CVE-2025-39767: LoongArch: Optimize module load time by optimizing PLT/GOT counting
In the Linux kernel, the following vulnerability has been resolved:
LoongArch: Optimize module load time by optimizing PLT/GOT counting
When enabling CONFIGKASAN, CONFIGPREEMPTVOLUNTARYBUILD and CONFIGPREEMPTVOLUNTARY at the same time, there will be soft deadlock, the relevant logs are as follows:
rcu: INFO: rcusched self-detected stall on CPU ... Call Trace: [<900000000024f9e4>] showstack+0x5c/0x180 [<90000000002482f4>] dumpstacklvl+0x94/0xbc [<9000000000224544>] rcudumpcpustacks+0x1fc/0x280 [<900000000037ac80>] rcuschedclockirq+0x720/0xf88 [<9000000000396c34>] updateprocesstimes+0xb4/0x150 [<90000000003b2474>] ticknohzhandler+0xf4/0x250 [<9000000000397e28>] hrtimerrunqueues+0x1d0/0x428 [<9000000000399b2c>] hrtimerinterrupt+0x214/0x538 [<9000000000253634>] constanttimerinterrupt+0x64/0x80 [<9000000000349938>] handleirqeventpercpu+0x78/0x1a0 [<9000000000349a78>] handleirqeventpercpu+0x18/0x88 [<9000000000354c00>] handlepercpuirq+0x90/0xf0 [<9000000000348c74>] handleirqdesc+0x94/0xb8 [<9000000001012b28>] handlecpuirq+0x68/0xa0 [<9000000001def8c0>] handleloongarchirq+0x30/0x48 [<9000000001def958>] dovint+0x80/0xd0 [<9000000000268a0c>] kasanmemtoshadow.part.0+0x2c/0x2a0 [<90000000006344f4>] asanload8+0x4c/0x120 [<900000000025c0d0>] modulefrobarchsections+0x5c8/0x6b8 [<90000000003895f0>] loadmodule+0x9e0/0x2958 [<900000000038b770>] dosysinitmodule+0x208/0x2d0 [<9000000001df0c34>] dosyscall+0x94/0x190 [<900000000024d6fc>] handlesyscall+0xbc/0x158
After analysis, this is because the slow speed of loading the amdgpu module leads to the long time occupation of the cpu and then the soft deadlock.
When loading a module, modulefrobarchsections() tries to figure out the number of PLTs/GOTs that will be needed to handle all the RELAs. It will call the countmaxentries() to find in an out-of-order date which counting algorithm has O(n^2) complexity.
To make it faster, we sort the relocation list by info and addend. That way, to check for a duplicate relocation, it just needs to compare with the previous entry. This reduces the complexity of the algorithm to O(n log n), as done in commit d4e0340919fb ("arm64/module: Optimize module load time by optimizing PLT counting"). This gives sinificant reduction in module load time for modules with large number of relocations.
After applying this patch, the soft deadlock problem has been solved, and the kernel starts normally without "Call Trace".
Using the default configuration to test some modules, the results are as follows:
Module Size iptables 36K fat 143K radeon 2.5MB amdgpu 16MB
Without this patch: Module Module load time (ms) Count(PLTs/GOTs) iptables 18 59/6 fat 0 162/14 radeon 54 1221/84 amdgpu 1411 4525/1098
With this patch: Module Module load time (ms) Count(PLTs/GOTs) iptables 18 59/6 fat 0 162/14 radeon 22 1221/84 amdgpu 45 4525/1098
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.107-1Fixed in 6.12.113-1Fixed in 7.2.12-1Fixed in 7.2.13-1 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.6.103 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.44 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.16.4
Event History
Frequently Asked Questions
What is the severity of CVE-2025-39767?
CVE-2025-39767 has a medium severity due to the potential for soft deadlock in certain kernel configurations.
How do I fix CVE-2025-39767?
To fix CVE-2025-39767, it is recommended to update the Linux kernel to a version that mitigates the vulnerability.
Which configurations are affected by CVE-2025-39767?
CVE-2025-39767 affects systems with CONFIG_KASAN, CONFIG_PREEMPT_VOLUNTARY_BUILD, and CONFIG_PREEMPT_VOLUNTARY enabled simultaneously.
What does CVE-2025-39767 impact in the Linux kernel?
CVE-2025-39767 impacts the module load time optimization feature in the Linux kernel, leading to possible deadlocks.
Is CVE-2025-39767 specific to a particular version of the Linux kernel?
CVE-2025-39767 is not limited to a specific version but arises from specific configuration combinations within the Linux kernel.