🇰🇷 한글 설명
리눅스 커널의 shmem(공유 메모리) 관리 과정에서 cachestat가 스와핑 및 무효화 작업과 경합할 때 발생하는 두 가지 버그입니다. 첫 번째는 잘못된 스왑 엔트리로 인해 배열 범위를 벗어난 메모리 접근이 발생할 수 있으며, 두 번째는 유효하지 않은 NULL 포인터가 전달되어 잘못된 통계 결과가 도출될 수 있습니다.
💡 쉬운 설명
컴퓨터가 메모리를 정리하는 과정에서 서로 다른 작업이 동시에 충돌하여 시스템 오류가 발생할 수 있는 문제입니다. 이로 인해 시스템이 비정상적으로 작동하거나 보안상 취약점이 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
mm: cachestat: fix two shmem bugs
When cachestat on shmem races with swapping and invalidation, there
are two possible bugs:
1) A swapin error can have resulted in a poisoned swap entry in the
shmem inode's xarray. Calling get_shadow_from_swap_cache() on it
will result in an out-of-bounds access to swapper_spaces[].
Validate the entry with non_swap_entry() before going further.
2) When we find a valid swap entry in the shmem's inode, the shadow
entry in the swapcache might not exist yet: swap IO is still in
progress and we're before __remove_mapping; swapin, invalidation,
or swapoff have removed the shadow from swapcache after we saw the
shmem swap entry.
This will send a NULL to workingset_test_recent(). The latter
purely operates on pointer bits, so it won't crash - node 0, memcg
ID 0, eviction timestamp 0, etc. are all valid inputs - but it's a
bogus test. In theory that could result in a false "recently
evicted" count.
Such a false positive wouldn't be the end of the world. But for
code clarity and (future) robustness, be explicit about this case.
Bail on get_shadow_from_swap_cache() returning NULL.
📍 영향받는 시스템
Linux Kernel (shmem 관련 기능이 활성화된 버전)
⚔️ 공격 벡터
로컬 공격자가 메모리 관리 및 스와핑 프로세스 간의 경합 상태(Race Condition)를 유도하여 발생
🛡️ 대응 방법
리눅스 커널을 최신 보안 패치가 적용된 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 해결된 패치 버전인지 확인