From: Oleg Nesterov <oleg@redhat.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: syzbot <syzbot+f7a1c2c2711e4a780f19@syzkaller.appspotmail.com>,
Andrii Nakryiko <andrii@kernel.org>,
jolsa@kernel.org, acme@kernel.org, adrian.hunter@intel.com,
alexander.shishkin@linux.intel.com, irogers@google.com,
kan.liang@linux.intel.com, linux-kernel@vger.kernel.org,
linux-perf-users@vger.kernel.org,
linux-trace-kernel@vger.kernel.org, mark.rutland@arm.com,
mhiramat@kernel.org, mingo@redhat.com, namhyung@kernel.org,
peterz@infradead.org, syzkaller-bugs@googlegroups.com,
bpf <bpf@vger.kernel.org>
Subject: Re: [syzbot] [perf?] KASAN: slab-use-after-free Read in __uprobe_unregister
Date: Mon, 12 Aug 2024 21:24:31 +0200 [thread overview]
Message-ID: <20240812192405.GD11656@redhat.com> (raw)
In-Reply-To: <CAEf4BzZ6coCZHY_KMnSQQUyc_-xziKurOQ0j3xaCvHhnDaafuQ@mail.gmail.com>
On 08/12, Andrii Nakryiko wrote:
>
> adding bpf ML, given it's bpf's code base
Thanks,
> On Mon, Aug 12, 2024 at 3:00 AM Oleg Nesterov <oleg@redhat.com> wrote:
> >
> > > --- a/kernel/trace/bpf_trace.c
> > > +++ b/kernel/trace/bpf_trace.c
> > > @@ -3491,8 +3491,10 @@ int bpf_uprobe_multi_link_attach(const union
> > > bpf_attr *attr, struct bpf_prog *pr
> > > }
> > >
> > > err = bpf_link_prime(&link->link, &link_primer);
> > > - if (err)
> > > + if (err) {
> > > + bpf_uprobe_unregister(&path, uprobes, cnt);
> >
> > I disagree. This code already uses the "goto error_xxx" pattern, why
>
> Well, if you have strong preferences,
Well, YES and NO ;) please see below.
> so be it (it's too trivial code
> to argue about).
Agreed. On a closer look both the code and the problem look very trivial.
But note that nobody noticed this trivial problem before. Including me who
had to change this trivial code to adapt to the recent API changes.
May be this means that we should keep the error handling in this function
more consistent ;)
> We do have quite a lot of "hybrid" error handling
And YES, I don't like this kind of error handling.
But, at the same time: NO, I never-never argue with the maintainers when it
comes to "cosmetic" issues.
My main point was (and you seem to agree) that this simpler patch above won't
simplify the routing. I too thought about the change above initially.
-------------------------------------------------------------------------------
> Yep, absolutely, given the bpf_uprobe_unregister() change, I don't see
> any problem for it to go together with your refactorings.
>
> For the fix:
>
> Acked-by: Andrii Nakryiko <andrii@kernel.org>
Thanks! I'll write the changelog and send this patch with your ack included
tomorrow.
Oleg.
next prev parent reply other threads:[~2024-08-12 19:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-10 20:17 [syzbot] [perf?] KASAN: slab-use-after-free Read in __uprobe_unregister syzbot
2024-08-11 12:14 ` Oleg Nesterov
2024-08-11 12:35 ` Oleg Nesterov
2024-08-12 4:20 ` Andrii Nakryiko
2024-08-12 10:00 ` Oleg Nesterov
2024-08-12 15:22 ` Andrii Nakryiko
2024-08-12 19:24 ` Oleg Nesterov [this message]
2024-08-12 20:00 ` Andrii Nakryiko
2024-08-11 12:58 ` Oleg Nesterov
2024-08-11 13:29 ` syzbot
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=20240812192405.GD11656@redhat.com \
--to=oleg@redhat.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=syzbot+f7a1c2c2711e4a780f19@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.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;
as well as URLs for NNTP newsgroup(s).