Home Home > GIT Browse > SLE11-SP4
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiroslav Benes <mbenes@suse.cz>2018-12-27 15:40:56 +0100
committerMiroslav Benes <mbenes@suse.cz>2018-12-27 15:40:56 +0100
commitf5f45e54f5b3fac0060974def3b21f8b7cf529e3 (patch)
tree58474cdf3f9f5cc985dca6d42a4cda935d4e55d6
parentcc06549c1f918638620c92ec0379353fc9d629ca (diff)
tracing: probeevent: Fix to support minus offset from symbol
(bsc#1120347).
-rw-r--r--patches.fixes/tracing-probeevent-fix-to-support-minus-offset-from-symbol.patch79
-rw-r--r--series.conf1
2 files changed, 80 insertions, 0 deletions
diff --git a/patches.fixes/tracing-probeevent-fix-to-support-minus-offset-from-symbol.patch b/patches.fixes/tracing-probeevent-fix-to-support-minus-offset-from-symbol.patch
new file mode 100644
index 0000000000..b74e61dc04
--- /dev/null
+++ b/patches.fixes/tracing-probeevent-fix-to-support-minus-offset-from-symbol.patch
@@ -0,0 +1,79 @@
+From: Masami Hiramatsu <mhiramat@kernel.org>
+Date: Sat, 17 Mar 2018 21:38:10 +0900
+Subject: tracing: probeevent: Fix to support minus offset from symbol
+Git-commit: c5d343b6b7badd1f5fe0873eff2e8d63a193e732
+Patch-mainline: v4.16-rc7
+References: bsc#1120347
+
+In Documentation/trace/kprobetrace.txt, it says
+
+ @SYM[+|-offs] : Fetch memory at SYM +|- offs (SYM should be a data symbol)
+
+However, the parser doesn't parse minus offset correctly, since
+commit 2fba0c8867af ("tracing/kprobes: Fix probe offset to be
+unsigned") drops minus ("-") offset support for kprobe probe
+address usage.
+
+This fixes the traceprobe_split_symbol_offset() to parse minus
+offset again with checking the offset range, and add a minus
+offset check in kprobe probe address usage.
+
+Link: http://lkml.kernel.org/r/152129028983.31874.13419301530285775521.stgit@devbox
+
+Cc: Ingo Molnar <mingo@redhat.com>
+Cc: Tom Zanussi <tom.zanussi@linux.intel.com>
+Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
+Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
+Cc: stable@vger.kernel.org
+Fixes: 2fba0c8867af ("tracing/kprobes: Fix probe offset to be unsigned")
+Acked-by: Namhyung Kim <namhyung@kernel.org>
+Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
+Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
+Acked-by: Miroslav Benes <mbenes@suse.cz>
+---
+ kernel/trace/trace_kprobe.c | 11 +++++------
+ 1 file changed, 5 insertions(+), 6 deletions(-)
+
+--- a/kernel/trace/trace_kprobe.c
++++ b/kernel/trace/trace_kprobe.c
+@@ -766,7 +766,7 @@ end:
+ }
+
+ /* Split symbol and offset. */
+-static int split_symbol_offset(char *symbol, unsigned long *offset)
++static int split_symbol_offset(char *symbol, long *offset)
+ {
+ char *tmp;
+ int ret;
+@@ -774,10 +774,9 @@ static int split_symbol_offset(char *sym
+ if (!offset)
+ return -EINVAL;
+
+- tmp = strchr(symbol, '+');
++ tmp = strpbrk(symbol, "+-");
+ if (tmp) {
+- /* skip sign because strict_strtol doesn't accept '+' */
+- ret = strict_strtoul(tmp + 1, 0, offset);
++ ret = strict_strtol(tmp, 0, offset);
+ if (ret)
+ return ret;
+ *tmp = '\0';
+@@ -1011,7 +1010,7 @@ static int create_trace_probe(int argc,
+ int is_return = 0, is_delete = 0;
+ char *symbol = NULL, *event = NULL, *group = NULL;
+ char *arg;
+- unsigned long offset = 0;
++ long offset = 0;
+ void *addr = NULL;
+ char buf[MAX_EVENT_NAME_LEN];
+
+@@ -1078,7 +1077,7 @@ static int create_trace_probe(int argc,
+ symbol = argv[1];
+ /* TODO: support .init module functions */
+ ret = split_symbol_offset(symbol, &offset);
+- if (ret) {
++ if (ret || offset < 0 || offset > UINT_MAX) {
+ pr_info("Failed to parse either an address or a symbol.\n");
+ return ret;
+ }
+
diff --git a/series.conf b/series.conf
index e107db7d9e..9e6a1a2367 100644
--- a/series.conf
+++ b/series.conf
@@ -23191,6 +23191,7 @@
patches.fixes/tracing-add-undef-to-fix-compile-error.patch
patches.fixes/tracing-kprobes-allow-to-create-probe-with-a-module-name-starting-with-a-digit.patch
patches.fixes/ring-buffer-mask-out-the-info-bits-when-returning-buffer-page-length.patch
+ patches.fixes/tracing-probeevent-fix-to-support-minus-offset-from-symbol.patch
########################################################
# KVM patches