commit | 6de505173e24e76bb33a2595312e0c2b44d49e58 | [log] [tgz] |
---|---|---|
author | [email protected] <[email protected]> | Tue Oct 11 08:29:08 2005 -0700 |
committer | Linus Torvalds <[email protected]> | Tue Oct 11 09:46:54 2005 -0700 |
tree | 0d06e061a70b337627b7e83985d736c0b4f50f33 | |
parent | a0c111c631e7ab4abd68920debd44259160812ef [diff] [blame] |
[PATCH] binfmt_elf bss padding fix Nir Tzachar <[email protected]> points out that if an ELF file specifies a zero-length bss at a whacky address, we cannot load that binary because padzero() tries to zero out the end of the page at the whacky address, and that may not be writeable. See also http://bugzilla.kernel.org/show_bug.cgi?id=5411 So teach load_elf_binary() to skip the bss settng altogether if the elf file has a zero-length bss segment. Cc: Roland McGrath <[email protected]> Cc: Daniel Jacobowitz <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 7976a23..d4b1557 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c
@@ -905,7 +905,7 @@ send_sig(SIGKILL, current, 0); goto out_free_dentry; } - if (padzero(elf_bss)) { + if (likely(elf_bss != elf_brk) && unlikely(padzero(elf_bss))) { send_sig(SIGSEGV, current, 0); retval = -EFAULT; /* Nobody gets to see this, but.. */ goto out_free_dentry;