[PATCH] arm64/sme: Always initialise TPIDR2 storage
Will Deacon
will at kernel.org
Fri Jul 1 07:40:43 PDT 2022
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 at 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
More information about the linux-arm-kernel
mailing list