Skip to contentSkip to conversation

arm64/signal: Support TPIDR2

PATCH Superseded Mark Brown 3 participants 16 messages Oct 31, 2022 – Nov 23, 2022

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

v2 cover arm64/signal: Support TPIDR2

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.

v2:
- Rebase onto v6.1-rc3.
- Change the signal frame magic to 0x54504902 (TPI).

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 ++++++++++++
 .../testing/selftests/arm64/signal/.gitignore |  1 +
 .../arm64/signal/testcases/testcases.c        |  4 +
 .../arm64/signal/testcases/tpidr2_siginfo.c   | 90 +++++++++++++++++++
 6 files changed, 165 insertions(+)
 create mode 100644 tools/testing/selftests/arm64/signal/testcases/tpidr2_siginfo.c

base-commit: 30a0b95b1335e12efef89dd78518ed3e4a71a763

Signature · 7 lines
2.30.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author
#1 lore raw

PATCH v2 1/4 arm64/sme: Document ABI for TPIDR2 signal information

In order to allow access to TPIDR2 from signal handlers we need to add it to the signal context, document that we are doing so.

---
 Documentation/arm64/sme.rst | 3 +++
 1 file changed, 3 insertions(+)
Documentation/arm64/sme.rst +3 -0
index 16d2db4c2e2e..36b08a105dd1 100644
@@ -111,6 +111,9 @@ be zeroed.
 
 * Signal handlers are invoked with streaming mode and ZA disabled.
 
+* A new signal frame record TPIDR2_MAGIC is added formatted as a struct
+  tpidr2_context to allow access to TPIDR2_EL0 from signal handlers.
+
 * A new signal frame record za_context encodes the ZA register contents on
   signal delivery. [1]
 
Signature · 7 lines
2.30.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author
#2 lore raw

PATCH v2 2/4 arm64/signal: Include TPIDR2 in the signal context

In reply to Mark Brown

Add a new signal frame record for TPIDR2 using the same format as we already use for ESR with different magic, a header with the value from the register appended as the only data. If SME is supported then this record is always included.

---
 arch/arm64/include/uapi/asm/sigcontext.h |  8 ++++
 arch/arm64/kernel/signal.c               | 59 ++++++++++++++++++++++++
 2 files changed, 67 insertions(+)
arch/arm64/include/uapi/asm/sigcontext.h +8 -0
index 4aaf31e3bf16..46ce097ca8c0 100644
@@ -140,6 +140,14 @@ struct sve_context {
 
 #define SVE_SIG_FLAG_SM	0x1	/* Context describes streaming mode */
 
+/* TPIDR2_EL0 context */
+#define TPIDR2_MAGIC	0x54504902
+
+struct tpidr2_context {
+	struct _aarch64_ctx head;
+	__u64 tpidr2;
+};
+
 #define ZA_MAGIC	0x54366345
 
 struct za_context {
arch/arm64/kernel/signal.c +59 -0

113 lines not on this page · raw message

Signature · 7 lines
2.30.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer
#3 lore raw

Re: [PATCH v2 2/4] arm64/signal: Include TPIDR2 in the signal context

Quoted 52 lines · Mark Brown

Add a new signal frame record for TPIDR2 using the same format as we already use for ESR with different magic, a header with the value from the register appended as the only data. If SME is supported then this record is always included.

---
 arch/arm64/include/uapi/asm/sigcontext.h |  8 ++++
 arch/arm64/kernel/signal.c               | 59 ++++++++++++++++++++++++
 2 files changed, 67 insertions(+)
arch/arm64/include/uapi/asm/sigcontext.h +8 -0
index 4aaf31e3bf16..46ce097ca8c0 100644
@@ -140,6 +140,14 @@ struct sve_context {
 
 #define SVE_SIG_FLAG_SM	0x1	/* Context describes streaming mode */
 
+/* TPIDR2_EL0 context */
+#define TPIDR2_MAGIC	0x54504902
+
+struct tpidr2_context {
+	struct _aarch64_ctx head;
+	__u64 tpidr2;
+};
+
 #define ZA_MAGIC	0x54366345
 
 struct za_context {
arch/arm64/kernel/signal.c +2 -0
index 9ad911f1647c..ac4fb42a9613 100644
@@ -56,6 +56,7 @@ struct rt_sigframe_user_layout {
 	unsigned long fpsimd_offset;
 	unsigned long esr_offset;
 	unsigned long sve_offset;
+	unsigned long tpidr2_offset;
 	unsigned long za_offset;
 	unsigned long extra_offset;
 	unsigned long end_offset;
@@ -219,6 +220,7 @@ static int restore_fpsimd_context(struct fpsimd_context __user *ctx)
 struct user_ctxs {
 	struct fpsimd_context __user *fpsimd;
 	struct sve_context __user *sve;
+	struct tpidr2_context __user *tpidr2;
 	struct za_context __user *za;
 };
 

arch/arm64/kernel/signal.c extern int preserve_sve_context(void __user *ctx); · line 367

Quoted 8 lines
arch/arm64/kernel/signal.c +5 -0
@@ -358,6 +360,32 @@ extern int preserve_sve_context(void __user *ctx);
 
 #ifdef CONFIG_ARM64_SME
 
+static int preserve_tpidr2_context(struct tpidr2_context __user *ctx)
+{
+	int err = 0;
+
+	current->thread.tpidr2_el0 = read_sysreg_s(SYS_TPIDR2_EL0);

This is half of tls_preserve_current_state() and may be worth factoring out so that ptrace and signal delivery can use the same sets of helpers.

Quoted 4 lines
arch/arm64/kernel/signal.c +4 -0
+
+	__put_user_error(TPIDR2_MAGIC, &ctx->head.magic, err);
+	__put_user_error(sizeof(*ctx), &ctx->head.size, err);
+	__put_user_error(current->thread.tpidr2_el0, &ctx->tpidr2, err);

arch/arm64/kernel/signal.c extern int preserve_sve_context(void __user *ctx); · line 381

Quoted 10 lines
arch/arm64/kernel/signal.c +10 -0
+
+	return err;
+}
+
+static int restore_tpidr2_context(struct user_ctxs *user)
+{
+	u64 tpidr2_el0;
+	int err = 0;
+
+	/* Magic and size were validated deciding to call this function */

typo: before deciding

arch/arm64/kernel/signal.c extern int preserve_sve_context(void __user *ctx); · line 384

Quoted 3 lines
arch/arm64/kernel/signal.c +3 -0
+	__get_user_error(tpidr2_el0, &user->tpidr2->tpidr2, err);
+	if (!err)
+		current->thread.tpidr2_el0 = tpidr2_el0;

What guarantees this makes its way into the hardware register before we return to userspace, context switch or deliver another signal?

Quoted 25 lines
arch/arm64/kernel/signal.c +7 -0
+
+	return err;
+}
+
 static int preserve_za_context(struct za_context __user *ctx)
 {
 	int err = 0;
@@ -447,6 +475,8 @@ static int restore_za_context(struct user_ctxs *user)
 #else /* ! CONFIG_ARM64_SME */
 
 /* Turn any non-optimised out attempts to use these into a link error: */
+extern int preserve_tpidr2_context(void __user *ctx);
+extern int restore_tpidr2_context(struct user_ctxs *user);
 extern int preserve_za_context(void __user *ctx);
 extern int restore_za_context(struct user_ctxs *user);
 
@@ -465,6 +495,7 @@ static int parse_user_sigframe(struct user_ctxs *user,
 
 	user->fpsimd = NULL;
 	user->sve = NULL;
+	user->tpidr2 = NULL;
 	user->za = NULL;
 
 	if (!IS_ALIGNED((unsigned long)base, 16))

arch/arm64/kernel/signal.c static int parse_user_sigframe(struct user_ctxs *user, · line 566

Quoted 5 lines
arch/arm64/kernel/signal.c +2 -0
@@ -531,6 +562,19 @@ static int parse_user_sigframe(struct user_ctxs *user,
 			user->sve = (struct sve_context __user *)head;
 			break;
 
+		case TPIDR2_MAGIC:
+			if (!system_supports_sme())

We seem to be inconsistent between using system_supports_sme() and system_supports_tpidr2() for tpidr2 checks (see tls_get() and tls_set() for a glaring example). Please can you tidy this up as a preliminary patch?

arch/arm64/kernel/signal.c static int parse_user_sigframe(struct user_ctxs *user, · line 572

Quoted 6 lines
arch/arm64/kernel/signal.c +6 -0
+				goto invalid;
+
+			if (user->tpidr2)
+				goto invalid;
+
+			if (size != sizeof(*user->tpidr2))

Why are you requiring an exact match here? Won't that hinder any future extension of the structure?

Will

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

author
#4 lore raw

Re: [PATCH v2 2/4] arm64/signal: Include TPIDR2 in the signal context

Quoted 9 lines · Will Deacon

arch/arm64/kernel/signal.c static int parse_user_sigframe(struct user_ctxs *user, · line 572

Quoted 4 lines · Mark Brown
arch/arm64/kernel/signal.c +3 -0
+			if (user->tpidr2)
+				goto invalid;
 
+			if (size != sizeof(*user->tpidr2))

Why are you requiring an exact match here? Won't that hinder any future extension of the structure?

It will but since the structure is explicitly for a single sysreg that's intentional - the thinking was to just continue to model any more sysregs we want to report in the signal context in the same format with their own contexts. It felt like it fit better into how everything else in the signal context is extended.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#5 lore raw

Re: [PATCH v2 2/4] arm64/signal: Include TPIDR2 in the signal context

Quoted 11 lines · Mark Brown
Quoted 9 lines · Will Deacon

arch/arm64/kernel/signal.c static int parse_user_sigframe(struct user_ctxs *user, · line 572

Quoted 4 lines · Mark Brown
arch/arm64/kernel/signal.c +3 -0
+			if (user->tpidr2)
+				goto invalid;
 
+			if (size != sizeof(*user->tpidr2))

Why are you requiring an exact match here? Won't that hinder any future extension of the structure?

Quoted 5 lines

It will but since the structure is explicitly for a single sysreg that's intentional - the thinking was to just continue to model any more sysregs we want to report in the signal context in the same format with their own contexts. It felt like it fit better into how everything else in the signal context is extended.

I see, but having the usual '<' check wouldn't preclude us from doing what you suggest above, whilst also giving us some flexibility in case things turn out differently from how we expected.

Will

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

author
#6 lore raw

Re: [PATCH v2 2/4] arm64/signal: Include TPIDR2 in the signal context

Quoted 18 lines · Will Deacon
Quoted 11 lines · Mark Brown
Quoted 9 lines · Will Deacon

arch/arm64/kernel/signal.c static int parse_user_sigframe(struct user_ctxs *user, · line 572

Quoted 4 lines · Mark Brown
arch/arm64/kernel/signal.c +3 -0
+			if (user->tpidr2)
+				goto invalid;
 
+			if (size != sizeof(*user->tpidr2))

Why are you requiring an exact match here? Won't that hinder any future extension of the structure?

Quoted 5 lines

It will but since the structure is explicitly for a single sysreg that's intentional - the thinking was to just continue to model any more sysregs we want to report in the signal context in the same format with their own contexts. It felt like it fit better into how everything else in the signal context is extended.

Quoted 3 lines

I see, but having the usual '<' check wouldn't preclude us from doing what you suggest above, whilst also giving us some flexibility in case things turn out differently from how we expected.

This actually also how we validate the base fpsimd_context - while there is a < check in the switch statement in parse_user_sigframe() but we also have an exact size check near the top of restore_fpsimd_context() which gets called from there, meaning that the check in parse_user_sigframe() is a bit redundant. We do however allow the varibly sized frames to have an oversized allocation, though those have internal sizing information whereas fpsimd_context doesn't. My take was that we were erroring out here because if userspace thinks it's supplying some state that we're ignoring and not restoring then things might go badly. I'm not super wedded to this approach but it is consistent with the fpsimd_context handling and I can see some justificaton for it being done the way it is.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#7 lore raw

Re: [PATCH v2 2/4] arm64/signal: Include TPIDR2 in the signal context

Quoted 23 lines · Mark Brown
Quoted 18 lines · Will Deacon
Quoted 11 lines · Mark Brown
Quoted 9 lines · Will Deacon

arch/arm64/kernel/signal.c static int parse_user_sigframe(struct user_ctxs *user, · line 572

Quoted 4 lines · Mark Brown
arch/arm64/kernel/signal.c +3 -0
+			if (user->tpidr2)
+				goto invalid;
 
+			if (size != sizeof(*user->tpidr2))

Why are you requiring an exact match here? Won't that hinder any future extension of the structure?

Quoted 5 lines

It will but since the structure is explicitly for a single sysreg that's intentional - the thinking was to just continue to model any more sysregs we want to report in the signal context in the same format with their own contexts. It felt like it fit better into how everything else in the signal context is extended.

Quoted 3 lines

I see, but having the usual '<' check wouldn't preclude us from doing what you suggest above, whilst also giving us some flexibility in case things turn out differently from how we expected.

Quoted 13 lines

This actually also how we validate the base fpsimd_context - while there is a < check in the switch statement in parse_user_sigframe() but we also have an exact size check near the top of restore_fpsimd_context() which gets called from there, meaning that the check in parse_user_sigframe() is a bit redundant. We do however allow the varibly sized frames to have an oversized allocation, though those have internal sizing information whereas fpsimd_context doesn't. My take was that we were erroring out here because if userspace thinks it's supplying some state that we're ignoring and not restoring then things might go badly. I'm not super wedded to this approach but it is consistent with the fpsimd_context handling and I can see some justificaton for it being done the way it is.

Hmm, good point about fpsimd, it looks at magic/size twice which is definitely wrong (userspace could even change those values in between!).

So I'd vote for removing the checks from restore_fpsimd_context() which raises the same question we were discussing initially: should the check in parse_user_sigframe() require an exact size match or instead truncate the structure on the stack by only copying a prefix into the kernel?

I'm actually warming more towards an exact check now that we've spoken about it a bit... What do you think?

Will

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

author
#8 lore raw

Re: [PATCH v2 2/4] arm64/signal: Include TPIDR2 in the signal context

Quoted 11 lines · Will Deacon
Quoted 8 lines · Mark Brown
Quoted 3 lines

I see, but having the usual '<' check wouldn't preclude us from doing what you suggest above, whilst also giving us some flexibility in case things turn out differently from how we expected.

This actually also how we validate the base fpsimd_context - while there is a < check in the switch statement in parse_user_sigframe() but we also have an exact size check near the top of restore_fpsimd_context() which gets called from

Quoted 7 lines

Hmm, good point about fpsimd, it looks at magic/size twice which is definitely wrong (userspace could even change those values in between!).

So I'd vote for removing the checks from restore_fpsimd_context() which raises the same question we were discussing initially: should the check in parse_user_sigframe() require an exact size match or instead truncate the structure on the stack by only copying a prefix into the kernel?

I think it might be best to go the other way and remove the size checks from parse_user_sigframe() entirely and put them into the frame type specific functions so that parse_user_sigframe() looks the same for all frame types. We should make sure that the individual frame type functions don't re-read the magic and size though, only reading the additional frame type specific data and doing whatever validation makes sense.

Quoted 2 lines

I'm actually warming more towards an exact check now that we've spoken about it a bit... What do you think?

I'm more inclined towards exact checks, it seems safer. It's hard to see how we'd use any extensibility in a way that doesn't go bad in some situation or other if the frame isn't designed to be variably sized from the start, it's a lot easier to add a new frame safely than to extend an existing one.

I'll send a new version fixing all the other issues you pointed out and with size the check code as is (apart from anything else I already prepared it) and then look at fixing up the behaviour for FPSIMD and generally around parse_user_sigframe() incrementally. Hopefully that's OK.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#9 lore raw

Re: [PATCH v2 2/4] arm64/signal: Include TPIDR2 in the signal context

In reply to Will Deacon
Quoted 41 lines · Will Deacon
Quoted 23 lines · Mark Brown
Quoted 18 lines · Will Deacon
Quoted 11 lines · Mark Brown
Quoted 9 lines · Will Deacon

arch/arm64/kernel/signal.c static int parse_user_sigframe(struct user_ctxs *user, · line 572

Quoted 4 lines · Mark Brown
arch/arm64/kernel/signal.c +3 -0
+			if (user->tpidr2)
+				goto invalid;
 
+			if (size != sizeof(*user->tpidr2))

Why are you requiring an exact match here? Won't that hinder any future extension of the structure?

Quoted 5 lines

It will but since the structure is explicitly for a single sysreg that's intentional - the thinking was to just continue to model any more sysregs we want to report in the signal context in the same format with their own contexts. It felt like it fit better into how everything else in the signal context is extended.

Quoted 3 lines

I see, but having the usual '<' check wouldn't preclude us from doing what you suggest above, whilst also giving us some flexibility in case things turn out differently from how we expected.

Quoted 13 lines

This actually also how we validate the base fpsimd_context - while there is a < check in the switch statement in parse_user_sigframe() but we also have an exact size check near the top of restore_fpsimd_context() which gets called from there, meaning that the check in parse_user_sigframe() is a bit redundant. We do however allow the varibly sized frames to have an oversized allocation, though those have internal sizing information whereas fpsimd_context doesn't. My take was that we were erroring out here because if userspace thinks it's supplying some state that we're ignoring and not restoring then things might go badly. I'm not super wedded to this approach but it is consistent with the fpsimd_context handling and I can see some justificaton for it being done the way it is.

Hmm, good point about fpsimd, it looks at magic/size twice which is definitely wrong (userspace could even change those values in between!).

Quoted 7 lines

So I'd vote for removing the checks from restore_fpsimd_context() which raises the same question we were discussing initially: should the check in parse_user_sigframe() require an exact size match or instead truncate the structure on the stack by only copying a prefix into the kernel?

I'm actually warming more towards an exact check now that we've spoken about it a bit... What do you think?

I'd go for an exact match as well. I don't think we can expand these structures in the future safely without an additional magic number.

I tend to agree with Mark here that parse_user_sigframe() should only check the magic numbers and set the corresponding user_ctxs members. We leave the exact size check to the restore_fpsimd_context() etc. (can skip the magic check here). Well, not a strong view either way but we should definitely remove the duplicate checks.

Signature · 6 lines
Catalin

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author
#10 lore raw

Re: [PATCH v2 2/4] arm64/signal: Include TPIDR2 in the signal context

Quoted 10 lines · Catalin Marinas
Quoted 7 lines · Will Deacon

So I'd vote for removing the checks from restore_fpsimd_context() which raises the same question we were discussing initially: should the check in parse_user_sigframe() require an exact size match or instead truncate the structure on the stack by only copying a prefix into the kernel?

I'm actually warming more towards an exact check now that we've spoken about it a bit... What do you think?

Quoted 8 lines

I'd go for an exact match as well. I don't think we can expand these structures in the future safely without an additional magic number.

I tend to agree with Mark here that parse_user_sigframe() should only check the magic numbers and set the corresponding user_ctxs members. We leave the exact size check to the restore_fpsimd_context() etc. (can skip the magic check here). Well, not a strong view either way but we should definitely remove the duplicate checks.

I'm working on this, should have something out in the next day or so, but it's getting a bit more involved than just a simple fix (the main thing is that the various frame type parsers aren't consistent in how they're called which makes things a bit more invasive than they should be).

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

author
#11 lore raw

Re: [PATCH v2 2/4] arm64/signal: Include TPIDR2 in the signal context

In reply to Will Deacon
Quoted 8 lines · Will Deacon

arch/arm64/kernel/signal.c extern int preserve_sve_context(void __user *ctx); · line 384

Quoted 3 lines · Mark Brown
arch/arm64/kernel/signal.c +3 -0
+	__get_user_error(tpidr2_el0, &user->tpidr2->tpidr2, err);
+	if (!err)
+		current->thread.tpidr2_el0 = tpidr2_el0;

What guarantees this makes its way into the hardware register before we return to userspace, context switch or deliver another signal?

Context switch is handled, part of context switch is to restore the value from the task struct, but other cases aren't AFAICT. This is in general an oversight in our signal testing framework, it does not have a pattern of validating values set in signals.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#12 lore raw

Re: [PATCH v2 2/4] arm64/signal: Include TPIDR2 in the signal context

Quoted 10 lines · Mark Brown
Quoted 8 lines · Will Deacon

arch/arm64/kernel/signal.c extern int preserve_sve_context(void __user *ctx); · line 384

Quoted 3 lines · Mark Brown
arch/arm64/kernel/signal.c +3 -0
+	__get_user_error(tpidr2_el0, &user->tpidr2->tpidr2, err);
+	if (!err)
+		current->thread.tpidr2_el0 = tpidr2_el0;

What guarantees this makes its way into the hardware register before we return to userspace, context switch or deliver another signal?

Quoted 4 lines

Context switch is handled, part of context switch is to restore the value from the task struct, but other cases aren't AFAICT. This is in general an oversight in our signal testing framework, it does not have a pattern of validating values set in signals.

Right, but my question is about going to userspace _before_ we context switch, so I think there's an issue here.

Will

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

author
#13 lore raw

Re: [PATCH v2 2/4] arm64/signal: Include TPIDR2 in the signal context

Quoted 9 lines · Will Deacon
Quoted 4 lines · Mark Brown

Context switch is handled, part of context switch is to restore the value from the task struct, but other cases aren't AFAICT. This is in general an oversight in our signal testing framework, it does not have a pattern of validating values set in signals.

Right, but my question is about going to userspace _before_ we context switch, so I think there's an issue here.

Yes - like I say "other cases aren't AFAICT".

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

author
#14 lore raw

PATCH v2 3/4 kselftest/arm64: Add TPIDR2 to the set of known signal context records

In reply to Mark Brown

When validating the set of signal context records check that any TPIDR2 record has the correct size, also suppressing warnings due to seeing an unknown record type.

---
 tools/testing/selftests/arm64/signal/testcases/testcases.c | 4 ++++
 1 file changed, 4 insertions(+)
tools/testing/selftests/arm64/signal/testcases/testcases.c +4 -0
index e1c625b20ac4..f98cc081aa95 100644
@@ -158,6 +158,10 @@ bool validate_reserved(ucontext_t *uc, size_t resv_sz, char **err)
 			if (head->size != sizeof(struct esr_context))
 				*err = "Bad size for esr_context";
 			break;
+		case TPIDR2_MAGIC:
+			if (head->size != sizeof(struct tpidr2_context))
+				*err = "Bad size for tpidr2_context";
+			break;
 		case SVE_MAGIC:
 			if (flags & SVE_CTX)
 				*err = "Multiple SVE_MAGIC";
Signature · 7 lines
2.30.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author
#15 lore raw

PATCH v2 4/4 kselftest/arm64: Add test case for TPIDR2 signal frame records

In reply to Mark Brown

Ensure that we get signal context for TPIDR2 if and only if SME is present on the system. Since TPIDR2 is owned by libc we merely validate that the value is whatever it was set to, this isn't ideal since it's likely to just be the default of 0 with current systems but it avoids future false positives.

---
 .../testing/selftests/arm64/signal/.gitignore |  1 +
 .../arm64/signal/testcases/tpidr2_siginfo.c   | 90 +++++++++++++++++++
 2 files changed, 91 insertions(+)
 create mode 100644 tools/testing/selftests/arm64/signal/testcases/tpidr2_siginfo.c
tools/testing/selftests/arm64/signal/.gitignore +1 -0
index e8d2b57f73ec..e1b6c4d961b5 100644
@@ -4,5 +4,6 @@ fake_sigreturn_*
 sme_*
 ssve_*
 sve_*
+tpidr2_siginfo
 za_*
 !*.[ch]
tools/testing/selftests/arm64/signal/testcases/tpidr2_siginfo.c new file +90 -0

90 lines not on this page · raw message

Signature · 7 lines
2.30.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel