Re: [PATCH 4.19 62/99] kmemleak: powerpc: skip scanning holes in the .bss section

From: Nobuhiro Iwamatsu
Date: Tue May 07 2019 - 04:00:06 EST


On Mon, May 06, 2019 at 04:32:35PM +0200, Greg Kroah-Hartman wrote:
> [ Upstream commit 298a32b132087550d3fa80641ca58323c5dfd4d9 ]
> Commit 2d4f567103ff ("KVM: PPC: Introduce kvm_tmp framework") adds
> kvm_tmp[] into the .bss section and then free the rest of unused spaces
> back to the page allocator.
> kernel_init
> kvm_guest_init
> kvm_free_tmp
> free_reserved_area
> free_unref_page
> free_unref_page_prepare
> With DEBUG_PAGEALLOC=y, it will unmap those pages from kernel. As the
> result, kmemleak scan will trigger a panic when it scans the .bss
> section with unmapped pages.
> This patch creates dedicated kmemleak objects for the .data, .bss and
> potentially .data..ro_after_init sections to allow partial freeing via
> the kmemleak_free_part() in the powerpc kvm_free_tmp() function.
> Link:
> Signed-off-by: Catalin Marinas <catalin.marinas@xxxxxxx>
> Reported-by: Qian Cai <cai@xxxxxx>
> Acked-by: Michael Ellerman <mpe@xxxxxxxxxxxxxx> (powerpc)
> Tested-by: Qian Cai <cai@xxxxxx>
> Cc: Paul Mackerras <paulus@xxxxxxxxx>
> Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
> Cc: Avi Kivity <avi@xxxxxxxxxx>
> Cc: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> Cc: Radim Krcmar <rkrcmar@xxxxxxxxxx>
> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
> ---
> arch/powerpc/kernel/kvm.c | 7 +++++++
> mm/kmemleak.c | 16 +++++++++++-----
> 2 files changed, 18 insertions(+), 5 deletions(-)

This commit has other problems, so we also need the following commits:

commit dce5b0bdeec61bdbee56121ceb1d014151d5cab1
Author: Arnd Bergmann <arnd@xxxxxxxx>
Date: Thu Apr 18 17:50:48 2019 -0700

mm/kmemleak.c: fix unused-function warning

The only references outside of the #ifdef have been removed, so now we
get a warning in non-SMP configurations:

mm/kmemleak.c:1404:13: error: unused function 'scan_large_block' [-Werror,-Wunused-function]

Add a new #ifdef around it.

Fixes: 298a32b13208 ("kmemleak: powerpc: skip scanning holes in the .bss section")
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
Acked-by: Catalin Marinas <catalin.marinas@xxxxxxx>
Cc: Vincent Whitchurch <vincent.whitchurch@xxxxxxxx>
Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

Please apply this commit.

Best regards,