Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: zhangjiayi1014@gmail.com
Cc: edumazet@kernel.org, kuniyu@google.com, pabeni@redhat.com,
	willemb@google.com, davem@davemloft.net, kuba@kernel.org,
	horms@kernel.org, netdev@vger.kernel.org,
	syzbot+c2e012bd497ee37068b0@syzkaller.appspotmail.com,
	syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH net-next] net: use RCU_INIT_POINTER() to clear sk->sk_wq in sock_orphan()
Date: Thu, 03 Dec 2026 18:05:19 +0000	[thread overview]
Message-ID: <179632111980.3146.9699155298810510139@kernel.org> (raw)
In-Reply-To: <20261202180315.4144359-1-zhangjiayi1014@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The patch carries `Closes:` for the syzbot bug titled "data-
  race in unix_release_sock / unix_write_space", but one of the access…

--

net: use RCU_INIT_POINTER() to clear sk->sk_wq in sock_orphan()

This patch changes the plain store that clears sk->sk_wq in sock_orphan()
to RCU_INIT_POINTER(), so the store is done with WRITE_ONCE(). The goal is
to silence a KCSAN data-race report between unix_release_sock() and
unix_write_space() that syzbot found.

Closes: https://syzkaller.appspot.com/bug?extid=c2e012bd497ee37068b0

> diff --git a/include/net/sock.h b/include/net/sock.h
> index 5a203809218aa..9d22ccd91838d 100644
> --- a/include/net/sock.h
> +++ b/include/net/sock.h
> @@ -2168,7 +2168,7 @@ static inline void sock_orphan(struct sock *sk)
>  	write_lock_bh(&sk->sk_callback_lock);
>  	sock_set_flag(sk, SOCK_DEAD);

[Severity: Medium]
Will the syzbot bug in the Closes: tag still be reported after this patch?

sock_set_flag() is a plain non-atomic read-modify-write of the whole
sk_flags word:

include/net/sock.h:sock_set_flag() {
	__set_bit(flag, &sk->sk_flags);
}

On the peer side, the skb free path reads the same word without holding
sk_callback_lock:

unix_release_sock()->kfree_skb_reason()->unix_wfree()->sock_wfree()
  ->unix_write_space()->sk_wake_async_rcu()

include/net/sock.h:sk_wake_async_rcu() {
	if (unlikely(sock_flag(sk, SOCK_FASYNC)))
		sock_wake_async(rcu_dereference(sk->sk_wq), how, band);
}

unix_write_space() only holds rcu_read_lock(), so no lock is shared with
sock_orphan(). KCSAN can still report this pair under the same title,
"data-race in unix_release_sock / unix_write_space".

The notes below the changelog say this pair shows up in 3 of the 35 syzbot
crashes and in 3 of 5 local runs with the patch applied. Once this is
merged, syzbot would close the bug and then report it again from the same
reproducer.

Should the sk_flags access be handled too? One option is an atomic
set_bit() for SOCK_DEAD in sock_orphan(). Another is data_race() on the
reader side. If that is out of scope, could the Closes: tag be changed so
it does not claim the whole syzbot report is fixed?

>  	sk_set_socket(sk, NULL);
> -	sk->sk_wq  = NULL;
> +	RCU_INIT_POINTER(sk->sk_wq, NULL);
>  	write_unlock_bh(&sk->sk_callback_lock);
>  }

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202180315.4144359-1-zhangjiayi1014%40gmail.com

      reply	other threads:[~2026-12-03 18:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 18:03 [PATCH net-next] net: use RCU_INIT_POINTER() to clear sk->sk_wq in sock_orphan() Jiayi Zhang
2026-12-03 18:05 ` netdev-bot+sashiko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179632111980.3146.9699155298810510139@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzbot+c2e012bd497ee37068b0@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=willemb@google.com \
    --cc=zhangjiayi1014@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox