linux-test-project / ltp

Linux Test Project (mailing list: https://lists.linux.it/listinfo/ltp)
https://linux-test-project.readthedocs.io/
GNU General Public License v2.0
2.28k stars 999 forks source link

arm32: Test killed by SIGSEGV: mq_timedsend01 mq_timedreceive01 pread02 recvmmsg01 semctl03 sigwait #996

Open realhezhe opened 1 year ago

realhezhe commented 1 year ago

On arm32 archtectures, tmq_timedsend01 mq_timedreceive01 pread02 recvmmsg01 semctl03 sigwait would be killed by SIGSEGV. The cause for tmq_timedsend01 mq_timedreceive01 pread02 recvmmsg01 semctl03 sigwait is that the bad address(-1) for timeout passed to libc can pass the NULL check but would get SIGSEGV when being dereferenced later. The cause for pread02 is still unclear, dying in syscall's assemble blob.

Seems there is still no good way for libc to validate a pointer other than NULL check. We might need to either change the bad address to NULL or handle the SIGSEGV gracefully to fail the cases clearly.

tst_test.c:1431: TINFO: Timeout per run is 0h 05m 00s mq_timedsend01.c:153: TINFO: Testing variant: vDSO or syscall with libc spec mq_timedsend01.c:259: TPASS: mq_timedreceive() returned 0, priority 0, length: 8192 mq_timedsend01.c:259: TPASS: mq_timedreceive() returned 1, priority 0, length: 8192 mq_timedsend01.c:259: TPASS: mq_timedreceive() returned 8192, priority 0, length: 8192 mq_timedsend01.c:259: TPASS: mq_timedreceive() returned 1, priority 32767, length: 8192 mq_timedsend01.c:210: TPASS: mq_timedsend() failed expectedly: EMSGSIZE (90) mq_timedsend01.c:210: TPASS: mq_timedsend() failed expectedly: EBADF (9) mq_timedsend01.c:210: TPASS: mq_timedsend() failed expectedly: EBADF (9) mq_timedsend01.c:210: TPASS: mq_timedsend() failed expectedly: EBADF (9) mq_timedsend01.c:259: TPASS: mq_timedreceive() returned 16, priority 0, length: 8192 mq_timedsend01.c:210: TPASS: mq_timedsend() failed expectedly: EINVAL (22) mq_timedsend01.c:210: TPASS: mq_timedsend() failed expectedly: EINVAL (22) /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 1/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 2/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 3/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 4/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 5/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 6/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 7/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 8/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 9/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 10/10 message mq_timedsend01.c:210: TPASS: mq_timedsend() failed expectedly: EINVAL (22) /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 1/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 2/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 3/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 4/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 5/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 6/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 7/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 8/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 9/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 10/10 message mq_timedsend01.c:210: TPASS: mq_timedsend() failed expectedly: EINVAL (22) /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 1/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 2/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 3/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 4/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 5/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 6/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 7/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 8/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 9/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 10/10 message mq_timedsend01.c:210: TPASS: mq_timedsend() failed expectedly: ETIMEDOUT (110) /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 1/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 2/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 3/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 4/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 5/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 6/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 7/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 8/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 9/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 10/10 message mq_timedsend01.c:210: TPASS: mq_timedsend() failed expectedly: EINTR (4) /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 1/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 2/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 3/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 4/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 5/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 6/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 7/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 8/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 9/10 message /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedsend/../utils/mq.h:70: TINFO: receive 10/10 message mq_timedsend01.c:210: TPASS: mq_timedsend() failed expectedly: EFAULT (14) tst_test.c:1484: TBROK: Test killed by SIGSEGV!

tst_test.c:1431: TINFO: Timeout per run is 0h 05m 00s mq_timedreceive01.c:140: TINFO: Testing variant: vDSO or syscall with libc spec mq_timedreceive01.c:223: TPASS: mq_timedreceive() returned 0, priority 0, length: 8192 mq_timedreceive01.c:223: TPASS: mq_timedreceive() returned 1, priority 0, length: 8192 mq_timedreceive01.c:223: TPASS: mq_timedreceive() returned 8192, priority 0, length: 8192 mq_timedreceive01.c:223: TPASS: mq_timedreceive() returned 1, priority 32767, length: 8192 /usr/src/debug/ltp/20220121-r0/git/testcases/kernel/syscalls/mq_timedreceive/../utils/mq.h:70: TINFO: receive 1/1 message mq_timedreceive01.c:197: TPASS: mq_timedreceive() failed expectedly: EMSGSIZE (90) mq_timedreceive01.c:197: TPASS: mq_timedreceive() failed expectedly: EBADF (9) mq_timedreceive01.c:197: TPASS: mq_timedreceive() failed expectedly: EBADF (9) mq_timedreceive01.c:197: TPASS: mq_timedreceive() failed expectedly: EBADF (9) mq_timedreceive01.c:197: TPASS: mq_timedreceive() failed expectedly: EAGAIN/EWOULDBLOCK (11) mq_timedreceive01.c:197: TPASS: mq_timedreceive() failed expectedly: EINVAL (22) mq_timedreceive01.c:197: TPASS: mq_timedreceive() failed expectedly: EINVAL (22) mq_timedreceive01.c:197: TPASS: mq_timedreceive() failed expectedly: EINVAL (22) mq_timedreceive01.c:197: TPASS: mq_timedreceive() failed expectedly: ETIMEDOUT (110) mq_timedreceive01.c:197: TPASS: mq_timedreceive() failed expectedly: EINTR (4) tst_test.c:1484: TBROK: Test killed by SIGSEGV!

tst_test.c:1431: TINFO: Timeout per run is 0h 05m 00s pread02.c:44: TPASS: pread(3, 1024, 0) (null) : ESPIPE (29) tst_test.c:1484: TBROK: Test killed by SIGSEGV!

tst_buffers.c:55: TINFO: Test is using guarded buffers tst_test.c:1431: TINFO: Timeout per run is 0h 05m 00s recvmmsg01.c:102: TINFO: Testing variant: vDSO or syscall with libc spec recvmmsg01.c:92: TPASS: recvmmsg() bad socket file descriptor : EBADF (9) recvmmsg01.c:92: TPASS: recvmmsg() bad message vector address : EFAULT (14) recvmmsg01.c:92: TPASS: recvmmsg() negative seconds in timeout : EINVAL (22) recvmmsg01.c:92: TPASS: recvmmsg() overflow in nanoseconds in timeout : EINVAL (22) tst_test.c:1484: TBROK: Test killed by SIGSEGV!

tst_test.c:1431: TINFO: Timeout per run is 0h 05m 00s semctl03.c:82: TINFO: Testing variant: libc semctl() semctl03.c:73: TPASS: semctl() with invalid IPC command : EINVAL (22) tst_test.c:1484: TBROK: Test killed by SIGSEGV!

tst_test.c:1431: TINFO: Timeout per run is 0h 05m 00s sigwait.c:27: TPASS: Wait interrupted by expected signal sigwait.c:88: TPASS: struct siginfo is correct sigwait.c:148: TPASS: struct siginfo is correct sigwait.c:160: TPASS: sigwaitinfo restored the original mask sigwait.c:113: TPASS: Wait interrupted by expected signal sigwait.c:259: TPASS: Wait interrupted by expected signal sigwait.c:268: TPASS: sigwaitinfo restored the original mask sigwait.c:302: TPASS: Fault occurred while accessing the buffers sigwait.c:344: TPASS: Child exited with expected code tst_test.c:1484: TBROK: Test killed by SIGSEGV!

metan-ucw commented 1 year ago

The usual fix to such tests is to fix them so that the SIGSEGV is caught and translated to PASS in the case of the EFAULT errno. We usually deal with that by running the test in a child as in fstat03.c or for the case of test variants we can skip the libc variant and keep the EFAULT case only for the syscall variant.