🇰🇷 한글 설명
Linux 커널의 SMP(Symmetric Multi-Processing) 환경에서 CSD(Cross-CPU Data) 락 획득 과정에 경합 조건(Race Condition)이 존재합니다. 디버그 모드 활성화 시 여러 CPU가 동시에 동일한 대상 CPU의 CSD 데이터를 수정할 수 있어, 큐 관리 구조가 손상되고 시스템이 멈추거나 커널 패닉이 발생할 수 있습니다.
💡 쉬운 설명
여러 개의 CPU가 동시에 한 곳에 명령을 내릴 때, 서로의 작업을 확인하지 않고 동시에 기록하려다 시스템이 엉키는 문제입니다. 이로 인해 컴퓨터가 명령을 처리하지 못하고 멈추거나 갑자기 꺼질 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
smp: Make CSD lock acquisition atomic for debug mode
Commit b0473dcd4b1d ("smp: Improve smp_call_function_single()
CSD-lock diagnostics") changed smp_call_function_single() so that,
when CSD lock debugging is enabled, async !wait calls use the
destination CPU csd_data. That improves diagnostics, but it also removes
the single-writer property that made the old csd_lock() safe: multiple
CPUs can now prepare the same destination CPU CSD concurrently.
csd_lock() currently waits for CSD_FLAG_LOCK to clear and then sets the
bit with a non-atomic read-modify-write. Two senders can both see an
unlocked CSD, set the bit, overwrite the callback fields, and enqueue
the same llist node. Re-adding a node that is already the queue head can
make node->next point to itself, leaving the target CPU stuck walking
call_single_queue. Later synchronous work, such as a TLB shootdown, can
then remain queued and trigger soft-lockup warnings or panics.
Keep the single csd_lock() implementation, but when CSD lock debugging is
enabled, acquire CSD_FLAG_LOCK with try_cmpxchg_acquire(). This makes the
destination CPU CSD a real atomic lock in the only configuration where it
can be shared by multiple remote senders, while preserving the existing
non-debug fast path.
📍 영향받는 시스템
CSD 락 디버깅 기능이 활성화된 Linux 커널 (Commit b0473dcd4b1d 이전 버전)
⚔️ 공격 벡터
로컬 공격자가 다중 CPU 환경에서 특정 커널 디버그 설정을 유도하여 경합 조건을 발생시킴
🛡️ 대응 방법
커널 패치(Commit b0473dcd4b1d 이상)를 적용하여 csd_lock() 호출 시 try_cmpxchg_acquire()를 사용하도록 업데이트
🔧 검증 코드
명령어 결과에 해당 커밋 메시지가 포함되어 있으면 취약점이 해결된 버전입니다.
git log --grep="smp: Improve smp_call_function_single()" | head -n 1