Patch "tracing: probeevent: Fix to support minus offset from symbol" has been added to the 4.15-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
tracing: probeevent: Fix to support minus offset from symbol
to the 4.15-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
tracing-probeevent-fix-to-support-minus-offset-from-symbol.patch
and it can be found in the queue-4.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
c5d343b6b7badd1f5fe0873eff2e8d63a193e732Mon Sep 17 00:00:00 2001
From: Masami Hiramatsu <[email protected]>
Date: Sat, 17 Mar 2018 21:38:10 +0900
Subject: tracing: probeevent: Fix to support minus offset from symbol
From: Masami Hiramatsu <[email protected]>
commit c5d343b6b7badd1f5fe0873eff2e8d63a193e732 upstream.
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.
--- kernel/trace/trace_kprobe.c | 4 ++-- kernel/trace/trace_probe.c | 8 +++----- kernel/trace/trace_probe.h | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-)
kernel/trace/trace_kprobe.c +2 -2
@@ -635,7 +635,7 @@ static int create_trace_kprobe(int argc,char *symbol =NULL , *event =NULL , *group =NULL ;int maxactive =0 ;char *arg; -unsigned long offset =0 ; +long offset =0 ;void *addr =NULL ;char buf[MAX_EVENT_NAME_LEN ];
@@ -723,7 +723,7 @@ static int create_trace_kprobe(int argc, symbol = argv[1 ];/* TODO: support .init module functions */ ret =traceprobe_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; }
kernel/trace/trace_probe.c +3 -5
@@ -320,7 +320,7 @@ static fetch_func_t get_fetch_size_funct }/* Split symbol and offset. */ -int traceprobe_split_symbol_offset (char *symbol,unsigned long *offset) +int traceprobe_split_symbol_offset (char *symbol,long *offset) {char *tmp;int ret;
@@ -328,13 +328,11 @@ int traceprobe_split_symbol_offset(charif (!offset)return -EINVAL ; - tmp =strchr (symbol,'+' ); + tmp =strpbrk (symbol,"+-" );if (tmp) { -/* skip sign because kstrtoul doesn't accept '+' */ - ret =kstrtoul (tmp +1 ,0 , offset); + ret =kstrtol (tmp,0 , offset);if (ret)return ret; - *tmp ='\0' ; }else *offset =0 ;
kernel/trace/trace_probe.h +1 -1
@@ -353,7 +353,7 @@ extern int traceprobe_conflict_field_namextern void traceprobe_update_arg (struct probe_arg *arg);extern void traceprobe_free_probe_arg (struct probe_arg *arg); -extern int traceprobe_split_symbol_offset (char *symbol,unsigned long *offset); +extern int traceprobe_split_symbol_offset (char *symbol,long *offset);/* Sum up total data length for dynamic arraies (strings) */ static nokprobe_inline int
Patches currently in stable-queue which might be from [email protected] are
queue-4.15/tracing-probeevent-fix-to-support-minus-offset-from-symbol.patch