Bug 202271

Summary: Regression in 32-bit-compat TIOCGPTPEER ioctl due to 311fc65c9fb9c966bca8e6f3ff8132ce57344ab9
Product: Drivers Reporter: Robert O'Callahan (robert)
Component: OtherAssignee: drivers_other
Status: RESOLVED INVALID    
Severity: normal    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.19.10-200.fc28.x86_64 Subsystem:
Regression: No Bisected commit-id:
Attachments: testcase

Description Robert O'Callahan 2019-01-15 05:23:03 UTC
Commit 311fc65c9fb9c966bca8e6f3ff8132ce57344ab9 refactored the implementation of TIOCGPTPEER, moving "case TIOCGPTPEER" from pty_unix98_ioctl() to tty_ioctl(). pty_unix98_ioctl() is called by pty_unix98_compat_ioctl(), so before the commit, TIOCGPTPEER worked for 32-bit userspace. Unfortunately tty_compat_ioctl() does not call tty_ioctl() so after the commit, TIOCGPTPEER from 32-bit userspace fails with ENOTTY.

I found this bug running the rr test suite.

I've attached a test program. Results:

[roc@localhost ~]$ gcc -o ~/tmp/test ~/tmp/test.c
[roc@localhost ~]$ ~/tmp/test
[roc@localhost ~]$ gcc -m32 -o ~/tmp/test ~/tmp/test.c
[roc@localhost ~]$ ~/tmp/test
TIOCGPTPEER failed: Inappropriate ioctl for device
Comment 1 Robert O'Callahan 2019-01-15 05:23:38 UTC
Created attachment 280475 [details]
testcase
Comment 2 Robert O'Callahan 2019-01-15 19:37:19 UTC
This is already fixed on master by commit e21120383f2dce32312f63ffca145ff8a87d41f5.