Re: [PATCH 2/2] x86,entry: Use PUSH_AND_CLEAR_REGS for compat
From: Josh Poimboeuf
Date: Wed Apr 20 2022 - 10:58:53 EST
On Wed, Apr 20, 2022 at 09:07:30AM +0200, Peter Zijlstra wrote:
> On Tue, Apr 19, 2022 at 08:21:23PM -0700, Josh Poimboeuf wrote:
> > On Tue, Apr 19, 2022 at 10:41:11PM +0200, Peter Zijlstra wrote:
> > > Since the upper regs don't exist for ia32 code, preserving them
> > > doesn't hurt and it simplifies the code.
> >
> > But an attacker can still control those registers, so clearing them on
> > the stack is better, as it reduces user control over the kernel stack.
> >
> > 64-bit syscalls *do* have to save those registers to the stack, so
> > whether it truly matters if compat mode is made equally insecure, I
> > can't say. But without evidence to the contrary, my feeling is that we
> > should err on the side of caution.
>
> Right, so earlier Brian said simpler might be better, and I figured I'd
> try to see if I could make that stick, because I too like simpler ;-)
Simple is good.
> Also, since int80 already has to do this, attackers already have their
> attack surface.
Hm, probably true...
--
Josh