[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YvuOnkhj/Z8naRmN@kroah.com>
Date: Tue, 16 Aug 2022 14:33:34 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Daniel Sneddon <daniel.sneddon@...ux.intel.com>,
Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>,
Borislav Petkov <bp@...e.de>,
Andrew Cooper <Andrew.Cooper3@...rix.com>,
Thomas Gleixner <tglx@...utronix.de>, x86@...nel.org,
Josh Poimboeuf <jpoimboe@...hat.com>
Subject: Re: [PATCH] x86/nospec: Unwreck the RSB stuffing
On Tue, Aug 16, 2022 at 02:28:36PM +0200, Peter Zijlstra wrote:
>
> Replying here, because obviously there's no actual posting of this
> patch... :/
{sigh} True :(
>
> > --- a/arch/x86/include/asm/nospec-branch.h
> > +++ b/arch/x86/include/asm/nospec-branch.h
> > @@ -118,13 +118,28 @@
> > #endif
> > .endm
> >
> > +.macro ISSUE_UNBALANCED_RET_GUARD
> > + ANNOTATE_INTRA_FUNCTION_CALL
> > + call .Lunbalanced_ret_guard_\@
> > + int3
> > +.Lunbalanced_ret_guard_\@:
> > + add $(BITS_PER_LONG/8), %_ASM_SP
> > + lfence
> > +.endm
> > +
> > /*
> > * A simpler FILL_RETURN_BUFFER macro. Don't make people use the CPP
> > * monstrosity above, manually.
> > */
> > -.macro FILL_RETURN_BUFFER reg:req nr:req ftr:req
> > +.macro FILL_RETURN_BUFFER reg:req nr:req ftr:req ftr2
> > +.ifb \ftr2
> > ALTERNATIVE "jmp .Lskip_rsb_\@", "", \ftr
> > +.else
> > + ALTERNATIVE_2 "jmp .Lskip_rsb_\@", "", \ftr, "jmp .Lunbalanced_\@", \ftr2
> > +.endif
> > __FILL_RETURN_BUFFER(\reg,\nr,%_ASM_SP)
> > +.Lunbalanced_\@:
> > + ISSUE_UNBALANCED_RET_GUARD
> > .Lskip_rsb_\@:
> > .endm
>
> (/me deletes all the swear words and starts over)
>
> This must absolutely be the most horrible patch you could come up with,
> no? I suppose that's the price of me taking PTO :-(
>
> Could you please test this; I've only compiled it.
>
> ---
> Subject: x86/nospec: Unwreck the RSB stuffing
>
> Commit 2b1299322016 ("x86/speculation: Add RSB VM Exit protections")
> made a right mess of the RSB stuffing, rewrite the whole thing to not
> suck.
>
> Thanks to Andrew for the enlightening comment about Post-Barrier RSB
> things so we can make this code less magical.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
I need an Intel person to test this as I have no idea how to do so as
this is an issue in Linus's tree.
thanks,
greg k-h
Powered by blists - more mailing lists