提交 f0a51578 编写于 作者: S Sasha Levin 提交者: Steven Rostedt

tracing: Don't make assumptions about length of string on task rename

While the dest comm string size is assured to be at least TASK_COMM_LEN long,
doing a memcpy() also adds the assumption that the source is at least that
long as well, which isn't assured, and isn't true in cases such as:

	set_task_comm(worker->task, "kworker/dying");

This leads to accessing invalid memory.

Link: http://lkml.kernel.org/r/1440760018-1557-1-git-send-email-sasha.levin@oracle.comSigned-off-by: NSasha Levin <sasha.levin@oracle.com>
Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
上级 9f616680
......@@ -46,7 +46,7 @@ TRACE_EVENT(task_rename,
TP_fast_assign(
__entry->pid = task->pid;
memcpy(entry->oldcomm, task->comm, TASK_COMM_LEN);
memcpy(entry->newcomm, comm, TASK_COMM_LEN);
strlcpy(entry->newcomm, comm, TASK_COMM_LEN);
__entry->oom_score_adj = task->signal->oom_score_adj;
),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册