We can only create hugepages if the there is an alignment on the page
size by both the virtual and physical address. Without this check, we
crashed, e.g., on configurations that placed the hypervisor on physical
start addresses that were not 2M-aligned.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
unsigned long phys, unsigned long size, unsigned long virt,
unsigned long flags, enum page_map_coherent coherent)
{
+ phys &= PAGE_MASK;
virt &= PAGE_MASK;
size = PAGE_ALIGN(size);
pte = paging->get_entry(pt, virt);
if (paging->page_size > 0 &&
paging->page_size <= size &&
- (virt & (paging->page_size - 1)) == 0) {
+ ((phys | virt) & (paging->page_size - 1)) == 0) {
/*
* We might be overwriting a more fine-grained
* mapping, so release it first. This cannot