🇰🇷 한글 설명
Linux 커널의 DAMON 구성 요소에서 kdamond_merge_regions() 함수가 무한 루프에 빠질 수 있는 취약점이 발견되었습니다. 특정 조건에서 병합 임계값이 정수 오버플로를 일으켜 루프 종료 조건을 우회하게 됩니다. 이 문제는 비정상적인 사용자 설정 환경에서 발생할 수 있습니다.
💡 쉬운 설명
컴퓨터가 데이터를 정리하는 과정에서 계산 오류로 인해 멈추지 않고 계속 반복 작업을 수행하는 버그입니다. 일반적인 상황에서는 거의 발생하지 않지만, 특수한 설정을 하면 시스템이 먹통이 될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
mm/damon/core: avoid infinite kdamond_merge_regions() 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. kdamond_merge_regions()
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 max_thres is larger than UINT_MAX / 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 max_thres
higher than UINT_MAX / 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.
📍 영향받는 시스템
Linux Kernel (DAMON 기능이 활성화된 버전)
⚔️ 공격 벡터
비정상적으로 많은 비연속적 영역과 매우 큰 집계 간격을 설정하여 정수 오버플로 유도
🛡️ 대응 방법
DAMON 관련 패치가 적용된 최신 Linux 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인합니다.