Advisory

RUSTSEC-2024-0428

Also known as: GHSA-3qx8-rv27-j6gp

Summary

Undefined behaviour in kvm_ioctls::ioctls::vm::VmFd::create_device

Details

An issue was identified in the VmFd::create_device function, leading to undefined behavior and miscompilations on rustc 1.82.0 and newer due to the function's violation of Rust's pointer safety rules.

The function downcasted a mutable reference to its struct kvm_create_device argument to an immutable pointer, and then proceeded to pass this pointer to a mutating system call. Rustc 1.82.0 and newer elides subsequent reads of this structure's fields, meaning code will not see the value written by the kernel into the fd member. Instead, the code will observe the value that this field was initialized to prior to calling VmFd::create_device (usually, 0).

The issue started in kvm-ioctls 0.1.0 and was fixed in 0.19.1 by correctly using
a mutable pointer.

Severity

Not rated by the source.

Dates

Published
2024-12-05 12:00 UTC
Modified
2025-10-28 06:29 UTC

Affected packages and fixes

kvm-ioctls

crates.io · All systems

Affected

  • introduced 0.0.0-0, fixed 0.19.1 (semver)

Fixed versions

0.19.1

Fix

  • Fixed version 0.19.1
    cargo update -p kvm-ioctls --precise 0.19.1

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: RustSec Advisory Database · CC0-1.0

Sources & licences