Skip to contentSkip to conversation

CVE-2024-50270: mm/damon/core: avoid overflow in damon_feed_loop_next_input()

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Nov 19, 2024

lore
Share & tools
lore
#0 lore raw

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

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

mm/damon/core: avoid overflow in damon_feed_loop_next_input()

damon_feed_loop_next_input() is inefficient and fragile to overflows. Specifically, 'score_goal_diff_bp' calculation can overflow when 'score' is high. The calculation is actually unnecessary at all because 'goal' is a constant of value 10,000. Calculation of 'compensation' is again fragile to overflow. Final calculation of return value for under-achiving case is again fragile to overflow when the current score is under-achieving the target.

Add two corner cases handling at the beginning of the function to make the body easier to read, and rewrite the body of the function to avoid overflows and the unnecessary bp value calcuation.

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

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

	Issue introduced in 6.8 with commit 9294a037c015 and fixed in 6.11.8 with commit 2d339a1f0f16
	Issue introduced in 6.8 with commit 9294a037c015 and fixed in 6.12 with commit 4401e9d10ab0

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-50270

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:
mm/damon/core.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/2d339a1f0f16ff5dea58e612ff336f0be0d041e9
	https://git.kernel.org/stable/c/4401e9d10ab0281a520b9f8c220f30f60b5c248f