linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL] tracing/kprobes: Fix strpbrk() argument order
@ 2018-11-06 14:11 Steven Rostedt
  2018-11-06 16:13 ` Linus Torvalds
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2018-11-06 14:11 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: LKML, Ingo Molnar, Andrew Morton, Masami Hiramatsu


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,

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [GIT PULL] tracing/kprobes: Fix strpbrk() argument order
  2018-11-06 14:11 [GIT PULL] tracing/kprobes: Fix strpbrk() argument order Steven Rostedt
@ 2018-11-06 16:13 ` Linus Torvalds
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Torvalds @ 2018-11-06 16:13 UTC (permalink / raw)
  To: rostedt; +Cc: Linux Kernel Mailing List, Ingo Molnar, Andrew Morton, mhiramat

On Tue, Nov 6, 2018 at 6:12 AM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> Masami found a slight bug in his code where he transposed the arguments of a
> call to strpbrk.

Pulled,

                  Linus

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-11-06 16:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-06 14:11 [GIT PULL] tracing/kprobes: Fix strpbrk() argument order Steven Rostedt
2018-11-06 16:13 ` Linus Torvalds

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).