From: Zbigniew Jędrzejewski-Szmek Date: Tue, 22 Sep 2020 12:49:49 +0000 (+0200) Subject: core: turn on MountAPIVFS=true when RootImage or RootDirectory are specified X-Git-Tag: v247-rc1~136^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6119878480aab4c10ad6af33deab221778683807;p=thirdparty%2Fsystemd.git core: turn on MountAPIVFS=true when RootImage or RootDirectory are specified Lennart wanted to do this back in https://github.com/systemd/systemd/commit/01c33c1effaa2406ff7d2a7de08a3ee87aec9fc8. For better or worse, this wasn't done because I thought that turning on MountAPIVFS is a compat break for RootDirectory and people might be negatively surprised by it. Without this, search for binaries doesn't work (access_fd() requires /proc). Let's turn it on, but still allow overriding to "no". When RootDirectory=/, MountAPIVFS=1 doesn't work. This might be a buglet on its own, but this patch doesn't change the situation. --- diff --git a/src/core/execute.c b/src/core/execute.c index fd28f22c4ff..1030c37ab56 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -5653,9 +5653,14 @@ int exec_context_get_effective_ioprio(const ExecContext *c) { bool exec_context_get_effective_mount_apivfs(const ExecContext *c) { assert(c); + /* Explicit setting wins */ if (c->mount_apivfs_set) return c->mount_apivfs; + /* Default to "yes" if root directory or image are specified */ + if (c->root_image || !empty_or_root(c->root_directory)) + return true; + return false; }