4 # Overlayfs should only filter out xattr starting with
5 # "trusted.overlay.", not "trusted.overlay".
7 # Setting xattrs like "trusted.overlay.xxx" is not allowed.
8 # Setting xattrs like "trusted.overlayxxx" is allowed.
10 # v4.8-rc1 introduced a regression that we can't set xattrs
11 # like "trusted.overlayxxx". Kernel commit below fixed it
13 # fe2b75952347 ovl: Fix OVL_XATTR_PREFIX
15 # This case tests both get/set of these 2 kinds of xattrs.
17 # Pattern "trusted.overlay.xxx" should fail, however the
18 # errno returned by set/get varies among kernel versions.
19 # Pattern "trusted.overlayxxx" shold always work.
21 # This reproducer was originally written by
22 # Miklos Szeredi <mszeredi@redhat.com>
24 #-----------------------------------------------------------------------
25 # Copyright (c) 2017 Red Hat Inc. All Rights Reserved.
27 # This program is free software; you can redistribute it and/or
28 # modify it under the terms of the GNU General Public License as
29 # published by the Free Software Foundation.
31 # This program is distributed in the hope that it would be useful,
32 # but WITHOUT ANY WARRANTY; without even the implied warranty of
33 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34 # GNU General Public License for more details.
36 # You should have received a copy of the GNU General Public License
37 # along with this program; if not, write the Free Software Foundation,
38 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
39 #-----------------------------------------------------------------------
43 seqres=$RESULT_DIR/$seq
44 echo "QA output created by $seq"
48 status=1 # failure is the default!
49 trap "_cleanup; exit \$status" 0 1 2 3 15
57 # get standard environment, filters and checks
62 # remove previous $seqres.full before test
65 # real QA test starts here
67 # Modify as appropriate.
73 # Remove all files from previous tests
78 touch $SCRATCH_MNT/testf0
79 touch $SCRATCH_MNT/testf1
81 # {s,g}etfattr of "trusted.overlayxxx" should work.
82 # v4.3/6/7 v4.8-rc1 v4.8 v4.10
83 # setfattr ok not perm ok ok
84 # getfattr ok no attr ok ok
86 $SETFATTR_PROG -n "trusted.overlayfsrz" -v "n" \
87 $SCRATCH_MNT/testf0 2>&1 | _filter_scratch
89 $GETFATTR_PROG --absolute-names -n "trusted.overlayfsrz" \
90 $SCRATCH_MNT/testf0 2>&1 | _filter_scratch
92 # {s,g}etfattr of "trusted.overlay.xxx" should fail.
93 # The errno returned varies among kernel versions,
94 # v4.3/7 v4.8-rc1 v4.8 v4.10
95 # setfattr not perm not perm not perm not supp
96 # getfattr no attr no attr not perm not supp
98 # Consider "Operation not {supported,permitted}" pass.
100 $SETFATTR_PROG -n "trusted.overlay.fsz" -v "n" \
101 $SCRATCH_MNT/testf1 2>&1 | _filter_scratch | \
102 sed -e 's/permitted/supported/g'
104 $GETFATTR_PROG --absolute-names -n "trusted.overlay.fsz" \
105 $SCRATCH_MNT/testf1 2>&1 | _filter_scratch | \
106 sed -e 's/permitted/supported/g'