Re: [syzbot] [trace?] KCSAN: data-race in __trace_trigger_soft_disabled / apply_subsystem_event_filter

From: Masami Hiramatsu (Google)

Date: Sun Nov 22 2026 - 01:48:23 EST


On Sat, 21 Nov 2026 16:18:36 -0800, syzbot <syzbot+1faa12be48036b80e416@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: d0f871bfb831 Merge tag 'arm64-fixes' of git://git.kernel.o..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=12708a03580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=886d2ddd2d6b664e
> dashboard link: https://syzkaller.appspot.com/bug?extid=1faa12be48036b80e416
> compiler: Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8
>
> Unfortunately, I don't have any reproducer for this issue yet.
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/018edb90159d/disk-d0f871bf.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/b27112368dea/vmlinux-d0f871bf.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/1f2c7b502c76/bzImage-d0f871bf.xz
>
> AI-generated root cause summary:
> `filter_disable()` (and its counterpart `event_set_filtered_flag()`) in
> `kernel/trace/trace_events_filter.c` updates `struct trace_event_file::flags`
> using non-atomic read-modify-write operations (`file->flags &=
> ~EVENT_FILE_FL_FILTERED`) instead of atomic bit operations
> (`test_and_clear_bit()`/`test_and_set_bit()`). Meanwhile, tracepoint handlers
> such as `trace_trigger_soft_disabled()` and `__trace_trigger_soft_disabled()`
> read `file->flags` locklessly without `READ_ONCE()`. Writing a failing subsystem
> filter via `subsystem_filter_write()` triggers `filter_disable()` while
> `sched_switch` concurrently executes `__trace_trigger_soft_disabled()` on
> another CPU, causing a KCSAN data race on `file->flags`.

Hmm, this means we need to update all code which accessing `file->flags`.
The point about using `READ_ONCE()` is correct, as the trigger must be able
to operate in parallel without acquiring a lock.

Thanks,

--
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>