[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1298904783-4291-1-git-send-email-ludwig.nussel@suse.de>
Date: Mon, 28 Feb 2011 15:53:03 +0100
From: Ludwig Nussel <ludwig.nussel@...e.de>
To: linux-kernel@...r.kernel.org
Cc: Ludwig Nussel <ludwig.nussel@...e.de>,
Thomas Gleixner <tglx@...utronix.de> (maintainer:X86
ARCHITECTURE...),
Ingo Molnar <mingo@...hat.com> (maintainer:X86 ARCHITECTURE...),
"H. Peter Anvin" <hpa@...or.com> (maintainer:X86 ARCHITECTURE...),
x86@...nel.org (maintainer:X86 ARCHITECTURE...)
Subject: [PATCH] fix mmap random address range on x86 (try2)
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@...e.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;
}
--
1.7.3.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists