mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Abel Bernabeu" <abelbg@m2grp.com>
To: linux-kernel@vger.kernel.org
Subject: [Patch] Elf loader crash while zero-filling .bss
Date: Mon, 11 Feb 2008 19:27:35 +0100	[thread overview]
Message-ID: <15577be70802111027s59bc16f7q7c0be42cc44f9ad7@mail.gmail.com> (raw)

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);

             reply	other threads:[~2008-02-11 18:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-11 18:27 Abel Bernabeu [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15577be70802111027s59bc16f7q7c0be42cc44f9ad7@mail.gmail.com \
    --to=abelbg@m2grp.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®