System Management Mode
Lua error in package.lua at line 80: module 'strict' not found.
System Management Mode (SMM, sometimes called ring -2[1][2]) is an operating mode of x86 central processor units (CPUs) in which all normal execution, including the operating system, is suspended and special separate software, which is usually part of the firmware or a hardware-assisted debugger, is executed with high privileges.
It was first released with the Intel 386SL.[3] While initially special SL versions were required for SMM, Intel incorporated SMM in its mainline 486 and Pentium processors in 1993. AMD copied Intel's SMM with the Enhanced Am486 processors in 1994. It is available in all later microprocessors in the x86 architecture.
Operation
SMM is a special-purpose operating mode provided for handling system-wide functions like power management, system hardware control, or proprietary OEM designed code. It is intended for use only by system firmware, not by applications software or general-purpose systems software. The main benefit of SMM is that it offers a distinct and easily isolated processor environment that operates transparently to the operating system or executive and software applications.
In order to achieve transparency, SMM imposes certain rules. The SMM can only be entered through SMI (System Management Interrupt). The processor executes the SMM code in a separate address space that has to be made inaccessible to other operating modes of the CPU by the firmware.[4]
Usage
Initially, System Management Mode was used for implementing Advanced Power Management (APM) features. However, over time, some BIOS manufacturers have relied on SMM for other functionality like making a USB keyboard work in real mode.[5]
Some uses of the System Management Mode are:
- Handle system events like memory or chipset errors
- Manage system safety functions, such as shutdown on high CPU temperature and turning the fans on and off
- Security functions, such as flash device lock down require SMM support on some chipsets
- Deeper sleep power management support on Intel systems
- Control power management operations, such as managing the voltage regulator modules
- Emulate motherboard hardware that is unimplemented or buggy
- Emulate a PS/2 mouse and/or keyboard by converting the messages from USB versions of those peripherals to the messages that would have been generated had PS/2 versions of such hardware been connected (often referred to as USB legacy support)[6]
- Centralize system configuration, such as on Toshiba and IBM notebook computers
- Emulate or forward calls to a Trusted Platform Module (TPM)[7]
System Management Mode can also be abused to run high-privileged rootkits, as demonstrated at Black Hat 2008[8] and 2015.[9]
Entering SMM
SMM is entered via the SMI (system management interrupt), which is caused by:
- Motherboard hardware or chipset signaling via a designated pin SMI# of the processor chip.[10] This signal can be an independent event.
- Software SMI triggered by the system software via an I/O access to a location considered special by the motherboard logic (port 0B2h is common).[11][12]
- An I/O write to a location which the firmware has requested that the processor chip act on.
Problems
By design, the operating system cannot override or disable the SMI. Due to this fact, it is a target for malicious rootkits to reside in,[13][14][15] including NSA's "implants"[16] which have individual code names for specific hardware, like SOUFFLETROUGH for Juniper Networks firewalls,[17] SCHOOLMONTANA for J-series routers of the same company,[18] DEITYBOUNCE for DELL,[19] or IRONCHEF for HP Proliant servers.[20]
Improperly designed and insufficiently tested SMM BIOS code can make the wrong assumptions and not work properly when interrupting some other modes like PAE or 64-bit long mode. According to the documentation of the Linux kernel, around 2004, such buggy implementations of the USB legacy support feature were a common cause of crashes, for example on motherboards based on the Intel E7505 chipset.[6]
Since the SMM code (SMI handler) is installed by the system firmware (BIOS), the OS and the SMM code may have expectations about hardware settings that are incompatible, such as different ideas of how the Advanced Programmable Interrupt Controller (APIC) should be set up.
Operations in SMM take CPU time away from the applications, operating system kernel and hypervisor, with the effects magnified for multicore processors since each SMI causes all cores to switch modes.[21] There is also some overhead involved with switching in and out of SMM, since the CPU state must be stored to memory (SMRAM) and any write-back caches must be flushed. This can destroy real-time behavior and cause clock ticks to get lost. The Windows and Linux kernels define an ‘SMI Timeout’ setting a period within which SMM handlers must return control to the operating system or it will ‘hang’ or ‘crash’.
The SMM may disrupt the behavior of real-time applications with constrained timing requirements.
A digital logic analyzer may be required to determine if the CPU has entered SMM (checking state of SMIACT# pin of CPU).[10] Recovering the SMI handler code to analyze it for bugs, vulnerabilities and secrets requires a logic analyzer or disassembly of the system firmware.
See also
- Coreboot – includes an open source SMM/SMI handler implementation, for some chipsets
- Intel 80486SL
- MediaGX – a processor which emulates nonexistent hardware via SMM
- Protection ring
- Unified Extensible Firmware Interface (UEFI)
References
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ 6.0 6.1 Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Google Tech Talks - Coreboot - 00:34:30
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ 10.0 10.1 Intel's System Management Mode by Robert R. Collins
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ US 5963738 - Computer system for reading/writing system configuration using I/O instruction
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Lua error in package.lua at line 80: module 'strict' not found.
- ↑ Brian Delgado and Karen L. Karavanic, "Performance Implications of System Management Mode," 2013 IEEE International Symposium on Workload Characterization, Sept. 22-24, Portland, OR USA.
Further reading
- AMD Hammer BIOS and Kernel Developer's guide, Chapter 6 (archived from the original on December 7, 2008)
- Intel 64 and IA-32 Architectures Developer's Manual, Volume 3C, Chapter 34