svn commit: r338901 - stable/11/sys/amd64/amd64
Konstantin Belousov
kib at FreeBSD.org
Mon Sep 24 09:57:48 UTC 2018
Author: kib
Date: Mon Sep 24 09:57:47 2018
New Revision: 338901
URL: https://svnweb.freebsd.org/changeset/base/338901
Log:
MFC r338711:
Make the PTI violation check to follow style of the SMAP check.
Modified:
stable/11/sys/amd64/amd64/trap.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/amd64/amd64/trap.c
==============================================================================
--- stable/11/sys/amd64/amd64/trap.c Mon Sep 24 00:53:57 2018 (r338900)
+++ stable/11/sys/amd64/amd64/trap.c Mon Sep 24 09:57:47 2018 (r338901)
@@ -684,6 +684,17 @@ trap_check(struct trapframe *frame)
trap(frame);
}
+static bool
+trap_is_pti(struct trapframe *frame)
+{
+
+ return (PCPU_GET(curpmap)->pm_ucr3 != PMAP_NO_CR3 &&
+ pg_nx != 0 && (frame->tf_err & (PGEX_P | PGEX_W |
+ PGEX_U | PGEX_I)) == (PGEX_P | PGEX_U | PGEX_I) &&
+ (curpcb->pcb_saved_ucr3 & ~CR3_PCID_MASK) ==
+ (PCPU_GET(curpmap)->pm_cr3 & ~CR3_PCID_MASK));
+}
+
static int
trap_pfault(struct trapframe *frame, int usermode)
{
@@ -781,11 +792,7 @@ trap_pfault(struct trapframe *frame, int usermode)
* If nx protection of the usermode portion of kernel page
* tables caused trap, panic.
*/
- if (usermode && PCPU_GET(curpmap)->pm_ucr3 != PMAP_NO_CR3 &&
- pg_nx != 0 && (frame->tf_err & (PGEX_P | PGEX_W |
- PGEX_U | PGEX_I)) == (PGEX_P | PGEX_U | PGEX_I) &&
- (curpcb->pcb_saved_ucr3 & ~CR3_PCID_MASK)==
- (PCPU_GET(curpmap)->pm_cr3 & ~CR3_PCID_MASK))
+ if (usermode && trap_is_pti(frame))
panic("PTI: pid %d comm %s tf_err %#lx", p->p_pid,
p->p_comm, frame->tf_err);
More information about the svn-src-stable
mailing list