Cyber Posture

CVE-2024-57917

High

Published: 19 January 2025

Published
19 January 2025
Modified
03 November 2025
KEV Added
Patch
CVSS Score 7.8 CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
EPSS Score 0.0003 8.0th percentile
Risk Priority 16 60% EPSS · 20% KEV · 20% CVSS

Description

In the Linux kernel, the following vulnerability has been resolved: topology: Keep the cpumask unchanged when printing cpumap During fuzz testing, the following warning was discovered: different return values (15 and 11) from vsnprintf("%*pbl ", ...) test:keyward is WARNING in kvasprintf WARNING: CPU: 55 PID: 1168477 at lib/kasprintf.c:30 kvasprintf+0x121/0x130 Call Trace: kvasprintf+0x121/0x130 kasprintf+0xa6/0xe0 bitmap_print_to_buf+0x89/0x100 core_siblings_list_read+0x7e/0xb0 kernfs_file_read_iter+0x15b/0x270 new_sync_read+0x153/0x260 vfs_read+0x215/0x290 ksys_read+0xb9/0x160 do_syscall_64+0x56/0x100 entry_SYSCALL_64_after_hwframe+0x78/0xe2 The call trace shows that kvasprintf() reported this warning during the printing of core_siblings_list. kvasprintf() has several steps: (1) First, calculate the length of the resulting formatted string. (2) Allocate a buffer based on the returned length. (3) Then, perform the actual string formatting. (4) Check whether the lengths of the formatted strings returned in steps (1) and (2) are consistent. If the core_cpumask is modified between steps (1) and (3), the lengths obtained in these two steps may not match. Indeed our test includes cpu hotplugging, which should modify core_cpumask while printing. To fix this issue, cache the cpumask into a temporary variable before calling cpumap_print_{list, cpumask}_to_buf(), to keep it unchanged during the printing process.

Security Summary

CVE-2024-57917 is a vulnerability in the Linux kernel's topology subsystem, specifically affecting the handling of cpumasks during printing operations. The issue arises in the core_siblings_list_read function when using kvasprintf to format and print the core_cpumask via bitmap_print_to_buf and cpumap_print functions. During fuzz testing, a warning was triggered because the cpumask could be modified—such as by CPU hotplugging—between the initial length calculation in vsnprintf and the subsequent string formatting step, resulting in inconsistent return values and a failure in kvasprintf's consistency check.

A local attacker with low privileges (PR:L) can exploit this vulnerability with low complexity and no user interaction required (AV:L/AC:L/UI:N). Successful exploitation could lead to high impacts on confidentiality, integrity, and availability (C:H/I:H/A:H), as indicated by the CVSS v3.1 score of 7.8 in the unchanged security scope (S:U). The attack involves triggering a read on the core_siblings_list sysfs file concurrently with cpumask modifications, potentially causing memory handling issues in kvasprintf.

Mitigation is provided through kernel patches available in stable releases, as detailed in the referenced commits: 1c7818e2746e747838a3de1687e89eac7b947f08, 360596e7fe319a5db1b5fb34a3952862ae53c924, b02cf1d27e460ab2b3e1c8c9ce472d562cad2e8d, ca47e933a900492d89dcf5db18a99c28bd4a742d, and cbd399f78e23ad4492c174fc5e6b3676dba74a52. These patches cache the cpumask in a temporary variable before calling cpumap_print_list or cpumap_print_cpumask_to_buf, ensuring it remains unchanged during the entire printing process and preventing length inconsistencies. Security practitioners should update to a patched kernel version as soon as possible.

Details

CWE(s)
NVD-CWE-noinfo

Affected Products

linux
linux kernel
6.13 · 5.15 — 5.15.177 · 5.16 — 6.1.125 · 6.2 — 6.6.72

References