🇰🇷 한글 설명
Linux 커널의 Slimbus 드라이버에서 tx_lock과 ctrl->lock 간의 잠금 순서가 일치하지 않아 발생하는 ABBA 데드락 취약점입니다. SSR/PDR 다운 알림 과정에서 서로 다른 경로로 잠금을 획득하려 시도할 때 시스템이 멈출 수 있습니다.
💡 쉬운 설명
두 개의 자물쇠를 사용하는 과정에서 서로 다른 순서로 자물쇠를 잠그려다 보니, 두 작업이 서로 상대방의 자물쇠가 풀리기를 기다리며 영원히 멈춰버리는 현상입니다. 이로 인해 시스템이 응답하지 않는 상태가 될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
slimbus: qcom-ngd-ctrl: Avoid ABBA on tx_lock/ctrl->lock
During the SSR/PDR down notification the tx_lock is taken with the
intent to provide synchronization with active DMA transfers.
But during this period qcom_slim_ngd_down() is invoked, which ends up in
slim_report_absent(), which takes the slim_controller lock. In multiple
other codepaths these two locks are taken in the opposite order (i.e.
slim_controller then tx_lock).
The result is a lockdep splat, and a possible deadlock:
rprocctl/449 is trying to acquire lock:
ffff00009793e620 (&ctrl->lock){+.+.}-{4:4}, at: slim_report_absent (drivers/slimbus/core.c:322) slimbus
but task is already holding lock:
ffff00009793fb50 (&ctrl->tx_lock){+.+.}-{4:4}, at: qcom_slim_ngd_ssr_pdr_notify (drivers/slimbus/qcom-ngd-ctrl.c:1475) slim_qcom_ngd_ctrl
which lock already depends on the new lock.
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&ctrl->tx_lock);
lock(&ctrl->lock);
lock(&ctrl->tx_lock);
lock(&ctrl->lock);
The assumption is that the comment refers to the desire to not call
qcom_slim_ngd_exit_dma() while we have an ongoing DMA TX transaction.
But any such transaction is initiated and completed within a single
qcom_slim_ngd_xfer_msg().
Prior to calling qcom_slim_ngd_exit_dma() the slim_controller is torn
down, all child devices are notified that the slimbus is gone and the
child devices are removed.
Stop taking the tx_lock in qcom_slim_ngd_ssr_pdr_notify() to avoid the
deadlock.
📍 영향받는 시스템
Linux kernel (Slimbus driver components)
⚔️ 공격 벡터
로컬 시스템에서 특정 하드웨어 이벤트(SSR/PDR 다운 알림)를 유도하여 데드락 발생 가능
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 qcom_slim_ngd_ssr_pdr_notify() 내의 tx_lock 획득 로직을 제거해야 합니다.
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 수정된 패치 버전 이상인지 확인합니다.