mbox series

[v3,0/4] arm64/signal: Support TPIDR2

Message ID 20221208-arm64-tpidr2-sig-v3-0-c77c6c8775f4@kernel.org
Headers show
Series arm64/signal: Support TPIDR2 | expand

Message

Mark Brown Dec. 27, 2022, 2:20 p.m. UTC
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:
 - Rebase onto v6.2-rc1.
v2:
 - Rebase onto v6.1-rc3.
 - Change the signal frame magic to 0x54504902 (TPI).

To: Catalin Marinas <catalin.marinas@arm.com>
To: Will Deacon <will@kernel.org>
To: Shuah Khan <shuah@kernel.org>
Cc: Szabolcs Nagy <szabolcs.nagy@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kselftest@vger.kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>

---
Mark Brown (4):
      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/uapi/asm/sigcontext.h           |  8 ++
 arch/arm64/kernel/signal.c                         | 59 ++++++++++++++
 tools/testing/selftests/arm64/signal/.gitignore    |  1 +
 .../selftests/arm64/signal/testcases/testcases.c   |  4 +
 .../arm64/signal/testcases/tpidr2_siginfo.c        | 90 ++++++++++++++++++++++
 6 files changed, 165 insertions(+)
---
base-commit: 1b929c02afd37871d5afb9d498426f83432e71c2
change-id: 20221208-arm64-tpidr2-sig-8fbb93725d8e

Best regards,

Comments

Catalin Marinas Jan. 20, 2023, 5:02 p.m. UTC | #1
On Tue, 27 Dec 2022 14:20:40 +0000, Mark Brown wrote:
> 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.
> 
> [...]

Applied to arm64 (for-next/tpidr2), thanks!

[1/4] arm64/sme: Document ABI for TPIDR2 signal information
      https://git.kernel.org/arm64/c/17d0c4a27b2a
[2/4] arm64/signal: Include TPIDR2 in the signal context
      https://git.kernel.org/arm64/c/39e54499280f
[3/4] kselftest/arm64: Add TPIDR2 to the set of known signal context records
      https://git.kernel.org/arm64/c/bae393dabf35
[4/4] kselftest/arm64: Add test case for TPIDR2 signal frame records
      https://git.kernel.org/arm64/c/8ced92801935

I'll look at the signal handling clean-up patches as well but they
probably conflicts with this series and may need to be rebased on top.