🇰🇷 한글 설명
Linux 커널의 sbs-battery 드라이버에서 power_supply 핸들이 해제된 후 인터럽트 핸들러가 호출되는 Use-After-Free 취약점이 발견되었습니다. 이는 장치 제거 과정에서 IRQ 해제와 power_supply 핸들 해제 순서가 뒤바뀌어 발생하는 레이스 컨디션 때문입니다. 이로 인해 시스템 충돌이나 메모리 오염이 발생할 수 있습니다.
💡 쉬운 설명
배터리 정보를 관리하는 프로그램이 종료될 때, 관리 도구가 먼저 사라졌는데 배터리 신호가 갑자기 들어와서 발생하는 오류입니다. 이 과정에서 컴퓨터가 갑자기 꺼지거나 데이터가 망가질 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
power: supply: sbs-battery: Fix use-after-free in power_supply_changed()
Using the `devm_` variant for requesting IRQ _before_ the `devm_`
variant for allocating/registering the `power_supply` handle, means that
the `power_supply` handle will be deallocated/unregistered _before_ the
interrupt handler (since `devm_` naturally deallocates in reverse
allocation order). This means that during removal, there is a race
condition where an interrupt can fire just _after_ the `power_supply`
handle has been freed, *but* just _before_ the corresponding
unregistration of the IRQ handler has run.
This will lead to the IRQ handler calling `power_supply_changed()` with
a freed `power_supply` handle. Which usually crashes the system or
otherwise silently corrupts the memory...
Note that there is a similar situation which can also happen during
`probe()`; the possibility of an interrupt firing _before_ registering
the `power_supply` handle. This would then lead to the nasty situation
of using the `power_supply` handle *uninitialized* in
`power_supply_changed()`.
Fix this racy use-after-free by making sure the IRQ is requested _after_
the registration of the `power_supply` handle. Keep the old behavior of
just printing a warning in case of any failures during the IRQ request
and finishing the probe successfully.
📍 영향받는 시스템
Linux kernel (sbs-battery 드라이버를 사용하는 시스템)
⚔️ 공격 벡터
로컬 공격자가 장치 제거 또는 재설정 과정을 유도하여 레이스 컨디션을 발생시킴
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 IRQ 요청 순서를 수정함
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인합니다.