Re: [PATCH v3] x86: Use `get_random_u8' for kernel stack offset randomization

From: Maciej W. Rozycki
Date: Wed Feb 22 2023 - 07:06:45 EST


On Tue, 14 Feb 2023, Jason A. Donenfeld wrote:

> > > Please provide numbers on contemporary hardware.
> >
> > Jason, is this something you could help me with to back up your claim?
> >
> > My access to modern x86 gear is limited and I just don't have anything I
> > can randomly fiddle with (I guess an Intel Core 2 Duo T5600 processor back
> > from 2008 doesn't count as "contemporary", does it?).
>
> I imagine tglx wants real life performance numbers rather than a
> microbench of the rng. So the thing to do would be to exercise
> arch_exit_to_user_mode() a bunch. Does this trigger on every syscall,
> even invalid ones? If so, you could make a test like:
>
> #include <sys/syscall.h>
> #include <unistd.h>
>
> int main(int argc, char *argv[])
> {
> for (int i = 0; i < (1 << 26); ++i)
> syscall(0xffffffff);
> return 0;
> }
>
> And then see if the timing changes across your patch.

Thanks. Though that does not solve my lack of suitable hardware, sigh.
It's not like I have x86 systems scattered all over the place. I guess I
could try to benchmark with said T5600 piece, but it won't be until April
the earliest as I'm away most of the time.

Maciej