[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251024141657.GL4068168@noisy.programming.kicks-ass.net>
Date: Fri, 24 Oct 2025 16:16:57 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: jpoimboe@...nel.org, rostedt@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 11/12] unwind: Implement compat fp unwind
On Fri, Oct 24, 2025 at 04:10:56PM +0200, Peter Zijlstra wrote:
> 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@...radead.org> 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);
Ooh, how about I do:
if (!state->ws) {
state->done = true;
return -EINVAL; // nobody cares about this return value
}
>
> And then every arch will need to implement this. The x86 implementations
> is:
>
> static inline int unwind_user_word_size(struct pt_regs *regs)
> {
if (regs->flags & X86_VM_MASK)
return 0;
> #ifdef CONFIG_X86_64
> if (!user_64bit_mode(regs))
> return sizeof(int);
> #endif
> return sizeof(long);
> }
Then we flat out refuse to unwind VM86, which is slightly different from
the current code (which would still record regs->ip), but meh.
Powered by blists - more mailing lists