linux/arch/powerpc/perf
Ravi Bangoria bf05fc25f2 powerpc/perf: Fix oops when kthread execs user process
When a kthread calls call_usermodehelper() the steps are:
  1. allocate current->mm
  2. load_elf_binary()
  3. populate current->thread.regs

While doing this, interrupts are not disabled. If there is a perf
interrupt in the middle of this process (i.e. step 1 has completed
but not yet reached to step 3) and if perf tries to read userspace
regs, kernel oops with following log:

  Unable to handle kernel paging request for data at address 0x00000000
  Faulting instruction address: 0xc0000000000da0fc
  ...
  Call Trace:
  perf_output_sample_regs+0x6c/0xd0
  perf_output_sample+0x4e4/0x830
  perf_event_output_forward+0x64/0x90
  __perf_event_overflow+0x8c/0x1e0
  record_and_restart+0x220/0x5c0
  perf_event_interrupt+0x2d8/0x4d0
  performance_monitor_exception+0x54/0x70
  performance_monitor_common+0x158/0x160
  --- interrupt: f01 at avtab_search_node+0x150/0x1a0
      LR = avtab_search_node+0x100/0x1a0
  ...
  load_elf_binary+0x6e8/0x15a0
  search_binary_handler+0xe8/0x290
  do_execveat_common.isra.14+0x5f4/0x840
  call_usermodehelper_exec_async+0x170/0x210
  ret_from_kernel_thread+0x5c/0x7c

Fix it by setting abi to PERF_SAMPLE_REGS_ABI_NONE when userspace
pt_regs are not set.

Fixes: ed4a4ef85c ("powerpc/perf: Add support for sampling interrupt register state")
Cc: stable@vger.kernel.org # v4.7+
Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Acked-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2017-06-16 21:02:46 +10:00
..
req-gen powerpc/perf/{hv-gpci, hv-common}: generate requests with counters annotated 2015-02-02 17:56:39 +11:00
8xx-pmu.c powerpc/8xx: Perf events on PPC 8xx 2017-01-26 17:49:34 -06:00
bhrb.S powerpc/perf: Add basic assembly code to read BHRB entries on POWER8 2013-04-26 16:11:11 +10:00
callchain.c Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-05-25 17:05:40 -07:00
core-book3s.c powerpc/perf: Support to export MMCRA[TEC*] field to userspace 2017-04-19 20:00:22 +10:00
core-fsl-emb.c perf/powerpc: reset event hw state when adding it to the PMU 2015-01-29 23:44:18 -06:00
e500-pmu.c powerpc/perf: Add stalled-cycles events 2013-01-10 17:00:56 +11:00
e6500-pmu.c powerpc/perf: Add e6500 PMU driver 2013-08-07 18:38:04 -05:00
hv-24x7-catalog.h powerpc/perf/hv-24x7: parse catalog and populate sysfs with events 2015-02-02 17:56:38 +11:00
hv-24x7-domains.h powerpc/perf/hv-24x7: parse catalog and populate sysfs with events 2015-02-02 17:56:38 +11:00
hv-24x7.c powerpc: Various typo fixes 2016-06-14 13:58:26 +10:00
hv-24x7.h powerpc: Various typo fixes 2016-06-14 13:58:26 +10:00
hv-common.c powerpc/perf/{hv-gpci, hv-common}: generate requests with counters annotated 2015-02-02 17:56:39 +11:00
hv-common.h perf: define EVENT_DEFINE_RANGE_FORMAT_LITE helper 2015-02-02 17:56:38 +11:00
hv-gpci-requests.h powerpc/perf/hv-gpci: add the remaining gpci requests 2015-02-02 17:56:39 +11:00
hv-gpci.c powerpc/sparse: Make a bunch of things static 2016-09-13 17:35:47 +10:00
hv-gpci.h powerpc/perf/{hv-gpci, hv-common}: generate requests with counters annotated 2015-02-02 17:56:39 +11:00
isa207-common.c powerpc/perf: Support to export MMCRA[TEC*] field to userspace 2017-04-19 20:00:22 +10:00
isa207-common.h powerpc/perf: Support to export MMCRA[TEC*] field to userspace 2017-04-19 20:00:22 +10:00
Makefile powerpc/8xx: Perf events on PPC 8xx 2017-01-26 17:49:34 -06:00
mpc7450-pmu.c powerpc/perf: Pass the struct perf_events down to compute_mmcr() 2014-07-28 14:30:47 +10:00
perf_regs.c powerpc/perf: Fix oops when kthread execs user process 2017-06-16 21:02:46 +10:00
power4-pmu.c powerpc/perf: Pass the struct perf_events down to compute_mmcr() 2014-07-28 14:30:47 +10:00
power5-pmu.c powerpc/perf: Pass the struct perf_events down to compute_mmcr() 2014-07-28 14:30:47 +10:00
power5+-pmu.c powerpc/perf: Pass the struct perf_events down to compute_mmcr() 2014-07-28 14:30:47 +10:00
power6-pmu.c powerpc/perf: Pass the struct perf_events down to compute_mmcr() 2014-07-28 14:30:47 +10:00
power7-events-list.h powerpc/perf: Make some new raw event codes available in sysfs 2014-03-24 09:48:23 +11:00
power7-pmu.c powerpc/sparse: Make a bunch of things static 2016-09-13 17:35:47 +10:00
power8-events-list.h powerpc/perf: Add Power8 mem_access event to sysfs 2017-04-19 20:00:23 +10:00
power8-pmu.c powerpc/perf: Add Power8 mem_access event to sysfs 2017-04-19 20:00:23 +10:00
power9-events-list.h powerpc/perf: Add PM_INST_DISP event to Power9 event list 2017-02-17 21:48:52 +11:00
power9-pmu.c powerpc/perf: Fix Power9 test_adder fields 2017-06-06 21:21:19 +10:00
ppc970-pmu.c powerpc/perf: Pass the struct perf_events down to compute_mmcr() 2014-07-28 14:30:47 +10:00