public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alois Wohlschlager <alwoju@gmx.de>
To: Christian Brauner <brauner@kernel.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Alexey Gladkov <legion@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	David Hildenbrand <david@redhat.com>,
	Rolf Eike Beer <eb@emlix.com>,
	Ran Xiaokai <ran.xiaokai@zte.com.cn>,
	Matthew Bobrowski <repnop@google.com>, Jan Kara <jack@suse.cz>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pid: Allow creation of pidfds to threads
Date: Fri, 01 Apr 2022 11:00:27 +0200	[thread overview]
Message-ID: <5392366.5i5WIIk9Ns@genesis> (raw)
In-Reply-To: <20220401070942.odjbuc5wecfayyok@wittgenstein>

[-- Attachment #1: Type: text/plain, Size: 1346 bytes --]

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 return
error on tasks which are not thread-group leaders. IIRC, waiting on specific
threads is not supported by Linux at all, so I don't see a problem with not
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 with
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 intended
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 there
is no way to obtain the required pidfd.

> Christian

Alois

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-04-01  9:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-31 19:02 [PATCH] pid: Allow creation of pidfds to threads Alois Wohlschlager
2022-04-01  7:09 ` Christian Brauner
2022-04-01  9:00   ` Alois Wohlschlager [this message]
2022-04-01  9:42     ` Christian Brauner
2022-04-13  4:46       ` Matthew Bobrowski
2022-04-14  8:11         ` Alois Wohlschlager

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5392366.5i5WIIk9Ns@genesis \
    --to=alwoju@gmx.de \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=david@redhat.com \
    --cc=eb@emlix.com \
    --cc=ebiederm@xmission.com \
    --cc=jack@suse.cz \
    --cc=legion@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=ran.xiaokai@zte.com.cn \
    --cc=repnop@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox