Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp5687503ybh; Wed, 7 Aug 2019 09:45:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqy1cz0J0UQDL4Ww58yCu+wW1G/D/bixAOkOwZX/Q91XVxfTe5D1QWXQxUI6AMrRJPpDBNGx X-Received: by 2002:a17:902:925:: with SMTP id 34mr8999607plm.334.1565196324605; Wed, 07 Aug 2019 09:45:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565196324; cv=none; d=google.com; s=arc-20160816; b=IJdBR85kVpwrxDbtm30wEpqk11lLFEptZphvUte3wgpa0bwT6JSkKd13NGkJ3ei2ZS Nw60e2dh6laF6rGKQV5drsB2QovL5UPDCxH3PFha7h7dujBQulKXjNcZN5mZs3gh5ZyV 9Ty6GWQ/rY4lmNZoDFQOnI7XaaMc1I1+OIEyS3/FkJ2Iqb84TDUcuhJB0sxUsYec2Haj f7EFYtsL85hZfmMuVZLrWbasMuuUAMo5WIa+27f+vBBwgwYAC/Y8ZWKcaI+S/iX8NBxh AFr23K0YudNXOCDEySeP9yzC9NpQxLUNKZ02GM4kW5nYEyFkFxF6QNIc/hzkUMcP5Du2 yxjg== 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=9RJsXbhbYVG68H00jCEw48t3acicRBSCMSJi2tO36YA=; b=RLxRG9T2Axk2mMxZ7wCmfH4m7T3ljxSWFq/rqptP75SjIQl8JI9ApknSPEt9KH99bN Q3XKYFRmQnmsOopGFhIyKn8pvOEuobaGrAfWoLdbK+QoaEPBSVpWGDaGkt5w+sBm1Z0b Ir4ixfKl/gsPYwfarEBQ+o1bD40mStxMmXepufHVjRUhViO3bPt9nXO7R7+IHXyuwLcc tgufiBUYxolnz8XcaMRLEhoIE6DwGQxVudeXZYFDgznjjp3QpWt99yXSbKNiG/m5nycq SHGaw11omo2dpHz3svUMTkmX7yZbbPWW+0meMyTPcjDUCGJZj9ymZGs9ZBr5zJIC+/Uy jAiA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o11si323389pjb.30.2019.08.07.09.45.08; Wed, 07 Aug 2019 09:45:24 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388939AbfHGQI7 (ORCPT + 99 others); Wed, 7 Aug 2019 12:08:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44592 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727213AbfHGQI7 (ORCPT ); Wed, 7 Aug 2019 12:08:59 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 57155315C011; Wed, 7 Aug 2019 16:08:59 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.136]) by smtp.corp.redhat.com (Postfix) with SMTP id 6D7175C21A; Wed, 7 Aug 2019 16:08:57 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 7 Aug 2019 18:08:59 +0200 (CEST) Date: Wed, 7 Aug 2019 18:08:56 +0200 From: Oleg Nesterov To: Adrian Reber Cc: Christian Brauner , 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: <20190807160856.GE24112@redhat.com> References: <20190806191551.22192-1-areber@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190806191551.22192-1-areber@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 07 Aug 2019 16:08:59 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? Oleg.