RE: [PATCH] x86/entry/64: randomize kernel stack offset upon syscall

From: Reshetova, Elena
Date: Fri May 03 2019 - 12:18:03 EST


> * David Laight <David.Laight@xxxxxxxxxx> wrote:
>
> > It has already been measured - it is far too slow.
>
> I don't think proper buffering was tested, was it? Only a per syscall
> RDRAND overhead which I can imagine being not too good.
>

Well, I have some numbers, but I am struggling to understand one
aspect there.

So, this is how it looks when PAGE_TABLE_ISOLATION is off:

base: Simple syscall: 0.0516 microseconds
rdrand (calling every 8 syscalls): Simple syscall: 0.0795 microseconds
get_random_bytes (4096 bytes buffer): Simple syscall: 0.0597 microseconds

But then it looks like this with PAGE_TABLE_ISOLATION is on:

base: Simple syscall: 0.1761 microseconds
get_random_bytes (4096 bytes buffer): Simple syscall: 0.1793 microseconds
get_random_bytes (64 bytes buffer): Simple syscall: 0.1866 microseconds
rdrand (calling every 8 syscalls): Simple syscall: 0.3131 microseconds

So, suddenly calling rdrand is much more pricey...
Either smth is really weird going on when PAGE_TABLE is enabled, or
I managed to do smth wrongly (no idea what although). I will continue
Investigating.

Best Regards,
Elena.