# 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 
- List: linux-trace-kernel
- Page: https://ratatoskr.run/linux-trace-kernel/2025/06/3097632
- Thread: https://ratatoskr.run/linux-trace-kernel/2025/06/3086227/t.md

```text
On Wed, 18 Jun 2025 15:46:41 +0200
Peter Zijlstra [ref] wrote:

> 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().

Sure. Will update it.

> 
> > +{
> > +	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

> 
> > +({									\
> > +	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;  

```
