[MODERATED] Re: [PATCH 3/4] V8 more sampling fun 3

Josh Poimboeuf <[email protected]> Thu, 16 Apr 2020 13:01:08 -0500
Newsgroups org.kernel.lore.historical-speck
Message-ID <20200416180108.bjbhdl24nrlbfans@treble>
On Thu, Apr 16, 2020 at 07:44:52PM +0200, speck for Borislav Petkov wrote:
>  static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c)
>  {
>  	u64 ia32_cap = x86_read_arch_cap_msr();
> @@ -1142,6 +1174,27 @@ static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c)
>  	     (ia32_cap & ARCH_CAP_TSX_CTRL_MSR)))
>  		setup_force_cpu_bug(X86_BUG_TAA);
>  
> +	/*
> +	 * Some parts on the list don't have RDRAND or RDSEED. Make sure
> +	 * they show as "Not affected".
> +	 */
> +	if (cpu_has(c, X86_FEATURE_RDRAND) || cpu_has(c, X86_FEATURE_RDSEED)) {
> +		if (!cpu_matches(cpu_vuln_blacklist, SRBDS))
> +			goto srbds_not_affected;
> +
> +		/*
> +		 * Parts in the blacklist that enumerate MDS_NO are only
> +		 * vulnerable if TSX can be used.  To handle cases where TSX
> +		 * gets fused off check to see if TSX is fused off and thus not
> +		 * affected.
> +		 */
> +		if ((ia32_cap & ARCH_CAP_MDS_NO) && tsx_fused_off(c, ia32_cap))
> +			goto srbds_not_affected;
> +
> +		setup_force_cpu_bug(X86_BUG_SRBDS);
> +	}
> +
> +srbds_not_affected:

I still strongly dislike this and would much prefer my more compact
non-goto version.

Otherwise everything looks good :-)

-- 
Josh