🇰🇷 한글 설명
Linux 커널 ALSA PCM의 snd_pcm_drain() 함수에서 발생하는 use-after-free 취약점입니다. 연결된 스트림의 런타임 필드가 스트림 락 해제 후 보호 없이 접근되며, 동시에 다른 프로세스에서 해당 메모리를 해제할 수 있어 이미 해제된 메모리에 대한 접근이 발생합니다.
💡 쉬운 설명
리눅스 오디오 시스템에서 두 개의 연결된 오디오 작업이 동시에 실행될 때, 한쪽에서 메모리를 정리하는 중에 다른 쪽에서 이미 정리된 메모리에 접근하는 문제입니다. 이는 시스템 충돌이나 권한 상승으로 이어질 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ALSA: pcm: fix use-after-free on linked stream runtime in snd_pcm_drain()
In the drain loop, the local variable 'runtime' is reassigned to a
linked stream's runtime (runtime = s->runtime at line 2157). After
releasing the stream lock at line 2169, the code accesses
runtime->no_period_wakeup, runtime->rate, and runtime->buffer_size
(lines 2170-2178) — all referencing the linked stream's runtime without
any lock or refcount protecting its lifetime.
A concurrent close() on the linked stream's fd triggers
snd_pcm_release_substream() → snd_pcm_drop() → pcm_release_private()
→ snd_pcm_unlink() → snd_pcm_detach_substream() → kfree(runtime).
No synchronization prevents kfree(runtime) from completing while the
drain path dereferences the stale pointer.
Fix by caching the needed runtime fields (no_period_wakeup, rate,
buffer_size) into local variables while still holding the stream lock,
and using the cached values after the lock is released.
📍 영향받는 시스템
Linux 커널 (모든 버전, ALSA PCM 사용 시스템)
⚔️ 공격 벡터
특정 타이밍에 연결된 두 PCM 스트림을 동시에 종료하여 use-after-free 조건을 유도
🛡️ 대응 방법
Linux 커널을 최신 버전으로 업데이트 (snd_pcm_drain() use-after-free 수정 포함)
🔧 검증 코드
현재 커널 버전이 취약점 수정 버전보다 최신인지 확인 (커널 벤더별 공지사항 참조)
uname -r | grep -oE '^[0-9]+\.[0-9]+\.[0-9]+'