]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
feat: enable SMAP (Supervisor Mode Access Prevention)
authorTulio A M Mendes <[email protected]>
Sun, 15 Feb 2026 00:41:33 +0000 (21:41 -0300)
committerTulio A M Mendes <[email protected]>
Sun, 15 Feb 2026 00:41:33 +0000 (21:41 -0300)
commitc728212cbf93a53a1c680badf210fd81e7997791
treeaab7fb7b0f9ef0469fa3b7cd21394f6c4fdd983c
parent2c261198ce6f87448bf8328fcfe7532d913825b8
feat: enable SMAP (Supervisor Mode Access Prevention)

- STAC/CLAC bracket user memory accesses in copy_from_user/copy_to_user
- CR4.SMAP enabled when CPU supports it (CPUID leaf 7, EBX bit 20)
- g_smap_enabled runtime flag guards STAC/CLAC to avoid #UD on older CPUs
- Encoded as raw bytes (.byte 0x0F,0x01,0xCB/CA) for assembler compat
- 35/35 smoke tests pass, cppcheck clean
src/arch/x86/uaccess.c
src/hal/x86/cpu_features.c