diff options
author | Mark Brown <broonie@kernel.org> | 2023-07-28 00:26:12 +0100 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2023-08-04 17:36:52 +0100 |
commit | d6da04b6fbabf4b464bfe29e34ff10c62024d1e4 (patch) | |
tree | 01e35e70dbf61386a4d0d1c7a3a98855f16a93f2 /tools/include/linux/compiler.h | |
parent | d1890517ac751a427b962caddda91ecc2bbf21d0 (diff) |
kselftest/arm64: Exit streaming mode after collecting signal context
When we collect a signal context with one of the SME modes enabled we will
have enabled that mode behind the compiler and libc's back so they may
issue some instructions not valid in streaming mode, causing spurious
failures.
For the code prior to issuing the BRK to trigger signal handling we need to
stay in streaming mode if we were already there since that's a part of the
signal context the caller is trying to collect. Unfortunately this code
includes a memset() which is likely to be heavily optimised and is likely
to use FP instructions incompatible with streaming mode. We can avoid this
happening by open coding the memset(), inserting a volatile assembly
statement to avoid the compiler recognising what's being done and doing
something in optimisation. This code is not performance critical so the
inefficiency should not be an issue.
After collecting the context we can simply exit streaming mode, avoiding
these issues. Use a full SMSTOP for safety to prevent any issues appearing
with ZA.
Reported-by: Will Deacon <will@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230728-arm64-signal-memcpy-fix-v4-1-0c1290db5d46@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'tools/include/linux/compiler.h')
0 files changed, 0 insertions, 0 deletions