Skip to content

Commit 39f79d8

Browse files
committed
Merge branch 'main' into vm_trait
2 parents 31bfc5a + e63a0cc commit 39f79d8

File tree

38 files changed

+115
-416
lines changed

38 files changed

+115
-416
lines changed

Cargo.lock

Lines changed: 23 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ fn main() -> hyperlight_host::Result<()> {
4242
// Create an uninitialized sandbox with a guest binary
4343
let mut uninitialized_sandbox = UninitializedSandbox::new(
4444
hyperlight_host::GuestBinary::FilePath(hyperlight_testing::simple_guest_as_string().unwrap()),
45-
None, // default configuration
46-
None, // default run options
45+
None // default configuration
4746
)?;
4847

4948
// Registering a host function makes it available to be called by the guest

fuzz/fuzz_targets/guest_call.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ fuzz_target!(
3535
let u_sbox = UninitializedSandbox::new(
3636
GuestBinary::FilePath(simple_guest_for_fuzzing_as_string().expect("Guest Binary Missing")),
3737
None,
38-
None,
3938
)
4039
.unwrap();
4140

fuzz/fuzz_targets/host_call.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ fuzz_target!(
3333
init: {
3434
let u_sbox = UninitializedSandbox::new(
3535
GuestBinary::FilePath(simple_guest_for_fuzzing_as_string().expect("Guest Binary Missing")),
36-
None,
37-
None,
36+
None
3837
)
3938
.unwrap();
4039

fuzz/fuzz_targets/host_print.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ fuzz_target!(
2121
let u_sbox = UninitializedSandbox::new(
2222
GuestBinary::FilePath(simple_guest_for_fuzzing_as_string().expect("Guest Binary Missing")),
2323
None,
24-
None,
2524
)
2625
.unwrap();
2726

src/hyperlight_common/src/mem.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,6 @@ pub const PAGE_SIZE_USIZE: usize = 1 << 12;
2222

2323
use core::ffi::{c_char, c_void};
2424

25-
#[repr(u64)]
26-
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
27-
pub enum RunMode {
28-
None = 0,
29-
Hypervisor = 1,
30-
InProcessWindows = 2,
31-
InProcessLinux = 3,
32-
Invalid = 4,
33-
}
34-
3525
#[repr(C)]
3626
pub struct InputData {
3727
pub inputDataSize: u64,
@@ -67,9 +57,6 @@ pub struct HyperlightPEB {
6757
pub security_cookie_seed: u64,
6858
pub guest_function_dispatch_ptr: u64,
6959
pub pCode: *mut c_char,
70-
pub pOutb: *mut c_void,
71-
pub pOutbContext: *mut c_void,
72-
pub runMode: RunMode,
7360
pub inputdata: InputData,
7461
pub outputdata: OutputData,
7562
pub guestheapData: GuestHeapData,

src/hyperlight_guest/src/chkstk.rs

Lines changed: 3 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,9 @@ limitations under the License.
1515
*/
1616

1717
use core::arch::global_asm;
18-
use core::mem::size_of;
1918

20-
use hyperlight_common::mem::RunMode;
21-
22-
use crate::guest_error::{set_invalid_runmode_error, set_stack_allocate_error};
23-
use crate::{MIN_STACK_ADDRESS, RUNNING_MODE};
19+
use crate::guest_error::set_stack_allocate_error;
20+
use crate::MIN_STACK_ADDRESS;
2421

2522
extern "win64" {
2623
fn __chkstk();
@@ -35,21 +32,6 @@ global_asm!(
3532
push r10
3633
push r11
3734
38-
/* Load run_mode into r10 */
39-
mov r10, qword ptr [rip+{run_mode}]
40-
41-
cmp r10, 0
42-
je handle_none
43-
cmp r10, 1
44-
je handle_hypervisor
45-
cmp r10, 2
46-
je handle_inproc_windows
47-
cmp r10, 3
48-
je handle_inproc_linux
49-
/* run_mode > 3 (invalid), so treat like handle_none */
50-
jmp handle_invalid
51-
52-
handle_hypervisor:
5335
/* Load the minimum stack address from the PEB */
5436
mov r11, [rip+{min_stack_addr}]
5537
@@ -72,49 +54,11 @@ global_asm!(
7254
call {set_error}
7355
hlt
7456
75-
handle_inproc_windows:
76-
/* Get the current stack pointer */
77-
lea r10, [rsp + 0x18]
78-
79-
/* Calculate what the new stack pointer will be */
80-
sub r10, rax
81-
cmovb r10, r11
82-
mov r11, qword ptr gs:[0x0000000000000010]
83-
cmp r10, r11
84-
jae cs_ret
85-
and r10w, 0x0F000
86-
csip_stackprobe:
87-
lea r11, [r11 + 0x0FFFFFFFFFFFFF000]
88-
mov byte ptr [r11], 0
89-
cmp r10, r11
90-
jne csip_stackprobe
9157
cs_ret:
9258
/* Restore RAX, R11 */
9359
pop r11
9460
pop r10
95-
ret
96-
handle_inproc_linux:
97-
/* no-op */
98-
jmp cs_ret
99-
handle_none:
100-
/* no-op. This can entrypoint has a large stack allocation
101-
before RunMode variable is set */
102-
jmp cs_ret
103-
handle_invalid:
104-
call {invalid_runmode}",
105-
run_mode = sym RUNNING_MODE,
61+
ret",
10662
min_stack_addr = sym MIN_STACK_ADDRESS,
10763
set_error = sym set_stack_allocate_error,
108-
invalid_runmode = sym set_invalid_runmode_error
10964
);
110-
111-
// Assumptions made in implementation above. If these are no longer true, compilation will fail
112-
// and the developer will need to update the assembly code.
113-
const _: () = {
114-
assert!(size_of::<RunMode>() == size_of::<u64>());
115-
assert!(RunMode::None as u64 == 0);
116-
assert!(RunMode::Hypervisor as u64 == 1);
117-
assert!(RunMode::InProcessWindows as u64 == 2);
118-
assert!(RunMode::InProcessLinux as u64 == 3);
119-
assert!(RunMode::Invalid as u64 == 4);
120-
};

0 commit comments

Comments
 (0)