Author: kib
Date: Sat Oct  3 23:11:20 2020
New Revision: 366416
URL: https://svnweb.freebsd.org/changeset/base/366416

Log:
  Fix pmap_pti_add_kva() call for doublefault stack page.
  
  After r354889 stack got struct nmi_pcpu at top, which makes IST top
  not page-aligned.  Since pmap_pti_add_kva() truncates/rounds up
  addresses, it erronously entered a page mapped before double fault
  stack into the pti page table.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:    3 days

Modified:
  head/sys/amd64/amd64/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==============================================================================
--- head/sys/amd64/amd64/pmap.c Sat Oct  3 23:07:09 2020        (r366415)
+++ head/sys/amd64/amd64/pmap.c Sat Oct  3 23:11:20 2020        (r366416)
@@ -10479,7 +10479,7 @@ pmap_pti_init(void)
            sizeof(struct gate_descriptor) * NIDT, false);
        CPU_FOREACH(i) {
                /* Doublefault stack IST 1 */
-               va = __pcpu[i].pc_common_tss.tss_ist1;
+               va = __pcpu[i].pc_common_tss.tss_ist1 + sizeof(struct nmi_pcpu);
                pmap_pti_add_kva_locked(va - PAGE_SIZE, va, false);
                /* NMI stack IST 2 */
                va = __pcpu[i].pc_common_tss.tss_ist2 + sizeof(struct nmi_pcpu);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to