Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 1 Oct 2013 14:18:22 -0700
From: Kees Cook <keescook@...omium.org>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: LKML <linux-kernel@...r.kernel.org>, "x86@...nel.org" <x86@...nel.org>, 
	"kernel-hardening@...ts.openwall.com" <kernel-hardening@...ts.openwall.com>, Aaron Durbin <adurbin@...gle.com>, 
	Eric Northup <digitaleric@...gle.com>, Julien Tinnes <jln@...gle.com>, Will Drewry <wad@...gle.com>, 
	Mathias Krause <minipli@...glemail.com>, Zhang Yanfei <zhangyanfei@...fujitsu.com>
Subject: Re: [PATCH 4/7] x86, kaslr: select random base offset

On Tue, Oct 1, 2013 at 1:46 PM, H. Peter Anvin <hpa@...or.com> wrote:
> On 10/01/2013 12:37 PM, Kees Cook wrote:
>> +
>> +#include <asm/archrandom.h>
>> +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:"
>> +                  : "=r" (ok), "=a" (*v)
>> +                  : "0" (RDRAND_RETRY_LOOPS));
>> +     return ok;
>> +}
>> +
>
> This looks just like rdrand_long() in arch/x86/kernel/cpu/rdrand.c and
> could move into the header file, no?

Yes, good idea. I'll move it into archrandom.h instead of this copy/paste.

-Kees

-- 
Kees Cook
Chrome OS Security

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.