RE: [PATCH v8 30/33] x86/fred: allow dynamic stack frame size

From: Li, Xin3
Date: Tue Jun 06 2023 - 02:18:47 EST


> > A FRED stack frame could contain different amount of information for
> > different event types, or perhaps even for different instances of the
> > same event type. Thus we need to eliminate the need of any advance
> > information of the stack frame size to allow dynamic stack frame size.
> >
> > Implement it through:
> > 1) add a new field user_pt_regs to thread_info, and initialize it
> > with a pointer to a virtual pt_regs structure at the top of a
> > thread stack.
> > 2) save a pointer to the user-space pt_regs structure created by
> > fred_entrypoint_user() to user_pt_regs in fred_entry_from_user().
> > 3) initialize the init_thread_info's user_pt_regs with a pointer to
> > a virtual pt_regs structure at the top of init stack.
> >
> > This approach also works for IDT, thus we unify the code.
>
> And thereby remove the useful comment and replace it with an undocumented
> macro mess.
>
> I'm simply refusing to review this. It's not my job to understand this
> undocumented hackery.
>

I believe it's a nice idea to allow dynamic stack frame size, at least for
FRED. It's totally my bad that I didn't make it meet the minimum standards,
I will rewrite the commit message and add better comments.

After a second thought, I probably should only apply the change to FRED for
2 reasons, the change seems problematic with ESPFIX (which FRED doesn't need),
and such corner cases are hard to test (self-tests needed?).

Thanks!
Xin