aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakpm@osdl.org <akpm@osdl.org>2005-10-11 11:29:08 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-11 12:46:54 -0400
commit6de505173e24e76bb33a2595312e0c2b44d49e58 (patch)
tree0d06e061a70b337627b7e83985d736c0b4f50f33
parenta0c111c631e7ab4abd68920debd44259160812ef (diff)
[PATCH] binfmt_elf bss padding fix
Nir Tzachar <tzachar@cs.bgu.ac.il> 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 <roland@redhat.com> Cc: Daniel Jacobowitz <dan@debian.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/binfmt_elf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 7976a238f0a3..d4b15576e584 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -905,7 +905,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)
905 send_sig(SIGKILL, current, 0); 905 send_sig(SIGKILL, current, 0);
906 goto out_free_dentry; 906 goto out_free_dentry;
907 } 907 }
908 if (padzero(elf_bss)) { 908 if (likely(elf_bss != elf_brk) && unlikely(padzero(elf_bss))) {
909 send_sig(SIGSEGV, current, 0); 909 send_sig(SIGSEGV, current, 0);
910 retval = -EFAULT; /* Nobody gets to see this, but.. */ 910 retval = -EFAULT; /* Nobody gets to see this, but.. */
911 goto out_free_dentry; 911 goto out_free_dentry;