lkml.org 
[lkml]   [2020]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.7 178/244] ovl: fix regression with re-formatted lower squashfs
    Date
    From: Amir Goldstein <amir73il@gmail.com>

    commit a888db310195400f050b89c47673f0f8babfbb41 upstream.

    Commit 9df085f3c9a2 ("ovl: relax requirement for non null uuid of lower
    fs") relaxed the requirement for non null uuid with single lower layer to
    allow enabling index and nfs_export features with single lower squashfs.

    Fabian reported a regression in a setup when overlay re-uses an existing
    upper layer and re-formats the lower squashfs image. Because squashfs
    has no uuid, the origin xattr in upper layer are decoded from the new
    lower layer where they may resolve to a wrong origin file and user may
    get an ESTALE or EIO error on lookup.

    To avoid the reported regression while still allowing the new features
    with single lower squashfs, do not allow decoding origin with lower null
    uuid unless user opted-in to one of the new features that require
    following the lower inode of non-dir upper (index, xino, metacopy).

    Reported-by: Fabian <godi.beat@gmx.net>
    Link: https://lore.kernel.org/linux-unionfs/32532923.JtPX5UtSzP@fgdesktop/
    Fixes: 9df085f3c9a2 ("ovl: relax requirement for non null uuid of lower fs")
    Cc: stable@vger.kernel.org # v4.20+
    Signed-off-by: Amir Goldstein <amir73il@gmail.com>
    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    fs/overlayfs/super.c | 12 ++++++++++++
    1 file changed, 12 insertions(+)

    --- a/fs/overlayfs/super.c
    +++ b/fs/overlayfs/super.c
    @@ -1331,6 +1331,18 @@ static bool ovl_lower_uuid_ok(struct ovl
    if (!ofs->config.nfs_export && !ofs->upper_mnt)
    return true;

    + /*
    + * We allow using single lower with null uuid for index and nfs_export
    + * for example to support those features with single lower squashfs.
    + * To avoid regressions in setups of overlay with re-formatted lower
    + * squashfs, do not allow decoding origin with lower null uuid unless
    + * user opted-in to one of the new features that require following the
    + * lower inode of non-dir upper.
    + */
    + if (!ofs->config.index && !ofs->config.metacopy && !ofs->config.xino &&
    + uuid_is_null(uuid))
    + return false;
    +
    for (i = 0; i < ofs->numfs; i++) {
    /*
    * We use uuid to associate an overlay lower file handle with a

    \
     
     \ /
      Last update: 2020-07-20 18:15    [W:4.104 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site