Re: [PATCH] x86/dumpstack/64: Add guard pages to stack_info

From: Peter Zijlstra
Date: Thu Sep 16 2021 - 04:04:10 EST


On Thu, Sep 16, 2021 at 10:00:15AM +0200, Peter Zijlstra wrote:
> On Thu, Sep 16, 2021 at 11:47:49AM +0800, 王贇 wrote:
>
> > I did some debug and found the issue, we are missing:
> >
> > @@ -122,7 +137,10 @@ static __always_inline bool in_exception_stack(unsigned long *stack, struct stac
> > info->type = ep->type;
> > info->begin = (unsigned long *)begin;
> > info->end = (unsigned long *)end;
> > - info->next_sp = (unsigned long *)regs->sp;
> > +
> > + if (!(ep->type & STACK_TYPE_GUARD))
> > + info->next_sp = (unsigned long *)regs->sp;
> > +
> > return true;
> > }
> >
> > as the guard page are not working as real stack I guess?
>
> Correct, but I thought I put if (type & GUARD) terminators in all paths
> that ended up caring about ->next_sp. Clearly I seem to have missed one
> :/
>
> Let me try and figure out where that happens.

Oh, I'm an idiot... yes it tries to read regs the stack, but clearly
that won't work for the guard page.