From: chenyuan_fl@163.com
To: bpf@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Jiri Olsa <jolsa@kernel.org>,
Ihor Solodrai <ihor.solodrai@linux.dev>,
Yuan Chen <chenyuan@kylinos.cn>
Subject: [PATCH bpf-next 0/2] bpf: Keep target extended until its last freplace link detaches
Date: Wed, 23 Sep 2026 17:06:33 +0800 [thread overview]
Message-ID: <20260923090635.368488-1-chenyuan_fl@163.com> (raw)
From: Yuan Chen <chenyuan@kylinos.cn>
is_extended is a plain boolean, but one target prog can carry several
freplace links at the same time, one on its entry and one on a global
subprogram. __bpf_trampoline_unlink_prog() cleared it whenever *any*
of them detached, so with two links on one target, detaching one of
them re-armed the unbounded tail call loop closed by commit
d6083f040d5d ("bpf: Prevent tailcall infinite loop caused by freplace"):
a single BPF_PROG_TEST_RUN on the tail-called target then panics the
kernel, reproduced on both bpf-next and master.
Patch 1 replaces the boolean with a count of the freplace links
attached to each target prog, so the target stays extended until its
last link detaches. Patch 2 adds a selftest covering the sequence.
Yuan Chen (2):
bpf: Keep target extended until its last freplace link detaches
selftests/bpf: Verify is_extended with multiple freplace links
include/linux/bpf.h | 4 +-
kernel/bpf/arraymap.c | 2 +-
kernel/bpf/trampoline.c | 10 ++-
.../selftests/bpf/prog_tests/tailcalls.c | 74 +++++++++++++++++++
.../bpf/progs/tailcall_freplace_multi.c | 27 +++++++
5 files changed, 110 insertions(+), 7 deletions(-)
create mode 100644 tools/testing/selftests/bpf/progs/tailcall_freplace_multi.c
--
2.54.0
next reply other threads:[~2026-09-23 9:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 9:06 chenyuan_fl [this message]
2026-09-23 9:06 ` [PATCH bpf-next 1/2] " chenyuan_fl
2026-09-23 9:54 ` Leon Hwang
2026-09-23 10:02 ` bot+bpf-ci
2026-09-23 22:14 ` Alexei Starovoitov
2026-09-23 9:06 ` [PATCH bpf-next 2/2] selftests/bpf: Verify is_extended with multiple freplace links chenyuan_fl
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=20260923090635.368488-1-chenyuan_fl@163.com \
--to=chenyuan_fl@163.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=chenyuan@kylinos.cn \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=ihor.solodrai@linux.dev \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/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
all inboxes | Powered by JetHome®