Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1210330pxb; Fri, 1 Apr 2022 07:28:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynlEyOcGTglwoLx+/ywUh51nB/qlSXTN+1DpDx36R7TyWO8BdJDl9YFhVag0EpTWq0WiSC X-Received: by 2002:a17:902:ba8c:b0:14f:d9b7:ab4 with SMTP id k12-20020a170902ba8c00b0014fd9b70ab4mr10911293pls.23.1648823312655; Fri, 01 Apr 2022 07:28:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648823312; cv=none; d=google.com; s=arc-20160816; b=vPHbqQdNT5l89slrJMT7QDW0DAv0l809rpI+9xl9ggbBD6cI3iWed7wVOLL6Qf/5sZ FuO6SsSohQcLlyecnwKMGHteo9Yu7eTlz0yWw8cQdIkD7YcvHetDc4NsowM1wK18Vobl 6M4xq2++OYY1iu6QMB7/fikmNiSHJm66jdLiUyJPXteRA11eVmuKSyZoTRBcE4bw4lz1 pAMDnywhOVGKRKTOwJOaPcWzwJkKko9rR/R0RIQyV4CdDZE1ueutD2U4j16MCOJodKUl NkG15TD5ttOSO6JCaE1RtCLPLwsXuavkS8mvB84N27ibML4HDC7BYiKxyI8V+pUks6T+ iuXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=A3dsJ2AXBiFkTvR2SoKOxX+hgIr1pcvpMiQ8AAPATCo=; b=BaB0t9lP5cBXs5FgYl58s/dLKlQNnK9sSefuIyDe41IvH7VFxUngYuQozz9bjqnh/u q+cIsEg3JWNRaGTvmmZmm+mXM2e0F+2n+1P61sy57DULE+dlQXHRxOnAbw+35e2QbXXp 6KivV1Bf54+gLpBnCHw8xf6C5hbbbeLcc0BKK06DfeTt6gIzLhs8ACFFrvpVtMlAjITU xHMBfZsTyvHpvglSxVXcEdCbn1nqiCM64qOCGUxfWn7TQuvn455G7UcrwGBGRqTVvhaY CytRAO2sfp2k9avcaVSxArG5Xlt/XQAqzmcjhRIBp7K4ll4VKFZpjATu8Bh39pPCV8in V6Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b="U0B/7xUg"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m9-20020a056a00080900b004fa3a8dffc6si2689416pfk.125.2022.04.01.07.28.18; Fri, 01 Apr 2022 07:28:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b="U0B/7xUg"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344088AbiDAJDS (ORCPT + 99 others); Fri, 1 Apr 2022 05:03:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231157AbiDAJDQ (ORCPT ); Fri, 1 Apr 2022 05:03:16 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02D1125F667 for ; Fri, 1 Apr 2022 02:01:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1648803638; bh=A3dsJ2AXBiFkTvR2SoKOxX+hgIr1pcvpMiQ8AAPATCo=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=U0B/7xUgHIBRZCONDSD4540AsBZEgTnO6HPKt/0HU6D+xvF+r2n9YJ/bXrf2KtcZv TyIgfAFwguW9g95+99/aYjaCscWtGy2VkGL8g2TugVb6oFo649gtN4McPvAljnPJL9 pmC2Z/6OGBxFTQBiYD7CwVtABZjIo//KsTFPmCkk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from genesis.localnet ([217.232.146.93]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M3DJv-1nbZWd0p9J-003ZlA; Fri, 01 Apr 2022 11:00:38 +0200 From: Alois Wohlschlager To: Christian Brauner Cc: "Eric W. Biederman" , Andrew Morton , Peter Zijlstra , Alexey Gladkov , Jens Axboe , David Hildenbrand , Rolf Eike Beer , Ran Xiaokai , Matthew Bobrowski , Jan Kara , linux-kernel@vger.kernel.org Subject: Re: [PATCH] pid: Allow creation of pidfds to threads Date: Fri, 01 Apr 2022 11:00:27 +0200 Message-ID: <5392366.5i5WIIk9Ns@genesis> In-Reply-To: <20220401070942.odjbuc5wecfayyok@wittgenstein> References: <3412128.IC5jYiYEAv@genesis> <20220401070942.odjbuc5wecfayyok@wittgenstein> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart36927791.vr0k8ECSMx"; micalg="pgp-sha256"; protocol="application/pgp-signature" X-Provags-ID: V03:K1:Mcz+IWskG6bHGd5D+uo1Pru/G0reYgYsMnwEkPHVLHar1c/ob9h XT6NLZ338r66vUtCJKuudb6DfC3eCiUycko4I5wphhRxpqcrbsLtuOuHFDDNENKQLAs8pGc 0uqS0KiipX0AwBqC0ZeiEmGuFMwJt2gSCxU4IxxPZj8DJvwaZ4A6c37c3Io99vqLOuMzStp EJeA4OJbJxnFohDPFKpaQ== X-UI-Out-Filterresults: notjunk:1;V03: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w7tmg8yfUnBA1PtZUhZQBRuEMfBvkNIJz53BF8fo+IiewQR53dK3w6K6ZKEL2 dD1uSsI/VfGmfE= X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --nextPart36927791.vr0k8ECSMx Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii"; protected-headers="v1" From: Alois Wohlschlager To: Christian Brauner Subject: Re: [PATCH] pid: Allow creation of pidfds to threads Date: Fri, 01 Apr 2022 11:00:27 +0200 Message-ID: <5392366.5i5WIIk9Ns@genesis> In-Reply-To: <20220401070942.odjbuc5wecfayyok@wittgenstein> Hello Christian, > We originally blocked this because it is not as easy as simply allowing > pidfds to be created for non-thread-group leaders. > For a start, pidfd_poll() currently doens't work if pidfd_task() isn't a > thread-group leader I did notice the hang there, that's why my patch changes pidfd_poll to ret= urn error on tasks which are not thread-group leaders. IIRC, waiting on specif= ic threads is not supported by Linux at all, so I don't see a problem with no= t supporting it here either. > and you'll just hang for CLONE_PIDFD | CLONE_THREAD. No, CLONE_PIDFD | CLONE_THREAD behavior is unchanged, it will still fail w= ith EINVAL. I actually confirmed this by double-checking right now. > So at least that needs to be adapated as well and there's likely a bunch > of other corner-cases I'm forgetting about. I'd be happy to hear about other corner-cases so I can fix them. > Do you have a concrete use-case you want this for? My use-case is basically making pidfd_getfd actually useful for its intend= ed purpose: there is a seccomp_unotify-based supervisor that wants to obtain = a file descriptor from its guest. This currently does not work if the action= to be forwarded to the supervisor is performed in a secondary thread, since t= here is no way to obtain the required pidfd. > Christian Alois --nextPart36927791.vr0k8ECSMx Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEypeoIv8kJdR0rz5L4PWepeUhaRQFAmJGvysACgkQ4PWepeUh aRSBhQ/8CXQauAadNg4smYJongj+K9af3RvKzcgoGNZ7inOUDRBADIyDIMkiP4QH 1LxDeWn36uwVju5R+lIrW1nbO/aKEh+wEkQz8yQun4saQfehfGDydnk+TPXMPmlw E575TuBN7qncn2sR0eiOB0QecN8sO1pGHZbM6ZBTndFl9UR+3hMSse/vD9zbfiuP HhdTRY/Um/GHLTl1KTWua4v7GPLUVpDRh1nTSWaP366jwKX0xkeTqZ7hg1xTmEqz 8c36+TAKS3MEOTt68hTFM3H7VfhzdxJuZRwP5++MlWfAk0B46zDMtRJKykQr9uH5 Lx3BHmnDMt6XB+c9d4sgp+IOt/7HmSA/bEqKTIdb1Ea5eiChwPzQjbLo22L8U1hZ IxYeStwGSG0fgTPSrBlC+vad8FdTfSNHxNXPTMCmiLawhyXFWnSmfpqmhA6ots+I G4Ei5duX06BaL4Swwv/f4IxZQVfNIR5nhLsyRrgamh2+K7oakUmoxRLXScpGY9o4 Ghh9+vjSnOB/b0lFtrjorFbYb5w8McSEGLigXfSHXnLfTdIA9a8t/2ojQDWfXIl2 VA58qchxSuXhHPx76Strh3GmT1RLwgzA3qDMCpjdEvwHq5pvC6W5SOOiziNSRx19 Igxi1fXGhJCkKE7krdS4/lqqNxucoaJVvtr1I55CbEd8WzjcgE4= =PTKU -----END PGP SIGNATURE----- --nextPart36927791.vr0k8ECSMx--