Chen Jun
f25667e598
tracing: Fix a kmemleak false positive in tracing_map
...
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>
2021-12-01 21:04:34 -05:00
..
2021-10-19 05:54:57 -06:00
2021-11-15 20:35:58 -08:00
2020-07-13 16:55:49 -07:00
2021-02-26 09:41:02 -08:00
2021-10-20 23:44:43 -04:00
2020-05-12 18:24:34 -04:00
2021-11-11 10:16:33 -08:00
2021-08-16 11:37:20 -04:00
2020-01-30 09:46:28 -05:00
2021-10-05 17:30:08 -04:00
2021-10-07 09:56:38 -04:00
2021-10-05 17:38:45 -04:00
2021-02-02 17:02:07 -05:00
2020-07-29 11:43:53 +02:00
2021-11-10 11:56:29 -05:00
2021-03-23 14:08:18 -04:00
2020-11-10 20:39:40 -05:00
2021-10-26 09:18:10 -04:00
2021-02-02 17:02:06 -05:00
2021-06-18 09:10:00 -04:00
2021-10-08 18:08:43 -04:00
2021-08-18 18:10:32 -04:00
2021-06-25 19:57:24 -04:00
2021-10-29 09:54:14 -04:00
2021-10-27 12:25:09 -04:00
2021-03-25 16:04:35 -04:00
2021-12-01 21:04:22 -05:00
2021-02-02 17:02:06 -05:00
2021-10-08 18:08:43 -04:00
2021-08-20 14:18:40 -04:00
2021-11-27 16:50:43 -05:00
2020-11-10 20:39:40 -05:00
2021-10-13 18:19:41 -04:00
2021-10-27 11:21:49 -04:00
2021-10-26 09:18:28 -04:00
2021-02-02 17:02:06 -05:00
2021-07-27 17:05:06 +01:00
2021-10-08 18:08:43 -04:00
2021-02-02 17:02:07 -05:00
2021-11-12 09:25:59 -05:00
2021-09-30 21:24:08 -04:00
2020-11-06 08:42:26 -05:00
2020-09-14 10:08:07 +02:00
2021-10-08 18:08:43 -04:00
2021-08-19 09:09:03 -04:00
2021-08-20 14:18:40 -04:00
2021-08-20 14:18:40 -04:00
2021-10-08 18:08:43 -04:00
2020-01-30 09:46:10 -05:00
2021-06-30 09:19:14 -04:00
2021-10-21 14:18:48 -04:00
2021-03-23 14:08:18 -04:00
2021-10-08 18:08:43 -04:00
2021-10-08 18:08:43 -04:00
2019-11-14 13:15:11 -05:00
2021-09-08 15:29:16 -04:00
2021-02-02 17:02:06 -05:00
2021-11-23 20:52:01 -05:00
2021-11-18 21:10:18 -05:00
2021-11-26 17:37:06 -05:00
2021-12-01 21:04:34 -05:00
2020-11-10 20:39:40 -05:00