Chen Jun
a501f2500f
tracing: Fix a kmemleak false positive in tracing_map
[ Upstream commit f25667e598 ]
Doing the command:
echo 'hist:key=common_pid.execname,common_timestamp' > /sys/kernel/debug/tracing/events/xxx/trigger
Triggers many kmemleak reports:
unreferenced object 0xffff0000c7ea4980 (size 128):
comm "bash", pid 338, jiffies 4294912626 (age 9339.324s)
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:
[<00000000f3469921>] kmem_cache_alloc_trace+0x4c0/0x6f0
[<0000000054ca40c3>] hist_trigger_elt_data_alloc+0x140/0x178
[<00000000633bd154>] tracing_map_init+0x1f8/0x268
[<000000007e814ab9>] event_hist_trigger_func+0xca0/0x1ad0
[<00000000bf8520ed>] trigger_process_regex+0xd4/0x128
[<00000000f549355a>] event_trigger_write+0x7c/0x120
[<00000000b80f898d>] vfs_write+0xc4/0x380
[<00000000823e1055>] ksys_write+0x74/0xf8
[<000000008a9374aa>] __arm64_sys_write+0x24/0x30
[<0000000087124017>] do_el0_svc+0x88/0x1c0
[<00000000efd0dcd1>] el0_svc+0x1c/0x28
[<00000000dbfba9b3>] el0_sync_handler+0x88/0xc0
[<00000000e7399680>] el0_sync+0x148/0x180
unreferenced object 0xffff0000c7ea4980 (size 128):
comm "bash", pid 338, jiffies 4294912626 (age 9339.324s)
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:
[<00000000f3469921>] kmem_cache_alloc_trace+0x4c0/0x6f0
[<0000000054ca40c3>] hist_trigger_elt_data_alloc+0x140/0x178
[<00000000633bd154>] tracing_map_init+0x1f8/0x268
[<000000007e814ab9>] event_hist_trigger_func+0xca0/0x1ad0
[<00000000bf8520ed>] trigger_process_regex+0xd4/0x128
[<00000000f549355a>] event_trigger_write+0x7c/0x120
[<00000000b80f898d>] vfs_write+0xc4/0x380
[<00000000823e1055>] ksys_write+0x74/0xf8
[<000000008a9374aa>] __arm64_sys_write+0x24/0x30
[<0000000087124017>] do_el0_svc+0x88/0x1c0
[<00000000efd0dcd1>] el0_svc+0x1c/0x28
[<00000000dbfba9b3>] el0_sync_handler+0x88/0xc0
[<00000000e7399680>] el0_sync+0x148/0x180
The reason is elts->pages[i] is alloced by get_zeroed_page.
and kmemleak will not scan the area alloced by get_zeroed_page.
The address stored in elts->pages will be regarded as leaked.
That is, the elts->pages[i] will have pointers loaded onto it as well, and
without telling kmemleak about it, those pointers will look like memory
without a reference.
To fix this, call kmemleak_alloc to tell kmemleak to scan elts->pages[i]
Link: https://lkml.kernel.org/r/20211124140801.87121-1-chenjun102@huawei.com
Signed-off-by: Chen Jun <chenjun102@huawei.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-12-22 09:19:00 +01:00
..
2021-12-14 10:18:05 +01:00
2021-11-26 11:36:07 +01:00
2021-03-04 09:39:31 +01:00
2021-10-27 09:53:12 +02:00
2021-11-26 11:36:24 +01:00
2020-09-17 13:45:31 +02:00
2021-08-26 08:36:40 -04:00
2021-11-26 11:36:04 +01:00
2021-12-01 09:27:43 +01:00
2021-11-12 14:40:50 +01:00
2021-09-26 13:39:46 +02:00
2021-12-14 10:18:06 +01:00
2021-09-22 11:47:49 +02:00
2021-12-22 09:19:00 +01:00
2020-10-01 13:14:33 +02:00
2020-06-22 09:05:13 +02:00
2020-06-22 09:05:13 +02:00
2020-06-22 09:05:13 +02:00
2020-06-22 09:04:58 +02:00
2020-06-22 09:05:28 +02:00
2021-07-20 16:16:04 +02:00
2021-01-30 13:32:11 +01:00
2020-11-24 13:27:23 +01:00
2021-09-22 11:48:09 +02:00
2021-07-11 12:49:30 +02:00
2021-03-04 09:39:30 +01:00
2020-07-16 08:17:26 +02:00
2021-02-03 23:23:23 +01:00
2021-05-22 10:59:44 +02:00
2020-04-17 10:48:52 +02:00
2021-12-08 08:50:12 +01:00
2021-07-11 12:49:31 +02:00
2021-02-10 09:21:06 +01:00
2020-01-29 16:43:27 +01:00
2021-06-30 08:48:28 -04:00
2020-03-25 08:06:13 +01:00
2021-08-08 08:54:30 +02:00
2021-09-22 11:48:09 +02:00
2021-09-26 13:39:48 +02:00
2021-05-26 11:48:32 +02:00
2020-11-18 19:18:52 +01:00
2020-08-26 10:30:59 +02:00
2021-03-04 09:39:54 +01:00
2021-11-26 11:36:02 +01:00
2021-05-22 10:59:39 +02:00
2021-02-07 14:48:38 +01:00
2021-09-26 13:39:47 +02:00
2021-02-07 14:48:37 +01:00
2021-07-20 16:15:42 +02:00
2020-10-14 10:31:21 +02:00
2021-05-22 10:59:39 +02:00
2020-02-24 08:34:49 +01:00
2021-11-26 11:36:06 +01:00