From: Jeremy Linton <jeremy.linton@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: catalin.marinas@arm.com, will@kernel.org, keescook@chromium.org,
Jason@zx2c4.com, gustavoars@kernel.org, mark.rutland@arm.com,
rostedt@goodmis.org, arnd@arndb.de, broonie@kernel.org,
guohui@uniontech.com, Manoj.Iyer@arm.com,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org,
Jeremy Linton <jeremy.linton@arm.com>
Subject: [PATCH 0/1] Bring kstack randomized perf closer to unrandomized
Date: Tue, 5 Mar 2024 16:18:23 -0600 [thread overview]
Message-ID: <20240305221824.3300322-1-jeremy.linton@arm.com> (raw)
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
next reply other threads:[~2024-03-05 22:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-05 22:18 Jeremy Linton [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240305221824.3300322-1-jeremy.linton@arm.com \
--to=jeremy.linton@arm.com \
--cc=Jason@zx2c4.com \
--cc=Manoj.Iyer@arm.com \
--cc=arnd@arndb.de \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=guohui@uniontech.com \
--cc=gustavoars@kernel.org \
--cc=keescook@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=rostedt@goodmis.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).