ANDROID: KVM: arm64: Prevent kmemleak from accessing .hyp.data

We've recently added a .data section for the hypervisor, which kmemleak
is eager to parse. This clearly doesn't go well, so add the section to
kmemleak's block list.

Bug: 235903024
Signed-off-by: Quentin Perret <qperret@google.com>
Change-Id: I29d81cb1246c590bd5203d560ea369e5f29d59b0
This commit is contained in:
Quentin Perret
2022-06-14 09:18:32 +00:00
parent 2f97e58fd2
commit 06e6eb707d

View File

@@ -2139,11 +2139,11 @@ static int finalize_hyp_mode(void)
return 0;
/*
* Exclude HYP BSS from kmemleak so that it doesn't get peeked
* at, which would end badly once the section is inaccessible.
* None of other sections should ever be introspected.
* Exclude HYP BSS and DATA from kmemleak so that they don't get peeked
* at, which would end badly once the sections are inaccessible.
*/
kmemleak_free_part(__hyp_bss_start, __hyp_bss_end - __hyp_bss_start);
kmemleak_free_part(__hyp_data_start, __hyp_data_end - __hyp_data_start);
return pkvm_drop_host_privileges();
}