🇰🇷 한글 설명
Linux 커널의 DAMON 샘플 모듈인 mtier에서 target_value를 0으로 설정할 경우 0으로 나누기(division by zero) 오류가 발생합니다. 이로 인해 시스템 커널 패닉(Oops)이 발생하여 시스템 안정성이 저해될 수 있습니다.
💡 쉬운 설명
특정 설정값을 0으로 입력하면 컴퓨터의 두뇌 역할을 하는 커널이 계산을 못 하고 멈춰버리는 버그입니다. 사용자가 잘못된 값을 입력하면 시스템 전체가 갑자기 꺼지거나 오류가 날 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
samples/damon/mtier: error out for zero quota goal target values
Patch series "mm/damon: avoid division by zero from damos_quota_score()".
DAMON_SAMPLE_MTIER and DAMON_LRU_SORT allow the user to trigger division
by zero in damos_quota_score(). Avoid it by adding parameters validation
checks.
This patch (of 2):
damos_quota_score() can trigger division by zero if the target_value is
zero. DAMON_SAMPLE_MTIER lets users set the target_value via
node0_mem_{used,free}_bp parameters. It doesn't guard zero value case,
though. As a result, users can trigger division by zero. Fix the issue
by returning an error when the user tries to start DAMON with zero
node0_mem_{used,free}_bp parameter values.
DAMON_SAMPLE_MTIER is just a sample module, but the consequence is quite
bad. Also the zero node0_mem_free_bp parameter might look like a
reasonable setup to some users. Hence, the issue might really happen in
the real world.
One reliable way to reproduce the issue is like below:
# cd /sys/module/damon_sample_mtier/parameters
# echo 4096 > node0_start_addr
# echo 8192 > node0_end_addr
# echo 8192 > node1_start_addr
# echo 81920 > node1_end_addr
# echo 0 > node0_mem_free_bp
# echo Y > enabled
# dmesg -w
[...]
[18792.235916] Oops: divide error: 0000 [#1] SMP NOPTI
[...]
[18792.242787] RIP: 0010:damos_quota_score+0x6f/0x480
[...]
This issue was discovered [1] by Sashiko.
📍 영향받는 시스템
DAMON_SAMPLE_MTIER 및 DAMON_LRU_SORT 모듈을 사용하는 Linux 커널
⚔️ 공격 벡터
사용자가 sysfs 인터페이스를 통해 node0_mem_free_bp 또는 node0_mem_used_bp 파라미터에 0을 입력하여 유도
🛡️ 대응 방법
커널 패치를 적용하여 파라미터 값이 0인 경우 에러를 반환하도록 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전인지 배포판 보안 공지를 통해 확인