ACK/Cmnt: [PATCH 0/1][SRU][D/E/F] Fix uuid-less squashfs overlayfs corruption issue (LP: #1824407)
Colin Ian King
colin.king at canonical.com
Fri Nov 22 14:33:51 UTC 2019
On 22/11/2019 14:12, Andrea Righi wrote:
> 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.
>>
>> ----
>>
>> Amir Goldstein (1):
>> ovl: fix lookup failure on multi lower squashfs
>>
>> fs/overlayfs/namei.c | 8 ++++++++
>> fs/overlayfs/ovl_entry.h | 2 ++
>> fs/overlayfs/super.c | 24 +++++++++++++++++-------
>> 3 files changed, 27 insertions(+), 7 deletions(-)
>
> Shouldn't be an "UBUNTU: SAUCE" patch for now? Apart than that the fix
> makes sense to me.
I was not 100% sure about the SAUCE patch, the fix is very much likely
to land during the 5.5 merge in a week or so. Anyhow, if it needs the
SAUCE subject can that be added when it's applied please ;-)
Colin
>
> Acked-by: Andrea Righi <andrea.righi at canonical.com>
>
More information about the kernel-team
mailing list