• Naveen N. Rao's avatar
    Revert "powerpc64/elfv1: Only dereference function descriptor for non-text symbols" · 63be1a81
    Naveen N. Rao authored
    This reverts commit 83e840c7 ("powerpc64/elfv1: Only dereference
    function descriptor for non-text symbols").
    
    Chandan reported that on newer kernels, trying to enable function_graph
    tracer on ppc64 (BE) locks up the system with the following trace:
    
      Unable to handle kernel paging request for data at address 0x600000002fa30010
      Faulting instruction address: 0xc0000000001f1300
      Thread overran stack, or stack corrupted
      Oops: Kernel access of bad area, sig: 11 [#1]
      BE SMP NR_CPUS=2048 DEBUG_PAGEALLOC NUMA pSeries
      Modules linked in:
      CPU: 1 PID: 6586 Comm: bash Not tainted 4.14.0-rc3-00162-g6e51f1f-dirty #20
      task: c000000625c07200 task.stack: c000000625c07310
      NIP:  c0000000001f1300 LR: c000000000121cac CTR: c000000000061af8
      REGS: c000000625c088c0 TRAP: 0380   Not tainted  (4.14.0-rc3-00162-g6e51f1f-dirty)
      MSR:  8000000000001032 <SF,ME,IR,DR,RI>  CR: 28002848  XER: 00000000
      CFAR: c0000000001f1320 SOFTE: 0
      ...
      NIP [c0000000001f1300] .__is_insn_slot_addr+0x30/0x90
      LR [c000000000121cac] .kernel_text_address+0x18c/0x1c0
      Call Trace:
      [c000000625c08b40] [c0000000001bd040] .is_module_text_address+0x20/0x40 (unreliable)
      [c000000625c08bc0] [c000000000121cac] .kernel_text_address+0x18c/0x1c0
      [c000000625c08c50] [c000000000061960] .prepare_ftrace_return+0x50/0x130
      [c000000625c08cf0] [c000000000061b10] .ftrace_graph_caller+0x14/0x34
      [c000000625c08d60] [c000000000121b40] .kernel_text_address+0x20/0x1c0
      [c000000625c08df0] [c000000000061960] .prepare_ftrace_return+0x50/0x130
      ...
      [c000000625c0ab30] [c000000000061960] .prepare_ftrace_return+0x50/0x130
      [c000000625c0abd0] [c000000000061b10] .ftrace_graph_caller+0x14/0x34
      [c000000625c0ac40] [c000000000121b40] .kernel_text_address+0x20/0x1c0
      [c000000625c0acd0] [c000000000061960] .prepare_ftrace_return+0x50/0x130
      [c000000625c0ad70] [c000000000061b10] .ftrace_graph_caller+0x14/0x34
      [c000000625c0ade0] [c000000000121b40] .kernel_text_address+0x20/0x1c0
    
    This is because ftrace is using ppc_function_entry() for obtaining the
    address of return_to_handler() in prepare_ftrace_return(). The call to
    kernel_text_address() itself gets traced and we end up in a recursive
    loop.
    
    Fixes: 83e840c7 ("powerpc64/elfv1: Only dereference function descriptor for non-text symbols")
    Cc: stable@vger.kernel.org # v4.13+
    Reported-by: default avatarChandan Rajendra <chandan@linux.vnet.ibm.com>
    Signed-off-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    63be1a81
Name
Last commit
Last update
..
alpha Loading commit data...
arc Loading commit data...
arm Loading commit data...
arm64 Loading commit data...
blackfin Loading commit data...
c6x Loading commit data...
cris Loading commit data...
frv Loading commit data...
h8300 Loading commit data...
hexagon Loading commit data...
ia64 Loading commit data...
m32r Loading commit data...
m68k Loading commit data...
metag Loading commit data...
microblaze Loading commit data...
mips Loading commit data...
mn10300 Loading commit data...
nios2 Loading commit data...
openrisc Loading commit data...
parisc Loading commit data...
powerpc Loading commit data...
s390 Loading commit data...
score Loading commit data...
sh Loading commit data...
sparc Loading commit data...
tile Loading commit data...
um Loading commit data...
unicore32 Loading commit data...
x86 Loading commit data...
xtensa Loading commit data...
.gitignore Loading commit data...
Kconfig Loading commit data...