diff options
author | Steven Rostedt <rostedt@goodmis.org> | 2013-06-27 16:58:31 +0200 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2013-07-02 02:34:22 +0200 |
commit | 6e94a780374ed31b280f939d4757e8d7858dff16 (patch) | |
tree | e319c403696469c0c818d5c4fe4b674b303eca9b /fs/stat.c | |
parent | ftrace: Fix stddev calculation in function profiler (diff) | |
download | linux-6e94a780374ed31b280f939d4757e8d7858dff16.tar.xz linux-6e94a780374ed31b280f939d4757e8d7858dff16.zip |
tracing: Failed to create system directory
Running the following:
# cd /sys/kernel/debug/tracing
# echo p:i do_sys_open > kprobe_events
# echo p:j schedule >> kprobe_events
# cat kprobe_events
p:kprobes/i do_sys_open
p:kprobes/j schedule
# echo p:i do_sys_open >> kprobe_events
# cat kprobe_events
p:kprobes/j schedule
p:kprobes/i do_sys_open
# ls /sys/kernel/debug/tracing/events/kprobes/
enable filter j
Notice that the 'i' is missing from the kprobes directory.
The console produces:
"Failed to create system directory kprobes"
This is because kprobes passes in a allocated name for the system
and the ftrace event subsystem saves off that name instead of creating
a duplicate for it. But the kprobes may free the system name making
the pointer to it invalid.
This bug was introduced by 92edca073c37 "tracing: Use direct field, type
and system names" which switched from using kstrdup() on the system name
in favor of just keeping apointer to it, as the internal ftrace event
system names are static and exist for the life of the computer being booted.
Instead of reverting back to duplicating system names again, we can use
core_kernel_data() to determine if the passed in name was allocated or
static. Then use the MSB of the ref_count to be a flag to keep track if
the name was allocated or not. Then we can still save from having to duplicate
strings that will always exist, but still copy the ones that may be freed.
Cc: stable@vger.kernel.org # 3.10
Reported-by: "zhangwei(Jovi)" <jovi.zhangwei@huawei.com>
Reported-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Tested-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'fs/stat.c')
0 files changed, 0 insertions, 0 deletions