🇰🇷 한글 설명
Linux 커널의 TI VPE 미디어 드라이버에서 스트림 해제 시 발생하는 레이스 컨디션 취약점입니다. 스트림 리소스가 해제된 후에도 인터럽트 핸들러나 복구 워커가 해당 리소스에 접근하여 Use-After-Free 오류를 유발할 수 있습니다.
💡 쉬운 설명
데이터 처리가 끝나고 시스템이 정리되는 과정에서, 이미 삭제된 메모리 주소를 프로그램이 다시 참조하려고 시도하는 오류입니다. 이로 인해 시스템이 갑자기 멈추거나 보안 문제가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
media: ti: vpe: quiesce overflow recovery before freeing streams
The VIP overflow recovery worker is armed from the hardirq handler when a
FIFO overflow is detected, and the list-complete path looks the stream up
through the VPDMA list private pointer. Both keep touching stream, port
and device state; the recovery worker also resets the parser and VPDMA,
repopulates the descriptor list, and re-enables the per-list IRQs.
vip_stop_streaming() masks and clears the per-list IRQs, but it neither
synchronizes the hardirq handler nor disables recovery_work. An overflow
IRQ that has already queued recovery_work, or a list-complete IRQ in
flight when the stream is torn down, can therefore still dereference the
stream after its resources are released: the descriptor list is freed by
vip_release_stream() on file release, and the stream itself by
free_stream() on unbind/remove.
Drain the recovery worker and the IRQ handler at both teardown points
through a shared vip_quiesce_stream() helper, before any stream-owned
resource is released. disable_work_sync() cancels pending recovery_work,
drains a running instance, and raises its disable depth, so a subsequent
schedule_work() issued by a racing IRQ handler is rejected at the
workqueue scheduler: recovery_work cannot be requeued after
disable_work_sync() takes effect. The worker may still re-enable the
per-list IRQs before disable_work_sync() returns; disable_irqs() then
masks those sources and synchronize_irq() waits for any in-flight handler
that still dereferences stream state. In vip_stop_streaming() the helper
runs before the parser is stopped, since a worker drained by
disable_work_sync() may re-enable the parser before exiting and would
otherwise undo the stop. recovery_work is created disabled and enabled in
vip_start_streaming() before IRQs, pairing the enable with the teardown
disable across the streaming lifecycle.
This issue was found by an in-house static analysis tool and confirmed
by manual code review.
📍 영향받는 시스템
Linux kernel (media: ti: vpe driver components)
⚔️ 공격 벡터
FIFO 오버플로우를 유도하여 복구 워커를 실행시킨 후, 스트림을 해제하여 Use-After-Free를 유발하는 방식
🛡️ 대응 방법
커널 패치를 적용하여 스트림 해제 전 recovery_work와 IRQ 핸들러를 동기화하고 안전하게 중단해야 함
🔧 검증 코드
커널 버전 확인 및 소스 코드 내에 수정된 함수(vip_quiesce_stream)가 포함되어 있는지 확인합니다.
uname -r && grep -r "vip_quiesce_stream" /lib/modules/$(uname -r)/build/drivers/media/