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

From: Borislav Petkov
Date: Thu Apr 07 2022 - 04:22:54 EST


On Thu, Apr 07, 2022 at 03:03:08PM +0800, Lai Jiangshan wrote:
> sync_regs() is called before the return address of error_entry()
> popped into %r12 while fixup_bad_iret() is called with the return
> address of error_entry() still on the stack. And the primitives of
> fixup_bad_iret() and sync_regs() are different which also means
> they are not the same way.
>
> After this change, they become the same way.
>
> IMO, sync_regs() is grace while fixup_bad_iret() is a bad C function
> or is not a pure C function because it is handling the return address
> of its parent function which is better done by the compiler or ASM
> code.

Maybe there was a reason it was done this way:

b645af2d5905 ("x86_64, traps: Rework bad_iret")

although I don't see anything relevant in the text explaining this.

Andy?

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette