lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 14 Nov 2020 19:49:31 +0100
From:   Florian Lehner <dev@...-flo.net>
To:     Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc:     acme@...nel.org, andrii@...nel.org, ast@...nel.org,
        bpf@...r.kernel.org, daniel@...earbox.net,
        john.fastabend@...il.com, linux-kernel@...r.kernel.org,
        mingo@...hat.com, netdev@...r.kernel.org, peterz@...radead.org
Subject: Re: [PATCH bpf,perf]] bpf,perf: return EOPNOTSUPP for attaching bpf
 handler on PERF_COUNT_SW_DUMMY

On Sat, Nov 14, 2020 at 08:07:29AM -0800, Alexei Starovoitov wrote:
> On Sat, Nov 14, 2020 at 5:53 AM Florian Lehner <dev@...-flo.net> wrote:
> >
> > At the moment it is not possible to attach a bpf handler to a perf event
> > of type PERF_TYPE_SOFTWARE with a configuration of PERF_COUNT_SW_DUMMY.
> 
> It is possible or it is not possible?
> 
> Such "commit log as an abstract statement" patches are a mystery to a reader.
> Please explain what problem you're trying to solve and how it's being addressed.

Perf events of type software/dummy are just placeholder events and don't
require a counting event. So attaching the bpf handler to the
overflow_handler of this event does not trigger the execution of the bpf
handler.
So the idea of this fix was to indicate to the user that attaching a bpf
handler to such a perf event is not (yet) supported.

> > Signed-off-by: Florian Lehner <dev@...-flo.net>
> > ---
> >  kernel/events/core.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/kernel/events/core.c b/kernel/events/core.c
> > index da467e1dd49a..4e8846b7ceda 100644
> > --- a/kernel/events/core.c
> > +++ b/kernel/events/core.c
> > @@ -9668,6 +9668,10 @@ static int perf_event_set_bpf_handler(struct perf_event *event, u32 prog_fd)
> >         if (event->prog)
> >                 return -EEXIST;
> >
> > +       if (event->attr.type == PERF_TYPE_SOFTWARE &&
> > +           event->attr.config == PERF_COUNT_SW_DUMMY)
> > +               return -EOPNOTSUPP;
> 
> Is it a fix or a feature?
> If it is a fix please add 'Fixes:' tag.

I was not sure how to address it and so I have chosen PATCH. As bpf
handlers are still not executed on such events, I also would not call it
a feature.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ