From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D85543ABD99; Sat, 17 Oct 2026 16:58:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792256283; cv=none; b=i/zkywNip+XEJsEeG3DrbLacsjltenH91YSmj9Y+nlTRmVpqT5N3ZqBb6htn0nQAHfup1dSao2NJn3IoJCZTClLlE7XKBW+KauVZV/lczuO8ZbypWd2uaJoyYtx4RGC0W5n8HB2RBHe9CDSl/GpPdF4wYydh65bd4qhnute37x4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792256283; c=relaxed/simple; bh=repg6KFIXhdReQkt/L9jc243+R3HtA/Kjg/HmvuXOaE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pT0tqSWsThZ8LHoZsUxn8mh2UGjP38rhU7jUZ+AD9+LZIj7sER9CCp15k4lGST1oSch8vveLH9TTOzM/p4TgDUAHoOD2uhqsUVXiw1gfMBMu/sklqBNLdQac5nSeCRpPH4g2LiTbcCIM3rke88NsbHn9Hslm9qfqASbf2UyFwQA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=WtBaloaB; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="WtBaloaB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6594A1F000C4; Sat, 17 Oct 2026 16:58:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1792256282; bh=rgWABQwpAs4nE8yP22dGCnWtZRaAYufemOzZHVQQOIc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WtBaloaB5YKHfTkjBskwv0tN8bv1sGyVe8YLxkkycRtTTs1uD/Cg9vdnnltG9+Se8 DPAY7jWBBJTaupafWXZFsvk5NBkb+wQlsFZOsrTMkswcqgo5T+XApCG2lstB7bEWvI 6TPyGJxYncjctvG0Q8BIH24pqFIIUmxlwOKh3ztQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot , Tetsuo Handa , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 6.6 0185/1674] perf/core: Fix WARN in perf_sigtrap() Date: Sat, 17 Oct 2026 17:40:57 +0200 Message-ID: <20261017160435.897416261@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261017160431.119607952@linuxfoundation.org> References: <20261017160431.119607952@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tetsuo Handa [ Upstream commit 3da6bb419750f3ad834786d6ba7c9d5d062c770b ] Since exit_task_work() runs after perf_event_exit_task_context() updated ctx->task to TASK_TOMBSTONE, perf_sigtrap() from perf_pending_task() might observe event->ctx->task == TASK_TOMBSTONE. Swap the early exit tests in order not to hit WARN_ON_ONCE(). Closes: https://syzkaller.appspot.com/bug?extid=2fe61cb2a86066be6985 Reported-by: syzbot Signed-off-by: Tetsuo Handa Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/b1c224bd-97f9-462c-a3e3-125d5e19c983@I-love.SAKURA.ne.jp Signed-off-by: Sasha Levin --- kernel/events/core.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index ced90b65e76a4..45f439ba7cbfc 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -6808,18 +6808,18 @@ void perf_event_wakeup(struct perf_event *event) static void perf_sigtrap(struct perf_event *event) { /* - * We'd expect this to only occur if the irq_work is delayed and either - * ctx->task or current has changed in the meantime. This can be the - * case on architectures that do not implement arch_irq_work_raise(). + * Both perf_pending_task() and perf_pending_irq() can race with the + * task exiting. */ - if (WARN_ON_ONCE(event->ctx->task != current)) + if (current->flags & PF_EXITING) return; /* - * Both perf_pending_task() and perf_pending_irq() can race with the - * task exiting. + * We'd expect this to only occur if the irq_work is delayed and either + * ctx->task or current has changed in the meantime. This can be the + * case on architectures that do not implement arch_irq_work_raise(). */ - if (current->flags & PF_EXITING) + if (WARN_ON_ONCE(event->ctx->task != current)) return; send_sig_perf((void __user *)event->pending_addr, -- 2.53.0