Skip to content

Commit

Permalink
Update Rust to 2024-02-01
Browse files Browse the repository at this point in the history
This seems to require minimal changes.

Change-Id: I00dd9c4773a929a0877767c2eeef5f0d7edf79e4
  • Loading branch information
andrisaar authored and tiziano88 committed Apr 9, 2024
1 parent 94d15d9 commit 55e4fea
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
includeSystemImages = false;
}).androidsdk;
rustToolchain =
pkgs.rust-bin.nightly."2023-11-15".default.override {
pkgs.rust-bin.nightly."2024-02-01".default.override {
extensions = [
"clippy"
"llvm-tools-preview"
Expand Down
2 changes: 1 addition & 1 deletion oak_functions_containers_app/src/native_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct RequestContext {
}

thread_local! {
static CONTEXT: RefCell<Option<RequestContext>> = RefCell::new(None);
static CONTEXT: RefCell<Option<RequestContext>> = const { RefCell::new(None) };
}

// Callbacks for the C side.
Expand Down
4 changes: 3 additions & 1 deletion oak_restricted_kernel/src/ghcb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
// limitations under the License.
//

use core::ptr::addr_of;

use oak_core::sync::OnceCell;
use oak_sev_guest::{
ghcb::{Ghcb, GhcbProtocol},
Expand Down Expand Up @@ -166,7 +168,7 @@ fn get_identity_mapped_encrypted_page_table<'a>()
fn get_ghcb_page() -> Page<Size2MiB> {
// Safety: the reference to a mutable static is safe, as we only use it to
// calculate a virtual address and don't dereference it.
let ghcb_pointer = unsafe { &GHCB_WRAPPER as *const GhcbAlignmentWrapper };
let ghcb_pointer = unsafe { addr_of!(GHCB_WRAPPER) };
let ghcb_address = VirtAddr::from_ptr(ghcb_pointer);
Page::<Size2MiB>::from_start_address(ghcb_address).expect("invalid start address for GHCB page")
}
1 change: 0 additions & 1 deletion oak_sev_guest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
//! manage page state and interact with the hypervisor and the secure processor.
#![no_std]
#![feature(offset_of)]

use x86_64::{PhysAddr, VirtAddr};

Expand Down
9 changes: 5 additions & 4 deletions stage0/src/paging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
//

use alloc::boxed::Box;
use core::ptr::addr_of_mut;

use oak_core::sync::OnceCell;
use spinning_top::Spinlock;
Expand Down Expand Up @@ -62,10 +63,10 @@ pub fn init_page_table_refs(encrypted: u64) {
// Safety: accessing the mutable statics here is safe since we only do it once
// and protect the mutable references with a mutex. This function can only
// be called once, since updating `PAGE_TABLE_REFS` twice will panic.
let pml4 = unsafe { &mut PML4 };
let pdpt = unsafe { &mut PDPT };
let pd_0 = unsafe { &mut PD_0 };
let pd_3 = unsafe { &mut PD_3 };
let pml4 = unsafe { &mut *addr_of_mut!(PML4) };
let pdpt = unsafe { &mut *addr_of_mut!(PDPT) };
let pd_0 = unsafe { &mut *addr_of_mut!(PD_0) };
let pd_3 = unsafe { &mut *addr_of_mut!(PD_3) };

// Set up a new page table that maps the first 2MiB as 4KiB pages, so that we
// can share individual 4KiB pages with the hypervisor as needed. We are
Expand Down

0 comments on commit 55e4fea

Please sign in to comment.