🇰🇷 한글 설명
Linux 커널 Intel Xe 그래픽 드라이버(drm/xe)에서 디스플레이 프레임버퍼와 외부(dma-buf) 핀 해제가 겹칠 때 pinned_link 리스트 항목이 해제되지 않고 남는 문제입니다. 해제된 메모리를 가리키는 잔여 항목이 리스트를 손상시키고 이후 use-after-free로 이어질 수 있습니다. 해당 패치는 pinned_link 제거를 pin_count가 실제로 0이 되는 지점으로 옮겨 문제를 수정합니다.
💡 쉬운 설명
그래픽 카드 드라이버가 메모리 사용 목록을 정리하지 않아, 이미 지워진 메모리를 가리키는 잘못된 기록이 남는 버그입니다. 이 상태에서 시스템이 목록을 다시 읽으면 충돌이나 임의 메모리 접근으로 이어질 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
drm/xe: Fix stale pinned_link entry when fb-pin performs the final unpin
xe_bo_pin_external() and xe_bo_unpin_external() maintain the bo's
pinned_link list membership in xe->pinned.late.external, based on
whether the current call is the outermost pin or the final unpin.
However, the same external bo's pin_count can also be raised and
lowered directly by __xe_pin_fb_vma()/__xe_unpin_fb_vma(), which pin
the bo as a display scanout buffer without going through
xe_bo_pin_external()/xe_bo_unpin_external() at all, and have no
notion of, or ownership over, pinned_link.
If a bo is pinned both externally (e.g. dma-buf export) and as an fb,
and the external unpin happens first, xe_bo_unpin_external() correctly
observes pin_count > 1 and leaves the bo on pinned_link. When the fb
unpin later performs the true last unpin (pin_count 1 -> 0), it never
touches pinned_link, leaving the bo linked on xe->pinned.late.external
indefinitely. Once the bo is subsequently freed, this stale list entry
points into freed memory, corrupting the list and risking a
use-after-free the next time the list is walked or spliced.
The backup object pin/unpin sites in xe_bo_notifier_prepare_pinned()/
xe_bo_notifier_unprepare_pinned() have the same bypass characteristic,
though they never add their bo to a pinned list, so are not affected
by this particular list-corruption issue.
Move the pinned_link removal into xe_bo_account_unpin(), which already
runs on every unpin path (kernel, external, framebuffer, backup
object) right before the true 1 -> 0 pin_count transition. Since
list_del_init() only operates on the node itself, this removal is
list-agnostic and safe to perform regardless of which list (external
or kernel_bo_present) the bo happens to be linked on, or which code
path is performing the final unpin. Drop the now-redundant explicit
list_del_init() calls in xe_bo_unpin_external() and xe_bo_unpin().
v2:
- New patch
v3:
- Rebased on changes to previous patch.
(cherry picked from commit ca58d36a1f93af586ee93b340c9f9fd81312cc01)
📍 영향받는 시스템
Linux 커널의 drm/xe 드라이버를 사용하는 Intel Xe 기반 그래픽 장치 시스템(해당 수정이 포함되기 이전 커널 버전)
⚔️ 공격 벡터
로컬 사용자 또는 그래픽 자원을 사용하는 권한 있는 프로세스가 외부 export와 프레임버퍼 핀을 특정 순서로 발생시켜 손상된 리스트를 유발할 수 있으며, 원격 공격 경로는 확인되지 않음
🛡️ 대응 방법
커널 업데이트를 적용하여 커밋 ca58d36a1f93af586ee93b340c9f9fd81312cc01 이후 버전으로 갱신
🔧 검증 코드
출력된 커널 버전이 해당 수정이 배포된 최신 패치 버전 이상인지 배포판 보안 공지 또는 changelog와 대조하여 확인하며, 낮으면 업데이트가 필요합니다.