APPLIED[Unstable]: [PATCH 0/1][SRU][D/E/F] Fix uuid-less squashfs overlayfs corruption issue (LP: #1824407)

Seth Forshee seth.forshee at canonical.com
Fri Dec 6 04:35:04 UTC 2019


On Fri, Nov 22, 2019 at 12:16:58PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1824407
> 
> == SRU Justification Disco, Eoan, Focal ==
> 
> Multiple squashfs filesystems with overlayfs cause file corruption issues
> when modifying zero sized files
> 
> == Fix ==
> 
> The current fix is pending in https://github.com/amir73il/linux/commit/b2d4f0ea5af42e16e154254de99da064f3ac551a
> and should be landing in Linux v5.5
> 
> == Test case ==
> 
> With an Ubuntu ISO on the cdrom drive, use:
> 
> #!/bin/bash -x
> mkdir -p /cdrom
> mount -t iso9660 -o ro,noatime /dev/sr0 /cdrom
> sleep 1
> mkdir -p /cow
> mount -t tmpfs -o 'rw,noatime,mode=755' tmpfs /cow
> sleep 1
> mkdir -p /cow/upper
> mkdir -p /cow/work
> modprobe -q -b overlay
> sleep 1
> modprobe -q -b loop
> sleep 1
> dev=$(losetup -f)
> mkdir -p /filesystem.squashfs
> losetup $dev /cdrom/casper/filesystem.squashfs
> mount -t squashfs -o ro,noatime $dev /filesystem.squashfs
> sleep 1
> 
> dev=$(losetup -f)
> mkdir -p /installer.squashfs
> losetup $dev /cdrom/casper/installer.squashfs
> mount -t squashfs -o ro,noatime $dev /installer.squashfs
> sleep 1
> 
> mkdir -p /root-tmp
> mount -t overlay -o 'upperdir=/cow/upper,lowerdir=/installer.squashfs:/filesystem.squashfs,workdir=/cow/work' /cow /root-tmp
> 
> FILE=/root-tmp/etc/.pwd.lock
> 
> echo foo > $FILE
> cat $FILE
> sync
> #
> # dropping caches or remounting causes the bug
> #
> echo 3 > /proc/sys/vm/drop_caches
> cat $FILE
> 
> Without the fix the cat of the file will produce an error. With the the
> cat will work correctly.
> 
> == Regression Potential ==
> 
> There is an unhandled corner case:
>     - two filesystems, A and B, both have null uuid
>     - upper layer is on A
>     - lower layer 1 is also on A
>     - lower layer 2 is on B
> 
> However, since this is an issue without the fix and will be addressed later
> with subsequent fixes once they are OK with upstream I think the risk is
> minimal considering nobody is complaining about these corner cases with the
> current broken overlayfs squashfs layering.

Applied to unstable/master as sauce, thanks!



More information about the kernel-team mailing list