From: Eduard Zingerman <eddyz87@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Leon Hwang <hffilwlqm@gmail.com>
Cc: "Leon Hwang" <leon.hwang@linux.dev>, bpf <bpf@vger.kernel.org>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Toke Høiland-Jørgensen" <toke@redhat.com>,
"Martin KaFai Lau" <martin.lau@kernel.org>,
"Yonghong Song" <yonghong.song@linux.dev>,
"Puranjay Mohan" <puranjay@kernel.org>,
"Xu Kuohai" <xukuohai@huaweicloud.com>,
"Ilya Leoshkevich" <iii@linux.ibm.com>,
kernel-patches-bot@fb.com
Subject: Re: [PATCH bpf-next v4 2/4] bpf: Prevent extending tail callee prog with freplace prog
Date: Fri, 04 Oct 2024 13:52:04 -0700 [thread overview]
Message-ID: <3d2ba1d054d73c53b205559ad5d89cef78d89303.camel@gmail.com> (raw)
In-Reply-To: <CAADnVQL_VUJCFH6TuHMLesafY8iQ-4xBkiTdfEMqr02C_G6T=w@mail.gmail.com>
On Fri, 2024-10-04 at 12:33 -0700, Alexei Starovoitov wrote:
[...]
> btw the whole thing can be done with a single atomic64_t:
> - set it to 1 at the start then
>
> - prog_fd_array_get_ptr() will do
> atomic64_inc_not_zero
>
> - prog_fd_array_put_ptr() will do
> atomic64_add_unless(,-1, 1)
>
> - freplace attach will do
> cmpxchg(,1,0)
>
> so 1 - initial state
> 2,3,.. - prog in prog_array
> 0 - prog was extended.
>
> If == 0 -> cannot add to prog_array
> if > 1 -> cannot freplace.
I think this should work, because we no longer need to jungle two values.
I kinda like it.
[...]
next prev parent reply other threads:[~2024-10-04 20:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-29 13:27 [PATCH bpf-next v4 0/4] bpf: Fix tailcall infinite loop caused by freplace Leon Hwang
2024-09-29 13:27 ` [PATCH bpf-next v4 1/4] bpf: Prevent updating extended prog to prog_array map Leon Hwang
2024-10-01 11:13 ` Eduard Zingerman
2024-10-01 13:20 ` Leon Hwang
2024-10-01 16:54 ` Eduard Zingerman
2024-09-29 13:27 ` [PATCH bpf-next v4 2/4] bpf: Prevent extending tail callee prog with freplace prog Leon Hwang
2024-09-30 1:53 ` Leon Hwang
2024-10-04 19:33 ` Alexei Starovoitov
2024-10-04 20:37 ` Eduard Zingerman
2024-10-04 20:52 ` Eduard Zingerman [this message]
2024-10-04 23:30 ` Alexei Starovoitov
2024-09-29 13:27 ` [PATCH bpf-next v4 3/4] selftests/bpf: Add a test case to confirm a tailcall infinite loop issue has been prevented Leon Hwang
2024-09-29 13:27 ` [PATCH bpf-next v4 4/4] selftests/bpf: Add cases to test tailcall in freplace Leon Hwang
2024-10-01 11:14 ` [PATCH bpf-next v4 0/4] bpf: Fix tailcall infinite loop caused by freplace Eduard Zingerman
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=3d2ba1d054d73c53b205559ad5d89cef78d89303.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=hffilwlqm@gmail.com \
--cc=iii@linux.ibm.com \
--cc=kernel-patches-bot@fb.com \
--cc=leon.hwang@linux.dev \
--cc=martin.lau@kernel.org \
--cc=puranjay@kernel.org \
--cc=toke@redhat.com \
--cc=xukuohai@huaweicloud.com \
--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