intel_pmu_init() extra_attr memory leak
From: Tommi Rantala
Date: Tue Dec 19 2017 - 05:15:30 EST
Hi,
I'm seeing this kmemleak report in v4.15-rc4:
# cat /sys/kernel/debug/kmemleak
unreferenced object 0xffff8801f3d5d720 (size 64):
comm "swapper/0", pid 1, jiffies 4294667312 (age 2687.423s)
hex dump (first 32 bytes):
60 d1 41 ad ff ff ff ff 20 d1 41 ad ff ff ff ff `.A..... .A.....
80 d0 41 ad ff ff ff ff 40 d0 41 ad ff ff ff ff ..A.....@.A.....
backtrace:
[<00000000ab01886a>] intel_pmu_init+0x1844/0x1d38
[<00000000cf20c5f0>] init_hw_perf_events+0x8c/0x66f
[<00000000dd69189d>] do_one_initcall+0x7b/0x1d0
[<000000008ee1f02a>] kernel_init_freeable+0x163/0x2f9
[<00000000e32ca8d9>] kernel_init+0xf/0x120
[<0000000038a99264>] ret_from_fork+0x24/0x30
[<00000000ace6d26f>] 0xffffffffffffffff
$ ./scripts/faddr2line vmlinux intel_pmu_init+0x1844/0x1d38
intel_pmu_init+0x1844/0x1d38:
intel_pmu_init at arch/x86/events/intel/core.c:4296
Which matches line:
extra_attr = merge_attr(extra_attr, skl_format_attr);
So looks like "extra_attr" is leaked here.
"git blame" points to this commit:
commit a5df70c354c26e20d5fd8eb64517f724e97ef0b2
Author: Andi Kleen <ak@xxxxxxxxxxxxxxx>
Date: Tue Aug 22 11:52:00 2017 -0700
perf/x86: Only show format attributes when supported
-Tommi