Module parent

Module parent 

Source

StructsΒ§

ChildListener
A listener for the FFI start info channel along with relevant state.
ExecEnd
An error came up while waiting on the child process to do something. It likely died, with this return code if we have one.

EnumsΒ§

ExecEvent
A unified event representing something happening on the child process. Wraps nix’s WaitStatus and our custom signals so it can all be done with one match statement.
InitialCont πŸ”’
Whether to call ptrace::cont() immediately. Used exclusively by wait_for_signal.

ConstantsΒ§

ARCH_WORD_SIZE πŸ”’
WAIT_FLAGS πŸ”’
The flags to use when calling waitid().

StaticsΒ§

PAGE_ADDR πŸ”’
The address of the page set to be edited, initialised to a sentinel null pointer.
PAGE_COUNT πŸ”’
How many consecutive pages to unprotect. 1 by default, unlikely to be set higher than 2.
PAGE_SIZE
The host pagesize, initialised to a sentinel zero value.

TraitsΒ§

ArchIndependentRegs πŸ”’
Allows us to get common arguments from the user_regs_t across architectures. Normally this would land us ABI hell, but thankfully all of our usecases consist of functions with a small number of register-sized integer arguments. See https://man7.org/linux/man-pages/man2/syscall.2.html for sources.

FunctionsΒ§

capstone_disassemble πŸ”’
Extract the events from the given instruction.
capstone_find_events πŸ”’
Add the memory events from op being executed while there is a memory access at addr to acc_events. Return whether this was a memory operand.
get_disasm πŸ”’
Spawns a Capstone disassembler for the host architecture.
handle_segfault πŸ”’
Grabs the access that caused a segfault and logs it down if it’s to our memory, or kills the child and returns the appropriate error otherwise.
mempr_off⚠
Disables protections on the page whose address is currently in PAGE_ADDR.
mempr_on⚠
Reenables protection on the page set by PAGE_ADDR.
sv_loop
This is the main loop of the supervisor process. It runs in a separate process from the rest of Miri (but because we fork, addresses for anything created before the fork - like statics - are the same).
wait_for_signal πŸ”’
Waits for wait_signal. If init_cont, it will first do a ptrace::cont. We want to avoid that in some cases, like at the beginning of FFI.