🇰🇷 한글 설명
Linux 커널의 ice 드라이버에서 TX 타임스탬프 링 정리 과정 중 레이스 컨디션(경쟁 상태) 취약점이 발견되었습니다. 이로 인해 ice_free_tx_tstamp_ring()과 ice_tx_map() 함수가 동시에 실행될 경우 NULL 포인터 역참조가 발생하여 시스템이 충돌할 수 있습니다.
💡 쉬운 설명
두 가지 작업이 동시에 일어날 때 데이터가 지워지는 순서가 맞지 않아 발생하는 문제입니다. 이로 인해 컴퓨터가 존재하지 않는 메모리 주소를 참조하게 되어 시스템이 멈추거나 오류가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ice: fix race condition in TX timestamp ring cleanup
Fix a race condition between ice_free_tx_tstamp_ring() and ice_tx_map()
that can cause a NULL pointer dereference.
ice_free_tx_tstamp_ring currently clears the ICE_TX_FLAGS_TXTIME flag
after NULLing the tstamp_ring. This could allow a concurrent ice_tx_map
call on another CPU to dereference the tstamp_ring, which could lead to
a NULL pointer dereference.
CPU A:ice_free_tx_tstamp_ring() | CPU B:ice_tx_map()
--------------------------------|---------------------------------
tx_ring->tstamp_ring = NULL |
| ice_is_txtime_cfg() -> true
| tstamp_ring = tx_ring->tstamp_ring
| tstamp_ring->count // NULL deref!
flags &= ~ICE_TX_FLAGS_TXTIME |
Fix by:
1. Reordering ice_free_tx_tstamp_ring() to clear the flag before
NULLing the pointer, with smp_wmb() to ensure proper ordering.
2. Adding smp_rmb() in ice_tx_map() after the flag check to order the
flag read before the pointer read, using READ_ONCE() for the
pointer, and adding a NULL check as a safety net.
3. Converting tx_ring->flags from u8 to DECLARE_BITMAP() and using
atomic bitops (set_bit(), clear_bit(), test_bit()) for all flag
operations throughout the driver:
- ICE_TX_RING_FLAGS_XDP
- ICE_TX_RING_FLAGS_VLAN_L2TAG1
- ICE_TX_RING_FLAGS_VLAN_L2TAG2
- ICE_TX_RING_FLAGS_TXTIME
📍 영향받는 시스템
Linux kernel (ice network driver 사용 시스템)
⚔️ 공격 벡터
로컬 공격자가 특정 네트워크 트래픽 처리 조건을 유도하여 커널 레이스 컨디션 유발
🛡️ 대응 방법
커널 패치를 통해 플래그 해제 순서를 조정하고 원자적 비트 연산(atomic bitops)을 적용하여 수정
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 해당 취약점이 수정된 최신 패치 버전인지 확인합니다.