Skip to content

Commit

Permalink
tracing: Don't make assumptions about length of string on task rename
Browse files Browse the repository at this point in the history
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/[email protected]

Signed-off-by: Sasha Levin <[email protected]>
Signed-off-by: Steven Rostedt <[email protected]>
  • Loading branch information
sashalevin authored and rostedt committed Aug 31, 2015
1 parent 9f61668 commit f0a5157
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/trace/events/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
),

Expand Down

0 comments on commit f0a5157

Please sign in to comment.