From nobody Wed Nov 04 17:40:07 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4jKXlC5hpTz6yZpG for ; Wed, 04 Nov 2026 17:40:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jKXlC4Hp6z50lB for ; Wed, 04 Nov 2026 17:40:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793814007; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tTgE2XOd/+VTGcM9ReGjSfxKvXlYPQ8bzvq+gPTiFeY=; b=mW8UD8PpEnzVm/w/q6U3gldaio8xW4PSy5G8zd98TZt6GJs3+dO2U57iw+wW86ZYkFsrWx gVdiFL3VuHh3dT+sGeAim+g7gUcG7MtLxcMWqEOCogYn4VDbVuWWcv9A2HFCZs8123usbn aqOM7MbovR0x6KPCcIlos+jg5xS3LMY3jRxIpqdAlxeky1w12kMmx4gkCPzPaed3XIeqJG eNf6jtBvPa34qlk8xb15DRSy1YiN14g4ue+tWc/zQlMIhSldOKQfjNmGQ6yUkEHuwIXilm 4pOSsCKhsQTB+59YI9f+mzdq2cIQpA1Su5l3tG2qQs/c4DtxBowWz0P7m4h1pg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1793814007; b=G7CDw5Km+WvUUDvD613fINcSez2YD+m8efMaybM6vF8nNssRrCBft7k0WqESKOcrMioKQl 4LCu/z/JslB/RgWmPybc+vfz8bqzXZUbmpOrajgR9A2e3zbSVWH9A8J7r4B+jg+TFIX8GW mwXuZLXvQoO5jH+n7P3eAGif4WFPQj3vc1se6DCU2uRfgGSgYkRCrQ31A/5kvffigtlhAD t48gUiOfRore3gjqvocWHVvmQzreTgrQCl8pw6A6BXpuOg/V3QUkUZgzIQU0PD2vPesUp4 nBRH/C/RgSHEgybRh96B6U5Q/wT4f6KNG4N/NVHmtSYGt3NIN1J4Oruw8h3Ajw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793814007; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tTgE2XOd/+VTGcM9ReGjSfxKvXlYPQ8bzvq+gPTiFeY=; b=OZzBODcNnjty2dHuG6pRC8Vilr7AaPhq4CK8szKZyt5fi4kk0pizlRtzpW95/REERQePJU 0OkD8K0rAed/9GNoOPdV+KlhIY+Kynvs4RliDE3byzSzkXdsD4f7FoaPHNxsmcJ4c2XQye 2SJbRDJ8SJUp9D8Gf+TmoQjSS9ErLqNuJItW2gYoBf+6m1kBRNPSKY0875lrVcLMs/6wUh OlN6xaWX+KkT01pQITsh9cCDegxxnRg+daDjkJsGGj1WoaMO29qwTf7FwWd4uZPpIoBpZb 4XNPKBmsASOfFf3ln3MS1xBkiZwETswMScubZVJq6Dud8sON/Oj49dgpg6TDxQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jKXlC3wsQz1CL7 for ; Wed, 04 Nov 2026 17:40:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2694d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 04 Nov 2026 17:40:07 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Nick Banks From: Mitchell Horne Subject: git: 32beb16881ad - stable/14 - hwpmc(4): stop overwalking past _start on amd64 user callchains List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 32beb16881adfc137fe7cc07b3a86a535e0b3ed2 Auto-Submitted: auto-generated Date: Wed, 04 Nov 2026 17:40:07 +0000 Message-Id: <6aeb6df7.2694d.485c58f2@gitrepo.freebsd.org> The branch stable/14 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=32beb16881adfc137fe7cc07b3a86a535e0b3ed2 commit 32beb16881adfc137fe7cc07b3a86a535e0b3ed2 Author: Nick Banks AuthorDate: 2026-09-02 14:28:54 +0000 Commit: Mitchell Horne CommitDate: 2026-11-04 17:36:03 +0000 hwpmc(4): stop overwalking past _start on amd64 user callchains pmc_save_user_callchain() emits the pc it just loaded before checking whether fp is the ABI's zero frame-chain terminator. At the bottom of a well-formed chain under _start, fp comes back 0 as expected, but the paired pc is stale rtld data left on the stack -- a legal userspace VA that still passes PMC_IN_USERSPACE(), so it gets emitted as a bogus extra frame. This shows up in flame graphs as a spurious hex-valued root frame below _start. Check fp == 0 alongside the existing checks before emitting, matching how arm/arm64/powerpc already load the next fp before their check. Measured via 1kHz hwpmc sampling on an OCA: stacks with any unresolved hex frame drop from 23.9% to 1.3%, and stacks with hex at the root drop from 5.5% to 0.3%. Reviewed by: mhorne, Ali Mashtizadeh , gallatin MFC after: 3 days Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D59229 (cherry picked from commit 1db0c9fa7a32255c452c2536d657e63b55e30e03) --- sys/dev/hwpmc/hwpmc_x86.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/hwpmc/hwpmc_x86.c b/sys/dev/hwpmc/hwpmc_x86.c index d6ffa5270bbb..595ad0079f9b 100644 --- a/sys/dev/hwpmc/hwpmc_x86.c +++ b/sys/dev/hwpmc/hwpmc_x86.c @@ -108,7 +108,8 @@ pmc_save_user_callchain(uintptr_t *cc, int nframes, struct trapframe *tf) return (n); for (; n < nframes;) { - if (pc == 0 || !PMC_IN_USERSPACE(pc)) + /* fp == 0 is the ABI frame-chain sentinel below _start. */ + if (pc == 0 || !PMC_IN_USERSPACE(pc) || fp == 0) break; *cc++ = pc; n++;