🇰🇷 한글 설명
Linux 커널의 iio: adc: ad_sigma_delta 드라이버에서 장치 해제(unbind) 시 Use-After-Free 취약점이 발견되었습니다. 버퍼가 장치 등록 해제보다 먼저 해제되어, 인터럽트 핸들러가 이미 해제된 메모리 영역에 데이터를 복사하려고 시도할 수 있습니다.
💡 쉬운 설명
장치를 연결 해제할 때 메모리가 먼저 지워지는데, 시스템은 아직 데이터가 들어올 것이라 착각하여 빈 공간에 데이터를 쓰려고 하는 문제입니다. 이로 인해 시스템이 충돌하거나 보안 문제가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
iio: adc: ad_sigma_delta: fix use-after-free on unbind
ad_sd_buffer_postenable() allocates sigma_delta->samples_buf with
devm_krealloc() at runtime, so its devres entry sits after all
probe-time entries of the driver. devm resources are released in
reverse allocation order, which means unbind frees samples_buf before
iio_device_unregister() disables the buffers and detaches the trigger
pollfunc. The data ready IRQ is still enabled at that point, so
ad_sd_trigger_handler() can still run and memcpy() incoming samples
into the freed samples_buf.
Fix this by preallocating the buffer in
devm_ad_sd_setup_buffer_and_trigger(), before the triggered buffer and
the IRQ are set up, so it is freed only after iio_device_unregister()
has drained the trigger handler via free_irq(). Size it for the worst
case of all sequencer slots being active; ad_sd_validate_scan_mask()
already caps the number of active channels at num_slots.
This issue was found by an in-house static analysis tool.
📍 영향받는 시스템
Linux kernel (iio: adc: ad_sigma_delta 드라이버 포함 버전)
⚔️ 공격 벡터
장치 해제(unbind) 과정 중 발생하는 레이스 컨디션을 이용한 메모리 오염
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 버퍼 할당 순서를 수정해야 합니다.
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인합니다.