Re: [PATCH 0/2] perf/hw_breakpoint: Fix breakpoint overcommit issue

From: Peter Zijlstra
Date: Wed Jul 10 2019 - 10:04:31 EST


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@xxxxxxxxxx/
>
> 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?