linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Masami Hiramatsu <mhiramat@kernel.org>
Subject: [GIT PULL] tracing/kprobes: Fix strpbrk() argument order
Date: Tue, 6 Nov 2018 09:11:56 -0500	[thread overview]
Message-ID: <20181106091156.1a373d76@gandalf.local.home> (raw)


Linus,

Masami found a slight bug in his code where he transposed the arguments of a
call to strpbrk.

The reason this wasn't detected in our tests is that the only way this would
transpire is when a kprobe event with a symbol offset is attached to a
function that belongs to a module that isn't loaded yet. When the kprobe
trace event is added, the offset would be truncated after it was parsed,
and when the module is loaded, it would use the symbol without the offset
(as the nul character added by the parsing would not be replaced with the
original character).


Please pull the latest trace-v4.20-rc1 tree, which can be found at:


  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
trace-v4.20-rc1

Tag SHA1: 112b3ade59dcaec85ec3402c4dd270e051b660dd
Head SHA1: ee474b81fe5aa5dc0faae920bf66240fbf55f891


Masami Hiramatsu (1):
      tracing/kprobes: Fix strpbrk() argument order

----
 kernel/trace/trace_probe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---------------------------
commit ee474b81fe5aa5dc0faae920bf66240fbf55f891
Author: Masami Hiramatsu <mhiramat@kernel.org>
Date:   Thu Nov 1 23:29:28 2018 +0900

    tracing/kprobes: Fix strpbrk() argument order
    
    Fix strpbrk()'s argument order, it must pass acceptable string
    in 2nd argument. Note that this can cause a kernel panic where
    it recovers backup character to code->data.
    
    Link: http://lkml.kernel.org/r/154108256792.2604.1816052586385217811.stgit@devbox
    
    Fixes: a6682814f371 ("tracing/kprobes: Allow kprobe-events to record module symbol")
    Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
    Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 3ef15a6683c0..bd30e9398d2a 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -535,7 +535,7 @@ int traceprobe_update_arg(struct probe_arg *arg)
 			if (code[1].op != FETCH_OP_IMM)
 				return -EINVAL;
 
-			tmp = strpbrk("+-", code->data);
+			tmp = strpbrk(code->data, "+-");
 			if (tmp)
 				c = *tmp;
 			ret = traceprobe_split_symbol_offset(code->data,

             reply	other threads:[~2018-11-06 14:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06 14:11 Steven Rostedt [this message]
2018-11-06 16:13 ` [GIT PULL] tracing/kprobes: Fix strpbrk() argument order Linus Torvalds

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=20181106091156.1a373d76@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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;
as well as URLs for NNTP newsgroup(s).