core/execute: also check cg_is_threaded for clone3()
Prompted by #32259 We already have this check in exec_invoke(), i.e. child. But if CLONE_INTO_CGROUP is used, the failure would occur on parent's side, so do the check there too.
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "alloc-util.h"
|
||||
#include "architecture.h"
|
||||
#include "argv-util.h"
|
||||
#include "cgroup-util.h"
|
||||
#include "dirent-util.h"
|
||||
#include "env-file.h"
|
||||
#include "env-util.h"
|
||||
@@ -2108,7 +2109,13 @@ int posix_spawn_wrapper(
|
||||
|
||||
return FLAGS_SET(flags, POSIX_SPAWN_SETCGROUP);
|
||||
}
|
||||
if (!(ERRNO_IS_NOT_SUPPORTED(r) || ERRNO_IS_PRIVILEGE(r)))
|
||||
if (ERRNO_IS_NOT_SUPPORTED(r)) {
|
||||
/* clone3() could also return EOPNOTSUPP if the target cgroup is in threaded mode. */
|
||||
if (cgroup && cg_is_threaded(cgroup) > 0)
|
||||
return -EUCLEAN;
|
||||
|
||||
/* clone3() not available? */
|
||||
} else if (!ERRNO_IS_PRIVILEGE(r))
|
||||
return -r;
|
||||
|
||||
/* Compiled on a newer host, or seccomp&friends blocking clone3()? Fallback, but need to change the
|
||||
|
||||
Reference in New Issue
Block a user