Commit 2e8a1acea859 ("arm64: signal: Improve POR_EL0 handling to
avoid uaccess failures") introduced special handling for EL0 registers
that impact uaccess. This did not however handle the case where a signal
handler removes the relevant record (poe_context for POE) from the
signal frame; this is clearly not typical behaviour but it is legal.
That commit resulted in arbitrary data from the kernel stack being
written to POR_EL0 in that case.Patch 1 fixes this by tracking which fields in struct user_access_state are actually valid. This restores the original behaviour, where POR_EL0 is left untouched if poe_context is removed. The remaining patches add new tests to the arm64 signal kselftests to check that POR_EL0 is reset and restored (or preserved) as expected. --- Cc: Catalin Marinas <[email protected]> Cc: Joey Gouly <[email protected]> Cc: Mark Brown <[email protected]> Cc: Shuah Khan <[email protected]> Cc: Will Deacon <[email protected]> Cc: [email protected] --- Kevin Brodsky (4): arm64: signal: Preserve POR_EL0 if poe_context is missing kselftest/arm64: Add POE as a feature in the signal tests kselftest/arm64: Add POE helpers to test_signals_utils.h kselftest/arm64: Add tests for POR_EL0 save/reset/restore arch/arm64/kernel/signal.c | 19 +++-- .../selftests/arm64/signal/test_signals.h | 2 + .../arm64/signal/test_signals_utils.c | 3 + .../arm64/signal/test_signals_utils.h | 16 ++++ .../testcases/poe_missing_poe_context.c | 73 +++++++++++++++++++ .../arm64/signal/testcases/poe_restore.c | 64 ++++++++++++++++ .../arm64/signal/testcases/poe_siginfo.c | 15 ---- 7 files changed, 172 insertions(+), 20 deletions(-) create mode 100644 tools/testing/selftests/arm64/signal/testcases/poe_missing_poe_context.c create mode 100644 tools/testing/selftests/arm64/signal/testcases/poe_restore.c base-commit: 028ef9c96e96197026887c0f092424679298aae8 -- 2.51.2

