diff options
author | Will Deacon <will.deacon@arm.com> | 2014-09-11 14:38:16 +0100 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2014-09-11 18:34:58 +0100 |
commit | eb35bdd7bca29a13c8ecd44e6fd747a84ce675db (patch) | |
tree | 67653a916c9f5afae04959601e3b45507d043f53 /arch/arm64/kernel/sys_compat.c | |
parent | 3d8afe3099ebc602848aa7f09235cce3a9a023ce (diff) | |
download | linux-stable-eb35bdd7bca29a13c8ecd44e6fd747a84ce675db.tar.gz linux-stable-eb35bdd7bca29a13c8ecd44e6fd747a84ce675db.tar.bz2 linux-stable-eb35bdd7bca29a13c8ecd44e6fd747a84ce675db.zip |
arm64: flush TLS registers during exec
Nathan reports that we leak TLS information from the parent context
during an exec, as we don't clear the TLS registers when flushing the
thread state.
This patch updates the flushing code so that we:
(1) Unconditionally zero the tpidr_el0 register (since this is fully
context switched for native tasks and zeroed for compat tasks)
(2) Zero the tp_value state in thread_info before clearing the
tpidrr0_el0 register for compat tasks (since this is only writable
by the set_tls compat syscall and therefore not fully switched).
A missing compiler barrier is also added to the compat set_tls syscall.
Cc: <stable@vger.kernel.org>
Acked-by: Nathan Lynch <Nathan_Lynch@mentor.com>
Reported-by: Nathan Lynch <Nathan_Lynch@mentor.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64/kernel/sys_compat.c')
-rw-r--r-- | arch/arm64/kernel/sys_compat.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/arm64/kernel/sys_compat.c b/arch/arm64/kernel/sys_compat.c index de2b0226e06d..dc47e53e9e28 100644 --- a/arch/arm64/kernel/sys_compat.c +++ b/arch/arm64/kernel/sys_compat.c @@ -79,6 +79,12 @@ long compat_arm_syscall(struct pt_regs *regs) case __ARM_NR_compat_set_tls: current->thread.tp_value = regs->regs[0]; + + /* + * Protect against register corruption from context switch. + * See comment in tls_thread_flush. + */ + barrier(); asm ("msr tpidrro_el0, %0" : : "r" (regs->regs[0])); return 0; |