]> git.karo-electronics.de Git - karo-tx-linux.git/commit
x86: Fix mmap random address range
authorLudwig Nussel <ludwig.nussel@suse.de>
Tue, 15 Nov 2011 22:46:46 +0000 (14:46 -0800)
committerWilly Tarreau <w@1wt.eu>
Sat, 11 Feb 2012 14:40:49 +0000 (15:40 +0100)
commitad6e2b74568f82e902aa066982f22a3723929bb4
treeedeb0c9f281f43a848ea2903c798ed510d2943df
parent93050f523a0e91d818dc7290454a8ea746884ecd
x86: Fix mmap random address range

commit 9af0c7a6fa860698d080481f24a342ba74b68982 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Willy Tarreau <w@1wt.eu>
arch/x86/mm/mmap.c