Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

KVM: arm64: Fix initialisation order in __pkvm_init_finalise()

fix_host_ownership() walks the hypervisor's stage-1 page-table to
adjust the host's stage-2 accordingly. Any such adjustment that
requires cache maintenance operations depends on the per-CPU hyp
fixmap being present. However, fix_host_ownership() is currently
called before fix_hyp_pgtable_refcnt() and hyp_create_fixmap(), so
the fixmap does not yet exist when it runs.

This is benign today because the host stage-2 starts empty and no
CMOs are needed, but it becomes a latent crash as soon as
fix_host_ownership() is extended to operate on a non-empty
page-table.

Reorder the calls so that fix_hyp_pgtable_refcnt() and
hyp_create_fixmap() complete before fix_host_ownership() is invoked.

Fixes: 0d16d12eb26e ("KVM: arm64: Fix-up hyp stage-1 refcounts for all pages mapped at EL2")
Signed-off-by: Quentin Perret <qperret@google.com>
Signed-off-by: Fuad Tabba <tabba@google.com>
Link: https://patch.msgid.link/20260424084908.370776-7-tabba@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.kernel.org

authored by

Quentin Perret and committed by
Marc Zyngier
5bb0aed5 73b9c1e5

+4 -4
+4 -4
arch/arm64/kvm/hyp/nvhe/setup.c
··· 312 312 }; 313 313 pkvm_pgtable.mm_ops = &pkvm_pgtable_mm_ops; 314 314 315 - ret = fix_host_ownership(); 316 - if (ret) 317 - goto out; 318 - 319 315 ret = fix_hyp_pgtable_refcnt(); 320 316 if (ret) 321 317 goto out; 322 318 323 319 ret = hyp_create_fixmap(); 320 + if (ret) 321 + goto out; 322 + 323 + ret = fix_host_ownership(); 324 324 if (ret) 325 325 goto out; 326 326