linux_mitigations.md

May 20, 2024 ยท View on GitHub

We list mitigations added in all Linux versions.

Version (and date)MitigationReferences
(optional patch)grsecurity/PaX1 2
Linux ? (2013)remove %n support in vsprintf()61 62
Linux 2.4.21-rc1Exec-Shield3
Linux 2.6.8Non-Executable Memory (NX) / DEP4
Linux 2.6.12kernel.randomize_va_space. Address Space Layout Randomization (ASLR).5
Linux 2.6.12 for i386 / Linux 2.6.23 for x86_64virtual syscalls (vsyscall) replaced by virtual Dynamic Shared Object (vDSO)72
Linux 2.6.23(ineffective until 2019) kernel.mmap_min_addr. NULL page mitigation. Ineffective and easily bypassable (CVE-2019-9213) until 2019.6 7 8
Linux 2.6.28kernel.kptr_restrict9 10 11
Linux 2.6.37kernel.dmesg_restrict12 13 14
Linux 3.0 + hardware needs support (>= Ivy Bridge architecture)Supervisor Mode Execution Prevention (SMEP) for x86 / x86_64 architectures.15 16 17 18
Linux 3.7 + hardware needs supportSupervisor Mode Access Prevention (SMAP) for x86 / x86_64 architectures.19 20
Linux 3.7 + hardware needs supportPXN (Privileged Execute-Never). Effectively SMEP (Supervisor Mode Execution Prevention) for ARM architectures.21 22 23
Linux 3.14 (supported, but not enabled by default until kernel 4.12)Kernel ASLR (KASLR)24 25
>= clang 3.7Control Flow Integrity (CFI)26
Linux 4.0 (optional kernel module)Linux Kernel Runtime Guard (LKRG). Loadable kernel module that performs runtime integrity checking.27
Linux 4.0pagemap: do not leak physical addresses to non-privileged userspace91
Linux 4.3 + hardware needs supportPAN (Privileged Access Never). Effectively SMAP (Supervisor Mode Access Prevention) for ARM architectures.28
Linux 4.4kmem accounting (SLAB_ACCOUNT) added to cred_jar cache93
Linux 4.8CONFIG_SLAB_FREELIST_RANDOM - freelist order randomized during initialization of a new slab (new set of pages for that region)83 85 93
Linux 4.11CONFIG_STATIC_USERMODEHELPER - prevents the overwrite of modprobe_path (read-only)79
Linux 4.11structleak plugin enforcing __user annotated struct zeroing92
Linux 4.13Compile-time and run-time protectino for finding overflows (CONFIG_FORTIFY_SOURCE)29
Linux 4.13Forced NULL-prefixed stack canary on 64-bit29
Linux 4.13randomized structure layout (manual mode only) (randstruct gcc plugin)29
Linux 4.13lower ELF_ET_DYN_BASE (32-bit only)29
Linux 4.13kill iovec exploitation trick86 87 88
Linux 4.14CONFIG_SLAB_FREELIST_HARDENED - encoded freelist next pointers84
Linux 4.14 (optional patch)Kernel Address Isolation to have Side-channels Efficiently Removed (KAISER)30 31
Linux 4.15Kernel Page Table Isolation (KPTI or PTI) (formerly KAISER)32 33 34 35
Linux 4.4.144Spectre v1 fix36 37 38
Linux ?hardened usercopy (CONFIG_HARDENED_USERCOPY)79 93
Linux 4.16usercopy hardened for info leaks (CONFIG_HARDENED_USERCOPY with useroffset and usersize)93
Linux 4.16special-purpose caches matching sizes of general-purpose caches not mergeable with them when kmem accounting (SLAB_ACCOUNT) used for these special-purpose caches. NOTE: From 5.9 and before 5.14, kmem accounted (SLAB_ACCOUNT) general purpose (kmalloc) caches again mergeable with other special-purpose caches.93 94
Linux 4.18allocation overflow detection helpers39 40
Linux 4.18Removing open-coded multiplication from memory allocation arguments41 40
Linux 5.1CR4 Pinning. Prevents modification of sensitive CR4 bits, preventing SMEP/SMAP bypass via native_write_cr4.42 43
Linux 5.3Heap auto initialization44 45
Linux 5.4PAC on arm64: return address signing46 47
Linux 5.4Lockdown module63 64 65
Linux 5.4Automatically mitigate X86_BUG_ITLB_MULTIHIT (iTLB Multihit)66 67 68
Linux 5.4Mitigate TSX Async Abort67 69 70 71
Linux ?kernel stack base offset randomization50 51
Linux 5.7SLAB free pointer moved to middle of object
Linux 5.9seccomp user_notif file descriptor injection52 53
Linux 5.9zero-initialize stack variables with Clang52 53
Linux 5.9common syscall entry/exit routines52 53
Linux 5.9SLAB kfree() hardening52 53
Linux 5.9new CAP_CHECKPOINT_RESTORE capability52 53
Linux 5.9debugfs boot-time visibility restriction52 53
Linux 5.9more seccomp architecture support52 53
Linux 5.9new tasklet API52 53
Linux 5.9x86 FSGSBASE implementation52 53
Linux 5.9filter x86 MSR writes52 53
Linux 5.9uninitialized_var() macro removed52 53
Linux 5.9function pointer cast removals52 53
Linux 5.9flexible array conversions52 53
Linux 5.9(regression) kmem accounted (SLAB_ACCOUNT) general purpose (kmalloc) caches mergeable (again) with other special-purpose caches.93 94
Linux ?Linux Kernel Runtime Guard (LKRG)54 55 73 74 75
Linux XXXvm.unprivileged_userfaultfd / userfaultfd() forbidden to unprivileged users81 82
Linux 5.11vm.unprivileged_userfaultfd / userfaultfd() restrict unprivileged users to handle faults in user space77 80
Linux 5.13randomize #kernel stack offset each syscall56 57
Linux 5.13/dev/kmem removed entirely58 59 60
Linux 5.14kmem accounted (SLAB_ACCOUNT) general purpose (kmalloc) caches not mergeable (again) with other special-purpose caches.93 94
Linux TDBFunction Granular KASLR (FGKASLR)48 49 76 78 89
Linux XXXSLAB_RANDOM (or slab_rand?)XXX
Linux XXXSLAB_HARDENEDXXX
Linux XXXCONFIG_SLAB_MERGE_DEFAULTXXX
Linux XXXCONFIG_SHUFFLE_PAGE_ALLOCATORXXX
Linux TDBRandomized slab caches for kmalloc()95
Ubuntu 24.04Unprivileged user namespace restrictions96 97