From: Jiri Olsa <olsajiri@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Jiri Olsa <olsajiri@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
andrii@kernel.org, yhs@fb.com, linux-kernel@vger.kernel.org,
daniel@iogearbox.net, sean@mess.org, bpf <bpf@vger.kernel.org>
Subject: Re: perf_event_detach_bpf_prog() broken?
Date: Wed, 23 Oct 2024 10:19:38 +0200 [thread overview]
Message-ID: <ZxixmhdyhGSt1_Jx@krava> (raw)
In-Reply-To: <CAEf4Bzbp-LxpFR5Ue6YTfana5ST+sHMLi_zxS9Ax3uR7bXpuNA@mail.gmail.com>
On Tue, Oct 22, 2024 at 10:33:37AM -0700, Andrii Nakryiko wrote:
> + bpf ML
>
> On Tue, Oct 22, 2024 at 7:03 AM Jiri Olsa <olsajiri@gmail.com> wrote:
> >
> > On Tue, Oct 22, 2024 at 01:16:38PM +0200, Peter Zijlstra wrote:
> > > Hi guys,
> > >
> > > Per commit 170a7e3ea070 ("bpf: bpf_prog_array_copy() should return
> > > -ENOENT if exclude_prog not found") perf_event_detach_bpf_prog() can now
> > > return without doing bpf_prog_put() and leaving event->prog set.
> > >
> > > This is very 'unexpected' behaviour.
> > >
> > > I'm not sure what's sane from the BPF side of things here, but leaving
> > > event->prog set is really rather unexpected.
> > >
> > > Help?
> >
> > IIUC the ENOENT should never happen in perf event context, so not
>
> yep, if it does return an error it's a bug, right? So we can add
> WARN_ONCE() or just drop the check, probably.
I'm now more inclined to have the WARN there, because it's possible
return value of bpf_prog_array_copy .. I'll send the patch and let's
discuss over the change
jirka
>
> > sure why we have that check.. also does not seem to be used from
> > lirc code, Sean?
> >
> > perf_event_detach_bpf_prog is called when the event is being freed
> > so I think we should always put and clear the event->prog
> >
> > jirka
prev parent reply other threads:[~2024-10-23 8:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-22 11:16 perf_event_detach_bpf_prog() broken? Peter Zijlstra
2024-10-22 14:03 ` Jiri Olsa
2024-10-22 14:12 ` Sean Young
2024-10-22 21:08 ` Jiri Olsa
2024-10-22 17:33 ` Andrii Nakryiko
2024-10-23 8:19 ` Jiri Olsa [this message]
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=ZxixmhdyhGSt1_Jx@krava \
--to=olsajiri@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=sean@mess.org \
--cc=yhs@fb.com \
/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