When running as a SEV guest, page frame mask is calculated from the
CPUID provided "physical address bit reduction". The amd64 pmap
code uses the variable pg_frame instead of the defined PG_FRAME
0x000ffffffffff000.
There was one instance in pmap code where pg_frame was applied to
virtual address, not physical address. On some machines the address
bit reduction is rather large with six bits. So the calculated
pg_frame is 0x00003fffffe00000. However, on amd64 VM_MAX_ADDRESS
is defined as 0x00007fbfdfeff000. Masking a such large address
with pg_frame caused havoc. Therefore, when masking virtual
addresses, still use PG_FRAME.
from hshoexer@
-/* $OpenBSD: pmap.c,v 1.172 2024/08/29 20:13:42 dv Exp $ */
+/* $OpenBSD: pmap.c,v 1.173 2024/09/03 17:19:53 bluhm Exp $ */
/* $NetBSD: pmap.c,v 1.3 2003/05/08 18:13:13 thorpej Exp $ */
/*
shootself = (scr3 == 0);
/* should be ok, but just in case ... */
- sva &= pg_frame;
- eva &= pg_frame;
+ sva &= PG_FRAME;
+ eva &= PG_FRAME;
if (!(prot & PROT_READ))
set |= pg_xo;