Skip to content

Commit 406b3a0

Browse files
yuwatabluca
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) (cherry picked from commit 0e25a21)
1 parent edf4a86 commit 406b3a0

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
@@ -3906,13 +3906,20 @@ static int manager_run_generators(Manager *m) {
39063906
_exit(r >= 0 ? EXIT_SUCCESS : EXIT_FAILURE);
39073907
}
39083908
if (r < 0) {
3909-
if (!ERRNO_IS_PRIVILEGE(r)) {
3909+
if (!ERRNO_IS_PRIVILEGE(r) && r != -EINVAL) {
39103910
log_error_errno(r, "Failed to fork off sandboxing environment for executing generators: %m");
39113911
goto finish;
39123912
}
39133913

39143914
/* Failed to fork with new mount namespace? Maybe, running in a container environment with
3915-
* seccomp or without capability. */
3915+
* seccomp or without capability.
3916+
*
3917+
* We also allow -EINVAL to allow running without CLONE_NEWNS.
3918+
*
3919+
* Also, when running on non-native userland architecture via systemd-nspawn and
3920+
* qemu-user-static QEMU-emulator, clone() with CLONE_NEWNS fails with EINVAL, see
3921+
* https://github.com/systemd/systemd/issues/28901.
3922+
*/
39163923
log_debug_errno(r,
39173924
"Failed to fork off sandboxing environment for executing generators. "
39183925
"Falling back to execute generators without sandboxing: %m");

0 commit comments

Comments
 (0)