From nobody Mon Jul 6 09:26:39 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 4gtzWj5fLqz6dSN1; Mon, 06 Jul 2026 09:26:41 +0000 (UTC) (envelope-from des@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gtzWj4mWDz3JYH; Mon, 06 Jul 2026 09:26:41 +0000 (UTC) (envelope-from des@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783330001; 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: in-reply-to:in-reply-to:references:references; bh=lxnm2hNVBFr36i2QEF/n1ksq1N+Bb+rwZjUEnAf6G+Y=; b=HJmqAESQUJtCh/8wa048yjMSQTr/frlWXJl1DM/lpeqppUk2pFnsRJ6CaeVqTfVaBiy2NF MQ6C4e1kXgsH4Z2EuQCLZt+yVTxFhY5lik4cG8wWhAHa7MdZCmYFkLnBu53Un4gtP8WeEU S07PFdF3VOM2/IK9nVX6F3oPWgN9LqDVM4XKdNaskIDVTpzKjBjEs1L+Qnx2pq8Do3rBFx WaNtAmsAwxRId31XwD5US141kQm2SA1floCTUBuESslluwFIvNQJQrPHQdDfScR2a3JDEq QI3cGN13tUpgAdCG4Ntq602AYBfDrNH50GqxWfvIBWheDM4ZbY1+Hyi/7fX15g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783330001; a=rsa-sha256; cv=none; b=rvHMrQ5BpPHqbovCMDbBaTAezlpX1w77peJ56HDZAmXQcLX73Fsqe2vuIngH+wd6c72qb7 aggTJjX/pUFhcQNxw3rQ4Xrw9DbxOFBwEMt56qlYvPidsDTU87XqOQ26S1vzqt81CeN4+e hj+mHmxuMYykE/YR1eKIilJ5pUIZUtXvWGHcdYQ8slaMjEppNaRS+6pXMOqd3l1ldsg4rE U0p8Y0uEY9f3c5W5CEmbRNuM9GQE0rcyM93VPxbu/gGbGkk2pRcAomN0MqCb5cyQFYkCab d5bhnOlDqttz6ClZpyrYUwm6MnJw6sJlFPVKdzwssHzaN+RFC0jfoC3R5Nz1/Q== 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=1783330001; 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: in-reply-to:in-reply-to:references:references; bh=lxnm2hNVBFr36i2QEF/n1ksq1N+Bb+rwZjUEnAf6G+Y=; b=QlDEZm7MaCQGeoOR3fL5fwRRtxf0rafT1+WQMg1Z7OnNKKssBeeTMtUCKHkzZkEFvCtn5l YLQbD8Q2Vo6iEr7LoikYuRbk5JtSErf+3oTpy3/XaTupWcIGyDzDQT0rOr8FtGbJPbhS4x 8NUkO5iAN/TZmaD8iqFb9QCOHeSj2/t9avoMKq7BfAj7S8eNHeGzZAAlHPH+HHkdjQAEtj M3lbzwyAed+/zM8zkvZXBhCzMA8hFgAPmkLQ8WXeI3sISGUXVixJBDNgFzv0f9lbPr0rgW V8v7IWwsCpQ2H8TbpEWnXweoDi41V9+yclErrj0fM+9ze3Lj+fBUEYCHYJ/h5Q== Received: from ltc.des.dev (2a01cb0585070b00922e16fffef1acef.ipv6.abo.wanadoo.fr [IPv6:2a01:cb05:8507:b00:922e:16ff:fef1:acef]) (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) (Authenticated sender: des/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gtzWj2kYYzNtX; Mon, 06 Jul 2026 09:26:41 +0000 (UTC) (envelope-from des@freebsd.org) Received: by ltc.des.dev (Postfix, from userid 1001) id E20AAA8D42; Mon, 06 Jul 2026 11:26:39 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Olivier Certner Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org, Artem Bunichev Subject: Re: git: 759ce9a2b38e - main - ps.1: Fix broken comment line In-Reply-To: <6a4ab8b9.42091.46ef79a8@gitrepo.freebsd.org> (Olivier Certner's message of "Sun, 05 Jul 2026 20:04:09 +0000") References: <6a4ab8b9.42091.46ef79a8@gitrepo.freebsd.org> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Mon, 06 Jul 2026 11:26:39 +0200 Message-ID: <86jyr879kg.fsf@ltc.des.dev> 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: quoted-printable Olivier Certner writes: > commit 759ce9a2b38e1de70c14c81dee7e245bf0bc6b94 > Author: Artem Bunichev > AuthorDate: 2026-07-05 19:01:36 +0000 > Commit: Olivier Certner > CommitDate: 2026-07-05 20:03:34 +0000 > > ps.1: Fix broken comment line >=20=20=20=20=20 > While here, remove the long-unused dash in the first line. It's not =E2=80=9Clong-unused=E2=80=9D, it's there to prevent indent(1) from reformatting the comment. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@FreeBSD.org From nobody Mon Jul 6 09:56:22 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 4gv0B03n88z6dVLn; Mon, 06 Jul 2026 09:56:24 +0000 (UTC) (envelope-from des@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv0B037Hfz3MG6; Mon, 06 Jul 2026 09:56:24 +0000 (UTC) (envelope-from des@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783331784; 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: in-reply-to:in-reply-to:references:references; bh=nH0LAHVJlfDWdZts1bzUElRqZ1oj7sn58dEdzUfjx1U=; b=j2mcjwQTKbKfpFPy0cv0AoZppg6TVXzegPoqewaVdDuRwW7DcwCTLujXH8A2YlMkpWbD5p gicIdHjdGAdNvNMsoMSDMwy6gcZcB0CqeuAl04JfaJJWuQClVrCXRIv1v0Xf+mINGh0WMZ vq2hDtJqXyyOhP3J0lNYhqGsRG8vjhKMzhOkjtMbC+swkW1Hd9V2uH2iR8kAjnjEkh+HIF 80xBmz+EDYphuyuQNyn79+XeGqsBtIRf9zU3uEGvfKLLTx51vBmeYqBBmwtClH8+8+S0rl iCbvOXntcZG7oYlm1io+XqiApEYIKtJW3g0+wRlvgc9B5P2xWatERH6wGTUh7g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783331784; a=rsa-sha256; cv=none; b=xa5I1zSzdSG08a+Jn0R/RlqSxG6OhmMhY/DPMobDJhZbZSqawuMppY3E8S3Aa5gfTOB1Iw HskCDc1M4X47mUhiXpKxnZXhKLVeineKoDtDmy8/T/+p9QPKxXpPzXxgpQgj4tZox32i8d 662vVU+pCWF3Yq62cvEAQFiR1MD+PemMlrO6tuP9yp/AHppBlDcvzQiXBWO01QaZIXcQX9 zn03hjDuSZQZXxOWafWW2dq8mVACIp4vLa3YxUVGBwsgMzJBn9PVpYR9F4oHLNet38J/9C HsyX5hOf35lzGFETLZnWrUvny97yubKwA3+R8vH+1CW01dhSehNcE9gBWbtyqg== 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=1783331784; 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: in-reply-to:in-reply-to:references:references; bh=nH0LAHVJlfDWdZts1bzUElRqZ1oj7sn58dEdzUfjx1U=; b=vKW+buqaHniqlxUutYeTEURRAwAmArxv4mQcF/BCf3TaXRs0ERgfTY1uChj8D12uQuMIcl S46i9XmpNs2M4dBydXSkSvh1NDo4ImJOV3tV4YSHTe+7+CjDlFyP8Dpe0awuoQ/hwMcP31 iNTRuPp1KEvtD+MaVWinHMRJXQgAclpOT/snhskkoJRiiyqpI6U1865eRfA2qYoEjqtsvt KNx+BMGcbnMvRtnj3MEjc1xVVn41jpz5tRIVbA2ZcO8TmPZsiQVyS4qTAv02zwjzNLQGhC AuVn1G9Gj2Rl08xFDTuk2D/rR7SCmCxETYWZ6UwsVa365SaXpwn1fwZtiL5D6A== Received: from ltc.des.dev (92-129-202-201.ftth.fr.orangecustomers.net [92.129.202.201]) (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) (Authenticated sender: des/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gv0B011qrzQ6F; Mon, 06 Jul 2026 09:56:24 +0000 (UTC) (envelope-from des@freebsd.org) Received: by ltc.des.dev (Postfix, from userid 1001) id 3997AAC195; Mon, 06 Jul 2026 11:56:22 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Robert Clausecker Cc: Olivier Certner , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, Artem Bunichev Subject: Re: git: 759ce9a2b38e - main - ps.1: Fix broken comment line In-Reply-To: (Robert Clausecker's message of "Mon, 6 Jul 2026 11:32:19 +0200") References: <6a4ab8b9.42091.46ef79a8@gitrepo.freebsd.org> <86jyr879kg.fsf@ltc.des.dev> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Mon, 06 Jul 2026 11:56:22 +0200 Message-ID: <86cxx0786x.fsf@ltc.des.dev> 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: quoted-printable Robert Clausecker writes: > Dag-Erling Sm=C3=B8rgrav writes: > > Olivier Certner writes: > > > While here, remove the long-unused dash in the first line. > > It's not =E2=80=9Clong-unused=E2=80=9D, it's there to prevent indent(1)= from > > reformatting the comment. > The .\"- convention was added by imp for automatic license analysis. It was already present in CSRG sources (admittedly not in ps.1, but you'll find it in e.g. ps.c). See also indent(1): =E2=80=98Box=E2=80=99 comments. The indent utility assumes that any c= omment with a dash or star immediately after the start of comment (that is, `/*-' or `/**= ') is a comment surrounded by a box of stars. Each line of such a comment is left unchanged, except that its indentation may be adjusted to acco= unt for the change in indentation of the first line of the comment. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@FreeBSD.org From nobody Mon Jul 6 10:18:05 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 4gv0g7180Rz6dXsD for ; Mon, 06 Jul 2026 10:18:11 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv0g65gkfz3RmD for ; Mon, 06 Jul 2026 10:18:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783333090; 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=snR220QZG3GUDitcFsg34cM9zRng4cH+a/Mx7KdT6PU=; b=dz1ckR/rmZVr7iswQmN6Cn1m/eMwOKOETjYdE3pNmw9IUGQAprnP9L4012TMvXqwHsnqSH Q/aV47lFHTQC5P8rUx530iJZp+s721uWat2qZ29mxwAXR59Q558sH12wgjyhoXG9FdBrq7 Pb0jFWM8838gRd7EHy/RuOz0fB09ZRnpB86j9+BajQOO3nj6/Z9j/k3zEuQSMYhaFHR7EZ yoIfAdOGxlNdAvxkBSrD1H87uX83cJqOuYCUaQ/BdJ18gEpRVyPKyNRWmhxFQPn2DmUWFg row9oabddfsmg179j8dazMWmW5cCVIhmO/2X/xDh7i6QAnpyPW/bzH+ZhUm4bQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783333090; a=rsa-sha256; cv=none; b=UC0BfFZuiiCuy8kjO0yYWBzOS/b2G9YqWuKtNo5lELo3u2kuYfB4hY1tPGgfa7r82qmJwX eQYQz6qGfiQdfHqArIvyaW32AL9KQNNgPzXvOke66JebhsUzKc4mBliCJ67S5aGsrXbnlt 739AXQFJRu/cDfiyIGzaf45A3/0P2tFBwvT2TFmBz4yrtRCRG0s9WQQarc4tKFoE9qawc0 JrVJUEPQ3Ql+N1A4TpEei1UEr+tz/4PBlhuhaJmq+tLYf3x5KBscJSVRk1YEh3YswfDRoM 4N5JhMju4JnTmTJqmyXrMIn+ERCLnWg3LHW8LyA0oUmv665Q9DbRikiso+E/SQ== 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=1783333090; 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=snR220QZG3GUDitcFsg34cM9zRng4cH+a/Mx7KdT6PU=; b=ctNRzuJJXGRJfNXuK6ZtXspeFMTMNwiU2W+3o4+tdK64q0kHJA7ieqcvPKSMkg5sFHgXzG OcEg7m9+gadkatmbKd6hKaG9CWLbrAKskkOwxyU63GoDpDXUXESLl6yvDlJdKEsWDYz3nX VFyQzgM6ByJZSRR+QMfmX5RIWAeGcevKo5MjOlzAWj5Yy1WVfuNt3gXvZ6nGtpbROjEHyo OWrIrNd6/OKS8V4bhiudLzhDpTAD8YZ9aAGK8fNSf/FoHk+GQHBRZ2vRSC6WG7sTBcfupw hi9v1n7UEwphhlMDoYxhpEbxR0j/YEuf1TP0UUPLrjBaulWek4q2zv27WQtqUg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv0g64Jlmz113S for ; Mon, 06 Jul 2026 10:18:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2518c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 10:18:05 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Slava Shwartsman From: Konstantin Belousov Subject: git: b125b736eaf7 - main - ibcore: Fix GID sysctl fallback formatting 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b125b736eaf7da334b07dead671e48ecad3211b3 Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 10:18:05 +0000 Message-Id: <6a4b80dd.2518c.14115110@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b125b736eaf7da334b07dead671e48ecad3211b3 commit b125b736eaf7da334b07dead671e48ecad3211b3 Author: Slava Shwartsman AuthorDate: 2026-07-02 15:06:39 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-06 10:15:02 +0000 ibcore: Fix GID sysctl fallback formatting When a GID table entry is empty or not yet present in the cache, show_port_gid() falls back to printing a zero GID. Use the existing GID_PRINT_FMT/GID_PRINT_ARGS helpers instead of Linux's %pI6 format, which FreeBSD printf treats as a pointer followed by "I6". This makes empty GID sysctl entries consistently report 0000:0000:0000:0000:0000:0000:0000:0000. Tested by: Wafa Hamzah (mlx5_ib) Reviewed by: jhb, kib Sponsored by: NVIDIA Networking Fixes: 6a75471dbcf0 ("OFED: Various changes from Linux 4.19") Differential Revision: https://reviews.freebsd.org/D58042 --- sys/ofed/drivers/infiniband/core/ib_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_sysfs.c b/sys/ofed/drivers/infiniband/core/ib_sysfs.c index b44d4b1d85f7..b9e8c57ddd67 100644 --- a/sys/ofed/drivers/infiniband/core/ib_sysfs.c +++ b/sys/ofed/drivers/infiniband/core/ib_sysfs.c @@ -421,7 +421,7 @@ static ssize_t show_port_gid(struct ib_port *p, struct port_attribute *attr, * space throwing such error on fail to read gid, return zero * GID as before. This maintains backward compatibility. */ - return sprintf(buf, "%pI6\n", zgid.raw); + return sprintf(buf, GID_PRINT_FMT"\n", GID_PRINT_ARGS(zgid.raw)); } ret = sprintf(buf, GID_PRINT_FMT"\n", GID_PRINT_ARGS(gid_attr->gid.raw)); From nobody Mon Jul 6 12:07:46 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 4gv35g4dJjz6jQsq for ; Mon, 06 Jul 2026 12:07:51 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv35g2KKpz3dmn for ; Mon, 06 Jul 2026 12:07:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783339671; 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=2URxEV44CDFVbLuYQpmNtgo9+g+dcxTIze+U/lViGvs=; b=ZGb7NDZJjVnyUfyHXqmOpv+RvHmgFX50IVAapN8e5oDPCgiGv0TkanntWwlUXolHOXokg4 hrrqkHrQMgGkUNRfB3Lv3qHDdsgjCfeieRdO3vf/17NM5tvSpguuTGaGPkp1QPXuvMXdPc zEkJTnod0bYg0GcH8Xod8uGH6jUpJ0DmTe2j7Jz/e1I0hwiwbHk9CDgnwxL9amKH0Nkc6X hy6HAmkKvL1lyxTVdxpfDRc51owGK8J8pRXAkpaJN7XajUr4HYuOwuBV1aIsEOY7mf8RAW AioH9BT+i5AikxjVDh/NZ2NuJyGC7DbELKXQ+g5P+k78zh2GEitXyhTlz1jyNg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783339671; a=rsa-sha256; cv=none; b=P+W6Yr0tMXYxooRrfJK6GOYcpXWF0FCBXtFCaoH0iQjloxdsjOvLYhWgEFPmTD3TBTAIXC HPAWpEI7rclWPYIP7x45FEP8t8PWUQX185alyef0/imRNx9p9cxMcf7Ll6zi1bXbimfmiw 4R/FWowyP2QeHHlrpITdrl0KQNNJB/rzvdq/QjZZnzb71D6y/qR6uMgnsxGhklkNAIUHQy aOjkrkkof5zO+VjQSp0UwVnOp2RS15xwAmHl17PYfZeyHU6DUUEu5M7efDGq0M7im2DbQr 3d++vWNLHCod2QE7XzDwkfLa5KthFX/kVPrIJUpC2LzHNWdwvEuZAy/P+pg9VQ== 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=1783339671; 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=2URxEV44CDFVbLuYQpmNtgo9+g+dcxTIze+U/lViGvs=; b=Rw/xo28iIVEAxfh/gJe/3w6047k/dQLTn7E08ijLL0jt00xkNmGnNK47flfBVHVpicRKS+ zNklebsTI3SgC0uWjKqGM0HqYj8BEbgENkY9D6ISH+kyeWnRBX/TE/5X6d9td/qhiyqb+i cHasV8Pnyy4DEhR1xlfh8/boSn4BNqgOg5Nu0DXGwmF3QUBejtCSvPsd6KH2vYr0FNla/J kogk165yvvXplKBp1t0F4B1Kt6mdujEswpq1ICvI1bDa+q6H1sIs1580h0HbLLL3WesZOM rDcJSWc+D8KVgOHrB47M+vgqaKfD4NvUHfflL5rGtpfycIUwqEkhj+Ihf1uHBQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv35g1HrHz13vG for ; Mon, 06 Jul 2026 12:07:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 396fb by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 12:07:46 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Goran=?utf-8?Q? Meki=C4=87?= From: Christos Margiolis Subject: git: 24576c39789c - main - sound: track kqueue low watermark per-knote for mmaped channels 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 24576c39789ca13846b9450155923ee0e377aeb4 Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 12:07:46 +0000 Message-Id: <6a4b9a92.396fb.7198c2aa@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=24576c39789ca13846b9450155923ee0e377aeb4 commit 24576c39789ca13846b9450155923ee0e377aeb4 Author: Goran Mekić AuthorDate: 2026-07-06 12:06:17 +0000 Commit: Christos Margiolis CommitDate: 2026-07-06 12:07:41 +0000 sound: track kqueue low watermark per-knote for mmaped channels Use kn->kn_sdata to track the last bs->total value for each knote attached to an mmaped channel. An event is delivered only when the total byte counter has advanced by at least c->lw since the last delivery. After delivery kn_sdata is updated to the current total. Each knote tracks its own watermark independently, so multiple knotes attached to the same mmaped channel all receive events correctly. Non-mmap channels keep the existing level-triggered behavior via chn_polltrigger(). MFC after: 1 week Reviewed by: christos Differential Revision: https://reviews.freebsd.org/D57833 --- sys/dev/sound/pcm/channel.c | 14 +++++++++----- sys/dev/sound/pcm/channel.h | 2 +- sys/dev/sound/pcm/dsp.c | 14 +++++++++++++- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index a0ee16a14386..40a08d48fb21 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -270,11 +270,15 @@ chn_lockdestroy(struct pcm_channel *c) /** * @brief Determine channel is ready for I/O * + * @param ref_total for mmaped channels, the previous byte counter + * * snapshot from which to compute the delta to + * * bufsoft->total; ignored for non-mmaped channels. + * * @retval 1 = ready for I/O * @retval 0 = not ready for I/O */ int -chn_polltrigger(struct pcm_channel *c) +chn_polltrigger(struct pcm_channel *c, u_int64_t ref_total) { struct snd_dbuf *bs = c->bufsoft; u_int delta; @@ -282,10 +286,10 @@ chn_polltrigger(struct pcm_channel *c) CHN_LOCKASSERT(c); if (c->flags & CHN_F_MMAP) { - if (bs->prev_total < c->lw) + if (ref_total < c->lw) delta = c->lw; else - delta = bs->total - bs->prev_total; + delta = bs->total - ref_total; } else { if (c->direction == PCMDIR_PLAY) delta = sndbuf_getfree(bs); @@ -316,7 +320,7 @@ chn_wakeup(struct pcm_channel *c) if (CHN_EMPTY(c, children.busy)) { KNOTE_LOCKED(&bs->sel.si_note, 0); - if (SEL_WAITING(&bs->sel) && chn_polltrigger(c)) + if (SEL_WAITING(&bs->sel) && chn_polltrigger(c, bs->prev_total)) selwakeuppri(&bs->sel, PRIBIO); CHN_BROADCAST(&c->intr_cv); } else { @@ -830,7 +834,7 @@ chn_poll(struct pcm_channel *c, int ev, struct thread *td) } ret = 0; - if (chn_polltrigger(c)) { + if (chn_polltrigger(c, bs->prev_total)) { chn_pollreset(c); ret = ev; } else diff --git a/sys/dev/sound/pcm/channel.h b/sys/dev/sound/pcm/channel.h index 6fa4338dce4a..c7f5bf93b8e5 100644 --- a/sys/dev/sound/pcm/channel.h +++ b/sys/dev/sound/pcm/channel.h @@ -260,7 +260,7 @@ int chn_read(struct pcm_channel *c, struct uio *buf); u_int32_t chn_start(struct pcm_channel *c, int force); int chn_sync(struct pcm_channel *c, int threshold); int chn_flush(struct pcm_channel *c); -int chn_polltrigger(struct pcm_channel *c); +int chn_polltrigger(struct pcm_channel *c, u_int64_t ref_total); int chn_poll(struct pcm_channel *c, int ev, struct thread *td); char *chn_mkname(char *buf, size_t len, struct pcm_channel *c); diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 8bb07d87fac9..da8bf485bc9b 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -3010,7 +3010,13 @@ dsp_kqevent(struct knote *kn, long hint) return (1); } kn->kn_data = 0; - if (chn_polltrigger(ch)) { + /* + * For mmaped channels pass the knote's own reference point so the + * low watermark is tracked per-knote. Non-mmaped channels ignore + * the reference and fire based on the current amount of ready/free + * data in the buffer, so all knotes see the same live state. + */ + if (chn_polltrigger(ch, (u_int64_t)kn->kn_sdata)) { if (kn->kn_filter == EVFILT_READ) { kn->kn_data = sndbuf_getready(ch->bufsoft); if (ch->flags & CHN_F_MMAP) @@ -3025,6 +3031,7 @@ dsp_kqevent(struct knote *kn, long hint) kn->kn_kevent.ext[0] = sndbuf_getready(ch->bufsoft) / ch->bufsoft->align; } kn->kn_kevent.ext[1] = ch->xruns; + kn->kn_sdata = ch->bufsoft->total; } return (kn->kn_data > 0); @@ -3070,6 +3077,11 @@ dsp_kqfilter(struct cdev *dev, struct knote *kn) knlist_add(&ch->bufsoft->sel.si_note, kn, 1); CHN_UNLOCK(ch); kn->kn_hook = ch; + /* + * Start tracking from the current position so the first event + * fires after c->lw additional bytes have been transferred. + */ + kn->kn_sdata = ch->bufsoft->prev_total; } else err = EINVAL; PCM_GIANT_LEAVE(d); From nobody Mon Jul 6 12:24:27 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 4gv3Ss0J9qz6jSNG for ; Mon, 06 Jul 2026 12:24:29 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv3Sq5l9Mz3ggv for ; Mon, 06 Jul 2026 12:24:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783340667; 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=umC7BhN1WqMF/xZX3QYfwfAYugrLcSnsFMq2tO7MXyk=; b=n8wYAEetgDrSAXqEvkYNFxNEKYust6MajTbJVq3MUKQMZ7eCEA2Uo1kJbAkzMRR5unzfvI nuI+EqDjKU49z/B+6SpPTcgCjUzDTrv9fZW6RaC7RiCr2CTCDjFgt5nurbk5OBnSWGkDTu OKSvzI9jubDiMUp2h16p57GYq0DgxqlolYGMY/0x+mJjg4dj4IBHdWHZduMlZqsd5i5xY7 XOHgIcLC9I62oqmBjd542GmuMyLtzDNdMPllmWmcj+tnXzgipBoIb24GVtUI4aEAhXG8aJ ZxJf+RNCR+vzIrQrHZ/oFLLoIMKUGll8dgFYkraFRVfQmRDQFOiOxT+/VYv0Zg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783340667; a=rsa-sha256; cv=none; b=NGem8J+ivapEA9L4kK/u6qcbHW51gbZUJfX/hULpONnUPQpGI9cZuu+DA0/O6UpSWgM8GM 3ioQOLCU4BYDd7+ZY650uav9hDYnaOHWJmBe8Hy3xKNgnoNJcChQaSmxqG03A+LXQy0oHu ip658nBTPJ8IRKqF3wsGx5St2gPQQnriidFT/Hrfe4WrwmcFdu2Cf3cql6sC3+xp8nT05b a6a9h+t3MeDArRVv09dz7h6IvKUKOZLfW6zReEwLW8lB/5aAle0lzfr6+OqlAEWHz81jOy g3/tqW4UFCzlvqn93uhHLjlwhXXDs00viExkD4uMSZGxUUkY09Z9s+4zQmbyTQ== 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=1783340667; 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=umC7BhN1WqMF/xZX3QYfwfAYugrLcSnsFMq2tO7MXyk=; b=TspdN9ECsSbra2Fz0mZpPrmFnLN9IR3pElHYueRy94wHmv8PqEO4u4Q/51rFitUpOzhbbJ sl9cwrvk8WriwUNBx7eoeMWSZfdBel8SEQVW5OIruvGorCYwflxjQqrN/uUGPigKjTzsYj DmKMJp+geztOZaQut8ijOcR+OLsHICJvVuztIwGVplgujoAu6a8gF3LkSWdGu2iCxp4arK 5U5aC6T/lvkfZQP8hE4x6LnahGm3oW4vQshzZW14Z1tamN1VK5lrMS2g9xETTS9TGabI0V td5Mw2T5oF1smTLlDGmIs7mmm2vke3me3UiPOgHlemawZDDIgoSvZsPtEiE0dw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv3Sq4fvBz13th for ; Mon, 06 Jul 2026 12:24:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3a4ea by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 12:24:27 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: ffeb56905ed6 - main - libc/resolv: Refactor the configuration parser 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ffeb56905ed6a7ac759367096d6dc0596e82e03f Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 12:24:27 +0000 Message-Id: <6a4b9e7b.3a4ea.3e7ab5ac@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=ffeb56905ed6a7ac759367096d6dc0596e82e03f commit ffeb56905ed6a7ac759367096d6dc0596e82e03f Author: Dag-Erling Smørgrav AuthorDate: 2026-07-06 12:23:33 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-07-06 12:23:33 +0000 libc/resolv: Refactor the configuration parser This was previously all a single loop in res_init(), apart from option parsing which we cleaned up in a previous commit. Break it out into separate functions for reading the configuration line by line, setting the default domain, setting the search list, and adding a nameserver to the nameserver list. Sprinkle bounds checks and code comments all around. The sortlist code, which has been disabled for the past 20 years, will be dealt with in a separate commit. MFC after: 1 week Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D57924 --- lib/libc/resolv/res_init.c | 649 ++++++++++++++++++++++++++------------------- 1 file changed, 381 insertions(+), 268 deletions(-) diff --git a/lib/libc/resolv/res_init.c b/lib/libc/resolv/res_init.c index 4cddb3b0b72a..bd3fd866c189 100644 --- a/lib/libc/resolv/res_init.c +++ b/lib/libc/resolv/res_init.c @@ -97,6 +97,10 @@ #include "res_private.h" +static void res_readconf(res_state, const char *, int); +static void res_setdefdname(res_state, const char *, const char *); +static void res_setdnsrch(res_state, const char *, const char *); +static int res_setnsaddr(res_state, int, const char *, const char *); static void res_setoptions(res_state, const char *, const char *); #ifdef RESOLVSORT @@ -107,6 +111,8 @@ static u_int32_t net_mask(struct in_addr); #define res_space(ch) \ isspace((unsigned char)(ch)) +#define res_comment(ch) \ + ((ch) == '#' || (ch) == ';') #define res_match(str, end, word) \ (strncmp((str), (word), (end) - (str)) == 0 && \ (word)[(end) - (str)] == '\0') @@ -136,7 +142,9 @@ res_ninit(res_state statp) { /*% This function has to be reachable by res_data.c but not publicly. */ int -__res_vinit(res_state statp, int preinit) { +__res_vinit(res_state statp, int preinit) +{ + char buf[NI_MAXHOST]; union res_sockaddr_union u[] = { { .sin = { .sin_family = AF_INET, @@ -157,17 +165,7 @@ __res_vinit(res_state statp, int preinit) { } }, #endif }; - FILE *fp; char *cp, **pp; - int n; - char buf[BUFSIZ]; - int nserv = 0; /*%< number of nameserver records read from file */ - int haveenv = 0; - int havesearch = 0; -#ifdef RESOLVSORT - int nsort = 0; - char *net; -#endif int dots; int maxns = MAXNS; @@ -219,263 +217,14 @@ __res_vinit(res_state statp, int preinit) { #endif res_setservers(statp, u, nitems(u)); + /* read the configuration file */ + res_readconf(statp, _PATH_RESCONF, maxns); + /* Allow user to override the local domain definition */ if ((cp = secure_getenv("LOCALDOMAIN")) != NULL) { - (void)strncpy(statp->defdname, cp, sizeof(statp->defdname) - 1); - statp->defdname[sizeof(statp->defdname) - 1] = '\0'; - haveenv++; - - /* - * Set search list to be blank-separated strings - * from rest of env value. Permits users of LOCALDOMAIN - * to still have a search list, and anyone to set the - * one that they want to use as an individual (even more - * important now that the rfc1535 stuff restricts searches) - */ - cp = statp->defdname; - pp = statp->dnsrch; - *pp++ = cp; - for (n = 0; *cp && pp < statp->dnsrch + MAXDNSRCH; cp++) { - if (*cp == '\n') /*%< silly backwards compat */ - break; - else if (*cp == ' ' || *cp == '\t') { - *cp = 0; - n = 1; - } else if (n) { - *pp++ = cp; - n = 0; - havesearch = 1; - } - } - /* null terminate last domain if there are excess */ - while (*cp != '\0' && *cp != ' ' && *cp != '\t' && *cp != '\n') + while (res_space(*cp)) cp++; - *cp = '\0'; - *pp++ = NULL; - } - -#define MATCH(line, name) \ - (!strncmp(line, name, sizeof(name) - 1) && \ - (line[sizeof(name) - 1] == ' ' || \ - line[sizeof(name) - 1] == '\t')) - - if ((fp = fopen(_PATH_RESCONF, "re")) != NULL) { - struct stat sb; - struct timespec now; - - if (statp->_u._ext.ext != NULL) { - if (_fstat(fileno(fp), &sb) == 0) { - statp->_u._ext.ext->conf_mtim = sb.st_mtim; - if (clock_gettime(CLOCK_MONOTONIC_FAST, &now) == 0) { - statp->_u._ext.ext->conf_stat = now.tv_sec; - } - } - } - - /* read the config file */ - while (fgets(buf, sizeof(buf), fp) != NULL) { - /* skip comments */ - if (*buf == ';' || *buf == '#') - continue; - /* read default domain name */ - if (MATCH(buf, "domain")) { - if (haveenv) /*%< skip if have from environ */ - continue; - cp = buf + sizeof("domain") - 1; - while (*cp == ' ' || *cp == '\t') - cp++; - if ((*cp == '\0') || (*cp == '\n')) - continue; - strncpy(statp->defdname, cp, sizeof(statp->defdname) - 1); - statp->defdname[sizeof(statp->defdname) - 1] = '\0'; - if ((cp = strpbrk(statp->defdname, " \t\n")) != NULL) - *cp = '\0'; - havesearch = 0; - continue; - } - /* set search list */ - if (MATCH(buf, "search")) { - if (haveenv) /*%< skip if have from environ */ - continue; - cp = buf + sizeof("search") - 1; - while (*cp == ' ' || *cp == '\t') - cp++; - if ((*cp == '\0') || (*cp == '\n')) - continue; - strncpy(statp->defdname, cp, sizeof(statp->defdname) - 1); - statp->defdname[sizeof(statp->defdname) - 1] = '\0'; - if ((cp = strchr(statp->defdname, '\n')) != NULL) - *cp = '\0'; - /* - * Set search list to be blank-separated strings - * on rest of line. - */ - cp = statp->defdname; - pp = statp->dnsrch; - *pp++ = cp; - for (n = 0; *cp && pp < statp->dnsrch + MAXDNSRCH; cp++) { - if (*cp == ' ' || *cp == '\t') { - *cp = 0; - n = 1; - } else if (n) { - *pp++ = cp; - n = 0; - } - } - /* null terminate last domain if there are excess */ - while (*cp != '\0' && *cp != ' ' && *cp != '\t') - cp++; - *cp = '\0'; - *pp++ = NULL; - havesearch = 1; - continue; - } - /* read nameservers to query */ - if (MATCH(buf, "nameserver") && nserv < maxns) { - struct addrinfo hints, *ai; - char sbuf[NI_MAXSERV]; - const size_t minsiz = - sizeof(statp->_u._ext.ext->nsaddrs[0]); - - cp = buf + sizeof("nameserver") - 1; - while (*cp == ' ' || *cp == '\t') - cp++; - cp[strcspn(cp, ";# \t\n")] = '\0'; - if ((*cp != '\0') && (*cp != '\n')) { - memset(&hints, 0, sizeof(hints)); - hints.ai_family = PF_UNSPEC; - hints.ai_socktype = SOCK_DGRAM; /*dummy*/ - hints.ai_flags = AI_NUMERICHOST; - sprintf(sbuf, "%u", NAMESERVER_PORT); - if (getaddrinfo(cp, sbuf, &hints, &ai) == 0) { - if (ai->ai_addrlen <= minsiz) { - if (statp->_u._ext.ext != NULL) { - memcpy(&statp->_u._ext.ext->nsaddrs[nserv], - ai->ai_addr, ai->ai_addrlen); - } - if (ai->ai_addrlen <= - sizeof(statp->nsaddr_list[nserv])) { - memcpy(&statp->nsaddr_list[nserv], - ai->ai_addr, ai->ai_addrlen); - } else - statp->nsaddr_list[nserv].sin_family = 0; - nserv++; - } - freeaddrinfo(ai); - } - } - continue; - } -#ifdef RESOLVSORT - if (MATCH(buf, "sortlist")) { - struct in_addr a; - struct in6_addr a6; - int m, i; - u_char *u; - struct __res_state_ext *ext = statp->_u._ext.ext; - - cp = buf + sizeof("sortlist") - 1; - while (nsort < MAXRESOLVSORT) { - while (*cp == ' ' || *cp == '\t') - cp++; - if (*cp == '\0' || *cp == '\n' || *cp == ';') - break; - net = cp; - while (*cp && !ISSORTMASK(*cp) && *cp != ';' && - isascii(*cp) && !isspace((unsigned char)*cp)) - cp++; - n = *cp; - *cp = 0; - if (inet_aton(net, &a)) { - statp->sort_list[nsort].addr = a; - if (ISSORTMASK(n)) { - *cp++ = n; - net = cp; - while (*cp && *cp != ';' && - isascii(*cp) && - !isspace((unsigned char)*cp)) - cp++; - n = *cp; - *cp = 0; - if (inet_aton(net, &a)) { - statp->sort_list[nsort].mask = a.s_addr; - } else { - statp->sort_list[nsort].mask = - net_mask(statp->sort_list[nsort].addr); - } - } else { - statp->sort_list[nsort].mask = - net_mask(statp->sort_list[nsort].addr); - } - ext->sort_list[nsort].af = AF_INET; - ext->sort_list[nsort].addr.ina = - statp->sort_list[nsort].addr; - ext->sort_list[nsort].mask.ina.s_addr = - statp->sort_list[nsort].mask; - nsort++; - } - else if (inet_pton(AF_INET6, net, &a6) == 1) { - - ext->sort_list[nsort].af = AF_INET6; - ext->sort_list[nsort].addr.in6a = a6; - u = (u_char *)&ext->sort_list[nsort].mask.in6a; - *cp++ = n; - net = cp; - while (*cp && *cp != ';' && - isascii(*cp) && !isspace(*cp)) - cp++; - m = n; - n = *cp; - *cp = 0; - switch (m) { - case '/': - m = atoi(net); - break; - case '&': - if (inet_pton(AF_INET6, net, u) == 1) { - m = -1; - break; - } - /*FALLTHROUGH*/ - default: - m = sizeof(struct in6_addr) * CHAR_BIT; - break; - } - if (m >= 0) { - for (i = 0; i < sizeof(struct in6_addr); i++) { - if (m <= 0) { - *u = 0; - } else { - m -= CHAR_BIT; - *u = (u_char)~0; - if (m < 0) - *u <<= -m; - } - u++; - } - } - statp->sort_list[nsort].addr.s_addr = - (u_int32_t)0xffffffff; - statp->sort_list[nsort].mask = - (u_int32_t)0xffffffff; - nsort++; - } - *cp = n; - } - continue; - } -#endif - if (MATCH(buf, "options")) { - res_setoptions(statp, buf + sizeof("options") - 1, "conf"); - continue; - } - } - if (nserv > 0) - statp->nscount = nserv; -#ifdef RESOLVSORT - statp->nsort = nsort; -#endif - (void) fclose(fp); + res_setdnsrch(statp, cp, strchr(cp, '\0')); } /* guess default domain if not set */ @@ -485,7 +234,7 @@ __res_vinit(res_state statp, int preinit) { strcpy(statp->defdname, cp + 1); /* find components of local domain that might be searched */ - if (havesearch == 0) { + if (statp->dnsrch[0] == NULL) { pp = statp->dnsrch; *pp++ = statp->defdname; *pp = NULL; @@ -521,6 +270,370 @@ __res_vinit(res_state statp, int preinit) { return (statp->res_h_errno); } +/*% + * Read the resolver configuration file. + */ +static void +res_readconf(res_state statp, const char *resconf, int maxns) +{ + struct stat sb; + struct timespec now; + FILE *fp; + char *line = NULL, *eol, *eow; + char *cp; + ssize_t len; + size_t sz = 0; + int nserv = 0; +#ifdef RESOLVSORT + int n, nsort = 0; + char *net; +#endif + + if ((fp = fopen(resconf, "re")) == NULL) + return; + if (statp->_u._ext.ext != NULL) { + if (_fstat(fileno(fp), &sb) == 0) { + statp->_u._ext.ext->conf_mtim = sb.st_mtim; + if (clock_gettime(CLOCK_MONOTONIC_FAST, &now) == 0) { + statp->_u._ext.ext->conf_stat = now.tv_sec; + } + } + } + + while ((len = getline(&line, &sz, fp)) != -1) { + /* search for comment or end of line */ + eol = line; + while (eol < line + len && !res_comment(*eol)) + eol++; + + /* now backtrack over whitespace */ + while (eol > line && res_space(eol[-1])) + eol--; + *eol = '\0'; + + /* skip blank line */ + if (eol == line) + continue; + + /* isolate the first word */ + eow = line; + while (eow < eol && !res_space(*eow)) + eow++; + + /* read default domain name */ + if (res_match(line, eow, "domain")) { + cp = eow; + while (cp < eol && res_space(*cp)) + cp++; + res_setdefdname(statp, cp, eol); + continue; + } + + /* set search list */ + if (res_match(line, eow, "search")) { + cp = eow; + while (cp < eol && res_space(*cp)) + cp++; + res_setdnsrch(statp, cp, eol); + continue; + } + + /* read nameservers to query */ + if (res_match(line, eow, "nameserver")) { + cp = eow; + while (cp < eol && res_space(*cp)) + cp++; + if (cp == eol) + continue; + if (nserv < maxns) { + if (res_setnsaddr(statp, nserv, cp, eol)) + nserv++; +#ifdef DEBUG + } else { + printf(";; nameserver overflow: %.*s\n", + (int)(eol - cp), cp); +#endif + } + continue; + } +#ifdef RESOLVSORT + if (res_match(line, eow, "sortlist")) { + struct in_addr a; + struct in6_addr a6; + int m, i; + u_char *u; + struct __res_state_ext *ext = statp->_u._ext.ext; + + cp = line + sizeof("sortlist") - 1; + while (nsort < MAXRESOLVSORT) { + while (*cp == ' ' || *cp == '\t') + cp++; + if (*cp == '\0' || *cp == '\n' || *cp == ';') + break; + net = cp; + while (*cp && !ISSORTMASK(*cp) && *cp != ';' && + isascii(*cp) && !isspace((unsigned char)*cp)) + cp++; + n = *cp; + *cp = 0; + if (inet_aton(net, &a)) { + statp->sort_list[nsort].addr = a; + if (ISSORTMASK(n)) { + *cp++ = n; + net = cp; + while (*cp && *cp != ';' && + isascii(*cp) && + !isspace((unsigned char)*cp)) + cp++; + n = *cp; + *cp = 0; + if (inet_aton(net, &a)) { + statp->sort_list[nsort].mask = a.s_addr; + } else { + statp->sort_list[nsort].mask = + net_mask(statp->sort_list[nsort].addr); + } + } else { + statp->sort_list[nsort].mask = + net_mask(statp->sort_list[nsort].addr); + } + ext->sort_list[nsort].af = AF_INET; + ext->sort_list[nsort].addr.ina = + statp->sort_list[nsort].addr; + ext->sort_list[nsort].mask.ina.s_addr = + statp->sort_list[nsort].mask; + nsort++; + } + else if (inet_pton(AF_INET6, net, &a6) == 1) { + + ext->sort_list[nsort].af = AF_INET6; + ext->sort_list[nsort].addr.in6a = a6; + u = (u_char *)&ext->sort_list[nsort].mask.in6a; + *cp++ = n; + net = cp; + while (*cp && *cp != ';' && + isascii(*cp) && !isspace(*cp)) + cp++; + m = n; + n = *cp; + *cp = 0; + switch (m) { + case '/': + m = atoi(net); + break; + case '&': + if (inet_pton(AF_INET6, net, u) == 1) { + m = -1; + break; + } + /*FALLTHROUGH*/ + default: + m = sizeof(struct in6_addr) * CHAR_BIT; + break; + } + if (m >= 0) { + for (i = 0; i < sizeof(struct in6_addr); i++) { + if (m <= 0) { + *u = 0; + } else { + m -= CHAR_BIT; + *u = (u_char)~0; + if (m < 0) + *u <<= -m; + } + u++; + } + } + statp->sort_list[nsort].addr.s_addr = + (u_int32_t)0xffffffff; + statp->sort_list[nsort].mask = + (u_int32_t)0xffffffff; + nsort++; + } + *cp = n; + } + continue; + } +#endif /* RESOLVSORT */ + /* read resolver options */ + if (res_match(line, eow, "options")) { + cp = eow; + while (res_space(*cp)) + cp++; + res_setoptions(statp, cp, "conf"); + continue; + } + } + free(line); + if (nserv > 0) + statp->nscount = nserv; +#ifdef RESOLVSORT + statp->nsort = nsort; +#endif + (void)fclose(fp); +} + +/*% + * Set the default domain to the first word of the string. Assumes no + * leading space. + */ +static void +res_setdefdname(res_state statp, const char *str, const char *end) +{ + const char *sp; + + /* find the first space */ + sp = str; + while (sp < end && !res_space(*sp)) + sp++; + + /* check length of first word */ + if (sp == str || sp - str >= sizeof(statp->defdname)) { + statp->defdname[0] = '\0'; + statp->dnsrch[0] = NULL; + return; + } + + /* copy the first word into defdname */ + memcpy(statp->defdname, str, sp - str); + statp->defdname[sp - str] = '\0'; + statp->dnsrch[0] = NULL; +#ifdef DEBUG + printf(";; domain %s\n", statp->defdname); +#endif +} + +/*% + * Set the default domain to the first word of the string and split the + * string up into the search path. Assumes no leading space. + */ +static void +res_setdnsrch(res_state statp, const char *str, const char *end) +{ + char *sp, *wp, *np; + int n; + + /* trim trailing space */ + while (end > str && res_space(end[-1])) + end--; + + /* check length of string */ + if (end == str || end - str >= sizeof(statp->defdname)) { + statp->defdname[0] = '\0'; + statp->dnsrch[0] = NULL; + return; + } + + /* copy entire string into defdname */ + memcpy(statp->defdname, str, end - str); + statp->defdname[end - str] = '\0'; + + /* split string into words */ + for (wp = statp->defdname, n = 0; + *wp != '\0' && n < MAXDNSRCH; + wp = np) { + /* find the end of the word */ + sp = wp; + while (*sp != '\0' && !res_space(*sp)) + sp++; + + /* find the start of the next word */ + np = sp; + while (*np != '\0' && res_space(*np)) + np++; + + /* assign to the next slot */ + if (sp > wp) { + statp->dnsrch[n] = wp; + *sp = '\0'; +#ifdef DEBUG + if (n == 0) + printf(";; domain %s\n;; search", statp->defdname); + printf(" %s", statp->dnsrch[n]); +#endif + n++; + } + } +#ifdef DEBUG + printf("\n"); +#endif + + /* terminate the list */ + statp->dnsrch[n] = NULL; +} + +/*% + * Resolve the string and insert the result in the specified slot in the + * name server list. Assumes no leading or trailing space. Returns 1 if + * an entry was inserted, 0 otherwise. + */ +static int +res_setnsaddr(res_state statp, int i, const char *str, const char *end) +{ + char addr[48], port[8]; + _Static_assert(sizeof(addr) > INET6_ADDRSTRLEN, + "address buffer too small for AF_INET6"); + _Static_assert(sizeof(addr) > INET_ADDRSTRLEN, + "address buffer too small for AF_INET"); + struct addrinfo hints = { + .ai_family = AF_UNSPEC, + .ai_socktype = SOCK_DGRAM, + .ai_flags = AI_NUMERICHOST, + }; + struct addrinfo *ai; + int ret = 0; + + /* prepare port number */ + snprintf(port, sizeof(port), "%u", NAMESERVER_PORT); + + /* check length */ + if (end - str >= sizeof(addr)) { +#ifdef DEBUG + printf(";; nameserver too long: %.*s\n", + (int)(end - str), str); +#endif + return (0); + } + + /* resolve the address */ + memcpy(addr, str, end - str); + addr[end - str] = '\0'; + if (getaddrinfo(addr, port, &hints, &ai) != 0) { +#ifdef DEBUG + printf(";; nameserver invalid: %s\n", addr); +#endif + return (0); + } + + /* copy the sockaddr */ + if (ai->ai_addrlen <= sizeof(statp->_u._ext.ext->nsaddrs[0])) { + if (statp->_u._ext.ext != NULL) { + memcpy(&statp->_u._ext.ext->nsaddrs[i], + ai->ai_addr, ai->ai_addrlen); + ret = 1; + } + if (ai->ai_addrlen <= sizeof(statp->nsaddr_list[i])) { + memcpy(&statp->nsaddr_list[i], + ai->ai_addr, ai->ai_addrlen); + ret = 1; + } else { + statp->nsaddr_list[i].sin_family = 0; + } +#ifdef DEBUG + printf(";; nameserver %s\n", addr); +#endif + } else { +#ifdef DEBUG + printf(";; sockaddr too big: %s\n", addr); +#endif + } + freeaddrinfo(ai); + return (ret); +} + +/*% + * Split the string up into words and interpret them as resolver options. + */ static void res_setoptions(res_state statp, const char *options, const char *source) { @@ -742,7 +855,8 @@ res_get_nibblesuffix2(res_state statp) { #endif void -res_setservers(res_state statp, const union res_sockaddr_union *set, int cnt) { +res_setservers(res_state statp, const union res_sockaddr_union *set, int cnt) +{ int i, nserv; size_t size; @@ -789,7 +903,6 @@ res_setservers(res_state statp, const union res_sockaddr_union *set, int cnt) { set++; } statp->nscount = nserv; - } int From nobody Mon Jul 6 12:24:26 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 4gv3Sq1rm4z6jSNC for ; Mon, 06 Jul 2026 12:24:27 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv3Sp4yZQz3gQ1 for ; Mon, 06 Jul 2026 12:24:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783340666; 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=jKeqcgDNcpFOsssbRSeNwfdgo/LM90dlMd0n+U+gPvs=; b=mrQMPlUAWJTr4C6tUa2E05hE5ygKiV/D87psuSa+ertqft/sci+4wgcivwe7TNXOoE7Uzy DIjCmudh8v6DAYfvb1PFLq1ktIncWQjupQGA6vWPitAbwyYSrRw2/NMrD8/Eu6CxTOkkAc riVYcp7vjgKoUFW3aJkr3ZKYgQxYPunqalg22+g0AvAq60p+lH7uqcjj3wUt8fcHgbYxLX h1gsQyRiYGGsPuseRaUu0LtXb9MwO0dCfD6bmAqZRW5zLrgDez4iL++QHoqcjim2leyV3w GhDqBpH4BisT3ie/nF7OSPL6IJm+jkEOsqa/sTafDRdRrMHsWwnYZtxB2yX+XQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783340666; a=rsa-sha256; cv=none; b=Ib4iw5Z5qhzZfYCDsc9UliA8vhuvXfYXQdUBaTsey1RbXf7DDvJ4TBtPpIbfL8jW3JiUU2 OeDjpWEld+5ia/L5v4u/r9uQ+4REciKI72uY0kKdsULYOICDCY4da9PjuDfUppHQ6NWLur p3gHVJx1rFOD3IwEjDxRYK9EykpIOBbRKL3GBAvmXOTOz8wbCcNQRcxTXl4TGD5TlWXU6J PZDJ0BC/XcvywtzxlTDFWDGc2S3/b9wgDWT+0Rvr2hGswLjag5gYCciy4PTobYgpaRIhnj FnIJTEP6zvWDfIx+n8THJckmPuqlZnApy83Gu5cgpLz3si1Nn+z9KAMmBxHCjw== 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=1783340666; 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=jKeqcgDNcpFOsssbRSeNwfdgo/LM90dlMd0n+U+gPvs=; b=u7n5GjKwtde/59TQ05Wc4AsMstD/BMZn63uZ82kMq9nRiezVrBMBBfEIwnFlCq965kLsKI D4qUZqDGMEKHOKoPoVfGFOhpY1K3wB6ckVYfmKE5tLqoaRRIVy5w5gb2hC9p3sqqQbZwBH msDMS3HmZ+iPx9zonDwgnf0Ca4jS/O1RQrrhaeH3P45pb/BVBEc5FBn5X4b9SGgRv3DtUG rmQcVW40o86vuYUF/JRxyaW7XnOi/AL9FAMFLwF8p0TV4lMU1mq+tLBhjOI94UtXdtkYeE 7jvIiDfO6PEFWfgpKS0KKNv1MDSPgE2yplU8U2qkJCcdjKxPqIr79rJxxt6Wmg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv3Sp3kcCz13Ls for ; Mon, 06 Jul 2026 12:24:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 39ef7 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 12:24:26 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 9bfdfecd2735 - main - libc/resolv: Refactor the option parser 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9bfdfecd27359130aa4ef63fc0aa32f98f9e7b50 Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 12:24:26 +0000 Message-Id: <6a4b9e7a.39ef7.5ff4d111@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=9bfdfecd27359130aa4ef63fc0aa32f98f9e7b50 commit 9bfdfecd27359130aa4ef63fc0aa32f98f9e7b50 Author: Dag-Erling Smørgrav AuthorDate: 2026-07-06 12:23:29 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-07-06 12:23:29 +0000 libc/resolv: Refactor the option parser Start the loop by finding the end of the option name, the name-value separator (if any), and the end of the option. Use those pointers to simplify matching the option name and parsing the option value, and validate option names and values more strictly. This means that: * We no longer accept trailing garbage in an option name or value. For instance, we would previously interpret “edns0123” as “edns0” and “timeout:3xyz” as “timeout:3”. This was actually quite lucky because we also failed to recognize the newline at the end of the option line as a whitespace character. * For options that take a numerical argument, we would previously accept negative values and treat non-numerical arguments as 0, while large numerical arguments would be capped to the option's maximum permitted value. Now, any failure to parse the argument, including overflow, results in the option being left unchanged. MFC after: 1 week Relnotes: yes Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D57923 --- lib/libc/resolv/res_init.c | 194 ++++++++++++++++++++++++--------------------- 1 file changed, 105 insertions(+), 89 deletions(-) diff --git a/lib/libc/resolv/res_init.c b/lib/libc/resolv/res_init.c index e9e982fe27bb..4cddb3b0b72a 100644 --- a/lib/libc/resolv/res_init.c +++ b/lib/libc/resolv/res_init.c @@ -3,6 +3,7 @@ * * Copyright (c) 1985, 1989, 1993 * The Regents of the University of California. All rights reserved. + * Copyright (c) 2026 Dag-Erling Smørgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -80,6 +81,7 @@ #include #include +#include #include #include #include @@ -103,9 +105,11 @@ static const char sort_mask[] = "/&"; static u_int32_t net_mask(struct in_addr); #endif -#if !defined(isascii) /*%< XXX - could be a function */ -# define isascii(c) (!(c & 0200)) -#endif +#define res_space(ch) \ + isspace((unsigned char)(ch)) +#define res_match(str, end, word) \ + (strncmp((str), (word), (end) - (str)) == 0 && \ + (word)[(end) - (str)] == '\0') /* * Resolver state default settings. @@ -520,129 +524,141 @@ __res_vinit(res_state statp, int preinit) { static void res_setoptions(res_state statp, const char *options, const char *source) { - const char *cp = options; - int i; + const char *cp = options, *sp, *ep; + char *numend; + long num; struct __res_state_ext *ext = statp->_u._ext.ext; #ifdef DEBUG - if (statp->options & RES_DEBUG) + if (statp->options & RES_DEBUG) { printf(";; res_setoptions(\"%s\", \"%s\")...\n", options, source); + } #endif - while (*cp) { + for (;;) { /* skip leading and inner runs of spaces */ - while (*cp == ' ' || *cp == '\t') + while (res_space(*cp)) cp++; + /* find the separator if there is one */ + sp = cp; + while (*sp != '\0' && !res_space(*sp) && *sp != ':') + sp++; + /* find the end of the option */ + ep = sp; + while (*ep != '\0' && !res_space(*ep)) + ep++; + /* end of option line */ + if (ep == cp) + break; /* search for and process individual options */ - if (!strncmp(cp, "ndots:", sizeof("ndots:") - 1)) { - i = atoi(cp + sizeof("ndots:") - 1); - if (i <= RES_MAXNDOTS) - statp->ndots = i; - else - statp->ndots = RES_MAXNDOTS; + /* note: sp < ep if implies *sp == ':' */ + if (res_match(cp, sp, "ndots") && sp < ep) { + num = strtol(sp + 1, &numend, 10); + if (numend == ep && num >= 0 && num <= RES_MAXNDOTS) { + statp->ndots = num; #ifdef DEBUG - if (statp->options & RES_DEBUG) - printf(";;\tndots=%d\n", statp->ndots); + if (statp->options & RES_DEBUG) + printf(";;\tndots=%d\n", statp->ndots); #endif - } else if (!strncmp(cp, "timeout:", sizeof("timeout:") - 1)) { - i = atoi(cp + sizeof("timeout:") - 1); - if (i <= RES_MAXRETRANS) - statp->retrans = i; - else - statp->retrans = RES_MAXRETRANS; + } + } else if (res_match(cp, sp, "timeout") && sp < ep) { + num = strtol(sp + 1, &numend, 10); + if (numend == ep && num > 0 && num <= RES_MAXRETRANS) { + statp->retrans = num; #ifdef DEBUG - if (statp->options & RES_DEBUG) - printf(";;\ttimeout=%d\n", statp->retrans); + if (statp->options & RES_DEBUG) + printf(";;\ttimeout=%d\n", + statp->retrans); #endif - } else if (!strncmp(cp, "attempts:", sizeof("attempts:") - 1)){ - i = atoi(cp + sizeof("attempts:") - 1); - if (i <= RES_MAXRETRY) - statp->retry = i; - else - statp->retry = RES_MAXRETRY; + } + } else if (res_match(cp, sp, "attempts") && sp < ep) { + num = strtol(sp + 1, &numend, 10); + if (numend == ep && num > 0 && num <= RES_MAXRETRY) { + statp->retry = num; #ifdef DEBUG - if (statp->options & RES_DEBUG) - printf(";;\tattempts=%d\n", statp->retry); + if (statp->options & RES_DEBUG) + printf(";;\tattempts=%d\n", + statp->retry); #endif - } else if (!strncmp(cp, "debug", sizeof("debug") - 1)) { + } + } else if (res_match(cp, ep, "debug")) { #ifdef DEBUG if (!(statp->options & RES_DEBUG)) { printf(";; res_setoptions(\"%s\", \"%s\")..\n", options, source); - statp->options |= RES_DEBUG; } +#endif + statp->options |= RES_DEBUG; +#ifdef DEBUG printf(";;\tdebug\n"); #endif - } else if (!strncmp(cp, "no_tld_query", - sizeof("no_tld_query") - 1) || - !strncmp(cp, "no-tld-query", - sizeof("no-tld-query") - 1)) { + } else if (res_match(cp, ep, "no-tld-query") || + res_match(cp, ep, "no_tld_query")) { statp->options |= RES_NOTLDQUERY; - } else if (!strncmp(cp, "inet6", sizeof("inet6") - 1)) { + } else if (res_match(cp, ep, "inet6")) { statp->options |= RES_USE_INET6; - } else if (!strncmp(cp, "insecure1", sizeof("insecure1") - 1)) { - statp->options |= RES_INSECURE1; - } else if (!strncmp(cp, "insecure2", sizeof("insecure2") - 1)) { - statp->options |= RES_INSECURE2; - } else if (!strncmp(cp, "rotate", sizeof("rotate") - 1)) { + } else if (res_match(cp, ep, "insecure1")) { + statp->options |= RES_INSECURE1; + } else if (res_match(cp, ep, "insecure2")) { + statp->options |= RES_INSECURE2; + } else if (res_match(cp, ep, "blast")) { + statp->options |= RES_BLAST; + } else if (res_match(cp, ep, "rotate")) { statp->options |= RES_ROTATE; - } else if (!strncmp(cp, "usevc", sizeof("usevc") - 1)) { + } else if (res_match(cp, ep, "usevc")) { statp->options |= RES_USEVC; - } else if (!strncmp(cp, "no-check-names", - sizeof("no-check-names") - 1)) { + } else if (res_match(cp, ep, "no-check-names")) { statp->options |= RES_NOCHECKNAME; - } else if (!strncmp(cp, "reload-period:", - sizeof("reload-period:") - 1)) { - if (ext != NULL) { - ext->reload_period = (u_short) - atoi(cp + sizeof("reload-period:") - 1); + } else if (res_match(cp, sp, "reload-period") && sp < ep) { + num = strtol(sp + 1, &numend, 10); + if (numend == ep && num > 0 && num <= USHRT_MAX) { + if (ext != NULL) + ext->reload_period = (u_short)num; +#ifdef DEBUG + if (statp->options & RES_DEBUG) + printf(";;\treload-period %hu\n", + (u_short)num); +#endif } - } #ifdef RES_USE_EDNS0 - else if (!strncmp(cp, "edns0", sizeof("edns0") - 1)) { + } else if (res_match(cp, ep, "edns0")) { statp->options |= RES_USE_EDNS0; - } #endif #ifndef _LIBC - else if (!strncmp(cp, "dname", sizeof("dname") - 1)) { + } else if (res_match(cp, ep, "dname")) { statp->options |= RES_USE_DNAME; - } - else if (!strncmp(cp, "nibble:", sizeof("nibble:") - 1)) { - if (ext == NULL) - goto skip; - cp += sizeof("nibble:") - 1; - i = MIN(strcspn(cp, " \t"), sizeof(ext->nsuffix) - 1); - strncpy(ext->nsuffix, cp, i); - ext->nsuffix[i] = '\0'; - } - else if (!strncmp(cp, "nibble2:", sizeof("nibble2:") - 1)) { - if (ext == NULL) - goto skip; - cp += sizeof("nibble2:") - 1; - i = MIN(strcspn(cp, " \t"), sizeof(ext->nsuffix2) - 1); - strncpy(ext->nsuffix2, cp, i); - ext->nsuffix2[i] = '\0'; - } - else if (!strncmp(cp, "v6revmode:", sizeof("v6revmode:") - 1)) { - cp += sizeof("v6revmode:") - 1; + } else if (res_match(cp, sp, "nibble") && sp < ep) { + sp++; + if (ext != NULL && ep - sp < sizeof(ext->nsuffix)) { + memcpy(ext->nsuffix, sp, ep - sp); + ext->nsuffix[ep - sp] = '\0'; + } + } else if (res_match(cp, sp, "nibble2") && sp < ep) { + sp++; + if (ext != NULL && ep - sp < sizeof(ext->nsuffix2)) { + memcpy(ext->nsuffix2, sp, ep - sp); + ext->nsuffix2[ep - sp] = '\0'; + } + } else if (res_match(cp, sp, "v6revmode") && sp < ep) { /* "nibble" and "bitstring" used to be valid */ - if (!strncmp(cp, "single", sizeof("single") - 1)) { + if (res_match(sp + 1, ep, "single")) statp->options |= RES_NO_NIBBLE2; - } else if (!strncmp(cp, "both", sizeof("both") - 1)) { - statp->options &= - ~RES_NO_NIBBLE2; - } - } + else if (res_match(sp + 1, ep, "both")) + statp->options &= ~RES_NO_NIBBLE2; +#ifdef DEBUG + else + printf(";;\t%.*s: unrecognized value: %.*s\n", + (int)(sp - cp), cp, + (int)(ep - sp - 1), sp + 1); #endif - else { - /* XXX - print a warning here? */ - } -#ifndef _LIBC - skip: +#endif /* !_LIBC */ + } else { +#ifdef DEBUG + printf(";;\tunrecognized option: %.*s\n", + (int)(ep - cp), cp); #endif - /* skip to next run of spaces */ - while (*cp && *cp != ' ' && *cp != '\t') - cp++; + } + cp = ep; } } From nobody Mon Jul 6 12:24:28 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 4gv3Ss46bLz6jS72 for ; Mon, 06 Jul 2026 12:24:29 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv3Ss1JXlz3gp6 for ; Mon, 06 Jul 2026 12:24:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783340669; 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=GvlIr6TboIyWZ+B5CaDwTaE+CaOmfwxUGJY6Yf91zs0=; b=tW3pqR+xA+OJJPLVsmd8WSwjOYLUebh9sPI5jCsbS9PZOaQUNuc6ez5MnbdKijN8jT9Zw9 1d9rUZAcQLRKB89kwOqA3xjqw+NkJvkeJfYS61TGN0fehFSEVWp7HE90POUVJKuWg008m/ BZkwBFQpvClaAu2L6z+xRUqrS5PrLIupAOi9GXVZdq7FKrq4QZyxHmNEbC9EiNr4f48HZ9 TDa3DPJHC0mVlhUIAAi3V4+yU9vFz1yEltLllux4aA7VorQxRjKLAF84Mb6qD9781AqJ4I GkcJLqD3RmeF0KEEoqQWPqkeuFafqdKIApjtzyn7OrTfuXVU4nEH0rfdmuGevg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783340669; a=rsa-sha256; cv=none; b=pO/MTdiaNuNC3/0DkXiwUpL1wH9RbqZbqWQjZQ4l69MCU24MX2Tm9HENMTPulUE4onKevi uI+lDB7301Qz2jxWajh6QpkWsOwZ9yLsqHCYCf1HQCggSoG7PW7SyYH/kAl5HE8NjSlnTk TFSePYaHniM4v8LZdL6M90FjqIOv27HPGuh/H1YPXUrKc2uL0Blo/g9kQiKS6BHKSW9JfV MIMyp8OkaHmoeeyOaRD5q/YN66U292TM7+RbWoY6E1Ykv+xOlUMklaBfkrWzDvK9CAMmDi guo8oT3HgZcAhDk8KDZzaLzRa4Bscj22JyHVpAa5tuPGEEr+53QLgMgFVg4Crw== 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=1783340669; 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=GvlIr6TboIyWZ+B5CaDwTaE+CaOmfwxUGJY6Yf91zs0=; b=d9PfYi2bELPFoElmReTfyEAsLjdXe0p5wnp4K8cy8/tLPN0QhYycol+p4UHyqshT7puFfi 7FBvAKRgZtHls3DPYMmuU8U82GGmuXBhD/YzHd2gSfaNfISUEOCj/XPAQQNMOi46cuUwqf WdT+Wxhh/7O4LlL9Pl1S9Fqol5gnfbFDnij19gSaYYImYCbwxbd43pU5JSCVzqcCvA4SMT fU6Dcc3yoXLcRr8HnpGIEUj8b/TbN4tugl4M15YRXAEZYseltGgJsos+YpNzm91+b3w8az 6ngWRqMVT5Z2VhiKVb9UOvfR1lbHBhISjizWr7l4MK/JUDjorKyP40VZ8hV2Yg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv3Sr5bPDz147R for ; Mon, 06 Jul 2026 12:24:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3a45f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 12:24:28 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: fbe0257b5613 - main - libc/resolv: Reimplement the sortlist parser 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fbe0257b5613f457af42f82efb2e3bc9395d0557 Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 12:24:28 +0000 Message-Id: <6a4b9e7c.3a45f.1bda28f6@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=fbe0257b5613f457af42f82efb2e3bc9395d0557 commit fbe0257b5613f457af42f82efb2e3bc9395d0557 Author: Dag-Erling Smørgrav AuthorDate: 2026-07-06 12:23:37 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-07-06 12:23:37 +0000 libc/resolv: Reimplement the sortlist parser When we switched from the BIND4 resolver to the BIND9 resolver, the sortlist parser was inadvertently disabled due to a missing #define, and nobody seemed to notice. The sorting code remained enabled in the resolver, but there was no way to set a sort order. Reimplement the sortlist parser, but correctly, and update the manual accordingly. The new parser accepts IPv4 and IPv6 addresses with or without a mask or prefix length, just like the old one, except IPv6 support was a bit wonky in the original code. Fixes: 5342d17f09a8 ("Update the resolver in libc to BIND9's one.") Relnotes: yes Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D57925 --- lib/libc/resolv/Makefile.inc | 1 + lib/libc/resolv/res_init.c | 246 ++++++++++++++++++++++++------------------- share/man/man5/resolver.5 | 36 ++++--- 3 files changed, 160 insertions(+), 123 deletions(-) diff --git a/lib/libc/resolv/Makefile.inc b/lib/libc/resolv/Makefile.inc index be900e942435..ecb0c2462b08 100644 --- a/lib/libc/resolv/Makefile.inc +++ b/lib/libc/resolv/Makefile.inc @@ -7,4 +7,5 @@ SRCS+= herror.c h_errno.c mtctxres.c res_comp.c res_data.c res_debug.c \ SYM_MAPS+= ${LIBC_SRCTOP}/resolv/Symbol.map +CFLAGS+=-I${LIBC_SRCTOP}/net CFLAGS+=-I${SRCTOP}/lib/libmd diff --git a/lib/libc/resolv/res_init.c b/lib/libc/resolv/res_init.c index bd3fd866c189..120b30fc74f5 100644 --- a/lib/libc/resolv/res_init.c +++ b/lib/libc/resolv/res_init.c @@ -95,6 +95,7 @@ /* ensure that sockaddr_in6 and IN6ADDR_ANY_INIT are declared / defined */ #include +#include "res_config.h" #include "res_private.h" static void res_readconf(res_state, const char *, int); @@ -104,10 +105,8 @@ static int res_setnsaddr(res_state, int, const char *, const char *); static void res_setoptions(res_state, const char *, const char *); #ifdef RESOLVSORT -static const char sort_mask[] = "/&"; -#define ISSORTMASK(ch) (strchr(sort_mask, ch) != NULL) -static u_int32_t net_mask(struct in_addr); -#endif +static int res_setsortlist(res_state, int, const char *, const char *); +#endif /* RESOLVSORT */ #define res_space(ch) \ isspace((unsigned char)(ch)) @@ -285,8 +284,7 @@ res_readconf(res_state statp, const char *resconf, int maxns) size_t sz = 0; int nserv = 0; #ifdef RESOLVSORT - int n, nsort = 0; - char *net; + int nsort = 0; #endif if ((fp = fopen(resconf, "re")) == NULL) @@ -357,101 +355,28 @@ res_readconf(res_state statp, const char *resconf, int maxns) continue; } #ifdef RESOLVSORT + /* read result sort order */ if (res_match(line, eow, "sortlist")) { - struct in_addr a; - struct in6_addr a6; - int m, i; - u_char *u; - struct __res_state_ext *ext = statp->_u._ext.ext; - - cp = line + sizeof("sortlist") - 1; while (nsort < MAXRESOLVSORT) { - while (*cp == ' ' || *cp == '\t') + cp = eow; + while (cp < eol && res_space(*cp)) cp++; - if (*cp == '\0' || *cp == '\n' || *cp == ';') + if (cp == eol) break; - net = cp; - while (*cp && !ISSORTMASK(*cp) && *cp != ';' && - isascii(*cp) && !isspace((unsigned char)*cp)) - cp++; - n = *cp; - *cp = 0; - if (inet_aton(net, &a)) { - statp->sort_list[nsort].addr = a; - if (ISSORTMASK(n)) { - *cp++ = n; - net = cp; - while (*cp && *cp != ';' && - isascii(*cp) && - !isspace((unsigned char)*cp)) - cp++; - n = *cp; - *cp = 0; - if (inet_aton(net, &a)) { - statp->sort_list[nsort].mask = a.s_addr; - } else { - statp->sort_list[nsort].mask = - net_mask(statp->sort_list[nsort].addr); - } - } else { - statp->sort_list[nsort].mask = - net_mask(statp->sort_list[nsort].addr); - } - ext->sort_list[nsort].af = AF_INET; - ext->sort_list[nsort].addr.ina = - statp->sort_list[nsort].addr; - ext->sort_list[nsort].mask.ina.s_addr = - statp->sort_list[nsort].mask; - nsort++; - } - else if (inet_pton(AF_INET6, net, &a6) == 1) { - - ext->sort_list[nsort].af = AF_INET6; - ext->sort_list[nsort].addr.in6a = a6; - u = (u_char *)&ext->sort_list[nsort].mask.in6a; - *cp++ = n; - net = cp; - while (*cp && *cp != ';' && - isascii(*cp) && !isspace(*cp)) - cp++; - m = n; - n = *cp; - *cp = 0; - switch (m) { - case '/': - m = atoi(net); - break; - case '&': - if (inet_pton(AF_INET6, net, u) == 1) { - m = -1; - break; - } - /*FALLTHROUGH*/ - default: - m = sizeof(struct in6_addr) * CHAR_BIT; - break; - } - if (m >= 0) { - for (i = 0; i < sizeof(struct in6_addr); i++) { - if (m <= 0) { - *u = 0; - } else { - m -= CHAR_BIT; - *u = (u_char)~0; - if (m < 0) - *u <<= -m; - } - u++; - } - } - statp->sort_list[nsort].addr.s_addr = - (u_int32_t)0xffffffff; - statp->sort_list[nsort].mask = - (u_int32_t)0xffffffff; + eow = cp; + while (eow < eol && !res_space(*eow)) + eow++; + if (res_setsortlist(statp, nsort, cp, eow)) nsort++; - } - *cp = n; } +#ifdef DEBUG + while (cp < eol && res_space(*cp)) + cp++; + if (cp < eol) { + printf(";; sortlist overflow: %.*s\n", + (int)(eol - cp), cp); + } +#endif continue; } #endif /* RESOLVSORT */ @@ -631,6 +556,122 @@ res_setnsaddr(res_state statp, int i, const char *str, const char *end) return (ret); } +#ifdef RESOLVSORT +/*% + * Parse a sortlist entry and insert it into the specified slot in the + * sortlist. Assumes no leading or trailing space. Returns 1 if an entry + * was inserted, 0 otherwise. + */ +static int +res_setsortlist(res_state statp, int i, const char *str, const char *end) +{ + struct __res_state_ext *ext = statp->_u._ext.ext; + char addr[48], mask[48], *dst, *numend; + _Static_assert(sizeof(addr) > INET6_ADDRSTRLEN, + "address buffer too small for AF_INET6"); + _Static_assert(sizeof(addr) > INET_ADDRSTRLEN, + "address buffer too small for AF_INET"); + _Static_assert(sizeof(mask) > INET6_ADDRSTRLEN, + "mask buffer too small for AF_INET6"); + _Static_assert(sizeof(mask) > INET_ADDRSTRLEN, + "mask buffer too small for AF_INET"); + struct in_addr a; + struct in6_addr a6; + uint8_t *u; + long num; + + /* copy the address */ + dst = addr; + while (str < end && !res_space(*str) && *str != '/') { + *dst++ = *str++; + if (dst == addr + sizeof(addr)) + return (0); + } + *dst = '\0'; + + /* copy the mask, if there is one */ + dst = mask; + if (str < end) { + if (*str++ != '/') + return (0); + if (end - str >= sizeof(mask)) + return (0); + memcpy(mask, str, end - str); + dst += end - str; + } + *dst = '\0'; + + /* IPv4 case */ + if (inet_pton(AF_INET, addr, &a) == 1) { + statp->sort_list[i].addr = a; + if (strchr(mask, '.') && + inet_pton(AF_INET, mask, &a) == 1) { + statp->sort_list[i].mask = a.s_addr; + } else if (*mask != '\0') { + if ((num = strtol(mask, &numend, 10)) < 0 || + num > 32 || *numend != '\0') + return (0); + statp->sort_list[i].mask = + num == 0 ? 0 : + htonl(0xffffffffU << (32 - num)); + } else if (IN_CLASSA(ntohl(a.s_addr))) { + statp->sort_list[i].mask = + htonl(IN_CLASSA_NET); + } else if (IN_CLASSB(ntohl(a.s_addr))) { + statp->sort_list[i].mask = + htonl(IN_CLASSB_NET); + } else if (IN_CLASSC(ntohl(a.s_addr))) { + statp->sort_list[i].mask = + htonl(IN_CLASSC_NET); + } else { + statp->sort_list[i].mask = + htonl(IN_NETMASK_DEFAULT); + } + ext->sort_list[i].af = AF_INET; + ext->sort_list[i].addr.ina = + statp->sort_list[i].addr; + ext->sort_list[i].mask.ina.s_addr = + statp->sort_list[i].mask; +#ifdef DEBUG + inet_ntop(AF_INET, &statp->sort_list[i].addr, + addr, sizeof(addr)); + a.s_addr = statp->sort_list[i].mask; + inet_ntop(AF_INET, &a, mask, sizeof(mask)); + printf(";; sortlist %s/%s\n", addr, mask); +#endif + return (1); + } + + /* IPv6 case */ + if (inet_pton(AF_INET6, addr, &a6) == 1) { + statp->sort_list[i].addr.s_addr = INADDR_NONE; + statp->sort_list[i].mask = INADDR_NONE; + ext->sort_list[i].af = AF_INET6; + ext->sort_list[i].addr.in6a = a6; + if (*mask != '\0') { + /* prefix length */ + if ((num = strtol(mask, &numend, 10)) < 0 || + num > 128 || *numend != '\0') + return (0); + } else { + num = 64; + } +#ifdef DEBUG + inet_ntop(AF_INET6, &a6, addr, sizeof(addr)); + printf(";; sortlist %s/%ld\n", addr, num); +#endif + a6 = (struct in6_addr)IN6ADDR_ANY_INIT; + for (u = a6.s6_addr8; num > 0; num -= 8) + *u++ = num > 8 ? 0xffU : 0xffU << (8 - num); + ext->sort_list[i].mask.in6a = a6; + return (1); + } + + /* invalid */ + return (0); +} +#endif /* RESOLVSORT */ + /*% * Split the string up into words and interpret them as resolver options. */ @@ -775,21 +816,6 @@ res_setoptions(res_state statp, const char *options, const char *source) } } -#ifdef RESOLVSORT -/* XXX - should really support CIDR which means explicit masks always. */ -static u_int32_t -net_mask(struct in_addr in) /*!< XXX - should really use system's version of this */ -{ - u_int32_t i = ntohl(in.s_addr); - - if (IN_CLASSA(i)) - return (htonl(IN_CLASSA_NET)); - else if (IN_CLASSB(i)) - return (htonl(IN_CLASSB_NET)); - return (htonl(IN_CLASSC_NET)); -} -#endif - void freebsd15_res_rndinit(res_state statp) { diff --git a/share/man/man5/resolver.5 b/share/man/man5/resolver.5 index c9e7526ab865..749ffba21fbd 100644 --- a/share/man/man5/resolver.5 +++ b/share/man/man5/resolver.5 @@ -100,20 +100,30 @@ for one of the domains. .Pp The search list is currently limited to six domains with a total of 256 characters. -.It Sy sortlist -Sortlist allows addresses returned by the resolver to be sorted. -A sortlist is specified by IP address netmask pairs. -If the netmask is not specified, -it defaults to the historical Class A/B/C netmask of the net; -this usage is deprecated. -The IP address -and network pairs are separated by slashes. -Up to 10 pairs may -be specified. -E.g., +.It Cm sortlist Ar addr1 Ns Oo Li / Ns Ar plen1 Oc Op addr2 Ns Oo Li / Ns Ar plen2 Oc ... +Sort order for query results in the form of a list of +.Ar addr Ns Li / Ns Ar mask +or +.Ar addr Ns Li / Ns Ar plen +entries, for instance: +.Bd -literal +sortlist 198.51.100.0/24 203.0.113.0/255.255.255.0 2001:db8::/32 +.Ed +.Pp +Masks are only supported for IPv4. +If the mask or prefix length is omitted, it defaults to historical +class-based addressing for IPv4 and to 64 for IPv6. +.Pp +Query results that match one of the sort list entries are sorted +accordingly and ahead of query results that don't. +If multiple results match a single sort list entry, the order is +unspecified. .Pp -.Dl "sortlist 10.9.1.0/255.255.240.0 10.9.0.0/255.255.0.0" -.It Cm options Ar option1 Op Ar option2 ... +If multiple +.Cm sortlist +lines are encountered, entries are appended to the list in the order +in which they were encountered, up to a maximum of ten. +.It Cm options Options allows certain internal resolver variables to be modified. The following options are supported: .Bl -tag -width indent From nobody Mon Jul 6 12:24:24 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 4gv3Sm6rzyz6jSKf for ; Mon, 06 Jul 2026 12:24:24 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv3Sm3ccNz3gkF for ; Mon, 06 Jul 2026 12:24:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783340664; 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=4ghC1KWMc/JObLaDKrDNDm47lln7zbIlE1HAVUveLEs=; b=TU9U1lbasDjt5sNgLeInWCtf06CDspq26/0DPOKf3veZVeDpf77GycOwyevSoxS7Fghu48 AJGaEqAWFeXOuSEF9N0cdRVv/2DexXBVN5RCfTqnc3YeYeYg0RiAIqKx1rQ29ELgqsoKHy ZDIdPJ6A/yljCprQ+7Ncnws563A4Vuwn7Ch/yr7ZctO8pZl/Yc3EgTaqbgngpxer9+9nap chhbxptkDK+kgXIlIOuLfOJXAE5dlPGaYtYYW1GQolWcfnYL7t/aCqaP93/Gn8mAHBQGVu /ICcsrjiRoNm/BDowmVUiPUEkEnWl6Nxsfs+pTC3uMNHC5XNglo3Jo4LGxUA3A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783340664; a=rsa-sha256; cv=none; b=a8dfiFUjoIHcFiGC1DVpi/iHtOo5s+osUM5zhsBJmajAKWvvGQrls0hiG++g+vDwRgF8nr AyGCVyTwS0nqWgf/be0ZBYlpaG1sEoBiMpOgtoA/j0AjlE1xk8rLdEhCsAsp32gDNNHArY HBB0hHvZ6mNqgLmVyrPbpszrOl6hUH4HyrInmYrWcocuaYBsmPStXprGvdVD45DN1Sm2tc D2ffiMfyLA+izz7U9i9lAgxDl617xr4jWSTPOFAn9U5SHiqF1aKkbzn7qSZZTR+JVwEmxX 20js6ba2y/kegMQ9BdU+RoYkn4VXXK4ICdfjg6Fyg3kdt7ge7pYOJ8Ohr7Bgvg== 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=1783340664; 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=4ghC1KWMc/JObLaDKrDNDm47lln7zbIlE1HAVUveLEs=; b=JoVo6zYRmFgv/oWsc0aEnygmKMKd/aBgwZ0IWBpQ9+kAXt5hpdNrc70zozkdjrprZmEtlL X6ON3lUsrgq+sTwRrhSU+Bi5OfGjpIvG+yJqeWh7dQfEdabbTYTwtIDlPPW7nRO+ZdxDEe Egd06iZhg2hPfNFe+Ggps/bNT7OsDZp1UCXou/vsRjgVNgFDlLa38XKNTvv4JC6nQZOvce +jhE/lk9ZWgmbZCL2hI9zZtk+MTWx0YKVOng8dnlNxbMsaPokNwtouib+Tolta5jNBPw6x 69tOYMrdeyV/nxRqU1/GB4wXDdVWBUxe2XZtd71nF6Ygw6CozU4DPKr8a9Zj9A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv3Sm2Yxyz13qy for ; Mon, 06 Jul 2026 12:24:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3b046 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 12:24:24 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 4319e4bf42f2 - main - resolver(5): Overhaul 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4319e4bf42f2f5a71ac32cb18cef8f7677fdf7f7 Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 12:24:24 +0000 Message-Id: <6a4b9e78.3b046.3b68aa33@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=4319e4bf42f2f5a71ac32cb18cef8f7677fdf7f7 commit 4319e4bf42f2f5a71ac32cb18cef8f7677fdf7f7 Author: Dag-Erling Smørgrav AuthorDate: 2026-07-06 12:23:20 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-07-06 12:23:20 +0000 resolver(5): Overhaul * Modernize the markup * Describe the comment syntax * Drop obsolete advice * Capitalize sentences * Improve the language * Replace no_tld_query with no-tld-query; both are supported, but all the other multi-word options use hyphens rather than underscores. * Add missing ENVIRONMENT section * Redo the example MFC after: 1 week Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D57921 --- share/man/man5/resolver.5 | 227 +++++++++++++++++++++++----------------------- 1 file changed, 116 insertions(+), 111 deletions(-) diff --git a/share/man/man5/resolver.5 b/share/man/man5/resolver.5 index 4dd3f8c93a99..c9e7526ab865 100644 --- a/share/man/man5/resolver.5 +++ b/share/man/man5/resolver.5 @@ -1,5 +1,6 @@ .\" Copyright (c) 1986, 1991, 1993 .\" The Regents of the University of California. All rights reserved. +.\" Copyright (c) 2026 Dag-Erling Smørgrav .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -25,7 +26,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd March 15, 2026 +.Dd July 6, 2026 .Dt RESOLVER 5 .Os .Sh NAME @@ -40,57 +41,56 @@ is a set of routines in the C library which provide access to the Internet Domain Name System. The resolver configuration file contains information that is read by the resolver routines the first time they are invoked by a process. -The file is designed to be human readable and contains a list of -keywords with values that provide various types of resolver information. .Pp -On a normally configured system, setting this file manually should not -be necessary. -The only name server(s) to be queried will be on the local machine -or automatically configured using DHCP or a similar mechanism, -the domain name is determined from the host name, -and the domain search path is constructed from the domain name. -.Pp -The different configuration options are: -.Bl -tag -width nameserver -.It Sy nameserver -IPv4 or IPv6 address of a name server -that the resolver should query. +The file is read line by line. +Anything after a +.Sq # +or +.Sq \&; +character is considered a comment and discarded. +Blank lines are ignored. +The first word on each non-blank line is a keyword which determines +how the rest of the line is interpreted. +Available keywords are: +.Bl -tag -width indent +.It Cm nameserver Ar address +IPv4 or IPv6 address of a name server that the resolver should query. Up to .Dv MAXNS -(currently 3) name servers may be listed, -one per keyword. -If there are multiple servers, -the resolver library queries them in the order listed. +(currently 3) name servers may be listed on separate lines. +If there are multiple servers, the resolver library queries them in +the order listed, unless +.Dv RES_ROTATE +is in effect +.Po +See the +.Cm rotate +option below +.Pc . If no -.Sy nameserver +.Cm nameserver entries are present, the default is to use the name server on the local machine. (The algorithm used is to try a name server, and if the query times out, try the next, until out of name servers, then repeat trying all the name servers until a maximum number of retries are made). -.It Sy domain -Local domain name. +.It Cm domain Ar name +Set both the local domain name and the search list to +.Ar name . Most queries for names within this domain can use short names relative to the local domain. -If no -.Sy domain -entry is present, the domain is determined -from the local host name returned by +If no domain name has been set, it is derived from the local host name +returned by .Xr gethostname 3 ; the domain part is taken to be everything after the first .Ql \&. . Finally, if the host name does not contain a domain part, the root domain is assumed. -.It Sy search -Search list for host-name lookup. -The search list is normally determined from the local domain name; -by default, it contains only the local domain name. -This may be changed by listing the desired domain search path -following the -.Sy search -keyword with spaces or tabs separating -the names. +.It Cm search Ar name1 Op name2 ... +Set the domain search list. +Additionally, sets the local domain to +.Ar name1 . Most resolver queries will be attempted using each component of the search path in turn until a match is found. Note that this process may be slow and will generate a lot of network @@ -101,7 +101,7 @@ for one of the domains. The search list is currently limited to six domains with a total of 256 characters. .It Sy sortlist -Sortlist allows addresses returned by gethostbyname to be sorted. +Sortlist allows addresses returned by the resolver to be sorted. A sortlist is specified by IP address netmask pairs. If the netmask is not specified, it defaults to the historical Class A/B/C netmask of the net; @@ -113,26 +113,21 @@ be specified. E.g., .Pp .Dl "sortlist 10.9.1.0/255.255.240.0 10.9.0.0/255.255.0.0" -.It Sy options +.It Cm options Ar option1 Op Ar option2 ... Options allows certain internal resolver variables to be modified. -The syntax is -.Pp -\fBoptions\fP \fIoption\fP \fI...\fP -.Pp -where -.Sy option -is one of the following: -.Bl -tag -width no_tld_query -.It Sy debug -sets +The following options are supported: +.Bl -tag -width indent +.It Cm debug +Set .Dv RES_DEBUG -in _res.options. -.It Sy usevc -sets +in +.Va _res.options . +.It Cm usevc +Set .Dv RES_USEVC to use TCP instead of UDP for queries. -.It Sy ndots : Ns Ar n -sets a threshold for the number of dots which must appear in a name given to +.It Cm ndots Ns Li : Ns Ar n +Set a threshold for the number of dots which must appear in a name given to .Fn res_query (see .Xr resolver 3 ) @@ -147,8 +142,8 @@ meaning that if there are any dots in a name, the name will be tried first as an absolute name before any .Em search list elements are appended to it. -.It Sy timeout : Ns Ar n -sets the initial amount of time the resolver will wait +.It Cm timeout Ns Li : Ns Ar n +Set the initial amount of time the resolver will wait for a response from a remote name server before retrying the query via a different name server. The resolver may wait longer during subsequent retries @@ -160,8 +155,8 @@ the allowed maximum is .Dv RES_MAXRETRANS (see .In resolv.h ) . -.It Sy attempts : Ns Ar n -sets the number of times the resolver will send a query to each of +.It Cm attempts Ns Li : Ns Ar n +Set the number of times the resolver will send a query to each of its name servers before giving up and returning an error to the calling application. The default is @@ -170,118 +165,128 @@ the allowed maximum is .Dv RES_MAXRETRY (see .In resolv.h ) . -.It Sy edns0 -Sets +.It Cm edns0 +Set .Dv RES_USE_EDNS0 . Attach an OPT pseudo-RR for the EDNS0 extension, as specified in RFC 2671. This allows the resolver to advertise a larger UDP receive buffer size, permitting responses larger than the original 512-byte limit. -.It Sy inet6 -Sets +.It Cm inet6 +Set .Dv RES_USE_INET6 . -Causes -.Xr gethostbyname 3 +Causes the resolver to look up AAAA records before A records and to map IPv4 responses into IPv6 addresses. The use of this option is discouraged. -.It Sy insecure1 -Sets +.It Cm insecure1 +Set .Dv RES_INSECURE1 . -Disables the check that the response was received from the +This disables the check that the response was received from the same server to which the query was sent. Use of this option is a security risk and is not recommended. -.It Sy insecure2 -Sets +.It Cm insecure2 +Set .Dv RES_INSECURE2 . -Disables the check that the response contains a query +This disables the check that the response contains a query matching the one that was sent. Use of this option is a security risk and is not recommended. -.It Sy no-check-names -Sets +.It Cm no-check-names +Set .Dv RES_NOCHECKNAME . -Disables the check of incoming host names for invalid characters +This disables the check of incoming host names for invalid characters such as underscore, non-ASCII, or control characters. -.It Sy no_tld_query -tells the resolver not to attempt to resolve a top level domain name, that -is, a name that contains no dots. +.It Cm no-tld-query +Set +.Dv RES_NOTLDQUERY . +This tells the resolver not to attempt to resolve a top level domain +name, that is, a name that contains no dots. Use of this option does not prevent the resolver from obeying the standard -.Sy domain +.Cm domain and -.Sy search +.Cm search rules with the given name. -.It Sy rotate -Sets +.It Cm rotate +Set .Dv RES_ROTATE . -Causes the resolver to round-robin among the configured name servers, -distributing the query load instead of always trying the first -listed server. -.It Sy reload-period : Ns Ar n +This causes the resolver to round-robin among the configured name +servers, distributing the query load instead of always trying the +first listed server. +.It Cm reload-period Ns Li : Ns Ar n The resolver checks the modification time of .Pa /etc/resolv.conf -every +if more than .Ar n -seconds. -If -.Pa /etc/resolv.conf -has changed, it is automatically reloaded. +seconds have elapsed since the last check. +If the file has changed, it is automatically reloaded. The default for .Ar n is two seconds. Setting it to zero disables the file check. .El .Pp -Options may also be specified as a space or tab separated list using the +Options may also be passed as a space- or tab-separated list in the .Dv RES_OPTIONS environment variable. +This environment variable is applied after the configuration file has +been read. .El .Pp The -.Sy domain +.Cm domain and -.Sy search +.Cm search keywords are mutually exclusive. If more than one instance of these keywords is present, -the last instance will override. +the last instance will override all previous instances. .Pp The keyword and value must appear on a single line, and the keyword .Pq for example, Sy nameserver must start the line. The value follows the keyword, separated by white space. +.Sh ENVIRONMENT +.Bl -tag -width indent +.It Dv LOCALDOMAIN +If set, overrides the local domain and search list set in the resolver +configuration file. +.It Dv RES_OPTIONS +If set, its value is split into words and interpreted as resolver +options as described for the +.Cm options +keyword in the resolver configuration file. +.El .Sh FILES -.Bl -tag -width /etc/resolv.conf -compact +.Bl -tag -width indent .It Pa /etc/resolv.conf -The file -.Nm resolv.conf -resides in -.Pa /etc . +resolver configuration file .El .Sh EXAMPLES -A basic resolv.conf file could be in the following form. -.Bd -literal -offset indent -# The domain directive is only necessary, if your local -# router advertises something like localdomain and you have -# set up your hostnames via an external domain. -domain localdomain.tld +.Bd -literal +# Set the local domain to example.com and the search list to +# example.com, example.net, example.org +search example.com example.net example.org -# In case you a running a local dns server or caching name server -# like local-unbound(8) for example. +# Set the local domain and search list to example.com, +# completely overriding the previous line +domain example.com + +# Use this if you are running a local caching forwarding (or +# recursing) resolver like local-unbound(8) nameserver 127.0.0.1 # IP address of the local or ISP name service -nameserver 192.168.2.1 - -# Fallback nameservers, in this case these from Google. -nameserver 8.8.8.8 -nameserver 8.8.4.4 +nameserver 198.51.100.53 +nameserver 203.0.113.53 -# Attach an OPT pseudo-RR for the EDNS0 extension, -# as specified in RFC 2671. +# Enable EDNS0, which tells the name server that we are capable of +# handling large responses. This is required for DNSSEC. options edns0 .Ed .Sh SEE ALSO +.Xr getaddrinfo 3 , .Xr gethostbyname 3 , +.Xr gethostname 3 , .Xr resolver 3 , .Xr hostname 7 , .Xr resolvconf 8 From nobody Mon Jul 6 12:24:25 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 4gv3Sp0mv1z6jS1n for ; Mon, 06 Jul 2026 12:24:26 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv3Sn4Dylz3gTv for ; Mon, 06 Jul 2026 12:24:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783340665; 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=Qvy7KQ95ahNOscauuNt763mDyrV0ThH8bF65dSKjQ6g=; b=HgsCsa7yXAoW1BWPKmNx/Iq/88eAU3LiVhXTVolXUZ4VSIKf6/f92NnKvWxMGumxG4e26f o3flIaCRD4GDENBGSSqwFn5G0gee6DHG9Q8pF8KisrhR7dCpo4mtGTUrBJ4sRmsfMKqqfH Rv7hmzy/C9rmM2p3iuXyOlNVK7pNZXuTgwsswR4b54ANy+H93a2KVgZf85TIAtTwN2AaVF DnI84VFtTiAm5A68+qxG+jHth+EhsC45o98qHEOLc5keHtEDdBGUAceJHa2zrvG2TkgdjX ZTKvZcV9SreQvs9GJ2jZxYd9T589LdAAJYplga3DlX92FjmWnANGCZPSCxrlwQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783340665; a=rsa-sha256; cv=none; b=afYI0BwhLVZFhTft7JKGfw7KdjHo6cDpQaRcMweCeKaA7jHp9wgy9Z4RnQnBAKbtg0MGZ9 jmlcS1QcnF215+pxjYR6gm6aRhSUiLATKvPnq1GKv2mRgT540wvKBT9nwHLUJ4ubHAz8Ep pGZ9Ivac8ff4m7JDXBjjHbxTnu2C5jmmJ3Ao/mz/cNknaxpf+dqReOZivLIS4I4bqJXfVr nnquoy10VtOPs9siYdxcfVw3tlAnO4YznhAowlyamH/az/XTeqQNTfzuj02WWIZsDLFwmc dluWhgvVAQMsplf/wAtCA7tDKqSoju6+pP5FC2BaYCYEYt/PCf60gjabViDOnw== 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=1783340665; 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=Qvy7KQ95ahNOscauuNt763mDyrV0ThH8bF65dSKjQ6g=; b=eFLIZeySGeXztg36wVPiQ6AmIRGPK1Y6dBf92ZmYFo5Ms6USrVkH2J/z8PdiNnoj7exb+g 2lcdSbSMjN2Ytk4x278INXfDhSkOOIp16a9WhtzQYE+u8ej9YDnTpPRpsDeO/LMhD9S0U6 Tj0SALQycJbM8eVjTNk5iOJmIXNGqyM+tZ9PNimkMCG/TLV1jgQB1rHsAnseap+ulGGER3 bmfkr+ngtz1DaCzMxrIMohZd6G0NygDWset82x9KVyBTY6CUuQxZGPbo/mFPCRBcS7eUdY KdXbFs0GLury54Q49EYD65eYY7nunUS/F69+E9NOsYjEigpIsKVT4M04pActww== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv3Sn3GS1z13dq for ; Mon, 06 Jul 2026 12:24:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 39cbb by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 12:24:25 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: aba9fffebf97 - main - libc/resolv: Drop Solaris 2 compatibility 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aba9fffebf97d631f85e904813ff35ed031a3bac Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 12:24:25 +0000 Message-Id: <6a4b9e79.39cbb.5038d032@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=aba9fffebf97d631f85e904813ff35ed031a3bac commit aba9fffebf97d631f85e904813ff35ed031a3bac Author: Dag-Erling Smørgrav AuthorDate: 2026-07-06 12:23:24 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-07-06 12:23:24 +0000 libc/resolv: Drop Solaris 2 compatibility MFC after: 1 week Reviewed by: kevans, markj Differential Revision: https://reviews.freebsd.org/D57922 --- lib/libc/nameser/ns_parse.c | 5 ----- lib/libc/resolv/res_comp.c | 11 ----------- lib/libc/resolv/res_init.c | 42 ------------------------------------------ 3 files changed, 58 deletions(-) diff --git a/lib/libc/nameser/ns_parse.c b/lib/libc/nameser/ns_parse.c index 40f19d33c2bc..fa21127a5c7e 100644 --- a/lib/libc/nameser/ns_parse.c +++ b/lib/libc/nameser/ns_parse.c @@ -38,12 +38,7 @@ static void setsection(ns_msg *msg, ns_sect sect); /* Macros. */ -#if !defined(SOLARIS2) || defined(__COVERITY__) #define RETERR(err) do { errno = (err); return (-1); } while (0) -#else -#define RETERR(err) \ - do { errno = (err); if (errno == errno) return (-1); } while (0) -#endif #define PARSE_FMT_PRESO 0 /* Parse using presentation-format names */ #define PARSE_FMT_WIRE 1 /* Parse using network-format names */ diff --git a/lib/libc/resolv/res_comp.c b/lib/libc/resolv/res_comp.c index 55b71266b4ae..d9edcc9a4930 100644 --- a/lib/libc/resolv/res_comp.c +++ b/lib/libc/resolv/res_comp.c @@ -240,17 +240,6 @@ res_dnok(const char *dn) { * Note that one _ comes from C and the others come from us. */ -#ifdef SOLARIS2 -#ifdef __putlong -#undef __putlong -#endif -#ifdef __putshort -#undef __putshort -#endif -#pragma weak putlong = __putlong -#pragma weak putshort = __putshort -#endif /* SOLARIS2 */ - void __putlong(u_int32_t src, u_char *dst) { ns_put32(src, dst); } void __putshort(u_int16_t src, u_char *dst) { ns_put16(src, dst); } #ifndef __ultrix__ diff --git a/lib/libc/resolv/res_init.c b/lib/libc/resolv/res_init.c index b21a3fa1670f..e9e982fe27bb 100644 --- a/lib/libc/resolv/res_init.c +++ b/lib/libc/resolv/res_init.c @@ -95,10 +95,6 @@ #include "res_private.h" -#ifdef SOLARIS2 -#include -#endif - static void res_setoptions(res_state, const char *, const char *); #ifdef RESOLVSORT @@ -219,28 +215,6 @@ __res_vinit(res_state statp, int preinit) { #endif res_setservers(statp, u, nitems(u)); -#ifdef SOLARIS2 - /* - * The old libresolv derived the defaultdomain from NIS/NIS+. - * We want to keep this behaviour - */ - { - char buf[sizeof(statp->defdname)], *cp; - int ret; - - if ((ret = sysinfo(SI_SRPC_DOMAIN, buf, sizeof(buf))) > 0 && - (unsigned int)ret <= sizeof(buf)) { - if (buf[0] == '+') - buf[0] = '.'; - cp = strchr(buf, '.'); - cp = (cp == NULL) ? buf : (cp + 1); - strncpy(statp->defdname, cp, - sizeof(statp->defdname) - 1); - statp->defdname[sizeof(statp->defdname) - 1] = '\0'; - } - } -#endif /* SOLARIS2 */ - /* Allow user to override the local domain definition */ if ((cp = secure_getenv("LOCALDOMAIN")) != NULL) { (void)strncpy(statp->defdname, cp, sizeof(statp->defdname) - 1); @@ -580,22 +554,6 @@ res_setoptions(res_state statp, const char *options, const char *source) if (statp->options & RES_DEBUG) printf(";;\ttimeout=%d\n", statp->retrans); #endif -#ifdef SOLARIS2 - } else if (!strncmp(cp, "retrans:", sizeof("retrans:") - 1)) { - /* - * For backward compatibility, 'retrans' is - * supported as an alias for 'timeout', though - * without an imposed maximum. - */ - statp->retrans = atoi(cp + sizeof("retrans:") - 1); - } else if (!strncmp(cp, "retry:", sizeof("retry:") - 1)){ - /* - * For backward compatibility, 'retry' is - * supported as an alias for 'attempts', though - * without an imposed maximum. - */ - statp->retry = atoi(cp + sizeof("retry:") - 1); -#endif /* SOLARIS2 */ } else if (!strncmp(cp, "attempts:", sizeof("attempts:") - 1)){ i = atoi(cp + sizeof("attempts:") - 1); if (i <= RES_MAXRETRY) From nobody Mon Jul 6 12:24:29 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 4gv3St3SCnz6jRyn for ; Mon, 06 Jul 2026 12:24:30 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv3St0L7Mz3gGD for ; Mon, 06 Jul 2026 12:24:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783340670; 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=74WmdG2/0EyGIDrHLtCvhu6KyGnonn8wvycmnx+giFE=; b=qcrENBo+tgb7sM73bV+uBC427ziCrR5xb62qVI1EMOnOC+g+nRr15fTVKOU5/4nXEqBJQU 48MFbUZXArm+C+LRXFQzkMPem1imMwIy8e73ItmBCxm7ka0jHYyFdh6RZciy+102Q02w9K eTM6NtoNfxChmgfT0e/JYWrZIBWC1rHVWomqlcpplaw8iQ7tVS/dA2cB5gaA57BS5uMBA+ 3y37Hzalb+da6wszAkbuLYicyJ7B1FQJdmJ0mCjwhHLDBFPEag6jNZpgvfSWm8W4YuLBp5 of1E4976W2A5WVfqWy+feWZLFtMaqfZxNqTKrVjMkxDZCif1H16d6tdZriCzTQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783340670; a=rsa-sha256; cv=none; b=mOtQpt1PLytBzsavbjRlFg3UcvU+lfs5sxLzkZ/DNVZLiGaWbwf9RmBTBANq0kAu5fDl0S FZU2ZTGp934g0tZMuXGFtDB365V17DJqKEWlTJM7FPTgX3zvMryJ9It9GOIwxiqdQYnHfd vKl/ejvoUuuDmApHRTjX3lpy/JI/Zs/PhhneRe5O0pC2gZs03j97eWjpGbNv4WZdvZcpfp JhdR7KOFJF9uyzs6eOyJ8hqm9l5FW4tl7Czyd62L1/t/EBkXnImkDyGEGCufICNskKUi31 y26xvQl5Iov2tUaT5dqVBLxK03ULgLZyUZIfQfvq8fnAdPC1RZGqoLbS/eHsYQ== 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=1783340670; 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=74WmdG2/0EyGIDrHLtCvhu6KyGnonn8wvycmnx+giFE=; b=C98Xojo1uoYUoPkqne5H/AVteFt+pCucqfpTTa06ZL9zU8m4cjUyvXCAOpzJS1r1vn9XK8 cMDMF2slGsXWEQf8IWgf1g/2B/D1aFpEbuqZ5TDY1jNY1Ei7+ZGL8jTghlKoTxeKVN+p7W d9sxiQ3oPWorPu8ljy72XPsVU2wRMYdmwl22Is6huil2qmy3Cr8iPgcmfY+PwZM8Xu6tVh ZmNFnsR5MiRlkZCsdJBPVEy+Klu5/0o6/qQWYtjFpuIpjHslGjsdRBugVEL5tjKMl3Op4z EIOyK7V7tpQSfJlK05K95eSahb1MDByrP4dvKmbsR+ysoyFhL6zfXLcs+4quQA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv3Ss6W0gz13r1 for ; Mon, 06 Jul 2026 12:24:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 39f5d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 12:24:29 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 60827d788501 - main - libc/resolv: Add no-debug and no-rotate options 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 60827d7885016861dc02caa45f3ce873ad2a020e Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 12:24:29 +0000 Message-Id: <6a4b9e7d.39f5d.628c9d9d@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=60827d7885016861dc02caa45f3ce873ad2a020e commit 60827d7885016861dc02caa45f3ce873ad2a020e Author: Dag-Erling Smørgrav AuthorDate: 2026-07-06 12:23:43 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-07-06 12:23:43 +0000 libc/resolv: Add no-debug and no-rotate options These are simply the reverse of the debug and rotate options. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D57926 --- lib/libc/resolv/res_init.c | 4 ++++ share/man/man5/resolver.5 | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/lib/libc/resolv/res_init.c b/lib/libc/resolv/res_init.c index 120b30fc74f5..a9b2d5c582c8 100644 --- a/lib/libc/resolv/res_init.c +++ b/lib/libc/resolv/res_init.c @@ -746,6 +746,10 @@ res_setoptions(res_state statp, const char *options, const char *source) #ifdef DEBUG printf(";;\tdebug\n"); #endif + } else if (res_match(cp, ep, "no-debug")) { + statp->options &= ~RES_DEBUG; + } else if (res_match(cp, ep, "no-rotate")) { + statp->options &= ~RES_ROTATE; } else if (res_match(cp, ep, "no-tld-query") || res_match(cp, ep, "no_tld_query")) { statp->options |= RES_NOTLDQUERY; diff --git a/share/man/man5/resolver.5 b/share/man/man5/resolver.5 index 749ffba21fbd..3951aa750a96 100644 --- a/share/man/man5/resolver.5 +++ b/share/man/man5/resolver.5 @@ -206,6 +206,18 @@ Set .Dv RES_NOCHECKNAME . This disables the check of incoming host names for invalid characters such as underscore, non-ASCII, or control characters. +.It Cm no-debug +Clears +.Dv RES_DEBUG . +See +.Cm debug +above. +.It Cm no-rotate +Clears +.Dv RES_ROTATE . +See +.Cm rotate +below. .It Cm no-tld-query Set .Dv RES_NOTLDQUERY . From nobody Mon Jul 6 12:24:31 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 4gv3Sv5q9Dz6jSKh for ; Mon, 06 Jul 2026 12:24:31 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv3Sv19zSz3gkK for ; Mon, 06 Jul 2026 12:24:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783340671; 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=Qabqo3tL9RU1LA1bQqUi0fLzmZPPOXPVZzYOEl5qrrg=; b=sayoHOnlh3llGi8e5+81pyb8DeA37wiJddmKhuogAd/sGQNqQ5N9w8E9KNVwsw67j23jNh 8LbYEgk3sR5sinGgu1FpC7GdSjA2iBEanSzsqdq8E4g+pTzr/7Jecw7zrEE1jnPtlQyrcE X8fURZXTb/O+iAjfD+X6qC2gzJvf6BpjtgI4Sy9KtkDZ4uE55SySXedzPLgEItFGFG7KRP msAHjsR00ztC5LzK62oCvbCm+QyNf9DN9rf81gXJZlLz4AISCaSyBP/1+Y1XW6H+bmk2EQ I8fcR/gnPOHIQPs2jMX+bG0XAPLBxbPWeStTpyhJo+rnENZUqPv9/pgaVCpE9A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783340671; a=rsa-sha256; cv=none; b=Xu44dFfZP/3f8BdMdgI2UefCsMbagfpNvjUzyh6AOkd+uzeA9lslX8EBwlpDjUlAmSKCEW DoSARU8Lxeje1rAU8erjXnvGj+aXdo3DEGLt5zPatdMIyTWvvQH9zEv+iXnlidU22u6W+U WtbEO7JfFv9lB1sVTNLAVCD8fP9SyOyhAn+Q0gyc7ewiGw86oKjWoWfpSvvPblGYZCcI4Y QDfPS/K4y0SRI/XG8tgCuWlpyRb3pWt9lsToEsKsUhoCudNNCAjLjWVvsd4BRYwcI5zF3R rUKsf69q0172xJGM8H9A0sVkcx2ZEHutnd0rXkaoKAnvKS71buTODGtLzDGTWw== 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=1783340671; 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=Qabqo3tL9RU1LA1bQqUi0fLzmZPPOXPVZzYOEl5qrrg=; b=ZBwQrq8SGI4xcvzxjdge9g6VP/9jDE61AMOvDI64uwQYiNwrnmwxRkLFcve7ysazjLkOEL nKuARqrwvr+vqpSXsV+9EpnBnhH32pj2/dsWPeEZEXzbLTuBY059tB7NNPzYqgDH1R8icz GoT9wtSp/e5xvKovnAk7UMLbYFggmIoSafOHZA9A67g6/roFeQfPLKQqmcZK4JVC9pEwU5 9Nt4Hkj0y8gK/QVSddW7iFkPIizSPE7JE2N0pyUlAkxhFpkkGaewwPbd+8C7d1sFF6dj+B 8hBsylEraPODzlgQj5WhP71sMQRueyvNP0G+79BWFjSCW4B5eUJJfu1QJh2Ofg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv3Sv0DkHz13PY for ; Mon, 06 Jul 2026 12:24:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3a463 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 12:24:31 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 3f15998d25da - main - resolv.h: Remove unused parts 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3f15998d25da08677d2c40bc2240de293aec4205 Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 12:24:31 +0000 Message-Id: <6a4b9e7f.3a463.5ec687d3@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=3f15998d25da08677d2c40bc2240de293aec4205 commit 3f15998d25da08677d2c40bc2240de293aec4205 Author: Dag-Erling Smørgrav AuthorDate: 2026-07-06 12:23:50 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-07-06 12:23:50 +0000 resolv.h: Remove unused parts Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D57927 --- include/resolv.h | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) diff --git a/include/resolv.h b/include/resolv.h index 6ef79601b5f8..8514339a1618 100644 --- a/include/resolv.h +++ b/include/resolv.h @@ -148,11 +148,7 @@ struct __res_state { * it breaks binary backward compatibility against FreeBSD's * resolver. So, we changed not to see `sun'. */ -#if defined(sun) && 0 - u_int options; /*%< option flags - see below. */ -#else u_long options; /*%< option flags - see below. */ -#endif int nscount; /*%< number of name servers */ struct sockaddr_in nsaddr_list[MAXNS]; /*%< address of name server */ @@ -160,11 +156,7 @@ struct __res_state { u_short id; /*%< current message id */ char *dnsrch[MAXDNSRCH+1]; /*%< components of domain to search */ char defdname[256]; /*%< default domain (deprecated) */ -#if defined(sun) && 0 - u_int pfcode; /*%< RES_PRF_ flags - see below. */ -#else u_long pfcode; /*%< RES_PRF_ flags - see below. */ -#endif unsigned ndots:4; /*%< threshold for initial abs. query */ unsigned nsort:4; /*%< number of elements in sort_list[] */ char unused[3]; @@ -195,9 +187,7 @@ typedef struct __res_state *res_state; union res_sockaddr_union { struct sockaddr_in sin; -#ifdef IN6ADDR_ANY_INIT struct sockaddr_in6 sin6; -#endif #ifdef ISC_ALIGN64 int64_t __align64; /*%< 64bit alignment */ #else @@ -358,9 +348,6 @@ extern const struct res_sym __p_rcode_syms[]; #define putlong __putlong #define putshort __putshort #define res_dnok __res_dnok -#if 0 -#define res_findzonecut __res_findzonecut -#endif #define res_findzonecut2 __res_findzonecut2 #define res_hnok __res_hnok #define res_hostalias __res_hostalias @@ -374,9 +361,6 @@ extern const struct res_sym __p_rcode_syms[]; #define res_nquerydomain __res_nquerydomain #define res_nsearch __res_nsearch #define res_nsend __res_nsend -#if 0 -#define res_nsendsigned __res_nsendsigned -#endif #define res_nisourserver __res_nisourserver #define res_ownok __res_ownok #define res_queriesmatch __res_queriesmatch @@ -392,24 +376,9 @@ extern const struct res_sym __p_rcode_syms[]; #define res_nametotype __res_nametotype #define res_setservers __res_setservers #define res_getservers __res_getservers -#if 0 -#define res_buildprotolist __res_buildprotolist -#define res_destroyprotolist __res_destroyprotolist -#define res_destroyservicelist __res_destroyservicelist -#define res_get_nibblesuffix __res_get_nibblesuffix -#define res_get_nibblesuffix2 __res_get_nibblesuffix2 -#endif #define res_ourserver_p __res_ourserver_p -#if 0 -#define res_protocolname __res_protocolname -#define res_protocolnumber __res_protocolnumber -#endif #define res_send_setqhook __res_send_setqhook #define res_send_setrhook __res_send_setrhook -#if 0 -#define res_servicename __res_servicename -#define res_servicenumber __res_servicenumber -#endif __BEGIN_DECLS int res_hnok(const char *); int res_ownok(const char *); @@ -425,10 +394,8 @@ const char * loc_ntoa(const u_char *, char *); int dn_skipname(const u_char *, const u_char *); void putlong(u_int32_t, u_char *); void putshort(u_int16_t, u_char *); -#ifndef __ultrix__ u_int16_t _getshort(const u_char *); u_int32_t _getlong(const u_char *); -#endif const char * p_class(int); const char * p_time(u_int32_t); const char * p_type(int); @@ -465,12 +432,6 @@ int res_nmkquery(res_state, int, const char *, int, int, const u_char *, int, const u_char *, u_char *, int); int res_nsend(res_state, const u_char *, int, u_char *, int); -#if 0 -int res_nsendsigned(res_state, const u_char *, int, - ns_tsig_key *, u_char *, int); -int res_findzonecut(res_state, const char *, ns_class, int, - char *, size_t, struct in_addr *, int); -#endif int res_findzonecut2(res_state, const char *, ns_class, int, char *, size_t, union res_sockaddr_union *, int); @@ -481,15 +442,6 @@ int res_nopt_rdata(res_state, int, u_char *, int, u_char *, void res_send_setqhook(res_send_qhook); void res_send_setrhook(res_send_rhook); int __res_vinit(res_state, int); -#if 0 -void res_destroyservicelist(void); -const char * res_servicename(u_int16_t, const char *); -const char * res_protocolname(int); -void res_destroyprotolist(void); -void res_buildprotolist(void); -const char * res_get_nibblesuffix(res_state); -const char * res_get_nibblesuffix2(res_state); -#endif void res_ndestroy(res_state); u_int16_t res_nametoclass(const char *, int *); u_int16_t res_nametotype(const char *, int *); @@ -499,4 +451,3 @@ int res_getservers(res_state, union res_sockaddr_union *, int); __END_DECLS #endif /* !_RESOLV_H_ */ -/*! \file */ From nobody Mon Jul 6 12:24:32 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 4gv3Sw5zGfz6jSP4 for ; Mon, 06 Jul 2026 12:24:32 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv3Sw28YWz3gkL for ; Mon, 06 Jul 2026 12:24:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783340672; 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=ULXq4TwgtxTunkEqtUbz6yItjIZknK7qMphcsCNVfd0=; b=yrJei5wvfSjPF2ppqPMYi+Q9FHbD9KA7InChx7mJ7qLlMX+xRcc31B/crRZ9/W4gR50ngo BLdAPS0zWz+wRW3SVj8XmCc1Isl9nY5nlX8WDp2H3GnK/ye2ertU7PnaOe2gWfFpZNaEc5 Ov3sCadG0GxZjzRTuZDLKLYb5H+mnHA/6qWABUY3usY4IyW8f6gBsgjk74cwF6zF7GZLxX yy6VwGKKvXVLxPNP/ml5SNj1r7GfGMZ8e/8+gldHHy8a+RSXsHf0u0f/dWG31MqE618Yta PCuL5bdhdL+RLTnQsQLooHE7uvF9SUWoSQZqCS3JSOXjoOXNuwrRTWjcZYbHCg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783340672; a=rsa-sha256; cv=none; b=Oo9Q07JXAKgLOjYIZ18SMXDiwdEBNmhiJRkhCX+PX2f2Mf/gWT5m3tOUpmmOTF9g4H54rP 5QIfrwgdris3OP4HdBoG8Ky8JHX0BqkKqaNdoKJYY1tSVh9j20Drrk8NVRHWm6/beZ4udx RrC+APP/60QcaBJLC6qOpwSCpAylNO/9XNCSbokF8w9/7Oa+TffKizTRPN7kmy9b7Nb/aW Lu4PStmKJQxQsiTzBnLfqoAtFyDrSSQla4tGg3cTyRH70Axpc/kfSUIzTrU1uushSrf+JV hwZHEW4unK1mePz44FpknIUCT39sI+p57BmALSNGCnVSkoYYp0U23A6RS9ZH/Q== 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=1783340672; 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=ULXq4TwgtxTunkEqtUbz6yItjIZknK7qMphcsCNVfd0=; b=KKtKRVu7ShhvUBtD9iftbSo3/uq7GNYKmhiBxIV+xeQAoU5fVSCgaiIPQZwNT+uDKadYzC sOVY7gjh6tgLMLnGCTccCtsjgJh19B6YrpBwlR2UpbzqGcl/CucCPKkxKDaCYL+g4VBj7U W7u1fuYEnqpZWwWvyx+op54OhbK+UhBj6JuiCrjtb0gD1ZvPHdSH2i/3JEOaiD6HzfORu6 CBUTzzneL8ssoy3X+5L7ODP1X3BpnNN7xxqXeHUMHZlPYWLqP7gxGfqX4xBss7DVV77zBS ex7jsNi9zu7w0ojK8YFENX5v7kurOcD5N6zllqKRfpZs7T7ZtBm2E3pAxJDyXA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv3Sw0v0fz13tj for ; Mon, 06 Jul 2026 12:24:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3b20b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 12:24:32 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 4805b88edb00 - main - libc/resolv: Dead code and style cleanup 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4805b88edb009e53c4fee159138d2cbe0c848da7 Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 12:24:32 +0000 Message-Id: <6a4b9e80.3b20b.a151c60@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=4805b88edb009e53c4fee159138d2cbe0c848da7 commit 4805b88edb009e53c4fee159138d2cbe0c848da7 Author: Dag-Erling Smørgrav AuthorDate: 2026-07-06 12:23:55 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-07-06 12:23:55 +0000 libc/resolv: Dead code and style cleanup Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D57928 --- lib/libc/resolv/res_init.c | 59 +++++++++++++--------------------------------- 1 file changed, 17 insertions(+), 42 deletions(-) diff --git a/lib/libc/resolv/res_init.c b/lib/libc/resolv/res_init.c index a9b2d5c582c8..25c7643c66b1 100644 --- a/lib/libc/resolv/res_init.c +++ b/lib/libc/resolv/res_init.c @@ -4,7 +4,7 @@ * Copyright (c) 1985, 1989, 1993 * The Regents of the University of California. All rights reserved. * Copyright (c) 2026 Dag-Erling Smørgrav - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -16,7 +16,7 @@ * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -32,14 +32,14 @@ /* * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * + * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies, and that * the name of Digital Equipment Corporation not be used in advertising or * publicity pertaining to distribution of the document or software without * specific, written prior permission. - * + * * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT @@ -133,9 +133,8 @@ static int res_setsortlist(res_state, int, const char *, const char *); * Return 0 if completes successfully, -1 on error */ int -res_ninit(res_state statp) { - extern int __res_vinit(res_state, int); - +res_ninit(res_state statp) +{ return (__res_vinit(statp, 0)); } @@ -153,7 +152,6 @@ __res_vinit(res_state statp, int preinit) .sin_port = htons(NAMESERVER_PORT), .sin_addr = { htonl(INADDR_LOOPBACK) }, } }, -#ifdef HAS_INET6_STRUCTS { .sin6 = { .sin6_family = AF_INET6, #ifdef HAVE_SA_LEN @@ -162,7 +160,6 @@ __res_vinit(res_state statp, int preinit) .sin6_port = htons(NAMESERVER_PORT), .sin6_addr = IN6ADDR_LOOPBACK_INIT, } }, -#endif }; char *cp, **pp; int dots; @@ -190,7 +187,7 @@ __res_vinit(res_state statp, int preinit) statp->_u._ext.nscount = 0; statp->_u._ext.ext = malloc(sizeof(*statp->_u._ext.ext)); if (statp->_u._ext.ext != NULL) { - memset(statp->_u._ext.ext, 0, sizeof(*statp->_u._ext.ext)); + memset(statp->_u._ext.ext, 0, sizeof(*statp->_u._ext.ext)); statp->_u._ext.ext->nsaddrs[0].sin = statp->nsaddr; strcpy(statp->_u._ext.ext->nsuffix, "ip6.arpa"); strcpy(statp->_u._ext.ext->nsuffix2, "ip6.int"); @@ -828,7 +825,8 @@ freebsd15_res_rndinit(res_state statp) __sym_compat(__res_rndinit, freebsd15_res_rndinit, FBSD_1.4); u_int -res_nrandomid(res_state statp) { +res_nrandomid(res_state statp) +{ (void) statp; return ((u_int)(arc4random() & 0xffff)); @@ -842,10 +840,11 @@ res_nrandomid(res_state statp) { * This routine is not expected to be user visible. */ void -res_nclose(res_state statp) { +res_nclose(res_state statp) +{ int ns; - if (statp->_vcsock >= 0) { + if (statp->_vcsock >= 0) { (void) _close(statp->_vcsock); statp->_vcsock = -1; statp->_flags &= ~(RES_F_VC | RES_F_CONN); @@ -859,7 +858,8 @@ res_nclose(res_state statp) { } void -res_ndestroy(res_state statp) { +res_ndestroy(res_state statp) +{ res_nclose(statp); if (statp->_u._ext.ext != NULL) { free(statp->_u._ext.ext); @@ -868,22 +868,6 @@ res_ndestroy(res_state statp) { statp->options &= ~RES_INIT; } -#ifndef _LIBC -const char * -res_get_nibblesuffix(res_state statp) { - if (statp->_u._ext.ext) - return (statp->_u._ext.ext->nsuffix); - return ("ip6.arpa"); -} - -const char * -res_get_nibblesuffix2(res_state statp) { - if (statp->_u._ext.ext) - return (statp->_u._ext.ext->nsuffix2); - return ("ip6.int"); -} -#endif - void res_setservers(res_state statp, const union res_sockaddr_union *set, int cnt) { @@ -911,8 +895,6 @@ res_setservers(res_state statp, const union res_sockaddr_union *set, int cnt) statp->nsaddr_list[nserv].sin_family = 0; nserv++; break; - -#ifdef HAS_INET6_STRUCTS case AF_INET6: size = sizeof(set->sin6); if (statp->_u._ext.ext) @@ -925,8 +907,6 @@ res_setservers(res_state statp, const union res_sockaddr_union *set, int cnt) statp->nsaddr_list[nserv].sin_family = 0; nserv++; break; -#endif - default: break; } @@ -936,7 +916,8 @@ res_setservers(res_state statp, const union res_sockaddr_union *set, int cnt) } int -res_getservers(res_state statp, union res_sockaddr_union *set, int cnt) { +res_getservers(res_state statp, union res_sockaddr_union *set, int cnt) +{ int i; size_t size; u_int16_t family; @@ -944,7 +925,7 @@ res_getservers(res_state statp, union res_sockaddr_union *set, int cnt) { for (i = 0; i < statp->nscount && i < cnt; i++) { if (statp->_u._ext.ext) family = statp->_u._ext.ext->nsaddrs[i].sin.sin_family; - else + else family = statp->nsaddr_list[i].sin_family; switch (family) { @@ -958,8 +939,6 @@ res_getservers(res_state statp, union res_sockaddr_union *set, int cnt) { memcpy(&set->sin, &statp->nsaddr_list[i], size); break; - -#ifdef HAS_INET6_STRUCTS case AF_INET6: size = sizeof(set->sin6); if (statp->_u._ext.ext) @@ -970,8 +949,6 @@ res_getservers(res_state statp, union res_sockaddr_union *set, int cnt) { memcpy(&set->sin6, &statp->nsaddr_list[i], size); break; -#endif - default: set->sin.sin_family = 0; break; @@ -980,5 +957,3 @@ res_getservers(res_state statp, union res_sockaddr_union *set, int cnt) { } return (statp->nscount); } - -/*! \file */ From nobody Mon Jul 6 12:55:19 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 4gv48S0gdxz6jW3b for ; Mon, 06 Jul 2026 12:55:20 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv48S09Lgz3mBP for ; Mon, 06 Jul 2026 12:55:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783342520; 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=pmV01X40JcRh8uXKIaLSa9q6JAdYMyEEs850jGtskeo=; b=YTetsaCOB07zFGeFk5zHeJLbALAnuH7uDuh+dzDJssi4xofEKNA+4UXBEPUal2YmKTKY2p vsqh8Cn/HkMxwgkc3pTN2yi7+i5uh0T47qdNFo43GDI5qwlqRg7cFfkkQrTdtIaOgTcabP 90YLnNZWJDQ72KgadyYNT20D5k7x+FrF6DXmTGj+zxu28zo66wi6LKsSBJn+1V/tu3jsUB iEDI4C14whGcmHSAayy8Ap5pkSeiT0WAIcEA4dUs2+zOHp4D8sWv2VlivDXAQlUt/f3vQ2 /D3Ng8Y1M9muxalKNV1xS3l3Y1qEpgxPCl+4FatvREq1yKbnG3JfKPSuopyugA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783342520; a=rsa-sha256; cv=none; b=mQikD6BGZS6uIwJkqXxXF/TumRPbdQEahgyGeS/Vs3N9xkBedk3zNMClkKKY6vYtVO9uMa d2S10l4aKlob9UubKqxhquJ+mWJ09yLy054mQvkZhj7hN9S7L+kHkPKN9JlUEbHjPlKJ8b aQHO0e1JFS1XAXUWvtSUwG4vH8DcbeAZFO9wcr5HDblsqDx5+vsa4ngmnjS352cx6CPJkg +usArdAUSFpdRPC5lT4Cg6z4HgPHd5uWXG27lOTyuRNPFph2CRycL7GPXSIkeF9C/Op/nj buPnWt/JCqVBozevnhmrZjoMKVR1kesYq68lZCRxOPpqdXiAQklFgnliHgJTCw== 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=1783342520; 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=pmV01X40JcRh8uXKIaLSa9q6JAdYMyEEs850jGtskeo=; b=gljuq1pC5godJZUVjlc/CdDzBWk4EvpbiqmSb74+MJikG9hFiPzQSbA+Ma23f5RnRHrL2Q oPT8LuWU3J4fphsunt21+DXzZyhu84QOHQILnXCW/3nMq+UUvMO99mllfcadQM8UNFHVhd oeoANxcaToCX9dKmN6k1YwynMtI7g/l1TUrL25kmUofUPhhQbikm2jy1Z+txnXjlt/Fcg7 dCvODs9wOiohCJtAbzgmgfZtZ0FRON4BoaYn9d3RbqsVfwpg94Cq91R/N5U5Mwri+71Hgn bJBRdnq+WqtGMFhqTwTeiGyHeUEgoMzRvAb0xWh/N9rWYqL40xYliOEiuPb8AA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv48R64FXz157b for ; Mon, 06 Jul 2026 12:55:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3de06 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 12:55:19 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: b70997c8c75a - main - inotify: Unconditionally generate IN_IGNORED events for files/dirs 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: b70997c8c75adc3ab343c47d5ba7d01c9c774d9e Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 12:55:19 +0000 Message-Id: <6a4ba5b7.3de06.6244136d@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b70997c8c75adc3ab343c47d5ba7d01c9c774d9e commit b70997c8c75adc3ab343c47d5ba7d01c9c774d9e Author: Mark Johnston AuthorDate: 2026-07-06 12:50:37 +0000 Commit: Mark Johnston CommitDate: 2026-07-06 12:50:37 +0000 inotify: Unconditionally generate IN_IGNORED events for files/dirs The implementation previously only generated an IN_IGNORED event for a deleted watched file if the watch explicitly requested IN_DELETE_SELF. This is not correct, IN_IGNORED should always be raised when the watched subject is deleted. Adjust the implementation of inotify_log_one() accordingly. This also fixes a problem where a deleted watched file's watch would not be removed if IN_DELETE_SELF was not in the watch's event mask, in which case the unlinked vnode would linger until the inotify descriptor itself is closed. Add a regression test. Reported by: jrtc27 Reviewed by: jrtc27 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D58050 --- sys/kern/vfs_inotify.c | 35 +++++++++++++++++++++++------------ tests/sys/kern/inotify_test.c | 24 ++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 12 deletions(-) diff --git a/sys/kern/vfs_inotify.c b/sys/kern/vfs_inotify.c index 94e65973a36b..9269dc0723af 100644 --- a/sys/kern/vfs_inotify.c +++ b/sys/kern/vfs_inotify.c @@ -614,25 +614,37 @@ inotify_log_one(struct inotify_watch *watch, const char *name, size_t namelen, struct inotify_watch key; struct inotify_softc *sc; struct inotify_record *rec; - bool allocfail; + bool allocfail, delete, notify, oneshot, unmount; mtx_assert(&watch->vp->v_pollinfo->vpi_lock, MA_OWNED); sc = watch->sc; - rec = inotify_alloc_record(watch->wd, name, namelen, event, cookie, - M_NOWAIT); - if (rec == NULL) { - rec = &sc->overflow; - allocfail = true; + + delete = (event & IN_DELETE_SELF) != 0; + notify = (watch->mask & event) != 0; + oneshot = (watch->mask & IN_ONESHOT) != 0; + unmount = (event & IN_UNMOUNT) != 0; + if (!notify && !delete && !unmount) + return; + + if (notify || unmount) { + rec = inotify_alloc_record(watch->wd, name, namelen, event, + cookie, M_NOWAIT); + if (rec == NULL) { + rec = &sc->overflow; + allocfail = true; + } else { + allocfail = false; + } } else { - allocfail = false; + rec = NULL; } mtx_lock(&sc->lock); - if (!inotify_queue_record(sc, rec) && rec != &sc->overflow) + if (rec != NULL && !inotify_queue_record(sc, rec) && + rec != &sc->overflow) free(rec, M_INOTIFY); - if ((watch->mask & IN_ONESHOT) != 0 || - (event & (IN_DELETE_SELF | IN_UNMOUNT)) != 0) { + if (oneshot || delete || unmount) { if (!allocfail) { rec = inotify_alloc_record(watch->wd, NULL, 0, IN_IGNORED, 0, M_NOWAIT); @@ -676,8 +688,7 @@ inotify_log(struct vnode *vp, const char *name, size_t namelen, int event, TAILQ_FOREACH_SAFE(watch, &vp->v_pollinfo->vpi_inotify, vlink, tmp) { KASSERT(watch->vp == vp, ("inotify_log: watch %p vp != vp", watch)); - if ((watch->mask & event) != 0 || event == IN_UNMOUNT) - inotify_log_one(watch, name, namelen, event, cookie); + inotify_log_one(watch, name, namelen, event, cookie); } mtx_unlock(&vp->v_pollinfo->vpi_lock); } diff --git a/tests/sys/kern/inotify_test.c b/tests/sys/kern/inotify_test.c index d3799b12ce20..9d5265e71f95 100644 --- a/tests/sys/kern/inotify_test.c +++ b/tests/sys/kern/inotify_test.c @@ -54,6 +54,8 @@ ev2name(int event) return ("IN_MOVED_TO"); case IN_OPEN: return ("IN_OPEN"); + case IN_IGNORED: + return ("IN_IGNORED"); default: return (NULL); } @@ -832,6 +834,27 @@ ATF_TC_BODY(inotify_event_delete, tc) close_inotify(ifd); } +ATF_TC_WITHOUT_HEAD(inotify_event_delete_ignored); +ATF_TC_BODY(inotify_event_delete_ignored, tc) +{ + char path[PATH_MAX]; + int error, ifd, wd; + + ifd = inotify(IN_NONBLOCK); + + wd = watch_dir(ifd, IN_DELETE, path); + + /* + * IN_IGNORED should be generated when a watched directory is removed, + * even if the watch was not configured to raise IN_DELETE_SELF. + */ + error = rmdir(path); + ATF_REQUIRE(error == 0); + consume_event(ifd, wd, 0, IN_IGNORED, NULL); + + close_inotify(ifd); +} + ATF_TC_WITHOUT_HEAD(inotify_event_move); ATF_TC_BODY(inotify_event_move, tc) { @@ -999,6 +1022,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, inotify_event_close_write); ATF_TP_ADD_TC(tp, inotify_event_create); ATF_TP_ADD_TC(tp, inotify_event_delete); + ATF_TP_ADD_TC(tp, inotify_event_delete_ignored); ATF_TP_ADD_TC(tp, inotify_event_move); ATF_TP_ADD_TC(tp, inotify_event_move_dir); ATF_TP_ADD_TC(tp, inotify_event_open); From nobody Mon Jul 6 12:55:20 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 4gv48T1bWZz6jVxd for ; Mon, 06 Jul 2026 12:55:21 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv48T0LHvz3mjB for ; Mon, 06 Jul 2026 12:55:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783342521; 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=HSsS319bwv7INGXfr2sVw62bnAc/NMAFwRUfnUETjdM=; b=eg6pcJh28t/p8ntc7cDaXnU1mpVbdLiMFP3bLx1E+fCx6hRQQutYC5PvdlI6QPhYsl8jxy mKYB0KL6rts2ZvRmaOBAN9ZeuGK5qHy67HhKEYfpEkbXhp6PNf0863UCBW+DkIPkOZ1bnb XiRoZtC37CY6QeZ8fKQyPA311JHbvPiKP6Jt6kGgar8RNeSsGH5G7XAhoyBoZ5DWC+n+6U FoSJkzEznvhrEsj8I2Q0LVKe95X1enJMl/P2GW5ZJqqS6kPYwUScte2FZJqPXaBX4wBJZN EJDxQksG7N6D4Uw11T+wm0mtB3k3GHs3yBLJgcV96hiAMMWAUYFLblAPzvnCQA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783342521; a=rsa-sha256; cv=none; b=HQ5Fxs01E34Zu5keh+oGyXDsLaEsYeSIHOIM+v2DgAK29tJa/XYf0o32eME3l1b8lPerbS BuRUMKgKY2NuKZ11iZX13YPu6ZbuEUL67ITes6tnpmUZ4LgZ6rZlExXD5nUIr2JNqLrUK/ kOaBlkjSgLXE5h1Fa+K7otNuW3bZJOdQeq7xDvGxSSzgmwcTgWHRX57Z3RQ9mvNFG1RZY2 AVbjG3QX3aRQSzRkl3SNZhjRD663W9idNKF/KC/NYTMXGi0MBcv1OItjkvsten0VXZU+96 sNH/7/WTlRwKU+kzezpj/YlZo3vEH9XaJ9Y+9QflHiIvh8w1eGQg2jeEeiHlEw== 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=1783342521; 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=HSsS319bwv7INGXfr2sVw62bnAc/NMAFwRUfnUETjdM=; b=uS09C0T5SArz601nBGRP+gv8ZvL/A+G6CT5oVgL8SydgyLWBl645d0w18jAN8Ad/celdpk H27nEnPNqDfEksFC35tu/QTkWZWslb2GCbyNrKFG3RDay3sh3iHq8XNg3VnoKjj/OpvJvc lfEGtk8yNH4t4B1J7Eq11MXwRiK6tureCOThqdqXzc6/pDxsEOixQ4mECTHDGIbfbqPQsk TzBcDiIiAeLExzV5xav1Yz9ngXDckiqUtDPOZkdbmu875NFqeAuz2o+65SJVQtoI86KNPC kx07O/03uz9TqNjWg3McQPqnqFr4oiipdRKkiixV/vipc2/5I/sPL2U6bQCI3w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv48S6SJrz14rr for ; Mon, 06 Jul 2026 12:55:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3e565 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 12:55:20 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 92dfe30ba254 - main - inotify.2: Fix formatting and lint 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: 92dfe30ba254b50a74e14f33ad1d2a0c03393960 Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 12:55:20 +0000 Message-Id: <6a4ba5b8.3e565.5540026d@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=92dfe30ba254b50a74e14f33ad1d2a0c03393960 commit 92dfe30ba254b50a74e14f33ad1d2a0c03393960 Author: Mark Johnston AuthorDate: 2026-07-06 12:50:51 +0000 Commit: Mark Johnston CommitDate: 2026-07-06 12:50:51 +0000 inotify.2: Fix formatting and lint MFC after: 1 week --- lib/libsys/inotify.2 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/libsys/inotify.2 b/lib/libsys/inotify.2 index f94509d6f59e..0728c65af975 100644 --- a/lib/libsys/inotify.2 +++ b/lib/libsys/inotify.2 @@ -179,18 +179,18 @@ Some additional flags may be set in inotify event records: When a watch is removed from a file, for example because it was created with the .Dv IN_ONESHOT flag, the file was deleted, or the watch was explicitly removed with -.Xr inotify_rm_watch 2 , +.Fn inotify_rm_watch , an event with this mask is generated to indicate that the watch will not generate any more events. Once this event is generated, the watch is automatically removed, and in particular should not be removed manually with -.Xr inotify_rm_watch 2 . +.Fn inotify_rm_watch . .It Dv IN_ISDIR When the subject of an event is a directory, this flag is set in the .Ar mask .It Dv IN_Q_OVERFLOW -One or more events were dropped, for example because of a kernel memory allocation -failure or because the event queue size hit a limit. +One or more events were dropped, for example because of a kernel memory +allocation failure or because the event queue size hit a limit. .It Dv IN_UNMOUNT The filesystem containing the watched object was unmounted. .El @@ -210,7 +210,7 @@ is a symbolic link, do not follow it. This currently has no effect, see the .Sx BUGS section. -.In Dv IN_MASK_ADD +.It Dv IN_MASK_ADD When adding a watch to an object, and that object is already watched by the same inotify descriptor, by default the mask of the existing watch is overwritten. @@ -218,20 +218,20 @@ When .Dv IN_MASK_ADD is specified, the mask of the existing watch is instead logically ORed with the new mask. -.In Dv IN_MASK_CREATE +.It Dv IN_MASK_CREATE When .Fn inotify_add watch is used to add a watch to an object, .Dv IN_MASK_CREATE is specified, and that object is already watched by the same inotify descriptor, return an error instead of updating the existing watch. -.In Dv IN_ONESHOT +.It Dv IN_ONESHOT Monitor the object for a single event, after which the watch is automatically removed. As part of removal, a .Dv IN_IGNORED event is generated. -.In Dv IN_ONLYDIR +.It Dv IN_ONLYDIR When creating a watch, fail with .Er ENOTDIR if the path does not refer to a directory. From nobody Mon Jul 6 12:55:21 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 4gv48V2Llyz6jW17 for ; Mon, 06 Jul 2026 12:55:22 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv48V0qhyz3msg for ; Mon, 06 Jul 2026 12:55:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783342522; 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=atTXA2dglOHwfAe9lQFXYp1tg/QLBhjNydQPR0+AAJw=; b=gyCgfVNS3xAarv2dX7vf4FvhW1zWSuhj7ffUuwI4ovwLphVlgaK42QCxku/usAWxQEmJWd a8tlilAl51JwzkYjNCaVzm9WdYfuR4nRc699v/xRCTFv6W1ZoEil4oTw/C1ew9wsQDAhM+ /FhgZ9/HrZ2mPQ78/yTBsIXuedDmfZlqcZwD+ruhEvIgGx9YDO+lRm/jGUNU/mhDL4s6eE OAQgw67il+fvH2gDaVz04xMWyXSBQQPRBg8XVkLXFTzx0sGq9PJhEKLFHP4EuBtWh7tNnx PnfAsrg00PNS27U74droUPcviVOEmLizU55wP/6+G/lCY5oiNksnn/kNX25WTQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783342522; a=rsa-sha256; cv=none; b=A24F6a0T6bhJyz7BK6KAJB7iFUjdeGJM1mcuVM2mtGzFNTMEqNBDjjU8+RSJG4N1IyYZ5D R9rhEH/1ntagd6ow3QCQsXm7FAKl5nZlJmSzd8hcAHAHhEdaek9+zQKgdV6Gu+PBMfJ02q qfD+3foEH1FgXFI7mU/VleX4jdUuhZk1H1CUjQcxE5JTb9T8+dcIU5KzLTYW8t+B0PqEdM CfobPiS/NDzWIkYUO+0uYzzZ6oBWA+8ziNOQNsS32Qdym9kxHlUr57envwjnBUVK2WN+he YlDx70AV6OspUwc025KjUQ4/Vlz4eeVJjVygaTW9dSAqIfK3v4KmrH+cW0tItQ== 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=1783342522; 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=atTXA2dglOHwfAe9lQFXYp1tg/QLBhjNydQPR0+AAJw=; b=LINS+G50ZQ7djMQTc8nzAmac8j6kC9BV6bYOaaxVSQHZ3QwiYhd2/uEVBDnSU3U8Qyd0RR BLEohK2ztI3PmptZ2v07+hUetzv2rkb/8wLipxzCmtIWfecmCVSqdcLHkEDBfoCGh4XL8L QqLHc7inzCJXMbYmK/cmoja12PCbYwCvqQagEEFLpijqE/79DGoi1SBLFENfHXvKQA7c5V 88vA/ajmGxUfXlA8tXLUvknzeBzYB7gxrCONLccsAwjz98nNXfmhijf2usUQ28IchJHkTr BX6e9uZTWWBstpVU0xsiOrs+86HX+g6Ez/PDDoUdw7MprqFpbpFSm+nisObHQA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv48T71prz14RN for ; Mon, 06 Jul 2026 12:55:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3bfd7 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 12:55:21 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 38dd686b9336 - main - jaildesc: Publish the new fd only after the jaildesc is initialized 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: 38dd686b9336e2de5deadc5f8cb5e46a845b0dd9 Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 12:55:21 +0000 Message-Id: <6a4ba5b9.3bfd7.66c5985d@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=38dd686b9336e2de5deadc5f8cb5e46a845b0dd9 commit 38dd686b9336e2de5deadc5f8cb5e46a845b0dd9 Author: Mark Johnston AuthorDate: 2026-07-06 12:51:11 +0000 Commit: Mark Johnston CommitDate: 2026-07-06 12:51:11 +0000 jaildesc: Publish the new fd only after the jaildesc is initialized jaildesc_alloc() finishes initializing the file structure only after it is made visible from the file descriptor table via finit(). In that window, other threads could try to perform operations on the descriptor and thus access an incompletely initialized jaildesc. Defer the finit() call until locks are initialized. While here, simplify the error path for falloc_caps(). Reported by: Yuxiang Yang, Yizhou Zhao, Ao Wang, Xuewei Feng, Qi Li, and Ke Xu from Tsinghua University using GLM-5.2 from Z.ai Reviewed by: jamie MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D58049 --- sys/kern/kern_jaildesc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/kern/kern_jaildesc.c b/sys/kern/kern_jaildesc.c index e2e3246ea92b..fdce321cb468 100644 --- a/sys/kern/kern_jaildesc.c +++ b/sys/kern/kern_jaildesc.c @@ -153,18 +153,16 @@ jaildesc_alloc(struct thread *td, struct file **fpp, int *fdp, int owning) if (error != 0) return (error); } - jd = malloc(sizeof(*jd), M_JAILDESC, M_WAITOK | M_ZERO); error = falloc_caps(td, &fp, fdp, 0, NULL); - if (error != 0) { - free(jd, M_JAILDESC); + if (error != 0) return (error); - } - finit(fp, priv_check_cred(fp->f_cred, PRIV_JAIL_SET) == 0 ? - FREAD | FWRITE : FREAD, DTYPE_JAILDESC, jd, &jaildesc_ops); + jd = malloc(sizeof(*jd), M_JAILDESC, M_WAITOK | M_ZERO); JAILDESC_LOCK_INIT(jd); knlist_init_mtx(&jd->jd_selinfo.si_note, &jd->jd_lock); if (owning) jd->jd_flags |= JDF_OWNING; + finit(fp, priv_check_cred(fp->f_cred, PRIV_JAIL_SET) == 0 ? + FREAD | FWRITE : FREAD, DTYPE_JAILDESC, jd, &jaildesc_ops); *fpp = fp; return (0); } From nobody Mon Jul 6 13:18:51 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 4gv4gc0RFVz6jX1H for ; Mon, 06 Jul 2026 13:18:52 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv4gb6WYdz3q8L for ; Mon, 06 Jul 2026 13:18:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783343931; 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=zS/fv17PzNVKS0f2ifoDNhlIe0w5QkoBgAdLeBikzLo=; b=K0VSyycPnj56LCp+oXr9/6U2yrk8lfG1XMADT2E51zAGryrBRRKxq95yLqdzW0bCgdXKwq MHIatxagjJx3SI3Y+ulqUkiCmiGPfSzcrhoigfi+kYH5R6JDV6E7cyA0pYZ7C+Lbu4obiT dIAE+YhwUWE9Y9mAz4XPE/nzqwWM/c1iODDdwgoRdl7j9glQKAQGU0eSexACX6LQN+i228 upcxI2Mm8TZdv2W5cHZHZt+sYqEItvzii7tjwq4hSU8vDn8+PZqZ5twDv1P6BDJw9ar4vE j78wSUBT2ia/QDJfcEIa5Qjm+5JoigQKG3ts5vxDaFjydaXz91+0SLWwM2AE5w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783343932; a=rsa-sha256; cv=none; b=vcJ+QCtzSvmMtpssv6Qk0O3esmgA3LA5NTKwaAOcW7tlQjmUGWcyEu+0vgINTWQDXAkuDE pwy4ESiG7lG5oTQgy+0MB7SXOopW3jpx8TtgzKbWrYF3TazTCWxBDjsZauPYl1NnDCKoZN rFz3AiL+4x1gU3TMSA9X2BeUXRQbw4d4Wg8fevGkDVOtIbBIF3kWHvUYZ0UJUodwJ00fK0 hnGQYeWNzfSHNuLN7rTRPwoXdia9Ol/4TFMFIv+wZ0o1iIkpkyLw5Ku5+GZWYkKcoc/fuB QllSk8KsNQxBHlp1YEBB2VjM8JtsVvy9WkGhlMsq0jk6l2ji30MOzwrhpVTkag== 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=1783343932; 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=zS/fv17PzNVKS0f2ifoDNhlIe0w5QkoBgAdLeBikzLo=; b=TmEtmyvUnikeu+mEG6FSHy++6R3i0I0vemyULQQJGbI7s/oeSnHa0XBPTYwcrOZ2BrHJOi 6KQF0+iSfS6xCzZ4+BaAddDf1HK9COoFTF3iv0f3+BbQz7rAZnNW5Bc7HdZI1E6an3DG3Z 7nb23BXztrh0xbpjuIlk/272nAIVehuwOfrh1YPJtfdDxdbgFy9tnvq5YEL7qNcdtDurry tw/pi4rSKP1r3a04dtL0Cq0kEDz7ZTPtA38r7j+CMf+6TYdo3Qpq4Ouu1TM7ZEHQ03Am/X b2Qtjo1I9Bq+7aq/vhVj5qPpe1nptPJ2QrEAd9zNR0jCO6TH+3YzOn0Cp5SKog== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv4gb4kWKz15bZ for ; Mon, 06 Jul 2026 13:18:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3fbb2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 13:18:51 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 705a88a71727 - main - ee: Improve handling of malformed UTF-8 characters 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: 705a88a717272c52c897c3d28dc2997980ee67f4 Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 13:18:51 +0000 Message-Id: <6a4bab3b.3fbb2.737b6ba9@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=705a88a717272c52c897c3d28dc2997980ee67f4 commit 705a88a717272c52c897c3d28dc2997980ee67f4 Author: Mark Johnston AuthorDate: 2026-07-06 13:16:32 +0000 Commit: Mark Johnston CommitDate: 2026-07-06 13:18:13 +0000 ee: Improve handling of malformed UTF-8 characters In delete(), when copying the deleted character to the d_char buffer, don't assume that it fits. utf8_prev() may return a sequence of more than 5 bytes. In insert_utf8(), fix the copy-up of the line. We extended the line by "len" bytes, so "temp" has to be repositioned accordingly. Compare with plain insert(). Use sizeof when copying to buffers instead of hard-coding buffer sizes. Don't dynamically allocate d_char, there is no need. Fixes: 62fba0054d9e ("ee: add unicode support") Reported by: Sayono Hiragi (overflow in delete()) Reviewed by: bapt MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57996 --- contrib/ee/ee.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/contrib/ee/ee.c b/contrib/ee/ee.c index 13a554bf0146..94bb296bcd65 100644 --- a/contrib/ee/ee.c +++ b/contrib/ee/ee.c @@ -194,7 +194,7 @@ unsigned char *srch_2; /* pointer to next character of string */ unsigned char *srch_3; unsigned char *in_file_name = NULL; /* name of input file */ char *tmp_file; /* temporary file name */ -unsigned char *d_char; /* deleted character */ +unsigned char d_char[5]; /* deleted character */ unsigned char *d_word; /* deleted word */ unsigned char *d_line; /* deleted line */ char in_string[513]; /* buffer for reading a file */ @@ -598,7 +598,6 @@ main(int argc, char *argv[]) signal(SIGCHLD, SIG_DFL); signal(SIGSEGV, SIG_DFL); signal(SIGINT, edit_abort); - d_char = malloc(5); /* UTF-8 chars can be up to 4 bytes + NUL */ d_word = malloc(150); *d_word = '\0'; d_line = NULL; @@ -832,7 +831,6 @@ insert_utf8(const unsigned char *mb, int len) { int counter; unsigned char *temp; - unsigned char *temp2; int i; text_changes = TRUE; @@ -848,17 +846,18 @@ insert_utf8(const unsigned char *mb, int len) counter++; temp++; } - temp++; - while (point < temp) + temp += len; + while (point + len - 1 < temp) { + unsigned char *temp2; + temp2 = temp - len; *temp = *temp2; temp--; } /* copy all bytes of the UTF-8 character */ - for (i = 0; i < len; i++) - point[i] = mb[i]; + memmove(point, mb, len); /* display the character before advancing past it */ wclrtoeol(text_win); @@ -931,8 +930,10 @@ delete(int disp) scr_pos = scr_horz; if (in == 8) { - memcpy(d_char, point, del_width); - d_char[del_width] = '\0'; + size_t width = min(del_width, 4); + + memcpy(d_char, point, width); + d_char[width] = '\0'; } while (temp_pos <= curr_line->line_length) { @@ -2993,7 +2994,7 @@ del_word(void) if (d_word != NULL) free(d_word); d_word = malloc(curr_line->line_length); - memcpy(tmp_char, d_char, 5); + memcpy(tmp_char, d_char, sizeof(tmp_char)); d_word3 = point; d_word2 = d_word; tposit = position; @@ -3026,7 +3027,7 @@ del_word(void) curr_line->line_length -= difference; *d_word2 = '\0'; draw_line(scr_vert, scr_horz,point,position,curr_line->line_length); - memcpy(d_char, tmp_char, 5); + memcpy(d_char, tmp_char, sizeof(d_char)); text_changes = TRUE; formatted = FALSE; } @@ -4141,7 +4142,7 @@ Format(void) unsigned char *temp_dword; unsigned char temp_d_char[5]; - memcpy(temp_d_char, d_char, 5); + memcpy(temp_d_char, d_char, sizeof(temp_d_char)); /* | if observ_margins is not set, or the current line is blank, @@ -4336,7 +4337,7 @@ Format(void) case_sen = temp_case; free(srch_str); srch_str = tmp_srchstr; - memcpy(d_char, temp_d_char, 5); + memcpy(d_char, temp_d_char, sizeof(d_char)); auto_format = tmp_af; midscreen(scr_vert, point); @@ -4720,7 +4721,7 @@ Auto_Format(void) unsigned char temp_d_char[5]; unsigned char *tmp_d_line; - memcpy(temp_d_char, d_char, 5); + memcpy(temp_d_char, d_char, sizeof(temp_d_char)); /* | if observ_margins is not set, or the current line is blank, @@ -4946,7 +4947,7 @@ Auto_Format(void) case_sen = temp_case; free(srch_str); srch_str = tmp_srchstr; - memcpy(d_char, temp_d_char, 5); + memcpy(d_char, temp_d_char, sizeof(d_char)); auto_format = TRUE; dlt_line->line_length = tmp_d_line_length; d_line = tmp_d_line; From nobody Mon Jul 6 13:18:52 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 4gv4gd08cFz6jXNy for ; Mon, 06 Jul 2026 13:18:53 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv4gc61Bbz3ph3 for ; Mon, 06 Jul 2026 13:18:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783343932; 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=5ror7iwQXWRiGPL5itXCIjOUW6Ou1ThboafG5ltvIvY=; b=NoQnASfzLUlIno2MSrrc1CUSTdGm9Fg7UomHpRfdVRkmdzsPGIc09DhNttvUtv7FW4gHDE sHddTxSMNEdqWcBSMoG9+ZTcVRGpNsQWHMsbbbLu73l6J+wLu7vjd8W264bGb5PwsHnjrW EuAehrHQlfF5sEQofDurWZEZ4ch52LchEemLDDdT/6fY6Tpom8xXexFkGriSLcN4hmHSUV acgWTCrYcjk4K0B+WR4yxwCwNf7yT9g2OLKwInVulcoFCQHfD4VZMh89bWURGdLWI4ppur oNqlmE9vLjsHvtPXffuZkl+pBcDxKZgbcR1hjeeyLSAG7VRiTXqj3rFLVp5m7g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783343932; a=rsa-sha256; cv=none; b=sgKtrucW+O/1Hz1U1R/KSLJDVpjorRhls7Y0j9+EUqR1Fk1GmEkV+68ErEytHaObu51znA gug6L94m8XSTu1sLCBpcKA5MRE8Y8/80RH8B0Jh0XA/NPJUbDxz+336EucxX+SYVzfNV0U 2h/gfd0u+lVwcaeVeKdjDSY1qdGyjNDlT9gZgi/TOo6kQy9DqLsidb9xuXKa/cLZM+XZek GhqfsVoVtrg9X6ynjallvny/py8Zrt+CLe7O+z3NZIPHyKZ5IGm0s9SPuud3QkebPfSrMH eiYQ6ohGV8ekZebN4tLeTYhgBg6EVvdsf0ylMyaX1jcWZGnwZbl4ebLwB9qIhA== 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=1783343932; 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=5ror7iwQXWRiGPL5itXCIjOUW6Ou1ThboafG5ltvIvY=; b=GbNTJUbTrsjXGDOfxigaF4pTzCjfSNkBAGHz5r0p93ZILzL+6Nfz/xeEic58tl5iJR5Ev4 E02HCbZZpxWe7QYYH0bJC52O3IJZtSMnjvgejPoELoQ+FN0no0jOKrm7HFewkjKTbpXyoQ aQn+93ScmxruQNXPJPxAfslWb397vSPScP0lK5kx09b/TzlTKeqMp6W4XJfcrylPYsyJiL vEracCNY679+lEvrjHPrMPEFKGIavz38hd6/0Pz548xpnEIcogK8qwMKmR98qBNoZ9tBE7 b377U/LBpRjq9smSd2YjP+ipOpFt0oTogstlpllk8Y6Uiva8nlcf5Ta01LlO2Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv4gc50Bgz15Lk for ; Mon, 06 Jul 2026 13:18:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3ff23 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 13:18:52 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: a8f5e24070a2 - main - ee: Handle EINTR when waiting for a character 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: a8f5e24070a2fffc752ac7855bfb49049dcbb41e Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 13:18:52 +0000 Message-Id: <6a4bab3c.3ff23.7eac5feb@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a8f5e24070a2fffc752ac7855bfb49049dcbb41e commit a8f5e24070a2fffc752ac7855bfb49049dcbb41e Author: Mark Johnston AuthorDate: 2026-07-06 13:16:45 +0000 Commit: Mark Johnston CommitDate: 2026-07-06 13:18:18 +0000 ee: Handle EINTR when waiting for a character Otherwise one can't easily attach gdb to ee. Reviewed by: bapt MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57997 --- contrib/ee/ee.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/ee/ee.c b/contrib/ee/ee.c index 94bb296bcd65..d397dc27b519 100644 --- a/contrib/ee/ee.c +++ b/contrib/ee/ee.c @@ -678,7 +678,11 @@ main(int argc, char *argv[]) * issue */ if (wret == ERR) + { + if (errno == EINTR) + continue; exit(0); + } in = (int)win; resize_check(); From nobody Mon Jul 6 13:28:27 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 4gv4tg72TFz6jXtb for ; Mon, 06 Jul 2026 13:28:27 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv4tg6FtRz3rZG for ; Mon, 06 Jul 2026 13:28:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783344507; 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=njoOOho6FbNM0kWd4jl16XoJ4oBRlrNM4uLggM9uOok=; b=YCf9KlgordBU4Imq38SEoCyBVO04CidKHjc2fOTrBv8tekHFRuvKJnIwK0sNkY6xoQ0L9E afbS22hofaYsk4KvP2K0MVTeRuQUspr3hTFNWiFP6P5khJipNXSSnalQKLxokS0ewuLGBI pjBtTtl/2Ma/0FubTZl2AA55QGm4ql+vazpuSKx4I3TGd47EN4ADELVzPPte5jd2SBVZzY Pn4E0tNi3/NSiqhGSYQxDIHcS9j+Nn1+euNR/gLwPQHAgESWwKbm0V+AoW1dE00rMB0Two vUqeu6KtheDvySZe6PRd0elbubfz7ULOsm3m9ZwLqcweYY2QjE/XdSDArPxTkA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783344507; a=rsa-sha256; cv=none; b=HSHQI0K+QFSUrCG7zdCQj+B8jy1vQia4xWeMjxWep8TPrX7bKQVyHteLPRUJMnt/fZI4I3 cJeiyTSz2DkGd2RdjHUzYy7cY/nAhLNjBuFPhuZq7PqW/bPiHJy5kEuSsl7iLdbX49DRtH clEexC3dVrLVZahNL27VMEinvuNQ2Q64u2QHgcj8TxjqtKUGdCvHi+1IpAn7TBxAlMHyBf gG6h44Ra7+i5WJXRNXFVxUmaLJZffDupj0oYYfw9L3ITtqwrl6gkXzZW3hcpS8RNqDoYwn Hg1Nq6iTENNHeIX0WQ3v5U3KDf21zue7GIawhltZOQjhjs7enTCPdj0A0484FQ== 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=1783344507; 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=njoOOho6FbNM0kWd4jl16XoJ4oBRlrNM4uLggM9uOok=; b=RQhYnu9wHzm2YdDDLpykAMukNposrZNEdkDgslLR5amJGjLGhSIguyXJp2lmz5U3QP5SKz Oq2cUcBoqHchz3QS0voa0BtvwouDyn1xnPFUVln6zA+cY6812BDGNLIMjfyjP/kK2+Lr6Q w7efmcI0YcHmJU+uC1SxnnK7uqCKbv9YyVLuEscGfRhzbTAdBKsQmCPlKMBQeHk87UbL8P KCfpNsepL4XfftJKVwyROIYRxWcVlov0V2yfyGbDEvbPYYq5BwkHFyNTxTc7sGH2uparxv nWoEJGgztQyvFsdRFtpxbPWupumRpsJ1aNofqE6F42JOMDMNRYpN/CIJ3FqGYg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv4tg52nsz14w0 for ; Mon, 06 Jul 2026 13:28:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 40f8e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 13:28:27 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: c1b6ebc2b758 - main - dtrace: Improve DOF section size validation 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: c1b6ebc2b7584f93cea4d818468b2aee74475674 Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 13:28:27 +0000 Message-Id: <6a4bad7b.40f8e.50d68fb7@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c1b6ebc2b7584f93cea4d818468b2aee74475674 commit c1b6ebc2b7584f93cea4d818468b2aee74475674 Author: Mark Johnston AuthorDate: 2026-07-06 13:20:33 +0000 Commit: Mark Johnston CommitDate: 2026-07-06 13:20:33 +0000 dtrace: Improve DOF section size validation The loop which validates each DOF section assumes that the section header is present, so the section size must be at least as large as the header, otherwise a small OOB access is possible. Reviewed by: christos MFC after: 2 weeks Sponsored by: CHERI Research Centre Differential Revision: https://reviews.freebsd.org/D57975 --- sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c index 853cfb845878..d4c6c5ec449a 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c @@ -14201,8 +14201,8 @@ dtrace_dof_slurp(dof_hdr_t *dof, dtrace_vstate_t *vstate, cred_t *cr, return (-1); } - if (dof->dofh_secsize == 0) { - dtrace_dof_error(dof, "zero section header size"); + if (dof->dofh_secsize < sizeof (dof_sec_t)) { + dtrace_dof_error(dof, "invalid section header size"); return (-1); } From nobody Mon Jul 6 13:28:28 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 4gv4tj0w8bz6jYHw for ; Mon, 06 Jul 2026 13:28:29 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv4tj00h7z3rJb for ; Mon, 06 Jul 2026 13:28:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783344509; 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=xl35qKMtF5OQJGvUjRBjFxKKORH3AvJxpMJ+jF/NLS8=; b=TFvJrnqAR13J7Xv57w7MxiJ6m8osIfJQeALjSs6R6zyDIxCx7uykuv4tUu3UohN50Gsq6N ghPxpDmp6JS6t/Kh0wqtmaIVmcBDn+uKNnW0/GNkYgnZt8lSgiPoFSuApSeZCq2i4s1BBg Gwa+p+11EB7BG274QPql82sr5HkgNV5E4I3/VH1MU92zkY+oGARtkVWXz5E7qztIxTc13C m+XJe4sIPOVbJYa8kps46sHBmbK2BTXm1mZnSEJuoE19iNeI257U1uakzFf173/AvdyOKr YueTfjMzReLZEL3NA7s1Gr0v0Ger4oRIKI3vW1CW23BQhdrEd5la9ub977XhOw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783344509; a=rsa-sha256; cv=none; b=biLihdpMEnLsQaT65tP3NvAWVpdGS6QuCbwZ4ve/WZITgjIxOiNC9ViAkHX4B5thOKxaeZ 5YUlsFv54iKU6rNdo9se147EWikymLQiC97pf9FOQpxDe3ZD2XHRY8G9a+b1smsfphAEx7 igSehhE7CbV/myZpoKJgLAUsO+pPNVO3U/d35bPkUekSH/fzKin6uZfaUpsYWiZt9YwIH+ w55ZD/y/VNQsOIpuzFgUzwhfLdhZJFRD6UA3G7sIWHFsVnrOxwjYqOBZHz5juHxN9yK9b3 cQI/y+84LP34sDQ4uv7ubRus5bc7x1LOtZbWLy2/1tgXp/6ebKLVhMdxedEsdw== 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=1783344509; 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=xl35qKMtF5OQJGvUjRBjFxKKORH3AvJxpMJ+jF/NLS8=; b=V3VR5ymlUnVnHwQXjtKkCCM9Ttfn59BolPchtjzyb8XlrCotRQw3dfVE+KtcHhTaxkv3IY DVw3ZRqFLKn6BtGe/XPcJHLM4h7Q863AqOYPHz3xFpmeJlbjU9VxVflJV8yF2uAhKVn4jW UnY2tMG0UNR6/ppUnBxj0HKJGyBlRxE7pi1luTsFzddMBcCNAvZJc43JLViGoECFrHnyKX KvRR46R16hUkrO+r3uXRWwObhACE9V4cMKyJh2sRZP60+jY7TyB2RPLyZqktCVfp7UR0hf fH4gwRKC5tS0b1W007VgSGnctXtyNr6RggnyjzETkPRmHRYdkc4VcduLcpyVmw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv4th5vP2z15fD for ; Mon, 06 Jul 2026 13:28:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 40ddb by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 13:28:28 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 8dc98f4d25a3 - main - dtrace: Fix DOF section bounds validation 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: 8dc98f4d25a31a8dfddbcc18eb0ee2e0f005ec15 Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 13:28:28 +0000 Message-Id: <6a4bad7c.40ddb.609eb75b@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8dc98f4d25a31a8dfddbcc18eb0ee2e0f005ec15 commit 8dc98f4d25a31a8dfddbcc18eb0ee2e0f005ec15 Author: Mark Johnston AuthorDate: 2026-07-06 13:21:08 +0000 Commit: Mark Johnston CommitDate: 2026-07-06 13:21:08 +0000 dtrace: Fix DOF section bounds validation We must ensure that each DOF section does not overlap with the DOF header or section table. Otherwise the relocations processed in the second pass over sections can manipulate DOF metadata, leading to OOB writes. Reviewed by: christos MFC after: 2 weeks Sponsored by: CHERI Research Centre Differential Revision: https://reviews.freebsd.org/D57976 --- sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c index d4c6c5ec449a..aa8716908cb1 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c @@ -14276,6 +14276,18 @@ dtrace_dof_slurp(dof_hdr_t *dof, dtrace_vstate_t *vstate, cred_t *cr, return (-1); } + if (sec->dofs_offset < sizeof (dof_hdr_t)) { + dtrace_dof_error(dof, "section overlaps header"); + return (-1); + } + + if (sec->dofs_offset + sec->dofs_size > dof->dofh_secoff && + sec->dofs_offset < dof->dofh_secoff + + dof->dofh_secnum * dof->dofh_secsize) { + dtrace_dof_error(dof, "invalid section offset"); + return (-1); + } + if (sec->dofs_type == DOF_SECT_STRTAB && *((char *)daddr + sec->dofs_offset + sec->dofs_size - 1) != '\0') { dtrace_dof_error(dof, "non-terminating string table"); From nobody Mon Jul 6 13:28:29 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 4gv4tk5r9Bz6jYQn for ; Mon, 06 Jul 2026 13:28:30 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv4tk2zF2z3rZP for ; Mon, 06 Jul 2026 13:28:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783344510; 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=GIjZyq/aX8YYPjEf5TtvoNZ6oAWQ1Xv0tFkMpZRtKXY=; b=RzQoyVz//Xmaz0xHwFg1UU5mV52PPpe4nCIBMArwbhYCskBgPLQ/8L/8qYm2B/51Exzd1g PYT6uEzmmg6ozTNCwKQopOqnse6oqEwDj9E10kDBx6OLGgvqPHOb478Ft3S2UZ3X5AcWzY BzYtXRT7IOr8Y655SV5EhLbnxcyeb/NyHqKG4OexoPveNM+KbRkgtRpz5whre6mmbMxZRJ 9cwvvijD5CKiyVbxy3jzHvJ53Iu2MAjyWNOvWD+XFmtarYGUxIP/6BDGYl4RaF5eSCmRXC 994dWtXGZPS5K6ebfrRHyI5ZPJZ4S2hobqpnPLHfKzn4/tdLlG9ZnXj45JUO8A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783344510; a=rsa-sha256; cv=none; b=Lqg/auhnxRvVhy2X5R+mrEe8oXws+AlCozUg78hvcUgW5zjmUs6qfxwIwBD+Uk1/yw4n0z lnrx5OlUa8rqmi5dDHxY4NgTBAAgVQefDMofQ8qAh8WEnSwPlSKA0ePYf30Wi2KONnm9ew 15GOmgUwTZqu+Z7vudfGZOn3+0LY9VbjYYM6JvKJYHtcEPEwW3N3Etr5yVrrw9mfLKKpSS 98Z5V6iq1Zzj0fOyTsU2bQYRLYimwelCKX5/a7t3ykWbYwxwmpE03Ijk+T0nHzxcS3UddW uOnEYfXCpSb2H5xz/SfGz/ZcRZ0sF0fvStLhkjtEByInQqxgC+QZIOgcieY7gw== 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=1783344510; 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=GIjZyq/aX8YYPjEf5TtvoNZ6oAWQ1Xv0tFkMpZRtKXY=; b=H7pjow5sqoHbpycdREJA7vJve3AlaTXL3TE/1uqzkrO76Xhw9eGtmmNdA/l7h5fgkBmhuu AmE7Kn7+norn7kZX5LisgxS9YOsnk4vD9zP93ttcczcaQTOutcORJl5atsckIG1gntoqmH wSrMorDyj2VENEWsH/YRcLJbjsNbzC9RSCbbvWueQB9o7r34fmgFzCw5gDHQKgSn/cVn2I x2H3HpmLonKVDs7bUrX0iNJ5Rl5C1nBcHxPsfcBOybzan6Q6cVwFWBXJxvri6EtUedZ1e+ suJU17hqFI3cRcsDFiRsFxXssTyUrBjPJjVAnrLKKuBZ4je/JjuXMQsJCzKviw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv4tj6Wbvz15fH for ; Mon, 06 Jul 2026 13:28:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 40b2c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 13:28:29 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: b56b601c5ba6 - main - dtrace: Improve DOF string table validation 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: b56b601c5ba603031312b9bc7ae895ecb0dcdaec Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 13:28:29 +0000 Message-Id: <6a4bad7d.40b2c.65f6fa75@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b56b601c5ba603031312b9bc7ae895ecb0dcdaec commit b56b601c5ba603031312b9bc7ae895ecb0dcdaec Author: Mark Johnston AuthorDate: 2026-07-06 13:21:24 +0000 Commit: Mark Johnston CommitDate: 2026-07-06 13:21:24 +0000 dtrace: Improve DOF string table validation The check for a nul terminator implicitly assumes that the section size is positive. Make the assumption explicit. Reviewed by: christos MFC after: 2 weeks Sponsored by: CHERI Research Centre Differential Revision: https://reviews.freebsd.org/D57977 --- sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c index aa8716908cb1..ff31d806664b 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c @@ -14288,8 +14288,9 @@ dtrace_dof_slurp(dof_hdr_t *dof, dtrace_vstate_t *vstate, cred_t *cr, return (-1); } - if (sec->dofs_type == DOF_SECT_STRTAB && *((char *)daddr + - sec->dofs_offset + sec->dofs_size - 1) != '\0') { + if (sec->dofs_type == DOF_SECT_STRTAB && (sec->dofs_size == 0 || + *((char *)daddr + sec->dofs_offset + sec->dofs_size - 1) != + '\0')) { dtrace_dof_error(dof, "non-terminating string table"); return (-1); } From nobody Mon Jul 6 13:28:31 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 4gv4tl63qBz6jYJ3 for ; Mon, 06 Jul 2026 13:28:31 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv4tl1d4Wz3rcY for ; Mon, 06 Jul 2026 13:28:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783344511; 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=22Socabktks4m8ClkhPjxKEnmyRi+XMZxR3UyE7pJ4w=; b=yIOj6S16ULwbPAJjeEA1PPxDPA0HEbGKNAWCTOllu/D9C9YZ4voo3nm1PUWzN3RLI5cAgd B66dNwUxwiLpT9tIkmsT5flN4F+6PMK0Iy/67AwqmoQCkLqirdI7IdEppMCnw4hBFf5Gz8 rh/Sw4Vjy9/YqZYULcsmmEf8DeBTnDSCqxHQwgVGUSL+Q/1CXjP0ofP+l+G5RDoOUq20nj 2lzoqEtvtuPqMChbMR8WWZ+k862CHDBHa+8xhRxPaENFqHFDGaFnFoVYabPRbFHgV8z9oG h5j15ejjkuWrySRVwucIv0srcuDIKCk60lepGh4duqddRZpME/x0i7DgjU1M5A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783344511; a=rsa-sha256; cv=none; b=l3MVu5IjHqHsj5GZLPzizYnhh4mcAv11/JrBd7K2JP1aNobkimX5VmLwXvTOamxQBmMwG2 rrPUwrn9Nnf09bpfnaQe45F+Q8zTvUC//HzOyzMCqqKAPSNSpwOW5PrTW7xi6ngfSGrOft 4GBCJkdOhLm+fL6/9Sup0DtQpBWG7Z21HXNfG4QTp0rrQIwMMXsgWWEyS3F9l3jpPN882x TDbijBKUDOGq6S7uhOI6+KcXNyYTk3Krhk1VdeqrcCXtV1+NxwiAekXqyF54enlkz81BuN KiEMsa+NwHBwi+oNcAD34KPeuXbYyyYTkMzCvu5Y5j6A8RA4fu2XevHPu2fdrg== 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=1783344511; 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=22Socabktks4m8ClkhPjxKEnmyRi+XMZxR3UyE7pJ4w=; b=u/+28mhFB97tiCuX8GZSvf4yi4OMiwp3DybKwH4HrXAHOQEw6bizOl2khR/8DiW9zSq1gm 30dVUU+dvWwASwsNwyZja8vMKhjhPhjKGCvUa087TuD1Xb6ivaiHO7gDvcCB3F5H8Z4U96 A/ZyMcKFrA3ObExNZvHDR0oQwhK22z5nYq5q8EjtMZmuRqY45xZoi6KMEkGqsGCstWfWyk 6hOMmcxgn631vCwcKkoLB90ma3p64qGQjqhJVlWZpe4Y7XVEAkPyHCQyYaSISR+Ap4DSPG tOqvCQWK6b4QJwPYbY8vn1RZg855jTUt0+BPBJx4aWZaZwMQw6qHMfLw85ihug== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv4tl0GfBz15c5 for ; Mon, 06 Jul 2026 13:28:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3fc3e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 13:28:31 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 7f5fa76367d7 - main - dtrace: Fix DOF section-specific validation 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: 7f5fa76367d78e47d483fdf2cc72e5823d0f7807 Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 13:28:31 +0000 Message-Id: <6a4bad7f.3fc3e.5a6a8523@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7f5fa76367d78e47d483fdf2cc72e5823d0f7807 commit 7f5fa76367d78e47d483fdf2cc72e5823d0f7807 Author: Mark Johnston AuthorDate: 2026-07-06 13:21:43 +0000 Commit: Mark Johnston CommitDate: 2026-07-06 13:21:43 +0000 dtrace: Fix DOF section-specific validation The entry size of the probe section is assumed to be at least sizeof(dof_probe_t) by the loop further below. enoff_sec->dofs_entsize was not being validated at all. When multiplying an index by a table entry size, make sure the multiplication can't overflow. Fix an off-by-one when validating the translated probe argument array. Make sure that the probe argument argvs are valid string offsets even if the argument count is zero. Reviewed by: christos MFC after: 2 weeks Sponsored by: CHERI Research Centre Differential Revision: https://reviews.freebsd.org/D57979 --- .../contrib/opensolaris/uts/common/dtrace/dtrace.c | 30 +++++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c index ff31d806664b..11d499953c85 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c @@ -16260,7 +16260,8 @@ dtrace_helper_provider_validate(dof_hdr_t *dof, dof_sec_t *sec) } if (prb_sec->dofs_entsize == 0 || - prb_sec->dofs_entsize > prb_sec->dofs_size) { + prb_sec->dofs_entsize > prb_sec->dofs_size || + prb_sec->dofs_entsize < sizeof (dof_probe_t)) { dtrace_dof_error(dof, "invalid entry size"); return (-1); } @@ -16285,6 +16286,11 @@ dtrace_helper_provider_validate(dof_hdr_t *dof, dof_sec_t *sec) return (-1); } + if (enoff_sec != NULL && enoff_sec->dofs_entsize != sizeof (uint32_t)) { + dtrace_dof_error(dof, "invalid entry size"); + return (-1); + } + arg = (uint8_t *)(uintptr_t)(daddr + arg_sec->dofs_offset); nprobes = prb_sec->dofs_size / prb_sec->dofs_entsize; @@ -16325,7 +16331,7 @@ dtrace_helper_provider_validate(dof_hdr_t *dof, dof_sec_t *sec) if (probe->dofpr_offidx + probe->dofpr_noffs < probe->dofpr_offidx || (probe->dofpr_offidx + probe->dofpr_noffs) * - off_sec->dofs_entsize > off_sec->dofs_size) { + (uint64_t) off_sec->dofs_entsize > off_sec->dofs_size) { dtrace_dof_error(dof, "invalid probe offset"); return (-1); } @@ -16347,7 +16353,8 @@ dtrace_helper_provider_validate(dof_hdr_t *dof, dof_sec_t *sec) } else if (probe->dofpr_enoffidx + probe->dofpr_nenoffs < probe->dofpr_enoffidx || (probe->dofpr_enoffidx + probe->dofpr_nenoffs) * - enoff_sec->dofs_entsize > enoff_sec->dofs_size) { + (uint64_t) enoff_sec->dofs_entsize > + enoff_sec->dofs_size) { dtrace_dof_error(dof, "invalid is-enabled " "offset"); return (-1); @@ -16366,13 +16373,17 @@ dtrace_helper_provider_validate(dof_hdr_t *dof, dof_sec_t *sec) if (probe->dofpr_argidx + probe->dofpr_xargc < probe->dofpr_argidx || (probe->dofpr_argidx + probe->dofpr_xargc) * - arg_sec->dofs_entsize > arg_sec->dofs_size) { + (uint64_t) arg_sec->dofs_entsize > arg_sec->dofs_size) { dtrace_dof_error(dof, "invalid args"); return (-1); } typeidx = probe->dofpr_nargv; - typestr = strtab + probe->dofpr_nargv; + if (typeidx >= str_sec->dofs_size) { + dtrace_dof_error(dof, "bad native argument type"); + return (-1); + } + typestr = strtab + typeidx; for (k = 0; k < probe->dofpr_nargc; k++) { if (typeidx >= str_sec->dofs_size) { dtrace_dof_error(dof, "bad " @@ -16391,9 +16402,14 @@ dtrace_helper_provider_validate(dof_hdr_t *dof, dof_sec_t *sec) } typeidx = probe->dofpr_xargv; - typestr = strtab + probe->dofpr_xargv; + if (typeidx >= str_sec->dofs_size) { + dtrace_dof_error(dof, "bad native argument type"); + return (-1); + } + typestr = strtab + typeidx; for (k = 0; k < probe->dofpr_xargc; k++) { - if (arg[probe->dofpr_argidx + k] > probe->dofpr_nargc) { + if (arg[probe->dofpr_argidx + k] >= + probe->dofpr_nargc) { dtrace_dof_error(dof, "bad " "native argument index"); return (-1); From nobody Mon Jul 6 15:08:23 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 4gv75z207Kz6kCD8 for ; Mon, 06 Jul 2026 15:08:23 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv75z1Pbmz47Bm for ; Mon, 06 Jul 2026 15:08:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783350503; 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=Y99osTB0519MqwfICzO+AusCg5XncAyeZsgdfhmIG0U=; b=WiN27DCe9s+XOt5TL1yNZ8glJNfJQoCJhmwFPTQuWg0jU4c2IYFY0C/KNmBiA314jna7Qc 0g0YHY2DGjKdJrwaWBn6+c/iOUVXA8T2DmHtKnVHphiypiEya594kYdV6LWFy8iLlOU60s 3W5kEgg7KrzKTtZSIRGBxWCXV8Y6NUErmhcicFT3LYFbNEhVl/OxQtpBZzsSEDo2Jyqktd TYJ4lj9EV6S1dfIZ4UKDJQRTqAuOJe7I14UNsdDCQ4VoJLK/OpEKgHWjS5/ukk6zXGx3Pj fvJQphkMZ2agDnfUkcL53ANha7kvWDOI0C1zJp8wsZR9Djwi8N67cQ8KkNgOAA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783350503; a=rsa-sha256; cv=none; b=tputQEpin/SGVZ50O9HhnqmF0734M3S69QcIIR+Bud5WsCwKVCGoliswxoG8869zHMN8nI FR0w1nYWYmSZlpuc2ojq5bionW3wnEm8EL1r4Yr3tCIXW7770wnXJsaHISU7g0S7qw6JfJ LWzlehyQ+f7ejx3Qx34L2EIy2U6V3QdnKnIqlkxTjcdUI6TQcHaaO1YjfAgihd0NFY0Agp eEM1J7WGmx/LmgLqb00qPitEXjeW1gaKSMbY5qvUPcf++bHNP3/EgNAG04P7DaX9h3Wm2S CMfDp1MS69hLpCCOt8may3K6d7F4Al33gsQvdTPbgB59an1lrUocM2BZTUnxrA== 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=1783350503; 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=Y99osTB0519MqwfICzO+AusCg5XncAyeZsgdfhmIG0U=; b=hU1NG9AXD1+DbcTUmU2QR+VCzXd8zbCWHOBFGCqKK1m5xq7Skyhws5KxiRGusvFuq7J/ag i/Glt6x0LWU4YP/nn+iqJ54dxI+zoy1rdEBmemDRBRAd4HtLfY+Lon1jwxWPThybRAmkV9 ZmXmT/axaLMu8bVVoeelT7uV9r4VXN24m2HNjwDYaNdBcnTgdgNpxtZIVdI9mE6PtF4Bn8 KfuaOh4KsUagYSMsLTygO1hBqJCqXIiLL7ISbLa0OCw0IY3T2Aq8zt5tuijIiDPE9NCcUI efqq+DJAwQvs4DKidb63PJVRO8ALKtuymCplv2hG5ZPo7ilWi+dqgLahTQoIdA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv75z0JLXz18XG for ; Mon, 06 Jul 2026 15:08:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1be06 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 15:08:23 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 302d3a21ad9a - main - cpu: cpu_get_pcpuid(): Fix typo in herald comment 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 302d3a21ad9aae26a55aa8d8396c69f8ca8ac33e Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 15:08:23 +0000 Message-Id: <6a4bc4e7.1be06.838c56@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=302d3a21ad9aae26a55aa8d8396c69f8ca8ac33e commit 302d3a21ad9aae26a55aa8d8396c69f8ca8ac33e Author: Olivier Certner AuthorDate: 2026-07-06 14:49:58 +0000 Commit: Olivier Certner CommitDate: 2026-07-06 15:07:58 +0000 cpu: cpu_get_pcpuid(): Fix typo in herald comment Fixes: c3c8f4d9e662 ("cpu: New cpu_get_pcpuid(), retrieves internal CPU ID") Sponsored by: The FreeBSD Foundation --- sys/sys/cpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/cpu.h b/sys/sys/cpu.h index 9156fa9f723d..7b5d45e98f47 100644 --- a/sys/sys/cpu.h +++ b/sys/sys/cpu.h @@ -53,7 +53,7 @@ cpu_get_pcpu(device_t dev) /* * Assumes the parent bus sets the CPU_IVAR_PCPU instance variable, which most - * CPU buses do. A panic will ensure if not the case. Calling devices should + * CPU buses do. A panic will ensue if not the case. Calling devices should * check for that condition (most probably in their attach function). */ static __inline u_int From nobody Mon Jul 6 15:24:38 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 4gv7Sk50B1z6kDJG for ; Mon, 06 Jul 2026 15:24:38 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv7Sk3gHKz3D1n for ; Mon, 06 Jul 2026 15:24:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783351478; 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=RyWNS7koqghM3IS1pz5KeWpKu2RSiX1klV/fsf7d0+o=; b=MOf4hrqkd2owztwB5JGlJU4m1t9cQGaGgVd+t3SVe4AzhwDTDgXiDIEdiMPfTy3uLTktGq +TE2aiGDG9gEaOr/TKV33W86V1PpNnp/mXSAHWYVOow0w5ynhHmOYtSG7iQPgSSb71LMUt zRThaxr5EcEPRpd2lpbQQm/Zoe+RlJ2JBdgwU6YCu9MYMX5Q9TyXkDeGbiI+Hl8vdWsJqq wVulVSJIfqkO3yI8TLrORgg2pFln3735zh8/MvDy9HnqMhSWUc9ol8/eYzrFRIa90Bs+Uk F9Hl4r0CoNSzac9zqXgeLNsaQAxFOCeyKRAw5XrOZlWrJFSzogXyHsHafArZkQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783351478; a=rsa-sha256; cv=none; b=kHtxmxGtwcfCpyl0WdbsKzvAl7FLbEx7mwnK74bEn55bji5D2G5iT3vZXzPh7Nab5wBmm7 z5pRZ8diotZljO4m57TLJCB270bJhxKQFVzTM/QEOXOUFlOWx9lsw02BfnlpXIdkzSKxhZ PENRUQHiVMdJx1XBEzakAKQ5rO0dwjEW8Dk10e8RX7QMuTMDWSHWN2+Ga9mpifLljJNWvH ewIPdCB6AFHH2pT5p+1ALWCRC24xTt6jp9C6b+T3TfjjYMx90Cku/tVQgtf17NdmFUC/bd 1cYtzcf8EfXCLG2IpOaUIA4r+P3csA37alALqGSIEgp6ABsopUBFLE9zEkya7A== 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=1783351478; 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=RyWNS7koqghM3IS1pz5KeWpKu2RSiX1klV/fsf7d0+o=; b=qRnt7XYd1JEVpCfh2LO9pzVr1Ght+pihz7VAtFgMRILXPLHF5boJHmnv+R7ikbbRsfx+1d ajQt71+JDwoZ9YUiiBMneFhCTW7fL9/zJyvaXBLYZyFUsSZJ0OI8iA8Ec33NUizqIJQfkY Nek2zc4CrkQCYGmgXJZjecuAjwBjcjV3ZJFSJ1ENOp6b/W6zjoIT3z2gJNVfZkwNbW/1aZ AQHRyjVoH3nIpLHvVHO2y8E52Im9BUg6liE9yjTOtGpe8VWcvO2RcVGHgyS49pdtuCuNax M64+wTlA9PH6KWykWe68PQGpRPhdy/DIolXgJVb2RnkzDz1pj+tKUGWGcWebcw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv7Sk2PNjz194M for ; Mon, 06 Jul 2026 15:24:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1d5aa by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 15:24:38 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Kajetan Puchalski From: Andrew Turner Subject: git: 5c7315317f5f - main - arm64/vmm: Add FEAT_NV2 definitions 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5c7315317f5f383168981eb4ab944e340acaf212 Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 15:24:38 +0000 Message-Id: <6a4bc8b6.1d5aa.4a548e43@gitrepo.freebsd.org> The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=5c7315317f5f383168981eb4ab944e340acaf212 commit 5c7315317f5f383168981eb4ab944e340acaf212 Author: Kajetan Puchalski AuthorDate: 2026-07-06 14:15:47 +0000 Commit: Andrew Turner CommitDate: 2026-07-06 15:18:29 +0000 arm64/vmm: Add FEAT_NV2 definitions Add the definitions for the VNCR_EL2 register and all of the offsets to registers in memory relative to the page stored in VNCR_EL2. Signed-off-by: Kajetan Puchalski Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D56550 --- sys/arm64/include/hypervisor.h | 101 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/sys/arm64/include/hypervisor.h b/sys/arm64/include/hypervisor.h index bd77dcadc724..bc5b6f4344ee 100644 --- a/sys/arm64/include/hypervisor.h +++ b/sys/arm64/include/hypervisor.h @@ -2134,6 +2134,14 @@ #define VMPIDR_EL2_MT 0x0000000001000000 #define VMPIDR_EL2_RES1 0x0000000080000000 +/* VNCR_EL2 - Virtual Nested Control Register */ +#define VNCR_EL2_REG MRS_REG_ALT_NAME(VNCR_EL2) +#define VNCR_EL2_op0 3 +#define VNCR_EL2_op1 4 +#define VNCR_EL2_CRn 2 +#define VNCR_EL2_CRm 2 +#define VNCR_EL2_op2 0 + /* VTCR_EL2 - Virtualization Translation Control Register */ #define VTCR_EL2_RES1 (0x1UL << 31) #define VTCR_EL2_T0SZ_SHIFT 0 @@ -2177,4 +2185,97 @@ /* Assumed to be 0 by locore.S */ #define VTTBR_HOST 0x0000000000000000 +/* + * Memory offsets of registers redirected to memory by HCR_EL2.NV2 + * relative to the base address stored in VNCR_EL2. + */ +#define VNCR_VTTBR_EL2 0x20 +#define VNCR_VSTTBR_EL2 0x30 +#define VNCR_VTCR_EL2 0x40 +#define VNCR_VSTCR_EL2 0x48 +#define VNCR_VMPIDR_EL2 0x50 +#define VNCR_CNTVOFF_EL2 0x60 +#define VNCR_HCR_EL2 0x78 +#define VNCR_HSTR_EL2 0x80 +#define VNCR_VPIDR_EL2 0x88 +#define VNCR_TPIDR_EL2 0x90 +#define VNCR_HCRX_EL2 0xA0 +#define VNCR_VNCR_EL2 0xB0 +#define VNCR_CPACR_EL1 0x100 /* Architectural Feature Access Control Register */ +#define VNCR_CONTEXTIDR_EL1 0x108 /* Current Process Identifier */ +#define VNCR_SCTLR_EL1 0x110 /* System Control Register */ +#define VNCR_ACTLR_EL1 0x118 /* Auxiliary Control Register */ +#define VNCR_TCR_EL1 0x120 /* Translation Control Register */ +#define VNCR_AFSR0_EL1 0x128 /* Auxiliary Fault Status Register 0 */ +#define VNCR_AFSR1_EL1 0x130 /* Auxiliary Fault Status Register 1 */ +#define VNCR_ESR_EL1 0x138 /* Exception Syndrome Register */ +#define VNCR_MAIR_EL1 0x140 /* Memory Attribute Indirection Register */ +#define VNCR_AMAIR_EL1 0x148 /* Auxiliary Memory Attribute Indirection Register */ +#define VNCR_MDSCR_EL1 0x158 /* Monitor Debug System Control Register */ +#define VNCR_SPSR_EL1 0x160 /* Saved Program Status Register */ +#define VNCR_CNTV_CVAL_EL0 0x168 +#define VNCR_CNTV_CTL_EL0 0x170 +#define VNCR_CNTP_CVAL_EL0 0x178 +#define VNCR_CNTP_CTL_EL0 0x180 +#define VNCR_SCXTNUM_EL1 0x188 +#define VNCR_TFSR_EL1 0x190 +#define VNCR_HDFGRTR2_EL2 0x1A0 +#define VNCR_CNTPOFF_EL2 0x1A8 +#define VNCR_HDFGWTR2_EL2 0x1B0 +#define VNCR_HFGRTR_EL2 0x1B8 +#define VNCR_HFGWTR_EL2 0x1C0 +#define VNCR_HFGITR_EL2 0x1C8 +#define VNCR_HDFGRTR_EL2 0x1D0 +#define VNCR_HDFGWTR_EL2 0x1D8 +#define VNCR_ZCR_EL1 0x1E0 +#define VNCR_HAFGRTR_EL2 0x1E8 +#define VNCR_SMCR_EL1 0x1F0 +#define VNCR_SMPRIMAP_EL2 0x1F8 +#define VNCR_TTBR0_EL1 0x200 /* Translation Table Base Register 0 */ +#define VNCR_TTBR1_EL1 0x210 /* Translation Table Base Register 1 */ +#define VNCR_FAR_EL1 0x220 /* Fault Address Register */ +#define VNCR_ELR_EL1 0x230 /* Exception Link Register */ +#define VNCR_SP_EL1 0x240 +#define VNCR_VBAR_EL1 0x250 /* Vector Base Address Register */ +#define VNCR_TCR2_EL1 0x270 /* Translation Control Register 2 */ +#define VNCR_SCTLR2_EL1 0x278 +#define VNCR_MAIR2_EL1 0x280 +#define VNCR_AMAIR2_EL1 0x288 +#define VNCR_PIRE0_EL1 0x290 +#define VNCR_PIRE0_EL2 0x298 +#define VNCR_PIR_EL1 0x2A0 +#define VNCR_POR_EL1 0x2A8 +#define VNCR_S2PIR_EL2 0x2B0 +#define VNCR_S2POR_EL1 0x2B8 +#define VNCR_HFGRTR2_EL2 0x2C0 +#define VNCR_HFGWTR2_EL2 0x2C8 +#define VNCR_PFAR_EL1 0x2D0 +#define VNCR_HFGITR2_EL2 0x310 +#define VNCR_SCTLRMASK_EL1 0x318 +#define VNCR_CPACRMASK_EL1 0x320 +#define VNCR_SCTLR2MASK_EL1 0x328 +#define VNCR_TCRMASK_EL1 0x330 +#define VNCR_TCR2MASK_EL1 0x338 +#define VNCR_ACTLRMASK_EL1 0x340 +#define VNCR_ICH_HCR_EL2 0x4C0 +#define VNCR_ICH_VMCR_EL2 0x4C8 +#define VNCR_VDISR_EL2 0x500 +#define VNCR_VSESR_EL2 0x508 +#define VNCR_PMBLIMITR_EL1 0x800 +#define VNCR_PMBPTR_EL1 0x810 +#define VNCR_PMBSR_EL1 0x820 +#define VNCR_PMSCR_EL1 0x828 +#define VNCR_PMSEVFR_EL1 0x830 +#define VNCR_PMSICR_EL1 0x838 +#define VNCR_PMSIRR_EL1 0x840 +#define VNCR_PMSLATFR_EL1 0x848 +#define VNCR_PMSNEVFR_EL1 0x850 +#define VNCR_PMSDSFR_EL1 0x858 +#define VNCR_TRFCR_EL1 0x880 +#define VNCR_TRCITECR_EL1 0x888 +#define VNCR_GCSPR_EL1 0x8C0 +#define VNCR_GCSCR_EL1 0x8D0 +#define VNCR_BRBCR_EL1 0x8E0 +#define VNCR_SPMACCESSR_EL1 0x8E8 + #endif /* !_MACHINE_HYPERVISOR_H_ */ From nobody Mon Jul 6 15:24:39 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 4gv7Sm648Pz6kDQv for ; Mon, 06 Jul 2026 15:24:40 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv7Sl5W8Xz3D4P for ; Mon, 06 Jul 2026 15:24:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783351479; 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=bfvgFOMRYMVCLWUw5ImYMJyFOQjoXL/qKZA5Ja3dSiY=; b=uFrsOU6EEfUGPDWn12qTcxP/AWkKOne8Luy65P6CBl+HksP+yma2QniUdPy1DBN0ni1BUG oTRcymP7f4g7L7AmCML2Tt5If+ZRERVTlUxf/8IBFMFvLRxpondS65ewV0vPa5XCFpn0MD NtRoaYAnj7eKPmiUwICSErYOGWEg/g3p6ZwQgz1vm/Q7jfQPKXtrZl+MOU5+pkb4CkuVdm GYZjyeWCtFGXeVqND4aEYLN8qjViJuWObxQqj55eFY4m4aFGgWzKbuoIWeSuNb7gS7Putq 2S2cYyodkNAES7gQEwDEaOaOBuxKo+DGxdcyMYFN3Qruwt8JMsFTLh9pqP3ijQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783351479; a=rsa-sha256; cv=none; b=bTiY84yAnQvpZBn/5jITMaihHgyZUjj092oGBVDksqTLuInwetAxPA65GdVklsBH/RnP0Y Fc+YKTmbrO+7NB1eQdkA/RvC3CDIWMsBjdwpxzSyrKbd1iJsbz+1SEqS8WzERomM/xmSHF a2QzEKMkyQ8fJ0R9D8312f0EpPxEtsgpWVcBEwX+mbbZqxdMDB2tXQlZiTROlkrDTL2V0g 7rGohSBvHPCOAe6pRSqdnlY8Yw5xsUvLP9IYbdzLq3t7w7dOq1itB7wEoceR3rLICvV8rV 7g/aB12tw3jS0uh6Z9kJzy8MImjiq8ZXk66tMdaL2ghRP7VwDtbVSeC5hpl7AA== 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=1783351479; 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=bfvgFOMRYMVCLWUw5ImYMJyFOQjoXL/qKZA5Ja3dSiY=; b=sD0OL0HXprdtrVEInEUSoyD+8HX8eJ5fj+zmu/5T1NzB+7EXoAE5F7k4UNV2I59el1BhK1 o7UByZiK+fqxRmJS+tLUn+5OWZHdLCXiDy4vrz+m3u5zYFP2IaVo5Xa9fwb5J+ctoq/iqo q+QZZD4dpnyFjQmlT9pO6YKUQC1acguf6sl5NBMZVqgxEQUquN8eMMN4EdBN8M1Jqv9k6h rZCj18+Fz+WaMf/ndbeyElTUQCGTzWsUNv3zohYceS5WoLOKrmXkNcwiVz9GDDj1+ybqlR N7X48J2NjjGGVyKwjR0jL0ZnLJDR7R3mt5vf8QhPI457FaOKnl/VsJX7atzFkQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv7Sl3J8vz194P for ; Mon, 06 Jul 2026 15:24:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1e2c2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 15:24:39 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Kajetan Puchalski From: Andrew Turner Subject: git: dd08cb0c8d6e - main - arm64/vmm: Use the VNCR_EL2 memory page to store guest registers 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dd08cb0c8d6e1737d2dddf978a0291f09911a715 Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 15:24:39 +0000 Message-Id: <6a4bc8b7.1e2c2.1d541648@gitrepo.freebsd.org> The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=dd08cb0c8d6e1737d2dddf978a0291f09911a715 commit dd08cb0c8d6e1737d2dddf978a0291f09911a715 Author: Kajetan Puchalski AuthorDate: 2026-07-06 14:16:34 +0000 Commit: Andrew Turner CommitDate: 2026-07-06 15:18:29 +0000 arm64/vmm: Use the VNCR_EL2 memory page to store guest registers Wherever possible, move the storage space for guest register values from the hypctx struct into a preallocated memory page matching the layout of the page pointed to by VNCR_EL2. This will streamline implementing support for nested virtualization, but the implementation itself is not reliant on the presence of nested virtualization architecture features. Signed-off-by: Kajetan Puchalski Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D56551 --- sys/arm64/include/hypervisor.h | 2 + sys/arm64/vmm/arm64.h | 168 +++++++++++++++++++++++++++++++++++------ sys/arm64/vmm/vmm_arm64.c | 78 ++++++++++++------- sys/arm64/vmm/vmm_hyp.c | 111 +++++++++++++++++---------- sys/arm64/vmm/vmm_nvhe.c | 3 + sys/arm64/vmm/vmm_reset.c | 22 +----- 6 files changed, 277 insertions(+), 107 deletions(-) diff --git a/sys/arm64/include/hypervisor.h b/sys/arm64/include/hypervisor.h index bc5b6f4344ee..0b6492785a0a 100644 --- a/sys/arm64/include/hypervisor.h +++ b/sys/arm64/include/hypervisor.h @@ -2185,6 +2185,8 @@ /* Assumed to be 0 by locore.S */ #define VTTBR_HOST 0x0000000000000000 +/* Size of the memory page pointed to by VNCR_EL2 */ +#define VNCR_PAGE_SIZE 4096 /* * Memory offsets of registers redirected to memory by HCR_EL2.NV2 * relative to the base address stored in VNCR_EL2. diff --git a/sys/arm64/vmm/arm64.h b/sys/arm64/vmm/arm64.h index 6062d1c07ae4..4db26709f21e 100644 --- a/sys/arm64/vmm/arm64.h +++ b/sys/arm64/vmm/arm64.h @@ -39,6 +39,109 @@ struct vgic_v3; struct vgic_v3_cpu; +/* + Encode the index of a given register within VNCR into the enum value. + We move the indices up by VNCR_START to not interfere with values for + non-VNCR registers. +*/ +#define VNCR_REG(reg) reg = (VNCR_START + VNCR_##reg / 8) +/* Retrieve the VNCR offset from the enum value */ +#define REG_VNCR_OFFSET(val) ((val - VNCR_START) * 8) + +enum hypctx_sysreg { + /* VNCR Registers */ + VNCR_START, + + VNCR_REG(VTTBR_EL2), + VNCR_REG(VSTTBR_EL2), + VNCR_REG(VTCR_EL2), + VNCR_REG(VSTCR_EL2), + VNCR_REG(VMPIDR_EL2), /* Virtualization Multiprocessor ID Register */ + VNCR_REG(CNTVOFF_EL2), + VNCR_REG(HCR_EL2), /* Hypervisor Configuration Register */ + VNCR_REG(HSTR_EL2), + VNCR_REG(VPIDR_EL2), /* Virtualization Processor ID Register */ + VNCR_REG(TPIDR_EL2), + VNCR_REG(HCRX_EL2), /* Extended Hypervisor Configuration Register */ + VNCR_REG(VNCR_EL2), + VNCR_REG(CPACR_EL1), /* Architectural Feature Access Control Register */ + VNCR_REG(CONTEXTIDR_EL1), /* Current Process Identifier */ + VNCR_REG(SCTLR_EL1), /* System Control Register */ + VNCR_REG(ACTLR_EL1), /* Auxiliary Control Register */ + VNCR_REG(TCR_EL1), /* Translation Control Register */ + VNCR_REG(AFSR0_EL1), /* Auxiliary Fault Status Register 0 */ + VNCR_REG(AFSR1_EL1), /* Auxiliary Fault Status Register 1 */ + VNCR_REG(ESR_EL1), /* Exception Syndrome Register */ + VNCR_REG(MAIR_EL1), /* Memory Attribute Indirection Register */ + VNCR_REG(AMAIR_EL1), /* Auxiliary Memory Attribute Indirection Register */ + VNCR_REG(MDSCR_EL1), /* Monitor Debug System Control Register */ + VNCR_REG(SPSR_EL1), /* Saved Program Status Register */ + VNCR_REG(CNTV_CVAL_EL0), + VNCR_REG(CNTV_CTL_EL0), + VNCR_REG(CNTP_CVAL_EL0), + VNCR_REG(CNTP_CTL_EL0), + VNCR_REG(SCXTNUM_EL1), + VNCR_REG(TFSR_EL1), + VNCR_REG(HDFGRTR2_EL2), + VNCR_REG(CNTPOFF_EL2), + VNCR_REG(HDFGWTR2_EL2), + VNCR_REG(HFGRTR_EL2), + VNCR_REG(HFGWTR_EL2), + VNCR_REG(HFGITR_EL2), + VNCR_REG(HDFGRTR_EL2), + VNCR_REG(HDFGWTR_EL2), + VNCR_REG(ZCR_EL1), + VNCR_REG(HAFGRTR_EL2), + VNCR_REG(SMCR_EL1), + VNCR_REG(SMPRIMAP_EL2), + VNCR_REG(TTBR0_EL1), /* Translation Table Base Register 0 */ + VNCR_REG(TTBR1_EL1), /* Translation Table Base Register 1 */ + VNCR_REG(FAR_EL1), /* Fault Address Register */ + VNCR_REG(ELR_EL1), /* Exception Link Register */ + VNCR_REG(SP_EL1), + VNCR_REG(VBAR_EL1), /* Vector Base Address Register */ + VNCR_REG(TCR2_EL1), /* Translation Control Register 2 */ + VNCR_REG(SCTLR2_EL1), + VNCR_REG(MAIR2_EL1), + VNCR_REG(AMAIR2_EL1), + VNCR_REG(PIRE0_EL1), + VNCR_REG(PIRE0_EL2), + VNCR_REG(PIR_EL1), + VNCR_REG(POR_EL1), + VNCR_REG(S2PIR_EL2), + VNCR_REG(S2POR_EL1), + VNCR_REG(HFGRTR2_EL2), + VNCR_REG(HFGWTR2_EL2), + VNCR_REG(PFAR_EL1), + VNCR_REG(HFGITR2_EL2), + VNCR_REG(SCTLRMASK_EL1), + VNCR_REG(CPACRMASK_EL1), + VNCR_REG(SCTLR2MASK_EL1), + VNCR_REG(TCRMASK_EL1), + VNCR_REG(TCR2MASK_EL1), + VNCR_REG(ACTLRMASK_EL1), + VNCR_REG(ICH_HCR_EL2), + VNCR_REG(ICH_VMCR_EL2), + VNCR_REG(VDISR_EL2), + VNCR_REG(VSESR_EL2), + VNCR_REG(PMBLIMITR_EL1), + VNCR_REG(PMBPTR_EL1), + VNCR_REG(PMBSR_EL1), + VNCR_REG(PMSCR_EL1), + VNCR_REG(PMSEVFR_EL1), + VNCR_REG(PMSICR_EL1), + VNCR_REG(PMSIRR_EL1), + VNCR_REG(PMSLATFR_EL1), + VNCR_REG(PMSNEVFR_EL1), + VNCR_REG(PMSDSFR_EL1), + VNCR_REG(TRFCR_EL1), + VNCR_REG(TRCITECR_EL1), + VNCR_REG(GCSPR_EL1), + VNCR_REG(GCSCR_EL1), + VNCR_REG(BRBCR_EL1), + VNCR_REG(SPMACCESSR_EL1), +}; + /* * Per-vCPU hypervisor state. */ @@ -46,34 +149,15 @@ struct hypctx { struct trapframe tf; /* - * EL1 control registers. + * EL1 & EL0 registers. */ - uint64_t elr_el1; /* Exception Link Register */ uint64_t sp_el0; /* Stack pointer */ uint64_t tpidr_el0; /* EL0 Software ID Register */ uint64_t tpidrro_el0; /* Read-only Thread ID Register */ uint64_t tpidr_el1; /* EL1 Software ID Register */ - uint64_t vbar_el1; /* Vector Base Address Register */ - - uint64_t actlr_el1; /* Auxiliary Control Register */ - uint64_t afsr0_el1; /* Auxiliary Fault Status Register 0 */ - uint64_t afsr1_el1; /* Auxiliary Fault Status Register 1 */ - uint64_t amair_el1; /* Auxiliary Memory Attribute Indirection Register */ - uint64_t contextidr_el1; /* Current Process Identifier */ - uint64_t cpacr_el1; /* Architectural Feature Access Control Register */ uint64_t csselr_el1; /* Cache Size Selection Register */ - uint64_t esr_el1; /* Exception Syndrome Register */ - uint64_t far_el1; /* Fault Address Register */ - uint64_t mair_el1; /* Memory Attribute Indirection Register */ uint64_t mdccint_el1; /* Monitor DCC Interrupt Enable Register */ - uint64_t mdscr_el1; /* Monitor Debug System Control Register */ uint64_t par_el1; /* Physical Address Register */ - uint64_t sctlr_el1; /* System Control Register */ - uint64_t tcr_el1; /* Translation Control Register */ - uint64_t tcr2_el1; /* Translation Control Register 2 */ - uint64_t ttbr0_el1; /* Translation Table Base Register 0 */ - uint64_t ttbr1_el1; /* Translation Table Base Register 1 */ - uint64_t spsr_el1; /* Saved Program Status Register */ uint64_t pmcr_el0; /* Performance Monitors Control Register */ uint64_t pmccntr_el0; @@ -100,6 +184,8 @@ struct hypctx { uint64_t mdcr_el2; /* Monitor Debug Configuration Register */ uint64_t vpidr_el2; /* Virtualization Processor ID Register */ uint64_t vmpidr_el2; /* Virtualization Multiprocessor ID Register */ + /* On systems without NV2 this still points to the register storage memory page */ + uint64_t vncr_el2; /* Virtual Nested Control Register */ /* FEAT_FGT registers */ /*uint64_t hafgrtr_el2; *//* For FEAT_AMUv1 (not supported) */ @@ -116,7 +202,6 @@ struct hypctx { uint64_t hfgrtr2_el2; uint64_t hfgwtr2_el2; - uint64_t el2_addr; /* The address of this in el2 space */ struct hyp *hyp; struct vcpu *vcpu; struct { @@ -136,8 +221,49 @@ struct hypctx { struct vgic_v3_cpu *vgic_cpu; bool has_exception; bool dbg_oslock; + + /* + * Memory page pointed at by VNCR_EL2. Contains storage for registers + * the accesses to which are redirected to memory by FEAT_NV2. + * NOTE: The storage is still used even if FEAT_NV2 is not present. + */ + void *vncr_regs; + /* Memory page used to store the host's values of VNCR registers. */ + void *host_vncr_regs; + + uint64_t el2_addr; /* The address of this in el2 space */ + uint64_t el2_vncr_addr; /* The address of vncr_regs in el2 space */ + uint64_t el2_host_vncr_addr; }; +/* For non-VHE vmm_hyp.c, this will already be defined in vmm_nvhe.c */ +#ifndef __hypctx_vncr_sysreg +#define __hypctx_vncr_sysreg(hypctx, reg) \ + ((uint64_t *)((char *)hypctx->vncr_regs + REG_VNCR_OFFSET(reg))) +#endif + +static inline uint64_t * +hypctx_sys_reg(struct hypctx *hypctx, int reg /* enum hypctx_sysreg */) +{ + if (reg > VNCR_START) + return (__hypctx_vncr_sysreg(hypctx, reg)); + /* TODO: uniform handling for non-VNCR registers */ + return (NULL); +} + +static inline void +hypctx_write_sys_reg(struct hypctx *hypctx, enum hypctx_sysreg reg, + uint64_t val) +{ + *hypctx_sys_reg(hypctx, reg) = val; +} + +static inline uint64_t +hypctx_read_sys_reg(struct hypctx *hypctx, enum hypctx_sysreg reg) +{ + return (*hypctx_sys_reg(hypctx, reg)); +} + struct hyp { struct vm *vm; struct vtimer vtimer; diff --git a/sys/arm64/vmm/vmm_arm64.c b/sys/arm64/vmm/vmm_arm64.c index 8fe0bf62bf8b..3615d2da66cc 100644 --- a/sys/arm64/vmm/vmm_arm64.c +++ b/sys/arm64/vmm/vmm_arm64.c @@ -490,7 +490,8 @@ el2_hyp_size(struct vm *vm) static vm_size_t el2_hypctx_size(void) { - return (round_page(sizeof(struct hypctx))); + /* Allocation for hypctx, one vncr page & one host state page */ + return (round_page(sizeof(struct hypctx) + 2 * VNCR_PAGE_SIZE)); } static vm_offset_t @@ -559,7 +560,17 @@ vmmops_vcpu_init(void *vmi, struct vcpu *vcpu1, int vcpuid) vm_size_t size; size = el2_hypctx_size(); + /* + * Allocation memory layout: + 0x0000 - 0x0fff <- struct hypctx + 0x1000 - 0x1fff <- VNCR memory page + 0x2000 - 0x2fff <- host_ctx memory page + */ hypctx = malloc_aligned(size, PAGE_SIZE, M_HYP, M_WAITOK | M_ZERO); + _Static_assert(sizeof(struct hypctx) < VNCR_PAGE_SIZE, + "struct hypctx exceeds VNCR_PAGE_SIZE"); + hypctx->vncr_regs = (void *)((char *)hypctx + VNCR_PAGE_SIZE); + hypctx->host_vncr_regs = (void *)((char *)hypctx + 2 * VNCR_PAGE_SIZE); KASSERT(vcpuid >= 0 && vcpuid < vm_get_maxcpus(hyp->vm), ("%s: Invalid vcpuid %d", __func__, vcpuid)); @@ -574,9 +585,12 @@ vmmops_vcpu_init(void *vmi, struct vcpu *vcpu1, int vcpuid) vtimer_cpuinit(hypctx); vgic_cpuinit(hypctx); - if (!in_vhe()) + if (!in_vhe()) { hypctx->el2_addr = el2_map_enter((vm_offset_t)hypctx, size, VM_PROT_READ | VM_PROT_WRITE); + hypctx->el2_vncr_addr = hypctx->el2_addr + VNCR_PAGE_SIZE; + hypctx->el2_host_vncr_addr = hypctx->el2_addr + 2 * VNCR_PAGE_SIZE; + } return (hypctx); } @@ -639,12 +653,14 @@ arm64_gen_inst_emul_data(struct hypctx *hypctx, uint32_t esr_iss, vie->reg = reg_num; paging = &vme_ret->u.inst_emul.paging; - paging->ttbr0_addr = hypctx->ttbr0_el1 & ~(TTBR_ASID_MASK | TTBR_CnP); - paging->ttbr1_addr = hypctx->ttbr1_el1 & ~(TTBR_ASID_MASK | TTBR_CnP); - paging->tcr_el1 = hypctx->tcr_el1; - paging->tcr2_el1 = hypctx->tcr2_el1; + paging->ttbr0_addr = hypctx_read_sys_reg(hypctx, TTBR0_EL1) & + ~(TTBR_ASID_MASK | TTBR_CnP); + paging->ttbr1_addr = hypctx_read_sys_reg(hypctx, TTBR1_EL1) & + ~(TTBR_ASID_MASK | TTBR_CnP); + paging->tcr_el1 = hypctx_read_sys_reg(hypctx, TCR_EL1); + paging->tcr2_el1 = hypctx_read_sys_reg(hypctx, TCR2_EL1); paging->flags = hypctx->tf.tf_spsr & (PSR_M_MASK | PSR_M_32); - if ((hypctx->sctlr_el1 & SCTLR_M) != 0) + if ((hypctx_read_sys_reg(hypctx, SCTLR_EL1) & SCTLR_M) != 0) paging->flags |= VM_GP_MMU_ENABLED; } @@ -1078,7 +1094,7 @@ fault: int vmmops_run(void *vcpui, register_t pc, pmap_t pmap, struct vm_eventinfo *evinfo) { - uint64_t excp_type; + uint64_t excp_type, vbar_el1; int handled; register_t daif; struct hyp *hyp; @@ -1097,36 +1113,41 @@ vmmops_run(void *vcpui, register_t pc, pmap_t pmap, struct vm_eventinfo *evinfo) for (;;) { if (hypctx->has_exception) { hypctx->has_exception = false; - hypctx->elr_el1 = hypctx->tf.tf_elr; + hypctx_write_sys_reg(hypctx, ELR_EL1, hypctx->tf.tf_elr); mode = hypctx->tf.tf_spsr & (PSR_M_MASK | PSR_M_32); + vbar_el1 = hypctx_read_sys_reg(hypctx, VBAR_EL1); if (mode == PSR_M_EL1t) { - hypctx->tf.tf_elr = hypctx->vbar_el1 + 0x0; + hypctx->tf.tf_elr = vbar_el1 + 0x0; } else if (mode == PSR_M_EL1h) { - hypctx->tf.tf_elr = hypctx->vbar_el1 + 0x200; + hypctx->tf.tf_elr = vbar_el1 + 0x200; } else if ((mode & PSR_M_32) == PSR_M_64) { /* 64-bit EL0 */ - hypctx->tf.tf_elr = hypctx->vbar_el1 + 0x400; + hypctx->tf.tf_elr = vbar_el1 + 0x400; } else { /* 32-bit EL0 */ - hypctx->tf.tf_elr = hypctx->vbar_el1 + 0x600; + hypctx->tf.tf_elr = vbar_el1 + 0x600; } /* Set the new spsr */ - hypctx->spsr_el1 = hypctx->tf.tf_spsr; + hypctx_write_sys_reg(hypctx, SPSR_EL1, hypctx->tf.tf_spsr); /* Set the new cpsr */ - hypctx->tf.tf_spsr = hypctx->spsr_el1 & PSR_FLAGS; + hypctx->tf.tf_spsr = hypctx_read_sys_reg(hypctx, + SPSR_EL1) & PSR_FLAGS; + hypctx->tf.tf_spsr |= PSR_DAIF | PSR_M_EL1h; /* * Update fields that may change on exeption entry * based on how sctlr_el1 is configured. */ - if ((hypctx->sctlr_el1 & SCTLR_SPAN) == 0) + if ((hypctx_read_sys_reg(hypctx, SCTLR_EL1) & + SCTLR_SPAN) == 0) hypctx->tf.tf_spsr |= PSR_PAN; - if ((hypctx->sctlr_el1 & SCTLR_DSSBS) == 0) + if ((hypctx_read_sys_reg(hypctx, SCTLR_EL1) & + SCTLR_DSSBS) == 0) hypctx->tf.tf_spsr &= ~PSR_SSBS; else hypctx->tf.tf_spsr |= PSR_SSBS; @@ -1259,15 +1280,15 @@ hypctx_regptr(struct hypctx *hypctx, int reg) case VM_REG_GUEST_PC: return (&hypctx->tf.tf_elr); case VM_REG_GUEST_SCTLR_EL1: - return (&hypctx->sctlr_el1); + return hypctx_sys_reg(hypctx, SCTLR_EL1); case VM_REG_GUEST_TTBR0_EL1: - return (&hypctx->ttbr0_el1); + return hypctx_sys_reg(hypctx, TTBR0_EL1); case VM_REG_GUEST_TTBR1_EL1: - return (&hypctx->ttbr1_el1); + return hypctx_sys_reg(hypctx, TTBR1_EL1); case VM_REG_GUEST_TCR_EL1: - return (&hypctx->tcr_el1); + return hypctx_sys_reg(hypctx, TCR_EL1); case VM_REG_GUEST_TCR2_EL1: - return (&hypctx->tcr2_el1); + return hypctx_sys_reg(hypctx, TCR2_EL1); case VM_REG_GUEST_MPIDR_EL1: return (&hypctx->vmpidr_el2); default: @@ -1327,8 +1348,8 @@ vmmops_exception(void *vcpui, uint64_t esr, uint64_t far) panic("%s: %s%d is running", __func__, vm_name(hypctx->hyp->vm), vcpu_vcpuid(hypctx->vcpu)); - hypctx->far_el1 = far; - hypctx->esr_el1 = esr; + hypctx_write_sys_reg(hypctx, FAR_EL1, far); + hypctx_write_sys_reg(hypctx, ESR_EL1, esr); hypctx->has_exception = true; return (0); @@ -1382,17 +1403,18 @@ vmmops_setcap(void *vcpui, int num, int val) if (val != 0) { hypctx->debug_spsr |= (hypctx->tf.tf_spsr & PSR_SS); - hypctx->debug_mdscr |= (hypctx->mdscr_el1 & MDSCR_SS); + hypctx->debug_mdscr |= + (hypctx_read_sys_reg(hypctx, MDSCR_EL1) & MDSCR_SS); hypctx->tf.tf_spsr |= PSR_SS; - hypctx->mdscr_el1 |= MDSCR_SS; + *hypctx_sys_reg(hypctx, MDSCR_EL1) |= MDSCR_SS; hypctx->mdcr_el2 |= MDCR_EL2_TDE; } else { hypctx->tf.tf_spsr &= ~PSR_SS; hypctx->tf.tf_spsr |= hypctx->debug_spsr; hypctx->debug_spsr &= ~PSR_SS; - hypctx->mdscr_el1 &= ~MDSCR_SS; - hypctx->mdscr_el1 |= hypctx->debug_mdscr; + *hypctx_sys_reg(hypctx, MDSCR_EL1) &= ~MDSCR_SS; + *hypctx_sys_reg(hypctx, MDSCR_EL1) |= hypctx->debug_mdscr; hypctx->debug_mdscr &= ~MDSCR_SS; if ((hypctx->setcaps & (1ul << VM_CAP_BRK_EXIT)) == 0) hypctx->mdcr_el2 &= ~MDCR_EL2_TDE; diff --git a/sys/arm64/vmm/vmm_hyp.c b/sys/arm64/vmm/vmm_hyp.c index 27fdf18e4700..bde283a077c8 100644 --- a/sys/arm64/vmm/vmm_hyp.c +++ b/sys/arm64/vmm/vmm_hyp.c @@ -246,30 +246,44 @@ vmm_hyp_reg_store(struct hypctx *hypctx, struct hyp *hyp, bool guest, hypctx->tpidrro_el0 = READ_SPECIALREG(tpidrro_el0); hypctx->tpidr_el1 = READ_SPECIALREG(tpidr_el1); - hypctx->actlr_el1 = READ_SPECIALREG(actlr_el1); + hypctx_write_sys_reg(hypctx, ACTLR_EL1, READ_SPECIALREG(actlr_el1)); hypctx->csselr_el1 = READ_SPECIALREG(csselr_el1); hypctx->mdccint_el1 = READ_SPECIALREG(mdccint_el1); - hypctx->mdscr_el1 = READ_SPECIALREG(mdscr_el1); + hypctx_write_sys_reg(hypctx, MDSCR_EL1, READ_SPECIALREG(mdscr_el1)); if (guest_or_nonvhe(guest)) { - hypctx->elr_el1 = READ_SPECIALREG(EL1_REG(ELR)); - hypctx->vbar_el1 = READ_SPECIALREG(EL1_REG(VBAR)); - - hypctx->afsr0_el1 = READ_SPECIALREG(EL1_REG(AFSR0)); - hypctx->afsr1_el1 = READ_SPECIALREG(EL1_REG(AFSR1)); - hypctx->amair_el1 = READ_SPECIALREG(EL1_REG(AMAIR)); - hypctx->contextidr_el1 = READ_SPECIALREG(EL1_REG(CONTEXTIDR)); - hypctx->cpacr_el1 = READ_SPECIALREG(EL1_REG(CPACR)); - hypctx->esr_el1 = READ_SPECIALREG(EL1_REG(ESR)); - hypctx->far_el1 = READ_SPECIALREG(EL1_REG(FAR)); - hypctx->mair_el1 = READ_SPECIALREG(EL1_REG(MAIR)); - hypctx->sctlr_el1 = READ_SPECIALREG(EL1_REG(SCTLR)); - hypctx->spsr_el1 = READ_SPECIALREG(EL1_REG(SPSR)); - hypctx->tcr_el1 = READ_SPECIALREG(EL1_REG(TCR)); + hypctx_write_sys_reg(hypctx, ELR_EL1, + READ_SPECIALREG(EL1_REG(ELR))); + hypctx_write_sys_reg(hypctx, VBAR_EL1, + READ_SPECIALREG(EL1_REG(VBAR))); + hypctx_write_sys_reg(hypctx, AFSR0_EL1, + READ_SPECIALREG(EL1_REG(AFSR0))); + hypctx_write_sys_reg(hypctx, AFSR1_EL1, + READ_SPECIALREG(EL1_REG(AFSR1))); + hypctx_write_sys_reg(hypctx, AMAIR_EL1, + READ_SPECIALREG(EL1_REG(AMAIR))); + hypctx_write_sys_reg(hypctx, CONTEXTIDR_EL1, + READ_SPECIALREG(EL1_REG(CONTEXTIDR))); + hypctx_write_sys_reg(hypctx, CPACR_EL1, + READ_SPECIALREG(EL1_REG(CPACR))); + hypctx_write_sys_reg(hypctx, ESR_EL1, + READ_SPECIALREG(EL1_REG(ESR))); + hypctx_write_sys_reg(hypctx, FAR_EL1, + READ_SPECIALREG(EL1_REG(FAR))); + hypctx_write_sys_reg(hypctx, MAIR_EL1, + READ_SPECIALREG(EL1_REG(MAIR))); + hypctx_write_sys_reg(hypctx, SCTLR_EL1, + READ_SPECIALREG(EL1_REG(SCTLR))); + hypctx_write_sys_reg(hypctx, SPSR_EL1, + READ_SPECIALREG(EL1_REG(SPSR))); + hypctx_write_sys_reg(hypctx, TCR_EL1, + READ_SPECIALREG(EL1_REG(TCR))); /* TODO: Support when this is not res0 */ - hypctx->tcr2_el1 = 0; - hypctx->ttbr0_el1 = READ_SPECIALREG(EL1_REG(TTBR0)); - hypctx->ttbr1_el1 = READ_SPECIALREG(EL1_REG(TTBR1)); + hypctx_write_sys_reg(hypctx, TCR2_EL1, 0); + hypctx_write_sys_reg(hypctx, TTBR0_EL1, + READ_SPECIALREG(EL1_REG(TTBR0))); + hypctx_write_sys_reg(hypctx, TTBR1_EL1, + READ_SPECIALREG(EL1_REG(TTBR1))); } hypctx->cptr_el2 = READ_SPECIALREG(cptr_el2); @@ -320,30 +334,43 @@ vmm_hyp_reg_restore(struct hypctx *hypctx, struct hyp *hyp, bool guest, WRITE_SPECIALREG(tpidrro_el0, hypctx->tpidrro_el0); WRITE_SPECIALREG(tpidr_el1, hypctx->tpidr_el1); - WRITE_SPECIALREG(actlr_el1, hypctx->actlr_el1); + WRITE_SPECIALREG(actlr_el1, hypctx_read_sys_reg(hypctx, ACTLR_EL1)); WRITE_SPECIALREG(csselr_el1, hypctx->csselr_el1); WRITE_SPECIALREG(mdccint_el1, hypctx->mdccint_el1); - WRITE_SPECIALREG(mdscr_el1, hypctx->mdscr_el1); + WRITE_SPECIALREG(mdscr_el1, hypctx_read_sys_reg(hypctx, MDSCR_EL1)); if (guest_or_nonvhe(guest)) { - WRITE_SPECIALREG(EL1_REG(ELR), hypctx->elr_el1); - WRITE_SPECIALREG(EL1_REG(VBAR), hypctx->vbar_el1); - - WRITE_SPECIALREG(EL1_REG(AFSR0), hypctx->afsr0_el1); - WRITE_SPECIALREG(EL1_REG(AFSR1), hypctx->afsr1_el1); - WRITE_SPECIALREG(EL1_REG(AMAIR), hypctx->amair_el1); - WRITE_SPECIALREG(EL1_REG(CONTEXTIDR), hypctx->contextidr_el1); - WRITE_SPECIALREG(EL1_REG(CPACR), hypctx->cpacr_el1); - WRITE_SPECIALREG(EL1_REG(ESR), hypctx->esr_el1); - WRITE_SPECIALREG(EL1_REG(FAR), hypctx->far_el1); - WRITE_SPECIALREG(EL1_REG(MAIR), hypctx->mair_el1); // - - WRITE_SPECIALREG(EL1_REG(SCTLR), hypctx->sctlr_el1); - WRITE_SPECIALREG(EL1_REG(SPSR), hypctx->spsr_el1); - WRITE_SPECIALREG(EL1_REG(TCR), hypctx->tcr_el1); + WRITE_SPECIALREG(EL1_REG(ELR), + hypctx_read_sys_reg(hypctx, ELR_EL1)); + WRITE_SPECIALREG(EL1_REG(VBAR), + hypctx_read_sys_reg(hypctx, VBAR_EL1)); + WRITE_SPECIALREG(EL1_REG(AFSR0), + hypctx_read_sys_reg(hypctx, AFSR0_EL1)); + WRITE_SPECIALREG(EL1_REG(AFSR1), + hypctx_read_sys_reg(hypctx, AFSR1_EL1)); + WRITE_SPECIALREG(EL1_REG(AMAIR), + hypctx_read_sys_reg(hypctx, AMAIR_EL1)); + WRITE_SPECIALREG(EL1_REG(CONTEXTIDR), + hypctx_read_sys_reg(hypctx, CONTEXTIDR_EL1)); + WRITE_SPECIALREG(EL1_REG(CPACR), + hypctx_read_sys_reg(hypctx, CPACR_EL1)); + WRITE_SPECIALREG(EL1_REG(ESR), + hypctx_read_sys_reg(hypctx, ESR_EL1)); + WRITE_SPECIALREG(EL1_REG(FAR), + hypctx_read_sys_reg(hypctx, FAR_EL1)); + WRITE_SPECIALREG(EL1_REG(MAIR), + hypctx_read_sys_reg(hypctx, MAIR_EL1)); + WRITE_SPECIALREG(EL1_REG(SCTLR), + hypctx_read_sys_reg(hypctx, SCTLR_EL1)); + WRITE_SPECIALREG(EL1_REG(SPSR), + hypctx_read_sys_reg(hypctx, SPSR_EL1)); + WRITE_SPECIALREG(EL1_REG(TCR), + hypctx_read_sys_reg(hypctx, TCR_EL1)); /* TODO: tcr2_el1 */ - WRITE_SPECIALREG(EL1_REG(TTBR0), hypctx->ttbr0_el1); - WRITE_SPECIALREG(EL1_REG(TTBR1), hypctx->ttbr1_el1); + WRITE_SPECIALREG(EL1_REG(TTBR0), + hypctx_read_sys_reg(hypctx, TTBR0_EL1)); + WRITE_SPECIALREG(EL1_REG(TTBR1), + hypctx_read_sys_reg(hypctx, TTBR1_EL1)); } if (guest) { @@ -542,7 +569,7 @@ vmm_hyp_reg_restore(struct hypctx *hypctx, struct hyp *hyp, bool guest, #define LOAD_APR(x) \ case x: \ WRITE_SPECIALREG(ich_ap0r ## x ##_el2, \ - hypctx->vgic_v3_regs.ich_ap0r_el2[x]); \ + hypctx->vgic_v3_regs.ich_ap0r_el2[x]); \ WRITE_SPECIALREG(ich_ap1r ## x ##_el2, \ hypctx->vgic_v3_regs.ich_ap1r_el2[x]) LOAD_APR(3); @@ -568,6 +595,12 @@ vmm_hyp_call_guest(struct hyp *hyp, struct hypctx *hypctx) uint64_t s1e1r, hpfar_el2; bool ecv_poff, hpfar_valid; + /* Allows uniform implementation of guest and host register reloads */ + host_hypctx.vncr_regs = hypctx->host_vncr_regs; +#ifndef VMM_VHE + host_hypctx.el2_vncr_addr = hypctx->el2_host_vncr_addr; +#endif + ecv_poff = (hyp->vtimer.cnthctl_el2 & CNTHCTL_ECV_EN) != 0; vmm_hyp_reg_store(&host_hypctx, NULL, false, ecv_poff); #ifndef VMM_VHE diff --git a/sys/arm64/vmm/vmm_nvhe.c b/sys/arm64/vmm/vmm_nvhe.c index 025b1308ce68..3d42fc1d5900 100644 --- a/sys/arm64/vmm/vmm_nvhe.c +++ b/sys/arm64/vmm/vmm_nvhe.c @@ -36,6 +36,9 @@ #define EL1_REG(reg) MRS_REG_ALT_NAME(reg ## _EL1) #define EL0_REG(reg) MRS_REG_ALT_NAME(reg ## _EL0) +#define __hypctx_vncr_sysreg(hypctx, reg) \ + ((uint64_t*)(hypctx->el2_vncr_addr + REG_VNCR_OFFSET(reg))) + #include "vmm_hyp.c" uint64_t vmm_hyp_enter(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t, diff --git a/sys/arm64/vmm/vmm_reset.c b/sys/arm64/vmm/vmm_reset.c index fd3414ecd066..4966de5c8fa5 100644 --- a/sys/arm64/vmm/vmm_reset.c +++ b/sys/arm64/vmm/vmm_reset.c @@ -55,19 +55,8 @@ reset_vm_el01_regs(void *vcpu) set_arch_unknown(el2ctx->tf); - set_arch_unknown(el2ctx->actlr_el1); - set_arch_unknown(el2ctx->afsr0_el1); - set_arch_unknown(el2ctx->afsr1_el1); - set_arch_unknown(el2ctx->amair_el1); - set_arch_unknown(el2ctx->contextidr_el1); - set_arch_unknown(el2ctx->cpacr_el1); set_arch_unknown(el2ctx->csselr_el1); - set_arch_unknown(el2ctx->elr_el1); - set_arch_unknown(el2ctx->esr_el1); - set_arch_unknown(el2ctx->far_el1); - set_arch_unknown(el2ctx->mair_el1); set_arch_unknown(el2ctx->mdccint_el1); - set_arch_unknown(el2ctx->mdscr_el1); set_arch_unknown(el2ctx->par_el1); /* @@ -77,19 +66,14 @@ reset_vm_el01_regs(void *vcpu) * SCTLR_CP15BEN: memory barrier instruction enable from EL0; RAO/WI * ~SCTLR_I: instruction cache off */ - el2ctx->sctlr_el1 = SCTLR_RES1; - el2ctx->sctlr_el1 &= ~SCTLR_M & ~SCTLR_C & ~SCTLR_I; - el2ctx->sctlr_el1 |= SCTLR_CP15BEN; + *hypctx_sys_reg(el2ctx, SCTLR_EL1) = SCTLR_RES1; + *hypctx_sys_reg(el2ctx, SCTLR_EL1) &= ~SCTLR_M & ~SCTLR_C & ~SCTLR_I; + *hypctx_sys_reg(el2ctx, SCTLR_EL1) |= SCTLR_CP15BEN; set_arch_unknown(el2ctx->sp_el0); - set_arch_unknown(el2ctx->tcr_el1); set_arch_unknown(el2ctx->tpidr_el0); set_arch_unknown(el2ctx->tpidr_el1); set_arch_unknown(el2ctx->tpidrro_el0); - set_arch_unknown(el2ctx->ttbr0_el1); - set_arch_unknown(el2ctx->ttbr1_el1); - set_arch_unknown(el2ctx->vbar_el1); - set_arch_unknown(el2ctx->spsr_el1); set_arch_unknown(el2ctx->dbgbcr_el1); set_arch_unknown(el2ctx->dbgbvr_el1); From nobody Mon Jul 6 15:24:40 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 4gv7Sp00DWz6kDQw for ; Mon, 06 Jul 2026 15:24:42 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv7Sm52N0z3D8m for ; Mon, 06 Jul 2026 15:24:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783351480; 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=hkPYg+OSBfOqcX8XPH4TtBDVvLUhkSvTFkrsWBgOAN0=; b=qIPvicmLRrGjBDt6vEM6lBkTxdzfElSi1ZPvX585uMpyk0+CQ0tpTZVerYg1xpm6kOnAF8 GE3gV8qvVWTxYk5WquZPeNcmgHJnHSThtsDEfibcbBLRzoq4894reiOiZQfDs8t5QWKdUX cfKHzMC0/Atb34iGP/kY3mwmy6bLjVMR04wbAAC5e4ki0a7N3ACFhSYpLo+IPu2Wc2MbAW vRZeg7juKke79pVjJuXGwY55zdqGwuJGJET7lzepqUzL4Ks6TS+SqGwWA+Hi0RYXpTtmeb lfAnSQuOA0Sc3PWhQ4KXExZoi3Tqe4Q/ujWAKgJU35xk3GOA6+tVM5a0CEKtcw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783351480; a=rsa-sha256; cv=none; b=YEjL7wG65vKFOxuH20vtZ5CufEbssbU2IRRVnB64lYPQWOdGC6f7XBj5XUmzFUXgFEcIsJ s91jjBtTBxzRFcYJGhc7SkTcffQ7/XTUaqx0zgq90zQTNpp9EssCRkRLcJkFt+Bndf8MFf ts/htk/nG20k0Xna3uc3IwPAyE1dfoFEWWejnYZMfMuQSEFiNrRgJl+aHSg36sIA/musre psQL7Zx4yAXU5rjOYQjXRfQn4l0A5b7g+a4ZCXYBp02oP8LIhaNZ+NKSnvVKdykFIPtJAo xfcAG5KKBcnWOC7cirVSBmtJYLOepoLTibuvihp/eifiIKrDo8htGUdFkzl5ow== 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=1783351480; 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=hkPYg+OSBfOqcX8XPH4TtBDVvLUhkSvTFkrsWBgOAN0=; b=BZZSaiMgOqIywdBVrzDEb3qxdy3S5dAJUm6Pz0jMDbvjvKba3u/bAHLEFn70a0YBMTLUKT ROIgenhVLEGeXySDvJHVYSGQTAKr0EtTmJU3t1hCTlIMPQnJ5k2hoGxemqu2kicama7KFA ieU+OMWuHMp/3U1igOdOwSX4A10ZaBd6c/Qa9Hduo9Q3YABX2qKhTfFwBHv3Jvz/otqtOV GnxanSAYKncdu3kFCahZJbBZZdeQxlJV7j56+EJgQIZaxozUebP+xs6fMpmb6bSBvNIpl2 C2ceutYBjDkM4wTR8LUoTw11Jq7oFCmsSXa31TXmqjpjq+5evfM2wNW5cWCarA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv7Sm3zfYz189Y for ; Mon, 06 Jul 2026 15:24:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1cdc2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 15:24:40 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Kajetan Puchalski From: Andrew Turner Subject: git: d2e3e76ab902 - main - arm64/vmm: Store non-VNCR registers in an array 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d2e3e76ab902001c62e8c9a6286d2979b0f2a0de Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 15:24:40 +0000 Message-Id: <6a4bc8b8.1cdc2.75cd5be8@gitrepo.freebsd.org> The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=d2e3e76ab902001c62e8c9a6286d2979b0f2a0de commit d2e3e76ab902001c62e8c9a6286d2979b0f2a0de Author: Kajetan Puchalski AuthorDate: 2026-07-06 14:17:03 +0000 Commit: Andrew Turner CommitDate: 2026-07-06 15:18:30 +0000 arm64/vmm: Store non-VNCR registers in an array Move non-VNCR EL0 and EL1 registers into a dedicated array inside of hypctx. This enables uniform accesses to both VNCR and non-VNCR guest register state through hypctx_[read|write]_sys_reg(). The accessors are _not_ used for non-VNCR EL2 registers in order to create a clear separation between guest-visible and guest-invisible register state. Signed-off-by: Kajetan Puchalski Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D56552 --- sys/arm64/vmm/arm64.h | 99 +++++++++++++++-------- sys/arm64/vmm/vmm_hyp.c | 199 +++++++++++++++++++++++++--------------------- sys/arm64/vmm/vmm_reset.c | 32 +------- 3 files changed, 181 insertions(+), 149 deletions(-) diff --git a/sys/arm64/vmm/arm64.h b/sys/arm64/vmm/arm64.h index 4db26709f21e..b90cc9d8d15f 100644 --- a/sys/arm64/vmm/arm64.h +++ b/sys/arm64/vmm/arm64.h @@ -48,7 +48,49 @@ struct vgic_v3_cpu; /* Retrieve the VNCR offset from the enum value */ #define REG_VNCR_OFFSET(val) ((val - VNCR_START) * 8) +/* Accessors for indices of PME and DBG registers */ +#define PMEVCNTR_EL0(n) (PMEVCNTR0_EL0 + MIN(n, 30)) +#define PMEVTYPER_EL0(n) (PMEVTYPER0_EL0 + MIN(n, 30)) +#define DBGBCR_EL1(n) (DBGBCR0_EL1 + MIN(n, 15)) +#define DBGBVR_EL1(n) (DBGBVR0_EL1 + MIN(n, 15)) +#define DBGWCR_EL1(n) (DBGWCR0_EL1 + MIN(n, 15)) +#define DBGWVR_EL1(n) (DBGWVR0_EL1 + MIN(n, 15)) + enum hypctx_sysreg { + CSSELR_EL1, /* Cache Size Selection Register */ + MDCCINT_EL1, /* Monitor DCC Interrupt Enable Register */ + PAR_EL1, /* Physical Address Register */ + + /* PMU Registers */ + PMCR_EL0, /* Performance Monitors Control Register */ + PMCCNTR_EL0, + PMCCFILTR_EL0, + PMUSERENR_EL0, + PMSELR_EL0, + PMXEVCNTR_EL0, + PMCNTENSET_EL0, + PMINTENSET_EL1, + PMOVSSET_EL0, + /* Access these through macros defined above, e.g. PMEVCNTR_EL0(5) */ + PMEVCNTR0_EL0, + PMEVCNTR30_EL0 = PMEVCNTR0_EL0 + 30, + PMEVTYPER0_EL0, + PMEVTYPER30_EL0 = PMEVTYPER0_EL0 + 30, + + /* DBG Registers */ + DBGCLAIMSET_EL1, + /* Access these through macros defined above, e.g. DBGBCR_EL1(5) */ + DBGBCR0_EL1, /* Debug Breakpoint Control Registers */ + DBGBCR15_EL1 = DBGBCR0_EL1 + 15, + DBGBVR0_EL1, /* Debug Breakpoint Value Registers */ + DBGBVR15_EL1 = DBGBVR0_EL1 + 15, + DBGWCR0_EL1, /* Debug Watchpoint Control Registers */ + DBGWCR15_EL1 = DBGWCR0_EL1 + 15, + DBGWVR0_EL1, /* Debug Watchpoint Value Registers */ + DBGWVR15_EL1 = DBGWVR0_EL1 + 15, + + NR_NON_VNCR_REGS, + /* VNCR Registers */ VNCR_START, @@ -140,6 +182,16 @@ enum hypctx_sysreg { VNCR_REG(GCSCR_EL1), VNCR_REG(BRBCR_EL1), VNCR_REG(SPMACCESSR_EL1), + + /* Virtual-address-sized registers */ + VA_REGS_START, + + SP_EL0, /* Stack pointer */ + TPIDR_EL0, /* EL0 Software ID Register */ + TPIDRRO_EL0, /* Read-only Thread ID Register */ + TPIDR_EL1, /* EL1 Software ID Register */ + + VA_REGS_END, }; /* @@ -147,37 +199,12 @@ enum hypctx_sysreg { */ struct hypctx { struct trapframe tf; + /* Virtual-address-sized registers */ + uint64_t va_regs[VA_REGS_END - VA_REGS_START - 1]; + /* Non-VNCR guest register state */ + uint64_t sys_regs[NR_NON_VNCR_REGS]; - /* - * EL1 & EL0 registers. - */ - uint64_t sp_el0; /* Stack pointer */ - uint64_t tpidr_el0; /* EL0 Software ID Register */ - uint64_t tpidrro_el0; /* Read-only Thread ID Register */ - uint64_t tpidr_el1; /* EL1 Software ID Register */ - uint64_t csselr_el1; /* Cache Size Selection Register */ - uint64_t mdccint_el1; /* Monitor DCC Interrupt Enable Register */ - uint64_t par_el1; /* Physical Address Register */ - - uint64_t pmcr_el0; /* Performance Monitors Control Register */ - uint64_t pmccntr_el0; - uint64_t pmccfiltr_el0; - uint64_t pmuserenr_el0; - uint64_t pmselr_el0; - uint64_t pmxevcntr_el0; - uint64_t pmcntenset_el0; - uint64_t pmintenset_el1; - uint64_t pmovsset_el0; - uint64_t pmevcntr_el0[31]; - uint64_t pmevtyper_el0[31]; - - uint64_t dbgclaimset_el1; - uint64_t dbgbcr_el1[16]; /* Debug Breakpoint Control Registers */ - uint64_t dbgbvr_el1[16]; /* Debug Breakpoint Value Registers */ - uint64_t dbgwcr_el1[16]; /* Debug Watchpoint Control Registers */ - uint64_t dbgwvr_el1[16]; /* Debug Watchpoint Value Registers */ - - /* EL2 control registers */ + /* EL2 registers which we use to control the guest but do not expose to it */ uint64_t cptr_el2; /* Architectural Feature Trap Register */ uint64_t hcr_el2; /* Hypervisor Configuration Register */ uint64_t hcrx_el2; /* Extended Hypervisor Configuration Register */ @@ -242,13 +269,21 @@ struct hypctx { ((uint64_t *)((char *)hypctx->vncr_regs + REG_VNCR_OFFSET(reg))) #endif +#ifndef __hypctx_va_sysreg +#define __hypctx_va_sysreg(hypctx, reg) \ + (&hypctx->va_regs[reg - VA_REGS_START - 1]) +#endif + static inline uint64_t * hypctx_sys_reg(struct hypctx *hypctx, int reg /* enum hypctx_sysreg */) { + /* Extract this into a separate helper when we actually support 128-bit regs */ + if (reg > VA_REGS_START) + return (__hypctx_va_sysreg(hypctx, reg)); if (reg > VNCR_START) return (__hypctx_vncr_sysreg(hypctx, reg)); - /* TODO: uniform handling for non-VNCR registers */ - return (NULL); + /* Calling this with reg=VNCR_START or reg=NR_NON_VNCR_REGS is a bad idea */ + return (&hypctx->sys_regs[reg]); } static inline void diff --git a/sys/arm64/vmm/vmm_hyp.c b/sys/arm64/vmm/vmm_hyp.c index bde283a077c8..469ae8b90d9e 100644 --- a/sys/arm64/vmm/vmm_hyp.c +++ b/sys/arm64/vmm/vmm_hyp.c @@ -120,16 +120,17 @@ vmm_hyp_reg_store(struct hypctx *hypctx, struct hyp *hyp, bool guest, } } - hypctx->dbgclaimset_el1 = READ_SPECIALREG(dbgclaimset_el1); + hypctx_write_sys_reg(hypctx, DBGCLAIMSET_EL1, + READ_SPECIALREG(dbgclaimset_el1)); dfr0 = READ_SPECIALREG(id_aa64dfr0_el1); switch (ID_AA64DFR0_BRPs_VAL(dfr0) - 1) { -#define STORE_DBG_BRP(x) \ - case x: \ - hypctx->dbgbcr_el1[x] = \ - READ_SPECIALREG(dbgbcr ## x ## _el1); \ - hypctx->dbgbvr_el1[x] = \ - READ_SPECIALREG(dbgbvr ## x ## _el1) +#define STORE_DBG_BRP(x) \ + case x: \ + hypctx_write_sys_reg(hypctx, DBGBCR_EL1(x), \ + READ_SPECIALREG(dbgbcr ## x ## _el1)); \ + hypctx_write_sys_reg(hypctx, DBGBVR_EL1(x), \ + READ_SPECIALREG(dbgbvr ## x ## _el1)) STORE_DBG_BRP(15); STORE_DBG_BRP(14); STORE_DBG_BRP(13); @@ -151,12 +152,12 @@ vmm_hyp_reg_store(struct hypctx *hypctx, struct hyp *hyp, bool guest, } switch (ID_AA64DFR0_WRPs_VAL(dfr0) - 1) { -#define STORE_DBG_WRP(x) \ - case x: \ - hypctx->dbgwcr_el1[x] = \ - READ_SPECIALREG(dbgwcr ## x ## _el1); \ - hypctx->dbgwvr_el1[x] = \ - READ_SPECIALREG(dbgwvr ## x ## _el1) +#define STORE_DBG_WRP(x) \ + case x: \ + hypctx_write_sys_reg(hypctx, DBGWCR_EL1(x), \ + READ_SPECIALREG(dbgwcr ## x ## _el1)); \ + hypctx_write_sys_reg(hypctx, DBGWVR_EL1(x), \ + READ_SPECIALREG(dbgwvr ## x ## _el1)) STORE_DBG_WRP(15); STORE_DBG_WRP(14); STORE_DBG_WRP(13); @@ -178,23 +179,33 @@ vmm_hyp_reg_store(struct hypctx *hypctx, struct hyp *hyp, bool guest, } /* Store the PMU registers */ - hypctx->pmcr_el0 = READ_SPECIALREG(pmcr_el0); - hypctx->pmccntr_el0 = READ_SPECIALREG(pmccntr_el0); - hypctx->pmccfiltr_el0 = READ_SPECIALREG(pmccfiltr_el0); - hypctx->pmuserenr_el0 = READ_SPECIALREG(pmuserenr_el0); - hypctx->pmselr_el0 = READ_SPECIALREG(pmselr_el0); - hypctx->pmxevcntr_el0 = READ_SPECIALREG(pmxevcntr_el0); - hypctx->pmcntenset_el0 = READ_SPECIALREG(pmcntenset_el0); - hypctx->pmintenset_el1 = READ_SPECIALREG(pmintenset_el1); - hypctx->pmovsset_el0 = READ_SPECIALREG(pmovsset_el0); - - switch ((hypctx->pmcr_el0 & PMCR_N_MASK) >> PMCR_N_SHIFT) { + hypctx_write_sys_reg(hypctx, PMCR_EL0, + READ_SPECIALREG(pmcr_el0)); + hypctx_write_sys_reg(hypctx, PMCCNTR_EL0, + READ_SPECIALREG(pmccntr_el0)); + hypctx_write_sys_reg(hypctx, PMCCFILTR_EL0, + READ_SPECIALREG(pmccfiltr_el0)); + hypctx_write_sys_reg(hypctx, PMUSERENR_EL0, + READ_SPECIALREG(pmuserenr_el0)); + hypctx_write_sys_reg(hypctx, PMSELR_EL0, + READ_SPECIALREG(pmselr_el0)); + hypctx_write_sys_reg(hypctx, PMXEVCNTR_EL0, + READ_SPECIALREG(pmxevcntr_el0)); + hypctx_write_sys_reg(hypctx, PMCNTENSET_EL0, + READ_SPECIALREG(pmcntenset_el0)); + hypctx_write_sys_reg(hypctx, PMINTENSET_EL1, + READ_SPECIALREG(pmintenset_el1)); + hypctx_write_sys_reg(hypctx, PMOVSSET_EL0, + READ_SPECIALREG(pmovsset_el0)); + + switch ((hypctx_read_sys_reg(hypctx, PMCR_EL0) & PMCR_N_MASK) >> + PMCR_N_SHIFT) { #define STORE_PMU(x) \ case (x + 1): \ - hypctx->pmevcntr_el0[x] = \ - READ_SPECIALREG(pmevcntr ## x ## _el0); \ - hypctx->pmevtyper_el0[x] = \ - READ_SPECIALREG(pmevtyper ## x ## _el0) + hypctx_write_sys_reg(hypctx, PMEVCNTR_EL0(x), \ + READ_SPECIALREG(pmevcntr ## x ## _el0)); \ + hypctx_write_sys_reg(hypctx, PMEVTYPER_EL0(x), \ + READ_SPECIALREG(pmevtyper ## x ## _el0)) STORE_PMU(30); STORE_PMU(29); STORE_PMU(28); @@ -237,53 +248,53 @@ vmm_hyp_reg_store(struct hypctx *hypctx, struct hyp *hyp, bool guest, hypctx->tf.tf_spsr = READ_SPECIALREG(spsr_el2); if (guest) { hypctx->tf.tf_esr = READ_SPECIALREG(esr_el2); - hypctx->par_el1 = READ_SPECIALREG(par_el1); + hypctx_write_sys_reg(hypctx, PAR_EL1, READ_SPECIALREG(par_el1)); } /* Store the guest special registers */ - hypctx->sp_el0 = READ_SPECIALREG(sp_el0); - hypctx->tpidr_el0 = READ_SPECIALREG(tpidr_el0); - hypctx->tpidrro_el0 = READ_SPECIALREG(tpidrro_el0); - hypctx->tpidr_el1 = READ_SPECIALREG(tpidr_el1); + hypctx_write_sys_reg(hypctx, SP_EL0, READ_SPECIALREG(sp_el0)); + hypctx_write_sys_reg(hypctx, TPIDR_EL0, READ_SPECIALREG(tpidr_el0)); + hypctx_write_sys_reg(hypctx, TPIDRRO_EL0, READ_SPECIALREG(tpidrro_el0)); + hypctx_write_sys_reg(hypctx, TPIDR_EL1, READ_SPECIALREG(tpidr_el1)); hypctx_write_sys_reg(hypctx, ACTLR_EL1, READ_SPECIALREG(actlr_el1)); - hypctx->csselr_el1 = READ_SPECIALREG(csselr_el1); - hypctx->mdccint_el1 = READ_SPECIALREG(mdccint_el1); + hypctx_write_sys_reg(hypctx, CSSELR_EL1, READ_SPECIALREG(csselr_el1)); + hypctx_write_sys_reg(hypctx, MDCCINT_EL1, READ_SPECIALREG(mdccint_el1)); hypctx_write_sys_reg(hypctx, MDSCR_EL1, READ_SPECIALREG(mdscr_el1)); if (guest_or_nonvhe(guest)) { hypctx_write_sys_reg(hypctx, ELR_EL1, - READ_SPECIALREG(EL1_REG(ELR))); + READ_SPECIALREG(EL1_REG(ELR))); hypctx_write_sys_reg(hypctx, VBAR_EL1, - READ_SPECIALREG(EL1_REG(VBAR))); + READ_SPECIALREG(EL1_REG(VBAR))); hypctx_write_sys_reg(hypctx, AFSR0_EL1, - READ_SPECIALREG(EL1_REG(AFSR0))); + READ_SPECIALREG(EL1_REG(AFSR0))); hypctx_write_sys_reg(hypctx, AFSR1_EL1, - READ_SPECIALREG(EL1_REG(AFSR1))); + READ_SPECIALREG(EL1_REG(AFSR1))); hypctx_write_sys_reg(hypctx, AMAIR_EL1, - READ_SPECIALREG(EL1_REG(AMAIR))); + READ_SPECIALREG(EL1_REG(AMAIR))); hypctx_write_sys_reg(hypctx, CONTEXTIDR_EL1, - READ_SPECIALREG(EL1_REG(CONTEXTIDR))); + READ_SPECIALREG(EL1_REG(CONTEXTIDR))); hypctx_write_sys_reg(hypctx, CPACR_EL1, - READ_SPECIALREG(EL1_REG(CPACR))); + READ_SPECIALREG(EL1_REG(CPACR))); hypctx_write_sys_reg(hypctx, ESR_EL1, - READ_SPECIALREG(EL1_REG(ESR))); + READ_SPECIALREG(EL1_REG(ESR))); hypctx_write_sys_reg(hypctx, FAR_EL1, - READ_SPECIALREG(EL1_REG(FAR))); + READ_SPECIALREG(EL1_REG(FAR))); hypctx_write_sys_reg(hypctx, MAIR_EL1, - READ_SPECIALREG(EL1_REG(MAIR))); + READ_SPECIALREG(EL1_REG(MAIR))); hypctx_write_sys_reg(hypctx, SCTLR_EL1, - READ_SPECIALREG(EL1_REG(SCTLR))); + READ_SPECIALREG(EL1_REG(SCTLR))); hypctx_write_sys_reg(hypctx, SPSR_EL1, - READ_SPECIALREG(EL1_REG(SPSR))); + READ_SPECIALREG(EL1_REG(SPSR))); hypctx_write_sys_reg(hypctx, TCR_EL1, - READ_SPECIALREG(EL1_REG(TCR))); + READ_SPECIALREG(EL1_REG(TCR))); /* TODO: Support when this is not res0 */ hypctx_write_sys_reg(hypctx, TCR2_EL1, 0); hypctx_write_sys_reg(hypctx, TTBR0_EL1, - READ_SPECIALREG(EL1_REG(TTBR0))); + READ_SPECIALREG(EL1_REG(TTBR0))); hypctx_write_sys_reg(hypctx, TTBR1_EL1, - READ_SPECIALREG(EL1_REG(TTBR1))); + READ_SPECIALREG(EL1_REG(TTBR1))); } hypctx->cptr_el2 = READ_SPECIALREG(cptr_el2); @@ -329,52 +340,52 @@ vmm_hyp_reg_restore(struct hypctx *hypctx, struct hyp *hyp, bool guest, } #endif - WRITE_SPECIALREG(sp_el0, hypctx->sp_el0); - WRITE_SPECIALREG(tpidr_el0, hypctx->tpidr_el0); - WRITE_SPECIALREG(tpidrro_el0, hypctx->tpidrro_el0); - WRITE_SPECIALREG(tpidr_el1, hypctx->tpidr_el1); + WRITE_SPECIALREG(sp_el0, hypctx_read_sys_reg(hypctx, SP_EL0)); + WRITE_SPECIALREG(tpidr_el0, hypctx_read_sys_reg(hypctx, TPIDR_EL0)); + WRITE_SPECIALREG(tpidrro_el0, hypctx_read_sys_reg(hypctx, TPIDRRO_EL0)); + WRITE_SPECIALREG(tpidr_el1, hypctx_read_sys_reg(hypctx, TPIDR_EL1)); WRITE_SPECIALREG(actlr_el1, hypctx_read_sys_reg(hypctx, ACTLR_EL1)); - WRITE_SPECIALREG(csselr_el1, hypctx->csselr_el1); - WRITE_SPECIALREG(mdccint_el1, hypctx->mdccint_el1); + WRITE_SPECIALREG(csselr_el1, hypctx_read_sys_reg(hypctx, CSSELR_EL1)); + WRITE_SPECIALREG(mdccint_el1, hypctx_read_sys_reg(hypctx, MDCCINT_EL1)); WRITE_SPECIALREG(mdscr_el1, hypctx_read_sys_reg(hypctx, MDSCR_EL1)); if (guest_or_nonvhe(guest)) { WRITE_SPECIALREG(EL1_REG(ELR), - hypctx_read_sys_reg(hypctx, ELR_EL1)); + hypctx_read_sys_reg(hypctx, ELR_EL1)); WRITE_SPECIALREG(EL1_REG(VBAR), - hypctx_read_sys_reg(hypctx, VBAR_EL1)); + hypctx_read_sys_reg(hypctx, VBAR_EL1)); WRITE_SPECIALREG(EL1_REG(AFSR0), - hypctx_read_sys_reg(hypctx, AFSR0_EL1)); + hypctx_read_sys_reg(hypctx, AFSR0_EL1)); WRITE_SPECIALREG(EL1_REG(AFSR1), - hypctx_read_sys_reg(hypctx, AFSR1_EL1)); + hypctx_read_sys_reg(hypctx, AFSR1_EL1)); WRITE_SPECIALREG(EL1_REG(AMAIR), - hypctx_read_sys_reg(hypctx, AMAIR_EL1)); + hypctx_read_sys_reg(hypctx, AMAIR_EL1)); WRITE_SPECIALREG(EL1_REG(CONTEXTIDR), - hypctx_read_sys_reg(hypctx, CONTEXTIDR_EL1)); + hypctx_read_sys_reg(hypctx, CONTEXTIDR_EL1)); WRITE_SPECIALREG(EL1_REG(CPACR), - hypctx_read_sys_reg(hypctx, CPACR_EL1)); + hypctx_read_sys_reg(hypctx, CPACR_EL1)); WRITE_SPECIALREG(EL1_REG(ESR), - hypctx_read_sys_reg(hypctx, ESR_EL1)); + hypctx_read_sys_reg(hypctx, ESR_EL1)); WRITE_SPECIALREG(EL1_REG(FAR), - hypctx_read_sys_reg(hypctx, FAR_EL1)); + hypctx_read_sys_reg(hypctx, FAR_EL1)); WRITE_SPECIALREG(EL1_REG(MAIR), - hypctx_read_sys_reg(hypctx, MAIR_EL1)); + hypctx_read_sys_reg(hypctx, MAIR_EL1)); WRITE_SPECIALREG(EL1_REG(SCTLR), - hypctx_read_sys_reg(hypctx, SCTLR_EL1)); + hypctx_read_sys_reg(hypctx, SCTLR_EL1)); WRITE_SPECIALREG(EL1_REG(SPSR), - hypctx_read_sys_reg(hypctx, SPSR_EL1)); + hypctx_read_sys_reg(hypctx, SPSR_EL1)); WRITE_SPECIALREG(EL1_REG(TCR), - hypctx_read_sys_reg(hypctx, TCR_EL1)); + hypctx_read_sys_reg(hypctx, TCR_EL1)); /* TODO: tcr2_el1 */ WRITE_SPECIALREG(EL1_REG(TTBR0), - hypctx_read_sys_reg(hypctx, TTBR0_EL1)); + hypctx_read_sys_reg(hypctx, TTBR0_EL1)); WRITE_SPECIALREG(EL1_REG(TTBR1), - hypctx_read_sys_reg(hypctx, TTBR1_EL1)); + hypctx_read_sys_reg(hypctx, TTBR1_EL1)); } if (guest) { - WRITE_SPECIALREG(par_el1, hypctx->par_el1); + WRITE_SPECIALREG(par_el1, hypctx_read_sys_reg(hypctx, PAR_EL1)); } WRITE_SPECIALREG(cptr_el2, hypctx->cptr_el2); @@ -387,27 +398,36 @@ vmm_hyp_reg_restore(struct hypctx *hypctx, struct hyp *hyp, bool guest, WRITE_SPECIALREG(spsr_el2, hypctx->tf.tf_spsr); /* Restore the PMU registers */ - WRITE_SPECIALREG(pmcr_el0, hypctx->pmcr_el0); - WRITE_SPECIALREG(pmccntr_el0, hypctx->pmccntr_el0); - WRITE_SPECIALREG(pmccfiltr_el0, hypctx->pmccfiltr_el0); - WRITE_SPECIALREG(pmuserenr_el0, hypctx->pmuserenr_el0); - WRITE_SPECIALREG(pmselr_el0, hypctx->pmselr_el0); - WRITE_SPECIALREG(pmxevcntr_el0, hypctx->pmxevcntr_el0); + WRITE_SPECIALREG(pmcr_el0, + hypctx_read_sys_reg(hypctx, PMCR_EL0)); + WRITE_SPECIALREG(pmccntr_el0, + hypctx_read_sys_reg(hypctx, PMCCNTR_EL0)); + WRITE_SPECIALREG(pmccfiltr_el0, + hypctx_read_sys_reg(hypctx, PMCCFILTR_EL0)); + WRITE_SPECIALREG(pmuserenr_el0, + hypctx_read_sys_reg(hypctx, PMUSERENR_EL0)); + WRITE_SPECIALREG(pmselr_el0, + hypctx_read_sys_reg(hypctx, PMSELR_EL0)); + WRITE_SPECIALREG(pmxevcntr_el0, + hypctx_read_sys_reg(hypctx, PMXEVCNTR_EL0)); /* Clear all events/interrupts then enable them */ WRITE_SPECIALREG(pmcntenclr_el0, ~0ul); - WRITE_SPECIALREG(pmcntenset_el0, hypctx->pmcntenset_el0); + WRITE_SPECIALREG(pmcntenset_el0, + hypctx_read_sys_reg(hypctx, PMCNTENSET_EL0)); WRITE_SPECIALREG(pmintenclr_el1, ~0ul); - WRITE_SPECIALREG(pmintenset_el1, hypctx->pmintenset_el1); + WRITE_SPECIALREG(pmintenset_el1, + hypctx_read_sys_reg(hypctx, PMINTENSET_EL1)); WRITE_SPECIALREG(pmovsclr_el0, ~0ul); - WRITE_SPECIALREG(pmovsset_el0, hypctx->pmovsset_el0); + WRITE_SPECIALREG(pmovsset_el0, + hypctx_read_sys_reg(hypctx, PMOVSSET_EL0)); - switch ((hypctx->pmcr_el0 & PMCR_N_MASK) >> PMCR_N_SHIFT) { + switch ((hypctx_read_sys_reg(hypctx, PMCR_EL0) & PMCR_N_MASK) >> PMCR_N_SHIFT) { #define LOAD_PMU(x) \ case (x + 1): \ WRITE_SPECIALREG(pmevcntr ## x ## _el0, \ - hypctx->pmevcntr_el0[x]); \ + hypctx_read_sys_reg(hypctx, PMEVCNTR_EL0(x))); \ WRITE_SPECIALREG(pmevtyper ## x ## _el0, \ - hypctx->pmevtyper_el0[x]) + hypctx_read_sys_reg(hypctx, PMEVTYPER_EL0(x))) LOAD_PMU(30); LOAD_PMU(29); LOAD_PMU(28); @@ -445,16 +465,17 @@ vmm_hyp_reg_restore(struct hypctx *hypctx, struct hyp *hyp, bool guest, } WRITE_SPECIALREG(dbgclaimclr_el1, ~0ul); - WRITE_SPECIALREG(dbgclaimclr_el1, hypctx->dbgclaimset_el1); + WRITE_SPECIALREG(dbgclaimclr_el1, + hypctx_read_sys_reg(hypctx, DBGCLAIMSET_EL1)); dfr0 = READ_SPECIALREG(id_aa64dfr0_el1); switch (ID_AA64DFR0_BRPs_VAL(dfr0) - 1) { #define LOAD_DBG_BRP(x) \ case x: \ WRITE_SPECIALREG(dbgbcr ## x ## _el1, \ - hypctx->dbgbcr_el1[x]); \ + hypctx_read_sys_reg(hypctx, DBGBCR_EL1(x))); \ WRITE_SPECIALREG(dbgbvr ## x ## _el1, \ - hypctx->dbgbvr_el1[x]) + hypctx_read_sys_reg(hypctx, DBGBVR_EL1(x))) LOAD_DBG_BRP(15); LOAD_DBG_BRP(14); LOAD_DBG_BRP(13); @@ -479,9 +500,9 @@ vmm_hyp_reg_restore(struct hypctx *hypctx, struct hyp *hyp, bool guest, #define LOAD_DBG_WRP(x) \ case x: \ WRITE_SPECIALREG(dbgwcr ## x ## _el1, \ - hypctx->dbgwcr_el1[x]); \ + hypctx_read_sys_reg(hypctx, DBGWCR_EL1(x))); \ WRITE_SPECIALREG(dbgwvr ## x ## _el1, \ - hypctx->dbgwvr_el1[x]) + hypctx_read_sys_reg(hypctx, DBGWVR_EL1(x))) LOAD_DBG_WRP(15); LOAD_DBG_WRP(14); LOAD_DBG_WRP(13); diff --git a/sys/arm64/vmm/vmm_reset.c b/sys/arm64/vmm/vmm_reset.c index 4966de5c8fa5..1280fe64277a 100644 --- a/sys/arm64/vmm/vmm_reset.c +++ b/sys/arm64/vmm/vmm_reset.c @@ -55,10 +55,6 @@ reset_vm_el01_regs(void *vcpu) set_arch_unknown(el2ctx->tf); - set_arch_unknown(el2ctx->csselr_el1); - set_arch_unknown(el2ctx->mdccint_el1); - set_arch_unknown(el2ctx->par_el1); - /* * Guest starts with: * ~SCTLR_M: MMU off @@ -70,29 +66,9 @@ reset_vm_el01_regs(void *vcpu) *hypctx_sys_reg(el2ctx, SCTLR_EL1) &= ~SCTLR_M & ~SCTLR_C & ~SCTLR_I; *hypctx_sys_reg(el2ctx, SCTLR_EL1) |= SCTLR_CP15BEN; - set_arch_unknown(el2ctx->sp_el0); - set_arch_unknown(el2ctx->tpidr_el0); - set_arch_unknown(el2ctx->tpidr_el1); - set_arch_unknown(el2ctx->tpidrro_el0); - - set_arch_unknown(el2ctx->dbgbcr_el1); - set_arch_unknown(el2ctx->dbgbvr_el1); - set_arch_unknown(el2ctx->dbgwcr_el1); - set_arch_unknown(el2ctx->dbgwvr_el1); - - el2ctx->pmcr_el0 = READ_SPECIALREG(pmcr_el0) & PMCR_N_MASK; - /* PMCR_LC is unknown when AArch32 is supported or RES1 otherwise */ - el2ctx->pmcr_el0 |= PMCR_LC; - set_arch_unknown(el2ctx->pmccntr_el0); - set_arch_unknown(el2ctx->pmccfiltr_el0); - set_arch_unknown(el2ctx->pmuserenr_el0); - set_arch_unknown(el2ctx->pmselr_el0); - set_arch_unknown(el2ctx->pmxevcntr_el0); - set_arch_unknown(el2ctx->pmcntenset_el0); - set_arch_unknown(el2ctx->pmintenset_el1); - set_arch_unknown(el2ctx->pmovsset_el0); - memset(el2ctx->pmevcntr_el0, 0, sizeof(el2ctx->pmevcntr_el0)); - memset(el2ctx->pmevtyper_el0, 0, sizeof(el2ctx->pmevtyper_el0)); + hypctx_write_sys_reg(el2ctx, PMCR_EL0, + /* PMCR_LC is unknown when AArch32 is supported or RES1 otherwise */ + (READ_SPECIALREG(pmcr_el0) & PMCR_N_MASK) | PMCR_LC); } void @@ -133,7 +109,7 @@ reset_vm_el2_regs(void *vcpu) el2ctx->mdcr_el2 = MDCR_EL2_TDOSA | MDCR_EL2_TDRA | MDCR_EL2_TPMS | MDCR_EL2_TTRF; /* PMCR_EL0.N is read from MDCR_EL2.HPMN */ - el2ctx->mdcr_el2 |= (el2ctx->pmcr_el0 & PMCR_N_MASK) >> PMCR_N_SHIFT; + el2ctx->mdcr_el2 |= (hypctx_read_sys_reg(el2ctx, PMCR_EL0) & PMCR_N_MASK) >> PMCR_N_SHIFT; el2ctx->vmpidr_el2 = VMPIDR_EL2_RES1; /* The guest will detect a multi-core, single-threaded CPU */ From nobody Mon Jul 6 15:24:42 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 4gv7Sq2VvSz6kDfJ for ; Mon, 06 Jul 2026 15:24:43 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv7Sp6GKrz3DFk for ; Mon, 06 Jul 2026 15:24:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783351482; 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=xkWEkvtyuSP1Tm3UT92evDoOi2+ahXIc5XW5rvxopt8=; b=ckam3GQFsivwedjPy1tXg9+P0kMiK40VWAqeP/TvmBd+fMiyjVJlTA5E/+w31HKNnv8SuS iB37BxnrlJQC3lffQuXMNe2iKylAimpO88kzmMaXLsarVKAa3M0IxWw47baITsIPqzd6R3 Fa8BJZvDi35+igSWnAkSA/FbhippTMxk0lD/v24vsB3nJibruc4PSD7EWqSJsztMBwplTr QgZndc/DCmmmrq39KSF7K3zlEEEoj6rg5gfhe+90pVYRfnYAbN+MDp5uNoDuzrWsoMnrns hPiWcOtFygs7H8zVVAJI9/81Slq3jBFQ+2f6hSJHJ4Q+E3T1JMKocQH5ELnpzQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783351482; a=rsa-sha256; cv=none; b=edByH8KglKgwBE3R+YtTxjAz2cWYnBTCDv50zGUBas9lwCpkYn9tXr8LzlYQDvqLauZL0h wF24DwmaM9oTZQye/ehaHs3toO3pqa8+xCNzPO20XjkjBgebsmfCyBmeMawZf/0leFgR4C 9lPqTqhssaVPNXo5Gh99K5C+PSVX3Ry1UQFcWKMfeuNS1Aj9f1dV0hGsLIT4Lpns0Xtsja 7jIhUWeC71OtAcO5iRUfiX8NEZW6Btll90CabrNLYBAv+ybirf6NuwSloAl8AgZ/OidaQI G9bLmICmAsDswOnyluzQti7ZKYYc75HvNAcnufitZD38R165K3BgHOfCAQ+xtQ== 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=1783351482; 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=xkWEkvtyuSP1Tm3UT92evDoOi2+ahXIc5XW5rvxopt8=; b=dIkLW/C0WldDDnihL+78NoXSzzmD4oHjv3o+RLzfO6bE/IOLTKl9W02KYcLhb7mX41MHiO AjxPqt1I088odIqRIeKES4weLcWesgtybhNj9SH8sa1mQpQc6AHv+WV2LNzv2jng+L81ft av421sj4ZGa/972qofQS29ljSuryuMcZ66DSdv6GWgA1bDb7N7cL1NgboeiWsY0KwbouVP /sI5l17jTUBRd9jUc9f1WszpFLiLsQ0h2MGR8hNHBQQ9UpyQG69zheh9VbNVwIZmklYSCP OExkv7bRAUGpqzCUOJygyaUoaB36NA6whJjFWfhDPowudHeLlxEqFsTGiIxvYw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv7Sp5KK8z189Z for ; Mon, 06 Jul 2026 15:24:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1dd46 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 15:24:42 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Kajetan Puchalski From: Andrew Turner Subject: git: f4c3458ab3ce - main - arm64/vmm: Move vttbr_el2 & vtimer into struct hypctx 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f4c3458ab3ce52ba9b234bee7711d0cb9a0745ac Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 15:24:42 +0000 Message-Id: <6a4bc8ba.1dd46.19bb853a@gitrepo.freebsd.org> The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=f4c3458ab3ce52ba9b234bee7711d0cb9a0745ac commit f4c3458ab3ce52ba9b234bee7711d0cb9a0745ac Author: Kajetan Puchalski AuthorDate: 2026-07-06 14:17:58 +0000 Commit: Andrew Turner CommitDate: 2026-07-06 15:18:30 +0000 arm64/vmm: Move vttbr_el2 & vtimer into struct hypctx Move vttbr_el2 & vtimer from struct hyp into struct hypctx to streamline the logic and handle them in the same way as other *_el2 registers are already being handled. Signed-off-by: Kajetan Puchalski Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D56554 --- sys/arm64/vmm/arm64.h | 6 ++- sys/arm64/vmm/io/vtimer.c | 99 ++++++++++++++++++++--------------------------- sys/arm64/vmm/io/vtimer.h | 1 - sys/arm64/vmm/vmm_arm64.c | 4 +- sys/arm64/vmm/vmm_hyp.c | 21 +++++----- 5 files changed, 56 insertions(+), 75 deletions(-) diff --git a/sys/arm64/vmm/arm64.h b/sys/arm64/vmm/arm64.h index 2b69f86da321..c43034454808 100644 --- a/sys/arm64/vmm/arm64.h +++ b/sys/arm64/vmm/arm64.h @@ -229,6 +229,8 @@ struct hypctx { uint64_t hfgrtr2_el2; uint64_t hfgwtr2_el2; + uint64_t vttbr_el2; + /* Storage for *host* timer registers */ struct { uint64_t cnthctl_el2; @@ -242,6 +244,7 @@ struct hypctx { uint64_t hpfar_el2; /* Hypervisor IPA Fault Address Register */ } exit_info; + struct vtimer vtimer; struct vtimer_cpu vtimer_cpu; uint64_t setcaps; /* Currently enabled capabilities. */ @@ -307,9 +310,8 @@ hypctx_read_sys_reg(struct hypctx *hypctx, enum hypctx_sysreg reg) struct hyp { struct vm *vm; - struct vtimer vtimer; uint64_t vmid_generation; - uint64_t vttbr_el2; + uint64_t cntvoff_el2; /* VM-wide virtual timer offset */ uint64_t el2_addr; /* The address of this in el2 space */ uint64_t feats; /* Which features are enabled */ #define HYP_FEAT_HCX (0x1ul << 0) diff --git a/sys/arm64/vmm/io/vtimer.c b/sys/arm64/vmm/io/vtimer.c index d1c489463882..ff29a06751e0 100644 --- a/sys/arm64/vmm/io/vtimer.c +++ b/sys/arm64/vmm/io/vtimer.c @@ -97,7 +97,7 @@ vtimer_virtual_timer_intr(void *arg) } cntpct_el0 = READ_SPECIALREG(cntpct_el0) - - hypctx->hyp->vtimer.cntvoff_el2; + hypctx->vtimer.cntvoff_el2; if (hypctx->vtimer_cpu.virt_timer.cntx_cval_el0 < cntpct_el0) vgic_inject_irq(hypctx->hyp, vcpu_vcpuid(hypctx->vcpu), GT_VIRT_IRQ, true); @@ -133,14 +133,35 @@ vtimer_init(void) } void -vtimer_vminit(struct hyp *hyp) +vtimer_cpuinit(struct hypctx *hypctx) { - uint64_t now; + struct vtimer_cpu *vtimer_cpu; bool ecv_poff; + vtimer_cpu = &hypctx->vtimer_cpu; + /* + * Configure physical timer interrupts for the VCPU. + * + * CNTP_CTL_IMASK: mask interrupts + * ~CNTP_CTL_ENABLE: disable the timer + */ + vtimer_cpu->phys_timer.cntx_ctl_el0 = CNTP_CTL_IMASK & ~CNTP_CTL_ENABLE; + + mtx_init(&vtimer_cpu->phys_timer.mtx, "vtimer phys callout mutex", NULL, + MTX_DEF); + callout_init_mtx(&vtimer_cpu->phys_timer.callout, + &vtimer_cpu->phys_timer.mtx, 0); + vtimer_cpu->phys_timer.irqid = GT_PHYS_NS_IRQ; + + mtx_init(&vtimer_cpu->virt_timer.mtx, "vtimer virt callout mutex", NULL, + MTX_DEF); + callout_init_mtx(&vtimer_cpu->virt_timer.callout, + &vtimer_cpu->virt_timer.mtx, 0); + vtimer_cpu->virt_timer.irqid = GT_VIRT_IRQ; + ecv_poff = false; - if (allow_ecv_phys && (hyp->feats & HYP_FEAT_ECV_POFF) != 0) + if (allow_ecv_phys && (hypctx->hyp->feats & HYP_FEAT_ECV_POFF) != 0) ecv_poff = true; /* @@ -165,17 +186,17 @@ vtimer_vminit(struct hyp *hyp) * * TODO: Don't trap when FEAT_ECV is present */ - hyp->vtimer.cnthctl_el2 = + hypctx->vtimer.cnthctl_el2 = CNTHCTL_E2H_EL0VCTEN_NOTRAP | CNTHCTL_E2H_EL0VTEN_NOTRAP; if (ecv_poff) { - hyp->vtimer.cnthctl_el2 |= + hypctx->vtimer.cnthctl_el2 |= CNTHCTL_E2H_EL0PCTEN_NOTRAP | CNTHCTL_E2H_EL0PTEN_NOTRAP | CNTHCTL_E2H_EL1PCTEN_NOTRAP | CNTHCTL_E2H_EL1PTEN_NOTRAP; } else { - hyp->vtimer.cnthctl_el2 |= + hypctx->vtimer.cnthctl_el2 |= CNTHCTL_E2H_EL0PCTEN_TRAP | CNTHCTL_E2H_EL0PTEN_TRAP | CNTHCTL_E2H_EL1PCTEN_TRAP | @@ -188,50 +209,20 @@ vtimer_vminit(struct hyp *hyp) * CNTHCTL_EL1PCTEN: trap access to CNTPCT_EL0 */ if (ecv_poff) { - hyp->vtimer.cnthctl_el2 = + hypctx->vtimer.cnthctl_el2 = CNTHCTL_EL1PCTEN_NOTRAP | CNTHCTL_EL1PCEN_NOTRAP; } else { - hyp->vtimer.cnthctl_el2 = + hypctx->vtimer.cnthctl_el2 = CNTHCTL_EL1PCTEN_TRAP | CNTHCTL_EL1PCEN_TRAP; } } if (ecv_poff) - hyp->vtimer.cnthctl_el2 |= CNTHCTL_ECV_EN; - - now = READ_SPECIALREG(cntpct_el0); - hyp->vtimer.cntvoff_el2 = now; + hypctx->vtimer.cnthctl_el2 |= CNTHCTL_ECV_EN; - return; -} - -void -vtimer_cpuinit(struct hypctx *hypctx) -{ - struct vtimer_cpu *vtimer_cpu; - - vtimer_cpu = &hypctx->vtimer_cpu; - /* - * Configure physical timer interrupts for the VCPU. - * - * CNTP_CTL_IMASK: mask interrupts - * ~CNTP_CTL_ENABLE: disable the timer - */ - vtimer_cpu->phys_timer.cntx_ctl_el0 = CNTP_CTL_IMASK & ~CNTP_CTL_ENABLE; - - mtx_init(&vtimer_cpu->phys_timer.mtx, "vtimer phys callout mutex", NULL, - MTX_DEF); - callout_init_mtx(&vtimer_cpu->phys_timer.callout, - &vtimer_cpu->phys_timer.mtx, 0); - vtimer_cpu->phys_timer.irqid = GT_PHYS_NS_IRQ; - - mtx_init(&vtimer_cpu->virt_timer.mtx, "vtimer virt callout mutex", NULL, - MTX_DEF); - callout_init_mtx(&vtimer_cpu->virt_timer.callout, - &vtimer_cpu->virt_timer.mtx, 0); - vtimer_cpu->virt_timer.irqid = GT_VIRT_IRQ; + hypctx->vtimer.cntvoff_el2 = hypctx->hyp->cntvoff_el2; } void @@ -289,10 +280,10 @@ vtimer_sync_hwstate(struct hypctx *hypctx) uint64_t cntpct_el0; cntpct_el0 = READ_SPECIALREG(cntpct_el0) - - hypctx->hyp->vtimer.cntvoff_el2; + hypctx->vtimer.cntvoff_el2; vtime_sync_timer(hypctx, &hypctx->vtimer_cpu.virt_timer, cntpct_el0); /* If FEAT_ECV_POFF is in use then we need to sync the physical timer */ - if ((hypctx->hyp->vtimer.cnthctl_el2 & CNTHCTL_ECV_EN) != 0) { + if ((hypctx->vtimer.cnthctl_el2 & CNTHCTL_ECV_EN) != 0) { vtime_sync_timer(hypctx, &hypctx->vtimer_cpu.phys_timer, cntpct_el0); } @@ -331,7 +322,7 @@ vtimer_schedule_irq(struct hypctx *hypctx, bool phys) else timer = &hypctx->vtimer_cpu.virt_timer; cntpct_el0 = READ_SPECIALREG(cntpct_el0) - - hypctx->hyp->vtimer.cntvoff_el2; + hypctx->vtimer.cntvoff_el2; if (timer->cntx_cval_el0 < cntpct_el0) { /* Timer set in the past, trigger interrupt */ vgic_inject_irq(hypctx->hyp, vcpu_vcpuid(hypctx->vcpu), @@ -381,16 +372,14 @@ vtimer_remove_irq(struct hypctx *hypctx, struct vcpu *vcpu) int vtimer_phys_ctl_read(struct vcpu *vcpu, uint64_t *rval, void *arg) { - struct hyp *hyp; struct hypctx *hypctx; struct vtimer_cpu *vtimer_cpu; uint64_t cntpct_el0; hypctx = vcpu_get_cookie(vcpu); - hyp = hypctx->hyp; vtimer_cpu = &hypctx->vtimer_cpu; - cntpct_el0 = READ_SPECIALREG(cntpct_el0) - hyp->vtimer.cntvoff_el2; + cntpct_el0 = READ_SPECIALREG(cntpct_el0) - hypctx->vtimer.cntvoff_el2; if (vtimer_cpu->phys_timer.cntx_cval_el0 < cntpct_el0) /* Timer condition met */ *rval = vtimer_cpu->phys_timer.cntx_ctl_el0 | CNTP_CTL_ISTATUS; @@ -430,12 +419,10 @@ vtimer_phys_ctl_write(struct vcpu *vcpu, uint64_t wval, void *arg) int vtimer_phys_cnt_read(struct vcpu *vcpu, uint64_t *rval, void *arg) { - struct vm *vm; - struct hyp *hyp; + struct hypctx *hypctx; - vm = vcpu_vm(vcpu); - hyp = vm_get_cookie(vm); - *rval = READ_SPECIALREG(cntpct_el0) - hyp->vtimer.cntvoff_el2; + hypctx = vcpu_get_cookie(vcpu); + *rval = READ_SPECIALREG(cntpct_el0) - hypctx->vtimer.cntvoff_el2; return (0); } @@ -481,13 +468,11 @@ vtimer_phys_cval_write(struct vcpu *vcpu, uint64_t wval, void *arg) int vtimer_phys_tval_read(struct vcpu *vcpu, uint64_t *rval, void *arg) { - struct hyp *hyp; struct hypctx *hypctx; struct vtimer_cpu *vtimer_cpu; uint32_t cntpct_el0; hypctx = vcpu_get_cookie(vcpu); - hyp = hypctx->hyp; vtimer_cpu = &hypctx->vtimer_cpu; if (!(vtimer_cpu->phys_timer.cntx_ctl_el0 & CNTP_CTL_ENABLE)) { @@ -500,7 +485,7 @@ vtimer_phys_tval_read(struct vcpu *vcpu, uint64_t *rval, void *arg) *rval = (uint32_t)RES1; } else { cntpct_el0 = READ_SPECIALREG(cntpct_el0) - - hyp->vtimer.cntvoff_el2; + hypctx->vtimer.cntvoff_el2; *rval = vtimer_cpu->phys_timer.cntx_cval_el0 - cntpct_el0; } @@ -510,16 +495,14 @@ vtimer_phys_tval_read(struct vcpu *vcpu, uint64_t *rval, void *arg) int vtimer_phys_tval_write(struct vcpu *vcpu, uint64_t wval, void *arg) { - struct hyp *hyp; struct hypctx *hypctx; struct vtimer_cpu *vtimer_cpu; uint64_t cntpct_el0; hypctx = vcpu_get_cookie(vcpu); - hyp = hypctx->hyp; vtimer_cpu = &hypctx->vtimer_cpu; - cntpct_el0 = READ_SPECIALREG(cntpct_el0) - hyp->vtimer.cntvoff_el2; + cntpct_el0 = READ_SPECIALREG(cntpct_el0) - hypctx->vtimer.cntvoff_el2; vtimer_cpu->phys_timer.cntx_cval_el0 = (int32_t)wval + cntpct_el0; vtimer_remove_irq(hypctx, vcpu); diff --git a/sys/arm64/vmm/io/vtimer.h b/sys/arm64/vmm/io/vtimer.h index 92ce025968d2..d415afa47acc 100644 --- a/sys/arm64/vmm/io/vtimer.h +++ b/sys/arm64/vmm/io/vtimer.h @@ -67,7 +67,6 @@ struct vtimer_cpu { }; int vtimer_init(void); -void vtimer_vminit(struct hyp *); void vtimer_cpuinit(struct hypctx *); void vtimer_cpucleanup(struct hypctx *); void vtimer_vmcleanup(struct hyp *); diff --git a/sys/arm64/vmm/vmm_arm64.c b/sys/arm64/vmm/vmm_arm64.c index 3615d2da66cc..43f45dc596c9 100644 --- a/sys/arm64/vmm/vmm_arm64.c +++ b/sys/arm64/vmm/vmm_arm64.c @@ -542,7 +542,7 @@ vmmops_init(struct vm *vm, pmap_t pmap) if (ID_AA64MMFR1_HCX_VAL(idreg) >= ID_AA64MMFR1_HCX_IMPL) hyp->feats |= HYP_FEAT_HCX; - vtimer_vminit(hyp); + hyp->cntvoff_el2 = READ_SPECIALREG(cntpct_el0); vgic_vminit(hyp); if (!in_vhe()) @@ -1170,7 +1170,7 @@ vmmops_run(void *vcpui, register_t pc, pmap_t pmap, struct vm_eventinfo *evinfo) /* Activate the stage2 pmap so the vmid is valid */ pmap_activate_vm(pmap); - hyp->vttbr_el2 = pmap_to_ttbr0(pmap); + hypctx->vttbr_el2 = pmap_to_ttbr0(pmap); /* * TODO: What happens if a timer interrupt is asserted exactly diff --git a/sys/arm64/vmm/vmm_hyp.c b/sys/arm64/vmm/vmm_hyp.c index 25b04d14dca8..070142199c44 100644 --- a/sys/arm64/vmm/vmm_hyp.c +++ b/sys/arm64/vmm/vmm_hyp.c @@ -241,13 +241,13 @@ vmm_hyp_reg_store_timer(struct hypctx *hypctx, struct hyp *hyp, bool guest) } else { hypctx->vtimer_cpu.cntkctl_el1 = READ_SPECIALREG(cntkctl_el1); - hypctx->host_timer_regs.cnthctl_el2 = + hypctx->vtimer.cnthctl_el2 = READ_SPECIALREG(cnthctl_el2); - hypctx->host_timer_regs.cntvoff_el2 = + hypctx->vtimer.cntvoff_el2 = READ_SPECIALREG(cntvoff_el2); } - ecv_poff = (hyp->vtimer.cnthctl_el2 & CNTHCTL_ECV_EN) != 0; + ecv_poff = (hypctx->vtimer.cnthctl_el2 & CNTHCTL_ECV_EN) != 0; if (guest_or_nonvhe(guest) && ecv_poff) { /* @@ -565,11 +565,12 @@ static void vmm_hyp_reg_restore_timer(struct hypctx *hypctx, struct hyp *hyp, bool guest) { bool ecv_poff; - ecv_poff = (hyp->vtimer.cnthctl_el2 & CNTHCTL_ECV_EN) != 0; + ecv_poff = (hypctx->vtimer.cnthctl_el2 & CNTHCTL_ECV_EN) != 0; + + WRITE_SPECIALREG(cnthctl_el2, hypctx->vtimer.cnthctl_el2); + WRITE_SPECIALREG(cntvoff_el2, hypctx->vtimer.cntvoff_el2); if (guest) { - WRITE_SPECIALREG(cnthctl_el2, hyp->vtimer.cnthctl_el2); - WRITE_SPECIALREG(cntvoff_el2, hyp->vtimer.cntvoff_el2); WRITE_SPECIALREG(EL1_REG(CNTKCTL), hypctx->vtimer_cpu.cntkctl_el1); WRITE_SPECIALREG(EL0_REG(CNTV_CVAL), @@ -583,14 +584,10 @@ vmm_hyp_reg_restore_timer(struct hypctx *hypctx, struct hyp *hyp, bool guest) * to keep in sync. */ WRITE_SPECIALREG(CNTPOFF_EL2_REG, - hyp->vtimer.cntvoff_el2); + hypctx->vtimer.cntvoff_el2); isb(); } } else { - WRITE_SPECIALREG(cnthctl_el2, - hypctx->host_timer_regs.cnthctl_el2); - WRITE_SPECIALREG(cntvoff_el2, - hypctx->host_timer_regs.cntvoff_el2); WRITE_SPECIALREG(cntkctl_el1, hypctx->vtimer_cpu.cntkctl_el1); } if (guest_or_nonvhe(guest) && ecv_poff) { @@ -736,7 +733,7 @@ static uint64_t __vmm_hyp_call_guest(struct hypctx *hypctx, struct hypctx *host_hypctx) { uint64_t ret; - WRITE_SPECIALREG(vttbr_el2, hypctx->hyp->vttbr_el2); + WRITE_SPECIALREG(vttbr_el2, hypctx->vttbr_el2); WRITE_SPECIALREG(mdcr_el2, hypctx->mdcr_el2); /* Call into the guest */ ret = VMM_HYP_FUNC(do_call_guest)(hypctx); From nobody Mon Jul 6 15:24:41 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 4gv7Sp3Xmyz6kDl7 for ; Mon, 06 Jul 2026 15:24:42 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv7Sn639mz3D93 for ; Mon, 06 Jul 2026 15:24:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783351481; 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=KC/Ywicje4OjAY/Ln4WEhYDm9gxidKL53IuPjCB4ruA=; b=CGWKocuiOsp91lZQ3pEUX8Xursri6hAQsZCf4pBCLxJ6bg/JSxDarStnOP9m+81tLsWR5q UCSRXCDFqTi/zFi6lSWJR5hRkt2rgX8AKNhoRu69kYw9b7gtVWnrIgL8/S01enGDIu9U4n oc8vslMo00nHvj2BpSeHW0qMD5BQJpn7nWTn7rDsGaQNIMvvyhFQWkJXTFQk+mNHaWS93/ AFNXivlYEEHnqnD3TUbfEWuOdKixdvJe9H/tujyCPNs/pF6QNIIIbJ1gPeKslUhCQjPkpa LVDZAMKBAWnPE5mPKdNNrnpnNLUOOKHQgkUVcQaIvT+5RNXeL4+BtvGOQsIzVA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783351481; a=rsa-sha256; cv=none; b=HIeJ32+jFPYVseLdZwJqefUTRqtQNYndzkTNMvZhFa0Ddx6/8xMfcZuny6wZdyelYmuwZC pzEKGkpmsZRdvo55IH9IVIiBAd/No3zJoTB6a+1oFgnexla3ap3ypvmvKPQIpNWE6UYMpK fAI1GCYXvX7Vmd0374R/pWpAxLqVe1SVasBdkXo2cwl/Wj+RjVAwyFepUtzuQZgr9q+oMy 8H/etbR1WDU/wEGV6ZqFRTk2OjQsCL+zFEdyaDPuu+QHRFFhheFl6pM3+rPFVpGj7DV0hi j0pnemFY6C2ip/Lv/f2pH3gO1VE5ruINJ8pZeG77VAkUcHNreEt+0us4/Jyh6g== 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=1783351481; 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=KC/Ywicje4OjAY/Ln4WEhYDm9gxidKL53IuPjCB4ruA=; b=I30fMgPUWt5eiOFEXZTR+/MFMwfPkNPgU6kSHb6AEGlhdy2wkk2UEiXaLUYFS3hPmU0N1w VhmQNyV7ilA8JTZrAYpXrM6GgHsfY+st2nF1YlTljTye8FCzMhIIVoWn+NvlVbcbkzfCMw MCf9A35vvKlqgImZUn/csp3bfz4qFfhz0xGF/UuBQeUPZanDUTpyt+Q2RydVKP05tWmjoC rXQnC+wozse82+O1dlCG9lMqEeyI2pUc0tl9WTbHT+2TUFliVFTGHuF3r1RaPI2E85equG RfTZ0g6uur0Q3LLvr913xQ05uggm6JAAPmpCX1PpspKoGGb8kImh83cDs97/Kg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv7Sn4Y8Qz194T for ; Mon, 06 Jul 2026 15:24:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1bcdc by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 15:24:41 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Kajetan Puchalski From: Andrew Turner Subject: git: e3cd6d104783 - main - arm64/vmm: Refactor vmm_hyp.c 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e3cd6d1047831f58bf704d207ba559c21af63e03 Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 15:24:41 +0000 Message-Id: <6a4bc8b9.1bcdc.4863c95b@gitrepo.freebsd.org> The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=e3cd6d1047831f58bf704d207ba559c21af63e03 commit e3cd6d1047831f58bf704d207ba559c21af63e03 Author: Kajetan Puchalski AuthorDate: 2026-07-06 14:17:31 +0000 Commit: Andrew Turner CommitDate: 2026-07-06 15:18:30 +0000 arm64/vmm: Refactor vmm_hyp.c Refactor vmm_hyp.c to split register reload logic by type of register, streamline the implementation and improve readability. Signed-off-by: Kajetan Puchalski Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D56553 --- sys/arm64/vmm/arm64.h | 6 + sys/arm64/vmm/vmm_hyp.c | 406 +++++++++++++++++++++++++++--------------------- 2 files changed, 234 insertions(+), 178 deletions(-) diff --git a/sys/arm64/vmm/arm64.h b/sys/arm64/vmm/arm64.h index b90cc9d8d15f..2b69f86da321 100644 --- a/sys/arm64/vmm/arm64.h +++ b/sys/arm64/vmm/arm64.h @@ -229,6 +229,12 @@ struct hypctx { uint64_t hfgrtr2_el2; uint64_t hfgwtr2_el2; + /* Storage for *host* timer registers */ + struct { + uint64_t cnthctl_el2; + uint64_t cntvoff_el2; + } host_timer_regs; + struct hyp *hyp; struct vcpu *vcpu; struct { diff --git a/sys/arm64/vmm/vmm_hyp.c b/sys/arm64/vmm/vmm_hyp.c index 469ae8b90d9e..25b04d14dca8 100644 --- a/sys/arm64/vmm/vmm_hyp.c +++ b/sys/arm64/vmm/vmm_hyp.c @@ -41,85 +41,9 @@ struct hypctx; uint64_t VMM_HYP_FUNC(do_call_guest)(struct hypctx *); static void -vmm_hyp_reg_store(struct hypctx *hypctx, struct hyp *hyp, bool guest, - bool ecv_poff) +vmm_hyp_reg_store_pmu_debug(struct hypctx *hypctx, bool guest) { uint64_t dfr0; - - if (guest) { - /* Store the timer registers */ - hypctx->vtimer_cpu.cntkctl_el1 = - READ_SPECIALREG(EL1_REG(CNTKCTL)); - hypctx->vtimer_cpu.virt_timer.cntx_cval_el0 = - READ_SPECIALREG(EL0_REG(CNTV_CVAL)); - hypctx->vtimer_cpu.virt_timer.cntx_ctl_el0 = - READ_SPECIALREG(EL0_REG(CNTV_CTL)); - } - if (guest_or_nonvhe(guest) && ecv_poff) { - /* - * If we have ECV then the guest could modify these registers. - * If VHE is enabled then the kernel will see a different view - * of the registers, so doesn't need to handle them. - */ - hypctx->vtimer_cpu.phys_timer.cntx_cval_el0 = - READ_SPECIALREG(EL0_REG(CNTP_CVAL)); - hypctx->vtimer_cpu.phys_timer.cntx_ctl_el0 = - READ_SPECIALREG(EL0_REG(CNTP_CTL)); - } - - if (guest) { - /* Store the GICv3 registers */ - hypctx->vgic_v3_regs.ich_eisr_el2 = - READ_SPECIALREG(ich_eisr_el2); - hypctx->vgic_v3_regs.ich_elrsr_el2 = - READ_SPECIALREG(ich_elrsr_el2); - hypctx->vgic_v3_regs.ich_hcr_el2 = - READ_SPECIALREG(ich_hcr_el2); - hypctx->vgic_v3_regs.ich_misr_el2 = - READ_SPECIALREG(ich_misr_el2); - hypctx->vgic_v3_regs.ich_vmcr_el2 = - READ_SPECIALREG(ich_vmcr_el2); - switch (hypctx->vgic_v3_regs.ich_lr_num - 1) { -#define STORE_LR(x) \ - case x: \ - hypctx->vgic_v3_regs.ich_lr_el2[x] = \ - READ_SPECIALREG(ich_lr ## x ##_el2) - STORE_LR(15); - STORE_LR(14); - STORE_LR(13); - STORE_LR(12); - STORE_LR(11); - STORE_LR(10); - STORE_LR(9); - STORE_LR(8); - STORE_LR(7); - STORE_LR(6); - STORE_LR(5); - STORE_LR(4); - STORE_LR(3); - STORE_LR(2); - STORE_LR(1); - default: - STORE_LR(0); -#undef STORE_LR - } - - switch (hypctx->vgic_v3_regs.ich_apr_num - 1) { -#define STORE_APR(x) \ - case x: \ - hypctx->vgic_v3_regs.ich_ap0r_el2[x] = \ - READ_SPECIALREG(ich_ap0r ## x ##_el2); \ - hypctx->vgic_v3_regs.ich_ap1r_el2[x] = \ - READ_SPECIALREG(ich_ap1r ## x ##_el2) - STORE_APR(3); - STORE_APR(2); - STORE_APR(1); - default: - STORE_APR(0); -#undef STORE_APR - } - } - hypctx_write_sys_reg(hypctx, DBGCLAIMSET_EL1, READ_SPECIALREG(dbgclaimset_el1)); @@ -242,12 +166,113 @@ vmm_hyp_reg_store(struct hypctx *hypctx, struct hyp *hyp, bool guest, #undef STORE_PMU } + if (!guest) + hypctx->mdcr_el2 = READ_SPECIALREG(mdcr_el2); +} + +static void +vmm_hyp_reg_store_vgic(struct hypctx *hypctx, bool guest) +{ + hypctx->vgic_v3_regs.ich_hcr_el2 = READ_SPECIALREG(ich_hcr_el2); + hypctx->vgic_v3_regs.ich_vmcr_el2 = READ_SPECIALREG(ich_vmcr_el2); + + if (!guest) + return; + + /* Store the GICv3 registers */ + hypctx->vgic_v3_regs.ich_eisr_el2 = READ_SPECIALREG(ich_eisr_el2); + hypctx->vgic_v3_regs.ich_elrsr_el2 = READ_SPECIALREG(ich_elrsr_el2); + hypctx->vgic_v3_regs.ich_misr_el2 = READ_SPECIALREG(ich_misr_el2); + + switch (hypctx->vgic_v3_regs.ich_lr_num - 1) { +#define STORE_LR(x) \ +case x: \ + hypctx->vgic_v3_regs.ich_lr_el2[x] = \ + READ_SPECIALREG(ich_lr ## x ##_el2) + STORE_LR(15); + STORE_LR(14); + STORE_LR(13); + STORE_LR(12); + STORE_LR(11); + STORE_LR(10); + STORE_LR(9); + STORE_LR(8); + STORE_LR(7); + STORE_LR(6); + STORE_LR(5); + STORE_LR(4); + STORE_LR(3); + STORE_LR(2); + STORE_LR(1); + default: + STORE_LR(0); +#undef STORE_LR + } + + switch (hypctx->vgic_v3_regs.ich_apr_num - 1) { +#define STORE_APR(x) \ +case x: \ + hypctx->vgic_v3_regs.ich_ap0r_el2[x] = \ + READ_SPECIALREG(ich_ap0r ## x ##_el2); \ + hypctx->vgic_v3_regs.ich_ap1r_el2[x] = \ + READ_SPECIALREG(ich_ap1r ## x ##_el2) + STORE_APR(3); + STORE_APR(2); + STORE_APR(1); + default: + STORE_APR(0); +#undef STORE_APR + } +} + +static void +vmm_hyp_reg_store_timer(struct hypctx *hypctx, struct hyp *hyp, bool guest) +{ + bool ecv_poff; + + if (guest) { + /* Store the timer registers */ + hypctx->vtimer_cpu.cntkctl_el1 = + READ_SPECIALREG(EL1_REG(CNTKCTL)); + hypctx->vtimer_cpu.virt_timer.cntx_cval_el0 = + READ_SPECIALREG(EL0_REG(CNTV_CVAL)); + hypctx->vtimer_cpu.virt_timer.cntx_ctl_el0 = + READ_SPECIALREG(EL0_REG(CNTV_CTL)); + } else { + hypctx->vtimer_cpu.cntkctl_el1 = + READ_SPECIALREG(cntkctl_el1); + hypctx->host_timer_regs.cnthctl_el2 = + READ_SPECIALREG(cnthctl_el2); + hypctx->host_timer_regs.cntvoff_el2 = + READ_SPECIALREG(cntvoff_el2); + } + + ecv_poff = (hyp->vtimer.cnthctl_el2 & CNTHCTL_ECV_EN) != 0; + + if (guest_or_nonvhe(guest) && ecv_poff) { + /* + * If we have ECV then the guest could modify these registers. + * If VHE is enabled then the kernel will see a different view + * of the registers, so doesn't need to handle them. + */ + hypctx->vtimer_cpu.phys_timer.cntx_cval_el0 = + READ_SPECIALREG(EL0_REG(CNTP_CVAL)); + hypctx->vtimer_cpu.phys_timer.cntx_ctl_el0 = + READ_SPECIALREG(EL0_REG(CNTP_CTL)); + } +} + +static void +vmm_hyp_reg_store_special(struct hypctx *hypctx, struct hyp *hyp, bool guest) +{ /* Store the special to from the trapframe */ hypctx->tf.tf_sp = READ_SPECIALREG(sp_el1); hypctx->tf.tf_elr = READ_SPECIALREG(elr_el2); hypctx->tf.tf_spsr = READ_SPECIALREG(spsr_el2); + if (guest) { hypctx->tf.tf_esr = READ_SPECIALREG(esr_el2); + hypctx->exit_info.far_el2 = READ_SPECIALREG(far_el2); hypctx_write_sys_reg(hypctx, PAR_EL1, READ_SPECIALREG(par_el1)); } @@ -301,21 +326,26 @@ vmm_hyp_reg_store(struct hypctx *hypctx, struct hyp *hyp, bool guest, hypctx->hcr_el2 = READ_SPECIALREG(hcr_el2); hypctx->vpidr_el2 = READ_SPECIALREG(vpidr_el2); hypctx->vmpidr_el2 = READ_SPECIALREG(vmpidr_el2); + +#ifndef VMM_VHE + if (!guest) { + if ((hyp->feats & HYP_FEAT_HCX) != 0) + hypctx->hcrx_el2 = + READ_SPECIALREG(MRS_REG_ALT_NAME(HCRX_EL2)); + } +#endif } static void -vmm_hyp_reg_restore(struct hypctx *hypctx, struct hyp *hyp, bool guest, - bool ecv_poff) +vmm_hyp_reg_restore_special(struct hypctx *hypctx, struct hyp *hyp, bool guest) { - uint64_t dfr0; - - /* Restore the special registers */ WRITE_SPECIALREG(hcr_el2, hypctx->hcr_el2); - if (guest) { + if (guest_or_nonvhe(guest)) { if ((hyp->feats & HYP_FEAT_HCX) != 0) WRITE_SPECIALREG(HCRX_EL2_REG, hypctx->hcrx_el2); } + isb(); #ifdef VMM_VHE @@ -396,6 +426,12 @@ vmm_hyp_reg_restore(struct hypctx *hypctx, struct hyp *hyp, bool guest, WRITE_SPECIALREG(sp_el1, hypctx->tf.tf_sp); WRITE_SPECIALREG(elr_el2, hypctx->tf.tf_elr); WRITE_SPECIALREG(spsr_el2, hypctx->tf.tf_spsr); +} + +static void +vmm_hyp_reg_restore_pmu_debug(struct hypctx *hypctx) +{ + uint64_t dfr0; /* Restore the PMU registers */ WRITE_SPECIALREG(pmcr_el0, @@ -421,7 +457,8 @@ vmm_hyp_reg_restore(struct hypctx *hypctx, struct hyp *hyp, bool guest, WRITE_SPECIALREG(pmovsset_el0, hypctx_read_sys_reg(hypctx, PMOVSSET_EL0)); - switch ((hypctx_read_sys_reg(hypctx, PMCR_EL0) & PMCR_N_MASK) >> PMCR_N_SHIFT) { + switch ((hypctx_read_sys_reg(hypctx, PMCR_EL0) & PMCR_N_MASK) >> + PMCR_N_SHIFT) { #define LOAD_PMU(x) \ case (x + 1): \ WRITE_SPECIALREG(pmevcntr ## x ## _el0, \ @@ -522,17 +559,23 @@ vmm_hyp_reg_restore(struct hypctx *hypctx, struct hyp *hyp, bool guest, LOAD_DBG_WRP(0); #undef LOAD_DBG_WRP } +} + +static void +vmm_hyp_reg_restore_timer(struct hypctx *hypctx, struct hyp *hyp, bool guest) +{ + bool ecv_poff; + ecv_poff = (hyp->vtimer.cnthctl_el2 & CNTHCTL_ECV_EN) != 0; if (guest) { - /* Load the timer registers */ + WRITE_SPECIALREG(cnthctl_el2, hyp->vtimer.cnthctl_el2); + WRITE_SPECIALREG(cntvoff_el2, hyp->vtimer.cntvoff_el2); WRITE_SPECIALREG(EL1_REG(CNTKCTL), hypctx->vtimer_cpu.cntkctl_el1); WRITE_SPECIALREG(EL0_REG(CNTV_CVAL), hypctx->vtimer_cpu.virt_timer.cntx_cval_el0); WRITE_SPECIALREG(EL0_REG(CNTV_CTL), hypctx->vtimer_cpu.virt_timer.cntx_ctl_el0); - WRITE_SPECIALREG(cnthctl_el2, hyp->vtimer.cnthctl_el2); - WRITE_SPECIALREG(cntvoff_el2, hyp->vtimer.cntvoff_el2); if (ecv_poff) { /* @@ -543,6 +586,12 @@ vmm_hyp_reg_restore(struct hypctx *hypctx, struct hyp *hyp, bool guest, hyp->vtimer.cntvoff_el2); isb(); } + } else { + WRITE_SPECIALREG(cnthctl_el2, + hypctx->host_timer_regs.cnthctl_el2); + WRITE_SPECIALREG(cntvoff_el2, + hypctx->host_timer_regs.cntvoff_el2); + WRITE_SPECIALREG(cntkctl_el1, hypctx->vtimer_cpu.cntkctl_el1); } if (guest_or_nonvhe(guest) && ecv_poff) { /* @@ -555,38 +604,45 @@ vmm_hyp_reg_restore(struct hypctx *hypctx, struct hyp *hyp, bool guest, WRITE_SPECIALREG(EL0_REG(CNTP_CTL), hypctx->vtimer_cpu.phys_timer.cntx_ctl_el0); } +} - if (guest) { - /* Load the GICv3 registers */ - WRITE_SPECIALREG(ich_hcr_el2, hypctx->vgic_v3_regs.ich_hcr_el2); - WRITE_SPECIALREG(ich_vmcr_el2, - hypctx->vgic_v3_regs.ich_vmcr_el2); - switch (hypctx->vgic_v3_regs.ich_lr_num - 1) { -#define LOAD_LR(x) \ - case x: \ - WRITE_SPECIALREG(ich_lr ## x ##_el2, \ - hypctx->vgic_v3_regs.ich_lr_el2[x]) - LOAD_LR(15); - LOAD_LR(14); - LOAD_LR(13); - LOAD_LR(12); - LOAD_LR(11); - LOAD_LR(10); - LOAD_LR(9); - LOAD_LR(8); - LOAD_LR(7); - LOAD_LR(6); - LOAD_LR(5); - LOAD_LR(4); - LOAD_LR(3); - LOAD_LR(2); - LOAD_LR(1); - default: - LOAD_LR(0); +static void +vmm_hyp_reg_restore_vgic(struct hypctx *hypctx, bool guest) +{ + /* Load the GICv3 registers */ + WRITE_SPECIALREG(ich_hcr_el2, hypctx->vgic_v3_regs.ich_hcr_el2); + WRITE_SPECIALREG(ich_vmcr_el2, + hypctx->vgic_v3_regs.ich_vmcr_el2); + + if (!guest) + return; + + switch (hypctx->vgic_v3_regs.ich_lr_num - 1) { +#define LOAD_LR(x) \ +case x: \ + WRITE_SPECIALREG(ich_lr ## x ##_el2, \ + hypctx->vgic_v3_regs.ich_lr_el2[x]) + LOAD_LR(15); + LOAD_LR(14); + LOAD_LR(13); + LOAD_LR(12); + LOAD_LR(11); + LOAD_LR(10); + LOAD_LR(9); + LOAD_LR(8); + LOAD_LR(7); + LOAD_LR(6); + LOAD_LR(5); + LOAD_LR(4); + LOAD_LR(3); + LOAD_LR(2); + LOAD_LR(1); + default: + LOAD_LR(0); #undef LOAD_LR - } + } - switch (hypctx->vgic_v3_regs.ich_apr_num - 1) { + switch (hypctx->vgic_v3_regs.ich_apr_num - 1) { #define LOAD_APR(x) \ case x: \ WRITE_SPECIALREG(ich_ap0r ## x ##_el2, \ @@ -599,64 +655,35 @@ vmm_hyp_reg_restore(struct hypctx *hypctx, struct hyp *hyp, bool guest, default: LOAD_APR(0); #undef LOAD_APR - } } } -static uint64_t -vmm_hyp_call_guest(struct hyp *hyp, struct hypctx *hypctx) +static void +vmm_hyp_reg_store(struct hypctx *hypctx, struct hyp *hyp, bool guest) { - struct hypctx host_hypctx; - uint64_t cntvoff_el2; - uint64_t ich_hcr_el2, ich_vmcr_el2, cnthctl_el2, cntkctl_el1; -#ifndef VMM_VHE - uint64_t hcrx_el2; -#endif - uint64_t ret; - uint64_t s1e1r, hpfar_el2; - bool ecv_poff, hpfar_valid; - - /* Allows uniform implementation of guest and host register reloads */ - host_hypctx.vncr_regs = hypctx->host_vncr_regs; -#ifndef VMM_VHE - host_hypctx.el2_vncr_addr = hypctx->el2_host_vncr_addr; -#endif - - ecv_poff = (hyp->vtimer.cnthctl_el2 & CNTHCTL_ECV_EN) != 0; - vmm_hyp_reg_store(&host_hypctx, NULL, false, ecv_poff); -#ifndef VMM_VHE - if ((hyp->feats & HYP_FEAT_HCX) != 0) - hcrx_el2 = READ_SPECIALREG(MRS_REG_ALT_NAME(HCRX_EL2)); -#endif - - /* Save the host special registers */ - cnthctl_el2 = READ_SPECIALREG(cnthctl_el2); - cntkctl_el1 = READ_SPECIALREG(cntkctl_el1); - cntvoff_el2 = READ_SPECIALREG(cntvoff_el2); - - ich_hcr_el2 = READ_SPECIALREG(ich_hcr_el2); - ich_vmcr_el2 = READ_SPECIALREG(ich_vmcr_el2); - - vmm_hyp_reg_restore(hypctx, hyp, true, ecv_poff); - - /* Load the common hypervisor registers */ - WRITE_SPECIALREG(vttbr_el2, hyp->vttbr_el2); - - host_hypctx.mdcr_el2 = READ_SPECIALREG(mdcr_el2); - WRITE_SPECIALREG(mdcr_el2, hypctx->mdcr_el2); - - /* Call into the guest */ - ret = VMM_HYP_FUNC(do_call_guest)(hypctx); + vmm_hyp_reg_store_vgic(hypctx, guest); + vmm_hyp_reg_store_timer(hypctx, hyp, guest); + vmm_hyp_reg_store_pmu_debug(hypctx, guest); + vmm_hyp_reg_store_special(hypctx, hyp, guest); +} - WRITE_SPECIALREG(mdcr_el2, host_hypctx.mdcr_el2); - isb(); +static void +vmm_hyp_reg_restore(struct hypctx *hypctx, struct hyp *hyp, bool guest) +{ + vmm_hyp_reg_restore_special(hypctx, hyp, guest); + vmm_hyp_reg_restore_pmu_debug(hypctx); + vmm_hyp_reg_restore_timer(hypctx, hyp, guest); + vmm_hyp_reg_restore_vgic(hypctx, guest); +} - /* Store the exit info */ - hypctx->exit_info.far_el2 = READ_SPECIALREG(far_el2); - vmm_hyp_reg_store(hypctx, hyp, true, ecv_poff); +static void +vmm_hyp_handle_guest_exit(struct hypctx *hypctx, uint64_t *ret) +{ + bool hpfar_valid; + uint64_t s1e1r, hpfar_el2; hpfar_valid = true; - if (ret == EXCP_TYPE_EL1_SYNC) { + if (*ret == EXCP_TYPE_EL1_SYNC) { switch (ESR_ELx_EXCEPTION(hypctx->tf.tf_esr)) { case EXCP_INSN_ABORT_L: case EXCP_DATA_ABORT_L: @@ -699,24 +726,47 @@ vmm_hyp_call_guest(struct hyp *hyp, struct hypctx *hypctx) hpfar_el2 <<= HPFAR_EL2_FIPA_SHIFT; hypctx->exit_info.hpfar_el2 = hpfar_el2; } else { - ret = EXCP_TYPE_REENTER; + *ret = EXCP_TYPE_REENTER; } } +} - vmm_hyp_reg_restore(&host_hypctx, NULL, false, ecv_poff); +/* Minimum guest entry logic that should not be reordered */ +static uint64_t +__vmm_hyp_call_guest(struct hypctx *hypctx, struct hypctx *host_hypctx) +{ + uint64_t ret; + WRITE_SPECIALREG(vttbr_el2, hypctx->hyp->vttbr_el2); + WRITE_SPECIALREG(mdcr_el2, hypctx->mdcr_el2); + /* Call into the guest */ + ret = VMM_HYP_FUNC(do_call_guest)(hypctx); + WRITE_SPECIALREG(mdcr_el2, host_hypctx->mdcr_el2); -#ifndef VMM_VHE - if ((hyp->feats & HYP_FEAT_HCX) != 0) - WRITE_SPECIALREG(MRS_REG_ALT_NAME(HCRX_EL2), hcrx_el2); -#endif + isb(); + + return ret; +} + +static uint64_t +vmm_hyp_call_guest(struct hyp *hyp, struct hypctx *hypctx) +{ + struct hypctx host_hypctx; + uint64_t ret; + + /* Allows uniform implementation of guest and host register reloads */ + host_hypctx.vncr_regs = hypctx->host_vncr_regs; + #ifndef VMM_VHE + host_hypctx.el2_vncr_addr = hypctx->el2_host_vncr_addr; + #endif + + vmm_hyp_reg_store(&host_hypctx, hyp, false); + vmm_hyp_reg_restore(hypctx, hyp, true); - /* Restore the host special registers */ - WRITE_SPECIALREG(ich_hcr_el2, ich_hcr_el2); - WRITE_SPECIALREG(ich_vmcr_el2, ich_vmcr_el2); + ret = __vmm_hyp_call_guest(hypctx, &host_hypctx); - WRITE_SPECIALREG(cnthctl_el2, cnthctl_el2); - WRITE_SPECIALREG(cntkctl_el1, cntkctl_el1); - WRITE_SPECIALREG(cntvoff_el2, cntvoff_el2); + vmm_hyp_reg_store(hypctx, hyp, true); + vmm_hyp_handle_guest_exit(hypctx, &ret); + vmm_hyp_reg_restore(&host_hypctx, hyp, false); return (ret); } From nobody Mon Jul 6 15:24:44 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 4gv7Ss4btPz6kDJL for ; Mon, 06 Jul 2026 15:24:45 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv7Ss139xz3DLS for ; Mon, 06 Jul 2026 15:24:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783351485; 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=t8qHUIVAMHpi9P4/lOSdG7RBn6mOxPlHXe97qtbDd2c=; b=k1kQ/pRuUGemA3FQUwMzu6WWJJnRKH0B4TGi5csEyRgee5BwXMRAmBnxuTyo31GQCXomHu EsLZ1/k8F+kre3RiDgfCvyIBi6Cs4BukJEkmNGb2pZZZnsEWueQWdxhbXlvIBcvXIiEB80 /5QRZFYYcbs/eHqmhYmo91TmDiFrGu/j1tK4+C1KrJGdbZNijB/3ymBuV/wV8Dfvm040ph ULXOiOHroNsUKnmH4v82xnd0KLo3InHdOz5cV7azMw5emWbX6Huqf/fp/4VHT9rAhQRKy7 5xX71VCTPULWjko9pbSa9G7MtUjqZR7SImQQ/DJ5wusE0XqskoG1mxMxP9biNg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783351485; a=rsa-sha256; cv=none; b=Jdc+5nOusVigUwyZTtRXmUgqiwoTCzOaaucub2N7PpNMMFupGn3np8LMrysdMwi0k5TJPy 1B5MzR5rwWjrqpF9LKFcry87bYfILWz/5UL+aFLsx/YnYemqzs9RGH9Lk5HpNBpQ9JtA77 VrGFw3ky0imYimrSDQzCwVmnPnwBX3tQ+YJTp1hHJlF/nH4bEjauju78X4i2rb+J82pQTQ SBiH868iayZO2Bp9Ljd0AzUPI1rW4yw3nfYzZUnjUAFO8gLJChygiAyPMvoLsFb32FJKqn rn6odicZhPQh6vKvQjJlk5UWr8ebtZc9XhXC+xPxP6wUNPpqsOYLjTyAKHjKZw== 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=1783351485; 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=t8qHUIVAMHpi9P4/lOSdG7RBn6mOxPlHXe97qtbDd2c=; b=FiwvjA8k8o72Pq2hfqjLlWdbZoMp9DNQ++ohRvHkw/boS2yqiynK0mQgtBQGT4CrD0u6Zm at4Kotn6c5pisuUft2hnDSGkCEZRmkvc8oW9V6o0GvTBXX5ek7b12Lg+YSENIVaaVHryI6 FzsgsyF4Ry/WUpuF4U5hvf0F7+m6ldbzhJJmwvLBt9U4GicoZx/dgU0CStP184BeVyB+1w niOmuImfO3EN+tUT23cTdDoPNxNa2SzO/Vhoko4JdbcCyn9ciwUKQSbHsB9L4FDN3+cgj3 keZGRHVTPynQGrfM4M6KKg7HzsNUJ+1uxCiPgOIGNAmnQNRlZy0IafDzZPTQJw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv7Ss03pTz189c for ; Mon, 06 Jul 2026 15:24:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1d5af by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 15:24:44 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Kajetan Puchalski From: Andrew Turner Subject: git: 35164034e390 - main - arm64/vmm: Make remaining registers use hypctx_*_sys_reg 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 35164034e390f56f83efe5bf073d36812b19df23 Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 15:24:44 +0000 Message-Id: <6a4bc8bc.1d5af.33e40433@gitrepo.freebsd.org> The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=35164034e390f56f83efe5bf073d36812b19df23 commit 35164034e390f56f83efe5bf073d36812b19df23 Author: Kajetan Puchalski AuthorDate: 2026-07-06 14:18:50 +0000 Commit: Andrew Turner CommitDate: 2026-07-06 15:18:30 +0000 arm64/vmm: Make remaining registers use hypctx_*_sys_reg Move vgic, timer and trapframe registers into sys_regs to handle them in the same way as all the other registers. Signed-off-by: Kajetan Puchalski Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D56556 --- sys/arm64/vmm/arm64.h | 46 +++++++++++-- sys/arm64/vmm/hyp_genassym.c | 35 ++++++++++ sys/arm64/vmm/io/vgic_v3.c | 46 +++++++------ sys/arm64/vmm/io/vgic_v3.h | 22 ------ sys/arm64/vmm/io/vtimer.c | 36 +++++----- sys/arm64/vmm/io/vtimer.h | 5 -- sys/arm64/vmm/vmm.c | 6 +- sys/arm64/vmm/vmm_arm64.c | 110 +++++++++++++++++------------- sys/arm64/vmm/vmm_hyp.c | 137 +++++++++++++++++++++----------------- sys/arm64/vmm/vmm_hyp_exception.S | 69 +++++++++---------- sys/arm64/vmm/vmm_reset.c | 6 +- sys/modules/vmm/Makefile | 11 +-- 12 files changed, 304 insertions(+), 225 deletions(-) diff --git a/sys/arm64/vmm/arm64.h b/sys/arm64/vmm/arm64.h index 48ac3fe83ad7..5279ca546984 100644 --- a/sys/arm64/vmm/arm64.h +++ b/sys/arm64/vmm/arm64.h @@ -56,7 +56,14 @@ struct vgic_v3_cpu; #define DBGWCR_EL1(n) (DBGWCR0_EL1 + MIN(n, 15)) #define DBGWVR_EL1(n) (DBGWVR0_EL1 + MIN(n, 15)) +#define HOST_ICH_LR_EL2(n) (HOST_ICH_LR0_EL2 + MIN(n, VGIC_ICH_LR_NUM_MAX-1)) +#define HOST_ICH_AP0R_EL2(n) (HOST_ICH_AP0R0_EL2 + MIN(n, VGIC_ICH_APR_NUM_MAX-1)) +#define HOST_ICH_AP1R_EL2(n) (HOST_ICH_AP1R0_EL2 + MIN(n, VGIC_ICH_APR_NUM_MAX-1)) +#define GPR_X(n) (GPR_X0 + MIN(n, 30)) + enum hypctx_sysreg { + HOST_SPSR_EL2, + HOST_ESR_EL2, CSSELR_EL1, /* Cache Size Selection Register */ MDCCINT_EL1, /* Monitor DCC Interrupt Enable Register */ PAR_EL1, /* Physical Address Register */ @@ -120,6 +127,28 @@ enum hypctx_sysreg { HOST_FAR_EL2, /* Fault Address Register */ HOST_HPFAR_EL2, /* Hypervisor IPA Fault Address Register */ + HOST_ICH_EISR_EL2, /* End of Interrupt Status Register */ + HOST_ICH_ELRSR_EL2, /* Empty List Register Status Register */ + HOST_ICH_HCR_EL2, /* Hyp Control Register */ + HOST_ICH_MISR_EL2, /* Maintenance Interrupt State Register */ + HOST_ICH_VMCR_EL2, /* Virtual Machine Control Register */ + + /* + * The List Registers are part of the VM context and are modified on a + * world switch. They need to be allocated statically so they are + * mapped in the EL2 translation tables when struct hypctx is mapped. + */ + HOST_ICH_LR0_EL2, + HOST_ICH_LR_MAX_EL2 = HOST_ICH_LR0_EL2 + (VGIC_ICH_LR_NUM_MAX - 1), + /* Active Priorities Registers for Group 0 and 1 interrupts */ + HOST_ICH_AP0R0_EL2, + HOST_ICH_AP0R_MAX_EL2 = HOST_ICH_AP0R0_EL2 + (VGIC_ICH_APR_NUM_MAX - 1), + HOST_ICH_AP1R0_EL2, + HOST_ICH_AP1R_MAX_EL2 = HOST_ICH_AP1R0_EL2 + (VGIC_ICH_APR_NUM_MAX - 1), + + HOST_CNTHCTL_EL2, + HOST_CNTVOFF_EL2, + NR_NON_VNCR_REGS, /* VNCR Registers */ @@ -217,10 +246,17 @@ enum hypctx_sysreg { /* Virtual-address-sized registers */ VA_REGS_START, + /* Do not reorder these without matching asm changes */ + GPR_LR, + GPR_X0, + GPR_X30 = GPR_X0 + 30, + /* These can be reordered freely */ SP_EL0, /* Stack pointer */ TPIDR_EL0, /* EL0 Software ID Register */ TPIDRRO_EL0, /* Read-only Thread ID Register */ TPIDR_EL1, /* EL1 Software ID Register */ + HOST_SP_EL1, + HOST_ELR_EL2, VA_REGS_END, }; @@ -229,7 +265,6 @@ enum hypctx_sysreg { * Per-vCPU hypervisor state. */ struct hypctx { - struct trapframe tf; /* Virtual-address-sized registers */ uint64_t va_regs[VA_REGS_END - VA_REGS_START - 1]; /* Non-VNCR register state */ @@ -238,7 +273,6 @@ struct hypctx { struct hyp *hyp; struct vcpu *vcpu; - struct vtimer vtimer; struct vtimer_cpu vtimer_cpu; uint64_t setcaps; /* Currently enabled capabilities. */ @@ -247,7 +281,10 @@ struct hypctx { uint64_t debug_spsr; /* Saved guest SPSR */ uint64_t debug_mdscr; /* Saved guest MDSCR */ - struct vgic_v3_regs vgic_v3_regs; + struct { + uint16_t ich_lr_num; + uint16_t ich_apr_num; + } vgic_v3; struct vgic_v3_cpu *vgic_cpu; bool has_exception; bool dbg_oslock; @@ -277,6 +314,8 @@ struct hypctx { (&hypctx->va_regs[reg - VA_REGS_START - 1]) #endif +/* Calling this with markers like reg=VNCR_START or reg=NR_NON_VNCR_REGS + is a bad idea */ static inline uint64_t * hypctx_sys_reg(struct hypctx *hypctx, int reg /* enum hypctx_sysreg */) { @@ -285,7 +324,6 @@ hypctx_sys_reg(struct hypctx *hypctx, int reg /* enum hypctx_sysreg */) return (__hypctx_va_sysreg(hypctx, reg)); if (reg > VNCR_START) return (__hypctx_vncr_sysreg(hypctx, reg)); - /* Calling this with reg=VNCR_START or reg=NR_NON_VNCR_REGS is a bad idea */ return (&hypctx->sys_regs[reg]); } diff --git a/sys/arm64/vmm/hyp_genassym.c b/sys/arm64/vmm/hyp_genassym.c new file mode 100644 index 000000000000..da3e5f307ab2 --- /dev/null +++ b/sys/arm64/vmm/hyp_genassym.c @@ -0,0 +1,35 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2026 Arm Ltd + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +#include "arm64.h" + +ASSYM(HYPCTX_GPR_LR, offsetof(struct hypctx, va_regs) + (GPR_LR - VA_REGS_START - 1) * sizeof(uint64_t)); +ASSYM(HYPCTX_GPR_X0, offsetof(struct hypctx, va_regs) + (GPR_X0 - VA_REGS_START - 1) * sizeof(uint64_t)); diff --git a/sys/arm64/vmm/io/vgic_v3.c b/sys/arm64/vmm/io/vgic_v3.c index f38fb4b74693..81bb94878368 100644 --- a/sys/arm64/vmm/io/vgic_v3.c +++ b/sys/arm64/vmm/io/vgic_v3.c @@ -503,7 +503,7 @@ vgic_v3_cpuinit(device_t dev, struct hypctx *hypctx) * * Maintenance interrupts are disabled. */ - hypctx->vgic_v3_regs.ich_hcr_el2 = ICH_HCR_EL2_En; + hypctx_write_sys_reg(hypctx, HOST_ICH_HCR_EL2, ICH_HCR_EL2_En); /* * Configure the Interrupt Controller Virtual Machine Control Register. @@ -518,20 +518,21 @@ vgic_v3_cpuinit(device_t dev, struct hypctx *hypctx) * ICH_VMCR_EL2_VENG0: virtual Group 0 interrupts enabled. * ICH_VMCR_EL2_VENG1: virtual Group 1 interrupts enabled. */ - hypctx->vgic_v3_regs.ich_vmcr_el2 = + hypctx_write_sys_reg(hypctx, HOST_ICH_VMCR_EL2, (virt_features.min_prio << ICH_VMCR_EL2_VPMR_SHIFT) | - ICH_VMCR_EL2_VBPR1_NO_PREEMPTION | ICH_VMCR_EL2_VBPR0_NO_PREEMPTION; - hypctx->vgic_v3_regs.ich_vmcr_el2 &= ~ICH_VMCR_EL2_VEOIM; - hypctx->vgic_v3_regs.ich_vmcr_el2 |= ICH_VMCR_EL2_VENG0 | + ICH_VMCR_EL2_VBPR1_NO_PREEMPTION | + ICH_VMCR_EL2_VBPR0_NO_PREEMPTION); + *hypctx_sys_reg(hypctx, HOST_ICH_VMCR_EL2) &= ~ICH_VMCR_EL2_VEOIM; + *hypctx_sys_reg(hypctx, HOST_ICH_VMCR_EL2) |= ICH_VMCR_EL2_VENG0 | ICH_VMCR_EL2_VENG1; - hypctx->vgic_v3_regs.ich_lr_num = virt_features.ich_lr_num; - for (i = 0; i < hypctx->vgic_v3_regs.ich_lr_num; i++) - hypctx->vgic_v3_regs.ich_lr_el2[i] = 0UL; + hypctx->vgic_v3.ich_lr_num = virt_features.ich_lr_num; + for (i = 0; i < hypctx->vgic_v3.ich_lr_num; i++) + hypctx_write_sys_reg(hypctx, HOST_ICH_LR_EL2(i), 0UL); vgic_cpu->ich_lr_used = 0; TAILQ_INIT(&vgic_cpu->irq_act_pend); - hypctx->vgic_v3_regs.ich_apr_num = virt_features.ich_apr_num; + hypctx->vgic_v3.ich_apr_num = virt_features.ich_apr_num; } static void @@ -2118,7 +2119,7 @@ vgic_v3_flush_hwstate(device_t dev, struct hypctx *hypctx) */ mtx_lock_spin(&vgic_cpu->lr_mtx); - hypctx->vgic_v3_regs.ich_hcr_el2 &= ~ICH_HCR_EL2_UIE; + *hypctx_sys_reg(hypctx, HOST_ICH_HCR_EL2) &= ~ICH_HCR_EL2_UIE; /* Exit early if there are no buffered interrupts */ if (TAILQ_EMPTY(&vgic_cpu->irq_act_pend)) @@ -2128,33 +2129,34 @@ vgic_v3_flush_hwstate(device_t dev, struct hypctx *hypctx) __func__, vgic_cpu->ich_lr_used)); i = 0; - hypctx->vgic_v3_regs.ich_elrsr_el2 = - (1u << hypctx->vgic_v3_regs.ich_lr_num) - 1; + hypctx_write_sys_reg(hypctx, HOST_ICH_ELRSR_EL2, + (1u << hypctx->vgic_v3.ich_lr_num) - 1); TAILQ_FOREACH(irq, &vgic_cpu->irq_act_pend, act_pend_list) { /* No free list register, stop searching for IRQs */ - if (i == hypctx->vgic_v3_regs.ich_lr_num) + if (i == hypctx->vgic_v3.ich_lr_num) break; if (!irq->enabled) continue; - hypctx->vgic_v3_regs.ich_lr_el2[i] = ICH_LR_EL2_GROUP1 | - ((uint64_t)irq->priority << ICH_LR_EL2_PRIO_SHIFT) | - irq->irq; + hypctx_write_sys_reg(hypctx, HOST_ICH_LR_EL2(i), + ICH_LR_EL2_GROUP1 | + ((uint64_t)irq->priority << ICH_LR_EL2_PRIO_SHIFT) | + irq->irq); if (irq->active) { - hypctx->vgic_v3_regs.ich_lr_el2[i] |= + *hypctx_sys_reg(hypctx, HOST_ICH_LR_EL2(i)) |= ICH_LR_EL2_STATE_ACTIVE; } #ifdef notyet /* TODO: Check why this is needed */ if ((irq->config & _MASK) == LEVEL) - hypctx->vgic_v3_regs.ich_lr_el2[i] |= ICH_LR_EL2_EOI; + *hypctx_sys_reg(hypctx, HOST_ICH_LR_EL2(i)) |= ICH_LR_EL2_EOI; #endif if (!irq->active && vgic_v3_irq_pending(irq)) { - hypctx->vgic_v3_regs.ich_lr_el2[i] |= + *hypctx_sys_reg(hypctx, HOST_ICH_LR_EL2(i)) |= ICH_LR_EL2_STATE_PENDING; /* @@ -2196,8 +2198,8 @@ vgic_v3_sync_hwstate(device_t dev, struct hypctx *hypctx) * access unlocked. */ for (i = 0; i < vgic_cpu->ich_lr_used; i++) { - lr = hypctx->vgic_v3_regs.ich_lr_el2[i]; - hypctx->vgic_v3_regs.ich_lr_el2[i] = 0; + lr = hypctx_read_sys_reg(hypctx, HOST_ICH_LR_EL2(i)); + hypctx_write_sys_reg(hypctx, HOST_ICH_LR_EL2(i), 0); irq = vgic_v3_get_irq(hypctx->hyp, vcpu_vcpuid(hypctx->vcpu), ICH_LR_EL2_VINTID(lr)); @@ -2244,7 +2246,7 @@ vgic_v3_sync_hwstate(device_t dev, struct hypctx *hypctx) vgic_v3_release_irq(irq); } - hypctx->vgic_v3_regs.ich_hcr_el2 &= ~ICH_HCR_EL2_EOICOUNT_MASK; + *hypctx_sys_reg(hypctx, HOST_ICH_HCR_EL2) &= ~ICH_HCR_EL2_EOICOUNT_MASK; vgic_cpu->ich_lr_used = 0; } diff --git a/sys/arm64/vmm/io/vgic_v3.h b/sys/arm64/vmm/io/vgic_v3.h index 8804cc7a0211..427a5ec5bb69 100644 --- a/sys/arm64/vmm/io/vgic_v3.h +++ b/sys/arm64/vmm/io/vgic_v3.h @@ -32,26 +32,4 @@ #define VGIC_ICH_LR_NUM_MAX 16 #define VGIC_ICH_APR_NUM_MAX 4 -/* Registers accessed by EL2 */ -struct vgic_v3_regs { - uint32_t ich_eisr_el2; /* End of Interrupt Status Register */ - uint32_t ich_elrsr_el2; /* Empty List register Status Register (ICH_ELRSR_EL2) */ - uint32_t ich_hcr_el2; /* Hyp Control Register */ - uint32_t ich_misr_el2; /* Maintenance Interrupt State Register */ - uint32_t ich_vmcr_el2; /* Virtual Machine Control Register */ - - /* - * The List Registers are part of the VM context and are modified on a - * world switch. They need to be allocated statically so they are - * mapped in the EL2 translation tables when struct hypctx is mapped. - */ - uint64_t ich_lr_el2[VGIC_ICH_LR_NUM_MAX]; - uint16_t ich_lr_num; - - /* Active Priorities Registers for Group 0 and 1 interrupts */ - uint16_t ich_apr_num; - uint32_t ich_ap0r_el2[VGIC_ICH_APR_NUM_MAX]; - uint32_t ich_ap1r_el2[VGIC_ICH_APR_NUM_MAX]; -}; - #endif /* !_VMM_VGIC_V3_H_ */ diff --git a/sys/arm64/vmm/io/vtimer.c b/sys/arm64/vmm/io/vtimer.c index ff29a06751e0..509e52947524 100644 --- a/sys/arm64/vmm/io/vtimer.c +++ b/sys/arm64/vmm/io/vtimer.c @@ -97,7 +97,7 @@ vtimer_virtual_timer_intr(void *arg) } cntpct_el0 = READ_SPECIALREG(cntpct_el0) - - hypctx->vtimer.cntvoff_el2; + hypctx_read_sys_reg(hypctx, HOST_CNTVOFF_EL2); if (hypctx->vtimer_cpu.virt_timer.cntx_cval_el0 < cntpct_el0) vgic_inject_irq(hypctx->hyp, vcpu_vcpuid(hypctx->vcpu), GT_VIRT_IRQ, true); @@ -186,17 +186,17 @@ vtimer_cpuinit(struct hypctx *hypctx) * * TODO: Don't trap when FEAT_ECV is present */ - hypctx->vtimer.cnthctl_el2 = + hypctx_write_sys_reg(hypctx, HOST_CNTHCTL_EL2, CNTHCTL_E2H_EL0VCTEN_NOTRAP | - CNTHCTL_E2H_EL0VTEN_NOTRAP; + CNTHCTL_E2H_EL0VTEN_NOTRAP); if (ecv_poff) { - hypctx->vtimer.cnthctl_el2 |= + *hypctx_sys_reg(hypctx, HOST_CNTHCTL_EL2) |= CNTHCTL_E2H_EL0PCTEN_NOTRAP | CNTHCTL_E2H_EL0PTEN_NOTRAP | CNTHCTL_E2H_EL1PCTEN_NOTRAP | CNTHCTL_E2H_EL1PTEN_NOTRAP; } else { - hypctx->vtimer.cnthctl_el2 |= + *hypctx_sys_reg(hypctx, HOST_CNTHCTL_EL2) |= CNTHCTL_E2H_EL0PCTEN_TRAP | CNTHCTL_E2H_EL0PTEN_TRAP | CNTHCTL_E2H_EL1PCTEN_TRAP | @@ -209,20 +209,20 @@ vtimer_cpuinit(struct hypctx *hypctx) * CNTHCTL_EL1PCTEN: trap access to CNTPCT_EL0 */ if (ecv_poff) { - hypctx->vtimer.cnthctl_el2 = + hypctx_write_sys_reg(hypctx, HOST_CNTHCTL_EL2, CNTHCTL_EL1PCTEN_NOTRAP | - CNTHCTL_EL1PCEN_NOTRAP; + CNTHCTL_EL1PCEN_NOTRAP); } else { - hypctx->vtimer.cnthctl_el2 = + hypctx_write_sys_reg(hypctx, HOST_CNTHCTL_EL2, CNTHCTL_EL1PCTEN_TRAP | - CNTHCTL_EL1PCEN_TRAP; + CNTHCTL_EL1PCEN_TRAP); } } if (ecv_poff) - hypctx->vtimer.cnthctl_el2 |= CNTHCTL_ECV_EN; + *hypctx_sys_reg(hypctx, HOST_CNTHCTL_EL2) |= CNTHCTL_ECV_EN; - hypctx->vtimer.cntvoff_el2 = hypctx->hyp->cntvoff_el2; + hypctx_write_sys_reg(hypctx, HOST_CNTVOFF_EL2, hypctx->hyp->cntvoff_el2); } void @@ -280,10 +280,10 @@ vtimer_sync_hwstate(struct hypctx *hypctx) uint64_t cntpct_el0; cntpct_el0 = READ_SPECIALREG(cntpct_el0) - - hypctx->vtimer.cntvoff_el2; + hypctx_read_sys_reg(hypctx, HOST_CNTVOFF_EL2); vtime_sync_timer(hypctx, &hypctx->vtimer_cpu.virt_timer, cntpct_el0); /* If FEAT_ECV_POFF is in use then we need to sync the physical timer */ - if ((hypctx->vtimer.cnthctl_el2 & CNTHCTL_ECV_EN) != 0) { + if ((hypctx_read_sys_reg(hypctx, HOST_CNTHCTL_EL2) & CNTHCTL_ECV_EN) != 0) { vtime_sync_timer(hypctx, &hypctx->vtimer_cpu.phys_timer, cntpct_el0); } @@ -322,7 +322,7 @@ vtimer_schedule_irq(struct hypctx *hypctx, bool phys) else timer = &hypctx->vtimer_cpu.virt_timer; cntpct_el0 = READ_SPECIALREG(cntpct_el0) - - hypctx->vtimer.cntvoff_el2; + hypctx_read_sys_reg(hypctx, HOST_CNTVOFF_EL2); if (timer->cntx_cval_el0 < cntpct_el0) { /* Timer set in the past, trigger interrupt */ vgic_inject_irq(hypctx->hyp, vcpu_vcpuid(hypctx->vcpu), @@ -379,7 +379,7 @@ vtimer_phys_ctl_read(struct vcpu *vcpu, uint64_t *rval, void *arg) hypctx = vcpu_get_cookie(vcpu); vtimer_cpu = &hypctx->vtimer_cpu; - cntpct_el0 = READ_SPECIALREG(cntpct_el0) - hypctx->vtimer.cntvoff_el2; + cntpct_el0 = READ_SPECIALREG(cntpct_el0) - hypctx_read_sys_reg(hypctx, HOST_CNTVOFF_EL2); if (vtimer_cpu->phys_timer.cntx_cval_el0 < cntpct_el0) /* Timer condition met */ *rval = vtimer_cpu->phys_timer.cntx_ctl_el0 | CNTP_CTL_ISTATUS; @@ -422,7 +422,7 @@ vtimer_phys_cnt_read(struct vcpu *vcpu, uint64_t *rval, void *arg) struct hypctx *hypctx; hypctx = vcpu_get_cookie(vcpu); - *rval = READ_SPECIALREG(cntpct_el0) - hypctx->vtimer.cntvoff_el2; + *rval = READ_SPECIALREG(cntpct_el0) - hypctx_read_sys_reg(hypctx, HOST_CNTVOFF_EL2); return (0); } @@ -485,7 +485,7 @@ vtimer_phys_tval_read(struct vcpu *vcpu, uint64_t *rval, void *arg) *rval = (uint32_t)RES1; } else { cntpct_el0 = READ_SPECIALREG(cntpct_el0) - - hypctx->vtimer.cntvoff_el2; + hypctx_read_sys_reg(hypctx, HOST_CNTVOFF_EL2); *rval = vtimer_cpu->phys_timer.cntx_cval_el0 - cntpct_el0; } @@ -502,7 +502,7 @@ vtimer_phys_tval_write(struct vcpu *vcpu, uint64_t wval, void *arg) hypctx = vcpu_get_cookie(vcpu); vtimer_cpu = &hypctx->vtimer_cpu; - cntpct_el0 = READ_SPECIALREG(cntpct_el0) - hypctx->vtimer.cntvoff_el2; + cntpct_el0 = READ_SPECIALREG(cntpct_el0) - hypctx_read_sys_reg(hypctx, HOST_CNTVOFF_EL2); vtimer_cpu->phys_timer.cntx_cval_el0 = (int32_t)wval + cntpct_el0; vtimer_remove_irq(hypctx, vcpu); diff --git a/sys/arm64/vmm/io/vtimer.h b/sys/arm64/vmm/io/vtimer.h index d415afa47acc..0fa772b8fcbf 100644 --- a/sys/arm64/vmm/io/vtimer.h +++ b/sys/arm64/vmm/io/vtimer.h @@ -37,11 +37,6 @@ struct hyp; struct hypctx; -struct vtimer { - uint64_t cnthctl_el2; - uint64_t cntvoff_el2; -}; - struct vtimer_timer { struct callout callout; struct mtx mtx; diff --git a/sys/arm64/vmm/vmm.c b/sys/arm64/vmm/vmm.c index 07be8b1707a0..ad53dc16e91a 100644 --- a/sys/arm64/vmm/vmm.c +++ b/sys/arm64/vmm/vmm.c @@ -862,13 +862,13 @@ vm_handle_smccc_call(struct vcpu *vcpu, struct vm_exit *vme, bool *retu) hypctx = vcpu_get_cookie(vcpu); - if ((hypctx->tf.tf_esr & ESR_ELx_ISS_MASK) != 0) + if ((hypctx_read_sys_reg(hypctx, HOST_ESR_EL2) & ESR_ELx_ISS_MASK) != 0) return (1); vme->exitcode = VM_EXITCODE_SMCCC; - vme->u.smccc_call.func_id = hypctx->tf.tf_x[0]; + vme->u.smccc_call.func_id = hypctx_read_sys_reg(hypctx, GPR_X(0)); for (i = 0; i < nitems(vme->u.smccc_call.args); i++) - vme->u.smccc_call.args[i] = hypctx->tf.tf_x[i + 1]; + vme->u.smccc_call.args[i] = hypctx_read_sys_reg(hypctx, GPR_X(i + 1)); *retu = true; return (0); diff --git a/sys/arm64/vmm/vmm_arm64.c b/sys/arm64/vmm/vmm_arm64.c index ba826649092c..e2d667575706 100644 --- a/sys/arm64/vmm/vmm_arm64.c +++ b/sys/arm64/vmm/vmm_arm64.c @@ -659,7 +659,7 @@ arm64_gen_inst_emul_data(struct hypctx *hypctx, uint32_t esr_iss, ~(TTBR_ASID_MASK | TTBR_CnP); paging->tcr_el1 = hypctx_read_sys_reg(hypctx, TCR_EL1); paging->tcr2_el1 = hypctx_read_sys_reg(hypctx, TCR2_EL1); - paging->flags = hypctx->tf.tf_spsr & (PSR_M_MASK | PSR_M_32); + paging->flags = hypctx_read_sys_reg(hypctx, HOST_SPSR_EL2) & (PSR_M_MASK | PSR_M_32); if ((hypctx_read_sys_reg(hypctx, SCTLR_EL1) & SCTLR_M) != 0) paging->flags |= VM_GP_MMU_ENABLED; } @@ -685,7 +685,7 @@ raise_data_insn_abort(struct hypctx *hypctx, uint64_t far, bool dabort, int fsc) { uint64_t esr; - if ((hypctx->tf.tf_spsr & PSR_M_MASK) == PSR_M_EL0t) + if ((hypctx_read_sys_reg(hypctx, HOST_SPSR_EL2) & PSR_M_MASK) == PSR_M_EL0t) esr = EXCP_INSN_ABORT_L << ESR_ELx_EC_SHIFT; else esr = EXCP_INSN_ABORT << ESR_ELx_EC_SHIFT; @@ -693,7 +693,7 @@ raise_data_insn_abort(struct hypctx *hypctx, uint64_t far, bool dabort, int fsc) if (dabort) esr |= EXCP_DATA_ABORT_L << ESR_ELx_EC_SHIFT; /* Set the IL bit if set by hardware */ - esr |= hypctx->tf.tf_esr & ESR_ELx_IL; + esr |= hypctx_read_sys_reg(hypctx, HOST_ESR_EL2) & ESR_ELx_IL; vmmops_exception(hypctx, esr | fsc, far); } @@ -705,8 +705,8 @@ handle_el1_sync_excp(struct hypctx *hypctx, struct vm_exit *vme_ret, uint64_t gpa; uint32_t esr_ec, esr_iss; - esr_ec = ESR_ELx_EXCEPTION(hypctx->tf.tf_esr); - esr_iss = hypctx->tf.tf_esr & ESR_ELx_ISS_MASK; + esr_ec = ESR_ELx_EXCEPTION(hypctx_read_sys_reg(hypctx, HOST_ESR_EL2)); + esr_iss = hypctx_read_sys_reg(hypctx, HOST_ESR_EL2) & ESR_ELx_ISS_MASK; switch (esr_ec) { case EXCP_UNKNOWN: @@ -715,7 +715,7 @@ handle_el1_sync_excp(struct hypctx *hypctx, struct vm_exit *vme_ret, vme_ret->exitcode = VM_EXITCODE_HYP; break; case EXCP_TRAP_WFI_WFE: - if ((hypctx->tf.tf_esr & 0x3) == 0) { /* WFI */ + if ((hypctx_read_sys_reg(hypctx, HOST_ESR_EL2) & 0x3) == 0) { /* WFI */ vmm_stat_incr(hypctx->vcpu, VMEXIT_WFI, 1); vme_ret->exitcode = VM_EXITCODE_WFI; } else { @@ -744,7 +744,7 @@ handle_el1_sync_excp(struct hypctx *hypctx, struct vm_exit *vme_ret, case EXCP_DATA_ABORT_L: vmm_stat_incr(hypctx->vcpu, esr_ec == EXCP_DATA_ABORT_L ? VMEXIT_DATA_ABORT : VMEXIT_INSN_ABORT, 1); - switch (hypctx->tf.tf_esr & ISS_DATA_DFSC_MASK) { + switch (hypctx_read_sys_reg(hypctx, HOST_ESR_EL2) & ISS_DATA_DFSC_MASK) { case ISS_DATA_DFSC_TF_L0: case ISS_DATA_DFSC_TF_L1: case ISS_DATA_DFSC_TF_L2: @@ -769,7 +769,7 @@ handle_el1_sync_excp(struct hypctx *hypctx, struct vm_exit *vme_ret, if (vm_mem_allocated(hypctx->vcpu, gpa)) { vme_ret->exitcode = VM_EXITCODE_PAGING; vme_ret->inst_length = 0; - vme_ret->u.paging.esr = hypctx->tf.tf_esr; + vme_ret->u.paging.esr = hypctx_read_sys_reg(hypctx, HOST_ESR_EL2); vme_ret->u.paging.gpa = gpa; } else if (esr_ec == EXCP_INSN_ABORT_L) { /* @@ -1094,7 +1094,7 @@ fault: int vmmops_run(void *vcpui, register_t pc, pmap_t pmap, struct vm_eventinfo *evinfo) { - uint64_t excp_type, vbar_el1; + uint64_t excp_type, vbar_el1, new_spsr; int handled; register_t daif; struct hyp *hyp; @@ -1108,36 +1108,43 @@ vmmops_run(void *vcpui, register_t pc, pmap_t pmap, struct vm_eventinfo *evinfo) vcpu = hypctx->vcpu; vme = vm_exitinfo(vcpu); - hypctx->tf.tf_elr = (uint64_t)pc; + hypctx_write_sys_reg(hypctx, HOST_ELR_EL2, (uint64_t)pc); for (;;) { if (hypctx->has_exception) { hypctx->has_exception = false; - hypctx_write_sys_reg(hypctx, ELR_EL1, hypctx->tf.tf_elr); + hypctx_write_sys_reg(hypctx, ELR_EL1, + hypctx_read_sys_reg(hypctx, HOST_ELR_EL2)); - mode = hypctx->tf.tf_spsr & (PSR_M_MASK | PSR_M_32); + mode = hypctx_read_sys_reg(hypctx, HOST_SPSR_EL2) & + (PSR_M_MASK | PSR_M_32); vbar_el1 = hypctx_read_sys_reg(hypctx, VBAR_EL1); if (mode == PSR_M_EL1t) { - hypctx->tf.tf_elr = vbar_el1 + 0x0; + hypctx_write_sys_reg(hypctx, HOST_ELR_EL2, + vbar_el1 + 0x0); } else if (mode == PSR_M_EL1h) { - hypctx->tf.tf_elr = vbar_el1 + 0x200; + hypctx_write_sys_reg(hypctx, HOST_ELR_EL2, + vbar_el1 + 0x200); } else if ((mode & PSR_M_32) == PSR_M_64) { /* 64-bit EL0 */ - hypctx->tf.tf_elr = vbar_el1 + 0x400; + hypctx_write_sys_reg(hypctx, HOST_ELR_EL2, + vbar_el1 + 0x400); } else { /* 32-bit EL0 */ - hypctx->tf.tf_elr = vbar_el1 + 0x600; + hypctx_write_sys_reg(hypctx, HOST_ELR_EL2, + vbar_el1 + 0x600); } /* Set the new spsr */ - hypctx_write_sys_reg(hypctx, SPSR_EL1, hypctx->tf.tf_spsr); + new_spsr = hypctx_read_sys_reg(hypctx, HOST_SPSR_EL2); + hypctx_write_sys_reg(hypctx, SPSR_EL1, new_spsr); /* Set the new cpsr */ - hypctx->tf.tf_spsr = hypctx_read_sys_reg(hypctx, - SPSR_EL1) & PSR_FLAGS; - - hypctx->tf.tf_spsr |= PSR_DAIF | PSR_M_EL1h; + hypctx_write_sys_reg(hypctx, HOST_SPSR_EL2, + new_spsr & PSR_FLAGS); + *hypctx_sys_reg(hypctx, HOST_SPSR_EL2) |= PSR_DAIF | + PSR_M_EL1h; /* * Update fields that may change on exeption entry @@ -1145,12 +1152,15 @@ vmmops_run(void *vcpui, register_t pc, pmap_t pmap, struct vm_eventinfo *evinfo) */ if ((hypctx_read_sys_reg(hypctx, SCTLR_EL1) & SCTLR_SPAN) == 0) - hypctx->tf.tf_spsr |= PSR_PAN; + *hypctx_sys_reg(hypctx, + HOST_SPSR_EL2) |= PSR_PAN; if ((hypctx_read_sys_reg(hypctx, SCTLR_EL1) & SCTLR_DSSBS) == 0) - hypctx->tf.tf_spsr &= ~PSR_SSBS; + *hypctx_sys_reg(hypctx, + HOST_SPSR_EL2) &= ~PSR_SSBS; else - hypctx->tf.tf_spsr |= PSR_SSBS; + *hypctx_sys_reg(hypctx, + HOST_SPSR_EL2) |= PSR_SSBS; } daif = intr_disable(); @@ -1170,7 +1180,8 @@ vmmops_run(void *vcpui, register_t pc, pmap_t pmap, struct vm_eventinfo *evinfo) /* Activate the stage2 pmap so the vmid is valid */ pmap_activate_vm(pmap); - hypctx_write_sys_reg(hypctx, HOST_VTTBR_EL2, pmap_to_ttbr0(pmap)); + hypctx_write_sys_reg(hypctx, HOST_VTTBR_EL2, + pmap_to_ttbr0(pmap)); /* * TODO: What happens if a timer interrupt is asserted exactly @@ -1195,10 +1206,10 @@ vmmops_run(void *vcpui, register_t pc, pmap_t pmap, struct vm_eventinfo *evinfo) if (excp_type == EXCP_TYPE_MAINT_IRQ) continue; - vme->pc = hypctx->tf.tf_elr; + vme->pc = hypctx_read_sys_reg(hypctx, HOST_ELR_EL2); vme->inst_length = INSN_SIZE; vme->u.hyp.exception_nr = excp_type; - vme->u.hyp.esr_el2 = hypctx->tf.tf_esr; + vme->u.hyp.esr_el2 = hypctx_read_sys_reg(hypctx, HOST_ESR_EL2); vme->u.hyp.far_el2 = hypctx_read_sys_reg(hypctx, HOST_FAR_EL2); vme->u.hyp.hpfar_el2 = hypctx_read_sys_reg(hypctx, HOST_HPFAR_EL2); @@ -1209,7 +1220,7 @@ vmmops_run(void *vcpui, register_t pc, pmap_t pmap, struct vm_eventinfo *evinfo) break; else /* Resume guest execution from the next instruction. */ - hypctx->tf.tf_elr += vme->inst_length; + *hypctx_sys_reg(hypctx, HOST_ELR_EL2) += vme->inst_length; } return (0); @@ -1270,15 +1281,15 @@ hypctx_regptr(struct hypctx *hypctx, int reg) { switch (reg) { case VM_REG_GUEST_X0 ... VM_REG_GUEST_X29: - return (&hypctx->tf.tf_x[reg]); + return hypctx_sys_reg(hypctx, GPR_X(reg)); case VM_REG_GUEST_LR: - return (&hypctx->tf.tf_lr); + return hypctx_sys_reg(hypctx, GPR_LR); case VM_REG_GUEST_SP: - return (&hypctx->tf.tf_sp); + return hypctx_sys_reg(hypctx, HOST_SP_EL1); case VM_REG_GUEST_CPSR: - return (&hypctx->tf.tf_spsr); + return hypctx_sys_reg(hypctx, HOST_SPSR_EL2); case VM_REG_GUEST_PC: - return (&hypctx->tf.tf_elr); + return hypctx_sys_reg(hypctx, HOST_ELR_EL2); case VM_REG_GUEST_SCTLR_EL1: return hypctx_sys_reg(hypctx, SCTLR_EL1); case VM_REG_GUEST_TTBR0_EL1: @@ -1385,6 +1396,7 @@ vmmops_setcap(void *vcpui, int num, int val) { struct hypctx *hypctx = vcpui; int ret; + uint64_t host_spsr_el2; ret = 0; @@ -1402,38 +1414,42 @@ vmmops_setcap(void *vcpui, int num, int val) break; if (val != 0) { - hypctx->debug_spsr |= (hypctx->tf.tf_spsr & PSR_SS); - hypctx->debug_mdscr |= - (hypctx_read_sys_reg(hypctx, MDSCR_EL1) & MDSCR_SS); + hypctx->debug_spsr |= (hypctx_read_sys_reg(hypctx, + HOST_SPSR_EL2) & PSR_SS); + hypctx->debug_mdscr |= (hypctx_read_sys_reg(hypctx, + MDSCR_EL1) & MDSCR_SS); - hypctx->tf.tf_spsr |= PSR_SS; + *hypctx_sys_reg(hypctx, HOST_SPSR_EL2) |= PSR_SS; *hypctx_sys_reg(hypctx, MDSCR_EL1) |= MDSCR_SS; *hypctx_sys_reg(hypctx, HOST_MDCR_EL2) |= MDCR_EL2_TDE; } else { - hypctx->tf.tf_spsr &= ~PSR_SS; - hypctx->tf.tf_spsr |= hypctx->debug_spsr; + *hypctx_sys_reg(hypctx, HOST_SPSR_EL2) &= ~PSR_SS; + *hypctx_sys_reg(hypctx, + HOST_SPSR_EL2) |= hypctx->debug_spsr; hypctx->debug_spsr &= ~PSR_SS; *hypctx_sys_reg(hypctx, MDSCR_EL1) &= ~MDSCR_SS; - *hypctx_sys_reg(hypctx, MDSCR_EL1) |= hypctx->debug_mdscr; + *hypctx_sys_reg(hypctx, + MDSCR_EL1) |= hypctx->debug_mdscr; hypctx->debug_mdscr &= ~MDSCR_SS; if ((hypctx->setcaps & (1ul << VM_CAP_BRK_EXIT)) == 0) - *hypctx_sys_reg(hypctx, HOST_MDCR_EL2) &= ~MDCR_EL2_TDE; + *hypctx_sys_reg(hypctx, + HOST_MDCR_EL2) &= ~MDCR_EL2_TDE; } break; case VM_CAP_MASK_HWINTR: if ((val != 0) == ((hypctx->setcaps & (1ul << num)) != 0)) break; + host_spsr_el2 = hypctx_read_sys_reg(hypctx, HOST_SPSR_EL2); if (val != 0) { - hypctx->debug_spsr |= (hypctx->tf.tf_spsr & - (PSR_I | PSR_F)); - hypctx->tf.tf_spsr |= PSR_I | PSR_F; + hypctx->debug_spsr |= (host_spsr_el2 & (PSR_I | PSR_F)); + host_spsr_el2 |= PSR_I | PSR_F; } else { - hypctx->tf.tf_spsr &= ~(PSR_I | PSR_F); - hypctx->tf.tf_spsr |= (hypctx->debug_spsr & - (PSR_I | PSR_F)); + host_spsr_el2 &= ~(PSR_I | PSR_F); + host_spsr_el2 |= (hypctx->debug_spsr & (PSR_I | PSR_F)); hypctx->debug_spsr &= ~(PSR_I | PSR_F); } + hypctx_write_sys_reg(hypctx, HOST_SPSR_EL2, host_spsr_el2); break; default: ret = ENOENT; diff --git a/sys/arm64/vmm/vmm_hyp.c b/sys/arm64/vmm/vmm_hyp.c index ffc51f243dcd..7a86086be56e 100644 --- a/sys/arm64/vmm/vmm_hyp.c +++ b/sys/arm64/vmm/vmm_hyp.c @@ -174,22 +174,27 @@ vmm_hyp_reg_store_pmu_debug(struct hypctx *hypctx, bool guest) static void vmm_hyp_reg_store_vgic(struct hypctx *hypctx, bool guest) { - hypctx->vgic_v3_regs.ich_hcr_el2 = READ_SPECIALREG(ich_hcr_el2); - hypctx->vgic_v3_regs.ich_vmcr_el2 = READ_SPECIALREG(ich_vmcr_el2); + hypctx_write_sys_reg(hypctx, HOST_ICH_HCR_EL2, + READ_SPECIALREG(ich_hcr_el2)); + hypctx_write_sys_reg(hypctx, HOST_ICH_VMCR_EL2, + READ_SPECIALREG(ich_vmcr_el2)); if (!guest) return; /* Store the GICv3 registers */ - hypctx->vgic_v3_regs.ich_eisr_el2 = READ_SPECIALREG(ich_eisr_el2); - hypctx->vgic_v3_regs.ich_elrsr_el2 = READ_SPECIALREG(ich_elrsr_el2); - hypctx->vgic_v3_regs.ich_misr_el2 = READ_SPECIALREG(ich_misr_el2); - - switch (hypctx->vgic_v3_regs.ich_lr_num - 1) { -#define STORE_LR(x) \ -case x: \ - hypctx->vgic_v3_regs.ich_lr_el2[x] = \ - READ_SPECIALREG(ich_lr ## x ##_el2) + hypctx_write_sys_reg(hypctx, HOST_ICH_EISR_EL2, + READ_SPECIALREG(ich_eisr_el2)); + hypctx_write_sys_reg(hypctx, HOST_ICH_ELRSR_EL2, + READ_SPECIALREG(ich_elrsr_el2)); + hypctx_write_sys_reg(hypctx, HOST_ICH_MISR_EL2, + READ_SPECIALREG(ich_misr_el2)); + + switch (hypctx->vgic_v3.ich_lr_num - 1) { +#define STORE_LR(x) \ +case x: \ + hypctx_write_sys_reg(hypctx, HOST_ICH_LR_EL2(x), \ + READ_SPECIALREG(ich_lr ## x ##_el2)) STORE_LR(15); STORE_LR(14); STORE_LR(13); @@ -210,13 +215,13 @@ case x: \ #undef STORE_LR } - switch (hypctx->vgic_v3_regs.ich_apr_num - 1) { -#define STORE_APR(x) \ -case x: \ - hypctx->vgic_v3_regs.ich_ap0r_el2[x] = \ - READ_SPECIALREG(ich_ap0r ## x ##_el2); \ - hypctx->vgic_v3_regs.ich_ap1r_el2[x] = \ - READ_SPECIALREG(ich_ap1r ## x ##_el2) + switch (hypctx->vgic_v3.ich_apr_num - 1) { +#define STORE_APR(x) \ +case x: \ + hypctx_write_sys_reg(hypctx, HOST_ICH_AP0R_EL2(x), \ + READ_SPECIALREG(ich_ap0r ## x ##_el2)); \ + hypctx_write_sys_reg(hypctx, HOST_ICH_AP1R_EL2(x), \ + READ_SPECIALREG(ich_ap1r ## x ##_el2)) STORE_APR(3); STORE_APR(2); STORE_APR(1); @@ -242,13 +247,14 @@ vmm_hyp_reg_store_timer(struct hypctx *hypctx, struct hyp *hyp, bool guest) } else { hypctx->vtimer_cpu.cntkctl_el1 = READ_SPECIALREG(cntkctl_el1); - hypctx->vtimer.cnthctl_el2 = - READ_SPECIALREG(cnthctl_el2); - hypctx->vtimer.cntvoff_el2 = - READ_SPECIALREG(cntvoff_el2); + hypctx_write_sys_reg(hypctx, HOST_CNTHCTL_EL2, + READ_SPECIALREG(cnthctl_el2)); + hypctx_write_sys_reg(hypctx, HOST_CNTVOFF_EL2, + READ_SPECIALREG(cntvoff_el2)); } - ecv_poff = (hypctx->vtimer.cnthctl_el2 & CNTHCTL_ECV_EN) != 0; + ecv_poff = (hypctx_read_sys_reg(hypctx, HOST_CNTHCTL_EL2) & + CNTHCTL_ECV_EN) != 0; if (guest_or_nonvhe(guest) && ecv_poff) { /* @@ -267,16 +273,17 @@ static void vmm_hyp_reg_store_special(struct hypctx *hypctx, struct hyp *hyp, bool guest) { /* Store the special to from the trapframe */ - hypctx->tf.tf_sp = READ_SPECIALREG(sp_el1); - hypctx->tf.tf_elr = READ_SPECIALREG(elr_el2); - hypctx->tf.tf_spsr = READ_SPECIALREG(spsr_el2); + hypctx_write_sys_reg(hypctx, HOST_SP_EL1, READ_SPECIALREG(sp_el1)); + hypctx_write_sys_reg(hypctx, HOST_ELR_EL2, READ_SPECIALREG(elr_el2)); + hypctx_write_sys_reg(hypctx, HOST_SPSR_EL2, READ_SPECIALREG(spsr_el2)); if (guest) { - hypctx->tf.tf_esr = READ_SPECIALREG(esr_el2); + hypctx_write_sys_reg(hypctx, HOST_ESR_EL2, + READ_SPECIALREG(esr_el2)); hypctx_write_sys_reg(hypctx, HOST_FAR_EL2, READ_SPECIALREG(far_el2)); - hypctx_write_sys_reg(hypctx, - PAR_EL1, READ_SPECIALREG(par_el1)); + hypctx_write_sys_reg(hypctx, PAR_EL1, + READ_SPECIALREG(par_el1)); } /* Store the guest special registers */ @@ -439,9 +446,9 @@ vmm_hyp_reg_restore_special(struct hypctx *hypctx, struct hyp *hyp, bool guest) hypctx_read_sys_reg(hypctx, HOST_VMPIDR_EL2)); /* Load the special regs from the trapframe */ - WRITE_SPECIALREG(sp_el1, hypctx->tf.tf_sp); - WRITE_SPECIALREG(elr_el2, hypctx->tf.tf_elr); - WRITE_SPECIALREG(spsr_el2, hypctx->tf.tf_spsr); + WRITE_SPECIALREG(sp_el1, hypctx_read_sys_reg(hypctx, HOST_SP_EL1)); + WRITE_SPECIALREG(elr_el2, hypctx_read_sys_reg(hypctx, HOST_ELR_EL2)); + WRITE_SPECIALREG(spsr_el2, hypctx_read_sys_reg(hypctx, HOST_SPSR_EL2)); } static void @@ -581,10 +588,13 @@ static void vmm_hyp_reg_restore_timer(struct hypctx *hypctx, struct hyp *hyp, bool guest) { bool ecv_poff; - ecv_poff = (hypctx->vtimer.cnthctl_el2 & CNTHCTL_ECV_EN) != 0; + ecv_poff = (hypctx_read_sys_reg(hypctx, HOST_CNTHCTL_EL2) & + CNTHCTL_ECV_EN) != 0; - WRITE_SPECIALREG(cnthctl_el2, hypctx->vtimer.cnthctl_el2); - WRITE_SPECIALREG(cntvoff_el2, hypctx->vtimer.cntvoff_el2); + WRITE_SPECIALREG(cnthctl_el2, + hypctx_read_sys_reg(hypctx, HOST_CNTHCTL_EL2)); + WRITE_SPECIALREG(cntvoff_el2, + hypctx_read_sys_reg(hypctx, HOST_CNTVOFF_EL2)); if (guest) { WRITE_SPECIALREG(EL1_REG(CNTKCTL), @@ -600,7 +610,7 @@ vmm_hyp_reg_restore_timer(struct hypctx *hypctx, struct hyp *hyp, bool guest) * to keep in sync. */ WRITE_SPECIALREG(CNTPOFF_EL2_REG, - hypctx->vtimer.cntvoff_el2); + hypctx_read_sys_reg(hypctx, HOST_CNTVOFF_EL2)); isb(); } } else { @@ -623,18 +633,19 @@ static void vmm_hyp_reg_restore_vgic(struct hypctx *hypctx, bool guest) { /* Load the GICv3 registers */ - WRITE_SPECIALREG(ich_hcr_el2, hypctx->vgic_v3_regs.ich_hcr_el2); + WRITE_SPECIALREG(ich_hcr_el2, + hypctx_read_sys_reg(hypctx, HOST_ICH_HCR_EL2)); WRITE_SPECIALREG(ich_vmcr_el2, - hypctx->vgic_v3_regs.ich_vmcr_el2); + hypctx_read_sys_reg(hypctx, HOST_ICH_VMCR_EL2)); if (!guest) return; - switch (hypctx->vgic_v3_regs.ich_lr_num - 1) { -#define LOAD_LR(x) \ -case x: \ - WRITE_SPECIALREG(ich_lr ## x ##_el2, \ - hypctx->vgic_v3_regs.ich_lr_el2[x]) + switch (hypctx->vgic_v3.ich_lr_num - 1) { +#define LOAD_LR(x) \ +case x: \ + WRITE_SPECIALREG(ich_lr ## x ##_el2, \ + hypctx_read_sys_reg(hypctx, HOST_ICH_LR_EL2(x))) LOAD_LR(15); LOAD_LR(14); LOAD_LR(13); @@ -655,18 +666,18 @@ case x: \ #undef LOAD_LR } - switch (hypctx->vgic_v3_regs.ich_apr_num - 1) { -#define LOAD_APR(x) \ - case x: \ - WRITE_SPECIALREG(ich_ap0r ## x ##_el2, \ - hypctx->vgic_v3_regs.ich_ap0r_el2[x]); \ - WRITE_SPECIALREG(ich_ap1r ## x ##_el2, \ - hypctx->vgic_v3_regs.ich_ap1r_el2[x]) - LOAD_APR(3); - LOAD_APR(2); - LOAD_APR(1); - default: - LOAD_APR(0); + switch (hypctx->vgic_v3.ich_apr_num - 1) { +#define LOAD_APR(x) \ +case x: \ + WRITE_SPECIALREG(ich_ap0r ## x ##_el2, \ + hypctx_read_sys_reg(hypctx, HOST_ICH_AP0R_EL2(x))); \ + WRITE_SPECIALREG(ich_ap1r ## x ##_el2, \ + hypctx_read_sys_reg(hypctx, HOST_ICH_AP1R_EL2(x))) + LOAD_APR(3); + LOAD_APR(2); + LOAD_APR(1); + default: + LOAD_APR(0); #undef LOAD_APR } } @@ -693,11 +704,12 @@ static void vmm_hyp_handle_guest_exit(struct hypctx *hypctx, uint64_t *ret) { bool hpfar_valid; - uint64_t s1e1r, hpfar_el2; + uint64_t s1e1r, hpfar_el2, host_esr_el2, host_far_el2; hpfar_valid = true; + host_esr_el2 = hypctx_read_sys_reg(hypctx, HOST_ESR_EL2); if (*ret == EXCP_TYPE_EL1_SYNC) { - switch (ESR_ELx_EXCEPTION(hypctx->tf.tf_esr)) { + switch (ESR_ELx_EXCEPTION(host_esr_el2)) { case EXCP_INSN_ABORT_L: case EXCP_DATA_ABORT_L: /* @@ -713,9 +725,9 @@ vmm_hyp_handle_guest_exit(struct hypctx *hypctx, uint64_t *ret) * * TODO: Add a case for Arm erratum 834220. */ - if ((hypctx->tf.tf_esr & ISS_DATA_S1PTW) != 0) *** 186 LINES SKIPPED *** From nobody Mon Jul 6 15:24:43 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 4gv7Sr2Bqnz6kDR2 for ; Mon, 06 Jul 2026 15:24:44 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv7Sr03NBz3D2P for ; Mon, 06 Jul 2026 15:24:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783351484; 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=4zGHPf2HpqC9Ttq2pQerZxlt6baAoylX2BixRYun3tI=; b=Cf1bYT46XJOpXAMoflnI3ysxGjqCWnoiGOsNYKaHAx/j0li0cyfA+RyI14JZaGZLD4GTtb aGrFtjgGYA5waWXONxfw5VLqiZxUuwR0EVi2t5fuZLtiyDtP8kkmMA7nZ/0jKmng8wnAbq ZyVv3VZIMYLJamOjVkOAsPtmikuCvazlPds2tDnFfquJtByd1lcXn+u1RHSGlk0e7/HRZC uNcgB6E2FgnZ3MHzFtZcutlIiVh7HBRGXaZ0PhE916mZfMQPA7Z7tQhvAeP+PfjSmEMiP6 UGBef3BobjTdj9UBGAjZDYHHdbMREeCG/Nwju9J3AZZ+nK/QkaUbhz/bzz9A2Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783351484; a=rsa-sha256; cv=none; b=ji76vQ3Y+FiBWyX1JxDibcLHUJDjKeCV1+1TQkC3D5jwHSUDm7Lz8LqorXb03kL/xoSzAl P9OcLynKNHWA4S/de4jZqEx7efqLwgQMU4Vk2vMBU/8SG9psqS0qS7NTwaepVo9mFXDkrC iJhPMO+urEmruDCzeWMcbxsz6GeNYwigW+OiKKKEjtv08ELGxfLcMAfLlMiD5vXRWmyhCR skqUJFIr09JPN6a2g5rbzmPvxi971XWM57w8CpT2YtijF68yw6C2Fch0dBI72lsRgNHiM3 IwAC0aTInFLR1amev/udJEq8Vcf63Rg0eiRzT9Vlezz6i55TI69/gH6zNckBjw== 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=1783351484; 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=4zGHPf2HpqC9Ttq2pQerZxlt6baAoylX2BixRYun3tI=; b=fmSKNczy+JBDyfeamQjvjyy/q5lSCd53W+6tAvzIBB3i+QG88k8u0AXgr5g+Cxnxkd1F+m D2iHaY7ABeePLgdQSprcYdOXky1YnCuQhsL4MLcYWvFw8Jj8Hwd1Ap7kbNzhUDgRkf6DiY H124NdqFgywATvFgOXV0rV/ZWxKW+GdvDfHnuEZvadKSAZhvjbzo2lCu/voePbE2gVWNgO o1mOSZE2Tjv3yko3SzLHhFrVefOUW0tifhJg4y72qFLXaWPY9XpCJeH6zmxYs+tRHTu/8y pLbbpyOnwoLi/RbwePOw1NIDEN8Ecovfywx8baJ5DcvrRSRi78puXLUbG7j8+g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv7Sq6CzBz18jD for ; Mon, 06 Jul 2026 15:24:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1bce1 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 15:24:43 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Kajetan Puchalski From: Andrew Turner Subject: git: ee2642678a2c - main - arm64/vmm: Move host-side EL2 regs into sys_regs 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ee2642678a2ca1cb968fcb2795496bc56eacbe7b Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 15:24:43 +0000 Message-Id: <6a4bc8bb.1bce1.1d6cbb80@gitrepo.freebsd.org> The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=ee2642678a2ca1cb968fcb2795496bc56eacbe7b commit ee2642678a2ca1cb968fcb2795496bc56eacbe7b Author: Kajetan Puchalski AuthorDate: 2026-07-06 14:18:19 +0000 Commit: Andrew Turner CommitDate: 2026-07-06 15:18:30 +0000 arm64/vmm: Move host-side EL2 regs into sys_regs Move EL2 host registers that are not visible to the guest into hypctx->sys_regs. Prefix them with HOST_ to distinguish from EL2 registers which are part of the guest's own state (e.g. in VNCR). Signed-off-by: Kajetan Puchalski Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D56555 --- sys/arm64/vmm/arm64.h | 70 +++--- sys/arm64/vmm/io/vgic_v3.c | 6 +- sys/arm64/vmm/vmm_arm64.c | 26 +- sys/arm64/vmm/vmm_hyp.c | 82 ++++--- sys/arm64/vmm/vmm_reset.c | 582 ++++++++++++++++++++++++--------------------- 5 files changed, 410 insertions(+), 356 deletions(-) diff --git a/sys/arm64/vmm/arm64.h b/sys/arm64/vmm/arm64.h index c43034454808..48ac3fe83ad7 100644 --- a/sys/arm64/vmm/arm64.h +++ b/sys/arm64/vmm/arm64.h @@ -89,6 +89,37 @@ enum hypctx_sysreg { DBGWVR0_EL1, /* Debug Watchpoint Value Registers */ DBGWVR15_EL1 = DBGWVR0_EL1 + 15, + /* EL2 registers used to control the guest, but not exposed to it */ + HOST_CPTR_EL2, /* Architectural Feature Trap Register */ + HOST_HCR_EL2, /* Hypervisor Configuration Register */ + HOST_HCRX_EL2, /* Extended Hypervisor Configuration Register */ + HOST_MDCR_EL2, /* Monitor Debug Configuration Register */ + HOST_VPIDR_EL2, /* Virtualization Processor ID Register */ + HOST_VMPIDR_EL2, /* Virtualization Multiprocessor ID Register */ + /* On systems without NV2 this still points to the register storage + memory page */ + HOST_VNCR_EL2, /* Virtual Nested Control Register */ + HOST_VTTBR_EL2, + + /* FEAT_FGT registers */ + /*HOST_HAFGRTR_EL2; */ /* For FEAT_AMUv1 (not supported) */ + HOST_HDFGRTR_EL2, + HOST_HDFGWTR_EL2, + HOST_HFGITR_EL2, + HOST_HFGRTR_EL2, + HOST_HFGWTR_EL2, + + /* FEAT_FGT2 registers */ + HOST_HDFGRTR2_EL2, + HOST_HDFGWTR2_EL2, + HOST_HFGITR2_EL2, + HOST_HFGRTR2_EL2, + HOST_HFGWTR2_EL2, + + /* Exit info registers */ + HOST_FAR_EL2, /* Fault Address Register */ + HOST_HPFAR_EL2, /* Hypervisor IPA Fault Address Register */ + NR_NON_VNCR_REGS, /* VNCR Registers */ @@ -201,48 +232,11 @@ struct hypctx { struct trapframe tf; /* Virtual-address-sized registers */ uint64_t va_regs[VA_REGS_END - VA_REGS_START - 1]; - /* Non-VNCR guest register state */ + /* Non-VNCR register state */ uint64_t sys_regs[NR_NON_VNCR_REGS]; - /* EL2 registers which we use to control the guest but do not expose to it */ - uint64_t cptr_el2; /* Architectural Feature Trap Register */ - uint64_t hcr_el2; /* Hypervisor Configuration Register */ - uint64_t hcrx_el2; /* Extended Hypervisor Configuration Register */ - uint64_t mdcr_el2; /* Monitor Debug Configuration Register */ - uint64_t vpidr_el2; /* Virtualization Processor ID Register */ - uint64_t vmpidr_el2; /* Virtualization Multiprocessor ID Register */ - /* On systems without NV2 this still points to the register storage memory page */ - uint64_t vncr_el2; /* Virtual Nested Control Register */ - - /* FEAT_FGT registers */ - /*uint64_t hafgrtr_el2; *//* For FEAT_AMUv1 (not supported) */ - uint64_t hdfgrtr_el2; - uint64_t hdfgwtr_el2; - uint64_t hfgitr_el2; - uint64_t hfgrtr_el2; - uint64_t hfgwtr_el2; - - /* FEAT_FGT2 registers */ - uint64_t hdfgrtr2_el2; - uint64_t hdfgwtr2_el2; - uint64_t hfgitr2_el2; - uint64_t hfgrtr2_el2; - uint64_t hfgwtr2_el2; - - uint64_t vttbr_el2; - - /* Storage for *host* timer registers */ - struct { - uint64_t cnthctl_el2; - uint64_t cntvoff_el2; - } host_timer_regs; - struct hyp *hyp; struct vcpu *vcpu; - struct { - uint64_t far_el2; /* Fault Address Register */ - uint64_t hpfar_el2; /* Hypervisor IPA Fault Address Register */ - } exit_info; struct vtimer vtimer; struct vtimer_cpu vtimer_cpu; diff --git a/sys/arm64/vmm/io/vgic_v3.c b/sys/arm64/vmm/io/vgic_v3.c index 199749c12b9f..f38fb4b74693 100644 --- a/sys/arm64/vmm/io/vgic_v3.c +++ b/sys/arm64/vmm/io/vgic_v3.c @@ -431,7 +431,7 @@ mpidr_to_vcpu(struct hyp *hyp, uint64_t mpidr) vm = hyp->vm; for (int i = 0; i < vm_get_maxcpus(vm); i++) { hypctx = hyp->ctx[i]; - if (hypctx != NULL && (hypctx->vmpidr_el2 & GICD_AFF) == mpidr) + if (hypctx != NULL && (hypctx_read_sys_reg(hypctx, HOST_VMPIDR_EL2) & GICD_AFF) == mpidr) return (i); } return (-1); @@ -481,7 +481,7 @@ vgic_v3_cpuinit(device_t dev, struct hypctx *hypctx) mtx_init(&irq->irq_spinmtx, "VGIC IRQ spinlock", NULL, MTX_SPIN); irq->irq = irqid; - irq->mpidr = hypctx->vmpidr_el2 & GICD_AFF; + irq->mpidr = hypctx_read_sys_reg(hypctx, HOST_VMPIDR_EL2) & GICD_AFF; irq->target_vcpu = vcpu_vcpuid(hypctx->vcpu); MPASS(irq->target_vcpu >= 0); @@ -1470,7 +1470,7 @@ redist_typer_read(struct hypctx *hypctx, u_int reg, uint64_t *rval, void *arg) if (vcpu_vcpuid(hypctx->vcpu) == (vgic_max_cpu_count(hypctx->hyp) - 1)) last_vcpu = true; - vmpidr_el2 = hypctx->vmpidr_el2; + vmpidr_el2 = hypctx_read_sys_reg(hypctx, HOST_VMPIDR_EL2); MPASS(vmpidr_el2 != 0); /* * Get affinity for the current CPU. The guest CPU affinity is taken diff --git a/sys/arm64/vmm/vmm_arm64.c b/sys/arm64/vmm/vmm_arm64.c index 43f45dc596c9..ba826649092c 100644 --- a/sys/arm64/vmm/vmm_arm64.c +++ b/sys/arm64/vmm/vmm_arm64.c @@ -638,9 +638,9 @@ arm64_gen_inst_emul_data(struct hypctx *hypctx, uint32_t esr_iss, * Get the page address from HPFAR_EL2. */ vme_ret->u.inst_emul.gpa = - HPFAR_EL2_FIPA_ADDR(hypctx->exit_info.hpfar_el2); + HPFAR_EL2_FIPA_ADDR(hypctx_read_sys_reg(hypctx, HOST_HPFAR_EL2)); /* Bits [11:0] are the same as bits [11:0] from the virtual address. */ - vme_ret->u.inst_emul.gpa += hypctx->exit_info.far_el2 & + vme_ret->u.inst_emul.gpa += hypctx_read_sys_reg(hypctx, HOST_FAR_EL2) & FAR_EL2_HPFAR_PAGE_MASK; esr_sas = (esr_iss & ISS_DATA_SAS_MASK) >> ISS_DATA_SAS_SHIFT; @@ -755,11 +755,11 @@ handle_el1_sync_excp(struct hypctx *hypctx, struct vm_exit *vme_ret, case ISS_DATA_DFSC_PF_L1: case ISS_DATA_DFSC_PF_L2: case ISS_DATA_DFSC_PF_L3: - gpa = HPFAR_EL2_FIPA_ADDR(hypctx->exit_info.hpfar_el2); + gpa = HPFAR_EL2_FIPA_ADDR(hypctx_read_sys_reg(hypctx, HOST_HPFAR_EL2)); /* Check the IPA is valid */ if (gpa >= (1ul << vmm_max_ipa_bits)) { raise_data_insn_abort(hypctx, - hypctx->exit_info.far_el2, + hypctx_read_sys_reg(hypctx, HOST_FAR_EL2), esr_ec == EXCP_DATA_ABORT_L, ISS_DATA_DFSC_ASF_L0); vme_ret->inst_length = 0; @@ -777,7 +777,7 @@ handle_el1_sync_excp(struct hypctx *hypctx, struct vm_exit *vme_ret, * not executable */ raise_data_insn_abort(hypctx, - hypctx->exit_info.far_el2, false, + hypctx_read_sys_reg(hypctx, HOST_FAR_EL2), false, ISS_DATA_DFSC_EXT); vme_ret->inst_length = 0; return (HANDLED); @@ -1170,7 +1170,7 @@ vmmops_run(void *vcpui, register_t pc, pmap_t pmap, struct vm_eventinfo *evinfo) /* Activate the stage2 pmap so the vmid is valid */ pmap_activate_vm(pmap); - hypctx->vttbr_el2 = pmap_to_ttbr0(pmap); + hypctx_write_sys_reg(hypctx, HOST_VTTBR_EL2, pmap_to_ttbr0(pmap)); /* * TODO: What happens if a timer interrupt is asserted exactly @@ -1199,8 +1199,8 @@ vmmops_run(void *vcpui, register_t pc, pmap_t pmap, struct vm_eventinfo *evinfo) vme->inst_length = INSN_SIZE; vme->u.hyp.exception_nr = excp_type; vme->u.hyp.esr_el2 = hypctx->tf.tf_esr; - vme->u.hyp.far_el2 = hypctx->exit_info.far_el2; - vme->u.hyp.hpfar_el2 = hypctx->exit_info.hpfar_el2; + vme->u.hyp.far_el2 = hypctx_read_sys_reg(hypctx, HOST_FAR_EL2); + vme->u.hyp.hpfar_el2 = hypctx_read_sys_reg(hypctx, HOST_HPFAR_EL2); handled = arm64_handle_world_switch(hypctx, excp_type, vme, pmap); @@ -1290,7 +1290,7 @@ hypctx_regptr(struct hypctx *hypctx, int reg) case VM_REG_GUEST_TCR2_EL1: return hypctx_sys_reg(hypctx, TCR2_EL1); case VM_REG_GUEST_MPIDR_EL1: - return (&hypctx->vmpidr_el2); + return hypctx_sys_reg(hypctx, HOST_VMPIDR_EL2); default: break; } @@ -1393,9 +1393,9 @@ vmmops_setcap(void *vcpui, int num, int val) if ((val != 0) == ((hypctx->setcaps & (1ul << num)) != 0)) break; if (val != 0) - hypctx->mdcr_el2 |= MDCR_EL2_TDE; + *hypctx_sys_reg(hypctx, HOST_MDCR_EL2) |= MDCR_EL2_TDE; else if ((hypctx->setcaps & (1ul << VM_CAP_SS_EXIT)) == 0) - hypctx->mdcr_el2 &= ~MDCR_EL2_TDE; + *hypctx_sys_reg(hypctx, HOST_MDCR_EL2) &= ~MDCR_EL2_TDE; break; case VM_CAP_SS_EXIT: if ((val != 0) == ((hypctx->setcaps & (1ul << num)) != 0)) @@ -1408,7 +1408,7 @@ vmmops_setcap(void *vcpui, int num, int val) hypctx->tf.tf_spsr |= PSR_SS; *hypctx_sys_reg(hypctx, MDSCR_EL1) |= MDSCR_SS; - hypctx->mdcr_el2 |= MDCR_EL2_TDE; + *hypctx_sys_reg(hypctx, HOST_MDCR_EL2) |= MDCR_EL2_TDE; } else { hypctx->tf.tf_spsr &= ~PSR_SS; hypctx->tf.tf_spsr |= hypctx->debug_spsr; @@ -1417,7 +1417,7 @@ vmmops_setcap(void *vcpui, int num, int val) *hypctx_sys_reg(hypctx, MDSCR_EL1) |= hypctx->debug_mdscr; hypctx->debug_mdscr &= ~MDSCR_SS; if ((hypctx->setcaps & (1ul << VM_CAP_BRK_EXIT)) == 0) - hypctx->mdcr_el2 &= ~MDCR_EL2_TDE; + *hypctx_sys_reg(hypctx, HOST_MDCR_EL2) &= ~MDCR_EL2_TDE; } break; case VM_CAP_MASK_HWINTR: diff --git a/sys/arm64/vmm/vmm_hyp.c b/sys/arm64/vmm/vmm_hyp.c index 070142199c44..ffc51f243dcd 100644 --- a/sys/arm64/vmm/vmm_hyp.c +++ b/sys/arm64/vmm/vmm_hyp.c @@ -167,7 +167,8 @@ vmm_hyp_reg_store_pmu_debug(struct hypctx *hypctx, bool guest) } if (!guest) - hypctx->mdcr_el2 = READ_SPECIALREG(mdcr_el2); + hypctx_write_sys_reg(hypctx, HOST_MDCR_EL2, + READ_SPECIALREG(mdcr_el2)); } static void @@ -272,8 +273,10 @@ vmm_hyp_reg_store_special(struct hypctx *hypctx, struct hyp *hyp, bool guest) if (guest) { hypctx->tf.tf_esr = READ_SPECIALREG(esr_el2); - hypctx->exit_info.far_el2 = READ_SPECIALREG(far_el2); - hypctx_write_sys_reg(hypctx, PAR_EL1, READ_SPECIALREG(par_el1)); + hypctx_write_sys_reg(hypctx, HOST_FAR_EL2, + READ_SPECIALREG(far_el2)); + hypctx_write_sys_reg(hypctx, + PAR_EL1, READ_SPECIALREG(par_el1)); } /* Store the guest special registers */ @@ -322,16 +325,19 @@ vmm_hyp_reg_store_special(struct hypctx *hypctx, struct hyp *hyp, bool guest) READ_SPECIALREG(EL1_REG(TTBR1))); } - hypctx->cptr_el2 = READ_SPECIALREG(cptr_el2); - hypctx->hcr_el2 = READ_SPECIALREG(hcr_el2); - hypctx->vpidr_el2 = READ_SPECIALREG(vpidr_el2); - hypctx->vmpidr_el2 = READ_SPECIALREG(vmpidr_el2); + hypctx_write_sys_reg(hypctx, HOST_CPTR_EL2, + READ_SPECIALREG(cptr_el2)); + hypctx_write_sys_reg(hypctx, HOST_HCR_EL2, + READ_SPECIALREG(hcr_el2)); + hypctx_write_sys_reg(hypctx, HOST_VPIDR_EL2, + READ_SPECIALREG(vpidr_el2)); + hypctx_write_sys_reg(hypctx, HOST_VMPIDR_EL2, + READ_SPECIALREG(vmpidr_el2)); #ifndef VMM_VHE - if (!guest) { - if ((hyp->feats & HYP_FEAT_HCX) != 0) - hypctx->hcrx_el2 = - READ_SPECIALREG(MRS_REG_ALT_NAME(HCRX_EL2)); + if (!guest && ((hyp->feats & HYP_FEAT_HCX) != 0)) { + hypctx_write_sys_reg(hypctx, HOST_HCRX_EL2, + READ_SPECIALREG(MRS_REG_ALT_NAME(HCRX_EL2))); } #endif } @@ -339,11 +345,11 @@ vmm_hyp_reg_store_special(struct hypctx *hypctx, struct hyp *hyp, bool guest) static void vmm_hyp_reg_restore_special(struct hypctx *hypctx, struct hyp *hyp, bool guest) { - WRITE_SPECIALREG(hcr_el2, hypctx->hcr_el2); + WRITE_SPECIALREG(hcr_el2, hypctx_read_sys_reg(hypctx, HOST_HCR_EL2)); - if (guest_or_nonvhe(guest)) { - if ((hyp->feats & HYP_FEAT_HCX) != 0) - WRITE_SPECIALREG(HCRX_EL2_REG, hypctx->hcrx_el2); + if (guest_or_nonvhe(guest) && ((hyp->feats & HYP_FEAT_HCX) != 0)) { + WRITE_SPECIALREG(HCRX_EL2_REG, + hypctx_read_sys_reg(hypctx, HOST_HCRX_EL2)); } isb(); @@ -352,20 +358,27 @@ vmm_hyp_reg_restore_special(struct hypctx *hypctx, struct hyp *hyp, bool guest) if (guest) { /* Fine-grained trap controls */ if ((hyp->feats & HYP_FEAT_FGT) != 0) { - WRITE_SPECIALREG(HDFGWTR_EL2_REG, hypctx->hdfgwtr_el2); - WRITE_SPECIALREG(HFGITR_EL2_REG, hypctx->hfgitr_el2); - WRITE_SPECIALREG(HFGRTR_EL2_REG, hypctx->hfgrtr_el2); - WRITE_SPECIALREG(HFGWTR_EL2_REG, hypctx->hfgwtr_el2); + WRITE_SPECIALREG(HDFGWTR_EL2_REG, + hypctx_read_sys_reg(hypctx, HOST_HDFGWTR_EL2)); + WRITE_SPECIALREG(HFGITR_EL2_REG, + hypctx_read_sys_reg(hypctx, HOST_HFGITR_EL2)); + WRITE_SPECIALREG(HFGRTR_EL2_REG, + hypctx_read_sys_reg(hypctx, HOST_HFGRTR_EL2)); + WRITE_SPECIALREG(HFGWTR_EL2_REG, + hypctx_read_sys_reg(hypctx, HOST_HFGWTR_EL2)); } if ((hyp->feats & HYP_FEAT_FGT2) != 0) { WRITE_SPECIALREG(HDFGRTR2_EL2_REG, - hypctx->hdfgrtr2_el2); + hypctx_read_sys_reg(hypctx, HOST_HDFGRTR2_EL2)); WRITE_SPECIALREG(HDFGWTR2_EL2_REG, - hypctx->hdfgwtr2_el2); - WRITE_SPECIALREG(HFGITR2_EL2_REG, hypctx->hfgitr2_el2); - WRITE_SPECIALREG(HFGRTR2_EL2_REG, hypctx->hfgrtr2_el2); - WRITE_SPECIALREG(HFGWTR2_EL2_REG, hypctx->hfgwtr2_el2); + hypctx_read_sys_reg(hypctx, HOST_HDFGWTR2_EL2)); + WRITE_SPECIALREG(HFGITR2_EL2_REG, + hypctx_read_sys_reg(hypctx, HOST_HFGITR2_EL2)); + WRITE_SPECIALREG(HFGRTR2_EL2_REG, + hypctx_read_sys_reg(hypctx, HOST_HFGRTR2_EL2)); + WRITE_SPECIALREG(HFGWTR2_EL2_REG, + hypctx_read_sys_reg(hypctx, HOST_HFGWTR2_EL2)); } } #endif @@ -418,9 +431,12 @@ vmm_hyp_reg_restore_special(struct hypctx *hypctx, struct hyp *hyp, bool guest) WRITE_SPECIALREG(par_el1, hypctx_read_sys_reg(hypctx, PAR_EL1)); } - WRITE_SPECIALREG(cptr_el2, hypctx->cptr_el2); - WRITE_SPECIALREG(vpidr_el2, hypctx->vpidr_el2); - WRITE_SPECIALREG(vmpidr_el2, hypctx->vmpidr_el2); + WRITE_SPECIALREG(cptr_el2, + hypctx_read_sys_reg(hypctx, HOST_CPTR_EL2)); + WRITE_SPECIALREG(vpidr_el2, + hypctx_read_sys_reg(hypctx, HOST_VPIDR_EL2)); + WRITE_SPECIALREG(vmpidr_el2, + hypctx_read_sys_reg(hypctx, HOST_VMPIDR_EL2)); /* Load the special regs from the trapframe */ WRITE_SPECIALREG(sp_el1, hypctx->tf.tf_sp); @@ -710,18 +726,18 @@ vmm_hyp_handle_guest_exit(struct hypctx *hypctx, uint64_t *ret) } } if (hpfar_valid) { - hypctx->exit_info.hpfar_el2 = READ_SPECIALREG(hpfar_el2); + hypctx_write_sys_reg(hypctx, HOST_HPFAR_EL2, READ_SPECIALREG(hpfar_el2)); } else { /* * TODO: There is a risk the at instruction could cause an * exception here. We should handle it & return a failure. */ s1e1r = - arm64_address_translate_s1e1r(hypctx->exit_info.far_el2); + arm64_address_translate_s1e1r(hypctx_read_sys_reg(hypctx, HOST_FAR_EL2)); if (PAR_SUCCESS(s1e1r)) { hpfar_el2 = (s1e1r & PAR_PA_MASK) >> PAR_PA_SHIFT; hpfar_el2 <<= HPFAR_EL2_FIPA_SHIFT; - hypctx->exit_info.hpfar_el2 = hpfar_el2; + hypctx_write_sys_reg(hypctx, HOST_HPFAR_EL2, hpfar_el2); } else { *ret = EXCP_TYPE_REENTER; } @@ -733,11 +749,11 @@ static uint64_t __vmm_hyp_call_guest(struct hypctx *hypctx, struct hypctx *host_hypctx) { uint64_t ret; - WRITE_SPECIALREG(vttbr_el2, hypctx->vttbr_el2); - WRITE_SPECIALREG(mdcr_el2, hypctx->mdcr_el2); + WRITE_SPECIALREG(vttbr_el2, hypctx_read_sys_reg(hypctx, HOST_VTTBR_EL2)); + WRITE_SPECIALREG(mdcr_el2, hypctx_read_sys_reg(hypctx, HOST_MDCR_EL2)); /* Call into the guest */ ret = VMM_HYP_FUNC(do_call_guest)(hypctx); - WRITE_SPECIALREG(mdcr_el2, host_hypctx->mdcr_el2); + WRITE_SPECIALREG(mdcr_el2, hypctx_read_sys_reg(host_hypctx, HOST_MDCR_EL2)); isb(); diff --git a/sys/arm64/vmm/vmm_reset.c b/sys/arm64/vmm/vmm_reset.c index 1280fe64277a..1beea0fdbc53 100644 --- a/sys/arm64/vmm/vmm_reset.c +++ b/sys/arm64/vmm/vmm_reset.c @@ -97,23 +97,27 @@ reset_vm_el2_regs(void *vcpu) * invalidate * HCR_VM: use stage 2 translation */ - el2ctx->hcr_el2 = HCR_RW | HCR_TID3 | HCR_TWI | HCR_BSU_IS | HCR_FB | - HCR_AMO | HCR_IMO | HCR_FMO | HCR_SWIO | HCR_VM; + hypctx_write_sys_reg(el2ctx, HOST_HCR_EL2, + HCR_RW | HCR_TID3 | HCR_TWI | HCR_BSU_IS | HCR_FB | HCR_AMO | + HCR_IMO | HCR_FMO | HCR_SWIO | HCR_VM); + if (in_vhe()) { - el2ctx->hcr_el2 |= HCR_E2H; + *hypctx_sys_reg(el2ctx, HOST_HCR_EL2) |= HCR_E2H; } /* Set the Extended Hypervisor Configuration Register */ - el2ctx->hcrx_el2 = 0; + hypctx_write_sys_reg(el2ctx, HOST_HCRX_EL2, 0); /* TODO: Trap all extensions we don't support */ - el2ctx->mdcr_el2 = MDCR_EL2_TDOSA | MDCR_EL2_TDRA | MDCR_EL2_TPMS | - MDCR_EL2_TTRF; + hypctx_write_sys_reg(el2ctx, HOST_MDCR_EL2, + MDCR_EL2_TDOSA | MDCR_EL2_TDRA | MDCR_EL2_TPMS | MDCR_EL2_TTRF); /* PMCR_EL0.N is read from MDCR_EL2.HPMN */ - el2ctx->mdcr_el2 |= (hypctx_read_sys_reg(el2ctx, PMCR_EL0) & PMCR_N_MASK) >> PMCR_N_SHIFT; + *hypctx_sys_reg(el2ctx, HOST_MDCR_EL2) |= + (hypctx_read_sys_reg(el2ctx, PMCR_EL0) & PMCR_N_MASK) >> PMCR_N_SHIFT; - el2ctx->vmpidr_el2 = VMPIDR_EL2_RES1; + hypctx_write_sys_reg(el2ctx, HOST_VMPIDR_EL2, VMPIDR_EL2_RES1); /* The guest will detect a multi-core, single-threaded CPU */ - el2ctx->vmpidr_el2 &= ~VMPIDR_EL2_U & ~VMPIDR_EL2_MT; + *hypctx_sys_reg(el2ctx, HOST_VMPIDR_EL2) &= + ~VMPIDR_EL2_U & ~VMPIDR_EL2_MT; /* * Generate the guest MPIDR value. We only support 16 CPUs at affinity * level 0 to simplify the vgicv3 driver (see writing sgi1r_el1). @@ -122,24 +126,28 @@ reset_vm_el2_regs(void *vcpu) ((vcpuid >> 4) & 0xff) << MPIDR_AFF1_SHIFT | ((vcpuid >> 12) & 0xff) << MPIDR_AFF2_SHIFT | ((vcpuid >> 20) & 0xff) << MPIDR_AFF3_SHIFT; - el2ctx->vmpidr_el2 |= cpu_aff; + *hypctx_sys_reg(el2ctx, HOST_VMPIDR_EL2) |= cpu_aff; /* Use the same CPU identification information as the host */ - el2ctx->vpidr_el2 = CPU_IMPL_TO_MIDR(CPU_IMPL_ARM); - el2ctx->vpidr_el2 |= CPU_VAR_TO_MIDR(0); - el2ctx->vpidr_el2 |= CPU_ARCH_TO_MIDR(0xf); - el2ctx->vpidr_el2 |= CPU_PART_TO_MIDR(CPU_PART_FOUNDATION); - el2ctx->vpidr_el2 |= CPU_REV_TO_MIDR(0); + hypctx_write_sys_reg(el2ctx, HOST_VPIDR_EL2, + CPU_IMPL_TO_MIDR(CPU_IMPL_ARM)); + *hypctx_sys_reg(el2ctx, HOST_VPIDR_EL2) |= CPU_VAR_TO_MIDR(0); + *hypctx_sys_reg(el2ctx, HOST_VPIDR_EL2) |= CPU_ARCH_TO_MIDR(0xf); + *hypctx_sys_reg(el2ctx, HOST_VPIDR_EL2) |= CPU_PART_TO_MIDR( + CPU_PART_FOUNDATION); + *hypctx_sys_reg(el2ctx, HOST_VPIDR_EL2) |= CPU_REV_TO_MIDR(0); /* * Don't trap accesses to CPACR_EL1, trace, SVE, Advanced SIMD * and floating point functionality to EL2. */ if (in_vhe()) - el2ctx->cptr_el2 = CPTR_E2H_TRAP_ALL | CPTR_E2H_FPEN; + hypctx_write_sys_reg(el2ctx, HOST_CPTR_EL2, + CPTR_E2H_TRAP_ALL | CPTR_E2H_FPEN); else - el2ctx->cptr_el2 = CPTR_TRAP_ALL & ~CPTR_TFP; - el2ctx->cptr_el2 &= ~CPTR_TCPAC; + hypctx_write_sys_reg(el2ctx, HOST_CPTR_EL2, + CPTR_TRAP_ALL & ~CPTR_TFP); + *hypctx_sys_reg(el2ctx, HOST_CPTR_EL2) &= ~CPTR_TCPAC; /* * Disable interrupts in the guest. The guest OS will re-enable * them. @@ -150,325 +158,361 @@ reset_vm_el2_regs(void *vcpu) /* FEAT_FGT traps */ if ((el2ctx->hyp->feats & HYP_FEAT_FGT) != 0) { -#define HFGT_TRAP_FIELDS(read, write, read_pfx, write_pfx, name, trap) \ -do { \ - el2ctx->read |= read_pfx ## _EL2_ ## name ## _ ## trap; \ - el2ctx->write |= write_pfx ## _EL2_ ## name ## _ ## trap; \ -} while (0) - +#define HFGT_TRAP_FIELDS(read, write, read_pfx, write_pfx, name, trap) \ + do { \ + *hypctx_sys_reg(el2ctx, \ + read) |= read_pfx##_EL2_##name##_##trap; \ + *hypctx_sys_reg(el2ctx, \ + write) |= write_pfx##_EL2_##name##_##trap; \ + } while (0) /* * Traps for special registers */ /* Debug registers */ - el2ctx->hdfgrtr_el2 = 0; - el2ctx->hdfgwtr_el2 = 0; + hypctx_write_sys_reg(el2ctx, HOST_HDFGRTR_EL2, 0); + hypctx_write_sys_reg(el2ctx, HOST_HDFGWTR_EL2, 0); /* FEAT_BRBE */ - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - nBRBDATA, TRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - nBRBCTL, TRAP); - el2ctx->hdfgrtr_el2 |= HDFGRTR_EL2_nBRBIDR_TRAP; + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, nBRBDATA, TRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, nBRBCTL, TRAP); + *hypctx_sys_reg(el2ctx, + HOST_HDFGRTR_EL2) |= HDFGRTR_EL2_nBRBIDR_TRAP; /* FEAT_TRBE */ - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - TRBTRG_EL1, TRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - TRBSR_EL1, TRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - TRBPTR_EL1, TRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - TRBMAR_EL1, TRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - TRBLIMITR_EL1, TRAP); - el2ctx->hdfgrtr_el2 |= HDFGRTR_EL2_TRBIDR_EL1_TRAP; - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - TRBBASER_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, TRBTRG_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, TRBSR_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, TRBPTR_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, TRBMAR_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, TRBLIMITR_EL1, TRAP); + *hypctx_sys_reg(el2ctx, + HOST_HDFGRTR_EL2) |= HDFGRTR_EL2_TRBIDR_EL1_TRAP; + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, TRBBASER_EL1, TRAP); /* FEAT_TRF */ - el2ctx->hdfgwtr_el2 |= HDFGWTR_EL2_TRFCR_EL1_TRAP; + *hypctx_sys_reg(el2ctx, + HOST_HDFGWTR_EL2) |= HDFGWTR_EL2_TRFCR_EL1_TRAP; /* FEAT_ETE */ - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - TRCVICTLR, TRAP); - el2ctx->hdfgrtr_el2 |= HDFGRTR_EL2_TRCSTATR_TRAP; - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - TRCSSCSRn, TRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - TRCSEQSTR, TRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - TRCPRGCTLR, TRAP); - el2ctx->hdfgrtr_el2 |= HDFGRTR_EL2_TRCOSLSR_TRAP; - el2ctx->hdfgwtr_el2 |= HDFGWTR_EL2_TRCOSLAR_TRAP; - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - TRCIMSPECn, TRAP); - el2ctx->hdfgrtr_el2 |= HDFGRTR_EL2_TRCID_TRAP; - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - TRCCNTVRn, TRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - TRCCLAIM, TRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - TRCAUXCTLR, TRAP); - el2ctx->hdfgrtr_el2 |= HDFGRTR_EL2_TRCAUTHSTATUS_TRAP; - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - TRC, TRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - PMSLATFR_EL1, TRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - PMSIRR_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, TRCVICTLR, TRAP); + *hypctx_sys_reg(el2ctx, + HOST_HDFGRTR_EL2) |= HDFGRTR_EL2_TRCSTATR_TRAP; + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, TRCSSCSRn, TRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, TRCSEQSTR, TRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, TRCPRGCTLR, TRAP); + *hypctx_sys_reg(el2ctx, + HOST_HDFGRTR_EL2) |= HDFGRTR_EL2_TRCOSLSR_TRAP; + + *hypctx_sys_reg(el2ctx, + HOST_HDFGWTR_EL2) |= HDFGWTR_EL2_TRCOSLAR_TRAP; + + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, TRCIMSPECn, TRAP); + *hypctx_sys_reg(el2ctx, + HOST_HDFGRTR_EL2) |= HDFGRTR_EL2_TRCID_TRAP; + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, TRCCNTVRn, TRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, TRCCLAIM, TRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, TRCAUXCTLR, TRAP); + *hypctx_sys_reg(el2ctx, + HOST_HDFGRTR_EL2) |= HDFGRTR_EL2_TRCAUTHSTATUS_TRAP; + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, TRC, TRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, PMSLATFR_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, PMSIRR_EL1, TRAP); /* FEAT_SPE */ - el2ctx->hdfgrtr_el2 |= HDFGRTR_EL2_PMBIDR_EL1_TRAP; - el2ctx->hdfgrtr_el2 |= HDFGRTR_EL2_PMSIDR_EL1_TRAP; - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - PMSICR_EL1, TRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - PMSFCR_EL1, TRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - PMSEVFR_EL1, TRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - PMSCR_EL1, TRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - PMBSR_EL1, TRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - PMBPTR_EL1, TRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - PMBLIMITR_EL1, TRAP); + *hypctx_sys_reg(el2ctx, + HOST_HDFGRTR_EL2) |= HDFGRTR_EL2_PMBIDR_EL1_TRAP; + + *hypctx_sys_reg(el2ctx, + HOST_HDFGRTR_EL2) |= HDFGRTR_EL2_PMSIDR_EL1_TRAP; + + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, PMSICR_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, PMSFCR_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, PMSEVFR_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, PMSCR_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, PMBSR_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, PMBPTR_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, PMBLIMITR_EL1, TRAP); /* FEAT_SPE_FnE */ - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - nPMSNEVFR_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, nPMSNEVFR_EL1, TRAP); /* FEAT_PMUv3 */ - el2ctx->hdfgrtr_el2 |= HDFGRTR_EL2_PMCEIDn_EL0_NOTRAP; - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - PMUSERENR_EL0, NOTRAP); - el2ctx->hdfgrtr_el2 |= HDFGRTR_EL2_PMMIR_EL1_NOTRAP; - el2ctx->hdfgwtr_el2 |= HDFGWTR_EL2_PMCR_EL0_NOTRAP; - el2ctx->hdfgwtr_el2 |= HDFGWTR_EL2_PMSWINC_EL0_NOTRAP; - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - PMSELR_EL0, NOTRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - PMOVS, NOTRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - PMINTEN, NOTRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - PMCNTEN, NOTRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - PMCCNTR_EL0, NOTRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - PMCCFILTR_EL0, NOTRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - PMEVTYPERn_EL0, NOTRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - PMEVCNTRn_EL0, NOTRAP); + *hypctx_sys_reg(el2ctx, + HOST_HDFGRTR_EL2) |= HDFGRTR_EL2_PMCEIDn_EL0_NOTRAP; + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, PMUSERENR_EL0, NOTRAP); + *hypctx_sys_reg(el2ctx, + HOST_HDFGRTR_EL2) |= HDFGRTR_EL2_PMMIR_EL1_NOTRAP; + *hypctx_sys_reg(el2ctx, + HOST_HDFGWTR_EL2) |= HDFGWTR_EL2_PMCR_EL0_NOTRAP; + *hypctx_sys_reg(el2ctx, + HOST_HDFGWTR_EL2) |= HDFGWTR_EL2_PMSWINC_EL0_NOTRAP; + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, PMSELR_EL0, NOTRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, PMOVS, NOTRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, PMINTEN, NOTRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, PMCNTEN, NOTRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, PMCCNTR_EL0, NOTRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, PMCCFILTR_EL0, NOTRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, PMEVTYPERn_EL0, NOTRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, PMEVCNTRn_EL0, NOTRAP); /* FEAT_DoubleLock */ - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - OSDLR_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, OSDLR_EL1, TRAP); /* Base architecture */ - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - OSECCR_EL1, NOTRAP); - el2ctx->hdfgrtr_el2 |= HDFGRTR_EL2_OSLSR_EL1_NOTRAP; - el2ctx->hdfgwtr_el2 |= HDFGWTR_EL2_OSLAR_EL1_NOTRAP; - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - DBGPRCR_EL1, NOTRAP); - el2ctx->hdfgrtr_el2 |= HDFGRTR_EL2_DBGAUTHSTATUS_EL1_NOTRAP; - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - DBGCLAIM, NOTRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - MDSCR_EL1, NOTRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - DBGWVRn_EL1, NOTRAP); - el2ctx->hdfgwtr_el2 |= HDFGWTR_EL2_DBGWCRn_EL1_NOTRAP; - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - DBGBVRn_EL1, NOTRAP); - HFGT_TRAP_FIELDS(hdfgrtr_el2, hdfgwtr_el2, HDFGRTR, HDFGWTR, - DBGBCRn_EL1, NOTRAP); - + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, OSECCR_EL1, NOTRAP); + *hypctx_sys_reg(el2ctx, + HOST_HDFGRTR_EL2) |= HDFGRTR_EL2_OSLSR_EL1_NOTRAP; + *hypctx_sys_reg(el2ctx, + HOST_HDFGWTR_EL2) |= HDFGWTR_EL2_OSLAR_EL1_NOTRAP; + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, DBGPRCR_EL1, NOTRAP); + *hypctx_sys_reg(el2ctx, + HOST_HDFGRTR_EL2) |= HDFGRTR_EL2_DBGAUTHSTATUS_EL1_NOTRAP; + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, DBGCLAIM, NOTRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, MDSCR_EL1, NOTRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, DBGWVRn_EL1, NOTRAP); + *hypctx_sys_reg(el2ctx, + HOST_HDFGWTR_EL2) |= HDFGWTR_EL2_DBGWCRn_EL1_NOTRAP; + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, DBGBVRn_EL1, NOTRAP); + HFGT_TRAP_FIELDS(HOST_HDFGRTR_EL2, HOST_HDFGWTR_EL2, HDFGRTR, + HDFGWTR, DBGBCRn_EL1, NOTRAP); /* Non-debug special registers */ - el2ctx->hfgrtr_el2 = 0; - el2ctx->hfgwtr_el2 = 0; + *hypctx_sys_reg(el2ctx, HOST_HFGRTR_EL2) = 0; + *hypctx_sys_reg(el2ctx, HOST_HFGWTR_EL2) = 0; /* FEAT_AIE */ - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - nAMAIR2_EL1, TRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - nMAIR2_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, nAMAIR2_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, nMAIR2_EL1, TRAP); /* FEAT_S2POE */ - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - nS2POR_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, nS2POR_EL1, TRAP); /* FEAT_S1POE */ - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - nPOR_EL1, TRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - nPOR_EL0, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, nPOR_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, nPOR_EL0, TRAP); /* FEAT_S1PIE */ - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - nPIR_EL1, TRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - nPIRE0_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, nPIR_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, nPIRE0_EL1, TRAP); /* FEAT_THE */ - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - nRCWMASK_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, nRCWMASK_EL1, TRAP); /* FEAT_SME */ - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - nTPIDR2_EL0, TRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - nSMPRI_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, nTPIDR2_EL0, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, nSMPRI_EL1, TRAP); /* FEAT_GCS */ - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - nGCS_EL1, TRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - nGCS_EL0, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, nGCS_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, nGCS_EL0, TRAP); /* FEAT_LS64_ACCDATA */ - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - nACCDATA_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, nACCDATA_EL1, TRAP); /* FEAT_RASv1p1 */ - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - ERXPFGCDN_EL1, TRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - ERXPFGCTL_EL1, TRAP); - el2ctx->hfgrtr_el2 |= HFGRTR_EL2_ERXPFGF_EL1_TRAP; + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, ERXPFGCDN_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, ERXPFGCTL_EL1, TRAP); + *hypctx_sys_reg(el2ctx, + HOST_HFGRTR_EL2) |= HFGRTR_EL2_ERXPFGF_EL1_TRAP; /* FEAT_RAS */ - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - ERXADDR_EL1, TRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - ERXMISCn_EL1, TRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - ERXSTATUS_EL1, TRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - ERXCTLR_EL1, TRAP); - el2ctx->hfgrtr_el2 |= HFGRTR_EL2_ERXFR_EL1_TRAP; - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - ERRSELR_EL1, TRAP); - el2ctx->hfgrtr_el2 |= HFGRTR_EL2_ERRIDR_EL1_TRAP; + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, ERXADDR_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, ERXMISCn_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, ERXSTATUS_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, ERXCTLR_EL1, TRAP); + *hypctx_sys_reg(el2ctx, + HOST_HFGRTR_EL2) |= HFGRTR_EL2_ERXFR_EL1_TRAP; + + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, ERRSELR_EL1, TRAP); + *hypctx_sys_reg(el2ctx, + HOST_HFGRTR_EL2) |= HFGRTR_EL2_ERRIDR_EL1_TRAP; /* GICv3 */ - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - ICC_IGRPENn_EL1, NOTRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, ICC_IGRPENn_EL1, NOTRAP); /* FEAT_LOR */ - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - LORSA_EL1, TRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - LORN_EL1, TRAP); - el2ctx->hfgrtr_el2 |= HFGRTR_EL2_LORID_EL1_TRAP; - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - LOREA_EL1, TRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - LORC_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, LORSA_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, LORN_EL1, TRAP); + *hypctx_sys_reg(el2ctx, + HOST_HFGRTR_EL2) |= HFGRTR_EL2_LORID_EL1_TRAP; + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, LOREA_EL1, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, LORC_EL1, TRAP); /* FEAT_PAuth */ - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - APIBKey, TRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - APIAKey, TRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - APGAKey, TRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - APDBKey, TRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - APDAKey, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, APIBKey, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, APIAKey, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, APGAKey, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, APDBKey, TRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, + HFGWTR, APDAKey, TRAP); /* Base architecture */ - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - VBAR_EL1, NOTRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - TTBR1_EL1, NOTRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - TTBR0_EL1, NOTRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - TPIDR_EL0, NOTRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - TPIDRRO_EL0, NOTRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - TPIDR_EL1, NOTRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - TCR_EL1, NOTRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - SCXTNUM_EL0, TRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - SCXTNUM_EL1, TRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - SCTLR_EL1, NOTRAP); - el2ctx->hfgrtr_el2 |= HFGRTR_EL2_REVIDR_EL1_NOTRAP; - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - PAR_EL1, NOTRAP); - el2ctx->hfgrtr_el2 |= HFGRTR_EL2_MPIDR_EL1_NOTRAP; - el2ctx->hfgrtr_el2 |= HFGRTR_EL2_MIDR_EL1_NOTRAP; - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - MAIR_EL1, NOTRAP); - el2ctx->hfgrtr_el2 |= HFGRTR_EL2_ISR_EL1_NOTRAP; - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - FAR_EL1, NOTRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - ESR_EL1, NOTRAP); - el2ctx->hfgrtr_el2 |= HFGRTR_EL2_DCZID_EL0_NOTRAP; - el2ctx->hfgrtr_el2 |= HFGRTR_EL2_CTR_EL0_NOTRAP; - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - CSSELR_EL1, NOTRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - CPACR_EL1, NOTRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - CONTEXTIDR_EL1, NOTRAP); - el2ctx->hfgrtr_el2 |= HFGRTR_EL2_CLIDR_EL1_NOTRAP; - el2ctx->hfgrtr_el2 |= HFGRTR_EL2_CCSIDR_EL1_NOTRAP; - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - AMAIR_EL1, NOTRAP); - el2ctx->hfgrtr_el2 |= HFGRTR_EL2_AIDR_EL1_NOTRAP; - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - AFSR1_EL1, NOTRAP); - HFGT_TRAP_FIELDS(hfgrtr_el2, hfgwtr_el2, HFGRTR, HFGWTR, - AFSR0_EL1, NOTRAP); + HFGT_TRAP_FIELDS(HOST_HFGRTR_EL2, HOST_HFGWTR_EL2, HFGRTR, *** 173 LINES SKIPPED *** From nobody Mon Jul 6 15:49:14 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 4gv8170Y8jz6kGNX for ; Mon, 06 Jul 2026 15:49:15 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv81673KXz3Jfc for ; Mon, 06 Jul 2026 15:49:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783352955; 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=XsV557oWtWner70wosh1lacfptKqH6VuLVZrVPb3ZnI=; b=Vl09utqopsI1ZRrW+vjmAudbjnuk50HpWzpQKyS0kN/LonPVoXAHQOfXUEmpOzGGb2o3EB uVnwllzafdJOHN0iqY8VrkNJolq7iDd05e6zFufxdkr1tbu0Z7xiz6gmB0pIQ2UULf2wwT wnPvVz6ykOupsaoWkfOpswZ3FqpZ7D876BkAx3M+CbhRq/liyRoIFzZr0FKs5afQcKybXt jJ1GHLEeM2Whu27MXU0DfNG9HARgHrfEcrOQWB8VrXTX7W4ZZ4TDyhVDgOP8H0suzL+GC+ 02F2SB88PJ+92XApDflXMIAKspKzz3jxeBCwG9ZALcD3nUES8cWt7adA+qUTFQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783352955; a=rsa-sha256; cv=none; b=CdUTx6AJXVoXeC395jv75SrroKS9aauE9hWZ6wpgAgfnog6+J/MjsMDbZIvpd8/scm4n7J tTsie4LJi/Lnk8wVeZjMWuwYKYPcop377j4tLAaf8E92LIccR08FERPmuR3cmbZSJQ8ywU 0lvUU6Mj/FFronWR9IzL51ZTNJZKXzPqAlGSYzXH4dWtuzmE9brJVS0dNmWa4/oB9VVCB3 tK+b0e5PuYCmrmhA/d2gMjpus2lFtAPuEQZoTWgvonmw+fllRYwboID3seHdViUFovJkpa p7pPEEleHS4G9HhW76NjN3W1EpUVfBD/hTWbQPZYRz6tZNf3OHpNwq6q3R1rSQ== 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=1783352955; 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=XsV557oWtWner70wosh1lacfptKqH6VuLVZrVPb3ZnI=; b=HiVnOwueqiath+AZ8LCMBhK6u5EqnIKt9vim9HMtZH3s9ElQc0EUbF5oHAg1qArWQye7Bu SanKswSMBTVhILYhVtSAF4vjz99gwj55f/kX5j6Q1VbTjs0kIBNrq8MXQ2UFvvUTysUpk7 dJ5mrMxWoVHBEl1kzJt3WQ0Hopc6DINpEvZxmJqIVYs81T7IGU6fhun8ShOTvVWykbGy5D C4B51SIBtDDIOse/w1UmA/ZCYeh0X5iQAfg3KmW/NwzxITBYvc5QnRXrigE8R5EloU+gIW wVFtoYczBIIjbfRG3I7JBpvp9ou0wWt73cdqLaZWI4rZihB9VLL56v8brgX4EQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv8165Z24z19WM for ; Mon, 06 Jul 2026 15:49:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1eece by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 15:49:14 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 58c73727d6e4 - main - vfs: Fix resource leaks in kern_symlinkat() 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: 58c73727d6e49de1fc4f4bc90621146cae8db2bc Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 15:49:14 +0000 Message-Id: <6a4bce7a.1eece.18e1b08e@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=58c73727d6e49de1fc4f4bc90621146cae8db2bc commit 58c73727d6e49de1fc4f4bc90621146cae8db2bc Author: Mark Johnston AuthorDate: 2026-07-06 15:42:52 +0000 Commit: Mark Johnston CommitDate: 2026-07-06 15:46:01 +0000 vfs: Fix resource leaks in kern_symlinkat() Fixes: 2ec2ba7e232d ("vfs: Add VFS/syscall support for Solaris style extended attributes") Reported by: Yuxiang Yang, Yizhou Zhao, Ao Wang, Xuewei Feng, Qi Li, and Ke Xu from Tsinghua University using GLM-5.2 from Z.ai Reviewed by: rmacklem, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D58053 --- sys/kern/vfs_syscalls.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index ec952cac1d2e..59d0c9c40927 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1882,7 +1882,7 @@ restart: } if ((vn_irflag_read(nd.ni_dvp) & VIRF_NAMEDDIR) != 0) { error = EINVAL; - goto out; + goto out2; } VATTR_NULL(&vattr); vattr.va_mode = ACCESSPERMS &~ td->td_proc->p_pd->pd_cmask; @@ -1894,9 +1894,7 @@ restart: goto out2; #endif error = VOP_SYMLINK(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr, syspath); -#ifdef MAC out2: -#endif VOP_VPUT_PAIR(nd.ni_dvp, error == 0 ? &nd.ni_vp : NULL, true); vn_finished_write(mp); NDFREE_PNBUF(&nd); From nobody Mon Jul 6 16:26:59 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 4gv8rh1hghz6kK85 for ; Mon, 06 Jul 2026 16:27:00 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv8rh0xgXz3Mt6 for ; Mon, 06 Jul 2026 16:27:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783355220; 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=R3ogu6XC1jD70vovC1qUrkmnBUhihgSco+Gnnzd0S9E=; b=Uto+we3TiTYYL3mxazDeWoxwXI8wb7Cg11InFYYRkv2erQROMrJ9ihjiojelr9mm3pns9t tMQwmDN99ZIpyYXqVwgRoYY/5PiX6WW8nqsL0gFI/TwdguBOfRZ5dZtM632yCoja/xxsBA BhxF/1uB9VLhquYOCbujPeBOC2aFjFc1i723BvA4mBC6Y9XjtScanvPAy+BqymPSAQuS6K Bor5HyzCAPcj/e5IOPsfYvtIs17Qu5BZXkEd0wcW1G2vwUSYzDduMD/DtkXqV987hYP8EX GuI+N4Y0AEOzeaOFTpSDuvgwG+QwWn8XaqpDz7MK/I1GTGFhrXLMrhUtBf7tAw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783355220; a=rsa-sha256; cv=none; b=dpbHw0ul5aXv11rolP0T9T7D2HH7RRvAQBEXx28g/TJkgvBNWFHfkEnAnpTcOJoW2dG9+i R5ctppNx3uBUjqIxbJk+K+y/1r9AXX9FNog/yC/IGc77EXEuNtNAry8M4sz59iqz6Im/CW 1fh5wAxbUm66DAWMb+GGXqT27Rt35OI8zPeUvLQdfomjoM31ptx11kNq0lZYtdCVTxOi0V YvdyR52CZVmCxAfTrFr0UCWOUKV4q2KI727E2feUbys5Um0BefR2u6PZt1Sqp1mX8SE5PS roQw72PYAlSJp5pHJ5moseLpA48cBi/BEYQsTBn9EPNFd/6zU3bVKkAV2qxxow== 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=1783355220; 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=R3ogu6XC1jD70vovC1qUrkmnBUhihgSco+Gnnzd0S9E=; b=TZX9OWgCSPMaLubHvTeI+UkWnUQnZ6gLqA13v5jChVh2liOWGwfFQlJuXfCWjVy/H5zBee BlYYskUbWkhs8l/oRoZlI3C3WOc5rcHFpNENMHWZ9JQY3iTlliicS8CS6ewHxiIIcEo0g5 +McQTbnMh2SWzAKQhxjXvhMVPm85Az7kNYt6vifed0ugoeZSJchqk24qFtX4GdZfAxzN/A yUoONerySGJFpj8V9s60+lHb8TErQQ8ULCH5rsveZZsJ6gOZpSYIvtNnhW6ANfyoDU8Y6x rHvjE0OmeFWt15IRZXzgsHuaLom+sswkSFBF5YAlgP5kGZKXoivsKuV0TwFmHw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv8rg6fvVz1BQJ for ; Mon, 06 Jul 2026 16:26:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 25085 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 16:26:59 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 7a0b9e30a5ba - main - libllvmminimal: Fix building with LLVM < 21 on riscv64 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: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7a0b9e30a5ba07066caffba51fa82ca3782a5da1 Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 16:26:59 +0000 Message-Id: <6a4bd753.25085.292b9fb@gitrepo.freebsd.org> The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=7a0b9e30a5ba07066caffba51fa82ca3782a5da1 commit 7a0b9e30a5ba07066caffba51fa82ca3782a5da1 Author: Jessica Clarke AuthorDate: 2026-07-06 16:25:48 +0000 Commit: Jessica Clarke CommitDate: 2026-07-06 16:25:48 +0000 libllvmminimal: Fix building with LLVM < 21 on riscv64 On most architectures we end up not needing ABIBreak.cpp as, although some of the sources here do reference EnableABIBreakingChecks (or, if assertions are disabled, DisableABIBreakingChecks) at a source level, we compile with -ffunction-sections and -fdata-sections, and link with --gc-sections, and it happens to be the case that all references can be GC'ed. However, prior to LLVM 21, the RISC-V backend did not apply -fdata-sections to .sdata, where references to these symbols end up, and for some files we're building with such references we end up not being able to GC .sdata due to the other unrelated data in it, meaning that we do in fact need to build ABIBreak.cpp. Whilst we could make this conditional on the architecture, it's a tiny file, and it's a bit fragile to rely on GC behaviour, so just include it unconditionally. Reviewed by: dim, emaste Fixes: 770cf0a5f02d ("Fixups after llvm-project main llvmorg-21-init-19288-gface93e724f4 merge") MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D58044 --- lib/clang/libllvmminimal/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/clang/libllvmminimal/Makefile b/lib/clang/libllvmminimal/Makefile index f54974c2d2ca..eaa6a670294d 100644 --- a/lib/clang/libllvmminimal/Makefile +++ b/lib/clang/libllvmminimal/Makefile @@ -6,7 +6,7 @@ INTERNALLIB= SRCDIR= llvm/lib SRCS+= Demangle/ItaniumDemangle.cpp -#SRCS+= Support/ABIBreak.cpp +SRCS+= Support/ABIBreak.cpp SRCS+= Support/APFloat.cpp SRCS+= Support/APInt.cpp #SRCS+= Support/Atomic.cpp From nobody Mon Jul 6 17:15:21 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 4gv9wT3CYxz6kNbM for ; Mon, 06 Jul 2026 17:15:21 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gv9wT2Smvz3TKj for ; Mon, 06 Jul 2026 17:15:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783358121; 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=u4p34wO7x4fiPeLGaAExOVJXbX9q+BdWg8etkLG83gE=; b=dffrBr8ijPS6z4UGQ1yU0t266dbAeInP7iZjNR127/LadNtJdkUAJTXh+Q3riXRdQdqvMp ROQgL4/BvdubEBgdSZmeUjnQQugiBrZS8hYDyFb4CPd9G/nkbpYXOqle1ZoDtkHE8KTTwC KHNwxHWnZgiCnM44EwidoB482rnTpXj9jRUBBT0y+OfVKLsi6u0Iuh1tpbRHlsU+a0H/Hq MC93ycDs1iQwmr5f/9FEvyrQZrPjkgjF9FVzoYvfhc+eY8fMWlDRNZjXUL0h2FtnURUfDr EVxeBs65SC9HC3/sl6SE8DSznw2q/VYZU8ZE/uwokX5LRS/DvOxF1dUKquzR1g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783358121; a=rsa-sha256; cv=none; b=xT4LhqLaqDeUSecwCzB+h7/dOxouutohjZj01gohIwoZa2LEfzLoyJabrEuYp0BIjR7uis ER67GkTjgRMCGT6gymNMVdeBnDVvmfThNtEtsphecfbGOTANoaphebRj3qRKgnKKLD1YSU kHDoMKSJzA/l1clVVeSV/T3NzCNEVNlEAKvmR1khtig7HAWXJHMt8kcAVA8R0NDWIlk/wq SDxBaX6Rg+QdWoUJrX/132i1XSEMxeMjefRjt4oHFKrpC4fpJz5/OG5ArFQkYf0UVN36dU eMswTaim/XxlWj9KyvOnTFOTYC8t1b6UmXHc49Jbz28gSyTPPOK8/cl/lN8QAA== 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=1783358121; 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=u4p34wO7x4fiPeLGaAExOVJXbX9q+BdWg8etkLG83gE=; b=PwnXiGPz06PI6xje6Fluftw4BzlQ5TlRs6Pv/hZ+22b4mZRb/1gGRKDRSBs/SfxgRt7LQ0 cJELX07WOWk1GsVNUx2N3dc8ytT9C5LuvW0BJylofr34S59FApjUkrFrbpPxRl+4zKDkuC y5E8srrslWuKDN0fWsYtc6U6RqcDpz7X/uYP5arNvtc4FksNq5oxElzvdNVLU3L8SZe1ZS QNAtrNrx8/6toHeP1oSxVB8cH7NUzdOVsVycDK1ar6rO7zhzEFBCR4hKlYu6jpqLwUvgnB 59f2zgHBTHz9/z5AcWvFshpUD10q/XHTdFLsBDvgU/Yk6NHqOoZpJ02Hzemuxw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gv9wT1QTRz1CmP for ; Mon, 06 Jul 2026 17:15:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 31a29 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 17:15:21 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Pouria Mousavizadeh Tehrani Subject: git: bf142ea4760b - main - if_ovpn: Fix memory leak in VNET during unload 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: pouria X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bf142ea4760bd4391092d9cc0038a0870cf7e0b2 Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 17:15:21 +0000 Message-Id: <6a4be2a9.31a29.5d355ed7@gitrepo.freebsd.org> The branch main has been updated by pouria: URL: https://cgit.FreeBSD.org/src/commit/?id=bf142ea4760bd4391092d9cc0038a0870cf7e0b2 commit bf142ea4760bd4391092d9cc0038a0870cf7e0b2 Author: Pouria Mousavizadeh Tehrani AuthorDate: 2026-07-06 16:23:56 +0000 Commit: Pouria Mousavizadeh Tehrani CommitDate: 2026-07-06 17:13:53 +0000 if_ovpn: Fix memory leak in VNET during unload Unloading if_ovpn while it's in use by other vnets causes memory leaks and panics. Fix this by reverting VNET_SYSUNINIT and adjusting the SI_SUB initialization order. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D54175 --- sys/net/if_ovpn.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/sys/net/if_ovpn.c b/sys/net/if_ovpn.c index b4796fb95589..19fab11f3dde 100644 --- a/sys/net/if_ovpn.c +++ b/sys/net/if_ovpn.c @@ -2847,9 +2847,19 @@ vnet_ovpn_init(const void *unused __unused) }; V_ovpn_cloner = ifc_attach_cloner(ovpngroupname, &req); } -VNET_SYSINIT(vnet_ovpn_init, SI_SUB_PSEUDO, SI_ORDER_ANY, +VNET_SYSINIT(vnet_ovpn_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, vnet_ovpn_init, NULL); +static void +vnet_ovpn_uninit(void) +{ + + if (V_ovpn_cloner != NULL) + ifc_detach_cloner(V_ovpn_cloner); +} +VNET_SYSUNINIT(vnet_ovpn_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, + vnet_ovpn_uninit, NULL); + static int ovpn_prison_remove(void *obj, void *data __unused) { @@ -2891,12 +2901,6 @@ ovpnmodevent(module_t mod, int type, void *data) case MOD_UNLOAD: if (ovpn_osd_jail_slot != 0) osd_jail_deregister(ovpn_osd_jail_slot); - CURVNET_SET(vnet0); - if (V_ovpn_cloner != NULL) { - ifc_detach_cloner(V_ovpn_cloner); - V_ovpn_cloner = NULL; - } - CURVNET_RESTORE(); break; default: return (EOPNOTSUPP); @@ -2911,6 +2915,6 @@ static moduledata_t ovpn_mod = { 0 }; -DECLARE_MODULE(if_ovpn, ovpn_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); +DECLARE_MODULE(if_ovpn, ovpn_mod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY); MODULE_VERSION(if_ovpn, 1); MODULE_DEPEND(if_ovpn, crypto, 1, 1, 1); From nobody Mon Jul 6 19:35:40 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 4gvF2V0TFfz6kYx6 for ; Mon, 06 Jul 2026 19:35: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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvF2T6sjHz3lLS for ; Mon, 06 Jul 2026 19:35:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783366546; 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=LG4bWYo5Elv29alpUSzJp8zA8izMhBhwlEwImmTjr/A=; b=QUpGDcD7F5enXmirO9B/fcbJxU2xq4TtN5MGCVtk01HLtQlThvrYU0Cakw4+nYDYywOnEp Lmkf27EF4eQkIvQNvVOnz5g39nYL/noguAG0hHpRJI8AHa7oc1YxZ4oAmCuLQkuieTREiy m8cKvNG5sScRCC0v3YPJMar+kzCLwa7gqs/dSjbEJlKACdKC9MZAHgrDSjCb4I8rwi3ewJ 2gVa60Z7eomSeFFFqQZyfjz9Jq62cY+UyQ2Tgsr1m4FrOEAINd11TqhIAFP+QYzE7kh/8Q Fa4XE1KFN2b9Qd15Z/0CjZ79a/5c+ArmDZKT2g5Rej5vjcbaztesRY0zcQ0moA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783366546; a=rsa-sha256; cv=none; b=LnOBqWEG1ujJGg5W/OCdqF9AOAycuAOLSNUNzg7LmNjm7CT1mf7Hz9tHjodIPO8tHkCS3d uGwYkgOwLtgZUK0HHKgnomZrrNtoecg75CPCY5Crv2suzbAv76AkqIYvvvj/gQDbKnz4ui KIzLPVSTziAb1RD1SNHCGNgIxKdGbjw01095jc4Uj6rDzLCyOT/6+WoTTjIiVeXQux9Mlt PUnU8L5KIlHyNCoI87XUdN3Pz4IfqM21D+QH8aPYj+OlPBBeMqaGyHpveMgJjjZ7BqmAp4 1IZh65V2K628ibITE1VaP27z7Fwdy8ZR/vPqmPIVnpIotRaB9n8M327dh3C42w== 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=1783366546; 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=LG4bWYo5Elv29alpUSzJp8zA8izMhBhwlEwImmTjr/A=; b=cVNUWwCNn7AMS8rwAqtIA14RfE74Oa11tpHRyxVGkDZkh0dlqNIgJzxoTKxZgD8UBZzNGb s8FV/xfgGua3x/FK+hOTCkUXFtUVC6wtUrCBM+zOFNKcb5CaFbDlWmxOJFym9rQj30VF6r 1YRppn30XARlY65+Crf/viFYHQcG0TPl7VsT/aY6I5ptF3d0Lef8oiocpQxmcw+CrZ1JxL 2L/fDRrPQdtrgnirdB4Dw0Se0ZfIRYSCQyZTOscV71PbQ2ApYVy4hFO4ha2deMCN4EzJyT I9JhOw2+8BGGeGgYVcI8lsTjDyaKGiWROw6gNUyuEUNlNX+UGPH98uLNbT8L3Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvF2T5Wbgz1HMn for ; Mon, 06 Jul 2026 19:35:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 40202 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 19:35:40 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Peter Eriksson From: Rick Macklem Subject: git: d7d71341ae7d - main - acl_from_text.c: Allow negative uid/gid numbers to be handled 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: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d7d71341ae7d79886143a9ce427dca0e858eda97 Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 19:35:40 +0000 Message-Id: <6a4c038c.40202.3c63240e@gitrepo.freebsd.org> The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=d7d71341ae7d79886143a9ce427dca0e858eda97 commit d7d71341ae7d79886143a9ce427dca0e858eda97 Author: Peter Eriksson AuthorDate: 2026-07-06 19:33:22 +0000 Commit: Rick Macklem CommitDate: 2026-07-06 19:33:22 +0000 acl_from_text.c: Allow negative uid/gid numbers to be handled getfacl / acl_to_text() incorrectly prints uid/gid numbers as signed integers. This causes uid / gid numbers larger than 2G (2147483648) to print as negative numbers. The libc acl_from_text() function does not handle negative numbers. This diff adds a backwards compatiblity fix to allow negative numbers... Reviewed by: rmacklem MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D57180 --- lib/libc/posix1e/acl_from_text.c | 41 +++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/lib/libc/posix1e/acl_from_text.c b/lib/libc/posix1e/acl_from_text.c index 765b58290a04..746338b37f0c 100644 --- a/lib/libc/posix1e/acl_from_text.c +++ b/lib/libc/posix1e/acl_from_text.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include "acl_support.h" @@ -263,6 +264,24 @@ error_label: return(NULL); } +/* + * Make sure the number given fits inside an uid_t or gid_t. + * Currently (2026-05-23) uid_t & gid_t is an uint32_t. + * Special case handle uid_t/gid_t numbers specified as negative numbers. + * Assumes that uid_t and gid_t are the same types. + */ +static int +_invalid_uidgid(intmax_t v) { + if (v < 0) { + if ((-v) & ~(uintmax_t)((~(uid_t)0)>>1)) + return (2); /* Underflow, does not fit into uid_t */ + } else { + if (v & ~(uintmax_t)(~(uid_t)0)) + return (1); /* Overflow, does not fit into uid_t */ + } + return (0); +} + /* * Given a username/groupname from a text form of an ACL, return the uid/gid * XXX NOT THREAD SAFE, RELIES ON GETPWNAM, GETGRNAM @@ -274,19 +293,21 @@ _acl_name_to_id(acl_tag_t tag, char *name, uid_t *id) { struct group *g; struct passwd *p; - unsigned long l; + intmax_t v; char *endp; switch(tag) { case ACL_USER: p = getpwnam(name); if (p == NULL) { - l = strtoul(name, &endp, 0); - if (*endp != '\0' || l != (unsigned long)(uid_t)l) { - errno = EINVAL; + errno = 0; + v = strtoimax(name, &endp, 0); + if (name == endp || *endp != '\0' || + errno == ERANGE || _invalid_uidgid(v) != 0) { + errno = EINVAL; /* No or invalid number */ return (-1); } - *id = (uid_t)l; + *id = v; return (0); } *id = p->pw_uid; @@ -295,12 +316,14 @@ _acl_name_to_id(acl_tag_t tag, char *name, uid_t *id) case ACL_GROUP: g = getgrnam(name); if (g == NULL) { - l = strtoul(name, &endp, 0); - if (*endp != '\0' || l != (unsigned long)(gid_t)l) { - errno = EINVAL; + errno = 0; + v = strtoimax(name, &endp, 0); + if (name == endp || *endp != '\0' || + errno == ERANGE || _invalid_uidgid(v) != 0) { + errno = EINVAL; /* No or invalid number */ return (-1); } - *id = (gid_t)l; + *id = v; return (0); } *id = g->gr_gid; From nobody Mon Jul 6 19:41:02 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 4gvF8Z6Jf2z6kZHq for ; Mon, 06 Jul 2026 19:41:02 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvF8Z5mB3z3n6R for ; Mon, 06 Jul 2026 19:41:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783366862; 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=6K3EaMMBhQDZWawSEeyOsR4AY4QZQGppU2OOqu9oJgk=; b=Ji4ZfAgC7VphZcigbPdyAeEEqtVL2Hv+GkfpupKA6IHZWC0/xf+bAuNsJ7V8bkFW+wYrfl sf/JyPlEIHxMcPlop618yav5VkRzms05dbfqq2e1+nO/OLOo1+7QcDaVs1pd9gsyOrVHZC 1HgGEZnUKewlaXEGFIHoOso25BrZ1nFFbnjcBwAZ/1mDi8NpWQbHRXAuOtG4CK7ukiLu5r lCRz2LA301fiYAm/9K8BOzajt8dvnLsRPnBJcVvo646fBfYqVZ19X7Z9WVOEeutIme4ap1 pTiIPiQI3CTySjaj7UEW+RF1bekI2+dD0B8aSHWHrhM/xS19qNZRczKE/nYTZw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783366862; a=rsa-sha256; cv=none; b=dMSgXQB2Gh7JSJLNE1ZsuyJc9LD2ja4hjQfEXyK3OTLdLz2NHlZNSXxf4MrDIRbhV6CZW0 ajCi+eVrn2VVNjxLhwkodNpjY/2WSIcy6SRtoL4DeMY5P8t1+WailDK9toNmhAkLhwGKRW dMrmRxbm+0ZxiaKuYMXwGCPELnOscangqsoch2zijTxksRD6iW8ex52JnGK4QDafe6Ug/p C+XGaV8havZM7VeCZ4WdbN7W6VqmKfqMizOXhZp1WsDd3MaKItf5Dw6hF6h+9JRwoL54ZF Bsq8RBKbhs5ksipt+rtJzOq2wJBdnUw93YJV2/ZL+D6Sv9w7MT/rcr5BBt4U5A== 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=1783366862; 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=6K3EaMMBhQDZWawSEeyOsR4AY4QZQGppU2OOqu9oJgk=; b=m2Vk7XSk9izaZWVfhME4dkWJsQlcblVCUM3fAW8bdZYsP9pQ1ZHVZB7yzWkY8H0dxH+Woh Z0R5qr22aWF6xOhNCAVYH2Eoj79Bt5p2q3G2VoddUWdw4CfFzax1rue5DOH6KNxTdw0ER6 hCJ8Owkyv8t7ng3am5/X6Wf81ccJ81iTKRYsP1j8dz4A4Q4zxb9CiSS1i7N3coD5al65HS XlPP20bOfOOzmW+1CG7HN8mq11+ly9Uvbxo8mQhmlPYf7m4ZRrRHw8TNMFE5vyFpUzGQaK Q3ZyGb/oaTxVO3Ob5qJmKp4K+P+dHfdFSwvvMWAg9OQuT00xkNtelJPk41qDBg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvF8Z4kf1z1HBb for ; Mon, 06 Jul 2026 19:41:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 40f9a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 19:41:02 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Drewery Subject: git: 6a6d6d7d9c29 - main - dtrace tests: Fix finding multiple process results 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: bdrewery X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6a6d6d7d9c294efb8b4025d80e938f2c16c3aa5f Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 19:41:02 +0000 Message-Id: <6a4c04ce.40f9a.73b95bd9@gitrepo.freebsd.org> The branch main has been updated by bdrewery: URL: https://cgit.FreeBSD.org/src/commit/?id=6a6d6d7d9c294efb8b4025d80e938f2c16c3aa5f commit 6a6d6d7d9c294efb8b4025d80e938f2c16c3aa5f Author: Bryan Drewery AuthorDate: 2026-07-03 00:37:02 +0000 Commit: Bryan Drewery CommitDate: 2026-07-06 19:40:23 +0000 dtrace tests: Fix finding multiple process results When looking up self process we can use `ps -p $$` directly rather than grep which may find other processes ending in the expected PID. Sponsored by: Dell Inc. Reviewed by: markj, vangyzen Differential Revision: https://reviews.freebsd.org/D58019 --- .../opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh | 2 +- .../opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh | 2 +- .../opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh | 2 +- .../opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh | 2 +- .../opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh index 2397db6e1b72..bd4a2bf324b4 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh @@ -77,7 +77,7 @@ fi #Get the groupid of the calling process using ps -groupid=`ps -x -o pid,egid | grep "$$ " | awk '{print $2}' 2>/dev/null` +groupid=$(ps -p $$ -o egid= 2>/dev/null) if [ $? -ne 0 ]; then print -u2 "unable to get uid of the current process with pid = $$" exit 1 diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh index 5bdc391dbbc0..aa379b76025d 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh @@ -69,7 +69,7 @@ EOF chmod 555 $dfilename -userid=`ps -x -o pid,uid | grep "$$ " | awk '{print $2}' 2>/dev/null` +userid=$(ps -p $$ -o uid= 2>/dev/null) if [ $? -ne 0 ]; then print -u2 "unable to get uid of the current process with pid = $$" exit 1 diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh index 0c4e77b54e4f..00414f9bfe64 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh @@ -69,7 +69,7 @@ EOF chmod 555 $dfilename -groupid=`ps -x -o pid,gid | grep "$$ " | awk '{print $2}' 2>/dev/null` +groupid=$(ps -p $$ -o gid= 2>/dev/null) if [ $? -ne 0 ]; then print -u2 "unable to get uid of the current process with pid = $$" exit 1 diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh index 08a65b2d62dc..64fb817f1b34 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh @@ -69,7 +69,7 @@ EOF chmod 555 $dfilename -sessionid=`ps -x -o pid,sid | grep "$$ " | awk '{print $2}' 2>/dev/null` +sessionid=$(ps -p $$ -o sid= 2>/dev/null) if [ $? -ne 0 ]; then print -u2 "unable to get sid of the current process with pid = $$" exit 1 diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh index 8cd6130ff644..a44186f5f28b 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh @@ -69,7 +69,7 @@ EOF chmod 555 $dfilename -userid=`ps -x -o pid,uid | grep "$$ " | awk '{print $2}' 2>/dev/null` +userid=$(ps -p $$ -o uid= 2>/dev/null) if [ $? -ne 0 ]; then print -u2 "unable to get uid of the current process with pid = $$" exit 1 From nobody Mon Jul 6 19:44:13 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 4gvFDF5XNfz6k5V9 for ; Mon, 06 Jul 2026 19:44:13 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvFDF54Ksz3nvX for ; Mon, 06 Jul 2026 19:44:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783367053; 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=x5WxCErwc6UXOSEp1mVXHQZDML581pxQ96DOlijXNrY=; b=kxNzYIBm46dBo95kE8s+6Mg/Cm68VOTtOgLTpQCUXeUn0EAWKl3hnwDupLO6IReW+T1aLC /q8aZcMwoaG+cufv0j/JCy2r92xbVkqdFNOOS6RivaDUEVez358M9gEK4HAu8DORkMIrFn O4iMMunFEpWSnuUHAcMZ5jRTU/IhcHTr0qi/DM+ih26iU9uMWH00L/ErBvi7Bp/L0OTcdz N5UcidKoah3qeWJSHu30QYT+2pZo5bB0ueO58wUivbTZWz4QNW8UPtVCQGwQMPCrZpD84C FHN0LPo97goYE9jljAaJRIhdMi0XW12VpraTaq9kl5EAvEnE0k7F+G8OlkOiRg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783367053; a=rsa-sha256; cv=none; b=B757PCmn54H2oIuISyG2JWo/WlFcNGbrUdqnoOIQNnojWnQsBJa3C+T5Rdz6VnvSlglBzm JkNsHbxccTmu/dJ00LR90OQ5N6Y7X3/2NeUBdTfDn/Erzh55GrZ0kLHF9wHg07fxdNX7JW RN51vBT4yzdC+7MT4jKyCpxnmzxwJjTmNhcdWSE2fs45FY9agPkFJMIjq61A2goNbU8dvc FKqQMv7Iy6XgLtybEsb1k6LD+/nj/e6jwb3DifOB/ghmoPnPc1fHVj7CZO6s8xDqXyhM7j Bm/YgaBZ1envhCPXVXoxQV5GrtY3ogk3kKvQx+p58oc4ZBTCGase3xMrX3HwUg== 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=1783367053; 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=x5WxCErwc6UXOSEp1mVXHQZDML581pxQ96DOlijXNrY=; b=yiPiNfgSVS4CMi5F8S6iDSICJdFDFvP8npnjdcekS1dbaa18xnzEPcl8c3SyvW6FCRBfw+ d4yBYb2SbTuWd9wEHoXNfbVFC+parEEP24hexhq/lAKwUs1GM5BdXKXwNjhH0OVp2HTdJJ vGK+U7dbqL+BHjdkelysurO8N69ABhCkuvtlQed7qKIUqOx/ntigt2ggLpaDlIYwLFOeZc us/6JngzzEUHyGbnccjPdYLlMTQ60aq8EEI1n8ad1ia281jaM/T2ysm/PBprmQ83SGBEDj 86Q2Hz5seS3QoNTVsNY3oPcjYwGx4EQESMf+dJhzjWZEFJuPLr9xH7Sl+rNeDA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvFDF3kMqz1HDv for ; Mon, 06 Jul 2026 19:44:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3ff3a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 19:44:13 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 8b197806dcdf - main - libsysdecode: Teach mktables to handle enums 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8b197806dcdff5673dd4f77a97bf46035d14db2a Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 19:44:13 +0000 Message-Id: <6a4c058d.3ff3a.44bb1175@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=8b197806dcdff5673dd4f77a97bf46035d14db2a commit 8b197806dcdff5673dd4f77a97bf46035d14db2a Author: Dag-Erling Smørgrav AuthorDate: 2026-07-06 19:41:15 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-07-06 19:41:15 +0000 libsysdecode: Teach mktables to handle enums While here, clean up and simplify the existing code. MFC after: 1 week Reviewed by: glebius, jhb Differential Revision: https://reviews.freebsd.org/D57993 --- lib/libsysdecode/mktables | 59 +++++++++++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/lib/libsysdecode/mktables b/lib/libsysdecode/mktables index e7dde6f8e2ff..df742ff62f39 100644 --- a/lib/libsysdecode/mktables +++ b/lib/libsysdecode/mktables @@ -48,35 +48,54 @@ fi all_headers= # -# Generate a table C #definitions. The including file can define the -# TABLE_NAME(n), TABLE_ENTRY(x), and TABLE_END macros to define what -# the tables map to. +# Generate a table from C preprocessor symbol definitions. The +# including file can define the TABLE_START(n), TABLE_ENTRY(x), and +# TABLE_END macros to define what the tables map to. # gen_table() { - local name grep file excl filter - name=$1 - grep=$2 - file=$3 - excl=$4 + local name=$1 grep=$2 file=$3 excl=$4 - if [ -z "$excl" ]; then - filter="cat" - else - filter="egrep -v" + cat <<_EOF_ +TABLE_START(${name}) +_EOF_ + if [ -e "${include_dir}/${file}" ]; then + all_headers="${all_headers:+${all_headers} }${file}" + sed -nE ${excl:+-e "/${excl}/d"} \ + -e "/^#[[:space:]]*define[[:space:]]+${grep}/p" \ + "${include_dir}/${file}" | \ + sed -Ee 's/.*define[[:space:]]+([^[:space:]]+)\>.*/TABLE_ENTRY(\1)/' fi +cat <<_EOF_ +TABLE_END + +_EOF_ +} + +# +# Generate a table from C enum definitions. The including file can +# define the TABLE_START(n), TABLE_ENTRY(x), and TABLE_END macros to +# define what the tables map to. Works with most enum definitions as +# long as each constant is on a line by itself. +# +gen_table_enum() +{ + local name=$1 grep=$2 file=$3 excl=$4 + cat <<_EOF_ TABLE_START(${name}) _EOF_ if [ -e "${include_dir}/${file}" ]; then all_headers="${all_headers:+${all_headers} }${file}" - egrep "^#[[:space:]]*define[[:space:]]+"${grep}"[[:space:]]*" \ - $include_dir/$file | ${filter} ${excl} | \ - awk '{ for (i = 1; i <= NF; i++) \ - if ($i ~ /define/) \ - break; \ - ++i; \ - printf "TABLE_ENTRY(%s)\n", $i }' + # preprocess the header + ${CPP:-${CC:-cc} -E} "${include_dir}/${file}" | + # filter out directives and apply exclusion + sed -Ee '/^#/d' ${excl:+-e "/${excl}/d"} | + # extract all enum definitions + awk '/^(typedef[[:space:]]*)?enum([[:space:]].*)?\{/, + /^\}([[:space:]].*)?;/' | + # pick out the constants we want + sed -Ene 's/^[[:space:]]*('"${grep}"')\>.*/TABLE_ENTRY(\1)/p' fi cat <<_EOF_ TABLE_END @@ -127,7 +146,7 @@ gen_table "rusage" "RUSAGE_[A-Z]+[[:space:]]+[-0-9]+" "sys/ gen_table "schedpolicy" "SCHED_[A-Z]+[[:space:]]+[0-9]+" "sys/sched.h" gen_table "sendfileflags" "SF_[A-Z]+[[:space:]]+[0-9]+" "sys/socket.h" gen_table "shmatflags" "SHM_[A-Z]+[[:space:]]+[0-9]{6}" "sys/shm.h" -gen_table "shutdownhow" "SHUT_[A-Z]+[[:space:]]+SHUT_[A-Z]+" "sys/socket.h" +gen_table_enum "shutdownhow" "SHUT_[A-Z]+" "sys/socket.h" gen_table "sigbuscode" "BUS_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h" gen_table "sigchldcode" "CLD_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h" gen_table "sigfpecode" "FPE_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h" From nobody Mon Jul 6 19:44:14 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 4gvFDH1SBMz6k5XR for ; Mon, 06 Jul 2026 19:44:15 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvFDG5hlBz3nyC for ; Mon, 06 Jul 2026 19:44:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783367054; 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=A3DnOuqr66zVwYe6FIP6rq+20h8rKDINDOS8RadX5EU=; b=UpIl3AOLeKGbjJWfitrrG/4HZ2pK49ckVyUee5sV3oQFai011rJhMvqXv+TVLHNrXZdHNp 8JpDTdAkTMYr/i5ME4TcijPZwZs/yR0cZCB0MdYT9h+dx8OOF+XI0eB5oPDfQkHvRk8iMN uhl5/fn1P1TnPUI73XTgzNFtp62o21I3j522+2N1Qc43d1cXwZvrSpBojEc2EieSDI4t6W Y7UhCF3ANUwggXBNJX/cwS+ympK65fSy2iXS8EU9fjojJirZwqIxN5oNINhZatFJu7RXYP SWxl92nY0K6qT874oFLniy6BDI71TMVjIFQWwGV2DlorxE3c14okeywtTx5GJQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783367054; a=rsa-sha256; cv=none; b=vLfSqI5W00YASAjiv9MA3UXHzRCJuDTDXMiMhiAoDaUvvT6HcZGVZyIXkQd/u1k8bjXrUE MKTQfj2bXmd5qiHze9U/F6eHuK2w3HNXn0ye/lgMuf77QOf0bh6nt/1q/ZO3EDqTN1e7gD EwdIIfPul7rHWNMEmZjK1B5wc8Maq+qEr5f5VtrtU5tB+5ZvWqmWrZzlZB0pgQZWuvJj+i kjyvKgQ7jaDbuiwKQe/vgQa4/48XDMcbZrl68NDKe71f76DIWXJxo5cNbdHWArSvgGSNnF XA4Lzmx29g/lawIQYDzWOE7LFCxGHDt+c39v3lEuPz52/1BTzLexqy471VibzA== 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=1783367054; 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=A3DnOuqr66zVwYe6FIP6rq+20h8rKDINDOS8RadX5EU=; b=N0EG50iK8CjebJ4ZJXQR5D00eZwouEOOFWQz79FSUTu9ufVUNuhfR2ItPr+ZxPmoHBJFLH AeqNgvj+o1JZ01ad/cFuYc6kCuedTwcHSh0ZSAQj8cs/vRGGu+WqDdMvZBrQJkarSh7wrw W3PmJhhfdDRUw7y5scTcqj9Df/ltzixmiNvXzBLws2rbNMY1OkX8sj9KmZTVyg72XkGEzN ZgWfOp3bDJgqFxL2O+FOoIDoErqzx4ApnHXhKOgFDhpbvB/meX0Wp58rTQMvhD6soVvAnV 9xtU8L+mWmfH+HJxDObxeUVPX4yjXChb+2jnXkclW4pJImj0mF3j0wCNeT4Lsw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvFDG4WzSz1HZY for ; Mon, 06 Jul 2026 19:44:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3f2f3 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 19:44:14 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Gleb Smirnoff From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: f01c509568f2 - main - pf: revert netlink commands back to enum 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f01c509568f25c8003bf2b0c5f6fa008e5f8f810 Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 19:44:14 +0000 Message-Id: <6a4c058e.3f2f3.76baf8c3@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=f01c509568f25c8003bf2b0c5f6fa008e5f8f810 commit f01c509568f25c8003bf2b0c5f6fa008e5f8f810 Author: Gleb Smirnoff AuthorDate: 2026-07-06 19:41:25 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-07-06 19:41:25 +0000 pf: revert netlink commands back to enum Revert pf_nl.h part of 017690e50913 and use new libsysdecode build glue that parses enums. Reviewed by: kp, glebius Differential Revision: https://reviews.freebsd.org/D57866 --- lib/libsysdecode/mktables | 2 +- sys/netpfil/pf/pf_nl.h | 103 +++++++++++++++++++++++----------------------- 2 files changed, 53 insertions(+), 52 deletions(-) diff --git a/lib/libsysdecode/mktables b/lib/libsysdecode/mktables index df742ff62f39..9e08246d50cc 100644 --- a/lib/libsysdecode/mktables +++ b/lib/libsysdecode/mktables @@ -189,7 +189,7 @@ else fi gen_table "shmflags" "SHM_[A-Z_]+[[:space:]]+0x[0-9]+" "sys/mman.h" "SHM_ANON" gen_table "itimerwhich" "ITIMER_[A-Z]+[[:space:]]+[0-9]+" "sys/time.h" -gen_table "pfnl_cmd" "PFNL_CMD_[A-Z_]+[[:space:]]+[0-9]+" "netpfil/pf/pf_nl.h" +gen_table_enum "pfnl_cmd" "PFNL_CMD_[A-Z_]+" "netpfil/pf/pf_nl.h" gen_table "nlm_flag" "NLM_F_[A-Z]+[[:space:]]+0x[0-9]+" "netlink/netlink.h" # Generate a .depend file for our output file diff --git a/sys/netpfil/pf/pf_nl.h b/sys/netpfil/pf/pf_nl.h index 34ad5be75917..4d0186ea86a5 100644 --- a/sys/netpfil/pf/pf_nl.h +++ b/sys/netpfil/pf/pf_nl.h @@ -34,57 +34,58 @@ #define PFNL_FAMILY_NAME "pfctl" /* available commands */ -#define PFNL_CMD_UNSPEC 0 -#define PFNL_CMD_GETSTATES 1 -#define PFNL_CMD_GETCREATORS 2 -#define PFNL_CMD_START 3 -#define PFNL_CMD_STOP 4 -#define PFNL_CMD_ADDRULE 5 -#define PFNL_CMD_GETRULES 6 -#define PFNL_CMD_GETRULE 7 -#define PFNL_CMD_CLRSTATES 8 -#define PFNL_CMD_KILLSTATES 9 -#define PFNL_CMD_SET_STATUSIF 10 -#define PFNL_CMD_GET_STATUS 11 -#define PFNL_CMD_CLEAR_STATUS 12 -#define PFNL_CMD_NATLOOK 13 -#define PFNL_CMD_SET_DEBUG 14 -#define PFNL_CMD_SET_TIMEOUT 15 -#define PFNL_CMD_GET_TIMEOUT 16 -#define PFNL_CMD_SET_LIMIT 17 -#define PFNL_CMD_GET_LIMIT 18 -#define PFNL_CMD_BEGIN_ADDRS 19 -#define PFNL_CMD_ADD_ADDR 20 -#define PFNL_CMD_GET_ADDRS 21 -#define PFNL_CMD_GET_ADDR 22 -#define PFNL_CMD_GET_RULESETS 23 -#define PFNL_CMD_GET_RULESET 24 -#define PFNL_CMD_GET_SRCNODES 25 -#define PFNL_CMD_CLEAR_TABLES 26 -#define PFNL_CMD_ADD_TABLE 27 -#define PFNL_CMD_DEL_TABLE 28 -#define PFNL_CMD_GET_TSTATS 29 -#define PFNL_CMD_CLR_TSTATS 30 -#define PFNL_CMD_CLR_ADDRS 31 -#define PFNL_CMD_TABLE_ADD_ADDR 32 -#define PFNL_CMD_TABLE_DEL_ADDR 33 -#define PFNL_CMD_TABLE_SET_ADDR 34 -#define PFNL_CMD_TABLE_GET_ADDR 35 -#define PFNL_CMD_TABLE_GET_ASTATS 36 -#define PFNL_CMD_TABLE_CLEAR_ASTATS 37 -#define PFNL_CMD_STATE_LIMITER_ADD 38 -#define PFNL_CMD_STATE_LIMITER_GET 39 -#define PFNL_CMD_STATE_LIMITER_NGET 40 -#define PFNL_CMD_SOURCE_LIMITER_ADD 41 -#define PFNL_CMD_SOURCE_LIMITER_GET 42 -#define PFNL_CMD_SOURCE_LIMITER_NGET 43 -#define PFNL_CMD_SOURCE_GET 44 -#define PFNL_CMD_SOURCE_NGET 45 -#define PFNL_CMD_SOURCE_CLEAR 46 -#define PFNL_CMD_TABLE_TEST_ADDRS 47 - -#define __PFNL_CMD_MAX 48 -#define PFNL_CMD_MAX (__PFNL_CMD_MAX - 1) +enum { + PFNL_CMD_UNSPEC = 0, + PFNL_CMD_GETSTATES = 1, + PFNL_CMD_GETCREATORS = 2, + PFNL_CMD_START = 3, + PFNL_CMD_STOP = 4, + PFNL_CMD_ADDRULE = 5, + PFNL_CMD_GETRULES = 6, + PFNL_CMD_GETRULE = 7, + PFNL_CMD_CLRSTATES = 8, + PFNL_CMD_KILLSTATES = 9, + PFNL_CMD_SET_STATUSIF = 10, + PFNL_CMD_GET_STATUS = 11, + PFNL_CMD_CLEAR_STATUS = 12, + PFNL_CMD_NATLOOK = 13, + PFNL_CMD_SET_DEBUG = 14, + PFNL_CMD_SET_TIMEOUT = 15, + PFNL_CMD_GET_TIMEOUT = 16, + PFNL_CMD_SET_LIMIT = 17, + PFNL_CMD_GET_LIMIT = 18, + PFNL_CMD_BEGIN_ADDRS = 19, + PFNL_CMD_ADD_ADDR = 20, + PFNL_CMD_GET_ADDRS = 21, + PFNL_CMD_GET_ADDR = 22, + PFNL_CMD_GET_RULESETS = 23, + PFNL_CMD_GET_RULESET = 24, + PFNL_CMD_GET_SRCNODES = 25, + PFNL_CMD_CLEAR_TABLES = 26, + PFNL_CMD_ADD_TABLE = 27, + PFNL_CMD_DEL_TABLE = 28, + PFNL_CMD_GET_TSTATS = 29, + PFNL_CMD_CLR_TSTATS = 30, + PFNL_CMD_CLR_ADDRS = 31, + PFNL_CMD_TABLE_ADD_ADDR = 32, + PFNL_CMD_TABLE_DEL_ADDR = 33, + PFNL_CMD_TABLE_SET_ADDR = 34, + PFNL_CMD_TABLE_GET_ADDR = 35, + PFNL_CMD_TABLE_GET_ASTATS = 36, + PFNL_CMD_TABLE_CLEAR_ASTATS = 37, + PFNL_CMD_STATE_LIMITER_ADD = 38, + PFNL_CMD_STATE_LIMITER_GET = 39, + PFNL_CMD_STATE_LIMITER_NGET = 40, + PFNL_CMD_SOURCE_LIMITER_ADD = 41, + PFNL_CMD_SOURCE_LIMITER_GET = 42, + PFNL_CMD_SOURCE_LIMITER_NGET = 43, + PFNL_CMD_SOURCE_GET = 44, + PFNL_CMD_SOURCE_NGET = 45, + PFNL_CMD_SOURCE_CLEAR = 46, + PFNL_CMD_TABLE_TEST_ADDRS = 47, + __PFNL_CMD_MAX, +}; +#define PFNL_CMD_MAX (__PFNL_CMD_MAX -1) enum pfstate_key_type_t { PF_STK_UNSPEC, From nobody Mon Jul 6 20:03:12 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 4gvFf822Zjz6k6Nk for ; Mon, 06 Jul 2026 20:03:12 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvFf81VX8z3qy9 for ; Mon, 06 Jul 2026 20:03:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783368192; 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=JJxpHKVfJSMW99WlJoDKS8DN0DPUBVqNl/oqA5VsfUE=; b=eDpkImfqqAlgsX0rEH2ivKoX9yLL5yZsUbGsO65ljfTHqU1Q1f8kxxQyVjM1ff78asMdSg bvjtUUndQ+XB4+pXDHo0Iy1veuHgs11+FfxvLjdCkun2VzmN+hWJOrrHqCl7hO+ekJyJbc xAin4q7N0mQsPZ8hyFIlnkLKco1OAYDEAXqYho1DmkqY+/GZ6yEXoLSkqwoFPmbuIcMzyv sgd/jZ7Zha4+drsui9P4TfKT2SOjYeSjvlO/l1SGxHHjsk+8esZ2p4bAo9C8lhzDoxpw5o IkqNRH14xmf5nAqhzpazYJFOq/r61WC4wHWUjub7PPHves5LtnqMhLuCMRkrlg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783368192; a=rsa-sha256; cv=none; b=lJsKeohtaKHLZRSsDf/E/7UXAVHdLa83FQR6VvDB8KYqkKvUCWFpK2YGG1cWqqi84x2Z32 nNXejMuyx+sudCU6GGK+kx/giz1U5NzDk3gOgGUR7/ovN4ULaRUiKNCUlOW4LshR5/Pnld tdF4alRBeIbi5q0jSGl4kmMXCiEseQ7sjd/+VTO2TFsrgJd0gpVn/ZgRlW+bnGkLfT86nO RJJlru1RNou/J1KnAt4kk5T4eGDUySpzBpCnDOXmLf59d/GkvsoKLPMnTyB8zqpL+2gGXJ jZGyzzX/c6R4Kz29nAUfb+GJkXCiI7poafa0DlZCOH9UpqEPQzMeLJ+pmp2+Yw== 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=1783368192; 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=JJxpHKVfJSMW99WlJoDKS8DN0DPUBVqNl/oqA5VsfUE=; b=dkZXtsEOlS3BbYu2qEW9vT00vRdJ1cPDPBLAwqaAA53ouCChPyQa/dqT8aNTo7gz3phsOe iBYGuce0fHGUrGNE2l5Vpq+zQoGslzSbExvlSQUBoWvIos4paCCPlPsSCVDbgmlyUzxEPx Rq75fy9W5ggXaUHwwqybqB7wpgQrQ8e2C/njxjPqRkOmSxLPie3psfjlEnCsJ+MJdUFggQ Q4hPi5UvD7l3JD7qQ3NDo9Do7oZr3xrbKDVNUebBYSLn8Iw7XdxZL2y3/F91kc8bMxH8C+ PyDhYHnUHYOlUo33glDNLGUcWPUGw8hmYj+jv7YNsr+R6SppP/zW8s/q/LRNkw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvFf80Dxlz1HfC for ; Mon, 06 Jul 2026 20:03:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 42f12 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 20:03:12 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 5f4c87e6503c - main - git-mfc: Allow merging merge commits 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5f4c87e6503cd0e1644b86201eafdb11e7e53b90 Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 20:03:12 +0000 Message-Id: <6a4c0a00.42f12.300ade21@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=5f4c87e6503cd0e1644b86201eafdb11e7e53b90 commit 5f4c87e6503cd0e1644b86201eafdb11e7e53b90 Author: Dag-Erling Smørgrav AuthorDate: 2026-07-06 19:58:47 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-07-06 20:02:34 +0000 git-mfc: Allow merging merge commits In order to merge merge commits (such as vendor imports), we need to tell git cherry-pick which of the two branches referenced in the commit is the mainline. In our case, it is always the first. Approved by: markj --- tools/tools/git/git-mfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tools/git/git-mfc b/tools/tools/git/git-mfc index 181432fad523..c3ff474add3e 100755 --- a/tools/tools/git/git-mfc +++ b/tools/tools/git/git-mfc @@ -358,7 +358,7 @@ def pending(repo, upstream, author=None, baking=False): def cherry_pick(commit, edit=False): """Cherry-pick a single commit with -x. Abort on failure.""" - cmd = ['git', 'cherry-pick', '-x'] + cmd = ['git', 'cherry-pick', '-x', '-m1'] if edit: cmd.append('-e') cmd.append(commit.hexsha) From nobody Mon Jul 6 21:24:21 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 4gvHRn3tJmz6kF22 for ; Mon, 06 Jul 2026 21:24:21 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvHRn36GRz40xK for ; Mon, 06 Jul 2026 21:24:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783373061; 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=Q/4VzRyGcEVGeF9mt3Wbl11tpP71md3854LEzoDHR1U=; b=QJP1TTpiTMs47FN60dd9Tg7KJ0XgPzGTtrvfFcFjHIK8rsALgWy+dxtT9+peVhMgBec/3E i59cpi7oX13ZtXpj6QiBRE55y5OVtTnqzNWBsrVntmJ92ubF8xNdStmuUN+8jtn7iUMPaI bQHzlp5tpASSQdI4JbF7TPKmICPQBPjyU7SrXaIwtiAI65UbYil/mOkIAzabzvqW0lzohx M6Cwabj00aP6LGMUvUxvEPtTOe0G7bXUVVvgYjLrDuVCQRJHWWbdeXKqYwgZ3nm6bvUflx rMEe4mbyYc7rwSFIHMy+6O3y8ud2Hgk1tv1lvSK/rIi4HK3Px/1j6Il8S8vZLA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783373061; a=rsa-sha256; cv=none; b=BXMCitD4tPSS/5MFxzRHkcyGCPgKxL94EkDfYUDJQxAeYAXhFO7JPcF7XgTVg4MPHTyiqw HpxBOBIu0Nd3H1odrWM16m9vznbnjNHRO9ErF+Dn6WgM2pfNZKM+H2nxuN2xMSPvWtIMvi EeTrs0YRiNGZ5+RJ//hqEH+aIJlIUylBDWYDBz36gjF4GVAlFdyWhF7OSbQtucVJUSMCy4 FispKUTNZekV3n2WM5n34YxkgaTAXnfu6Dkqcs1SzAQ7O5R1CWVAa46HMMeL03wLS4Xb6o KrsuiNDWYwU53mhITYfccqOrQx0dS0UGPaLIERwP/M9q+8QRlpeXg5xDJPBQ4Q== 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=1783373061; 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=Q/4VzRyGcEVGeF9mt3Wbl11tpP71md3854LEzoDHR1U=; b=r+qHpPRO2Ewix+JoHTzK6uiRo/m3nDIW6+IOmPB4Yn6F2mPmIHbSFQdr8+I1HZ5OKjedf0 oIumgTk2XbM1EJ9orPScwZ3I6UNiI1bo56A5LY+grsCS6BAUzAm1I38u286PJUZJKC61y6 tpNy3cCjIidCo9AOkEY5VCDVdtUBUB6AIiUIDYq0v4gOdbgaORx2b+h2S4LUlGreb9zT9R 7ArX9tjbkg/oMik0fj1LBbQ72eLVnnv7AI6hW2X/iF3Mec8seBonJTtKmFBYSE3N1GzP5c KhDA1tDvqoTTEdLZ/tAqqhLevVkEab5xqjjpFqpFCchjdlX+eKGAeD/FQul25Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvHRn1zCNz1Ktb for ; Mon, 06 Jul 2026 21:24:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1a32a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 21:24:21 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: dec79d2b47b3 - main - powerpc/pmap(booke): Fix TLB TID eviction 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: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dec79d2b47b3cb797d45b8bee7a1640dec85ebcc Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 21:24:21 +0000 Message-Id: <6a4c1d05.1a32a.7901b17a@gitrepo.freebsd.org> The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=dec79d2b47b3cb797d45b8bee7a1640dec85ebcc commit dec79d2b47b3cb797d45b8bee7a1640dec85ebcc Author: Justin Hibbits AuthorDate: 2026-07-05 23:03:31 +0000 Commit: Justin Hibbits CommitDate: 2026-07-06 21:23:55 +0000 powerpc/pmap(booke): Fix TLB TID eviction Fix tid_set_busy() for when `pmap` is NULL. Obviously a NULL pointer cannot be correctly used, so I'm not sure how it worked in testing on 64-bit. --- sys/powerpc/booke/pmap.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sys/powerpc/booke/pmap.c b/sys/powerpc/booke/pmap.c index 310d38d5c450..545416921d09 100644 --- a/sys/powerpc/booke/pmap.c +++ b/sys/powerpc/booke/pmap.c @@ -2484,11 +2484,14 @@ mmu_booke_page_array_startup(long pages) static __inline void tid_set_busy(int cpu, int tid, pmap_t pmap) { - tidbusy[cpu * (tid_max + 1) + tid] = pmap; - if (pmap == NULL) - pmap->pm_tid[cpu] = TID_NONE; - else + volatile pmap_t *pm = &tidbusy[cpu * (tid_max + 1) + tid]; + + if (pmap == NULL) { + if (*pm != NULL) + (*pm)->pm_tid[cpu] = TID_NONE; + } else pmap->pm_tid[cpu] = tid; + *pm = pmap; } static __inline pmap_t @@ -2522,7 +2525,7 @@ tid_alloc(pmap_t pmap) /* If we are stealing TID then clear the relevant pmap's field */ if (tid_get_busy(thiscpu, tid) != NULL) { CTR2(KTR_PMAP, "%s: warning: stealing tid %d", __func__, tid); - + tid_set_busy(thiscpu, tid, NULL); /* Flush all entries from TLB0 matching this TID. */ From nobody Mon Jul 6 21:24:22 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 4gvHRp3zQqz6kF8t for ; Mon, 06 Jul 2026 21:24:22 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvHRp3NhDz40lh for ; Mon, 06 Jul 2026 21:24:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783373062; 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=8KhsKipal4NeRVKx/R4wyEHvW3+QafWlOtsZbM8dm4g=; b=PuCYyiAzFDoT+TWuczTVxQeWYs76NRUxk3XYawFHsT5J9ibvEcv/jKSWU4CS9LSN3hyzCH zb5XrDFJGsHSFt4Vcg5K2Yyuo9swJurTo/lQpQ4LGR15/R4Touel7BeGl6iP4M/BjL4LY1 QRfCv85Pj3PUZTiSn4n259r0z/wFAi22WZLM7eoe2Ic0CpSrYYuDXNoF19cVT972LMO0Gi yJGxihRrt31fCKOjuzj+IhXj5v2BhzYW63RNZGXCOhjEGfZjkpuYv4jSGC79JqTUA7kxjX JpeK5vESyuHFShqLJy5eQu8y7o06bu//0RFwChDbsJW0peEhNDmtGSij3LYItQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783373062; a=rsa-sha256; cv=none; b=CqKZhd7Ri4fmaMo9umXBnjj5Rw41JaeXwUVj4e7VYoaI9S4V45HpXEupA/5qBmZea0hSrf 8L82HlsmQx/bzVIFgLyXL0fI2uJdiQ/mhe3YqtjFL9EYkCHlMTRcmbKlc2i7n/cCbyrmqQ y/TXUepvUsKMjmGPra6LiRGkuNOrGGgWp+bXPBHztWmJ8mFR215mKePTNz/Lu6UwRib18b EFZ9XgySiD6DxYVZ7fWZDQrxy7DsYfVZthL3kKfOf8zPiubjzX8EvBn6cK6dWhjmToFOIu A3K8cjQUZcmTrQ4PnueUaXMUB3iTgcI1gYbS78VlIJwENtk158PwzNKEUXGemA== 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=1783373062; 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=8KhsKipal4NeRVKx/R4wyEHvW3+QafWlOtsZbM8dm4g=; b=sTjKPSGLXvDYWvWSYN1jg2hhnL6SOIoH9aBpSg/19PMMqaFspypb6mlZKaUZYyij8iv0C0 IYsjVy1Gt6IZJXmGcimUWO3oz9Lwm2L3/6POAv014RcFnkH8+IKGTX3dEFFY+ECyxn7mAU Y8tC2Qkr29ttYVrZmpxUA/Ymg+BYVEUwoa9XX8W8wSdkX/t/o0amSty7fnqUZ8HLMPIt47 G4z74qeo4nV88efSmgCFUScUZsnwBtavBBKGnW7HcDVfRjLwadAJvlnsHRvguLvkZKkgef xYTHpsvTVxPtFsNXSGU1KE+a8RVjsHlhDxC+gTfklp4n3Pq2qMPWWMfu6bh5rw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvHRp2T8rz1L7J for ; Mon, 06 Jul 2026 21:24:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1c2de by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 21:24:22 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 4dd9e4ed9771 - main - powerpc/booke(pmap): Flash-invalidate TLB on TID rollover 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: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4dd9e4ed9771630388cdf49ba3bcd1a608b05c9c Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 21:24:22 +0000 Message-Id: <6a4c1d06.1c2de.52e0577e@gitrepo.freebsd.org> The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=4dd9e4ed9771630388cdf49ba3bcd1a608b05c9c commit 4dd9e4ed9771630388cdf49ba3bcd1a608b05c9c Author: Justin Hibbits AuthorDate: 2026-07-05 23:05:13 +0000 Commit: Justin Hibbits CommitDate: 2026-07-06 21:23:55 +0000 powerpc/booke(pmap): Flash-invalidate TLB on TID rollover When the TID rolls over on a given CPU, simply flash-invalidate the TLB instead of walking the TLB to only invalidate the repurposed TID. Walking 256 entries is expensive, and we'll likely be inserting a bunch new ones anyway in the new environment, since 256 really only handles 1MB of storage, so the likelihood of other mappings continuing to exist in the TLB when their thread owner is scheduled again is very very small. --- sys/powerpc/booke/pmap_32.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/sys/powerpc/booke/pmap_32.c b/sys/powerpc/booke/pmap_32.c index 7d27d1fe407e..ef946194b649 100644 --- a/sys/powerpc/booke/pmap_32.c +++ b/sys/powerpc/booke/pmap_32.c @@ -939,8 +939,6 @@ static void tid_flush(tlbtid_t tid) { register_t msr; - uint32_t mas0, mas1, mas2; - int entry, way; /* Don't evict kernel translations */ if (tid == TID_KERNEL) @@ -963,26 +961,8 @@ tid_flush(tlbtid_t tid) __asm __volatile("wrtee %0" :: "r"(msr)); return; } + /* Flash invalidate TLB0 instead of walking the TLB to invalidate. */ + mtspr(SPR_MMUCSR0, MMUCSR0_L2TLB0_FI); - for (way = 0; way < TLB0_WAYS; way++) - for (entry = 0; entry < TLB0_ENTRIES_PER_WAY; entry++) { - mas0 = MAS0_TLBSEL(0) | MAS0_ESEL(way); - mtspr(SPR_MAS0, mas0); - - mas2 = entry << MAS2_TLB0_ENTRY_IDX_SHIFT; - mtspr(SPR_MAS2, mas2); - - __asm __volatile("isync; tlbre"); - - mas1 = mfspr(SPR_MAS1); - - if (!(mas1 & MAS1_VALID)) - continue; - if (((mas1 & MAS1_TID_MASK) >> MAS1_TID_SHIFT) != tid) - continue; - mas1 &= ~MAS1_VALID; - mtspr(SPR_MAS1, mas1); - __asm __volatile("isync; tlbwe; isync; msync"); - } __asm __volatile("wrtee %0" :: "r"(msr)); } From nobody Mon Jul 6 21:38:37 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 4gvHmF44Tmz6kFyf for ; Mon, 06 Jul 2026 21:38:37 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvHmF3RBZz42SM for ; Mon, 06 Jul 2026 21:38:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783373917; 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=gU/lGdmTmX9de6er9S53Zt75bF3OWntdlIzZc6NEqV4=; b=JJinlMmCkazIeVTIQYaSczC7Mw2iaY7rgIC6O6Gi6IjvknML8Bpn6GFobyljMc1okcSA4A ZY5XabNNslmDei5+kPx4I7A7hPJSsbkgpVz+qG9v/XS0KLmRYvgKmN4StIKEiWSxXYv8U4 q3ddOECFjphmjtQi1f0rP2hQMrRnrKlNeQr3pITAh9fHIEYt4uuF3zehhKlvKJ2kIK2mTi 8/2HSl+pWeWiTg60hx8pgo3murfcEX9aUR5QjW/IwfTR30kMA7FMWXUbtFml03h3tocGSj d+ObcXrUaNztT2ox9ho24xtdUGgJZf9Djp560Muy+BYaMsQ9TKHLsmNO2etHnw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783373917; a=rsa-sha256; cv=none; b=wVd6OcBg61N8Wy1BMDsG9A2Nil6e8i2t2QIX99/DFi1tKJx5Fhlu/jHphy+h6r/pDzVCT3 mtPUotonJHnMJldQwWrnjiQyCJim2Qk1EogrTggcyzY9ivb5LuLqJQzTJ+ecmjiUaYxc/q Z9X606mjFPoTr60dV0w6FT7YE2WW/3iHwZcjMr4+16ORvMk084HU9VId5rn/2EIEb9z/Do 0IkfJ8uOkeBL0rilzUe+26TpU2pgEDQjXHUBs/DeBe5vxpiILXDZCcghPzd9IVnAR6w5Tw jsGJMn9fJNYB3O8pPrmZfnF+DHoYYUjLwriamKGVPx+ElJMyPiFpfp27bmOAvQ== 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=1783373917; 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=gU/lGdmTmX9de6er9S53Zt75bF3OWntdlIzZc6NEqV4=; b=TV3vGaWobmZhn1JArAIp0Xk+QgckJKroE6oXByBXBJ2HQXPuRjiLSpzLktIaFLYr3ifgS6 NIUyZmp4lnuyWxqtQdMh0Jx4YH08pkO3JrB7yy0ftof1ktvZL0JQLba+TDTU97xWEX9NQL Xa4Q/jaJqTfaUNfbNKhJH67f6DIXZ+8Qjof70Qk9J0fK1V4gZaJFEfzdLKRmdw4NkWgcTI UaIsTy2BBCV/WZhj0fBbBDCz035WTMljtr5JugeXuGVg+Hc6kp8ZsNSWg4EgrfSP/VzaiY AAMjRdcPKHjOtQvjO5o/MuAxRc7YS8+NENxMP7n9bj/YzTTQyJkZ6kgd/9GtZA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvHmF20rDz1LLL for ; Mon, 06 Jul 2026 21:38:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1bfbb by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 06 Jul 2026 21:38:37 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: ee5d87a3e2ca - main - raw ip: fix race of two connect(2) 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ee5d87a3e2ca1c169ca2032fcb12841a499356c9 Auto-Submitted: auto-generated Date: Mon, 06 Jul 2026 21:38:37 +0000 Message-Id: <6a4c205d.1bfbb.2475fabb@gitrepo.freebsd.org> The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=ee5d87a3e2ca1c169ca2032fcb12841a499356c9 commit ee5d87a3e2ca1c169ca2032fcb12841a499356c9 Author: Gleb Smirnoff AuthorDate: 2026-07-06 21:30:41 +0000 Commit: Gleb Smirnoff CommitDate: 2026-07-06 21:30:41 +0000 raw ip: fix race of two connect(2) The historical design of sockets is that on a re-connect the disconnect is performed at the socket layer in soconnectat(). Since SMP times this is known to be racy and the function has appopriate comment. I missed that in the recent change. The pr_connect method should normally expect the socket to be already disconnected, however should be able to handle a race where socket is actually connected. Convert the check that incorrectly tried to handle normal path of re-connect into check that handles the race. Reported by: markj Fixes: ece716c5d34728a170f1dfe1b3389c267d6ddd1e --- sys/netinet/raw_ip.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 851f70cbb0ad..67e798ccad54 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -904,8 +904,7 @@ rip_connect(struct socket *so, struct sockaddr *nam, struct thread *td) KASSERT(inp != NULL, ("rip_connect: inp == NULL")); INP_WLOCK(inp); - if (inp->inp_faddr.s_addr != INADDR_ANY && - addr->sin_addr.s_addr == INADDR_ANY) + if (__predict_false(inp->inp_faddr.s_addr != INADDR_ANY)) rip_dodisconnect(inp, false); if (addr->sin_addr.s_addr != INADDR_ANY) { inp->inp_faddr = addr->sin_addr; From nobody Tue Jul 7 00:11:40 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 4gvM8r6Qdzz6kSnH for ; Tue, 07 Jul 2026 00:11:40 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvM8r5xWwz3Hjr for ; Tue, 07 Jul 2026 00:11:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783383100; 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=b40vPXBb+vZgCkXMwsNqTNIIXE/BqWupaxMtylA/gdk=; b=pHzsKX/i9Ug2bjmYUvIUfZ85B1cbwkkPAqq9Jj9+Gu38O5aVy5N2jixxBz9o8NJ8v+7geL AcUIVtdbxw3AwlXcgQ5uJytzbs1m3JXhNdtzw0wXLJInLMcO1vyEaWwIoyLizm1vI3nkre 9m7sOgaH4mOuwp0eXY7EPx7tw7FL61fgwxgLCpYnqkvPJaZ8lebqNCKD41dV4ZggcSggy3 S6uC/qavcYiBppEoaB7GXg8UtMW9hp9rR7K9pZD2ee93jekhuil8B79+5lRfFQ43czvpgc hISYmKyu6biMhE05OMhVgHBf1+BC0R6iyMC62QMA9l4KpYRZS/qA/0oHQX4fWA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783383100; a=rsa-sha256; cv=none; b=vKc8s/CvnE3ozEect+pbPcGrA5L7RVnE/MEcbt87fo8SRnQOeBSDT5ENLbcFdYlbvIGDOj oS1dcjpu/Az0FtCfzm5ERQ4413of2DtbdM7E3RdxTKI3ssdmPFlpCrSmp+7gjF3L5ABcaI d9W+hdAk4r3mv3pVAzoV8GJV3+/+DGtHzFrmJzYKgZCuH4L0CxaiuuB8/oiZfAi+mc86Zy EfZH0KNCKVjF1pg0Mi+0E2FAuybnCOWzLN1wgMKRM6Jzsbo6HIqOa30f8CDwbqfHvu1WnZ 79jbC0PLvMODAMDYVRVmASDDiMoQAyr7AlYLb4MN9VUk0D/IomXNglumWEFZKw== 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=1783383100; 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=b40vPXBb+vZgCkXMwsNqTNIIXE/BqWupaxMtylA/gdk=; b=YlCVj0Jp+wkPjNgJbNfy9fJWZ8/87QrUdE38e9RjZo/317QVV9ur7/gGBcdmOVDQ7ZDktU IgVSVnxDV6z0rhPi+kSn2Ujo592bYtp9dlnMMApW9gfPpZg0AvsVp6cJrJJ/EK90RPEJHa wlf0//p/vAqpRbOBDnQd5KYQwXUld9Knd3xhEL8zBWKZRhZn5nxncD8AACf7zeWSKJROZ0 MQcraQBqA5vBd8Ol9hKjtuIYc1s6K0uUAT12LLEWVCCU6wFOMhLqkb7PCG0uW5HXcCUXLF 8NYtPDodLf43CY2ruwLZs10Wz8bV4L77mEVOuZTjRAFY7g3/5Eyz70DxVvWkaw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvM8r4pHQz1Phr for ; Tue, 07 Jul 2026 00:11:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 34446 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 00:11:40 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: d516e52373e1 - main - nfsd: Optionally enable use of M_EXTPG mbufs for read replies 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: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d516e52373e1768ea84bf1ca220671a44f413abe Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 00:11:40 +0000 Message-Id: <6a4c443c.34446.24e9c94e@gitrepo.freebsd.org> The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=d516e52373e1768ea84bf1ca220671a44f413abe commit d516e52373e1768ea84bf1ca220671a44f413abe Author: Rick Macklem AuthorDate: 2026-07-07 00:10:11 +0000 Commit: Rick Macklem CommitDate: 2026-07-07 00:10:11 +0000 nfsd: Optionally enable use of M_EXTPG mbufs for read replies A test site determined that, for a Mellanox NIC which can handle M_EXTPG mbufs, an improvement of 5-15% for read rate could be achieved if the read reply was in M_EXTPG mbufs. A patch that tried to determine if the outbound NIC supported M_EXTPG mbufs (IFCAP_MEXTPG) did not pass review. However, it does appear that this can be useful for NFS-over-RDMA. (Which just happen to use NICs that do support M_EXTPG mbufs.) As such, this patch enables them is xp_extpg is set to true, which is never for now, but might be set true for RDMA or when vfs.nfsd.enable_mextpg is set non-zero. (It is 0 by default, so this is never enabled by default at this time.) Tested by: Greg Becker MFC after: 2 weeks --- sys/fs/nfs/nfs.h | 1 + sys/fs/nfsserver/nfs_nfsdkrpc.c | 18 +++++++++++++++++- sys/fs/nfsserver/nfs_nfsdport.c | 16 ++++++++++------ sys/fs/nfsserver/nfs_nfsdserv.c | 7 +++++-- sys/rpc/svc.h | 1 + 5 files changed, 34 insertions(+), 9 deletions(-) diff --git a/sys/fs/nfs/nfs.h b/sys/fs/nfs/nfs.h index 1056595e8cde..4e79d3afbd2f 100644 --- a/sys/fs/nfs/nfs.h +++ b/sys/fs/nfs/nfs.h @@ -746,6 +746,7 @@ struct nfsrv_descript { #define ND_EXTLSCERTUSER 0x20000000000 #define ND_ERELOOKUP 0x40000000000 #define ND_MACHCRED 0x80000000000 +#define ND_CANEXTPG 0x100000000000 /* * ND_GSS should be the "or" of all GSS type authentications. diff --git a/sys/fs/nfsserver/nfs_nfsdkrpc.c b/sys/fs/nfsserver/nfs_nfsdkrpc.c index 8c557143efbd..16c21b4e1607 100644 --- a/sys/fs/nfsserver/nfs_nfsdkrpc.c +++ b/sys/fs/nfsserver/nfs_nfsdkrpc.c @@ -97,6 +97,10 @@ SYSCTL_INT(_vfs_nfsd, OID_AUTO, server_max_nfsvers, CTLFLAG_VNET | CTLFLAG_RWTUN, &VNET_NAME(nfs_maxvers), 0, "The highest version of NFS handled by the server"); +static bool nfsrv_mextpg = false; +SYSCTL_BOOL(_vfs_nfsd, OID_AUTO, enable_mextpg, CTLFLAG_RW, + &nfsrv_mextpg, 0, "Enable use of M_EXTPG mbufs"); + static int nfs_proc(struct nfsrv_descript *, u_int32_t, SVCXPRT *xprt, struct nfsrvcache **); @@ -315,7 +319,19 @@ nfssvc_program(struct svc_req *rqst, SVCXPRT *xprt) if ((xprt->xp_tls & RPCTLS_FLAGS_CERTUSER) != 0) nd.nd_flag |= ND_TLSCERTUSER; } - nd.nd_maxextsiz = 16384; + nd.nd_maxextsiz = MBUF_PEXT_MAX_PGS * PAGE_SIZE; + /* + * If the NIC can handle M_EXTPG mbufs, they can be used + * only if the reply will not be copied into the DRC. + * This implies NFSv3 over TCP and NFSv4.n, but not NFSv4.0. + * (NFSv4.n will set ND_SAVEREPLY if the reply is going + * to be copied into the session slot.) + * Check for TCP transport (UDP uses the DRC) and a direct + * map. + */ + if ((nfsrv_mextpg || xprt->xp_extpg) && nd.nd_nam2 == NULL && + PMAP_HAS_DMAP != 0) + nd.nd_flag |= ND_CANEXTPG; #ifdef MAC mac_cred_associate_nfsd(nd.nd_cred); #endif diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index 543c43295b20..cfc0cea2195e 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -3018,12 +3018,13 @@ again: /* * If cnt > MCLBYTES and the reply will not be saved, use - * ext_pgs mbufs for TLS. + * ext_pgs mbufs for TLS or if enabled via vfs.nfsd.enable_mextpg. * For NFSv4.0, we do not know for sure if the reply will * be saved, so do not use ext_pgs mbufs for NFSv4.0. */ if (cnt > MCLBYTES && siz > MCLBYTES && - (nd->nd_flag & (ND_TLS | ND_EXTPG | ND_SAVEREPLY)) == ND_TLS && + ((nd->nd_flag & (ND_TLS | ND_SAVEREPLY)) == ND_TLS || + (nd->nd_flag & (ND_CANEXTPG | ND_SAVEREPLY)) == ND_CANEXTPG) && (nd->nd_flag & (ND_NFSV4 | ND_NFSV41)) != ND_NFSV4) nd->nd_flag |= ND_EXTPG; @@ -3364,7 +3365,8 @@ ateof: /* * If the reply is likely to exceed MCLBYTES and the reply will - * not be saved, use ext_pgs mbufs for TLS. + * not be saved, use ext_pgs mbufs for TLS or if enabled via + * vfs.nfsd.enable_mextpg. * It is difficult to predict how large each entry will be and * how many entries have been read, so just assume the directory * entries grow by a factor of 4 when attributes are included. @@ -3372,7 +3374,8 @@ ateof: * be saved, so do not use ext_pgs mbufs for NFSv4.0. */ if (cnt > MCLBYTES && siz > MCLBYTES / 4 && - (nd->nd_flag & (ND_TLS | ND_EXTPG | ND_SAVEREPLY)) == ND_TLS && + ((nd->nd_flag & (ND_TLS | ND_SAVEREPLY)) == ND_TLS || + (nd->nd_flag & (ND_CANEXTPG | ND_SAVEREPLY)) == ND_CANEXTPG) && (nd->nd_flag & (ND_NFSV4 | ND_NFSV41)) != ND_NFSV4) nd->nd_flag |= ND_EXTPG; @@ -8213,13 +8216,14 @@ nfsvno_getxattr(struct vnode *vp, char *name, uint32_t maxresp, if (tlen > 0) { /* * If cnt > MCLBYTES and the reply will not be saved, use - * ext_pgs mbufs for TLS. + * ext_pgs mbufs for TLS or enabled via vfs.nfsd.enable_mextpg. * For NFSv4.0, we do not know for sure if the reply will * be saved, so do not use ext_pgs mbufs for NFSv4.0. * Always use ext_pgs mbufs if ND_EXTPG is set. */ if ((flag & ND_EXTPG) != 0 || (tlen > MCLBYTES && - (flag & (ND_TLS | ND_SAVEREPLY)) == ND_TLS && + ((flag & (ND_TLS | ND_SAVEREPLY)) == ND_TLS || + (flag & (ND_CANEXTPG | ND_SAVEREPLY)) == ND_CANEXTPG) && (flag & (ND_NFSV4 | ND_NFSV41)) != ND_NFSV4)) uiop->uio_iovcnt = nfsrv_createiovec_extpgs(tlen, maxextsiz, &m, &m2, &iv); diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index fe7f0e217a74..704667bd27b6 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -1028,13 +1028,16 @@ nfsrvd_read(struct nfsrv_descript *nd, __unused int isdgram, if (cnt > 0) { /* * If cnt > MCLBYTES and the reply will not be saved, use - * ext_pgs mbufs for TLS. + * ext_pgs mbufs for TLS of if enabled via + * vfs.nfsd.enable_mextpg. * For NFSv4.0, we do not know for sure if the reply will * be saved, so do not use ext_pgs mbufs for NFSv4.0. * Always use ext_pgs mbufs if ND_EXTPG is set. */ if ((nd->nd_flag & ND_EXTPG) != 0 || (cnt > MCLBYTES && - (nd->nd_flag & (ND_TLS | ND_SAVEREPLY)) == ND_TLS && + ((nd->nd_flag & (ND_TLS | ND_SAVEREPLY)) == ND_TLS || + (nd->nd_flag & (ND_CANEXTPG | ND_SAVEREPLY)) == + ND_CANEXTPG) && (nd->nd_flag & (ND_NFSV4 | ND_NFSV41)) != ND_NFSV4)) nd->nd_repstat = nfsvno_read(vp, off, cnt, nd->nd_cred, nd->nd_maxextsiz, p, &m3, &m2); diff --git a/sys/rpc/svc.h b/sys/rpc/svc.h index b0fc78d4d044..e73e61e5ac93 100644 --- a/sys/rpc/svc.h +++ b/sys/rpc/svc.h @@ -155,6 +155,7 @@ typedef struct __rpc_svcxprt { uid_t xp_uid; gid_t *xp_gidp; int xp_doneddp; + bool_t xp_extpg; /* Can use M_EXTPG mbufs. */ } SVCXPRT; /* From nobody Tue Jul 7 01:57:10 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 4gvPVZ6hzlz6kccj for ; Tue, 07 Jul 2026 01:57:10 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvPVZ6DPcz3TcD for ; Tue, 07 Jul 2026 01:57:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783389430; 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=yytzXPhRPtQycmCZprcCNQz1pUlVonzI2q8ciGfALQ8=; b=anRzAqH6F9UAX6YBEvTOXP+okVjngz0mxKIi1XZ9p+lO4ZUSvVfU/OcWJHgPHrFKNZfbKS zDvLxm5eMDtjF/BdG4Oo3vVCqiRGkA9Mb7V+Cx9TeqyHn3qXb1v+4/6/UQU0hm6hRYp1Ep dxgR/Enj/LWr0kIxdaG19cOZtaxhpfit8oDe5xDQofDTHL9Al/hYPBa7LAhXOpOjDb8LlB b8vxnVVNwxCrRv2rAhvSfHVD4kF0FIikI1/afxJmDYH4P0BgdZDzznRItDWd8AvhwFYwUc EPAOZjI2tRo4t8UH5LcekXb9iumY+Z/9PIC/D9yrB9IWMrmr5Bw5b/52wt5WdQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783389430; a=rsa-sha256; cv=none; b=O2iiixwGF7W9525OrUZL8eDw6LXJjorXSuci0SzslYz+uxB5PE0qrYVLFhacQkw4wSTxmD ndQRzwFWfshKgxd4a+f+TfXF7po5e02rpxICbo7s0TeF3obrf267NgSDC2S1R14PP0Al5A Jw43D3bYKv1GXEk5SdhBOvy9G4M7jv+aFe4xzEmacSDMjm0WhmhPHtoOLo/QauGx5x2KyH utFhGu0lVkpdjuFnWrMAnlN5wX2LvXcFR9OiBuDiFtdYZn6709C1eA8+XclydMlvNhyllj /P2Ve4XgPwYfVGjVOeIHnb3dLhr0qK2OEpovEhJ0uh14s58sYiHE78GkhZXd5w== 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=1783389430; 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=yytzXPhRPtQycmCZprcCNQz1pUlVonzI2q8ciGfALQ8=; b=q4If79OfhmAMFVfAwDuITbXtbM+BGv352U2CxVofIChPTrFQ+IOJh1TWUOkKNFxh83xNE6 CYCqjTvd3mW8yu73uWQ+5+BvXLLLai3PizFsX6bP+5aLHMdgRuP5QpA++higK3Xi1pYLD/ OXrezMWG73huzEA7MQHkDeMIZ1EsV/1bi8y85j9wmP7OD1tMtOfWt4gLZOWCi16y1VLS6M Tu2/Q5vBoznRaR7rKHlxSJH7i2En+V4VZ6qXeWY4OuNZrN9gMMeGG/rGqRyIV4q+h5RMgN LAMaCk1SyfJmCaIqr2VZnGj1AGwVfjo+4YV9YcKB9c1EmpnS1bKPkLI3ma33Yw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvPVZ5286z9w for ; Tue, 07 Jul 2026 01:57:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3eaf9 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 01:57:10 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: aa1694e23401 - main - procdesc_exit(): assert that _exit() was called 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aa1694e23401762c661da11bbf9016a368d37fbe Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 01:57:10 +0000 Message-Id: <6a4c5cf6.3eaf9.221eac22@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=aa1694e23401762c661da11bbf9016a368d37fbe commit aa1694e23401762c661da11bbf9016a368d37fbe Author: Konstantin Belousov AuthorDate: 2026-05-21 17:37:47 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 01:21:49 +0000 procdesc_exit(): assert that _exit() was called Check that the P_WEXIT flag is set. Requested by: markj Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57124 --- sys/kern/sys_procdesc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/kern/sys_procdesc.c b/sys/kern/sys_procdesc.c index 9360ec147f8a..377132af13c3 100644 --- a/sys/kern/sys_procdesc.c +++ b/sys/kern/sys_procdesc.c @@ -294,6 +294,7 @@ procdesc_exit(struct proc *p) sx_assert(&proctree_lock, SA_XLOCKED); PROC_LOCK_ASSERT(p, MA_OWNED); KASSERT(p->p_procdesc != NULL, ("procdesc_exit: p_procdesc NULL")); + MPASS((p->p_flag & P_WEXIT) != 0); pd = p->p_procdesc; From nobody Tue Jul 7 01:57:11 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 4gvPVc07Lvz6kd3p for ; Tue, 07 Jul 2026 01:57:12 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvPVb6YNJz3V0w for ; Tue, 07 Jul 2026 01:57:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783389431; 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=HBchdM2qa//M4LfUlpNMebCGVV+Ma6Dt9PhEEUluRTQ=; b=YroA+A1q9eP5onryaxMoaBcu1cm07JxEjE4HiWjkPGWmb5i0ucVEckikMXUuPvIq9u5g5x OJG5RjoNFjhOijWye+eWCKigSVQHrEG8vASpZCIXHoPeGIaoEtXgCHN+iwJphlfFDm2QOR SO4DiK7jdCyfrGQzWdnxjX3fO5LgwGQAgSLnq4V0hqY2kiR/uZuMzKsHG9rhaUJCqth07c nKKJnhhHlowsObzs/90BIozH40Wl4ivTdafJpZ6xJOWgJQoP9JkBG+tNxtGTRAelIhJyD/ M0NEbpNTD71zJrUEf0ciEBtGJFgPm3QRZtW357RQUHJ0QfL+4aaswO5qOn2vIw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783389431; a=rsa-sha256; cv=none; b=pRYbRsxnJkkLqjBA6xdOl1rNVWBMAgbbF6skLqu0GUGbYo6OQnSU6YA9/7MqtCOUoQMNO7 txZSTl7MpmnAXv4IfqzvDp25/l0JOPEDl04NNHhTaW16bvXmCeYduRhXWFqrbtlMqffCBV vZru5JmCeOCx0Y9hEfiUQ/1QfKpIjgES8M6KoFQG2omjBQ9FVIKF7HFlgQvkD2PCYRElpj IgEDIcM3uBGXgW+Mhhi/+S6xVj9FzFfSqrpInVL6Nt3x7wrkIRUQzK7PGz7wGF5OWwcrYj s79FYqVeyvsJ/2q3+oa1uP+zJDThvhmGWU893LZ66tJrxCgVY+tQ54I8FXwEPQ== 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=1783389431; 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=HBchdM2qa//M4LfUlpNMebCGVV+Ma6Dt9PhEEUluRTQ=; b=Q/aLhs1ReEopBcjHLDK2siZTEBv24VXJN2nd9sPuJvQXt1dYz+/zWb5wUz1NYePBM0LwG5 vbWfwnneEDzXEWx9ADOG2jG/3JO5rClVb5GZ9aY8pzpM7ZEx1IQfGJJ6TbdJvdoIMzwRID NEzyCu8vIJUAEXXHhldJw6CL+Z1Nu3O4MyjQCfmkewd7+eRm6oduJwSVcqC8mB6NIIbaj1 MFOI1bWL+47A1fvI9FYQzigppG3xIa4+xIT5SPKyOS5PRDRMw9iar7xQaY4Te2nhqsQTqG y8ezbQnMfPNlzeE96UlNZVWpYEnIHG8CWypDM1GVvrdJMs6laOOc1SH0dgk/rA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvPVb5Tckz1S2H for ; Tue, 07 Jul 2026 01:57:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3f64e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 01:57:11 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 599d021224f2 - main - sys_procdesc: extract procdesc_alloc() 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 599d021224f2af3fc0befdbd6b804a328dd556f9 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 01:57:11 +0000 Message-Id: <6a4c5cf7.3f64e.68e9e4e4@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=599d021224f2af3fc0befdbd6b804a328dd556f9 commit 599d021224f2af3fc0befdbd6b804a328dd556f9 Author: Konstantin Belousov AuthorDate: 2026-05-20 02:02:54 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 01:22:20 +0000 sys_procdesc: extract procdesc_alloc() Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57124 --- sys/kern/sys_procdesc.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/sys/kern/sys_procdesc.c b/sys/kern/sys_procdesc.c index 377132af13c3..e6d8ac403dfb 100644 --- a/sys/kern/sys_procdesc.c +++ b/sys/kern/sys_procdesc.c @@ -201,23 +201,15 @@ sys_pdgetpid(struct thread *td, struct pdgetpid_args *uap) return (error); } -/* - * When a new process is forked by pdfork(), a file descriptor is allocated - * by the fork code first, then the process is forked, and then we get a - * chance to set up the process descriptor. Failure is not permitted at this - * point, so procdesc_new() must succeed. - */ -void -procdesc_new(struct proc *p, int flags) +static struct procdesc * +procdesc_alloc(int flags) { struct procdesc *pd; pd = malloc(sizeof(*pd), M_PROCDESC, M_WAITOK | M_ZERO); - pd->pd_proc = p; - pd->pd_pid = p->p_pid; - p->p_procdesc = pd; pd->pd_flags = 0; - if (flags & PD_DAEMON) + pd->pd_pid = -1; + if ((flags & PD_DAEMON) != 0) pd->pd_flags |= PDF_DAEMON; PROCDESC_LOCK_INIT(pd); knlist_init_mtx(&pd->pd_selinfo.si_note, &pd->pd_lock); @@ -227,6 +219,26 @@ procdesc_new(struct proc *p, int flags) * struct file, and the other from their struct proc. */ refcount_init(&pd->pd_refcount, 2); + + return (pd); +} + +/* + * When a new process is forked by pdfork(), a file descriptor is allocated + * by the fork code first, then the process is forked, and then we get a + * chance to set up the process descriptor. Failure is not permitted at this + * point, so procdesc_new() must succeed. + */ +void +procdesc_new(struct proc *p, int flags) +{ + struct procdesc *pd; + + pd = procdesc_alloc(flags); + pd->pd_proc = p; + pd->pd_pid = p->p_pid; + MPASS(p->p_procdesc == NULL); + p->p_procdesc = pd; } /* From nobody Tue Jul 7 01:57:12 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 4gvPVd4pvvz6kcjK for ; Tue, 07 Jul 2026 01:57:13 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvPVd07dfz3V6l for ; Tue, 07 Jul 2026 01:57:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783389433; 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=WRINDv9oBecmK5OeaTLmZWast2kYTpjlsFAmM5wEOjA=; b=oNX8gGbwbbEpC+eU981iTG9P95/nN8/AXRR7Lqv2+Y1kkjat6I7RR9yeqpkbd8LhtYohWs aCtorNVYS4/W439D0B/cQcRe/lRJY9UV5O6nGM6wUaYIwa7q4qWc0Uvvehs2aYnFYI7/pQ 7Soqq2XyjvlpA90spl2SmKABeZV2ZUgqovOoFhx57pdJC0C50uu5tIPxq3k3KlM26yjjW+ cDj6uoYW0JNMPMEMlbndn3Ub5SK8Lnmu5y5SKzGQDgwqNipMyHxO+dgSG9n74m8onHgVxd p6Ryo3A0zIvfSvj+ojHvNZv1HN49b/bhJPpHnyDhIkbAkMm9JMR10HsFKSJeWA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783389433; a=rsa-sha256; cv=none; b=ykYYilv17+W9qtTpEGJ0v1dHN1HAF7K++uhDN4xqsNZV1yi2s6Rh4e9j2eYBEmrqrFqRAw ETPPwYP4md3JB2urwiImDxQH/dj9osFshnC0G84nUgEz1phXRYwd4iklj6+leYLaLDI9nC p9vGc3BmndmqBRjOB4Ye8F7Sr5SdHaelT+tsHVGZoTADbIHqZ/kOeSTSW2XdLuWPzvY98S +y+TQnVgzssH3s1joK1JJNXlPTJAlKIagF502iHQVle8f0I/MZebn5fvfPKuTBt6ygGu4i talg+oz/naXyTXFmlQhsDiJyod1T3X0isAdE0zqfskw3ApNqm8EeCvqNChEQJg== 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=1783389433; 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=WRINDv9oBecmK5OeaTLmZWast2kYTpjlsFAmM5wEOjA=; b=k4gkz4NXIEm05Jihp8Dt3KXmR3P3fyNm6JhwqmtfQVyQ93BCHuUWCyOVbj7LcZabZzTV9T VE6BGLenrwb20cj+cNRkjCqdwqVv2UwPj9B4JjR5N2RulZuHHpOY9BFFaBTukyNHZc99UB tBlUmZX+yKiK/9JfQlcR17FqcdGrQX3pKZe3cVyx8ZS0zvA8gYREnxkc/SNFe0y4cSFMs8 wX/yANm8CN7o9GXfbDsN9t1QpAq14Hrdaj+0AyKqsZ+5141jDkWu0Al9mJY7DqGAY/6iI8 j8OVUFEvNNTMfzQDlQ2GDki8Y/nKo6Zl8OSAOLm8i6aYxDL7OI2k3QDWR34xAA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvPVc6Gy0z9x for ; Tue, 07 Jul 2026 01:57:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 40a09 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 01:57:12 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 974770199877 - main - sys_procdesc: extract pdtofdflags() 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 974770199877ae7aa912b6dced909429c52dea93 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 01:57:12 +0000 Message-Id: <6a4c5cf8.40a09.790e6627@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=974770199877ae7aa912b6dced909429c52dea93 commit 974770199877ae7aa912b6dced909429c52dea93 Author: Konstantin Belousov AuthorDate: 2026-05-20 02:03:32 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 01:23:25 +0000 sys_procdesc: extract pdtofdflags() Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57124 --- sys/kern/sys_procdesc.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/sys/kern/sys_procdesc.c b/sys/kern/sys_procdesc.c index e6d8ac403dfb..69f327e3604e 100644 --- a/sys/kern/sys_procdesc.c +++ b/sys/kern/sys_procdesc.c @@ -241,6 +241,17 @@ procdesc_new(struct proc *p, int flags) p->p_procdesc = pd; } +static int +pdtofdflags(int flags) +{ + int fflags; + + fflags = 0; + if (flags & PD_CLOEXEC) + fflags |= O_CLOEXEC; + return (fflags); +} + /* * Create a new process decriptor for the process that refers to it. */ @@ -248,13 +259,7 @@ int procdesc_falloc(struct thread *td, struct file **resultfp, int *resultfd, int flags, struct filecaps *fcaps) { - int fflags; - - fflags = 0; - if (flags & PD_CLOEXEC) - fflags = O_CLOEXEC; - - return (falloc_caps(td, resultfp, resultfd, fflags, fcaps)); + return (falloc_caps(td, resultfp, resultfd, pdtofdflags(flags), fcaps)); } /* From nobody Tue Jul 7 01:57:13 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 4gvPVf5SR1z6kccn for ; Tue, 07 Jul 2026 01:57:14 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvPVf1tBRz3V5g for ; Tue, 07 Jul 2026 01:57:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783389434; 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=re3xRNtX6v8bpFoXLI0Z9ip3N31Kq0K2Y6JIGijhdx8=; b=VLlW44otwRouljSkG1nSyMthfIK/m19JgCC4EveXzIQJDqlu3u55Po0k3nCZcLluhDf6F4 rxlJ+DaP17cneUm08mIPns9VxBjIsSTQ9rkPJSeuSf0M27AD5SltHF4GLuJAYpgD87mX1K IcybsUhhA4uoxHgRsU+onaHx5yfqI40ASm77vXS4HMetfdk84WgIkEMNZ+fxF2iNsxOt7R J5GFbKoakcsJYyUXaNnCGkqo9S2ftx0cxEFZv2q69sRfgL34smIQgT3iksvxDOtFbFZWOS fzEl8GgovFPROnuEJoEIJOompvnzktmHBxHdNbn3LQ0Yem59vEpuaGxrA9bllw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783389434; a=rsa-sha256; cv=none; b=YtaJrbSElzXtQDq+I/q2vtTl4KXgVPYPQiuyT2VlfpoulhqEixXmtJgbYCjMVLNb33dF9a 3HOf06FtZOQRXPIK9KAZizebtIMZ3Cq/T3VlHu8jJexYWfWgT9crHw7yfxIf2VDw8+5Ixu Mq4cUa4yB7yWJRQBSDMOJqk84KvhXYt1TF3WdLUv0f47X4pB5MGi9sJ6prBDADw2C2e2o/ jqodIy9nq3u8a++tgppf2JYPdAmY422w9F3qtGuY8yiWuyYclfLoqXa2vbxPsd/n2k8DYn ldbYreaLmE8hORfAQzPGki9TPIZSHgRW0h3NUNBIIBvPpUNJYdvoHgmGhK51bw== 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=1783389434; 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=re3xRNtX6v8bpFoXLI0Z9ip3N31Kq0K2Y6JIGijhdx8=; b=wBdddOVTyKThB3rBUEeze37GSplINwH9rQOoJpyUvfau5gaelHjq99vphPTVoTiHd6l+TS gndc/xPm72VXQOjTx60DJ/++8iKWgTfzw3i4agbypYbuNXwPD522VkvjIDsvHIhjRNVKKG GC2TkL24gncLtOsxP7dHVvQGsv9OocbN6bFUuy9MHAMD90YSUg6tKynHaSTivhe3KMBw8a GyU877auHeyF5490F+En5u020+pP1K71hPZ6VKa/GeryAYvpJmSRA5DC7fJjlBHnufESpg J4qzbbM850PsJyIjX/LgSI8T2Qa0YxmS0yd0LGlVAIhY5FFIU0LDVShQwP4rjQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvPVf002nzRC for ; Tue, 07 Jul 2026 01:57:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 40a0d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 01:57:13 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 90b560f7bae6 - main - sys_procdesc: extract procdesc_destroy() 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 90b560f7bae649f9770e787d9e268401a1319493 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 01:57:13 +0000 Message-Id: <6a4c5cf9.40a0d.b496969@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=90b560f7bae649f9770e787d9e268401a1319493 commit 90b560f7bae649f9770e787d9e268401a1319493 Author: Konstantin Belousov AuthorDate: 2026-06-05 01:42:44 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 01:23:48 +0000 sys_procdesc: extract procdesc_destroy() Reviewed byL markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57124 --- sys/kern/sys_procdesc.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/kern/sys_procdesc.c b/sys/kern/sys_procdesc.c index 69f327e3604e..e6174ea3cbb9 100644 --- a/sys/kern/sys_procdesc.c +++ b/sys/kern/sys_procdesc.c @@ -272,6 +272,14 @@ procdesc_finit(struct procdesc *pdp, struct file *fp) finit(fp, FREAD | FWRITE, DTYPE_PROCDESC, pdp, &procdesc_ops); } +static void +procdesc_destroy(struct procdesc *pd) +{ + knlist_destroy(&pd->pd_selinfo.si_note); + PROCDESC_LOCK_DESTROY(pd); + free(pd, M_PROCDESC); +} + static void procdesc_free(struct procdesc *pd) { @@ -292,9 +300,7 @@ procdesc_free(struct procdesc *pd) proc_id_clear(PROC_ID_PID, pd->pd_pid); seldrain(&pd->pd_selinfo); - knlist_destroy(&pd->pd_selinfo.si_note); - PROCDESC_LOCK_DESTROY(pd); - free(pd, M_PROCDESC); + procdesc_destroy(pd); } } From nobody Tue Jul 7 01:57:16 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 4gvPVh4f8mz6kd5m for ; Tue, 07 Jul 2026 01:57:16 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvPVh2Scqz3V64 for ; Tue, 07 Jul 2026 01:57:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783389436; 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=O+8ALE8r7IO9rf2zXPBfpkgSkka+/WrcPqw9bCC9dCk=; b=Vznp+5o8eyYMZlt5zqimuOb4zxW2PPoiItv577hwyW3qUbx7F/ftW7qeRU0t+I2aiSJAO2 R9OIkYR1QyBUAauxyn/moW87fdmN7IG4nAfxLdsYx3zEbfyHbuZ2p54PDhqWaY0giHaVhf 3oLXF5PDSqaxTn2LO/EV4dmP6/5Ulh2K8X8VVtSIVaSA7V41J6ISkMaQlk359UnhQGKNIn VNabLGZgvPBmPWibADdSV+KfK0P3VDi5PYBNFxMVtLvmhsRj94wl+eD0Cc9zGEDaG5G9su sI8CuTE9uAuo5cy1EPGTJScesJj5khrnN4Y43IQRHg7O+VnPSULi6WaN/m/fMg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783389436; a=rsa-sha256; cv=none; b=L/cF85JN75gSif4KxV8FZQTeQS7ak2r/fSXfwZo3XeyRZ/I4PxLOb0rnN8bMP93YEOveSt Wgd8hwWVvIP4Za3T2G0jctDgT1wKeGLsxBXINtEZVHaRDh3fhi4FbcuotxaVaCYu0K3Htx KoWH3MU+i+I+nFaSBCZdQ4re02mA10oO8SATB+7bgKH0sNG5JJ/LpIz3/zLFPUcmmLogoJ huxnTwJUf9otIuq8HsXl0Q0YOgdJ11hJ2A4qiDGbt2dYLPmLIxNQjirpIPEMDXUwkOeGkJ DlO2iloAcJhcYDITnZTdBVZOVxoM5uBZpCrnROVDdnb9nqKYvcen3sxCfnhPag== 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=1783389436; 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=O+8ALE8r7IO9rf2zXPBfpkgSkka+/WrcPqw9bCC9dCk=; b=IVSLnuAXlwuVSQYPnVJYTvTNhjETTr4Bzi+BBdTEIXM3eqc0Y4EazEy4LW4lgUF1pYzbU0 Xk/uFAfjwQr/3txxtKdLKw0TS2dTuyebwZrFjpo7oBQlYs3dliwb/+P4+kI4qOrh3TMeLv RTpcQFzJA8QHrXzuZ3ZjeZ3kXgdomeW53CSxEUFWpjWHdPKfbXopTchoFvnMfv8YbGRowp iRtoO3HceyWi63YQQg3bXZIx9S1G4UxgetWcKW7jUnRajJQJPWUy9jkYWDp2grA5BxFXXw MywEuRAHNTARezIMlj+xLaoqwewj6NamznSZ1qpBva2gQv0okT5uFtclS/sN/g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvPVh1TY0zFM for ; Tue, 07 Jul 2026 01:57:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3f652 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 01:57:16 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: c0e1201aaba8 - main - procdesc: make PD_DAEMON per-file 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c0e1201aaba8860bdcfd754e35024a85ceb1580a Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 01:57:16 +0000 Message-Id: <6a4c5cfc.3f652.2e2ec0be@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c0e1201aaba8860bdcfd754e35024a85ceb1580a commit c0e1201aaba8860bdcfd754e35024a85ceb1580a Author: Konstantin Belousov AuthorDate: 2026-05-25 17:48:03 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 01:24:28 +0000 procdesc: make PD_DAEMON per-file Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57124 --- sys/kern/sys_procdesc.c | 26 +++++++++++++++++--------- sys/sys/file.h | 1 + sys/sys/procdesc.h | 7 ++++++- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/sys/kern/sys_procdesc.c b/sys/kern/sys_procdesc.c index c5be98f66749..0d57a8cc7b2c 100644 --- a/sys/kern/sys_procdesc.c +++ b/sys/kern/sys_procdesc.c @@ -209,8 +209,6 @@ procdesc_alloc(int flags) pd = malloc(sizeof(*pd), M_PROCDESC, M_WAITOK | M_ZERO); pd->pd_flags = 0; pd->pd_pid = -1; - if ((flags & PD_DAEMON) != 0) - pd->pd_flags |= PDF_DAEMON; PROCDESC_LOCK_INIT(pd); knlist_init_mtx(&pd->pd_selinfo.si_note, &pd->pd_lock); @@ -260,7 +258,12 @@ int procdesc_falloc(struct thread *td, struct file **resultfp, int *resultfd, int flags, struct filecaps *fcaps) { - return (falloc_caps(td, resultfp, resultfd, pdtofdflags(flags), fcaps)); + int error; + + error = falloc_caps(td, resultfp, resultfd, pdtofdflags(flags), fcaps); + if (error == 0 && (flags & PD_DAEMON) != 0) + (*resultfp)->f_pdflags |= F_PD_NOKILL; + return (error); } /* @@ -369,6 +372,15 @@ procdesc_reap(struct proc *p) procdesc_free(pd); } +static void +procdesc_close_tail(struct file *fp, struct proc *p) +{ + if ((fp->f_pdflags & F_PD_NOKILL) == 0) + kern_psignal(p, SIGKILL); + PROC_UNLOCK(p); + sx_xunlock(&proctree_lock); +} + /* * procdesc_close() - last close on a process descriptor. If the process is * still running, terminate with SIGKILL (unless PDF_DAEMON is set) and let @@ -436,13 +448,9 @@ procdesc_close(struct file *fp, struct thread *td) p->p_oppid = p->p_reaper->p_pid; proc_add_orphan(p, p->p_reaper); } - if ((pd->pd_flags & PDF_DAEMON) == 0) - kern_psignal(p, SIGKILL); - PROC_UNLOCK(p); - sx_xunlock(&proctree_lock); + procdesc_close_tail(fp, p); } else { - PROC_UNLOCK(p); - sx_xunlock(&proctree_lock); + procdesc_close_tail(fp, p); } } diff --git a/sys/sys/file.h b/sys/sys/file.h index f5d0778453d1..a5125d0559b1 100644 --- a/sys/sys/file.h +++ b/sys/sys/file.h @@ -213,6 +213,7 @@ struct file { union { int16_t f_seqcount[2]; /* (a) Count of seq. reads and writes. */ int f_pipegen; + int f_pdflags; /* Per-file flags for procdesc. */ }; off_t f_nextoff[2]; /* next expected read/write offset. */ union { diff --git a/sys/sys/procdesc.h b/sys/sys/procdesc.h index 08b563828b95..5fbd43f1ac84 100644 --- a/sys/sys/procdesc.h +++ b/sys/sys/procdesc.h @@ -89,7 +89,12 @@ struct procdesc { * Flags for the pd_flags field. */ #define PDF_EXITED 0x00000004 /* Process exited. */ -#define PDF_DAEMON 0x00000008 /* Don't exit when procdesc closes. */ + +/* + * Flags for file f_pdflags. + */ +#define F_PD_NOKILL 0x00000001 /* Opened with PD_DAEMON. Don't send + SIGKILL when file closes. */ /* * In-kernel interfaces to process descriptors. From nobody Tue Jul 7 01:57:15 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 4gvPVh2dHcz6kd3q for ; Tue, 07 Jul 2026 01:57:16 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvPVg3DPBz3V3M for ; Tue, 07 Jul 2026 01:57:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783389435; 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=Q7QF4tUYRtP7VDQMRjfXbUnDv3CgDDSHzq2wAKOEE5w=; b=jhe3fTncSkSGBVbITlG/MpOgYFrVEqVViXGzqp/rb1WAWvZXddHg3isw9MNx+77jSOFxkk E6XAuoRMoI4CaTR86dh8hDqAWntZQ/uisC9FgRAMNNqfiQXEDfpxxHyxzAwY6bXrq/Ctxc 1PRnOZ7fvkUL32X/x5besk3fQ2/KHe9z6KWGMmOqOs1h6/6Wr+gmdsOXSLJANb8ZlcGc81 mSKiKq5X5E6xRpaR6fATi2FstEBhS67C13jqwNaR9eoeHARtXVbEOEKlEPqCDCi7zNqT7u UosIJZg2EpHC1/gffoGZmmpSFh6G2dDtxdmHYhY1h102Br/KjdSYa4eeDSvgGg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783389435; a=rsa-sha256; cv=none; b=mSnKU+V1uyAe3wL2EMdnHyHvdxanTfj76Nl8wVJlUL6UjqZww1PXjyFYMswXwxJLVXPFbq ASQKpK5xY7zFd9RWrIbqxzauKfKDzJMUI6rGYpolov3kOtjRJuC2teEHEuTQ7zcUUVhFOp 0IeBlVZ74/3SSRsJ3leDqO6dgC+H3K1L0E/BlOzv8YlrIIu++mxL1A7PDL3AgGwQ5hN9UE iZPXA3PyZhAc2FK391mKynsm2W+h221+DSgzzp/ZviqTVw2kqwIHyyNn6DfHd+NaZ1KiwF 117qJbYJLBpGtvx59YQLrt+Schlt3R1Csvd+H+GT6AJe/utoduaoWg62WOmlFg== 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=1783389435; 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=Q7QF4tUYRtP7VDQMRjfXbUnDv3CgDDSHzq2wAKOEE5w=; b=GOpJbps77Il62INMq3saD9Dm233pTH6gFxk2NBvTkHCBiPKBXjRrL4p5zwvY408eX2Wqnv R19q/Q1erSe5DyzwYwcRfuHlMoA/KFTuAezwfhPeH8G85KQbyMAvoGm763+lzNVaVcOCRN U3jWAG8UReFRIuXImWXTaka0PfD+i5T/dTo4AdnNXl3bPrVy8gGqdcMEoWIx2kRAhIZT4b muVSczq2y9kGfj50+m/KugLgWDmReq6um6jJ1rTCWdBwhVMeU14lQLMKWZtjldG+bvme6w NRo3j2pTHHlAPW0GkRFO91AdD4bwVy4LkfgEMKHRBGEqSPrWlBwFoqlisAC2rw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvPVg0kPDz1S2J for ; Tue, 07 Jul 2026 01:57:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3f331 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 01:57:15 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 18b6bb5231bf - main - procdesc: track count of open files 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 18b6bb5231bf1c927a6f8de24e466764fe1f7470 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 01:57:15 +0000 Message-Id: <6a4c5cfb.3f331.f82b5b2@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=18b6bb5231bf1c927a6f8de24e466764fe1f7470 commit 18b6bb5231bf1c927a6f8de24e466764fe1f7470 Author: Konstantin Belousov AuthorDate: 2026-05-21 00:47:20 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 01:24:02 +0000 procdesc: track count of open files Introduce pd_fpcount that counts the number of file references to the procdesc. Remove the PDF_CLOSED flag, now it is expressed as pd_fpcount == 0. Only send SIGKILL and clear pointers when we are closing the last file referencing procdesc. This should be nop until the next commit. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57124 --- sys/kern/kern_exit.c | 4 ++-- sys/kern/sys_procdesc.c | 17 +++++++++++------ sys/sys/procdesc.h | 4 +++- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 8f9007752b3b..db8882d70041 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1573,8 +1573,8 @@ kern_pdwait(struct thread *td, int fd, int *status, for (;;) { /* We own a reference on the procdesc file. */ - KASSERT((pd->pd_flags & PDF_CLOSED) == 0, - ("PDF_CLOSED proc %p procdesc %p pd flags %#x", + KASSERT(pd->pd_fpcount > 0, + ("closed proc %p procdesc %p pd flags %#x", p, pd, pd->pd_flags)); sx_xlock(&proctree_lock); diff --git a/sys/kern/sys_procdesc.c b/sys/kern/sys_procdesc.c index e6174ea3cbb9..c5be98f66749 100644 --- a/sys/kern/sys_procdesc.c +++ b/sys/kern/sys_procdesc.c @@ -219,6 +219,7 @@ procdesc_alloc(int flags) * struct file, and the other from their struct proc. */ refcount_init(&pd->pd_refcount, 2); + pd->pd_fpcount = 1; return (pd); } @@ -293,8 +294,8 @@ procdesc_free(struct procdesc *pd) if (refcount_release(&pd->pd_refcount)) { KASSERT(pd->pd_proc == NULL, ("procdesc_free: pd_proc != NULL")); - KASSERT((pd->pd_flags & PDF_CLOSED), - ("procdesc_free: !PDF_CLOSED")); + KASSERT(pd->pd_fpcount == 0, + ("procdesc_free: not closed %p %d", pd, pd->pd_fpcount)); if (pd->pd_pid != -1) proc_id_clear(PROC_ID_PID, pd->pd_pid); @@ -322,7 +323,7 @@ procdesc_exit(struct proc *p) pd = p->p_procdesc; PROCDESC_LOCK(pd); - KASSERT((pd->pd_flags & PDF_CLOSED) == 0 || p->p_pptr == p->p_reaper, + KASSERT(pd->pd_fpcount > 0 || p->p_pptr == p->p_reaper, ("procdesc_exit: closed && parent not reaper")); pd->pd_flags |= PDF_EXITED; @@ -334,7 +335,7 @@ procdesc_exit(struct proc *p) * Clean up the procdesc now rather than letting it happen during * that reap. */ - if (pd->pd_flags & PDF_CLOSED) { + if (pd->pd_fpcount == 0) { PROCDESC_UNLOCK(pd); pd->pd_proc = NULL; p->p_procdesc = NULL; @@ -388,7 +389,8 @@ procdesc_close(struct file *fp, struct thread *td) sx_xlock(&proctree_lock); PROCDESC_LOCK(pd); - pd->pd_flags |= PDF_CLOSED; + MPASS(pd->pd_fpcount > 0); + pd->pd_fpcount--; PROCDESC_UNLOCK(pd); p = pd->pd_proc; if (p == NULL) { @@ -408,7 +410,7 @@ procdesc_close(struct file *fp, struct thread *td) * calls back into procdesc_reap(). */ proc_reap(curthread, p, NULL, 0); - } else { + } else if (pd->pd_fpcount == 0) /* last procdesc */ { /* * If the process is not yet dead, we need to kill it, * but we can't wait around synchronously for it to go @@ -438,6 +440,9 @@ procdesc_close(struct file *fp, struct thread *td) kern_psignal(p, SIGKILL); PROC_UNLOCK(p); sx_xunlock(&proctree_lock); + } else { + PROC_UNLOCK(p); + sx_xunlock(&proctree_lock); } } diff --git a/sys/sys/procdesc.h b/sys/sys/procdesc.h index a6be5dbe576c..08b563828b95 100644 --- a/sys/sys/procdesc.h +++ b/sys/sys/procdesc.h @@ -51,6 +51,8 @@ * (r) - Atomic reference count. * (s) - Protected by selinfo. * (t) - Protected by the proctree_lock + * (p|t) - Both procree_lock and process descriptor must be locked + * for pd_fpcount */ struct proc; struct sigio; @@ -63,6 +65,7 @@ struct procdesc { struct proc *pd_proc; /* (t) Process. */ pid_t pd_pid; /* (c) Cached pid. */ u_int pd_refcount; /* (r) Reference count. */ + u_int pd_fpcount; /* (p|t) files referencing me */ /* * In-flight data and notification of events. @@ -85,7 +88,6 @@ struct procdesc { /* * Flags for the pd_flags field. */ -#define PDF_CLOSED 0x00000001 /* Descriptor has closed. */ #define PDF_EXITED 0x00000004 /* Process exited. */ #define PDF_DAEMON 0x00000008 /* Don't exit when procdesc closes. */ From nobody Tue Jul 7 01:57:17 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 4gvPVj5JYMz6kd5n for ; Tue, 07 Jul 2026 01:57:17 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvPVj3BT1z3V9x for ; Tue, 07 Jul 2026 01:57:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783389437; 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=kCsb84sCSNzhKxKPxLiFmKTA/xzBqTF3G6s8sTXxUfc=; b=f0BvjZdwO9bW+bc8PLKtRQG06zuw+BPswUZ79PfqkGpNJZ+Ndn8MdtvbK41C2zxtuuz7bs ssk+fM4wp1T1yZwdZ18hz5V9phA7ErekE6XJ1uaF+rzk/PgRuc3bR/m3nh2cJBO97zCmBb 7aFmJRuyF3HCBHVr+aurPi/1TK9IBOwucX5KwHgzOdFGbf1A4ZaqR34oeSHjkFkgH5S6Fl pKUajBEquN6ECHmeWoghobgkQtYY1P42+6fTNz2ISIiqlrrr9R2Il0sEvH+Uw27sgKnTLs 2WX429WN92oBlyUAqXXiHgeE0+dqGnitfyAA+uhiyROaencp/efd5OOWbWebhA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783389437; a=rsa-sha256; cv=none; b=u+TY9nTF7A/C+Tu2mj4I7mHVrEdt5VDDWAiFRnel82K/zJ7LoRra6/IneGkAuxgj8y+9MZ bhR1bFpULuY0aIIN6ZEUvOoh3zPGgTt7Zw3uu/9NtP9jisoYEJrPoP9ig1jZMX8QwBHWAp XSOPQCmncwy0HDsaopMcy9IJ4VIZwxc5Bh9jlB9xpB8ERf/4yGD1Hp7I/Azudp4TENDxkY S+AacnsN1Acj89+Buwgq1w3q5GQ6CtCq4ciNzppMa6c58aFsSa7IJw0h+hsdb7DrN+ZOsq Nw3KuutKO09a4s4fAg3S4XoFCxeFEdjQ09c3h0kd4HZYH3RgZyfix2xIwLLwtg== 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=1783389437; 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=kCsb84sCSNzhKxKPxLiFmKTA/xzBqTF3G6s8sTXxUfc=; b=KK9T00Q+Kl3meeY0/OZwWKyaIjkCNXks/tCdGJuhvZGOmiXTHxhm9H6a7TTnDNOg4P9jQE S+6GHVlXgQ+dS4Rpz8+38Ij0T8Y0aUsf5VSrpxKgZmZgvWap3E/SRyRl2CusgJKE7ApEtE JjoDLBxjm6mFnL6K/iIENVcD5EjJPBl+sL0XZToF6qB749wrJ3vNX4qwdhUDQ3GZTqBsYY hHM4B5WQ6Q78ON88nBCnO2TMkVhe8IMl+27Yk+evzAyI0lRFEaI5PcgeK55udS2jL1HvRU Md2m1cz8nwjUqTrRVUEUMvgomMwskp63Xr6d517m9BAz/IugPrD5GULRczMhjw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvPVj2F7pzRD for ; Tue, 07 Jul 2026 01:57:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 401a7 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 01:57:17 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 5c32aa785184 - main - kern: add pdopenpid(2) 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5c32aa785184bb1e646b0b4c73d3c5fd9a6b8951 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 01:57:17 +0000 Message-Id: <6a4c5cfd.401a7.4610660e@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5c32aa785184bb1e646b0b4c73d3c5fd9a6b8951 commit 5c32aa785184bb1e646b0b4c73d3c5fd9a6b8951 Author: Konstantin Belousov AuthorDate: 2026-05-20 02:04:02 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 01:24:51 +0000 kern: add pdopenpid(2) Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57124 --- sys/kern/sys_procdesc.c | 114 ++++++++++++++++++++++++++++++++++++++++++----- sys/kern/syscalls.master | 7 +++ sys/sys/procdesc.h | 2 + 3 files changed, 111 insertions(+), 12 deletions(-) diff --git a/sys/kern/sys_procdesc.c b/sys/kern/sys_procdesc.c index 0d57a8cc7b2c..3fca3ea29b18 100644 --- a/sys/kern/sys_procdesc.c +++ b/sys/kern/sys_procdesc.c @@ -435,18 +435,22 @@ procdesc_close(struct file *fp, struct thread *td) pd->pd_pid = -1; procdesc_free(pd); - /* - * Next, reparent it to its reaper (usually init(8)) so - * that there's someone to pick up the pieces; finally, - * terminate with prejudice. - */ - p->p_sigparent = SIGCHLD; - if ((p->p_flag & P_TRACED) == 0) { - proc_reparent(p, p->p_reaper, true); - } else { - proc_clear_orphan(p); - p->p_oppid = p->p_reaper->p_pid; - proc_add_orphan(p, p->p_reaper); + /* Failed finstall() should not cause reaping. */ + if ((fp->f_pdflags & F_PD_NOFINSTALL) == 0) { + /* + * Next, reparent it to its reaper + * (usually init(8)) so that there's + * someone to pick up the pieces; + * finally, terminate with prejudice. + */ + p->p_sigparent = SIGCHLD; + if ((p->p_flag & P_TRACED) == 0) { + proc_reparent(p, p->p_reaper, true); + } else { + proc_clear_orphan(p); + p->p_oppid = p->p_reaper->p_pid; + proc_add_orphan(p, p->p_reaper); + } } procdesc_close_tail(fp, p); } else { @@ -609,3 +613,89 @@ procdesc_cmp(struct file *fp1, struct file *fp2, struct thread *td) pdp2 = fp2->f_data; return (kcmp_cmp((uintptr_t)pdp1->pd_pid, (uintptr_t)pdp2->pd_pid)); } + +static int +pdopenpid1(struct thread *td, pid_t pid, struct procdesc **pdf, struct file *fp) +{ + struct proc *p; + struct procdesc *pd; + int error; + + sx_assert(&proctree_lock, SX_XLOCKED); + + error = pget(pid, PGET_NOTID | PGET_CANDEBUG, &p); + if (error != 0) + return (error); + if ((p->p_flag & (P_SYSTEM | P_WEXIT)) != 0) { + PROC_UNLOCK(p); + return (EBUSY); + } + pd = p->p_procdesc; + if (pd != NULL) { + refcount_acquire(&pd->pd_refcount); + PROCDESC_LOCK(pd); + MPASS(pd->pd_fpcount > 0); + pd->pd_fpcount++; + PROCDESC_UNLOCK(pd); + } else { + pd = *pdf; + *pdf = NULL; + pd->pd_proc = p; + pd->pd_pid = p->p_pid; + p->p_procdesc = pd; + } + procdesc_finit(pd, fp); + PROC_UNLOCK(p); + return (0); +} + +static int +kern_pdopenpid(struct thread *td, pid_t pid, int flags) +{ + struct file *fp; + struct procdesc *pdf; + int error, fd, fflags; + + error = falloc_noinstall(td, &fp); + if (error != 0) + return (error); + fflags = pdtofdflags(flags); + pdf = procdesc_alloc(flags); + if ((flags & PD_DAEMON) != 0) + fp->f_pdflags |= F_PD_NOKILL; + + sx_xlock(&proctree_lock); + error = pdopenpid1(td, pid, &pdf, fp); + sx_xunlock(&proctree_lock); + + if (error == 0) { + error = finstall(td, fp, &fd, fflags, NULL); + if (error == 0) { + td->td_retval[0] = fd; + } else { + /* + * Not killing the target process if cannot + * return file descriptor to userspace. + */ + fp->f_pdflags |= F_PD_NOKILL | F_PD_NOFINSTALL; + } + } + fdrop(fp, td); + + if (pdf != NULL) { + MPASS(pdf->pd_refcount == 2); + MPASS(pdf->pd_fpcount == 1); + MPASS(pdf->pd_proc == NULL); + MPASS(pdf->pd_pid == -1); + procdesc_destroy(pdf); + } + return (error); +} + +int +sys_pdopenpid(struct thread *td, struct pdopenpid_args *args) +{ + if ((args->flags & ~(PD_ALLOWED_AT_FORK)) != 0) + return (EINVAL); + return (kern_pdopenpid(td, args->pid, args->flags)); +} diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 1032f6cd1bf0..41580d0c4595 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -3429,4 +3429,11 @@ int flags ); } +603 AUE_NULL STD { + int pdopenpid( + pid_t pid, + int flags + ); + } + ; vim: syntax=off diff --git a/sys/sys/procdesc.h b/sys/sys/procdesc.h index 5fbd43f1ac84..9eb64525e430 100644 --- a/sys/sys/procdesc.h +++ b/sys/sys/procdesc.h @@ -95,6 +95,8 @@ struct procdesc { */ #define F_PD_NOKILL 0x00000001 /* Opened with PD_DAEMON. Don't send SIGKILL when file closes. */ +#define F_PD_NOFINSTALL 0x00000002 /* Procdesc file is closing because + finstall() failed */ /* * In-kernel interfaces to process descriptors. From nobody Tue Jul 7 01:57:18 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 4gvPVk5gvRz6kcjR for ; Tue, 07 Jul 2026 01:57:18 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvPVk4Mnmz3V48 for ; Tue, 07 Jul 2026 01:57:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783389438; 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=ugWqaToc75hDLzID4ovRhxFsR6nC8JBZ2kZll9Nt0X0=; b=CPu72f6DqhRHJUmcStS7jY5JD4ABe9dMeAqK4MSHQwUsHMf5qta0w/XbOCUcbf03WwBTT5 0FHOUe1RK7x8KWG6bPlnKxhRvOB30mfvzD3RiJPFcyxF+DprfXbxFkzMEJuYxVOp8ksZPc 08AG8yoneQQb4GODLraULxUu0I8VhQSbF0YHoCtUTdSmVAafl8mKkDVBjtKOpZ3FQaeDc5 UAccRSEIRGscT0Tls3OD7dxmEgITDq164itUbDXCc9PI3v00qM7KRPzl6yvQzb+Br7nhK9 gHU+maBlY6hqtmyErnimXaGq7elAFPp6XFCaaZD2w5VgHiou4fv8dgIf3xDeXA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783389438; a=rsa-sha256; cv=none; b=QkeUGMVT7T7eFVx9yCNN1hOhZQbyW/ajQPmVHpc4hhpHM4sMkT7U7GGjC4ClyxJn538ZcD UAak6QYIPojsyxU+xiRFzcoECQaQAqdtxWUu9NiB+tLob3uf9x02aI+wr7YevfbhzIod3D 1cAcmlJUO6+6aleumBN8AwzvE5JOEcPat8wemlZZ6A2ZxvM6aSiy2hNraWleVUgNPPO7Aa jjD/0T/eBdHl5vuljTJuMiuokeu9gQoTSQFUcw0faZzB5cDaBDzebgaBxXiMEYgb1y4twr GQFlcg+pgNIqayddJQy03dgLoAhMft34g0dN4uTfXwbmVsqVnoLpkUVz3DEh5Q== 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=1783389438; 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=ugWqaToc75hDLzID4ovRhxFsR6nC8JBZ2kZll9Nt0X0=; b=wvDMo/yfoWeDxkQJAQPHTQ6Mb8fKvAUGFtsqeKO3Muhi0szJ7CrTjqQdYKZ/X1OjfiLVSp z60ko51Zxr4H3Lzj1DMyB2YT2wQWDE+JJRgbLe33qn/euhmwSogg6cnvhAuhzLBiy67QDM eQSUkNLDm+fftphEGjHodcPLndtc6twnGd0qq0OIqLBQATBp9is3BHnpYv3e8PmG4Zo9DQ +O5oe/pgtq7eu4KzfNOEHgjPvljVTk0PR3saUZhc9PaJt4GxbAgfOczi9xjqpldRngkEGM JFYcF9RZens0F5wYIdigj3G9+UDnCFycvG5jLGM5jB9ckV+/04ZdeLVlZCsjZw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvPVk31q0z9y for ; Tue, 07 Jul 2026 01:57:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3f335 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 01:57:18 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 606061ea463d - main - sys: add AUE_PDOPENPID 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 606061ea463dd1d7c3664b296e569b4b25d0f275 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 01:57:18 +0000 Message-Id: <6a4c5cfe.3f335.2c90fb8@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=606061ea463dd1d7c3664b296e569b4b25d0f275 commit 606061ea463dd1d7c3664b296e569b4b25d0f275 Author: Konstantin Belousov AuthorDate: 2026-05-20 02:14:24 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 01:25:08 +0000 sys: add AUE_PDOPENPID Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57124 --- sys/bsm/audit_kevents.h | 1 + sys/kern/sys_procdesc.c | 3 +++ sys/kern/syscalls.master | 2 +- sys/security/audit/audit_bsm.c | 10 ++++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sys/bsm/audit_kevents.h b/sys/bsm/audit_kevents.h index ac6f5d69f07d..fb54f179d677 100644 --- a/sys/bsm/audit_kevents.h +++ b/sys/bsm/audit_kevents.h @@ -665,6 +665,7 @@ #define AUE_SETCRED 43271 /* FreeBSD-specific. */ #define AUE_INOTIFY 43272 /* FreeBSD/Linux. */ #define AUE_PDRFORK 43273 /* FreeBSD-specific. */ +#define AUE_PDOPENPID 43274 /* FreeBSD-specific. */ /* * Darwin BSM uses a number of AUE_O_* definitions, which are aliased to the diff --git a/sys/kern/sys_procdesc.c b/sys/kern/sys_procdesc.c index 3fca3ea29b18..4749a9b8bf7e 100644 --- a/sys/kern/sys_procdesc.c +++ b/sys/kern/sys_procdesc.c @@ -695,6 +695,9 @@ kern_pdopenpid(struct thread *td, pid_t pid, int flags) int sys_pdopenpid(struct thread *td, struct pdopenpid_args *args) { + AUDIT_ARG_PID(args->pid); + AUDIT_ARG_FFLAGS(args->flags); + if ((args->flags & ~(PD_ALLOWED_AT_FORK)) != 0) return (EINVAL); return (kern_pdopenpid(td, args->pid, args->flags)); diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 41580d0c4595..8ea32a7b0058 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -3429,7 +3429,7 @@ int flags ); } -603 AUE_NULL STD { +603 AUE_PDOPENPID STD { int pdopenpid( pid_t pid, int flags diff --git a/sys/security/audit/audit_bsm.c b/sys/security/audit/audit_bsm.c index 4654b607aea5..8873eb877234 100644 --- a/sys/security/audit/audit_bsm.c +++ b/sys/security/audit/audit_bsm.c @@ -1412,6 +1412,16 @@ kaudit_to_bsm(struct kaudit_record *kar, struct au_record **pau) kau_write(rec, tok); } break; + case AUE_PDOPENPID: + if (ARG_IS_VALID(kar, ARG_PID)) { + tok = au_to_arg32(1, "PID", ar->ar_arg_pid); + kau_write(rec, tok); + } + if (ARG_IS_VALID(kar, ARG_FFLAGS)) { + tok = au_to_arg32(2, "flags", ar->ar_arg_fflags); + kau_write(rec, tok); + } + break; case AUE_PROCCTL: if (ARG_IS_VALID(kar, ARG_VALUE)) { From nobody Tue Jul 7 01:57:19 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 4gvPVl72H3z6kcjX for ; Tue, 07 Jul 2026 01:57:19 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvPVl4tScz3VQ6 for ; Tue, 07 Jul 2026 01:57:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783389439; 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=1SPj0n3psw1aVSaGZNOUYFTmvIxDjqTMLRrZt6gBNRA=; b=Kxr5Fi/e7PlQVN153gAjAYubvftoxeWJMsThYDVLnfZ5Ul5yvq0JkqI/XAYrehKDUYTdWu yMv2OGYU9rShWK9UpzhV8BRTCZaX3o/T9TnMlSGfPMM9xNIKOjx3aOUcRST74eplcd3Ixg TQ+DqbrPPX8SuqtGnJtsSX8Hqu+/Dixa8og5GB9+CVCrI/23A4KM6l6dBcLLOddXU0+AQB MmCrT6gR9ehnsx/lfr2FiKK/9TaM6vSdEd4vmVkmugTg3xj+V49G0NjBNEKfXIRCcRfnJm 5nRWR1DJZ6ooynCQ8aVAkQMpbUO6t2lmSm5G9rvr2LnkeEGbbam6n2K885MQvQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783389439; a=rsa-sha256; cv=none; b=A+CNScWGOabd8WVk9t9Edxry8ySMR/RgpBzsribpeal9va+PtuWEX9JrMyKzDTd0tR5hOs RG6wjywrJ+zpozTTXKWsIeHk6KZRyVso8KUjQ0nKT9BmDyIi1kP/drCxTMIFi10imFb6Rn N+gl0kVSqsFHxOZbG4naHFlg6buqXb22StE94kczwe4WcNtXsFaCh6Z+kxpx2IRVnPhPex JnwsIB9WNgZwNnwv8mA1X4ygSGc3ub42bL681SrOZm7G3efKZc9wtiS4tnafdMP3qApMl5 xoRRsoMF6dSjKaZv9DxtKhD7u/GwZgTS6kmHleN3fxUn3/VImF9zHp7yyaBEDQ== 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=1783389439; 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=1SPj0n3psw1aVSaGZNOUYFTmvIxDjqTMLRrZt6gBNRA=; b=BZFz8Z4QCSrBDL7mCWV2YxyyrESY9wOgjzluwFb6lqRLn29iGjGqYt20EeVbgsCacWmHlQ JuIMdBuzCf7koM1EMvwdhy9sc7LDDiLYwwVtHL9UFA9f2LudpoAxNw6OMBhsi1QejPb2TE +T632Tdj/4GTSpNBvN/KPux7/L+VkhTuYlnjXyK7R2wrfXTBiBSdc3O8krus4l5rxQbLum ZnXAlhu0vvdHv9sUQ2TRhCGWvNViLKJfylw5GdeZe1jCR9TuJy2YIWavjY2Q8/YAR98uqZ 5WQqaNEXg6vpekitLdTOD/zdUTlTTZimNbcMynOub8DmvrEaIVLjA6fhEhYl7Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvPVl3fngzTH for ; Tue, 07 Jul 2026 01:57:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 40a11 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 01:57:19 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: d6ff3bb3de91 - main - libsys: export pdopenpid(2) 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d6ff3bb3de91a2f1980c24e748ea5dc16b0987fd Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 01:57:19 +0000 Message-Id: <6a4c5cff.40a11.5e72b040@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d6ff3bb3de91a2f1980c24e748ea5dc16b0987fd commit d6ff3bb3de91a2f1980c24e748ea5dc16b0987fd Author: Konstantin Belousov AuthorDate: 2026-05-20 02:05:02 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 01:25:26 +0000 libsys: export pdopenpid(2) Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57124 --- lib/libsys/Symbol.sys.map | 1 + sys/sys/procdesc.h | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/libsys/Symbol.sys.map b/lib/libsys/Symbol.sys.map index 7f5c252af91b..05678ad0a7b6 100644 --- a/lib/libsys/Symbol.sys.map +++ b/lib/libsys/Symbol.sys.map @@ -391,6 +391,7 @@ FBSD_1.8 { }; FBSD_1.9 { + pdopenpid; pdrfork; pdrfork_thread; renameat2; diff --git a/sys/sys/procdesc.h b/sys/sys/procdesc.h index 9eb64525e430..ba72cf573c31 100644 --- a/sys/sys/procdesc.h +++ b/sys/sys/procdesc.h @@ -137,6 +137,7 @@ pid_t pdfork(int *, int); pid_t pdrfork(int *, int, int); int pdkill(int, int); int pdgetpid(int, pid_t *); +int pdopenpid(pid_t, int); int pdwait(int, int *, int, struct __wrusage *, struct __siginfo *); pid_t pdrfork_thread(int *, int, int, void *, int (*)(void *), void *); __END_DECLS From nobody Tue Jul 7 01:57:20 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 4gvPVn1n4Cz6kcd3 for ; Tue, 07 Jul 2026 01:57:21 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvPVm5sPGz3VFG for ; Tue, 07 Jul 2026 01:57:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783389440; 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=aWWMryaTOex5BkxGW0aKZidiN3QS6iQOd72s61T0LUA=; b=iikxr9HwTt3izSCcSsnK3lWZ1Q+ObbeZ3vIMrrAqv27mVT3DA/nejNcpCsRkotOlkUYWDZ H2Rdz8VNUxXljLMpM0Y8mKhOXzce1tKSrhAC6/0TkRbM6oHzV5zj9otxAJKUsKWzADztkx opb/9+2UIXSxdnq1YV3cVdy0GsxHQbu9qQ8TH7QSX6BtQxRisNieB4ZiFe13Ipbf/Z3prn JW5h+iwwJIG9oduyCw5aA7brjQ97U7+50efI34a7XPCbIW2WlVOMMqw+AImBg0fqm6bfaM sM4MgirCIWjAFB3qos7K3K3F9Su3Se7dK8LGI+Eh9AUB1b6RPE/OU228YjYSIQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783389440; a=rsa-sha256; cv=none; b=JAjbO7VkOP7KnBf43pDdG7OUtRRh3dW28UEBCV4LWH19qDQrpCnYNB7fXhHRefhR2RfZaF ocrqOHP6hHaIfP/hWXNTeHsDm3e4MHLQtBE4EVNn62Ka9PDlLZKSy7DT4H32yObUpzekJQ /7/624uS6MXdwDk7xSY0I46f8KjjfZfLXKIGMu1Zvpcr/CKSTeZ7kKe8J+JoVgqTXV7WP8 FC/abttFTg/yRC8SA56fpmWm9wj8ONrbLMSssf0lSLGdlsNrhOSpG9VRnNxL9DFnSQV5ru sBAF/wyzR7kI4uaadLSJ0nYIbm6r0FTJ7Gb2RA0KRS+euVBPiHdKu5VgUzLW5g== 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=1783389440; 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=aWWMryaTOex5BkxGW0aKZidiN3QS6iQOd72s61T0LUA=; b=O32s6Ha6wesijEseMK7h243wKShevr2tMm8pbmaiJPCprjXkBMQZTW3x5Al99B0SJpVmEw lbNlRhnLrC/F1sULfGsv44dqf6Uhv6nAIOpee1UjNSa4eWk9dYch3qUbzRA/9fErxwcRgy sUvFPkvCGr8fVyJRSZuoCVFaBc85tFMjwOpb/rZqt3uT9QMCr38b5fykzXIUd18FrAIrJt sP/jC5fT6MFCCyByYltMaPNwdUdj9Xr63xTx9khm1A6F1/BvpTNqfM6VLAZhwp/Ati3wV5 Y/iZXnKZNrx24u0DaEngj+qz/JofxYp1zrwmKr7itkNuAjL+TP1Th9Bn9EJE4A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvPVm4QclzB0 for ; Tue, 07 Jul 2026 01:57:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 40a15 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 01:57:20 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 1cced4932899 - main - pdfork.2: document EINVAL for pdwait(2) 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1cced493289962858c961b06b161b44ca43e7ac7 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 01:57:20 +0000 Message-Id: <6a4c5d00.40a15.5f256e13@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1cced493289962858c961b06b161b44ca43e7ac7 commit 1cced493289962858c961b06b161b44ca43e7ac7 Author: Konstantin Belousov AuthorDate: 2026-05-20 02:05:02 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 01:27:10 +0000 pdfork.2: document EINVAL for pdwait(2) Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57124 --- lib/libsys/pdfork.2 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/libsys/pdfork.2 b/lib/libsys/pdfork.2 index 3997570d2125..bf433509892a 100644 --- a/lib/libsys/pdfork.2 +++ b/lib/libsys/pdfork.2 @@ -232,6 +232,11 @@ The process descriptor being operated on has insufficient rights (e.g. .Dv CAP_PDKILL for .Fn pdkill ) . +.It Bq Er EINVAL +The +.Fn pdwait +function is called with reserved bits set in +.Fa options . .El .Sh SEE ALSO .Xr close 2 , From nobody Tue Jul 7 01:57:21 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 4gvPVp36s9z6kd8Y for ; Tue, 07 Jul 2026 01:57:22 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvPVn6K37z3VHS for ; Tue, 07 Jul 2026 01:57:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783389441; 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=lLSZZJq02sL2BIsdY44XoN7nGpfNBehG8xciASXLLfM=; b=tpVwYEZ/j11pjHuWh+yuoaQP7owCUdZCe8U5AZqvBK1mMO6yx45bXoCeSdkmmu+FihjFXb ccxbXCsT/18iVGv+DQHMRzyuA8mZi3NzqiLSkO/8taow0nlbIBfXzv0VertyXpiYJNMw1G 2NLzRoaeVZkG/+BtURGuLhD5LV4l5prd2YrBoYrqLofh6bVIE65cX9f31a5Ja2CScUVXWt Qr2QAfTnN7lfCOqCSXMRyBJY2x5Jj5kgOljVLMCr1g8CUPe8QgmmoKBcWNiwGOhkEI11wO JTw+Seh9rQ5An+uWSSmc8wzvtTFjKFI87PxLhAFuX5SN4wXB/cXdIwWj6oA8SA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783389441; a=rsa-sha256; cv=none; b=W5PBOEhRvq2xxR0NscvHCU+yvFWfaOvW2+pcFgUEn/jARUA/nnYXVOCbHetEGviXoJlCCc LcxtEVuw2LkMtkvDMGP7VqwBWyjuLY/C3pEpphrkeSxZ8pd2NAvzmQ7GIXwIDX/SFIz9Rn 5+N/ds4NJrjsFQEja7zpYHEgGv7V0ixrZ5vkAEf4vnR+98rNPzBpQjxBgD3a4z4+wMrXN6 /G9haWtH5uhpsMcKhNuRCelKlCJ5XJ+8UJ8HO5MV6yNyIsYcHIclvB9CjKnl3Dh8FW33Kp QQuLGfsGqlQLrGwWLy5z43Wynm4MHvCgF7imduV50jWiCvBxLZSpq6AfhFDszg== 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=1783389441; 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=lLSZZJq02sL2BIsdY44XoN7nGpfNBehG8xciASXLLfM=; b=N1+9+6MT4HNwO3dqNoAMt2qWvkPCVAKp9icW4XU4EQYHq6Wa3mticbxpWLbRcYrcF0TlmF uShoYViJUh2Rw5ZYViD0E6J2zko0F5QoSw/jBFqvTQRf2zWjsLsj36wBk0PVVEyouqlWuy 7GGScAeK0ibuGSQB/qqSYr4E2Ci/dDauSF9+37Wh7XHv24pLsNegxyZCQOW+rNATfF3vep 9t5leCAKl7v2BdBOBc6gLr1vc8l/3Rpw1llSLhxmKKSb0T/vUy/l6hhRRTwLmLioIiklvn uadNu7OuoJNe2pHl31Y807ved4yfmxkTR+pI88iP5jhrzdEDOrlVGEmOUbVTyA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvPVn5Ddmz1S2M for ; Tue, 07 Jul 2026 01:57:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3f339 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 01:57:21 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 5a5affd457eb - main - pdfork.2: clarify that PD_DAEMON acts on current file 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5a5affd457eb3ab89b57c9c512a8843d9011133f Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 01:57:21 +0000 Message-Id: <6a4c5d01.3f339.3a85656d@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5a5affd457eb3ab89b57c9c512a8843d9011133f commit 5a5affd457eb3ab89b57c9c512a8843d9011133f Author: Konstantin Belousov AuthorDate: 2026-05-25 17:49:50 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 01:27:13 +0000 pdfork.2: clarify that PD_DAEMON acts on current file Also do not start a new list for each flag item. Reviewed by: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D57124 --- lib/libsys/pdfork.2 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/libsys/pdfork.2 b/lib/libsys/pdfork.2 index bf433509892a..6ebab24ff180 100644 --- a/lib/libsys/pdfork.2 +++ b/lib/libsys/pdfork.2 @@ -87,8 +87,14 @@ This option is not permitted in .Xr capsicum 4 capability mode (see .Xr cap_enter 2 ) . -.El -.Bl -tag -width ".Dv PD_DAEMON" +.Pp +Note: the option changes the behavior of +.Xr close 2 +for the process descriptor returned by the operation. +If there is another process descriptor for the same process, created without +specifying the +.Dv PD_DAEMON +flag, closing that descriptor kills the process. .It Dv PD_CLOEXEC Set close-on-exec on process descriptor. .El From nobody Tue Jul 7 01:57:22 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 4gvPVq3JRSz6kd4H for ; Tue, 07 Jul 2026 01:57:23 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvPVq04Q4z3VQZ for ; Tue, 07 Jul 2026 01:57:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783389443; 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=RoHHAP4PKgPDX7lNwrRl9V37RZUJyb1vhJVnow1hqU0=; b=VhAcnaxxAAQfMyeGr5bRtNF8czJm7WUOBLyrNhqiVyBEfM96LGk9FuWKpNs7hgxYZjcFtd sIWvivUGMtdgmgCwTNw3kOC7JCkUb7wXkuKTnq6ID12uhOyLBNPrE6jLcBdwDN4uO4xp0z R/NQtvqqT2dCDiZEN3TjlxQINvCG8hnIkx9Lckm1Q8LBj64Mtx054UaNn9HKzERG73dwjp qhA49MuZcvJxhjOb+NF1k6tMB4qqgijuNBka1sAt4WQOy5Db/FJ+Oc64r/pCyPniXOhzma WtyH5IG8B81hNZWmnO08EagORd+ciV1yZgKyqsWzndq0YqooYcKdUQ//ETmBuA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783389443; a=rsa-sha256; cv=none; b=uoDdsUF9OVkQ7PTd6I3WUNoSuY4YUZkX3mRaKWRQZrnA7+dA9//2u+8hz8q9TsFVe/+mux XMx5usH4AsflSMWjM8MGw++nk7e9ikVny6OenqjrvnTfH8yqInybD35aXQxWSw8YlKqW3k Yk5Wf60ShePozaLWerh0gV1Vq8XDc2K2s9D/sf837Tj6RPWQ2pkxwFv9IidmRhR/cSWwio EhLFzQW9k3u9fm9cQCPeQyLCRdVf8ANWqq6tUj/0QgSsBhK47BmMjGwBNc96yE2CCM4Hop 7uG9nJBombi+d1/shhz+rpzjrZSgDLtkZZaEeh/KXP9jOtFi3jRP/fVu9XSCqg== 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=1783389443; 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=RoHHAP4PKgPDX7lNwrRl9V37RZUJyb1vhJVnow1hqU0=; b=O0qJqseVL/q2nndU5PEtHYzFTcLrgXgJxLSIpi9pOnZ8nsKH45+uUNh09enCMY6E9PZQTZ rBecIeSO5HGvvQpND+F8M2ATvDHuLh9XRoz8v1f3DUWJ/sWQhVR3Uzn5UCArP3CbrHHgsK cjCv7F5w/no2ewte2jE9rI8W38dFOkyJtZ/lLKrFbAedALbBZtURakADwwsQVejrSmWh2G NNgPyvS5Y48KSYu64uAXNVNFAHKA3sJBIGuilsHoepWqE99V3k6b42PGPgR/hkbvpkzhEs VWK3BV27qp6Sv23292BIuY4UZYgtkg0x3JLzvdPmRCBFHa2v+AdhJB1yaeJTKQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvPVp601KzB1 for ; Tue, 07 Jul 2026 01:57:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3f33d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 01:57:22 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 3e8b68c26e2b - main - pdfork.2: document pdopenpid(2) 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3e8b68c26e2b108dac96517ef8fd26fe7dce5bcd Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 01:57:22 +0000 Message-Id: <6a4c5d02.3f33d.7156f525@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3e8b68c26e2b108dac96517ef8fd26fe7dce5bcd commit 3e8b68c26e2b108dac96517ef8fd26fe7dce5bcd Author: Konstantin Belousov AuthorDate: 2026-05-21 17:33:43 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 01:27:16 +0000 pdfork.2: document pdopenpid(2) Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57124 --- lib/libsys/Makefile.sys | 1 + lib/libsys/pdfork.2 | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/lib/libsys/Makefile.sys b/lib/libsys/Makefile.sys index 76855e0ae54d..c362258b89f4 100644 --- a/lib/libsys/Makefile.sys +++ b/lib/libsys/Makefile.sys @@ -497,6 +497,7 @@ MLINKS+=open.2 openat.2 MLINKS+=pathconf.2 fpathconf.2 MLINKS+=pathconf.2 lpathconf.2 MLINKS+=pdfork.2 pdgetpid.2 \ + pdfork.2 pdopenpid.2 \ pdfork.2 pdkill.2 \ pdfork.2 pdrfork.2 \ pdfork.2 pdwait.2 diff --git a/lib/libsys/pdfork.2 b/lib/libsys/pdfork.2 index 6ebab24ff180..9099edebaa2a 100644 --- a/lib/libsys/pdfork.2 +++ b/lib/libsys/pdfork.2 @@ -36,6 +36,7 @@ .Sh NAME .Nm pdfork , .Nm pdrfork , +.Nm pdopenpid , .Nm pdgetpid , .Nm pdkill , .Nm pdwait @@ -49,6 +50,8 @@ .Ft pid_t .Fn pdrfork "int *fdp" "int pdflags" "int rfflags" .Ft int +.Fn pdopenpid "pid_t pid" "int pdflags" +.Ft int .Fn pdgetpid "int fd" "pid_t *pidp" .Ft int .Fn pdkill "int fd" "int signum" @@ -128,6 +131,28 @@ flags, or .Va RFSPAWN flag are specified. .Pp +.Fn pdopenpid +opens the process descriptor for the process specified by the argument +.Fa pid . +It takes the same flags in the +.Fa pdflags +argument as +.Fn pdfork . +The caller must have permission to debug the target process in order for +.Fn pdopenpid +to succeed. +Zombie processes cannot be opened. +.Pp +There might be more that one file descriptor referencing the process. +But only one caller of +.Fn pdwait +gets the exit status. +After the zombie is reaped, calls to +.Fn pdwait +specifying any file descriptors for the same process fail with the +.Er ESRCH +error. +.Pp .Fn pdgetpid queries the process ID (PID) in the process descriptor .Fa fd . @@ -198,6 +223,7 @@ return a PID, 0 or -1, as .Xr fork 2 does. .Pp +.Fn pdopenpid , .Fn pdgetpid , .Fn pdkill , and @@ -244,6 +270,40 @@ The function is called with reserved bits set in .Fa options . .El +.Pp +The +.Fn pdopenpid +might return the same errors as +.Xr open 2 , +related to the file descriptor allocation problems, as well as the +following specific errors: +.Bl -tag -width Er +.It Bq Er EINVAL +The +.Fa flags +argument has reserved bits set. +.It Bq Er ECAPMODE +.Fn pdopenpid +is called by the process in capability mode. +.It Bq Er EBUSY +The process specified by the +.Fa pid +argument already terminated. +.It Bq Er ESRCH +The process specified by the +.Fa pid +argument does not exist, or the caller does not have enough privileges +to open the process. +.It Bq Er EMFILE +The calling process already reached its limit for open file descriptors. +.Pp +Current implementation installs the opened process descriptor into the +calling process's file descriptors table. +If the descriptor cannot be installed, the process descriptor is closed, +which executes all actions performed by +.Xr close 2 +on it. +.El .Sh SEE ALSO .Xr close 2 , .Xr fork 2 , @@ -268,6 +328,10 @@ and .Fn pdwait system calls first appeared in .Fx 15.1 . +The +.Fn pdopenpid +system call first appeared in +.Fx 16.0 . .Pp Support for process descriptors mode was developed as part of the .Tn TrustedBSD @@ -288,3 +352,7 @@ functions were developed by .An Konstantin Belousov Aq Mt kib@FreeBSD.org with input from .An Alan Somers Aq Mt asomers@FreeBSD.org . +The +.Fn pdopenpid +function was developed by +.An Konstantin Belousov Aq Mt kib@FreeBSD.org . From nobody Tue Jul 7 01:57:23 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 4gvPVr4l8Mz6kd26 for ; Tue, 07 Jul 2026 01:57:24 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvPVr0Y8zz3VKt for ; Tue, 07 Jul 2026 01:57:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783389444; 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=ByfByY/c84uFRKJOjJJpZpApD4SKVjGM16eRu7X3Kj8=; b=HjmhBY1to0u/diWBxF+XdE6UvVx8PcrREiA/0EmUkwAFd96skCfcWtA7izsTFcVd+3nwCj GjpJy9KYWZfk0RrODpUKZOijx/lQX0qIMlko3Pp8pbPZRRt89BbGiyzltU9mkwSdrnOB9E iDRCur9PN1qGHG/Vqwf0Y8eD3pEF6l1sk+QpYAxlnft2dcLRaT7RcsQZpModcqC/TME4xa p8Ai6EOyPHrLpZwd7tAnvN1DASZCwQZ5/NI581wN/WPgBZTaqSYwwaepHLM2kQlC4U7faD A+ShWbg3Oj8rIGEbqQkeAJY74hnC5JqEPX5MngoMHWnG7vE4ReJdcHRWDPejdA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783389444; a=rsa-sha256; cv=none; b=UppDC5YarY3j/feS5QSDf25m6KwhhlscnrRXma8PJfkAdwPTEy3p1O/C+fQ2E1rAF6K8op 2xrHqbHJcrLRswG5MJm4+dimq0L6K7vYVzNe/3ooOiPl1qJxOtA544kA5K9tDKTnoR/DZo WuFXN4gsQm/h7EqapVv4t6mj+YuZlinTkhddBll2rHhAgThG3TMl5DHhi1Do1we2+LEQ9j C6aXMz3pFPHnabwHt/HWBwIWW5E/FIzHm1He3JKLiZapsg0zZ4EuMQP5B3JP+S51kGi/yY ZmDREfGiwFZ8MIgqAV30yShf03tho4lBtwXgk1QkG/YUJe4mtYo2bscGaGtBtQ== 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=1783389444; 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=ByfByY/c84uFRKJOjJJpZpApD4SKVjGM16eRu7X3Kj8=; b=bML0qg9QXFml3gqSAzXxpUR9JfAIUBIcilz6e0Fb+q5xWcnZnU0pjcKjUiiH/3XJK5Qd8X flMOC/HSiKAfk/xiP+tjGD6GE8ClAxw15dlB/V/xDyOrCRy5eHX2yta+T1jikgkLnOUbrE jaWfsQivusqzPcQU8IXnJkT8lsE+oYVWgZo1xfHFo53wo6Pbeihgva4+aLuhkdpbms9OVi 7lCA4iyBIpbTDKjuZQbGdZaHlHM3J+B6rdV2dYT5AHUvtAo3+7z1S7LtrQCX/dDsKV8gsI CCjf66gFnFsLIsNhbESm/gr0SkZxbYzExmKESoCCRbiwkJLORzcdB7Fic5AJgA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvPVq6X7XzPC for ; Tue, 07 Jul 2026 01:57:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3eafd by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 01:57:23 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: f7675fab2084 - main - Regen 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f7675fab2084ef5a2c0feb378ff396f0d5ed6c92 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 01:57:23 +0000 Message-Id: <6a4c5d03.3eafd.1c5b705c@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f7675fab2084ef5a2c0feb378ff396f0d5ed6c92 commit f7675fab2084ef5a2c0feb378ff396f0d5ed6c92 Author: Konstantin Belousov AuthorDate: 2026-05-20 02:06:37 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 01:27:16 +0000 Regen --- lib/libsys/_libsys.h | 2 ++ lib/libsys/syscalls.map | 2 ++ sys/compat/freebsd32/freebsd32_syscall.h | 3 ++- sys/compat/freebsd32/freebsd32_syscalls.c | 1 + sys/compat/freebsd32/freebsd32_sysent.c | 1 + sys/compat/freebsd32/freebsd32_systrace_args.c | 26 ++++++++++++++++++++++++++ sys/kern/init_sysent.c | 1 + sys/kern/syscalls.c | 1 + sys/kern/systrace_args.c | 26 ++++++++++++++++++++++++++ sys/sys/syscall.h | 3 ++- sys/sys/syscall.mk | 3 ++- sys/sys/sysproto.h | 6 ++++++ 12 files changed, 72 insertions(+), 3 deletions(-) diff --git a/lib/libsys/_libsys.h b/lib/libsys/_libsys.h index c454fc3fece9..c40e56a96094 100644 --- a/lib/libsys/_libsys.h +++ b/lib/libsys/_libsys.h @@ -475,6 +475,7 @@ typedef int (__sys_kexec_load_t)(uint64_t, u_long, struct kexec_segment *, u_lon typedef int (__sys_pdrfork_t)(int *, int, int); typedef int (__sys_pdwait_t)(int, int *, int, struct __wrusage *, struct __siginfo *); typedef int (__sys_renameat2_t)(int, const char *, int, const char *, int); +typedef int (__sys_pdopenpid_t)(pid_t, int); _Noreturn void __sys__exit(int rval); int __sys_fork(void); @@ -885,6 +886,7 @@ int __sys_kexec_load(uint64_t entry, u_long nseg, struct kexec_segment * segment int __sys_pdrfork(int * fdp, int pdflags, int rfflags); int __sys_pdwait(int fd, int * status, int options, struct __wrusage * wrusage, struct __siginfo * info); int __sys_renameat2(int oldfd, const char * old, int newfd, const char * new, int flags); +int __sys_pdopenpid(pid_t pid, int flags); __END_DECLS #endif /* __LIBSYS_H_ */ diff --git a/lib/libsys/syscalls.map b/lib/libsys/syscalls.map index 928817e57b7c..2d0f204f9705 100644 --- a/lib/libsys/syscalls.map +++ b/lib/libsys/syscalls.map @@ -825,4 +825,6 @@ FBSDprivate_1.0 { __sys_pdwait; _renameat2; __sys_renameat2; + _pdopenpid; + __sys_pdopenpid; }; diff --git a/sys/compat/freebsd32/freebsd32_syscall.h b/sys/compat/freebsd32/freebsd32_syscall.h index 9fed7ec58669..d786f4cd4528 100644 --- a/sys/compat/freebsd32/freebsd32_syscall.h +++ b/sys/compat/freebsd32/freebsd32_syscall.h @@ -520,4 +520,5 @@ #define FREEBSD32_SYS_pdrfork 600 #define FREEBSD32_SYS_freebsd32_pdwait 601 #define FREEBSD32_SYS_renameat2 602 -#define FREEBSD32_SYS_MAXSYSCALL 603 +#define FREEBSD32_SYS_pdopenpid 603 +#define FREEBSD32_SYS_MAXSYSCALL 604 diff --git a/sys/compat/freebsd32/freebsd32_syscalls.c b/sys/compat/freebsd32/freebsd32_syscalls.c index d91d45130c89..3a28ddeb843a 100644 --- a/sys/compat/freebsd32/freebsd32_syscalls.c +++ b/sys/compat/freebsd32/freebsd32_syscalls.c @@ -608,4 +608,5 @@ const char *freebsd32_syscallnames[] = { "pdrfork", /* 600 = pdrfork */ "freebsd32_pdwait", /* 601 = freebsd32_pdwait */ "renameat2", /* 602 = renameat2 */ + "pdopenpid", /* 603 = pdopenpid */ }; diff --git a/sys/compat/freebsd32/freebsd32_sysent.c b/sys/compat/freebsd32/freebsd32_sysent.c index 68c0388eaa79..0541d4a7569a 100644 --- a/sys/compat/freebsd32/freebsd32_sysent.c +++ b/sys/compat/freebsd32/freebsd32_sysent.c @@ -670,4 +670,5 @@ struct sysent freebsd32_sysent[] = { { .sy_narg = AS(pdrfork_args), .sy_call = (sy_call_t *)sys_pdrfork, .sy_auevent = AUE_PDRFORK, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 600 = pdrfork */ { .sy_narg = AS(freebsd32_pdwait_args), .sy_call = (sy_call_t *)freebsd32_pdwait, .sy_auevent = AUE_PDWAIT, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 601 = freebsd32_pdwait */ { .sy_narg = AS(renameat2_args), .sy_call = (sy_call_t *)sys_renameat2, .sy_auevent = AUE_RENAMEAT, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 602 = renameat2 */ + { .sy_narg = AS(pdopenpid_args), .sy_call = (sy_call_t *)sys_pdopenpid, .sy_auevent = AUE_PDOPENPID, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 603 = pdopenpid */ }; diff --git a/sys/compat/freebsd32/freebsd32_systrace_args.c b/sys/compat/freebsd32/freebsd32_systrace_args.c index e85cf4765c98..b79d53bd62bb 100644 --- a/sys/compat/freebsd32/freebsd32_systrace_args.c +++ b/sys/compat/freebsd32/freebsd32_systrace_args.c @@ -3458,6 +3458,14 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 5; break; } + /* pdopenpid */ + case 603: { + struct pdopenpid_args *p = params; + iarg[a++] = p->pid; /* pid_t */ + iarg[a++] = p->flags; /* int */ + *n_args = 2; + break; + } default: *n_args = 0; break; @@ -9347,6 +9355,19 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; + /* pdopenpid */ + case 603: + switch (ndx) { + case 0: + p = "pid_t"; + break; + case 1: + p = "int"; + break; + default: + break; + }; + break; default: break; }; @@ -11280,6 +11301,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "int"; break; + /* pdopenpid */ + case 603: + if (ndx == 0 || ndx == 1) + p = "int"; + break; default: break; }; diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c index 54f1ada9453c..5e80fe8bac01 100644 --- a/sys/kern/init_sysent.c +++ b/sys/kern/init_sysent.c @@ -669,4 +669,5 @@ struct sysent sysent[] = { { .sy_narg = AS(pdrfork_args), .sy_call = (sy_call_t *)sys_pdrfork, .sy_auevent = AUE_PDRFORK, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 600 = pdrfork */ { .sy_narg = AS(pdwait_args), .sy_call = (sy_call_t *)sys_pdwait, .sy_auevent = AUE_PDWAIT, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 601 = pdwait */ { .sy_narg = AS(renameat2_args), .sy_call = (sy_call_t *)sys_renameat2, .sy_auevent = AUE_RENAMEAT, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 602 = renameat2 */ + { .sy_narg = AS(pdopenpid_args), .sy_call = (sy_call_t *)sys_pdopenpid, .sy_auevent = AUE_PDOPENPID, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 603 = pdopenpid */ }; diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c index cf54a656d639..bd9e766b4e44 100644 --- a/sys/kern/syscalls.c +++ b/sys/kern/syscalls.c @@ -608,4 +608,5 @@ const char *syscallnames[] = { "pdrfork", /* 600 = pdrfork */ "pdwait", /* 601 = pdwait */ "renameat2", /* 602 = renameat2 */ + "pdopenpid", /* 603 = pdopenpid */ }; diff --git a/sys/kern/systrace_args.c b/sys/kern/systrace_args.c index 18c6462d4207..3ad68f186acb 100644 --- a/sys/kern/systrace_args.c +++ b/sys/kern/systrace_args.c @@ -3555,6 +3555,14 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 5; break; } + /* pdopenpid */ + case 603: { + struct pdopenpid_args *p = params; + iarg[a++] = p->pid; /* pid_t */ + iarg[a++] = p->flags; /* int */ + *n_args = 2; + break; + } default: *n_args = 0; break; @@ -9521,6 +9529,19 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; + /* pdopenpid */ + case 603: + switch (ndx) { + case 0: + p = "pid_t"; + break; + case 1: + p = "int"; + break; + default: + break; + }; + break; default: break; }; @@ -11549,6 +11570,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "int"; break; + /* pdopenpid */ + case 603: + if (ndx == 0 || ndx == 1) + p = "int"; + break; default: break; }; diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h index 0bbbf38ceea0..13db6580b4d2 100644 --- a/sys/sys/syscall.h +++ b/sys/sys/syscall.h @@ -541,4 +541,5 @@ #define SYS_pdrfork 600 #define SYS_pdwait 601 #define SYS_renameat2 602 -#define SYS_MAXSYSCALL 603 +#define SYS_pdopenpid 603 +#define SYS_MAXSYSCALL 604 diff --git a/sys/sys/syscall.mk b/sys/sys/syscall.mk index 5c9bc8b3c0ab..b2ff9ccee001 100644 --- a/sys/sys/syscall.mk +++ b/sys/sys/syscall.mk @@ -444,4 +444,5 @@ MIASM = \ kexec_load.o \ pdrfork.o \ pdwait.o \ - renameat2.o + renameat2.o \ + pdopenpid.o diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h index b3819b8f4bda..12e12eefab9f 100644 --- a/sys/sys/sysproto.h +++ b/sys/sys/sysproto.h @@ -1932,6 +1932,10 @@ struct renameat2_args { char new_l_[PADL_(const char *)]; const char * new; char new_r_[PADR_(const char *)]; char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; }; +struct pdopenpid_args { + char pid_l_[PADL_(pid_t)]; pid_t pid; char pid_r_[PADR_(pid_t)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; +}; int sys__exit(struct thread *, struct _exit_args *); int sys_fork(struct thread *, struct fork_args *); int sys_read(struct thread *, struct read_args *); @@ -2342,6 +2346,7 @@ int sys_kexec_load(struct thread *, struct kexec_load_args *); int sys_pdrfork(struct thread *, struct pdrfork_args *); int sys_pdwait(struct thread *, struct pdwait_args *); int sys_renameat2(struct thread *, struct renameat2_args *); +int sys_pdopenpid(struct thread *, struct pdopenpid_args *); #ifdef COMPAT_43 @@ -3344,6 +3349,7 @@ int freebsd14_setgroups(struct thread *, struct freebsd14_setgroups_args *); #define SYS_AUE_pdrfork AUE_PDRFORK #define SYS_AUE_pdwait AUE_PDWAIT #define SYS_AUE_renameat2 AUE_RENAMEAT +#define SYS_AUE_pdopenpid AUE_PDOPENPID #undef PAD_ #undef PADL_ From nobody Tue Jul 7 03:23:37 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 4gvRQd5XFcz6kkrQ for ; Tue, 07 Jul 2026 03:23:53 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvRQc6RJSz3jbN for ; Tue, 07 Jul 2026 03:23:52 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=freebsd.org (policy=none); spf=pass (mx1.freebsd.org: domain of jrtc27@jrtc27.com designates 209.85.128.51 as permitted sender) smtp.mailfrom=jrtc27@jrtc27.com Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-493bb510ce4so27286755e9.1 for ; Mon, 06 Jul 2026 20:23:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783394630; x=1783999430; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Dc00wk4KDnBOtfx4irVCXH1/5An1Ln6MjOB2FYliRWM=; b=bXFvmt9XNQ/hOPtX6UJrGQemKOEUYpIEbpUenjbjAr1Lspu4qIOUHdQjS4eCAg+ySv w1J8yAD3kX6W25hqXYOdW4EKUatoYG3ov8C50mJ0+boJVeaKPG7ezh7UYr3fVfRKKUB7 NGTx5kj2/Y1KCTe9Cn8cJURuf38WfT4VvnIDzPD0xTMzPm0Dw2WDUIXCy7KPaL9iwQhF 2OYUg1KEbu0XECaMwG4LjxWQKpgRRfiBVJtbdmaH6XcKd5u8jV/2PsNPPtMnt4k/qYho 5+9t0JC3MS/BxmS6SVOZ4ZBFs/W+nKPUX6X+N5hJCsaG9neIfPKLNHlNvjSnmXwb3jFh qccw== X-Forwarded-Encrypted: i=1; AHgh+RqWFzMnEGYR1CewivMlenLsW/MC+DvuZrtMc4dqgUP7+rwVACass4FtQcHiDLikZfbeX3f2zb2xvdkZJNzXueSUNIBAEw==@freebsd.org X-Gm-Message-State: AOJu0YxU5SRd2sbTamn0WwPVUohUVkMKSB7EfLJwF2kiRksr9o64kk/V KaSYcXldVZM5sUasX216yAksVx6hj94Vbsr9Mai6Iq4JTO7pz6oPzaNshfKxgMYJuiQ= X-Gm-Gg: AfdE7cn/dKRZIKYSicurbTudYCySx2PTrtYASOz7KpwhHrUsDMI4bEjAs0OCAgb7GIg j7KQ3inXoQCXTPkGpWqveHLFgFhU/aT+SMswf0+H6e6RIv6TuQ1GNs5focvzSV5XtrZPFknt16+ 1biJVDUarkhMTadP7fuYkw4r9hTAR3ZDehsbB7TdBtbLlgqWmjO5NitHA/GVPMskgjhGwVVEW50 M5GhgdV5r8HRLwWHyHotISb28ClBhDh6VqaTNYPa6w87g+/wr4eXscbhoX4wZbM9sl5jteIOFFy ns/cvKAdGgWG+RA83vY9OD3wTCBLczVlWAHEjBQyzbhBIiaXD3awZCbAj38pqSl2JdNZMthnM5w Jqb0RS1LziD6B2toXLWwuKVw4+7qp+NAcoERqRRmNK2NCRFrsLbQz9teccLXXXMPDMFWJB3Ln8S WEM2/CHcx7u7qwkm1U/QHrS26Xvbr5y+DMIX33u6weXlCt35UZeZ4qs1QDVTo= X-Received: by 2002:a05:600c:3547:b0:493:72d3:4a81 with SMTP id 5b1f17b1804b1-493df041366mr31907115e9.16.1783394629904; Mon, 06 Jul 2026 20:23:49 -0700 (PDT) Received: from smtpclient.apple (nat-184-161.net.cam.ac.uk. [131.111.184.161]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-493e0f43912sm24136165e9.7.2026.07.06.20.23.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2026 20:23:48 -0700 (PDT) Content-Type: text/plain; charset=utf-8 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 (Mac OS X Mail 16.0 \(3893.100.7.1.1\)) Subject: Re: git: 02ef0b6d76e9 - main - universe: allow moving build logs to UNIVERSE_LOGDIR From: Jessica Clarke In-Reply-To: <6a0f1540.3ff24.51dc4c5c@gitrepo.freebsd.org> Date: Tue, 7 Jul 2026 04:23:37 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <8E08C2FC-CC93-4374-A31F-C96DFF916A2B@freebsd.org> References: <6a0f1540.3ff24.51dc4c5c@gitrepo.freebsd.org> To: Siva Mahadevan X-Mailer: Apple Mail (2.3893.100.7.1.1) X-Spamd-Result: default: False [-2.40 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.996]; MV_CASE(0.50)[]; FORGED_SENDER(0.30)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; MIME_GOOD(-0.10)[text/plain]; DMARC_POLICY_SOFTFAIL(0.10)[freebsd.org : SPF not aligned (relaxed), No valid DKIM,none]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEFALL_USER(0.00)[jrtc27]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_HAS_DN(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_NEQ_ENVFROM(0.00)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-main@freebsd.org]; R_DKIM_NA(0.00)[]; MLMMJ_DEST(0.00)[dev-commits-src-main@freebsd.org]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.128.51:from]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.128.51:from] X-Rspamd-Queue-Id: 4gvRQc6RJSz3jbN X-Spamd-Bar: -- On 21 May 2026, at 15:22, Siva Mahadevan wrote: >=20 > The branch main has been updated by siva: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D02ef0b6d76e9717b8e3182dd706e23fd= 2702701d >=20 > commit 02ef0b6d76e9717b8e3182dd706e23fd2702701d > Author: Siva Mahadevan > AuthorDate: 2026-05-20 20:05:53 +0000 > Commit: Siva Mahadevan > CommitDate: 2026-05-21 14:16:48 +0000 >=20 > universe: allow moving build logs to UNIVERSE_LOGDIR >=20 > This allows `make universe` or `make tinderbox` > to build from a read-only src tree. >=20 > Reviewed by: ziaee, imp, delphij > Approved by: lwhsu (mentor), emaste (mentor) > MFC after: 3 days > Differential Revision: https://reviews.freebsd.org/D55566 > --- > Makefile | 17 ++++++++--------- > share/man/man7/build.7 | 7 ++++++- > 2 files changed, 14 insertions(+), 10 deletions(-) >=20 > diff --git a/Makefile b/Makefile > index 9308883b8500..e7a565cff05e 100644 > --- a/Makefile > +++ b/Makefile > @@ -599,8 +599,9 @@ targets: .PHONY > .endfor > .endfor >=20 > +UNIVERSE_LOGDIR?=3D${.CURDIR} > .if defined(DOING_TINDERBOX) > -FAILFILE=3D${.CURDIR}/_.tinderbox.failed > +FAILFILE=3D${UNIVERSE_LOGDIR}/_.tinderbox.failed > MAKEFAIL=3Dtee -a ${FAILFILE} > .else > MAKEFAIL=3Dcat > @@ -612,9 +613,7 @@ universe_prologue: .PHONY > @echo "--------------------------------------------------------------" > @echo ">>> make universe started on ${STARTTIME}" > @echo "--------------------------------------------------------------" > -.if defined(DOING_TINDERBOX) > @rm -f ${FAILFILE} > -.endif Hm, I don=E2=80=99t see an explanation for this change? This seems like = a separate thing, and changes behaviour even when UNIVERSE_LOGDIR isn=E2=80=99= t set? I can see the argument for doing it, but I don=E2=80=99t see any justification for it, whether in the commit message or in the Phabricator review, and it really belonged in its own commit IMO if making the change. Jessica From nobody Tue Jul 7 06:48:12 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 4gvWyP3NRvz6l1kH for ; Tue, 07 Jul 2026 06:48:13 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvWyP1h6Cz46dG for ; Tue, 07 Jul 2026 06:48:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783406893; 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=w7BgZka4EHgYmbNPUL4Q83S/FhDzPNsSnxkk8maab8s=; b=C4fOtz/rB2OL0/JDb3liFnFdfnuoWgz5wwzqxcwDsoPjkmV+to4/Sdaba5T8gjUGfqU/JU E3mG9IxWGkZ1VtLMWeqsG9sWYJkpc2LPCCpYH9f2CJolAccwKdHGnzFNl9ca1VQyhJsU4G s3Y5VPUZegSMPDob6r3UGxI3cAQ9uX/LC7pbJ1RBbT3alcTKVQc1Pr6EJLUcsmAG4jIR9s vVc6ZS/ewNf1WV5TYnbm52PosoMTlRzQ88Uukl2KbsRCBGnGTM/ZgVG+lWKQ3wFgK+hpcs 8vNxU4nNR+9WWxlZ1NDgxy0bqmaX1BICxpbQpkm7rCIZjpFqWnwPPGIyiD45cQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783406893; a=rsa-sha256; cv=none; b=ZRRHycjx+ytX9O+PPP36TvshACUVOU+4nh6cK+tQzkGlHjmRJUbUk+nH0nbolf6VLkdf6g IoJXUrFIzFMHH2uYvOeq7QP/fXYJGtm8p65Kzpnuf3ij1mbraTzuX2M6PsQuBSuXvukprf a6sV4RIwkyIbUP4YcgXPHdx5w674Q8CEhlDpRmr8pAlD8TVDiDt3NxPa4Lm1KH31eYS3WP Boodd9dhQMX/CjRDS0viaiaqqvs3tDE9RvHCEqZ/R5QEsfOHTxs5F5yOuWj2NirKukTt1u eegKSVevtAVL/ELk5n184WM79cFiHATvWnBigJ0VRMeyy8Xbcxl0RlrLXJiXeA== 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=1783406893; 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=w7BgZka4EHgYmbNPUL4Q83S/FhDzPNsSnxkk8maab8s=; b=OlIMaVExa7XEjR/7eneGc8hugu0RnucFgWeWJLHI1q199SpHYMuJQAMVtmj7r3ONWAqxwp Av4Y5pWP04eqZByKyAO6ifX0blN9UgJTqRzQR0TFOABNAzwwmgH4KFnUiI9i6hgaJ8/u1Y b6FPBXyfU3ddR2cOaBtDOI2lc3HPw11khg+9gud8C2w6IspIZQbca2GlEc93vOHQKCGdiP JfTngm2OIgT6yKMZHQrfyKRr4yGGV6xbrr1XVKHG1HD8Gl5f7Z8mv5VscDqRHVO/TDl0k0 0C1wVbMSApDtYrdSydiTcddOv8PqYRxu9FU5bd0GErruz74UUVKU/EzG1qZvFg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvWyP08Ygz8Xm for ; Tue, 07 Jul 2026 06:48:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 38155 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 06:48:12 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: af202a5052b6 - main - Retire dialog 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: af202a5052b6e9a1885d06941ffbba7630acb7df Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 06:48:12 +0000 Message-Id: <6a4ca12c.38155.7cd25101@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=af202a5052b6e9a1885d06941ffbba7630acb7df commit af202a5052b6e9a1885d06941ffbba7630acb7df Author: Dag-Erling Smørgrav AuthorDate: 2026-07-07 06:47:36 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-07-07 06:47:36 +0000 Retire dialog This is the last remaining piece of GPL software in the base system. The installer transitioned to bsddialog four years ago, and the last remaining dialog consumer, dpv, was turned off more than two years ago. Retire dpv, libdpv, libfigpar (used only by dpv), and dialog itself. Reviewed by: dteske Differential Revision: https://reviews.freebsd.org/D55424 --- MAINTAINERS | 3 - Makefile.inc1 | 6 - ObsoleteFiles.inc | 26 + contrib/dialog/CHANGES | 2461 -- contrib/dialog/COPYING | 504 - contrib/dialog/README | 61 - contrib/dialog/VERSION | 1 - contrib/dialog/aclocal.m4 | 7150 ------ contrib/dialog/argv.c | 168 - contrib/dialog/arrows.c | 277 - contrib/dialog/buildlist.c | 1268 -- contrib/dialog/buttons.c | 833 - contrib/dialog/calendar.c | 1016 - contrib/dialog/checklist.c | 702 - contrib/dialog/columns.c | 174 - contrib/dialog/config.guess | 1687 -- contrib/dialog/config.hin | 4 - contrib/dialog/config.sub | 1851 -- contrib/dialog/configure | 27284 ----------------------- contrib/dialog/configure.in | 285 - contrib/dialog/demo.pl | 337 - contrib/dialog/dialog-config.in | 254 - contrib/dialog/dialog.1 | 2041 -- contrib/dialog/dialog.3 | 3823 ---- contrib/dialog/dialog.c | 2144 -- contrib/dialog/dialog.h | 1002 - contrib/dialog/dialog.lsm | 23 - contrib/dialog/dialog.pl | 600 - contrib/dialog/dlg_colors.h | 280 - contrib/dialog/dlg_internals.h | 47 - contrib/dialog/dlg_keys.c | 973 - contrib/dialog/dlg_keys.h | 182 - contrib/dialog/editbox.c | 771 - contrib/dialog/formbox.c | 1002 - contrib/dialog/fselect.c | 962 - contrib/dialog/guage.c | 456 - contrib/dialog/headers-sh.in | 199 - contrib/dialog/help.c | 54 - contrib/dialog/inputbox.c | 274 - contrib/dialog/inputstr.c | 808 - contrib/dialog/install-sh | 294 - contrib/dialog/makefile.in | 363 - contrib/dialog/menubox.c | 814 - contrib/dialog/mixedform.c | 118 - contrib/dialog/mixedgauge.c | 408 - contrib/dialog/mouse.c | 162 - contrib/dialog/mousewget.c | 96 - contrib/dialog/msgbox.c | 204 - contrib/dialog/package/debian/changelog | 337 - contrib/dialog/package/debian/compat | 1 - contrib/dialog/package/debian/control | 33 - contrib/dialog/package/debian/copyright | 111 - contrib/dialog/package/debian/docs | 1 - contrib/dialog/package/debian/postinst | 7 - contrib/dialog/package/debian/rules | 140 - contrib/dialog/package/debian/source/format | 1 - contrib/dialog/package/debian/watch | 4 - contrib/dialog/package/dialog.map | 263 - contrib/dialog/package/dialog.spec | 110 - contrib/dialog/package/dialog.sym | 225 - contrib/dialog/package/freebsd/Makefile | 48 - contrib/dialog/package/freebsd/distinfo | 2 - contrib/dialog/package/freebsd/pkg-descr | 9 - contrib/dialog/package/freebsd/pkg-plist | 203 - contrib/dialog/pause.c | 259 - contrib/dialog/po/POTFILES.in | 32 - contrib/dialog/po/an.po | 111 - contrib/dialog/po/ar.po | 112 - contrib/dialog/po/ast.po | 115 - contrib/dialog/po/be@latin.po | 109 - contrib/dialog/po/bg.po | 112 - contrib/dialog/po/ca.po | 111 - contrib/dialog/po/cs.po | 114 - contrib/dialog/po/cy.po | 111 - contrib/dialog/po/da.po | 112 - contrib/dialog/po/de.po | 115 - contrib/dialog/po/dialog.pot | 120 - contrib/dialog/po/el.po | 111 - contrib/dialog/po/eo.po | 110 - contrib/dialog/po/es.po | 112 - contrib/dialog/po/et.po | 110 - contrib/dialog/po/eu.po | 112 - contrib/dialog/po/fa.po | 113 - contrib/dialog/po/fi.po | 114 - contrib/dialog/po/fr.po | 111 - contrib/dialog/po/fur.po | 113 - contrib/dialog/po/ga.po | 109 - contrib/dialog/po/gd.po | 111 - contrib/dialog/po/gl.po | 119 - contrib/dialog/po/hi.po | 113 - contrib/dialog/po/hr.po | 114 - contrib/dialog/po/hu.po | 114 - contrib/dialog/po/ia.po | 111 - contrib/dialog/po/id.po | 111 - contrib/dialog/po/is.po | 112 - contrib/dialog/po/it.po | 112 - contrib/dialog/po/ja.po | 112 - contrib/dialog/po/ku.po | 113 - contrib/dialog/po/lt.po | 112 - contrib/dialog/po/lv.po | 115 - contrib/dialog/po/makefile.inn | 249 - contrib/dialog/po/mg.po | 110 - contrib/dialog/po/mk.po | 111 - contrib/dialog/po/ms.po | 110 - contrib/dialog/po/nb.po | 108 - contrib/dialog/po/nl.po | 113 - contrib/dialog/po/pl.po | 113 - contrib/dialog/po/pt.po | 114 - contrib/dialog/po/pt_BR.po | 113 - contrib/dialog/po/rm.po | 113 - contrib/dialog/po/ro.po | 115 - contrib/dialog/po/ru.po | 115 - contrib/dialog/po/rw.po | 126 - contrib/dialog/po/sk.po | 111 - contrib/dialog/po/sl.po | 112 - contrib/dialog/po/sq.po | 113 - contrib/dialog/po/sr.po | 112 - contrib/dialog/po/sv.po | 110 - contrib/dialog/po/sw.po | 111 - contrib/dialog/po/th.po | 112 - contrib/dialog/po/tr.po | 115 - contrib/dialog/po/uk.po | 113 - contrib/dialog/po/vi.po | 113 - contrib/dialog/po/wa.po | 110 - contrib/dialog/po/zh_CN.po | 112 - contrib/dialog/po/zh_TW.po | 112 - contrib/dialog/prgbox.c | 118 - contrib/dialog/progressbox.c | 488 - contrib/dialog/rangebox.c | 421 - contrib/dialog/rc.c | 665 - contrib/dialog/rename.sh | 60 - contrib/dialog/run_test.sh | 58 - contrib/dialog/samples/README | 7 - contrib/dialog/samples/buildlist | 20 - contrib/dialog/samples/buildlist2 | 42 - contrib/dialog/samples/buildlist4 | 22 - contrib/dialog/samples/calendar | 11 - contrib/dialog/samples/calendar-stdout | 9 - contrib/dialog/samples/calendar2 | 11 - contrib/dialog/samples/calendar2-stdout | 9 - contrib/dialog/samples/calendar3 | 11 - contrib/dialog/samples/calendar3-stdout | 9 - contrib/dialog/samples/checklist | 28 - contrib/dialog/samples/checklist-8bit | 30 - contrib/dialog/samples/checklist-utf8 | 30 - contrib/dialog/samples/checklist1 | 28 - contrib/dialog/samples/checklist10 | 30 - contrib/dialog/samples/checklist11 | 33 - contrib/dialog/samples/checklist12 | 44 - contrib/dialog/samples/checklist2 | 28 - contrib/dialog/samples/checklist3 | 28 - contrib/dialog/samples/checklist4 | 28 - contrib/dialog/samples/checklist5 | 29 - contrib/dialog/samples/checklist6 | 30 - contrib/dialog/samples/checklist7 | 34 - contrib/dialog/samples/checklist8 | 33 - contrib/dialog/samples/checklist9 | 13 - contrib/dialog/samples/checklist9.txt | 21 - contrib/dialog/samples/copifuncs/copi.ifman1 | 29 - contrib/dialog/samples/copifuncs/copi.ifmcfg2 | 68 - contrib/dialog/samples/copifuncs/copi.ifmcfg4 | 30 - contrib/dialog/samples/copifuncs/copi.ifmcfg5 | 14 - contrib/dialog/samples/copifuncs/copi.ifpoll1 | 9 - contrib/dialog/samples/copifuncs/copi.ifreq1 | 20 - contrib/dialog/samples/copifuncs/copi.rcnews | 79 - contrib/dialog/samples/copifuncs/copi.sendifm2 | 15 - contrib/dialog/samples/copifuncs/copi.trnrc | 13 - contrib/dialog/samples/copifuncs/ifpatch | 101 - contrib/dialog/samples/debian.rc | 143 - contrib/dialog/samples/dft-cancel | 3 - contrib/dialog/samples/dft-extra | 3 - contrib/dialog/samples/dft-help | 3 - contrib/dialog/samples/dft-no | 3 - contrib/dialog/samples/dialog.py | 354 - contrib/dialog/samples/dselect | 11 - contrib/dialog/samples/editbox | 45 - contrib/dialog/samples/editbox-utf8 | 35 - contrib/dialog/samples/editbox2 | 45 - contrib/dialog/samples/editbox3 | 18 - contrib/dialog/samples/editbox4 | 45 - contrib/dialog/samples/form1 | 71 - contrib/dialog/samples/form1-both | 61 - contrib/dialog/samples/form1-extra | 61 - contrib/dialog/samples/form1-help | 61 - contrib/dialog/samples/form1-utf8 | 63 - contrib/dialog/samples/form2 | 84 - contrib/dialog/samples/form3 | 69 - contrib/dialog/samples/form4 | 70 - contrib/dialog/samples/form5 | 71 - contrib/dialog/samples/form6 | 71 - contrib/dialog/samples/fselect | 11 - contrib/dialog/samples/fselect-stdout | 9 - contrib/dialog/samples/fselect0 | 11 - contrib/dialog/samples/fselect1 | 20 - contrib/dialog/samples/fselect1-stdout | 18 - contrib/dialog/samples/fselect2 | 11 - contrib/dialog/samples/fselect2-stdout | 9 - contrib/dialog/samples/gauge | 22 - contrib/dialog/samples/gauge0 | 23 - contrib/dialog/samples/gauge0-input-fd | 27 - contrib/dialog/samples/gauge2 | 28 - contrib/dialog/samples/infobox | 21 - contrib/dialog/samples/infobox1 | 21 - contrib/dialog/samples/infobox2 | 21 - contrib/dialog/samples/infobox3 | 22 - contrib/dialog/samples/infobox4 | 22 - contrib/dialog/samples/infobox5 | 39 - contrib/dialog/samples/infobox6 | 41 - contrib/dialog/samples/inputbox | 20 - contrib/dialog/samples/inputbox-both | 22 - contrib/dialog/samples/inputbox-extra | 21 - contrib/dialog/samples/inputbox-help | 21 - contrib/dialog/samples/inputbox1 | 23 - contrib/dialog/samples/inputbox2 | 20 - contrib/dialog/samples/inputbox3 | 21 - contrib/dialog/samples/inputbox4 | 20 - contrib/dialog/samples/inputbox5 | 21 - contrib/dialog/samples/inputbox6-8bit | 17 - contrib/dialog/samples/inputbox6-utf8 | 18 - contrib/dialog/samples/inputbox7 | 29 - contrib/dialog/samples/inputmenu | 65 - contrib/dialog/samples/inputmenu-stdout | 63 - contrib/dialog/samples/inputmenu1 | 85 - contrib/dialog/samples/inputmenu2 | 97 - contrib/dialog/samples/inputmenu3 | 106 - contrib/dialog/samples/inputmenu4 | 86 - contrib/dialog/samples/install/FDISK.TEST | 28 - contrib/dialog/samples/install/makefile.in | 35 - contrib/dialog/samples/install/setup.c | 371 - contrib/dialog/samples/install/setup.help | 49 - contrib/dialog/samples/killall | 16 - contrib/dialog/samples/listing | 8 - contrib/dialog/samples/menubox | 27 - contrib/dialog/samples/menubox-8bit | 29 - contrib/dialog/samples/menubox-utf8 | 29 - contrib/dialog/samples/menubox1 | 27 - contrib/dialog/samples/menubox10 | 22 - contrib/dialog/samples/menubox11 | 31 - contrib/dialog/samples/menubox12 | 43 - contrib/dialog/samples/menubox2 | 27 - contrib/dialog/samples/menubox3 | 27 - contrib/dialog/samples/menubox4 | 27 - contrib/dialog/samples/menubox5 | 30 - contrib/dialog/samples/menubox6 | 28 - contrib/dialog/samples/menubox7 | 29 - contrib/dialog/samples/menubox8 | 30 - contrib/dialog/samples/menubox9 | 26 - contrib/dialog/samples/mixedform | 53 - contrib/dialog/samples/mixedform2 | 53 - contrib/dialog/samples/mixedgauge | 26 - contrib/dialog/samples/msgbox | 13 - contrib/dialog/samples/msgbox-help | 14 - contrib/dialog/samples/msgbox-utf8 | 14 - contrib/dialog/samples/msgbox1 | 34 - contrib/dialog/samples/msgbox2 | 34 - contrib/dialog/samples/msgbox3 | 22 - contrib/dialog/samples/msgbox4-8bit | 33 - contrib/dialog/samples/msgbox4-eucjp | 25 - contrib/dialog/samples/msgbox4-utf8 | 39 - contrib/dialog/samples/msgbox5 | 23 - contrib/dialog/samples/msgbox6 | 17 - contrib/dialog/samples/msgbox6a | 17 - contrib/dialog/samples/password | 20 - contrib/dialog/samples/password1 | 21 - contrib/dialog/samples/password2 | 21 - contrib/dialog/samples/passwordform1 | 61 - contrib/dialog/samples/passwordform1-utf8 | 63 - contrib/dialog/samples/pause | 10 - contrib/dialog/samples/pause-both | 14 - contrib/dialog/samples/pause-extra | 13 - contrib/dialog/samples/pause-help | 12 - contrib/dialog/samples/prgbox | 9 - contrib/dialog/samples/prgbox2 | 9 - contrib/dialog/samples/programbox | 22 - contrib/dialog/samples/programbox2 | 22 - contrib/dialog/samples/programbox3 | 22 - contrib/dialog/samples/progress | 22 - contrib/dialog/samples/progress2 | 22 - contrib/dialog/samples/radiolist | 28 - contrib/dialog/samples/radiolist1 | 33 - contrib/dialog/samples/radiolist10 | 30 - contrib/dialog/samples/radiolist2 | 30 - contrib/dialog/samples/radiolist3 | 30 - contrib/dialog/samples/radiolist4 | 30 - contrib/dialog/samples/rangebox | 11 - contrib/dialog/samples/rangebox2 | 11 - contrib/dialog/samples/rangebox3 | 11 - contrib/dialog/samples/rangebox4 | 11 - contrib/dialog/samples/report-button | 25 - contrib/dialog/samples/report-edit | 27 - contrib/dialog/samples/report-string | 28 - contrib/dialog/samples/report-tempfile | 28 - contrib/dialog/samples/report-yesno | 25 - contrib/dialog/samples/rotated-data | 23 - contrib/dialog/samples/run_test.sh | 56 - contrib/dialog/samples/setup-edit | 7 - contrib/dialog/samples/setup-tempfile | 6 - contrib/dialog/samples/setup-utf8 | 12 - contrib/dialog/samples/setup-vars | 24 - contrib/dialog/samples/shortlist | 19 - contrib/dialog/samples/slackware.rc | 142 - contrib/dialog/samples/sourcemage.rc | 142 - contrib/dialog/samples/suse.rc | 142 - contrib/dialog/samples/tailbox | 16 - contrib/dialog/samples/tailboxbg | 22 - contrib/dialog/samples/tailboxbg1 | 32 - contrib/dialog/samples/tailboxbg2 | 33 - contrib/dialog/samples/testdata-8bit | 48 - contrib/dialog/samples/textbox | 44 - contrib/dialog/samples/textbox-both | 21 - contrib/dialog/samples/textbox-help | 20 - contrib/dialog/samples/textbox.txt | 24 - contrib/dialog/samples/textbox2 | 44 - contrib/dialog/samples/textbox3 | 20 - contrib/dialog/samples/timebox | 14 - contrib/dialog/samples/timebox-stdout | 10 - contrib/dialog/samples/timebox2 | 11 - contrib/dialog/samples/timebox2-stdout | 10 - contrib/dialog/samples/treeview | 22 - contrib/dialog/samples/treeview2 | 52 - contrib/dialog/samples/treeview4 | 24 - contrib/dialog/samples/wheel | 65 - contrib/dialog/samples/whiptail.rc | 142 - contrib/dialog/samples/with-dquotes | 3 - contrib/dialog/samples/with-squotes | 3 - contrib/dialog/samples/yesno | 21 - contrib/dialog/samples/yesno-both | 24 - contrib/dialog/samples/yesno-extra | 23 - contrib/dialog/samples/yesno-help | 18 - contrib/dialog/samples/yesno-utf8 | 14 - contrib/dialog/samples/yesno2 | 18 - contrib/dialog/samples/yesno3 | 18 - contrib/dialog/samples/yesno4 | 18 - contrib/dialog/tailbox.c | 433 - contrib/dialog/textbox.c | 1004 - contrib/dialog/timebox.c | 430 - contrib/dialog/trace.c | 280 - contrib/dialog/treeview.c | 674 - contrib/dialog/ttysize.c | 87 - contrib/dialog/ui_getc.c | 681 - contrib/dialog/util.c | 3047 --- contrib/dialog/version.c | 33 - contrib/dialog/yesno.c | 171 - gnu/lib/Makefile | 1 - gnu/lib/libdialog/Makefile | 20 - gnu/lib/libdialog/Makefile.depend | 18 - gnu/lib/libdialog/dlg_config.h | 126 - gnu/usr.bin/Makefile | 1 - gnu/usr.bin/dialog/Makefile | 8 - gnu/usr.bin/dialog/Makefile.depend | 19 - lib/Makefile | 2 - lib/libdpv/Makefile | 14 - lib/libdpv/Makefile.depend | 21 - lib/libdpv/dialog_util.c | 637 - lib/libdpv/dialog_util.h | 70 - lib/libdpv/dialogrc.c | 357 - lib/libdpv/dialogrc.h | 54 - lib/libdpv/dprompt.c | 764 - lib/libdpv/dprompt.h | 57 - lib/libdpv/dpv.3 | 529 - lib/libdpv/dpv.c | 728 - lib/libdpv/dpv.h | 163 - lib/libdpv/dpv_private.h | 65 - lib/libdpv/status.c | 109 - lib/libdpv/status.h | 41 - lib/libdpv/util.c | 104 - lib/libdpv/util.h | 48 - lib/libfigpar/Makefile | 18 - lib/libfigpar/Makefile.depend | 15 - lib/libfigpar/figpar.3 | 263 - lib/libfigpar/figpar.c | 464 - lib/libfigpar/figpar.h | 97 - lib/libfigpar/string_m.c | 304 - lib/libfigpar/string_m.h | 41 - lib/libsysdecode/Makefile.depend | 3 - share/man/man3/intro.3 | 7 +- share/man/man5/src.conf.5 | 9 +- share/mk/bsd.libnames.mk | 3 - share/mk/src.libnames.mk | 6 - share/mk/src.opts.mk | 1 - targets/pseudo/userland/lib/Makefile.depend | 5 - tools/build/mk/OptionalObsoleteFiles.inc | 34 - tools/build/options/WITHOUT_DIALOG | 6 - tools/build/options/WITH_DIALOG | 6 - usr.bin/Makefile | 1 - usr.bin/dpv/Makefile | 9 - usr.bin/dpv/Makefile.depend | 20 - usr.bin/dpv/dpv.1 | 448 - usr.bin/dpv/dpv.c | 543 - usr.bin/dpv/dpv_util.h | 66 - 390 files changed, 28 insertions(+), 95078 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 4f4d15869c81..818b52175f9e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -58,9 +58,7 @@ fusefs(4) asomers Pre-commit review requested. geli pjd Pre-commit review requested (both sys/geom/eli/ and sbin/geom/class/eli/). iwm(4) adrian Pre-commit review requested, send to freebsd-wireless@freebsd.org iwn(4) adrian Pre-commit review requested, send to freebsd-wireless@freebsd.org -libdpv dteske Pre-commit review requested. Keep in sync with dpv(1). libfetch des Pre-commit review requested. -libfigpar dteske Pre-commit review requested. libm freebsd-numerics Send email with patches to freebsd-numerics@ libpam des Pre-commit review requested. linprocfs des Pre-commit review requested. @@ -120,7 +118,6 @@ tools/build imp,jrtc27 Pre-commit review requested, especially to fix bootstrap top(1) eadler Pre-commit review requested. ufshci(4) jaeyoon Pre-commit review requested. usr.sbin/bsdconfig dteske Pre-commit phabricator review requested. -usr.sbin/dpv dteske Pre-commit review requested. Keep in sync with libdpv. usr.sbin/pkg pkg@ Please coordinate behavior or flag changes with pkg team. usr.sbin/sysrc dteske Pre-commit phabricator review requested. Keep in sync with bsdconfig(8) sysrc.subr. vmm(4) #bhyve Pre-commit review requested via #bhyve phabricator group. diff --git a/Makefile.inc1 b/Makefile.inc1 index f7d68dd0b4bd..6d82baeda643 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -3345,7 +3345,6 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ lib/libbz2 ${_libcom_err} lib/libcrypt \ lib/libc++ \ lib/libelf lib/libexpat \ - lib/libfigpar \ ${_lib_libgssapi} \ lib/libjail \ lib/libkiconv lib/libkldelf lib/libkvm \ @@ -3384,11 +3383,6 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ ${_secure_lib_libcrypto} ${_secure_lib_libssl} \ ${_lib_libldns} ${_secure_lib_libssh} -.if ${MK_DIALOG} != "no" -_prebuild_libs+= gnu/lib/libdialog -gnu/lib/libdialog__L: lib/msun__L lib/ncurses/tinfo__L lib/ncurses/ncurses__L -.endif - .if ${MK_GOOGLETEST} != "no" _prebuild_libs+= lib/libregex .endif diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 071fb20e870a..21160613a725 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -51,6 +51,32 @@ # xargs -n1 | sort | uniq -d; # done +# 20260707: Removed dialog, figpar, dpv +OLD_FILES+=usr/bin/dialog +OLD_FILES+=usr/bin/dpv +OLD_FILES+=usr/lib/libdialog.a +OLD_FILES+=usr/lib/libdialog.so +OLD_LIBS+=usr/lib/libdialog.so.10 +OLD_FILES+=usr/lib/libdpv.a +OLD_FILES+=usr/lib/libdpv.so +OLD_LIBS+=usr/lib/libdpv.so.3 +OLD_FILES+=usr/lib/libfigpar.a +OLD_FILES+=usr/lib/libfigpar.so +OLD_LIBS+=usr/lib/libfigpar.so.0 +OLD_FILES+=usr/share/man/man1/dialog.1.gz +OLD_FILES+=usr/share/man/man1/dpv.1.gz +OLD_FILES+=usr/share/man/man3/dialog.3.gz +OLD_FILES+=usr/share/man/man3/dpv.3.gz +OLD_FILES+=usr/share/man/man3/dpv_free.3.gz +OLD_FILES+=usr/share/man/man3/figpar.3.gz +OLD_FILES+=usr/share/man/man3/get_config_option.3.gz +OLD_FILES+=usr/share/man/man3/parse_config.3.gz +OLD_FILES+=usr/share/man/man3/replaceall.3.gz +OLD_FILES+=usr/share/man/man3/strcount.3.gz +OLD_FILES+=usr/share/man/man3/strexpand.3.gz +OLD_FILES+=usr/share/man/man3/strexpandnl.3.gz +OLD_FILES+=usr/share/man/man3/strtolower.3.gz + # 20260602: Removed by 0a36787e4c1f on 20210723 OLD_FILES+=usr/share/locale/hr_HR.ISO8859-2/LC_MESSAGES OLD_FILES+=usr/share/locale/nl_BE.ISO8859-1/LC_MESSAGES diff --git a/contrib/dialog/CHANGES b/contrib/dialog/CHANGES deleted file mode 100644 index 8e5d22e400a3..000000000000 --- a/contrib/dialog/CHANGES +++ /dev/null @@ -1,2461 +0,0 @@ --- $Id: CHANGES,v 1.723 2021/01/17 20:21:41 tom Exp $ --- Thomas E. Dickey - -This version of dialog was originally from a Debian snapshot. I've done this -to it: - -2021/01/17 - + updated dialog.pot - + add option --no-hot-list, to allow suppressing the hotkey feature - from lists. - + increase minimum height of inputbox to avoid input field overlapping - with the button-box (report by Victor Ananjevsky). - + modify options-parsing to permit a "no" on any boolean option and - deprecating the "no" options without a "-" , e.g., generalizing on - "--nook" equivalence to "--no-ok". - -2021/01/12 - + minor spelling fixes, per codespell - + update configure macros, for quoting/escaping fixes per shellcheck - + update config.guess, config.sub - -2020/11/26 - + modify configure script's compiler check to work around Xcode's - useless aliases for standard C. - + enable keep-tite feature for NetBSD 8 and up; earlier releases would - dump core. - > new features/fixes (Glenn Herteg) - + add option "--cursor-off-label" - + add option "--erase-on-exit" - + fix errata in manpage. - + fix logic: dlg_button_to_char() would return wrong value if no - uppercase was found - -2020/11/25 - + add DIALOG_TIMEOUT to sample scripts, and use report-button more - consistently to handle unexpected exit-status values. - -2020/11/24 - + add dlg_getenv_num() and dlg_getenv_str(). - + add DLG_EXIT_TIMEOUT to allow scripts to exit on an expired timeout - with an exit-status different from DLG_EXIT_ERROR or DLG_EXIT_ESC - (patch by Norbert Koch). - -2020/11/23 - + modify dlg_ok_label() and dlg_ok_labels() to ignore --no-ok if all - buttons would be omitted. - + add/use dlg_der_window() to account for derived windows just like - subwindows, to fix regression in dlg_getc() in fselect/dselect - widget. - + modify several widgets to make their handling of --no-ok consistent - with the majority of the widgets: editbox.c, menubox.c, msgbox.c, - rangebox.c, textbox.c, timebox.c - + add ^D as binding for new virtual key DLGK_LEAVE, which will close - the current dialog by activating the currently-selected button. - + improve manual-page description of --no-ok option (reports by - Hans Mueller, Gil Delescluse). - + modify configure script to make Solaris -R rpath feature work - -2020/11/21 - + fix regression in dlg_getc() caused by not taking into account - subwindows used for input (report by Michael Wihl). - -2020/11/20 - + add validity-checks for window pointer (report/testcase by Michael - Wihl). - + improve configure macros: - CF_CLANG_COMPILER: apply compiler-flags needed for test. - CF_WITH_SCREEN_PDCURSES: use this to reduce X11-checks. - -2020/11/17 - + amend initialization for dlg_getc to fix regression in pause widget - from 2020/03/27 changes (reports by Aidan Tessier, Norbert Koch, - Josmar Pierri). - + improve configure macros: - CF_CLANG_COMPILER: split-out check for -Qunused-arguments to ensure - that clang supports it. IBM xlclang does not. - CF_MIXEDCASE_FILENAMES: when cross-compiling to darwin (macOS), - assume the filesystem doesn't support mixed-case - -2020/09/21 - + modify init_dialog's initialization of tab_len and aspect_ratio to - avoid overwriting initialization done in process_common_options - (report/patch by Rainer Weikusat, Debian #970508). - -2020/09/13 - + fix out-of-order description for --tailbox vs --rangebox in manpage - (report by Glenn Herteg). - + updated configure-macros: compiler-warnings and shared-library - options. Changed configure --with-warnings to --enable-warnings for - consistency. - + update config.guess - -2020/04/01 - + updated sq.po from - http://translationproject.org/latest/dialog/ - -2020/03/27 - + add clarification in manual page to show when the single/double - quotes may be needed (prompted by discussion with Danilo G Baio). - + fix an extra ".exe" in makefile.in which prevented Cygwin build. - + fix most cppcheck warnings - + tailbox/tailboxbg's exit-button now works with mouse-clicks - + fix repainting while resizing for the editbox widget. - + add configure-check for curses_exit() from ncurses 6.2 - + fix a few memory leaks in fselect.c, mixedgauge.c when resizing. - + fix inconsistency in dlg_string_to_argv() which made the checklist9 - example not work. - + add empty-string check in dlg_print_listitem() to avoid indexing past - the end of the array of character-offsets. - + improve handling of KEY_RESIZE by repainting the backtitle after - clearing the screen (integrated patch by Rainer Weikusat, Debian - #954185). - + improve logic for wtimeout() calls which are used to set temporary - non-blocking reads (prompted by patch by Rainer Weikusat, Debian - #954220). - + add "make check" rule. - + updated configure-macros. - -2020/02/28 - + updated configure-macros, to work around ncurses vs xcode's c99 -W - + update config.guess - -2019/12/31 - + updated configure-macros. - + update config.guess - -2019/12/10 - + correct rc-file lookup of "default" color (report by Grady Martin, - cf: 2019/09/24). - + fix several issues in the sample scripts reported by shellcheck. - + fix a few spelling errors reported by codespell (report by Jens - Schleusener). - + correct check for return-value of isblank(), which is not necessarily - 0/1 (report/patch by Paul Cercueil, Peter Korsgaard, cf: 2018/05/31). - -2019/12/09 - + amend change for parsing command-options before calling init_dialog, - to handle --no-shadow, etc., which are initialized in init_dialog - (report by Paul Cercueil, cf: 2018/06/21). - + add dlg_trace_va_msg to manpage, symbol files. - -2019/11/10 - + improve layout of several widgets' data area when maximizing. - + modify dselect/fselect to work with autosizing (Debian #915949). - + add error messages from dlg_exiterr() to trace file. - + improve manual page description of escaping in key-bindings. - + modify inputmenu to recognize the "Cancel" button and keys bound to - that feature while editing a renamed menu item. - + revert one change, in form.c to the --last-key feature (Debian - #942025). - + correct ordering of libraries in configure-script, which appended - in a case where it should have prepended. - + update config.guess, config.sub - -2019/09/26 - + improve dialog-config script's filtering of -L options using the - linker default directories. - + improve dialog-config script, adding a -L option corresponding to - the configure --libdir option if it would be a duplicate (report by - Andrew Kosteltsev). - + build-fix for configure --disable-trace - + updated pt.po from - http://translationproject.org/latest/dialog/ - -2019/09/24 - + allow for underline- and reverse-video flags in the ".rc" file - (integrated patch by Richard Robbins). - -2019/08/08 - + amend change to --last-key feature to eliminate an unnecessary - separator (report by Gabriele Balducci). - -2019/08/06 - + extend --last-key feature to the remaining widgets which have - ok/cancel buttons, and add logic to map keys which happen to be - bound to ok/extra/cancel/help to simulate a button-press on the - corresponding button (report by "sgewrk"). - -2019/08/01 - + further fixes for dialog-config.in (report by Andrew Kosteltsev). - -2019/07/28 - + modify dialog-config.in so that setting prefix or exec-prefix to - a given value with --prefix=VALUE or --exec-prefix=VALUE has the - expected result of changing bindir, etc. - + correct substitution for $LIBS value in dialog-config.in (report by - Andrew Kosteltsev). - -2019/07/24 - + modify dlg_will_resize() and dlg_result_key() functions to reduce - the chance that dialog exits on a SIGWINCH (Debian #930775). - + make test-package for the development headers/library - + add --libs-only-L, etc., to dialog-config script (prompted by - discussion with Andrew Kosteltsev). - + fix a memory leak in gauge widget (Andrew Kosteltsev). - + minor fix for CF_GCC_WARNINGS - + update config.guess, config.sub - -2019/02/11 - + modify to work with ncurses' threaded-library, which does not allow - assignment to LINES/COLS (report by Marcus Roeckrath). - + correct clearing after text in progressbox from 2018/06/21 changes - for resizing (reports by David Boyd, Alan Somers). - + improved configure macros CF_GNU_SOURCE, CF_POSIX_C_SOURCE, - CF_XOPEN_SOURCE - + update config.guess, config.sub - -2018/11/07 - + convert ja.po to UTF-8 for consistency (suggested by Stanislav - Brabec). - + repair mis-encoded hi.po (report/analysis by Stanislav Brabec). - -2018/10/22 - + improved configure macros CF_CC_ENV_FLAGS, CF_LD_RPATH_OPT, - CF_LIBRARY_PATH, CF_SHARED_OPTS, CF_WITH_MAN2HTML, - CF_WITH_VERSIONED_SYMS from ncurses - + add ast.po, from - http://translationproject.org/latest/dialog/ - -2018/06/21 - + improve file-offset computation in textbox.c (Werner Fink). - + fix an overlooked case with real_auto_size() to maximize when - height or width is given as -1. - + build-fixes for configure options "--disable-Xdialog2" and - "--disable-form" - + add traces for each widget to show its parameters. - + modify color scheme for mixedgauge to use the dialog window colors, - like the captions. - + fix a too-small malloc in the mixedgauge widget. - + fix a use-after-free in dlg_remove_callback(). - + improve handling of SIGWINCH for several widgets (Debian #865840). - + menubox, the point of the Debian report was that it would be nice - to increase the window size if the terminal size increases. Did - that as a special case less problematic than decreasing the - terminal size. Added samples/menubox11 to demonstrate by - comparison with menubox10 a problem with debconf which puts extra - newlines in the caption that interfere with autowrap. - + progressbox and derived prgbox, programbox, now handle resizing. - + yesno, window was cleared - + add dlg_ttysize() to support new options, allowing scripts to obtain - some text-formatting details without initializing the terminal. - + add options --print-text-only, and --print-text-size for scripts that - adjust the widget size according to how the captions are formatted. - + improve dialog.pl: - + add demo.pl, to demonstrate the functions - + quote/escape string parameters passed to dialog. - + ensure all "integer" parameters are really integers. - + use actual screensize for list captions rather than assuming 24 - lines. - + when trimming blanks, treat unconverted tabs the same as spaces. - + correct parameter to test when trimming blanks from the script, - e.g., with "--trim" (report by Jarno Suni). - + improve documentation of the various whitespace-filtering options, - to show which take precedence (Debian #867536, cf: Debian #102942). - + modify msgbox.c, yesno.c to bind SCROLLKEY_BINDINGS before - TRAVERSE_BINDINGS so that up/down arrow will by default scroll the - message up/down rather than be aliases for tab-traversal (report by - Fredrik Kers). - + modify dump_one_binding() to show when a binding is overridden. - + improve format of trace-file, making comment-syntax consistent, - as well as showing argv-splitting as a series of comments. - + modify dlg_string_to_argv() to change the quoting behavior to be - more consistent with shell behavior (patch by Denilson Sa Maia). - + modify dlg_getc() to return ESC when a timeout expires, notifying - callers that a quit occurred rather than exiting the application - (suggested by Rodrigo Freitas). - + modify handle_inputs() to ensure cursor-visibility is restored when - there is no input character available (report by Guillaume Vareille). - + improve comment in manual page regarding which widgets can use the - "--help-button" (prompted by discussion with Csanyi Pal). - + add a check for valid object pointer in tailbox's main loop since - the getc-callback may have been freed within ui_getc.c (report by - "David"). - + improved configure macros for ncurses: CF_GNU_SOURCE, CF_SHARED_OPTS, - CF_CURSES_LIBS, CF_CURSES_FUNCS, CF_NCURSES_CONFIG - + improved configure script checks for groff vs man2html: - CF_PROG_GROFF and CF_WITH_MAN2HTML - + build-fix from lynx for AM_WITH_NLS configure macro - + update config.guess, config.sub - -2017/12/09 - + update ftp url in test-packages. - + modify test-packages to use recommended compiler/linker flags. - + improved configure macros AM_WITH_NLS, CF_CC_ENV_FLAGS, - CF_CURSES_LIBS, CF_NCURSES_CONFIG, CF_SHARED_OPTS, CF_WITH_LIBTOOL, - CF__INTL_BODY. - + update config.guess, config.sub - -2017/05/09 - + improved configure macros CF_ADD_CFLAGS, CF_CC_ENV_FLAGS, and - CF_SHARED_OPTS. - + updated hu.po and tr.po from - http://translationproject.org/latest/dialog/ - + update config.guess, config.sub - -2017/01/31 - + use DLG_TRACE macro consistently to make "--disable-trace" configure - option work. - + modify buildlist widget to support option "--reorder" for to allow - user to reorder the data based on the sequence of selections - (discussion with Paraic O'Ceallaigh). - + fill background color on unused parts of buildlist. - + fix a minor error in buildlist which let pageup switch columns. - + change several calls to dlg_trace_msg to prefix with "#" to make - the trace logs more consistent for parsing. - + add samples/run_test.sh - + further improve performance with very long command-lines by changes - to howmany_tags(). - + modify dlg_string_to_argv() to convert escaped double-quotes to - plain double-quotes when within a double-quoted string. - + modify makefile to apply CFLAGS to linking - + modify dlg_string_to_argv() to ignore escaped newlines except when - quoted, fixing a problem with samples/checklist9. - + interpret $DIALOGOPTS before expanding "--file", etc., to allow - the environment variable to turn on tracing in that process. - + improve performance when processing very long command lines, e.g., - using "--file" by changing dialog_opts[] to an array of pointers to - the expanded argv[] (discussion with Lars Tauber). - + modified autoconf macros - + CF_CC_ENV_FLAGS amend the last change to move only the - preprocessor, optimization and warning flags to CPPFLAGS and - CFLAGS, leaving the residue in CC. That happens to work for gcc's - various "model" options, but may require tuning for other compilers - + CF_LARGEFILE workaround for clang exit-code vs warnings - + CF_MATH_LIB quiet strict gcc warning - + CF_WITH_LIBTOOL fix a few places in configure/build scripts where - DESTDIR and rpath were combined - + CF_XOPEN_SOURCE add "uclinux" to list of Linux's - + update config.guess, config.sub - -2016/11/20 - + added fur.po (Friulian) from - http://translationproject.org/latest/dialog/ - -2016/08/28 - + improve parsing and trace for "bindkey", to convert space to/from - "\s", as well as handle octal escapes for single byte characters. - + change explicit checks for space character used for select or toggle - to make this rebindable to "TOGGLE" (prompted by discussion with - Paul van Tilburg). - + add default bindings for cursor left/right to formbox. The cursor - left/right cases were replaced with rebindable symbols in 2005/12/07 - without providing these keys as default values (report/patch by - Miroslav Lichvar). - + modified autoconf macros - + CF_PROG_LINT add cpplint to programs to use; drop ad hoc tdlint and - alint. - + CF_CC_ENV_FLAGS don't limit the check to -I, -U and -D options, - since the added options can include various compiler options before - and after preprocessor options. - + CF_GNU_SOURCE recent glibc (Debian 2.23-4 for example) has - misordered ifdef/checks for new symbol _DEFAULT_SOURCE, producing - warning messages when only _GNU_SOURCE is defined. Add a followup - check to define _DEFAULT_SOURCE. - + CF_XOPEN_SOURCE use _GNU_SOURCE for cygwin headers, tested with - cygwin 2.3, 2.5 (patch by Corinna Vinschen). - + mention --no-collapse option in manual page description of - --tab-correct option. - + update config.guess, config.sub - -2016/04/24 - + fix a special case in drawing shadow on a line-drawing cell where the - alternate-character set flag was lost (report by Martin Kravec). - + fix a regression from 2015/05/13 changes for escaping; it is - necessary to retain backslashes within quotes to make "\Z" escapes - work (report by Marcin Krol). - + fix test package for RPMs; changes in 2015 omitted symbolic links - for the library. - + fix typo in help message for "--buildlist" (report by Rihards Olups). - + modified autoconf macros - + CF_PROG_AR, CF_AR_FLAGS added to improve check for archive tool. - + CF_LD_RPATH_OPT, change FreeBSD to use -Wl,-rpath rather than - -rpath option. According to FreeBSD #178732, either works since - FreeBSD 4.x; however scons does not accept anything except the - -Wl,-rpath form. - + CF_WITH_NCURSES_ETC, change from ncurses to check for pthreads - dependency. - -2016/02/09 - + modify editbox widget to add a trailing newline if the text has none - to ensure the last line is not ignored (report by Florent Rougon). - + change mouse initialization to look for button-presses rather than - button-clicks, for better response. - + modify dump_curses_key() to show mouse-coding in readable form. - + correct mapping of mouse-clicks on the day-grid in calendar widget - when "--week-start" is used to set the start of the week (report by - Stefan Vogtner). - > integrated changes from Stefan Vogtner: - + use Gregorian algorithm for leap year - + use mktime if available; calendar was written just as it became - standard. - -2016/01/26 - release 1.3 - + correct --infobox documentation, which said it shows an OK button. - + fix a couple of place in test-scripts which referred to $SIG_TRAP - rather than $SIG_QUIT - + reorganize dialog.3, to use subsections for generating navigation - pane, using man2html - + add "--week-start" option for calendar widget (prompted by discussion - with Stefan Vogtner). - + add a limit-check in editbox.c to ensure that mouse-clicks outside - the filled-in text area do not access past the end of the array - (report by Stefan Vogtner). - + update configure macros from ncurses changes. - + update config.guess, config.sub - -2015/09/20 - + decrease table value for minimum number of arguments for the widgets - which use --no-items option (report by Raven Singularity). - + update configure macros: - + use $SHELL consistently, deprecate non-POSIX shell - + PKG_CONFIG may simply be unset - fix - + add option to allow changing ABI version, from ncurses6. - -2015/05/28 - + fixes for two autoconf macros, CF_ADD_INCDIR and CF_NCURSES_CONFIG - from work on ncurses. - + build-fix for NetBSD curses (patch by Matthias Scheler). - -2015/05/13 - + add configure option --with-install-prefix, like ncurses. - + add --with-screen and related configure options from ncurses-examples - to allow building with ncurses6 test-packages. - + update configure macros for improved coding style from lynx changes. - + updated ro.po from - http://translationproject.org/latest/dialog/ - + update config.guess, config.sub - > patches by Florent Rougon: - + fix two bugs in the "--file" option. - + When the number of arguments read from the included file is 0, the - code used to just skip over '--file' and its argument instead of - removing them from the argument list, causing "Error: Unknown - option --file" later on. - + In the alternative case (at least one argument read from the file), - the previous code used to do '--j;' in order to "force rescan" of - the inserted arguments. However, control then flowed to outer - blocks where a '++j;' counteracted this measure, causing "Error: - Unknown option --msgbox" (for instance) later on. - + modify escaping in argv.c to be more uniform, whether or not the - backslash is found within a parameter. - -2015/02/25 - + modify gauge widget to keep from erasing a second gauge widget, e.g., - via the "--and-widget" option. This is a cosmetic change to match - behavior of dialog 1.0 (report by Jason Orendorf). - + add configure option "--with-man2html" - + add configure options for versioned symbols, from ongoing work on - ncurses. - + update configure macros, e.g., for shared libraries - -2015/01/25 - + suppress highlighting of character which denotes an abbreviation or - shortcut for the OK/Cancel and other buttons for these widgets, which - use abbreviations for the list shown on the screen: buildlist, - checklist/radiobox, menubox, treeview (Debian #775295). - + add grid up/left and down/right bindings in editbox.c as synonyms for - field prev and next, respectively when handling the OK/Cancel buttons - (Debian #775294). - -2014/09/11 - + correct malloc-size for change to prgbox. - -2014/09/10 - + fixes to make "-c" option work when passing command to shell for the - prgbox widget, for example in samples/prgbox2 (report by Korantin - Auguste). - -2014/09/08 - + fix an out-of-bounds array index in buildlist widget (report by - Cade Foster). - -2014/09/01 - + add configure check for groff, needed for html/ps/pdf output. - + update configure-script macros: - + CF_ACVERSION_CHECK - work around another gratuitous incompatibility - introduced in 2.69 - + CF_ADD_CFLAGS - workaround for ash-shell, e.g., with Minix - + CF_ADD_LIBS - filter out duplicates - + CF_CURSES_FUNCS - improve workaround for weak-linkage, seems to fix - tests with NetBSD 6.1 - + CF_INTEL_COMPILER - clean up the -no-gcc option which was leftover - from testing. - + CF_LIB_SUFFIX - change suffix for AIX shared libraries to ".so". - + CF_MAKEFLAGS - workaround for GNU make 4.0 incompatibility with - previous releases. - + CF_XOPEN_SOURCE - add cases for Minix, UnixWare and improve the *** 97031 LINES SKIPPED *** From nobody Tue Jul 7 06:48:14 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 4gvWyQ2VQjz6l1sY for ; Tue, 07 Jul 2026 06:48:14 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvWyQ1rVgz46V7 for ; Tue, 07 Jul 2026 06:48:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783406894; 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=7SF1y+yH5WIC33+o1X+v5qR1uAQT8/zwAN9OkW2W5p8=; b=a56W35TeXsRkVNm69s1Sinkz0tlHlrmrzYu/5TLz75By5S0FvPUNW31F6B1Z5iqSLrtRlR P7RD8Yi4NU/yCmZq8JnlbnlBck2cPm8CnB3+0S4EnVooExkcE0lQ0zN6We/3YTSWLYqUhG tk0feEpysvUfswD71V46Him8xgq617mqv6Ftb/3IrRUNm7oaJs+HO48A3a+jytvFXIX8nV JkYLN3SiWp/6W+vpSl68EMGwtSp82i+H90i9bxg4alV09E3kRa2mdw6NjoIsm02X5fqI2X SWg4Rnx2Cymq+lDFK/q/gCtOPDHhkuP+W+FISf1OdDgmX2ausxpiHNT+7G7Nnw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783406894; a=rsa-sha256; cv=none; b=wz6RDCvRZGp58d4pjCxE5bNcpKtE9vn4WxVWmG6tF1lj+kL6R/GKL+xTv9OIuycjpXoCkg TO8hUC/n3b3Xl0rKJcdb2Osv3UZozj7jC799GFjNS7BJEIcJQ9Gg7IZK0whsJ7J04DQnSa oY8lVMMBb5C7JN+k3zNBV8YqVmvxVpDuB53cxAzKKdhNlEgeYwyYnGeGAvSAkDFFHbgm9+ +SbGpFv2zgPvLWgVavVq/WWPiWvNC32OIRvZp4OdELleaQUOiJMnTkZD3jPJOVSerRMbPC HhiVSIgkdX/ieoZMnWKzYcP918tVNtunuiv+RK3VygYlKQ31oQdklGcQ/pGI+g== 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=1783406894; 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=7SF1y+yH5WIC33+o1X+v5qR1uAQT8/zwAN9OkW2W5p8=; b=wZJEy9qsIIpjJSASqu4nlQSL7GnqFN/EBfXFivOI81MIQ60c+Vo+AZ5OVojO5PeFko032T N5Ynzxa3CXkkWAlmOkvcYiQFtzG5WnFCkw0VW86wHQ1vfwf5gB8HW/FYLO9VDxkpjzduOd aWQORjN4SJ9bRtmShIxHANHeoxCFVMQthmdIUYmkGn31CSmG92q8vG96KnjZem9ATwBK0p meEDT2ZOngiPv+/kUfaQTcNTSiuW4e0Jk4elQXjEbHWRIDwdayJqw0aOP6DNHl2oEZeCmM lFHnVUsexuQ/IS8FoOh4ikxbVWo8GhFo0bHp5TFVpI3rhW099kLn3HLblu3tJQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvWyQ0gxQz8Tn for ; Tue, 07 Jul 2026 06:48:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3667c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 06:48:14 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 134a4c78d070 - main - Retire the GNU subtree 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 134a4c78d070f8c4ea43a060a7ae28d22ac39558 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 06:48:14 +0000 Message-Id: <6a4ca12e.3667c.2a1b6549@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=134a4c78d070f8c4ea43a060a7ae28d22ac39558 commit 134a4c78d070f8c4ea43a060a7ae28d22ac39558 Author: Dag-Erling Smørgrav AuthorDate: 2026-07-07 06:47:40 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-07-07 06:47:40 +0000 Retire the GNU subtree With GNU diff and cdialog gone, this is now an empty shell. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D55425 --- Makefile.inc1 | 4 +- Makefile.libcompat | 1 - ObsoleteFiles.inc | 9 + README.md | 1 - etc/mtree/BSD.tests.dist | 8 - gnu/COPYING | 339 --------------------------- gnu/COPYING.LIB | 481 -------------------------------------- gnu/Makefile | 10 - gnu/Makefile.inc | 1 - gnu/lib/Makefile | 8 - gnu/lib/Makefile.inc | 1 - gnu/lib/tests/Makefile | 4 - gnu/lib/tests/Makefile.depend | 10 - gnu/tests/Makefile | 4 - gnu/tests/Makefile.depend | 10 - gnu/usr.bin/Makefile | 7 - gnu/usr.bin/Makefile.inc | 3 - gnu/usr.bin/tests/Makefile | 4 - gnu/usr.bin/tests/Makefile.depend | 10 - share/mk/local.dirdeps.mk | 1 - 20 files changed, 11 insertions(+), 905 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 6d82baeda643..b683e007f0dc 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -434,7 +434,7 @@ SUBDIR+=bin .if ${MK_CDDL} != "no" SUBDIR+=cddl .endif -SUBDIR+=gnu include +SUBDIR+=include .if ${MK_KERBEROS} != "no" .if ${MK_MITKRB5} != "no" SUBDIR+=krb5 @@ -3424,7 +3424,7 @@ lib/liblzma__L: lib/libmd__L lib/libthr__L lib/libzstd__L: lib/libthr__L lib/librt__L: lib/libthr__L -_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} +_generic_libs= ${_cddl_lib} ${_kerberos5_lib} lib ${_secure_lib} .if ${MK_IPFILTER} != "no" _generic_libs+= sbin/ipf/libipf .endif diff --git a/Makefile.libcompat b/Makefile.libcompat index e132a9f8442f..67af386b3e4a 100644 --- a/Makefile.libcompat +++ b/Makefile.libcompat @@ -89,7 +89,6 @@ distribute${libcompat} install${libcompat}: .PHONY # rather than the native make environment. _LC_LIBDIRS.yes= lib -_LC_LIBDIRS.yes+= gnu/lib _LC_LIBDIRS.${MK_CDDL:tl}+= cddl/lib _LC_LIBDIRS.${MK_CRYPT:tl}+= secure/lib .if ${MK_MITKRB5} != "no" diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 21160613a725..39690870a444 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -51,6 +51,15 @@ # xargs -n1 | sort | uniq -d; # done +# 20260707: Removed GNU subtree +OLD_FILES+=usr/tests/gnu/Kyuafile +OLD_FILES+=usr/tests/gnu/lib/Kyuafile +OLD_DIRS+=usr/tests/gnu/lib +OLD_DIRS+=usr/tests/gnu/usr.bin/diff +OLD_FILES+=usr/tests/gnu/usr.bin/Kyuafile +OLD_DIRS+=usr/tests/gnu/usr.bin +OLD_DIRS+=usr/tests/gnu + # 20260707: Removed dialog, figpar, dpv OLD_FILES+=usr/bin/dialog OLD_FILES+=usr/bin/dpv diff --git a/README.md b/README.md index 160c91b387e6..6baef2a18ba8 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,6 @@ Source Roadmap: | contrib | Source code for third-party software. | | crypto | Source code for cryptographic libraries and commands (see [crypto/README](crypto/README)). | | etc | Template files for /etc. | -| gnu | Source code for third-party software under the GNU General Public License (GPL) or Lesser General Public License (LGPL). Please see [gnu/COPYING](gnu/COPYING) and [gnu/COPYING.LIB](gnu/COPYING.LIB) for more information. | | include | System include files. | | kerberos5 | Build system for Kerberos 5 (Heimdal). | | krb5 | Build system for Kerberos 5 (MIT). | diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist index 3c3662c11502..004be9536f1f 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -292,14 +292,6 @@ .. games .. - gnu - lib - .. - usr.bin - diff - .. - .. - .. include .. lib diff --git a/gnu/COPYING b/gnu/COPYING deleted file mode 100644 index a43ea2126fb6..000000000000 --- a/gnu/COPYING +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/gnu/COPYING.LIB b/gnu/COPYING.LIB deleted file mode 100644 index eb685a5ec981..000000000000 --- a/gnu/COPYING.LIB +++ /dev/null @@ -1,481 +0,0 @@ - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - d) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Library General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/gnu/Makefile b/gnu/Makefile deleted file mode 100644 index 301faa1c8670..000000000000 --- a/gnu/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -.include - -SUBDIR= lib .WAIT \ - usr.bin - -SUBDIR.${MK_TESTS}+= tests - -SUBDIR_PARALLEL= - -.include diff --git a/gnu/Makefile.inc b/gnu/Makefile.inc deleted file mode 100644 index 7f963b3788d1..000000000000 --- a/gnu/Makefile.inc +++ /dev/null @@ -1 +0,0 @@ -# This file is empty to prevent infinite recursion in */Makefile.inc diff --git a/gnu/lib/Makefile b/gnu/lib/Makefile deleted file mode 100644 index 9c1a2c71fdd9..000000000000 --- a/gnu/lib/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -.include - *** 125 LINES SKIPPED *** From nobody Tue Jul 7 06:52:25 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 4gvX3H6PKGz6l1vw; Tue, 07 Jul 2026 06:52:27 +0000 (UTC) (envelope-from des@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvX3H48yWz486b; Tue, 07 Jul 2026 06:52:27 +0000 (UTC) (envelope-from des@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783407147; 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: in-reply-to:in-reply-to:references:references; bh=o49T+ZTLF/WLFfsYGe/uLnkUMmbpANRfNSJRz/l2P40=; b=g2Gea35JV0qspfEWD+6adFj/gdOROYbpYpiS7a1dDH7WDOoA3YqkgTeuxzVdxyfepuO2N1 Ss6vx/eQnLqJhZ8fxSHFDEayU+kwUHON7SnEY6S7n2Sii/6Af3cTFaCLT+mMv1uHWSCR5d 661q2cb0cbXObZxJdHAmLfs3jJhX1HFK/aRVN95lUMjVNKwMTgK4bajO2MvmJB59+GJ9Yy +2ELRxRuGeJNEoECjFAiMPkKAbME9vTMhAxb9vhNZoJ1cvuG84j7l6YRYRaSHv7J4X8PmU PA+axv5+u3PK0A3EiIdn5WZIG0GXNuEBOsTvVKzZPLgvigg57YC30kXXPFVfxg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783407147; a=rsa-sha256; cv=none; b=Emqe54y5cl9wb2tQJFzUGIO9cbsm6yUJkNwlwVgGk5WuDkxo0pX5/8nbSOUZzsyJZBezAE lubEaoNqwO9fqtaYN/d7Sdepog3rDqsCWUrDluH9usoob+wf6jzZ34/AN3lduFZQMk1bnl iKGhgPd+K9Ei//CXwljjlXSsW5AESgD3zXBNkPEcvnWleQsTSOIeNeTDAzcSxAQh29CS8v YiMSxTssfSm2oh8J0Gq7i/Erc3Kt6X+btJmssUDOT8l3pSUA3Fj+rIEecYapBTZ5jHSiXk thO3mJdrAnHq6cc71ldqEJRYTmhBusdoNQ6gqUFU0ThOBriL1PUF3us1VXyRew== 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=1783407147; 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: in-reply-to:in-reply-to:references:references; bh=o49T+ZTLF/WLFfsYGe/uLnkUMmbpANRfNSJRz/l2P40=; b=wr3G07pRXDFANPAroQzRtcNFgbE33ihAK0PjkY78g5NGl+HiF5CXdZAPDja7iotiH0KuBV fAqDUAsEf5V0Y5/trWDKlIia58WoomS5ZoMo5Uv/3a9c9lX9dUawZ+TdNViTDgyRwUfVUb /qAYF9dEXm+PVHTJItqWuaOMdkof0wxDU7U1AXoIxvivW9+k2gbPCku1wQ2YHUoq3hS86W JaNG+WO2Obb/ljPZbcUIVNc69xxJcYLzbpZZ8TQtaaKTlLkwNnN5oJuvDfwYzSCE0LzCjO +SK1CTJ5VPYs8luYN6vEYAZscVNtvZ+3RAOEogFS+l6cXZyDZCBhPlVQCYRkoQ== Received: from ltc.des.dev (2a01cb0585070b00922e16fffef1acef.ipv6.abo.wanadoo.fr [IPv6:2a01:cb05:8507:b00:922e:16ff:fef1:acef]) (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) (Authenticated sender: des/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gvX3H2NYhz19C8; Tue, 07 Jul 2026 06:52:27 +0000 (UTC) (envelope-from des@freebsd.org) Received: by ltc.des.dev (Postfix, from userid 1001) id 993DFAC198; Tue, 07 Jul 2026 08:52:25 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Konstantin Belousov Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 3e8b68c26e2b - main - pdfork.2: document pdopenpid(2) In-Reply-To: <6a4c5d02.3f33d.7156f525@gitrepo.freebsd.org> (Konstantin Belousov's message of "Tue, 07 Jul 2026 01:57:22 +0000") References: <6a4c5d02.3f33d.7156f525@gitrepo.freebsd.org> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Tue, 07 Jul 2026 08:52:25 +0200 Message-ID: <867bn75m1i.fsf@ltc.des.dev> 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: quoted-printable Konstantin Belousov writes: > @@ -128,6 +131,28 @@ flags, or > .Va RFSPAWN > flag are specified. > .Pp The > +.Fn pdopenpid function > +opens the process descriptor for the process specified by the argument > +.Fa pid . DES --=20 Dag-Erling Sm=C3=B8rgrav - des@FreeBSD.org From nobody Tue Jul 7 06:54:35 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 4gvX5n3lCWz6l2Lr; Tue, 07 Jul 2026 06:54:37 +0000 (UTC) (envelope-from des@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvX5n0txsz48vw; Tue, 07 Jul 2026 06:54:37 +0000 (UTC) (envelope-from des@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783407277; 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: in-reply-to:in-reply-to:references:references; bh=rlbrDvlNZ3mSLZAuYRkaBseCzEiGXcBRl759KiR4C+U=; b=ojjLNOMJSe4cn45TKTJc+fjwvTK9P5prB8OZ0GKzPDW5UXvRQk4yFwlujG6EpdkU36Cl7S atquQSxjtdbQQI4xYscVn+veZE2okj3M+Y6nV7Ij/0pbbstpxy3HYGPBgMF8wb31rjpysL 2yUFm6ixdn0bBftqaOK6s+4RtRPKV24aLiARn9bQxyJNEO/VW+CwgkmaAEjiMpAaIPGh5Y as7Ya+hhN1Ja/hDESUF8xmifr0wfoxxTdG/Giq9WDpULD4iF045iHpVJ2wh2nThLkTbVHi mJGfqRTCB4HFY5KClOBelzJYz9VEr8av1bij/X+lXPn8/h1P9rCQquSdGjfPxw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783407277; a=rsa-sha256; cv=none; b=qxIjWUeCyUO9+HYrxiY/KlF+5dGtuMsJkGRDdXw020K7PismySzQkR+oPHLcSzu4gCdy8+ SB7sBGI0b6Nn3k0+2h9Z7Tyc/RoiODplcpYomRxH9XtRsS5snXQw0vncf+U0tp6iP/z0wT xOe+dxPuKEgHUHBCir05AHw1O3G+DitoOy+38G1EFpJBc89vbTjAKtU3ZnR0SBpKmYlc+g AludprwGn8SSxUt2DNjXanttW0yxor4tDQSZvI15tzD3i2YnNL6ExrGpScHEWNrhpjIxNh 5lGKm74oHxOkxK0CUlpHIUpRvto2mtYyj9TFNdD13314IcQj+q5iGwPIUQXQkA== 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=1783407277; 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: in-reply-to:in-reply-to:references:references; bh=rlbrDvlNZ3mSLZAuYRkaBseCzEiGXcBRl759KiR4C+U=; b=SOSmbOqS78fksw4j82El04THDX8M1BhNfRKa2gCKYNJGM76jsgXuivBCMx69Ua2raGD+UM wZ12PN6djlqV9v7cmHgIQs7JGb1A4SzRDoQd/BUk0aiBkan0vy2CckZ5cZJdcDoGqIGd3+ Jz7eG1/XqUfPY3GcrTCKgMy03iinfm59LDkLjtre1vsXhKAx+EZ0OogeFzjm9uTp6ABS2P sUiNPL5OuwRuiYujank+jeS7V/mx8f4druN/mzO9+S7XBMfG5FX0IS0rAJNb7AW3NI1RCQ TdwLOgvQUWllkquJY4Z4WQvvF0N6BQ5oJuYhkm/NKI0kRkuo3PG7XgCSbDSusA== Received: from ltc.des.dev (92-129-202-201.ftth.fr.orangecustomers.net [92.129.202.201]) (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) (Authenticated sender: des/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gvX5m6C5rz18yp; Tue, 07 Jul 2026 06:54:36 +0000 (UTC) (envelope-from des@freebsd.org) Received: by ltc.des.dev (Postfix, from userid 1001) id B69B5AC199; Tue, 07 Jul 2026 08:54:35 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: "Bjoern A. Zeeb" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: fbe0257b5613 - main - libc/resolv: Reimplement the sortlist parser In-Reply-To: <40s77q5o-q2no-p79r-7719-67np83p1934s@mnoonqbm.arg> (Bjoern A. Zeeb's message of "Tue, 7 Jul 2026 05:59:25 +0000 (UTC)") References: <6a4b9e7c.3a45f.1bda28f6@gitrepo.freebsd.org> <40s77q5o-q2no-p79r-7719-67np83p1934s@mnoonqbm.arg> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Tue, 07 Jul 2026 08:54:35 +0200 Message-ID: <8633xv5lxw.fsf@ltc.des.dev> 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: quoted-printable "Bjoern A. Zeeb" writes: > one could likely make the blocks above and below even simpler if one used > inet_cidr_pton(), which will also deal with the mask, so one does not have > to parse it away and checking it onself per-AF. inet_cidr_pton() is undocumented, so it might as well not exist. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@FreeBSD.org From nobody Tue Jul 7 08:07:22 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 4gvYjk3Djtz6l6lv for ; Tue, 07 Jul 2026 08:07:22 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvYjk2cfbz4H3J for ; Tue, 07 Jul 2026 08:07:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783411642; 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=5kKqKl8+GFWONa4rlLR77PgE/NPP4ZXc2D+46tBR0W8=; b=ye6R3p8TqxdSLj5XUrzl2GKLVGLGQjg6GbAJStIGTHNo4YOMvypiRx7HwMukvQK6oRm43f al20Dc1+Mk1rUpbG314QYI0QPtOhoxWDVtZnEm1/0V4SXf5lM2hp+OHAPaVZmg4+dMB0tw GuLwhmA+rK00WsT4eRpdJto6W9bClzEAonnjoTYpEEPuKPNoKhkH1F8GB+dd0wgYvWaETD WdOm0d83nArF/D0PCKNCCqLWMzw0DkJJ9O6/StUpa6nOUhWETA1wABEaEhV9y5e9ATq9N7 mAf4esfbx408qC8Jxx7ckEThB6Iwwgmw8JRm6oN+0/ROgAOr2raENvUhE5ijrg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783411642; a=rsa-sha256; cv=none; b=IEaIIPC5aoSx2/302l4j/gLWJsOOf/FbYM1WnYeLzxiLZdaKchKS/cvFiHLh8/ikXM6QYH skW5lP7gGjX92gTiylJuyWOUoMs1uqbSOUU3ZWshuoQ+gMDg0Idg2K1lVAIPROLHRD+gtN PkNPRKmhD2w3L370fbdaeqP6gD3u80v01Lto/3CY9NhpoHe1+qUszGyvz84vkpmXJFBd/C +glnjzsYNXSB3dBIvOxcvtzY3Pvbkx9GR4dxIqSzu3WKAlWcd4Ydw1RG+McBVieNpKNeOA PAxUC5579NMhOMmTv9TIEjZzUaCYGaDgV0boIPZibcOEhgcuR+Yo9DY31XCB/g== 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=1783411642; 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=5kKqKl8+GFWONa4rlLR77PgE/NPP4ZXc2D+46tBR0W8=; b=rMSgkvVIIpnTybDZZzpxfAIBYB+JDvDW2G1vQhw/7y6md6qrMn8v3JiuvO27UIkGnVHGAQ xj9sF+FEZoKVFwGIL/Q4lyryuSBXO3tIUs9lr9HJgEGXn8RtrZnz2QjEMfkzKX6OmSYDwR 25C4O+gGxq1/JxTi1QcVWhT8cYWmt6i3DjzPHq+XvIhANM6iYbYgJghrSr59MA860CxcKw kB/lQHMFUq+aXhL4fL4McG1phJIvF43VRbD++TGVEc84DmljKRhrVcUMDnIG4yL5AzyLKb y5SmVbM7IDIQoPBApyhz+6hVn1P1afO7iiWdjGjBZJR7XgwSMrcrPMjuv/NUTg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvYjk1L1SzBDk for ; Tue, 07 Jul 2026 08:07:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3fd2a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 08:07:22 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 849a51ac8371 - main - pdfork.2: grammar 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 849a51ac8371f45a61e93c7b5787da93cf751c75 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 08:07:22 +0000 Message-Id: <6a4cb3ba.3fd2a.7f9f1721@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=849a51ac8371f45a61e93c7b5787da93cf751c75 commit 849a51ac8371f45a61e93c7b5787da93cf751c75 Author: Konstantin Belousov AuthorDate: 2026-07-07 08:05:20 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 08:07:04 +0000 pdfork.2: grammar Submitted by: des MFC after: 1 week --- lib/libsys/pdfork.2 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/libsys/pdfork.2 b/lib/libsys/pdfork.2 index 9099edebaa2a..18dff970be1f 100644 --- a/lib/libsys/pdfork.2 +++ b/lib/libsys/pdfork.2 @@ -131,8 +131,10 @@ flags, or .Va RFSPAWN flag are specified. .Pp +The .Fn pdopenpid -opens the process descriptor for the process specified by the argument +function opens the process descriptor for the process +specified by the argument .Fa pid . It takes the same flags in the .Fa pdflags From nobody Tue Jul 7 11:30:01 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 4gvfCb34Q8z6dR3y for ; Tue, 07 Jul 2026 11:30:03 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvfCb0y5gz3M9n for ; Tue, 07 Jul 2026 11:30:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783423803; 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=ZCQlusVtpY2AX+mtfpZDedOZQS7HmJCubQgj62hEXzE=; b=SsPmuFH430qgcKRdL7OarcM/dncy6qwcvpcXG2m7dIJqKojZ2RAuaS0gSJicKhAlAaFWgY IGGDB4MQLWDmZE0d79eOWbt0sWos/0yzfc1ZcxVPwe/Fmfnkr4Uv53K7FhbB5fM7IYpYCU kkqosF9nODKxtpqjJU0U7woN7l5yOarj0qlUZoyQ9b99RprwxhcQkk+g6Hix3CHBmG97f6 l/67MuikwQgEZkWheP3Wl4WiezOBlWG7FphZeDlwkdIHaAbHuQm6b3KCplOOk4NfKtIrNg 5DOX2xNjLrwSlP3CcCyMYhfpFp3LQF7qCTEU670mNEkQvsWNJXz4H847LB5LHw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783423803; a=rsa-sha256; cv=none; b=pQJxftAv0GdmzNNhtBCCMFdrIF+sybHUnEMPRSDZ2r1pMSX9l0yXYzNTfxije95As5nAk9 4iTgTMWiNEi/BlQeAK5Y6uWxqH5jN6ZDGgvaiz4A3VqrqRBpASteBG1qWTxliip/VWwhRZ A3kSz9DQFzUvHAdSHuUdmWyCjPm/hK+XXhuHbJLiGMn9GaTzZXNbWhLPDENTxmKHs/F2zW 3CAkgsKlnabEEj4ED0iU6ad/b8MoKBZeNXXhMcE3b14jmq3laMIhDnxOLlOPN2uBhrgDrl w/0wKP/hrlE56TAhIRGpuf9VzxGY8b0kO+IJEWsNUTPxGhlYhL17PizTlIgK2w== 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=1783423803; 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=ZCQlusVtpY2AX+mtfpZDedOZQS7HmJCubQgj62hEXzE=; b=B6O/qLoGNnvBIQVqawvUz/Nkg11bDul30dbuOkqcc147dTBfm4KI136WkvBM3FDN8yGmu5 7onCIpseKBq3oYsuh9HDg34RYRFfsLh38GA3awcqigbWRpppu6/yG3dBbqepIHV0czinOm tpryVT9flj6PAQvtl0gVjUMp0txAeJLqtpg3o5ehkCeWLs6hEna1o2uIwbLalnh2W4NcBS de+aUJGdoupSLA4Rd06QXH0j5Cfjej0SVPHIDwahGlanfwXvJ0I6RZjUL1a6jl7VRh6soH N8/rr/vR0yoata78EF1lCRrJO1w6aO8gkU3AcFxAbDCdhOrLJrS+8y0ioLM7ZQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvfCY6PFLzZLl for ; Tue, 07 Jul 2026 11:30:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 36d1e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 11:30:01 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Ariel Ehrenberg From: Konstantin Belousov Subject: git: 705d6cf4bf25 - main - mlx5_ib: register DEVX objects in the uverbs ioctl parse tree 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 705d6cf4bf25f7b87f017322e04c6a1a37f1fac0 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 11:30:01 +0000 Message-Id: <6a4ce339.36d1e.1b46e7b7@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=705d6cf4bf25f7b87f017322e04c6a1a37f1fac0 commit 705d6cf4bf25f7b87f017322e04c6a1a37f1fac0 Author: Ariel Ehrenberg AuthorDate: 2026-06-09 11:20:23 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 11:24:29 +0000 mlx5_ib: register DEVX objects in the uverbs ioctl parse tree Import Linux upstream commits a8b92ca1b0e5ce620e425e9d2f89ce44f1a82a82 and c59450c463695a016e823175bac421cff219935d. The DEVX object and method definitions were already present, but nothing pointed ib_device.driver_def at them. ibcore therefore never merged them into the uverbs uapi tree and every DEVX ioctl came back as EPROTONOSUPPORT. Reviewed by: kib Tested by: Wafa Hamzah Sponsored by: Nvidia networking MFC after: 1 month --- sys/dev/mlx5/mlx5_ib/mlx5_ib.h | 1 + sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h index a97d74864292..bbc7aa4a170a 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h @@ -1080,6 +1080,7 @@ void mlx5_ib_devx_init_event_table(struct mlx5_ib_dev *dev); void mlx5_ib_devx_cleanup_event_table(struct mlx5_ib_dev *dev); bool mlx5_ib_devx_is_flow_dest(void *obj, int *dest_id, int *dest_type); bool mlx5_ib_devx_is_flow_counter(void *obj, u32 offset, u32 *counter_id); +extern const struct uapi_definition mlx5_ib_devx_defs[]; #else static inline int mlx5_ib_devx_create(struct mlx5_ib_dev *dev, diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c index 53ccf68e4077..f5c7d5cf382b 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c @@ -3300,6 +3300,11 @@ free: return ARRAY_SIZE(names); } +static const struct uapi_definition mlx5_ib_defs[] = { + UAPI_DEF_CHAIN(mlx5_ib_devx_defs), + {} +}; + static int mlx5_ib_stage_bfreg_init(struct mlx5_ib_dev *dev) { int err; @@ -3374,6 +3379,7 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) dev->ib_dev.num_comp_vectors = dev->mdev->priv.eq_table.num_comp_vectors; dev->ib_dev.dma_device = &mdev->pdev->dev; + dev->ib_dev.driver_def = mlx5_ib_defs; dev->ib_dev.uverbs_abi_ver = MLX5_IB_UVERBS_ABI_VERSION; dev->ib_dev.uverbs_cmd_mask = @@ -3539,9 +3545,18 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) if (err) goto err_q_cnt; + /* + * Initialize the DEVX event table before ib_register_device(). + * Registration merges ib_dev.driver_def into the uverbs uapi, which + * makes the DEVX object tree live immediately; initializing the event + * table afterwards would leave a window where a DEVX ioctl could touch + * an uninitialized dev->devx_event_table. + */ + mlx5_ib_devx_init_event_table(dev); + err = ib_register_device(&dev->ib_dev, NULL); if (err) - goto err_bfreg; + goto err_devx; err = create_umr_res(dev); if (err) @@ -3568,7 +3583,9 @@ err_umrc: err_dev: ib_unregister_device(&dev->ib_dev); -err_bfreg: +err_devx: + mlx5_ib_devx_cleanup_event_table(dev); + mlx5_ib_stage_bfreg_cleanup(dev); err_q_cnt: @@ -3600,6 +3617,7 @@ static void mlx5_ib_remove(struct mlx5_core_dev *mdev, void *context) struct mlx5_ib_dev *dev = context; enum rdma_link_layer ll = mlx5_ib_port_link_layer(&dev->ib_dev, 1); + mlx5_ib_devx_cleanup_event_table(dev); mlx5_ib_cleanup_congestion(dev); mlx5_remove_roce_notifier(dev); ib_unregister_device(&dev->ib_dev); From nobody Tue Jul 7 11:29:59 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 4gvfCX39llz6dRSd for ; Tue, 07 Jul 2026 11:30:00 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvfCX0ZrPz3M55 for ; Tue, 07 Jul 2026 11:30:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783423800; 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=Nru/nOhUT0KwqP17mHEYo/M5NTxeLt0/xpLyv4XfjoI=; b=TP2AyEdFZ1dE/4UBgB1zwooKNnokHUVLlPM2UU5olFp6G00YfVzpqv/tDm5ymISHmrxRlS AH6h/q4u2keKyVsrNlIvrorZG/M2BgU+OERXt0wWDe/aJcyvUUZUGQuge3Vlr26rOewRpL +KlJLfF5fZUo5dAeQ4Vvk+pViqGr9R0swonAJW2+G7FUlV8MCUPv4xu3937MVIm9+e4Ywo AgUDm9p0ZiJ3iCUF7fhvo9eIR6IyRFYQ5VMGIo7MJLT83BUrLol/SFC8utdNcMz+0enU6g MBdAYIbHVwXZOGjAJmopTXwy77l6P+guTdbFD4O9lmU0Jysr9ZF1uPVbL+6zIw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783423800; a=rsa-sha256; cv=none; b=ibhEDBTjFHPyN7cE5uyADnV4elboEA+RSMmdw5kWALf+oN2GFriN4sAr/A6Vqkv+CLjDt5 cVCzwCz09Tk6Dwom7NyRhocedcwZkx5O+UVwFaILZfDZhkFn2V9C72YViTfAM6XNsBAsWQ 4UuSfNd9EuFwcVSEjU7bdiciOeHgjxdhT+NZr2NkdnxzmvSKRJV3qyFfZNAm21L2hNWrl5 RgkuoBhPEkVcoyqAvrSrE33TqAWZKNCHf5gLRXUCx7Y2XTJBWZ9UJXfORxyzU2v+RCbTsc vi8znD7iSxhXay6lHRZmzCDdQd/mukhHnrc7wSVrPOgQVVFHDyo1OULA1C4LAw== 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=1783423800; 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=Nru/nOhUT0KwqP17mHEYo/M5NTxeLt0/xpLyv4XfjoI=; b=W0091MltJScd7CUphnILFRLKihQBzFeIk4DGkmVw8QdFSM8y7Sx7O6qMzVMtoPBGf29vaf hnFpZct5aJG3u2olCve4By2uFQjNKEKf47+irAKUFc5XaJHdzhFR7Gf/UKQrG3PqqcHsfK 95ZyLIvQPt0X1p593r9lHHqy2ZiznZdGsk5SkOdLb96qXcaEWo12GMM1EZhVS5Cg3rXymQ s+nNuOVhINrNPihPVXE2hhzI6RRGHyTjHxU20DZzdiBVatD5RokOwxg841wTMY22MSimAy kOmixNVPS8r38A7Z+g5O+J0C/LuTvGAtbHn3O5cDqkTXvGQ0fxUJqqw/pYig7Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvfCW63XnzZLg for ; Tue, 07 Jul 2026 11:29:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 36244 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 11:29:59 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 716bb8d3d402 - main - mlx5: extend mlx5_ib_create_cq struct with fields from the current Linux ABI 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 716bb8d3d40250b0b2b40480dc062abfab5665ed Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 11:29:59 +0000 Message-Id: <6a4ce337.36244.5cd1a6e0@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=716bb8d3d40250b0b2b40480dc062abfab5665ed commit 716bb8d3d40250b0b2b40480dc062abfab5665ed Author: Konstantin Belousov AuthorDate: 2026-06-02 21:59:16 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 11:24:11 +0000 mlx5: extend mlx5_ib_create_cq struct with fields from the current Linux ABI This is backward ABI-compatible, because the only place in kernel that uses the structure, namely the mlx5_ib_cq.c:mlx5_ib_create_cq() function, copies in as much structure members as provided by userspace. Tested by: Wafa Hamzah Sponsored by: Nvidia networking MFC after: 1 month --- sys/ofed/include/uapi/rdma/mlx5-abi.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/ofed/include/uapi/rdma/mlx5-abi.h b/sys/ofed/include/uapi/rdma/mlx5-abi.h index ba0b3f655231..91af500c9a61 100644 --- a/sys/ofed/include/uapi/rdma/mlx5-abi.h +++ b/sys/ofed/include/uapi/rdma/mlx5-abi.h @@ -163,6 +163,10 @@ struct mlx5_ib_create_cq { __u32 cqe_size; __u16 flags; __u16 uar_page_index; + __u8 cqe_comp_en; + __u8 cqe_comp_res_format; + __u16 reserved0; + __u32 reserved1; }; struct mlx5_ib_create_cq_resp { From nobody Tue Jul 7 11:30:00 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 4gvfCY431Wz6dRMH for ; Tue, 07 Jul 2026 11:30:01 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvfCY0JVzz3M56 for ; Tue, 07 Jul 2026 11:30:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783423801; 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=5tR6183p4p7WljW1sH+jVkpjgFuvQphCz2+VTdVmn1c=; b=HWg+q+0D/wkKAdL2WrdePgXi7StM6PxO7cmKm1GtfgXeBm61x6VUhCRFJREqfqsb80QbsV EZTf1Pej5PyDUQoupUFUrKthbpf2GbDz2JC9m+icflnU6YFv2DeBtMcXbdaz9vgmOEX17B OgZ4mJI7s0bQNOd44XXaIpxm5DNmzukhRZkMKnqhIvFvhHBMGQXXXiDZHEcD1j4z4ySOP7 P4m/GfFKXcEEDNre5rNdpX1obFzwgoh18nq6mgb34goiPF3MfX3Xq3cHZWeRgd7NBFbSYF r8pupxoEPUcSdmfuEMS72EVOWt0QdmUXTrahdUgPrAxILsoSVhvc2OPbKEYSAQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783423801; a=rsa-sha256; cv=none; b=RayU5fxfZZ1CTx8bwnz2TuPaLzvJNEUxdufCyb3FRejbFdD2Q1UzN+bzFr8H9hdn/JMQ9m NAWq+fymipwNrycwmBqFHKBkehgd9c57bXlzFAAaPiXhUTsMcy2ImcM7rNUGuPV3fmnIQX JEzVyxtQE39fCho+lKfRY2diq4dC7+96WEEmCIwc9IObtCK9b/KNAQsaGb4/40ks7bCFuQ H6QcQN/9FYPoVb9GXhq1wD17ODZcOi2Mvwrrztj4CZQ177b0lZkoeT8Dp5ixpRhjAPwosk eQJxGQdS/HcU+7Fvw/3hr8LXLYhEA0ZzgUaMgsEFJBAcUF+aF2cNGzTmJq8o7A== 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=1783423801; 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=5tR6183p4p7WljW1sH+jVkpjgFuvQphCz2+VTdVmn1c=; b=jRZnnMwklokHizuZY1VsMiHG3qPxSPaFsMuHclcE6NJDMSbVVfbVELRFQfBdkRhF6Gm+zN tGLugvFhgQoGQdZ5juofbWS+SbIuY7b3fDPWtcEDs2w2qmR0dvgtW3Ss78GcSma+XDmJXs b/EZ7ewDUIgd+0sE54zudZB5IkGNn+nv1YxKqTdg9XkPXwiB2nQRvMIfD7V4A4HmMGhnv7 sxYoY1QKVRuryFyUWsXhi2Tnzo9umc7bJKKvz+2r/r32E/SXTryrGlBk+NsCLFWP62OW1v 5Jl+uopsyAJnUZLQ89Bc2u1uV/VBIj3enC92z0RuD386v3C0+vU3zCznx3qTjQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvfCX5yjTzYqR for ; Tue, 07 Jul 2026 11:30:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 34875 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 11:30:00 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Ariel Ehrenberg From: Konstantin Belousov Subject: git: 2e3b3ce88149 - main - mlx5_ib: do not consume CMD/PAGE_REQUEST events in the DEVX notifier 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2e3b3ce881490adcef17905450d0402030975051 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 11:30:00 +0000 Message-Id: <6a4ce338.34875.508be9a7@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2e3b3ce881490adcef17905450d0402030975051 commit 2e3b3ce881490adcef17905450d0402030975051 Author: Ariel Ehrenberg AuthorDate: 2026-06-09 11:20:08 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 11:24:21 +0000 mlx5_ib: do not consume CMD/PAGE_REQUEST events in the DEVX notifier DEVX event notifier returned true for the command-completion and page-request events. This is causing mlx5_eq_int() to skip the core EQ handler, so the firmware command interface and the page supply stop being serviced and the device wedges. This commit also make notifier registration and dispatch safe against the EQ interrupt running concurrently: publish the table pointer before the callback and load it with acquire semantics. run the callback under RCU, and drain it with synchronize_rcu() on teardown. Otherwise the interrupt handler could observe a half-initialized notifier or race with cleanup. Reviewed by: kib Tested by: Wafa Hamzah Sponsored by: Nvidia networking MFC after: 1 month --- sys/dev/mlx5/mlx5_core/mlx5_eq.c | 33 ++++++++++++++++++++++++++++++--- sys/dev/mlx5/mlx5_ib/mlx5_ib_devx.c | 35 ++++++++++++++++++++++++++++------- 2 files changed, 58 insertions(+), 10 deletions(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_eq.c b/sys/dev/mlx5/mlx5_core/mlx5_eq.c index 1090f8638171..f564b88c48b4 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_eq.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_eq.c @@ -238,6 +238,10 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, struct mlx5_eq *eq) u8 port; while ((eqe = next_eqe_sw(eq))) { + bool (*devx_cb)(struct mlx5_core_dev *mdev, + uint8_t event_type, void *data); + bool devx_consumed = false; + /* * Make sure we read EQ entry contents after we've * checked the ownership bit. @@ -247,9 +251,32 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, struct mlx5_eq *eq) mlx5_core_dbg(eq->dev, "eqn %d, eqe type %s\n", eq->eqn, eqe_type_str(eqe->type)); - if (dev->priv.eq_table.cb != NULL && - dev->priv.eq_table.cb(dev, eqe->type, &eqe->data)) { - /* FALLTHROUGH */ + /* + * The DEVX event notifier can be (un)registered concurrently. + * Fast path: when no notifier is registered (the common case + * with DEVX unused) skip RCU entirely - on FreeBSD LinuxKPI + * rcu_read_lock() pins the thread and starts an epoch section, + * which is not free per EQE. If a notifier appears registered, + * re-load the callback under rcu_read_lock() before calling it. + * The acquire load pairs with the store-release in + * mlx5_ib_devx_init_event_table() so eq_table.dev is visible + * once cb is; the re-check under RCU pairs with synchronize_rcu() + * in mlx5_ib_devx_cleanup_event_table() so the callback only + * ever runs inside an RCU section and none is in flight when the + * notifier (and its event table) is torn down. + */ + devx_cb = smp_load_acquire(&dev->priv.eq_table.cb); + if (devx_cb != NULL) { + rcu_read_lock(); + devx_cb = smp_load_acquire(&dev->priv.eq_table.cb); + if (devx_cb != NULL) + devx_consumed = + devx_cb(dev, eqe->type, &eqe->data); + rcu_read_unlock(); + } + + if (devx_consumed) { + /* event consumed by the DEVX notifier */ } else switch (eqe->type) { case MLX5_EVENT_TYPE_COMP: mlx5_cq_completion(dev, eqe); diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_devx.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_devx.c index 835a7fd8cfa4..6522a0aa6daf 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_devx.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_devx.c @@ -2357,12 +2357,21 @@ static bool mlx5_devx_event_notifier(struct mlx5_core_dev *mdev, bool is_unaffiliated; u32 obj_id; - /* Explicit filtering to kernel events which may occur frequently */ + /* + * Command completions and page requests must be processed by the + * mlx5_core default EQ handler. Returning true here tells + * mlx5_eq_int() the event was consumed and skips core processing, + * which stalls the firmware command interface and page supply and + * wedges the device. Return false so the core handler runs for + * these frequent kernel events. + */ if (event_type == MLX5_EVENT_TYPE_CMD || event_type == MLX5_EVENT_TYPE_PAGE_REQUEST) - return true; + return false; - dev = mdev->priv.eq_table.dev; + dev = READ_ONCE(mdev->priv.eq_table.dev); + if (dev == NULL) + return false; table = &dev->devx_event_table; is_unaffiliated = is_unaffiliated_event(dev->mdev, event_type); @@ -2401,8 +2410,14 @@ void mlx5_ib_devx_init_event_table(struct mlx5_ib_dev *dev) xa_init_flags(&table->event_xa, 0); mutex_init(&table->event_xa_lock); - dev->mdev->priv.eq_table.dev = dev; - dev->mdev->priv.eq_table.cb = mlx5_devx_event_notifier; + /* + * Publish dev before cb. The EQ interrupt handler loads cb with + * acquire semantics and the notifier then dereferences eq_table.dev, + * so dev must be visible to that handler once cb is observed. + */ + WRITE_ONCE(dev->mdev->priv.eq_table.dev, dev); + smp_store_release(&dev->mdev->priv.eq_table.cb, + mlx5_devx_event_notifier); } void mlx5_ib_devx_cleanup_event_table(struct mlx5_ib_dev *dev) @@ -2413,8 +2428,14 @@ void mlx5_ib_devx_cleanup_event_table(struct mlx5_ib_dev *dev) void *entry; unsigned long id; - dev->mdev->priv.eq_table.cb = NULL; - dev->mdev->priv.eq_table.dev = NULL; + /* + * Stop new dispatch by clearing cb, then wait for any in-flight EQ + * callback to finish its RCU read section before clearing dev and + * tearing down the event table. + */ + WRITE_ONCE(dev->mdev->priv.eq_table.cb, NULL); + synchronize_rcu(); + WRITE_ONCE(dev->mdev->priv.eq_table.dev, NULL); mutex_lock(&dev->devx_event_table.event_xa_lock); xa_for_each(&table->event_xa, id, entry) { event = entry; From nobody Tue Jul 7 11:30:02 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 4gvfCc09C6z6dRXG for ; Tue, 07 Jul 2026 11:30:04 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvfCb4HKrz3M57 for ; Tue, 07 Jul 2026 11:30:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783423803; 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=HfveXK9AOeEX9cevNKHu6H2B/Y2koXGb3C6l8I6F7cs=; b=LrSvfHG9ieBSGd18Ns1LFKuY7oIW0c2byso4c76MlPucBXV+mkmqLk9ULUqvFFxaJ6pKfD yEH/FQBkDOdGUPeeFDknMv+BvGkfV5t59rNfo3h+Fd5fDigbsMMx2YQ3cloB/eczFHEHw+ HNIn0oksDXml60QrHtdh7IKLoU5RDOFmlyGnK22u/9lMGm0/WaVVIoC+a3/P8Aeq1N56Tz 3kya3ilJAaFTz7qZsyH+FoiLTQI9ipznQvKw/CMRjdPbYgRLZuIUJpvBI3zhdLhoD2Ydx5 ByuDqwR1pnUFZv2zlHvHoyZMFeHPpbxwoIFDzFqjgtHhXBd3PlT4cd6ts5Hqrg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783423803; a=rsa-sha256; cv=none; b=sZWN2zDtVP13DAdOC4MhTXTL8ekleErvpUWfuAAixJVM/2QSFQ4EaDyHGfVlWa/bDtOhpL PrVP9bYpzkL5iiP6vfrLUdDHjn645nC7Vi3AD0zh0RVlmt8XLopk5RGqQ3CLl/czA8B6gQ m9Di23DkRpigmOOtEh0boVBVb5KufKazu8YPmp69PVYUSM4PpjaeEs4rmR4QH42iVIllAL t4GmcYYckYkc2OD/bBqNgLnCOXoPyfl/stgUQVPMp3/d7tL5vMlIgnl2SjE/2iKY48bBsl JLUe+GhvJXUjfPSJZT1YAB4qmvbpWZGv0UvOm5+OUzFL0jHSkZnsi5IlX11Nqw== 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=1783423803; 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=HfveXK9AOeEX9cevNKHu6H2B/Y2koXGb3C6l8I6F7cs=; b=fc7l1QPSrT5Z60L6rYsJZXoaF/VwEyqKrrjJkJGrdr45fOjqyAjCncNdHIsL3KPyZl/5kT l/Sh44AILzYOj/57laSpKo4dQ7oMEF33Q07N7o4/JBdhUROEso0xAI0buPah1MDCkFbx1o qY3nSGqcM78gSwDGcMN7pq4LEljNlZUGSmRziO5pAGAqSzaUt+C4ZUGYH9IFDz8WoNkgXT fMs1RplydfayTU0ZB1VfseHaOrIT2Nf04y4ovLGQrI2QlrtgAMI7hZadqMr4pmS26cE7q9 guQTkIgEPcqSQdOzO7TUxkiUoAapBPa9U0pbgwN7VdIo86EGvh33qLRYUxK3SQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvfCZ6qy9zXGm for ; Tue, 07 Jul 2026 11:30:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 366b1 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 11:30:02 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Ariel Ehrenberg From: Konstantin Belousov Subject: git: b7ca46b161d8 - main - mlx5ib: implement the MLX5_IB_OBJECT_UAR ioctl object 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b7ca46b161d869c839b1d4a544f64d5661a9082f Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 11:30:02 +0000 Message-Id: <6a4ce33a.366b1.7306ff0e@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b7ca46b161d869c839b1d4a544f64d5661a9082f commit b7ca46b161d869c839b1d4a544f64d5661a9082f Author: Ariel Ehrenberg AuthorDate: 2026-06-04 15:07:52 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 11:24:38 +0000 mlx5ib: implement the MLX5_IB_OBJECT_UAR ioctl object Import Linux upstream commit 342ee59de98a2ecdf15a46849a2534e7c808eb1f. The dynamic UAR object was declared in the ABI headers but had no handler, so the ioctl was rejected and dynamic-UAR contexts could not allocate a doorbell UAR at all. Implement the alloc and destroy methods following the upstream driver: grab a UAR stamped with the caller's DEVX uid, expose it to user space through an rdma_user_mmap entry (write-combining or non-cached as requested), and free it on destroy. Reviewed by: kib Tested by: Wafa Hamzah Sponsored by: Nvidia networking MFC after: 1 month --- sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 163 +++++++++++++++++++++++++++++++++++- sys/dev/mlx5/mlx5_ifc.h | 4 +- 2 files changed, 164 insertions(+), 3 deletions(-) diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c index f5c7d5cf382b..fc9af189f3fa 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c @@ -47,6 +47,12 @@ #include #include #include +#include +#include +#define UVERBS_MODULE_NAME mlx5_ib +#include +#include +#include #include #include #include @@ -1506,15 +1512,44 @@ static int mlx5_ib_mmap_clock_info_page(struct mlx5_ib_dev *dev, return -EOPNOTSUPP; } +static int mlx5_cmd_uar_alloc(struct mlx5_core_dev *dev, u32 *uarn, u16 uid) +{ + u32 out[MLX5_ST_SZ_DW(alloc_uar_out)] = {}; + u32 in[MLX5_ST_SZ_DW(alloc_uar_in)] = {}; + int err; + + MLX5_SET(alloc_uar_in, in, opcode, MLX5_CMD_OP_ALLOC_UAR); + MLX5_SET(alloc_uar_in, in, uid, uid); + err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); + if (err) + return err; + + *uarn = MLX5_GET(alloc_uar_out, out, uar); + return 0; +} + +static int mlx5_cmd_uar_dealloc(struct mlx5_core_dev *dev, u32 uarn, u16 uid) +{ + u32 out[MLX5_ST_SZ_DW(dealloc_uar_out)] = {}; + u32 in[MLX5_ST_SZ_DW(dealloc_uar_in)] = {}; + + MLX5_SET(dealloc_uar_in, in, opcode, MLX5_CMD_OP_DEALLOC_UAR); + MLX5_SET(dealloc_uar_in, in, uar, uarn); + MLX5_SET(dealloc_uar_in, in, uid, uid); + return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); +} + static void mlx5_ib_mmap_free(struct rdma_user_mmap_entry *entry) { struct mlx5_user_mmap_entry *mentry = to_mmmap(entry); struct mlx5_ib_dev *dev = to_mdev(entry->ucontext->device); + struct mlx5_ib_ucontext *context = to_mucontext(entry->ucontext); switch (mentry->mmap_flag) { case MLX5_IB_MMAP_TYPE_UAR_WC: case MLX5_IB_MMAP_TYPE_UAR_NC: - mlx5_cmd_free_uar(dev->mdev, mentry->page_idx); + mlx5_cmd_uar_dealloc(dev->mdev, mentry->page_idx, + context->devx_uid); kfree(mentry); break; default: @@ -3300,8 +3335,134 @@ free: return ARRAY_SIZE(names); } +/* + * MLX5_IB_OBJECT_UAR: allocate a dedicated UAR for user space and expose it + * through an mmap entry. Modern libmlx5 uses this (dynamic UAR) to obtain the + * UAR backing CQ/QP doorbells instead of the legacy static UAR pages. + */ +static int mmap_obj_cleanup(struct ib_uobject *uobject, + enum rdma_remove_reason why, + struct uverbs_attr_bundle *attrs) +{ + struct mlx5_user_mmap_entry *obj = uobject->object; + + rdma_user_mmap_entry_remove(&obj->rdma_entry); + return 0; +} + +static int UVERBS_HANDLER(MLX5_IB_METHOD_UAR_OBJ_ALLOC)( + struct uverbs_attr_bundle *attrs) +{ + struct ib_uobject *uobj = uverbs_attr_get_uobject(attrs, + MLX5_IB_ATTR_UAR_OBJ_ALLOC_HANDLE); + enum mlx5_ib_uapi_uar_alloc_type alloc_type; + struct mlx5_user_mmap_entry *entry; + struct mlx5_ib_ucontext *c; + struct mlx5_ib_dev *dev; + u32 uar_index; + u32 length = PAGE_SIZE; + u64 mmap_offset; + int err; + + c = to_mucontext(ib_uverbs_get_ucontext(attrs)); + if (IS_ERR(c)) + return PTR_ERR(c); + dev = to_mdev(c->ibucontext.device); + + err = uverbs_get_const(&alloc_type, attrs, + MLX5_IB_ATTR_UAR_OBJ_ALLOC_TYPE); + if (err) + return err; + + if (alloc_type != MLX5_IB_UAPI_UAR_ALLOC_TYPE_BF && + alloc_type != MLX5_IB_UAPI_UAR_ALLOC_TYPE_NC) + return -EOPNOTSUPP; + + if (alloc_type == MLX5_IB_UAPI_UAR_ALLOC_TYPE_BF && !dev->wc_support) + return -EOPNOTSUPP; + + err = mlx5_cmd_uar_alloc(dev->mdev, &uar_index, c->devx_uid); + if (err) + return err; + + entry = kzalloc(sizeof(*entry), GFP_KERNEL); + if (!entry) { + err = -ENOMEM; + goto err_uar; + } + + entry->mmap_flag = (alloc_type == MLX5_IB_UAPI_UAR_ALLOC_TYPE_NC) ? + MLX5_IB_MMAP_TYPE_UAR_NC : MLX5_IB_MMAP_TYPE_UAR_WC; + entry->page_idx = uar_index; + entry->address = uar_index2pfn(dev, uar_index) << PAGE_SHIFT; + + err = rdma_user_mmap_entry_insert(&c->ibucontext, &entry->rdma_entry, + length); + if (err) + goto err_entry; + + mmap_offset = rdma_user_mmap_get_offset(&entry->rdma_entry); + err = uverbs_copy_to(attrs, MLX5_IB_ATTR_UAR_OBJ_ALLOC_MMAP_OFFSET, + &mmap_offset, sizeof(mmap_offset)); + if (err) + goto err_insert; + err = uverbs_copy_to(attrs, MLX5_IB_ATTR_UAR_OBJ_ALLOC_MMAP_LENGTH, + &length, sizeof(length)); + if (err) + goto err_insert; + err = uverbs_copy_to(attrs, MLX5_IB_ATTR_UAR_OBJ_ALLOC_PAGE_ID, + &uar_index, sizeof(uar_index)); + if (err) + goto err_insert; + + uobj->object = entry; + return 0; + +err_insert: + /* Removing the entry frees the UAR and the entry itself. */ + rdma_user_mmap_entry_remove(&entry->rdma_entry); + return err; +err_entry: + kfree(entry); +err_uar: + mlx5_cmd_uar_dealloc(dev->mdev, uar_index, c->devx_uid); + return err; +} + +DECLARE_UVERBS_NAMED_METHOD( + MLX5_IB_METHOD_UAR_OBJ_ALLOC, + UVERBS_ATTR_IDR(MLX5_IB_ATTR_UAR_OBJ_ALLOC_HANDLE, + MLX5_IB_OBJECT_UAR, + UVERBS_ACCESS_NEW, + UA_MANDATORY), + UVERBS_ATTR_CONST_IN(MLX5_IB_ATTR_UAR_OBJ_ALLOC_TYPE, + enum mlx5_ib_uapi_uar_alloc_type, + UA_MANDATORY), + UVERBS_ATTR_PTR_OUT(MLX5_IB_ATTR_UAR_OBJ_ALLOC_PAGE_ID, + UVERBS_ATTR_TYPE(u32), + UA_MANDATORY), + UVERBS_ATTR_PTR_OUT(MLX5_IB_ATTR_UAR_OBJ_ALLOC_MMAP_LENGTH, + UVERBS_ATTR_TYPE(u32), + UA_MANDATORY), + UVERBS_ATTR_PTR_OUT(MLX5_IB_ATTR_UAR_OBJ_ALLOC_MMAP_OFFSET, + UVERBS_ATTR_TYPE(u64), + UA_MANDATORY)); + +DECLARE_UVERBS_NAMED_METHOD_DESTROY( + MLX5_IB_METHOD_UAR_OBJ_DESTROY, + UVERBS_ATTR_IDR(MLX5_IB_ATTR_UAR_OBJ_DESTROY_HANDLE, + MLX5_IB_OBJECT_UAR, + UVERBS_ACCESS_DESTROY, + UA_MANDATORY)); + +DECLARE_UVERBS_NAMED_OBJECT(MLX5_IB_OBJECT_UAR, + UVERBS_TYPE_ALLOC_IDR(mmap_obj_cleanup), + &UVERBS_METHOD(MLX5_IB_METHOD_UAR_OBJ_ALLOC), + &UVERBS_METHOD(MLX5_IB_METHOD_UAR_OBJ_DESTROY)); + static const struct uapi_definition mlx5_ib_defs[] = { UAPI_DEF_CHAIN(mlx5_ib_devx_defs), + UAPI_DEF_CHAIN_OBJ_TREE_NAMED(MLX5_IB_OBJECT_UAR), {} }; diff --git a/sys/dev/mlx5/mlx5_ifc.h b/sys/dev/mlx5/mlx5_ifc.h index 3f75acd250da..0a3bb9b38568 100644 --- a/sys/dev/mlx5/mlx5_ifc.h +++ b/sys/dev/mlx5/mlx5_ifc.h @@ -7572,7 +7572,7 @@ struct mlx5_ifc_dealloc_uar_out_bits { struct mlx5_ifc_dealloc_uar_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; @@ -8583,7 +8583,7 @@ struct mlx5_ifc_alloc_uar_out_bits { struct mlx5_ifc_alloc_uar_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; From nobody Tue Jul 7 11:30:04 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 4gvfCc4Xs3z6dRML for ; Tue, 07 Jul 2026 11:30:04 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvfCc1Rztz3M9p for ; Tue, 07 Jul 2026 11:30:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783423804; 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=KC+LQMsKD5JMD2HbzUWXhIaAvPGMMJBG/wcVje8zDeo=; b=ErdLK1olAxwOR5NeYZ8/jcYdWJy3M19B3pjkSdgeDpf4M35WvW3a7k8hJ+RiKzInHRG1UP FAGHT4LNkEfbjc/YinmjBJ6+kn06rWimeN28oIZQnYfXYSF4vNakWesc3lzepe23hePtW+ vfF7vyYDOUbIMG/i8ygosEe8OI7pZJ5q9QiuoStp16kIVOYv8PMXm4EjwsqXFOnmSK6Ymu DOromQdAkMYemb03zv76C3zbx03/8xt5Ks9Qli2ZKlG6pV7cSNYub+/CvImgFgYWeCfHCc pM8z1QXBFPB0RTB57ErRMQce5H1NEsvXuS/NWdPzb9s4bzj+ghEeRS/DmnTD9g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783423804; a=rsa-sha256; cv=none; b=vNb9LEcAofOiiFZI9O24pOCflUjXiHWZXQTJH8kx68YFhCc0IIQebRy/XP6FkZn/g722kW 8tOvmvUrvoZIQzlFSwP2Su3kiIb1lLsRPu6HB+ULNthzsPVcZR8u+aPX/iI86TTLcZpMmB F4KsIoiEEoLCzsQzcqxwPsI7K+Bl4Iba9yWpNsU3DLxsRJbdkFtgcs2gQ3a1te5SkaJTFI 4UoFJqStklfnJXSjU/gvJ6ASi7NgQuAA0Errejtkbivx/i16K1SwSpt36Cam1VyKVl/q0M eeKW6TLZgB8Pr7Cfg+gcqtXc22SFwCfkXxMNPlUdhMoQuJOijD73XWyIYZkrHA== 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=1783423804; 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=KC+LQMsKD5JMD2HbzUWXhIaAvPGMMJBG/wcVje8zDeo=; b=rvUGSj3Qd/bV0RN+vyBxxC/3tZSAFvs9bQ0KBonEcKaYmUg7LZX/9zw982ysBiqS/2JunW LKynVvXB9uVUZHEjQhxMj+IEMvQe/GIDf5fqeqG1rvakLF0YlZK5Y/UgmY8f9D9zQqO78m KnuQFO1MfB8QcS4cbnN0OEqdlZj/lnMkWITMZhbwJeneCcddNa7KHeBaHTGEJ/LmCvZSo9 /doZNu54q+0aL0PorHoMZObq7qzQvA32Lt0zkq2sZ6U0+qhzZlvjPqGbQtkIkr/2LqgouE RAimAcKSDTyik5z2YkqdmlT5IiQQ+nV7LN5eS/wmsOz+EqRIE0BHmS89nxIMGg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvfCc0BGczYwY for ; Tue, 07 Jul 2026 11:30:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3605e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 11:30:04 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Ariel Ehrenberg From: Konstantin Belousov Subject: git: bfe14bfeb8dc - main - mlx5: mark completion EQs as a shared resource for DEVX uids 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bfe14bfeb8dcefc606bdf76c40987467bbd36d92 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 11:30:04 +0000 Message-Id: <6a4ce33c.3605e.66d03ba9@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=bfe14bfeb8dcefc606bdf76c40987467bbd36d92 commit bfe14bfeb8dcefc606bdf76c40987467bbd36d92 Author: Ariel Ehrenberg AuthorDate: 2026-06-04 15:46:17 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 11:24:48 +0000 mlx5: mark completion EQs as a shared resource for DEVX uids A firmware object owned by a DEVX uid may only reference resources owned by the same uid or ones explicitly marked as shared. Completion EQs were created with uid 0, so a CQ owned by a DEVX uid could not attach to its EQ and CREATE_CQ failed with "bad resource". Create completion EQs with MLX5_SHARED_RESOURCE_UID on devices that support user contexts, so uid-owned CQs can use them. The code follows the Linux commit d2c8a1554c10d5e0443b1f97f480d7dacd55cf55 ("IB/mlx5: Enable UAR to have DevX UID"). Reviewed by: kib Tested by: Wafa Hamzah Sponsored by: Nvidia networking MFC after: 1 month --- sys/dev/mlx5/mlx5_core/mlx5_eq.c | 8 ++++++++ sys/dev/mlx5/mlx5_ifc.h | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_eq.c b/sys/dev/mlx5/mlx5_core/mlx5_eq.c index f564b88c48b4..5279d71e3e86 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_eq.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_eq.c @@ -487,6 +487,14 @@ int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, mlx5_fill_page_array(&eq->buf, pas); MLX5_SET(create_eq_in, in, opcode, MLX5_CMD_OP_CREATE_EQ); + /* + * Completion EQs (no event mask) must be marked as a shared resource + * when the device supports user contexts; otherwise CQs owned by a + * DEVX uid cannot attach to them and CREATE_CQ fails with a firmware + * "bad resource" error. + */ + if (mask == 0 && MLX5_CAP_GEN(dev, log_max_uctx)) + MLX5_SET(create_eq_in, in, uid, MLX5_SHARED_RESOURCE_UID); MLX5_SET64(create_eq_in, in, event_bitmask, mask); eqc = MLX5_ADDR_OF(create_eq_in, in, eq_context_entry); diff --git a/sys/dev/mlx5/mlx5_ifc.h b/sys/dev/mlx5/mlx5_ifc.h index 0a3bb9b38568..952f51d3c3f7 100644 --- a/sys/dev/mlx5/mlx5_ifc.h +++ b/sys/dev/mlx5/mlx5_ifc.h @@ -26,6 +26,12 @@ #ifndef MLX5_IFC_H #define MLX5_IFC_H +/* + * Special UID that marks a resource (e.g. an EQ) as shared, so that + * objects owned by a user context (DEVX uid) may reference it. + */ +#define MLX5_SHARED_RESOURCE_UID 0xffff + #include enum { @@ -8317,7 +8323,7 @@ struct mlx5_ifc_create_eq_out_bits { struct mlx5_ifc_create_eq_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; From nobody Tue Jul 7 11:30:06 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 4gvfCf4qRgz6dRYw for ; Tue, 07 Jul 2026 11:30:06 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvfCf2KhPz3Ljy for ; Tue, 07 Jul 2026 11:30:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783423806; 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=8pa5k1ZNdzLP9yf+BVevpNWfcyhS90iBh1czXBgWNPw=; b=RAas5U1wK4Rjxe5svMjmvP4eaHEJinVqDNgiL2IF5sjQQ/oY6OndDN+kddUBCUUqDlZ0Gy ARpKcnan1VkVwD0jPlw4mgehTkfpV8nGd5gKxvUFTK9yQq4e1lM0DIn0EtInu2pZATP8+o it+g/JRj2g0018Dp9Te16/j8emh0Fqz4NSWvwsLaMYxJxOpgbHTV/Q4LuL5MuJC7sHrDX3 vZRMfyMCyF5DM96zDqFg46wn9WNHA+qr6sA/iZsHRDACvgnT3DMjkO7CuambzwSjFa6wBU zPiZbnJ5aqRnmmOSrXF9FpcsVqUFcO49o4G/0s6tcZgN+R1hVT6e2gXLfY2rUw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783423806; a=rsa-sha256; cv=none; b=chMK/esNX6Lc3P70M74WoFHrDWkiXiniiCMSpu68CE3lPQ4VOxucCP4cq6e29VxnSb9KrL VukLP43IqycDj+V/ipMrukxZXkDIrG5NM6F15Vld3lr6uZwJx5mn3pZPmFoFNi/rMHkCnw Vp9u0ZT2nZOET0x7I1VNJikApw0J2wZriAtVgF2vmDE6mPNc9DEkWASiomQ4V/IYGEJrOW 0G9BiAZ68T2/N+BVWg0hmRzGUbJggG73hxQR2USryTaEt6AJTkU8OMjXcuZehfxn6hwRN0 IDWaMzrTNjPsrXYbURODb3JmPtEoomKgT7FINtSL56Gz7Y2sXN5OvddIJD8Avg== 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=1783423806; 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=8pa5k1ZNdzLP9yf+BVevpNWfcyhS90iBh1czXBgWNPw=; b=SYoxIn/mNSa/24sa8XTBlZ98v2EdgBg5XsSHhVWzzHpN9akw4UqRlEh70JxhZHX1QSo7My osGPivi4UIlPZ45sbm8SlS2IFBU7GDm4RZPM7x/NkqQXy2FWh+F7It3sITMjXOgQRbDJON PuhRh0jNng7ojuXb0Pt58AFMwd229MB1IkVTizUQGTTPLNxTVt1ECHiECyqzq+bItjOJgI S/7AjLN+ZW4ysCN02fY5o3G/I9VYEHdDJiI7rZKF4Ao7BEtQMH9BNFtjAstcZ9pgTl59AW vkTrkAzF6Lzt5BkKsNFk1ef/TOBsCCpKbNVKO1hakOUnTb7Fq/qj1qeZC3RhEA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvfCf1471zZLp for ; Tue, 07 Jul 2026 11:30:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 33e69 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 11:30:06 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Ariel Ehrenberg From: Konstantin Belousov Subject: git: 631e57d54c13 - main - mlx5ib: encode dynamic UAR mmap offsets in the reserved command range 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 631e57d54c137e9393c47075db09a6c7fb84c6ed Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 11:30:06 +0000 Message-Id: <6a4ce33e.33e69.7ebbd721@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=631e57d54c137e9393c47075db09a6c7fb84c6ed commit 631e57d54c137e9393c47075db09a6c7fb84c6ed Author: Ariel Ehrenberg AuthorDate: 2026-06-08 10:55:47 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 11:25:06 +0000 mlx5ib: encode dynamic UAR mmap offsets in the reserved command range The UAR ioctl handed user space a raw mmap offset, so the first dynamic UAR landed at page offset 0. mlx5_ib_mmap() decodes offset 0 as the legacy regular-page command and routed the mapping through the old bfreg path, which rejects dynamic-UAR contexts, so mmap() failed with EINVAL and mlx5dv_devx_alloc_uar() returned NULL. Follow the upstream scheme: reserve the mmap command range [9, 255] for rdma_user_mmap entries and return command-encoded offsets, so the dynamic-UAR mappings decode to the intended mlx5_ib_mmap() path. Reviewed by: kib Tested by: Wafa Hamzah Sponsored by: Nvidia networking MFC after: 1 month --- sys/dev/mlx5/mlx5_ib/mlx5_ib.h | 11 +++++++++++ sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 24 +++++++++++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h index bbc7aa4a170a..c4775319ea47 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib.h +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib.h @@ -66,6 +66,17 @@ enum { MLX5_IB_MMAP_CMD_MASK = 0xff, }; +/* + * Reserved mmap command range used to encode rdma_user_mmap entry page + * offsets (e.g. dynamically allocated UARs). Keeping these above the legacy + * MLX5_IB_MMAP_* commands ensures mlx5_ib_mmap() routes them to the + * rdma_user_mmap offset handler instead of the legacy bfreg uar_mmap() path. + */ +enum { + MLX5_IB_MMAP_OFFSET_START = 9, + MLX5_IB_MMAP_OFFSET_END = 255, +}; + enum { MLX5_RES_SCAT_DATA32_CQE = 0x1, MLX5_RES_SCAT_DATA64_CQE = 0x2, diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c index daf5cb217001..66d8d511f2f0 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c @@ -1675,6 +1675,25 @@ static unsigned long mlx5_vma_to_pgoff(struct vm_area_struct *vma) return (command << 16 | idx); } +static u64 mlx5_entry_to_mmap_offset(struct mlx5_user_mmap_entry *entry) +{ + u64 cmd = (entry->rdma_entry.start_pgoff >> 16) & 0xFFFF; + u64 index = entry->rdma_entry.start_pgoff & 0xFFFF; + + return (((index >> 8) << 16) | (cmd << MLX5_IB_MMAP_CMD_SHIFT) | + (index & 0xFF)) << PAGE_SHIFT; +} + +static int mlx5_rdma_user_mmap_entry_insert(struct mlx5_ib_ucontext *c, + struct mlx5_user_mmap_entry *entry, + size_t length) +{ + return rdma_user_mmap_entry_insert_range( + &c->ibucontext, &entry->rdma_entry, length, + (MLX5_IB_MMAP_OFFSET_START << 16), + ((MLX5_IB_MMAP_OFFSET_END << 16) + (1UL << 16) - 1)); +} + static int mlx5_ib_mmap_offset(struct mlx5_ib_dev *dev, struct vm_area_struct *vma, struct ib_ucontext *ucontext) @@ -3416,12 +3435,11 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_UAR_OBJ_ALLOC)( entry->page_idx = uar_index; entry->address = uar_index2pfn(dev, uar_index) << PAGE_SHIFT; - err = rdma_user_mmap_entry_insert(&c->ibucontext, &entry->rdma_entry, - length); + err = mlx5_rdma_user_mmap_entry_insert(c, entry, length); if (err) goto err_entry; - mmap_offset = rdma_user_mmap_get_offset(&entry->rdma_entry); + mmap_offset = mlx5_entry_to_mmap_offset(entry); err = uverbs_copy_to(attrs, MLX5_IB_ATTR_UAR_OBJ_ALLOC_MMAP_OFFSET, &mmap_offset, sizeof(mmap_offset)); if (err) From nobody Tue Jul 7 11:30:07 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 4gvfCg47VRz6dRc1 for ; Tue, 07 Jul 2026 11:30: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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvfCg2jDHz3M36 for ; Tue, 07 Jul 2026 11:30:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783423807; 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=UQ5QQ6/bMtLTrV3JUbjG+w1P36HKEgznwWP/OebSpQQ=; b=MGbhrEE/6egi7ywQeHBdCADn1KDhA+BkkGumklVsy9ReD/gvrqYzSCfQsnzTlLn6Rgfe/V biG3hbsua2Yz5o7leZbd+wbv9Q7BDpcgU4VKtR+c0XNDjPJWEPtawRQzAiXksfUY+I+iyP ki61r4hMXUfRArnCv1LDYeZr7blg8ichK5os428Efv61Daz6U9jNlBi66Us076R39zeUdU V2Sn1hhNowXS4kfGJocKhp9Fku1jAC0LIe25B/8zYF4pPCAG3LlOGWjxLbmu51CX0jnDTI pjf6IkIsyrT/ASVacFG0MSYqSpNydqabLfnD4JPWK2wwXZNsvS+kTZJqLq7PFQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783423807; a=rsa-sha256; cv=none; b=NoXoqENz2lj2/8jgL1DnpeOO+nHLM6zIUG5TMXI8gZhcDf7mB9GDwB6YGLBlB8FUSzx2Sd HgNkTsRIILqYKMvrhkhU4l1qaUHe3ZQ5GqA4VTMdwStsDe0PWtIaXnY/w4+XbPqtGyRSUp D5+NPVoCeyKqNW4oX+zUYeNU5tPwtfahn5VgvEDJ5o5NbNh2Wp8RwPGs4BDLwXWS4BZbf8 QrQlPNaZ1hIHzZCiHWRVgMOsoJM8i3LbG3GlzqSh18D6HiGSdAZsNRjp6NAbAMNkCgKGfW awDGR//m9wq0WwVj4kjY2Ac8akG25cXO73LQMr5RuM84cq+NqOPpp3+sCUN8FQ== 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=1783423807; 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=UQ5QQ6/bMtLTrV3JUbjG+w1P36HKEgznwWP/OebSpQQ=; b=DREpMtAMFPvTFYOqNg1KPKcgBj488IyitihVsc9L5ID3J60uMhcVAiUQy0wOayBdFumQ/o pq1nMhNlp6DCRS6LwcXFUEulJxcEeQF4tPrdaH5LuyVTmcOM7rkQIYr0cgwPFClqRncJry 7AxPMgd2acm7IdvjJftwDjWLmVubtt2YHJclkEdDhnV+RiYaHxT02MqfFYwaSzN1bfyl84 CiGV/5M0tpifoVFLC+vEN3BbpmCZTQGYDRnzmbp9fHxDqGjCaaWz5MWCVKngDG0ofTAVfT U1Q/TzA6pONcU30XXS/h4X63Z3iKU0Rvf+CYF7RLUKLt72i6Ey3We2S8EFeecQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvfCg1WMtzZ9G for ; Tue, 07 Jul 2026 11:30:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 360b8 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 11:30:07 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Ariel Ehrenberg From: Konstantin Belousov Subject: git: 80902b8b7cd4 - main - mlx5ib: advertise write-combining support for dynamic BlueFlame UARs 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 80902b8b7cd409ade11048dc78212e7d43475c65 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 11:30:07 +0000 Message-Id: <6a4ce33f.360b8.4050a7e2@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=80902b8b7cd409ade11048dc78212e7d43475c65 commit 80902b8b7cd409ade11048dc78212e7d43475c65 Author: Ariel Ehrenberg AuthorDate: 2026-06-08 10:56:04 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 11:25:15 +0000 mlx5ib: advertise write-combining support for dynamic BlueFlame UARs Import Linux upstream commit 1f3db161881b7e21efb149e0ae8152b79a571a8f. dev->wc_support was never set, so it was always false and the UAR ioctl refused BlueFlame (write-combining) UAR allocations with EOPNOTSUPP. That breaks QP creation in pure dynamic-UAR mode, where user space asks for a BF doorbell UAR. Reviewed by: kib Tested by: Wafa Hamzah Sponsored by: Nvidia networking MFC after: 1 month --- sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c index 66d8d511f2f0..ee5288c07b35 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c @@ -3551,6 +3551,16 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) dev->mdev = mdev; + /* + * Write-combining is required to expose BlueFlame (WC) UARs through the + * dynamic MLX5_IB_OBJECT_UAR ioctl path. The legacy static UAR path + * already maps doorbell pages with pgprot_writecombine(), so advertise + * WC support whenever the platform actually provides it. + */ +#if defined(VM_MEMATTR_WRITE_COMBINING) + dev->wc_support = true; +#endif + dev->port = kcalloc(MLX5_CAP_GEN(mdev, num_ports), sizeof(*dev->port), GFP_KERNEL); if (!dev->port) From nobody Tue Jul 7 11:30:05 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 4gvfCd5y7Dz6dRXM for ; Tue, 07 Jul 2026 11:30:05 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvfCd1yb4z3M58 for ; Tue, 07 Jul 2026 11:30:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783423805; 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=tm3sstQ5t8oaCS+5vvd7BhjKRcBzA72vGA+uwppgbkE=; b=evp6TaDsdtOyROtI+jYZF3gKMzvu8EeyFkVZ4N6C/POedL2xinNDqo35Ksh5a8hHC1cSB/ X6N4OlNrBTuRYgkV8yzrODs3IsDDpbx5oDFlwAreeExB7/WjEILq0VYML8Cx8XN4NltRZy RhgQzhUep9TaNtUlsDdZw1NfumGTct4wpgFMVtnTQ70FOCDJKKHMsPd123lYzg4KowTsFf Ku/yOwuGbdM77rrpwRBrPSitpf2dHhxamy+WXHgQP07lJ97zF0sN7Syt5tY8k/56aSz0fn zZhnKwvFyxELs7BKBqH9rBcsn363ulorCf2fbFAZGLkcsJGAA8ZqHZBZ/8jmIg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783423805; a=rsa-sha256; cv=none; b=WgpFXjDqfeOV9sXT4zOh2/cemfgH5WF8Exwh9d7N7EtEsSLFBib2fWZCKqaKZzNhgPEZhl 5jtGnQByo1B1W2nwoFH6k9kBGmu+1rPbxBNOigcFljog6KyC4LHdFRz7SuTmBYeGvbdTGK 6ouIvaL6gYOJGAVbM3skoeRMfiQJGcekyTFyrieGrc/9XEyUl5KNb3jxspYNy4q8T8uD0N fy1Tgap3FzzWYrJQ8MckzlsWTk5DdvwW1eVDoVicrVcIg31jliQoK+fD9kk27g/3YZY2J8 5R+wxVp1+CYvDyVQYLBC+na/yyl9U+cWSOaTliXFH9fRd8USbdKTlCu+75awbQ== 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=1783423805; 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=tm3sstQ5t8oaCS+5vvd7BhjKRcBzA72vGA+uwppgbkE=; b=s4LclYbnb9wfa17ZYE2WicCyDN5IGed1cd+GAYZCSqWv07BOzx36hAloz5Vs+4b4zkh/N5 ddBBlRenfDNkrKxZWdFU8S3IUiPPsbroaElrs5wweDVkgHRbYDtmRcRICbJVtxRKK3rkXN a4CjkX2iRwj4XGwHkH1Bi5gJrmwK++omY1eiysRACjSURoH6qJbWL4K4SCHoylUBlFEOph Av95OUP/qRK6IPt7jxN8Ub/PBC+Qmxbsy5rHYVz4Ku53CaAa5iu1oDQC0XC/inKLeq8L0Z vXkfOfrdKDf1ZvnocNIIHNaT2SOfYFf8dqzLkgHfoLL7KNTu9byVoMRTXNPs3w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvfCd0cvzzYwZ for ; Tue, 07 Jul 2026 11:30:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 34878 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 11:30:05 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Ariel Ehrenberg From: Konstantin Belousov Subject: git: 412aa220aeb9 - main - mlx5ib: allocate IB queue counters as a shared resource 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 412aa220aeb920dcbc0f2b3effbbb51ad41c7fc3 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 11:30:05 +0000 Message-Id: <6a4ce33d.34878.31b00570@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=412aa220aeb920dcbc0f2b3effbbb51ad41c7fc3 commit 412aa220aeb920dcbc0f2b3effbbb51ad41c7fc3 Author: Ariel Ehrenberg AuthorDate: 2026-06-04 15:46:28 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 11:24:57 +0000 mlx5ib: allocate IB queue counters as a shared resource A QP owned by a DEVX uid references the port's queue counter. The counter was allocated with uid 0, so RST2INIT_QP on a uid-owned QP failed with "bad resource state". Allocate and free the IB queue counters directly and, on devices that support user contexts, stamp them with MLX5_SHARED_RESOURCE_UID so uid-owned QPs can use them. The code follows the Linux commit d2c8a1554c10d5e0443b1f97f480d7dacd55cf55 ("IB/mlx5: Enable UAR to have DevX UID"). Reviewed by: kib Tested by: Wafa Hamzah Sponsored by: Nvidia networking MFC after: 1 month --- sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c index fc9af189f3fa..daf5cb217001 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c @@ -3223,9 +3223,17 @@ static void mlx5_disable_roce(struct mlx5_ib_dev *dev) static void mlx5_ib_dealloc_q_port_counter(struct mlx5_ib_dev *dev, u8 port_num) { - mlx5_vport_dealloc_q_counter(dev->mdev, - MLX5_INTERFACE_PROTOCOL_IB, - dev->port[port_num].q_cnt_id); + u32 in[MLX5_ST_SZ_DW(dealloc_q_counter_in)] = {}; + u32 out[MLX5_ST_SZ_DW(dealloc_q_counter_out)] = {}; + + if (!dev->port[port_num].q_cnt_id) + return; + + MLX5_SET(dealloc_q_counter_in, in, opcode, + MLX5_CMD_OP_DEALLOC_Q_COUNTER); + MLX5_SET(dealloc_q_counter_in, in, counter_set_id, + dev->port[port_num].q_cnt_id); + mlx5_cmd_exec(dev->mdev, in, sizeof(in), out, sizeof(out)); dev->port[port_num].q_cnt_id = 0; } @@ -3239,19 +3247,31 @@ static void mlx5_ib_dealloc_q_counters(struct mlx5_ib_dev *dev) static int mlx5_ib_alloc_q_counters(struct mlx5_ib_dev *dev) { + u32 in[MLX5_ST_SZ_DW(alloc_q_counter_in)] = {}; + u32 out[MLX5_ST_SZ_DW(alloc_q_counter_out)] = {}; int i; int ret; + MLX5_SET(alloc_q_counter_in, in, opcode, MLX5_CMD_OP_ALLOC_Q_COUNTER); + /* + * On devices that support user contexts, allocate the queue counters + * as a shared resource so QPs owned by a user context (DEVX uid) can + * reference them; otherwise RST2INIT_QP fails with a firmware "bad + * resource state" error. + */ + if (MLX5_CAP_GEN(dev->mdev, log_max_uctx)) + MLX5_SET(alloc_q_counter_in, in, uid, MLX5_SHARED_RESOURCE_UID); + for (i = 0; i < dev->num_ports; i++) { - ret = mlx5_vport_alloc_q_counter(dev->mdev, - MLX5_INTERFACE_PROTOCOL_IB, - &dev->port[i].q_cnt_id); + ret = mlx5_cmd_exec(dev->mdev, in, sizeof(in), out, sizeof(out)); if (ret) { mlx5_ib_warn(dev, "couldn't allocate queue counter for port %d, err %d\n", i + 1, ret); goto dealloc_counters; } + dev->port[i].q_cnt_id = MLX5_GET(alloc_q_counter_out, out, + counter_set_id); } return 0; From nobody Tue Jul 7 11:30:08 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 4gvfCj0cLwz6dRR0 for ; Tue, 07 Jul 2026 11:30:09 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvfCh30FZz3Lpp for ; Tue, 07 Jul 2026 11:30:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783423808; 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=XbmOqX+Poeit/+Oh8+qlvYYKBmfKHjMZtgZM8VtxYRA=; b=lB5tDSqUHPkPt/kE+91zfS/KTHTUgeHKCCVGu5JANf/GgEEkrRajr9tNOzsZI5mcXLUeGD q0MNdk1m+aHZaxikPPhNabzcfZoBpLG1U0B3tznaitStea+0hbEX+0ZGfljmRsubYQCJ/O 8mthGPtPkUYgBxXUH5O3b2bdLEOuPLv8W1siFoVJ7FlCtxYW/r2BZwlYCpLK2YNuzZwRws mSQAjMkkuFN91gxOK9Pi5fakcGa2dmuyggY2UL29LgK6ltoeA5Cp3rh6cOjloOOESPx8mB bFpvKp2lAQQAFuza5GYiVtqhIOZ1dMFKUHhULwZGF5OKYnUCstYcSmw/v3ivQw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783423808; a=rsa-sha256; cv=none; b=RdZnUGTho4V9CxTHLxiCa9xEI6Cg1LoUq90K5zkqa8KjRLGEz0wAlkKpanOxUUnv5VAWOc 4x4yRNPbAqsrXy63lhluit6xAk2C2UP59gLVkBA4FCyjHMK7fC+Y8VAb+p0ZqZo9mSsC78 ptReluIofzc2bGGLOUqwEnVhkDEtOxsz0R5qi2kvI54HHr5MyZypls8j3hhUpjFyNWUOgV 95/89xgc+8xcvxLHSZavB4FzNmKciHUlAonHgzoVSJMd68WKr1vuwCar90WmfWRRwKf8pD 6RJkTIPqoQw7z6xxnGhVE7l/F6wN3jHxU9scMxer8ZiAsKDsDd1ttTWiIuwWVg== 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=1783423808; 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=XbmOqX+Poeit/+Oh8+qlvYYKBmfKHjMZtgZM8VtxYRA=; b=XBmahxfl/HY0Zxa8FM2ie/Yp0taPxVkwQBcGhBiiJDK7abDo/n5gsWanWA0FFoUdUra0pw sSKA8LWkwRzgKL4vKHR97nSqMbKPzsciwEG2VF6TZyTwMsH8bFUo3D6HtS5BwNzG8GFRlC +zW2wuMcZoeYlIEPqpI6NEkE80jnKUMXSs5G7MY7Hi4GkkPmoVwMYmxF6NtVLmo+uSmoxo rwZSZYT+KiBOTtcSlh5LYnJ8sKB+LOqzf1XfGzDUiKZqWO+PzZxHbo8qkcOTgSvZlL0JN+ klphb+RR2NOk+oYnfF83wY3AfPSBVOQhoSlyWnl4L7WHspgxFp1nJ7/nMhincg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvfCh1wf1zZ9H for ; Tue, 07 Jul 2026 11:30:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 36ea0 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 11:30:08 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Ariel Ehrenberg From: Konstantin Belousov Subject: git: a7298669cd53 - main - ofed/ib_uverbs: release rdma_user_mmap entry ref in rdma_umap_close() 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a7298669cd53a9fc8446c53db6872bc2f64c508d Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 11:30:08 +0000 Message-Id: <6a4ce340.36ea0.5e342732@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a7298669cd53a9fc8446c53db6872bc2f64c508d commit a7298669cd53a9fc8446c53db6872bc2f64c508d Author: Ariel Ehrenberg AuthorDate: 2026-06-08 10:56:16 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 11:25:23 +0000 ofed/ib_uverbs: release rdma_user_mmap entry ref in rdma_umap_close() Import Linux upstream commit 3411f9f01b76bd88aa6e0e013847ab6479cb4f24. rdma_umap_priv_init() takes a reference on the rdma_user_mmap entry for every VMA it maps, but rdma_umap_close() never dropped it. The entry was therefore never freed and lingered in ucontext->mmap_xa, tripping WARN_ON(!xa_empty(&ucontext->mmap_xa)) at context teardown and leaking the firmware UAR on every context close. Reviewed by: kib Tested by: Wafa Hamzah Sponsored by: Nvidia networking MFC after: 1 month --- sys/ofed/drivers/infiniband/core/ib_uverbs_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c b/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c index 1586c23d28d4..42b6d55de56e 100644 --- a/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c +++ b/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c @@ -745,6 +745,8 @@ static void rdma_umap_close(struct vm_area_struct *vma) * this point. */ mutex_lock(&ufile->umap_lock); + if (priv->entry) + rdma_user_mmap_entry_put(priv->entry); list_del(&priv->list); mutex_unlock(&ufile->umap_lock); From nobody Tue Jul 7 11:30:10 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 4gvfCl075xz6dRZ6 for ; Tue, 07 Jul 2026 11:30:11 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvfCk3wjjz3M7Q for ; Tue, 07 Jul 2026 11:30:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783423810; 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=t6sWw2VIs1OWaWQSS14SRydd7i0rKe6aQvQJTgiQ6F8=; b=v2Ho7U3SmsN7MAdcSIF9QBIFVLux2U0hFtrrO3No1i+i2VAcmhPzHNuI/M8hGsBzDm2P2k Q2w5jHgXbDkv3U7JyxsmgrPKA9ECZDY4oc3GWRhU7C7VV25kzD6ACwXVw5X/X1YVN2YMH/ r4dmDXjSP7ZgEmOBTBk72qNBn/80aKKI7k78pQZR6BYUqRuYhdcUXtMptrUKWGvfrK2llK nnAzePG9CrTDG7L60F3YGl+NE+1Ar2CaPMnBkpm+PF4acoN4kNmgpHEgnIeeCmWgJRceWV N+O72egMbVrBz7yxa+Or9kuzFRgaoM8BEVnyBQfTNA/H5CnhLbyvqw5NeDv3ow== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783423810; a=rsa-sha256; cv=none; b=E0ZLvUOu7aGdXuLE4s7DRvrWyf2vRR139sxLcseOhxIB16VhOWOuWc8FdUGwzqaWb+lall m9BAB+1RFspkVs7gRhxLhssrKSXwnBNrId7I7nqdQhp3TYDfEu+B5v5IbwjmwSl5WyFKXw yfqGRpxS9upiyau7BRP3C/6QAPHptuXbW+O12or0hSzGbB/+rqjN+lHitLAjdmVoYAPftU CW8ZcwV0nRp8vshUqjza/iSHHmFyByWkr+cTVRbWkIA3zjvPbdiCN9MR0YktVA8bAjgDLd S02livlk0vkGNx5eLtRPkhGT0zgDqm3s9nleU3ZMsBQqvwuu4xwQA1WJAygT/w== 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=1783423810; 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=t6sWw2VIs1OWaWQSS14SRydd7i0rKe6aQvQJTgiQ6F8=; b=fxNDvpwLqu0isRrSpl8syk+Q/J/5hVmz4PmnlzBnnIVufMbm19vpyR5IBsu/LVZDxophFe kolT26qwR8fuOgneegrH3Tk79Sk8hpSJjYBHtbCK804o0lf6HWXCrrWi2FxoYDL8ds/g7P C+X9pjh9pTE4dLjKQ8D40HiaIvNJtNESW3H4soQYRLwB6C5qkVvqYPPhsnUA+DBj2Z5hSr FNSbpy5aKCCWZIJcr/wBGo4QW+9jksYBydUsK7Ro0kuSisZJjFHST4Sb0a1ioy2ZxP6Eo4 7/HfugtzxjZhWMIaQU/opgCOM1TGGN3SiaVkT4J2TWbEBi02lZANG/qye/3CUg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvfCk2jdLzZ0D for ; Tue, 07 Jul 2026 11:30:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 347ec by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 11:30:10 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Ariel Ehrenberg From: Konstantin Belousov Subject: git: 284e06dec78f - main - mlx5: guard against a NULL CQ event handler in mlx5_cq_event() 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 284e06dec78ffbbf8919dc0aa11073ecabba7176 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 11:30:10 +0000 Message-Id: <6a4ce342.347ec.5f1501ed@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=284e06dec78ffbbf8919dc0aa11073ecabba7176 commit 284e06dec78ffbbf8919dc0aa11073ecabba7176 Author: Ariel Ehrenberg AuthorDate: 2026-06-15 08:16:17 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 11:25:41 +0000 mlx5: guard against a NULL CQ event handler in mlx5_cq_event() DEVX and mlx5en created CQs are registered without an asynchronous event handler (mcq.event is NULL). An asynchronous CQ_ERROR event for such a CQ made mlx5_cq_event() call through a NULL pointer and panic. Reviewed by: kib Tested by: Wafa Hamzah Sponsored by: Nvidia networking MFC after: 1 month --- sys/dev/mlx5/mlx5_core/mlx5_cq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_cq.c b/sys/dev/mlx5/mlx5_core/mlx5_cq.c index fa28ae6dece9..f1f8fc03de6c 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_cq.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_cq.c @@ -113,7 +113,8 @@ void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type) spin_unlock(&table->writerlock); if (likely(cq != NULL)) { - cq->event(cq, event_type); + if (cq->event) + cq->event(cq, event_type); } else { mlx5_core_warn(dev, "Asynchronous event for bogus CQ 0x%x\n", cqn); From nobody Tue Jul 7 11:30:11 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 4gvfCm0Qlpz6dRSr for ; Tue, 07 Jul 2026 11:30:12 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvfCl4C0nz3M3G for ; Tue, 07 Jul 2026 11:30:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783423811; 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=yqvbfavUGTcTRhCNLl0eh+Ho8GurkEm81RfBnp4h+/M=; b=KS5+91pxrTyFNT8bOZISWWxVr+JiDG5oyGqw/UggBVWMqOgBGBuPTXlfVnlDS8bbh9hMDz tzrdGzUVKi8dsUlAxPekt525DzL3DuktenaIAIw9xZr5rs2gpjgjNTpXhZF19ew4rwOxIk llblgTL5LOuN7s7e/IggfqEQOBOJv4myhPgvP2o5n/VZc2ObmF1UCBCBT8xsaxJ6aP+KV2 JxldO5/esPVjzTl7wpsCmamckvAxbeiDEkD3WqaVnM7kOOsbZd5HPb/8kGdopKOh6PYslD sDcYNi8GLH8lAMnCcqN7be8RnajpHYnAp12nBV9Ar3uXnLuvBM6xvt1Mb8xXkw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783423811; a=rsa-sha256; cv=none; b=I1J20uEz9icA8EZpVuSxsvFZMgG4syH4l5nhCiIeXw8oykUO3m3lN6OgcO+t+0KjX1YNCQ CqjulE8HQtkBJW7AAHTMKGUtGzT5j7PjL8RwSFDLRxNVMQMa+WiJbCl6TD74PtScbzHLIt 9qiwQHWkbJsxNBKqcIgtjWKresNKn6jQizr3A7CxAaHFmlbzgzVxEEY/6Y8iNdctlyu2N1 HcRK1D/z6v06jt2B0zMQ09C/ngcIYisM88XlQVFiuO5BMrNMXppwDudRp5+VMIinke9rIU YczwaTqfxQPrfNZW39wBGLLqWw8M/8yuCO4xUeuyD8mNVA4p7/zE3phTC1LcJA== 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=1783423811; 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=yqvbfavUGTcTRhCNLl0eh+Ho8GurkEm81RfBnp4h+/M=; b=UUJFpRMiiWZ29HmeUYD5RlUz449xUCdbOCe3vPg0CN+mkPelKjy4F70yc/I+BdNs95G/6m 6rqttfx23cOqHay1yXYMeqc52V3y4Y6wKkxp06tWiS7J7vgJcCGpQbZSCSfgMK2NR8oYg/ GpLEc04uG//+akuc61yTA8y69y/paCA9iVKkDpthEGdBUoCqtnUVSblPX/TXgOBIpP6DD+ 47iDaRwyTuToR5bx6XdFpMYmRb7vnMVcDDJ0AVi7VoFN46o9qo7ol9R9oqNGnaaxHNmk9S VkGQkNS3UpBQTrixjscgrAhYqjqR1LTqGHKpaafgELe6zj8oQ1Z0uL8+8+y+4Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvfCl3DnQzYwb for ; Tue, 07 Jul 2026 11:30:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 36f1d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 11:30:11 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Ariel Ehrenberg From: Konstantin Belousov Subject: git: 07f780cb7f8e - main - mlx5: propagate the DEVX uid through SRQ create and destroy 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 07f780cb7f8eab1aa6e84d3ed6785144d0d3cc47 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 11:30:11 +0000 Message-Id: <6a4ce343.36f1d.d1fcdb8@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=07f780cb7f8eab1aa6e84d3ed6785144d0d3cc47 commit 07f780cb7f8eab1aa6e84d3ed6785144d0d3cc47 Author: Ariel Ehrenberg AuthorDate: 2026-06-15 19:00:47 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 11:25:49 +0000 mlx5: propagate the DEVX uid through SRQ create and destroy The SRQ command builders never stamped the owning DEVX uid into the firmware CREATE_SRQ/CREATE_RMP/CREATE_XRC_SRQ commands, so a basic SRQ was always created with uid 0. Every modern libmlx5 context runs with a DEVX uid, and the QPs that reference the SRQ carry that uid, so firmware rejected CREATE_QP with "bad resource": a uid-owned QP may not reference a uid-0 SRQ. Reviewed by: kib Tested by: Wafa Hamzah Sponsored by: Nvidia networking MFC after: 1 month --- sys/dev/mlx5/driver.h | 1 + sys/dev/mlx5/mlx5_core/mlx5_srq.c | 30 +++++++++++++++++++++++++++--- sys/dev/mlx5/mlx5_ifc.h | 2 +- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/sys/dev/mlx5/driver.h b/sys/dev/mlx5/driver.h index ba6714c5c7b6..f5a73bec0776 100644 --- a/sys/dev/mlx5/driver.h +++ b/sys/dev/mlx5/driver.h @@ -481,6 +481,7 @@ struct mlx5_sq_bfreg { struct mlx5_core_srq { struct mlx5_core_rsc_common common; /* must be first */ u32 srqn; + u16 uid; int max; size_t max_gs; size_t max_avail_gather; diff --git a/sys/dev/mlx5/mlx5_core/mlx5_srq.c b/sys/dev/mlx5/mlx5_core/mlx5_srq.c index 7318a5b2c3c8..cd705ae6de88 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_srq.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_srq.c @@ -166,7 +166,10 @@ static int create_rmp_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq, set_wq(wq, in); memcpy(MLX5_ADDR_OF(rmpc, rmpc, wq.pas), in->pas, pas_size); + MLX5_SET(create_rmp_in, create_in, uid, in->uid); err = mlx5_core_create_rmp(dev, create_in, inlen, &srq->srqn); + if (!err) + srq->uid = in->uid; kvfree(create_in); return err; @@ -175,7 +178,14 @@ static int create_rmp_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq, static int destroy_rmp_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq) { - return mlx5_core_destroy_rmp(dev, srq->srqn); + u32 in[MLX5_ST_SZ_DW(destroy_rmp_in)] = {0}; + u32 out[MLX5_ST_SZ_DW(destroy_rmp_out)] = {0}; + + MLX5_SET(destroy_rmp_in, in, opcode, MLX5_CMD_OP_DESTROY_RMP); + MLX5_SET(destroy_rmp_in, in, rmpn, srq->srqn); + MLX5_SET(destroy_rmp_in, in, uid, srq->uid); + + return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); } static int query_rmp_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq, @@ -232,7 +242,10 @@ static int create_xrc_srq_cmd(struct mlx5_core_dev *dev, MLX5_SET(xrc_srqc, xrc_srqc, user_index, in->user_index); memcpy(pas, in->pas, pas_size); + MLX5_SET(create_xrc_srq_in, create_in, uid, in->uid); err = mlx5_core_create_xsrq(dev, create_in, inlen, &srq->srqn); + if (!err) + srq->uid = in->uid; if (err) goto out; @@ -244,7 +257,14 @@ out: static int destroy_xrc_srq_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq) { - return mlx5_core_destroy_xsrq(dev, srq->srqn); + u32 in[MLX5_ST_SZ_DW(destroy_xrc_srq_in)] = {0}; + u32 out[MLX5_ST_SZ_DW(destroy_xrc_srq_out)] = {0}; + + MLX5_SET(destroy_xrc_srq_in, in, opcode, MLX5_CMD_OP_DESTROY_XRC_SRQ); + MLX5_SET(destroy_xrc_srq_in, in, xrc_srqn, srq->srqn); + MLX5_SET(destroy_xrc_srq_in, in, uid, srq->uid); + + return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); } static int query_xrc_srq_cmd(struct mlx5_core_dev *dev, @@ -304,10 +324,13 @@ static int create_srq_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq, memcpy(pas, in->pas, pas_size); MLX5_SET(create_srq_in, create_in, opcode, MLX5_CMD_OP_CREATE_SRQ); + MLX5_SET(create_srq_in, create_in, uid, in->uid); err = mlx5_cmd_exec(dev, create_in, inlen, create_out, sizeof(create_out)); kvfree(create_in); - if (!err) + if (!err) { srq->srqn = MLX5_GET(create_srq_out, create_out, srqn); + srq->uid = in->uid; + } return err; } @@ -320,6 +343,7 @@ static int destroy_srq_cmd(struct mlx5_core_dev *dev, MLX5_SET(destroy_srq_in, srq_in, opcode, MLX5_CMD_OP_DESTROY_SRQ); MLX5_SET(destroy_srq_in, srq_in, srqn, srq->srqn); + MLX5_SET(destroy_srq_in, srq_in, uid, srq->uid); return mlx5_cmd_exec(dev, srq_in, sizeof(srq_in), srq_out, sizeof(srq_out)); } diff --git a/sys/dev/mlx5/mlx5_ifc.h b/sys/dev/mlx5/mlx5_ifc.h index 952f51d3c3f7..1906b670f013 100644 --- a/sys/dev/mlx5/mlx5_ifc.h +++ b/sys/dev/mlx5/mlx5_ifc.h @@ -7212,7 +7212,7 @@ struct mlx5_ifc_destroy_rmp_out_bits { struct mlx5_ifc_destroy_rmp_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10]; From nobody Tue Jul 7 11:30:09 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 4gvfCj6FHFz6dRXR for ; Tue, 07 Jul 2026 11:30:09 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvfCj3KLjz3Lpq for ; Tue, 07 Jul 2026 11:30:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783423809; 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=iz35QXw2Ru4JX9JI3wCvMe6r0IZi+qgjTxrSNVlYEfU=; b=Asfp2B2zNm58PRNMr4ZE4FCxyFVnDc/0tyqEZf31tAvMkM/xNbhj/QR44cP9KQYRL0dgWz yMoSltWkzlESePi54k4sfgs83JGYjpzmNEY2u7Fm8JcNduxhQ0eUwqnMt7XF3i8fs6sZfM txwUDttmLiY7KeV0NrjSd5Pqrg8HNo71c6pV4n+pzDhs4gD3ihLnBagznwl7IX6dr8ovN3 gpfbKARCC67osEcKme2jH9r3pY4fRWbbe4EvuIUiZbrJZ4XUPJNt0Rjv08vAmg0TnoZ/Zg b59FWX3i10/dYWpJxx5e/D1QQoevdjNelVBqXULIeEJ1KzJ1Csv12sRVVED9Xw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783423809; a=rsa-sha256; cv=none; b=QCdeLA7WseIv8QirF4/htdVHghKiSnMGI4wwwiEnLhoIQC9VbKhHLslQrapF1H32tNRoEZ qL/LO7o5o58hEqaT8y3YrZYQZSzZL1lHgk4NfU0H9hxTNDeisMayjvui2mEesUB6Vg5lbr rGsDYIBrJnThhWqYmxzsSJ9BNLnsNynD1JGdJpVVUSj/GY+nzRAFt/dG2ACw52s/jyNza2 UU0EqR2FLLmI7R6nyjly05LPfxEP1SNYtwuqCVlDRdHA2t8DbyrppwtS++i2QzhRAvnmkf S8dK4khV+S+cBxNGi6tci2DzlsUCnss/n4Hrf5Gec0v1YeP9kEXGpdX75GkPAA== 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=1783423809; 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=iz35QXw2Ru4JX9JI3wCvMe6r0IZi+qgjTxrSNVlYEfU=; b=QPUZtJMY6rCE3a0V4H+JojxNFgPG+MVNcCpQuS6xyzFUuouN5xW7fP/+TujlHXNDR4jRFA BMhYAB7dRCiS5fEFiAjjVMjOaPo1tLUodgH+UIL2F3dinpEc8jUGvcKsojkN8jeQCSXz3d Re7C/+F0H3xaAy3Bm4wKOSgBBz7r5g9BUz1lOYCIl3z46ihP8Yr9ZWjH3rverqmjpfT9ia bUuKowH4YKNJ6myk7uNtATW0esA42tvOkcX/AqXA+h//esF4XzGfiXp4SSCmeKLgVB+WQs iDufB2Dqe4CHdiC9Z2qm7R2WM86H48z6X7TA5pdumP+V72td0/aPpZolnUvPPg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvfCj2HxxzZLr for ; Tue, 07 Jul 2026 11:30:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 347e7 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 11:30:09 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Ariel Ehrenberg From: Konstantin Belousov Subject: git: 0e9bbbdcbea8 - main - mlx5: pass the full EQE to the DEVX event notifier 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0e9bbbdcbea8edc6ad259a9428234b494014bc4e Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 11:30:09 +0000 Message-Id: <6a4ce341.347e7.655c3179@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0e9bbbdcbea8edc6ad259a9428234b494014bc4e commit 0e9bbbdcbea8edc6ad259a9428234b494014bc4e Author: Ariel Ehrenberg AuthorDate: 2026-06-15 08:15:54 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 11:25:32 +0000 mlx5: pass the full EQE to the DEVX event notifier The DEVX event notifier and its helpers expect a full struct mlx5_eqe and read eqe->data from it, but mlx5_eq_int() passed &eqe->data, so the data offset was applied twice. Reviewed by: kib Tested by: Wafa Hamzah Sponsored by: Nvidia networking MFC after: 1 month --- sys/dev/mlx5/mlx5_core/mlx5_eq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_eq.c b/sys/dev/mlx5/mlx5_core/mlx5_eq.c index 5279d71e3e86..1458c0859610 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_eq.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_eq.c @@ -271,7 +271,7 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, struct mlx5_eq *eq) devx_cb = smp_load_acquire(&dev->priv.eq_table.cb); if (devx_cb != NULL) devx_consumed = - devx_cb(dev, eqe->type, &eqe->data); + devx_cb(dev, eqe->type, eqe); rcu_read_unlock(); } From nobody Tue Jul 7 13:23:42 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 4gvhkk54dXz6dcj5 for ; Tue, 07 Jul 2026 13:23:42 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvhkk2nkCz3d3l for ; Tue, 07 Jul 2026 13:23:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783430622; 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=+QYXo3bsBR3dz/4GbHndr726CJUweZ8sKp1qHUfaOl4=; b=rRiudUyF642B8l70DGBY1XxO2Jz/9u7rBpQzzDB/LS2SczwF0ydgEA9ZQDNjOrih3Y0eeH hIboaLzaQnlgYRSb7EM2q9rOcKaoqhLGAGPFkxuzqAZanluMvJNSER9t5l8y2w9rqbf3iw mdMt69qWE0rVHADPyqwA5TwTTHpcpOWV/WXyvdpwk/ohwRc6obmeRZT0LQbndJus/AES58 08D5+VflUtkR4dX5Sg+eH5loEWaRQQFtp93Ne4mwzumFILXknS3isVGBwHPUA5rMD7t49r JHqHADMOu5msgWSYS+3d0P+fUGFfRhTcCHLjHXP2KO8aAyNuVNxoQ17v8SkiIw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783430622; a=rsa-sha256; cv=none; b=TXYMkWKdXmmodCz4sUPf9mA90S4k8iAm1iorTkmz1oaRca+cv50w75aZw86a5EHCZTF8ii hUjE3kOr4GO4tS9GKomjDo7frppglYGl7dBkA+ZbnwLNBWx++w4mxZY3WwdoXaPkEtkVWS 1gfcs637uINxcxtdWCjZ90T6oZPY1B6nypyL8JqWrg3Jiz3jIo6RVPYpzN/XY3sfMt/T4n 908lorpY1x8XRCsT6lzO2Pgg/kTTxJ+J9z3sSeWxb2vWHuIpgu0CJ4JoZNCu+4USg20Cvy WAr6S2w4iYzEDz/zBDB4U2t9QgFkuZGOWY0uL5lzkki6q5KQucaeHjISJrCdcQ== 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=1783430622; 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=+QYXo3bsBR3dz/4GbHndr726CJUweZ8sKp1qHUfaOl4=; b=g9Tlqc89oVIfTzS+8kglVrw2YvMU9mSTlsZWg/SgEAvEZQp45LucUqIEUMMOOC42uo+G6w R/YOXED0OWGEYJlyJL+0drnjpuXDYNEg+f2K+hSinh6Q2o+LyANC0q2UGY+yijbPqT9HS9 MsQ3gxwqZo6QD6Zqw/Y+EwgA1ZBwdlKozxOUlzQuWd+vPiGOMAX6dxFq9aCI/k6VgFKwXP OGd1ozb9pBBmBZxnlIWiF1TnOhjWS3Y9TWg7cI+roC2oT7wcqiKf8yQosam4Xacy27Lefr 6QaLaSCQYB5sFA7NKknHDgAWPvAKGtI5zYA2uxASr0piyFI5lxyVQhzuOicyIA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvhkk1Kv5zd2s for ; Tue, 07 Jul 2026 13:23:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 4234f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 13:23:42 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Acesp25 From: Kristof Provost Subject: git: 3e3752ce73b7 - main - if_bridge: Remove unused disable parameter in bridge_stop 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3e3752ce73b75b8d1089eb09c8b63d4bdde46219 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 13:23:42 +0000 Message-Id: <6a4cfdde.4234f.2ca24905@gitrepo.freebsd.org> The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3e3752ce73b75b8d1089eb09c8b63d4bdde46219 commit 3e3752ce73b75b8d1089eb09c8b63d4bdde46219 Author: Acesp25 AuthorDate: 2026-06-21 01:34:50 +0000 Commit: Kristof Provost CommitDate: 2026-07-07 13:17:02 +0000 if_bridge: Remove unused disable parameter in bridge_stop The ```int disable``` parameter is included in the bridge_stop function signature but is not used in the function body. I had noticed this when tracing the driver's path while learning more about the ifnet library. This parameter originally appeared when importing the driver from NetBSD. However, the FreeBSD ifnet library no longer requires an if_stop function. Meaning that the function signature can be changed to only contain needed parameters for our bridge driver. Discussed with: freebsd-net@ mailing list Signed-off-by: Acesp25 Reviewed by: kp Pull-Request: https://github.com/freebsd/freebsd-src/pull/2290 --- sys/net/if_bridge.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index de991b8464c0..792b2c952e7a 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -327,7 +327,7 @@ static void bridge_init(void *); static void bridge_dummynet(struct mbuf *, struct ifnet *); static bool bridge_same(const void *, const void *); static void *bridge_get_softc(struct ifnet *); -static void bridge_stop(struct ifnet *, int); +static void bridge_stop(struct ifnet *); static int bridge_transmit(struct ifnet *, struct mbuf *); #ifdef ALTQ static void bridge_altq_start(if_t); @@ -937,7 +937,7 @@ bridge_clone_destroy(struct if_clone *ifc, struct ifnet *ifp, uint32_t flags) BRIDGE_LOCK(sc); - bridge_stop(ifp, 1); + bridge_stop(ifp); ifp->if_flags &= ~IFF_UP; while ((bif = CK_LIST_FIRST(&sc->sc_iflist)) != NULL) @@ -1068,9 +1068,9 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) (ifp->if_drv_flags & IFF_DRV_RUNNING)) { /* * If interface is marked down and it is running, - * then stop and disable it. + * then stop it. */ - bridge_stop(ifp, 1); + bridge_stop(ifp); } else if ((ifp->if_flags & IFF_UP) && !(ifp->if_drv_flags & IFF_DRV_RUNNING)) { /* @@ -2346,7 +2346,7 @@ bridge_init(void *xsc) * Stop the bridge interface. */ static void -bridge_stop(struct ifnet *ifp, int disable) +bridge_stop(struct ifnet *ifp) { struct bridge_softc *sc = ifp->if_softc; From nobody Tue Jul 7 14:16:10 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 4gvjvG3kF7z6jQ56 for ; Tue, 07 Jul 2026 14:16:10 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvjvG2wm9z3lN7 for ; Tue, 07 Jul 2026 14:16:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783433770; 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=gcNXsjpmRCn+bcsGY7MkAs8ZzQWuPPqIBv/ZmbaW4dI=; b=IF8c/3CRsBhVHq3SlCqajSPJ5bXQti2ZSsIh7zoe3ok4WgR2j9Dk8fF3Txuyc3CWvbnGVz glJGAyfkxS+X5hXxo05e4dFEG+B1C8qwJIuFWFQZqx8HDx/eeJIpRo4FagXbaWJP2JECYf 2GFbqnpaU/f9TCHU1Ii1vu6ZT9H6Mdbm/d6dlwaHEOuV8QXLkZ+XgC8399eDwlkE8mGOlG uZJyOToKNmw6xs5U+peQVHu6OSgvBgfk9rJL9/2ge3WBgj4YANuTZkqym6oMeCP5HqeO+T idZ18hDI/RODrcRPo5iLYptuNXNO8OqwnFpqFGa8MpauBHL7/Gm8y2rcgdSXfg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783433770; a=rsa-sha256; cv=none; b=bfQJVGKNUDdI2v3cZ72tlsVSrhd22gs2mVUAgFHUj2UZLny7BdXb0C7y5CRcvniNiYSunS eJC0qgzWnNao6naHCp5lLTzSw5903EwCOJo3jd60pzJDi0Lmrk1CEP0USqmr0Cwe+odozU W7Ya5YnKtkZDvRc1sGARxMJdUp8QiTtpd4UoKSjIVtabhcuWhbDCpv/xDwNnZbSGpgwdIo ai+mG6yTGrTgK2cJhNA9deQoJLoeD7K2lAmXiSB0HV+x0vxkVvM9aiUfiyjt+5hGzqK9o0 I7U9DsiTRGpT4Ka7Pn1Q+RjmXnihcaRKtYkRGEPK2GlETUdg3HqPXL/h3xbCzA== 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=1783433770; 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=gcNXsjpmRCn+bcsGY7MkAs8ZzQWuPPqIBv/ZmbaW4dI=; b=U3tIuvWyIopDAeDzPb2vqqmJlggWYaJmgQb7yb+FBsPAc61a/T4iaYF8ZR9B+ZSeB0wWB0 9RZEBbwtOKpHh46yMThosK2dMjrYE18970p7AagpkPi/rneFD3Pl3y6mS1XZXe6D21CZqV OQAaEltECtkyEoVb7etx6pvyOJ3zX644pJhkSOYpAd4llLgXTOS38GnccNqLAqudYk/pzn cD2xDyAMQG7gpCrlfxDeP8lF/FqtFJKVqdxHWDU5vtAAvpG3W3pFc+2fLddrTOwrfIJ0ED mFJ/GwnepVbG1ey8mA/Zl81aGPJKCrW7/m5hJtQdbA7ZuQ8opBv6fXj8d3VCbQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvjvG1Z97zfjW for ; Tue, 07 Jul 2026 14:16:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 4607d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 14:16:10 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 0083a4d6224f - main - tests/procdesc: Add some test cases for pdopenpid() 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: 0083a4d6224f1290af31528b55ba27c51e27ba46 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 14:16:10 +0000 Message-Id: <6a4d0a2a.4607d.435cde32@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0083a4d6224f1290af31528b55ba27c51e27ba46 commit 0083a4d6224f1290af31528b55ba27c51e27ba46 Author: Mark Johnston AuthorDate: 2026-07-07 14:14:39 +0000 Commit: Mark Johnston CommitDate: 2026-07-07 14:14:39 +0000 tests/procdesc: Add some test cases for pdopenpid() Reviewed by: kib MFC with: 5c32aa785184 ("kern: add pdopenpid(2)") Differential Revision: https://reviews.freebsd.org/D58023 --- tests/sys/kern/procdesc.c | 467 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 467 insertions(+) diff --git a/tests/sys/kern/procdesc.c b/tests/sys/kern/procdesc.c index 2fe50be45bf7..388104054b82 100644 --- a/tests/sys/kern/procdesc.c +++ b/tests/sys/kern/procdesc.c @@ -27,16 +27,21 @@ */ #include +#include +#include #include #include #include #include #include +#include #include #include #include +#include #include +#include #include #include @@ -205,11 +210,473 @@ ATF_TC_BODY(poll_exit_wakeup, tc) ATF_REQUIRE_MSG(close(pd) == 0, "close: %s", strerror(errno)); } +/* Tests for pdopenpid(2) */ + +/* + * Basic: open a process descriptor for a child, verify pdgetpid() returns the + * right pid. + */ +ATF_TC_WITHOUT_HEAD(pdopenpid_basic); +ATF_TC_BODY(pdopenpid_basic, tc) +{ + pid_t child, queried; + int fd; + + child = fork(); + ATF_REQUIRE_MSG(child >= 0, "fork: %s", strerror(errno)); + if (child == 0) { + for (;;) + pause(); + _exit(0); + } + + fd = pdopenpid(child, 0); + ATF_REQUIRE_MSG(fd >= 0, "pdopenpid: %s", strerror(errno)); + + ATF_REQUIRE_MSG(pdgetpid(fd, &queried) == 0, + "pdgetpid: %s", strerror(errno)); + ATF_REQUIRE_EQ(child, queried); + + ATF_REQUIRE_MSG(pdkill(fd, SIGKILL) == 0, + "pdkill: %s", strerror(errno)); + ATF_REQUIRE_EQ(child, waitpid(child, NULL, 0)); + ATF_REQUIRE(close(fd) == 0); +} + +/* + * pdopenpid with PD_CLOEXEC should set the close-on-exec flag. + */ +ATF_TC_WITHOUT_HEAD(pdopenpid_cloexec); +ATF_TC_BODY(pdopenpid_cloexec, tc) +{ + pid_t child; + int fd, flags; + + child = fork(); + ATF_REQUIRE_MSG(child >= 0, "fork: %s", strerror(errno)); + if (child == 0) { + for (;;) + pause(); + _exit(0); + } + + fd = pdopenpid(child, PD_CLOEXEC); + ATF_REQUIRE_MSG(fd >= 0, "pdopenpid: %s", strerror(errno)); + + flags = fcntl(fd, F_GETFD); + ATF_REQUIRE(flags >= 0); + ATF_REQUIRE(flags & FD_CLOEXEC); + + ATF_REQUIRE_MSG(pdkill(fd, SIGKILL) == 0, + "pdkill: %s", strerror(errno)); + ATF_REQUIRE_EQ(child, waitpid(child, NULL, 0)); + ATF_REQUIRE(close(fd) == 0); +} + +/* + * Invalid flags should return EINVAL. + */ +ATF_TC_WITHOUT_HEAD(pdopenpid_einval); +ATF_TC_BODY(pdopenpid_einval, tc) +{ + ATF_REQUIRE_ERRNO(EINVAL, pdopenpid(getpid(), 0xdeadbeef) < 0); + ATF_REQUIRE_ERRNO(EINVAL, pdopenpid(getpid(), ~PD_ALLOWED_AT_FORK) < 0); +} + +/* + * Validate handling of EMFILE. + */ +ATF_TC_WITHOUT_HEAD(pdopenpid_emfile); +ATF_TC_BODY(pdopenpid_emfile, tc) +{ + pid_t child; + struct rlimit rl; + int fd; + + child = fork(); + ATF_REQUIRE_MSG(child >= 0, "fork: %s", strerror(errno)); + if (child == 0) { + for (;;) + pause(); + _exit(0); + } + + /* + * Determine the lowest unused fd, then set the fd limit to that + * value so that no new fds can be allocated. + */ + fd = dup(STDIN_FILENO); + ATF_REQUIRE(fd >= 0); + ATF_REQUIRE(close(fd) == 0); + + ATF_REQUIRE_EQ(getrlimit(RLIMIT_NOFILE, &rl), 0); + rl.rlim_cur = fd; + ATF_REQUIRE_EQ(setrlimit(RLIMIT_NOFILE, &rl), 0); + + ATF_REQUIRE_ERRNO(EMFILE, pdopenpid(child, 0) < 0); + + /* + * The child should not have been killed or reparented as a side + * effect of the failed syscall. + */ + ATF_REQUIRE_MSG(kill(child, 0) == 0, + "child was killed: %s", strerror(errno)); + ATF_REQUIRE_MSG(waitpid(child, NULL, WNOHANG) == 0, + "child was reparented"); + + ATF_REQUIRE_MSG(kill(child, SIGKILL) == 0, + "kill: %s", strerror(errno)); + ATF_REQUIRE_EQ(child, waitpid(child, NULL, 0)); +} + +/* + * Opening a nonexistent pid should return ESRCH. + */ +ATF_TC_WITHOUT_HEAD(pdopenpid_esrch); +ATF_TC_BODY(pdopenpid_esrch, tc) +{ + ATF_REQUIRE_ERRNO(ESRCH, pdopenpid(123456789, 0) < 0); +} + +/* + * pdopenpid should fail in capability mode. + */ +ATF_TC_WITHOUT_HEAD(pdopenpid_capmode); +ATF_TC_BODY(pdopenpid_capmode, tc) +{ + pid_t child, parent; + + parent = getpid(); + child = fork(); + ATF_REQUIRE_MSG(child >= 0, "fork: %s", strerror(errno)); + if (child == 0) { + while (getppid() == parent) + sleep(1); + _exit(0); + } + + ATF_REQUIRE_MSG(cap_enter() == 0, "cap_enter: %s", strerror(errno)); + ATF_REQUIRE_ERRNO(ECAPMODE, pdopenpid(child, 0) < 0); +} + +/* + * Open a process descriptor for a child that already has one from pdfork(). + * Both fds should refer to the same process. + */ +ATF_TC_WITHOUT_HEAD(pdopenpid_pdfork_then_open); +ATF_TC_BODY(pdopenpid_pdfork_then_open, tc) +{ + pid_t child, pid1, pid2; + int fd1, fd2; + + child = pdfork(&fd1, PD_DAEMON); + ATF_REQUIRE_MSG(child >= 0, "pdfork: %s", strerror(errno)); + if (child == 0) { + for (;;) + pause(); + _exit(0); + } + + fd2 = pdopenpid(child, 0); + ATF_REQUIRE_MSG(fd2 >= 0, "pdopenpid: %s", strerror(errno)); + + ATF_REQUIRE(pdgetpid(fd1, &pid1) == 0); + ATF_REQUIRE(pdgetpid(fd2, &pid2) == 0); + ATF_REQUIRE_EQ(pid1, pid2); + ATF_REQUIRE_EQ(child, pid1); + + /* Kill via the second fd, wait via the first. */ + ATF_REQUIRE_MSG(pdkill(fd2, SIGKILL) == 0, + "pdkill: %s", strerror(errno)); + ATF_REQUIRE_MSG(pdwait(fd1, NULL, WEXITED, NULL, NULL) == 0, + "pdwait: %s", strerror(errno)); + + ATF_REQUIRE(close(fd1) == 0); + ATF_REQUIRE(close(fd2) == 0); +} + +/* + * Open a process descriptor for a child created with fork(), which has no + * pre-existing procdesc. Then use pdkill() and pdwait() on it. + */ +ATF_TC_WITHOUT_HEAD(pdopenpid_fork_then_open); +ATF_TC_BODY(pdopenpid_fork_then_open, tc) +{ + pid_t child; + int fd, status; + + child = fork(); + ATF_REQUIRE_MSG(child >= 0, "fork: %s", strerror(errno)); + if (child == 0) { + for (;;) + pause(); + _exit(0); + } + + fd = pdopenpid(child, 0); + ATF_REQUIRE_MSG(fd >= 0, "pdopenpid: %s", strerror(errno)); + + ATF_REQUIRE_MSG(pdkill(fd, SIGKILL) == 0, + "pdkill: %s", strerror(errno)); + ATF_REQUIRE_MSG(pdwait(fd, &status, WEXITED, NULL, NULL) == 0, + "pdwait: %s", strerror(errno)); + ATF_REQUIRE(WIFSIGNALED(status)); + ATF_REQUIRE_EQ(WTERMSIG(status), SIGKILL); + + ATF_REQUIRE(close(fd) == 0); +} + +/* + * Closing one fd should not kill the process when another fd still references + * the same procdesc. + */ +ATF_TC_WITHOUT_HEAD(pdopenpid_close_one_of_two); +ATF_TC_BODY(pdopenpid_close_one_of_two, tc) +{ + pid_t child, queried; + int fd1, fd2, status; + + child = pdfork(&fd1, PD_DAEMON); + ATF_REQUIRE_MSG(child >= 0, "pdfork: %s", strerror(errno)); + if (child == 0) { + for (;;) + pause(); + _exit(0); + } + + fd2 = pdopenpid(child, 0); + ATF_REQUIRE_MSG(fd2 >= 0, "pdopenpid: %s", strerror(errno)); + + /* Close the first fd; the process should remain alive. */ + ATF_REQUIRE(close(fd1) == 0); + + /* + * Verify the process is still reachable via the second fd and still + * alive. + */ + ATF_REQUIRE_EQ(0, pdgetpid(fd2, &queried)); + ATF_REQUIRE_EQ(child, queried); + ATF_REQUIRE_MSG(pdkill(fd2, 0) == 0, + "pdkill(0) after closing first fd: %s", strerror(errno)); + + /* Now kill and reap via the second fd. */ + ATF_REQUIRE_MSG(pdkill(fd2, SIGKILL) == 0, + "pdkill: %s", strerror(errno)); + ATF_REQUIRE_MSG(pdwait(fd2, &status, WEXITED, NULL, NULL) == 0, + "pdwait: %s", strerror(errno)); + ATF_REQUIRE(WIFSIGNALED(status)); + ATF_REQUIRE_EQ(WTERMSIG(status), SIGKILL); + + ATF_REQUIRE(close(fd2) == 0); +} + +/* + * Two calls to pdopenpid for the same process (no pdfork) should both work. + */ +ATF_TC_WITHOUT_HEAD(pdopenpid_open_twice); +ATF_TC_BODY(pdopenpid_open_twice, tc) +{ + pid_t child, pid1, pid2; + int fd1, fd2; + + child = fork(); + ATF_REQUIRE_MSG(child >= 0, "fork: %s", strerror(errno)); + if (child == 0) { + for (;;) + pause(); + _exit(0); + } + + fd1 = pdopenpid(child, 0); + ATF_REQUIRE_MSG(fd1 >= 0, "pdopenpid(1): %s", strerror(errno)); + + fd2 = pdopenpid(child, 0); + ATF_REQUIRE_MSG(fd2 >= 0, "pdopenpid(2): %s", strerror(errno)); + + ATF_REQUIRE_EQ(0, pdgetpid(fd1, &pid1)); + ATF_REQUIRE_EQ(0, pdgetpid(fd2, &pid2)); + ATF_REQUIRE_EQ(pid1, pid2); + + /* Close the first, process should survive. */ + ATF_REQUIRE(close(fd1) == 0); + ATF_REQUIRE_MSG(pdkill(fd2, 0) == 0, + "pdkill(0) after closing first fd: %s", strerror(errno)); + + ATF_REQUIRE_MSG(pdkill(fd2, SIGKILL) == 0, + "pdkill: %s", strerror(errno)); + ATF_REQUIRE_MSG(pdwait(fd2, NULL, WEXITED, NULL, NULL) == 0, + "pdwait: %s", strerror(errno)); + ATF_REQUIRE(close(fd2) == 0); +} + +/* + * When a process with two procdesc fds exits, only one pdwait should succeed + * in collecting the exit status. The other should get ESRCH. + */ +ATF_TC_WITHOUT_HEAD(pdopenpid_pdwait_only_one); +ATF_TC_BODY(pdopenpid_pdwait_only_one, tc) +{ + pid_t child; + int fd1, fd2, status; + + child = pdfork(&fd1, PD_DAEMON); + ATF_REQUIRE_MSG(child >= 0, "pdfork: %s", strerror(errno)); + if (child == 0) + _exit(42); + + fd2 = pdopenpid(child, 0); + ATF_REQUIRE_MSG(fd2 >= 0, "pdopenpid: %s", strerror(errno)); + + /* Collect via the first fd. */ + ATF_REQUIRE_MSG(pdwait(fd1, &status, WEXITED, NULL, NULL) == 0, + "pdwait(fd1): %s", strerror(errno)); + ATF_REQUIRE(WIFEXITED(status) && WEXITSTATUS(status) == 42); + + /* The second fd should no longer be able to collect. */ + ATF_REQUIRE_ERRNO(ESRCH, pdwait(fd2, &status, WEXITED, NULL, NULL) < 0); + + ATF_REQUIRE(close(fd1) == 0); + ATF_REQUIRE(close(fd2) == 0); +} + +/* + * Opening a process descriptor for ourselves should work. + */ +ATF_TC_WITHOUT_HEAD(pdopenpid_self); +ATF_TC_BODY(pdopenpid_self, tc) +{ + pid_t child, queried; + int childfd, fd, status; + + /* + * Closing self-referencing procdesc would steal the exit + * status from the parent. Keep one more procdesc for the + * child in the parent so that we can query the state. + * + * For the same reason we must use fork() and test in the + * child, otherwise kyua does not get the SIGCHILD nor the + * exit status. + */ + child = pdfork(&childfd, 0); + if (child == 0) { + fd = pdopenpid(getpid(), PD_DAEMON); + if (fd < 0) + _exit(21); + if (pdgetpid(fd, &queried) == -1) + _exit(22); + if (getpid() != queried) + _exit(23); + if (close(fd) != 0) + _exit(24); + _exit(0); + } + + ATF_REQUIRE(pdgetpid(childfd, &queried) == 0); + ATF_REQUIRE_EQ(queried, child); + ATF_REQUIRE(pdwait(childfd, &status, WEXITED, NULL, NULL) == 0); + + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE_EQ(WEXITSTATUS(status), 0); + ATF_REQUIRE(close(childfd) == 0); +} + +/* + * pdopenpid for a process that is exiting (P_WEXIT set) should fail with EBUSY. + */ +ATF_TC_WITHOUT_HEAD(pdopenpid_exiting); +ATF_TC_BODY(pdopenpid_exiting, tc) +{ + pid_t child; + int fd, pip[2], status; + + ATF_REQUIRE_EQ(pipe(pip), 0); + + child = fork(); + ATF_REQUIRE_MSG(child >= 0, "fork: %s", strerror(errno)); + if (child == 0) { + char c; + + close(pip[1]); + (void)read(pip[0], &c, 1); + _exit(0); + } + ATF_REQUIRE(close(pip[0]) == 0); + + /* Tell the child to exit. */ + ATF_REQUIRE(close(pip[1]) == 0); + + /* Might still race. */ + usleep(1000); + fd = pdopenpid(child, 0); + if (fd >= 0) { + ATF_REQUIRE(close(fd) == 0); + } else { + ATF_REQUIRE_MSG(errno == EBUSY, + "unexpected errno %d (%s)", errno, strerror(errno)); + } + + ATF_REQUIRE(waitpid(child, &status, 0) == child); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE_EQ(WEXITSTATUS(status), 0); +} + +/* + * Make sure that opening a process descriptor doesn't cause a wakeup in the + * target process. + */ +ATF_TC_WITHOUT_HEAD(pdopenpid_no_wakeup); +ATF_TC_BODY(pdopenpid_no_wakeup, tc) +{ + pid_t child; + int fd, pip[2]; + + ATF_REQUIRE(pipe(pip) == 0); + + child = fork(); + ATF_REQUIRE_MSG(child >= 0, "fork: %s", strerror(errno)); + if (child == 0) { + char buf[1]; + + close(pip[1]); + (void)read(pip[0], buf, 1); + _exit(0); + } + close(pip[0]); + + wait_for_naptime(child, "piperd"); + + fd = pdopenpid(child, 0); + ATF_REQUIRE_MSG(fd >= 0, "pdopenpid: %s", strerror(errno)); + + /* + * If pdopenpid() caused a wakeup, read() returned and the child exited. + */ + wait_for_naptime(child, "piperd"); + + ATF_REQUIRE(close(pip[1]) == 0); + ATF_REQUIRE(close(fd) == 0); +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, pid_recycle); ATF_TP_ADD_TC(tp, poll_close_race); ATF_TP_ADD_TC(tp, poll_exit_wakeup); + ATF_TP_ADD_TC(tp, pdopenpid_basic); + ATF_TP_ADD_TC(tp, pdopenpid_cloexec); + ATF_TP_ADD_TC(tp, pdopenpid_einval); + ATF_TP_ADD_TC(tp, pdopenpid_emfile); + ATF_TP_ADD_TC(tp, pdopenpid_esrch); + ATF_TP_ADD_TC(tp, pdopenpid_capmode); + ATF_TP_ADD_TC(tp, pdopenpid_pdfork_then_open); + ATF_TP_ADD_TC(tp, pdopenpid_fork_then_open); + ATF_TP_ADD_TC(tp, pdopenpid_close_one_of_two); + ATF_TP_ADD_TC(tp, pdopenpid_open_twice); + ATF_TP_ADD_TC(tp, pdopenpid_pdwait_only_one); + ATF_TP_ADD_TC(tp, pdopenpid_self); + ATF_TP_ADD_TC(tp, pdopenpid_exiting); + ATF_TP_ADD_TC(tp, pdopenpid_no_wakeup); + return (atf_no_error()); } From nobody Tue Jul 7 16:28:26 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 4gvmqt5RBZz6k62Q for ; Tue, 07 Jul 2026 16:28:26 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvmqt4x20z40s4 for ; Tue, 07 Jul 2026 16:28:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783441706; 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=qfn9FCn8CN9QHR4j/NfBWQpmoyZBbyZ6YldgGUDPono=; b=tnE/qXkORtuPKQhD7FA189ivD6lrKaMXhglxb/BCOAH5eNAtJYs5Hhf/NACGLTi4dAKamZ Y6FJfNNIk/I2zq/QBPMjBAtkBZLJN+iXuyYIH/zfLeZoMW70zRplw8UCTXX495OVACM7uG YsmqVI2COUmWscON4tnBi3IayENT6Yp8ggZ7mgcdY893A9gSOGnTdXyAfvQGiEJIYPhf6D NSjm1AVwAAhOR/iij8zzTlOD8yciFffy2gvFpVZhBczv5bPhAF+2aZs/ne7H2s26QBUb19 XYjFo/S44qLD3wqdSPQOd4rAF0gfycR1pNT0wQ40SEoTMBHkIhWgnJ/sidNd0w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783441706; a=rsa-sha256; cv=none; b=I15K7ITjJ155nUQm9w+tvsZ1NId5xQDtrG54QKUjdhnjMpWxScJEmtPpTQJpprv2taEsXZ jR52UTIHdDI+PEGwTvSmNqIjCtymGHuebPr3jzc6B/i6q1UGIp0YjFjUlhdk5tEhEEG4HQ Vfri4g69ART2gnKh8taNcqhmLuBOsIe9pGnSR1xnvEByEw3Pxif4ptr9JWsv7iX7Z2WX/u ZnqS+3+J8esjcdmjBfJCquO2pAdJ4jQS4zO4ZWEs4PKcsu9d6xjqwiKdfqWtC9qJOfqrgI ZBZDEtysGDHJNB8vipoAlRSpsjzYTMoqvMM5Ogi1hT6LB+n0jBuMq0Emv2VPbg== 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=1783441706; 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=qfn9FCn8CN9QHR4j/NfBWQpmoyZBbyZ6YldgGUDPono=; b=wHhmJh2e8iegI5fTkyUDfL+VCRQ8gwEcWu/R30JpItnATw/8UKlsgHpkoWW66eO/VpS8By iM75XrSSjMXw3ydbxqyBqGGWKPXCD1PvxsCIilJTznEb6ZIYpm4ZMjeIxRL2UFidgEY6ba YLi1fGjqJxh7jY6PnWGFAGNbWgskT/7gAUiTnVL1iRyz78sS+ByBNmyqy6XAqNKIvqDRql 60ERjcWKJta0GXLN2QzsQgbiXyYkP4hRul5s3v/Qswek8tmtJJdbUratdzRPMoOvJVJTib 3vVkRJris9R+DIwpi0Lb0gTTwpXB2EK2Ig9ofwbeslBtGwkscZfQKxNugLjTEw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvmqt3qqSzjnB for ; Tue, 07 Jul 2026 16:28:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 25a32 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 16:28:26 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 3fdb1b6f10b3 - main - netinet6: further refactor in6_pcbconnect() 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3fdb1b6f10b33f9ac62a80d75898a89c153445fc Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 16:28:26 +0000 Message-Id: <6a4d292a.25a32.400ad208@gitrepo.freebsd.org> The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=3fdb1b6f10b33f9ac62a80d75898a89c153445fc commit 3fdb1b6f10b33f9ac62a80d75898a89c153445fc Author: Gleb Smirnoff AuthorDate: 2026-07-07 16:27:57 +0000 Commit: Gleb Smirnoff CommitDate: 2026-07-07 16:27:57 +0000 netinet6: further refactor in6_pcbconnect() A mistake from 90ea8e89d9b7 is that in6_pcblookup_internal() was skipped for an inpcb that had unspecified local address. This is incorrect, as such inpcb could have already have a port set, and in_pcb_lport_dest() shall not be called on such inpcb. That could lead to creation of an alised connection in the database. This makes the function almost identical to in_pcbconnect(). While here, fix minor bug of missing INP_ANONPORT. This flag has no use in kernel, but affects netstat(1) output in certain mode. Fixes: 90ea8e89d9b751e8b5ae90ef3397883b035788e5 Reviewed by: pouria Differential Revision: https://reviews.freebsd.org/D57987 --- sys/netinet6/in6_pcb.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 971f05838ce2..1b55a3425e59 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -450,8 +450,9 @@ in6_pcbconnect(struct inpcb *inp, struct sockaddr_in6 *sin6, struct ucred *cred, bool sas_required) { struct inpcbinfo *pcbinfo = inp->inp_pcbinfo; - struct sockaddr_in6 laddr6; + struct sockaddr_in6 laddr6 = { .sin6_family = AF_INET6 }; int error; + bool anonport; NET_EPOCH_ASSERT(); INP_WLOCK_ASSERT(inp); @@ -462,8 +463,7 @@ in6_pcbconnect(struct inpcb *inp, struct sockaddr_in6 *sin6, struct ucred *cred, KASSERT(IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr), ("%s: inp is already connected", __func__)); - bzero(&laddr6, sizeof(laddr6)); - laddr6.sin6_family = AF_INET6; + anonport = (inp->inp_lport == 0); INP_HASH_WLOCK(pcbinfo); if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) { @@ -477,25 +477,27 @@ in6_pcbconnect(struct inpcb *inp, struct sockaddr_in6 *sin6, struct ucred *cred, INP_HASH_WUNLOCK(pcbinfo); return (error); } - if (inp->inp_lport == 0) { - error = in_pcb_lport_dest(inp, - (struct sockaddr *) &laddr6, &inp->inp_lport, - (struct sockaddr *) sin6, sin6->sin6_port, cred, - INPLOOKUP_WILDCARD); - if (__predict_false(error)) { - INP_HASH_WUNLOCK(pcbinfo); - return (error); - } + } else + laddr6.sin6_addr = inp->in6p_laddr; + + if (anonport) { + error = in_pcb_lport_dest(inp, (struct sockaddr *) &laddr6, + &inp->inp_lport, (struct sockaddr *) sin6, sin6->sin6_port, + cred, INPLOOKUP_WILDCARD); + if (__predict_false(error)) { + INP_HASH_WUNLOCK(pcbinfo); + return (error); } - inp->in6p_laddr = laddr6.sin6_addr; } else if (in6_pcblookup_internal(pcbinfo, &sin6->sin6_addr, - sin6->sin6_port, &inp->in6p_laddr, inp->inp_lport, 0, + sin6->sin6_port, &laddr6.sin6_addr, inp->inp_lport, 0, M_NODOM, RT_ALL_FIBS) != NULL) { INP_HASH_WUNLOCK(pcbinfo); return (EADDRINUSE); } + MPASS(inp->inp_lport != 0); - MPASS(!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)); + MPASS(!IN6_IS_ADDR_UNSPECIFIED(&laddr6.sin6_addr)); + inp->in6p_laddr = laddr6.sin6_addr; inp->in6p_faddr = sin6->sin6_addr; inp->inp_fport = sin6->sin6_port; /* update flowinfo - draft-itojun-ipv6-flowlabel-api-00 */ @@ -520,6 +522,8 @@ in6_pcbconnect(struct inpcb *inp, struct sockaddr_in6 *sin6, struct ucred *cred, inp->inp_flowid = hash_val; inp->inp_flowtype = hash_type; } + if (anonport) + inp->inp_flags |= INP_ANONPORT; return (0); } From nobody Tue Jul 7 16:29:15 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 4gvmrq1sLKz6k66n for ; Tue, 07 Jul 2026 16:29:15 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvmrq1LfRz419B for ; Tue, 07 Jul 2026 16:29:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783441755; 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=O505dgxPLinnL0BkdEJpSk6FVOx48NJ/izIkCH0xubc=; b=bEst3t7hqAMALbW3XjaopDeMemnzE7JLMysR8G8C6dhlECbCJfmDLDoZJZY3DhZ6vs0M7E FxjvEiMu8zIeF1E7p9Vsi7N8nC0s/LGBZMVO6lFtoEGaQ4BY6M4jivF9tIvFcu/f1LkSns ofTD/ifRjQp9HTeHRmw0Xx2IPCNI9CUUWZpyj04seG32vNM2YOz2gzqLSBjku0AHUmNYGb hBVOHKgVpVEREstTzXRst3CEaW+lmvR/BQh33q69bMhU9fV+bM6J0UMa3hGGs52Lgv/NQy NCM0kHzV01w6zBP9ARHmiHc4G0GpJtjtMDqmhsFzfMkvVB2fbhxVxUe4YKNeAQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783441755; a=rsa-sha256; cv=none; b=B5D+kiNQV5oYOAO/osHetDZ8NPEONpiaEXn+2LXedNrrobz7PyFjeXryB1zT69q+R02Ztj GSCYHJ7jCiCTyiil2Hg2BRyiUeu6CSU+PB09PvuGP79a6GJ7152DrhRNjFoHVnIpFH51ho lTAVpT0C8DD8JAFsu/SU+/Xq4sEo9DVxy5UVH0IOGybkXASWxA932+w0c1vN61xS/S73dH hTLitxvNWePCHlBjzi7Enzt6uLvQzTMvbsxocWHS5JtezWpg1hNf5DJpj50dAUgZuLmV8Q 41rf6QR8WRcn+eu6kdERfkkp/FdtnDe/lzBToFOU05J4jBEGmOGjX3XkMxjSeA== 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=1783441755; 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=O505dgxPLinnL0BkdEJpSk6FVOx48NJ/izIkCH0xubc=; b=dkmtF1lRxY3UEoFYp6/rfzpJ7R9BosqSIBjcsZmZtiYtydJ/IJ55FkarslExZtmoJccUiO HemIH4tn7pmkUKs7sAU81HBEogV+XN9WtkhM3CNVxtuYVeoeSOfhz3GqIVlzWyFWiMuvTy AM0F6cQ6mrRuE1bRkfqsltFzxpXJZRuCnAE1YzPWNEKAgYcK7BJhfPTiX34k5lEiKD/fWA f5pw9I13q+ka2eC+VMF7zRAQYBA1fa7oARYET7DnA3XG7CFc1fV5bNWKVO77FiuPFvcd3S x1faLnUjjzemRbt0uPA9wFlfizB2HBX/VDWjVeMnjviab8D2eUZToMbJ5lIBfw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvmrq045Nzjl7 for ; Tue, 07 Jul 2026 16:29:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2596e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 16:29:15 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 1ea204b91909 - main - inpcb: make net.inet.ip.portrange port number limiting sysctls unsigned 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1ea204b91909fe6c2060b1fa522b31bb5b8c7dd1 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 16:29:15 +0000 Message-Id: <6a4d295b.2596e.74d5a917@gitrepo.freebsd.org> The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=1ea204b91909fe6c2060b1fa522b31bb5b8c7dd1 commit 1ea204b91909fe6c2060b1fa522b31bb5b8c7dd1 Author: Gleb Smirnoff AuthorDate: 2026-07-07 16:28:48 +0000 Commit: Gleb Smirnoff CommitDate: 2026-07-07 16:28:48 +0000 inpcb: make net.inet.ip.portrange port number limiting sysctls unsigned And make net.inet.ip.portrange.randomized boolean. Reviewed by: pouria, tuexen, markj Differential Revision: https://reviews.freebsd.org/D57291 --- sys/netinet/in_pcb.c | 48 ++++++++++++++++++++++++------------------------ sys/netinet/in_pcb.h | 18 +++++++++--------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 84b175b42eec..7a9e327893ca 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -115,23 +115,23 @@ * These configure the range of local port addresses assigned to * "unspecified" outgoing connections/packets/whatever. */ -VNET_DEFINE(int, ipport_lowfirstauto) = IPPORT_RESERVED - 1; /* 1023 */ -VNET_DEFINE(int, ipport_lowlastauto) = IPPORT_RESERVEDSTART; /* 600 */ -VNET_DEFINE(int, ipport_firstauto) = IPPORT_EPHEMERALFIRST; /* 10000 */ -VNET_DEFINE(int, ipport_lastauto) = IPPORT_EPHEMERALLAST; /* 65535 */ -VNET_DEFINE(int, ipport_hifirstauto) = IPPORT_HIFIRSTAUTO; /* 49152 */ -VNET_DEFINE(int, ipport_hilastauto) = IPPORT_HILASTAUTO; /* 65535 */ +VNET_DEFINE(u_int, ipport_lowfirstauto) = IPPORT_RESERVED - 1; /* 1023 */ +VNET_DEFINE(u_int, ipport_lowlastauto) = IPPORT_RESERVEDSTART; /* 600 */ +VNET_DEFINE(u_int, ipport_firstauto) = IPPORT_EPHEMERALFIRST; /* 10000 */ +VNET_DEFINE(u_int, ipport_lastauto) = IPPORT_EPHEMERALLAST; /* 65535 */ +VNET_DEFINE(u_int, ipport_hifirstauto) = IPPORT_HIFIRSTAUTO; /* 49152 */ +VNET_DEFINE(u_int, ipport_hilastauto) = IPPORT_HILASTAUTO; /* 65535 */ /* * Reserved ports accessible only to root. There are significant * security considerations that must be accounted for when changing these, * but the security benefits can be great. Please be careful. */ -VNET_DEFINE(int, ipport_reservedhigh) = IPPORT_RESERVED - 1; /* 1023 */ -VNET_DEFINE(int, ipport_reservedlow); +VNET_DEFINE(u_int, ipport_reservedhigh) = IPPORT_RESERVED - 1; /* 1023 */ +VNET_DEFINE(u_int, ipport_reservedlow); /* Enable random ephemeral port allocation by default. */ -VNET_DEFINE(int, ipport_randomized) = 1; +VNET_DEFINE(bool, ipport_randomized) = true; #ifdef INET static struct inpcb *in_pcblookup_internal(struct inpcbinfo *pcbinfo, @@ -166,35 +166,35 @@ static SYSCTL_NODE(_net_inet_ip, IPPROTO_IP, portrange, "IP Ports"); SYSCTL_PROC(_net_inet_ip_portrange, OID_AUTO, lowfirst, - CTLFLAG_VNET | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - &VNET_NAME(ipport_lowfirstauto), 0, &sysctl_net_ipport_check, "I", + CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, + &VNET_NAME(ipport_lowfirstauto), 0, &sysctl_net_ipport_check, "IU", ""); SYSCTL_PROC(_net_inet_ip_portrange, OID_AUTO, lowlast, - CTLFLAG_VNET | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - &VNET_NAME(ipport_lowlastauto), 0, &sysctl_net_ipport_check, "I", + CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, + &VNET_NAME(ipport_lowlastauto), 0, &sysctl_net_ipport_check, "IU", ""); SYSCTL_PROC(_net_inet_ip_portrange, OID_AUTO, first, - CTLFLAG_VNET | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - &VNET_NAME(ipport_firstauto), 0, &sysctl_net_ipport_check, "I", + CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, + &VNET_NAME(ipport_firstauto), 0, &sysctl_net_ipport_check, "IU", ""); SYSCTL_PROC(_net_inet_ip_portrange, OID_AUTO, last, - CTLFLAG_VNET | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - &VNET_NAME(ipport_lastauto), 0, &sysctl_net_ipport_check, "I", + CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, + &VNET_NAME(ipport_lastauto), 0, &sysctl_net_ipport_check, "IU", ""); SYSCTL_PROC(_net_inet_ip_portrange, OID_AUTO, hifirst, - CTLFLAG_VNET | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - &VNET_NAME(ipport_hifirstauto), 0, &sysctl_net_ipport_check, "I", + CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, + &VNET_NAME(ipport_hifirstauto), 0, &sysctl_net_ipport_check, "IU", ""); SYSCTL_PROC(_net_inet_ip_portrange, OID_AUTO, hilast, - CTLFLAG_VNET | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, - &VNET_NAME(ipport_hilastauto), 0, &sysctl_net_ipport_check, "I", + CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, + &VNET_NAME(ipport_hilastauto), 0, &sysctl_net_ipport_check, "IU", ""); -SYSCTL_INT(_net_inet_ip_portrange, OID_AUTO, reservedhigh, +SYSCTL_UINT(_net_inet_ip_portrange, OID_AUTO, reservedhigh, CTLFLAG_VNET | CTLFLAG_RW | CTLFLAG_SECURE, &VNET_NAME(ipport_reservedhigh), 0, ""); -SYSCTL_INT(_net_inet_ip_portrange, OID_AUTO, reservedlow, +SYSCTL_UINT(_net_inet_ip_portrange, OID_AUTO, reservedlow, CTLFLAG_RW|CTLFLAG_SECURE, &VNET_NAME(ipport_reservedlow), 0, ""); -SYSCTL_INT(_net_inet_ip_portrange, OID_AUTO, randomized, +SYSCTL_BOOL(_net_inet_ip_portrange, OID_AUTO, randomized, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ipport_randomized), 0, "Enable random port allocation"); diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index ea93780730de..933a4c42808e 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -624,15 +624,15 @@ typedef enum { #define INP_CHECK_SOCKAF(so, af) (INP_SOCKAF(so) == af) -VNET_DECLARE(int, ipport_reservedhigh); -VNET_DECLARE(int, ipport_reservedlow); -VNET_DECLARE(int, ipport_lowfirstauto); -VNET_DECLARE(int, ipport_lowlastauto); -VNET_DECLARE(int, ipport_firstauto); -VNET_DECLARE(int, ipport_lastauto); -VNET_DECLARE(int, ipport_hifirstauto); -VNET_DECLARE(int, ipport_hilastauto); -VNET_DECLARE(int, ipport_randomized); +VNET_DECLARE(u_int, ipport_reservedhigh); +VNET_DECLARE(u_int, ipport_reservedlow); +VNET_DECLARE(u_int, ipport_lowfirstauto); +VNET_DECLARE(u_int, ipport_lowlastauto); +VNET_DECLARE(u_int, ipport_firstauto); +VNET_DECLARE(u_int, ipport_lastauto); +VNET_DECLARE(u_int, ipport_hifirstauto); +VNET_DECLARE(u_int, ipport_hilastauto); +VNET_DECLARE(bool, ipport_randomized); #define V_ipport_reservedhigh VNET(ipport_reservedhigh) #define V_ipport_reservedlow VNET(ipport_reservedlow) From nobody Tue Jul 7 16:35:17 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 4gvmzn2C0hz6k68T for ; Tue, 07 Jul 2026 16:35:17 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvmzn1bKKz424w for ; Tue, 07 Jul 2026 16:35:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783442117; 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=RKfZIAlZi5qtJd3XTmsBJeF9FjxW5EyWxnuW6jqF5HI=; b=ECnixNPznvIndhaWh2IbUl1dYzGinBr8Gyevg2SGp78TUHLwH21LuYbZtK/NihwaBlK9Gi DDGGD5oYX2G/G4IeMnavGnRwnmQgRVV+UwvjmKt4t1iiFW4GwnYl1TCT7burkw/47/e5FA jtHJDxZxebKPUQyv3aL1Yh091ch2N4DojH2DXRjYlUpDQxoT5hckveEbVuy7vfpV4UG17A rmJkIZn/3O0LZzKw9tbMLRd6VjFdJ+aywiDXG6TZ71inOihoY0UqhiUSGKK9EMV6qqNl2K ri6bDc9yDvZs9j50Um55Rz/Kv2CpQPrD1L7W3/S0UrOCJizbWeBQfDCiYRrjkA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783442117; a=rsa-sha256; cv=none; b=RNY8nubxs4750XoZCwxzR09i5jhDpiR/EJ/gl3IF7msK6w/GEZgytQnl6x1XpjWOwptpAs UiO1kjTni3b4OcofVbXLFX9EUzYChLn6dMjmKuZfhNY/ZE54zGVL7uNhMzSDMACmMTSsRc QXRs9BHoU+Sf0OGGeFcoh38sZSSOBres6PiFbq0aY5eov4nU/kksDzpGOH8NXbhwpu8Z59 YDUEXKif7eeY7kZ0NBU0fzCRunmgL6EjRIfAbsDVq/Rxoo5fxn1zXcrvPGYSdc3BAdQ2rQ OQT8koBoysr8fSjQLBrc3uiWnxCcKjG7CxCt0sm4FTYl308DJGfDfPg5f3wJWQ== 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=1783442117; 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=RKfZIAlZi5qtJd3XTmsBJeF9FjxW5EyWxnuW6jqF5HI=; b=V4IKKVNItfzVrb06SQ6JEy5jeXxrMXYYaEuiiMpBSMZLM+oCXAJ0mW8iBtD53vF62F9nNY 7zdwYnhSmCcGfWyTDB32v78Pizs6B7UgXj/ANP5p2icWAYUQ4IA6dm8Iwc3anEmdiB3t09 U+Iw3w+tqoyhfgsVw1i54TWbgUCtiBB+oCUx1h0EEQlAE49QtRkxOh9+xh9djyNc2bMXNe MLHyZQN6Kcc+mFeDJzOSdX165PAFgtxz4ETllpGAj0p0/LSb2cnK1l57bRfgkFsfZC5hzm U3gO0F41pEnJbhrTfW73flMcF4wcElRU1AGT0U+hEvacy5wcVD9y1viewPE3Sg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvmzn0Kpmzk2p for ; Tue, 07 Jul 2026 16:35:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27180 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 16:35:17 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: e1f4a8cb8656 - main - x86/local_apic.c: Thermal interrupt support: Additional style fixes 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e1f4a8cb8656e64a1fe2b1ab519821b14c4985a0 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 16:35:17 +0000 Message-Id: <6a4d2ac5.27180.7af668d7@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=e1f4a8cb8656e64a1fe2b1ab519821b14c4985a0 commit e1f4a8cb8656e64a1fe2b1ab519821b14c4985a0 Author: Olivier Certner AuthorDate: 2026-07-02 13:05:09 +0000 Commit: Olivier Certner CommitDate: 2026-07-07 16:34:07 +0000 x86/local_apic.c: Thermal interrupt support: Additional style fixes Rename handler function type 'lapic_thermal_handle_function' to the shorter 'lapic_thermal_handler_t'. Move it closer to the function declaration block where it is used. Make it a true function type (no pointer) and add explicit pointer marks on usage. Rename 'lapic_thermal_function_value' to the more immediately clear 'lapic_thermal_function_arg'. In lapic_thermal_enable(), use 'func_arg' as the argument name for the handler argument, which at least refers to function 'func', rather than the generic 'value'. Finally, rename the global handler variable from 'lapic_thermal_function_ptr' to the shorter 'lapic_thermal_function' (dynamic functions can be referenced only through a pointer). MFC with: 87ba088fa310 ("x86/local_apic.c: Add support for installing a thermal interrupt handler") Sponsored by: The FreeBSD Foundation --- sys/x86/include/apicvar.h | 6 ++++-- sys/x86/x86/local_apic.c | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/sys/x86/include/apicvar.h b/sys/x86/include/apicvar.h index 66d53bbf7e5d..54ea5bc655e5 100644 --- a/sys/x86/include/apicvar.h +++ b/sys/x86/include/apicvar.h @@ -199,7 +199,6 @@ extern int *apic_cpuids; extern void (*ipi_vectored)(u_int, int); typedef struct ioapic *ioapic_drv_t; -typedef void (*lapic_thermal_handle_function)(int, void *); void apic_register_enumerator(struct apic_enumerator *enumerator); ioapic_drv_t ioapic_create(vm_paddr_t addr, int32_t apic_id, int intbase); @@ -215,6 +214,9 @@ int ioapic_set_triggermode(ioapic_drv_t cookie, u_int pin, enum intr_trigger trigger); int ioapic_set_smi(ioapic_drv_t cookie, u_int pin); +/* First argument: 'cpuid' from 'struct pcpu', second: Opaque cookie. */ +typedef void lapic_thermal_handler_t(int, void *); + void lapic_create(u_int apic_id, int boot_cpu); void lapic_init(vm_paddr_t addr); void lapic_xapic_mode(void); @@ -234,7 +236,7 @@ void apic_enable_vector(u_int apic_id, u_int vector); void apic_disable_vector(u_int apic_id, u_int vector); void apic_free_vector(u_int apic_id, u_int vector, u_int irq); void lapic_calibrate_timer(void); -void lapic_enable_thermal(lapic_thermal_handle_function thermfunc, void *value); +void lapic_enable_thermal(lapic_thermal_handler_t *func, void *func_arg); void lapic_disable_thermal(void); int lapic_enable_pcint(void); void lapic_disable_pcint(void); diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c index 08748a1fe7c2..9e1c1d70aea7 100644 --- a/sys/x86/x86/local_apic.c +++ b/sys/x86/x86/local_apic.c @@ -314,8 +314,8 @@ static uint64_t lapic_ipi_wait_mult; static int __read_mostly lapic_ds_idle_timeout = 1000000; #endif unsigned int max_apic_id; -static void *lapic_thermal_function_value; -static lapic_thermal_handle_function lapic_thermal_function_ptr; +static lapic_thermal_handler_t *lapic_thermal_function; +static void *lapic_thermal_function_arg; static int pcint_refcnt = 0; SYSCTL_NODE(_hw, OID_AUTO, apic, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, @@ -1642,13 +1642,13 @@ lapic_enable_mca_elvt(void) void lapic_handle_thermal(void) { - lapic_thermal_handle_function func; + lapic_thermal_handler_t *func; - func = (lapic_thermal_handle_function)atomic_load_acq_ptr( - (void *)&lapic_thermal_function_ptr); + func = (lapic_thermal_handler_t *)atomic_load_acq_ptr( + (uintptr_t *)&lapic_thermal_function); if (func != NULL) - func(PCPU_GET(cpuid), lapic_thermal_function_value); + func(PCPU_GET(cpuid), lapic_thermal_function_arg); lapic_eoi(); } @@ -1664,7 +1664,7 @@ lapic_update_thermal(void *dummy __unused) } void -lapic_enable_thermal(lapic_thermal_handle_function thermfunc, void *value) +lapic_enable_thermal(lapic_thermal_handler_t *func, void *func_arg) { #ifdef DEV_ATPIC /* Fail if the local APIC is not present. */ @@ -1672,9 +1672,9 @@ lapic_enable_thermal(lapic_thermal_handle_function thermfunc, void *value) return; #endif - lapic_thermal_function_value = value; - atomic_store_rel_ptr((uintptr_t *)&lapic_thermal_function_ptr, - (uintptr_t)thermfunc); + lapic_thermal_function_arg = func_arg; + atomic_store_rel_ptr((uintptr_t *)&lapic_thermal_function, + (uintptr_t)func); lvts[APIC_LVT_THERMAL].lvt_masked = 0; @@ -1698,7 +1698,7 @@ lapic_disable_thermal(void) #endif smp_rendezvous(NULL, lapic_update_thermal, NULL, NULL); - atomic_store_rel_ptr((uintptr_t *)&lapic_thermal_function_ptr, + atomic_store_rel_ptr((uintptr_t *)&lapic_thermal_function, (uintptr_t)NULL); } From nobody Tue Jul 7 16:35:15 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 4gvmzs1zp9z6k6Bg for ; Tue, 07 Jul 2026 16:35:21 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvmzs1J9bz42Vj for ; Tue, 07 Jul 2026 16:35:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783442121; 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=c4UXwfrlpT9kaaNlgPbHO+J8uH2IofmC/jPj6no0MpU=; b=MN9+0ocHX0DILcCKIlWMDv+HitplxPXSVfVOnWjJRcnlogPQr98Pm/wcn93DKmNH0tn0x7 dE7levf6XBWmH1DkfOehhkV7noT6r57iZVKikxR8Q/q06ZY53zG3kl6+FmprrO5VD2V5Xd 4oowr9n5TflovBQ8/yC24pKw9fX/wnLcH21kTjP4gyBx6yGJupf6CgqBZ3Yut8mqUPr82p T6x9oekmGUMQVYyPNuTH3dCf3Q8vgK06C6BDUapNMDM9B1JjdEpjSzSpp3nG3Q2F1LpTQL O1nhcZaV1wXHADY9nFcHMkKjYwcs/g89jFGzpnmd9uugCLcEl003gocapDaoRA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783442121; a=rsa-sha256; cv=none; b=aVCU1jRodSakFQ3y4RSfYZ6dqUBCXWSiGu02ZVykEVxnr2jBZwZU08fy3HNvC182dgYkT6 a6IOaWt919axdWAyO55849c1dOJW60GNm2Ingtm7qzXPm1Eowv+/ugae+3EbDM8efrCsUw 9hwfJiXh6PtiKJQ8wnGFQYPAZ5GsXMI3cIcmrWzP4bzolhTHvDv9iuG8RF9idu52g6V4Yc tPH59ujZxhRR0f1X5qi0G9/uuT6WrQBUJN1XvtDfqOzffjZLA+WJtyR+OcPAgMwIW/zpUn qUeVxPsX7OIu1M5Bqf9i5qiYtVp3csEFb5kVUH486buKdIX7jnBtrGkIciXhOg== 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=1783442121; 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=c4UXwfrlpT9kaaNlgPbHO+J8uH2IofmC/jPj6no0MpU=; b=uoHylXJJpS70JRYSOImbOfdysXPSsuN1gog7MhZ4tLx/mwFojOmqxLVNDjDhA7FI8kH6j4 QaIPxYUqQSpOvP0rNfCTdkpMDlyIoBNRKCCeo3urAj4ncm2k+InL5w3aGfLn+fHfl73hMZ 9b+yR39Yh/Tn5hTfMwXdQl06fGJ5aFKB2uW9neA5qKVMXPRi8PSDopXeCm4ETY7HDUcz9c IMEKNvNb73EtsDoCuK6eccypG+W+NyPHUb8l0K0amnEwRCrxyND6X82e/RKYqqiqBjHhgd 5VUWt1zArUCByHCNgXmapw0rIWvmDQlWL0iMXPy1lSMPERWwoVl0CSbFnkBKPQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvmzr6bkbzjjn for ; Tue, 07 Jul 2026 16:35:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2668f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 16:35:15 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Koine Yuusuke From: Olivier Certner Subject: git: 87ba088fa310 - main - x86/local_apic.c: Add support for installing a thermal interrupt handler 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 87ba088fa3108dd180008a04f25760ec71476c87 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 16:35:15 +0000 Message-Id: <6a4d2ac3.2668f.48cbd856@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=87ba088fa3108dd180008a04f25760ec71476c87 commit 87ba088fa3108dd180008a04f25760ec71476c87 Author: Koine Yuusuke AuthorDate: 2026-07-01 15:28:21 +0000 Commit: Olivier Certner CommitDate: 2026-07-07 16:33:31 +0000 x86/local_apic.c: Add support for installing a thermal interrupt handler The thermal interrupt is initially masked. Thermal interrupt handling is enabled by calling lapic_enable_thermal(), which installs a (single) handler. [olce: Wrote the commit message.] Reviewed by: kib, olce MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D44454 --- sys/amd64/amd64/apic_vector.S | 9 ++++++ sys/x86/include/apicvar.h | 12 ++++--- sys/x86/x86/local_apic.c | 74 +++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 89 insertions(+), 6 deletions(-) diff --git a/sys/amd64/amd64/apic_vector.S b/sys/amd64/amd64/apic_vector.S index c753ddbad9be..85136b2f17df 100644 --- a/sys/amd64/amd64/apic_vector.S +++ b/sys/amd64/amd64/apic_vector.S @@ -144,6 +144,15 @@ IDTVEC(spuriousint) KMSAN_LEAVE jmp doreti +/* + * Local APIC thermal interrupt handler. + */ + INTR_HANDLER thermalint + KMSAN_ENTER + call lapic_handle_thermal + KMSAN_LEAVE + jmp doreti + #ifdef XENHVM /* * Xen event channel upcall interrupt handler. diff --git a/sys/x86/include/apicvar.h b/sys/x86/include/apicvar.h index 2dda3103f93c..66d53bbf7e5d 100644 --- a/sys/x86/include/apicvar.h +++ b/sys/x86/include/apicvar.h @@ -185,12 +185,12 @@ struct apic_enumerator { inthand_t IDTVEC(apic_isr1), IDTVEC(apic_isr2), IDTVEC(apic_isr3), IDTVEC(apic_isr4), IDTVEC(apic_isr5), IDTVEC(apic_isr6), - IDTVEC(apic_isr7), IDTVEC(cmcint), IDTVEC(errorint), - IDTVEC(spuriousint), IDTVEC(timerint), + IDTVEC(apic_isr7), IDTVEC(cmcint), IDTVEC(thermalint), + IDTVEC(errorint), IDTVEC(spuriousint), IDTVEC(timerint), IDTVEC(apic_isr1_pti), IDTVEC(apic_isr2_pti), IDTVEC(apic_isr3_pti), IDTVEC(apic_isr4_pti), IDTVEC(apic_isr5_pti), IDTVEC(apic_isr6_pti), - IDTVEC(apic_isr7_pti), IDTVEC(cmcint_pti), IDTVEC(errorint_pti), - IDTVEC(spuriousint_pti), IDTVEC(timerint_pti); + IDTVEC(apic_isr7_pti), IDTVEC(cmcint_pti), IDTVEC(thermalint_pti), + IDTVEC(errorint_pti), IDTVEC(spuriousint_pti), IDTVEC(timerint_pti); extern vm_paddr_t lapic_paddr; extern int *apic_cpuids; @@ -199,6 +199,7 @@ extern int *apic_cpuids; extern void (*ipi_vectored)(u_int, int); typedef struct ioapic *ioapic_drv_t; +typedef void (*lapic_thermal_handle_function)(int, void *); void apic_register_enumerator(struct apic_enumerator *enumerator); ioapic_drv_t ioapic_create(vm_paddr_t addr, int32_t apic_id, int intbase); @@ -233,6 +234,8 @@ void apic_enable_vector(u_int apic_id, u_int vector); void apic_disable_vector(u_int apic_id, u_int vector); void apic_free_vector(u_int apic_id, u_int vector, u_int irq); void lapic_calibrate_timer(void); +void lapic_enable_thermal(lapic_thermal_handle_function thermfunc, void *value); +void lapic_disable_thermal(void); int lapic_enable_pcint(void); void lapic_disable_pcint(void); void lapic_reenable_pcint(void); @@ -257,6 +260,7 @@ int lapic_set_lvt_polarity(u_int apic_id, u_int lvt, int lapic_set_lvt_triggermode(u_int apic_id, u_int lvt, enum intr_trigger trigger); void lapic_handle_cmc(void); +void lapic_handle_thermal(void); void lapic_handle_error(void); void lapic_handle_intr(int vector, struct trapframe *frame); void lapic_handle_timer(struct trapframe *frame); diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c index cd5e4d474080..08748a1fe7c2 100644 --- a/sys/x86/x86/local_apic.c +++ b/sys/x86/x86/local_apic.c @@ -60,6 +60,7 @@ #include #include +#include #include #include #include @@ -313,6 +314,8 @@ static uint64_t lapic_ipi_wait_mult; static int __read_mostly lapic_ds_idle_timeout = 1000000; #endif unsigned int max_apic_id; +static void *lapic_thermal_function_value; +static lapic_thermal_handle_function lapic_thermal_function_ptr; static int pcint_refcnt = 0; SYSCTL_NODE(_hw, OID_AUTO, apic, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, @@ -596,7 +599,9 @@ lapic_init(vm_paddr_t addr) setidt(APIC_ERROR_INT, pti ? IDTVEC(errorint_pti) : IDTVEC(errorint), SDT_APIC, SEL_KPL, GSEL_APIC); - /* XXX: Thermal interrupt */ + /* Thermal interrupt */ + setidt(APIC_THERMAL_INT, pti ? IDTVEC(thermalint_pti) : IDTVEC(thermalint), + SDT_APIC, SEL_KPL, GSEL_APIC); /* Local APIC CMCI. */ setidt(APIC_CMC_INT, pti ? IDTVEC(cmcint_pti) : IDTVEC(cmcint), @@ -923,7 +928,9 @@ lapic_setup(int boot) lapic_read32(LAPIC_LVT_ERROR))); lapic_write32(LAPIC_ESR, 0); - /* XXX: Thermal LVT */ + /* Thermal LVT */ + lapic_write32(LAPIC_LVT_THERMAL, lvt_mode(la, APIC_LVT_THERMAL, + lapic_read32(LAPIC_LVT_THERMAL))); /* Program the CMCI LVT entry if present. */ if (maxlvt >= APIC_LVT_CMCI) { @@ -1632,6 +1639,69 @@ lapic_enable_mca_elvt(void) return (APIC_ELVT_MCA); } +void +lapic_handle_thermal(void) +{ + lapic_thermal_handle_function func; + + func = (lapic_thermal_handle_function)atomic_load_acq_ptr( + (void *)&lapic_thermal_function_ptr); + + if (func != NULL) + func(PCPU_GET(cpuid), lapic_thermal_function_value); + + lapic_eoi(); +} + +static void +lapic_update_thermal(void *dummy __unused) +{ + struct lapic *la; + + la = &lapics[lapic_id()]; + lapic_write32(LAPIC_LVT_THERMAL, lvt_mode(la, APIC_LVT_THERMAL, + lapic_read32(LAPIC_LVT_THERMAL))); +} + +void +lapic_enable_thermal(lapic_thermal_handle_function thermfunc, void *value) +{ +#ifdef DEV_ATPIC + /* Fail if the local APIC is not present. */ + if (!x2apic_mode && lapic_map == NULL) + return; +#endif + + lapic_thermal_function_value = value; + atomic_store_rel_ptr((uintptr_t *)&lapic_thermal_function_ptr, + (uintptr_t)thermfunc); + + lvts[APIC_LVT_THERMAL].lvt_masked = 0; + + MPASS(mp_ncpus == 1 || smp_started); + smp_rendezvous(NULL, lapic_update_thermal, NULL, NULL); +} + +void +lapic_disable_thermal(void) +{ +#ifdef DEV_ATPIC + /* Fail if the local APIC is not present. */ + if (!x2apic_mode && lapic_map == NULL) + return; +#endif + + lvts[APIC_LVT_THERMAL].lvt_masked = 1; + +#ifdef SMP + KASSERT(mp_ncpus == 1 || smp_started, ("thermal driver unloaded too early")); +#endif + smp_rendezvous(NULL, lapic_update_thermal, NULL, NULL); + + atomic_store_rel_ptr((uintptr_t *)&lapic_thermal_function_ptr, + (uintptr_t)NULL); +} + void lapic_handle_error(void) { From nobody Tue Jul 7 19:18:16 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 4gvrbs1zLTz6kLK4 for ; Tue, 07 Jul 2026 19:18:17 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvrbs1h68z3QlJ for ; Tue, 07 Jul 2026 19:18:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783451897; 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=GSBe6sTDPtUUSoRqHUM9gMTSy4k1/qv6MVBugGRb+3U=; b=q1v/SGCozYMrx9DTV182yS8OiYTj0B8SoAsl/XzXgfnVsJcdlcEBWhHTtcmySvAs5adhju 4GQCq4IvJECsHfj8JIgqz6FKxKmK7fMhRKktO04ivq7nFiN3R0Vq4fCAAnbVWRV106XSeP R9i0E+xjA1/sbycNFHChRBZjoi+DcuJzJLbysiASdV4bsP4HP1afvBjEkfiSiXCkhfgpAf GITvt6Tz2RtcEj/p7bZTL4S69KTRWJ5orBvl1lKfyoinXwi1BtYfZe1GNv5EjP7BJVA+Lg KhAWj/JiVNyqUhE2cVRRR4VSrZFYPGDbnoiU+Abqaenu7iuyvw7AoEFPh4D4DQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783451897; a=rsa-sha256; cv=none; b=QD3kjFC9klPW5rp/djeNswuKB+LmLF4U1xn0+4cEK4R56xCioTmK2dZLEm3xmPohBWedF3 k83iaLnUax/8wzkeqpMgZuk2h/gqvW7k2GPe6GwUF+lSlY5ar2lcregfbQwqFmn8ZEjLLt 9IcGtFHUCnTfmQUm01VEbhF2xb5wZsd7P+TDZCHVmNngrGz4ZB0o+ji+V9exn2uMLpiYS/ er6rCVu5D+dTXK/el6bvSd1XHEjoAvc7nc2dviLigbelIPdcg1p0xo94g5SX+wha3squ54 xwzECyL1jvilSWpAyKJmjVq0AA071njEHU0N2Cx0CHuIPvHgMSH+stEcyRE51w== 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=1783451897; 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=GSBe6sTDPtUUSoRqHUM9gMTSy4k1/qv6MVBugGRb+3U=; b=PrkONmm7Ee+fyxAJVjyqmiTX2Z5uVeW/awKASErEcu38CP9bRLa+P2k26iGdV2lZEpPsg4 LrMdjlNqWyRU5z9gN1I5drR5b0wiqC6low/MBK6HSxLR+ImijEFXr6eY92zvukRdkGGRl1 K37OEnU2vSCa757U2k55kK81FldDK5Ukq2MUwVxX/2FWeybNmTEwb3KqZUHrzUlEpcMNK5 But1sMP89z14V2HIQBAkEXGzAuF+gvHhdSYFuiuv1AB9ijmSo03ZJm1Kw5CA/fhL1Wy4fw fRnxiT7GUvrQxpuLIuS+ysa0wzcDPpMNcu4rLwEr35X5W4p0QYmSkZHF7rN29Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvrbs0CfczpJf for ; Tue, 07 Jul 2026 19:18:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3f168 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 19:18:16 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 9313f6b01485 - main - acpi: Add a pseudo-bus for APEI devices to manage resources 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9313f6b01485ad9a0b7cc59b459f5714533587c3 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 19:18:16 +0000 Message-Id: <6a4d50f8.3f168.563a50cc@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=9313f6b01485ad9a0b7cc59b459f5714533587c3 commit 9313f6b01485ad9a0b7cc59b459f5714533587c3 Author: John Baldwin AuthorDate: 2026-07-07 18:13:51 +0000 Commit: John Baldwin CommitDate: 2026-07-07 18:13:51 +0000 acpi: Add a pseudo-bus for APEI devices to manage resources Different APEI tables can reuse the same registers (and sometimes different views of the same register, e.g. 32- vs 64-bit mappings of the same register). To enable this sharing, apei0 now acts as a bus device managing a pool of allocated resources and handing out mappings to child devices which handle individual tables. Most of the previous apei(4) driver has been moved into a new hest0 device that is a child of apei0. Reviewed by: gallatin Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D58024 --- sys/conf/files | 2 + sys/dev/acpica/acpi_apei.c | 159 ++++----------- sys/dev/acpica/acpi_apei_bus.c | 435 +++++++++++++++++++++++++++++++++++++++++ sys/dev/acpica/apei_if.m | 49 +++++ sys/dev/acpica/apeivar.h | 54 +++++ 5 files changed, 579 insertions(+), 120 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index cc18ecbb9301..3635e6474708 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -759,6 +759,7 @@ dev/acpica/Osd/OsdTable.c optional acpi dev/acpica/acpi.c optional acpi dev/acpica/acpi_acad.c optional acpi dev/acpica/acpi_apei.c optional acpi +dev/acpica/acpi_apei_bus.c optional acpi dev/acpica/acpi_battery.c optional acpi dev/acpica/acpi_button.c optional acpi dev/acpica/acpi_cmbat.c optional acpi @@ -779,6 +780,7 @@ dev/acpica/acpi_throttle.c optional acpi dev/acpica/acpi_video.c optional acpi_video acpi dev/acpica/acpi_dock.c optional acpi_dock acpi dev/acpica/acpi_spmc.c optional acpi +dev/acpica/apei_if.m optional acpi dev/adlink/adlink.c optional adlink dev/ae/if_ae.c optional ae pci dev/age/if_age.c optional age pci diff --git a/sys/dev/acpica/acpi_apei.c b/sys/dev/acpica/acpi_apei.c index 925558d585bf..09073207c06e 100644 --- a/sys/dev/acpica/acpi_apei.c +++ b/sys/dev/acpica/acpi_apei.c @@ -48,6 +48,7 @@ #include #include +#include #include #include @@ -56,12 +57,8 @@ struct apei_ge { ACPI_HEST_GENERIC v1; ACPI_HEST_GENERIC_V2 v2; }; - int res_type; - int res_rid; - struct resource *res; - int res2_type; - int res2_rid; - struct resource *res2; + struct resource_map *res; + struct resource_map *res2; uint8_t *buf, *copybuf; TAILQ_ENTRY(apei_ge) link; TAILQ_ENTRY(apei_ge) nlink; @@ -85,7 +82,7 @@ struct apei_pges { TAILQ_HEAD(, apei_ge) ges; }; -struct apei_softc { +struct hest_softc { TAILQ_HEAD(, apei_ge) ges; struct apei_nges nges; struct apei_iges iges; @@ -128,26 +125,6 @@ struct apei_pcie_error { uint8_t AERInfo[96]; }; -#ifdef __i386__ -static __inline uint64_t -apei_bus_read_8(struct resource *res, bus_size_t offset) -{ - return (bus_read_4(res, offset) | - ((uint64_t)bus_read_4(res, offset + 4)) << 32); -} -static __inline void -apei_bus_write_8(struct resource *res, bus_size_t offset, uint64_t val) -{ - bus_write_4(res, offset, val); - bus_write_4(res, offset + 4, val >> 32); -} -#define READ8(r, o) apei_bus_read_8((r), (o)) -#define WRITE8(r, o, v) apei_bus_write_8((r), (o), (v)) -#else -#define READ8(r, o) bus_read_8((r), (o)) -#define WRITE8(r, o, v) bus_write_8((r), (o), (v)) -#endif - #define GED_SIZE(ged) ((ged)->Revision >= 0x300 ? \ sizeof(ACPI_HEST_GENERIC_DATA_V300) : sizeof(ACPI_HEST_GENERIC_DATA)) #define GED_DATA(ged) ((uint8_t *)(ged) + GED_SIZE(ged)) @@ -431,10 +408,10 @@ apei_ge_handler(struct apei_ge *ge, bool copy) ges->BlockStatus = 0; if (!copy && ge->v1.Header.Type == ACPI_HEST_TYPE_GENERIC_ERROR_V2 && ge->res2) { - uint64_t val = READ8(ge->res2, 0); + uint64_t val = bus_read_8(ge->res2, 0); val &= ge->v2.ReadAckPreserve; val |= ge->v2.ReadAckWrite; - WRITE8(ge->res2, 0, val); + bus_write_8(ge->res2, 0, val); } /* If ACPI told the error is fatal -- make it so. */ @@ -484,10 +461,10 @@ apei_nmi_handler(void) ges->BlockStatus = 0; if (ge->v1.Header.Type == ACPI_HEST_TYPE_GENERIC_ERROR_V2 && ge->res2) { - uint64_t val = READ8(ge->res2, 0); + uint64_t val = bus_read_8(ge->res2, 0); val &= ge->v2.ReadAckPreserve; val |= ge->v2.ReadAckWrite; - WRITE8(ge->res2, 0, val); + bus_write_8(ge->res2, 0, val); } handled = 1; } @@ -514,7 +491,7 @@ static void apei_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context) { device_t dev = context; - struct apei_softc *sc = device_get_softc(dev); + struct hest_softc *sc = device_get_softc(dev); struct apei_ge *ge; TAILQ_FOREACH(ge, &sc->iges.ges, nlink) @@ -522,7 +499,7 @@ apei_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context) } static int -hest_parse_structure(struct apei_softc *sc, void *addr, int remaining) +hest_parse_structure(struct hest_softc *sc, void *addr, int remaining) { ACPI_HEST_HEADER *hdr = addr; struct apei_ge *ge; @@ -582,7 +559,7 @@ hest_parse_structure(struct apei_softc *sc, void *addr, int remaining) } static void -hest_parse_table(ACPI_TABLE_HEST *hest, struct apei_softc *sc) +hest_parse_table(ACPI_TABLE_HEST *hest, struct hest_softc *sc) { char *cp; int remaining, consumed; @@ -598,95 +575,43 @@ hest_parse_table(ACPI_TABLE_HEST *hest, struct apei_softc *sc) } } -static char *apei_ids[] = { "PNP0C33", NULL }; - -static ACPI_STATUS -apei_find(ACPI_HANDLE handle, UINT32 level, void *context, - void **status) -{ - int *found = (int *)status; - char **ids; - - for (ids = apei_ids; *ids != NULL; ids++) { - if (acpi_MatchHid(handle, *ids)) { - *found = 1; - break; - } - } - return (AE_OK); -} - static void -apei_identify(driver_t *driver, device_t parent) +hest_identify(driver_t *driver, device_t parent) { device_t child; - int found; ACPI_TABLE_HEADER *hest; ACPI_STATUS status; - if (acpi_disabled("apei")) - return; - /* Without HEST table we have nothing to do. */ status = AcpiGetTable(ACPI_SIG_HEST, 0, &hest); if (ACPI_FAILURE(status)) return; AcpiPutTable(hest); - /* Only one APEI device can exist. */ - if (devclass_get_device(devclass_find("apei"), 0)) + if (device_find_child(parent, "hest", DEVICE_UNIT_ANY) != NULL) return; - /* Search for ACPI error device to be used. */ - found = 0; - AcpiWalkNamespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - 100, apei_find, NULL, NULL, (void *)&found); - if (found) - return; - - /* If not found - create a fake one. */ - child = BUS_ADD_CHILD(parent, 2, "apei", 0); + child = BUS_ADD_CHILD(parent, 0, "hest", DEVICE_UNIT_ANY); if (child == NULL) printf("%s: can't add child\n", __func__); } static int -apei_probe(device_t dev) +hest_probe(device_t dev) { - ACPI_TABLE_HEADER *hest; - ACPI_STATUS status; - int rv; - - if (acpi_disabled("apei")) - return (ENXIO); - - if (acpi_get_handle(dev) != NULL) { - rv = ACPI_ID_PROBE(device_get_parent(dev), dev, apei_ids, NULL); - if (rv > 0) - return (rv); - } else - rv = 0; - - /* Without HEST table we have nothing to do. */ - status = AcpiGetTable(ACPI_SIG_HEST, 0, &hest); - if (ACPI_FAILURE(status)) - return (ENXIO); - AcpiPutTable(hest); - - device_set_desc(dev, "ACPI Platform Error Interface"); - return (rv); + device_set_desc(dev, "APEI Hardware Errors"); + return (BUS_PROBE_NOWILDCARD); } static int -apei_attach(device_t dev) +hest_attach(device_t dev) { - struct apei_softc *sc = device_get_softc(dev); + struct hest_softc *sc = device_get_softc(dev); ACPI_TABLE_HEADER *hest; struct acpi_softc *acpi_sc; struct apei_pges *pges; struct apei_ge *ge; ACPI_STATUS status; - int rid; if (!apei_sysctl_tree) { /* Install hw.acpi.apei sysctl tree */ @@ -717,21 +642,17 @@ apei_attach(device_t dev) hest_parse_table((ACPI_TABLE_HEST *)hest, sc); AcpiPutTable(hest); - rid = 0; TAILQ_FOREACH(ge, &sc->ges, link) { - ge->res_rid = rid++; - acpi_bus_alloc_gas(dev, &ge->res_type, ge->res_rid, - &ge->v1.ErrorStatusAddress, &ge->res, 0); + ge->res = apei_map_register(dev, &ge->v1.ErrorStatusAddress); if (ge->res) { - ge->buf = pmap_mapdev_attr(READ8(ge->res, 0), + ge->buf = pmap_mapdev_attr(bus_read_8(ge->res, 0), ge->v1.ErrorBlockLength, VM_MEMATTR_WRITE_COMBINING); } else { device_printf(dev, "Can't allocate status resource.\n"); } if (ge->v1.Header.Type == ACPI_HEST_TYPE_GENERIC_ERROR_V2) { - ge->res2_rid = rid++; - acpi_bus_alloc_gas(dev, &ge->res2_type, ge->res2_rid, - &ge->v2.ReadAckRegister, &ge->res2, RF_SHAREABLE); + ge->res2 = apei_map_register(dev, + &ge->v2.ReadAckRegister); if (ge->res2 == NULL) device_printf(dev, "Can't allocate ack resource.\n"); } @@ -766,9 +687,9 @@ apei_attach(device_t dev) } static int -apei_detach(device_t dev) +hest_detach(device_t dev) { - struct apei_softc *sc = device_get_softc(dev); + struct hest_softc *sc = device_get_softc(dev); struct apei_ge *ge; apei_nmi = NULL; @@ -787,12 +708,10 @@ apei_detach(device_t dev) while ((ge = TAILQ_FIRST(&sc->ges)) != NULL) { TAILQ_REMOVE(&sc->ges, ge, link); if (ge->res) { - bus_release_resource(dev, ge->res_type, - ge->res_rid, ge->res); + apei_unmap_register(dev, ge->res); } if (ge->res2) { - bus_release_resource(dev, ge->res2_type, - ge->res2_rid, ge->res2); + apei_unmap_register(dev, ge->res2); } if (ge->v1.Notify.Type == ACPI_HEST_NOTIFY_POLLED) { TAILQ_REMOVE(&sc->pges[PGE_ID(ge)].ges, ge, nlink); @@ -812,23 +731,23 @@ apei_detach(device_t dev) return (0); } -static device_method_t apei_methods[] = { +static device_method_t hest_methods[] = { /* Device interface */ - DEVMETHOD(device_identify, apei_identify), - DEVMETHOD(device_probe, apei_probe), - DEVMETHOD(device_attach, apei_attach), - DEVMETHOD(device_detach, apei_detach), + DEVMETHOD(device_identify, hest_identify), + DEVMETHOD(device_probe, hest_probe), + DEVMETHOD(device_attach, hest_attach), + DEVMETHOD(device_detach, hest_detach), DEVMETHOD_END }; -static driver_t apei_driver = { - "apei", - apei_methods, - sizeof(struct apei_softc), +static driver_t hest_driver = { + "hest", + hest_methods, + sizeof(struct hest_softc), }; static int -apei_modevent(struct module *mod __unused, int evt, void *cookie __unused) +hest_modevent(struct module *mod __unused, int evt, void *cookie __unused) { int err = 0; @@ -845,5 +764,5 @@ apei_modevent(struct module *mod __unused, int evt, void *cookie __unused) return (err); } -DRIVER_MODULE(apei, acpi, apei_driver, apei_modevent, 0); -MODULE_DEPEND(apei, acpi, 1, 1, 1); +DRIVER_MODULE(hest, apei, hest_driver, hest_modevent, 0); +MODULE_DEPEND(hest, acpi, 1, 1, 1); diff --git a/sys/dev/acpica/acpi_apei_bus.c b/sys/dev/acpica/acpi_apei_bus.c new file mode 100644 index 000000000000..c6c3a4f11a12 --- /dev/null +++ b/sys/dev/acpica/acpi_apei_bus.c @@ -0,0 +1,435 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 Alexander Motin + * Copyright (c) 2025-2026 Netflix, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +/* + * Different APEI tables can reuse the same registers (and sometimes + * different views of the same register, e.g. 32- vs 64-bit mappings + * of the same register). To enable this sharing, apei0 acts as a bus + * device managing a pool of allocated resources and hands out + * mappings to child devices. Child devices handle individual tables. + */ + +struct apei_register { + struct resource *res; + TAILQ_ENTRY(apei_register) link; +}; + +struct apei_register_mapping { + struct resource_map map; + struct apei_register *reg; + TAILQ_ENTRY(apei_register_mapping) link; +}; + +struct apei_ivars { + TAILQ_HEAD(, apei_register_mapping) mappings; +}; + +TAILQ_HEAD(apei_register_list, apei_register); + +struct apei_softc { + device_t dev; + struct apei_register_list mem; + struct apei_register_list io; +}; + +static char *apei_ids[] = { "PNP0C33", NULL }; + +static MALLOC_DEFINE(M_APEI, "apei", "ACPI platform error interface"); + +static ACPI_STATUS +apei_find(ACPI_HANDLE handle, UINT32 level, void *context, + void **status) +{ + int *found = (int *)status; + char **ids; + + for (ids = apei_ids; *ids != NULL; ids++) { + if (acpi_MatchHid(handle, *ids)) { + *found = 1; + break; + } + } + return (AE_OK); +} + +static void +apei_identify(driver_t *driver, device_t parent) +{ + device_t child; + int found; + + if (acpi_disabled("apei")) + return; + + /* Only one APEI device can exist. */ + if (device_find_child(parent, "apei", DEVICE_UNIT_ANY) != NULL) + return; + + /* Search for ACPI error device to be used. */ + found = 0; + AcpiWalkNamespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, + 100, apei_find, NULL, NULL, (void *)&found); + if (found) + return; + + /* If not found - create a fake one. */ + child = BUS_ADD_CHILD(parent, 2, "apei", 0); + if (child == NULL) + printf("%s: can't add child\n", __func__); +} + +static int +apei_probe(device_t dev) +{ + int rv; + + if (acpi_disabled("apei")) + return (ENXIO); + + if (acpi_get_handle(dev) != NULL) { + rv = ACPI_ID_PROBE(device_get_parent(dev), dev, apei_ids, NULL); + if (rv > 0) + return (rv); + } + + device_set_desc(dev, "ACPI Platform Error Interface"); + return (0); +} + +static int +apei_attach(device_t dev) +{ + struct apei_softc *sc = device_get_softc(dev); + + sc->dev = dev; + TAILQ_INIT(&sc->mem); + TAILQ_INIT(&sc->io); + bus_identify_children(dev); + bus_attach_children(dev); + return (0); +} + +static device_t +apei_add_child(device_t dev, u_int order, const char *name, int unit) +{ + struct apei_ivars *ai; + device_t child; + + ai = malloc(sizeof(*ai), M_APEI, M_WAITOK); + TAILQ_INIT(&ai->mappings); + child = device_add_child_ordered(dev, order, name, unit); + if (child != NULL) + device_set_ivars(child, ai); + else + free(ai, M_APEI); + return (child); +} + +static void +apei_child_deleted(device_t dev, device_t child) +{ + struct apei_ivars *ai = device_get_ivars(child); + + MPASS(TAILQ_EMPTY(&ai->mappings)); + free(ai, M_APEI); +} + +static void +apei_child_detached(device_t dev, device_t child) +{ + struct apei_ivars *ai = device_get_ivars(child); + + while (!TAILQ_EMPTY(&ai->mappings)) { + struct apei_register_mapping *m = TAILQ_FIRST(&ai->mappings); + + device_printf(dev, "child leaked mapping of %s %#jx-%#jx\n", + rman_get_type(m->reg->res) == SYS_RES_MEMORY ? "iomem" : + "port", rman_get_start(m->reg->res), + rman_get_end(m->reg->res)); + + (void) apei_unmap_register(child, &m->map); + } +} + +static int +apei_read_ivar(device_t dev, device_t child, int index, uintptr_t *result) +{ + switch (index) { + case ACPI_IVAR_HANDLE: + *(ACPI_HANDLE *)result = acpi_get_handle(dev); + break; + default: + return (ENOENT); + } + + return (0); +} + +static struct apei_register * +apei_alloc_register(struct apei_softc *sc, int type, rman_res_t start, + rman_res_t count) +{ + struct apei_register_list *list; + struct apei_register *reg, *prev; + rman_res_t end; + const char *descr; + int error, next_rid; + + switch (type) { + case SYS_RES_MEMORY: + list = &sc->mem; + descr = "iomem"; + break; + case SYS_RES_IOPORT: + list = &sc->io; + descr = "port"; + break; + default: + return (NULL); + } + + end = start + (count - 1); + + /* First, look for an existing resource. */ + prev = NULL; + TAILQ_FOREACH(reg, list, link) { + /* Does the existing register overlap with this request? */ + if (start > rman_get_end(reg->res) || + end < rman_get_start(reg->res)) { + + /* prev will be the location of the first free rid */ + if (prev == NULL) + next_rid = 0; + else + next_rid = rman_get_rid(prev->res) + 1; + if (rman_get_rid(reg->res) == next_rid) + prev = reg; + continue; + } + + /* Do we need to extend the existing register? */ + if (start < rman_get_start(reg->res) || + end > rman_get_end(reg->res)) { + rman_res_t new_end, new_start; + + new_start = rman_get_start(reg->res); + if (start < new_start) + new_start = start; + new_end = rman_get_end(reg->res); + if (end > new_end) + new_end = end; + error = bus_adjust_resource(sc->dev, reg->res, + new_start, new_end); + if (error != 0) { + if (bootverbose) + device_printf(sc->dev, + "failed to grow %s %#jx-%#jx for %#jx-%#jx: %d\n", + descr, rman_get_start(reg->res), + rman_get_end(reg->res), start, end, + error); + return (NULL); + } + } + + return (reg); + } + + /* Allocate a new resource. */ + if (prev == NULL) + next_rid = 0; + else + next_rid = rman_get_rid(prev->res) + 1; + error = bus_set_resource(sc->dev, type, next_rid, start, count); + if (error != 0) { + if (bootverbose) + device_printf(sc->dev, + "failed to add %s %#jx-%#jx: %d\n", descr, start, + end, error); + return (NULL); + } + + reg = malloc(sizeof(*reg), M_APEI, M_WAITOK); + reg->res = bus_alloc_resource_any(sc->dev, type, next_rid, RF_ACTIVE | + RF_UNMAPPED); + if (reg->res == NULL) { + if (bootverbose) + device_printf(sc->dev, + "failed to allocate %s %#jx-%#jx\n", descr, start, + end); + free(reg, M_APEI); + bus_delete_resource(sc->dev, type, next_rid); + return (NULL); + } + + if (prev == NULL) + TAILQ_INSERT_HEAD(list, reg, link); + else + TAILQ_INSERT_AFTER(list, prev, reg, link); + return (reg); +} + +static struct resource_map * +apei_map_register_method(device_t dev, device_t child, int type, + rman_res_t start, rman_res_t count) +{ + struct apei_softc *sc = device_get_softc(dev); + struct apei_ivars *ai = device_get_ivars(child); + struct apei_register_mapping *m; + struct apei_register *reg; + struct resource_map_request req; + int error; + + reg = apei_alloc_register(sc, type, start, count); + if (reg == NULL) + return (NULL); + + m = malloc(sizeof(*m), M_APEI, M_WAITOK | M_ZERO); + m->reg = reg; + resource_init_map_request(&req); + req.offset = start - rman_get_start(reg->res); + req.length = count; + error = bus_map_resource(dev, reg->res, &req, &m->map); + if (error != 0) { + if (bootverbose) + device_printf(dev, "failed to map %s %#jx-%#jx: %d\n", + type == SYS_RES_MEMORY ? "iomem" : "port", + start, + start + (count - 1), error); + free(m, M_APEI); + return (NULL); + } + TAILQ_INSERT_TAIL(&ai->mappings, m, link); + return (&m->map); +} + +static int +apei_unmap_register_method(device_t dev, device_t child, + struct resource_map *map) +{ + struct apei_ivars *ai = device_get_ivars(child); + struct apei_register_mapping *m; + int error; + + if (map == NULL) + return (0); + + TAILQ_FOREACH(m, &ai->mappings, link) { + if (&m->map == map) + break; + } + + if (m == NULL) + return (EINVAL); + + TAILQ_REMOVE(&ai->mappings, m, link); + error = bus_unmap_resource(dev, m->reg->res, &m->map); + if (error != 0 && bootverbose) + device_printf(dev, "failed to unmap %s %#jx-%#jx: %d\n", + rman_get_type(m->reg->res) == SYS_RES_MEMORY ? "iomem" : + "port", rman_get_start(m->reg->res), + rman_get_end(m->reg->res), error); + free(m, M_APEI); + return (0); +} + +struct resource_map * +apei_map_register(device_t dev, ACPI_GENERIC_ADDRESS *gas) +{ + int type; + + if (gas->Address == 0 || gas->BitWidth == 0 || gas->BitWidth % 8 != 0) + return (NULL); + + switch (gas->SpaceId) { + case ACPI_ADR_SPACE_SYSTEM_MEMORY: + type = SYS_RES_MEMORY; + break; + case ACPI_ADR_SPACE_SYSTEM_IO: + type = SYS_RES_IOPORT; + break; + default: + return (NULL); + } + + return (APEI_MAP_REGISTER(device_get_parent(dev), dev, type, + gas->Address, gas->BitWidth / 8)); +} + +struct resource_map * +apei_map_memory(device_t dev, rman_res_t start, rman_res_t count) +{ + return (APEI_MAP_REGISTER(device_get_parent(dev), dev, SYS_RES_MEMORY, + start, count)); +} + +int +apei_unmap_register(device_t dev, struct resource_map *map) +{ + return (APEI_UNMAP_REGISTER(device_get_parent(dev), dev, map)); +} + +static device_method_t apei_methods[] = { + /* Device interface */ + DEVMETHOD(device_identify, apei_identify), + DEVMETHOD(device_probe, apei_probe), + DEVMETHOD(device_attach, apei_attach), + + /* Bus interface */ + DEVMETHOD(bus_add_child, apei_add_child), + DEVMETHOD(bus_print_child, bus_generic_print_child), + DEVMETHOD(bus_child_deleted, apei_child_deleted), + DEVMETHOD(bus_child_detached, apei_child_detached), + DEVMETHOD(bus_read_ivar, apei_read_ivar), + + /* APEI interface */ + DEVMETHOD(apei_map_register, apei_map_register_method), + DEVMETHOD(apei_unmap_register, apei_unmap_register_method), + + DEVMETHOD_END +}; + +static driver_t apei_driver = { + "apei", + apei_methods, + sizeof(struct apei_softc), +}; + +DRIVER_MODULE(apei, acpi, apei_driver, NULL, NULL); +MODULE_DEPEND(apei, acpi, 1, 1, 1); diff --git a/sys/dev/acpica/apei_if.m b/sys/dev/acpica/apei_if.m new file mode 100644 index 000000000000..1975fbde962f --- /dev/null +++ b/sys/dev/acpica/apei_if.m @@ -0,0 +1,49 @@ +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2025 Netflix, Inc. +# Written by: John Baldwin +# + +#include + +#include + +/** + * @defgroup APEI apei - KObj methods for ACPI platform error interface drivers + * @brief A pair of methods to allocate/deallocate registers for APEI + * @{ + */ +INTERFACE apei; + +/** + * @brief Allocate a mapping for a resource. + * + * @param _bus parent device + * @param _dev device requesting the mapping + * @param _type resource type + * @param _start start address + * @param _count length + * + * @returns resource mapping on success, or @c NULL on failure + */ +METHOD struct resource_map * map_register { + device_t _bus; + device_t _child; + int _type; + rman_res_t _start; + rman_res_t _count; +}; + +/** + * @brief Deallocate a mapping for a resource. + * + * @param _bus parent device + * @param _dev device releasing the mapping + * @param _map resource map + */ +METHOD int unmap_register { + device_t _bus; + device_t _child; + struct resource_map *_map; +}; diff --git a/sys/dev/acpica/apeivar.h b/sys/dev/acpica/apeivar.h new file mode 100644 index 000000000000..7820641aef1f --- /dev/null +++ b/sys/dev/acpica/apeivar.h @@ -0,0 +1,54 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 Alexander Motin + * Copyright (c) 2025 Netflix, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef __APEIVAR_H__ +#define __APEIVAR_H__ + +#include "apei_if.h" + +struct resource_map *apei_map_register(device_t dev, ACPI_GENERIC_ADDRESS *gas); +struct resource_map *apei_map_memory(device_t dev, rman_res_t start, + rman_res_t len); +int apei_unmap_register(device_t dev, struct resource_map *map); + +#ifdef __i386__ +static __inline uint64_t +bus_read_8(struct resource_map *res, bus_size_t offset) +{ + return (bus_read_4(res, offset) | + ((uint64_t)bus_read_4(res, offset + 4)) << 32); +} +static __inline void +bus_write_8(struct resource_map *res, bus_size_t offset, uint64_t val) +{ + bus_write_4(res, offset, val); + bus_write_4(res, offset + 4, val >> 32); +} +#endif + +#endif /* !__APEIVAR_H__ */ From nobody Tue Jul 7 19:18:18 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 4gvrbt2dP5z6kL3M for ; Tue, 07 Jul 2026 19:18:18 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvrbt26skz3QlK for ; Tue, 07 Jul 2026 19:18:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783451898; 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=CHcIDNtM/vR2qs4497AXpJWj6z0Yfo7LWZxtL1+TB1c=; b=s5OoqKA+HMiO5yL9KWOZWmBdudzVBJFKX0+brMJ7G84YVOkba2cKtJO5nU6Uk4PQ+zznw3 plNDqBBNLOQxFsWgKTT/Obk2V+K09/AoK8figv+LTx9/cUGAK4BdHux11K9N9pSNC9GajW tLnkaZzb0E0Th9HZlN56vgXXgcRdLrwxen+e9uUi2Pw1d5AhhiIFuvOy75D1K8CYToE2G+ kNVDXnWWoWVGireDOZgXWI2ghiIPOYqVEt7ybX0IaDppTKKRH3OjF+tKCXeer/it+vqZQh k6d+W/9ZykFQnvhV1Sac3oH5X7eH+3Fv2TQvSwhaxwHrERDUHSFYCeGz6HmJhg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783451898; a=rsa-sha256; cv=none; b=xdvAYCGdkkq0nxyxn5Day77ItZk+j3QmeWhN3LH8JH4RVLvRiYf03NIt+ChfvV3ghXrHcs tfLYAwYLj2V64jAAg4DiGGusu/SWyb8/f3K2yQvKNnmgZwlV5Q5fzPTgdmt2CUIvaojkOR g8LLx38EGjb9mgDKsOI8MlTaVSGX5K6dAcL7NWJ7J/wDCALXB7lyEAlMtPhWhHRXaLUqOm jGoGJigd+AfboLpw2Dm59858ynMqAdTLabDYqocmqDW1pQlA6oqJpDjlciOjKTzoR7qhBm uSG31EH8FZT5cPR+Qf7qqBPeaLlfaQ4deCeKIIETc6UL3uL73bh5LGRgV4I5zg== 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=1783451898; 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=CHcIDNtM/vR2qs4497AXpJWj6z0Yfo7LWZxtL1+TB1c=; b=peOf3H+tCz8m6sZ7E+oauKz91EuxWWlay+HKQ3N8XgvUQFudCpI5ZW9O743N9voxJCtx1b T5e7Y8WXuIVIl45Pz+meQTbg2od+MOyYsrLm1budVRfbr2fUkP27bWcj6jOgbuxYDVFIWy iS7vp1RI4nURzW1xdtrvJcaYJgCdNG1+1+7RMxdMPlI1++k9sTQ/I1ZZ087w5Kc4LYDHM1 Kmu4cJe8ijCTWDeDPa1spw+7I/Lmb2ZIcnwArIZ+EvIlVL6Dpqg7jHaa0x7Qjl03rQkvIS 5e4O5/xFR5d1Mk06m8koO02z2BHdtQooNae7l3G1RfNwo/A4710OmlHzf5TR2g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvrbt0bXJzpJg for ; Tue, 07 Jul 2026 19:18:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3e3af by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 19:18:18 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: bc49842769bd - main - acpi_einj: Support for ACPI error injection 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bc49842769bd3657a5a1e7de878c0ce8780a2f86 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 19:18:18 +0000 Message-Id: <6a4d50fa.3e3af.79b8bd3e@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=bc49842769bd3657a5a1e7de878c0ce8780a2f86 commit bc49842769bd3657a5a1e7de878c0ce8780a2f86 Author: John Baldwin AuthorDate: 2026-07-07 18:15:27 +0000 Commit: John Baldwin CommitDate: 2026-07-07 18:15:27 +0000 acpi_einj: Support for ACPI error injection This driver parses the ACPI EINJ table and builds a list of instructions associated with known actions. It then exports ioctls to fetch the set of supported errors and inject system errors by executing specific sequences of actions. This can be used to test error reporting facilities for events such as ECC errors. Reviewed by: gallatin Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D58025 --- share/man/man4/Makefile | 1 + share/man/man4/acpi_einj.4 | 58 +++ sys/dev/acpica/acpi_einj.c | 777 ++++++++++++++++++++++++++++++++++++ sys/dev/acpica/acpiio.h | 39 ++ sys/modules/acpi/Makefile | 1 + sys/modules/acpi/acpi_einj/Makefile | 7 + 6 files changed, 883 insertions(+) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index b029d8a64933..775a3e84f933 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -17,6 +17,7 @@ MAN= aac.4 \ ${_acpi_asus.4} \ ${_acpi_asus_wmi.4} \ ${_acpi_dock.4} \ + acpi_einj.4 \ ${_acpi_fujitsu.4} \ ${_acpi_hp.4} \ ${_acpi_ibm.4} \ diff --git a/share/man/man4/acpi_einj.4 b/share/man/man4/acpi_einj.4 new file mode 100644 index 000000000000..e0ec3a39a9b7 --- /dev/null +++ b/share/man/man4/acpi_einj.4 @@ -0,0 +1,58 @@ +.\" +.\" Copyright (c) 2025-2026 Netflix, Inc. +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.Dd July 7, 2026 +.Dt ACPI_EINJ 4 +.Os +.Sh NAME +.Nm acpi_einj +.Nd ACPI platform error injection module +.Sh SYNOPSIS +.In dev/acpica/acpiio.h +.Sh DESCRIPTION +The +.Nm +modules provides support for the error injection facility from the ACPI +Platform Error Interface +.Pq APEI . +This module parses the EINJ table to construct a list of instructions +associated with actions. +The module provides several +.Xr ioctl 2 +commands on the +.Fa /dev/acpi +character device used by the +.Xr einj 8 +utility. +.Sh IOCTLS +The following commands are supported: +.Bl -tag -width indent +.It Dv ACPIIO_EINJ_GET_INFO +Returns a +.Vt struct acpi_einj_info +object to the caller. +.It Dv ACPIIO_EINJ_GET_VENDOR +If the host supports the +.Cm SET_ERROR_TYPE_WITH_ADDRESS +command that includes a vendor extension structure, +this command stores a copy of the vendor extension structure in the buffer +described by the caller-provided +.Vt struct acpi_einj_vendor_info . +.It Dv ACPIIO_EINJ_SET_ERROR +Injects a platform error described by a +.Vt struct acpi_einj_error +object provided by the caller. +.El +.Sh FILES +.Bl -tag -width "/boot/kernel/acpi_einj.ko" -compact +.It Pa /boot/kernel/acpi_einj.ko +.Sh SEE ALSO +.Xr acpi 4 , +.Xr einj 8 +.El +.Sh HISTORY +The +.Nm +module first appeared in +.Fx 16.0 . diff --git a/sys/dev/acpica/acpi_einj.c b/sys/dev/acpica/acpi_einj.c new file mode 100644 index 000000000000..ac12cf28b414 --- /dev/null +++ b/sys/dev/acpica/acpi_einj.c @@ -0,0 +1,777 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2025-2026 Netflix, Inc. + * Written by: John Baldwin + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include + +#define ACPI_EINJ_MAX_ACTION (ACPI_EINJV2_GET_ERROR_TYPE) + +struct einj_instruction { + struct resource_map *res; + u_int instruction; + u_int flags; + u_int size; + uint64_t value; + uint64_t mask; +}; + +struct einj_action { + struct einj_instruction *instructions; + u_int num_instructions; +}; + +struct einj_softc { + device_t dev; + ACPI_TABLE_EINJ *einj; + struct einj_action actions[ACPI_EINJ_MAX_ACTION + 1]; + + struct acpi_einj_info info; + struct resource_map *address_res; + struct resource_map *vendor_res; + + struct sx lock; +}; + +static MALLOC_DEFINE(M_EINJ, "einj", "ACPI error injection"); + +static bool +einj_validate_instruction(u_int i, ACPI_EINJ_ENTRY *e) +{ + ACPI_GENERIC_ADDRESS *gas; + UINT8 valid_flags; + + valid_flags = 0; + switch (e->WheaHeader.Instruction) { + case ACPI_EINJ_WRITE_REGISTER: + case ACPI_EINJ_WRITE_REGISTER_VALUE: + valid_flags |= ACPI_EINJ_PRESERVE; + break; + case ACPI_EINJ_READ_REGISTER: + case ACPI_EINJ_READ_REGISTER_VALUE: + /* PRESERVE_REGISTER is ignored, but not invalid. */ + valid_flags |= ACPI_EINJ_PRESERVE; + break; + case ACPI_EINJ_NOOP: +#if 0 + /* Not documented. */ + case ACPI_EINJ_FLUSH_CACHELINE: +#endif + break; + default: + if (bootverbose) + printf("EINJ: Unknown instruction at index %u\n", i); + return (false); + } + if ((e->WheaHeader.Flags & ~valid_flags) != 0) { + if (bootverbose) + printf("EINJ: Invalid instruction flag at index %u\n", + i); + return (false); + } + + gas = &e->WheaHeader.RegisterRegion; + switch (gas->SpaceId) { + case ACPI_ADR_SPACE_SYSTEM_MEMORY: + case ACPI_ADR_SPACE_SYSTEM_IO: + break; + default: + if (bootverbose) + printf("EINJ: Unsupported register address space at index %u\n", + i); + return (false); + } + + /* + * The spec seems to suggest sub-bit ranges of registers might + * be valid, but punt on handling those until one is actually + * encountered in the wild. + */ + if (gas->BitOffset != 0) { + if (bootverbose) + printf("EINJ: Unsupported register offset at index %u\n", + i); + return (false); + } + if (!(gas->BitWidth == 8 || gas->BitWidth == 16 || + gas->BitWidth == 32 || gas->BitWidth == 64)) { + if (bootverbose) + printf("EINJ: Unsupported register width at index %u\n", + i); + return (false); + } + return (true); +} + +static bool +einj_validate_table(ACPI_TABLE_EINJ *einj) +{ + ACPI_EINJ_ENTRY *e; + u_int i; + bool seen_set_error_type_with_address; + + if (einj->Header.Revision < 1 || einj->Header.Revision > 2) { + if (bootverbose) + printf("EINJ: Unsupported revision %u\n", + einj->Header.Revision); + return (false); + } + if (einj->HeaderLength != sizeof(*einj)) { + if (bootverbose) + printf("EINJ: Invalid Injection Interface Header Length\n"); + return (false); + } + if (einj->Entries == 0) { + if (bootverbose) + printf("EINJ: No actions\n"); + return (false); + } + if (einj->Header.Length != sizeof(*einj) + einj->Entries * sizeof(*e)) { + if (bootverbose) + printf("EINJ: Invalid table length\n"); + return (false); + } + + e = (ACPI_EINJ_ENTRY *)(einj + 1); + seen_set_error_type_with_address = false; + for (i = 0; i < einj->Entries; i++, e++) { + if (e->WheaHeader.Action > ACPI_EINJ_MAX_ACTION) { + if (bootverbose) + printf("EINJ: Invalid action at index %u\n", i); + return (false); + } + + if (e->WheaHeader.Action == + ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS) { + if (seen_set_error_type_with_address) { + if (bootverbose) + printf("EINJ: Multiple SET_ERROR_TYPE_WITH_ADDRESS instructions\n"); + return (false); + } + seen_set_error_type_with_address = true; + } + + if (!einj_validate_instruction(i, e)) + return (false); + } + return (true); +} + +static uint64_t +einj_read_register(struct einj_instruction *inst) +{ + switch (inst->size) { + case 1: + return (bus_read_1(inst->res, 0)); + case 2: + return (bus_read_2(inst->res, 0)); + case 4: + return (bus_read_4(inst->res, 0)); + case 8: + return (bus_read_8(inst->res, 0)); + default: + __assert_unreachable(); + } +} + +static void +einj_write_register(struct einj_instruction *inst, uint64_t value) +{ + switch (inst->size) { + case 1: + bus_write_1(inst->res, 0, value); + break; + case 2: + bus_write_2(inst->res, 0, value); + break; + case 4: + bus_write_4(inst->res, 0, value); + break; + case 8: + bus_write_8(inst->res, 0, value); + break; + default: + __assert_unreachable(); + } +} + +static uint64_t +einj_execute_instruction(struct einj_instruction *inst, uint64_t value) +{ + uint64_t old; + + switch (inst->instruction) { + case ACPI_EINJ_READ_REGISTER: + case ACPI_EINJ_READ_REGISTER_VALUE: + value = einj_read_register(inst); + value &= inst->mask; + if (inst->instruction == ACPI_EINJ_READ_REGISTER_VALUE) + value = (value == inst->value); + break; + case ACPI_EINJ_WRITE_REGISTER_VALUE: + value = inst->value; + /* FALLTHROUGH */ + case ACPI_EINJ_WRITE_REGISTER: + value &= inst->mask; + if (inst->flags & ACPI_EINJ_PRESERVE) { + old = einj_read_register(inst); + value |= (old & ~inst->mask); + } + einj_write_register(inst, value); + break; + case ACPI_EINJ_NOOP: + break; + default: + __assert_unreachable(); + } + return (value); +} + +static uint64_t +einj_execute_instructions(struct einj_instruction *inst, u_int count, + uint64_t value) +{ + for (u_int i = 0; i < count; i++, inst++) { + value = einj_execute_instruction(inst, value); + } + return (value); +} + +static int +einj_execute_action(struct einj_softc *sc, u_int action, uint64_t *value) +{ + struct einj_action *ea; + + if (action >= nitems(sc->actions)) + return (ENOENT); + ea = &sc->actions[action]; + if (ea->num_instructions == 0) + return (ENOENT); + + *value = einj_execute_instructions(ea->instructions, + ea->num_instructions, *value); + return (0); +} + +static int +einj_trigger_error(struct einj_softc *sc, vm_paddr_t table_pa) +{ + ACPI_EINJ_TRIGGER *table; + ACPI_EINJ_ENTRY *e; + size_t table_len; + uint64_t value; + int error; + + /* Map the header to obtain the full length. */ + table_len = sizeof(*table); + table = pmap_mapbios(table_pa, table_len); + if (table == NULL) { + device_printf(sc->dev, "failed to map trigger table header\n"); + return (ENXIO); + } + + if (table->HeaderSize != sizeof(*table)) { + device_printf(sc->dev, "invalid trigger table header size %u\n", + table->HeaderSize); + error = ENXIO; + goto out; + } + + if (table->TableSize < + table->HeaderSize + sizeof(*e) * table->EntryCount) { + device_printf(sc->dev, + "trigger table too small (%u) for %u entries\n", + table->TableSize, table->EntryCount); + error = ENXIO; + goto out; + } + + if (table->EntryCount == 0) { + error = 0; + goto out; + } + + /* Map the full table. */ + pmap_unmapbios(table, table_len); + table_len = table->TableSize; + table = pmap_mapbios(table_pa, table_len); + if (table == NULL) { + device_printf(sc->dev, "failed to map trigger table\n"); + return (ENXIO); + } + + value = 0; + e = (ACPI_EINJ_ENTRY *)(table + 1); + for (u_int i = 0; i < table->EntryCount; i++, e++) { + struct einj_instruction ei; + + if (e->WheaHeader.Action != ACPI_EINJ_TRIGGER_ERROR) + device_printf(sc->dev, + "invalid action %#x for trigger instruction %u\n", + e->WheaHeader.Action, i); + + if (e->WheaHeader.Instruction == ACPI_EINJ_NOOP) + continue; + + ei.res = apei_map_register(sc->dev, + &e->WheaHeader.RegisterRegion); + if (ei.res == NULL) { + device_printf(sc->dev, + "failed to map register for trigger entry %u\n", i); + error = ENXIO; + goto out; + } + + ei.instruction = e->WheaHeader.Instruction; + ei.flags = e->WheaHeader.Flags; + ei.value = e->WheaHeader.Value; + ei.mask = e->WheaHeader.Mask; + ei.size = e->WheaHeader.RegisterRegion.BitWidth / 8; + value = einj_execute_instruction(&ei, value); + apei_unmap_register(sc->dev, ei.res); + } + error = 0; +out: + pmap_unmapbios(table, table_len); + return (error); +} + +static int +einj_set_error(struct einj_softc *sc, const struct acpi_einj_error *err) +{ + uint64_t value; + int error; + + if ((err->address_flags & ~(ACPI_EINJ_APICID_VALID | + ACPI_EINJ_MEMADDRESS_VALID | ACPI_EINJ_PCIE_VALID)) != 0) + return (EINVAL); + if (err->address_flags != 0 && sc->address_res == NULL) + return (EOPNOTSUPP); + + value = 0; + error = einj_execute_action(sc, ACPI_EINJ_BEGIN_OPERATION, &value); + if (error != 0) { + device_printf(sc->dev, "BEGIN_OPERATION failed\n"); + return (error); + } + + value = err->error_type; + if (sc->address_res != NULL) { + error = einj_execute_action(sc, + ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS, &value); + if (error != 0) { + device_printf(sc->dev, + "SET_ERROR_TYPE_WITH_ADDRESS failed\n"); + goto out; + } + + bus_write_4(sc->address_res, + offsetof(ACPI_EINJ_ERROR_TYPE_WITH_ADDR, Flags), + err->address_flags); + bus_write_4(sc->address_res, + offsetof(ACPI_EINJ_ERROR_TYPE_WITH_ADDR, ApicId), + err->apic_id); + bus_write_8(sc->address_res, + offsetof(ACPI_EINJ_ERROR_TYPE_WITH_ADDR, Address), + err->memory_address); + bus_write_8(sc->address_res, + offsetof(ACPI_EINJ_ERROR_TYPE_WITH_ADDR, Range), + err->memory_range); + bus_write_4(sc->address_res, + offsetof(ACPI_EINJ_ERROR_TYPE_WITH_ADDR, PcieId), + err->pcie_id); + } else { + error = einj_execute_action(sc, ACPI_EINJ_SET_ERROR_TYPE, + &value); + if (error != 0) { + device_printf(sc->dev, "SET_ERROR_TYPE failed\n"); + goto out; + } + } + + value = 0; + error = einj_execute_action(sc, ACPI_EINJ_EXECUTE_OPERATION, &value); + if (error != 0) { + device_printf(sc->dev, "EXECUTE_OPERATION failed\n"); + goto out; + } + + for (;;) { + value = 0; + error = einj_execute_action(sc, ACPI_EINJ_CHECK_BUSY_STATUS, + &value); + if (error != 0) { + device_printf(sc->dev, "CHECK_BUSY_STATUS failed\n"); + goto out; + } + + if ((value & 1) == 0) + break; + DELAY(1000); + } + + value = 0; + error = einj_execute_action(sc, ACPI_EINJ_GET_COMMAND_STATUS, &value); + if (error != 0) { + device_printf(sc->dev, "GET_COMMAND_STATUS failed\n"); + goto out; + } + + /* Bits 1:8 of the returned value contain the status code. */ + switch ((value >> 1) & 0xff) { + case ACPI_EINJ_SUCCESS: + break; + case ACPI_EINJ_FAILURE: + device_printf(sc->dev, "injection of error type %#x failed\n", + err->error_type); + error = ENXIO; + goto out; + case ACPI_EINJ_INVALID_ACCESS: + device_printf(sc->dev, + "invalid access while injecting error type %#x\n", + err->error_type); + error = ENXIO; + goto out; + default: + device_printf(sc->dev, + "unknown status %ju while injecting error type %#x\n", + (uintmax_t)value, err->error_type); + error = ENXIO; + goto out; + } + + value = 0; + error = einj_execute_action(sc, ACPI_EINJ_GET_TRIGGER_TABLE, &value); + if (error != 0) { + device_printf(sc->dev, "GET_TRIGER_TABLE failed\n"); + goto out; + } + + error = einj_trigger_error(sc, value); +out: + value = 0; + (void)einj_execute_action(sc, ACPI_EINJ_END_OPERATION, &value); + return (error); +} + +static int +einj_ioctl(u_long cmd, caddr_t addr, void *arg) +{ + struct einj_softc *sc = arg; + int error; + + error = 0; + switch (cmd) { + case ACPIIO_EINJ_GET_INFO: + memcpy(addr, &sc->info, sizeof(sc->info)); + break; + case ACPIIO_EINJ_GET_VENDOR: { + struct acpi_einj_vendor_info *v = (void *)addr; + void *buf; + + if (sc->vendor_res == NULL) + return (ENXIO); + if (v->len != sc->info.vendor_length) + return (EINVAL); + + /* + * This assumes the region can be safely read via + * 4-byte reads. + */ + buf = malloc(v->len, M_DEVBUF, M_WAITOK); + bus_read_region_4(sc->vendor_res, 0, buf, v->len / 4); + if (v->len % 4 != 0) { + uint32_t offset; + + offset = rounddown2(v->len, 4); + bus_read_region_1(sc->vendor_res, offset, + (char *)buf + offset, v->len % 4); + } + + error = copyout(buf, v->buf, v->len); + free(buf, M_DEVBUF); + break; + } + case ACPIIO_EINJ_SET_ERROR: + sx_xlock(&sc->lock); + error = einj_set_error(sc, (struct acpi_einj_error *)addr); + sx_xunlock(&sc->lock); + break; + default: + error = ENOIOCTL; + break; + } + return (error); +} + +static void +einj_identify(driver_t *driver, device_t parent) +{ + ACPI_TABLE_HEADER *einj; + ACPI_STATUS status; + bool valid; + + if (device_find_child(parent, "einj", DEVICE_UNIT_ANY) != NULL) + return; + + status = AcpiGetTable(ACPI_SIG_EINJ, 0, &einj); + if (ACPI_FAILURE(status)) + return; + valid = einj_validate_table((ACPI_TABLE_EINJ *)einj); + AcpiPutTable(einj); + if (!valid) + return; + + BUS_ADD_CHILD(parent, 1, "einj", DEVICE_UNIT_ANY); +} + +static bool +einj_parse_table(struct einj_softc *sc, ACPI_GENERIC_ADDRESS *address_gas) +{ + ACPI_EINJ_ENTRY *e; + struct resource_map *res; + u_int i; + + e = (ACPI_EINJ_ENTRY *)(sc->einj + 1); + for (i = 0; i < sc->einj->Entries; i++, e++) { + struct einj_action *ea = &sc->actions[e->WheaHeader.Action]; + struct einj_instruction *ei; + + switch (e->WheaHeader.Instruction) { + case ACPI_EINJ_NOOP: + res = NULL; + break; + default: + res = apei_map_register(sc->dev, + &e->WheaHeader.RegisterRegion); + if (res == NULL) + return (false); + } + + if (e->WheaHeader.Action == + ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS) + *address_gas = e->WheaHeader.RegisterRegion; + + ea->instructions = realloc(ea->instructions, + sizeof(*ea->instructions) * (ea->num_instructions + 1), + M_EINJ, M_WAITOK); + ei = &ea->instructions[ea->num_instructions]; + ei->res = res; + ei->instruction = e->WheaHeader.Instruction; + ei->flags = e->WheaHeader.Flags; + ei->value = e->WheaHeader.Value; + ei->mask = e->WheaHeader.Mask; + ei->size = e->WheaHeader.RegisterRegion.BitWidth / 8; + ea->num_instructions++; + } + return (true); +} + +/* + * SET_ERROR_TYPE_WITH_ADDRESS points to a data structure, but the + * original action only points to the first word. Expand the mapping + * to cover the entire structure and initialize the cached copy of the + * structure. + */ +static int +einj_parse_set_error_with_address(struct einj_softc *sc, + const ACPI_GENERIC_ADDRESS *gas) +{ + struct resource_map *res; + struct einj_action *ea; + uint32_t vendor_offset; + + ea = &sc->actions[ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS]; + if (ea->num_instructions == 0) + return (0); + + /* Map the SET_ERROR_TYPE_WITH_ADDRESS structure. */ + res = apei_map_memory(sc->dev, gas->Address, + sizeof(ACPI_EINJ_ERROR_TYPE_WITH_ADDR)); + if (res == NULL) { + device_printf(sc->dev, + "failed to map SET_ERROR_TYPE_WITH_ADDRESS structure\n"); + return (ENXIO); + } + sc->address_res = res; + + /* Map the Vendor extension structure if it exists. */ + if ((sc->info.error_type & ACPI_EINJ_VENDOR_DEFINED) == 0) + return (0); + + vendor_offset = bus_read_4(res, + offsetof(ACPI_EINJ_ERROR_TYPE_WITH_ADDR, VendorStructOffset)); + + if (vendor_offset < sizeof(ACPI_EINJ_ERROR_TYPE_WITH_ADDR)) { + device_printf(sc->dev, + "Vendor Error extension overlaps base structure\n"); + return (0); + } + + res = apei_map_memory(sc->dev, gas->Address + vendor_offset, + sizeof(ACPI_EINJ_VENDOR)); + if (res == NULL) { + device_printf(sc->dev, + "failed to map Vendor Error extension structure\n"); + return (0); + } + + sc->info.vendor_length = + bus_read_4(res, offsetof(ACPI_EINJ_VENDOR, Length)); + + if (sc->info.vendor_length < sizeof(ACPI_EINJ_VENDOR)) { + if (bootverbose || sc->info.vendor_length != 0) + device_printf(sc->dev, + "invalid Vendor Error extension structure length\n"); + apei_unmap_register(sc->dev, res); + return (0); + } + + if (sc->info.vendor_length > sizeof(ACPI_EINJ_VENDOR)) { + apei_unmap_register(sc->dev, res); + res = apei_map_memory(sc->dev, gas->Address + vendor_offset, + sc->info.vendor_length); + if (res == NULL) { + device_printf(sc->dev, + "failed to map Vendor Error extension structure\n"); + return (0); + } + } + sc->vendor_res = res; + + return (0); +} + +static void +einj_cleanup(struct einj_softc *sc) +{ + struct einj_action *ea; + + /* This is idempotent if the handler isn't registered. */ + acpi_deregister_ioctls(einj_ioctl); + + ea = sc->actions; + for (u_int i = 0; i < nitems(sc->actions); i++, ea++) { + struct einj_instruction *ei; + + ei = ea->instructions; + for (u_int j = 0; j < ea->num_instructions; j++, ei++) { + if (ei->res != NULL) + apei_unmap_register(sc->dev, ei->res); + } + free(ea->instructions, M_EINJ); + } + + if (sc->address_res) + apei_unmap_register(sc->dev, sc->address_res); + if (sc->vendor_res) + apei_unmap_register(sc->dev, sc->vendor_res); + AcpiPutTable((ACPI_TABLE_HEADER *)sc->einj); + sx_destroy(&sc->lock); +} + +static int +einj_probe(device_t dev) +{ + device_set_desc(dev, "ACPI Error Injection Interface"); + return (BUS_PROBE_GENERIC); +} + +static int +einj_attach(device_t dev) +{ + struct einj_softc *sc = device_get_softc(dev); + ACPI_TABLE_HEADER *hdr; + ACPI_GENERIC_ADDRESS address_gas; + ACPI_STATUS status; + uint64_t value; + int error; + + sc->dev = dev; + status = AcpiGetTable(ACPI_SIG_EINJ, 0, &hdr); + if (ACPI_FAILURE(status)) { + device_printf(dev, "Failed to read " ACPI_SIG_EINJ " table\n"); + return (ENXIO); + } + sx_init(&sc->lock, "einj"); + sc->einj = (ACPI_TABLE_EINJ *)hdr; + + if (!einj_validate_table(sc->einj)) { + device_printf(dev, "Invalid " ACPI_SIG_EINJ " table\n"); + goto out; + } + if (!einj_parse_table(sc, &address_gas)) + goto out; + + value = 0; + error = einj_execute_action(sc, ACPI_EINJ_GET_ERROR_TYPE, &value); + if (error != 0) { + device_printf(dev, "Failed to fetch supported error types\n"); + goto out; + } + sc->info.error_type = value; + + error = einj_parse_set_error_with_address(sc, &address_gas); + if (error != 0) + goto out; + + error = acpi_register_ioctl(ACPIIO_EINJ_GET_INFO, einj_ioctl, sc); + if (error == 0) + error = acpi_register_ioctl(ACPIIO_EINJ_GET_VENDOR, einj_ioctl, + sc); + if (error == 0) + error = acpi_register_ioctl(ACPIIO_EINJ_SET_ERROR, einj_ioctl, + sc); + if (error != 0) { + device_printf(dev, "Failed to register ioctl handler\n"); + goto out; + } + return (0); +out: + einj_cleanup(sc); + return (ENXIO); +} + +static int +einj_detach(device_t dev) +{ + struct einj_softc *sc = device_get_softc(dev); + + einj_cleanup(sc); + return (0); +} + +static device_method_t einj_methods[] = { + DEVMETHOD(device_identify, einj_identify), + DEVMETHOD(device_probe, einj_probe), + DEVMETHOD(device_attach, einj_attach), + DEVMETHOD(device_detach, einj_detach), + DEVMETHOD_END +}; + +static driver_t einj_driver = { + "einj", + einj_methods, + sizeof(struct einj_softc) +}; + +DRIVER_MODULE(einj, apei, einj_driver, NULL, NULL); +MODULE_DEPEND(einj, acpi, 1, 1, 1); diff --git a/sys/dev/acpica/acpiio.h b/sys/dev/acpica/acpiio.h index 4df049ed196a..4c85ad244462 100644 --- a/sys/dev/acpica/acpiio.h +++ b/sys/dev/acpica/acpiio.h @@ -28,6 +28,10 @@ #ifndef _ACPIIO_H_ #define _ACPIIO_H_ +#ifndef _KERNEL +#include +#endif + /* * Core ACPI subsystem ioctls */ @@ -201,6 +205,41 @@ union acpi_battery_ioctl_arg { /* Get AC adapter status. */ #define ACPIIO_ACAD_GET_STATUS _IOR('A', 1, int) +/* Error injection commands. */ + +/* Flags in ACPI_EINJ_ERROR_TYPE_WITH_ADDR.Flags */ +#define ACPI_EINJ_APICID_VALID 0x00000001 +#define ACPI_EINJ_MEMADDRESS_VALID 0x00000002 +#define ACPI_EINJ_PCIE_VALID 0x00000004 + +struct acpi_einj_info { + uint32_t error_type; /* Value from GET_ERROR_TYPE. */ + + uint32_t vendor_length; + + /* SET_ERROR_TYPE_WITH_ADDRESS supported. */ + bool error_address; +}; + +struct acpi_einj_vendor_info { + void *buf; + uint32_t len; +}; + +struct acpi_einj_error { + uint32_t error_type; + + uint32_t address_flags; /* ACPI_EINJ_*_VALID */ + uint32_t apic_id; + uint64_t memory_address; + uint64_t memory_range; + uint32_t pcie_id; +}; + +#define ACPIIO_EINJ_GET_INFO _IOR('E', 1, struct acpi_einj_info) +#define ACPIIO_EINJ_GET_VENDOR _IOW('E', 2, struct acpi_einj_vendor_info) +#define ACPIIO_EINJ_SET_ERROR _IOW('E', 3, struct acpi_einj_error) + #ifdef _KERNEL typedef int (*acpi_ioctl_fn)(u_long cmd, caddr_t addr, void *arg); extern int acpi_register_ioctl(u_long cmd, acpi_ioctl_fn fn, void *arg); diff --git a/sys/modules/acpi/Makefile b/sys/modules/acpi/Makefile index 265e6bd6cdcb..25ce293a9fa5 100644 --- a/sys/modules/acpi/Makefile +++ b/sys/modules/acpi/Makefile @@ -17,6 +17,7 @@ SUBDIR= \ .endif SUBDIR+= \ + acpi_einj \ acpi_ged .include diff --git a/sys/modules/acpi/acpi_einj/Makefile b/sys/modules/acpi/acpi_einj/Makefile new file mode 100644 index 000000000000..14ff9ac1eac3 --- /dev/null +++ b/sys/modules/acpi/acpi_einj/Makefile @@ -0,0 +1,7 @@ +.PATH: ${SRCTOP}/sys/dev/acpica + +KMOD= acpi_einj +SRCS= acpi_einj.c +SRCS+= opt_acpi.h apei_if.h bus_if.h device_if.h + +.include From nobody Tue Jul 7 19:18:19 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 4gvrbv4C7dz6kL3N for ; Tue, 07 Jul 2026 19:18:19 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvrbv2YwWz3QlL for ; Tue, 07 Jul 2026 19:18:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783451899; 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=aKVzQohJPIG86EpZWUj7Kt2C7a6G/A0//yaH/c+r7eQ=; b=Jksdro/SiokF4oSBJCsRG7dM2avg607KjygHMtwyNuwEEqYUiqqNBrc9AfZGblv5lx2Eab trBr2mLyA56/elaDj2tvG/HW0INyBG5dbFXhsZahlKXozPmjXKgnuSq8DJPL9J6BNSDqk7 ewDZuDyTIAexDQRGgPT7iUpsuTUSRh9oqMTkQ/0qbfU93YICjCWOKVVGxpku+nNww1zYZx jrGcjMbEUn4Zblmq1X0S122AjTXhTnG1I64DBLDvV3F7N1JnMZUqmW4mW9m8UN8K6VLYmk FvaRtpYIp/31CI/bKo6lEdG1rLcOTjLQoKcx+sCAHiE0h0N51h3fp/KCoiJKtA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783451899; a=rsa-sha256; cv=none; b=Mo2D2/l/uA5PwLdLj5U+h42p9l/2NbVo+u4jU+LHFMEjs+0bzQ/ogJsaqlJOD3AOE+aaKR /SuDhXVuOagMpNDzvh5cMaQnxBcBj8U8WkSjxANM+V8RSxDQhC2JAQoCJqTMovy0X1sHhF k6LHvvrNTG2dIcOriuSV4PIJ8bqxVDtqJ+G2cNisE6l+Yv4Oi+T7o1008xYwTqdAZIAbjl Wdo0Yn4UjtyRBo/iuMHSo/x2dzbd2wxZjg7ArqyKK+TL0I7M+/37RixOqpjA8iT/3039sO SQ6CDhsJ/BefF06jKCjtnvqu//W231O/hMM+/8eJMTuIJDbeDj0LEE3HZNxFwA== 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=1783451899; 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=aKVzQohJPIG86EpZWUj7Kt2C7a6G/A0//yaH/c+r7eQ=; b=sKK5UwWGgAoN8cgrksU3NccigQ+XfFjD8epXXbXeVrTXi/qDdM48fW1l31N78kKCiym+l2 KBBa1Rwfnqf33cZrFWBODKlcR/LaCmqkaCzXfWZGML5t7plipS5KWFOwwFwYTkqT5DHY8j eLO5KoM4a95NDKOZ1uScKqtFA8bBRRIMHoRpsyFRvsmGrOWnY92KKku7mHKXvPm6imrwKf vzyAa9Fk4hGKFnoP8hYSDmbVrG5BPMyxBxtZ9hDuQ8R+w9C9owTiBmE6FPTv+bTYBQRfd7 a+IapDPs+9mF3xtVkjNP5opfyXKVzORHn18Vs4NZIA+aFe+2n9IdFyIZJDUgmQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvrbv1CZdznJg for ; Tue, 07 Jul 2026 19:18:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3e12e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 19:18:19 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 81bab70dc620 - main - einj: Tool to manage APEI error injection 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 81bab70dc6205032e58d15a87ccc8549f900316d Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 19:18:19 +0000 Message-Id: <6a4d50fb.3e12e.3c22b58d@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=81bab70dc6205032e58d15a87ccc8549f900316d commit 81bab70dc6205032e58d15a87ccc8549f900316d Author: John Baldwin AuthorDate: 2026-07-07 18:15:49 +0000 Commit: John Baldwin CommitDate: 2026-07-07 18:15:49 +0000 einj: Tool to manage APEI error injection This tool supports two commands. The list command outputs a summary of injectable errors supported by the current system. The inject command injects the requested error. Reviewed by: gallatin, imp Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D58026 --- usr.sbin/acpi/Makefile | 2 +- usr.sbin/acpi/einj/Makefile | 4 + usr.sbin/acpi/einj/einj.8 | 73 +++++++++++++ usr.sbin/acpi/einj/einj.c | 256 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 334 insertions(+), 1 deletion(-) diff --git a/usr.sbin/acpi/Makefile b/usr.sbin/acpi/Makefile index c44a4146f44b..fb1216b43f60 100644 --- a/usr.sbin/acpi/Makefile +++ b/usr.sbin/acpi/Makefile @@ -1,6 +1,6 @@ # Makefile for acpi tools # $Id: Makefile,v 1.1 2000/07/14 18:16:22 iwasaki Exp $ -SUBDIR= acpiconf acpidb acpidump iasl +SUBDIR= acpiconf acpidb acpidump einj iasl .include diff --git a/usr.sbin/acpi/einj/Makefile b/usr.sbin/acpi/einj/Makefile new file mode 100644 index 000000000000..4a0a9900f3b1 --- /dev/null +++ b/usr.sbin/acpi/einj/Makefile @@ -0,0 +1,4 @@ +PROG= einj +MAN= einj.8 + +.include diff --git a/usr.sbin/acpi/einj/einj.8 b/usr.sbin/acpi/einj/einj.8 new file mode 100644 index 000000000000..06ac0988158a --- /dev/null +++ b/usr.sbin/acpi/einj/einj.8 @@ -0,0 +1,73 @@ +.\" +.\" Copyright (c) 2025 Netflix, Inc. +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.Dd December 17, 2025 +.Dt EINJ 8 +.Os +.Sh NAME +.Nm einj +.Nd ACPI Platform Error Interface error injection +.Sh SYNOPSIS +.Nm +.Cm list +.Nm +.Cm inject +.Op Fl a Ar address +.Op Fl C Ar APIC ID +.Oo Fl P Ar device +.Sm off +.Cm pci Oo Ar domain \&: Oc Ar bus \&: Ar slot \&: Ar function +.Sm on +.Oc +.Ar type +.Sh DESCRIPTION +The +.Nm +utility provides a command line interface to the ACPI Platform Error Interface +.Pq APEI +error injection facility provided by +.Xr acpi_einj 4 . +.Pp +The +.Cm list +command outputs the set of platform errors that can be injected on the +current host. +.Pp +The +.Cm inject +command injects a single platform error. +The +.Ar type +argument specifies the type of error to inject, +for example +.Dq mem.cor +to inject a correctable memory error. +Vendor-specific errors are not supported. +.Pp +The +.Ar address +argument sets a specific address to use with memory errors. +.Pp +The +.Ar APIC ID +argument sets a physical processor ID for processor errors. +.Pp +The +.Ar device +argument sets the target for PCI device errors. +The argument must follow the format +.Sm off +.Cm pci Oo Ar domain \&: Oc Ar bus \&: Ar slot \&: Ar function +.Sm on . +.Sh EXAMPLES +Inject a fatal uncorrectable memory error for the physical address 0x12345678: +.Pp +.Dl einj inject -a 0x12345678 mem.fatal +.Sh SEE ALSO +.Xr acpi_einj 4 +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 16.0 . diff --git a/usr.sbin/acpi/einj/einj.c b/usr.sbin/acpi/einj/einj.c new file mode 100644 index 000000000000..38e0d129a2e5 --- /dev/null +++ b/usr.sbin/acpi/einj/einj.c @@ -0,0 +1,256 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2025 Netflix, Inc. + * Written by: John Baldwin + */ + +#include +#include +#include +#include +#include +#include +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#include +#include +#pragma GCC diagnostic pop + +#include +#include + +static int fd; + +static struct error_type_info { + const char *name; + uint32_t bit; + const char *description; +} error_types[] = { + { "cpu.cor", ACPI_EINJ_PROCESSOR_CORRECTABLE, "Processor Correctable" }, + { "cpu.uc", ACPI_EINJ_PROCESSOR_UNCORRECTABLE, + "Processor Uncorrectable Non-Fatal" }, + { "cpu.fatal", ACPI_EINJ_PROCESSOR_FATAL, + "Processor Uncorrectable Fatal" }, + { "mem.cor", ACPI_EINJ_MEMORY_CORRECTABLE, "Memory Correctable" }, + { "mem.uc", ACPI_EINJ_MEMORY_UNCORRECTABLE, + "Memory Uncorrectable Non-Fatal" }, + { "mem.fatal", ACPI_EINJ_MEMORY_FATAL, "Memory Uncorrectable Fatal" }, + { "pcie.cor", ACPI_EINJ_PCIX_CORRECTABLE, "PCI Express Correctable" }, + { "pcie.uc", ACPI_EINJ_PCIX_UNCORRECTABLE, + "PCI Express Uncorrectable Non-Fatal" }, + { "pcie.fatal", ACPI_EINJ_PCIX_FATAL, + "PCI Express Uncorrectable Fatal" }, + { "platform.cor", ACPI_EINJ_PLATFORM_CORRECTABLE, + "Platform Correctable" }, + { "platform.uc", ACPI_EINJ_PLATFORM_UNCORRECTABLE, + "Platform Uncorrectable Non-Fatal" }, + { "platform.fatal", ACPI_EINJ_PLATFORM_FATAL, + "Platform Uncorrectable Fatal" }, + { "cxl.cache.cor", ACPI_EINJ_CXL_CACHE_CORRECTABLE, + "CXL.cache Correctable" }, + { "cxl.cache.uc", ACPI_EINJ_CXL_CACHE_UNCORRECTABLE, + "CXL.cache Uncorrectable Non-Fatal" }, + { "cxl.cache.fatal", ACPI_EINJ_CXL_CACHE_FATAL, + "CXL.cache Uncorrectable Fatal" }, + { "cxl.mem.cor", ACPI_EINJ_CXL_MEM_CORRECTABLE, "CXL.mem Correctable" }, + { "cxl.mem.uc", ACPI_EINJ_CXL_MEM_UNCORRECTABLE, + "CXL.mem Uncorrectable Non-Fatal" }, + { "cxl.mem.fatal", ACPI_EINJ_CXL_MEM_FATAL, + "CXL.mem Uncorrectable Fatal" }, + { "vendor", ACPI_EINJ_VENDOR_DEFINED, "Vendor Defined" }, +}; + +static void +usage(void) +{ + fprintf(stderr, "usage:\n" + "\teinj list\n" + "\teinj inject -a
-C -P \n"); + exit(1); +} + +static void +print_vendor_struct(uint32_t vendor_length) +{ + struct acpi_einj_vendor_info vi; + ACPI_EINJ_VENDOR *vendor; + uint32_t dbsf; + + vi.buf = malloc(vendor_length); + vi.len = vendor_length; + if (ioctl(fd, ACPIIO_EINJ_GET_VENDOR, &vi) == -1) { + warn("ACPIIO_EINJ_GET_VENDOR"); + free(vi.buf); + return; + } + + vendor = vi.buf; + dbsf = vendor->PcieId; + + printf("Vendor Extension:\n"); + printf("\tLength:\t%u\n", vendor->Length); + printf("\tPCIe Id:\t%u:%u:%u:%u\n", dbsf >> 24, + (dbsf >> 16) & 0xff, (dbsf >> 11) & 0x1f, (dbsf >> 8) & 7); + printf("\tVendor Id:\t%04x\n", vendor->VendorId); + printf("\tDevice Id:\t%04x\n", vendor->DeviceId); + printf("\tRevision:\t%02x\n", vendor->RevisionId); + free(vi.buf); +} + +static void +list_error_types(void) +{ + struct acpi_einj_info info; + + if (ioctl(fd, ACPIIO_EINJ_GET_INFO, &info) == -1) + err(1, "ACPIIO_EINJ_GET_INFO"); + + printf("Supported errors <%#x>:\n", info.error_type); + for (u_int i = 0; i < nitems(error_types); i++) { + struct error_type_info *eti = &error_types[i]; + + if ((info.error_type & eti->bit) == 0) + continue; + printf("\t%s (%s)\n", eti->name, eti->description); + } + + if ((info.error_type & ACPI_EINJ_VENDOR_DEFINED) != 0 && + info.vendor_length != 0) { + printf("\n"); + print_vendor_struct(info.vendor_length); + } +} + +static uint32_t +parse_dbsf(const char *arg) +{ + char *cp; + unsigned long val[4]; + u_int i; + + /* + * Permit the same format as pciconf. Eventually this should + * accept PCI device names, too. + */ + if (strncmp(arg, "pci", 3) == 0) + arg += 3; + + /* Read up to 4 colon-separated values. */ + for (i = 0;; i++) { + val[i] = strtoul(arg, &cp, 10); + if (cp == arg || val[i] > 255) + goto error; + if (*cp == ':') { + if (i == nitems(val) - 1) + goto error; + arg = cp + 1; + continue; + } + if (*cp == '\0') { + if (i < 3) + goto error; + break; + } + goto error; + } + + /* If no domain is given, assume a domain of 0. */ + if (i == 3) { + val[3] = val[2]; + val[2] = val[1]; + val[1] = val[0]; + val[0] = 0; + } + + /* + * To handle ARI, only limit function numbers if the slot is + * non-zero. + */ + if (val[2] != 0 && val[3] > PCI_FUNCMAX) + goto error; + + return (val[0] << 24 | val[1] << 16 | val[2] << 3 | val[3]); + +error: + errx(1, "invalid PCIe ID"); +} + +static void +inject_error(int argc, char *argv[]) +{ + struct acpi_einj_error einj; + char *cp; + uintmax_t value; + int ch; + + memset(&einj, 0, sizeof(einj)); + while ((ch = getopt(argc, argv, "a:C:P:")) != -1) { + switch (ch) { + case 'a': + einj.memory_address = strtoumax(optarg, &cp, 0); + if (*cp != '\0') + errx(1, "invalid address"); + einj.address_flags |= ACPI_EINJ_MEMADDRESS_VALID; + break; + case 'C': + value = strtoumax(optarg, &cp, 0); + if (*cp != '\0' || value > UINT32_MAX) + errx(1, "invalid APIC ID"); + einj.apic_id = value; + einj.address_flags |= ACPI_EINJ_APICID_VALID; + break; + case 'P': + einj.pcie_id = parse_dbsf(optarg); + einj.address_flags |= ACPI_EINJ_PCIE_VALID; + break; + default: + usage(); + } + } + argc -= optind; + argv += optind; + + if (argc != 1) + usage(); + + if (strcmp(argv[0], "vendor") == 0) + errx(1, "vendor errors are not supported"); + + for (u_int i = 0; i < nitems(error_types); i++) { + struct error_type_info *eti = &error_types[i]; + + if (strcmp(argv[0], eti->name) == 0) { + einj.error_type = eti->bit; + break; + } + } + if (einj.error_type == 0) + errx(1, "unknown error type"); + + if (ioctl(fd, ACPIIO_EINJ_SET_ERROR, &einj) == -1) + err(1, "ACPIIO_EINJ_SET_ERROR"); +} + +int +main(int argc, char *argv[]) +{ + if (argc < 2) + usage(); + + fd = open("/dev/acpi", O_RDWR); + if (fd == -1) + err(1, "/dev/acpi"); + + if (strcasecmp(argv[1], "list") == 0) + list_error_types(); + else if (strcasecmp(argv[1], "inject") == 0) + inject_error(argc - 1, argv + 1); + else + usage(); + + close(fd); + return (0); +} From nobody Tue Jul 7 21:16:31 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 4gvvDJ0kdHz6kVPw for ; Tue, 07 Jul 2026 21:16:32 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvvDH6ZpMz3rCk for ; Tue, 07 Jul 2026 21:16:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783458991; 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=fFWuyUAYGTYsg7fdKRQgQ7kz6y+5Ce7jdLrYOlaFeEc=; b=sdKjrciHklwzirTM3HK0GmXx0pL1ZYFQBJT3FeXTLGw4JHQnuSlafYBkJF6yWoSPkKVaWZ NkTfok97JT6YkUPrnAOGaJkVg0+A62e19F5Xi+wRcYz59wQOpn0NvrJ6/s5PgaDmz7Ypzz KD2O90RZyXgrdiQbF8dGKz32zL+qt7SYQk3jYikBWJZaMrlZrkvvewk438MjVDSswWOozn KFNQ7hQsGZqKiA/ObDo1FSvk+AuApczbrXJPZ7z6qzW3vGQq1jQdLsrX086PbHxjYx6AHi mVIsIeVG4a+iRrSpz7b9n1dpLOG7wGOJN7PoheLWzdUWI3+iRGm+3o3nFrj1pw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783458991; a=rsa-sha256; cv=none; b=k7iONhWuo2noIrho/UHZaFrTN92coAnACOlufXmoVw0dx9dKQmXgpAU/5V+rzYaTVH1aUc oTnI80ifHjvFKUurCHp1VCPvQwWyH1QWYx37pB6UkCRrStHMZofpYTcKIB/7GlnK27kE8g lK3Ogp34wc5WIyfUe9h5o6mpKkwXx3Nsrux9Wtu5W2mBZLYKjk3w+WdrpweQE8dgRV5DHN SXqULhGGGkoqJNL1TurP+g64Dv2fwznZYI+qw2iUkBCbsiYyUpOaJymCNwcS2YJob6/OHM MlLE9lBPxnEuoOwUnUf55rC+9j2vioVrZ7+Tp8etzMLu28HliHvxktfipV5yZg== 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=1783458991; 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=fFWuyUAYGTYsg7fdKRQgQ7kz6y+5Ce7jdLrYOlaFeEc=; b=Fo+FQBjcMFwHhTXbZaWK211RXJji7Yd4LKDKRY6+MJhe/ddzPSvTr9BwhCFEIUV1Le4uq9 219UpYXxB0E+qG2LtFUOIsOS5FYSyJ4zPijq+Ms1vkMEVnDUwrCA+HVAfvVL8gqcYbZcmo iRCNGaQePmU0FJIEe7wPNyvI/vh8hwdolSupD6uuR7MWocD5iOqg1vGLOsHrG07n81UKJS tPCQ2fv6KY8BCmXt0sRnVP/tsFzm5wBJ95H98ahkalkL4chmz6JZF/Wze0Coj5MvylLYNF 48TLHmvJ6e5ATw4Mcs03dSZUkw2zkCAL8nauFXaUiKBne5F6S3tBZggd59Le4A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvvDH5fqLzs9Z for ; Tue, 07 Jul 2026 21:16:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 19cbc by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 21:16:31 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 6cfc526e7f91 - main - acpi: fix instant panic in hest_attach() 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6cfc526e7f91534db46a3cff3c2dd2744310e24f Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 21:16:31 +0000 Message-Id: <6a4d6caf.19cbc.5a9dbebe@gitrepo.freebsd.org> The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=6cfc526e7f91534db46a3cff3c2dd2744310e24f commit 6cfc526e7f91534db46a3cff3c2dd2744310e24f Author: Gleb Smirnoff AuthorDate: 2026-07-07 21:14:43 +0000 Commit: Gleb Smirnoff CommitDate: 2026-07-07 21:14:43 +0000 acpi: fix instant panic in hest_attach() Since now there is a pseudo-bus between our device and acpi0, we need to go deeper. Fixes: 9313f6b01485ad9a0b7cc59b459f5714533587c3 --- sys/dev/acpica/acpi_apei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/acpica/acpi_apei.c b/sys/dev/acpica/acpi_apei.c index 09073207c06e..9e5a691c8655 100644 --- a/sys/dev/acpica/acpi_apei.c +++ b/sys/dev/acpica/acpi_apei.c @@ -615,7 +615,7 @@ hest_attach(device_t dev) if (!apei_sysctl_tree) { /* Install hw.acpi.apei sysctl tree */ - acpi_sc = acpi_device_get_parent_softc(dev); + acpi_sc = acpi_device_get_parent_softc(device_get_parent(dev)); apei_sysctl_tree = SYSCTL_ADD_NODE(&apei_sysctl_ctx, SYSCTL_CHILDREN(acpi_sc->acpi_sysctl_tree), OID_AUTO, "apei", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, From nobody Tue Jul 7 21:19:52 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 4gvvJ84Z9pz6kVWY for ; Tue, 07 Jul 2026 21:19:52 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvvJ842rcz3rlD for ; Tue, 07 Jul 2026 21:19:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783459192; 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=pg2uH0WSHWHQDdTzOhjzIDI21PgR0ZY2LpSWHmx4Y8w=; b=tuD698EPQY95+F4nIe4GgEDQ7Iu2Tf1iRC+AltUH6TAd9jDxuixvwEWz7udC0yPod2asuS +ref0y5ZiApi64djE4vxZttc/fXa0nv1tgA3L0DvTxHmNMf0fra56QMzJccmUzNsFgrvZ3 4JhUYzYPRqcSAGK0uvj8JcSr4XNVcobO4/EhqhWpihY3ot3bJ17V/TfNVMSqfjGr8umddw l0mVjYZslo5dO+Tw9u1jax5N+6hHQ9mWzHpl39cBSrA1rr70o7/fGGWX+GAg8nTHXBrERR AYPDHejoBtPc+/IwEs6JuhFcWd9eeMrJZlTayfU63dFxLtjwdFeyWhp5bvwhgg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783459192; a=rsa-sha256; cv=none; b=gcDyNSxZy8SZb0oaiDIVu32OHyhWiszuiiw+Tf+N0xwXoRIs9Jn7qJbBClRTjAwXvbFuKh 0lvMwFNsZ7C+BKz7ans57BKv3itkOeydtwvnjUjBLiq1rj1Mp3rIyeKuo0MU4K0GV3FiIu 2tLstMqDRWlviXDRXQyEUVAv6KS7oiaE3SZxMUAmrUpVsCUepPnLnHy+SzPgjKPgk4mXUs LvvDwnoSqzw6O8UjAr6WNjW/CENBypOdQeH5Hrox6TNbHod/CPu/xqsj0z7Q+PnPeJ98Xw m1TZbZWNSPcCxv0yBRDlv/9RcRqFupcnVSb1EWpp0BH4Ip+N+5mwX4wKxqbGkA== 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=1783459192; 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=pg2uH0WSHWHQDdTzOhjzIDI21PgR0ZY2LpSWHmx4Y8w=; b=SZ/T/U1LQx6V06yyxs3LBFRPlKuH27znTUFHRP+ROX0yEYSQS1zPXY4DVZ8GuRRdSJ771A J/45MagyReOiXO4UIyghkCA6rBZbMy23nMFFqBgDhG2QnH0rrItIN8wMv49/Wp02n/msMI o+J3F/YDwp2OEWFlQ9t7dMB4qFUtLx3PjUR/t545It+YrYo6J4ONtHW3NLGTedG+52wkj2 x0ZHeqOTwtQQFfw+ZUL4eD9ZwlTvAIgf5O5InG0Z/fEe3Hw6lvGCAWjkFP3ZGdgOV0FqWf FAk6Eb69dgkUZvLDc4Xi9Bvdy4nnjd5H61lpP1nxqrELlr6UM420uuJNnVwarA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvvJ837TdzrwJ for ; Tue, 07 Jul 2026 21:19:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 19a4f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 21:19:52 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 11bd6ade5dfd - main - linux: switch off interface name translation and schedule its removal 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 11bd6ade5dfdfb5160dd001542c4cfd44aed98bc Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 21:19:52 +0000 Message-Id: <6a4d6d78.19a4f.2a815a0f@gitrepo.freebsd.org> The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=11bd6ade5dfdfb5160dd001542c4cfd44aed98bc commit 11bd6ade5dfdfb5160dd001542c4cfd44aed98bc Author: Gleb Smirnoff AuthorDate: 2026-07-07 21:19:17 +0000 Commit: Gleb Smirnoff CommitDate: 2026-07-07 21:19:17 +0000 linux: switch off interface name translation and schedule its removal Modern Linuxes don't use ethX for almost 15 years already, see [1] and [2]. The translation logic has always been a source of bugs and PITA. Switch default to not translate (long due!) and schedule removal of the code for FreeBSD 17. [1] https://systemd.io/PREDICTABLE_INTERFACE_NAMES/ [2] https://www.freedesktop.org/software/systemd/man/latest/systemd.net-naming-scheme.html Reviewed by: iwtcex_gmail.com, vvd, melifaro, dchagin Differential Revision: https://reviews.freebsd.org/D57852 --- sys/compat/linux/linux_if.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/sys/compat/linux/linux_if.c b/sys/compat/linux/linux_if.c index ca4e3a4079ed..51a76aa13be3 100644 --- a/sys/compat/linux/linux_if.c +++ b/sys/compat/linux/linux_if.c @@ -44,9 +44,24 @@ _Static_assert(LINUX_IFNAMSIZ == IFNAMSIZ, "Linux IFNAMSIZ"); -static bool use_real_ifnames = false; -SYSCTL_BOOL(_compat_linux, OID_AUTO, use_real_ifnames, CTLFLAG_RWTUN, - &use_real_ifnames, 0, +static bool use_real_ifnames = true; +static int +sysctl_linux_use_real_ifnames(SYSCTL_HANDLER_ARGS) +{ + int error; + + error = sysctl_handle_bool(oidp, &use_real_ifnames, arg2, req); + if (error != 0 || req->newptr == NULL) + return (error); + if (!use_real_ifnames) + gone_in(17, "linux(4): %s: conversion of native interface " + "names to ethN is not needed to emulate modern Linux. " + "See https://systemd.io/PREDICTABLE_INTERFACE_NAMES. ", + oidp->oid_name); + return (0); +} +SYSCTL_PROC(_compat_linux, OID_AUTO, use_real_ifnames, + CTLTYPE_U8 | CTLFLAG_RWTUN, 0, 0, sysctl_linux_use_real_ifnames, "CU", "Use FreeBSD interface names instead of generating ethN aliases"); VNET_DEFINE_STATIC(struct unrhdr *, linux_eth_unr); From nobody Tue Jul 7 21:47:35 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 4gvvw74719z6kX8W for ; Tue, 07 Jul 2026 21:47:35 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvvw73NrBz3tm7 for ; Tue, 07 Jul 2026 21:47:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783460855; 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=1Pplht9gj3jiP78iWLLfoDZsouRTxL3ulcmzlITEoO8=; b=ut1QCszC6tbC3XrYguFZbiHLBuciG+0Uw/vyB7yPmvpGR8kyb/D+GV0OUpaynIllJQbfVV tT1atL9BWDMXV9znEU2pAnshZKK+efIepC5qQnt4F2bL426VE6amofMRzGicloIUvnNN4b 654XTBH6ZXopaQI6gNcB4fSIbuCtME0c1/cUcY1khPSo7fQpYYuNJdaIo4I+z/sh9NYvrh 3eQkxHcftYVjFQB2f5wubstfoPhg+W1h6N39PbG9K8l0bxwGb5j2XI3lKmG2rvGQyCWVOO ZyHAVN9BRALVwxDwzND77DdlUuBq1Hc6Ne7iFMWl7D0Rdsf9faq+x0aTDdKsIw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783460855; a=rsa-sha256; cv=none; b=xQo872leelvrW1TD3tBcCemmi1ZMhGLzwwvdzFHs513/cYw+DMX2vUW80M1sV8zGDlaMxd xcJ/Kz/r0r+Tuqpt5Q0/v8IpPDIuO1YQsOazFuT+mUQM6QQr8jitt8d/OOa8ovdY0Y59mR iKT/9AFvkGL4dRKUHlP5BUoGjwbepgaigG2op0XKRtCPBl7tsk7Q+T0aqd7RrEF++Ud+70 /0QcJT819iUM0OWpTxE660GZwrSNCB5/fPGQJovsz1yoVqreJhQ78M6vZP/o4q4ohK7ee+ USa1q9Ji3QJGFji+7BSKXl0AaTvQP7IwG5Ol0WtVQqxXbCaGNqYITRleFczzRw== 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=1783460855; 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=1Pplht9gj3jiP78iWLLfoDZsouRTxL3ulcmzlITEoO8=; b=I8Q3V0FWeC4yvmwm3BvrwMH0Pfkv4+HsrUUHM20sFWGRAIuRPPVojJv5+n9y9yqSPO1kvf 3P1tjaCluZfgtgGEWwWm7thWEZ4UBqViPmP+dqdicyD/X5Bmfbo3AB9U6I3H/Bo12r2tSk bmSKo6+w0McRyCWGiJxFIKYx4pVlC8CoFetbfwELH9+MfmKGT8xXJgbZ0Uodq60jJeL2DY uWMhQJfoBBkX6+qcaM+yXgkcptpNbgrgEaduQnRJJoZOjyfXf+mCiGQzd42kEpA3ZLfAfS 9R417utKzMbS9FQbQsVarig7WrlCqjAogeEcm4TeLGZhbvfIKARxyxpyJj532Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvvw72B2jzsnQ for ; Tue, 07 Jul 2026 21:47:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1e7dd by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 21:47:35 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: dfad790c8cca - main - sendfile: stop abusing kern_writev() 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dfad790c8ccad05ff603ceaa5b2efe4205b38e1c Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 21:47:35 +0000 Message-Id: <6a4d73f7.1e7dd.1cbcbd60@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=dfad790c8ccad05ff603ceaa5b2efe4205b38e1c commit dfad790c8ccad05ff603ceaa5b2efe4205b38e1c Author: Konstantin Belousov AuthorDate: 2026-07-04 02:29:56 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 21:47:18 +0000 sendfile: stop abusing kern_writev() Provide convenient wrapper kern_filewrite() around fo_write(). Switch to use it in vn_sendfile(). This allows to avoid duplicate fget() when we already have the reference to the file, which creates a correctness race with the userspace. Also td_retval[0] clearing hack can be removed. Reviewed by: glebius, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D58035 --- sys/kern/kern_sendfile.c | 25 +++++++++++++------------ sys/kern/sys_generic.c | 41 ++++++++++++++++++++++++++++++----------- sys/sys/syscallsubr.h | 2 ++ 3 files changed, 45 insertions(+), 23 deletions(-) diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c index cf9716560c07..1a534210ca0c 100644 --- a/sys/kern/kern_sendfile.c +++ b/sys/kern/kern_sendfile.c @@ -1168,14 +1168,17 @@ prepend_header: } /* - * Send trailers. Wimp out and use writev(2). + * Send trailers. */ if (trl_uio != NULL) { + ssize_t cnt; + SOCK_IO_SEND_UNLOCK(so); CURVNET_RESTORE(); - error = kern_writev(td, sockfd, trl_uio); + error = kern_filewrite(td, sockfd, sock_fp, trl_uio, + (off_t)-1, 0, &cnt); if (error == 0) - sbytes += td->td_retval[0]; + sbytes += cnt; goto out; } @@ -1183,15 +1186,8 @@ done: SOCK_IO_SEND_UNLOCK(so); CURVNET_RESTORE(); out: - /* - * If there was no error we have to clear td->td_retval[0] - * because it may have been set by writev. - */ - if (error == 0) { - td->td_retval[0] = 0; - if (sbytes > 0 && vp != NULL) - INOTIFY(vp, IN_ACCESS); - } + if (error == 0 && sbytes > 0 && vp != NULL) + INOTIFY(vp, IN_ACCESS); if (sent != NULL) { (*sent) = sbytes; } @@ -1260,6 +1256,11 @@ sendfile(struct thread *td, struct sendfile_args *uap, int compat) &trl_uio); if (error != 0) goto out; + if (trl_uio->uio_rw != UIO_WRITE) { + error = EINVAL; + goto out; + } + trl_uio->uio_td = td; } } diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index b84f675d1dcb..07b98613e087 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -549,21 +549,16 @@ dofilewrite(struct thread *td, int fd, struct file *fp, struct uio *auio, { ssize_t cnt; int error; -#ifdef KTRACE - struct uio *ktruio = NULL; -#endif AUDIT_ARG_FD(fd); + auio->uio_rw = UIO_WRITE; auio->uio_td = td; auio->uio_offset = offset; -#ifdef KTRACE - if (KTRPOINT(td, KTR_GENIO)) - ktruio = cloneuio(auio); -#endif - cnt = auio->uio_resid; - error = fo_write(fp, auio, td->td_ucred, flags, td); + error = kern_filewrite(td, fd, fp, auio, offset, flags, &cnt); + /* + * Handle short writes and generate SIGPIPE if needed. * Socket layer is responsible for special error handling, * see sousrsend(). */ @@ -577,15 +572,39 @@ dofilewrite(struct thread *td, int fd, struct file *fp, struct uio *auio, PROC_UNLOCK(td->td_proc); } } - cnt -= auio->uio_resid; + + if (error == 0) + td->td_retval[0] = cnt; + return (error); +} + +/* + * Write io request specified by auio into the file fp. If fd != -1, + * might generate the ktrace io point. + */ +int +kern_filewrite(struct thread *td, int fd, struct file *fp, struct uio *auio, + off_t offset, int flags, ssize_t *cntp) +{ + ssize_t cnt; + int error; +#ifdef KTRACE + struct uio *ktruio; + + ktruio = fd != -1 && KTRPOINT(td, KTR_GENIO) ? cloneuio(auio) : NULL; +#endif + cnt = auio->uio_resid; + error = fo_write(fp, auio, td->td_ucred, flags, td); #ifdef KTRACE if (ktruio != NULL) { + cnt -= auio->uio_resid; if (error == 0) ktruio->uio_resid = cnt; ktrgenio(fd, UIO_WRITE, ktruio, error); } #endif - td->td_retval[0] = cnt; + + *cntp = cnt; return (error); } diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h index c6bfe89dcf35..131a8925a2d4 100644 --- a/sys/sys/syscallsubr.h +++ b/sys/sys/syscallsubr.h @@ -176,6 +176,8 @@ int kern_fcntl_freebsd(struct thread *td, int fd, int cmd, intptr_t arg); int kern_fhopen(struct thread *td, const struct fhandle *u_fhp, int flags); int kern_fhstat(struct thread *td, fhandle_t fh, struct stat *buf); int kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf); +int kern_filewrite(struct thread *td, int fd, struct file *fp, + struct uio *auio, off_t offset, int flags, ssize_t *cntp); int kern_fpathconf(struct thread *td, int fd, int name, long *valuep); int kern_freebsd11_getfsstat(struct thread *td, struct freebsd11_statfs *ubuf, long bufsize, int mode); From nobody Tue Jul 7 23:28:19 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 4gvy8N24DHz6kCG4 for ; Tue, 07 Jul 2026 23:28:20 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvy8N03gTz3FKp for ; Tue, 07 Jul 2026 23:28:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783466900; 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=1Rf6KZPF5EwL2W1yWt53nKNKjJIQvhj0k0rieS3yoG8=; b=ZMi9yYP2L3anjbyX35O/FT4Pg/1iZiBjwMPQNxLFcBHm+RPQj0k5oeJNz0BINS7mcVMFeS RFS1NX5S66D+VghY9eSO0J/cnUD4zoFJTvZRjSGEhHeImTP8bBVlzDj8fPECemyl3kfeaL tsdzNUuVvDt7D2uj9GXTfqkQFOH+TnwEQ5PM2Av9eGBWbSQYbb8gHPC9WJPntBQ9cs4013 AeA3NjXl2vJQ1ohJUq363KClU5vx3tXFvYLsJ9nqJeP396ydlKB9JjqOmU8J6bwbrmHvL3 KKrNeROYLCL6t95hRXQ9zSyMFZSLou3EEncY1/p+RwOYpsLXN78U8KPPrMpdUg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783466900; a=rsa-sha256; cv=none; b=tgMqOOyvQBqY7QmHhSCeUUdV8CP4/lxVWOUqkbXHdBNTnwes3vmDp7vu2/oZ4qpf4pc/AG ZybyKqVjOt5NlOh6o7aIt/D2A+LlHni3jXBe5xmsN788Chac9YpZnZnLSENE1ka3JWzlkM E70ne8QXqlxWokWE25AO5LbYHE1IezZ+Aq+oz+tw8ZLdxQA/tLfbcQqUXfr/R+UpynX22W BVTa8Daf5xwOfsTP38zwKgo9rjzpmlI1W91hKcdUewYLAweQBRx4JOmbrLARSqHlmGyMSv g35be3392yDRSQeC1KueVeawbglJY6uHKuaIxEdgtj4mZ/YUMyHbBqlAd9MvSg== 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=1783466900; 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=1Rf6KZPF5EwL2W1yWt53nKNKjJIQvhj0k0rieS3yoG8=; b=Cyr85gLGa2RrCJw3Z2qutt0E7YwGYit/UxstCZ4rmkrJnjHBtCRQYCv3t5Rhex1hQdcYeZ JWwJTV0+DYsmtR1nIC8dpS8aud4aCFLd/f2dSq3V4j5yvW8Zy1SXsHnp5dHfbLGHsVjgbP 5cNWyq8r9jV7XK9h0uBW0tCA1Z1ylF5z/Ck/Os/gKfpB8/oZMGU3bvMyRtWTOerqy8lUA9 Qi6hIFVyPyPIRjEMYezNcr+j2AiOvSzg95qCbnODGZ9w+3MZa42OX7gVUtiQ41rkzWYcKA tvH90yXe4x8QcTAtY8gvGA+j7PmLShoH4kiBoPZzigtflQpfzTROJJcvgd518A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvy8M69gbzwWR for ; Tue, 07 Jul 2026 23:28:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 307d2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 23:28:19 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 77b6adbe5e35 - main - fget_remote(): return fcaps and fde_flags if requested 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 77b6adbe5e351d1907e14d21c49291ff40ba879a Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 23:28:19 +0000 Message-Id: <6a4d8b93.307d2.42d5f42@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=77b6adbe5e351d1907e14d21c49291ff40ba879a commit 77b6adbe5e351d1907e14d21c49291ff40ba879a Author: Konstantin Belousov AuthorDate: 2026-05-23 07:03:17 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 21:54:35 +0000 fget_remote(): return fcaps and fde_flags if requested Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57163 --- sys/kern/kern_descrip.c | 19 ++++++++++++++++--- sys/kern/kern_event.c | 2 +- sys/kern/sys_generic.c | 4 ++-- sys/sys/file.h | 3 ++- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 349ebb5702a5..351cc1917b04 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -3156,13 +3156,20 @@ fget_cap(struct thread *td, int fd, const cap_rights_t *needrightsp, #endif int -fget_remote(struct thread *td, struct proc *p, int fd, struct file **fpp) +fget_remote(struct thread *td, struct proc *p, int fd, struct filecaps *fcaps, + uint8_t *fd_flags, struct file **fpp) { struct filedesc *fdp; struct file *fp; int error; - if (p == td->td_proc) /* curproc */ + /* + * Both fcaps and fd_flags must be either requested together, + * or not at all. + */ + MPASS((!(fcaps == NULL) ^ (fd_flags == NULL))); + + if (p == td->td_proc && fcaps == NULL) /* curproc */ return (fget_unlocked(td, fd, &cap_no_rights, fpp)); PROC_LOCK(p); @@ -3175,6 +3182,12 @@ fget_remote(struct thread *td, struct proc *p, int fd, struct file **fpp) fp = fget_noref(fdp, fd); if (fp != NULL && fhold(fp)) { *fpp = fp; + if (fd_flags != NULL) { + *fd_flags = fde_to_fd_flags(fdp->fd_ofiles[fd]. + fde_flags); + } + if (fcaps != NULL) + *fcaps = fdp->fd_ofiles[fd].fde_caps; error = 0; } else { error = EBADF; @@ -3215,7 +3228,7 @@ fget_remote_foreach(struct thread *td, struct proc *p, } for (fd = 0; fd <= highfd; fd++) { - error1 = fget_remote(td, p, fd, &fp); + error1 = fget_remote(td, p, fd, NULL, NULL, &fp); if (error1 != 0) continue; error = fn(p, fd, fp, arg); diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 01bd22fbefd1..fa7f8bf7cdb7 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -3355,7 +3355,7 @@ sysctl_kern_proc_kqueue_one(struct thread *td, struct sbuf *s, struct proc *p, struct kqueue *kq; int error; - error = fget_remote(td, p, kq_fd, &fp); + error = fget_remote(td, p, kq_fd, NULL, NULL, &fp); if (error == 0) { if (fp->f_type != DTYPE_KQUEUE) { error = EINVAL; diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 07b98613e087..079bd7b347d7 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -2204,9 +2204,9 @@ kern_kcmp(struct thread *td, pid_t pid1, pid_t pid2, int type, switch (type) { case KCMP_FILE: case KCMP_FILEOBJ: - error = fget_remote(td, p1, idx1, &fp1); + error = fget_remote(td, p1, idx1, NULL, NULL, &fp1); if (error == 0) { - error = fget_remote(td, p2, idx2, &fp2); + error = fget_remote(td, p2, idx2, NULL, NULL, &fp2); if (error == 0) { if (type == KCMP_FILEOBJ) res = fo_cmp(fp1, fp2, td); diff --git a/sys/sys/file.h b/sys/sys/file.h index a5125d0559b1..abe211aaa39a 100644 --- a/sys/sys/file.h +++ b/sys/sys/file.h @@ -283,7 +283,8 @@ int fget_write(struct thread *td, int fd, const cap_rights_t *rightsp, int fget_fcntl(struct thread *td, int fd, const cap_rights_t *rightsp, int needfcntl, struct file **fpp); int _fdrop(struct file *fp, struct thread *td); -int fget_remote(struct thread *td, struct proc *p, int fd, struct file **fpp); +int fget_remote(struct thread *td, struct proc *p, int fd, + struct filecaps *fcaps, uint8_t *fd_flags, struct file **fpp); int fget_remote_foreach(struct thread *td, struct proc *p, int (*fn)(struct proc *, int, struct file *, void *), void *arg); From nobody Tue Jul 7 23:28:20 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 4gvy8P3bBhz6kC8Z for ; Tue, 07 Jul 2026 23:28:21 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvy8P10NLz3F20 for ; Tue, 07 Jul 2026 23:28:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783466901; 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=ol0kfz2366k0DCt8uJBusARjtQC3ZnGoEta3N1PwpQE=; b=RTiJF6iqpwtUJ9uqFY/p1gufxdbHwd74fMRqaM5aouOTdgpdqs93Vsz97DU7xWXmG9tisu 0tY+AqGYh4kD+OJNPKFtHnzQuyNqRMi8PvSjKGjfs87PYGQk477h816IblueqjzdIHYd4l /lpDplc6MKGVIE6wkmi2FmUWjycN6S4FaHYAOn271cgzBfIDQLoNPnmeHNi2v9mURH1zDM Wk9jbHjIBjeu9YLPu7tsaycM1XoUlgI7WwsIuLoKZl8U4dbf9Zy+kyhs0ggro4SKspVxbc jFy3XFVSVRgFpPF782DrRjICsYuVOSOgL9zfR5/b0vSu1mq7GAEUDLzXkxPy6g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783466901; a=rsa-sha256; cv=none; b=cEmjPnP8d/NPySXYqA+M+YnTEVm3DQS0/E5ji9IZoVzt2tGHOKIK93MTqnxG1KPZrGH+I2 qkkvWnWfCEXWNyYs+eAfIOSsYR12MFKLTvbmacTak4MXc9nBDhT5T5fFnSFJN471c38UTq o1nGWKglXK7vqi7mYi7AzXUNDCzgYFLYAbSNXhlMpkrJTRqb/9gB2Upr1Fk2Smee7BsPy9 T4FnDkxgf+Ag7FkOxt/4o3afEuBbpHVcU2lvYhxzOlKAnX4LfdGaYue34HbWJJU2JCxWE7 UlDuTXRfqDiE9tbeEaHMRz9b//pq+e0Go2jMksQk3ikbMBwPS+c37oVkxHhKYw== 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=1783466901; 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=ol0kfz2366k0DCt8uJBusARjtQC3ZnGoEta3N1PwpQE=; b=NDrA/dHdSgRjVe65E6cTzaD1n+TNkeSFGanDJfYV90hrL55uerKdpFMRontiloDwQSNGI/ qzAA+7XRZK/pq1wdhQQOSCjS0EaYDUpnLj7vTfoT4UPFf2zDiF7zuW8o8sMxf82ksE+JGq Zk7mVQ/+AFAePAmFLDqWHbi8Ll9BOI/0EkOQKAXZEqrcafDc0WuQXXOx+crgwSAane64KU 18NkLsuNSoE0QRkZL/jw+MPqijurSlbEyZsmpDTBxTFBhW1Ld2MmMPUS3mPAsJfPBq0jgx 6N4ceKtsLXAp8ZmzsxdbekHnV1WE1CD2IQu/Ieh/vue/Rl+mhCQfHbesA7Z1Hg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvy8N6WhWzwFm for ; Tue, 07 Jul 2026 23:28:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 31b67 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 23:28:20 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 193fd496995d - main - sys/capsicum.h: fix comment for CAP_PDWAIT 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 193fd496995d7d22d65c424716e8308fa769aa0a Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 23:28:20 +0000 Message-Id: <6a4d8b94.31b67.4dade18e@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=193fd496995d7d22d65c424716e8308fa769aa0a commit 193fd496995d7d22d65c424716e8308fa769aa0a Author: Konstantin Belousov AuthorDate: 2026-05-21 19:11:02 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 21:54:41 +0000 sys/capsicum.h: fix comment for CAP_PDWAIT Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57163 --- sys/sys/capsicum.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/sys/sys/capsicum.h b/sys/sys/capsicum.h index 9ef2f0d48d38..803804a38734 100644 --- a/sys/sys/capsicum.h +++ b/sys/sys/capsicum.h @@ -262,12 +262,7 @@ /* Process management via process descriptors. */ /* Allows for pdgetpid(2). */ #define CAP_PDGETPID CAPRIGHT(1, 0x0000000000000200ULL) -/* - * Allows for pdwait4(2). - * - * XXX: this constant was imported unused, but is targeted to be implemented - * in the future (bug 235871). - */ +/* Allows for pdwait(2). */ #define CAP_PDWAIT CAPRIGHT(1, 0x0000000000000400ULL) /* Allows for pdkill(2). */ #define CAP_PDKILL CAPRIGHT(1, 0x0000000000000800ULL) From nobody Tue Jul 7 23:28:22 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 4gvy8Q3pNMz6kCKm for ; Tue, 07 Jul 2026 23:28:22 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvy8Q1RNVz3FWM for ; Tue, 07 Jul 2026 23:28:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783466902; 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=aW+Bh7GEnGaRQ8iKhbppKKigJaK7oVMu1K3slNk3BvQ=; b=e+XTQluOnD4ESwET9UzJmxpnMMvsk87mMFZzdfsXV1hcokKzm9Sl9yCyc1N8+faOFqr1/2 mJhfyD8J6aJ5riBdnRDy1p/Yi/gC66EjtlTu/+ZneO7KkVQ8mG4GRNlagPp3VNH7IYkP5+ el7YbrEYw9X/amWnqP6s05Yf3df6kVewgBwhxp8AXGKF1jN62PRUGb6xXfsq9iu2nDmOzC 8WAjUNVptvZ3caX5vxH7G2/6ENFrjrVT8bXJwV1KVpiL/xekmtx7rGwlyBpOkWEjfxWazs alptAS91tlU1lwT8CLymBCttaXwODNe7AB/nzlg9ym3NJpk6TSsni95/WhSWNQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783466902; a=rsa-sha256; cv=none; b=DMQrONt/0/hNwAAeYigPwKgDV/RVipTvxBrO+GBEwfmz/xoDPPfZ/qoEwYMSjP1N5JJWuq MK4+ec1jdCa/Q2yDloqv5EM6YqmJLf0QUh7D0FnSC4hTlRavikRWW3byUAD2YiaID9wTMY JUwwWX5zG6FsKpLvtnZNlpzObzYNphe16/JfPXmj2IfSK5wZD19CsoyucYTjYcMbGhmj2P udy1P4AdtH7f30AD4sqfTm+yZ06+mQ6k7/zSnX+PeKdhQOcB88+n8cocPtpsuPnWFortc6 7a0euagxgZb4zlBacrQBgRJOdkLL3JqWtGk0IHm4v22caeW9xhifW8xDQWr7Tw== 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=1783466902; 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=aW+Bh7GEnGaRQ8iKhbppKKigJaK7oVMu1K3slNk3BvQ=; b=XUw4vB/uubamnZW2sAmw2Oi/dvkRr+pkWxTHjVjk/9M6x8oGh7XnwigSzz6WwyXetTSS4U LB/0aFscXmFoZFxwAhV/sqMmbVSPjVoooz1THcXH8NMXUcYMBpfXJHm24p7FLUk7CpfZCb 7RXt1hyAAafI22b3eCcB728PcTRK+rfXCRiU/i07buvFeL5NFNimUR3knxDKopyxRC/u1R 7IdBA147yL1V/eeQ7RNMHZmMzl+/CNScHTO+dwmRYKj8ReBPtdK6MMmJ5TtPX1d94oE3HW wN46sTMZlZZOkfrkr/OMTU/gwiCCvLJnbbtI3rm4N+KBerJe81l/fDJ6+9aoEw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvy8Q0CXJzwL1 for ; Tue, 07 Jul 2026 23:28:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 30bda by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 23:28:22 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 046a4efe78ad - main - Add CAP_PDDUPFD capability 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 046a4efe78addafcd4810974d6c71c1cdd591b6b Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 23:28:22 +0000 Message-Id: <6a4d8b96.30bda.5c25c825@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=046a4efe78addafcd4810974d6c71c1cdd591b6b commit 046a4efe78addafcd4810974d6c71c1cdd591b6b Author: Konstantin Belousov AuthorDate: 2026-05-21 19:12:22 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 22:03:52 +0000 Add CAP_PDDUPFD capability Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57163 --- sys/kern/subr_capability.c | 1 + sys/sys/caprights.h | 1 + sys/sys/capsicum.h | 6 ++++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_capability.c b/sys/kern/subr_capability.c index 6e23525186ea..55d6225fd67a 100644 --- a/sys/kern/subr_capability.c +++ b/sys/kern/subr_capability.c @@ -88,6 +88,7 @@ const cap_rights_t cap_mmap_rights = CAP_RIGHTS_INITIALIZER(CAP_MMAP); const cap_rights_t cap_mkdirat_rights = CAP_RIGHTS_INITIALIZER(CAP_MKDIRAT); const cap_rights_t cap_mkfifoat_rights = CAP_RIGHTS_INITIALIZER(CAP_MKFIFOAT); const cap_rights_t cap_mknodat_rights = CAP_RIGHTS_INITIALIZER(CAP_MKNODAT); +const cap_rights_t cap_pddupfd_rights = CAP_RIGHTS_INITIALIZER(CAP_PDDUPFD); const cap_rights_t cap_pdgetpid_rights = CAP_RIGHTS_INITIALIZER(CAP_PDGETPID); const cap_rights_t cap_pdkill_rights = CAP_RIGHTS_INITIALIZER(CAP_PDKILL); const cap_rights_t cap_pdwait_rights = CAP_RIGHTS_INITIALIZER(CAP_PDWAIT); diff --git a/sys/sys/caprights.h b/sys/sys/caprights.h index 904d9b4e843a..296fac3b6231 100644 --- a/sys/sys/caprights.h +++ b/sys/sys/caprights.h @@ -90,6 +90,7 @@ extern const cap_rights_t cap_mkfifoat_rights; extern const cap_rights_t cap_mknodat_rights; extern const cap_rights_t cap_mmap_rights; extern const cap_rights_t cap_no_rights; +extern const cap_rights_t cap_pddupfd_rights; extern const cap_rights_t cap_pdgetpid_rights; extern const cap_rights_t cap_pdkill_rights; extern const cap_rights_t cap_pdwait_rights; diff --git a/sys/sys/capsicum.h b/sys/sys/capsicum.h index 803804a38734..aa3f2f1bccdf 100644 --- a/sys/sys/capsicum.h +++ b/sys/sys/capsicum.h @@ -296,7 +296,9 @@ #define CAP_INOTIFY_ADD CAPRIGHT(1, 0x0000000000200000ULL) #define CAP_INOTIFY_RM CAPRIGHT(1, 0x0000000000400000ULL) -#define CAP_UNUSED1_24 CAPRIGHT(1, 0x0000000000800000ULL) +/* Allows pddupfd(2). */ +#define CAP_PDDUPFD CAPRIGHT(1, 0x0000000000800000ULL) + #define CAP_UNUSED1_25 CAPRIGHT(1, 0x0000000001000000ULL) #define CAP_UNUSED1_26 CAPRIGHT(1, 0x0000000002000000ULL) #define CAP_UNUSED1_27 CAPRIGHT(1, 0x0000000004000000ULL) @@ -332,7 +334,7 @@ #define CAP_UNUSED1_57 CAPRIGHT(1, 0x0100000000000000ULL) /* All used bits for index 1. */ -#define CAP_ALL1 CAPRIGHT(1, 0x00000000007FFFFFULL) +#define CAP_ALL1 CAPRIGHT(1, 0x0000000000FFFFFFULL) /* Backward compatibility. */ #define CAP_POLL_EVENT CAP_EVENT From nobody Tue Jul 7 23:28:23 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 4gvy8R3qrhz6kCJ5 for ; Tue, 07 Jul 2026 23:28:23 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvy8R1yjlz3FT8 for ; Tue, 07 Jul 2026 23:28:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783466903; 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=M9c5AGN5X2337z1oC+QCxx6hC5yVKo2r6tnhYjvtriY=; b=lq1YyMijjXhO5fmOU5uSRsQbVE73GrLzXyL684iJl5cR8QS3f0VdJQAX9yKX1Zua+27qW4 RNA+XM7lG8aJkyPBfh2TpyFZKpoN9+WyleUrT2ciCwxti0Tq+510JMLJcOdj92zci83OLu MjYqyMXPldvkxoZl3ZghoadbIeIxCjid+NMRl22cc4E+0DvjruJY0ALw/aslkYnxh1Mh48 TdodLSgPMqzJJ3ZZzrRbgoYZqYZPNwn66ZFhHoAaArBvWInPV/uDHNNkivYGXBBywpGx9H ZrqQjNsRBVCLQaYrwM3pP1S/Lsv6Q31qfCJ6jmtblZqv+1ZgZF2W3fYmY9FQvw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783466903; a=rsa-sha256; cv=none; b=N6KuRBTmi55CBEIJRUuQUohSXcyl+HlMKEl1odYIXaxXMSkjtjb8mGbHwfrVXBscRzdKrm BvKE04cZCRP00z2Fv535ADz9UxSeGnAsb/JDvLRBBltIz4xLhZrqPrxSj5x1mIcy8T+uGK VabPUZoTxW4Nyt9/fUNd/Mkaqgc4der0o30tDuqm7Df6BhWw92QJMk8GNTBR3cvKxPM3uW jXQh0elUb2nDR9PLoJYt9ZfTrM5NdPLmgBAjdCa2T9zlxDp22Gh4I0YfmxjYAbPVEUtHZ1 PktanOgcSAKxtVJFm4p+ORJ8tsDF2zcka0ySEbUDd9yb9++OLCSWVXRnvtQIbQ== 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=1783466903; 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=M9c5AGN5X2337z1oC+QCxx6hC5yVKo2r6tnhYjvtriY=; b=UVD3g/+e7lfAUroCZaTG802t8BnlGVZM7r60u+3azYiihdXnAF8Gr2VG87lVpPnlP7EtZr W6+bILizV/52JztOOCBYiQ7xC1cbZxgPkcEFTxpJFwrTG53e2tl9z9xtTG1xK9ND2JPC8s F3oikobwWst2Wlt+FB04ExaQumnMzZSVuc0H00tX5ATb/AocJbUsloUVVNkRIYgKsMgwiS T8htV2U9eU7QIU0C4FFQr7pvSLSwUkWcyCVchnmdb40gJGcD2Ovv31f26srgZMPNLyuOMx GV6AEII0nbRSuw3wPeuLwXvSUgHopZ0neRrzv5BU2RpdIoj6iIYLyn81wF5JRQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvy8R104pzwWT for ; Tue, 07 Jul 2026 23:28:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 314ba by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 23:28:23 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 1ad21a652182 - main - kern: add pddupfd(2) 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1ad21a6521827473dc6692646e9c760a5b0521cd Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 23:28:23 +0000 Message-Id: <6a4d8b97.314ba.6044989@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1ad21a6521827473dc6692646e9c760a5b0521cd commit 1ad21a6521827473dc6692646e9c760a5b0521cd Author: Konstantin Belousov AuthorDate: 2026-05-21 19:12:45 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 22:03:53 +0000 kern: add pddupfd(2) Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57163 --- sys/kern/kern_descrip.c | 8 +++-- sys/kern/sys_procdesc.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++ sys/kern/syscalls.master | 7 +++++ 3 files changed, 95 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 351cc1917b04..8272d6da9b0a 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -3162,6 +3162,7 @@ fget_remote(struct thread *td, struct proc *p, int fd, struct filecaps *fcaps, struct filedesc *fdp; struct file *fp; int error; + bool copied __diagused; /* * Both fcaps and fd_flags must be either requested together, @@ -3186,8 +3187,11 @@ fget_remote(struct thread *td, struct proc *p, int fd, struct filecaps *fcaps, *fd_flags = fde_to_fd_flags(fdp->fd_ofiles[fd]. fde_flags); } - if (fcaps != NULL) - *fcaps = fdp->fd_ofiles[fd].fde_caps; + if (fcaps != NULL) { + copied = filecaps_copy( + &fdp->fd_ofiles[fd].fde_caps, fcaps, true); + MPASS(copied); + } error = 0; } else { error = EBADF; diff --git a/sys/kern/sys_procdesc.c b/sys/kern/sys_procdesc.c index 4749a9b8bf7e..7351df11c631 100644 --- a/sys/kern/sys_procdesc.c +++ b/sys/kern/sys_procdesc.c @@ -67,6 +67,7 @@ #include #include #include +#include #include #include #include @@ -702,3 +703,84 @@ sys_pdopenpid(struct thread *td, struct pdopenpid_args *args) return (EINVAL); return (kern_pdopenpid(td, args->pid, args->flags)); } + +static int +kern_pddupfd(struct thread *td, int pdfd, int fd, int flags) +{ + struct proc *p; + struct file *fp, *pfp; + struct procdesc *pd; + struct filecaps fcaps; + uint8_t fd_flags; + int error, fdr; + + error = fget(td, pdfd, &cap_pddupfd_rights, &pfp); + if (error != 0) + return (error); + if (pfp->f_type != DTYPE_PROCDESC) { + error = EBADF; + goto out; + } + pd = pfp->f_data; +again: + sx_slock(&proctree_lock); + p = pd->pd_proc; + if (p != NULL) { + AUDIT_ARG_PROCESS(p); + PROC_LOCK(p); + sx_sunlock(&proctree_lock); + if ((p->p_flag & P_WEXIT) != 0) { + error = ESRCH; + } else { + /* + * Block the target process from entering + * execve(). We need to ensure that the + * p_candebug() predicate is stable until the + * fget_remote() call ends even after the + * process lock is dropped. For that, the + * process must not change uid/suid. + */ + if (!execve_block(td, p)) + goto again; + error = p_candebug(td, p); + if (error == 0) + _PHOLD(p); + else + execve_unblock(td, p); + } + PROC_UNLOCK(p); + if (error != 0) + goto out; + + error = fget_remote(td, p, fd, &fcaps, &fd_flags, &fp); + PROC_LOCK(p); + execve_unblock(td, p); + _PRELE(p); + PROC_UNLOCK(p); + if (error == 0) { + error = finstall_refed(td, fp, &fdr, O_CLOEXEC | + ((fd_flags & FD_RESOLVE_BENEATH) != 0 ? + O_RESOLVE_BENEATH : 0), &fcaps); + if (error != 0) { + fdrop(fp, td); + filecaps_free(&fcaps); + } else { + td->td_retval[0] = fdr; + } + } + } else { + sx_sunlock(&proctree_lock); + error = ESRCH; + } +out: + fdrop(pfp, td); + return (error); +} + +int +sys_pddupfd(struct thread *td, struct pddupfd_args *args) +{ + if (args->flags != 0) + return (EINVAL); + return (kern_pddupfd(td, args->pd, args->fd, args->flags)); +} diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 8ea32a7b0058..4bc5385f76e7 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -3435,5 +3435,12 @@ int flags ); } +604 AUE_NULL STD { + int pddupfd( + int pd, + int fd, + int flags + ); + } ; vim: syntax=off From nobody Tue Jul 7 23:28:24 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 4gvy8S4NV0z6kCGB for ; Tue, 07 Jul 2026 23:28:24 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvy8S2cCfz3FRF for ; Tue, 07 Jul 2026 23:28:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783466904; 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=HVstY+vjca5jcnpaVGVLQLdU0db4lAGQmfM4T7YrRto=; b=GLhYfrHcaW+wQxuiquia4Y10C0BT5W7wF26QAFqnID1S8OAja2t7fdkzdB/NkPBRieBAsF DluvfGJkc8fQGjleS6zPJjTeyuUP4wRDmnBxc5NDxuxnwyadiE2YeYAPSyk0ZoIOxjAjl9 xW3r92chgYHk6RSZx2DDc38z6/3aKOQ6v/aqRjqKCBau38ImmmLQqBIo5oVmX+HIufgcQn yhV407/5CKVOSzRRcsuJbJGJFdyW2KZKNKHakH0V3DT+jtG/C0IaLVTKpAZ7Q9uGKrUhkV sPLbbHpMXwp7VERmZpTR0uJsp3tEuyDYsobkNYj0V2aSlBaVBdRvzU/IEPJ/mQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783466904; a=rsa-sha256; cv=none; b=sYEjZQzfOJBSTu6lxya7rsTuhq27Cl0VUHBv6Hgdadpyi/AZZ2qn3rDo8RRgPFtnkWASrv x3DWOvo2mQFfJShL6bw+jBxzQ0YVcZQ8SrZR20S7sA1y1JEeosGwf/2MuXC77Y84021JI+ Ou/a03vqNAjxVTGnOVs7GFYIpYQPvyJTzkT74D+icIUF08Fw/MyGI+MzXEkA79pMawgFBz WYHAl0hiW6cIJ4Qf38g/DMEM08IxzKjlSFWKJ66lXEpMGvMxPkr/z5dOG3b3gZOuXo1pQk knbL1Dvubty9gYFb7VUll/5G12bcf79h7rv8pppv9vuOLZew9AoAf8621IiUnA== 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=1783466904; 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=HVstY+vjca5jcnpaVGVLQLdU0db4lAGQmfM4T7YrRto=; b=cnx8r5q30lXmklFNvFv8ar40HC8mwZdbIBzQs+KSTCyYz5z2wLpPwuHDMQzlTpErLnMlMD Eg3ZOzdBWZKESLxEIgZuXfONFOcqvqCK1i/9RLAMwkg0HPhbV6822c546eAD4W7QnyCexy Nn4Gxw7gJZkwiXwYfRaaG+5yKkqsETtKN0Kh2MqPV28n2QyATyiCYMO6FTEtzqjATOdavb v7ZGWc8NCFcCXtcQkIkOO1y/t81vxoHP5jnLWTG2h53ZNbDZ5bkts9GypTsNflIEJsrkdD vXt/yqNqvNs1pk/GrhyxTpBq1y4C1V1jAyJKE0Abj+e6K2kZGdAsDKPaJ8gUJw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvy8S1hLFzwlW for ; Tue, 07 Jul 2026 23:28:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 31af5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 23:28:24 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 2a41a8f64ba1 - main - libsys: export pddupfd(2) 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2a41a8f64ba12c0d446bf1d4ed1334610f013773 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 23:28:24 +0000 Message-Id: <6a4d8b98.31af5.3a3fdd93@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2a41a8f64ba12c0d446bf1d4ed1334610f013773 commit 2a41a8f64ba12c0d446bf1d4ed1334610f013773 Author: Konstantin Belousov AuthorDate: 2026-05-21 19:19:57 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 22:03:53 +0000 libsys: export pddupfd(2) Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57163 --- lib/libsys/Symbol.sys.map | 1 + sys/sys/procdesc.h | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/libsys/Symbol.sys.map b/lib/libsys/Symbol.sys.map index 05678ad0a7b6..9d1fad29230d 100644 --- a/lib/libsys/Symbol.sys.map +++ b/lib/libsys/Symbol.sys.map @@ -391,6 +391,7 @@ FBSD_1.8 { }; FBSD_1.9 { + pddupfd; pdopenpid; pdrfork; pdrfork_thread; diff --git a/sys/sys/procdesc.h b/sys/sys/procdesc.h index ba72cf573c31..b332f73744de 100644 --- a/sys/sys/procdesc.h +++ b/sys/sys/procdesc.h @@ -139,6 +139,7 @@ int pdkill(int, int); int pdgetpid(int, pid_t *); int pdopenpid(pid_t, int); int pdwait(int, int *, int, struct __wrusage *, struct __siginfo *); +int pddupfd(int, int, int); pid_t pdrfork_thread(int *, int, int, void *, int (*)(void *), void *); __END_DECLS From nobody Tue Jul 7 23:28:25 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 4gvy8T5tgWz6kCKy for ; Tue, 07 Jul 2026 23:28:25 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvy8T3NSSz3FWx for ; Tue, 07 Jul 2026 23:28:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783466905; 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=PomDAolh7lIcX0Osltsv45YCOj/13egrq1zbk/bpO5w=; b=hzWVr1FN4ib9nqMbIs/1cTaA6O8A5qF6QpbZiq/NtWCa4vg4KSZaBn/0TNjG0wcX8aV5XQ AuzxHJfr4V6ZzU1R82cOm8AynhNT03Ma5m9OW4LOjOaQvElu7VW6mwovnRsnM2khkkufwk wNCwTS6v/vp2Ksn+7ukvGrK4C6kwMkCQqvNGnbIqRuUroelIHAf1eDkLXws0GGMwqNd1Ys OqELvzZ84AaIsltMPjyGKgmah7JkqHpEPbLKUT3/rySNI0sJcxsEOty+rk68Gzcts9gZqv gQ2pWHFSjntKJIrxxDLaqFD2HicUhwn4Ib3X8tEzaTD0d2Q5CN8mR7s1pcs8ng== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783466905; a=rsa-sha256; cv=none; b=H8CszDfbbQHnUL/oWMor9RhaE7HbyKoAQmtsR1715jeCE3JqRWK/lNzYD+DGxUhoFJ/nvB jwL/OK8sMEZo7nFJnHV5+OpKKgdhjBAalrrwlnb3mSinzgveBVy+epGMcGptqQHR4epJFV jFZVDdN7lO/qIHL5Du36zerGRK51Qpoc4H6V1mPGx6Ny4DgcjYmZ9Jsa3PeAEDWWgJs8+T /pDzEVWUZw/LQgVSZMKu+CLEDRas0sgo10TKvF7Gsl3M/u48IKAX6bOie6Ql7xa5i/EbSL ezXwvZQve1wtbq44L8u7Q8+vBQQEXQ8ClYcv23JdlTkKo1uflpHaIMoo17FtWg== 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=1783466905; 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=PomDAolh7lIcX0Osltsv45YCOj/13egrq1zbk/bpO5w=; b=ryZSvuS3SJG19CvM7V/J2c3DJyv13H+YXJuaPiHyAYd0Y9KTL6KocaOai7xalGLE2MVYnq m9Wr5gdHuO3Xp8ahzNIJGGjAOrc6dRgyiH1V80dTc4TTFz9ZESJ6ykOp2eYYikL3TTjLWX aUt02WdIxAOmXEoZAzAmPH/qWbI4JYewckkoHyU9sptD0y97zwKm3E39QC9Fu/ksO8FTcK lWb/sTcDSFX2u1T0AbM7jeELD8lW66GlYCK350j8VMfTNwa48MfPaZ/paq4Ti0xO7x3jHH ILj8eM+SIUPk7D9UkEvu5t4nR3qHzC714YmVgYB2WB/ZpTI7VAmOFn6n1HO1Mw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvy8T2BWRzwlX for ; Tue, 07 Jul 2026 23:28:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27665 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 23:28:25 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: c20558e5c9da - main - pdfork.2: document pddupfd() 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c20558e5c9dadfdddc879ee50a65d14beb4992b9 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 23:28:25 +0000 Message-Id: <6a4d8b99.27665.176ec2bf@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c20558e5c9dadfdddc879ee50a65d14beb4992b9 commit c20558e5c9dadfdddc879ee50a65d14beb4992b9 Author: Konstantin Belousov AuthorDate: 2026-05-22 10:09:01 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 22:03:53 +0000 pdfork.2: document pddupfd() Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57163 --- lib/libsys/Makefile.sys | 3 ++- lib/libsys/pdfork.2 | 57 +++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/lib/libsys/Makefile.sys b/lib/libsys/Makefile.sys index c362258b89f4..5924abb43a39 100644 --- a/lib/libsys/Makefile.sys +++ b/lib/libsys/Makefile.sys @@ -500,7 +500,8 @@ MLINKS+=pdfork.2 pdgetpid.2 \ pdfork.2 pdopenpid.2 \ pdfork.2 pdkill.2 \ pdfork.2 pdrfork.2 \ - pdfork.2 pdwait.2 + pdfork.2 pdwait.2 \ + pdfork.2 pddupfd.2 MLINKS+=pipe.2 pipe2.2 MLINKS+=poll.2 ppoll.2 MLINKS+=rctl_add_rule.2 rctl_get_limits.2 \ diff --git a/lib/libsys/pdfork.2 b/lib/libsys/pdfork.2 index 18dff970be1f..a6bf8534003d 100644 --- a/lib/libsys/pdfork.2 +++ b/lib/libsys/pdfork.2 @@ -39,7 +39,8 @@ .Nm pdopenpid , .Nm pdgetpid , .Nm pdkill , -.Nm pdwait +.Nm pdwait , +.Nm pddupfd .Nd System calls to manage process descriptors .Sh LIBRARY .Lb libc @@ -63,6 +64,8 @@ .Fa "struct __wrusage *wrusage" .Fa "struct __siginfo *info" .Fc +.Ft int +.Fn pddupfd "int fd" "int remotefd" "int flags" .Sh DESCRIPTION Process descriptors are special file descriptors that represent processes, and are created using @@ -176,6 +179,23 @@ See the description of the .Xr wait6 system call for the behavior specification. .Pp +The +.Fn pddupfd +allows the caller to duplicate a file descriptor across the process +boundaries. +The function returns the new file descriptor that points to the same file +as the file descriptor +.Fa remotefd +in the process specified by the +.Fa fd +process descriptor. +The returned file descriptor has the +.Va O_CLOEXEC +flag set. +The +.Fa flags +argument is reserved and must be zero. +.Pp The following system calls also have effects specific to process descriptors: .Pp .Xr fstat 2 @@ -228,8 +248,9 @@ does. .Fn pdopenpid , .Fn pdgetpid , .Fn pdkill , +.Fn pdwait , and -.Fn pdwait +.Fn pddupfd return 0 on success and -1 on failure. .Sh ERRORS These functions may return the same error numbers as their PID-based equivalents @@ -306,6 +327,30 @@ which executes all actions performed by .Xr close 2 on it. .El +.Pp +The +.Fn pddupfd +returns the following errors: +.Bl -tag -width Er +.It Bq Er EINVAL +The +.Fa flags +argument is not zero. +.It Bq Er ESRCH +The process specified by the file descriptor +.Fa fd +exited. +.It Bq Er EBADF +The file descriptor +.Fa fd +is not a process file descriptor. +.It Bq Er EBADF +The file descriptor +.Fa remotefd +is not a valid file descriptor in the specified process. +.It Bq Er ENOENT +The specified process does not have a file descriptor table. +.El .Sh SEE ALSO .Xr close 2 , .Xr fork 2 , @@ -332,7 +377,9 @@ system calls first appeared in .Fx 15.1 . The .Fn pdopenpid -system call first appeared in +and +.Fn pddupfd +system calls first appeared in .Fx 16.0 . .Pp Support for process descriptors mode was developed as part of the @@ -356,5 +403,7 @@ with input from .An Alan Somers Aq Mt asomers@FreeBSD.org . The .Fn pdopenpid -function was developed by +and +.Fn pddupfd +functions were developed by .An Konstantin Belousov Aq Mt kib@FreeBSD.org . From nobody Tue Jul 7 23:28:26 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 4gvy8W0tmkz6kCQr for ; Tue, 07 Jul 2026 23:28:27 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvy8V4LQxz3FM3 for ; Tue, 07 Jul 2026 23:28:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783466906; 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=MlDLTgEocQdYGY7dZC2Il27g806pe8L2fBOjSwQWDRQ=; b=QBsYuFsLukwi8Zujn8V27+4inKs3pcGxmNdQbMBKDNLK+KTgxaEqbiqsxrzPmqpUbidQyz OZcqm9jb8HKu+6EWLJKstaOl8CrEAlsbHj2rYJ8J4sh+vrHP1v/n2vI+0xUUZag2jPA8ub waSDPQYk3F9s7pjEJiWqeEgAdHwx+nXaoI1Qc07CuNx6pRUFSywGg5kmIbcdnFP2WtgGvL 3rK0J/C8cjBsMGFb3JL2PjiwVTaLcmu0O791RcRm2Sfay+g3uewkl7itNHMV9bO3BKMy0L 37PkVHNh1fuaZ2m/r0pKUWUlBKpPWIbIYYqXuszgSqTpPm0KTUuXAI/1zhLWdg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783466906; a=rsa-sha256; cv=none; b=DERxLIt0VinmxXZ3ACD4ym48OYwf/hF0kZnY0GGKZLJkrloWYmXOM001mYmrHLRRbHxYNh mqhX20x1zd9XW7e8H9rRoQ15wpDbUjTKcC6J7rbiqanDPSklat3qwyAW+rySjvNKiaSY1f 4w1HvsFkqVpgJhRuVhgKGVZNM0m0AwmCF6N1wx3sfte3wcMXmjM7qHuTML+p9b0bLnO4qf VTv4sXPujEGrW/497baa24YcNz91RYh5d8FLnsXfNg79MkFdp3/NdCsKwdgJ52V68Gz8EN 37d3JHr6K8VYB6LzetzZVpqm4vBKmfgWyCqRobK02Df+tDBBxBAC7s72JQw9rQ== 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=1783466906; 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=MlDLTgEocQdYGY7dZC2Il27g806pe8L2fBOjSwQWDRQ=; b=T9qZqBnr48QyhewmSCOtXMuY7Pqum505OFP6RE5DELhJIWuGb9fDVkw6WFt6lDghLceFt1 0DBDaMUtUVe8Yl8hoYCWJ5H4mLufotPAJnoJ/LW2pI02J/hmdh7TZiBh2lLuwbjkcoAn1K 1l0BOuRhx3rSYayJzNcNFIXaclh2Dfj354dTVI340My0A82sQSLWdG+Plhvu6+JBzlnKJX iXJiKefidQdssWuQ7ke8nx6grPDpQgXUkUWREgcKl6RWbbHcJ5k8f3mr1NGVgExp3y+VdC RomzdtBOf7/xnXM1wB9btVMQw73fSsL2E28t1iJD8IBb+dPbJYUz1KuE+lbPSA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvy8V33hfzw13 for ; Tue, 07 Jul 2026 23:28:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 30e2a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 23:28:26 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 080a7fe98178 - main - Regen. 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 080a7fe981783590bf7f0ff39eb44dc2eecd58a2 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 23:28:26 +0000 Message-Id: <6a4d8b9a.30e2a.76e3365f@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=080a7fe981783590bf7f0ff39eb44dc2eecd58a2 commit 080a7fe981783590bf7f0ff39eb44dc2eecd58a2 Author: Konstantin Belousov AuthorDate: 2026-05-21 19:13:18 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 22:03:53 +0000 Regen. --- lib/libsys/_libsys.h | 2 ++ lib/libsys/syscalls.map | 2 ++ sys/compat/freebsd32/freebsd32_syscall.h | 3 ++- sys/compat/freebsd32/freebsd32_syscalls.c | 1 + sys/compat/freebsd32/freebsd32_sysent.c | 1 + sys/compat/freebsd32/freebsd32_systrace_args.c | 30 ++++++++++++++++++++++++++ sys/kern/init_sysent.c | 1 + sys/kern/syscalls.c | 1 + sys/kern/systrace_args.c | 30 ++++++++++++++++++++++++++ sys/sys/syscall.h | 3 ++- sys/sys/syscall.mk | 3 ++- sys/sys/sysproto.h | 7 ++++++ 12 files changed, 81 insertions(+), 3 deletions(-) diff --git a/lib/libsys/_libsys.h b/lib/libsys/_libsys.h index c40e56a96094..81dc7bdeb475 100644 --- a/lib/libsys/_libsys.h +++ b/lib/libsys/_libsys.h @@ -476,6 +476,7 @@ typedef int (__sys_pdrfork_t)(int *, int, int); typedef int (__sys_pdwait_t)(int, int *, int, struct __wrusage *, struct __siginfo *); typedef int (__sys_renameat2_t)(int, const char *, int, const char *, int); typedef int (__sys_pdopenpid_t)(pid_t, int); +typedef int (__sys_pddupfd_t)(int, int, int); _Noreturn void __sys__exit(int rval); int __sys_fork(void); @@ -887,6 +888,7 @@ int __sys_pdrfork(int * fdp, int pdflags, int rfflags); int __sys_pdwait(int fd, int * status, int options, struct __wrusage * wrusage, struct __siginfo * info); int __sys_renameat2(int oldfd, const char * old, int newfd, const char * new, int flags); int __sys_pdopenpid(pid_t pid, int flags); +int __sys_pddupfd(int pd, int fd, int flags); __END_DECLS #endif /* __LIBSYS_H_ */ diff --git a/lib/libsys/syscalls.map b/lib/libsys/syscalls.map index 2d0f204f9705..2e4fa4b27ed4 100644 --- a/lib/libsys/syscalls.map +++ b/lib/libsys/syscalls.map @@ -827,4 +827,6 @@ FBSDprivate_1.0 { __sys_renameat2; _pdopenpid; __sys_pdopenpid; + _pddupfd; + __sys_pddupfd; }; diff --git a/sys/compat/freebsd32/freebsd32_syscall.h b/sys/compat/freebsd32/freebsd32_syscall.h index d786f4cd4528..22704174e366 100644 --- a/sys/compat/freebsd32/freebsd32_syscall.h +++ b/sys/compat/freebsd32/freebsd32_syscall.h @@ -521,4 +521,5 @@ #define FREEBSD32_SYS_freebsd32_pdwait 601 #define FREEBSD32_SYS_renameat2 602 #define FREEBSD32_SYS_pdopenpid 603 -#define FREEBSD32_SYS_MAXSYSCALL 604 +#define FREEBSD32_SYS_pddupfd 604 +#define FREEBSD32_SYS_MAXSYSCALL 605 diff --git a/sys/compat/freebsd32/freebsd32_syscalls.c b/sys/compat/freebsd32/freebsd32_syscalls.c index 3a28ddeb843a..06606de6f52b 100644 --- a/sys/compat/freebsd32/freebsd32_syscalls.c +++ b/sys/compat/freebsd32/freebsd32_syscalls.c @@ -609,4 +609,5 @@ const char *freebsd32_syscallnames[] = { "freebsd32_pdwait", /* 601 = freebsd32_pdwait */ "renameat2", /* 602 = renameat2 */ "pdopenpid", /* 603 = pdopenpid */ + "pddupfd", /* 604 = pddupfd */ }; diff --git a/sys/compat/freebsd32/freebsd32_sysent.c b/sys/compat/freebsd32/freebsd32_sysent.c index 0541d4a7569a..a0726834cef8 100644 --- a/sys/compat/freebsd32/freebsd32_sysent.c +++ b/sys/compat/freebsd32/freebsd32_sysent.c @@ -671,4 +671,5 @@ struct sysent freebsd32_sysent[] = { { .sy_narg = AS(freebsd32_pdwait_args), .sy_call = (sy_call_t *)freebsd32_pdwait, .sy_auevent = AUE_PDWAIT, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 601 = freebsd32_pdwait */ { .sy_narg = AS(renameat2_args), .sy_call = (sy_call_t *)sys_renameat2, .sy_auevent = AUE_RENAMEAT, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 602 = renameat2 */ { .sy_narg = AS(pdopenpid_args), .sy_call = (sy_call_t *)sys_pdopenpid, .sy_auevent = AUE_PDOPENPID, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 603 = pdopenpid */ + { .sy_narg = AS(pddupfd_args), .sy_call = (sy_call_t *)sys_pddupfd, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 604 = pddupfd */ }; diff --git a/sys/compat/freebsd32/freebsd32_systrace_args.c b/sys/compat/freebsd32/freebsd32_systrace_args.c index b79d53bd62bb..ea5991bd019b 100644 --- a/sys/compat/freebsd32/freebsd32_systrace_args.c +++ b/sys/compat/freebsd32/freebsd32_systrace_args.c @@ -3466,6 +3466,15 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 2; break; } + /* pddupfd */ + case 604: { + struct pddupfd_args *p = params; + iarg[a++] = p->pd; /* int */ + iarg[a++] = p->fd; /* int */ + iarg[a++] = p->flags; /* int */ + *n_args = 3; + break; + } default: *n_args = 0; break; @@ -9368,6 +9377,22 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; + /* pddupfd */ + case 604: + switch (ndx) { + case 0: + p = "int"; + break; + case 1: + p = "int"; + break; + case 2: + p = "int"; + break; + default: + break; + }; + break; default: break; }; @@ -11306,6 +11331,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "int"; break; + /* pddupfd */ + case 604: + if (ndx == 0 || ndx == 1) + p = "int"; + break; default: break; }; diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c index 5e80fe8bac01..8ee5f163a550 100644 --- a/sys/kern/init_sysent.c +++ b/sys/kern/init_sysent.c @@ -670,4 +670,5 @@ struct sysent sysent[] = { { .sy_narg = AS(pdwait_args), .sy_call = (sy_call_t *)sys_pdwait, .sy_auevent = AUE_PDWAIT, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 601 = pdwait */ { .sy_narg = AS(renameat2_args), .sy_call = (sy_call_t *)sys_renameat2, .sy_auevent = AUE_RENAMEAT, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 602 = renameat2 */ { .sy_narg = AS(pdopenpid_args), .sy_call = (sy_call_t *)sys_pdopenpid, .sy_auevent = AUE_PDOPENPID, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 603 = pdopenpid */ + { .sy_narg = AS(pddupfd_args), .sy_call = (sy_call_t *)sys_pddupfd, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 604 = pddupfd */ }; diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c index bd9e766b4e44..6d36e8c7f814 100644 --- a/sys/kern/syscalls.c +++ b/sys/kern/syscalls.c @@ -609,4 +609,5 @@ const char *syscallnames[] = { "pdwait", /* 601 = pdwait */ "renameat2", /* 602 = renameat2 */ "pdopenpid", /* 603 = pdopenpid */ + "pddupfd", /* 604 = pddupfd */ }; diff --git a/sys/kern/systrace_args.c b/sys/kern/systrace_args.c index 3ad68f186acb..4fcadbde5e28 100644 --- a/sys/kern/systrace_args.c +++ b/sys/kern/systrace_args.c @@ -3563,6 +3563,15 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 2; break; } + /* pddupfd */ + case 604: { + struct pddupfd_args *p = params; + iarg[a++] = p->pd; /* int */ + iarg[a++] = p->fd; /* int */ + iarg[a++] = p->flags; /* int */ + *n_args = 3; + break; + } default: *n_args = 0; break; @@ -9542,6 +9551,22 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; + /* pddupfd */ + case 604: + switch (ndx) { + case 0: + p = "int"; + break; + case 1: + p = "int"; + break; + case 2: + p = "int"; + break; + default: + break; + }; + break; default: break; }; @@ -11575,6 +11600,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "int"; break; + /* pddupfd */ + case 604: + if (ndx == 0 || ndx == 1) + p = "int"; + break; default: break; }; diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h index 13db6580b4d2..94321263756f 100644 --- a/sys/sys/syscall.h +++ b/sys/sys/syscall.h @@ -542,4 +542,5 @@ #define SYS_pdwait 601 #define SYS_renameat2 602 #define SYS_pdopenpid 603 -#define SYS_MAXSYSCALL 604 +#define SYS_pddupfd 604 +#define SYS_MAXSYSCALL 605 diff --git a/sys/sys/syscall.mk b/sys/sys/syscall.mk index b2ff9ccee001..0e1b0c91943b 100644 --- a/sys/sys/syscall.mk +++ b/sys/sys/syscall.mk @@ -445,4 +445,5 @@ MIASM = \ pdrfork.o \ pdwait.o \ renameat2.o \ - pdopenpid.o + pdopenpid.o \ + pddupfd.o diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h index 12e12eefab9f..d86409b9eb21 100644 --- a/sys/sys/sysproto.h +++ b/sys/sys/sysproto.h @@ -1936,6 +1936,11 @@ struct pdopenpid_args { char pid_l_[PADL_(pid_t)]; pid_t pid; char pid_r_[PADR_(pid_t)]; char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; }; +struct pddupfd_args { + char pd_l_[PADL_(int)]; int pd; char pd_r_[PADR_(int)]; + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; +}; int sys__exit(struct thread *, struct _exit_args *); int sys_fork(struct thread *, struct fork_args *); int sys_read(struct thread *, struct read_args *); @@ -2347,6 +2352,7 @@ int sys_pdrfork(struct thread *, struct pdrfork_args *); int sys_pdwait(struct thread *, struct pdwait_args *); int sys_renameat2(struct thread *, struct renameat2_args *); int sys_pdopenpid(struct thread *, struct pdopenpid_args *); +int sys_pddupfd(struct thread *, struct pddupfd_args *); #ifdef COMPAT_43 @@ -3350,6 +3356,7 @@ int freebsd14_setgroups(struct thread *, struct freebsd14_setgroups_args *); #define SYS_AUE_pdwait AUE_PDWAIT #define SYS_AUE_renameat2 AUE_RENAMEAT #define SYS_AUE_pdopenpid AUE_PDOPENPID +#define SYS_AUE_pddupfd AUE_NULL #undef PAD_ #undef PADL_ From nobody Tue Jul 7 23:28:27 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 4gvy8X02z6z6kCNF for ; Tue, 07 Jul 2026 23:28:28 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvy8W4qYYz3Fb7 for ; Tue, 07 Jul 2026 23:28:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783466907; 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=HpK247U4BqaYFudYWS5J0prGB5hqjz+Vu2QPO/KGTwA=; b=rLBvuYI3JNKUgicOgp49Tgou/MTkWPbaulYt3DNde2B1EeFJvAR1fS5zZyOqyyDKdvxoKl 4F1HcQBHG3vbQn9fhzQx+dpNztGrC96XVb4ahomJdxYi7HTCE9SqEKiVXH573ukPR3t7Dr AiX6sTfI2Edp95gA9+EzyVYtkSsADybNCws0BS3BYdpZhGkWm8RQ5HLNiTum3+aLQ7AY6X mVOrpVQHbLO9f+B3H9yrCeK5BTt8p9CeMfoDJE/9EIJBJzJGCJoz1bbz0eRdVU7BqK7iur zY2FmQ0+MqCPxB4c3fYd/kSDxAY6vr3kAy4ryr2hD7XcrrGRcAPaEfkmNa9C/g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783466907; a=rsa-sha256; cv=none; b=SxO/kUEx0qV1rhmbVSze7TrBB579SQVW+mESnc4r13pMm8N9+fVxoYthUUZva1Xh1BSAgn VCxEP0Rmg4etPWu6trX2SdFyCpbC1kh9kR7vCuTfBlxLGBaZvX33cy1B9KnYbIX/FmcL67 6wF5Nk89CJdRNnQj5td1hY/p411ym36IJy8iYRs4XmCyJ1Mpl+E9b0ck0RhN1WV7B1RygW K6j0cq1BZDPGBG4Q4ZgfVD0v55HYIeoNbW+LJJcLJnqrUz4kCA25aGGUW9qmQJqJpwS4+X 5+gRP1QdIkb3aGbMkbTm41NVTt2uCH21AjSofdAMqbQmc0EHixV06dJ1Xc/UHg== 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=1783466907; 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=HpK247U4BqaYFudYWS5J0prGB5hqjz+Vu2QPO/KGTwA=; b=Ief2zdjfTX2KUaLYyDaFMrewqrpgNIo1PSKxKlfqBv5c43nL0xD7uyRZQQ4AercFyvmn5m 1q0OSpZ1k0aY60w5WkK70J+pUpfRyrohi/AYOIT+fX56ieuUWjOzha0FRkjBY3eK9ueLcl kmkCFNqca987toCrJuz66f+H/wT52h5nACQWVdB5hJk521UXgvPjcA7BNtD1tUuLUlcp5N uK32p1SzDgTMhORcIeJXOU5KxNy6duKGG85nHwGTXPyAQZ1KHqZU4JdJ4XbnOAbh/TUzEo TkhthNKCV48GbhQ/3LSzzzBWLUpNBLeadfgyhsqdSWu8JoSIQ0Hh9gFQOq7X4Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvy8W3spxzwFp for ; Tue, 07 Jul 2026 23:28:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27669 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 23:28:27 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: f87f97d4c9b3 - main - kern/sys_process.c: clean up includes 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f87f97d4c9b30dde1cdb3d72dfd699aed9c307e1 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 23:28:27 +0000 Message-Id: <6a4d8b9b.27669.4b556678@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f87f97d4c9b30dde1cdb3d72dfd699aed9c307e1 commit f87f97d4c9b30dde1cdb3d72dfd699aed9c307e1 Author: Konstantin Belousov AuthorDate: 2026-05-26 01:24:54 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 22:03:53 +0000 kern/sys_process.c: clean up includes Order them alphabetically. Remove redundand sys/param.h. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/kern/sys_process.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 81cff03250a9..9fdcf79d0873 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -31,29 +31,28 @@ * SUCH DAMAGE. */ -#include #include +#include +#include #include #include #include #include +#include #include #include +#include +#include +#include #include +#include +#include #include +#include #include #include #include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include #include From nobody Tue Jul 7 23:28:28 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 4gvy8Y1BHmz6kCLJ for ; Tue, 07 Jul 2026 23:28:29 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvy8X5TC9z3FV0 for ; Tue, 07 Jul 2026 23:28:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783466908; 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=Va1f/RLSgpbAsg0JDDnd0zhK6kEjjycqnyo+tIrFL1k=; b=xihDZO66XXhnnjZy9/9ePWwmM3iv5vVBcRp6lNgwSllPaXhygaTbnuu0MkNobTV9T5TLnc 58FSWOs1Q9W5gFWhJxhQyMmPtKo+mZjSAsyVJu7BegcsTtsPGnN6WFiQqpy//jWkX5Jd6Q zA+Gouh8buWRkWIyN8ZLTcRUe0pL37Q7cNUe51brO5KUoJQz8GPCERLC94dquC9bEAARbv UWjIKXRMVsqhI5rbGWEjYfH00AD1wZ3kSQYdK/k3jURd7fSJfNEAsIZkHPvY6xsrquM0WS LcMbWJiWhqo4lZJ/4yh7sHP6euBI82b7vL+k1FOD6XRo0faynupTRNadqYwi7g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783466908; a=rsa-sha256; cv=none; b=IVK1i9eALHqNRcVB+HHwtUmEd0GYpJjhkUI6pdDGgHKaLs4/pgtjEDAm/RqH9sVb6MHcTy raPicQKd9nH1dUaUy24wi93IncZBUD02fFIgOyIf9IGBJWZBKfGKwSZrgYVyMtNT7rizVy jz2iPVKzraT204ydatR1VAUj2fucEkGK8ADgWiLt57NbtvKTGlchwvsAMKYTWzlT9eDk5d 2caS2PamvgjgLFc2LSHnvMeswQtbm97TzXSED96CrPlBKk3QCz0+Q47mXufOJB1vS6FWFU sVEDFMAewyGt4acD5y8GfP92SZ5fduAtcFQU6FvqFtKUFbxiaWPacZQMduTkMw== 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=1783466908; 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=Va1f/RLSgpbAsg0JDDnd0zhK6kEjjycqnyo+tIrFL1k=; b=NGZMSg0t/2FdQfyQMJe17gF362tZht/C8QyUYHmeN5+p/kmZCDIRad0pzvOpCn3M/UDoq2 pgrImZexdqpl2uZXf/zR80BtxJYcbNOu5pd0QzOHeK3fe57LvWOLvY1+z2cUQ85r0b6GpV 4bTdjxrxjNZNI0PDfJdiK5F3zTmfmbhKgloGpISxuycMsGjU4ma6WgsfYq+dZzE1fSYmGH RPrzjjfeZHFosCNNkKW1AbFeTZHvug0439Zip+e6UQ0zg/R9XtcC3xco1Rc6NXGkkcvs9v PW9UF3y/g4ayhnzxl/EE4WliOX6N6E3O+KqUCbDB8VoGWIu5ueDymckdBzK9Hw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvy8X4RQ6zwWW for ; Tue, 07 Jul 2026 23:28:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 31ccc by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 23:28:28 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 23e94b040b9b - main - pddupfd(2): add basic test 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 23e94b040b9b99f097c113fc8576576ffec0486f Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 23:28:28 +0000 Message-Id: <6a4d8b9c.31ccc.231a4f86@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=23e94b040b9b99f097c113fc8576576ffec0486f commit 23e94b040b9b99f097c113fc8576576ffec0486f Author: Konstantin Belousov AuthorDate: 2026-07-07 05:49:54 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 23:18:01 +0000 pddupfd(2): add basic test Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57163 --- tests/sys/kern/procdesc.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/tests/sys/kern/procdesc.c b/tests/sys/kern/procdesc.c index 388104054b82..541f15b49338 100644 --- a/tests/sys/kern/procdesc.c +++ b/tests/sys/kern/procdesc.c @@ -28,12 +28,14 @@ #include #include +#include #include #include #include #include #include #include +#include #include #include @@ -657,6 +659,76 @@ ATF_TC_BODY(pdopenpid_no_wakeup, tc) ATF_REQUIRE(close(fd) == 0); } +/* + * basic pddupfd functionality + */ + +#define EXPECTED_OFFSET 123 + +ATF_TC_WITHOUT_HEAD(pddupfd_basic); +ATF_TC_BODY(pddupfd_basic, tc) +{ + int *comm; + struct __wrusage wu; + struct __siginfo si; + int fd, pp, rfd, status, workfd, r, r1; + off_t off; + pid_t child; + + comm = mmap(NULL, sizeof(int), PROT_READ | PROT_WRITE, MAP_SHARED | + MAP_ANONYMOUS, -1, 0); + ATF_REQUIRE(comm != MAP_FAILED); + atomic_store_int(comm, -1); + + child = fork(); + ATF_REQUIRE(child != -1); + if (child == 0) { + workfd = open("/etc/passwd", O_RDONLY); + ATF_REQUIRE(workfd != -1); + atomic_store_int(comm, workfd); + while ((r = (int)atomic_load_int(comm)) >= 0) + sleep(1); + lseek(workfd, EXPECTED_OFFSET, SEEK_SET); + r -= 1; + atomic_store_int(comm, r); + while (r == (int)atomic_load_int(comm)) + sleep(1); + _exit(0x23); + } + + fd = pdopenpid(child, 0); + ATF_REQUIRE(fd != -1); + ATF_REQUIRE(pdgetpid(fd, &pp) == 0); + + while ((rfd = (int)atomic_load_int(comm)) == -1) + ; + ATF_REQUIRE(rfd >= 0); + workfd = pddupfd(fd, rfd, 0); + ATF_REQUIRE(workfd != -1); + + /* + * pddupfd-ed file must dup-ed, i.e. the underlying file must + * be same between the remote and local filedescriptors. + * Check that the initial seek offset is zero. Then observe + * the updated offset, which is only possible if the file is + * indeed shared. + */ + off = lseek(workfd, 0, SEEK_CUR); + ATF_REQUIRE_EQ(off, 0); + r = -1; + atomic_store_int(comm, r); + while ((r1 = (int)atomic_load_int(comm)) == r) + sleep(1); + off = lseek(workfd, 0, SEEK_CUR); + ATF_REQUIRE_EQ(off, EXPECTED_OFFSET); + r1 -= 1; + atomic_store_int(comm, r1); + ATF_REQUIRE(close(workfd) == 0); + + ATF_REQUIRE(pdwait(fd, &status, WEXITED, &wu, &si) != -1); + ATF_REQUIRE(close(fd) == 0); +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, pid_recycle); @@ -678,5 +750,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, pdopenpid_exiting); ATF_TP_ADD_TC(tp, pdopenpid_no_wakeup); + ATF_TP_ADD_TC(tp, pddupfd_basic); + return (atf_no_error()); } From nobody Tue Jul 7 23:32:05 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 4gvyDk07ktz6kCb9 for ; Tue, 07 Jul 2026 23:32:06 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvyDj5y7wz3K1b for ; Tue, 07 Jul 2026 23:32:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783467125; 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=aRWur2ySBMlwjzqznjzR5cqmpfoP+CcDKHrV/ATl1pc=; b=mJBK9b93c5bcf3sAEENviwQ07HLRgY7jt9gYkrqLs0Cse2HJEjHFbriXIfB6vmdXP5YaHB BE/S7LCAVzTWJMd+6cgwzlmZaqLfgTBORSc7ZgkIpTzMvjkXR8mllLkXRVsjtQN7/O+R/j IZ6pSZFfmtvqzqvKqyHu0dnmGOJDz3A+3mgl0R6n6Vtjz0kcrEoHRt+3QbvkuXBWjZMzpF 16w/ymN+baM0q5Lsy1uKVHeiUZ1hcKJWjlnxrZZ1yPjmh+j9xBzMiz3z3PEHYeXOCUbbmi Bd5kTnlswEgXT/eOPPPID2G5KhvWD5pM47YLxO1fzUj7G1IqEy0hCagxUj0mNg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783467125; a=rsa-sha256; cv=none; b=aghGKrGKYtBIifvCWCkLEhRvdyiia4/6zcQ/OrSWPqwRjQnBw7NQKWQUsxL3M94xwp/Tsc 8qFoAV+eDACWKeL3sC0Au7qcBb0DzauOyvmWZXbbMbFQjNOu7BR16dwldRaYXpNLBTQ8DR 1Z4QMHKY8feQEnrXmpGc3CouZ+Fynhe1lstKIJ7oWsQI3dWNawMy/KU+N8sBMooTgTgyk3 iWdBZ+7NCUKdSWxzn0DWEQlKy3INy7YMe8P7QQNO76zkTO0MizgErlznlRCBrjLUYqUMND JoqkiVPnbCybK09B3TdRt7B2MjKGwhS3vsHiR0VuPiyJZGtlcNKT2s3MavGW2A== 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=1783467125; 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=aRWur2ySBMlwjzqznjzR5cqmpfoP+CcDKHrV/ATl1pc=; b=X0VM7YvGtzKHdkeal1CcHr9JO2jnIZDTQVQDS2adYqLkaWWPdsRS+SwGL5JcyjUWfX9XRB W25PdGMfBN22FOqn1HfKEx6krSqFtYtrMPrC3p8Eme9AFLQn6bml/MrQaUHu5xgCNp+gbV ZLG4tWYNlOr991q+XZC+cZyIWL30NLzVw0rTXA+ubD2zaOKt6v7zPdOixEH9ZEyYXcemkv VLBGVfHgKunHPZoX52x/JEBCsJg1e6JRqQGLWg1CWnR8/XA6rtrzZ7EZ+3ZNaeFeBMpMnY HyhcKHQ9rnYl8MDE9+AZsm/od16H+QhuofD290QTX4Q8KP/9Nr7QPG+H709JYw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvyDj4jJ5zwTr for ; Tue, 07 Jul 2026 23:32:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 332e2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 23:32:05 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 407c7c339adb - main - linux/futex: Don't load a timeout when try-locking a mutex 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: 407c7c339adb429efcb6658accd16399031c34ca Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 23:32:05 +0000 Message-Id: <6a4d8c75.332e2.21901efe@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=407c7c339adb429efcb6658accd16399031c34ca commit 407c7c339adb429efcb6658accd16399031c34ca Author: Mark Johnston AuthorDate: 2026-07-07 22:52:56 +0000 Commit: Mark Johnston CommitDate: 2026-07-07 23:28:55 +0000 linux/futex: Don't load a timeout when try-locking a mutex linux_sys_futex() does not copyin a timespec for the timeout if the operation is LINUX_FUTEX_TRYLOCK_PI, presumably because it doesn't make sense to specify a timeout for a try-lock operation. However, this means that we pass a userspace timespec pointer to linux_umtx_abs_timeout_init(). Modify linux_futex_lock_pi() to not initialize the timeout if we're try-locking. Reviewed by: kib, dchagin Reported by: Yuxiang Yang, Yizhou Zhao, Ao Wang, Xuewei Feng, Qi Li, and Ke Xu from Tsinghua University using GLM-5.2 from Z.ai MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D58061 --- sys/compat/linux/linux_futex.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index 0586eb55a8f3..2e26fb6458a3 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -356,7 +356,7 @@ linux_futex(struct thread *td, struct linux_futex_args *args) static int linux_futex_lock_pi(struct thread *td, bool try, struct linux_futex_args *args) { - struct umtx_abs_timeout timo; + struct umtx_abs_timeout timo, *timop; struct linux_emuldata *em; struct umtx_pi *pi, *new_pi; struct thread *td1; @@ -370,8 +370,12 @@ linux_futex_lock_pi(struct thread *td, bool try, struct linux_futex_args *args) &uq->uq_key); if (error != 0) return (error); - if (args->ts != NULL) - linux_umtx_abs_timeout_init(&timo, args); + if (!try && args->ts != NULL) { + timop = &timo; + linux_umtx_abs_timeout_init(timop, args); + } else { + timop = NULL; + } umtxq_lock(&uq->uq_key); pi = umtx_pi_lookup(&uq->uq_key); @@ -546,8 +550,7 @@ linux_futex_lock_pi(struct thread *td, bool try, struct linux_futex_args *args) /* We set the contested bit, sleep. */ error = umtxq_sleep_pi(uq, pi, owner, "futexp", - args->ts == NULL ? NULL : &timo, - (args->flags & FUTEX_SHARED) != 0); + timop, (args->flags & FUTEX_SHARED) != 0); if (error != 0) continue; From nobody Wed Jul 8 02:58:06 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 4gw2pQ5bwNz6kW31 for ; Wed, 08 Jul 2026 02:58:06 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gw2pQ4GLJz3fbh for ; Wed, 08 Jul 2026 02:58:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783479486; 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=i3M7QSBcLqouQA0vGAQf+IzmFNIrosrwCrLP/CFyTW0=; b=x4EFVrqoLFe9pxzHi8rU1v1lwDE5XKKZKgO3173Ql7/Ka/eH/iHwLkLHw5YuDBN5RPBJgz Ba+kfUZ9zOLuH7FYUirtf4Rj/cxo258xCNUpYcyzmhhRWz24mndwZJhhdKYwmB9g5M7Jcc qf6dbPnnd9e3Ulnp6OavujDDcxO5D5TW3516QACcYlgocqYJO/a7+vSAXC87c7wSJ2Y43r NqZB5+u4JgmmH/jiys1OiSDJ18qhVpgTLZ4xZcMtsSICwW/EwxIINxVROTpnXKNE9fl0UY wSEsj4Cnh7+iyucyBru/kWNK9NmdIvK2FifcS9jD7oCQ+0UvZ/Gc+m1Yw7XCJA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783479486; a=rsa-sha256; cv=none; b=Qi42ZqWzae/OUcrjrvUtNxhmB28IbQFkSaAxH/9XM17agQgP8HVV+xSYOrltcIbJlRpUeu 5ARg270b4O0cxhl2GDm77gZN/G4/x7yqk22oBVGG0toarfvB++u1548y+YAAS187b4r4UR scsw5AQhVogAiaRoTsHAFryNpNFElTwhbfA3WGnJcwk6dpBL44nKnbHJKNbkaSYFkXdZon 3BEu0TMlozToOzEnnYVInzRAAMS1mDIMd4E2dsnBp0r2PFGFbG/cZ8zklUEcDonHocopfW ZekMiCFi2W2Ou9/K1c26eM8XzYP6/M2nmEfi5OIQfolHjfAyJZmvF1hFUBQzwA== 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=1783479486; 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=i3M7QSBcLqouQA0vGAQf+IzmFNIrosrwCrLP/CFyTW0=; b=yFEt2mGLHs3G/o05OuqSmk5//cjBe1g04K9soJOBcJU4Y8viJlX0sv/Y3ofJPC29ZspFQO THQzaiZMrz6j4Xo7A19zT1u4bTs2uTvl/sl2Sw2EEIXXXfUjYXfaWyxSYlbLlN9g7QY2vL OAZhuA+x5uCGve3vZ/XQGKK8SiNILtLuq3k/uNbuvbgUgBOa6SJknbqvFC7vYBw0NREGTI wFnzSM62orlWaLs928YTtLrfe6VyFhQyun40+U+dOj4tBBL4oX335nTiA9hxNq9zZeG89z 0LdvTnCc8H5YFG+QYHD02HKi1b3pp3nHLazb6ktSnjKqRtbTB+C9C4F3QCTI/Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gw2pQ2lvYz12tM for ; Wed, 08 Jul 2026 02:58:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 206a5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 08 Jul 2026 02:58:06 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: f5329a0d1471 - main - kern: imgact: fix imgp->interpreted 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: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f5329a0d14712ae990f650286a6d5a04617c7cb3 Auto-Submitted: auto-generated Date: Wed, 08 Jul 2026 02:58:06 +0000 Message-Id: <6a4dbcbe.206a5.6a28725a@gitrepo.freebsd.org> The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=f5329a0d14712ae990f650286a6d5a04617c7cb3 commit f5329a0d14712ae990f650286a6d5a04617c7cb3 Author: Kyle Evans AuthorDate: 2026-07-08 02:56:38 +0000 Commit: Kyle Evans CommitDate: 2026-07-08 02:56:38 +0000 kern: imgact: fix imgp->interpreted This is a mask, so the new value should have taken the next bit to avoid breaking a shell script that's interpreted by a binmisc-activated interpreter. Add a brief note that the new value is only used within the ELF activator. Fixes: 389c124fecb0 ("imgact_elf.c indicate that interpreter [...]") Reported by: "polyduekes" on discord, madpilot Reviewed by: kib, sjg (both previous version) Differential Revision: https://reviews.freebsd.org/D58063 --- sys/kern/imgact_elf.c | 4 ++-- sys/kern/kern_exec.c | 3 +-- sys/sys/imgact.h | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index a0dc96e74ed6..7c78d66b3648 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -823,8 +823,8 @@ __elfN(load_interp_file)(struct thread *td, const char *file, u_long *addr, imgp->td = td; imgp->proc = td->td_proc; imgp->attr = attr; - imgp->interpreted = IMGACT_INTERP_IGNORE; /* ignored by do_execve */ - + imgp->interpreted = IMGACT_INTERP_ELF; /* ignored by do_execve */ + NDINIT(nd, LOOKUP, ISOPEN | FOLLOW | LOCKSHARED | LOCKLEAF, UIO_SYSSPACE, file); if ((error = namei(nd)) != 0) { diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index b6f2848f800c..03a05c6cc041 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -750,8 +750,7 @@ interpret: * Special interpreter operation, cleanup and loop up to try to * activate the interpreter. */ - if (imgp->interpreted != 0 && - imgp->interpreted != IMGACT_INTERP_IGNORE) { + if ((imgp->interpreted & ~IMGACT_INTERP_ELF) != 0) { exec_unmap_first_page(imgp); /* * The text reference needs to be removed for scripts. diff --git a/sys/sys/imgact.h b/sys/sys/imgact.h index bf0453beec1f..155db3c7cb6b 100644 --- a/sys/sys/imgact.h +++ b/sys/sys/imgact.h @@ -86,7 +86,7 @@ struct image_params { struct ucred *newcred; /* new credentials if changing */ #define IMGACT_SHELL 0x1 #define IMGACT_BINMISC 0x2 -#define IMGACT_INTERP_IGNORE 0x3 +#define IMGACT_INTERP_ELF 0x4 /* only used within the ELF activator */ unsigned char interpreted; /* mask of interpreters that have run */ bool credential_setid; /* true if becoming setid */ bool vmspace_destroyed; /* we've blown away original vm space */ From nobody Wed Jul 8 05:17:01 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 4gw5tq3m2zz6kj3y for ; Wed, 08 Jul 2026 05:17: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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gw5tq2sYwz3tLx for ; Wed, 08 Jul 2026 05:17:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783487827; 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=m8rH+OtOiB/CvCDx0/oyH9qvjZS3A1P/ncYPRXm8dYE=; b=fqYvZGSjAm2HNe9DITNZPmFHHxSqDPmLrl6iBddzKjy9+uTVpLvbw474eeDc81BguCaLCO IXvUT+dVtberc6L5i2q58y8aLBMtan7OsWCTf67QL6xhgfGQfnVB7Wcg9oJCdMQ262cvUz vy/4knAH9ABUFdC9TjHS6qwbhgzc4hKJBsAnHSTBvYNUrMgc0pAMdU1fsGemPWiXJLuVo1 7JsKhQY1W5DPa9FtZcny77I8vKiSRnEUarSyFUvcnHtSfIA/kVtIb3xKakK9pHmLXLHU0B 41KTDp97uquprpSm0ssLiWq86iJjBk9z3bQngNfV7vS1q8klFL/+7IGamdOA2A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783487827; a=rsa-sha256; cv=none; b=LClpCotTWoLQOvDver9eYKg1BxxN4dnj/YmEYnN7KbjU0VeSG9rzRNfsAc/Ay0Al7OnndB S2J3WEpz/kDmPcFd5NI22DjtRafZgFqqL22ZpT0eOI8JuaQfFCyazzBKrGnLU8er25k2b9 +HJBUVJwi4L8t4ZPZFAk5EoOnnIvvNKMMaei+8s098f3V0ya86VXhH7D4DmXinav5BFO32 sEqMPIi8ZA+nFrN2wgf4meii+UpHxBsFb3nCHQcdQ9cr+vndCnUz82xBh2T6j7poGuMmfZ YyZd3rIffDbUvsssBAgAir3jSZHm7mN2VlcxfR/pQi3ljsohKsgfN9y0k10F3A== 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=1783487827; 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=m8rH+OtOiB/CvCDx0/oyH9qvjZS3A1P/ncYPRXm8dYE=; b=fXGXiJaYe7ZTjniWSk3rhhnuIwTn7c/3C6HCA3f+CjW02QuyQ2QGLSlAhD/fzSyafXEdHU ax/zoy3Mi9HRxFsUuXMbblwPaTh5E9q+u056MWkMfKmW29+UQrl0zKCUp7+kHwwy3Q59Uf o4lNellNUsd7+kKvpY/A0L2r4IhgHhWVAvrQ/s8oRU1FwqyrGlv+ygqr1voAQZGZO9F5RB OnRqMOkf1piONp4LPmj5NZ+bnGhzh9hT2UHYwJEffkPRjPwf3MjyAqQnisFOGX8zb/j/Cl rX7Vqy1yua+AIQwY6n5R2EwH4sFuAWb8xfFSHpZ0AZY4Vx8kR8sAvxaEhG+igg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gw5tq1DX0z16kY for ; Wed, 08 Jul 2026 05:17:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3836b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 08 Jul 2026 05:17:01 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Ricardo Branco From: Warner Losh Subject: git: f723b28c9663 - main - reboot: fix openlog(3) calls 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f723b28c9663b70045e6db07f9fe72422a609c16 Auto-Submitted: auto-generated Date: Wed, 08 Jul 2026 05:17:01 +0000 Message-Id: <6a4ddd4d.3836b.3d24ead@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f723b28c9663b70045e6db07f9fe72422a609c16 commit f723b28c9663b70045e6db07f9fe72422a609c16 Author: Ricardo Branco AuthorDate: 2026-06-27 10:04:48 +0000 Commit: Warner Losh CommitDate: 2026-07-08 05:16:01 +0000 reboot: fix openlog(3) calls LOG_CONS was OR'd into the facility argument instead of logopt, leaving logopt as 0. The correct call is openlog(ident, LOG_CONS, LOG_AUTH), as shutdown(8) and init(8) already do. PR: 296315 Signed-off-by: Ricardo Branco Reviewed by: imp, des Pull Request: https://github.com/freebsd/freebsd-src/pull/2300 --- sbin/reboot/reboot.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c index a11f92453147..047646d8089e 100644 --- a/sbin/reboot/reboot.c +++ b/sbin/reboot/reboot.c @@ -421,19 +421,19 @@ main(int argc, char *argv[]) user = (pw = getpwuid(getuid())) ? pw->pw_name : "???"; if (dohalt) { - openlog("halt", 0, LOG_AUTH | LOG_CONS); + openlog("halt", LOG_CONS, LOG_AUTH); syslog(LOG_CRIT, "halted by %s", user); } else if (howto & RB_REROOT) { - openlog("reroot", 0, LOG_AUTH | LOG_CONS); + openlog("reroot", LOG_CONS, LOG_AUTH); syslog(LOG_CRIT, "rerooted by %s", user); } else if (howto & RB_POWEROFF) { - openlog("reboot", 0, LOG_AUTH | LOG_CONS); + openlog("reboot", LOG_CONS, LOG_AUTH); syslog(LOG_CRIT, "powered off by %s", user); } else if (howto & RB_POWERCYCLE) { - openlog("reboot", 0, LOG_AUTH | LOG_CONS); + openlog("reboot", LOG_CONS, LOG_AUTH); syslog(LOG_CRIT, "power cycled by %s", user); } else { - openlog("reboot", 0, LOG_AUTH | LOG_CONS); + openlog("reboot", LOG_CONS, LOG_AUTH); syslog(LOG_CRIT, "rebooted by %s", user); } } From nobody Wed Jul 8 05:17:03 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 4gw5tr3sQxz6khlR for ; Wed, 08 Jul 2026 05:17:08 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gw5tr2RKLz3tDM for ; Wed, 08 Jul 2026 05:17:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783487828; 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=OacgJVJlXG6cliBo/F1KPbEf1D8ziX+T52uSFMxLrEo=; b=dL8BdIordmX6jt1RM/f4BHIkI2IIfWOv8w47H05UwOnoZ3qJEV9qSHzVnTjFVE2YU4VHiy m+ZQXQTLwgnsE3iV1BnS9R9IuTK5irOK9VWFAKxbHt8wBMGAxSTIKmrHFmgg3qG92R8mtD WVJzDW4uWog2TtpSJZY3qWlxS8/k9/0NmpMWp3sEruVMYAPRudxefrQ9ETn/Y62Xe8RjFG AsPmRwP/mgVbx6m9r1Ea0ZurPs0lViaw8CAJ5SOjG7oYu6zG/F4LLzeFUriuiWB0CBx7pr oKnGsUgW1bdn2rdMpSl+rqnQMZH+dE+P06Oil+ZIPHV6yJB7BaPMEQzWXcllFA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783487828; a=rsa-sha256; cv=none; b=uzy0QQgRhmqVO4IDomGJw1Ipt7HME1ttHZ8yQxAy0gobQPnZiZ3cgvSWoEGZElR2UNTumD anjZXfEhiiYAcCN0+jI/rykMz5NAhkmzQdZ/ETTmsgiEVxe3bj8GaoFcO07lG5+K6cT6/a 2IaZEw7STOBTLqbF9NaFbnUYigVcNrwrnQmvc2q9NXpdK7qNLwpZjfMle3r7yCaAZhpb5w aW1Fa3NecbD3pMFT3oeEUFdVIMiEVhKZGWN/fw7cBeZgL5kvhxznqjVzw3eGwQyr6P97Kn eivsc0vGM3k/VE6i56/HyJ/9RC7blMM5j/4gQuhuKlSbcDnVp+Vu4SWGH8dfCg== 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=1783487828; 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=OacgJVJlXG6cliBo/F1KPbEf1D8ziX+T52uSFMxLrEo=; b=yyu6B5j6FruU52CHamnAqOEnBYOdkZuJZTqjGmvfJwmjbJh2AsYdzV/o07SBpELmuCWIzg GGi6oR/EV74B4uPkOpksNvPJEUOS1xyloGbcQOw31Qbj1/l3kRfm7Pi7T5QO/bkF8WOcD5 Xaq7Fsp9xzvxTDZkJI/lzR+n7jbzBIGIXxjwy0VaPRLzcf6NI7ZEYWX3P+9J4z4BhlXp1b edB7jll2y8Flca5R+FB8UmnivorxXKYzW80g3HyV4SFIlEF7qX1GMSsGZN4nC+19SKcxNA kQs29r42uTrGlOr5gtiwGJl7P+oxCWrqEy1or7/oGdv/O25LykQNIiLa46Xdag== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gw5tr1Pllz161G for ; Wed, 08 Jul 2026 05:17:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 372c2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 08 Jul 2026 05:17:03 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Ricardo Branco From: Warner Losh Subject: git: 3eb80d8d7daf - main - ufs: Allow read-only mounting of NetBSD FFSv2 WAPBL filesystems 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3eb80d8d7daf4f14c22dd462d8c4e5b6fc818bd4 Auto-Submitted: auto-generated Date: Wed, 08 Jul 2026 05:17:03 +0000 Message-Id: <6a4ddd4f.372c2.5cc2ceb7@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3eb80d8d7daf4f14c22dd462d8c4e5b6fc818bd4 commit 3eb80d8d7daf4f14c22dd462d8c4e5b6fc818bd4 Author: Ricardo Branco AuthorDate: 2026-06-13 08:26:58 +0000 Commit: Warner Losh CommitDate: 2026-07-08 05:16:01 +0000 ufs: Allow read-only mounting of NetBSD FFSv2 WAPBL filesystems Skip UFS2 fs_metaspace upper-bound validation that rejects NetBSD FFSv2 WAPBL filesystems due to differing superblock layouts. Detect the condition during mount instead and permit read-only mounts while rejecting read-write mounts with EROFS. This follows NetBSD's recommendation for systems without WAPBL support and avoids modifying unsupported journal metadata. PR: 296022 Signed-off-by: Ricardo Branco Reviewed by: imp, kirk Pull Request: https://github.com/freebsd/freebsd-src/pull/2279 --- sys/ufs/ffs/ffs_subr.c | 14 +++++++++++++- sys/ufs/ffs/ffs_vfsops.c | 27 +++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c index 682dd60ebd44..496de9913eda 100644 --- a/sys/ufs/ffs/ffs_subr.c +++ b/sys/ufs/ffs/ffs_subr.c @@ -717,7 +717,19 @@ validate_sblock(struct fs *fs, int flags) howmany(fs->fs_cssize, fs->fs_fsize), %jd); #endif WCHK(fs->fs_metaspace, <, 0, %jd); - WCHK(fs->fs_metaspace, >, fs->fs_fpg / 2, %jd); + /* + * FreeBSD and NetBSD FFSv2 layouts diverge in the superblock region + * following fs_maxbsize. NetBSD's WAPBL journal metadata occupies + * the same bytes as FreeBSD's fs_metaspace and other fields. + * fs_flags cannot serve as a discriminator: ffs_oldfscompat_read() + * may overwrite it from the 8-bit fs_old_flags before this check runs. + * Skip the upper-bound check for UFS2; ffs_mountfs() detects the + * condition and enforces read-only access without modifying the + * on-disk superblock. The check is preserved for UFS1 where no such + * layout divergence exists. + */ + if (fs->fs_magic != FS_UFS2_MAGIC) + WCHK(fs->fs_metaspace, >, fs->fs_fpg / 2, %jd); WCHK(fs->fs_minfree, >, 99, %jd%%); maxfilesize = fs->fs_bsize * UFS_NDADDR - 1; for (sizepb = fs->fs_bsize, i = 0; i < UFS_NIADDR; i++) { diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index a9b04bd290bd..f7f1d3e7ff93 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -604,6 +604,16 @@ ffs_mount(struct mount *mp) if (error) { return (error); } + /* + * Refuse upgrade of NetBSD WAPBL filesystem to + * read-write; see validate_sblock() for details. + */ + if (fs->fs_magic == FS_UFS2_MAGIC && + fs->fs_metaspace > fs->fs_fpg / 2) { + vfs_mount_error(mp, + "WAPBL filesystem must be mounted read-only"); + return (EROFS); + } fs->fs_flags &= ~FS_UNCLEAN; if (fs->fs_clean == 0) { fs->fs_flags |= FS_UNCLEAN; @@ -926,6 +936,23 @@ ffs_mountfs(struct vnode *odevvp, struct mount *mp, struct thread *td) ffs_use_bread); if (error != 0) goto out; + /* + * Per NetBSD's wapbl(4), systems without WAPBL support should mount it + * read-only; see validate_sblock() for details. + */ + if (fs->fs_magic == FS_UFS2_MAGIC && + fs->fs_metaspace > fs->fs_fpg / 2) { + if ((mp->mnt_flag & MNT_RDONLY) == 0) { + vfs_mount_error(mp, + "WAPBL filesystem must be mounted read-only"); + error = EROFS; + goto out; + } + printf("WARNING: %s: WAPBL filesystem mounted read-only" + "(fs_metaspace %jd, fs_fpg/2 %jd)\n", + mp->mnt_stat.f_mntonname, (intmax_t)fs->fs_metaspace, + (intmax_t)fs->fs_fpg / 2); + } fs->fs_flags &= ~FS_UNCLEAN; if (fs->fs_clean == 0) { fs->fs_flags |= FS_UNCLEAN; From nobody Wed Jul 8 05:42:04 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 4gw6Rc614Fz6kkQt for ; Wed, 08 Jul 2026 05:42:04 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gw6Rc5Dzkz3wyR for ; Wed, 08 Jul 2026 05:42:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783489324; 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=4LUXOZBe2+w4EiUKigbWBD1VqgZ7h+4GfgyvAHCYxBY=; b=fWSrR3WibNsqKv+xAq7tkyyFG/qnOoUksI+li9lGUFyZnlPeyO+RKoZJ5PXNLOJOgTW8O4 oMAru3YKgY18N4sjOPYupjRL27941h+Eqi9ZAV1Qvl98YkTkUGbJcp3drKok+wRNvRmmJ3 HUecNxuwB2wJzAkUUh+pWhXGhJSqF5dm9zfjiGHo2v2TPEdzGi+dzYEE2Lw5+qN7zMzD5F SXGNe/Tn9R7+WFIYuKPav6v+STLrKYlJ+4LHVbFbaDZM8P4Bk5DBJ4bO6COELAT1iJ8PXZ Q5g894e7vFhKMS5jtnrfkFX3j1QfXUfXY5NwYYSKFIUpSfj83jHOyI/63thfzw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783489324; a=rsa-sha256; cv=none; b=KNY2CPAObSyaylc9760zshCpLiCD+QZ3J2JQ5gD5dJ1xlzgIjRWKZxtlXb12pFMU1dbctY IEujFM8ctLfptvyviGQYwZhNLUT/8xm/hPPEEZ+sacbgZk0lNm7cvOpHvvjTt/tQ+nv3dc tPxqWjPDMLAgBe5KV9LJrALqSLWOuxZEgGYJao02EI3vjDpmRZb2ePCD38FaBEQ9DpESCH gVEdzJc7J+TtBTohGbB1v+xnFjKCow2EXzPCBoKqyv0b+dSd9ixxxYdEMXszCP11LnvUWT Ka3XsdyVWqvgkbd4AhNmPs+CHH05mjs4zFQ1Z88zd1P5dmT0q6zhNkK5gRUFyA== 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=1783489324; 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=4LUXOZBe2+w4EiUKigbWBD1VqgZ7h+4GfgyvAHCYxBY=; b=ProVT2gY8kIGqjPayWWV72q7m7ncwXZ2bX/rNQrphlU4CNCp1GqRyJuuVTHGNwzoNs0qDD 2LP0kRHTysLVkSpQp+XAEvunJ9bWr9/szRIkJbKONWUGOM6nkpHoGXGKc3rcotJVRXbVHZ eLyDs8mDzlxR2anro4HuR+n71qv22dFekLElQNtbQICD4l/xaCSJ4txS4RHyso48uAlk/0 yzRvFhSCZZK35ukry8YKH6T+R70Rb6oHyWhGdSFDyH7dtHXk59JBUvnEDQhAwklBJhP//j ExWTb4PJCyJg7KCg6xHkB/icFEuRpJfA04tOR3P5F/3gVkV+om6aMVJeR97+Xw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gw6Rc4Bqhz177B for ; Wed, 08 Jul 2026 05:42:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 38d5c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 08 Jul 2026 05:42:04 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Abdelkader Boudih From: Adrian Chadd Subject: git: f4825e91cf77 - main - fwcam: add dynamic resolution and frame rate support 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f4825e91cf77d6f0fa6c8d8407956e9e1c52f2df Auto-Submitted: auto-generated Date: Wed, 08 Jul 2026 05:42:04 +0000 Message-Id: <6a4de32c.38d5c.3773c47e@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=f4825e91cf77d6f0fa6c8d8407956e9e1c52f2df commit f4825e91cf77d6f0fa6c8d8407956e9e1c52f2df Author: Abdelkader Boudih AuthorDate: 2026-07-08 05:31:03 +0000 Commit: Adrian Chadd CommitDate: 2026-07-08 05:32:43 +0000 fwcam: add dynamic resolution and frame rate support Read V_MODE_INQ and V_RATE_INQ registers for all supported formats during probe, caching the camera's actual capabilities. Use these to validate SMODE ioctl requests before writing to the camera. Writing an unsupported combination caused the camera to stop responding, requiring a physical power cycle. Tested with: Apple iSight (external FireWire) Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58090 --- sys/dev/firewire/fwcam.c | 33 ++++++++++++++++++++++++++++++--- sys/dev/firewire/fwcam.h | 2 ++ 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/sys/dev/firewire/fwcam.c b/sys/dev/firewire/fwcam.c index 38a99c359c18..752558a1ecea 100644 --- a/sys/dev/firewire/fwcam.c +++ b/sys/dev/firewire/fwcam.c @@ -173,7 +173,7 @@ fwcam_format_name(int format) static int fwcam_read_capabilities(struct fwcam_softc *sc) { - int err; + int err, f, m; err = fwcam_read_quadlet(sc, IIDC_V_FORMAT_INQ, &sc->formats); if (err) { @@ -189,6 +189,30 @@ fwcam_read_capabilities(struct fwcam_softc *sc) return (err); } + /* Read mode and rate inquiry registers for each supported format */ + for (f = 0; f < 8; f++) { + if (!(sc->formats & (1 << (31 - f)))) { + sc->modes[f] = 0; + continue; + } + err = fwcam_read_quadlet(sc, IIDC_V_MODE_INQ(f), + &sc->modes[f]); + if (err) { + sc->modes[f] = 0; + continue; + } + for (m = 0; m < 8; m++) { + if (!(sc->modes[f] & (1 << (31 - m)))) { + sc->rates[f][m] = 0; + continue; + } + err = fwcam_read_quadlet(sc, IIDC_V_RATE_INQ(f, m), + &sc->rates[f][m]); + if (err) + sc->rates[f][m] = 0; + } + } + err = fwcam_read_quadlet(sc, IIDC_FEATURE_HI_INQ, &sc->features_hi); if (err) sc->features_hi = 0; @@ -815,10 +839,13 @@ fwcam_cdev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, if (mode->format > 7 || mode->mode > 7 || mode->framerate > 7) return (EINVAL); - if (mode->format != IIDC_FMT_VGA) - return (EINVAL); if (!(sc->formats & (1 << (31 - mode->format)))) return (EINVAL); + if (!(sc->modes[mode->format] & (1 << (31 - mode->mode)))) + return (EINVAL); + if (!(sc->rates[mode->format][mode->mode] & + (1 << (31 - mode->framerate)))) + return (EINVAL); FWCAM_LOCK(sc); if (sc->state == FWCAM_STATE_DETACHING) { diff --git a/sys/dev/firewire/fwcam.h b/sys/dev/firewire/fwcam.h index dcc871f2a249..ac72c8609f13 100644 --- a/sys/dev/firewire/fwcam.h +++ b/sys/dev/firewire/fwcam.h @@ -225,6 +225,8 @@ struct fwcam_softc { uint32_t basic_func; /* BASIC_FUNC_INQ */ uint32_t features_hi; /* FEATURE_HI_INQ */ uint32_t features_lo; /* FEATURE_LO_INQ */ + uint32_t modes[8]; /* V_MODE_INQ per format */ + uint32_t rates[8][8]; /* V_RATE_INQ per format/mode */ /* Current settings */ uint8_t cur_format; From nobody Wed Jul 8 05:42:05 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 4gw6Rf067Dz6kkXD for ; Wed, 08 Jul 2026 05:42:06 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gw6Rd6RzLz3wqQ for ; Wed, 08 Jul 2026 05:42:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783489325; 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=nsGhr7Wbvf57woYEHnaAXzdgm+iAKidGWUfHhgLvJO0=; b=vEnjrYZblZeRfe814bnI2EkQGGT9ZSI0MM/FgZGD0t/Kuh+ShJBUwCmuf/Gcvf9FZwHBuU PFY43usxzedPNAf4CaNNBR+GVMzXabUcYCvvynzmTIy6iYitSEfhcGZEhg6NQbrvwSKYqe c2WiudlPD3HV7JJDvbmrm3H22DJ2pDG5ikPgbM9KF9Fv77TbhpJXfjV7m9i/WokKP/6wY6 a3uL/BVjpBuTZBSXrp4AThyMP5UIQnFagLeIEll9ZvrQeOyghG1jmp81ElFKUNmaFrde3h JShlupoYhOTB+YDgiNzn2/SNe3L9hjlwT34gpZSEmfkYm/6g3HIJJ/9jywjOuw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783489325; a=rsa-sha256; cv=none; b=trENRDxvNB6UZY3clS64C050rVs5bbIBEBWWZsyvsXoqvMIrgcG6ErjAhSlYD5WzP3GqXO AoqqKNSqDAR2sHJxHadpfYxsBrDJrvhVmWhrhoKxvrorlEPUcaiTfjlYZ8FNR3JvOhypAZ x7pxpIZHZ7nNMWHUSCOEYk2iZQtaSIftKJKleKpkowQvvmrAaLPNLjZ3FqohXhx8n7V/Vn U3xb+hhUzACZIiNzT6tTqmj3cpkHpe3lr0Z41Z8IBrDF2L3ixkYJEUT0Voh74/WGBvT0JY xgpCLavPUyaU/U899d58WvJ5iam9DNHEaFuqtgTw74scgi4kBMP8IEcL7JO5+w== 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=1783489325; 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=nsGhr7Wbvf57woYEHnaAXzdgm+iAKidGWUfHhgLvJO0=; b=tTUTtjSDE7Uejjb95ggfSzbEOkIM27WKoRKSlbE5ZyVN6VuSk9F3JYWSkxYJKzAxER2kcK V1DxaH21o8fiq3byNTRI4EMmfyS3J756l9P/wevF7JTHzCHDUyvZ2E9VrB2Ga4NEpaYY66 e5Coz80yIhEyqRIw6k1S34/KY6iZsBU3qe9s7+CiY1tysLf01c9OB+ZaR47A2wDR9yDDI7 yBmUQRysi/nAxUscpgM1pAti00WV9g4nx0p+BrGOc/7U2jZXQuj0ihK8rVjwUXp1mbyqMk BO4TTaUetK7DSOlqSy2hJXDMfW5IMN8YaA6eDK5rX6JKXXJ80y8WZhWVlouk4A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gw6Rd4wqkz17LM for ; Wed, 08 Jul 2026 05:42:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 39cb4 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 08 Jul 2026 05:42:05 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Abdelkader Boudih From: Adrian Chadd Subject: git: 4e0fc4d44dc1 - main - fwcam: set ISO speed from device link speed 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4e0fc4d44dc18d0d3fd3d79f9074b068f2ee6eeb Auto-Submitted: auto-generated Date: Wed, 08 Jul 2026 05:42:05 +0000 Message-Id: <6a4de32d.39cb4.7d96b2a7@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=4e0fc4d44dc18d0d3fd3d79f9074b068f2ee6eeb commit 4e0fc4d44dc18d0d3fd3d79f9074b068f2ee6eeb Author: Abdelkader Boudih AuthorDate: 2026-07-08 05:31:22 +0000 Commit: Adrian Chadd CommitDate: 2026-07-08 05:32:44 +0000 fwcam: set ISO speed from device link speed iso_speed was never initialized, defaulting to S100 regardless of the camera's actual link speed. Some cameras firmwares reject ISO_EN when the speed field in the ISO_CHANNEL register does not match their capabilities. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58091 --- sys/dev/firewire/fwcam.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/firewire/fwcam.c b/sys/dev/firewire/fwcam.c index 752558a1ecea..251451bc289e 100644 --- a/sys/dev/firewire/fwcam.c +++ b/sys/dev/firewire/fwcam.c @@ -962,6 +962,7 @@ fwcam_post_explore(void *arg) sc->fwdev = fwdev; sc->cmd_hi = 0xffff; sc->cmd_lo = 0xf0000000 | (cmd_base << 2); + sc->iso_speed = min(fwdev->speed, FWSPD_S400); FWCAM_UNLOCK(sc); err = taskqueue_enqueue(taskqueue_thread, From nobody Wed Jul 8 05:42:06 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 4gw6Rh2wcJz6kkTQ for ; Wed, 08 Jul 2026 05:42:08 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gw6Rg0yQ8z3wqZ for ; Wed, 08 Jul 2026 05:42:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783489327; 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=H5oRxpDcRUgCas4mxIL8ztLbBdZXxJjI1DL2U1yRK5c=; b=ZDkGBDUYC6wm5ia8BYJ5eM/lp3/LB2NuiUMpC3ovRm5AonwPOABMSKjxU4GzyeSWssQ4I4 XNiadf0mv5GAiSYbQqS8OhsJ35cffVhCmAGM7909U7eTAPUYjcaW1xzgzReejd9Qz2HPmv 3BUAK25fCmJDV43dT4hBlmAjMFOiZdLNhIhuYEQbPG6vXIsvTJ4ocn8GmKuHiujRG5Df0Y 6g4iA9RagnQl/nT5ydFnVkxfwrqkWS0iUkymxx/Q0JsQBdMa8mEf5md/bRAaQgGMpalhWt 4TWR0VPuom2ttcm8/DAaiXXm1JL5QK6m6NaC+BhibsmkC6rs3CLAFb6xsfHaxQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783489327; a=rsa-sha256; cv=none; b=FEsGf9T5rglACaVbGp7IYAQPhURGL0ESLqorMASy0DwbVM3XjHM1T3qJPYmjXFB9NT80xQ ndmV1A5JgPTC7fH4SxYxrH8HF4UWepQf5/eDNYcv8CXfxrO1qh9TtM8fWEWtlpAkRbRIis OTI9ciOzdpi9hhU6vDppxX6NUgGzftJzMPTaO3fLGbF/CqlVzvGg/2j3V57kFCfVuOzQo7 Tbcr05QAzwZzNMh0qDidh6A0KCm9rOfVERpuySP4oP+jUv7Q6LwGt/ZOGZAJ2EhodD0EwC /VnNjmFJvHUJPPYIbbzXpzQVKMd/9V4LtkQ7I/YPxravV2ldclH3TIkI5bkdDg== 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=1783489327; 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=H5oRxpDcRUgCas4mxIL8ztLbBdZXxJjI1DL2U1yRK5c=; b=pQGLPiDgPsGnAucS3Jv+lxewWP6y8WXiisIITprA5XQgSHkIDVtH4UtOPOOXLxncX6LtiW Rl9Utxjg0YCif6MB173EaVaS5TYAUN1+N7ZrB+7/7NAgPDKNTs1KWOSFRNEaQiRDw6BSgv 0c41KbsAZI6F/7lLKWYZdJtuZoM8IEwPlBJgxtFbbK26ilcxn7/Q8tpd+/avI5iBFfvEVi ml4JSFIPZ4A8Yudea8bv0WpO1lIFgGNQVq1P4sCPj4NnkfOcNFOJC1kHqkMz6taahf18SE e5O48szXWQR1k2jqGx4z/3/jeFYZ5Qu8RgP3LAH4VPhs5m/3h99XlMzzucJ1UQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gw6Rf5m4Tz17XW for ; Wed, 08 Jul 2026 05:42:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3a8b5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 08 Jul 2026 05:42:06 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Abdelkader Boudih From: Adrian Chadd Subject: git: 84044a77a620 - main - fwcam: write video mode registers before enabling ISO streaming 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 84044a77a620751d104f772345be66445ebe4fe0 Auto-Submitted: auto-generated Date: Wed, 08 Jul 2026 05:42:06 +0000 Message-Id: <6a4de32e.3a8b5.ae93d4b@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=84044a77a620751d104f772345be66445ebe4fe0 commit 84044a77a620751d104f772345be66445ebe4fe0 Author: Abdelkader Boudih AuthorDate: 2026-07-08 05:31:32 +0000 Commit: Adrian Chadd CommitDate: 2026-07-08 05:32:44 +0000 fwcam: write video mode registers before enabling ISO streaming The IIDC spec (s3.1) requires the video mode to be programmed before ISO enable. Without this, cameras that power up with invalid default mode/rate combinations reject the ISO_EN write. This can happen when the firmware of teh camera is outdated or vendor never updated it. Differential Revision: https://reviews.freebsd.org/D58092 --- sys/dev/firewire/fwcam.c | 40 +++++++++++++++++++++++++++++++++++++--- sys/dev/firewire/fwcam.h | 7 +++++++ 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/sys/dev/firewire/fwcam.c b/sys/dev/firewire/fwcam.c index 251451bc289e..226295154e6e 100644 --- a/sys/dev/firewire/fwcam.c +++ b/sys/dev/firewire/fwcam.c @@ -406,6 +406,40 @@ fwcam_iso_start(struct fwcam_softc *sc) sc->frame_ready = 0; sc->frame_dropped = 0; + /* IIDC spec s3.1: set video mode registers before ISO enable */ + err = fwcam_write_quadlet(sc, IIDC_CUR_V_FORMAT, + (uint32_t)sc->cur_format << IIDC_CUR_V_SHIFT); + if (err) { + device_printf(sc->fd.dev, + "failed to set CUR_V_FORMAT: %d\n", err); + goto fail; + } + err = fwcam_write_quadlet(sc, IIDC_CUR_V_MODE, + (uint32_t)sc->cur_mode << IIDC_CUR_V_SHIFT); + if (err) { + device_printf(sc->fd.dev, + "failed to set CUR_V_MODE: %d\n", err); + goto fail; + } + err = fwcam_write_quadlet(sc, IIDC_CUR_V_FRM_RATE, + (uint32_t)sc->cur_framerate << IIDC_CUR_V_SHIFT); + if (err) { + device_printf(sc->fd.dev, + "failed to set CUR_V_FRM_RATE: %d\n", err); + goto fail; + } + + /* Check Vmode_Error_Status - camera rejects ISO_EN on error */ + err = fwcam_read_quadlet(sc, IIDC_VMODE_ERR_STATUS, &val); + if (err == 0 && (val & IIDC_VMODE_ERROR)) { + device_printf(sc->fd.dev, + "Vmode_Error_Status set: format=%d mode=%d rate=%d " + "speed=%d\n", sc->cur_format, sc->cur_mode, + sc->cur_framerate, sc->iso_speed); + err = EINVAL; + goto fail; + } + val = ((uint32_t)sc->iso_channel << IIDC_ISO_CH_SHIFT) | ((uint32_t)sc->iso_speed << IIDC_ISO_SPEED_SHIFT); err = fwcam_write_quadlet(sc, IIDC_ISO_CHANNEL, val); @@ -863,13 +897,13 @@ fwcam_cdev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, FWCAM_UNLOCK(sc); err = fwcam_write_quadlet(sc, IIDC_CUR_V_FORMAT, - (uint32_t)mode->format << 29); + (uint32_t)mode->format << IIDC_CUR_V_SHIFT); if (err == 0) err = fwcam_write_quadlet(sc, IIDC_CUR_V_MODE, - (uint32_t)mode->mode << 29); + (uint32_t)mode->mode << IIDC_CUR_V_SHIFT); if (err == 0) err = fwcam_write_quadlet(sc, IIDC_CUR_V_FRM_RATE, - (uint32_t)mode->framerate << 29); + (uint32_t)mode->framerate << IIDC_CUR_V_SHIFT); if (err == 0) { sc->cur_format = mode->format; diff --git a/sys/dev/firewire/fwcam.h b/sys/dev/firewire/fwcam.h index ac72c8609f13..841683bbc37d 100644 --- a/sys/dev/firewire/fwcam.h +++ b/sys/dev/firewire/fwcam.h @@ -53,6 +53,13 @@ #define IIDC_ONE_SHOT 0x61C #define IIDC_MEM_SAVE_CH 0x620 #define IIDC_CUR_MEM_CH 0x624 +#define IIDC_VMODE_ERR_STATUS 0x628 + +/* Cur_V_Format / Cur_V_Mode / Cur_V_Frm_Rate register fields */ +#define IIDC_CUR_V_SHIFT 29 /* bits [0..2] */ + +/* Vmode_Error_Status register */ +#define IIDC_VMODE_ERROR (1 << 31) /* bit [0]: mode error */ /* Section 1.7 - Status and control register for features */ #define IIDC_BRIGHTNESS 0x800 From nobody Wed Jul 8 05:42:07 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 4gw6Rj64pZz6kkbV for ; Wed, 08 Jul 2026 05:42:09 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gw6Rh0nm0z3xFc for ; Wed, 08 Jul 2026 05:42:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783489328; 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=Lmc6Vn0CtZkQZ7mBF7kiUIMSedw8PLJKprCuvfMFofM=; b=BYZNqkh6AFeMw9Uk0O1Mqk4jf+xlinV3YUSvy11WcupQ4y657TQii1BxSI8BgEvFOVYt3x B2BWaqDQEpJK/OTBjLvFSp22gKfSwOkUsIDZ7BrZmEeipuK/sdhUqOjqYLBKXdVkVZDVUn MoEbTGVj8klY6q8mT/fH2svbW6zlq0aUvx+TJTJAW5NEu8VgtkX860EM4VNC9EJdHZp0Z0 CnhcWE8A7x7FIHq4GQg5ZwXOXkJuEGNp9RbQj/bY2qIRAqFumDGWu8UKTMzIyJkxzmbgP4 /KKFlPF3de/NzbNclebHJ3JyV9JbbpiJZhbTrsfqd4CUx9XQ+Nt9eyd1361aUA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783489328; a=rsa-sha256; cv=none; b=rtz5VXkiLqmocsKU0gxzUgLVkg20hIEGwvDuVilVtPIhx/Ze0nBqW2SABDF2xNqoOwvdqO AXDslLZrf8EcNfBIBJcEVeEdKUc/AjgYwt7/dLRyISpmkwLEDcFMti4g9RVFSlrkJau1P/ aA4g5GwKe+B+n/Qk76WyoGvjv/hiazalmQBPfyodScsaTmnyUnTkMvPY9Hkoupiz11NQYO LYlsQgNRL+paEk5ADR9Y328y6uNhBYRCaOm4u97jGehMHXpN1SdpbdkGJyV1+FHSKem70m IXxMqcA7yP3Q3qfrwR/BcnGcwrRqcSy9SEuTL9ot+M2jyqJNbM89k8X21GE9Gg== 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=1783489328; 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=Lmc6Vn0CtZkQZ7mBF7kiUIMSedw8PLJKprCuvfMFofM=; b=NGzDLUKaVPlfqRqjYD0B8v/VE74hZ+BWpVv+Z9kY2PafJD7kx9mpV58zi2nnfwJpa71bSN 49pJ3jMq5DHbt4DX4o8YqlE6JITEWCuL8IOcZqYH4ooprflz0ue4aWdZMCJWZNoCzXTqsA Oa79Vcv3KPFhZE4kCDZn/v5bs2JtWg7WF0i+/xggAxOPOkH3eE7k6S+3z6HH+udjm7Jvkm 3vvuxpKrOymZUsQZDoDTIlVwMiLH4qHvQKmsWW2qzyqBwAUgE1MQthd//NoqYiot+75lTU zJabEMIiGjZNuOp+KvV3u55I4fIH7tEf5A7I1g3ksjTWYKzxkzAZCAFjCdDeHg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gw6Rg6bwWz17LN for ; Wed, 08 Jul 2026 05:42:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3af0e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 08 Jul 2026 05:42:07 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Abdelkader Boudih From: Adrian Chadd Subject: git: 94f24c0ee239 - main - fwcamctl: add control utility for fwcam(4) IIDC FireWire cameras 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 94f24c0ee23964f751fabc908a7564a388c9d1a1 Auto-Submitted: auto-generated Date: Wed, 08 Jul 2026 05:42:07 +0000 Message-Id: <6a4de32f.3af0e.64256412@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=94f24c0ee23964f751fabc908a7564a388c9d1a1 commit 94f24c0ee23964f751fabc908a7564a388c9d1a1 Author: Abdelkader Boudih AuthorDate: 2026-07-08 05:31:46 +0000 Commit: Adrian Chadd CommitDate: 2026-07-08 05:32:44 +0000 fwcamctl: add control utility for fwcam(4) IIDC FireWire cameras fwcamctl provides userland access to /dev/fwcam0. Supported subcommands: info (camera state, format, mode, rate, features), snap (capture a frame as PPM), mode (set format/mode/rate), and feat (get/set camera feature registers). snap converts YUV422, YUV411, YUV444, RGB8, and Mono8 pixel formats to RGB24 PPM with no external dependencies. A configurable frame skip (default 5) allows auto-exposure and auto-white-balance to settle before capture. (from adrian - yes, I've successfully captured images from an Apple isight camera on firewire with this tool and in-tree support.) Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D57914 --- sys/dev/firewire/fwcam.c | 21 -- sys/dev/firewire/fwcam.h | 64 ++++++ usr.sbin/Makefile | 1 + usr.sbin/fwcamctl/Makefile | 9 + usr.sbin/fwcamctl/fwcamctl.8 | 156 +++++++++++++++ usr.sbin/fwcamctl/fwcamctl.c | 450 +++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 680 insertions(+), 21 deletions(-) diff --git a/sys/dev/firewire/fwcam.c b/sys/dev/firewire/fwcam.c index 226295154e6e..27451316d613 100644 --- a/sys/dev/firewire/fwcam.c +++ b/sys/dev/firewire/fwcam.c @@ -149,27 +149,6 @@ fwcam_write_quadlet(struct fwcam_softc *sc, uint32_t offset, uint32_t val) return (err); } -#if 0 -static const char * -fwcam_format_name(int format) -{ - static const char *names[] = { - "VGA (Format_0)", - "Super VGA 1 (Format_1)", - "Super VGA 2 (Format_2)", - "Reserved", - "Reserved", - "Reserved", - "Still Image (Format_6)", - "Partial Image (Format_7)", - }; - - if (format >= 0 && format <= 7) - return (names[format]); - return ("Unknown"); -} -#endif - static int fwcam_read_capabilities(struct fwcam_softc *sc) { diff --git a/sys/dev/firewire/fwcam.h b/sys/dev/firewire/fwcam.h index 841683bbc37d..79b0dd3b5ec6 100644 --- a/sys/dev/firewire/fwcam.h +++ b/sys/dev/firewire/fwcam.h @@ -207,6 +207,70 @@ struct fwcam_info { #define FWCAM_STATE_STREAMING 2 #define FWCAM_STATE_DETACHING 3 +/* IIDC format/mode/rate/feature/state name tables for userland and driver */ +#define FWCAM_FMT_NMAX 8 +#define FWCAM_RATE_NMAX 8 + +static const char * const fwcam_fmt_names[FWCAM_FMT_NMAX] = { + "VGA (Format_0)", + "Super VGA 1 (Format_1)", + "Super VGA 2 (Format_2)", + "Reserved", + "Reserved", + "Reserved", + "Still Image (Format_6)", + "Partial Image (Format_7)", +}; + +static const char * const fwcam_rate_names[FWCAM_RATE_NMAX] = { + "1.875 fps", "3.75 fps", "7.5 fps", "15 fps", + "30 fps", "60 fps", "120 fps", "240 fps", +}; + +static const char * const fwcam_feat_names[FWCAM_FEAT_MAX] = { + [FWCAM_FEAT_BRIGHTNESS] = "brightness", + [FWCAM_FEAT_AUTO_EXPOSURE] = "auto_exposure", + [FWCAM_FEAT_SHARPNESS] = "sharpness", + [FWCAM_FEAT_WHITE_BALANCE] = "white_balance", + [FWCAM_FEAT_HUE] = "hue", + [FWCAM_FEAT_SATURATION] = "saturation", + [FWCAM_FEAT_GAMMA] = "gamma", + [FWCAM_FEAT_SHUTTER] = "shutter", + [FWCAM_FEAT_GAIN] = "gain", + [FWCAM_FEAT_IRIS] = "iris", + [FWCAM_FEAT_FOCUS] = "focus", + [FWCAM_FEAT_TEMPERATURE] = "temperature", + [FWCAM_FEAT_TRIGGER] = "trigger", + [FWCAM_FEAT_ZOOM] = "zoom", + [FWCAM_FEAT_PAN] = "pan", + [FWCAM_FEAT_TILT] = "tilt", +}; + +static const char * const fwcam_state_names[] = { + [FWCAM_STATE_IDLE] = "idle", + [FWCAM_STATE_PROBED] = "probed", + [FWCAM_STATE_STREAMING] = "streaming", + [FWCAM_STATE_DETACHING] = "detaching", +}; + +/* Format_0 (VGA non-compressed) mode geometry */ +struct fwcam_fmt0_mode { + int w, h; + const char *pixfmt; +}; + +#define FWCAM_FMT0_NMODES 7 + +static const struct fwcam_fmt0_mode fwcam_fmt0_modes[FWCAM_FMT0_NMODES] = { + { 160, 120, "YUV444" }, /* mode 0 */ + { 320, 240, "YUV422" }, /* mode 1 */ + { 640, 480, "YUV411" }, /* mode 2 */ + { 640, 480, "YUV422" }, /* mode 3 */ + { 640, 480, "RGB8" }, /* mode 4 */ + { 640, 480, "Mono8" }, /* mode 5 */ + { 640, 480, "Mono16" }, /* mode 6 */ +}; + /* * Internal constants */ diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index 9e885d5d45c5..c55592c926a4 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -27,6 +27,7 @@ SUBDIR= adduser \ extattrctl \ fifolog \ fstyp \ + fwcamctl \ fwcontrol \ fwget \ getfmac \ diff --git a/usr.sbin/fwcamctl/Makefile b/usr.sbin/fwcamctl/Makefile new file mode 100644 index 000000000000..127639c7e91f --- /dev/null +++ b/usr.sbin/fwcamctl/Makefile @@ -0,0 +1,9 @@ +PROG= fwcamctl +SRCS= fwcamctl.c +MAN= fwcamctl.8 +WARNS?= 3 + +SDIR= ${SRCTOP}/sys +CFLAGS+= -I${SDIR} + +.include diff --git a/usr.sbin/fwcamctl/fwcamctl.8 b/usr.sbin/fwcamctl/fwcamctl.8 new file mode 100644 index 000000000000..389117bcc9d0 --- /dev/null +++ b/usr.sbin/fwcamctl/fwcamctl.8 @@ -0,0 +1,156 @@ +.\" Copyright (c) 2026 Abdelkader Boudih +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.Dd May 27, 2026 +.Dt FWCAMCTL 8 +.Os +.Sh NAME +.Nm fwcamctl +.Nd control utility for IIDC FireWire cameras +.Sh SYNOPSIS +.Nm +.Op Fl f Ar device +.Cm info +.Nm +.Op Fl f Ar device +.Cm snap +.Op Fl o Ar output.ppm +.Op Fl s Ar skip +.Nm +.Op Fl f Ar device +.Cm mode +.Ar format mode rate +.Nm +.Op Fl f Ar device +.Cm feat get +.Ar id +.Nm +.Op Fl f Ar device +.Cm feat set +.Ar id value Op Ar value2 +.Sh DESCRIPTION +The +.Nm +utility controls IIDC 1394-based digital cameras via the +.Xr fwcam 4 +driver. +.Pp +The following options are available: +.Bl -tag -width indent +.It Fl f Ar device +Specify the camera device. +Defaults to +.Pa /dev/fwcam0 . +.El +.Pp +The subcommands are: +.Bl -tag -width indent +.It Cm info +Display camera state, current format/mode/framerate, supported formats, +basic function capabilities, and present features. +.It Cm snap Op Fl o Ar output.ppm Op Fl s Ar skip +Capture a single video frame and write it as a PPM image. +.Pp +.Bl -tag -width indent -compact +.It Fl o Ar output.ppm +Output file path. +Use +.Sq - +for stdout. +Defaults to +.Pa snap.ppm . +.It Fl s Ar skip +Number of frames to skip before capturing, to allow auto-exposure +and auto-white-balance to settle. +Defaults to 5. +.El +.Pp +Supported pixel formats: YUV444, YUV422, YUV411, RGB8, Mono8. +The frame is converted to RGB24 and written as a binary PPM (P6). +.It Cm mode Ar format mode rate +Set the camera video format, mode, and frame rate. +All arguments are integer indices per the IIDC specification. +Only Format_0 (VGA) is currently supported by the +.Xr fwcam 4 +frame assembly path. +.Pp +Format_0 modes: +.Bl -column "Mode" "Resolution" "Pixel format" -compact +.It Em Mode Ta Em Resolution Ta Em Pixel format +.It 0 Ta 160x120 Ta YUV444 +.It 1 Ta 320x240 Ta YUV422 +.It 2 Ta 640x480 Ta YUV411 +.It 3 Ta 640x480 Ta YUV422 +.It 4 Ta 640x480 Ta RGB8 +.It 5 Ta 640x480 Ta Mono8 +.El +.Pp +Frame rates: 0=1.875 1=3.75 2=7.5 3=15 4=30 5=60 fps. +.It Cm feat get Ar id +Query the camera feature with the given numeric ID and display its +inquiry (presence, on/off, auto, manual, range) and current value. +.It Cm feat set Ar id value Op Ar value2 +Set the camera feature with the given numeric ID to +.Ar value . +For the +.Sq white_balance +feature (id 3), +.Ar value +is the U/B component and +.Ar value2 +is the V/R component. +.El +.Pp +Feature IDs: +.Bl -column "ID" "Name" -compact +.It Em ID Ta Em Name +.It 0 Ta brightness +.It 1 Ta auto_exposure +.It 2 Ta sharpness +.It 3 Ta white_balance +.It 4 Ta hue +.It 5 Ta saturation +.It 6 Ta gamma +.It 7 Ta shutter +.It 8 Ta gain +.It 9 Ta iris +.It 10 Ta focus +.It 11 Ta temperature +.It 12 Ta trigger +.It 13 Ta zoom +.It 14 Ta pan +.It 15 Ta tilt +.El +.Sh EXAMPLES +Show camera information: +.Bd -literal -offset indent +fwcamctl info +.Ed +.Pp +Capture a photo to +.Pa photo.ppm , +skipping 10 frames for AE to settle: +.Bd -literal -offset indent +fwcamctl snap -o photo.ppm -s 10 +.Ed +.Pp +Switch to 320x240 YUV422 at 30 fps: +.Bd -literal -offset indent +fwcamctl mode 0 1 4 +.Ed +.Pp +Read the current gain value: +.Bd -literal -offset indent +fwcamctl feat get 8 +.Ed +.Pp +Set brightness to 200: +.Bd -literal -offset indent +fwcamctl feat set 0 200 +.Ed +.Sh SEE ALSO +.Xr fwcam 4 , +.Xr fwcontrol 8 +.Sh AUTHORS +.An Abdelkader Boudih Aq Mt freebsd@seuros.com diff --git a/usr.sbin/fwcamctl/fwcamctl.c b/usr.sbin/fwcamctl/fwcamctl.c new file mode 100644 index 000000000000..af484c39dee6 --- /dev/null +++ b/usr.sbin/fwcamctl/fwcamctl.c @@ -0,0 +1,450 @@ +/* + * Copyright (c) 2026 Abdelkader Boudih + * + * SPDX-License-Identifier: BSD-2-Clause + * + * fwcamctl - control utility for fwcam(4) IIDC FireWire cameras + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +static const char *default_dev = "/dev/fwcam0"; + +static void +usage(void) +{ + fprintf(stderr, + "usage: fwcamctl [-f device] info\n" + " fwcamctl [-f device] snap [-o output.ppm] [-s skip]\n" + " fwcamctl [-f device] mode \n" + " fwcamctl [-f device] feat get \n" + " fwcamctl [-f device] feat set [value2]\n" + "\n" + " Feature IDs: 0=brightness 1=auto_exposure 2=sharpness\n" + " 3=white_balance 4=hue 5=saturation 6=gamma\n" + " 7=shutter 8=gain 9=iris 10=focus 11=temperature\n" + " 12=trigger 13=zoom 14=pan 15=tilt\n"); + exit(1); +} + +static inline int +clamp_u8(int v) +{ + if (v < 0) return (0); + if (v > 255) return (255); + return (v); +} + +/* + * IIDC YUV 4:2:2 → RGB24 + * IIDC spec layout: U0 Y0 V0 Y1 (UYVY, 2 pixels per 4 bytes) + */ +static void +yuv422_to_rgb(const uint8_t *src, uint8_t *dst, int w, int h) +{ + int i, n = w * h / 2; + + for (i = 0; i < n; i++) { + int cb = src[0] - 128; + int y0 = src[1]; + int cr = src[2] - 128; + int y1 = src[3]; + src += 4; + + /* pixel 0 */ + dst[0] = clamp_u8(y0 + (int)(1.402f * cr)); + dst[1] = clamp_u8(y0 - (int)(0.34414f * cb) - (int)(0.71414f * cr)); + dst[2] = clamp_u8(y0 + (int)(1.772f * cb)); + /* pixel 1 */ + dst[3] = clamp_u8(y1 + (int)(1.402f * cr)); + dst[4] = clamp_u8(y1 - (int)(0.34414f * cb) - (int)(0.71414f * cr)); + dst[5] = clamp_u8(y1 + (int)(1.772f * cb)); + dst += 6; + } +} + +/* + * IIDC YUV 4:1:1 → RGB24 + * Layout: U0 Y0 Y1 V0 Y2 Y3 (4 pixels per 6 bytes) + */ +static void +yuv411_to_rgb(const uint8_t *src, uint8_t *dst, int w, int h) +{ + int i, j, n = w * h / 4; + + for (i = 0; i < n; i++) { + int cb = src[0] - 128; + int y[4]; + y[0] = src[1]; + y[1] = src[2]; + int cr = src[3] - 128; + y[2] = src[4]; + y[3] = src[5]; + src += 6; + + for (j = 0; j < 4; j++) { + *dst++ = clamp_u8(y[j] + (int)(1.402f * cr)); + *dst++ = clamp_u8(y[j] - (int)(0.34414f * cb) - (int)(0.71414f * cr)); + *dst++ = clamp_u8(y[j] + (int)(1.772f * cb)); + } + } +} + +/* + * IIDC YUV 4:4:4 → RGB24 + * Layout: U Y V (3 bytes/pixel) + */ +static void +yuv444_to_rgb(const uint8_t *src, uint8_t *dst, int w, int h) +{ + int i, n = w * h; + + for (i = 0; i < n; i++) { + int cb = src[0] - 128; + int y = src[1]; + int cr = src[2] - 128; + src += 3; + + *dst++ = clamp_u8(y + (int)(1.402f * cr)); + *dst++ = clamp_u8(y - (int)(0.34414f * cb) - (int)(0.71414f * cr)); + *dst++ = clamp_u8(y + (int)(1.772f * cb)); + } +} + +static int +write_ppm(const char *path, const uint8_t *rgb, int w, int h) +{ + FILE *f; + + if (strcmp(path, "-") == 0) { + f = stdout; + } else { + f = fopen(path, "wb"); + if (f == NULL) { + warn("fopen %s", path); + return (-1); + } + } + + fprintf(f, "P6\n%d %d\n255\n", w, h); + if (fwrite(rgb, 1, (size_t)(w * h * 3), f) != (size_t)(w * h * 3)) { + warn("fwrite"); + if (f != stdout) + fclose(f); + return (-1); + } + + if (f != stdout) + fclose(f); + return (0); +} + +static int +do_snap(int fd, const char *outpath, int skip) +{ + struct fwcam_info info; + uint8_t *frame_buf, *rgb_buf; + uint32_t rgb_size; + ssize_t n; + int w, h, i; + const char *pixfmt; + + if (ioctl(fd, FWCAM_GINFO, &info) < 0) + err(1, "FWCAM_GINFO"); + + if (info.frame_size == 0) + errx(1, "frame_size is 0 — camera not yet probed?"); + + if (info.cur_format != IIDC_FMT_VGA || + info.cur_mode >= nitems(fwcam_fmt0_modes)) + errx(1, "unsupported format %d mode %d for snap " + "(only Format_0 VGA supported)", + info.cur_format, info.cur_mode); + + w = fwcam_fmt0_modes[info.cur_mode].w; + h = fwcam_fmt0_modes[info.cur_mode].h; + pixfmt = fwcam_fmt0_modes[info.cur_mode].pixfmt; + + if (strcmp(pixfmt, "Mono16") == 0) + errx(1, "Mono16 not supported for PPM output"); + + rgb_size = (uint32_t)(w * h * 3); + frame_buf = malloc(info.frame_size); + rgb_buf = malloc(rgb_size); + if (frame_buf == NULL || rgb_buf == NULL) + err(1, "malloc"); + + /* Read frames; skip the first N to let AE/AWB settle */ + for (i = 0; i <= skip; i++) { + n = read(fd, frame_buf, info.frame_size); + if (n < 0) + err(1, "read"); + if ((uint32_t)n < info.frame_size) + errx(1, "short read: got %zd of %u bytes", + n, info.frame_size); + if (i < skip) + fprintf(stderr, "skipping frame %d/%d...\n", i + 1, skip); + } + + /* Convert to RGB24 */ + if (strcmp(pixfmt, "YUV422") == 0) { + yuv422_to_rgb(frame_buf, rgb_buf, w, h); + } else if (strcmp(pixfmt, "YUV411") == 0) { + yuv411_to_rgb(frame_buf, rgb_buf, w, h); + } else if (strcmp(pixfmt, "YUV444") == 0) { + yuv444_to_rgb(frame_buf, rgb_buf, w, h); + } else if (strcmp(pixfmt, "RGB8") == 0) { + memcpy(rgb_buf, frame_buf, rgb_size); + } else if (strcmp(pixfmt, "Mono8") == 0) { + for (i = 0; i < w * h; i++) { + rgb_buf[i * 3 + 0] = frame_buf[i]; + rgb_buf[i * 3 + 1] = frame_buf[i]; + rgb_buf[i * 3 + 2] = frame_buf[i]; + } + } else { + errx(1, "no converter for pixel format %s", pixfmt); + } + + if (write_ppm(outpath, rgb_buf, w, h) < 0) { + free(frame_buf); + free(rgb_buf); + return (1); + } + + fprintf(stderr, "saved %s (%dx%d %s, %u bytes raw)\n", + outpath, w, h, pixfmt, info.frame_size); + + free(frame_buf); + free(rgb_buf); + return (0); +} + +static void +do_info(int fd) +{ + struct fwcam_info info; + int i; + + if (ioctl(fd, FWCAM_GINFO, &info) < 0) + err(1, "FWCAM_GINFO"); + + printf("state: %s\n", + info.state < nitems(fwcam_state_names) ? + fwcam_state_names[info.state] : "unknown"); + printf("cur format: %d (%s)\n", info.cur_format, + info.cur_format < nitems(fwcam_fmt_names) ? + fwcam_fmt_names[info.cur_format] : "?"); + + if (info.cur_format == IIDC_FMT_VGA && + info.cur_mode < nitems(fwcam_fmt0_modes)) { + printf("cur mode: %d (%dx%d %s)\n", info.cur_mode, + fwcam_fmt0_modes[info.cur_mode].w, + fwcam_fmt0_modes[info.cur_mode].h, + fwcam_fmt0_modes[info.cur_mode].pixfmt); + } else { + printf("cur mode: %d\n", info.cur_mode); + } + + printf("cur rate: %d (%s)\n", info.cur_framerate, + info.cur_framerate < nitems(fwcam_rate_names) ? + fwcam_rate_names[info.cur_framerate] : "?"); + printf("iso_channel: %u\n", info.iso_channel); + printf("frame_size: %u bytes\n", info.frame_size); + printf("dropped: %u frames\n", info.frame_dropped); + + printf("formats: 0x%08x (", info.formats); + for (i = 0; i < 8; i++) { + if (info.formats & (1 << (31 - i))) + printf("F%d ", i); + } + printf(")\n"); + + printf("basic_func: 0x%08x", info.basic_func); + if (info.basic_func & IIDC_CAM_POWER_CTRL) printf(" [power_ctrl]"); + if (info.basic_func & IIDC_ONE_SHOT_INQ) printf(" [one_shot]"); + if (info.basic_func & IIDC_MULTI_SHOT_INQ) printf(" [multi_shot]"); + printf("\n"); + + printf("features: hi=0x%08x lo=0x%08x\n", + info.features_hi, info.features_lo); + if (info.features_hi) { + printf(" "); + if (info.features_hi & IIDC_HAS_BRIGHTNESS) printf("brightness "); + if (info.features_hi & IIDC_HAS_AUTO_EXPOSURE) printf("auto_exp "); + if (info.features_hi & IIDC_HAS_SHARPNESS) printf("sharpness "); + if (info.features_hi & IIDC_HAS_WHITE_BALANCE) printf("white_bal "); + if (info.features_hi & IIDC_HAS_HUE) printf("hue "); + if (info.features_hi & IIDC_HAS_SATURATION) printf("saturation "); + if (info.features_hi & IIDC_HAS_GAMMA) printf("gamma "); + if (info.features_hi & IIDC_HAS_SHUTTER) printf("shutter "); + if (info.features_hi & IIDC_HAS_GAIN) printf("gain "); + if (info.features_hi & IIDC_HAS_IRIS) printf("iris "); + if (info.features_hi & IIDC_HAS_FOCUS) printf("focus "); + if (info.features_hi & IIDC_HAS_TEMPERATURE) printf("temperature "); + if (info.features_hi & IIDC_HAS_TRIGGER) printf("trigger "); + printf("\n"); + } +} + +static void +do_mode(int fd, int argc, char **argv) +{ + struct fwcam_mode mode; + + if (argc < 3) + usage(); + + mode.format = (uint8_t)atoi(argv[0]); + mode.mode = (uint8_t)atoi(argv[1]); + mode.framerate = (uint8_t)atoi(argv[2]); + mode.frame_size = 0; + mode._pad = 0; + + if (ioctl(fd, FWCAM_SMODE, &mode) < 0) + err(1, "FWCAM_SMODE"); + + printf("mode set: format=%d mode=%d framerate=%d frame_size=%u\n", + mode.format, mode.mode, mode.framerate, mode.frame_size); +} + +static void +do_feat_get(int fd, int feat_id) +{ + struct fwcam_feature feat; + + if (feat_id < 0 || feat_id >= FWCAM_FEAT_MAX) + errx(1, "invalid feature id %d (0-%d)", feat_id, FWCAM_FEAT_MAX - 1); + + memset(&feat, 0, sizeof(feat)); + feat.id = (uint32_t)feat_id; + + if (ioctl(fd, FWCAM_GFEAT, &feat) < 0) + err(1, "FWCAM_GFEAT"); + + printf("feature %d (%s):\n", feat_id, + fwcam_feat_names[feat_id] != NULL ? fwcam_feat_names[feat_id] : "?"); + printf(" present: %s\n", + (feat.flags & FWCAM_FEATF_PRESENT) ? "yes" : "no"); + printf(" flags: 0x%x", feat.flags); + if (feat.flags & FWCAM_FEATF_ONOFF) printf(" [on/off]"); + if (feat.flags & FWCAM_FEATF_AUTO) printf(" [auto]"); + if (feat.flags & FWCAM_FEATF_MANUAL) printf(" [manual]"); + printf("\n"); + printf(" range: %u - %u\n", feat.min, feat.max); + + if (feat_id == FWCAM_FEAT_WHITE_BALANCE) + printf(" value: U/B=%u V/R=%u\n", feat.value, feat.value2); + else + printf(" value: %u\n", feat.value); +} + +static void +do_feat_set(int fd, int feat_id, uint32_t value, uint32_t value2) +{ + struct fwcam_feature feat; + + if (feat_id < 0 || feat_id >= FWCAM_FEAT_MAX) + errx(1, "invalid feature id %d (0-%d)", feat_id, FWCAM_FEAT_MAX - 1); + + memset(&feat, 0, sizeof(feat)); + feat.id = (uint32_t)feat_id; + feat.value = value; + feat.value2 = value2; + + if (ioctl(fd, FWCAM_SFEAT, &feat) < 0) + err(1, "FWCAM_SFEAT"); + + printf("feature %d (%s) set to %u\n", feat_id, + fwcam_feat_names[feat_id] != NULL ? fwcam_feat_names[feat_id] : "?", value); +} + +int +main(int argc, char *argv[]) +{ + const char *devpath = default_dev; + int fd, ch; + + while ((ch = getopt(argc, argv, "f:")) != -1) { + switch (ch) { + case 'f': + devpath = optarg; + break; + default: + usage(); + } + } + argc -= optind; + argv += optind; + + if (argc < 1) + usage(); + + fd = open(devpath, O_RDWR); + if (fd < 0) + err(1, "open %s", devpath); + + if (strcmp(argv[0], "info") == 0) { + do_info(fd); + + } else if (strcmp(argv[0], "snap") == 0) { + const char *out = "snap.ppm"; + int skip = 5; + + /* re-parse the snap subcommand's own flags */ + optreset = 1; + optind = 1; + while ((ch = getopt(argc, argv, "o:s:")) != -1) { + switch (ch) { + case 'o': + out = optarg; + break; + case 's': + skip = atoi(optarg); + break; + default: + usage(); + } + } + do_snap(fd, out, skip); + + } else if (strcmp(argv[0], "mode") == 0) { + do_mode(fd, argc - 1, argv + 1); + + } else if (strcmp(argv[0], "feat") == 0) { + if (argc < 3) + usage(); + + int feat_id = atoi(argv[2]); + + if (strcmp(argv[1], "get") == 0) { + do_feat_get(fd, feat_id); + } else if (strcmp(argv[1], "set") == 0) { + if (argc < 4) + usage(); + uint32_t val = (uint32_t)atoi(argv[3]); + uint32_t val2 = (argc > 4) ? (uint32_t)atoi(argv[4]) : 0; + do_feat_set(fd, feat_id, val, val2); + } else { + usage(); + } + + } else { + warnx("unknown command: %s", argv[0]); + usage(); + } + + close(fd); + return (0); +} From nobody Wed Jul 8 05:42:03 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 4gw6Rj6pDsz6kkwN for ; Wed, 08 Jul 2026 05:42:09 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gw6Rh6LXsz3xFm for ; Wed, 08 Jul 2026 05:42:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783489328; 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=vbBfkkjv52M7nTzIkkkccDn424Dehg0S5VQlKp1KzmM=; b=K2GT5vMCtZXz9FOFhN0Y8+HZ/sU+IgWBQs419X+V1DM+lTeGaY3GVmJkMLfo0//wvwlIOW Xv7CK7G/43p1Vp18eZgL2W0IDqffYyqkpizHDHO3MYRx8cP+4bfWKvQh881LP5EMNMgjIk t2C0xOH0hYlda9hKZ71+yXLBsgk7Ih8zdCF6vcXT/Gukn14ZAba4g7cxCswmiH9kmOwrYZ s0+q4O3CD8CgxF4mRUrPDp0NUmVDBTNMyb8kbfFWvavA8DKhXWHibYuQWclGh8INCWGMPo I/J7k6uZu0WG1KvSN2VRNCmZuOAuSq675VMnyHzqkSrRXStiFugCtXINCuU00Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783489328; a=rsa-sha256; cv=none; b=F+8nHjr3i6hyTR914Do2F1cBApLGhmJAxSX3XxEEsJQ7ehro4PaJTpBYFqFW8BsVEtwd6K A7rS036QDUkwyQ+IKSlw33SiU0+8is+1m9vAkiidwjnrVWN2S+J+7f5FQy0cEH0WjpBJNU pvqtJ9OpoBgOGPFNoz3gmme74VVILGW0f1I7iPxrmNFQuL33DJGyAIN2+QaqYMmyspj0/F lrZNTuRnASshLqZ8AGKMARLwSmNPwrMPhQgds2I2VJSc3P28xBou1yEbVHcQ7yPKX7ie3Y 6ZSyQKNQZ15T2a0XVpxRHkbTs9raMA3ahQIobIA1kr9yVYt2uQGQ9twhAGNGjQ== 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=1783489328; 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=vbBfkkjv52M7nTzIkkkccDn424Dehg0S5VQlKp1KzmM=; b=cgsYUquI9BrcN+NzZBJaUJ9dhQ7G2dzHy8su3TKz4HT6FK2unJfU9gegrxgPiXKg9VxHjB ircQ4/fav+3rL9hfyAO0qYGbG8dlCugt9UXsJpBXpYP79JkMSpWWqX6Ia+HRmFZUMEtkAs WeyhJbkHSNvr3+E+H6yAue1R8k1DAFEWtXzZpsmN5+3O1pfI0UGKr1SYJ+pftnOQjlvMzm 85k72AkFFci5tIYC2lCvLJ/ECISxmvHt6t7EEqGqCt8lp9L4w3lA7aadrtPLT8FG9ed1/W hUzTlsHdVZcLFV/BkYe1xqNok2L3pcMx8E6xTp1LIo0RNrDyZhHrYg9S1SkThg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gw6Rh57C6z174G for ; Wed, 08 Jul 2026 05:42:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3b20b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 08 Jul 2026 05:42:03 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Abdelkader Boudih From: Adrian Chadd Subject: git: 4b3d03566821 - main - fwohci: fix LPS delay, PHY_INT storm, and SID timeout recovery 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4b3d035668211c19fc6fd5d4d207c2e8f96e7ad3 Auto-Submitted: auto-generated Date: Wed, 08 Jul 2026 05:42:03 +0000 Message-Id: <6a4de32b.3b20b.589193a8@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=4b3d035668211c19fc6fd5d4d207c2e8f96e7ad3 commit 4b3d035668211c19fc6fd5d4d207c2e8f96e7ad3 Author: Abdelkader Boudih AuthorDate: 2026-07-08 05:30:44 +0000 Commit: Adrian Chadd CommitDate: 2026-07-08 05:32:43 +0000 fwohci: fix LPS delay, PHY_INT storm, and SID timeout recovery Fixed the post-LPS delay from 500us to the IEEE 1394a-2000 s6.1 mandated 10ms ceiling. Handled PHY_INT by clearing W1C status bits in register 5 (masked ISBR to avoid spurious bus resets). Added a SID timeout callout that recovers the state machine when a remote device fails to complete self-ID. Fixed FW_PHY_SPD operator precedence and gated noisy messages behind bootverbose/firewire_debug. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58033 --- sys/dev/firewire/fwohci.c | 59 ++++++++++++++++++++++++++++++++++++++------ sys/dev/firewire/fwohcivar.h | 3 +++ 2 files changed, 54 insertions(+), 8 deletions(-) diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index eeb35bb94b42..245edb1f8fe4 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -155,6 +155,7 @@ void fwohci_txbufdb (struct fwohci_softc *, int , struct fw_bulkxfer *); static void fwohci_task_busreset(void *, int); static void fwohci_task_sid(void *, int); static void fwohci_task_dma(void *, int); +static void fwohci_sid_timeout(void *); /* * memory allocated for DMA programs @@ -427,17 +428,20 @@ fwohci_probe_phy(struct fwohci_softc *sc, device_t dev) * It is not actually available port on your PC . */ OWRITE(sc, OHCI_HCCCTL, OHCI_HCC_LPS); - DELAY(500); + /* IEEE 1394a-2000 s6.1: PHY reset completes within 10 ms of LPS. */ + DELAY(10000); reg = fwphy_rddata(sc, FW_PHY_SPD_REG); if ((reg >> 5) != 7) { sc->fc.mode &= ~FWPHYASYST; sc->fc.nport = reg & FW_PHY_NP; - sc->fc.speed = reg & FW_PHY_SPD >> 6; + sc->fc.speed = (reg & FW_PHY_SPD) >> 6; if (sc->fc.speed > MAX_SPEED) { - device_printf(dev, "invalid speed %d (fixed to %d).\n", - sc->fc.speed, MAX_SPEED); + if (bootverbose) + device_printf(dev, + "invalid speed %d (fixed to %d).\n", + sc->fc.speed, MAX_SPEED); sc->fc.speed = MAX_SPEED; } device_printf(dev, @@ -449,8 +453,10 @@ fwohci_probe_phy(struct fwohci_softc *sc, device_t dev) sc->fc.nport = reg & FW_PHY_NP; sc->fc.speed = (reg2 & FW_PHY_ESPD) >> 5; if (sc->fc.speed > MAX_SPEED) { - device_printf(dev, "invalid speed %d (fixed to %d).\n", - sc->fc.speed, MAX_SPEED); + if (bootverbose) + device_printf(dev, + "invalid speed %d (fixed to %d).\n", + sc->fc.speed, MAX_SPEED); sc->fc.speed = MAX_SPEED; } device_printf(dev, @@ -762,6 +768,7 @@ fwohci_init(struct fwohci_softc *sc, device_t dev) TASK_INIT(&sc->fwohci_task_busreset, 2, fwohci_task_busreset, sc); TASK_INIT(&sc->fwohci_task_sid, 1, fwohci_task_sid, sc); TASK_INIT(&sc->fwohci_task_dma, 0, fwohci_task_dma, sc); + callout_init_mtx(&sc->sid_timeout_callout, FW_GMTX(&sc->fc), 0); fw_init(&sc->fc); fwohci_reset(sc, dev); @@ -804,6 +811,7 @@ fwohci_detach(struct fwohci_softc *sc, device_t dev) fwohci_db_free(&sc->it[i]); fwohci_db_free(&sc->ir[i]); } + callout_drain(&sc->sid_timeout_callout); if (sc->fc.taskqueue != NULL) { taskqueue_drain(sc->fc.taskqueue, &sc->fwohci_task_busreset); taskqueue_drain(sc->fc.taskqueue, &sc->fwohci_task_sid); @@ -1824,7 +1832,8 @@ fwohci_intr_core(struct fwohci_softc *sc, uint32_t stat, int count) /* Disable bus reset interrupt until sid recv. */ OWRITE(sc, FWOHCI_INTMASKCLR, OHCI_INT_PHY_BUS_R); - device_printf(fc->dev, "%s: BUS reset\n", __func__); + if (sc->sid_timeout_count == 0 || firewire_debug) + device_printf(fc->dev, "%s: BUS reset\n", __func__); OWRITE(sc, FWOHCI_INTMASKCLR, OHCI_INT_CYC_LOST); OWRITE(sc, OHCI_LNKCTLCLR, OHCI_CNTL_CYCSRC); @@ -1835,6 +1844,10 @@ fwohci_intr_core(struct fwohci_softc *sc, uint32_t stat, int count) if (!kdb_active) taskqueue_enqueue(sc->fc.taskqueue, &sc->fwohci_task_busreset); + + /* SID watchdog: recover if self-ID never completes. */ + callout_reset(&sc->sid_timeout_callout, hz / 2, + fwohci_sid_timeout, sc); } if (stat & OHCI_INT_PHY_SID) { /* Enable bus reset interrupt */ @@ -1902,6 +1915,8 @@ fwohci_intr_core(struct fwohci_softc *sc, uint32_t stat, int count) } fc->status = FWBUSINIT; + callout_stop(&sc->sid_timeout_callout); + sc->sid_timeout_count = 0; if (!kdb_active) taskqueue_enqueue(sc->fc.taskqueue, &sc->fwohci_task_sid); @@ -1982,7 +1997,13 @@ fwohci_intr_dma(struct fwohci_softc *sc, uint32_t stat, int count) device_printf(fc->dev, "unrecoverable error\n"); } if (stat & OHCI_INT_PHY_INT) { - device_printf(fc->dev, "phy int\n"); + uint32_t r5; + + /* Clear W1C interrupt bits; mask ISBR(6) to avoid bus reset. */ + r5 = fwphy_rddata(sc, 5); + if (firewire_debug) + device_printf(fc->dev, "phy int: reg5=0x%02x\n", r5); + fwphy_wrdata(sc, 5, (r5 & ~(1 << 6)) | 0x3c); } } @@ -2039,6 +2060,28 @@ fwohci_task_sid(void *arg, int pending) fw_drain_txq(fc); fw_sidrcv(fc, buf, plen); free(buf, M_FW); + +} + +/* SelfID timeout: called with FW_GLOCK held (callout_init_mtx). */ +static void +fwohci_sid_timeout(void *arg) +{ + struct fwohci_softc *sc = arg; + struct firewire_comm *fc = &sc->fc; + + FW_GLOCK_ASSERT(fc); + if (fc->status != FWBUSRESET) + return; + + sc->sid_timeout_count++; + if (sc->sid_timeout_count == 1) + device_printf(fc->dev, "SelfID timeout, retrying\n"); + + /* Reset state machine so next bus reset is recognized. */ + fc->status = FWBUSINIT; + OWRITE(sc, FWOHCI_INTSTATCLR, OHCI_INT_PHY_BUS_R); + OWRITE(sc, FWOHCI_INTMASK, OHCI_INT_PHY_BUS_R); } static void diff --git a/sys/dev/firewire/fwohcivar.h b/sys/dev/firewire/fwohcivar.h index 754d61bb3513..a9e7e06b5590 100644 --- a/sys/dev/firewire/fwohcivar.h +++ b/sys/dev/firewire/fwohcivar.h @@ -36,6 +36,7 @@ * */ +#include #include typedef struct fwohci_softc { @@ -71,6 +72,8 @@ typedef struct fwohci_softc { struct task fwohci_task_busreset; struct task fwohci_task_sid; struct task fwohci_task_dma; + struct callout sid_timeout_callout; /* fires if SID phase doesn't complete */ + int sid_timeout_count; /* consecutive SID timeouts */ int cycle_lost; } fwohci_softc_t; From nobody Wed Jul 8 06:05:19 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 4gw6yT2Zfpz6kmL8; Wed, 08 Jul 2026 06:05:21 +0000 (UTC) (envelope-from des@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gw6yT24kyz41sP; Wed, 08 Jul 2026 06:05:21 +0000 (UTC) (envelope-from des@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783490721; 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: in-reply-to:in-reply-to:references:references; bh=AbTvLg6P4jnV8NB9ukXJLS6/3xl01wOds/9WZAe6Dzg=; b=OdZyHZiOsOtWJK0FZUg1oIPr0b8uUkjv281SFjySHvRiiSZSGiptgQ9XbCbA2Wq+qWI+3C XzNuyIxlcal5DQ3AgPWqpv/4GBJ/FckFsTkeElrZex0ycrbE8tV1E5BR1+GdR1Gsj1GoPW GwvpVV5/Wl0l7DYdIm+tvs4j256NJk3qddkVNXQbvWtgRuNWd269Y94FtqYtbkf3qWoCs8 VMns44LuhSMSbxGUBxNWUpYQ6BCu6cit68Lw/BK8trA/QpixRBYz3OynJ65ROvywlZxTbb MNrLmRbHpzXNGpEvhp+xBEy9s77PC6+3Sekuh/pe/mKHfwREJA8Q6iYDKcnQLQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783490721; a=rsa-sha256; cv=none; b=W1nN0eDwzQemrwpKLBaTIIi+cyHlFD+yh84FLWFci+gyesXfRK8LAmVuzxPi/G0pFvqeM3 uL+0djHiqnOiavHqwzlxYAMkUtpiTAmuTDZxxkEu+ZTU+rzlN5IvBMb89I6kBmFeCNqCb6 4WGnZjhRsZZBel+zUn9wrFkfbwgMXZ2gAK0Tb1Au4sqwlfuKBwfSs39mLc595mboauBGPN UiOUExLJQ4xOPM8L+DBvflDGjQJSOVMZt50LGhQJxBaIEQ9pFT69UpQ2YGfbaser6z3X4d TDNdImTWu2C5SBN6iEmWVm+Y0anmrT+cuJd1d36/OYGgjoCZ6EYoGu01zO5aZg== 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=1783490721; 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: in-reply-to:in-reply-to:references:references; bh=AbTvLg6P4jnV8NB9ukXJLS6/3xl01wOds/9WZAe6Dzg=; b=jtZnpoMmFYGYQ3zqcJPaAYN6DLzqgnnGOiSKD8j2X7oxlAeyw+vc4GEKeal47tbWxcSL+H e/lWEJP2J5TzwCWpIPvArGgMvQYRn8qk8FV4tUQ7ZOTTV8Klm7MtHR4kJnP0/PICy2n2T9 3lVHbrvmWJVYsZRS20xnO49+7cIIc+bTw/1ij9O6/lQu25PINTRoNs9bcvqccSb9HVyAwv CvSupcC2lazEAXXChTmbxcc/SxB0d3dyd0pnuxG74MmHsjQ9YtzZyd0t1WoEY++jUuvglu 5MwbmDPTuSjRPLcbs1ZkZs3Uru7RGZptLse6Czqh6zFL+k/7mSqJZrreriBJgA== Received: from ltc.des.dev (2a01cb0585070b00922e16fffef1acef.ipv6.abo.wanadoo.fr [IPv6:2a01:cb05:8507:b00:922e:16ff:fef1:acef]) (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) (Authenticated sender: des/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gw6yS6wVgzZMv; Wed, 08 Jul 2026 06:05:20 +0000 (UTC) (envelope-from des@freebsd.org) Received: by ltc.des.dev (Postfix, from userid 1001) id 9B110AC1A4; Wed, 08 Jul 2026 08:05:19 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Konstantin Belousov Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: c20558e5c9da - main - pdfork.2: document pddupfd() In-Reply-To: <6a4d8b99.27665.176ec2bf@gitrepo.freebsd.org> (Konstantin Belousov's message of "Tue, 07 Jul 2026 23:28:25 +0000") References: <6a4d8b99.27665.176ec2bf@gitrepo.freebsd.org> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Wed, 08 Jul 2026 08:05:19 +0200 Message-ID: <86ldbm3tk0.fsf@ltc.des.dev> 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: quoted-printable Konstantin Belousov writes: > .Pp > +The > +.Fn pddupfd function > +allows the caller to duplicate a file descriptor across the process > +boundaries. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@FreeBSD.org From nobody Wed Jul 8 06:09:58 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 4gw73p3mGDz6klxM for ; Wed, 08 Jul 2026 06:09: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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gw73p2whnz42Vf for ; Wed, 08 Jul 2026 06:09:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783490998; 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=cVh2KJavyATUlhZtVyhdPs5Lzx8n20foVKhDAEXI29Q=; b=SgAqxwFgUqa0WOUVtcmomSBg85y7TLt/Yq18Ivi4h7hYcCGjqSUez9fNok7eYfaG9AGKKl fjfnI++P/6TqPH1wFaTuP6JzXgSXcxICJBZqjRNX5oxg7km8Fz5fPqN3Xamj7TNwwV2uRH 3ON0Wo1DwrLeRU7cuEbgRGSS8CIQxuPTnEZ6JtfOSdCf1REWhrO/1bK0Lt7sdMXBu3+Ga5 NxfP/y2xw7D3ZV3FxmFbhPgVD8UFJImwhAaFaw4wOArcB61/vQNNW03vVeCmLagEP0cZQ0 HHLhOy8XDaIejbB8jUWNYAWd5k5z08IAKOL9QuGO4prc3a8oj4+SmzcEpV0YmA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783490998; a=rsa-sha256; cv=none; b=L2Wcq5AaRyHzm1ZDMWGeVfsFDQChM9Aq2dERPuzrN+p0dkJsMXc9KHfsBDAmhK+/1Y/Nzr 6uKoHxJyApKRDHshiIJvWAW7f0z6GqdwY/23g3FvUtb6KPpqqmv+zYPMUN5fb613GKwoQE bed4pXL36QrSJ+dlPgKpfuJwLJ6fEwEX92XPbZQM/oT6sCnYnHTxgqUHdhS7PL8RL2eUVo mdlzFRgGlQ0vx4sH8fJO3rZsgHTpx3pqC8W9ODqwkyGebLmHiuJM+TBk7DePjx5dESxolz doo4SQCHxpTYse+BxeaxEXl2wF9mlXcZ27nLgKUaefwQX7iiwuHIkdE541+ahg== 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=1783490998; 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=cVh2KJavyATUlhZtVyhdPs5Lzx8n20foVKhDAEXI29Q=; b=pgEuKq3ZGoD7ZgVaeaKQSfj9PDmzCHRfdYaqHbfSCgR3VYuFCKAQ81Ci52RibOYbUqlcBi q2oVOaW2hyOXspj3T7ObtA/mSukTSXog6rgUSALigdwOC5EenAV9PNNlVVEBkRIvsH9EYB UCBlmC+4EZarKzSMgk3wBwxyi8D+w004WcM6LBPltVmJyqS2rnaUemuO6lLgVt8zh7NVNC I9Kz9GAFsh7Qn6tTGgHwM66PtpBO7oS3Mt5yHKbu07ZkRgCpS9KLINXlTrH1dPqpo3fsNg w5st0U9dm2JFw7RKKRWmFcCRTIIHsBE2KErWlFxIJ2XV7lQWDV3KlwCxUJGgbQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gw73p1cdcz175C for ; Wed, 08 Jul 2026 06:09:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3c7ab by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 08 Jul 2026 06:09:58 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: a2426d1cd89e - main - pdfork.2: grammar 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a2426d1cd89e8cee08612951c133663dd8834838 Auto-Submitted: auto-generated Date: Wed, 08 Jul 2026 06:09:58 +0000 Message-Id: <6a4de9b6.3c7ab.56b1edce@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a2426d1cd89e8cee08612951c133663dd8834838 commit a2426d1cd89e8cee08612951c133663dd8834838 Author: Konstantin Belousov AuthorDate: 2026-07-08 06:08:55 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-08 06:09:32 +0000 pdfork.2: grammar Submitted by: des MFC after: 1 week --- lib/libsys/pdfork.2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libsys/pdfork.2 b/lib/libsys/pdfork.2 index a6bf8534003d..584c87e17e38 100644 --- a/lib/libsys/pdfork.2 +++ b/lib/libsys/pdfork.2 @@ -181,8 +181,8 @@ system call for the behavior specification. .Pp The .Fn pddupfd -allows the caller to duplicate a file descriptor across the process -boundaries. +function allows the caller to duplicate a file descriptor +across the process boundaries. The function returns the new file descriptor that points to the same file as the file descriptor .Fa remotefd From nobody Wed Jul 8 07:52:10 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 4gw9Kl04Hhz6kvnb for ; Wed, 08 Jul 2026 07:52:11 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gw9Kk63tbz4JFf for ; Wed, 08 Jul 2026 07:52:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783497130; 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=iGo0PRTL8M3dwtgAKVUpaf5agcHCWwbgG2pUSTzBqDQ=; b=E3z9ag428OGwLehO2ZBA/RMn+ao5EB35+orFr7BYdMxvTr9OBTP5YXj26JgbIov050Q1kM Nyh12QxO+RRSNvtTeD2oW5sIDpfVmLCPwkbHREjz+UvAr8UZ0rlttj1qs5c1neI7+BgyUW QPxfMCr/n3Y3VT3cbYZdqj61dziBb1DtMi+tRsp6SfNdyJOehaDiHh6sKjBEW+gz6fNDaE osQm93psFUPlxQuI+YcGnOCSvm9cp+QWgbeMOoulXVOJKja8Xu/qq+1SxHqfUVC8sz7Hso Gn1c9YAIYz3kyND1LsSE4hQNCW/ITmJQiYhuhOpXs8V3cOx8bNvv7Wi8BYc9OA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783497130; a=rsa-sha256; cv=none; b=LcZ5z+d6+9dmYbBSeHFQeWcOSjCH5T+ynuCBsj16YnKR+ra6xFV0pvz6/jij0LMVELkFmd 6/9ev5rSYC04L77rbJ/M0ZzJhEcYLT5BXxg9GjzKJ1eae5IBch5K/F8OnTzS/7TEf6XYf3 NhAvuY0ME+lux4T1vouV/7eNOFlkY4Ui3Req3c6nMfIUDwXOrLMWpnlsCgevCI5+MGoo4T LcIVzfQ39TRZoYMCvp67LFfK6oK2oQvh4kB0JVQPZIgLaZCNZYh71YU9f/mH6ZpIX89TAN Mp4uEE3lygWncBmoJXTLJxxcdW9OlWQZ1NJOgi8pdugn69+teRvbIXtw0DOqpQ== 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=1783497130; 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=iGo0PRTL8M3dwtgAKVUpaf5agcHCWwbgG2pUSTzBqDQ=; b=EYoUd94BnVxf8h2w6rC5qNfSv9EoDk5bTGnaPTw5o/p2/+KjsMsEVqUCevX0y0Wgf9rB0e Z3xXXTYsvpK9qmY72To7/dBTqMit9gVV0K8id2T1Ub2l6uihKlCzp6DurYPmcCGR/PDRh+ cs3krWCGWrQOB6XV/yYA//8FY+ArsBuG+T74DnEJ3Sq5GZFx9OR91L89nIoNH0/b2IZWFQ lEfS4/uwbLBWmpthtw+bc6chaB5scJamurXtxHepMOSuHv98BmypfOB+endpFI5l3lXfvu +RTw+4IQ2qaE+bOje7ttdxe6AjlKc1aG/dD7TJdgK9OmLmUxtRviORbxBKd7Bg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gw9Kk4yyvz1B81 for ; Wed, 08 Jul 2026 07:52:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 18343 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 08 Jul 2026 07:52:10 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: KUROSAWA Takahiro From: Kristof Provost Subject: git: 6a5ba658dd48 - main - tests/sendfile: move the helper program to common 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6a5ba658dd480206187776e3c25d9f710fac90fd Auto-Submitted: auto-generated Date: Wed, 08 Jul 2026 07:52:10 +0000 Message-Id: <6a4e01aa.18343.5201aeaa@gitrepo.freebsd.org> The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6a5ba658dd480206187776e3c25d9f710fac90fd commit 6a5ba658dd480206187776e3c25d9f710fac90fd Author: KUROSAWA Takahiro AuthorDate: 2026-07-07 19:09:06 +0000 Commit: Kristof Provost CommitDate: 2026-07-08 07:23:16 +0000 tests/sendfile: move the helper program to common In order to reuse the sendfile_helper program in pf tests, move it to tests/sys/common directory, indicatint that it is also used from another places than sys/kern. Also make the readlen variable static. Reviewed by: gelbius, kp Differential Revision: https://reviews.freebsd.org/D58040 --- ObsoleteFiles.inc | 3 +++ tests/sys/common/Makefile | 4 ++++ tests/sys/{kern => common}/sendfile_helper.c | 2 +- tests/sys/kern/Makefile | 2 -- tests/sys/kern/sendfile_test.sh | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 39690870a444..ce7ef62c0da9 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -51,6 +51,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20260707: Move sendfile_helper to tests/sys/common +OLD_FILES+=usr/tests/sys/kern/sendfile_helper + # 20260707: Removed GNU subtree OLD_FILES+=usr/tests/gnu/Kyuafile OLD_FILES+=usr/tests/gnu/lib/Kyuafile diff --git a/tests/sys/common/Makefile b/tests/sys/common/Makefile index 269aa9d52f9a..e42e9537f1a8 100644 --- a/tests/sys/common/Makefile +++ b/tests/sys/common/Makefile @@ -9,4 +9,8 @@ ${PACKAGE}FILESMODE_divert.py=0555 ${PACKAGE}FILESMODE_sender.py=0555 ${PACKAGE}FILESMODE_net_receiver.py=0555 +BINDIR= ${TESTSDIR} +PROGS+= sendfile_helper +LIBADD.sendfile_helper+= pthread + .include diff --git a/tests/sys/kern/sendfile_helper.c b/tests/sys/common/sendfile_helper.c similarity index 99% rename from tests/sys/kern/sendfile_helper.c rename to tests/sys/common/sendfile_helper.c index 6365531e312c..c92a194bff2d 100644 --- a/tests/sys/kern/sendfile_helper.c +++ b/tests/sys/common/sendfile_helper.c @@ -43,7 +43,7 @@ #include static char buf[1024*1024]; -ssize_t readlen; +static ssize_t readlen; static volatile bool read_done = false; static int diff --git a/tests/sys/kern/Makefile b/tests/sys/kern/Makefile index f7e06968520a..f7f5d1825e01 100644 --- a/tests/sys/kern/Makefile +++ b/tests/sys/kern/Makefile @@ -92,7 +92,6 @@ ${PACKAGE}FILESMODE_sonewconn_overflow.py=0555 BINDIR= ${TESTSDIR} PROGS+= coredump_phnum_helper PROGS+= pdeathsig_helper -PROGS+= sendfile_helper CFLAGS.aslr+= -I${SRCTOP}/tests LIBADD.aslr+= util @@ -116,7 +115,6 @@ LIBADD.procdesc+= kvm pthread LIBADD.shutdown_dgram+= pthread LIBADD.socket_msg_waitall+= pthread LIBADD.socket_splice+= pthread -LIBADD.sendfile_helper+= pthread LIBADD.fdgrowtable_test+= util pthread kvm procstat LIBADD.sigwait+= rt LIBADD.ktrace_test+= sysdecode diff --git a/tests/sys/kern/sendfile_test.sh b/tests/sys/kern/sendfile_test.sh index 7e549eec610a..b2e329126d85 100755 --- a/tests/sys/kern/sendfile_test.sh +++ b/tests/sys/kern/sendfile_test.sh @@ -38,7 +38,7 @@ MD_DEVS="md.devs" MNT=mnt FILE=$MNT/file -HELPER="$(atf_get_srcdir)/sendfile_helper" +HELPER="$(atf_get_srcdir)/../common/sendfile_helper" BSIZE=4096 atf_test_case io_success cleanup From nobody Wed Jul 8 07:52:11 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 4gw9Km37MPz6kvNZ for ; Wed, 08 Jul 2026 07:52:12 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gw9Km0MFHz4JHk for ; Wed, 08 Jul 2026 07:52:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783497132; 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=uT26PmD34n15c+wNHfbh4Oj9cqq7sZ9lnBI9tOmkLqs=; b=M1+iMQUh7CoRnhz/VM5Ns+vzPjuGXt4A5iH/karTg2Vm4yZ8eCQtERufeHNcL+6vYZX4pf btajYslc1+dXdfyAdWlOqAmtNTre7exL9A92bR9be1rHeTWWuu0rudCwxgkZPNFTN4okEF PD4b7v4qpOKhU4c1OfUKYiw7gqlpYxR8qpKz1QWooOEQo3pPqMZxuwRQxlVz+9yDWiTsW7 V1vvd8nGZOAtwJ3LkwIbTW3tq+9ECFV+ZdNe35A/ihcpH3b7i9/i9jI4DPfsp3Z77pRY1K k/FAxtCG8/EE3H3HUDDD0dYgOdVV0U7ZTt1A8GdU86oKjydOT8UBnA2yK+V9xw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783497132; a=rsa-sha256; cv=none; b=pRusUaNRwPde5zBxpd2MUidgtmFAF5hBCLkL7B85tLjzYMiLSaE0C1vDs6mcuIm2AJJ3lN S8CsbldgmC4/asKfDKTLtOdOHryHU1RGs2PdOXyYxrLrVCGK/TzY/AaYs4KFZPLshtdAnw VEqOrXIHriSkzDQH6o5tVbiluTKSW0U4ToOgZfc+SCtzW3tfEJNURf0JUFVBwGKmkcw8BX PGYZcdAKqJfsw62923xxxBfjARxwNcNa1rVW8Qf0PvR9DZjP507SUMsjRz3DHrSzK4Fyzc C+HYBkqaOt912wHBSt6a8Tty2O4F5dDthtBqKlFz3Xgz/MdMZ6vAoMgvePljLA== 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=1783497132; 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=uT26PmD34n15c+wNHfbh4Oj9cqq7sZ9lnBI9tOmkLqs=; b=wEa1K7hg1zC9AglxpLJAbEKaLCBjfXE202QAtCnRs65RYNg3GahxylZ6uxU/lxvBgKQGUM jOj0Y3n1+ihBbAayDIJh69+I2i+2ViIrT4xsOO1luJCkYvT3Tv7sG5crwayDxHrpoXh+B5 vZASDVYKQj8LXEHj3Y4cBmUO8RkO+TDKp/SuRG9sCPQEDOUykHE6UWTSsEu4XvJr0C+MGD Hx3prdICgAX0epXcL+bNZiSPz7X3cNUnwRVRAZ+4GGrUsE3M+VOXszTPLBtdNzhGNnVH2+ OnE1GI91VtGyfotg9hWwUApEJcDravh/8JreEdwWxrSivYMHldYaPxwS0v0q1g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gw9Kl6632z1BHk for ; Wed, 08 Jul 2026 07:52:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 46a69 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 08 Jul 2026 07:52:11 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: KUROSAWA Takahiro From: Kristof Provost Subject: git: 2039fe8ea421 - main - tests/sendfile_helper: support remote connection 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2039fe8ea421a93c466657485ba83b4b055f81dd Auto-Submitted: auto-generated Date: Wed, 08 Jul 2026 07:52:11 +0000 Message-Id: <6a4e01ab.46a69.2ed65acd@gitrepo.freebsd.org> The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2039fe8ea421a93c466657485ba83b4b055f81dd commit 2039fe8ea421a93c466657485ba83b4b055f81dd Author: KUROSAWA Takahiro AuthorDate: 2026-07-07 19:11:19 +0000 Commit: Kristof Provost CommitDate: 2026-07-08 07:23:16 +0000 tests/sendfile_helper: support remote connection In order to use the sendfile_helper program in a pf test script that requires non-loopback interfaces, add functionality to sendfile with a TCP socket that is connected to a remote host. The behavior for unix sockets and TCP loopback sockets is unchanged. Reviewed by: glebius Differential Revision: https://reviews.freebsd.org/D58041 --- tests/sys/common/sendfile_helper.c | 70 ++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 6 deletions(-) diff --git a/tests/sys/common/sendfile_helper.c b/tests/sys/common/sendfile_helper.c index c92a194bff2d..a6181d96892e 100644 --- a/tests/sys/common/sendfile_helper.c +++ b/tests/sys/common/sendfile_helper.c @@ -31,6 +31,7 @@ #include #include +#include #include #include @@ -101,6 +102,44 @@ tcp_socketpair(int *sv) return (0); } +static int +tcp_client_socket(const char *host, const char *port) +{ + struct addrinfo hints, *res, *res0; + int error; + int s; + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + if ((error = getaddrinfo(host, port, &hints, &res0)) != 0) + errx(1, "host %s port %s: %s.", + host, port, gai_strerror(error)); + s = -1; + for (res = res0; res != NULL; res = res->ai_next) { + s = socket(res->ai_family, res->ai_socktype, + res->ai_protocol); + if (s < 0) { + warn("socket(pf:%d, type:%d, proto:%d)", + res->ai_family, res->ai_socktype, + res->ai_protocol); + continue; + } + if (connect(s, res->ai_addr, res->ai_addrlen) < 0) { + warn("connect(%s, %s)", host, port); + close(s); + s = -1; + continue; + } else + break; + } + if (s < 0) + exit(1); + freeaddrinfo(res0); + + return s; +} + static void * receiver(void *arg) { @@ -124,7 +163,8 @@ receiver(void *arg) static void usage(void) { - errx(1, "usage: %s [-u] ", getprogname()); + errx(1, "usage: %s [-u] [-c host] [-p port] " + " ", getprogname()); } int @@ -134,9 +174,19 @@ main(int argc, char **argv) off_t start; int ch, fd, ss[2], flags, error; bool pf_unix = false; + bool tcp_client = false; + const char *host, *port; - while ((ch = getopt(argc, argv, "u")) != -1) + while ((ch = getopt(argc, argv, "c:p:u")) != -1) switch (ch) { + case 'c': + host = optarg; + tcp_client = true; + break; + case 'p': + port = optarg; + tcp_client = true; + break; case 'u': pf_unix = true; break; @@ -148,6 +198,8 @@ main(int argc, char **argv) if (argc != 4) usage(); + if (tcp_client && (host == NULL || port == NULL)) + errx(1, "Need to specify host and port."); start = strtoull(argv[1], NULL, 0); readlen = strtoull(argv[2], NULL, 0); @@ -160,12 +212,18 @@ main(int argc, char **argv) if (pf_unix) { if (socketpair(PF_LOCAL, SOCK_STREAM, 0, ss) != 0) err(1, "socketpair"); - } else + } else if (tcp_client) + ss[0] = tcp_client_socket(host, port); + else tcp_socketpair(ss); - error = pthread_create(&pt, NULL, receiver, &ss[1]); - if (error) - errc(1, error, "pthread_create"); + if (tcp_client) + read_done = true; /* The receiver is another process. */ + else { + error = pthread_create(&pt, NULL, receiver, &ss[1]); + if (error) + errc(1, error, "pthread_create"); + } if (sendfile(fd, ss[0], start, readlen, NULL, NULL, flags) < 0) err(3, "sendfile"); From nobody Wed Jul 8 07:52:12 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 4gw9Kn5NBsz6kvNb for ; Wed, 08 Jul 2026 07:52:13 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gw9Kn1Wgdz4JFr for ; Wed, 08 Jul 2026 07:52:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783497133; 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=c4qcDqmMKjKHwhVng4rCaxx8Rv5yr8uITRZWZeqqFUw=; b=fBRezappUScrUgEXfuj+zs6ZlGQlRmLgDhsJP5EISpWodh6fv5m9fDBM0G2jxkuiYcdNDr f0clLzL1WMU122PiGekXHe3esNEw5Qg3lWjgcdA17KQCBFk2InjBpeTAMHoaCVKq21lmYu /2wi0V9HThw81mDs/OV9K+K19+kOmWQeFaKoQ/T4Yc0029O0Cg7ubkJ40FUmTPJhHqLK1o NtDsKzSH13DQmQiXWOfr/3nKynnzxvillWtlSbQdVzTug3LHJ3L9pYna2I8W2pOBox3Tg5 HeJlLCy3cY9ZzxmMtM4/zXK4j3pb85MA6P4zBUYOxUz3FYdn/cB2EpJhPIgykw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783497133; a=rsa-sha256; cv=none; b=etaxMJv0fvalHqERiq7YycWlKUQL0Y+kmqeAcgK1KoUjysQyH7fhzPnSC9THTJOE1raNql E4m1jfJdHB4varT9p9X282b12WkI7d3ByJxPiLRsMstLgeyobPKVwmoGYN5YRzYhGau/Be JWErJFYUKAcyD+c5MP65d34rYvfWwhMbh7vPI1Jxob/P7T8IQ9HrDdvzwjZjkL/U7eC+4f By4m5s3p9Pna7ja87tW03KWsbaqey9GnBoopmcz8zWJy+CMhcGLcOKO7mADXYIrnsUKCln dNg1fM7fqmH/P9A+DMl3E3rypzsPnqDk6vdySrRk4QScVMJ1KNdKgOZExvVyrw== 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=1783497133; 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=c4qcDqmMKjKHwhVng4rCaxx8Rv5yr8uITRZWZeqqFUw=; b=aV3nQ0r6kh3RsJy2mWvudO2aYdKH5PdmHkZlKIEMl87XWNAFJFfP5qTEQRWkL6xSCX4Ob1 WNnXArnJwMuoDKM3Zg7u2EPZQsqYiKNLSjusetj9MiESjnafJ9z0l7hLim1ZJl6Xro2P6X AUaB8kNjpD6QcSk0MGPjq0DeTLrbdg7iHQwl+5zJwRqP13mgEbZlm88lpHIzJJiNvdPxfy iGaTtVsCE2VtcHVLN1FEUBeNc2S0sNVdFBxcKNhsRhPmsymyRPyIhOSDf2hibCZCj10rav CoTX9ODiCB2Dkv5yjHFrxc4M/ZpPRA77umP8JEOHWFT6FBQcu/MUQ5EGOs8Wyw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gw9Km6Ckdz1B84 for ; Wed, 08 Jul 2026 07:52:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 4749f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 08 Jul 2026 07:52:12 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: c38abd64dbc1 - main - if_epair: support IFCAP_MEXTPG 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c38abd64dbc18ec10a4f80e74ae4a304c075aa5c Auto-Submitted: auto-generated Date: Wed, 08 Jul 2026 07:52:12 +0000 Message-Id: <6a4e01ac.4749f.1f2bb97d@gitrepo.freebsd.org> The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c38abd64dbc18ec10a4f80e74ae4a304c075aa5c commit c38abd64dbc18ec10a4f80e74ae4a304c075aa5c Author: Kristof Provost AuthorDate: 2026-07-06 09:16:41 +0000 Commit: Kristof Provost CommitDate: 2026-07-08 07:23:17 +0000 if_epair: support IFCAP_MEXTPG Enable IFCAP_MEXTPG by default, which may bring performance benefits. Allow it to be disabled, and when disabled assert that we do not receive any mbufs with M_EXTPG set. This is useful for testing. Default the tests to disabling MEXTPG support. Reviewed by: zlei Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D58054 --- sys/net/if_epair.c | 7 ++++++- tests/sys/common/vnet.subr | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c index 60849ca1d4f2..5addd43b6190 100644 --- a/sys/net/if_epair.c +++ b/sys/net/if_epair.c @@ -351,6 +351,10 @@ epair_transmit(struct ifnet *ifp, struct mbuf *m) return (E2BIG); } + if ((ifp->if_capenable & IFCAP_MEXTPG) == 0) { + M_ASSERTMAPPED(m); + } + /* * We are not going to use the interface en/dequeue mechanism * on the TX side. We are called from ether_output_frame() @@ -632,7 +636,8 @@ epair_setup_ifp(struct epair_softc *sc, char *name, int unit) ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING | IFCAP_TXCSUM | IFCAP_RXCSUM | - IFCAP_TXCSUM_IPV6 | IFCAP_RXCSUM_IPV6; + IFCAP_TXCSUM_IPV6 | IFCAP_RXCSUM_IPV6 | + IFCAP_MEXTPG; ifp->if_capenable = ifp->if_capabilities; epair_caps_changed(ifp); ifp->if_transmit = epair_transmit; diff --git a/tests/sys/common/vnet.subr b/tests/sys/common/vnet.subr index 245dbaea517a..781bde4943fa 100644 --- a/tests/sys/common/vnet.subr +++ b/tests/sys/common/vnet.subr @@ -46,7 +46,9 @@ vnet_mkepair() # compute checksums, it just marks packets that this computation still # needs to be done. However, some test cases verify the checksum. # Therefore disable this for IPv4 and IPv6. - ifconfig ${ifname} -txcsum -txcsum6 + # Also disable MEXTPG support, so the tests can verify that the network + # stack don't pass MEXTPG mbufs to interfaces that don't support it. + ifconfig ${ifname} -txcsum -txcsum6 -mextpg list_interface $ifname list_interface ${ifname%a}b echo ${ifname%a} From nobody Wed Jul 8 07:52:13 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 4gw9Kp5mc3z6kvNc for ; Wed, 08 Jul 2026 07:52:14 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gw9Kp0VSwz4JPW for ; Wed, 08 Jul 2026 07:52:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783497134; 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=UuypI2oWYsz8snfHK6AqKlvXPWaD5oRHQkZONGxTSIo=; b=hx+UkZqK6jjYV02l29FrH+j/GRcsrW9ow5JWeRSpalM4CeXIu2NckrLvBMJwkWCMITGSwC /fahcsvTIxbJrPRF2Zq4oV6NpVhCnzf532T7wsr4bizb9Kmt4beZc5LduTVEhFIrE2wqhn hUpftSWCEuRTvbfeW+GqEyAg8kigs1Bt6trVTKFgv0T+/ejmATFpPlSQbbPVln4g7C45E9 jx3fYKRO6xlyGcPSfBZvfG4onhICSGPFm885jFdbK7UkoZyjVVkaeBL36K1McNB43eXS2K x2b0o/Gbz1bjpQYqCvJ5NdwAM1WAKxS94sdF5KBxsLEUYKxR62qC5WMcgcMTlg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783497134; a=rsa-sha256; cv=none; b=ji/sUlSW3TK4GeJnJpc0e5mQeH/t3avqsL08Lsr5uP3PeNOtMyo/yQeZi63My/tJLmp8d0 I4DJK2cP5QsvBqLORjb+D87wmLGwNYzYJ2S9uT3aHIVEa7j1SpHv9yrB63iMhTisqaeKVr CtpUJtQpEJUe/hSdkzVxArbG2OYeXaB8fypvNk3U684HLiXCRVZAXUZbliOeLrBJMsr3J5 i+npBobvEO/CyrA2sdJbfNf/IM+1+WkSaRGEjnZGkwXkR29Tm3CY0cj4CTQDzeiDoVoGso 2IJQ5wJMuVSuILXEa4O/o01zcwD5/n9XpC+PvWfuyo8nXoZDz7PcJr6M5r68JQ== 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=1783497134; 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=UuypI2oWYsz8snfHK6AqKlvXPWaD5oRHQkZONGxTSIo=; b=ZdnKe/7evkTkZm0+RyVZhlM1zyYIuZ2biimP0KUHXPSeO+lOlTotte/tyCwhipYCHYT3A1 Q43um3rFRgkVV9ZOK2BTtba3fsTP80LT70Y8dBdg4hADOkGKJq1ewXvYnMPOp6F+DUssIz Rc2TXXNctsasoBtWHwimDZHycNRF/m7ToldjCoUmV6T7BCbvkMoUFyY7iPRV5bdZxOf+iF InVTIZquDqT8rumOaa7U3/3i4m+axut5s9oRRnyE+GoJNlNzOkp/oAa15Gwy3XiiiD1sqA 9HzSzVHnuSqgdWt/61VCp03mR541yR8bY7by9JwVpsmramsWpBaVarTFzCVAcg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gw9Kn6fGdz1BHm for ; Wed, 08 Jul 2026 07:52:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 466c2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 08 Jul 2026 07:52:13 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: KUROSAWA Takahiro From: Kristof Provost Subject: git: 8a14fcd23a20 - main - pf: fix a crash on sendfile() 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8a14fcd23a201944f3eb5086403d10cfe1fc128f Auto-Submitted: auto-generated Date: Wed, 08 Jul 2026 07:52:13 +0000 Message-Id: <6a4e01ad.466c2.50fd25d4@gitrepo.freebsd.org> The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8a14fcd23a201944f3eb5086403d10cfe1fc128f commit 8a14fcd23a201944f3eb5086403d10cfe1fc128f Author: KUROSAWA Takahiro AuthorDate: 2026-07-07 19:43:32 +0000 Commit: Kristof Provost CommitDate: 2026-07-08 07:23:17 +0000 pf: fix a crash on sendfile() The network layer must not pass unmapped (M_EXTPG) mbufs to if_output() of network interfaces without IFCAP_MEXTPG. pf should convert these mbufs by mb_unmapped_to_ext() for such interfaces but it didn't. The problem had occurred on sendfile because sendfile system call uses unmapped mbufs for the file data. Reported by: feld Reviewed by: kp, glebius Differential Revision: https://reviews.freebsd.org/D58021 --- sys/netpfil/pf/pf.c | 35 ++++++++ tests/sys/netpfil/pf/Makefile | 3 +- tests/sys/netpfil/pf/unmapped_mbuf.sh | 145 ++++++++++++++++++++++++++++++++++ 3 files changed, 182 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index c7d5e923d50b..10e73ce1e7b9 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -9980,6 +9980,21 @@ pf_route(struct pf_krule *r, struct ifnet *oifp, pd->act.dnpipe = tmp; } + /* + * If the output interface does not accept unmapped mbufs, convert + * them to mapped mbufs. + */ + if ((ifp->if_capenable & IFCAP_MEXTPG) == 0) { + error = mb_unmapped_to_ext(m0, &md); + if (error) + goto done; + /* + * The first mbuf should not be reallocated because it is + * always mapped. + */ + MPASS(m0 == md); + } + /* * If small enough for interface, or the interface will take * care of the fragmentation for us, we can just send directly. @@ -10321,6 +10336,11 @@ pf_route6(struct pf_krule *r, struct ifnet *oifp, } if ((u_long)m0->m_pkthdr.len <= ifp->if_mtu) { + if ((ifp->if_capenable & IFCAP_MEXTPG) == 0) { + if (mb_unmapped_to_ext(m0, &md) != 0) + goto done; + MPASS(m0 == md); + } md = m0; pf_dummynet_route(pd, s, r, ifp, sintosa(&dst), &md); if (md != NULL) { @@ -11585,6 +11605,7 @@ pf_test(sa_family_t af, int dir, int pflags, struct ifnet *ifp, struct mbuf **m0 { struct pfi_kkif *kif; u_short action, reason = 0; + struct mbuf *m; struct m_tag *mtag; struct pf_krule *a = NULL, *r = &V_pf_default_rule; struct pf_kstate *s = NULL; @@ -11620,6 +11641,12 @@ pf_test(sa_family_t af, int dir, int pflags, struct ifnet *ifp, struct mbuf **m0 } if (__predict_false(! M_WRITABLE(*m0))) { + /* Need to convert unmapped mbufs before calling m_unshare(). */ + if (mb_unmapped_to_ext(*m0, &m) != 0) { + *m0 = NULL; + return (PF_DROP); + } + MPASS(*m0 == m); *m0 = m_unshare(*m0, M_NOWAIT); if (*m0 == NULL) { return (PF_DROP); @@ -11639,6 +11666,14 @@ pf_test(sa_family_t af, int dir, int pflags, struct ifnet *ifp, struct mbuf **m0 *m0 = NULL; return (PF_PASS); } + + /* + * No need to call mb_unmapped_to_ext() here because it had + * already been called in pf_route()/pf_route6() and dummynet + * re-injected this packet. + */ + + M_ASSERTMAPPED(*m0); (ifp->if_output)(ifp, *m0, sintosa(&pd.pf_mtag->dst), NULL); *m0 = NULL; return (PF_PASS); diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index ded0002768b0..7b2e32c09543 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -56,7 +56,8 @@ ATF_TESTS_SH+= altq \ synproxy \ table \ tcp \ - tos + tos \ + unmapped_mbuf ATF_TESTS_PYTEST+= frag4.py ATF_TESTS_PYTEST+= frag6.py diff --git a/tests/sys/netpfil/pf/unmapped_mbuf.sh b/tests/sys/netpfil/pf/unmapped_mbuf.sh new file mode 100644 index 000000000000..d8005d12b44d --- /dev/null +++ b/tests/sys/netpfil/pf/unmapped_mbuf.sh @@ -0,0 +1,145 @@ +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2026 KUROSAWA Takahiro +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +. $(atf_get_srcdir)/utils.subr + +HELPER=$(atf_get_srcdir)/../../common/sendfile_helper + +# pf must call mb_unmapped_to_ext() before passing an output mbuf to a network +# interface if it does not accept unmapped mbufs as ip_output() does. These +# tests make sure that unmapped mbufs are correctly converted to mapped ones +# before pf passes mbufs to interfaces. + +atf_test_case "v4" "cleanup" +v4_head() { + atf_set descr 'unmapped mbuf IPv4 test' + atf_set require.user root +} + +v4_body() { + pft_init + + l=$(vnet_mkepair) + vnet_mkjail a ${l}a + jexec a ifconfig ${l}a 192.0.2.1/24 up + vnet_mkjail b ${l}b + jexec b ifconfig ${l}b 192.0.2.2/24 up + + # Sanity check + atf_check -s exit:0 -o ignore jexec a ping -c 1 192.0.2.2 + + jexec a pfctl -e + pft_set_rules a "pass out on ${l}a route-to (${l}a 192.0.2.2) all" + jexec b timeout 30s nc -4 -d -l 2345 > out & + sleep 1 + atf_check -s exit:0 -o ignore \ + jexec a ${HELPER} -c 192.0.2.2 -p 2345 ${HELPER} 0 512 0 + wait + atf_check_equal $(dd bs=512 count=1 if=${HELPER} | sha256 -q) \ + $(sha256 -q out) +} + +v4_cleanup() { + pft_cleanup + rm -f out +} + +atf_test_case "v6" "cleanup" +v6_head() { + atf_set descr 'unmapped mbuf IPv6 test' + atf_set require.user root +} + +v6_body() { + pft_init + + l=$(vnet_mkepair) + vnet_mkjail a ${l}a + jexec a ifconfig ${l}a inet6 2001:db8::1/64 up + vnet_mkjail b ${l}b + jexec b ifconfig ${l}b inet6 2001:db8::2/64 up + + # Sanity check + atf_check -s exit:0 -o ignore jexec a ping -c 1 2001:db8::2 + + jexec a pfctl -e + pft_set_rules a "pass out on ${l}a route-to (${l}a 2001:db8::2) all" + jexec b timeout 30s nc -6 -d -l 2345 > out & + sleep 1 + atf_check -s exit:0 -o ignore \ + jexec a ${HELPER} -c 2001:db8::2 -p 2345 ${HELPER} 0 512 0 + wait + atf_check_equal $(dd bs=512 count=1 if=${HELPER} | sha256 -q) \ + $(sha256 -q out) +} + +v6_cleanup() { + pft_cleanup + rm -f out +} + +atf_test_case "dummynet" "cleanup" +dummynet_head() { + atf_set descr 'unmapped mbuf dummynet test' + atf_set require.user root +} + +dummynet_body() { + pft_init + + l=$(vnet_mkepair) + vnet_mkjail a ${l}a + jexec a ifconfig ${l}a 192.0.2.1/24 up + vnet_mkjail b ${l}b + jexec b ifconfig ${l}b 192.0.2.2/24 up + + # Sanity check + atf_check -s exit:0 -o ignore jexec a ping -c 1 192.0.2.2 + + atf_check -s exit:0 -o ignore \ + jexec a dnctl pipe 1 config delay 100 + jexec a pfctl -e + pft_set_rules a "pass out on ${l}a route-to (${l}a 192.0.2.2) all dnpipe 1" + jexec b timeout 30s nc -4 -d -l 2345 > out & + sleep 1 + atf_check -s exit:0 -o ignore \ + jexec a ${HELPER} -c 192.0.2.2 -p 2345 ${HELPER} 0 512 0 + wait + atf_check_equal $(dd bs=512 count=1 if=${HELPER} | sha256 -q) \ + $(sha256 -q out) +} + +dummynet_cleanup() { + pft_cleanup + rm -f out +} + +atf_init_test_cases() +{ + atf_add_test_case "v4" + atf_add_test_case "v6" + atf_add_test_case "dummynet" +} From nobody Wed Jul 8 12:28:20 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 4gwHSP1234z6lGbD for ; Wed, 08 Jul 2026 12:28:21 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwHSP0Gbhz3ZKj for ; Wed, 08 Jul 2026 12:28:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783513701; 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=eL7YK/RmG70GUpPru4A/IRhBDmWfVWzVB9sQ+CWYhes=; b=C8vXWjqQx0/ftDRxOz897bDooUAOFl3vM6/pwf+GYddvIpXP6owPKArTLTB8oPB1oZvP14 v+7Oopr6yutjWuGeZ1BC1Ta1t33P1qXzpfT/JSaJA5DAfh2vH6EIw1TxG6OVg+L3Bkjuw6 H74f/mKkxB/frxu00wiBOsDV8FRcLKVAndoBWbHXYWa7Qct+i79dX2DtHBOM4zKBbg12Zo fUUrZjCPguOC68jIgrK0LHUTYIGxyFXKY5yfykGAyZIR17YqNSoPJ51p2BTdknxClbDKQk veNU/1OwVtBV5i6ZNy0Web1nOo/fuzusiib5qZ1cuG63VlEmnrlFNptwJ7z9Ng== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783513701; a=rsa-sha256; cv=none; b=ksACuKfwLRs7qNsyjkMEM35rMcZSLSijTHhJIeEs8T4NVBml+vEYFKDbGRlaszJV2yoOsV HTnWd+rhsKNIQrs0YxA6V0BlR4PBjjgpI4njhaoO0kaJGy4dFbvqiXWSe/E4rUiMfzt8HK iTKP5DSRrKEddo6VawTIEhIUAv2slC/LyvexwvKXhr8lAMIpeoUHQfylPJNLtkKZ8MrX0V pMlQav+hfrVu9/ACurvuPy6pN5DJpYWBE27FotsQ3gqafH0ZgHMUSTTT9057Fds4b90Hwe mRRvwfJkhZp23q3h9oD0asatD9YFCypO7TorUgc75OPnrz+noNXUL2roxJz0Ew== 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=1783513701; 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=eL7YK/RmG70GUpPru4A/IRhBDmWfVWzVB9sQ+CWYhes=; b=FGNZnAdJo3MsjYcaM65isWgtPuID1+T1RbmZm4XK9rYdbLhB1VCBLdbRi0jjgsxdWL47RR /PQFTGwV8PuULXqVPNbleVVUtCHXLSnJHsNRdNKePvpGdNA8pzqK07h2MhhA2J718N8FSN P2XJ0MONZta60ivNydaRfL2Yx8qtYkRT4qzZxl47/q5rH44x78g88OJ9aB/v6xuhgy1wlf 6zSLxJ5vJQSJFJHRKYQOFXrMSb1r7bmxhA3m7PvRpSKDvWcb1J/M5Jy3HnEMq63RbzEbC7 QqNtn8hPaE92Cw4uIOxB1vNDeqqom8ONfn2nV9E5InkJ1Pj2tnLtQ9kIqsuVIg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwHSN62sDz5W6 for ; Wed, 08 Jul 2026 12:28:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3c2ad by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 08 Jul 2026 12:28:20 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Gallatin Subject: git: 1cce5ef05d7b - main - lagg: re-check port caps after bringing up a port 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: gallatin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1cce5ef05d7ba077b0cb29d30b59f3a862e7e5ae Auto-Submitted: auto-generated Date: Wed, 08 Jul 2026 12:28:20 +0000 Message-Id: <6a4e4264.3c2ad.53e50a88@gitrepo.freebsd.org> The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=1cce5ef05d7ba077b0cb29d30b59f3a862e7e5ae commit 1cce5ef05d7ba077b0cb29d30b59f3a862e7e5ae Author: Andrew Gallatin AuthorDate: 2026-07-08 12:24:35 +0000 Commit: Andrew Gallatin CommitDate: 2026-07-08 12:27:58 +0000 lagg: re-check port caps after bringing up a port Some nic drivers (including iflib) do not initialize if_hwassist until after the interface is brought up. If a lagg member is included in a lagg when its not yet been brought up, that will cause lagg to see if_hwassist=0 and will disable all checksum offload, etc, on the interface. This is almost impossible to debug without kgdb or dtrace, as ifconfig does not surface if_hwassist. Fix this by re-calculating lagg caps (including if_hwassist) after adding a port. I encountered this problem when I had a commented-out if_foo1=up entry in my rc.conf that i neglected to uncomment when I was re-configuring a lagg. Sponsored by: Netflix Reviewed by: markj, zlei Differential Revision: https://reviews.freebsd.org/D58062 --- sys/net/if_lagg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index da08e02d50be..e8e0306b0d1f 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -1309,6 +1309,8 @@ lagg_init_locked(struct lagg_softc *sc) lagg_if_updown(sc, true); + /* Recheck port caps; bringing them up may have changed if_hwassist. */ + lagg_capabilities(sc); lagg_proto_init(sc); if (ifp->if_type == IFT_INFINIBAND) { From nobody Wed Jul 8 12:59:37 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 4gwJ8Z4ryJz6lJqF for ; Wed, 08 Jul 2026 12:59:42 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwJ8Z4GWhz3fHn for ; Wed, 08 Jul 2026 12:59:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783515582; 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=kexBKYYglzCsKqBwfxk23lGM7u18fRqbSePWFN9WnPg=; b=RofDxOjVbOMtKIdHxzMEuxtLo02o5B6vHfFjjEJzhCvPVi/XKMRpx41+Gt8tPXP26JhJGH v1tdup6DCYuXSk0nqGYIzO4rDH4tleU1lyZN/sz32HTyy8tJPN+HiUC0LGkTTmuGEx/GHm EkQPu9bc0rLX2yxyeGkw3OaFy16MCBJ4fy+Ow2YMjuEKvnzUuUHxBqGSKmU35e2zqSVRxg oQ+jYRMURllJYuVZXbS/UxkDW3Ouv+UunbeSEJtMf9KBspnhCmtBQqGL3q9Z/0+mJ2vhVR jZ/S+QXb76by0vHtK2001NbhSUnURjTu/CMp+gLdBqbewBGfm61VaPFDPBmoqA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783515582; a=rsa-sha256; cv=none; b=sM+mj7Q2iQtObi0KC1FFT915xg0zFdWKXO66SBr/o5MZUU2KjHmj9mlmF+Gnv7Z3NgzHX3 ag5gQH57dqoCd0txpMMIcMDF+2NLuaK26qIGflM5ww7p4uRNTtARdnoVZ3CHz0xxt8sIuE jb1jf2Rvfs+fIkpSdng5IBVxTtjnsg0lcz1PLea6ifoR+nRqeBkwvhW/XOjvVCYHKiWsQf /Bb5j2Nly9Apa9EUXmgh4ZK8a3fXoNeqBvEjflbVUarrdMf5ULt20r6BDMZ1YWSZrEx7gX 45RBkzTNpgAlXlJOVApqME/Qi63EJHnwSpwd+JHt3Prt5S5+ufeo6I2LNnD+xQ== 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=1783515582; 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=kexBKYYglzCsKqBwfxk23lGM7u18fRqbSePWFN9WnPg=; b=DQDeGgYRerzFyeq3cVxBkUw9Zq9DKdJeOtFIictQUVxSPNBQpcxdo9zSsA0nn2pnOVpDG5 tCKjJhFEKT8k2Y+vHcK2rvAQypMpuksOQconq7rOkBPkq4cVO5ndBlTD64fnfG6NZd3bFU BoYRbD3CVmLgfW9B0GnuLbercfiTGtSc93Rp8aRWgx0/pjSxcAeAePtluLBmHWU39kWuSr zssLs0zlOelVeC87d8RIWVExgAjndZpED4UBqVp0u0jISj6/2+hjSUJO1dLlocEBeeEBPW MJ5l86hQlUqyGc7OcyphPpQdxlaPWhUTz83ijgcnzZxn60qpX4/9bIQ0cIagbQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwJ8Z3FZdz66N for ; Wed, 08 Jul 2026 12:59:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3ffa9 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 08 Jul 2026 12:59:37 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Sourojeet A From: Ed Maste Subject: git: 7e1245aafeec - main - linuxkpi: Add pm_runtime_resume_and_get 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7e1245aafeece1a56af292c2652c6b835ccb6f10 Auto-Submitted: auto-generated Date: Wed, 08 Jul 2026 12:59:37 +0000 Message-Id: <6a4e49b9.3ffa9.3f44eba9@gitrepo.freebsd.org> The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=7e1245aafeece1a56af292c2652c6b835ccb6f10 commit 7e1245aafeece1a56af292c2652c6b835ccb6f10 Author: Sourojeet A AuthorDate: 2026-07-08 12:57:34 +0000 Commit: Ed Maste CommitDate: 2026-07-08 12:58:48 +0000 linuxkpi: Add pm_runtime_resume_and_get pm_runtime_resume_and_get is used by new versions of amdgpu, and began use between Linux kernel version 6.12, and 6.14. Reviewed by: dumbbell Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57463 --- sys/compat/linuxkpi/common/include/linux/pm_runtime.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/pm_runtime.h b/sys/compat/linuxkpi/common/include/linux/pm_runtime.h index 6114b7b159d7..8c7d9f3a8e1c 100644 --- a/sys/compat/linuxkpi/common/include/linux/pm_runtime.h +++ b/sys/compat/linuxkpi/common/include/linux/pm_runtime.h @@ -51,4 +51,10 @@ pm_runtime_suspended(struct device *dev) return 0; } +static inline int +pm_runtime_resume_and_get(struct device *dev) +{ + return 0; +} + #endif /* _LINUXKPI_LINUX_PM_RUNTIME_H_ */ From nobody Wed Jul 8 15:27:04 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 4gwMQd2k6Wz6kNfK for ; Wed, 08 Jul 2026 15:27:05 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwMQd0btrz3phR for ; Wed, 08 Jul 2026 15:27:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783524425; 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=uM8IRwNYv2A3YFI5v57gyheF3FHCKdQ6NyYgIVsqojM=; b=PQv/v7o6gioZHYXihBGSc7FPEZ5/2Xq5u+5HOkERKgrsNcbrUN8eDPs2SpWQ6LTxZUprHB gJ4vrrqDXCxbBLoFV413cpl5T4MEbbxbk5GBdQzW9Ax9XLWPg7Mb9hm8aPBcBIxygu4dKV Y27ugpyD8dGr6fCprxRIr3i3Cs2SXhwllVB+2oIYf5Owk7tBt+G5jABen4xrNKbnTSqGu7 Rl1wBlhQlS93maWGvUBALkR71fHn2ryeQBjnKieFyVnT4lp7EcbzUkWxoe/ldUKs/r4NT3 tHF3I8TMnuKXvygcC+On4Hr8G/VqwRLU4witAdMk4UaR0qvXieGPJ0x8mrhnBw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783524425; a=rsa-sha256; cv=none; b=RD7pdA9DuyjkYrvl0ZygE9wSwOJ46c6PMQR0E4YWtEwGsYKQtIwv6Vv6IBGmBk3pvQtr8h IxDJbrxcGg96A8o276hM3Aap0IVEx+m/q6KPMJ4qSKfRjTlzkr7150M8tyjrJ6VEcvySfw cBfFADLy20TXubnx8FxcV3XcPq1Rmbh0ej9b0MosEhdQkqWBtbw787QUB+3oJJXYeY43T9 7TDSC9JC4dCB5Z38Hogj9tW3l+37dHgEg/zyvI4FpsmhZeRRSLNUzE9iAuC0RTjQ7oxqnj nlzo5eCem1TyEYngGhZx86jHnSIAxUD7QaM1X10y0NW1e9z8Me2OSSqaNnByvQ== 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=1783524425; 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=uM8IRwNYv2A3YFI5v57gyheF3FHCKdQ6NyYgIVsqojM=; b=mUTkHcnRce4iLjd0/VkrVZo4TWKYUIzfh86f0lNXJlXrvh6nwPGeg6huDcHXuUsnRMeGGz miGP8jCPH1VhnruC/u0Di1f7Qva1URYgMLzEPTlavWNKX9XR2hFNgMGRPsXSssnQdZhN8A KEpPDWaGMxfg8savRoXMy9MjE0awMM/HjUNNDE0riD3DO5OJ7BWti6NgstVoVpo349DWZ4 djPGTDGcdyWlP1B+3P1NM4aDSe6fBt0SPHBYz2t6o5eSNb2/4dZEqBDsi1EjL2sXccSOcR VcSxCSj2Y1p13+vMR36OJuy9gKx3thklhqZ0VO8fG/numjDJSG9IVEQEvYMJBQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwMQc6N3kzBMG for ; Wed, 08 Jul 2026 15:27:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2071c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 08 Jul 2026 15:27:04 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: e75fa2a613fc - main - Regen syscalls tables. 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e75fa2a613fc522be8ec501480902eabecf887e6 Auto-Submitted: auto-generated Date: Wed, 08 Jul 2026 15:27:04 +0000 Message-Id: <6a4e6c48.2071c.207c9ba7@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e75fa2a613fc522be8ec501480902eabecf887e6 commit e75fa2a613fc522be8ec501480902eabecf887e6 Author: Konstantin Belousov AuthorDate: 2026-07-08 15:22:59 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-08 15:26:57 +0000 Regen syscalls tables. This catches up with 692b0ef1506ba which added CAPENABLED to clock_nanosleep(). Curiously recent additions of the pdopenpid(2) and pddupfd(2) were done before the cited commit, and that regen did not included the change. Sponsored by: The FreeBSD Foundation --- sys/compat/freebsd32/freebsd32_sysent.c | 2 +- sys/kern/init_sysent.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32_sysent.c b/sys/compat/freebsd32/freebsd32_sysent.c index a0726834cef8..d8c276d7669c 100644 --- a/sys/compat/freebsd32/freebsd32_sysent.c +++ b/sys/compat/freebsd32/freebsd32_sysent.c @@ -311,7 +311,7 @@ struct sysent freebsd32_sysent[] = { { .sy_narg = AS(ffclock_getcounter_args), .sy_call = (sy_call_t *)sys_ffclock_getcounter, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 241 = ffclock_getcounter */ { .sy_narg = AS(freebsd32_ffclock_setestimate_args), .sy_call = (sy_call_t *)freebsd32_ffclock_setestimate, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 242 = freebsd32_ffclock_setestimate */ { .sy_narg = AS(freebsd32_ffclock_getestimate_args), .sy_call = (sy_call_t *)freebsd32_ffclock_getestimate, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 243 = freebsd32_ffclock_getestimate */ - { .sy_narg = AS(freebsd32_clock_nanosleep_args), .sy_call = (sy_call_t *)freebsd32_clock_nanosleep, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 244 = freebsd32_clock_nanosleep */ + { .sy_narg = AS(freebsd32_clock_nanosleep_args), .sy_call = (sy_call_t *)freebsd32_clock_nanosleep, .sy_auevent = AUE_NULL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 244 = freebsd32_clock_nanosleep */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 245 = reserved for local use */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 246 = reserved for local use */ { .sy_narg = AS(freebsd32_clock_getcpuclockid2_args), .sy_call = (sy_call_t *)freebsd32_clock_getcpuclockid2, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 247 = freebsd32_clock_getcpuclockid2 */ diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c index 8ee5f163a550..1f1b26d16b7a 100644 --- a/sys/kern/init_sysent.c +++ b/sys/kern/init_sysent.c @@ -310,7 +310,7 @@ struct sysent sysent[] = { { .sy_narg = AS(ffclock_getcounter_args), .sy_call = (sy_call_t *)sys_ffclock_getcounter, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 241 = ffclock_getcounter */ { .sy_narg = AS(ffclock_setestimate_args), .sy_call = (sy_call_t *)sys_ffclock_setestimate, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 242 = ffclock_setestimate */ { .sy_narg = AS(ffclock_getestimate_args), .sy_call = (sy_call_t *)sys_ffclock_getestimate, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 243 = ffclock_getestimate */ - { .sy_narg = AS(clock_nanosleep_args), .sy_call = (sy_call_t *)sys_clock_nanosleep, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 244 = clock_nanosleep */ + { .sy_narg = AS(clock_nanosleep_args), .sy_call = (sy_call_t *)sys_clock_nanosleep, .sy_auevent = AUE_NULL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 244 = clock_nanosleep */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 245 = reserved for local use */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 246 = reserved for local use */ { .sy_narg = AS(clock_getcpuclockid2_args), .sy_call = (sy_call_t *)sys_clock_getcpuclockid2, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 247 = clock_getcpuclockid2 */ From nobody Wed Jul 8 16:16:18 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 4gwNWQ5lSKz6kRpQ for ; Wed, 08 Jul 2026 16:16:18 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwNWQ3KTLz3wQq for ; Wed, 08 Jul 2026 16:16:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783527378; 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=+tSv3KuKJfynCIfkG6ps38Xo5GAk7W8aSlWCpb0Srs0=; b=he+faeZ/Pnh2QJ7uvElzYysWd01dpeyLNUOmxWccmqUVbbC5PPq3kcsPQoU00V+XLk/tqp rSy+Zjhe3SkwreaZtjnWjZp8017QE9kiVdqqN9b7v5Uymv7sKjpfCzWMlxw+L4OL5HVOJl aBInaID+ilq0mLuF1Dmg8PeQY01CDm7G7sXe3G3vt9HDh7Q4FOMk4n6zt9u4MvW46OsFGc To/d8dWvcwIPYVzUFVDJofZYBqJymGlWX2GOytwoomR4+7gCrwCToRZCwhr07pPYX5AGP3 Xp/HRev4kaefFzuW9ky73za3QxfmIdsm+VhHYpoHCR+oGAyd4JIVAEa6FdYAwQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783527378; a=rsa-sha256; cv=none; b=goZPVEtrqMXljfD0yt4VXQ/yKpOGXhbBgyOP8gQOYFvHvjGGrIkw/ijUQIp4K4vS1Ynl8y sM4hKRQU7g521iMkUmsiVHr/BDxP6V4nsUMtFQ13zcA9IRD+763WrMuhj6qLeNEgOH66Eu /L0DHKWjzjzmp6ZGrVHXjr48AjqBMuUx1KKuCSeb0+BCdS5legxMgtL4hUQHjaG9VIJIGa xWomtto/1+hhxEyfqnrjBMto+92u5UYbuPVZZORJOUKyScF0OmCxNLPyiJEvKyXAIa6MW7 YOL3jEPHl/8lPAIynK07/m8JxUcpZqJb/cWNBOrCiCGbiny8uAKN6BDoyUxP1A== 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=1783527378; 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=+tSv3KuKJfynCIfkG6ps38Xo5GAk7W8aSlWCpb0Srs0=; b=VMWwNCIkvehHqkXCGmq5McF2VfSKVeNm2uNFZoIq28GVf6slmq7x2QIi1PtbZ6YlHwxHTh x9ShR82SvTmzMueXmh1lBXrvv2MNJW5BZEj9eLLqm6Y8xCGTzmVsmIXAk1Zeoe+NS1YAFg eJuR2VDgDT1T9Op74F3cjBtDTeeO94lK/DW9wIwFFrOQr3FYtP4NvLFAr99Ss/3zn5QwAv PiKbCJhdP8+JuQOGV5vzA92PAP16kq7T2DSrFsZx5h0s8u6nzQ+qw5rowNIPgDnxS27dEi SGDLEcG0h4xzrrCk1kmmiSpurAVPBIHwCb89+GUMbXCKggzHklk72vAUhgCFMA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwNWQ29tjzTgF for ; Wed, 08 Jul 2026 16:16:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 25bed by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 08 Jul 2026 16:16:18 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Roman Bogorodskiy Subject: git: ed7e0ebfa20e - main - bhyve: allow overriding snapshot socket directory 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: novel X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ed7e0ebfa20e7e798d2e4e20623d452f1c715aa5 Auto-Submitted: auto-generated Date: Wed, 08 Jul 2026 16:16:18 +0000 Message-Id: <6a4e77d2.25bed.4d33447f@gitrepo.freebsd.org> The branch main has been updated by novel: URL: https://cgit.FreeBSD.org/src/commit/?id=ed7e0ebfa20e7e798d2e4e20623d452f1c715aa5 commit ed7e0ebfa20e7e798d2e4e20623d452f1c715aa5 Author: Roman Bogorodskiy AuthorDate: 2026-06-07 07:31:30 +0000 Commit: Roman Bogorodskiy CommitDate: 2026-07-08 16:10:14 +0000 bhyve: allow overriding snapshot socket directory By default bhyve(8) creates a snapshot socket in "/var/run/bhyve/" (BHYVE_RUN_DIR). As this is a system directory not writable by users, this does not work when bhyve(8) is being started as a non-root user. Address that by allowing to override this directory. In bhyve(8) it is done by setting 'rundir' option with '-o rundir='. In bhyvectl(8) it is done with '--rundir='. MFC after: 1 month Reviewed by: bcr (manpages), bnovkov Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57494 --- usr.sbin/bhyve/amd64/bhyverun_machdep.c | 6 ++++++ usr.sbin/bhyve/bhyve_config.5 | 9 ++++++++- usr.sbin/bhyve/bhyverun.c | 2 +- usr.sbin/bhyve/snapshot.c | 14 ++++++++++---- usr.sbin/bhyve/snapshot.h | 2 +- usr.sbin/bhyvectl/bhyvectl.8 | 8 +++++++- usr.sbin/bhyvectl/bhyvectl.c | 32 +++++++++++++++++++++++++------- 7 files changed, 58 insertions(+), 15 deletions(-) diff --git a/usr.sbin/bhyve/amd64/bhyverun_machdep.c b/usr.sbin/bhyve/amd64/bhyverun_machdep.c index 98a756551272..2c8f825b4a7c 100644 --- a/usr.sbin/bhyve/amd64/bhyverun_machdep.c +++ b/usr.sbin/bhyve/amd64/bhyverun_machdep.c @@ -37,6 +37,9 @@ #include "acpi.h" #include "atkbdc.h" #include "bhyverun.h" +#ifdef BHYVE_SNAPSHOT +#include "snapshot.h" +#endif #include "bootrom.h" #include "config.h" #include "debug.h" @@ -65,6 +68,9 @@ bhyve_init_config(void) set_config_bool("x86.strictmsr", true); set_config_bool("x86.verbosemsr", false); set_config_value("lpc.fwcfg", "bhyve"); +#ifdef BHYVE_SNAPSHOT + set_config_value("rundir", BHYVE_RUN_DIR); +#endif } void diff --git a/usr.sbin/bhyve/bhyve_config.5 b/usr.sbin/bhyve/bhyve_config.5 index 8bfe9afd0b24..dd82bea61d20 100644 --- a/usr.sbin/bhyve/bhyve_config.5 +++ b/usr.sbin/bhyve/bhyve_config.5 @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd December 26, 2025 +.Dd July 8, 2026 .Dt BHYVE_CONFIG 5 .Os .Sh NAME @@ -226,6 +226,13 @@ This value is used for the guest's System Management BIOS System Information str Stock keeping unit of the chassis. It's also called product ID or purchase order number. This value is used for the guest's System Management BIOS System Information structure. +.It Va rundir Ta String Ta Pa /var/run/bhyve/ Ta +Path to the runtime directory for +.Xr bhyve 8 +to store its service files, such as the checkpoint socket. +Overriding this path is useful when running +.Xr bhyve 8 +as an unprivileged user. .El .Ss x86-Specific Settings .Bl -column "x86.vmexit_on_pause" "integer" "Default" diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index 8cbc19fcfef8..ace631594544 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -1068,7 +1068,7 @@ main(int argc, char *argv[]) /* * checkpointing thread for communication with bhyvectl */ - if (init_checkpoint_thread(ctx) != 0) + if (init_checkpoint_thread(ctx, get_config_value("rundir")) != 0) errx(EX_OSERR, "Failed to start checkpoint thread"); #endif diff --git a/usr.sbin/bhyve/snapshot.c b/usr.sbin/bhyve/snapshot.c index 5b941984c0c0..fdb5941bf1d0 100644 --- a/usr.sbin/bhyve/snapshot.c +++ b/usr.sbin/bhyve/snapshot.c @@ -1399,13 +1399,13 @@ IPC_COMMAND(ipc_cmd_set, checkpoint, vm_do_checkpoint); * Create the listening socket for IPC with bhyvectl */ int -init_checkpoint_thread(struct vmctx *ctx) +init_checkpoint_thread(struct vmctx *ctx, const char *bhyve_run_dir) { struct checkpoint_thread_info *checkpoint_info = NULL; struct sockaddr_un addr; int socket_fd; pthread_t checkpoint_pthread; - int err; + int err, ret; #ifndef WITHOUT_CAPSICUM cap_rights_t rights; #endif @@ -1421,8 +1421,14 @@ init_checkpoint_thread(struct vmctx *ctx) addr.sun_family = AF_UNIX; - snprintf(addr.sun_path, sizeof(addr.sun_path), "%s%s", - BHYVE_RUN_DIR, vm_get_name(ctx)); + ret = snprintf(addr.sun_path, sizeof(addr.sun_path), "%s/%s", + bhyve_run_dir, vm_get_name(ctx)); + if ((ret < 0) || ((size_t)ret >= sizeof(addr.sun_path))) { + EPRINTLN("%s: error setting socket path (%d)", __func__, ret); + err = -1; + goto fail; + } + addr.sun_len = SUN_LEN(&addr); unlink(addr.sun_path); diff --git a/usr.sbin/bhyve/snapshot.h b/usr.sbin/bhyve/snapshot.h index 8bebdafd6117..5c71640f3f09 100644 --- a/usr.sbin/bhyve/snapshot.h +++ b/usr.sbin/bhyve/snapshot.h @@ -99,7 +99,7 @@ int vm_resume_devices(void); int get_checkpoint_msg(int conn_fd, struct vmctx *ctx); void *checkpoint_thread(void *param); -int init_checkpoint_thread(struct vmctx *ctx); +int init_checkpoint_thread(struct vmctx *ctx, const char *bhyve_run_dir); int load_restore_file(const char *filename, struct restore_state *rstate); diff --git a/usr.sbin/bhyvectl/bhyvectl.8 b/usr.sbin/bhyvectl/bhyvectl.8 index 550c4f10d8e6..b999230cfd73 100644 --- a/usr.sbin/bhyvectl/bhyvectl.8 +++ b/usr.sbin/bhyvectl/bhyvectl.8 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 8, 2025 +.Dd July 8, 2026 .Dt BHYVECTL 8 .Os .Sh NAME @@ -41,6 +41,7 @@ .Op Fl -force-reset .Op Fl -force-poweroff .Op Fl -checkpoint= Ns Ar +.Op Fl -rundir= Ns Ar .Op Fl -suspend= Ns Ar .Sh DESCRIPTION The @@ -77,6 +78,11 @@ Save a snapshot of a virtual machine similar to .Fl -checkpoint . The virtual machine will terminate after the snapshot has been saved. +.It Fl -rundir= Ns Ar +Specify path to the directory containing the checkpoint socket. +If not specified, +.Pa /var/run/bhyve +is used. .El .Pp .Em Note : diff --git a/usr.sbin/bhyvectl/bhyvectl.c b/usr.sbin/bhyvectl/bhyvectl.c index 96768383d4ca..b63cd5dc8c6e 100644 --- a/usr.sbin/bhyvectl/bhyvectl.c +++ b/usr.sbin/bhyvectl/bhyvectl.c @@ -86,6 +86,7 @@ enum { #ifdef BHYVE_SNAPSHOT SET_CHECKPOINT_FILE, SET_SUSPEND_FILE, + SET_RUNDIR, #endif OPT_LAST, }; @@ -138,6 +139,7 @@ setup_options(void) #ifdef BHYVE_SNAPSHOT { "checkpoint", REQ_ARG, 0, SET_CHECKPOINT_FILE}, { "suspend", REQ_ARG, 0, SET_SUSPEND_FILE}, + { "rundir", REQ_ARG, 0, SET_RUNDIR}, #endif }; @@ -155,6 +157,7 @@ usage(const struct option *opts) #ifdef BHYVE_SNAPSHOT [SET_CHECKPOINT_FILE] = "filename", [SET_SUSPEND_FILE] = "filename", + [SET_RUNDIR] = "path", #endif }; (void)fprintf(stderr, "Usage: %s --vm=\n", progname); @@ -252,10 +255,10 @@ show_memseg(struct vmctx *ctx) #ifdef BHYVE_SNAPSHOT static int -send_message(const char *vmname, nvlist_t *nvl) +send_message(const char *vmname, nvlist_t *nvl, const char *rundir) { struct sockaddr_un addr; - int err = 0, socket_fd; + int err = 0, ret, socket_fd; socket_fd = socket(PF_UNIX, SOCK_STREAM, 0); if (socket_fd < 0) { @@ -265,8 +268,15 @@ send_message(const char *vmname, nvlist_t *nvl) } memset(&addr, 0, sizeof(struct sockaddr_un)); - snprintf(addr.sun_path, sizeof(addr.sun_path), "%s%s", - BHYVE_RUN_DIR, vmname); + ret = snprintf(addr.sun_path, sizeof(addr.sun_path), "%s/%s", + rundir, vmname); + if ((ret < 0) || ((size_t)ret >= sizeof(addr.sun_path))) { + fprintf(stderr, "%s: error setting socket path (%d)", + __func__, ret); + err = 1; + goto done; + } + addr.sun_family = AF_UNIX; addr.sun_len = SUN_LEN(&addr); @@ -305,7 +315,7 @@ open_directory(const char *file) } static int -snapshot_request(const char *vmname, char *file, bool suspend) +snapshot_request(const char *vmname, char *file, bool suspend, const char *rundir) { nvlist_t *nvl; int fd; @@ -319,7 +329,7 @@ snapshot_request(const char *vmname, char *file, bool suspend) nvlist_add_bool(nvl, "suspend", suspend); nvlist_move_descriptor(nvl, "fddir", fd); - return (send_message(vmname, nvl)); + return (send_message(vmname, nvl, rundir)); } #endif @@ -335,6 +345,7 @@ main(int argc, char *argv[]) struct option *opts; #ifdef BHYVE_SNAPSHOT char *checkpoint_file = NULL; + char *rundir = NULL; #endif opts = setup_options(); @@ -379,6 +390,11 @@ main(int argc, char *argv[]) checkpoint_file = optarg; vm_suspend_opt = (ch == SET_SUSPEND_FILE); break; + + case SET_RUNDIR: + rundir = optarg; + break; + #endif default: usage(opts); @@ -528,7 +544,9 @@ main(int argc, char *argv[]) #ifdef BHYVE_SNAPSHOT if (!error && checkpoint_file) - error = snapshot_request(vmname, checkpoint_file, vm_suspend_opt); + error = snapshot_request(vmname, checkpoint_file, + vm_suspend_opt, + rundir ? rundir : BHYVE_RUN_DIR); #endif if (error) From nobody Wed Jul 8 17:01:24 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 4gwPWS6RCMz6kWnC for ; Wed, 08 Jul 2026 17:01:24 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwPWS5ZTWz43dd for ; Wed, 08 Jul 2026 17:01:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783530084; 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=2jvZA/kq9/L5jISJLBtdK262EJq6dO1R1mVvA1tC5rM=; b=rFustOrQb1n1DYxlbhG5BIF9IYJ9cHN/q6ent50MlU/5z8W3eb9QJ3es4aB4bKZihho+5K zo/QV4Z9/r3FXaHfWFDphHWWNu81GQcSmABC0g5TaFuehU12bdzd3Ry5nrKhaHpFciEA/h tKgBNfnQ5fyudIFS+NnF/jYXE9DxbZsqhGADH+8YDtlDQDJgUf2XUuUC9rquxiZsY6Xl/c q+P3YDPgmddDA2hr29uswfVQk22pW4RmQTxcYq3ZUz7BfpX3sn7RxbaiSsDPpdFeOHvUML 58DUgoCk5LvkBEbGydyDUnDjG38F7QU3CH8dgReKOGCipv2xGvtasQx6O8M88A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783530084; a=rsa-sha256; cv=none; b=Of1bW+oLMb8cArPgepyTu3F43hPJF+XVyshi/nlmwkpxetowmTfnhYVzZQd4mQUA7PoA2B +uWfhzCh5enRFK2LekneZOnMvbOhj9gIh2pfa2eYRyuGK9uDJgOaBt2Nusruj3C7VRnVxb pqLkJRjhxP+VlPNwkiZwvZwG3P6SYn6HlYm13tgz5+RGMWDQ0YEefdaMRqdG5T5CMW5Mt1 gZddEFz0B0QERNIpEYkarXWyNjOdQLRSKZJTfuVhZRBbS7nMWKLA3ZuayXgz/KZXTVxldx iSKwoiv/tKtDq9PkAa140wrjsbs/OCycUmoEqRoM00CfPRTQ54c/nMovOv5M7w== 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=1783530084; 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=2jvZA/kq9/L5jISJLBtdK262EJq6dO1R1mVvA1tC5rM=; b=T0H/LTVlvXSgq4yWG7IHy4hsY8PBt6lI7m+KXqH7n2YX6UTSEPC900IDkPZuYTD5atkNbH sU6cNFNIC6X6vHZCDvnZaBV5dLg5M1N5fNN+1Y2oh0mryxlO1Liv5I6bvaQ1OcdFsvM+lp j9BvKG60dtK+xKIgKwjjfuNY95AR9GsxsufnGSlTUFNW645ZeXcokLDEnmD6NlDGBQh+in 5UyYTCnRr48iaw8nfZS1mp1TJDU3BU80KjQIe9lPA+cEsVO52uujBWmmeXL6J/6zpsyK/A 3zwoCI8F3JichM5pIwHUPJ2kfxT1F0nsFMAhYmRzYWovhTXtAz5KkGXvHYNxnA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwPWS4FVmzVsC for ; Wed, 08 Jul 2026 17:01:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 32e05 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 08 Jul 2026 17:01:24 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: b72397da275b - main - kern_filewrite(): unconditionally calculate cnt, it is used by callers 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b72397da275b098365532133688d555b842bad4f Auto-Submitted: auto-generated Date: Wed, 08 Jul 2026 17:01:24 +0000 Message-Id: <6a4e8264.32e05.2b37112e@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b72397da275b098365532133688d555b842bad4f commit b72397da275b098365532133688d555b842bad4f Author: Konstantin Belousov AuthorDate: 2026-07-08 14:54:25 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-08 17:01:09 +0000 kern_filewrite(): unconditionally calculate cnt, it is used by callers Reported by: dhw, madpilot Tested by: dhw Sponsored by: The FreeBSD Foundation MFC after: 1 week Fixes: dfad790c8cca ("sendfile: stop abusing kern_writev()") --- sys/kern/sys_generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 079bd7b347d7..d5145d6cf322 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -595,9 +595,9 @@ kern_filewrite(struct thread *td, int fd, struct file *fp, struct uio *auio, #endif cnt = auio->uio_resid; error = fo_write(fp, auio, td->td_ucred, flags, td); + cnt -= auio->uio_resid; #ifdef KTRACE if (ktruio != NULL) { - cnt -= auio->uio_resid; if (error == 0) ktruio->uio_resid = cnt; ktrgenio(fd, UIO_WRITE, ktruio, error); From nobody Wed Jul 8 18:12:35 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 4gwR5c1QGWz6kd28 for ; Wed, 08 Jul 2026 18:12:36 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwR5b61T8z4GgT for ; Wed, 08 Jul 2026 18:12:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783534355; 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=dmnw3Rn76NgKWQxVDHK1bMNebTD3O9w8+vWcZAefN7g=; b=peadMoOuCNahwNzuNVyf4X+Q9aqBLOlPYvztckkJEs6mJjw9a2RJAeOoF7sFCb7Qwd0/oO JRzvzdemhGDhzy3ulTGkNkv4UYFLcyLk/Z4Xhsktwc5n/PTxYtOyDBEwzCOIVth37viqdu zERgEUm9ctRpXFftF/TasZotyFektWsSGeKoV31awSN6Y/9yE3YKqgaqFI6JKJQg54BG2a DNowg5sR2S4BLt1xBy5J6VwPBX3vjtZ071iUWA5LwFTVPMj1/Dllm3ugMI7KLzCanv+are zTCSMUlRe3VGLf7R/X+eV+V9wtfT2Rnu/rRExviEVVMelDwvcHj+VCwjIioJIg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783534355; a=rsa-sha256; cv=none; b=uODJRub4tX7CXCE0sagjXf0ZLwhhb8iyP3ipZZOhuelP1BjnYrfgecQELaFIgbkkMiAval xnlXNr/tggsVU9Dr9USVGpFkFN3YdsnJSi87jKipPQOUsJEt5aUBgabwRJ+8HUyS4fsrEy hbkS+MiOMy2zZsQNocd+RWPcj8CxX5snpS8jQ1povFNC3ozssN65QyuSMr9avcZt3WrB8G xIGNMCU2SVeRL+bF1TynP4pVncLhJC6oxqFrMonq2ubpCsLjhDQxai4/hbAVq0DvSas107 /Y4/b//e+xGqdzAHXyVV58eYDnpZI//QeeJ9nlBxHhSE5FzbRDVui8lfN+pjwQ== 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=1783534355; 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=dmnw3Rn76NgKWQxVDHK1bMNebTD3O9w8+vWcZAefN7g=; b=Xzi+/yO9Oa9fIIS8Gpg3WX2clQJz2MzgoNRumtDBNaKhmxD/GAH1E3EcbmixnQ2uNGMoHf LBgnITJVLQxcg/ufJNgqUgwGguJbN3q9zxJJ2Z/OLOigCwwwCk4gHE8/9I+G07qf0VPvaV uv/jeqD98sppfKgRs2cbh+uNHeM3rQKdt2FtsjUMaZV0cnFTvnJj41jN7Yo5fbikeSKBBz mz8BujA+Qm7TDWqVRV4x5eWWlVddZE632xuyYVhF1NQdvwfbOcPAPopkypGJZtj8bDEhKn 6BY/XPKrsPzZQ29Em4cMzIguvVHRcaUmt2hiGepYW540J1IGr0qTbOTcGj/DRQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwR5b4phhzZdn for ; Wed, 08 Jul 2026 18:12:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3ab91 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 08 Jul 2026 18:12:35 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 69c4e2b68a58 - main - sound: Remove dead code in dsp_ioctl() 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 69c4e2b68a588272de6ab86e302d87188bfef2a6 Auto-Submitted: auto-generated Date: Wed, 08 Jul 2026 18:12:35 +0000 Message-Id: <6a4e9313.3ab91.3fc261e2@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=69c4e2b68a588272de6ab86e302d87188bfef2a6 commit 69c4e2b68a588272de6ab86e302d87188bfef2a6 Author: Christos Margiolis AuthorDate: 2026-07-08 18:11:54 +0000 Commit: Christos Margiolis CommitDate: 2026-07-08 18:11:54 +0000 sound: Remove dead code in dsp_ioctl() Sponsored by; The FreeBSD Foundation MFC after: 1 week --- sys/dev/sound/pcm/dsp.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index da8bf485bc9b..0a5063410d24 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -770,10 +770,6 @@ dsp_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, case AIONWRITE: /* how many bytes can write ? */ if (wrch) { CHN_LOCK(wrch); -/* - if (wrch && wrch->bufhard.dl) - while (chn_wrfeed(wrch) == 0); -*/ *arg_i = sndbuf_getfree(wrch->bufsoft); CHN_UNLOCK(wrch); } else { @@ -986,9 +982,6 @@ dsp_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, case FIONREAD: /* get # bytes to read */ if (rdch) { CHN_LOCK(rdch); -/* if (rdch && rdch->bufhard.dl) - while (chn_rdfeed(rdch) == 0); -*/ *arg_i = sndbuf_getready(rdch->bufsoft); CHN_UNLOCK(rdch); } else { @@ -1630,7 +1623,6 @@ dsp_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, ret = EINVAL; else { struct snd_dbuf *bs; - /* int tmp; */ oss_count_t *oc = (oss_count_t *)arg; From nobody Wed Jul 8 18:19:50 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 4gwRFy6WhLz6kdhN for ; Wed, 08 Jul 2026 18:19:50 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwRFy3WN4z4HXf for ; Wed, 08 Jul 2026 18:19:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783534790; 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=HMY2F5LWYvtkARX26EpWtZdB7PgozTIQiPykLeh0iAI=; b=doOVc9Ptb8CXnrRwGNWT2e7pr6yLw0u+AiEzE+JeW1mrumqzKutvVsKGGHxIYdIuoyHod6 lpSkDOBFpvqwZi5EPIXoafVZovBfOxBhpUp8HBpN7hwZFkf6vauLg3Nt5124DE53pu3EPw vxucfAFS1r6X3016ybuUOnPKimhdL1KCNv0KNqdNJQYH5tRGa6zdOMzzpaE05V2RTLqf68 JE0LAPNBpcYryEr9PG3bbIaQNfygQBov5smZig/D6dL6odhl5QbWBjB0THhWbnEE6s7q9G 8wcZd5YMJqO2BYzbGZxXVqeEj+V2pGm2w32c7mOHH4naGb1gZVgHKHFmFQZDlA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783534790; a=rsa-sha256; cv=none; b=MQwZW0mAjWiAtoNdgVdtBd4VymLogFqqr79fjYijrJHxRd9s6D8HFyu62Vo9primajxyqp n4gnoFp4ImzOvEcXxuJ6b36DCd984k8Hag9H6+kEWGmFNcwfGDozOWFI2GsfeBlGJ25wx9 etxs80/y2B3bhDUClMSyK31Lz93gm1B87xJpmhoL68wlXe/kOO3Fxtx+hb5qCti3DGUa+l E7BXOpUfoFJ+TZ8PXyUoh1Ha7HKwxDW0wigoLgSLzZ+/OawF93rBuBcNEyBb/q6IyKyP9f wO+00GGW7kfJ7soTkTmT93SzqL2Xftn8TuVAMs+2KwUIFoZAENwS/eZjsiXEYQ== 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=1783534790; 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=HMY2F5LWYvtkARX26EpWtZdB7PgozTIQiPykLeh0iAI=; b=PCTL9P1+w7ZERoQRhJ66XC0aJFF3M5e+e6BIVgvhOOCFzflQpKAeXhsCIdlkEQpoxxR6Ja xGSeAmhpNh8OLzxQ/1erW2oioBphNO3wPF1Iq9W9Fqu7LXvSCrKgP89J6vBzjpfvL92xfW VJWn9780a9N74/jID3pNmD4hoIj1mjDNCSliWohr2fsvSi6YaUIC3Oj25T8mrxoF+1LLJ9 YBNN5yBwkcqw4rt+1XeYIUvObzyv5zgC5m0EArVb5Qr5lGv3nh/E8nItdbin/3ZtJ369p6 pHxhyYh+Mix1ZypFbOj2mj3EConN9s20kNsAaUoAIxkJ4VjpBNVjV493ZNtG6A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwRFy2MW1zZdB for ; Wed, 08 Jul 2026 18:19:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3b26d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 08 Jul 2026 18:19:50 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 815dc35b7b5e - main - sound: Pass format and speed as arguments to sndbuf_create() 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 815dc35b7b5ed694fc1986d054149e375b8a17bd Auto-Submitted: auto-generated Date: Wed, 08 Jul 2026 18:19:50 +0000 Message-Id: <6a4e94c6.3b26d.558a76c7@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=815dc35b7b5ed694fc1986d054149e375b8a17bd commit 815dc35b7b5ed694fc1986d054149e375b8a17bd Author: Christos Margiolis AuthorDate: 2026-07-08 18:18:49 +0000 Commit: Christos Margiolis CommitDate: 2026-07-08 18:18:49 +0000 sound: Pass format and speed as arguments to sndbuf_create() Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/dev/sound/pcm/buffer.c | 5 ++++- sys/dev/sound/pcm/buffer.h | 2 +- sys/dev/sound/pcm/channel.c | 8 ++------ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/sys/dev/sound/pcm/buffer.c b/sys/dev/sound/pcm/buffer.c index 86278a46a731..73f75716a198 100644 --- a/sys/dev/sound/pcm/buffer.c +++ b/sys/dev/sound/pcm/buffer.c @@ -46,7 +46,8 @@ #include "snd_fxdiv_gen.h" struct snd_dbuf * -sndbuf_create(struct pcm_channel *channel, const char *desc) +sndbuf_create(struct pcm_channel *channel, u_int32_t fmt, u_int32_t spd, + const char *desc) { struct snd_dbuf *b; @@ -54,6 +55,8 @@ sndbuf_create(struct pcm_channel *channel, const char *desc) refcount_init(&b->refcount, 1); snprintf(b->name, SNDBUF_NAMELEN, "%s:%s", channel->name, desc); b->channel = channel; + sndbuf_setfmt(b, fmt); + sndbuf_setspd(b, spd); return b; } diff --git a/sys/dev/sound/pcm/buffer.h b/sys/dev/sound/pcm/buffer.h index fee41db2ff82..34f885db6609 100644 --- a/sys/dev/sound/pcm/buffer.h +++ b/sys/dev/sound/pcm/buffer.h @@ -60,7 +60,7 @@ struct snd_dbuf { char name[SNDBUF_NAMELEN]; }; -struct snd_dbuf *sndbuf_create(struct pcm_channel *channel, const char *desc); +struct snd_dbuf *sndbuf_create(struct pcm_channel *channel, u_int32_t fmt, u_int32_t spd, const char *desc); void sndbuf_destroy(struct snd_dbuf *b); void sndbuf_ref(struct snd_dbuf *b); void sndbuf_rele(struct snd_dbuf *b); diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 40a08d48fb21..ff7620c772c3 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -1223,8 +1223,8 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, chn_vpc_reset(c, SND_VOL_C_PCM, 1); CHN_UNLOCK(c); - b = sndbuf_create(c, "primary"); - bs = sndbuf_create(c, "secondary"); + b = sndbuf_create(c, c->format, c->speed, "primary"); + bs = sndbuf_create(c, c->format, c->speed, "secondary"); if (b == NULL || bs == NULL) { device_printf(d->dev, "%s(): failed to create %s buffer\n", __func__, b == NULL ? "hardware" : "software"); @@ -1246,10 +1246,6 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, goto fail; } - sndbuf_setfmt(b, c->format); - sndbuf_setspd(b, c->speed); - sndbuf_setfmt(bs, c->format); - sndbuf_setspd(bs, c->speed); sndbuf_setup(bs, NULL, 0); /** From nobody Wed Jul 8 18:59:47 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 4gwS861Jj2z6khZ5; Wed, 08 Jul 2026 18:59:50 +0000 (UTC) (envelope-from markj@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwS860p2nz4M5s; Wed, 08 Jul 2026 18:59:50 +0000 (UTC) (envelope-from markj@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783537190; 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: in-reply-to:in-reply-to:references:references; bh=H4BxVJsTZOyuTdlMYmje+oab1Xt6nb2rHl9XbzHU6Bg=; b=jAQdj1tM/WpZu4P13Q/+rhGLbLI0DFfymZf28IP3iYzbjdjnIbw9WwjtWJYNtROi8p+7jP pMWOh4i0W78m2PNqc94O6X0EjNwQacucn0x2OLerdvp5+dsD0aJIYynqIb8MXxBzuFckSv cIZBtDSzq/MFHKVdOk4U58enZ5VJQejD5hD5pB/t3c6f/M5Vod5xDv+5soEnp7EbhkcJ+2 8spQaKGlShuf5Z1YRZn6cc+TIa71D2/2irtNCE+KhLIN9kLpbdsjptGI+IJxZ6tXUCwxHg K7H8BiPBKQX42MFubaufryw+gii+rjJ35lRs49rtGMXm5eEoB8Oai9sEr5cTzg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783537190; a=rsa-sha256; cv=none; b=n6vY0gWO0YQLS9GD9L2NlN1ZxO5PhMQ7nJ8sPDWWMdI+8FF2KdbRi+JoP0kH5MaUtPX7+I uUxa+1Xzv875022N4Pn3T3Un2PK3ZqojChJksERQoKM1RVIGkHrlXAQ4nA32/6+HP1ynqr CsrNPdZXk5FlCzFQq6hvWoYVfXEy03bjtV4mUuS23bwX1DdkoJNCy/JlnHFCnBPisPRntX vofV11j+bmlQNDH2NutmsLTR/B77A9GlIf+tIjyy61p4ZUqVnu+6mayKnjecry0QcgrQpm 0DdPzK1o6BNa62pYYSioPNltiE2LyUPYnhjO93c2yXzRVwHi+RiZ+AYOZMvX0Q== 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=1783537190; 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: in-reply-to:in-reply-to:references:references; bh=H4BxVJsTZOyuTdlMYmje+oab1Xt6nb2rHl9XbzHU6Bg=; b=Sp+qn7gREZ+0AKiz0BPvmdCh4cjrc05yPLMWJ4rba4bioAzLTnILvOkCq8VaT5PbWLKxNg z+dNLkS/2X11LnWSDstsYXMx6GItrNo/5wnr2LaBcTIfikPfKSV00ZVK3hAFQu5EoNhjUI qzzU57c9n9kH5gMS2A34IieKt/ypkdiprQlybs/9ni92IRutuEnUB0HM3kILddmjj7ZO+G EXH4RUVpMS4XWCKzYb3wK2vy2jHdc3xLbR1hOgJindqTAb3xhWzB6P6i0hPxB5ktQCf+XG BL9IQZXygTyqIrysrOAZRdKNFf639mS5bMwNRUxwK7B3grKNc0U0C5Soob6A/A== Received: from nuc (192-0-220-237.cpe.teksavvy.com [192.0.220.237]) (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) (Authenticated sender: markj) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gwS854zxcz11JD; Wed, 08 Jul 2026 18:59:49 +0000 (UTC) (envelope-from markj@freebsd.org) Date: Wed, 8 Jul 2026 14:59:47 -0400 From: Mark Johnston To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: dfad790c8cca - main - sendfile: stop abusing kern_writev() Message-ID: References: <6a4d73f7.1e7dd.1cbcbd60@gitrepo.freebsd.org> 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=us-ascii Content-Disposition: inline In-Reply-To: <6a4d73f7.1e7dd.1cbcbd60@gitrepo.freebsd.org> On Tue, Jul 07, 2026 at 09:47:35PM +0000, Konstantin Belousov wrote: > The branch main has been updated by kib: > > URL: https://cgit.FreeBSD.org/src/commit/?id=dfad790c8ccad05ff603ceaa5b2efe4205b38e1c > > commit dfad790c8ccad05ff603ceaa5b2efe4205b38e1c > Author: Konstantin Belousov > AuthorDate: 2026-07-04 02:29:56 +0000 > Commit: Konstantin Belousov > CommitDate: 2026-07-07 21:47:18 +0000 > > sendfile: stop abusing kern_writev() > > Provide convenient wrapper kern_filewrite() around fo_write(). > Switch to use it in vn_sendfile(). This allows to avoid duplicate > fget() when we already have the reference to the file, which creates a > correctness race with the userspace. Also td_retval[0] clearing hack > can be removed. > > Reviewed by: glebius, markj > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D58035 > --- > sys/kern/kern_sendfile.c | 25 +++++++++++++------------ > sys/kern/sys_generic.c | 41 ++++++++++++++++++++++++++++++----------- > sys/sys/syscallsubr.h | 2 ++ > 3 files changed, 45 insertions(+), 23 deletions(-) > > diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c > index cf9716560c07..1a534210ca0c 100644 > --- a/sys/kern/kern_sendfile.c > +++ b/sys/kern/kern_sendfile.c > @@ -1168,14 +1168,17 @@ prepend_header: > } > > /* > - * Send trailers. Wimp out and use writev(2). > + * Send trailers. > */ > if (trl_uio != NULL) { > + ssize_t cnt; > + > SOCK_IO_SEND_UNLOCK(so); > CURVNET_RESTORE(); > - error = kern_writev(td, sockfd, trl_uio); > + error = kern_filewrite(td, sockfd, sock_fp, trl_uio, > + (off_t)-1, 0, &cnt); > if (error == 0) > - sbytes += td->td_retval[0]; > + sbytes += cnt; > goto out; > } > > @@ -1183,15 +1186,8 @@ done: > SOCK_IO_SEND_UNLOCK(so); > CURVNET_RESTORE(); > out: > - /* > - * If there was no error we have to clear td->td_retval[0] > - * because it may have been set by writev. > - */ > - if (error == 0) { > - td->td_retval[0] = 0; > - if (sbytes > 0 && vp != NULL) > - INOTIFY(vp, IN_ACCESS); > - } > + if (error == 0 && sbytes > 0 && vp != NULL) > + INOTIFY(vp, IN_ACCESS); > if (sent != NULL) { > (*sent) = sbytes; > } > @@ -1260,6 +1256,11 @@ sendfile(struct thread *td, struct sendfile_args *uap, int compat) > &trl_uio); > if (error != 0) > goto out; > + if (trl_uio->uio_rw != UIO_WRITE) { cloneuio() does not set uio_rw. sendfile() was relying on kern_writev() to do that. A GENERIC-KMSAN kernel panics when running the test suite: panic: MSan: Uninitialized malloc memory from copyinuio+0x11d cpuid = 5 time = 1783537112 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0xa7/frame 0xfffffe00764d7840 vpanic() at vpanic+0x538/frame 0xfffffe00764d79c0 panic() at panic+0x1dd/frame 0xfffffe00764d7ad0 __msan_warning() at __msan_warning+0x25d/frame 0xfffffe00764d7c20 sendfile() at sendfile+0xcb6/frame 0xfffffe00764d7d50 amd64_syscall() at amd64_syscall+0x837/frame 0xfffffe00764d7f30 fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe00764d7f30 --- syscall (393, FreeBSD ELF64, sendfile), rip = 0x21aad2ea3b0a, rsp = 0x21aad1d706c8, rbp = 0x21aad1d70760 --- KDB: enter: panic From nobody Wed Jul 8 19:36:44 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 4gwSyl0fYLz6klKq; Wed, 08 Jul 2026 19:36:47 +0000 (UTC) (envelope-from markj@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwSyl00cSz4QDg; Wed, 08 Jul 2026 19:36:47 +0000 (UTC) (envelope-from markj@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783539407; 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: in-reply-to:in-reply-to:references:references; bh=TvPeyZrVG2KimPtHRbsJy+y9cR1KY/0X+REKctjaafc=; b=h5Zwujm2QZs4MjPbqbBmvItlM/bGmqWTTndgkYaeGWTlCpK6UfDVFDBOPhdEM8lHKYKUeP AAd5Zc5kC4rrO9p40rY67T5LLZ0sOE4T6qTFcQEnHhznwukVelv/Qgy6qq5AxSRtyJyneo mnwuJxxrfHHzjShB9KozyClKiticE9Irn3IY3/5fRmTHBnLE+1UmmY6K5E4miZ13ttRl/t kRQanWPxB3M3b0BCEnJTrnjrmagInQaX+GHGKI1Y20EX3NZnYpswt8WS4bFjvk1TEsxZrN 9vnclQbkbwOAdbXk2/bulVIsEGADz80NWMCfTccZX0qYZ/3cBQK1D5Se/t3XoQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783539407; a=rsa-sha256; cv=none; b=RqAj7OxUrAmoPRNzAFkyppD7pm9pBoIeV5pXZy8xjEeW/9oFaRXniGlNEd6m4SX+54VXfu 1GA9BK/dQY0J5LMMF4W49CFsPLNgotREGwJaeNQ0o/361LRlbXI7L3reltrh9SnuJyA8fW AsjfE07Qix9sSp/jsgJrJ547VWMJC23DN6LmZ1YyGQBBDtb1IOmtk4NS60tcyx9jSeFpNK TSaOP/GD2B541cf1+6sLEW9hto+3YwINnRTkrktKKRvv5LQEB6OU6WkFLboQUaqgC3kFWV rqTdJpDPO+4ocoWN076FOq2jplzYnVefTp91EFLqwf1n8KNUfQpMOFpvggPg4Q== 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=1783539407; 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: in-reply-to:in-reply-to:references:references; bh=TvPeyZrVG2KimPtHRbsJy+y9cR1KY/0X+REKctjaafc=; b=ZXwFQ0ee0ZpEUSYTbZRKSWf5v7NJdkobMCcU5Fxx5NzhEwNE3Rgov6iItTb8ZwQgL0OueA ZKDYBlluRzyOsmigOW5z12yNhK4iE8ZlHuwFrl07n1IBV1+HCllmQnxwzpIirFyiqWY+c7 sOHwrHOgFQ2/68WB8Tb9GM3QWECe4glkMESQk8NWmW55s4TLHCs/RD7/VJz1fkUsODZ68j 0d91pmr2g2ggotgMp+3GTfTnmkCd8Iy/D1cBOldO9h55g/Z0/qiKmduD1q34xPgJb5pXVI CMvixTv/IYVV7UupLzHUGwCzbW8Xlj/xF6TG75xr1C1V3bIvwSQMMq5BQgeKjA== Received: from nuc (192-0-220-237.cpe.teksavvy.com [192.0.220.237]) (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) (Authenticated sender: markj) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gwSyk4JPBzyrf; Wed, 08 Jul 2026 19:36:46 +0000 (UTC) (envelope-from markj@freebsd.org) Date: Wed, 8 Jul 2026 15:36:44 -0400 From: Mark Johnston To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: dfad790c8cca - main - sendfile: stop abusing kern_writev() Message-ID: References: <6a4d73f7.1e7dd.1cbcbd60@gitrepo.freebsd.org> 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=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Jul 08, 2026 at 10:23:06PM +0300, Konstantin Belousov wrote: > On Wed, Jul 08, 2026 at 02:59:47PM -0400, Mark Johnston wrote: > > On Tue, Jul 07, 2026 at 09:47:35PM +0000, Konstantin Belousov wrote: > > > if (error != 0) > > > goto out; > > > + if (trl_uio->uio_rw != UIO_WRITE) { > > > > cloneuio() does not set uio_rw. sendfile() was relying on kern_writev() > > to do that. A GENERIC-KMSAN kernel panics when running the test suite: > > > > panic: MSan: Uninitialized malloc memory from copyinuio+0x11d > > cpuid = 5 > > time = 1783537112 > > KDB: stack backtrace: > > db_trace_self_wrapper() at db_trace_self_wrapper+0xa7/frame 0xfffffe00764d7840 > > vpanic() at vpanic+0x538/frame 0xfffffe00764d79c0 > > panic() at panic+0x1dd/frame 0xfffffe00764d7ad0 > > __msan_warning() at __msan_warning+0x25d/frame 0xfffffe00764d7c20 > > sendfile() at sendfile+0xcb6/frame 0xfffffe00764d7d50 > > amd64_syscall() at amd64_syscall+0x837/frame 0xfffffe00764d7f30 > > fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe00764d7f30 > > --- syscall (393, FreeBSD ELF64, sendfile), rip = 0x21aad2ea3b0a, rsp = 0x21aad1d706c8, rbp = 0x21aad1d70760 --- > > KDB: enter: panic > > The following should be enough, am I correct? I am re-running the test suite to see. I am also not sure about the offset. dofilewrite() sets auio->uio_offset = offset. kern_filewrite() takes an offset parameter and does nothing with it. copyinuio() initializes it to -1, so KMSAN will not report a problem, but it looks wrong to me. > commit 4152c4b88947d087a8fcb48a67d4dfddcdd60b31 > Author: Konstantin Belousov > Date: Wed Jul 8 22:21:00 2026 +0300 > > sendfile(): for trailers uio, set uio_rw to UIO_WRITE instead of checking it > > Reported by: markj > Fixes: dfad790c8cca ("sendfile: stop abusing kern_writev()") > > diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c > index 1a534210ca0c..fb6d2da201ef 100644 > --- a/sys/kern/kern_sendfile.c > +++ b/sys/kern/kern_sendfile.c > @@ -1256,10 +1256,7 @@ sendfile(struct thread *td, struct sendfile_args *uap, int compat) > &trl_uio); > if (error != 0) > goto out; > - if (trl_uio->uio_rw != UIO_WRITE) { > - error = EINVAL; > - goto out; > - } > + trl_uio->uio_rw = UIO_WRITE; > trl_uio->uio_td = td; > } > } > From nobody Wed Jul 8 21:00:48 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 4gwVql1q03z6ks6B for ; Wed, 08 Jul 2026 21:00:51 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwVql1XD7z3LnH for ; Wed, 08 Jul 2026 21:00:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783544451; 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=6GTWHgGfirZpIeSW/glRw9BR1bH/3feBFBj8XwSx2T0=; b=ZAnHie2o5aQblJLWlnnX32xq+yjhCQonjGC1eNc3k3xv6J2Ih3pYC+4sqLpkXTmrAIR9Wo CX/J2s4o+2rRCBlbf9M1i5hRRsjNO3TZGt/xRhqcaVnz/m+sN+XKjQ+rVeTRx7TUDjOS13 emWuclutZRg3fPgZXvpsueJccIzrbJLTSY0xDRN48cM1XbrF1dAlKfTqcER0tdIrUbJ8uO LpP8oj2p422ozJB03Ij+IJorxUc+lcdz4bppnvwi1aubaPg2F0zfUOdXox5dov9963SbAS MkXxxEHqSbvmOd9SRngscMU1AI397uTOio22Bc2yAvdb/N5P8+qaky/TpdPuQA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783544451; a=rsa-sha256; cv=none; b=vCmHZyg/FwCwrwbbm6SLpQSsxDYv70Q7JPxAJXvIQ8vn4ArsThbh2fXHJXr1qCSTvDA1Mr U/Q5o4Hy/STGZx/YRJkvHqhXPQC3LKepfqMaAgSKUX6nDTEW8+ONERpZaINpDibV8AMVVk K/Q92i0qTWJ/eYmnaY5PrlB+/HHuXajN8WloGu1vdT5xhRfPFLHkof3Arzr9Mb5ys/wyDE P137xzsFIiQ0DfoNVs/cTUEiGyjGnGUP2hROQbyxRYUsDTLu9qt8Xz1HDS2DoXPDAP+KMd KQfNe5bhNqXuah2k6kFvwFUQTR04AvvTQroTkA/zWNmshlxBBcKfsOAnr5xdrw== 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=1783544451; 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=6GTWHgGfirZpIeSW/glRw9BR1bH/3feBFBj8XwSx2T0=; b=qtq0k0tL07WSU6H2dSRUyTZWJNGwSBpBmLJRXLlQWRkf3ZH0ctRE+eJYDFi6SES05JoHkK x8L8vIws7c33Vu9mboxHqdVgQeX81dm5+E6cUd8LHtHpMcIV108qnlREDxz6OB+cd/IpEe tmqJjFTDDaCWDrDQWwS7gEoGUg3L9eYsgB3mTDGkrkj51iL8zBJ/pUBSWIDsLc6JJPt/Lq xoxmdH/+2WD5OlYEnL1ty65yxzmR6i8YacPQldHH0Fn/yKGcJQAy3PsVkiWpRQKkkIuN41 MLQlooKwUHMaOAk1ndQEzhVUGhKhbZF2lV6rjiZSsTM1AKi1AYCkGXFS5AxR0Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwVql0WmSzfXl for ; Wed, 08 Jul 2026 21:00:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 25603 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 08 Jul 2026 21:00:48 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Philip Paeps Subject: git: 665bb2d9a440 - main - contrib/tzdata: import tzdata 2026c 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: philip X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 665bb2d9a440d33e2ec2f9151e45b8cda93433ae Auto-Submitted: auto-generated Date: Wed, 08 Jul 2026 21:00:48 +0000 Message-Id: <6a4eba80.25603.470a8067@gitrepo.freebsd.org> The branch main has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=665bb2d9a440d33e2ec2f9151e45b8cda93433ae commit 665bb2d9a440d33e2ec2f9151e45b8cda93433ae Merge: 815dc35b7b5e dd6fd39608b6 Author: Philip Paeps AuthorDate: 2026-07-08 20:46:28 +0000 Commit: Philip Paeps CommitDate: 2026-07-08 20:46:28 +0000 contrib/tzdata: import tzdata 2026c Changes: https://github.com/eggert/tz/blob/2026c/NEWS MFC after: 3 days contrib/tzdata/Makefile | 45 ++++----- contrib/tzdata/NEWS | 79 ++++++++++++++-- contrib/tzdata/africa | 191 +++++++-------------------------------- contrib/tzdata/australasia | 2 +- contrib/tzdata/europe | 21 +++-- contrib/tzdata/leap-seconds.list | 8 +- contrib/tzdata/leapseconds | 8 +- contrib/tzdata/northamerica | 121 ++++++++++++++++++++++--- contrib/tzdata/theory.html | 18 ++-- contrib/tzdata/version | 2 +- contrib/tzdata/ziguard.awk | 8 +- contrib/tzdata/zone.tab | 2 +- contrib/tzdata/zone1970.tab | 2 +- contrib/tzdata/zonenow.tab | 9 +- 14 files changed, 272 insertions(+), 244 deletions(-) diff --cc contrib/tzdata/Makefile index 1e0a5903534d,000000000000..f5a22f1896a4 mode 100644,000000..100644 --- a/contrib/tzdata/Makefile +++ b/contrib/tzdata/Makefile @@@ -1,1447 -1,0 +1,1436 @@@ +# Make and install tzdb code and data. +# This file is in the public domain, so clarified as of +# 2009-05-17 by Arthur David Olson. +# Request POSIX conformance; this must be the first non-comment line. +.POSIX: +# By default, builds of code and data assume POSIX.1-2001 or later; +# this assumption can be relaxed by tailoring the build as described below. +# On older platforms you may need to scrounge for POSIX conformance. +# For example, on Solaris 10 (2005) with Sun Studio 12 aka Sun C 5.9 (2007), +# use 'PATH=/usr/xpg4/bin:$PATH make CC=c99'. +# Reproducible builds of distribution tarballs also need a copy of the +# Git repository, and assume the behavior of the following programs +# (or later versions): +# Git 2.7.0 (2016) +# GNU Coreutils 6.3 (2006) +# GNU Tar 1.14 (2004) +# GnuPG 1.4 (2004) +# Although tzdb does not come with a software bill of materials, +# you should be able to construct one based on the above information, +# your platform, and the way you use this Makefile. + +# To affect how this Makefile works, you can run a shell script like this: +# +# #!/bin/sh +# make CFLAGS='-O2 -DHAVE_GETTEXT=0' "$@" +# +# This example script is appropriate for a GNU/Linux system +# which needs more optimization than default, and which does not want +# gettext's internationalization of diagnostics. +# +# Alternatively, you can simply edit this Makefile to tailor the following +# macro definitions. + +############################################################################### +# Start of macros that one plausibly might want to tailor. + +# Package name for the code distribution. +PACKAGE= tzcode + +# Version number for the distribution, overridden in the 'tarballs' rule below. +VERSION= unknown + +# Email address for bug reports. +BUGEMAIL= tz@iana.org + +# DATAFORM selects the data format. +# Available formats represent essentially the same data, albeit +# possibly with minor discrepancies that users are not likely to notice. +# To get new features and the best data right away, use: +# DATAFORM= vanguard +# To wait a while before using new features, to give downstream users +# time to upgrade zic (the default), use: +# DATAFORM= main +# To wait even longer for new features, use: +# DATAFORM= rearguard +# Rearguard users might also want "ZFLAGS = -b fat"; see below. +DATAFORM= main + +# Change the line below for your timezone (after finding the one you want in +# one of the $(TDATA) source files, or adding it to a source file). +# Alternatively, if you discover you've got the wrong timezone, you can just +# 'zic -l -' to remove it, or 'zic -l rightzone' to change it. +# Use the command +# make zonenames +# to get a list of the values you can use for LOCALTIME. + +LOCALTIME= Factory + + +# Installation locations. +# +# The defaults are suitable for Debian, except that if REDO is +# posix_right or right_posix then files that Debian puts under +# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead +# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps, +# respectively. Problems with the Debian approach are discussed in +# the commentary for the right_posix rule (below). + +# Destination directory, which can be used for staging. +# 'make DESTDIR=/stage install' installs under /stage (e.g., to +# /stage/etc/localtime instead of to /etc/localtime). Files under +# /stage are not intended to work as-is, but can be copied by hand to +# the root directory later. If DESTDIR is empty, 'make install' does +# not stage, but installs directly into production locations. +DESTDIR = + +# Everything is installed into subdirectories of TOPDIR, and used there. +# TOPDIR should be empty (meaning the root directory), +# or a directory name that does not end in "/". +# TOPDIR should be empty or an absolute name unless you're just testing. +TOPDIR = + +# The default local timezone is taken from the file TZDEFAULT. +TZDEFAULT = $(TOPDIR)/etc/localtime + +# The subdirectory containing installed program and data files, and +# likewise for installed files that can be shared among architectures. +# These should be relative file names. +USRDIR = usr +USRSHAREDIR = $(USRDIR)/share + +# "Compiled" timezone information is placed in the "TZDIR" directory +# (and subdirectories). +# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty. +TZDIR_BASENAME= zoneinfo +TZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME) + +# The "tzselect" and (if you do "make INSTALL") "date" commands go in: +BINDIR = $(TOPDIR)/$(USRDIR)/bin + +# The "zdump" command goes in: +ZDUMPDIR = $(BINDIR) + +# The "zic" command goes in: +ZICDIR = $(TOPDIR)/$(USRDIR)/sbin + - # Manual pages go in subdirectories of. . . ++# Manual pages go in subdirectories of: +MANDIR = $(TOPDIR)/$(USRSHAREDIR)/man + +# Library functions are put in an archive in LIBDIR. +LIBDIR = $(TOPDIR)/$(USRDIR)/lib + + +# Types to try, as an alternative to time_t. +TIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL) +TIME_T_ALTERNATIVES_HEAD = int_least64_t.ck +TIME_T_ALTERNATIVES_TAIL = int_least32_t.ck uint_least32_t.ck \ + uint_least64_t.ck + +# What kind of TZif data files to generate. (TZif is the binary time +# zone data format that zic generates; see Internet RFC 9636.) +# If you want only POSIX time, with time values interpreted as +# seconds since the epoch (not counting leap seconds), use +# REDO= posix_only +# below. If you want only "right" time, with values interpreted +# as seconds since the epoch (counting leap seconds), use +# REDO= right_only +# below. If you want both sets of data available, with leap seconds not +# counted normally, use +# REDO= posix_right +# below. If you want both sets of data available, with leap seconds counted +# normally, use +# REDO= right_posix +# below. POSIX mandates that leap seconds not be counted, and a +# nonnegative TZ_CHANGE_INTERVAL also assumes this, so to be compatible with +# these, use "posix_only" or "posix_right". Use POSIX time on systems with +# leap smearing; this can work better than unsmeared "right" time with - # applications that are not leap second aware, and is closer to unsmeared ++# applications that are not aware of leap seconds, and is closer to unsmeared +# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error). + +REDO= posix_only + +# Whether to put an "Expires" line in the leapseconds file. +# Use EXPIRES_LINE=1 to put the line in, 0 to omit it. +# The EXPIRES_LINE value matters only if REDO's value contains "right". +# If you change EXPIRES_LINE, remove the leapseconds file before running "make". +# zic's support for the Expires line was introduced in tzdb 2020a, +# and was modified in tzdb 2021b to generate version 4 TZif files. +# EXPIRES_LINE defaults to 0 for now so that the leapseconds file +# can be given to pre-2020a zic implementations and so that TZif files +# built by newer zic implementations can be read by pre-2021b libraries. +EXPIRES_LINE= 0 + +# To install data in text form that has all the information of the TZif data, +# (optionally incorporating leap second information), use +# TZDATA_TEXT= tzdata.zi leapseconds +# To install text data without leap second information (e.g., because +# REDO='posix_only'), use +# TZDATA_TEXT= tzdata.zi +# To avoid installing text data, use +# TZDATA_TEXT= + +TZDATA_TEXT= leapseconds tzdata.zi + +# For backward-compatibility links for old zone names, use +# BACKWARD= backward +# To omit these links, use +# BACKWARD= + +BACKWARD= backward + +# If you want out-of-scope and often-wrong data from the file 'backzone', +# but only for entries listed in the backward-compatibility file zone.tab, use +# PACKRATDATA= backzone +# PACKRATLIST= zone.tab +# If you want all the 'backzone' data, use +# PACKRATDATA= backzone +# PACKRATLIST= +# To omit this data, use +# PACKRATDATA= +# PACKRATLIST= + +PACKRATDATA= +PACKRATLIST= + +# The name of a locale using the UTF-8 encoding, used during self-tests. +# The tests are skipped if the name does not appear to work on this system. + +UTF8_LOCALE= en_US.utf8 + +# Extra flags for producing man page files like tzfile.5.txt. +# These flags are used only if groff (or mandoc) is present. +# Each option should begin with "-" and should lack shell metacharacters. +# Plausible options include -Tascii and -Tutf8. +MANFLAGS= -Tutf8 + +# Non-default libraries needed to link. +# On some hosts, this should have -lintl unless CFLAGS has -DHAVE_GETTEXT=0. +LDLIBS= + +# Add the following to an uncommented "CFLAGS=" line as needed +# to override defaults specified in the source code or by the system. +# "-DFOO" is equivalent to "-DFOO=1". +# -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime +# formats that generate only the last two digits of year numbers +# -DEPOCH_LOCAL if the 'time' function returns local time not UT +# -DEPOCH_OFFSET=N if the 'time' function returns a value N greater +# than what POSIX specifies, assuming local time is UT. +# For example, N is 252460800 on AmigaOS. +# -DFREE_PRESERVES_ERRNO=[01] if the 'free' function munges or preserves errno +# (default is guessed) +# -DHAVE_DECL_ASCTIME_R=0 if does not declare asctime_r +# on POSIX platforms predating POSIX.1-2024 +# -DHAVE_DECL_ENVIRON if declares 'environ' +# -DHAVE_DECL_TIMEGM=0 if does not declare timegm +# -DHAVE_DIRECT_H if mkdir needs (MS-Windows) +# -DHAVE_FCHMOD=0 if your system lacks the fchmod function +# -DHAVE__GENERIC=0 if _Generic does not work* +# -DHAVE_GETEUID=0 if gete?[ug]id do not work +# -DHAVE_GETRANDOM if getrandom works (e.g., GNU/Linux), +# -DHAVE_GETRANDOM=0 to avoid using getrandom +# -DHAVE_GETRESUID=0 if getres[ug]id do not work +# -DHAVE_GETTEXT if gettext works (e.g., GNU/Linux, FreeBSD, Solaris), +# where LDLIBS also needs to contain -lintl on some hosts; +# -DHAVE_GETTEXT=0 to avoid using gettext +# -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares +# ctime_r and asctime_r incompatibly with POSIX.1-2017 and earlier +# (Solaris when _POSIX_PTHREAD_SEMANTICS is not defined). +# -DHAVE_INTTYPES_H=0 if does not work*+ +# -DHAVE_ISSETUGID=1 if issetugid works, 0 otherwise (default is guessed) +# If 0, you may also use -DHAVE_SYS_AUXV_H=1 if works, +# 0 otherwise (default is guessed). +# -DHAVE_LINK=0 if your system lacks a link function +# -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function +# -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz +# localtime_rz can make zdump significantly faster, but is nonstandard. +# -DHAVE_MALLOC_ERRNO=0 if malloc etc. do not set errno on failure. +# -DHAVE_MEMPCPY=1 if your system has mempcpy, 0 if not (default is guessed) +# -DHAVE_POSIX_DECLS=0 if your system's include files do not declare +# variables like 'tzname' required by POSIX +# -DHAVE_PWD_H=0 if your system lacks pwd.h, grp.h and corresponding functions +# If 0, you may also need -Dgid_t=G -Duid_t=U +# to define gid_t and uid_t to be types G and U. +# -DHAVE_SETENV=0 if your system lacks the setenv function +# -DHAVE_SETMODE=[01] if your system lacks or has the setmode and getmode +# functions (default is guessed) +# -DHAVE_SNPRINTF=0 if your system lacks the snprintf function+ +# -DHAVE_STDCKDINT_H=0 if neither nor substitutes like +# __builtin_add_overflow work* +# -DHAVE_STDINT_H=0 if does not work*+ +# -DHAVE_STRFTIME_L if declares locale_t and strftime_l +# -DHAVE_STRDUP=0 if your system lacks the strdup function +# -DHAVE_STRNLEN=0 if your system lacks the strnlen function+ +# -DHAVE_STRTOLL=0 if your system lacks the strtoll function+ +# -DHAVE_STRUCT_STAT_ST_CTIM=0 if struct stat lacks a status-change member +# of type struct timespec, so code should use st_ctime instead; +# but if the status-change member name is st_ctimespec, +# use -Dst_ctim=st_ctimespec instead (default is guessed)+ +# -DHAVE_STRUCT_TIMESPEC=0 if your system lacks struct timespec+ +# -DHAVE_SYMLINK=0 if your system lacks the symlink function +# -DHAVE_SYS_STAT_H=0 if does not work* +# If 0, you may also need -Dmode_t=M to define mode_t to be type M. +# -DHAVE_TZSET=0 if your system lacks a tzset function +# -DHAVE_UNISTD_H=0 if does not work* +# -DHAVE_UTMPX_H=0 if does not work* +# -Dlocale_t=XXX if your system uses XXX instead of locale_t +# -DMKTIME_MIGHT_OVERFLOW if mktime might fail due to time_t overflow +# -DOPENAT_TZDIR if tzset should use openat on TZDIR then a relative open. +# See localtime.c for details. +# -DPORT_TO_C89 if tzcode should also run on mostly-C89 platforms+ +# Typically it is better to use a later standard. For example, +# with GCC 4.9.4 (2016), prefer '-std=gnu11' to '-DPORT_TO_C89'. +# Even with -DPORT_TO_C89, the code needs at least one C99 +# feature (integers at least 64 bits wide) and maybe more. +# -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers +# with external linkage, e.g., applications cannot define 'localtime'. +# -Dssize_t=int on hosts like MS-Windows that lack ssize_t +# -DSUPPORT_C89=0 if the tzcode library should not support C89 callers +# Although -DSUPPORT_C89=0 might work around latent bugs in callers, +# it does not conform to POSIX. +# -DSUPPORT_POSIX2008 if the library should support older POSIX callers+ +# However, this might cause problems in POSIX.1-2024-or-later callers. +# -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has +# security implications and is not recommended for general use +# -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires; +# not needed by the main-program tz code, which is single-threaded. +# Append other compiler flags as needed, e.g., -pthread on GNU/Linux. - # The following options can also be used: ++# With -DTHREAD_SAFE the following options can also be used: +# -DTHREAD_PREFER_SINGLE to prefer speed in single-threaded apps, +# at some cost in CPU time and energy in multi-threaded apps. - # The following options can also be used: ++# With -DTHREAD_PREFER_SINGLE the following options can also be used: +# -DHAVE___ISTHREADED=1 if there is an extern int __isthreaded +# variable, 0 otherwise (default is guessed) +# -DHAVE_SYS_SINGLE_THREADED_H=0 if works, +# 0 otherwise (default is guessed) +# -DTHREAD_RWLOCK to use read-write locks instead of mutexes. +# This can improve parallelism and thus save real time +# if many threads call tzcode functions simultaneously. +# It also costs CPU time and thus energy. +# -DTHREAD_TM_MULTI to have gmtime, localtime, and offtime +# return different struct tm * addresses in different threads. +# This supports nonportable programs that call +# gmtime/localtime/offtime when they should call +# gmtime_r/localtime_r/offtime_r to avoid races. +# Because the corresponding storage is freed on thread exit, +# this option is incompatible with POSIX.1-2024 and earlier. +# It also costs CPU time and memory. +# -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t +# This is intended for internal use only; it mangles external names. +# -DTZ_CHANGE_INTERVAL=N if functions depending on TZ should check +# no more often than every N seconds for TZif file changes. +# If N is negative (the default), no such checking is done. +# This option is intended for platforms that want localtime etc. +# to respond to changes to a file selected by TZ, including to +# TZDEFAULT (normally /etc/localtime) if TZ is unset. +# On these platforms, REDO should be "posix_only" or "posix_right". +# This option does not affect tzalloc-allocated objects. +# -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz" +# -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory; +# the default is system-supplied, typically "/usr/lib/locale" +# -DTZ_RUNTIME_LEAPS=0 to disable runtime support for leap seconds. +# This conforms to POSIX, shrinks tzcode's attack surface, +# and is more efficient. However, it fails to support Internet +# RFC 9636's leap seconds. +# -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified +# DST transitions for proleptic format TZ strings lacking them. +# If not specified, it defaults to US rules for future DST transitions. +# This mishandles some past timestamps, as US DST rules have changed. +# It also mishandles settings like TZ='EET-2EEST' for eastern Europe, +# as Europe and US DST rules differ. +# -DTZNAME_MAXIMUM=N to limit time zone abbreviations to N bytes (default 254) +# -DUNINIT_TRAP if reading uninitialized storage can cause problems +# other than simply getting garbage data +# -DUSE_LTZ=0 to build zdump with the system time zone library +# Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below. +# -DZIC_BLOAT_DEFAULT=\"fat\" to default zic's -b option to "fat", and +# similarly for "slim". Fat TZif files work around incompatibilities +# and bugs in some TZif readers, notably older ones that +# ignore or otherwise mishandle 64-bit data in TZif files; +# however, fat TZif files may trigger bugs in newer TZif readers. +# Slim TZif files are more efficient, and are the default. +# -DZIC_MAX_ABBR_LEN_WO_WARN=3 +# (or some other number) to set the maximum time zone abbreviation length +# that zic will accept without a warning (the default is 6) +# -g to generate symbolic debugging info +# -Idir to include from directory 'dir' +# -O0 to disable optimization; other -O options to enable more optimization +# -Uname to remove any definition of the macro 'name' +# $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking +# +# * Options marked "*" can be omitted if your compiler is C23 compatible. +# * Options marked "+" are obsolescent and are planned to be removed +# once the code assumes C99 or later (say in the year 2029) +# and POSIX.1-2024 or later (say in the year 2034). +# +# Select instrumentation via "make GCC_INSTRUMENT='whatever'". +GCC_INSTRUMENT = \ + -fsanitize=undefined -fsanitize-address-use-after-scope \ + -fsanitize-trap=all -fstack-protector +# Omit -fanalyzer from GCC_DEBUG_FLAGS, as it makes GCC too slow. +GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 \ + $(GCC_INSTRUMENT) \ + -Wall -Wextra \ + -Walloc-size-larger-than=100000 -Warray-bounds=2 \ + -Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wcast-qual \ + -Wdate-time \ + -Wdeclaration-after-statement -Wdouble-promotion \ + -Wduplicated-branches -Wduplicated-cond -Wflex-array-member-not-at-end \ + -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \ - -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op \ ++ -Wfree-labels -Wimplicit-fallthrough=5 -Winit-self \ ++ -Wkeyword-macro -Wlogical-op \ + -Wmissing-declarations -Wmissing-prototypes \ + -Wmissing-variable-declarations -Wnested-externs \ + -Wnull-dereference \ + -Wold-style-definition -Woverlength-strings -Wpointer-arith \ - -Wshadow -Wshift-overflow=2 -Wstrict-overflow \ ++ -Wshadow -Wshift-overflow=2 \ + -Wstrict-prototypes -Wstringop-overflow=4 \ + -Wsuggest-attribute=cold \ + -Wsuggest-attribute=const -Wsuggest-attribute=format \ + -Wsuggest-attribute=malloc \ + -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \ + -Wtrampolines -Wundef -Wunused-macros -Wuse-after-free=3 \ + -Wvariadic-macros -Wvla -Wwrite-strings \ + -Wzero-as-null-pointer-constant \ + -Wno-format-nonliteral -Wno-sign-compare -Wno-type-limits +# +# If your system has a "GMT offset" field in its "struct tm"s +# (or if you decide to add such a field in your system's "time.h" file), +# add the name to a define such as +# -DTM_GMTOFF=tm_gmtoff +# to the end of the "CFLAGS=" line. If not defined, the code attempts to +# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this. +# Similarly, if your system has a "zone abbreviation" field, define +# -DTM_ZONE=tm_zone +# and define NO_TM_ZONE to suppress any guessing. +# Although POSIX.1-2024 requires these fields and they are widely available +# on GNU/Linux and BSD systems, some older systems lack them. +# +# The next batch of options control support for external variables +# exported by tzcode. In practice these variables are less useful +# than TM_GMTOFF and TM_ZONE. However, most of them are standardized. +# # +# # To omit or support the external variable "tzname", add one of: +# # -DHAVE_TZNAME=0 # do not support "tzname" +# # -DHAVE_TZNAME=1 # support "tzname", which is defined by system library +# # -DHAVE_TZNAME=2 # support and define "tzname" +# # to the "CFLAGS=" line. Although "tzname" is required by POSIX.1-1988 +# # and later, its contents are unspecified if you use a geographical TZ +# # and the variable is planned to be removed in a future POSIX edition. +# # If not defined, the code attempts to guess HAVE_TZNAME from other macros. +# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause +# # crashes when combined with some platforms' standard libraries, +# # presumably due to memory allocation issues. +# # +# # To omit or support the external variables "timezone" and "daylight", add +# # -DUSG_COMPAT=0 # do not support +# # -DUSG_COMPAT=1 # support, and variables are defined by system library +# # -DUSG_COMPAT=2 # support and define variables +# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by Unix +# # Systems Group code and are required by POSIX.1-2008 and later (with XSI), +# # although their contents are unspecified if you use a geographical TZ +# # and the variables are planned to be removed in a future edition of POSIX. +# # If not defined, the code attempts to guess USG_COMPAT from other macros. +# # +# # To support the external variable "altzone", add +# # -DALTZONE=0 # do not support +# # -DALTZONE=1 # support "altzone", which is defined by system library +# # -DALTZONE=2 # support and define "altzone" +# # to the end of the "CFLAGS=" line; although "altzone" appeared in +# # System V Release 3.1 it has not been standardized. +# # If not defined, the code attempts to guess ALTZONE from other macros. +# +# If you want functions that were inspired by early versions of X3J11's work, +# add +# -DSTD_INSPIRED +# to the end of the "CFLAGS=" line. This arranges for the following +# functions to be added to the time conversion library. +# "offtime" is like "gmtime" except that it accepts a second (long) argument +# that gives an offset to add to the time_t when converting it. +# "offtime_r" is to "offtime" what "gmtime_r" is to "gmtime". +# I.e., "offtime" and "offtime_r" are like calling "localtime_rz" +# with a fixed-offset zone. +# "timelocal" is nearly equivalent to "mktime". +# "timeoff" is like "timegm" except that it accepts a second (long) argument +# that gives an offset to use when converting to a time_t. +# I.e., "timeoff" is like calling "mktime_z" with a fixed-offset zone. +# "posix2time" and "time2posix" are described in an included manual page. +# X3J11's work does not describe any of these functions. +# These functions may well disappear in future releases of the time +# conversion package. +# +# If you don't want functions that were inspired by NetBSD, add +# -DNETBSD_INSPIRED=0 +# to the end of the "CFLAGS=" line. Otherwise, the functions +# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the +# time library, and if STD_INSPIRED is also defined to nonzero the functions +# "posix2time_z" and "time2posix_z" are added as well. +# The functions ending in "_z" (or "_rz") are like their unsuffixed +# (or suffixed-by-"_r") counterparts, except with an extra first +# argument of opaque type timezone_t that specifies the timezone. +# "tzalloc" allocates a timezone_t value, and "tzfree" frees it. +# +# If you want to allocate state structures in localtime, add +# -DALL_STATE +# to the end of the "CFLAGS=" line. Storage is obtained by calling malloc. +# +# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put +# out by the National Institute of Standards and Technology +# which claims to test C and POSIX conformance. If you want to pass PCTS, add +# -DPCTS +# to the end of the "CFLAGS=" line. +# +# If you want strict compliance with XPG4 as of 1994-04-09, add +# -DXPG4_1994_04_09 +# to the end of the "CFLAGS=" line. This causes "strftime" to always return +# 53 as a week number (rather than 52 or 53) for January days before +# January's first Monday when a "%V" format is used and January 1 +# falls on a Friday, Saturday, or Sunday. +# +# POSIX says CFLAGS defaults to "-O 1". +# Uncomment the following line and edit its contents as needed. + +#CFLAGS= -O 1 + + +# The name of a POSIX-like library archiver, its flags, C compiler, +# linker flags, and 'make' utility. Ordinarily the defaults suffice. +# The commented-out values are the defaults specified by POSIX.1-2024. +#AR = ar +#ARFLAGS = -rv +#CC = c17 +#LDFLAGS = +#MAKE = make + +# Where to fetch leap-seconds.list from. +leaplist_URI = \ + https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list +# The file is generated by the IERS Earth Orientation Centre, in Paris. +leaplist_TZ = Europe/Paris +# +# To fetch leap-seconds.list from NIST via a less-secure protocol +# and with less-volatile metadata, use these settings: +#leaplist_URI = ftp://ftp.boulder.nist.gov/pub/time/leap-seconds.list +#leaplist_TZ = America/Denver + +# The zic command and its arguments. + +zic= ./zic +ZIC= $(zic) $(ZFLAGS) + +# To shrink the size of installed TZif files, +# append "-r @N" to omit data before N-seconds-after-the-Epoch. +# To grow the files and work around bugs in older applications, +# possibly at the expense of introducing bugs in newer ones, +# append "-b fat"; see ZIC_BLOAT_DEFAULT above. +# See the zic man page for more about -b and -r. +ZFLAGS= + +# How to use zic to install TZif files. + +ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' + +# The name of a POSIX-compliant 'awk' on your system. +# mawk 1.3.3 and Solaris 10 /usr/bin/awk do not work. +# Also, it is better (though not essential) if 'awk' supports UTF-8, +# and unfortunately mawk and busybox awk do not support UTF-8. - # Try AWK=gawk or AWK=nawk if your awk has the abovementioned problems. ++# Try AWK=gawk or AWK=nawk if your awk has the problems mentioned above. +AWK= awk + +# The full path name of a POSIX-compliant shell, preferably one that supports +# the Korn shell's 'select' statement as an extension. +# These days, Bash is the most popular. +# It should be OK to set this to /bin/sh, on platforms where /bin/sh +# lacks 'select' or doesn't completely conform to POSIX, but /bin/bash +# is typically nicer if it works. +KSHELL= /bin/bash + +# Name of curl , used for HTML validation +# and to fetch leap-seconds.list from upstream. +# Set CURL=: to disable use of the Internet. +CURL= curl + +# Name of GNU Privacy Guard , used to sign distributions. +GPG= gpg + +# This expensive test requires USE_LTZ. +# To suppress it, define this macro to be empty. +CHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives + +# SAFE_CHAR is a regular expression that matches a safe character. +# Some parts of this distribution are limited to safe characters; +# others can use any UTF-8 character. +# For now, the safe characters are a safe subset of ASCII. +# The caller must set the shell variable 'sharp' to the character '#', +# since Makefile macros cannot contain '#'. +# TAB_CHAR is a single tab character, in single quotes. +TAB_CHAR= ' ' +SAFE_CHARSET1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@' +SAFE_CHARSET2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`' +SAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~' +SAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3) +SAFE_CHAR= '[]'$(SAFE_CHARSET)'-]' + +# These non-alphabetic, non-ASCII printable characters are +# used in commentary or in generated *.txt files +# and are not likely to cause confusion. +UNUSUAL_OK_CHARSET= §«°±»½¾×–‘’“”•→−≤★⟨⟩⯪ + +# Put this in a bracket expression to match spaces. +s = [:space:] + +# OK_CHAR matches any character allowed in the distributed files. +# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and +# multibyte letters are also allowed so that commentary can contain a +# few safe symbols and people's names and can quote non-English sources. +OK_CHAR= '[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]' + +# SAFE_LINE matches a line of safe characters. +# SAFE_SHARP_LINE is similar, except any OK character can follow '#'; +# this is so that comments can contain non-ASCII characters. +# OK_LINE matches a line of OK characters. +SAFE_LINE= '^'$(SAFE_CHAR)'*$$' +SAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$' +OK_LINE= '^'$(OK_CHAR)'*$$' + +# Flags to give 'tar' when making a distribution. +# Try to use flags appropriate for GNU tar. +GNUTARFLAGS= --format=pax --pax-option=delete=atime,delete=ctime \ + --numeric-owner --owner=0 --group=0 \ + --mode=go+u,go-w --sort=name +SETUP_TAR= \ + export LC_ALL=C && \ + if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; then \ + TAR='tar $(GNUTARFLAGS)'; \ + else \ + TAR=tar; \ + fi + +# Flags to give 'gzip' when making a distribution. +GZIPFLAGS= -9n + +# When comparing .tzs files, use GNU diff's -F'^TZ=' option if supported. +# This makes it easier to see which Zone has been affected. +SETUP_DIFF_TZS = \ + if diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1; then \ + DIFF_TZS='diff -u -F^TZ='; \ + else \ + DIFF_TZS='diff -u'; \ + fi + +# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. +RANLIB= : + +# POSIX prohibits defining or using SHELL. However, csh users on systems +# that use the user shell for Makefile commands may need to define SHELL. +#SHELL= /bin/sh + +# End of macros that one plausibly might want to tailor. +############################################################################### + + +TZCOBJS= zic.o +TZDOBJS= zdump.o localtime.o strftime.o +DATEOBJS= date.o localtime.o strftime.o +LIBSRCS= localtime.c asctime.c difftime.c strftime.c +LIBOBJS= localtime.o asctime.o difftime.o strftime.o +HEADERS= tzfile.h private.h +NONLIBSRCS= zic.c zdump.c +NEWUCBSRCS= date.c +SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \ + tzselect.ksh workman.sh +MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \ + tzfile.5 tzselect.8 zic.8 zdump.8 +MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \ + time2posix.3.txt \ + tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \ + date.1.txt +COMMON= calendars CONTRIBUTING LICENSE Makefile \ + NEWS README SECURITY theory.html version +WEB_PAGES= tz-art.html tz-how-to.html tz-link.html +CHECK_WEB_PAGES=theory.ck tz-art.ck tz-how-to.ck tz-link.ck +DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) +PRIMARY_YDATA= africa antarctica asia australasia \ + europe northamerica southamerica +YDATA= $(PRIMARY_YDATA) etcetera +NDATA= factory +TDATA_TO_CHECK= $(YDATA) $(NDATA) backward +TDATA= $(YDATA) $(NDATA) $(BACKWARD) +ZONETABLES= zone.tab zone1970.tab zonenow.tab +TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) +LEAP_DEPS= leapseconds.awk leap-seconds.list +TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) \ + $(PACKRATDATA) $(PACKRATLIST) +DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST) +DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ + leapseconds $(ZONETABLES) +AWK_SCRIPTS= checklinks.awk checknow.awk checktab.awk leapseconds.awk \ + ziguard.awk zishrink.awk +MISC= $(AWK_SCRIPTS) +TZS_YEAR= 2050 +TZS_CUTOFF_FLAG= -c $(TZS_YEAR) +TZS= to$(TZS_YEAR).tzs +TZS_NEW= to$(TZS_YEAR)new.tzs +TZS_DEPS= $(YDATA) localtime.c private.h \ + strftime.c tzfile.h zdump.c zic.c +TZDATA_DIST = $(COMMON) $(DATA) $(MISC) +# EIGHT_YARDS is just a yard short of the whole ENCHILADA. +EIGHT_YARDS = $(TZDATA_DIST) $(DOCS) $(SOURCES) tzdata.zi +ENCHILADA = $(EIGHT_YARDS) $(TZS) + +# Consult these files when deciding whether to rebuild the 'version' file. +# This list is not the same as the output of 'git ls-files', since +# .gitignore is not distributed. +VERSION_DEPS= \ + calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \ + africa antarctica asctime.c asia australasia \ + backward backzone \ + checklinks.awk checknow.awk checktab.awk \ + date.1 date.c difftime.c \ + etcetera europe factory iso3166.tab \ + leap-seconds.list leapseconds.awk localtime.c \ + newctime.3 newstrftime.3 newtzset.3 northamerica \ + private.h southamerica strftime.c theory.html \ + time2posix.3 tz-art.html tz-how-to.html tz-link.html \ + tzfile.5 tzfile.h tzselect.8 tzselect.ksh \ + workman.sh zdump.8 zdump.c zic.8 zic.c \ + ziguard.awk zishrink.awk \ + zone.tab zone1970.tab zonenow.tab + +all: tzselect zic zdump libtz.a $(TABDATA) \ + vanguard.zi main.zi rearguard.zi + +ALL: all date $(ENCHILADA) + +install: all $(DATA) $(REDO) $(MANS) + mkdir -p '$(DESTDIR)$(BINDIR)' \ + '$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \ + '$(DESTDIR)$(LIBDIR)' \ + '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \ + '$(DESTDIR)$(MANDIR)/man8' + $(ZIC_INSTALL) -l $(LOCALTIME) \ + -t '$(DESTDIR)$(TZDEFAULT)' + cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.' + cp tzselect '$(DESTDIR)$(BINDIR)/.' + cp zdump '$(DESTDIR)$(ZDUMPDIR)/.' + cp zic '$(DESTDIR)$(ZICDIR)/.' + cp libtz.a '$(DESTDIR)$(LIBDIR)/.' + $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a' + cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.' + cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.' + cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.' + +INSTALL: ALL install date.1 + mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1' + cp date '$(DESTDIR)$(BINDIR)/.' + cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.' + +# Calculate version number from git, if available. +# Otherwise, use $(VERSION) unless it is "unknown" and there is already +# a 'version' file, in which case reuse the existing 'version' contents +# and append "-dirty" if the contents do not already end in "-dirty". +version: $(VERSION_DEPS) + { (type git) >/dev/null 2>&1 && \ + V=$$(git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ + --abbrev=7 --dirty) || \ + if test '$(VERSION)' = unknown && read -r V <$@; then \ + V=$${V%-dirty}-dirty; \ + else \ + V='$(VERSION)'; \ + fi; } && \ + printf '%s\n' "$$V" >$@.out + mv $@.out $@ + +# These files can be tailored by setting BACKWARD, PACKRATDATA, PACKRATLIST. +vanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS) + $(AWK) \ + -v DATAFORM=$(@:.zi=) \ + -v PACKRATDATA='$(PACKRATDATA)' \ + -v PACKRATLIST='$(PACKRATLIST)' \ + -f ziguard.awk \ + $(TDATA) $(PACKRATDATA) >$@.out + mv $@.out $@ +# This file has a version comment that attempts to capture any tailoring +# via BACKWARD, DATAFORM, PACKRATDATA, PACKRATLIST, and REDO. +tzdata.zi: $(DATAFORM).zi version zishrink.awk + read -r version $@.out + mv $@.out $@ + +tzdir.h: + printf '%s\n' >$@.out \ + '#ifndef TZDEFAULT' \ + '# define TZDEFAULT "$(TZDEFAULT)" /* default zone */' \ + '#endif' \ + '#ifndef TZDIR' \ + '# define TZDIR "$(TZDIR)" /* TZif directory */' \ + '#endif' + mv $@.out $@ + +version.h: version + read -r VERSION $@.out + mv $@.out $@ + +zdump: $(TZDOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS) + +zic: $(TZCOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS) + +leapseconds: $(LEAP_DEPS) + $(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \ + -f leapseconds.awk leap-seconds.list >$@.out + mv $@.out $@ + +# Awk script to extract a Git-style author from leap-seconds.list comments. +EXTRACT_AUTHOR = \ + author_line { sub(/^.[[:space:]]*/, ""); \ + sub(/:[[:space:]]*/, " <"); \ + printf "%s>\n", $$0; \ + success = 1; \ + exit \ + } \ + /Questions or comments to:/ { author_line = 1 } \ + END { exit !success } + +# Fetch leap-seconds.list from upstream. +fetch-leap-seconds.list: + $(CURL) -OR $(leaplist_URI) + +# Fetch leap-seconds.list from upstream and commit it to the local repository. +commit-leap-seconds.list: fetch-leap-seconds.list + author=$$($(AWK) '$(EXTRACT_AUTHOR)' leap-seconds.list) && \ + date=$$(TZ=$(leaplist_TZ) stat -c%y leap-seconds.list) && \ + git commit --author="$$author" --date="$$date" -m'make $@' \ + leap-seconds.list + +# Arguments to pass to submakes. +# They can be overridden by later submake arguments. +INSTALLARGS = \ + BACKWARD='$(BACKWARD)' \ + DESTDIR='$(DESTDIR)' \ + PACKRATDATA='$(PACKRATDATA)' \ + PACKRATLIST='$(PACKRATLIST)' \ + TZDEFAULT='$(TZDEFAULT)' \ + TZDIR='$(TZDIR)' \ + ZIC='$(ZIC)' + +INSTALL_DATA_DEPS = zic leapseconds tzdata.zi + +posix_only: $(INSTALL_DATA_DEPS) + $(ZIC_INSTALL) tzdata.zi + +right_only: $(INSTALL_DATA_DEPS) + $(ZIC_INSTALL) -L leapseconds tzdata.zi + +# In earlier versions of this makefile, the other two directories were +# subdirectories of $(TZDIR). However, this led to configuration errors. +# For example, with posix_right under the earlier scheme, +# TZ='right/Australia/Adelaide' got you localtime with leap seconds, +# but gmtime without leap seconds, which led to problems with applications +# like sendmail that subtract gmtime from localtime. +# Therefore, the other two directories are now siblings of $(TZDIR). +# You must replace all of $(TZDIR) to switch from not using leap seconds +# to using them, or vice versa. +right_posix: right_only + rm -fr '$(DESTDIR)$(TZDIR)-leaps' + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \ + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only + +posix_right: posix_only + rm -fr '$(DESTDIR)$(TZDIR)-posix' + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \ + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only + +zones: $(REDO) + +# dummy.zd is not a real file; it is mentioned here only so that the +# top-level 'make' does not have a syntax error. +ZDS = dummy.zd +# Rule used only by submakes invoked by the $(TZS_NEW) rule. +# It is separate so that GNU 'make -j' can run instances in parallel. +$(ZDS): zdump + ./zdump -i $(TZS_CUTOFF_FLAG) "$$PWD/$(@:.zd=)" >$@ + +TZS_NEW_DEPS = tzdata.zi zdump zic +$(TZS_NEW): $(TZS_NEW_DEPS) + rm -fr tzs$(TZS_YEAR).dir + mkdir tzs$(TZS_YEAR).dir + $(zic) -d tzs$(TZS_YEAR).dir tzdata.zi + $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \ + tzdata.zi | LC_ALL=C sort >$@.out + x=$$($(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \ + tzdata.zi \ + | LC_ALL=C sort -t . -k 2,2) && \ + set x $$x && \ + shift && \ + ZDS=$$* && \ + $(MAKE) TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \ + ZDS="$$ZDS" $$ZDS && \ + sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out + rm -fr tzs$(TZS_YEAR).dir + mv $@.out $@ + +# If $(TZS) exists but 'make tzs.ck' fails, a maintainer should inspect the +# failed output and fix the inconsistency, perhaps by running 'make force_tzs'. +$(TZS): + touch $@ + +force_tzs: $(TZS_NEW) + cp $(TZS_NEW) $(TZS) + +libtz.a: $(LIBOBJS) + rm -f $@ + $(AR) $(ARFLAGS) $@ $(LIBOBJS) + $(RANLIB) $@ + +date: $(DATEOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS) + +tzselect: tzselect.ksh version + read -r VERSION $@.out + chmod +x $@.out + mv $@.out $@ + +check: check_mild back.ck now.ck +check_mild: check_web check_zishrink \ + character-set.ck white-space.ck links.ck mainguard.ck \ - name-lengths.ck slashed-abbrs.ck sorted.ck \ ++ name-lengths.ck news.ck slashed-abbrs.ck sorted.ck \ + tables.ck ziguard.ck tzs.ck + +# True if UTF8_LOCALE does not work; +# otherwise, false but with LC_ALL set to $(UTF8_LOCALE). +UTF8_LOCALE_MISSING = \ + { test ! '$(UTF8_LOCALE)' \ + || ! printf 'A\304\200B\n' \ + | LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 \ + || { export LC_ALL='$(UTF8_LOCALE)'; false; }; } + +character-set.ck: $(ENCHILADA) + $(UTF8_LOCALE_MISSING) || { \ + sharp='#' && \ + ! grep -Env $(SAFE_LINE) $(MANS) date.1 \ + $(MISC) $(SOURCES) \ + LICENSE \ + version tzdata.zi && \ + ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \ + Makefile && \ + ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ + leapseconds zone.tab && \ + ! grep -Env $(OK_LINE) $(ENCHILADA); \ + } *** 516 LINES SKIPPED *** From nobody Wed Jul 8 21:15:35 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 4gwW8m0jnnz6ktBb for ; Wed, 08 Jul 2026 21:15:36 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwW8l74FMz3NVg for ; Wed, 08 Jul 2026 21:15:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783545336; 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=k7xelw3jFEz8iqafH03P2QxHnc7X9pfe3JLa/sX7CKI=; b=r/s+wz7CACJ+O/R2QEkL3HGhg+Q+i0PpORHQNnClY0+cQcDPEjVekDnDFB7/+YT6R4US8f ed0eOXkrcfdWp3uzINEDOOlcYZPmVoSj2F2qtCYnMnG1OjyqQNbgQSERq2Unms4XZlaQEi VdCbEPoH0BbAub/1ArN5kIRoSCeq02uYtoYe4X8rD03/LHgcqR9K+KAO1EozD0hSeG07hU l06mOewdeUYQm8u6NQBsiTEsEdaO8mUQ93GjyLC6vwSx7wJOcTC0sdNExOia9TxQExLEsX XiLF09HAZ/D6PYah5+F3YwYoFQWivu2JiZuBzKWymBUcjanN3pgXNgm0R0JLGQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783545336; a=rsa-sha256; cv=none; b=OaerTNU3X92H/QvGZZZn8MaMXtJYE4XYuN2Yb4tOCq2Ft0ulhxhRv/NDOVFHodxiiJZZBv 7NdMezWf9XluQywX55mTLjen0zdugNHhMaFzx86Z5ArI0R9u+puZuHtInU4kubhPCvMgVn 2dgq8XPPAI+c7Nlr4lq6ZW72pg6hMfYPvnjrdPTX5No+9hpnHPrDe935knT0Ojv5uZXAjD 1D4YMTgdlv/FnEOqrScS1h6OE6n9gx/pzmOMuY1QBK5jJ4ogv1aXlnk8GbKa6EQ+A/Ta/R OTdPiTPH6ZYASlhOGwUhoLlrTS/5WUUO9nvR80iiBWtGPrICzMVViib4vWT7cQ== 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=1783545336; 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=k7xelw3jFEz8iqafH03P2QxHnc7X9pfe3JLa/sX7CKI=; b=KEodejucd90ozdcdQ1QMJnUo9BnL0jD1/eumT3F3QbVBErRf/7fWjMGrxHhRKJ7QqAndB2 wxxMExjJrgp7BIjVjeeECMI4aP16aEDThX2fom42Q/N+/30UzCP0S/hG6ZbAaOCj3PkGRL 5gPIEScbmObilaU6h+kbyUz6BgMFsVnNcqePnzBlssiyBFXG6T48tvpHf8kypiTZ0pOgFE m9mC2bVxPs+N3Wb48tGHVzoGM44lWTYKGlHUYJqjP8yOVC0yNdNvfeqEpvoKRXT+RfhIdS i2rMF/bRchytQGTjyyxqHxM2rjZh1JfSjQvWQJVBG/BKWsjrkoXuZlU3pms1uQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwW8l5qvfzfGk for ; Wed, 08 Jul 2026 21:15:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 25467 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 08 Jul 2026 21:15:35 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 750d429a228f - main - vfs cache: further massage some commentary 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: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 750d429a228fb102d6e5d45bdc116489acbfff00 Auto-Submitted: auto-generated Date: Wed, 08 Jul 2026 21:15:35 +0000 Message-Id: <6a4ebdf7.25467.59f938de@gitrepo.freebsd.org> The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=750d429a228fb102d6e5d45bdc116489acbfff00 commit 750d429a228fb102d6e5d45bdc116489acbfff00 Author: Mateusz Guzik AuthorDate: 2026-07-08 21:13:34 +0000 Commit: Mateusz Guzik CommitDate: 2026-07-08 21:15:31 +0000 vfs cache: further massage some commentary --- sys/kern/vfs_cache.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 66210bf58a7c..9e1c9cb757b5 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -6349,7 +6349,7 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) * Note: all VOP_FPLOOKUP_VEXEC routines have a comment referencing this one. * * Filesystems can opt in by setting the MNTK_FPLOOKUP flag and meeting criteria - * outlined at the end. + * outlined at the end of this comment. * * Traversing from one vnode to another requires atomicity with regard to * permissions, mount points and of course their relative placement (if you are @@ -6370,6 +6370,13 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) * See places which issue vn_seqc_write_begin()/vn_seqc_write_end() for * operations affected. * + * Note: regardless of locked or unlocked operation atomicity of traversal only + * covers the immediate move from one vnode to the next. For example, suppose you + * are looking up "foo/level2/level3" and are racing against rename("foo", bar"). + * If the vnode for "level2" was found and locked prior to the rename call locking + * "foo", then by the time "level3" is locked the true path might happen to be + * "bar/level2/level3". + * * Suppose the variable "cnp" contains lookup metadata (the path etc.), then * locked lookup conceptually looks like this: * @@ -6378,16 +6385,16 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) * for (;;) { * // permission check * if (!canlookup(dvp, cnp)) - * abort(); + * fail(); * // look for the target name inside dvp * tvp = findnext(dvp, cnp); * vn_lock(tvp); * // tvp is still guaranteed to be inside of dvp because of the lock on dvp * vn_unlock(dvp); - * // dvp is unlocked. its state is now arbitrary, but that's fine as we + * // dvp is unlocked and its state is now arbitrary, but that's fine as we * // made the jump while everything relevant was correct, continue with tvp * // as the directory to look up names in - * tvp = dvp; + * dvp = tvp; * if (last) * break; * // if not last loop back and continue until done @@ -6395,7 +6402,8 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) * vget(tvp); * return (tvp); * - * Lockless lookup replaces locking with sequence counter checks: + * Lockless lookup replaces locking with sequence counter checks. If any of + * them fail, it falls back to locked traversal. * * vfs_smr_enter(); * dvp_seqc = seqc_read_any(dvp); From nobody Wed Jul 8 22:57:21 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 4gwYQC5NDWz6l22m; Wed, 08 Jul 2026 22:57:23 +0000 (UTC) (envelope-from markj@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwYQC3ZX8z3YxC; Wed, 08 Jul 2026 22:57:23 +0000 (UTC) (envelope-from markj@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783551443; 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: in-reply-to:in-reply-to:references:references; bh=Av7XphwkYokmQd7WrxY0gJD9zY/Kt8hnVqZECFxHcDU=; b=OzT6kmvfAgysUHNPoAX7HxujEoQyLTDHa5l7jn8Fgxzrez7DqSh5qREgJhAcKYjbcmvR4L OwJsMpMeMVFmzB1N/EhySWbn2FABwc2shFE99nI3Jy2jKnZlWTGclfkIqGAFvVCzv/igZ5 L/eiyiDro7GV5b03cg8daU2oHAkfyKtjwrAXPLQmQUB/c5BJ9fA7KSal6rzP2QkdGXFEAS 87F5tJUuJ4iu0UnFVP1wstnlWbinXOzNcbHGnuYW87tFZzLflZpa6dL8UGG1j4vLAI9vUB VPZQWAWqmXZaf4M6t/NvoLDDOl9uruUmqFHXDMMj/1AVeYGX9/ViKDIn5aaKYg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783551443; a=rsa-sha256; cv=none; b=va9+1RzMOqEJ/GGvndDizhbrkvbeWBeSZnollv53g79zE/DHnNpSecQLeVNVyMPjcYuF5e 9ozttU+7By9I0Rvv3mI4CBQmiR780s56mWa5Oqs8VqLxV9GpToT8UYyJB3KzXAqew5aTpG mz4YS6squOYCW03WR3gLEZghetFM4V2XPny+sE7GV4tKbcZDgTpRMBQo6uDi4oKqnv4lcT Ow12gmBsTXTG7BHtduQcnhYuaOLdBUMTtCKsdkNtDVPWosaPVj6hjxunwsSwuvamLRxAWw u5nr+UGNWAwyit7uHiyrgj5RP7EJDNspS63SyXBCkWWMNAECVkNGDueEJuU6ZA== 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=1783551443; 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: in-reply-to:in-reply-to:references:references; bh=Av7XphwkYokmQd7WrxY0gJD9zY/Kt8hnVqZECFxHcDU=; b=QCJ7ZfWREZnMTilHJSUS04FZ9a5qWW6YSaVQlmIyxeW/nOcM1cXjFT9xI4L094etmMM6v6 H+W8IzROScuIokIGjfGCVxel/sqFN5OwRTsPy6vcouBxjbePLDo5tAd1XqY8vOz2niM3C5 7Zm/14RSy4oYVnkztk92UpWUQ1y7r6XGJ6G1GK6DmaAC213Jgx7qZiykxl3OrL2u7RcxPs 9RC8+LKqzWSeSfB9LNvuQW6FvTro5DbfqVX/gcMD1lMCtNwpOj3eMU8v6GyBzZfSo4vuB/ cLitHhutlZ5qIMzjY9sJc//wezvWSUALInIb0CXEUAto16IswGZjQCh27HZWeg== Received: from nuc (192-0-220-237.cpe.teksavvy.com [192.0.220.237]) (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) (Authenticated sender: markj) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gwYQC0tQ8z14Tt; Wed, 08 Jul 2026 22:57:23 +0000 (UTC) (envelope-from markj@freebsd.org) Date: Wed, 8 Jul 2026 18:57:21 -0400 From: Mark Johnston To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: dfad790c8cca - main - sendfile: stop abusing kern_writev() Message-ID: References: <6a4d73f7.1e7dd.1cbcbd60@gitrepo.freebsd.org> 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=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Jul 08, 2026 at 11:23:27PM +0300, Konstantin Belousov wrote: > On Wed, Jul 08, 2026 at 03:36:44PM -0400, Mark Johnston wrote: > > On Wed, Jul 08, 2026 at 10:23:06PM +0300, Konstantin Belousov wrote: > > > On Wed, Jul 08, 2026 at 02:59:47PM -0400, Mark Johnston wrote: > > > > On Tue, Jul 07, 2026 at 09:47:35PM +0000, Konstantin Belousov wrote: > > > > > if (error != 0) > > > > > goto out; > > > > > + if (trl_uio->uio_rw != UIO_WRITE) { > > > > > > > > cloneuio() does not set uio_rw. sendfile() was relying on kern_writev() > > > > to do that. A GENERIC-KMSAN kernel panics when running the test suite: > > > > > > > > panic: MSan: Uninitialized malloc memory from copyinuio+0x11d > > > > cpuid = 5 > > > > time = 1783537112 > > > > KDB: stack backtrace: > > > > db_trace_self_wrapper() at db_trace_self_wrapper+0xa7/frame 0xfffffe00764d7840 > > > > vpanic() at vpanic+0x538/frame 0xfffffe00764d79c0 > > > > panic() at panic+0x1dd/frame 0xfffffe00764d7ad0 > > > > __msan_warning() at __msan_warning+0x25d/frame 0xfffffe00764d7c20 > > > > sendfile() at sendfile+0xcb6/frame 0xfffffe00764d7d50 > > > > amd64_syscall() at amd64_syscall+0x837/frame 0xfffffe00764d7f30 > > > > fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe00764d7f30 > > > > --- syscall (393, FreeBSD ELF64, sendfile), rip = 0x21aad2ea3b0a, rsp = 0x21aad1d706c8, rbp = 0x21aad1d70760 --- > > > > KDB: enter: panic > > > > > > The following should be enough, am I correct? > > > > I am re-running the test suite to see. > > > > I am also not sure about the offset. dofilewrite() sets > > auio->uio_offset = offset. kern_filewrite() takes an offset parameter > > and does nothing with it. > > > > copyinuio() initializes it to -1, so KMSAN will not report a problem, > > but it looks wrong to me. > > The streaming sockets are kind of append-only, so uio_offset should > be irrelevant for them. But indeed kern_filewrite() should not take > explicit offset, it was a mistake to keep the argument after the split. > > commit 605bd06dd7fca162967ce0f99bcbd31d982b1a37 > Author: Konstantin Belousov > Date: Wed Jul 8 23:21:26 2026 +0300 > > kern_filewrite(): remove unused argument offset > > Noted by: markj > Fixes: dfad790c8cca ("sendfile: stop abusing kern_writev()") > Seems ok. I am surprised the compiler didn't catch this. It seems we need to explicitly pass -Wunused-parameter, and if I do this there are many places that need to be patched. There is another bug, the comparison `auio->uio_resid != cnt` in dofilewrite() is no longer correct. It needs to be `cnt != 0`. From nobody Thu Jul 9 02:54:12 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 4gwfgS63PGz6kLLY for ; Thu, 09 Jul 2026 02:54:12 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwfgS4lHlz3xQj for ; Thu, 09 Jul 2026 02:54:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783565652; 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=QDhT1X5469q6ngsT5tdL48N+4uKztYJPctsacxm5H6M=; b=ySkK/G9bd5cr8DNkSRCdk6/TI5p/m83f101c/jIx68vvHZU0+gwtYYtPXAoSVT8+dJsdME IXYyGIUKeqoS5y9r5vV1nsIFDnlXqoWVrHIL9+E1DliA8fsCltADhzeMIlqG1ofvNDEuIA U437QTTBsrs9vc8xftG+Ng5P47yEJk/hOBVioSJJlBph0sDjtz5cnbXG8ZLUOj3K/6Cl06 n7VlNzl/FP9jwH3ZcSw7YosLSktRgXLW4tJxOwX/KMhqt3uSoaFrvOyMxCoyFkwdk8faTT lL7xRzJ5HWWhrnTVm9bDjSO3tOa+XQVCzQ/zP3510TdsiCfe8qP+1Xhjeag7Bg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783565652; a=rsa-sha256; cv=none; b=KAEP7ht5b5z9LgNwoqCSW7uwL7IpjG1o0NcxXWEaTeUK0cjjKBkUS7nePngED7wMi+03S9 qaxlNOcJEk6REGLK9MOnnLNL0gQ2BEf+GVY6EAbU0TXZ+Mfw2NsYfuovBLTcrPa9dPuqrY 1mRkUhb4wNV9XVSA6juwZJu2LeTNmKA+JJ5cFCtsr3t01eRtHo9yqzpoT7OHjjmp1Vgg4O qaRltEgeoHPQBUvznQ6L12TRmVxV+TWvI94h+KEqh1Mp9EYOsMw2iyvN+js0wl8viLcED/ Eb2o/Z5gzofQvkiNcYnqpmwgeDmFZzk+Wgc6hqQjeEeIlF30pc5VgPGDtsg1Kw== 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=1783565652; 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=QDhT1X5469q6ngsT5tdL48N+4uKztYJPctsacxm5H6M=; b=B1u2btPDn0CRbWwtQTxAbW27Ak7zhvSPEZKy3uGqaJE33aO8OI1SlAqufEPrHchG8PEyVD 405Lh6YQavOQcg3hz6XSMRW6e8fptIhffQPJzgD82IFp2WAnbvtgfhA77aDyNRfpzUsYje r/RsxA2j0brJqgpA9nW5pVSPeeHpzYuoV4iYPzahrrwCVjnVOBRgZfz4yK8stSkhxQdCqq EmZRqUBDWj9gTcBls2yaMp7Hcjhm1s+Ze9gsxPCoJxUGpOdYuPOLwOGbTaWjPxIO3JNV4O bhqsw/UWHT2WysMOpZO1DQcFa+Lgv3hpbOcie4CYzL77gQ5jDbDV30qmvOwRHg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwfgS3fjDzqSC for ; Thu, 09 Jul 2026 02:54:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 21b3a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 09 Jul 2026 02:54:12 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Abdelkader Boudih From: Adrian Chadd Subject: git: d128ddf32e87 - main - fwcam: retry ISO enable after re-powering camera 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d128ddf32e87a672dbbbc26cfece71e241e0ffa0 Auto-Submitted: auto-generated Date: Thu, 09 Jul 2026 02:54:12 +0000 Message-Id: <6a4f0d54.21b3a.4d230ce9@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=d128ddf32e87a672dbbbc26cfece71e241e0ffa0 commit d128ddf32e87a672dbbbc26cfece71e241e0ffa0 Author: Abdelkader Boudih AuthorDate: 2026-07-09 02:52:29 +0000 Commit: Adrian Chadd CommitDate: 2026-07-09 02:52:30 +0000 fwcam: retry ISO enable after re-powering camera Some IIDC cameras power down the sensor when inactive (e.g. lens cover closed) and reject ISO enable with EIO. Re-power the camera and retry once before failing. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58101 --- sys/dev/firewire/fwcam.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sys/dev/firewire/fwcam.c b/sys/dev/firewire/fwcam.c index c5e5cf545fe9..234dd41eedf1 100644 --- a/sys/dev/firewire/fwcam.c +++ b/sys/dev/firewire/fwcam.c @@ -429,7 +429,22 @@ fwcam_iso_start(struct fwcam_softc *sc) } err = fwcam_write_quadlet(sc, IIDC_ISO_EN, IIDC_ISO_EN_ON); - if (err) { + if (err == EIO) { + /* + * Cameras with a lens cover might power down the sensor + * when the cover is closed and reject streaming requests. + * Try to re-power and retry once before giving up. + */ + err = fwcam_power_on(sc); + if (err == 0) + err = fwcam_write_quadlet(sc, IIDC_ISO_EN, + IIDC_ISO_EN_ON); + if (err) { + device_printf(sc->fd.dev, + "ISO enable refused (lens cover closed?)\n"); + goto fail; + } + } else if (err) { device_printf(sc->fd.dev, "failed to enable ISO: %d\n", err); goto fail; From nobody Thu Jul 9 02:54:13 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 4gwfgV0qdqz6kLG1 for ; Thu, 09 Jul 2026 02:54:14 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwfgT6GMPz3xYw for ; Thu, 09 Jul 2026 02:54:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783565653; 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=m5KBC9qx89zjMIVPk5s/3N/LtaAm9w+NmVTrxi7fir8=; b=cgqBBvY8mlMaFz4NtAe8279ZG6j74x2ZGKRxf0MNWKdJ5wrBeFmrotwr9iKnikYmebMw7b hUKb4la/HfvbqOpoPaHnj14Z7Q4ql0tII9/T1u9fuAKaKAUmVjGyk+d9yd7iDu4qL2DlXf GVHgTYi25Bo/fh1lKnl5zgK5T4tJSKbisyS7Cp9QfrP/Kuni0ATcGzwhCKJH0DMt0GVWJN cDR8tSVKYxrbC6ApFeC3UdTAZPL7ak2wP5Ceb8oM6DQ1w6gpcNBq6p3//o86ympLq0hZcm r0/Ig9nmlQNUwTbp1f7xPb8GewUWjeKJlyfFAMSs20WI3r8ZSeUxbMqcU+PiQg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783565653; a=rsa-sha256; cv=none; b=jjMHCB3Af8LKvOoSSP2iSgUdNKL1YAcgFtmqBMrzP7kXiDLwjSBmxqbba09YoHkRQ2ofMx qUicB4ad6FVUUpAAvDKFHLB3F7oINb+5iawjBD/mFmk3wN1vbCe3NAj6h/uCmBQCEgEDQW nzTFlitm65Alwv+K1AP3CgBxe4DhOsxEM8ymoUHUOoIkfxU4gYvJ7h23pcNtMaj+490/nd JlyHpcgfhhv3wJVX3EZTEqdJoRi9GhUnPf7Sx8xGd9X+qX6G1QG03gBI9vIvc7FvkVI9Mu cvbo0LWhA1QEK93tlkfzDi36IWSAgPLBpFQO36GEDQEpgzgejUl+L4nQtq4Jdw== 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=1783565653; 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=m5KBC9qx89zjMIVPk5s/3N/LtaAm9w+NmVTrxi7fir8=; b=d3HIR3yOcWPt8UNmpsBgZxsLHmwyC/ld+dJyW8eFwkK9PTxI+M5VyDnN/xW0N/T0Nyt9pz /SItPNwJulm+/SJkNu06QmPfD2WRfDUreJu1pvucxTr0dyMyByYc8X8pbmMH7SqLhqxn2w TFpfzHVCnBCvw97Sjq4L71Hl8vcm0c6M9N6JqO1d9gDZsIfRGgupMB3wHZOLVMUGBWW5MC pDtdzS9n8HdMGLt5RPUDjGbdLsB27JRen3mPoFNvqK3cJ4iWP2NJA2y4iEqwzYPNqqitR6 gR0MOAQXSCb/UcRVoLr2XnSZJHuoloosbwEfpnmyXanRy0BDOylog/bkcWZLHQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwfgT4XbYzqwQ for ; Thu, 09 Jul 2026 02:54:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 22b82 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 09 Jul 2026 02:54:13 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Abdelkader Boudih From: Adrian Chadd Subject: git: cd7b65080f2f - main - fwisound: add Apple FireWire audio driver 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cd7b65080f2f2e038ddba42048f24f8e98b011f2 Auto-Submitted: auto-generated Date: Thu, 09 Jul 2026 02:54:13 +0000 Message-Id: <6a4f0d55.22b82.41eb8679@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=cd7b65080f2f2e038ddba42048f24f8e98b011f2 commit cd7b65080f2f2e038ddba42048f24f8e98b011f2 Author: Abdelkader Boudih AuthorDate: 2026-07-09 02:52:43 +0000 Commit: Adrian Chadd CommitDate: 2026-07-09 02:52:46 +0000 fwisound: add Apple FireWire audio driver Expose audio capture from Apple FireWire devices as a standard pcm(4)/dsp(4) device via the newpcm framework. (adrian: I've tested this on an isight camera and looped it back to USB speakers via "sox -t oss /dev/dsp3 -t oss /dev/dsp4") Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58109 --- share/man/man4/Makefile | 1 + share/man/man4/fwisound.4 | 96 ++++++ sys/conf/NOTES | 1 + sys/conf/files | 2 + sys/dev/firewire/fwisound.c | 609 +++++++++++++++++++++++++++++++++ sys/dev/firewire/fwisound.h | 112 ++++++ sys/dev/firewire/fwisound_pcm.c | 233 +++++++++++++ sys/modules/firewire/Makefile | 1 + sys/modules/firewire/fwisound/Makefile | 12 + 9 files changed, 1067 insertions(+) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 775a3e84f933..56b50d39d6f4 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -179,6 +179,7 @@ MAN= aac.4 \ filemon.4 \ firewire.4 \ fwcam.4 \ + fwisound.4 \ ${_ftgpio.4} \ ${_ftwd.4} \ full.4 \ diff --git a/share/man/man4/fwisound.4 b/share/man/man4/fwisound.4 new file mode 100644 index 000000000000..0da89fbe2bdc --- /dev/null +++ b/share/man/man4/fwisound.4 @@ -0,0 +1,96 @@ +.\" +.\" Copyright (c) 2026 Abdelkader Boudih +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.Dd June 19, 2026 +.Dt FWISOUND 4 +.Os +.Sh NAME +.Nm fwisound +.Nd Apple FireWire audio driver +.Sh SYNOPSIS +.Cd "device firewire" +.Cd "device fwisound" +.Cd "device sound" +.Sh DESCRIPTION +The +.Nm +driver provides audio capture from Apple FireWire devices that use a +proprietary isochronous audio protocol +.Pq not IEC 61883/AMDTP . +.Pp +The driver matches FireWire units with Apple OUI +.Pq 0x000a27 +and decodes the +.Qq sght +packet signature to deliver stereo PCM audio to the +.Xr sound 4 +framework. +.Pp +The device attaches as a standard +.Xr sound 4 +capture device accessible at +.Pa /dev/dspX . +The fixed audio format is 48000\~Hz, 2-channel, signed 16-bit big-endian +.Pq S16BE . +.Sh HARDWARE +The +.Nm +driver supports Apple FireWire devices with the following unit directory: +.Pp +.Bl -tag -width "unit_sw_version" -compact +.It Va unit_spec_ID +0x000a27 +.Pq Apple OUI +.It Va unit_sw_version +0x000010 +.El +.Pp +Known compatible hardware: +.Pp +.Bl -bullet -compact +.It +Apple iSight (FireWire cylinder) +.El +.Sh SYSCTLS +.Bl -tag -width ".Va hw.firewire.fwisound.iso_channel" +.It Va hw.firewire.fwisound.iso_channel +Isochronous receive channel (default 1). +Can be set as a tunable in +.Xr loader.conf 5 . +Must not conflict with +.Va hw.firewire.fwcam.iso_channel +.Pq default 0 . +.El +.Sh FILES +.Bl -tag -width ".Pa /dev/dspX" -compact +.It Pa /dev/dspX +PCM capture device created by +.Xr sound 4 . +.El +.Sh EXAMPLES +Record five seconds of audio: +.Bd -literal -offset indent +rec -r 48000 -c 2 -e signed-integer -b 16 -B /tmp/out.wav trim 5 +.Ed +.Pp +If multiple sound devices are present, address the device explicitly: +.Bd -literal -offset indent +sox -t ossdsp /dev/dsp4 -r 48000 -c 2 -e signed-integer -b 16 \e + /tmp/out.wav trim 5 +.Ed +.Sh SEE ALSO +.Xr firewire 4 , +.Xr fwohci 4 , +.Xr sound 4 , +.Xr sysctl 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 16.0 . +.Sh AUTHORS +.An Abdelkader Boudih Aq Mt freebsd@seuros.com +.Pp +Protocol reverse-engineered by Clemens Ladisch. diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 41f2514788df..c7931db374c7 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -2614,6 +2614,7 @@ device sbp_targ # SBP-2 Target mode (Requires scbus and targ) device fwe # Ethernet over FireWire (non-standard!) device fwip # IP over FireWire (RFC2734 and RFC3146) device fwcam # IIDC digital cameras over FireWire +device fwisound # Apple FireWire audio ##################################################################### # dcons support (Dumb Console Device) diff --git a/sys/conf/files b/sys/conf/files index 3635e6474708..09d4ff70e322 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1733,6 +1733,8 @@ dev/firewire/fwcrom.c optional firewire dev/firewire/fwdev.c optional firewire dev/firewire/fwcam.c optional fwcam dev/firewire/fwdma.c optional firewire +dev/firewire/fwisound.c optional fwisound sound +dev/firewire/fwisound_pcm.c optional fwisound sound dev/firewire/fwmem.c optional firewire dev/firewire/fwohci.c optional firewire dev/firewire/fwohci_pci.c optional firewire pci diff --git a/sys/dev/firewire/fwisound.c b/sys/dev/firewire/fwisound.c new file mode 100644 index 000000000000..9766f88060f7 --- /dev/null +++ b/sys/dev/firewire/fwisound.c @@ -0,0 +1,609 @@ +/* + * Copyright (c) 2026 Abdelkader Boudih + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +/* + * fwisound(4) - Apple FireWire audio driver + * + * Protocol reverse-engineered by Clemens Ladisch (Linux isight_audio). + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +static MALLOC_DEFINE(M_FWISOUND, "fwisound", "Apple FireWire Audio"); + +static int debug = 0; +static int iso_channel = FWISOUND_ISO_CHANNEL; +SYSCTL_DECL(_hw_firewire); +static SYSCTL_NODE(_hw_firewire, OID_AUTO, fwisound, + CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "Apple FireWire Audio"); +SYSCTL_INT(_hw_firewire_fwisound, OID_AUTO, debug, CTLFLAG_RWTUN, &debug, 0, + "fwisound debug level"); +SYSCTL_INT(_hw_firewire_fwisound, OID_AUTO, iso_channel, CTLFLAG_RWTUN, + &iso_channel, 0, "ISO channel for isochronous receive (default 1)"); + +#define FWISOUND_DEBUG(lev, fmt, ...) \ + do { \ + if (debug >= (lev)) \ + printf("fwisound: " fmt, ## __VA_ARGS__); \ + } while (0) + +static void fwisound_identify(driver_t *, device_t); +static int fwisound_probe(device_t); +static int fwisound_attach(device_t); +static int fwisound_detach(device_t); +static void fwisound_post_busreset(void *); +static void fwisound_post_explore(void *); +static void fwisound_probe_task(void *, int); +static void fwisound_start_task(void *, int); +static void fwisound_stop_task(void *, int); +static void fwisound_iso_input(struct fw_xferq *); + +static int +fwisound_read_quadlet(struct fwisound_softc *sc, uint32_t offset, uint32_t *val) +{ + uint16_t dst; + uint8_t spd; + int err; + + FWISOUND_LOCK(sc); + if (sc->fwdev == NULL) { + FWISOUND_UNLOCK(sc); + return (ENXIO); + } + dst = FWLOCALBUS | sc->fwdev->dst; + spd = min(sc->fwdev->speed, FWSPD_S400); + FWISOUND_UNLOCK(sc); + + err = fw_read_quadlet(sc->fd.fc, M_FWISOUND, dst, spd, + sc->cmd_hi, sc->cmd_lo + offset, val); + if (err) + FWISOUND_DEBUG(1, "read_quadlet: offset=0x%x err=%d\n", + offset, err); + return (err); +} + +static int +fwisound_write_quadlet(struct fwisound_softc *sc, uint32_t offset, uint32_t val) +{ + uint16_t dst; + uint8_t spd; + int err; + + FWISOUND_LOCK(sc); + if (sc->fwdev == NULL) { + FWISOUND_UNLOCK(sc); + return (ENXIO); + } + dst = FWLOCALBUS | sc->fwdev->dst; + spd = min(sc->fwdev->speed, FWSPD_S400); + FWISOUND_UNLOCK(sc); + + err = fw_write_quadlet(sc->fd.fc, M_FWISOUND, dst, spd, + sc->cmd_hi, sc->cmd_lo + offset, val); + if (err) + FWISOUND_DEBUG(1, "write_quadlet: offset=0x%x err=%d\n", + offset, err); + return (err); +} + +static uint32_t +fwisound_find_audio_unit(struct fw_device *fwdev) +{ + struct csrhdr *hdr; + struct csrdirectory *root, *udir; + struct csrreg *reg, *u; + int i, j, spec_ok, ver_ok; + uint32_t audio_base; + + hdr = (struct csrhdr *)fwdev->csrrom; + if (hdr->info_len <= 1) + return (0); + + root = (struct csrdirectory *)(fwdev->csrrom + 1 + hdr->info_len); + + for (i = 0; i < root->crc_len; i++) { + reg = &root->entry[i]; + + if (reg->key != CROM_UDIR) + continue; + + udir = (struct csrdirectory *)(reg + reg->val); + + spec_ok = 0; + ver_ok = 0; + audio_base = 0; + + for (j = 0; j < udir->crc_len; j++) { + u = &udir->entry[j]; + + if (u->key == CSRKEY_SPEC && u->val == FWISOUND_SPEC_ID) + spec_ok = 1; + else if (u->key == CSRKEY_VER && + u->val == FWISOUND_VERSION) + ver_ok = 1; + else if (u->key == IIDC_CROM_CMD_BASE) + audio_base = u->val; + } + + if (spec_ok && ver_ok && audio_base != 0) + return (audio_base); + } + + return (0); +} + +static void +fwisound_probe_task(void *arg, int pending __unused) +{ + struct fwisound_softc *sc = (struct fwisound_softc *)arg; + uint32_t val; + int err; + + if (sc->state == FWISOUND_STATE_DETACHING || sc->fwdev == NULL) + return; + + err = fwisound_write_quadlet(sc, FWISOUND_REG_SAMPLE_RATE, + FWISOUND_RATE_48000); + if (err) { + device_printf(sc->dev, + "failed to set sample rate: %d\n", err); + return; + } + + if (fwisound_read_quadlet(sc, FWISOUND_REG_GAIN_RAW_START, &val) == 0) + sc->gain_raw_min = (int32_t)val; + if (fwisound_read_quadlet(sc, FWISOUND_REG_GAIN_RAW_END, &val) == 0) + sc->gain_raw_max = (int32_t)val; + + FWISOUND_LOCK(sc); + if (sc->state == FWISOUND_STATE_DETACHING) { + FWISOUND_UNLOCK(sc); + return; + } + sc->state = FWISOUND_STATE_PROBED; + FWISOUND_UNLOCK(sc); +} + +static void +fwisound_start_task(void *arg, int pending __unused) +{ + struct fwisound_softc *sc = (struct fwisound_softc *)arg; + + if (sc->state == FWISOUND_STATE_DETACHING) + return; + + fwisound_iso_start(sc); +} + +static void +fwisound_stop_task(void *arg, int pending __unused) +{ + struct fwisound_softc *sc = (struct fwisound_softc *)arg; + + fwisound_iso_stop(sc); + + FWISOUND_LOCK(sc); + if (sc->state != FWISOUND_STATE_DETACHING) + sc->state = FWISOUND_STATE_PROBED; + FWISOUND_UNLOCK(sc); +} + +int +fwisound_iso_start(struct fwisound_softc *sc) +{ + struct firewire_comm *fc = sc->fd.fc; + struct fw_xferq *xferq; + uint32_t val; + uint8_t speed; + int dma_ch, err; + + mtx_assert(&sc->mtx, MA_NOTOWNED); + + FWISOUND_LOCK(sc); + if (sc->dma_ch >= 0 || sc->state == FWISOUND_STATE_STREAMING) { + FWISOUND_UNLOCK(sc); + return (0); + } + if (sc->state == FWISOUND_STATE_DETACHING || sc->fwdev == NULL) { + FWISOUND_UNLOCK(sc); + return (ENXIO); + } + speed = min(sc->fwdev->speed, FWSPD_S400); + FWISOUND_UNLOCK(sc); + + dma_ch = fw_open_isodma(fc, 0); + if (dma_ch < 0) { + device_printf(sc->dev, "no IR DMA channel available\n"); + return (EBUSY); + } + + FWISOUND_LOCK(sc); + if (sc->dma_ch >= 0) { + FWISOUND_UNLOCK(sc); + fc->ir[dma_ch]->flag &= ~FWXFERQ_OPEN; + return (0); + } + FWISOUND_UNLOCK(sc); + + xferq = fc->ir[dma_ch]; + xferq->flag |= FWXFERQ_EXTBUF | FWXFERQ_HANDLER | FWXFERQ_STREAM; + + xferq->flag &= ~FWXFERQ_CHTAGMASK; + xferq->flag |= sc->iso_channel & FWXFERQ_CHTAGMASK; + + xferq->sc = (caddr_t)sc; + xferq->hand = fwisound_iso_input; + xferq->bnchunk = FWISOUND_ISO_NCHUNK; + xferq->bnpacket = 1; + xferq->psize = FWISOUND_ISO_PKTSIZE; + xferq->queued = 0; + xferq->buf = NULL; + + xferq->bulkxfer = malloc( + sizeof(struct fw_bulkxfer) * xferq->bnchunk, + M_FWISOUND, M_WAITOK | M_ZERO); + + fw_iso_init_chunks(xferq); + + sc->sample_total = 0; + + val = sc->iso_channel | ((uint32_t)speed << 16); + err = fwisound_write_quadlet(sc, FWISOUND_REG_ISO_TX_CONFIG, val); + if (err) { + device_printf(sc->dev, + "failed to set ISO_TX_CONFIG: %d\n", err); + goto fail; + } + + err = fwisound_write_quadlet(sc, FWISOUND_REG_AUDIO_ENABLE, + FWISOUND_AUDIO_ENABLE); + if (err) { + device_printf(sc->dev, + "failed to enable audio: %d\n", err); + goto fail; + } + + err = fc->irx_enable(fc, dma_ch); + if (err) { + device_printf(sc->dev, "failed to start IR DMA: %d\n", err); + fwisound_write_quadlet(sc, FWISOUND_REG_AUDIO_ENABLE, 0); + goto fail; + } + + FWISOUND_LOCK(sc); + if (sc->state == FWISOUND_STATE_DETACHING) { + FWISOUND_UNLOCK(sc); + fc->irx_disable(fc, dma_ch); + fwisound_write_quadlet(sc, FWISOUND_REG_AUDIO_ENABLE, 0); + err = ENXIO; + goto fail; + } + sc->dma_ch = dma_ch; + sc->state = FWISOUND_STATE_STREAMING; + FWISOUND_UNLOCK(sc); + + return (0); + +fail: + fw_iso_free_chunks(xferq, M_FWISOUND); + xferq->flag &= ~(FWXFERQ_MODEMASK | FWXFERQ_OPEN | FWXFERQ_STREAM | + FWXFERQ_EXTBUF | FWXFERQ_HANDLER | FWXFERQ_CHTAGMASK); + xferq->hand = NULL; + sc->dma_ch = -1; + return (err); +} + +void +fwisound_iso_stop(struct fwisound_softc *sc) +{ + struct firewire_comm *fc = sc->fd.fc; + struct fw_xferq *xferq; + int dma_ch; + + FWISOUND_LOCK(sc); + dma_ch = sc->dma_ch; + if (dma_ch < 0) { + FWISOUND_UNLOCK(sc); + return; + } + sc->dma_ch = -1; + FWISOUND_UNLOCK(sc); + + xferq = fc->ir[dma_ch]; + + xferq->flag &= ~FWXFERQ_OPEN; + xferq->hand = NULL; + + if (xferq->flag & FWXFERQ_RUNNING) + fc->irx_disable(fc, dma_ch); + + if (sc->fwdev != NULL) + fwisound_write_quadlet(sc, FWISOUND_REG_AUDIO_ENABLE, 0); + + FWISOUND_LOCK(sc); + fw_iso_wait_inactive_locked(&sc->mtx, &sc->iso_active, "fwisis"); + FWISOUND_UNLOCK(sc); + + xferq->flag &= ~(FWXFERQ_MODEMASK | FWXFERQ_STREAM | + FWXFERQ_EXTBUF | FWXFERQ_HANDLER | FWXFERQ_CHTAGMASK); + + fw_iso_free_chunks(xferq, M_FWISOUND); +} + +static void +fwisound_iso_input(struct fw_xferq *xferq) +{ + struct fwisound_softc *sc = (struct fwisound_softc *)xferq->sc; + struct fwisound_chan *chan; + struct fw_bulkxfer *sxfer; + struct fw_pkt *fp; + struct fwisound_payload *pay; + struct mbuf *m; + uint8_t *ring; + uint32_t plen, nbytes, sample_count, ring_size, pos, chunk, old_ptr; + int dma_ch, need_intr; + + FWISOUND_LOCK(sc); + dma_ch = sc->dma_ch; + if (dma_ch < 0) { + FWISOUND_UNLOCK(sc); + return; + } + sc->iso_active = 1; + chan = sc->chan; + FWISOUND_UNLOCK(sc); + + while ((sxfer = STAILQ_FIRST(&xferq->stvalid)) != NULL) { + STAILQ_REMOVE_HEAD(&xferq->stvalid, link); + + m = fw_iso_dequeue(xferq, sxfer, sc->fd.fc); + if (m == NULL) + continue; + + fp = mtod(m, struct fw_pkt *); + plen = fp->mode.stream.len; + if (plen < 20 || (uint32_t)m->m_len < 4 + plen) { + m_freem(m); + continue; + } + + pay = (struct fwisound_payload *)(mtod(m, uint8_t *) + 4); + if (ntohl(pay->signature) != FWISOUND_SIGNATURE) { + m_freem(m); + continue; + } + + sample_count = ntohl(pay->sample_count); + if (sample_count == 0 || sample_count > 475) { + m_freem(m); + continue; + } + + nbytes = sample_count * 4; + if (plen < 16 + nbytes) { + m_freem(m); + continue; + } + + if (sc->sample_total != 0 && + ntohl(pay->sample_total) != sc->sample_total) + sc->dropped++; + sc->sample_total = ntohl(pay->sample_total) + sample_count; + + need_intr = 0; + if (chan != NULL && chan->running && + chan->buf != NULL && chan->pcm_chan != NULL) { + ring = sndbuf_getbufofs(chan->buf, 0); + ring_size = chan->buf->bufsize; + old_ptr = chan->hw_ptr; + + uint8_t *src = (uint8_t *)pay->samples; + uint32_t rem = nbytes; + + while (rem > 0) { + pos = chan->hw_ptr % ring_size; + chunk = MIN(rem, ring_size - pos); + memcpy(ring + pos, src, chunk); + chan->hw_ptr += chunk; + src += chunk; + rem -= chunk; + } + + if (chan->buf->blksz == 0 || + (old_ptr / chan->buf->blksz) != + (chan->hw_ptr / chan->buf->blksz)) + need_intr = 1; + } + + m_freem(m); + + if (need_intr) { + chn_intr(chan->pcm_chan); + } + } + + fw_iso_rearm_done(xferq, sc->fd.fc, &sc->mtx, &sc->iso_active, + &sc->dma_ch, dma_ch); +} + +static void +fwisound_post_explore(void *arg) +{ + struct fwisound_softc *sc = (struct fwisound_softc *)arg; + struct fw_device *fwdev; + uint32_t audio_base; + int err; + + FWISOUND_LOCK(sc); + if (sc->state == FWISOUND_STATE_DETACHING) { + FWISOUND_UNLOCK(sc); + return; + } + + if (sc->fwdev != NULL) { + STAILQ_FOREACH(fwdev, &sc->fd.fc->devices, link) { + if (fwdev == sc->fwdev && + fwdev->status == FWDEVATTACHED) + break; + } + if (fwdev == NULL) { + device_printf(sc->dev, "device disconnected\n"); + sc->fwdev = NULL; + sc->state = FWISOUND_STATE_IDLE; + FWISOUND_UNLOCK(sc); + fwisound_iso_stop(sc); + FWISOUND_LOCK(sc); + } + } + + if (sc->fwdev == NULL) { + STAILQ_FOREACH(fwdev, &sc->fd.fc->devices, link) { + if (fwdev->status != FWDEVATTACHED) + continue; + + audio_base = fwisound_find_audio_unit(fwdev); + if (audio_base == 0) + continue; + + sc->fwdev = fwdev; + sc->cmd_hi = 0xffff; + sc->cmd_lo = 0xf0000000 | (audio_base << 2); + + FWISOUND_UNLOCK(sc); + err = taskqueue_enqueue(taskqueue_thread, + &sc->probe_task); + if (err != 0) + device_printf(sc->dev, + "taskqueue_enqueue failed: %d\n", err); + return; + } + } + + FWISOUND_UNLOCK(sc); +} + +static void +fwisound_post_busreset(void *arg __unused) +{ + +} + +static void +fwisound_identify(driver_t *driver, device_t parent) +{ + + if (device_find_child(parent, "fwisound", DEVICE_UNIT_ANY) == NULL) + BUS_ADD_CHILD(parent, 0, "fwisound", DEVICE_UNIT_ANY); +} + +static int +fwisound_probe(device_t dev) +{ + + device_set_desc(dev, "Apple FireWire Audio"); + return (0); +} + +static int +fwisound_attach(device_t dev) +{ + struct fwisound_softc *sc; + + sc = device_get_softc(dev); + sc->fd.dev = dev; + sc->fd.fc = device_get_ivars(dev); + sc->dev = dev; + mtx_init(&sc->mtx, "fwisound", NULL, MTX_DEF); + + sc->fwdev = NULL; + sc->state = FWISOUND_STATE_IDLE; + sc->dma_ch = -1; + sc->iso_active = 0; + sc->iso_channel = (uint8_t)(iso_channel & FWXFERQ_CHTAGMASK); + sc->chan = NULL; + TASK_INIT(&sc->probe_task, 0, fwisound_probe_task, sc); + TASK_INIT(&sc->start_task, 0, fwisound_start_task, sc); + TASK_INIT(&sc->stop_task, 0, fwisound_stop_task, sc); + + sc->fd.post_busreset = fwisound_post_busreset; + sc->fd.post_explore = fwisound_post_explore; + + sc->pcm_dev = device_add_child(dev, "pcm", DEVICE_UNIT_ANY); + if (sc->pcm_dev == NULL) { + device_printf(dev, "failed to add pcm child\n"); + mtx_destroy(&sc->mtx); + return (ENXIO); + } + + bus_attach_children(dev); + + fwisound_post_explore(sc); + + return (0); +} + +static int +fwisound_detach(device_t dev) +{ + struct fwisound_softc *sc; + + sc = device_get_softc(dev); + + FWISOUND_LOCK(sc); + sc->state = FWISOUND_STATE_DETACHING; + FWISOUND_UNLOCK(sc); + + taskqueue_drain(taskqueue_thread, &sc->probe_task); + taskqueue_drain(taskqueue_thread, &sc->start_task); + taskqueue_drain(taskqueue_thread, &sc->stop_task); + fwisound_iso_stop(sc); + + if (sc->pcm_dev != NULL) + device_delete_children(dev); + + FWISOUND_LOCK(sc); + sc->fwdev = NULL; + FWISOUND_UNLOCK(sc); + + mtx_destroy(&sc->mtx); + return (0); +} + +static device_method_t fwisound_methods[] = { + DEVMETHOD(device_identify, fwisound_identify), + DEVMETHOD(device_probe, fwisound_probe), + DEVMETHOD(device_attach, fwisound_attach), + DEVMETHOD(device_detach, fwisound_detach), + + DEVMETHOD_END +}; + +static driver_t fwisound_driver = { + "fwisound", + fwisound_methods, + sizeof(struct fwisound_softc), +}; + +DRIVER_MODULE(fwisound, firewire, fwisound_driver, 0, 0); +MODULE_VERSION(fwisound, 1); +MODULE_DEPEND(fwisound, firewire, 1, 1, 1); +MODULE_DEPEND(fwisound, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER); diff --git a/sys/dev/firewire/fwisound.h b/sys/dev/firewire/fwisound.h new file mode 100644 index 000000000000..47a9790e074c --- /dev/null +++ b/sys/dev/firewire/fwisound.h @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2026 Abdelkader Boudih + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#ifndef _DEV_FIREWIRE_FWISOUND_H_ +#define _DEV_FIREWIRE_FWISOUND_H_ + +#include + +/* Protocol reverse-engineered by Clemens Ladisch (Linux isight-firmware). */ +#define FWISOUND_SPEC_ID APPLE_FW_OUI +#define FWISOUND_VERSION 0x000010 /* SW_ISIGHT_AUDIO */ + +#define APPLE_FW_OUI 0x000a27 + +/* Audio register offsets from audio_base */ +#define FWISOUND_REG_AUDIO_ENABLE 0x000 /* bit31 = enable streaming */ +#define FWISOUND_REG_DEF_AUDIO_GAIN 0x204 +#define FWISOUND_REG_GAIN_RAW_START 0x210 +#define FWISOUND_REG_GAIN_RAW_END 0x214 +#define FWISOUND_REG_GAIN_DB_START 0x218 +#define FWISOUND_REG_GAIN_DB_END 0x21c +#define FWISOUND_REG_SAMPLE_RATE_INQ 0x280 +#define FWISOUND_REG_ISO_TX_CONFIG 0x300 /* bits[19:16]=speed, [3:0]=ch*/ +#define FWISOUND_REG_SAMPLE_RATE 0x400 /* bit31 = 1 → 48000 Hz */ +#define FWISOUND_REG_GAIN 0x500 +#define FWISOUND_REG_MUTE 0x504 + +/* REG_AUDIO_ENABLE / REG_SAMPLE_RATE bit */ +#define FWISOUND_AUDIO_ENABLE (1u << 31) +#define FWISOUND_RATE_48000 (1u << 31) + +/* Apple FireWire audio ISO payload. */ +struct fwisound_payload { + uint32_t sample_count; /* samples in this packet */ + uint32_t signature; /* 0x73676874 = "sght" */ + uint32_t sample_total; /* running total (drop detect)*/ + uint32_t reserved; + int16_t samples[2 * 475]; /* stereo S16BE; *2 valid */ +}; + +#define FWISOUND_SIGNATURE 0x73676874u /* "sght" */ + +/* ISO DMA parameters */ +#define FWISOUND_ISO_CHANNEL 1 +#define FWISOUND_ISO_NCHUNK 64 +#define FWISOUND_ISO_PKTSIZE 2048 /* MCLBYTES */ + +/* Driver states */ +#define FWISOUND_STATE_IDLE 0 +#define FWISOUND_STATE_PROBED 1 +#define FWISOUND_STATE_STREAMING 2 +#define FWISOUND_STATE_DETACHING 3 + +#ifdef _KERNEL + +#include + +struct fwisound_chan { + struct fwisound_softc *sc; + struct pcm_channel *pcm_chan; + struct snd_dbuf *buf; + struct pcmchan_caps caps; + uint32_t fmts[2]; + uint32_t hw_ptr; /* ring write offset (bytes) */ + int running; +}; + +struct fwisound_softc { + struct firewire_dev_comm fd; /* MUST BE FIRST */ + struct mtx mtx; + device_t dev; + device_t pcm_dev; + + struct fw_device *fwdev; + uint16_t cmd_hi; /* always 0xffff */ + uint32_t cmd_lo; /* 0xf0000000|(audio_base<<2) */ + + struct task probe_task; + struct task start_task; /* deferred iso_start */ + struct task stop_task; /* deferred iso_stop */ + + /* ISO streaming */ + int dma_ch; /* -1 = not open */ + int iso_active; /* iso_input running */ + uint8_t iso_channel; + + /* PCM channel back-reference */ + struct fwisound_chan *chan; + + /* Sample drop detection */ + uint32_t sample_total; + + /* Gain range (read from camera during probe) */ + int32_t gain_raw_min; + int32_t gain_raw_max; + + int state; + int dropped; +}; + +#define FWISOUND_LOCK(sc) mtx_lock(&(sc)->mtx) +#define FWISOUND_UNLOCK(sc) mtx_unlock(&(sc)->mtx) + +int fwisound_iso_start(struct fwisound_softc *); +void fwisound_iso_stop(struct fwisound_softc *); + +#endif /* _KERNEL */ + +#endif /* _DEV_FIREWIRE_FWISOUND_H_ */ diff --git a/sys/dev/firewire/fwisound_pcm.c b/sys/dev/firewire/fwisound_pcm.c new file mode 100644 index 000000000000..a7dd6f1c1a01 --- /dev/null +++ b/sys/dev/firewire/fwisound_pcm.c @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2026 Abdelkader Boudih + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +/* newpcm channel integration for fwisound(4). */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#define FWISOUND_BUFSZ 65536 + + +static void * +fwisound_chan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, + struct pcm_channel *c, int dir) +{ + struct fwisound_softc *sc = devinfo; + struct fwisound_chan *chan; + void *buf; + unsigned int bufsz; + + if (dir != PCMDIR_REC) + return (NULL); + + chan = malloc(sizeof(*chan), M_DEVBUF, M_WAITOK | M_ZERO); + chan->sc = sc; + chan->pcm_chan = c; + chan->buf = b; + + chan->fmts[0] = SND_FORMAT(AFMT_S16_BE, 2, 0); + chan->fmts[1] = 0; + + chan->caps.minspeed = 48000; + chan->caps.maxspeed = 48000; + chan->caps.fmtlist = chan->fmts; + chan->caps.caps = 0; + + bufsz = pcm_getbuffersize(sc->pcm_dev, 4096, FWISOUND_BUFSZ, 131072); + buf = malloc(bufsz, M_DEVBUF, M_WAITOK | M_ZERO); + if (sndbuf_setup(b, buf, bufsz) != 0) { + free(buf, M_DEVBUF); + free(chan, M_DEVBUF); + return (NULL); + } + + FWISOUND_LOCK(sc); + sc->chan = chan; + FWISOUND_UNLOCK(sc); + + return (chan); +} + +static int +fwisound_chan_free(kobj_t obj, void *data) +{ + struct fwisound_chan *chan = data; + struct fwisound_softc *sc = chan->sc; + void *buf; + + if (chan->running) { + taskqueue_enqueue(taskqueue_thread, &sc->stop_task); + taskqueue_drain(taskqueue_thread, &sc->stop_task); *** 187 LINES SKIPPED *** From nobody Thu Jul 9 02:54:11 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 4gwfgY0PDgz6kLcd for ; Thu, 09 Jul 2026 02:54:17 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwfgX4PFrz3xrc for ; Thu, 09 Jul 2026 02:54:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783565656; 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=yY3qEfhtt2RO2ouQXcJRzySx1/zElXVJwQQFeCG4OWk=; b=ojLubGtSw3K7DQ+tOajX833w+faL+VYfmcvS/tDql5V+nDUEOebt4JdMG27JWA2Koio9g+ Trs7vNDWJtwWiwp/wZze7s/lvkOq8MLCNPCCXiMUruLy/RSMElu6L2sAYTD85Cpjbzl8yD eIhWV01vv8gysWToTHaqhUF7/bN3T9rURf+5Ewblzyq37subQu7HFts2yVvQuEvWybil3o TKcIwfvFH4q+a5kWjfptonjCtgLhEy78Y7GEXf1whAghp14LOI1JYavhGIFG51/KytyuVa SnArSDtqhX1g1Bf/BL1ioTtaLzfnarC9Npp0vsGZHBOiDTbGQWSipS/bQoP/iA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783565656; a=rsa-sha256; cv=none; b=X8cMCS0DWgdTWAkqEPXfi8g1C4ljY3GNAR3P0sZilBo5AScJ6IioTMzxVOPK3P8vuZJZ1n UhAvPBxuSEbQ943j/T6jOFp33V4QtlocxptHTrSePmTOxVAnNkvYISQaQzP8BYHIq+j6vr WjFX4uDpmNg+Bzcq6M9CzYDer4BcLBSqsQMLsvfmNGfiEiEWAqXFrYe9TiKCckdyyJJmIP 5nHkFvPh2pISgvJlso7skbpQyRjA7Y2VKAtAa6zqpKKdg6kILKUH5SBQq8v4f6MfPRDlWH iYFsiJUAVnqyj0I5MSk3qSFkFDvo1NhdkZbSuhbSP06VZEN8LfipudqBMafQoA== 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=1783565656; 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=yY3qEfhtt2RO2ouQXcJRzySx1/zElXVJwQQFeCG4OWk=; b=yilJcNwc+C5nLhApQWqWmoBib38TRvrKwNwc8VptAbevAbdJ7lrNfEoTBtD8MSIZWpVEwk d29Rp991nCQLCAkJIzppAKIWX7q3tUHZvy2Bz/4I0OgN0fFyAfNcUStXDZatVXuzcMAGl9 kOGy9CBRAILY+f6OwWzxFMJW6f7j2lg7yB3PdllDlMUGWFOaqXmp2RZtX1kCWkQEeSnugW KEyvEpdmW+ARilAqnxedyfcnUC34N6Ugkq8LFuJGBGguApSXcpf9ZkMWzE9CxhmjzIIR0N WeW1tYGbCrWVJOiFVxC5HFG9we24sPY+xRwHOa0K+PWWnXPReB5596+GpylpZQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwfgX3FTSzqwS for ; Thu, 09 Jul 2026 02:54:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 236fd by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 09 Jul 2026 02:54:11 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Abdelkader Boudih From: Adrian Chadd Subject: git: 56d4dee82de1 - main - fwcam: defer ISO streaming to first read 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 56d4dee82de1b5c8c77d5be79f7bf4183b327b57 Auto-Submitted: auto-generated Date: Thu, 09 Jul 2026 02:54:11 +0000 Message-Id: <6a4f0d53.236fd.369b15e7@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=56d4dee82de1b5c8c77d5be79f7bf4183b327b57 commit 56d4dee82de1b5c8c77d5be79f7bf4183b327b57 Author: Abdelkader Boudih AuthorDate: 2026-07-09 02:52:12 +0000 Commit: Adrian Chadd CommitDate: 2026-07-09 02:52:18 +0000 fwcam: defer ISO streaming to first read Moved ISO start to first usage. Opening the device now only validates state and increments the open count, allowing info queries and mode changes without starting the camera. ISO streaming begins on demand when userland first reads frame data. This avoid the camera led to turn-on at attach. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58100 --- sys/dev/firewire/fwcam.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/sys/dev/firewire/fwcam.c b/sys/dev/firewire/fwcam.c index 27451316d613..c5e5cf545fe9 100644 --- a/sys/dev/firewire/fwcam.c +++ b/sys/dev/firewire/fwcam.c @@ -288,7 +288,7 @@ fwcam_probe_task(void *arg, int pending __unused) sc->state = FWCAM_STATE_PROBED; FWCAM_UNLOCK(sc); - if (sc->open_count > 0 && + if (sc->dma_ch >= 0 && sc->state != FWCAM_STATE_DETACHING) fwcam_iso_start(sc); } @@ -601,7 +601,6 @@ static int fwcam_cdev_open(struct cdev *dev, int oflags, int devtype, struct thread *td) { struct fwcam_softc *sc = dev->si_drv1; - int err = 0; FWCAM_LOCK(sc); if (sc->state == FWCAM_STATE_DETACHING) { @@ -615,18 +614,8 @@ fwcam_cdev_open(struct cdev *dev, int oflags, int devtype, struct thread *td) } sc->open_count++; - if (sc->open_count == 1 && sc->state == FWCAM_STATE_PROBED) { - FWCAM_UNLOCK(sc); - err = fwcam_iso_start(sc); - if (err) { - FWCAM_LOCK(sc); - sc->open_count--; - FWCAM_UNLOCK(sc); - } - } else { - FWCAM_UNLOCK(sc); - } - return (err); + FWCAM_UNLOCK(sc); + return (0); } static int @@ -657,6 +646,13 @@ fwcam_cdev_read(struct cdev *dev, struct uio *uio, int ioflag) int err; FWCAM_LOCK(sc); + if (sc->state == FWCAM_STATE_PROBED) { + FWCAM_UNLOCK(sc); + err = fwcam_iso_start(sc); + if (err) + return (err); + FWCAM_LOCK(sc); + } while (!sc->frame_ready) { if (sc->state != FWCAM_STATE_STREAMING) { FWCAM_UNLOCK(sc); From nobody Thu Jul 9 04:53:38 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 4gwjKH1zKvz6kWDb for ; Thu, 09 Jul 2026 04:53: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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwjKH1Gtwz4B7Z for ; Thu, 09 Jul 2026 04:53:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783572819; 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=tVKfKfSxBuo7NOqV969pPSfGwHs33kzOi0hKbrYYasw=; b=O1ZX4CaDcr+hbQKiykb/P/qlRuk962SZGZKpf2lg+nXR7abVYzB4qdhFKMKR/+lP4x29b8 Ea/QNZQdOE2oBr/Hn3ZnbTM/MZHYtk8/+0yefGBqEKL7vUDT8jETwiiLS0gdPXPpWd2Bkw SZeO/6lLnSTXn215PLx/1yXGBFekSRviA04cucFbhF8DZMTU8ffMZKYoX8Er9YR1ZxiR5S z3pUv0b67UKnzHnRXMlAJRPfjTgJ2t3VFi/1yTgUKm+IJiiYdRIbCm3sbLAQ1DUIp/hSX8 urRFUcjaJxjCk6zyzL0Hylf+7Op4UHjyQQJQDDUgJRJskJjSn/WZl0In+d1NoA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783572819; a=rsa-sha256; cv=none; b=Ud5uPNrPzuWuDyFOmMG+zqYwZNSxLyIOqYxLMatu7gUagjwkG4f6s+hCq2Ke38F7hQrlfe /7bh77IFxUa7aeZVbQ1vB9YhZ78G4yeLVT/47cktGS7dTT4bPefBlpbFho1ZI+5NZEEMGH pO9k2xe3mTFatl8esCM73XHIaHkz10Q5E0CboqD6XkESc1Dv1An2zBWEG2pyJ3UuhpOHd6 Jfrub8OSL6QcikSD7FXj7tuge74iwbSm85DR4wpejvHbpHltLWp8aWr6PKjPq+27/P4V4N H50MoAnwe5nt6G7Svwatw3iuxikxqE9oy0u5JqeV28a3u5XFdELl4sRTrFj2LQ== 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=1783572819; 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=tVKfKfSxBuo7NOqV969pPSfGwHs33kzOi0hKbrYYasw=; b=KZp3aagnzXzJQuN/AV7ddc3s+Dm4hoFCQ+20opC2ACtNWn7hD2675kCF4PS65FOfXChdEG uTvMRn03SZc0yHbpk9HIAtZ7OnQk3dUxk3hz3z/vg7DGllPQb5/jXXskxChWkVrpSXpEZ8 rrsSL3aSi2+GqkJAuN2gWrHzOf/9Dik8ZC7aLZ5osZiLCi2AK/MSxmb3YhA3uTldTmd0k6 41Z4w9GeSxVcc03JZdq2kDq+q8K2KC1oAVleqvBcDjQbnEInxw+m4ioodhnnfYgIedVjfY o/fVIv7C7vNQjokcIQvEfphpvadc6RlXDvmjK1hj5k9TsbbJpP6XNPRnuQm1NQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwjKG73Cyzv2k for ; Thu, 09 Jul 2026 04:53:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 379a2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 09 Jul 2026 04:53:38 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 1364d8fd9b25 - main - kern_writefile(): fix several regressions 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1364d8fd9b25d6d3e9618e7be073a1a1b41aa19c Auto-Submitted: auto-generated Date: Thu, 09 Jul 2026 04:53:38 +0000 Message-Id: <6a4f2952.379a2.37ac66e3@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1364d8fd9b25d6d3e9618e7be073a1a1b41aa19c commit 1364d8fd9b25d6d3e9618e7be073a1a1b41aa19c Author: Konstantin Belousov AuthorDate: 2026-07-08 19:21:00 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-09 04:53:23 +0000 kern_writefile(): fix several regressions sendfile(): for trailers uio, set uio_rw to UIO_WRITE instead of checking it kern_filewrite(): remove unused argument offset kern_writev(): the check should compare cnt against zero, not uio_resid Reported by: markj Fixes: dfad790c8cca ("sendfile: stop abusing kern_writev()") Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/kern/kern_sendfile.c | 8 ++------ sys/kern/sys_generic.c | 6 +++--- sys/sys/syscallsubr.h | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c index 1a534210ca0c..f975470e6dcf 100644 --- a/sys/kern/kern_sendfile.c +++ b/sys/kern/kern_sendfile.c @@ -1175,8 +1175,7 @@ prepend_header: SOCK_IO_SEND_UNLOCK(so); CURVNET_RESTORE(); - error = kern_filewrite(td, sockfd, sock_fp, trl_uio, - (off_t)-1, 0, &cnt); + error = kern_filewrite(td, sockfd, sock_fp, trl_uio, 0, &cnt); if (error == 0) sbytes += cnt; goto out; @@ -1256,10 +1255,7 @@ sendfile(struct thread *td, struct sendfile_args *uap, int compat) &trl_uio); if (error != 0) goto out; - if (trl_uio->uio_rw != UIO_WRITE) { - error = EINVAL; - goto out; - } + trl_uio->uio_rw = UIO_WRITE; trl_uio->uio_td = td; } } diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index d5145d6cf322..bbfeebbe2f2e 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -555,7 +555,7 @@ dofilewrite(struct thread *td, int fd, struct file *fp, struct uio *auio, auio->uio_rw = UIO_WRITE; auio->uio_td = td; auio->uio_offset = offset; - error = kern_filewrite(td, fd, fp, auio, offset, flags, &cnt); + error = kern_filewrite(td, fd, fp, auio, flags, &cnt); /* * Handle short writes and generate SIGPIPE if needed. @@ -563,7 +563,7 @@ dofilewrite(struct thread *td, int fd, struct file *fp, struct uio *auio, * see sousrsend(). */ if (error != 0 && fp->f_type != DTYPE_SOCKET) { - if (auio->uio_resid != cnt && (error == ERESTART || + if (cnt != 0 && (error == ERESTART || error == EINTR || error == EWOULDBLOCK)) error = 0; if (error == EPIPE) { @@ -584,7 +584,7 @@ dofilewrite(struct thread *td, int fd, struct file *fp, struct uio *auio, */ int kern_filewrite(struct thread *td, int fd, struct file *fp, struct uio *auio, - off_t offset, int flags, ssize_t *cntp) + int flags, ssize_t *cntp) { ssize_t cnt; int error; diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h index 131a8925a2d4..f0652806b999 100644 --- a/sys/sys/syscallsubr.h +++ b/sys/sys/syscallsubr.h @@ -177,7 +177,7 @@ int kern_fhopen(struct thread *td, const struct fhandle *u_fhp, int flags); int kern_fhstat(struct thread *td, fhandle_t fh, struct stat *buf); int kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf); int kern_filewrite(struct thread *td, int fd, struct file *fp, - struct uio *auio, off_t offset, int flags, ssize_t *cntp); + struct uio *auio, int flags, ssize_t *cntp); int kern_fpathconf(struct thread *td, int fd, int name, long *valuep); int kern_freebsd11_getfsstat(struct thread *td, struct freebsd11_statfs *ubuf, long bufsize, int mode); From nobody Thu Jul 9 07:28:27 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 4gwmlv634Xz6kkSp for ; Thu, 09 Jul 2026 07:28:27 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwmlv4ttRz3WmW for ; Thu, 09 Jul 2026 07:28:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783582107; 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=nXjf3Ehxijm43M/N7iejzAhrYgfNhC38LrDGLThlMus=; b=FyLEwFs90J9n9HZasNCoZng2e/8usWTx3XOCHS7b1QeaGzv6kApcZtA0lapvriu09lQyDR RCh5AGjVVj84AHStbvhhMbtJh8FAHx0y+qGzci80XmjRpQEDbPlGPA0HIeUDlTwT6IAxsn bNASB41sSfdoNavxnYOSNU3TJ5Ph8uKCxHXat++bEwqaxg/3b2m4sep4BtEnymstSZGo0j b/OCs6uECECRU0w50xWwWDGag9YQ8BE/U/dUTDFaxUgGNAKBIvHfoDvb1HPoah6Wr1ZRmu EGBhXHWc7439k7RjKEqHvd5xIJjS90w5MBp3ScnRNaH2bPPoZ+pSc/lOVV8Lmg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783582107; a=rsa-sha256; cv=none; b=dMGtNXqsaMM7XPAzRqjWoFuq0UosqZZXCFUyxDYzU4u3RIUsbXPRPra0FQq0iBxMp2az6G K2jx6wguf5Sff4NPJudHAUAMrnx/qPbQ+szRV+dpFjBxIJRCiBUPOTN2liSe1XIvYW26zw 6s6+KqDbxtHIJcyThrjEp3ZyzpOJCQq7gup0rMwmOlBF/NuFN7XwOePCGlnLU1tnTF1SXO 3vHPOz0P2OnNlr9d2J4WiYlFJbh8UoAe7cbYKdUpmsjyFHMQKwTdmNhHUWJegVLEBpI5NO tbGd1ojpi+EHko7afZS5aghyGga6PSBSKJkyqe/MkU5psGWTCTKanSuBUNd3BQ== 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=1783582107; 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=nXjf3Ehxijm43M/N7iejzAhrYgfNhC38LrDGLThlMus=; b=A0H1v0xsYclY4a2+17YKdsQ09dkk59dSHgK6griVlMjcvVQxC1torMF7h93PcOmqQvClbv rB7Iv8ixJ9J/vKDb0zX3HiD3N5wpr+Z2VBJQ1wv4ouEfqvc6i6Ss7qKkKmz2Rlm8BpdqRp OocdI37wiJSanVOYBswPziPrmyBUvLWfgAuBC32dzUuonsjFxkX1C/WgNDVDQcjVcM/7zh S+4n3cFMYN/pbn32t8sfEqUcHn5S2EnaaWvX5trzHfMhQZeyhGH031thRBpiSkok/ur8ww GdKAvlVDNE2lOBkR3ymXoCyLdyAiHqBn6FCbP360tJjcy7pvCdWNPTnp3T2YyA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwmlv3ZjSzytn for ; Thu, 09 Jul 2026 07:28:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 466a8 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 09 Jul 2026 07:28:27 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Aymeric Wibo Subject: git: e2d56447b3a9 - main - hrfkill: Add driver to report RFKILL button press 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: obiwac X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e2d56447b3a9d2ef9bd0b80c3aaa69e681f4be0f Auto-Submitted: auto-generated Date: Thu, 09 Jul 2026 07:28:27 +0000 Message-Id: <6a4f4d9b.466a8.5fd576fb@gitrepo.freebsd.org> The branch main has been updated by obiwac: URL: https://cgit.FreeBSD.org/src/commit/?id=e2d56447b3a9d2ef9bd0b80c3aaa69e681f4be0f commit e2d56447b3a9d2ef9bd0b80c3aaa69e681f4be0f Author: Aymeric Wibo AuthorDate: 2026-06-25 02:03:36 +0000 Commit: Aymeric Wibo CommitDate: 2026-07-09 07:27:07 +0000 hrfkill: Add driver to report RFKILL button press This driver only reports the RFKILL button presses. This is needed for the "airplane" key on some Framework laptops. Reviewed by: wulf, ziaee Event: Halifax Hackathon 202606 Location: vishwin@'s car Co-authored-by: Daniel Shaefer Sponsored by: Framework Computer Inc Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57838 --- share/man/man4/Makefile | 1 + share/man/man4/hidbus.4 | 1 + share/man/man4/hrfkill.4 | 82 +++++++++++++++++++++++++++++ sys/conf/NOTES | 1 + sys/conf/files | 1 + sys/dev/hid/hid.h | 2 + sys/dev/hid/hrfkill.c | 111 +++++++++++++++++++++++++++++++++++++++ sys/modules/hid/Makefile | 1 + sys/modules/hid/hrfkill/Makefile | 8 +++ 9 files changed, 208 insertions(+) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 56b50d39d6f4..9bee23f1df8f 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -222,6 +222,7 @@ MAN= aac.4 \ ${_hptmv.4} \ ${_hptnr.4} \ ${_hptrr.4} \ + hrfkill.4 \ hsctrl.4 \ htu21.4 \ ${_hv_kvp.4} \ diff --git a/share/man/man4/hidbus.4 b/share/man/man4/hidbus.4 index f8ebaca8d659..e336eb5eb9b9 100644 --- a/share/man/man4/hidbus.4 +++ b/share/man/man4/hidbus.4 @@ -83,6 +83,7 @@ Default is 0. .Xr hms 4 , .Xr hmt 4 , .Xr hpen 4 , +.Xr hrfkill 4 , .Xr hsctrl 4 , .Xr hskbd 4 , .Xr iichid 4 , diff --git a/share/man/man4/hrfkill.4 b/share/man/man4/hrfkill.4 new file mode 100644 index 000000000000..c1d3b73b28b2 --- /dev/null +++ b/share/man/man4/hrfkill.4 @@ -0,0 +1,82 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.\" Copyright (c) 2026 The FreeBSD Foundation +.\" +.\" Portions of this software were developed by Aymeric Wibo +.\" under sponsorship from the FreeBSD Foundation. +.\" +.Dd June 24, 2026 +.Dt HRFKILL 4 +.Os +.Sh NAME +.Nm hrfkill +.Nd HID radio control driver +.Sh SYNOPSIS +.Cd device hrfkill +.Cd device hid +.Cd device hidbus +.Cd device hidmap +.Cd device evdev +In +.Xr loader.conf 5 : +.Cd hrfkill_load="YES" +.Sh DESCRIPTION +The +.Nm +driver provides support for HID wireless radio control buttons, +most often found as an +.Qq airplane mode +or RFKILL toggle on laptop keyboards, and presents them to applications over the +.Ar evdev +interface. +.Sh HARDWARE +The +.Nm +driver supports HID radio control buttons and airplane mode keys +on devices such as: +.Pp +.Bl -bullet -compact +.It +Framework Laptop Keyboard +.El +.Sh FILES +.Bl -tag -width /dev/input/event* -compact +.It Pa /dev/input/event* +input event device node +.El +.Sh SEE ALSO +.Xr hidbus 4 , +.Xr hsctrl 4 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 16.0 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Aymeric Wibo Aq Mt obiwac@freebsd.org +under sponsorship from the FreeBSD Foundation and by +.An Daniel Shaefer Aq Mt git@danielschaefer.me +under sponsorship from Framework Computer Inc. +.Sh CAVEATS +Currently, +.Nm +only handles radio button reporting. +The HID Generic Desktop radio control page also defines radio switches and +status LEDs; support for these should be added in a future revision of the +driver. +.Pp +.Fx +does not yet have a generic RFKILL framework analogous to the one found in +Linux. +As a result, +.Nm +can only report radio button events to userspace via +.Ar evdev ; +the kernel itself has no mechanism to act on these events to block or unblock +wireless devices. +A future RFKILL framework would allow the driver to integrate directly with +network interfaces and block transmitters in response to hardware events. diff --git a/sys/conf/NOTES b/sys/conf/NOTES index c7931db374c7..7b253927e9a8 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -2435,6 +2435,7 @@ device hkbd # HID keyboard device hms # HID mouse device hmt # HID multitouch (MS-compatible) device hpen # Generic pen driver +device hrfkill # RFKILL driver device hsctrl # System controls device ps4dshock # Sony PS4 DualShock 4 gamepad driver device u2f # FIDO/U2F authenticator diff --git a/sys/conf/files b/sys/conf/files index 09d4ff70e322..86dbd83e21d9 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1801,6 +1801,7 @@ dev/hid/hkbd.c optional hkbd dev/hid/hms.c optional hms dev/hid/hmt.c optional hmt hconf dev/hid/hpen.c optional hpen +dev/hid/hrfkill.c optional hrfkill dev/hid/hsctrl.c optional hsctrl dev/hid/ietp.c optional ietp dev/hid/ps4dshock.c optional ps4dshock diff --git a/sys/dev/hid/hid.h b/sys/dev/hid/hid.h index f164e48341ed..848657a7b768 100644 --- a/sys/dev/hid/hid.h +++ b/sys/dev/hid/hid.h @@ -74,6 +74,7 @@ #define HUG_KEYBOARD 0x0006 #define HUG_KEYPAD 0x0007 #define HUG_MULTIAXIS_CNTROLLER 0x0008 +#define HUG_RADIO_CONTROL 0x000c #define HUG_X 0x0030 #define HUG_Y 0x0031 #define HUG_Z 0x0032 @@ -116,6 +117,7 @@ #define HUG_D_PAD_RIGHT 0x0092 #define HUG_D_PAD_LEFT 0x0093 #define HUG_APPLE_EJECT 0x00b8 +#define HUG_RADIO_BUTTON 0x00c6 /* Usages Digitizers */ #define HUD_UNDEFINED 0x0000 diff --git a/sys/dev/hid/hrfkill.c b/sys/dev/hid/hrfkill.c new file mode 100644 index 000000000000..279d04c54f6e --- /dev/null +++ b/sys/dev/hid/hrfkill.c @@ -0,0 +1,111 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2026 The FreeBSD Foundation + * Copyright (c) 2026 Framework Computer Inc + * + * This software was developed by Aymeric Wibo + * under sponsorship from the FreeBSD Foundation. + * + * Portions of this software were developed by Daniel Schaefer + * under sponsorship from Framework Computer Inc. + */ + +#include "opt_hid.h" + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +/* + * Reference document: + * https://www.usb.org/sites/default/files/hutrr40radiohidusagesfinal_0.pdf + */ + +static hidmap_cb_t hrfkill_cb; + +static const struct hidmap_item hrfkill_map[] = { + { HIDMAP_REL_CB(HUP_GENERIC_DESKTOP, HUG_RADIO_BUTTON, &hrfkill_cb) }, +}; + +static const struct hid_device_id hrfkill_devs[] = { + { HID_TLC(HUP_GENERIC_DESKTOP, HUG_RADIO_CONTROL) }, +}; + +/* + * Synthesize key-down + key-up for the wireless radio button, + * which only reports a relative pulse (value=1) on press. + * The firmware latches value=1 and never resets it, so we + * track the last value via HIDMAP_CB_UDATA64 and only fire + * on the 0 -> non-zero transition. + */ +static int +hrfkill_cb(HIDMAP_CB_ARGS) +{ + struct evdev_dev *evdev = HIDMAP_CB_GET_EVDEV(); + int32_t last; + + switch (HIDMAP_CB_GET_STATE()) { + case HIDMAP_CB_IS_ATTACHING: + evdev_support_event(evdev, EV_KEY); + evdev_support_key(evdev, KEY_RFKILL); + HIDMAP_CB_UDATA64 = 0; + break; + case HIDMAP_CB_IS_RUNNING: + last = (int32_t)HIDMAP_CB_UDATA64; + HIDMAP_CB_UDATA64 = (uint64_t)ctx.data; + if (ctx.data == 0 || ctx.data == last) + return (ENOMSG); + evdev_push_key(evdev, KEY_RFKILL, 1); + evdev_push_key(evdev, KEY_RFKILL, 0); + break; + default: + break; + } + + return (0); +} + +static int +hrfkill_probe(device_t dev) +{ + return (HIDMAP_PROBE(device_get_softc(dev), dev, + hrfkill_devs, hrfkill_map, "RFKILL Switch")); +} + +static int +hrfkill_attach(device_t dev) +{ + return (hidmap_attach(device_get_softc(dev))); +} + +static int +hrfkill_detach(device_t dev) +{ + return (hidmap_detach(device_get_softc(dev))); +} + +static device_method_t hrfkill_methods[] = { + DEVMETHOD(device_probe, hrfkill_probe), + DEVMETHOD(device_attach, hrfkill_attach), + DEVMETHOD(device_detach, hrfkill_detach), + + DEVMETHOD_END +}; + +DEFINE_CLASS_0(hrfkill, hrfkill_driver, hrfkill_methods, sizeof(struct hidmap)); +DRIVER_MODULE(hrfkill, hidbus, hrfkill_driver, NULL, NULL); +MODULE_DEPEND(hrfkill, hid, 1, 1, 1); +MODULE_DEPEND(hrfkill, hidbus, 1, 1, 1); +MODULE_DEPEND(hrfkill, hidmap, 1, 1, 1); +MODULE_DEPEND(hrfkill, evdev, 1, 1, 1); +MODULE_VERSION(hrfkill, 1); +HID_PNP_INFO(hrfkill_devs); diff --git a/sys/modules/hid/Makefile b/sys/modules/hid/Makefile index a32b9326647e..c6d856c45ed1 100644 --- a/sys/modules/hid/Makefile +++ b/sys/modules/hid/Makefile @@ -15,6 +15,7 @@ SUBDIR += \ hms \ hmt \ hpen \ + hrfkill \ hsctrl \ ietp \ ps4dshock \ diff --git a/sys/modules/hid/hrfkill/Makefile b/sys/modules/hid/hrfkill/Makefile new file mode 100644 index 000000000000..e6c46696fb7d --- /dev/null +++ b/sys/modules/hid/hrfkill/Makefile @@ -0,0 +1,8 @@ +.PATH: ${SRCTOP}/sys/dev/hid + +KMOD= hrfkill +SRCS= hrfkill.c +SRCS+= opt_kbd.h +SRCS+= bus_if.h device_if.h + +.include From nobody Thu Jul 9 08:23:00 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 4gwnyr74Wnz6kpS5 for ; Thu, 09 Jul 2026 08:23:00 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwnyr6Ytlz3d1m for ; Thu, 09 Jul 2026 08:23:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783585380; 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=GqieodR6iOTSm3xtbY0FqR/Fvnf62/EjJGkSPw2gxQA=; b=S1eNimpWt/gM0itKGY+ulbngVMdqHc9rJcWlB34EyyXO38FtIelw2NlY7o8EIw7I/Udf+m cnN/D8OvJ2jAMrcLnBHuv7SyQ7XDfbpIdDYE2y1JctOt+mf4k43I+AqqXAK9W8ChdBTsXU V1WyOWtqJo89p0MG319oTpy05OXr8BMpKeJag6RCgcYA+VakEs12gUdCmxIn2IGits/kQp j+b9Jgcu0Uhs5mLrtQAjA0B0wB7mNm30SVhZ+WdLvQn+iHjbKMn2M8Bf94BOX+e6z6uTOJ GrKgM2J4KRfWPodQp7FFPTJbXYfjo3CAClLFUPJsawZ0vVwEOD6pps5DayWbxA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783585380; a=rsa-sha256; cv=none; b=rjtrZCEyZXwzLegXhPEf+/01D239/UPEYRQvKEWJxL0hzf5UsiSsrMOuxhhEHIebnC/4Yu 5F0AZjmCNfcFqXP232OBT/bDlAxQZQlSprlLwqQ6voTVvb1AW2tXITtCW3KyfbH8Fgtmq4 Q8wExp7/N3b5U5Kbm6+0YLAdRCLgARAJdf7CPGvmAFXX8cHv9uTtd2+YJXXJaNlHdVuJpN k2cRg0BWek6SQTAgh3VjIz7bf09Sddkm2hHjW06Bkw1/HCbw9a2ZrLbJyD7AX0xJ8pPS4t xWWMic+VyM+Zj6eKQuZ/gZgx93foB1QDKdkLbmvAqmkWdXocidqjP5yZbVQEaQ== 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=1783585380; 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=GqieodR6iOTSm3xtbY0FqR/Fvnf62/EjJGkSPw2gxQA=; b=mIyL5lV7RH262vxi/QppLLV97LJdZC4OooYvxxIN/NVbcplIWZdGWzPuB5lOimPFjnhIRX nNdJYiss0p5B4R3N93EI9nmxZZZt9YNuQo+RdDKOdl8CE66oyqZmwj+YKWcrWll3k3PetR PpHjpwmZTf3eH37ilJS0gqZavjrisOxGIyFHB3dAq4chcC/bivAmM78+xdNPZzrUAHV9rp RhMLTVTELzgoFHNaUY7w9iazRTxJccg9f1G5sUbxc4d3eH6NxKdxfkx8zGh9oOxeHO5nbf jjIrAiZHwH8WilIAqk583Drk/Dl0mmfvePj7JdG7nPS+gB2DP33w/9fc3NCbxQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwnyr5PCYz11Fy for ; Thu, 09 Jul 2026 08:23:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1d771 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 09 Jul 2026 08:23:00 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 28f617de7d9b - main - tzcode: Update to 2026c 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 28f617de7d9b9c708eacb3c2c13e5287e1b7354d Auto-Submitted: auto-generated Date: Thu, 09 Jul 2026 08:23:00 +0000 Message-Id: <6a4f5a64.1d771.65e3f04b@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=28f617de7d9b9c708eacb3c2c13e5287e1b7354d commit 28f617de7d9b9c708eacb3c2c13e5287e1b7354d Merge: e2d56447b3a9 2479b6921a20 Author: Dag-Erling Smørgrav AuthorDate: 2026-07-09 08:22:09 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-07-09 08:22:09 +0000 tzcode: Update to 2026c MFC after: 1 week contrib/tzcode/Makefile | 45 ++---- contrib/tzcode/NEWS | 77 ++++++++- contrib/tzcode/localtime.c | 78 ++++++---- contrib/tzcode/newctime.3 | 20 +-- contrib/tzcode/newstrftime.3 | 4 +- contrib/tzcode/newtzset.3 | 16 +- contrib/tzcode/private.h | 24 ++- contrib/tzcode/theory.html | 18 +-- contrib/tzcode/tz-art.html | 32 ++-- contrib/tzcode/tz-how-to.html | 6 +- contrib/tzcode/tz-link.html | 50 +++--- contrib/tzcode/version | 2 +- contrib/tzcode/zdump.c | 66 ++------ contrib/tzcode/zic.8 | 4 +- contrib/tzcode/zic.c | 351 ++++++++++++++++++++++-------------------- 15 files changed, 414 insertions(+), 379 deletions(-) diff --cc contrib/tzcode/Makefile index 1e0a5903534d,000000000000..f5a22f1896a4 mode 100644,000000..100644 --- a/contrib/tzcode/Makefile +++ b/contrib/tzcode/Makefile @@@ -1,1447 -1,0 +1,1436 @@@ +# Make and install tzdb code and data. +# This file is in the public domain, so clarified as of +# 2009-05-17 by Arthur David Olson. +# Request POSIX conformance; this must be the first non-comment line. +.POSIX: +# By default, builds of code and data assume POSIX.1-2001 or later; +# this assumption can be relaxed by tailoring the build as described below. +# On older platforms you may need to scrounge for POSIX conformance. +# For example, on Solaris 10 (2005) with Sun Studio 12 aka Sun C 5.9 (2007), +# use 'PATH=/usr/xpg4/bin:$PATH make CC=c99'. +# Reproducible builds of distribution tarballs also need a copy of the +# Git repository, and assume the behavior of the following programs +# (or later versions): +# Git 2.7.0 (2016) +# GNU Coreutils 6.3 (2006) +# GNU Tar 1.14 (2004) +# GnuPG 1.4 (2004) +# Although tzdb does not come with a software bill of materials, +# you should be able to construct one based on the above information, +# your platform, and the way you use this Makefile. + +# To affect how this Makefile works, you can run a shell script like this: +# +# #!/bin/sh +# make CFLAGS='-O2 -DHAVE_GETTEXT=0' "$@" +# +# This example script is appropriate for a GNU/Linux system +# which needs more optimization than default, and which does not want +# gettext's internationalization of diagnostics. +# +# Alternatively, you can simply edit this Makefile to tailor the following +# macro definitions. + +############################################################################### +# Start of macros that one plausibly might want to tailor. + +# Package name for the code distribution. +PACKAGE= tzcode + +# Version number for the distribution, overridden in the 'tarballs' rule below. +VERSION= unknown + +# Email address for bug reports. +BUGEMAIL= tz@iana.org + +# DATAFORM selects the data format. +# Available formats represent essentially the same data, albeit +# possibly with minor discrepancies that users are not likely to notice. +# To get new features and the best data right away, use: +# DATAFORM= vanguard +# To wait a while before using new features, to give downstream users +# time to upgrade zic (the default), use: +# DATAFORM= main +# To wait even longer for new features, use: +# DATAFORM= rearguard +# Rearguard users might also want "ZFLAGS = -b fat"; see below. +DATAFORM= main + +# Change the line below for your timezone (after finding the one you want in +# one of the $(TDATA) source files, or adding it to a source file). +# Alternatively, if you discover you've got the wrong timezone, you can just +# 'zic -l -' to remove it, or 'zic -l rightzone' to change it. +# Use the command +# make zonenames +# to get a list of the values you can use for LOCALTIME. + +LOCALTIME= Factory + + +# Installation locations. +# +# The defaults are suitable for Debian, except that if REDO is +# posix_right or right_posix then files that Debian puts under +# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead +# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps, +# respectively. Problems with the Debian approach are discussed in +# the commentary for the right_posix rule (below). + +# Destination directory, which can be used for staging. +# 'make DESTDIR=/stage install' installs under /stage (e.g., to +# /stage/etc/localtime instead of to /etc/localtime). Files under +# /stage are not intended to work as-is, but can be copied by hand to +# the root directory later. If DESTDIR is empty, 'make install' does +# not stage, but installs directly into production locations. +DESTDIR = + +# Everything is installed into subdirectories of TOPDIR, and used there. +# TOPDIR should be empty (meaning the root directory), +# or a directory name that does not end in "/". +# TOPDIR should be empty or an absolute name unless you're just testing. +TOPDIR = + +# The default local timezone is taken from the file TZDEFAULT. +TZDEFAULT = $(TOPDIR)/etc/localtime + +# The subdirectory containing installed program and data files, and +# likewise for installed files that can be shared among architectures. +# These should be relative file names. +USRDIR = usr +USRSHAREDIR = $(USRDIR)/share + +# "Compiled" timezone information is placed in the "TZDIR" directory +# (and subdirectories). +# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty. +TZDIR_BASENAME= zoneinfo +TZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME) + +# The "tzselect" and (if you do "make INSTALL") "date" commands go in: +BINDIR = $(TOPDIR)/$(USRDIR)/bin + +# The "zdump" command goes in: +ZDUMPDIR = $(BINDIR) + +# The "zic" command goes in: +ZICDIR = $(TOPDIR)/$(USRDIR)/sbin + - # Manual pages go in subdirectories of. . . ++# Manual pages go in subdirectories of: +MANDIR = $(TOPDIR)/$(USRSHAREDIR)/man + +# Library functions are put in an archive in LIBDIR. +LIBDIR = $(TOPDIR)/$(USRDIR)/lib + + +# Types to try, as an alternative to time_t. +TIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL) +TIME_T_ALTERNATIVES_HEAD = int_least64_t.ck +TIME_T_ALTERNATIVES_TAIL = int_least32_t.ck uint_least32_t.ck \ + uint_least64_t.ck + +# What kind of TZif data files to generate. (TZif is the binary time +# zone data format that zic generates; see Internet RFC 9636.) +# If you want only POSIX time, with time values interpreted as +# seconds since the epoch (not counting leap seconds), use +# REDO= posix_only +# below. If you want only "right" time, with values interpreted +# as seconds since the epoch (counting leap seconds), use +# REDO= right_only +# below. If you want both sets of data available, with leap seconds not +# counted normally, use +# REDO= posix_right +# below. If you want both sets of data available, with leap seconds counted +# normally, use +# REDO= right_posix +# below. POSIX mandates that leap seconds not be counted, and a +# nonnegative TZ_CHANGE_INTERVAL also assumes this, so to be compatible with +# these, use "posix_only" or "posix_right". Use POSIX time on systems with +# leap smearing; this can work better than unsmeared "right" time with - # applications that are not leap second aware, and is closer to unsmeared ++# applications that are not aware of leap seconds, and is closer to unsmeared +# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error). + +REDO= posix_only + +# Whether to put an "Expires" line in the leapseconds file. +# Use EXPIRES_LINE=1 to put the line in, 0 to omit it. +# The EXPIRES_LINE value matters only if REDO's value contains "right". +# If you change EXPIRES_LINE, remove the leapseconds file before running "make". +# zic's support for the Expires line was introduced in tzdb 2020a, +# and was modified in tzdb 2021b to generate version 4 TZif files. +# EXPIRES_LINE defaults to 0 for now so that the leapseconds file +# can be given to pre-2020a zic implementations and so that TZif files +# built by newer zic implementations can be read by pre-2021b libraries. +EXPIRES_LINE= 0 + +# To install data in text form that has all the information of the TZif data, +# (optionally incorporating leap second information), use +# TZDATA_TEXT= tzdata.zi leapseconds +# To install text data without leap second information (e.g., because +# REDO='posix_only'), use +# TZDATA_TEXT= tzdata.zi +# To avoid installing text data, use +# TZDATA_TEXT= + +TZDATA_TEXT= leapseconds tzdata.zi + +# For backward-compatibility links for old zone names, use +# BACKWARD= backward +# To omit these links, use +# BACKWARD= + +BACKWARD= backward + +# If you want out-of-scope and often-wrong data from the file 'backzone', +# but only for entries listed in the backward-compatibility file zone.tab, use +# PACKRATDATA= backzone +# PACKRATLIST= zone.tab +# If you want all the 'backzone' data, use +# PACKRATDATA= backzone +# PACKRATLIST= +# To omit this data, use +# PACKRATDATA= +# PACKRATLIST= + +PACKRATDATA= +PACKRATLIST= + +# The name of a locale using the UTF-8 encoding, used during self-tests. +# The tests are skipped if the name does not appear to work on this system. + +UTF8_LOCALE= en_US.utf8 + +# Extra flags for producing man page files like tzfile.5.txt. +# These flags are used only if groff (or mandoc) is present. +# Each option should begin with "-" and should lack shell metacharacters. +# Plausible options include -Tascii and -Tutf8. +MANFLAGS= -Tutf8 + +# Non-default libraries needed to link. +# On some hosts, this should have -lintl unless CFLAGS has -DHAVE_GETTEXT=0. +LDLIBS= + +# Add the following to an uncommented "CFLAGS=" line as needed +# to override defaults specified in the source code or by the system. +# "-DFOO" is equivalent to "-DFOO=1". +# -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime +# formats that generate only the last two digits of year numbers +# -DEPOCH_LOCAL if the 'time' function returns local time not UT +# -DEPOCH_OFFSET=N if the 'time' function returns a value N greater +# than what POSIX specifies, assuming local time is UT. +# For example, N is 252460800 on AmigaOS. +# -DFREE_PRESERVES_ERRNO=[01] if the 'free' function munges or preserves errno +# (default is guessed) +# -DHAVE_DECL_ASCTIME_R=0 if does not declare asctime_r +# on POSIX platforms predating POSIX.1-2024 +# -DHAVE_DECL_ENVIRON if declares 'environ' +# -DHAVE_DECL_TIMEGM=0 if does not declare timegm +# -DHAVE_DIRECT_H if mkdir needs (MS-Windows) +# -DHAVE_FCHMOD=0 if your system lacks the fchmod function +# -DHAVE__GENERIC=0 if _Generic does not work* +# -DHAVE_GETEUID=0 if gete?[ug]id do not work +# -DHAVE_GETRANDOM if getrandom works (e.g., GNU/Linux), +# -DHAVE_GETRANDOM=0 to avoid using getrandom +# -DHAVE_GETRESUID=0 if getres[ug]id do not work +# -DHAVE_GETTEXT if gettext works (e.g., GNU/Linux, FreeBSD, Solaris), +# where LDLIBS also needs to contain -lintl on some hosts; +# -DHAVE_GETTEXT=0 to avoid using gettext +# -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares +# ctime_r and asctime_r incompatibly with POSIX.1-2017 and earlier +# (Solaris when _POSIX_PTHREAD_SEMANTICS is not defined). +# -DHAVE_INTTYPES_H=0 if does not work*+ +# -DHAVE_ISSETUGID=1 if issetugid works, 0 otherwise (default is guessed) +# If 0, you may also use -DHAVE_SYS_AUXV_H=1 if works, +# 0 otherwise (default is guessed). +# -DHAVE_LINK=0 if your system lacks a link function +# -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function +# -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz +# localtime_rz can make zdump significantly faster, but is nonstandard. +# -DHAVE_MALLOC_ERRNO=0 if malloc etc. do not set errno on failure. +# -DHAVE_MEMPCPY=1 if your system has mempcpy, 0 if not (default is guessed) +# -DHAVE_POSIX_DECLS=0 if your system's include files do not declare +# variables like 'tzname' required by POSIX +# -DHAVE_PWD_H=0 if your system lacks pwd.h, grp.h and corresponding functions +# If 0, you may also need -Dgid_t=G -Duid_t=U +# to define gid_t and uid_t to be types G and U. +# -DHAVE_SETENV=0 if your system lacks the setenv function +# -DHAVE_SETMODE=[01] if your system lacks or has the setmode and getmode +# functions (default is guessed) +# -DHAVE_SNPRINTF=0 if your system lacks the snprintf function+ +# -DHAVE_STDCKDINT_H=0 if neither nor substitutes like +# __builtin_add_overflow work* +# -DHAVE_STDINT_H=0 if does not work*+ +# -DHAVE_STRFTIME_L if declares locale_t and strftime_l +# -DHAVE_STRDUP=0 if your system lacks the strdup function +# -DHAVE_STRNLEN=0 if your system lacks the strnlen function+ +# -DHAVE_STRTOLL=0 if your system lacks the strtoll function+ +# -DHAVE_STRUCT_STAT_ST_CTIM=0 if struct stat lacks a status-change member +# of type struct timespec, so code should use st_ctime instead; +# but if the status-change member name is st_ctimespec, +# use -Dst_ctim=st_ctimespec instead (default is guessed)+ +# -DHAVE_STRUCT_TIMESPEC=0 if your system lacks struct timespec+ +# -DHAVE_SYMLINK=0 if your system lacks the symlink function +# -DHAVE_SYS_STAT_H=0 if does not work* +# If 0, you may also need -Dmode_t=M to define mode_t to be type M. +# -DHAVE_TZSET=0 if your system lacks a tzset function +# -DHAVE_UNISTD_H=0 if does not work* +# -DHAVE_UTMPX_H=0 if does not work* +# -Dlocale_t=XXX if your system uses XXX instead of locale_t +# -DMKTIME_MIGHT_OVERFLOW if mktime might fail due to time_t overflow +# -DOPENAT_TZDIR if tzset should use openat on TZDIR then a relative open. +# See localtime.c for details. +# -DPORT_TO_C89 if tzcode should also run on mostly-C89 platforms+ +# Typically it is better to use a later standard. For example, +# with GCC 4.9.4 (2016), prefer '-std=gnu11' to '-DPORT_TO_C89'. +# Even with -DPORT_TO_C89, the code needs at least one C99 +# feature (integers at least 64 bits wide) and maybe more. +# -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers +# with external linkage, e.g., applications cannot define 'localtime'. +# -Dssize_t=int on hosts like MS-Windows that lack ssize_t +# -DSUPPORT_C89=0 if the tzcode library should not support C89 callers +# Although -DSUPPORT_C89=0 might work around latent bugs in callers, +# it does not conform to POSIX. +# -DSUPPORT_POSIX2008 if the library should support older POSIX callers+ +# However, this might cause problems in POSIX.1-2024-or-later callers. +# -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has +# security implications and is not recommended for general use +# -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires; +# not needed by the main-program tz code, which is single-threaded. +# Append other compiler flags as needed, e.g., -pthread on GNU/Linux. - # The following options can also be used: ++# With -DTHREAD_SAFE the following options can also be used: +# -DTHREAD_PREFER_SINGLE to prefer speed in single-threaded apps, +# at some cost in CPU time and energy in multi-threaded apps. - # The following options can also be used: ++# With -DTHREAD_PREFER_SINGLE the following options can also be used: +# -DHAVE___ISTHREADED=1 if there is an extern int __isthreaded +# variable, 0 otherwise (default is guessed) +# -DHAVE_SYS_SINGLE_THREADED_H=0 if works, +# 0 otherwise (default is guessed) +# -DTHREAD_RWLOCK to use read-write locks instead of mutexes. +# This can improve parallelism and thus save real time +# if many threads call tzcode functions simultaneously. +# It also costs CPU time and thus energy. +# -DTHREAD_TM_MULTI to have gmtime, localtime, and offtime +# return different struct tm * addresses in different threads. +# This supports nonportable programs that call +# gmtime/localtime/offtime when they should call +# gmtime_r/localtime_r/offtime_r to avoid races. +# Because the corresponding storage is freed on thread exit, +# this option is incompatible with POSIX.1-2024 and earlier. +# It also costs CPU time and memory. +# -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t +# This is intended for internal use only; it mangles external names. +# -DTZ_CHANGE_INTERVAL=N if functions depending on TZ should check +# no more often than every N seconds for TZif file changes. +# If N is negative (the default), no such checking is done. +# This option is intended for platforms that want localtime etc. +# to respond to changes to a file selected by TZ, including to +# TZDEFAULT (normally /etc/localtime) if TZ is unset. +# On these platforms, REDO should be "posix_only" or "posix_right". +# This option does not affect tzalloc-allocated objects. +# -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz" +# -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory; +# the default is system-supplied, typically "/usr/lib/locale" +# -DTZ_RUNTIME_LEAPS=0 to disable runtime support for leap seconds. +# This conforms to POSIX, shrinks tzcode's attack surface, +# and is more efficient. However, it fails to support Internet +# RFC 9636's leap seconds. +# -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified +# DST transitions for proleptic format TZ strings lacking them. +# If not specified, it defaults to US rules for future DST transitions. +# This mishandles some past timestamps, as US DST rules have changed. +# It also mishandles settings like TZ='EET-2EEST' for eastern Europe, +# as Europe and US DST rules differ. +# -DTZNAME_MAXIMUM=N to limit time zone abbreviations to N bytes (default 254) +# -DUNINIT_TRAP if reading uninitialized storage can cause problems +# other than simply getting garbage data +# -DUSE_LTZ=0 to build zdump with the system time zone library +# Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below. +# -DZIC_BLOAT_DEFAULT=\"fat\" to default zic's -b option to "fat", and +# similarly for "slim". Fat TZif files work around incompatibilities +# and bugs in some TZif readers, notably older ones that +# ignore or otherwise mishandle 64-bit data in TZif files; +# however, fat TZif files may trigger bugs in newer TZif readers. +# Slim TZif files are more efficient, and are the default. +# -DZIC_MAX_ABBR_LEN_WO_WARN=3 +# (or some other number) to set the maximum time zone abbreviation length +# that zic will accept without a warning (the default is 6) +# -g to generate symbolic debugging info +# -Idir to include from directory 'dir' +# -O0 to disable optimization; other -O options to enable more optimization +# -Uname to remove any definition of the macro 'name' +# $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking +# +# * Options marked "*" can be omitted if your compiler is C23 compatible. +# * Options marked "+" are obsolescent and are planned to be removed +# once the code assumes C99 or later (say in the year 2029) +# and POSIX.1-2024 or later (say in the year 2034). +# +# Select instrumentation via "make GCC_INSTRUMENT='whatever'". +GCC_INSTRUMENT = \ + -fsanitize=undefined -fsanitize-address-use-after-scope \ + -fsanitize-trap=all -fstack-protector +# Omit -fanalyzer from GCC_DEBUG_FLAGS, as it makes GCC too slow. +GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 \ + $(GCC_INSTRUMENT) \ + -Wall -Wextra \ + -Walloc-size-larger-than=100000 -Warray-bounds=2 \ + -Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wcast-qual \ + -Wdate-time \ + -Wdeclaration-after-statement -Wdouble-promotion \ + -Wduplicated-branches -Wduplicated-cond -Wflex-array-member-not-at-end \ + -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \ - -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op \ ++ -Wfree-labels -Wimplicit-fallthrough=5 -Winit-self \ ++ -Wkeyword-macro -Wlogical-op \ + -Wmissing-declarations -Wmissing-prototypes \ + -Wmissing-variable-declarations -Wnested-externs \ + -Wnull-dereference \ + -Wold-style-definition -Woverlength-strings -Wpointer-arith \ - -Wshadow -Wshift-overflow=2 -Wstrict-overflow \ ++ -Wshadow -Wshift-overflow=2 \ + -Wstrict-prototypes -Wstringop-overflow=4 \ + -Wsuggest-attribute=cold \ + -Wsuggest-attribute=const -Wsuggest-attribute=format \ + -Wsuggest-attribute=malloc \ + -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \ + -Wtrampolines -Wundef -Wunused-macros -Wuse-after-free=3 \ + -Wvariadic-macros -Wvla -Wwrite-strings \ + -Wzero-as-null-pointer-constant \ + -Wno-format-nonliteral -Wno-sign-compare -Wno-type-limits +# +# If your system has a "GMT offset" field in its "struct tm"s +# (or if you decide to add such a field in your system's "time.h" file), +# add the name to a define such as +# -DTM_GMTOFF=tm_gmtoff +# to the end of the "CFLAGS=" line. If not defined, the code attempts to +# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this. +# Similarly, if your system has a "zone abbreviation" field, define +# -DTM_ZONE=tm_zone +# and define NO_TM_ZONE to suppress any guessing. +# Although POSIX.1-2024 requires these fields and they are widely available +# on GNU/Linux and BSD systems, some older systems lack them. +# +# The next batch of options control support for external variables +# exported by tzcode. In practice these variables are less useful +# than TM_GMTOFF and TM_ZONE. However, most of them are standardized. +# # +# # To omit or support the external variable "tzname", add one of: +# # -DHAVE_TZNAME=0 # do not support "tzname" +# # -DHAVE_TZNAME=1 # support "tzname", which is defined by system library +# # -DHAVE_TZNAME=2 # support and define "tzname" +# # to the "CFLAGS=" line. Although "tzname" is required by POSIX.1-1988 +# # and later, its contents are unspecified if you use a geographical TZ +# # and the variable is planned to be removed in a future POSIX edition. +# # If not defined, the code attempts to guess HAVE_TZNAME from other macros. +# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause +# # crashes when combined with some platforms' standard libraries, +# # presumably due to memory allocation issues. +# # +# # To omit or support the external variables "timezone" and "daylight", add +# # -DUSG_COMPAT=0 # do not support +# # -DUSG_COMPAT=1 # support, and variables are defined by system library +# # -DUSG_COMPAT=2 # support and define variables +# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by Unix +# # Systems Group code and are required by POSIX.1-2008 and later (with XSI), +# # although their contents are unspecified if you use a geographical TZ +# # and the variables are planned to be removed in a future edition of POSIX. +# # If not defined, the code attempts to guess USG_COMPAT from other macros. +# # +# # To support the external variable "altzone", add +# # -DALTZONE=0 # do not support +# # -DALTZONE=1 # support "altzone", which is defined by system library +# # -DALTZONE=2 # support and define "altzone" +# # to the end of the "CFLAGS=" line; although "altzone" appeared in +# # System V Release 3.1 it has not been standardized. +# # If not defined, the code attempts to guess ALTZONE from other macros. +# +# If you want functions that were inspired by early versions of X3J11's work, +# add +# -DSTD_INSPIRED +# to the end of the "CFLAGS=" line. This arranges for the following +# functions to be added to the time conversion library. +# "offtime" is like "gmtime" except that it accepts a second (long) argument +# that gives an offset to add to the time_t when converting it. +# "offtime_r" is to "offtime" what "gmtime_r" is to "gmtime". +# I.e., "offtime" and "offtime_r" are like calling "localtime_rz" +# with a fixed-offset zone. +# "timelocal" is nearly equivalent to "mktime". +# "timeoff" is like "timegm" except that it accepts a second (long) argument +# that gives an offset to use when converting to a time_t. +# I.e., "timeoff" is like calling "mktime_z" with a fixed-offset zone. +# "posix2time" and "time2posix" are described in an included manual page. +# X3J11's work does not describe any of these functions. +# These functions may well disappear in future releases of the time +# conversion package. +# +# If you don't want functions that were inspired by NetBSD, add +# -DNETBSD_INSPIRED=0 +# to the end of the "CFLAGS=" line. Otherwise, the functions +# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the +# time library, and if STD_INSPIRED is also defined to nonzero the functions +# "posix2time_z" and "time2posix_z" are added as well. +# The functions ending in "_z" (or "_rz") are like their unsuffixed +# (or suffixed-by-"_r") counterparts, except with an extra first +# argument of opaque type timezone_t that specifies the timezone. +# "tzalloc" allocates a timezone_t value, and "tzfree" frees it. +# +# If you want to allocate state structures in localtime, add +# -DALL_STATE +# to the end of the "CFLAGS=" line. Storage is obtained by calling malloc. +# +# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put +# out by the National Institute of Standards and Technology +# which claims to test C and POSIX conformance. If you want to pass PCTS, add +# -DPCTS +# to the end of the "CFLAGS=" line. +# +# If you want strict compliance with XPG4 as of 1994-04-09, add +# -DXPG4_1994_04_09 +# to the end of the "CFLAGS=" line. This causes "strftime" to always return +# 53 as a week number (rather than 52 or 53) for January days before +# January's first Monday when a "%V" format is used and January 1 +# falls on a Friday, Saturday, or Sunday. +# +# POSIX says CFLAGS defaults to "-O 1". +# Uncomment the following line and edit its contents as needed. + +#CFLAGS= -O 1 + + +# The name of a POSIX-like library archiver, its flags, C compiler, +# linker flags, and 'make' utility. Ordinarily the defaults suffice. +# The commented-out values are the defaults specified by POSIX.1-2024. +#AR = ar +#ARFLAGS = -rv +#CC = c17 +#LDFLAGS = +#MAKE = make + +# Where to fetch leap-seconds.list from. +leaplist_URI = \ + https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list +# The file is generated by the IERS Earth Orientation Centre, in Paris. +leaplist_TZ = Europe/Paris +# +# To fetch leap-seconds.list from NIST via a less-secure protocol +# and with less-volatile metadata, use these settings: +#leaplist_URI = ftp://ftp.boulder.nist.gov/pub/time/leap-seconds.list +#leaplist_TZ = America/Denver + +# The zic command and its arguments. + +zic= ./zic +ZIC= $(zic) $(ZFLAGS) + +# To shrink the size of installed TZif files, +# append "-r @N" to omit data before N-seconds-after-the-Epoch. +# To grow the files and work around bugs in older applications, +# possibly at the expense of introducing bugs in newer ones, +# append "-b fat"; see ZIC_BLOAT_DEFAULT above. +# See the zic man page for more about -b and -r. +ZFLAGS= + +# How to use zic to install TZif files. + +ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' + +# The name of a POSIX-compliant 'awk' on your system. +# mawk 1.3.3 and Solaris 10 /usr/bin/awk do not work. +# Also, it is better (though not essential) if 'awk' supports UTF-8, +# and unfortunately mawk and busybox awk do not support UTF-8. - # Try AWK=gawk or AWK=nawk if your awk has the abovementioned problems. ++# Try AWK=gawk or AWK=nawk if your awk has the problems mentioned above. +AWK= awk + +# The full path name of a POSIX-compliant shell, preferably one that supports +# the Korn shell's 'select' statement as an extension. +# These days, Bash is the most popular. +# It should be OK to set this to /bin/sh, on platforms where /bin/sh +# lacks 'select' or doesn't completely conform to POSIX, but /bin/bash +# is typically nicer if it works. +KSHELL= /bin/bash + +# Name of curl , used for HTML validation +# and to fetch leap-seconds.list from upstream. +# Set CURL=: to disable use of the Internet. +CURL= curl + +# Name of GNU Privacy Guard , used to sign distributions. +GPG= gpg + +# This expensive test requires USE_LTZ. +# To suppress it, define this macro to be empty. +CHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives + +# SAFE_CHAR is a regular expression that matches a safe character. +# Some parts of this distribution are limited to safe characters; +# others can use any UTF-8 character. +# For now, the safe characters are a safe subset of ASCII. +# The caller must set the shell variable 'sharp' to the character '#', +# since Makefile macros cannot contain '#'. +# TAB_CHAR is a single tab character, in single quotes. +TAB_CHAR= ' ' +SAFE_CHARSET1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@' +SAFE_CHARSET2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`' +SAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~' +SAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3) +SAFE_CHAR= '[]'$(SAFE_CHARSET)'-]' + +# These non-alphabetic, non-ASCII printable characters are +# used in commentary or in generated *.txt files +# and are not likely to cause confusion. +UNUSUAL_OK_CHARSET= §«°±»½¾×–‘’“”•→−≤★⟨⟩⯪ + +# Put this in a bracket expression to match spaces. +s = [:space:] + +# OK_CHAR matches any character allowed in the distributed files. +# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and +# multibyte letters are also allowed so that commentary can contain a +# few safe symbols and people's names and can quote non-English sources. +OK_CHAR= '[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]' + +# SAFE_LINE matches a line of safe characters. +# SAFE_SHARP_LINE is similar, except any OK character can follow '#'; +# this is so that comments can contain non-ASCII characters. +# OK_LINE matches a line of OK characters. +SAFE_LINE= '^'$(SAFE_CHAR)'*$$' +SAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$' +OK_LINE= '^'$(OK_CHAR)'*$$' + +# Flags to give 'tar' when making a distribution. +# Try to use flags appropriate for GNU tar. +GNUTARFLAGS= --format=pax --pax-option=delete=atime,delete=ctime \ + --numeric-owner --owner=0 --group=0 \ + --mode=go+u,go-w --sort=name +SETUP_TAR= \ + export LC_ALL=C && \ + if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; then \ + TAR='tar $(GNUTARFLAGS)'; \ + else \ + TAR=tar; \ + fi + +# Flags to give 'gzip' when making a distribution. +GZIPFLAGS= -9n + +# When comparing .tzs files, use GNU diff's -F'^TZ=' option if supported. +# This makes it easier to see which Zone has been affected. +SETUP_DIFF_TZS = \ + if diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1; then \ + DIFF_TZS='diff -u -F^TZ='; \ + else \ + DIFF_TZS='diff -u'; \ + fi + +# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. +RANLIB= : + +# POSIX prohibits defining or using SHELL. However, csh users on systems +# that use the user shell for Makefile commands may need to define SHELL. +#SHELL= /bin/sh + +# End of macros that one plausibly might want to tailor. +############################################################################### + + +TZCOBJS= zic.o +TZDOBJS= zdump.o localtime.o strftime.o +DATEOBJS= date.o localtime.o strftime.o +LIBSRCS= localtime.c asctime.c difftime.c strftime.c +LIBOBJS= localtime.o asctime.o difftime.o strftime.o +HEADERS= tzfile.h private.h +NONLIBSRCS= zic.c zdump.c +NEWUCBSRCS= date.c +SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \ + tzselect.ksh workman.sh +MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \ + tzfile.5 tzselect.8 zic.8 zdump.8 +MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \ + time2posix.3.txt \ + tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \ + date.1.txt +COMMON= calendars CONTRIBUTING LICENSE Makefile \ + NEWS README SECURITY theory.html version +WEB_PAGES= tz-art.html tz-how-to.html tz-link.html +CHECK_WEB_PAGES=theory.ck tz-art.ck tz-how-to.ck tz-link.ck +DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) +PRIMARY_YDATA= africa antarctica asia australasia \ + europe northamerica southamerica +YDATA= $(PRIMARY_YDATA) etcetera +NDATA= factory +TDATA_TO_CHECK= $(YDATA) $(NDATA) backward +TDATA= $(YDATA) $(NDATA) $(BACKWARD) +ZONETABLES= zone.tab zone1970.tab zonenow.tab +TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) +LEAP_DEPS= leapseconds.awk leap-seconds.list +TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) \ + $(PACKRATDATA) $(PACKRATLIST) +DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST) +DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ + leapseconds $(ZONETABLES) +AWK_SCRIPTS= checklinks.awk checknow.awk checktab.awk leapseconds.awk \ + ziguard.awk zishrink.awk +MISC= $(AWK_SCRIPTS) +TZS_YEAR= 2050 +TZS_CUTOFF_FLAG= -c $(TZS_YEAR) +TZS= to$(TZS_YEAR).tzs +TZS_NEW= to$(TZS_YEAR)new.tzs +TZS_DEPS= $(YDATA) localtime.c private.h \ + strftime.c tzfile.h zdump.c zic.c +TZDATA_DIST = $(COMMON) $(DATA) $(MISC) +# EIGHT_YARDS is just a yard short of the whole ENCHILADA. +EIGHT_YARDS = $(TZDATA_DIST) $(DOCS) $(SOURCES) tzdata.zi +ENCHILADA = $(EIGHT_YARDS) $(TZS) + +# Consult these files when deciding whether to rebuild the 'version' file. +# This list is not the same as the output of 'git ls-files', since +# .gitignore is not distributed. +VERSION_DEPS= \ + calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \ + africa antarctica asctime.c asia australasia \ + backward backzone \ + checklinks.awk checknow.awk checktab.awk \ + date.1 date.c difftime.c \ + etcetera europe factory iso3166.tab \ + leap-seconds.list leapseconds.awk localtime.c \ + newctime.3 newstrftime.3 newtzset.3 northamerica \ + private.h southamerica strftime.c theory.html \ + time2posix.3 tz-art.html tz-how-to.html tz-link.html \ + tzfile.5 tzfile.h tzselect.8 tzselect.ksh \ + workman.sh zdump.8 zdump.c zic.8 zic.c \ + ziguard.awk zishrink.awk \ + zone.tab zone1970.tab zonenow.tab + +all: tzselect zic zdump libtz.a $(TABDATA) \ + vanguard.zi main.zi rearguard.zi + +ALL: all date $(ENCHILADA) + +install: all $(DATA) $(REDO) $(MANS) + mkdir -p '$(DESTDIR)$(BINDIR)' \ + '$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \ + '$(DESTDIR)$(LIBDIR)' \ + '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \ + '$(DESTDIR)$(MANDIR)/man8' + $(ZIC_INSTALL) -l $(LOCALTIME) \ + -t '$(DESTDIR)$(TZDEFAULT)' + cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.' + cp tzselect '$(DESTDIR)$(BINDIR)/.' + cp zdump '$(DESTDIR)$(ZDUMPDIR)/.' + cp zic '$(DESTDIR)$(ZICDIR)/.' + cp libtz.a '$(DESTDIR)$(LIBDIR)/.' + $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a' + cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.' + cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.' + cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.' + +INSTALL: ALL install date.1 + mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1' + cp date '$(DESTDIR)$(BINDIR)/.' + cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.' + +# Calculate version number from git, if available. +# Otherwise, use $(VERSION) unless it is "unknown" and there is already +# a 'version' file, in which case reuse the existing 'version' contents +# and append "-dirty" if the contents do not already end in "-dirty". +version: $(VERSION_DEPS) + { (type git) >/dev/null 2>&1 && \ + V=$$(git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ + --abbrev=7 --dirty) || \ + if test '$(VERSION)' = unknown && read -r V <$@; then \ + V=$${V%-dirty}-dirty; \ + else \ + V='$(VERSION)'; \ + fi; } && \ + printf '%s\n' "$$V" >$@.out + mv $@.out $@ + +# These files can be tailored by setting BACKWARD, PACKRATDATA, PACKRATLIST. +vanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS) + $(AWK) \ + -v DATAFORM=$(@:.zi=) \ + -v PACKRATDATA='$(PACKRATDATA)' \ + -v PACKRATLIST='$(PACKRATLIST)' \ + -f ziguard.awk \ + $(TDATA) $(PACKRATDATA) >$@.out + mv $@.out $@ +# This file has a version comment that attempts to capture any tailoring +# via BACKWARD, DATAFORM, PACKRATDATA, PACKRATLIST, and REDO. +tzdata.zi: $(DATAFORM).zi version zishrink.awk + read -r version $@.out + mv $@.out $@ + +tzdir.h: + printf '%s\n' >$@.out \ + '#ifndef TZDEFAULT' \ + '# define TZDEFAULT "$(TZDEFAULT)" /* default zone */' \ + '#endif' \ + '#ifndef TZDIR' \ + '# define TZDIR "$(TZDIR)" /* TZif directory */' \ + '#endif' + mv $@.out $@ + +version.h: version + read -r VERSION $@.out + mv $@.out $@ + +zdump: $(TZDOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS) + +zic: $(TZCOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS) + +leapseconds: $(LEAP_DEPS) + $(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \ + -f leapseconds.awk leap-seconds.list >$@.out + mv $@.out $@ + +# Awk script to extract a Git-style author from leap-seconds.list comments. +EXTRACT_AUTHOR = \ + author_line { sub(/^.[[:space:]]*/, ""); \ + sub(/:[[:space:]]*/, " <"); \ + printf "%s>\n", $$0; \ + success = 1; \ + exit \ + } \ + /Questions or comments to:/ { author_line = 1 } \ + END { exit !success } + +# Fetch leap-seconds.list from upstream. +fetch-leap-seconds.list: + $(CURL) -OR $(leaplist_URI) + +# Fetch leap-seconds.list from upstream and commit it to the local repository. +commit-leap-seconds.list: fetch-leap-seconds.list + author=$$($(AWK) '$(EXTRACT_AUTHOR)' leap-seconds.list) && \ + date=$$(TZ=$(leaplist_TZ) stat -c%y leap-seconds.list) && \ + git commit --author="$$author" --date="$$date" -m'make $@' \ + leap-seconds.list + +# Arguments to pass to submakes. +# They can be overridden by later submake arguments. +INSTALLARGS = \ + BACKWARD='$(BACKWARD)' \ + DESTDIR='$(DESTDIR)' \ + PACKRATDATA='$(PACKRATDATA)' \ + PACKRATLIST='$(PACKRATLIST)' \ + TZDEFAULT='$(TZDEFAULT)' \ + TZDIR='$(TZDIR)' \ + ZIC='$(ZIC)' + +INSTALL_DATA_DEPS = zic leapseconds tzdata.zi + +posix_only: $(INSTALL_DATA_DEPS) + $(ZIC_INSTALL) tzdata.zi + +right_only: $(INSTALL_DATA_DEPS) + $(ZIC_INSTALL) -L leapseconds tzdata.zi + +# In earlier versions of this makefile, the other two directories were +# subdirectories of $(TZDIR). However, this led to configuration errors. +# For example, with posix_right under the earlier scheme, +# TZ='right/Australia/Adelaide' got you localtime with leap seconds, +# but gmtime without leap seconds, which led to problems with applications +# like sendmail that subtract gmtime from localtime. +# Therefore, the other two directories are now siblings of $(TZDIR). +# You must replace all of $(TZDIR) to switch from not using leap seconds +# to using them, or vice versa. +right_posix: right_only + rm -fr '$(DESTDIR)$(TZDIR)-leaps' + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \ + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only + +posix_right: posix_only + rm -fr '$(DESTDIR)$(TZDIR)-posix' + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \ + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only + +zones: $(REDO) + +# dummy.zd is not a real file; it is mentioned here only so that the +# top-level 'make' does not have a syntax error. +ZDS = dummy.zd +# Rule used only by submakes invoked by the $(TZS_NEW) rule. +# It is separate so that GNU 'make -j' can run instances in parallel. +$(ZDS): zdump + ./zdump -i $(TZS_CUTOFF_FLAG) "$$PWD/$(@:.zd=)" >$@ + +TZS_NEW_DEPS = tzdata.zi zdump zic +$(TZS_NEW): $(TZS_NEW_DEPS) + rm -fr tzs$(TZS_YEAR).dir + mkdir tzs$(TZS_YEAR).dir + $(zic) -d tzs$(TZS_YEAR).dir tzdata.zi + $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \ + tzdata.zi | LC_ALL=C sort >$@.out + x=$$($(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \ + tzdata.zi \ + | LC_ALL=C sort -t . -k 2,2) && \ + set x $$x && \ + shift && \ + ZDS=$$* && \ + $(MAKE) TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \ + ZDS="$$ZDS" $$ZDS && \ + sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out + rm -fr tzs$(TZS_YEAR).dir + mv $@.out $@ + +# If $(TZS) exists but 'make tzs.ck' fails, a maintainer should inspect the +# failed output and fix the inconsistency, perhaps by running 'make force_tzs'. +$(TZS): + touch $@ + +force_tzs: $(TZS_NEW) + cp $(TZS_NEW) $(TZS) + +libtz.a: $(LIBOBJS) + rm -f $@ + $(AR) $(ARFLAGS) $@ $(LIBOBJS) + $(RANLIB) $@ + +date: $(DATEOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS) + +tzselect: tzselect.ksh version + read -r VERSION $@.out + chmod +x $@.out + mv $@.out $@ + +check: check_mild back.ck now.ck +check_mild: check_web check_zishrink \ + character-set.ck white-space.ck links.ck mainguard.ck \ - name-lengths.ck slashed-abbrs.ck sorted.ck \ ++ name-lengths.ck news.ck slashed-abbrs.ck sorted.ck \ + tables.ck ziguard.ck tzs.ck + +# True if UTF8_LOCALE does not work; +# otherwise, false but with LC_ALL set to $(UTF8_LOCALE). +UTF8_LOCALE_MISSING = \ + { test ! '$(UTF8_LOCALE)' \ + || ! printf 'A\304\200B\n' \ + | LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 \ + || { export LC_ALL='$(UTF8_LOCALE)'; false; }; } + +character-set.ck: $(ENCHILADA) + $(UTF8_LOCALE_MISSING) || { \ + sharp='#' && \ + ! grep -Env $(SAFE_LINE) $(MANS) date.1 \ + $(MISC) $(SOURCES) \ + LICENSE \ + version tzdata.zi && \ + ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \ + Makefile && \ + ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ + leapseconds zone.tab && \ + ! grep -Env $(OK_LINE) $(ENCHILADA); \ + } + touch $@ *** 624 LINES SKIPPED *** From nobody Thu Jul 9 13:41:43 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 4gwx2b3kT7z6lDNB for ; Thu, 09 Jul 2026 13:41:43 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwx2b2RhMz46qc for ; Thu, 09 Jul 2026 13:41:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783604503; 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=7D+H+fHPL4b1Kw5qCaH1g2oTmpL4W5L3xM/8JGc/a9c=; b=OzyhrQovJZpCJKVYaO7YYI7A3idgqWIfDrsRrJ1xXH/rh0i3yyaSCLFBup8cs/v7rPvPh+ L5Ua2Kn25JHPW6jCHpC/+3C8nCk71qOnqEVt4uhDuCBt7WMI93uRzPR+A7yXdHALEWxQFG L1Jd58iCqVnFs0vxQcpnzM2HW00QQN6rIbJn0V7XG03LO6MWvg2zkmdYzEJWDOPda23BP1 yrOLUk+ZD7znJTxvIwV1bAm+n2FjnmQY8ueYk8IZnhr2BETnqoS7uaTWWiJA99Ttzs9GKp yCs7KcxdMpi4Meph9ahs0OO9oqwYsR5KScUQF/QMW1596ROyuUfWbP1S/qMwXg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783604503; a=rsa-sha256; cv=none; b=FHoTZWO0nCGc8Owuvdb1wZJyF4+zYLQbGTZH3vUBW6xifxd6wwEn/JjsNedWXUDxsu9MI8 JYh8DfaYJz+BMhgRISAuncU52x4aKHlsM4HaswuI1kiD/veHoNYuZupgj++OsWDyRjgqfM eYf+xHasWzCPKLIb0r155XrYF9rgrnbw3AtRHxyrGuyACD55ov7ywsbOs1ZT3P5lj+Sv0v MlqD1J+KwbIOycxb0v/0cU61ugXg0jscrQagUf0stIq8W8ELYvX3iNMvb3MFAgamKErAlQ GPhrzxSW9cqk5j6N/NcTDW1ym7O0q+to+rQoWCuQn3kv/Ba9UHD9c/FFeFMR6g== 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=1783604503; 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=7D+H+fHPL4b1Kw5qCaH1g2oTmpL4W5L3xM/8JGc/a9c=; b=G290eRz6GKW3a5bF6p6sOSHpH0BYKqBMQ4p8VF6ofHqM9TFssSnv+bFcS8IbaBU8QEYCqX QmjKNqGKFe2tU8tWhoKQKckapMhY2+OyfYFNAzUyl73PpMy3FeDVY4glt22TZtC0fOT0lG hng9x/iFJi0HbUbLT2+gPczTmYQP0BE7OpIzRwX3bjZ52m/a8hRPB0LTeWpRe+3HXRYisl uEvctmiGx+bSKCCVBfMyqoEt6rWsnu8GzN9x3zqMeKiUT3mpIiG4a3Zs31skfoNXdPGlgG 4uBN60pLctcdKUwpznVy+Ums9+kOoxvYYuTTXZhyhX2wJ3u2X0cXxyakZBX25A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwx2b13l7z19TD for ; Thu, 09 Jul 2026 13:41:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 20430 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 09 Jul 2026 13:41:43 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: e1ab35148dd4 - main - netmap: Don't assume that user-provided strings are nul-terminated 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: e1ab35148dd425340a88a2acaf10b972cb119f8f Auto-Submitted: auto-generated Date: Thu, 09 Jul 2026 13:41:43 +0000 Message-Id: <6a4fa517.20430.4457887a@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e1ab35148dd425340a88a2acaf10b972cb119f8f commit e1ab35148dd425340a88a2acaf10b972cb119f8f Author: Mark Johnston AuthorDate: 2026-07-08 17:11:05 +0000 Commit: Mark Johnston CommitDate: 2026-07-09 13:41:19 +0000 netmap: Don't assume that user-provided strings are nul-terminated MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/dev/netmap/netmap_bdg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/netmap/netmap_bdg.c b/sys/dev/netmap/netmap_bdg.c index bcb45f55d160..1fe5052448f8 100644 --- a/sys/dev/netmap/netmap_bdg.c +++ b/sys/dev/netmap/netmap_bdg.c @@ -1043,6 +1043,10 @@ netmap_bdg_config(struct nm_ifreq *nr) struct nm_bridge *b; int error = EINVAL; + if (strnlen(nr->nifr_name, sizeof(nr->nifr_name)) >= + sizeof(nr->nifr_name)) + return error; + NMG_LOCK(); b = nm_find_bridge(nr->nifr_name, 0, NULL); if (!b) { From nobody Thu Jul 9 13:41:44 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 4gwx2c3mlZz6lDND for ; Thu, 09 Jul 2026 13:41:44 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwx2c2Q09z46wV for ; Thu, 09 Jul 2026 13:41:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783604504; 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=alUPAt3sv7aq9fzQnJsZjN2wLs/j7nCj4uFxEYVRAFk=; b=cSkRI+kxdgEfgf4JYwQKcG0ytpOZiUbJ3BTZPFZTPFZB9jnRJ/mV17RdEiKxG3zR2FVi// K7+rKXOxHZqQvCpeAyPyJFLE0veqngaMa6m+RVIw6ADNc3lYfa8/ckQwF9f9g3rK0AUyTq yco9ZBtvKXL+8Xknq/KWmPA8f2khi4KEDH2rQDW6sdpoaVVNEUU/VGAodqTQb6WDSfMZPj VuL/LO39rcTDSGchlkxEwIAEteNhZTtZmNmj2ECPbsaSx+xbD3cakkJ5JdDlM1/fBS4qqk IyaYSTVbuQHJPpIQ1vnO8Jcpm17q0lSev6Hx0PTmO3HCIS1g1aBC5LYgX/cWbg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783604504; a=rsa-sha256; cv=none; b=MoKkKn/gPgYVFm89eUIHXAxCAanMDPRdDLyeMTYIttzONegX66ywuQXZbdjyP7Wnc2rCk+ A2wDmCCuLcyu80DbIlF6mHZK5ydEV2+4MR3sUTPLh9pZJ++1FFcCO8vaGzOwmDwnlT5YwH Y8VKegiODWMetiktaArDC7Om/WW/q6Z6kUe4qBDquVPKGCgSORHjg7uBa+uB+MwPZjJIf0 pLHEWw1unv1crPHeyENjD32PMzSiFFpDh/PD+Y2tIwvQFqInaA36F9PjA2BCLoFR7G7xTU Fat4ce3WNzCHVfuhS/qLPpWhSNosgG0/RCblgvLvvYe+cRgmCy4wfpe3J4u9nA== 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=1783604504; 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=alUPAt3sv7aq9fzQnJsZjN2wLs/j7nCj4uFxEYVRAFk=; b=r1b76WphhFDkVex+MdPjNj1o/jMnRITf3fZUMiLjS5etIqVsHlmyPbLcNfw4VyZj+TDBzx HiRMFS4mJmfv36tAhBN8BxJtvmvkxroM22dYBIhozfX9U1a13VbvK580g8d1auecsha0bU Fq3SD4ZJrj8PswkGm3h3CDvIu3up7QNSx7OxWgIks7hjUhURCQ0LJEdY+mw+2nTzZ4meAl vjZ9oLyWytYL43drs/fHVq7HdTuciXCqbGAh/yHjclZh5yoVu5SjyJTN+8jkvmipLy0ZvB EvB8AgfV5GNfZfOi9gP5DWHTOZ38ZZutt47EcOCIuzObLxpLZITOp87fEWw21A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwx2c1PFXz19YZ for ; Thu, 09 Jul 2026 13:41:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 20434 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 09 Jul 2026 13:41:44 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: de6193cf7d2c - main - timefd: Correct the required rights for timerfd_gettime() 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: de6193cf7d2c0c31e5ccafd098275a629a5ea49e Auto-Submitted: auto-generated Date: Thu, 09 Jul 2026 13:41:44 +0000 Message-Id: <6a4fa518.20434.650f31@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=de6193cf7d2c0c31e5ccafd098275a629a5ea49e commit de6193cf7d2c0c31e5ccafd098275a629a5ea49e Author: Mark Johnston AuthorDate: 2026-07-08 17:12:21 +0000 Commit: Mark Johnston CommitDate: 2026-07-09 13:41:24 +0000 timefd: Correct the required rights for timerfd_gettime() Reviewed by: jfree MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D58084 --- sys/kern/sys_timerfd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/sys_timerfd.c b/sys/kern/sys_timerfd.c index 22e6a30faa21..412a000c22d6 100644 --- a/sys/kern/sys_timerfd.c +++ b/sys/kern/sys_timerfd.c @@ -496,7 +496,7 @@ kern_timerfd_gettime(struct thread *td, int fd, struct itimerspec *curr_value) struct timerfd *tfd; int error; - error = fget(td, fd, &cap_write_rights, &fp); + error = fget(td, fd, &cap_read_rights, &fp); if (error != 0) return (error); if (fp->f_type != DTYPE_TIMERFD) { From nobody Thu Jul 9 13:41:45 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 4gwx2f0Rk0z6lDNF for ; Thu, 09 Jul 2026 13:41: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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwx2d3Xdxz46nM for ; Thu, 09 Jul 2026 13:41:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783604505; 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=r882wySeNafvsUiVZ2S+qOqE8jB2U66EkAblhVbnLic=; b=ANLaffIzv/xN2i6X5bl8XEjZYGY1FbKQkY9mCacEUIhF7cdWux/YJLjJerV35aQgHs892b 5m8rpr5Tcx5fEOhACOWWy2v3TmMAs78Sw2H6xOj/2wx5NupcNuvqxWOXEISlybsiiWjBDg VW7MASS1gifGXpHWE/ZmOaDmR0w/PSJL+28mvbrZSqFl97+Kamm+3vx6IuJEAqgzaNm/XP GNJ65MZyM3nzWhqx95I9GMSJM/Xnq2uS9glLkGk2gUvrBxNvLvK/qn8PsGiZMh8gJng7/S GX9oIzWv12Ha+VMPDAw6nXzv7d7pqvXY8MPXieOs3s6CYaicVmrSO7tllHxZDA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783604505; a=rsa-sha256; cv=none; b=QHTY2OtQQ8vVBbaU36sJh+Off0EDlo79mtcdxx9wXugy3jfDO3hvlwG/+bvamX79UzvPi0 wXSDendtq7AJqpNd/WpBJKUG2leEcQSdwjfGfxZ2YuH9rdnK4A7IdlBgp7G9iFEWQXi1Nu dqP8d/7cuADwOsXYvUzapiBo7mTvz1zmZfzJRPphBdnfSv36aHD33BAzmfvpRJkDT4nak3 mJHLt/M8nnQrFQm/yLh23KX7HG1/UWG3kXT+NGyGpyi0ht+kyTLdtQM4DyJEeKhjiCgxH7 CgCnlM+tnP4zDHzLHREXOcywUBaPnfSke1YE65ELQWidqYkJfcX18h78gIDfUA== 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=1783604505; 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=r882wySeNafvsUiVZ2S+qOqE8jB2U66EkAblhVbnLic=; b=bijxHEt4EHK1YDCaNAEpnZLP33ru4m+lbCm29bffLUouVC6EmTRbqgYyJqxQN6H/RrJdim uCP2eSGyBg+CMbx8tXKoB2Vd3QDrTus3tvmO+7bTpzotnACDcOQs3qJJvQvbkyqKDN9rcl qm0KIsLpMddjKW+iyWaND3GzVlyZ9WGAxErPAJi2Itxt0YJrWBq/VicXXJfWrl3+1FycmT eAl3Pr4xTYkhfVt4qhYGjagAk+zmFD/qnnGNT51YHADdy7xeeYNjeZOoq2QhQ2FXAex3uk xgRGtlnXZEVKRL8Qi9JcEPjb/B64v7sT8+nKhS1lmXqu759CC1UMKmpXHPrHlQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwx2d2FLmz18xn for ; Thu, 09 Jul 2026 13:41:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1f2ac by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 09 Jul 2026 13:41:45 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: a58590631ccc - main - taskqueue: Avoid unbounded epoch read sections 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: a58590631ccc0fa5bdbbdf88021c6878d644d128 Auto-Submitted: auto-generated Date: Thu, 09 Jul 2026 13:41:45 +0000 Message-Id: <6a4fa519.1f2ac.1b16199f@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a58590631ccc0fa5bdbbdf88021c6878d644d128 commit a58590631ccc0fa5bdbbdf88021c6878d644d128 Author: Mark Johnston AuthorDate: 2026-07-08 17:12:54 +0000 Commit: Mark Johnston CommitDate: 2026-07-09 13:41:27 +0000 taskqueue: Avoid unbounded epoch read sections The taskqueue thread loop tries to avoid entering and exiting net epoch read sections for every task. This reduces the overhead of net epoch integration, but the implementation wasn't bounding the length of the read section, so a busy taskqueue thread could hold an epoch open for an unbounded period. This is easy to achieve with the epair task, for instance. Bound the number of tasks that we'll execute without observing the global epoch, and provide a sysctl to control it. Let the default bound be eight. Reviewed by: glebius MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D58031 --- sys/kern/subr_gtaskqueue.c | 20 ++++++++++++-------- sys/kern/subr_taskqueue.c | 34 ++++++++++++++++++++++++++-------- sys/sys/taskqueue.h | 2 ++ 3 files changed, 40 insertions(+), 16 deletions(-) diff --git a/sys/kern/subr_gtaskqueue.c b/sys/kern/subr_gtaskqueue.c index e13721ffe1f2..4b0600101b64 100644 --- a/sys/kern/subr_gtaskqueue.c +++ b/sys/kern/subr_gtaskqueue.c @@ -342,14 +342,14 @@ gtaskqueue_run_locked(struct gtaskqueue *queue) struct epoch_tracker et; struct gtaskqueue_busy tb; struct gtask *gtask; - bool in_net_epoch; + unsigned int epochtasks; KASSERT(queue != NULL, ("tq is NULL")); TQ_ASSERT_LOCKED(queue); tb.tb_running = NULL; LIST_INSERT_HEAD(&queue->tq_active, &tb, tb_link); - in_net_epoch = false; + epochtasks = 0; while ((gtask = STAILQ_FIRST(&queue->tq_queue)) != NULL) { STAILQ_REMOVE_HEAD(&queue->tq_queue, ta_link); gtask->ta_flags &= ~TASK_ENQUEUED; @@ -358,19 +358,23 @@ gtaskqueue_run_locked(struct gtaskqueue *queue) TQ_UNLOCK(queue); KASSERT(gtask->ta_func != NULL, ("task->ta_func is NULL")); - if (!in_net_epoch && TASK_IS_NET(gtask)) { - in_net_epoch = true; - NET_EPOCH_ENTER(et); - } else if (in_net_epoch && !TASK_IS_NET(gtask)) { + if (TASK_IS_NET(gtask)) { + if (epochtasks++ == 0) + NET_EPOCH_ENTER(et); + } else if (epochtasks > 0) { NET_EPOCH_EXIT(et); - in_net_epoch = false; + epochtasks = 0; } gtask->ta_func(gtask->ta_context); + if (epochtasks > net_epoch_task_limit) { + NET_EPOCH_EXIT(et); + epochtasks = 0; + } TQ_LOCK(queue); wakeup(gtask); } - if (in_net_epoch) + if (epochtasks > 0) NET_EPOCH_EXIT(et); LIST_REMOVE(&tb, tb_link); } diff --git a/sys/kern/subr_taskqueue.c b/sys/kern/subr_taskqueue.c index f17e59a441a6..b337aa83d69d 100644 --- a/sys/kern/subr_taskqueue.c +++ b/sys/kern/subr_taskqueue.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -78,6 +79,19 @@ struct taskqueue { void *tq_cb_contexts[TASKQUEUE_NUM_CALLBACKS]; }; +static SYSCTL_NODE(_kern, OID_AUTO, taskqueue, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, + "taskqueue information"); + +/* + * Limit on the number of tasks that may be run in a single epoch section. + * It's profitable to batch tasks together, but there must be a bound in order + * to maintain system liveness. + */ +unsigned int net_epoch_task_limit = 8; +SYSCTL_UINT(_kern_taskqueue, OID_AUTO, net_epoch_task_limit, CTLFLAG_RWTUN, + &net_epoch_task_limit, 0, + "Maximum number of tasks to run in an epoch section"); + #define TQ_FLAGS_ACTIVE (1 << 0) #define TQ_FLAGS_BLOCKED (1 << 1) #define TQ_FLAGS_UNLOCKED_ENQUEUE (1 << 2) @@ -486,15 +500,15 @@ taskqueue_run_locked(struct taskqueue *queue) struct epoch_tracker et; struct taskqueue_busy tb; struct task *task; - bool in_net_epoch; + unsigned int epochtasks; int pending; KASSERT(queue != NULL, ("tq is NULL")); TQ_ASSERT_LOCKED(queue); tb.tb_running = NULL; LIST_INSERT_HEAD(&queue->tq_active, &tb, tb_link); - in_net_epoch = false; + epochtasks = 0; while ((task = STAILQ_FIRST(&queue->tq_queue)) != NULL) { STAILQ_REMOVE_HEAD(&queue->tq_queue, ta_link); if (queue->tq_hint == task) @@ -507,19 +521,23 @@ taskqueue_run_locked(struct taskqueue *queue) TQ_UNLOCK(queue); KASSERT(task->ta_func != NULL, ("task->ta_func is NULL")); - if (!in_net_epoch && TASK_IS_NET(task)) { - in_net_epoch = true; - NET_EPOCH_ENTER(et); - } else if (in_net_epoch && !TASK_IS_NET(task)) { + if (TASK_IS_NET(task)) { + if (epochtasks++ == 0) + NET_EPOCH_ENTER(et); + } else if (epochtasks > 0) { NET_EPOCH_EXIT(et); - in_net_epoch = false; + epochtasks = 0; } task->ta_func(task->ta_context, pending); + if (epochtasks > net_epoch_task_limit) { + NET_EPOCH_EXIT(et); + epochtasks = 0; + } TQ_LOCK(queue); wakeup(task); } - if (in_net_epoch) + if (epochtasks > 0) NET_EPOCH_EXIT(et); LIST_REMOVE(&tb, tb_link); } diff --git a/sys/sys/taskqueue.h b/sys/sys/taskqueue.h index 9da364a1a716..b9d4ebe98be4 100644 --- a/sys/sys/taskqueue.h +++ b/sys/sys/taskqueue.h @@ -221,4 +221,6 @@ struct taskqueue *taskqueue_create_fast(const char *name, int mflags, */ TASKQUEUE_DECLARE(bus); +extern unsigned int net_epoch_task_limit; + #endif /* !_SYS_TASKQUEUE_H_ */ From nobody Thu Jul 9 13:41:46 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 4gwx2g1hNcz6lDgs for ; Thu, 09 Jul 2026 13:41:47 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwx2f4RrGz47DD for ; Thu, 09 Jul 2026 13:41:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783604506; 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=2mVXL4/XT4GxsKpENtJ7BDIpBWGlmNjhXk3jXUm6gjA=; b=s+E6AkoPagoDqTKeb5eTzM0KUfyS/Iw3UV4gu6Cs+wkDMQ1Vpy0uG7P8tKaHFOp/LDemSg dF9jJclWVquVWlbbOFRkJoz0zffkqJ+t9edGGxpRgq4vu6IKqq3yA4/aX6FUfPTHEBBdz3 vGbcpqFvVBtBgZWpO3ZpVQfXREVT0iMmjKwlaPGOkS2XlPeeBtFSOPaDrErASVOlRZY62a xCkOO+Cfff0nBcT49Ww9PFDJZOjnbOdxzLofDjyNeZxfEdiENsuspaQQtzVP+6anqvUMka BqwquQhStrinlawyZ/tXI33KwOHgcetmGmPU25FyFeQ2KUxubuaBnIhQntdqQw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783604506; a=rsa-sha256; cv=none; b=WW59Z2vO0ij/cmjL5vk1+ZnnU7HbIR4tH9QdIFTrbGOzEoFLqDZJOxxzMI79hSpJJvDJ9Y QgdaKlkGPTWDxJzWZ4Ue6O/BwifTPZQwLkx+nDMcbzAdX9se/nmTdglJF3E2G37lXLygYR Q9wxGfb6elhSJ8wYBE5HgsNcNmEgza2rp/3rQPFOWQfJuhfbXnBzLjnrMToMClhP84Fdjd 0a8vijl1g27mOrzNZEhwdgJYu87PNXOSgEJl75oaSle+kwuRWvgwSRuP/lpUrckBa1JMkt GcXGB5Dhc6PyTbpQKppOTMPmKLDyOO58axJoT7oYN0wNYCtjTDoTkR+20zcsSw== 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=1783604506; 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=2mVXL4/XT4GxsKpENtJ7BDIpBWGlmNjhXk3jXUm6gjA=; b=MaswEi+NSx4tIL8E6WWmzUibyKJKD8Hvhs0Cf8DqHwKEjxTt61reMr71dbIDAtO/8w8XfG N9GMrvfo+QjwnHtKcmGKy6BK4kWNE4TTmTnR1X0M3742x7I8u8dsdGXtab+pyaX5uaCd7C kOP3iKLErh5yivf9806ppte89B56DOvmgHCo2hgXsLRLagGIjVDL2/cMaqDVIimnDwty0Q OzvTH8k8l8lXX2ua1mUwQUNHo4oKGrZ4oWRznbo3Y7A4QpsCm6/1RH5als7EF2H7NeCUX1 cb+uz1IzLQ34yhDS05YeZ3iMPjSTIBGdT/Wzz/ZFkHv0YWJPkTe4wiFzKjeW4A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwx2f31R6z192x for ; Thu, 09 Jul 2026 13:41:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1cae7 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 09 Jul 2026 13:41:46 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 7bf11a2f0c9a - main - epoch: Fix epoch_drain_callbacks() 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: 7bf11a2f0c9ad7af00996105fd34e61f1040402b Auto-Submitted: auto-generated Date: Thu, 09 Jul 2026 13:41:46 +0000 Message-Id: <6a4fa51a.1cae7.38844096@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7bf11a2f0c9ad7af00996105fd34e61f1040402b commit 7bf11a2f0c9ad7af00996105fd34e61f1040402b Author: Mark Johnston AuthorDate: 2026-07-08 17:13:01 +0000 Commit: Mark Johnston CommitDate: 2026-07-09 13:41:27 +0000 epoch: Fix epoch_drain_callbacks() This function is supposed to wait until all pending callbacks have been executed. This is useful in some contexts where we tear down some context (like a VNET jail and its associated UMA zones) synchronously, and we want to make sure that all pending asynchronous callbacks (which may free objects to said UMA zones) have run first. The implementation schedules a callback on each CPU and waits for them all to run. This assumes that, on a given CPU, callbacks are executed in the order that they are pushed. This assumption depends on the implementation of epoch_call_task() and ck_epoch_poll_deferred(), and it is not true in general. Callbacks are pushed onto a per-CPU stack in LIFO order. ck_epoch_poll_deferred() first pulls out the callbacks from epoch - 2, which are always safe to execute, and in so doing reorders them such that the oldest callback as at the top of the stack, so in this case, epoch_call_task() will execute them in order. However, ck_epoch_poll_deferred() may determine that it is safe to execute callbacks from epoch - 1 (or even from the current epoch if there are no active readers), and in this case it will push those callbacks onto the returned stack. This means that epoch_call_task() will invoke those newer destructors before the older ones, which means that epoch_drain_callbacks() may return early. Fix the correctness problem by simply doing all of this twice: once the first callback is invoked, we know that all of the callbacks that were pending at the time that epoch_drain_callbacks() was called are scheduled to be executed, so when the second callback is executed we know that they must be finished. This is slow, but it is already slow, and the slowness is less noticeable after commit dce56594991. I note that in an ideal world, this function would not exist, and all of the teardown would happen asynchronously, rather than the current mismash of synchronous and asynchronous cleanup. PR: 290201 Reviewed by: glebius MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D58030 --- sys/kern/subr_epoch.c | 50 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/sys/kern/subr_epoch.c b/sys/kern/subr_epoch.c index 51d66d51db8d..266230b04b43 100644 --- a/sys/kern/subr_epoch.c +++ b/sys/kern/subr_epoch.c @@ -986,30 +986,40 @@ epoch_drain_callbacks(epoch_t epoch) sched_unbind(td); td->td_pinned = 0; - CPU_FOREACH(cpu) - epoch->e_drain_count++; - CPU_FOREACH(cpu) { - er = zpcpu_get_cpu(epoch->e_pcpu_record, cpu); - sched_bind(td, cpu); - epoch_call(epoch, &epoch_drain_cb, &er->er_drain_ctx); - } + /* + * Schedule a destructor on each CPU and block until all of them have + * run. Don't assume that destructors are invoked in order: once we're + * finished draining, do the same thing again to ensure that any + * destructors scheduled after the first pass have also run. + */ + for (int i = 0; i < 2; i++) { + CPU_FOREACH(cpu) + epoch->e_drain_count++; + CPU_FOREACH(cpu) { + er = zpcpu_get_cpu(epoch->e_pcpu_record, cpu); + sched_bind(td, cpu); + epoch_call(epoch, &epoch_drain_cb, &er->er_drain_ctx); + } - /* restore CPU binding, if any */ - if (was_bound != 0) { - sched_bind(td, old_cpu); - } else { - /* get thread back to initial CPU, if any */ - if (old_pinned != 0) + /* restore CPU binding, if any */ + if (was_bound != 0) { sched_bind(td, old_cpu); - sched_unbind(td); - } - /* restore pinned after bind */ - td->td_pinned = old_pinned; + } else { + /* get thread back to initial CPU, if any */ + if (old_pinned != 0) + sched_bind(td, old_cpu); + sched_unbind(td); + } + /* restore pinned after bind */ + td->td_pinned = old_pinned; + thread_unlock(td); - thread_unlock(td); + while (epoch->e_drain_count != 0) + msleep(epoch, &epoch->e_drain_mtx, PZERO, "EDRAIN", 0); - while (epoch->e_drain_count != 0) - msleep(epoch, &epoch->e_drain_mtx, PZERO, "EDRAIN", 0); + thread_lock(td); + } + thread_unlock(td); mtx_unlock(&epoch->e_drain_mtx); sx_xunlock(&epoch->e_drain_sx); From nobody Thu Jul 9 13:41:47 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 4gwx2h1TBzz6lDSF for ; Thu, 09 Jul 2026 13:41:48 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwx2g4tlgz46qv for ; Thu, 09 Jul 2026 13:41:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783604507; 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=7n63H9+GPbHaeeuvErdWogCh8aHpo2eKoWVhs3nx22M=; b=AZm1ZyRUgWXqL9c1JUN2viZonDECuRE9Y104Ik3f3gGRxHOXi42CHU1EXvWyVe+p9/xFZo QGocxy67xmYBjp9bePq6RaFl3FeZnn+15FhzL7ypCREnk+wmqWLI1m47pCf65b81WdjJw9 NZ92xGSp8LFORMnFb6DzfMhIF6cEJLHDCTJmlKvF2Il2Z4o6hEm0G+H3zlh/Q37yi6nOtF UxByAqKWQT1CMRZhFUWbRmeVXK0x5Q21CvTk9Vu0llUA/MNcvYV5R0Sux5NPTBqXgOAKBM tldyasauF0zKzv4oJ/K8k6B+OqpwT+QtErkKhAlMwkpE2ffhvz5Zu9z3dl3RPg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783604507; a=rsa-sha256; cv=none; b=ZCTuluVH5v20j46jqjl316FhuHgBvz+X8FoNPqvHEk6A3kDQurVcr2LFoNcBBz032vAuSJ NB3UG0Q5Yr754GjjLuTIbPmukxP9GWDu3rq3/PvLQcHhaD/fD9SVumTjIHAC2RPzrj/m84 0aMOCFZP6zVgY+VAscpXqOGxbyfn1akjbpTpjYEIvoz/4jQEw6HkYF3qjpCH2q7pUbaN0Y PYymv5FuK6guwiuH4gddOustxRYIvrLPPeylMGfW4KZirg7Na5pRSTGlvn2MKnWlUoODbH ZZwNRxI5qE40IEKjK9XyJL4VG5UT8Sur5Zy82rFsH+o1sNci8SaUp6vyyLhxPw== 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=1783604507; 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=7n63H9+GPbHaeeuvErdWogCh8aHpo2eKoWVhs3nx22M=; b=wfZN+CI2aPeaXQdOFaYAOCCGlvD/h/dotNcB72H/RsbtBuzgQwn0gy1ZTV1+Yy0dDUYAGt bxVwWM+2V8TsqikosxutrBpr7Wuo17uH6DCEvjrpUEKImBtbOdJlcot8O1vCK++7eGmxPG eV90QQmUqMzXwmbYPVexJms/Q5C0TOjaJaZ/2nHXZXOhibqvC9mp/F7FtrKs+3er8te0FG XhVpSbwDmpzoK9L6WA95VkNc8D22UE7jIR+gf91SAF8Jw/fM6p6ToaKTHT+PFgRaZ0MHpM nmhPNberJBUeHBUdyUTG79+mvmY1StA/ycxf7uSD4PllqXmfV1Kn7G18+wMsxA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwx2g3XMjz19Yc for ; Thu, 09 Jul 2026 13:41:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1eaee by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 09 Jul 2026 13:41:47 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 836a76ad95be - main - tests/inotify: Make an error message more useful 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: 836a76ad95be2fcf2cd116d754c5888a731d57aa Auto-Submitted: auto-generated Date: Thu, 09 Jul 2026 13:41:47 +0000 Message-Id: <6a4fa51b.1eaee.59a861c1@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=836a76ad95be2fcf2cd116d754c5888a731d57aa commit 836a76ad95be2fcf2cd116d754c5888a731d57aa Author: Mark Johnston AuthorDate: 2026-07-08 17:09:42 +0000 Commit: Mark Johnston CommitDate: 2026-07-09 13:41:27 +0000 tests/inotify: Make an error message more useful MFC after: 3 days --- tests/sys/kern/inotify_test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/sys/kern/inotify_test.c b/tests/sys/kern/inotify_test.c index 9d5265e71f95..0c2cc260f29e 100644 --- a/tests/sys/kern/inotify_test.c +++ b/tests/sys/kern/inotify_test.c @@ -96,7 +96,8 @@ consume_event_cookie(int ifd, int wd, unsigned int event, unsigned int flags, ATF_REQUIRE(ev != NULL); n = read(ifd, ev, evsz); - ATF_REQUIRE_MSG(n >= 0, "failed to read event %s", ev2name(event)); + ATF_REQUIRE_MSG(n >= 0, "failed to read event %s: %s", + ev2name(event), strerror(errno)); ATF_REQUIRE((size_t)n >= sizeof(*ev)); ATF_REQUIRE((size_t)n == sizeof(*ev) + ev->len); ATF_REQUIRE((size_t)n == evsz); From nobody Thu Jul 9 13:41:48 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 4gwx2j16CCz6lDPj for ; Thu, 09 Jul 2026 13:41:49 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwx2h5Km4z47JH for ; Thu, 09 Jul 2026 13:41:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783604508; 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=39H7nlf1lHjlp7BzwEMgDwq67iPEqmDNC/jagNrMjCs=; b=g8m9HExflzHR5aTGP+JvCHhhial4/iXE7NX4KUUmlugsGdb9LuX6JtclDFE2uc7bGv6MIq PkC/DTzNLgKkN6wzQJg3pZOnUColIxCfJmLl2WCDOqyCv+uJ7wLj0vIslrnUdGsa2+QLvl 6vnm0u7qTUec9gZGzia5U2lr0KT0X86G9ug/lzsOzOiFdWDGPJU6etw97gTeGk+FkDDwOG nhJsQLDkL//0BNthoSTxzu+0rq0A3H5I7o93Y6j0y1H0nOAfoOu5Qmvsae3v9wfOAenpqq QitAdu6YqNpFh44ypHshe1DfSe2gNPAchNAooFSdbu1U8Y/peNgp5o7FLwQ0aA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783604508; a=rsa-sha256; cv=none; b=cllrm7PqWYkJTqWqh8OT37aeYcTjxYrPTlu5z8UGfhUSaxu7mNSdCWHvOTuenHTA/yfPdm cxJUumEPBeFMLC9aGCV7Z5cgPOiBF/vxl5FXGdYJOW/c/Fv+Hit8yB6s/xQDnUZwvlnTD6 vhlfbf/W2GV6jQm09Yphy/m0fjkzJjF4PmhujfWRruz+R9PFp8ilYqUL27J+ZpyX91T425 OV7Q2LTWqGXfuQZSGyiopsaM3qrQYAjPudkrLuUvX+M2UzBNyJZF8hAUf/RdRTC+icAt5D mKQe46SiRln9grNVveQJJPeU1hnr9vwkaKoWaMgV2FxZ/DJGnmqzIvvRHkTTBw== 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=1783604508; 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=39H7nlf1lHjlp7BzwEMgDwq67iPEqmDNC/jagNrMjCs=; b=f/K5nkk5jEZeQlrAmGrU9Ir9Kfv95NKRjPH7cxK6QD02jhyMqPlYwH1XBb0xd1FHo3DMFi MtqhO3X4AtT+ynG4B0gHgKiQHFXlgq5hOxhSY5qJy4u+NksV5MwFY3p8+5W8M/UARvN9q5 PW943LZ+LkCldWs9uiOc1Bc78Zl3gDuYwormvCvqz6ohekr1U51pbgMbCU4W2n1FGtd5pc K4IlLWDab6tikbZt+xPbJL/V8EPGC58nlWlL/ZwHDV/hw5h9qRkG073YCjH3pEungeJ/yi wxPOXj3HiGB7BUnK9uo0YUV5M42t4sDRfm8ApQMpCfVIdnW9u+Hcf2fKSCKb8w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwx2h3sxGz18jX for ; Thu, 09 Jul 2026 13:41:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1e252 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 09 Jul 2026 13:41:48 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 3e123be2305a - main - inotify: Fix comment typos 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: 3e123be2305a30369f63bcee22ca5e0db527f320 Auto-Submitted: auto-generated Date: Thu, 09 Jul 2026 13:41:48 +0000 Message-Id: <6a4fa51c.1e252.5e17840c@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3e123be2305a30369f63bcee22ca5e0db527f320 commit 3e123be2305a30369f63bcee22ca5e0db527f320 Author: Mark Johnston AuthorDate: 2026-07-08 18:06:00 +0000 Commit: Mark Johnston CommitDate: 2026-07-09 13:41:27 +0000 inotify: Fix comment typos MFC after: 1 week --- sys/kern/vfs_inotify.c | 2 +- sys/sys/inotify.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_inotify.c b/sys/kern/vfs_inotify.c index 9269dc0723af..473ce9358276 100644 --- a/sys/kern/vfs_inotify.c +++ b/sys/kern/vfs_inotify.c @@ -563,7 +563,7 @@ inotify_overflow_event(struct inotify_event *evp) } /* - * Put an event record on the queue for an inotify desscriptor. Return false if + * Put an event record on the queue for an inotify descriptor. Return false if * the record was not enqueued for some reason, true otherwise. */ static bool diff --git a/sys/sys/inotify.h b/sys/sys/inotify.h index d1f23d5898bb..b8b4c67d9be2 100644 --- a/sys/sys/inotify.h +++ b/sys/sys/inotify.h @@ -38,7 +38,7 @@ struct inotify_event { #define IN_MOVE_SELF 0x00000800 #define IN_ALL_EVENTS 0x00000fff -/* Events report only for entries in a watched dir, not the dir itself. */ +/* Events reported only for entries in a watched dir, not the dir itself. */ #define _IN_DIR_EVENTS (IN_CLOSE_WRITE | IN_DELETE | IN_MODIFY | \ IN_MOVED_FROM | IN_MOVED_TO) From nobody Thu Jul 9 13:41:49 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 4gwx2k321qz6lDSK for ; Thu, 09 Jul 2026 13:41:50 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwx2j5mFMz47JY for ; Thu, 09 Jul 2026 13:41:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783604509; 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=z+7YWZ7ZUJqYfFcG3HO9HSr7YI+evP25g6MY6iLHv6s=; b=F760KGJAYJOi1uRiZtI+i0pXeMy87W2p4VB9kCCMyHW4EojN55AEIPW5Qlthbs/mwiIn+3 FmDukRvSMd4LJMJrHVnUdcMxbSuMIqxenU7QVgarkMb9G82mnX2Xu+JUuCvU7AJb5PpTFr TEpShFDf4kZSh1YxWbSrBF8n9DbMayBvAJtiURH18Ih9FG32WmgO+0Am14HByDB2CtUuvD DeXyZ4U1rp1N4aw9W3HX7tS7AxRe8FQYZbinHWMy0Bv1Gyoylsh+oPvi2zj4VXE/PuVqDF 12X3o0Q9ffpjQn3n455KWptJTjp0i/lAhBVb246n8kEgDMwK+3z1z/hHiCZxcQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783604509; a=rsa-sha256; cv=none; b=uEC6D8UEUzhX3oS8JfPJMIh4jviIPfXCVSmUpeL83swV3Rm/CRzmRHIOyAFvL4OJ4Pw+0R wZL3PXElaJqOfcxDc0M/bfjQ1WBJeZwR5ZuYimcpea7PL9ZLIhxrFwFAjgrYG9UkO2qIXg EcaOwHyF2obOXBmk9hNnGcaNJ/cxmQm4HA3sCAtSFB4Im+folt1fKXCKoocEouDtR6Jvoi zbw9qCZu4gTxI6fso5EOWEqVTe/65p0a71/uhIz9rXO/pzhvBsf9mfmUO9ol7POhH1tnE7 wzVRwK1inZclbsLrmX4EzSycjVJcsWDznrnUQAMwCVHattEVycs66WHckio7qQ== 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=1783604509; 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=z+7YWZ7ZUJqYfFcG3HO9HSr7YI+evP25g6MY6iLHv6s=; b=tK6Ycs97EOmLEdBp/8gehYaHxLHQ0c403qVD7ij0Tazp83+Y4yK3sDzGGoeUCbGNsQg4+M Ikns+CLZpXruZfXqzCUtJ5HFjgv6nGfTyZUvJceWrpf6hcUg7yG6gB4dUhqGE4W6swJAYH ym1KKqhN+whdD5T1jUqjWXiUKO31toeBgopMi3b0NOXtLAwzlRC3H1Im4oiNlm+a3vw47q k0btmnlLqet2rHy6MdZg6aPufRoamMRte1EpLMVQlaP61niomTeJvY/6lh+jTyfpYySkI+ jjtuo6l3dyAIHC2jZK8C/v0bTvoHHaGv28L1XKKWkLJ0L6G431/O9SyUoVc6lg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwx2j4jGnz19TK for ; Thu, 09 Jul 2026 13:41:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1fd8f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 09 Jul 2026 13:41:49 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: f370bf9fafce - main - inotify: Ensure that "allocfail" is initialized in inotify_log_one() 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: f370bf9fafce82851bedb2b88bc21ec6ca0182df Auto-Submitted: auto-generated Date: Thu, 09 Jul 2026 13:41:49 +0000 Message-Id: <6a4fa51d.1fd8f.7e167e4f@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f370bf9fafce82851bedb2b88bc21ec6ca0182df commit f370bf9fafce82851bedb2b88bc21ec6ca0182df Author: Mark Johnston AuthorDate: 2026-07-08 19:28:43 +0000 Commit: Mark Johnston CommitDate: 2026-07-09 13:41:27 +0000 inotify: Ensure that "allocfail" is initialized in inotify_log_one() Fixes: b70997c8c75a ("inotify: Unconditionally generate IN_IGNORED events for files/dirs") --- sys/kern/vfs_inotify.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/kern/vfs_inotify.c b/sys/kern/vfs_inotify.c index 473ce9358276..bc8db76d848b 100644 --- a/sys/kern/vfs_inotify.c +++ b/sys/kern/vfs_inotify.c @@ -627,14 +627,13 @@ inotify_log_one(struct inotify_watch *watch, const char *name, size_t namelen, if (!notify && !delete && !unmount) return; + allocfail = false; if (notify || unmount) { rec = inotify_alloc_record(watch->wd, name, namelen, event, cookie, M_NOWAIT); if (rec == NULL) { rec = &sc->overflow; allocfail = true; - } else { - allocfail = false; } } else { rec = NULL; From nobody Thu Jul 9 13:42:03 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 4gwx3059bqz6lDBf for ; Thu, 09 Jul 2026 13:42:04 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwx301tVmz47Z6 for ; Thu, 09 Jul 2026 13:42:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783604524; 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=NyhXL93uFiwglZ+2esI8apSO5shVqzXjhDXX+1+9VPE=; b=LJthXR1bU9I60Cfj53myZVPDugqsxD0eh6Kna28SeemlqmNSGgTwu/6I1g7u3MDPRF62Z5 gytc+hJ7dbgYT/+ptTdgdEJnuo+HIoa/M8EADwTShbND7tfpVJ5W3HUiDh0rXq6YcGKOg3 iMvq4rZRm5AwKZbpopj4BAgC9obPDIbSe7CxhjObvsBQuAMB6pTwyF3wgKPDODvT0zLyPD rugqWcTne6GSonUzwZVlyNXyYBN1E2q6dHOfgSnIXe8+ItxLd2BSejA3ceANWXvr3vzh1i G/GOL2ENcZQqJEjSWOlBNzs9TFTIIGkyuESUfF0P7LccKy353UZovicbJlzWnQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783604524; a=rsa-sha256; cv=none; b=spCK+AX0y/tV/w/uXAAC1Cm0fRbvHgnjHC1eugAeXHxSwdfNJ1YZ+AO0eV+1C8RHR7mM4t CGflH/cPYiapOFNmaNKwyZEV3t22HWOONR7l+e9teviPdeShXocJYmfbf13OwlIC9p63XN 47lJZDVOvYrdQcngM/TUvUcjCDyAojIIGcHekqEfHa5LZa7LaL7P0Vucd6H+pSQkSDCKUS ph82sz5FM/HFEoJXtj/TKfXENsrF8ntIA1/JSwyVn02vgl9GPj+L+QKn0187+yi3RvM8M4 x1+rE4Zv6b+z9Fjt6QyUaSn8jIP0CrvhFzjRfyuA853uuELbC7vyRiVA+ff3ig== 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=1783604524; 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=NyhXL93uFiwglZ+2esI8apSO5shVqzXjhDXX+1+9VPE=; b=C3KWGbK1ijKcv/zkcXoiKnhD60wgxI31PZn9kaFPaBw5Vk+oR1lGDGSnFY7b9XHmZIszof RWrhDfNoOc2S1J0ruCI3JSqx4xjKCKxouxyHfoACrMb9R8uDcdpxZzmu8eqNKvgRrZsNoL 4NEvn1fx+1HSoP2HYTZT7r+z1xHQORS8xRg1Z+rW893vnYLKNrvMwT5BvoKXZNV0rDzg07 kAZXYoyxdSyNvjgUzoUFKuZbjfbIgJ5gsficlsEvmU917gs45XqpiXYwVomD/Vs9bJlHVC xNmQ/K5qfJNAZ7x9pLrBQa8261Tf6Vj34guxrrJGPTBt1pyhP+NP+nbK3kkJvQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwx2z6rBDz19TP for ; Thu, 09 Jul 2026 13:42:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1ecca by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 09 Jul 2026 13:42:03 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 0b95429fde2a - main - usb/quirks: More USB mass storage quirk sorting 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0b95429fde2ae83c159ca991458608a97ca6b93a Auto-Submitted: auto-generated Date: Thu, 09 Jul 2026 13:42:03 +0000 Message-Id: <6a4fa52b.1ecca.14dc9685@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=0b95429fde2ae83c159ca991458608a97ca6b93a commit 0b95429fde2ae83c159ca991458608a97ca6b93a Author: Dag-Erling Smørgrav AuthorDate: 2026-07-09 13:38:53 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-07-09 13:41:56 +0000 usb/quirks: More USB mass storage quirk sorting --- sys/dev/usb/quirk/usb_quirk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/usb/quirk/usb_quirk.c b/sys/dev/usb/quirk/usb_quirk.c index 81694071ec3d..61aa0d845e77 100644 --- a/sys/dev/usb/quirk/usb_quirk.c +++ b/sys/dev/usb/quirk/usb_quirk.c @@ -201,7 +201,6 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = { USB_QUIRK(BALTECH, SMARTCARDREADER, UQ_IGNORE_CDC_CM), /* USB Mass Storage Class Quirks */ - USB_QUIRK_VO(ASAHIOPTICAL, UQ_MSC_NO_RS_CLEAR_UA), USB_QUIRK(ADDON, ATTACHE, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE), USB_QUIRK(ADDON, A256MB, UQ_MSC_FORCE_WIRE_BBB, @@ -219,6 +218,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = { UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), USB_QUIRK(ASAHIOPTICAL, OPTIO330, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), + USB_QUIRK_VO(ASAHIOPTICAL, UQ_MSC_NO_RS_CLEAR_UA), USB_QUIRK(ATP, EUSB, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(BELKIN, USB2SCSI, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(CASIO, QV_DIGICAM, UQ_MSC_FORCE_WIRE_CBI, @@ -277,7 +277,6 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = { USB_QUIRK(INSYSTEM, ATAPI, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_RBC), USB_QUIRK(INSYSTEM, STORAGE_V2, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_RBC), - USB_QUIRK(VIALABS, VL701, UQ_MSC_NO_INQUIRY), USB_QUIRK(IODATA, IU_CD2, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(IODATA, DVR_UEH8, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(IOMEGA, ZIP100, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, @@ -486,6 +485,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = { USB_QUIRK(VIA, USB2IDEBRIDGE, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(VIALABS, USB30SATABRIDGE, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(VIALABS, VL701, UQ_MSC_NO_INQUIRY), USB_QUIRK(VIVITAR, 35XX, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), USB_QUIRK(WESTERN, COMBO, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, From nobody Thu Jul 9 15:41:57 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 4gwzjK3SMZz6kPfw for ; Thu, 09 Jul 2026 15:41: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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gwzjK2nrrz3RLm for ; Thu, 09 Jul 2026 15:41:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783611717; 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=d8c20qha+35GQbsDWrAb55Dj43LbK/fJ2REsP0CwRaM=; b=d31KQdaNn8WJb3+l5F4+PUO3DdhO1vhpz2utlnuxX8NnC0BEAeflXn2xHRX30yQ4K6GxhT ixro5BBKvMsULXBlBMLwusMrXsNA5fJJLa9+4GwNibq84N4+G6atMhek/+1egrj6ryYCEb vpb8GEwIjGuj2UvcV7epfeoKWUD5+shMM9Sa1K2mNX76IcNi6EGP5ZgZ52g2auHEEiDtF6 xhgumfUgVKrP5pBreIZNq8OmUC/a6TmvEqjuU2oHway2iWARn9252ZaT1GeHNDyX00xnXd j7UNWrZDtSLbk3wSesx/w6kaT2cZJQuKPh+QtDDAVjDg4Wd+lqR6PbdqyaO8/Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783611717; a=rsa-sha256; cv=none; b=UkAq3ZEEdG4mXQWpvcIRBRKHMaOugS5Qt+5rf+1DAS/j2wPEZdu3R6jTkC7u4GqPmFgL25 YXyK7RsDhtU2ZHx8p3cY75h9k8L4KoEW+j26wZwWwLRc44GQO91JUJeP+KjTN7e0hZOsiM DhEtfHqIkAn+wvrplMpk8qrvX+W96em0vJ6AsVY+5HZi+cm7HuJQdg1DuZ3HSpmU4AihOj 3qd47vS2Fu4SA9Py1ERGS9m539yAJW66ngwMfhzJVoxRUUsoTz40lqBAL6jHSZ+j8BGs3N WKKNWdegC2OhNj/IAxCCSMJrMLaDB5ynEJHwms0Mq8MGQF87Qx/l94u8oZfsTQ== 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=1783611717; 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=d8c20qha+35GQbsDWrAb55Dj43LbK/fJ2REsP0CwRaM=; b=tppnLHoaP3951IYjc4iVCnQqtwQFayFmuhYElq+p1zezz46GCsJj1zZxd8a72GMTjmXVnK YJYp0mJm7egx3pQ2YSpp/F9gxUptLXbQgN67LvDGyJnVQB30js2V8a9sXOI8OhgjpZlgao gKpgATQLDw6Soy3t48BzXFE5wjVkmy4PG63aN5XR/PuJjIpDAYuL01BknCRm86pRYkGI19 Icp4HIyLtH6agPDf0xjA33sy0THJqJhSJ8shKdepzMW1AIKqahVfYhEB8gVJIvqiU8+KJx vI7MQeMVMeGYhuHRyniG3WiNfDasBftymwAy7jnwpxcpY/VI12iLuf6N2Eu8hw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gwzjK1XrMzbM for ; Thu, 09 Jul 2026 15:41:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3456e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 09 Jul 2026 15:41:57 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 3defe8195684 - main - infiniband/core/ib_addr.c: fix typo 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3defe8195684c3ee4cf5295a58967e3face8dce1 Auto-Submitted: auto-generated Date: Thu, 09 Jul 2026 15:41:57 +0000 Message-Id: <6a4fc145.3456e.20473f62@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3defe8195684c3ee4cf5295a58967e3face8dce1 commit 3defe8195684c3ee4cf5295a58967e3face8dce1 Author: Konstantin Belousov AuthorDate: 2026-07-09 15:09:27 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-09 15:41:50 +0000 infiniband/core/ib_addr.c: fix typo We should exit the net epoch instead of acquiring one more entry. Reported by: Wafa Hamzah Reviewed by: jhb Sponsored by: Nvidia networking Fixes: 4726b80d9379 ("OFED: Various changes from Linux 4.20") Differential revision: https://reviews.freebsd.org/D58127 --- sys/ofed/drivers/infiniband/core/ib_addr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/ofed/drivers/infiniband/core/ib_addr.c b/sys/ofed/drivers/infiniband/core/ib_addr.c index 8a18f7bab1d2..38457f067957 100644 --- a/sys/ofed/drivers/infiniband/core/ib_addr.c +++ b/sys/ofed/drivers/infiniband/core/ib_addr.c @@ -731,7 +731,7 @@ static int addr_resolve(struct sockaddr *src_in, NET_EPOCH_ENTER(et); if (resolve_by_gid_attr) { if (!addr->sgid_attr) { - NET_EPOCH_ENTER(et); + NET_EPOCH_EXIT(et); pr_warn_ratelimited("%s: missing gid_attr\n", __func__); return -EINVAL; } @@ -742,7 +742,7 @@ static int addr_resolve(struct sockaddr *src_in, */ ret = set_addr_netns_by_gid_rcu(addr); if (ret) { - NET_EPOCH_ENTER(et); + NET_EPOCH_EXIT(et); return ret; } } From nobody Thu Jul 9 17:18:07 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 4gx1rJ0p5Vz6kXTr for ; Thu, 09 Jul 2026 17:18:08 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gx1rJ0J1Nz3dsW for ; Thu, 09 Jul 2026 17:18:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783617488; 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=bLBJBuEYDE0wfaknZI+H91ZWhxVUr+tpU4ydK5Rdamw=; b=ZJgumtE37DIU9XuarUZ6KyE+vruYObHYxpl2nKMfbxU3zChwBvwmt8vsXAabM/7EMT7qDc 6OJbt262B0GDzVECTLpIkpMCEIYOjKx7r4nlObL/aLU8ZOKMT5Z59dQgwaq1JRFe0leZR6 EuFAKFKwcLV4yMtAn6L772pHpnRytpMDV16O82ouaAAPX/9bShyXpC2tRfPutBev+/EiYH qH0CxC6Xj8fdJCwn6xqUd3zDNr/eLLgMjMaHPHEuGFDfhi2iTsBRVrSKRAxm3BySKU1ktI wlveyUI6OqeG32OkMuK/alXnJ+jL82Rp3d8+qapKaS6GuyqfKmaRp7xpP6Xmag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783617488; a=rsa-sha256; cv=none; b=diC4v9uQBdCk4j3RwMh0e/nJFd0IXrkBQjVSNJ/F+S/dVt9ic2sGLxCaf0/MPs1ofoBJsC s52BEuK6FySgwWyLVSGjACST1Ia7J/gga5EoyD1Ca5dO/I5aa991abOl99mCOKVEQTh1N+ ilE+7Mlh/twa3nBVB45O1FOyoOj0Sp5xH0H1E7ttJ9SoKDp8dtvr+qkwFli7QFKTmQW0zL rq4bf04ch1vgY0X4128HwNsxpQjuiSouhWvOXWQrxqgQdNeyqoMLGKfHXPk3mmPW0co7to x85RpNaNhrvjBpmfle2AqFBur8bNQ9MB55LFVQnXThk/DRzR9FXtHJ/fDvEvfw== 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=1783617488; 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=bLBJBuEYDE0wfaknZI+H91ZWhxVUr+tpU4ydK5Rdamw=; b=FMxIM7wZZ+nDvNuAJkmufAQeLhR9VmBVeDRXnmwczZqmr18iV0OxVj6uvWilH4BgwsNWo5 petSB/B4efSGWol13bx7kgOtrK8Z5vU+yQNeHYLD+O5XsOyXugMaRgkS+HqV4tpRnHcCHS zyZqGgAE4oPihmJizF4a32Q2FxWeHIAS5ZhhdXC/tjWeRXoOdP3dWqO84SmmqwvgCo/mUH aWEznpjSl3CXEyXx7JqMvByX5k0ya2cNONLwA15v8SyfEUzg43LGxnx63HtIAX6Gc2MgyU nuZ6sLRUPkRCWtOHZhjpTpNnNStdeD3T0WSCpZzux2XSYh43KQ88Fy5qY+JFEQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gx1rH6CQvz332 for ; Thu, 09 Jul 2026 17:18:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3d6f6 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 09 Jul 2026 17:18:07 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: bb5c77e9d281 - main - OpenSSH: Update to 10.4p1 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bb5c77e9d281d6def6835d48249898764bc6a5fe Auto-Submitted: auto-generated Date: Thu, 09 Jul 2026 17:18:07 +0000 Message-Id: <6a4fd7cf.3d6f6.257b6b48@gitrepo.freebsd.org> The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=bb5c77e9d281d6def6835d48249898764bc6a5fe commit bb5c77e9d281d6def6835d48249898764bc6a5fe Merge: 3defe8195684 3838aee84536 Author: Ed Maste AuthorDate: 2026-07-09 17:17:11 +0000 Commit: Ed Maste CommitDate: 2026-07-09 17:17:11 +0000 OpenSSH: Update to 10.4p1 Full release notes are available at https://www.openssh.com/txt/release-10.4 Selected highlights from the release notes: Potentially-incompatible changes -------------------------------- * sshd(8): configuration dump mode ("sshd -G") now writes directives in mixed case (e.g. "PubkeyAuthentication") whereas previously it emitted only lower-case names. * ssh(1), sshd(8): make the transport protocol stricter by disconnecting if the peer sends non-KEX messages during a post- authentication key re-exchange. Previously a malicious peer could continue sending non-key exchange messages without penalty. These would be buffered, causing memory to be wasted up until the connection terminated or the server/client hit a memory limit. Implementations that do not restrict messages sent during key exchange as per RFC4253 section 7.1 may be disconnected. Reported by Marko Jevtic. Changes since OpenSSH 10.3 ========================== This release contains a number of security fixes as well as general bugfixes and a couple of new features. Security ======== * sftp(1): when downloading files on the command-line using "sftp host:/path .", a malicious server could cause the file to be downloaded to an unexpected location. This issue was identified by the Swival Security Scanner. * scp(1): when copying files between two remote destinations, do not allow a malicious server to write files to the parent directory of the intended target directory. This issue was identified by the Swival Security Scanner. * sshd(8): DisableForwarding=yes didn't override PermitTunnel=yes as it was documented to do. Note that PermitTunnel is not enabled by default. Reported independently by Huzaifa Sidhpurwala of Redhat and Marko Jevtic. * sshd(8): avoid a potential pre-authentication denial of service when GSSAPIAuthentication was enabled (this feature is off by default). This was not mitigated by MaxAuthTries, but would be penalised by PerSourcePenalties. This was reported by Manfred Kaiser of the milCERT AT (Austrian Ministry of Defence). * sshd(8): fix a number of cases where the minimum authentication delay was not being enforced. Reported by the Orange Cyberdefense Vulnerability Team. * ssh(1): fix a possible client-side use-after-free if the server changes its host key during a key reexchange. This was reported by Zhenpeng (Leo) Lin of Depthfirst. New features ------------ * All: add experimental support for a composite post-quantum signature scheme that combines ML-DSA 44 and Ed25519 as specified in draft-miller-sshm-mldsa44-ed25519-composite-sigs. This scheme is not enabled by default. To use it, you'll need to add it to HostKeyAlgorithms, PubkeyAcceptedAlgorithms, etc. Keys may be generated using "ssh-keygen -t mldsa44-ed25519". Bugfixes -------- * sshd(8): avoid sending observably different messages for valid vs invalid users in GSSAPIAuthentication (disabled by default). * ssh(1), sshd(8): fix several bugs that incorrectly classified bulk traffic as interactive. bz3972, bz3958 * ssh-keygen(1), ssh-add(1): skip unsupported key types when downloading resident keys from a FIDO token. Previously, downloads would abort when one was encountered. GHPR657 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D58083 crypto/openssh/.depend | 4 +- crypto/openssh/.git_allowed_signers.asc | 26 +- crypto/openssh/.github/ci-status.md | 12 +- crypto/openssh/.github/configs | 7 +- crypto/openssh/.github/install_dropbear.sh | 35 + crypto/openssh/.github/install_libcrypto.sh | 2 +- crypto/openssh/.github/pin_actions.sh | 35 + crypto/openssh/.github/run_test.sh | 24 +- crypto/openssh/.github/setup_ci.sh | 167 +- crypto/openssh/.github/workflows/c-cpp.yml | 42 +- crypto/openssh/.github/workflows/cifuzz.yml | 6 +- crypto/openssh/.github/workflows/selfhosted.yml | 10 +- crypto/openssh/.github/workflows/upstream.yml | 20 +- crypto/openssh/.github/workflows/vm.yml | 155 +- crypto/openssh/.skipped-commit-ids | 2 + crypto/openssh/ChangeLog | 14820 +++++----- crypto/openssh/Makefile.in | 42 + crypto/openssh/PROTOCOL.agent | 4 +- crypto/openssh/README | 2 +- crypto/openssh/README.privsep | 184 +- crypto/openssh/auth.h | 3 +- crypto/openssh/auth2-chall.c | 6 +- crypto/openssh/auth2-gss.c | 62 +- crypto/openssh/auth2.c | 12 +- crypto/openssh/authfd.c | 8 +- crypto/openssh/authfile.c | 9 +- crypto/openssh/chacha.c | 6 +- crypto/openssh/channels.c | 17 +- crypto/openssh/channels.h | 5 +- crypto/openssh/cipher.c | 44 +- crypto/openssh/cipher.h | 4 +- crypto/openssh/clientloop.c | 26 +- crypto/openssh/config.h | 13 +- crypto/openssh/configure.ac | 39 +- crypto/openssh/contrib/redhat/openssh.spec | 2 +- crypto/openssh/contrib/suse/openssh.spec | 2 +- crypto/openssh/crypto_api.h | 127 +- crypto/openssh/defines.h | 16 +- crypto/openssh/ed25519-openssl.c | 38 +- crypto/openssh/ed25519.c | 36 +- crypto/openssh/ed25519.sh | 74 +- crypto/openssh/kex.c | 9 +- crypto/openssh/kex.h | 3 +- crypto/openssh/kexmlkem768x25519.c | 100 +- crypto/openssh/libcrux-mlkem-mldsa.c | 430 + crypto/openssh/libcrux_internal.h | 27332 +++++++++++++++++++ crypto/openssh/libcrux_mlkem768_sha3.h | 11752 -------- crypto/openssh/mac.c | 8 +- crypto/openssh/match.c | 137 +- crypto/openssh/misc.c | 8 +- crypto/openssh/mlkem768.sh | 219 - crypto/openssh/mlkem_mldsa.sh | 341 + crypto/openssh/moduli | 1124 +- crypto/openssh/monitor.c | 58 +- crypto/openssh/monitor_wrap.c | 84 +- crypto/openssh/monitor_wrap.h | 6 +- crypto/openssh/openbsd-compat/bsd-cygwin_util.c | 6 +- crypto/openssh/openbsd-compat/bsd-misc.c | 2 +- crypto/openssh/openbsd-compat/fake-rfc2553.c | 3 +- crypto/openssh/openbsd-compat/fmt_scaled.c | 39 +- .../openssh/openbsd-compat/getrrsetbyname-ldns.c | 3 +- crypto/openssh/openbsd-compat/getrrsetbyname.c | 23 +- crypto/openssh/openbsd-compat/vis.c | 2 + crypto/openssh/packet.c | 35 +- crypto/openssh/pathnames.h | 4 +- crypto/openssh/readconf.c | 6 +- crypto/openssh/regress/Makefile | 3 + crypto/openssh/regress/addrmatch.sh | 4 +- crypto/openssh/regress/agent.sh | 21 +- crypto/openssh/regress/cert-hostkey.sh | 15 +- crypto/openssh/regress/cert-userkey.sh | 16 +- crypto/openssh/regress/cfgmatch.sh | 4 +- crypto/openssh/regress/dropbear-kex.sh | 10 +- crypto/openssh/regress/dropbear-server.sh | 202 +- crypto/openssh/regress/hostkey-agent.sh | 8 +- crypto/openssh/regress/kbdint.sh | 4 +- crypto/openssh/regress/keyscan.sh | 6 +- crypto/openssh/regress/keytype.sh | 8 +- crypto/openssh/regress/knownhosts-command.sh | 5 +- .../ssh-verify-attestation.c | 4 +- crypto/openssh/regress/sshsig.sh | 8 +- crypto/openssh/regress/test-exec.sh | 8 + crypto/openssh/regress/unittests/Makefile | 4 +- crypto/openssh/regress/unittests/Makefile.inc | 3 +- crypto/openssh/regress/unittests/authopt/Makefile | 4 +- crypto/openssh/regress/unittests/crypto/Makefile | 26 + .../regress/unittests/crypto/test_ed25519.c | 99 + .../openssh/regress/unittests/crypto/test_mldsa.c | 140 + .../regress/unittests/crypto/test_mldsa_eddsa.c | 197 + .../openssh/regress/unittests/crypto/test_mlkem.c | 164 + .../draft-ietf-lamps-pq-composite-sigs.json | 8 + .../unittests/crypto/testdata/nistkats-44.json | 802 + crypto/openssh/regress/unittests/crypto/tests.c | 123 + crypto/openssh/regress/unittests/hostkeys/Makefile | 4 +- crypto/openssh/regress/unittests/kex/Makefile | 3 +- crypto/openssh/regress/unittests/match/tests.c | 202 +- crypto/openssh/regress/unittests/servconf/Makefile | 26 + crypto/openssh/regress/unittests/servconf/tests.c | 364 + crypto/openssh/regress/unittests/sshkey/Makefile | 4 +- .../openssh/regress/unittests/sshkey/mktestdata.sh | 22 +- .../openssh/regress/unittests/sshkey/test_file.c | 67 +- .../openssh/regress/unittests/sshkey/test_fuzz.c | 58 +- .../openssh/regress/unittests/sshkey/test_sshkey.c | 111 +- .../unittests/sshkey/testdata/mldsa44_ed25519_1 | 58 + .../sshkey/testdata/mldsa44_ed25519_1-cert.fp | 1 + .../sshkey/testdata/mldsa44_ed25519_1-cert.pub | 1 + .../unittests/sshkey/testdata/mldsa44_ed25519_1.fp | 1 + .../sshkey/testdata/mldsa44_ed25519_1.fp.bb | 1 + .../sshkey/testdata/mldsa44_ed25519_1.pub | 1 + .../unittests/sshkey/testdata/mldsa44_ed25519_1_pw | 59 + .../unittests/sshkey/testdata/mldsa44_ed25519_2 | 58 + .../unittests/sshkey/testdata/mldsa44_ed25519_2.fp | 1 + .../sshkey/testdata/mldsa44_ed25519_2.fp.bb | 1 + .../sshkey/testdata/mldsa44_ed25519_2.pub | 1 + crypto/openssh/regress/unittests/sshkey/tests.c | 2 +- crypto/openssh/regress/unittests/sshsig/Makefile | 4 +- .../openssh/regress/unittests/sshsig/mktestdata.sh | 9 +- .../unittests/sshsig/testdata/mldsa44-ed25519 | 58 + .../unittests/sshsig/testdata/mldsa44-ed25519.pub | 1 + .../unittests/sshsig/testdata/mldsa44-ed25519.sig | 78 + crypto/openssh/regress/unittests/sshsig/tests.c | 9 +- .../regress/unittests/test_helper/test_helper.c | 18 +- .../regress/unittests/test_helper/test_helper.h | 4 +- crypto/openssh/sandbox-seccomp-filter.c | 17 +- crypto/openssh/scp.c | 8 +- crypto/openssh/servconf.c | 1995 +- crypto/openssh/servconf.h | 483 +- crypto/openssh/serverloop.c | 4 +- crypto/openssh/session.c | 70 +- crypto/openssh/sftp-client.c | 16 +- crypto/openssh/sftp-server.8 | 15 +- crypto/openssh/sftp-server.c | 43 +- crypto/openssh/sftp.c | 40 +- crypto/openssh/sk-usbhid.c | 31 +- crypto/openssh/ssh-add.c | 33 +- crypto/openssh/ssh-agent.1 | 8 +- crypto/openssh/ssh-agent.c | 42 +- crypto/openssh/ssh-keygen.1 | 16 +- crypto/openssh/ssh-keygen.c | 12 +- crypto/openssh/ssh-keyscan.1 | 13 +- crypto/openssh/ssh-keyscan.c | 15 +- crypto/openssh/ssh-keysign.c | 3 +- crypto/openssh/ssh-mldsa-eddsa.c | 506 + crypto/openssh/ssh.1 | 9 +- crypto/openssh/ssh.c | 32 +- crypto/openssh/ssh_config.5 | 96 +- crypto/openssh/ssh_namespace.h | 64 +- crypto/openssh/sshbuf-io.c | 7 +- crypto/openssh/sshbuf.h | 3 +- crypto/openssh/sshconnect.c | 50 +- crypto/openssh/sshconnect.h | 9 +- crypto/openssh/sshconnect2.c | 25 +- crypto/openssh/sshd-auth.c | 60 +- crypto/openssh/sshd-session.c | 3 +- crypto/openssh/sshd.c | 6 +- crypto/openssh/sshd_config | 2 +- crypto/openssh/sshd_config.5 | 14 +- crypto/openssh/ssherr-libcrypto.c | 4 +- crypto/openssh/ssherr.c | 4 +- crypto/openssh/ssherr.h | 4 +- crypto/openssh/sshkey.c | 22 +- crypto/openssh/sshkey.h | 7 +- crypto/openssh/version.h | 6 +- secure/lib/libssh/Makefile | 1 + 164 files changed, 43368 insertions(+), 21435 deletions(-) diff --cc crypto/openssh/.github/install_dropbear.sh index 000000000000,ed91c52f7cdb..ed91c52f7cdb mode 000000,100755..100755 --- a/crypto/openssh/.github/install_dropbear.sh +++ b/crypto/openssh/.github/install_dropbear.sh diff --cc crypto/openssh/.github/pin_actions.sh index 000000000000,8b64e823827e..8b64e823827e mode 000000,100755..100755 --- a/crypto/openssh/.github/pin_actions.sh +++ b/crypto/openssh/.github/pin_actions.sh diff --cc crypto/openssh/config.h index b922734d01b3,000000000000..80f0b4055c10 mode 100644,000000..100644 --- a/crypto/openssh/config.h +++ b/crypto/openssh/config.h @@@ -1,2121 -1,0 +1,2128 @@@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Define if you have a getaddrinfo that fails for the all-zeros IPv6 address + */ +/* #undef AIX_GETNAMEINFO_HACK */ + +/* Define if your AIX loginfailed() function takes 4 arguments (AIX >= 5.2) */ +/* #undef AIX_LOGINFAILED_4ARG */ + +/* System only supports IPv4 audit records */ +/* #undef AU_IPv4 */ + +/* Define if your resolver libs need this for getrrsetbyname */ +/* #undef BIND_8_COMPAT */ + +/* The system has incomplete BSM API */ +/* #undef BROKEN_BSM_API */ + +/* broken in chroots on older kernels */ +/* #undef BROKEN_CLOSEFROM */ + +/* Define if cmsg_type is not passed correctly */ +/* #undef BROKEN_CMSG_TYPE */ + +/* getaddrinfo is broken (if present) */ +/* #undef BROKEN_GETADDRINFO */ + +/* getgroups(0,NULL) will return -1 */ +/* #undef BROKEN_GETGROUPS */ + +/* getline is not what we expect */ +/* #undef BROKEN_GETLINE */ + +/* Do not use system glob */ +#define BROKEN_GLOB 1 + +/* Define if you system's inet_ntoa is busted (e.g. Irix gcc issue) */ +/* #undef BROKEN_INET_NTOA */ + +/* Define if your struct dirent expects you to allocate extra space for d_name + */ +/* #undef BROKEN_ONE_BYTE_DIRENT_D_NAME */ + +/* System poll(2) implementation is broken */ +/* #undef BROKEN_POLL */ + +/* Can't do comparisons on readv */ +/* #undef BROKEN_READV_COMPARISON */ + +/* NetBSD read function is sometimes redirected, breaking atomicio comparisons + against it */ +/* #undef BROKEN_READ_COMPARISON */ + +/* Needed for NeXT */ +/* #undef BROKEN_SAVED_UIDS */ + +/* Define if your setregid() is broken */ +/* #undef BROKEN_SETREGID */ + +/* Define if your setresgid() is broken */ +/* #undef BROKEN_SETRESGID */ + +/* Define if your setresuid() is broken */ +/* #undef BROKEN_SETRESUID */ + +/* Define if your setreuid() is broken */ +/* #undef BROKEN_SETREUID */ + +/* LynxOS has broken setvbuf() implementation */ +/* #undef BROKEN_SETVBUF */ + +/* QNX shadow support is broken */ +/* #undef BROKEN_SHADOW_EXPIRE */ + +/* Define if your snprintf is busted */ +/* #undef BROKEN_SNPRINTF */ + +/* strndup broken, see APAR IY61211 */ +/* #undef BROKEN_STRNDUP */ + +/* strnlen broken, see APAR IY62551 */ +/* #undef BROKEN_STRNLEN */ + +/* strnvis detected broken */ +#define BROKEN_STRNVIS 1 + +/* tcgetattr with ICANON may hang */ +/* #undef BROKEN_TCGETATTR_ICANON */ + +/* updwtmpx is broken (if present) */ +/* #undef BROKEN_UPDWTMPX */ + +/* Define if you have BSD auth support */ +/* #undef BSD_AUTH */ + +/* Define if you want to specify the path to your lastlog file */ +/* #undef CONF_LASTLOG_FILE */ + +/* Define if you want to specify the path to your utmp file */ +/* #undef CONF_UTMP_FILE */ + +/* Define if you want to specify the path to your wtmpx file */ +/* #undef CONF_WTMPX_FILE */ + +/* Define if you want to specify the path to your wtmp file */ +/* #undef CONF_WTMP_FILE */ + +/* Need to call setpgrp as root */ +/* #undef DISABLE_FD_PASSING */ + +/* Define if you don't want to use lastlog */ +/* #undef DISABLE_LASTLOG */ + +/* Define if you don't want to use your system's login() call */ +/* #undef DISABLE_LOGIN */ + +/* Define if you don't want to use pututline() etc. to write [uw]tmp */ +/* #undef DISABLE_PUTUTLINE */ + +/* Define if you don't want to use pututxline() etc. to write [uw]tmpx */ +/* #undef DISABLE_PUTUTXLINE */ + +/* Define if you want to disable shadow passwords */ +/* #undef DISABLE_SHADOW */ + +/* Define if you don't want to use utmp */ +#define DISABLE_UTMP 1 + +/* Define if you don't want to use utmpx */ +/* #undef DISABLE_UTMPX */ + +/* Define if you don't want to use wtmp */ +#define DISABLE_WTMP 1 + +/* Define if you don't want to use wtmpx */ +#define DISABLE_WTMPX 1 + +/* Enable for PKCS#11 support */ +#define ENABLE_PKCS11 /**/ + +/* Enable for U2F/FIDO support */ +#define ENABLE_SK /**/ + +/* Enable for built-in U2F/FIDO support */ +/* #undef ENABLE_SK_INTERNAL */ + +/* define if fflush(NULL) does not work */ +/* #undef FFLUSH_NULL_BUG */ + +/* File names may not contain backslash characters */ +/* #undef FILESYSTEM_NO_BACKSLASH */ + +/* fsid_t has member val */ +/* #undef FSID_HAS_VAL */ + +/* fsid_t has member __val */ +/* #undef FSID_HAS___VAL */ + +/* getpgrp takes one arg */ +#define GETPGRP_VOID 1 + +/* Conflicting defs for getspnam */ +/* #undef GETSPNAM_CONFLICTING_DEFS */ + +/* Define if your system glob() function has the GLOB_ALTDIRFUNC extension */ +#define GLOB_HAS_ALTDIRFUNC 1 + +/* Define if your system glob() function has gl_matchc options in glob_t */ +#define GLOB_HAS_GL_MATCHC 1 + +/* Define if your system glob() function has gl_statv options in glob_t */ +/* #undef GLOB_HAS_GL_STATV */ + +/* Define this if you want GSSAPI support in the version 2 protocol */ +/* #undef GSSAPI */ + +/* Define if you want to use shadow password expire field */ +/* #undef HAS_SHADOW_EXPIRE */ + +/* Define if your system uses access rights style file descriptor passing */ +/* #undef HAVE_ACCRIGHTS_IN_MSGHDR */ + +/* Define if you have ut_addr in utmp.h */ +/* #undef HAVE_ADDR_IN_UTMP */ + +/* Define if you have ut_addr in utmpx.h */ +/* #undef HAVE_ADDR_IN_UTMPX */ + +/* Define if you have ut_addr_v6 in utmp.h */ +/* #undef HAVE_ADDR_V6_IN_UTMP */ + +/* Define if you have ut_addr_v6 in utmpx.h */ +/* #undef HAVE_ADDR_V6_IN_UTMPX */ + +/* Define to 1 if you have the 'arc4random' function. */ +#define HAVE_ARC4RANDOM 1 + +/* Define to 1 if you have the 'arc4random_buf' function. */ +#define HAVE_ARC4RANDOM_BUF 1 + +/* Define to 1 if you have the 'arc4random_stir' function. */ +/* #undef HAVE_ARC4RANDOM_STIR */ + +/* Define to 1 if you have the 'arc4random_uniform' function. */ +#define HAVE_ARC4RANDOM_UNIFORM 1 + +/* Define to 1 if you have the 'asprintf' function. */ +#define HAVE_ASPRINTF 1 + +/* OpenBSD's gcc has bounded */ +/* #undef HAVE_ATTRIBUTE__BOUNDED__ */ + +/* Have attribute nonnull */ +#define HAVE_ATTRIBUTE__NONNULL__ 1 + +/* compiler supports nonstring attribute */ +#define HAVE_ATTRIBUTE__NONSTRING__ 1 + +/* OpenBSD's gcc has sentinel */ +/* #undef HAVE_ATTRIBUTE__SENTINEL__ */ + +/* Define to 1 if you have the 'aug_get_machine' function. */ +/* #undef HAVE_AUG_GET_MACHINE */ + +/* Define to 1 if you have the 'auth_hostok' function. */ +#define HAVE_AUTH_HOSTOK 1 + +/* Define to 1 if you have the 'auth_timeok' function. */ +#define HAVE_AUTH_TIMEOK 1 + +/* Define to 1 if you have the 'b64_ntop' function. */ +/* #undef HAVE_B64_NTOP */ + +/* Define to 1 if you have the 'b64_pton' function. */ +/* #undef HAVE_B64_PTON */ + +/* Define if you have the basename function. */ +#define HAVE_BASENAME 1 + +/* Define to 1 if you have the 'bcopy' function. */ +#define HAVE_BCOPY 1 + +/* Define to 1 if you have the 'bcrypt_pbkdf' function. */ +/* #undef HAVE_BCRYPT_PBKDF */ + +/* Define to 1 if you have the 'bindresvport_sa' function. */ +#define HAVE_BINDRESVPORT_SA 1 + +/* Define to 1 if you have the 'blf_enc' function. */ +/* #undef HAVE_BLF_ENC */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BLF_H */ + +/* Define to 1 if you have the 'Blowfish_expand0state' function. */ +/* #undef HAVE_BLOWFISH_EXPAND0STATE */ + +/* Define to 1 if you have the 'Blowfish_expandstate' function. */ +/* #undef HAVE_BLOWFISH_EXPANDSTATE */ + +/* Define to 1 if you have the 'Blowfish_initstate' function. */ +/* #undef HAVE_BLOWFISH_INITSTATE */ + +/* Define to 1 if you have the 'Blowfish_stream2word' function. */ +/* #undef HAVE_BLOWFISH_STREAM2WORD */ + +/* Define to 1 if you have the 'BN_is_prime_ex' function. */ +#define HAVE_BN_IS_PRIME_EX 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BSD_LIBUTIL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BSM_AUDIT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BSTRING_H */ + +/* Define to 1 if you have the 'bzero' function. */ +#define HAVE_BZERO 1 + +/* calloc(0, x) returns NULL */ +#define HAVE_CALLOC 1 + +/* Define if you have caph_cache_tzdata */ +#define HAVE_CAPH_CACHE_TZDATA 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_CAPSICUM_HELPERS_H 1 + +/* Define to 1 if you have the 'cap_rights_limit' function. */ +#define HAVE_CAP_RIGHTS_LIMIT 1 + +/* Define to 1 if you have the 'clock' function. */ +#define HAVE_CLOCK 1 + +/* Have clock_gettime */ +#define HAVE_CLOCK_GETTIME 1 + +/* define if you have clock_t data type */ +#define HAVE_CLOCK_T 1 + +/* Define to 1 if you have the 'closefrom' function. */ +#define HAVE_CLOSEFROM 1 + +/* Define to 1 if you have the 'close_range' function. */ +#define HAVE_CLOSE_RANGE 1 + +/* Define if gai_strerror() returns const char * */ +#define HAVE_CONST_GAI_STRERROR_PROTO 1 + +/* Define if your system uses ancillary data style file descriptor passing */ +#define HAVE_CONTROL_IN_MSGHDR 1 + +/* Define to 1 if you have the 'crypt' function. */ +#define HAVE_CRYPT 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CRYPTO_SHA2_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CRYPT_H */ + +/* Define if you are on Cygwin */ +/* #undef HAVE_CYGWIN */ + +/* Define if your libraries define daemon() */ +#define HAVE_DAEMON 1 + +/* Define to 1 if you have the declaration of 'AI_NUMERICSERV', and to 0 if + you don't. */ +#define HAVE_DECL_AI_NUMERICSERV 1 + +/* Define to 1 if you have the declaration of 'authenticate', and to 0 if you + don't. */ +/* #undef HAVE_DECL_AUTHENTICATE */ + +/* Define to 1 if you have the declaration of 'bzero', and to 0 if you don't. + */ +#define HAVE_DECL_BZERO 1 + +/* Define to 1 if you have the declaration of 'ftruncate', and to 0 if you + don't. */ +#define HAVE_DECL_FTRUNCATE 1 + +/* Define to 1 if you have the declaration of 'getentropy', and to 0 if you + don't. */ +#define HAVE_DECL_GETENTROPY 1 + +/* Define to 1 if you have the declaration of 'getpeereid', and to 0 if you + don't. */ +#define HAVE_DECL_GETPEEREID 1 + +/* Define to 1 if you have the declaration of 'GLOB_NOMATCH', and to 0 if you + don't. */ +#define HAVE_DECL_GLOB_NOMATCH 1 + +/* Define to 1 if you have the declaration of 'GSS_C_NT_HOSTBASED_SERVICE', + and to 0 if you don't. */ +/* #undef HAVE_DECL_GSS_C_NT_HOSTBASED_SERVICE */ + +/* Define to 1 if you have the declaration of 'howmany', and to 0 if you + don't. */ +#define HAVE_DECL_HOWMANY 1 + ++/* Define to 1 if you have the declaration of 'htobe32', and to 0 if you ++ don't. */ ++#define HAVE_DECL_HTOBE32 1 ++ +/* Define to 1 if you have the declaration of 'htole64', and to 0 if you + don't. */ +#define HAVE_DECL_HTOLE64 1 + +/* Define to 1 if you have the declaration of 'h_errno', and to 0 if you + don't. */ +#define HAVE_DECL_H_ERRNO 1 + +/* Define to 1 if you have the declaration of 'INFINITY', and to 0 if you + don't. */ +#define HAVE_DECL_INFINITY 1 + +/* Define to 1 if you have the declaration of 'le32toh', and to 0 if you + don't. */ +#define HAVE_DECL_LE32TOH 1 + +/* Define to 1 if you have the declaration of 'le64toh', and to 0 if you + don't. */ +#define HAVE_DECL_LE64TOH 1 + +/* Define to 1 if you have the declaration of 'loginfailed', and to 0 if you + don't. */ +/* #undef HAVE_DECL_LOGINFAILED */ + +/* Define to 1 if you have the declaration of 'loginrestrictions', and to 0 if + you don't. */ +/* #undef HAVE_DECL_LOGINRESTRICTIONS */ + +/* Define to 1 if you have the declaration of 'loginsuccess', and to 0 if you + don't. */ +/* #undef HAVE_DECL_LOGINSUCCESS */ + +/* Define to 1 if you have the declaration of 'MAXSYMLINKS', and to 0 if you + don't. */ +#define HAVE_DECL_MAXSYMLINKS 1 + +/* Define to 1 if you have the declaration of 'memmem', and to 0 if you don't. + */ +#define HAVE_DECL_MEMMEM 1 + +/* Define to 1 if you have the declaration of 'NFDBITS', and to 0 if you + don't. */ +#define HAVE_DECL_NFDBITS 1 + +/* Define to 1 if you have the declaration of 'offsetof', and to 0 if you + don't. */ +#define HAVE_DECL_OFFSETOF 1 + +/* Define to 1 if you have the declaration of 'O_NONBLOCK', and to 0 if you + don't. */ +#define HAVE_DECL_O_NONBLOCK 1 + +/* Define to 1 if you have the declaration of 'passwdexpired', and to 0 if you + don't. */ +/* #undef HAVE_DECL_PASSWDEXPIRED */ + +/* Define to 1 if you have the declaration of 'readv', and to 0 if you don't. + */ +#define HAVE_DECL_READV 1 + +/* Define to 1 if you have the declaration of 'setauthdb', and to 0 if you + don't. */ +/* #undef HAVE_DECL_SETAUTHDB */ + +/* Define to 1 if you have the declaration of 'SHUT_RD', and to 0 if you + don't. */ +#define HAVE_DECL_SHUT_RD 1 + +/* Define to 1 if you have the declaration of 'UINT32_MAX', and to 0 if you + don't. */ +#define HAVE_DECL_UINT32_MAX 1 + +/* Define to 1 if you have the declaration of 'writev', and to 0 if you don't. + */ +#define HAVE_DECL_WRITEV 1 + +/* Define to 1 if you have the declaration of '_getlong', and to 0 if you + don't. */ +#define HAVE_DECL__GETLONG 0 + +/* Define to 1 if you have the declaration of '_getshort', and to 0 if you + don't. */ +#define HAVE_DECL__GETSHORT 0 + +/* Define to 1 if you have the declaration of '__builtin_inff', and to 0 if + you don't. */ +/* #undef HAVE_DECL___BUILTIN_INFF */ + +/* Define to 1 if you have the 'DES_crypt' function. */ +#define HAVE_DES_CRYPT 1 + +/* Define if you have /dev/ptmx */ +/* #undef HAVE_DEV_PTMX */ + +/* Define if you have /dev/ptc */ +/* #undef HAVE_DEV_PTS_AND_PTC */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you have the 'dirfd' function. */ +#define HAVE_DIRFD 1 + +/* Define to 1 if you have the 'dirname' function. */ +#define HAVE_DIRNAME 1 + +/* Define to 1 if you have the 'dlopen' function. */ +#define HAVE_DLOPEN 1 + +/* Define to 1 if you have the 'EC_KEY_METHOD_new' function. */ +#define HAVE_EC_KEY_METHOD_NEW 1 + +/* Define to 1 if you have the 'EC_POINT_get_affine_coordinates' function. */ +#define HAVE_EC_POINT_GET_AFFINE_COORDINATES 1 + +/* Define to 1 if you have the 'EC_POINT_get_affine_coordinates_GFp' function. + */ +#define HAVE_EC_POINT_GET_AFFINE_COORDINATES_GFP 1 + +/* Define to 1 if you have the 'EC_POINT_set_affine_coordinates' function. */ +#define HAVE_EC_POINT_SET_AFFINE_COORDINATES 1 + +/* Define to 1 if you have the 'EC_POINT_set_affine_coordinates_GFp' function. + */ +#define HAVE_EC_POINT_SET_AFFINE_COORDINATES_GFP 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ELF_H 1 + +/* Define to 1 if you have the 'endgrent' function. */ +#define HAVE_ENDGRENT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ENDIAN_H 1 + +/* Define to 1 if you have the 'endutent' function. */ +/* #undef HAVE_ENDUTENT */ + +/* Define to 1 if you have the 'endutxent' function. */ +#define HAVE_ENDUTXENT 1 + +/* Define to 1 if you have the 'err' function. */ +#define HAVE_ERR 1 + +/* Define to 1 if you have the 'errx' function. */ +#define HAVE_ERRX 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERR_H 1 + +/* Define if your system has /etc/default/login */ +/* #undef HAVE_ETC_DEFAULT_LOGIN */ + +/* Define to 1 if you have the 'EVP_chacha20' function. */ +#define HAVE_EVP_CHACHA20 1 + +/* Define to 1 if you have the 'EVP_CIPHER_CTX_get_iv' function. */ +/* #undef HAVE_EVP_CIPHER_CTX_GET_IV */ + +/* Define to 1 if you have the 'EVP_CIPHER_CTX_get_updated_iv' function. */ +#define HAVE_EVP_CIPHER_CTX_GET_UPDATED_IV 1 + +/* Define to 1 if you have the 'EVP_CIPHER_CTX_iv' function. */ +#define HAVE_EVP_CIPHER_CTX_IV 1 + +/* Define to 1 if you have the 'EVP_CIPHER_CTX_iv_noconst' function. */ +#define HAVE_EVP_CIPHER_CTX_IV_NOCONST 1 + +/* Define to 1 if you have the 'EVP_CIPHER_CTX_set_iv' function. */ +/* #undef HAVE_EVP_CIPHER_CTX_SET_IV */ + +/* Define to 1 if you have the 'EVP_DigestFinal_ex' function. */ +#define HAVE_EVP_DIGESTFINAL_EX 1 + +/* Define to 1 if you have the 'EVP_DigestInit_ex' function. */ +#define HAVE_EVP_DIGESTINIT_EX 1 + +/* Define to 1 if you have the 'EVP_DigestSign' function. */ +#define HAVE_EVP_DIGESTSIGN 1 + +/* Define to 1 if you have the 'EVP_DigestVerify' function. */ +#define HAVE_EVP_DIGESTVERIFY 1 + +/* Define to 1 if you have the 'EVP_MD_CTX_cleanup' function. */ +/* #undef HAVE_EVP_MD_CTX_CLEANUP */ + +/* Define to 1 if you have the 'EVP_MD_CTX_copy_ex' function. */ +#define HAVE_EVP_MD_CTX_COPY_EX 1 + +/* Define to 1 if you have the 'EVP_MD_CTX_init' function. */ +/* #undef HAVE_EVP_MD_CTX_INIT */ + +/* Define to 1 if you have the 'EVP_PKEY_get_raw_private_key' function. */ +#define HAVE_EVP_PKEY_GET_RAW_PRIVATE_KEY 1 + +/* Define to 1 if you have the 'EVP_PKEY_get_raw_public_key' function. */ +#define HAVE_EVP_PKEY_GET_RAW_PUBLIC_KEY 1 + +/* Define to 1 if you have the 'EVP_sha256' function. */ +#define HAVE_EVP_SHA256 1 + +/* Define to 1 if you have the 'EVP_sha384' function. */ +#define HAVE_EVP_SHA384 1 + +/* Define to 1 if you have the 'EVP_sha512' function. */ +#define HAVE_EVP_SHA512 1 + +/* Define if you have ut_exit in utmp.h */ +/* #undef HAVE_EXIT_IN_UTMP */ + +/* Define to 1 if you have the 'explicit_bzero' function. */ +#define HAVE_EXPLICIT_BZERO 1 + +/* Define to 1 if you have the 'explicit_memset' function. */ +/* #undef HAVE_EXPLICIT_MEMSET */ + +/* Define to 1 if you have the 'fchmod' function. */ +#define HAVE_FCHMOD 1 + +/* Define to 1 if you have the 'fchmodat' function. */ +#define HAVE_FCHMODAT 1 + +/* Define to 1 if you have the 'fchown' function. */ +#define HAVE_FCHOWN 1 + +/* Define to 1 if you have the 'fchownat' function. */ +#define HAVE_FCHOWNAT 1 + +/* Use F_CLOSEM fcntl for closefrom */ +/* #undef HAVE_FCNTL_CLOSEM */ + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if the system has the type 'fd_mask'. */ +#define HAVE_FD_MASK 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_FEATURES_H */ + +/* Define to 1 if you have the 'fido_assert_set_clientdata' function. */ +/* #undef HAVE_FIDO_ASSERT_SET_CLIENTDATA */ + +/* Define to 1 if you have the 'fido_cred_prot' function. */ +/* #undef HAVE_FIDO_CRED_PROT */ + +/* Define to 1 if you have the 'fido_cred_set_clientdata' function. */ +/* #undef HAVE_FIDO_CRED_SET_CLIENTDATA */ + +/* Define to 1 if you have the 'fido_cred_set_prot' function. */ +/* #undef HAVE_FIDO_CRED_SET_PROT */ + +/* Define to 1 if you have the 'fido_dev_get_touch_begin' function. */ +/* #undef HAVE_FIDO_DEV_GET_TOUCH_BEGIN */ + +/* Define to 1 if you have the 'fido_dev_get_touch_status' function. */ +/* #undef HAVE_FIDO_DEV_GET_TOUCH_STATUS */ + +/* Define to 1 if you have the 'fido_dev_is_winhello' function. */ +/* #undef HAVE_FIDO_DEV_IS_WINHELLO */ + +/* Define to 1 if you have the 'fido_dev_supports_cred_prot' function. */ +/* #undef HAVE_FIDO_DEV_SUPPORTS_CRED_PROT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_FLOATINGPOINT_H 1 + +/* Define to 1 if you have the 'flock' function. */ +#define HAVE_FLOCK 1 + +/* Define to 1 if you have the 'fmt_scaled' function. */ +/* #undef HAVE_FMT_SCALED */ + +/* Define to 1 if you have the 'fnmatch' function. */ +#define HAVE_FNMATCH 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FNMATCH_H 1 + +/* Define to 1 if you have the 'freeaddrinfo' function. */ +#define HAVE_FREEADDRINFO 1 + +/* Define to 1 if you have the 'freezero' function. */ +/* #undef HAVE_FREEZERO */ + +/* Define to 1 if the system has the type 'fsblkcnt_t'. */ +#define HAVE_FSBLKCNT_T 1 + +/* Define to 1 if the system has the type 'fsfilcnt_t'. */ +#define HAVE_FSFILCNT_T 1 + +/* Define to 1 if you have the 'fstatat' function. */ +#define HAVE_FSTATAT 1 + +/* Define to 1 if you have the 'fstatfs' function. */ +#define HAVE_FSTATFS 1 + +/* Define to 1 if you have the 'fstatvfs' function. */ +#define HAVE_FSTATVFS 1 + +/* Define to 1 if you have the 'futimes' function. */ +#define HAVE_FUTIMES 1 + +/* Define to 1 if you have the 'gai_strerror' function. */ +#define HAVE_GAI_STRERROR 1 + +/* Define to 1 if you have the 'getaddrinfo' function. */ +#define HAVE_GETADDRINFO 1 + +/* Define to 1 if you have the 'getaudit' function. */ +/* #undef HAVE_GETAUDIT */ + +/* Define to 1 if you have the 'getaudit_addr' function. */ +/* #undef HAVE_GETAUDIT_ADDR */ + +/* Define to 1 if you have the 'getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define to 1 if you have the 'getentropy' function. */ +#define HAVE_GETENTROPY 1 + +/* Define to 1 if you have the 'getgrouplist' function. */ +#define HAVE_GETGROUPLIST 1 + +/* Define to 1 if you have the 'getgrset' function. */ +/* #undef HAVE_GETGRSET */ + +/* Define to 1 if you have the 'getlastlogxbyname' function. */ +/* #undef HAVE_GETLASTLOGXBYNAME */ + +/* Define to 1 if you have the 'getline' function. */ +#define HAVE_GETLINE 1 *** 14376 LINES SKIPPED *** From nobody Thu Jul 9 18:20:34 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 4gx3DL5hKQz6kdSZ for ; Thu, 09 Jul 2026 18:20:34 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gx3DL2XhNz3n5h for ; Thu, 09 Jul 2026 18:20:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783621234; 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=ujXRatdXo9wS7qKGMkNVTMZrFwfjD9c3q6M3EhjnxFU=; b=O5a27dBBrfSnSohgxmXk/GMPamgm9aaqYjkNyU1YuyhzIb9fiTINcD+m60pjwvZxMmbpa2 3dnupCCUUgfUoBgjDHs3UYZaJR+NpTNS85WWepkWs08WBraJsnfLsbYWl1/iz8fwPXghFa NTKgqoOzuzjXtkthpWOD56hGgNqiFiKKVPSYgNj6VO1XLlLQwQPQVdrpgEL4xLvdJnqGvK LKaleT8GKnrNRSf6FnFrzkQ/UmUOLAqEV39rvfA1CONRgkByvhFWDuwUpl0gez7oSxLWDL P36EDCHrnu4NcIPTCje3RVbliPgf0JTi5LCffpbCHNTl2WHqbx5xip2hbpQiBA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783621234; a=rsa-sha256; cv=none; b=giDGhgbcWaxC9RFjutep+8BqQ5Nk1f5owiS9MC/aX4AR/lBQmRfjei/9Ib9cQfayVT3C3+ 0+IT/wZN2FJ+4UhnAEylyoU8VK2rG5x8nsKvduNX9wVjx22GCz3r0aJzUMqN22l+qq7btI 2Go61V3PVXiGad47nHqBDRdDzazl3DHT5N/+vrESuJjtAziqxvH0/ni80M3oeoRr3vP7iX yoLOXYmci6dRHqAqK/TlyY0JxTn9LN+jQOhKLg5QuBPyp1kfjPh7CkBXta6lYKb+esbR4j pr+2LkXNmDFkXSGDOyM6mZtdbAPautLkg9gYQED8XH2d7NBWKLxnyit4I4RnDg== 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=1783621234; 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=ujXRatdXo9wS7qKGMkNVTMZrFwfjD9c3q6M3EhjnxFU=; b=oIhAszbK5jKmh1H6OcmQ34Xq7ClkP0kthTwlnM0XRPArB2eOmjgSYRjdh1/EtgKuWYIQuU BLKZcf1/9AmGsnlENtZcJkg+ciY1h/XTEdHi8JbcvFCg2Hho/fpJtUlTna7VmeZWxRu5F9 /QRc5iIr5KxKvoNdl/wLiQr0FsV397nmFXkZzCf7SwDEZbbnljiOpPsCqc1HEajKxuYClJ KU2r2KG+xGLiKBk6t6j15QNubwQjZBIR74pooSvQKbPMVsci/hqgPf1mw6RBh4gWlU2sLH x+LepcVHihfc/fp2QbHC5BBKwj8M0qVddntYFpjthlgKCZKPeisJ8H0nvYo5+w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gx3DL19kFz4mN for ; Thu, 09 Jul 2026 18:20:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 44e94 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 09 Jul 2026 18:20:34 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: =?utf-8?Q?Vin=C3=ADci?=us Fe=?utf-8?Q?rr=C3=A3o?= From: Pouria Mousavizadeh Tehrani Subject: git: bac4760524a2 - main - netinet6: Fix ND link-layer address option layout for IPoIB 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: pouria X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bac4760524a2a15ce75e35251f0c9cdf31732f3f Auto-Submitted: auto-generated Date: Thu, 09 Jul 2026 18:20:34 +0000 Message-Id: <6a4fe672.44e94.2d48fd70@gitrepo.freebsd.org> The branch main has been updated by pouria: URL: https://cgit.FreeBSD.org/src/commit/?id=bac4760524a2a15ce75e35251f0c9cdf31732f3f commit bac4760524a2a15ce75e35251f0c9cdf31732f3f Author: Vinícius Ferrão AuthorDate: 2026-07-09 07:05:53 +0000 Commit: Pouria Mousavizadeh Tehrani CommitDate: 2026-07-09 17:30:04 +0000 netinet6: Fix ND link-layer address option layout for IPoIB RFC 4391 (IP over InfiniBand), section 9.3, lays the ND source/target link-layer address option out as type, length (3), two reserved zero octets, then the 20-octet IPoIB link-layer address. The ND code assumed the Ethernet layout (RFC 4861, section 4.6.1) everywhere and read/wrote the address directly after the option header, i.e. two octets early. The option-length sanity check computes 24 for both layouts for a 20-octet address, so the mismatch was silent. PR: 296585 Reviewed by: adrian, pouria Sponsored by: VersatusHPC Differential Revision: https://reviews.freebsd.org/D58096 --- sys/netinet6/icmp6.c | 15 ++++++++++----- sys/netinet6/nd6.h | 1 + sys/netinet6/nd6_nbr.c | 47 +++++++++++++++++++++++++++++++++++++---------- sys/netinet6/nd6_rtr.c | 18 ++++++++++-------- 4 files changed, 58 insertions(+), 23 deletions(-) diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 7fe18f4a4d2b..e92a433c21b1 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -2169,7 +2169,8 @@ icmp6_redirect_input(struct mbuf *m, int off) union nd_opts ndopts; char ip6buf[INET6_ADDRSTRLEN]; char *lladdr; - int icmp6len, is_onlink, is_router, lladdrlen; + int icmp6len, is_onlink, is_router; + u_int lladdr_pad, lladdrlen; M_ASSERTPKTHDR(m); KASSERT(m->m_pkthdr.rcvif != NULL, ("%s: no rcvif", __func__)); @@ -2296,16 +2297,17 @@ icmp6_redirect_input(struct mbuf *m, int off) lladdr = NULL; lladdrlen = 0; + lladdr_pad = nd6_lladdr_opt_pad(ifp); if (ndopts.nd_opts_tgt_lladdr) { - lladdr = (char *)(ndopts.nd_opts_tgt_lladdr + 1); + lladdr = (char *)(ndopts.nd_opts_tgt_lladdr + 1) + lladdr_pad; lladdrlen = ndopts.nd_opts_tgt_lladdr->nd_opt_len << 3; } if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) { nd6log((LOG_INFO, "%s: lladdrlen mismatch for %s " - "(if %d, icmp6 packet %d): %s\n", + "(if %d, icmp6 packet %u): %s\n", __func__, ip6_sprintf(ip6buf, &redtgt6), - ifp->if_addrlen, lladdrlen - 2, + ifp->if_addrlen, lladdrlen - 2 - lladdr_pad, icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); goto bad; } @@ -2492,6 +2494,7 @@ icmp6_redirect_output(struct mbuf *m0, struct nhop_object *nh) { /* target lladdr option */ int len; + u_int pad; struct nd_opt_hdr *nd_opt; char *lladdr; @@ -2499,6 +2502,7 @@ icmp6_redirect_output(struct mbuf *m0, struct nhop_object *nh) if (ln == NULL) goto nolladdropt; + pad = nd6_lladdr_opt_pad(ifp); len = sizeof(*nd_opt) + ifp->if_addrlen; len = (len + 7) & ~7; /* round by 8 */ /* safety check */ @@ -2507,9 +2511,10 @@ icmp6_redirect_output(struct mbuf *m0, struct nhop_object *nh) if (ln->la_flags & LLE_VALID) { nd_opt = (struct nd_opt_hdr *)p; + memset(nd_opt, 0, len); nd_opt->nd_opt_type = ND_OPT_TARGET_LINKADDR; nd_opt->nd_opt_len = len >> 3; - lladdr = (char *)(nd_opt + 1); + lladdr = (char *)(nd_opt + 1) + pad; bcopy(ln->ll_addr, lladdr, ifp->if_addrlen); p += len; } diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h index 92b776b008b9..372d06b6574d 100644 --- a/sys/netinet6/nd6.h +++ b/sys/netinet6/nd6.h @@ -380,6 +380,7 @@ void nd6_ns_input(struct mbuf *, int, int); void nd6_ns_output(struct ifnet *, const struct in6_addr *, const struct in6_addr *, const struct in6_addr *, uint8_t *); caddr_t nd6_ifptomac(struct ifnet *); +u_int nd6_lladdr_opt_pad(struct ifnet *); void nd6_dad_init(void); void nd6_dad_start(struct ifaddr *, int); void nd6_dad_stop(struct ifaddr *); diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index c345e96f8d3f..0601b55a0f18 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -151,7 +151,8 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len) union nd_opts ndopts; char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; char *lladdr; - int lladdrlen, rflag, tentative, tlladdr; + int rflag, tentative, tlladdr; + u_int lladdr_pad, lladdrlen; uint32_t dflags; ifa = NULL; @@ -240,8 +241,9 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len) lladdr = NULL; lladdrlen = 0; + lladdr_pad = nd6_lladdr_opt_pad(ifp); if (ndopts.nd_opts_src_lladdr) { - lladdr = (char *)(ndopts.nd_opts_src_lladdr + 1); + lladdr = (char *)(ndopts.nd_opts_src_lladdr + 1) + lladdr_pad; lladdrlen = ndopts.nd_opts_src_lladdr->nd_opt_len << 3; } @@ -302,9 +304,9 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len) if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) { nd6log((LOG_INFO, "nd6_ns_input: lladdrlen mismatch for %s " - "(if %d, NS packet %d)\n", + "(if %d, NS packet %u)\n", ip6_sprintf(ip6bufs, &taddr6), - ifp->if_addrlen, lladdrlen - 2)); + ifp->if_addrlen, lladdrlen - 2 - lladdr_pad)); goto bad; } @@ -582,6 +584,7 @@ nd6_ns_output_fib(struct ifnet *ifp, const struct in6_addr *saddr6, struct nd_opt_hdr *nd_opt; char *mac; int optlen; + u_int pad; mac = NULL; if (ifp->if_carp) @@ -591,6 +594,7 @@ nd6_ns_output_fib(struct ifnet *ifp, const struct in6_addr *saddr6, if (mac != NULL) { nd_opt = (struct nd_opt_hdr *)(nd_ns + 1); + pad = nd6_lladdr_opt_pad(ifp); optlen = sizeof(struct nd_opt_hdr) + ifp->if_addrlen; /* 8 byte alignments... */ optlen = (optlen + 7) & ~7; @@ -600,7 +604,8 @@ nd6_ns_output_fib(struct ifnet *ifp, const struct in6_addr *saddr6, bzero(nd_opt, optlen); nd_opt->nd_opt_type = ND_OPT_SOURCE_LINKADDR; nd_opt->nd_opt_len = optlen >> 3; - bcopy(mac, nd_opt + 1, ifp->if_addrlen); + memcpy((char *)(nd_opt + 1) + pad, mac, + ifp->if_addrlen); } } /* @@ -680,7 +685,8 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) char *lladdr; size_t linkhdrsize; int flags, is_override, is_router, is_solicited; - int lladdr_off, lladdrlen, checklink; + int lladdr_off, checklink; + u_int lladdr_pad, lladdrlen; bool flush_holdchain = false; NET_EPOCH_ASSERT(); @@ -749,8 +755,9 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) lladdr = NULL; lladdrlen = 0; + lladdr_pad = nd6_lladdr_opt_pad(ifp); if (ndopts.nd_opts_tgt_lladdr) { - lladdr = (char *)(ndopts.nd_opts_tgt_lladdr + 1); + lladdr = (char *)(ndopts.nd_opts_tgt_lladdr + 1) + lladdr_pad; lladdrlen = ndopts.nd_opts_tgt_lladdr->nd_opt_len << 3; } @@ -795,8 +802,8 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) { nd6log((LOG_INFO, "nd6_na_input: lladdrlen mismatch for %s " - "(if %d, NA packet %d)\n", ip6_sprintf(ip6bufs, &taddr6), - ifp->if_addrlen, lladdrlen - 2)); + "(if %d, NA packet %u)\n", ip6_sprintf(ip6bufs, &taddr6), + ifp->if_addrlen, lladdrlen - 2 - lladdr_pad)); goto bad; } @@ -1087,6 +1094,7 @@ nd6_na_output_fib(struct ifnet *ifp, const struct in6_addr *daddr6_0, } } if ((tlladdr & ND6_NA_OPT_LLA) && mac != NULL) { + u_int pad = nd6_lladdr_opt_pad(ifp); int optlen = sizeof(struct nd_opt_hdr) + ifp->if_addrlen; struct nd_opt_hdr *nd_opt = (struct nd_opt_hdr *)(nd_na + 1); @@ -1099,7 +1107,7 @@ nd6_na_output_fib(struct ifnet *ifp, const struct in6_addr *daddr6_0, bzero((caddr_t)nd_opt, optlen); nd_opt->nd_opt_type = ND_OPT_TARGET_LINKADDR; nd_opt->nd_opt_len = optlen >> 3; - bcopy(mac, (caddr_t)(nd_opt + 1), ifp->if_addrlen); + memcpy((char *)(nd_opt + 1) + pad, mac, ifp->if_addrlen); } else flags &= ~ND_NA_FLAG_OVERRIDE; @@ -1156,6 +1164,25 @@ nd6_ifptomac(struct ifnet *ifp) } } +/* + * Number of reserved octets between the header of an ND link-layer + * address option and the link-layer address itself. On IPoIB links + * two zero octets are prepended to the 20-octet link-layer address + * to fill the 24-octet option (RFC 4391, section 9.3); on all other + * link types the address immediately follows the option header. + */ +u_int +nd6_lladdr_opt_pad(struct ifnet *ifp) +{ + switch (ifp->if_type) { + case IFT_INFINIBAND: + case IFT_INFINIBANDLAG: + return (2); + default: + return (0); + } +} + struct dadq { TAILQ_ENTRY(dadq) dad_list; struct ifaddr *dad_ifa; diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 637f00bef2c9..167f3704f02d 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -171,7 +171,7 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len) union nd_opts ndopts; char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; char *lladdr; - int lladdrlen; + u_int lladdr_pad, lladdrlen; ifp = m->m_pkthdr.rcvif; @@ -226,16 +226,17 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len) lladdr = NULL; lladdrlen = 0; + lladdr_pad = nd6_lladdr_opt_pad(ifp); if (ndopts.nd_opts_src_lladdr) { - lladdr = (char *)(ndopts.nd_opts_src_lladdr + 1); + lladdr = (char *)(ndopts.nd_opts_src_lladdr + 1) + lladdr_pad; lladdrlen = ndopts.nd_opts_src_lladdr->nd_opt_len << 3; } if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) { nd6log((LOG_INFO, - "%s: lladdrlen mismatch for %s (if %d, RS packet %d)\n", + "%s: lladdrlen mismatch for %s (if %d, RS packet %u)\n", __func__, ip6_sprintf(ip6bufs, &saddr6), - ifp->if_addrlen, lladdrlen - 2)); + ifp->if_addrlen, lladdrlen - 2 - lladdr_pad)); goto bad; } @@ -467,18 +468,19 @@ nd6_ra_opt_src_lladdr(struct nd_opt_hdr *opthdr, struct ifnet *ifp, { char ip6bufs[INET6_ADDRSTRLEN]; char *lladdr = NULL; - int lladdrlen = 0; + u_int lladdr_pad = nd6_lladdr_opt_pad(ifp); + u_int lladdrlen = 0; if (opthdr != NULL) { - lladdr = (char *)(opthdr + 1); + lladdr = (char *)(opthdr + 1) + lladdr_pad; lladdrlen = opthdr->nd_opt_len << 3; } if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) { nd6log((LOG_INFO, - "%s: lladdrlen mismatch for %s (if %d, RA packet %d)\n", + "%s: lladdrlen mismatch for %s (if %d, RA packet %u)\n", __func__, ip6_sprintf(ip6bufs, &saddr6), - ifp->if_addrlen, lladdrlen - 2)); + ifp->if_addrlen, lladdrlen - 2 - lladdr_pad)); return (-1); } From nobody Thu Jul 9 18:34:20 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 4gx3XD2d7Dz6kfSl for ; Thu, 09 Jul 2026 18:34:20 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gx3XD1mVHz3pJ5 for ; Thu, 09 Jul 2026 18:34:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783622060; 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=o7gqtW5tXwheo8Hxo69l9YnOyt/ZmHS7JKDX49eKU1w=; b=aU6diCxXXKdmr9j4m64atM9BKULoIwJQEnOvUBqHWrc5xzIZWHo/UhoCD8KQeeznxZPWTB Gn7Cu1IDl0RoY7oerYpAdizfoK47S1wDL4sfPE1Ke29PWe64w2gsz+z5qypONJCTbNoxgT aV5PymxMgAs6jfgZxPvyOku4pDBspxxj1pZ1B9JWLKsSKMDYqbwmHOOkKhX5O4ssY/hkkj BxhzLAbsfPKOhlS64Ah0Dpl5tCCepuqnZMIhXDrRUCh7Nm6Z9dbMv24LH4sNJpmjtruECY WyoKm0KFMUyq7fNjMdNN5cA754jP97e1bHH2xs1tIo+VDFeY0fDA9y0Joh6w4g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783622060; a=rsa-sha256; cv=none; b=KSX27o7LC6wTiUL4eGTf83UEXuCj8LcLzRt48h0j7EXf1xvh4bv3wJ8pofvZrtCfMHqYIG XSva1qPjTJ/ls9YMQvKws1CDoMdsvHzHr87E/aKEtL87IGiufaRDs+aEGia/z7ERtUA41w 3oLkT0VN3y9yJ4DmF79CtUgiKaB/2dc2bVa9jKgHJVHDzPv844FT7dxWoc/eUdsjDgR0s/ D4xvFzVSm7XjvQzamVTy8L/rVBzlXMkdZ5aQOLGAeX4IIhl1rN8UCiK8OxGqTtPruErzdT 0z8N1sqSRHqRgbWvE1qUGkQuHnX6FjNXj29xhrQv2P7edG16BQlfeFOMS9J+IA== 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=1783622060; 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=o7gqtW5tXwheo8Hxo69l9YnOyt/ZmHS7JKDX49eKU1w=; b=ZlWbXvg/d+4XfNGKvwC8o3G3NofmxeZh7FaYTx8hPYoJNMaCATpqkHAYafBtbfadEFjH4Q ooQLdq0PJz3TIRpu3RRSEkSx95AQsI7tC1wlVcc7pXDomKoDKpTBti9JBzJdgJEvnk0UXD qG4NgziD6wkb2AbRSK+y2/USA4FrrWo3/MmoGNvkoeFfKBe/3kPjtFBB7z+uc9QGP1Z37D rSw/Z08+IPQG38s4Ui5GmksZ6ntEPIQpT66Jckm8IcgtFgifhTNSXmp0H/EmwHlz5hfEP3 j6Gt7LXYDEWmyf/iqT3kVemupGlGjE6DKLcc0fRPFDNG+hw/RQPHfI+0bBJnLA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gx3XD0Ngzz4rL for ; Thu, 09 Jul 2026 18:34:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 4656e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 09 Jul 2026 18:34:20 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jean-=?utf-8?Q?S=C3=A9bast?==?utf-8?Q?ien P=C3=A9?=dron Subject: git: 6d5f5f730a42 - main - linuxkpi: Add `to_acpi_device_node()` and `ACPI_COMPANION()` 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: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6d5f5f730a42eb49240bf1a21a65f4c5f7fd2843 Auto-Submitted: auto-generated Date: Thu, 09 Jul 2026 18:34:20 +0000 Message-Id: <6a4fe9ac.4656e.585f3bde@gitrepo.freebsd.org> The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=6d5f5f730a42eb49240bf1a21a65f4c5f7fd2843 commit 6d5f5f730a42eb49240bf1a21a65f4c5f7fd2843 Author: Jean-Sébastien Pédron AuthorDate: 2026-06-12 14:02:54 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2026-07-09 18:33:49 +0000 linuxkpi: Add `to_acpi_device_node()` and `ACPI_COMPANION()` The former is called by the latter. We return NULL because linuxkpi does not implement ACPI (pseudo?) devices associated to regular devices. The amdgpu DRM driver started to use `ACPI_COMPANION()` in Linux 6.13. Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57577 --- sys/compat/linuxkpi/common/include/linux/acpi.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/acpi.h b/sys/compat/linuxkpi/common/include/linux/acpi.h index a764a975c983..8b86fdfe9044 100644 --- a/sys/compat/linuxkpi/common/include/linux/acpi.h +++ b/sys/compat/linuxkpi/common/include/linux/acpi.h @@ -44,6 +44,14 @@ static inline void acpi_dev_put(struct acpi_device *adev) {} #define acpi_handle_debug(handle, fmt, ...) +static inline struct acpi_device * +to_acpi_device_node(const struct fwnode_handle *fwnode) +{ + return (NULL); +} + +#define ACPI_COMPANION(dev) to_acpi_device_node((dev)->fwnode) + #endif #endif /* _LINUXKPI_LINUX_ACPI_H_ */ From nobody Thu Jul 9 18:34:21 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 4gx3XF3gLqz6kfJv for ; Thu, 09 Jul 2026 18:34:21 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gx3XF2Z3Hz3pc9 for ; Thu, 09 Jul 2026 18:34:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783622061; 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=T0D0BQu+/cC+bOl0ORq4IHljJYrS1CMHzuV7m9WWSL4=; b=YzGKobO8rPzCz3nEeVXK71UCw/+FVfmy6a4/6bLAQt4aCBUZtQw67ldU+HaFk9PArnN7oA FncFtzVlJ/aGKgZfDwqE2qUehWuY6qo7NZU9vugsIsIQpm3MtfT7eQH78LxIsCB9ztPRRk 0gjLGzt4gSoHqnqNEeQgrZ6VlYXszyNK/8QAmlMrNhEXkKmPI19v3p6joblb6E4lXDri+K 7yYEgwOxBCcmgH0AIOklxrrmJJFpFycXHIOLPSCeg8Vd8h8rpEnTo+eNHIc2IYuOjmVeDK Cwt1ai9s8LZ6lQdh4LeCLMKDqYmF8QJ+Id7hl+bu6E+JxEypbPM2mOBUFQNa3A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783622061; a=rsa-sha256; cv=none; b=wRGsZqy5aNBZK8bmjz4EiVs+616sVRUNh1aQ044CYTvlDA+cJVY7XALtm4YvTKhAc6/kIb csbVHqBPsmdin+mnesaupxym0h2ChL6QYz0i12tdtok8c6p4oeaLEfqdBHvjY6XZjj9XKG iF3WoBAYocvzBNVHx+DtQ8bRcxVtTZTzigL995AR9+UncESyElmXbQQ+6ChMdxcY5iExXb QL25sJ0a2Im+KSx4N2G5iqCBY/ANO0iEkdyIfVMN3HiEWmZJsihXR6s1s3FpsWKnTBbSie k0QVqCy+gD6Y+fborCb8WPmz4cjpBHZk/OshOcIuR9LrDWYdc7snGCjhcqn8jw== 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=1783622061; 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=T0D0BQu+/cC+bOl0ORq4IHljJYrS1CMHzuV7m9WWSL4=; b=XfU1DBFG+m9dAbMVwjFJu/IboLcw1n/9Pf/TRRfiWu8fCtZlQ/f+4rXrpbbH3prZbvl5Jb cxU00+Kx68AYs74hJen86P1m3hzFJT9MQJZfvnNdVJHRMpLZQ6wbNP0Z3WXoRPU3GiZLfj o3s1sgPdi8nqOiPJDSCGja8VFMaaj2zB9Oq0HOYZWW5xbWNnnfBv6GGMDTdLPatjuie+we 5msRtiJFnIt/COQQPzTAXRCsXqXUeYiM/euO1mZxjPHeetB1jSSACouFdJdk1JU+BSdbn6 DGsMDRQUccwzonUliNl2IHoFiwRc4JWEr/DcOrx1uuZ2jCD5MsQmmiF5qHSCpA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gx3XF10qLz4Hx for ; Thu, 09 Jul 2026 18:34:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 452a8 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 09 Jul 2026 18:34:21 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jean-=?utf-8?Q?S=C3=A9bast?==?utf-8?Q?ien P=C3=A9?=dron Subject: git: e9f21e4f28ce - main - linuxkpi: Add `usleep_range_state()` 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: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e9f21e4f28ce8cf8ca890b86f8c791473976396f Auto-Submitted: auto-generated Date: Thu, 09 Jul 2026 18:34:21 +0000 Message-Id: <6a4fe9ad.452a8.66cd3c35@gitrepo.freebsd.org> The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=e9f21e4f28ce8cf8ca890b86f8c791473976396f commit e9f21e4f28ce8cf8ca890b86f8c791473976396f Author: Jean-Sébastien Pédron AuthorDate: 2026-06-12 16:00:56 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2026-07-09 18:33:56 +0000 linuxkpi: Add `usleep_range_state()` It takes a task state as its last argument. We enforce that this state is `TASK_UNINTERRUPTIBLE` for the time being because other states are not interpreted. Change `usleep_range()` to call `usleep_range_state()` with the state set to `TASK_UNINTERRUPTIBLE`, which is what Linux does too. The amdgpu DRM driver starte to use `usleep_range_state()` in Linux 6.13. Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57579 --- sys/compat/linuxkpi/common/include/linux/delay.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/delay.h b/sys/compat/linuxkpi/common/include/linux/delay.h index f19d1a759c26..7d29211bf110 100644 --- a/sys/compat/linuxkpi/common/include/linux/delay.h +++ b/sys/compat/linuxkpi/common/include/linux/delay.h @@ -30,7 +30,10 @@ #ifndef _LINUXKPI_LINUX_DELAY_H_ #define _LINUXKPI_LINUX_DELAY_H_ +#include +#include #include + #include static inline void @@ -64,14 +67,23 @@ ndelay(unsigned long x) } static inline void -usleep_range(unsigned long min, unsigned long max) +usleep_range_state(unsigned long min, unsigned long max, unsigned int state) { + KASSERT(state == TASK_UNINTERRUPTIBLE, ("%s: state=%d unsupported\n", + __func__, state)); + /* guard against invalid values */ if (min == 0) min = 1; pause_sbt("lnxsleep", ustosbt(min), 0, C_HARDCLOCK); } +static inline void +usleep_range(unsigned long min, unsigned long max) +{ + usleep_range_state(min, max, TASK_UNINTERRUPTIBLE); +} + extern unsigned int linux_msleep_interruptible(unsigned int ms); static inline void From nobody Thu Jul 9 18:41:23 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 4gx3hN0RSkz6kfmx for ; Thu, 09 Jul 2026 18:41:24 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gx3hM746xz3qHF for ; Thu, 09 Jul 2026 18:41:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783622484; 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=76MP1cNapnoUyM+7WvKHixyU8Oj0RuNx+3vvA4TEMbE=; b=aSOFWb88jvA8G8NeHnXNsy0iTVUYYprXGhLMQPdTy1CnhR/qEJT6FTieLzDl0worccCNQD 5mlP5ltGItLP7xB4FtClFw7kQ+3S4IgcEiSblKknYuxBP0SXyeOarO6IgrhdFC/nDISKEJ dRbuUGYHip6KENiQD07Zr/+TtnE7opqU9gnI9Pd1KRCUwttTOT4WdcRVS5CcpgnjfzGo79 iapCzgp+PtBT40O3aARqX4x2br1FpeQ4DKh5mbL5zbfVlAY2eL7x8Piz36Rmw6LAvl8ufp J2tymwyx367vpzssrWbnFdytp3+l/f972uB41CwNgMp5s8dYUgktV5dcgg+IJw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783622484; a=rsa-sha256; cv=none; b=WleBpg7CmVc8zl/rlFiH39zLFKFfH7te63cjgNpaoDMRJ+X2Lc9aZWx2KQy3mEz3xEBSTP JZI+JAYkNlVG+XHA61dvcjKC/IN7Z/pJfBlCrxr15RRzspaPWBPMFbDV+5RCXBycDX8+DD R6Q2z9HT1KV9SNC2sB+/FPHCcG4PvNXIm97eNt7ZQsIs01j0+Lzmo8NTUZg2LrFRWMjFgZ tTj3cbdhv4jkhXYRJ7laVeywHxX/k7g2/kQVcnLij6rpNramcdVn84D+jNo/DjqkV+BDYW EP/cKj8lpm4Q69QtEAOqHAlVKh5a4++5fj2JWGX9p4WN9TFoMmjMDHNI/duYBA== 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=1783622484; 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=76MP1cNapnoUyM+7WvKHixyU8Oj0RuNx+3vvA4TEMbE=; b=q9NLbZHw9AK+CCuRcfyWwBO0VKV45BmrJfSVhJV0748ylff9V/2/ql3bln5QLRsJrNyB4M rJj6U77eHnsu4B/8QpJeJiGMdO9heQtyNXqx04eZ4TQrDRWeAxZhISf57rQmVHTyREsYeE vj/IW8qlUviKzcc+Dh+QVwc3XZ7iJRn2XsemkQD2A+TZyuqiRDhyPdgtSQaWm5n2MW4/bT 5V99yFy0oarvhLVPUI+IQDVsdqekXvgSAuAt7FbjwdgKvrKAERNBJKJ+CX064owNBVeYgc 6VcrcolFd5O2oPZ6DnhK09oqXHehMqOs8Cudy+yXVDxRn2xvZUVYJWJpJND+OA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gx3hM5jxxz4J7 for ; Thu, 09 Jul 2026 18:41:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 461f9 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 09 Jul 2026 18:41:23 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 707ee7ff952c - main - usbdevs: Add Microchip 10BASE-T1S eval board 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 707ee7ff952c5aa50884f96f7ed26f756c9723b5 Auto-Submitted: auto-generated Date: Thu, 09 Jul 2026 18:41:23 +0000 Message-Id: <6a4feb53.461f9.66d52e2b@gitrepo.freebsd.org> The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=707ee7ff952c5aa50884f96f7ed26f756c9723b5 commit 707ee7ff952c5aa50884f96f7ed26f756c9723b5 Author: Ed Maste AuthorDate: 2026-05-04 15:33:24 +0000 Commit: Ed Maste CommitDate: 2026-07-09 18:40:37 +0000 usbdevs: Add Microchip 10BASE-T1S eval board USB vendor:product 184f:0051 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56794 --- sys/dev/usb/usbdevs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index 5d9ce62da13d..a2592b4dd411 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -714,6 +714,7 @@ vendor DISPLAYLINK 0x17e9 DisplayLink vendor LENOVO 0x17ef Lenovo vendor WAVESENSE 0x17f4 WaveSense vendor VAISALA 0x1843 Vaisala +vendor K2L 0x184f K2L GmbH vendor VERBATIM 0x18a5 Verbatim vendor E3C 0x18b4 E3C Technologies vendor AMIT 0x18c5 AMIT @@ -2767,6 +2768,9 @@ product JVC MP_PRX1 0x3008 MP-PRX1 Ethernet /* JRC products */ product JRC AH_J3001V_J3002V 0x0001 AirH PHONE AH-J3001V/J3002V +/* K2L products */ +product K2L EVB_LAN8670_USB 0x0051 Microchip EVB-LAN8670-USB 10BASE-T1S + /* Kamstrrup products */ product KAMSTRUP OPTICALEYE 0x0001 Optical Eye/3-wire product KAMSTRUP MBUS_250D 0x0005 M-Bus Master MultiPort 250D From nobody Fri Jul 10 03:20:06 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 4gxHBv1PmPz6kMVN for ; Fri, 10 Jul 2026 03:20: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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxHBv0nNSz3VkC for ; Fri, 10 Jul 2026 03:20:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783653607; 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=iYA3mLMDgggST4wuh+tdo+VBwV8HUjiNl3Wp0Kq/vmM=; b=OycqMnsNEHUWM83aVljnjpZ4VQwGX/1/DNhcYaXQotjmY9IpSLzPCpSAGQPydZr+Zh+EFD gxBoSSwGvTFgEZ7nqssyOHxVIP8za+Ym0ws8bueroITojqubRA/WAY2/hw+wWGJKBQZlms 9iADfpuBVoxlS+Recogz5LxxBUz9SSz+a7n+XmcC4n3YQsZrfQUTyRhYgUI8/QevfSArgZ LgK2aebwOJrokfJymcqCyWLxcAPn8sIu5xw0d4gSQMWwUhrH/eANapLhWubi8VvfiNJqO4 RO2HanUlERXkrwN4xRTsiFq+EEerv49PQZ6Q4LaYZuURX5QmYzkO50fDO6+NKw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783653607; a=rsa-sha256; cv=none; b=sDsPMWnvJG8aBGashDmdp4WR2cO/S93txtvVkRuaTe+H3SYQROp73aM9iaP6VystFwf8Ee FjEej5PoIPYiGm5RKrBBWHC7fhKk/Lc3D7YuVuMpZHL6HMf3u84rVZ/jfOtUBZqi4Pwf4l rKePduSUYiNPt+kmGpFhqXcIPphPuJqrl9+jKh5djDRHB0cIA8BxwhZJLu+diRZxN01pJv 3K1pUcTMgewr2RhWty9vRCNlpWlGI9lUXSqYbdhrrhc3i0luPWycthRJKFT4ZvYjOgVGUM uyWw5r1p/CJUuH31yqloukXWHLf0wO04anyB+angiNQmIfY3Qk1rE5X9q44nCg== 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=1783653607; 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=iYA3mLMDgggST4wuh+tdo+VBwV8HUjiNl3Wp0Kq/vmM=; b=st8j0vRRhScNIcUSuygVvBNReopTqkHIQoAnPrq0pUEOiEVO6Ogl76f0CVekUlSbRitb7X 6Fi9aoS12wJqu6tfB94e5Iax4+Q2v+Z722Z/yn+J7yGw8LnPS0as3iW7/0Y+fRLfgScG1b jJfZDbBTz3YmV9PWAY9jwiPiZy3ZPBnSvccBTvkzeG+gsV09WXOdTgbb8ZMqtEN5/IePxa P9DOVcyDMEJYz9VSYlfvzNyLqg4CbfnSU2ZieATYNMznAuIjXwlM1bO+JFgzf0F9fV5q6R OGX+ODkgYQ+4wkccfXGd0UyGsD9+8SEBIzVVy58UjguVIrEPwuyPPWtVvyFEoQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxHBt6S3NzdWk for ; Fri, 10 Jul 2026 03:20:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 26a1d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 03:20:06 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 5792a639ab95 - main - openssh: fix GSSAPI option names 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5792a639ab950fb7e6add09352e1cd41f1809bc2 Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 03:20:06 +0000 Message-Id: <6a5064e6.26a1d.19f7c526@gitrepo.freebsd.org> The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=5792a639ab950fb7e6add09352e1cd41f1809bc2 commit 5792a639ab950fb7e6add09352e1cd41f1809bc2 Author: Ed Maste AuthorDate: 2026-07-10 03:15:37 +0000 Commit: Ed Maste CommitDate: 2026-07-10 03:15:37 +0000 openssh: fix GSSAPI option names From openssh-portable commit c14709356563. Reported by: cy --- crypto/openssh/servconf.c | 18 +++++++++--------- crypto/openssh/servconf.h | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/crypto/openssh/servconf.c b/crypto/openssh/servconf.c index 7ed4dd2353fa..db8aab5f8fc1 100644 --- a/crypto/openssh/servconf.c +++ b/crypto/openssh/servconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: servconf.c,v 1.450 2026/06/29 08:59:31 djm Exp $ */ +/* $OpenBSD: servconf.c,v 1.451 2026/07/07 01:00:22 djm Exp $ */ /* * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland * All rights reserved @@ -1441,19 +1441,19 @@ process_server_config_line_depth(ServerOptions *options, char *line, #endif /* KRB5 */ #ifdef GSSAPI - case sGssAuthentication: + case sGSSAPIAuthentication: intptr = &options->gss_authentication; goto parse_flag; - case sGssCleanupCreds: + case sGSSAPICleanupCredentials: intptr = &options->gss_cleanup_creds; goto parse_flag; - case sGssDelegateCreds: + case sGSSAPIDelegateCredentials: intptr = &options->gss_deleg_creds; goto parse_flag; - case sGssStrictAcceptor: + case sGSSAPIStrictAcceptorCheck: intptr = &options->gss_strict_acceptor; goto parse_flag; #endif /* GSSAPI */ @@ -4227,10 +4227,10 @@ dump_config(ServerOptions *o) # endif #endif #ifdef GSSAPI - dump_cfg_fmtint(sGssAuthentication, o->gss_authentication); - dump_cfg_fmtint(sGssCleanupCreds, o->gss_cleanup_creds); - dump_cfg_fmtint(sGssDelegateCreds, o->gss_deleg_creds); - dump_cfg_fmtint(sGssStrictAcceptor, o->gss_strict_acceptor); + dump_cfg_fmtint(sGSSAPIAuthentication, o->gss_authentication); + dump_cfg_fmtint(sGSSAPICleanupCredentials, o->gss_cleanup_creds); + dump_cfg_fmtint(sGSSAPIDelegateCredentials, o->gss_deleg_creds); + dump_cfg_fmtint(sGSSAPIStrictAcceptorCheck, o->gss_strict_acceptor); #endif dump_cfg_fmtint(sPasswordAuthentication, o->password_authentication); dump_cfg_fmtint(sKbdInteractiveAuthentication, diff --git a/crypto/openssh/servconf.h b/crypto/openssh/servconf.h index 031032181889..27cabdb070bb 100644 --- a/crypto/openssh/servconf.h +++ b/crypto/openssh/servconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: servconf.h,v 1.177 2026/05/31 11:30:50 djm Exp $ */ +/* $OpenBSD: servconf.h,v 1.179 2026/07/07 01:00:22 djm Exp $ */ /* * Author: Tatu Ylonen @@ -316,16 +316,16 @@ SSHCONF_UNSUPPORTED_INT(kerberos_get_afs_token, KerberosGetAFSToken, SSHCFG_GLOB #ifdef GSSAPI #define SSHD_CONFIG_ENTRIES_GSS \ -SSHCONF_INTFLAG(gss_authentication, GssAuthentication, SSHCFG_ALL, 0, SSHCFG_COPY_MATCH) \ -SSHCONF_INTFLAG(gss_cleanup_creds, GssCleanupCreds, SSHCFG_GLOBAL, 1, SSHCFG_COPY_NONE) \ -SSHCONF_INTFLAG(gss_deleg_creds, GssDelegateCreds, SSHCFG_GLOBAL, 1, SSHCFG_COPY_NONE) \ -SSHCONF_INTFLAG(gss_strict_acceptor, GssStrictAcceptor, SSHCFG_GLOBAL, 1, SSHCFG_COPY_NONE) +SSHCONF_INTFLAG(gss_authentication, GSSAPIAuthentication, SSHCFG_ALL, 0, SSHCFG_COPY_MATCH) \ +SSHCONF_INTFLAG(gss_cleanup_creds, GSSAPICleanupCredentials, SSHCFG_GLOBAL, 1, SSHCFG_COPY_NONE) \ +SSHCONF_INTFLAG(gss_deleg_creds, GSSAPIDelegateCredentials, SSHCFG_GLOBAL, 1, SSHCFG_COPY_NONE) \ +SSHCONF_INTFLAG(gss_strict_acceptor, GSSAPIStrictAcceptorCheck, SSHCFG_GLOBAL, 1, SSHCFG_COPY_NONE) #else /* GSSAPI */ #define SSHD_CONFIG_ENTRIES_GSS \ -SSHCONF_UNSUPPORTED_INT(gss_authentication, GssAuthentication, SSHCFG_ALL) \ -SSHCONF_UNSUPPORTED_INT(gss_cleanup_creds, GssCleanupCreds, SSHCFG_GLOBAL) \ -SSHCONF_UNSUPPORTED_INT(gss_deleg_creds, GssDelegateCreds, SSHCFG_GLOBAL) \ -SSHCONF_UNSUPPORTED_INT(gss_strict_acceptor, GssStrictAcceptor, SSHCFG_GLOBAL) +SSHCONF_UNSUPPORTED_INT(gss_authentication, GSSAPIAuthentication, SSHCFG_ALL) \ +SSHCONF_UNSUPPORTED_INT(gss_cleanup_creds, GSSAPICleanupCredentials, SSHCFG_GLOBAL) \ +SSHCONF_UNSUPPORTED_INT(gss_deleg_creds, GSSAPIDelegateCredentials, SSHCFG_GLOBAL) \ +SSHCONF_UNSUPPORTED_INT(gss_strict_acceptor, GSSAPIStrictAcceptorCheck, SSHCFG_GLOBAL) #endif /* GSSAPI */ #define SSHD_CONFIG_ENTRIES \ From nobody Fri Jul 10 04:18:40 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 4gxJVS36Nlz6kRMh for ; Fri, 10 Jul 2026 04:18:40 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxJVS1b3Zz3bpx for ; Fri, 10 Jul 2026 04:18:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783657120; 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=e2fCPlh1OCn5mnG56bhFK8TkUQ5wxB40RiWrZFLZbM8=; b=Dniu9qg+A/XxOcCoKhQ7qvyj+pVKqyIiMsnvSj7lOipaN+1fXwhT0Z1ghBidVFURoWaGPc DzS5zsknOMvd5JbOY1l2tPOvc7T3vmwN8hKOX6yuwEjTENAIZtpnX5Sz/xl/tung2sYS73 tnthuME+hz32B9mVdvkanehUwR003C1rxX4WH9xTGucDnJXEWYJ0+Ba/ahXzMjzJsFqte1 22o38vL0+0YJRDaWkIEEeGbTOLa2y1RX9AFw784nKLeZ4R8eA8KGPgT7hVRkUix3aBInR0 BsDE/ncTvVmO+31OrLaz6PI5+4YJ+22cr2+NJt8zvM6vVdWCK8l8bdpuZyP/nA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783657120; a=rsa-sha256; cv=none; b=qBxy8GQRbfPInNL9ib6KqHnq//FfpQP2SR9nxZAGI/33as9k/iQDchBEqsESgqEO5XIQ+v IunDiwLE5ayT4SXyJ7x7Zwm4x+mEX7jBbvIHZCwtN/ZXokZUA4xjAYP60F/w1jIQzv4MeG uL/g9iJpD6KAZQkWsi9MLKKCxd9koPnaw3txjJZihOye8TapSKMfONu/1Pun+lNxeAf6BF oAL4uqJ7f1eSNVlcrJUyuJAT8VeZ1oJpBv9IAPiXG0xXQiLqqn55R4syIGHXrHc3S4cXjM UsZbDnryLACCMerdBjbpmfrfjCUgxT6ogIaKeOPC4vbYqLSfyUMmORCY/7PaQA== 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=1783657120; 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=e2fCPlh1OCn5mnG56bhFK8TkUQ5wxB40RiWrZFLZbM8=; b=sZ4kuYAWxuQ7x8VJgJG5bdOkNzcMFqjHvnHpRtgh+Wl5kpwPSmljeNTYPj4ZQKsl8r9kZb w4pS96r/byo3VcDnTVIFlBtoj6U1MVX1jJS9X9Wu0Bi4TvJFwj27Zty93Nq+DTh++8Vc3P a42eEjB74RQlOl65vbM7vvk0EW793RP+l5L2PEi/J7pG/pgYKyG37zYvB4VI+7SvSXUS14 cI43qMba7tu2CAzwOq9wWVfrMIhyQs2phHs/dT4kABvm0BOfyVq0eHGhfarpggp29pmnk+ NC8h+pNV7Vy38/C01Hw8Yyla57VqWmO6fCMP0cVYJlz3JamDJfSxS97/Y3IMWQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxJVS0QgDzg78 for ; Fri, 10 Jul 2026 04:18:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 328d7 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 04:18:40 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: f273414c11e4 - main - MINIMAL: Add device md 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f273414c11e46c1e388aebc6bd45f83e91beeb11 Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 04:18:40 +0000 Message-Id: <6a5072a0.328d7.714b1ef9@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f273414c11e46c1e388aebc6bd45f83e91beeb11 commit f273414c11e46c1e388aebc6bd45f83e91beeb11 Author: Warner Losh AuthorDate: 2026-07-10 04:04:04 +0000 Commit: Warner Losh CommitDate: 2026-07-10 04:09:40 +0000 MINIMAL: Add device md This can't be a loadable module, so add it to MINIMAL Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D58067 --- sys/amd64/conf/MINIMAL | 1 + sys/i386/conf/MINIMAL | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/amd64/conf/MINIMAL b/sys/amd64/conf/MINIMAL index bf371f79ed86..30a8dad75b7b 100644 --- a/sys/amd64/conf/MINIMAL +++ b/sys/amd64/conf/MINIMAL @@ -130,6 +130,7 @@ device uart # Generic UART driver # Pseudo devices. device loop # Network loopback device ether # Ethernet support +device md # Memory "disks" # The `bpf' device enables the Berkeley Packet Filter. # Be aware of the administrative consequences of enabling this! diff --git a/sys/i386/conf/MINIMAL b/sys/i386/conf/MINIMAL index ec46c91aaad2..e3ef9dddbea8 100644 --- a/sys/i386/conf/MINIMAL +++ b/sys/i386/conf/MINIMAL @@ -142,6 +142,7 @@ device loop # Network loopback device padlock_rng # VIA Padlock RNG device rdrand_rng # Intel Bull Mountain RNG device ether # Ethernet support +device md # Memory "disks" # The `bpf' device enables the Berkeley Packet Filter. # Be aware of the administrative consequences of enabling this! From nobody Fri Jul 10 04:18:41 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 4gxJVT33RTz6kQwb for ; Fri, 10 Jul 2026 04:18:41 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxJVT2PkZz3bf2 for ; Fri, 10 Jul 2026 04:18:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783657121; 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=WXD4K6SiJiORUzHXIs/tUr2KH58M3+Kz/xpNfDrrvJE=; b=qbaaK3U83hHIT30BrK2lbcI0YbwLFLzpJ4CFGdG+eXKYprOnH3FnwhRE+tYy8ds/6xjUXp MmECIAsd9ac0aFO2AaiBPfTfYfii87U2f2YQ/ZjSKKjxKlZqVml+mfaA+pVfCjSBYszSkR PakBDtV5Q9yKGaY8WJNolrmGVkkQ03gF8VLO9SdzZGdldWwiBkvLV384qtIwFZuQkBZVlp e6a1jYFGiUjrySdvbDrT/LjSFrqVaOXkkPK0xZP51LkbVc6lE7wMZ3jSLx+Jor6FQ3LhDe fmU12mtRruaXXqQXhKul3Zhz8Kj6QFHeQtyjOgg3HZWx217LzqIn6fcqfCDjuw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783657121; a=rsa-sha256; cv=none; b=lMc1mHOmPXyMimYETyVLyexrqeO8wH+zw5zYF5yKeXF3QjPLdd733VgFS6QTytcPUcXReo /0NzUwCbsE987NEJ8VwRFqCHJYlw5ypteTQsdTGqxWX9Lb3m7h9aew8WIum5RV135msTR3 ZhGYK+4nRXGrfyWkN4KWtQPN95KUNgjCU+yyS3umhjvlEI3qYOo9iK0bxJA+XxeYzcypCD hh+KY4l+JKcfau7rYqQ3pGnc/u0D/EsYq8rcOU67pMdKg4AceBjQmoYdATGYgu6aEAnD4O 9qcjsgYJ4lAVAISEY2CqGV/BMth6KSBlME+KF8ITF6LzE06DOOyWe+ermJJP6Q== 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=1783657121; 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=WXD4K6SiJiORUzHXIs/tUr2KH58M3+Kz/xpNfDrrvJE=; b=KqRejANBd2EpdgWQYKlhexUDAjkvHpioUBbHlAKI52epS/Nr+sqVht0hOsupkA8WbGbSkY Z3HdMGUJqlFnHiPK6NC/F8dBW6yCRL8rpHkKPpsuy3XDzf/EnF4QnknWmd6iOeiaduc37g AVEmqxebU+AmSfZb2sHg37JH/3bX+OPbb4dZxqN+GQ5IPQIragcsoHAsQ8Yh/EGjoXLK8j Wh5vvQLaUPPfqBc4Awiuh0IuRGvVqd9gRDw0ySN1I9bNecos6sDroBqpXT2mis8XieTzAl skilYwSkU4bIEGL4BdG6mSC6pCbzXkRFwH/05PQUfP8za3QIziwpqvysHTIA6Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxJVT1CPCzgK8 for ; Fri, 10 Jul 2026 04:18:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 33aa2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 04:18:41 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: a22fa5ec74e0 - main - laoder.efi: Fix error in download protcol 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a22fa5ec74e084c5786745e56939e78f7159007b Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 04:18:41 +0000 Message-Id: <6a5072a1.33aa2.2f8c0dfb@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a22fa5ec74e084c5786745e56939e78f7159007b commit a22fa5ec74e084c5786745e56939e78f7159007b Author: Warner Losh AuthorDate: 2026-07-10 04:04:20 +0000 Commit: Warner Losh CommitDate: 2026-07-10 04:09:41 +0000 laoder.efi: Fix error in download protcol The download protocol calls download_data with FileOffset and BufferLength of 0 first to start the download (no data yet available). Calls it again with BufferLength == 0 and FileOffset the size of the download (again, no data). It then starts calling with BufferLength != 0 and FileOffset == 0 to start the download. The heuristic I used to detect the start was wrong, so we'd allocate the buffer twice. Fix that by being more explicit and not using the heuristic that was bogus. Fixes: afee781523e4 ("loader.efi: Recognize new memdisk= and memcd= options") Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D58068 --- stand/efi/loader/memdisk.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/stand/efi/loader/memdisk.c b/stand/efi/loader/memdisk.c index 8d34d3ceae42..aa843916c799 100644 --- a/stand/efi/loader/memdisk.c +++ b/stand/efi/loader/memdisk.c @@ -50,11 +50,15 @@ download_data(IN VOID *Context, IN VOID *Buffer, IN UINTN BufferLength, IN UINTN dl_state *ctx = Context; decomp_state *dctx = ctx->dctx; + if (FileOffset == 0 && BufferLength == 0) { + printf("Staritng the download\n"); + return (EFI_SUCCESS); + } + /* - * Make a note of the size when we're hinted about it. But once - * we start the download, ignore the hints. + * Make a note of the size when we're hinted about it. */ - if (ctx->size == 0 && BufferLength == 0) { + if (BufferLength == 0) { printf("We know we will download %llu bytes\n", ULL(FileOffset)); ctx->size = FileOffset; ctx->status = EFI_SUCCESS; From nobody Fri Jul 10 04:18:42 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 4gxJVV5FP0z6kQyw for ; Fri, 10 Jul 2026 04:18:42 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxJVV3JWLz3bmY for ; Fri, 10 Jul 2026 04:18:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783657122; 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=5YjHk0xSBs/N4D7gS9ItG6rSi+zagegF+3Qp8kFaEgo=; b=IW1oJKBP0oYEPUyzVUSc02mf4IybD6RvfSqI0KtwKTAXaLAC8n9Fd3Ej0bw/5/kOkAQs9g Z0uFvzNrPawNVY75sRDsDGZ8Y0CkzUAjlE3m9CJfjAMJAtze99mdCSiCrfD2MfykeefKVo erXnNmmyQUGImbGVVZ9jvnN+/tHrQcqPXTzQP3XG3ljITdYb8MmnBMFncFj1WF1kTzBi1I ei224j6NxNbYxZKIFIw/ibfsvVzFni4s1Fis7LSjgu87iVQvJ13ywwxqJuInTgkWJkRS+D rssH3D/gAR/Nb1bxDF4emkKED9iTbMycKKiOq7D0j7WCDXGJ7ORcABUlBQUoww== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783657122; a=rsa-sha256; cv=none; b=TTjcvGaV3m0xeTTs1lNg4VrJS5/LC0wh+QppkdpMstRsS/5KQsJ+iKnpRLDwEmUuoOJ27G lFCN04ZKYE2Sl3hyaKPqtJ7fu9M6vU3rFXmHY9ykoKJBPDfl4sd/Wx8VpsxRb3hbTDoeoJ FtqIagiAJZFHElJenVRXTuNACF+PeViYH8Upc4yOtTYY5P1S0bfxL06TexZfGf3/2Rm6uC xglzZ54lB+VMF8fploTlF64MlKsTkFRMIILdNcPU6JgGeuTJthUXFo23l4sP8V39gLtX2h OUFhe4Wh+J06MFI/PDLQ4IJD5hM0sPBiqXKqaTYGUI4b3bb1Qd/bm8lnf0ebZQ== 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=1783657122; 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=5YjHk0xSBs/N4D7gS9ItG6rSi+zagegF+3Qp8kFaEgo=; b=DSoqpTIVuyZWttNMGjkCVaGIkkDJoWtugqRW73eASB842E6+vNhOJe1t/jf4FChqrIhNb3 nkEz/Ty5zKvCx9FIhKigksWboqEte0mba7KkO1l6HdReGlhunp9IvU5PUowJ4uGtJYcs1E 8AUtkboYUSgqXN2j3FtUD0ljaVSeXSI6vFCJXeADMn8NlzwnnlKzVvArOfTq8PAe4DyFwX YXdYY8PEAh0amHBW30nIJrcOkD/DRoe1CagS4emxdJ64XqoRaSPJINKsn9zB8MpURpUsX7 TZPh8m4qKg26KAX/UTx9ClZp34qF41iDE0Xr2jBDoBy6xyA5OBi2XjbZBwZpXA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxJVV20R9zg5J for ; Fri, 10 Jul 2026 04:18:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 33e63 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 04:18:42 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 603270b4d69e - main - loader.efi: Fix off by one error in size of the virtual disk 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 603270b4d69ecf0a8405e34bd41838873ddad72d Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 04:18:42 +0000 Message-Id: <6a5072a2.33e63.542dce88@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=603270b4d69ecf0a8405e34bd41838873ddad72d commit 603270b4d69ecf0a8405e34bd41838873ddad72d Author: Warner Losh AuthorDate: 2026-07-10 04:04:30 +0000 Commit: Warner Losh CommitDate: 2026-07-10 04:09:41 +0000 loader.efi: Fix off by one error in size of the virtual disk The end address is the final byte in the array, not one byte past the end of the array, so we need to add 1 to get the full length. Fixes: 59219fc76a4b ("loader.efi: efiblk_memdisk_preload passes the VirtualDisks to FreeBSD") Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D58069 --- stand/efi/libefi/efipart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/efi/libefi/efipart.c b/stand/efi/libefi/efipart.c index b4842e1b52aa..c80a3b966376 100644 --- a/stand/efi/libefi/efipart.c +++ b/stand/efi/libefi/efipart.c @@ -1292,7 +1292,7 @@ efiblk_memdisk_preload(void) snprintf(value, sizeof(value), "0x%016x", start); setenv(key, value, 1); snprintf(key, sizeof(key), "hint.md.%d.len", i); - snprintf(value, sizeof(value), "0x%016x", end - start); + snprintf(value, sizeof(value), "%d", end - start + 1); setenv(key, value, 1); } } From nobody Fri Jul 10 04:18:43 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 4gxJVW5cbXz6kR4q for ; Fri, 10 Jul 2026 04:18:43 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxJVW3sgMz3bYY for ; Fri, 10 Jul 2026 04:18:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783657123; 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=kx2Wh9ggQj6x82hb2LHVDt6henQBbRimf0SMqnN9B1I=; b=X6sRepxB2oeXuSfCnrg1WrtpEoGBGE19kcvbkf8l0poJ1i9L4KlDCKtpYC+Uxjtrf75ca4 l5vjJ7Qm0J4qdb3tgI1Fq65frHtGqw20byFWdqtqhNJKbZHf2nxo+vZ4GShvXV689Esf6q UM19aPhTLVf9/7mvLLbuejRDI75t6lBQiyt/Be504dAP5uGNhFia/oUu9Q9oO2d5C2ulmO CLd1MdzG0dOoQt74myA6m2g68ng7jt29zmqVuFAuutqMFEHwaScjoVu3M2CLm93V/OLnwf +h8YquAiDY16YPsYuFmwCWKC9Z7JXydwk/ELfv4VtIg+cUsLBi5oOqR3tP0sJg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783657123; a=rsa-sha256; cv=none; b=dLc8BG6sse7wbrhIvbxb1HmAQ/wOAqR3e50nWRZx3e4uKf4WTGxboZvzZNAGG1Uv9yAsWu Uv0YWgt1ZRH5P16aVN65NYrtf8qlxSDpfKwp4W4EEDM97LOvnfm3fUcdZggyNg06SNUaST yuqhaoS7BEZR6RyOcpxYq/FikXiwjhgxUFyoK6hKhlJnzTUkxzEn8YO/nQiPQOEvrnCJII Cnpw7MMRFkvJDVW2nrVsHyHeJ8D4ASLiaaSxzIgqClp8qyPCU+RhQSNmHUWUvtJ7lHBnKj Kb+JBGTc3R07WB4B1ZGoIByOgDO5Tv3eBE38r1tjHN7g8xyx6+To9Xd0ZCrmzA== 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=1783657123; 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=kx2Wh9ggQj6x82hb2LHVDt6henQBbRimf0SMqnN9B1I=; b=YFebept65e9hUKBs2kHBUvq3+Q1x1zSFjY49lYhfDaXyxwYjY6kC79UmUoEJTCIcdKbKP8 MidTyxtzvuQHVVBWezwqqkWAzdZAATsLM72FcrCYPUIvQS69PHyag/X4L5ZjJJR6+L8t3Q vB/7XPkUEvMDslK7X696RcNk1kFlMsJSyWV7/qP2DY5TAhuhit4bAsQdHreiA7htWrQkBn eHpO7hX3tuVyDS0sC3nnUj8TK3F150U3DlbhguwPh+wjDAtldnRzMmBmSlZY3dWw7MM+sw 37H0JOwF177qiO3JUn9KX64bouAaSg9g/X5GvHKL39caQIR4IldoNUUJXZp++g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxJVW2cKqzgK9 for ; Fri, 10 Jul 2026 04:18:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 332ba by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 04:18:43 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 1d1298269d4c - main - loader.efi: Simplify the code for null decompression a little 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1d1298269d4c6e3ce41db6265f32ff6c2faecaf7 Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 04:18:43 +0000 Message-Id: <6a5072a3.332ba.105c45e1@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1d1298269d4c6e3ce41db6265f32ff6c2faecaf7 commit 1d1298269d4c6e3ce41db6265f32ff6c2faecaf7 Author: Warner Losh AuthorDate: 2026-07-10 04:04:40 +0000 Commit: Warner Losh CommitDate: 2026-07-10 04:09:41 +0000 loader.efi: Simplify the code for null decompression a little This code is simpler when we spell it the Unix way. Also, add sanity checks to make sure the offset is where we think it is. Fixes: afee781523e4 ("loader.efi: Recognize new memdisk= and memcd= options") Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D58070 --- stand/efi/loader/decompress.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/stand/efi/loader/decompress.c b/stand/efi/loader/decompress.c index 1e18618db6f2..5c16f7d9bb2a 100644 --- a/stand/efi/loader/decompress.c +++ b/stand/efi/loader/decompress.c @@ -335,10 +335,14 @@ null_step(decomp_state *dctx, uint8_t *buf, size_t len, size_t offset) printf("Too much data recieved!"); return (err); } + if ((uintptr_t)dctx->buf_cur - (uintptr_t)dctx->buf != offset) { + printf("OH NO! The offset is %llu but I expected %llu\n", ULL(offset), + ULL((uintptr_t)dctx->buf_cur - (uintptr_t)dctx->buf)); + return (err); + } - CHAR8 *src = buf; - CHAR8 *dst = (void*)(uintptr_t)(dctx->buf + offset); - BS->CopyMem(dst, src, len); + memcpy(dctx->buf_cur, buf, len); + dctx->buf_cur += len; return (end == dctx->size ? done : ok); } From nobody Fri Jul 10 04:18:44 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 4gxJVX6CZvz6kR4s for ; Fri, 10 Jul 2026 04:18:44 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxJVX4xTdz3blY for ; Fri, 10 Jul 2026 04:18:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783657124; 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=jkwoN7c9PK0aeosD+FtkCSxOagsXRRW+Pw+FzCYJlLs=; b=qPhaYuDYlyHABqmOwbOEu/BRuDV/17aC8VsiZ/VjbVAM/LIJfQa0wldQQBKKBDDTMG5dof W9yUPJvxFwmPqy2iX6VYOvktmD5s8p+53bk8rEdxY4tJQTooMkTX9bQvumkJFPsL15AbT/ 5xhEDR063Fgmy0ll72/VHVAXJ8Wn0UmA3MVmiKK7HGxs//trfwln8Ib4XkgViFvW8ZPC0U qetrmkt1oGbmTuYpZ2ffD8TDb6zaEEpTsnoKd15pOiS9YepOiriuiKXKScClvBbx5dI6Nk VW/E6U0HqVTc5BsyYhRPTPjQIs9tyXhuz2Oz51qNpIIDFgQ4saxMlHkAcsG2NQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783657124; a=rsa-sha256; cv=none; b=oLVX3VLqYqOmi4gZ8wYEghvP8t2s5LKZcdWXrhEAZJcprpjmY53NO9B3w+scl6+yjPyM46 mzzLboqnpi4Hgvmqm0SxnWXU9mwX55v2K/w6weth59yjkLY7A+MilwygCiDMgYomM1St+E pHQNbKuGOTKXhq96PJt5nh2FIVuwUdtF7hCEn+GMND/5HEH+xho7ulsWE7cDcQxgckWApt JHonG0wjaATXfK/RX5e3Uwuf9Qpveqwg3ZBzZ+PG2Bhl/G6AEql3V0FRsgta71EBpYhqGK 0XPgIikYXSn23RIJZjQ7FGnIpDLFTOqbvZwRRF7w2w9x4Zo9Y8pQKsHCkTxIFQ== 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=1783657124; 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=jkwoN7c9PK0aeosD+FtkCSxOagsXRRW+Pw+FzCYJlLs=; b=LvZ3Dt2xcD7T2KrqIYX3K5NwkwwA9xzambdRz4DkUfUyH3A7jfvIR/edMJb19A0z97V4Kv QQnuow4Wvdz/kYLWdzr/AZLxMDy7CvvB7uyoFETpDC+O4GVZx07juLeyPh1PPmwuSRkhrP eW6H2ZXQk19Aj6ulyoNTA/Gr4dsRTWW7hkBBzXhcPzST6ybrFLLJtLYoEtxT4fF3NjaA9N w4SwEsLOyhWwrg9MUKEnv1dZdUkLO1GxKFhAHomhCfdqqvEstKAV0xSs10Q6Vdg3ejaVn/ S9nnCw6Nxq6Lak4VW3CXsZIIdSFSBWoQHd35y9Cef0v43WRUififT1gIch2L8A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxJVX3RbKzfm2 for ; Fri, 10 Jul 2026 04:18:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 328db by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 04:18:44 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: c8842f1d18ae - main - Revert "loader.efi: Trim ZFS searching for other booting options" 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c8842f1d18ae136cf5e3144540f76c7ebe0cd28a Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 04:18:44 +0000 Message-Id: <6a5072a4.328db.3ac30072@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c8842f1d18ae136cf5e3144540f76c7ebe0cd28a commit c8842f1d18ae136cf5e3144540f76c7ebe0cd28a Author: Warner Losh AuthorDate: 2026-07-10 04:04:52 +0000 Commit: Warner Losh CommitDate: 2026-07-10 04:09:41 +0000 Revert "loader.efi: Trim ZFS searching for other booting options" This reverts commit 3e3fd1fde8e168910edc538966111c0b5f03cd5f. This appears to break chainbooting with boot1.efi and similar scenarios with Root-on-ZFS scenarios. Revert until it's better understood. PR: 296309 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D58071 --- stand/efi/loader/main.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index cc7a9c4ac814..891ae198a13f 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -681,21 +681,39 @@ find_currdev(bool do_bootmgr, char *boot_info, size_t boot_info_sz) #ifdef EFI_ZFS_BOOT /* - * Sixth Choice: With a relaxed policy, try ZFS pools on non-boot - * devices after the boot device has been fully exhausted. + * Sixth Choice: Probe the boot disk for ZFS and then probe the non-boot + * disk if we have a relaxed boot poluicy. */ - if (boot_policy == RELAXED) { + { zfsinfo_list_t *zfsinfo = efizfs_get_zfsinfo_list(); zfsinfo_t *zi; + /* + * Try ZFS pool(s) on the boot device not reachable via + * the partition walk above. + */ STAILQ_FOREACH(zi, zfsinfo, zi_link) { - if (zi->zi_handle == boot_img->DeviceHandle) + if (zi->zi_handle != boot_img->DeviceHandle) continue; - printf("Trying ZFS pool 0x%jx\n", - zi->zi_pool_guid); + printf("Trying ZFS pool 0x%jx\n", zi->zi_pool_guid); if (probe_zfs_currdev(zi->zi_pool_guid)) return (0); } + + /* + * With a relaxed policy, try pools on other devices only + * after the boot device has no bootable root. + */ + if (boot_policy == RELAXED) { + STAILQ_FOREACH(zi, zfsinfo, zi_link) { + if (zi->zi_handle == boot_img->DeviceHandle) + continue; + printf("Trying ZFS pool 0x%jx\n", + zi->zi_pool_guid); + if (probe_zfs_currdev(zi->zi_pool_guid)) + return (0); + } + } } #endif /* EFI_ZFS_BOOT */ From nobody Fri Jul 10 04:18:45 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 4gxJVZ0bVFz6kRJb for ; Fri, 10 Jul 2026 04:18: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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxJVY5lGmz3bYr for ; Fri, 10 Jul 2026 04:18:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783657125; 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=0GOsWYzRSMnQ1JNHHKSzSAk5kPJtlKSINXYhN0E6oSk=; b=Xm/0OjqQW5aqopr/TjpNVKJ2dPEtrjP8B1vQqOq+2H4DY0hljiIDYoXVj783WwK51NMmMw DfjqAZXf2a+uQPDEP/podIpxvyyStyy9NjCIaIaJSNYNvTIO7trvkK8IK0WEg6mhiLLJKW yakHZfYdEiP9gmylhvM0jUYKmVyWvF9QopQp65fzABEnzYjG2wNR2lQgla5pbbOOfYrtmf msX/E/qI7KR4bQmi9aYQ0bsRPd9ml5Vl8jsA13s6wRB1HOf9iaVm1bb9CRSWla+3/m2q8W TPJ7lED0gZwnDnQJ2HpcJ3sXjaRBQXQ6cd7se+hEpc7/X9ap6dDtZgE0fgRByw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783657125; a=rsa-sha256; cv=none; b=f140Dtirlypk8v/Nhx8P4ZsSygyoSSrTsvSAZ5356+HC9OynNgP0PR+TnIplASooWBgzrl 5WRJ5LzhTNdLJOj0CaPckC1xlE9y/8agODyJBm2U8zzVvcJDys0DQyA5S4bI3oL8z4WNhj AFetLyzbHdcBRVQaufrKXdpMnB1jF9fuX4Lh/Wvsdto7XJOlv/hjlYMsjb2pHwPkz5I5MX qfWw3H3Wwqgu3aneUcBHQTkxL3ucqRP/3d6zxDTLoIf4eVcI3YClpU/hBvrT3+tBzDikHM luWxr15z52hTQnwnykskARi7Z5k8K2YnWjanepwtlrz2IRkoOkK82ReW4hxp1w== 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=1783657125; 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=0GOsWYzRSMnQ1JNHHKSzSAk5kPJtlKSINXYhN0E6oSk=; b=thIG5BRJBiz0nnqGrNcpZvkbleN7kH4aHKuOcq+n0hB/+zzBAgiQjvu+AlNbS2iNITToao yqGgdfOqtfdjGDIjHZbf+/e/vPjEgUrHpFpjUGINZVwqnZibxofVR4uNU4Dt12jFrLV+gt bzWP+W/vOegBA7dFMj5nJ0HgcxSJTsncQzEP7rItycZ8ttFh0ZjEnyOoOHMQSMdFvwWljZ spMmX8GtedVSMCv0G+XEnuJsISmFFa55d366wS7ffOFk52XoOjrgZ34RhoK2S2qudFarzB Ym35q2PRhpnU4h/LDG5Cx3YJeCMadmKXypRH602Gc5jfxWqFRM3iecpiXSvRgA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxJVY4HrczgJZ for ; Fri, 10 Jul 2026 04:18:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 34179 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 04:18:45 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: bcb1b157fdf9 - main - loader: Add two new build knobs for x86 BIOS loaders 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bcb1b157fdf97d5296457a0a95dfc04e33c2faeb Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 04:18:45 +0000 Message-Id: <6a5072a5.34179.450975cf@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=bcb1b157fdf97d5296457a0a95dfc04e33c2faeb commit bcb1b157fdf97d5296457a0a95dfc04e33c2faeb Author: Warner Losh AuthorDate: 2026-07-10 04:05:25 +0000 Commit: Warner Losh CommitDate: 2026-07-10 04:13:07 +0000 loader: Add two new build knobs for x86 BIOS loaders We have two sets of BIOS loaders: One that lives in stand/i386 and one that lives in stand/userboot. Add knows to turn these on/off, with the default being on. These often aren't needed when creating a minimal UEFI system, so add knobs to turn them off. Given light-weight VMs have created a new use cases for these loaders, there's no plans at all to eliminate them. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D58072 --- share/man/man5/src.conf.5 | 8 +++++++- share/mk/src.opts.mk | 2 ++ stand/Makefile.amd64 | 4 ++-- tools/build/options/WITHOUT_LOADER_BIOS | 2 ++ tools/build/options/WITHOUT_LOADER_USERBOOT | 2 ++ tools/build/options/WITH_LOADER_BIOS | 2 ++ tools/build/options/WITH_LOADER_USERBOOT | 2 ++ 7 files changed, 19 insertions(+), 3 deletions(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index 03c43bed733c..b1c511f596ef 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,5 +1,5 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. -.Dd July 7, 2026 +.Dd July 9, 2026 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1065,6 +1065,9 @@ Do not build LLVM target support for X86. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. +.It Va WITHOUT_LOADER_BIOS +Do not build x86 BIOS loader support + .It Va WITHOUT_LOADER_BIOS_TEXTONLY Include graphics, font and video mode support in the i386 and amd64 BIOS boot loader. @@ -1146,6 +1149,9 @@ arm/armv7 and powerpc/powerpc64. .It Va WITH_LOADER_USB Build the usb/kshim library +.It Va WITHOUT_LOADER_USERBOOT +Do not build x86 userboot loader support + .It Va WITH_LOADER_VERBOSE Build with extra verbose debugging in the loader. May explode already nearly too large loader over the limit. diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 1b5a44c231f3..1dbd1d2d9703 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -125,6 +125,7 @@ __DEFAULT_YES_OPTIONS = \ LLVM_BINUTILS \ LLVM_BINUTILS_BOOTSTRAP \ LLVM_COV \ + LOADER_BIOS \ LOADER_BIOS_TEXTONLY \ LOADER_GELI \ LOADER_IA32 \ @@ -133,6 +134,7 @@ __DEFAULT_YES_OPTIONS = \ LOADER_OFW \ LOADER_PXEBOOT \ LOADER_UBOOT \ + LOADER_USERBOOT \ LOADER_ZFS \ LOCALES \ LOCATE \ diff --git a/stand/Makefile.amd64 b/stand/Makefile.amd64 index 48e5136ec33f..1a19dd76ba46 100644 --- a/stand/Makefile.amd64 +++ b/stand/Makefile.amd64 @@ -1,5 +1,5 @@ -S.yes+= userboot -S.yes+= i386 +S.${MK_LOADER_USERBOOT}+= userboot +S.${MK_LOADER_BIOS}+= i386 SUBDIR_DEPEND_userboot+= ${INTERP_DEPENDS} # These won't get tacked on in an amd64 build diff --git a/tools/build/options/WITHOUT_LOADER_BIOS b/tools/build/options/WITHOUT_LOADER_BIOS new file mode 100644 index 000000000000..702d33340d56 --- /dev/null +++ b/tools/build/options/WITHOUT_LOADER_BIOS @@ -0,0 +1,2 @@ +Do not build x86 BIOS loader support + diff --git a/tools/build/options/WITHOUT_LOADER_USERBOOT b/tools/build/options/WITHOUT_LOADER_USERBOOT new file mode 100644 index 000000000000..3a9c755306b9 --- /dev/null +++ b/tools/build/options/WITHOUT_LOADER_USERBOOT @@ -0,0 +1,2 @@ +Do not build x86 userboot loader support + diff --git a/tools/build/options/WITH_LOADER_BIOS b/tools/build/options/WITH_LOADER_BIOS new file mode 100644 index 000000000000..c876ddaddb20 --- /dev/null +++ b/tools/build/options/WITH_LOADER_BIOS @@ -0,0 +1,2 @@ +Build x86 BIOS loader support + diff --git a/tools/build/options/WITH_LOADER_USERBOOT b/tools/build/options/WITH_LOADER_USERBOOT new file mode 100644 index 000000000000..363facc112ec --- /dev/null +++ b/tools/build/options/WITH_LOADER_USERBOOT @@ -0,0 +1,2 @@ +Build x86 userboot loader support + From nobody Fri Jul 10 04:18:46 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 4gxJVb1NFmz6kRZK for ; Fri, 10 Jul 2026 04:18:47 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxJVZ6qqCz3bm5 for ; Fri, 10 Jul 2026 04:18:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783657127; 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=QKn3ImDrKNkh6CL944w0XTF+HYdCRwriOCp/NrkFUuY=; b=WzRWy9p08W6r6t6UhBetSS30SoL4oRC1vSS2lOnwePbIFGaEjMicPYs54qGzFt5xEgH+zQ Rm+wM11Df8xYZH03xUy/OVPsCQ7dvjl1YEYuLQMQwqU5YReUQbwtAO/BQUS2GckRgmtIE9 06tqMkFdw82oK0tLkgqA5beDsKS7C6gR6BzfpusxkumoASJRd7/Ctc/oboUFdsOknJOFIi i/zQ2KJ7EzijBsSKcIltZwxQTgH9Q3M3FDwMRz93WvzeAD6F7uGh+wzX/RWjqe5tZ3Dzm8 GaXCzr/Qb6wNf9ZuT8IlpSJ0EzI5u9xEhbyCusa5b5ooRIZBtj4vI5FHtedAyw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783657127; a=rsa-sha256; cv=none; b=L4v/SVAXQU1VPj/949F1H2jWBtGQ84uxX3KEx/rVSbz3Q7J+AfaBay+KPHlKComKO0PBvd I317JrP60e3AXKvVz2bdt5UmQWJKJ9iOPuZN5dU5oSmKE3DrshQagC21IQOCc7Lz4iLgSA H+X72rnp23U9gSofNmv2JYE5GvhzzHvzb8J6oK86512DLMRrqrtMprSrIOddjt3ZCLf0WE avYe/IcFhWCJEBR92eJ5T/cG4EJ2bpk9TbphnQ1IiQZJuuGYI09uuEM8GNtLx1fmjMTNcj RF8c5SJz+Zo6gqUrhcry4EsK3YEOqwMapdxqF9w3oqndvMyesimBnV+Aec/j+w== 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=1783657127; 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=QKn3ImDrKNkh6CL944w0XTF+HYdCRwriOCp/NrkFUuY=; b=yX/e6BWAcTN41Qxc3MRjJTPZOzrGfgcQMDi/66st/Z6wyn0tteG4JYc2S2XyD8HK17KIZW mfSPMC5TFLBesL2rrrlpg0A1pIYY5BtOA2BCzkvRKkuu7feSNNKrTXHp88rVAM05mEStEB SLuwpUDcScK7Qv2kq6oUESxsskzeqmQVT9XhtP++9KXrzCbAI+GkNLqKIqj7iY2z+pJbro Wm2JoO9agPOGk6gMPvuyTd92xLVWxPTRwwk1AiUdVvPC8m61gmGnB7tGlSUEmQsBOPQbM/ R3KQpXzbelqK6AEFahLAG+MXlnPdIEZcbwoA1xa8q2XBQADgK6cgMdkLaBFVtA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxJVZ57NFzg5N for ; Fri, 10 Jul 2026 04:18:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 32a3a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 04:18:46 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 45f9f6ebacff - main - kldxref: Add -m filag to print info about modules in one file 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 45f9f6ebacff41a70673fdbc305a442afff13494 Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 04:18:46 +0000 Message-Id: <6a5072a6.32a3a.2b751e8@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=45f9f6ebacff41a70673fdbc305a442afff13494 commit 45f9f6ebacff41a70673fdbc305a442afff13494 Author: Warner Losh AuthorDate: 2026-07-10 04:05:46 +0000 Commit: Warner Losh CommitDate: 2026-07-10 04:14:51 +0000 kldxref: Add -m filag to print info about modules in one file kldxref -m will print the same data that the '-d' flag produces, except restrict the output to one file. This should be the full path to the file, and the directory name to process is omitted. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D57902 --- usr.sbin/kldxref/kldxref.8 | 7 ++++++- usr.sbin/kldxref/kldxref.c | 17 ++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/usr.sbin/kldxref/kldxref.8 b/usr.sbin/kldxref/kldxref.8 index 1704847592cd..c292a2338cb7 100644 --- a/usr.sbin/kldxref/kldxref.8 +++ b/usr.sbin/kldxref/kldxref.8 @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd February 25, 2023 +.Dd June 27, 2026 .Dt KLDXREF 8 .Os .Sh NAME @@ -35,6 +35,8 @@ .Op Fl Rdv .Op Fl f Ar hintsfile .Ar path ... +.Nm +.Fl m Ar module .Sh DESCRIPTION The .Nm @@ -67,6 +69,9 @@ output. .It Fl f Ar hintsfile Specify a different name for the hints files than .Pa linker.hints . +.It Fl m Ar module +Print information about the modules in the file +.Ar module . .It Fl v Operate in verbose mode. .El diff --git a/usr.sbin/kldxref/kldxref.c b/usr.sbin/kldxref/kldxref.c index eed754e1e730..260a0baa6405 100644 --- a/usr.sbin/kldxref/kldxref.c +++ b/usr.sbin/kldxref/kldxref.c @@ -764,13 +764,13 @@ main(int argc, char *argv[]) { FTS *ftsp; FTSENT *p; - char *dot = NULL; + char *dot = NULL, *module = NULL; int opt, fts_options; struct stat sb; fts_options = FTS_PHYSICAL; - while ((opt = getopt(argc, argv, "Rdf:v")) != -1) { + while ((opt = getopt(argc, argv, "Rdf:m:v")) != -1) { switch (opt) { case 'd': /* no hint file, only print on stdout */ dflag = true; @@ -778,6 +778,10 @@ main(int argc, char *argv[]) case 'f': /* use this name instead of linker.hints */ xref_file = optarg; break; + case 'm': + module = optarg; + dflag = true; + break; case 'v': verbose++; break; @@ -789,11 +793,18 @@ main(int argc, char *argv[]) /* NOTREACHED */ } } - if (argc - optind < 1) + if (argc - optind < (module ? 0 : 1)) usage(); argc -= optind; argv += optind; + if (module) { + if (elf_version(EV_CURRENT) == EV_NONE) + errx(1, "unsupported libelf"); + read_kld(module, module); + exit(0); + } + if (stat(argv[0], &sb) != 0) err(1, "%s", argv[0]); if ((sb.st_mode & S_IFDIR) == 0 && !dflag) { From nobody Fri Jul 10 04:18:47 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 4gxJVc26MDz6kRZM for ; Fri, 10 Jul 2026 04:18:48 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxJVb6vh2z3bsb for ; Fri, 10 Jul 2026 04:18:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783657128; 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=n8skGJtvaJxX454P8wBRy4/cuqw5UtkQ9XJTClYLbuo=; b=p34CPFjFHIyjn/fZj+LDMqWBJZdbO9mS2IVWSX4o6H7z0Rkg9gGIEtPuKHAaAtQR+MLTOr QqwmTy9X5NjdVNyUrsFJXEI3IY3rgm7ZxMntebMDu9VZn9Zd3ahCAGpSd9G4WppM78iVqf FNB+eHHGy3zRdPLv/rw0RYX0Yh2iJNP2PZZGuxHH0fznGc2p0zZZyJTJERaF+a1iGlf6H1 ht4Ofky1st6aSiyuyQZxhmRibbEkDZqc9Qlv+64ABFBYO8kLggrE1RUjvdHZUX5aUgLwtO c2f08cz1iJvWSCXqg3ljiFDPrqYxSa/vXk4BS7MFB7y6X+tsiyt2nXZr8IBUCw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783657128; a=rsa-sha256; cv=none; b=Hn/zftWxq68i9bInSAZgwLRw3TSMIf02muSGm0wLfdaAGmBM4sa6I8qXWkVc3xnM0zRwpP X8L8QJU8B8m96Ff+1U4fLOw2qPelreX/QTZ0kxm+KCQJgyEe6o9UfTjP5Igm3wPcGm1WlB SfSjYeUdynPzKEg4ik4nqqPF0FETDsuflFvETVqXjNm8Vd6xLYBLzlptg/j7tcd3Ph3pta UtsYQBLE1zZZf/q9a3DtoP2KMJOs2CAayfWqhqoDTMoyLQyKyXLQ7npPQMt4yZu3aBCYJp cY+9llqplVkBp+X6JvOFXb2z13YMuarTCGIItJBirazZHxPSMA+2C+eRZVYNXw== 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=1783657128; 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=n8skGJtvaJxX454P8wBRy4/cuqw5UtkQ9XJTClYLbuo=; b=Csz9b2rTBYTi2qqxGLW3v6ce7nrcrDZNGs4tGtCdftKCnn3mNkIVTdBzP40YVcn2eRm6CI LdV5v5g6vgk/LYhMKUFcPPdf5UN/0eU5u134HTIW8hHlknrhVe42/ojVA/Peoi2pebP1zZ WPBqoyR2+xQiDKzNSgvJZ2LAP1muibKuiB9lWmueaKbvyTubL+0MzoFvgrnyjhqv/zcumL +StxrAI6wra3OgX8FD6n0dNH30KDbRRq4WO5MtDZLD4Yl7Bnkhee9bHzBsmSx71F5qMqt9 vLiq+Tt/Tgyz4YIhXGgTa1t6/3/cBe8rZ71bMNoXsSIaNZRQP8pJkmAUnsIc6Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxJVb5v26zg5P for ; Fri, 10 Jul 2026 04:18:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 320c6 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 04:18:47 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 584ecfeb9cde - main - XZ kernel build cleanup 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 584ecfeb9cde1e4cf0ed27c4f822b316b67d320e Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 04:18:47 +0000 Message-Id: <6a5072a7.320c6.5c655fb1@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=584ecfeb9cde1e4cf0ed27c4f822b316b67d320e commit 584ecfeb9cde1e4cf0ed27c4f822b316b67d320e Author: Warner Losh AuthorDate: 2026-07-10 04:05:54 +0000 Commit: Warner Losh CommitDate: 2026-07-10 04:14:51 +0000 XZ kernel build cleanup -I${SRCTOP}/sys/contrib/xz-embedded/linux/lib/xz isn't used, and .PATH: ${SRCTOP}/sys/contrib/xz-embedded/freebsd isn't used either. Remove them both to simplify things a little. Sponsored by: Netflix --- sys/modules/xz/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/modules/xz/Makefile b/sys/modules/xz/Makefile index 8951123635c3..a05da29e3611 100644 --- a/sys/modules/xz/Makefile +++ b/sys/modules/xz/Makefile @@ -1,5 +1,4 @@ .PATH: ${SRCTOP}/sys/dev/xz -.PATH: ${SRCTOP}/sys/contrib/xz-embedded/freebsd .PATH: ${SRCTOP}/sys/contrib/xz-embedded/linux/lib/xz KMOD= xz @@ -14,7 +13,6 @@ SRCS= \ CFLAGS+= \ -DXZ_USE_CRC64 \ -I${SRCTOP}/sys/contrib/xz-embedded/freebsd \ - -I${SRCTOP}/sys/contrib/xz-embedded/linux/lib/xz \ -I${SRCTOP}/sys/contrib/xz-embedded/linux/include/linux EXPORT_SYMS= YES From nobody Fri Jul 10 14:46:43 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 4gxZR74BvPz6lFMD for ; Fri, 10 Jul 2026 14:46:43 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxZR72t2dz3w80 for ; Fri, 10 Jul 2026 14:46:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783694803; 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=HdwuGdCEA6fhb3QsmFiZXKciGwxYED56iy/mzc1by4Y=; b=rjXKIdNQLFvfHz5+tkyH20TJZL8Mg0s0X1kkGOyeVQU85Xo8PiAhy8D1UufrIgZ+nwEabl KSM+T4hlewNVXqIGgu+ZPQqls3u4ghpoiXaIK7fC3Mr/nSxWz0EgGqEjwpxp7nu1Hkivlz QyXQXxEQWQrurggb1/ZE4+qYIcsC9/R++jR6RrrsTP1sxoPun1q/v/zn2GGQcBpht97f2o qWLW7t7BCpPcUePRHCwnGYBazftx9hP/0Lx8FxPuUo1cWsM6bdiRol3DbOhJ+LKpSSZX7V 6DYQdU/eWRWPjZyrLpaSxL6jrMSgWs5YX2ESBObDRWvq0/n0DBggoFPge8iHvQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783694803; a=rsa-sha256; cv=none; b=x22YKXRdWEHAkUcW7eihsqF+DucCbNhyB0I402dvUdmWeiuikfzc16QAHihgNEXzLWjNDv 3+DZo+HbmDj9LZLqFEtd08xX9eJeOimXjBNfIH54yiJ6PGVgpGgjCz/w04zDvwTjHdeK0s 0tLqPToiPADvESz6keQOl/e0K2lpV16xEK+cYTx0gxLhFM0MHa7Y7Rso+Ph19U2pr7H5+b UB6JhGaG1SfXn728ic36//SWneQVT8+35uz1zBqAt7rz+qTl3RSCJM/WQdIIlnLGvrpNph vF66sGp/K2KuYPwoEn2K1oyi3tPGhR3PyyVnqydBCHC1Usv3lOxRouqbvnYYcg== 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=1783694803; 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=HdwuGdCEA6fhb3QsmFiZXKciGwxYED56iy/mzc1by4Y=; b=I+2cMVzTkPBmHK5STqCAo6bm2DpIZeLp7fUd8vHAuITJJ7sWwa2n48pzW3PhU3R413gqJ4 r3uFJ09zYfVBZKqDyKcTlp2Xf15CBp3XRVd3btplzlWhHWB5GvQVgh7sqPPvOrS6zfWwzD fzrdG/iBAdfutEibWY7g0nKpyN/xArgyxGBi+DzMCjKKrIEUu8rVcI/rT8iuRLX97HiETR 0hSqjkD6GLqs5qIxpoIPPfeAjriZVMkTjjLaNpJu9cYzFVsoY8Z585ulVbjaVp1NUwvtSh spllU+na1OA0yyLUSUdlMu8TImJzhoTMqxEIcWDLOgRKFjUG6OZ4NIb0UopL1w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxZR70wG4z1067 for ; Fri, 10 Jul 2026 14:46:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2738c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 14:46:43 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 1f091ad283e9 - main - git-mfc: Filter pending and dangling commits by committer 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: 1f091ad283e9e9815f568d6fdf2b58d1e75f02b3 Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 14:46:43 +0000 Message-Id: <6a5105d3.2738c.210dbc97@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1f091ad283e9e9815f568d6fdf2b58d1e75f02b3 commit 1f091ad283e9e9815f568d6fdf2b58d1e75f02b3 Author: Mark Johnston AuthorDate: 2026-07-10 14:44:09 +0000 Commit: Mark Johnston CommitDate: 2026-07-10 14:44:09 +0000 git-mfc: Filter pending and dangling commits by committer Previously we searched commits based on the author email address, but this isn't really right: if I commit something from a contributor, I'm still responsible for MFCing it, so really we should be filtering on the committer. Add a new --committer option to filter results by committer email address, defaulting to the user.email value in the git config. Keep the --author option, but don't filter by author unless the option is explicitly specified. Reported by: des Reviewed by: des Differential Revision: https://reviews.freebsd.org/D58126 --- tools/tools/git/git-mfc | 49 +++++++++++++++++++++++++++++------------------ tools/tools/git/git-mfc.1 | 13 +++++++++++-- 2 files changed, 41 insertions(+), 21 deletions(-) diff --git a/tools/tools/git/git-mfc b/tools/tools/git/git-mfc index c3ff474add3e..513a7f150e3c 100755 --- a/tools/tools/git/git-mfc +++ b/tools/tools/git/git-mfc @@ -31,6 +31,11 @@ def commit_summary(commit): return f'{commit.hexsha} ("{commit.summary}")' +def commit_match(commit, author, committer): + return (author is None or author in commit.author.email) and \ + (committer is None or committer in commit.committer.email) + + def origin_branch(): """ Determine the default origin branch by parsing sys/conf/newvers.sh. @@ -245,7 +250,7 @@ def mfc_origins(repo, commit, warn=False): return origins -def dangling(repo, upstream, author=None): +def dangling(repo, upstream, author=None, committer=None): """ Find commits in the current branch which have been cherry-picked from upstream but are missing fixup commits. @@ -258,7 +263,7 @@ def dangling(repo, upstream, author=None): refs = mfc_origins(repo, commit, warn=True) for ref in refs: picked.append(ref.hexsha) - if author is None or author in commit.author.email: + if commit_match(ref, author, committer): mine.append(ref.hexsha) # Create a mapping of all upstream commits to their fixups, # tracking reverts as we go. @@ -301,7 +306,7 @@ def mfc_after(commit): return None -def pending(repo, upstream, author=None, baking=False): +def pending(repo, upstream, author=None, committer=None, baking=False): """ Find commits in the upstream branch that have an "MFC after:" tag, whose waiting period has elapsed, and which have not been cherry-picked to the @@ -339,8 +344,7 @@ def pending(repo, upstream, author=None, baking=False): # Not yet eligible for MFC. continue - if author is not None and author not in commit.author.email: - # Don't report commits that don't match the requested author. + if not commit_match(commit, author, committer): continue committed = datetime.datetime.fromtimestamp( @@ -388,7 +392,7 @@ def main(): ) parser.add_argument( '-a', '--author', type=str, default=None, - help='Filter --pending/--dangling results by author (default: current user)', + help='Filter --pending/--dangling results by author (default: ignore author)', ) parser.add_argument( '--all', action='store_true', @@ -399,6 +403,10 @@ def main(): help='With --pending, also show commits whose MFC-after period ' 'has not yet elapsed', ) + parser.add_argument( + '-c', '--committer', type=str, default=None, + help='Filter --pending/--dangling results by committer (default: current user)', + ) parser.add_argument( '--dangling', action='store_true', help='Find cherry-picked commits in the current branch that are ' @@ -455,24 +463,27 @@ def main(): if not args.n: repo.remotes[remote].fetch(origin) - show_all = getattr(args, 'all') - if show_all: - author = None - elif args.author: - author = args.author - elif args.dangling or args.pending: - author = repo.config_reader().get_value('user', 'email', default=None) - if author is None: - err(1, "could not determine user email; use -a or --all") - else: - author = None + # Do we want to filter commits by author or committer? By default, use + # the current git user's email to match the committer field. + author = committer = None + if not getattr(args, 'all'): + user_email = repo.config_reader().get_value('user', 'email', default=None) + if args.author: + author = args.author + + if args.committer: + committer = args.committer + else: + committer = user_email + if committer is None: + err(1, "could not determine user email; use -c or --all") if args.dangling: - missing = dangling(repo, upstream, author=author) + missing = dangling(repo, upstream, author=author, committer=committer) for fixup, commit in missing: print(f'{commit_summary(fixup)} fixes {commit_summary(commit)}') elif args.pending: - results = pending(repo, upstream, author=author, + results = pending(repo, upstream, author=author, committer=committer, baking=args.baking) for commit, ready_date, ready in results: date_str = ready_date.strftime('%Y-%m-%d') diff --git a/tools/tools/git/git-mfc.1 b/tools/tools/git/git-mfc.1 index acd27ef3cbcb..a730eae7ee6b 100644 --- a/tools/tools/git/git-mfc.1 +++ b/tools/tools/git/git-mfc.1 @@ -19,6 +19,7 @@ .Nm .Fl -pending .Op Fl a Ar author +.Op Fl c Ar committer .Op Fl -all .Op Fl -baking .Op Fl -origin Ar branch @@ -26,6 +27,7 @@ .Nm .Fl -dangling .Op Fl a Ar author +.Op Fl c Ar committer .Op Fl -all .Op Fl -origin Ar branch .Op Fl r Ar remote @@ -84,7 +86,7 @@ scans the origin branch for commits with tags whose waiting period has elapsed and which have not already been cherry-picked to the current branch. Commits that have been reverted upstream are excluded. -By default, only commits authored by the current user +By default, only commits committed by the current user .Pq as determined by Xr git-config 1 are shown. .It @@ -96,7 +98,7 @@ Instead, finds commits in the current branch that have been cherry-picked from the origin branch but are missing associated fixup commits. Fixup commits that have been reverted upstream are excluded. -By default, only cherry-picks authored by the current user +By default, only cherry-picks committed by the current user .Pq as determined by Xr git-config 1 are considered. .El @@ -109,6 +111,13 @@ With or .Fl -dangling , filter results to commits whose author email contains the given string. +By default, the author field of commits is ignored. +.It Fl c Ar committer , Fl -committer Ar committer +With +.Fl -pending +or +.Fl -dangling , +filter results to commits whose committer email contains the given string. By default, the value of .Va user.email from From nobody Fri Jul 10 14:46:44 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 4gxZR84sKJz6lFbx for ; Fri, 10 Jul 2026 14:46:44 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxZR82mVLz3wJl for ; Fri, 10 Jul 2026 14:46:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783694804; 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=AN+DA4xE7aG0JTurALc5xR9KYoxgwKvox22jpP01B+4=; b=c1nxg/zvimY9sqJwbV/dJfMN9BLB39TvU8RFTdir4v75008cSP6qnPfkR3ijykUn3vj16r mw09h1osRx6ZgJMrOqze6+UuGoTDfODoPPURaXOgVSLZbsY/IuHZ4a1sg4a1TIc0tjOz6J gV5SDPiNlw8saIuTE327NGI9CMJnMMhb/TD5Nk1pGmkAxCBGGdcQp0N5881MOcZn566mTs i+BhWyNdDeYvzzl5GN04pADFuZC98wxp97AdYlJs5umvwahSp3LHp0Qu3++PA067eLyI/s tPeK5eFNMAGE8ajDSVNLPtHxf2lmdSKLl6y2G+8trVc2yDyFdtyWHyXs2r2ckw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783694804; a=rsa-sha256; cv=none; b=VJYMbjPPRpfvPU6P+ZDDCzlpHqvdcLuD/qgb+IbuTBLatgYgdT42tCjvgjcWjjHXXDnKOt k5InHSTAnaJNqmJl1E4DIgYgormSze2ukXd5tEf2DI0Okc+H6S9r66xxlWdMI9DfD46oHA aVnhSNcdSoqveTLeZ4niIf/HfL0m9PejyWfmD+rpwgHZADGlObyqsNhgNng+BYv3e08rqj j95p8BH80oU58n2XbG7FFsxGZ82hQjiMYnjmgj86yn+ka4AhTMVAP55yMFcMW+6i+m/A5R G1I5jjs6aCtdynw46TrZzsVwRfGYKTgmP1laRxD2qeOSALRlACPjgkz1jkNIGg== 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=1783694804; 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=AN+DA4xE7aG0JTurALc5xR9KYoxgwKvox22jpP01B+4=; b=K9kp2IxPwlxcMmj35oFEWa/yRbdJTm3/ZpLNZk84i3EAFrRT//VAWUJ47iL9EjUPSOC3c/ tX5L+N3T7jggP+REPTqxCFD5nvelZEI2FkQlFPCExEW4a0gaKzeU9P6Biab5qr2xQWqcPC C1+EnlY4WDFFvQ5TipDyLMDKDHfZf2e+rZtSl7U3pp4eJFs1zZEn+1WEl+lyt6aYaTm/Gv hReby+o7V/juwnoLIq2bo/+oZOgMMfqtE0jfNBP5YRZ6SEqdZ4/CkTYvYNPz/z08IDt/c7 q6tNTfO+bpRinQtfr6J64brE+dO2V4i2+bW7VVzM7ehTUN+dil6TxSqbrZ5n7g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxZR81Cfhzyp4 for ; Fri, 10 Jul 2026 14:46:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27bcb by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 14:46:44 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 59a4b6c2a065 - main - git-mfc: Cherry-pick all commits in one git command 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: 59a4b6c2a06512bc7b62fdfe16df4afed355d2e5 Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 14:46:44 +0000 Message-Id: <6a5105d4.27bcb.3486712e@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=59a4b6c2a06512bc7b62fdfe16df4afed355d2e5 commit 59a4b6c2a06512bc7b62fdfe16df4afed355d2e5 Author: Mark Johnston AuthorDate: 2026-07-10 14:44:33 +0000 Commit: Mark Johnston CommitDate: 2026-07-10 14:46:31 +0000 git-mfc: Cherry-pick all commits in one git command This allows one to resume from a conflict with a plain `git cherry-pick --continue`, whereas before one would have to re-run the original git-mfc command after resolving the conflict and running `git cherry-pick --continue`. Suggested by: des Reviewed by: des Differential Revision: https://reviews.freebsd.org/D58129 --- tools/tools/git/git-mfc | 16 +++++++++------- tools/tools/git/git-mfc.1 | 11 +++++++---- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/tools/tools/git/git-mfc b/tools/tools/git/git-mfc index 513a7f150e3c..42fb4f169412 100755 --- a/tools/tools/git/git-mfc +++ b/tools/tools/git/git-mfc @@ -360,17 +360,16 @@ def pending(repo, upstream, author=None, committer=None, baking=False): return list(results.values()) -def cherry_pick(commit, edit=False): - """Cherry-pick a single commit with -x. Abort on failure.""" +def cherry_pick(commits, edit=False): + """Cherry-pick a list of commits with -x. Abort on failure.""" cmd = ['git', 'cherry-pick', '-x', '-m1'] if edit: cmd.append('-e') - cmd.append(commit.hexsha) + cmd.extend([c.hexsha for c in commits]) result = subprocess.run(cmd, capture_output=False) if result.returncode != 0: - print(f"\nCherry-pick of {commit.hexsha} ({commit.summary}) failed.", - file=sys.stderr) - print("Resolve the conflict and then re-run git mfc to continue,", + print("\nCherry-pick failed.", file=sys.stderr) + print("Resolve the conflict and run 'git cherry-pick --continue',", file=sys.stderr) print("or run 'git cherry-pick --abort' to give up.", file=sys.stderr) sys.exit(1) @@ -521,13 +520,16 @@ def main(): print(commit.hexsha, commit.summary) return + topick = [] for commit in tomfc: if commit.hexsha in already_picked: print(f"Skipping {commit.hexsha[:12]} {commit.summary} " f"(already cherry-picked)") continue print(f"Cherry-picking {commit.hexsha[:12]} {commit.summary}") - cherry_pick(commit, edit=args.edit) + topick.append(commit) + if topick: + cherry_pick(topick, edit=args.edit) if __name__ == '__main__': diff --git a/tools/tools/git/git-mfc.1 b/tools/tools/git/git-mfc.1 index a730eae7ee6b..2594446201c2 100644 --- a/tools/tools/git/git-mfc.1 +++ b/tools/tools/git/git-mfc.1 @@ -68,13 +68,16 @@ Fixup commits that have been reverted are skipped with a warning. .Pp Commits that have already been cherry-picked to the current branch are automatically skipped. -This allows the same -.Nm -command to be re-run after resolving a conflict without re-applying -earlier commits. Use .Fl f to override this behavior. +.Pp +All commits are cherry-picked using a single +.Xr git-cherry-pick 1 +invocation. +If a conflict occurs, resolve it and run +.Dq git cherry-pick --continue +to proceed with the remaining commits. .It In .Fl -pending From nobody Fri Jul 10 14:58:34 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 4gxZhp3kJhz6lG5l for ; Fri, 10 Jul 2026 14:58:34 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxZhp2zsMz3xWY for ; Fri, 10 Jul 2026 14:58:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783695514; 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=oIId9tWBaBTh5jHnnZUfODbjEB3F7tlZA3UkqHyq2/k=; b=DomvT3ab1BRUcgroD/JH/+7XDejVeM20UuJzDX8nckKNhYB/iLRk/aC3e+5QPHLGexlbbm aieEQr6I4ugG5hcD25HIUDxC2+avnhRcvZmZSRYbp1+9ttYJxSEtUhoWz8JmIi3dTQXzbB s9dSB+0HciIzPI9iQz0BB5XHjq6VLDSt7BI4t3qYTcBk3rC9HKHKd4MJyTo+qHG0CSQdJ3 kLiXQyAwNVGqz2JVBodTyCxh5Q2m6HBbGw6tlE3iW4fFtiiHbytjp5I8rfoUvmVUT7VfaZ js7l2s4Bg8AkFLUU3ZgEp8dx9y5PhJSJFMVi+Ls5EToA+YZEi6uh/tSIW4hDQQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783695514; a=rsa-sha256; cv=none; b=WjAQFCKu4blZVEyk1TuwIxRHqzQjAbS0oQ43YXKQ8XzxOEjpzWALFKhO3zUQGQlm+jdAYf YR8fS3PRg+BmsL+XPhDxOEtach3+zhkbovYLgBoEycOD1I4c2CmTuaChf+KfsD/jUrTCW6 szNLok/QZFezsNBY6Wn8iC1QbeVQr1u/p80rueiq/B/7PQ1DBpWNKp9fzA8LFstHhP2W8d NmQHhRWO6iih1EoAD3v/wndo/2lu1RInN5aNicJUiixf8r4MPjEhcPsy5f4jlCix+rvX+x Rele7Zrq5DScIuty2XQYx34lomPu6CSQQPBIMl5oaae/nJqMySfes1wnVDxvIg== 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=1783695514; 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=oIId9tWBaBTh5jHnnZUfODbjEB3F7tlZA3UkqHyq2/k=; b=AgHrYAf6sIfqPY8WOVmxV9mztrotNy1N5qFekwL/8CQqQazFTH6OvWnQgT5se1jzhlDwu/ isPEmLuLyyXlTJmscWe37w1HxXhp8qlEe/gB+lhhJh1hjdwerckGBg8SCRNd5EyNYqKqhj BkUKfmJmrFzHuMoh9korQai5ELC7jpEtVsYygC5a0KAfo/IvHWiIFPsVPe97ypWqVkwBYf vr0rfMt7rSvLg24h8JBQyFnB/Np4pOZwbGMnIHvKmloIGa4B33rysRAzESvXgXv+xQ7HH6 6/3eIFSFqGVG4JioauD2yRHQub1o+sb5c32rcOW4gRCEyF0mTPZ5VDbnXqI7BA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxZhp1rQlz10SW for ; Fri, 10 Jul 2026 14:58:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 31201 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 14:58:34 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: c18512056301 - main - readelf: Add support for ELF package metadata note 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c18512056301fa97dd31c4cc9a78e18f1aa8b2d5 Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 14:58:34 +0000 Message-Id: <6a51089a.31201.763338f6@gitrepo.freebsd.org> The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=c18512056301fa97dd31c4cc9a78e18f1aa8b2d5 commit c18512056301fa97dd31c4cc9a78e18f1aa8b2d5 Author: Ed Maste AuthorDate: 2022-04-20 14:12:06 +0000 Commit: Ed Maste CommitDate: 2026-07-10 14:58:15 +0000 readelf: Add support for ELF package metadata note We don't use this note type today, but as a general purpose ELF diagnostic tool readelf(1) ought to decode it. References: https://fedoraproject.org/wiki/Changes/Package_information_on_ELF_objects https://systemd.io/ELF_PACKAGE_METADATA/ Reviewed by: fuz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D47524 --- contrib/elftoolchain/readelf/readelf.c | 38 +++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/contrib/elftoolchain/readelf/readelf.c b/contrib/elftoolchain/readelf/readelf.c index 43585459d82e..d49505756fef 100644 --- a/contrib/elftoolchain/readelf/readelf.c +++ b/contrib/elftoolchain/readelf/readelf.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -371,6 +372,7 @@ static int loc_at_comparator(const void *la1, const void *la2); static const char *mips_abi_fp(uint64_t fp); static const char *note_type(const char *note_name, unsigned int et, unsigned int nt); +static const char *note_type_fdo(unsigned int nt); static const char *note_type_freebsd(unsigned int nt); static const char *note_type_freebsd_core(unsigned int nt); static const char *note_type_go(unsigned int nt); @@ -1150,6 +1152,8 @@ note_type(const char *name, unsigned int et, unsigned int nt) return note_type_freebsd_core(nt); else return note_type_freebsd(nt); + else if (strcmp(name, "FDO") == 0 && et != ET_CORE) + return note_type_fdo(nt); else if (strcmp(name, "GNU") == 0 && et != ET_CORE) return note_type_gnu(nt); else if (strcmp(name, "Go") == 0 && et != ET_CORE) @@ -1163,6 +1167,15 @@ note_type(const char *name, unsigned int et, unsigned int nt) return note_type_unknown(nt); } +static const char * +note_type_fdo(unsigned int nt) +{ + switch (nt) { + case NT_FDO_PACKAGING_METADATA: return "NT_FDO_PACKAGING_METADATA"; + default: return (note_type_unknown(nt)); + } +} + static const char * note_type_freebsd(unsigned int nt) { @@ -3819,7 +3832,30 @@ dump_notes_data(struct readelf *re, const char *name, uint32_t type, } ubuf = (const uint32_t *)(const void *)buf; - if (strcmp(name, "FreeBSD") == 0) { + if (strcmp(name, "FDO") == 0) { + switch (type) { + case NT_FDO_PACKAGING_METADATA: + { + char *visbuf; + + if (sz > SIZE_MAX / 4 - 1) { + warnx("invalid note data"); + return; + } + /* Ignore trailing NULs. */ + while (sz > 0 && buf[sz - 1] == '\0') { + sz--; + } + if ((visbuf = malloc(sz * 4 + 1)) == NULL) { + err(1, "malloc"); + } + (void)strvisx(visbuf, buf, sz, VIS_CSTYLE); + printf(" Package metadata: %s\n", visbuf); + free(visbuf); + return; + } + } + } else if (strcmp(name, "FreeBSD") == 0) { switch (type) { case NT_FREEBSD_ABI_TAG: if (sz != 4) From nobody Fri Jul 10 15:05:41 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 4gxZs13SN8z6lGt1 for ; Fri, 10 Jul 2026 15:05:41 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxZs130BCz40FK for ; Fri, 10 Jul 2026 15:05:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783695941; 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=no48WEwm9g285+TkCe+pc9hjwjf5pF8J1NanIBDWwgE=; b=IZ9Dq9hnrbPS5Pr5m5DZH2SWe0s1MuC4CN3nr7goMTGd8FfC+b9/qaJlGC6IavkpFzbYTd Daff4svGr6oMs25k8EFMCzPwtJrpwxSoB7QfIAbyu7yin2+OjNCAWJzqQEIrJIA3nHHlkI XcWRiN/v8ar9Osw2g11x0mFmdno5yEwQERSWK58StpDD0UI5/I/Ygl7hvjAeGQAg7STOLF hEVdHH0UkHYAFjRSj104/v4TNox1m7hxwalYlF4yC8rVFTGB69YI6HAj9QQr/BBrIbCNCq y4zKhc13vxc9+lig9UZeGOFTzgKe/QaU781ayX7Y6kaixhL/XEIlA+/z9qJZnw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783695941; a=rsa-sha256; cv=none; b=I1rbUoI8uGSUILcvVDsW+Hz+73KH7UbHzyT/SVhh57GCAjH1+wBKwO/vCjSJ5DFA7YfJjn ZhIIifWSGaULMOyvpL5PooLN4A+8Y4B50LzGgwtWsj3AN1+mI2Gf74nB2V2oBlr0l2OV+b zu/ol0jRzfctL891rDSTKVx9dZB8gsEj0CQPS9ilDLe1yHdz1k/rYJlnZ5uZDmVuSa9ufl 77bYOwYPrgelBm4Xkr2h6dXjmCaKNlAQdb9bVJV3BYGWF15ESenEZlh4Gs+8NN9OY37ChU iApXTlfeEmxzzQDxHzLsl8K1IGskQZB+o0NRcl9VHsvYQczPh4DUPrIT1Eh2zg== 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=1783695941; 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=no48WEwm9g285+TkCe+pc9hjwjf5pF8J1NanIBDWwgE=; b=uLnNkLK9OkkM9mU9fZvj9eoO4dG9EIMkSpV8In0JixguVWo86TENkQnzKKimuZBdaS3/p9 gBUKccLnqg71MkDiNCvyP2A7drxDk1wwi/IiJ5i+JOPBNZI0zsmaeFfCqU68TzXZG6CJvv HfA+0EDLPV0p9RNnFLTM98FE+ggrjg/OfTW1nFa9eIZGuebRoj4Ok+P5ToSxRJwfuWlcPs wuW26n0B3iMFXwPVpJCFgQ2JNIoxS7vy6/Yqlgkh9ws6NAroQgfteeceAlzUj1Vcd5Oas6 cABfk6PWn2bQAOcf2kxUgXmoJyuCgFkh/pjAJE0E/varesgie7dJzsNOYQ2BgA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxZs11fSTz10Sq for ; Fri, 10 Jul 2026 15:05:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 304a5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 15:05:41 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 7fde3e62231a - main - beinstall: Avoid chrooting into new world 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7fde3e62231ac397a779e4fef729908c5ef6f53a Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 15:05:41 +0000 Message-Id: <6a510a45.304a5.51570bd4@gitrepo.freebsd.org> The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=7fde3e62231ac397a779e4fef729908c5ef6f53a commit 7fde3e62231ac397a779e4fef729908c5ef6f53a Author: Ed Maste AuthorDate: 2025-06-04 13:33:30 +0000 Commit: Ed Maste CommitDate: 2026-07-10 15:04:45 +0000 beinstall: Avoid chrooting into new world The new world may use system calls that are not in the currently-running kernel, so we cannot chroot into the new environment to run `make installworld`, `etcupdate`, etc. Partially revert commit 16702050ac95 ("beinstall: perform pre-installworld steps") and switch back to using DESTDIR for installworld and so on. Reported by: olivier Reviewed by: olivier Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50682 --- tools/build/beinstall.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/build/beinstall.sh b/tools/build/beinstall.sh index dcafd1030c91..e4ae4a81617b 100755 --- a/tools/build/beinstall.sh +++ b/tools/build/beinstall.sh @@ -125,9 +125,8 @@ update_etcupdate_pre() { } update_etcupdate() { - chroot ${BE_MNTPT} \ - ${ETCUPDATE_CMD} -s ${srcdir} ${ETCUPDATE_FLAGS} || return $? - chroot ${BE_MNTPT} ${ETCUPDATE_CMD} resolve + ${ETCUPDATE_CMD} -s ${srcdir} ${ETCUPDATE_FLAGS} || return $? + ${ETCUPDATE_CMD} resolve -D ${BE_MNTPT} } @@ -216,7 +215,7 @@ mount -t nullfs "${srcdir}" "${BE_MNTPT}${srcdir}" || errx "Unable to mount src" mount -t nullfs "${objdir}" "${BE_MNTPT}${objdir}" || errx "Unable to mount obj" mount -t devfs devfs "${BE_MNTPT}/dev" || errx "Unable to mount devfs" -chroot ${BE_MNTPT} make "$@" -C ${srcdir} installworld || \ +make "$@" DESTDIR=${BE_MNTPT} -DDB_FROM_SRC installworld || \ errx "Installworld failed!" if [ -n "${CONFIG_UPDATER}" ]; then From nobody Fri Jul 10 15:20:47 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 4gxbBS0cvJz6lHHR for ; Fri, 10 Jul 2026 15:20:48 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxbBR73X0z432r for ; Fri, 10 Jul 2026 15:20:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783696848; 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=4QKvctlNoFuWTBaxcRzlhbVM80mw7Rnd6hV61TVPhzg=; b=ipKEcJ/8LvBcncUnqrmku43NDYsV/tf5E3/+LkKYZ0wdBv3Gpc+6fR4vXrivBzuaXMHVOD 6Kroo8k/XcXFjx73gM45mZnHed2vi5RoYUAqNaDBSdbnOSOCHjf+Av9KhTzlpBQ9zdCitB AZzwh/gqgR3f9cIDSxydvhlHT05+p1UR4L7to0rPkpyv6W0kQt9VE9ToemqteCv9UynePP Fm05TFOBgFzEZfYRIKgrFFHD1Q9vlxViTFZ1j29t5xMOvdZ4XJf6qzooijmqbzZcLsvmph zFjI591g+3FoLEBgFhGjSjUV4G41Yd03H68pz5O6RpJi4WcD6U16/DQMnkEBAg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783696848; a=rsa-sha256; cv=none; b=QZGxXq2djmwZsOr3CGCQA4gTMT3HhcBQdhSZgIv30VLRe/8/7+gu876giFaIEJ/PDSUoIB jtCTxMVXylnTRsLqqeiL0iRHQVYvAFZl/y0YyXrobvzQNkkk4I//550ErClGo8y0lAV2NJ GdOO7qWPfL7Sp89uZqRpwv61r16xfdBRQgHHrhP35Wva+SMKeEOfcQEbKV74R7mkde8Sbb AlwJDOOGgb6AzHYfqer1/cHx+T4o/V9hGW9nIPEXB2jI0FfvYA1GaqTK+8klJ0lIEIuiky +vzHR3yz7c78rzGlSkHEdjYbT6iiAvtTgKr227ufvrrbQe2PsiBJs3xCmBHviw== 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=1783696848; 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=4QKvctlNoFuWTBaxcRzlhbVM80mw7Rnd6hV61TVPhzg=; b=URBhhrTWELt9LLYZjzY2gQYC2R3FgnqeEOC1mFHtH7s+YgQUF79eT7RDlDlOQMZEyWbjBC iwJaqMi86CMFLhWNPbfZzrt5MzwCBLOzWBou9r8m5hJIxUY0doNBWQynzvaT0UehZJQQwk Cqfzol4qdsp4xbUa7ugPFWAgVRix2AZBZX7T7tKGLtlF/mkmzmU5nOweX57IudeNBv/8eJ b1t4wif5v1czqaCmq7bEopTLCTvwfi49PP9wcVXGK7ZxwFQ1UYiosQCN53YyrJYNmFLNWt 6pwbf1z+gXx4Qx9Z9y4ef9nNbVqduJQ0emLi3oSk9qAhqJ0t2hS2+Ffy0jlttQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxbBR5ZZrz10CJ for ; Fri, 10 Jul 2026 15:20:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3331e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 15:20:47 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: ae0a3632b508 - main - build: Retire LLVM_COV src.conf knob 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ae0a3632b5080b953e138b69d2b96de54d9be8a3 Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 15:20:47 +0000 Message-Id: <6a510dcf.3331e.767e580f@gitrepo.freebsd.org> The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=ae0a3632b5080b953e138b69d2b96de54d9be8a3 commit ae0a3632b5080b953e138b69d2b96de54d9be8a3 Author: Ed Maste AuthorDate: 2026-05-04 14:34:07 +0000 Commit: Ed Maste CommitDate: 2026-07-10 15:20:34 +0000 build: Retire LLVM_COV src.conf knob I introduced it in commit 1b49115a40ad ("Promote llvm-cov to a standalone option"). llvm-cov was previously enabled as part of the CLANG_EXTRAS option. I made it a standalone, default-enabled option for parity with the tools provided by the GCC-based toolchain. We no longer provide an in-tree GCC toolchain. Now, just build llvm-cov along with Clang to simplify build infrastructure. Reviewed by: dim Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D58155 --- lib/clang/libllvm/Makefile | 5 ++--- share/man/man5/src.conf.5 | 10 +--------- share/mk/src.opts.mk | 2 -- tools/build/mk/OptionalObsoleteFiles.inc | 4 ++-- tools/build/options/WITHOUT_LLVM_COV | 3 --- tools/build/options/WITH_LLVM_COV | 3 --- usr.bin/clang/Makefile | 2 +- usr.bin/clang/toolchain/Makefile | 2 -- 8 files changed, 6 insertions(+), 25 deletions(-) diff --git a/lib/clang/libllvm/Makefile b/lib/clang/libllvm/Makefile index ea90b37f8cbd..a234c73b15b9 100644 --- a/lib/clang/libllvm/Makefile +++ b/lib/clang/libllvm/Makefile @@ -2205,10 +2205,9 @@ SRCS_ALL+= ${SRCS_XDL} .if ${MK_CLANG_EXTRAS} != "no" || ${MK_LLDB} != "no" || !defined(TOOLS_PREFIX) SRCS_ALL+= ${SRCS_XDW} .endif -.if ${MK_LLVM_COV} != "no" +# LLVM_COV retired, just part of Clang now SRCS_ALL+= ${SRCS_COV} -.endif -.if ${MK_LLVM_COV} != "no" || ${MK_LLD} != "no" || \ +.if ${MK_LLD} != "no" || \ (defined(TOOLS_PREFIX) && ${MK_LLD_BOOTSTRAP} != "no") SRCS_ALL+= ${SRCS_COL} .endif diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index b1c511f596ef..c9c9c01cbc99 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,5 +1,5 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. -.Dd July 9, 2026 +.Dd July 10, 2026 .Dt SRC.CONF 5 .Os .Sh NAME @@ -397,8 +397,6 @@ When set, it enforces these options: .Va WITHOUT_CLANG_FORMAT .It .Va WITHOUT_CLANG_FULL -.It -.Va WITHOUT_LLVM_COV .El .Pp When set, these options are also in effect: @@ -993,10 +991,6 @@ To be able to build the system alternate binary utilities must be provided via and .Ev XSTRIPBIN . -.It Va WITHOUT_LLVM_COV -Do not build the -.Xr llvm-cov 1 -tool. .It Va WITH_LLVM_FULL_DEBUGINFO Generate full debug information for LLVM libraries and tools, which uses more disk space and build resources, but allows for easier debugging. @@ -1841,8 +1835,6 @@ When set, it enforces these options: .Va WITHOUT_LLD .It .Va WITHOUT_LLDB -.It -.Va WITHOUT_LLVM_COV .El .Pp When set, these options are also in effect: diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 1dbd1d2d9703..13136b174860 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -124,7 +124,6 @@ __DEFAULT_YES_OPTIONS = \ LLVM_ASSERTIONS \ LLVM_BINUTILS \ LLVM_BINUTILS_BOOTSTRAP \ - LLVM_COV \ LOADER_BIOS \ LOADER_BIOS_TEXTONLY \ LOADER_GELI \ @@ -511,7 +510,6 @@ MK_LLVM_BINUTILS:= no MK_CLANG_EXTRAS:= no MK_CLANG_FORMAT:= no MK_CLANG_FULL:= no -MK_LLVM_COV:= no .endif .if ${MK_ASAN} == "yes" diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index e46618644f7d..842ecec362a6 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -895,7 +895,7 @@ OLD_LIBS+=usr/lib/libprivateclang.so.21 .endif .if (${MK_CLANG_EXTRAS} == no && ${MK_CLANG} == no && ${MK_LLDB} == no && \ - ${MK_LLD} == no && ${MK_LLVM_BINUTILS} == no && ${MK_LLVM_COV} == no) || \ + ${MK_LLD} == no && ${MK_LLVM_BINUTILS} == no) || \ ${MK_LLVM_LINK_STATIC_LIBRARIES} != no OLD_LIBS+=usr/lib/libprivatellvm.so.21 .endif @@ -3925,7 +3925,7 @@ OLD_FILES+=usr/share/man/man1/lldb-server.1.gz OLD_FILES+=usr/share/man/man1/lldb.1.gz .endif -.if ${MK_LLVM_COV} == no +.if ${MK_CLANG} == no OLD_FILES+=usr/bin/gcov OLD_FILES+=usr/bin/llvm-cov OLD_FILES+=usr/bin/llvm-profdata diff --git a/tools/build/options/WITHOUT_LLVM_COV b/tools/build/options/WITHOUT_LLVM_COV deleted file mode 100644 index d95e76ddf659..000000000000 --- a/tools/build/options/WITHOUT_LLVM_COV +++ /dev/null @@ -1,3 +0,0 @@ -Do not build the -.Xr llvm-cov 1 -tool. diff --git a/tools/build/options/WITH_LLVM_COV b/tools/build/options/WITH_LLVM_COV deleted file mode 100644 index 8cfe078ee231..000000000000 --- a/tools/build/options/WITH_LLVM_COV +++ /dev/null @@ -1,3 +0,0 @@ -Build the -.Xr llvm-cov 1 -tool. diff --git a/usr.bin/clang/Makefile b/usr.bin/clang/Makefile index 1d80fad2936f..3252e077d42f 100644 --- a/usr.bin/clang/Makefile +++ b/usr.bin/clang/Makefile @@ -62,7 +62,7 @@ SUBDIR+= lld SUBDIR+= lldb SUBDIR+= lldb-server .endif -.if ${MK_LLVM_COV} != "no" +.if ${MK_CLANG} != "no" SUBDIR+= llvm-cov SUBDIR+= llvm-profdata SUBDIR_DEPEND_toolchain= llvm-cov diff --git a/usr.bin/clang/toolchain/Makefile b/usr.bin/clang/toolchain/Makefile index 5f66ae1433b1..728c945bea10 100644 --- a/usr.bin/clang/toolchain/Makefile +++ b/usr.bin/clang/toolchain/Makefile @@ -7,10 +7,8 @@ SYMLINKS+= llvm-ar ${BINDIR}/ar SYMLINKS+= llvm-ranlib ${BINDIR}/ranlib MLINKS+= llvm-ar.1 ar.1 llvm-ar.1 ranlib.1 -.if ${MK_LLVM_COV} != "no" SYMLINKS+= llvm-cov ${BINDIR}/gcov MLINKS= llvm-cov.1 gcov.1 -.endif SYMLINKS+= llvm-cxxfilt ${BINDIR}/c++filt MLINKS+= llvm-cxxfilt.1 c++filt.1 From nobody Fri Jul 10 15:30:38 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 4gxbPp2GNFz6lJNJ for ; Fri, 10 Jul 2026 15:30:38 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxbPp1Pfyz46B2 for ; Fri, 10 Jul 2026 15:30:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783697438; 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=O3lW97mJ+28njA6TOt7oWNovrewLBCVuzCIcP61ilGE=; b=suxU+Uao9SE6SzNghy2mByzPnl4rfx0vkP8Rak4fTTg7ILPbfjXD2NWUE812hrmYEtoOew GK99Z70MZGob0v91MXLBfFIwx6HEHWxXeRWx4TpYwPS5ArQtU9Ze0AdFwCP8fQZ3VBTnNg BSzoHy6xzHx3hdgSeKWz+5tKB/InyGisLtATI9ozea+shCLXpvpRBhTMryz7/rxra0EnBL 5+b08vKmkm9BLBXP0dlqrOWO/rxlBIdRCULMrHyeWSaNX0stqv5nvsrjbPaUGAm0R4nSga SQs+7QmNy3XmduERfM6LjcoHRGl79JwzzeRs7SNAlYMoKkXCZJQDZomL3xn+qg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783697438; a=rsa-sha256; cv=none; b=ehEeIrHTsbMRHz9iITXeUnsvhwOOevJ4fFeYpFm9aa20lm7rPLrDwOXeedTkT/gOvIYTAm Qchyw9SsaGOAizy0s4H8723oCVOdPYhwmVJVtswvCGBkMNVQ+ay0fVvHKuhTimpM1+yDNT 9cFNRY3RSfPXfOsm+3VyPxkYG9iG2f2bGl/WNlhiihQi5Lxz4G/IBhWcMl0xaM/umli6Va YT7mzomM04TlzCRH4qcMo+gj9HKlVkNlUxo7mVLzl4RHo681yznmoqX5AjKrSnye1XD9F0 3496KhZhr4q8IBw0su/Y6ma7ATR6RkO+iAIT05JiUnbfsGCIOyNtc4yETK3p/w== 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=1783697438; 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=O3lW97mJ+28njA6TOt7oWNovrewLBCVuzCIcP61ilGE=; b=eI0Ba+OpXe4KOylPLLxysluPW/IXTFl1ZAO0h62Nz+VgVzY2oU0v7ocQ/5NGbbbvKtLOsg q8nH1ZuGuaL4RMSz+iYrDpyDf3LwXfmwpF/Q36+gK8pPnA1Vjl3BpuCBImB3jfJRlsFzA7 7BMIEHAobieK0Fl8gPYzLTarcNlwxnlyIIyyRGfpX/6tZ4ZVBJaqlvysXNKZzjFjCF4l5F OxcWIv4d+KdgD/+DOP2Qu1cQ5Cn11/bK9Qi8CO/hPmwc8iYTHWMIKnFVHZE526XGi12YkC B62BDrt6jVeUfNS/EuN79lDCzRXlqIsJKioZN2/1TVJ8u0SUZCmG4AoIYr6RdA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxbPp0V6wz11BH for ; Fri, 10 Jul 2026 15:30:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3393e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 15:30:38 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 060ecf296664 - main - x86/local_apic.c: Factor out version read and max LVT slot computation 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 060ecf296664fd150328ac6dcdc24764a427bc3a Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 15:30:38 +0000 Message-Id: <6a51101e.3393e.12c5ed2c@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=060ecf296664fd150328ac6dcdc24764a427bc3a commit 060ecf296664fd150328ac6dcdc24764a427bc3a Author: Olivier Certner AuthorDate: 2026-07-08 12:59:28 +0000 Commit: Olivier Certner CommitDate: 2026-07-10 15:29:44 +0000 x86/local_apic.c: Factor out version read and max LVT slot computation This makes the code slightly more compact and easier to read. No functional change intended. Reviewed by: bnovkov MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D58110 --- sys/x86/x86/local_apic.c | 72 ++++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c index 9e1c1d70aea7..73ddf9115e4c 100644 --- a/sys/x86/x86/local_apic.c +++ b/sys/x86/x86/local_apic.c @@ -333,16 +333,6 @@ SYSCTL_INT(_hw_apic, OID_AUTO, ds_idle_timeout, CTLFLAG_RWTUN, static void lapic_calibrate_initcount(struct lapic *la); -/* - * Calculate the max index of the present LVT entry from the value of - * the LAPIC version register. - */ -static int -lapic_maxlvt(uint32_t version) -{ - return ((version & APIC_VER_MAXLVT) >> MAXLVTSHIFT); -} - /* * Use __nosanitizethread to exempt the LAPIC I/O accessors from KCSan * instrumentation. Otherwise, if x2APIC is not available, use of the global @@ -390,6 +380,28 @@ lapic_write32_nofence(enum LAPIC_REGISTERS reg, uint32_t val) } } +static inline uint32_t __pure2 +lapic_version(void) +{ + return (lapic_read32(LAPIC_VERSION)); +} + +/* + * Calculate the max index of the present LVT entry from the value of + * the LAPIC version register. + */ +static inline int __pure2 +lapic_version_maxlvt(uint32_t version) +{ + return ((version & APIC_VER_MAXLVT) >> MAXLVTSHIFT); +} + +static inline int __pure2 +lapic_maxlvt(void) +{ + return (lapic_version_maxlvt(lapic_version())); +} + #ifdef SMP static uint64_t lapic_read_icr_lo(void) @@ -648,7 +660,7 @@ lapic_init(vm_paddr_t addr) * It seems that at least some KVM versions report * EOI_SUPPRESSION bit, but auto-EOI does not work. */ - ver = lapic_read32(LAPIC_VERSION); + ver = lapic_version(); if ((ver & APIC_VER_EOI_SUPPRESSION) != 0) { lapic_eoi_suppression = 1; if (vm_guest == VM_GUEST_KVM) { @@ -755,7 +767,7 @@ amd_read_ext_features(void) if (cpu_vendor_id != CPU_VENDOR_AMD && cpu_vendor_id != CPU_VENDOR_HYGON) return (0); - version = lapic_read32(LAPIC_VERSION); + version = lapic_version(); if ((version & APIC_VER_AMD_EXT_SPACE) != 0) return (lapic_read32(LAPIC_EXT_FEATURES)); else @@ -780,14 +792,12 @@ amd_read_elvt_count(void) void lapic_dump(const char* str) { - uint32_t version; - uint32_t maxlvt; + const uint32_t version = lapic_version(); + const int maxlvt = lapic_version_maxlvt(version); uint32_t extf; int elvt_count; int i; - version = lapic_read32(LAPIC_VERSION); - maxlvt = lapic_maxlvt(version); printf("cpu%d %s:\n", PCPU_GET(cpuid), str); printf(" ID: 0x%08x VER: 0x%08x LDR: 0x%08x DFR: 0x%08x", lapic_read32(LAPIC_ID), version, @@ -844,10 +854,8 @@ static void lapic_early_mask_vecs(void) { int elvt_count, lvts_count, i; - uint32_t version; - version = lapic_read32(LAPIC_VERSION); - lvts_count = min(nitems(lvts), lapic_maxlvt(version) + 1); + lvts_count = min(nitems(lvts), lapic_maxlvt() + 1); for (i = 0; i < lvts_count; i++) lapic_early_mask_vec(&lvts[i]); @@ -859,9 +867,9 @@ lapic_early_mask_vecs(void) void lapic_setup(int boot) { + const uint32_t version = lapic_version(); + const uint32_t maxlvt = lapic_version_maxlvt(version); struct lapic *la; - uint32_t version; - uint32_t maxlvt; register_t saveintr; int elvt_count; int i; @@ -870,8 +878,6 @@ lapic_setup(int boot) la = &lapics[lapic_id()]; KASSERT(la->la_present, ("missing APIC structure")); - version = lapic_read32(LAPIC_VERSION); - maxlvt = lapic_maxlvt(version); /* Initialize the TPR to allow all interrupts. */ lapic_set_tpr(0); @@ -1032,8 +1038,6 @@ lapic_calibrate_timer(void) int lapic_enable_pcint(void) { - u_int32_t maxlvt; - #ifdef DEV_ATPIC /* Fail if the local APIC is not present. */ if (!x2apic_mode && lapic_map == NULL) @@ -1041,8 +1045,7 @@ lapic_enable_pcint(void) #endif /* Fail if the PMC LVT is not present. */ - maxlvt = lapic_maxlvt(lapic_read32(LAPIC_VERSION)); - if (maxlvt < APIC_LVT_PMC) + if (lapic_maxlvt() < APIC_LVT_PMC) return (0); if (refcount_acquire(&pcint_refcnt) > 0) return (1); @@ -1059,8 +1062,6 @@ lapic_enable_pcint(void) void lapic_disable_pcint(void) { - u_int32_t maxlvt; - #ifdef DEV_ATPIC /* Fail if the local APIC is not present. */ if (!x2apic_mode && lapic_map == NULL) @@ -1068,8 +1069,7 @@ lapic_disable_pcint(void) #endif /* Fail if the PMC LVT is not present. */ - maxlvt = lapic_maxlvt(lapic_read32(LAPIC_VERSION)); - if (maxlvt < APIC_LVT_PMC) + if (lapic_maxlvt() < APIC_LVT_PMC) return; if (!refcount_release(&pcint_refcnt)) return; @@ -1987,19 +1987,19 @@ DB_SHOW_COMMAND_FLAGS(lapic, db_show_lapic, DB_CMD_MEMSAFE) { const struct lvt *l; int elvt_count, lvts_count, i; - uint32_t v, vr; + const uint32_t v = lapic_version(); + const int maxlvt = lapic_version_maxlvt(v); + const uint32_t vr = lapic_read32(LAPIC_SVR); db_printf("lapic ID = %d\n", lapic_id()); - v = lapic_read32(LAPIC_VERSION); db_printf("version = %d.%d (%#x) \n", (v & APIC_VER_VERSION) >> 4, v & 0xf, v); - db_printf("max LVT = %d\n", lapic_maxlvt(v)); - vr = lapic_read32(LAPIC_SVR); + db_printf("max LVT = %d\n", maxlvt); db_printf("SVR = %02x (%s)\n", vr & APIC_SVR_VECTOR, vr & APIC_SVR_ENABLE ? "enabled" : "disabled"); db_printf("TPR = %02x\n", lapic_read32(LAPIC_TPR)); - lvts_count = min(nitems(lvts), lapic_maxlvt(v) + 1); + lvts_count = min(nitems(lvts), maxlvt + 1); for (i = 0; i < lvts_count; i++) { l = &lvts[i]; db_printf("LVT%d (reg %#x %-5s) = %#010x\n", i, l->lvt_reg, From nobody Fri Jul 10 15:30:39 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 4gxbPq4F4nz6lJG2 for ; Fri, 10 Jul 2026 15:30: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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxbPq2cfQz46Dk for ; Fri, 10 Jul 2026 15:30:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783697439; 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=LO2ROiu74JlC7GR+DLovVF9oBWAlPxgokpVSQgRpDxk=; b=OWEapeoUU6emBxsKvBgCHreN4NwfQ0w/CGUJL79VlUtFvvTc8a+QiQdfHAczPoPAZHjDoy b15uURFLFpQOE+ajLOqRfCaenJ1mxVRNA51JoE0scicNiyQBMrF3T1qnZRWVbD9XE1AnpO 5dHAr8ecETQXnVuUIskYGERmexggyj/WWcXUZ6mLYIxRPWzI8u9LxmAUZLa2C4iNHTQ1jn zgA5FvEnZLXQs0cYwwyZhxVz08UPMvc1zjwYLFMV4cjjY1h5M9VQOQYBfSk3wzy6d/m5q/ 0HIZ27sPbbZF9KR4ypVyjWJVOov+u6gNI3eFRDuEeV6MEzcib1SSSPWXJYDXPg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783697439; a=rsa-sha256; cv=none; b=CW6h8lKO9P4a8x0XeX23KgLC2i8CWr/gwXuzQQquivYCefeqFNs39/v2OBuAxsLfuWkxaA m4GcYAcEArlG9tmbaUVaPMjOXmbOdlb5F9Owa5I4HlPcFgyU3e03MyZ3NbyAQBomcjLZLp n68SM6DRZPBIO/XrnnaU97EngQFILctmL3r/NfIFc5laX93nodtUDCBPVC522LqyI2orVn bDQlRFMKSXrS5tOCc0lRxgOGoi8Zf65dn7SKagIDEkp8fK5vAMtwh2QQ0ZYLvlseDBP9f1 Ogntt053zLW0sVP3LqD6bE3czwBBjyLoVG1iTix8CP17cRXdzRedTpHvZVlpXw== 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=1783697439; 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=LO2ROiu74JlC7GR+DLovVF9oBWAlPxgokpVSQgRpDxk=; b=X5D5qin7L0TMFcvwkBla+QEThCMf4Qc0f+ECrMR7sy7m6/5ALWp7Al9PkdvkHUZI9krgah jsU3tk8AIxabdG/7YwWdDQhtxYeo2vc7Kni8yigaTDe40jANLVM7frLtifS38gqsca4Nsi 8LmMQZgrys8GQOU6V0rxlR0abDIJrPTV9t8TiiQCfBRA0wmLHNOn8gA8AqYLH0rqrj0Spp R3A2c7eXqvTFSodqdGXQUiuQ4Nq+5t1BwawQbONJCwKWQDrdXVB2oVcjQorda10pKiwAIB SfoL+nUJVnjH5B1kJrn/oCYNDceR8m9dbf9u202pva7g8bZQF6e+9NNTtgI43w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxbPq1Kstz1104 for ; Fri, 10 Jul 2026 15:30:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3494b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 15:30:39 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: c18ec05395b3 - main - x86/local_apic.c: Fiddle with thermal LVT slot only if supported 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c18ec05395b36bdd12b0129533a553f27eb9b067 Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 15:30:39 +0000 Message-Id: <6a51101f.3494b.14d56633@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=c18ec05395b36bdd12b0129533a553f27eb9b067 commit c18ec05395b36bdd12b0129533a553f27eb9b067 Author: Olivier Certner AuthorDate: 2026-07-02 14:26:21 +0000 Commit: Olivier Certner CommitDate: 2026-07-10 15:29:49 +0000 x86/local_apic.c: Fiddle with thermal LVT slot only if supported The thermal LVT slot does not necessarily exist. According to Intel's Software Developers Manual, for Intel processors supporting 64-bit operation (amd64), probably even the earliest ones should have a local APIC with such a slot (the slot was introduced with Pentium 4 and Xeon processors according to the manual, and the 64-bit implementation in some later versions of them). AMD's Architecture Programmer's Manual also seems to imply that all AMD processors supporting amd64 should have the slot too. So this change may not be needed when i386's code is dropped, but it does not hurt to have it, and it might ease possible MFCs. Change the signature of lapic_enable_thermal() so that it can report failure (if there is no local APIC or if there is no thermal LVT slot). Reviewed by: bnovkov, kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D58086 --- sys/x86/include/apicvar.h | 2 +- sys/x86/x86/local_apic.c | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/sys/x86/include/apicvar.h b/sys/x86/include/apicvar.h index 54ea5bc655e5..10dbc50a981b 100644 --- a/sys/x86/include/apicvar.h +++ b/sys/x86/include/apicvar.h @@ -236,7 +236,7 @@ void apic_enable_vector(u_int apic_id, u_int vector); void apic_disable_vector(u_int apic_id, u_int vector); void apic_free_vector(u_int apic_id, u_int vector, u_int irq); void lapic_calibrate_timer(void); -void lapic_enable_thermal(lapic_thermal_handler_t *func, void *func_arg); +bool lapic_enable_thermal(lapic_thermal_handler_t *func, void *func_arg); void lapic_disable_thermal(void); int lapic_enable_pcint(void); void lapic_disable_pcint(void); diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c index 73ddf9115e4c..aceb9a229c4f 100644 --- a/sys/x86/x86/local_apic.c +++ b/sys/x86/x86/local_apic.c @@ -807,9 +807,10 @@ lapic_dump(const char* str) printf("\n lint0: 0x%08x lint1: 0x%08x TPR: 0x%08x SVR: 0x%08x\n", lapic_read32(LAPIC_LVT_LINT0), lapic_read32(LAPIC_LVT_LINT1), lapic_read32(LAPIC_TPR), lapic_read32(LAPIC_SVR)); - printf(" timer: 0x%08x therm: 0x%08x err: 0x%08x", - lapic_read32(LAPIC_LVT_TIMER), lapic_read32(LAPIC_LVT_THERMAL), + printf(" timer: 0x%08x err: 0x%08x", lapic_read32(LAPIC_LVT_TIMER), lapic_read32(LAPIC_LVT_ERROR)); + if (maxlvt >= APIC_LVT_THERMAL) + printf(" therm: 0x%08x", lapic_read32(LAPIC_LVT_THERMAL)); if (maxlvt >= APIC_LVT_PMC) printf(" pmc: 0x%08x", lapic_read32(LAPIC_LVT_PCINT)); printf("\n"); @@ -935,8 +936,9 @@ lapic_setup(int boot) lapic_write32(LAPIC_ESR, 0); /* Thermal LVT */ - lapic_write32(LAPIC_LVT_THERMAL, lvt_mode(la, APIC_LVT_THERMAL, - lapic_read32(LAPIC_LVT_THERMAL))); + if (maxlvt >= APIC_LVT_THERMAL) + lapic_write32(LAPIC_LVT_THERMAL, lvt_mode(la, APIC_LVT_THERMAL, + lapic_read32(LAPIC_LVT_THERMAL))); /* Program the CMCI LVT entry if present. */ if (maxlvt >= APIC_LVT_CMCI) { @@ -1663,15 +1665,18 @@ lapic_update_thermal(void *dummy __unused) lapic_read32(LAPIC_LVT_THERMAL))); } -void +bool lapic_enable_thermal(lapic_thermal_handler_t *func, void *func_arg) { #ifdef DEV_ATPIC /* Fail if the local APIC is not present. */ if (!x2apic_mode && lapic_map == NULL) - return; + return (false); #endif + if (lapic_maxlvt() < APIC_LVT_THERMAL) + return (false); + lapic_thermal_function_arg = func_arg; atomic_store_rel_ptr((uintptr_t *)&lapic_thermal_function, (uintptr_t)func); @@ -1680,6 +1685,8 @@ lapic_enable_thermal(lapic_thermal_handler_t *func, void *func_arg) MPASS(mp_ncpus == 1 || smp_started); smp_rendezvous(NULL, lapic_update_thermal, NULL, NULL); + + return (true); } void @@ -1691,6 +1698,9 @@ lapic_disable_thermal(void) return; #endif + if (lapic_maxlvt() < APIC_LVT_THERMAL) + return; + lvts[APIC_LVT_THERMAL].lvt_masked = 1; #ifdef SMP From nobody Fri Jul 10 16:03:42 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 4gxc7z25Ygz6lLNP for ; Fri, 10 Jul 2026 16:03:43 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxc7z16qHz3HpH for ; Fri, 10 Jul 2026 16:03:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783699423; 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=GM6U26P+i06ComgQC/Syp6gBoCPZ50iWUedTdbjG2OE=; b=moKQzFfRXuIz6fY7ry4jqQCHf+dbMrUAjHDRgoKjEo/qJ1pssaXJV+rvdtrQSpy8bE3FNO MWR1YCba81N7r72Gjoe7tLkonBL4j1/QQUEpiHj+4eE0nxcxuwMHpxkoHf8DrLlBLx+Yon wwNrKs9ufo1H/6i3KXJltLFc+A/mCPC7yFk6Jp9bHEqmV7s1rN2+7NRiClfP40+yRKEyv6 QjKIf6C7HkbKd7l9/9k2hZqVpQpN6mem9OqP5MvMrVnZ23qmHa3mL7f+VbqSRvmU1Dt47/ q+GyoceEOv+NW8AK5iVMo0fLAkQPxtxzkxROHnxZlHgQ60Vpjm8M5J3ZjDimxQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783699423; a=rsa-sha256; cv=none; b=vIQg6oPGlULeKmRoju4+KRhNRI569rCGRN0rY3cDpL4LJWGZenZAs6npPUEM/iVKH5PELm qjrxGzd2ihIrneqLeD2ChJS84l2KOlTG5tt8iZMbZABtqvkydfm39oNpN/nXBt8H+Wzw5l frcDBEaVKeYvoFXK4oBnrpJDpQEJresJmgdV1pW3sSRItuODeZZ9kNO1RUtav33PAVlYDM zlRrSTxA4kLhZAPt4GZ/bm37WIvtXdZ3JLY0hW6KuxmJKvb3C+wRDcgelLfuvIm81vZmhw yj3vKbi+3jd+f6JZOEkx8+r1pBNsZb+bTCXS9ZMviO33wrz9fMk0B4U2oCrGNQ== 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=1783699423; 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=GM6U26P+i06ComgQC/Syp6gBoCPZ50iWUedTdbjG2OE=; b=wA8HpvBIehV61/shM8ouIyrlFc4XT6bbrhcQSlxj+5IBNTcyQYckjha0mVs52WnB7T3igt 3dRWrvqJmDK8jKOxDLBJl7THwEN4Yw/TKtFiELSbJyAeY3KQb1EJ2nOYBtei7GChmASOAr Lhw8Ymw/Atm0GLdG6hxmnzohPU093Xz8pI7OHzGR1C2n7fdbW1Fzjg2XzOaUjec/eo3H9l P1+wZg7dZyHPunxUaVv1lGDpxPcYwuXdKRtCDa6LldLD2fUUsym6HIW3fxKhZjvmsFZSV5 xRd0Odpxh0vDt3D+S9Qw08PTb2VksZTSX5VhSAmic0mNM2zba7JBl22DIbWzHw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxc7y71z6z12GM for ; Fri, 10 Jul 2026 16:03:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 373b3 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 16:03:42 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bojan Novk=?utf-8?Q?ovi=C4=87?= Subject: git: 84148cc1a926 - main - riscv: Add vendor and arch IDs for the SpacemiT K1 CPU 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: bnovkov X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 84148cc1a9262452a1d39576dbb5ab7866dddf7b Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 16:03:42 +0000 Message-Id: <6a5117de.373b3.56027dc1@gitrepo.freebsd.org> The branch main has been updated by bnovkov: URL: https://cgit.FreeBSD.org/src/commit/?id=84148cc1a9262452a1d39576dbb5ab7866dddf7b commit 84148cc1a9262452a1d39576dbb5ab7866dddf7b Author: Bojan Novković AuthorDate: 2026-04-14 17:01:01 +0000 Commit: Bojan Novković CommitDate: 2026-07-10 15:51:22 +0000 riscv: Add vendor and arch IDs for the SpacemiT K1 CPU Differential Revision: https://reviews.freebsd.org/D56923 Reviewed by: mhorne --- sys/riscv/include/cpu.h | 4 ++++ sys/riscv/riscv/identcpu.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/sys/riscv/include/cpu.h b/sys/riscv/include/cpu.h index 13a9f1ca0603..59214f05f595 100644 --- a/sys/riscv/include/cpu.h +++ b/sys/riscv/include/cpu.h @@ -55,6 +55,7 @@ #define MVENDORID_UNIMPL 0x0 #define MVENDORID_SIFIVE 0x489 #define MVENDORID_THEAD 0x5b7 +#define MVENDORID_SPACEMIT 0x710 /* * Micro-architecture ID register, marchid. @@ -82,6 +83,9 @@ #define MARCHID_SIFIVE_U7 MARCHID_COMMERCIAL(7) #define MARCHID_SIFIVE_P5 MARCHID_COMMERCIAL(8) +/* SpacemiT marchid values */ +#define MARCHID_SPACEMIT_K1 MARCHID_COMMERCIAL(0x58000001) + /* * MMU virtual-addressing modes. Support for each level implies the previous, * so Sv48-enabled systems MUST support Sv39, etc. diff --git a/sys/riscv/riscv/identcpu.c b/sys/riscv/riscv/identcpu.c index 7b2d9a1d1259..3b747576db48 100644 --- a/sys/riscv/riscv/identcpu.c +++ b/sys/riscv/riscv/identcpu.c @@ -131,6 +131,11 @@ static const struct marchid_entry sifive_marchids[] = { MARCHID_END }; +static const struct marchid_entry spacemit_marchids[] = { + { MARCHID_SPACEMIT_K1, "SpacemiT(R) X60" }, + MARCHID_END +}; + /* * Known CPU vendor/manufacturer table. */ @@ -142,6 +147,7 @@ static const struct { { MVENDORID_UNIMPL, "Unspecified", NULL }, { MVENDORID_SIFIVE, "SiFive", sifive_marchids }, { MVENDORID_THEAD, "T-Head", NULL }, + { MVENDORID_SPACEMIT, "SpacemiT", spacemit_marchids }, }; /* From nobody Fri Jul 10 16:03:44 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 4gxc802RvCz6lLNQ for ; Fri, 10 Jul 2026 16:03:44 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxc801Sk7z3J62 for ; Fri, 10 Jul 2026 16:03:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783699424; 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=UPilm1OLM3rFvxO1Itklcogse/xMLU3Y6k3t/Spl+wU=; b=wed3oFyMHLpwmfAzjhkOBrot3059IBZMEeWk+wcv2jxcG+BtcLZuK/AzG97xHdygzNyUVw SgTg95zMyT3ttae9OCveg53PMlDjh2rowo95zkpFG6RoPrb6F6W1KnYUgsYhwoJckhT4x0 ZC5q1SvChsj57H3RpsT9NpARXPecvR/wjimd2SFOzlTXMWtOdiPT7Q6XXBswsvtf5BVUoV MhsjhhLZjXYoN6WL7X3gab45sdNcn0LYYtcEFxXYYvfm91n1eoUUAphGtJ9PoxbJFghAJJ lauVPELKu/faNuJC5tVx4hQ8O/RxzJdoZhkFwrZ2VzQQUSdAWMsF8HcMwrEm4Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783699424; a=rsa-sha256; cv=none; b=fF9megbYrD359NptqE0BaxJHlWjH7cmf6nlEOn22UzE7nQBJiNIs+TCqx1KGUSFMN71CoE bJwc6KsAOK0hykI9gAzYwHLOOCT5nfLvupsE+qruJXXYLnnRcECzWtXIHc4KSax11jHZz7 0nghfr32+2aQKosw9XkPEmKzfzvXi4pmpYNh1WGPu5F9x2gJXHO/R6FiszozvsoFh5D+uU ewVP03uEkNhSEnFQQV0Uu/JriI67Ub0l/6gJA11SGAzDV5QFkgs5zqjNIG4qvyshiPfHaP fu7njc9vzbIqvznGno/arA/A6QewN4dL2eMkj08Vq65JVEUWcEvdhBg7HuYOtw== 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=1783699424; 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=UPilm1OLM3rFvxO1Itklcogse/xMLU3Y6k3t/Spl+wU=; b=O0BaP62ouoC9+GM1FXDn4uECvXLfQ4Gtm4DLkYiVVRR4woWoLlDSR4M2LSmLEzh6pzQyjH c7UM3ZivdSnwAQgDBjzhUn20FMfla/sOCLFLmSuYTCzEYg8MskESF03+h21Tc/Dh7sDbKR DFVcFv+FJopnq94Jf/5x/aR7uHl80bEIDhN1B42H6JAQZnv6aDDsuMSEOXHDaULs6sXSV4 Dyz20vCOeONaGb65Z786CNn8/vJym800psJBVw5XrIFqowFnvYSjzWEdbSWjImlbioDFDj i5aho7CBawpv37PFfSTzGjaGqTFT88HKwImFigw2lzcil7x/IwYLsXi4U43xjQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxc800Mcwz11lx for ; Fri, 10 Jul 2026 16:03:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 37bff by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 16:03:44 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bojan Novk=?utf-8?Q?ovi=C4=87?= Subject: git: 10487e30c0a7 - main - riscv/pmap.c: Add a ddb command for inspecting PTEs 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: bnovkov X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 10487e30c0a70cedb2ade55e88c0dbbfc8e59f24 Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 16:03:44 +0000 Message-Id: <6a5117e0.37bff.335a1eee@gitrepo.freebsd.org> The branch main has been updated by bnovkov: URL: https://cgit.FreeBSD.org/src/commit/?id=10487e30c0a70cedb2ade55e88c0dbbfc8e59f24 commit 10487e30c0a70cedb2ade55e88c0dbbfc8e59f24 Author: Bojan Novković AuthorDate: 2026-04-14 17:02:21 +0000 Commit: Bojan Novković CommitDate: 2026-07-10 15:52:00 +0000 riscv/pmap.c: Add a ddb command for inspecting PTEs This change implements the equivalent of the amd64-specific 'show pte' ddb command used to dump the page table entries associated with a specific virtual address. Differential Revision: https://reviews.freebsd.org/D56924 Reviewed by: mhorne --- sys/riscv/riscv/pmap.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 0461400f2a7c..35194ebd7c28 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -112,6 +112,7 @@ * and to when physical maps must be made correct. */ +#include "opt_ddb.h" #include "opt_pmap.h" #include @@ -136,6 +137,10 @@ #include #include #include +#ifdef DDB +#include +#include +#endif #include #include @@ -5596,3 +5601,59 @@ SYSCTL_OID(_vm_pmap, OID_AUTO, kernel_maps, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE | CTLFLAG_SKIP, NULL, 0, sysctl_kmaps, "A", "Dump kernel address layout"); + +#ifdef DDB +DB_SHOW_COMMAND(pte, pmap_print_pte) +{ + pd_entry_t *l0, l0e, *l1, l1e; + pt_entry_t *l2, l2e, *l3, l3e; + vm_offset_t va; + pmap_t pmap; + + if (!have_addr) { + db_printf("show pte addr\n"); + return; + } + + va = (vm_offset_t)addr; + if (!VIRT_IS_VALID(va)) { + db_printf("malformed virtual address %#lx\n", va); + return; + } + + if (kdb_thread != NULL) + pmap = vmspace_pmap(kdb_thread->td_proc->p_vmspace); + else + pmap = PCPU_GET(curpmap); + + db_printf("VA 0x%016lx", va); + if (pmap_mode == PMAP_MODE_SV48) { + l0 = pmap_l0(pmap, va); + l0e = pmap_load(l0); + db_printf(" l0e@0x%016lx 0x%016lx", (uint64_t)l0, l0e); + } + l1 = pmap_l1(pmap, va); + if (l1 == NULL) { + db_printf("\n"); + return; + } + l1e = pmap_load(l1); + db_printf(" l1e@0x%016lx 0x%016lx", (uint64_t)l1, l1e); + + l2 = pmap_l2(pmap, va); + if (l2 == NULL) { + db_printf("\n"); + return; + } + l2e = pmap_load(l2); + db_printf(" l2e@0x%016lx 0x%016lx", (uint64_t)l2, l2e); + + l3 = pmap_l3(pmap, va); + if (l3 == NULL) { + db_printf("\n"); + return; + } + l3e = pmap_load(l3); + db_printf(" l3e@0x%016lx 0x%016lx\n", (uint64_t)l3, l3e); +} +#endif From nobody Fri Jul 10 16:03:45 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 4gxc8205V6z6lLnR for ; Fri, 10 Jul 2026 16:03: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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxc812RwCz3J63 for ; Fri, 10 Jul 2026 16:03:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783699425; 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=gN2+91ri0bQNsQl/cfWrAO19dcj7L39NyjeYjy8NRfc=; b=ipPt7ZILrbkljnTN7W0d8Z+JtTHXi6c2/AIJ4bHiuToDMbtgU/eOv8HB3U2TRmiT+GRWih wI1GoobPxod/xGTziM8JINBCmDPsiUz5FXB8fl6+0cJo3NvT/mbQehtaoJ3HjLQDQIPBKg UwN5fAz3fSqW92SeoAOUTvB+OmlCaaaw0BWK3srffBI99YV66rjZIDB+uFPLlz8Sc0VHit 8ZtJ9olEfj+NuL5Kza2xQ36lIc/m7TkKhEiSGCAQm2ElVMlziqXYQW45xAelvTY705KPbI 8r718mKQ8N1bLmNJzaHw0w4EiDKhL3hLqfJsd6ZqqgUIzzxZKl4YuNnBZsPIAA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783699425; a=rsa-sha256; cv=none; b=h3HLbhyZhWWPYATrjRk0tuqo4SNV0DykZa/OHdS4+/63CZ1kT2R4SA3NOpSMAEO1SsrD3o +qEfnZ+RZQWSfu1zznjo1N+IoxBhSh3FFvhY4zpqJpK7dmbrFjP4V2LEtD+9dQ2rfTOhxi yfZglskI5nc9pZMK4kB5nAPrgTqyTCI5BL6SbMnsFlJKbVk8KutGleoC+o/N8eCW/HXHw/ ldeNWmOKpq0n7McmV+1dKRTjlAjnE/8iueZOSIZdBDRmdmntZOas+2ryDZmYCQ1rBCwHam 3GN2HSre85dmpRTNBp88lajFkyRiQlAxmCo+p5Q0HpM3fhQJ8YIXrrZbhuUTwQ== 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=1783699425; 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=gN2+91ri0bQNsQl/cfWrAO19dcj7L39NyjeYjy8NRfc=; b=RKFxa79Q1jIeK/dAXpekaoDeO36ekyTXz4pKKSZ+yL+83YZgPpf1nGBcmhc4KcAvMkkx9r 3qVFlvy54nXzQbEwYfyTnrKtTucHRkaXBZW4kzG8D6Awh3vimeWWIG/pIEY5dg2uGOKygc uAmEB85Odb4/G+E27T6MoweiK3gyqam1FDR8mSCIM0RpdpEEsAiONmF4IOnMYZxWinVnQ2 hzojkt0TtdaQy/4I2U3MXl6MEVPb+CBGvFY5xAJ4VThUbqUNxMvFFMAgCZO9FKvR2evMOx riGs7BxjqbDtYx+HLAZLunh3Jo9prw398pYdNG5livadJH3KGNNdtflG0UyucQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxc811H4Gz12ZK for ; Fri, 10 Jul 2026 16:03:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 343ed by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 16:03:45 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bojan Novk=?utf-8?Q?ovi=C4=87?= Subject: git: 7489f0bf84e4 - main - riscv/mp_machdep.c: Flush the TLB after releasing APs 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: bnovkov X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7489f0bf84e4c88ad6cfbf4c8cf91bd7bede56f6 Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 16:03:45 +0000 Message-Id: <6a5117e1.343ed.375422b2@gitrepo.freebsd.org> The branch main has been updated by bnovkov: URL: https://cgit.FreeBSD.org/src/commit/?id=7489f0bf84e4c88ad6cfbf4c8cf91bd7bede56f6 commit 7489f0bf84e4c88ad6cfbf4c8cf91bd7bede56f6 Author: Bojan Novković AuthorDate: 2026-05-13 15:49:01 +0000 Commit: Bojan Novković CommitDate: 2026-07-10 15:52:52 +0000 riscv/mp_machdep.c: Flush the TLB after releasing APs Spurious page faults caused by cached invalid entries may occur when starting APs and potentially panic the kernel if we're running in a non-sleepable context. Fix this avoidable panic by flushing the TLB after the AP is released. Differential Revision: https://reviews.freebsd.org/D57003 Reviewed by: markj --- sys/riscv/riscv/mp_machdep.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/riscv/riscv/mp_machdep.c b/sys/riscv/riscv/mp_machdep.c index 235bee15ca29..9c81d9ee1043 100644 --- a/sys/riscv/riscv/mp_machdep.c +++ b/sys/riscv/riscv/mp_machdep.c @@ -172,6 +172,11 @@ init_secondary(uint64_t hart) while (!atomic_load_int(&aps_ready)) __asm __volatile("wfi"); + /* + * Flush the TLB to avoid spurious kernel page faults + * on implementations that cache invalid entries. + */ + sfence_vma(); /* Initialize curthread */ KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread")); pcpup->pc_curthread = pcpup->pc_idlethread; From nobody Fri Jul 10 16:03:46 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 4gxc826GbHz6lLSd for ; Fri, 10 Jul 2026 16:03: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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxc823BRMz3J64 for ; Fri, 10 Jul 2026 16:03:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783699426; 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=qFh701FElnvmneZ+HHRRoj2k5B/BNi0n3StLkqMNbKk=; b=vn2Ay4zc3Wg4KNAQJrmSrOmcw7p4scCXGyBTMnYVcG4YLmoenYOyp4ZNOci6/9m5ATExhH K7qZSTc0vtFGmPtrBkS5Kglo7VoN1NGy34f6Y/vP0OIH0/eI0zKtRiP3nvLTwE5WDIOGZh MVkR6HK1h3WZ5Dcua8bEAge/XrSewoVqDbqR0qf+iLdL7IfmHI88Z9bBlXYo8Xqx6UoJtl 9sJ79XgSwP6qEqSlJUry3F5q+Mk/L3JgVCpsn/bNcZj1RBcRctU14eWENlmOE/Sb0a2MGt Da1NS9iNb8MxPituGreJNSQRhdyRRV2xyMyU0n1XY5swb0ux69Wez+uYNOtYig== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783699426; a=rsa-sha256; cv=none; b=MN2yh6HQ+fkeOjLXgfN1uWbJsCXgH8XNdCtQLtA/tPUTIGw8L6/3b7tiA8FDauRfNfQvSE QcQmBZEY4gq8DyIe/r8DN++uUqZfoXu6D/rB0lKC/bV568VGSTc+giMDIWT8YoiG0ywE9m s10+ORJM1ac/gfQRFX6AJLmgtbym5AuPEVu6Q1UIlgbF5SkfnA8Ey+nOlIgl1UjhlQqFbE CvYXAUmjVwN/OTD1rHFSbAtfXSbqQfXQebycWqmInaxxTp37i75dqquYBoFyXvQ77d8Zrv /R5bJ0tWuxcBpcxgn6sNksdBGaUySC47w7bA/gff0v9yCqNdj9qhf7zVUI9n7w== 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=1783699426; 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=qFh701FElnvmneZ+HHRRoj2k5B/BNi0n3StLkqMNbKk=; b=FI5mpIOaHHw5OZMwY0p0AI+M9KENPCN7QQqxzzkCw16HryxIBkxGaW4JlbZxBKeVl2uFP9 OhEbzsBlptygrPkTXzSPLxePTMRgAbNKGuYvjIxsdln2QYtXg07Ul8261WWL6YG8VbfURH 03A/f7XtTl05MNPDBE9PdywU8IHvfXOpd/gt+iVojptE47rlV2NFbDRTw6FSkySisAkG0V 4Q+KJFKqcX7rHrzGoY13Tmn7j4iC+qfmX4Uu3Z1RI8aI6GLoIUzYum46VVpAgX7Y1CFD2/ 3I4f4HWhcxYjiR5TRgNj3yk4AsSjkln8DcllOTy484RgzN15WOxpMIWgV+UPQA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxc822FZZz12ZM for ; Fri, 10 Jul 2026 16:03:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 38ab3 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 16:03:46 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bojan Novk=?utf-8?Q?ovi=C4=87?= Subject: git: 7a5ef20a977c - main - riscv/pmap.c: Handle spurious kernel page faults in critical sections 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: bnovkov X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7a5ef20a977c2d1ae5b94e6e6e927ac7a566ff10 Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 16:03:46 +0000 Message-Id: <6a5117e2.38ab3.772cfc8c@gitrepo.freebsd.org> The branch main has been updated by bnovkov: URL: https://cgit.FreeBSD.org/src/commit/?id=7a5ef20a977c2d1ae5b94e6e6e927ac7a566ff10 commit 7a5ef20a977c2d1ae5b94e6e6e927ac7a566ff10 Author: Bojan Novković AuthorDate: 2026-06-10 19:13:03 +0000 Commit: Bojan Novković CommitDate: 2026-07-10 15:56:57 +0000 riscv/pmap.c: Handle spurious kernel page faults in critical sections The Privileged ISA specification permits caching of invalid PTEs 12.2.1. Supervisor Memory-Management Fence Instruction), which may result in a spurious page fault. Such faults are handled by 'pmap_fault' which locks the kernel pmap before inspecting and possibly updating the offending L2 entry. Unfortunately, spurious faults may also occur when we're already holding the kernel_pmap lock or running in a critical section, where any attempt to grab the pmap lock will result in a kernel panic. Fix this avoidable panic by performing a lockless lookup to determine whether a valid kernel mapping exits and flushing appropriate TLB entry. Differential Revision: https://reviews.freebsd.org/D56925 Reviewed by: jrtc27, mhorne, markj --- sys/riscv/riscv/pmap.c | 46 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 35194ebd7c28..67123f9bfcc8 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -2911,28 +2911,52 @@ retryl3: PMAP_UNLOCK(pmap); } +static pt_entry_t * +pmap_fault_lookup(pmap_t pmap, vm_offset_t va) +{ + pd_entry_t *l2, l2e; + + l2 = pmap_l2(pmap, va); + if (l2 == NULL || ((l2e = pmap_load(l2)) & PTE_V) == 0) + return (NULL); + if ((l2e & PTE_RWX) == 0) + return (pmap_l2_to_l3(l2, va)); + return (l2); +} + int pmap_fault(pmap_t pmap, vm_offset_t va, vm_prot_t ftype) { - pd_entry_t *l2, l2e; pt_entry_t bits, *pte, oldpte; int rv; KASSERT(VIRT_IS_VALID(va), ("pmap_fault: invalid va %#lx", va)); + if (pmap == kernel_pmap) { + /* + * Locking the kernel pmap while processing spurious faults + * may lead to a panic since we might be running a critical section + * or already holding the kernel pmap lock. + * We deal with this by taking advantage of the fact that + * kernel PTPs are never freed and performing a lockless lookup + * to determine whether a valid mapping exits. + */ + pte = pmap_fault_lookup(pmap, va); + if (pte != NULL && (pmap_load(pte) & PTE_KERN) == PTE_KERN) { + sfence_vma_page(va); + return (1); + } + /* + * The entry is either not present or missing some bits. + * Fall back to the locked lookup below to handle the fault. + */ + } + rv = 0; PMAP_LOCK(pmap); - l2 = pmap_l2(pmap, va); - if (l2 == NULL || ((l2e = pmap_load(l2)) & PTE_V) == 0) + pte = pmap_fault_lookup(pmap, va); + if (pte == NULL || ((oldpte = pmap_load(pte)) & PTE_V) == 0) goto done; - if ((l2e & PTE_RWX) == 0) { - pte = pmap_l2_to_l3(l2, va); - if (((oldpte = pmap_load(pte)) & PTE_V) == 0) - goto done; - } else { - pte = l2; - oldpte = l2e; - } if ((pmap != kernel_pmap && (oldpte & PTE_U) == 0) || (ftype == VM_PROT_WRITE && (oldpte & PTE_W) == 0) || From nobody Fri Jul 10 17:50:08 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 4gxfVt0ML8z6lT3w for ; Fri, 10 Jul 2026 17:50:14 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxfVs6WgLz3dFd for ; Fri, 10 Jul 2026 17:50:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783705813; 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=kWp6TFx+2vd49X7IEeUfV5f87r4tH0mhwQXt11EG0A4=; b=f4t9/7ctTkNUVhQ6RwhL9eeEC1JJqfzkEVbAq+Xpt/a5j5UeGXSSv0TZjlLBDbV/Bof4C8 /FRwxs2eeBI8bFVBGoUGEEeo0JWmFWYrdKxw0vzAem3ZdaL5OPQfgri1HM45OgdS1/2k+/ iaaqWwaLWWW8zSNjcQ9PfaFZ8QPScj/hnHefa7w+DV4Gf3nm2bbXZgJCupPLm921nuEtoY hdbtKwGXpSSWqJQjI+9pG21ZwCKRZFHQPYGff63zN7PRyu2DbzVtimhdecVvkfZziKCZvs QaG7gVEUl7i8v6sig9+DwD2qv0YpphJMcBYBRmnt7vWqJroL1glvZ15Jpsk++A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783705813; a=rsa-sha256; cv=none; b=R8na8qqU+wHPXZBLMEfn29BW1Z7jNrfTqO/IzlqI6j7ibj14lU/mHIRA3U3RP54ZPKloH9 wRY5NKkTTo5znXlE3ItuE2aUTOAL1C8195pvIGriLlVy6ErdHT8cDAZGDj56OoDzT9H1cb KusxXPH9wYWr+Cg7rwkQSVrudqacn1NsJY93uDLdr5LgSJ9o+Sg32O5+7kTsSpfOW59V7W TwyXWD3gzCjlv3sUYHi2ZfqBwsA7294nj4DUtiOlc1zxo/GZFxZg06OQepgrksbylScfeL LxTX93yoo6mwRGHe2c4GfzY/jhCY5jDHqTSryq0t3sE3fMw6dhOTdPpafdhMoQ== 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=1783705813; 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=kWp6TFx+2vd49X7IEeUfV5f87r4tH0mhwQXt11EG0A4=; b=CiYaLA2L2oJ/y+/GbyKuNx6fjSsAKN8R1E9rshUtIR/lAUzbyIqfqWDxiNiCtnCSjI3jtL gl2AsIFOg1Z5lAnWxo70yGPqLStBCpv7KUv2ZPJr1bLNYDkCK8jaekzYioN1kx0eD8XuUf XP3fXfLhjaXRuimXXHXDV9+jWwXvJCDULbT1dJ2iWvlm4b9T0E+JV6jTldmODYemMX0WaU NGeskv9UOkiyFdZ3Te36UWxmLBOPTJw9AZW6nAseJdEzFbJ/jQfQjNHv3x60iJO1XO082j iD3IP6kHqLKObFsnz7Ad3X8xfCf5T0ybnZGPB2FxUV3JtWuKoKIozkoZdCyp3Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxfVs58Mgz14Nr for ; Fri, 10 Jul 2026 17:50:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 42fa3 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 17:50:08 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Yusuke Ichiki From: Gleb Smirnoff Subject: git: 3c8cc666a3d3 - main - netinet6: Remove unused rip6_usrreqs declaration 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3c8cc666a3d3d65aedd552364e5fd43221b90d55 Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 17:50:08 +0000 Message-Id: <6a5130d0.42fa3.70d42cbc@gitrepo.freebsd.org> The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=3c8cc666a3d3d65aedd552364e5fd43221b90d55 commit 3c8cc666a3d3d65aedd552364e5fd43221b90d55 Author: Yusuke Ichiki AuthorDate: 2026-06-20 00:47:26 +0000 Commit: Gleb Smirnoff CommitDate: 2026-07-10 17:49:39 +0000 netinet6: Remove unused rip6_usrreqs declaration Fixes: e7d02be19d40063783d6b8f1ff2bc4c7170fd434 Signed-off-by: Yusuke Ichiki --- sys/netinet6/ip6_var.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h index 002b07e85434..9a861ab20647 100644 --- a/sys/netinet6/ip6_var.h +++ b/sys/netinet6/ip6_var.h @@ -373,8 +373,6 @@ VNET_DECLARE(int, ip6stealth); VNET_DECLARE(bool, ip6_log_cannot_forward); #define V_ip6_log_cannot_forward VNET(ip6_log_cannot_forward) -extern struct pr_usrreqs rip6_usrreqs; - struct inpcb; struct socket; struct sockopt; From nobody Fri Jul 10 17:52:05 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 4gxfY63bgjz6lTFC for ; Fri, 10 Jul 2026 17:52:10 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxfY12Jd0z3dTH for ; Fri, 10 Jul 2026 17:52:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783705925; 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=dIx2pGEG2U2TQZKJJ9Ehp33s6WLvahEC581s/TOqVpo=; b=FjhnBBCdAPwr5ZmffeB9ebnX/KrHrRX5GvpDCBapI8rNtGVafMX7TNkEOU3QiM4p9avjc8 qS7MPKpYi8RrbEXnTQA2w6SkbzOd1gv1Hf9iARJnKBFjsMc4RB1JdBAVwKt7PKyUQtEoYc Fg5hbMcgoEI30HqsdJ2IJCobKTPXliI9zfkzrnwrrWBmLe1vQdKG6efEYp/nJWgMQzam4C hGWw8WHAPKJswf/CuhJ4pjv0K7Us6YUpqsiMVNSchwOOWNygFNs7AyJHQnaQRtOBdfureM YABRN8leKy/rgkXoTGzUG6g6QteoBkT/+WaNIN0Gd/uFL6BmYHKdRFZ5ANzKmw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783705925; a=rsa-sha256; cv=none; b=IvqZWP7c5wrFot5PShUCyMwCyGscbDyKBPIXXz3JZDV+vWMv7AmoM6IbbYdQiNrn1NzWLz 0tMkT43f+vXtAJxul/PvzeNXJodCa0wZ+ueUa0yAMLEtUDM5I2tu3WmUgaqHnjDu10UHo+ tK5uJyjQqiw3iZb45cBAhcP0Hd1M5b4h5eVpBZTNCdNE6pu0bORDK3QOoAwxSRziMnlIiF 1CZ7O4/ghDYijxu/Emtj08I3SNXGOvMhj/lC0ezuyJyl890Drrji09sEGCqsJ4uq0CCbJ9 eFp7RF1xh5z7xwa3478Kcg8CM1WcNtlXaTp8WpE6gSbKHmGWlPF/+9A7OcxuZQ== 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=1783705925; 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=dIx2pGEG2U2TQZKJJ9Ehp33s6WLvahEC581s/TOqVpo=; b=yuhkmT7IZ1JRPTN/CfgbEii6wJXobG/WXDBJyrqlIdOKODPAb/iNKdmT5rL4xz6bkrViZG SjzwJsKdZ5/xSqPXBCn/kHYmqn8DixLyK+RGOSGqcKYzMwKPwfKE37/I3gl6DHoIBxkdWE 46ozI48zBj0yqPu9bjPFniHwuELfUtrxK83FIYlnyhonx6jIWs4Uu0HOAUMWP3ZDc0I3cG Z8LnLtlxaLCuaAtU4xjwIQ64fd0GQepp+GBJsyAHaoGDrp10HOyhTL2Va+Fp4AX/UiKAQB 9zm6e+fvSmSoF5maRJ/Liqxuvgapm9w5L/SzuoWN08SSB3opk8SgiDIA/kkJyA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxfY11Dwzz14gK for ; Fri, 10 Jul 2026 17:52:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 421bb by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 17:52:05 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ryan Libby Subject: git: c503d23a6ccb - main - fusefs: fix gcc build error with shadowed variable in tests 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: rlibby X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c503d23a6ccb8090edabc1c90981f9b8f202e093 Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 17:52:05 +0000 Message-Id: <6a513145.421bb.1dd99828@gitrepo.freebsd.org> The branch main has been updated by rlibby: URL: https://cgit.FreeBSD.org/src/commit/?id=c503d23a6ccb8090edabc1c90981f9b8f202e093 commit c503d23a6ccb8090edabc1c90981f9b8f202e093 Author: Ryan Libby AuthorDate: 2026-07-10 17:51:03 +0000 Commit: Ryan Libby CommitDate: 2026-07-10 17:51:03 +0000 fusefs: fix gcc build error with shadowed variable in tests Reported by: gcc -Werror=shadow Reviewed by: asomers, markj Fixes: ee1c3d38a26a ("fusefs: fix vnode locking violations during execve") Differential Revision: https://reviews.freebsd.org/D58130 --- tests/sys/fs/fusefs/misc.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/sys/fs/fusefs/misc.cc b/tests/sys/fs/fusefs/misc.cc index d95356262c1f..985fe927a858 100644 --- a/tests/sys/fs/fusefs/misc.cc +++ b/tests/sys/fs/fusefs/misc.cc @@ -280,7 +280,7 @@ TEST_F(FexecvDefaultPermissions, atime) }, [&] { char *const argv[] = {__DECONST(char *, "true"), NULL}; char *const env[] = {NULL}; - char buf[8]; + char cbuf[8]; int fd; /* Note that fexecve doesn't actually require O_EXEC */ @@ -290,7 +290,7 @@ TEST_F(FexecvDefaultPermissions, atime) return 1; } /* Read a few bytes, just to dirty the file's atime */ - if (read(fd, buf, sizeof(buf)) < 0) { + if (read(fd, cbuf, sizeof(cbuf)) < 0) { fprintf(stderr, "read: %s\n", strerror(errno)); return 1; } From nobody Fri Jul 10 18:12:31 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 4gxg0c2f8cz6lVhy for ; Fri, 10 Jul 2026 18:12:32 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxg0c0TZYz3kVM for ; Fri, 10 Jul 2026 18:12:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783707152; 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=J8PtIaTr7+QKkbFGRlFLyabjf53BziExRgNtm+hEQMg=; b=AtooNmOgQ1JKcEEydTq8QPDPiE/ulcX3xBjqBztmlD0xVEuzrZJ5XuVE6HMLJNzajBr99t XwCVngANsEAXJIExoIj7upGlbi8LG7b8KzpiGaiRmgdIPUSUDKJgOpvwReFAPKhxRNuWBr ZaT0q9Z+PxxfZX99kHA0CK9Y7Yae8sXO+UHXZ6bxozHOiVZiYRkDh0FuzH3JCn6hZvA1qq OCoht+nSI2ikdkCtWfz46QvPqdJr/lL+jTxOFL7msyZl5m3OZoBC3NwRiLDsx4aPsd9doE kEaRWRXWpGpWxHNXeWUdIKAjxBQQ4l1wRvnl1PovX0GrG9bYXsAZFnOcNnv8XA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783707152; a=rsa-sha256; cv=none; b=kpPX2sOqVb+YSjJzqXJdORzqjnmJsF6k18S/XoFsENJwXBBvK4ceaiFS6S9O6FFkymldMb Rly3BPXa58h+Q7EJbN/rPiF6PB+MDFNN1cxlOHRDvfyOubXQ2kCJTyJGPt9UbRXk6ucVju 9eX8In7C+UXTZckiyXwiNfhuQXEQVshOdBw80kKkXMIBDoK01zC4kLU9pJ5DJaqaWymUrw Mr8ighV5MsyfyYSmvmDlJuxomywQRDu8taSdDrjkoMuj//q2HcKWBKRcv47StM/KhZC2tB U5ca3owK6e02WQLw1E9LGzlr+xf0ufTVh8u2d2KkxtZqDwlYxFsJB/wjEwnetA== 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=1783707152; 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=J8PtIaTr7+QKkbFGRlFLyabjf53BziExRgNtm+hEQMg=; b=rAqflm0chLw4eqldrBUJfzRys+qVqqpmOTU6kFmnz4bqLui6JH78aC4KbBChtRls9XAkx1 Wl5/ynn60AYijBrVdPkswG5U+OHfxKyLyVyiltcGBfheSevhleyXgVajSBzzohAQv3xEDR BTUCCNaTfQgkJ1o2Y5SkeK9zb7zTwYXXorg0qGv3LoTEPu7oH0t3Js9PHXhYXMj45miC8c oDq/DAUg5qj4jbsr2Aq8IRY6lhTfKoFdxZTi344eIBRMFnvGyD7qrb0ZaCd/lF4bQxkCrd AV5CaCiKxiu2kzDBWyuuOdj0dXkRr8sWsr5VenjVKj+L4Z/Cdeqykvg87xmmhg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxg0b6MRJz161v for ; Fri, 10 Jul 2026 18:12:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 454ba by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 18:12:31 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Yusuke Ichiki From: Gleb Smirnoff Subject: git: f0b8c514a18d - main - libalias: use htons() when converting from host to network 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f0b8c514a18d098d9e1cfd10fa4401f277cb2f1f Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 18:12:31 +0000 Message-Id: <6a51360f.454ba.41cace5f@gitrepo.freebsd.org> The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=f0b8c514a18d098d9e1cfd10fa4401f277cb2f1f commit f0b8c514a18d098d9e1cfd10fa4401f277cb2f1f Author: Yusuke Ichiki AuthorDate: 2026-07-10 18:11:00 +0000 Commit: Gleb Smirnoff CommitDate: 2026-07-10 18:12:10 +0000 libalias: use htons() when converting from host to network PR: 295434 --- sys/netinet/libalias/alias_db.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index bc567ad2d918..24e05e06b21a 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -200,7 +200,7 @@ _RandomPort(struct libalias *la) { port = la->aliasPortLower + arc4random_uniform(la->aliasPortLength); - return ntohs(port); + return htons(port); } /* GetNewPort() allocates port numbers. Note that if a port number From nobody Fri Jul 10 18:17:09 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 4gxg5x74DRz6lVYH for ; Fri, 10 Jul 2026 18:17:09 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxg5x6SMNz3lyW for ; Fri, 10 Jul 2026 18:17:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783707429; 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=/MFrVvaZRbOFTveTTffOkzS6s1q/BeJdKMhYD54y0GI=; b=p7qMagneQxpA6Bu8lNqYDCo2I7Wy1F+eHauQoCvBDGKRLAdJDkrkpf1h3Gwb1XzOM0r2lW Ojh4/Y0E2RwFEIcU5sGTrz4mZgUMgUknQCCD7G4SlJ4gasxS3D3wgMB+kbEPRPj0Jh60ov 75JPg/ZE0j56/d9sZ0OVh31cxQV8uEsCgP/nXYfg31UjxOJ9HBdVW7jjkmyt2guDRWMFd5 69ASELLUsi43K0frxF5c67WsXJ1s2+Vgyxy1SEUS+uAwCVlH5Da2imzCMEO5VQ4bkdBsd/ 1cfvn7GQKHELrY5mRgoeI5ybwMXfHh8u+t45vC9p8JX9+nsH56xE69Sy4LFWRQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783707429; a=rsa-sha256; cv=none; b=WRzcnJtSpzg2h42QYYt8v4yIXOKwsQk7sHaI8OH+8940smotnsNfsvYY6N1ApVmD0YiMxI YIx/jTR0r/anH1wleBk2HPCeSg3Kwr29eV6ILsw+Py8bVyUVsiXm2kTGvnB+7PgQPS5tj4 CL7WE7oAes3ElXuIH4YaWBkE56hRoF7/wWDBJHIEMGUKe16qG8pJBTz3hbD9BHUW0l4cmL k3Jhvtp4F/Y0b34F6gsWwWzcK2c7tf6wkSHCPwo6biR/Ulrdr8eSDfv8isRRHb74Xv3iWC W3D3GPk2uvNdJzjFn18EVGbf1PAvzmV58A+CibG2HpC+68roeOcH8CTPxt5U0w== 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=1783707429; 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=/MFrVvaZRbOFTveTTffOkzS6s1q/BeJdKMhYD54y0GI=; b=YaHAs9hqfcQOzqlDp/UX2w9hMTsdIPqWDrcj2Asd0fIcZXE/6BNHaqcW/YkeTf7fFFHT3W iwI/Fu4z6eAgZXQUHq6SkVOUFaGEx/FyKjnhGDIw6f4iHFisg9PE6YnLF+mf5vLdsxyK4f 0Mo235/HGBv3td3LqPUFOFCT9gbaC4DtX+i+N+rWmzp5ziLBs1DMGWCWD7q3D/jnku7m0H FCQsI/XrXE+j79gJ0bCDM4PwdSNB2QhUeaOYb7s/kpuBfztPsg0XbM+4ONhqeuEd+gZSkp 1+/YhWERT8yhpbOXsEwvWEwDgwbkte37uHhjvvWOOxv4Szs/N8uTE0dYFESKlg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxg5x5KhMz15x1 for ; Fri, 10 Jul 2026 18:17:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 457c5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 18:17:09 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 513d3fde7c46 - main - tools/build: Don't set RANLIB for non-FreeBSD builds 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 513d3fde7c4665c1c83ad227ac4ec95c89b84add Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 18:17:09 +0000 Message-Id: <6a513725.457c5.7df68de7@gitrepo.freebsd.org> The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=513d3fde7c4665c1c83ad227ac4ec95c89b84add commit 513d3fde7c4665c1c83ad227ac4ec95c89b84add Author: Ed Maste AuthorDate: 2026-03-23 18:50:41 +0000 Commit: Ed Maste CommitDate: 2026-07-10 18:16:49 +0000 tools/build: Don't set RANLIB for non-FreeBSD builds RANLIB is not used by our build, so there is no need to set it. Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D58156 --- tools/build/mk/Makefile.boot | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/build/mk/Makefile.boot b/tools/build/mk/Makefile.boot index 43246f3ceebf..94e44cbabab4 100644 --- a/tools/build/mk/Makefile.boot +++ b/tools/build/mk/Makefile.boot @@ -9,7 +9,6 @@ LDFLAGS+= -L${WORLDTMP}/legacy/usr/lib # $PATH before a nm that supports the host architecture. # To ensure that host binary compile as expected we use the tools from /usr/bin. AR:= /usr/bin/ar -RANLIB:= /usr/bin/ranlib NM:= /usr/bin/nm # Avoid stale dependecy warnings: @@ -57,10 +56,9 @@ LDADD+= -lfts .elif ${.MAKE.OS} == "Darwin" CFLAGS+= -D_DARWIN_C_SOURCE=1 CFLAGS+= -I${SRCTOP}/tools/build/cross-build/include/mac -# The macOS ar and ranlib don't understand all the flags supported by the -# FreeBSD and Linux ar/ranlib +# The macOS ar doesn't understand all the flags supported by the +# FreeBSD and Linux ar ARFLAGS:= -crs -RANLIBFLAGS:= # to get libarchive (needed for elftoolchain) # MacOS ships /usr/lib/libarchive.dylib but doesn't provide the headers From nobody Fri Jul 10 19:34:24 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 4gxhq43XDpz6cxN9 for ; Fri, 10 Jul 2026 19:34:24 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxhq414j0z3ydr for ; Fri, 10 Jul 2026 19:34:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783712064; 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=BXQTaOqAVUivaNItM6LF3oFCWzfJFyixO2NXL0uC0Rg=; b=Ka9n0iAx5dBCWnMoRuBFVPz5bmLlEhlVEqJ3gUKlgon22GdGvaQQqzTl3prH0vqLQJzmUD CNJWVN2T8T45YMHPI4+3nfXPZIzO3pK5J92mLCTDoELC1fCyHMWsGreblB9odv/vjTdG5f Rafk4lXmgCA1x0+WlC42FUiwICkLKN+mUK9W6fbausCqTpErgp4eGQtgEp81HqEEDNK8uE FmBAWpEhkQEGGD3Ki9Rje1Q5l1FGKjQmHTLBr6Dlu/rGlkc0872XhiEjH+XBlGr7NwqpQu ThdF6MToM+E9EsXhyx+/FjPNA/l4GNYKxDSscy0j8sF2aHn9gAOBn8H6PTg3tQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783712064; a=rsa-sha256; cv=none; b=clo/Wirt2t7H4YsdQeRY8Y0HBlzncnPGxOrKR54ROramiqHMkh3Yl//qPos6dHHlEBGvIq WHMY3RE0/YDQ/Um9zQQWvEqzJ7O8QRad8EpVuYxv1PuJcRvObpZ/pidLi+KBZwRGLtMewg i7cyx9jXm0in1xGY7byoWYtsowCFX7kxV21dWOKIkBGr6qjD6QQiw9T4wT1c/8BqZS6A8m uL4xE0D/ODacWrTbFRabbmu2lAZs+Usfzy6PWXzKcurJoUN05KFNwRuoTxHrIHKqUiKxnN cxSwEEkvbDUXhZs0EtKPkoI1eWKlmMnbK5Dfgdm5MV2Aec9e6JUyDDazMhN/bQ== 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=1783712064; 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=BXQTaOqAVUivaNItM6LF3oFCWzfJFyixO2NXL0uC0Rg=; b=n6gyjGjt6RQgwLW5o8gzD3Ig9JrNMnGUj4c1dYk03LPvy6yNijpX45L+x/XleuX049CRon vsWbcFG5p5mx0ci4QOEyWRCpflNT4C/Gw9hgp19UmngmDEE8NyIHokt881sctgk1D71mpI xvTiE2Q0zluR3eZjMyO7Ecrok1s0LuzRmnOBTfjwVpJB6amBA5GosQn8l2iAZzU8tvs1Ff CpxWTq/fRbN5YFGaMNhIVTdWdo39e0K8WT97g2LTXn+EA1YZDrstDkF/KB2B7Nho0mihEf 0P8kdEBY482sK01OuVgHmX86kn0UHXobDd/X5Ul8ukw7a62C+ty+FMWCx3CHdg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxhq405lZz17T1 for ; Fri, 10 Jul 2026 19:34:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1e90c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 19:34:24 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 1a3d61552546 - main - hwpstate_amd(4): Restore CPU ID cache after introducing cpu_get_pcpuid() 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1a3d61552546407786148221a961b0ce810ebabb Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 19:34:24 +0000 Message-Id: <6a514940.1e90c.9c4e5e4@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=1a3d61552546407786148221a961b0ce810ebabb commit 1a3d61552546407786148221a961b0ce810ebabb Author: Olivier Certner AuthorDate: 2026-07-07 09:56:34 +0000 Commit: Olivier Certner CommitDate: 2026-07-10 19:33:34 +0000 hwpstate_amd(4): Restore CPU ID cache after introducing cpu_get_pcpuid() Using cpu_get_pcpuid() directly or having a CPU ID cache does not really make any significant difference. With cache: Less function calls, less space on stack, but an additional allocation in the softc, who stays permanently. Without cache: Some function calls, but one less slot in the softc, and no data duplication (but that info never changes). The main reason for this change is to reduce conflicts with some work-in-progress by aokblast@. While here, move the check that a per-CPU structure is provided by the bus from the attach to the probe method, as it is already used by hwpstate_probe_pstate() there. Reviewed by: aokblast Sponsored by: The FreeBSD Foundation --- sys/x86/cpufreq/hwpstate_amd.c | 46 +++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/sys/x86/cpufreq/hwpstate_amd.c b/sys/x86/cpufreq/hwpstate_amd.c index fc31229008a3..f2ae38ed5ed6 100644 --- a/sys/x86/cpufreq/hwpstate_amd.c +++ b/sys/x86/cpufreq/hwpstate_amd.c @@ -179,6 +179,7 @@ struct hwpstate_softc { uint64_t request; } cppc; }; + u_int cpuid; }; static void hwpstate_identify(driver_t *driver, device_t parent); @@ -337,7 +338,6 @@ static int sysctl_cppc_dump_handler(SYSCTL_HANDLER_ARGS) { const struct hwpstate_softc *const sc = arg1; - const u_int cpuid = cpu_get_pcpuid(sc->dev); struct sbuf *sb; struct sbuf sbs; struct get_cppc_regs_data data; @@ -348,15 +348,15 @@ sysctl_cppc_dump_handler(SYSCTL_HANDLER_ARGS) sb = sbuf_new_for_sysctl(&sbs, NULL, 0, req); - smp_rendezvous_cpu(cpuid, smp_no_rendezvous_barrier, + smp_rendezvous_cpu(sc->cpuid, smp_no_rendezvous_barrier, get_cppc_regs_cb, smp_no_rendezvous_barrier, &data); if (hwp_has_error(data.res, HWP_ERROR_CPPC_ENABLE)) sbuf_printf(sb, "CPU%u: " MSR_AMD_CPPC_ENABLE_NAME ": " - MSR_NOT_READ_MSG "\n", cpuid); + MSR_NOT_READ_MSG "\n", sc->cpuid); else sbuf_printf(sb, "CPU%u: HWP %sabled (" MSR_AMD_CPPC_REQUEST_NAME - ": %#" PRIx64 ")\n", cpuid, data.enable & 1 ? + ": %#" PRIx64 ")\n", sc->cpuid, data.enable & 1 ? "En" : "Dis", data.enable); if (hwp_has_error(data.res, HWP_ERROR_CPPC_CAPS)) @@ -433,7 +433,7 @@ static inline void set_cppc_request_send_one(struct set_cppc_request_cb *const data, device_t dev) { data->sc = device_get_softc(dev); - smp_rendezvous_cpu(cpu_get_pcpuid(dev), smp_no_rendezvous_barrier, + smp_rendezvous_cpu(data->sc->cpuid, smp_no_rendezvous_barrier, set_cppc_request_cb, smp_no_rendezvous_barrier, data); } @@ -502,9 +502,8 @@ sysctl_cppc_request_field_handler(SYSCTL_HANDLER_ARGS) check_cppc_in_use(sc, __func__); if ((sc->flags & HWPFL_CPPC_REQUEST_NOT_READ) != 0) { - smp_rendezvous_cpu(cpu_get_pcpuid(dev), - smp_no_rendezvous_barrier, get_cppc_request_cb, - smp_no_rendezvous_barrier, sc); + smp_rendezvous_cpu(sc->cpuid, smp_no_rendezvous_barrier, + get_cppc_request_cb, smp_no_rendezvous_barrier, sc); if ((sc->flags & HWPFL_CPPC_REQUEST_NOT_READ) != 0) return (EIO); @@ -571,7 +570,8 @@ hwpstate_pstate_read_status(u_int cpuid, uint64_t *msr) static int hwpstate_goto_pstate(device_t dev, int id) { - const u_int cpuid = cpu_get_pcpuid(dev); + const struct hwpstate_softc *const sc = device_get_softc(dev); + const u_int cpuid = sc->cpuid; uint64_t msr; if (hwpstate_pstate_limit) { @@ -656,12 +656,13 @@ hwpstate_set(device_t dev, const struct cf_setting *cf) static int hwpstate_get_cppc(device_t dev, struct cf_setting *cf) { + const struct hwpstate_softc *const sc = device_get_softc(dev); uint64_t rate; int ret; memset(cf, CPUFREQ_VAL_UNKNOWN, sizeof(*cf)); cf->dev = dev; - if ((ret = cpu_est_clockrate(cpu_get_pcpuid(dev), &rate))) + if ((ret = cpu_est_clockrate(sc->cpuid, &rate))) return (ret); cf->freq = rate / 1000000; return (0); @@ -671,11 +672,10 @@ static int hwpstate_get_pstate(device_t dev, struct cf_setting *cf) { const struct hwpstate_softc *const sc = device_get_softc(dev); - const u_int cpuid = cpu_get_pcpuid(dev); struct hwpstate_setting set; uint64_t msr; - hwpstate_pstate_read_status(cpuid, &msr); + hwpstate_pstate_read_status(sc->cpuid, &msr); if (msr >= sc->cfnum) return (EINVAL); set = sc->hwpstate_settings[msr]; @@ -887,7 +887,7 @@ static int enable_cppc(struct hwpstate_softc *sc) { const device_t dev = sc->dev; - const u_int cpuid = cpu_get_pcpuid(dev); + const u_int cpuid = sc->cpuid; struct enable_cppc_data data; struct sbuf sbs; struct sbuf *sb; @@ -951,7 +951,6 @@ static int hwpstate_probe_pstate(device_t dev) { const struct hwpstate_softc *const sc = device_get_softc(dev); - const u_int cpuid = cpu_get_pcpuid(dev); device_t perf_dev; int error, type; uint64_t msr; @@ -989,7 +988,7 @@ hwpstate_probe_pstate(device_t dev) * Now we get _PSS info from acpi_perf without error. * Let's check it. */ - hwpstate_pstate_read_limit(cpuid, &msr); + hwpstate_pstate_read_limit(sc->cpuid, &msr); if (sc->cfnum != 1 + AMD_10H_11H_GET_PSTATE_MAX_VAL(msr)) { HWPSTATE_DEBUG(dev, "MSR (%jd) and ACPI _PSS (%d)" " count mismatch\n", (intmax_t)msr, sc->cfnum); @@ -1025,6 +1024,13 @@ hwpstate_probe(device_t dev) { struct hwpstate_softc *const sc = device_get_softc(dev); + if (cpu_get_pcpu(dev) == NULL) { + device_printf(dev, + "Parent bus does not provide a per-CPU structure!"); + return (ENXIO); + } + sc->cpuid = cpu_get_pcpuid(dev); + if (hwpstate_amd_cppc_enable && (amd_extended_feature_extensions & AMDFEID_CPPC)) { sc->flags |= HWPFL_USE_CPPC; @@ -1048,12 +1054,6 @@ hwpstate_attach(device_t dev) struct hwpstate_softc *const sc = device_get_softc(dev); int res; - if (cpu_get_pcpu(dev) == NULL) { - device_printf(dev, - "Parent bus does not provide a per-CPU structure!"); - return (ENXIO); - } - if ((sc->flags & HWPFL_USE_CPPC) != 0) { if ((res = enable_cppc(sc)) != 0) return (res); @@ -1133,7 +1133,7 @@ hwpstate_pstate_read_settings(struct hwpstate_softc *sc, uint64_t vals[]) req.sc = sc; req.vals = vals; - smp_rendezvous_cpu(cpu_get_pcpuid(sc->dev), smp_no_rendezvous_barrier, + smp_rendezvous_cpu(sc->cpuid, smp_no_rendezvous_barrier, hwpstate_pstate_read_settings_cb, smp_no_rendezvous_barrier, &req); return (req.err); } @@ -1148,7 +1148,7 @@ hwpstate_get_info_from_msr(device_t dev) family = CPUID_TO_FAMILY(cpu_id); /* Get pstate count */ - hwpstate_pstate_read_limit(cpu_get_pcpuid(dev), &msr); + hwpstate_pstate_read_limit(sc->cpuid, &msr); sc->cfnum = 1 + AMD_10H_11H_GET_PSTATE_MAX_VAL(msr); hwpstate_set = sc->hwpstate_settings; hwpstate_pstate_read_settings(sc, state_settings); From nobody Fri Jul 10 19:34:25 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 4gxhq53fNdz6cxHy for ; Fri, 10 Jul 2026 19:34:25 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxhq5273Jz3yds for ; Fri, 10 Jul 2026 19:34:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783712065; 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=VmjMhgOe6/aUDMkfJhnTOBkIx3DvF/Ill3uFxeIHd4o=; b=Tiz81Aca3UGJ3zPgWVWZDRC48x0OgL9B3FF4eM5KdktqzkDbjdHu+OV0BTBA9Vmx6Vz2z9 Q5/9sPBam7m4kMVexRZdAKaD0vxkUKJ/0XJE2FRknfBRli/kwu8kAcHQJC84iPq9mrsc9T 6tD4yxgChvLf8gyl5/Aqf/hK7tLElv/tuMZp/EBLz6G4JXBQammEQqZ/ktAn2hRAsnKgzY amagD4q5x/2TmRawktoFOlHb6dxFIcJffrVQxI/LGeOchARnXUT9aov4eJWEc7jICRn/8H uNPnYNi5al7iIfUTrb3DMGyW4vmRD9FYdclbGXjaqVx+9JxqVB5MirOlqniriQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783712065; a=rsa-sha256; cv=none; b=MxE1au6hJg4NdInw2f/+nmSX0h7L6dW9OJ263zpVnhUE1a1k2whltl3EObGJbI3xk1+My+ dLj+b+70ZC45lWDDnXmGbkOWXernHlezl28IbRjtznm4xypvPAJc/NWCgaBWg3q+WRkB0H AFYtmMQQlXG6kvX8x9mKIBEyIEwIzNqJewllFaQD0IJ82Yl33IMUwm1SfcmPtT30CMRD+R Yqe4spnaOCI4tfZmU/QzkxYmC+cUjWD7ZTAIPbAWfTLTU9dBYBqEc5Dgp00ZUFV4BfpMO+ 81mHJqJMBusUF+w8XQ7Up84Io9o2VJwTLW/tH0lNBYwwsgHNCMlmk2E/z1tiWQ== 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=1783712065; 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=VmjMhgOe6/aUDMkfJhnTOBkIx3DvF/Ill3uFxeIHd4o=; b=we5U4SM2ZN2HyH/jkTPOWM2HYkoErIovLJ+tQHUiEeupiHyEU1VstpitXWAswnYcVVqGj6 jQ5h3uVrBnXhVRhNdkPBeGkdZeGveLt9uC/2OPlplU7z5Gmu6Zfaf+xCgWQYy/Ck+pSllH jtdiF6zfSs48oHUn/bKft/D0oQ8hedVWvEgkWJiRvSF1F6M6Xj8OG2nJwibIW0+kNBuoJV Wmh5QHr6y5G4H44DnE0sgZdEthUadhMwh9I1IU2Xf/REuZaPC6LOkKejJ8EVw7kmcd0Frx cDUYOedVQbMvpzTH+n80u1lKJX/jf/xvZL+f27H1251TSZdDPlLinjI0bxOvZg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxhq50w4Tz17Ws for ; Fri, 10 Jul 2026 19:34:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1ebe5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 19:34:25 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 7cc2f18e12ed - main - hwpstate_intel(4): Introduce a CPU ID cache 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7cc2f18e12ed3dd19522c5b8e96519282189a83b Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 19:34:25 +0000 Message-Id: <6a514941.1ebe5.43df5fbb@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=7cc2f18e12ed3dd19522c5b8e96519282189a83b commit 7cc2f18e12ed3dd19522c5b8e96519282189a83b Author: Olivier Certner AuthorDate: 2026-07-07 12:52:58 +0000 Commit: Olivier Certner CommitDate: 2026-07-10 19:33:53 +0000 hwpstate_intel(4): Introduce a CPU ID cache To minimize the diff with hwpstate_intel(4). See previous commit there for the rationale. Reviewed by: aokblast Sponsored by: The FreeBSD Foundation --- sys/x86/cpufreq/hwpstate_intel.c | 60 +++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/sys/x86/cpufreq/hwpstate_intel.c b/sys/x86/cpufreq/hwpstate_intel.c index 1cea06f3721e..59d7a155fda8 100644 --- a/sys/x86/cpufreq/hwpstate_intel.c +++ b/sys/x86/cpufreq/hwpstate_intel.c @@ -85,20 +85,21 @@ static device_method_t intel_hwpstate_methods[] = { DEVMETHOD_END }; -#define RDMSR_ON_CPU(dev, msr, val) \ - (x86_msr_op(msr, \ - MSR_OP_RENDEZVOUS_ONE | MSR_OP_READ | \ - MSR_OP_CPUID(cpu_get_pcpuid(dev)), \ +#define RDMSR_ON_CPU(sc, msr, val) \ + (x86_msr_op(msr, \ + MSR_OP_RENDEZVOUS_ONE | MSR_OP_READ | \ + MSR_OP_CPUID(sc->cpuid), \ 0, val)); -#define WRMSR_ON_CPU(dev, msr, val) \ - x86_msr_op(msr, \ - MSR_OP_RENDEZVOUS_ONE | MSR_OP_WRITE | \ - MSR_OP_CPUID(cpu_get_pcpuid(dev)), \ +#define WRMSR_ON_CPU(sc, msr, val) \ + x86_msr_op(msr, \ + MSR_OP_RENDEZVOUS_ONE | MSR_OP_WRITE | \ + MSR_OP_CPUID(sc->cpuid), \ val, NULL) struct hwp_softc { device_t dev; + u_int cpuid; bool hwp_notifications; bool hwp_activity_window; @@ -189,7 +190,7 @@ get_cppc_regs_one(const struct hwp_softc *const sc, struct get_cppc_regs_data *const req) { req->sc = sc; - smp_rendezvous_cpu(cpu_get_pcpuid(sc->dev), + smp_rendezvous_cpu(sc->cpuid, smp_no_rendezvous_barrier, get_cppc_regs_cb, smp_no_rendezvous_barrier, req); } @@ -200,7 +201,7 @@ static int intel_hwp_dump_sysctl_handler(SYSCTL_HANDLER_ARGS) { const struct hwp_softc *const sc = arg1; - const u_int cpuid = cpu_get_pcpuid(sc->dev); + const u_int cpuid = sc->cpuid; struct sbuf *sb; struct get_cppc_regs_data data; int ret = 0; @@ -298,8 +299,7 @@ sysctl_epp_select(SYSCTL_HANDLER_ARGS) * This register is per-core (but not HT). */ if (!sc->hwp_perf_bias_cached) { - ret = RDMSR_ON_CPU(dev, MSR_IA32_ENERGY_PERF_BIAS, - &epb); + ret = RDMSR_ON_CPU(sc, MSR_IA32_ENERGY_PERF_BIAS, &epb); if (ret) goto out; sc->hwp_energy_perf_bias = epb; @@ -327,10 +327,10 @@ sysctl_epp_select(SYSCTL_HANDLER_ARGS) (val << 24u); if (sc->hwp_pkg_ctrl_en) - ret = WRMSR_ON_CPU(dev, MSR_IA32_HWP_REQUEST_PKG, + ret = WRMSR_ON_CPU(sc, MSR_IA32_HWP_REQUEST_PKG, req_cached); else - ret = WRMSR_ON_CPU(dev, MSR_IA32_HWP_REQUEST, + ret = WRMSR_ON_CPU(sc, MSR_IA32_HWP_REQUEST, req_cached); } else { val = EPP_TO_EPB(val); @@ -339,7 +339,7 @@ sysctl_epp_select(SYSCTL_HANDLER_ARGS) sc->hwp_energy_perf_bias = ((sc->hwp_energy_perf_bias & ~IA32_ENERGY_PERF_BIAS_POLICY_HINT_MASK) | val); - ret = WRMSR_ON_CPU(dev, MSR_IA32_ENERGY_PERF_BIAS, + ret = WRMSR_ON_CPU(sc, MSR_IA32_ENERGY_PERF_BIAS, sc->hwp_energy_perf_bias); } @@ -494,16 +494,15 @@ set_autonomous_hwp_send_one(struct hwp_softc *sc, struct set_autonomous_hwp_cb *data) { data->sc = sc; - smp_rendezvous_cpu(cpu_get_pcpu(sc->dev)->pc_cpuid, - smp_no_rendezvous_barrier, set_autonomous_hwp_cb, - smp_no_rendezvous_barrier, data); + smp_rendezvous_cpu(sc->cpuid, smp_no_rendezvous_barrier, + set_autonomous_hwp_cb, smp_no_rendezvous_barrier, data); } static int set_autonomous_hwp(struct hwp_softc *const sc) { const device_t dev = sc->dev; - const u_int cpuid = cpu_get_pcpuid(dev); + const u_int cpuid = sc->cpuid; struct set_autonomous_hwp_cb data; set_autonomous_hwp_send_one(sc, &data); @@ -552,6 +551,7 @@ intel_hwpstate_attach(device_t dev) "Parent bus does not provide a per-CPU structure!"); return (ENXIO); } + sc->cpuid = cpu_get_pcpuid(dev); /* eax */ if (cpu_power_eax & CPUTPM1_HWP_NOTIFICATION) @@ -595,6 +595,7 @@ intel_hwpstate_detach(device_t dev) static int intel_hwpstate_get(device_t dev, struct cf_setting *set) { + const struct hwp_softc *const sc = device_get_softc(dev); uint64_t rate; int ret; @@ -604,7 +605,7 @@ intel_hwpstate_get(device_t dev, struct cf_setting *set) memset(set, CPUFREQ_VAL_UNKNOWN, sizeof(*set)); set->dev = dev; - ret = cpu_est_clockrate(cpu_get_pcpuid(dev), &rate); + ret = cpu_est_clockrate(sc->cpuid, &rate); if (ret == 0) set->freq = rate / 1000000; @@ -632,15 +633,15 @@ intel_hwpstate_suspend(device_t dev) } struct hwpstate_resume_cb { - struct hwp_softc *sc; + const struct hwp_softc *sc; uint32_t flag; }; static void hwpstate_resume_cb(void *arg) { - struct hwpstate_resume_cb *data = arg; - struct hwp_softc *sc = data->sc; + struct hwpstate_resume_cb *const data = arg; + const struct hwp_softc *const sc = data->sc; int ret; data->flag = 0; @@ -676,12 +677,11 @@ hwpstate_resume_cb(void *arg) } static inline void -hwpstate_resume_send_one(struct hwp_softc *sc, struct hwpstate_resume_cb *req) +hwpstate_resume_send_one(const struct hwp_softc *sc, struct hwpstate_resume_cb *req) { req->sc = sc; - smp_rendezvous_cpu(cpu_get_pcpuid(sc->dev), - smp_no_rendezvous_barrier, hwpstate_resume_cb, - smp_no_rendezvous_barrier, req); + smp_rendezvous_cpu(sc->cpuid, smp_no_rendezvous_barrier, + hwpstate_resume_cb, smp_no_rendezvous_barrier, req); } /* @@ -691,12 +691,10 @@ hwpstate_resume_send_one(struct hwp_softc *sc, struct hwpstate_resume_cb *req) static int intel_hwpstate_resume(device_t dev) { - const u_int cpuid = cpu_get_pcpuid(dev); - struct hwp_softc *sc; + const struct hwp_softc *const sc = device_get_softc(dev); + const u_int cpuid = sc->cpuid; struct hwpstate_resume_cb data; - sc = device_get_softc(dev); - hwpstate_resume_send_one(sc, &data); if (hwp_has_error(data.flag, HWP_ERROR_CPPC_ENABLE)) { device_printf(dev, From nobody Fri Jul 10 20:36:48 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 4gxkC45YNWz6d3Cb for ; Fri, 10 Jul 2026 20:36:48 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxkC43LXVz446K for ; Fri, 10 Jul 2026 20:36:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783715808; 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=KyRvaFog4xt/Yxp6WvI72Evr/3tWWarR3Irk/AQ4/tk=; b=Jrd04V7lbzI0wzbOhI8eIqNRwsRXu69/dVw7WvOq8O4HEdo4oYKqjRdcwiM4I4D9+VYRdy P3Uj7u/VGAd3sNIQ1X7oX5iJdNlLY82QxrUrhjMDhYnWWMi4Pu1q31gvq2rOvb5Me+xvtS b6R+RhfWIG+2YPYhw2dFhRagOKm1P7a2ji009kbeBqvk2GC9cdevTIIj4LEh5M6zhlPNrK ZMyVbC/G4PWbc6EpHuRHWM25X8SyOOKwW9b7aRp73XF9cdhB4bETXCXkIq2LCBrk4prR0o tqrG3Si4r/5R5Y1yLtU/7Iv5JQKdlsy2B7eRccLaoSk3CmQegID9Fk/Lb7vukA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783715808; a=rsa-sha256; cv=none; b=kVB8cxURO30poH1P5GyxtZEAT9uHyApUqj8nMXsczcWn19R3wOSkznITrH/tyFG5MzfR1C uMEUIKnbWt0OJQHUwld66sRRbc8hrIep9dUqEAq5P7q/FhYeJO+vPBPU1CChGBwW4APVY1 rHDp5EFsOISnfzvqJGApnQ3dKE0QeXRnNldX7ZP1/m/+yy080ggDMYzNulATjx1GRevO5K M8BDEXFAfkCnCmu8WsFyBGxgXJbl4rTKab4DVrPHhF3GZ2G+dnxOs80/EEnRz8d9KhM0PV YxC/XYmw2FjMIjsWVImfpcTMnExPGRrz8+oDUeqnH7W42BuZg6JaD5QbSWN3ig== 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=1783715808; 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=KyRvaFog4xt/Yxp6WvI72Evr/3tWWarR3Irk/AQ4/tk=; b=Y+WUgEh0mL0xVLwiHHIKRKwB60av57tihb1GPMjoO2B109wOJVdZB3toEje4mLZhvCtOSA y7frMx7XY0nxGHWisIexQhJUL7FS56MvwHXoB22hc3/Bpnms12iD8kR66PnmjnmA3RAjOL qJFqabqS9cJsg67X9EnbUDIKA8ga7I5Bf8XxBaWHMN91mpde7ahWf8sGmzO5603t7FvRJO fJpr2gldSTquQ/sMm62m6SftwqDgGImia2QaoE/U/1eYnPWbcXqY40qIql6RV46F+7TDyN +YYlxbExCc+7Z17YUaLLmvO+s7HD2jUNf70QP/tYD9Rs/rV9Eu9pWmcdkLu3XQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxkC41yjbz19cM for ; Fri, 10 Jul 2026 20:36:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 25111 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 20:36:48 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 8a365723923e - main - kern_execve.c: simplify execve_block_wait() 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8a365723923e4eadad962d9c7e8162dfbfe3e78c Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 20:36:48 +0000 Message-Id: <6a5157e0.25111.17c44039@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8a365723923e4eadad962d9c7e8162dfbfe3e78c commit 8a365723923e4eadad962d9c7e8162dfbfe3e78c Author: Konstantin Belousov AuthorDate: 2026-07-10 10:05:13 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-10 20:36:17 +0000 kern_execve.c: simplify execve_block_wait() Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D58147 --- sys/kern/kern_exec.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 03a05c6cc041..35eb22e03f48 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -414,17 +414,11 @@ execve_block(struct thread *td, struct proc *p) void execve_block_wait(struct thread *td, struct proc *p) { - bool first; - PROC_ASSERT_HELD(p); PROC_LOCK_ASSERT(p, MA_OWNED); - for (first = true;; first = false) { - if (!first) - PROC_LOCK(p); - if (execve_block(td, p)) - return; - } + while (!execve_block(td, p)) + PROC_LOCK(p); } void From nobody Fri Jul 10 21:23:08 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 4gxlDX679yz6d6dY for ; Fri, 10 Jul 2026 21:23:08 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxlDX5M6Yz47Cv for ; Fri, 10 Jul 2026 21:23:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783718588; 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=lpb+ku3vJMASvGE2KzSJMLZk+LEnMcHd5r5c86et9Zc=; b=iG3qwayZIWNbeIEr8SIO6Ro7xPT/OxF8fsXlRnPaYUc6xCcHlq5AYb6M55RYcnBj/BFkFn yKsdxjLmURvl6DVKOm51yqLwnfvpsJCZnzl9xup4vbrFCpb+GeHcxtNDXkRPpiz7FPheZe 8jUecaFPRvvRD/jpWrz69bamkF9KlMH0aNyl7K1QTmNo4n9sa9aOeBh1mS0KjM565KFtGw mW7g3XUY0KtddAzx5UYWkFOI7EqI1BYYFQz7C880biMxKq2TxVvkbAiZ+PiFi0QkZPg0uO adAq4BfRkGEWWFw1zDA4JRtCbvJplBw0wpsWXgPH2B7jf76erTAYdKWdLj33uw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783718588; a=rsa-sha256; cv=none; b=JvcYUi06mDyR/SYmvdxMKWoS6IS+MGYOB0M0+fhR0VHCdKGSRCwcQwCJXXuuSpLbS7i35C 5zv3DX/96+zHtiAW8FrVxmAqbqLegZZXxEnJJyc2f7fEkKEDQNiFLz16Z2PL3XJKnDuSFy R4hA29/nSwsEHADPFirSY4GiO4+SzgNWWZLHhDnmLO4uP2zxWfAsPHQbBydSMGena0OAgZ mhg+f72aAj5ThWhgF8G9ZHgwg1pQ0VVZxW3W3FsqOVHunPsXTAL/RPUGCRUOWIEfzkTxAk cvxL4s+Y8AjvDHGJvIwhllNi7GST1u3ewpDl4eexYn1V842gomVqgsAQRx2Rzg== 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=1783718588; 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=lpb+ku3vJMASvGE2KzSJMLZk+LEnMcHd5r5c86et9Zc=; b=bCJ8HzqZjXJUvz5n+4JRuWDRAdg8rSWPLF/PnPd/J4RUDkG/riW0zYkCXnMOhkYV0Y4k6d jkWc8tv+wTPhFf+EuVh2MqtbMOXSKbPIEQ68Ij5aKePtBwGkDCK5+FvJK5p9+2XsIPYChv 0T5mzjYPB58AfsbPFslF/AGvDlYb6x2Vrv959lFwVLdE2S0tYefiF8AsDKVl1siaXAjEqk R3ePaiAm/kgfdrAOmKhzcqOmaHTjNcPw3z8MJdQlRyRzGp5ejRi56wGv1ENfzxs5zgCXjH 2CccBAyWyXlxEbZ7BK3oHqcYL8RegLwt7OEJ0nuXQZxJbYwtbUil3LUdK41aYg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxlDX459mz1BtT for ; Fri, 10 Jul 2026 21:23:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 31b0c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 21:23:08 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 24816abb8740 - main - syslogd: Limit rights on procdescs 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: 24816abb8740c387ad4aba4ad2fa4c23b191c351 Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 21:23:08 +0000 Message-Id: <6a5162bc.31b0c.37ccbdde@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=24816abb8740c387ad4aba4ad2fa4c23b191c351 commit 24816abb8740c387ad4aba4ad2fa4c23b191c351 Author: Mark Johnston AuthorDate: 2026-07-10 20:25:54 +0000 Commit: Mark Johnston CommitDate: 2026-07-10 21:21:59 +0000 syslogd: Limit rights on procdescs Reviewed by: jfree, kib MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D58160 --- usr.sbin/syslogd/syslogd.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 19190124c8b4..e3d144a532b5 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -3772,6 +3772,7 @@ validate(struct sockaddr *sa, const char *hname) int p_open(const char *prog, int *rpd) { + cap_rights_t rights; struct sigaction act = { }; int pfd[2], pd; pid_t pid; @@ -3823,6 +3824,10 @@ p_open(const char *prog, int *rpd) dprintf("Warning: cannot change pipe to PID %d to non-blocking" "behaviour.", pid); } + + if (cap_rights_limit(pd, + cap_rights_init(&rights, CAP_PDKILL, CAP_EVENT)) == -1) + err(1, "cap_rights_limit"); *rpd = pd; return (pfd[1]); } From nobody Fri Jul 10 21:23:09 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 4gxlDZ0QpDz6d6jJ for ; Fri, 10 Jul 2026 21:23:10 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxlDY6HCvz470g for ; Fri, 10 Jul 2026 21:23:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783718589; 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=bvvqEG9kGkLiMoUQCrLs1oOeEWJh66u+Mc7fAOXbXI4=; b=yi2sq8gbs1xZ9Bvb2YY/vLQI0Fs4SsESWLuxrsQg0n6t7d8yEQEw2rK9567Bp5tivi7M/E gG+WY1xup0Z1K4eYmvPUHQ5suojN2lq9QUlQY3586C2iBtrvbADQQSYz47JMEhPlNmpqIB 8IdJOeR3qrwlCoEw+w5WL03ThX0+t6puo05QmiH3B3sGNLgbV2t8UWCg5Y9O3s7ZlXGIXf +SYE0RFiO2JBTz5hbKfzAGxOdcTp07KGnsxNfbG4zw8mmGA1bXKgJiG+v6LUAmY7zeRIJk WFKWgfBplkCorBvfB96QclNELnrsTanuACsnzyOBh12LyK1jy97tLJlRjneYQA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783718589; a=rsa-sha256; cv=none; b=EGuHM5djBFdCY/FjzkzdygkU67Ib7QeOUhxa0sBpWP4oTc2NGNnbMlaiKgh9haB89boLBB wcLe07PKbZ9FOhx0y6jnzklZY8tJEnXXR+T7xv9hh2sm+ABqkM+wBZzEqXhKdxP7KdgJGn Y6hA+NmAVXqoJOvd5HhJRJCLoMY/QEFeuJsfVg8rxXq5q76idwvoV64N1UxyAsuf7NJwxm XILGZsez4c5CUJxx1CxeDplIsg2ZtLJwew93Ruxa4nNwL5ca3Owq0znVJkbfWeLLVY70Bp +kcpxd9pAMG+aOaISfGAROwXDvDa3rV6PnfYnJCQWnKtjWoUvlyJnSrj6jxE+A== 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=1783718589; 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=bvvqEG9kGkLiMoUQCrLs1oOeEWJh66u+Mc7fAOXbXI4=; b=SFZZBh4lTzDn9BX5XC/4Y0Bbd0HoBAmzZdowEjFDUhxzAZTjZpDx43QCnbm+IaRwTpwj7f si9A+GZZOIe3McBZY/mWJG+241c8O33EhFE0mhDDpfylpjVvuzrgiB2t5MP1zM29xXK6xa grUzItkfVgrB3JUFj+D7+Zp/s1FGjJTsKGJiK4PHcmlEXtJ16uZTrUM8Uw+G1tnZAsDnwQ +OSWkBRma3MC8ix9/6kG55UHIoSX/RqJ+fGgH5DAfk226gpsI/2ol4F6mwpliJl+5IKU4Z skhtGYfyM2h3aYLslSXkpPS69x/x1GteJxpkijnNIuxaN21lMwFfkOpj7Lmh0g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxlDY4slwz1BtV for ; Fri, 10 Jul 2026 21:23:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 31038 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 21:23:09 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 8ae306a1c8eb - main - git-mfc: Add an ignore-list feature 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: 8ae306a1c8eb919ca087cd20dc03e1d5a083abd6 Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 21:23:09 +0000 Message-Id: <6a5162bd.31038.62e610fe@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8ae306a1c8eb919ca087cd20dc03e1d5a083abd6 commit 8ae306a1c8eb919ca087cd20dc03e1d5a083abd6 Author: Mark Johnston AuthorDate: 2026-07-10 20:26:14 +0000 Commit: Mark Johnston CommitDate: 2026-07-10 21:21:59 +0000 git-mfc: Add an ignore-list feature Commit hashes listed in ~/.git-mfc-ignore are not listed in output of git-mfc --dangling or --pending. This is handy for silencing output about commits that are tagged for MFC or as fixing another commit, but which were not MFCed for some reason or other. Requested by: des Reviewed by: des Differential Revision: https://reviews.freebsd.org/D58161 --- tools/tools/git/git-mfc | 31 +++++++++++++++++++++++++++++++ tools/tools/git/git-mfc.1 | 14 ++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/tools/tools/git/git-mfc b/tools/tools/git/git-mfc index 42fb4f169412..7040443bea1b 100755 --- a/tools/tools/git/git-mfc +++ b/tools/tools/git/git-mfc @@ -250,6 +250,31 @@ def mfc_origins(repo, commit, warn=False): return origins +def load_ignore_list(repo): + """ + Load commit hashes from $HOME/.git-mfc-ignore. Each line has the format: + [ignored text] + where the hash may be abbreviated. Blank lines and lines starting with + '#' are skipped. Each hash is resolved to a full commit to validate it. + """ + path = os.path.join(os.environ['HOME'], '.git-mfc-ignore') + commits = set() + try: + with open(path) as f: + for lineno, line in enumerate(f, 1): + line = line.strip() + if not line or line.startswith('#'): + continue + abbrev = line.split()[0] + try: + commits.add(repo.commit(abbrev).hexsha) + except (git.exc.BadName, ValueError): + err(1, f"{path}:{lineno}: unknown commit {abbrev}") + except FileNotFoundError: + pass + return commits + + def dangling(repo, upstream, author=None, committer=None): """ Find commits in the current branch which have been cherry-picked from @@ -478,13 +503,19 @@ def main(): err(1, "could not determine user email; use -c or --all") if args.dangling: + ignored = load_ignore_list(repo) missing = dangling(repo, upstream, author=author, committer=committer) for fixup, commit in missing: + if fixup.hexsha in ignored: + continue print(f'{commit_summary(fixup)} fixes {commit_summary(commit)}') elif args.pending: + ignored = load_ignore_list(repo) results = pending(repo, upstream, author=author, committer=committer, baking=args.baking) for commit, ready_date, ready in results: + if commit.hexsha in ignored: + continue date_str = ready_date.strftime('%Y-%m-%d') if ready: status = f"ready since {date_str}" diff --git a/tools/tools/git/git-mfc.1 b/tools/tools/git/git-mfc.1 index 2594446201c2..9121c253f3a9 100644 --- a/tools/tools/git/git-mfc.1 +++ b/tools/tools/git/git-mfc.1 @@ -287,6 +287,20 @@ Use a different remote and origin branch: .Bd -literal -offset indent $ git mfc -r freebsd --origin main abc123 .Ed +.Sh FILES +.Bl -tag -width "$HOME/.git-mfc-ignore" +.It Pa $HOME/.git-mfc-ignore +A list of commits to exclude from +.Fl -pending +and +.Fl -dangling +output. +Each line contains a commit hash, optionally abbreviated, followed by +arbitrary text which is ignored. +Blank lines and lines beginning with +.Ql # +are skipped. +.El .Sh SEE ALSO .Xr git-cherry-pick 1 , .Xr git-config 1 , From nobody Fri Jul 10 21:23:10 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 4gxlDb1v6Mz6d6dl for ; Fri, 10 Jul 2026 21:23:11 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gxlDZ6v8rz478V for ; Fri, 10 Jul 2026 21:23:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783718591; 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=09LzzmgSULVMzKCIf4ttYdEb9GIIffBPSAqVF3I+MYU=; b=sQU/J9F3OSlCo6KKLGhG6t67u2F5+PMnfZgMiWtLvMmlHkvrbSLHT0uR75Jsuhd0IMJ2Sf 9mB90dc2xnuypAerQimF0m+J/sg541cbV7rlHmVI+xRVX+KOPAwcZfWWjl3tyJFRo9r4RK DQA2KnQAjSnTY6xdr7av/EytuHaS448lKRPx3cvUl21LXygSVFWKetMeiFkqbmflRIjC2E u2MEf697/0g6uP4DR6vbDDLya77R4qq0tnPxbO6PbjpTaYZsfM0XMw8EiV00anqDp7Ajz7 Ru8D4uS8lR3OSRnSt+GxA2lDqFj6bZc1qi7RxI/cIVOP7G69GuIrqQApLpS5Tg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783718591; a=rsa-sha256; cv=none; b=ZkNaXvGPMQvpBQd/xObn4FBHllbH0nWV+ugwfqegPw4aS7MEhmCfZy06aAzyzgmLr9/Fa/ y5PS8kT2lgIW4HBIBEZ+rC1DAIbKZBuw8uWKXiD8ACgnRKncvJ9P8BJsv85ZPMco68Sp4m wOKiEg+aomeBFgO8cRTwH9ZippdGABESw/nR47tqjNdHaZnL77dBLBH4WGX5+VQf9QMDjZ 43Nv8h41EDQzgipXY0+1ExjWk2U7B9rC8r++oIEQ+/QGcFe+P7qXqZYbyODe72RdxZPnNL G+StX25MfneABMLhkFggli/zla5pa+p7Bb//h2EbQ61iI8duRck3iCI6oyysdw== 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=1783718591; 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=09LzzmgSULVMzKCIf4ttYdEb9GIIffBPSAqVF3I+MYU=; b=p4P/a1MLvV0FEgA1up0os55Ryg+yWVkPHsqajOh6wX2csmQjUfwsBstxHSPlNWF4oWIBuZ 5rwDbGFuJ12ybYwv6bkcdMlSoj8USsYq75dNQBcBzbj8wHusDqmH3v+UIMQTJu/pyqNLm8 L5eXzK7jEiBjEcob0Vbwcwn9qLEBSglthijJgI0I2uwCdVRXYKygyGqJOkX8bl6mdbq/KZ nTDRiERvKCZAJ6Fq4ekO4yT3NknL2+mWMXkm5JcacyZwMQcn9s8/FBKarg4n+DqgJk+yl1 JNjbJBtwrK89rZw2tukJLuazaB5uZeOCeJEbWngciUFqKhJ05cBJ3vT6XXoXgQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gxlDZ5fQnz1BXX for ; Fri, 10 Jul 2026 21:23:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 30a2c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 10 Jul 2026 21:23:10 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 9bb576da3f60 - main - git-mfc: Update exception lists 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: 9bb576da3f6089ccb423966d65918e1fce346a32 Auto-Submitted: auto-generated Date: Fri, 10 Jul 2026 21:23:10 +0000 Message-Id: <6a5162be.30a2c.1299173f@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9bb576da3f6089ccb423966d65918e1fce346a32 commit 9bb576da3f6089ccb423966d65918e1fce346a32 Author: Mark Johnston AuthorDate: 2026-07-10 20:26:17 +0000 Commit: Mark Johnston CommitDate: 2026-07-10 21:21:59 +0000 git-mfc: Update exception lists This silences warnings when running git-mfc --pending against stable/13, 14 and 15. Reviewed by: des Differential Revision: https://reviews.freebsd.org/D58162 --- tools/tools/git/git-mfc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tools/tools/git/git-mfc b/tools/tools/git/git-mfc index 7040443bea1b..c5a39e3ba5a4 100755 --- a/tools/tools/git/git-mfc +++ b/tools/tools/git/git-mfc @@ -78,6 +78,25 @@ def fixes(repo, commit, warn=False): valid but malformed somehow. """ special = { + "956100d60fa86daebc1bd46ea62f207f6b54d93d": ["1bdf1b8186359d4ea26e26de03e03b7c1543b707"], + "013c58ced6aef26bad7ca5c6eb829b9d586f6edb": ["2fefe2c88b31dc7f173c9424f3eb13d49e98d55a"], + "63c9b018069b58bacb2875c83c676cc8c4f40d69": ["2fefe2c88b31dc7f173c9424f3eb13d49e98d55a"], + "27c41b28b1d7749c4dde266a12cd9ff93f168767": ["2ad0f7e91582dde5475ceb1a1942930549e5c628"], + "56c45700f2ae15755358f2da8266247613c564df": ["b1c38df05d79c81ee1e9fd0942774820a4ffcb63"], + "1580f8d9c1740e0c54554e6c185573d34f2dcf76": [], + "a18be39aafc1b55fd67603ee6a6d820d0fcd877f": ["518cdd344ec51584478f39b9a9cac77fc0766ce1"], + "337f5e7a44c4d5ac29e0b0c0fe957bb3b9bae222": ["518cdd344ec51584478f39b9a9cac77fc0766ce1"], + "be8e84c2e9240110ce99bb8d14259073340e4ef6": ["de78657a3aef3c2efbcbdf9ea73a95283c91fab0"], + "9b56dfd27c64fcaf2dfbaa1eb3e2bd2b163fa56c": [], + "5fea0aec5c8e7e8e68a3f0de6ae717588344a6b4": ["deaae83da0571af7c97acf8f1444a00350e21e3a"], + "93bc3d83a11a1dbebd264616d63af3dd32cc1c8c": ["06410c1b51637e5e1f392d553b5008948af58014"], + "1a9ec72022ddce0cacb9aedda3d69aa95cd45ed0": ["f9a71840d8ee0cfff4ec983a589be53648e7017d"], + "b033e3684fd14c798405420449eb55e1d4f9df1e": ["f42421307b115345ea1a6c8fdf61fbb581e4400f"], + "2a5b083c1f7e0a4518bd944241af1d1102997c4d": ["58580dc0c694b107ba7ba1b14dc8ee8f306e53f6"], + "cbb7441245cf2b22efed17dec3c88587c980c691": ["05322eec86ae42a8f873ba10d8da61bd61b5b48f"], + "7e68af7ce2c1b892954df415774fe59fd2f1b62f": [], + "2612f1b8649bb4f069a6a064ed714daa5f10d037": [], + "43d632779b7d1df6c96a5cc0f506c13e09a845f3": ["2358492b0347b11178fb594069330820f11ec81f"], "a693d17b9985a03bd9b5108e890d669005ab41eb": ["8a42005d1e491932666eb9f0be3e70ea1a28a3f7"], "a04ca1c229195c7089b878a94fbe76505ea693b5": ["93b7818226cf5270646725805b4a8c17a1ad3761"], "852088f6af6c5cd44542dde72aa5c3f4c4f9353c": ["b5fb9ae6872c499f1a02bec41f48b163a73a2aaa"], @@ -221,6 +240,11 @@ def mfc_origins(repo, commit, warn=False): "5946b0c6cbc77e6c5f62f5f7e635c6036e14f4d0": [], "06bb8e1dab004ccb283f7a20fe84aa1326baf6b7": [], "e5fadc41b48045d8978993d6c4ac72c64542b470": ["e20971500194d2f7299e9d01ca3b20e9bc6b4009"], + "3ba946aebf747e12da4fb22ee0e45ee0e3a233ee": ["c4380d5b9383e2a062840573b36ab643b65b2610"], + "3a84c630f2361763f8cd1390847677dfe8fb0b01": ["841be1d0495224a47d3dbfd8647c7fcbf58b205c"], + "827fd20d07a46879c66bb6899ad1d780845b1b6c": ["83fa80a5500ed7baccedfa90ad55ac879af710c9"], + "be72364ad64ac3c350cbd47130794db254fc77b0": ["b1ccab17213b38aa269e85c6b371d69eb25b6ca9"], + "4fc0ae5d6b459156317acc070acbbdc53cda1d6e": ["7359df79d3affeccf17f12f16c23ba3d4c5e0346"], # stable/13 "fb4bc4c325eca15247a2e21ded0a70f92ec15488": ["c57c02ebf7bcc9b02a0dc11711e8d8a6960ad34b"], "213406054e46b50d5df6d28b01a0a3410132b322": ["62af5b9dc6205289a0ace964d060fba64e71ef28"], @@ -233,6 +257,7 @@ def mfc_origins(repo, commit, warn=False): "a75324d674f5df10f1407080a49cfe933dbb06ec": ["64ae2f785e0672286901c15045a24cbc533538d3"], "0729ba2f49c956789701aecb70f4f555181fd3a7": ["91a8bed5a49eb2d1e4e096a4c68c108cebec8818"], "bec0d2c9c8413707b0fff8e65fb96aa53f149be3": ["8d5c7813061dfa0b187500dfe3aeea7a28181c13"], + "66b1d696db1284ac9f9bb4037ffc288091f5ba84": ["f9a039060e834e89e0b2de1e8a442d78bd5c083d"], } if commit.hexsha in special: return [repo.commit(s) for s in special[commit.hexsha]] From nobody Sat Jul 11 08:40:05 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 4gy2Fd5MNbz6khlp for ; Sat, 11 Jul 2026 08:40:05 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gy2Fd4Tmcz3y27 for ; Sat, 11 Jul 2026 08:40:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783759205; 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=AwFOKScIT3dRxGw5+coVbR46B4K53jt206X0W9dxIWE=; b=qRRFyz1LDZrK8moBTo/qvQYRV9Oak6a9D/UGZMjL6bUO6zged1ojd5sk3Vq18OcfriJRjy SNftbv6C8leFF9ysaeph6g9vPcWEn8kGKFuNghKlORrbbNTgckDTi7h2d+OwXaCQ7PCVbn oYbruMFqlbPWLXNejt0q7wn8O6iSJAEEQ1+NngMR1L4gkkLR5u1HcybdTAbMbwOhga6hoA Kw8Gt6SQUPBaxvyGN+6pXKvvxXfmZy1B+ReglaLiVCdjFmV8sis310WjhO061h3tKOTK2V e+sBxL24Dux0l34NXLzq5UNqRvrq2h5afZhGvC+7DMuCNO/wW8nbuhx1nTJXrg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783759205; a=rsa-sha256; cv=none; b=E3ob8OxMxSDIZcYNlsJaBNIH95HEbrD3d0URrjR48kHAIw3MvaUDSnYlleCfv0tbeZG97G mOXa8YMcNfcKE3uSTSquuvS5ycvHaf3DnTtitP88n6K2MNNFbhDTzU9zXs87pgAtunbCMc pUu924fNEov7lKTsyrarL5OkCcSI7nrU4D/rz9eEftoCgfwZu8ZuV0nKXhPP7qf4Na5Azq aOctDRIpeNjfOJLPZ6DzQ9zhB4Pd5blZsYqFE32PWBpYzPQN5N9OnI8N+RBvRCRsnOHeeb Vf1xIKJ0IW2Ag6hSqUPx6jgd1jD3R7iotnFr02rqRdXj1aYQgbaJS6sJr3vNdw== 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=1783759205; 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=AwFOKScIT3dRxGw5+coVbR46B4K53jt206X0W9dxIWE=; b=KLURraIh166CIGGLD34w/HtYEEwQc5Hghl0eMpdyyEM7o+TiNaGahU3CvYAbTfEsppqmEc 5hD8anKgzJ2Gu833juKdFuVDwc+pRZ6KtpZ4U/mHjw+ZjLWlBFKL5zaEdmmsVAwxMyqt80 4FCWmnCMKKco6w+CyRpJCwbo98R89agJJr1xm/9opEyeHEj9AoukYL8pTqhvgA4WbvW+pi X+K4+S9HmIUdr8VVu8vcZhc4T01Bx5uFNU5z4y12fChayeDdC+7wOf+tUIMtRqrcPWKyw1 6EMPPpIE8Sb9S53rdJOY7A9dy1L5Qozeh8Tg4v5GVlnrysZAihbrqv76jxA/hw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gy2Fd38C4zb4H for ; Sat, 11 Jul 2026 08:40:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 317d6 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 11 Jul 2026 08:40:05 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: ShengYi Hung Subject: git: 86691d52a6d3 - main - kvm: Support non-default CPUID leaf 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: aokblast X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 86691d52a6d3796ad36ba474cf0a9493f6d99202 Auto-Submitted: auto-generated Date: Sat, 11 Jul 2026 08:40:05 +0000 Message-Id: <6a520165.317d6.7830b157@gitrepo.freebsd.org> The branch main has been updated by aokblast: URL: https://cgit.FreeBSD.org/src/commit/?id=86691d52a6d3796ad36ba474cf0a9493f6d99202 commit 86691d52a6d3796ad36ba474cf0a9493f6d99202 Author: ShengYi Hung AuthorDate: 2026-07-10 09:21:11 +0000 Commit: ShengYi Hung CommitDate: 2026-07-11 08:39:36 +0000 kvm: Support non-default CPUID leaf KVM does not always use 0x40000000 as its CPUID base. For example, QEMU adds a 0x100 offset when nested virtualization is detected and the host exposes Hyper-V enlightenment hints. To accommodate this behavior, switch the detection logic to use the CPUID leaf returned by do_cpuid(), making the implementation more flexible. See: https://github.com/qemu/qemu/blob/master/target/i386/kvm/kvm.c#L2300 Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D58146 --- sys/x86/include/kvm.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/x86/include/kvm.h b/sys/x86/include/kvm.h index 83dd20fa8d23..5414075f89d6 100644 --- a/sys/x86/include/kvm.h +++ b/sys/x86/include/kvm.h @@ -45,7 +45,7 @@ #include #define KVM_CPUID_SIGNATURE 0x40000000 -#define KVM_CPUID_FEATURES_LEAF 0x40000001 +#define KVM_CPUID_FEATURES_LEAF(base) ((base) + 1) #define KVM_FEATURE_CLOCKSOURCE 0x00000001 #define KVM_FEATURE_CLOCKSOURCE2 0x00000008 @@ -63,8 +63,7 @@ static inline bool kvm_cpuid_features_leaf_supported(void) { return (vm_guest == VM_GUEST_KVM && - KVM_CPUID_FEATURES_LEAF > hv_base && - KVM_CPUID_FEATURES_LEAF <= hv_high); + KVM_CPUID_FEATURES_LEAF(hv_base) <= hv_high); } static inline void @@ -73,7 +72,7 @@ kvm_cpuid_get_features(u_int *regs) if (!kvm_cpuid_features_leaf_supported()) regs[0] = regs[1] = regs[2] = regs[3] = 0; else - do_cpuid(KVM_CPUID_FEATURES_LEAF, regs); + do_cpuid(KVM_CPUID_FEATURES_LEAF(hv_base), regs); } #endif /* !_X86_KVM_H_ */ From nobody Sat Jul 11 15:51:36 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 4gyCqX3y7Fz6lHJw for ; Sat, 11 Jul 2026 15:51:36 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyCqX2PfQz3Df5 for ; Sat, 11 Jul 2026 15:51:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783785096; 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=eS2+UKNgktjdaM5sFJqEMgwYl/0NeuYUOzmwBmLP7iE=; b=GUFOHWQLVP/FRqqtcJqwq2OGpVfVDE4luzzAiIaTr4FhONDmmQQudD3bzVQQKq38Kux575 Qzo7rl6vkJcdDTJfBoUAuK7cARBdgNeJVJYCftcG18lXSuBa5zkQXHc01+pNsWopLs0LCy tXxga/wcrZZhmF2Qdxw2EkwIu2XRwI75+Yo5r1P7neaKm2WGIQeOk2TquRvRIt+DAiPC4R /zQ5w3UVdGQYWz0W5TeymJEJN1jdDQc5W7F7Uk0ePau1P6nml1RQLo7MNeZgKwXDvFXVp5 tEtFrgBM/qt81Tl/dJvDIVfIfefNHKzSKN4grmdTnvmhk9w09HxrU509fdhi9Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783785096; a=rsa-sha256; cv=none; b=fP/9SWx1fNS6lIReHFC+92jWxMzVuq/Yb/yTCMbuXvYWf1amkaSqL/8PXXJgyklCpIOcv0 uVgeSv1cy9mh0D7X6w4HfKjtr4cbHw7iPRCsF1b2TpMeUK8f2gS7/Subm4GqhpYa0bGbN5 6Lkllaf9i+CFZC9zk8AatfNj9i+BtK3ooX78CI1/XqpkP8gzDOmDM3MnL4VdwhKDP7sHKe ap5LmTW5cO751VD5kAdrKI9rXaxAwZ0zwJMA8rDfss22HXyA2L60IuNDzwIJT7yE4hGJjM 1M+tAhSAPJofWrJGvmAMK6IfeTzzuh8lrs1Cx8SiGd8HdxnoQvcWsTm13C/dlQ== 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=1783785096; 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=eS2+UKNgktjdaM5sFJqEMgwYl/0NeuYUOzmwBmLP7iE=; b=eRh8nQH41Qveo6E0/cvZZzRnTpbxsQIYVopvrUy/uh84hF9abdo265l+i72JHupTxOlIHc 8Vicg3BgRk7waIaErrjxx7mjlhFCs59n4Hwp8OA1qN913340ygP0fGcPO/S8ru70vMM136 qMOkkgaPofkmdWTvCd62yvjDrQKjEMscoGZxe9jhxkdyURPGdbrXFhWzR4wTZhmL5rQQc9 vvsRz//q6zBjksQtbXsp+pSjeezQY6uHqi/Lyg6NIImcUmjFN8CHXq7rac8xsYAJ3MTwQ8 sP5DNhb8ijS+1AWt9tivou8IlMS8+2Il/wTQgs4XloBgKbQnn/2yV7QqGpto2w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyCqX1SmRzn0d for ; Sat, 11 Jul 2026 15:51:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 386dd by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 11 Jul 2026 15:51:36 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: c52bcd09c2a6 - main - nfsd: Garbage collect stray NFSv4 state 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: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c52bcd09c2a6736fe841fd72e3cfb74de5a35b03 Auto-Submitted: auto-generated Date: Sat, 11 Jul 2026 15:51:36 +0000 Message-Id: <6a526688.386dd.2aa996fc@gitrepo.freebsd.org> The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=c52bcd09c2a6736fe841fd72e3cfb74de5a35b03 commit c52bcd09c2a6736fe841fd72e3cfb74de5a35b03 Author: Rick Macklem AuthorDate: 2026-07-11 15:49:12 +0000 Commit: Rick Macklem CommitDate: 2026-07-11 15:49:12 +0000 nfsd: Garbage collect stray NFSv4 state When a file is deleted on the NFS server by another client, any NFSv4 state related to that file is left stranded. This happens because the NFSv4 operations that free the state use a CFH, which is set by a PutFH operation. However, the PutFH fails with ESTALE because the file has been deleted. This patch adds a function called nfsrv_freestrandedstate() that frees all the NFSv4 state related to a file and calls this function when PutFH will be replying ESTALE. While here, a helper function was defined to handle free'ng of the nfslockfile structure and replaces the two places where nearly identical code does this. Reported by: Richard Purdie Tested by: Michael Halstead MFC after: 2 weeks --- sys/fs/nfsserver/nfs_nfsdstate.c | 89 +++++++++++++++++++++++++++++++++------- 1 file changed, 75 insertions(+), 14 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index 102af9bb2951..d790ab974d07 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -253,6 +253,7 @@ static void nfsrv_issuedelegation(struct vnode *vp, struct nfsclient *clp, nfsv4stateid_t *delegstateidp); static void nfsrv_clientlock(bool mlocked); static void nfsrv_clientunlock(bool mlocked); +static void nfsrv_freelockifnotinuse(struct nfslockfile *lfp); /* * Lock the client structure, either with the mutex or the exclusive nfsd lock. @@ -1537,20 +1538,13 @@ nfsrv_freedeleglist(struct nfsstatehead *sthp) static void nfsrv_freedeleg(struct nfsstate *stp) { - struct nfslockfile *lfp; LIST_REMOVE(stp, ls_hash); LIST_REMOVE(stp, ls_list); LIST_REMOVE(stp, ls_file); if ((stp->ls_flags & NFSLCK_DELEGWRITE) != 0) nfsrv_writedelegcnt--; - lfp = stp->ls_lfp; - if (LIST_EMPTY(&lfp->lf_open) && - LIST_EMPTY(&lfp->lf_lock) && LIST_EMPTY(&lfp->lf_deleg) && - LIST_EMPTY(&lfp->lf_locallock) && LIST_EMPTY(&lfp->lf_rollback) && - lfp->lf_usecount == 0 && - nfsv4_testlock(&lfp->lf_locallock_lck) == 0) - nfsrv_freenfslockfile(lfp); + nfsrv_freelockifnotinuse(stp->ls_lfp); free(stp, M_NFSDSTATE); VNET(nfsstatsv1_p)->srvdelegates--; nfsrv_openpluslock--; @@ -1632,12 +1626,7 @@ nfsrv_freeopen(struct nfsstate *stp, vnode_t vp, int cansleep, NFSPROC_T *p) * If there are locks associated with the open, the * nfslockfile structure can be freed via nfsrv_freelockowner(). */ - if (lfp != NULL && LIST_EMPTY(&lfp->lf_open) && - LIST_EMPTY(&lfp->lf_deleg) && LIST_EMPTY(&lfp->lf_lock) && - LIST_EMPTY(&lfp->lf_locallock) && LIST_EMPTY(&lfp->lf_rollback) && - lfp->lf_usecount == 0 && - nfsv4_testlock(&lfp->lf_locallock_lck) == 0) - nfsrv_freenfslockfile(lfp); + nfsrv_freelockifnotinuse(lfp); free(stp, M_NFSDSTATE); VNET(nfsstatsv1_p)->srvopens--; nfsrv_openpluslock--; @@ -8881,3 +8870,75 @@ nfsrv_removedeleg(fhandle_t *fhp, struct nfsrv_descript *nd, NFSPROC_T *p) } NFSUNLOCKSTATE(); } + +/* + * Free the nfslockfile structure if not in use. + */ +static void +nfsrv_freelockifnotinuse(struct nfslockfile *lfp) +{ + + /* + * The nfslockfile is freed here if there are no locks + * associated with the open. + * If there are locks associated with the open, the + * nfslockfile structure can be freed via nfsrv_freelockowner(). + */ + if (lfp != NULL && LIST_EMPTY(&lfp->lf_open) && + LIST_EMPTY(&lfp->lf_deleg) && LIST_EMPTY(&lfp->lf_lock) && + LIST_EMPTY(&lfp->lf_locallock) && LIST_EMPTY(&lfp->lf_rollback) && + lfp->lf_usecount == 0 && + nfsv4_testlock(&lfp->lf_locallock_lck) == 0) + nfsrv_freenfslockfile(lfp); +} + +/* + * Free stranded open/lock/delegation/layouts. + * (These become stranded if the file has been deleted.) + */ +void +nfsrv_freestrandedstate(struct nfsrvfh *nfp) +{ + struct nfslockfile *lfp; + struct nfsstate *stp, *nstp; + struct nfslayouthash *lhyp; + struct nfslayout *lyp, *nlyp; + fhandle_t *fhp; + + if (nfp->nfsrvfh_len != NFSX_MYFH) + return; + fhp = (fhandle_t *)nfp->nfsrvfh_data; + NFSLOCKSTATE(); + if (nfsrv_getlockfile(0, NULL, &lfp, fhp, 0) < 0) { + NFSUNLOCKSTATE(); + return; + } + lfp->lf_usecount++; /* So nfsrv_freeopen() does not free it. */ + /* Note that nfsrv_freeopen() will also free the byte range locks. */ + LIST_FOREACH_SAFE(stp, &lfp->lf_open, ls_file, nstp) + nfsrv_freeopen(stp, NULL, 0, curthread); + + /* + * Normally, a delegation will have been recalled when the file is + * removed. However, get rid of any that have somehow been + * left stranded. + */ + LIST_FOREACH_SAFE(stp, &lfp->lf_deleg, ls_file, nstp) + nfsrv_freedeleg(stp); + + /* Get rid of the nfslockfile, if no longer in use. */ + lfp->lf_usecount--; + nfsrv_freelockifnotinuse(lfp); + NFSUNLOCKSTATE(); + + /* Free any layouts for the pNFS server case. */ + if (nfsrv_devidcnt == 0) + return; + lhyp = NFSLAYOUTHASH(fhp); + NFSLOCKLAYOUT(lhyp); + TAILQ_FOREACH_SAFE(lyp, &lhyp->list, lay_list, nlyp) { + if (NFSBCMP(&lyp->lay_fh, fhp, sizeof(*fhp)) == 0) + nfsrv_freelayout(&lhyp->list, lyp); + } + NFSUNLOCKLAYOUT(lhyp); +} From nobody Sat Jul 11 17:28:54 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 4gyG0Y3wWsz6lNtC; Sat, 11 Jul 2026 17:29:33 +0000 (UTC) (envelope-from freebsd@walstatt-de.de) Received: from smtp6.goneo.de (smtp6.goneo.de [85.220.129.31]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4gyG0X51W8z3NNc; Sat, 11 Jul 2026 17:29:32 +0000 (UTC) (envelope-from freebsd@walstatt-de.de) Authentication-Results: mx1.freebsd.org; none Received: from hub2.goneo.de (hub2.goneo.de [IPv6:2001:1640:5::8:53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by smtp6.goneo.de (Postfix) with ESMTPS id 7A460240548; Sat, 11 Jul 2026 19:29:30 +0200 (CEST) Received: from hub2.goneo.de (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by hub2.goneo.de (Postfix) with ESMTPS id 96D63240363; Sat, 11 Jul 2026 19:29:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walstatt-de.de; s=DKIM001; t=1783790965; 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: in-reply-to:in-reply-to:references:references; bh=XN7uD7y03eKL6+Hg0UbztGsgO7dgnGJi6Hvdu2jx8tA=; b=ZHNvbV3mSBXkl4/W+tIzATWrCUOSbu6hNfTb/DgpllpEx9U/Qv+JPsFHNh2ta0+14O8zfI EHLW2AkrZEspC476o3/vKP0QlEe2p28Sb/BS4YANWZwSUWfNVsoToOGynnonm8wdUeXsD5 yucvZPjtNFWBeqOszqFOZ4Jk7xFhuVr2IJLuz0/yj1K6wCAQbfpR7XJOuJlm/RT6IRbZ/G FV4kKbxO1mkvUegyj8hqWiNLN98ZqoDrkRulbwbZqEF19EARW9lJoSGAJ9JQauBX5syluH FDFeV1OdPW9sKqWoh4rtHcvq6hWPQ6wLxCRdLPKF98sCt1U6fh8UyXWhKqTwqQ== Received: from thor.sb211.local (dynamic-2a02-3100-253b-6f02-e310-7648-7860-5ce4.310.pool.telefonica.de [IPv6:2a02:3100:253b:6f02:e310:7648:7860:5ce4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange secp256r1 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by hub2.goneo.de (Postfix) with ESMTPSA id 504DD240182; Sat, 11 Jul 2026 19:29:25 +0200 (CEST) Date: Sat, 11 Jul 2026 19:28:54 +0200 From: A FreeBSD User To: Rick Macklem Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: c52bcd09c2a6 - main - nfsd: Garbage collect stray NFSv4 state Message-ID: <20260711192455.1fcbe221@thor.sb211.local> In-Reply-To: <6a526688.386dd.2aa996fc@gitrepo.freebsd.org> References: <6a526688.386dd.2aa996fc@gitrepo.freebsd.org> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; amd64-portbld-freebsd16.0) 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: multipart/signed; boundary="Sig_/5ZIBhD6k_kyyD9D73.tkZGc"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Rspamd-UID: 461517 X-Rspamd-UID: 36345b X-Rspamd-Queue-Id: 4gyG0X51W8z3NNc X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:25394, ipnet:85.220.128.0/17, country:DE] X-Spamd-Bar: ---- --Sig_/5ZIBhD6k_kyyD9D73.tkZGc Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Am Tage des Herren Sat, 11 Jul 2026 15:51:36 +0000 Rick Macklem schrieb: > The branch main has been updated by rmacklem: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3Dc52bcd09c2a6736fe841fd72e3= cfb74de5a35b03 >=20 > commit c52bcd09c2a6736fe841fd72e3cfb74de5a35b03 > Author: Rick Macklem > AuthorDate: 2026-07-11 15:49:12 +0000 > Commit: Rick Macklem > CommitDate: 2026-07-11 15:49:12 +0000 >=20 > nfsd: Garbage collect stray NFSv4 state > =20 > When a file is deleted on the NFS server by another client, > any NFSv4 state related to that file is left stranded. > This happens because the NFSv4 operations that free the > state use a CFH, which is set by a PutFH operation. > However, the PutFH fails with ESTALE because the file has > been deleted. > =20 > This patch adds a function called nfsrv_freestrandedstate() > that frees all the NFSv4 state related to a file and calls > this function when PutFH will be replying ESTALE. > =20 > While here, a helper function was defined to handle free'ng > of the nfslockfile structure and replaces the two places > where nearly identical code does this. > =20 > Reported by: Richard Purdie > Tested by: Michael Halstead > MFC after: 2 weeks > --- > sys/fs/nfsserver/nfs_nfsdstate.c | 89 +++++++++++++++++++++++++++++++++-= ------ > 1 file changed, 75 insertions(+), 14 deletions(-) >=20 > diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsd= state.c > index 102af9bb2951..d790ab974d07 100644 > --- a/sys/fs/nfsserver/nfs_nfsdstate.c > +++ b/sys/fs/nfsserver/nfs_nfsdstate.c > @@ -253,6 +253,7 @@ static void nfsrv_issuedelegation(struct vnode *vp, s= truct nfsclient > *clp, nfsv4stateid_t *delegstateidp); > static void nfsrv_clientlock(bool mlocked); > static void nfsrv_clientunlock(bool mlocked); > +static void nfsrv_freelockifnotinuse(struct nfslockfile *lfp); > =20 > /* > * Lock the client structure, either with the mutex or the exclusive nfs= d lock. > @@ -1537,20 +1538,13 @@ nfsrv_freedeleglist(struct nfsstatehead *sthp) > static void > nfsrv_freedeleg(struct nfsstate *stp) > { > - struct nfslockfile *lfp; > =20 > LIST_REMOVE(stp, ls_hash); > LIST_REMOVE(stp, ls_list); > LIST_REMOVE(stp, ls_file); > if ((stp->ls_flags & NFSLCK_DELEGWRITE) !=3D 0) > nfsrv_writedelegcnt--; > - lfp =3D stp->ls_lfp; > - if (LIST_EMPTY(&lfp->lf_open) && > - LIST_EMPTY(&lfp->lf_lock) && LIST_EMPTY(&lfp->lf_deleg) && > - LIST_EMPTY(&lfp->lf_locallock) && LIST_EMPTY(&lfp->lf_rollback) && > - lfp->lf_usecount =3D=3D 0 && > - nfsv4_testlock(&lfp->lf_locallock_lck) =3D=3D 0) > - nfsrv_freenfslockfile(lfp); > + nfsrv_freelockifnotinuse(stp->ls_lfp); > free(stp, M_NFSDSTATE); > VNET(nfsstatsv1_p)->srvdelegates--; > nfsrv_openpluslock--; > @@ -1632,12 +1626,7 @@ nfsrv_freeopen(struct nfsstate *stp, vnode_t vp, i= nt cansleep, > NFSPROC_T *p) > * If there are locks associated with the open, the > * nfslockfile structure can be freed via nfsrv_freelockowner(). > */ > - if (lfp !=3D NULL && LIST_EMPTY(&lfp->lf_open) && > - LIST_EMPTY(&lfp->lf_deleg) && LIST_EMPTY(&lfp->lf_lock) && > - LIST_EMPTY(&lfp->lf_locallock) && LIST_EMPTY(&lfp->lf_rollback) && > - lfp->lf_usecount =3D=3D 0 && > - nfsv4_testlock(&lfp->lf_locallock_lck) =3D=3D 0) > - nfsrv_freenfslockfile(lfp); > + nfsrv_freelockifnotinuse(lfp); > free(stp, M_NFSDSTATE); > VNET(nfsstatsv1_p)->srvopens--; > nfsrv_openpluslock--; > @@ -8881,3 +8870,75 @@ nfsrv_removedeleg(fhandle_t *fhp, struct nfsrv_des= cript *nd, > NFSPROC_T *p) } > NFSUNLOCKSTATE(); > } > + > +/* > + * Free the nfslockfile structure if not in use. > + */ > +static void > +nfsrv_freelockifnotinuse(struct nfslockfile *lfp) > +{ > + > + /* > + * The nfslockfile is freed here if there are no locks > + * associated with the open. > + * If there are locks associated with the open, the > + * nfslockfile structure can be freed via nfsrv_freelockowner(). > + */ > + if (lfp !=3D NULL && LIST_EMPTY(&lfp->lf_open) && > + LIST_EMPTY(&lfp->lf_deleg) && LIST_EMPTY(&lfp->lf_lock) && > + LIST_EMPTY(&lfp->lf_locallock) && LIST_EMPTY(&lfp->lf_rollback) && > + lfp->lf_usecount =3D=3D 0 && > + nfsv4_testlock(&lfp->lf_locallock_lck) =3D=3D 0) > + nfsrv_freenfslockfile(lfp); > +} > + > +/* > + * Free stranded open/lock/delegation/layouts. > + * (These become stranded if the file has been deleted.) > + */ > +void > +nfsrv_freestrandedstate(struct nfsrvfh *nfp) > +{ > + struct nfslockfile *lfp; > + struct nfsstate *stp, *nstp; > + struct nfslayouthash *lhyp; > + struct nfslayout *lyp, *nlyp; > + fhandle_t *fhp; > + > + if (nfp->nfsrvfh_len !=3D NFSX_MYFH) > + return; > + fhp =3D (fhandle_t *)nfp->nfsrvfh_data; > + NFSLOCKSTATE(); > + if (nfsrv_getlockfile(0, NULL, &lfp, fhp, 0) < 0) { > + NFSUNLOCKSTATE(); > + return; > + } > + lfp->lf_usecount++; /* So nfsrv_freeopen() does not free it. */ > + /* Note that nfsrv_freeopen() will also free the byte range locks. */ > + LIST_FOREACH_SAFE(stp, &lfp->lf_open, ls_file, nstp) > + nfsrv_freeopen(stp, NULL, 0, curthread); > + > + /* > + * Normally, a delegation will have been recalled when the file is > + * removed. However, get rid of any that have somehow been > + * left stranded. > + */ > + LIST_FOREACH_SAFE(stp, &lfp->lf_deleg, ls_file, nstp) > + nfsrv_freedeleg(stp); > + > + /* Get rid of the nfslockfile, if no longer in use. */ > + lfp->lf_usecount--; > + nfsrv_freelockifnotinuse(lfp); > + NFSUNLOCKSTATE(); > + > + /* Free any layouts for the pNFS server case. */ > + if (nfsrv_devidcnt =3D=3D 0) > + return; > + lhyp =3D NFSLAYOUTHASH(fhp); > + NFSLOCKLAYOUT(lhyp); > + TAILQ_FOREACH_SAFE(lyp, &lhyp->list, lay_list, nlyp) { > + if (NFSBCMP(&lyp->lay_fh, fhp, sizeof(*fhp)) =3D=3D 0) > + nfsrv_freelayout(&lhyp->list, lyp); > + } > + NFSUNLOCKLAYOUT(lhyp); > +} >=20 It seems this commit breaks buildkernel for me: [...] /usr/src/sys/fs/nfsserver/nfs_nfsdstate.c:8900:1: error: no previous protot= ype for function 'nfsrv_freestrandedstate' [-Werror,-Wmissing-prototypes] 8900 | nfsrv_frees= trandedstate(struct nfsrvfh *nfp Kind regards, oh --=20 A FreeBSD user --Sig_/5ZIBhD6k_kyyD9D73.tkZGc Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iJEEARYKADkWIQRQheDybVktG5eW/1Kxzvs8OqokrwUCalJ9cRsUgAAAAAAEAA5t YW51MiwyLjUrMS4xMiwyLDMACgkQsc77PDqqJK+7agD9EoSdyu3IwmFusl5AUjJD BzwqD/s5OMSSJs/AugyPwcEBAMvkLGCyLDzx8BluuJMGsc+QK0UMVKXPBztBWYia CbEG =Myfr -----END PGP SIGNATURE----- --Sig_/5ZIBhD6k_kyyD9D73.tkZGc-- From nobody Sat Jul 11 17:46: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 4gyGPP3VHSz6lQ2w; Sat, 11 Jul 2026 17:47:37 +0000 (UTC) (envelope-from pouria@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyGPP2SLwz3PBf; Sat, 11 Jul 2026 17:47:37 +0000 (UTC) (envelope-from pouria@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783792057; 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: in-reply-to:in-reply-to:references:references; bh=qmVPvL+MlaCbhKDnS5RrmfbHkVdFhJS4eH5PILj1P0s=; b=L9lDzPr2ZkgtQoexCLQ5nSAnnVT6mC/6WeaZ+Iks8EiMMUoZjk8gni4u04bhGjkKrLLeb+ QLok1m/iV8Tjt2ZANbXgyRLchN4A7iwGsA11Ff9ra3UndCTxM4m5gJyt+rSJXpaiqI9CXu KWjPtyxgvYzZHh3HCrWRUeGxAQwxSqTrRWd03R4RNFe7TW4mF92lVuAyRVivywkC6ggPCf juIoLLIR9YsRhEPNJKZvkFFtwVFPFG8GI1O6a+61bMh8op8o7g3bDsa9xh7xtPBDvJMoxG wFs8dm3TE0ea5qjAeRxVpfwIXoZjLeyEdrGLCbvc3gW9+tlRR/TUXLcs/7NPkA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783792057; a=rsa-sha256; cv=none; b=SqkjIm1TyPSTleuL1S7ehR4jewqYOhx/2rleOnY05Hk8NLtT25F63rORzJIa6hdNgEIDQX S+2VtNX7ZFxA7xwMPsn8Ci9rCLxfEHLNgIotwvQq69J1sYlbHEY1YLWfmhqV7X2ZoHylOZ LpBGFqul+Cbw8q9zYsDgrJifl1nu+xXsCSqZPFhr9CIwKDPjro9XWczMVYHETH6p+MLBLo X8iiJrPEd+ewdj6IBBuiq+Xc9a26pvEk3L/l1Kyv893uAvhXR34bGxqxnVPCChhVPQnI7o IpcAc0Q4JSU8ISBRY0kpX1d7ZhlZ1BE0ynuH2HRkzIFO0zPyVPuU45IRX18c+w== 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=1783792057; 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: in-reply-to:in-reply-to:references:references; bh=qmVPvL+MlaCbhKDnS5RrmfbHkVdFhJS4eH5PILj1P0s=; b=cyuKiodGmds6P3+utIRToDU4D7ipC4i6yloCcShJpe3xo3CeeqeGyHFmJpLNnMn0iApwT9 iIs8YDnYBAEaPlLMfLPdfDhsNy3t0I9HLDrq6tq87ahcim9AgzPDIqHf2ipnlcHrmnRTtX UH4LYdXDF/70Vcru6A4XMLPtzXEyOvHqPh2NVf1q1THow/upxjRc3w3GE4Uk7G02N3tES3 C2ZQTkD8THeHFrYUQRJL7/L1tPrvbFYN/ZGQ7PcVc3vCqF2Y9U0dBQicXPUZUspx5z6qi0 8hg86ibmJ7NST6zoU+jE9u5ApssjYWx4HMhDJOVsA3pAWr4tWTommt5y3M0JyA== Received: from nl.mail.spmzt.net (mail.spmzt.net [193.148.248.214]) (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) (Authenticated sender: pouria) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gyGPN524nzNfv; Sat, 11 Jul 2026 17:47:36 +0000 (UTC) (envelope-from pouria@FreeBSD.org) Received: by nl.mail.spmzt.net (OpenSMTPD) with ESMTPSA id c286bf49 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sat, 11 Jul 2026 22:17:28 +0430 (+0430) Message-ID: <8c6af42d-c7ca-424d-9c9a-cb318434f61e@FreeBSD.org> Date: Sat, 11 Jul 2026 21:16:33 +0330 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 User-Agent: Mozilla Thunderbird Subject: Re: git: c52bcd09c2a6 - main - nfsd: Garbage collect stray NFSv4 state To: rmacklem@FreeBSD.org References: <6a526688.386dd.2aa996fc@gitrepo.freebsd.org> <20260711192455.1fcbe221@thor.sb211.local> Content-Language: en-US, fa-IR Cc: A FreeBSD User , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" From: Pouria Mousavizadeh Tehrani In-Reply-To: <20260711192455.1fcbe221@thor.sb211.local> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------Quz0NktHsJnOTsvXkLjOz5NT" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------Quz0NktHsJnOTsvXkLjOz5NT Content-Type: multipart/mixed; boundary="------------TTsjPMUR2c154o91cufPipD6"; protected-headers="v1"; hp="clear" Message-ID: <8c6af42d-c7ca-424d-9c9a-cb318434f61e@FreeBSD.org> Date: Sat, 11 Jul 2026 21:16:33 +0330 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: c52bcd09c2a6 - main - nfsd: Garbage collect stray NFSv4 state To: rmacklem@FreeBSD.org References: <6a526688.386dd.2aa996fc@gitrepo.freebsd.org> <20260711192455.1fcbe221@thor.sb211.local> Content-Language: en-US, fa-IR Cc: A FreeBSD User , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" From: Pouria Mousavizadeh Tehrani In-Reply-To: <20260711192455.1fcbe221@thor.sb211.local> --------------TTsjPMUR2c154o91cufPipD6 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64 T24gNy8xMS8yNiAyMDo1OCwgQSBGcmVlQlNEIFVzZXIgd3JvdGU6DQo+IEFtIFRhZ2UgZGVz IEhlcnJlbiBTYXQsIDExIEp1bCAyMDI2IDE1OjUxOjM2ICswMDAwDQo+IFJpY2sgTWFja2xl bSA8cm1hY2tsZW1ARnJlZUJTRC5vcmc+IHNjaHJpZWI6DQo+IA0KPj4gVGhlIGJyYW5jaCBt YWluIGhhcyBiZWVuIHVwZGF0ZWQgYnkgcm1hY2tsZW06DQo+Pg0KPj4gVVJMOiBodHRwczov L2NnaXQuRnJlZUJTRC5vcmcvc3JjL2NvbW1pdC8/aWQ9YzUyYmNkMDljMmE2NzM2ZmU4NDFm ZDcyZTNjZmI3NGRlNWEzNWIwMw0KPj4NCj4+IGNvbW1pdCBjNTJiY2QwOWMyYTY3MzZmZTg0 MWZkNzJlM2NmYjc0ZGU1YTM1YjAzDQo+PiBBdXRob3I6ICAgICBSaWNrIE1hY2tsZW0gPHJt YWNrbGVtQEZyZWVCU0Qub3JnPg0KPj4gQXV0aG9yRGF0ZTogMjAyNi0wNy0xMSAxNTo0OTox MiArMDAwMA0KPj4gQ29tbWl0OiAgICAgUmljayBNYWNrbGVtIDxybWFja2xlbUBGcmVlQlNE Lm9yZz4NCj4+IENvbW1pdERhdGU6IDIwMjYtMDctMTEgMTU6NDk6MTIgKzAwMDANCj4+DQo+ PiAgICAgIG5mc2Q6IEdhcmJhZ2UgY29sbGVjdCBzdHJheSBORlN2NCBzdGF0ZQ0KPj4gICAg ICANCj4+ICAgICAgV2hlbiBhIGZpbGUgaXMgZGVsZXRlZCBvbiB0aGUgTkZTIHNlcnZlciBi eSBhbm90aGVyIGNsaWVudCwNCj4+ICAgICAgYW55IE5GU3Y0IHN0YXRlIHJlbGF0ZWQgdG8g dGhhdCBmaWxlIGlzIGxlZnQgc3RyYW5kZWQuDQo+PiAgICAgIFRoaXMgaGFwcGVucyBiZWNh dXNlIHRoZSBORlN2NCBvcGVyYXRpb25zIHRoYXQgZnJlZSB0aGUNCj4+ICAgICAgc3RhdGUg dXNlIGEgQ0ZILCB3aGljaCBpcyBzZXQgYnkgYSBQdXRGSCBvcGVyYXRpb24uDQo+PiAgICAg IEhvd2V2ZXIsIHRoZSBQdXRGSCBmYWlscyB3aXRoIEVTVEFMRSBiZWNhdXNlIHRoZSBmaWxl IGhhcw0KPj4gICAgICBiZWVuIGRlbGV0ZWQuDQo+PiAgICAgIA0KPj4gICAgICBUaGlzIHBh dGNoIGFkZHMgYSBmdW5jdGlvbiBjYWxsZWQgbmZzcnZfZnJlZXN0cmFuZGVkc3RhdGUoKQ0K Pj4gICAgICB0aGF0IGZyZWVzIGFsbCB0aGUgTkZTdjQgc3RhdGUgcmVsYXRlZCB0byBhIGZp bGUgYW5kIGNhbGxzDQo+PiAgICAgIHRoaXMgZnVuY3Rpb24gd2hlbiBQdXRGSCB3aWxsIGJl IHJlcGx5aW5nIEVTVEFMRS4NCj4+ICAgICAgDQo+PiAgICAgIFdoaWxlIGhlcmUsIGEgaGVs cGVyIGZ1bmN0aW9uIHdhcyBkZWZpbmVkIHRvIGhhbmRsZSBmcmVlJ25nDQo+PiAgICAgIG9m IHRoZSBuZnNsb2NrZmlsZSBzdHJ1Y3R1cmUgYW5kIHJlcGxhY2VzIHRoZSB0d28gcGxhY2Vz DQo+PiAgICAgIHdoZXJlIG5lYXJseSBpZGVudGljYWwgY29kZSBkb2VzIHRoaXMuDQo+PiAg ICAgIA0KPj4gICAgICBSZXBvcnRlZCBieTogICAgUmljaGFyZCBQdXJkaWUgPHJpY2hhcmQu cHVyZGllQGxpbnV4Zm91bmRhdGlvbi5vcmc+DQo+PiAgICAgIFRlc3RlZCBieTogICAgICBN aWNoYWVsIEhhbHN0ZWFkIDxtaGFsc3RlYWRAbGludXhmb3VuZGF0aW9uLm9yZz4NCj4+ICAg ICAgTUZDIGFmdGVyOiAgICAgIDIgd2Vla3MNCj4+IC0tLQ0KPj4gICBzeXMvZnMvbmZzc2Vy dmVyL25mc19uZnNkc3RhdGUuYyB8IDg5ICsrKysrKysrKysrKysrKysrKysrKysrKysrKysr KysrKy0tLS0tLS0NCj4+ICAgMSBmaWxlIGNoYW5nZWQsIDc1IGluc2VydGlvbnMoKyksIDE0 IGRlbGV0aW9ucygtKQ0KPj4NCj4+IGRpZmYgLS1naXQgYS9zeXMvZnMvbmZzc2VydmVyL25m c19uZnNkc3RhdGUuYyBiL3N5cy9mcy9uZnNzZXJ2ZXIvbmZzX25mc2RzdGF0ZS5jDQo+PiBp bmRleCAxMDJhZjliYjI5NTEuLmQ3OTBhYjk3NGQwNyAxMDA2NDQNCj4+IC0tLSBhL3N5cy9m cy9uZnNzZXJ2ZXIvbmZzX25mc2RzdGF0ZS5jDQo+PiArKysgYi9zeXMvZnMvbmZzc2VydmVy L25mc19uZnNkc3RhdGUuYw0KPj4gQEAgLTI1Myw2ICsyNTMsNyBAQCBzdGF0aWMgdm9pZCBu ZnNydl9pc3N1ZWRlbGVnYXRpb24oc3RydWN0IHZub2RlICp2cCwgc3RydWN0IG5mc2NsaWVu dA0KPj4gKmNscCwgbmZzdjRzdGF0ZWlkX3QgKmRlbGVnc3RhdGVpZHApOw0KPj4gICBzdGF0 aWMgdm9pZCBuZnNydl9jbGllbnRsb2NrKGJvb2wgbWxvY2tlZCk7DQo+PiAgIHN0YXRpYyB2 b2lkIG5mc3J2X2NsaWVudHVubG9jayhib29sIG1sb2NrZWQpOw0KPj4gK3N0YXRpYyB2b2lk IG5mc3J2X2ZyZWVsb2NraWZub3RpbnVzZShzdHJ1Y3QgbmZzbG9ja2ZpbGUgKmxmcCk7DQo+ PiAgIA0KPj4gICAvKg0KPj4gICAgKiBMb2NrIHRoZSBjbGllbnQgc3RydWN0dXJlLCBlaXRo ZXIgd2l0aCB0aGUgbXV0ZXggb3IgdGhlIGV4Y2x1c2l2ZSBuZnNkIGxvY2suDQo+PiBAQCAt MTUzNywyMCArMTUzOCwxMyBAQCBuZnNydl9mcmVlZGVsZWdsaXN0KHN0cnVjdCBuZnNzdGF0 ZWhlYWQgKnN0aHApDQo+PiAgIHN0YXRpYyB2b2lkDQo+PiAgIG5mc3J2X2ZyZWVkZWxlZyhz dHJ1Y3QgbmZzc3RhdGUgKnN0cCkNCj4+ICAgew0KPj4gLQlzdHJ1Y3QgbmZzbG9ja2ZpbGUg KmxmcDsNCj4+ICAgDQo+PiAgIAlMSVNUX1JFTU9WRShzdHAsIGxzX2hhc2gpOw0KPj4gICAJ TElTVF9SRU1PVkUoc3RwLCBsc19saXN0KTsNCj4+ICAgCUxJU1RfUkVNT1ZFKHN0cCwgbHNf ZmlsZSk7DQo+PiAgIAlpZiAoKHN0cC0+bHNfZmxhZ3MgJiBORlNMQ0tfREVMRUdXUklURSkg IT0gMCkNCj4+ICAgCQluZnNydl93cml0ZWRlbGVnY250LS07DQo+PiAtCWxmcCA9IHN0cC0+ bHNfbGZwOw0KPj4gLQlpZiAoTElTVF9FTVBUWSgmbGZwLT5sZl9vcGVuKSAmJg0KPj4gLQkg ICAgTElTVF9FTVBUWSgmbGZwLT5sZl9sb2NrKSAmJiBMSVNUX0VNUFRZKCZsZnAtPmxmX2Rl bGVnKSAmJg0KPj4gLQkgICAgTElTVF9FTVBUWSgmbGZwLT5sZl9sb2NhbGxvY2spICYmIExJ U1RfRU1QVFkoJmxmcC0+bGZfcm9sbGJhY2spICYmDQo+PiAtCSAgICBsZnAtPmxmX3VzZWNv dW50ID09IDAgJiYNCj4+IC0JICAgIG5mc3Y0X3Rlc3Rsb2NrKCZsZnAtPmxmX2xvY2FsbG9j a19sY2spID09IDApDQo+PiAtCQluZnNydl9mcmVlbmZzbG9ja2ZpbGUobGZwKTsNCj4+ICsJ bmZzcnZfZnJlZWxvY2tpZm5vdGludXNlKHN0cC0+bHNfbGZwKTsNCj4+ICAgCWZyZWUoc3Rw LCBNX05GU0RTVEFURSk7DQo+PiAgIAlWTkVUKG5mc3N0YXRzdjFfcCktPnNydmRlbGVnYXRl cy0tOw0KPj4gICAJbmZzcnZfb3BlbnBsdXNsb2NrLS07DQo+PiBAQCAtMTYzMiwxMiArMTYy Niw3IEBAIG5mc3J2X2ZyZWVvcGVuKHN0cnVjdCBuZnNzdGF0ZSAqc3RwLCB2bm9kZV90IHZw LCBpbnQgY2Fuc2xlZXAsDQo+PiBORlNQUk9DX1QgKnApDQo+PiAgIAkgKiBJZiB0aGVyZSBh cmUgbG9ja3MgYXNzb2NpYXRlZCB3aXRoIHRoZSBvcGVuLCB0aGUNCj4+ICAgCSAqIG5mc2xv Y2tmaWxlIHN0cnVjdHVyZSBjYW4gYmUgZnJlZWQgdmlhIG5mc3J2X2ZyZWVsb2Nrb3duZXIo KS4NCj4+ICAgCSAqLw0KPj4gLQlpZiAobGZwICE9IE5VTEwgJiYgTElTVF9FTVBUWSgmbGZw LT5sZl9vcGVuKSAmJg0KPj4gLQkgICAgTElTVF9FTVBUWSgmbGZwLT5sZl9kZWxlZykgJiYg TElTVF9FTVBUWSgmbGZwLT5sZl9sb2NrKSAmJg0KPj4gLQkgICAgTElTVF9FTVBUWSgmbGZw LT5sZl9sb2NhbGxvY2spICYmIExJU1RfRU1QVFkoJmxmcC0+bGZfcm9sbGJhY2spICYmDQo+ PiAtCSAgICBsZnAtPmxmX3VzZWNvdW50ID09IDAgJiYNCj4+IC0JICAgIG5mc3Y0X3Rlc3Rs b2NrKCZsZnAtPmxmX2xvY2FsbG9ja19sY2spID09IDApDQo+PiAtCQluZnNydl9mcmVlbmZz bG9ja2ZpbGUobGZwKTsNCj4+ICsJbmZzcnZfZnJlZWxvY2tpZm5vdGludXNlKGxmcCk7DQo+ PiAgIAlmcmVlKHN0cCwgTV9ORlNEU1RBVEUpOw0KPj4gICAJVk5FVChuZnNzdGF0c3YxX3Ap LT5zcnZvcGVucy0tOw0KPj4gICAJbmZzcnZfb3BlbnBsdXNsb2NrLS07DQo+PiBAQCAtODg4 MSwzICs4ODcwLDc1IEBAIG5mc3J2X3JlbW92ZWRlbGVnKGZoYW5kbGVfdCAqZmhwLCBzdHJ1 Y3QgbmZzcnZfZGVzY3JpcHQgKm5kLA0KPj4gTkZTUFJPQ19UICpwKSB9DQo+PiAgIAlORlNV TkxPQ0tTVEFURSgpOw0KPj4gICB9DQo+PiArDQo+PiArLyoNCj4+ICsgKiBGcmVlIHRoZSBu ZnNsb2NrZmlsZSBzdHJ1Y3R1cmUgaWYgbm90IGluIHVzZS4NCj4+ICsgKi8NCj4+ICtzdGF0 aWMgdm9pZA0KPj4gK25mc3J2X2ZyZWVsb2NraWZub3RpbnVzZShzdHJ1Y3QgbmZzbG9ja2Zp bGUgKmxmcCkNCj4+ICt7DQo+PiArDQo+PiArCS8qDQo+PiArCSAqIFRoZSBuZnNsb2NrZmls ZSBpcyBmcmVlZCBoZXJlIGlmIHRoZXJlIGFyZSBubyBsb2Nrcw0KPj4gKwkgKiBhc3NvY2lh dGVkIHdpdGggdGhlIG9wZW4uDQo+PiArCSAqIElmIHRoZXJlIGFyZSBsb2NrcyBhc3NvY2lh dGVkIHdpdGggdGhlIG9wZW4sIHRoZQ0KPj4gKwkgKiBuZnNsb2NrZmlsZSBzdHJ1Y3R1cmUg Y2FuIGJlIGZyZWVkIHZpYSBuZnNydl9mcmVlbG9ja293bmVyKCkuDQo+PiArCSAqLw0KPj4g KwlpZiAobGZwICE9IE5VTEwgJiYgTElTVF9FTVBUWSgmbGZwLT5sZl9vcGVuKSAmJg0KPj4g KwkgICAgTElTVF9FTVBUWSgmbGZwLT5sZl9kZWxlZykgJiYgTElTVF9FTVBUWSgmbGZwLT5s Zl9sb2NrKSAmJg0KPj4gKwkgICAgTElTVF9FTVBUWSgmbGZwLT5sZl9sb2NhbGxvY2spICYm IExJU1RfRU1QVFkoJmxmcC0+bGZfcm9sbGJhY2spICYmDQo+PiArCSAgICBsZnAtPmxmX3Vz ZWNvdW50ID09IDAgJiYNCj4+ICsJICAgIG5mc3Y0X3Rlc3Rsb2NrKCZsZnAtPmxmX2xvY2Fs bG9ja19sY2spID09IDApDQo+PiArCQluZnNydl9mcmVlbmZzbG9ja2ZpbGUobGZwKTsNCj4+ ICt9DQo+PiArDQo+PiArLyoNCj4+ICsgKiBGcmVlIHN0cmFuZGVkIG9wZW4vbG9jay9kZWxl Z2F0aW9uL2xheW91dHMuDQo+PiArICogKFRoZXNlIGJlY29tZSBzdHJhbmRlZCBpZiB0aGUg ZmlsZSBoYXMgYmVlbiBkZWxldGVkLikNCj4+ICsgKi8NCj4+ICt2b2lkDQo+PiArbmZzcnZf ZnJlZXN0cmFuZGVkc3RhdGUoc3RydWN0IG5mc3J2ZmggKm5mcCkNCj4+ICt7DQo+PiArCXN0 cnVjdCBuZnNsb2NrZmlsZSAqbGZwOw0KPj4gKwlzdHJ1Y3QgbmZzc3RhdGUgKnN0cCwgKm5z dHA7DQo+PiArCXN0cnVjdCBuZnNsYXlvdXRoYXNoICpsaHlwOw0KPj4gKwlzdHJ1Y3QgbmZz bGF5b3V0ICpseXAsICpubHlwOw0KPj4gKwlmaGFuZGxlX3QgKmZocDsNCj4+ICsNCj4+ICsJ aWYgKG5mcC0+bmZzcnZmaF9sZW4gIT0gTkZTWF9NWUZIKQ0KPj4gKwkJcmV0dXJuOw0KPj4g KwlmaHAgPSAoZmhhbmRsZV90ICopbmZwLT5uZnNydmZoX2RhdGE7DQo+PiArCU5GU0xPQ0tT VEFURSgpOw0KPj4gKwlpZiAobmZzcnZfZ2V0bG9ja2ZpbGUoMCwgTlVMTCwgJmxmcCwgZmhw LCAwKSA8IDApIHsNCj4+ICsJCU5GU1VOTE9DS1NUQVRFKCk7DQo+PiArCQlyZXR1cm47DQo+ PiArCX0NCj4+ICsJbGZwLT5sZl91c2Vjb3VudCsrOwkvKiBTbyBuZnNydl9mcmVlb3Blbigp IGRvZXMgbm90IGZyZWUgaXQuICovDQo+PiArCS8qIE5vdGUgdGhhdCBuZnNydl9mcmVlb3Bl bigpIHdpbGwgYWxzbyBmcmVlIHRoZSBieXRlIHJhbmdlIGxvY2tzLiAqLw0KPj4gKwlMSVNU X0ZPUkVBQ0hfU0FGRShzdHAsICZsZnAtPmxmX29wZW4sIGxzX2ZpbGUsIG5zdHApDQo+PiAr CQluZnNydl9mcmVlb3BlbihzdHAsIE5VTEwsIDAsIGN1cnRocmVhZCk7DQo+PiArDQo+PiAr CS8qDQo+PiArCSAqIE5vcm1hbGx5LCBhIGRlbGVnYXRpb24gd2lsbCBoYXZlIGJlZW4gcmVj YWxsZWQgd2hlbiB0aGUgZmlsZSBpcw0KPj4gKwkgKiByZW1vdmVkLiAgSG93ZXZlciwgZ2V0 IHJpZCBvZiBhbnkgdGhhdCBoYXZlIHNvbWVob3cgYmVlbg0KPj4gKwkgKiBsZWZ0IHN0cmFu ZGVkLg0KPj4gKwkgKi8NCj4+ICsJTElTVF9GT1JFQUNIX1NBRkUoc3RwLCAmbGZwLT5sZl9k ZWxlZywgbHNfZmlsZSwgbnN0cCkNCj4+ICsJCW5mc3J2X2ZyZWVkZWxlZyhzdHApOw0KPj4g Kw0KPj4gKwkvKiBHZXQgcmlkIG9mIHRoZSBuZnNsb2NrZmlsZSwgaWYgbm8gbG9uZ2VyIGlu IHVzZS4gKi8NCj4+ICsJbGZwLT5sZl91c2Vjb3VudC0tOw0KPj4gKwluZnNydl9mcmVlbG9j a2lmbm90aW51c2UobGZwKTsNCj4+ICsJTkZTVU5MT0NLU1RBVEUoKTsNCj4+ICsNCj4+ICsJ LyogRnJlZSBhbnkgbGF5b3V0cyBmb3IgdGhlIHBORlMgc2VydmVyIGNhc2UuICovDQo+PiAr CWlmIChuZnNydl9kZXZpZGNudCA9PSAwKQ0KPj4gKwkJcmV0dXJuOw0KPj4gKwlsaHlwID0g TkZTTEFZT1VUSEFTSChmaHApOw0KPj4gKwlORlNMT0NLTEFZT1VUKGxoeXApOw0KPj4gKwlU QUlMUV9GT1JFQUNIX1NBRkUobHlwLCAmbGh5cC0+bGlzdCwgbGF5X2xpc3QsIG5seXApIHsN Cj4+ICsJCWlmIChORlNCQ01QKCZseXAtPmxheV9maCwgZmhwLCBzaXplb2YoKmZocCkpID09 IDApDQo+PiArCQkJbmZzcnZfZnJlZWxheW91dCgmbGh5cC0+bGlzdCwgbHlwKTsNCj4+ICsJ fQ0KPj4gKwlORlNVTkxPQ0tMQVlPVVQobGh5cCk7DQo+PiArfQ0KPj4NCj4gDQo+IEl0IHNl ZW1zIHRoaXMgY29tbWl0IGJyZWFrcyBidWlsZGtlcm5lbCBmb3IgbWU6DQo+IFsuLi5dDQo+ IC91c3Ivc3JjL3N5cy9mcy9uZnNzZXJ2ZXIvbmZzX25mc2RzdGF0ZS5jOjg5MDA6MTogZXJy b3I6IG5vIHByZXZpb3VzIHByb3RvdHlwZSBmb3IgZnVuY3Rpb24NCj4gJ25mc3J2X2ZyZWVz dHJhbmRlZHN0YXRlJyBbLVdlcnJvciwtV21pc3NpbmctcHJvdG90eXBlc10gODkwMCB8IG5m c3J2X2ZyZWVzdHJhbmRlZHN0YXRlKHN0cnVjdA0KPiBuZnNydmZoICpuZnANCg0KKzENClNh bWUgaGVyZQ0KDQo+IA0KPiBLaW5kIHJlZ2FyZHMsDQo+IA0KPiBvaA0KDQotLSANClBvdXJp YQ0KDQo= --------------TTsjPMUR2c154o91cufPipD6-- --------------Quz0NktHsJnOTsvXkLjOz5NT Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature.asc" -----BEGIN PGP SIGNATURE----- iJEEARYKADkWIQSqt7cppfvJ816gj0lUwVnUeMwagAUCalKBeRsUgAAAAAAEAA5t YW51MiwyLjUrMS4xMiwyLDMACgkQVMFZ1HjMGoDdnwEA7K6dufNrSbzwLL5LvGSj Bozn0IYfcZMTngYnFbWXKxsA/1yKEJY0SCIlvEtj99iEn5nTggFajquIZe3AP74q 9BkL =VzBD -----END PGP SIGNATURE----- --------------Quz0NktHsJnOTsvXkLjOz5NT-- From nobody Sat Jul 11 18:10:39 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 4gyGw46MY9z6lRCY; Sat, 11 Jul 2026 18:10:44 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyGw43x75z3R7y; Sat, 11 Jul 2026 18:10:44 +0000 (UTC) (envelope-from bz@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783793444; 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: in-reply-to:in-reply-to:references:references; bh=P6q36Ubya4f0a/dFSfOrnXiBhDl26PdX3CuHhEka0wk=; b=hpiEpYFNq3MJy339tCoS/pBKfm1JUfD7H1xW0k9FMp4pSXat4OkWidJXkHW/afwdPrIRHK /yPHStIfILZnDy6qEHNnMaqoHQo1+lUQUcTYXg/NjNjeTpIZqoVMRoe2xm6PraRg2lnjSg VCzeKYMUjVC+d5KOduhU+uLCUYgE0/LXoemxAgtwavGI66BQ6TvOS3UeW9OCsRkl9KWbz+ y0fC3dFNpbaYBFnA5+aJGXdsNacwaBDJ0FNpL4qp3fFxvNvNAxOiYXqnWeTD1vtDic8+aU dD47bR4k6TYLRbt6xSS6F4PDghwBZ9HeO9e+qgY5E0swUW2e77CMz8m/o1ksHA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783793444; a=rsa-sha256; cv=none; b=U0e0TujUQ//C9Bi0IW5FqztZRokVoCzj7pEpBLlzZbtf1nM5nak2ST572rBWUbDNhF6H/o LwEvxsrUyohXr+m2/9D4lSMJeGVauZmi8F1BCBvD8w67F1CAxZ76MYGV0FyfEke01N8tTU hI0XHtiqCmwUuyMspnKQhDAUNqrG9FHvtplU9cg34QSuEkBhveEZUWNi8M5ROIYlanoD7K rLhWj7cy5lzZQWry4l9mrbinPufuqESW8qDzC6Vd6t0WTkm32Q1Lr5bU+71STxX9mPczSA AxHNtSW+8whG88XYP1L37JN63XLN3fc7hlWYKfFSzY/zqiDqgkeNz+FU0hW5hQ== 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=1783793444; 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: in-reply-to:in-reply-to:references:references; bh=P6q36Ubya4f0a/dFSfOrnXiBhDl26PdX3CuHhEka0wk=; b=UTaZVuu9qJBh7b+tHpu5vqaeGxe13Kucj2dpBtAKkzG5hq0+qVO1SppMe1K+JEZjKLKU17 IPA7xQ7QpXBQe9XxROBCjb0Uz2x3vPZyz0UCXgRwmR+Tpgva9YqnCDsoGT/iZO5PoODqGE isIDYeJ9XnqvzKRUruBP9meDUWppBVljGXgIy/XdoltZnQdszrpM/mPTV/M4lpoZZpKa0d Ikw4TudeIoefwbOsKOVbppeNZPY/x4U9qA8cQd0NweI9d9iLgMXTEZSOlUf/zz4nVG2e3Q aRo0mwKfcRujC+3otlgI8WWxOS28E1ApBelK4g2JOBhB0M9ifH6BVl1OTVOl2w== Received: from mx-01.divo.sbone.de (mx-01.divo.sbone.de [IPv6:2003:a:140a:2200:6:594:fffe:19]) (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 ECDSA (prime256v1) client-digest SHA256) (Client CN "mx-01.divo.sbone.de", Issuer "YE2" (not verified)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gyGw41fyrzNs1; Sat, 11 Jul 2026 18:10:44 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by mx-01.divo.sbone.de (Postfix) with ESMTPS id B2167A64805; Sat, 11 Jul 2026 18:10:11 +0000 (UTC) Received: from content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (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 mail.sbone.de (Postfix) with ESMTPS id 6F7172D029E9; Sat, 11 Jul 2026 18:10:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) by content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (amavisd-new, port 10024) with ESMTP id 9IMZBfqXfIVY; Sat, 11 Jul 2026 18:10:39 +0000 (UTC) Received: from nv.t4-02.sbone.de (nv.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:22]) (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 mail.sbone.de (Postfix) with ESMTPSA id 555B72D029D8; Sat, 11 Jul 2026 18:10:39 +0000 (UTC) Date: Sat, 11 Jul 2026 18:10:39 +0000 (UTC) From: "Bjoern A. Zeeb" To: John Baldwin cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: bc49842769bd - main - acpi_einj: Support for ACPI error injection In-Reply-To: <6a4d50fa.3e3af.79b8bd3e@gitrepo.freebsd.org> Message-ID: <95o992o6-sr26-pnnq-1pn-n4r554q0o510@mnoonqbm.arg> References: <6a4d50fa.3e3af.79b8bd3e@gitrepo.freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 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=US-ASCII; format=flowed On Tue, 7 Jul 2026, John Baldwin wrote: > The branch main has been updated by jhb: > > URL: https://cgit.FreeBSD.org/src/commit/?id=bc49842769bd3657a5a1e7de878c0ce8780a2f86 > > commit bc49842769bd3657a5a1e7de878c0ce8780a2f86 > Author: John Baldwin > AuthorDate: 2026-07-07 18:15:27 +0000 > Commit: John Baldwin > CommitDate: 2026-07-07 18:15:27 +0000 > > acpi_einj: Support for ACPI error injection > > This driver parses the ACPI EINJ table and builds a list of > instructions associated with known actions. It then exports ioctls to > fetch the set of supported errors and inject system errors by > executing specific sequences of actions. This can be used to test > error reporting facilities for events such as ECC errors. > > Reviewed by: gallatin > Sponsored by: Netflix > Differential Revision: https://reviews.freebsd.org/D58025 > --- > share/man/man4/Makefile | 1 + > share/man/man4/acpi_einj.4 | 58 +++ > sys/dev/acpica/acpi_einj.c | 777 ++++++++++++++++++++++++++++++++++++ This broke _.arm64.LINT-FDT: 23 In file included from /sys/dev/acpica/acpi_einj.c:23: 24 /sys/dev/acpica/acpivar.h:34:10: fatal error: 'acpi_if.h' file not found 25 34 | #include "acpi_if.h" 26 | ^~~~~~~~~~~ 27 1 error generated. > sys/dev/acpica/acpiio.h | 39 ++ > sys/modules/acpi/Makefile | 1 + > sys/modules/acpi/acpi_einj/Makefile | 7 + > 6 files changed, 883 insertions(+) -- Bjoern A. Zeeb r15:7 From nobody Sat Jul 11 19:26:22 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 4gyJbM0wKHz6lWSs for ; Sat, 11 Jul 2026 19:26:23 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyJbL66JHz3Y6X for ; Sat, 11 Jul 2026 19:26:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783797982; 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=slvBS5HbU1RqsBja0y4If8PvL1aIRKSQ6uIBhvqWN+U=; b=BAFumViUHPahpwWBfDn4x1i6HsH0Blx6CXS74TxLb//fD6KrxTg2BYUd67uaO4KxydMHAC 2woPwzsR77h3Zaarx+ZsuBYPMEqhas0jwfVC1RMmlIob2naZcM3IPylw6GUbu2icmz8PXh qN3PE0RGuQch3suSR0BFuzhG63SGkXIYOPuNO5v0JlNEQMftIwgDCZKUA4dx7XYK8AE6GS OZovmyQS3w6W6OJuaG/Phz5vuJZ608vXOYtfQi5KwVt5Amf/T3fZ5fWiofOvhNLzLxOvld UceKxtLDTuN22o3lUi+Tc79oE8DEOuk+j8eBLFR9F/nSeYxzvDxsMNkLEljc2g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783797982; a=rsa-sha256; cv=none; b=ud2A1TseQdEXs8GZTrfnWjJpeshYxtf0W3c0oFyAyef5oE1aE9r85XvDofXMnbGxV+8Nwx gnhgAgQnJYnMmIG1TTgZdlYraFBjoiCWuJSAG/NEfvSXdXMyRFXFBD3K7OqNhGmlMIhyXH KAgYlOVOH0hIiUaQxZ4T8GYAMfO9ksrqwelhDQM6Zqu6Ve6DRwmvOjdckJwq8AZEcUPqVe AYkUKSVFa6fcyJatf4SN9LBMv6XewECGwivBQRBzRLQltAOE+k75O1nqsbytEtXqqiwHGL 8kNfOgtc+kuOR9cBs8TyBs+h+Eq+p/4F4XHwvqWft0vp+HQWvmv5F/nbu0NL8Q== 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=1783797982; 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=slvBS5HbU1RqsBja0y4If8PvL1aIRKSQ6uIBhvqWN+U=; b=J3kU8EZ1STErt3LBR7Z5QelKiEGVUDbdx69Ncm8DugfuGsocQorvuvmF6ghhrg5XCeth6U JLdoBmhUQx1u1/FPy3HfD4iHdI9nDHtciBC9rgfWjH+AsHkEebmb7mc5aIWaMJOfRP/sic 7VWtFE2H6dMFMkPJt9hG/WAF2UKQFDT9H9s1fG6+XlybjRCHhgyKma3XRp+yja14+EUSFl UNElsn5ne2cZjHWxO+lqDhA2LPqVTbv+jULjcMFYy8668jBOcQKlnA/QvwSaimeKgQl46X k/j5obF+IjFN48NwLxxQ1tUgEpqSbZONDl4g0oWcvcaJ5TREtS+Uetpg8M4a/Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyJbL4ttszt9l for ; Sat, 11 Jul 2026 19:26:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 25070 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 11 Jul 2026 19:26:22 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Pouria Mousavizadeh Tehrani Subject: git: d05d1f256082 - main - routing: Subscribe nhops to ifnet link events 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: pouria X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d05d1f25608230edd300d59b96da6521b409d4f3 Auto-Submitted: auto-generated Date: Sat, 11 Jul 2026 19:26:22 +0000 Message-Id: <6a5298de.25070.b0bcc3b@gitrepo.freebsd.org> The branch main has been updated by pouria: URL: https://cgit.FreeBSD.org/src/commit/?id=d05d1f25608230edd300d59b96da6521b409d4f3 commit d05d1f25608230edd300d59b96da6521b409d4f3 Author: Pouria Mousavizadeh Tehrani AuthorDate: 2026-07-08 19:55:46 +0000 Commit: Pouria Mousavizadeh Tehrani CommitDate: 2026-07-11 18:23:05 +0000 routing: Subscribe nhops to ifnet link events Update nexthop flags with interface link status events and instead of checking link status of interface for every packet only check the reachability flag of the final nexthop. Reviewed by: glebius Discussed with: markj Differential Revision: https://reviews.freebsd.org/D57375 --- sys/net/route.h | 4 +-- sys/net/route/nhop.h | 8 +----- sys/net/route/nhop_ctl.c | 68 +++++++++++++++++++++++++++++++++++++++++++++-- sys/net/route/route_ctl.h | 1 + sys/netinet/in_fib.c | 6 ++--- sys/netinet6/in6_fib.c | 6 ++--- 6 files changed, 75 insertions(+), 18 deletions(-) diff --git a/sys/net/route.h b/sys/net/route.h index d8cc12a39c61..b4440de19d96 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -205,6 +205,7 @@ EVENTHANDLER_DECLARE(rtnumfibs_change, rtnumfibs_change_t); #define NHF_BROADCAST 0x0100 /* RTF_BROADCAST */ #define NHF_GATEWAY 0x0200 /* RTF_GATEWAY */ #define NHF_HOST 0x0400 /* RTF_HOST */ +#define NHF_INVALID 0x0800 /* Nexthop is unreachable */ /* Nexthop request flags */ #define NHR_NONE 0x00 /* empty flags field */ @@ -368,9 +369,6 @@ struct rt_addrinfo { #ifdef _KERNEL -#define RT_LINK_IS_UP(ifp) (!((ifp)->if_capabilities & IFCAP_LINKSTATE) \ - || (ifp)->if_link_state == LINK_STATE_UP) - #define RO_NHFREE(_ro) do { \ if ((_ro)->ro_nh) { \ NH_FREE((_ro)->ro_nh); \ diff --git a/sys/net/route/nhop.h b/sys/net/route/nhop.h index 6c62ae2f2f5f..0ae41cbf8292 100644 --- a/sys/net/route/nhop.h +++ b/sys/net/route/nhop.h @@ -145,14 +145,8 @@ struct nhop_object { /* * Nhop validness. - * - * Currently we verify whether link is up or not on every packet, which can be - * quite costy. - * TODO: subscribe for the interface notifications and update the nexthops - * with NHF_INVALID flag. */ - -#define NH_IS_VALID(_nh) RT_LINK_IS_UP((_nh)->nh_ifp) +#define NH_IS_VALID(_nh) (!((_nh)->nh_flags & NHF_INVALID)) #define NH_IS_NHGRP(_nh) ((_nh)->nh_flags & NHF_MULTIPATH) #define NH_FREE(_nh) do { \ diff --git a/sys/net/route/nhop_ctl.c b/sys/net/route/nhop_ctl.c index 9ef5bbc74a92..4f013908b338 100644 --- a/sys/net/route/nhop_ctl.c +++ b/sys/net/route/nhop_ctl.c @@ -90,6 +90,8 @@ static void fill_sdl_from_ifp(struct sockaddr_dl_short *sdl, const struct ifnet static void destroy_nhop_epoch(epoch_context_t ctx); static void destroy_nhop(struct nhop_object *nh); +static void nhops_ifnet_event(void *arg, struct ifnet *ifp, int state); +static void nhops_ifnet_link_event(void *arg, struct ifnet *ifp, int state); _Static_assert(__offsetof(struct nhop_object, nh_ifp) == 32, "nhop_object: wrong nh_ifp offset"); @@ -109,6 +111,10 @@ nhops_init(void) nhops_zone = uma_zcreate("routing nhops", NHOP_OBJECT_ALIGNED_SIZE + NHOP_PRIV_ALIGNED_SIZE, NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); + EVENTHANDLER_REGISTER(ifnet_event, nhops_ifnet_event, NULL, + EVENTHANDLER_PRI_ANY); + EVENTHANDLER_REGISTER(ifnet_link_event, nhops_ifnet_link_event, NULL, + EVENTHANDLER_PRI_ANY); } /* @@ -1109,7 +1115,10 @@ nhops_iter_start(struct nhop_iter *iter) if (iter->rh != NULL) { struct nh_control *ctl = iter->rh->nh_control; - NHOPS_RLOCK(ctl); + if (iter->wlock) + NHOPS_WLOCK(ctl); + else + NHOPS_RLOCK(ctl); iter->_i = 0; iter->_next = CHT_FIRST(&ctl->nh_head, iter->_i); @@ -1147,7 +1156,10 @@ nhops_iter_stop(struct nhop_iter *iter) if (iter->rh != NULL) { struct nh_control *ctl = iter->rh->nh_control; - NHOPS_RUNLOCK(ctl); + if (iter->wlock) + NHOPS_WUNLOCK(ctl); + else + NHOPS_RUNLOCK(ctl); } } @@ -1317,3 +1329,55 @@ nhops_dump_sysctl(struct rib_head *rh, struct sysctl_req *w) return (0); } + +static void +nhops_ifnet_state_changed(struct ifnet *ifp, bool status) +{ + struct nhop_object *nh; + struct nhop_iter iter = { .fibnum = ifp->if_fib, .wlock = true }; + + for (iter.family = 1; iter.family <= AF_MAX; iter.family++) { + iter.rh = rt_tables_get_rnh_safe(iter.fibnum, iter.family); + for (nh = nhops_iter_start(&iter); nh != NULL; + nh = nhops_iter_next(&iter)) { + if (nh->nh_ifp != ifp) + continue; + + if (status) + nh->nh_flags &= ~NHF_INVALID; + else + nh->nh_flags |= NHF_INVALID; + } + nhops_iter_stop(&iter); + } +} + +static void +nhops_ifnet_event(void *arg __unused, struct ifnet *ifp, int state) +{ + + if ((ifp->if_flags & IFF_DYING) != 0 || + (state != IFNET_EVENT_UP && state != IFNET_EVENT_DOWN)) + return; + + nhops_ifnet_state_changed(ifp, state == IFNET_EVENT_UP); +} + +static void +nhops_ifnet_link_event(void *arg __unused, struct ifnet *ifp, int state) +{ +#ifdef VIMAGE + /* + * rib_head will be calculated from V_tables in rt_tables_get_rnh + * and the VNET is destroyed. + */ + if (VNET_IS_SHUTTING_DOWN(ifp->if_vnet)) + return; +#endif + + if ((ifp->if_flags & IFF_DYING) != 0 || + (state != LINK_STATE_UP && state != LINK_STATE_DOWN)) + return; + + nhops_ifnet_state_changed(ifp, state == LINK_STATE_UP); +} diff --git a/sys/net/route/route_ctl.h b/sys/net/route/route_ctl.h index 845df8ce1fbe..2e34b2a35c25 100644 --- a/sys/net/route/route_ctl.h +++ b/sys/net/route/route_ctl.h @@ -164,6 +164,7 @@ struct nhop_iter { struct rib_head *rh; int _i; struct nhop_priv *_next; + const bool wlock; }; struct nhop_object *nhops_iter_start(struct nhop_iter *iter); diff --git a/sys/netinet/in_fib.c b/sys/netinet/in_fib.c index d8e373bf3dc2..d864bce07315 100644 --- a/sys/netinet/in_fib.c +++ b/sys/netinet/in_fib.c @@ -117,7 +117,7 @@ fib4_lookup(uint32_t fibnum, struct in_addr dst, uint32_t scopeid, if (nh != NULL) { nh = nhop_select(nh, flowid); /* Ensure route & ifp is UP */ - if (RT_LINK_IS_UP(nh->nh_ifp)) { + if (NH_IS_VALID(nh)) { if (flags & NHR_REF) nhop_ref_object(nh); return (nh); @@ -154,7 +154,7 @@ fib4_lookup(uint32_t fibnum, struct in_addr dst, uint32_t scopeid, if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) { nh = nhop_select((RNTORT(rn))->rt_nhop, flowid); /* Ensure route & ifp is UP */ - if (RT_LINK_IS_UP(nh->nh_ifp)) { + if (NH_IS_VALID(nh)) { if (flags & NHR_REF) nhop_ref_object(nh); RIB_RUNLOCK(rh); @@ -320,7 +320,7 @@ fib4_lookup_debugnet(uint32_t fibnum, struct in_addr dst, uint32_t scopeid, if (rt != NULL) { struct nhop_object *nh = nhop_select(rnd.rnd_nhop, 0); /* Ensure route & ifp is UP */ - if (RT_LINK_IS_UP(nh->nh_ifp)) + if (NH_IS_VALID(nh)) return (nh); } diff --git a/sys/netinet6/in6_fib.c b/sys/netinet6/in6_fib.c index c851a5bd14c5..594a9dc0a24e 100644 --- a/sys/netinet6/in6_fib.c +++ b/sys/netinet6/in6_fib.c @@ -125,7 +125,7 @@ fib6_lookup(uint32_t fibnum, const struct in6_addr *dst6, if (nh != NULL) { nh = nhop_select(nh, flowid); /* Ensure route & ifp is UP */ - if (RT_LINK_IS_UP(nh->nh_ifp)) { + if (NH_IS_VALID(nh)) { if (flags & NHR_REF) nhop_ref_object(nh); return (nh); @@ -163,7 +163,7 @@ fib6_lookup(uint32_t fibnum, const struct in6_addr *dst6, if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) { nh = nhop_select((RNTORT(rn))->rt_nhop, flowid); /* Ensure route & ifp is UP */ - if (RT_LINK_IS_UP(nh->nh_ifp)) { + if (NH_IS_VALID(nh)) { if (flags & NHR_REF) nhop_ref_object(nh); RIB_RUNLOCK(rh); @@ -335,7 +335,7 @@ fib6_lookup_debugnet(uint32_t fibnum, const struct in6_addr *dst6, if (rt != NULL) { struct nhop_object *nh = nhop_select(rnd.rnd_nhop, 0); /* Ensure route & ifp is UP */ - if (RT_LINK_IS_UP(nh->nh_ifp)) + if (NH_IS_VALID(nh)) return (nh); } From nobody Sat Jul 11 19:26:23 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 4gyJbN1MXMz6lWj9 for ; Sat, 11 Jul 2026 19:26:24 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyJbM6f73z3YWW for ; Sat, 11 Jul 2026 19:26:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783797984; 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=bx8Y2Us19+maSnxQUsbXS1dqz2X0WcOF7t7Nsx8ZAHQ=; b=CoLx/JDcnLVVppodQG7QN0iKEizOzPI+sbVaCYW0gf4x6WQjusNy0kh8Sf2d5x7m/xyVbk NuJMJOWIpTrH3q8MGAZL+TF6h3V1U5LAwwykMk6M+0rZEkiUwUu8A9a6KurEOGtf0Lpmbs iya+n8SciB3Gqvy/G08uARiIuiFBH8XJzIyekvQOpkbg7+3gXVsH/JPB7b7fOZPVCLMu3k UlB+pnfynOk8exuPvaJJ7gAMbE68+b66FNShknwFOIHdmEvWuyFKxHNPcOq7tDIGmfhTl8 domtdphWvBTqrXDqXsQc6qgShenpd8yWrct1oP73cUW7p9Vi3+ErtM+mjjHsXA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783797984; a=rsa-sha256; cv=none; b=CIO7Qexz/9OotZraEs4GXdR8KJaYNePLsqeHCrk039g/7mWLE/eHh5PtLFG8oMDmJvBAEU lfOR8awOGtGE0lrC39pFgb0YRPpyz4TAb4ZN6GwgWQZ0VgEsPYlaTFNoyuBhXstMP9CGaP aZ5pEnhAuKAWCIkUDVjcBDyJjpUQ4l2wfND19v5pXGtKrwA77DW3QKiIZ+f4Xo73IBYKUQ 78PNZxy0C5XPPr4r/eJ2EiwGUBTrWMHxxHztwmqtX8gb+IH7pZAF8kEf15wr25lE3kNb/p AqNkhibiha4nxGSZ74vvqo9DR2neUFT1E5JOM+bTdDqajqNsB7A8xjOudczstA== 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=1783797984; 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=bx8Y2Us19+maSnxQUsbXS1dqz2X0WcOF7t7Nsx8ZAHQ=; b=IKKnBVwdigEtiNmFXLipxmeCLwTEJVQZ89Wv/YQkI7AQQ822J25njwqnTMCNhnYpvWMyPS heyTCD0Vu/tbw73pSE6CPFpH5hOQZHyTiV2pezTCOF6XXllYUUzR1oJtIxvFg7kZsh7Ekl UjihVg4p2YTWa3T+4Lsj3ulaHCpl+WS4+e8Z7araiu1wI5DxZQbgyYS5L/ofssS5Ulw3Z/ 7DysqI/xmN6ZB9c3odJRhyqFddA8vZ0n00l05QmK16qYZL9y4YforKHOC5ZTvz4NCilTH7 V409y8DRmx+MzaTz/GcoRvMd5PwL3k7jZHGvoJ1Ua324t7yDBwW6PEebUNWhsg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyJbM5257zt9n for ; Sat, 11 Jul 2026 19:26:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27283 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 11 Jul 2026 19:26:23 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Pouria Mousavizadeh Tehrani Subject: git: be42ac4dceac - main - routing: Replace unreachable nhops in nhgrp 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: pouria X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: be42ac4dceacedb0e4f676a0614e14d125fab36b Auto-Submitted: auto-generated Date: Sat, 11 Jul 2026 19:26:23 +0000 Message-Id: <6a5298df.27283.68bf5741@gitrepo.freebsd.org> The branch main has been updated by pouria: URL: https://cgit.FreeBSD.org/src/commit/?id=be42ac4dceacedb0e4f676a0614e14d125fab36b commit be42ac4dceacedb0e4f676a0614e14d125fab36b Author: Pouria Mousavizadeh Tehrani AuthorDate: 2026-06-01 20:07:27 +0000 Commit: Pouria Mousavizadeh Tehrani CommitDate: 2026-07-11 18:23:07 +0000 routing: Replace unreachable nhops in nhgrp If a nhop gets an interface event, revalidate the nhops and immediately try to recompile existing nexthop groups by replacing unreachable nexthops with reachable ones. If none are available, recompile them back to their normal position in nexthop group slots. Reviewed by: glebius Discussed with: markj Relnotes: yes Differential Revision: https://reviews.freebsd.org/D57389 --- sys/net/route/nhgrp_ctl.c | 66 ++++++++++++++++++++++++++++++++++++++++++----- sys/net/route/nhop_ctl.c | 15 +++++++++-- sys/net/route/route_var.h | 1 + 3 files changed, 74 insertions(+), 8 deletions(-) diff --git a/sys/net/route/nhgrp_ctl.c b/sys/net/route/nhgrp_ctl.c index d684cd698284..ea1d3b089d9e 100644 --- a/sys/net/route/nhgrp_ctl.c +++ b/sys/net/route/nhgrp_ctl.c @@ -251,14 +251,29 @@ compile_nhgrp(struct nhgrp_priv *dst_priv, const struct weightened_nhop *x, struct nhgrp_object *dst; int i, slot_idx, remaining_slots; uint64_t remaining_sum, nh_weight, nh_slots; + bool one_reachable = true; slot_idx = 0; dst = dst_priv->nhg; /* Calculate sum of all weights with lowest metric */ - remaining_sum = 0; + remaining_sum = nh_weight = 0; for (i = 0; i < dst_priv->nhg_nh_count; i++) { - if (nhop_get_metric(x[i].nh) == metric) - remaining_sum += x[i].weight; + if (nhop_get_metric(x[i].nh) == metric) { + /* + * Temporary store weight of unreachable nhops in nh_weight + * to ensure we have at least one reachable nexthop. + */ + if (NH_IS_VALID(x[i].nh)) + remaining_sum += x[i].weight; + else + nh_weight += x[i].weight; + } + } + + /* If no reachable nhops exist, include all */ + if (remaining_sum == 0) { + remaining_sum = nh_weight; + one_reachable = false; } remaining_slots = num_slots; @@ -268,14 +283,18 @@ compile_nhgrp(struct nhgrp_priv *dst_priv, const struct weightened_nhop *x, if (nhop_get_metric(x[i].nh) != metric) continue; - /* Calculate number of slots for the current nexthop */ - if (remaining_sum > 0) { + /* + * Calculate number of slots for the current nexthop. + * Exclude unreachable nexthops if there is one reachable. + */ + if (remaining_sum > 0 && + (NH_IS_VALID(x[i].nh) || !one_reachable)) { nh_weight = (uint64_t)x[i].weight; nh_slots = (nh_weight * remaining_slots / remaining_sum); + remaining_sum -= x[i].weight; } else nh_slots = 0; - remaining_sum -= x[i].weight; remaining_slots -= nh_slots; FIB_NH_LOG(LOG_DEBUG3, x[0].nh, @@ -1066,6 +1085,41 @@ nhgrp_get_count(struct rib_head *rh) return (count); } +/* + * Recompile nexthop group without changing the slots. + * Since a nexthop might become reachable again soon, + * this avoids unnecessary memory allocation. + */ +static void +nhgrp_recompile_one(struct nhgrp_priv *nhg_priv) +{ + struct nhgrp_object *nhg = nhg_priv->nhg; + const struct weightened_nhop *wn; + uint32_t num_nhops, min_metric; + + wn = nhgrp_get_nhops(nhg, &num_nhops); + + /* dataplane only has the lowest metric nhops, just pick one */ + min_metric = nhop_get_metric(nhg->nhops[0]); + compile_nhgrp(nhg_priv, wn, nhg->nhg_size, min_metric); +} + +void +nhgrp_recompile(struct rib_head *rh) +{ + struct nh_control *ctl = rh->nh_control; + struct nhgrp_priv *nhg_priv; + + NHOPS_WLOCK_ASSERT(ctl); + + if (ctl->gr_head.items_count == 0) + return; + + CHT_SLIST_FOREACH(&ctl->gr_head, mpath, nhg_priv) { + nhgrp_recompile_one(nhg_priv); + } CHT_SLIST_FOREACH_END; +} + int nhgrp_dump_sysctl(struct rib_head *rh, struct sysctl_req *w) { diff --git a/sys/net/route/nhop_ctl.c b/sys/net/route/nhop_ctl.c index 4f013908b338..d978e624e65d 100644 --- a/sys/net/route/nhop_ctl.c +++ b/sys/net/route/nhop_ctl.c @@ -1335,19 +1335,30 @@ nhops_ifnet_state_changed(struct ifnet *ifp, bool status) { struct nhop_object *nh; struct nhop_iter iter = { .fibnum = ifp->if_fib, .wlock = true }; + bool nhops_changed; for (iter.family = 1; iter.family <= AF_MAX; iter.family++) { + /* + * By tracking nhop changes, we avoid redundant nhgrp + * recompilation triggered by multiple events. + */ + nhops_changed = false; iter.rh = rt_tables_get_rnh_safe(iter.fibnum, iter.family); for (nh = nhops_iter_start(&iter); nh != NULL; nh = nhops_iter_next(&iter)) { if (nh->nh_ifp != ifp) continue; - if (status) + if (status && !NH_IS_VALID(nh)) { nh->nh_flags &= ~NHF_INVALID; - else + nhops_changed = true; + } else if (!status && NH_IS_VALID(nh)) { nh->nh_flags |= NHF_INVALID; + nhops_changed = true; + } } + if (iter.rh != NULL && nhops_changed) + nhgrp_recompile(iter.rh); nhops_iter_stop(&iter); } } diff --git a/sys/net/route/route_var.h b/sys/net/route/route_var.h index df528c93262a..c91002e6c005 100644 --- a/sys/net/route/route_var.h +++ b/sys/net/route/route_var.h @@ -312,6 +312,7 @@ int nhgrp_get_addition_group(struct rib_head *rnh, int nhgrp_get_merge_group(struct rib_head *rnh, struct route_nhop_data *rnd_orig, struct route_nhop_data *rnd_add, struct route_nhop_data *rnd_new); +void nhgrp_recompile(struct rib_head *rh); void nhgrp_ref_object(struct nhgrp_object *nhg); uint32_t nhgrp_get_idx(const struct nhgrp_object *nhg); From nobody Sat Jul 11 19:26:24 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 4gyJbP3QwWz6lWks for ; Sat, 11 Jul 2026 19:26:25 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyJbP0jxGz3YWX for ; Sat, 11 Jul 2026 19:26:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783797985; 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=8f/GZ3Sx2i4JARaeKq8dLjPJSTCasR7T7SK6ASNowYE=; b=IR+h4XWr5L+EeX/klNGNz+dhVdfv5ycw34zGg0jnmZhOD3rOvUqmNgl6wserjS5QUB0/CC KZz3rpEMlTUEBqrDU63aZEhfdJeGQq841HctlaiWRexk1lxlUHlJ4NeP5tm6c2OAbSzvtz WvV0A+ZaI9A0j7nCkw8siRkY69OYh9a8vBQB+RiS7jmPO2jvUTfDyMGKoaEp4e991JnVY8 wByjTDibxEVFvMz1QTUrZhCkCSQkXb5ebzwvwAzC2bTwhF+V8O3CWgRJ9eXsVPQ1CcDk59 1RGE7lzGTFA/2jJbxjKOqumM/ReNqZrILeBR3ShBMnLoANzJvs3FDIIEv+uTAA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783797985; a=rsa-sha256; cv=none; b=IlovcSbMgi+UNtQBzFP796Oek7DwbKSF/2o8I5cWcjE6D/W7Je1qBhSnvoAXlQc80C76CD OJ/xHo8Izvxh5rTSjz7NA3H44zMo232+4i2ysDIJLZEe/BZ8Pb/A5JA9BhKBMoJc05C15C a77f3E4zdTTrBa5VqDK92NLzQNd4GWl6UQUPJ6U0GV2uYqn7qedMP8e2kQf1MuVql/nZ0v eNeUsi/yPKwpC6hXI1qPzPxIbrBgc4e34i15vVcQvBijbZRDniwny1Z/qf3KtlqxKeSJEZ kkk8iRBql7ANxKMaotfrV6gVM7440VbT0V9A2OeJeYDolDAbCS1aHOg9jupBug== 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=1783797985; 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=8f/GZ3Sx2i4JARaeKq8dLjPJSTCasR7T7SK6ASNowYE=; b=xcZ1NrIWtVDzMfnEKMv5eJqhSR306+fbeJUB9xEHthnm685Rl8oig9ELsS+vyOxKNigV2r wEkXCwUsyOtkfy2L6tuUNtqEKxNONO1HU+71ORjP5+HkM3peNN0Q8kZ19Gorq5WYAXJZUk ImS0eSsfHKIIcw9ulYqfnyOnA2H881Eop5AiLoC4GRHAULXeFMlc0+y9ZH0ExRJDWN40Tk mcm4X4ulOhbZw8a73nzGf1NzRta6A4Zbsi1xun10FQwxZhNpLf2QekcOXjXoEo2xUZrNxA nzPErOKJ3hHRxVJnmF89Be73fPmLxS7dTlDQeFtLPFLIcE0kFMC3HYq9P3WrCQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyJbN5r3pztpM for ; Sat, 11 Jul 2026 19:26:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2700d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 11 Jul 2026 19:26:24 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Pouria Mousavizadeh Tehrani Subject: git: 4d37c2ea3c86 - main - routing: Add test for nexthop subscription 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: pouria X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4d37c2ea3c863e802a0d58a70331f4da9e41486c Auto-Submitted: auto-generated Date: Sat, 11 Jul 2026 19:26:24 +0000 Message-Id: <6a5298e0.2700d.1ae4cde7@gitrepo.freebsd.org> The branch main has been updated by pouria: URL: https://cgit.FreeBSD.org/src/commit/?id=4d37c2ea3c863e802a0d58a70331f4da9e41486c commit 4d37c2ea3c863e802a0d58a70331f4da9e41486c Author: Pouria Mousavizadeh Tehrani AuthorDate: 2026-06-12 20:22:47 +0000 Commit: Pouria Mousavizadeh Tehrani CommitDate: 2026-07-11 18:23:09 +0000 routing: Add test for nexthop subscription Make sure we have reachability when one of our nexthops gets down without deleting the route. Differential Revision: https://reviews.freebsd.org/D57552 --- tests/sys/net/routing/test_routing.sh | 90 ++++++++++++++++++++++++++++++++--- 1 file changed, 84 insertions(+), 6 deletions(-) diff --git a/tests/sys/net/routing/test_routing.sh b/tests/sys/net/routing/test_routing.sh index 296bd7ebaffd..644b0381bca5 100755 --- a/tests/sys/net/routing/test_routing.sh +++ b/tests/sys/net/routing/test_routing.sh @@ -34,7 +34,6 @@ add_lowest_metric_head() atf_set require.user root atf_set require.progs jq } - add_lowest_metric_body() { local epair laddr route nhop1 nhop2 nhop3 @@ -83,7 +82,6 @@ add_lowest_metric_body() atf_check -o match:".*gateway: ${nhop1}.*" \ route -n6 get -net ${route}/64 } - add_lowest_metric_cleanup() { vnet_cleanup @@ -96,7 +94,6 @@ add_default_metric_head() atf_set require.user root atf_set require.progs jq } - add_default_metric_body() { local epair laddr route nhop1 @@ -121,7 +118,6 @@ add_default_metric_body() output=$(cat netstat | jq_rtentry ${route}/64 | jq_nhop_filter ${nhop1} 1 1) atf_check_equal "$output" "$nhop1" } - add_default_metric_cleanup() { vnet_cleanup @@ -134,7 +130,6 @@ delete_route_with_metric_head() atf_set require.user root atf_set require.progs jq } - delete_route_with_metric_body() { local epair laddr route nhop1 nhop2 @@ -216,16 +211,99 @@ delete_route_with_metric_body() output=$(cat netstat | jq_rtentry ${route}/64 | jq_nhop_filter ${nhop2} 1 4) atf_check_equal "$output" "$nhop2" } - delete_route_with_metric_cleanup() { vnet_cleanup } +atf_test_case "test_ecmp_routes_by_event" "cleanup" +test_ecmp_routes_by_event_head() +{ + atf_set descr 'Test reachability of ECMP routes when an ifp gets down' + atf_set require.user root +} +test_ecmp_routes_by_event_body() +{ + local jname epair0 epair1 lo0_addr lo1_addr ep0_prefix ep1_prefix + + jname="ecmp_route_by_event" + lo0_addr="3fff:a::1" + lo1_addr="3fff:b::1" + ep0_prefix="3fff:1::" + ep1_prefix="3fff:2::" + + vnet_init + epair0=$(vnet_mkepair) + epair1=$(vnet_mkepair) + + vnet_mkjail ${jname} ${epair0}b + atf_check -o ignore \ + ifconfig ${epair1}b vnet ${jname} + + atf_check -o ignore \ + ifconfig ${epair0}a inet6 ${ep0_prefix}a/127 up + atf_check -o ignore \ + ifconfig ${epair1}a inet6 ${ep1_prefix}a/127 up + atf_check -o ignore \ + ifconfig -j ${jname} ${epair0}b inet6 ${ep0_prefix}b/127 up + atf_check -o ignore \ + ifconfig -j ${jname} ${epair1}b inet6 ${ep1_prefix}b/127 up + atf_check -o ignore \ + ifconfig lo0 inet6 ${lo0_addr}/128 up + atf_check -o ignore \ + ifconfig -j ${jname} lo0 inet6 ${lo1_addr}/128 up + + # Create ECMP routes with via epair0 and epair1 to loopback + atf_check -o ignore \ + route -6 add -net ${lo1_addr}/128 -gateway ${ep0_prefix}b + atf_check -o ignore \ + route -6 add -net ${lo1_addr}/128 -gateway ${ep1_prefix}b + atf_check -o ignore \ + route -6j ${jname} add -net ${lo0_addr}/128 -gateway ${ep0_prefix}a + atf_check -o ignore \ + route -6j ${jname} add -net ${lo0_addr}/128 -gateway ${ep1_prefix}a + + # Check the connection + atf_check -o ignore ping -c1 -t1 ${ep0_prefix}b + atf_check -o ignore ping -c1 -t1 ${ep1_prefix}b + atf_check -o ignore ping -c1 -t1 -S ${lo0_addr} ${lo1_addr} + + # Down one of the nexthop interfaces + atf_check -o ignore \ + ifconfig ${epair0}a down + # Since epair doesn't support linkstate and we need to receive + # the icmp reply, shutdown the other side of epair too + atf_check -o ignore \ + ifconfig -j${jname} ${epair0}b down + + # Test if our destination is still reachable + sleep 0.01 + atf_check -o ignore ping -c1 -t1 -S ${lo0_addr} ${lo1_addr} + + # Do the same thing for other interface + atf_check -o ignore \ + ifconfig ${epair0}a up + atf_check -o ignore \ + ifconfig -j${jname} ${epair0}b up + atf_check -o ignore \ + ifconfig ${epair1}a down + atf_check -o ignore \ + ifconfig -j${jname} ${epair1}b down + + # Test if our destination is still reachable + sleep 0.01 + atf_check -o ignore ping -c1 -t1 -S ${lo0_addr} ${lo1_addr} +} +test_ecmp_routes_by_event_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "add_lowest_metric" atf_add_test_case "add_default_metric" atf_add_test_case "delete_route_with_metric" + atf_add_test_case "test_ecmp_routes_by_event" } From nobody Sat Jul 11 19:30:24 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 4gyJh13Prsz6lX0m for ; Sat, 11 Jul 2026 19:30:25 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyJh1058Bz3Zg2 for ; Sat, 11 Jul 2026 19:30:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783798225; 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=ApDORUVmWyrc/Yvzw/gZ9cSSW2pOZI/QY4eWZ8Qt4wo=; b=x/Ex5Xu6+9lvPCn3mFikVByQeCNKlwuSNcaace7RLV5r8X2lnxRp8PfuILqgeEpKD3C9e+ +6Ar04C6th9OkhkACmiPcTUp071q5epJUCj8bnkI2esBMltuynQ0UWFZ9ZGLn6v994eFy2 mXA3tW65BOFDKfmJ+oOoaxAJcrshVLxRmEiCeasOnCVJN3Z56kfnRiePAv+HVIfjxUMaOx jYgGBRFjBvbhBy8025sW5HewNXF965uAyX6YkHgg4px2NtaHZOFsdvgVM5NHOps5zb2L12 /G0K+Uq50mF2kWsszrRZU+wLoZ76wGx1tsXDyqtnNZGcq0grC2EFIiZD9042lQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783798225; a=rsa-sha256; cv=none; b=Ar3wsPTXjvMF+FRkANdXItSKB4Zw2cDKEGR3Q3QpYJ3dxhj8tBgKeeDTWTC+DW7e1s7OSB KrMB1a6ptoAy9xlmws+LrOCWdot/AiY8/k4AnCUEIgrJSwnLA1y8Raj9Hk9/4j1THdGAIt 50Fw5EiUJheed4ddT6wLhtHJC4lrM2H20dwtfj0hzCUfJYYo94O+UOm6HdKsEmPyemlBOj rRM3nvUI8Fl+JsZqjkdAP5XxOW+x5iH+8Y4/h1wi8MzE1w5ycHU1e4YoVvdMHwgTJMwmAF 2YTlJ+wMT4OxUoAJi8P0Z5OpSbVAoLoL1wM7prScgnwJb+TibKcoO07BUFEZAQ== 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=1783798225; 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=ApDORUVmWyrc/Yvzw/gZ9cSSW2pOZI/QY4eWZ8Qt4wo=; b=a311gSvZBhhLh5ukMM28EMc06PS6WpJK0Li+KT3c4WeSl+415rpIDZsZEDV/m+pGAdbLbS 9B0HoPR+7xbxShqfjByAs7wZcvNNG0kwyVULIurZl+qYKomsWI728eP21Yt0jCH8XQK+xS uMrT0ZXrVkadAFKZMJ0ZTsv9WgFbYiFswwN6qvtUwSRubFZgGJ13HK4ooX4HehHHJ/o1nx OVDlzG2mAmZbUQcmQZJiAt0u3FPj/uq9otvYlleofmh6toX2cag072aJmOO2sG4BFdrGZs oYJspEbDJGHx+UohW8KWM7pAJq/7YbwHqNbM7hp2dQRqcCw6If7N0ciCJnCSKA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyJh05NNxzv51 for ; Sat, 11 Jul 2026 19:30:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 26e5e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 11 Jul 2026 19:30:24 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: dc6c193bb4a6 - main - loader.efi: Add xz decompression 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dc6c193bb4a67e2e9ee97d1e3ac3e2950bd16979 Auto-Submitted: auto-generated Date: Sat, 11 Jul 2026 19:30:24 +0000 Message-Id: <6a5299d0.26e5e.70437550@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=dc6c193bb4a67e2e9ee97d1e3ac3e2950bd16979 commit dc6c193bb4a67e2e9ee97d1e3ac3e2950bd16979 Author: Warner Losh AuthorDate: 2026-07-11 14:44:40 +0000 Commit: Warner Losh CommitDate: 2026-07-11 19:28:47 +0000 loader.efi: Add xz decompression We can now decompress .xz compressed memory disks, like FreeBSD-15.1-RELEASE-amd64-disc1.iso.xz Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D58073 --- stand/defs.mk | 5 ++ stand/efi/loader/Makefile | 2 +- stand/efi/loader/decompress.c | 101 ++++++++++++++++++++++++++-- stand/efi/loader/decompress.h | 2 +- stand/libsa/Makefile | 7 ++ sys/contrib/xz-embedded/freebsd/xz_config.h | 11 +-- 6 files changed, 117 insertions(+), 11 deletions(-) diff --git a/stand/defs.mk b/stand/defs.mk index 05108404c538..e3908678b53a 100644 --- a/stand/defs.mk +++ b/stand/defs.mk @@ -190,6 +190,11 @@ BZIP2_CFLAGS=-I${SRCTOP}/contrib/bzip2 -DBZ_NO_STDIO -DBZ_NO_COMPRESS # ZSTD client cflags ZSTD_CFLAGS=-I${SYSDIR}/contrib/zstd/lib +# XZ flags +XZ_DIR=${SRCTOP}/sys/contrib/xz-embedded +XZ_CFLAGS=-DXZ_USE_CRC64 -I${XZ_DIR}/freebsd -I${XZ_DIR}/linux/include/linux + + # The boot loader build uses dd status=none, where possible, for reproducible # build output (since performance varies from run to run). Trouble is that # option was recently (10.3) added to FreeBSD and is non-standard. Only use it diff --git a/stand/efi/loader/Makefile b/stand/efi/loader/Makefile index 164b16ff2a59..b29f0b8f8259 100644 --- a/stand/efi/loader/Makefile +++ b/stand/efi/loader/Makefile @@ -47,7 +47,7 @@ HAVE_ZFS= yes CFLAGS.bootinfo.c += -I$(SRCTOP)/sys/teken CFLAGS.bootinfo.c += -I${SRCTOP}/contrib/pnglite -CFLAGS.decompress.c += ${ZLIB_CFLAGS} ${BZIP2_CFLAGS} ${ZSTD_CFLAGS} +CFLAGS.decompress.c += ${ZLIB_CFLAGS} ${BZIP2_CFLAGS} ${ZSTD_CFLAGS} ${XZ_CFLAGS} CFLAGS.framebuffer.c += -I$(SRCTOP)/sys/teken CFLAGS.framebuffer.c += -I${SRCTOP}/contrib/pnglite CFLAGS.main.c += -I$(SRCTOP)/sys/teken diff --git a/stand/efi/loader/decompress.c b/stand/efi/loader/decompress.c index 5c16f7d9bb2a..fb3c6314e4b6 100644 --- a/stand/efi/loader/decompress.c +++ b/stand/efi/loader/decompress.c @@ -11,7 +11,8 @@ #include #include -#ifdef LOADER_ZFS_SUPPORT /* ZSTD only available with ZFS */ +#include +#ifdef LOADER_ZFS_SUPPORT /* ZSTD and lzma only available with ZFS */ #include #endif #include @@ -32,6 +33,7 @@ struct decomp_state union { z_stream zstrm; bz_stream bzstrm; + struct xz_dec *xzstrm; #ifdef LOADER_ZFS_SUPPORT ZSTD_DStream *zstdstrm; #endif @@ -63,10 +65,10 @@ what_compressed(uint8_t *buf, size_t len) return (zstd); } if (memcmp(buf, "\xfd""7zXZ\x00", 6) == 0) { - printf("xz -- unsupproted\n"); - } else { - printf("Not compressed\n"); + printf("xz\n"); + return (xz); } + printf("Not compressed\n"); return (none); } @@ -220,7 +222,7 @@ bzip2_step(decomp_state *dctx, uint8_t *buf, size_t len, size_t offset) if (ret == BZ_STREAM_END) return (done); - if (ret != Z_OK) + if (ret != BZ_OK) return (err); if (dctx->buf_cur < dctx->buf_end) /* Have output space */ return (ok); @@ -247,6 +249,90 @@ bzip2_fini(decomp_state *dctx, bool flush) free_buffer(dctx); } +/* + * XZ support + */ +static EFI_STATUS +xz_init(decomp_state *dctx, uint8_t *first_buf, size_t buflen, size_t size_hint) +{ + /* + * Assume 4x compression, but start at 64MB + */ + dctx->size = max(size_hint * 4, M(64)); + EFI_STATUS status = alloc_buffer(dctx, dctx->size); + if (EFI_ERROR(status)) + return (status); + xz_crc32_init(); + xz_crc64_init(); + dctx->xzstrm = xz_dec_init(XZ_DYNALLOC, (uint32_t)-1); + return (dctx->xzstrm != NULL ? EFI_SUCCESS : EFI_VOLUME_CORRUPTED); +} + + +static enum step_return +xz_step(decomp_state *dctx, uint8_t *buf, size_t len, size_t offset) +{ + struct xz_dec *strm = dctx->xzstrm; + size_t outlen = dctx->buf_end - dctx->buf_cur; + struct xz_buf b = { .in = buf, .in_size = len, .in_pos = 0, + .out = dctx->buf_cur, .out_size = outlen, .out_pos = 0 }; + int ret; + + ret = xz_dec_run(strm, &b); + dctx->buf_cur += b.out_pos; + + if (ret == XZ_STREAM_END) + return (done); + if (ret != XZ_OK) { + switch(ret) { + case XZ_MEM_ERROR: + printf("xz no memory "); + break; + case XZ_DATA_ERROR: + printf("xz file corrupted "); + break; + case XZ_FORMAT_ERROR: + printf("xz format not found "); + break; + case XZ_OPTIONS_ERROR: + printf("unsupported xz option "); + break; + case XZ_MEMLIMIT_ERROR: + printf("xz dictionary too small "); + break; + default: + printf("xz step error %d ", ret); + break; + } + printf(" len %d offset %d\n", (int)len, (int)offset); + return (err); + } + if (dctx->buf_cur < dctx->buf_end) /* Have output space */ + return (ok); + + /* + * We're out of space, grow the buffer and try again if there's buffer + * space. We try again recursively since we know that will usually go + * only 1 deep. + */ + if (EFI_ERROR(grow_buffer(dctx))) + return (err); + if (b.in_pos == b.in_size) + return (ok); + size_t consumed = b.in_pos; + return (xz_step(dctx, buf + consumed, len - consumed, offset + consumed)); +} + +static void +xz_fini(decomp_state *dctx, bool flush) +{ + xz_dec_end(dctx->xzstrm); + dctx->xzstrm = NULL; + if (!flush) + return; + free_buffer(dctx); +} + /* * ZSTD supprot */ @@ -373,6 +459,11 @@ decomp_init(uint8_t *buf, size_t buflen, size_t size_hint) dctx->step = bzip2_step; dctx->fini = bzip2_fini; break; + case xz: + dctx->init = xz_init; + dctx->step = xz_step; + dctx->fini = xz_fini; + break; #ifdef LOADER_ZFS_SUPPORT case zstd: dctx->init = zstd_init; diff --git a/stand/efi/loader/decompress.h b/stand/efi/loader/decompress.h index 43c48078f822..f9d4fe445028 100644 --- a/stand/efi/loader/decompress.h +++ b/stand/efi/loader/decompress.h @@ -6,7 +6,7 @@ #pragma once -enum compression { none, zlib, bzip2, zstd }; +enum compression { none, zlib, bzip2, xz, zstd }; enum step_return { ok, done, err }; typedef struct decomp_state decomp_state; diff --git a/stand/libsa/Makefile b/stand/libsa/Makefile index a0bc47f343b5..ab7a0f5a59f2 100644 --- a/stand/libsa/Makefile +++ b/stand/libsa/Makefile @@ -110,6 +110,13 @@ SRCS+= ${i} SRCS+= lz4.c CFLAGS.lz4.c+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 +# xz decompression +.PATH: ${XZ_DIR}/linux/lib/xz +.for i in xz_crc32.c xz_crc64.c xz_dec_bcj.c xz_dec_lzma2.c xz_dec_stream.c xz.c +CFLAGS.${i}+=${XZ_CFLAGS} +SRCS+= ${i} +.endfor + # io routines SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c mount.c \ fstat.c close.c lseek.c open.c read.c write.c readdir.c preload.c diff --git a/sys/contrib/xz-embedded/freebsd/xz_config.h b/sys/contrib/xz-embedded/freebsd/xz_config.h index 7fb9a07b5982..4667b64805af 100644 --- a/sys/contrib/xz-embedded/freebsd/xz_config.h +++ b/sys/contrib/xz-embedded/freebsd/xz_config.h @@ -27,10 +27,17 @@ #ifndef __FREEBSD_XZ_CONFIG_H__ #define __FREEBSD_XZ_CONFIG_H__ +#if defined(_KERNEL) #include #include #include #include +#elif defined(_STANDALONE) +#include "stand.h" +#include +#else +/* nothing */ +#endif #include #include "xz_malloc.h" @@ -61,10 +68,6 @@ #define memeq(a, b, size) (memcmp((a), (b), (size)) == 0) #define memzero(buf, size) bzero((buf), (size)) -#ifndef min -# define min(x, y) MIN((x), (y)) -#endif - #define min_t(type, x, y) min((x), (y)) #define get_le32(ptr) le32toh(*(const uint32_t *)(ptr)) From nobody Sat Jul 11 19:30:25 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 4gyJh20n2Nz6lX0n for ; Sat, 11 Jul 2026 19:30:26 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyJh1747Tz3ZZg for ; Sat, 11 Jul 2026 19:30:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783798226; 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=vnCvsg6fWVudzvMrO9z0IiCr/JplMt66qNldxVemHjs=; b=DMYRGJV2WuLjOygKf+GKFi1Or/aAI3ssoPXzp31wq06XRmsFEgr9X6IEQ68lRYkq6xCupQ +/3/KcsynnqxIb6TJew3f2cjt8zNLlnDzQV4aFEBfoYeHgYD5O5+AI2ZgtnxD4rbJoidsf jjsmFfmij4ICOXb6OOqKjy3tqnplB/dP5CHzk/M/jmnpHOEm0xv7g1A3aO2dOC5nRwKZkn Z4WEcH9dCUqblTvWhWbNK4H2l4mkHKL8uaRSejsSNCfeVtGeWczkquI222f0Y0/tR4nTgO d51ZHKvGNnchIbiGg3k6NGA+RPkoU+QyNqUQxuZzvf4m2yHP6APwMREu0qZxng== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783798226; a=rsa-sha256; cv=none; b=C195Zx4qYw/CmN4T6Pj39h3LFZpEb6fBw4rFrdTwmEVHZ+fVewyf/gCKfkOERff38Ug9PW uCclg+szfopW5u6kfs0PsXstHGuQDMWRuA+oHumrsAGnXC2yfXeyvlCxhdo1zSPIXex+37 JbtQqq8EZ2U/Jy7y1a7Igjzai7W5J3hdjsK9tK/lqKxP8zT1oYeslL6Q1+Yiic53o4opWh dQQl3wwifbQEMHHi9GLTNscFmD8R5EuTlT7kicv8xI0lawwsqID6be6+DJ/WR/CK3Q8ubk CZP07yh/MAgLSBhNEFrkYIQV4mjT8BlB4KQPkKfqWunzdesUDB5YAeTMNzy65g== 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=1783798226; 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=vnCvsg6fWVudzvMrO9z0IiCr/JplMt66qNldxVemHjs=; b=MMOFBmT9rbgwmvGkx4S82bK/Xn1L9RKOqO0X8bJFM/aU1yWYShOoPa5P0QOYqQ5UFI2fmT gL0CXlAVBpBUsHhgK+qf+rsLL8cwivRddm4RaMS5Ih2iT4dgx2/KwwYPlVpTUJ9NdmnKbk tcvsC831Wdh56W+t6CUznnbUyYY55CBwh4P6fGdy063O8oljzO3p6yFKiyFCg1Vi3X7eEG LfAMPAF4xJYNFNx3jjgAXjSScG3MXM21dyzmWE5xM9ru8hcyrzcfGBnU13c7WeV45WQ7Gm LzBtoWgEhY8gS5p9int0hCkHev1IB/nFwFHRsg0Vh5cn6hjTy0hg65nCUQOsPQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyJh15hKMztWy for ; Sat, 11 Jul 2026 19:30:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 30485 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 11 Jul 2026 19:30:25 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 86d719ae68aa - main - loader: Add xzfs, like gzipfs but with xz. 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 86d719ae68aa5f6db055e1fa7ede24b70e612ec7 Auto-Submitted: auto-generated Date: Sat, 11 Jul 2026 19:30:25 +0000 Message-Id: <6a5299d1.30485.a632fac@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=86d719ae68aa5f6db055e1fa7ede24b70e612ec7 commit 86d719ae68aa5f6db055e1fa7ede24b70e612ec7 Author: Warner Losh AuthorDate: 2026-07-11 14:46:14 +0000 Commit: Warner Losh CommitDate: 2026-07-11 19:28:47 +0000 loader: Add xzfs, like gzipfs but with xz. This is just like gzipfs or bzipfs, except done with the newer xz program. This is off by default for the moment. Sponsored by: Netflix --- stand/efi/loader/conf.c | 1 + stand/i386/loader/conf.c | 3 + stand/libsa/Makefile | 3 +- stand/libsa/bzipfs.c | 5 +- stand/libsa/gzipfs.c | 5 +- stand/libsa/stand.h | 1 + stand/libsa/xzfs.c | 309 ++++++++++++++++++++++++++++++++++++++++ stand/loader.mk | 4 + stand/powerpc/ofw/conf.c | 3 + stand/uboot/arch/arm/conf.c | 3 + stand/uboot/arch/powerpc/conf.c | 3 + stand/userboot/userboot/conf.c | 1 + 12 files changed, 336 insertions(+), 5 deletions(-) diff --git a/stand/efi/loader/conf.c b/stand/efi/loader/conf.c index 0a0476873fe1..4f257dc5ba23 100644 --- a/stand/efi/loader/conf.c +++ b/stand/efi/loader/conf.c @@ -66,6 +66,7 @@ struct fs_ops *file_system[] = { &nfs_fsops, &gzipfs_fsops, &bzipfs_fsops, + &xzfs_fsops, NULL }; diff --git a/stand/i386/loader/conf.c b/stand/i386/loader/conf.c index bba33a2707d5..643990699ca1 100644 --- a/stand/i386/loader/conf.c +++ b/stand/i386/loader/conf.c @@ -87,6 +87,9 @@ struct fs_ops *file_system[] = { #ifdef LOADER_BZIP2_SUPPORT &bzipfs_fsops, #endif +#ifdef LOADER_XZ_SUPPORT + &xzfs_fsops, +#endif #ifdef LOADER_SPLIT_SUPPORT &splitfs_fsops, #endif diff --git a/stand/libsa/Makefile b/stand/libsa/Makefile index ab7a0f5a59f2..2bb33060ee2a 100644 --- a/stand/libsa/Makefile +++ b/stand/libsa/Makefile @@ -142,7 +142,7 @@ SRCS+= arp.c ether.c ip.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c SRCS+= bootp.c rarp.c bootparam.c # boot filesystems -SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c +SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c xzfs.c SRCS+= dosfs.c ext2fs.c SRCS+= splitfs.c SRCS+= pkgfs.c @@ -168,6 +168,7 @@ CFLAGS.ffs_subr.c+= -DSTANDALONE_SMALL CFLAGS.gzipfs.c+= ${ZLIB_CFLAGS} CFLAGS.pkgfs.c+= ${ZLIB_CFLAGS} CFLAGS.bzipfs.c+= ${BZIP2_CFLAGS} +CFLAGS.xzfs.c+= ${XZ_CFLAGS} # explicit_bzero and calculate_crc32c .PATH: ${SYSDIR}/libkern diff --git a/stand/libsa/bzipfs.c b/stand/libsa/bzipfs.c index ff7ec16e7dc6..f548475f32f2 100644 --- a/stand/libsa/bzipfs.c +++ b/stand/libsa/bzipfs.c @@ -158,9 +158,10 @@ bzf_open(const char *fname, struct open_file *f) if (f->f_flags != F_READ) return(EPERM); - /* If the name already ends in .gz or .bz2, ignore it */ + /* If the name already ends in a known compressed suffix, ignore it */ if ((cp = strrchr(fname, '.')) && (!strcmp(cp, ".gz") - || !strcmp(cp, ".bz2") || !strcmp(cp, ".split"))) + || !strcmp(cp, ".bz2") || !strcmp(cp, ".xz") + || !strcmp(cp, ".zst") || !strcmp(cp, ".split"))) return(ENOENT); /* Construct new name */ diff --git a/stand/libsa/gzipfs.c b/stand/libsa/gzipfs.c index 6b22f750f3ef..c81335bc0321 100644 --- a/stand/libsa/gzipfs.c +++ b/stand/libsa/gzipfs.c @@ -167,9 +167,10 @@ zf_open(const char *fname, struct open_file *f) if (f->f_flags != F_READ) return(EPERM); - /* If the name already ends in .gz or .bz2, ignore it */ + /* If the name already ends in a known compressed suffix, ignore it */ if ((cp = strrchr(fname, '.')) && (!strcmp(cp, ".gz") - || !strcmp(cp, ".bz2") || !strcmp(cp, ".split"))) + || !strcmp(cp, ".bz2") || !strcmp(cp, ".xz") + || !strcmp(cp, ".zst") || !strcmp(cp, ".split"))) return(ENOENT); /* Construct new name */ diff --git a/stand/libsa/stand.h b/stand/libsa/stand.h index 4f7f21867cea..3cb227ce2079 100644 --- a/stand/libsa/stand.h +++ b/stand/libsa/stand.h @@ -130,6 +130,7 @@ extern struct fs_ops nfs_fsops; extern struct fs_ops cd9660_fsops; extern struct fs_ops gzipfs_fsops; extern struct fs_ops bzipfs_fsops; +extern struct fs_ops xzfs_fsops; extern struct fs_ops dosfs_fsops; extern struct fs_ops ext2fs_fsops; extern struct fs_ops splitfs_fsops; diff --git a/stand/libsa/xzfs.c b/stand/libsa/xzfs.c new file mode 100644 index 000000000000..8880203ddeb2 --- /dev/null +++ b/stand/libsa/xzfs.c @@ -0,0 +1,309 @@ +/* + * Copyright (c) 1998 Michael Smith. + * All rights reserved. + * Copyright (c) 2026 Netflix, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Stacked filesystem for .xz compressed files, structured like gzipfs.c and + * bzipfs.c above it. + */ + +#include "stand.h" + +#include +#include +#include + +#define XZ_BUFSIZE 2048 /* XXX larger? */ + +struct xz_file +{ + int xzf_rawfd; + struct xz_dec *xzf_strm; + struct xz_buf xzf_buf; + unsigned char xzf_inbuf[XZ_BUFSIZE]; + int xzf_endseen; + off_t xzf_total_out; +}; + +static int xzf_fill(struct xz_file *xzf); +static int xzf_open(const char *path, struct open_file *f); +static int xzf_close(struct open_file *f); +static int xzf_read(struct open_file *f, void *buf, size_t size, size_t *resid); +static off_t xzf_seek(struct open_file *f, off_t offset, int where); +static int xzf_stat(struct open_file *f, struct stat *sb); + +struct fs_ops xzfs_fsops = { + .fs_name = "xz", + .fs_flags = 0, + .fo_open = xzf_open, + .fo_close = xzf_close, + .fo_read = xzf_read, + .fo_write = null_write, + .fo_seek = xzf_seek, + .fo_stat = xzf_stat, + .fo_readdir = null_readdir, +}; + +static int +xzf_fill(struct xz_file *xzf) +{ + int result; + int avail_in; + int req; + + avail_in = xzf->xzf_buf.in_size - xzf->xzf_buf.in_pos; + req = XZ_BUFSIZE - avail_in; + result = 0; + + /* If we need more */ + if (req > 0) { + /* move old data to bottom of buffer */ + if (avail_in > 0) + bcopy(xzf->xzf_inbuf + xzf->xzf_buf.in_pos, xzf->xzf_inbuf, avail_in); + + /* read to fill buffer and update availibility data */ + result = read(xzf->xzf_rawfd, xzf->xzf_inbuf + avail_in, req); + xzf->xzf_buf.in = xzf->xzf_inbuf; + xzf->xzf_buf.in_pos = 0; + xzf->xzf_buf.in_size = avail_in + (result >= 0 ? result : 0); + } + return (result); +} + +static const unsigned char xz_magic[6] = {0xfd, '7', 'z', 'X', 'Z', 0x00}; + +/* + * Peek at the fixed-size .xz magic without consuming it, so the header + * remains for xz_dec_run() to parse normally on the first read. + * + * Returns 0 if the header is OK, nonzero if not. + */ +static int +check_header(struct xz_file *xzf) +{ + if (xzf->xzf_buf.in_size - xzf->xzf_buf.in_pos < (int)sizeof(xz_magic) && + xzf_fill(xzf) == -1) + return (1); + if (xzf->xzf_buf.in_size - xzf->xzf_buf.in_pos < (int)sizeof(xz_magic)) + return (1); + return (memcmp(xzf->xzf_buf.in + xzf->xzf_buf.in_pos, xz_magic, + sizeof(xz_magic)) != 0); +} + +static int +xzf_open(const char *fname, struct open_file *f) +{ + static char *xzfname; + int rawfd; + struct xz_file *xzf; + char *cp; + struct stat sb; + + /* Have to be in "just read it" mode */ + if (f->f_flags != F_READ) + return(EPERM); + + /* If the name already ends in a known compressed suffix, ignore it */ + if ((cp = strrchr(fname, '.')) && (!strcmp(cp, ".gz") + || !strcmp(cp, ".bz2") || !strcmp(cp, ".xz") + || !strcmp(cp, ".zst") || !strcmp(cp, ".split"))) + return(ENOENT); + + /* Construct new name */ + xzfname = malloc(strlen(fname) + 4); + if (xzfname == NULL) + return(ENOMEM); + sprintf(xzfname, "%s.xz", fname); + + /* Try to open the compressed datafile */ + rawfd = open(xzfname, O_RDONLY); + free(xzfname); + if (rawfd == -1) + return(ENOENT); + + if (fstat(rawfd, &sb) < 0) { + printf("xzf_open: stat failed\n"); + close(rawfd); + return(ENOENT); + } + if (!S_ISREG(sb.st_mode)) { + printf("xzf_open: not a file\n"); + close(rawfd); + return(EISDIR); /* best guess */ + } + + /* Allocate an xz_file structure, populate it */ + xzf = malloc(sizeof(struct xz_file)); + if (xzf == NULL) { + close(rawfd); + return(ENOMEM); + } + bzero(xzf, sizeof(struct xz_file)); + xzf->xzf_rawfd = rawfd; + xzf->xzf_buf.in = xzf->xzf_inbuf; + + /* + * The embedded xz decoder's internal CRC32/CRC64 tables start out + * zeroed and must be built before any stream can be decoded, or the + * Stream Header CRC32 check fails on the very first read. + */ + xz_crc32_init(); + xz_crc64_init(); + + /* Verify that the file is xz compressed */ + if (check_header(xzf)) { + close(xzf->xzf_rawfd); + free(xzf); + return(EFTYPE); + } + + /* Initialise the inflation engine */ + xzf->xzf_strm = xz_dec_init(XZ_DYNALLOC, (uint32_t)-1); + if (xzf->xzf_strm == NULL) { + close(xzf->xzf_rawfd); + free(xzf); + return(EIO); + } + + /* Looks OK, we'll take it */ + f->f_fsdata = xzf; + return(0); +} + +static int +xzf_close(struct open_file *f) +{ + struct xz_file *xzf = (struct xz_file *)f->f_fsdata; + + xz_dec_end(xzf->xzf_strm); + close(xzf->xzf_rawfd); + free(xzf); + return(0); +} + +static int +xzf_read(struct open_file *f, void *buf, size_t size, size_t *resid) +{ + struct xz_file *xzf = (struct xz_file *)f->f_fsdata; + enum xz_ret ret; + + xzf->xzf_buf.out = buf; /* where and how much */ + xzf->xzf_buf.out_pos = 0; + xzf->xzf_buf.out_size = size; + + while (xzf->xzf_buf.out_pos < xzf->xzf_buf.out_size && xzf->xzf_endseen == 0) { + if ((xzf->xzf_buf.in_pos == xzf->xzf_buf.in_size) && (xzf_fill(xzf) == -1)) { + printf("xzf_read: fill error\n"); + return(EIO); + } + if (xzf->xzf_buf.in_pos == xzf->xzf_buf.in_size) { /* oops, unexpected EOF */ + printf("xzf_read: unexpected EOF\n"); + if (xzf->xzf_buf.out_pos == 0) + return(EIO); + break; + } + + ret = xz_dec_run(xzf->xzf_strm, &xzf->xzf_buf); /* decompression pass */ + if (ret == XZ_STREAM_END) { /* EOF, all done */ + xzf->xzf_endseen = 1; + break; + } + if (ret != XZ_OK) { /* argh, decompression error */ + printf("xzf_read: xz_dec_run returned %d\n", ret); + return(EIO); + } + } + xzf->xzf_total_out += xzf->xzf_buf.out_pos; + if (resid != NULL) + *resid = xzf->xzf_buf.out_size - xzf->xzf_buf.out_pos; + return(0); +} + +static int +xzf_rewind(struct open_file *f) +{ + struct xz_file *xzf = (struct xz_file *)f->f_fsdata; + + if (lseek(xzf->xzf_rawfd, 0, SEEK_SET) == -1) + return(-1); + xzf->xzf_buf.in = xzf->xzf_inbuf; + xzf->xzf_buf.in_pos = 0; + xzf->xzf_buf.in_size = 0; + xzf->xzf_endseen = 0; + xzf->xzf_total_out = 0; + xz_dec_reset(xzf->xzf_strm); + + return(0); +} + +static off_t +xzf_seek(struct open_file *f, off_t offset, int where) +{ + struct xz_file *xzf = (struct xz_file *)f->f_fsdata; + off_t target; + char discard[16]; + + switch (where) { + case SEEK_SET: + target = offset; + break; + case SEEK_CUR: + target = offset + xzf->xzf_total_out; + break; + default: + errno = EINVAL; + return(-1); + } + + /* rewind if required */ + if (target < xzf->xzf_total_out && xzf_rewind(f) != 0) + return(-1); + + /* skip forwards if required */ + while (target > xzf->xzf_total_out) { + errno = xzf_read(f, discard, min(sizeof(discard), + target - xzf->xzf_total_out), NULL); + if (errno) + return(-1); + /* Break out of loop if end of file has been reached. */ + if (xzf->xzf_endseen) + break; + } + /* This is where we are (be honest if we overshot) */ + return(xzf->xzf_total_out); +} + +static int +xzf_stat(struct open_file *f, struct stat *sb) +{ + struct xz_file *xzf = (struct xz_file *)f->f_fsdata; + int result; + + /* stat as normal, but indicate that size is unknown */ + if ((result = fstat(xzf->xzf_rawfd, sb)) == 0) + sb->st_size = -1; + return(result); +} diff --git a/stand/loader.mk b/stand/loader.mk index b34ba08a8e5d..0ff5bd144d93 100644 --- a/stand/loader.mk +++ b/stand/loader.mk @@ -53,6 +53,7 @@ SRCS+= metadata.c # LOADER_NFS_SUPPORT Add NFS support # LOADER_TFTP_SUPPORT Add TFTP support # LOADER_UFS_SUPPORT Add support for UFS filesystems +# LOADER_XZ_SUPPORT Add support for xz compressed files # LOADER_ZFS_SUPPORT Add support for ZFS filesystems # @@ -130,6 +131,9 @@ CFLAGS+= -DLOADER_GZIP_SUPPORT .if ${LOADER_BZIP2_SUPPORT:Uno} == "yes" CFLAGS+= -DLOADER_BZIP2_SUPPORT .endif +.if ${LOADER_XZ_SUPPORT:Uno} == "yes" +CFLAGS+= -DLOADER_XZ_SUPPORT +.endif # Network related things .if ${LOADER_NET_SUPPORT:Uno} == "yes" diff --git a/stand/powerpc/ofw/conf.c b/stand/powerpc/ofw/conf.c index c96048b5a09c..a77afe203719 100644 --- a/stand/powerpc/ofw/conf.c +++ b/stand/powerpc/ofw/conf.c @@ -80,6 +80,9 @@ struct fs_ops *file_system[] = { #endif #if defined(LOADER_BZIP2_SUPPORT) &bzipfs_fsops, +#endif +#if defined(LOADER_XZ_SUPPORT) + &xzfs_fsops, #endif NULL }; diff --git a/stand/uboot/arch/arm/conf.c b/stand/uboot/arch/arm/conf.c index 7d36e6d6629e..535c3b494e3c 100644 --- a/stand/uboot/arch/arm/conf.c +++ b/stand/uboot/arch/arm/conf.c @@ -67,6 +67,9 @@ struct fs_ops *file_system[] = { #endif #if defined(LOADER_BZIP2_SUPPORT) &bzipfs_fsops, +#endif +#if defined(LOADER_XZ_SUPPORT) + &xzfs_fsops, #endif NULL }; diff --git a/stand/uboot/arch/powerpc/conf.c b/stand/uboot/arch/powerpc/conf.c index 963a4ded4dcf..543b4fb643b2 100644 --- a/stand/uboot/arch/powerpc/conf.c +++ b/stand/uboot/arch/powerpc/conf.c @@ -76,6 +76,9 @@ struct fs_ops *file_system[] = { #endif #if defined(LOADER_BZIP2_SUPPORT) &bzipfs_fsops, +#endif +#if defined(LOADER_XZ_SUPPORT) + &xzfs_fsops, #endif NULL }; diff --git a/stand/userboot/userboot/conf.c b/stand/userboot/userboot/conf.c index 63f64cb97fbe..8d37f241c9bf 100644 --- a/stand/userboot/userboot/conf.c +++ b/stand/userboot/userboot/conf.c @@ -70,6 +70,7 @@ struct fs_ops *file_system[] = { #endif &gzipfs_fsops, &bzipfs_fsops, + &xzfs_fsops, NULL }; From nobody Sat Jul 11 19:30:26 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 4gyJh33Bc2z6lWrl for ; Sat, 11 Jul 2026 19:30:27 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyJh30Sd2z3Znc for ; Sat, 11 Jul 2026 19:30:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783798227; 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=f9NN5nuCXMl3yN6uZD8XXH4YENLRHS4eZWlZmZNlP0s=; b=HO9eLhruqrdy8HCXvxyFNyHG2KLDFB4WalQzh877pSpHweNgvy77XIx1DBtUS/2cpL39/j 4gdhv6Yo+krN3ypKnyR7B61EAr0wUG+RBfG19UM4KhE1N2yyMMo6qXl8/0+I7KNsfRpKwF 2QF4HvWz+3jhSZ/xQgwNKQRNUvxlNMQXa29MFCFg8XQEKqmRcyJqgkuICz3j0EI/dDBQyi SQ6ybLbiOVKsGq6Nvx155HVzARAVtfEOdTIcN19F3SX9EAnYyBiyI+Rjui6oZau11DQeDc p2Ls5ebBvPSCqJiZ+1WJfLIqlj9gixNxawks2fe1x0lxl+7ESHKeTLP9oAqwkA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783798227; a=rsa-sha256; cv=none; b=VvfkMmRuog2fxAyti6+Nw3SUqI7VonbJM7obE5fzcKw7VswJWKtMFE/0AYb0C4NVVW7ka+ /N6kE2nHZV3AUKvgwEp2d2WwnATUl//iVO8te0ekmQ4Bb58raeyFu2goAuqEuKBlHmNklB T5kPBlQqr67p3DrKyBVA33+ogRsXRW69yK9U52gXp9IZMJmbCS/mqPcXkGWLdFg0n77nmM vpGHJbN8o2EoKXpypYMljH9tl6tH7fpNUUCrtGp8P/xU6eNgj43B6AXsLK46QpHhZYpTZy bp82QBD3v5s1lO8krjAxaq1wvYrwpO16qECEzuT/8eDbFGvZFknLakPm3MidRQ== 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=1783798227; 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=f9NN5nuCXMl3yN6uZD8XXH4YENLRHS4eZWlZmZNlP0s=; b=pacHKmNcEQcbOf/I3JoAGfierl2sbFY3YAe+Ys1Jdo7Bcd/46+xArJwHbHEUxpOmcKiqvO gxlgCGTVqVCw9ba+Ms528vbetnmtn8GZXC29UIhGr7xs7FSFMh7lLpveXcQ9qDEG2j/jnB iRQJbit0Gyc3ZTnmyjDathsk2G1PCMK4SL/qtkF0m1NheAzYME16e8noo1bdYyyO7/1sM/ ZDPQURklfcNo/hVmZQ0MYRS7PsBZvzKi+avf1fM4/yxBOt+AWH831petJE42To0manO9ze 0uCUhdNnPFT3IfR/vM58RrrTwLyLGfLmhK8PuQJTGBI4J/fG+u+WI1hc6KbpPA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyJh26T8bztsY for ; Sat, 11 Jul 2026 19:30:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2703a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 11 Jul 2026 19:30:26 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: c61ee49cd06a - main - loader: zstd based filesystem, zstdfs like gzipfs 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c61ee49cd06a610193493f033f04d38cf61f11e2 Auto-Submitted: auto-generated Date: Sat, 11 Jul 2026 19:30:26 +0000 Message-Id: <6a5299d2.2703a.4911201a@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c61ee49cd06a610193493f033f04d38cf61f11e2 commit c61ee49cd06a610193493f033f04d38cf61f11e2 Author: Warner Losh AuthorDate: 2026-07-11 14:46:19 +0000 Commit: Warner Losh CommitDate: 2026-07-11 19:28:47 +0000 loader: zstd based filesystem, zstdfs like gzipfs Off by default. Sponsored by: Netflix --- stand/efi/loader/conf.c | 1 + stand/i386/loader/conf.c | 1 + stand/kboot/kboot/conf.c | 4 ++++ stand/libsa/Makefile | 6 ++++++ stand/libsa/libsa.3 | 14 ++++++++++++++ stand/libsa/stand.h | 1 + stand/userboot/userboot/conf.c | 1 + 7 files changed, 28 insertions(+) diff --git a/stand/efi/loader/conf.c b/stand/efi/loader/conf.c index 4f257dc5ba23..30d9b95739e8 100644 --- a/stand/efi/loader/conf.c +++ b/stand/efi/loader/conf.c @@ -57,6 +57,7 @@ struct devsw *devsw[] = { struct fs_ops *file_system[] = { #ifdef EFI_ZFS_BOOT &zfs_fsops, + &zstdfs_fsops, #endif &dosfs_fsops, &ufs_fsops, diff --git a/stand/i386/loader/conf.c b/stand/i386/loader/conf.c index 643990699ca1..3360c2722035 100644 --- a/stand/i386/loader/conf.c +++ b/stand/i386/loader/conf.c @@ -62,6 +62,7 @@ struct devsw *devsw[] = { struct fs_ops *file_system[] = { #if defined(LOADER_ZFS_SUPPORT) &zfs_fsops, + &zstdfs_fsops, #endif #if defined(LOADER_UFS_SUPPORT) &ufs_fsops, diff --git a/stand/kboot/kboot/conf.c b/stand/kboot/kboot/conf.c index 5d384c5270e6..03c3ea750e76 100644 --- a/stand/kboot/kboot/conf.c +++ b/stand/kboot/kboot/conf.c @@ -85,11 +85,15 @@ struct fs_ops *file_system[] = { #if defined(LOADER_BZIP2_SUPPORT) &bzipfs_fsops, #endif +#if defined(LOADER_XZ_SUPPORT) + &xzfs_fsops, +#endif #if defined(LOADER_MSDOS_SUPPORT) &dosfs_fsops, #endif #if defined(LOADER_ZFS_SUPPORT) &zfs_fsops, + &zstdfs_fsops, #endif &hostfs_fsops, NULL diff --git a/stand/libsa/Makefile b/stand/libsa/Makefile index 2bb33060ee2a..173dec69657d 100644 --- a/stand/libsa/Makefile +++ b/stand/libsa/Makefile @@ -192,6 +192,12 @@ SRCS+= g_eli_hmac.c pkcs5v2.c # Maybe ZFS .if ${MK_LOADER_ZFS} == "yes" .include "${SASRC}/zfs/Makefile.inc" + +# zstdfs.c is a stacked filesystem for .zst files, like gzipfs.c/bzipfs.c +# above; it's only buildable here because zfs/Makefile.inc already pulled +# the zstd decompressor in for ZFS's on-disk compression. +SRCS+= zstdfs.c +CFLAGS.zstdfs.c+= ${ZSTD_CFLAGS} .endif # Crypto hashing functions diff --git a/stand/libsa/libsa.3 b/stand/libsa/libsa.3 index 0947f97a0a1f..a44588901f8b 100644 --- a/stand/libsa/libsa.3 +++ b/stand/libsa/libsa.3 @@ -781,6 +781,20 @@ The same as but for .Xr bzip2 1 Ns -compressed files. +.It Va xzfs_fsops +The same as +.Va gzipfs_fsops , +but for +.Xr xz 1 Ns -compressed +files. +.It Va zstdfs_fsops +The same as +.Va gzipfs_fsops , +but for +.Xr zstd 1 Ns -compressed +files. +Only available when built with ZFS support, since that is the only +source of the zstd decompressor in the boot loader environment. .It Va pkgfs_fsops File access from a tar file typically streamed via TFTP. The order of files in the tar file must match the order they are diff --git a/stand/libsa/stand.h b/stand/libsa/stand.h index 3cb227ce2079..6e363b145595 100644 --- a/stand/libsa/stand.h +++ b/stand/libsa/stand.h @@ -131,6 +131,7 @@ extern struct fs_ops cd9660_fsops; extern struct fs_ops gzipfs_fsops; extern struct fs_ops bzipfs_fsops; extern struct fs_ops xzfs_fsops; +extern struct fs_ops zstdfs_fsops; extern struct fs_ops dosfs_fsops; extern struct fs_ops ext2fs_fsops; extern struct fs_ops splitfs_fsops; diff --git a/stand/userboot/userboot/conf.c b/stand/userboot/userboot/conf.c index 8d37f241c9bf..662f4e405f0a 100644 --- a/stand/userboot/userboot/conf.c +++ b/stand/userboot/userboot/conf.c @@ -67,6 +67,7 @@ struct fs_ops *file_system[] = { &cd9660_fsops, #if defined(USERBOOT_ZFS_SUPPORT) &zfs_fsops, + &zstdfs_fsops, #endif &gzipfs_fsops, &bzipfs_fsops, From nobody Sat Jul 11 19:30:28 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 4gyJh44ClRz6lWy4 for ; Sat, 11 Jul 2026 19:30:28 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyJh418Q4z3ZdM for ; Sat, 11 Jul 2026 19:30:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783798228; 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=OjsBqXFo8BBXKBWZRQNxjOQ+i357dtrwbgRTLCb6ybA=; b=uhlI+Re4/9AG0PJO7zzk1RCGAljFNebzCnNtmtW7PGnN8I+/tq5vkvw4HBHoUETr5R/gam t1tn0TbLb2WWjv2HGEY1fm2mmUkvnHSMk87e6kQoMlftxJ4VhGY1qtNA/hnSsnVlSFsHYM kNw2YXMosFqQnrSjkpP9ieEPCHR6fM/wrx6WeWLWBYjMgDG4z33O0e020bzd1as+7iYc2P SwMdJxVO/pnSOd/Qk48iFAB7CX51ab/w7jx2vyRWa3R+aoKUp6FCh/+myKZ9Rb44lcWXSs cZvxp+7Wsd5t+ECPlxhwSBCQGUF4Ti17gShvkaeQFeFrWzwCH451mnEqYMbXjA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783798228; a=rsa-sha256; cv=none; b=ODf/aySJywVblxAOZiE5eeS6q7VPQ35GIig/QklfwzcRM3nhjzfuGzcZ7o1sX9vqkUbSK2 iFIi3JmMbFHET/XlG4lF4nSmx6ihHAZ0YQnW9uBIoH7DdQ53d224VTp3/2nAIUZHW6TUs7 77dkOVZ90JSQriH96WQvoT1esmP3yRwpHKKg1PVHdAn2krE9MsvtvYK8pxZvsbuIBKjoF+ u+18bDhmXbWd3GIQCs1fgFCPmtDa6VjBWLXptyZh2TYmhYOMnuzF3oqczGrac9AuE5b0al ZxoKhdn19XAk69xHv93KWx7fKkI0bgfP7dR97eQXE/MVkdBe0MbVHAJt/gEQhQ== 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=1783798228; 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=OjsBqXFo8BBXKBWZRQNxjOQ+i357dtrwbgRTLCb6ybA=; b=sq1AYpos16WyVMQyQ6d4s0SBGeUbZATHqfBPvNpmSO8WDEcD1uyK7goll98QqzvNy/pQWG nti4o9atAfmWqkOLUszsJclEAW+8r3tSgGeXYap65mKrbD8pCFn7rg9iFgi6ZHwZQ1lNfT n0dMTEuiB4gNStTDBjJwPePaTBpgmzgvOYFxw5XDlLwe1e5gSu+EGsCNsqVpOU4VKS68k/ SIZFC380rLC5ZgenA2oo3dPiwim2y8A/m58BiZbqAlI4WkSFicc5rktLRNkX4qxtTPLNn4 mJMPLf5R6bMAURG40cNpwmBAaQnF5aWFUnqw7fG3x5sa3+RuvXCKXaj25tTGQQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyJh409MMztwB for ; Sat, 11 Jul 2026 19:30:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 25edb by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 11 Jul 2026 19:30:28 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 7db502d50c1e - main - loader: Add xzfs support by defualt to BIOS and EFI loaders 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7db502d50c1e492f626fefc7d3925b85e05ae743 Auto-Submitted: auto-generated Date: Sat, 11 Jul 2026 19:30:28 +0000 Message-Id: <6a5299d4.25edb.3b4cbd82@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=7db502d50c1e492f626fefc7d3925b85e05ae743 commit 7db502d50c1e492f626fefc7d3925b85e05ae743 Author: Warner Losh AuthorDate: 2026-07-11 14:46:24 +0000 Commit: Warner Losh CommitDate: 2026-07-11 19:28:47 +0000 loader: Add xzfs support by defualt to BIOS and EFI loaders For the BIOS, add xzfs support. This is a tiny increase in the loader size, but allows us to fetch compressed files from any of the filesystems we support, including over the network. For EFI, also add gzipfs and bzip2fs support we well. The increment for these files is tiny. Sponsored by: Netflix --- stand/efi/loader/Makefile | 3 +++ stand/i386/loader/Makefile | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/stand/efi/loader/Makefile b/stand/efi/loader/Makefile index b29f0b8f8259..d423062dc132 100644 --- a/stand/efi/loader/Makefile +++ b/stand/efi/loader/Makefile @@ -3,6 +3,9 @@ LOADER_MSDOS_SUPPORT?= yes LOADER_UFS_SUPPORT?= yes LOADER_CD9660_SUPPORT?= no LOADER_EXT2FS_SUPPORT?= no +LOADER_GZ_SUPPORT?= yes +LOADER_BZIP2_SUPPORT?= yes +LOADER_XZ_SUPPORT?= yes .include diff --git a/stand/i386/loader/Makefile b/stand/i386/loader/Makefile index fde389b9940e..8b9163aa69c2 100644 --- a/stand/i386/loader/Makefile +++ b/stand/i386/loader/Makefile @@ -9,6 +9,7 @@ LOADER_MSDOS_SUPPORT?= no LOADER_UFS_SUPPORT?= yes LOADER_GZIP_SUPPORT?= yes LOADER_BZIP2_SUPPORT?= yes +LOADER_XZ_SUPPORT?= yes .include @@ -32,12 +33,12 @@ VERSION_FILE?= ${.CURDIR}/../loader/version # # will tell you how many kiB of lomem are available. # -# We further reduce this to 500k, though, to give PXE an additional 64k of space +# We further reduce this to 505k, though, to give PXE an additional 64k of space # so pxeloader will fit. If you have special needs that do not include pxeboot, # you can safely set this as high as 560000 generally, or a bit higher if you # have tight control over the machines you are booting on. # -LOADERSIZE?= 500000 # Largest known safe size for loader.bin +LOADERSIZE?= 505000 # Largest known safe size for loader.bin .PATH: ${BOOTSRC}/i386/loader From nobody Sat Jul 11 19:33:42 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 4gyJlp42ZLz6lXCK for ; Sat, 11 Jul 2026 19:33:42 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyJlp1ZJGz3ck9 for ; Sat, 11 Jul 2026 19:33:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783798422; 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=SwvMU/wA9Uneng3PujON9etOwNpLUSYp8bLyZzCSgcE=; b=MNt6BbyoxjMue4LmSfW7kDSo2eclKyOh7x/ziQDmNVBNTLajWoOIfzRL/HQABFA7Q8YQ2M OPUolft5oIDKBp3BAm7ViGjiI/uF60992LZOM5pdeHeMbjI5Eg5yhacmCPpaHF4n8c832U 1OLvaRGvF41g9b4ukhN+qwMcSdacYlwflsO+0dWyiDrTE7L++8DjlbmtQXrKWNfb5ZX8JH 0w1OoyUxwd0lZnbnrFHQu58UCwRZuj4tW3UMKFwg6hZS669WUDN8La/oPEWq34QarHNoeo ous+1reKRkbM7TNhves7uAQ/vwGoxMKGRi68jwtUF/H/5LIU6YtJgATkba0CwA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783798422; a=rsa-sha256; cv=none; b=DC+GDOCBODxjmPs7B7zfQrPoUrUPsOGSlUY3NzlsrePq9PBHxTgxJ4gXP37vsAcDEc4GYT jM6E/DY5x7/InevkU4XW4m9vnzJzG5TbUjmM1GaygKMAY+blVDCJkUglPZ61Pn7wnDSndz N0h4lm9+upB/KuxyYyGOV7RLjQKvPOD2JHoQ+IXaavKQe7zL6FNf7l2jmlvWnQjaGysGJW urCaQt79sBpypvNggTyBn3WBQ84xKlqVVFe3HxN1rQPLe9RBf92mE/1Y7sY1h6j6NhYQn2 1V9z2KtGNk7iweL016DodqnyQUTOOwdCX3UwcVI/DmEwLlYjoydfUnp5AQvOsw== 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=1783798422; 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=SwvMU/wA9Uneng3PujON9etOwNpLUSYp8bLyZzCSgcE=; b=xR1AIcOCbN7fptRpqcxoVFWkzJcjBS91fWNGmCQDfh70JwEsR3XXoU+aIvRskCucbhLXfR 4uK6hd1AxFxoG3avpYpPkuxFfg6+4yRwztXG1j0pxL2m8SKQm0QiTAiJ+WAOMBC6zuuZ0N wb68xjHEgwHGmLkqGufGLDbI+zPswzPw9HmPpYroGOxuOkr0Qesm9LYxz9fmHWrlLF5Bto sSv3ULuvfkqWagnXHKw4pjQDABKPoACcWM4MgpAxiMJPGNltuvliB24GsPKNrjj+0nloyu z+2+j79kZXzEigSVR+bz9DUKBaNdqfTpJ47Kfzm+UdTEVGmhV99K3m6oeDf80g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyJlp0QYqzvPp for ; Sat, 11 Jul 2026 19:33:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 30b76 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 11 Jul 2026 19:33:42 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 30d4d3db431a - main - nfsd: Commit missing patches for c52bcd09c2a6 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: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 30d4d3db431a5df8084048c4d31e98e74d2f225a Auto-Submitted: auto-generated Date: Sat, 11 Jul 2026 19:33:42 +0000 Message-Id: <6a529a96.30b76.4feffba5@gitrepo.freebsd.org> The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=30d4d3db431a5df8084048c4d31e98e74d2f225a commit 30d4d3db431a5df8084048c4d31e98e74d2f225a Author: Rick Macklem AuthorDate: 2026-07-11 19:30:51 +0000 Commit: Rick Macklem CommitDate: 2026-07-11 19:32:46 +0000 nfsd: Commit missing patches for c52bcd09c2a6 Oops, I missed the other files for the commit. This should fix the build. Pointy hat goes on me. MFC after: 2 weeks Fixes: c52bcd09c2a6 ("nfsd: Garbage collect stray NFSv4 state") --- sys/fs/nfs/nfs_var.h | 1 + sys/fs/nfsserver/nfs_nfsdsocket.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index 525f573b5167..57cf1566a14d 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -169,6 +169,7 @@ int nfsrv_mdscopymr(char *, char *, char *, char *, int *, char *, NFSPROC_T *, struct nfsdevice **); void nfsrv_marknospc(char *, bool); void nfsrv_removedeleg(fhandle_t *, struct nfsrv_descript *, NFSPROC_T *); +void nfsrv_freestrandedstate(struct nfsrvfh *); /* nfs_nfsdserv.c */ int nfsrvd_access(struct nfsrv_descript *, int, diff --git a/sys/fs/nfsserver/nfs_nfsdsocket.c b/sys/fs/nfsserver/nfs_nfsdsocket.c index 36996425ae95..70aa20d4aa04 100644 --- a/sys/fs/nfsserver/nfs_nfsdsocket.c +++ b/sys/fs/nfsserver/nfs_nfsdsocket.c @@ -1031,7 +1031,8 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag, cur_fsid = vp->v_mount->mnt_stat.f_fsid; NFSVOPUNLOCK(vp); vpnes = nes; - } + } else if (nd->nd_repstat == ESTALE) + nfsrv_freestrandedstate(&fh); break; case NFSV4OP_PUTPUBFH: if (nfs_pubfhset) { From nobody Sat Jul 11 19:53:44 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 4gyKBx1hR5z6lY0V for ; Sat, 11 Jul 2026 19:53:45 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyKBw66VNz3fnr for ; Sat, 11 Jul 2026 19:53:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783799624; 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=kbvc/3K5ky+26viHcJV6ZmwnaCZdWAAK84yS9klvpDY=; b=i936xKzrglkIgjSiHcf2DWaC0Ou7hPV9GUcrsHJlga5T7KL6x1KKbv+FGnLi8bLYfcc0kn RZiYYQnWdDPaYAiea9FCOTN70QD3ELJQ7pVPrAZ38Izs/A0wIxj8E1wlesSu3YkzQigwgG ADLjiY1Za20dzQk8O/4NM1QPduJZ/N+VcgHy5yfyq2rYSbPYJmNz8Q7lD2GpArWDiDajP5 QP26LfblRi7sLBafPR4RCrKK+rPCR4GrM6CoIp6thdBBaEz599epvnTVY9QELaLsnWLmWC jWIM+ILg7LhUp3OI9YsUhttJM8uA+7ycV2vegDjjM8gikCqk60SxnVaZgMSa4g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783799624; a=rsa-sha256; cv=none; b=HUMS35ZJtdnIEYA/4thT0/p4Ne+ItUlmYP9mU/uQWWAWZnbVTze4wwOYIjwXS8Sc7eXVZg ToYdzdi043k/BVYvJ3b6XJ3eFtYgpMlEp8ftjCSBx27Vv9alkjfEFnMFM29WQUuZszFjr7 N2LT3hkBpH+5qDVqN01+aX5eXm8ZEyPP8+waX/ys/0ECk6KjJgLCqaQkNcQ+s51q8gGVfw pjiOUJ6wSX3oxwbitxCFsmQHXlR7XFdIXEdHx4WfLMDf2BhkPG78JZXr6DAeeXwYN7bZ7V ABR+EJshSI3mYhq/8CNi5N7cXoJOQd7l9DzXgv0DPVhvbU5/QFwdcoOprmw57w== 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=1783799624; 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=kbvc/3K5ky+26viHcJV6ZmwnaCZdWAAK84yS9klvpDY=; b=b+63c9wYjeWdXknf4ik5rT38CySNQPiEjYO5YH2EhriKIqaF2FUbhSRJSgtmthQSQkJ0r0 LRb++iFlE+2YRnVdvNlHdmnYjBr4r992cAQOVjr54dVQ5cNmJHYi0IApNKBAnQqdSH8zMB zLNtV1320i28uvNEtjNtny+3V6kq1JOJ0ppdNaEDzV/3qiVI9V66Ojt/gPZnHhW9KdQ27o EL9YBG8P5c6liMwsI8bUfth0piSaO7+/C9qW+BjcwdBfFWzkU0qSKaksqX1p4e2yQBzyd4 ksbg6d3qQGXlMy21KCUg2izAxd4ciSqnIvhIWMi+unrFkVZ3gdNC49aiQ9jrCQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyKBw4Y0tzvGs for ; Sat, 11 Jul 2026 19:53:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 30c48 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 11 Jul 2026 19:53:44 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 541e6e2d516b - main - bsd.dirs.mk: Fix MK_INSTALL_AS_USER for directories 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 541e6e2d516b6c9d3681b24464e9ef53c1f2579a Auto-Submitted: auto-generated Date: Sat, 11 Jul 2026 19:53:44 +0000 Message-Id: <6a529f48.30c48.2a2222dc@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=541e6e2d516b6c9d3681b24464e9ef53c1f2579a commit 541e6e2d516b6c9d3681b24464e9ef53c1f2579a Author: Warner Losh AuthorDate: 2026-07-11 19:44:49 +0000 Commit: Warner Losh CommitDate: 2026-07-11 19:52:17 +0000 bsd.dirs.mk: Fix MK_INSTALL_AS_USER for directories Sponsored by: Netflix --- share/mk/bsd.dirs.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/share/mk/bsd.dirs.mk b/share/mk/bsd.dirs.mk index 1f81bda80eab..e708ebc9d916 100644 --- a/share/mk/bsd.dirs.mk +++ b/share/mk/bsd.dirs.mk @@ -12,8 +12,13 @@ DIRS?= . if defined(${dir}) && !empty(${dir}) # Set default permissions for a directory ${dir}_MODE?= 0755 +.if ${MK_INSTALL_AS_USER} == "yes" +${dir}_OWN?= ${_uid} +${dir}_GRP?= ${_gid} +.else ${dir}_OWN?= root ${dir}_GRP?= wheel +.endif . if defined(${dir}_FLAGS) && !empty(${dir}_FLAGS) ${dir}_FLAG= -f ${${dir}_FLAGS} . endif From nobody Sat Jul 11 19:53:43 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 4gyKC10c0qz6lY67 for ; Sat, 11 Jul 2026 19:53:49 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyKC04nhkz3fwX for ; Sat, 11 Jul 2026 19:53:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783799628; 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=kzoJ1ibgzkmBJBl40qpsfdn+CKyYvPrknBxFRmWRKH8=; b=DSDlr8CtnD3o99YFxk2I5DLEQ8mVvVKyZpCnzB4OyhCIYlyxW99+ndYSe/m0hHFSmV156q 00NKDGPJ8sJNonAprMrEwZst6Im3h/D7Ds4Dk/yulwkW0SH5JMoUschV0SBJb8HoSoBiLN DaAL3hZxA6NL3T8kuhAjx71m/Kg7zSOnxcEnLDD02FD34lkRzY1H59am27Ppe85ukGD0EK TIPx6XEJNqn03YDgXLYx3zHizzPUszVhBu9DyuylEJvzcdD/ThiPt2HjSI8BylLO0FEd7W JGoKRxRPecmDOaSgx5b72Sy0P/ZVMKTGvGEkQFDK8dPCsCOjqp6bNNi737o/Gg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783799628; a=rsa-sha256; cv=none; b=OiDmwVgNTuG48twtzLTjNI8a6DLUEmHxizliWkJ1v3dLhi30N5HG2SzXKmwfPWDde3FGqR fp2ehbb+6fsX316AtOwIgEsKxYsLxJAcNjeXQwbKFWb909es8EhQfKhUc9/4tf9ERztjPu +OSrMt9VdrCcSyWMtl2A2g3WvJcevhc8DNrrl4IRVqQQoZmNdPF4NKK+QMoXgGdLjkhwBv uw2n0mSZoQ4bVITCBJAuypz4m6jqhjy7GbYs0JrLxXESRcNpTp8Y9c0J5pyGwGLDjHpCHU m4hioucpUtkcCzK7ujQiHbQsLjYh3w8h0WIakkZSib/uieHk+acZxNbsGFbNDA== 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=1783799628; 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=kzoJ1ibgzkmBJBl40qpsfdn+CKyYvPrknBxFRmWRKH8=; b=m0RtaLc0F9EqRfhG3Npxwyrk2tO2qAkdWE9ao7RcZRNooNgDoNVZTt+Le1GxPQ+2ZL+dl+ f4VVlN9Y9pgSCdp38+ACHLsmsxY6CcG3IgcEcHN6DIy7Me5Qxq2Y8U+Mi3NfJ0nXb4mzbJ TLwTP8MunigbavwyuRCiM0Bz70vq29Gd9BB5242ne7B1giO1ZuLirCGlUft3R/cT5VyZRB /66KZYVyLma+amFDmLpkdqRlbcF8Z1kI3pLYtQPKrSvr584+OwnjUoNc6xInlmaX3xAV57 iRZcTwHu3uUTiAL2V2Ie4Dh70RvPzaNImgiPTi2WZ7dqIfZN6IYxMuOJ4Qkr1g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyKBv3mGQzvGq for ; Sat, 11 Jul 2026 19:53:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 30c44 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 11 Jul 2026 19:53:43 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: a7ebe2d436e5 - main - boot-test.sh: Test many boot loader combinations. 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a7ebe2d436e5d2fabf223796f992683c17acf50f Auto-Submitted: auto-generated Date: Sat, 11 Jul 2026 19:53:43 +0000 Message-Id: <6a529f47.30c44.116e4425@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a7ebe2d436e5d2fabf223796f992683c17acf50f commit a7ebe2d436e5d2fabf223796f992683c17acf50f Author: Warner Losh AuthorDate: 2026-07-11 19:36:51 +0000 Commit: Warner Losh CommitDate: 2026-07-11 19:45:37 +0000 boot-test.sh: Test many boot loader combinations. This is a script that eventually will test boot with qemu all the supproted combinations for the boot loader. There's several things that could be done with gptboot or boot0sio (or not) that aren't tested. We don't test the 10-odd hardware root devices we support, nor do we test complex scenarios like RELAXED vs STRICT zfs efi booting. However, the scenarios we do support are included here. We test aarch64, amd64, armv7, powerpc64, powerpc64le, and riscv64 for BIOS, UEFI, and Prep and OpenFirmware (as appropriate) crossed with CDROM, MBR and GPT (and some hybrid) crossed with lua, 4th and simple loaders. Plus some linuxboot and memdisk scenarios, including the recently added compression for ram disk scenarios: === Results: 67 passed, 3 failed, 9 timed out (of 79) === The timeouts are well understood, usually failure to find the root disk. The failures are bad console assumptions. netboot-bios fails because TFTP with a single packet buffer in qemu gives horrible throughput, so the test takes 18-20 minutes. Now that I have a dashboard, I can fix the rest one by one. There's also a powerpc architecture that you can request specifically, but it's just for convenience and tests with the non-functional mac99 qemu machine. I will eventually eliminate this architecture. I added it to make sure the FreeBSD version wasn't too hard coded since this framework pulls from CD images to get the binaries for the minimal root used in testing and there's no 15.x 32-bit powerpc images. We need to add http and nfs root booting tests, but that's for the future. Plus there's some other functional tests that we should also add for different types of root (usb, sata, sas, nvme, ufs, emmc, sd, etc) that would be useful to test, especailly the non-sata/non-nvme ones. How we do that is still TBD. I leaned on claude to iterate over the recipes that I've developed over the years, collected off the internet or got on IRC recently to produce this framework. Most of this code is fairly good, while a few parts, especailly some of the comments, are detectable as AI produced. My plans are to iteratively improve those. Since this is just a test, and since I've broken many scenarios w/o realizing, it's a good tradeoff. I've not made it an ATF test since we test all the architectures, but I'm open to feedback in this area. Total time to test all the architectures is about 10 minutes. It assumes you've built GENERIC* and the boot loader for all the architectures too. In the future, I plan on moving to MINIMAL for all the boot testing, but likely only after PCI devmatch is integrated into it. That would be incrementally faster test times. The man page is decent, but was also generated by Claude with only trivial edits by me to date.... But at least there's a man page for it, though neither it nor the script is installed onto the system. Sponsored by: Netflix Assisted-by: Claude Code (Opus 4.6, Opus 4.8(1M) and Sonet 5.0) Differential Revision: https://reviews.freebsd.org/D58008 --- tools/boot/boot-test.json | 97 +++ tools/boot/boot-test.sh | 1677 +++++++++++++++++++++++++++++++++++++++++++++ tools/boot/boot-test.sh.8 | 303 ++++++++ 3 files changed, 2077 insertions(+) diff --git a/tools/boot/boot-test.json b/tools/boot/boot-test.json new file mode 100644 index 000000000000..91beb64e44e6 --- /dev/null +++ b/tools/boot/boot-test.json @@ -0,0 +1,97 @@ +{ + "defaults": { + "byte_order": "little", + "kernconf": "GENERIC", + "timeout": 90, + "caps": [], + "freebsd_version": "15.1", + "netboot_nic": "e1000", + "netboot_subnet_base": "198.18.0.0", + "efi_loaders": ["loader_lua", "loader_4th", "loader_simp", "boot1"] + }, + "arch": { + "amd64": { + "qemu_bin": "qemu-system-x86_64", + "efi_firmware": "/usr/local/share/qemu/edk2-x86_64-code.fd", + "efi_bootname": "bootx64", + "caps": ["bios", "efi", "linuxboot", "zfs", "mbr", "cd", "netboot"], + "bios_loaders": ["lua", "4th", "simp"], + "linux_console": "console=ttyS0,115200", + "target": "amd64", + "target_arch": "amd64", + "netboot_ipxe": "/usr/local/share/ipxe/ipxe.efi-x86_64.usb", + "netboot_efi_vars": "/usr/local/share/qemu/edk2-i386-vars.fd", + "netboot_memdisk": "/usr/local/share/syslinux/bios/memdisk/memdisk", + "hints": "sys/amd64/conf/GENERIC.hints" + }, + "aarch64": { + "qemu_bin": "qemu-system-aarch64", + "qemu_machine": "-machine virt,gic-version=3", + "qemu_extra": "-cpu cortex-a57 -smp 4", + "efi_firmware": "/usr/local/share/qemu/edk2-aarch64-code.fd", + "efi_bootname": "bootaa64", + "caps": ["efi", "linuxboot", "zfs", "netboot"], + "netboot_nic": "virtio-net-device", + "target": "arm64", + "target_arch": "aarch64" + }, + "armv7": { + "qemu_bin": "qemu-system-arm", + "qemu_machine": "-machine virt", + "qemu_extra": "-cpu cortex-a15", + "efi_firmware": "/usr/local/share/qemu/edk2-arm-code.fd", + "efi_bootname": "bootarm", + "caps": ["efi", "netboot"], + "netboot_nic": "virtio-net-device", + "target": "arm", + "target_arch": "armv7" + }, + "riscv64": { + "qemu_bin": "qemu-system-riscv64", + "qemu_machine": "-machine virt", + "qemu_extra": "-bios /usr/local/share/opensbi/lp64/generic/firmware/fw_jump.elf -kernel /usr/local/share/u-boot/u-boot-qemu-riscv64/u-boot.bin", + "efi_bootname": "bootriscv64", + "caps": ["efi", "zfs", "netboot"], + "netboot_nic": "virtio-net-device", + "target": "riscv", + "target_arch": "riscv64" + }, + "powerpc": { + "qemu_bin": "qemu-system-ppc", + "qemu_machine": "-machine mac99,via=pmu", + "qemu_extra": "-vga none -smp 1 -no-reboot", + "byte_order": "big", + "caps": ["ofw", "cd"], + "efi_loaders": [], + "target": "powerpc", + "target_arch": "powerpc", + "freebsd_version": "14.4", + "timeout": 180, + "disabled": true + }, + "powerpc64": { + "qemu_bin": "qemu-system-ppc64", + "qemu_machine": "-machine pseries,cap-hpt-max-page-size=16M", + "qemu_extra": "-vga none -smp 1 -no-reboot", + "byte_order": "big", + "caps": ["prep", "cd"], + "efi_loaders": [], + "target": "powerpc", + "target_arch": "powerpc64", + "kernconf": "GENERIC64", + "timeout": 180 + }, + "powerpc64le": { + "qemu_bin": "qemu-system-ppc64", + "qemu_machine": "-machine pseries,cap-hpt-max-page-size=16M", + "qemu_extra": "-vga none -smp 1 -no-reboot", + "caps": ["prep", "cd", "linuxboot"], + "efi_loaders": [], + "linux_console": "console=hvc0", + "target": "powerpc", + "target_arch": "powerpc64le", + "kernconf": "GENERIC64LE", + "timeout": 180 + } + } +} diff --git a/tools/boot/boot-test.sh b/tools/boot/boot-test.sh new file mode 100755 index 000000000000..5ead7260d781 --- /dev/null +++ b/tools/boot/boot-test.sh @@ -0,0 +1,1677 @@ +#!/bin/sh +# +# boot-test.sh - Automated boot loader regression tests +# +# Builds a minimal bootable tree, assembles disk images for all supported boot +# configurations, then runs each in QEMU with a timeout looking for "SUCCESS". +# +# All tests run as an unprivileged user. No root required, with one exception: +# netboot-bios/netboot-efi need a real tap(4) device + dnsmasq (so DHCP can +# carry a root-path) instead of QEMU's slirp networking, and both creating a tap +# and giving it an address require root. That setup runs once (via sudo, +# prompting interactively) and is left running -- later runs detect the existing +# setup and skip sudo entirely. Assumes buildworld and buildkernel have already +# been done for the target architecture. +# +# Usage: +# cd /usr/src/stand && sh ../tools/boot/boot-test.sh [options] +# +# Options: +# -a ARCH Architecture to test; repeat -a to test several +# (default: host arch) +# Supported: amd64, aarch64, armv7, riscv64, powerpc, powerpc64, +# powerpc64le +# -A Test every supported architecture +# -b Skip build/install phase (reuse existing tree) +# -B Skip build/install and image creation (reuse existing images) +# -l Tell us the log directory and exit +# -j JOBS Max parallel QEMU instances (default: unlimited) +# -o DIR Output directory for images and logs +# -t REGEX Only run tests matching REGEX +# -T SECONDS QEMU timeout (default: per-arch, 60; 180 for powerpc64) +# --netboot-teardown +# Destroy the tap(4)/dnsmasq netboot setup (run with sudo) + +set -e + +die() { + echo "FATAL: $*" >&2 + exit 1 +} + +# FreeBSD port package (origin) that provides a command or file; "" = base +# system. +pkg_for() { + case "$1" in + jq) echo textproc/jq ;; + expect) echo lang/expect ;; + qemu-system-*) echo emulators/qemu ;; + *ipxe*) echo sysutils/ipxe ;; + *syslinux*|*memdisk*) echo sysutils/syslinux ;; + *edk2*) echo emulators/qemu ;; # edk2-*.fd ship with qemu + *) echo "" ;; # makefs/mkimg etc. = base + esac +} + +# Hard requirement: a command that must be in PATH, else abort naming the pkg. +need_cmd() { + which "$1" >/dev/null 2>&1 && return 0 + p=$(pkg_for "$1") + [ -n "${p}" ] && die "$1 not found; install with: pkg install ${p##*/}" + die "$1 not found (expected in the base system)" +} + +# Optional requirement: a file for a feature; warn + skip (return 1) if absent. +have_file() { + [ -e "$1" ] && return 0 + p=$(pkg_for "$1") + echo " WARNING: $1 missing${p:+; pkg install ${p##*/}} -- skipping" >&2 + return 1 +} + +# -------------------------------------------------------------------------- +# Architecture configuration +# +# Per-arch parameters live in boot-test.json, as an arch object merged over a +# "defaults" object. Arrays are expanded to a space separated list. Missing +# values default to an empty string. ARCH_CAPS is a cached copy of the +# capabilities array for the architecture. TARGET and TARGET_ARCH are cached due +# to heavy use. Other parameters are fetched as needed as their use is +# infrequent. +# -------------------------------------------------------------------------- + +# Test whether the current arch declares a capability, e.g. "has efi". +has() { + case " ${ARCH_CAPS} " in + *" $1 "*) return 0 ;; + esac + return 1 +} + +# Fetch the named parameter for this $ARCH. +param() { + jq -r --arg a "${ARCH}" --arg k "$1" ' + (.defaults + .arch[$a])[$k] as $v + | if ($v | type) == "array" then $v | join(" ") + elif $v == null then "" + else $v end + ' "${CONF}" +} + +# Validate ${ARCH} and cache the parameters that are heavily used in global +# variables. +load_arch_config() { + jq -e --arg a "${ARCH}" '.arch | has($a)' "${CONF}" >/dev/null 2>&1 \ + || die "Unknown architecture: ${ARCH}" + ARCH_CAPS=$(param caps) + TARGET=$(param target) + TARGET_ARCH=$(param target_arch) +} + +# Derive every per-arch value for ${1} into the ARCH_*/TARGET/OUTDIR/... globals. +# Callers isolate architectures via subshells (build) or job backgrounding (run) +# -- both snapshot these globals -- so they never collide across arches, and we +# never have to pass the whole bundle around. +setup_arch_env() { + ARCH=$1 + load_arch_config + TIMEOUT=${TIMEOUT_OVERRIDE:-$(param timeout)} + MK="make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH}" + ARCH_OBJDIR=$(${MK} -v .OBJDIR) + [ -n "${ARCH_OBJDIR}" ] || die "Cannot determine OBJDIR for ${ARCH}" + OUTDIR=${OUTDIR_OVERRIDE:-${ARCH_OBJDIR}/boot-test} + IMGDIR=${OUTDIR}/images + LOGDIR=${OUTDIR}/logs + DESTDIR=${OUTDIR}/tree + TESTLIST=${OUTDIR}/test-list.txt + mkdir -p ${IMGDIR} ${LOGDIR} +} + +# --- Configuration --- + +SKIP_BUILD=false +SKIP_IMAGES=false +TEST_FILTER="" +MAX_JOBS=0 +OUTDIR_OVERRIDE="" # from -o; only valid with a single arch +TIMEOUT_OVERRIDE="" # from -T; else each arch's param timeout +ARCHES="" # from -a (repeatable) / -A; defaults to $(uname -p) +ALL=false + +# State shared by tap(4)/dnsmasq netboot networking (see netboot_network_setup / +# netboot_helper below). Key off user's ID to allow multiple people to +# run the script at the same time. +NETBOOT_STATE_DIR=${TMPDIR:-/tmp}/boot-test-net.${SUDO_UID:-$(id -u)} + +# --netboot-helper/--netboot-teardown are internal entry points used to run +# privileged setup/teardown via sudo (see netboot_network_setup); they bypass +# normal option parsing and are dispatched once every function is defined, in +# the Main section at the bottom of this script. +NETBOOT_MODE="" +case "$1" in + --netboot-helper) NETBOOT_MODE=helper; NETBOOT_HELPER_PLAN=$2 ;; + --netboot-teardown) NETBOOT_MODE=teardown ;; +esac + +do_report_dirs=false +if [ -z "${NETBOOT_MODE}" ]; then + while getopts "a:AbBlj:o:t:T:" opt; do + case "$opt" in + a) ARCHES="${ARCHES} $OPTARG" ;; + A) ALL=true ;; + b) SKIP_BUILD=true ;; + B) SKIP_BUILD=true; SKIP_IMAGES=true ;; + j) MAX_JOBS="$OPTARG" ;; + l) do_report_dirs=true ;; + o) OUTDIR_OVERRIDE="$OPTARG" ;; + t) TEST_FILTER="$OPTARG" ;; + T) TIMEOUT_OVERRIDE="$OPTARG" ;; + ?) echo "Usage: $0 [-a arch]... | -A] [-b] [-B] [-t regex] [-T secs] [-j jobs] [-o dir]" >&2 + exit 1 ;; + esac + done + + # Resolve the config file next to this script before we cd elsewhere. + CONF="$(cd "$(dirname "$0")" && pwd)/boot-test.json" + [ -f "${CONF}" ] || die "Config file not found: ${CONF}" + + SRCTOP=$(make -v SRCTOP) || die "Run from stand/ directory in a FreeBSD source tree" + cd ${SRCTOP}/stand + + # Build the architecture list from json. Partially supported architectures + # are omitted from -A, but accessible with a direct -a. + if ${ALL}; then + for a in $(jq -r '.arch | keys_unsorted[]' "${CONF}"); do + if [ $(jq ".arch.${a}.disabled" "${CONF}") != "true" ]; then + ARCHES="$ARCHES $a" + fi + done + fi + [ -n "${ARCHES}" ] || ARCHES=$(uname -p) + + # -o names one output directory, so it only makes sense for a single arch. + if [ -n "${OUTDIR_OVERRIDE}" ] && [ $(echo ${ARCHES} | wc -w) -gt 1 ]; then + die "-o cannot be combined with multiple architectures" + fi +fi + +# The smallest FAT32 filesystem is 33292 KB +espsize=33292 + +# Linux kernel version for linuxboot tests +LINUX_VERSION=6.18.2 + +# -------------------------------------------------------------------------- +# QEMU command builders +# +# qemu_base wraps the constant bits -- binary, memory, machine, per-arch extra +# flags, and the -nographic/serial tail -- around the device arguments each +# specific builder passes in (disks, CDs, firmware, bios). +# -------------------------------------------------------------------------- + +qemu_base() { + echo "$(param qemu_bin) -m 1g $(param qemu_machine) $(param qemu_extra) $* -nographic -monitor none -serial stdio" +} + +# -drive for the EFI firmware pflash; empty when the arch has no separate +# firmware (e.g. riscv64's u-boot payload). +qemu_efi_firmware() { + [ -z "$(param efi_firmware)" ] && return 0 + echo "-drive file=$(param efi_firmware),format=raw,if=pflash,readonly=on" +} + +# Custom OpenBIOS cached beside the ISOs, if present (QEMU's bundled one is +# missing fixes we need for now); empty otherwise. +qemu_ofw_bios() { + [ -f "${ISODIR}/openbios-ppc" ] || return 0 + echo "-bios ${ISODIR}/openbios-ppc" +} + +qemu_bios() { qemu_base "-drive file=$1,format=raw"; } +qemu_efi() { qemu_base "$(qemu_efi_firmware) -drive file=$1,format=raw"; } +qemu_bios_cdrom() { qemu_base "-cdrom $1"; } +qemu_efi_cdrom() { qemu_base "$(qemu_efi_firmware) -cdrom $1"; } + +# OFW disk on the default (macio IDE) bus: OpenBIOS aliases it "hd" and +# auto-probes hd:,\\:tbxi for the Apple_Bootstrap (boot1.hfs) partition. +# virtio disks are not reachable as "hd", so OF finds nothing and drops to "0 >". +qemu_ofw() { qemu_base "$(qemu_ofw_bios) -drive file=$1,format=raw"; } +# -boot d boots the (macio IDE) CD-ROM, which OpenBIOS probes cd:,\\:tbxi. +qemu_ofw_cdrom() { qemu_base "$(qemu_ofw_bios) -boot d -cdrom $1"; } + +# pseries PReP disk boot: virtio-blk (vtbd0), matching freebsd-ci; SLOF finds +# the PReP boot partition on it and runs boot1.elf. +qemu_prep() { qemu_base "-drive if=none,file=$1,format=raw,id=hd0 -device virtio-blk,drive=hd0"; } +# pseries CD boot: SLOF boots the El Torito CHRP image; -boot d selects the CD. +qemu_prep_cdrom() { qemu_base "-cdrom $1 -boot d"; } + +# Direct linuxboot: hand the Linux kernel and initrd to QEMU on the command +# line (-kernel/-initrd) rather than off an ESP. Used by platforms with no +# EFI/ESP (e.g. powerpc64le/pseries); the FreeBSD root disk is attached the +# same way as every other test. +qemu_linuxboot() { + extra="-kernel $2 -initrd $3" + [ -n "$(param linux_console)" ] && extra="${extra} -append $(param linux_console)" + qemu_base "${extra} -drive file=$1,format=raw" +} + +# Netboot over $1 -- vmnet(4): dnsmasq owns DHCP/TFTP/root-path, which we use so +# we use tftp, not NFS, for all the files. QEMU's netdev type is still "tap" (it +# treats vmnet(4) and tap(4) identically). $2 = bios|efi (efi adds the pflash +# firmware; bios relies on the NIC's PXE option ROM). +qemu_netboot() { + netif=$1 + fw="" + [ "$2" = efi ] && fw="$(qemu_efi_firmware)" + qemu_base "${fw} -netdev tap,id=net0,ifname=${netif},script=no,downscript=no -device $(param netboot_nic),netdev=net0 -boot n" +} + +# RAM-disk netboot (x86 EFI). Boots iPXE from -hda (edk2's own PXE is disabled +# via fw_cfg); iPXE DHCPs, fetches the bootfile (an iPXE script) over TFTP, and +# chains loader.efi with memdisk=. The loader downloads that image and +# boots it entirely from RAM -- no NFS and no DHCP root-path needed. Mirrors +# ~/memdisk/do-memddisk-efi. ${OUTDIR}/netboot-vars.fd is a writable edk2 vars +# copy made by assemble_netboot. +# +# We'll need to to http boots in the future, and that will likely require +# we don't use the ipxe USB path we use here. We use that because Tianocore +# expects http/https booting when the obvious '-boot n' sort of things +# are used. +qemu_netboot_ramdisk() { + netif=$1 + echo "$(param qemu_bin) -M q35 -cpu max -m 2g \ + -drive if=pflash,format=raw,readonly=on,file=$(param efi_firmware) \ + -drive if=pflash,format=raw,file=${OUTDIR}/netboot-vars.fd \ + -hda ${OUTDIR}/netboot-ipxe.img \ + -device virtio-net,netdev=net0 \ + -netdev tap,id=net0,ifname=${netif},script=no,downscript=no \ + -fw_cfg name=opt/org.tianocore/IPv4PXESupport,string=no \ + -fw_cfg name=opt/org.tianocore/IPv6PXESupport,string=no \ + -nographic -monitor none -serial stdio" +} + +# -------------------------------------------------------------------------- +# Phase 0: Extract minimal userland from release ISO +# -------------------------------------------------------------------------- + +# Binaries needed for a minimal bootable userland. +# Libraries are inferred from these via ldd on the host equivalents. +USERLAND_BINS="sbin/fastboot sbin/halt sbin/init bin/sh sbin/sysctl" + +ISODIR=${HOME}/iso + +find_iso() { + local isotgt=${TARGET} + [ ${TARGET} != ${TARGET_ARCH} ] && isotgt="${isotgt}-${TARGET_ARCH}" + local isoname="${ISODIR}/FreeBSD-$(param freebsd_version)-RELEASE-${isotgt}-disc1.iso.xz" + [ -f "${isoname}" ] && echo "${isoname}" && return + die "No ISO found for ${ARCH}: ${isoname} not found" +} + +install_minimal_userland() { + # Split the declaration from the assignment: `local iso=$(find_iso)` would + # swallow find_iso's exit status (local returns 0), so its die() -- which + # runs in the $() subshell -- would not stop this script. + local iso + iso=$(find_iso) || exit 1 + echo " Extracting minimal userland from release ISO ${iso}..." + + # Determine library paths from host equivalents of our binaries + local host_bins="" + for b in ${USERLAND_BINS}; do + host_bins="${host_bins} /${b}" + done + lib_paths=$(ldd ${host_bins} 2>/dev/null \ + | awk 'NF == 4 { print $3 }' | sort -u) + + # Build the list of paths to extract: binaries + libraries + rtld + local extract_list="" + for b in ${USERLAND_BINS}; do + extract_list="${extract_list} ./${b}" + done + for l in ${lib_paths}; do + extract_list="${extract_list} .${l}" + done + extract_list="${extract_list} ./libexec/ld-elf.so.1" + + # Some architectures (e.g., armv7) need libgcc_s.so.1 even though the host + # binaries don't. Always try to extract it. We'll ignore it if not there. + extract_list="${extract_list} ./lib/libgcc_s.so.1" + + # Extract the files from the tarball. + tar -C ${DESTDIR} -xf ${iso} ${extract_list} \ + >> ${LOGDIR}/installuserland.log 2>&1 || true +} + +# -------------------------------------------------------------------------- +# Phase 1: Build the boot tree +# -------------------------------------------------------------------------- + +build_tree() { + echo "=== Phase 1: Building boot tree ===" + + rm -rf ${DESTDIR} + mkdir -p ${DESTDIR}/boot/defaults + mkdir -p ${DESTDIR}/boot/kernel + mkdir -p ${DESTDIR}/boot/uboot + mkdir -p ${DESTDIR}/sbin ${DESTDIR}/bin \ + ${DESTDIR}/lib ${DESTDIR}/libexec \ + ${DESTDIR}/etc ${DESTDIR}/dev + + # Install kernel + # I'd prefer this to be MINIMAL, but GENERIC is needed until I work out what + # different devices we boot from... + (cd ${SRCTOP} && ${MK} installkernel \ + KERNCONF=$(param kernconf) \ + MODULES_OVERRIDE="ufs zfs acl_nfs4 crypto zlib cd9660" \ + DESTDIR=${DESTDIR} \ + MK_KERNEL_SYMBOLS=no \ + MK_INSTALL_AS_USER=yes) > ${LOGDIR}/installkernel.log 2>&1 \ + || die "Kernel install failed (see ${LOGDIR}/installkernel.log)" + + # Install boot loaders + ${MK} buildenv \ + DESTDIR=${DESTDIR} \ + MK_MAN=no \ + MK_INSTALL_AS_USER=yes \ + MK_DEBUG_FILES=no \ + BUILDENV_SHELL="make all install" \ + >> ${LOGDIR}/installloader.log 2>&1 \ + || die "Boot loader install failed (see ${LOGDIR}/installloader.log)" + + # Install minimal userland (works for both native and cross builds) + install_minimal_userland + + # Remove default loader symlinks -- we add them back per-image via + # mtree overlays to test each loader variant individually. + # /boot/loader is the BIOS stage-3 (amd64 only). + # /boot/loader.efi is what boot1.efi chainloads (all EFI platforms). + # OFW/PReP are the exception: their /boot/loader is the one real loader + # (no lua/4th/simp variants are built), chainloaded by boot1.hfs (mac99) + # or boot1.elf (pseries PReP), so keep it in the tree. + has ofw || has prep || rm -f ${DESTDIR}/boot/loader + rm -f ${DESTDIR}/boot/loader.efi + + # Serial console configuration. boot.config is consumed only by the + # BIOS boot blocks; its -h/-D/-S flags are meaningless on EFI/OFW, so + # only write it where BIOS booting is supported. + if has bios; then + echo -h -D -S115200 > ${DESTDIR}/boot.config + fi + # Unified loader.conf: always load ufs, zfs, and cd9660 + cat > ${DESTDIR}/boot/loader.conf < ${DESTDIR}/etc/rc <<'RCEOF' +#!/bin/sh + +sysctl machdep.bootmethod +echo "RC COMMAND RUNNING -- SUCCESS!!!!!" +halt -p +RCEOF + chmod +x ${DESTDIR}/etc/rc + + # Create fstab used by UFS mtree overlays + cat > ${OUTDIR}/fstab.ufs < ${OUTDIR}/fstab.cd < ${mt} + # BIOS: /boot/loader -> loader_ + if [ -n "$(param bios_loaders)" ]; then + echo "./boot/loader type=file mode=0644 contents=${DESTDIR}/boot/loader_${variant}" >> ${mt} + fi + # OFW: boot1.hfs chainloads the single /boot/loader already in the + # tree (no per-variant overlay needed). + # EFI: /boot/loader.efi -> loader_.efi (needed for boot1.efi chainload) + if has efi; then + echo "./boot/loader.efi type=file mode=0755 contents=${DESTDIR}/boot/loader_${variant}.efi" >> ${mt} + fi + makefs -t ffs -B $(param byte_order) -M 10m -o label=root -o version=2 \ + ${img} ${mt} ${DESTDIR} >> ${LOGDIR}/imagebuild.log 2>&1 + rm -f ${mt} +} + +# Create a ZFS image with a specific loader variant via mtree overlay +make_one_zfs() { + variant=$1 + img=${IMGDIR}/bootable-zfs-${variant}.img + mt=$(mktemp ${OUTDIR}/zfs-mtree.XXXXXX) + + echo " Creating ZFS image with loader_${variant}..." + > ${mt} + # BIOS: /boot/loader -> loader_ + if [ -n "$(param bios_loaders)" ]; then + echo "./boot/loader type=link link=loader_${variant}" >> ${mt} + fi + # OFW: boot1.hfs chainloads the single /boot/loader already in the + # tree (no per-variant overlay needed). + # EFI: /boot/loader.efi -> loader_.efi (needed for boot1.efi chainload) + if has efi; then + echo "./boot/loader.efi type=file mode=0755 contents=${DESTDIR}/boot/loader_${variant}.efi" >> ${mt} + fi + makefs -t zfs -s 100m \ + -o poolname=ztestroot -o bootfs=ztestroot -o rootpath=/ \ + ${img} ${mt} ${DESTDIR} >> ${LOGDIR}/imagebuild.log 2>&1 + rm -f ${mt} +} + +# Create an ESP with the given EFI loader using an mtree spec +make_one_esp() { + loader_name=$1 + esp=${IMGDIR}/${loader_name}.esp + mt=$(mktemp ${OUTDIR}/esp-mtree.XXXXXX) + + echo " Creating ESP with ${loader_name}.efi..." + cat > ${mt} <> ${LOGDIR}/imagebuild.log 2>&1 + rm -f ${mt} +} + +# Create a small ESP for CD hybrid boot using an mtree spec +make_cd_esp() { + file=$1 + loader=$2 + mt=$(mktemp ${OUTDIR}/cd-esp-mtree.XXXXXX) + + cat > ${mt} <> ${LOGDIR}/imagebuild.log 2>&1 + rm -f ${mt} +} + +# Find the pre-built Linux kernel EFI binary for linuxboot +find_linux_kernel() { + target_arch=$(${MK} -v TARGET_ARCH) + linuxboot_dir=${ARCH_OBJDIR}/../../linuxboot/data/output + + # amd64 has .efi suffix, others don't + for f in \ + ${linuxboot_dir}/${target_arch}.linux.v${LINUX_VERSION}.efi \ + ${linuxboot_dir}/${target_arch}.linux.v${LINUX_VERSION} \ + ${linuxboot_dir}/${target_arch}.v${LINUX_VERSION}.efi \ + ${linuxboot_dir}/${target_arch}.v${LINUX_VERSION}; do + if [ -f "$f" ]; then + echo "$f" + return + fi + done + return 1 +} + +# Build a linuxboot initrd using tar --format newc with an mtree spec. +# No root/sudo required -- device nodes are written directly into the +# cpio archive via mtree type=char entries. +make_linuxboot_initrd() { + initrd=${IMGDIR}/linuxboot-initrd.cpio.gz + mt=$(mktemp ${OUTDIR}/initrd-mtree.XXXXXX) + + echo " Creating linuxboot initrd..." + + # Build mtree spec for the initrd contents + cat > ${mt} <> ${mt} + done + + # Add loader.help.kboot if present + if [ -f "${DESTDIR}/boot/loader.help.kboot" ]; then + echo "./boot/loader.help.kboot type=file mode=0644 contents=${DESTDIR}/boot/loader.help.kboot" >> ${mt} + fi + + # Create the kboot-specific loader.conf + kboot_conf=$(mktemp ${OUTDIR}/kboot-loader-conf.XXXXXX) + cat > ${kboot_conf} <> ${kboot_conf} <> ${mt} + + # Create the initrd as a gzip-compressed newc cpio archive + tar --format newc -cf - @${mt} 2>> ${LOGDIR}/imagebuild.log | \ + gzip > ${initrd} + + rm -f ${mt} ${kboot_conf} +} + +# Build a linuxboot ESP containing the Linux kernel, initrd, and startup.nsh +make_linuxboot_esp() { + linux_kernel=$1 + esp=${IMGDIR}/linuxboot.esp + mt=$(mktemp ${OUTDIR}/linuxboot-esp-mtree.XXXXXX) + + echo " Creating linuxboot ESP..." + + # Generate startup.nsh + startup=${OUTDIR}/startup.nsh + cat > ${startup} < ${mt} <> ${LOGDIR}/imagebuild.log 2>&1 + rm -f ${mt} +} + +make_base_images() { + echo "=== Phase 2: Creating base filesystem images ===" + + # UFS images - one per BIOS loader variant, plus one for EFI (uses lua) + if [ -n "$(param bios_loaders)" ]; then + for v in $(param bios_loaders); do + make_one_ufs $v + done + else + # EFI-only arches still need one UFS image + make_one_ufs lua + fi + + # ZFS images (if supported) + if has zfs; then + if [ -n "$(param bios_loaders)" ]; then + for v in $(param bios_loaders); do + make_one_zfs $v + done + else + make_one_zfs lua + fi + fi + + # ESP images (if EFI is supported) + if has efi; then + for l in $(param efi_loaders); do + make_one_esp $l + done + fi + + # Linuxboot initrd + ESP (if supported and Linux kernel is available) + if has linuxboot; then + linux_kernel=$(find_linux_kernel) || true + if [ -n "${linux_kernel}" ]; then + make_linuxboot_initrd + # EFI arches chainload the kernel+initrd off an ESP; platforms + # without EFI hand them to QEMU directly (-kernel/-initrd), so + # they need no ESP. + has efi && make_linuxboot_esp ${linux_kernel} + else + echo " WARNING: Linux kernel not found for linuxboot, skipping" + echo " Expected in: ${ARCH_OBJDIR}/../../linuxboot/data/output/" + fi + fi + + echo "Base images created in ${IMGDIR}" +} + +# -------------------------------------------------------------------------- +# Phase 3: Assemble disk images and register tests +# -------------------------------------------------------------------------- + +# Test registration - uses temp files since /bin/sh doesn't have arrays. +# ${TESTLIST} and ${OUTDIR} are set per-arch by setup_arch_env; the list is +# truncated in build_all before each arch's images are (re)assembled. +register_test() { + name=$1 + shift + echo "$*" > ${OUTDIR}/test-cmd-${name}.sh + echo "${name}" >> ${TESTLIST} +} + +# Like register_test, but for tests that need a real tap(4) interface +# (assigned later by netboot_network_setup, once every arch is built) instead +# of QEMU's slirp net. The command is written out now with a placeholder tap +# name; netboot_network_setup patches it in once the tap is assigned. +# ${NETBOOT_PLAN} accumulates across every arch (unlike ${TESTLIST}, it is not +# truncated per-arch), so it must already exist by the time build_all runs -- +# see Main. $5 optionally names a different command builder than the default +# qemu_netboot (e.g. qemu_netboot_ramdisk) -- it's always called as +# "builder __NETBOOT_TAP__ ${fw}", so a non-default builder that doesn't need +# ${fw} just ignores its second arg. +register_netboot_test() { + name=$1 + tftpdir=$2 + bootfile=$3 + fw=$4 + builder=${5:-qemu_netboot} + cmdfile=${OUTDIR}/test-cmd-${name}.sh + echo "$(${builder} __NETBOOT_TAP__ ${fw})" > ${cmdfile} + echo "${name}" >> ${TESTLIST} + echo "${cmdfile} ${tftpdir} ${bootfile}" >> ${NETBOOT_PLAN} +} + +assemble_efi_gpt() { + echo " Assembling EFI+GPT images..." + for loader in $(param efi_loaders); do + esp=${IMGDIR}/${loader}.esp + fstypes="ufs" + has zfs && fstypes="ufs zfs" + for fs in ${fstypes}; do + name="efi-gpt-${fs}-${loader}" + img=${IMGDIR}/${name}.img + + # For EFI, the stage-3 in the filesystem doesn't matter, use lua variant + case ${fs} in + ufs) fsimg=${IMGDIR}/bootable-ufs-lua.img; ptype="freebsd-ufs" ;; + zfs) fsimg=${IMGDIR}/bootable-zfs-lua.img; ptype="freebsd-zfs" ;; + esac + + mkimg -s gpt \ + -p efi:=${esp} \ + -p ${ptype}:=${fsimg} \ + -o ${img} >> ${LOGDIR}/imagebuild.log 2>&1 + + register_test ${name} $(qemu_efi ${img}) + done + done +} + +assemble_efi_mbr() { + echo " Assembling EFI+MBR images..." + for loader in $(param efi_loaders); do + esp=${IMGDIR}/${loader}.esp + name="efi-mbr-ufs-${loader}" + img=${IMGDIR}/${name}.img + ufs=${IMGDIR}/bootable-ufs-lua.img + + mkimg -s bsd -p freebsd-ufs:=${ufs} -o ${img}.s2 >> ${LOGDIR}/imagebuild.log 2>&1 + mkimg -a 1 -s mbr -p efi:=${esp} -p freebsd:=${img}.s2 -o ${img} >> ${LOGDIR}/imagebuild.log 2>&1 + rm -f ${img}.s2 + + register_test ${name} $(qemu_efi ${img}) + done +} + +assemble_bios_gpt() { + echo " Assembling BIOS+GPT images..." + for variant in $(param bios_loaders); do + # UFS + name="bios-gpt-ufs-loader_${variant}" + img=${IMGDIR}/${name}.img + ufs=${IMGDIR}/bootable-ufs-${variant}.img + + mkimg -s gpt -b ${DESTDIR}/boot/pmbr \ + -p freebsd-boot:=${DESTDIR}/boot/gptboot \ + -p freebsd-ufs:=${ufs} \ + -o ${img} >> ${LOGDIR}/imagebuild.log 2>&1 + + register_test ${name} $(qemu_bios ${img}) + + # ZFS + if has zfs; then + name="bios-gpt-zfs-loader_${variant}" + img=${IMGDIR}/${name}.img + zfs=${IMGDIR}/bootable-zfs-${variant}.img + + mkimg -s gpt -b ${DESTDIR}/boot/pmbr \ + -p freebsd-boot:=${DESTDIR}/boot/gptzfsboot \ + -p freebsd-zfs:=${zfs} \ + -o ${img} >> ${LOGDIR}/imagebuild.log 2>&1 + + register_test ${name} $(qemu_bios ${img}) + fi + done +} + +assemble_bios_mbr() { + echo " Assembling BIOS+MBR images..." + for variant in $(param bios_loaders); do + name="bios-mbr-ufs-loader_${variant}" + img=${IMGDIR}/${name}.img + ufs=${IMGDIR}/bootable-ufs-${variant}.img + + mkimg -s bsd -b ${DESTDIR}/boot/boot \ + -p freebsd-ufs:=${ufs} -o ${img}.s1 >> ${LOGDIR}/imagebuild.log 2>&1 + # Note: boot0sio has a longish timeout, and does work but + # takes longer than 30s so we use mbr. + mkimg -a 1 -s mbr -b ${DESTDIR}/boot/mbr \ *** 1182 LINES SKIPPED *** From nobody Sat Jul 11 20:31:56 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 4gyL306KfRz6lbGk for ; Sat, 11 Jul 2026 20:31:56 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyL305tMCz3lTK for ; Sat, 11 Jul 2026 20:31:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783801916; 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=c2QBivWiJeoeu0uNkcoor1c/3PzDl8Cgw3juoWihMn0=; b=L91AfT/EABcCupDek00pa62uCq8dl+Fb57aOeHP2TORv1X6pjyna002L4CYeZMqSeIbjpu ETy2mV8t93gPoymvqSu0/O5BxKCs6DPtK4oj6mcua48lOzsH/Ch4e58T9cfakQO8iBYDPy uvXH6fYVnBErVaXs70DIWSIPUlH7uVWi63L//8RdI04jYZpZdz4fccEtSlW84QoNnJoz5G gxsqGUqs21OqlYADYALncqLBwQ+yYL4KWXGbu1dT7ae8O9sPunTk/AghWJQTzP9vRodrYI ynKF5sQ3xSlC3h5CbAEBa/5wjClKfdOOk1awiOfZPEnESunt5TzJfLktYoYNoQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783801916; a=rsa-sha256; cv=none; b=Nu2WWmPDzrEsoJB55LI/7gTwk5Wo+iKxfjWq3KYbVJXLhYcWg0RSiQAq66qvkzFkolup2i vl4oCDrTQhUN9ubiNlzzcVLrqFvWhZWYGkuxbTbslI52JQRXujEXHwgPsZ9YJ5jEGGh2qB VoLDmlUcVUU3yruZ3Conuhk87Cc9e4k6mRdDB1eb5Gj8qydZvnog5fvLhs5zfjXlFuqd8q tEnpFCj38DkiQGpWSqy9pRaLo+AEXPE5dc6POvnMDRRxlutOQUTbbnRdGvIZqmtSP0O13w wOAO0L1Ah/uxRtw3bm19MpKXE6xuzJsxdtZyziwnB/PEILmXzJ+RwLVVg81Klw== 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=1783801916; 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=c2QBivWiJeoeu0uNkcoor1c/3PzDl8Cgw3juoWihMn0=; b=wOEEIeM6iExdm/FMJxniwfGDN3de+faCY/Bp7MP4tBJr/XN+A1ZQ/vzszQno53btlF23Xg C9inO6nb8CgUkOG4gTTn+NpAwhoTZrwM0nDUNhTS+cWomAYuiqmm4eiadgHiGXh5393qgy ukBwvmquQE5kC5TDf46j2NU1rxT2PITzeNO5hqbBjAbZj0YtFwgNRlPZAZh/XktFYEld5B 37L+XL+JI0RVbn0gB901O9vIF/XLNAw0Hv8hMRuNQdURWaZ/2kFMgkidijDCXqBHHhc10M L5KCQfxW0ItDW7cCGjj9ob5EY3iw35kL4IGha0Bh3t7orqo0WYyT9vHpegbH5A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyL304dSHzwbN for ; Sat, 11 Jul 2026 20:31:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 36d86 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 11 Jul 2026 20:31:56 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 4735ef6196bc - main - zonectl: display conventional zones better during RZ 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: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4735ef6196bcb2802ad7fc7d1b8054a4756d786b Auto-Submitted: auto-generated Date: Sat, 11 Jul 2026 20:31:56 +0000 Message-Id: <6a52a83c.36d86.1305bb35@gitrepo.freebsd.org> The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=4735ef6196bcb2802ad7fc7d1b8054a4756d786b commit 4735ef6196bcb2802ad7fc7d1b8054a4756d786b Author: Alan Somers AuthorDate: 2026-06-09 18:06:13 +0000 Commit: Alan Somers CommitDate: 2026-07-11 20:31:51 +0000 zonectl: display conventional zones better during RZ zonectl's Report Zones subcommand displays a tabular list of zones. A conventional zone's WP column is displayed as 0xffffffffffffffff , the literal value that the HDD reports. But that's too wide for the column, causing the text to be misaligned. It's also not really meaningful, because the Write Pointer isn't really defined for a Conventional zone. Change it to "-1" to fix the text misalignment. MFC after: 2 weeks Sponsored by: ConnectWise Reviewed by: fuz Differential Revision: https://reviews.freebsd.org/D57512 --- usr.sbin/zonectl/zonectl.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/usr.sbin/zonectl/zonectl.c b/usr.sbin/zonectl/zonectl.c index 53e5e6599597..9dc6ddfd1aae 100644 --- a/usr.sbin/zonectl/zonectl.c +++ b/usr.sbin/zonectl/zonectl.c @@ -288,11 +288,22 @@ zonectl_print_rz(struct disk_zone_report *report, zone_output_flags out_flags, for (i = 0; i < report->entries_filled; i++) { entry = &report->entries[i]; - printf("%#*jx, %*ju, %#*jx, ", field_widths[ZONE_FW_START], + printf("%#*jx, %*ju, ", field_widths[ZONE_FW_START], (uintmax_t)entry->zone_start_lba, field_widths[ZONE_FW_LEN], - (uintmax_t)entry->zone_length, field_widths[ZONE_FW_WP], - (uintmax_t)entry->write_pointer_lba); + (uintmax_t)entry->zone_length); + if (entry->write_pointer_lba == 0xffffffffffffffff) { + /* + * This value is reported by HDDs for conventional + * zones. It really means "N/A". Reported it as -1, + * even though it's technically unsigned, to save + * space. + */ + printf("%*d, ", field_widths[ZONE_FW_WP], -1); + } else { + printf("%#*jx, ", field_widths[ZONE_FW_WP], + (uintmax_t)entry->write_pointer_lba); + } switch (entry->zone_type) { case DISK_ZONE_TYPE_CONVENTIONAL: From nobody Sat Jul 11 20:47:25 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 4gyLNy2MTQz6lcKh; Sat, 11 Jul 2026 20:47:30 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyLNy1r4Kz3mQm; Sat, 11 Jul 2026 20:47:30 +0000 (UTC) (envelope-from bz@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783802850; 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: in-reply-to:in-reply-to:references:references; bh=xmVRm2t64fQD6ukKoCfwNP4Oox9WEFW1VMD0lYW1/8o=; b=RFZ4VSZ3qQ7NGo+nazhKE1POf/t0dx1whc5ICnGMs4i6lZ2eXcdFpnuZaCzP+FK/vjJgdn 5uMX3nqAZshgi7MtMigyBR5ALWf1X6E9vliYTJ2X0tsdmHW9lbxL9ufrCwAh9owksee17Q Gj+2eD/LSf+yLpm2fCPYB7AOeSRRb5KUXa34ORnH6BnQuz3fsOmaqfGyKfOj5+J0GpMPT4 ZB5oUkMeMbAHlFHnmLtrWauRaVMV5ycaWL4m4ICY2zCZ9dbMRjqT7B/8vlTYcojjfV271g Y8wVJiNWXuWM7wx3M9eRodsIfVvygPe3I+Pon1xW8SVcEEhH/FwwfYMdPoCisw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783802850; a=rsa-sha256; cv=none; b=NFFiETDZJKetgoN4t7b7I4tNTwuSViv5GvyFIvzcJPiOOPfOBVKy9+0QO6M6Apaj6SAxIm ZJUcY+a1BDGoldFq9ePYpletSJ+/EvDdwoKVfPGjgSr82zZP5f3C5ZgDig9PDsreQ5I4YM TINkwSTgBfo+XptK2vbsrpkPBOdEs2kKLr+hzOEp8aG0j+OVMonShaHBKSxZKuf13fHioo V02K8he7j5jZFSJhSnWYMp0EcYmME8uxkH+UxWU73fFitzR0zTMXe7QTj4xjcEyb55v2uQ DNL6bzweww9PIudkoXAaseTWdN4fkF2/ztoc2gyo5Qlzgs3gQhgPC9yiEHrV/g== 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=1783802850; 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: in-reply-to:in-reply-to:references:references; bh=xmVRm2t64fQD6ukKoCfwNP4Oox9WEFW1VMD0lYW1/8o=; b=fiNRCVwblCLCsQ7VcSEXKWLmp5Oszc6m8+3pShCCgTg1DIMgpdcY4Jv/jmkEKOAtlBNGMU feIDpxTxcOcN+pXNoPlFMJ73bae5JBtINnBtL+/fMGbuRN+hYSl1TZ6f3jexoVHVuw6E6V v2LpgykuCbOb2cQ7nxGveeSn0KFjtfS96bnjcpc1bSl63Gg/UcoCCdZ26SB2Lq02gc697r JeW1n0Z3n73ERR+t5jqYKCrLXn5JfNci09PUoNUnUsrDflkmfg46I0RporAOCur+/5fm3R mgXBBr8J1NV1rxAiohGMgnZS2rF2D1QYFIATRCMm5MF1cNqVOqryUzV0ETYNlA== Received: from mx-01.divo.sbone.de (mx-01.divo.sbone.de [IPv6:2003:a:140a:2200:6:594:fffe:19]) (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 ECDSA (prime256v1) client-digest SHA256) (Client CN "mx-01.divo.sbone.de", Issuer "YE2" (not verified)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gyLNx6rDnzQQ0; Sat, 11 Jul 2026 20:47:29 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by mx-01.divo.sbone.de (Postfix) with ESMTPS id 231B0A64805; Sat, 11 Jul 2026 20:46:59 +0000 (UTC) Received: from content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (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 mail.sbone.de (Postfix) with ESMTPS id E02882D029E9; Sat, 11 Jul 2026 20:47:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) by content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (amavisd-new, port 10024) with ESMTP id IKbqKzM8iurn; Sat, 11 Jul 2026 20:47:26 +0000 (UTC) Received: from nv.t4-02.sbone.de (nv.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:22]) (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 mail.sbone.de (Postfix) with ESMTPSA id D39822D029D8; Sat, 11 Jul 2026 20:47:26 +0000 (UTC) Date: Sat, 11 Jul 2026 20:47:25 +0000 (UTC) From: "Bjoern A. Zeeb" To: Warner Losh cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: dc6c193bb4a6 - main - loader.efi: Add xz decompression In-Reply-To: <6a5299d0.26e5e.70437550@gitrepo.freebsd.org> Message-ID: References: <6a5299d0.26e5e.70437550@gitrepo.freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 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=US-ASCII; format=flowed On Sat, 11 Jul 2026, Warner Losh wrote: > The branch main has been updated by imp: > > URL: https://cgit.FreeBSD.org/src/commit/?id=dc6c193bb4a67e2e9ee97d1e3ac3e2950bd16979 > > commit dc6c193bb4a67e2e9ee97d1e3ac3e2950bd16979 > Author: Warner Losh > AuthorDate: 2026-07-11 14:44:40 +0000 > Commit: Warner Losh > CommitDate: 2026-07-11 19:28:47 +0000 > > loader.efi: Add xz decompression > > We can now decompress .xz compressed memory disks, like > FreeBSD-15.1-RELEASE-amd64-disc1.iso.xz Thank you! Helps me a lot! We need to make sure the .xz is correctly padded if needed: see 4bf34c597c44a2393ac5ec483e9cecac128d8202 > Sponsored by: Netflix > Differential Revision: https://reviews.freebsd.org/D58073 > --- > stand/defs.mk | 5 ++ > stand/efi/loader/Makefile | 2 +- > stand/efi/loader/decompress.c | 101 ++++++++++++++++++++++++++-- > stand/efi/loader/decompress.h | 2 +- > stand/libsa/Makefile | 7 ++ > sys/contrib/xz-embedded/freebsd/xz_config.h | 11 +-- > 6 files changed, 117 insertions(+), 11 deletions(-) -- Bjoern A. Zeeb r15:7 From nobody Sat Jul 11 22:05:22 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 4gyN6p5FhFz6lhBh for ; Sat, 11 Jul 2026 22:05:22 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyN6p4XMnz3wbP for ; Sat, 11 Jul 2026 22:05:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783807522; 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=R4gfh12lmBxBCXuJvA0k232grHqrwpjoQZFobwfzW5U=; b=UM+CCKLnWrwVTqGOEEdYfxlCy/IDaTZqG5chPkQIaShNgWUgalbY/hYrO7G4/nDTwcBakm UQYG2LEetyrW2UhDxYylNdiYBr+i5adBEeBueyq27I3gflCfBdkrMsFsjcpE9VvPBOEH1e YgT+jOJmFLoNS+5XnL63nBWa1YLd6stgpS14TSD+mRfA9Fs9r5j/d6QK2D7VjNsmfLQPpL /0EJeg4qKdwhP5dQrwBYH4MP5BmZLbmMWlCDv4Ap7lZKVbe+6Rj984p7HemLHaXJbC8Z8o 8O6RNLyTZJ/pN6/TsW8FTMZQOTBVudbxJF/vvajdtCFqz4End7kj0qapBtQM3Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783807522; a=rsa-sha256; cv=none; b=YJ50ntwqULyymvK0P4mIzhsxlJjg5WgQPRfS1qAgaFd4s41eXp1vnbsDOCNavMGhwD03GF LSKJ6arannC8u45p/Lrumn3Z+dj/rn0FRt2mhXVYO7V8XmtxXc6mGy0WG8fKS8YcrV8fz+ yn3ZzaZnHA523DGnStVHfSaqMQCOTkQmab8oDm5SLIILbf1Jrlw+OEEv3Iu8uLLs1O2Whl cy1p/xajbHGmGRd4BGlfFllm+sx+7Ob93jcDDqzIjgeVDG8CNMJeFOnUQEtA5f/i4PjFPL ogcYzYr6d2pwUHYw1yBDU8cWVP5j6aayLS7EVC1yqDYHk61svC3rMecZWYusoQ== 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=1783807522; 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=R4gfh12lmBxBCXuJvA0k232grHqrwpjoQZFobwfzW5U=; b=RRIpBhp8xaZx6Wy88culKLSqnGaAhE+2vy6vz7IVRsUiMTRhEpF6l4klczxY3yVN+JDy/q kOTWmYFTCsEZ/ji5TT2bAbPT7xaa5He6jKtS0GX/smf2Q2hwrIkDW9ZEsZ0sapr8n2sXEY gbKsiRI+8AqhXuDu47h3XF0a+gukWqFI6/6u46P8159Rop5sGjUbbydfC06nHRW+YWME96 uiSVpXcKtutQEdYXSrpBCNI799I+QI86zJeOfM02XqAjGOvQ43K9FDo62sggjFGgIRT/y/ 9vQflaR4ewNf8+cKYyFhaVQjeMhDtidcV1jaYoFaxKDXZlaMcPhCz2+UbjlCwg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyN6p3CgMzypF for ; Sat, 11 Jul 2026 22:05:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3f0ce by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 11 Jul 2026 22:05:22 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 8e6e77ec25bc - main - renameat(2): add AT_RENAME_EXCHANGE flag 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8e6e77ec25bc5809500d29bf318a843b40205657 Auto-Submitted: auto-generated Date: Sat, 11 Jul 2026 22:05:22 +0000 Message-Id: <6a52be22.3f0ce.6d0e691e@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8e6e77ec25bc5809500d29bf318a843b40205657 commit 8e6e77ec25bc5809500d29bf318a843b40205657 Author: Konstantin Belousov AuthorDate: 2026-06-18 18:12:01 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-11 22:04:43 +0000 renameat(2): add AT_RENAME_EXCHANGE flag Currently no filesystems support it. Reviewed by: mckusick Discussed with: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57658 --- sys/kern/vfs_syscalls.c | 70 ++++++++++++++++++++++++++++++++++++++++--------- sys/sys/fcntl.h | 2 ++ 2 files changed, 59 insertions(+), 13 deletions(-) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 59d0c9c40927..29d503bbb3fa 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -3752,12 +3752,13 @@ sys_renameat2(struct thread *td, struct renameat2_args *uap) #ifdef MAC static int kern_renameat_mac(struct thread *td, int oldfd, const char *old, int newfd, - const char *new, enum uio_seg pathseg, struct nameidata *fromnd) + const char *new, enum uio_seg pathseg, struct nameidata *fromnd, int op, + int ndflags) { int error; - NDINIT_ATRIGHTS(fromnd, DELETE, LOCKPARENT | LOCKLEAF | AUDITVNODE1, - pathseg, old, oldfd, &cap_renameat_source_rights); + NDINIT_ATRIGHTS(fromnd, op, LOCKPARENT | LOCKLEAF | AUDITVNODE1 | + ndflags, pathseg, old, oldfd, &cap_renameat_source_rights); if ((error = namei(fromnd)) != 0) return (error); error = mac_vnode_check_rename_from(td->td_ucred, fromnd->ni_dvp, @@ -3782,23 +3783,35 @@ kern_renameat(struct thread *td, int oldfd, const char *old, int newfd, struct vnode *tvp, *fvp, *tdvp; struct nameidata fromnd, tond; uint64_t tondflags; - int error; + int error, fndflags, op; short irflag; + bool exchange; - if ((flags & ~(AT_RENAME_NOREPLACE)) != 0) + if ((flags & ~(AT_RENAME_NOREPLACE | AT_RENAME_EXCHANGE)) != 0) + return (EINVAL); + if ((flags & (AT_RENAME_NOREPLACE | AT_RENAME_EXCHANGE)) == + (AT_RENAME_NOREPLACE | AT_RENAME_EXCHANGE)) return (EINVAL); + if ((flags & AT_RENAME_EXCHANGE) != 0) { + op = RENAME; + exchange = true; + } else { + op = DELETE; + exchange = false; + } + fndflags = 0; again: tmp = mp = NULL; bwillwrite(); #ifdef MAC if (mac_vnode_check_rename_from_enabled()) { error = kern_renameat_mac(td, oldfd, old, newfd, new, pathseg, - &fromnd); + &fromnd, op, fndflags); if (error != 0) return (error); } else { #endif - NDINIT_ATRIGHTS(&fromnd, DELETE, WANTPARENT | AUDITVNODE1, + NDINIT_ATRIGHTS(&fromnd, op, WANTPARENT | AUDITVNODE1 | fndflags, pathseg, old, oldfd, &cap_renameat_source_rights); if ((error = namei(&fromnd)) != 0) return (error); @@ -3806,6 +3819,11 @@ again: } #endif fvp = fromnd.ni_vp; + if (exchange && fvp == NULL) { + NDFREE_PNBUF(&fromnd); + vrele(fromnd.ni_dvp); + return (ENOENT); + } tondflags = LOCKPARENT | LOCKLEAF | NOCACHE | AUDITVNODE2; if (fromnd.ni_vp->v_type == VDIR) tondflags |= WILLBEDIR; @@ -3844,6 +3862,29 @@ again: error = EEXIST; goto out; } + if (exchange) { + if (tvp == NULL) { + error = ENOENT; + goto out; + } + if (tvp->v_type == VDIR && fndflags == 0) { + fndflags = WILLBEDIR; +again2: + NDFREE_PNBUF(&fromnd); + vrele(fromnd.ni_dvp); + vrele(fvp); + NDFREE_PNBUF(&tond); + VOP_VPUT_PAIR(tdvp, &tvp, true); + error = sig_intr(); + if (error != 0) + goto out1; + goto again; + } + if (tvp->v_type != VDIR && fndflags != 0) { + fndflags = 0; + goto again2; + } + } error = vn_start_write(fvp, &mp, V_NOWAIT); if (error != 0) { again1: @@ -3886,12 +3927,15 @@ again1: goto out; } if (tvp != NULL) { - if (fvp->v_type == VDIR && tvp->v_type != VDIR) { - error = ENOTDIR; - goto out; - } else if (fvp->v_type != VDIR && tvp->v_type == VDIR) { - error = EISDIR; - goto out; + if (!exchange) { + if (fvp->v_type == VDIR && tvp->v_type != VDIR) { + error = ENOTDIR; + goto out; + } else if (fvp->v_type != VDIR && + tvp->v_type == VDIR) { + error = EISDIR; + goto out; + } } #ifdef CAPABILITIES if (newfd != AT_FDCWD && (tond.ni_resflags & NIRES_ABS) == 0) { diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h index 80cbca4ea753..44f43f745762 100644 --- a/sys/sys/fcntl.h +++ b/sys/sys/fcntl.h @@ -260,7 +260,9 @@ typedef __pid_t pid_t; #define AT_EMPTY_PATH 0x4000 /* Operate on dirfd if path is empty */ #define AT_RENAME_NOREPLACE 0x0001 /* Fail rename if target exists */ +#define AT_RENAME_EXCHANGE 0x0002 /* Atomically exchange 'from' and 'to' */ #define RENAME_NOREPLACE AT_RENAME_NOREPLACE +#define RENAME_EXCHANGE AT_RENAME_EXCHANGE #endif /* __BSD_VISIBLE */ /* From nobody Sat Jul 11 22:05:23 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 4gyN6r1NLmz6lhBl for ; Sat, 11 Jul 2026 22:05:24 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyN6q5MMLz3wbQ for ; Sat, 11 Jul 2026 22:05:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783807523; 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=IA9WGsx9Mv7K+JWEn+b/n4ktenbM70DUByVmT7pOnJk=; b=sma9UEWfj/1RjphN4N089IuYGHz6pWPT3c/PctMrz+Z6BsIBjUUrlPpcdOOv78uUXnTUhW 3hUUHVA24FzKNzKhr8SgBBF7stvFr58riWhiAlFTmIuoDQme/J+1QngVPpMsF1Zxzbn2oo BWnsTVS5cKYChG+x6Ko9FNnnW8aRytyw5KcDM03xMGdRYkpFUTP1dj2uo013+Kj6GmHYmk 5wfsREecMMca3Af80MZyyn/si21R+hJWd5o0WK3bY5/FAVnJGoX25tp1YK6HZiuV9mLlc5 ubX3cXmzHanfnaPE/fgiAlm3iwrNmpA9uKKOh08KN7VnD+c4jEfCcDkzfX4SSg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783807523; a=rsa-sha256; cv=none; b=NaFTPRPOkmVyr7a9ibfa9phAdajDTc53ZGt1A78VR+jlERT0wvfLnJYsw15YFn01t+MjXL b06Lx+MLsqCiBknwgcgKVD/67EgeBZHEyE6c5i7m/9eKEz6XjTJMP6tCHrRwBCVYRdsCrr oZwGfE2+m4P5S0MgcYbuWPVjn3keN537pN/47i+M1TxC/vIblmY4OIuQntYxf0GStbIHNR uQFrmN8gch1U6HwA7zzIMJIsahppB2xZWF+gAoKru3Fx0yuS2egYGDTA8C/oXVFkmKE/Ap uVoWZXv1uqAO6Za5Kfvrwi04x79525bpazFM12lAOV+vlvVwz+Mnml9YQhvtFg== 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=1783807523; 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=IA9WGsx9Mv7K+JWEn+b/n4ktenbM70DUByVmT7pOnJk=; b=Mu9wN8mgOoOg+Rp46NJuPm+VaLOPmoNj+nwF4S/Mw1nbT4W/v5QdznQpYk1EmDG5PcocyA Oi6sWBvIVe+PcJU6XJdtIYKyUlcJzyvOeqAVgouQX4oHUF2d6ZR64XHlVR99RvP55rCltW cD1llZ74v0A6FDwlJ6NRPVpSnwkO0v5ojqJ380e9Y9DTrLf+Ma28J5qMofF+KX+rcbfhHc upezdz8mTYp8rBF7Le1Q/0tWDS1QYvLHAAWctbqjk+y0sMmVMOueZUrcgSIzbqDVDsvHE8 oNHVJz4MAcnxqzJnc58g7yvoPSeOfNMDbx+xDYXJpweQ6NzZ/plutf2/SqR6Mw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyN6q40gPz10Cl for ; Sat, 11 Jul 2026 22:05:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3db61 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 11 Jul 2026 22:05:23 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 3055c47f6024 - main - rename.2: Document AT_RENAME_EXCHANGE 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3055c47f6024b087a90021edb05992304a119827 Auto-Submitted: auto-generated Date: Sat, 11 Jul 2026 22:05:23 +0000 Message-Id: <6a52be23.3db61.2d27335d@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3055c47f6024b087a90021edb05992304a119827 commit 3055c47f6024b087a90021edb05992304a119827 Author: Konstantin Belousov AuthorDate: 2026-06-19 08:40:25 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-11 22:04:43 +0000 rename.2: Document AT_RENAME_EXCHANGE Reviewed by: mckusick Discussed with: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57658 --- lib/libsys/rename.2 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/libsys/rename.2 b/lib/libsys/rename.2 index dbad50edb9a9..2a4729dfc8d0 100644 --- a/lib/libsys/rename.2 +++ b/lib/libsys/rename.2 @@ -143,6 +143,12 @@ and .Fa to exists, the request fails with the error .Er EEXIST . +.It Dv AT_RENAME_EXCHANGE +Atomically exchange the files pointed to by the +.Fa from +and +.Fa to +names. .El .Sh RETURN VALUES .Rv -std rename From nobody Sat Jul 11 22:05:24 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 4gyN6s2FZ9z6lhhj for ; Sat, 11 Jul 2026 22:05:25 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyN6r6Ycxz3x61 for ; Sat, 11 Jul 2026 22:05:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783807524; 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=jhdMtdiguT5UDoM5fSIifjckMeoD3trhFvwIEo7VL+s=; b=VFCR/1Y4BkR4a2wr+8K11L+2iF2lXBACuJ3bLjd5x8YUNvOr1NumVlBYCPak7extN/HUCi KhiYQMhmTV7dwW8yOAqetMRPpWmM7h68ahjqBmf6tV1AW573+MChoSUt7kZVXWZxghKlKO 2f2JlhQfH7zfbN0vRfGMk+ko9q/edXfNTQjYmzjkPNEl47Mlz2nxvpYO1bobslLuTCIsMX 5WHjxlJcVoF7supb8YlkZiD9DMG9MCuYNjglSL2/R64JBdku1EOqShmtlkmWv1DfB37U0B HOkOL0wO39rk57Kz/xH8PJup4QQZcza8oKqcmAUI0CmyoaLp183bLM7c74L4hw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783807524; a=rsa-sha256; cv=none; b=lMNrh6LTPNLTQmaBS70aOtXPCQ0kv+NgRe8KhB0Ajznu3NFKTrRXiruC22C5UQl61OJRbK s+8aNW60+4wbUT2oxgJrrvJmxTLzt/OKVGQx+L+lXQO8V/C+hTOlPk40a9wjdkOkbhxFX3 JR5Lj39CGBzkNN1tQ6hvSXLe13SCE+j00bCQj3xa5A+UP99dpRzIcDtJhYrqyuNWwBs9zZ 5EaKfdL0VMPB+hlpPPqFZdkWvt3iI4KFRRuy6nc8Tkw8ZbDRSsykGFtRH2IOVd52VqwVgr K/Vop+MUVj9MwovSUJIUECjkeGamDuUAYbIb8pUAM662TfIO88PxK6xvKWcNvw== 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=1783807524; 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=jhdMtdiguT5UDoM5fSIifjckMeoD3trhFvwIEo7VL+s=; b=EuYnL/nx9PqKvMxx0xzdRa4NJgj63AspqQkzkhIIRsGUdZOnCu31C9gmE2bJ7Vk+hn0FwI FzHDkyJqDCJiQm9TVhNetN9MSf92I4nEeLmA4cN+Ze11O0L7PRpQwViIROghQy3xhoUSc1 b1/wR02AFHhe64CFVA3SsSs95WPgFSDGOulVjMtjU4eel6YHQMwLrCMBeEcyz2W/kI7iMO caUf891yqALlNUFTwGSEQ/ktP6G+Hclx7tgQ2x0DT84qb1Kio3jmbhTzMBQQtv58MinqBm 9ECWNJxRu0NJyaEKnxfjCXY6PZ2a88tGrCvIJ72A3gjcUrpx/WSe6HDaFpofPg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyN6r4nlZzyXs for ; Sat, 11 Jul 2026 22:05:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3d9ec by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 11 Jul 2026 22:05:24 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 631b8ff9318a - main - tmpfs_rename(): style 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 631b8ff9318a83b985d3a8a790dd0fc1bab9d5cd Auto-Submitted: auto-generated Date: Sat, 11 Jul 2026 22:05:24 +0000 Message-Id: <6a52be24.3d9ec.330e250@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=631b8ff9318a83b985d3a8a790dd0fc1bab9d5cd commit 631b8ff9318a83b985d3a8a790dd0fc1bab9d5cd Author: Konstantin Belousov AuthorDate: 2026-06-19 08:11:18 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-11 22:04:43 +0000 tmpfs_rename(): style Reviewed by: mckusick Discussed with: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57658 --- sys/fs/tmpfs/tmpfs_vnops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 05d8f3e863e8..b635450f205f 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -1104,8 +1104,8 @@ tmpfs_rename(struct vop_rename_args *v) } } - if ((fnode->tn_flags & (NOUNLINK | IMMUTABLE | APPEND)) - || (fdnode->tn_flags & (APPEND | IMMUTABLE))) { + if ((fnode->tn_flags & (NOUNLINK | IMMUTABLE | APPEND)) != 0 || + (fdnode->tn_flags & (APPEND | IMMUTABLE)) != 0) { error = EPERM; goto out_locked; } From nobody Sat Jul 11 22:05:25 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 4gyN6t1Thqz6lhNj for ; Sat, 11 Jul 2026 22:05:26 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyN6s6ty3z3wvl for ; Sat, 11 Jul 2026 22:05:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783807526; 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=VeUQGKfT05uWm40VB7bGo+RwLDsFU379Cvsfrw8ojZk=; b=D/wkmu90zPghxZ1qzEHjl0tH6NH64xQeN/GoXl9y1fP5iUJavtlIgUUgf74QpF+kcA4viz jqnNACD3Y1syQ07TD/FmbSq5yWFxlFX6shtkp8/xVc9DNZnS+ZYkYSGLqQcBalsz509dti rsgUdOplAc6ZvR8HFPbPIaJwLpSMiHMJ/gQEugB8sT9t9NkNtXHFo3qoGXXch7S+01x4Id zXkvfF5CyvlFv/LKB5EDhdwyMVVzY4eyjE6+O6irY7VenxujwKH7jYuRfR61Twkc4LOkFW 6gUle77FYu2f0F4Ou3ieUNsQ2k7dmLOs9SKmgAjj8BScqjQo0EjSb1DWoqTPZw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783807526; a=rsa-sha256; cv=none; b=hXgWtkpoIJ6OeQkaqP6PbfMIV2bBsseCGJQ9s5Y9bW7axrFl2iw9labegl+gNyjNxCTI4M QljjkuOGZ6ELulWO8L86VA7x4p9MT+VkKQ9QwASI7XS4aRFlXYsc8uQftublNHCvHVBOOd IHxfrKrgVserpL9SP+6UZHwmbTwQWC0QbBVJwK1dh2c0Ia7SO2VFfU9dnmQRdA+ttfzISP Hv0zGkNvz77jq1WKMa9nIgZ3kyYyyjsSNjzuTNmn0I0RyYCjadesV9XccpG90bybwewQBz 65ZS1+fN8zWIXyxrlcMwMc6AaCuKTEQRagdtyohKSDlcSX/GzecwzqwGb/g8RQ== 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=1783807526; 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=VeUQGKfT05uWm40VB7bGo+RwLDsFU379Cvsfrw8ojZk=; b=BWQZPouNTaGlOG8BuyIn3nVHdhXQNn1XoHhnNyvr7Y1wjCRpjwc5GM5GvXiLgNykRZEcjj fv0x0WofratjgPI/kNhtDpHgYQ64WAPZ/y9xJqxFnBKBjHe9rURx19YVVVRKlpPOYcVG49 HtE1JmhixjwcGeol3WXjJ6M0+MBH+HDiJuSYlwAV8NaJgN8O171PIh1WIg8uQE0kxMWaCS ScBdr/W5yw02QryFuaYc+q6qLE4sqDKHlkrtADnELg2uNFRrC4hpkA3ia7yER9W1VHovTh IOpQBT+Z0W/kVVxv7i8Y/1iV7Ttdz5Z8IB02cYdtKFtQDQmIIulHb+37/55u7A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyN6s5fHrzypJ for ; Sat, 11 Jul 2026 22:05:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 40016 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 11 Jul 2026 22:05:25 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 5e0b96e728af - main - tmpfs: extract tmpfs_rename_check/set_parent() from tmpfs_rename() 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5e0b96e728af9916ac59d65e37155a95e06c3b5e Auto-Submitted: auto-generated Date: Sat, 11 Jul 2026 22:05:25 +0000 Message-Id: <6a52be25.40016.24568144@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5e0b96e728af9916ac59d65e37155a95e06c3b5e commit 5e0b96e728af9916ac59d65e37155a95e06c3b5e Author: Konstantin Belousov AuthorDate: 2026-06-18 20:01:35 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-11 22:04:43 +0000 tmpfs: extract tmpfs_rename_check/set_parent() from tmpfs_rename() Reviewed by: mckusick Discussed with: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57658 --- sys/fs/tmpfs/tmpfs_vnops.c | 167 ++++++++++++++++++++++++--------------------- 1 file changed, 89 insertions(+), 78 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index b635450f205f..8021e42e7c06 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -962,6 +962,89 @@ releout: return (error); } +static int +tmpfs_rename_check_parent(struct tmpfs_mount *tmp, struct tmpfs_node *fdnode, + struct vnode *fvp, struct tmpfs_node *fnode, struct tmpfs_dirent *de, + struct tmpfs_node *tdnode, struct ucred *tcred) +{ + struct tmpfs_node *n; + int error; + + TMPFS_NODE_LOCK(fnode); + error = tmpfs_access_locked(fvp, fnode, VWRITE, tcred); + TMPFS_NODE_UNLOCK(fnode); + if (error != 0) + return (error); + + /* + * Ensure the target directory is not a child of the + * directory being moved. Otherwise, we'd end up + * with stale nodes. + * + * TMPFS_LOCK guarantees that no nodes are freed while + * traversing the list. Nodes can only be marked as + * removed: tn_parent == NULL. + */ + n = tdnode; + TMPFS_LOCK(tmp); + TMPFS_NODE_LOCK(n); + while (n != n->tn_dir.tn_parent) { + struct tmpfs_node *parent; + + if (n == fnode) { + TMPFS_NODE_UNLOCK(n); + TMPFS_UNLOCK(tmp); + return (EINVAL); + } + parent = n->tn_dir.tn_parent; + TMPFS_NODE_UNLOCK(n); + if (parent == NULL) { + n = NULL; + break; + } + TMPFS_NODE_LOCK(parent); + if (parent->tn_dir.tn_parent == NULL) { + TMPFS_NODE_UNLOCK(parent); + n = NULL; + break; + } + n = parent; + } + TMPFS_UNLOCK(tmp); + if (n == NULL) + return (EINVAL); + + TMPFS_NODE_UNLOCK(n); + + return (0); +} + +static void +tmpfs_rename_set_parent(struct tmpfs_node *fdnode, struct tmpfs_node *fnode, + struct tmpfs_dirent *de, struct tmpfs_node *tdnode) +{ + /* Adjust the parent pointer. */ + TMPFS_VALIDATE_DIR(fnode); + TMPFS_NODE_LOCK(de->td_node); + de->td_node->tn_dir.tn_parent = tdnode; + TMPFS_NODE_UNLOCK(de->td_node); + + /* + * As a result of changing the target of the '..' + * entry, the link count of the source and target + * directories has to be adjusted. + */ + TMPFS_NODE_LOCK(tdnode); + TMPFS_ASSERT_LOCKED(tdnode); + tdnode->tn_links++; + TMPFS_NODE_UNLOCK(tdnode); + + TMPFS_NODE_LOCK(fdnode); + TMPFS_ASSERT_LOCKED(fdnode); + fdnode->tn_links--; + TMPFS_NODE_UNLOCK(fdnode); +} + static int tmpfs_rename(struct vop_rename_args *v) { @@ -1129,86 +1212,14 @@ tmpfs_rename(struct vop_rename_args *v) * In case we are moving a directory, we have to adjust its * parent to point to the new parent. */ - if (de->td_node->tn_type == VDIR) { - struct tmpfs_node *n; - - TMPFS_NODE_LOCK(fnode); - error = tmpfs_access_locked(fvp, fnode, VWRITE, - tcnp->cn_cred); - TMPFS_NODE_UNLOCK(fnode); - if (error) { - if (newname != NULL) - free(newname, M_TMPFSNAME); + if (fnode->tn_type == VDIR) { + error = tmpfs_rename_check_parent(tmp, fdnode, fvp, + fnode, de, tdnode, tcnp->cn_cred); + if (error != 0) { + free(newname, M_TMPFSNAME); goto out_locked; } - - /* - * Ensure the target directory is not a child of the - * directory being moved. Otherwise, we'd end up - * with stale nodes. - */ - n = tdnode; - /* - * TMPFS_LOCK guaranties that no nodes are freed while - * traversing the list. Nodes can only be marked as - * removed: tn_parent == NULL. - */ - TMPFS_LOCK(tmp); - TMPFS_NODE_LOCK(n); - while (n != n->tn_dir.tn_parent) { - struct tmpfs_node *parent; - - if (n == fnode) { - TMPFS_NODE_UNLOCK(n); - TMPFS_UNLOCK(tmp); - error = EINVAL; - if (newname != NULL) - free(newname, M_TMPFSNAME); - goto out_locked; - } - parent = n->tn_dir.tn_parent; - TMPFS_NODE_UNLOCK(n); - if (parent == NULL) { - n = NULL; - break; - } - TMPFS_NODE_LOCK(parent); - if (parent->tn_dir.tn_parent == NULL) { - TMPFS_NODE_UNLOCK(parent); - n = NULL; - break; - } - n = parent; - } - TMPFS_UNLOCK(tmp); - if (n == NULL) { - error = EINVAL; - if (newname != NULL) - free(newname, M_TMPFSNAME); - goto out_locked; - } - TMPFS_NODE_UNLOCK(n); - - /* Adjust the parent pointer. */ - TMPFS_VALIDATE_DIR(fnode); - TMPFS_NODE_LOCK(de->td_node); - de->td_node->tn_dir.tn_parent = tdnode; - TMPFS_NODE_UNLOCK(de->td_node); - - /* - * As a result of changing the target of the '..' - * entry, the link count of the source and target - * directories has to be adjusted. - */ - TMPFS_NODE_LOCK(tdnode); - TMPFS_ASSERT_LOCKED(tdnode); - tdnode->tn_links++; - TMPFS_NODE_UNLOCK(tdnode); - - TMPFS_NODE_LOCK(fdnode); - TMPFS_ASSERT_LOCKED(fdnode); - fdnode->tn_links--; - TMPFS_NODE_UNLOCK(fdnode); + tmpfs_rename_set_parent(fdnode, fnode, de, tdnode); } } From nobody Sat Jul 11 22:05:26 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 4gyN6v3Yz2z6lhfW for ; Sat, 11 Jul 2026 22:05:27 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyN6v13JMz3x1j for ; Sat, 11 Jul 2026 22:05:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783807527; 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=D68bMfmhslPwMdKLxJONCiCB545Lg50N/pDX7HgVY/Y=; b=Lhl4+/FQLmWU9DGIpOoIcJdpLMQ3V+J0lxt+/TGNBHDNF3IywYIaNUYiGX7NWTAXAwysq7 OxOBXZ+UWjWdchYuJKWDH/eneucsy448pE3EmOY0y3QUWYaTqshWv4MxPxltn+OGv9HJ/C Uy/YmVWrDyo1vbCHl3y6XRmniqwNtetyKyemv+EiyabxumcYYOi6LISLIH4tNKFGzGlCB5 wiONZ8zgbwWs2haZdz5vCzfHntfQEaQrACFNWc+AjWSTdXZFNbJH9d8robLjLCuAa1SzRW ZlM3rh8BRNeRqnSEBc6zN1bOxRjNULaaTeBB9AmAW3FlbjShWnE0BK5BBDYdQA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783807527; a=rsa-sha256; cv=none; b=qvr9RJ5pG5CLXUSPs+ZcG4PVpbH9iJWNz+X5+bLiPyCqOGW/mWyr1BaZCaqiBqEVsRNTgL l7k68lLm6nJHf/lY/DLu58xHBpe7tIgcoKNMlh3ckRxpRWCZZlK8fh6Lo07sEGq5CmGvJd j8/P6t/cbQrf3q+wRy83GF70ujO28RqyJluXmVpidoNOrQzgRXQumlUCBJeia5obdXb100 GHg/7NkEgbws5zfQMg+UTWjIjFv0gqEYtJc/EKaPrQgsN2m0UW+fY8JZz/E5AONl740ZFz mLmgJnO3sG2RGdMAchA3huDI7fHQM/zKJoivGt9zRgE21Nc/R4KmotaJrMaVnA== 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=1783807527; 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=D68bMfmhslPwMdKLxJONCiCB545Lg50N/pDX7HgVY/Y=; b=ihl/l4X7vnIFb53iH1txbUBeuuqpxUKPTsMCcOBgi6tMpzwZgaxAjgaQ9xshZSIis9WzEN kBF+yZ1Ny4HiHra9ItI0Fk2vrfstTUv5sOTtopnoJznOKceVoKGBY2I0YqcKnV7s9Pw8pZ dl1Hm7NpD1cu0oPP+4fC7XHiq2X7ELJALibfzWCXwRMwQc7EeHmZqjyfuWvmk+ebNMYX+r U9pv/YhAqIl/2R1CCWL/OYt8Sr0Kd1tOxFYJASULnZOsH7ReO9MsPdXiSQWrrv0kX9rVfv nTtkaT4hZJDt+e0x5pzAKBAOWzSwXOyAe9FJ69vMYxTVvhlU2tdoRA26LArYvA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyN6t6SSbzylk for ; Sat, 11 Jul 2026 22:05:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3fa87 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 11 Jul 2026 22:05:26 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 7e06c33151e7 - main - tmpfs: implement AT_RENAME_EXCHANGE 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7e06c33151e7664f6d664ee282d8da1985ce94aa Auto-Submitted: auto-generated Date: Sat, 11 Jul 2026 22:05:26 +0000 Message-Id: <6a52be26.3fa87.74727064@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7e06c33151e7664f6d664ee282d8da1985ce94aa commit 7e06c33151e7664f6d664ee282d8da1985ce94aa Author: Konstantin Belousov AuthorDate: 2026-06-18 18:40:40 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-11 22:04:43 +0000 tmpfs: implement AT_RENAME_EXCHANGE Reviewed by: mckusick Discussed with: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57658 --- sys/fs/tmpfs/tmpfs_vnops.c | 90 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 67 insertions(+), 23 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 8021e42e7c06..fe8507b4936a 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -1055,7 +1055,7 @@ tmpfs_rename(struct vop_rename_args *v) struct vnode *tvp = v->a_tvp; struct componentname *tcnp = v->a_tcnp; char *newname; - struct tmpfs_dirent *de; + struct tmpfs_dirent *de, *tde; struct tmpfs_mount *tmp; struct tmpfs_node *fdnode; struct tmpfs_node *fnode; @@ -1063,8 +1063,11 @@ tmpfs_rename(struct vop_rename_args *v) struct tmpfs_node *tdnode; int error; bool want_seqc_end; + bool exchange; want_seqc_end = false; + newname = NULL; + error = 0; /* * Disallow cross-device renames. @@ -1076,16 +1079,15 @@ tmpfs_rename(struct vop_rename_args *v) goto out; } - if ((v->a_flags & ~(AT_RENAME_NOREPLACE)) != 0) { + if ((v->a_flags & ~(AT_RENAME_NOREPLACE | AT_RENAME_EXCHANGE)) != 0) { error = EOPNOTSUPP; goto out; } /* If source and target are the same file, there is nothing to do. */ - if (fvp == tvp) { - error = 0; + if (fvp == tvp) goto out; - } + exchange = (v->a_flags & AT_RENAME_EXCHANGE) != 0; /* * If we need to move the directory between entries, lock the @@ -1138,6 +1140,8 @@ tmpfs_rename(struct vop_rename_args *v) fdnode = VP_TO_TMPFS_DIR(fdvp); fnode = VP_TO_TMPFS_NODE(fvp); de = tmpfs_dir_lookup(fdnode, fnode, fcnp); + if (exchange) + tde = tmpfs_dir_lookup(tdnode, tnode, tcnp); /* * Entry can disappear before we lock fdvp. @@ -1151,6 +1155,13 @@ tmpfs_rename(struct vop_rename_args *v) goto out_locked; } MPASS(de->td_node == fnode); + if (exchange) { + if (tde == NULL) { + error = ENOENT; + goto out_locked; + } + MPASS(tde->td_node == tnode); + } /* * If re-naming a directory to another preexisting directory @@ -1168,22 +1179,27 @@ tmpfs_rename(struct vop_rename_args *v) goto out_locked; } - if (fnode->tn_type == VDIR && tnode->tn_type == VDIR) { - if (tnode->tn_size != 0 && - ((tcnp->cn_flags & IGNOREWHITEOUT) == 0 || - tnode->tn_size > tnode->tn_dir.tn_wht_size)) { - error = ENOTEMPTY; + if (!exchange) { + if (fnode->tn_type == VDIR && tnode->tn_type == VDIR) { + if (tnode->tn_size != 0 && + ((tcnp->cn_flags & IGNOREWHITEOUT) == 0 || + tnode->tn_size > + tnode->tn_dir.tn_wht_size)) { + error = ENOTEMPTY; + goto out_locked; + } + } else if (fnode->tn_type == VDIR && + tnode->tn_type != VDIR) { + error = ENOTDIR; goto out_locked; + } else if (fnode->tn_type != VDIR && + tnode->tn_type == VDIR) { + error = EISDIR; + goto out_locked; + } else { + MPASS(fnode->tn_type != VDIR && + tnode->tn_type != VDIR); } - } else if (fnode->tn_type == VDIR && tnode->tn_type != VDIR) { - error = ENOTDIR; - goto out_locked; - } else if (fnode->tn_type != VDIR && tnode->tn_type == VDIR) { - error = EISDIR; - goto out_locked; - } else { - MPASS(fnode->tn_type != VDIR && - tnode->tn_type != VDIR); } } @@ -1197,11 +1213,9 @@ tmpfs_rename(struct vop_rename_args *v) * Ensure that we have enough memory to hold the new name, if it * has to be changed. */ - if (fcnp->cn_namelen != tcnp->cn_namelen || - bcmp(fcnp->cn_nameptr, tcnp->cn_nameptr, fcnp->cn_namelen) != 0) { + if (!exchange && (fcnp->cn_namelen != tcnp->cn_namelen || + bcmp(fcnp->cn_nameptr, tcnp->cn_nameptr, fcnp->cn_namelen) != 0)) newname = malloc(tcnp->cn_namelen, M_TMPFSNAME, M_WAITOK); - } else - newname = NULL; /* * If the node is being moved to another directory, we have to do @@ -1219,8 +1233,38 @@ tmpfs_rename(struct vop_rename_args *v) free(newname, M_TMPFSNAME); goto out_locked; } + } + if (exchange && tnode->tn_type == VDIR) { + MPASS(newname == NULL); + error = tmpfs_rename_check_parent(tmp, tdnode, tvp, + tnode, tde, fdnode, fcnp->cn_cred); + if (error != 0) + goto out_locked; + } + if (fnode->tn_type == VDIR) tmpfs_rename_set_parent(fdnode, fnode, de, tdnode); + if (exchange && tnode->tn_type == VDIR) + tmpfs_rename_set_parent(tdnode, tnode, tde, fdnode); + } + if (exchange) { + de->td_node = tnode; + tde->td_node = fnode; + if (tmpfs_use_nc(fvp)) { + cache_purge(fvp); + cache_purge(tvp); + cache_enter(tdvp, fvp, tcnp); + cache_enter(fdvp, tvp, fcnp); + } + fdnode->tn_status |= TMPFS_NODE_MODIFIED | TMPFS_NODE_CHANGED; + fdnode->tn_accessed = true; + tmpfs_update(fdvp); + if (fdvp != tdvp) { + tdnode->tn_status |= TMPFS_NODE_MODIFIED | + TMPFS_NODE_CHANGED; + tdnode->tn_accessed = true; + tmpfs_update(tdvp); } + goto out_locked; } /* From nobody Sun Jul 12 01:17:54 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 4gySP350zsz6kQxy; Sun, 12 Jul 2026 01:17:59 +0000 (UTC) (envelope-from bz@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gySP32hFZz4Fwy; Sun, 12 Jul 2026 01:17:59 +0000 (UTC) (envelope-from bz@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783819079; 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: in-reply-to:in-reply-to:references:references; bh=pCLO0kTTZRtx4PD240yU6SlkMP2AmIUewP2ROhbyMMM=; b=DHC5BMH69aJlZp3IoNhx+murJTKuuHrBPTtczpiT+3odHQsYfBKZbDfxpAVbtjooMBQ8ht sBkA0m5S23sWsCa87T5Gq3W8p/TIEtS9bGnDL68Faa99DvhNSS03ZRUX3v+0zcTCPlcLxA 1JwD9Hl8kWNBJXS0uGyiuF41JDGDDus7vqMhhXJ21Sj45gpDHbEXOfc1DRpMqewx6rtCJM L/XRslGXMJAsL8/68Iem1f2L40kKpx9ufyOBkoXLd3xhJlyTBC8DYUUgL1vjdxI90vh1NQ Ag0ySnH/x/abEczs/4X1CykvJqRw/MzEniuFNY4L717bqUQR2wD5ujdzahsX2A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783819079; a=rsa-sha256; cv=none; b=mjOSAoUTARlqV7sOCvfxtO1fp8yaR+FxwxAFijEZKcV53mQVScOjpoimzIOJs3RXxUT7KE aBZJuST9f+37YxmdWCu1S4Ss7BmXggJQYX2jkrGStoT/apNPAQ58Cgs/0TFtbQFLFI53w7 ck0uzC7bXPkqlHZlV1f7D/BAbL1BUGZZOKu5irvK7J5HqcW0Bg+WHcsuRrW0o2k7a4mtAT QV+vTq6LS+nfXtDipdvGz44FhQ1AI2wSzaemzJAHsZJO/U8FWOtmCqhASLYTz8/945u2x7 RYoM3XXQPxFH9LnrJX+d840zzCIyXF7G+AW+mT6nLYlpWxdmRpeCOSzbLZlEiw== 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=1783819079; 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: in-reply-to:in-reply-to:references:references; bh=pCLO0kTTZRtx4PD240yU6SlkMP2AmIUewP2ROhbyMMM=; b=enDt0UV0jhbQCSUlbnPNrS29NUhUOWi0cEWAp83V0AvQl8UCYLCJ8Jmy2PJdkBX4zMAXjK Z4fR3QjueQuOM6S0uVi8wbGmSYUYCdvoJkZ4TRTv37bDkGyWAQ3dlI7uEuD88lida9ljGt JaPcRApK0TcbFA0NGCR219TnqFzgLgeS7q3qMKOvwClKro4kUMOaE6HHM5Nnm9r8pUmWPP +PY2HYXY1byf3tc4J5+WJh8r1RlNNE+J1jegYvXDKAnc//BR2PLpZf8RnARwjXTFd9JJ3e IixVElWNDd/arSmC+5laNMYdL6zdzAhBP01qlx0swTmcGj1vwL9+a84PH1UlbA== Received: from mx-01.divo.sbone.de (mx-01.divo.sbone.de [IPv6:2003:a:140a:2200:6:594:fffe:19]) (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 ECDSA (prime256v1) client-digest SHA256) (Client CN "mx-01.divo.sbone.de", Issuer "YE2" (not verified)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gySP30gZHzp3r; Sun, 12 Jul 2026 01:17:59 +0000 (UTC) (envelope-from bz@freebsd.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by mx-01.divo.sbone.de (Postfix) with ESMTPS id 2A711A64805; Sun, 12 Jul 2026 01:17:28 +0000 (UTC) Received: from content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (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 mail.sbone.de (Postfix) with ESMTPS id EEB252D029E9; Sun, 12 Jul 2026 01:17:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) by content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (amavisd-new, port 10024) with ESMTP id Qxaxd8XT3mji; Sun, 12 Jul 2026 01:17:55 +0000 (UTC) Received: from nv.t4-02.sbone.de (nv.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:22]) (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 mail.sbone.de (Postfix) with ESMTPSA id AC60B2D029D8; Sun, 12 Jul 2026 01:17:55 +0000 (UTC) Date: Sun, 12 Jul 2026 01:17:54 +0000 (UTC) From: "Bjoern A. Zeeb" To: Warner Losh cc: Warner Losh , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: dc6c193bb4a6 - main - loader.efi: Add xz decompression In-Reply-To: Message-ID: References: <6a5299d0.26e5e.70437550@gitrepo.freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 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: multipart/mixed; boundary="0-201433757-1783819075=:11296" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-201433757-1783819075=:11296 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT On Sat, 11 Jul 2026, Warner Losh wrote: > On Sat, Jul 11, 2026 at 2:47 PM Bjoern A. Zeeb wrote: > >> On Sat, 11 Jul 2026, Warner Losh wrote: >> >>> The branch main has been updated by imp: >>> >>> URL: >> https://cgit.FreeBSD.org/src/commit/?id=dc6c193bb4a67e2e9ee97d1e3ac3e2950bd16979 >>> >>> commit dc6c193bb4a67e2e9ee97d1e3ac3e2950bd16979 >>> Author: Warner Losh >>> AuthorDate: 2026-07-11 14:44:40 +0000 >>> Commit: Warner Losh >>> CommitDate: 2026-07-11 19:28:47 +0000 >>> >>> loader.efi: Add xz decompression >>> >>> We can now decompress .xz compressed memory disks, like >>> FreeBSD-15.1-RELEASE-amd64-disc1.iso.xz >> >> Thank you! Helps me a lot! >> >> We need to make sure the .xz is correctly padded if needed: >> see 4bf34c597c44a2393ac5ec483e9cecac128d8202 >> > > Earlier versions of my xz stuff had an off by one error that would trigger > that warning. But I fixed that so we wouldn't lose the last byte. If there's > still a partial sector at the end, it should be truncated, no? I used to pass a foo.xz file in the past in as an md_image and the foo.xz wasn't properly padded as xz doesn't pad unlike gzip and bzip -- at least that was my understanding, so that file was corrupt when trying to read it. That's what triggered the above commit by kib. What I realize now is that we may now transparently uncompress the xz first and then pass the uncompressed version to md. Is there a way to prevent that? For an mfs_root I would love to have the transparent uncompressions but couldn't so far and that case should be fixed now and will defintiively save me cycles, but for a general purpose other "file" I many not want it to be decompressed just stay there as a read-only copy as-is. /bz -- Bjoern A. Zeeb r15:7 --0-201433757-1783819075=:11296-- From nobody Sun Jul 12 02:04:05 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 4gyTQH1rfjz6kVFZ; Sun, 12 Jul 2026 02:04:07 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyTQG6cJbz4Ngl; Sun, 12 Jul 2026 02:04:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783821846; 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: in-reply-to:in-reply-to:references:references; bh=q5k52zhVwVSVOQMVozF66FVn+LuE8Wzhcilz1DmigDg=; b=ao+/XgtB5pHSvQxYoJ/gDrbrr2hE7Obn67d/JPTBkktJ2cwVj5adZsYLMCFgRrPMfRfFRF IUjZF7brd6m/ZZlXIRZ9+HUgUnOrqFcgfRLtST3my1FL5aZxYLaGa+nxYjQ/30zJa6MnKV vlEWU0OJdzSz1GTOhU4YapRAjg801OO7eXUIlN+C15Y+Xaj2OGSRuQzxRK2A8/eu2CXmfX D/bKytKm7uwymrV833Tb542inT+h6IkzPvSNYPZs++W0mDZRfHxrzaE0gvwewpZ0sVTVah gZcy/CwYNULjnH+SecSv32GSQTqT0zINn07F7FeIqEzk9JDtVeCyzbij0anX9w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783821846; a=rsa-sha256; cv=none; b=vL54XTzuY1UUAFwtfZ8wTGWg39jCz6YjSBG0KCg3rQPt2rQBy52mYKTvrZb6V3WrrHMirM D5k/aXmSAHG/n1pYeMsGI3geysJVs0p7CmQWzCJFAJYNRPRW53lcCYs0jLRrc/Y7GxibUp HCnc8joQq7NzJherWlsaRwobwfjLTY3lpGZXobwhQqBJlxFYjOenYV2ybvW58aIh9OSBRL qBMXjTj9m67QGzExfoPzPuQSoGDTvhcVZji+gvCOH6aUS1cldwRobFB7eIFhOW/Lb6E8C9 bciVyPk696xmIi9fH0SFs2SqYY7UheSZYMtp/4WmOzBQVizAWgZr5G0qCQTwHA== 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=1783821846; 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: in-reply-to:in-reply-to:references:references; bh=q5k52zhVwVSVOQMVozF66FVn+LuE8Wzhcilz1DmigDg=; b=i9481+F1ETeWMTrXiUncxCSbYOlnrukP2ysr9ipvTayHJxIhb0iRrhsqt7C3ub5dNhMdv9 1pC+/QwSxD8V9ZnC4NoH6X9DXw+yroMQtthXlN9KRFHKUMMJfsM65kjobRoEbMiJK9Ot9k hSPnTONnffN0qRW4qQwontBCc6dxSt6cPxQPWhM/lOnbS0oMBGGAuSR8Iex3Ov6MC9CvTM Yte2bhaPKsqrE796LdkaojVexZgOWk95BYT9y4YI2Bvefi9cAR2NRuCrpFAkHtk/J3ltlV Ii2jPEl9hgd2JcqU+27wbxg1SiTLt66SjGekaEVWhqTsD1x6Q6B9FkmrX0/WGQ== Received: from [10.9.4.95] (unknown [209.182.120.176]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: kevans/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gyTQG356ZzqRr; Sun, 12 Jul 2026 02:04:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Message-ID: <26111ffb-259b-40b3-8f3b-2a0faa4bf51a@FreeBSD.org> Date: Sat, 11 Jul 2026 21:04:05 -0500 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 User-Agent: Mozilla Thunderbird Subject: Re: git: dc6c193bb4a6 - main - loader.efi: Add xz decompression To: Warner Losh , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <6a5299d0.26e5e.70437550@gitrepo.freebsd.org> Content-Language: en-US From: Kyle Evans In-Reply-To: <6a5299d0.26e5e.70437550@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 7/11/26 14:30, Warner Losh wrote: > The branch main has been updated by imp: > > URL: https://cgit.FreeBSD.org/src/commit/?id=dc6c193bb4a67e2e9ee97d1e3ac3e2950bd16979 > > commit dc6c193bb4a67e2e9ee97d1e3ac3e2950bd16979 > Author: Warner Losh > AuthorDate: 2026-07-11 14:44:40 +0000 > Commit: Warner Losh > CommitDate: 2026-07-11 19:28:47 +0000 > > loader.efi: Add xz decompression > > We can now decompress .xz compressed memory disks, like > FreeBSD-15.1-RELEASE-amd64-disc1.iso.xz > > Sponsored by: Netflix > Differential Revision: https://reviews.freebsd.org/D58073 > --- > stand/defs.mk | 5 ++ > stand/efi/loader/Makefile | 2 +- > stand/efi/loader/decompress.c | 101 ++++++++++++++++++++++++++-- > stand/efi/loader/decompress.h | 2 +- > stand/libsa/Makefile | 7 ++ > sys/contrib/xz-embedded/freebsd/xz_config.h | 11 +-- > 6 files changed, 117 insertions(+), 11 deletions(-) > [...] > diff --git a/stand/libsa/Makefile b/stand/libsa/Makefile > index a0bc47f343b5..ab7a0f5a59f2 100644 > --- a/stand/libsa/Makefile > +++ b/stand/libsa/Makefile > @@ -110,6 +110,13 @@ SRCS+= ${i} > SRCS+= lz4.c > CFLAGS.lz4.c+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 > > +# xz decompression > +.PATH: ${XZ_DIR}/linux/lib/xz > +.for i in xz_crc32.c xz_crc64.c xz_dec_bcj.c xz_dec_lzma2.c xz_dec_stream.c xz.c > +CFLAGS.${i}+=${XZ_CFLAGS} > +SRCS+= ${i} > +.endfor > + > # io routines > SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c mount.c \ > fstat.c close.c lseek.c open.c read.c write.c readdir.c preload.c xz.c doesn't seem to come from xz-embedded, was it supposed to be added here? This seems to have broken the build. Thanks, Kyle Evans From nobody Sun Jul 12 03:21:35 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 4gyW7j29xCz6kbKJ; Sun, 12 Jul 2026 03:21:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyW7j1bnqz3Fqq; Sun, 12 Jul 2026 03:21:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783826497; 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: in-reply-to:in-reply-to:references:references; bh=6YKiQMqYlo1P0yPqmd2iwfcTCjybPGdtjB15i38WPeU=; b=PVZS6raTh1HXMrXSfQVLUmc6WKSmbYw+FttQ3AZKxnXlwHcVMmSTmLi2L8c5bpD+C/b8oK QUchdqRvOeWsDKZaI+GLS6kv534kk6J8sgHPpWm9vJ+/fhRJGUYDNnh2epKNg78xky82Mk fjbOWUdg8pxqpOBZQzoQFz34CYjziXlnsXUizdzVHuvAj5WK4PwZmdB+lzx8dpHauH3/xi Z4A5z3spYqiqV4/ukaTgBX4rt1QffFo6kEjPEiv82Quh/SoXMq4GE7z/mk7Yn4+5FPKsnf +NJzPghmV+TdWygtu/r1oSCaa8SOy9ybb7bS4Nznz2m9tJvMU3p7WuTf7vD78w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783826497; a=rsa-sha256; cv=none; b=OMknZUSjefeCSRjrC5ixtXnCZvT2QzVBSr7GUfVUYfCmaUlSequndqKLc7nX+zWtjFDZfM VqlgxA9XTXxJkyJ8x/wkoEhx/QVUK51w7734WrPEBHMt6xzNqwBE+HMlDvJnvldt95xiwr MrchRmrUssgyDVZQRzrfMymwpQygxZ7b69zo4LQBJakuBxR6/+XYFXHedsOp+ZVmAY5PXz PKfT8Ld7flZVWGvuiNdRLWGghbaf9/2gs+nObeAnbpQyr2rgseIWRoTOOD4tEh7QKC6OSP IZssQgZrilVzyWibyuD7SKaRc7wB+WvmHHA8Kd3HJYhXKVOc6XADjahDMlKnMQ== 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=1783826497; 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: in-reply-to:in-reply-to:references:references; bh=6YKiQMqYlo1P0yPqmd2iwfcTCjybPGdtjB15i38WPeU=; b=wBEU7+G3+s9jdBCwsJCn+LicadRRmknvZ2auZ5qYkuc1A/c9zLZtUZ2Z4e49oK2Z7LMMe7 38FYCsItz+VjiPBH1NXfsrO5iOlZqqd1EAN/Erzynzndwdcsdo5Yut1v/ZmfblfnjIIVtV GHdZW1Vuhh1Sozly3s90B2y9hJ1Q5pwyD7HRQSBepLrPu/zltZfeDd3yMMx+iOPbs1J+/y aYUlM7X592xum/45KaFaG0Ki0HOGskHJIuI0YUhn6XAjKmXqho/oEW6FHfWEt4tklHZuuH K1X/lidNpurERqqA24aVWrmPi52uKgeU6IurLxktu8FKoAbbTRBzwUjKw0DZaQ== Received: from [10.9.4.95] (unknown [209.182.120.176]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: kevans/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gyW7h4q4Qzqtn; Sun, 12 Jul 2026 03:21:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Message-ID: <49761290-2d6c-403f-acdd-48b5b536804c@FreeBSD.org> Date: Sat, 11 Jul 2026 22:21:35 -0500 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 User-Agent: Mozilla Thunderbird From: Kyle Evans Subject: Re: git: 28d85db46b48 - main - xhci: Do not drop and add bits in xhci To: ShengYi Hung , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <6a1008a0.3f79c.1d455f29@gitrepo.freebsd.org> Content-Language: en-US Cc: Vladimir Kondratyev In-Reply-To: <6a1008a0.3f79c.1d455f29@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/22/26 02:41, ShengYi Hung wrote: > The branch main has been updated by aokblast: > > URL: https://cgit.FreeBSD.org/src/commit/?id=28d85db46b484589e2ee74cf4b270db066821de1 > > commit 28d85db46b484589e2ee74cf4b270db066821de1 > Author: ShengYi Hung > AuthorDate: 2026-05-21 12:49:42 +0000 > Commit: ShengYi Hung > CommitDate: 2026-05-22 07:41:07 +0000 > > xhci: Do not drop and add bits in xhci > > Drop and Add bits reset the data toggle for high-speed devices in XHCI. > The toggle bit represents the sequence number in USB 2.0 transfers. However, > a device can only recognize that the toggle bit has been reset while in > the HALT state. As a result, the host and device toggle values may > become mismatched, causing xHCI to reject the packet. This issue was > observed while testing the EZ-USB FX2 device. > > The transfer may then return to the original value after a > bi-directional TD because the toggle field is only one bit wide. This > explains the reson that we can only receive packets bi-transfer in some > case. Therefore, we do not reset the toggle bit here. > > Reviewed by: adrian > MFC after: 2 weeks > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D57146 > --- > sys/dev/usb/controller/xhci.c | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > Hi, This patch reliably fixes a bug I've been trying to track down in a u2f(4) patch that I've been testing, and I'm wondering if you can help connect the dots. I have a Solo2 u2f(4) key that I find will inconsistently desync (for other reasons) and hang, and the solution for *that* is to release this NOT_YET block[0] in u2f_dtor(). The problem I was hunting down is that doing so subsequently broke my Yubikey in a way that this patch alone seems to fix. It would hang on every other ssh attempt, as long as we issued usbd_transfer_stop on our interrupt endpoints upon last-close. It was known to work with uhid(4) reliably which issues a stop as well, and that's the thing I can't really explain. Is there something that uhid(4) / usb_dev.c is doing that might have accidentally worked around this? This was the only commit that looked relevant in the fast-forward I did for my latest round of testing from 9c18d55a768a3 to 707ee7ff952c5, and reverting just this patch reliably re-introduces the problem I was having with the Yubikey. Thanks, Kyle Evans [0] https://cgit.freebsd.org/src/tree/sys/dev/hid/u2f.c#n303 > diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c > index 3dad0985b39d..b522c5fdc5a3 100644 > --- a/sys/dev/usb/controller/xhci.c > +++ b/sys/dev/usb/controller/xhci.c > @@ -3898,10 +3898,8 @@ xhci_configure_reset_endpoint(struct usb_xfer *xfer) > */ > switch (xhci_get_endpoint_state(udev, epno)) { > case XHCI_EPCTX_0_EPSTATE_DISABLED: > - drop = 0; > - break; > case XHCI_EPCTX_0_EPSTATE_STOPPED: > - drop = 1; > + drop = 0; > break; > case XHCI_EPCTX_0_EPSTATE_HALTED: > err = xhci_cmd_reset_ep(sc, 0, epno, index); > @@ -3910,9 +3908,15 @@ xhci_configure_reset_endpoint(struct usb_xfer *xfer) > DPRINTF("Could not reset endpoint %u\n", epno); > break; > default: > - drop = 1; > + /* > + * xHCI spec 4.6.8: > + * The Drop and Add operation resets the toggle bit, which can > + * cause a toggle mismatch between the device and host. As a > + * result, xHCI may refuse to receive or process the packet. > + */ > err = xhci_cmd_stop_ep(sc, 0, epno, index); > - if (err != 0) > + drop = (err != 0); > + if (drop) > DPRINTF("Could not stop endpoint %u\n", epno); > break; > } > From nobody Sun Jul 12 03:38:09 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 4gyWVq4Yk7z6kc4d; Sun, 12 Jul 2026 03:38:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyWVq0Q0Rz3GN7; Sun, 12 Jul 2026 03:38:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783827491; 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: in-reply-to:in-reply-to:references:references; bh=/jE8F+E3+dztZ17czYoAcUvVhK0iYcVPQ/cKqiE7G2A=; b=qgBfQNdx0tuie5TAlH9Mxh3l5F+muFnJ51tnhDYUC5SP18w3Kbb7uyk7tXtKwey1DCHDu1 2COHAdh1aZyodyrP42VTJaKZjwND+5FA0OqE0IbsG/ymYKlHRRtLYyJNRkPRcrtlt+JKnC kSG4oZ0Il2kCS8SFQPvTgz6PXq23XiMpTHAURmEDgVA0qc/H+s9t/7eZvA8VCjyUQCvMCd y4k2zCV9qpekxaRV5HChGPVyIrjN6+SYYAUhOKqpUch2eyXRX5SF8HlEJwYeURq3msJMZw pxY6dzDcyZQKga5B2hAohgQ/M6Q7JjH1qy87GajHeEqddOhmTOhJVFb7YLZ3Qg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783827491; a=rsa-sha256; cv=none; b=uoZ+3jh3qtqtHQwvuPIWYI1jXSsEBlFp6GKyY+grXETYTY41U4pjky7NFPvGUGR3ZBiIl9 Fn62ml47LE/5SxJD26kQni8fMrq5cgU3wnaMw1bbtsc+S6TwJLyzd/Ly40zs3EI+WvmTYm cGbjQMWhvpayBpUKvOyvq9kWD9v/hC82GlBxpQKYR1/yoJC88MwsiQfmDxVLPOJjNvbyad cndfL2LFh/iBLqqq5IAimKGmrFZkkAsuOkqngBIQKlhPBFjZOys/VO9JPvNhBVSxujq7q+ puxWc8Zhk2AyNx1Uoh9FanI5lPv8B1t0TOI5kws2H7UGTMeN6kns+DTjzog23w== 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=1783827491; 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: in-reply-to:in-reply-to:references:references; bh=/jE8F+E3+dztZ17czYoAcUvVhK0iYcVPQ/cKqiE7G2A=; b=DEY1rvNuR9pqZOE/aFPCn3q9ru1ikx/iRhdq/v0dAZ+RZIzKvWxoD+uWs4o/FmTYGx91Mr bmVWASUlB+nw6UTc/P/WNG03ReozOyiWwHVfYWhjU2ejb8PKE5b9PTJmLW8kyokVOr/Wqd 6NSeBTs4IJYKJTT8KEm6/2NXDPZLz1NJ0qqwv85Fb+rYH+WvM/i1u8Qyg//WysXdhXNbpf rs7Uw4nbQMAMwNff9H0hnWMDVez9BFnG9HL+Q8tU+yww0AtmaSat7a1U13GS/cStEMELhE ojWvHYYCnjm0x46G87GbnwYcPy2oK/3Gllcx86OCG/ALyS/cCGQPblZr8Thrmw== Received: from [10.9.4.95] (unknown [209.182.120.176]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) (Authenticated sender: kevans/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gyWVp3TCtzqWV; Sun, 12 Jul 2026 03:38:10 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Message-ID: Date: Sat, 11 Jul 2026 22:38:09 -0500 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 User-Agent: Mozilla Thunderbird Subject: Re: git: dc6c193bb4a6 - main - loader.efi: Add xz decompression To: Warner Losh Cc: Warner Losh , src-committers , "" , "" References: <6a5299d0.26e5e.70437550@gitrepo.freebsd.org> <26111ffb-259b-40b3-8f3b-2a0faa4bf51a@FreeBSD.org> Content-Language: en-US From: Kyle Evans In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 7/11/26 22:31, Warner Losh wrote: > > > On Sat, Jul 11, 2026, 8:04 PM Kyle Evans > wrote: > > On 7/11/26 14:30, Warner Losh wrote: > > The branch main has been updated by imp: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=dc6c193bb4a67e2e9ee97d1e3ac3e2950bd16979 > > > > commit dc6c193bb4a67e2e9ee97d1e3ac3e2950bd16979 > > Author:     Warner Losh > > AuthorDate: 2026-07-11 14:44:40 +0000 > > Commit:     Warner Losh > > CommitDate: 2026-07-11 19:28:47 +0000 > > > >      loader.efi: Add xz decompression > > > >      We can now decompress .xz compressed memory disks, like > >      FreeBSD-15.1-RELEASE-amd64-disc1.iso.xz > > > >      Sponsored by:           Netflix > >      Differential Revision: https://reviews.freebsd.org/D58073 > > --- > >   stand/defs.mk                                |   5 ++ > >   stand/efi/loader/Makefile                   |   2 +- > >   stand/efi/loader/decompress.c               | 101 ++++++++++++++++++++++++++-- > >   stand/efi/loader/decompress.h               |   2 +- > >   stand/libsa/Makefile                        |   7 ++ > >   sys/contrib/xz-embedded/freebsd/xz_config.h |  11 +-- > >   6 files changed, 117 insertions(+), 11 deletions(-) > > > [...] > > diff --git a/stand/libsa/Makefile b/stand/libsa/Makefile > > index a0bc47f343b5..ab7a0f5a59f2 100644 > > --- a/stand/libsa/Makefile > > +++ b/stand/libsa/Makefile > > @@ -110,6 +110,13 @@ SRCS+=   ${i} > >   SRCS+=      lz4.c > >   CFLAGS.lz4.c+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 > > > > +# xz decompression > > +.PATH: ${XZ_DIR}/linux/lib/xz > > +.for i in xz_crc32.c xz_crc64.c xz_dec_bcj.c xz_dec_lzma2.c xz_dec_stream.c xz.c > > +CFLAGS.${i}+=${XZ_CFLAGS} > > +SRCS+=       ${i} > > +.endfor > > + > >   # io routines > >   SRCS+=      closeall.c dev.c ioctl.c nullfs.c stat.c mount.c \ > >       fstat.c close.c lseek.c open.c read.c write.c readdir.c preload.c > > xz.c doesn't seem to come from xz-embedded, was it supposed to be added here?  This seems to have broken the build. > > > Yes. I did. A later commit fixed it. xz.c is just malloc and free for the stand env. > Hi, Did it get missed in a push? It still seems to be broken as of 7e06c33151e76, and Jenkins seems to agree with that assessment: https://ci.freebsd.org/job/FreeBSD-main-amd64-build/35969/console Thanks, Kyle Evans From nobody Sun Jul 12 03:54:15 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 4gyWsM6v9Cz6kdWl for ; Sun, 12 Jul 2026 03:54:15 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyWsM6612z3JQy for ; Sun, 12 Jul 2026 03:54:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783828455; 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=u5yQXGEiZh7w4zxdJMGOyCiFJPZxV2kX9TTyaauUGN8=; b=wDUVUX9BzfyuRAg+QZgySbHuscdyU2X5xWGg7gX9ziB/7CtQ0vjZQF1oG/1OEXip7DE2CM gONqUiU/JYralkeonRF1vFJGYtUncCaPLsTH8PeIe+wPTogoOWvNExa5sXHbpvrK6zxs9d nnx53GyuWnzeXkmUn4nn2nZLBREXazm5+IQwyv4okVGGSj4QkRWynQeMc3yPj6FkfOGFS/ e8cfhY4HSEZ9ZadM1+wgTh/N73KivT4FX6PtqJkaSQaIXLgtk+NH2qQkohBKaoFhUwA823 ny3G0R3c/h3giVPx0DeATrL4jWmFdiZJO1OlZv1iGZm6AzgFrJU/O+bnGlanDA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783828455; a=rsa-sha256; cv=none; b=xvUgUg8kg/ChY1YxgTsRS9j1pz6an72z9CD/UrzppEW9C7cFYF5JVa8bxArRc/5fsbWGDd beYqPQZAPYXxTFrE+f0I8LIPaptRopb6GFaAsS9/BZCqUr+aGQffAtxf02jriCau8tgrv1 U3DIZIxX8X65KFgfnFYOLHvPwD4LwnyFrjmNrLlMMhXdBjJopmEtX8NOq52HYGQ0a52YYT EKf4JDF8/mFmgjfIYe7BxlvvHHj0MpA4OC4fXBIsSoCCtMmKMdnvz1hUMifepjnGo+Seat ngLpchU2LUDElmpGK+xi/nfDhweo2SU/TM+22+sxH7kxxhBf8WhM0P6qQ/NGfg== 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=1783828455; 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=u5yQXGEiZh7w4zxdJMGOyCiFJPZxV2kX9TTyaauUGN8=; b=adjnk5trZYGveW4fBhCOF7KXv++b2ux+rqCThKEbhqRAzxLCI7eMy6F0RqxqzsCxrhrgiG jpf7wqD1AX51PQ7Bsfsu932PxZa/gILqktMOhT68q4bE/nWG49D0WSvzQBgN/NPnvOOZY/ 1ZeXAiRi6d0g8Xi9NYWifnDuoiFB4gEcjer9QRUfM1Wn7EhD5zyjyE9wohAqiT6b0dewVA YWvComALSzykriogLud5CASsoQB6oZwJPZz037gN3Sbglxv9jgkEvWzbDXE9DcxrxA7BQO QXGyXmuiv3Jccwlzk4cU1yWtUS77EuhyA5ILAMjb5T2BTVDW8zrsWsEq/Rsgyg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyWsM4zDgz1985 for ; Sun, 12 Jul 2026 03:54:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3b651 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 12 Jul 2026 03:54:15 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: df9d6403caa6 - main - loader: Add forgotten xz.c and zstdfs.c 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: df9d6403caa6426e92f5e100602f4d2be474bbae Auto-Submitted: auto-generated Date: Sun, 12 Jul 2026 03:54:15 +0000 Message-Id: <6a530fe7.3b651.2650a09a@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=df9d6403caa6426e92f5e100602f4d2be474bbae commit df9d6403caa6426e92f5e100602f4d2be474bbae Author: Warner Losh AuthorDate: 2026-07-11 20:46:55 +0000 Commit: Warner Losh CommitDate: 2026-07-12 03:53:29 +0000 loader: Add forgotten xz.c and zstdfs.c These were overlooked when I added compression support. Fixes: 86d719ae68aa ("loader: Add xzfs, like gzipfs but with xz.") Fixes: c61ee49cd06a ("loader: zstd based filesystem, zstdfs like gzipfs") Sponsored by: Netflix --- stand/libsa/xz.c | 21 ++++ stand/libsa/zstdfs.c | 308 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 329 insertions(+) diff --git a/stand/libsa/xz.c b/stand/libsa/xz.c new file mode 100644 index 000000000000..ef9b4be1451e --- /dev/null +++ b/stand/libsa/xz.c @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2026 Netflix, Inc. Written by Warner Losh + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include "stand.h" +#include "xz.h" +#include "xz_malloc.h" + +void * +xz_malloc(unsigned long size) +{ + return (malloc(size)); +} + +void +xz_free(void *addr) +{ + free(addr); +} diff --git a/stand/libsa/zstdfs.c b/stand/libsa/zstdfs.c new file mode 100644 index 000000000000..f845ddc70361 --- /dev/null +++ b/stand/libsa/zstdfs.c @@ -0,0 +1,308 @@ +/* + * Copyright (c) 1998 Michael Smith. + * Copyright (c) 2026 Netflix, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Stacked filesystem for .zst compressed files, structured like gzipfs.c and + * bzipfs.c above it. Only built when the zstd decompressor is already being + * pulled into libsa for ZFS (see libsa/Makefile), since that's the only + * source of the ZSTD_* symbols in this environment. + */ + +#include "stand.h" + +#include +#include +#include + +#define ZSTD_BUFSIZE 2048 /* XXX larger? */ + +struct zstd_file +{ + int zstdf_rawfd; + ZSTD_DStream *zstdf_strm; + ZSTD_inBuffer zstdf_in; + unsigned char zstdf_inbuf[ZSTD_BUFSIZE]; + int zstdf_endseen; + off_t zstdf_total_out; +}; + +static int zstdf_fill(struct zstd_file *zstdf); +static int zstdf_open(const char *path, struct open_file *f); +static int zstdf_close(struct open_file *f); +static int zstdf_read(struct open_file *f, void *buf, size_t size, size_t *resid); +static off_t zstdf_seek(struct open_file *f, off_t offset, int where); +static int zstdf_stat(struct open_file *f, struct stat *sb); + +struct fs_ops zstdfs_fsops = { + .fs_name = "zstd", + .fs_flags = 0, + .fo_open = zstdf_open, + .fo_close = zstdf_close, + .fo_read = zstdf_read, + .fo_write = null_write, + .fo_seek = zstdf_seek, + .fo_stat = zstdf_stat, + .fo_readdir = null_readdir, +}; + +static int +zstdf_fill(struct zstd_file *zstdf) +{ + int result; + int avail_in; + int req; + + avail_in = zstdf->zstdf_in.size - zstdf->zstdf_in.pos; + req = ZSTD_BUFSIZE - avail_in; + result = 0; + + /* If we need more */ + if (req > 0) { + /* move old data to bottom of buffer */ + if (avail_in > 0) + bcopy(zstdf->zstdf_inbuf + zstdf->zstdf_in.pos, zstdf->zstdf_inbuf, avail_in); + + /* read to fill buffer and update availibility data */ + result = read(zstdf->zstdf_rawfd, zstdf->zstdf_inbuf + avail_in, req); + zstdf->zstdf_in.src = zstdf->zstdf_inbuf; + zstdf->zstdf_in.pos = 0; + zstdf->zstdf_in.size = avail_in + (result >= 0 ? result : 0); + } + return (result); +} + +static const unsigned char zstd_magic[4] = {0x28, 0xb5, 0x2f, 0xfd}; + +/* + * Peek at the fixed-size zstd frame magic without consuming it, so the + * header remains for ZSTD_decompressStream() to parse normally on the + * first read. + * + * Returns 0 if the header is OK, nonzero if not. + */ +static int +check_header(struct zstd_file *zstdf) +{ + if (zstdf->zstdf_in.size - zstdf->zstdf_in.pos < sizeof(zstd_magic) && + zstdf_fill(zstdf) == -1) + return (1); + if (zstdf->zstdf_in.size - zstdf->zstdf_in.pos < sizeof(zstd_magic)) + return (1); + return (memcmp((const unsigned char *)zstdf->zstdf_in.src + zstdf->zstdf_in.pos, + zstd_magic, sizeof(zstd_magic)) != 0); +} + +static int +zstdf_open(const char *fname, struct open_file *f) +{ + static char *zstdfname; + int rawfd; + struct zstd_file *zstdf; + char *cp; + struct stat sb; + + /* Have to be in "just read it" mode */ + if (f->f_flags != F_READ) + return(EPERM); + + /* If the name already ends in a known compressed suffix, ignore it */ + if ((cp = strrchr(fname, '.')) && (!strcmp(cp, ".gz") + || !strcmp(cp, ".bz2") || !strcmp(cp, ".xz") + || !strcmp(cp, ".zst") || !strcmp(cp, ".split"))) + return(ENOENT); + + /* Construct new name */ + zstdfname = malloc(strlen(fname) + 5); + if (zstdfname == NULL) + return(ENOMEM); + sprintf(zstdfname, "%s.zst", fname); + + /* Try to open the compressed datafile */ + rawfd = open(zstdfname, O_RDONLY); + free(zstdfname); + if (rawfd == -1) + return(ENOENT); + + if (fstat(rawfd, &sb) < 0) { + printf("zstdf_open: stat failed\n"); + close(rawfd); + return(ENOENT); + } + if (!S_ISREG(sb.st_mode)) { + printf("zstdf_open: not a file\n"); + close(rawfd); + return(EISDIR); /* best guess */ + } + + /* Allocate a zstd_file structure, populate it */ + zstdf = malloc(sizeof(struct zstd_file)); + if (zstdf == NULL) { + close(rawfd); + return(ENOMEM); + } + bzero(zstdf, sizeof(struct zstd_file)); + zstdf->zstdf_rawfd = rawfd; + zstdf->zstdf_in.src = zstdf->zstdf_inbuf; + + /* Verify that the file is zstd compressed */ + if (check_header(zstdf)) { + close(zstdf->zstdf_rawfd); + free(zstdf); + return(EFTYPE); + } + + /* Initialise the inflation engine */ + zstdf->zstdf_strm = ZSTD_createDStream(); + if (zstdf->zstdf_strm == NULL) { + close(zstdf->zstdf_rawfd); + free(zstdf); + return(ENOMEM); + } + if (ZSTD_isError(ZSTD_initDStream(zstdf->zstdf_strm))) { + ZSTD_freeDStream(zstdf->zstdf_strm); + close(zstdf->zstdf_rawfd); + free(zstdf); + return(EIO); + } + + /* Looks OK, we'll take it */ + f->f_fsdata = zstdf; + return(0); +} + +static int +zstdf_close(struct open_file *f) +{ + struct zstd_file *zstdf = (struct zstd_file *)f->f_fsdata; + + ZSTD_freeDStream(zstdf->zstdf_strm); + close(zstdf->zstdf_rawfd); + free(zstdf); + return(0); +} + +static int +zstdf_read(struct open_file *f, void *buf, size_t size, size_t *resid) +{ + struct zstd_file *zstdf = (struct zstd_file *)f->f_fsdata; + ZSTD_outBuffer out = { buf, size, 0 }; + size_t ret; + + while (out.pos < out.size && zstdf->zstdf_endseen == 0) { + if ((zstdf->zstdf_in.pos == zstdf->zstdf_in.size) && (zstdf_fill(zstdf) == -1)) { + printf("zstdf_read: fill error\n"); + return(EIO); + } + if (zstdf->zstdf_in.pos == zstdf->zstdf_in.size) { /* oops, unexpected EOF */ + printf("zstdf_read: unexpected EOF\n"); + if (out.pos == 0) + return(EIO); + break; + } + + ret = ZSTD_decompressStream(zstdf->zstdf_strm, &out, &zstdf->zstdf_in); + if (ZSTD_isError(ret)) { /* argh, decompression error */ + printf("zstdf_read: %s\n", ZSTD_getErrorName(ret)); + return(EIO); + } + if (ret == 0) { /* EOF, all done */ + zstdf->zstdf_endseen = 1; + break; + } + } + zstdf->zstdf_total_out += out.pos; + if (resid != NULL) + *resid = out.size - out.pos; + return(0); +} + +static int +zstdf_rewind(struct open_file *f) +{ + struct zstd_file *zstdf = (struct zstd_file *)f->f_fsdata; + + if (lseek(zstdf->zstdf_rawfd, 0, SEEK_SET) == -1) + return(-1); + zstdf->zstdf_in.src = zstdf->zstdf_inbuf; + zstdf->zstdf_in.pos = 0; + zstdf->zstdf_in.size = 0; + zstdf->zstdf_endseen = 0; + zstdf->zstdf_total_out = 0; + if (ZSTD_isError(ZSTD_initDStream(zstdf->zstdf_strm))) + return(-1); + + return(0); +} + +static off_t +zstdf_seek(struct open_file *f, off_t offset, int where) +{ + struct zstd_file *zstdf = (struct zstd_file *)f->f_fsdata; + off_t target; + char discard[16]; + + switch (where) { + case SEEK_SET: + target = offset; + break; + case SEEK_CUR: + target = offset + zstdf->zstdf_total_out; + break; + default: + errno = EINVAL; + return(-1); + } + + /* rewind if required */ + if (target < zstdf->zstdf_total_out && zstdf_rewind(f) != 0) + return(-1); + + /* skip forwards if required */ + while (target > zstdf->zstdf_total_out) { + errno = zstdf_read(f, discard, min(sizeof(discard), + target - zstdf->zstdf_total_out), NULL); + if (errno) + return(-1); + /* Break out of loop if end of file has been reached. */ + if (zstdf->zstdf_endseen) + break; + } + /* This is where we are (be honest if we overshot) */ + return(zstdf->zstdf_total_out); +} + +static int +zstdf_stat(struct open_file *f, struct stat *sb) +{ + struct zstd_file *zstdf = (struct zstd_file *)f->f_fsdata; + int result; + + /* stat as normal, but indicate that size is unknown */ + if ((result = fstat(zstdf->zstdf_rawfd, sb)) == 0) + sb->st_size = -1; + return(result); +} From nobody Sun Jul 12 04:03:46 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 4gyX4N1J6Lz6kdk8; Sun, 12 Jul 2026 04:03:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyX4N0dVXz3KRG; Sun, 12 Jul 2026 04:03:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783829028; 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: in-reply-to:in-reply-to:references:references; bh=po1Fnw5fAIJ/MCfpgSnmi+RWnwGLPGHXiLBG3kqoP6Y=; b=Il+d0S5i+G0HZBsC0VNZs/JSTFOwy1vL2WA/LYDMEr0DUBIu1fi2ynUzz9dD6zxZoNC8ZE fWN8Mr84xDxefrJoTBwXlu8fsEvznz+RX3elsAFZAM1OEBvwmhUgIyZV2vgG26xjudUzc+ oYZwXpj1tFhqOxh+8YRo7B5mFaX8eAcg+qXJXfneFGM+75XeciCg7ENEcu8AKWm5QZrVN7 jTw6tOaZqEVPWHjISlbedfUJjv4fL4Hl7lVe+VktvyYsvvOTpdsPx9w+pj8uOvy6u6QyNH MIWUkSl10HG5uhy3s7oyQWwP7gi419FCCosxKjpx2CW/cUvyEEuuA65eli4ekw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783829028; a=rsa-sha256; cv=none; b=UIQ7oJZPqM1BclJ9idGIFvdT9csa29p6GgkR3wWUSpNmbKK4/I++bb+ehlPbnOa/v7ZkRQ k3vvlEuhRW5eIIbvAP6M8g0ueGV14HrgqR5sUayCtsSFV2NWH+Ty0pCHspKPQ4OpomdBmj Zm3Ft2pKIKIa24RyrBgG299mtw++902U7MYLIuS4wdWQa8teVkDTvBmbTMjMWYCAVWvzrI UrT0QNOW53Tvq3XGAMoLRFcenP9McLubuoFHMeDKH1gupo0gOZViz9LMJrkQ8o40oGswWk ujwlzcq6XQvGN00Pwobm3wCE/7RT3Ntee3XFsAmylI7DGxqtrMjXnt4J61JP6Q== 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=1783829028; 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: in-reply-to:in-reply-to:references:references; bh=po1Fnw5fAIJ/MCfpgSnmi+RWnwGLPGHXiLBG3kqoP6Y=; b=lGlreR7ohUrIlcO80avuqiR7ENF6R6jKWK7pcVzK4N08LdQNbyyU5+gIFkk8Ha1yb1w0I7 cYR7d68wFo30l80ty7pHpAgxICekiN0evV7dB8aMIH9E8m6NAxunc3oWwT0UIh0omMHAhy DI7PapzjSd4ydCWONWt/WQCHk4qXisfqoORMZ1G3O/jZdUMBi2+JxWA7i+Qwrx8GsKJJNS 72KbkQSbGcwitX/rsJsLqkxIW3dUqmotrOtakTxUG//BKcYIIYDA235KtCUCR4kILNYJIe Wy/XVIvp85o71FnY1Z8n1x1JXDuhFj+4rJtHvpgpGfo/yZGKpJem2L1QMH3x9A== Received: from [10.9.4.95] (unknown [209.182.120.176]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: kevans/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gyX4M4431zsMW; Sun, 12 Jul 2026 04:03:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Message-ID: Date: Sat, 11 Jul 2026 23:03:46 -0500 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 User-Agent: Mozilla Thunderbird Subject: Re: git: dc6c193bb4a6 - main - loader.efi: Add xz decompression To: Warner Losh Cc: Warner Losh , src-committers , "" , "" References: <6a5299d0.26e5e.70437550@gitrepo.freebsd.org> <26111ffb-259b-40b3-8f3b-2a0faa4bf51a@FreeBSD.org> Content-Language: en-US From: Kyle Evans In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 7/11/26 22:55, Warner Losh wrote: > > > On Sat, Jul 11, 2026 at 9:38 PM Kyle Evans > wrote: > > On 7/11/26 22:31, Warner Losh wrote: > > > > > > On Sat, Jul 11, 2026, 8:04 PM Kyle Evans >> wrote: > > > >     On 7/11/26 14:30, Warner Losh wrote: > >      > The branch main has been updated by imp: > >      > > >      > URL: https://cgit.FreeBSD.org/src/commit/?id=dc6c193bb4a67e2e9ee97d1e3ac3e2950bd16979 > > >      > > >      > commit dc6c193bb4a67e2e9ee97d1e3ac3e2950bd16979 > >      > Author:     Warner Losh > >      > AuthorDate: 2026-07-11 14:44:40 +0000 > >      > Commit:     Warner Losh > >      > CommitDate: 2026-07-11 19:28:47 +0000 > >      > > >      >      loader.efi: Add xz decompression > >      > > >      >      We can now decompress .xz compressed memory disks, like > >      >      FreeBSD-15.1-RELEASE-amd64-disc1.iso.xz > >      > > >      >      Sponsored by:           Netflix > >      >      Differential Revision: https://reviews.freebsd.org/D58073 > > >      > --- > >      >   stand/defs.mk >                               |   5 ++ > >      >   stand/efi/loader/Makefile                   |   2 +- > >      >   stand/efi/loader/decompress.c               | 101 ++++++++++++++++++++++++++-- > >      >   stand/efi/loader/decompress.h               |   2 +- > >      >   stand/libsa/Makefile                        |   7 ++ > >      >   sys/contrib/xz-embedded/freebsd/xz_config.h |  11 +-- > >      >   6 files changed, 117 insertions(+), 11 deletions(-) > >      > > >     [...] > >      > diff --git a/stand/libsa/Makefile b/stand/libsa/Makefile > >      > index a0bc47f343b5..ab7a0f5a59f2 100644 > >      > --- a/stand/libsa/Makefile > >      > +++ b/stand/libsa/Makefile > >      > @@ -110,6 +110,13 @@ SRCS+=   ${i} > >      >   SRCS+=      lz4.c > >      >   CFLAGS.lz4.c+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 > >      > > >      > +# xz decompression > >      > +.PATH: ${XZ_DIR}/linux/lib/xz > >      > +.for i in xz_crc32.c xz_crc64.c xz_dec_bcj.c xz_dec_lzma2.c xz_dec_stream.c xz.c > >      > +CFLAGS.${i}+=${XZ_CFLAGS} > >      > +SRCS+=       ${i} > >      > +.endfor > >      > + > >      >   # io routines > >      >   SRCS+=      closeall.c dev.c ioctl.c nullfs.c stat.c mount.c \ > >      >       fstat.c close.c lseek.c open.c read.c write.c readdir.c preload.c > > > >     xz.c doesn't seem to come from xz-embedded, was it supposed to be added here?  This seems to have broken the build. > > > > > > Yes. I did. A later commit fixed it. xz.c is just malloc and free for the stand env. > > > > Hi, > > Did it get missed in a push?  It still seems to be broken as of > 7e06c33151e76, and Jenkins seems to agree with that assessment: > > https://ci.freebsd.org/job/FreeBSD-main-amd64-build/35969/console > > > Oh Yes. I did it hours ago, but it looks like it didn't get pushed. df9d6403caa6 fixes it. My > apologies for leaving things broken for so long. > Ah, whoops- thanks! From nobody Sun Jul 12 10:25:35 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 4gyhXv6pHbz6l9mb for ; Sun, 12 Jul 2026 10:25:35 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyhXv6FJYz3Qdt for ; Sun, 12 Jul 2026 10:25:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783851935; 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=RRlSc7QrAznodRvXqMAVbLc6DSm4zHaVKhYG5zRlJ8s=; b=oXHk9nDtW41rvvKtF+GZYo0rYmJ4HCjlooW+n+BVChKsKy8cARE/wG3cA5+DpC1FR+uZuX 95FXIeBqgmoPP1Q4p4/kgbgIuXqLRcgCyfxeBoNegSPy6VtyeE5/xtwGNZ8Wtvzks7gXF1 LmKwKjawIA4GGwZDU17Q0vP7lSimQD3LYpxkYzJecicAqPtaYM38ImWDHxqhjA7dJdhQNt hr8lM36RuZ49qNGneLqyCqj2Q1j8oau6bcsyAPVnm8EO9N2f9ZfwhLgjm7BJECgnGyNAmA IlSCeuKCVBHirCNTmAvCvWK+S0iL7HbVKyIEn6jkt2RoCOppf+d8Cu/gyy0XHQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783851935; a=rsa-sha256; cv=none; b=Lhpoz7S7XQFNjwEJCad95n8EG4fP3bQabDzCnZtatn5ZO2JJjRCA3UYHX9uQcihg+LdoIF 7k9/o+7VFP8MxK+nju47/6cVNH5j3Fnb3+fhaIg+wryQ1/kCkCb8kg139DzYw28lAPZ1Dx mzI3M2yzM6ulsxrvTg/BCYECRUrF9WmgsDLh+urtVR2/S1anjbQpzxvYhW6Har2/mOhahq IFKwzjIAHg3xaNtvBUucu6RcjQJliOH0UOBQL2kMAJfRvAvqnvMU67wDtuz15MnwIgAL+V vjHeWPw2p9hdaJwBBpLkPH6GInRcpHjpCqdh6YgpDB/KKinwhtBrn/A6hc4aEA== 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=1783851935; 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=RRlSc7QrAznodRvXqMAVbLc6DSm4zHaVKhYG5zRlJ8s=; b=HwybETN7+PELJ5+sTjwwjY0zwc/JqFjEjAevgXh9WkywK1iKFhcgEpN1Xw3/4aK+mmNCEO Or+PsetUfu21+ClJO6F5SSi0q1WxIMbH05+8sN8o5T03Vx6O6R+TMyqo69eKKCOUMq4xsd y4o6ih7/aGCaMUWBtlIw+x+mucZz9d4iAGoongkCwmUVl1Zdt8zp616773+9O9o+sItsZ4 7YenoJ7kJ6HVeiCNhfNmqBDl1FSfT4VTxTLZ7UgIaRJNXfCBAnEMyE1g6fzAg4fK+jbm06 0b1GQPMEfAzS6VmRLcvzHCKHWBvC6PzHmkxCnxVEeG83usCaG4oGE90kkyxgsg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyhXv4STsz1Mh6 for ; Sun, 12 Jul 2026 10:25:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3ef4b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 12 Jul 2026 10:25:35 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 62e22d7cfc1c - main - tcp_bblog.4: Add a manual page for TCP Blackbox Logging 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: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 62e22d7cfc1ca1c25bede6aaeca370c163a9a1ef Auto-Submitted: auto-generated Date: Sun, 12 Jul 2026 10:25:35 +0000 Message-Id: <6a536b9f.3ef4b.69164639@gitrepo.freebsd.org> The branch main has been updated by gbe: URL: https://cgit.FreeBSD.org/src/commit/?id=62e22d7cfc1ca1c25bede6aaeca370c163a9a1ef commit 62e22d7cfc1ca1c25bede6aaeca370c163a9a1ef Author: Gordon Bergling AuthorDate: 2026-07-12 10:25:01 +0000 Commit: Gordon Bergling CommitDate: 2026-07-12 10:25:01 +0000 tcp_bblog.4: Add a manual page for TCP Blackbox Logging The tcp_bblog facility provides structured logging of TCP stack activity for debugging and performance analysis. It is implemented in the kernel and allows per-connection tracing of TCP events with low overhead. Reviewed by: tuexen, ziaee MFC after: 1 week Relnotes: yes Differential Revision: https://reviews.freebsd.org/D56252 --- share/man/man4/Makefile | 1 + share/man/man4/tcp_bblog.4 | 147 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 9bee23f1df8f..ab937d5cacee 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -600,6 +600,7 @@ MAN= aac.4 \ tarfs.4 \ targ.4 \ tcp.4 \ + tcp_bblog.4 \ tcp_bbr.4 \ tcp_rack.4 \ tdfx.4 \ diff --git a/share/man/man4/tcp_bblog.4 b/share/man/man4/tcp_bblog.4 new file mode 100644 index 000000000000..37c076dddfc5 --- /dev/null +++ b/share/man/man4/tcp_bblog.4 @@ -0,0 +1,147 @@ +.\" +.\" Copyright (c) 2026, Gordon Bergling +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.Dd July 10, 2026 +.Dt TCP_BBLOG 4 +.Os +.Sh NAME +.Nm tcp_bblog +.Nd TCP Black Box Logging facility +.Sh SYNOPSIS +.Cd options TCP_BLACKBOX +.Sh DESCRIPTION +The +.Nm +facility provides structured logging of TCP stack activity for +debugging and performance analysis. +It is implemented in the kernel and allows per-connection tracing +of TCP events with low overhead. +Each TCP endpoint may maintain an internal log buffer recording +events such as packet transmission, reception, retransmissions, +and state transitions. +Unlike earlier debugging mechanisms, +.Nm +records structured metadata without capturing TCP payload data. +Logs are exported to userland via the device +.Pa /dev/tcp_log . +If no process is actively reading from this device, log records +may be discarded. +Each log entry includes: +.Pp +.Bl -bullet -compact +.It +Connection identifiers, including local and remote addresses and ports +.It +Timestamp information +.It +TCP state and sequence variables +.It +Event-specific metadata +.El +.Pp +Logging may be enabled globally using +.Xr sysctl 8 +or on a per-connection basis using +.Xr setsockopt 2 +or +.Xr tcpsso 8 . +.Sh MODES +The following logging modes are supported: +.Pp +.Bl -tag -width "TCP_LOG_STATE_CONTINUAL" -compact +.It Dv TCP_LOG_STATE_OFF +Disable logging. +.It Dv TCP_LOG_STATE_TAIL +Maintain a ring buffer of recent events. +.It Dv TCP_LOG_STATE_HEAD +Log only the initial events of a connection. +.It Dv TCP_LOG_STATE_HEAD_AUTO +Log initial events and automatically export them. +.It Dv TCP_LOG_STATE_CONTINUAL +Continuously log and export events as buffers fill. +.It Dv TCP_LOG_STATE_TAIL_AUTO +Maintain a tail buffer and export on overflow. +.El +.Sh CONFIGURATION +Global configuration is available via +.Xr sysctl 8 +under the +.Va net.inet.tcp.bb +namespace. +Notable variables include: +.Bl -tag -width "net.inet.tcp.bb.log_session_limit" -compact +.It Va net.inet.tcp.bb.log_auto_all +Enable logging consideration for all TCP connections. +.It Va net.inet.tcp.bb.log_auto_ratio +Select one out of N connections for logging. +.It Va net.inet.tcp.bb.log_auto_mode +Default logging mode applied automatically. +When set to 1 the last net.inet.tcp.bb.log_session_limit entries +are stored at the TCP endpoint. +This is a good way to capture information when debugging TCP +related panics. +.It Va net.inet.tcp.bb.log_session_limit +Maximum number of log entries per connection. +.It Va net.inet.tcp.bb.log_global_limit +Global limit on allocated log entries. +.El +.Sh FILES +.Bl -tag -width "/var/log/tcplog_dumps" -compact +.It Pa /dev/tcp_log +TCP BBLog device interface +.It Pa /var/log/tcplog_dumps +Default directory for stored log output +.El +.Sh EXAMPLES +Enable continual logging for all TCP connections: +.Bd -literal -offset indent +sysctl net.inet.tcp.bb.log_auto_all=1 +sysctl net.inet.tcp.bb.log_auto_ratio=1 +sysctl net.inet.tcp.bb.log_auto_mode=4 +.Ed +.Pp +Enable logging on a specific socket: +.Bd -literal -offset indent +int mode = TCP_LOG_STATE_CONTINUAL; +setsockopt(sd, IPPROTO_TCP, TCP_LOG, &mode, sizeof(mode)); +.Ed +.Sh SEE ALSO +.Xr tcpdump 1 , +.Xr setsockopt 2 , +.Xr tcp 4 , +.Xr sysctl 8 , +.Xr tcpsso 8 +.Rs +.%A "Randall Stewart" +.%A "Michael T\(:uxen" +.%T "Adventures in TCP/IP: TCP Black Box Logging" +.%J "FreeBSD Journal" +.%D "May / June 2024" +.%U "https://freebsdfoundation.org/adventures-in-tcp-ip-tcp-black-box-logging/" +.Re +.Sh HISTORY +The +.Nm +facility first appeared in +.Fx 13.0 +and replaced earlier TCP debugging mechanisms. +.Sh AUTHORS +The +.Nm +facility was written by +.An -nosplit +.An Randall Stewart Aq Mt rrs@freebsd.org +and +.An Jonathan Looney Aq Mt jtl@freebsd.org +and sponsored by Netflix, Inc. +This manual page was written by +.An Gordon Bergling Aq Mt gbe@FreeBSD.org . +.Sh CAVEATS +Log records may be dropped if userland does not drain +.Pa /dev/tcp_log +fast enough. +TCP payload data is not recorded. +.Sh BUGS +Logging may introduce measurable overhead under high connection rates. From nobody Sun Jul 12 14:16:01 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 4gynfn5x97z6lRKT for ; Sun, 12 Jul 2026 14:16:01 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gynfn5M19z3p2b for ; Sun, 12 Jul 2026 14:16:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783865761; 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=ZJYUJ2qh9cOodvDRPGZtrzv5s6VrUssKlGfmvf4n40I=; b=Rw8BQL5bLbGszPcAvOFqbJQszTXLjSny37C77/3QGdMMuKTZU/rwTbn8zzQCe9Jz3A30gR +j0nuay3a6G4VM00Bfez/K9ViFdjH0/uQX9KoyQdx4Di2QI34I2wovhMM2NKI5SVVCHVe1 sJi0Oi+dn5sMB460A62Id6Ut9lsm1VVZ9l6SqcC03QHqx88UqcsfKrnXd94AqdMFnWNA7N YNj2X85xHhqEOzs+/VCFuPpVZq/LKOzYLotnf1fTh5nPEgyND2Rr+CQbZsbuUCW1F8JGaB vxN5PPF9VOJMwHA4u7ix9kDTVGnVc4H6GA/Zyphb+7k+H1VO8XpW9E8tJHmBuQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783865761; a=rsa-sha256; cv=none; b=ozx7HKTr1e6GubRBeqI0o1xJXwT62RvojjM6uBVyYSm8cwABOqMCYTT0XKb94cNOMr9cg8 DKgR/EODisYv5i8LBex4aSvsx/VcuZMuTTi0BQVvBvWJQ7nkhcGJ7I73w5/j5YY7pPMwPc NyOZI2JdzQ+cOYsn/jFHO78kSvQ65yveo75mGu9NPHhImKviGuFWyAW1tZK6r3zloLfuN8 t+UD/GE8ktKZ6eac4zhaf3t8447GPqGEeTEDB26hVVrh4XtlHvxhrnMUE0Mzojn7g/A/U+ bKeCZYlloku1ZWPT3IWMkJ31dMrNC2NaaBiBXzFfw2MOu96ZTn7CCcqG3Q5MKw== 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=1783865761; 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=ZJYUJ2qh9cOodvDRPGZtrzv5s6VrUssKlGfmvf4n40I=; b=b5Ioz9KOaahv3tKGvEcs397YJqwWg9EuB+WNYCxmAekXYxswl0SZHPEsmI/cAnHDTrJ8hE swZ8MYf/dQaqNX+W27XhV3dR2ywK64pJpmAd95/3rwwx/zmxvAen4BUzI2wEImnD51H4HN kuwMnBXTzRoAXdwbCw9I5GvutFNDZlQoMgu/2fOA7xME3ZRnnEed3Dvfe8Kvu8cr9lSe4Q vwBk8T6qSF29NrgGwvCPb2CznSTWXH0LmqC4GOCv618pxzSqoQJeqSnaii6DW6qWOPLXoi sogXU1v0bq4aQs0wOJLe9+x1LH3hjW9hOxh06ukr1vaxHjkq8SX6RfvqNpoxhg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gynfn4RzZz12D for ; Sun, 12 Jul 2026 14:16:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 36dd2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 12 Jul 2026 14:16:01 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: f72cfefae99b - main - Add a few missed files to ObsoleteFiles.inc 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: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f72cfefae99befe47fefc4683cd6957edaaf0e86 Auto-Submitted: auto-generated Date: Sun, 12 Jul 2026 14:16:01 +0000 Message-Id: <6a53a1a1.36dd2.69632087@gitrepo.freebsd.org> The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=f72cfefae99befe47fefc4683cd6957edaaf0e86 commit f72cfefae99befe47fefc4683cd6957edaaf0e86 Author: Dimitry Andric AuthorDate: 2026-07-12 14:15:29 +0000 Commit: Dimitry Andric CommitDate: 2026-07-12 14:15:29 +0000 Add a few missed files to ObsoleteFiles.inc There were still some left-over files under usr/tests/gnu/usr.bin/diff, causing the directory to not be fully removed. Add these to OLD_FILES. Fixes: 134a4c78d070 --- ObsoleteFiles.inc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index ce7ef62c0da9..79c59baf188d 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -58,6 +58,10 @@ OLD_FILES+=usr/tests/sys/kern/sendfile_helper OLD_FILES+=usr/tests/gnu/Kyuafile OLD_FILES+=usr/tests/gnu/lib/Kyuafile OLD_DIRS+=usr/tests/gnu/lib +OLD_FILES+=usr/tests/gnu/usr.bin/diff/d_mallocv1.in +OLD_FILES+=usr/tests/gnu/usr.bin/diff/d_mallocv2.in +OLD_FILES+=usr/tests/gnu/usr.bin/diff/diff_test +OLD_FILES+=usr/tests/gnu/usr.bin/diff/Kyuafile OLD_DIRS+=usr/tests/gnu/usr.bin/diff OLD_FILES+=usr/tests/gnu/usr.bin/Kyuafile OLD_DIRS+=usr/tests/gnu/usr.bin From nobody Sun Jul 12 14:20:45 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 4gynmJ6LrWz6lRSY; Sun, 12 Jul 2026 14:20:48 +0000 (UTC) (envelope-from des@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gynmJ5svsz3pc3; Sun, 12 Jul 2026 14:20:48 +0000 (UTC) (envelope-from des@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783866048; 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: in-reply-to:in-reply-to:references:references; bh=kU5Q6uLV/o8I0OJefp1nNieCQy3sGwPeVnyRHrg2HCw=; b=pfzka+rava48WK2tGeHv9xW/lRA9dxPTEBJ3ECOnjwFREZrlaTMAEopckpMQoM37ojeQ4c QDumNKLFkm6b0OytUT9S4YSAhATPPcLYn6emPO5Vf60edltz9xM637Lj0teBPdgLyQBlyc 5dFVmgC2t8uuSUgfazJl7wdPVbgpvlN1jH0qitDSPzqFFMJmvJ/d1v5eUJpKGemioLoUtt LHhJ4cpkRzTidQ/E55hfmwBNQrkk/tjtGEgqMcmD1sYzCW/31GWAAkoqAYLI4CIL3rf2VL CAu8Dqfjmmdz5BZo0YEFE17SjcIBIbCCJY+FtEoJitSXGi1gMKjWb5qww8xO3w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783866048; a=rsa-sha256; cv=none; b=Whx8Hh9b6tvydAGlR9EqQ5UZTbxsvzJb8h+iUFEWyLYWpchtA4C7RyQ6s4PvM2izvJkG09 mUU8GpLXL0Cmp6FOR8PKdq8/QD/d6wf4kVimV5zj30eQ4MymKj3GYfPXGr2jcoZ0UURMXH I4StgRfrrgTBSAlk1cAeFYIkIKtkotpQYcR13A1f1jQzT3/7td6Ph3b22gAiUVmQn+tPvU Egh1yTLdXEh/ISzJ/+yHmbJQzkgZ+PPdVruL1Nr6wbBrpBvVj29pkrInTN9K71n0QN7H4U Q2qRHH4ozpkJmlQ5ExetVSfCed+uGXhJgALX0Y2+k8/LofpNtWfpbItE8Y4UKQ== 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=1783866048; 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: in-reply-to:in-reply-to:references:references; bh=kU5Q6uLV/o8I0OJefp1nNieCQy3sGwPeVnyRHrg2HCw=; b=qe4C3xbHMb/Lzt+HYN9olSuwYRpUcmaYj9+KuFy+GDFsjL2q9WkfgNgkWMSDGB3ammf6vg ezNXbaJODynmTNvBb3Fy6cq58V0wrEw+dK9Rw8aRWqwu1PbRh7beeGv62cqbppQLRd2COt OJ+8qyOff76yEG9GFhItWvWEy3XaDGVCQ9Fpfg2daLq8N31eDCLGt3zWj7GEPslruGbXfP AT2fg4EQe+1HeFQxaH2I51vJYcUwPHq1c+1HBdxxB2T1ccrE0EkeYj6lhPcoiT9ieRttWB p1bXvAYWQZl24EVskjls17rui4lJfz6JIJWFJxxbErAdJwDYIVG3UXgztTXsog== Received: from ltc.des.dev (2a01cb0585070b00922e16fffef1acef.ipv6.abo.wanadoo.fr [IPv6:2a01:cb05:8507:b00:922e:16ff:fef1:acef]) (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) (Authenticated sender: des/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gynmJ3hcrz14Dv; Sun, 12 Jul 2026 14:20:48 +0000 (UTC) (envelope-from des@freebsd.org) Received: by ltc.des.dev (Postfix, from userid 1001) id BB71C80749; Sun, 12 Jul 2026 16:20:45 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Dimitry Andric Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: f72cfefae99b - main - Add a few missed files to ObsoleteFiles.inc In-Reply-To: <6a53a1a1.36dd2.69632087@gitrepo.freebsd.org> (Dimitry Andric's message of "Sun, 12 Jul 2026 14:16:01 +0000") References: <6a53a1a1.36dd2.69632087@gitrepo.freebsd.org> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Sun, 12 Jul 2026 16:20:45 +0200 Message-ID: <861pd82ssi.fsf@ltc.des.dev> 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: quoted-printable Dimitry Andric writes: > Add a few missed files to ObsoleteFiles.inc >=20=20=20=20=20 > There were still some left-over files under usr/tests/gnu/usr.bin/dif= f, > causing the directory to not be fully removed. Add these to OLD_FILES. >=20=20=20=20=20 > Fixes: 134a4c78d070 This should be MFCed to 15, and the files should be added to the MK_GNU_DIFF section of tools/build/mk/OptionalObsoleteFiles.inc in 14. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@FreeBSD.org From nobody Sun Jul 12 14:51:14 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 4gypRQ6Q23z6lT8n for ; Sun, 12 Jul 2026 14:51:14 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gypRQ5wk5z3slL for ; Sun, 12 Jul 2026 14:51:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783867874; 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=HnZMUJRm3ST1ThF5nTV+1/+rwPcXFAPWwM1/12BNTbQ=; b=ak7XHhxDniYFTHQQZA+LKEG8VE4q5OpjxrQqovwooqBSWaZic4ieNMkHE0Wb2a591rJRyX 0kx5P46CroyBO0ywbYI72pSR8LiYRu+5iNIPK1Wb12Tyz1qGZ5DyJ0RDSiToX7+6KIKupq L6fy80J+hjLBDW08EJkkgG1g0zUnx+USI2Q6oPF2YZ7sULSg+LLk1jAxgrHg2tqp4GhB5O Kf1yE8/RvR7UlO9HedjRysUOd1Khco65S0lk9Pyhb6xHrKwaurDovJrMNyBmJYJk0RMHY3 aOt4koQsuhadWRFOKeQfe1YyHaDHnW8IHF5XTEJhV6hrfFZtAdl9PgFam+M2Ng== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783867874; a=rsa-sha256; cv=none; b=sPImihj13kI6uEwsG7NBisDnbNnE1ljPJwzRgqD4p2vPXfYP93GUeMI8o9ufROAfOOSFPg 0aJWJVshq83JFqZJQSI1VPhs8Go0EjBfohJKSQ3CsExnj9KdrQKgw0uut2IuEJpzU9d3cY mJmPiBBJ5q89zLQ7C9ZyS9qayB92VZqXxkYRIruEnc2UboAY4y90SSgBgz62M5NeaUSsO4 a2oiLJHEezUzBCa2MGRh7iSi/Ra2JN0mJQW4BeIAel/L3Vh2/1Q5Vhez3PZoqyLFURdbLa d10Sk1xdK1Sg/9WGkXyDziKWZXATHabXiEkU/FZm4Y9vql+Wg1G/KUXb67UoWQ== 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=1783867874; 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=HnZMUJRm3ST1ThF5nTV+1/+rwPcXFAPWwM1/12BNTbQ=; b=nm1+DifbCCgJu06rYvTAhTPGLg3LCR/JfYfLIN8EaDVWdHPzPIuH3pKhiZWSbXTGmpEHVe b9KL5vSzrGKpPg1Op5TmEsMxK256PHlzHEJEqjAxSs0rBJi9nX716tWJYsGw1+fKoMYrjU LmJ76OwQ8cUuwsqD9x3szCFzT77Lv2c9n1jFR9iCMbMKVbt5e2V8LjHvZh2rVJG5jsibjy 4o392D4iL3Z5TLllIxw2rPFsK+RLiKOHt/0yXjzHwrK0y2pHSn34DpSEpoB8hSz8FW6V+c sf8u2iAeCpmZNGGKCSFv3PImfTcC4eo5MGMh499M31YT8z6+eeUoz8oJs0L4yQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gypRQ4kFKz263 for ; Sun, 12 Jul 2026 14:51:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3b1eb by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 12 Jul 2026 14:51:14 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: d387a43ec8e2 - main - rockchip: fix stack overflow in rk8xx_rtc 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: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d387a43ec8e2663b2d8bc0c8cb02d3a2ff14b6e6 Auto-Submitted: auto-generated Date: Sun, 12 Jul 2026 14:51:14 +0000 Message-Id: <6a53a9e2.3b1eb.641ee5c0@gitrepo.freebsd.org> The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=d387a43ec8e2663b2d8bc0c8cb02d3a2ff14b6e6 commit d387a43ec8e2663b2d8bc0c8cb02d3a2ff14b6e6 Author: Kyle Evans AuthorDate: 2026-07-12 14:51:05 +0000 Commit: Kyle Evans CommitDate: 2026-07-12 14:51:05 +0000 rockchip: fix stack overflow in rk8xx_rtc Presumably surfaced by -fstack-protector-strong, rk8xx_settime was triggering SSP when ntpd set the time on the RockPro64, at the very least. A minor oops meant that the weeks mask was getting tossed into the wrong field, and the mask was never populated. The mask is 0x7 for all three of these, thus overflowing the `data` array in settime by one byte. PR: 296719 Reported by: jsm, "Tenkawa" on Discord Reviewed by: mmel Differential Revision: https://reviews.freebsd.org/D58182 --- sys/dev/iicbus/pmic/rockchip/rk805.c | 3 ++- sys/dev/iicbus/pmic/rockchip/rk808.c | 3 ++- sys/dev/iicbus/pmic/rockchip/rk817.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/dev/iicbus/pmic/rockchip/rk805.c b/sys/dev/iicbus/pmic/rockchip/rk805.c index 4b18aaba053d..5cdc27cd035f 100644 --- a/sys/dev/iicbus/pmic/rockchip/rk805.c +++ b/sys/dev/iicbus/pmic/rockchip/rk805.c @@ -167,7 +167,8 @@ rk805_attach(device_t dev) sc->rtc_regs.months = RK805_RTC_MONTHS; sc->rtc_regs.months_mask = RK805_RTC_MONTHS_MASK; sc->rtc_regs.years = RK805_RTC_YEARS; - sc->rtc_regs.weeks = RK805_RTC_WEEKS_MASK; + sc->rtc_regs.weeks = RK805_RTC_WEEKS; + sc->rtc_regs.weeks_mask = RK805_RTC_WEEKS_MASK; sc->rtc_regs.ctrl = RK805_RTC_CTRL; sc->rtc_regs.ctrl_stop_mask = RK805_RTC_CTRL_STOP; sc->rtc_regs.ctrl_ampm_mask = RK805_RTC_AMPM_MODE; diff --git a/sys/dev/iicbus/pmic/rockchip/rk808.c b/sys/dev/iicbus/pmic/rockchip/rk808.c index 1227fd47ee7b..f3974c5ec31b 100644 --- a/sys/dev/iicbus/pmic/rockchip/rk808.c +++ b/sys/dev/iicbus/pmic/rockchip/rk808.c @@ -242,7 +242,8 @@ rk808_attach(device_t dev) sc->rtc_regs.months = RK808_RTC_MONTHS; sc->rtc_regs.months_mask = RK808_RTC_MONTHS_MASK; sc->rtc_regs.years = RK808_RTC_YEARS; - sc->rtc_regs.weeks = RK808_RTC_WEEKS_MASK; + sc->rtc_regs.weeks = RK808_RTC_WEEKS; + sc->rtc_regs.weeks_mask = RK808_RTC_WEEKS_MASK; sc->rtc_regs.ctrl = RK808_RTC_CTRL; sc->rtc_regs.ctrl_stop_mask = RK808_RTC_CTRL_STOP; sc->rtc_regs.ctrl_ampm_mask = RK808_RTC_AMPM_MODE; diff --git a/sys/dev/iicbus/pmic/rockchip/rk817.c b/sys/dev/iicbus/pmic/rockchip/rk817.c index 6d14a26a87af..461a832d4d42 100644 --- a/sys/dev/iicbus/pmic/rockchip/rk817.c +++ b/sys/dev/iicbus/pmic/rockchip/rk817.c @@ -498,7 +498,8 @@ rk817_attach(device_t dev) sc->rtc_regs.months = RK817_RTC_MONTHS; sc->rtc_regs.months_mask = RK817_RTC_MONTHS_MASK; sc->rtc_regs.years = RK817_RTC_YEARS; - sc->rtc_regs.weeks = RK817_RTC_WEEKS_MASK; + sc->rtc_regs.weeks = RK817_RTC_WEEKS; + sc->rtc_regs.weeks_mask = RK817_RTC_WEEKS_MASK; sc->rtc_regs.ctrl = RK817_RTC_CTRL; sc->rtc_regs.ctrl_stop_mask = RK817_RTC_CTRL_STOP; sc->rtc_regs.ctrl_ampm_mask = RK817_RTC_AMPM_MODE; From nobody Sun Jul 12 15:35:36 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 4gyqQc4GPSz6lWZg for ; Sun, 12 Jul 2026 15:35:36 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyqQc3QmTz43Tb for ; Sun, 12 Jul 2026 15:35:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783870536; 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=09g4WJ4wLfWHMv7Mwmgy9Ll4ITGr10kqNWZvRBs8c/o=; b=jDt+iWsyHDHR7bk6S9vd58tmUD9x6UiGHK0AYNuy5HrBDNSvnb2cJHQhlXfTj/dg+7VJ0E U9lWgqtMtklOQ22dXsW7AASk6vsAlSewyfCvYDTwxrEYFZaVRG5XA0JVso980IJxS3YA5u RgcXWLMrbelyMXdXpQBT0nykmKgeofVJL8Rz70vVj+F3Q4OAZ7Uo16Nwx6ZZajxxcYm6nw FQ9g0jWRpgmuJUw19Hi0/8Y3evDJUpVKNoUk8GCGSaGjtDOi1uIAH8R4Mll+ASmx9E89y4 VNP0hxVuqE5O/0/IRtBlGolkkJl7HO5o0lAtxjem+H+L8wy/xc/mUZwUlcMqqA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783870536; a=rsa-sha256; cv=none; b=xp9VaWrOaDMoNdXwEXVUtkuC+1DJJpC6yR1GrUjsYteomymK3t3h162idQxEDczQdkIFI5 /xgSXykmDyGyI3gv9kIpJTIpBeHNkagpGBqCs+B3J/lafCPcftXYRT4Mu9hvYjlnYtMBed ojcjTDrJgLgQyrZ9/vRbLlLQ7MWr8nOaGTUTtPtV+Yoy9rlyXJChN/WQ24lOoeJMJg0/Gd zw1EGyRjJzQQ96T3+OO1pzRyWaB5IneaCIKO8OaB8GLZifIzeL6ZZRCmsNiF8GtIY4hNYp zWwig58m2sqNo9LLi7XDngbuGURNwedHhp2+ASC55Iz5YeNWuNnOP2BKWfyq+w== 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=1783870536; 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=09g4WJ4wLfWHMv7Mwmgy9Ll4ITGr10kqNWZvRBs8c/o=; b=wKAj9o/6wFvJkHOoAh6l9qrKEXnH3+V8At49oS4YU6friEUnsyhAc6o+VH+WpfepQCzXzB NdFwWxFPgxk9Cm8R8YV2ZgGX45VxwJJ6JTuhf8jy5mz/0LTcdAo3fGONYWnFLkPsdGFrTK TDD4pcHf3afBRiEfIZO+UmKcRj6PgofNvUyD6RUpNJXjmvt2VN/Q5ZbBtbuLka69ycZILj a4QQ3vhvTy5Siw/pa6/IIHKPlm3oxwdfJVxlrutTr+dhXvd6gTrzhhHfwfukVHArj9jHTU Kcm2hk6gzYWS7a4X1lmd/If5606IRpgQ7tnBaE1QJvDwYgXehTnZIob40LSFkQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyqQc2DdPz3NH for ; Sun, 12 Jul 2026 15:35:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3ff16 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 12 Jul 2026 15:35:36 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 7aa34e12c9e1 - main - rge: fix multicast add/removal by using if_getdrvflags() 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7aa34e12c9e198bf8b7e74370ff702def5ec2649 Auto-Submitted: auto-generated Date: Sun, 12 Jul 2026 15:35:36 +0000 Message-Id: <6a53b448.3ff16.15f8f9c3@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=7aa34e12c9e198bf8b7e74370ff702def5ec2649 commit 7aa34e12c9e198bf8b7e74370ff702def5ec2649 Author: Adrian Chadd AuthorDate: 2026-07-12 15:26:46 +0000 Commit: Adrian Chadd CommitDate: 2026-07-12 15:26:46 +0000 rge: fix multicast add/removal by using if_getdrvflags() Using if_getflags() to check IFF_DRV_RUNNING is wrong; if_getdrvflags() is required. This issue resulted in the multicast filter not being updated. This was an oversight by me in my initial port. Thanks to danilo@ for reporting it and Oleg for the fix. PR: kern/295176 --- sys/dev/rge/if_rge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/rge/if_rge.c b/sys/dev/rge/if_rge.c index 61dcac390765..7c11da5c3f53 100644 --- a/sys/dev/rge/if_rge.c +++ b/sys/dev/rge/if_rge.c @@ -951,7 +951,7 @@ rge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCADDMULTI: case SIOCDELMULTI: RGE_LOCK(sc); - if ((if_getflags(ifp) & IFF_DRV_RUNNING) != 0) + if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) != 0) rge_iff_locked(sc); RGE_UNLOCK(sc); break; From nobody Sun Jul 12 15:35:35 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 4gyqQh2pKqz6lWXJ for ; Sun, 12 Jul 2026 15:35:40 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyqQh2Jcjz43gh for ; Sun, 12 Jul 2026 15:35:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783870540; 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=vfNxIbRFdnJ0kmTy21RfSLuDl7BylA+PUzS1AbxiOPE=; b=S6Z85MPpUmeoieXjwz51lcOwiGWAyOniYXPcZAIBnMhp8qkU+Za1QKe+RpV02iOGYzGUr3 7gNoCndVuKfyapYoFSFnFt6P1wDvGfAeraVlz+Q6kRLy3xmc8x1UICzyh8/6RsEwAUI6Xe lSqxjv/OH9DU4IYn1bfoqubAviPLvmNSImDquaBG4eaYQauJBRoJVDb44IuUdFy5aNLeNs MfJtWPQrbM9k8Syu0qaeadPpo+0Us0k2Bt1WCo39XeBcC9vcEnh1S0rUjrT9YNCRFPd8Q4 5OPx0c10d60OZNLYv232JWOzPc00gC3lmJHzSFjgrdddONNq6fP/TRFumUGyzA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783870540; a=rsa-sha256; cv=none; b=UFM+jsp8fKhK3jAVbF/S8gU6yDF1SfJgSwICwjdqgNgC5wW/KP2Gv9RZa+WSTvwJ6jQ7Al CrS7rBAylynM+2buhsITV0fAPSBE24vU4F8/81B4HVsluBJWmtYf7xKx8kia8HwiaSbj4o TdafZpe81mMZiOZWTI9FgjfIiI8+QuYTm+SRBFwTaf9kCS14OLeTsZOEaZWEAtTqXKpnRI j2xjFjrQMAlZ4oKfiAfPZIcVuuXbvEldghKF7Hm//nyhns9f30CR/fnGp3v5bw5iwIkSvm cnq9w5m1VvdZuKBE6FnlEjVwj1pCevd8qLA347QQ5eQ60CfMkaba/iTOCNdsHQ== 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=1783870540; 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=vfNxIbRFdnJ0kmTy21RfSLuDl7BylA+PUzS1AbxiOPE=; b=VA0Fp/ffRjZdwrOXHuC4VtRCTSpXNnl4g7+ixwT0WKFtrV12rIL9Wxsbqx62zdf3NUwHZu qjYWl/SA3bRadXhLEicgkFrwuGqtcQV+4oaQEX6j8m4ukEiSl+nmrEwW3Ia/1IBY/iuRjP OtbAUwIQqhs7Ac+u2umhcFBXlCTeYb0cvOP0j/mPM2IrjzbX+N6Hr9kJZmqwslspjWjLNR FERvbd19gLwimBCpdUddxgjZavYEkhe1ntsD5soMCxUt16nVr8rJpOXJzyTvpPN4nd2lKQ WPqYUgeFQNG0Sau4a/RTwS+ivbIsdmTK8s4J3vCl/DDnfhAHpW45eZY2dltOyA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyqQh1NLwz384 for ; Sun, 12 Jul 2026 15:35:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 404c7 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 12 Jul 2026 15:35:35 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Abdelkader Boudih From: Adrian Chadd Subject: git: 23a6997e3071 - main - fwdv: add AV/C DV capture driver for FireWire camcorders 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 23a6997e3071cea8d8fc5238792fdd0ad5b5dc9a Auto-Submitted: auto-generated Date: Sun, 12 Jul 2026 15:35:35 +0000 Message-Id: <6a53b447.404c7.6b314274@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=23a6997e3071cea8d8fc5238792fdd0ad5b5dc9a commit 23a6997e3071cea8d8fc5238792fdd0ad5b5dc9a Author: Abdelkader Boudih AuthorDate: 2026-07-12 15:25:52 +0000 Commit: Adrian Chadd CommitDate: 2026-07-12 15:25:57 +0000 fwdv: add AV/C DV capture driver for FireWire camcorders Add fwdv(4) driver for DV video capture from FireWire camcorders using AV/C protocol and isochronous streaming. Supports AV/C tape transport commands (play, stop, ff, rewind, pause, record, eject) with NTSC/PAL auto-detection and read(2) interface for frame capture. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58122 --- share/man/man4/Makefile | 1 + share/man/man4/fwdv.4 | 80 +++ sys/conf/NOTES | 1 + sys/conf/files | 1 + sys/dev/firewire/fwdv.c | 1101 ++++++++++++++++++++++++++++++++++++ sys/dev/firewire/fwdv.h | 195 +++++++ sys/modules/firewire/Makefile | 1 + sys/modules/firewire/fwdv/Makefile | 11 + 8 files changed, 1391 insertions(+) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index ab937d5cacee..f987dae1b62e 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -179,6 +179,7 @@ MAN= aac.4 \ filemon.4 \ firewire.4 \ fwcam.4 \ + fwdv.4 \ fwisound.4 \ ${_ftgpio.4} \ ${_ftwd.4} \ diff --git a/share/man/man4/fwdv.4 b/share/man/man4/fwdv.4 new file mode 100644 index 000000000000..c21a95019c70 --- /dev/null +++ b/share/man/man4/fwdv.4 @@ -0,0 +1,80 @@ +.\" +.\" Copyright (c) 2026 Abdelkader Boudih +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.Dd June 19, 2026 +.Dt FWDV 4 +.Os +.Sh NAME +.Nm fwdv +.Nd AV/C DV capture driver for FireWire camcorders +.Sh SYNOPSIS +.Cd "device firewire" +.Cd "device fwdv" +.Sh DESCRIPTION +The +.Nm +driver provides DV frame capture from AV/C tape devices attached via +IEEE 1394 (FireWire), including DV camcorders, VCRs, and DV converters. +.Pp +The driver attaches to the +.Xr firewire 4 +bus and creates +.Pa /dev/fwdvX +at load time. +When an AV/C device is connected, the driver automatically discovers it +and begins receiving IEC 61883 isochronous packets on first open, +assembling complete DV frames. +Applications read raw DV frames from the character device +and control tape transport through +.Xr ioctl 2 . +.Pp +Both NTSC and PAL SD-DV streams are detected from the incoming CIP header. +DVCPRO HD frame sizing is also recognized. +.Sh IOCTLS +.Bl -tag -width ".Dv FWDV_GINFO" +.It Dv FWDV_GINFO Pq Vt "struct fwdv_info" +Return driver state, active ISO channel, detected DV system, frame size, +frame counters, dropped frame count, device EUI-64, and vendor/model strings +from the device configuration ROM. +.It Dv FWDV_PLAY +Send the AV/C play command to tape subunit 0. +.It Dv FWDV_STOP +Send the AV/C stop command to tape subunit 0. +.It Dv FWDV_FFWD +Send the AV/C fast-forward command to tape subunit 0. +.It Dv FWDV_REW +Send the AV/C rewind command to tape subunit 0. +.El +.Sh SYSCTLS +.Bl -tag -width ".Va hw.firewire.fwdv.iso_channel" +.It Va hw.firewire.fwdv.iso_channel +Fallback isochronous receive channel. +The default is 63. +If the device output plug control register reports an active channel, that +device-reported channel is used instead. +This value can be set as a tunable in +.Xr loader.conf 5 . +.El +.Sh FILES +.Bl -tag -width ".Pa /dev/fwdvX" -compact +.It Pa /dev/fwdvX +DV capture character device. +Read to obtain raw DV frames. +.El +.Sh SEE ALSO +.Xr firewire 4 , +.Xr fwohci 4 +.Pp +AV/C Digital Interface Command Set General Specification 4.1, +1394 Trade Association Document 2001012. +.Pp +IEC 61883-1 and IEC 61883-2. +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 16.0 . +.Sh AUTHORS +.An Abdelkader Boudih Aq Mt freebsd@seuros.com diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 7b253927e9a8..560b3554fe06 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -2615,6 +2615,7 @@ device sbp_targ # SBP-2 Target mode (Requires scbus and targ) device fwe # Ethernet over FireWire (non-standard!) device fwip # IP over FireWire (RFC2734 and RFC3146) device fwcam # IIDC digital cameras over FireWire +device fwdv # AV/C DV capture over FireWire device fwisound # Apple FireWire audio ##################################################################### diff --git a/sys/conf/files b/sys/conf/files index 86dbd83e21d9..392a6dd3a10f 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1733,6 +1733,7 @@ dev/firewire/fwcrom.c optional firewire dev/firewire/fwdev.c optional firewire dev/firewire/fwcam.c optional fwcam dev/firewire/fwdma.c optional firewire +dev/firewire/fwdv.c optional fwdv dev/firewire/fwisound.c optional fwisound sound dev/firewire/fwisound_pcm.c optional fwisound sound dev/firewire/fwmem.c optional firewire diff --git a/sys/dev/firewire/fwdv.c b/sys/dev/firewire/fwdv.c new file mode 100644 index 000000000000..b1bb6bb997cc --- /dev/null +++ b/sys/dev/firewire/fwdv.c @@ -0,0 +1,1101 @@ +/* + * Copyright (c) 2026 Abdelkader Boudih + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +/* + * fwdv(4) - AV/C DV capture driver for FireWire camcorders + * + * References: + * AV/C General Specification 4.1 (TA Document 2001012) + * IEC 61883-1, IEC 61883-2 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +static MALLOC_DEFINE(M_FWDV, "fwdv", "AV/C DV over FireWire"); + +static int debug = 0; +static int iso_channel = FWDV_DEFAULT_ISO_CH; +SYSCTL_DECL(_hw_firewire); +static SYSCTL_NODE(_hw_firewire, OID_AUTO, fwdv, CTLFLAG_RD | CTLFLAG_MPSAFE, + 0, "AV/C DV"); +SYSCTL_INT(_hw_firewire_fwdv, OID_AUTO, debug, CTLFLAG_RWTUN, &debug, 0, + "fwdv debug level"); +SYSCTL_INT(_hw_firewire_fwdv, OID_AUTO, iso_channel, CTLFLAG_RWTUN, + &iso_channel, 0, "ISO channel for DV receive"); + +#define FWDV_DEBUG(lev, fmt, ...) \ + do { \ + if (debug >= (lev)) \ + printf("fwdv: " fmt, ## __VA_ARGS__); \ + } while (0) + +static void fwdv_identify(driver_t *, device_t); +static int fwdv_probe(device_t); +static int fwdv_attach(device_t); +static int fwdv_detach(device_t); +static void fwdv_post_busreset(void *); +static void fwdv_post_explore(void *); +static void fwdv_probe_task(void *, int); + +static int fwdv_avc_command(struct fwdv_softc *, const uint8_t *, int, + uint8_t *, int *); +static int fwdv_avc_unit_info(struct fwdv_softc *); +static int fwdv_avc_play(struct fwdv_softc *); +static int fwdv_avc_stop(struct fwdv_softc *); + +static int fwdv_read_opcr(struct fwdv_softc *, int, uint32_t *); + +static int fwdv_iso_start(struct fwdv_softc *); +static void fwdv_iso_stop(struct fwdv_softc *); +static void fwdv_iso_input(struct fw_xferq *); + +static void fwdv_fcp_handler(struct fw_xfer *); + +static d_open_t fwdv_cdev_open; +static d_close_t fwdv_cdev_close; +static d_read_t fwdv_cdev_read; +static d_poll_t fwdv_cdev_poll; +static d_ioctl_t fwdv_cdev_ioctl; + +static struct cdevsw fwdv_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_TRACKCLOSE, + .d_open = fwdv_cdev_open, + .d_close = fwdv_cdev_close, + .d_read = fwdv_cdev_read, + .d_poll = fwdv_cdev_poll, + .d_ioctl = fwdv_cdev_ioctl, + .d_name = "fwdv", +}; + +static int +fwdv_read_quadlet(struct fwdv_softc *sc, uint16_t addr_hi, uint32_t addr_lo, + uint32_t *val) +{ + uint16_t dst; + uint8_t spd; + + FWDV_LOCK(sc); + if (sc->fwdev == NULL) { + FWDV_UNLOCK(sc); + return (ENXIO); + } + dst = FWLOCALBUS | sc->fwdev->dst; + spd = min(sc->fwdev->speed, FWSPD_S400); + FWDV_UNLOCK(sc); + + return (fw_read_quadlet(sc->fd.fc, M_FWDV, dst, spd, + addr_hi, addr_lo, val)); +} + +static void +fwdv_fcp_handler(struct fw_xfer *xfer) +{ + struct fwdv_softc *sc = (struct fwdv_softc *)xfer->sc; + struct fw_pkt *fp; + uint16_t src_id; + int len; + + fp = &xfer->recv.hdr; + + if (xfer->resp != 0) { + FWDV_DEBUG(1, "FCP response error: %d\n", xfer->resp); + goto done; + } + + len = fp->mode.wreqb.len; + if (len < 4 || len > FCP_MAX_FRAME_LEN) { + FWDV_DEBUG(1, "FCP response bad len: %d\n", len); + goto done; + } + + if (xfer->recv.pay_len < 4) { + FWDV_DEBUG(1, "FCP response short payload: %d\n", + xfer->recv.pay_len); + goto done; + } + if (xfer->recv.pay_len < len) + len = xfer->recv.pay_len; + + src_id = fp->mode.wreqb.src; + FWDV_LOCK(sc); + if (sc->fwdev == NULL || + (FWLOCALBUS | sc->fwdev->dst) != src_id) { + FWDV_UNLOCK(sc); + FWDV_DEBUG(2, "FCP response from unknown node 0x%04x\n", + src_id); + goto done; + } + + if (xfer->recv.payload != NULL) { + memcpy(sc->fcp_resp, xfer->recv.payload, + min(len, FCP_MAX_FRAME_LEN)); + sc->fcp_resp_len = len; + sc->fcp_resp_ready = 1; + wakeup(&sc->fcp_resp_ready); + } + FWDV_UNLOCK(sc); + +done: + STAILQ_INSERT_TAIL(&sc->fcp_bind.xferlist, xfer, link); +} + +static int +fwdv_avc_command(struct fwdv_softc *sc, const uint8_t *cmd, int cmd_len, + uint8_t *resp, int *resp_len) +{ + struct fw_xfer *xfer; + struct fw_pkt *fp; + uint16_t dst; + uint8_t spd; + int err, padded_len; + + FWDV_LOCK(sc); + while (sc->avc_busy) { + if (sc->state == FWDV_STATE_DETACHING) { + FWDV_UNLOCK(sc); + return (ENXIO); + } + msleep(&sc->avc_busy, &sc->mtx, PWAIT, "fwdvavc", hz); + } + sc->avc_busy = 1; + + if (sc->fwdev == NULL) { + sc->avc_busy = 0; + wakeup(&sc->avc_busy); + FWDV_UNLOCK(sc); + return (ENXIO); + } + dst = FWLOCALBUS | sc->fwdev->dst; + spd = min(sc->fwdev->speed, FWSPD_S400); + FWDV_UNLOCK(sc); + + padded_len = roundup2(cmd_len, 4); + + xfer = fw_xfer_alloc_buf(M_FWDV, padded_len, 0); + if (xfer == NULL) { + err = ENOMEM; + goto done; + } + + xfer->fc = sc->fd.fc; + xfer->hand = fw_xferwake; + + fp = &xfer->send.hdr; + fp->mode.wreqb.tcode = FWTCODE_WREQB; + fp->mode.wreqb.dst = dst; + fp->mode.wreqb.dest_hi = FCP_COMMAND_ADDR >> 32; + fp->mode.wreqb.dest_lo = FCP_COMMAND_ADDR & 0xffffffff; + fp->mode.wreqb.len = padded_len; + fp->mode.wreqb.extcode = 0; + xfer->send.spd = spd; + xfer->send.pay_len = padded_len; + + memcpy(xfer->send.payload, cmd, cmd_len); + if (padded_len > cmd_len) + memset((uint8_t *)xfer->send.payload + cmd_len, 0, + padded_len - cmd_len); + + FWDV_LOCK(sc); + sc->fcp_resp_ready = 0; + sc->fcp_resp_len = 0; + FWDV_UNLOCK(sc); + + FWDV_DEBUG(2, "AVC cmd: %02x %02x %02x %02x (len=%d)\n", + cmd[0], cmd[1], cmd_len > 2 ? cmd[2] : 0, + cmd_len > 3 ? cmd[3] : 0, cmd_len); + + err = fw_xfer_request_wait(xfer->fc, xfer, 2 * hz); + if (err != 0) { + fw_xfer_free_buf(xfer); + goto done; + } + + if (xfer->resp != 0 || + xfer->recv.hdr.mode.wres.rtcode != FWRCODE_COMPLETE) { + FWDV_DEBUG(1, "FCP write failed: resp=%d rtcode=%d\n", + xfer->resp, xfer->recv.hdr.mode.wres.rtcode); + err = EIO; + } + fw_xfer_free_buf(xfer); + if (err != 0) + goto done; + + FWDV_LOCK(sc); + for (int interim_retry = 0; interim_retry < 3; interim_retry++) { + while (!sc->fcp_resp_ready) { + if (sc->state == FWDV_STATE_DETACHING || + sc->fwdev == NULL) { + err = ENXIO; + goto done_locked; + } + err = msleep(&sc->fcp_resp_ready, &sc->mtx, PCATCH, + "fwdvfcp", 3 * hz); + if (err) { + err = (err == EWOULDBLOCK) ? ETIMEDOUT : err; + goto done_locked; + } + } + + if (sc->fcp_resp_len >= 1 && + (sc->fcp_resp[0] >> 4) == AVC_RESP_INTERIM) { + FWDV_DEBUG(2, "AVC INTERIM, waiting for final\n"); + sc->fcp_resp_ready = 0; + if (interim_retry == 2) { + FWDV_DEBUG(1, "AVC INTERIM timeout\n"); + err = ETIMEDOUT; + goto done_locked; + } + continue; + } + break; + } + + if (resp != NULL && resp_len != NULL) { + int copy_len = min(sc->fcp_resp_len, *resp_len); + memcpy(resp, sc->fcp_resp, copy_len); + *resp_len = copy_len; + } + FWDV_UNLOCK(sc); + + FWDV_DEBUG(2, "AVC resp: %02x %02x %02x %02x (len=%d)\n", + sc->fcp_resp[0], sc->fcp_resp[1], + sc->fcp_resp_len > 2 ? sc->fcp_resp[2] : 0, + sc->fcp_resp_len > 3 ? sc->fcp_resp[3] : 0, + sc->fcp_resp_len); + + FWDV_LOCK(sc); + sc->avc_busy = 0; + wakeup(&sc->avc_busy); + FWDV_UNLOCK(sc); + + return (0); + +done_locked: + sc->avc_busy = 0; + wakeup(&sc->avc_busy); + FWDV_UNLOCK(sc); + return (err); + +done: + FWDV_LOCK(sc); + sc->avc_busy = 0; + wakeup(&sc->avc_busy); + FWDV_UNLOCK(sc); + return (err); +} + +static int +fwdv_avc_unit_info(struct fwdv_softc *sc) +{ + uint8_t cmd[8], resp[8]; + int resp_len, err; + + cmd[0] = (AVC_CTYPE_STATUS << 4) | 0; + cmd[1] = AVC_ADDR_UNIT; + cmd[2] = AVC_OP_UNIT_INFO; + cmd[3] = 0xff; + cmd[4] = 0xff; + cmd[5] = 0xff; + cmd[6] = 0xff; + cmd[7] = 0xff; + + resp_len = sizeof(resp); + err = fwdv_avc_command(sc, cmd, 8, resp, &resp_len); + if (err) + return (err); + + if (resp_len < 8) { + device_printf(sc->fd.dev, + "UNIT INFO: short response (%d bytes)\n", resp_len); + return (EIO); + } + if ((resp[0] >> 4) != AVC_RESP_STABLE) { + device_printf(sc->fd.dev, + "UNIT INFO: unexpected response 0x%02x\n", resp[0]); + return (EIO); + } + + FWDV_DEBUG(1, "UNIT INFO: unit_type=0x%02x, company_id=%02x%02x%02x\n", + resp[4] >> 3, resp[5], resp[6], resp[7]); + + return (0); +} + +static int +fwdv_avc_tape_control(struct fwdv_softc *sc, uint8_t opcode, uint8_t operand, + const char *name) +{ + uint8_t cmd[4], resp[4]; + int resp_len, err; + + cmd[0] = (AVC_CTYPE_CONTROL << 4) | 0; + cmd[1] = AVC_ADDR_TAPE0; + cmd[2] = opcode; + cmd[3] = operand; + + resp_len = sizeof(resp); + err = fwdv_avc_command(sc, cmd, 4, resp, &resp_len); + if (err) + return (err); + if (resp_len < 1) + return (EIO); + + if ((resp[0] >> 4) != AVC_RESP_ACCEPTED) { + device_printf(sc->fd.dev, "%s rejected: 0x%02x\n", + name, resp[0]); + return (EIO); + } + + FWDV_DEBUG(1, "%s accepted\n", name); + return (0); +} + +static int +fwdv_avc_play(struct fwdv_softc *sc) +{ + + return (fwdv_avc_tape_control(sc, AVC_OP_PLAY, AVC_PLAY_FWD, "PLAY")); +} + +static int +fwdv_avc_stop(struct fwdv_softc *sc) +{ + + return (fwdv_avc_tape_control(sc, AVC_OP_WIND, AVC_WIND_STOP, "STOP")); +} + +static int +fwdv_read_opcr(struct fwdv_softc *sc, int plug, uint32_t *val) +{ + + return (fwdv_read_quadlet(sc, CSR_BASE_HI, + CSR_BASE_LO | PCR_oPCR(plug), val)); +} + +static int +fwdv_iso_start(struct fwdv_softc *sc) +{ + struct firewire_comm *fc = sc->fd.fc; + struct fw_xferq *xferq; + uint32_t opcr_val; + int dma_ch, err; + uint8_t ch; + + mtx_assert(&sc->mtx, MA_NOTOWNED); + + FWDV_LOCK(sc); + if (sc->dma_ch >= 0 || sc->state == FWDV_STATE_STREAMING) { + FWDV_UNLOCK(sc); + return (0); + } + if (sc->state == FWDV_STATE_DETACHING) { + FWDV_UNLOCK(sc); + return (ENXIO); + } + FWDV_UNLOCK(sc); + + ch = (uint8_t)(iso_channel & ISO_CHANNEL_MASK); + err = fwdv_read_opcr(sc, 0, &opcr_val); + if (err == 0 && (opcr_val & OPCR_ONLINE)) { + uint8_t dev_ch = (opcr_val & OPCR_CHANNEL_MASK) >> + OPCR_CHANNEL_SHIFT; + if (dev_ch < ISO_CHANNEL_MAX) { + ch = dev_ch; + FWDV_DEBUG(1, "oPCR[0] channel=%d\n", ch); + } + } + + dma_ch = fw_open_isodma(fc, 0); + if (dma_ch < 0) { + device_printf(sc->fd.dev, "no IR DMA channel available\n"); + return (EBUSY); + } + + FWDV_LOCK(sc); + if (sc->dma_ch >= 0) { + FWDV_UNLOCK(sc); + fc->ir[dma_ch]->flag &= ~FWXFERQ_OPEN; + return (0); + } + FWDV_UNLOCK(sc); + + xferq = fc->ir[dma_ch]; + xferq->flag |= FWXFERQ_EXTBUF | FWXFERQ_HANDLER | FWXFERQ_STREAM; + sc->iso_channel = ch; + xferq->flag &= ~FWXFERQ_CHTAGMASK; + xferq->flag |= (ch & ISO_CHANNEL_MASK) | (1 << 6); + + xferq->sc = (caddr_t)sc; + xferq->hand = fwdv_iso_input; + xferq->bnchunk = FWDV_ISO_NCHUNK; + xferq->bnpacket = 1; + xferq->psize = FWDV_ISO_PKTSIZE; + xferq->queued = 0; + xferq->buf = NULL; + + xferq->bulkxfer = malloc(sizeof(struct fw_bulkxfer) * xferq->bnchunk, + M_FWDV, M_WAITOK | M_ZERO); + + fw_iso_init_chunks(xferq); + + sc->frame_size = FWDV_MAX_FRAME_SIZE; + sc->frame_buf = malloc(sc->frame_size, M_FWDV, M_WAITOK | M_ZERO); + sc->read_buf = malloc(sc->frame_size, M_FWDV, M_WAITOK | M_ZERO); + sc->frame_offset = 0; + sc->frame_ready = 0; + sc->frame_dropped = 0; + sc->frame_count = 0; + sc->dv_detected = 0; + + err = fc->irx_enable(fc, dma_ch); + if (err) { + device_printf(sc->fd.dev, "failed to start IR DMA: %d\n", err); + goto fail; + } + + FWDV_LOCK(sc); + if (sc->state == FWDV_STATE_DETACHING || sc->fwdev == NULL) { + FWDV_UNLOCK(sc); + fc->irx_disable(fc, dma_ch); + err = ENXIO; + goto fail; + } + sc->dma_ch = dma_ch; + sc->state = FWDV_STATE_STREAMING; + wakeup(sc); + FWDV_UNLOCK(sc); + + return (0); + +fail: + fw_iso_free_chunks(xferq, M_FWDV); + xferq->flag &= ~(FWXFERQ_MODEMASK | FWXFERQ_OPEN | FWXFERQ_STREAM | + FWXFERQ_EXTBUF | FWXFERQ_HANDLER | FWXFERQ_CHTAGMASK); + xferq->hand = NULL; + + free(sc->frame_buf, M_FWDV); + free(sc->read_buf, M_FWDV); + sc->frame_buf = NULL; + sc->read_buf = NULL; + sc->dma_ch = -1; + + return (err); +} + +static void +fwdv_iso_stop(struct fwdv_softc *sc) +{ + struct firewire_comm *fc = sc->fd.fc; + struct fw_xferq *xferq; + int dma_ch; + + FWDV_LOCK(sc); + dma_ch = sc->dma_ch; + if (dma_ch < 0) { + FWDV_UNLOCK(sc); + return; + } + sc->dma_ch = -1; + FWDV_UNLOCK(sc); + + xferq = fc->ir[dma_ch]; + + if (xferq->flag & FWXFERQ_RUNNING) + fc->irx_disable(fc, dma_ch); + + FWDV_LOCK(sc); + fw_iso_wait_inactive_locked(&sc->mtx, &sc->iso_active, "fwdvis"); + sc->frame_ready = 0; + while (sc->read_in_progress) + msleep(&sc->read_in_progress, &sc->mtx, PWAIT, "fwdvst", hz); + FWDV_UNLOCK(sc); + + xferq->flag &= ~(FWXFERQ_MODEMASK | FWXFERQ_OPEN | FWXFERQ_STREAM | + FWXFERQ_EXTBUF | FWXFERQ_HANDLER | FWXFERQ_CHTAGMASK); + xferq->hand = NULL; + + fw_iso_free_chunks(xferq, M_FWDV); + + free(sc->frame_buf, M_FWDV); + free(sc->read_buf, M_FWDV); + sc->frame_buf = NULL; + sc->read_buf = NULL; +} + +static void +fwdv_iso_input(struct fw_xferq *xferq) +{ + struct fwdv_softc *sc = (struct fwdv_softc *)xferq->sc; + struct fw_bulkxfer *sxfer; + struct fw_pkt *fp; + struct ciphdr *ciph; + struct dvdbc *dv; + struct mbuf *m; + uint8_t *ptr, *end; + uint32_t plen; + uint8_t *tmp; + int dma_ch; + + FWDV_LOCK(sc); + dma_ch = sc->dma_ch; + if (dma_ch < 0 || sc->frame_buf == NULL) { + FWDV_UNLOCK(sc); + return; + } + sc->iso_active = 1; + FWDV_UNLOCK(sc); + + while ((sxfer = STAILQ_FIRST(&xferq->stvalid)) != NULL) { + STAILQ_REMOVE_HEAD(&xferq->stvalid, link); + + m = fw_iso_dequeue(xferq, sxfer, sc->fd.fc); + if (m == NULL) + continue; + + fp = mtod(m, struct fw_pkt *); + plen = fp->mode.stream.len; + if (plen <= sizeof(struct ciphdr)) { + m_freem(m); + continue; + } + + if (m->m_len < (int)(4 + sizeof(struct ciphdr))) { + m_freem(m); + continue; + } + + ciph = (struct ciphdr *)(mtod(m, uint8_t *) + 4); + + if (ciph->fmt != CIP_FMT_DVCR) { + m_freem(m); + continue; + } + + if (!sc->dv_detected) { + sc->dv_system = ciph->fdf.dv.fs; + sc->dv_detected = 1; + if (ciph->fdf.dv.stype == CIP_STYPE_HD) { + sc->frame_size = DV_DVCPRO_HD_FRAME; + } else { + sc->frame_size = sc->dv_system ? + DV_SD_PAL_FRAME : DV_SD_NTSC_FRAME; + } + printf("fwdv: DV stype=%d %s detected (frame=%u)\n", + ciph->fdf.dv.stype, + sc->dv_system ? "PAL" : "NTSC", + sc->frame_size); + } + + ptr = (uint8_t *)(ciph + 1); + end = mtod(m, uint8_t *) + 4 + plen; + if (end > mtod(m, uint8_t *) + m->m_len) + end = mtod(m, uint8_t *) + m->m_len; + + while (ptr + DV_DIF_BLOCK_SIZE <= end) { + dv = (struct dvdbc *)ptr; + + if (dv->sct == DV_SCT_HEADER && dv->dseq == 0) { + if (sc->frame_offset > 0) { + if (sc->frame_offset >= sc->frame_size) { + FWDV_LOCK(sc); + if (sc->read_in_progress) { + sc->frame_dropped++; + } else { + if (sc->frame_ready) + sc->frame_dropped++; + tmp = sc->read_buf; + sc->read_buf = + sc->frame_buf; + sc->frame_buf = tmp; + sc->frame_ready = 1; + sc->frame_count++; + wakeup(sc); + selwakeup(&sc->rsel); + } + FWDV_UNLOCK(sc); + } else { + sc->frame_dropped++; + } + } + sc->frame_offset = 0; + + if (sc->dv_system == 1 && + (dv->payload[0] & DV_DSF_12) == 0) + dv->payload[0] |= DV_DSF_12; + } + + if (sc->frame_offset + DV_DIF_BLOCK_SIZE <= + sc->frame_size) { + memcpy(sc->frame_buf + sc->frame_offset, + ptr, DV_DIF_BLOCK_SIZE); + sc->frame_offset += DV_DIF_BLOCK_SIZE; + } else { + sc->frame_dropped++; + sc->frame_offset = 0; + } + + ptr += DV_DIF_BLOCK_SIZE; + } + + m_freem(m); + } + + fw_iso_rearm_done(xferq, sc->fd.fc, &sc->mtx, &sc->iso_active, + &sc->dma_ch, dma_ch); +} + +static int +fwdv_cdev_open(struct cdev *dev, int oflags, int devtype, struct thread *td) +{ + struct fwdv_softc *sc = dev->si_drv1; + int err = 0; + + FWDV_LOCK(sc); + if (sc->state == FWDV_STATE_DETACHING) { + FWDV_UNLOCK(sc); + return (ENXIO); + } + while (sc->state == FWDV_STATE_STARTING) { + err = msleep(sc, &sc->mtx, PCATCH, "fwdvst", 5 * hz); + if (err) { + FWDV_UNLOCK(sc); + return (err == EWOULDBLOCK ? EAGAIN : err); + } + } + if (sc->state == FWDV_STATE_DETACHING) { + FWDV_UNLOCK(sc); + return (ENXIO); + } + if (sc->state != FWDV_STATE_PROBED && + sc->state != FWDV_STATE_STREAMING) { + FWDV_UNLOCK(sc); + return (EAGAIN); + } + + sc->open_count++; + if (sc->open_count == 1 && sc->state == FWDV_STATE_PROBED) { + sc->state = FWDV_STATE_STARTING; + FWDV_UNLOCK(sc); + err = fwdv_iso_start(sc); + if (err) { + FWDV_LOCK(sc); + sc->open_count--; + if (sc->state == FWDV_STATE_STARTING) { + sc->state = FWDV_STATE_PROBED; + wakeup(sc); + } + FWDV_UNLOCK(sc); + } + } else { + FWDV_UNLOCK(sc); + } + return (err); +} + +static int +fwdv_cdev_close(struct cdev *dev, int fflag, int devtype, struct thread *td) +{ + struct fwdv_softc *sc = dev->si_drv1; + + FWDV_LOCK(sc); + sc->open_count--; + if (sc->open_count <= 0) { + sc->open_count = 0; + if (sc->state == FWDV_STATE_STREAMING) { + FWDV_UNLOCK(sc); + fwdv_iso_stop(sc); + FWDV_LOCK(sc); + if (sc->state != FWDV_STATE_DETACHING) + sc->state = FWDV_STATE_PROBED; + } + } + FWDV_UNLOCK(sc); + return (0); +} + +static int +fwdv_cdev_read(struct cdev *dev, struct uio *uio, int ioflag) +{ + struct fwdv_softc *sc = dev->si_drv1; + int err; + + FWDV_LOCK(sc); + while (!sc->frame_ready) { + if (sc->state != FWDV_STATE_STREAMING) { + FWDV_UNLOCK(sc); + return (ENXIO); + } + if (ioflag & FNONBLOCK) { + FWDV_UNLOCK(sc); + return (EAGAIN); + } + err = msleep(sc, &sc->mtx, PCATCH, "fwdvrd", 0); + if (err) { + FWDV_UNLOCK(sc); + return (err); + } + } + + sc->read_in_progress = 1; + sc->frame_ready = 0; + FWDV_UNLOCK(sc); + + err = uiomove(sc->read_buf, min(uio->uio_resid, sc->frame_size), + uio); + + FWDV_LOCK(sc); + sc->read_in_progress = 0; + wakeup(&sc->read_in_progress); + FWDV_UNLOCK(sc); + + return (err); +} + +static int +fwdv_cdev_poll(struct cdev *dev, int events, struct thread *td) +{ + struct fwdv_softc *sc = dev->si_drv1; + int revents = 0; + + FWDV_LOCK(sc); + if (sc->state != FWDV_STATE_STREAMING) { + revents = POLLHUP; + } else if (events & (POLLIN | POLLRDNORM)) { + if (sc->frame_ready) + revents |= events & (POLLIN | POLLRDNORM); + else + selrecord(td, &sc->rsel); + } + FWDV_UNLOCK(sc); + + return (revents); +} + +static int +fwdv_cdev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, + struct thread *td) +{ + struct fwdv_softc *sc = dev->si_drv1; + struct fwdv_info *info; + + switch (cmd) { + case FWDV_GINFO: + info = (struct fwdv_info *)data; + memset(info, 0, sizeof(*info)); + FWDV_LOCK(sc); + info->state = sc->state; + info->iso_channel = sc->iso_channel; + info->dv_system = sc->dv_detected ? sc->dv_system : 0xff; + info->frame_size = sc->frame_size; + info->frame_count = sc->frame_count; + info->frame_dropped = sc->frame_dropped; + info->eui_hi = sc->eui_hi; + info->eui_lo = sc->eui_lo; + strlcpy(info->vendor, sc->vendor, sizeof(info->vendor)); + strlcpy(info->model, sc->model, sizeof(info->model)); + FWDV_UNLOCK(sc); + return (0); + + case FWDV_PLAY: + return (fwdv_avc_play(sc)); *** 504 LINES SKIPPED *** From nobody Sun Jul 12 15:43:42 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 4gyqcB6lD7z6lX8y for ; Sun, 12 Jul 2026 15:43:54 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyqcB4Ldwz45XG for ; Sun, 12 Jul 2026 15:43:54 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-92e5c92c389so117510085a.3 for ; Sun, 12 Jul 2026 08:43:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1783871033; cv=none; d=google.com; s=arc-20260327; b=sPD2HdzmINTknXrJpdZr/Icz7+H/50MAGhO895z7t8MV2Zxh6X9qKE0TSrChkc0TVG L9emJ7RjPW0phE4tfiFcFCO3Tn7+IwPLkvseut/dyKqOYPCEb1AX7zE7UJOiICiaqec+ gP/hOmbwASQMOQbHvJ3tVRkKy1AwcpMnrxjNbatQpE6QtfVgQBa5DqsqJgnJ29oPbrHA qV0LBEJ70FRT4evfQUcJup+2ac4BpvVJoLjH5ej8nIvL42ZAgE9weQgVRK310xWo+Hxo UwNWv7j7ABzX1vaMNprgfD6ICsLayoYLT/ZOKTlGIeu8we/v4Kn2rOr8nO0GKtjCqOQx d2Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version; bh=O3hyztXfUa7TAfry2nTzzCk/2Uhi6gdoxrh5qQqfmgY=; fh=9c0GOOltSmZkX46zbqCOdk6Mlx5Mzx8rPnt6umkzcNo=; b=XbhveOi08Fx9pkHhDI+kpygs2DZZPjpUhGQsiZLfaOlbslEJ5tm1XcHpBPuocwe4Jh IhLFi4GpmcDlp0U7jD18UWProI//jhF16bChIDnK7KbQUGrVuQdjyED+gwVvOgp0U9fG Xrbqdmc+rW5tPU2sxRX0THLfmdNBBjF0ZiiyI0BtcuKyoLB9R4tVyIwtjARAS/lg2cIj YiKhscN17MPyqyI2XG0jjF0enblSqcRmtQXwC50xeL9x4gaszGyHXXYRcQnXmEVmo4xX DgPuneaCs3N1ipKIMKbt6V6VCJCzjcF1YC5Hu4I+cic/ufnV1L7C/rsMiagwJGXGG+GA pzHg==; darn=freebsd.org ARC-Authentication-Results: i=1; mx.google.com; arc=none X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783871033; x=1784475833; h=content-type:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=O3hyztXfUa7TAfry2nTzzCk/2Uhi6gdoxrh5qQqfmgY=; b=mQ3+GJ1SnjPT28bfNoS2pC7hVc1M0v8wB6b5i1jZP9gwb3rcVpy1owbtayt2Lq5TPi tHFTJg/9YcEaJ/V7DjGru1xyx6/KKKCbjRo+2oBDnq8WUxO6HkZXXcDVp9+OgRS99iu0 PaB/6q4pNXBHKj5InSPE0TEvIv+qMvROguKUXdQx3Bu9XhfkmtJGRYiSgWS5JZbtfbfV Xb9nmoldRUzEBK43BCbRKjJb2eavGbF4/4CcLX3UShwILVIA9V1FpyKN+RVyCfkTxOOZ b1GxPFsEeRCqWJIygT09r7Vm5TJGGGPeXZIukGFxR/bgZa+Iz/ZoH4ru/5ZsLrW+sBgK ecFw== X-Forwarded-Encrypted: i=1; AHgh+Rrsl+k5QkJhhbfJgv2049xxmgi9FuhJmSNs1LDlu39tUnsfjms7yKDN9tVOqZ0RHw7VDPVFEO7XDiNqyp6OgMVyp4PV6w==@freebsd.org X-Gm-Message-State: AOJu0Yy2oIGzT6CJTY+cLeMZqKHRkPUNFzcCgetaQdAe797wzfrbHe+D G1+gtOr60l7jUUKh7Xxo+iI80uCmkWXYjuvZqQmWfP8lvp1ellKLUk7iJjtXTk6BMb8cKbGOY/n v89WLdH+nyeFmPR95IY9zGvzAz4f7h94S3A== X-Gm-Gg: AfdE7ck4BCdNAWlHQlq1hVqZjjLEL6HBKgDDTgGfIgwrv/+9IfQKiM+0Aey8wjGuGk1 sado/nnDW1YIhXlhctWKEA0zVxRzccE6ROEh7wRm1DrdaqnYAYn62XzaRpMOjvYHzwfJWhau1po yfN1UI2qwK4rVXJ9i5Trs/eldR00kTCm06G2MAEg4btkLQqI4zMXmwi5qqT92Yc+Ip8QkNgekMf r+Fisxg5PigCOfFnCsvWhWJQJz49ftOI1NCSL4od2PnLHOgWRW0sbrStuBWrX3NDznN+FCCVqVT mc6Bl8trwpYhC+jN2AkrUKVOpwQxSHaBYd+RgubbOveW01yPMj2h1LdyRBe4fqAa3QATU1IOmOc sMhXrDpgmAD9gQOUvTQ3xsSWdxoggBR3K1CvSftA/3IhaZfw= X-Received: by 2002:a05:620a:608a:b0:92e:8405:7ae8 with SMTP id af79cd13be357-92ef2b3888emr592813685a.4.1783871033519; Sun, 12 Jul 2026 08:43:53 -0700 (PDT) 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 References: <6a1008a0.3f79c.1d455f29@gitrepo.freebsd.org> <49761290-2d6c-403f-acdd-48b5b536804c@FreeBSD.org> In-Reply-To: <49761290-2d6c-403f-acdd-48b5b536804c@FreeBSD.org> From: Adrian Chadd Date: Sun, 12 Jul 2026 08:43:42 -0700 X-Gm-Features: AUfX_mxWciTEb_ANI7QFMI3kHQlcKZY31KWRMOVv_hof4xOKfZZl74aRc9-C5LE Message-ID: Subject: Re: git: 28d85db46b48 - main - xhci: Do not drop and add bits in xhci To: Kyle Evans Cc: ShengYi Hung , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, Vladimir Kondratyev Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4gyqcB4Ldwz45XG X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] X-Spamd-Bar: ---- On Sat, 11 Jul 2026 at 20:21, Kyle Evans wrote: > > On 5/22/26 02:41, ShengYi Hung wrote: > > The branch main has been updated by aokblast: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=28d85db46b484589e2ee74cf4b270db066821de1 > Hi, > > This patch reliably fixes a bug I've been trying to track down in a u2f(4) patch > that I've been testing, and I'm wondering if you can help connect the dots. I > have a Solo2 u2f(4) key that I find will inconsistently desync (for other reasons) > and hang, and the solution for *that* is to release this NOT_YET block[0] in > u2f_dtor(). > > The problem I was hunting down is that doing so subsequently broke my Yubikey in a > way that this patch alone seems to fix. It would hang on every other ssh attempt, as > long as we issued usbd_transfer_stop on our interrupt endpoints upon last-close. It > was known to work with uhid(4) reliably which issues a stop as well, and that's the > thing I can't really explain. Is there something that uhid(4) / usb_dev.c is doing > that might have accidentally worked around this? > > This was the only commit that looked relevant in the fast-forward I did for my latest > round of testing from 9c18d55a768a3 to 707ee7ff952c5, and reverting just this patch > reliably re-introduces the problem I was having with the Yubikey. > My guess is the yubikey device firmware pays attention to this bit and the state is only reset when the state cycles through STOP. If you're curious, try comparing usbdump captures before/after the fix and look for explicit differences in things and then guess what the firmware is doing. -adrian From nobody Sun Jul 12 17:19:10 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 4gysk85PHyz6kQrc; Sun, 12 Jul 2026 17:19:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gysk84Rh9z3SgZ; Sun, 12 Jul 2026 17:19:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783876752; 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: in-reply-to:in-reply-to:references:references; bh=W0vYDtJzdZ6vhlXP9klmvfX4fnmcYgqdjJyvJmxvit8=; b=vXWDqnHB3vo1kq89pPlnykeVko8EDOu4tqE5DvAvUCeIyZZdgKGWIUFTP5KeDnAlCM3mvr /GJBhstOwQwAKFypM8vzgjxobGZ50nNs7hozIgxCGfNXMC5apVqcwXS4IXCu1ryBE9DsGf qy0jYTm7yQvP0Yapmhbgkg/NAuX7s0OKpURWzkpLUPl5Rqn7SBbYe2Ajouy0zB3H9DyMoh hiCLfSSy8uWE/53O/s28xejlZ788lPwEnvYSg+E55n0JKhoDf7r5YVQRukiOydaDNPKFUj cAP2yrIEyCoHVCOQB6h8IiyyQOQz+0jY/Y1SwWGR0qHDSzzVLpdRSxLi9wY/tw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783876752; a=rsa-sha256; cv=none; b=PmNUmvCSuN89r6vLLK+dUs9G44TCJ5WYwNnkJIbonSafu/pyDt0od1YbmxEySdo3RhQbEu wy24DKI9WmTQh92I/nrIEyuv5a8txOUaT+geUS5Cy9LdR4eo/ZnrPzAMit0Q3QaZM1SZnh dUzdC2qqPT6pVoCe+ny2rz0+YA29TzJnMqU9Aa9Icp0p/T7rhFxSVrFmBX5M2SxJAOrQX8 QcyJCGddmv8SPr1oOtyN+2Xdbp+tDMwIAq5ka9uJtQhldSQMiEJgUeaonCN0q6gbKQxA40 UkhLvwT6UTv+VOFHDjkjc6kNAZXuhjTch7u/GNW82c6hCGGuq2orEoSV5UlkrQ== 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=1783876752; 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: in-reply-to:in-reply-to:references:references; bh=W0vYDtJzdZ6vhlXP9klmvfX4fnmcYgqdjJyvJmxvit8=; b=UCiHB0YCBW2SJZY19ftYqweD7pL179sew0iUHdLOjF+445EZrlzoz4RNWUtOj/A+sCJmpH ekln+Vc9iopgp/HDwmCpuUc0q+i4BQx8Z/ytQxNq7vIr92e9rsT0Pa73ZGNErEgchc5zb5 IKPUHTSZYW2KJNcvQw51SdEGwu8jYCO5uowlzShK1DlxJv1g0aJ+gdN5soT7BF0R3eRnAy 9GF1NR2CGOYF+BJIwhsEPLSWHxnYN1Bq9WfHJIBnC2uvs0UvyiLryegqcVNoMYcI2LBg8k Cp6xG80+HasvB86mlAFvchl+Oi977Lh/6fNWY0TFe967qy5rWRww0NOE0XkWMw== Received: from [10.9.4.95] (unknown [209.182.120.176]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: kevans/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gysk76s3Dz19CX; Sun, 12 Jul 2026 17:19:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Message-ID: <07894a56-cdfb-40dc-8746-60eaf596e4c4@FreeBSD.org> Date: Sun, 12 Jul 2026 12:19:10 -0500 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 User-Agent: Mozilla Thunderbird Subject: Re: git: 28d85db46b48 - main - xhci: Do not drop and add bits in xhci To: Adrian Chadd Cc: ShengYi Hung , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, Vladimir Kondratyev References: <6a1008a0.3f79c.1d455f29@gitrepo.freebsd.org> <49761290-2d6c-403f-acdd-48b5b536804c@FreeBSD.org> Content-Language: en-US From: Kyle Evans In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 7/12/26 10:43, Adrian Chadd wrote: > On Sat, 11 Jul 2026 at 20:21, Kyle Evans wrote: >> >> On 5/22/26 02:41, ShengYi Hung wrote: >>> The branch main has been updated by aokblast: >>> >>> URL: https://cgit.FreeBSD.org/src/commit/?id=28d85db46b484589e2ee74cf4b270db066821de1 > >> Hi, >> >> This patch reliably fixes a bug I've been trying to track down in a u2f(4) patch >> that I've been testing, and I'm wondering if you can help connect the dots. I >> have a Solo2 u2f(4) key that I find will inconsistently desync (for other reasons) >> and hang, and the solution for *that* is to release this NOT_YET block[0] in >> u2f_dtor(). >> >> The problem I was hunting down is that doing so subsequently broke my Yubikey in a >> way that this patch alone seems to fix. It would hang on every other ssh attempt, as >> long as we issued usbd_transfer_stop on our interrupt endpoints upon last-close. It >> was known to work with uhid(4) reliably which issues a stop as well, and that's the >> thing I can't really explain. Is there something that uhid(4) / usb_dev.c is doing >> that might have accidentally worked around this? >> >> This was the only commit that looked relevant in the fast-forward I did for my latest >> round of testing from 9c18d55a768a3 to 707ee7ff952c5, and reverting just this patch >> reliably re-introduces the problem I was having with the Yubikey. >> > > My guess is the yubikey device firmware pays attention to this bit and > the state is > only reset when the state cycles through STOP. If you're curious, try > comparing usbdump > captures before/after the fix and look for explicit differences in > things and then > guess what the firmware is doing. > Solid suggestion, thanks- I forgot that usbdump is even a thing, so I'll play with this a bit. Thanks, Kyle Evans From nobody Sun Jul 12 17:25:15 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 4gyss76B5Fz6kRXL for ; Sun, 12 Jul 2026 17:25:15 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyss743yhz3VMt for ; Sun, 12 Jul 2026 17:25:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783877115; 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=sY4CNzO1mtvYEvW9aZtZcgH29u7sIy0IrcnbImhey/4=; b=RcXkDYS57+quvB8fxwFvh6Gdy3+P3DM0rxv9kuRfzJJa7whkVhD3C70NZmP0R9IAt3XLPR Re7N4Nig0HXCcsFVw8QyXnXdy5JR4srmjr9OWQDi891MyAKFdkp1ZnLBssngi8lOQ5wFj0 j/OdoXUDuX07VeF6PzHNm95mzx1FrwPeWVimQRrS4OaPmo6u7ITnWSy/i6VcDDufI0nYIR wEF+ZF6UZCVUBZ06RyMVFLd2gKJ0TcKTVnt58/ZQg3UITYbVdq3+S8ziKoG8Rb5iJik27i Yw9IGTP/VBjVmoeWrrZn42BF881Hk9tCEEx/kOApghpVIwkzHsBkyTGVse5xXg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783877115; a=rsa-sha256; cv=none; b=E2rYeR+/aRtW4dcy+Mj6cBxMD3ED4/sEO1kAdygRm5lUnu1QnDAjm5QmU0yumrDCw+Mw03 cjA9ApwtFkIfPYnLwpKVrZxSM5JrqMocYxvgazl8ZY4o/3x67fnqeg7TLjnxKtw8dlHBbI WNx7/eHO5fhuYVcQqmZ3NJ+U9y7f8GxWChXG0oT1L1TfEvzVilU7nIPQvJZgHutazBOy3c 1yCzssKJSPo0PCV+tuJqIPZcrk3FEqdqG4w0Q5BBAugnGASDwVW0DgWWIlOX1E5uO65veT 1x9+Neh94vY3g42ZeyCdGil+O2JlMMHKwM6VCZrMemnOoe+kT5XT02ok+Qz4CQ== 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=1783877115; 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=sY4CNzO1mtvYEvW9aZtZcgH29u7sIy0IrcnbImhey/4=; b=viEL9s9nd7e5cpbBmiFVLngI7Q2F/2YSNjM9Hanw11m7PkJTeBE7xNYZ8HsajmFZHasIh1 w6isk5kAGuL1uSJpZ/3d8IhtlFSgdEXos3zco8kOLyRV3eJdh8Yte5cEhPY6MaoeVhNbkd 1H/iMAIcUaUFBqcSS0ASXvgqCBXqQqXwAepRTgGW2HlMLf8n909pEFEE0tKHArZXcyMbol /qFNcI31zoKYdiqz3XhrucPZlmD4CH3LMGkiDmfhlpt17Cw8XldwFJPS4p3rXp13iiAyIl yjD0PJ4qDo9TXRJan58OdBjNnhr9tJlLxaRrCtTs4KH0nz5+CaLLwIk0Xi3FPg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyss71VbBz50w for ; Sun, 12 Jul 2026 17:25:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1bc3b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 12 Jul 2026 17:25:15 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Abdelkader Boudih From: Adrian Chadd Subject: git: 4085d1991e2a - main - hidwacom: Add Wacom ExpressKey Remote driver 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4085d1991e2a9e155e3d928955ce8ba53512b8da Auto-Submitted: auto-generated Date: Sun, 12 Jul 2026 17:25:15 +0000 Message-Id: <6a53cdfb.1bc3b.6b99611c@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=4085d1991e2a9e155e3d928955ce8ba53512b8da commit 4085d1991e2a9e155e3d928955ce8ba53512b8da Author: Abdelkader Boudih AuthorDate: 2026-07-12 17:11:07 +0000 Commit: Adrian Chadd CommitDate: 2026-07-12 17:11:10 +0000 hidwacom: Add Wacom ExpressKey Remote driver The Wacom ExpressKey Remote (ACK-411050) is a wireless button pad with 18 programmable buttons and a touch ring, used as a companion device with Wacom tablets. It communicates via a USB wireless receiver (0x056a:0x0331) using a vendor-specific HID report (ID 0x11). This driver exposes the device via evdev: - 18 buttons: BTN_0–BTN_Z, BTN_BASE, BTN_BASE2 - Touch ring position via ABS_WHEEL (0–71; reports 0 on release) - Pad activity marker via ABS_MISC (set to 15/PAD_DEVICE_ID when any input is active, 0 when idle that matches Linux wacom driver convention) - Remote serial number via MSC_SERIAL (for userland per-remote identification) Battery level, charging state, and touch ring mode (3 LEDs, values 0–2) are exposed as per-device sysctls (dev.hidwacom.0.battery, .charging, .ring_mode) rather than overloading evdev misc codes. The ring mode sysctl is preserved across device idle periods. Protocol was decoded from USB traffic analysis and cross-referenced against the Linux wacom_remote_irq() implementation in drivers/hid/wacom_wac.c. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D56729 Discussed with: ziaee --- share/man/man4/Makefile | 1 + share/man/man4/hidwacom.4 | 87 +++++++++++ sys/conf/files | 1 + sys/dev/hid/hidwacom.c | 293 ++++++++++++++++++++++++++++++++++++++ sys/dev/usb/usbdevs | 1 + sys/modules/hid/Makefile | 1 + sys/modules/hid/hidwacom/Makefile | 8 ++ 7 files changed, 392 insertions(+) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index f987dae1b62e..80b9ac16ce87 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -213,6 +213,7 @@ MAN= aac.4 \ hidbus.4 \ hidquirk.4 \ hidraw.4 \ + hidwacom.4 \ hkbd.4 \ hms.4 \ hmt.4 \ diff --git a/share/man/man4/hidwacom.4 b/share/man/man4/hidwacom.4 new file mode 100644 index 000000000000..7bd786dfb94c --- /dev/null +++ b/share/man/man4/hidwacom.4 @@ -0,0 +1,87 @@ +.\" +.\" Copyright (c) 2026 Abdelkader Boudih +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.Dd April 18, 2026 +.Dt HIDWACOM 4 +.Os +.Sh NAME +.Nm hidwacom +.Nd Wacom ExpressKey Remote driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device hidwacom" +.Cd "device hidbus" +.Cd "device hid" +.Cd "device evdev" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +hidwacom_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for the Wacom ExpressKey Remote, a wireless +button pad with 18 programmable buttons and a touch ring. +The device communicates via a USB wireless receiver using vendor-specific +HID reports. +.Pp +The driver exposes the following inputs through +.Xr evdev 4 : +.Bl -tag -width "MSC_PULSELED" +.It Dv BTN_0 Ns \(en Ns Dv BTN_Z , Dv BTN_BASE , Dv BTN_BASE2 +18 buttons. +.It Dv ABS_WHEEL +Touch ring position (0\(en71). +Reports 0 when the ring is not being touched. +.It Dv ABS_MISC +Touch ring mode (0\(en3), as reported by the device. +Reports 0 when the ring is not being touched. +.It Dv MSC_PULSELED +Battery charge level as a percentage (0\(en100). +.It Dv MSC_SERIAL +Remote serial number, identifying which physical remote generated the event. +.El +.Pp +Only a single paired remote is supported. +The multi-remote pairing protocol (up to 5 remotes) is not implemented. +.Sh HARDWARE +The +.Nm +driver supports the following device: +.Pp +.Bl -bullet -compact +.It +Wacom ExpressKey Remote (ACK-411050), connected via the Wacom USB +wireless receiver +.El +.Sh FILES +.Bl -tag -width "/dev/input/eventX" -compact +.It Pa /dev/input/eventX +evdev input device +.El +.Sh SEE ALSO +.Xr evdev 4 , +.Xr hidbus 4 , +.Xr usbhid 4 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 16.0 . +.Sh BUGS +Only a single paired remote is fully supported. +When multiple remotes are paired, button state may be corrupted as all +remotes share a single evdev device. +.Sh AUTHORS +.An Abdelkader Boudih Aq Mt freebsd@seuros.com +.Pp +Protocol decoded from USB traffic analysis. diff --git a/sys/conf/files b/sys/conf/files index 392a6dd3a10f..3b5ba83eda28 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1798,6 +1798,7 @@ dev/hid/hidbus.c optional hidbus dev/hid/hidmap.c optional hidmap | hms dev/hid/hidquirk.c optional hid dev/hid/hidraw.c optional hidraw +dev/hid/hidwacom.c optional hidwacom dev/hid/hkbd.c optional hkbd dev/hid/hms.c optional hms dev/hid/hmt.c optional hmt hconf diff --git a/sys/dev/hid/hidwacom.c b/sys/dev/hid/hidwacom.c new file mode 100644 index 000000000000..4fc732102c73 --- /dev/null +++ b/sys/dev/hid/hidwacom.c @@ -0,0 +1,293 @@ +/* + * Copyright (c) 2026 Abdelkader Boudih + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +/* + * Wacom ExpressKey Remote Driver + * + * HID driver for Wacom ExpressKey Remote (USB HID, vendor 0x056a). + * The device uses a vendor-specific HID usage page (0xFF0C) with + * proprietary report formats. Only a single remote is supported; + * multi-remote pairing (up to 5) is not implemented. + * + * Protocol decoded from USB traffic capture (HydraUSB3 analyser). + * Report structure cross-referenced with the HID report descriptor + * and publicly available Wacom protocol documentation. + * + * Report ID 0x10 (DEVICE_LIST): pairing status (ignored) + * Report ID 0x11 (REMOTE): button and touch ring events + * buf[0]: report ID (0x11) + * buf[3..5]: serial number (LE 24-bit) + * buf[7]: battery (bit 7 = charging, bits 0-6 = percent 0-100) + * buf[9]: buttons 0-7 + * buf[10]: buttons 8-15 + * buf[11]: bits 0-1 = buttons 16-17, bits 6-7 = touch ring mode + * buf[12]: touch ring (bit 7 = active, bits 0-6 = position 1-72, + * where raw value 1 maps to position 0 and 72 maps to 71) + */ + +#include + +#include "opt_hid.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define HID_DEBUG_VAR hidwacom_debug +#include +#include +#include "usbdevs.h" + +#ifdef HID_DEBUG +static int hidwacom_debug = 0; + +static SYSCTL_NODE(_hw_hid, OID_AUTO, hidwacom, CTLFLAG_RW, 0, + "Wacom ExpressKey Remote"); +SYSCTL_INT(_hw_hid_hidwacom, OID_AUTO, debug, CTLFLAG_RWTUN, + &hidwacom_debug, 0, "Debug level"); +#endif + +/* Report IDs */ +#define WACOM_REPORT_DEVICE_LIST 0x10 +#define WACOM_REPORT_REMOTE 0x11 + +/* Minimum report length (report ID + 12 data bytes for ring at buf[12]) */ +#define WACOM_REMOTE_MIN_LEN 13 + +/* Touch ring modes (buf[11] bits 6-7) */ +#define WACOM_RING_MODE_MASK 0xc0 +#define WACOM_RING_MODE_SHIFT 6 + +/* Touch ring */ +#define WACOM_RING_ACTIVE 0x80 +#define WACOM_RING_POSITION_MASK 0x7f +#define WACOM_RING_MAX 71 + +/* Battery: bit 7 = charging flag, bits 0-6 = percent */ +#define WACOM_BATTERY_CHARGING 0x80 +#define WACOM_BATTERY_PERCENT_MASK 0x7f + +/* Pad device ID for ABS_MISC activity marker (matches Linux PAD_DEVICE_ID) */ +#define WACOM_PAD_DEVICE_ID 0x0f + +#define HIDWACOM_DEV_NAME "Wacom ExpressKey Remote" + +/* Button evdev keycodes */ +static const uint16_t hidwacom_buttons[] = { + BTN_0, BTN_1, BTN_2, BTN_3, BTN_4, BTN_5, BTN_6, BTN_7, /* buf[9] */ + BTN_8, BTN_9, BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, /* buf[10] */ + BTN_BASE, BTN_BASE2, /* buf[11] */ +}; + +struct hidwacom_softc { + struct mtx sc_mtx; + struct evdev_dev *sc_evdev; +}; + +static void +hidwacom_intr(void *context, void *data, hid_size_t len) +{ + struct hidwacom_softc *sc = context; + uint8_t *buf = data; + uint8_t report_id; + uint8_t b9, b10, b11, ring, battery; + uint32_t serial; + int i, pos; + + if (len < 1) + return; + + report_id = buf[0]; + + if (report_id == WACOM_REPORT_DEVICE_LIST) { + DPRINTFN(2, "device list report (pairing)\n"); + return; + } + + if (report_id != WACOM_REPORT_REMOTE) { + DPRINTFN(1, "unknown report id: 0x%02x\n", report_id); + return; + } + + if (len < WACOM_REMOTE_MIN_LEN) { + DPRINTFN(1, "short remote report: %zu\n", (size_t)len); + return; + } + + mtx_lock(&sc->sc_mtx); + + /* Serial number (LE 24-bit) */ + serial = buf[3] + ((uint32_t)buf[4] << 8) + ((uint32_t)buf[5] << 16); + + /* Battery: percent in bits 0-6, charging flag in bit 7 */ + battery = buf[7] & WACOM_BATTERY_PERCENT_MASK; + + /* Extract button bytes */ + b9 = buf[9]; + b10 = buf[10]; + b11 = buf[11]; + + /* Buttons 0-7 from buf[9] */ + for (i = 0; i < 8; i++) + evdev_push_key(sc->sc_evdev, hidwacom_buttons[i], + (b9 >> i) & 1); + + /* Buttons 8-15 from buf[10] */ + for (i = 0; i < 8; i++) + evdev_push_key(sc->sc_evdev, hidwacom_buttons[8 + i], + (b10 >> i) & 1); + + /* Buttons 16-17 from buf[11] bits 0-1 */ + evdev_push_key(sc->sc_evdev, BTN_BASE, b11 & 0x01); + evdev_push_key(sc->sc_evdev, BTN_BASE2, b11 & 0x02); + + /* Touch ring: raw position is 1-based (1..72); subtract 1 for 0..71 */ + ring = buf[12]; + if (ring & WACOM_RING_ACTIVE) { + pos = (ring & WACOM_RING_POSITION_MASK) - 1; + if (pos < 0) + pos = 0; + if (pos > WACOM_RING_MAX) + pos = WACOM_RING_MAX; + evdev_push_abs(sc->sc_evdev, ABS_WHEEL, pos); + evdev_push_abs(sc->sc_evdev, ABS_MISC, + (b11 >> WACOM_RING_MODE_SHIFT) & 0x03); + } else { + evdev_push_abs(sc->sc_evdev, ABS_WHEEL, 0); + evdev_push_abs(sc->sc_evdev, ABS_MISC, 0); + } + + /* Battery percent */ + evdev_push_event(sc->sc_evdev, EV_MSC, MSC_PULSELED, battery); + + /* Remote serial number */ + evdev_push_event(sc->sc_evdev, EV_MSC, MSC_SERIAL, serial); + + evdev_sync(sc->sc_evdev); + + mtx_unlock(&sc->sc_mtx); +} + +static const struct hid_device_id hidwacom_devs[] = { + { HID_BVP(BUS_USB, USB_VENDOR_WACOM, + USB_PRODUCT_WACOM_EXPRESSKEY_REMOTE) }, +}; + +static int +hidwacom_probe(device_t dev) +{ + int error; + + error = HIDBUS_LOOKUP_DRIVER_INFO(dev, hidwacom_devs); + if (error != 0) + return (error); + + if (hidbus_get_index(dev) != 0) + return (ENXIO); + + hidbus_set_desc(dev, HIDWACOM_DEV_NAME); + return (BUS_PROBE_DEFAULT); +} + +static int +hidwacom_attach(device_t dev) +{ + struct hidwacom_softc *sc = device_get_softc(dev); + const struct hid_device_info *hw; + int i, error; + + hw = hid_get_device_info(dev); + mtx_init(&sc->sc_mtx, "hidwacom", NULL, MTX_DEF); + + sc->sc_evdev = evdev_alloc(); + evdev_set_name(sc->sc_evdev, HIDWACOM_DEV_NAME); + evdev_set_phys(sc->sc_evdev, device_get_nameunit(dev)); + evdev_set_id(sc->sc_evdev, hw->idBus, hw->idVendor, hw->idProduct, + hw->idVersion); + evdev_set_serial(sc->sc_evdev, hw->serial); + + evdev_support_event(sc->sc_evdev, EV_SYN); + evdev_support_event(sc->sc_evdev, EV_KEY); + evdev_support_event(sc->sc_evdev, EV_ABS); + evdev_support_event(sc->sc_evdev, EV_MSC); + + for (i = 0; i < (int)nitems(hidwacom_buttons); i++) + evdev_support_key(sc->sc_evdev, hidwacom_buttons[i]); + + evdev_support_abs(sc->sc_evdev, ABS_WHEEL, 0, WACOM_RING_MAX, + 0, 0, 0); + evdev_support_abs(sc->sc_evdev, ABS_MISC, 0, 3, 0, 0, 0); + evdev_support_msc(sc->sc_evdev, MSC_SERIAL); + evdev_support_msc(sc->sc_evdev, MSC_PULSELED); + + error = evdev_register_mtx(sc->sc_evdev, &sc->sc_mtx); + if (error != 0) { + device_printf(dev, "evdev_register_mtx failed: %d\n", error); + goto fail; + } + + hidbus_set_intr(dev, hidwacom_intr, sc); + + error = hid_intr_start(dev); + if (error != 0) { + device_printf(dev, "hid_intr_start failed: %d\n", error); + hid_intr_stop(dev); + goto fail; + } + + return (0); + +fail: + if (sc->sc_evdev != NULL) + evdev_free(sc->sc_evdev); + mtx_destroy(&sc->sc_mtx); + return (error); +} + +static int +hidwacom_detach(device_t dev) +{ + struct hidwacom_softc *sc = device_get_softc(dev); + int error; + + error = hid_intr_stop(dev); + if (error != 0) { + device_printf(dev, "hid_intr_stop failed: %d\n", error); + return (error); + } + evdev_free(sc->sc_evdev); + mtx_destroy(&sc->sc_mtx); + + return (0); +} + +static device_method_t hidwacom_methods[] = { + DEVMETHOD(device_probe, hidwacom_probe), + DEVMETHOD(device_attach, hidwacom_attach), + DEVMETHOD(device_detach, hidwacom_detach), + DEVMETHOD_END +}; + +static driver_t hidwacom_driver = { + "hidwacom", + hidwacom_methods, + sizeof(struct hidwacom_softc) +}; + +DRIVER_MODULE(hidwacom, hidbus, hidwacom_driver, NULL, NULL); +MODULE_DEPEND(hidwacom, hid, 1, 1, 1); +MODULE_DEPEND(hidwacom, hidbus, 1, 1, 1); +MODULE_DEPEND(hidwacom, evdev, 1, 1, 1); +MODULE_VERSION(hidwacom, 1); +HID_PNP_INFO(hidwacom_devs); diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index a2592b4dd411..13fdebdd9fd8 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -4991,6 +4991,7 @@ product WACOM GRAPHIRE 0x0010 Graphire product WACOM GRAPHIRE3_4X5 0x0013 Graphire 3 4x5 product WACOM INTUOSA5 0x0021 Intuos A5 product WACOM GD0912U 0x0022 Intuos 9x12 Graphics Tablet +product WACOM EXPRESSKEY_REMOTE 0x0331 ExpressKey Remote /* WAGO Kontakttechnik GmbH products */ product WAGO SERVICECABLE 0x07a6 USB Service Cable 750-923 diff --git a/sys/modules/hid/Makefile b/sys/modules/hid/Makefile index c6d856c45ed1..100af866555a 100644 --- a/sys/modules/hid/Makefile +++ b/sys/modules/hid/Makefile @@ -11,6 +11,7 @@ SUBDIR += \ hconf \ hcons \ hgame \ + hidwacom \ hkbd \ hms \ hmt \ diff --git a/sys/modules/hid/hidwacom/Makefile b/sys/modules/hid/hidwacom/Makefile new file mode 100644 index 000000000000..011e47e9c160 --- /dev/null +++ b/sys/modules/hid/hidwacom/Makefile @@ -0,0 +1,8 @@ +.PATH: ${SRCTOP}/sys/dev/hid + +KMOD= hidwacom +SRCS= hidwacom.c +SRCS+= opt_hid.h +SRCS+= bus_if.h device_if.h usbdevs.h + +.include From nobody Sun Jul 12 18:47:30 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 4gyvh76D7jz6kYkt for ; Sun, 12 Jul 2026 18:47:35 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyvh75bqfz3l97 for ; Sun, 12 Jul 2026 18:47:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783882055; 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=xwHDYkotySgGW2+J1sfO+JzTNNff6otfA3rgaGvW0L8=; b=j1Ae7c4gHHGaKYExlAvaf3olxe6ELtOTD8r9B1D1HeF7UCzXKZNSTvQM0iGYMJObGfg5wn M/TLWbHSVy7XYzX/d33ev4EnHqV6zjfUteaxqwEVHJtoQgzFWbzFA2nBbtOJsQhfNxHRJM THbOHiyxPSpNskul+TZ1Ya2olyzsWFWbAfdstFpIVb/vmqL9QS1MuqmApbTYi1tpXJ5ouE /rsMfSKg5O9p580Ti/+rbe0pw1WJIWbKKzrsVHg9D8FYdZD/LkRMcvY5zlv08vEl/NmWx/ 1iWEyWh730ydhrLdLj9xwsuzbVNHCblRjCGbzS3l88rAe7Dw8B9gHkpYVVC7sQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783882055; a=rsa-sha256; cv=none; b=qNEPlQWPckfiiI6u5oVGDdOXNn4WFRIpPLow32wBEla/AcNlxg2fSeWVq0fkOELligzGTC Z+jwpGK2L0Y53WiI2n/k0wDSvkOoJfmJGUKWaRwTtOaTGm7TQxKKRaAmjQCrFy1hTQzHLL iDVenn17bQBcz52lwaKRciM7gPJEtwC/nUled3VFiCiDRd07CTFM6wDVWY4cr/PH/TIrcu dAowS1Z079JKiKNPZA0KQOOhl/6/lE+f7FhdP21u5k1nz10QdJ5toYUYq7nqIF3Qbyq/2f G+gI6EqGJ9vmIVrrD4wW6bAsVoCQc5IfhwQC+tzXTsLuPO0ft01L9yJhA4aSyQ== 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=1783882055; 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=xwHDYkotySgGW2+J1sfO+JzTNNff6otfA3rgaGvW0L8=; b=T+5siKYMsP7esGApiWra4PZeLULLOKqzafMoj9XAmjAqgY6CgPTlvHRIXbj8y/eE5Gh6qr PtGWr+dBXoSAoLZHI4U2Bxk0WSJ1wLndNdx23JeykLBlbRGSOLJQReGo/CCFyFY8o4g+LQ YKOdXX25LWAcqIf6CVxpfHAMkF//ESYKgKywDRsWbhi+0hxG9B9n5kB9pGBpZfeRZNiLIj jmGosa2OU+jB+0ZfPhW/57VeBtnZ6A3gaNxUdTEI3c3tG9ZyrKvx1II2/sWrND+6Ap9InE XTMeoObtyUpv/pfh9HuELtI5ZDD+FQr27RQ7lvIJ9VKPROa3ICAj/12v0xU0Rw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyvh73zKTz7xN for ; Sun, 12 Jul 2026 18:47:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 25510 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 12 Jul 2026 18:47:30 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: -k From: Adrian Chadd Subject: git: ad91d47db306 - main - bluetooth: signal devd on netgraph device events 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ad91d47db306738cc29f30c4d506509a3f5eeb8c Auto-Submitted: auto-generated Date: Sun, 12 Jul 2026 18:47:30 +0000 Message-Id: <6a53e142.25510.1286cc24@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=ad91d47db306738cc29f30c4d506509a3f5eeb8c commit ad91d47db306738cc29f30c4d506509a3f5eeb8c Author: -k AuthorDate: 2026-07-12 18:16:09 +0000 Commit: Adrian Chadd CommitDate: 2026-07-12 18:28:15 +0000 bluetooth: signal devd on netgraph device events Currently, devd emits events for external adapters only. Send Netgraph init/disconnect events to devd so the internal adapter's state could be asserted from userland. (adrian - indentation changes.) Signed-off-by: Kirill Orlov (-k) Reviewed-by: adrian, imp Pull-Request: https://github.com/freebsd/freebsd-src/pull/2196 --- sbin/devd/devd.conf | 15 +++++++ sys/netgraph/bluetooth/hci/ng_hci_main.c | 71 ++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/sbin/devd/devd.conf b/sbin/devd/devd.conf index 86faf2f30722..9fa11463cd42 100644 --- a/sbin/devd/devd.conf +++ b/sbin/devd/devd.conf @@ -159,4 +159,19 @@ notify 100 { action "/sbin/init q"; }; +# Track the bluetooth adapter's arrival/departure. This is useful +# for internal adapters that do not emit regular device events. +notify 100 { + match "system" "BLUETOOTH"; + match "subsystem" "HCI"; + match "type" "INITIALIZED"; + action "logger 'Bluetooth adapter initialized: $*'"; +}; +notify 100 { + match "system" "BLUETOOTH"; + match "subsystem" "HCI"; + match "type" "POWERED_OFF"; + action "logger 'Bluetooth adapter powered off: $*'"; +}; + */ diff --git a/sys/netgraph/bluetooth/hci/ng_hci_main.c b/sys/netgraph/bluetooth/hci/ng_hci_main.c index 13bf970f0135..190cb80a1c4c 100644 --- a/sys/netgraph/bluetooth/hci/ng_hci_main.c +++ b/sys/netgraph/bluetooth/hci/ng_hci_main.c @@ -33,7 +33,10 @@ */ #include +#include +#include #include +#include #include #include #include @@ -110,6 +113,19 @@ static int ng_hci_linktype_to_addrtype(int linktype) } return BDADDR_BREDR; } + +/* + * Append bdaddr_t as "xx:xx:xx:xx:xx:xx" to sbuf. + */ + +static void +ng_hci_append_bdaddr_to_sbuf(struct sbuf *sb, const bdaddr_t *ba) +{ + sbuf_printf(sb, "%02x:%02x:%02x:%02x:%02x:%02x", + ba->b[5], ba->b[4], ba->b[3], + ba->b[2], ba->b[1], ba->b[0]); +} /* ng_hci_append_bdaddr_to_sbuf */ + /***************************************************************************** ***************************************************************************** ** Netgraph methods implementation @@ -268,6 +284,31 @@ ng_hci_disconnect(hook_p hook) /* Connection terminated by local host */ ng_hci_unit_clean(unit, 0x16); unit->state &= ~(NG_HCI_UNIT_CONNECTED|NG_HCI_UNIT_INITED); + + /* Signal power off to devd */ + { + struct sbuf *sb; + sb = sbuf_new_auto(); + sbuf_printf(sb, "node=%s bdaddr=", + NG_NODE_NAME(NG_HOOK_NODE(hook))); + ng_hci_append_bdaddr_to_sbuf(sb, &unit->bdaddr); + sbuf_printf(sb, "\n"); + + if (sbuf_finish(sb) > 0) { + log(LOG_WARNING, + "hci: failed to signal bt device " \ + "power off to devd: " \ + "%02x:%02x:%02x:%02x:%02x:%02x\n", + unit->bdaddr.b[5], unit->bdaddr.b[4], + unit->bdaddr.b[3], unit->bdaddr.b[2], + unit->bdaddr.b[1], unit->bdaddr.b[0]); + } else { + devctl_notify("BLUETOOTH", "HCI", + "POWERED_OFF", sbuf_data(sb)); + } + + sbuf_delete(sb); + } } else return (EINVAL); @@ -371,6 +412,36 @@ ng_hci_default_rcvmsg(node_p node, item_p item, hook_p lasthook) ng_hci_node_is_up(unit->node, unit->acl, NULL, 0); ng_hci_node_is_up(unit->node, unit->sco, NULL, 0); + + /* Signal init to devd */ + { + struct sbuf *sb; + sb = sbuf_new_auto(); + sbuf_printf(sb, "node=%s bdaddr=", + NG_NODE_NAME(node)); + ng_hci_append_bdaddr_to_sbuf(sb, + &unit->bdaddr); + sbuf_printf(sb, "\n"); + + if (sbuf_finish(sb) > 0) { + log(LOG_WARNING, + "hci: failed to signal bt " \ + "device init to devd: " + "%02x:%02x:%02x:%02x:%02x:%02x\n", + unit->bdaddr.b[5], + unit->bdaddr.b[4], + unit->bdaddr.b[3], + unit->bdaddr.b[2], + unit->bdaddr.b[1], + unit->bdaddr.b[0]); + } else { + devctl_notify("BLUETOOTH", "HCI", + "INITIALIZED", sbuf_data(sb)); + } + + sbuf_delete(sb); + } + break; /* Get node debug level */ From nobody Sun Jul 12 19:50:36 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 4gyx4s48Ymz6ktJC for ; Sun, 12 Jul 2026 19:50:37 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gyx4r6hfbz3r5Z for ; Sun, 12 Jul 2026 19:50:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783885836; 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=xi/9qx0PkmMywv57Ppg0tCCpMPXDVIQZWHe8F2/M/GE=; b=nHYnTthown5ajxDMBuPNqhXsRBsFpCdmIu1E5XmM83h2teLZpECMt8NtZQ37vOcCwAMjfk Ny6xaWosZ4K1izie3fB/tk8ku50/PjDXkg3zrRvODP04OcMhx7nCmSKqJ6Xw2nETw4+Js1 PxNZmOEyDrHhbcve3pDtOElLBytHKNafxpoWLxLmpoXpYKZlQbGSbWTDgcz+Tdnuqi1/8D 7Bei5GhEVqHnizbAh6bERR93VXIc7GXZqS+JBcokRkzdqLbcdBy8wvt+GPJEUxEfaMjQFP 7v9VdeRlvGiyjk+R3GYRr4vX8P8ir0BwJfE8vfDJjdoFoYqBh8fbbd2da3NKRg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783885836; a=rsa-sha256; cv=none; b=NOyk1141NlDuCPkDM1TvDXylE+z++qdHHiwM32rV3bexplQl68b3G8XSBoiohkS/YXEB5O kAoQMemlDhtsRXjiRgAtJSisQT9zTcqbkdbvD6acIdLoqQbQ3hBPcQVv2NyLC+JyDYisNv Seby5pESYFovB7u8vzp3G9FFUMqjtByWa6Yh8C8UMTrsn66R+daqLIjJgwDwZ0bc3xfIv+ 4/6EIJ4zp5xPWazKZRJdv8yBx+3wLugb4hlv4K13lzg3CtHqQZz/fVP1DW1pjmQf09qYqp Bzwd42VjAlr+1mnK88VRF7Ig0Tz6rzqH0b8wfCvbIGHjCer+TtkUDmXLbSPbNQ== 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=1783885836; 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=xi/9qx0PkmMywv57Ppg0tCCpMPXDVIQZWHe8F2/M/GE=; b=jjN2+pEyhlYw++K+85D84IVR86U4iTyGc2VGqUKH+qgS3Fz1uRNk67vQahTSHs1SfNTlBt IOFeBwjc/c6QDXEIicm/lZP0HNquHROOn7sgwPyqQPu4YSrl7A4T5WdYSKwKCxlb6bnLSm Yjnk5EkeDSQfxeShCk8fZ/pGgBwgVbQUV9Ke+WTtVtqYh+pqsA+0DG5wSDU6we20rdOXhP DRBmmjVkKiVMRr+2Hafxy5dHm8UxzhiJZhH6eJObynvHS5LFWl55jUdmUUKLaJQb884PB6 swmOpsOpDcreWIPTNBUl3mizUtohG7c682Jk843eFhHlUxK7KjMGxQezyHdqfA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gyx4r54hmzB2k for ; Sun, 12 Jul 2026 19:50:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 316f0 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 12 Jul 2026 19:50:36 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 87fb416ac882 - main - usbdump: add -t to omit timestamps 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: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 87fb416ac8828d07fdf23a2c0d35d88efafce2af Auto-Submitted: auto-generated Date: Sun, 12 Jul 2026 19:50:36 +0000 Message-Id: <6a53f00c.316f0.4a20afe4@gitrepo.freebsd.org> The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=87fb416ac8828d07fdf23a2c0d35d88efafce2af commit 87fb416ac8828d07fdf23a2c0d35d88efafce2af Author: Kyle Evans AuthorDate: 2026-07-12 19:50:24 +0000 Commit: Kyle Evans CommitDate: 2026-07-12 19:50:24 +0000 usbdump: add -t to omit timestamps Matches tcpdump naming, but without getting more intense as you add more -t. This slightly reduces the post-processing needed on usbdump output to diff two transactions. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58196 --- usr.sbin/usbdump/usbdump.8 | 9 +++++++-- usr.sbin/usbdump/usbdump.c | 35 ++++++++++++++++++++++------------- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/usr.sbin/usbdump/usbdump.8 b/usr.sbin/usbdump/usbdump.8 index 96be9f738e2d..3c50f54d081e 100644 --- a/usr.sbin/usbdump/usbdump.8 +++ b/usr.sbin/usbdump/usbdump.8 @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 14, 2021 +.Dd July 12, 2026 .Dt USBDUMP 8 .Os .Sh NAME @@ -37,6 +37,7 @@ .Op Fl i Ar ifname .Op Fl r Ar file .Op Fl s Ar snaplen +.Op Fl t .Op Fl u .Op Fl v .Op Fl w Ar file @@ -90,6 +91,8 @@ This option also works with the -f option. Snapshot .Ar snaplen bytes from each packet. +.It Fl t +Do not print packet timestamps. .It Fl u Unbuffered output. .It Fl v @@ -140,7 +143,9 @@ is as follows: The meaning of the output format elements is as follows: .Bl -tag -width "" .It