🇰🇷 한글 설명
Linux 커널의 Thunderbolt 드라이버에서 tb_remove_work()와 tb_domain_remove() 함수 간의 경합 조건(Race Condition)으로 인해 NULL 포인터 역참조가 발생할 수 있는 취약점입니다. 이로 인해 시스템이 충돌하거나 커널 패닉이 발생할 수 있습니다.
💡 쉬운 설명
컴퓨터의 Thunderbolt 연결을 해제하는 과정에서 두 가지 작업이 동시에 일어나 충돌이 발생하는 문제입니다. 이 과정에서 잘못된 메모리 주소를 참조하게 되어 컴퓨터가 갑자기 멈추거나 꺼질 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
thunderbolt: Fix NULL dereference in tb_remove_work()
There is a slight race between tb_remove_work() and tb_domain_remove()
which leads to dereferencing a NULL tb->root_switch pointer inside
tb_free_unplugged_xdomains():
Thread A Thread B
tb_remove_work()
tb_domain_remove()
mutex_lock(&tb->lock)
tb_stop()
/* doesn't cancel a running callback */
cancel_delayed_work(&tcm->remove_work)
...
tb_switch_remove(tb->root_switch)
tb->root_switch = NULL
mutex_unlock(&tb->lock)
mutex_lock(&tb->lock)
...
/* without checking ->root_switch */
tb_free_unplugged_xdomains(tb->root_switch)
mutex_unlock(&tb->lock)
Commit a8937f35cf39 ("thunderbolt: Remove XDomain from the bus without
holding tb->lock") doesn't seem right to move tb_free_unplugged_xdomains()
out of the &tb->lock section and the check for tb->root_switch, in
particular. It states:
For this reason separate removing the XDomain from the topology data
structures (where we need the lock) from unregistering the device from
the bus (where remove callbacks of the drivers are being called).
tb_free_unplugged_xdomains() belongs to the former group of functions
requiring the lock. And it also calls tb_xdomain_remove() which should
only be called with &tb->lock held.
Found by Linux Verification Center (linuxtesting.org) with Svace static
analysis tool.
📍 영향받는 시스템
Thunderbolt 드라이버를 사용하는 Linux 커널 버전
⚔️ 공격 벡터
로컬 공격자가 Thunderbolt 장치를 빈번하게 연결하거나 해제하여 경합 조건을 유도함으로써 발생 가능
🛡️ 대응 방법
커널 패치(Commit a8937f35cf39 관련 수정 사항 포함)가 적용된 최신 Linux 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 취약점이 해결된 최신 패치 버전인지 확인