Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp585659pxk; Thu, 3 Sep 2020 07:37:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEsQJhVC38cMQ8FhJLk/kNZ1Kd4WXpZ9eUVAsCo2eKJigZOHVqlxsdbTjhkPZoXiYrAwNj X-Received: by 2002:a17:906:9941:: with SMTP id zm1mr2449086ejb.288.1599143839161; Thu, 03 Sep 2020 07:37:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599143839; cv=none; d=google.com; s=arc-20160816; b=0ZhUxy1zlhYn4UVaV+vBFLMi3c1WPB0tLiDqgOIxT9niblR27EUqn78DWHNAfxElRz oydBNc3cLzUa5fK3qSOVtBpu0A49PAZ42Xx1wKzTlZmYCloutnxU74VJYPjLGpSoCIOA ioEmTVId/0zn9foyvySvZJvNBvALiNYkECRvN+NTAmf/k8BiCPQ0K5G0zaoplMCAknFa nFD/TfLVsrIQ2YFWX8FNfVMsa60zGLBWc4kUyXq3cxykphqDrgBKzl2WrQ/KM5h+zscK FijVZcKo3UgbWb5sWZsgBnqmKyzftTc00SSqnB+9EnqumQ/IsNJmWRFaGrOv77IzrHp9 PO5w== 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:dkim-signature; bh=H7bJQ7h2myCkqnHq7O24s1ZUYNalRzEYrGJNorlqx6s=; b=Py1/C7AsIXBbrpDB7i5FlPaDTkD9z5FR52M6YtsVo50e21YdqhlfdB/bj4hl+biC7e 881ARORwJcir1oSq+94Dg0FzXRB2Hw/Kba6q3DiEyTvLs+hdcatNONZyp8aCRjKDAAua Tmb7+qfh6n7KXwHU9FvEzVdibRFhfsZJiZ3scqrL7PKnCpQArVsnarf8XQbOToTCf9zY j80gOBU0Czp+r7LZDk+2w9/dSFqReAd0GyZKAWL6+nleZJpx+ZzLbgBzxVXrkSAyE7Rs EG0WMzVtlHHPS2X+x4uLpcsNjw4Z3vbMf2nmNtWU+C/YiPpnHqyW83IPJZdzRFI/HexY G/Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AUQSdRQH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp1si2873312ejc.38.2020.09.03.07.36.54; Thu, 03 Sep 2020 07:37:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AUQSdRQH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729316AbgICOdy (ORCPT + 99 others); Thu, 3 Sep 2020 10:33:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:46567 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729337AbgICObg (ORCPT ); Thu, 3 Sep 2020 10:31:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599143495; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=H7bJQ7h2myCkqnHq7O24s1ZUYNalRzEYrGJNorlqx6s=; b=AUQSdRQH4PcxdN9PdwZG90owQKwPJdYPuqvLCDhROwZiIx7r8b+du7e3yYN/9U8SGiNvQB OpOVwCVZfMKTSZMKXALpY2EKYv7Hr/9KvhisrFBIiQPLypIJ5J3P3e+hDZYpJHYCOOoXhP qcjJGMQfimR7Xh8FWxk9FmEB5TvQ/V8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-41-nWV_P8BGM4aUcJJCqxZSZw-1; Thu, 03 Sep 2020 10:31:33 -0400 X-MC-Unique: nWV_P8BGM4aUcJJCqxZSZw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6248C425E8; Thu, 3 Sep 2020 14:31:31 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.40.192.114]) by smtp.corp.redhat.com (Postfix) with SMTP id 14BDB1055803; Thu, 3 Sep 2020 14:31:26 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Thu, 3 Sep 2020 16:31:31 +0200 (CEST) Date: Thu, 3 Sep 2020 16:31:25 +0200 From: Oleg Nesterov To: Christian Brauner Cc: linux-kernel@vger.kernel.org, Christian Brauner , "Peter Zijlstra (Intel)" , Ingo Molnar , Thomas Gleixner , "Eric W. Biederman" , Kees Cook , Sargun Dhillon , Aleksa Sarai , linux-kselftest@vger.kernel.org, Josh Triplett , Jens Axboe , linux-api@vger.kernel.org Subject: Re: [PATCH v2 1/4] pidfd: support PIDFD_NONBLOCK in pidfd_open() Message-ID: <20200903143124.GJ4386@redhat.com> References: <20200902102130.147672-1-christian.brauner@ubuntu.com> <20200902102130.147672-2-christian.brauner@ubuntu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200902102130.147672-2-christian.brauner@ubuntu.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/02, Christian Brauner wrote: > > -static int pidfd_create(struct pid *pid) > +static int pidfd_create(struct pid *pid, unsigned int flags) > { > int fd; > > fd = anon_inode_getfd("[pidfd]", &pidfd_fops, get_pid(pid), > - O_RDWR | O_CLOEXEC); > + flags | O_RDWR | O_CLOEXEC); > if (fd < 0) > put_pid(pid); > > @@ -565,7 +567,7 @@ SYSCALL_DEFINE2(pidfd_open, pid_t, pid, unsigned int, flags) > int fd; > struct pid *p; > > - if (flags) > + if (flags & ~PIDFD_NONBLOCK) > return -EINVAL; > > if (pid <= 0) > @@ -576,7 +578,7 @@ SYSCALL_DEFINE2(pidfd_open, pid_t, pid, unsigned int, flags) > return -ESRCH; > > if (pid_has_task(p, PIDTYPE_TGID)) > - fd = pidfd_create(p); > + fd = pidfd_create(p, flags); > else > fd = -EINVAL; > Reviewed-by: Oleg Nesterov