diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-10-08 18:32:03 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-10-08 18:32:03 +0200 |
commit | 1099ceebce55805a167dd29712423b2d958b9475 (patch) | |
tree | e273ce7c88be634368b0e4d7e1cca2c3eaca6687 /src/nspawn/nspawn.c | |
parent | meson: only build src/shared/tests.c if tests are enabled (diff) | |
download | systemd-1099ceebce55805a167dd29712423b2d958b9475.tar.xz systemd-1099ceebce55805a167dd29712423b2d958b9475.zip |
nspawn: optionally don't mount a tmpfs over /tmp (#10294)
nspawn: optionally, don't mount a tmpfs on /tmp
Fixes: #10260
Diffstat (limited to '')
-rw-r--r-- | src/nspawn/nspawn.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 1e20f46131..3afc66f981 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -189,7 +189,7 @@ static const char *arg_container_service_name = "systemd-nspawn"; static bool arg_notify_ready = false; static bool arg_use_cgns = true; static unsigned long arg_clone_ns_flags = CLONE_NEWIPC|CLONE_NEWPID|CLONE_NEWUTS; -static MountSettingsMask arg_mount_settings = MOUNT_APPLY_APIVFS_RO; +static MountSettingsMask arg_mount_settings = MOUNT_APPLY_APIVFS_RO|MOUNT_APPLY_TMPFS_TMP; static void *arg_root_hash = NULL; static size_t arg_root_hash_size = 0; static char **arg_syscall_whitelist = NULL; @@ -402,8 +402,14 @@ static void parse_share_ns_env(const char *name, unsigned long ns_flag) { } static void parse_mount_settings_env(void) { - int r; const char *e; + int r; + + r = getenv_bool("SYSTEMD_NSPAWN_TMPFS_TMP"); + if (r >= 0) + SET_FLAG(arg_mount_settings, MOUNT_APPLY_TMPFS_TMP, r > 0); + else if (r != -ENXIO) + log_warning_errno(r, "Failed to parse $SYSTEMD_NSPAWN_TMPFS_TMP, ignoring: %m"); e = getenv("SYSTEMD_NSPAWN_API_VFS_WRITABLE"); if (!e) |