diff options
| author | Will Deacon <will@kernel.org> | 2026-03-30 17:48:36 +0300 |
|---|---|---|
| committer | Marc Zyngier <maz@kernel.org> | 2026-03-30 18:58:09 +0300 |
| commit | f4a5a6770af9b87a8e87717e1b97af052979f4ec (patch) | |
| tree | 943e72dbaa7f894decb7b15927bc2264a7ae22f6 | |
| parent | 8972a991606bc021249ae53a95c131a79fdeda4a (diff) | |
| download | linux-f4a5a6770af9b87a8e87717e1b97af052979f4ec.tar.xz | |
KVM: arm64: Extend pKVM page ownership selftests to cover forced reclaim
Extend the pKVM page ownership selftests to forcefully reclaim a donated
page and check that it cannot be re-donated at the same IPA.
Tested-by: Fuad Tabba <tabba@google.com>
Tested-by: Mostafa Saleh <smostafa@google.com>
Signed-off-by: Will Deacon <will@kernel.org>
Link: https://patch.msgid.link/20260330144841.26181-36-will@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
| -rw-r--r-- | arch/arm64/kvm/hyp/nvhe/mem_protect.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/arch/arm64/kvm/hyp/nvhe/mem_protect.c b/arch/arm64/kvm/hyp/nvhe/mem_protect.c index d8f8ebe59129..0775a82ee4fe 100644 --- a/arch/arm64/kvm/hyp/nvhe/mem_protect.c +++ b/arch/arm64/kvm/hyp/nvhe/mem_protect.c @@ -1815,8 +1815,20 @@ void pkvm_ownership_selftest(void *base) assert_transition_res(-EPERM, __pkvm_hyp_donate_host, pfn, 1); selftest_state.host = PKVM_PAGE_OWNED; - selftest_state.guest[0] = PKVM_NOPAGE; - assert_transition_res(0, __pkvm_host_reclaim_page_guest, gfn, vm); + selftest_state.guest[0] = PKVM_POISON; + assert_transition_res(0, __pkvm_host_force_reclaim_page_guest, phys); + assert_transition_res(-EPERM, __pkvm_host_donate_guest, pfn, gfn, vcpu); + assert_transition_res(-EPERM, __pkvm_host_share_guest, pfn, gfn, 1, vcpu, prot); + + selftest_state.host = PKVM_NOPAGE; + selftest_state.guest[1] = PKVM_PAGE_OWNED; + assert_transition_res(0, __pkvm_host_donate_guest, pfn, gfn + 1, vcpu); + + selftest_state.host = PKVM_PAGE_OWNED; + selftest_state.guest[1] = PKVM_NOPAGE; + assert_transition_res(0, __pkvm_host_reclaim_page_guest, gfn + 1, vm); + assert_transition_res(-EPERM, __pkvm_host_donate_guest, pfn, gfn, vcpu); + assert_transition_res(-EPERM, __pkvm_host_share_guest, pfn, gfn, 1, vcpu, prot); selftest_state.host = PKVM_NOPAGE; selftest_state.hyp = PKVM_PAGE_OWNED; |
