Return-path: Received: from mx2.suse.de ([195.135.220.15]) by Galois.linutronix.de with esmtps (TLS1.0:DHE_RSA_CAMELLIA_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1f9ZZw-0001UK-Hy for speck@linutronix.de; Fri, 20 Apr 2018 19:12:08 +0200 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 548CFAC4F for ; Fri, 20 Apr 2018 17:12:03 +0000 (UTC) Date: Fri, 20 Apr 2018 19:12:00 +0200 From: Borislav Petkov Subject: [MODERATED] Re: [patch 05/11] [PATCH v2 05/10] Linux Patch #5 Message-ID: <20180420171200.GM13977@pd.tnic> References: <20180420022613.135106180@localhost.localdomain> MIME-Version: 1.0 In-Reply-To: <20180420022613.135106180@localhost.localdomain> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable To: speck@linutronix.de List-ID: On Thu, Apr 19, 2018 at 10:25:45PM -0400, speck for konrad.wilk_at_oracle.com= wrote: > x86/sbb: Expose the /sys/../sbb and BUG_SBB >=20 > It does not do much except show the words 'Vulnerable' for recent x86 > cores. Intel cores prior to Haswell are known not to be vulnerable. >=20 > It assumes that older Cyrix, Centaur, etc. cores are immune. >=20 > Signed-off-by: Konrad Rzeszutek Wilk > --- > v1.3: Remove AMD > s/md/mdd/ > v1.4: s/mdd/sbb/ > --- ... > static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c) > { > u64 ia32_cap =3D 0; > =20 > if (x86_match_cpu(cpu_no_speculation)) > - return; > + goto check_ssb; Instead of jumping to that label three times, you can flip the logic and keep the flow still understandable :) (pasting the whole function here): static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c) { u64 ia32_cap =3D 0; if (!x86_match_cpu(cpu_no_ssb)) setup_force_cpu_bug(X86_BUG_CPU_SSB); if (x86_match_cpu(cpu_no_speculation)) return; setup_force_cpu_bug(X86_BUG_SPECTRE_V1); setup_force_cpu_bug(X86_BUG_SPECTRE_V2); if (x86_match_cpu(cpu_no_meltdown)) return; if (cpu_has(c, X86_FEATURE_ARCH_CAPABILITIES)) rdmsrl(MSR_IA32_ARCH_CAPABILITIES, ia32_cap); /* Rogue Data Cache Load? No! */ if (ia32_cap & ARCH_CAP_RDCL_NO) return; setup_force_cpu_bug(X86_BUG_CPU_MELTDOWN); }; --=20 Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imend=C3=B6rffer, Jane Smithard, Graham Norton, HR= B 21284 (AG N=C3=BCrnberg) --=20