Re: [PATCH v3] x86,entry: Use PUSH_AND_CLEAR_REGS for compat

From: Linus Torvalds
Date: Fri Apr 29 2022 - 17:31:14 EST


On Fri, Apr 29, 2022 at 2:13 PM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> (Linus, can I add your SoB to the thing?)

If you teste this with some actual old int80 compat syscalls, then absolutely:

Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

> + pushq %rdi /* pt_regs->di */
> pushq %rsi /* pt_regs->si */
> xorl %esi, %esi /* nospec si */

It would probably make sense to add a comment about why %rdi isn't
cleared when pushed, like all the other registers are.

Even if that comment is just "%rdi will be overwritten as arg0 of the
call to C, so no need to clear it".

Maybe as part of the PUSH_AND_CLEAR_REGS changes?

Linus