Re: [PATCH 11/12] unwind: Implement compat fp unwind
From: Peter Zijlstra
Date: Fri Oct 24 2025 - 10:13:16 EST
On Wed, Oct 22, 2025 at 02:31:40PM -0400, Steven Rostedt wrote:
> On Wed, 24 Sep 2025 09:59:59 +0200
> Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> > @@ -100,6 +115,7 @@ static int unwind_user_start(struct unwi
> > state->ip = instruction_pointer(regs);
> > state->sp = user_stack_pointer(regs);
> > state->fp = frame_pointer(regs);
> > + state->ws = compat_user_mode(regs) ? sizeof(int) : sizeof(long);
>
> compat_user_mode() is an architecture function (only defined in arm64 and now x86).
>
> s390 doesn't implement it and regs can't be used to tell if it's compat or
> not (although Jens tells me the task_struct can).
I've made this:
state->ws = unwind_user_word_size(regs);
And then every arch will need to implement this. The x86 implementations
is:
static inline int unwind_user_word_size(struct pt_regs *regs)
{
#ifdef CONFIG_X86_64
if (!user_64bit_mode(regs))
return sizeof(int);
#endif
return sizeof(long);
}