pub trait Handler {
Show 79 methods fn sally(&mut self) -> Result<()>; fn block(&self) -> &[usize]; fn block_mut(&mut self) -> &mut [usize]; fn thread_local_storage(&mut self) -> &mut ThreadLocalStorage; fn arch_prctl(
        &mut self,
        platform: &impl Platform,
        code: c_int,
        addr: c_ulong
    ) -> Result<()>; fn brk(
        &mut self,
        platform: &impl Platform,
        addr: Option<NonNull<c_void>>
    ) -> Result<NonNull<c_void>>; fn madvise(
        &mut self,
        platform: &impl Platform,
        addr: NonNull<c_void>,
        length: c_size_t,
        advice: c_int
    ) -> Result<()>; fn mmap(
        &mut self,
        platform: &impl Platform,
        addr: Option<NonNull<c_void>>,
        length: c_size_t,
        prot: c_int,
        flags: c_int,
        fd: c_int,
        offset: off_t
    ) -> Result<NonNull<c_void>>; fn mprotect(
        &mut self,
        platform: &impl Platform,
        addr: NonNull<c_void>,
        len: c_size_t,
        prot: c_int
    ) -> Result<()>; fn munmap(
        &mut self,
        platform: &impl Platform,
        addr: NonNull<c_void>,
        length: c_size_t
    ) -> Result<()>; fn execute<'a, K: Kind, T: Call<'a, K>>(
        &mut self,
        call: T
    ) -> Result<T::Collected> { ... } fn attacked(&mut self) -> ! { ... } fn accept<'a>(
        &mut self,
        sockfd: c_int,
        addr: Option<impl Into<SockaddrOutput<'a>>>
    ) -> Result<c_int> { ... } fn accept4<'a>(
        &mut self,
        sockfd: c_int,
        addr: Option<impl Into<SockaddrOutput<'a>>>,
        flags: c_int
    ) -> Result<c_int> { ... } fn bind<'a>(
        &mut self,
        sockfd: c_int,
        addr: impl Into<SockaddrInput<'a>>
    ) -> Result<()> { ... } fn clock_getres(
        &mut self,
        clockid: clockid_t,
        res: Option<&mut timespec>
    ) -> Result<()> { ... } fn clock_gettime(
        &mut self,
        clockid: clockid_t,
        tp: &mut timespec
    ) -> Result<()> { ... } fn close(&mut self, fd: c_int) -> Result<()> { ... } fn connect<'a>(
        &mut self,
        sockfd: c_int,
        addr: impl Into<SockaddrInput<'a>>
    ) -> Result<()> { ... } fn dup(&mut self, oldfd: c_int) -> Result<()> { ... } fn dup2(&mut self, oldfd: c_int, newfd: c_int) -> Result<()> { ... } fn dup3(&mut self, oldfd: c_int, newfd: c_int, flags: c_int) -> Result<()> { ... } fn epoll_create1(&mut self, flags: c_int) -> Result<c_int> { ... } fn epoll_ctl(
        &mut self,
        epfd: c_int,
        op: c_int,
        fd: c_int,
        event: &epoll_event
    ) -> Result<()> { ... } fn epoll_wait(
        &mut self,
        epfd: c_int,
        events: &mut [epoll_event],
        timeout: c_int
    ) -> Result<c_int> { ... } fn epoll_pwait(
        &mut self,
        epfd: c_int,
        events: &mut [epoll_event],
        timeout: c_int,
        sigmask: &sigset_t
    ) -> Result<c_int> { ... } fn eventfd2(&mut self, initval: c_int, flags: c_int) -> Result<c_int> { ... } fn exit(&mut self, status: c_int) -> Result<()> { ... } fn exit_group(&mut self, status: c_int) -> Result<()> { ... } fn fcntl(&mut self, fd: c_int, cmd: c_int, arg: c_int) -> Result<c_int> { ... } fn fstat(&mut self, fd: c_int, statbuf: &mut stat) -> Result<()> { ... } fn getegid(&mut self) -> Result<gid_t> { ... } fn geteuid(&mut self) -> Result<uid_t> { ... } fn getgid(&mut self) -> Result<gid_t> { ... } fn getpid(&mut self) -> Result<pid_t> { ... } fn getrandom(&mut self, buf: &mut [u8], flags: c_uint) -> Result<c_size_t> { ... } fn getsockname<'a>(
        &mut self,
        sockfd: c_int,
        addr: impl Into<SockaddrOutput<'a>>
    ) -> Result<()> { ... } fn getuid(&mut self) -> Result<uid_t> { ... } fn ioctl(
        &mut self,
        fd: c_int,
        request: Ioctl,
        argp: Option<&mut [u8]>
    ) -> Result<c_int> { ... } fn listen(&mut self, sockfd: c_int, backlog: c_int) -> Result<()> { ... } fn mremap(
        &mut self,
        platform: &impl Platform,
        old_address: NonNull<c_void>,
        old_size: c_size_t,
        new_size: c_size_t,
        flags: Option<MremapFlags>
    ) -> Result<NonNull<c_void>> { ... } fn nanosleep(
        &mut self,
        req: &timespec,
        rem: Option<&mut timespec>
    ) -> Result<()> { ... } fn open(
        &mut self,
        pathname: &[u8],
        flags: c_int,
        mode: Option<mode_t>
    ) -> Result<c_int> { ... } fn poll(&mut self, fds: &mut [pollfd], timeout: c_int) -> Result<c_int> { ... } fn read(&mut self, fd: c_int, buf: &mut [u8]) -> Result<c_size_t> { ... } fn readlink(&mut self, pathname: &[u8], buf: &mut [u8]) -> Result<c_size_t> { ... } fn readv<T: ?Sized, U, V>(
        &mut self,
        fd: c_int,
        iovs: &mut T
    ) -> Result<c_size_t>
    where
        for<'a> &'a T: IntoIterator<Item = &'a U>,
        for<'a> &'a mut T: IntoIterator<Item = &'a mut V>,
        U: AsRef<[u8]>,
        V: AsMut<[u8]>
, { ... } fn recv(
        &mut self,
        sockfd: c_int,
        buf: &mut [u8],
        flags: c_int
    ) -> Result<c_size_t> { ... } fn recvfrom<'a>(
        &mut self,
        sockfd: c_int,
        buf: &'a mut [u8],
        flags: c_int,
        src_addr: impl Into<SockaddrOutput<'a>>
    ) -> Result<c_size_t> { ... } fn rt_sigaction(
        &mut self,
        signum: c_int,
        act: Option<&sigaction>,
        oldact: Option<&mut Option<sigaction>>,
        sigsetsize: c_size_t
    ) -> Result<()> { ... } fn rt_sigprocmask(
        &mut self,
        how: c_int,
        set: Option<&sigset_t>,
        oldset: Option<&mut sigset_t>,
        sigsetsize: c_size_t
    ) -> Result<()> { ... } fn send(&mut self, sockfd: c_int, buf: &[u8], flags: c_int) -> Result<c_size_t> { ... } fn sendto<'a>(
        &mut self,
        sockfd: c_int,
        buf: &'a [u8],
        flags: c_int,
        dest_addr: impl Into<SockaddrInput<'a>>
    ) -> Result<c_size_t> { ... } fn setsockopt<'a>(
        &mut self,
        sockfd: c_int,
        level: c_int,
        optname: c_int,
        optval: Option<impl Into<SockoptInput<'a>>>
    ) -> Result<c_int> { ... } fn set_tid_address(&mut self, tidptr: &mut c_int) -> Result<pid_t> { ... } fn sigaltstack(
        &mut self,
        ss: Option<&stack_t>,
        old_ss: Option<&mut stack_t>
    ) -> Result<()> { ... } fn socket(
        &mut self,
        domain: c_int,
        typ: c_int,
        protocol: c_int
    ) -> Result<c_int> { ... } fn sync(&mut self) -> Result<()> { ... } fn uname(&mut self, buf: &mut utsname) -> Result<()> { ... } fn write(&mut self, fd: c_int, buf: &[u8]) -> Result<c_size_t> { ... } fn writev<T: ?Sized, U>(&mut self, fd: c_int, iovs: &T) -> Result<c_size_t>
    where
        for<'a> &'a T: IntoIterator<Item = &'a U>,
        U: AsRef<[u8]>
, { ... } unsafe fn syscall(
        &mut self,
        platform: &impl Platform,
        registers: [usize; 7]
    ) -> Result<[usize; 2]> { ... } fn gdb_flush(&mut self) -> Result<()> { ... } fn gdb_on_session_start(&mut self) -> Result<()> { ... } fn gdb_peek(&mut self) -> Result<Option<u8>> { ... } fn gdb_read(&mut self) -> Result<u8> { ... } fn gdb_write(&mut self, byte: u8) -> Result<()> { ... } fn gdb_write_all(&mut self, buf: &[u8]) -> Result<usize> { ... } fn balloon_memory(
        &mut self,
        size_exponent: usize,
        pages: usize,
        addr: *mut c_void
    ) -> Result<usize> { ... } fn cpuid(
        &mut self,
        leaf: u32,
        sub_leaf: u32,
        result: &mut CpuidResult
    ) -> Result<()> { ... } fn get_sgx_quote(
        &mut self,
        report: &Report,
        quote: &mut [u8]
    ) -> Result<usize> { ... } fn get_sgx_quote_size(&mut self) -> Result<usize> { ... } fn get_sgx_target_info(&mut self, info: &mut TargetInfo) -> Result<()> { ... } fn get_snp_vcek(&mut self, vcek: &mut [u8]) -> Result<usize> { ... } fn mem_info(&mut self) -> Result<usize> { ... } fn mmap_host(
        &mut self,
        addr: NonNull<c_void>,
        length: usize,
        prot: c_int
    ) -> Result<()> { ... } fn mprotect_host(
        &mut self,
        addr: NonNull<c_void>,
        length: usize,
        prot: c_int
    ) -> Result<()> { ... } fn munmap_host(&mut self, addr: NonNull<c_void>, length: usize) -> Result<()> { ... } fn trim_sgx_pages(
        &mut self,
        addr: NonNull<c_void>,
        length: usize
    ) -> Result<()> { ... }
}
Expand description

Guest request handler.

Required Methods

Suspend guest execution and pass control to host. This function will return when the host passes control back to the guest.

Returns an immutable borrow of the sallyport block.

Returns a mutable borrow of the sallyport block.

Returns a mutable borrow of shared ThreadLocalStorage.

Executes arch_prctl.

Executes brk syscall akin to [libc::brk].

Executes madvise syscall akin to [libc::madvise].

Executes mmap syscall akin to [libc::mmap].

Executes mprotect syscall akin to [libc::mprotect].

Executes munmap syscall akin to [libc::munmap].

Provided Methods

Executes an arbitrary call. Examples of calls that this method can execute are:

Loops infinitely trying to exit.

Executes accept syscall akin to [libc::accept].

Executes accept4 syscall akin to [libc::accept4].

Executes bind syscall akin to [libc::bind].

Executes clock_getres syscall akin to [libc::clock_getres].

Executes clock_gettime syscall akin to [libc::clock_gettime].

Executes close syscall akin to [libc::close].

Executes connect syscall akin to [libc::connect].

Executes dup syscall akin to [libc::dup].

Executes dup2 syscall akin to [libc::dup2].

Executes dup3 syscall akin to [libc::dup3].

Executes epoll_create1 syscall akin to [libc::epoll_create1].

Executes epoll_ctl syscall akin to [libc::epoll_ctl].

Executes epoll_wait syscall akin to [libc::epoll_wait].

Executes epoll_pwait syscall akin to [libc::epoll_pwait].

Executes eventfd2.

Executes exit syscall akin to [libc::exit].

Executes exit_group.

Executes fcntl syscall akin to [libc::fcntl].

Executes fstat syscall akin to [libc::fstat].

Executes getegid syscall akin to [libc::getegid].

Executes geteuid syscall akin to [libc::geteuid].

Executes getgid syscall akin to [libc::getgid].

Executes getpid syscall akin to [libc::getpid].

Executes getrandom syscall akin to [libc::getrandom].

Executes getsockname syscall akin to [libc::getsockname].

Executes getuid syscall akin to [libc::getuid].

Executes ioctl syscall akin to [libc::ioctl].

Executes listen syscall akin to [libc::listen].

Executes mremap syscall akin to [libc::mremap]. If flags is Some, [libc::MREMAP_MAYMOVE] is implied.

Executes nanosleep syscall akin to [libc::nanosleep].

Executes open syscall akin to [libc::open].

pathname argument must contain the trailing nul terminator byte.

Executes poll syscall akin to [libc::poll].

Executes read syscall akin to [libc::read].

Executes readlink syscall akin to [libc::readlink].

pathname argument must contain the trailing nul terminator byte.

Executes readv syscall by mapping it onto a single read.

Executes recv syscall akin to [libc::recv].

Executes recvfrom syscall akin to [libc::recvfrom].

Executes rt_sigaction.

Executes rt_sigprocmask.

Executes send syscall akin to [libc::send].

Executes sendto syscall akin to [libc::sendto].

Executes setsockopt syscall akin to [libc::setsockopt].

Executes set_tid_address.

Executes sigaltstack syscall akin to [libc::sigaltstack].

Executes socket syscall akin to [libc::socket].

Executes sync syscall akin to [libc::sync].

Executes uname syscall akin to [libc::uname].

Executes write syscall akin to [libc::write].

Executes writev syscall by mapping it onto a single write.

Executes a supported syscall expressed as an opaque 7-word array akin to [libc::syscall].

Safety

This method is unsafe, because it allows execution of arbitrary syscalls on the host, which is intrinsically unsafe.

It can also produce multiple references to the same memory.

Executes gdbstub::conn::Connection::write_all and returns the amount of bytes written

Request an additional memory region and return the virtual address of allocated region.

Arguments
  • size_exponent: Page size expressed as an exponent of 2
  • pages: Number of pages to allocate
  • addr: Guest physical address where the memory should be allocated

Execute cpuid instruction storing the result in result.

Requests SGX quote from the host given a report and returns the length of the quote on success.

Requests the SGX quote size from the host.

Requests SGX TargetInfo from the host.

Requests SNP VCEK from the host.

Gets number of memory slots available for ballooning from the host.

KVM only has a limited number of memory ballooning slots, which varies by technology and kernel version. Knowing this number helps the shim allocator to decide how much memory to allocate for each slot.

Notify the host about mmmap().

Notify the host about mprotect().

Notify the host about munmap().

Within an address range inside the enclave, ask host to set page type to ‘trimmed’. Address and length must be page-aligned. Shim must validate and acknowledge the changes with ENCLU[EACCEPT], in order for them to take effect.

Implementors