From nobody Thu Sep 03 15:05:33 2026 X-Original-To: dev-commits-src-main@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 4hbNFb3kp8z6rP17 for ; Thu, 03 Sep 2026 15:05:39 +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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hbNFZ6zZbz43cJ for ; Thu, 03 Sep 2026 15:05:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1788447939; 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=Zkh08uh4L7HFCahqvM1Wt9qRrrlgI4WW8hiLNVAoDPs=; b=oSz+H9vmDPkqUIVk8mxDRfhS8R4YYgDnV9SkxtiI0l8bSRkRi38CH6DqHo8TkJHIrDXa4x Yki2u8u5GNDUe2J8t58M+aZbTzKVoB3fS/QUb1WesnX0Zb3Sqfrd5ab3S2Hpji2z2tcggU KIt6ln27ZdOemzMA/N1ER+93x8eOm9HTbbqmteGm3f4fiz+8otSvV4LeOY4cXblWk9TrE5 YTQ/OoM9NMaaOz3IJDo1SzskKVRmgVujAGOoxkKlwMjlP4G9D7mf4RFINTlEL4FNzTEyf4 qtrQHqnGV/qqw6Tmzvdg0w7DDOhr2w+y2E/S4I3dGShEWcqbsY3aVwnmS3TGOQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1788447939; a=rsa-sha256; cv=none; b=JcwAyHNOqyJ+t94Ubl8k1ohlThNSXn20esWHl+RUquGXT2ooUcTv+Xqkt8Xvr6Iakgx0bf 11fgx6ss+UWSNuJuko2rRd/opTLMiiK1o+ojxYNTw31Mx1ikMR2hjaeA3cF+LD0ZXQ0eIf 81CF38W8UI+EID3ZK/e5uDEB4TF117wpMWFBTa26s9FENvh12aF4ETdgCf8yM1yBwqnGSC /OF5lysNSLiYohOzWLvNXBbibeN7bsnQjuNxtIsEV6F/Xt1lG9oJkPWcz1UTreiRS3OUpQ JNTyOesfC8GJzTQe1yAm9MCEx7/EmTcQt0HnF0XdxEN6ZKQ99xGzqIx36SzboQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1788447939; 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=Zkh08uh4L7HFCahqvM1Wt9qRrrlgI4WW8hiLNVAoDPs=; b=hNzeqcSR/wG3sdBVfOqRReUgzQ8AxsM3jVrqZBZ8zO5v34PoVR610PyHaEx14Hf4ljgnde WOjus2aZWNHzUjKKnCy/XLc+XpUuMBH7P/m1pEXbOjJtBgZaQHqyqeUViBr0qhtFRwqqMA xQrcygpa/sSF6/IEnDT6IZhFeTXyIgwajOQorO+NB6kujTLOfgsvRwH7WcSn3J+EkttuA8 Mg1uzVpi/CTlQNKRCLBDK32JIJ6/p2H2OIRmmg6v623wiFPsC6oFSyZX9hMFKhxGhSPUAo NYC70MhipSoQi6geRZET1TlCmPFFagSdyk1hxGJsZAc3Lred8aWIJEJL0WTlQQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hbNFZ0yjMz3bL for ; Thu, 03 Sep 2026 15:05:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 300a9 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 03 Sep 2026 15:05:33 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Benjamin Jacobs From: Mark Johnston Subject: git: 3e6bc5c3b563 - main - sys/arm: Fix DTrace trap hook List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3e6bc5c3b5632ac9f55633b7d4e2e1a42b96a78b Auto-Submitted: auto-generated Date: Thu, 03 Sep 2026 15:05:33 +0000 Message-Id: <6a998cbd.300a9.368bc208@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3e6bc5c3b5632ac9f55633b7d4e2e1a42b96a78b commit 3e6bc5c3b5632ac9f55633b7d4e2e1a42b96a78b Author: Benjamin Jacobs AuthorDate: 2026-09-03 13:52:19 +0000 Commit: Mark Johnston CommitDate: 2026-09-03 15:05:03 +0000 sys/arm: Fix DTrace trap hook Move the dtrace_trap hook at the start of the abort handler to exit early when a trap is handled by DTrace. Fix the type argument to be the actual fault type instead of the value of the FAR. The latter will need to be added to the trapframe, until then DTrace will report unmapped addresses as the null address. Correct the comment of the PUSHFRAMEINSVC assembler macro to reflect that coming from SVC32 mode is expected for DTrace traps. PR: 298064 MFC after: 1 month Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D59279 --- sys/arm/arm/exception.S | 6 +++--- sys/arm/arm/trap-v6.c | 15 ++++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/sys/arm/arm/exception.S b/sys/arm/arm/exception.S index 2c25628f77cc..9df8e029385c 100644 --- a/sys/arm/arm/exception.S +++ b/sys/arm/arm/exception.S @@ -106,9 +106,9 @@ _C_LABEL(dtrace_invop_jump_addr): /* * PUSHFRAMEINSVC - macro to push a trap frame on the stack in SVC32 mode * This should only be used if the processor is not currently in SVC32 - * mode. The processor mode is switched to SVC mode and the trap frame is - * stored. The SVC lr field is used to store the previous value of - * lr in SVC mode. + * mode, except for data abort generated and handled by DTrace. + * The processor mode is switched to SVC mode and the trap frame is stored. + * The SVC lr field is used to store the previous value of lr in SVC mode. */ #define PUSHFRAMEINSVC \ stmdb sp, {r0-r3}; /* Save 4 registers */ \ diff --git a/sys/arm/arm/trap-v6.c b/sys/arm/arm/trap-v6.c index be7a10bb1f0a..60d716603f3f 100644 --- a/sys/arm/arm/trap-v6.c +++ b/sys/arm/arm/trap-v6.c @@ -328,6 +328,14 @@ abort_handler(struct trapframe *tf, int prefetch) return; } +#ifdef KDTRACE_HOOKS + if (!usermode) { + if (dtrace_trap_func != NULL && (*dtrace_trap_func)(tf, idx)) { + return; + } + } +#endif + /* * ARM has a set of unprivileged load and store instructions * (LDRT/LDRBT/STRT/STRBT ...) which are supposed to be used in other @@ -550,13 +558,6 @@ abort_fatal(struct trapframe *tf, u_int idx, u_int fsr, u_int far, #endif usermode = TRAPF_USERMODE(tf); -#ifdef KDTRACE_HOOKS - if (!usermode) { - if (dtrace_trap_func != NULL && (*dtrace_trap_func)(tf, far)) - return (0); - } -#endif - mode = usermode ? "user" : "kernel"; rw_mode = fsr & FSR_WNR ? "write" : "read"; disable_interrupts(PSR_I);