Signed-off-by: Jens Remus --- Notes (jremus): This fixup resolves the following issue for unwind user sframe, that got introduced by Peter Zijlstra's patch "[PATCH 11/12] unwind: Implement compat fp unwind" [1]: Peter factored out the word size (i.e. 4 for 32-bit compat or 8 for 64-bit) from the frame CFA, FP, and RA offsets. This is an issue for unwind user sframe for two reasons: 1. SFrame provides absolute offsets, which would require to be unnecessarily scaled down only to get scaled up again prior to use. 2. Factoring out the word size from those offsets requires that all architectures/ABIs guarantee, that these offsets are always aligned to the word size. Limit the down-/upscaling by word size to unwind user (compat) fp. [1]: https://lore.kernel.org/lkml/20250924080119.613695709@infradead.org/ kernel/unwind/user.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/kernel/unwind/user.c b/kernel/unwind/user.c index bc1bf1e83d65..696004ee956a 100644 --- a/kernel/unwind/user.c +++ b/kernel/unwind/user.c @@ -8,19 +8,15 @@ #include #include -static const struct unwind_user_frame fp_frame = { - ARCH_INIT_USER_FP_FRAME -}; - #define for_each_user_frame(state) \ for (unwind_user_start(state); !(state)->done; unwind_user_next(state)) static inline int -get_user_word(unsigned long *word, unsigned long base, int off, int size) +get_user_word(unsigned long *word, unsigned long base, int off, unsigned int ws) { - unsigned long __user *addr = (void __user *)base + (off * size); + unsigned long __user *addr = (void __user *)base + off; #ifdef CONFIG_COMPAT - if (size == sizeof(int)) { + if (ws == sizeof(int)) { unsigned int data; int ret = get_user(data, (unsigned int __user *)addr); *word = data; @@ -32,6 +28,9 @@ get_user_word(unsigned long *word, unsigned long base, int off, int size) static int unwind_user_next_fp(struct unwind_user_state *state) { + const struct unwind_user_frame fp_frame = { + ARCH_INIT_USER_FP_FRAME(state->ws) + }; const struct unwind_user_frame *frame = &fp_frame; unsigned long cfa, fp, ra; @@ -44,7 +43,7 @@ static int unwind_user_next_fp(struct unwind_user_state *state) } /* Get the Canonical Frame Address (CFA) */ - cfa += state->ws * frame->cfa_off; + cfa += frame->cfa_off; /* stack going in wrong direction? */ if (cfa <= state->sp) -- 2.48.1