🇰🇷 한글 설명
Linux 커널의 mm/hugetlb 구성 요소에서 VMA 분할 시 페이지 테이블의 unshare 작업이 적절한 잠금(Lock)을 확보하기 전에 수행되는 취약점입니다. 이로 인해 VMA 잠금 및 rmap 잠금이 획득되기 전 경쟁 상태(Race Condition)가 발생하여 페이지 테이블이 다시 공유될 수 있습니다.
💡 쉬운 설명
컴퓨터의 메모리를 나누는 과정에서 보안을 위한 잠금 장치를 걸기 전에 작업을 수행하여 발생하는 오류입니다. 이로 인해 메모리 관리 정보가 꼬이면서 시스템의 안정성이나 보안에 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
mm/hugetlb: unshare page tables during VMA split, not before
Currently, __split_vma() triggers hugetlb page table unsharing through
vm_ops->may_split(). This happens before the VMA lock and rmap locks are
taken - which is too early, it allows racing VMA-locked page faults in our
process and racing rmap walks from other processes to cause page tables to
be shared again before we actually perform the split.
Fix it by explicitly calling into the hugetlb unshare logic from
__split_vma() in the same place where THP splitting also happens. At that
point, both the VMA and the rmap(s) are write-locked.
An annoying detail is that we can now call into the helper
hugetlb_unshare_pmds() from two different locking contexts:
1. from hugetlb_split(), holding:
- mmap lock (exclusively)
- VMA lock
- file rmap lock (exclusively)
2. hugetlb_unshare_all_pmds(), which I think is designed to be able to
call us with only the mmap lock held (in shared mode), but currently
only runs while holding mmap lock (exclusively) and VMA lock
Backporting note:
This commit fixes a racy protection that was introduced in commit
b30c14cd6102 ("hugetlb: unshare some PMDs when splitting VMAs"); that
commit claimed to fix an issue introduced in 5.13, but it should actually
also go all the way back.
[
[email protected]: v2]
📍 영향받는 시스템
Linux Kernel (hugetlb 관련 기능이 활성화된 버전)
⚔️ 공격 벡터
메모리 분할 과정에서 발생하는 경쟁 상태(Race Condition)를 이용한 로컬 공격
🛡️ 대응 방법
커널 패치를 적용하여 VMA 및 rmap 잠금이 확보된 상태에서 hugetlb unshare 로직이 실행되도록 업데이트해야 합니다.
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 수정된 최신 패치 버전인지 확인합니다.