🇰🇷 한글 설명
리눅스 커널의 fork 과정에서 메모리 매핑이 완전히 완료되지 않은 상태로 khugepaged 및 KSM 훅을 호출하여 발생할 수 있는 취약점입니다. 메모리 트리(Maple Tree)의 데이터가 일관되지 않은 상태에서 최적화 기능이 호출되는 문제를 방지하기 위해, 작업이 성공적으로 완료된 후에만 해당 훅을 호출하도록 수정되었습니다.
💡 쉬운 설명
컴퓨터가 새로운 작업을 시작할 때 메모리를 정리하는 기능이 너무 일찍 작동하여 오류를 일으킬 수 있는 문제입니다. 이제는 메모리 준비가 완벽히 끝난 후에만 정리 기능이 작동하도록 안전하게 변경되었습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
fork: only invoke khugepaged, ksm hooks if no error
There is no reason to invoke these hooks early against an mm that is in an
incomplete state.
The change in commit d24062914837 ("fork: use __mt_dup() to duplicate
maple tree in dup_mmap()") makes this more pertinent as we may be in a
state where entries in the maple tree are not yet consistent.
Their placement early in dup_mmap() only appears to have been meaningful
for early error checking, and since functionally it'd require a very small
allocation to fail (in practice 'too small to fail') that'd only occur in
the most dire circumstances, meaning the fork would fail or be OOM'd in
any case.
Since both khugepaged and KSM tracking are there to provide optimisations
to memory performance rather than critical functionality, it doesn't
really matter all that much if, under such dire memory pressure, we fail
to register an mm with these.
As a result, we follow the example of commit d2081b2bf819 ("mm:
khugepaged: make khugepaged_enter() void function") and make ksm_fork() a
void function also.
We only expose the mm to these functions once we are done with them and
only if no error occurred in the fork operation.
📍 영향받는 시스템
Maple Tree 도입 이후의 특정 리눅스 커널 버전
⚔️ 공격 벡터
메모리 압박 상황을 유도하여 불완전한 메모리 상태에서 커널 최적화 로직을 트리거하는 방식
🛡️ 대응 방법
해당 취약점이 수정된 최신 리눅스 커널 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 패치가 적용된 최신 버전인지 확인