Crates.io | sallyport |
lib.rs | sallyport |
version | 0.6.3 |
source | src |
created_at | 2021-10-20 14:49:57.018475 |
updated_at | 2022-08-08 21:42:00.273976 |
description | API for the Enarx hypervisor-microkernel boundary |
homepage | |
repository | https://github.com/enarx/enarx |
max_upload_size | |
id | 467945 |
size | 359,448 |
API for the hypervisor-microkernel boundary
sallyport
is a protocol crate for proxying service requests (such as syscalls) from an Enarx Keep
to the host. A sally port is a secure gateway through
which a defending army might "sally forth" from the protection of their fortification.
sallyport
works by providing the host with the most minimal register context it requires to
perform the syscall on the Keep's behalf. In doing so, the host can immediately call the desired
syscall without any additional logic required.
Guest and host side communicate via a mutually-distrusted shared block of memory.
This crate provides functionality for the guest to execute arbitary requests by proxying requests to the host via the untrusted block and corresponding functionality for the host to execute the requests contained within the untrusted block.
The sallyport block is a region of memory containing zero or more items. All items contain the following header:
usize
usize
The size parameter includes the full length of the item except the header value. The contents of the item are defined by the value of the kind
parameter. An item with an unknown kind
can be skipped since the length of the item is known from the size
field. The recipient of an item with an unknown kind
MUST NOT try to interpret or modify the contents of the item in any way.
END
: 0
SYSCALL
: 1
GDBCALL
: 2
ENARXCALL
: 3
An END
item MUST have a size
of 0
. It has no contents and simply marks the end of items in the block. This communicates the end of the items list to the host. However, the guest MUST NOT rely on the presence of a terminator upon return to the guest.
A SYSCALL
item has the following contents:
nmbr
: usize
- the system call numberarg0
: usize
- the first argumentarg1
: usize
- the second argumentarg2
: usize
- the third argumentarg3
: usize
- the fourth argumentarg4
: usize
- the fifth argumentarg5
: usize
- the sixth argumentret0
: usize
- the first return valueret1
: usize
- the second return valuedata
: ...
- data that can be referenced (optional)A GDBCALL
item has the following contents:
nmbr
: usize
- the GDB call numberarg0
: usize
- the first argumentarg1
: usize
- the second argumentarg2
: usize
- the third argumentarg3
: usize
- the fourth argumentret
: usize
- the return valuedata
: ...
- data that can be referenced (optional)A ENARXCALL
item has the following contents:
nmbr
: usize
- the Enarx call number
arg0
: usize
- the first argument
arg1
: usize
- the second argument
arg2
: usize
- the third argument
arg3
: usize
- the fourth argument
ret
: usize
- the return value
data
: ...
- data that can be referenced (optional)
The argument values may contain numeric values. However, all pointers MUST be translated to an offset from the beginning of the data section.
Here's an example of how the sallyport
protocol might be used to proxy a syscall between
the host and a protected virtual machine:
write
syscall.write
syscall.END
item header.write
syscall, the shim:
kind
set to Syscall
and size equal to 9 + count of allocated bytes to write (syscall number + arguments + return values + data length).nmbr
equal to the Linux integral value for SYS_write
.arg0
= The file descriptor to write to.arg1
= The offset starting after the last return value where the bytes have been copied to.arg2
= The number of bytes that the write
syscall should emit from the bytes pointed to in the second parameter.arg3
= [NULL
]arg4
= [NULL
]arg5
= [NULL
]ret0
= -ENOSYS
ret1
= 0
License: Apache-2.0