Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3295798imu; Mon, 19 Nov 2018 13:43:51 -0800 (PST) X-Google-Smtp-Source: AJdET5dQo5qU45u4WR9+Kgy7Mg78bdXreME3Ed3feGUtMe5L3Ik384JPYsf4twq+JNXTLiwC4KUG X-Received: by 2002:a63:1848:: with SMTP id 8mr21414432pgy.81.1542663831255; Mon, 19 Nov 2018 13:43:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542663831; cv=none; d=google.com; s=arc-20160816; b=QqQiCrnNE5u3sI9vCrEK48Lmk2AiZHxp/1WLJcQ8BC++WPDL1mYlk0+3fdOFA/Kr4i z0oKg5RdW+bNWYzPwB31GOVaG8p4QQdVG+TRbnU8bcxNHlwEkkjgOhI/SR4NL6yYJpQK 5VScYoRWpcNIsycuoKDvXDQ455gYYopavCKV53x8VcooPQQWfJQff1sCYigpDXCOcD+5 rt8pm4hKWN6Bcseem4gNqrc7arQXcpTQdZ2SnRxaB9iYfQxt6TX4xa+zat8Kny1fa0b2 9yn1xcmoFnQ8Rxt5SZj6PlcMJKHBPSFZSxfMbBcnCcdggY1wmOQQ/FpD0uATA0NjwfMM reaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=GU3TnvgcFfbK+HKMP9elr0xQDZ3OfrM2HTww2/am9rc=; b=Shlb3BVnzvWU28MWJ3LY/Y17ElA+jmIK0cvzBzVceOed1rn966R+1XFNshSga+pkZL qWODkPDv/QFBaF/r6ooYdk9Dsz34eY8H5zofdskFa7ycXNnj0VUSijbckEO9wsXlW17d csIsKhXaT2pfcjfa06xWitPkTYbH0p/LlD9/x9byNgUssjwhML0uoL1uYZv5PTUkUUMC 21Cyj/7tOOxvaIhqmSeR3x9tshomdv67vZfYqW6t6o6niaJBDnbjkyNb+vN/m7nE6EYT u8WMLufDR5n8OWDE6x0REIEtUHJkLBB/tAn/dukAnAjw8Hx6KzaIPKnrHCNZpO5omcmL V8/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=bfsZvvLn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o3si39229232pgm.441.2018.11.19.13.43.36; Mon, 19 Nov 2018 13:43:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=bfsZvvLn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731272AbeKTIHM (ORCPT + 99 others); Tue, 20 Nov 2018 03:07:12 -0500 Received: from mail-vs1-f68.google.com ([209.85.217.68]:46820 "EHLO mail-vs1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731258AbeKTIHL (ORCPT ); Tue, 20 Nov 2018 03:07:11 -0500 Received: by mail-vs1-f68.google.com with SMTP id r14so18675498vsc.13 for ; Mon, 19 Nov 2018 13:41:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GU3TnvgcFfbK+HKMP9elr0xQDZ3OfrM2HTww2/am9rc=; b=bfsZvvLnHLB9a/UrM7/uN7JgQQtTF61We8C39OTZcoZAcIaKn5hsmtj4BZLCP2U6o/ QT3T2vV5ohtX9uLul5dv1OuMy3+gE5JZaE9RIXXJBMy5y77IrTsba0Fl4u2bT4PtqUs2 g+L+btPKhftoHl/GUZHzSBHmPJqXKEcjZXkcAWkXXo0OkIV2p9vVAr95jn1KgclGeEqp Tz18uDjZuMfq5m3XGj3o7ocFagAg/qMjgGY+eID2xw81tDr4wkFiEzkGMo52ZR95D6eW fyyJ7UsqAgtHiQf88zXEmSuWqvKuGZCDuU932P8JBH78sVle4/m2QGy57csHPUUJVUSC CBwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GU3TnvgcFfbK+HKMP9elr0xQDZ3OfrM2HTww2/am9rc=; b=gNfUbkfVJvMdmqk0pSxAkcUU/y/VBPvWDtKM2cCsapP4L/4o65KkoWnXeeY1cryUAt 2uDp1tuh95/Y5r5QuRo8pAiuuFypzIMHLPDqc9pg6Ys/tK6CqP4bT4EGU0PSoWavSDaH uqckFL0Nn3POvv5A990WdW4k2h9vULcRv+7C3szuLZ/t6IgQSN+2p/1lKB9fA5XrIP6P 8NS5VVGIPwoDCPfJ//ekGrlOaknHpsfS/3fJZD07sXo85ItKGHLReFYIJdnwD7ImYDf/ Xb67Jk3WopeItmngQoP394tOV+i96xgPRDhC5Mk//KExi28xm3Q7NM+9DEsG+TPHniFr oZgQ== X-Gm-Message-State: AGRZ1gKFrbeTdsoeyAj9oZYAIYl3QBlm/ewLqE1seqsVl+0Ndqx5zSN+ 0CDqXCy/Tx4DhUvLgVK8zSpp43Ec9F+gwz+wKNTvhA== X-Received: by 2002:a67:6346:: with SMTP id x67mr9699500vsb.114.1542663693374; Mon, 19 Nov 2018 13:41:33 -0800 (PST) MIME-Version: 1.0 References: <20181119103241.5229-1-christian@brauner.io> <20181119103241.5229-3-christian@brauner.io> <20181119202857.k5zw742xjfrw677j@yavin> <20181119205518.btew3vxwgva4w3zh@brauner.io> <20181119211810.73ptfhnwdmkngfi4@yavin> <20181119212126.u2nkijmula6wcfqi@brauner.io> <20181119213722.z54huio5g4kuldxk@brauner.io> In-Reply-To: <20181119213722.z54huio5g4kuldxk@brauner.io> From: Daniel Colascione Date: Mon, 19 Nov 2018 13:41:21 -0800 Message-ID: Subject: Re: [PATCH v1 2/2] signal: add procfd_signal() syscall To: Christian Brauner Cc: Aleksa Sarai , "Eric W. Biederman" , linux-kernel , "Serge E. Hallyn" , Jann Horn , Andy Lutomirski , Andrew Morton , Oleg Nesterov , Al Viro , Linux FS Devel , Linux API , Tim Murray , linux-man , Kees Cook Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 19, 2018 at 1:37 PM Christian Brauner wrote: > > On Mon, Nov 19, 2018 at 01:26:22PM -0800, Daniel Colascione wrote: > > On Mon, Nov 19, 2018 at 1:21 PM, Christian Brauner wrote: > > > That can be done without a loop by comparing the level counter for the > > > two pid namespaces. > > > > > >> > > >> And you can rewrite pidns_get_parent to use it. So you would instead be > > >> doing: > > >> > > >> if (pidns_is_descendant(proc_pid_ns, task_active_pid_ns(current))) > > >> return -EPERM; > > >> > > >> (Or you can just copy the 5-line loop into procfd_signal -- though I > > >> imagine we'll need this for all of the procfd_* APIs.) > > > > Why is any of this even necessary? Why does the child namespace we're > > considering even have a file descriptor to its ancestor's procfs? If > > Because you can send file descriptors between processes and container > runtimes tend to do that. Right. But why *would* a container runtime send one of these procfs FDs to a container? > > it has one of these FDs, it can already *read* all sorts of > > information it really shouldn't be able to acquire, so the additional > > ability to send a signal (subject to the usual permission checks) > > feels like sticking a finger in a dike that's already well-perforated. > > IMHO, we shouldn't bother with this check. The patch would be simpler > > without it. > > We will definitely not allow signaling processes in an ancestor pid > namespace! That is a security issue! I can imagine container runtimes > killing their monitoring process etc. pp. Not happening, unless someone > with deep expertise in signals can convince me otherwise. If parent namespace procfs FDs or mounts really can leak into child namespaces as easily as Aleksa says, then I don't mind adding the check. I was under the impression that if you find yourself in this situation, you already have a big problem.