Date: Sat, 24 Jul 2021 15:53:07 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 34516d4ad19b - main - amd64 pti init: fix calculation of the kernel text start Message-ID: <202107241553.16OFr7HY030322@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=34516d4ad19b83e5dfe6ec8c1db232c422d7ecff commit 34516d4ad19b83e5dfe6ec8c1db232c422d7ecff Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-07-10 19:51:16 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2021-07-24 15:52:44 +0000 amd64 pti init: fix calculation of the kernel text start Old expression happens to provide the correct answer, but assumes that kernel is loaded at physical address zero, with 2M gap. Do not use kernphys to calculate KVA of kernel text start, just explicitly write out KERNBASE and the hole size. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31121 --- sys/amd64/amd64/pmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 688412594e6c..03436a60a10b 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -10762,7 +10762,7 @@ pmap_pti_init(void) va = __pcpu[i].pc_common_tss.tss_ist4 + sizeof(struct nmi_pcpu); pmap_pti_add_kva_locked(va - DBG_STACK_SIZE, va, false); } - pmap_pti_add_kva_locked((vm_offset_t)kernphys + KERNBASE, + pmap_pti_add_kva_locked((vm_offset_t)KERNBASE + NBPDR, (vm_offset_t)etext, true); pti_finalized = true; VM_OBJECT_WUNLOCK(pti_obj);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107241553.16OFr7HY030322>