[PATCH] arm64/sme: Always initialise TPIDR2 storage

Mark Brown broonie at kernel.org
Fri Jul 1 04:34:09 PDT 2022


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;
 
 		if (stack_start) {
 			if (is_compat_thread(task_thread_info(p)))
-- 
2.30.2




More information about the linux-arm-kernel mailing list