Commit 067df9e
tracing: Fix potential null-pointer-access of entry in list 'tr->err_log'
Entries in list 'tr->err_log' will be reused after entry number
exceed TRACING_LOG_ERRS_MAX.
The cmd string of the to be reused entry will be freed first then
allocated a new one. If the allocation failed, then the entry will
still be in list 'tr->err_log' but its 'cmd' field is set to be NULL,
later access of 'cmd' is risky.
Currently above problem can cause the loss of 'cmd' information of first
entry in 'tr->err_log'. When execute `cat /sys/kernel/tracing/error_log`,
reproduce logs like:
[ 37.495100] trace_kprobe: error: Maxactive is not for kprobe(null) ^
[ 38.412517] trace_kprobe: error: Maxactive is not for kprobe
Command: p4:myprobe2 do_sys_openat2
^
Link: https://lore.kernel.org/linux-trace-kernel/20221114104632.3547266-1-zhengyejian1@huawei.com
Fixes: 1581a88 ("tracing: Remove size restriction on tracing_log_err cmd strings")
Signed-off-by: Zheng Yejian <zhengyejian1@huawei.com>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>1 parent b875206 commit 067df9e
1 file changed
+5
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7803 | 7803 | | |
7804 | 7804 | | |
7805 | 7805 | | |
| 7806 | + | |
7806 | 7807 | | |
7807 | 7808 | | |
7808 | 7809 | | |
| |||
7811 | 7812 | | |
7812 | 7813 | | |
7813 | 7814 | | |
7814 | | - | |
| 7815 | + | |
| 7816 | + | |
| 7817 | + | |
7815 | 7818 | | |
7816 | 7819 | | |
7817 | | - | |
7818 | | - | |
7819 | | - | |
| 7820 | + | |
7820 | 7821 | | |
7821 | 7822 | | |
7822 | 7823 | | |
| |||
0 commit comments