mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [Patch] Elf loader crash while zero-filling .bss
@ 2008-02-11 18:27 Abel Bernabeu
  2008-02-11 18:32 ` Abel Bernabeu
  2008-02-11 18:53 ` Sam Ravnborg
  0 siblings, 2 replies; 8+ messages in thread
From: Abel Bernabeu @ 2008-02-11 18:27 UTC (permalink / raw)
  To: linux-kernel

I've finally found a solution for the crash in load_binary_elf I
reported last week:

http://lkml.org/lkml/2008/1/30/171

The attached patch solves my problem, but please test it yourself...

set_brk(start, end) allocs just page aligned regions (by "colapsing"
both extremes to the start of the page in which they lay)... That
means than even if both pointers are not equal there are still some
chances that set_brk has allocated no space at all because
ELF_PAGEALIGN(elf_bss) != ELF_PAGEALIGN(elf_brk).

So the condition was not correct.


--- linux-2.6.22.10.orig/fs/binfmt_elf.c	2008-02-11 18:58:29.000000000 +0100
+++ linux-2.6.22.10.hacked/fs/binfmt_elf.c	2008-02-11 16:09:41.000000000 +0100
@@ -939,3 +939,3 @@ static int load_elf_binary(struct linux_
 	}
-	if (likely(elf_bss != elf_brk) && unlikely(padzero(elf_bss))) {
+	if (likely(ELF_PAGEALIGN(elf_bss) != ELF_PAGEALIGN(elf_brk)) &&
unlikely(padzero(elf_bss))) {
 		send_sig(SIGSEGV, current, 0);

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-02-11 22:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-11 18:27 [Patch] Elf loader crash while zero-filling .bss Abel Bernabeu
2008-02-11 18:32 ` Abel Bernabeu
2008-02-11 18:47   ` Jiri Kosina
     [not found]     ` <15577be70802111111x36f61433p321e5b8175a13d08@mail.gmail.com>
2008-02-11 19:28       ` Jiri Kosina
2008-02-11 20:35         ` H. Peter Anvin
2008-02-11 20:40           ` Jiri Kosina
2008-02-11 22:14             ` Andreas Schwab
2008-02-11 18:53 ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome