Re: [PATCH 2/2] x86/bugs: Clean-up verw mitigations
From: Daniel Sneddon
Date: Tue Oct 29 2024 - 10:40:39 EST
On 10/29/24 04:37, Borislav Petkov wrote:
> On Mon, Oct 28, 2024 at 04:50:35PM -0700, Daniel Sneddon wrote:
>> @@ -599,20 +503,70 @@ static void __init verw_mitigations_check(void)
>> }
>> }
>>
>> -static void __init md_clear_select_mitigation(void)
>> +static bool __init verw_mitigations_disabled(void)
>> {
>> verw_mitigations_check();
>> + /*
>> + * TODO: Create a single mitigation variable that will allow for setting
>
> A patch which introduces a TODO is basically telling me, it is not ready to go
> anywhere yet...
>
>> + * the location of the mitigation, i.e.:
>> + *
>> + * kernel->user
>> + * kvm->guest
>> + * kvm->guest if device passthrough
>> + * kernel->idle
>> + */
>> + return (mds_mitigation == MDS_MITIGATION_OFF &&
>> + taa_mitigation == TAA_MITIGATION_OFF &&
>> + mmio_mitigation == MMIO_MITIGATION_OFF &&
>> + rfds_mitigation == RFDS_MITIGATION_OFF);
>
> This should be used inside verw_mitigations_check() instead of repeated here,
> no?
>
> Also, pls call verw_mitigations_check() "check_verw_mitigations" - the name
> should start with a verb.
>
> Actually, you can merge verw_mitigations_check() and
> verw_mitigations_disabled(). Please do a *minimal* patch when cleaning this up
> - bugs.c is horrible. It should not get worse.
>
I'll merge those two.
> What could also help is splitting this patch - it is hard to review as it
> is...
>
Sure, I'll split this up as much as possible.
> Thx.
>