This commit 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.
Testcase in https://bugzilla.kernel.org/show_bug.cgi?id=202271.
I found this bug running the rr test suite.
Rob
--
Su ot deraeppa sah dna Rehtaf eht htiw saw hcihw, efil lanrete eht uoy
ot mialcorp ew dna, ti ot yfitset dna ti nees evah ew; deraeppa efil
eht. Efil fo Drow eht gninrecnoc mialcorp ew siht - dehcuot evah sdnah
ruo dna ta dekool evah ew hcihw, seye ruo htiw nees evah ew hcihw,
draeh evah ew hcihw, gninnigeb eht morf saw hcihw taht.
"Robert O'Callahan" <[email protected]> writes:
> This commit 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.
>
> Testcase in https://bugzilla.kernel.org/show_bug.cgi?id=202271.
>
> I found this bug running the rr test suite.
Can you confirm this fixes it for you?
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index bfe9ad85b362..1b0847976b28 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -2815,6 +2815,7 @@ static long tty_compat_ioctl(struct file *file, unsigned int cmd,
case TCXONC:
case TIOCMIWAIT:
case TIOCSERCONFIG:
+ case TIOCGPTPEER:
return tty_ioctl(file, cmd, arg);
}
Thank you,
Eric Biederman
On Tue, Jan 15, 2019 at 8:25 PM Eric W. Biederman <[email protected]> wrote:
> Can you confirm this fixes it for you?
Sorry --- I made a mistake. It looks like this is already fixed on
master, by commit e21120383f2dce32312f63ffca145ff8a87d41f5 (though I
don't think Al Viro knew he was fixing this bug). So, nothing to do
here.
Thanks,
Rob
--
Su ot deraeppa sah dna Rehtaf eht htiw saw hcihw, efil lanrete eht uoy
ot mialcorp ew dna, ti ot yfitset dna ti nees evah ew; deraeppa efil
eht. Efil fo Drow eht gninrecnoc mialcorp ew siht - dehcuot evah sdnah
ruo dna ta dekool evah ew hcihw, seye ruo htiw nees evah ew hcihw,
draeh evah ew hcihw, gninnigeb eht morf saw hcihw taht.
On Wed, Jan 16, 2019 at 08:36:49AM +1300, Robert O'Callahan wrote:
> On Tue, Jan 15, 2019 at 8:25 PM Eric W. Biederman <[email protected]> wrote:
> > Can you confirm this fixes it for you?
>
> Sorry --- I made a mistake. It looks like this is already fixed on
> master, by commit e21120383f2dce32312f63ffca145ff8a87d41f5 (though I
> don't think Al Viro knew he was fixing this bug). So, nothing to do
> here.
As you found a regression from 4.13 - 4.19, shouldn't we backport some
fix to the 4.14 and 4.19 kernels for this?
thanks,
greg k-h