Date: Sun, 16 Jun 2024 18:11:17 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 46bb2dca534a - main - kasan: Increase the size of the bootstrap PTP reservation Message-ID: <202406161811.45GIBHoN039501@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=46bb2dca534ae1dfe95ea11c915b441e4867a310 commit 46bb2dca534ae1dfe95ea11c915b441e4867a310 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2024-06-16 17:33:13 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2024-06-16 17:33:13 +0000 kasan: Increase the size of the bootstrap PTP reservation We were undercounting in the case where the boot stack crosses a 2MB boundary, resulting in a panic during locore execution. MFC after: 1 week Fixes: 756bc3adc578 ("kasan: Create a shadow for the bootstack prior to hammer_time()") --- sys/amd64/amd64/pmap.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index dee208fc9145..57943e815b5b 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -11671,15 +11671,16 @@ pmap_pkru_clear(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) * Reserve enough memory to: * 1) allocate PDP pages for the shadow map(s), * 2) shadow the boot stack of KSTACK_PAGES pages, - * so we need one PD page, one or two PT pages, and KSTACK_PAGES shadow pages - * per shadow map. + * 3) assuming that the kernel stack does not cross a 1GB boundary, + * so we need one or two PD pages, one or two PT pages, and KSTACK_PAGES shadow + * pages per shadow map. */ #ifdef KASAN #define SAN_EARLY_PAGES \ - (NKASANPML4E + 1 + 2 + howmany(KSTACK_PAGES, KASAN_SHADOW_SCALE)) + (NKASANPML4E + 2 + 2 + howmany(KSTACK_PAGES, KASAN_SHADOW_SCALE)) #else #define SAN_EARLY_PAGES \ - (NKMSANSHADPML4E + NKMSANORIGPML4E + 2 * (1 + 2 + KSTACK_PAGES)) + (NKMSANSHADPML4E + NKMSANORIGPML4E + 2 * (2 + 2 + KSTACK_PAGES)) #endif static uint64_t __nosanitizeaddress __nosanitizememory
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202406161811.45GIBHoN039501>