lkml.org 
[lkml]   [2017]   [Dec]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[tip:perf/core] perf probe: Add warning message if there is unexpected event name
    Commit-ID:  9f5c6d8777a2d962b0eeacb2a16f37da6bea545b
    Gitweb: https://git.kernel.org/tip/9f5c6d8777a2d962b0eeacb2a16f37da6bea545b
    Author: Masami Hiramatsu <mhiramat@kernel.org>
    AuthorDate: Sat, 9 Dec 2017 01:26:46 +0900
    Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
    CommitDate: Wed, 27 Dec 2017 12:15:53 -0300

    perf probe: Add warning message if there is unexpected event name

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

    E.g.
    ======
    #./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 <acme@redhat.com>
    Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
    Acked-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
    Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
    Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Paul Clarke <pc@us.ibm.com>
    Cc: bhargavb <bhargavaramudu@gmail.com>
    Cc: linux-rt-users@vger.kernel.org
    Link: http://lkml.kernel.org/r/151275040665.24652.5188568529237584489.stgit@devbox
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    ---
    tools/perf/util/probe-event.c | 8 ++++++++
    1 file changed, 8 insertions(+)

    diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
    index b7aaf9b..262d5da 100644
    --- 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, size_t len, const char *base,

    out:
    free(nbase);
    +
    + /* 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;
    }

    \
     
     \ /
      Last update: 2017-12-28 16:33    [W:7.248 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site