All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64/sme: Always initialise TPIDR2 storage
@ 2022-07-01 11:34 Mark Brown
  2022-07-01 14:40 ` Will Deacon
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2022-07-01 11:34 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon; +Cc: linux-arm-kernel, Mark Brown

Ensure that the value stored for TPIDR2 is always initialised, even if we
don't support it, in order to defend against the possibility that we might
look at the value and do something with it.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 arch/arm64/kernel/process.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index 944d782d581b..da1c65a7092c 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -376,6 +376,8 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 		*task_user_tls(p) = read_sysreg(tpidr_el0);
 		if (system_supports_tpidr2())
 			p->thread.tpidr2_el0 = read_sysreg_s(SYS_TPIDR2_EL0);
+		else
+			p->thread.tpidr2_el0 = 0;
 
 		if (stack_start) {
 			if (is_compat_thread(task_thread_info(p)))
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm64/sme: Always initialise TPIDR2 storage
  2022-07-01 11:34 [PATCH] arm64/sme: Always initialise TPIDR2 storage Mark Brown
@ 2022-07-01 14:40 ` Will Deacon
  2022-07-01 14:45   ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Will Deacon @ 2022-07-01 14:40 UTC (permalink / raw)
  To: Mark Brown; +Cc: Catalin Marinas, linux-arm-kernel

On Fri, Jul 01, 2022 at 12:34:09PM +0100, Mark Brown wrote:
> Ensure that the value stored for TPIDR2 is always initialised, even if we
> don't support it, in order to defend against the possibility that we might
> look at the value and do something with it.
> 
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
>  arch/arm64/kernel/process.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
> index 944d782d581b..da1c65a7092c 100644
> --- a/arch/arm64/kernel/process.c
> +++ b/arch/arm64/kernel/process.c
> @@ -376,6 +376,8 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
>  		*task_user_tls(p) = read_sysreg(tpidr_el0);
>  		if (system_supports_tpidr2())
>  			p->thread.tpidr2_el0 = read_sysreg_s(SYS_TPIDR2_EL0);
> +		else
> +			p->thread.tpidr2_el0 = 0;

Why is this needed? If !system_supports_tpidr2(), then we'll just copy the
tpidr2_el0 field from the parent. Given that INIT_THREAD defines this to be
zero, then it looks like it should all work out.

What am I missing?

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm64/sme: Always initialise TPIDR2 storage
  2022-07-01 14:40 ` Will Deacon
@ 2022-07-01 14:45   ` Mark Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2022-07-01 14:45 UTC (permalink / raw)
  To: Will Deacon; +Cc: Catalin Marinas, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 518 bytes --]

On Fri, Jul 01, 2022 at 03:40:43PM +0100, Will Deacon wrote:
> On Fri, Jul 01, 2022 at 12:34:09PM +0100, Mark Brown wrote:

> > +		else
> > +			p->thread.tpidr2_el0 = 0;

> Why is this needed? If !system_supports_tpidr2(), then we'll just copy the
> tpidr2_el0 field from the parent. Given that INIT_THREAD defines this to be
> zero, then it looks like it should all work out.

> What am I missing?

It should be redundant, I just had to check harder than I liked
that there wasn't a path where we could get it wrong.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-01 14:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-01 11:34 [PATCH] arm64/sme: Always initialise TPIDR2 storage Mark Brown
2022-07-01 14:40 ` Will Deacon
2022-07-01 14:45   ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.