⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

disable_smap_temporarily

Function disable_smap_temporarily 

Source
pub fn disable_smap_temporarily()
Expand description

Temporarily disable SMAP to allow kernel access to user-space memory.

On x86_64 this executes STAC (Set AC Flag). On AArch64, clears PSTATE.PAN. On RISC-V, sets the SUM bit in sstatus.

The caller must call restore_smap after the user-memory access.

§Safety

This function is safe to call, but the window between disable_smap_temporarily and restore_smap permits kernel code to access user-mapped pages. Keep this window as short as possible.