]> git.hungrycats.org Git - linux/commit
arm64: flush TLS registers during exec
authorWill Deacon <will.deacon@arm.com>
Thu, 11 Sep 2014 13:38:16 +0000 (14:38 +0100)
committerJiri Slaby <jslaby@suse.cz>
Fri, 26 Sep 2014 09:23:43 +0000 (11:23 +0200)
commit7bcae251a2dfb6c0aa2c34dc505a5796c7c39426
treece48e357e0a223c151bf81d5dc5ad46882638696
parent0fbdd4f77c9051e4f23b943aa8d373d151679f0d
arm64: flush TLS registers during exec

commit eb35bdd7bca29a13c8ecd44e6fd747a84ce675db upstream.

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.

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>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
arch/arm64/kernel/process.c
arch/arm64/kernel/sys_compat.c