Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754219AbbL0CDW (ORCPT ); Sat, 26 Dec 2015 21:03:22 -0500 Received: from mail-oi0-f50.google.com ([209.85.218.50]:35549 "EHLO mail-oi0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751372AbbL0CDU (ORCPT ); Sat, 26 Dec 2015 21:03:20 -0500 MIME-Version: 1.0 In-Reply-To: <20151226215101.GB21578@mail.hallyn.com> References: <20151226011038.GA25455@pc.thejh.net> <1451098351-8917-1-git-send-email-jann@thejh.net> <20151226215101.GB21578@mail.hallyn.com> From: Andy Lutomirski Date: Sat, 26 Dec 2015 18:03:00 -0800 Message-ID: Subject: Re: [PATCH] ptrace: being capable wrt a process requires mapped uids/gids To: "Serge E. Hallyn" Cc: Jann Horn , Roland McGrath , Oleg Nesterov , "linux-kernel@vger.kernel.org" , "security@kernel.org" , Serge Hallyn , "Eric W. Biederman" 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: 1799 Lines: 44 On Sat, Dec 26, 2015 at 1:51 PM, Serge E. Hallyn wrote: > On Sat, Dec 26, 2015 at 03:52:31AM +0100, Jann Horn wrote: >> ptrace_has_cap() checks whether the current process should be >> treated as having a certain capability for ptrace checks >> against another process. Until now, this was equivalent to >> has_ns_capability(current, target_ns, CAP_SYS_PTRACE). >> >> However, if a root-owned process wants to enter a user >> namespace for some reason without knowing who owns it and >> therefore can't change to the namespace owner's uid and gid >> before entering, as soon as it has entered the namespace, >> the namespace owner can attach to it via ptrace and thereby >> gain access to its uid and gid. >> >> While it is possible for the entering process to switch to >> the uid of a claimed namespace owner before entering, >> causing the attempt to enter to fail if the claimed uid is >> wrong, this doesn't solve the problem of determining an >> appropriate gid. >> >> With this change, the entering process can first enter the >> namespace and then safely inspect the namespace's >> properties, e.g. through /proc/self/{uid_map,gid_map}, >> assuming that the namespace owner doesn't have access to >> uid 0. >> >> Changed in v2: The caller needs to be capable in the >> namespace into which tcred's uids/gids can be mapped. >> >> Signed-off-by: Jann Horn > > Acked-by: Serge Hallyn Acked-by: Andy Lutomirski Who's going to apply this? Linus? Eric? --Andy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/