Re: [PATCH v2 1/6] x86/cpu: Allow feature bit names from /proc/cpuinfo in clearcpuid=

Kees Cook
2022-02-07T22:04:09Z

On Thu, Jan 27, 2022 at 12:56:21PM +0100, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
>
> Having to give the X86_FEATURE array indices in order to disable a
> feature bit for testing is not really user-friendly. So accept the
> feature bit names too.
>
> Some feature bits don't have names so there the array indices are still
> accepted, of course.
>
> Clearing CPUID flags is not something which should be done in production
> so taint the kernel too.
>
> An exemplary cmdline would then be something like:
>
> clearcpuid=de,440,smca,succory,bmi1,3dnow
>
> ("succory" is wrong on purpose). And it says:
>
> [ 0.000000] Clearing CPUID bits: de 13:24 smca bmi1 3dnow
>
> Signed-off-by: Borislav Petkov <bp@suse.de>

I like the taint flag addition!

Even though it reports what it does actually clear, do you think it
might be more "friendly" to yell about unknown stuff too? i.e.:

[ 0.000000] Clearing CPUID bits: unknown bit 'succory'
[ 0.000000] Clearing CPUID bits: de 13:24 smca bmi1 3dnow

Either way:

Reviewed-by: Kees Cook <keescook@chromium.org>

--
Kees Cook