tools/nfs.sh: comment out the fscontext= tests for now
Stephen Smalley
maintainerPATCH v2 1/2 tools/nfs.sh: comment out the fscontext= tests for now
These tests currently fail on mount(2) calls due to the directory being unlabeled at the point where search access is checked. Until we can resolve the underlying issue, comment out these tests to allow the NFS tests to be run. It is unclear that these tests ever passed and retaining them prevents enabling the NFS tests in automated testing.
Before:
Run 'filesystem' tests with mount context option:
fscontext=system_u:object_r:test_filesystem_file_t:s0
filesystem/test .. 1/41 Failed mount(2): Permission denied
# Failed test at filesystem/test line 709.
Failed umount(2): Permission denied
# Failed test at filesystem/test line 720.
Failed mount(2): Permission denied
# Failed test at filesystem/test line 744.
Failed umount(2): Permission denied
# Failed test at filesystem/test line 756.
Failed mount(2): Permission denied
# Failed test at filesystem/test line 780.
Failed umount(2): No such file or directory
# Failed test at filesystem/test line 793.
Failed mount(2): Permission denied
# Failed test at filesystem/test line 851.
Failed umount(2): Permission denied
# Failed test at filesystem/test line 863.
Failed mount(2): Permission denied
# Failed test at filesystem/test line 887.
Failed umount(2): Permission denied
# Failed test at filesystem/test line 899.
Failed mount(2): Permission denied
# Failed test at filesystem/test line 923.
Failed umount(2): Permission denied
# Failed test at filesystem/test line 935.
# Failed test at filesystem/test line 978.
# Looks like you failed 13 tests of 41. filesystem/test .. Dubious, test returned 13 (wstat 3328, 0xd00) Failed 13/41 subtests
Test Summary Report
-------------------
filesystem/test (Wstat: 3328 (exited 13) Tests: 41 Failed: 13)
Failed tests: 23, 25-26, 28-29, 31-32, 34-35, 37-38, 40-41
Non-zero exit status: 13
Files=1, Tests=41, 1 wallclock secs ( 0.02 usr 0.00 sys + 0.22 cusr 0.36 csys = 0.60 CPU)
Result: FAIL
Failed 1/1 test programs. 13/41 subtests failed.
Test failed on line: 85 - Closing down NFS
NFS Closed down
$ sudo ausearch -m AVC -ts recent | grep unlabeled
type=AVC msg=audit(1716989714.176:42466): avc: denied { search } for pid=170755 comm="mount" name="mntpoint" dev="0:60" ino=822109802 scontext=unconfined_u:unconfined_r:test_filesystem_no_watch_mount_t:s0-s0:c0.c1023 tcontext=system_u:object_r:unlabeled_t:s0 tclass=dir permissive=0After:
No failing tests.
--- tools/nfs.sh | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-)
tools/nfs.sh +20 -20
@@ -77,27 +77,27 @@ POPD=0 popd >/dev/null 2>&1 umount /mnt/selinux-testsuite # -echo -e "Run 'filesystem' tests with mount context option:\n\t$FS_CTX" -mount -t nfs -o vers=4.2,$FS_CTX localhost:$TESTDIR /mnt/selinux-testsuite -pushd /mnt/selinux-testsuite >/dev/null 2>&1 -POPD=1 -cd tests -./nfsruntests.pl filesystem/test -cd ../ -POPD=0 -popd >/dev/null 2>&1 -umount /mnt/selinux-testsuite +#echo -e "Run 'filesystem' tests with mount context option:\n\t$FS_CTX" +#mount -t nfs -o vers=4.2,$FS_CTX localhost:$TESTDIR /mnt/selinux-testsuite +#pushd /mnt/selinux-testsuite >/dev/null 2>&1 +#POPD=1 +#cd tests +#./nfsruntests.pl filesystem/test +#cd ../ +#POPD=0 +#popd >/dev/null 2>&1 +#umount /mnt/selinux-testsuite # -echo -e "Run 'fs_filesystem' tests with mount context option:\n\t$FS_CTX" -mount -t nfs -o vers=4.2,$FS_CTX localhost:$TESTDIR /mnt/selinux-testsuite -pushd /mnt/selinux-testsuite >/dev/null 2>&1 -POPD=1 -cd tests -./nfsruntests.pl fs_filesystem/test -cd ../ -POPD=0 -popd >/dev/null 2>&1 -umount /mnt/selinux-testsuite +#echo -e "Run 'fs_filesystem' tests with mount context option:\n\t$FS_CTX" +#mount -t nfs -o vers=4.2,$FS_CTX localhost:$TESTDIR /mnt/selinux-testsuite +#pushd /mnt/selinux-testsuite >/dev/null 2>&1 +#POPD=1 +#cd tests +#./nfsruntests.pl fs_filesystem/test +#cd ../ +#POPD=0 +#popd >/dev/null 2>&1 +#umount /mnt/selinux-testsuite # echo "Run NFS context specific tests" cd tests
Signature · 1 line
2.40.1
Stephen Smalley
maintainerPATCH v2 2/2 tests/nfs_filesystem: remove failing mount
For reasons unclear, we attempt to mount twice, the 2nd time yields EBUSY, and then the following test fails. Remove the 2nd mount, which also resolves the failure.
Before:
Run NFS context specific tests
nfs_filesystem/test .. 2/56 creat(2) Failed: Permission denied
# Failed test at nfs_filesystem/test line 118.
nfs_filesystem/test .. 30/56 creat(2) Failed: Permission denied
# Failed test at nfs_filesystem/test line 118.
nfs_filesystem/test .. 53/56 # Looks like you failed 2 tests of 56. nfs_filesystem/test .. Dubious, test returned 2 (wstat 512, 0x200) Failed 2/56 subtests
Test Summary Report
-------------------
nfs_filesystem/test (Wstat: 512 (exited 2) Tests: 56 Failed: 2)
Failed tests: 7, 35
Non-zero exit status: 2
Files=1, Tests=56, 12 wallclock secs ( 0.02 usr 0.00 sys + 0.15 cusr 0.25 csys = 0.42 CPU)
Result: FAIL
Failed 1/1 test programs. 2/56 subtests failed.
Error on line: 104 - Closing down NFS
umount: /mnt/selinux-testsuite: not mounted.
NFS Closed down
After:
No errors from this test script.
--- tests/nfs_filesystem/test | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
tests/nfs_filesystem/test +1 -12
@@ -38,7 +38,7 @@ BEGIN { $v = " "; } - plan tests => 56; + plan tests => 54; } # Set for testing mount(2) on first run
@@ -100,17 +100,6 @@ while ( $i < 2 ) { ); ok( $result eq 0, $test_msg ); - # First mount(2) ok, second currently fails with EBUSY - $result = system( -"runcon -t test_filesystem_t $mount_cmd $v -s $dev -t $target -f $fs_type -o $mount_opts 2>&1" - ); - if ( $i eq 0 and $result >> 8 eq 16 ) { - ok( 1, "$test_msg - returned EBUSY, possible bug/feature" ); - } - else { - ok( $result eq 0 ); - } - # Create file and change context via type_transition rule, check ok: $result = system( "runcon -t test_filesystem_t $filesystem_dir/create_file -f $target/tests/nfs_filesystem/mntpoint/mp1/test_file -e test_filesystem_filetranscon_t $v"
Signature · 1 line
2.40.1
Paul Moore
maintainerQuoted 114 lines · Stephen Smalley
These tests currently fail on mount(2) calls due to the directory being unlabeled at the point where search access is checked. Until we can resolve the underlying issue, comment out these tests to allow the NFS tests to be run. It is unclear that these tests ever passed and retaining them prevents enabling the NFS tests in automated testing.
Before:
Run 'filesystem' tests with mount context option:
fscontext=system_u:object_r:test_filesystem_file_t:s0
filesystem/test .. 1/41 Failed mount(2): Permission denied# Failed test at filesystem/test line 709.
Failed umount(2): Permission denied# Failed test at filesystem/test line 720.
Failed mount(2): Permission denied# Failed test at filesystem/test line 744.
Failed umount(2): Permission denied# Failed test at filesystem/test line 756.
Failed mount(2): Permission denied# Failed test at filesystem/test line 780.
Failed umount(2): No such file or directory# Failed test at filesystem/test line 793.
Failed mount(2): Permission denied# Failed test at filesystem/test line 851.
Failed umount(2): Permission denied# Failed test at filesystem/test line 863.
Failed mount(2): Permission denied# Failed test at filesystem/test line 887.
Failed umount(2): Permission denied# Failed test at filesystem/test line 899.
Failed mount(2): Permission denied# Failed test at filesystem/test line 923.
Failed umount(2): Permission denied# Failed test at filesystem/test line 935.
# Failed test at filesystem/test line 978.
# Looks like you failed 13 tests of 41. filesystem/test .. Dubious, test returned 13 (wstat 3328,0xd00) Failed 13/41 subtestsTest Summary Report
-------------------
filesystem/test (Wstat: 3328 (exited 13) Tests: 41 Failed: 13)
Failed tests: 23, 25-26, 28-29, 31-32, 34-35, 37-38, 40-41
Non-zero exit status: 13
Files=1, Tests=41, 1 wallclock secs ( 0.02 usr 0.00 sys + 0.22 cusr 0.36 csys = 0.60 CPU)
Result: FAIL
Failed 1/1 test programs. 13/41 subtests failed.
Test failed on line: 85 - Closing down NFS
NFS Closed down$ sudo ausearch -m AVC -ts recent | grep unlabeled type=AVC msg=audit(1716989714.176:42466): avc: denied { search } for pid=170755 comm="mount" name="mntpoint" dev="0:60" ino=822109802 scontext=unconfined_u:unconfined_r:test_filesystem_no_watch_mount_t:s0-s0:c0.c1023 tcontext=system_u:object_r:unlabeled_t:s0 tclass=dir permissive=0After:
No failing tests.Signed-off-by Stephen Smalley <[email protected]>--- tools/nfs.sh | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-)tools/nfs.sh +11
-20@@ -77,27 +77,27 @@ POPD=0 popd >/dev/null 2>&1 umount /mnt/selinux-testsuite # -echo -e "Run 'filesystem' tests with mount context option:\n\t$FS_CTX" -mount -t nfs -o vers=4.2,$FS_CTX localhost:$TESTDIR /mnt/selinux-testsuite -pushd /mnt/selinux-testsuite >/dev/null 2>&1 -POPD=1 -cd tests -./nfsruntests.pl filesystem/test -cd ../ -POPD=0 -popd >/dev/null 2>&1 -umount /mnt/selinux-testsuite +#echo -e "Run 'filesystem' tests with mount context option:\n\t$FS_CTX" +#mount -t nfs -o vers=4.2,$FS_CTX localhost:$TESTDIR /mnt/selinux-testsuite +#pushd /mnt/selinux-testsuite >/dev/null 2>&1 +#POPD=1 +#cd tests +#./nfsruntests.pl filesystem/test +#cd ../ +#POPD=0 +#popd >/dev/null 2>&1 +#umount /mnt/selinux-testsuite # -echo -e "Run 'fs_filesystem' tests with mount context option:\n\t$FS_CTX" -mount -t nfs -o vers=4.2,$FS_CTX localhost:$TESTDIR /mnt/selinux-testsuite -pushd /mnt/selinux-testsuite >/dev/null 2>&1 -POPD=1 -cd tests -./nfsruntests.pl fs_filesystem/test -cd ../ -POPD=0 -popd >/dev/null 2>&1 -umount /mnt/selinux-testsuite +#echo -e "Run 'fs_filesystem' tests with mount context option:\n\t$FS_CTX"
tools/nfs.sh POPD=0 · line 101
Quoted 10 lines
tools/nfs.sh +9
-0+#mount -t nfs -o vers=4.2,$FS_CTX localhost:$TESTDIR /mnt/selinux-testsuite +#pushd /mnt/selinux-testsuite >/dev/null 2>&1 +#POPD=1 +#cd tests +#./nfsruntests.pl fs_filesystem/test +#cd ../ +#POPD=0 +#popd >/dev/null 2>&1 +#umount /mnt/selinux-testsuite #
Thanks for the additional info in the patch description. I think this change is fine, although I have a slight preference to simply removing the dead code rather than commenting it out (a small comment can be inserted referencing the change if that helps), but ultimately I'll leave that decision to Ondrej as he has been really driving maintenance of the selinux-testsuite for the past several years. However, Ondrej hasn't been responding much on-list lately so it is possible he is away for a bit; if that is the case I would say to go ahead with what you have and we can always adjust as needed later.
Regardless, thanks for spending the time on getting the NFS tests working. I wonder if this is something we could get working in the GH Actions CI using NFS over loopback?
Quoted 4 lines
tools/nfs.sh +0
-1echo "Run NFS context specific tests" cd tests --2.40.1
Signature · 1 line
paul-moore.com
Stephen Smalley
maintainerQuoted 10 lines · Paul Moore
Thanks for the additional info in the patch description. I think this change is fine, although I have a slight preference to simply removing the dead code rather than commenting it out (a small comment can be inserted referencing the change if that helps), but ultimately I'll leave that decision to Ondrej as he has been really driving maintenance of the selinux-testsuite for the past several years. However, Ondrej hasn't been responding much on-list lately so it is possible he is away for a bit; if that is the case I would say to go ahead with what you have and we can always adjust as needed later.
Quoted 3 lines
Regardless, thanks for spending the time on getting the NFS tests working. I wonder if this is something we could get working in the GH Actions CI using NFS over loopback?
Yes, that should be trivial - just need to ensure that it installs the additional dependencies identified in the README.md for testing NFS and runs ./tools/nfs.sh, which starts the nfs server, exports to localhost, mounts it, and runs the tests.
Quoted 129 lines · Paul Moore
Quoted 114 lines · Stephen Smalley
These tests currently fail on mount(2) calls due to the directory being unlabeled at the point where search access is checked. Until we can resolve the underlying issue, comment out these tests to allow the NFS tests to be run. It is unclear that these tests ever passed and retaining them prevents enabling the NFS tests in automated testing.
Before:
Run 'filesystem' tests with mount context option:
fscontext=system_u:object_r:test_filesystem_file_t:s0
filesystem/test .. 1/41 Failed mount(2): Permission denied# Failed test at filesystem/test line 709.
Failed umount(2): Permission denied# Failed test at filesystem/test line 720.
Failed mount(2): Permission denied# Failed test at filesystem/test line 744.
Failed umount(2): Permission denied# Failed test at filesystem/test line 756.
Failed mount(2): Permission denied# Failed test at filesystem/test line 780.
Failed umount(2): No such file or directory# Failed test at filesystem/test line 793.
Failed mount(2): Permission denied# Failed test at filesystem/test line 851.
Failed umount(2): Permission denied# Failed test at filesystem/test line 863.
Failed mount(2): Permission denied# Failed test at filesystem/test line 887.
Failed umount(2): Permission denied# Failed test at filesystem/test line 899.
Failed mount(2): Permission denied# Failed test at filesystem/test line 923.
Failed umount(2): Permission denied# Failed test at filesystem/test line 935.
# Failed test at filesystem/test line 978.
# Looks like you failed 13 tests of 41. filesystem/test .. Dubious, test returned 13 (wstat 3328,0xd00) Failed 13/41 subtestsTest Summary Report
-------------------
filesystem/test (Wstat: 3328 (exited 13) Tests: 41 Failed: 13)
Failed tests: 23, 25-26, 28-29, 31-32, 34-35, 37-38, 40-41
Non-zero exit status: 13
Files=1, Tests=41, 1 wallclock secs ( 0.02 usr 0.00 sys + 0.22 cusr 0.36 csys = 0.60 CPU)
Result: FAIL
Failed 1/1 test programs. 13/41 subtests failed.
Test failed on line: 85 - Closing down NFS
NFS Closed down$ sudo ausearch -m AVC -ts recent | grep unlabeled type=AVC msg=audit(1716989714.176:42466): avc: denied { search } for pid=170755 comm="mount" name="mntpoint" dev="0:60" ino=822109802 scontext=unconfined_u:unconfined_r:test_filesystem_no_watch_mount_t:s0-s0:c0.c1023 tcontext=system_u:object_r:unlabeled_t:s0 tclass=dir permissive=0After:
No failing tests.Signed-off-by Stephen Smalley <[email protected]>--- tools/nfs.sh | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-)tools/nfs.sh +11
-20@@ -77,27 +77,27 @@ POPD=0 popd >/dev/null 2>&1 umount /mnt/selinux-testsuite # -echo -e "Run 'filesystem' tests with mount context option:\n\t$FS_CTX" -mount -t nfs -o vers=4.2,$FS_CTX localhost:$TESTDIR /mnt/selinux-testsuite -pushd /mnt/selinux-testsuite >/dev/null 2>&1 -POPD=1 -cd tests -./nfsruntests.pl filesystem/test -cd ../ -POPD=0 -popd >/dev/null 2>&1 -umount /mnt/selinux-testsuite +#echo -e "Run 'filesystem' tests with mount context option:\n\t$FS_CTX" +#mount -t nfs -o vers=4.2,$FS_CTX localhost:$TESTDIR /mnt/selinux-testsuite +#pushd /mnt/selinux-testsuite >/dev/null 2>&1 +#POPD=1 +#cd tests +#./nfsruntests.pl filesystem/test +#cd ../ +#POPD=0 +#popd >/dev/null 2>&1 +#umount /mnt/selinux-testsuite # -echo -e "Run 'fs_filesystem' tests with mount context option:\n\t$FS_CTX" -mount -t nfs -o vers=4.2,$FS_CTX localhost:$TESTDIR /mnt/selinux-testsuite -pushd /mnt/selinux-testsuite >/dev/null 2>&1 -POPD=1 -cd tests -./nfsruntests.pl fs_filesystem/test -cd ../ -POPD=0 -popd >/dev/null 2>&1 -umount /mnt/selinux-testsuite +#echo -e "Run 'fs_filesystem' tests with mount context option:\n\t$FS_CTX"tools/nfs.sh POPD=0 · line 101
Quoted 10 lines
tools/nfs.sh +9
-0+#mount -t nfs -o vers=4.2,$FS_CTX localhost:$TESTDIR /mnt/selinux-testsuite +#pushd /mnt/selinux-testsuite >/dev/null 2>&1 +#POPD=1 +#cd tests +#./nfsruntests.pl fs_filesystem/test +#cd ../ +#POPD=0 +#popd >/dev/null 2>&1 +#umount /mnt/selinux-testsuite #Thanks for the additional info in the patch description. I think this
Quoted 8 lines
change is fine, although I have a slight preference to simply removing the dead code rather than commenting it out (a small comment can be inserted referencing the change if that helps), but ultimately I'll leave that decision to Ondrej as he has been really driving maintenance of the selinux-testsuite for the past several years. However, Ondrej hasn't been responding much on-list lately so it is possible he is away for a bit; if that is the case I would say to go ahead with what you have and we can always adjust as needed later.
Yes, I was on a 2-week vacation ending tuesday (I should have set up an auto-reply, but forgot, sorry...).
I'm fine with the patches, although I would prefer that a comment is added before the commented-out code that explains why it is commented-out (can be taken from the log message), ideally with a link to an issue tracker or ML thread(s) so that future readers have a chance to figure out if the issue has been already fixed or not.
--
Ondrej Mosnacek
Senior Software Engineer, Linux Security - SELinux kernel Red Hat, Inc.