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: <20181206084141.GA13538@hirez.programming.kicks-ass.net>
Date:   Thu, 6 Dec 2018 09:41:41 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Waiman Long <longman@...hat.com>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        x86@...nel.org, linux-kernel@...r.kernel.org,
        Tim Chen <tim.c.chen@...ux.intel.com>,
        Josh Poimboeuf <jpoimboe@...hat.com>
Subject: Re: [PATCH 2/2] x86/speculation: switch_to_cond_stibp on is the
 likely case

On Wed, Dec 05, 2018 at 02:49:28PM -0500, Waiman Long wrote:
> Since conditional STIBP is the default, it should be treated as
> the likely case. Changes the use of static_branch_unlikely() to
> static_branch_likely() for switch_to_cond_stibp.

So now you're making kernels on 'fixed' or unaffected hardware slower.

> Signed-off-by: Waiman Long <longman@...hat.com>
> ---
>  arch/x86/kernel/cpu/bugs.c | 2 +-
>  arch/x86/kernel/process.c  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> index a68b32c..bd11119 100644
> --- a/arch/x86/kernel/cpu/bugs.c
> +++ b/arch/x86/kernel/cpu/bugs.c
> @@ -153,7 +153,7 @@ void __init check_bugs(void)
>  			hostval |= ssbd_tif_to_spec_ctrl(ti->flags);
>  
>  		/* Conditional STIBP enabled? */
> -		if (static_branch_unlikely(&switch_to_cond_stibp))
> +		if (static_branch_likely(&switch_to_cond_stibp))
>  			hostval |= stibp_tif_to_spec_ctrl(ti->flags);
>  
>  		if (hostval != guestval) {
> diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
> index 7d31192..39a21ae 100644
> --- a/arch/x86/kernel/process.c
> +++ b/arch/x86/kernel/process.c
> @@ -434,7 +434,7 @@ static __always_inline void __speculation_ctrl_update(unsigned long tifp,
>  	 * otherwise avoid the MSR write.
>  	 */
>  	if (IS_ENABLED(CONFIG_SMP) &&
> -	    static_branch_unlikely(&switch_to_cond_stibp)) {
> +	    static_branch_likely(&switch_to_cond_stibp)) {
>  		updmsr |= !!(tif_diff & _TIF_SPEC_IB);
>  		msr |= stibp_tif_to_spec_ctrl(tifn);
>  	}
> -- 
> 1.8.3.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ