Re: [PATCH v2 1/4] overlay: Add tests for nesting private xattrs

Amir Goldstein
2023-12-10T15:28:46Z

On Sun, Dec 10, 2023 at 3:35 PM Zorro Lang <zlang@redhat.com> wrote:
>
> On Mon, Dec 04, 2023 at 08:58:56PM +0200, Amir Goldstein wrote:
> > If overlayfs xattr escaping is supported, ensure:
> > * We can create "overlay.*" xattrs on a file in the overlayfs
> > * We can create an xwhiteout file in the overlayfs
> >
> > We check for nesting support by trying to getattr an "overlay.*" xattr
> > in an overlayfs mount, which will return ENOSUPP in older kernels.
> >
> > Signed-off-by: Alexander Larsson <alexl@redhat.com>
> > Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> > ---
>
> Hi Amir,
>
> This test passed with below kernel configuration at first:
> CONFIG_OVERLAY_FS=m
> # CONFIG_OVERLAY_FS_REDIRECT_DIR is not set
> CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y
> # CONFIG_OVERLAY_FS_INDEX is not set
> # CONFIG_OVERLAY_FS_XINO_AUTO is not set
> # CONFIG_OVERLAY_FS_METACOPY is not set
>
> But then I found it fails if I enabled below configurations:
> CONFIG_OVERLAY_FS_REDIRECT_DIR=y
> CONFIG_OVERLAY_FS_INDEX=y
> CONFIG_OVERLAY_FS_XINO_AUTO=y
> CONFIG_OVERLAY_FS_METACOPY=y
>
> Without these configures, this test passed. But with them, it fails as [1].
> The underlying fs is xfs (with default mkfs options), there're not specific
> MOUNT_OPTIONS and MKFS_OPTIONS to use.
>
> I'll delay merging this patchset temporarily, please check.
>

good spotting!

Here is a fix if you want to fix and test it in your tree:

diff --git a/tests/overlay/084 b/tests/overlay/084
index ff451f38..8465caeb 100755
--- a/tests/overlay/084
+++ b/tests/overlay/084
@@ -50,9 +50,10 @@ test_escape()

echo -e "\n== Check xattr escape $prefix =="

- local extra_options=""
+ # index feature would require nfs_export on $nesteddir mount
+ local extra_options="-o index=off"
if [ "$prefix" == "user" ]; then
- extra_options="-o userxattr"
+ extra_options+=",userxattr"
fi

_scratch_mkfs
@@ -146,9 +147,10 @@ test_escaped_xwhiteout()

echo -e "\n== Check escaped xwhiteout $prefix =="

- local extra_options=""
+ # index feature would require nfs_export on $nesteddir mount
+ local extra_options="-o index=off"
if [ "$prefix" == "user" ]; then
- extra_options="-o userxattr"
+ extra_options+=",userxattr"
fi

_scratch_mkfs

Thanks,
Amir.