* [PATCH] xfstests: overlay: Do not lose security.capability xattr over metadata only file copy-up
@ 2019-01-30 16:32 Vivek Goyal
2019-01-30 17:58 ` Amir Goldstein
0 siblings, 1 reply; 2+ messages in thread
From: Vivek Goyal @ 2019-01-30 16:32 UTC (permalink / raw)
To: fstests, linux-unionfs; +Cc: Amir Goldstein, Miklos Szeredi
Extend test 064 to check security.capability xattr is not lost over copy-up
of a metadata only file. This requires mounting overlay with option
metacopy=on and first trigger metadata only copy-up and then trigger
data copy-up.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
tests/overlay/064 | 18 ++++++++++++++++++
tests/overlay/064.out | 1 +
2 files changed, 19 insertions(+)
Index: xfstests-dev/tests/overlay/064
===================================================================
--- xfstests-dev.orig/tests/overlay/064 2019-01-28 15:03:12.590434802 -0500
+++ xfstests-dev/tests/overlay/064 2019-01-30 11:18:29.595591985 -0500
@@ -55,6 +55,24 @@ $XFS_IO_PROG -c "stat" ${SCRATCH_MNT}/fi
# Make sure cap_setuid is still there
$GETCAP_PROG ${SCRATCH_MNT}/file | _filter_scratch
+# Test copy-up with metacopy on.
+$UMOUNT_PROG $SCRATCH_MNT
+_scratch_mkfs
+echo "This is lower" >> ${lowerdir}/file
+
+# Set CAP_SETUID
+$SETCAP_PROG cap_setuid+ep ${lowerdir}/file
+_scratch_mount "-o metacopy=on"
+
+# Trigger metadata only copy-up
+chmod 000 ${SCRATCH_MNT}/file
+
+# Trigger data copy-up
+$XFS_IO_PROG -c "stat" ${SCRATCH_MNT}/file >>$seqres.full
+
+# Make sure cap_setuid is still there
+$GETCAP_PROG ${SCRATCH_MNT}/file | _filter_scratch
+
# success, all done
status=0
exit
Index: xfstests-dev/tests/overlay/064.out
===================================================================
--- xfstests-dev.orig/tests/overlay/064.out 2019-01-28 15:03:12.590434802 -0500
+++ xfstests-dev/tests/overlay/064.out 2019-01-30 11:21:11.745591985 -0500
@@ -1,2 +1,3 @@
QA output created by 064
SCRATCH_MNT/file = cap_setuid+ep
+SCRATCH_MNT/file = cap_setuid+ep
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] xfstests: overlay: Do not lose security.capability xattr over metadata only file copy-up
2019-01-30 16:32 [PATCH] xfstests: overlay: Do not lose security.capability xattr over metadata only file copy-up Vivek Goyal
@ 2019-01-30 17:58 ` Amir Goldstein
0 siblings, 0 replies; 2+ messages in thread
From: Amir Goldstein @ 2019-01-30 17:58 UTC (permalink / raw)
To: Vivek Goyal; +Cc: fstests, overlayfs, Miklos Szeredi
On Wed, Jan 30, 2019 at 6:32 PM Vivek Goyal <vgoyal@redhat.com> wrote:
>
> Extend test 064 to check security.capability xattr is not lost over copy-up
> of a metadata only file. This requires mounting overlay with option
> metacopy=on and first trigger metadata only copy-up and then trigger
> data copy-up.
>
I'm ok with extending the test, but it is not done right.
For using metacopy=on you need:
_require_scratch_overlay_features metacopy, so test will be skipped
on kernel < 4.19, but then the existing test case won't run on old kernels.
That is fine (I guess?) because the bug was introduced by metacopy
patches anyway.
So instead of repeating the test, I suggest to mount overlay with metacopy=on
to begin with and have 2 test files. One gets metacopied and then both get
data copied.
Thanks,
Amir.
> Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
> ---
> tests/overlay/064 | 18 ++++++++++++++++++
> tests/overlay/064.out | 1 +
> 2 files changed, 19 insertions(+)
>
> Index: xfstests-dev/tests/overlay/064
> ===================================================================
> --- xfstests-dev.orig/tests/overlay/064 2019-01-28 15:03:12.590434802 -0500
> +++ xfstests-dev/tests/overlay/064 2019-01-30 11:18:29.595591985 -0500
> @@ -55,6 +55,24 @@ $XFS_IO_PROG -c "stat" ${SCRATCH_MNT}/fi
> # Make sure cap_setuid is still there
> $GETCAP_PROG ${SCRATCH_MNT}/file | _filter_scratch
>
> +# Test copy-up with metacopy on.
> +$UMOUNT_PROG $SCRATCH_MNT
> +_scratch_mkfs
> +echo "This is lower" >> ${lowerdir}/file
> +
> +# Set CAP_SETUID
> +$SETCAP_PROG cap_setuid+ep ${lowerdir}/file
> +_scratch_mount "-o metacopy=on"
> +
> +# Trigger metadata only copy-up
> +chmod 000 ${SCRATCH_MNT}/file
> +
> +# Trigger data copy-up
> +$XFS_IO_PROG -c "stat" ${SCRATCH_MNT}/file >>$seqres.full
> +
> +# Make sure cap_setuid is still there
> +$GETCAP_PROG ${SCRATCH_MNT}/file | _filter_scratch
> +
> # success, all done
> status=0
> exit
> Index: xfstests-dev/tests/overlay/064.out
> ===================================================================
> --- xfstests-dev.orig/tests/overlay/064.out 2019-01-28 15:03:12.590434802 -0500
> +++ xfstests-dev/tests/overlay/064.out 2019-01-30 11:21:11.745591985 -0500
> @@ -1,2 +1,3 @@
> QA output created by 064
> SCRATCH_MNT/file = cap_setuid+ep
> +SCRATCH_MNT/file = cap_setuid+ep
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-01-30 17:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-30 16:32 [PATCH] xfstests: overlay: Do not lose security.capability xattr over metadata only file copy-up Vivek Goyal
2019-01-30 17:58 ` Amir Goldstein
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.