* [tip:x86/mm] x86: Fix mmap random address range
[not found] <201111152246.pAFMklOB028527@wpaz5.hot.corp.google.com>
@ 2011-12-05 17:52 ` tip-bot for Ludwig Nussel
2011-12-07 12:29 ` Valdis.Kletnieks
0 siblings, 1 reply; 2+ messages in thread
From: tip-bot for Ludwig Nussel @ 2011-12-05 17:52 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, torvalds, akpm, tglx, ludwig.nussel,
harvey.harrison, mingo
Commit-ID: 9af0c7a6fa860698d080481f24a342ba74b68982
Gitweb: http://git.kernel.org/tip/9af0c7a6fa860698d080481f24a342ba74b68982
Author: Ludwig Nussel <ludwig.nussel@suse.de>
AuthorDate: Tue, 15 Nov 2011 14:46:46 -0800
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 5 Dec 2011 17:07:23 +0100
x86: Fix mmap random address range
On x86_32 casting the unsigned int result of get_random_int() to
long may result in a negative value. On x86_32 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 675a081 ("x86: unify mmap_{32|64}.c")
in January 2008.
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: harvey.harrison@gmail.com
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/201111152246.pAFMklOB028527@wpaz5.hot.corp.google.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
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 4b5ba85..845df68 100644
--- a/arch/x86/mm/mmap.c
+++ b/arch/x86/mm/mmap.c
@@ -75,9 +75,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;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [tip:x86/mm] x86: Fix mmap random address range
2011-12-05 17:52 ` [tip:x86/mm] x86: Fix mmap random address range tip-bot for Ludwig Nussel
@ 2011-12-07 12:29 ` Valdis.Kletnieks
0 siblings, 0 replies; 2+ messages in thread
From: Valdis.Kletnieks @ 2011-12-07 12:29 UTC (permalink / raw)
To: mingo, hpa, linux-kernel, torvalds, akpm, tglx, ludwig.nussel,
harvey.harrison, mingo
Cc: linux-tip-commits
[-- Attachment #1: Type: text/plain, Size: 809 bytes --]
On Mon, 05 Dec 2011 09:52:17 PST, tip-bot for Ludwig Nussel said:
> Commit-ID: 9af0c7a6fa860698d080481f24a342ba74b68982
> Gitweb: http://git.kernel.org/tip/9af0c7a6fa860698d080481f24a342ba74b68982
> Author: Ludwig Nussel <ludwig.nussel@suse.de>
> AuthorDate: Tue, 15 Nov 2011 14:46:46 -0800
> Committer: Ingo Molnar <mingo@elte.hu>
> CommitDate: Mon, 5 Dec 2011 17:07:23 +0100
>
> x86: Fix mmap random address range
>
> On x86_32 casting the unsigned int result of get_random_int() to
> long may result in a negative value. On x86_32 the range of
> mmap_rnd() therefore was -255 to 255. The 32bit mode on x86_64
> used 0 to 255 as intended.
Will somebody please hand me a big dose of caffeine and explain to me
how the range could have been -255 to 255? -256 maybe, or -128 to 127,
but -255??!?
[-- Attachment #2: Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-12-07 12:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <201111152246.pAFMklOB028527@wpaz5.hot.corp.google.com>
2011-12-05 17:52 ` [tip:x86/mm] x86: Fix mmap random address range tip-bot for Ludwig Nussel
2011-12-07 12:29 ` Valdis.Kletnieks
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