🇰🇷 한글 설명
Linux 커널의 Bluetooth L2CAP 프로토콜 스택에서 l2cap_sock_cleanup_listen() 함수와 put_chan() 함수 간의 레이스 컨디션 취약점이 발견되었습니다. 이로 인해 L2CAP 소켓이 해제되는 과정에서 NULL 포인터 역참조가 발생하여 시스템 충돌이나 커널 패닉을 유발할 수 있습니다.
💡 쉬운 설명
블루투스 연결을 정리하는 과정에서 두 가지 작업이 동시에 일어나 충돌이 발생하는 문제입니다. 이 충돌로 인해 컴퓨터의 핵심 시스템인 커널이 갑자기 멈추거나 오류가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: L2CAP: fix race l2cap_sock_cleanup_listen() vs. put_chan
For L2CAP sockets without owning sk->sk_socket, reading
l2cap_pi(sk)->chan may race against concurrent l2cap_sock_kill() ->
l2cap_sock_put_chan(). This excludes simultaneous proto_ops callbacks,
but access in l2cap_sock_cleanup_listen() has unsafe lockless read.
[Task 1] [Task 2 (hdev->workqueue)]
l2cap_sock_release(parent) l2cap_disconn_cfm
l2cap_sock_cleanup_listen l2cap_conn_del
bt_accept_dequeue l2cap_chan_del
lock_sock(sk) l2cap_sock_teardown_cb
bt_accept_unlink
bt_sk(sk)->parent = NULL
release_sock(sk) ----------------> lock_sock(sk)
parent = /* NULL */
lock_sock(sk) <--------------------- release_sock(sk)
sock_set_flag(sk, SOCK_ZAPPED)
l2cap_sock_close_cb
l2cap_sock_kill(sk)
l2cap_sock_put_chan
chan = READ l2cap_pi(sk)->chan l2cap_pi(sk)->chan = NULL
l2cap_chan_hold_unless_zero l2cap_put_chan(chan)
kref_get_unless_zero(&chan->ref)
Task 1 may observe NULL which causes null-ptr-deref.
Fix the race by taking lock_sock() in l2cap_sock_kill() to
synchronize with l2cap_sock_cleanup_listen(). hold_unless_zero() is not
needed here, l2cap_pi(sk)->chan owns reference if it is non-NULL.
Clarify code comments vs. locking.
📍 영향받는 시스템
Linux Kernel (Bluetooth L2CAP 관련 모듈 사용 시스템)
⚔️ 공격 벡터
로컬 또는 원격에서 특정 블루투스 연결/해제 시퀀스를 유도하여 레이스 컨디션 유발
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 l2cap_sock_kill() 시 lock_sock()을 사용하도록 수정
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인하십시오.