Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RUSTSEC-2024-0428: Undefined behaviour in kvm_ioctls::ioctls::vm::VmFd::create_device #123

Open
github-actions bot opened this issue Dec 23, 2024 · 0 comments · May be fixed by #124
Open

RUSTSEC-2024-0428: Undefined behaviour in kvm_ioctls::ioctls::vm::VmFd::create_device #123

github-actions bot opened this issue Dec 23, 2024 · 0 comments · May be fixed by #124

Comments

@github-actions
Copy link

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

Details
Status unsound
Package kvm-ioctls
Version 0.19.0
URL rust-vmm/kvm#298
Date 2024-12-05

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.

See advisory page for additional details.

@ludfjig ludfjig linked a pull request Dec 26, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

0 participants