From nobody Tue Oct 10 14:39:56 2023 X-Original-To: dev-commits-src-branches@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 4S4dpj0fsTz4wrCJ; Tue, 10 Oct 2023 14:39:57 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S4dpj06xTz4Rfl; Tue, 10 Oct 2023 14:39:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696948797; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=viiBWvS+z993e/PlZaUYCtJLIjMohe8rIzAiUpSMZGw=; b=AMhXEAsQRU/bJ+xnLh/cAz0cUtdAfV526qd41oxNILG/5tWN01VsAAi8OeZ5Ee8NuggKKf ryXFCW6ZXCx5MBUFe3jbr3z7oK0s49fQez3k5aClBka3y9PRRJANMcdHYgJurPBdFH6ZWN WSyS5gLA+LCE63szHjkdLEzl2CNcYAsYLtTcVh34OKDyqyN5Kmpp1+T9mnn7znlnL81Ky5 g38q92UOfYCMY6m6g40V0ig6QkSfJwiXfJyd14rgwXM8jVZih0kzYs1Go7wyZMv8w8+Fsk CJs0ltRYrYOIYbYNGcigISQMo8SOvHdor/f6qj/1U9ROH0BcVSISPoGZtWOaAw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696948797; a=rsa-sha256; cv=none; b=Iza7AB/8sYkFNgWhle2XqstgRKtoVZmaHPCI/bgdTqxEQx5ybO/etBB9gNEy9zzvtQpf57 q2UjP1wtC6SNdHfBMrWIsnyv74ojhOuXXEPKdck+tfbY9UmsfA2MMKhXxua6FML4nzSFxr QbqUaQx5e68evOZiPYcFayQFAP7h2i2g17CkaT1DKnGtrOBpAqtDBPWAkATKcss7753EAg IMsjAO14HJ+WB0vOx9MlxNashrAcoImnDi9nEqS1P38QKAxWJ4IUYXUa9M1IFcb+7imt9k cEjB28w/AqVf4j2jIGtlXr+Rv3NRDi434Uo6eFSwnSrvX/i+NWSO1iW8FgYFdA== 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=1696948797; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=viiBWvS+z993e/PlZaUYCtJLIjMohe8rIzAiUpSMZGw=; b=pZj9wcumSRJCsi4xmlj97RIY8ivzVxOy0x9+4THpRhEZXvfJ940Oo69mQSzSe5igi/PqP+ NS2QDSAfNqS2RkXSiydQ8UmLqv4wl+w7R3GVVEG505AwcOGzMH5qAv1hibFYRGs/adtNGg 16eKOrEeM8aRidpvMG9ZjdoDLMsyVxw7B6nTG+ZltTyOg6FMb+fPYS/PaLF0UGVEH4Xsk3 jDx2I8pd8i1k1LXXaiFz2n+5oWNoHya/Or8IbSt3S/BAQTjhakUq1qGQgTXU7jlSypSV9U +yiN4qccgksLZmszPKhFt2SHWAM/j9Y8rw8/5+QN54zs5RFEo5qA+qlS1jligg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4S4dph6H9Tzj1s; Tue, 10 Oct 2023 14:39:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39AEduRI005979; Tue, 10 Oct 2023 14:39:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39AEdu2f005976; Tue, 10 Oct 2023 14:39:56 GMT (envelope-from git) Date: Tue, 10 Oct 2023 14:39:56 GMT Message-Id: <202310101439.39AEdu2f005976@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 21169ec5a219 - releng/14.0 - dtrace: fix fbt regression for aarch64 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org 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/releng/14.0 X-Git-Reftype: branch X-Git-Commit: 21169ec5a219f5fcec4c98649706f024d8bfe75f Auto-Submitted: auto-generated The branch releng/14.0 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=21169ec5a219f5fcec4c98649706f024d8bfe75f commit 21169ec5a219f5fcec4c98649706f024d8bfe75f Author: Igor Ostapenko AuthorDate: 2023-10-03 16:48:00 +0000 Commit: Mark Johnston CommitDate: 2023-10-10 14:39:44 +0000 dtrace: fix fbt regression for aarch64 fbt computes incorrect instruction position for AArch64 kernel module symbol. The issue is with the for loop, it does an extra increment of instr pointer after the required instruction is found. Hence, a wrong instruction is targeted for patching. Signed-off-by: Igor Ostapenko Approved by: re (gjb) Fixes: 980746e5cb26 ("fbt: simplify arm64 function-prologue parsing") Reviewed by: markj Pull Request: https://github.com/freebsd/freebsd-src/pull/855 MFC after: 1 week (cherry picked from commit b4db386f9fa7be9668aa09d14b0bbd048a7a7e89) (cherry picked from commit 2ba605f32ac3c673ef0f0bee810a2696f1887488) --- sys/cddl/dev/fbt/aarch64/fbt_isa.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/sys/cddl/dev/fbt/aarch64/fbt_isa.c b/sys/cddl/dev/fbt/aarch64/fbt_isa.c index 4094ea43a9fe..44690b97f77a 100644 --- a/sys/cddl/dev/fbt/aarch64/fbt_isa.c +++ b/sys/cddl/dev/fbt/aarch64/fbt_isa.c @@ -90,7 +90,6 @@ fbt_provide_module_function(linker_file_t lf, int symindx, uint32_t *instr, *limit; const char *name; char *modname; - bool found; int offs; modname = opaque; @@ -119,16 +118,16 @@ fbt_provide_module_function(linker_file_t lf, int symindx, if ((*instr & BTI_MASK) == BTI_INSTR) instr++; - /* Look for stp (pre-indexed) operation */ - found = false; /* * If the first instruction is a nop it's a specially marked * asm function. We only support a nop first as it's not a normal * part of the function prologue. */ if (*instr == NOP_INSTR) - found = true; - for (; !found && instr < limit; instr++) { + goto found; + + /* Look for stp (pre-indexed) or sub operation */ + for (; instr < limit; instr++) { /* * Functions start with "stp xt1, xt2, [xn, ]!" or * "sub sp, sp, ". @@ -142,14 +141,14 @@ fbt_provide_module_function(linker_file_t lf, int symindx, * past the function prologue. */ if (((*instr >> ADDR_SHIFT) & ADDR_MASK) == 31) - found = true; + break; } else if ((*instr & SUB_MASK) == SUB_INSTR && ((*instr >> SUB_RD_SHIFT) & SUB_R_MASK) == 31 && ((*instr >> SUB_RN_SHIFT) & SUB_R_MASK) == 31) - found = true; + break; } - - if (!found) +found: + if (instr >= limit) return (0); fbt = malloc(sizeof (fbt_probe_t), M_FBT, M_WAITOK | M_ZERO);