From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933863AbcDSSzn (ORCPT ); Tue, 19 Apr 2016 14:55:43 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:44560 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932794AbcDSSzj (ORCPT ); Tue, 19 Apr 2016 14:55:39 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Linus Torvalds 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 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> Date: Tue, 19 Apr 2016 13:44:40 -0500 In-Reply-To: (Linus Torvalds's message of "Sat, 16 Apr 2016 11:31:14 -0700 (PDT)") Message-ID: <87inzdmo9z.fsf_-_@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-AID: U2FsdGVkX1/95yVoloiWwaAItVK4xHprBo3n3uGM7qY= X-SA-Exim-Connect-IP: 97.119.105.151 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa03 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa03 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Linus Torvalds X-Spam-Relay-Country: X-Spam-Timing: total 2057 ms - load_scoreonly_sql: 0.06 (0.0%), signal_user_changed: 3.7 (0.2%), b_tie_ro: 2.6 (0.1%), parse: 1.33 (0.1%), extract_message_metadata: 26 (1.2%), get_uri_detail_list: 1.80 (0.1%), tests_pri_-1000: 10 (0.5%), tests_pri_-950: 1.99 (0.1%), tests_pri_-900: 1.69 (0.1%), tests_pri_-400: 33 (1.6%), check_bayes: 31 (1.5%), b_tokenize: 13 (0.6%), b_tok_get_all: 7 (0.4%), b_comp_prob: 3.7 (0.2%), b_tok_touch_all: 3.2 (0.2%), b_finish: 0.86 (0.0%), tests_pri_0: 1967 (95.7%), check_dkim_signature: 0.98 (0.0%), check_dkim_adsp: 111 (5.4%), tests_pri_500: 7 (0.3%), rewrite_mail: 0.00 (0.0%) Subject: Does anyone care about a race free ptsname? X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Wed, 24 Sep 2014 11:00:52 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Linus Torvalds writes: > What this does is get rid of the horrible notion of having that > > struct inode *ptmx_inode > > be the interface between the pty code and devpts. By de-emphasizing the > ptmx inode, a lot of things actually get cleaner, and we will have a much > saner way forward. 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. The only way we have today to query which instance of devpts the pty is on is through fstat and look st_dev to see if the file is on the correct filesystem. This works when /dev/pts/ptmx is used and fails when /dev/ptmx is used. Does anyone else care? If no one cares I will stop worrying about it and just get on with fixing the rest of this mess which there definitely seems to be the will to do. Eric