core: Add RootDirectoryFileDescriptor=
RootDirectory= but via a open_tree() file descriptor. This allows setting up the execution environment for a service by the client in a mount namespace and then starting a transient unit in that execution environment using the new property. We also add --root-directory= and --same-root-dir= to systemd-run to have it run services within the given root directory. As systemd-run might be invoked from a different mount namespace than what systemd is running in, systemd-run opens the given path with open_tree() and then sends it to systemd using the new RootDirectoryFileDescriptor= property.
This commit is contained in:
@@ -201,6 +201,7 @@ TEST(protect_kernel_logs) {
|
||||
static const NamespaceParameters p = {
|
||||
.runtime_scope = RUNTIME_SCOPE_SYSTEM,
|
||||
.protect_kernel_logs = true,
|
||||
.root_directory_fd = -EBADF,
|
||||
};
|
||||
pid_t pid;
|
||||
|
||||
|
||||
@@ -81,6 +81,7 @@ int main(int argc, char *argv[]) {
|
||||
.runtime_scope = RUNTIME_SCOPE_SYSTEM,
|
||||
|
||||
.root_directory = root_directory,
|
||||
.root_directory_fd = -EBADF,
|
||||
|
||||
.read_write_paths = (char**) writable,
|
||||
.read_only_paths = (char**) readonly,
|
||||
|
||||
Reference in New Issue
Block a user