Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3279568imu; Mon, 19 Nov 2018 13:27:39 -0800 (PST) X-Google-Smtp-Source: AJdET5e3YBIZnStqLvZFydVH5ilxYPFdrvVAgw2H1TgCj9oCLZWesm7rnsafCy8GfCNjpxSqnTi3 X-Received: by 2002:a17:902:1122:: with SMTP id d31-v6mr24272133pla.259.1542662859155; Mon, 19 Nov 2018 13:27:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542662859; cv=none; d=google.com; s=arc-20160816; b=vb59WpmB2BtqGbI5qmz2yJDMk6tJxQXteBXvHnl5MOl+uzXFQhewFsBhR2xE9+sX7i U/rz0fJc6vs4al7BsrWVnHkuv0nRpvW7cjtq4pRcHh1W0PHxNKWJBvetnjVCkp/mtNbU sE8p89cYvXRMO8St1sV7fSERZzMPwyaCVZ5mzE2yKQKMuS0CY5BtuiH7GHzfp8Nzp7xY 3azUFOawSMOoAY2SANsIohzuB34ZNrabwHccD7wQuX+U4I5YDTY2mWqu+oUPpaTP54d9 eBMtF8flY18JwtMKajR5S1v4WXhFRj381XZrshoxpPGqPspWXelSbm7m+c3m9fYFoSLu XyWA== 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 :references:in-reply-to:mime-version:dkim-signature; bh=nh96bPDfpXkw0uHoBWBhs9Qg+Ot//y/rzYSMJIiajqc=; b=VvpqCL5cngrZi/loXW1eT2TWnr5mEGvoshKlJddXjTQ/I1MypzDfsXYmvQ+voTws8Y BnLFDuwJrESTO2hO5jbVNlDFnhQVpg1Xd5Ktmqdk7wiP4rf7xNoyMFnksL+MvHRLpL+4 W70o14XIQvIaytxMdCDVfTxS8SfYQWy/JZUW+w1CO+5z2qY5v9yvsvLBQ8AtQx/i3C17 YhXrWmRF3JHlDHlmjbOa3amudewuLaG1LJ+o2JRfSyXydAZ8nspF/1IyBUnMVc9Art/G UvkPUdtUn1SjOazMEJvbvD4xkTiOCVQvxjQINZz9zyUq2nzWLK85zrOqtUf7mvnxdxeZ sHlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=QkQe36jb; 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 v17si29914301pga.566.2018.11.19.13.27.24; Mon, 19 Nov 2018 13:27:39 -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=QkQe36jb; 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 S1731134AbeKTHv5 (ORCPT + 99 others); Tue, 20 Nov 2018 02:51:57 -0500 Received: from mail-ua1-f65.google.com ([209.85.222.65]:43770 "EHLO mail-ua1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731112AbeKTHv5 (ORCPT ); Tue, 20 Nov 2018 02:51:57 -0500 Received: by mail-ua1-f65.google.com with SMTP id z11so11219153uaa.10 for ; Mon, 19 Nov 2018 13:26:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=nh96bPDfpXkw0uHoBWBhs9Qg+Ot//y/rzYSMJIiajqc=; b=QkQe36jbOGRTNr+ZMpFgFS4l98JAe/I1QvpnXl/yl1lITjGOOsZK2TG+rENMIIynvw HpWL8e66E2Bc3T2Efp2v77bYp+0RNblx3Qp7jqj/m3wSTsG0ToADG5Q7ceLas3L1u5XN Q2qVevclHiKtcEytqZlER0YqvSSIbIXK0UVT5stEqJguUPHPYE1ZccqwaRQRTSfvFCLa x6CdZIkvTToIpM1dN4zY/uzSxC+HeYkCU9AXms8EDzjUTC5ad8uS1JftIfH+fgxJLWDu HMhNwZZqKqNeOXOim3CZ3bviOewLIH/7p6O1QcpZbcA17EE9BHH5fKjZAL33G/H3G2+2 uDcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=nh96bPDfpXkw0uHoBWBhs9Qg+Ot//y/rzYSMJIiajqc=; b=qTActr0ouC249+0ynFPufibagAflU3jvVSkdMnbg6xLCKDov91O+QcoYklyj0OyZUf 8IQNYT6QmI7TcEd2sSLKc0+Q4y4e/p1yHxZFYtDksyl06ZNtnUvHt/lPUkTdzwTb/fy0 7gjeC6Ahm+/d09Exont9kwAaJ6sUvefjnQZx632RzNWnUH9SO0J8W3A2/zwDuBMq6kac /6LCi71/0EAnLPKzNjJ+MPMBickyh3tZTdWC68J7cGQlcK/gyGCPTiywkGRfbapm5a+W cUA7ZhbmrFpybmGKugPQvnxsJVXdogqXVOFQkrL+gT1iAFlHOfDX7MFeQ+bm9qW0+MhK /HyQ== X-Gm-Message-State: AGRZ1gIpEpGsHbvt2xo/lhrxpJApLBeaUMth/wORDNazJ1osVbB/eVPW +YC/sBcPr34/ydHvwp+sSSY59Y32z3Hn+5tvarWj5g== X-Received: by 2002:ab0:72a:: with SMTP id h39mr10825396uah.11.1542662783827; Mon, 19 Nov 2018 13:26:23 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a67:f48d:0:0:0:0:0 with HTTP; Mon, 19 Nov 2018 13:26:22 -0800 (PST) In-Reply-To: <20181119212126.u2nkijmula6wcfqi@brauner.io> 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> From: Daniel Colascione Date: Mon, 19 Nov 2018 13:26:22 -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: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 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.