mirror of https://github.com/torvalds/linux.git
On systems without any specific PMU driver support registered, running
perf record causes Oops.
The relevant portion from call trace:
BUG: Kernel NULL pointer dereference on read at 0x00000040
Faulting instruction address: 0xc0021f0c
Oops: Kernel access of bad area, sig: 11 [#1]
BE PAGE_SIZE=4K PREEMPT CMPCPRO
SAF3000 DIE NOTIFICATION
CPU: 0 PID: 442 Comm: null_syscall Not tainted 5.13.0-rc6-s3k-dev-01645-g7649ee3d2957 #5164
NIP: c0021f0c LR: c00e8ad8 CTR: c00d8a5c
NIP perf_instruction_pointer+0x10/0x60
LR perf_prepare_sample+0x344/0x674
Call Trace:
perf_prepare_sample+0x7c/0x674 (unreliable)
perf_event_output_forward+0x3c/0x94
__perf_event_overflow+0x74/0x14c
perf_swevent_hrtimer+0xf8/0x170
__hrtimer_run_queues.constprop.0+0x160/0x318
hrtimer_interrupt+0x148/0x3b0
timer_interrupt+0xc4/0x22c
Decrementer_virt+0xb8/0xbc
During perf record session, perf_instruction_pointer() is called to
capture the sample IP. This function in core-book3s accesses
ppmu->flags. If a platform specific PMU driver is not registered, ppmu
is set to NULL and accessing its members results in a crash. Fix this
crash by checking if ppmu is set.
Fixes:
|
||
|---|---|---|
| .. | ||
| req-gen | ||
| 8xx-pmu.c | ||
| Makefile | ||
| bhrb.S | ||
| callchain.c | ||
| callchain.h | ||
| callchain_32.c | ||
| callchain_64.c | ||
| core-book3s.c | ||
| core-fsl-emb.c | ||
| e500-pmu.c | ||
| e6500-pmu.c | ||
| generic-compat-pmu.c | ||
| hv-24x7-catalog.h | ||
| hv-24x7-domains.h | ||
| hv-24x7.c | ||
| hv-24x7.h | ||
| hv-common.c | ||
| hv-common.h | ||
| hv-gpci-requests.h | ||
| hv-gpci.c | ||
| hv-gpci.h | ||
| imc-pmu.c | ||
| internal.h | ||
| isa207-common.c | ||
| isa207-common.h | ||
| mpc7450-pmu.c | ||
| perf_regs.c | ||
| power5+-pmu.c | ||
| power5-pmu.c | ||
| power6-pmu.c | ||
| power7-events-list.h | ||
| power7-pmu.c | ||
| power8-events-list.h | ||
| power8-pmu.c | ||
| power9-events-list.h | ||
| power9-pmu.c | ||
| power10-events-list.h | ||
| power10-pmu.c | ||
| ppc970-pmu.c | ||