Jiri Olsa
3f938ee2f6
perf machine: Fix segfault for kernel.kptr_restrict=2
...
Michael reported the segfault when kernel.kptr_restrict=2 is set.
$ perf record ls
...
perf: Segmentation fault
Obtained 16 stack frames.
./perf(dump_stack+0x2d) [0x5068df]
./perf(sighandler_dump_stack+0x2d) [0x5069bf]
./perf() [0x43e47b]
/lib64/libc.so.6(+0x3594f) [0x7f762004794f]
/lib64/libc.so.6(strlen+0x26) [0x7f762009ef86]
/lib64/libc.so.6(__strdup+0xd) [0x7f762009ecbd]
./perf(maps__set_kallsyms_ref_reloc_sym+0x4d) [0x51590f]
./perf(machine__create_kernel_maps+0x136) [0x50a7de]
./perf(perf_session__create_kernel_maps+0x2c) [0x510a81]
./perf(perf_session__new+0x13d) [0x510e23]
./perf() [0x43fd61]
./perf(cmd_record+0x704) [0x441823]
./perf() [0x4bc1a0]
./perf() [0x4bc40d]
./perf() [0x4bc55f]
./perf(main+0x2d5) [0x4bc939]
Segmentation fault (core dumped)
The reason is that with kernel.kptr_restrict=2, we don't get
the symbol from machine__get_running_kernel_start, which we
want to use in maps__set_kallsyms_ref_reloc_sym and we crash.
Check the symbol name value before calling
maps__set_kallsyms_ref_reloc_sym() and succeed without ref_reloc_sym
being set. It's safe because we check its existence before we use it.
Reported-by: Michael Petlan <mpetlan@redhat.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20170626095153.553-1-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2017-06-26 11:52:37 -03:00
..
arch
perf tools: Fix build with ARCH=x86_64
2017-06-14 15:44:29 -03:00
bench
perf tools: Move extra string util functions to util/string2.h
2017-04-19 13:01:51 -03:00
Documentation
perf script python: Remove dups in documentation examples
2017-06-07 20:36:12 -03:00
jvmti
pmu-events
perf tools: Fix build with ARCH=x86_64
2017-06-14 15:44:29 -03:00
python
scripts
tests
perf tools: Fix build with ARCH=x86_64
2017-06-14 15:44:29 -03:00
trace
perf tools: Add signal.h to places using its definitions
2017-04-20 13:22:43 -03:00
ui
perf tools: Put caller above callee in --children mode
2017-05-24 08:41:49 +02:00
util
perf machine: Fix segfault for kernel.kptr_restrict=2
2017-06-26 11:52:37 -03:00
.gitignore
perf tools: Ignore generated files pmu-events/{jevents,pmu-events.c} for git
2017-03-13 10:59:36 -03:00
Build
perf trace: Beautify statx syscall 'flag' and 'mask' arguments
2017-03-31 14:42:31 -03:00
builtin-annotate.c
perf tools: Include errno.h where needed
2017-04-19 13:01:51 -03:00
builtin-bench.c
perf tools: Remove unused 'prefix' from builtin functions
2017-03-27 11:58:09 -03:00
builtin-buildid-cache.c
perf symbols: Accept symbols starting at address 0
2017-05-02 18:23:04 -03:00
builtin-buildid-list.c
perf tools: Include errno.h where needed
2017-04-19 13:01:51 -03:00
builtin-c2c.c
perf tools: Move event prototypes from util.h to event.h
2017-04-25 15:30:47 -03:00
builtin-config.c
perf config: Refactor a duplicated code for obtaining config file name
2017-05-02 18:23:12 -03:00
builtin-data.c
perf tools: Remove unused 'prefix' from builtin functions
2017-03-27 11:58:09 -03:00
builtin-diff.c
perf tools: Include errno.h where needed
2017-04-19 13:01:51 -03:00
builtin-evlist.c
perf tools: Remove unused 'prefix' from builtin functions
2017-03-27 11:58:09 -03:00
builtin-ftrace.c
perf tools: Remove poll.h and wait.h from util.h
2017-04-24 13:43:34 -03:00
builtin-help.c
perf tools: Remove string.h, unistd.h and sys/stat.h from util.h
2017-04-24 13:43:33 -03:00
builtin-inject.c
perf tools: Use just forward declarations for struct thread where possible
2017-04-24 13:43:35 -03:00
builtin-kallsyms.c
perf tools: Including missing inttypes.h header
2017-04-19 13:01:46 -03:00
builtin-kmem.c
perf tools: Include errno.h where needed
2017-04-19 13:01:51 -03:00
builtin-kvm.c
perf tools: Remove poll.h and wait.h from util.h
2017-04-24 13:43:34 -03:00
builtin-list.c
perf tools: Remove unused 'prefix' from builtin functions
2017-03-27 11:58:09 -03:00
builtin-lock.c
perf tools: Include errno.h where needed
2017-04-19 13:01:51 -03:00
builtin-mem.c
perf tools: Use just forward declarations for struct thread where possible
2017-04-24 13:43:35 -03:00
builtin-probe.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
2017-05-02 19:09:35 -07:00
builtin-record.c
perf tools: Remove poll.h and wait.h from util.h
2017-04-24 13:43:34 -03:00
builtin-report.c
perf tools: Remove string.h, unistd.h and sys/stat.h from util.h
2017-04-24 13:43:33 -03:00
builtin-sched.c
perf tools: Include errno.h where needed
2017-04-19 13:01:51 -03:00
builtin-script.c
perf script: Add --inline option for debugging
2017-05-24 08:41:48 +02:00
builtin-stat.c
perf stat: Only print NMI watchdog hint when enabled
2017-06-02 11:15:34 -03:00
builtin-timechart.c
perf tools: Use just forward declarations for struct thread where possible
2017-04-24 13:43:35 -03:00
builtin-top.c
perf tools: Move event prototypes from util.h to event.h
2017-04-25 15:30:47 -03:00
builtin-trace.c
perf trace: Add mmap alias for s390
2017-06-01 10:13:21 -03:00
builtin-version.c
perf tools: Remove string.h, unistd.h and sys/stat.h from util.h
2017-04-24 13:43:33 -03:00
builtin.h
perf tools: Remove stale prototypes from builtin.h
2017-04-24 13:43:33 -03:00
check-headers.sh
tools include uapi: Grab copies of stat.h and fcntl.h
2017-03-31 11:26:03 -03:00
command-list.txt
perf tools: Missing c2c command in command-list
2017-03-13 10:59:31 -03:00
CREDITS
design.txt
Makefile
Makefile.config
perf tools: Fix build with ARCH=x86_64
2017-06-14 15:44:29 -03:00
Makefile.perf
perf tools: Fix build with ARCH=x86_64
2017-06-14 15:44:29 -03:00
MANIFEST
tools include: Introduce linux/bug.h, from the kernel sources
2017-04-19 13:01:42 -03:00
perf-archive.sh
perf-completion.sh
perf-read-vdso.c
perf-sys.h
perf-with-kcore.sh
perf.c
perf tools: Move event prototypes from util.h to event.h
2017-04-25 15:30:47 -03:00
perf.h
perf tools: Add PERF_RECORD_NAMESPACES to include namespaces related info
2017-03-14 11:38:23 -03:00