From 8a0dc11a32ba3b52e4c321decd0e8a042d45d24b Mon Sep 17 00:00:00 2001 From: Ben Westover Date: Sun, 19 Jul 2026 01:33:07 -0400 Subject: [PATCH] Upgrade to rand 0.10 Signed-off-by: Ben Westover --- Cargo.lock | 14 +++++++------- src/devices/Cargo.toml | 2 +- src/devices/src/virtio/rng/device.rs | 4 ++-- src/devices/src/virtio/vsock/muxer_thread.rs | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f3d33d9..5392105 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -681,7 +681,7 @@ dependencies = [ "log", "lru", "nix 0.30.1", - "rand 0.9.2", + "rand 0.10.2", "thiserror 2.0.18", "vhost", "virtio-bindings", @@ -998,7 +998,7 @@ dependencies = [ "bitflags 2.11.0", "libc", "nix 0.26.4", - "rand 0.9.2", + "rand 0.9.5", "vsock", ] @@ -1175,9 +1175,9 @@ checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" [[package]] name = "rand" -version = "0.9.2" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" dependencies = [ "rand_chacha", "rand_core 0.9.5", @@ -1185,9 +1185,9 @@ dependencies = [ [[package]] name = "rand" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2e8e8bcc7961af1fdac401278c6a831614941f6164ee3bf4ce61b7edb162207" +checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80" dependencies = [ "chacha20", "getrandom 0.4.2", @@ -1585,7 +1585,7 @@ checksum = "a68d3c8f01c0cfa54a75291d83601161799e4a89a39e0929f4b0354d88757a37" dependencies = [ "getrandom 0.4.2", "js-sys", - "rand 0.10.1", + "rand 0.10.2", "wasm-bindgen", ] diff --git a/src/devices/Cargo.toml b/src/devices/Cargo.toml index f7b0127..8f70a33 100644 --- a/src/devices/Cargo.toml +++ b/src/devices/Cargo.toml @@ -28,7 +28,7 @@ crossbeam-channel = ">=0.5.15" libc = ">=0.2.39" libloading = "0.8" log = "0.4.0" -rand = "0.9.2" +rand = "0.10.2" thiserror = { version = "2.0", optional = true } vhost = { version = "0.15", optional = true, features = ["vhost-user-frontend"] } vmm-sys-util = { version = "0.15", optional = true } diff --git a/src/devices/src/virtio/rng/device.rs b/src/devices/src/virtio/rng/device.rs index b8f25ec..4e21fdc 100644 --- a/src/devices/src/virtio/rng/device.rs +++ b/src/devices/src/virtio/rng/device.rs @@ -1,4 +1,4 @@ -use rand::{TryRngCore, rngs::OsRng}; +use rand::{TryRng, rngs::SysRng}; use utils::eventfd::EventFd; use vm_memory::{Bytes, GuestMemoryMmap}; @@ -60,7 +60,7 @@ impl Rng { let mut written = 0; for desc in head.into_iter() { let mut rand_bytes = vec![0u8; desc.len as usize]; - if let Err(e) = OsRng.try_fill_bytes(&mut rand_bytes) { + if let Err(e) = SysRng.try_fill_bytes(&mut rand_bytes) { error!("Failed to fill buffer with random data: {e:?}"); queues[REQ_INDEX].queue.go_to_previous_position(); break; diff --git a/src/devices/src/virtio/vsock/muxer_thread.rs b/src/devices/src/virtio/vsock/muxer_thread.rs index 1db435c..cf0c98a 100644 --- a/src/devices/src/virtio/vsock/muxer_thread.rs +++ b/src/devices/src/virtio/vsock/muxer_thread.rs @@ -14,7 +14,7 @@ use crate::virtio::InterruptTransport; use crate::virtio::vsock::defs; use crate::virtio::vsock::unix::{UnixAcceptorProxy, UnixProxy}; use crossbeam_channel::Sender; -use rand::{Rng, rng, rngs::ThreadRng}; +use rand::{RngExt, rng, rngs::ThreadRng}; use utils::epoll::{ControlOperation, Epoll, EpollEvent, EventSet}; use vm_memory::GuestMemoryMmap; -- 2.51.2