Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KVM: guest_mem: Add alignment checks
An example for needing the offset alignment check: Suppose a memslot is configured with + guest_phys_addr = 0x400000 + gmem_offset = 0x201000 + memory_size = 0x201000 + Page size = 0x200000 (2M) The huge page will be allocated at some 2M-aligned boundary, so a possible PFN would be 0x200. The GFN for an allocation requested by KVM would be 0x400. Since GFN of 0x400 translates to offset 0x201000 through the memslot configuration and the hugepage begins at offset 0x200000 in the file, the returned page would have a PFN of 0x201, causing VM_BUG_ON((fault->gfn & mask) != (fault->pfn & mask)); in arch/x86/kvm/mmu/mmu.c to trigger. Signed-off-by: Ackerley Tng <ackerleytng@google.com>
- Loading branch information
Ackerley Tng
committed
Jun 6, 2023
1 parent
52bcfb4
commit cfae00d
Showing
3 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters