Re: [PATCH v3 20/35] x86/bugs: Define attack vectors

Borislav Petkov
2025-02-27T15:02:04Z

On Thu, Feb 27, 2025 at 02:36:37PM +0000, Kaplan, David wrote:

> My 2 cents is I think the negative option form is better. That's because
> I'd rather err on the side of safety if the user forgets something.
>
> For instance, in the case of 'mitigations=off;guest_host' there would be no
> guest->guest protection. Did the user really intend for that? Or did they
> simply forget to think about that attack vector? In this case, their error
> leaves the system potentially insecure.

Well, good question. It could be that or it could be that the admin only cares
about protecting the host from malicious VMs but not the VMs amongst each
other. Does this use case make sense?

Probably. Maybe.

So if the admin really wants to do that, then she'll have to say:

mitigations=off;guest_host,no_guest_guest

I guess that can be specified with this cmdline.

I guess if she would want to enable both guest_host and guest_guest, then the
cmdline should be

mitigations=auto;no_user_kernel,no_user_user

or the shorter version

mitigations=;no_user_kernel,no_user_user

Hmmm, something still feels weird... I still can't go "oh yeah, this is a good
form." ;-\

> But if we only support the opt-out form, like
> 'mitigations=auto;no_guest_host' and the user forgot about guest->guest, it
> would leave those protections enabled. Potentially reducing performance
> more than intended, but the system is more secure.

Still don't know for sure what the admin wanted: more perf or more security?
:-P

> Because the existing kernel defaults things to on (the auto setting) and
> requires action to disable mitigations, why not keep the same logic here and
> only support the opt-out form?
>
> Some specific use case examples might be:
> 'mitigations=auto;no_guest_guest,no_guest_host' -- Running trusted VMs
> 'mitigations=auto;no_user_kernel,no_user_user' -- Running untrusted VMs but trusted userspace (cloud provider setting)
> 'mitigations=auto;no_cross_thread' -- Using core scheduling

I guess those make sense if you write them this way.

With the opt-out-only strategy, enabling a single vector would require you to
specify all others as no_*.

mitigations=auto,no_user_kernel,no_guest_host,no_guest_guest,no_cross_thread

That'll give you user_user.

Yeah, I guess we can't have the cake and eat it too. :-\

Which reminds me: on boot we should printk which attack vector got enabled and
which got disabled.

And then have that same info in

/sys/devices/system/cpu/vulnerabilities/attack_vectors

or so.

So that we can verify what got configured.

> On the SMT piece, I think the proposal is:
> 'auto;<attack vectors>' -- Default SMT protections (enable cheap ones like STIBP, but never disable SMT)
> 'auto,nosmt;<attack vectors>' -- Full SMT protections, including disabling SMT if required

Well, that's the question: cross-thread or nosmt is yet another attack vector.
So if we define the format as I mentioned above, this should be

auto;<attack_vectors>,nosmt or "cross_thread".

Right?

--
Regards/Gruss,
Boris.