🇰🇷 한글 설명
Linux 커널의 qla2xxx SCSI 드라이버에서 타임아웃 핸들러와 완료 함수 간의 경쟁 상태(Race Condition)로 인해 발생하는 취약점입니다. 타임아웃 처리 중 이미 해제된 메모리 포인터에 접근하여 커널 NULL 포인터 역참조 오류 및 시스템 충돌을 유발할 수 있습니다.
💡 쉬운 설명
컴퓨터 부품을 제어하는 소프트웨어에서 두 가지 작업이 동시에 일어나면서, 이미 사라진 정보를 다시 사용하려고 시도하다가 시스템이 멈추는 문제입니다. 이로 인해 서버가 갑자기 꺼지거나 오류가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
scsi: qla2xxx: Implement ref count for SRB
The timeout handler and the done function are racing. When
qla2x00_async_iocb_timeout() starts to run it can be preempted by the
normal response path (via the firmware?). qla24xx_async_gpsc_sp_done()
releases the SRB unconditionally. When scheduling back to
qla2x00_async_iocb_timeout() qla24xx_async_abort_cmd() will access an freed
sp->qpair pointer:
qla2xxx [0000:83:00.0]-2871:0: Async-gpsc timeout - hdl=63d portid=234500 50:06:0e:80:08:77:b6:21.
qla2xxx [0000:83:00.0]-2853:0: Async done-gpsc res 0, WWPN 50:06:0e:80:08:77:b6:21
qla2xxx [0000:83:00.0]-2854:0: Async-gpsc OUT WWPN 20:45:00:27:f8:75:33:00 speeds=2c00 speed=0400.
qla2xxx [0000:83:00.0]-28d8:0: qla24xx_handle_gpsc_event 50:06:0e:80:08:77:b6:21 DS 7 LS 6 rc 0 login 1|1 rscn 1|0 lid 5
BUG: unable to handle kernel NULL pointer dereference at 0000000000000004
IP: qla24xx_async_abort_cmd+0x1b/0x1c0 [qla2xxx]
Obvious solution to this is to introduce a reference counter. One reference
is taken for the normal code path (the 'good' case) and one for the timeout
path. As we always race between the normal good case and the timeout/abort
handler we need to serialize it. Also we cannot assume any order between
the handlers. Since this is slow path we can use proper synchronization via
locks.
When we are able to cancel a timer (del_timer returns 1) we know there
can't be any error handling in progress because the timeout handler hasn't
expired yet, thus we can safely decrement the refcounter by one.
If we are not able to cancel the timer, we know an abort handler is
running. We have to make sure we call sp->done() in the abort handlers
before calling kref_put().
📍 영향받는 시스템
qla2xxx 드라이버를 사용하는 Linux 커널 시스템
⚔️ 공격 벡터
특정 SCSI 입출력 상황을 유도하여 타임아웃과 응답 처리가 동시에 발생하도록 유도하는 로컬/원격 공격 가능성
🛡️ 대응 방법
qla2xxx 드라이버에 참조 카운터(Reference Counter) 및 동기화 로직이 적용된 최신 Linux 커널로 업데이트
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 패치된 버전인지 보안 권고 사항과 비교합니다.