x86, kaslr: Mix entropy sources together as needed
authorKees Cook <keescook@chromium.org>
Mon, 11 Nov 2013 22:28:39 +0000 (14:28 -0800)
committerH. Peter Anvin <hpa@zytor.com>
Tue, 12 Nov 2013 06:29:44 +0000 (22:29 -0800)
commita653f3563c51c7bb7de63d607bef09d3baddaeb8
treebb431f947a59f2301aa81e9f347dc8b531b524b4
parentaec58bafaf89279522c44ec8ca9211eabb2b6976
x86, kaslr: Mix entropy sources together as needed

Depending on availability, mix the RDRAND and RDTSC entropy together with
XOR. Only when neither is available should the i8254 be used. Update
the Kconfig documentation to reflect this. Additionally, since bits
used for entropy is masked elsewhere, drop the needless masking in
the get_random_long(). Similarly, use the entire TSC, not just the low
32 bits.

Finally, to improve the starting entropy, do a simple hashing of a
build-time versions string and the boot-time boot_params structure for
some additional level of unpredictability.

Signed-off-by: Kees Cook <keescook@chromium.org>
Link: http://lkml.kernel.org/r/20131111222839.GA28616@www.outflux.net
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
arch/x86/Kconfig
arch/x86/boot/compressed/aslr.c