SELinuxProject / selinux-testsuite

This is the upstream SELinux testsuite which is designed as a basic set of regression tests for the SELinux kernel functionality.
GNU General Public License v2.0
53 stars 43 forks source link

BUG: commit c37b0182a9af ("tests: add timeout for reading the flag file (#51)") breaks the test suite #52

Closed pcmoore closed 5 years ago

pcmoore commented 5 years ago

Prior to commit c37b0182a9af03fff490fc37b64ebe49e3989f9f the test suite results in the following results on my test VM:

Running as user root with context unconfined_u:unconfined_r:unconfined_t

domain_trans/test ........... ok   
entrypoint/test ............. ok   
execshare/test .............. ok   
exectrace/test .............. ok   
execute_no_trans/test ....... ok   
fdreceive/test .............. ok   
inherit/test ................ ok   
link/test ................... ok   
mkdir/test .................. ok   
msg/test .................... ok     
open/test ................... ok   
ptrace/test ................. ok   
readlink/test ............... ok   
relabel/test ................ ok   
rename/test ................. ok   
rxdir/test .................. ok   
sem/test .................... ok     
setattr/test ................ ok   
setnice/test ................ ok   
shm/test .................... ok     
sigkill/test ................ ok     
stat/test ................... ok   
sysctl/test ................. ok   
task_create/test ............ ok   
task_setnice/test ........... ok   
task_setscheduler/test ...... ok   
task_getscheduler/test ...... ok   
task_getsid/test ............ ok   
task_getpgid/test ........... ok   
task_setpgid/test ........... ok   
file/test ................... ok     
ioctl/test .................. ok   
capable_file/test ........... ok     
capable_net/test ............ ok   
capable_sys/test ............ ok   
dyntrans/test ............... ok   
dyntrace/test ............... ok   
bounds/test ................. ok     
nnp_nosuid/test ............. ok     
mmap/test ................... ok     
unix_socket/test ............ ok   
inet_socket/test ............ ok     
overlay/test ................ ok       
checkreqprot/test ........... ok   
mqueue/test ................. ok     
mac_admin/test .............. ok   
atsecure/test ............... ok   
cap_userns/test ............. ok   
extended_socket_class/test .. ok     
sctp/test ................... ok     
netlink_socket/test ......... ok   
prlimit/test ................ ok   
binder/test ................. ok     
All tests successful.
Files=53, Tests=629, 101 wallclock secs ( 0.32 usr  0.16 sys +  1.93 cusr  6.98 csys =  9.39 CPU)
Result: PASS

With commit c37b0182a9af03fff490fc37b64ebe49e3989f9f I see the following:

Running as user root with context unconfined_u:unconfined_r:unconfined_t

domain_trans/test ........... ok   
entrypoint/test ............. ok   
execshare/test .............. ok   
exectrace/test .............. ok   
execute_no_trans/test ....... ok   
fdreceive/test .............. ok   
inherit/test ................ ok   
link/test ................... ok   
mkdir/test .................. ok   
msg/test .................... ok     
open/test ................... ok   
ptrace/test ................. ok   
readlink/test ............... ok   
relabel/test ................ ok   
rename/test ................. ok   
rxdir/test .................. ok   
sem/test .................... ok     
setattr/test ................ ok   
setnice/test ................ ok   
shm/test .................... ok     
sigkill/test ................ ok     
stat/test ................... ok   
sysctl/test ................. ok   
task_create/test ............ ok   
task_setnice/test ........... ok   
task_setscheduler/test ...... ok   
task_getscheduler/test ...... ok   
task_getsid/test ............ ok   
task_getpgid/test ........... ok   
task_setpgid/test ........... ok   
file/test ................... ok     
ioctl/test .................. ok   
capable_file/test ........... ok     
capable_net/test ............ ok   
capable_sys/test ............ ok   
dyntrans/test ............... ok   
dyntrace/test ............... ok   
bounds/test ................. ok     
nnp_nosuid/test ............. ok     
mmap/test ................... ok     
unix_socket/test ............ ok   
inet_socket/test ............ ok     
overlay/test ................ ok       
checkreqprot/test ........... ok   
mqueue/test ................. ok     
mac_admin/test .............. ok   
atsecure/test ............... ok   
cap_userns/test ............. ok   
extended_socket_class/test .. ok     
sctp/test ................... ok     
netlink_socket/test ......... ok   
prlimit/test ................ ok   
binder/test ................. Client timer expired waiting for Binder reply
binder/test ................. 1/16 
#   Failed test at binder/test line 110.
binder/test ................. 3/16 
#   Failed test at binder/test line 122.
binder/test ................. 4/16 
#   Failed test at binder/test line 127.
binder/test ................. 5/16 
#   Failed test at binder/test line 133.
binder/test ................. 7/16 
#   Failed test at binder/test line 156.
Client timer expired waiting for Binder reply
binder/test ................. 8/16 
#   Failed test at binder/test line 176.
Client timer expired waiting for Binder reply
binder/test ................. 9/16 
#   Failed test at binder/test line 192.
binder/test ................. 11/16 
#   Failed test at binder/test line 204.
binder/test ................. 12/16 
#   Failed test at binder/test line 210.
binder/test ................. 13/16 
#   Failed test at binder/test line 216.
binder/test ................. 15/16 
#   Failed test at binder/test line 242.
Client timer expired waiting for Binder reply
binder/test ................. 16/16 
#   Failed test at binder/test line 261.
# Looks like you failed 12 tests of 16.
binder/test ................. Dubious, test returned 12 (wstat 3072, 0xc00)
Failed 12/16 subtests 

Test Summary Report
-------------------
binder/test               (Wstat: 3072 Tests: 16 Failed: 12)
  Failed tests:  1, 3-5, 7-9, 11-13, 15-16
  Non-zero exit status: 12
Files=53, Tests=629, 222 wallclock secs ( 0.32 usr  0.15 sys +  1.96 cusr  7.51 csys =  9.94 CPU)
Result: FAIL
Failed 1/53 test programs. 12/629 subtests failed.
pcmoore commented 5 years ago

More information on the failure:

# ./test
1..16
Client timer expired waiting for Binder reply
not ok 1
#   Failed test at ./test line 110.
Client main() failing command BR_FAILED_REPLY, exiting.
ok 2
Client timer expired waiting for Binder reply
not ok 3
#   Failed test at ./test line 122.
Client timer expired waiting for Binder reply
not ok 4
#   Failed test at ./test line 127.
Client timer expired waiting for Binder reply
not ok 5
#   Failed test at ./test line 133.
Manager failed to become context manager: Permission denied
ok 6
Client timer expired waiting for Binder reply
not ok 7
#   Failed test at ./test line 156.
Client timer expired waiting for Binder reply
not ok 8
#   Failed test at ./test line 176.
Client timer expired waiting for Binder reply
not ok 9
#   Failed test at ./test line 192.
Client main() failing command BR_FAILED_REPLY, exiting.
ok 10
Client timer expired waiting for Binder reply
not ok 11
#   Failed test at ./test line 204.
Client timer expired waiting for Binder reply
not ok 12
#   Failed test at ./test line 210.
Client timer expired waiting for Binder reply
not ok 13
#   Failed test at ./test line 216.
Manager failed to become context manager: Permission denied
ok 14
Client timer expired waiting for Binder reply
not ok 15
#   Failed test at ./test line 242.
Client timer expired waiting for Binder reply
not ok 16
#   Failed test at ./test line 261.
# Looks like you failed 12 tests of 16.
pcmoore commented 5 years ago

Found the problem:

diff --git a/tests/binder/test b/tests/binder/test
index bb00b72..b888408 100755
--- a/tests/binder/test
+++ b/tests/binder/test
@@ -89,7 +89,7 @@ sub service_start {
     }

     # Wait for it to initialize.
-    system("read -t 5 <>$basedir/flag");
+    system("read -t 5 <>$basedir/$flag");
     return $pid;
 }
pcmoore commented 5 years ago

Fixed with 1a0dc744d2dcbd28c239ae5a7d5784a8630b2a1d.

stephensmalley commented 5 years ago

Mea culpa; merge error on my part

pcmoore commented 5 years ago

No worries, I've had a couple myself. I was just glad it turned out to be something so simple :)