aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64/amd64/trap.c
diff options
context:
space:
mode:
authorTycho Nightingale <tychon@FreeBSD.org>2018-04-27 12:44:20 +0000
committerTycho Nightingale <tychon@FreeBSD.org>2018-04-27 12:44:20 +0000
commit27275f8a5240f6c644cc3341b4efda3695d97620 (patch)
tree74998faf2b14141cce24ef8187287c4697ab431a /sys/amd64/amd64/trap.c
parent23774c3973bb1c1f9f646cc7f4d3e0f9cd7b1faf (diff)
downloadsrc-27275f8a5240f6c644cc3341b4efda3695d97620.tar.gz
src-27275f8a5240f6c644cc3341b4efda3695d97620.zip
Expand the checks for UCR3 == PMAP_NO_CR3 to enable processes to be
excluded from PTI. Reviewed by: kib Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D15100
Notes
Notes: svn path=/head/; revision=333059
Diffstat (limited to 'sys/amd64/amd64/trap.c')
-rw-r--r--sys/amd64/amd64/trap.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
index 0c6ce9a4e185..386eacfe0fbc 100644
--- a/sys/amd64/amd64/trap.c
+++ b/sys/amd64/amd64/trap.c
@@ -461,11 +461,13 @@ trap(struct trapframe *frame)
*/
if (frame->tf_rip == (long)doreti_iret) {
frame->tf_rip = (long)doreti_iret_fault;
- if (pti && frame->tf_rsp == (uintptr_t)PCPU_PTR(
- pti_stack) + (PC_PTI_STACK_SZ - 5) *
- sizeof(register_t))
+ if ((PCPU_GET(curpmap)->pm_ucr3 !=
+ PMAP_NO_CR3) &&
+ (frame->tf_rsp == (uintptr_t)PCPU_GET(
+ pti_rsp0) - 5 * sizeof(register_t))) {
frame->tf_rsp = PCPU_GET(rsp0) - 5 *
sizeof(register_t);
+ }
return;
}
if (frame->tf_rip == (long)ld_ds) {