]> git.baikalelectronics.ru Git - kernel.git/commit
x86/cpu: Allow feature bit names from /proc/cpuinfo in clearcpuid=
authorBorislav Petkov <bp@suse.de>
Thu, 27 Jan 2022 11:56:21 +0000 (12:56 +0100)
committerBorislav Petkov <bp@suse.de>
Mon, 4 Apr 2022 08:16:52 +0000 (10:16 +0200)
commit30624513e60360a0cc00c8a386287c1e2eac1c6d
treecb6bfcfdbec0e67637e0cc00842c35637816051f
parent6d94017b7b59bab528be97be158d0d602982e3a6
x86/cpu: Allow feature bit names from /proc/cpuinfo in clearcpuid=

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:

  [   ... ] Clearing CPUID bits: de 13:24 smca (unknown: succory) bmi1 3dnow

  [ Fix CONFIG_X86_FEATURE_NAMES=n build error as reported by the 0day
    robot: https://lore.kernel.org/r/202203292206.ICsY2RKX-lkp@intel.com ]

Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20220127115626.14179-2-bp@alien8.de
Documentation/admin-guide/kernel-parameters.txt
arch/x86/include/asm/cpufeature.h
arch/x86/kernel/cpu/common.c