From nobody Tue Oct 7 21:50:20 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 AAA3323F299; Fri, 9 May 2025 16:51:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746809500; cv=none; b=pUogpEwpQ7P/xNqYWWUtdESOIT+aHiGazp5PXS1bT1FgnNI/nZdPSjksvoIY3VHo3SOUFJU8IiGEMSp59eHSW+8PwfQFhfBazaBBaMfIixS1bV4pO2i76zDud/eM+dlCi849octGxuyU/9CmPcmF/hkhKC+jYGH3MOL76Fps6EE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746809500; c=relaxed/simple; bh=6DE7KZOXrlLO0p0yUtPCwZQ+NilkphXCklG8RJnYqCw=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=h9FPeI+Qf8ggLPeWmWfsBaqNgQfCoBFhittW6h2HD+PuB6/xqxO/o/OLHXdk0rHMCEKbpKuEEtNvi+3oSEdQ6Q2wXCMkHUAzPUkuej3AgTFjO+cAAzs5//UxdiCbbXzB1BLRHrejMpTy27O08W9pOdk744rHPFPpikPnj7Dj9hQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 827E9C19421; Fri, 9 May 2025 16:51:40 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1uDQx2-00000002gKj-1DBk; Fri, 09 May 2025 12:51:56 -0400 Message-ID: <20250509165156.135430576@goodmis.org> User-Agent: quilt/0.68 Date: Fri, 09 May 2025 12:45:39 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org, x86@kernel.org Cc: Masami Hiramatsu , Mathieu Desnoyers , Josh Poimboeuf , Peter Zijlstra , Ingo Molnar , Jiri Olsa , Namhyung Kim Subject: [PATCH v8 15/18] perf: Have get_perf_callchain() return NULL if crosstask and user are set References: <20250509164524.448387100@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Josh Poimboeuf get_perf_callchain() doesn't support cross-task unwinding for user space stacks, have it return NULL if both the crosstask and user arguments are set. Signed-off-by: Josh Poimboeuf Signed-off-by: Steven Rostedt (Google) --- kernel/events/callchain.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/events/callchain.c b/kernel/events/callchain.c index b0f5bd228cd8..abf258913ab6 100644 --- a/kernel/events/callchain.c +++ b/kernel/events/callchain.c @@ -224,6 +224,10 @@ get_perf_callchain(struct pt_regs *regs, bool kernel, = bool user, struct perf_callchain_entry_ctx ctx; int rctx, start_entry_idx; =20 + /* crosstask is not supported for user stacks */ + if (crosstask && user) + return NULL; + entry =3D get_callchain_entry(&rctx); if (!entry) return NULL; @@ -249,9 +253,6 @@ get_perf_callchain(struct pt_regs *regs, bool kernel, b= ool user, } =20 if (regs) { - if (crosstask) - goto exit_put; - if (add_mark) perf_callchain_store_context(&ctx, PERF_CONTEXT_USER); =20 @@ -261,7 +262,6 @@ get_perf_callchain(struct pt_regs *regs, bool kernel, b= ool user, } } =20 -exit_put: put_callchain_entry(rctx); =20 return entry; --=20 2.47.2