mirror of
https://git.yoctoproject.org/poky
synced 2026-02-05 16:28:43 +01:00
mount-copybind: add SELinux support
bind mounts don't use the SELinux label of the target, but the SELinux label of the source. This patch restores the SELinux context of the bind mount recursively using restorecon. (From OE-Core rev: 6f3e231dc9bc11772573bf9683de9804460362d1) Signed-off-by: Tobias Kaufmann <Tobias.KA.Kaufmann@bmw.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
6c0a5594cc
commit
e1d658ef11
@@ -46,6 +46,12 @@ if [ -d "$mountpoint" ]; then
|
||||
fi
|
||||
|
||||
mount -o "bind$options" "$spec" "$mountpoint"
|
||||
# restore the selinux context.
|
||||
if command -v selinuxenabled > /dev/null 2>&1; then
|
||||
if selinuxenabled; then
|
||||
restorecon -R "$mountpoint"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
elif [ -f "$mountpoint" ]; then
|
||||
if [ ! -f "$spec" ]; then
|
||||
@@ -53,4 +59,10 @@ elif [ -f "$mountpoint" ]; then
|
||||
fi
|
||||
|
||||
mount -o "bind$options" "$spec" "$mountpoint"
|
||||
# restore the selinux context.
|
||||
if command -v selinuxenabled > /dev/null 2>&1; then
|
||||
if selinuxenabled; then
|
||||
restorecon -R "$mountpoint"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user