From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752871AbcDSXXa (ORCPT ); Tue, 19 Apr 2016 19:23:30 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:34635 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752469AbcDSXX2 (ORCPT ); Tue, 19 Apr 2016 19:23:28 -0400 MIME-Version: 1.0 In-Reply-To: <87inzdmo9z.fsf_-_@x220.int.ebiederm.org> References: <878u0s3orx.fsf_-_@x220.int.ebiederm.org> <87twjcorwg.fsf@x220.int.ebiederm.org> <20160409140909.42315e6d@lxorguk.ukuu.org.uk> <83FE8CD2-C0A2-4ADB-AEBD-8DD89AD4F88A@zytor.com> <87bn5ij0x1.fsf@x220.int.ebiederm.org> <78205895-E11D-417F-91DC-4BCA0B61A122@zytor.com> <570D4781.3070600@zytor.com> <877ffyzy1j.fsf_-_@x220.int.ebiederm.org> <87inzdmo9z.fsf_-_@x220.int.ebiederm.org> Date: Tue, 19 Apr 2016 16:23:27 -0700 X-Google-Sender-Auth: vx1t4d0I-gOiIpYKzntJFrNH6zs Message-ID: Subject: Re: Does anyone care about a race free ptsname? From: Linus Torvalds To: "Eric W. Biederman" Cc: "H. Peter Anvin" , Andy Lutomirski , security@debian.org, "security@kernel.org" , Al Viro , "security@ubuntu.com >> security" , Peter Hurley , Serge Hallyn , Willy Tarreau , Aurelien Jarno , One Thousand Gnomes , Jann Horn , Greg KH , Linux Kernel Mailing List , Jiri Slaby , Florian Weimer Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 19, 2016 at 11:44 AM, Eric W. Biederman wrote: > > I will take a look in a minute. Before I do that I want to mention > why I care about /dev/pts/ptmx. > > There is a posix function that is widely used called ptsname. It's > function is to take a master file descriptor and returns the path to the > slave. > > All we have in the kernel to support ptsname is an ioctl TIOCGPTN that > returns the pty number in the appropriate instance of devpts. Don't bother with that completely mis-designed interface.It's crap. So we'll keep it working for legacy models, but the whole "return an integer index" is just pure shit. It's not worth worrying about. We can (and probably should) just introduce a new ioctl or even a system call that just does the sane thing and returns the pathname from the kernel. But for legacy reasons, we will continue to just return that silly integer, and it will continue to work - if you use /dev/pts/. And if you mount devpts anywhere else, or have some other setup, that interface *cannot* work. More importantly, it's not even worth worrying about. Linus