mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 00:14:44 +01:00
Move most file setup and creation to before the overlay mount call
kernel overlayfs propagates the changes, while fuse_overlayfs doesn't Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
This commit is contained in:
parent
ed8b6cb663
commit
be38da7570
1 changed files with 12 additions and 7 deletions
|
@ -55,20 +55,25 @@ mount "${loop_device_other}" "${overlayfs_other}"
|
|||
mkdir "${overlayfs_upper}"
|
||||
mkdir "${overlayfs_workdir}"
|
||||
|
||||
# The behavior when changing the contents of lowerdir or upperdir
|
||||
# after mounting the overlay is described as "undefined"
|
||||
# Hopefully this isn't UB in the C standard/compiler sense
|
||||
# Concretely: kernel overlayfs propagates changes, fuse-overlayfs doesn't
|
||||
fallocate -l 16K "${overlayfs_lower}/lower_file"
|
||||
touch "${overlayfs_lower}/lower_file_2"
|
||||
fallocate -l 16K "${overlayfs_upper}/upper_file"
|
||||
touch "${overlayfs_upper}/upper_file_2"
|
||||
# echo is also a builtin, making things a bit more complicated
|
||||
cp "$(type -P echo)" "${overlayfs_lower}/lower_echo"
|
||||
cp "$(type -P echo)" "${overlayfs_upper}/upper_echo"
|
||||
|
||||
if [ "$1" == "fuse" ]; then
|
||||
fuse-overlayfs -o lowerdir="${overlayfs_lower}",upperdir="${overlayfs_upper}",workdir="${overlayfs_workdir}" "${mount_target}"|| fatalerror 'Unable to set up overlayfs'
|
||||
else
|
||||
mount -t overlay -o lowerdir="${overlayfs_lower}",upperdir="${overlayfs_upper}",workdir="${overlayfs_workdir}" none "${mount_target}"|| fatalerror 'Unable to set up overlayfs'
|
||||
fi
|
||||
|
||||
fallocate -l 16K "${overlayfs_lower}/lower_file"
|
||||
touch "${overlayfs_lower}/lower_file_2"
|
||||
fallocate -l 16K "${overlayfs_upper}/upper_file"
|
||||
touch "${overlayfs_upper}/upper_file_2"
|
||||
fallocate -l 16K "${mount_target}/overlay_file"
|
||||
# echo is also a builtin, making things a bit more complicated
|
||||
cp "$(type -P echo)" "${overlayfs_lower}/lower_echo"
|
||||
cp "$(type -P echo)" "${overlayfs_upper}/upper_echo"
|
||||
|
||||
settest overlayfs "${bin}/complain"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue