From: Jiri Kosina <jkosina@suse.cz>
To: Ingo Molnar <mingo@elte.hu>, Andrew Morton <akpm@linux-foundation.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] brk: fix min_brk lower bound computation for COMPAT_BRK
Date: Mon, 3 Jan 2011 12:39:29 +0100 (CET) [thread overview]
Message-ID: <alpine.LNX.2.00.1101031237210.26685@pobox.suse.cz> (raw)
In-Reply-To: <alpine.LNX.2.00.1101030002390.26685@pobox.suse.cz>
On Mon, 3 Jan 2011, Jiri Kosina wrote:
> Even if CONFIG_COMPAT_BRK is set in the kernel configuration, it can still
> be overriden by randomize_va_space sysctl.
>
> If this is the case, the min_brk computation in sys_brk() implementation
> is wrong, as it solely takes into account COMPAT_BRK setting, assuming
> that brk start is not randomized. But that might not be the case if
> randomize_va_space sysctl has been set to '2' at the time the binary has
> been loaded from disk.
>
> In such case, the check has to be done in a same way as in
> !CONFIG_COMPAT_BRK case.
>
> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
> ---
> mm/mmap.c | 10 +++++++++-
> 1 files changed, 9 insertions(+), 1 deletions(-)
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 50a4aa0..35d9f9c 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -253,7 +253,15 @@ SYSCALL_DEFINE1(brk, unsigned long, brk)
> down_write(&mm->mmap_sem);
>
> #ifdef CONFIG_COMPAT_BRK
> - min_brk = mm->end_code;
> + /*
> + * CONFIG_COMPAT_BRK can still be overridden by setting
> + * randomize_va_space to 2, which will still make mm->start_brk
> + * to be arbitrarily shifted
> + */
> + if (mm->start_brk > mm->end_code)
> + min_brk = mm->start_brk;
> + else
> + min_brk = mm->end_code;
> #else
> min_brk = mm->start_brk;
> #endif
Hmm, actually no, that will bring us back into pre-a5b4592c era, please
disregard that.
I will have to come up with something more clever (we can't just check
'randomize_va_space == 2', as that would be racy for already running
programs).
--
Jiri Kosina
SUSE Labs, Novell Inc.
next prev parent reply other threads:[~2011-01-03 11:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-02 23:05 Jiri Kosina
2011-01-03 11:39 ` Jiri Kosina [this message]
2011-01-03 13:24 ` [PATCH v2] " Jiri Kosina
2011-03-24 21:49 ` [regression v2.6.38] " Geert Uytterhoeven
2011-03-25 10:20 ` Jiri Kosina
2011-03-26 13:51 ` Geert Uytterhoeven
2011-03-28 14:20 ` Jiri Kosina
2011-03-29 20:24 ` Geert Uytterhoeven
2011-03-29 20:37 ` Andreas Schwab
2011-04-06 20:08 ` Jiri Kosina
2011-04-06 20:23 ` Geert Uytterhoeven
2011-04-06 20:38 ` [PATCH] brk: COMPAT_BRK: fix detection of randomized brk (was Re: [regression v2.6.38] Re: [PATCH v2] brk: fix min_brk lower bound computation forCOMPAT_BRK) Jiri Kosina
2011-04-06 20:40 ` Geert Uytterhoeven
2011-04-06 20:42 ` Jiri Kosina
2011-03-29 12:02 ` [regression v2.6.38] Re: [PATCH v2] brk: fix min_brk lower bound computation for COMPAT_BRK Jiri Kosina
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=alpine.LNX.2.00.1101031237210.26685@pobox.suse.cz \
--to=jkosina@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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®