Re: [PATCH 0/5] Enable pt_regs based syscalls for x86-32 native

From: Brian Gerst
Date: Fri Feb 21 2020 - 08:15:33 EST


On Fri, Feb 21, 2020 at 2:07 AM Dominik Brodowski
<linux@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> Brian,
>
> On Fri, Feb 21, 2020 at 12:09:29AM -0500, Brian Gerst wrote:
> > This patch series cleans up the x86 syscall wrapper code and converts
> > the 32-bit native kernel over to pt_regs based syscalls.
>
> thanks for your patchset. Could you explain a bit more what the rationale
> is. Due to asmlinkage, it doesn't leak "random user-provided register
> content down the call chain" (as was the case for x86-64). But it may be
> cleaner, and you mention in patch 5/5 that the new way is "a bit more
> efficient" -- do you have numbers?

The main rationale for this patch set is to make the 32-bit native
kernel consistent with the 64-bit kernel. It's also slightly more
efficient because the old code pushed all 6 arguments onto the stack
whereas the new code only reads the args the syscall needs, with the
pt_regs pointer passed in through a register. By efficient I mean
that it uses fewer instructions and stack accesses, not that it will
actually have a significant difference on a benchmark.

--
Brian Gerst