[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEWA0a6ze-zrcOsY60ibovQDWYYKY4haEgQi=M-qu8Og8c=QcQ@mail.gmail.com>
Date: Mon, 15 Sep 2025 12:01:44 -0700
From: Andrei Vagin <avagin@...gle.com>
To: Eric Dumazet <edumazet@...gle.com>
Cc: "David S . Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>, netdev@...r.kernel.org,
eric.dumazet@...il.com, syzbot+50603c05bbdf4dfdaffa@...kaller.appspotmail.com,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>, Kuniyuki Iwashima <kuniyu@...gle.com>
Subject: Re: [PATCH net] net: lockless sock_i_ino()
On Mon, Sep 15, 2025 at 11:51 AM Eric Dumazet <edumazet@...gle.com> wrote:
>
> On Mon, Sep 15, 2025 at 11:16 AM Andrei Vagin <avagin@...gle.com> wrote:
> >
> > On Tue, Sep 02, 2025 at 06:36:03PM +0000, Eric Dumazet wrote:
> > > @@ -2056,6 +2058,10 @@ static inline int sk_rx_queue_get(const struct sock *sk)
> > > static inline void sk_set_socket(struct sock *sk, struct socket *sock)
> > > {
> > > sk->sk_socket = sock;
> > > + if (sock) {
> > > + WRITE_ONCE(sk->sk_uid, SOCK_INODE(sock)->i_uid);
> > > + WRITE_ONCE(sk->sk_ino, SOCK_INODE(sock)->i_ino);
> > > + }
> >
> > Hi Eric.
> >
> > This change breaks CRIU [1]. The issue is that socket_diag reports two
> > sockets with the same inode number. It seems inet_csk_clone_lock copies
> > sk->sk_ino to child sockets, but sk_set_socket doesn’t reset it to zero
> > when sock is NULL.
>
> Hi Andrei, thanks for the report.
>
> Could you test this patch ?
>
> diff --git a/include/net/sock.h b/include/net/sock.h
> index 0fd465935334160eeda7c1ea608f5d6161f02cb1..36e11b2afb223bf18ff0596d634e885cca549d0f
> 100644
> --- a/include/net/sock.h
> +++ b/include/net/sock.h
> @@ -2063,6 +2063,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);
It fixes the issue. Thanks!
Powered by blists - more mailing lists