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


From: Masami Hiramatsu <mhira...@kernel.org>

[ Upstream commit 9f5c6d8777a2d962b0eeacb2a16f37da6bea545b ]

This improve the error message so that user can know event-name error
before writing new events to kprobe-events interface.

   #./perf probe -x /lib64/libc-2.25.so malloc_get_state*
   Internal error: "malloc_get_state@GLIBC_2" is an invalid event name.
     Error: Failed to add events.

Reported-by: Arnaldo Carvalho de Melo <a...@redhat.com>
Signed-off-by: Masami Hiramatsu <mhira...@kernel.org>
Acked-by: Ravi Bangoria <ravi.bango...@linux.vnet.ibm.com>
Reviewed-by: Thomas Richter <tmri...@linux.vnet.ibm.com>
Tested-by: Arnaldo Carvalho de Melo <a...@redhat.com>
Cc: Paul Clarke <p...@us.ibm.com>
Cc: bhargavb <bhargavaram...@gmail.com>
Cc: linux-rt-us...@vger.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <a...@redhat.com>
Signed-off-by: Sasha Levin <alexander.le...@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
 tools/perf/util/probe-event.c |    8 ++++++++
 1 file changed, 8 insertions(+)

--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -2625,6 +2625,14 @@ static int get_new_event_name(char *buf,
+       /* Final validation */
+       if (ret >= 0 && !is_c_func_name(buf)) {
+               pr_warning("Internal error: \"%s\" is an invalid event name.\n",
+                          buf);
+               ret = -EINVAL;
+       }
        return ret;

Reply via email to