From: Kuniyuki Iwashima <kuniyu@google.com>
To: Henry Martin <bsdhenrymartin@gmail.com>
Cc: Eric Dumazet <edumazet@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Willem de Bruijn <willemb@google.com>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH net] net: initialize sk_peer_lock in cloned sockets
Date: Sat, 21 Nov 2026 18:39:12 +0000 [thread overview]
Message-ID: <awHkoGTQ71NbCeU0@google.com> (raw)
In-Reply-To: <20261118101752.1989502-1-bsdhenrymartin@gmail.com>
On Wed, 18 Nov 2026 18:17:52 +0800, Henry Martin wrote:
> sock_copy() clones a struct sock with two memcpys that both include
> sk_peer_lock. sk_clone() re-initializes sk_lock, but nothing resets
> sk_peer_lock, so a clone created while the parent's sk_peer_lock is held
> inherits the lock in the locked state.
>
> The first getsockopt(SO_PEERCRED) on such a child spins forever in
> queued_spin_lock_slowpath(). spin_lock() disables preemption, so the
> task never schedules and its CPU stops reporting quiescent states; RCU
> grace periods then stop and callers of synchronize_rcu(), such as
> expand_files() from accept(), hang.
>
> Initialize sk_peer_lock explicitly for the clone.
>
> This issue was discovered by Tencent CodeBuddy Security.
>
> Fixes: 35306eb23814 ("af_unix: fix races in sk_peer_pid and sk_peer_cred accesses")
> Cc: stable@vger.kernel.org
> Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
> Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
As Eric mentioned in v1, restricting SO_PEERCRED etc to AF_UNIX
and AF_BLUETOOTH makes more sense.
next prev parent reply other threads:[~2026-11-21 18:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 10:17 [PATCH net] net: initialize sk_peer_lock in cloned sockets Henry Martin
2026-11-18 10:22 ` netdev-bot+sinfo
2026-11-21 18:39 ` Kuniyuki Iwashima [this message]
2026-11-21 23:44 ` patchwork-bot+netdevbpf
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=awHkoGTQ71NbCeU0@google.com \
--to=kuniyu@google.com \
--cc=bsdhenrymartin@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=willemb@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.