From: Yonghong Song <yonghong.song@linux.dev>
To: Song Liu <song@kernel.org>
Cc: Dmitry Dolgov <9erthalion6@gmail.com>,
bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
andrii@kernel.org, martin.lau@linux.dev,
dan.carpenter@linaro.org
Subject: Re: [RFC PATCH bpf-next v2] bpf: Relax tracing prog recursive attach rules
Date: Sat, 25 Nov 2023 17:05:17 -0800 [thread overview]
Message-ID: <31aed971-6b0e-4cce-a2e1-d9fa2c27c9c5@linux.dev> (raw)
In-Reply-To: <CAPhsuW7K37n+5XWc2eKVhVA-V+Pd=NmLBN7hnowOpC0hNaCzgg@mail.gmail.com>
On 11/25/23 3:40 PM, Song Liu wrote:
> On Sat, Nov 25, 2023 at 11:55 AM Yonghong Song <yonghong.song@linux.dev> wrote:
>>
>> On 11/24/23 4:16 PM, Dmitry Dolgov wrote:
>>>> On Thu, Nov 23, 2023 at 11:24:34PM -0800, Song Liu wrote:
>>>>> Following the corresponding discussion [1], the reason for that is to
>>>>> avoid tracing progs call cycles without introducing more complex
>>>>> solutions. Relax "no same type" requirement to "no progs that are
>>>>> already an attach target themselves" for the tracing type. In this way
>>>>> only a standalone tracing program (without any other progs attached to
>>>>> it) could be attached to another one, and no cycle could be formed. To
>>>> If prog B attached to prog A, and prog C attached to prog B, then we
>>>> detach B. At this point, can we re-attach B to A?
>>> Nope, with the proposed changes it still wouldn't be possible to
>>> reattach B to A (if we're talking about tracing progs of course),
>>> because this time B is an attachment target on its own.
>> IIUC, the 'prog B attached to prog A, and prog C attached to prog B'
>> not really possible.
>> After prog B attached to prog A, we have
>> prog B follower_cnt = 1
>> prog A attach_depth = 1
> I think prog A has follower_cnt=1, while prog B has follow_cnt=0, no?
I checked bpf_tracing_prog_attach() again. Yes, I made a dumb mistake
and indeed
After prog B attached to prog A, we should have
prog A follower_cnt = 1 and prog B attach_depth = 1
>
> Thanks,
> Song
>
>> Then prog C wants to attach to prog B,
>> since we have prog B follower_cnt = 1, then attaching will fail.
>>
>> If we do have A <- B <- C chain by
>> first prog C attached to prog B, and then prog B attached to A
>> now we have
>> prog B/C follower_cnt = 1
>> prog A/B attach_depth = 1
>> after detaching B from A, we have
>> prog B follower_cnt = 0
>> prog A attach_depth = 0
>>
>> In this particular case, prog B attaching to prog A should succeed
>> since prog B follower_cnt = 0.
>>
>> Did I miss anything?
>>
>> In the commit message, 'falcosecurity libs project' is mentioned as a use
>> case for chained fentry/fexit bpf programs. I think you should expand the
>> use case in more details. It is possible with use case description, people
>> might find better/alternative solutions for your use case.
>>
>> Also, if you can have a test case to exercise your commit logic,
>> it will be even better.
[...]
next prev parent reply other threads:[~2023-11-26 1:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-22 19:18 [RFC PATCH bpf-next v2] bpf: Relax tracing prog recursive attach rules Dmitrii Dolgov
2023-11-23 14:25 ` Jiri Olsa
2023-11-23 19:49 ` Dmitry Dolgov
2023-11-24 7:24 ` Song Liu
2023-11-24 21:16 ` Dmitry Dolgov
2023-11-25 19:55 ` Yonghong Song
2023-11-25 20:40 ` Song Liu
2023-11-26 1:05 ` Yonghong Song [this message]
2023-11-25 20:39 ` Song Liu
2023-11-25 20:46 ` Song Liu
2023-11-25 21:01 ` Dmitry Dolgov
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=31aed971-6b0e-4cce-a2e1-d9fa2c27c9c5@linux.dev \
--to=yonghong.song@linux.dev \
--cc=9erthalion6@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=daniel@iogearbox.net \
--cc=martin.lau@linux.dev \
--cc=song@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