[PATCH 4/7] x86, kaslr: select random base offset

2013-10-03 Thread Kees Cook
Select a random location when CONFIG_RANDOMIZE_BASE is used, bounded by CONFIG_RANDOMIZE_BASE_MAX_OFFSET. Sources of randomness currently include RDRAND, RDTSC, or the i8254. This moves the pre-alternatives inline rdrand function into the header so both pieces of code can use it. Availability of R

Re: [PATCH 4/7] x86, kaslr: select random base offset

2013-10-01 Thread Kees Cook
On Tue, Oct 1, 2013 at 1:46 PM, H. Peter Anvin wrote: > On 10/01/2013 12:37 PM, Kees Cook wrote: >> + >> +#include >> +static inline int rdrand(unsigned long *v) >> +{ >> + int ok; >> + asm volatile("1: " RDRAND_LONG "\n\t" >> + "jc 2f\n\t" >> + "decl %0\

Re: [PATCH 4/7] x86, kaslr: select random base offset

2013-10-01 Thread H. Peter Anvin
On 10/01/2013 12:37 PM, Kees Cook wrote: > + > +#include > +static inline int rdrand(unsigned long *v) > +{ > + int ok; > + asm volatile("1: " RDRAND_LONG "\n\t" > + "jc 2f\n\t" > + "decl %0\n\t" > + "jnz 1b\n\t" > + "2:"

[PATCH 4/7] x86, kaslr: select random base offset

2013-10-01 Thread Kees Cook
Select a random location when CONFIG_RANDOMIZE_BASE is used, bounded by CONFIG_RANDOMIZE_BASE_MAX_OFFSET. Sources of randomness currently include RDRAND, RDTSC, or the i8254. Signed-off-by: Kees Cook --- arch/x86/boot/compressed/aslr.c | 83 ++- arch/x86/boo