public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] Bring kstack randomized perf closer to unrandomized
@ 2024-03-05 22:18 Jeremy Linton
  2024-03-05 22:18 ` [PATCH 1/1] arm64: syscall: Direct PRNG kstack randomization Jeremy Linton
  0 siblings, 1 reply; 15+ messages in thread
From: Jeremy Linton @ 2024-03-05 22:18 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: catalin.marinas, will, keescook, Jason, gustavoars, mark.rutland,
	rostedt, arnd, broonie, guohui, Manoj.Iyer, linux-kernel,
	linux-hardening, Jeremy Linton

Currently with kstack randomization there is somewhere on the order of
5x worse variation in response latencies vs unrandomized
syscalls. This is down from ~10x on pre 6.2 kernels where the RNG
reseeding was moved out of the syscall path, but get_random_uXX()
still contains a fair amount of additional global state manipulation
which is problematic.

So, lets replace the full get_random_u16 in the syscall path with
prandom_u32_state(). This also has the advantage of bringing the
randomized and unrandomized overall syscall performace much closer
together. Although in the syscall path, prandom_u32_state() remains
measurably worse than other architectures relying on non-random
functions (cycle counters) with respect to perf/latency
measurements. By comparison, the algorithm presented in the RFC which
had basically no impact given recent OoO cores are able to hide all of
the overhead from the the handful of additional instructions.

I'm still looking for suggestions reseeding prandom_u32_state() if
needed or improving the performace of get_random_u16. so consider this
somewhate more than an RFC and maybe less of a full patch request.

RFC->V1:
	Replace custom inline RNG with prandom_u32_state

Jeremy Linton (1):
  arm64: syscall: Direct PRNG kstack randomization

 arch/arm64/kernel/syscall.c | 42 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 41 insertions(+), 1 deletion(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-03-23 12:47 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-05 22:18 [PATCH 0/1] Bring kstack randomized perf closer to unrandomized Jeremy Linton
2024-03-05 22:18 ` [PATCH 1/1] arm64: syscall: Direct PRNG kstack randomization Jeremy Linton
2024-03-05 23:33   ` Kees Cook
2024-03-06 20:46     ` Arnd Bergmann
2024-03-06 21:54       ` Jeremy Linton
2024-03-07 11:10         ` Arnd Bergmann
2024-03-07 19:10           ` Kees Cook
2024-03-07 21:56             ` Arnd Bergmann
2024-03-07 19:15           ` Kees Cook
2024-03-07 22:02             ` Arnd Bergmann
2024-03-08 16:49           ` Jeremy Linton
2024-03-08 20:29             ` Arnd Bergmann
2024-03-22 23:40               ` Jeremy Linton
2024-03-23 12:47                 ` Arnd Bergmann
2024-03-07 19:05   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox