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-11-15 20:47:07 -08:00
2021-11-06 14:08:17 -07:00
2021-05-07 00:26:34 -07:00
2021-11-03 17:21:37 +00:00
2021-11-09 10:56:41 -08:00
2021-11-19 09:15:58 -06:00
2021-11-23 09:45:37 +01:00
2021-10-19 17:27:05 +02:00
2021-06-22 11:07:18 -07:00
2021-11-11 09:50:30 +01:00
2021-09-13 16:41:20 -07:00
2021-11-01 20:05:19 -07:00
2021-11-23 09:45:36 +01:00
2021-11-24 13:50:18 +01:00
2021-11-18 10:50:45 -08:00
2021-11-01 20:25:38 -07:00
2021-11-24 12:20:27 +01:00
2021-11-02 12:52:17 +01:00
2021-12-01 21:04:34 -05:00
2021-05-02 00:43:35 +09:00
2021-10-18 06:17:01 -06:00
2021-05-07 00:26:33 -07:00
2021-10-27 12:32:34 +02:00
2021-11-01 21:17:39 -07:00
2021-11-06 16:43:20 -07:00
2021-03-22 15:23:32 -04:00
2021-11-01 21:17:39 -07:00
2021-09-19 22:34:38 -04:00
2021-11-01 21:17:39 -07:00
2021-08-11 13:11:12 -07:00
2021-09-08 15:32:35 -07:00
2021-08-16 18:55:32 +02:00
2021-11-24 12:20:27 +01:00
2021-07-08 11:48:22 -07:00
2021-10-20 10:45:34 -05:00
2021-05-12 11:43:25 +02:00
2021-11-03 12:15:29 -07:00
2021-11-09 10:02:51 -08:00
2021-11-14 10:43:38 -08:00
2021-06-18 11:43:08 +02:00
2021-05-27 04:01:50 +09:00
2021-02-26 09:41:03 -08:00
2021-07-02 12:08:10 -07:00
2021-10-15 11:25:18 +02:00
2021-07-05 10:46:20 +02:00
2021-10-04 10:58:25 -07:00
2021-08-17 17:50:51 +02:00
2021-11-11 13:09:33 +01:00
2021-11-09 10:02:52 -08:00
2021-08-30 16:36:10 +02:00
2021-11-06 13:30:42 -07:00
2021-02-22 12:33:26 +00:00
2021-09-08 15:32:34 -07:00
2021-05-07 00:26:33 -07:00
2021-11-01 20:05:19 -07:00
2021-11-10 16:15:54 -08:00
2021-11-01 20:05:19 -07:00
2021-11-05 15:13:10 -07:00
2021-08-16 18:55:32 +02:00
2021-09-03 09:58:12 -07:00
2021-08-27 16:30:18 +08:00
2021-08-30 16:36:10 +02:00
2021-08-16 14:42:22 +02:00
2021-09-03 09:58:12 -07:00
2021-10-14 13:29:18 +02:00
2021-09-08 11:50:26 -07:00
2021-06-18 11:43:09 +02:00
2021-11-12 11:53:16 -08:00
2021-11-09 10:02:52 -08:00
2021-09-22 10:24:01 -04:00
2021-09-16 10:27:48 -07:00
2021-09-30 09:37:27 +01:00
2021-09-01 14:52:05 -07:00
2021-11-19 09:15:58 -06:00
2021-10-22 15:32:46 +02:00
2021-08-10 14:57:42 +02:00
2021-08-10 22:50:07 +02:00
2021-11-06 13:30:43 -07:00
2021-07-05 10:46:33 +02:00
2021-03-23 16:01:58 +01:00
2021-10-07 13:51:11 +02:00
2021-09-08 12:55:35 -07:00
2021-06-23 16:41:24 -06:00
2021-09-03 10:08:28 -07:00
2021-04-30 11:20:42 -07:00
2021-08-10 10:48:07 -07:00
2021-08-16 11:39:51 -04:00
2021-11-06 13:30:35 -07:00
2021-10-20 10:45:34 -05:00
2021-05-07 00:26:34 -07:00
2021-05-09 13:07:03 -07:00
2021-09-03 09:58:12 -07:00
2021-09-08 11:50:27 -07:00
2021-07-03 11:41:14 -07:00
2021-01-26 11:16:34 +00:00
2021-06-29 10:53:46 -07:00
2021-08-17 07:49:10 -10:00
2021-11-06 14:08:17 -07:00