linux/tools/perf
Masami Hiramatsu 9e6124d9d6 perf probe: Fix to clear tev->nargs in clear_probe_trace_event()
Since add_probe_trace_event() can reuse tf->tevs[i] after calling
clear_probe_trace_event(), this can make perf-probe crash if the 1st
attempt of probe event finding fails to find an event argument, and the
2nd attempt fails to find probe point.

E.g.
  $ perf probe -D "task_pid_nr tsk"
  Failed to find 'tsk' in this function.
  Failed to get entry address of warn_bad_vsyscall
  Segmentation fault (core dumped)

Committer testing:

After the patch:

  $ perf probe -D "task_pid_nr tsk"
  Failed to find 'tsk' in this function.
  Failed to get entry address of warn_bad_vsyscall
  Failed to get entry address of signal_fault
  Failed to get entry address of show_signal
  Failed to get entry address of umip_printk
  Failed to get entry address of __bad_area_nosemaphore
  <SNIP>
  Failed to get entry address of sock_set_timeout
  Failed to get entry address of tcp_recvmsg
  Probe point 'task_pid_nr' not found.
    Error: Failed to add events.
  $

Fixes: 092b1f0b5f ("perf probe: Clear probe_trace_event when add_probe_trace_event() fails")
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lore.kernel.org/lkml/156856587999.25775.5145779959474477595.stgit@devnote2
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-09-20 15:30:09 -03:00
..
arch perf/core improvements and fixes: 2019-09-20 18:16:42 +02:00
bench perf env: Remove needless cpumap.h header 2019-09-20 09:19:21 -03:00
Documentation perf report: Add --switch-on/--switch-off events 2019-08-16 12:14:33 -03:00
examples/bpf perf augmented_raw_syscalls: Reduce perf_event_output() boilerplate 2019-08-26 11:58:29 -03:00
include/bpf perf include bpf: Add bpf_tail_call() prototype 2019-07-29 18:34:40 -03:00
jvmti perf jvmti: Link against tools/lib/string.o to have weak strlcpy() 2019-09-20 09:18:45 -03:00
lib libperf: Adopt perf_cpu_map__max() function 2019-09-10 14:33:32 +01:00
pmu-events perf tools: Add PMU event JSON files for ARM Cortex-A76 and, Neoverse N1. 2019-09-20 09:19:20 -03:00
python treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 407 2019-06-05 17:37:14 +02:00
scripts perf tools: Remove perf.h from source files not needing it 2019-08-29 17:38:32 -03:00
tests perf tests: Fix static build test 2019-09-20 14:37:28 -03:00
trace perf trace beauty ioctl: Fix off-by-one error in cmd->string table 2019-08-26 11:58:29 -03:00
ui perf tools: Move event synthesizing routines to separate header 2019-09-20 09:19:22 -03:00
util perf probe: Fix to clear tev->nargs in clear_probe_trace_event() 2019-09-20 15:30:09 -03:00
.gitignore perf: Update .gitignore file 2019-08-31 22:27:52 -03:00
Build perf tools: Rename build libperf to perf 2019-02-14 15:18:08 -03:00
builtin-annotate.c perf annotate: Add missing machine.h include directive 2019-09-20 09:19:22 -03:00
builtin-bench.c perf tools: Remove perf.h from source files not needing it 2019-08-29 17:38:32 -03:00
builtin-buildid-cache.c perf tools: Remove needless evlist.h include directives 2019-08-31 22:24:10 -03:00
builtin-buildid-list.c perf tools: Remove needless evlist.h include directives 2019-08-31 22:24:10 -03:00
builtin-c2c.c perf env: Remove needless cpumap.h header 2019-09-20 09:19:21 -03:00
builtin-config.c perf tools: Remove util.h from where it is not needed 2019-09-20 09:19:20 -03:00
builtin-data.c perf debug: Remove needless include directives from debug.h 2019-08-31 19:10:19 -03:00
builtin-diff.c perf debug: Remove needless include directives from debug.h 2019-08-31 19:10:19 -03:00
builtin-evlist.c perf tools: Remove util.h from where it is not needed 2019-09-20 09:19:20 -03:00
builtin-ftrace.c perf auxtrace: Uninline functions that touch perf_session 2019-08-31 22:24:10 -03:00
builtin-help.c perf debug: Remove needless include directives from debug.h 2019-08-31 19:10:19 -03:00
builtin-inject.c perf tools: Move event synthesizing routines to separate header 2019-09-20 09:19:22 -03:00
builtin-kallsyms.c perf dsos: Move the dsos struct and its methods to separate source files 2019-08-31 22:24:10 -03:00
builtin-kmem.c perf dsos: Move the dsos struct and its methods to separate source files 2019-08-31 22:24:10 -03:00
builtin-kvm.c perf kvm: Add arch neutral function to choose event for perf kvm record 2019-09-20 10:28:26 -03:00
builtin-list.c perf tools: Remove needless evlist.h include directives 2019-08-31 22:24:10 -03:00
builtin-lock.c perf tools: Remove needless evlist.h include directives 2019-08-31 22:24:10 -03:00
builtin-mem.c perf symbols: Move mem_info and branch_info out of symbol.h 2019-08-31 22:27:48 -03:00
builtin-probe.c perf probe: No need for symbol.h, symbol_conf is enough 2019-08-31 22:24:10 -03:00
builtin-record.c perf tools: Move event synthesizing routines to separate .c file 2019-09-20 10:28:21 -03:00
builtin-report.c perf tools: Remove util.h from where it is not needed 2019-09-20 09:19:20 -03:00
builtin-sched.c perf sched: Add missing event.h include directive 2019-09-20 09:19:22 -03:00
builtin-script.c perf tools: Remove needless evlist.h include directives 2019-08-31 22:24:10 -03:00
builtin-stat.c perf stat: Fix a segmentation fault when using repeat forever 2019-09-20 10:28:26 -03:00
builtin-timechart.c perf tools: Remove needless evlist.h include directives 2019-08-31 22:24:10 -03:00
builtin-top.c perf tools: Move event synthesizing routines to separate header 2019-09-20 09:19:22 -03:00
builtin-trace.c perf tools: Move event synthesizing routines to separate header 2019-09-20 09:19:22 -03:00
builtin-version.c perf symbols: Move mem_info and branch_info out of symbol.h 2019-08-31 22:27:48 -03:00
builtin.h perf tools: Remove needless util.h include from builtin.h 2019-08-28 17:19:34 -03:00
check-headers.sh perf build: Ignore intentional differences for the x86 insn decoder 2019-08-31 22:27:52 -03:00
command-list.txt
CREDITS
design.txt perf/doc: Update design.txt for exclude_{host|guest} flags 2019-01-21 11:01:18 +01:00
Makefile
Makefile.config Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2019-09-16 17:06:21 -07:00
Makefile.perf perf python: Add missing python/perf.so dependency for libperf 2019-09-10 14:33:32 +01:00
MANIFEST tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
perf-archive.sh
perf-completion.sh
perf-read-vdso.c perf tools: Make find_vdso_map() more modular 2019-01-08 13:28:13 -03:00
perf-sys.h perf tools: Move everything related to sys_perf_event_open() to perf-sys.h 2019-08-29 17:38:32 -03:00
perf-with-kcore.sh Merge branch 'x86/cpu' into perf/core, to pick up dependent changes 2019-06-17 12:29:16 +02:00
perf.c perf tools: Remove util.h from where it is not needed 2019-09-20 09:19:20 -03:00
perf.h perf time-utils: Adopt rdclock() from perf.h 2019-08-29 17:38:32 -03:00