All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@google.com>
To: Hyunwoo Kim <imv4bel@gmail.com>
Cc: edumazet@kernel.org, ncardwell@google.com, davem@davemloft.net,
	 kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	martin.lau@linux.dev,  john.fastabend@gmail.com,
	weiwan@google.com, sd@queasysnail.net,  jiayuan.chen@linux.dev,
	netdev@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH net v5 2/2] net: restore refcount ordering for lockless socket access
Date: Thu, 29 Oct 2026 21:55:23 +0000	[thread overview]
Message-ID: <auPAvbIZ8XmOHKaE@google.com> (raw)
In-Reply-To: <20261029214219.1035176-3-imv4bel@gmail.com>

On Fri, 30 Oct 2026 06:42:17 +0900, Hyunwoo Kim wrote:
> Before commit fb041bb7c0a9 ("locking/refcount: Consolidate implementations
> of refcount_t"), default builds implemented refcount_inc_not_zero() using
> atomic_add_unless(), which provided full memory ordering on success. The
> commit removed that ordering on weakly ordered architectures, allowing
> accesses after a successful reference acquisition to be reordered before
> it.
> 
> Use refcount_inc_not_zero_acquire() in the IPv4 and IPv6 established
> lookups and in inet_twsk_purge(), where the socket is validated again
> after taking a reference.
> 
> bpf_sk_assign() can receive a socket pointer obtained through BTF
> without a reference. Use acquire ordering when it takes its own reference
> for a refcounted socket.
> 
> Use refcount_set_release() when setting refcounts in the SYN cookie,
> TCP Fast Open, request migration, and TIME_WAIT paths. Keep the existing
> TIME_WAIT smp_wmb(), which separately orders the refcount store before
> ehash publication.
> 
> Fixes: fb041bb7c0a9 ("locking/refcount: Consolidate implementations of refcount_t")
> Fixes: 27e5203bd9c5 ("bpf: Change bpf_sk_assign to accept ARG_PTR_TO_BTF_ID_SOCK_COMMON")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>

Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>

Thanks !

  reply	other threads:[~2026-10-29 21:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 21:42 [PATCH net v5 0/2] inet: fix lockless ehash walk races Hyunwoo Kim
2026-10-29 21:42 ` [PATCH net v5 1/2] inet: reject unhashed sockets during established lookups Hyunwoo Kim
2026-11-02 22:06   ` netdev-bot+sashiko
2026-10-29 21:42 ` [PATCH net v5 2/2] net: restore refcount ordering for lockless socket access Hyunwoo Kim
2026-10-29 21:55   ` Kuniyuki Iwashima [this message]
2026-11-02 22:06   ` netdev-bot+sashiko
2026-11-03  7:47     ` Hyunwoo Kim
2026-11-03 14:30     ` Paolo Abeni
2026-11-03 14:49   ` Eric Dumazet
2026-11-04  1:24     ` Hyunwoo Kim
2026-11-04  7:59       ` Paolo Abeni
2026-11-05  4:15         ` Hyunwoo Kim
2026-11-03 14:40 ` [PATCH net v5 0/2] inet: fix lockless ehash walk races 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=auPAvbIZ8XmOHKaE@google.com \
    --to=kuniyu@google.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=imv4bel@gmail.com \
    --cc=jiayuan.chen@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sd@queasysnail.net \
    --cc=stable@vger.kernel.org \
    --cc=weiwan@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.