mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-01 14:14:56 +00:00
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: 756bc3adc5
("kasan: Create a shadow for the bootstack prior to hammer_time()")
This commit is contained in:
parent
4441dd4094
commit
46bb2dca53
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue