Skip to content

Commit facee1b

Browse files
David BrazdilMarc Zyngier
authored andcommitted
KVM: arm64: Fix off-by-one in range_is_memory
Hyp checks whether an address range only covers RAM by checking the start/endpoints against a list of memblock_region structs. However, the endpoint here is exclusive but internally is treated as inclusive. Fix the off-by-one error that caused valid address ranges to be rejected. Cc: Quentin Perret <[email protected]> Fixes: 90134ac ("KVM: arm64: Protect the .hyp sections from the host") Signed-off-by: David Brazdil <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 5cf1774 commit facee1b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/arm64/kvm/hyp/nvhe/mem_protect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static bool range_is_memory(u64 start, u64 end)
193193
{
194194
struct kvm_mem_range r1, r2;
195195

196-
if (!find_mem_range(start, &r1) || !find_mem_range(end, &r2))
196+
if (!find_mem_range(start, &r1) || !find_mem_range(end - 1, &r2))
197197
return false;
198198
if (r1.start != r2.start)
199199
return false;

0 commit comments

Comments
 (0)