Skip to content

Commit

Permalink
alloc: Remove alloc_error_handler
Browse files Browse the repository at this point in the history
The experimental alloc_error_handler feature was removed in Rust 1.71.0.
Starting from 1.71.0, Rust will panic when there's an allocation error
(OOM), which is the expected behaviour in SVSM (it will call the
SVSM-defined panic handler).

Remove alloc_error_handler mentions, and declare 1.71 as the minimal
Rust version for building linux-svsm.

Signed-off-by: Dov Murik <[email protected]>
  • Loading branch information
dubek committed Apr 27, 2023
1 parent cbf4fc1 commit 298a2a1
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 7 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ name = "linux_svsm"
authors = ["Tom Lendacky <[email protected]>", "Carlos Bilbao <[email protected]>"]
version = "0.1.0"
edition = "2021"
rust-version = "1.71"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#![feature(type_ascription)]
#![feature(abi_x86_interrupt)]
#![feature(alloc_error_handler)]
// Disable the (implicitly-linked) standard library. #! defines behavior of the current module; as
// we are in root, the entire crate is affected.
#![no_std]
Expand Down
6 changes: 0 additions & 6 deletions src/mem/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1141,12 +1141,6 @@ unsafe impl GlobalAlloc for SvsmAllocator {
#[cfg_attr(not(test), global_allocator)]
pub static mut ALLOCATOR: SvsmAllocator = SvsmAllocator::new();

#[cfg(not(test))]
#[alloc_error_handler]
fn alloc_error_handler(layout: alloc::alloc::Layout) -> ! {
panic!("Allocation failed: {:?}\n", layout)
}

/// Create a stack of size stack_pages and add a guard page
/// also make the stack user accessible if needed
pub fn mem_create_stack(stack_pages: u64, user_space: bool) -> VirtAddr {
Expand Down

0 comments on commit 298a2a1

Please sign in to comment.