🇰🇷 한글 설명
Linux 커널의 bpf_find_vma() 함수에서 mm_struct에 대한 참조를 유지하지 않은 채 mmap_read_trylock()을 호출하여 발생하는 Use-After-Free 취약점입니다. 다른 태스크가 종료되면서 mm_struct를 해제하는 동안 해당 메모리에 접근을 시도할 경우 메모리 오염이나 시스템 충돌이 발생할 수 있습니다.
💡 쉬운 설명
프로그램이 사용 중인 메모리 정보가 갑자기 사라졌는데도 이를 계속 사용하려고 시도할 때 발생하는 오류입니다. 이로 인해 컴퓨터 시스템이 멈추거나 해커가 시스템 권한을 탈취할 위험이 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix use-after-free on mm_struct in bpf_find_vma()
bpf_find_vma() reads task->mm and calls mmap_read_trylock(mm) without
holding a reference on the mm. On a foreign task, a concurrent exit_mm()
can free the mm_struct between the lockless read and the trylock,
resulting in a use-after-free. mm_struct is not SLAB_TYPESAFE_BY_RCU.
For the current task, task->mm is stable. For a foreign task, pin the mm
under task->alloc_lock and release it with mmput_async(), mirroring commit
d8e27d2d22b6 ("bpf: fix mm lifecycle in open-coded task_vma iterator").
Use spin_trylock() instead of get_task_mm() so BPF context does not block
on alloc_lock. Reject irqs-disabled contexts and !CONFIG_MMU on the
foreign-task path because dropping the mm reference is not safe there.
Race:
CPU0 (BPF program) CPU1 (exiting task)
============================ ==========================
bpf_find_vma(foreign_task):
mm = task->mm
exit_mm():
task->mm = NULL
mmput(mm) -> frees mm_struct
mmap_read_trylock(mm)
// UAF on mm
📍 영향받는 시스템
Linux Kernel (bpf 관련 기능이 활성화된 버전)
⚔️ 공격 벡터
특정 BPF 프로그램을 실행하여 다른 프로세스의 메모리 해제 시점과 충돌을 유도하는 레이스 컨디션 공격
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하십시오.
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인하십시오.