1
0
Fork 0
alistair23-linux/tools/perf/tests
Jiri Olsa fb50c09e92 perf tools: Fix crash on synthesizing the unit
Adam reported a record command crash for simple session like:

  $ perf record -e cpu-clock ls

with following backtrace:

  Program received signal SIGSEGV, Segmentation fault.
  3543            ev = event_update_event__new(size + 1, PERF_EVENT_UPDATE__UNIT, evsel->id[0]);
  (gdb) bt
  #0  perf_event__synthesize_event_update_unit
  #1  0x000000000051e469 in perf_event__synthesize_extra_attr
  #2  0x00000000004445cb in record__synthesize
  #3  0x0000000000444bc5 in __cmd_record
  ...

We synthesize an update event that needs to touch the evsel id array,
which is not defined at that time. Fix this by forcing the id allocation
for events with their unit defined.

Reflecting possible read_format ID bit in the attr tests.

Reported-by: Yongxin Liu <yongxin.liu@outlook.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adam Lee <leeadamrobert@gmail.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=201477
Fixes: bfd8f72c27 ("perf record: Synthesize unit/scale/... in event update")
Link: http://lkml.kernel.org/r/20181112130012.5424-1-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-11-12 08:37:49 -08:00
..
attr perf tools: Fix crash on synthesizing the unit 2018-11-12 08:37:49 -08:00
shell perf tests: Fix record+probe_libc_inet_pton.sh without ping's debuginfo 2018-09-05 10:47:56 -03:00
.gitignore perf test: Add libbpf relocation checker 2016-01-26 12:10:55 -03:00
Build perf test: Add watchpoint test 2018-09-18 17:21:13 -03:00
attr.c perf tools: Fix snprint warnings for gcc 8 2018-03-19 10:00:43 -03:00
attr.py Merge branch 'linus' into perf/core, to fix conflicts 2017-11-07 10:30:18 +01:00
backward-ring-buffer.c perf mmap: Simplify perf_mmap__read_init() 2018-03-08 10:05:53 -03:00
bitmap.c perf tools: Drop unneeded bitmap_zero() calls 2018-08-08 15:55:44 -03:00
bp_account.c perf tests bp_account: Fix build with clang-6 2018-03-19 13:51:54 -03:00
bp_signal.c perf test: Disable test cases 19 and 20 on s390x 2017-11-29 18:17:59 -03:00
bp_signal_overflow.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bpf-script-example.c perf test BPF: Fixup BPF test using epoll_pwait syscall function probe 2018-04-18 15:35:53 -03:00
bpf-script-test-kbuild.c perf tests bpf: Remove unused ptrace.h include from LLVM test 2018-04-12 10:33:24 -03:00
bpf-script-test-prologue.c perf bpf: Fix endianness problem when loading parameters in prologue 2017-08-16 10:31:11 -03:00
bpf-script-test-relocation.c perf test: Add libbpf relocation checker 2016-01-26 12:10:55 -03:00
bpf.c perf mmap: Simplify perf_mmap__read_init() 2018-03-08 10:05:53 -03:00
builtin-test.c perf test: S390 does not support watchpoints in test 22 2018-10-08 14:23:44 -03:00
clang.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
code-reading.c perf tools: Get rid of dso__needs_decompress() call in read_object_code() 2018-08-20 08:54:59 -03:00
cpumap.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dso-data.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dwarf-unwind.c perf tests: Fix dwarf unwind for stripped binaries 2018-02-16 10:09:23 -03:00
event-times.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
event_update.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
evsel-roundtrip-name.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
evsel-tp-sched.c tools lib traceevent, perf tools: Rename enum format_flags to enum tep_format_flags 2018-09-19 17:14:13 -03:00
expr.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
fdarray.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hists_common.c perf symbols: Unify symbol maps 2018-04-27 10:47:06 -03:00
hists_common.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hists_cumulate.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hists_filter.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hists_link.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hists_output.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
is_printable_array.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
keep-tracking.c perf mmap: Simplify perf_mmap__read_init() 2018-03-08 10:05:53 -03:00
kmod-path.c perf tools: Remove ext from struct kmod_path 2018-08-20 08:54:59 -03:00
llvm.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
llvm.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
make Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2016-12-17 16:24:13 -08:00
mem.c perf tools: Fix snprint warnings for gcc 8 2018-03-19 10:00:43 -03:00
mem2node.c perf tools: Drop unneeded bitmap_zero() calls 2018-08-08 15:55:44 -03:00
mmap-basic.c perf tests mmap: Show which tracepoint is failing 2018-04-18 15:35:52 -03:00
mmap-thread-lookup.c perf thread: Introduce thread__find_map() 2018-04-26 13:47:06 -03:00
openat-syscall-all-cpus.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
openat-syscall-tp-fields.c perf mmap: Simplify perf_mmap__read_init() 2018-03-08 10:05:53 -03:00
openat-syscall.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
parse-events.c perf tests: Fix complex event name parsing 2018-07-31 10:52:23 -03:00
parse-no-sample-id-all.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perf-hooks.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perf-record.c perf mmap: Simplify perf_mmap__read_init() 2018-03-08 10:05:53 -03:00
perf-targz-src-pkg License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pmu.c perf tools: Fix snprint warnings for gcc 8 2018-03-19 10:00:43 -03:00
python-use.c perf test: Use header file util/debug.h 2018-06-04 10:28:53 -03:00
sample-parsing.c perf tools: Get rid of unused 'swapped' parameter from perf_event__synthesize_sample() 2018-01-18 09:01:23 -03:00
sdt.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
stat.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sw-clock.c perf mmap: Simplify perf_mmap__read_init() 2018-03-08 10:05:53 -03:00
switch-tracking.c perf mmap: Simplify perf_mmap__read_init() 2018-03-08 10:05:53 -03:00
task-exit.c perf mmap: Simplify perf_mmap__read_init() 2018-03-08 10:05:53 -03:00
tests.h perf test: S390 does not support watchpoints in test 22 2018-10-08 14:23:44 -03:00
thread-map.c perf thread_map: Enumerate all threads from /proc 2017-12-27 12:15:46 -03:00
thread-mg-share.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
topology.c perf test session topology: Fix test on s390 2018-06-25 11:59:35 -03:00
unit_number__scnprintf.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vmlinux-kallsyms.c perf machine: Ditch find_kernel_function variants 2018-04-30 12:20:54 -03:00
wp.c perf test: S390 does not support watchpoints in test 22 2018-10-08 14:23:44 -03:00