You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This saves an execve(). It also allows qrexec-daemon to change how it
performs a VM -> VM service call without having to change qrexec-client.
During an upgrade, it is possible that qrexec-daemon is older than
qrexec-client, causing the old qrexec-daemon to try to use a calling
convention that the new qrexec-client doesn't support. Doing VM -> VM
calls without calling execve() means this cannot happen. VM -> dom0
and dom0 -> VM calls still use qrexec-client, but VM -> dom0 calls are
safe from domain name reuse races as of [1], and the latter do not
involve qrexec-daemon at all.
qrexec-daemon uses atexit() hooks to clean up its listening sockets, so
it is critical that these hooks do _not_ run in the child process.
Therefore, change the functions that used exit(), err(), or errx() to
return normally or call abort(). The return value is checked by the
caller and the functions are marked __attribute__((warn_unused_result))
to ensure this. This also fixes some (but not all) cases where a
disposable VM would not be cleaned up by qrexec-client -k.
To ensure proper behavior if there are any remaining functions calls to
exit(), add an atexit() hook in the child process that calls
__gcov_dump() (if coverage is enabled) followed by _exit(126). All of
these calls will be in error paths (if not, there is a bug somewhere),
so the fixed exit code is okay. Since atexit() hooks are run in reverse
order of registration, the call to _exit() will prevent other hooks
(such as the one that cleans up the listening sockets) from running.
To ensure that code running in a child process gets coverage measured in
CI, it is necessary to add calls to __gcov_dump(). Add these calls
by means of a wrapper function around _exit(), which is much less
error-prone than calling __gcov_dump() and _exit() directly.
Part of QubesOS/qubes-issues#9066
[1]: 100fbb9 ("qrexec-client: Use XID to connect to qrexec daemon when possible")
0 commit comments