🇰🇷 한글 설명
Linux 커널 USB dummy-hcd 드라이버에서 인터럽트 동기화 순서 오류를 수정한 것입니다. 에뮬레이션된 synchronize_irq()가 인터럽트 비활성화 전에 실행되어 경쟁 조건이 발생하는 문제가 있었으나, 동기화를 인터럽트 비활성화 직후에 실행하도록 변경했습니다.
💡 쉬운 설명
USB 드라이버에서 작업 순서가 잘못되어 동기화 오류가 발생하는 문제를 수정했습니다. 이제 안전한 순서로 실행되어 시스템 안정성이 향상됩니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
USB: dummy-hcd: Fix interrupt synchronization error
This fixes an error in synchronization in the dummy-hcd driver. The
error has a somewhat involved history. The synchronization mechanism
was introduced by commit 7dbd8f4cabd9 ("USB: dummy-hcd: Fix erroneous
synchronization change"), which added an emulated "interrupts enabled"
flag together with code emulating synchronize_irq() (it waits until
all current handler callbacks have returned).
But the emulated interrupt-disable occurred too late, after the driver
containing the handler callback routines had been told that it was
unbound and no more callbacks would occur. Commit 4a5d797a9f9c ("usb:
gadget: dummy_hcd: fix gpf in gadget_setup") tried to fix this by
moving the synchronize_irq() emulation code from dummy_stop() to
dummy_pullup(), which runs before the unbind callback.
There still were races, though, because the emulated interrupt-disable
still occurred too late. It couldn't be moved to dummy_pullup(),
because that routine can be called for reasons other than an impending
unbind. Therefore commits 7dc0c55e9f30 ("USB: UDC core: Add
udc_async_callbacks gadget op") and 04145a03db9d ("USB: UDC: Implement
udc_async_callbacks in dummy-hcd") added an API allowing the UDC core
to tell dummy-hcd exactly when emulated interrupts and their callbacks
should be disabled.
That brings us to the current state of things, which is still wrong
because the emulated synchronize_irq() occurs before the emulated
interrupt-disable! That's no good, beause it means that more emulated
interrupts can occur after the synchronize_irq() emulation has run,
leading to the possibility that a callback handler may be running when
the gadget driver is unbound.
To fix this, we have to move the synchronize_irq() emulation code yet
again, to the dummy_udc_async_callbacks() routine, which takes care of
enabling and disabling emulated interrupt requests. The
synchronization will now run immediately after emulated interrupts are
disabled, which is where it belongs.
📍 영향받는 시스템
Linux kernel - USB gadget mode를 지원하는 임베디드 시스템 및 USB 드라이버
⚔️ 공격 벡터
로컬 공격만 가능, USB gadget driver 사용 시 비특권 사용자 또는 특권 사용자에 의한 경쟁 조건 악용
🛡️ 대응 방법
Linux 커널을 수정된 버전 이상으로 업데이트 (배포판 보안 패치 적용)
🔧 검증 코드
현재 커널 버전이 표시되며, 배포판 보안 권고에서 제시한 최소 버전 이상인지 확인하세요
uname -r | grep -E '[0-9]+\.[0-9]+\.[0-9]+'