Re: [PATCH V4 1/7] x86/traps: Move pt_regs only in fixup_bad_iret()

From: Lai Jiangshan
Date: Thu Apr 07 2022 - 21:56:44 EST


On Thu, Apr 7, 2022 at 9:19 PM Borislav Petkov <bp@xxxxxxxxx> wrote:
>
> On Thu, Apr 07, 2022 at 10:22:25AM +0200, Borislav Petkov wrote:
> > Maybe there was a reason it was done this way:
>
> Ok, I went and singlestepped this code so that I can see what's going
> on.

[....]

>
> So your commit message should have been as simple as:
>
> "Always stash the address error_entry() is going to return to, in %r12
> and get rid of the void *error_entry_ret; slot in struct bad_iret_stack
> which was supposed to account for it and pt_regs pushed on the stack.
>
> After this, both functions can work on a struct pt_regs pointer
> directly."

Thank you for elaborating on the details and I will use this changelog.

Thanks
Lai

>
> In any case, I don't see why amluto would do this so this looks like a
> sensible cleanup to do.
>