🇰🇷 한글 설명
Linux 커널 DRM xe 드라이버의 I2C 모듈에서 장치 제거 시 클라이언트 작업(work item)을 취소하지 않아 발생하는 문제입니다. 어댑터 해제 후에도 작업이 실행되어 해제된 메모리를 참조하거나 use-after-free가 발생할 수 있으며, 이를 해결하기 위해 버스 알림자를 먼저 해제하고 작업을 취소하도록 수정되었습니다.
💡 쉬운 설명
그래픽 드라이버를 제거할 때 아직 실행 대기 중인 작업이 남아 있어, 이미 지워진 장치 정보에 접근하는 오류가 생길 수 있습니다. 이 문제는 제거 순서를 바로잡아 해결되었습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
drm/xe/i2c: cancel the client work on remove
xe_i2c_notifier() stores the DesignWare adapter in i2c->adapter and
schedules i2c->work when the adapter is registered under the xe I2C
platform device, and xe_i2c_client_work() then instantiates the AMC
client device on that adapter.
xe_i2c_remove() tears down the AMC, unregisters the client devices,
the bus notifier and the adapter platform device, but it never drains
i2c->work. A work item that is still queued or running when the
adapter is unregistered dereferences i2c->adapter in
i2c_new_client_device() after platform_device_unregister() has
released the adapter. The work item is also embedded in the
devm-allocated struct xe_i2c, so a work item still queued after the
drm device devm unwind frees that allocation runs its callback on
freed memory.
The bus notifier is the only thing that schedules this work, and it is
unregistered after the client devices. An instance that is still queued
when the teardown runs can therefore write
i2c->client[XE_I2C_CLIENT_AMC] while the loop is unregistering and
clearing the same array, and an AMC client it instantiates late is only
cleaned up by the adapter's own child sweep in i2c_del_adapter().
Move bus_unregister_notifier() in front of the client teardown loop
and cancel the work right after it, so no new instance can be
scheduled and a queued instance is drained before the client array is
touched. A running instance still finds a live adapter, since the
adapter is unregistered later.
(cherry picked from commit a23f27d5ec11c3f418c5e5531eea34ccda2b5b20)
📍 영향받는 시스템
수정 이전의 Linux 커널 (DRM xe 드라이버의 I2C 지원 코드가 포함된 버전)
⚔️ 공격 벡터
공격 정보가 명시되지 않음. 로컬 사용자가 드라이버 제거 과정의 타이밍을 악용할 가능성이 있으나 확인되지 않음
🛡️ 대응 방법
해당 수정이 포함된 최신 Linux 커널로 업데이트하거나 상위 배포판의 보안 패치를 적용
🔧 검증 코드
출력된 커널 버전을 배포판의 패치 목록 또는 커널 변경 로그와 대조하여 커밋 a23f27d5ec11c3f418c5e5531eea34ccda2b5b20 반영 여부를 확인하고, 해당 버전 이상이면 수정된 것입니다.