Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759116AbcDHVyV (ORCPT ); Fri, 8 Apr 2016 17:54:21 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:35653 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752795AbcDHVyU (ORCPT ); Fri, 8 Apr 2016 17:54:20 -0400 MIME-Version: 1.0 In-Reply-To: <87d1pzn60f.fsf@x220.int.ebiederm.org> References: <878u0s3orx.fsf_-_@x220.int.ebiederm.org> <1459819769-30387-1-git-send-email-ebiederm@xmission.com> <87twjcorwg.fsf@x220.int.ebiederm.org> <87d1pzn60f.fsf@x220.int.ebiederm.org> Date: Fri, 8 Apr 2016 14:54:18 -0700 X-Google-Sender-Auth: JcgcwC3G5tc6ufRwJ-auIRR8G0k Message-ID: Subject: Re: [PATCH 01/13] devpts: Teach /dev/ptmx to find the associated devpts via path lookup From: Linus Torvalds To: "Eric W. Biederman" Cc: Andy Lutomirski , security@debian.org, "security@kernel.org" , Al Viro , "security@ubuntu.com >> security" , Peter Hurley , Serge Hallyn , Willy Tarreau , Aurelien Jarno , Jann Horn , Greg KH , Linux Kernel Mailing List , Jiri Slaby , Florian Weimer , "H. Peter Anvin" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1814 Lines: 46 On Fri, Apr 8, 2016 at 2:29 PM, Eric W. Biederman wrote: > > I don't think so. For one it depends on getting s_user_ns which should > happen but is not there yet. For another the way you describe > it you would break the case of > > unshare(CLONE_NEWUSER); > unshare(CLONE_NEWNS); > open("/dev/ptmx"); > > Which is actually more likely to break userspace than anything else we > have considered. I know people actually do that. .. but you could just check that the ptmx node is actually the same superblock that the pts directory is mounted on. If it's a bind mount, that wouldn't be true. But more fundamentally I still don't actually understand why you even really care. We get the wrong pts case *today*. We'd get a different wrong pts namespace when somebody tries to do odd things. Why would we care? It would be a _better_ guess. I don't see the security issue. If you do tricks to get pty's in another group, what's the problem? You have to do it consciously, and I don't see what the downside is. You get what you ask for, and I don't see a new attack surface. The whole "somebody used chmod on /dev/pts/" argument sounds bogus. That's an insane thing to do. If you want a private namespace, you make *all* of /dev private, you don't go "oh, I'll just make the pts subdirectory private". In other words, your whole scenario sounds totally made up to begin with. And even if it happens, I don't see what would be so disastrous about it. I mean, right now, /dev/ptmx is world read-write in the root container and everybody gets access to the same underlying set of ptys. And that's not some horrible security issue. It's how things are *supposed* to work. So I really don't see the argument. You guys are just making shit up. Linus