Commit c2bbdee
tracing: Fix syscall events activation by ensuring refcount hits zero
commit 0a663b7 upstream.
When multiple syscall events are specified in the kernel command line
(e.g., trace_event=syscalls:sys_enter_openat,syscalls:sys_enter_close),
they are often not captured after boot, even though they appear enabled
in the tracing/set_event file.
The issue stems from how syscall events are initialized. Syscall
tracepoints require the global reference count (sys_tracepoint_refcount)
to transition from 0 to 1 to trigger the registration of the syscall
work (TIF_SYSCALL_TRACEPOINT) for tasks, including the init process (pid 1).
The current implementation of early_enable_events() with disable_first=true
used an interleaved sequence of "Disable A -> Enable A -> Disable B -> Enable B".
If multiple syscalls are enabled, the refcount never drops to zero,
preventing the 0->1 transition that triggers actual registration.
Fix this by splitting early_enable_events() into two distinct phases:
1. Disable all events specified in the buffer.
2. Enable all events specified in the buffer.
This ensures the refcount hits zero before re-enabling, allowing syscall
events to be properly activated during early boot.
The code is also refactored to use a helper function to avoid logic
duplication between the disable and enable phases.
Cc: stable@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://patch.msgid.link/20260224023544.1250787-1-hehuiwen@kylinos.cn
Fixes: ce1039b ("tracing: Fix enabling of syscall events on the command line")
Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent efd9598 commit c2bbdee
1 file changed
+37
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4173 | 4173 | | |
4174 | 4174 | | |
4175 | 4175 | | |
4176 | | - | |
4177 | | - | |
| 4176 | + | |
| 4177 | + | |
| 4178 | + | |
| 4179 | + | |
| 4180 | + | |
4178 | 4181 | | |
4179 | 4182 | | |
4180 | | - | |
4181 | | - | |
4182 | | - | |
4183 | | - | |
4184 | | - | |
4185 | | - | |
4186 | | - | |
4187 | 4183 | | |
| 4184 | + | |
4188 | 4185 | | |
4189 | | - | |
4190 | | - | |
| 4186 | + | |
| 4187 | + | |
| 4188 | + | |
| 4189 | + | |
4191 | 4190 | | |
4192 | | - | |
4193 | | - | |
4194 | | - | |
4195 | | - | |
| 4191 | + | |
4196 | 4192 | | |
4197 | 4193 | | |
4198 | 4194 | | |
| |||
4201 | 4197 | | |
4202 | 4198 | | |
4203 | 4199 | | |
| 4200 | + | |
| 4201 | + | |
| 4202 | + | |
| 4203 | + | |
| 4204 | + | |
| 4205 | + | |
| 4206 | + | |
| 4207 | + | |
| 4208 | + | |
| 4209 | + | |
| 4210 | + | |
| 4211 | + | |
| 4212 | + | |
| 4213 | + | |
| 4214 | + | |
| 4215 | + | |
| 4216 | + | |
| 4217 | + | |
| 4218 | + | |
| 4219 | + | |
| 4220 | + | |
| 4221 | + | |
| 4222 | + | |
| 4223 | + | |
| 4224 | + | |
| 4225 | + | |
4204 | 4226 | | |
4205 | 4227 | | |
4206 | 4228 | | |
| |||
0 commit comments