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:   Thu, 11 Jan 2018 09:42:38 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     "Woodhouse, David" <dwmw@...zon.co.uk>
Cc:     "ak@...ux.intel.com" <ak@...ux.intel.com>,
        "tim.c.chen@...ux.intel.com" <tim.c.chen@...ux.intel.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "torvalds@...ux-foundation.org" <torvalds@...ux-foundation.org>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "x86@...nel.org" <x86@...nel.org>,
        "riel@...hat.com" <riel@...hat.com>,
        "keescook@...gle.com" <keescook@...gle.com>,
        "gnomes@...rguk.ukuu.org.uk" <gnomes@...rguk.ukuu.org.uk>,
        "pjt@...gle.com" <pjt@...gle.com>,
        "Ghitulete, Razvan-alin" <rga@...zon.com>,
        "bp@...en8.de" <bp@...en8.de>,
        "dave.hansen@...el.com" <dave.hansen@...el.com>,
        "luto@...capital.net" <luto@...capital.net>,
        "jikos@...nel.org" <jikos@...nel.org>,
        "gregkh@...ux-foundation.org" <gregkh@...ux-foundation.org>
Subject: Re: [PATCH] x86/retpoline: Fill return stack buffer on vmexit

On Thu, Jan 11, 2018 at 12:04:35AM +0000, Woodhouse, David wrote:
> On Wed, 2018-01-10 at 15:47 -0800, Tim Chen wrote:
> > 
> > > +
> > > +     asm volatile (ALTERNATIVE("",
> > > +                               __stringify(__FILL_RETURN_BUFFER(%0, %1, _%=)),
> > > +                               X86_FEATURE_RETPOLINE)
> > 
> > We'll be patching in a fairly long set of instructions here.  Maybe put
> > the ALTERNATIVE in the assembly and use a jmp skip_\@ for the ALTERNATIVE.
> 
> Perhaps the alternatives.h header could give me a clean way of doing this:
> 
> --- a/arch/x86/include/asm/nospec-branch.h
> +++ b/arch/x86/include/asm/nospec-branch.h
> @@ -177,7 +178,7 @@ static inline void vmexit_fill_RSB(void)
>  {
>         unsigned long dummy;
>  
> -       asm volatile (ALTERNATIVE("",
> +       asm volatile (ALTERNATIVE("jmp " alt_end_marker "f",
>                                   __stringify(__FILL_RETURN_BUFFER(%0, %1, _%=)),
>                                   X86_FEATURE_RETPOLINE)
>                       : "=r" (dummy), ASM_CALL_CONSTRAINT : : "memory" );


Or we teach the alternative thing to patch in a jmp to end instead of
NOP padding the entire thing as soon as the jmp (3 bytes) fits ?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ