linux/tools/perf
Wang Nan 3dc6c1d54f perf record: Fix crash when kptr is restricted
Before this patch, a simple 'perf record' could fail if kptr_restrict is
set to 1 (for normal user) or 2 (for root):

  # perf record 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)

This patch skips perf_event__synthesize_kernel_mmap() when kptr is not
available.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Fixes: 45e9005690 ("perf machine: Do not bail out if not managing to read ref reloc symbol")
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1464081688-167940-2-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-05-27 09:41:39 -03:00
..
arch perf dwarf: Guard !x86_64 definitions under #ifdef else clause 2016-05-12 11:26:59 -03:00
bench perf bench: Remove one more die() call 2016-04-26 13:28:40 -03:00
config perf probe: Check if dwarf_getlocations() is available 2016-05-12 11:26:59 -03:00
Documentation perf report: Add srcline_from/to branch sort keys 2016-05-23 11:25:16 -03:00
jvmti perf jit: Add support for using TSC as a timestamp 2016-04-01 18:42:55 -03:00
python perf python: Support the PERF_RECORD_SWITCH event 2015-10-07 19:41:50 -03:00
scripts perf script: Update export-to-postgresql to support callchain export 2016-05-06 13:00:55 -03:00
tests perf tests: Add test to check backward ring buffer 2016-05-09 18:11:22 -03:00
trace perf trace: Move seccomp args beautifiers to tools/perf/trace/beauty/ 2016-05-11 13:06:00 -03:00
ui perf hists: Move sort__has_comm into struct perf_hpp_list 2016-05-05 21:04:02 -03:00
util perf record: Fix crash when kptr is restricted 2016-05-27 09:41:39 -03:00
.gitignore perf tools: Add Intel PT instruction decoder 2015-08-17 11:11:36 -03:00
Build perf tools: Set and pass DOCDIR to builtin-report.c 2016-01-12 12:42:07 -03:00
builtin-annotate.c perf tools: Set buildid dir under symfs when --symfs is provided 2016-05-20 11:43:58 -03:00
builtin-bench.c perf subcmd: Create subcmd library 2015-12-17 14:27:14 -03:00
builtin-buildid-cache.c perf symbols: Introduce DSO__NAME_KALLSYMS and DSO__NAME_KCORE 2016-05-16 23:11:48 -03:00
builtin-buildid-list.c perf subcmd: Create subcmd library 2015-12-17 14:27:14 -03:00
builtin-config.c perf config: Make show_config() use perf_config_set 2016-04-14 09:15:47 -03:00
builtin-data.c perf subcmd: Create subcmd library 2015-12-17 14:27:14 -03:00
builtin-diff.c perf tools: Set buildid dir under symfs when --symfs is provided 2016-05-20 11:43:58 -03:00
builtin-evlist.c perf evlist: Add --trace-fields option to show trace fields 2016-01-08 14:23:02 -03:00
builtin-help.c perf help: Make check_emacsclient_version to check strbuf APIs 2016-05-10 11:56:14 -03:00
builtin-inject.c perf tools: Add time conversion event 2016-03-31 10:52:24 -03:00
builtin-kmem.c perf callchain: Start moving away from global per thread cursors 2016-04-14 14:48:07 -03:00
builtin-kvm.c perf evsel: Do not use globals in config() 2016-04-11 22:18:20 -03:00
builtin-list.c perf subcmd: Create subcmd library 2015-12-17 14:27:14 -03:00
builtin-lock.c perf subcmd: Create subcmd library 2015-12-17 14:27:14 -03:00
builtin-mem.c perf mem: Add -U/-K (--all-user/--all-kernel) options 2016-03-30 11:14:07 -03:00
builtin-probe.c perf subcmd: Create subcmd library 2015-12-17 14:27:14 -03:00
builtin-record.c perf record: Read from backward ring buffer 2016-05-23 18:22:48 -03:00
builtin-report.c perf tools: Set buildid dir under symfs when --symfs is provided 2016-05-20 11:43:58 -03:00
builtin-sched.c perf sched map: Display only given cpus 2016-04-13 10:11:52 -03:00
builtin-script.c perf tools: Set buildid dir under symfs when --symfs is provided 2016-05-20 11:43:58 -03:00
builtin-stat.c perf/core improvements and fixes: 2016-05-20 08:20:14 +02:00
builtin-timechart.c perf tools: Set buildid dir under symfs when --symfs is provided 2016-05-20 11:43:58 -03:00
builtin-top.c perf top: Use machine->kptr_restrict_warned 2016-05-20 11:43:55 -03:00
builtin-trace.c perf trace: Use the ptr->name beautifier as default for "filename" args 2016-05-23 16:41:00 -03:00
builtin-version.c perf tools: Move cmd_version() to builtin-version.c 2015-12-09 13:42:03 -03:00
builtin.h perf tools: Remove needless 'extern' from function prototypes 2016-03-23 15:06:35 -03:00
command-list.txt perf tools: Do not show trace command if it's not compiled in 2016-01-08 12:46:17 -03:00
CREDITS
design.txt
Makefile perf build tests: Do parallell builds with 'build-test' 2016-02-04 15:57:00 -03:00
Makefile.perf perf tools: Build syscall table .c header from kernel's syscall_64.tbl 2016-04-08 09:58:14 -03:00
MANIFEST perf bench: Fix detached tarball building due to missing 'perf bench memcpy' headers 2016-03-24 12:28:57 -03:00
perf-archive.sh
perf-completion.sh
perf-read-vdso.c
perf-sys.h perf tools: Move generic barriers out of perf-sys.h 2015-05-08 16:05:08 -03:00
perf-with-kcore.sh perf tools: Fix perf-with-kcore handling of arguments containing spaces 2015-08-06 16:48:27 -03:00
perf.c perf tools: Separate accounting of contexts and real addresses in a stack trace 2016-05-16 23:11:54 -03:00
perf.h perf tools: Ditch record_opts.callgraph_set 2016-04-18 12:26:27 -03:00