Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

af_unix: enable handing out pidfds for reaped tasks in SCM_PIDFD

Now everything is ready to pass PIDFD_STALE to pidfd_prepare().
This will allow opening pidfd for reaped tasks.

Cc: linux-kernel@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>
Cc: Willem de Bruijn <willemb@google.com>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Kuniyuki Iwashima <kuniyu@google.com>
Cc: Lennart Poettering <mzxreary@0pointer.de>
Cc: Luca Boccassi <bluca@debian.org>
Cc: David Rheinsberg <david@readahead.eu>
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Link: https://lore.kernel.org/20250703222314.309967-7-aleksandr.mikhalitsyn@canonical.com
Reviewed-by: Christian Brauner <brauner@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Alexander Mikhalitsyn and committed by
Christian Brauner
c679d17d 2775832f

+2 -1
+2 -1
net/core/scm.c
··· 23 23 #include <linux/security.h> 24 24 #include <linux/pid_namespace.h> 25 25 #include <linux/pid.h> 26 + #include <uapi/linux/pidfd.h> 26 27 #include <linux/pidfs.h> 27 28 #include <linux/nsproxy.h> 28 29 #include <linux/slab.h> ··· 483 482 if (!scm->pid) 484 483 return; 485 484 486 - pidfd = pidfd_prepare(scm->pid, 0, &pidfd_file); 485 + pidfd = pidfd_prepare(scm->pid, PIDFD_STALE, &pidfd_file); 487 486 488 487 if (put_cmsg(msg, SOL_SOCKET, SCM_PIDFD, sizeof(int), &pidfd)) { 489 488 if (pidfd_file) {