From: Masami Hiramatsu (Google) <[email protected]> To fix arm64 repeating watchpoint exception on the same instruction bug, markthe wprobe handler as compatible with the default overflow handler.
Since do_watchpoint() on arm64 does not configure the single step execution correctly if the overflow_handler is not compatible with default perf overflow handlers, custom handler will loop on the same instruction by repeating watchpoint exception. But if the overflow handler is compatible with the default handlers, it configures the single step. So set the compatible flag since wprobe_handler will not care arch-dependent case. Reported-by: Mark Brown <[email protected]> Closes: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Masami Hiramatsu (Google) <[email protected]> --- kernel/trace/trace_wprobe.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/trace/trace_wprobe.c b/kernel/trace/trace_wprobe.c index 98605b207f43..f2c2f26fd668 100644 --- a/kernel/trace/trace_wprobe.c +++ b/kernel/trace/trace_wprobe.c @@ -163,6 +163,8 @@ static void wprobe_perf_handler(struct perf_event *bp, static int __register_trace_wprobe(struct trace_wprobe *tw) { struct perf_event_attr attr; + struct perf_event *bp; + int cpu; if (tw->bp_event) return -EINVAL; @@ -179,6 +181,11 @@ static int __register_trace_wprobe(struct trace_wprobe *tw) tw->bp_event = NULL; return ret; } + /* Mark wprobe_perf_handler is compatible with default one. */ + for_each_online_cpu(cpu) { + bp = per_cpu(*tw->bp_event, cpu); + bp->default_overflow_compatible = true; + } return 0; }
