Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2043125yba; Mon, 15 Apr 2019 03:53:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqz052ufmjHJ+SxtyrLacT1M6vvS03j79VeGkYcTVsDWfa47Fc/64nVSG3Vuvsut9AejE7do X-Received: by 2002:a63:5b0a:: with SMTP id p10mr69960693pgb.282.1555325589396; Mon, 15 Apr 2019 03:53:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555325589; cv=none; d=google.com; s=arc-20160816; b=FIiJbCkUSkyBicx9VITPeBb3J0yI1HDI7UKRccOrpJO+i+MEvcNOgk3dyIaonnxzbB rMLQi7fGdLjENoLv6Ijn1ydAucIXtRx7/EMuiov5I9t61C0ngwB1cWxWidIjWMhoLtkw w6wc/1h622DCgfTV+YztZGNWByKDauDLEfrn97oYAKBJEFA+hNxxnJXrqscLnHFtpoCl PtOn2nRQpCCmkou4YJzZjIPiWY0ixhvNqjWsSBAK8h9CG0TBTrwMzsVt3BDauax6C5Ws WDPw+fWZv+Nz1vuxvKxziLeNotVyqcEhKCrRn5+UUtgNmRoqtPQCxnbQS27ta5Ri3EhS KUbA== 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=+t/+BlcQOYQaDJbcLP7VxGbPJ9ZhNdl4gW8xL+RbBmE=; b=GoUwGwLwKX7zRWbjlFdCuWyW+yuWVLORL4wwlbbofrnp4rwy7mRsh5avEaLcpx/gwm UZqLQDrOQSqYOGW+cjTay7ZklzHRTfbEWViVdfKzg1tHXuje1TSkKCRz6Y82G2KDkl3O PyvXICflp2b2T8++KGpk0HbL3WX63lA59+PQtI2fycRrVAPDqvfX2M0JXLi3pqKGJWVe egGLtrWSD6Q4tnmqFSM7xUs/oCAs/M7h3l25Kvak8FuQmbAAaI23NfMy6EYhiiEwEqKL B/keHulWihvFNpjS21m7AGcd7GK68M2n4yoJeaxvGrQ6O9RdSAJaV7LyuCSR5HC4lEGN MeWQ== 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 g123si44504459pfc.58.2019.04.15.03.52.53; Mon, 15 Apr 2019 03:53:09 -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 S1727221AbfDOKwP (ORCPT + 99 others); Mon, 15 Apr 2019 06:52:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58360 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727050AbfDOKwO (ORCPT ); Mon, 15 Apr 2019 06:52:14 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 48E3481F18; Mon, 15 Apr 2019 10:52:14 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.38]) by smtp.corp.redhat.com (Postfix) with SMTP id 7BBC319C4F; Mon, 15 Apr 2019 10:52:10 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Mon, 15 Apr 2019 12:52:14 +0200 (CEST) Date: Mon, 15 Apr 2019 12:52:09 +0200 From: Oleg Nesterov To: Christian Brauner Cc: torvalds@linux-foundation.org, viro@zeniv.linux.org.uk, jannh@google.com, dhowells@redhat.com, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, serge@hallyn.com, luto@kernel.org, arnd@arndb.de, ebiederm@xmission.com, keescook@chromium.org, tglx@linutronix.de, mtk.manpages@gmail.com, akpm@linux-foundation.org, cyphar@cyphar.com, joel@joelfernandes.org, dancol@google.com Subject: Re: [PATCH 2/4] clone: add CLONE_PIDFD Message-ID: <20190415105209.GA22204@redhat.com> References: <20190414201436.19502-1-christian@brauner.io> <20190414201436.19502-3-christian@brauner.io> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190414201436.19502-3-christian@brauner.io> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 15 Apr 2019 10:52:14 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/14, Christian Brauner wrote: > > @@ -2260,6 +2363,10 @@ long _do_fork(unsigned long clone_flags, > } > > put_pid(pid); > + > + if (clone_flags & CLONE_PIDFD) > + nr = pidfd; > + Well, this doesn't look nice ... CLONE_PARENT_SETTID doesn't look very usefule, so what if we add if ((clone_flags & (CLONE_PIDFD|CLONE_PARENT_SETTID)) == (CLONE_PIDFD|CLONE_PARENT_SETTID)) return ERR_PTR(-EINVAL); at the start of copy_process() ? Then it can do if (clone_flags & CLONE_PIDFD) { retval = pidfd_create(pid, &pidfdf); if (retval < 0) goto bad_fork_free_pid; retval = put_user(retval, parent_tidptr) if (retval < 0) goto bad_fork_free_pid; } Oleg.