From: Martin KaFai Lau <martin.lau@linux.dev>
To: bpf@vger.kernel.org
Cc: 'Alexei Starovoitov ' <ast@kernel.org>,
'Andrii Nakryiko ' <andrii@kernel.org>,
'Daniel Borkmann ' <daniel@iogearbox.net>,
netdev@vger.kernel.org, kernel-team@meta.com
Subject: [PATCH v2 bpf 0/3] bpf: Fix backward progress bug in bpf_iter_udp
Date: Wed, 10 Jan 2024 09:57:40 -0800 [thread overview]
Message-ID: <20240110175743.2220907-1-martin.lau@linux.dev> (raw)
From: Martin KaFai Lau <martin.lau@kernel.org>
This patch set fixes an issue in bpf_iter_udp that makes backward
progress and prevents the user space process from finishing. There is
a test at the end to reproduce the bug.
Please see individual patches for details.
v2:
- Added patch 1 to fix another bug that goes back to
the previous bucket
- Simplify the fix in patch 2 to always reset iter->offset to 0
- Add a test case to close all udp_sk in a bucket while
in the middle of the iteration.
Martin KaFai Lau (3):
bpf: iter_udp: Retry with a larger batch size without going back to
the previous bucket
bpf: Avoid iter->offset making backward progress in bpf_iter_udp
selftests/bpf: Test udp and tcp iter batching
net/ipv4/udp.c | 22 ++-
.../bpf/prog_tests/sock_iter_batch.c | 130 ++++++++++++++++++
.../selftests/bpf/progs/bpf_tracing_net.h | 3 +
.../selftests/bpf/progs/sock_iter_batch.c | 121 ++++++++++++++++
4 files changed, 264 insertions(+), 12 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/sock_iter_batch.c
create mode 100644 tools/testing/selftests/bpf/progs/sock_iter_batch.c
--
2.34.1
next reply other threads:[~2024-01-10 17:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-10 17:57 Martin KaFai Lau [this message]
2024-01-10 17:57 ` [PATCH v2 bpf 1/3] bpf: iter_udp: Retry with a larger batch size without going back to the previous bucket Martin KaFai Lau
2024-01-12 4:52 ` Yonghong Song
2024-01-10 17:57 ` [PATCH v2 bpf 2/3] bpf: Avoid iter->offset making backward progress in bpf_iter_udp Martin KaFai Lau
2024-01-12 5:33 ` Yonghong Song
2024-01-10 17:57 ` [PATCH v2 bpf 3/3] selftests/bpf: Test udp and tcp iter batching Martin KaFai Lau
2024-01-12 17:50 ` Yonghong Song
2024-01-12 18:10 ` Martin KaFai Lau
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=20240110175743.2220907-1-martin.lau@linux.dev \
--to=martin.lau@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@meta.com \
--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