🇰🇷 한글 설명
Linux 커널의 ALSA 드라이버에서 타이머와 워커 스레드 간의 정리 작업 순서 문제로 인해 Use-After-Free(UAF) 취약점이 발생합니다. PCM 스트림이 닫히는 과정에서 타이머 핸들러가 실행 중이거나 워커가 재스케줄링될 경우, 이미 해제된 메모리 영역을 참조하게 되어 시스템 불안정이나 권한 상승을 초래할 수 있습니다.
💡 쉬운 설명
컴퓨터가 사용 중인 메모리를 정리하는 과정에서 순서가 꼬여, 이미 삭제된 데이터를 다시 사용하려고 시도하는 오류입니다. 이로 인해 시스템이 갑자기 멈추거나 해커가 시스템 제어권을 얻을 위험이 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ALSA: sh: aica: reorder cleanup operations to avoid UAF bugs
The dreamcastcard->timer could schedule the spu_dma_work and the
spu_dma_work could also arm the dreamcastcard->timer.
When the snd_pcm_substream is closing, the aica_channel will be
deallocated. But it could still be dereferenced in the worker
thread. The reason is that del_timer() will return directly
regardless of whether the timer handler is running or not and
the worker could be rescheduled in the timer handler. As a result,
the UAF bug will happen. The racy situation is shown below:
(Thread 1) | (Thread 2)
snd_aicapcm_pcm_close() |
... | run_spu_dma() //worker
| mod_timer()
flush_work() |
del_timer() | aica_period_elapsed() //timer
kfree(dreamcastcard->channel) | schedule_work()
| run_spu_dma() //worker
... | dreamcastcard->channel-> //USE
In order to mitigate this bug and other possible corner cases,
call mod_timer() conditionally in run_spu_dma(), then implement
PCM sync_stop op to cancel both the timer and worker. The sync_stop
op will be called from PCM core appropriately when needed.
📍 영향받는 시스템
Linux Kernel (ALSA driver with dreamcastcard support)
⚔️ 공격 벡터
특정 사운드 장치(Dreamcast card)를 사용하는 환경에서 정교하게 설계된 PCM 스트림 종료 시퀀스를 유도하여 발생
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 타이머 및 워커 취소 로직(sync_stop)을 적용해야 함
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 해결된 패치 버전 이상인지 확인합니다.