Skip to content

Commit 19a3dac

Browse files
committed
fix(guest): drop nomem from out32 OUT-trap asm
The OUT traps to the host, which writes the shared input and output stacks before resuming. nomem lets LLVM cache or reorder shared-memory loads across the trap and read stale bytes after the host call. Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
1 parent d6b80da commit 19a3dac

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • src/hyperlight_guest/src/arch/amd64

src/hyperlight_guest/src/arch/amd64/exit.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub(crate) unsafe fn out32(port: u16, val: u32) {
3838
in("r8") OutBAction::TraceBatch as u64,
3939
in("r9") ptr,
4040
in("r10") len,
41-
options(preserves_flags, nomem, nostack)
41+
options(preserves_flags, nostack)
4242
)
4343
};
4444

@@ -49,12 +49,12 @@ pub(crate) unsafe fn out32(port: u16, val: u32) {
4949
} else {
5050
// If tracing is not enabled, just send the value
5151
unsafe {
52-
asm!("out dx, eax", in("dx") port, in("eax") val, options(preserves_flags, nomem, nostack))
52+
asm!("out dx, eax", in("dx") port, in("eax") val, options(preserves_flags, nostack))
5353
};
5454
}
5555
}
5656
#[cfg(not(feature = "trace_guest"))]
5757
unsafe {
58-
asm!("out dx, eax", in("dx") port, in("eax") val, options(preserves_flags, nomem, nostack));
58+
asm!("out dx, eax", in("dx") port, in("eax") val, options(preserves_flags, nostack));
5959
}
6060
}

0 commit comments

Comments
 (0)