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: <YEid+HQnqgnt3iyY@hirez.programming.kicks-ass.net>
Date:   Wed, 10 Mar 2021 11:22:48 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     hpa@...or.com
Cc:     Steven Rostedt <rostedt@...dmis.org>, x86@...nel.org,
        linux-kernel@...r.kernel.org
Subject: Re: The killing of ideal_nops[]

On Wed, Mar 10, 2021 at 11:03:10AM +0100, Peter Zijlstra wrote:
> -void __init arch_init_ideal_nops(void)
> -{
> -	switch (boot_cpu_data.x86_vendor) {
> -	case X86_VENDOR_INTEL:
> -		/*
> -		 * Due to a decoder implementation quirk, some
> -		 * specific Intel CPUs actually perform better with
> -		 * the "k8_nops" than with the SDM-recommended NOPs.
> -		 */
> -		if (boot_cpu_data.x86 == 6 &&
> -		    boot_cpu_data.x86_model >= 0x0f &&
> -		    boot_cpu_data.x86_model != 0x1c &&
> -		    boot_cpu_data.x86_model != 0x26 &&
> -		    boot_cpu_data.x86_model != 0x27 &&
> -		    boot_cpu_data.x86_model < 0x30) {
> -			ideal_nops = k8_nops;
> -		} else if (boot_cpu_has(X86_FEATURE_NOPL)) {
> -			   ideal_nops = p6_nops;
> -		} else {
> -#ifdef CONFIG_X86_64
> -			ideal_nops = k8_nops;
> -#else
> -			ideal_nops = intel_nops;
> -#endif
> -		}
> -		break;
> -
> -	case X86_VENDOR_HYGON:
> -		ideal_nops = p6_nops;
> -		return;
> -
> -	case X86_VENDOR_AMD:
> -		if (boot_cpu_data.x86 > 0xf) {
> -			ideal_nops = p6_nops;
> -			return;
> -		}
> -
> -		fallthrough;
> -
> -	default:
> -#ifdef CONFIG_X86_64
> -		ideal_nops = k8_nops;
> -#else
> -		if (boot_cpu_has(X86_FEATURE_K8))
> -			ideal_nops = k8_nops;
> -		else if (boot_cpu_has(X86_FEATURE_K7))
> -			ideal_nops = k7_nops;
> -		else
> -			ideal_nops = intel_nops;
> -#endif
> -	}
> -}

After this FEATURE_NOPL is unused except for required-features for
x86_64. FEATURE_K8 is only used for PTI and FEATURE_K7 is unused.

AFAICT this negatively affects lots of 32bit (DONTCARE) and 32bit on
64bit CPUs (CARELESS) and early AMD (K8) which is from 2003 and almost
2 decades old by now (SHRUG).

Everything x86_64 since AMD K10 (2007) was using p6_nops.

And per FEATURE_NOPL being required for x86_64, all those CPUs can use
p6_nops. So stop caring about NOPs, simplify things and get on with life
:-)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ