core: Add DelegateNamespaces=
This delegates one or more namespaces to the service. Concretely, this setting influences in which order we unshare namespaces. Delegated namespaces are unshared *after* the user namespace is unshared. Other namespaces are unshared *before* the user namespace is unshared. Fixes #35369
This commit is contained in:
@@ -2474,6 +2474,12 @@ static int exec_context_serialize(const ExecContext *c, FILE *f) {
|
||||
return r;
|
||||
}
|
||||
|
||||
if (c->delegate_namespaces != NAMESPACE_FLAGS_INITIAL) {
|
||||
r = serialize_item_format(f, "exec-context-delegate-namespaces", "%lu", c->delegate_namespaces);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
#if HAVE_LIBBPF
|
||||
if (exec_context_restrict_filesystems_set(c)) {
|
||||
char *fs;
|
||||
@@ -3536,6 +3542,10 @@ static int exec_context_deserialize(ExecContext *c, FILE *f) {
|
||||
r = safe_atolu(val, &c->restrict_namespaces);
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if ((val = startswith(l, "exec-context-delegate-namespaces="))) {
|
||||
r = safe_atolu(val, &c->delegate_namespaces);
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if ((val = startswith(l, "exec-context-restrict-filesystems="))) {
|
||||
r = set_ensure_allocated(&c->restrict_filesystems, &string_hash_ops);
|
||||
if (r < 0)
|
||||
|
||||
Reference in New Issue
Block a user