🇰🇷 한글 설명
Linux 커널의 ALSA seq: midi 구성 요소에서 발생하는 레이스 컨디션 취약점입니다. rawmidi 서브스트림이 닫히는 동안 MIDI 입력 이벤트가 실행될 경우, NULL 포인터 역참조가 발생하여 커널 패닉(시스템 충돌)을 유발할 수 있습니다.
💡 쉬운 설명
사운드 장치를 사용하는 프로그램이 종료될 때, 시스템이 데이터를 처리하는 순서가 꼬이면서 컴퓨터가 갑자기 멈추거나 꺼질 수 있는 문제입니다. 잘못된 메모리 주소를 참조하여 발생하는 오류입니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ALSA: seq: midi: Serialize input teardown with event_input
snd_midi_input_event() must not be running while a rawmidi substream is
closing, since this can lead to the trigger state becoming out-of-step
through this sequence in snd_rawmidi_input_trigger():
snd_rawmidi_input_trigger(up=0)
snd_midi_input_event()
-> snd_rawmidi_kernel_read()
-> snd_rawmidi_input_trigger(up=1)
-> cancel_work_sync()
which ends with the underlying device being active unexpectedly.
When this is called from close_substream(), further input can re-trigger
the input event leaving it running after rawmidi_release_priv() has set
rfile->rmidi to NULL which leads to:
Unable to handle kernel NULL pointer dereference at virtual address 00000000000000b0
Call trace:
snd_midi_input_event+0x3c/0x134 [snd_seq_midi] (P)
snd_rawmidi_input_event_work+0x1c/0x2c
process_one_work+0x150/0x3a4
worker_thread+0x190/0x318
Apply a similar approach to commit ef7607ab1c8ad ("ALSA: seq: midi:
Serialize output teardown with event_input") which fixed the same issue
in the output direction, but updated to use RCU following Takashi Iwai's
proposed follow-on patch [1].
With this change in place, midisynth_unsubscribe() clears the input file
so snd_midi_input_event() will not re-trigger the stream and will be
quiesced by the cancel_work_sync() in snd_rawmidi_input_trigger().
[1] https://lore.kernel.org/linux-sound/
[email protected]/
📍 영향받는 시스템
Linux Kernel (ALSA seq: midi 모듈 사용 시스템)
⚔️ 공격 벡터
특정 MIDI 입력 이벤트와 서브스트림 종료 동작을 정밀하게 타이밍을 맞춰 실행하여 커널 오류 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 MIDI 입력 종료 프로세스를 직렬화해야 합니다.
🔧 검증 코드
출력된 커널 버전이 취약점이 해결된 최신 패치 버전인지 확인합니다.