Skip to content

sockmap: Fix UAF and broken memory accounting for UDP.

Kuniyuki Iwashima bpf netdev 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest6 patches 24 repliesIn review
  2. v36 patches 1 replySuperseded
  3. v26 patches 0 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v16 patches3 repliesSuperseded

Changes in v4 from the cover letter

Patch 4: Don't pass gfp_flags and instead change it based on
take_ref in the next patch
Patch 5: Fix memory accounting condition from (skb->sk != sk) to
(skb->sk != sk && take_ref), the cause of selftest failure
Patch 6: Fix deadlock when requeued

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6sockmap: Annotate sk->sk_data_ready() for UDP.net/core/skmsg.c net/ipv4/udp.c+3 -32 replies
2/6sockmap: Annotate sk->sk_write_space() for UDP.net/core/skmsg.c net/core/sock.c net/ipv4/udp_bpf.c+8 -46 replies
3/6sockmap: Fix use-after-free in udp_bpf_recvmsg().net/ipv4/udp_bpf.c+9 -05 replies
4/6sockmap: Inline sk_psock_create_ingress_msg().net/core/skmsg.c+15 -161 reply
5/6sockmap: Consolidate sk_psock_skb_ingress_self().net/core/skmsg.c+17 -450 replies
6/6sockmap: Fix broken memory accounting for UDP.include/net/udp.h net/core/skmsg.c net/ipv4/udp.c+43 -410 replies

Reviews trailers per patch

4 of 6 patches have a Reviewed-by or Acked-by.

PatchJakub SitnickiJiayuan Chen
1/6R-b R-b
2/6R-b R-b
3/6R-b R-b
4/6R-b
5/6
6/6

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

Read the v4 thread

Cover letter [PATCH v4 bpf/net 0/6] sockmap: Fix UAF and broken memory accounting for UDP.

syzbot reported 3 issues in SOCKMAP for UDP.

Patch 1 - 2 fix lockless accesses to sk->sk_data_ready() and sk->sk_write_space().

Patch 3 fixes UAF in sk_msg_recvmsg().

Patch 4 - 5 consolidate sk_psock_skb_ingress_self() into sk_psock_skb_ingress() as prep.

Patch 6 fixes broken memory accounting.

Changes:
v4:
Patch 4: Don't pass gfp_flags and instead change it based on
take_ref in the next patch
Patch 5: Fix memory accounting condition from (skb->sk != sk) to
(skb->sk != sk && take_ref), the cause of selftest failure
Patch 6: Fix deadlock when requeued

v3: https://lore.kernel.org/netdev/[email protected]/
Patch 2: Use WRITE_ONCE() in udp_bpf_update_proto()

v2: https://lore.kernel.org/netdev/[email protected]/

    Patch 2: Cache sk->sk_write_space in sock_wfree()
    Patch 5: Keep msg->sk assignment
    Patch 6: Fix build failure when CONFIG_INET=n

v1: https://lore.kernel.org/netdev/[email protected]/

Kuniyuki Iwashima (6):
sockmap: Annotate sk->sk_data_ready() for UDP.
sockmap: Annotate sk->sk_write_space() for UDP.
sockmap: Fix use-after-free in udp_bpf_recvmsg().
sockmap: Inline sk_psock_create_ingress_msg().
sockmap: Consolidate sk_psock_skb_ingress_self().
sockmap: Fix broken memory accounting for UDP.

 include/net/udp.h  |   9 ++++
 net/core/skmsg.c   | 100 +++++++++++++++++++++------------------------
 net/core/sock.c    |   8 +++-
 net/ipv4/udp.c     |  11 ++++-
 net/ipv4/udp_bpf.c |  11 ++++-
 5 files changed, 81 insertions(+), 58 deletions(-)
Signature · 1 line
2.53.0.371.g1d285c8824-goog