🇰🇷 한글 설명
Linux 커널의 USB Gadget 코어에서 UVC(USB Video Class) 드라이버를 해제할 때 커널 패닉이 발생하는 취약점입니다. 드라이버 언바인드 과정에서 뮤텍스(mutex)를 보유한 상태로 콜백을 호출하여 데드락(Deadlock)이 발생하며, 이를 해결하기 위해 뮤텍스 해제 로직이 추가되었습니다.
💡 쉬운 설명
USB 장치 연결을 해제하는 과정에서 컴퓨터의 핵심 운영체제(커널)가 서로 자원을 기다리며 멈춰버리는 현상이 발생할 수 있습니다. 이로 인해 시스템이 갑자기 꺼지거나 재부팅될 수 있는 오류입니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
USB: Gadget: core: Help prevent panic during UVC unconfigure
Avichal Rakesh reported a kernel panic that occurred when the UVC
gadget driver was removed from a gadget's configuration. The panic
involves a somewhat complicated interaction between the kernel driver
and a userspace component (as described in the Link tag below), but
the analysis did make one thing clear: The Gadget core should
accomodate gadget drivers calling usb_gadget_deactivate() as part of
their unbind procedure.
Currently this doesn't work. gadget_unbind_driver() calls
driver->unbind() while holding the udc->connect_lock mutex, and
usb_gadget_deactivate() attempts to acquire that mutex, which will
result in a deadlock.
The simple fix is for gadget_unbind_driver() to release the mutex when
invoking the ->unbind() callback. There is no particular reason for
it to be holding the mutex at that time, and the mutex isn't held
while the ->bind() callback is invoked. So we'll drop the mutex
before performing the unbind callback and reacquire it afterward.
We'll also add a couple of comments to usb_gadget_activate() and
usb_gadget_deactivate(). Because they run in process context they
must not be called from a gadget driver's ->disconnect() callback,
which (according to the kerneldoc for struct usb_gadget_driver in
include/linux/usb/gadget.h) may run in interrupt context. This may
help prevent similar bugs from arising in the future.
📍 영향받는 시스템
UVC Gadget 드라이버를 사용하는 Linux 커널 버전
⚔️ 공격 벡터
사용자 공간(Userspace) 구성 요소와 드라이버 간의 특정 상호작용을 유도하여 시스템 데드락 유발
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 이후 버전인지 확인