arm64/sme: Always initialise TPIDR2 storage
PATCH 1/1 arm64/sme: Always initialise TPIDR2 storage
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.
--- arch/arm64/kernel/process.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/kernel/process.c +2 -0
@@ -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)))
Signature · 7 lines
2.30.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Will Deacon
maintainerQuoted 14 lines · 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 <[email protected]>--- arch/arm64/kernel/process.c | 2 ++ 1 file changed, 2 insertions(+)arch/arm64/kernel/process.c +0
-0
arch/arm64/kernel/process.c int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) · line 380
Quoted 5 lines
arch/arm64/kernel/process.c +2
-0@@ -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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 10 lines · Will Deacon
arch/arm64/kernel/process.c int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) · line 380
Quoted 2 lines · Mark Brown
arch/arm64/kernel/process.c +2
-0+else + p->thread.tpidr2_el0 =0 ;Why is this needed? If !system_supports_tpidr2(), then we'll just copy the
tpidr2_el0field from the parent. Given thatINIT_THREADdefines 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.
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel