Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933987AbcDSUnT (ORCPT ); Tue, 19 Apr 2016 16:43:19 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:41446 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932241AbcDSUnS (ORCPT ); Tue, 19 Apr 2016 16:43:18 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: "H. Peter Anvin" Cc: Linus Torvalds , 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> <87inzdmo9z.fsf_-_@x220.int.ebiederm.org> Date: Tue, 19 Apr 2016 15:32:15 -0500 In-Reply-To: (H. Peter Anvin's message of "Tue, 19 Apr 2016 12:16:13 -0700") Message-ID: <877fftiblc.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/Qu/CFP/q2+Znhw4XpBuHdUeewkW3T2pU= 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.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;"H. Peter Anvin" X-Spam-Relay-Country: X-Spam-Timing: total 849 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 3.4 (0.4%), b_tie_ro: 2.4 (0.3%), parse: 0.74 (0.1%), extract_message_metadata: 11 (1.3%), get_uri_detail_list: 0.98 (0.1%), tests_pri_-1000: 4.8 (0.6%), tests_pri_-950: 1.20 (0.1%), tests_pri_-900: 1.00 (0.1%), tests_pri_-400: 22 (2.6%), check_bayes: 21 (2.4%), b_tokenize: 6 (0.7%), b_tok_get_all: 7 (0.8%), b_comp_prob: 1.85 (0.2%), b_tok_touch_all: 3.0 (0.4%), b_finish: 0.71 (0.1%), tests_pri_0: 199 (23.4%), check_dkim_signature: 0.46 (0.1%), check_dkim_adsp: 2.8 (0.3%), tests_pri_500: 603 (71.0%), poll_dns_idle: 597 (70.4%), rewrite_mail: 0.00 (0.0%) Subject: Re: 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 Content-Length: 1185 Lines: 28 "H. Peter Anvin" writes: > We could add another ioctl for that purpose of we need to. Perhaps an > ioctl which returns a file descriptor to the slave device? > > However, since we are now defining ptmx to explicitly look up pts/ by > name it seems like /dev/ptmx -> /dev/pts/# is true by definition. If > what you worry about is namespace reshuffling then ptsname() is the > wrong interface in the first place since it returns a pathname. Good point. Yes if we are not using devpts_mnt (hooray!) there should be no complications, and the largest check we would need is to verify that /dev/ptmx is in the current namespace. > Fwiw, in klibc ptsname() is basically just an sprintf(). The challenge came in operations such as granpt. Where you are passed in a ptmx file descriptor from who knows where, and you pass it on to applications such as pt_chown which run with elevatated privileged. As the information is available of where devpts is mounted in relationship to /dev/ptmx I have no more concerns about implementing ptsname. Path pased is also sufficiently backwards compatible it would not usually be wrong even on existing kernels. Good enough. Eric