[PATCH v3 0/5] arm64/signal: Support TPIDR2

Mark Brown broonie at kernel.org
Fri Nov 18 08:22:19 PST 2022


When SME support was merged support for TPIDR2 in signal frames was
omitted, meaning that it was not possible for signal handers to inspect
or modify it. This will present an issue for programs using signals to
implement lightweight threads so let's provide access to TPIDR2 in
signal handlers.

Implement a new record type for TPIDR2 using the same format as we use
for ESR and add coverage to make sure that this appears in the signal
context as expected.  Due to TPIDR2 being reserved for libc we only
validate that the value is unchanged, meaning we're likely to just be
validating the default value of 0 on current systems. I have tested with
a modified version that sets an explicit value.

v3:
 - Load restored TPIDR2 value into the register to ensure that
   any changes requested by userspace are reflected in the case
   where we don't context switch before we return to userspace.
 - Use tls_preserve_current_state() to sync TPIDR2 state to the
   task struct.
 - Use system_supports_tpidr2().
 - Fix mangled comment.
 - Update comment on prototype for tls_preserve_current_state().
v2:
 - Rebase onto v6.1-rc3.
 - Change the signal frame magic to 0x54504902 (TPI).

Mark Brown (5):
  arm64/processor: Update documentation for tls_preserve_current_state()
  arm64/sme: Document ABI for TPIDR2 signal information
  arm64/signal: Include TPIDR2 in the signal context
  kselftest/arm64: Add TPIDR2 to the set of known signal context records
  kselftest/arm64: Add test case for TPIDR2 signal frame records

 Documentation/arm64/sme.rst                   |  3 +
 arch/arm64/include/asm/processor.h            |  2 +-
 arch/arm64/include/uapi/asm/sigcontext.h      |  8 ++
 arch/arm64/kernel/signal.c                    | 61 +++++++++++++
 .../testing/selftests/arm64/signal/.gitignore |  1 +
 .../arm64/signal/testcases/testcases.c        |  4 +
 .../arm64/signal/testcases/tpidr2_siginfo.c   | 90 +++++++++++++++++++
 7 files changed, 168 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/arm64/signal/testcases/tpidr2_siginfo.c


base-commit: 30a0b95b1335e12efef89dd78518ed3e4a71a763
-- 
2.30.2




More information about the linux-arm-kernel mailing list