Re: [PATCH v10 03/14] unwind_user: Add compat mode frame pointer support
From: Steven Rostedt <rostedt@goodmis.org>
Date: 2025-06-18 15:10:44
Also in:
bpf, lkml
On Wed, 18 Jun 2025 15:46:41 +0200 Peter Zijlstra [off-list ref] wrote:
On Tue, Jun 10, 2025 at 08:54:24PM -0400, Steven Rostedt wrote:quoted
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().
Sure. Will update it.
quoted
+{ + 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?
Don't we usually shout macros? -- Steve
quoted
+({ \ + 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;