Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752120AbdHPROx (ORCPT ); Wed, 16 Aug 2017 13:14:53 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:57373 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751611AbdHPROv (ORCPT ); Wed, 16 Aug 2017 13:14:51 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Aleksa Sarai Cc: "Michael Kerrisk \(man-pages\)" , linux-man@vger.kernel.org, Greg Kroah-Hartman , containers@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Jiri Slaby , Christian Brauner References: <20170609170147.32311-1-asarai@suse.de> <11706e49-8271-ed8c-3747-19b3e8f2850d@gmail.com> <878tijwjic.fsf@xmission.com> Date: Wed, 16 Aug 2017 12:14:37 -0500 In-Reply-To: (Aleksa Sarai's message of "Thu, 17 Aug 2017 02:54:03 +1000") Message-ID: <87ziaztoxu.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1di1u1-0005rK-6U;;;mid=<87ziaztoxu.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=67.3.200.44;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX19sZ35TyN1/YnnTFT7QM54N0DIhyKzAoEg= X-SA-Exim-Connect-IP: 67.3.200.44 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.4999] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa05 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa05 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Aleksa Sarai X-Spam-Relay-Country: X-Spam-Timing: total 5309 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 3.5 (0.1%), b_tie_ro: 2.5 (0.0%), parse: 1.36 (0.0%), extract_message_metadata: 18 (0.3%), get_uri_detail_list: 3.0 (0.1%), tests_pri_-1000: 9 (0.2%), tests_pri_-950: 1.68 (0.0%), tests_pri_-900: 1.38 (0.0%), tests_pri_-400: 27 (0.5%), check_bayes: 26 (0.5%), b_tokenize: 10 (0.2%), b_tok_get_all: 8 (0.1%), b_comp_prob: 3.0 (0.1%), b_tok_touch_all: 2.5 (0.0%), b_finish: 0.75 (0.0%), tests_pri_0: 657 (12.4%), check_dkim_signature: 0.59 (0.0%), check_dkim_adsp: 3.4 (0.1%), tests_pri_500: 4585 (86.4%), poll_dns_idle: 4580 (86.3%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH] ioctl_tty.2: add TIOCGPTPEER documentation X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -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: 2500 Lines: 55 Aleksa Sarai writes: >> A couple of things to note on the bigger picture. >> >> The glibc library on all distributions has been changed to not have a >> setuid binary pt_chown, that uses ptsname. This was the primary fix >> for the security issue. >> >> The behavior of opening /dev/ptmx has been changed to perform a path >> lookup relative to the location of /dev/ptmx of ./pts/ptmx and open >> it it is a devpts filesystem and to fail otherwise. This further >> makes it hard to confuse userspace this way as /dev/ptmx always >> corresponds to /dev/pts/ptmx. Even in chroots and in other mount >> namespaces. > > I have a feeling that there might be a way to trick glibc if you use > FUSE, but I haven't actually tried to create a PoC for it. Fair point > though. To trick glibc fuse would have to be mounted somewhere on /dev. >> That makes TIOCGPTPEER a very nice addition, but not something people >> have to scramble to use to ensure their system is secure. As a hostile >> environment now has to work very hard to confuse the existing mechanisms. > > There are usecases where you simply need TIOCGPTPEER, and no other > userspace alternative will do, but maybe if we modified the paragraph > to read (as suggested): > > Security-conscious programs interacting with namespaces may > wish to use this operation rather than open(2) with the > pathname returned by ptsname(3). > > This would clarify that there are usecases where you need this > particular feature, without saying causing people to panic over > inaccurate claims of glibc being broken. Does that sound better? I think your original words sounded fine. I would even go for new programs may want to use the new ioctl as it fundamentally less racy and more of what is actually trying to be implemented with the userspace pieces. I just wanted to point out that TIOCGPTPEER while being the interface that it would have been nice had we had since the beginning (and would have avoided all of the problems) is actually not something we need to scramble and use it is just a very nice to have. As the immediate issues have been fixed in other ways. It was not clear to me from the other discussions if you and Michael Kerrisk were aware of the mitigations that had been made to address the security issue. The change to the behavior of /dev/ptmx may need to be documented somewhere. I am not certain if anything has been documented since devpts has started allowing multiple mounts. Eric