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 822d2d6ac9.

Reviewed by:	andrew
Obtained from:	CheriBSD
MFC after:	1 week
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D28711
This commit is contained in:
John Baldwin 2021-03-17 13:19:04 -07:00
parent 8ad7d25dfc
commit 0723b40915
2 changed files with 10 additions and 0 deletions

View file

@ -561,6 +561,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

View file

@ -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