Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753022AbcDIOPZ (ORCPT ); Sat, 9 Apr 2016 10:15:25 -0400 Received: from terminus.zytor.com ([198.137.202.10]:54124 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751534AbcDIOPY (ORCPT ); Sat, 9 Apr 2016 10:15:24 -0400 User-Agent: K-9 Mail for Android In-Reply-To: <20160409140909.42315e6d@lxorguk.ukuu.org.uk> References: <878u0s3orx.fsf_-_@x220.int.ebiederm.org> <1459819769-30387-1-git-send-email-ebiederm@xmission.com> <87twjcorwg.fsf@x220.int.ebiederm.org> <20160409140909.42315e6d@lxorguk.ukuu.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Subject: Re: [PATCH 01/13] devpts: Teach /dev/ptmx to find the associated devpts via path lookup From: "H. Peter Anvin" Date: Sat, 09 Apr 2016 07:10:04 -0700 To: One Thousand Gnomes , ebiederm@xmission.com CC: Linus Torvalds , Peter Hurley , Greg KH , Jiri Slaby , Aurelien Jarno , Andy Lutomirski , Florian Weimer , Al Viro , Serge Hallyn , Jann Horn , "security@kernel.org" , "security@ubuntu.com >> security" , security@debian.org, Willy Tarreau , Linux Kernel Mailing List Message-ID: <83FE8CD2-C0A2-4ADB-AEBD-8DD89AD4F88A@zytor.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1265 Lines: 29 On April 9, 2016 6:09:09 AM PDT, One Thousand Gnomes wrote: > >> If anyone has a better idea on how userspace should connect the >master >> pty file descriptor the slave file descriptor, I would be willing to >> implement that instead. > >If we are willing to go away from the existing mess of a tty interface >inflicted on us by BSD and then mashed up by POSIX then a syscall of > > int err = ptypair(int fd[2], int perms, int flags); > >[where flags is the O_ ones we usually need to cover (CLOEXEC etc) and >maybe even some kind of "private" flag to say don't even expose it via >devpts). > >would do remarkably sane things to the majoirty of use cases as it >breaks >the dependence on grantpt and also the historic screwup that pty pairs >aren't allocated atomically with both file handles returned as pipe() >does. > >Alan We don't even need to do that if we'd be willing to change the user space interface... if we could rely on the POSIX interface then posix_openpt() could simply open /dev/pts/ptmx and everything would just work. The trick here is how to make it work in the presence of some extremely bad practices in existing userspace. -- Sent from my Android device with K-9 Mail. Please excuse brevity and formatting.