🇰🇷 한글 설명
Linux 커널의 mshv 구성 요소에서 VP(Virtual Processor) 구조체를 초기화하고 배열에 등록하는 과정 중 메모리 순서 보장 문제가 발견되었습니다. 약한 메모리 순서(weakly-ordered)를 사용하는 아키텍처에서 초기화가 완료되지 않은 포인터를 참조하여 부분적으로 초기화된 데이터를 사용할 수 있는 레이스 컨디션 취약점입니다.
💡 쉬운 설명
컴퓨터가 새로운 가상 프로세서를 만들 때, 준비가 덜 끝난 상태의 정보를 다른 기능이 미리 읽어버려서 발생하는 오류입니다. 이로 인해 시스템이 잘못된 정보를 읽어 불안정해지거나 오류가 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
mshv: Order pt_vp_array publish against irqfd assertion path
mshv_partition_ioctl_create_vp() initialises a VP struct (allocations,
mutex_init, init_waitqueue_head, page mappings) and then publishes the
pointer into partition->pt_vp_array. Several ISR paths read this array
locklessly: the intercept ISR, the two scheduler ISRs, and
mshv_try_assert_irq_fast() on the irqfd fast path.
Of these, only mshv_try_assert_irq_fast() can structurally race the
publish. It runs from an eventfd waker without holding pt_mutex, and
MSHV_IRQFD does not require the target lapic_apic_id (== vp_index) to
refer to an existing VP at registration time. A user can therefore
register an irqfd targeting a yet-to-be-created VP, then trigger
mshv_try_assert_irq_fast() concurrently with MSHV_CREATE_VP for the
same index. On weakly-ordered architectures the reader can observe a
non-NULL pointer in pt_vp_array before the initialising stores to the
VP struct become visible, leading to use of partially-initialised
fields (e.g. vp_register_page).
The other ISR readers cannot reach this race: the hypervisor will not
generate intercept or scheduler messages for a VP that has never been
told to run, and the user can only call MSHV_RUN_VP on the VP fd
returned by MSHV_CREATE_VP, which by construction is returned after
the publish. Leave those readers as plain loads.
Use smp_store_release() in mshv_partition_ioctl_create_vp() to publish
the pointer, and pair it with smp_load_acquire() in
mshv_try_assert_irq_fast(). On x86 these compile to plain accesses
under TSO; on ARM64 they emit one-instruction acquire/release barriers,
acceptable on this fast path.
The destroy-side path (destroy_partition() clearing pt_vp_array[i] to
NULL after kfree(vp)) has a separate ordering and lifetime concern
that is out of scope here.
📍 영향받는 시스템
Linux kernel (mshv 구성 요소가 포함된 버전)
⚔️ 공격 벡터
사용자가 irqfd를 등록한 상태에서 동시에 VP 생성 요청을 보내 메모리 순서 불일치를 유도하는 레이스 컨디션 공격
🛡️ 대응 방법
mshv_partition_ioctl_create_vp()에 smp_store_release()를 적용하고, mshv_try_assert_irq_fast()에 smp_load_acquire()를 적용하여 메모리 가시성을 보장하는 커널 패치 적용
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 해당 취약점이 해결된 패치 버전인지 확인합니다.