Bugzilla – Bug 1217145
LTP test ioctl02.c failed: ioctl TCSETA TCGETA inconsistent.
Last modified: 2024-02-26 16:08:59 UTC
## Observation openQA test in scenario sle-15-SP6-Online-ppc64le-ltp_syscalls@ppc64le-virtio fails in [ioctl02](https://openqa.suse.de/tests/12799195/modules/ioctl02/steps/7) The main step for this test case are: termio.c_lflag =((unsigned short)(ISIG | ICANON | XCASE | ECHO | ECHOE | NOFLSH)); IOCTL(parentfd, TCSETA, &termio); IOCTL(parentfd, TCGETA, &termio); chk_tty_parms(); <<<<< check the lflag is same as setting or not LTP log: susetest:~/ltp/testcases/kernel/syscalls/ioctl # ./ioctl02 -D /dev/tty0 tst_test.c:1690: TINFO: LTP version: 20230929 tst_test.c:1576: TINFO: Timeout per run is 0h 00m 30s ioctl02.c:148: TFAIL: lflag has incorrect value. 40612 ioctl02.c:179: TINFO: child: parent has finished testing In order to identify issue related with glibc or kernel, i replace ioctl to syscall directly but issue still exist, so it should be kernel related issue. Code change: - SAFE_IOCTL(parentfd, TCSETA, &termio); + /* SAFE_IOCTL(parentfd, TCSETA, &termio); */ + + if (syscall(__NR_ioctl, parentfd, TCSETA, &termio) == -1) { + perror("Error getting terminal attributes"); + return 1; + } /* Get termio and see if all parameters actually got set */ - SAFE_IOCTL(parentfd, TCGETA, &termio); + /* SAFE_IOCTL(parentfd, TCGETA, &termio); */ + if (syscall(__NR_ioctl, parentfd, TCGETA, &termio) == -1) { + perror("Error getting terminal attributes"); + return 1; + } chk_tty_parms(); }
Is it specific to powerpc, or can it be generically? Also, is it a regression? A bit more details please.
(In reply to Takashi Iwai from comment #1) > Is it specific to powerpc, or can it be generically? > ONLY happen on powerpc, such as x86 result is pass. > Also, is it a regression? A bit more details please. Not regression. I move case manually run on 15sp5, issue still exist.
FYI the problem started with this LTP change [1]: which caused ppc64le specific failure (on any kernel version): ioctl02.c:162: TFAIL: lflag has incorrect value. 40612 later change, which added struct termios [2] caused failing it on ppc64le (again, on any kernel version): ioctl02.c:80: TINFO: Testing termios variant ioctl02.c:141: TBROK: ioctl(3,(v->tcset),...) failed: ENOTTY (25) [1] https://github.com/linux-test-project/ltp/commit/73dcf173c [2] https://github.com/linux-test-project/ltp/commit/0ec2164
I suppose similarly as for ioctl01.c (#1217134) glibc ppc64le specific handling of TCSETS (and TCGETS) in sysdeps/unix/sysv/linux/powerpc/internal-ioctl.h causes ENOTTY. I wonder how to workaround it.
Both failures (wrong c_lflag value and ENOTTY error) turn out to be a test issue. The c_lflag value bug was due to NOFLSH bit not fitting into unsigned short on PPC64LE. It was stripped during TCSETS by typecast but included in the TCGETS check. The ENOTTY was caused by including the wrong struct termios definition (and possibly also wrong TCSETS constant) from <termios.h>. The correct definition is in <asm/termbits.h>. Patch sent to LTP upstream.