Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp509934rdb; Fri, 26 Jan 2024 02:24:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IGBhfsKhFapFpbFZ3l6FjJNwTCgSueXZ3St0emYW+55MtY2Pj3K36jCM1wFUydztLKVqPBk X-Received: by 2002:a0c:e24e:0:b0:681:931d:20c0 with SMTP id x14-20020a0ce24e000000b00681931d20c0mr953511qvl.24.1706264683402; Fri, 26 Jan 2024 02:24:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706264683; cv=pass; d=google.com; s=arc-20160816; b=EJq5eXbDLsydG9WaeKeZUeTtF5L4PlOKI9mt/PACo9IOTU0fiIjDJCCWMk6H7g5KMn SJYrccgvF+H3mmKBo6GR2EWtFXoiXeAff7JKHdDGVk4iHlQT03Tszdqr5Jb0q6SUluH9 2szKP0fnf9VIzgbKiWobbleasFovxVRm6pP7CdJGWHx8LR3pehQPap4VAZ9mvSgKXo7w zNoPywSC+Ldvvo9t59AlLkhvZSq6x03pp6TOSuLYSGYLcNsGjVwSfO9Ujv5PL/KB9KA1 UkWY22HaXUm47cnNwMLVoaVwjEXEErWc4L4lmUfBMb78Xp0maw02YY93ESc+9GOSMJtY iICw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=aj/hM3vsrJ5Tck4EnHAvSY4atntHC5v4CV5/44VlEcE=; fh=5lTTCeCqx4/XokEtSiEFYpRspw0/kdZZ1eSEE5qtKY0=; b=QnRms+SaaAE4HapY6wyMIDYVc2BZRsNIDiCAX8eH1DzIYwlnyvZ/Xmm5hDp3HrUrcU fF1Xu8tLpuuHmemkN2d/ZI2H8mVLIDLG7SlLPK3Aj/jJFbpth6pJ2T43I/2Qo7o1dUd1 4dwX1mzk0X5sHlwtighFieRVl7QQcADx+Om3muBXFZsPgtsp/jgGzDbOlFQpDOjrCWL8 3GgL+X1Y1X7RXv6bqJNb50xOdO8ZjUOKiTwaNVjPKKdEo+gTlvu10oHNsTGs0faP2C+7 k7V3+pY/haXUBdcTKMUaFjxIUZ6QKXDh0WW7FxSOZICKtcH4IkOdIOMUUB3h/31IieoW B8sQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=as61CN+K; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-39955-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39955-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id s11-20020a05620a0bcb00b0078333a213cdsi1063198qki.368.2024.01.26.02.24.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 02:24:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-39955-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=as61CN+K; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-39955-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39955-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 04F091C2FAFA for ; Fri, 26 Jan 2024 10:19:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 056314438A; Fri, 26 Jan 2024 09:49:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="as61CN+K" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 25E654437B; Fri, 26 Jan 2024 09:49:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706262548; cv=none; b=aFGzwL6vP7Giz/kkaA7YFSIrnomx3b9n9h7JkwpFezhY0mXsW23oT4RW5g5qu4YugfX40kze08kmCYxZGYu8rUsNDajy8lmqqhfHZnvyxrSwXfp+ahV35DFGPJyTxPnGfAzE+d1o0YT/t6OjsKKjUDTcxU0007g5/H/aU4lrE24= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706262548; c=relaxed/simple; bh=IcUa1qktRqvNoH2A8HXCfCg+Bdxwvo8ugy/XN/Mhhpw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HuqO25UwqwOsmBJDQfsByk7ZpYauMkdUe6e/1FHzFtxvsInvYq63F1IGgO2OIHHiLRYMUVU6bG3a93iDsvdNK4cB3I835QSaRs1JUhUebHjeSeEhKVc1wg7mUF4PxLRJaOAnhTCWIXZ9a10t44FLt1+HmXwkROQjhTbg+zt/HUo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=as61CN+K; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E03CC433F1; Fri, 26 Jan 2024 09:49:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706262547; bh=IcUa1qktRqvNoH2A8HXCfCg+Bdxwvo8ugy/XN/Mhhpw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=as61CN+K+kYtPU9tAM0FhvKfsWpyarSk0YjOUKVn+FJBPU6VAW6z2lxjHdEj6hIUL 3bD8O++Ri18a7ssmrZtj3zH0qnZiuxAu+Dib+l7JRLpdXy0q7Pe1eqLBgj0cEHw9sP SY2Kkz61keoyH2WGAHN9BhnTzszijxMGxYezNiznBeNcirw00JjJcdKU03uT+8aaFd 7B2YJbAv+YEh8Rc0kNQIremkWYcI71cyHxWenuPoXCjfef6Ah0uw7wmRVzUjrB3ZhP epCKhyDUJqNAuFtBY+FY2/9eq0Cy2tYIbSIHW5gz9PJ7OYNYHF1fqSHrxjpyc1RqTT sBKhu5cB+3egA== Date: Fri, 26 Jan 2024 10:49:02 +0100 From: Christian Brauner To: Tycho Andersen Cc: Oleg Nesterov , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Tycho Andersen , "Eric W. Biederman" Subject: Re: [PATCH v3 1/3] pidfd: allow pidfd_open() on non-thread-group leaders Message-ID: <20240126-indiz-radrennen-8554de0bc074@brauner> References: <20240123153452.170866-2-tycho@tycho.pizza> <20240123195608.GB9978@redhat.com> <20240125140830.GA5513@redhat.com> <20240125-tricksen-baugrube-3f78c487a23a@brauner> <20240125175113.GC5513@redhat.com> <20240125182505.GD5513@redhat.com> <20240125183045.GE5513@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Thu, Jan 25, 2024 at 11:36:50AM -0700, Tycho Andersen wrote: > On Thu, Jan 25, 2024 at 07:30:46PM +0100, Oleg Nesterov wrote: > > On 01/25, Oleg Nesterov wrote: > > > > > > On 01/25, Tycho Andersen wrote: > > > > > > > > One of the things I don't like about PIDFD_THREAD is that it's hard to > > > > tell whether an arbitrary thread is a leader or not. Right now we do > > > > it by parsing /proc/pid/status, which shows all the stuff from > > > > do_task_stat() that we don't care about but which is quite expensive > > > > to compute. (Maybe there's a better way?) > > > > > > > > With PIDFD_THREAD we could could do it twice, once with the flag, get > > > > EINVAL, and then do it again. But ideally we wouldn't have to. > > > > > > Too late for me, most probably I misunderstood. > > > > > > If you want the PIDFD_THREAD behaviour, you can always use this flag > > > without any check... > > Sorry, I hadn't read the patch. If it's ok to use PIDFD_THREAD on a > leader, then we can just always specify it. (We don't care about the > behavior of pidfd_poll().) > > > > Could you spell? > > > > Just in case, we can even add PIDFD_AUTO (modulo naming) which acts as > > PIDFD_THREAD if the target task is not a leader or 0 (current behaviour) > > otherwise. Trivial. > > Yep, or given the above, maybe it'll work as-is, thank you. Yes, let's rather do the explicit PIDFD_THREAD.