git: 0723b409150a - main - aarch64: Clear TLS registers during exec().
John Baldwin
jhb at FreeBSD.org
Wed Mar 17 20:20:25 UTC 2021
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=0723b409150ae302eb021cbde86a5f77348a1bb4
commit 0723b409150ae302eb021cbde86a5f77348a1bb4
Author: John Baldwin <jhb at FreeBSD.org>
AuthorDate: 2021-03-17 20:19:04 +0000
Commit: John Baldwin <jhb at FreeBSD.org>
CommitDate: 2021-03-17 20:19:04 +0000
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.
Reviewed by: andrew
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D28711
---
sys/arm64/arm64/machdep.c | 5 +++++
sys/arm64/linux/linux_sysvec.c | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c
index 91f0a31ebe36..97f97392e43f 100644
--- a/sys/arm64/arm64/machdep.c
+++ b/sys/arm64/arm64/machdep.c
@@ -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
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
More information about the dev-commits-src-main
mailing list