Commit fb3ec679 authored by Marc Zyngier's avatar Marc Zyngier Committed by Christoffer Dall

KVM: arm64: GICv3: mandate page-aligned GICV region

Just like GICv2 was fixed in 63afbe7a
(kvm: arm64: vgic: fix hyp panic with 64k pages on juno platform),
mandate the GICV region to be both aligned on a page boundary and
its size to be a multiple of page size.

This prevents a guest from being able to poke at regions where we
have no idea what is sitting there.
Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Signed-off-by: default avatarChristoffer Dall <christoffer.dall@linaro.org>
parent f4c321eb
...@@ -215,6 +215,22 @@ int vgic_v3_probe(struct device_node *vgic_node, ...@@ -215,6 +215,22 @@ int vgic_v3_probe(struct device_node *vgic_node,
ret = -ENXIO; ret = -ENXIO;
goto out; goto out;
} }
if (!PAGE_ALIGNED(vcpu_res.start)) {
kvm_err("GICV physical address 0x%llx not page aligned\n",
(unsigned long long)vcpu_res.start);
ret = -ENXIO;
goto out;
}
if (!PAGE_ALIGNED(resource_size(&vcpu_res))) {
kvm_err("GICV size 0x%llx not a multiple of page size 0x%lx\n",
(unsigned long long)resource_size(&vcpu_res),
PAGE_SIZE);
ret = -ENXIO;
goto out;
}
vgic->vcpu_base = vcpu_res.start; vgic->vcpu_base = vcpu_res.start;
vgic->vctrl_base = NULL; vgic->vctrl_base = NULL;
vgic->type = VGIC_V3; vgic->type = VGIC_V3;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment