From: Andrew Morton <akpm@linux-foundation.org>
To: Ludwig Nussel <ludwig.nussel@suse.de>
Cc: linux-kernel@vger.kernel.org, security@kernel.org,
x86@kernel.org, Ingo Molnar <mingo@redhat.com>,
"H. Peter Anvin" <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [Security] [PATCH] fix mmap random address range on x86
Date: Mon, 28 Feb 2011 15:18:25 -0800 [thread overview]
Message-ID: <20110228151825.26458ec9.akpm@linux-foundation.org> (raw)
In-Reply-To: <1298034957-17128-1-git-send-email-ludwig.nussel@suse.de>
On Fri, 18 Feb 2011 14:15:57 +0100
Ludwig Nussel <ludwig.nussel@suse.de> wrote:
> On x86 casting the unsigned int result of get_random_int() to long
> may result in a negative value. On x86 the range of mmap_rnd()
> therefore was -255 to 255. The 32bit mode on x86_64 used 0 to 255 as
> intended.
>
> The bug was introduced by commit 675a081 in January 2008.
>
> Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
> ---
> arch/x86/mm/mmap.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
> index 1dab519..f927429 100644
> --- a/arch/x86/mm/mmap.c
> +++ b/arch/x86/mm/mmap.c
> @@ -87,9 +87,9 @@ static unsigned long mmap_rnd(void)
> */
> if (current->flags & PF_RANDOMIZE) {
> if (mmap_is_ia32())
> - rnd = (long)get_random_int() % (1<<8);
> + rnd = get_random_int() % (1<<8);
> else
> - rnd = (long)(get_random_int() % (1<<28));
> + rnd = get_random_int() % (1<<28);
> }
> return rnd << PAGE_SHIFT;
> }
The changelog didn't describe the user-visible consequences of this
bug, so readers must try to work this out for themselves. That's not a
very desirable or efficient thing, so please do prepare more complete
changelogs.
afacit the effects are very small: the mmap base may fall slightly
below MIN_GAP, but that won't really affect anything?
next prev parent reply other threads:[~2011-02-28 23:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-18 13:15 Ludwig Nussel
2011-02-28 23:18 ` Andrew Morton [this message]
2011-03-01 8:41 ` [Security] " Ludwig Nussel
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=20110228151825.26458ec9.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ludwig.nussel@suse.de \
--cc=mingo@redhat.com \
--cc=security@kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@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®