Skip to content
Vol. 1 · Ed. 2026
CyberGlossary
Entry № 1178

SMEP / SMAP

Reviewed byCybersecurity entrepreneur & security researcher

What is SMEP / SMAP?

SMEP / SMAPSMEP and SMAP are CPU features that prevent the kernel from executing or accessing user-space pages, blocking common local privilege-escalation techniques.


Supervisor Mode Execution Prevention (SMEP) and Supervisor Mode Access Prevention (SMAP) are x86-64 features Intel introduced in Ivy Bridge (SMEP, 2012) and Broadwell (SMAP, ~2014–2015); ARM provides the equivalents PXN (Privileged Execute Never) and PAN (Privileged Access Never). Both are enabled through control-register bits (CR4.SMEP, CR4.SMAP).

SMEP makes the CPU fault if the kernel fetches instructions from a user-mapped page, killing the classic ret2usr technique in which an attacker redirected a kernel control-flow bug into shellcode mapped in their own process. SMAP extends this to any kernel read or write of user memory, so an exploit cannot stash a fake structure in userland for the kernel to dereference. Legitimate kernel accessors (Linux copy_from_user/copy_to_user) briefly set EFLAGS.AC with the STAC instruction and clear it with CLAC to open a controlled window.

Attackers responded with ret2dir (Kemerlis et al., USENIX Security 2014), which abuses the kernel's physmap direct mapping to reach attacker-controlled bytes without a user pointer, and with pure data-only/ROP chains inside kernel memory. SMEP/SMAP therefore complement — but do not replace — KASLR, KPTI, kCFI, and Intel CET.

flowchart TD
  K[Kernel bug hijacks<br/>control flow / pointer] --> T{Target page is<br/>user-space?}
  T -- "execute it" --> S1{SMEP on?}
  S1 -- Yes --> F1["#PF fault → attack blocked"]
  S1 -- No --> E1[ret2usr shellcode runs]
  T -- "read/write it" --> S2{SMAP on?}
  S2 -- Yes --> W{STAC window open?}
  W -- No --> F2["#PF fault → attack blocked"]
  W -- Yes --> E2[Controlled copy_from_user]
  S2 -- No --> E3[Kernel derefs user data]
  F1 --> B[Attacker pivots:<br/>ret2dir / kernel ROP]
  F2 --> B

● Examples

  1. 01

    A kernel exploit triggering #PF when it jumps to a user-space shellcode page on a SMEP CPU.

  2. 02

    Linux copy_from_user using stac/clac to access user buffers under SMAP.

● Frequently asked questions

What is SMEP / SMAP?

SMEP and SMAP are CPU features that prevent the kernel from executing or accessing user-space pages, blocking common local privilege-escalation techniques. It belongs to the Application Security category of cybersecurity.

What does SMEP / SMAP mean?

SMEP and SMAP are CPU features that prevent the kernel from executing or accessing user-space pages, blocking common local privilege-escalation techniques.

How do you defend against SMEP / SMAP?

Defences for SMEP / SMAP typically combine technical controls and operational practices, as detailed in the full definition above.

What are other names for SMEP / SMAP?

Common alternative names include: SMEP, SMAP, PXN, PAN.

● Related terms