Skip to content

inet: fix lockless ehash walk races

Hyunwoo Kim netdev stable 5 versions – Applied

Status from this message: This series was applied to netdev/net.git (main)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest2 patches 7 repliesApplied 2/2
  2. v42 patches 4 repliesSuperseded
  3. v32 patches 1 replySuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v22 patches3 repliesSuperseded
v11 patch2 repliesSuperseded

Changes in v5 from the cover letter

- 2/2: add acquire ordering to bpf_sk_assign() for BTF socket pointers (Kuniyuki)
- v4: https://lore.kernel.org/r/[email protected]

Patches in v5 All 2 applied

#Subject and filesSizeRepliesApplied
1/2inet: reject unhashed sockets during established lookupsnet/ipv4/inet_connection_sock.c net/ipv4/inet_hashtables.c net/ipv4/syncookies.c +2 more+18 -70 repliesApplied
2/2net: restore refcount ordering for lockless socket accessnet/core/filter.c net/ipv4/inet_connection_sock.c net/ipv4/inet_hashtables.c +4 more+10 -107 repliesApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchEric DumazetKuniyuki Iwashima
1/2R-b R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH net v5 0/2] inet: fix lockless ehash walk races

Fix two issues in lockless ehash walks. Reject unhashed sockets after taking a reference in established lookups, and restore the acquire/release ordering around refcount publication and acquisition.

Changes in v5:
- 2/2: add acquire ordering to bpf_sk_assign() for BTF socket pointers (Kuniyuki)
- v4: https://lore.kernel.org/r/[email protected]

Changes in v4:
- 2/2: add acquire ordering to inet_twsk_purge() and update the changelog (Sashiko)
- v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- 1/2: clarify the request reference comment (Eric)
- 2/2: drop the sk_clone() change, keep the TCP Fast Open update in place, add release ordering to TIME_WAIT, and rework the changelog (Eric)
- 2/2: note that backports to trees without the refcount helpers need adjustment (Eric)
- v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- 1/2: split the unhashed checks and __reqsk_free() to reqsk_put() conversions from the ordering changes, set the Fixes tag to commit 079096f103fa ("tcp/dccp: install syn_recv requests into ehash table"), mention the TIME_WAIT hashdance and request replacement cases, clarify request reference ownership, and drop the full socket race discussion (Eric)
- 2/2: new, split out the acquire/release changes, set the Fixes tag to commit fb041bb7c0a9 ("locking/refcount: Consolidate implementations of refcount_t"), cover sk_clone(), and leave the already ordered TIME_WAIT path unchanged (Eric)
- v1: https://lore.kernel.org/r/ath58Egc-oI6p3Jl@v4bel

Hyunwoo Kim (2):
inet: reject unhashed sockets during established lookups
net: restore refcount ordering for lockless socket access

 net/core/filter.c               |  2 +-
 net/ipv4/inet_connection_sock.c | 16 ++++++++++------
 net/ipv4/inet_hashtables.c      |  7 ++++---
 net/ipv4/inet_timewait_sock.c   |  4 ++--
 net/ipv4/syncookies.c           |  4 +++-
 net/ipv4/tcp_fastopen.c         |  2 +-
 net/ipv4/tcp_input.c            |  4 +++-
 net/ipv6/inet6_hashtables.c     |  6 ++++--
 8 files changed, 28 insertions(+), 17 deletions(-)
Signature · 1 line
2.43.0