[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250701083922.97928-1-aleksandr.mikhalitsyn@canonical.com>
Date: Tue, 1 Jul 2025 10:39:09 +0200
From: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@...onical.com>
To: kuniyu@...gle.com
Cc: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@...onical.com>,
linux-kernel@...r.kernel.org,
netdev@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Willem de Bruijn <willemb@...gle.com>,
Leon Romanovsky <leon@...nel.org>,
Arnd Bergmann <arnd@...db.de>,
Christian Brauner <brauner@...nel.org>,
Lennart Poettering <mzxreary@...inter.de>,
Luca Boccassi <bluca@...ian.org>,
David Rheinsberg <david@...dahead.eu>,
Simon Horman <horms@...nel.org>
Subject: [PATCH net-next v2 0/6] allow reaped pidfds receive in SCM_PIDFD
This is a logical continuation of a story from [1], where Christian
extented SO_PEERPIDFD to allow getting pidfds for a reaped tasks.
Git tree (based on vfs/vfs-6.17.pidfs):
v2: https://github.com/mihalicyn/linux/commits/scm_pidfd_stale.v2
current: https://github.com/mihalicyn/linux/commits/scm_pidfd_stale
Changelog for version 2:
- renamed __skb_set_pid() -> unix_set_pid_to_skb() [ as Kuniyuki suggested ]
- get rid of extra helper (__scm_set_cred()) I've introduced before [ as Kuniyuki suggested ]
- s/__inline__/inline/ for functions I touched [ as Kuniyuki suggested ]
- get rid of chunk in unix_destruct_scm() with NULLifying UNIXCB(skb).pid [ as Kuniyuki suggested ]
- added proper error handling in scm_send() for scm_set_cred() return value [ found by me during rework ]
- don't do get_pid() in __scm_replace_pid() [ as Kuniyuki suggested ]
- move __scm_replace_pid() from scm.h to scm.c [ as Kuniyuki suggested ]
- fixed kdoc for unix_maybe_add_creds() [ thanks to Kuniyuki's review ]
- added RWB tags from Christian and Kuniyuki
Links to previous versions:
v1: https://lore.kernel.org/netdev/20250629214449.14462-1-aleksandr.mikhalitsyn@canonical.com
tree: https://github.com/mihalicyn/linux/commits/scm_pidfd_stale.v1
/!\ Notice
Series based on https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git/log/?h=vfs-6.17.pidfs
It does not use pidfs_get_pid()/pidfs_put_pid() API as these were removed in a scope of [2].
I've checked that net-next branch currently (still) has these obsolete functions, but it
will eventually include changes from [2], so it's not a big problem.
Link: https://lore.kernel.org/all/20250425-work-pidfs-net-v2-0-450a19461e75@kernel.org/ [1]
Link: https://lore.kernel.org/all/20250618-work-pidfs-persistent-v2-0-98f3456fd552@kernel.org/ [2]
Cc: linux-kernel@...r.kernel.org
Cc: netdev@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>
Cc: Eric Dumazet <edumazet@...gle.com>
Cc: Jakub Kicinski <kuba@...nel.org>
Cc: Paolo Abeni <pabeni@...hat.com>
Cc: Willem de Bruijn <willemb@...gle.com>
Cc: Leon Romanovsky <leon@...nel.org>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Christian Brauner <brauner@...nel.org>
Cc: Kuniyuki Iwashima <kuniyu@...gle.com>
Cc: Lennart Poettering <mzxreary@...inter.de>
Cc: Luca Boccassi <bluca@...ian.org>
Cc: David Rheinsberg <david@...dahead.eu>
Alexander Mikhalitsyn (6):
af_unix: rework unix_maybe_add_creds() to allow sleep
af_unix: introduce unix_skb_to_scm helper
af_unix: introduce and use __scm_replace_pid() helper
af_unix: stash pidfs dentry when needed
af_unix: enable handing out pidfds for reaped tasks in SCM_PIDFD
selftests: net: extend SCM_PIDFD test to cover stale pidfds
include/net/scm.h | 33 ++-
net/core/scm.c | 30 ++-
net/unix/af_unix.c | 75 ++++--
.../testing/selftests/net/af_unix/scm_pidfd.c | 217 ++++++++++++++----
4 files changed, 285 insertions(+), 70 deletions(-)
--
2.43.0
Powered by blists - more mailing lists