Skip to contentSkip to conversation

powerpc/ftrace: Fix stack teardown in ftrace_no_trace

PATCH Applied Naveen N Rao 2 participants 2 messages Nov 30, 2023 – Dec 7, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/ftrace: Fix stack teardown in ftrace_no_trace

Commit 41a506ef71eb ("powerpc/ftrace: Create a dummy stackframe to fix stack unwind") added use of a new stack frame on ftrace entry to fix stack unwind. However, the commit missed updating the offset used while tearing down the ftrace stack when ftrace is disabled. Fix the same.

In addition, the commit missed saving the correct stack pointer in pt_regs. Update the same.

Fixes 41a506ef71eb ("powerpc/ftrace: Create a dummy stackframe to fix stack unwind")
---
 arch/powerpc/kernel/trace/ftrace_entry.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/trace/ftrace_entry.S +2 -2
index 90701885762c..40677416d7b2 100644
@@ -62,7 +62,7 @@
 	.endif
 
 	/* Save previous stack pointer (r1) */
-	addi	r8, r1, SWITCH_FRAME_SIZE
+	addi	r8, r1, SWITCH_FRAME_SIZE+STACK_FRAME_MIN_SIZE
 	PPC_STL	r8, GPR1(r1)
 
 	.if \allregs == 1
@@ -182,7 +182,7 @@ ftrace_no_trace:
 	mflr	r3
 	mtctr	r3
 	REST_GPR(3, r1)
-	addi	r1, r1, SWITCH_FRAME_SIZE
+	addi	r1, r1, SWITCH_FRAME_SIZE+STACK_FRAME_MIN_SIZE
 	mtlr	r0
 	bctr
 #endif

base-commit: 9a15ae60f2c9707433b01e55815cd9142be102b2

Signature · 1 line
2.43.0
#1 lore raw
Quoted 9 lines · Naveen N Rao

Commit 41a506ef71eb ("powerpc/ftrace: Create a dummy stackframe to fix stack unwind") added use of a new stack frame on ftrace entry to fix stack unwind. However, the commit missed updating the offset used while tearing down the ftrace stack when ftrace is disabled. Fix the same.

In addition, the commit missed saving the correct stack pointer in pt_regs. Update the same.

[...]

Applied to powerpc/fixes.

[1/1] powerpc/ftrace: Fix stack teardown in ftrace_no_trace

      https://git.kernel.org/powerpc/c/4b3338aaa74d7d4ec5b6734dc298f0db94ec83d2

cheers