🔍 CVE-2023-53178

7.8
CVSS Score
HIGH
2025-09-15
2026-08-04 10:18
✅ 완료

🇰🇷 한글 설명

리눅스 커널의 zswap 쓰기백(writeback) 메커니즘에서 레이스 컨디션(경쟁 상태) 취약점이 발견되었습니다. 이로 인해 스왑 아웃된 페이지가 다른 페이지의 데이터와 함께 스왑 인될 수 있어 메모리 오염이 발생할 수 있습니다.

💡 쉬운 설명

컴퓨터가 메모리를 정리하는 과정에서 데이터가 섞이는 오류가 발생할 수 있습니다. 이로 인해 원래 저장했던 데이터 대신 엉뚱한 데이터가 읽혀 시스템이 오작동할 수 있습니다.

🇺🇸 원문 (English)

In the Linux kernel, the following vulnerability has been resolved: mm: fix zswap writeback race condition The zswap writeback mechanism can cause a race condition resulting in memory corruption, where a swapped out page gets swapped in with data that was written to a different page. The race unfolds like this: 1. a page with data A and swap offset X is stored in zswap 2. page A is removed off the LRU by zpool driver for writeback in zswap-shrink work, data for A is mapped by zpool driver 3. user space program faults and invalidates page entry A, offset X is considered free 4. kswapd stores page B at offset X in zswap (zswap could also be full, if so, page B would then be IOed to X, then skip step 5.) 5. entry A is replaced by B in tree->rbroot, this doesn't affect the local reference held by zswap-shrink work 6. zswap-shrink work writes back A at X, and frees zswap entry A 7. swapin of slot X brings A in memory instead of B The fix: Once the swap page cache has been allocated (case ZSWAP_SWAPCACHE_NEW), zswap-shrink work just checks that the local zswap_entry reference is still the same as the one in the tree. If it's not the same it means that it's either been invalidated or replaced, in both cases the writeback is aborted because the local entry contains stale data. Reproducer: I originally found this by running `stress` overnight to validate my work on the zswap writeback mechanism, it manifested after hours on my test machine. The key to make it happen is having zswap writebacks, so whatever setup pumps /sys/kernel/debug/zswap/written_back_pages should do the trick. In order to reproduce this faster on a vm, I setup a system with ~100M of available memory and a 500M swap file, then running `stress --vm 1 --vm-bytes 300000000 --vm-stride 4000` makes it happen in matter of tens of minutes. One can speed things up even more by swinging /sys/module/zswap/parameters/max_pool_percent up and down between, say, 20 and 1; this makes it reproduce in tens of seconds. It's crucial to set `--vm-stride` to something other than 4096 otherwise `stress` won't realize that memory has been corrupted because all pages would have the same data.

📍 영향받는 시스템

zswap 기능을 사용하는 리눅스 커널 버전

⚔️ 공격 벡터

메모리 압박 상황을 유도하여 zswap 쓰기백 과정 중 레이스 컨디션을 발생시킴

🛡️ 대응 방법

zswap 쓰기백 시 참조 무결성을 확인하도록 수정된 최신 리눅스 커널로 업데이트

🔧 검증 코드

출력된 커널 버전이 해당 취약점이 패치된 최신 버전인지 확인합니다.

Shell / Script
uname -r

📊 CVSS Vector String

CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

💻 영향받는 소프트웨어

Linux Kernel