MCE-INJECT(8)
π MCE-INJECT π
okay bestie, so the manual name is mce-inject, it lives in section 8 of Linux's Administrator's Manual, and it is genuinely one of the most niche little gremlins in the whole toolbox. sit down, hydrate, let's go π«Ά
β¨ NAME β¨
mce-inject β inject machine checks into x86 kernel for testing π
πΈ SYNOPSIS πΈ
mce-inject mce-file1 ...
mce-inject < mce-file
π¦ DESCRIPTION π¦
so mce-inject lets you inject machine checks into a running x86 Linux kernel. and what even is a machine check? it's an internal CPU error, bestie β the CPU basically raising its hand like "something went wrong in here π". this tool exists to test the machine check handling code. that's the whole job. testing.
here's the tea though: the injection only happens on the software level, and it does not simulate full machine check handling on the platform level. so don't come for it expecting the whole hardware drama, it's not giving that.
the machine checks you're injecting are described in an input language that's similar to the format the kernel outputs on a panic message (with a few extension). and generally? you should be able to just pipe in a panic message to inject that mce. iconic, honestly. π
for the details on fields, go read the IA32 SDM Vol3a chapter 14 β they correspond to the machine check MSRs of the standard IA32 Machine check architecture described there. iykyk π
π INPUT LANGUAGE π
these generally represent the similarly CPU MSRs, with some metadata on where to inject the exception. please see the IA software developers Manual for more details. no cap.
- the machine check always starts with
MCEorCPUnumber|broadcast[bank-number]β Machine check is injected on CPU xx or broadcasted to all CPUs BANKbank-numberβ Machine check bank to inject on.STATUS{number|fatal|corrected|uncorrected|pcc|uc|val|en|over|ar|ucna|srao|srar|s}β The symbols generally represent hardware register bits, as documented in the Intel software developer's manual. When multiple are listed they are ored together.MCGSTATUS{number|mcip|ripv|eipv}β The symbols generally represent hardware register bits, as documented in the Intel software developer's manual. When multiple are listed they are ored together.ADDRnumberRIPnumber/RIPnumber:<number>{string}/RIPnumber:numberMISCnumberCPUnumber : machine check exception : number BANK number : numberβ parsed for compatibility with kernel output. Use explicit statementsTSCnumberβ TSC state injected in machine checkNOBROADCASTβ Don't broadcast exceptions to all CPUs. Default is to broadcast UCIRQBROADCASTβ Broadcast IRQ to all CPUs that not getting error injection.NMIBROADCASTβ Broadcast NMI to all CPUs that not getting error injection.IN_IRQβ MCE should be injected in interrupt contextIN_PROCβ MCE injected in process context.HOLDβ Don't inject MCE immediately but hold it for later injection. This is useful for testing injection on multiple CPUs in parallelSOCKETIDnumberβ Socketid. Ignored by kernel on injection.MCGCAPnumberβ Machine check capabilities register value. Currently ignored by kernel on injection.POLLβ Inject in machine check poller code.EXCPβ Inject as machine check exception.APICIDnumberβ APIC ID of CPU. Ignored by kernel on injection.
a list of symbols ors the symbols together. β¨
multiple fields can be on a line. number can be hex/octal/decimal in the usual C format. multiple machine checks can be in a single file, each new one starts with "CPU" or "MCE". for all missing fields reasonable default values are filled in (hopefully). comments start with # until the end of the line. the keywords are case-insensitive. π
π₯ REQUIREMENTS π₯
mce-injectneeds to run as root. no exceptions, bestie, it's giving privilege./dev/mceloghas to exist.- the kernel needs to have machine check injection (
CONFIG_X86_MCE_INJECT) enabled, and if modular, themce-injectmodule loaded. - this option is available in Linux 2.6.31 or later.
π NOTES π
the mce-test package has a lot of input file examples. go raid it. π
π SEE ALSO π
- Intel 64 and IA32 Architectures Software Developer's manual, Volume 3, System programming guide Parts 1 and 2. Machine checks are described in Chapter 14 in Part1 and in Appendix E in Part2.
- Datasheet of your CPU.
fr fr though, read the SDM chapter before you start poking at MSRs. it's giving "main character energy" but make it informed. π
and that's the whole page, bestie!! π₯³ this absolute banger of a manual was brought to you by Intel OTC, dated May 2009 β yes, 2009, ancient, historic, a relic, and yet here we are still reading it in the group chat. periodt. ππ
π¦ where this page comes from
- epel 10: mce-inject 0^20241112git-1.el10_1 Β· GPL-2.0-only
- epel 9: mce-inject 0^20241112git-1.el9 Β· GPL-2.0-only
- fedora 43: mce-inject 0^20241112git-2.fc43 Β· GPL-2.0-only
- fedora 44: mce-inject 0^20241112git-3.fc44 Β· GPL-2.0-only
- nixos 26.05: mce-inject 4cbe46321b4a81365ff3aafafe63967264dbfec5
- nixos 26.05: mceinject 0-unstable-2013-01-19
- nixpkgs unstable: mce-inject 4cbe46321b4a81365ff3aafafe63967264dbfec5
- nixpkgs unstable: mceinject 0-unstable-2013-01-19
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms