🇰🇷 한글 설명
Linux 커널의 libsas 드라이버에서 HA(고가용성) 재개 시 데드락(Deadlock)과 hisi_sas 디스크 깨우기 과정에서의 레이스 컨디션(Race Condition)이 발견되었습니다. 이 취약점은 특정 상황에서 시스템이 멈추거나 디스크가 비정상적으로 비활성화되는 문제를 일으킬 수 있습니다.
💡 쉬운 설명
컴퓨터가 절전 모드에서 깨어날 때, 특정 부품들이 서로의 작업이 끝나기를 기다리며 무한 대기에 빠지거나 순서가 꼬여 디스크 인식을 못 하는 문제입니다. 이로 인해 데이터 읽기/쓰기가 실패하고 디스크 사용이 중단될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
scsi: libsas: Fix HA resume deadlock and hisi_sas disk-wake race
Commit fbefe22811c3 ("scsi: libsas: Don't always drain event workqueue
for HA resume") introduced sas_resume_ha_no_sync() to avoid a deadlock:
the PHYE_RESUME_TIMEOUT handler, running on the HA event workqueue,
calls sas_deform_port() -> sas_destruct_devices(), which removes SCSI
devices and waits for the host to become runtime-active. But the host
cannot resume until sas_resume_ha() -> sas_drain_work() returns, and the
drain is blocked on that very handler.
However skipping the drain reintroduces a race: hisi_sas returns from
resume before all PHY UP work and libsas discovery work finish. The
controller may then autosuspend while disks are still waking up. The
disks issue IO to a suspended controller, the IO fails, and the disks
get disabled.
Fix the deadlock at its source by moving the PHYE_RESUME_TIMEOUT
notification to after sas_drain_work(). By then the host resume is about
to complete, so device removal through device_link no longer blocks on
the resume and the cycle is broken.
With the deadlock gone, restore sas_resume_ha() (the draining variant)
in hisi_sas and remove sas_resume_ha_no_sync().
The reorder is safe for the other libsas consumers (isci, pm8001,
aic94xx, mvsas). During suspend, sas_suspend_devices() calls
sas_notify_lldd_dev_gone() for each device, which sets dev->lldd_dev to
NULL. When scsi_unblock_requests re-enables I/O in resume, any I/O to a
timed-out phy's disk is immediately rejected by the LLDD before reaching
hardware: isci returns SAS_DEVICE_UNKNOWN (mapped to DID_BAD_TARGET),
and pm8001 returns SAS_PHY_DOWN (mapped to DID_NO_CONNECT). Both
complete directly via scsi_done() without entering SCSI EH. This is
identical in both the old and new ordering since lldd_dev_gone runs
during suspend, before resume. The reorder only affects when the
PHYE_RESUME_TIMEOUT handler runs (synchronized by sas_drain_work()
vs. asynchronous after resume returns), not whether I/O can reach the
device. aic94xx and mvsas do not register any PM ops and never reach
this code path.
📍 영향받는 시스템
Linux Kernel (libsas 및 hisi_sas 드라이버를 사용하는 시스템)
⚔️ 공격 벡터
로컬 시스템의 전원 관리 상태 변화(절전 모드 진입 및 해제)를 통한 트리거
🛡️ 대응 방법
해당 수정 사항(Commit fbefe22811c3)이 포함된 최신 Linux 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 패치가 적용된 버전인지 확인
💻 영향받는 소프트웨어
NVIDIA Cloud Gaming Guest Driver for Linux