Subject: [Bug 216156] [bisected] kmemleak: Not scanning unknown object at 0xc00000007f000000

From: [email-masked]
Date: Mon, 09 Oct 2023 04:36:58 +0000

https://bugzilla.kernel.org/show_bug.cgi?id=216156

Michael Ellerman ([email-masked]) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            [email-masked]

--- Comment #13 from Michael Ellerman ([email-masked]) ---
Thanks for the bisect.

I think I see what's happening. pmac_probe() is called before
mem_topology_setup(), so the min/max PFN variables are still zero. That causes
kmemleak_alloc_phys() to ignore the allocation, because the checks against the
PFN fail. Then kmemleak_no_scan() can't find the allocation and prints that
warning.

Can you try this, it moves the kmemleak_no_scan() call later:

diff --git a/arch/powerpc/sysdev/dart_iommu.c
b/arch/powerpc/sysdev/dart_iommu.c
index 98096bbfd62e..3883cb8a747e 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -243,9 +243,6 @@ static void __init allocate_dart(void)
        if (!dart_tablebase)
                panic("Failed to allocate 16MB below 2GB for DART table\n");

-       /* There is no point scanning the DART space for leaks*/
-       kmemleak_no_scan((void *)dart_tablebase);
-
        /* Allocate a spare page to map all invalid DART pages. We need to do
         * that to work around what looks like a problem with the HT bridge
         * prefetching into invalid pages and corrupting data
@@ -435,6 +432,9 @@ static int __init iommu_init_late_dart(void)
        if (!dart_tablebase)
                return 0;

+       // There is no point scanning the DART table for leaks.
+       kmemleak_no_scan(dart_tablebase);
+
        ppc_md.iommu_restore = iommu_dart_restore;

        return 0;

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.