Skip to content

Commit

Permalink
KVM: arm64: Fix memory check in host_stage2_set_owner_locked()
Browse files Browse the repository at this point in the history
I found this simple bug while preparing some patches for pKVM.
AFAICT, it should be harmless (besides crashing the kernel if it
was misbehaving)

Fixes: e94a7de ("KVM: arm64: Move host page ownership tracking to the hyp vmemmap")
Signed-off-by: Mostafa Saleh <smostafa@google.com>
Link: https://lore.kernel.org/r/20250501162450.2784043-1-smostafa@google.com
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
  • Loading branch information
Mostafa Saleh authored and Oliver Upton committed May 7, 2025
1 parent ef296ee commit 3949e28
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/arm64/kvm/hyp/nvhe/mem_protect.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ int host_stage2_set_owner_locked(phys_addr_t addr, u64 size, u8 owner_id)
{
int ret;

if (!addr_is_memory(addr))
if (!range_is_memory(addr, addr + size))
return -EPERM;

ret = host_stage2_try(kvm_pgtable_stage2_set_owner, &host_mmu.pgt,
Expand Down

0 comments on commit 3949e28

Please sign in to comment.