Instruction
CLRSSBSY
Clears the busy flag of a supervisor shadow-stack token in memory and zeroes the shadow-stack pointer; not with FRED.
- Extensions
- Forms
- 1 (1 Legacy)
- Data
- Intel XED v2026.08.23
CLRSSBSY releases a supervisor shadow stack: it clears the busy bit of the token at its memory operand and sets SSP to 0. It undoes SETSSBSY, and AMD’s Volume 2 places it on the way out of a system call, before SYSRET restores the user’s SSP from IA32_PL3_SSP. Once the bit is clear, the stack may be taken again, by this processor or another.
A bad token is no fault
In one locked step, CLRSSBSY reads the 8-byte token, which must hold its own address with the busy bit set, and writes it back with the bit clear. A token that does not match is written back as it was, and CLRSSBSY reports it in CF = 1 instead of raising #CP, as SETSSBSY would; CF = 0 means the stack was released. OF, SF, ZF, AF and PF are cleared either way. The manuals part on SSP after a bad token: Intel’s sets it to 0 regardless, AMD’s leaves it alone. The operand must be 8-byte aligned, or #GP(0).
Running with SSP at 0
Between CLRSSBSY and SYSRET the kernel runs without a shadow stack, and AMD’s manual warns that an interrupt or exception taken there must switch shadow stacks through its interrupt shadow stack table (ISST); one that pushed on the current stack would wrap SSP around from 0, which AMD expects to fault. With FRED enabled, CLRSSBSY raises #UD: FRED does not use busy tokens (Intel’s Volume 3).
The register form
CLRSSBSY is F3 0F AE /6 with a memory operand. With a register operand
the same bytes are UMONITOR, so on processors with
both, the ModRM byte alone tells a kernel instruction from a user one.
With -mshstk, GCC 14 compiles _clrssbsy(p) to clrssbsy QWORD PTR [rdi]; Clang 23’s Intel syntax prints dword ptr for the same 8-byte
operand.
Where it runs
Only at CPL 0, or #GP(0); #UD comes first when CR4.CET or supervisor shadow stacks are off. AMD’s Zen 5 guide lists CLRSSBSY among the shadow-stack instructions Zen 5 supports, as microcoded. The probe runs at CPL 3 in a KVM guest that reported no shadow stacks in CPUID (leaf 07H, ECX bit 7); both recorded cases raised #UD and left the token in memory unchanged.
Forms
| Instruction | Encoding | Requires |
|---|---|---|
CLRSSBSY m64
CLRSSBSY_MEMu64 | F3 0F AE /6 | CET |
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
if not cr4 >> 23 & 1: # CR4.CET; clear without CET
fault(UD)
if cr4 >> 32 & 1: # CR4.FRED
fault(UD)
if not s_cet & 1: # supervisor shadow stacks off
fault(UD)
if CPL > 0:
fault(GP, 0)
a = dest.address
if not canonical(a):
fault(GP, 0)
if a & 7:
fault(GP, 0)
t = ss_load(a, 64) # locked until the store below
ok = t == a | 1 # its own address, busy
ss_store(a, 64, a if ok else t) # busy bit cleared
cf = 0 if ok else 1 # a bad token: CF set, no fault
zf = pf = af = of = sf = 0
if ok:
ssp = 0 # no shadow stack in use
# Intel's manual sets SSP to 0 for a bad token too; AMD's leaves itRun on AMD Zen 5 (EPYC 9645): 2 cases. Its cases ran where CPUID reported no CET, and every one raised an exception.
Operands
| Operand | Kind | Action |
|---|---|---|
CLRSSBSY m64 | ||
m64 | explicit | read, write |
Flags
None: XED records no flag that the forms test or change.
Attributes
What else XED records about the forms. How to read.
- All forms
- privileged: CPL 0 only; not in real-address mode
Intrinsics
The C intrinsics of Clang 23.1.2 that compile to CLRSSBSY, each with the form it compiles to and the Clang options it needs. The forms come from compiling every intrinsic and decoding the result with Intel XED; all intrinsics A–Z explains the method.
| Intrinsic | Compiles to |
|---|---|
_clrssbsy
void _clrssbsy(void *__p) |
|
CPUID and processors
Each form belongs to an XED ISA set. A form can be used when the processor reports every CPUID bit of one of its ISA set's alternatives.
| ISA set | CPUID | Processors |
|---|---|---|
CET | CET | Tiger Lake, Alder Lake, Arrow Lake, Panther Lake, Nova Lake, Sapphire Rapids, Emerald Rapids, Granite Rapids, Diamond Rapids, Sierra Forest, Clearwater Forest, Zen 3, Zen 4, Zen 5, Zen 6 Note: Zen 3 to Zen 6 have the shadow stacks of CET but not its indirect branch tracking, so ENDBR32 and ENDBR64 run on them as hint NOPs. AMD's references for Zen 3, Zen 4 and Zen 5 (55898, 55901, 57238) set CPUID_Fn00000007_ECX_x00[CET_SS] (bit 7) and leave bit 20 of CPUID_Fn00000007_EDX_x00, which Intel gives to indirect branch tracking, reserved and clear. Note: Zen 6 is listed because Zen 5 has these instructions. GCC's -march sets, which give the other features of Zen 6, leave them out, and AMD has not yet published a Processor Programming Reference for Zen 6. |
More CET instructions
Sources
- Intel XED v2026.08.23 (commit
0bcb6237345c): forms, encodings, operands, flags, exception classes, attributes, ISA sets, CPUID bits and chip model. - The CPU data of x86-64.net: Zen 3 to Zen 6, from GCC’s
-marchfeature sets and AMD’s Processor Programming References, which the page of each processor cites. - Clang's x86 intrinsic headers, LLVM 23.1.2 (commit
85ac56026243): the intrinsics, their signatures and doc comments, and the Clang of that release, which compiled each of them. - Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2A, page 3-150 (CLRSSBSY)
- Linux kernel documentation: Control-flow Enforcement Technology (CET) Shadow Stack
- Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 1 (253665-093, September 2026)
- Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 3 (325384-093, September 2026)
- AMD64 Architecture Programmer's Manual, Volume 2: System Programming (24593, rev. 3.42, March 2024), Wayback Machine copy of AMD's PDF
- AMD64 Architecture Programmer's Manual, Volume 3: General-Purpose and System Instructions (24594, rev. 3.36, March 2024), Wayback Machine copy of AMD's PDF
- Software Optimization Guide for the AMD Zen5 Microarchitecture (58455, rev. 1.00, August 2024), Wayback Machine copy of AMD's ZIP
The tables are derived from Intel XED, Copyright Intel Corporation, licensed under the Apache License 2.0; x86-64.net converted and reformatted them. The intrinsics and their signatures come from Clang, part of the LLVM Project, licensed under the Apache License 2.0 with LLVM Exceptions. The text is our own.