🇰🇷 한글 설명
Linux 커널의 virtio-mmio 드라이버에서 vm_dev 구조체를 devres로 할당하여 객체 수명 관리가 깨진 문제입니다. 플랫폼 디바이스가 제거될 때 메모리가 먼저 해제되어, 이후 release 콜백 호출 시 use-after-free가 발생합니다. devres를 사용하지 않도록 수정하면 해결됩니다.
💡 쉬운 설명
리눅스 커널의 가상화 장치 드라이버가 메모리를 너무 일찍 해제해서, 이후 같은 메모리를 다시 사용하려다 오류가 생기는 문제입니다. 이로 인해 시스템이 불안정해지거나 비정상 동작할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
virtio-mmio: don't break lifecycle of vm_dev
vm_dev has a separate lifecycle because it has a 'struct device'
embedded. Thus, having a release callback for it is correct.
Allocating the vm_dev struct with devres totally breaks this protection,
though. Instead of waiting for the vm_dev release callback, the memory
is freed when the platform_device is removed. Resulting in a
use-after-free when finally the callback is to be called.
To easily see the problem, compile the kernel with
CONFIG_DEBUG_KOBJECT_RELEASE and unbind with sysfs.
The fix is easy, don't use devres in this case.
Found during my research about object lifetime problems.
📍 영향받는 시스템
Linux 커널 (virtio-mmio 드라이버를 사용하는 버전, 수정 커밋 적용 전 커널 전반)
⚔️ 공격 벡터
로컬 권한 사용자가 sysfs를 통해 장치를 unbind하여 해제된 메모리를 재사용하도록 유도하는 방식으로 악용될 수 있음
🛡️ 대응 방법
커널을 CVE-2023-53515 수정이 포함된 최신 안정 버전 또는 배포판 보안 업데이트로 갱신
🔧 검증 코드
출력된 커널 버전을 배포판 보안 공지 또는 커널 changelog에서 해당 수정 커밋 포함 여부와 비교하고, virtio_mmio 모듈이 로드되지 않았다면 이 취약점의 영향을 받지 않습니다.
uname -r && (grep -i virtio_mmio /proc/modules 2>/dev/null || echo 'virtio_mmio not loaded')