run_as: adapt run_as implementation to support complex payloads
This commits changes 4 elements of the run_as implementation:
1. Allow for commands with complex return types,
2. Detect worker crashes and restart it,
3. Enable commands that take FD as input.
4. Define master-worker protocol
In the past, run_as commands were simple and were all returning int
values (e.g. open(), mkdir()). With the introduction of the future, more
complex run_as commands such as the one to extract elf symbol offsets
for the userspace-probe instrumentation, we need to allow arbitrary
return types such as long and arrays. Creating a return type abstraction
allows to add new return types. To implement this new abstraction, this
commit adds the passing of the run_as_ret structure as parameter to the
command functions that are responsible to set the errno and the return
value according to their semantics. The run_as_ret struct now contains
an union of return types.
More complex run_as commands are more prone to crashes, we thus make the
master process restart the worker process if it detects it has exited.
Enable passing FD to worker process for commands that take file
descriptor as input.
Rework data and FD sending and receiving functions for both side of the
master-worker control channel and add comments describing each steps of
the protocol.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.025737 seconds and 4 git commands to generate.