Netdev List
 help / color / mirror / Atom feed
From: chenyuan_fl@163.com
To: netdev@vger.kernel.org, bpf@vger.kernel.org
Cc: john.fastabend@gmail.com, jakub@cloudflare.com,
	jiayuan.chen@linux.dev, daniel@iogearbox.net, ast@kernel.org,
	cong.wang@bytedance.com, linux-kernel@vger.kernel.org
Subject: [PATCH bpf-next 0/2] bpf, sockmap: Fix udp_bpf_recvmsg() spinning on backlog-only ingress
Date: Tue, 29 Sep 2026 16:34:45 +0800	[thread overview]
Message-ID: <20260929083447.558818-1-chenyuan_fl@163.com> (raw)

From: Yuan Chen <chenyuan@kylinos.cn>

udp_bpf_recvmsg() re-arms its receive loop on backlog-only skbs that
sk_msg_recvmsg() can never consume: whenever the backlog stays
populated, the loop re-arms on the same skb forever and recvmsg()
spins while holding the socket lock instead of sleeping.

Patch 1 aligns the re-arm condition with TCP and unix_bpf_recvmsg();
patch 2 adds a selftest that reproduces the hang.

Yuan Chen (2):
  bpf, sockmap: Fix udp_bpf_recvmsg() spinning on backlog-only ingress
  selftests/bpf: Add a test for udp_bpf_recvmsg() with a stuck backlog

 net/ipv4/udp_bpf.c                            |   2 +-
 .../bpf/prog_tests/sockmap_udp_backlog.c      | 141 ++++++++++++++++++
 .../bpf/progs/test_sockmap_udp_backlog.c      |  21 +++
 3 files changed, 163 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/sockmap_udp_backlog.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_sockmap_udp_backlog.c

-- 
2.54.0


             reply	other threads:[~2026-09-29  8:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29  8:34 chenyuan_fl [this message]
2026-09-29  8:34 ` [PATCH bpf-next 1/2] bpf, sockmap: Fix udp_bpf_recvmsg() spinning on backlog-only ingress chenyuan_fl
2026-09-30  9:01   ` Alexei Starovoitov
2026-09-29  8:34 ` [PATCH bpf-next 2/2] selftests/bpf: Add a test for udp_bpf_recvmsg() with a stuck backlog chenyuan_fl
2026-09-29  9:26   ` bot+bpf-ci

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=20260929083447.558818-1-chenyuan_fl@163.com \
    --to=chenyuan_fl@163.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=cong.wang@bytedance.com \
    --cc=daniel@iogearbox.net \
    --cc=jakub@cloudflare.com \
    --cc=jiayuan.chen@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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