Allocator for a real preload: every Rust allocation uses one of the two
Tool-owned arenas, independent of dispatch depth. Installation storage has
process lifetime; other allocations can be reused after deallocation.
The runtime’s records of guest calls it refused before any Tool ran (a
signal handler or alternate stack; a fork-like call while process forks
are not allowed). A take returns what was refused in this process since
the last take and clears it.
The SET of fork-like call kinds protect_runtime_control refused with
ENOTSUP because process forks are not allowed; the Tool never sees these
calls. It records which of five kinds were refused, not how many times or
in what order: repeats of a kind between two takes merge into one.
REVERIE_LITEINST_ALT_STACK selector and parser for the shared
reverie-inguestRuntimeConfig alt-stack knob.
Environment variable selecting the shared RuntimeConfig::use_alt_stack
knob for the in-guest runtime’s SIGSYS handler.
Opts the Tool mode into guest SIGALRM handlers (signal phase 1), 1 or
0. Off by default: until the runtime delivers a SIGALRM to an admitted
handler (step I4), a run that installs one ends at its first SIGALRM.
Sends request to the coordinator’s global state and waits for its
response, from the installed Tool’s own synchronous code running inside a
Tool callback but outside the callback’s own send_rpc: for example from
a synchronous method a callback calls, where no reverie::Guest is at
hand. Inside a callback the runtime’s own syscalls are not intercepted.
Guest code outside a callback cannot use this: its syscalls on the
coordinator connection are guest syscalls, which the runtime refuses. It uses the process’s one existing
coordinator connection, so it reconnects after a fork exactly as callbacks
do, and it adds no descriptor.
Parses a shared reverie-inguestBuiltinTool from a REVERIE_LITEINST_TOOL
value, returning None for the LiteInst-native strace/compat modes and
any other value.
Whether this process image’s runtime collects the statistics it reports at
exit: true once the in-guest Tool host initializes the actual collector.
Ordinary installations select its endpoint from
the compatible REVERIE_LITEINST_STATS_COORDINATOR environment variable; guest code that ran before installation
could have changed that variable. Authenticated private InitialImage setup
uses the fixed companion of its genuine coordinator endpoint, without an
environment fallback. A Tool can check this after installation returns;
the host must still require the actual terminal report and clean RPC drain.
An image that collects nothing reports nothing at exit.
Checks that this linked root’s allocator uses the runtime’s selected Tool
backing. Call during installation, while a dispatch allocation scope is live,
before connecting or publishing a Tool. This grants no installation or
private-image authority.
Moves fd, a socket the in-guest Tool owns for its own output (for example
one end of a socket pair its log records go to), to a reserved number in
the runtime’s range (runtime_fd_minimums), closes fd, and returns the
reserved number.
From then on the runtime keeps the guest away from it exactly as it does
from the coordinator connection: a close_range over it spares it, and a
guest close, read, write, shutdown, send, setsockopt or other
descriptor operation on it fails with EBADF, as on a number the guest does
not have open. A guest dup2/dup3 onto its number succeeds as it would if
the number were free: the runtime first moves the socket to another free
number (runtime_fd_minimums), so the Tool must read the current
number from tool_output_fd for each use. Tool code writes to it through
its own syscalls, which the runtime does not dispatch to the guest’s
protections. A forked child inherits the descriptor and its protection.
Takes the set of fork-like call kinds refused in this process since the
last take, so that a Tool can report them; taking clears the set, so each
kind is reported once per take. A forked child starts with its parent’s
set. Nothing calls this yet; a Tool that reports refusals is its first
caller.
Takes the guest signal controls refused in this process since the last
call, so that the Tool can report them (each refusal is reported once:
taking clears them). A forked child starts with its parent’s record.
The Tool output socket’s current number, if one is reserved
(reserve_tool_output_fd). It can change when the guest dup2s onto it,
so the Tool reads it for each use.
Called by the runtime in the creating process only, exactly once for each
process creation the guest asks for (fork, the copying vfork, and the
plain-fork forms of clone and clone3), whether it succeeded, failed or was
refused. The call happens synchronously after the physical call returns,
and before the copying vfork’s wait or the return to the Tool. For
Created the transient pidfd is closed, and its closure confirmed, before
the call. For Refused it may still be open (a child that could not be
killed, or a failed close); the process then ends right after the call,
which releases it. The hook must not wait for guest progress or take
the dispatch locks. An error, like a refusal, ends the creating process
with status 125; the Tool reports its own failure before returning one.