Skip to contentSkip to conversation

CVE-2024-58017: printk: Fix signed integer overflow when defining LOG_BUF_LEN_MAX

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Feb 27, 2025

lore
Share & tools
lore
#0 lore raw

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

printk: Fix signed integer overflow when defining LOG_BUF_LEN_MAX

Shifting 1 << 31 on a 32-bit int causes signed integer overflow, which leads to undefined behavior. To prevent this, cast 1 to u32 before performing the shift, ensuring well-defined behavior.

This change explicitly avoids any potential overflow by ensuring that the shift occurs on an unsigned 32-bit integer.

The Linux kernel CVE team has assigned CVE-2024-58017 to this issue.

Affected and fixed versions
===========================

	Fixed in 6.1.129 with commit 9a6d43844de2479a3ff8d674c3e2a16172e01598
	Fixed in 6.6.78 with commit 4acf6bab775dbd22a9a799030a808a7305e01d63
	Fixed in 6.12.14 with commit 404e5fd918a0b14abec06c7eca128f04c9b98e41
	Fixed in 6.13.3 with commit 4a2c4e7265b8eed83c25d86d702cea06493cab18
	Fixed in 6.14-rc1 with commit 3d6f83df8ff2d5de84b50377e4f0d45e25311c7a

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2024-58017

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
kernel/printk/printk.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/9a6d43844de2479a3ff8d674c3e2a16172e01598
	https://git.kernel.org/stable/c/4acf6bab775dbd22a9a799030a808a7305e01d63
	https://git.kernel.org/stable/c/404e5fd918a0b14abec06c7eca128f04c9b98e41
	https://git.kernel.org/stable/c/4a2c4e7265b8eed83c25d86d702cea06493cab18
	https://git.kernel.org/stable/c/3d6f83df8ff2d5de84b50377e4f0d45e25311c7a