CVE-2026-31521: module: Fix kernel panic when a symbol st_shndx is out of bounds
In the Linux kernel, the following vulnerability has been resolved:
module: Fix kernel panic when a symbol stshndx is out of bounds
The module loader doesn't check for bounds of the ELF section index in simplifysymbols():
for (i = 1; i < symsec->shsize / sizeof(ElfSym); i++) { const char name = info->strtab + sym[i].stname;
switch (sym[i].stshndx) { case SHNCOMMON:
[...]
default: / Divert to percpu allocation if a percpu var. / if (sym[i].stshndx == info->index.pcpu) secbase = (unsigned long)modpercpu(mod); else / HERE --> / secbase = info->sechdrs[sym[i].stshndx].shaddr; sym[i].stvalue += secbase; break; } }
A symbol with an out-of-bounds stshndx value, for example 0xffff (known as SHNXINDEX or SHNHIRESERVE), may cause a kernel panic:
BUG: unable to handle page fault for address: ... RIP: 0010:simplifysymbols+0x2b2/0x480 ... Kernel panic - not syncing: Fatal exception
This can happen when module ELF is legitimately using SHNXINDEX or when it is corrupted.
Add a bounds check in simplifysymbols() to validate that stshndx is within the valid range before using it.
This issue was discovered due to a bug in llvm-objcopy, see relevant discussion for details [1].
[1] https://lore.kernel.org/linux-modules/20251224005752.201911-1-ihor.solodrai@linux.dev/
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 6.6.134.1-2 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.1.176-1Fixed in 6.1.190-1Fixed in 6.12.107-1Fixed in 6.12.113-1Fixed in 7.2.12-1Fixed in 7.2.13-1 - Compensating control
Add a bounds check in the Linux kernel module loader's simplify_symbols() to validate that st_shndx is within the valid ELF section range before using it.
Event History
Frequently Asked Questions
What is the severity of CVE-2026-31521?
CVE-2026-31521 is classified as a moderate severity vulnerability affecting the Linux kernel.
How do I fix CVE-2026-31521?
To fix CVE-2026-31521, update your Linux kernel to the latest version where the vulnerability has been patched.
What systems are affected by CVE-2026-31521?
CVE-2026-31521 affects various versions of the Linux kernel across different distributions.
What are the potential impacts of CVE-2026-31521?
The potential impact of CVE-2026-31521 includes kernel panic and system crashes due to improper bounds checking.
Is CVE-2026-31521 exploitable remotely?
CVE-2026-31521 is considered not exploitably remotely, as it typically requires local access to trigger the kernel panic.