net: clear sk->sk_ino in sk_set_socket(sk, NULL)
Subsystems (4)
PATCH 1/1 net: clear sk->sk_ino in sk_set_socket(sk, NULL)
Andrei Vagin reported that blamed commit broke CRIU.
Indeed, while we want to keep sk_uid unchanged when a socket is cloned, we want to clear sk->sk_ino.
Otherwise, sock_diag might report multiple sockets sharing the same inode number.
Move the clearing part from sock_orphan() to sk_set_socket(sk, NULL), called both from sock_orphan() and sk_clone_lock().
--- include/net/sock.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
include/net/sock.h +3 -2
@@ -2061,6 +2061,9 @@ static inline void sk_set_socket(struct sock *sk, struct socket *sock)if (sock) {WRITE_ONCE (sk->sk_uid,SOCK_INODE (sock)->i_uid);WRITE_ONCE (sk->sk_ino,SOCK_INODE (sock)->i_ino); + }else { +/* Note: sk_uid is unchanged. */ +WRITE_ONCE (sk->sk_ino,0 ); } }
@@ -2082,8 +2085,6 @@ static inline void sock_orphan(struct sock *sk)sock_set_flag (sk,SOCK_DEAD );sk_set_socket (sk,NULL ); sk->sk_wq =NULL ; -/* Note: sk_uid is unchanged. */ -WRITE_ONCE (sk->sk_ino,0 );write_unlock_bh (&sk->sk_callback_lock); }
Signature · 1 line
2.51.0.384.g4c02a37b29-goog
Quoted 9 lines · Eric Dumazet
Andrei Vagin reported that blamed commit broke CRIU.
Indeed, while we want to keep
sk_uidunchanged when a socket is cloned, we want to clearsk->sk_ino.Otherwise,
sock_diagmight report multiple sockets sharing the same inode number.
Quoted 8 lines
Move the clearing part from
sock_orphan()tosk_set_socket(sk, NULL), called both fromsock_orphan()andsk_clone_lock().Fixes 5d6b58c932ec ("net: lockless sock_i_ino()")Reported-by Andrei Vagin <[email protected]>Signed-off-by Eric Dumazet <[email protected]>
I think we need to add Cc: [email protected].
Thanks,
Andrei
Quoted 14 lines · Andrei Vagin
Quoted 12 lines · Eric Dumazet
Andrei Vagin reported that blamed commit broke CRIU.
Indeed, while we want to keep
sk_uidunchanged when a socket is cloned, we want to clearsk->sk_ino.Otherwise,
sock_diagmight report multiple sockets sharing the same inode number.Move the clearing part from
sock_orphan()tosk_set_socket(sk, NULL), called both fromsock_orphan()andsk_clone_lock().
Quoted 8 lines
Quoted 5 lines
Fixes 5d6b58c932ec ("net: lockless sock_i_ino()")Reported-by Andrei Vagin <[email protected]>Signed-off-by Eric Dumazet <[email protected]>Acked-by Andrei Vagin <[email protected]>I think we need to add
Cc: [email protected].
I never do this. Note that the prior patch had no such CC.
A message that is not in the archive (sent off-list or not yet received): CAEWA0a4x4XMZKtpz_pNKruC4zwjETVxUuEMs2m_==Dpib_Jrqg@mail.gmail.com
Quoted 31 lines · Andrei Vagin
is
Quoted 22 lines · Eric Dumazet
Quoted 20 lines · Andrei Vagin
Quoted 17 lines · Eric Dumazet
Andrei Vagin reported that blamed commit broke CRIU.
Indeed, while we want to keep
sk_uidunchanged when a socket is cloned, we want to clearsk->sk_ino.Otherwise,
sock_diagmight report multiple sockets sharing the same inode number.Move the clearing part from
sock_orphan()tosk_set_socket(sk, NULL), called both fromsock_orphan()andsk_clone_lock().Fixes 5d6b58c932ec ("net: lockless sock_i_ino()")Reported-by Andrei Vagin <[email protected]>Signed-off-by Eric Dumazet <[email protected]>Quoted 4 lines
Quoted 2 lines
Acked-by Andrei Vagin <[email protected]>I think we need to add
Cc: [email protected].I never do this. Note that the prior patch had no such CC.
Quoted 7 lines
The original patch has been ported to the v6.16 kernels. According to the kernel documentation
(https://www.kernel.org/doc/html/v6.5/process/stable-kernel-rules.html),
adding Cc: [email protected] is required for automatic porting into stable trees. Without this tag, someone will likely need to manually request that this patch be ported. This is my understanding of how the stable branch process works, sorry if I missed something.
Andrei, I think I know pretty well what I am doing. You do not have to explain to me anything.
Thank you.
Quoted 41 lines · Eric Dumazet
Quoted 31 lines · Andrei Vagin
is
Quoted 22 lines · Eric Dumazet
Quoted 20 lines · Andrei Vagin
Quoted 17 lines · Eric Dumazet
Andrei Vagin reported that blamed commit broke CRIU.
Indeed, while we want to keep
sk_uidunchanged when a socket is cloned, we want to clearsk->sk_ino.Otherwise,
sock_diagmight report multiple sockets sharing the same inode number.Move the clearing part from
sock_orphan()tosk_set_socket(sk, NULL), called both fromsock_orphan()andsk_clone_lock().Fixes 5d6b58c932ec ("net: lockless sock_i_ino()")Reported-by Andrei Vagin <[email protected]>Signed-off-by Eric Dumazet <[email protected]>Quoted 4 lines
Quoted 2 lines
Acked-by Andrei Vagin <[email protected]>I think we need to add
Cc: [email protected].I never do this. Note that the prior patch had no such CC.
Quoted 7 lines
The original patch has been ported to the v6.16 kernels. According to the kernel documentation
(https://www.kernel.org/doc/html/v6.5/process/stable-kernel-rules.html),
adding Cc: [email protected] is required for automatic porting into stable trees. Without this tag, someone will likely need to manually request that this patch be ported. This is my understanding of how the stable branch process works, sorry if I missed something.
Quoted 2 lines
Andrei, I think I know pretty well what I am doing. You do not have to explain to me anything.
Eric, please don't misunderstand me. I want to get this patch into the stable kernels as soon as possible. I appreciate your help here.
Thanks again for the fix.
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Wed, 17 Sep 2025 13:53:37 +0000 you wrote:
Andrei Vagin reported that blamed commit broke CRIU.
Indeed, while we want to keep
sk_uidunchanged when a socket is cloned, we want to clearsk->sk_ino.Otherwise,
sock_diagmight report multiple sockets sharing the same inode number.[...]
Here is the summary with links:
- [net] net: clear sk->sk_ino in sk_set_socket(sk, NULL)
https://git.kernel.org/netdev/net/c/87ebb628a5ac
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html