🇰🇷 한글 설명
Linux 커널의 imon 미디어 드라이버에서 USB 통신 오류 발생 시 무한 재시도 및 잠금 해제 실패로 인해 시스템이 멈추는 취약점이 발견되었습니다. 이 문제는 오류 발생 시 printk 로그 폭주로 인한 RCU 스톨이나 장치 잠금을 계속 보유하여 발생하는 태스크 중단(hung task) 현상을 유발합니다.
💡 쉬운 설명
USB 장치와 통신 중에 오류가 발생하면 컴퓨터가 이를 해결하려고 무한히 반복하다가 시스템이 멈춰버리는 문제입니다. 이로 인해 컴퓨터가 응답하지 않거나 먹통이 될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
media: imon: make send_packet() more robust
syzbot is reporting that imon has three problems which result in
hung tasks due to forever holding device lock [1].
First problem is that when usb_rx_callback_intf0() once got -EPROTO error
after ictx->dev_present_intf0 became true, usb_rx_callback_intf0()
resubmits urb after printk(), and resubmitted urb causes
usb_rx_callback_intf0() to again get -EPROTO error. This results in
printk() flooding (RCU stalls).
Alan Stern commented [2] that
In theory it's okay to resubmit _if_ the driver has a robust
error-recovery scheme (such as giving up after some fixed limit on the
number of errors or after some fixed time has elapsed, perhaps with a
time delay to prevent a flood of errors). Most drivers don't bother to
do this; they simply give up right away. This makes them more
vulnerable to short-term noise interference during USB transfers, but in
reality such interference is quite rare. There's nothing really wrong
with giving up right away.
but imon has a poor error-recovery scheme which just retries forever;
this behavior should be fixed.
Since I'm not sure whether it is safe for imon users to give up upon any
error code, this patch takes care of only union of error codes chosen from
modules in drivers/media/rc/ directory which handle -EPROTO error (i.e.
ir_toy, mceusb and igorplugusb).
Second problem is that when usb_rx_callback_intf0() once got -EPROTO error
before ictx->dev_present_intf0 becomes true, usb_rx_callback_intf0() always
resubmits urb due to commit 8791d63af0cf ("[media] imon: don't wedge
hardware after early callbacks"). Move the ictx->dev_present_intf0 test
introduced by commit 6f6b90c9231a ("[media] imon: don't parse scancodes
until intf configured") to immediately before imon_incoming_packet(), or
the first problem explained above happens without printk() flooding (i.e.
hung task).
Third problem is that when usb_rx_callback_intf0() is not called for some
reason (e.g. flaky hardware; the reproducer for this problem sometimes
prevents usb_rx_callback_intf0() from being called),
wait_for_completion_interruptible() in send_packet() never returns (i.e.
hung task). As a workaround for such situation, change send_packet() to
wait for completion with timeout of 10 seconds.
📍 영향받는 시스템
Linux kernel (media: imon driver 포함 버전)
⚔️ 공격 벡터
물리적 또는 소프트웨어적으로 USB 통신에 오류(-EPROTO)를 유발하여 시스템 중단을 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 imon 드라이버의 오류 복구 로직을 수정해야 합니다.
🔧 검증 코드
출력된 커널 버전이 imon 드라이버의 오류 복구 패치가 적용된 최신 버전인지 확인합니다.