From: Andi Kleen <andi@firstfloor.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>,
jolsa@kernel.org, linux-kernel@vger.kernel.org,
Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH 2/2] perf, tools: Avoid segfault on alias parse error
Date: Thu, 17 Aug 2017 08:34:22 -0700 [thread overview]
Message-ID: <20170817153421.GE2482@two.firstfloor.org> (raw)
In-Reply-To: <20170817152816.GC10891@kernel.org>
> Humm, but don't we have that checked?
At least not in the case of the segfault below.
-Andi
>
> void parse_events_evlist_error(struct parse_events_evlist *data,
> int idx, const char *str)
> {
> struct parse_events_error *err = data->error;
>
> if (!err)
> return;
> err->idx = idx;
> err->str = strdup(str);
> WARN_ONCE(!err->str, "WARNING: failed to allocate error string");
> }
>
> - Arnaldo
>
> > Segfault:
> >
> > #'0 0x00000000004d66d2 in parse_events_evlist_error (data=0x7fffffffce20, idx=6, str=0x76cda8 "parser error") at util/parse-events.c:2530
> > #'1 0x0000000000516d0a in parse_events_error (loc=0x7fffffffb210, data=0x7fffffffce20, scanner=0x245b400, msg=0x76cb13 "syntax error") at util/parse-events.y:692
> > #'2 0x000000000051675b in parse_events_parse (_data=0x7fffffffce20, scanner=0x245b400) at /home/ak/hle/obj-perf/util/parse-events-bison.c:2213
> > #'3 0x00000000004d3fd6 in parse_events__scanner (str=0x725cff "event=0,", data=0x7fffffffce20, start_token=259) at util/parse-events.c:1646
> > #'4 0x00000000004d4063 in parse_events_terms (terms=0x245b398, str=0x725cff "event=0,") at util/parse-events.c:1664
> > #'5 0x00000000005179f1 in __perf_pmu__new_alias (list=0x7fffffffcf90, dir=0x0, name=0x725cec "unc_cha_clockticks", desc=0x725d08 "Uncore cache clock ticks. Unit: uncore_cha ",
> > val=0x725cff "event=0,", long_desc=0x0, topic=0x725d34 "uncore other", unit=0x0, perpkg=0x6ca7c6 "1", metric_expr=0x0, metric_name=0x0) at util/pmu.c:255
> > #'6 0x0000000000518789 in pmu_add_cpu_aliases (head=0x7fffffffcf90, name=0x2450903 "uncore_cha_9") at util/pmu.c:571
> > #'7 0x00000000005188ac in pmu_lookup (name=0x2450903 "uncore_cha_9") at util/pmu.c:613
> > #'8 0x0000000000518aff in perf_pmu__find (name=0x2450903 "uncore_cha_9") at util/pmu.c:672
> > #'9 0x00000000005183d5 in pmu_read_sysfs () at util/pmu.c:467
> > #'10 0x0000000000518a54 in perf_pmu__scan (pmu=0x0) at util/pmu.c:651
> > #'11 0x0000000000519f26 in print_pmu_events (event_glob=0x0, name_only=false, quiet_flag=false, long_desc=false, details_flag=false) at util/pmu.c:1173
> > #'12 0x00000000004d5ef0 in print_events (event_glob=0x0, name_only=false, quiet_flag=false, long_desc=false, details_flag=false) at util/parse-events.c:2343
> > #'13 0x000000000043c7d4 in cmd_list (argc=0, argv=0x7fffffffeb90) at builtin-list.c:56
> > #'14 0x00000000004ab2c8 in run_builtin (p=0xa281a0 <commands+192>, argc=1, argv=0x7fffffffeb90) at perf.c:296
> > #15 0x00000000004ab535 in handle_internal_command (argc=1, argv=0x7fffffffeb90) at perf.c:348
> > #16 0x00000000004ab687 in run_argv (argcp=0x7fffffffe9ec, argv=0x7fffffffe9e0) at perf.c:392
> > #17 0x00000000004aba55 in main (argc=1, argv=0x7fffffffeb90) at perf.c:530
> >
next prev parent reply other threads:[~2017-08-17 15:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-16 22:01 Two minor perf patches preparing for Skylake server events Andi Kleen
2017-08-16 22:02 ` [PATCH 1/2] perf, tools, json: Support FCMask and PortMask Andi Kleen
2017-08-17 15:20 ` Arnaldo Carvalho de Melo
2017-08-22 10:23 ` [tip:perf/core] perf jevents: " tip-bot for Andi Kleen
2017-08-16 22:02 ` [PATCH 2/2] perf, tools: Avoid segfault on alias parse error Andi Kleen
2017-08-17 15:28 ` Arnaldo Carvalho de Melo
2017-08-17 15:34 ` Andi Kleen [this message]
2017-08-17 16:25 ` Arnaldo Carvalho de Melo
2017-08-17 17:02 ` Andi Kleen
2017-08-17 16:42 ` Arnaldo Carvalho de Melo
2017-08-17 17:04 ` Andi Kleen
2017-08-17 17:22 ` Arnaldo Carvalho de Melo
2017-08-22 7:23 ` Jiri Olsa
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=20170817153421.GE2482@two.firstfloor.org \
--to=andi@firstfloor.org \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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