mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
tracing: Prevent kernel oops with corrupted buffer
If the contents of the ftrace ring buffer gets corrupted and the trace file is read, it could create a kernel oops (usualy just killing the user task thread). This is caused by the checking of the pid in the buffer. If the pid is negative, it still references the cmdline cache array, which could point to an invalid address. The simple fix is to test for negative PIDs. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
parent
f6760aa024
commit
74bf4076f2
1 changed files with 5 additions and 0 deletions
|
@ -951,6 +951,11 @@ void trace_find_cmdline(int pid, char comm[])
|
|||
return;
|
||||
}
|
||||
|
||||
if (WARN_ON_ONCE(pid < 0)) {
|
||||
strcpy(comm, "<XXX>");
|
||||
return;
|
||||
}
|
||||
|
||||
if (pid > PID_MAX_DEFAULT) {
|
||||
strcpy(comm, "<...>");
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue