summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2022-09-23 00:58:54 -0400
committercobackporter[bot] <cobackporter[bot]@users.noreply.github.com>2022-09-23 09:11:29 +0000
commit3717965f64f13a441a9232f29352d770b739037d (patch)
tree501c1c77e83490af7bc1be3c2f148e7e4df14bb8
parentBump version to 22.05.6.3 (diff)
downloadonline-3717965f64f13a441a9232f29352d770b739037d.tar.gz
online-3717965f64f13a441a9232f29352d770b739037d.zip
wsd: disable mounting when unmount fails backport/5289/distro/collabora/co-22-05
It seems that on some systems it is possible to succeed in mounting, but fail to unmount. This is proving very problematic and it is best to detect unmount failures and disable mount-binding altogether. Change-Id: I6f708b3a1e585dcbd95cced45c668629410562d6 Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
-rw-r--r--common/JailUtil.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/common/JailUtil.cpp b/common/JailUtil.cpp
index 98336581fb..5c9531b9ad 100644
--- a/common/JailUtil.cpp
+++ b/common/JailUtil.cpp
@@ -220,7 +220,9 @@ void setupChildRoot(bool bindMount, const std::string& childRoot, const std::str
// Test mounting to verify it actually works,
// as it might not function in some systems.
const std::string target = Poco::Path(childRoot, "cool_test_mount").toString();
- if (bind(sysTemplate, target))
+
+ // Make sure that we can both mount and unmount before enabling bind-mounting.
+ if (bind(sysTemplate, target) && unmount(target))
{
enableBindMounting();
safeRemoveDir(target);