System Management Mode
System Management Mode (SMM, sometimes called ring −2 in reference to protection rings)[1][2] is an operating mode of x86 central processor units (CPUs) in which all normal execution, including the operating system, is suspended. An alternate software system which usually resides in the computer's firmware, or a hardware-assisted debugger, is then 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 implemented Intel's SMM with the Am386 processors in 1991.[4] It is available in all later microprocessors in the x86 architecture.[citation needed]
In ARM architecture the Exception Level 3 (EL3) mode is also referred as Secure Monitor Mode or System Management Mode.[5]
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 (BIOS or UEFI), 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.[citation needed]
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 (SMRAM) that has to be made inaccessible to other operating modes of the CPU by the firmware.[6]
System Management Mode can address up to 4 GB memory as huge real mode. In x86-64 processors, SMM can address >4 GB memory as real address mode.[7]
Usage
Initially, System Management Mode was used for implementing power management and hardware control features like Advanced Power Management (APM). However, BIOS manufacturers and OEMs have relied on SMM for newer functionality like Advanced Configuration and Power Interface (ACPI).[8][9]
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
- System Management BIOS (SMBIOS)
- Advanced Configuration and Power Interface
- Control power management operations, such as managing the voltage regulator module and LPCIO (super I/O or embedded controller)
- Emulate USB mouse/keyboard as PS/2 mouse/keyboard (often referred to as USB legacy support)[10]
- Centralize system configuration, such as on Toshiba and IBM/Lenovo notebook computers
- Managing the Trusted Platform Module (TPM)[11]
- BIOS-specific hardware control programs, including USB hotswap and Thunderbolt hotswap in operating system runtime[12]
System Management Mode can also be abused to run high-privileged rootkits, as demonstrated at Black Hat 2008[13] and 2015.[14]
Entering SMM
SMM is entered via the SMI (system management interrupt), which is invoked by:
- Motherboard hardware or chipset signaling via a designated pin SMI# of the processor chip.[15] 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).[16]
- An I/O write to a location which the firmware has requested that the processor chip act on.
By entering SMM, the processor looks for the first instruction at the address SMBASE (SMBASE register content) + 8000h (by default 38000h), using registers CS = 3000h and EIP = 8000h. The CS register value (3000h) is due to the use of real-mode memory addresses by the processor when in SMM. In this case, the CS is internally appended with 0h on its rightmost end.
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,[17][18] including NSA's "implants",[19] which have individual code names for specific hardware, like SOUFFLETROUGH for Juniper Networks firewalls,[20] SCHOOLMONTANA for J-series routers of the same company,[21] DEITYBOUNCE for DELL,[22] or IRONCHEF for HP Proliant servers.[23]
Improperly designed and insufficiently tested SMM BIOS code can make the wrong assumptions and not work properly when interrupting some other x86 operating modes like PAE or 64-bit long mode.[24] 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.[10]
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.[25] 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 logic analyzer may be required to determine whether the CPU has entered SMM (checking state of SMIACT# pin of CPU).[15] 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
- LOADALL
- MediaGX – a processor which emulates nonexistent hardware via SMM
- Ring −3
- Unified Extensible Firmware Interface (UEFI)
- Basic Input/Output System (BIOS)
References
- ↑ Domas, Christopher (20 July 2015). "The Memory Sinkhole". Black Hat. https://www.blackhat.com/docs/us-15/materials/us-15-Domas-The-Memory-Sinkhole-Unleashing-An-x86-Design-Flaw-Allowing-Universal-Privilege-Escalation-wp.pdf. Retrieved 22 August 2015.
- ↑ "Introducing Ring -3 Rootkits". Invisible Things Lab, Black Hat USA. 29 July 2009. p. 4. https://www.blackhat.com/presentations/bh-usa-09/TERESHKIN/BHUSA09-Tereshkin-Ring3Rootkit-SLIDES.pdf. Retrieved 22 August 2015.
- ↑ "SMIs Are EEEEVIL (Part 1)". msdn.com. Microsoft. 17 July 2020. http://blogs.msdn.com/carmencr/archive/2005/08/31/458609.aspx.
- ↑ "AMD Am386SX/SXL/SXLV Datasheet". AMD. http://pdf.datasheetcatalog.com/datasheet/AdvancedMicroDevices/mXwtys.pdf.
- ↑ https://documentation-service.arm.com/static/5ed11e40ca06a95ce53f905c?token=[bare URL PDF]
- ↑ "Intel 64 and IA-32 Architectures Developer's Manual: Vol. 3B". Intel. http://www.intel.com/design/processor/manuals/253669.pdf.
- ↑ Intel 64 and IA-32 Software Development Manual, Vol. 3, System Management Mode.
- ↑ "SMIs Are EEEEVIL (Part 2)". msdn.com. Microsoft. http://blogs.msdn.com/b/carmencr/archive/2005/09/01/459194.aspx.
- ↑ "System Management Mode - OSDev Wiki". https://wiki.osdev.org/SMM.
- ↑ 10.0 10.1 Vojtech Pavlik (January 2004). "Linux kernel documentation: USB Legacy support". kernel.org. https://www.kernel.org/doc/Documentation/x86/usb-legacy-support.txt. Retrieved 2013-10-06.
- ↑ Google Tech Talks – Coreboot – 00:34:30.
- ↑ UEFI Platform Initialization Specification.
- ↑ Robert McMillan (10 May 2008). "Hackers find a new place to hide rootkits". InfoWorld. http://www.infoworld.com/d/security-central/hackers-find-new-place-hide-rootkits-252.
- ↑ Rob Williams (7 August 2015). "Researchers Discover Rootkit Exploit In Intel Processors That Dates Back To 1997". HotHardware.com. http://hothardware.com/news/researchers-discover-rootkit-exploit-in-intel-processors-that-dates-back-to-1997.
- ↑ 15.0 15.1 Intel's System Management Mode by Robert R. Collins
- ↑ "Computer system for reading/writing system configuration using I/O instruction" US patent 5963738.
- ↑ "SMM Rootkits: A New Breed of OS Independent Malware". ACM. September 2008. http://www.eecs.ucf.edu/~czou/research/SMM-Rootkits-Securecom08.pdf. Retrieved 2013-10-06.
- ↑ "Hackers Find a New Place to Hide Rootkits". PC World. 2008-05-09. http://www.pcworld.com/article/145703/article.html. Retrieved 2013-10-06.
- ↑
- 1 Source for Leaks Around the World! (2013-12-30). "NSA's ANT Division Catalog of Exploits for Nearly Every Major Software/Hardware/Firmware | LeakSource". Leaksource.wordpress.com. http://leaksource.wordpress.com/2013/12/30/nsas-ant-division-catalog-of-exploits-for-nearly-every-major-software-hardware-firmware/. Retrieved 2014-01-13.
- ↑ "Schneier on Security: SOUFFLETROUGH: NSA Exploit of the Day". Schneier.com. 2013-12-30. https://www.schneier.com/blog/archives/2014/01/souffletrough_n.html. Retrieved 2014-01-13.
- ↑ "Schneier on Security: SCHOOLMONTANA: NSA Exploit of the Day". Schneier.com. 2008-05-30. https://www.schneier.com/blog/archives/2014/01/schoolmontana_n.html. Retrieved 2014-01-16.
- ↑ "Schneier on Security". schneier.com. https://www.schneier.com/blog/archives/2014/08/reverse-enginee.html.
- ↑ "Schneier on Security: IRONCHEF: NSA Exploit of the Day". Schneier.com. 3 January 2014. https://www.schneier.com/blog/archives/2014/01/nsa_exploit_of_1.html. Retrieved 2014-01-13.
- ↑ http://images0.cnitblog.com/cnitblog_com/yuhensong/mode.JPG[bare URL image file]
- ↑ Brian Delgado and Karen L. Karavanic, "Performance Implications of System Management Mode", 2013 IEEE International Symposium on Workload Characterization, Sep. 22–24, Portland, OR USA.
Further reading
- James Kardach; Gregory Mathews & Cau Nguyen et al., "Transparent system interrupt", US patent 5175853, published 1992-12-29, issued 1992-12-29
- AMD Hammer BIOS and Kernel Developer's guide, Chapter 6 (archived from the original on 7 December 2008)
- Intel 64 and IA-32 Architectures Developer's Manual, Volume 3C, Chapter 34
Original source: https://en.wikipedia.org/wiki/System Management Mode.
Read more |