🇰🇷 한글 설명
Linux 커널의 mm/filemap 구성 요소 내 __filemap_add_folio() 함수에서 인덱스 복구 로직이 누락되어 발생하는 취약점입니다. 메모리 할당 실패로 인해 락을 해제했다가 다시 획득하는 과정에서 잘못된 인덱스에 데이터가 저장될 수 있으며, 이는 시스템의 실행 가능한 텍스트 페이지가 잘못된 위치에 배치되는 결과를 초래합니다.
💡 쉬운 설명
컴퓨터의 핵심 운영체제인 리눅스 메모리 관리 과정에서 데이터가 엉뚱한 주소에 저장될 수 있는 오류입니다. 이로 인해 프로그램이 갑자기 종료되거나 시스템이 비정상적으로 동작할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
mm/filemap: __filemap_add_folio() restore index before retrying
In __filemap_add_folio()'s split-a-conflict loop, xas_set_order() is
applied repeatedly: each application modifies xas.xa_index, rounding it
down according to the split_order attempted at that stage: and if all goes
as intended, it eventually (or immediately) converges on an
xas_try_split() to the required folio_order, with xas.xa_index now the
same as index: then xas_store() puts the new folio into the xarray there.
But if a new node was needed, and GFP_NOWAIT allocation did not get one,
the lock is dropped, xas_nomem() used to allocate, and sequence retried.
If (that part of) the xarray is unchanged when the lock is reacquired, no
problem. But what if the conflict was meanwhile resolved by another
thread (perhaps even doing the same thing, inserting a folio at that same
index)? Isn't there a danger of now putting our folio into the xarray at
an intermediate rounded-down index? With !folio_contains() bug to follow,
when CONFIG_DEBUG_VM=y is checking for that.
Fix this with an xas_set_order() to restore the original xas.xa_index at
the bottom of the loop, so the retry does a full re-evaluation after
reacquiring the lock, and cannot reach xas_store() with the wrong index.
Production was suffering from rare SIGILLs and SIGSEGVs, executable text
found a page away from where it belonged, !folio_contains() bug hit when
debug enabled: symptoms not seen since this patch went in.
📍 영향받는 시스템
Linux Kernel (mm/filemap 관련 모듈을 사용하는 모든 버전)
⚔️ 공격 벡터
메모리 할당 실패를 유도하여 레이스 컨디션(Race Condition)을 일으킴으로써 잘못된 메모리 주소에 데이터를 삽입
🛡️ 대응 방법
해당 취약점이 수정된 최신 리눅스 커널 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전이 취약점이 패치된 최신 보안 업데이트 버전인지 확인