Add a defensive loop to entry::exit()
This is defensive in case the host manages to resume the enclave during
an exit() syscall. If so, this syscall will be repeated endlessly.
@@ -6,13 +6,14 @@ use goblin::elf::header::{header64::Header, ELFMAG};
use crate::Layout;
fn exit(code: usize) -> ! {
+ loop {
unsafe {
asm!(
"syscall",
in("rax") libc::SYS_exit,
- in("rdi") code,
- options(noreturn)
- )
+ in("rdi") code
+ );
+ }
}
}
