CVE-2024-26588: LoongArch: BPF: Prevent out-of-bounds memory access
In the Linux kernel, the following vulnerability has been resolved:
LoongArch: BPF: Prevent out-of-bounds memory access
The testtag test triggers an unhandled page fault:
# ./testtag [ 130.640218] CPU 0 Unable to handle kernel paging request at virtual address ffff80001b898004, era == 9000000003137f7c, ra == 9000000003139e70 [ 130.640501] Oops[#3]: [ 130.640553] CPU: 0 PID: 1326 Comm: testtag Tainted: G D O 6.7.0-rc4-loong-devel-gb62ab1a397cf #47 61985c1d94084daa2432f771daa45b56b10d8d2a [ 130.640764] Hardware name: QEMU QEMU Virtual Machine, BIOS unknown 2/2/2022 [ 130.640874] pc 9000000003137f7c ra 9000000003139e70 tp 9000000104cb4000 sp 9000000104cb7a40 [ 130.641001] a0 ffff80001b894000 a1 ffff80001b897ff8 a2 000000006ba210be a3 0000000000000000 [ 130.641128] a4 000000006ba210be a5 00000000000000f1 a6 00000000000000b3 a7 0000000000000000 [ 130.641256] t0 0000000000000000 t1 00000000000007f6 t2 0000000000000000 t3 9000000004091b70 [ 130.641387] t4 000000006ba210be t5 0000000000000004 t6 fffffffffffffff0 t7 90000000040913e0 [ 130.641512] t8 0000000000000005 u0 0000000000000dc0 s9 0000000000000009 s0 9000000104cb7ae0 [ 130.641641] s1 00000000000007f6 s2 0000000000000009 s3 0000000000000095 s4 0000000000000000 [ 130.641771] s5 ffff80001b894000 s6 ffff80001b897fb0 s7 9000000004090c50 s8 0000000000000000 [ 130.641900] ra: 9000000003139e70 buildbody+0x1fcc/0x4988 [ 130.642007] ERA: 9000000003137f7c buildbody+0xd8/0x4988 [ 130.642112] CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE) [ 130.642261] PRMD: 00000004 (PPLV0 +PIE -PWE) [ 130.642353] EUEN: 00000003 (+FPE +SXE -ASXE -BTE) [ 130.642458] ECFG: 00071c1c (LIE=2-4,10-12 VS=7) [ 130.642554] ESTAT: 00010000 [PIL] (IS= ECode=1 EsubCode=0) [ 130.642658] BADV: ffff80001b898004 [ 130.642719] PRID: 0014c010 (Loongson-64bit, Loongson-3A5000) [ 130.642815] Modules linked in: [last unloaded: bpftestmod(O)] [ 130.642924] Process testtag (pid: 1326, threadinfo=00000000f7f4015f, task=000000006499f9fd) [ 130.643062] Stack : 0000000000000000 9000000003380724 0000000000000000 0000000104cb7be8 [ 130.643213] 0000000000000000 25af8d9b6e600558 9000000106250ea0 9000000104cb7ae0 [ 130.643378] 0000000000000000 0000000000000000 9000000104cb7be8 90000000049f6000 [ 130.643538] 0000000000000090 9000000106250ea0 ffff80001b894000 ffff80001b894000 [ 130.643685] 00007ffffb917790 900000000313ca94 0000000000000000 0000000000000000 [ 130.643831] ffff80001b894000 0000000000000ff7 0000000000000000 9000000100468000 [ 130.643983] 0000000000000000 0000000000000000 0000000000000040 25af8d9b6e600558 [ 130.644131] 0000000000000bb7 ffff80001b894048 0000000000000000 0000000000000000 [ 130.644276] 9000000104cb7be8 90000000049f6000 0000000000000090 9000000104cb7bdc [ 130.644423] ffff80001b894000 0000000000000000 00007ffffb917790 90000000032acfb0 [ 130.644572] ... [ 130.644629] Call Trace: [ 130.644641] [<9000000003137f7c>] buildbody+0xd8/0x4988 [ 130.644785] [<900000000313ca94>] bpfintjitcompile+0x228/0x4ec [ 130.644891] [<90000000032acfb0>] bpfprogselectruntime+0x158/0x1b0 [ 130.645003] [<90000000032b3504>] bpfprogload+0x760/0xb44 [ 130.645089] [<90000000032b6744>] sysbpf+0xbb8/0x2588 [ 130.645175] [<90000000032b8388>] sysbpf+0x20/0x2c [ 130.645259] [<9000000003f6ab38>] dosyscall+0x7c/0x94 [ 130.645369] [<9000000003121c5c>] handlesyscall+0xbc/0x158 [ 130.645507] [ 130.645539] Code: 380839f6 380831f9 28412bae <24000ca6> 004081ad 0014cb50 004083e8 02bff34c 58008e91 [ 130.645729] [ 130.646418] ---[ end trace 0000000000000000 ]---
On my machine, which has CONFIGPAGESIZE16KB=y, the test failed at loading a BPF prog with 2039 instructions:
prog = (struct bpfprog )ffff80001b894000 insn = (struct bpfinsn )(prog->insnsi)fff ---truncated---
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 5.10.223-1Fixed in 5.10.234-1Fixed in 6.1.129-1Fixed in 6.1.133-1Fixed in 6.12.22-1 - Upgrade
Upgrade
Linux kernelto a version that resolves this vulnerability.Fixed in 6.7.0-rc4-loong-devel-gb62ab1a397cf - Compensating control
For the LoongArch BPF out-of-bounds memory access issue, avoid triggering the crashing test path shown by test_tag: bpf_int_jit_compile/build_body during BPF program load (e.g., do not load JIT-compiled BPF programs that follow the failing code path) until the kernel is fixed.
Event History
Frequently Asked Questions
What is the severity of CVE-2024-26588?
CVE-2024-26588 has been designated with a moderate severity due to its potential to cause out-of-bounds memory access in the Linux kernel.
How do I fix CVE-2024-26588?
To resolve CVE-2024-26588, upgrade to patched versions of the Linux kernel, specifically versions 5.10.223-1, 5.10.226-1, 6.1.119-1, 6.1.123-1, 6.12.11-1, or 6.12.12-1.
Which Linux kernel versions are affected by CVE-2024-26588?
CVE-2024-26588 affects Linux kernel versions between 6.1 and 6.6.14, and versions between 6.7 and 6.7.2.
What kind of attack can exploit CVE-2024-26588?
CVE-2024-26588 can be exploited to trigger unhandled page faults, potentially leading to system crashes or unauthorized data access.
Who is affected by CVE-2024-26588?
Users and organizations running vulnerable versions of the Linux kernel, particularly those utilizing the LoongArch architecture, are at risk due to CVE-2024-26588.