2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-30 22:05:27 +00:00

tests: check for loopback module on pivot_root test

mount -o loop fails when the loopback module is not loaded with
permission denied. Add a check if /dev/loop0 exists. If not, load
the loop module.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/781
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
(cherry picked from commit 656a48b900)
Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
Georgia Garcia
2021-08-02 14:24:53 -03:00
committed by John Johansen
parent fa7eb62c62
commit eeca73e675

View File

@@ -45,6 +45,11 @@ pivot_root_cleanup() {
}
do_onexit="pivot_root_cleanup"
# loopback module must be loaded for mount -o loop to work
if [ ! -b /dev/loop0 ] ; then
modprobe loop
fi
# systemd mounts / and everything under it MS_SHARED. This breaks
# pivot_root entirely, so attempt to detect it, and remount /
# MS_PRIVATE temporarily.