Skip to content

Commit 63be1a8

Browse files
rnavmpe
authored andcommitted
Revert "powerpc64/elfv1: Only dereference function descriptor for non-text symbols"
This reverts commit 83e840c ("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: 83e840c ("powerpc64/elfv1: Only dereference function descriptor for non-text symbols") Cc: [email protected] # v4.13+ Reported-by: Chandan Rajendra <[email protected]> Signed-off-by: Naveen N. Rao <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent 26e53d5 commit 63be1a8

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

arch/powerpc/include/asm/code-patching.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,8 @@ static inline unsigned long ppc_function_entry(void *func)
8383
* On PPC64 ABIv1 the function pointer actually points to the
8484
* function's descriptor. The first entry in the descriptor is the
8585
* address of the function text.
86-
*
87-
* However, we may also receive pointer to an assembly symbol. To
88-
* detect that, we first check if the function pointer we receive
89-
* already points to kernel/module text and we only dereference it
90-
* if it doesn't.
9186
*/
92-
if (kernel_text_address((unsigned long)func))
93-
return (unsigned long)func;
94-
else
95-
return ((func_descr_t *)func)->entry;
87+
return ((func_descr_t *)func)->entry;
9688
#else
9789
return (unsigned long)func;
9890
#endif

0 commit comments

Comments
 (0)