Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1688231rdb; Wed, 31 Jan 2024 06:22:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IFngQzzddW5t7FSes/XfZ9KAiuabUN7HqAKNeaFVnxclzHmm1L+BHrXhti6MU8+pGfMaxpm X-Received: by 2002:a50:d74a:0:b0:55f:2f83:77e7 with SMTP id i10-20020a50d74a000000b0055f2f8377e7mr1314323edj.19.1706710927429; Wed, 31 Jan 2024 06:22:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706710927; cv=pass; d=google.com; s=arc-20160816; b=gpjuEiIW7Ef/3MkzNnzUXPCSlpRDcwDmSvmUwRkI0XoUPOD8zNbz8UibD51i8eUjUr w4Qk89VaI62sPGsts05VBPlPmfw/waN6/61tkuRQ08WXWwQjUUeWi2wGncM36hMA9xRJ 4kxC6K56awvo5oGdagvZVvKNwMtb07b+W6GLhQUfii7v3bueKHsN3lM1xJ5tLTcVZ8SE EWS71t7zxpWgrc8IX7PozctIbr9Xyk93+OHIgjBHoxYRpgGBWiGSMaE6u2VUEIv8lo+C Zr9s+hiwcCt3+Kx2VEd3jGl/iruPCf102SdwS/6U/+9Q663kurXsEkaFJMMo8WaD3d4i tgtQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent: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=QmWgIn8/losqPNaZbqt7S0IwT1KTKOd2fh4BG0eCSsU=; fh=RTIutmBjTKr4uGVxIM0BpTrB7O8vGxTZylJpq0va58w=; b=wm1C5O7ZlwnhsDyfqDg9OTpCRbmT0h/z+xkGPD251ucl1+glH0vnkjVSK60Lx26fC8 4MMIOg8xJCiG0b8JTg/PUHz93FK04PVXPmn+t8QcDDjNkRyVqPPvX4uGRZtbvDD4HfTg RRE8UEH+qhO5USDm5bIgNDKUnkhowYVpOWSNpC2A7ScCsG4AA2AKh+H0jIPPcuvkfR1D nvH8aw38KSOXhLC7/fRjBP115Mw9yzcMf9TSbwnIE7yXj15suVVXEpCSXm/TpdQL+ZFV rd1mUKuV74NEs/SFFPTncWcFbcWWzwxJ9Ja4a0hLOwcz2mvBhQ0MPOcX6/cdqusnn7Q3 go7A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YIvBLXkS; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-46588-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46588-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=1; AJvYcCWS+LaNbN/tzaJR6XISURnPVvAx9pFZRl+zH3gos7iHj6o59kofrQ8GJnLGrhut5Tl6muggKeNc6Cjv6q02ZnaicdWuZFz8VvVv5RfPTA== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id p14-20020a056402500e00b0055872d17e56si5875982eda.42.2024.01.31.06.22.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 06:22:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46588-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YIvBLXkS; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-46588-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46588-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 4F69F1F274DD for ; Wed, 31 Jan 2024 14:21:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E47DA82869; Wed, 31 Jan 2024 14:21:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YIvBLXkS" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 AF66169DEB for ; Wed, 31 Jan 2024 14:21:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706710881; cv=none; b=cPDaiBiUfH937kYpqgsxDoJDdvTWMy9Hl+5C7xImwB973RP1oDN4fV+t92BlW2R1uARknFg5/7XpMb4UDYLY9/xOEphYX1EJ2oIyswzqIDbsCfwa2dHoVgG53irxXGo0OdbPgK2QKsa454PZdAB7IvF+qmxObmKE9o7fOZPPn9g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706710881; c=relaxed/simple; bh=fSiMmFA1Onj6bA6ApyGPOy0mxZtbDqOV4qzmHd/evew=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=B4WqDw22XFtUbzYXZU6TF53DMcBOYOTK3o6deXPUv407s9VY1RQlfKne5n6wgMEZnRUYtuqIoge7a4XMzLe4u/s4ELBwItWvRK6NY4y2nRCv3JcxSgiX4xKHM9W5wufkM1o1W4gV1BG4hxwBwX6ZJ+g/OlT3wdgNCGWvU+mI+gA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=YIvBLXkS; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706710878; 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=QmWgIn8/losqPNaZbqt7S0IwT1KTKOd2fh4BG0eCSsU=; b=YIvBLXkSniyNYOrXON6GXrhEe/HNlmad0Py8h/iD6S39JSnNnxRKvKNjrAozzMu40BNM2Z 13OfEoWCbcUCwqDo9aBwN9rf0RGYF8RYqkJfBkoZvbrRIrAekqwk44fDPYs2lhQPBCzR9e xzO2CX8S2Vd238+/hCRwT/T4Y+KwbpU= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-79-9qT7n0-xMQuk6NJR10R6Iw-1; Wed, 31 Jan 2024 09:21:15 -0500 X-MC-Unique: 9qT7n0-xMQuk6NJR10R6Iw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9737F2812FE1; Wed, 31 Jan 2024 14:21:14 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.225.249]) by smtp.corp.redhat.com (Postfix) with SMTP id 8F2DF3C2E; Wed, 31 Jan 2024 14:21:13 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 31 Jan 2024 15:20:00 +0100 (CET) Date: Wed, 31 Jan 2024 15:19:58 +0100 From: Oleg Nesterov To: Christian Brauner Cc: "Eric W. Biederman" , Tycho Andersen , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/1] pidfd: implement PIDFD_THREAD flag for pidfd_open() Message-ID: <20240131141957.GB2609@redhat.com> References: <20240131132541.GA23632@redhat.com> <20240131132602.GA23641@redhat.com> <20240131-raubbau-rentier-7ca9be9bc7c9@brauner> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240131-raubbau-rentier-7ca9be9bc7c9@brauner> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 On 01/31, Christian Brauner wrote: > > On Wed, Jan 31, 2024 at 02:26:02PM +0100, Oleg Nesterov wrote: > > With this flag: > > > > - pidfd_open() doesn't require that the target task must be > > a thread-group leader > > > > - pidfd_poll() succeeds when the task exits and becomes a > > zombie (iow, passes exit_notify()), even if it is a leader > > and thread-group is not empty. > > > > This means that the behaviour of pidfd_poll(PIDFD_THREAD, > > pid-of-group-leader) is not well defined if it races with > > exec() from its sub-thread; pidfd_poll() can succeed or not > > depending on whether pidfd_task_exited() is called before > > or after exchange_tids(). > > I think that we can live with that for now. If it doesn't hinder Tycho's > use-case it's fine. OK, good. > (I often wish that we could report custom data from poll similar to > kqueue on bsd then we could attach file specific information to the > notification. That would enable userspace to handle this the way they > want.) Or at least perhaps we can change do_notify_pidfd() to use the keyed wakeups... I'll try to take a look later. > > thread_group_exited() is no longer used, perhaps it can die. > > Feel free to add a patch for that on top of it. Yes, will do. Oleg.