powerpc/hw_breakpoint: Avoid relying on caller synchronization
authorMarco Elver <elver@google.com>
Mon, 29 Aug 2022 12:47:14 +0000 (14:47 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 30 Aug 2022 08:56:23 +0000 (10:56 +0200)
commitf95e5a3d59011eec1257d0e76de1e1f8969d426f
tree7006acea7638507594b1f481bae7f91dcec29d94
parent24198ad373ad1e30b638aa147142dc21ab5757e7
powerpc/hw_breakpoint: Avoid relying on caller synchronization

Internal data structures (cpu_bps, task_bps) of powerpc's hw_breakpoint
implementation have relied on nr_bp_mutex serializing access to them.

Before overhauling synchronization of kernel/events/hw_breakpoint.c,
introduce 2 spinlocks to synchronize cpu_bps and task_bps respectively,
thus avoiding reliance on callers synchronizing powerpc's hw_breakpoint.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Dmitry Vyukov <dvyukov@google.com>
Acked-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20220829124719.675715-10-elver@google.com
arch/powerpc/kernel/hw_breakpoint.c