Wei Li
04e03d9a61
ftrace: Fix NULL pointer dereference in free_ftrace_func_mapper()
The mapper may be NULL when called from register_ftrace_function_probe()
with probe->data == NULL.
This issue can be reproduced as follow (it may be covered by compiler
optimization sometime):
/ # cat /sys/kernel/debug/tracing/set_ftrace_filter
#### all functions enabled ####
/ # echo foo_bar:dump > /sys/kernel/debug/tracing/set_ftrace_filter
[ 206.949100] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
[ 206.952402] Mem abort info:
[ 206.952819] ESR = 0x96000006
[ 206.955326] Exception class = DABT (current EL), IL = 32 bits
[ 206.955844] SET = 0, FnV = 0
[ 206.956272] EA = 0, S1PTW = 0
[ 206.956652] Data abort info:
[ 206.957320] ISV = 0, ISS = 0x00000006
[ 206.959271] CM = 0, WnR = 0
[ 206.959938] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000419f3a000
[ 206.960483] [0000000000000000] pgd=0000000411a87003, pud=0000000411a83003, pmd=0000000000000000
[ 206.964953] Internal error: Oops: 96000006 [#1] SMP
[ 206.971122] Dumping ftrace buffer:
[ 206.973677] (ftrace buffer empty)
[ 206.975258] Modules linked in:
[ 206.976631] Process sh (pid: 281, stack limit = 0x(____ptrval____))
[ 206.978449] CPU: 10 PID: 281 Comm: sh Not tainted 5.2.0-rc1+ #17
[ 206.978955] Hardware name: linux,dummy-virt (DT)
[ 206.979883] pstate: 60000005 (nZCv daif -PAN -UAO)
[ 206.980499] pc : free_ftrace_func_mapper+0x2c/0x118
[ 206.980874] lr : ftrace_count_free+0x68/0x80
[ 206.982539] sp : ffff0000182f3ab0
[ 206.983102] x29: ffff0000182f3ab0 x28: ffff8003d0ec1700
[ 206.983632] x27: ffff000013054b40 x26: 0000000000000001
[ 206.984000] x25: ffff00001385f000 x24: 0000000000000000
[ 206.984394] x23: ffff000013453000 x22: ffff000013054000
[ 206.984775] x21: 0000000000000000 x20: ffff00001385fe28
[ 206.986575] x19: ffff000013872c30 x18: 0000000000000000
[ 206.987111] x17: 0000000000000000 x16: 0000000000000000
[ 206.987491] x15: ffffffffffffffb0 x14: 0000000000000000
[ 206.987850] x13: 000000000017430e x12: 0000000000000580
[ 206.988251] x11: 0000000000000000 x10: cccccccccccccccc
[ 206.988740] x9 : 0000000000000000 x8 : ffff000013917550
[ 206.990198] x7 : ffff000012fac2e8 x6 : ffff000012fac000
[ 206.991008] x5 : ffff0000103da588 x4 : 0000000000000001
[ 206.991395] x3 : 0000000000000001 x2 : ffff000013872a28
[ 206.991771] x1 : 0000000000000000 x0 : 0000000000000000
[ 206.992557] Call trace:
[ 206.993101] free_ftrace_func_mapper+0x2c/0x118
[ 206.994827] ftrace_count_free+0x68/0x80
[ 206.995238] release_probe+0xfc/0x1d0
[ 206.995555] register_ftrace_function_probe+0x4a8/0x868
[ 206.995923] ftrace_trace_probe_callback.isra.4+0xb8/0x180
[ 206.996330] ftrace_dump_callback+0x50/0x70
[ 206.996663] ftrace_regex_write.isra.29+0x290/0x3a8
[ 206.997157] ftrace_filter_write+0x44/0x60
[ 206.998971] __vfs_write+0x64/0xf0
[ 206.999285] vfs_write+0x14c/0x2f0
[ 206.999591] ksys_write+0xbc/0x1b0
[ 206.999888] __arm64_sys_write+0x3c/0x58
[ 207.000246] el0_svc_common.constprop.0+0x408/0x5f0
[ 207.000607] el0_svc_handler+0x144/0x1c8
[ 207.000916] el0_svc+0x8/0xc
[ 207.003699] Code: aa0003f8 a9025bf5 aa0103f5 f946ea80 (f9400303)
[ 207.008388] ---[ end trace 7b6d11b5f542bdf1 ]---
[ 207.010126] Kernel panic - not syncing: Fatal exception
[ 207.011322] SMP: stopping secondary CPUs
[ 207.013956] Dumping ftrace buffer:
[ 207.014595] (ftrace buffer empty)
[ 207.015632] Kernel Offset: disabled
[ 207.017187] CPU features: 0x002,20006008
[ 207.017985] Memory Limit: none
[ 207.019825] ---[ end Kernel panic - not syncing: Fatal exception ]---
Link: http://lkml.kernel.org/r/20190606031754.10798-1-liwei391@huawei.com
Signed-off-by: Wei Li <liwei391@huawei.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-06-14 17:40:21 -04:00
..
2019-05-13 02:05:50 +02:00
2019-05-14 19:52:48 -07:00
2018-10-24 20:55:56 -04:00
2019-05-14 13:44:24 +01:00
2019-05-09 08:40:55 -07:00
2019-05-14 09:47:49 -07:00
2019-05-14 19:52:51 -07:00
2019-05-19 10:58:45 -07:00
2019-06-14 17:01:50 -04:00
2019-05-07 08:46:46 +02:00
2019-05-06 19:40:31 -07:00
2019-05-18 15:52:26 -07:00
2019-05-15 16:05:47 -07:00
2019-05-14 19:52:48 -07:00
2019-05-16 11:00:20 -07:00
2019-06-14 17:40:21 -04:00
2019-04-29 16:48:03 +02:00
2019-04-04 21:04:13 -04:00
2019-04-09 14:19:06 +02:00
2019-04-28 20:33:43 -04:00
2019-04-26 13:51:03 -04:00
2019-04-28 20:33:43 -04:00
2019-03-20 20:57:48 -04:00
2019-04-28 20:33:43 -04:00
2019-05-07 20:03:32 -07:00
2019-05-07 20:03:32 -07:00
2019-04-29 12:37:47 +02:00
2018-10-31 08:54:14 -07:00
2019-01-25 11:22:43 -08:00
2019-05-15 08:16:14 -07:00
2019-03-07 18:32:02 -08:00
2019-05-06 14:50:46 -07:00
2019-03-05 21:07:14 -08:00
2019-01-08 13:18:44 -08:00
2018-10-26 16:26:32 -07:00
2019-05-14 19:52:47 -07:00
2019-04-09 14:19:06 +02:00
2019-05-14 19:52:49 -07:00
2018-08-06 12:35:20 +02:00
2019-05-14 09:47:46 -07:00
2019-04-29 16:48:03 +02:00
2019-03-07 18:31:59 -08:00
2019-04-19 12:59:36 +02:00
2019-04-18 14:07:52 +02:00
2019-04-29 08:29:21 +02:00
2019-01-21 17:38:56 -03:00
2019-05-06 16:57:52 -07:00
2018-12-15 17:44:35 +09:00
2019-03-07 18:32:02 -08:00
2019-05-03 19:42:41 +02:00
2019-05-14 09:47:50 -07:00
2019-04-29 16:48:03 +02:00
2019-04-16 09:38:16 +02:00
2019-05-14 19:52:48 -07:00
2019-05-14 19:52:49 -07:00
2019-05-14 19:52:47 -07:00
2019-05-14 09:47:51 -07:00
2018-11-07 14:41:41 +01:00
2019-03-28 15:00:37 +01:00
2019-05-14 10:55:54 -07:00
2019-05-14 19:52:49 -07:00
2019-04-25 22:06:11 +02:00
2019-05-18 15:52:26 -07:00
2018-09-16 16:08:25 +02:00
2019-05-14 19:52:51 -07:00
2018-10-31 08:54:16 -07:00
2019-03-29 10:01:37 -07:00
2019-05-14 19:52:51 -07:00
2019-03-12 13:27:20 -07:00
2019-04-19 12:59:36 +02:00
2019-04-19 12:39:32 +02:00
2019-05-07 19:06:04 -07:00
2019-05-16 10:43:58 -07:00
2019-01-30 19:27:00 +01:00
2019-03-22 14:36:02 +01:00
2018-12-05 19:31:44 -08:00
2019-04-29 12:37:57 +02:00
2019-04-09 14:19:06 +02:00
2019-05-07 14:31:03 +02:00
2019-05-14 09:47:44 -07:00
2019-01-04 13:13:47 -08:00
2019-05-14 19:52:51 -07:00
2019-04-27 17:07:22 -04:00
2019-03-26 14:42:53 -07:00
2018-11-27 09:21:41 -08:00
2019-01-11 18:05:40 -08:00
2018-10-09 16:51:11 +02:00
2018-11-07 23:51:16 -06:00
2019-05-14 19:52:49 -07:00
2018-08-11 02:05:53 -05:00
2019-04-19 09:46:05 -07:00
2019-04-18 14:05:51 +02:00
2019-04-16 16:55:15 +02:00
2019-05-09 13:48:52 -07:00