В ядре Linux устранена следующая уязвимость:
scsi: libsas: исправлена тупиковая блокировка возобновления HA и гонка пробуждения диска hisi_sas. Commit fbefe22811c3 ("scsi: libsas: не всегда очищать рабочую очередь событий
для возобновления HA") введена функция sas_resume_ha_no_sync(), чтобы избежать тупиковой ситуации:
обработчик PHYE_RESUME_TIMEOUT, работающий в рабочей очереди событий высокой доступности,
вызывает sas_deform_port() -> sas_destruct_devices(), который удаляет SCSI
устройства и ждет, пока хост станет активным во время выполнения. Но хозяин
не может возобновиться до тех пор, пока sas_resume_ha() -> sas_drain_work() не вернется, и
сток заблокирован на этом самом обработчике.
Однако пропуск стока вновь приводит к гонке: hisi_sas возвращается из
возобновите работу до завершения всей работы PHY UP и работы по обнаружению libsas.
контроллер может затем автоматически перейти в режим ожидания, пока диски все еще пробуждаются.
диски выдают ввод-вывод на приостановленный контроллер, ввод-вывод завершается сбоем, и диски
получить инвалидность. Исправьте тупик в его источнике, переместив PHYE_RESUME_TIMEOUT.
уведомление после sas_drain_work(). К тому времени резюме ведущего будет готово.
завершено, поэтому удаление устройства через device_link больше не блокируется
резюме, и цикл разрывается.
После устранения тупика восстановите sas_resume_ha() (вариант слива)
в hisi_sas и удалите sas_resume_ha_no_sync(). Изменение порядка безопасно для других потребителей libsas (isci, pm8001,
aic94xx, mvsas). Во время приостановки вызывает sas_suspend_devices().
sas_notify_lldd_dev_gone() для каждого устройства, что устанавливает для dev->lldd_dev значение
НУЛЬ.
Когда scsi_unblock_requests повторно разрешает ввод-вывод в возобновлении, любой ввод-вывод в
физический диск с истекшим временем ожидания немедленно отклоняется LLDD до достижения
аппаратное обеспечение: isci возвращает SAS_DEVICE_UNKNOWN (сопоставленный с DID_BAD_TARGET),
и pm8001 возвращает SAS_PHY_DOWN (сопоставленный с DID_NO_CONNECT). оба
завершите напрямую через scsi_done(), не вводя SCSI EH. Это
идентичен как в старом, так и в новом порядке, поскольку запускается lldd_dev_gone
во время приостановки, перед возобновлением. Изменение порядка влияет только тогда, когда
Запускается обработчик PHYE_RESUME_TIMEOUT (синхронизируется с помощью sas_drain_work())
по сравнению с асинхронным после возврата возобновления), а не о том, может ли ввод-вывод достичь
устройство. aic94xx и mvsas не регистрируют никаких операций в ПМ и никогда не доходят
этот путь кода.
Показать оригинальное описание (EN)
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.