🇰🇷 한글 설명
Linux 커널의 pds_core 구성 요소에서 adminq를 사용하는 과정 중 레이스 컨디션(경쟁 상태)이 발생할 수 있는 취약점입니다. PCIe 리셋이나 펌웨어 업데이트로 인해 adminq가 삭제된 후, 기존 작업 스레드나 클라이언트가 해당 자원에 접근하려고 할 때 NULL 포인터 역참조가 발생하여 시스템이 충돌할 수 있습니다.
💡 쉬운 설명
장치가 재시작되는 과정에서 이미 사라진 통신 통로를 프로그램이 계속 사용하려고 시도하여 시스템이 멈추거나 오류가 발생하는 문제입니다. 이를 방지하기 위해 통로를 사용 중인 작업이 모두 끝날 때까지 기다리는 안전장치가 필요합니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
pds_core: Prevent race issues involving the adminq
There are multiple paths that can result in using the pdsc's
adminq.
[1] pdsc_adminq_isr and the resulting work from queue_work(),
i.e. pdsc_work_thread()->pdsc_process_adminq()
[2] pdsc_adminq_post()
When the device goes through reset via PCIe reset and/or
a fw_down/fw_up cycle due to bad PCIe state or bad device
state the adminq is destroyed and recreated.
A NULL pointer dereference can happen if [1] or [2] happens
after the adminq is already destroyed.
In order to fix this, add some further state checks and
implement reference counting for adminq uses. Reference
counting was used because multiple threads can attempt to
access the adminq at the same time via [1] or [2]. Additionally,
multiple clients (i.e. pds-vfio-pci) can be using [2]
at the same time.
The adminq_refcnt is initialized to 1 when the adminq has been
allocated and is ready to use. Users/clients of the adminq
(i.e. [1] and [2]) will increment the refcnt when they are using
the adminq. When the driver goes into a fw_down cycle it will
set the PDSC_S_FW_DEAD bit and then wait for the adminq_refcnt
to hit 1. Setting the PDSC_S_FW_DEAD before waiting will prevent
any further adminq_refcnt increments. Waiting for the
adminq_refcnt to hit 1 allows for any current users of the adminq
to finish before the driver frees the adminq. Once the
adminq_refcnt hits 1 the driver clears the refcnt to signify that
the adminq is deleted and cannot be used. On the fw_up cycle the
driver will once again initialize the adminq_refcnt to 1 allowing
the adminq to be used again.
📍 영향받는 시스템
Linux kernel (pds_core driver component)
⚔️ 공격 벡터
PCIe 리셋 또는 펌웨어 업데이트를 유도하여 특정 타이밍에 NULL 포인터 역참조를 발생시키는 방식
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 adminq 참조 카운팅(reference counting) 로직을 적용해야 합니다.
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인합니다.