Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1401412rdb; Tue, 30 Jan 2024 18:37:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IGC0uzmS5rpeqAyqAMj/z8CtYwndunzVIafuu8kjrXM3nlyfENLKYBPdI0N3lb5UZBwXDhU X-Received: by 2002:a17:903:445:b0:1d8:e7cd:c2cb with SMTP id iw5-20020a170903044500b001d8e7cdc2cbmr464416plb.7.1706668673407; Tue, 30 Jan 2024 18:37:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706668673; cv=pass; d=google.com; s=arc-20160816; b=WdwLXH5p19/iIQMNmcafHIUllClnjx9DP+P4Yi0mXKW2AR288tYj2j8IgcQ5dnh5ac yPAz5HZUJspjX5mdEWzhIlVgYOudsJYVQ0ZksQu54cAuj4ZKdHotW2Y5x6k7b8mK7Ojh 1gBpprdBmitaHr80PchhlycGhZgZxuVdzucjMuldOHjIThyAuEnJIFOT2GwC19PbAWrL wr89esuC1cNuEPRFoaIhZ7fSvKrUqnjUbf2IL54ro4E82UCWccUBe67Von/jVVi/01DU DVX4CNVw+etgguhES+O5y2mbnMTzZ0VQ+lf2m7Bidwa0tOub8jpql+74HNimsHpdRrn0 6OYQ== 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:feedback-id:dkim-signature:dkim-signature; bh=81kLSaihQotDKU9jTT77jkJOpqh/hq1cds+S6k0OFNQ=; fh=m38KrxSaWgvaAXkgZJoyjz7AgN3re21oVRODc65uN7A=; b=d+iDfHeFKEHj9t0JqgXHgPlnZlC7o99XC4Uh+Bqjzkov0jV0nw3nPM7p8Nb4rHesqF qDfnOc/ZcDsqR5C8d2DWpoU11kkw1xIqK7GPEXLNqiTGYGD90JIlpQcBQmlBlD5oy+No luSvGQlMbQ4Lxhh2hmyAsDz0ECYQcrex05cELBbz/OPM90f1Chetn6rGFhbMSwkfcsSm DE/UEeTwLkiDXQo0oWUESzScq/NrDY3CvhUiCQRBItegS21NQXkZysfvbspMVo0Ax26D 9JB2cjLHSXSLm91rYfMjR7IRpZ3bwv2hWtXv6mru15s9g8frXOaW/jj2Ep1ktIzX14aM VqbQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tycho.pizza header.s=fm2 header.b=KmrtVPFu; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=qEo06QOB; arc=pass (i=1 spf=pass spfdomain=tycho.pizza dkim=pass dkdomain=tycho.pizza dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-45675-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45675-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCUxbPUhPf9rGezCqAyOW0Is5fi/hL+OQMr9GpFMoeOwL9Vz8oDNJ6zPnh8H8kv1/DN/MOWJQtTAOiUSysyo0wWTANSl5mtX+DZpzf0R5w== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a11-20020a170902900b00b001d3ef57d914si8594996plp.95.2024.01.30.18.37.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 18:37:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45675-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@tycho.pizza header.s=fm2 header.b=KmrtVPFu; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=qEo06QOB; arc=pass (i=1 spf=pass spfdomain=tycho.pizza dkim=pass dkdomain=tycho.pizza dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-45675-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45675-linux.lists.archive=gmail.com@vger.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D99F828B644 for ; Wed, 31 Jan 2024 02:28:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 12D6D6AD9; Wed, 31 Jan 2024 02:27:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tycho.pizza header.i=@tycho.pizza header.b="KmrtVPFu"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="qEo06QOB" Received: from fhigh6-smtp.messagingengine.com (fhigh6-smtp.messagingengine.com [103.168.172.157]) (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 D41545667 for ; Wed, 31 Jan 2024 02:27:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.157 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706668076; cv=none; b=SWFTjB0crgMtqYuzBeQA6fDJwJADIaPuhIZSF4ZEDstaRVVE2nCsaKZHLKrSC4McIZOOP03O07ATJ95YRb93x8Qy5zUG0Y57cfUlL0N2/8vCBCdD/9X2TT0KwYxmbdwTeWqouapWRSEN0LKoKYlzQH5YOV2DefCDUk18EhUVNwA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706668076; c=relaxed/simple; bh=rqfGQ33rW27oNnjc+6yHT9BLkWlpUqBhPyW9ihVyVxo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dsiTS75UY7SJ4mrqh4ID7EHDWfhwvbHNcQUfyT3NISDgSNzjgc6WAeVHE828bQYAZc6lZpEX4kKy2N5DzW4zw5cmVhF3RRYzj7gNUI3A5KMKrxJ7K5h4Km97touc5oIadFWOarN3GN/gjDY7m2kubUgLf0gTUjYVIOcQ8hYdXoE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tycho.pizza; spf=pass smtp.mailfrom=tycho.pizza; dkim=pass (2048-bit key) header.d=tycho.pizza header.i=@tycho.pizza header.b=KmrtVPFu; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=qEo06QOB; arc=none smtp.client-ip=103.168.172.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tycho.pizza Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tycho.pizza Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.nyi.internal (Postfix) with ESMTP id B791F1140081; Tue, 30 Jan 2024 21:27:53 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 30 Jan 2024 21:27:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tycho.pizza; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1706668073; x=1706754473; bh=81kLSaihQo tDKU9jTT77jkJOpqh/hq1cds+S6k0OFNQ=; b=KmrtVPFuwVEqAqfu3rXHveGwlY ZacOwX1OcM6Lw3aVjasasUEWkg5TNmTtUyKFDza4OFWEpNnDvhcJhrrziYoJUwas nsSP1sbnWnTURAScWutMo31wZag92CqDEzK7uv1OTOoLdpti+3IaCXX4kPite2iZ ViURvNYcrdx39TExAooxnpL+tIHtjvhFKLVsXYb/6ooJOswwW03XNzFb3dg2n7ne gWyH0UZ2elzc7Cpj5CExe/C1lKXxgqxd5WzDrwxK3bxqFYHeKEM4BnoCiyd3IM6W uJcCBsakxAiOcsZRhvbvolHaup0IDQ3JuYDWP3873pRpdzJfQTSkS4KpmUcg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1706668073; x=1706754473; bh=81kLSaihQotDKU9jTT77jkJOpqh/ hq1cds+S6k0OFNQ=; b=qEo06QOBd6c1YsTJXtVNPYdwNj+d8avFV8Bgmx5OTgfM v6gF/Gb2F32HdkXfLUmRK/qGbMdJyLfKxx/v/Sr5UUchD9lOfY5t5+7hDL1z+FiG UkxZI+PMSTeX8Q0z3IAWgzd7DGheFNwss4Yfmm6Jrne3z8ue5KeRjP+Cl/K641HH MYwJf83rrjpkt76qbtSLGtYqx+GFEKXRvpCX0Qf3V/UehSXXvaV1atykSqGoHNG/ SpP+Xd03x8+eCBbF00rqB3VO0xLEtHNJmwdS6ziZdInKYjkoTeRlLOX994ZqCU9A Kj3w5tYj1EYHliiIgR3rzK7+lVV3+kMfzJOKs24ueA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrfedtkedggeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepvfihtghh ohcutehnuggvrhhsvghnuceothihtghhohesthihtghhohdrphhiiiiirgeqnecuggftrf grthhtvghrnhepueettdetgfejfeffheffffekjeeuveeifeduleegjedutdefffetkeel hfelleetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epthihtghhohesthihtghhohdrphhiiiiirg X-ME-Proxy: Feedback-ID: i21f147d5:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 30 Jan 2024 21:27:52 -0500 (EST) Date: Tue, 30 Jan 2024 19:27:50 -0700 From: Tycho Andersen To: Oleg Nesterov Cc: Christian Brauner , "Eric W. Biederman" , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] pidfd: implement PIDFD_THREAD flag for pidfd_open() Message-ID: References: <20240130112638.GA29773@redhat.com> <20240130113409.GA29849@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=us-ascii Content-Disposition: inline In-Reply-To: <20240130113409.GA29849@redhat.com> On Tue, Jan 30, 2024 at 12:34:09PM +0100, Oleg Nesterov wrote: > Damn. Self-NACK. > > I forgot (we all ;) about mt-exec, and there are 2 problems. > > 1. The "if (!thread_group_leader(tsk))" block in de_thread() needs > do_notify_pidfd() too, the execing non-leader thread looses its > old pid, pidfd_poll(PIDFD_THREAD, pid-of-execing-sub-thread) > should succeed. Must be fixed, I think. I think the `test_non_tgl_exec` from my tests exercises the scenario you're describing, and it works. > 2. pidfd_poll(PIDFD_THREAD, pid-of-group-leader) should not succeed > when its sub-thread execs, the execing thread inherits the leader's > pid. Perhaps pidfd_task_exited() can check sig->group_exec_task, I didn't have an explicit test for this, but I hacked one up, and pidfd_poll(PIDFD_THREAD, pid-of-group-leader) doesn't return after exec. I think it's ok? But I must be missing something. Tycho