[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240305221824.3300322-1-jeremy.linton@arm.com>
Date: Tue, 5 Mar 2024 16:18:23 -0600
From: Jeremy Linton <jeremy.linton@....com>
To: linux-arm-kernel@...ts.infradead.org
Cc: catalin.marinas@....com,
will@...nel.org,
keescook@...omium.org,
Jason@...c4.com,
gustavoars@...nel.org,
mark.rutland@....com,
rostedt@...dmis.org,
arnd@...db.de,
broonie@...nel.org,
guohui@...ontech.com,
Manoj.Iyer@....com,
linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org,
Jeremy Linton <jeremy.linton@....com>
Subject: [PATCH 0/1] Bring kstack randomized perf closer to unrandomized
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
Powered by blists - more mailing lists