From: Peter Zijlstra <peterz@infradead.org>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Dmitry Vyukov <dvyukov@google.com>, Borislav Petkov <bp@suse.de>,
syzbot+370a6b0f11867bf13515@syzkaller.appspotmail.com,
Jiri Olsa <jolsa@redhat.com>, Ingo Molnar <mingo@kernel.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH 0/2] perf/hw_breakpoint: Fix breakpoint overcommit issue
Date: Thu, 11 Jul 2019 12:53:05 +0200 [thread overview]
Message-ID: <20190711105305.GY3402@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20190710153406.GA18838@lenoir>
On Wed, Jul 10, 2019 at 05:34:07PM +0200, Frederic Weisbecker wrote:
> On Wed, Jul 10, 2019 at 04:04:21PM +0200, Peter Zijlstra wrote:
> > On Tue, Jul 09, 2019 at 03:48:19PM +0200, Frederic Weisbecker wrote:
> > >
> > > Syzbot has found a breakpoint overcommit issue:
> > >
> > > https://lore.kernel.org/lkml/000000000000639f6a0584d11b82@google.com/
> > >
> > > It took me a long time to find out what the actual root problem was. Also
> > > its reproducer only worked on a few month old kernel but it didn't feel like
> > > the issue was actually solved.
> > >
> > > I eventually cooked a reproducer that works with latest upstream, see in
> > > the end of this message.
> > >
> > > The fix is just a few liner but implies to shut down the context swapping
> > > optimization for contexts containing breakpoints.
> > >
> > > Also I feel like uprobes may be concerned as well as it seems to make use
> > > of event.hw->target after pmu::init().
> >
> > Can't we simply swizzle event.hw->target along too?
>
> You mean remove it? But it's still needed by breakpoint code during all the event
> lifecycle (init, destroy and anytime in-between).
No, I meant flip hw->target when we flip the context. It would mean
iterating the events, which I suppose would suck.
> I wish we could use event->ctx->task instead but on pmu::init() there
> is no ctx yet (we could pass the task in parameter though)
Right, that should be fairly easy.
> and on event->destroy() it's TASK_TOMBSTONE and retrieving the task at
> that time would be non trivial.
Well, right, we can maybe make TOMBSTONE be the LSB instead of the whole
word, then we can recover the task pointer... *yuck* though.
next prev parent reply other threads:[~2019-07-11 10:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-09 13:48 [PATCH 0/2] perf/hw_breakpoint: Fix breakpoint overcommit issue Frederic Weisbecker
2019-07-09 13:48 ` [PATCH 1/2] perf: Allow a pmu to pin context Frederic Weisbecker
2019-07-09 13:48 ` [PATCH 2/2] perf/hw_breakpoints: Pin perf contexts of breakpoints Frederic Weisbecker
2019-07-10 14:04 ` [PATCH 0/2] perf/hw_breakpoint: Fix breakpoint overcommit issue Peter Zijlstra
2019-07-10 15:34 ` Frederic Weisbecker
2019-07-11 10:53 ` Peter Zijlstra [this message]
2019-07-15 12:47 ` Peter Zijlstra
2019-07-16 13:42 ` Frederic Weisbecker
2019-07-16 13:50 ` Peter Zijlstra
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=20190711105305.GY3402@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=acme@kernel.org \
--cc=bp@suse.de \
--cc=dvyukov@google.com \
--cc=frederic@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=syzbot+370a6b0f11867bf13515@syzkaller.appspotmail.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