From: Daniel Jacobowitz <dan@debian.org>
To: akpm@linux-foundation.org
Cc: mm-commits@vger.kernel.org, abelbg@m2grp.com, hpa@zytor.com,
jkosina@suse.cz, roland@redhat.com, schwab@suse.de,
stable@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: + elf-loader-crash-while-zero-filling-bss.patch added to -mm tree
Date: Wed, 13 Feb 2008 09:37:01 -0500 [thread overview]
Message-ID: <20080213143701.GA21800@caradoc.them.org> (raw)
In-Reply-To: <200802130816.m1D8GSep015744@imap1.linux-foundation.org>
On Wed, Feb 13, 2008 at 12:15:06AM -0800, akpm@linux-foundation.org wrote:
> Subject: Elf loader crash while zero-filling .bss
> From: "Abel Bernabeu" <abelbg@m2grp.com>
>
> 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.
>
> set_brk(start, end) allocs just page aligned regions (by "collapsing" 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.
This patch is wrong.
ELF_PAGEALIGN rounds up to the end of the page, not down to the start
of the page. If elf_bss is in the middle of a page, set_brk allocates
any additional pages after the one already allocated. elf_bss is the
start of the area that needs to be zero initialized, elf_brk is its
end. So if elf_bss != elf_brk then there's garbage mapped in BSS
from the file and if you don't clear it some of your zero-initialized
variables won't be zero initialized at all.
In the linked message, set_brk is passed elf_bss so its actual
arguments are set_brk (0xa3801, 0x000a4ec8). It should map one
page. 0xa3801 should be an already mapped page, and clear_user should
succeed in clearing it.
--
Daniel Jacobowitz
CodeSourcery
next prev parent reply other threads:[~2008-02-13 15:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-13 8:15 + elf-loader-crash-while-zero-filling-bss.patch added to -mm tree akpm
2008-02-13 14:37 ` Daniel Jacobowitz [this message]
2008-02-14 10:03 ` Abel Bernabeu
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=20080213143701.GA21800@caradoc.them.org \
--to=dan@debian.org \
--cc=abelbg@m2grp.com \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=jkosina@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=mm-commits@vger.kernel.org \
--cc=roland@redhat.com \
--cc=schwab@suse.de \
--cc=stable@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.