mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Sasha Levin <sasha.levin@oracle.com>, Ingo Molnar <mingo@kernel.org>
Subject: [for-next][PATCH] tracing: Don't make assumptions about length of string on task rename
Date: Tue, 1 Sep 2015 10:04:13 -0400	[thread overview]
Message-ID: <20150901100413.2bd48026@gandalf.local.home> (raw)

  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
for-next

Head SHA1: f0a515780393dffbb363e6d1567da46af6f3c5f3


Sasha Levin (1):
      tracing: Don't make assumptions about length of string on task rename

----
 include/trace/events/task.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---------------------------
commit f0a515780393dffbb363e6d1567da46af6f3c5f3
Author: Sasha Levin <sasha.levin@oracle.com>
Date:   Fri Aug 28 07:06:58 2015 -0400

    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.com
    
    Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

diff --git a/include/trace/events/task.h b/include/trace/events/task.h
index dee3bb1d5a6b..2cca6cd342d8 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;
 	),
 

                 reply	other threads:[~2015-09-01 14:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150901100413.2bd48026@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=sasha.levin@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®