stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Masami Hiramatsu <mhiramat@kernel.org>,
	Sabrina Dubroca <sd@queasysnail.net>,
	"Steven Rostedt (VMware)" <rostedt@goodmis.org>
Subject: [PATCH 4.9 05/41] tracing/kprobes: Allow to create probe with a module name starting with a digit
Date: Mon, 10 Jul 2017 19:10:38 +0200	[thread overview]
Message-ID: <20170710171052.078843147@linuxfoundation.org> (raw)
In-Reply-To: <20170710171051.866846041@linuxfoundation.org>

4.9-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sabrina Dubroca <sd@queasysnail.net>

commit 9e52b32567126fe146f198971364f68d3bc5233f upstream.

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

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/trace/trace_kprobe.c |   21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -667,30 +667,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;
 

  parent reply	other threads:[~2017-07-10 17:13 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-10 17:10 [PATCH 4.9 00/41] 4.9.37-stable review Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 01/41] fs: add a VALID_OPEN_FLAGS Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 02/41] fs: completely ignore unknown open flags Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 03/41] driver core: platform: fix race condition with driver_override Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 04/41] ceph: choose readdir frag based on previous readdir reply Greg Kroah-Hartman
2017-07-10 17:10 ` Greg Kroah-Hartman [this message]
2017-07-10 17:10 ` [PATCH 4.9 06/41] [media] media: entity: Fix stream count check Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 08/41] usb: dwc3: replace %p with %pK Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 09/41] USB: serial: cp210x: add ID for CEL EM3588 USB ZigBee stick Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 10/41] Add USB quirk for HVR-950q to avoid intermittent device resets Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 11/41] usb: usbip: set buffer pointers to NULL after free Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 12/41] usb: Fix typo in the definition of Endpoint[out]Request Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 13/41] USB: core: fix device node leak Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 14/41] mac80211_hwsim: Replace bogus hrtimer clockid Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 15/41] sysctl: dont print negative flag for proc_douintvec Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 16/41] sysctl: report EINVAL if value is larger than UINT_MAX " Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 17/41] pinctrl: qcom: ipq4019: add missing pingroups for pins > 70 Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 18/41] pinctrl: cherryview: Add a quirk to make Acer Chromebook keyboard work again Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 19/41] pinctrl: sh-pfc: r8a7794: Swap ATA signals Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 20/41] pinctrl: sh-pfc: r8a7791: Fix SCIF2 pinmux data Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 21/41] pinctrl: sh-pfc: r8a7791: Add missing DVC_MUTE signal Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 22/41] pinctrl: sh-pfc: r8a7795: Fix hscif2_clk_b and hscif4_ctrl Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 23/41] pinctrl: meson: meson8b: fix the NAND DQS pins Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 24/41] pinctrl: stm32: Fix bad function call Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 25/41] pinctrl: sunxi: Fix SPDIF function name for A83T Greg Kroah-Hartman
2017-07-10 17:10 ` [PATCH 4.9 26/41] pinctrl: cherryview: Add terminate entry for dmi_system_id tables Greg Kroah-Hartman
2017-07-10 17:11 ` [PATCH 4.9 28/41] pinctrl: sh-pfc: r8a7791: Add missing HSCIF1 pinmux data Greg Kroah-Hartman
2017-07-10 17:11 ` [PATCH 4.9 29/41] pinctrl: sh-pfc: Update info pointer after SoC-specific init Greg Kroah-Hartman
2017-07-10 17:11 ` [PATCH 4.9 32/41] xhci: Limit USB2 port wake support for AMD Promontory hosts Greg Kroah-Hartman
2017-07-10 17:11 ` [PATCH 4.9 33/41] gfs2: Fix glock rhashtable rcu bug Greg Kroah-Hartman
2017-07-10 17:11 ` [PATCH 4.9 34/41] tpm: fix a kernel memory leak in tpm-sysfs.c Greg Kroah-Hartman
2017-07-10 17:11 ` [PATCH 4.9 36/41] x86/uaccess: Optimize copy_user_enhanced_fast_string() for short strings Greg Kroah-Hartman
2017-07-10 17:11 ` [PATCH 4.9 37/41] ath10k: override CE5 config for QCA9377 Greg Kroah-Hartman
2017-07-10 17:11 ` [PATCH 4.9 38/41] KEYS: Fix an error code in request_master_key() Greg Kroah-Hartman
2017-07-10 17:11 ` [PATCH 4.9 39/41] crypto: drbg - Fixes panic in wait_for_completion call Greg Kroah-Hartman
2017-07-10 17:11 ` [PATCH 4.9 40/41] RDMA/uverbs: Check port number supplied by user verbs cmds Greg Kroah-Hartman
2017-07-10 17:11 ` [PATCH 4.9 41/41] rt286: add Thinkpad Helix 2 to force_combo_jack_table Greg Kroah-Hartman
2017-07-10 22:31 ` [PATCH 4.9 00/41] 4.9.37-stable review Krister Johansen
2017-07-11  9:53   ` Greg Kroah-Hartman
2017-07-11  0:45 ` Guenter Roeck
2017-07-11  9:54 ` Sumit Semwal
2017-07-11 10:37   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170710171052.078843147@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=sd@queasysnail.net \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).