Re: [PATCH v10 03/14] unwind_user: Add compat mode frame pointer support
From: Peter Zijlstra <peterz@infradead.org>
Date: 2025-06-18 13:46:53
Also in:
bpf, lkml
From: Peter Zijlstra <peterz@infradead.org>
Date: 2025-06-18 13:46:53
Also in:
bpf, lkml
On Tue, Jun 10, 2025 at 08:54:24PM -0400, Steven Rostedt wrote:
diff --git a/kernel/unwind/user.c b/kernel/unwind/user.c index 4fc550356b33..29e1f497a26e 100644 --- a/kernel/unwind/user.c +++ b/kernel/unwind/user.c@@ -12,12 +12,32 @@ static struct unwind_user_frame fp_frame = { ARCH_INIT_USER_FP_FRAME }; +static struct unwind_user_frame compat_fp_frame = { + ARCH_INIT_USER_COMPAT_FP_FRAME +}; + static inline bool fp_state(struct unwind_user_state *state) { return IS_ENABLED(CONFIG_HAVE_UNWIND_USER_FP) && state->type == UNWIND_USER_TYPE_FP; } +static inline bool compat_state(struct unwind_user_state *state)
Consistency would mandate this thing be called: compat_fp_state().
+{
+ return IS_ENABLED(CONFIG_HAVE_UNWIND_USER_COMPAT_FP) &&
+ state->type == UNWIND_USER_TYPE_COMPAT_FP;
+}
+
+#define UNWIND_GET_USER_LONG(to, from, state) \Do we have to shout this?
+({ \
+ int __ret; \
+ if (compat_state(state)) \
+ __ret = get_user(to, (u32 __user *)(from)); \
+ else \
+ __ret = get_user(to, (unsigned long __user *)(from)); \
+ __ret; \
+})
+
int unwind_user_next(struct unwind_user_state *state)
{
struct unwind_user_frame *frame;