Re: [PATCH v4 03/10] net: add SO_PASSPIDFD_THREAD to get a thread-specific SCM_PIDFD
From: Kuniyuki Iwashima
Date: Thu Oct 08 2026 - 00:37:28 EST
On Mon, Oct 5, 2026 at 8:09 AM Andrew Halaney <andrew@xxxxxxxxxxxx> wrote:
>
> From: Christian Brauner <brauner@xxxxxxxxxx>
>
> Currently, SCM_PIDFD carries a pidfd for the thread-group leader. A
> broker or the coredump server cannot learn the identity of the specific
> thread that sent a given message. Now that both struct pids are recorded
> a receiver can ask for the specific identity it needs.
>
> So add SO_PASSPIDFD_THREAD as a sibling of SO_PASSPIDFD.
> SO_PASSPIDFD_THREAD delivers an SCM_PIDFD_THREAD, i.e. scoped
> to the specific thread sending. This is completely independent of
> SO_PASSPIDFD, meaning you can use both options and get both cmsgs.
>
> On SOCK_STREAM sockets recvmsg() only stops merging data at a thread
> boundary when the receiver asked for a thread pidfd. For SO_PASSCRED and
> SO_PASSPIDFD receivers all threads of one process remain a single
> writer.
>
> Signed-off-by: Christian Brauner (Amutable) <brauner@xxxxxxxxxx>
> Co-developed-by: Andrew Halaney <andrew@xxxxxxxxxxxx>
> Signed-off-by: Andrew Halaney <andrew@xxxxxxxxxxxx>
Reviewed-by: Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>