vmbase: Initialize heap in rust_entry
Initialize the heap as we enter Rust so that any code that follows can
make use of alloc, preventing bugs such as aosp/2567870 where client
code used the heap before initializing it.
Test: TH
Change-Id: Ibe6629a22cd828d8b9c6418b91b5971dbbeb4c3d
diff --git a/pvmfw/src/entry.rs b/pvmfw/src/entry.rs
index 56f9462..10a3e5a 100644
--- a/pvmfw/src/entry.rs
+++ b/pvmfw/src/entry.rs
@@ -31,7 +31,7 @@
use log::LevelFilter;
use vmbase::util::RangeExt as _;
use vmbase::{
- configure_global_allocator_size, console, heap,
+ configure_global_allocator_size, console,
layout::{self, crosvm},
logger, main,
memory::{min_dcache_line_size, MemoryTracker, MEMORY, SIZE_128KB, SIZE_4KB},
@@ -69,9 +69,6 @@
// - can't access non-pvmfw memory (only statically-mapped memory)
// - can't access MMIO (therefore, no logging)
- // SAFETY - This function should and will only be called once, here.
- unsafe { heap::init() };
-
match main_wrapper(fdt_address as usize, payload_start as usize, payload_size as usize) {
Ok((entry, bcc)) => jump_to_payload(fdt_address, entry.try_into().unwrap(), bcc),
Err(_) => reboot(), // TODO(b/220071963) propagate the reason back to the host.