ANDROID: KVM: arm64: Check PGD alignment when creating a pVM
Martijn reported a hypervisor crash when providing pKVM with an undersized PGD allocation. Indeed, although the size of the PGD allocation at EL2 is not under host control, a smaller host-side allocation can lead to providing pKVM with a misaligned PGD, which will cause the guest stage-2 init to fail in a bad way. Specifically, guest_s2_zalloc_pages_exact() expects a successful allocation from hyp_alloc_pages(), which can only happen if the pool has been pre-filled with a physically aligned high-order page. In order to guarantee allocation success in this path, check the host-provided PGD alignment early on. Bug: 443668075 Change-Id: I170963edc5721cf368a506bcdc4b2d0cdb462f78 Fixes: a1ec5c70 ("KVM: arm64: Add infrastructure to create and track pKVM instances at EL2") Reported-by:Martijn Bogaard <martijnbogaard@google.com> Signed-off-by:
Quentin Perret <qperret@google.com> (cherry picked from commit 42eff3b2) Signed-off-by:
Lee Jones <joneslee@google.com>
Loading
Please sign in to comment