Only set delayed inval for procs using PTI

invltlb_invpcid_pti_handler() was requesting delayed TLB invalidation
even for processes that aren't using PTI.  With an out-of-tree
change to avoid PTI for non-jailed root processes, this caused an
assertion failure in pmap_activate_sw_pcid_pti() when context-switching
between PTI and non-PTI processes.

Reviewed by:	bdrewery kib tychon
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D29094
This commit is contained in:
Eric van Gyzen 2021-03-05 10:31:43 -06:00
parent 4fc60fa929
commit 8b434feedf

View File

@ -851,7 +851,8 @@ invltlb_invpcid_pti_handler(pmap_t smp_tlb_pmap)
invpcid(&d, INVPCID_CTXGLOB);
} else {
invpcid(&d, INVPCID_CTX);
if (smp_tlb_pmap == PCPU_GET(curpmap))
if (smp_tlb_pmap == PCPU_GET(curpmap) &&
smp_tlb_pmap->pm_ucr3 != PMAP_NO_CR3)
PCPU_SET(ucr3_load_mask, ~CR3_PCID_SAVE);
}
}