lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 26 Jan 2016 14:05:20 +0200
From:	Adrian Hunter <adrian.hunter@...el.com>
To:	Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:	Jiri Olsa <jolsa@...hat.com>, linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] perf tools: Fix seg fault with Intel PT

Fix segmentation fault using:

	perf record -e intel_pt//u uname

Back trace:

  0  tracepoint_error (err=13, err@...ry=-13, sys=sys@...ry=0x18706c0 "sched", name=name@...ry=0x1871c70 "sched_switch", e=<optimized out>, e=<optimized out>) at util/parse-events.c:416
  1  0x000000000049791c in add_tracepoint (head_config=0x0, err=0x0, evt_name=0x1871c70 "sched_switch", sys_name=0x18706c0 "sched", idx=<optimized out>, list=<optimized out>)
     at util/parse-events.c:433
  2  add_tracepoint_event (list=<optimized out>, idx=<optimized out>, sys_name=0x18706c0 "sched", evt_name=0x1871c70 "sched_switch", err=0x0, head_config=0x0) at util/parse-events.c:498
  3  0x0000000000498ec4 in parse_events_add_tracepoint (list=list@...ry=0x1871c90, idx=idx@...ry=0x7fffffffba30, sys=0x18706c0 "sched", event=0x1871c70 "sched_switch", err=err@...ry=0x0,
     head_config=head_config@...ry=0x0) at util/parse-events.c:936
  4  0x00000000004ccff2 in parse_events_parse (_data=_data@...ry=0x7fffffffba20, scanner=0x18705f0) at util/parse-events.y:391
  5  0x000000000049a567 in parse_events__scanner (start_token=258, data=0x7fffffffba20, str=0x0) at util/parse-events.c:1361
  6  parse_events (evlist=evlist@...ry=0x1871150, str=str@...ry=0x55ef6c "sched:sched_switch", err=err@...ry=0x0) at util/parse-events.c:1401
  7  0x00000000004eb4b6 in perf_evlist__can_select_event (evlist=evlist@...ry=0x186fb90, str=str@...ry=0x55ef6c "sched:sched_switch") at util/record.c:253
  8  0x000000000051e1d3 in intel_pt_track_switches (evlist=0x186fb90) at arch/x86/util/intel-pt.c:362
  9  intel_pt_recording_options (itr=0x186ef70, evlist=0x186fb90, opts=0x7c3e08 <record+232>) at arch/x86/util/intel-pt.c:662
 10  0x000000000042e244 in cmd_record (argc=1, argv=0x7fffffffe270, prefix=<optimized out>) at builtin-record.c:1260
 11  0x000000000047cbd3 in run_builtin (p=p@...ry=0x7cf2e8 <commands+168>, argc=argc@...ry=4, argv=argv@...ry=0x7fffffffe270) at perf.c:390
 12  0x00000000004216a7 in handle_internal_command (argv=0x7fffffffe270, argc=4) at perf.c:451
 13  run_argv (argv=0x7fffffffdff0, argcp=0x7fffffffdffc) at perf.c:495
 14  main (argc=4, argv=0x7fffffffe270) at perf.c:618

Intel PT attempts to find the sched:sched_switch tracepoint but that
seg faults if tracefs is not readable, because the error reporting
structure is null, as errors are not reported when automatically
adding tracepoints.  Fix by checking before using.

Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
Fixes: 196581717d85 ("perf tools: Enhance parsing events tracepoint error output")
Cc: stable@...r.kernel.org # v4.4+
---
 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 4f7b0efdde2f..813d9b272c81 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.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ