🇰🇷 한글 설명
Linux 커널 Bluetooth HCI 드라이버에서 hdev->req_status 변수에 대한 동기화 부족으로 인한 데이터 레이스 취약점입니다. 서로 다른 워크큐에서 실행되는 함수들이 동시에 이 변수에 접근하면서 컴파일러 최적화로 인한 예상치 못한 동작이 발생할 수 있습니다.
💡 쉬운 설명
블루투스 명령 처리 중 여러 스레드가 동시에 같은 상태 변수를 수정하려고 할 때 발생하는 동시성 버그입니다. 이로 인해 블루투스 연결이 불안정해지거나 명령 처리가 실패할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: hci_sync: annotate data-races around hdev->req_status
__hci_cmd_sync_sk() sets hdev->req_status under hdev->req_lock:
hdev->req_status = HCI_REQ_PEND;
However, several other functions read or write hdev->req_status without
holding any lock:
- hci_send_cmd_sync() reads req_status in hci_cmd_work (workqueue)
- hci_cmd_sync_complete() reads/writes from HCI event completion
- hci_cmd_sync_cancel() / hci_cmd_sync_cancel_sync() read/write
- hci_abort_conn() reads in connection abort path
Since __hci_cmd_sync_sk() runs on hdev->req_workqueue while
hci_send_cmd_sync() runs on hdev->workqueue, these are different
workqueues that can execute concurrently on different CPUs. The plain
C accesses constitute a data race.
Add READ_ONCE()/WRITE_ONCE() annotations on all concurrent accesses
to hdev->req_status to prevent potential compiler optimizations that
could affect correctness (e.g., load fusing in the wait_event
condition or store reordering).
📍 영향받는 시스템
Linux 커널의 모든 버전 (Bluetooth 기능이 활성화된 시스템)
⚔️ 공격 벡터
로컬 공격자가 Bluetooth 명령을 빠르게 반복 전송하여 데이터 레이스를 트리거할 수 있습니다.
🛡️ 대응 방법
Linux 커널을 READ_ONCE/WRITE_ONCE 어노테이션이 적용된 최신 버전으로 업그레이드합니다.
🔧 검증 코드
req_status 접근 시 READ_ONCE/WRITE_ONCE 메크로가 사용되면 패치됨, 없으면 취약함
grep -n 'READ_ONCE\|WRITE_ONCE' /usr/src/linux/drivers/bluetooth/hci_sync.c 2>/dev/null | grep req_status