* [syzbot] [trace?] BUG: unable to handle kernel paging request in __ftrace_set_clr_event_nolock
@ 2026-08-11 0:23 syzbot
2026-08-11 17:39 ` [PATCH] tracing: Fix NULL pointer dereference in module event cache removal Hui Su
0 siblings, 1 reply; 3+ messages in thread
From: syzbot @ 2026-08-11 0:23 UTC (permalink / raw)
To: linux-kernel, linux-trace-kernel, mathieu.desnoyers, mhiramat,
rostedt, syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: ba5cc80fd326 Merge branch 'for-next/core' into for-kernelci
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
console output: https://syzkaller.appspot.com/x/log.txt?x=10a75079580000
kernel config: https://syzkaller.appspot.com/x/.config?x=ccf4bea59f67007
dashboard link: https://syzkaller.appspot.com/bug?extid=4d3143c8e28f6266c636
compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8
userspace arch: arm64
Unfortunately, I don't have any reproducer for this issue yet.
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/959ad5f4e730/disk-ba5cc80f.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/0787d25f251e/vmlinux-ba5cc80f.xz
kernel image: https://storage.googleapis.com/syzbot-assets/2e85c36fabac/Image-ba5cc80f.gz.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+4d3143c8e28f6266c636@syzkaller.appspotmail.com
Unable to handle kernel paging request at virtual address dfff800000000000
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
Mem abort info:
ESR = 0x0000000096000005
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x05: level 1 translation fault
Data abort info:
ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000
CM = 0, WnR = 0, TnD = 0, TagAccess = 0
GCS = 0, Overlay = 0, DirtyBit = 0
[dfff800000000000] address between user and kernel address ranges
Internal error: Oops: 0000000096000005 [#1] SMP
Instance 9�G\x1e�̌83��s]t4 ��Ķy�G\x18|aJ� ��VF��8V$m��7To0FO�P�p\x1e��6�O\f%�DZ�rf0 not found
Modules linked in:
CPU: 1 UID: 0 PID: 15930 Comm: syz.7.4873 Tainted: G L syzkaller #0 PREEMPT
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/02/2026
pstate: 83400005 (Nzcv daif +PAN -UAO +TCO +DIT -SSBS BTYPE=--)
pc : strcmp+0x28/0xf0 lib/string.c:265
lr : remove_cache_mod kernel/trace/trace_events.c:948 [inline]
lr : cache_mod kernel/trace/trace_events.c:977 [inline]
lr : __ftrace_set_clr_event_nolock+0x6a0/0x940 kernel/trace/trace_events.c:1395
sp : ffff800093567840
x29: ffff800093567870 x28: dfff800000000000 x27: 0000000000000000
x26: ffff800088d6e8b0 x25: ffff0000c71e0580 x24: 00000000ffffffea
x23: ffff800088d6e8b0 x22: 0000000000000000 x21: dfff800000000000
x20: ffff0000c71e0598 x19: ffff0000d4e7e4a0 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000001
x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000
x11: 0000000000000000 x10: dfff800000000000 x9 : ffff0000d2e90f01
x8 : 0000000000000000 x7 : ffff800080538ea0 x6 : 0000000000000000
x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff8000806c6790
x2 : 0000000000000000 x1 : ffff0000d2e90f01 x0 : 0000000000000000
Call trace:
strcmp+0x28/0xf0 lib/string.c:265 (P)
remove_cache_mod kernel/trace/trace_events.c:948 [inline]
cache_mod kernel/trace/trace_events.c:977 [inline]
__ftrace_set_clr_event_nolock+0x6a0/0x940 kernel/trace/trace_events.c:1395
__ftrace_set_clr_event+0xa8/0xec kernel/trace/trace_events.c:1410
ftrace_set_clr_event+0x2a0/0x438 kernel/trace/trace_events.c:1460
ftrace_event_write+0x1dc/0x28c kernel/trace/trace_events.c:1548
vfs_write+0x2a4/0xa0c fs/read_write.c:685
ksys_write+0x12c/0x228 fs/read_write.c:739
__do_sys_write fs/read_write.c:750 [inline]
__se_sys_write fs/read_write.c:747 [inline]
__arm64_sys_write+0x84/0x98 fs/read_write.c:747
__invoke_syscall arch/arm64/kernel/syscall.c:35 [inline]
invoke_syscall+0x98/0x244 arch/arm64/kernel/syscall.c:49
el0_svc_common+0xec/0x23c arch/arm64/kernel/syscall.c:121
do_el0_svc+0x4c/0x5c arch/arm64/kernel/syscall.c:140
el0_svc+0x64/0x260 arch/arm64/kernel/entry-common.c:738
el0t_64_sync_handler+0x48/0x148 arch/arm64/kernel/entry-common.c:757
el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:590
Code: aa0103e9 f2fbffea d343fc0b 1200080c (38ea696b)
---[ end trace 0000000000000000 ]---
----------------
Code disassembly (best guess):
0: aa0103e9 mov x9, x1
4: f2fbffea movk x10, #0xdfff, lsl #48
8: d343fc0b lsr x11, x0, #3
c: 1200080c and w12, w0, #0x7
* 10: 38ea696b ldrsb w11, [x11, x10] <-- trapping instruction
---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title
If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] tracing: Fix NULL pointer dereference in module event cache removal
2026-08-11 0:23 [syzbot] [trace?] BUG: unable to handle kernel paging request in __ftrace_set_clr_event_nolock syzbot
@ 2026-08-11 17:39 ` Hui Su
2026-08-11 17:56 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: Hui Su @ 2026-08-11 17:39 UTC (permalink / raw)
To: syzbot+4d3143c8e28f6266c636, rostedt, mhiramat, mathieu.desnoyers
Cc: linux-kernel, linux-trace-kernel, syzkaller-bugs, Hui Su
A module-only event filter such as ":mod:foo" is cached with a NULL
event_mod->match when foo has not been loaded. If a later write tries to
remove a specific match from the same module, remove_cache_mod() passes
the NULL cached match to strcmp(), causing a NULL pointer dereference.
The issue can be reproduced from userspace by keeping one set_event file
descriptor open across both writes:
mount -t tracefs tracefs /sys/kernel/tracing
exec 3>/sys/kernel/tracing/set_event
printf ':mod:trace_events_kunit_missing\n' >&3
printf '!foo_bar:mod:trace_events_kunit_missing\n' >&3
The descriptor must remain open because reopening set_event with O_TRUNC
calls ftrace_clear_events() and removes the cached module filter before
the second write.
The crash was reproduced on x86_64 QEMU while KUnit workers contended on
the event tracing path:
BUG: kernel NULL pointer dereference, address: 0000000000000000
#PF: supervisor read access in kernel mode
RIP: 0010:strcmp+0x10/0x30
Call Trace:
__ftrace_set_clr_event_nolock+0x373/0x4a0
ftrace_set_clr_event+0xf0/0x180
ftrace_event_write+0xdf/0x110
vfs_write+0xf6/0x440
ksys_write+0x68/0xe0
do_syscall_64+0xf9/0x540
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Check event_mod->match before comparing it, consistent with the existing
NULL checks for the cached system and event fields. The mismatched removal
continues to return -EINVAL; a broad cached module filter is removed with
"!:mod:<module>".
Fixes: b355247df104 ("tracing: Cache \":mod:\" events for modules not loaded yet")
Reported-by: syzbot+4d3143c8e28f6266c636@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/lkml/6a7a6b7f.9c11d2ce.289b96.00f8.GAE@google.com/
Signed-off-by: Hui Su <sh_def@163.com>
---
kernel/trace/trace_events.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index c01b10b99f67..032f741ba616 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -945,7 +945,7 @@ static int remove_cache_mod(struct trace_array *tr, const char *mod,
if (strcmp(event_mod->module, mod) != 0)
continue;
- if (match && strcmp(event_mod->match, match) != 0)
+ if (match && (!event_mod->match || strcmp(event_mod->match, match) != 0))
continue;
if (system &&
--
2.54.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tracing: Fix NULL pointer dereference in module event cache removal
2026-08-11 17:39 ` [PATCH] tracing: Fix NULL pointer dereference in module event cache removal Hui Su
@ 2026-08-11 17:56 ` Steven Rostedt
0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2026-08-11 17:56 UTC (permalink / raw)
To: Hui Su
Cc: syzbot+4d3143c8e28f6266c636, mhiramat, mathieu.desnoyers,
linux-kernel, linux-trace-kernel, syzkaller-bugs
On Wed, 12 Aug 2026 01:39:03 +0800
Hui Su <sh_def@163.com> wrote:
> A module-only event filter such as ":mod:foo" is cached with a NULL
> event_mod->match when foo has not been loaded. If a later write tries to
> remove a specific match from the same module, remove_cache_mod() passes
> the NULL cached match to strcmp(), causing a NULL pointer dereference.
>
> The issue can be reproduced from userspace by keeping one set_event file
> descriptor open across both writes:
>
> mount -t tracefs tracefs /sys/kernel/tracing
> exec 3>/sys/kernel/tracing/set_event
> printf ':mod:trace_events_kunit_missing\n' >&3
> printf '!foo_bar:mod:trace_events_kunit_missing\n' >&3
>
> The descriptor must remain open because reopening set_event with O_TRUNC
> calls ftrace_clear_events() and removes the cached module filter before
> the second write.
>
> The crash was reproduced on x86_64 QEMU while KUnit workers contended on
> the event tracing path:
>
> BUG: kernel NULL pointer dereference, address: 0000000000000000
> #PF: supervisor read access in kernel mode
> RIP: 0010:strcmp+0x10/0x30
> Call Trace:
> __ftrace_set_clr_event_nolock+0x373/0x4a0
> ftrace_set_clr_event+0xf0/0x180
> ftrace_event_write+0xdf/0x110
> vfs_write+0xf6/0x440
> ksys_write+0x68/0xe0
> do_syscall_64+0xf9/0x540
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> Check event_mod->match before comparing it, consistent with the existing
> NULL checks for the cached system and event fields. The mismatched removal
> continues to return -EINVAL; a broad cached module filter is removed with
> "!:mod:<module>".
Thanks but it's actually easier to trigger it this way:
echo ':mod:trace_events_kunit_missing' > /sys/kernel/tracing/set_event
echo '!foo_bar:mod:trace_events_kunit_missing' >> /sys/kernel/tracing/set_event
as '>>' doesn't truncate.
I'll queue it up and start testing it.
-- Steve
>
> Fixes: b355247df104 ("tracing: Cache \":mod:\" events for modules not loaded yet")
> Reported-by: syzbot+4d3143c8e28f6266c636@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/lkml/6a7a6b7f.9c11d2ce.289b96.00f8.GAE@google.com/
> Signed-off-by: Hui Su <sh_def@163.com>
> ---
> kernel/trace/trace_events.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index c01b10b99f67..032f741ba616 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -945,7 +945,7 @@ static int remove_cache_mod(struct trace_array *tr, const char *mod,
> if (strcmp(event_mod->module, mod) != 0)
> continue;
>
> - if (match && strcmp(event_mod->match, match) != 0)
> + if (match && (!event_mod->match || strcmp(event_mod->match, match) != 0))
> continue;
>
> if (system &&
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-11 17:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-11 0:23 [syzbot] [trace?] BUG: unable to handle kernel paging request in __ftrace_set_clr_event_nolock syzbot
2026-08-11 17:39 ` [PATCH] tracing: Fix NULL pointer dereference in module event cache removal Hui Su
2026-08-11 17:56 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox