# GHSA-3qx8-rv27-j6gp: Undefined behaviour in `kvm_ioctls::ioctls::vm::VmFd::create_device`

- Severity: Medium (rating, scored by GitHub)
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2024-12-05T12:00:00.000Z
- Modified: 2025-10-28T06:29:22.787Z
- Also known as: RUSTSEC-2024-0428
- Weaknesses: CWE-843

## Description

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.

(As written by GitHub Advisory Database.)

## Affected

- kvm-ioctls (crates.io): before 0.19.1; from 0.0.0-0 before 0.19.1

## References

- <https://github.com/rust-vmm/kvm/pull/298> (web)
- <https://github.com/rust-vmm/kvm-ioctls> (package)
- <https://rustsec.org/advisories/RUSTSEC-2024-0428.html> (advisory, web)
- <https://crates.io/crates/kvm-ioctls> (package)

## Sources

- GitHub Advisory Database: [GHSA-3qx8-rv27-j6gp](https://github.com/advisories/GHSA-3qx8-rv27-j6gp), CC-BY-4.0, modified 2025-10-28
- RustSec Advisory Database: [RUSTSEC-2024-0428](https://rustsec.org/advisories/RUSTSEC-2024-0428.html), CC0-1.0, modified 2025-10-28

---

Page: https://cve.day/GHSA-3qx8-rv27-j6gp · Whole record: https://cve.day/GHSA-3qx8-rv27-j6gp.json · Rebuilt by cve.day 2026-11-25T22:56:43.232Z
