diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2024-09-03 17:19:54 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2024-09-03 17:19:54 +0000 |
commit | 669d1de6943a3d288df77babd5352b4671a6be8b (patch) | |
tree | 201e2ad20e632e8a7c061587b24a09808b97a589 /sys/arch | |
parent | 4d23f3ef08e8bc35fe101449a9df91371118d81d (diff) |
For virtual addresses use fixed page frame without AMD SEV reduction.
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@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/amd64/amd64/pmap.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/arch/amd64/amd64/pmap.c b/sys/arch/amd64/amd64/pmap.c index cf8e59287e4..c7d2dca5e73 100644 --- a/sys/arch/amd64/amd64/pmap.c +++ b/sys/arch/amd64/amd64/pmap.c @@ -1,4 +1,4 @@ -/* $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 $ */ /* @@ -2159,8 +2159,8 @@ pmap_write_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot) 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; |