From nobody Fri Oct 30 14:05:46 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 4jGNDB5VP5z6wwQN for ; Fri, 30 Oct 2026 14:05:46 +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 4jGNDB4GJHz4pY8 for ; Fri, 30 Oct 2026 14:05:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793369146; 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=BpGrzRN/E+tZNV4mmcw7K368JPR2SFzhwocfsdcmIDk=; b=Vls1rqZvDsMf3BFyUmciQ7n7P+JDwxjNciTGt94aEDKu5W+qVxvtvW3mnEyBfS+w1ce/XD 0/Rhtog2ccGmXthVp3P0d+dMkwSbUbCzOu+fpoHRxEM1GI3lfqSSGFWHJofLd5gIicvAMs wm2+/akChBQ9CbmcAf3bsAH0e8QVwmUKfkaVPep4BPk3zScfdC11Kbo5GK7dHMeZ3QwyUz wkesKQuXO2BP9AxRh6tthwwL9k5a+F5csq4vOzxQ9LC/Xhf7Es93eXuQM+VHFb4SSHwcDd LfCl7v32vo+spCnDEvhUkpSX5Sd/74RR9PPLsteFEwqKldJbNY41LSetWgCnqA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1793369146; b=SQOwHJKnWWRmNSCbADoabiJwXbwSh/sdAzEX1ZrfzhMA6B7TsU39b/rhwSpNsiDsANipKs keuADRAXLUwW1p/LEGdiayIqVonH8e6hiN2+SyXpzrxQF7C6MAlJpbPFovcr43kA0N31yY 5L7v3GFuu6sIfzVNizcxXYtwKmJqQ4x7Fc6FB/SeHnjVA50J6atGmRRuHP9gVcbh4tpmGC XAa+PXp+nO2ZUnkFvS+wzu0iCMii8WxHEQGc500SEZBCY3xw3FjIILYwa1lHVwQ/lYMXqW zAZWOmIO80xJtoB7aDIJoDDxMaKqCCb5/ycK8QkBbzUaSrq8V5Erqysrg79ScQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793369146; 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=BpGrzRN/E+tZNV4mmcw7K368JPR2SFzhwocfsdcmIDk=; b=gbEJGBuoWlp98GFPklGC7NQp3i/8OzRgUofS0JJUmoHfa0xJqcUqL2IPHg5P0+oRQd5Xam OSEl8BiOxwzmU91ehIaG6EJlILdQKGOJXQJItjUQDYYnEv9IlzKko7Ob9ui4vQuvmTGigE dkemesNxg5uMQVQ1e5cdl2/6XcUUBZAXuvDZKQe/uAiXY2YhQrJA77uB6FjCSc9p9uZXq5 j3faeGIR/CAXT9EMRsNP1Geab+Y3AYzzyMNysO8dJcoYhKIuGiLFZU6c0nB9QS0puWiOv6 B4DCabSBdIBHaFRdIC79YjxrlAYtleJHL8mkfohcydua5Iz63ymecM3u5z2MWw== 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 4jGNDB32GmzV4k for ; Fri, 30 Oct 2026 14:05:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 22da6 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 30 Oct 2026 14:05:46 +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: 64cbdf1397e2 - stable/15 - 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/15 X-Git-Reftype: branch X-Git-Commit: 64cbdf1397e21a2984c71a9d81d3ca0b4fa75327 Auto-Submitted: auto-generated Date: Fri, 30 Oct 2026 14:05:46 +0000 Message-Id: <6ae4a43a.22da6.3770e710@gitrepo.freebsd.org> The branch stable/15 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=64cbdf1397e21a2984c71a9d81d3ca0b4fa75327 commit 64cbdf1397e21a2984c71a9d81d3ca0b4fa75327 Author: Nick Banks AuthorDate: 2026-09-02 14:28:54 +0000 Commit: Mitchell Horne CommitDate: 2026-10-30 14:04:07 +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 2903c25ef5c9..c32242a2bbb9 100644 --- a/sys/dev/hwpmc/hwpmc_x86.c +++ b/sys/dev/hwpmc/hwpmc_x86.c @@ -107,7 +107,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++;