Skip to content

Commit f192874

Browse files
mhiramatgregkh
authored andcommitted
perf probe: Add warning message if there is unexpected event name
[ Upstream commit 9f5c6d8 ] 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 <[email protected]> Signed-off-by: Masami Hiramatsu <[email protected]> Acked-by: Ravi Bangoria <[email protected]> Reviewed-by: Thomas Richter <[email protected]> Tested-by: Arnaldo Carvalho de Melo <[email protected]> Cc: Paul Clarke <[email protected]> Cc: bhargavb <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/151275040665.24652.5188568529237584489.stgit@devbox Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d8ccbd1 commit f192874

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tools/perf/util/probe-event.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2349,6 +2349,14 @@ static int get_new_event_name(char *buf, size_t len, const char *base,
23492349

23502350
out:
23512351
free(nbase);
2352+
2353+
/* Final validation */
2354+
if (ret >= 0 && !is_c_func_name(buf)) {
2355+
pr_warning("Internal error: \"%s\" is an invalid event name.\n",
2356+
buf);
2357+
ret = -EINVAL;
2358+
}
2359+
23522360
return ret;
23532361
}
23542362

0 commit comments

Comments
 (0)