🇰🇷 한글 설명
Linux 커널의 drm/amdkfd 구성 요소에서 NULL 포인터 역참조 취약점이 발견되었습니다. /sys/kernel/debug/kfd/mqds 파일을 읽을 때 특정 조건에서 초기화되지 않은 mqd_mgr 변수를 참조하여 커널 크래시가 발생할 수 있습니다.
💡 쉬운 설명
시스템의 특정 정보를 읽어오는 과정에서 컴퓨터가 잘못된 메모리 주소를 참조하여 시스템이 멈추거나 충돌할 수 있는 오류입니다. 이는 프로그램이 준비되지 않은 데이터를 사용하려고 할 때 발생하는 문제입니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
drm/amdkfd: fix scope of mqd_mgr dereference in pqm_debugfs_mqds
Reading /sys/kernel/debug/kfd/mqds while a process holds an active KFD
queue triggers a NULL pointer dereference because the for loop that
calls mqd_mgr->debugfs_show_mqd() is incorrectly placed outside the
if (pqn->q) block that initializes mqd_mgr.
The queue list can contain entries where pqn->q is NULL (kernel queues
where only pqn->kq is valid). In the original code:
if (pqn->q) {
...
mqd_mgr = q->device->dqm->mqd_mgrs[mqd_type];
size = mqd_mgr->mqd_stride(...);
}
for (xcc = 0; xcc < num_xccs; xcc++) { // WRONG: outside if block
mqd = q->mqd + size * xcc;
r = mqd_mgr->debugfs_show_mqd(m, mqd);
}
When iterating over a queue node where pqn->q is NULL:
1. The if (pqn->q) block is skipped
2. mqd_mgr remains uninitialized (NULL from declaration)
3. The for loop executes anyway
4. mqd_mgr->debugfs_show_mqd(m, mqd) dereferences NULL
The crash manifests as:
BUG: kernel NULL pointer dereference, address: 0000000000000000
#PF: supervisor instruction fetch in kernel mode
RIP: 0010:0x0
Call Trace:
pqm_debugfs_mqds+0x10c/0x1d0 [amdgpu]
kfd_debugfs_mqds_by_process+0x9b/0x110 [amdgpu]
seq_read_iter+0x132/0x4b0
...
Fix by moving the for loop inside the if (pqn->q) block, so mqd_mgr
and related variables are only used when properly initialized.
(cherry picked from commit 8bfe29d5c798940f797aa24135d2734c3ffce9de)
📍 영향받는 시스템
Linux kernel (amdgpu/amdkfd driver 포함 버전)
⚔️ 공격 벡터
로컬 권한을 가진 사용자가 debugfs를 통해 특정 경로(/sys/kernel/debug/kfd/mqds)를 읽는 행위
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하십시오.
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인하십시오.