Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1215286
| From | Sasha Levin <sasha.levin@oracle.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] tracepoint: don't make assumptions about length of string on task rename |
| Date | 2015-08-28 13:10 +0200 |
| Message-ID | <q2pHJ-1s8-57@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
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. Signed-off-by: Sasha Levin <sasha.levin@oracle.com> --- include/trace/events/task.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/trace/events/task.h b/include/trace/events/task.h index dee3bb1..2cca6cd 100644 --- a/include/trace/events/task.h +++ b/include/trace/events/task.h @@ -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; ), -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] tracepoint: don't make assumptions about length of string on task rename Sasha Levin <sasha.levin@oracle.com> - 2015-08-28 13:10 +0200
Re: [PATCH] tracepoint: don't make assumptions about length of string on task rename Steven Rostedt <rostedt@goodmis.org> - 2015-08-28 17:10 +0200
Re: [PATCH] tracepoint: don't make assumptions about length of string on task rename Sasha Levin <sasha.levin@oracle.com> - 2015-09-01 17:10 +0200
Re: [PATCH] tracepoint: don't make assumptions about length of string on task rename Steven Rostedt <rostedt@goodmis.org> - 2015-09-01 17:40 +0200
csiph-web