Don't bother looking for non-executable pages when a process is

excluded from PTI.

Reviewed by:	kib
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D15708
This commit is contained in:
tychon 2018-06-08 20:35:58 +00:00
parent 54ac1282ce
commit fd32dfa062

View File

@ -770,7 +770,8 @@ trap_pfault(struct trapframe *frame, int usermode)
* If nx protection of the usermode portion of kernel page
* tables caused trap, panic.
*/
if (pti && usermode && pg_nx != 0 && (frame->tf_err & (PGEX_P | PGEX_W |
if (PCPU_GET(curpmap)->pm_ucr3 != PMAP_NO_CR3 && usermode &&
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))