Skip to content

Commit 0e25a21

Browse files
yuwatakeszybz
authored andcommitted
core: allow to run generators without sandboxing on qemu-user
When running on non-native userland architecture via systemd-nspawn and qemu-user-static QEMU-emulator, clone() with CLONE_NEWNS fails with EINVAL. Fixes #28901. [zjs: add a comment in the code] (cherry picked from commit 4680187)
1 parent a3d7809 commit 0e25a21

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/core/manager.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4034,13 +4034,20 @@ static int manager_run_generators(Manager *m) {
40344034
_exit(r >= 0 ? EXIT_SUCCESS : EXIT_FAILURE);
40354035
}
40364036
if (r < 0) {
4037-
if (!ERRNO_IS_PRIVILEGE(r)) {
4037+
if (!ERRNO_IS_PRIVILEGE(r) && r != -EINVAL) {
40384038
log_error_errno(r, "Failed to fork off sandboxing environment for executing generators: %m");
40394039
goto finish;
40404040
}
40414041

40424042
/* Failed to fork with new mount namespace? Maybe, running in a container environment with
4043-
* seccomp or without capability. */
4043+
* seccomp or without capability.
4044+
*
4045+
* We also allow -EINVAL to allow running without CLONE_NEWNS.
4046+
*
4047+
* Also, when running on non-native userland architecture via systemd-nspawn and
4048+
* qemu-user-static QEMU-emulator, clone() with CLONE_NEWNS fails with EINVAL, see
4049+
* https://github.com/systemd/systemd/issues/28901.
4050+
*/
40444051
log_debug_errno(r,
40454052
"Failed to fork off sandboxing environment for executing generators. "
40464053
"Falling back to execute generators without sandboxing: %m");

0 commit comments

Comments
 (0)