[Lguest] mercurial repo

Rusty Russell rusty at rustcorp.com.au
Tue Jul 31 20:36:20 EST 2007


On Mon, 2007-07-30 at 08:55 -0700, ron minnich wrote:
> Ok, my problem on FC7 is that ld.so is mapping libc at low memory. The
> second mmap is mapping /dev/zero over that area, as we ask it to. So,
> the mmap happens, and libc kind of goes away and is replaced by zeros
> ... this is "bad". How to get ld.so to map "up there"? Is this a
> Fedora Core-ism at work? I have seen no other reports of this problem.
> 
> My fix is
> LDFLAGS+=-static
> 
> in lguest Makefile. Patch attached. Ugly, no? This patch also includes
> the  'read elf section in if mmap fails" which now lets me boot plan 9
> until it hits the 0x40 GPF.

Hmm, can you do me a favour?

	Can you put a "system("cat /proc/$PPID/maps")" in the start of the
launcher program and send the output?  I'd love to compare it with here.

The short-term fix for 2.6.23 will have to be to add that -static.  The
longer term is to give an address, size and offset to the kernel, so we
can use a non-fixed mmap.

> Note that my fix is pretty simple. Ask kernel to mmap, if kernel does
> not mmap, well, then try to read section in. I could get all fancy and
> check for nonaligned sections etc. myself but, hey, that's the
> kernel's job (or, much to my surprise, it seems libc thinks it is also
> libc's job..., as revealed by stepi, but that just makes me less
> inclined to add my own checking, on top of the two layers of checking
> already there).

Yeah, libc confused me once with that checking.  I'd prefer the mmap &
read fallback to be hoisted into a separate function (it can also be
used for the initrd).  Something like "void place_file(int fd, void
*addr, unsigned len)"?

BTW, I don't think the mmap len args needs to be extended to page-align
(see the initrd code, and
http://www.opengroup.org/onlinepubs/000095399/functions/mmap.html ).

Thanks!
Rusty.




More information about the Lguest mailing list