Re: [PATCH v5 00/16] Attack vector controls (part 1)

Borislav Petkov
2025-04-18T21:34:00Z

On Fri, Apr 18, 2025 at 10:03:42PM +0200, Ingo Molnar wrote:
> /* Select the proper CPU mitigations before patching alternatives: */
> mitigation_select_spectre_v1();
> mitigation_select_spectre_v2();
> mitigation_select_retbleed();
> mitigation_select_spectre_v2_user();
> mitigation_select_ssb();
> mitigation_select_l1tf();
> mitigation_select_mds();
> mitigation_update_taa();
> mitigation_select_taa();
> mitigation_select_mmio();
> mitigation_select_rfds();
> mitigation_select_srbds();
> mitigation_select_l1d_flush();
> mitigation_select_srso();
> mitigation_select_gds();
> mitigation_select_bhi();

The bad side of that is that you have a whole set of letters
- "mitigation_select" - before the *actual* name which is the only thing one
is interested in. With the vectors, one is now interested in the operation too
- select, update or apply.

I'd make *which* mitigation is a lot more visible instead of that useless
amassing of letters - especially since all those functions are internal.

spectre_v1_select()
spectre_v2_select()
...

then

...
spectre_v1_update()
...
mmio_update()

and then

...
srso_apply()
l1tf_apply()
...

and so on. Short, sweet, not a lot of bla, that useless "mitigation"
regurgitating is gone and the code is readable again.

Thx.

--
Regards/Gruss,
Boris.