Re: Fix handling of ELF segments with zero filesize

From: H. Peter Anvin
Date: Wed Nov 30 2005 - 19:26:07 EST


David Gibson wrote:
Andrew, please apply

mmap() returns -EINVAL if given a zero length, and thus elf_map() in
binfmt_elf.c does likewise if it attempts to map a (page-aligned) ELF
segment with zero filesize. Such a situation never arises with the
default linker scripts, but there's nothing inherently wrong with
zero-filesize (but non-zero memsize) ELF segments. Custom linker
scripts can generate them, and the kernel should be able to map them;
this patch makes it so.


More than that: even with some versions of the default linker scripts they can be created, according to reports I have received on the klibc mailing list. It just doesn't happen with glibc binaries.

This is a real bug and should be fixed.

-hpa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/