Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1322802
| From | Wang Nan <wangnan0@huawei.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/2] perf tools: Fix fault in tracepoint_error if NULL is passed to parse_event |
| Date | 2016-02-01 04:30 +0100 |
| Message-ID | <qXdlD-4Sy-1@gated-at.bofh.it> (permalink) |
| References | <qXdlD-4Sy-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Following segfault can happen with a non-root user:
$ ./perf record -I -e intel_pt/tsc=1,noretcomp=1/u /bin/ls
WARNING: Kernel address maps (/proc/{kallsyms,modules}) are restricted,
check /proc/sys/kernel/kptr_restrict.
Samples in kernel functions may not be resolved if a suitable vmlinux
file is not found in the buildid cache or in the vmlinux path.
Samples in kernel modules won't be resolved at all.
If some relocation was applied (e.g. kexec) symbols may be misresolved
even with a suitable vmlinux or kallsyms file.
Segmentation fault (core dumped)
The error is in tracepoint_error: it assumes 'e' is valid.
However, there are many situation a parse_event can be called without
parse_events_error. See result of
'grep 'parse_events(.*NULL)' ./tools/perf/ -r'.
This patch makes tracepoint_error() directly return when !e.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Tong Zhang <ztong@vt.edu>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
---
tools/perf/util/parse-events.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 4f7b0ef..813d9b2 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -399,6 +399,9 @@ static void tracepoint_error(struct parse_events_error *e, int err,
{
char help[BUFSIZ];
+ if (!e)
+ return;
+
/*
* We get error directly from syscall errno ( > 0),
* or from encoded pointer's error ( < 0).
--
1.8.3.4
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH 2/2] perf tools: Fix fault in tracepoint_error if NULL is passed to parse_event Wang Nan <wangnan0@huawei.com> - 2016-02-01 04:30 +0100
Re: [PATCH 2/2] perf tools: Fix fault in tracepoint_error if NULL is passed to parse_event Adrian Hunter <adrian.hunter@intel.com> - 2016-02-01 10:00 +0100
Re: [PATCH 2/2] perf tools: Fix fault in tracepoint_error if NULL is passed to parse_event Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-01 15:50 +0100
csiph-web