Skip to content

Commit 522c9a6

Browse files
Zenghui YuMarc Zyngier
authored andcommitted
KVM: arm64: Use kmemleak_free_part_phys() to unregister hyp_mem_base
With commit 0c24e06 ("mm: kmemleak: add rbtree and store physical address for objects allocated with PA"), kmemleak started to put the objects allocated with physical address onto object_phys_tree_root tree. The kmemleak_free_part() therefore no longer worked as expected on physically allocated objects (hyp_mem_base in this case) as it attempted to search and remove things in object_tree_root tree. Fix it by using kmemleak_free_part_phys() to unregister hyp_mem_base. This fixes an immediate crash when booting a KVM host in protected mode with kmemleak enabled. Signed-off-by: Zenghui Yu <[email protected]> Acked-by: Catalin Marinas <[email protected]> Reviewed-by: Oliver Upton <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 1c23f9e commit 522c9a6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/arm64/kvm/arm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2114,7 +2114,7 @@ static int finalize_hyp_mode(void)
21142114
* at, which would end badly once inaccessible.
21152115
*/
21162116
kmemleak_free_part(__hyp_bss_start, __hyp_bss_end - __hyp_bss_start);
2117-
kmemleak_free_part(__va(hyp_mem_base), hyp_mem_size);
2117+
kmemleak_free_part_phys(hyp_mem_base, hyp_mem_size);
21182118
return pkvm_drop_host_privileges();
21192119
}
21202120

0 commit comments

Comments
 (0)