Bug 202271 - Regression in 32-bit-compat TIOCGPTPEER ioctl due to 311fc65c9fb9c966bca8e6f3ff8132ce57344ab9
Summary: Regression in 32-bit-compat TIOCGPTPEER ioctl due to 311fc65c9fb9c966bca8e6f3...
Alias: None
Product: Drivers
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: drivers_other
Depends on:
Reported: 2019-01-15 05:23 UTC by Robert O'Callahan
Modified: 2019-01-15 19:37 UTC (History)
0 users

See Also:
Kernel Version: 4.19.10-200.fc28.x86_64
Tree: Mainline
Regression: No

testcase (277 bytes, text/plain)
2019-01-15 05:23 UTC, Robert O'Callahan

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]
Comment 2 Robert O'Callahan 2019-01-15 19:37:19 UTC
This is already fixed on master by commit e21120383f2dce32312f63ffca145ff8a87d41f5.

Note You need to log in before you can comment on or make changes to this bug.