[RFC PATCH v1 01/16] fixup! unwind_user: Add frame pointer support

From: Jens Remus
Date: Thu Jul 10 2025 - 12:36:09 EST


---
kernel/unwind/user.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/unwind/user.c b/kernel/unwind/user.c
index 6e7ca9f1293a..d0181c636c6b 100644
--- a/kernel/unwind/user.c
+++ b/kernel/unwind/user.c
@@ -74,6 +74,7 @@ static int unwind_user_next(struct unwind_user_state *state)
goto done;
}

+ /* Get the Canonical Frame Address (CFA) */
if (frame->use_fp) {
if (state->fp < state->sp)
goto done;
@@ -81,11 +82,9 @@ static int unwind_user_next(struct unwind_user_state *state)
} else {
cfa = state->sp;
}
-
- /* Get the Canonical Frame Address (CFA) */
cfa += frame->cfa_off;

- /* stack going in wrong direction? */
+ /* Make sure that stack is not going in wrong direction */
if (cfa <= state->sp)
goto done;

@@ -94,10 +93,11 @@ static int unwind_user_next(struct unwind_user_state *state)
if ((cfa + frame->ra_off) & ((1 << shift) - 1))
goto done;

- /* Find the Return Address (RA) */
+ /* Get the Return Address (RA) */
if (unwind_get_user_long(ra, cfa + frame->ra_off, state))
goto done;

+ /* Get the Frame Pointer (FP) */
if (frame->fp_off && unwind_get_user_long(fp, cfa + frame->fp_off, state))
goto done;

--
2.48.1