linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL] tracing: probeevent: Correctly update remaining space in dynamic area
@ 2019-02-13  2:07 Steven Rostedt
  2019-02-14 18:05 ` pr-tracker-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2019-02-13  2:07 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: LKML, Ingo Molnar, Andrew Morton, Masami Hiramatsu, Andreas Ziegler


Linus,

This fixes kprobes/uprobes dynamic processing of strings, where
it processes the args but does not update the remaining length
of the buffer that the string arguments will be placed in. It
constantly passes in the total size of buffer used instead of
passing in the remaining size of the buffer used. This could cause
issues if the strings are larger than the max size of an event
which could cause the strings to be written beyond what was reserved
on the buffer.


Please pull the latest trace-v5.0-rc4 tree, which can be found at:


  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
trace-v5.0-rc4

Tag SHA1: 2ed4d789cd16de14657339cec2bbeb5ce3cc192f
Head SHA1: f6675872db57305fa957021efc788f9983ed3b67


Andreas Ziegler (1):
      tracing: probeevent: Correctly update remaining space in dynamic area

----
 kernel/trace/trace_probe_tmpl.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---------------------------
commit f6675872db57305fa957021efc788f9983ed3b67
Author: Andreas Ziegler <andreas.ziegler@fau.de>
Date:   Wed Feb 6 20:00:13 2019 +0100

    tracing: probeevent: Correctly update remaining space in dynamic area
    
    Commit 9178412ddf5a ("tracing: probeevent: Return consumed
    bytes of dynamic area") improved the string fetching
    mechanism by returning the number of required bytes after
    copying the argument to the dynamic area. However, this
    return value is now only used to increment the pointer
    inside the dynamic area but misses updating the 'maxlen'
    variable which indicates the remaining space in the dynamic
    area.
    
    This means that fetch_store_string() always reads the *total*
    size of the dynamic area from the data_loc pointer instead of
    the *remaining* size (and passes it along to
    strncpy_from_{user,unsafe}) even if we're already about to
    copy data into the middle of the dynamic area.
    
    Link: http://lkml.kernel.org/r/20190206190013.16405-1-andreas.ziegler@fau.de
    
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: stable@vger.kernel.org
    Fixes: 9178412ddf5a ("tracing: probeevent: Return consumed bytes of dynamic area")
    Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
    Signed-off-by: Andreas Ziegler <andreas.ziegler@fau.de>
    Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

diff --git a/kernel/trace/trace_probe_tmpl.h b/kernel/trace/trace_probe_tmpl.h
index 5c56afc17cf8..4737bb8c07a3 100644
--- a/kernel/trace/trace_probe_tmpl.h
+++ b/kernel/trace/trace_probe_tmpl.h
@@ -180,10 +180,12 @@ store_trace_args(void *data, struct trace_probe *tp, struct pt_regs *regs,
 		if (unlikely(arg->dynamic))
 			*dl = make_data_loc(maxlen, dyndata - base);
 		ret = process_fetch_insn(arg->code, regs, dl, base);
-		if (unlikely(ret < 0 && arg->dynamic))
+		if (unlikely(ret < 0 && arg->dynamic)) {
 			*dl = make_data_loc(0, dyndata - base);
-		else
+		} else {
 			dyndata += ret;
+			maxlen -= ret;
+		}
 	}
 }
 

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

* Re: [GIT PULL] tracing: probeevent: Correctly update remaining space in dynamic area
  2019-02-13  2:07 [GIT PULL] tracing: probeevent: Correctly update remaining space in dynamic area Steven Rostedt
@ 2019-02-14 18:05 ` pr-tracker-bot
  0 siblings, 0 replies; 2+ messages in thread
From: pr-tracker-bot @ 2019-02-14 18:05 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Linus Torvalds, LKML, Ingo Molnar, Andrew Morton,
	Masami Hiramatsu, Andreas Ziegler

The pull request you sent on Tue, 12 Feb 2019 21:07:45 -0500:

> git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git trace-v5.0-rc4

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/b6ea7bcf77831ee5741e903738a19c94715b15e9

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker

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

end of thread, other threads:[~2019-02-14 18:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-13  2:07 [GIT PULL] tracing: probeevent: Correctly update remaining space in dynamic area Steven Rostedt
2019-02-14 18:05 ` pr-tracker-bot

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