Gentoo Archives: gentoo-hardened

From: "Anthony G. Basile" <blueness@g.o>
To: "Brian S. Stephan" <bss@×××××××××××.org>
Cc: gentoo-hardened@l.g.o
Subject: [gentoo-hardened] Re: Question about a hardened-sources patch hunk
Date: Fri, 14 Dec 2012 00:02:23
Message-Id: 50CA491C.7090604@gentoo.org
1 On 12/13/2012 11:46 AM, Brian S. Stephan wrote:
2 > Hi,
3 >
4 > Sorry for the direct email, this wasn't really a bug per se so I didn't
5 > feel it appropriate to open up something on bugs.gentoo.org.
6 >
7 > I was having a problem getting hardened-sources-3.5.4-r1 to boot on a
8 > Linode (a Xen hypervisor VPS, if you're not familiar) using PV-GRUB, and
9 > after some debugging I whittled it down to PV-GRUB not loading the kernel
10 > properly on 1024 MB RAM systems --- the identical .config worked fine on
11 > my 512 MB nodes, and merely limiting the 1024 MB node to 512 MB made that
12 > kernel boot.
13 >
14 > Playing around with configs, I found that the following made the kernel
15 > boot on 1024 MB:
16 >
17 > http://www.incorporeal.org/~bss/linode/ZZZZ-diff-between-0-and-G-plus-patch
18 >
19 > It just sets the PHYSICAL_START and PHYSICAL_ALIGN ranges back to their
20 > original values. I have been running with that patch for a month now with
21 > no noticed downside.
22 >
23 > I'm willing to chalk this all up to a PV-GRUB bug, but curiosity got the
24 > better of me and I started looking at the patch, and was curious what
25 > effect changing those ranges has? The patch hardly makes reference to
26 > either config setting, other than changing the range.
27 >
28 > Anyway, this is more just to satisfy my poking around more than anything
29 > else. Any thoughts or info you have would certainly be interesting ---
30 > and I'm fine with applying this patch myself in the future, so I'm not
31 > necessarily looking for "a fix".
32 >
33 > Thanks,
34 > bss
35
36
37 Okay, I'm mostly guessing here, but I think this is right. PV-GRUB is a
38 multiboot loader as grub is and it expects the kernel to comply with
39 certain standard. For some reason (bug?) it can't handle a kernel with
40 a physical start address at 0x1000000. Grub, and probably PV-GRUB,
41 looks for a sentinel word MBOOT_HEADER_MAGIC = 0x1BADB002 and knows this
42 is the start of the kernel --- something like 32 bytes in is where it
43 places _start: PV-GRUB must fail when it has to look all the way up to
44 0x1000000 but succeeds in finding the sentinel by 0x100000.
45
46 If you really want to nail it, create a tiny bootable kernel using
47 Molloy's code at
48 http://www.jamesmolloy.co.uk/tutorial_html/2.-Genesis.html. Play with
49 the linker script link.ld and keep increasing the beginning of the .text
50 section. See at what point PV-GRUB fails. That'll be your answer.
51 Then, if you really have lots of time on your hand, read PV-GRUB code
52 and see why :)
53
54 On a different note, bug the linode people for hardened gentoo because I
55 did and they ignored me. I'll build the image for them and everything
56 ... are their engineers really that lazy?
57
58 BTW, you can send these sorts of questions to gentoo-hardened@ there are
59 other people that are inerested.
60
61 --
62 Anthony G. Basile, Ph.D.
63 Gentoo Linux Developer [Hardened]
64 E-Mail : blueness@g.o
65 GnuPG FP : 8040 5A4D 8709 21B1 1A88 33CE 979C AF40 D045 5535
66 GnuPG ID : D0455535

Replies

Subject Author
Re: [gentoo-hardened] Re: Question about a hardened-sources patch hunk Maxim Kammerer <mk@×××.su>