]> git.ipfire.org Git - thirdparty/systemd.git/commit
namespace: properly handle bind mounts from the host
authorLennart Poettering <lennart@poettering.net>
Thu, 28 Sep 2017 16:30:55 +0000 (18:30 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 2 Oct 2017 15:41:43 +0000 (17:41 +0200)
commite908468b5b24f1d4a4d787262cb3b8b2d8a5aad4
treeca1af04598f70a096f6ea2ebf224e76471e446cf
parent645767d6b5fd965de6367e6c1289ec295ea77cd7
namespace: properly handle bind mounts from the host

Before this patch we had an ordering problem: if we have no namespacing
enabled except for two bind mounts that intend to swap /a and /b via
bind mounts, then we'd execute the bind mount binding /b to /a, followed
by thebind mount from /a to /b, thus having the effect that /b is now
visible in both /a and /b, which was not intended.

With this change, as soon as any bind mount is configured we'll put
together the service mount namespace in a temporary directory instead of
operating directly in the root. This solves the problem in a
straightforward fashion: the source of bind mounts will always refer to
the host, and thus be unaffected from the bind mounts we already
created.
src/core/namespace.c