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.33k stars 1.02k forks source link

ioctl07 fails on powerpc #1193

Open andree182 opened 1 month ago

andree182 commented 1 month ago

The test calls ioctl with invalid address (-1), however https://github.com/lattera/glibc/blob/master/sysdeps/unix/sysv/linux/tcgetattr.c called from the ioctl wrapper https://github.com/lattera/glibc/blob/master/sysdeps/unix/sysv/linux/powerpc/ioctl.c has no safeguards against bad address and causes some stack damage or whatever:

ioctl01
tst_test.c:1690: TINFO: LTP version: 20230929
tst_test.c:1574: TINFO: Timeout per run is 0h 00m 30s
ioctl01.c:62: TPASS: File descriptor is invalid (termio) : EBADF (9)
ioctl01.c:62: TPASS: File descriptor is invalid (termios) : EBADF (9)
ioctl01.c:62: TPASS: Termio address is invalid : EFAULT (14)
tst_test.c:1634: TBROK: Test killed by SIGSEGV!
[   10.736126] ioctl01[61]: segfault (11) at 3 nip 3c3718 lr 3c369c code 1 in libc.so.6[290000+217000]
[   10.736578] ioctl01[61]: code: 3920f000 7c034840 41c100b0 2c030000 40c2007c 80010014 81610018 80a1001c 
[   10.736627] ioctl01[61]: code: 80c10010 88e10033 80810024 81810038 <901f0004> 917f0008 80010034 81610020 

Perhaps the test should be disabled on powerpc?

metan-ucw commented 1 month ago

What we usually do in these cases is to run the test in a child process and pass it if child segfaulted as well.