🇰🇷 한글 설명
Linux 커널의 virt: vmgenid 드라이버에서 notification handler를 등록하기 전에 driver_data를 설정하지 않아 발생하는 취약점입니다. 이로 인해 핸들러가 실행될 때 NULL 포인터를 참조하게 되어 커널 패닉(Kernel Panic)이 발생할 수 있습니다.
💡 쉬운 설명
장치가 준비되기도 전에 알림 신호가 먼저 도착하면, 컴퓨터가 존재하지 않는 정보를 읽으려다 시스템이 멈춰버리는 문제입니다. 특히 가상 머신을 복구하는 과정에서 이 문제가 발생할 가능성이 높습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
virt: vmgenid: set driver_data before registering notification handlers
Both probe paths register their notification handler before assigning
driver_data, which the handler dereferences.
In the devicetree path, the notification IRQ can fire as soon as
devm_request_irq() registers the handler: the interrupt may already be
pending at probe time, for example when a VMM injects the
generation-changed notification while restoring a guest from a snapshot
that was taken before the driver had probed (Firecracker does exactly
this on snapshot restore). The IRQ is also requested with IRQF_SHARED,
so another device sharing the line can trigger the handler just as
early. The handler then calls vmgenid_notify(), which dereferences the
still-NULL driver_data and panics:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010
CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.18.38+ #1 PREEMPT(none)
Hardware name: linux,dummy-virt (DT)
pc : vmgenid_notify.isra.0+0x24/0x8c
lr : vmgenid_of_irq_handler+0x14/0x34
Call trace:
vmgenid_notify.isra.0+0x24/0x8c (P)
vmgenid_of_irq_handler+0x14/0x34
__handle_irq_event_percpu+0x44/0x1bc
handle_irq_event+0x4c/0xb4
handle_fasteoi_irq+0xf8/0x1f8
The ACPI path has the same ordering problem: the handler is installed
with acpi_install_notify_handler() before driver_data is assigned.
ACPI notifications are dispatched asynchronously from a workqueue, so
the window is narrow, but a notification arriving between the two calls
hits the same NULL dereference.
Assign driver_data before registering the handlers. The state is fully
initialized at that point, so the handlers are safe to run. Should
registration fail, the probe error path leaves no dangling pointer
behind: the driver core clears driver_data in device_unbind_cleanup().
📍 영향받는 시스템
Linux kernel (virt: vmgenid driver 사용 환경)
⚔️ 공격 벡터
가상 머신 스냅샷 복구 시 또는 공유 인터럽트 발생을 통한 의도적인 커널 패닉 유도
🛡️ 대응 방법
커널 패치를 적용하여 notification handler 등록 전에 driver_data를 먼저 할당하도록 수정해야 합니다.
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 취약점이 해결된 패치 버전인지 확인합니다.