🔍 CVE-2021-46921

7.8
CVSS Score
HIGH
2024-02-27
2026-08-04 10:16
✅ 완료

🇰🇷 한글 설명

Linux 커널의 qrwlock 메커니즘에서 queued_write_lock_slowpath() 함수의 잠금 순서 오류로 인해 발생하는 취약점입니다. 이로 인해 쓰기 잠금을 획득하기 전의 값을 읽게 되는 A-B-A 문제가 발생하여 데이터 일관성이 깨질 수 있습니다.

💡 쉬운 설명

컴퓨터의 핵심 부품인 커널이 데이터를 안전하게 잠그고 사용하는 과정에서 순서가 꼬이는 문제가 발견되었습니다. 이로 인해 데이터가 완전히 잠기기 전에 다른 프로그램이 잘못된 데이터를 읽어갈 위험이 있습니다.

🇺🇸 원문 (English)

In the Linux kernel, the following vulnerability has been resolved: locking/qrwlock: Fix ordering in queued_write_lock_slowpath() While this code is executed with the wait_lock held, a reader can acquire the lock without holding wait_lock. The writer side loops checking the value with the atomic_cond_read_acquire(), but only truly acquires the lock when the compare-and-exchange is completed successfully which isn’t ordered. This exposes the window between the acquire and the cmpxchg to an A-B-A problem which allows reads following the lock acquisition to observe values speculatively before the write lock is truly acquired. We've seen a problem in epoll where the reader does a xchg while holding the read lock, but the writer can see a value change out from under it. Writer | Reader -------------------------------------------------------------------------------- ep_scan_ready_list() | |- write_lock_irq() | |- queued_write_lock_slowpath() | |- atomic_cond_read_acquire() | | read_lock_irqsave(&ep->lock, flags); --> (observes value before unlock) | chain_epi_lockless() | | epi->next = xchg(&ep->ovflist, epi); | | read_unlock_irqrestore(&ep->lock, flags); | | | atomic_cmpxchg_relaxed() | |-- READ_ONCE(ep->ovflist); | A core can order the read of the ovflist ahead of the atomic_cmpxchg_relaxed(). Switching the cmpxchg to use acquire semantics addresses this issue at which point the atomic_cond_read can be switched to use relaxed semantics. [peterz: use try_cmpxchg()]

📍 영향받는 시스템

Linux Kernel (qrwlock 관련 모듈을 사용하는 시스템)

⚔️ 공격 벡터

특정 조건에서 epoll 등을 이용해 쓰기 잠금과 읽기 잠금이 충돌하도록 유도하여 데이터 불일치 유발

🛡️ 대응 방법

커널 패치를 적용하여 atomic_cmpxchg에 acquire semantics를 적용한 최신 커널로 업데이트

🔧 검증 코드

출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인

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