From nobody Wed Jan 15 17:26:57 2025 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 4YYCbk0Q39z5kPy7; Wed, 15 Jan 2025 17:26:58 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYCbj72Ncz469W; Wed, 15 Jan 2025 17:26:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736962018; 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=3BTqho66k5UvZ6kGUjCIF+u3h8KjhahqiVrhgUDguR8=; b=tbqIoPUrx58jq7A/vErye8WmmxlxB4u/MjCVxyie9jK1IyPW56DrbwdzM7KwbvwPNcPQcN IjW9avs7wEof6K0PmHmY9cvSde3UdUNUoG/4Z4kstpfy0B8iuuyAfhHhgCMhD0e1/oxpg/ vfvihvWZGKl+lhLJhiwSOl7eGJAawOZJFe8QOxoC6y2bmKyolAXM2vLr/iVDEfvim0xdp1 S1KGeeoyjisGUVfcY5oId/tgyMBtOpXmaXrC3vaUg4FIBXQ8m4I4oPU+KCaojLH9wf+mFm ppWULlV9RL4hDliNeS7NTycfkOrJDhqXvu5bPNq2v5EwgwN8H0Q9UeiBQRanOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736962018; 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=3BTqho66k5UvZ6kGUjCIF+u3h8KjhahqiVrhgUDguR8=; b=A14/ZGDLzdSB6KG2MlpHiJ1dBZ8IXryUcmND1lkcC2YRFaz0gbneEolH/fIUPfMjfWCF5A 7vnP4CGPuebZUQamaGmrh9duQxJCSUDhla4PXrbLbJM3dUawy/VMz60lfblS4XVJjpaJSH UW0OO5fSaalyNIuURQsWeva2c2mMduhRPBGT5dwiT2VExpOTL+rvS+xbKwP9whcSd4Iv1H cc7b8fcX1d/gnTG4mxX1FrAGZUhZGp7KmOfxhhUKUtY+MoI4dUyV3AVIKG5O6nlMnkYBAe LKc7/Uy9b62Na7Dw+/IoTLwjSD1tAELLPOegkVs7i10rpr4bFwjTq+0cIc2d+Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736962018; a=rsa-sha256; cv=none; b=cftiZEia1RRujaa98QsYNXc1aV8S4nmkEijyiHBsipQbF1IMp52kNOL7H8EdLJc7KnxqQ3 TGz7tzdU+wQnzENDECdwjfA1EJLXqB12Mw1eOHuvLZzotH3WUGUhePpZfWNVgkR997Epda XByc0/b7PyQkFISjWGcT2pP6E6AcQkucrhdS41mU55ZMtrlV9hTh3ClnB/oCSw7ht8ts5m JEUu2GC0+brFXKhMUsW0oYp3Kf8bqWAKIQh0A/nXLzVxlw0WR4T6jL8E4byTD9A7dJLMv5 KB8DfywW7CVJWIx/1IYIW+s8sR8EUO7jvWAPYKcIeidcdd6PmszQwY/S6vfvWg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YYCbj6DJpzwYK; Wed, 15 Jan 2025 17:26:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50FHQvHH015955; Wed, 15 Jan 2025 17:26:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50FHQvb0015952; Wed, 15 Jan 2025 17:26:57 GMT (envelope-from git) Date: Wed, 15 Jan 2025 17:26:57 GMT Message-Id: <202501151726.50FHQvb0015952@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: 2c5fbcff0717 - stable/14 - libdtrace: Be less strict when comparing pointer types List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 2c5fbcff0717ab7586a5862a76b8692503662efa Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2c5fbcff0717ab7586a5862a76b8692503662efa commit 2c5fbcff0717ab7586a5862a76b8692503662efa Author: Mark Johnston AuthorDate: 2024-12-31 19:25:52 +0000 Commit: Mark Johnston CommitDate: 2025-01-15 17:10:57 +0000 libdtrace: Be less strict when comparing pointer types If one of two pointers refers to a forward declaration, let the pointers be compatible so long as the referred types have the same name. Otherwise we can get spurious errors. To give a specific example, this can happen when ipfw_nat.ko is loaded before ipfw.ko and /usr/lib/dtrace/ipfw.d is processed. Currently, ipfw_nat.ko does not have a definition for struct inpcb (i.e., none of its files include in_pcb.h), so in the CTF type graph, struct ip_fw_args' "inp" member refers to a forward declaration, represented in CTF with CTF_K_FORWARD. Then, when libdtrace processes the ipfw_match_info_t translator in ipfw.d, it decides that the "inp" field assignment is incorrect because the two pointers are incompatible. However, there's no harm in allowing this assignment. Add some logic to dt_node_is_ptrcompat() to detect this case and declare the pointers as compatible so long as the name of the thing they refer to is the same, similar to how any pointer is compatible with a void *. Reported by: marck Reviewed by: Domagoj Stolfa MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D48254 (cherry picked from commit 4196f227aa84448ef3cae9e99678fbe787726cf7) --- .../opensolaris/lib/libdtrace/common/dt_parser.c | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c index 2b85dd2b26b6..d1ebaa8791da 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c @@ -1130,6 +1130,29 @@ dt_node_is_ptrcompat(const dt_node_t *lp, const dt_node_t *rp, lp_is_void = ctf_type_encoding(lfp, lref, &e) == 0 && IS_VOID(e); rp_is_void = ctf_type_encoding(rfp, rref, &e) == 0 && IS_VOID(e); + /* + * Let a pointer to a forward declaration be compatible with a pointer + * to a struct or union of the same name. + */ + if (lkind == CTF_K_POINTER && rkind == CTF_K_POINTER) { + int lrkind, rrkind; + + lrkind = ctf_type_kind(lfp, lref); + rrkind = ctf_type_kind(rfp, rref); + if (lrkind == CTF_K_FORWARD || rrkind == CTF_K_FORWARD) { + const char *lname, *rname; + char ln[DT_TYPE_NAMELEN], rn[DT_TYPE_NAMELEN]; + + lname = ctf_type_name(lfp, lref, ln, sizeof (ln)); + rname = ctf_type_name(rfp, rref, rn, sizeof (rn)); + if (lname != NULL && rname != NULL && + strcmp(lname, rname) == 0) { + lp_is_void = lrkind == CTF_K_FORWARD; + rp_is_void = rrkind == CTF_K_FORWARD; + } + } + } + /* * The types are compatible if both are pointers to the same type, or * if either pointer is a void pointer. If they are compatible, set