Skip to main content

CVE-2024-35917: Vulnerability in Linux Linux

Medium
VulnerabilityCVE-2024-35917cvecve-2024-35917
Published: Sun May 19 2024 (05/19/2024, 08:35:09 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: s390/bpf: Fix bpf_plt pointer arithmetic Kui-Feng Lee reported a crash on s390x triggered by the dummy_st_ops/dummy_init_ptr_arg test [1]: [<0000000000000002>] 0x2 [<00000000009d5cde>] bpf_struct_ops_test_run+0x156/0x250 [<000000000033145a>] __sys_bpf+0xa1a/0xd00 [<00000000003319dc>] __s390x_sys_bpf+0x44/0x50 [<0000000000c4382c>] __do_syscall+0x244/0x300 [<0000000000c59a40>] system_call+0x70/0x98 This is caused by GCC moving memcpy() after assignments in bpf_jit_plt(), resulting in NULL pointers being written instead of the return and the target addresses. Looking at the GCC internals, the reordering is allowed because the alias analysis thinks that the memcpy() destination and the assignments' left-hand-sides are based on different objects: new_plt and bpf_plt_ret/bpf_plt_target respectively, and therefore they cannot alias. This is in turn due to a violation of the C standard: When two pointers are subtracted, both shall point to elements of the same array object, or one past the last element of the array object ... From the C's perspective, bpf_plt_ret and bpf_plt are distinct objects and cannot be subtracted. In the practical terms, doing so confuses the GCC's alias analysis. The code was written this way in order to let the C side know a few offsets defined in the assembly. While nice, this is by no means necessary. Fix the noncompliance by hardcoding these offsets. [1] https://lore.kernel.org/bpf/c9923c1d-971d-4022-8dc8-1364e929d34c@gmail.com/

AI-Powered Analysis

AILast updated: 06/29/2025, 08:10:53 UTC

Technical Analysis

CVE-2024-35917 is a vulnerability identified in the Linux kernel specifically affecting the s390 architecture (IBM Z mainframe systems). The issue arises from a subtle bug in the Berkeley Packet Filter (BPF) implementation related to pointer arithmetic in the bpf_plt (procedure linkage table) code. The root cause is a violation of the C standard in the way pointers are subtracted, which misleads the GCC compiler's alias analysis. This results in the compiler reordering instructions such that memcpy() is moved after certain pointer assignments, causing NULL pointers to be written instead of valid return and target addresses. The practical effect is a crash triggered by the dummy_st_ops/dummy_init_ptr_arg test on s390x systems. The vulnerability is due to the compiler assuming that pointers point to different objects and thus allowing reordering, but the code's pointer arithmetic violates the C standard's requirement that pointers involved in subtraction must belong to the same array object. The fix involves hardcoding offsets rather than relying on pointer arithmetic that violates the standard, thereby preventing the compiler from misoptimizing the code. This vulnerability is specific to the s390 architecture and the BPF subsystem, which is used for packet filtering and tracing within the kernel. There are no known exploits in the wild at the time of publication, and no CVSS score has been assigned yet. The vulnerability was responsibly disclosed and fixed promptly in the Linux kernel source.

Potential Impact

For European organizations running Linux on s390 architecture systems—primarily large enterprises, financial institutions, and government agencies using IBM Z mainframes—this vulnerability could cause system crashes or instability when executing BPF-related operations. While it does not directly lead to privilege escalation or code execution, the resulting kernel crashes could cause denial of service conditions, impacting availability of critical services. Given that s390 systems are often used in high-availability environments for transaction processing, any downtime could have significant operational and financial consequences. However, the impact is limited to organizations using this specific architecture and kernel feature. Most European organizations running Linux on x86 or ARM architectures are not affected. The lack of known exploits reduces immediate risk, but unpatched systems remain vulnerable to potential future exploitation or accidental crashes triggered by malformed BPF programs or tests.

Mitigation Recommendations

European organizations using Linux on s390 systems should promptly apply the official Linux kernel patches that fix CVE-2024-35917. Since the vulnerability stems from compiler optimizations and pointer arithmetic, updating to the fixed kernel version is the most effective mitigation. Additionally, organizations should audit their use of BPF programs on s390 systems and restrict untrusted or unnecessary BPF code execution to reduce risk. Implementing kernel live patching where supported can minimize downtime during patch deployment. Monitoring system logs for unusual BPF-related crashes can help detect attempts to trigger this vulnerability. For environments where patching is delayed, consider disabling or limiting BPF functionality on s390 systems if feasible, though this may impact functionality. Finally, ensure that development and build environments use updated compilers that do not reorder instructions incorrectly in similar contexts.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-05-17T13:50:33.123Z
Cisa Enriched
true
Cvss Version
null
State
PUBLISHED

Threat ID: 682d9828c4522896dcbe2186

Added to database: 5/21/2025, 9:08:56 AM

Last enriched: 6/29/2025, 8:10:53 AM

Last updated: 7/28/2025, 10:21:28 PM

Views: 8

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats