Skip to content

x86/cpu: Add facility to force-enable CPU caps and bugs

Brendan Jackman linux-doc lkml 4 versions – New

Get series with b4
b4 am [email protected] change-id 20241119-force-cpu-bug-94a08ab0239f

Versions newest first

  1. v3 Latest4 patches 0 repliesNew
  2. v2 posting 2/23 patches 9 repliesSuperseded
  3. v2 posting 1/23 patches 4 repliesApplied
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v11 patch5 repliesSuperseded

Changes in v3 from the cover letter

- Added pre-patch to cleanup some unnecessary macro usage.
- More cleanups to commentary & commit messages.
- Link to v2: https://lore.kernel.org/r/[email protected]

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4x86/cpu: Remove some macros about feature namesarch/x86/include/asm/cpufeature.h arch/x86/kernel/cpu/common.c+6 -110 replies
2/4x86/cpu: Create helper to parse clearcpuid paramarch/x86/kernel/cpu/common.c+53 -440 replies
3/4x86/cpu: Add setcpuid cmdline paramarch/x86/kernel/cpu/common.c+25 -90 replies
4/4x86/cpu: Enable modifying bug flags with {clear,set}cpuidarch/x86/include/asm/cpufeature.h arch/x86/kernel/cpu/common.c+13 -40 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/4] x86/cpu: Add facility to force-enable CPU caps and bugs

For testing, development, and experimentation, add the ability to force the kernel to behave as if the CPU has a bug, even if it doesn't, using a command-line param.

Also do this in general for CPU flags, since:

- The infrastructure is the same so there is almost no extra implementation complexity.

- While setting random CPU flags is certain to break the kernel in mysterious and horrifying ways, this is not dramatically worse than setting CPU bugs. Although CPU bug mitigations don't have any very obvious ways to break the system if run on the wrong hardware, it's still very much an unsupported configuration, even beyond the security concern implied breaking mitigation logic.

Since a taint and scary docs are necessary regardless, supporting arbitrary CPU flags doesn't add significant maintenance/support burden either.

---
Changes in v3:
- Added pre-patch to cleanup some unnecessary macro usage.
- More cleanups to commentary & commit messages.
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Switched from a bugs-only force_cpu_bug= to a more general setcpuid=.
- Made it taint the kernel.
- Made docs sound scarier.
- Spellchecked and avoided new usage of personal pronouns.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Brendan Jackman (4):
x86/cpu: Remove some macros about feature names x86/cpu: Create helper to parse clearcpuid param x86/cpu: Add setcpuid cmdline param
x86/cpu: Enable modifying bug flags with {clear,set}cpuid

 arch/x86/include/asm/cpufeature.h |   6 +-
 arch/x86/kernel/cpu/common.c      | 147 +++++++++++++++++++++++---------------
 2 files changed, 91 insertions(+), 62 deletions(-)

---
base-commit: 83f8eec51fc484fe20f8d20171f6d450080c04ea
change-id: 20241119-force-cpu-bug-94a08ab0239f

Best regards,

Signature · 1 line
Brendan Jackman <[email protected]>