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]
Message-ID: <20180104225127.GF32035@hirez.programming.kicks-ass.net>
Date:   Thu, 4 Jan 2018 23:51:27 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Tim Chen <tim.c.chen@...ux.intel.com>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Andy Lutomirski <luto@...nel.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Greg KH <gregkh@...uxfoundation.org>,
        Dave Hansen <dave.hansen@...el.com>,
        Andrea Arcangeli <aarcange@...hat.com>,
        Andi Kleen <ak@...ux.intel.com>,
        Arjan Van De Ven <arjan.van.de.ven@...el.com>,
        linux-kernel@...r.kernel.org, David Woodhouse <dwmw@...zon.co.uk>
Subject: Re: [PATCH 5/7] x86: Use IBRS for firmware update path

On Thu, Jan 04, 2018 at 09:56:46AM -0800, Tim Chen wrote:
> diff --git a/arch/x86/include/asm/spec_ctrl.h b/arch/x86/include/asm/spec_ctrl.h
> index 28b0314..23b2804 100644
> --- a/arch/x86/include/asm/spec_ctrl.h
> +++ b/arch/x86/include/asm/spec_ctrl.h
> @@ -113,5 +113,42 @@ static inline void unprotected_speculation_end(void)
>  		rmb();
>  }
>  
> +
> +#if defined(RETPOLINE)
> +/*
> + * RETPOLINE does not protect against indirect speculation
> + * in firmware code.  Enable IBRS to protect firmware execution.
> + */
> +static inline void unprotected_firmware_begin(void)
> +{
> +	if (boot_cpu_has(X86_FEATURE_SPEC_CTRL))
> +                __disable_indirect_speculation();
> +	else
> +		/*
> +		 * If we intended to disable indirect speculation
> +		 * but come here due to mis-speculation, we need
> +		 * to stop the mis-speculation with rmb.
> +		 */
> +		rmb();
> +}

Looks like an exact replica of unprotected_speculation_end() we're going
for max linecount or something?

> +
> +static inline void unprotected_firmware_end(void)
> +{
> +	if (boot_cpu_has(X86_FEATURE_SPEC_CTRL))
> +                __enable_indirect_speculation();
> +}
> +
> +#else
> +static inline void unprotected_firmware_begin(void)
> +{
> +	return;
> +}
> +
> +static inline void unprotected_firmware_end(void)
> +{
> +	return;
> +}

Those return's are superfluous.

> +#endif
> +
>  #endif /* __ASSEMBLY__ */
>  #endif /* _ASM_X86_SPEC_CTRL_H */
> -- 
> 2.9.4
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ