security(kernel): enable hardening config defaults#16714
security(kernel): enable hardening config defaults#16714rlmenge wants to merge 5 commits intotomls/base/mainfrom
Conversation
Enable LIST_HARDENED and BUG_ON_DATA_CORRUPTION on both x86_64 and aarch64, which pulls in DEBUG_LIST, DEBUG_PLIST, DEBUG_SG, and DEBUG_NOTIFIERS. Kernel panics on detected list-head/scatterlist/ notifier/credential corruption; KSPP recommended.
Set CONFIG_SLAB_MERGE_DEFAULT=n on x86_64 and aarch64 so distinct allocation sites get distinct slab caches. Makes heap-spray attacks harder by eliminating cross-site cache aliasing. Small memory overhead (~few MB). Runtime-overridable via the slab_merge= boot parameter if a regression is observed. KSPP recommended.
Enable CONFIG_X86_KERNEL_IBT to turn on Indirect Branch Tracking via Intel CET, blocking indirect-branch-based ROP/JOP gadgets at the hardware level. No cost on modern CPUs (Tiger Lake+/Zen3+); gracefully disabled on older CPUs. Switch from LEGACY_VSYSCALL_XONLY to LEGACY_VSYSCALL_NONE to remove the legacy vsyscall page entirely. Userspace has used the vDSO for years; the vsyscall=emulate boot parameter remains available as an escape hatch for very old containers.
x86_64:
- Raise CONFIG_LSM_MMAP_MIN_ADDR from 0 to 65536 so LSMs enforce
the same mmap floor as vm.mmap_min_addr, blocking NULL-deref
kernel-exploit primitives.
aarch64:
- Enable CONFIG_ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT so unassigned
devices cannot DMA through the SMMU without an explicit mapping.
Rebuild kernel RPMs to pick up the hardening config changes (data-structure corruption detection, slab de-merge, x86 CET/IBT, LEGACY_VSYSCALL_NONE, LSM mmap floor, SMMU default-deny).
08d9550 to
bdfb314
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the Azure Linux kernel component to enable several KSPP-recommended hardening defaults by adjusting the shipped per-arch kernel .config files and bumping the kernel package release to produce a new build.
Changes:
- Bump
azl_pkgreleasefor thekernelcomponent to publish a new kernel release. - Enable multiple hardening-related kernel config options on x86_64 (IBT, vsyscall removal, slab de-merging, list/debug corruption checks, mmap floor).
- Enable multiple hardening-related kernel config options on aarch64 (slab de-merging, list/debug corruption checks, SMMU bypass disable).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| base/comps/kernel/kernel.comp.toml | Bumps kernel package release macro used by the spec. |
| base/comps/kernel/6.18-x86_64-azl.config | Enables x86_64 hardening options (IBT, vsyscall none, mmap floor, corruption/debug checks, slab de-merging). |
| base/comps/kernel/6.18-aarch64-azl.config | Enables aarch64 hardening options (SMMU bypass disable, corruption/debug checks, slab de-merging). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| CONFIG_LIST_HARDENED=y | ||
| CONFIG_BUG_ON_DATA_CORRUPTION=y |
There was a problem hiding this comment.
PR description calls out setting an LSM mmap floor (CONFIG_LSM_MMAP_MIN_ADDR=65536), but the aarch64 config still leaves CONFIG_LSM_MMAP_MIN_ADDR=0 (see file contents around line ~13413). If the hardening is intended for all arches, this should be updated in the aarch64 config as well; if it’s intentionally x86_64-only, please clarify that in the PR description/commit message.
There was a problem hiding this comment.
This is a good callout. 3.0 uses CONFIG_LSM_MMAP_MIN_ADDR=4096 for arm64
| # CONFIG_DEBUG_SG is not set | ||
| # CONFIG_DEBUG_NOTIFIERS is not set | ||
| CONFIG_DEBUG_LIST=y | ||
| CONFIG_DEBUG_PLIST=y |
There was a problem hiding this comment.
issue: commit message indicates DEBUG_LIST, DEBUG_PLIST, DEBUG_SG, DEBUG_NOTIFIERS are enabled due to LIST_HARDENED and BUG_ON_DATA_CORRUPTION, but that doesn't look accurate from looking at the Kconfig selectors upstream:
security(kernel): enable kernel data-structure corruption detection
Enable LIST_HARDENED and BUG_ON_DATA_CORRUPTION on both x86_64 and
aarch64, which pulls in DEBUG_LIST, DEBUG_PLIST, DEBUG_SG, and
DEBUG_NOTIFIERS. Kernel panics on detected list-head/scatterlist/
notifier/credential corruption; KSPP recommended.
Can you clarify how these 4 DEBUG_* are being force-enabled? Do they help with enabling these other hardening configurations?
Note: I also do worry about performance penalty with the DEBUG options. But we should iterate on this with perf data to understand how much we're trading off for what we gain.
There was a problem hiding this comment.
Ack. We for sure want LIST_HARDENED as that has been beneficial in the past. I will confirm whether the DEBUG_* are also needed. I did check prior to this PR and they are enabled in our 3.0 offering except for DEBUG_PLIST.
Summary
Layer five surgical kernel hardening changes from KSPP (via https://github.com/a13xp0p0v/kernel-hardening-checker/)
Change Log
Associated issues
Test Methodology
Task ID: 1504330