On Tue, Mar 11, 2025 at 01:03:40PM +0100, Borislav Petkov wrote: > On Mon, Mar 03, 2025 at 03:05:56PM +0000, Patrick Bellasi wrote: > > That's why we are also going to detect this cases and set > > SRSO_MITIGATION_BP_SPEC_REDUCE_NA, so that we get a: > > > > "Vulnerable: Reduced Speculation, not available" > > > > from vulnerabilities/spec_rstack_overflow, which should be the only place users > > look for to assess the effective mitigation posture, ins't it? > > If they even look. The strategy so far has been that the kernel should simply > DTRT (it being the default) if the user doesn't know anything about > mitigations etc. > > So I have another idea: how about we upstream enough ASI bits - i.e., the > function which checks whether ASI is enabled - and use that in the mitigation > selection? > > IOW: > case SRSO_CMD_BP_SPEC_REDUCE: > if ((boot_cpu_has(X86_FEATURE_SRSO_BP_SPEC_REDUCE)) { > select it > } else { > if (ASI enabled) > do not fall back to IBPB; > else > fallback to IBPB; > } > > "ASI enabled" will return false upstream - at least initially only, until ASI > is out-of-tree - and then it'll fall back. > > On your kernels, it'll return true and there it won't fall back. > > We just need to sync with Brendan what "ASI enabled" would be and then it > should work and your backports would be easy in that respect. > > Until ASI is not upstream, that is. > > Hmmmm? This seems like a good idea to me, assuming we want ASI in the code eventually it seems worthwhile to make visible the places where we know we'll want to update the code when we get it in. In RFCv2 this would be static_asi_enabled() [1] - I think in the current implementation it would be fine to use it directly, but in general we do need to be aware of initializion order. [0] (first half of) https://lore.kernel.org/all/DS0PR12MB9273553AE4096FCCBBB4000E94D62@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/ [1] https://lore.kernel.org/linux-mm/20250110-asi-rfc-v2-v2-4-8419288bc805@xxxxxxxxxx/ Of course I'm biased here, from my perspective having such mentions of ASI in the code is unambiguously useful. But if others perceived it as useless noise I would understand!