diff options
author | John Baldwin <jhb@FreeBSD.org> | 2021-03-17 20:19:04 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2021-03-29 22:17:04 +0000 |
commit | c6b96921a81968aa768b45e32195854aaec81331 (patch) | |
tree | a0665adc5bdf74fc20e2c74399ff2aa8f59f977a | |
parent | d8debda0d0a324c0925f23227514301eb7670b26 (diff) | |
download | src-c6b96921a81968aa768b45e32195854aaec81331.tar.gz src-c6b96921a81968aa768b45e32195854aaec81331.zip |
aarch64: Clear TLS registers during exec().
These are not stored in the trapframe so must be cleared explicitly.
This is similar to one of the MIPS changes in 822d2d6ac94f.
Obtained from: CheriBSD
Sponsored by: DARPA
(cherry picked from commit 0723b409150ae302eb021cbde86a5f77348a1bb4)
-rw-r--r-- | sys/arm64/arm64/machdep.c | 5 | ||||
-rw-r--r-- | sys/arm64/linux/linux_sysvec.c | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index c825c1a18c70..8a1e7520aacb 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -560,6 +560,11 @@ exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) tf->tf_lr = imgp->entry_addr; tf->tf_elr = imgp->entry_addr; + td->td_pcb->pcb_tpidr_el0 = 0; + td->td_pcb->pcb_tpidrro_el0 = 0; + WRITE_SPECIALREG(tpidrro_el0, 0); + WRITE_SPECIALREG(tpidr_el0, 0); + #ifdef VFP vfp_reset_state(td, pcb); #endif diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index 67feacfa876b..df16db4040a7 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -365,6 +365,11 @@ linux_exec_setregs(struct thread *td, struct image_params *imgp, #endif regs->tf_elr = imgp->entry_addr; + td->td_pcb->pcb_tpidr_el0 = 0; + td->td_pcb->pcb_tpidrro_el0 = 0; + WRITE_SPECIALREG(tpidrro_el0, 0); + WRITE_SPECIALREG(tpidr_el0, 0); + #ifdef VFP vfp_reset_state(td, td->td_pcb); #endif |