🇰🇷 한글 설명
리눅스 커널의 메모리 관리(mm) 서브시스템에서 swapoff 작업 중 VMA(가상 메모리 영역)를 탐색할 때 안정적인 주소 공간인지 확인하지 않아 발생하는 취약점입니다. fork()와 swapoff가 동시에 실행되는 레이스 컨디션 상황에서 NULL 포인터 역참조로 인한 커널 OOPS(시스템 오류)가 발생할 수 있습니다.
💡 쉬운 설명
컴퓨터가 메모리를 정리하는 과정에서 두 가지 작업이 동시에 일어나 충돌이 발생하는 문제입니다. 이로 인해 시스템이 갑자기 멈추거나 오류가 발생하여 서버가 다운될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
mm: swap: check for stable address space before operating on the VMA
It is possible to hit a zero entry while traversing the vmas in unuse_mm()
called from swapoff path and accessing it causes the OOPS:
Unable to handle kernel NULL pointer dereference at virtual address
0000000000000446--> Loading the memory from offset 0x40 on the
XA_ZERO_ENTRY as address.
Mem abort info:
ESR = 0x0000000096000005
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x05: level 1 translation fault
The issue is manifested from the below race between the fork() on a
process and swapoff:
fork(dup_mmap()) swapoff(unuse_mm)
--------------- -----------------
1) Identical mtree is built using
__mt_dup().
2) copy_pte_range()-->
copy_nonpresent_pte():
The dst mm is added into the
mmlist to be visible to the
swapoff operation.
3) Fatal signal is sent to the parent
process(which is the current during the
fork) thus skip the duplication of the
vmas and mark the vma range with
XA_ZERO_ENTRY as a marker for this process
that helps during exit_mmap().
4) swapoff is tried on the
'mm' added to the 'mmlist' as
part of the 2.
5) unuse_mm(), that iterates
through the vma's of this 'mm'
will hit the non-NULL zero entry
and operating on this zero entry
as a vma is resulting into the
oops.
The proper fix would be around not exposing this partially-valid tree to
others when droping the mmap lock, which is being solved with [1]. A
simpler solution would be checking for MMF_UNSTABLE, as it is set if
mm_struct is not fully initialized in dup_mmap().
Thanks to Liam/Lorenzo/David for all the suggestions in fixing this
issue.
📍 영향받는 시스템
Linux Kernel (fork와 swapoff가 동시에 발생하는 환경)
⚔️ 공격 벡터
로컬 공격자가 특정 프로세스 생성(fork)과 스왑 해제(swapoff)를 정밀하게 타이밍을 맞춰 실행하여 커널 오류 유도
🛡️ 대응 방법
리눅스 커널을 최신 보안 패치가 적용된 버전으로 업데이트하거나, MMF_UNSTABLE 플래그를 체크하도록 수정된 패치 적용
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전인지 배포판 보안 공지를 통해 확인하십시오.