Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 40 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/hyperlight_host/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ workspace = true

[dependencies]
goblin = { version = "0.9" }
rand = { version = "0.8.5" }
rand = { version = "0.9" }
cfg-if = { version = "1.0.0" }
libc = { version = "0.2.169" }
paste = "1.0"
Expand Down
4 changes: 2 additions & 2 deletions src/hyperlight_host/examples/otlp_tracing/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ fn run_example(wait_input: bool) -> HyperlightResult<()> {
multiuse_sandbox = result.unwrap();
}
let sleep_for = {
let mut rng = rand::thread_rng();
rng.gen_range(500..3000)
let mut rng = rand::rng();
rng.random_range(500..3000)
};
thread::sleep(std::time::Duration::from_millis(sleep_for));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ mod tests {
use std::time::{Duration, Instant};

use hyperlight_common::mem::PAGE_SIZE_USIZE;
use rand::{thread_rng, Rng};
use rand::{rng, Rng};
use serial_test::serial;
use windows::Win32::Foundation::{CloseHandle, BOOL, HANDLE, INVALID_HANDLE_VALUE};
use windows::Win32::System::Diagnostics::ToolHelp::{
Expand All @@ -439,7 +439,7 @@ mod tests {
for t in 0..NUMBER_OF_SURROGATE_PROCESSES * 2 {
let thread_handle = thread::spawn(move || -> Result<()> {
let surrogate_process_manager_res = get_surrogate_process_manager();
let mut rng = thread_rng();
let mut rng = rng();
let size = PAGE_SIZE_USIZE * 3;
assert!(surrogate_process_manager_res.is_ok());
let surrogate_process_manager = surrogate_process_manager_res.unwrap();
Expand Down Expand Up @@ -490,7 +490,7 @@ mod tests {
}

// in real use the process will not get returned immediately
let n: u64 = rng.gen_range(1..16);
let n: u64 = rng.random_range(1..16);
thread::sleep(Duration::from_millis(n));
// dropping the surrogate process, as we do in the line
// below, will return it to the surrogate process manager
Expand Down
6 changes: 2 additions & 4 deletions src/hyperlight_host/src/mem/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

use std::fmt::Debug;
use std::mem::{offset_of, size_of};

use hyperlight_common::mem::{GuestStackData, HyperlightPEB, RunMode, PAGE_SIZE_USIZE};
use paste::paste;
use rand::rngs::OsRng;
use rand::RngCore;
use rand::{rng, RngCore};
use tracing::{instrument, Span};

use super::memory_region::MemoryRegionType::{
Expand Down Expand Up @@ -1100,7 +1098,7 @@ impl SandboxMemoryLayout {

// Set up the security cookie seed
let mut security_cookie_seed = [0u8; 8];
OsRng.fill_bytes(&mut security_cookie_seed);
rng().fill_bytes(&mut security_cookie_seed);
shared_mem.copy_from_slice(&security_cookie_seed, self.peb_security_cookie_seed_offset)?;

// Skip guest_dispatch_function_ptr_offset because it is set by the guest
Expand Down
4 changes: 2 additions & 2 deletions src/hyperlight_host/src/sandbox/uninitialized_evolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ fn hv_init(
let outb_hdl = outb_handler_wrapper(hshm.clone(), host_funcs);
let mem_access_hdl = mem_access_handler_wrapper(hshm.clone());
let seed = {
let mut rng = rand::thread_rng();
rng.gen::<u64>()
let mut rng = rand::rng();
rng.random::<u64>()
};
let peb_addr = {
let peb_u64 = u64::try_from(gshm.layout.peb_address)?;
Expand Down
Loading