]> git.ipfire.org Git - thirdparty/systemd.git/commit
core: be more lenient when checking whether sandboxing is necessary
authorLennart Poettering <lennart@poettering.net>
Wed, 20 Nov 2019 11:23:17 +0000 (12:23 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 20 Nov 2019 11:30:04 +0000 (12:30 +0100)
commit4e677599607d582367151280aa5d922f80fd962e
treeca0918d496a7734e08e4268f3bdde61b0537e034
parente884e000714c2db006384058a63788ffcce8c8b8
core: be more lenient when checking whether sandboxing is necessary

In some containers unshare() is made unavailable entirely. Let's deal
with this that more gracefully and disable our sandboxing of services
then, so that we work in a container, under the assumption the container
manager is then responsible for sandboxing if we can't do it ourselves.

Previously, we'd insist on sandboxing as soon as any form of BindPath=
is used. With this change we only insist on it if we have a setting like
that where source and destination differ, i.e. there's a mapping
established that actually rearranges things, and thus would result in
systematically different behaviour if skipped (as opposed to mappings
that just make stuff read-only/writable that otherwise arent').

(Let's also update a test that intended to test for this behaviour with
a more specific configuration that still triggers the behaviour with
this change in place)

Fixes: #13955
(For testing purposes unshare() can easily be blocked with
systemd-nspawn --system-call-filter=~unshare.)
src/core/execute.c
test/test-execute/exec-readonlypaths-with-bindpaths.service