stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] tracing/kprobes: Allow to create probe with a module name" failed to apply to 4.11-stable tree
@ 2017-07-03  7:43 gregkh
  2017-07-03 13:09 ` Steven Rostedt
  2017-07-03 15:39 ` Steven Rostedt
  0 siblings, 2 replies; 7+ messages in thread
From: gregkh @ 2017-07-03  7:43 UTC (permalink / raw)
  To: sd, mhiramat, rostedt; +Cc: stable


The patch below does not apply to the 4.11-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

>From 9e52b32567126fe146f198971364f68d3bc5233f Mon Sep 17 00:00:00 2001
From: Sabrina Dubroca <sd@queasysnail.net>
Date: Thu, 22 Jun 2017 11:24:42 +0200
Subject: [PATCH] tracing/kprobes: Allow to create probe with a module name
 starting with a digit

Always try to parse an address, since kstrtoul() will safely fail when
given a symbol as input. If that fails (which will be the case for a
symbol), try to parse a symbol instead.

This allows creating a probe such as:

    p:probe/vlan_gro_receive 8021q:vlan_gro_receive+0

Which is necessary for this command to work:

    perf probe -m 8021q -a vlan_gro_receive

Link: http://lkml.kernel.org/r/fd72d666f45b114e2c5b9cf7e27b91de1ec966f1.1498122881.git.sd@queasysnail.net

Cc: stable@vger.kernel.org
Fixes: 413d37d1e ("tracing: Add kprobe-based event tracer")
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index c129fca6ec99..b53c8d369163 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -707,20 +707,16 @@ static int create_trace_kprobe(int argc, char **argv)
 		pr_info("Probe point is not specified.\n");
 		return -EINVAL;
 	}
-	if (isdigit(argv[1][0])) {
-		/* an address specified */
-		ret = kstrtoul(&argv[1][0], 0, (unsigned long *)&addr);
-		if (ret) {
-			pr_info("Failed to parse address.\n");
-			return ret;
-		}
-	} else {
+
+	/* try to parse an address. if that fails, try to read the
+	 * input as a symbol. */
+	if (kstrtoul(argv[1], 0, (unsigned long *)&addr)) {
 		/* a symbol specified */
 		symbol = argv[1];
 		/* TODO: support .init module functions */
 		ret = traceprobe_split_symbol_offset(symbol, &offset);
 		if (ret) {
-			pr_info("Failed to parse symbol.\n");
+			pr_info("Failed to parse either an address or a symbol.\n");
 			return ret;
 		}
 		if (offset && is_return &&

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

* Re: FAILED: patch "[PATCH] tracing/kprobes: Allow to create probe with a module name" failed to apply to 4.11-stable tree
  2017-07-03  7:43 FAILED: patch "[PATCH] tracing/kprobes: Allow to create probe with a module name" failed to apply to 4.11-stable tree gregkh
@ 2017-07-03 13:09 ` Steven Rostedt
  2017-07-03 14:28   ` Sabrina Dubroca
  2017-07-03 15:15   ` Masami Hiramatsu
  2017-07-03 15:39 ` Steven Rostedt
  1 sibling, 2 replies; 7+ messages in thread
From: Steven Rostedt @ 2017-07-03 13:09 UTC (permalink / raw)
  To: gregkh; +Cc: sd, mhiramat, stable

Masami and Sabrina,

I backported the patch to 4.11 as below. The one thing that changed
here is that Linus's tree doesn't fail on return probes if the
parameter is not a symbol. I didn't want to backport that to stable, so
I modified the patch to retain that failure for return probes when an
address is used.

Can you ack this patch and we can then have this be the backport for
stable?

-- Steve

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 49cdda8..f0e99394 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -680,30 +680,25 @@ static int create_trace_kprobe(int argc, char **argv)
 		pr_info("Probe point is not specified.\n");
 		return -EINVAL;
 	}
-	if (isdigit(argv[1][0])) {
-		if (is_return) {
-			pr_info("Return probe point must be a symbol.\n");
-			return -EINVAL;
-		}
-		/* an address specified */
-		ret = kstrtoul(&argv[1][0], 0, (unsigned long *)&addr);
-		if (ret) {
-			pr_info("Failed to parse address.\n");
-			return ret;
-		}
-	} else {
+
+	/* try to parse an address. if that fails, try to read the
+	 * input as a symbol. */
+	if (kstrtoul(argv[1], 0, (unsigned long *)&addr)) {
 		/* a symbol specified */
 		symbol = argv[1];
 		/* TODO: support .init module functions */
 		ret = traceprobe_split_symbol_offset(symbol, &offset);
 		if (ret) {
-			pr_info("Failed to parse symbol.\n");
+			pr_info("Failed to parse either an address or a symbol.\n");
 			return ret;
 		}
 		if (offset && is_return) {
 			pr_info("Return probe must be used without offset.\n");
 			return -EINVAL;
 		}
+	} else if (is_return) {
+		pr_info("Return probe point must be a symbol.\n");
+		return -EINVAL;
 	}
 	argc -= 2; argv += 2;
 

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

* Re: FAILED: patch "[PATCH] tracing/kprobes: Allow to create probe with a module name" failed to apply to 4.11-stable tree
  2017-07-03 13:09 ` Steven Rostedt
@ 2017-07-03 14:28   ` Sabrina Dubroca
  2017-07-03 14:45     ` Steven Rostedt
  2017-07-03 15:15   ` Masami Hiramatsu
  1 sibling, 1 reply; 7+ messages in thread
From: Sabrina Dubroca @ 2017-07-03 14:28 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: gregkh, mhiramat, stable

2017-07-03, 09:09:28 -0400, Steven Rostedt wrote:
> Masami and Sabrina,
> 
> I backported the patch to 4.11 as below. The one thing that changed
> here is that Linus's tree doesn't fail on return probes if the
> parameter is not a symbol. I didn't want to backport that to stable, so
> I modified the patch to retain that failure for return probes when an
> address is used.
> 
> Can you ack this patch and we can then have this be the backport for
> stable?

Thanks, LGTM

Acked-by: Sabrina Dubroca <sd@queasysnail.net>

-- 
Sabrina

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

* Re: FAILED: patch "[PATCH] tracing/kprobes: Allow to create probe with a module name" failed to apply to 4.11-stable tree
  2017-07-03 14:28   ` Sabrina Dubroca
@ 2017-07-03 14:45     ` Steven Rostedt
  0 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2017-07-03 14:45 UTC (permalink / raw)
  To: Sabrina Dubroca; +Cc: gregkh, mhiramat, stable

On Mon, 3 Jul 2017 16:28:32 +0200
Sabrina Dubroca <sd@queasysnail.net> wrote:

> 2017-07-03, 09:09:28 -0400, Steven Rostedt wrote:
> > Masami and Sabrina,
> > 
> > I backported the patch to 4.11 as below. The one thing that changed
> > here is that Linus's tree doesn't fail on return probes if the
> > parameter is not a symbol. I didn't want to backport that to stable, so
> > I modified the patch to retain that failure for return probes when an
> > address is used.
> > 
> > Can you ack this patch and we can then have this be the backport for
> > stable?  
> 
> Thanks, LGTM
> 
> Acked-by: Sabrina Dubroca <sd@queasysnail.net>
> 

Thanks, I'll wait for Masami's ack, and then push it for Greg.

-- Steve

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

* Re: FAILED: patch "[PATCH] tracing/kprobes: Allow to create probe with a module name" failed to apply to 4.11-stable tree
  2017-07-03 13:09 ` Steven Rostedt
  2017-07-03 14:28   ` Sabrina Dubroca
@ 2017-07-03 15:15   ` Masami Hiramatsu
  1 sibling, 0 replies; 7+ messages in thread
From: Masami Hiramatsu @ 2017-07-03 15:15 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: gregkh, sd, mhiramat, stable

On Mon, 3 Jul 2017 09:09:28 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> Masami and Sabrina,
> 
> I backported the patch to 4.11 as below. The one thing that changed
> here is that Linus's tree doesn't fail on return probes if the
> parameter is not a symbol. I didn't want to backport that to stable, so
> I modified the patch to retain that failure for return probes when an
> address is used.
> 
> Can you ack this patch and we can then have this be the backport for
> stable?

Looks good to me.

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>

Thank you!

> 
> -- Steve
> 
> diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
> index 49cdda8..f0e99394 100644
> --- a/kernel/trace/trace_kprobe.c
> +++ b/kernel/trace/trace_kprobe.c
> @@ -680,30 +680,25 @@ static int create_trace_kprobe(int argc, char **argv)
>  		pr_info("Probe point is not specified.\n");
>  		return -EINVAL;
>  	}
> -	if (isdigit(argv[1][0])) {
> -		if (is_return) {
> -			pr_info("Return probe point must be a symbol.\n");
> -			return -EINVAL;
> -		}
> -		/* an address specified */
> -		ret = kstrtoul(&argv[1][0], 0, (unsigned long *)&addr);
> -		if (ret) {
> -			pr_info("Failed to parse address.\n");
> -			return ret;
> -		}
> -	} else {
> +
> +	/* try to parse an address. if that fails, try to read the
> +	 * input as a symbol. */
> +	if (kstrtoul(argv[1], 0, (unsigned long *)&addr)) {
>  		/* a symbol specified */
>  		symbol = argv[1];
>  		/* TODO: support .init module functions */
>  		ret = traceprobe_split_symbol_offset(symbol, &offset);
>  		if (ret) {
> -			pr_info("Failed to parse symbol.\n");
> +			pr_info("Failed to parse either an address or a symbol.\n");
>  			return ret;
>  		}
>  		if (offset && is_return) {
>  			pr_info("Return probe must be used without offset.\n");
>  			return -EINVAL;
>  		}
> +	} else if (is_return) {
> +		pr_info("Return probe point must be a symbol.\n");
> +		return -EINVAL;
>  	}
>  	argc -= 2; argv += 2;
>  


-- 
Masami Hiramatsu <mhiramat@kernel.org>

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

* Re: FAILED: patch "[PATCH] tracing/kprobes: Allow to create probe with a module name" failed to apply to 4.11-stable tree
  2017-07-03  7:43 FAILED: patch "[PATCH] tracing/kprobes: Allow to create probe with a module name" failed to apply to 4.11-stable tree gregkh
  2017-07-03 13:09 ` Steven Rostedt
@ 2017-07-03 15:39 ` Steven Rostedt
  2017-07-07  9:09   ` Greg KH
  1 sibling, 1 reply; 7+ messages in thread
From: Steven Rostedt @ 2017-07-03 15:39 UTC (permalink / raw)
  To: gregkh; +Cc: sd, mhiramat, stable

Greg,

Here's a backport of the failed patch. I got Sabrina's and Masami's
acks for it. Can you please take this as the change. It applies all the
way back to 3.18.

Thanks!

-- Steve

>From 9e52b32567126fe146f198971364f68d3bc5233f Mon Sep 17 00:00:00 2001
From: Sabrina Dubroca <sd@queasysnail.net>
Date: Thu, 22 Jun 2017 11:24:42 +0200
Subject: [PATCH] tracing/kprobes: Allow to create probe with a module name
 starting with a digit

Always try to parse an address, since kstrtoul() will safely fail when
given a symbol as input. If that fails (which will be the case for a
symbol), try to parse a symbol instead.

This allows creating a probe such as:

    p:probe/vlan_gro_receive 8021q:vlan_gro_receive+0

Which is necessary for this command to work:

    perf probe -m 8021q -a vlan_gro_receive

Link: http://lkml.kernel.org/r/fd72d666f45b114e2c5b9cf7e27b91de1ec966f1.1498122881.git.sd@queasysnail.net

Cc: stable@vger.kernel.org
Fixes: 413d37d1e ("tracing: Add kprobe-based event tracer")
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

Index: linux-trace.git/kernel/trace/trace_kprobe.c
===================================================================
--- linux-trace.git.orig/kernel/trace/trace_kprobe.c
+++ linux-trace.git/kernel/trace/trace_kprobe.c
@@ -680,30 +680,25 @@ static int create_trace_kprobe(int argc,
 		pr_info("Probe point is not specified.\n");
 		return -EINVAL;
 	}
-	if (isdigit(argv[1][0])) {
-		if (is_return) {
-			pr_info("Return probe point must be a symbol.\n");
-			return -EINVAL;
-		}
-		/* an address specified */
-		ret = kstrtoul(&argv[1][0], 0, (unsigned long *)&addr);
-		if (ret) {
-			pr_info("Failed to parse address.\n");
-			return ret;
-		}
-	} else {
+
+	/* try to parse an address. if that fails, try to read the
+	 * input as a symbol. */
+	if (kstrtoul(argv[1], 0, (unsigned long *)&addr)) {
 		/* a symbol specified */
 		symbol = argv[1];
 		/* TODO: support .init module functions */
 		ret = traceprobe_split_symbol_offset(symbol, &offset);
 		if (ret) {
-			pr_info("Failed to parse symbol.\n");
+			pr_info("Failed to parse either an address or a symbol.\n");
 			return ret;
 		}
 		if (offset && is_return) {
 			pr_info("Return probe must be used without offset.\n");
 			return -EINVAL;
 		}
+	} else if (is_return) {
+		pr_info("Return probe point must be a symbol.\n");
+		return -EINVAL;
 	}
 	argc -= 2; argv += 2;
 

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

* Re: FAILED: patch "[PATCH] tracing/kprobes: Allow to create probe with a module name" failed to apply to 4.11-stable tree
  2017-07-03 15:39 ` Steven Rostedt
@ 2017-07-07  9:09   ` Greg KH
  0 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2017-07-07  9:09 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: sd, mhiramat, stable

On Mon, Jul 03, 2017 at 11:39:17AM -0400, Steven Rostedt wrote:
> Greg,
> 
> Here's a backport of the failed patch. I got Sabrina's and Masami's
> acks for it. Can you please take this as the change. It applies all the
> way back to 3.18.

Thanks, now queued up.

greg k-h

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

end of thread, other threads:[~2017-07-07  9:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-03  7:43 FAILED: patch "[PATCH] tracing/kprobes: Allow to create probe with a module name" failed to apply to 4.11-stable tree gregkh
2017-07-03 13:09 ` Steven Rostedt
2017-07-03 14:28   ` Sabrina Dubroca
2017-07-03 14:45     ` Steven Rostedt
2017-07-03 15:15   ` Masami Hiramatsu
2017-07-03 15:39 ` Steven Rostedt
2017-07-07  9:09   ` Greg KH

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