git: 8b434feedfa9 - main - Only set delayed inval for procs using PTI

Eric van Gyzen vangyzen at FreeBSD.org
Fri Mar 5 19:20:12 UTC 2021


The branch main has been updated by vangyzen:

URL: https://cgit.FreeBSD.org/src/commit/?id=8b434feedfa9f71b59b9653c9335700abc019c03

commit 8b434feedfa9f71b59b9653c9335700abc019c03
Author:     Eric van Gyzen <vangyzen at FreeBSD.org>
AuthorDate: 2021-03-05 16:31:43 +0000
Commit:     Eric van Gyzen <vangyzen at FreeBSD.org>
CommitDate: 2021-03-05 19:20:08 +0000

    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
---
 sys/amd64/amd64/mp_machdep.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index aa62c2086fa4..11f2bb8bbfc1 100644
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -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);
 	}
 }


More information about the dev-commits-src-all mailing list