[PATCH] powerpc/xive: silence kmemleak false positives

Qian Cai cai at lca.pw
Wed May 13 23:40:46 AEST 2020


opal_xive_donate_page() will reference the newly allocated memory using
__pa(). Since kmemleak is unable to track the physical memory resulting
in false positives, silence those by using kmemleak_ignore().

unreferenced object 0xc000201b53e90000 (size 65536):
 comm "qemu-kvm", pid 124557, jiffies 4295650285 (age 364.370s)
 hex dump (first 32 bytes):
   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
 backtrace:
   [<00000000acc2fb77>] xive_native_alloc_vp_block+0x168/0x210
   xive_native_provision_pages at arch/powerpc/sysdev/xive/native.c:645
   (inlined by) xive_native_alloc_vp_block at arch/powerpc/sysdev/xive/native.c:674
   [<000000004d5c7964>] kvmppc_xive_compute_vp_id+0x20c/0x3b0 [kvm]
   [<0000000055317cd2>] kvmppc_xive_connect_vcpu+0xa4/0x4a0 [kvm]
   [<0000000093dfc014>] kvm_arch_vcpu_ioctl+0x388/0x508 [kvm]
   [<00000000d25aea0f>] kvm_vcpu_ioctl+0x15c/0x950 [kvm]
   [<0000000048155cd6>] ksys_ioctl+0xd8/0x130
   [<0000000041ffeaa7>] sys_ioctl+0x28/0x40
   [<000000004afc4310>] system_call_exception+0x114/0x1e0
   [<00000000fb70a873>] system_call_common+0xf0/0x278

Signed-off-by: Qian Cai <cai at lca.pw>
---
 arch/powerpc/sysdev/xive/native.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/powerpc/sysdev/xive/native.c b/arch/powerpc/sysdev/xive/native.c
index 5218fdc4b29a..2d19f28967a6 100644
--- a/arch/powerpc/sysdev/xive/native.c
+++ b/arch/powerpc/sysdev/xive/native.c
@@ -18,6 +18,7 @@
 #include <linux/delay.h>
 #include <linux/cpumask.h>
 #include <linux/mm.h>
+#include <linux/kmemleak.h>
 
 #include <asm/machdep.h>
 #include <asm/prom.h>
@@ -647,6 +648,9 @@ static bool xive_native_provision_pages(void)
 			pr_err("Failed to allocate provisioning page\n");
 			return false;
 		}
+		/* Kmemleak is unable to track the physical address. */
+		kmemleak_ignore(p);
+
 		opal_xive_donate_page(chip, __pa(p));
 	}
 	return true;
-- 
2.21.0 (Apple Git-122.2)



More information about the Linuxppc-dev mailing list