From: Adrian Hunter <adrian.hunter@intel.com>
To: Wang Nan <wangnan0@huawei.com>, acme@kernel.org
Cc: linux-kernel@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Tong Zhang <ztong@vt.edu>, Josh Poimboeuf <jpoimboe@redhat.com>
Subject: Re: [PATCH 2/2] perf tools: Fix fault in tracepoint_error if NULL is passed to parse_event
Date: Mon, 1 Feb 2016 10:53:29 +0200 [thread overview]
Message-ID: <56AF1D09.4050108@intel.com> (raw)
In-Reply-To: <1454296865-19749-2-git-send-email-wangnan0@huawei.com>
On 01/02/16 05:21, Wang Nan wrote:
> 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.
I sent the same fix here:
http://marc.info/?l=linux-kernel&m=145381056111871
>
> 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).
>
next prev parent reply other threads:[~2016-02-01 8:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-01 3:21 [PATCH 1/2] perf tools: Fix fault in error patch of intel_pt_process_auxtrace_info() Wang Nan
2016-02-01 3:21 ` [PATCH 2/2] perf tools: Fix fault in tracepoint_error if NULL is passed to parse_event Wang Nan
2016-02-01 8:53 ` Adrian Hunter [this message]
2016-02-01 14:47 ` Arnaldo Carvalho de Melo
2016-02-01 8:51 ` [PATCH 1/2] perf tools: Fix fault in error patch of intel_pt_process_auxtrace_info() Adrian Hunter
2016-02-04 7:57 ` [tip:perf/urgent] perf tools: Fix thread lifetime related segfaut in intel_pt tip-bot for Adrian Hunter
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=56AF1D09.4050108@intel.com \
--to=adrian.hunter@intel.com \
--cc=acme@kernel.org \
--cc=acme@redhat.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=wangnan0@huawei.com \
--cc=ztong@vt.edu \
/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).