🇰🇷 한글 설명
Linux 커널의 drm/sched 구성 요소에서 drm_sched_job_add_resv_dependencies 함수 호출 시 발생할 수 있는 이중 해제(Double Free) 취약점입니다. xarray 확장 실패와 같은 오류 경로에서 이미 해제된 fence 참조를 다시 해제하려고 시도하여 메모리 오류를 유발할 수 있습니다.
💡 쉬운 설명
컴퓨터 메모리를 관리하는 과정에서 이미 사용이 끝난 메모리 영역을 실수로 두 번 삭제하려고 시도하는 오류입니다. 이로 인해 시스템이 갑자기 멈추거나 예상치 못한 동작을 할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
drm/sched: Fix potential double free in drm_sched_job_add_resv_dependencies
When adding dependencies with drm_sched_job_add_dependency(), that
function consumes the fence reference both on success and failure, so in
the latter case the dma_fence_put() on the error path (xarray failed to
expand) is a double free.
Interestingly this bug appears to have been present ever since
commit ebd5f74255b9 ("drm/sched: Add dependency tracking"), since the code
back then looked like this:
drm_sched_job_add_implicit_dependencies():
...
for (i = 0; i < fence_count; i++) {
ret = drm_sched_job_add_dependency(job, fences[i]);
if (ret)
break;
}
for (; i < fence_count; i++)
dma_fence_put(fences[i]);
Which means for the failing 'i' the dma_fence_put was already a double
free. Possibly there were no users at that time, or the test cases were
insufficient to hit it.
The bug was then only noticed and fixed after
commit 9c2ba265352a ("drm/scheduler: use new iterator in drm_sched_job_add_implicit_dependencies v2")
landed, with its fixup of
commit 4eaf02d6076c ("drm/scheduler: fix drm_sched_job_add_implicit_dependencies").
At that point it was a slightly different flavour of a double free, which
commit 963d0b356935 ("drm/scheduler: fix drm_sched_job_add_implicit_dependencies harder")
noticed and attempted to fix.
But it only moved the double free from happening inside the
drm_sched_job_add_dependency(), when releasing the reference not yet
obtained, to the caller, when releasing the reference already released by
the former in the failure case.
As such it is not easy to identify the right target for the fixes tag so
lets keep it simple and just continue the chain.
While fixing we also improve the comment and explain the reason for taking
the reference and not dropping it.
📍 영향받는 시스템
Linux Kernel (drm/sched 관련 모듈을 사용하는 시스템)
⚔️ 공격 벡터
특정 조건에서 DRM 스케줄러에 의존성을 추가하는 과정 중 오류를 유발하여 메모리 손상을 일으킴
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하십시오.
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 최신 패치 버전인지 확인하십시오.