Re: [PATCH] perf/core: Prevent duplicate sigtrap task work enqueue
From: Sebastian Andrzej Siewior
Date: Mon Nov 02 2026 - 15:07:27 EST
On 2026-10-31 11:45:20 [+0000], Tengda Wu wrote:
> The sigtrap handling in __perf_event_overflow() checks
> event->pending_work before calling task_work_add(), but only sets
> pending_work after the task work has been queued.
>
> This leaves a window where an NMI can interrupt task_work_add()
> and re-enter __perf_event_overflow() for the same event. Since
> pending_work is still zero, the nested invocation can enqueue
> the same pending_task again.
>
> The re-entrant call path is:
>
> __perf_event_overflow()
> task_work_add()
> kasan_record_aux_stack()
> <NMI>
> __perf_event_overflow()
> task_work_add()
How was the issue identified?
Sebastian