Module messages

Module messages 

Source
Expand description

Houses the types that are directly sent across the IPC channels.

When forking to initialise the supervisor during init_sv, the child raises a SIGSTOP; if the parent successfully ptraces the child, it will allow it to resume. Else, the child will be killed by the parent.

After initialisation is done, the overall structure of a traced FFI call from the child process’s POV is as follows:

message_tx.send(TraceRequest::StartFfi);
confirm_rx.recv(); // receives a `Confirmation`
raise(SIGSTOP);
/* do ffi call */
raise(SIGUSR1); // morally equivalent to some kind of "TraceRequest::EndFfi"
let events = event_rx.recv(); // receives a `MemEvents`

TraceRequest::OverrideRetcode can be sent at any point in the above, including before or after all of them. confirm_rx.recv() is to be called after, to ensure that the child does not exit before the supervisor has registered the return code.

NB: sending these events out of order, skipping steps, etc. will result in unspecified behaviour from the supervisor process, so use the abstractions in super::child (namely do_ffi()) to handle this. It is trivially easy to cause a deadlock or crash by messing this up!

Structs§

Confirmation
A marker type confirming that the supervisor has received the request to begin tracing and is now waiting for a SIGSTOP.
StartFfiInfo
Information needed to begin tracing.

Enums§

TraceRequest
An IPC request sent by the child process to the parent.