lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 9 Aug 2023 15:26:35 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Josh Poimboeuf <jpoimboe@...nel.org>
Cc:     x86@...nel.org, linux-kernel@...r.kernel.org, David.Kaplan@....com,
        Andrew.Cooper3@...rix.com, gregkh@...uxfoundation.org
Subject: Re: [RFC][PATCH 05/17] x86/cpu: Cleanup the untrain mess

On Wed, Aug 09, 2023 at 03:12:43PM +0200, Peter Zijlstra wrote:
> On Wed, Aug 09, 2023 at 08:51:01AM -0400, Josh Poimboeuf wrote:
> > On Wed, Aug 09, 2023 at 09:12:23AM +0200, Peter Zijlstra wrote:
> > > Since there can only be one active return_thunk, there only needs be
> > > one (matching) untrain_ret. It fundamentally doesn't make sense to
> > > allow multiple untrain_ret at the same time.
> > > 
> > > Fold all the 3 different untrain methods into a single (temporary)
> > > helper stub.
> > > 
> > > Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> > > ---
> > >  arch/x86/include/asm/nospec-branch.h |   19 +++++--------------
> > >  arch/x86/lib/retpoline.S             |    7 +++++++
> > >  2 files changed, 12 insertions(+), 14 deletions(-)
> > > 
> > > --- a/arch/x86/include/asm/nospec-branch.h
> > > +++ b/arch/x86/include/asm/nospec-branch.h
> > > @@ -272,9 +272,9 @@
> > >  .endm
> > >  
> > >  #ifdef CONFIG_CPU_UNRET_ENTRY
> > > -#define CALL_ZEN_UNTRAIN_RET	"call zen_untrain_ret"
> > > +#define CALL_UNTRAIN_RET	"call entry_untrain_ret"
> > >  #else
> > > -#define CALL_ZEN_UNTRAIN_RET	""
> > > +#define CALL_UNTRAIN_RET	""
> > >  #endif
> > >  
> > >  /*
> > > @@ -293,15 +293,10 @@
> > >  	defined(CONFIG_CALL_DEPTH_TRACKING) || defined(CONFIG_CPU_SRSO)
> > >  	VALIDATE_UNRET_END
> > >  	ALTERNATIVE_3 "",						\
> > > -		      CALL_ZEN_UNTRAIN_RET, X86_FEATURE_UNRET,		\
> > > +		      CALL_UNTRAIN_RET, X86_FEATURE_UNRET,		\
> > 
> > SRSO doesn't have X86_FEATURE_UNRET set.
> 
> Argh.. this stuff doesn't exist at the end anymore, but yeah, that's
> unfortunate.
> 
> I'll see if I can find another intermediate step.

I think simply setting UNRET for SRSO at this point will be sufficient.
That ensures the entry_untrain_ret thing gets called, and the
alternative there DTRT.

The feature isn't used anywhere else afaict.

Then later, after the fancy alternatives happen, this can be cleaned up
again.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ