CVE-2026-89796: mm/damon/core: avoid infinite kdamond_merge_regions() internal loop
In the Linux kernel, the following vulnerability has been resolved:
mm/damon/core: avoid infinite kdamondmergeregions() internal loop
Patch series "mm/damon: unurgent fixes for infinite loop, NULL de-ref and races", v1.1.
Sashiko found a few issues in DAMON that could cause infinite loop, NULL dereference and monitoring results degradation. The first two sounds scary but the infinite loop happens only under unreasonable user setup. The NULL dereference is only in a unit test. Monitoring results degradation is trivial since it is only best-effort, and those happens from only unlikely races. Still those are bugs that better to fix if possible. Fix those.
This patch (of 6):
Due to online parameter update like events, the number of DAMON regions could be higher than the user-set upper limit. kdamondmergeregions() repeats merge regions until the number meets the limit, while doubling the merge threshold up to the theoretical maximum threshold. It is tried only up to the theoretical maximum threshold because even the aggressive merging can fail from reducing the number of regions under the user-defined upper limit. For example, there could be many user-defined non-contiguous regions that cannot be merged.
The threshold based loop break condition is evaluated by comparing the threshold for the next merging try against the theoretical maximum threshold. If maxthres is larger than UINTMAX / 2, doubling the threshold could make it overflow, and bypass the loop break condition. In the case, if the number of regions cannot be reduced under the upper limit like explained above, the loop will run infinitely.
Prevent the case by doing the break condition check before doubling the threshold. Also, prevent the threshold exceeding the maximum threshold, as it could overflow and apply the wrong merge threshold.
This issue is unlikely to occur in real world, since having the maxthres higher than UINTMAX / 2 require unrealistically large aggregation intervals compared to the sampling interval. Also, it requires an unrealistically large number of uncontiguous regions setup. Nonetheless, the consequence is bad and the fix is simple.
The issue was discovered [1] by Sashiko.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
Linux kernelto a version that resolves this vulnerability.Fixed in v1.1 - Configuration
Apply the patch series mm/damon: unurgent fixes for infinite loop, NULL de-ref and races; specifically, in kdamond_merge_regions(), check the threshold-based loop break condition before doubling the merge threshold to avoid overflow and infinite looping.
Linux kernel mm/damon/core (kdamond_merge_regions) threshold doubling / loop break check order = Perform the break condition check before doubling the merge threshold to prevent overflow bypassing the loop break condition - Configuration
Apply the patch series mm/damon: unurgent fixes for infinite loop, NULL de-ref and races to correct the NULL dereference issue reported by Sashiko (noting it is only present in a unit test).
Linux kernel mm/damon NULL dereference handling = Fix NULL dereference causing infinite loop/monitoring issues (noting it is only in a unit test) - Compensating control
Since the described infinite loop/merge-threshold overflow requires unreasonable user setup (e.g., max_thres large enough to overflow, or unrealistically large aggregation intervals), constrain DAMON configuration (max_thres/aggregation interval) to safe operational ranges to avoid triggering the overflow/infinite-loop condition.
Event History
Frequently Asked Questions
Which deployments are most likely to encounter this issue?
The issue is described as occurring only under an unreasonable user setup. A relevant condition is having more DAMON regions than the user-configured upper limit, such as many non-contiguous user-defined regions.
What condition leads to the non-terminating behavior?
Online parameter updates or similar events can increase the number of DAMON regions beyond the configured upper limit. The merge logic keeps trying to reduce the region count, but aggressive merging may still be unable to reach that limit.
Does the related NULL dereference affect normal DAMON operation?
The provided information states that the NULL dereference occurs only in a unit test. It does not describe it as affecting normal runtime use.