Re: [Syzkaller & bisect] There is "__perf_event_overflow" WARNING in v6.1-rc5 kernel in guest
From: Peter Zijlstra
Date: Wed Nov 23 2022 - 10:06:33 EST
On Wed, Nov 23, 2022 at 04:05:14PM +0100, Peter Zijlstra wrote:
> @@ -9330,7 +9350,7 @@ static int __perf_event_overflow(struct
> }
>
> event->pending_addr = 0;
> - if (data->sample_flags & PERF_SAMPLE_ADDR)
> + if (valid_sample && (data->sample_flags & PERF_SAMPLE_ADDR))
> event->pending_addr = data->addr;
> irq_work_queue(&event->pending_irq);
> }
That is the result of this patch; also found in that branch:
---
Subject: perf: Fixup SIGTRAP and sample_flags interaction
From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Date: Mon Nov 21 15:57:44 CET 2022
The perf_event_attr::sigtrap functionality relies on data->addr being
set. However commit 7b0846301531 ("perf: Use sample_flags for addr")
changed this to only initialize data->addr when not 0.
Fixes: 7b0846301531 ("perf: Use sample_flags for addr")
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
---
kernel/events/core.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -9328,7 +9328,10 @@ static int __perf_event_overflow(struct
*/
WARN_ON_ONCE(event->pending_sigtrap != pending_id);
}
- event->pending_addr = data->addr;
+
+ event->pending_addr = 0;
+ if (data->sample_flags & PERF_SAMPLE_ADDR)
+ event->pending_addr = data->addr;
irq_work_queue(&event->pending_irq);
}