]> www.infradead.org Git - users/jedix/linux-maple.git/commit
KVM: arm64: Selftest for pKVM transitions
authorQuentin Perret <qperret@google.com>
Wed, 16 Apr 2025 16:08:59 +0000 (16:08 +0000)
committerMarc Zyngier <maz@kernel.org>
Tue, 6 May 2025 08:56:18 +0000 (09:56 +0100)
commit6c2d4c319c7db7be883428ae1161502f3f690e60
treefc080e78c25cc6819b2505ab4651917975689eb5
parent845f126732a8126dee3f15855487121f4836131a
KVM: arm64: Selftest for pKVM transitions

We have recently found a bug [1] in the pKVM memory ownership
transitions by code inspection, but it could have been caught with a
test.

Introduce a boot-time selftest exercising all the known pKVM memory
transitions and importantly checks the rejection of illegal transitions.

The new test is hidden behind a new Kconfig option separate from
CONFIG_EL2_NVHE_DEBUG on purpose as that has side effects on the
transition checks ([1] doesn't reproduce with EL2 debug enabled).

[1] https://lore.kernel.org/kvmarm/20241128154406.602875-1-qperret@google.com/

Suggested-by: Will Deacon <will@kernel.org>
Signed-off-by: Quentin Perret <qperret@google.com>
Link: https://lore.kernel.org/r/20250416160900.3078417-4-qperret@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/hyp/include/nvhe/mem_protect.h
arch/arm64/kvm/hyp/nvhe/mem_protect.c
arch/arm64/kvm/hyp/nvhe/setup.c