Hi, thanks for squashfuse!
I have stumbled across a potential bug when using multiple squashfs mounts as layers in overlayfs.
Here is the rough dir layout:
lower1 [squashfuse]
lower2 [squashfuse]
upper
work
mnt
This stack is then mounted using rootless overlay. What I have found is overwriting a large >2GB file can result in an error:
line 3: test.file: Value too large for defined data type
I have used the following script to reproduce this:
#!/bin/bash
mkdir -p large_squash1 large_squash2
pushd large_squash1
yes large_squash1 | head -c 4GB > test.file
popd
pushd large_squash2
yes large_squash2 | head -c 4GB > test.file
popd
rm -f large1.squashfs large2.squashfs
mksquashfs large_squash1 large1.squashfs -all-root
mksquashfs large_squash2 large2.squashfs -all-root
unshare -mr bash -c "$(tail -n +21 "$0" || true)" "$0" "$@"
exit $?
# Unshared payload starts here.
set -ux
WORKDIR=/tmp/sf_repro
mount_cleanup() {
umount --verbose -l "${WORKDIR}/mnt"
fusermount -uz ${WORKDIR}/lower
}
trap 'mount_cleanup' EXIT
# requires an empty squashfs to demo empty.squashfs
rm -rf $WORKDIR/upper
mkdir -p $WORKDIR/{lower1,lower2,upper,work,mnt}
./squashfuse large1.squashfs $WORKDIR/lower1
./squashfuse large2.squashfs $WORKDIR/lower2
# mount overlay
mount \
-t overlay \
overlay \
-o lowerdir=${WORKDIR}/lower2:${WORKDIR}/lower1,upperdir=${WORKDIR}/upper,workdir=${WORKDIR}/work\
"${WORKDIR}/mnt"
pushd $WORKDIR/mnt
stat test.file
tail test.file
yes overlay | head -c 4GB > test.file # This will fail
echo $?
stat test.file
tail test.file
popd
I am using unshare here but you should be able to see this mounting with sudo. I have built latest squashfuse (c41a22a) and seen this with both squashfuse and squashfuse_ll.
My env:
Ubuntu 22.04.3 LTS
fuse3 version: 3.10.5-1build1
kernel: 5.15.0-89-generic
I am not sure if this is a bug in the overlayfs stack, fuse or squashfuse. But I cannot reproduce this behaviour when using directories directly in overlayfs. Another odd thing I noticed is that getconf FILESIZEBITS . returns 32 for squashfuse mounts, which I wonder if overlayfs uses in some way.
Hi, thanks for
squashfuse!I have stumbled across a potential bug when using multiple squashfs mounts as layers in overlayfs.
Here is the rough dir layout:
This stack is then mounted using rootless overlay. What I have found is overwriting a large >2GB file can result in an error:
I have used the following script to reproduce this:
I am using
unsharehere but you should be able to see this mounting withsudo. I have built latestsquashfuse(c41a22a) and seen this with bothsquashfuseandsquashfuse_ll.My env:
I am not sure if this is a bug in the overlayfs stack, fuse or squashfuse. But I cannot reproduce this behaviour when using directories directly in overlayfs. Another odd thing I noticed is that
getconf FILESIZEBITS .returns32for squashfuse mounts, which I wonder if overlayfs uses in some way.