Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp5770391ybh; Wed, 7 Aug 2019 11:07:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJgl5UXQpV1oBVBQBAHYBw7ld8bD2Zp0LLpQV83Nud73e31BMUdvFsOmvvs4TfmJY30VRS X-Received: by 2002:a17:90a:2305:: with SMTP id f5mr1193955pje.128.1565201237080; Wed, 07 Aug 2019 11:07:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565201237; cv=none; d=google.com; s=arc-20160816; b=cbZakcVmphYTy2vASJgvqcfPRUEfTIREqqfYsS05cy+ThY9M1sukEH1UZTOUW8AVFY KAaPGolSgjqD/L7rvxP/F0doT+Vioqr3yg5JzCJ3VcpbPVxVw1mvBt2Cutc+jyAE6c8q USBuUCCULUl4xTOcvtlxggUZo1RVAqpAD7HKfHDm7DqtMzD3hDK2RIAzDlFrlt4A6SE+ 2U+H+TNFIYQmWDeygOD53WZsQ4jNXGDbYBlQLnnGI0WVfAl/Wm64oBLe3/1I5tt4vpv1 RrkvShDtBqaiFaJPEUd+nOiwwnrE9Gl1CuWUrnBNvR+MGasHTXvljClgIrx8c8VvRQwJ dHwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=hXSJn6uDmFlqsfyrszhHYe7KfnuhQHAYesfK5xVDA5Y=; b=Tpskgjq21VJziHKBa+9CV9mV9zgGXQW9zFx0Et83aVN7MzvdEakXcEMWvCj1SSmGzK W8KMHpJtnqDFwJy8431IPQkjmYxnOoB36BI73P/rTESMNsMFjVCRVP1YM7vAxiGbJY5K yeMnZUAN8kCVlFf7awxXBaVxdy5u1jUZL2KSlJ71ndFYzC+IuGcOLOtaDid4Glxkg1EP 8CyyO3//pLrnK4zuc+IQqpqz6OCn5DWKJUC/QU/wzJFFK/u1IYBcFIQAh6eGY3g+Zt/m IkW7lCfdFx6GXPK1UQAZk+P1PaFyF8xh8L4oRMic7Sqa1Al7ZTj1oYHXZCs0k8rdCynF 9tJg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b62si6149782pgc.148.2019.08.07.11.07.00; Wed, 07 Aug 2019 11:07:17 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389213AbfHGSFz (ORCPT + 99 others); Wed, 7 Aug 2019 14:05:55 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:58961 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388207AbfHGSFy (ORCPT ); Wed, 7 Aug 2019 14:05:54 -0400 Received: from c-67-180-61-213.hsd1.ca.comcast.net ([67.180.61.213] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1hvQJf-00089A-92; Wed, 07 Aug 2019 18:05:39 +0000 Date: Wed, 7 Aug 2019 20:05:35 +0200 From: Christian Brauner To: Oleg Nesterov Cc: Adrian Reber , Eric Biederman , Pavel Emelianov , Jann Horn , Dmitry Safonov <0x7f454c46@gmail.com>, linux-kernel@vger.kernel.org, Andrei Vagin , Mike Rapoport , Radostin Stoyanov Subject: Re: [PATCH v3 1/2] fork: extend clone3() to support CLONE_SET_TID Message-ID: <20190807180534.rhojrgy4j52n2eup@wittgenstein> References: <20190806191551.22192-1-areber@redhat.com> <20190807160856.GE24112@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190807160856.GE24112@redhat.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 07, 2019 at 06:08:56PM +0200, Oleg Nesterov wrote: > On 08/06, Adrian Reber wrote: > > > > @@ -2573,6 +2575,14 @@ noinline static int copy_clone_args_from_user(struct kernel_clone_args *kargs, > > .tls = args.tls, > > }; > > > > + if (size == sizeof(struct clone_args)) { > > + /* Only check permissions if set_tid is actually set. */ > > + if (args.set_tid && > > + !ns_capable(pid_ns->user_ns, CAP_SYS_ADMIN)) > > and I just noticed this uses pid_ns = task_active_pid_ns() ... > > is it correct? > > I feel I am totally confused, but should we use the same > p->nsproxy->pid_ns_for_children passed to alloc_pid? We need to have CAP_SYS_ADMIN in the owning user namespace of the target pidns for the pidns in which we spawn the new process. The value for pid_ns_for_children could've been altered by either passing CLONE_NEWPID or by having called unshare(CLONE_NEWPID) before. So yes, pid_ns_for_children is what we want. Sorry again for the delay in my responses. On vacation atm. Christian