🇰🇷 한글 설명
Linux 커널의 mm/damon/sysfs 구성 요소에서 state_show() 함수가 damon_sysfs_lock을 획득하지 않고 kdamond->damon_ctx를 읽어 발생하는 Use-After-Free 취약점입니다. 이로 인해 레이스 컨디션이 발생하여 이미 해제된 메모리 영역에 접근할 수 있습니다.
💡 쉬운 설명
데이터를 읽는 도중에 다른 작업이 해당 데이터를 삭제해버려, 이미 사라진 정보를 다시 사용하려고 시도할 때 발생하는 오류입니다. 이 과정에서 시스템이 충돌하거나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
mm/damon/sysfs: fix use-after-free in state_show()
state_show() reads kdamond->damon_ctx without holding damon_sysfs_lock.
This allows a use-after-free race:
CPU 0 CPU 1
----- -----
state_show() damon_sysfs_turn_damon_on()
ctx = kdamond->damon_ctx; mutex_lock(&damon_sysfs_lock);
damon_destroy_ctx(kdamond->damon_ctx);
kdamond->damon_ctx = NULL;
mutex_unlock(&damon_sysfs_lock);
damon_is_running(ctx); /* ctx is freed */
mutex_lock(&ctx->kdamond_lock); /* UAF */
(The race can also occur with damon_sysfs_kdamonds_rm_dirs() and
damon_sysfs_kdamond_release(), which free or replace the context under
damon_sysfs_lock.)
Fix by taking damon_sysfs_lock before dereferencing the context, mirroring
the locking used in pid_show().
The bug has existed since state_show() first accessed kdamond->damon_ctx.
📍 영향받는 시스템
Linux kernel (DAMON 기능이 포함된 버전)
⚔️ 공격 벡터
특수하게 조작된 시스템 호출을 통해 레이스 컨디션을 유도하여 메모리 해제 후 재사용 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 damon_sysfs_lock 적용
🔧 검증 코드
출력된 커널 버전이 취약점이 해결된 최신 패치 버전인지 확인