From nobody Sun Dec 24 01:03:20 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SyN7r2Lgfz55GDy; Sun, 24 Dec 2023 01:03: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SyN7r1rN0z3PhP; Sun, 24 Dec 2023 01:03:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703379800; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+DvgX7zsCoLbmIyCLTaBK6sqAppWrGj50kKyKrdgOAU=; b=qdYY3gwclA9CqDLqClX1MYEYWlWHQIXGvYZ2UCjScrhtMwZovKw2ljBBZq4f0HeEmfdn+X GMGEaghM5ABVaTwd77KXrpHFL37T7u7lXT13kAjU+rvlZmkPRcEEBJrAModYdsnb9FLMsJ 5ZAizlhhT/MUGVtAaotJ03FlaCVoXls4c5xFXx88dI2xpbnZtby9NhqLdtEASOkDefGwqt OPnmd1rzIkcHKjOag411xx0BIufC42Jh4dyhHhI+0hbEwKaqa2H0v26G3Q3oGmF52+omVm C9qJ3Uj7nWM3aUP6MrwtYRWy3k0RzjXiAOZqxRrNZiin9qXql5shNsxTbrTAEw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703379800; a=rsa-sha256; cv=none; b=SVZM9+XBzwNDm2pUxPXUt6G6Q+RvH+U4ht/55sNeQJXzOTUkPbtl98psqFBgZ9z7bUlthB to758ib7PWeT8aFgLvt1kdGLF4yOXGKGik5NhC6vCiy2tzjyqRtS8IBV4tpWzDf4qS7TCQ uuFctKgxtNkYlRpN2x4IQt6xd7mugQpVh04aJM/9M5oo5E6oU+mifFj3/9eN3/M3526mYZ 5Z3R1whC4Y1W94bTOJUXintGTXZ1R5dGOPCH5NntH2HxIpW5HadTV020syznEbKQZgD6Nj 6z88VZVXYW0Aaejo+Dz4Ev70efpbEWoea9iXuwipMMaveHBIapIT0WsDD4Rd1A== 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=1703379800; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+DvgX7zsCoLbmIyCLTaBK6sqAppWrGj50kKyKrdgOAU=; b=xRcUfBOnkDsMpRLnF2B+tOqTB4bdyDcOpQnswQDvLsa3sph/lSadvxbFD4nZAoFo2rX9Ts 6fsL1kcnJH3oU1Vqj3bPQgvUTLmmCB02V960P7AeVLQKYfaY3YcQzCDUeJrkjgIWkDiZTq CcTjGSs0uVLNIXlCYOAjgiyT/CaK/JLA6DMCXBwzWxhDhXmxaeUeZvuTN25AN62eP+pv/x /L0LWVsPLyusHiqpXhjfnJXHfrcEmBp3YZyYhAW00SanhlK36kecQ9alsCoAbWwfvUUzuM nbUuhvUwP3iQscrbAUgAIKy2bKg4fxNj5m2mkNF93NHuRiZ5TubB+6Rn7luiVg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SyN7r0ttGz1LYb; Sun, 24 Dec 2023 01:03:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BO13KhC049814; Sun, 24 Dec 2023 01:03:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BO13K74049811; Sun, 24 Dec 2023 01:03:20 GMT (envelope-from git) Date: Sun, 24 Dec 2023 01:03:20 GMT Message-Id: <202312240103.3BO13K74049811@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 1ae724792ced - stable/14 - kgssapi: Add a new file with a function for a future commit List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 1ae724792ced8ea56ecc6a9c19b67741be9859cc Auto-Submitted: auto-generated The branch stable/14 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=1ae724792ced8ea56ecc6a9c19b67741be9859cc commit 1ae724792ced8ea56ecc6a9c19b67741be9859cc Author: Rick Macklem AuthorDate: 2023-10-23 20:17:16 +0000 Commit: Rick Macklem CommitDate: 2023-12-24 01:01:11 +0000 kgssapi: Add a new file with a function for a future commit A future commit needs a new upcall function that can do reverse DNS in order to generate a "service principal". This patch adds the file. (cherry picked from commit 428879dc9110240ad0940c7ac8cd69bcaf6e686e) --- sys/kgssapi/gss_ip_to_dns.c | 85 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/sys/kgssapi/gss_ip_to_dns.c b/sys/kgssapi/gss_ip_to_dns.c new file mode 100644 index 000000000000..d2be006d5b3e --- /dev/null +++ b/sys/kgssapi/gss_ip_to_dns.c @@ -0,0 +1,85 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2008 Isilon Inc http://www.isilon.com/ + * Authors: Doug Rabson + * Developed with Red Inc: Alfred Perlstein + * + * 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 + +#include "gssd.h" + +OM_uint32 +gss_ip_to_dns(OM_uint32 *minor_status, + char *ip_addr, + char *dns_name) +{ + struct ip_to_dns_res res; + struct ip_to_dns_args args; + enum clnt_stat stat; + CLIENT *cl; + + *minor_status = 0; + cl = kgss_gssd_client(); + if (cl == NULL) + return (GSS_S_FAILURE); + + args.ip_addr.ip_addr_len = strlen(ip_addr); + args.ip_addr.ip_addr_val = mem_alloc(args.ip_addr.ip_addr_len); + memcpy(args.ip_addr.ip_addr_val, ip_addr, args.ip_addr.ip_addr_len); + + bzero(&res, sizeof(res)); + stat = gssd_ip_to_dns_1(&args, &res, cl); + CLNT_RELEASE(cl); + if (stat != RPC_SUCCESS) { + *minor_status = stat; + return (GSS_S_FAILURE); + } + + if (res.major_status != GSS_S_COMPLETE) { + *minor_status = res.minor_status; + return (res.major_status); + } + + if (res.dns_name.dns_name_len == 0 || + res.dns_name.dns_name_len >= NI_MAXHOST) { + *minor_status = 0; + return (GSS_S_FAILURE); + } + + memcpy(dns_name, res.dns_name.dns_name_val, res.dns_name.dns_name_len); + dns_name[res.dns_name.dns_name_len] = '\0'; + + return (GSS_S_COMPLETE); +} From nobody Sun Dec 24 01:06:25 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SyNCQ1Y3bz55G9F; Sun, 24 Dec 2023 01:06: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SyNCQ0kHwz3QP1; Sun, 24 Dec 2023 01:06:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703379986; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZsjOb928o4GeWSPAIlkfjSJnBnbQhvBOCf78UANhbak=; b=BL80c6xpyjWFtvSl7M+QN8xbwpMDde9RzriPVfD9WAFUjGW+QMhXGzsWWLOIvEkmjGJGM7 mmlAh+/YM0l3O/5akay2tpZ96FKq0Jus1Xi0iqC8gBb3tCHjbrGK1swEffoqUDOwA9ctpg ehegvoZzZarzwpt/spKkGXP2hUL5BOJPBtiJq20DMBKr9PdhMeQdlr6R5hCV5ez28oH40x XMBa6zQ078HTxdrunekT/+3bqShA/GPGpcMPlxSd88CUVzoIejLQoUrJBkfFiTKMQovqNz eQllfmKPaOxHJj7MILIn4LCj1l3A2QQCiYYkfPG/qZ/p5ZLDdXBZLzYTp5SySQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703379986; a=rsa-sha256; cv=none; b=RqLalH5iG5p/gl0GaYzbpfXqEM1EnVhMLjh9/B++ydIoc+mit9R+q8GgItWXrM6qKe0IVt vSwWajB6vLGb3VSX3vnxg+vRYlcxtQvtc5c7y5k5w96arX/0CDvZbhif2ukYlbVJ2dgC03 BeQMPxux7+WANx9QAKXMjp1Ycibxn1rA6SCR0cVN4grGkRy3MyvbT7Kz06R5hVjXztWiuz cdoVLgj6vvK1wukk1xKTYJztNIpkmf+9/wFfyR5vCaQJ6mHK+0FWSwyXcZJZtT2hmFfTD/ MGIm+2hlBJRvBQMWhn24pXYzQrsMTw58OOh/iz9MdwXHFCH+ZC3QfjUFFR94Mw== 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=1703379986; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZsjOb928o4GeWSPAIlkfjSJnBnbQhvBOCf78UANhbak=; b=OvvZstxBzZedNXLvhXAgt0z9VjEsNOJERIQFnru4OtZOrCHvZ6TDi0XGMpraKlc3iT0BjJ gULaTEq/8K20s/MT64rMomJwtQMIlsteBEzjILw//kYqYxeMSD8YTjbOFk8YK3FWs9j8AI wX9rqMyeXEO6+i9ym6ebkS2sG8lPM3Pw3wYHkC/45IYkhQ3xNQBYKuPdd8eWAZpgO0nChO W2mQNLQLEs423RbVRACBTLMVJ1Fb1sjKq5cuL1cIA9e81Qqr/0zpqHzhuDPozqlBieTEDB U30OPGYiS/aAmbkmztQypL+uFzz6f1Cy2oEYtO1nkODx06w+ZBfj0prsCX3uaQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SyNCP6bGGz1LYd; Sun, 24 Dec 2023 01:06:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BO16Pgt050304; Sun, 24 Dec 2023 01:06:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BO16P9W050301; Sun, 24 Dec 2023 01:06:25 GMT (envelope-from git) Date: Sun, 24 Dec 2023 01:06:25 GMT Message-Id: <202312240106.3BO16P9W050301@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: b9410313c66d - stable/14 - nfscl/kgssapi: Fix Kerberized NFS mounts to pNFS servers List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b9410313c66d8a23e51a5d2c9730cee7e1586317 Auto-Submitted: auto-generated The branch stable/14 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=b9410313c66d8a23e51a5d2c9730cee7e1586317 commit b9410313c66d8a23e51a5d2c9730cee7e1586317 Author: Rick Macklem AuthorDate: 2023-10-23 20:21:14 +0000 Commit: Rick Macklem CommitDate: 2023-12-24 01:03:58 +0000 nfscl/kgssapi: Fix Kerberized NFS mounts to pNFS servers During recent testing related to the IETF NFSv4 Bakeathon, it was discovered that Kerberized NFSv4.1/4.2 mounts to pNFS servers (sec=krb5[ip],pnfs mount options) was broken. The FreeBSD client was using the "service principal" for the MDS to try and establish a rpcsec_gss credential for a DS, which is incorrect. (A "service principal" looks like "nfs@" and the for the DS is not the same as the MDS for most pNFS servers.) To fix this, the rpcsec_gss code needs to be able to do a reverse DNS lookup of the DS's IP address. A new kgssapi upcall to the gssd(8) daemon is added by this patch to do the reverse DNS along with a new rpcsec_gss function to generate the "service principal". A separate patch to the gssd(8) will be committed, so that this patch will fix the problem. Without the gssd(8) patch, the new upcall fails and current/incorrect behaviour remains. This bug only affects the rare case of a Kerberized (sec=krb5[ip],pnfs) mount using pNFS. This patch changes the internal KAPI between the kgssapi and nfscl modules, but since I did a version bump a few days ago, I will not do one this time. (cherry picked from commit dd7d42a1fae5a4879b62689a165238082421f343) --- sys/conf/files | 1 + sys/fs/nfs/nfs.h | 1 + sys/fs/nfs/nfs_commonkrpc.c | 13 ++++++++--- sys/fs/nfsclient/nfs_clrpcops.c | 44 +++++++++++++++++++++++++++++++++++-- sys/kgssapi/gss_impl.c | 2 ++ sys/kgssapi/gssapi.h | 18 +++++++++++++++ sys/kgssapi/gssd.x | 14 ++++++++++++ sys/modules/kgssapi/Makefile | 1 + sys/rpc/rpcsec_gss.h | 17 ++++++++++++++ sys/rpc/rpcsec_gss/svc_rpcsec_gss.c | 31 ++++++++++++++++++++++++++ 10 files changed, 137 insertions(+), 5 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index f737f6ca6352..a8c1893b1341 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3983,6 +3983,7 @@ kgssapi/gss_get_mic.c optional kgssapi kgssapi/gss_init_sec_context.c optional kgssapi kgssapi/gss_impl.c optional kgssapi kgssapi/gss_import_name.c optional kgssapi +kgssapi/gss_ip_to_dns.c optional kgssapi kgssapi/gss_names.c optional kgssapi kgssapi/gss_pname_to_uid.c optional kgssapi kgssapi/gss_release_buffer.c optional kgssapi diff --git a/sys/fs/nfs/nfs.h b/sys/fs/nfs/nfs.h index 0ed96fe43c0a..9b09520b3257 100644 --- a/sys/fs/nfs/nfs.h +++ b/sys/fs/nfs/nfs.h @@ -636,6 +636,7 @@ struct nfssockreq { u_int32_t nr_vers; struct __rpc_client *nr_client; AUTH *nr_auth; + char nr_srvprinc[1]; }; /* diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c index 29fbb8dc4351..7ca150d4f54c 100644 --- a/sys/fs/nfs/nfs_commonkrpc.c +++ b/sys/fs/nfs/nfs_commonkrpc.c @@ -599,10 +599,14 @@ nfs_getauth(struct nfssockreq *nrp, int secflavour, char *clnt_principal, else svc = rpc_gss_svc_privacy; - if (clnt_principal == NULL) + if (clnt_principal == NULL) { + NFSCL_DEBUG(1, "nfs_getauth: clnt princ=NULL, " + "srv princ=%s\n", srv_principal); auth = rpc_gss_secfind_call(nrp->nr_client, cred, srv_principal, mech_oid, svc); - else { + } else { + NFSCL_DEBUG(1, "nfs_getauth: clnt princ=%s " + "srv princ=%s\n", clnt_principal, srv_principal); auth = rpc_gss_seccreate_call(nrp->nr_client, cred, clnt_principal, srv_principal, "kerberosv5", svc, NULL, NULL, NULL); @@ -799,7 +803,10 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, secflavour = RPCSEC_GSS_KRB5P; else secflavour = RPCSEC_GSS_KRB5; - srv_principal = NFSMNT_SRVKRBNAME(nmp); + if (nrp->nr_srvprinc[0] == '\0') + srv_principal = NFSMNT_SRVKRBNAME(nmp); + else + srv_principal = nrp->nr_srvprinc; } else if (nmp != NULL && (!NFSHASKERB(nmp) || NFSHASSYSKRB5(nmp)) && nd->nd_procnum != NFSPROC_NULL && (nd->nd_flag & ND_USEGSSNAME) != 0) { diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 12ce568dbedd..9d56d06c1c84 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -6019,7 +6019,27 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_in *sin, sad->sin_family = AF_INET; sad->sin_port = sin->sin_port; sad->sin_addr.s_addr = sin->sin_addr.s_addr; - nrp = malloc(sizeof(*nrp), M_NFSSOCKREQ, M_WAITOK | M_ZERO); + if (NFSHASPNFS(nmp) && NFSHASKERB(nmp)) { + /* For pNFS, a separate server principal is needed. */ + nrp = malloc(sizeof(*nrp) + NI_MAXSERV + NI_MAXHOST, + M_NFSSOCKREQ, M_WAITOK | M_ZERO); + /* + * Use the latter part of nr_srvprinc as a temporary + * buffer for the IP address. + */ + inet_ntoa_r(sad->sin_addr, + &nrp->nr_srvprinc[NI_MAXSERV]); + NFSCL_DEBUG(1, "nfsrpc_fillsa: DS IP=%s\n", + &nrp->nr_srvprinc[NI_MAXSERV]); + if (!rpc_gss_ip_to_srv_principal_call( + &nrp->nr_srvprinc[NI_MAXSERV], "nfs", + nrp->nr_srvprinc)) + nrp->nr_srvprinc[0] = '\0'; + NFSCL_DEBUG(1, "nfsrpc_fillsa: srv principal=%s\n", + nrp->nr_srvprinc); + } else + nrp = malloc(sizeof(*nrp), M_NFSSOCKREQ, + M_WAITOK | M_ZERO); nrp->nr_nam = (struct sockaddr *)sad; } else if (af == AF_INET6) { NFSLOCKMNT(nmp); @@ -6058,7 +6078,27 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_in *sin, sad6->sin6_port = sin6->sin6_port; NFSBCOPY(&sin6->sin6_addr, &sad6->sin6_addr, sizeof(struct in6_addr)); - nrp = malloc(sizeof(*nrp), M_NFSSOCKREQ, M_WAITOK | M_ZERO); + if (NFSHASPNFS(nmp) && NFSHASKERB(nmp)) { + /* For pNFS, a separate server principal is needed. */ + nrp = malloc(sizeof(*nrp) + NI_MAXSERV + NI_MAXHOST, + M_NFSSOCKREQ, M_WAITOK | M_ZERO); + /* + * Use the latter part of nr_srvprinc as a temporary + * buffer for the IP address. + */ + inet_ntop(AF_INET6, &sad6->sin6_addr, + &nrp->nr_srvprinc[NI_MAXSERV], NI_MAXHOST); + NFSCL_DEBUG(1, "nfsrpc_fillsa: DS IP=%s\n", + &nrp->nr_srvprinc[NI_MAXSERV]); + if (!rpc_gss_ip_to_srv_principal_call( + &nrp->nr_srvprinc[NI_MAXSERV], "nfs", + nrp->nr_srvprinc)) + nrp->nr_srvprinc[0] = '\0'; + NFSCL_DEBUG(1, "nfsrpc_fillsa: srv principal=%s\n", + nrp->nr_srvprinc); + } else + nrp = malloc(sizeof(*nrp), M_NFSSOCKREQ, + M_WAITOK | M_ZERO); nrp->nr_nam = (struct sockaddr *)sad6; } else return (EPERM); diff --git a/sys/kgssapi/gss_impl.c b/sys/kgssapi/gss_impl.c index 2bb785b63345..ae37cb646f1f 100644 --- a/sys/kgssapi/gss_impl.c +++ b/sys/kgssapi/gss_impl.c @@ -338,6 +338,8 @@ kgssapi_modevent(module_t mod, int type, void *data) rpc_gss_get_principal_name; rpc_gss_entries.rpc_gss_svc_max_data_length = rpc_gss_svc_max_data_length; + rpc_gss_entries.rpc_gss_ip_to_srv_principal = + rpc_gss_ip_to_srv_principal; mtx_init(&kgss_gssd_lock, "kgss_gssd_lock", NULL, MTX_DEF); error = kgss_load(); break; diff --git a/sys/kgssapi/gssapi.h b/sys/kgssapi/gssapi.h index ef9181bf1251..37cc8a1a5a09 100644 --- a/sys/kgssapi/gssapi.h +++ b/sys/kgssapi/gssapi.h @@ -372,6 +372,18 @@ extern gss_OID GSS_KRB5_NT_STRING_UID_NAME; #define GSS_S_GAP_TOKEN \ (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 4)) +/* + * NI_MAXSERV and NI_MAXHOST. The srv_principal argument for + * rpc_gss_ip_to_srv_principal should point to at least + * NI_MAXSERV + NI_MAXHOST + 1 bytes of storage. The "+ 1" is for the '@'. + * The NI_MAXHOST limit is checked for gss_ip_to_dns(). + * These should be set to the same value as they are in . + */ +#ifndef NI_MAXHOST +#define NI_MAXSERV 32 +#define NI_MAXHOST 1025 +#endif + __BEGIN_DECLS /* @@ -568,6 +580,12 @@ OM_uint32 gss_pname_to_unix_cred gid_t *groups /* pointer to group list */ ); +OM_uint32 gss_ip_to_dns + (OM_uint32 *, /* minor status */ + char *ip_addr, /* IP host address string */ + char *dns_name /* pointer to dns_name for result */ + ); + /* * Mbuf oriented message signing and encryption. * diff --git a/sys/kgssapi/gssd.x b/sys/kgssapi/gssd.x index 29503ac8599f..b50f39b33554 100644 --- a/sys/kgssapi/gssd.x +++ b/sys/kgssapi/gssd.x @@ -32,6 +32,7 @@ %#include %#else %#include +%#include %#endif %extern bool_t xdr_gss_buffer_desc(XDR *xdrs, gss_buffer_desc *buf); @@ -218,6 +219,16 @@ struct display_status_args { uint32_t message_context; }; +struct ip_to_dns_res { + uint32_t major_status; + uint32_t minor_status; + char dns_name; +}; + +struct ip_to_dns_args { + char ip_addr; +}; + program GSSD { version GSSDVERS { void GSSD_NULL(void) = 0; @@ -260,5 +271,8 @@ program GSSD { display_status_res GSSD_DISPLAY_STATUS(display_status_args) = 13; + + ip_to_dns_res + GSSD_IP_TO_DNS(ip_to_dns_args) = 14; } = 1; } = 0x40677373; diff --git a/sys/modules/kgssapi/Makefile b/sys/modules/kgssapi/Makefile index 2cf36246137c..a3eb812fd6e6 100644 --- a/sys/modules/kgssapi/Makefile +++ b/sys/modules/kgssapi/Makefile @@ -14,6 +14,7 @@ SRCS= gss_accept_sec_context.c \ gss_init_sec_context.c \ gss_impl.c \ gss_import_name.c \ + gss_ip_to_dns.c \ gss_names.c \ gss_pname_to_uid.c \ gss_release_buffer.c \ diff --git a/sys/rpc/rpcsec_gss.h b/sys/rpc/rpcsec_gss.h index 51381762fe29..2475f61a057e 100644 --- a/sys/rpc/rpcsec_gss.h +++ b/sys/rpc/rpcsec_gss.h @@ -184,6 +184,8 @@ typedef bool_t rpc_gss_get_principal_name_ftype(rpc_gss_principal_t *principal, typedef int rpc_gss_svc_max_data_length_ftype(struct svc_req *req, int max_tp_unit_len); typedef void rpc_gss_refresh_auth_ftype(AUTH *auth); +typedef bool_t rpc_gss_ip_to_srv_principal_ftype(char *ip_addr, + const char *srv_name, char *dns_name); struct rpc_gss_entries { rpc_gss_secfind_ftype *rpc_gss_secfind; @@ -206,6 +208,7 @@ struct rpc_gss_entries { rpc_gss_get_principal_name_ftype *rpc_gss_get_principal_name; rpc_gss_svc_max_data_length_ftype *rpc_gss_svc_max_data_length; rpc_gss_refresh_auth_ftype *rpc_gss_refresh_auth; + rpc_gss_ip_to_srv_principal_ftype *rpc_gss_ip_to_srv_principal; }; extern struct rpc_gss_entries rpc_gss_entries; @@ -417,6 +420,18 @@ rpc_gss_refresh_auth_call(AUTH *auth) (*rpc_gss_entries.rpc_gss_refresh_auth)(auth); } +static __inline bool_t +rpc_gss_ip_to_srv_principal_call(char *ip_addr, const char *srv_name, + char *dns_name) +{ + bool_t ret = FALSE; + + if (rpc_gss_entries.rpc_gss_ip_to_srv_principal != NULL) + ret = (*rpc_gss_entries.rpc_gss_ip_to_srv_principal)(ip_addr, + srv_name, dns_name); + return (ret); +} + AUTH *rpc_gss_secfind(CLIENT *clnt, struct ucred *cred, const char *principal, gss_OID mech_oid, rpc_gss_service_t service); void rpc_gss_secpurge(CLIENT *clnt); @@ -455,6 +470,8 @@ void rpc_gss_clear_callback(rpc_gss_callback_t *cb); bool_t rpc_gss_get_principal_name(rpc_gss_principal_t *principal, const char *mech, const char *name, const char *node, const char *domain); int rpc_gss_svc_max_data_length(struct svc_req *req, int max_tp_unit_len); +bool_t rpc_gss_ip_to_srv_principal(char *ip_addr, const char *srv_name, + char *dns_name); /* * Internal interface from the RPC implementation. diff --git a/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c b/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c index 2707c5ed0582..90aa9e0d7d4f 100644 --- a/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c +++ b/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c @@ -457,6 +457,37 @@ rpc_gss_get_principal_name(rpc_gss_principal_t *principal, return (TRUE); } +/* + * Note that the ip_addr and srv_principal pointers can point to the same + * buffer, so long as ip_addr is at least strlen(srv_name) + 1 > srv_principal. + */ +bool_t +rpc_gss_ip_to_srv_principal(char *ip_addr, const char *srv_name, + char *srv_principal) +{ + OM_uint32 maj_stat, min_stat; + size_t len; + + /* + * First fill in the service name and '@'. + */ + len = strlen(srv_name); + if (len > NI_MAXSERV) + return (FALSE); + memcpy(srv_principal, srv_name, len); + srv_principal[len] = '@'; + + /* + * Do reverse DNS to get the DNS name for the ip_addr. + */ + maj_stat = gss_ip_to_dns(&min_stat, ip_addr, &srv_principal[len + 1]); + if (maj_stat != GSS_S_COMPLETE) { + rpc_gss_log_status("gss_ip_to_dns", NULL, maj_stat, min_stat); + return (FALSE); + } + return (TRUE); +} + bool_t rpc_gss_getcred(struct svc_req *req, rpc_gss_rawcred_t **rcred, rpc_gss_ucred_t **ucred, void **cookie) From nobody Sun Dec 24 01:08:07 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SyNFM3zZ1z55GFt; Sun, 24 Dec 2023 01:08: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SyNFM32WMz3Qmw; Sun, 24 Dec 2023 01:08:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703380087; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=39HIJBWszaYEfd0xYvwVTSQHiXSgHmM2xYA/apTPi14=; b=hLoNjWR58aaItomRbk7UYxdjp8hgVPCODYhBG/oT8YF+XPhgTWkxktNjB22mQR2gEdGJQJ 7vLMggKEV/hK7cCRKFn9Jr6y2v6NiEqpRqG/QcJa/mWL22C40s8LzFFnNyd7CEY0fezbrb XodsfaNlZKEf3Pgn5gQgcyVW4DhEpJsG2eBvZ05g8YYoq0acrlccXnQ5kIstKv19C4rzqh YCcQCFC6aqbx768KRGAlpU7gq8UtWH/VZLNMWUgIP0U+yVjgQsr5VsGz1GKwXHJC3etSpt 1cGfMtCrBNP/b1iP5wLgRGCyP97jTEKkYKuPzPMTLcvO5p9Znlww6K41PGQC5Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703380087; a=rsa-sha256; cv=none; b=Jhgsfuz8EH1lWMhPupSn3aV9z+6ruip2QoIPMDpAPhR7IpHnb08Z+MzeYAnbJJPPYBEaaP n/8lwqCFl42W1P8QGCuymvUx9CYKPSGF2LcZAjBV3snl5idzavooegu1GRkH4DaSggnS3Y aryRUQnTR7VViviBuwLNe81egoxhuTFYHI9PEMHraB7p8heYkW5nlb5G4pMLO5HGHXa9Rf IBuESdrjy3gEeAXoJ9bi6hV84c/ROHfclUDVR3wWZDsHSu8TGMRRFwDVQwnbue/hHBGgg/ Zi6Zz9TAX3D/Rpyv/XgBW0FFUDwJgbByJioNy2+pQS6QB2usLlomfoVDP2WOIw== 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=1703380087; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=39HIJBWszaYEfd0xYvwVTSQHiXSgHmM2xYA/apTPi14=; b=CLZZnhMjC4iMFkRpAp0e+3eCPkrBQZS1kwnLVrKBoBQgNWi2S89B7PaeMb0ifYMjqWTnmM ThDEhGw1ahnaIGTOHQ4vIjnLCv2pNF88zAltA7/wln+dyiHdAHO/TXq0ay3xJ9PfXJBo+T /lTEe7NK2HVt8Hy2jBCXic+kX/i/h7cYwqzYXT/tJ8YsNi6zb47mOWyOCQ/ax1VcPZYQri Jt1rgHoEc2s+XdK/pgaGXqoElrTYG05g6rQTvsLZ0wI1O1ABaOsGklgQirtblLJI5Q1nIX AVmuQvA/qL7s5wuN6MCPOXLQJKxmm2fnc7viv2jwIfKD3Uielw/Fj/vRgfWp+w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SyNFM254fz1LSS; Sun, 24 Dec 2023 01:08:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BO187MH050670; Sun, 24 Dec 2023 01:08:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BO187jw050667; Sun, 24 Dec 2023 01:08:07 GMT (envelope-from git) Date: Sun, 24 Dec 2023 01:08:07 GMT Message-Id: <202312240108.3BO187jw050667@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: acc704b36192 - stable/14 - gssd: Add support for the new upcall required by commit 428879dc9110 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: acc704b36192dce117ef0d748be1d057e3fac9d0 Auto-Submitted: auto-generated The branch stable/14 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=acc704b36192dce117ef0d748be1d057e3fac9d0 commit acc704b36192dce117ef0d748be1d057e3fac9d0 Author: Rick Macklem AuthorDate: 2023-10-23 21:41:26 +0000 Commit: Rick Macklem CommitDate: 2023-12-24 01:06:54 +0000 gssd: Add support for the new upcall required by commit 428879dc9110 Commit 428879dc9110 adds a requirement for a new upcall for the gssd(8). This patch adds that upcall. Unfortunately, the old gssd.c would not build against the new patched gssd.x. This patch will fix the build. (cherry picked from commit 82ea0132c8b17a7a6067c8a36c6434e587ede6de) --- usr.sbin/gssd/gssd.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/usr.sbin/gssd/gssd.c b/usr.sbin/gssd/gssd.c index 59e0fc057f84..a22891f3bebf 100644 --- a/usr.sbin/gssd/gssd.c +++ b/usr.sbin/gssd/gssd.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -42,6 +43,7 @@ #ifndef WITHOUT_KERBEROS #include #endif +#include #include #include #include @@ -49,6 +51,8 @@ #include #include #include +#include +#include #include #include #include @@ -624,6 +628,51 @@ gssd_import_name_1_svc(import_name_args *argp, import_name_res *result, struct s return (TRUE); } +/* + * If the name is a numeric IP host address, do a DNS lookup on it and + * return the DNS name in a malloc'd string. + */ +static char * +gssd_conv_ip_to_dns(int len, char *name) +{ + struct sockaddr_in sin; + struct sockaddr_in6 sin6; + char *retcp; + + retcp = NULL; + if (len > 0) { + retcp = mem_alloc(NI_MAXHOST); + memcpy(retcp, name, len); + retcp[len] = '\0'; + if (inet_pton(AF_INET, retcp, &sin.sin_addr) != 0) { + sin.sin_family = AF_INET; + sin.sin_len = sizeof(sin); + sin.sin_port = 0; + if (getnameinfo((struct sockaddr *)&sin, + sizeof(sin), retcp, NI_MAXHOST, + NULL, 0, NI_NAMEREQD) != 0) { + mem_free(retcp, NI_MAXHOST); + return (NULL); + } + } else if (inet_pton(AF_INET6, retcp, &sin6.sin6_addr) != 0) { + sin6.sin6_family = AF_INET6; + sin6.sin6_len = sizeof(sin6); + sin6.sin6_port = 0; + if (getnameinfo((struct sockaddr *)&sin6, + sizeof(sin6), retcp, NI_MAXHOST, + NULL, 0, NI_NAMEREQD) != 0) { + mem_free(retcp, NI_MAXHOST); + return (NULL); + } + } else { + mem_free(retcp, NI_MAXHOST); + return (NULL); + } + gssd_verbose_out("gssd_conv_ip_to_dns: %s\n", retcp); + } + return (retcp); +} + bool_t gssd_canonicalize_name_1_svc(canonicalize_name_args *argp, canonicalize_name_res *result, struct svc_req *rqstp) { @@ -933,6 +982,25 @@ gssd_display_status_1_svc(display_status_args *argp, display_status_res *result, return (TRUE); } +bool_t +gssd_ip_to_dns_1_svc(ip_to_dns_args *argp, ip_to_dns_res *result, struct svc_req *rqstp) +{ + char *host; + + memset(result, 0, sizeof(*result)); + /* Check to see if the name is actually an IP address. */ + host = gssd_conv_ip_to_dns(argp->ip_addr.ip_addr_len, + argp->ip_addr.ip_addr_val); + if (host != NULL) { + result->major_status = GSS_S_COMPLETE; + result->dns_name.dns_name_len = strlen(host); + result->dns_name.dns_name_val = host; + return (TRUE); + } + result->major_status = GSS_S_FAILURE; + return (TRUE); +} + int gssd_1_freeresult(SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result) { From nobody Sun Dec 24 01:43:21 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SyP2138m5z55JCs; Sun, 24 Dec 2023 01:43: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SyP212w7sz3Tx1; Sun, 24 Dec 2023 01:43:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703382201; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=t4sg5UF+4I458SHdTDWf14Nk+aEDyEH9ymQMnNrfCHg=; b=eGwFGUlG/NjJVlH5VNaQTjulBJWephwE+ahhE6lvBn7J8eln23WaNL89ZyUW+z6cEO0Ya3 AMRMs5dF17v6P9Teu1OXVLFx5anYIviNZDshprhSEwYlnoMZRfTL1Bizh3iAIvHbFnCfWR /kV4BxR4KOR1SeHGyFzPSaoCGWXd2Y8k1+K0h6Y+mEeqgI5I4GiEyubzVgPNEwe8/6Z2qb 6eb+6MA8TF1qskk1FCMFJIqZatJZZ3F1ScbeXFg6svaR8FwbLPJQYRja6zpAEytapoeYS9 GkMYiuT9Oxqp1JKquLJrMwoHODf9twJk7tIQnzSvMlc2rPODvCG4quFHtkOG/w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703382201; a=rsa-sha256; cv=none; b=L7/fN50Hr/KwXCj6TQHfNxGGp+zA6zIaVb9nR8bnel7+UKpVCiFh4evHaFuYVQkTy9QSa+ H9tFrsUMKXVjaC6qrzZfE+xQ+4hh3J875WBk63Bso6F8ooiUsA5j7BUUXrgClboNCdleIw wreU3gTT4Mr4vSB1NslDMULWQM5PP4UKC5n5EPPdAR8RgQtlKzeyVpomzO63sANebszdKu Nwex1wsWpj+CGf4Idi/ITY6YR+hZqWlHGvghzvoIvvS5DMroTC6sFTxyGfC2UeUGTuiy1j g3mgzpjYqCjqsoliH43EOC5jiPpKF9o09OYLxBqRZbN8hluZE5pMMKjWK34B+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=1703382201; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=t4sg5UF+4I458SHdTDWf14Nk+aEDyEH9ymQMnNrfCHg=; b=LtOchZr2LyA0Saw7sRimZNj/Rkl10bcuUAHDXufCv2poUsreCwbv1sEX7qwuHNVHfibFGq FTwlbKdPsO/tDyiceDUaCAsw84xc+sAKj2r60ntuudGK2rgKE8P4ZypM4vuIIMjozub8rA 06EloQMquY7uaBRXjo/9NQVnwImdQ8DN8GWTSizsWHNrrKipL4sc5DfhNshHUKT1y5ian3 +pC1wIr6LuF4wcXui1OXpr5U3XAUxYBoa/UizNOcploI6Uv1i5Kvzb8T8THh0B8FP3fuxf uji2eM+ekgRHXceoEnHRSKkgoIQi0ttls+7FMzg7jr0RWh6ZlyQPkxzfuHFkvw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SyP211y8bz1Mb6; Sun, 24 Dec 2023 01:43:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BO1hLkP016128; Sun, 24 Dec 2023 01:43:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BO1hLuH016125; Sun, 24 Dec 2023 01:43:21 GMT (envelope-from git) Date: Sun, 24 Dec 2023 01:43:21 GMT Message-Id: <202312240143.3BO1hLuH016125@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Philip Paeps Subject: git: b277fb9996b1 - stable/14 - contrib/tzdata: import tzdata 2023d List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b277fb9996b1c52235647442f88de7403782c6ac Auto-Submitted: auto-generated The branch stable/14 has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=b277fb9996b1c52235647442f88de7403782c6ac commit b277fb9996b1c52235647442f88de7403782c6ac Author: Philip Paeps AuthorDate: 2023-12-23 01:51:01 +0000 Commit: Philip Paeps CommitDate: 2023-12-24 01:41:47 +0000 contrib/tzdata: import tzdata 2023d Changes: https://github.com/eggert/tz/blob/2023d/NEWS (cherry picked from commit eebb9c2caea1584773ae4cec311cee1eea5b1655) --- contrib/tzdata/Makefile | 209 ++++++++++++++++++--------- contrib/tzdata/NEWS | 125 ++++++++++++++-- contrib/tzdata/README | 19 +-- contrib/tzdata/africa | 7 - contrib/tzdata/antarctica | 57 +++++++- contrib/tzdata/asia | 6 +- contrib/tzdata/australasia | 8 +- contrib/tzdata/backward | 1 - contrib/tzdata/backzone | 29 ---- contrib/tzdata/checknow.awk | 54 +++++++ contrib/tzdata/checktab.awk | 7 +- contrib/tzdata/europe | 29 +++- contrib/tzdata/leap-seconds.list | 8 +- contrib/tzdata/leapseconds | 8 +- contrib/tzdata/northamerica | 2 +- contrib/tzdata/southamerica | 6 + contrib/tzdata/version | 2 +- contrib/tzdata/zone.tab | 24 ++-- contrib/tzdata/zone1970.tab | 29 ++-- contrib/tzdata/zonenow.tab | 301 +++++++++++++++++++++++++++++++++++++++ 20 files changed, 763 insertions(+), 168 deletions(-) diff --git a/contrib/tzdata/Makefile b/contrib/tzdata/Makefile index 6edc73cc6ffb..4e45f93b915c 100644 --- a/contrib/tzdata/Makefile +++ b/contrib/tzdata/Makefile @@ -1,7 +1,25 @@ # 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: +# On older platforms you may need to scrounge for a POSIX-conforming 'make'. +# For example, on Solaris 10 (2005), use /usr/sfw/bin/gmake or +# /usr/xpg4/bin/make, not /usr/ccs/bin/make. + +# To affect how this Makefile works, you can run a shell script like this: +# +# #!/bin/sh +# make CC='gcc -std=gnu11' "$@" +# +# This example script is appropriate for a pre-2017 GNU/Linux system +# where a non-default setting is needed to support this package's use of C99. +# +# 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 @@ -191,8 +209,9 @@ UTF8_LOCALE= en_US.utf8 # On some hosts, this should have -lintl unless CFLAGS has -DHAVE_GETTEXT=0. LDLIBS= -# Add the following to the end of the "CFLAGS=" line as needed to override -# defaults specified in the source code. "-DFOO" is equivalent to "-DFOO=1". +# 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 @@ -234,11 +253,16 @@ LDLIBS= # -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 -# -DPORT_TO_C89 if tzcode should also run on C89 platforms+ +# -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=long on hosts like MS-Windows that lack ssize_t # -DSUPPORT_C89 if the tzcode library should support C89 callers+ +# However, this might trigger latent bugs in C99-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; @@ -270,11 +294,15 @@ LDLIBS= # -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. +# once the code assumes C99 or later, say in the year 2029. # # Select instrumentation via "make GCC_INSTRUMENT='whatever'". GCC_INSTRUMENT = \ @@ -353,9 +381,11 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \ # 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. -# "timelocal" is equivalent to "mktime". +# I.e., "offtime" is 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 @@ -378,7 +408,7 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \ # # 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 +# which claims to test C and POSIX conformance. If you want to pass PCTS, add # -DPCTS # to the end of the "CFLAGS=" line. # @@ -388,13 +418,21 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \ # 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= +#CFLAGS= -O 1 -# Linker flags. Default to $(LFLAGS) for backwards compatibility -# to release 2012h and earlier. -LDFLAGS= $(LFLAGS) +# 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 202x/D3. +#AR = ar +#ARFLAGS = -rv +#CC = c17 +#LDFLAGS = +#MAKE = make # For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in # submake command lines. The default is no leap seconds. @@ -418,18 +456,18 @@ ZFLAGS= ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS) -# The name of a Posix-compliant 'awk' on your system. +# 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. AWK= awk -# The full path name of a Posix-compliant shell, preferably one that supports +# 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 +# lacks 'select' or doesn't completely conform to POSIX, but /bin/bash # is typically nicer if it works. KSHELL= /bin/bash @@ -503,17 +541,16 @@ GZIPFLAGS= -9n DIFF_TZS= diff -u$$(! diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1 \ || echo ' -F^TZ=') -############################################################################### - -#MAKE= make +# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. +RANLIB= : -cc= cc -CC= $(cc) -DTZDIR='"$(TZDIR)"' +# 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 -AR= ar +# End of macros that one plausibly might want to tailor. +############################################################################### -# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. -RANLIB= : TZCOBJS= zic.o TZDOBJS= zdump.o localtime.o asctime.o strftime.o @@ -543,7 +580,7 @@ YDATA= $(PRIMARY_YDATA) etcetera NDATA= factory TDATA_TO_CHECK= $(YDATA) $(NDATA) backward TDATA= $(YDATA) $(NDATA) $(BACKWARD) -ZONETABLES= zone1970.tab zone.tab +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) \ @@ -551,7 +588,7 @@ TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) \ DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST) DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ leapseconds $(ZONETABLES) -AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk \ +AWK_SCRIPTS= checklinks.awk checknow.awk checktab.awk leapseconds.awk \ ziguard.awk zishrink.awk MISC= $(AWK_SCRIPTS) TZS_YEAR= 2050 @@ -572,7 +609,7 @@ VERSION_DEPS= \ calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \ africa antarctica asctime.c asia australasia \ backward backzone \ - checklinks.awk checktab.awk \ + checklinks.awk checknow.awk checktab.awk \ date.1 date.c difftime.c \ etcetera europe factory iso3166.tab \ leap-seconds.list leapseconds.awk localtime.c \ @@ -582,12 +619,7 @@ VERSION_DEPS= \ 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 - -# And for the benefit of csh users on systems that assume the user -# shell should be used to handle commands in Makefiles. . . - -SHELL= /bin/sh + zone.tab zone1970.tab zonenow.tab all: tzselect zic zdump libtz.a $(TABDATA) \ vanguard.zi main.zi rearguard.zi @@ -657,6 +689,16 @@ tzdata.zi: $(DATAFORM).zi version zishrink.awk $(DATAFORM).zi >$@.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 VERSION=`cat version` && printf '%s\n' \ 'static char const PKGVERSION[]="($(PACKAGE)) ";' \ @@ -763,7 +805,7 @@ force_tzs: $(TZS_NEW) libtz.a: $(LIBOBJS) rm -f $@ - $(AR) -rc $@ $(LIBOBJS) + $(AR) $(ARFLAGS) $@ $(LIBOBJS) $(RANLIB) $@ date: $(DATEOBJS) @@ -771,26 +813,32 @@ date: $(DATEOBJS) tzselect: tzselect.ksh version VERSION=`cat version` && sed \ - -e 's|#!/bin/bash|#!$(KSHELL)|g' \ - -e 's|AWK=[^}]*|AWK='\''$(AWK)'\''|g' \ - -e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \ - -e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \ - -e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \ - -e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \ - <$@.ksh >$@.out + -e "s'#!/bin/bash'#!"'$(KSHELL)'\' \ + -e s\''\(AWK\)=[^}]*'\''\1=\'\''$(AWK)\'\'\' \ + -e s\''\(PKGVERSION\)=.*'\''\1=\'\''($(PACKAGE)) \'\'\' \ + -e s\''\(REPORT_BUGS_TO\)=.*'\''\1=\'\''$(BUGEMAIL)\'\'\' \ + -e s\''\(TZDIR\)=[^}]*'\''\1=\'\''$(TZDIR)\'\'\' \ + -e s\''\(TZVERSION\)=.*'\''\1=\'"'$$VERSION\\''" \ + <$@.ksh >$@.out chmod +x $@.out mv $@.out $@ check: check_back check_mild check_mild: check_character_set check_white_space check_links \ - check_name_lengths check_slashed_abbrs check_sorted \ + check_name_lengths check_now \ + check_slashed_abbrs check_sorted \ check_tables check_web check_ziguard check_zishrink check_tzs +# 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 \ + || { LC_ALL='$(UTF8_LOCALE)'; export LC_ALL; false; }; } + check_character_set: $(ENCHILADA) - test ! '$(UTF8_LOCALE)' || \ - ! printf 'A\304\200B\n' | \ - LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 || { \ - LC_ALL='$(UTF8_LOCALE)' && export LC_ALL && \ + $(UTF8_LOCALE_MISSING) || { \ sharp='#' && \ ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \ $(MISC) $(SOURCES) $(WEB_PAGES) \ @@ -805,12 +853,12 @@ check_character_set: $(ENCHILADA) touch $@ check_white_space: $(ENCHILADA) + $(UTF8_LOCALE_MISSING) || { \ patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \ - ! grep -En "$$pat" \ - $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list) - ! grep -n '[$s]$$' \ - $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list) - touch $@ + ! grep -En "$$pat|[$s]\$$" \ + $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list); \ + } + touch $@ PRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+ FILE_NAME_COMPONENT_TOO_LONG = $(PRECEDES_FILE_NAME)[^$s]*[^/$s]{15} @@ -851,7 +899,29 @@ check_links: checklinks.awk tzdata.zi -f checklinks.awk tzdata.zi touch $@ -check_tables: checktab.awk $(YDATA) backward $(ZONETABLES) +# Check timestamps from now through 28 years from now, to make sure +# that zonenow.tab contains all sequences of planned timestamps, +# without any duplicate sequences. In theory this might require +# 2800 years but that would take a long time to check. +CHECK_NOW_TIMESTAMP = `./date +%s` +CHECK_NOW_FUTURE_YEARS = 28 +CHECK_NOW_FUTURE_SECS = $(CHECK_NOW_FUTURE_YEARS) '*' 366 '*' 24 '*' 60 '*' 60 +check_now: checknow.awk date tzdata.zi zdump zic zone1970.tab zonenow.tab + rm -fr $@.dir + mkdir $@.dir + ./zic -d $@.dir tzdata.zi + now=$(CHECK_NOW_TIMESTAMP) && \ + future=`expr $(CHECK_NOW_FUTURE_SECS) + $$now` && \ + ./zdump -i -t $$now,$$future \ + $$(find $$PWD/$@.dir/????*/ -type f) \ + >$@.dir/zdump.tab + $(AWK) \ + -v zdump_table=$@.dir/zdump.tab \ + -f checknow.awk zonenow.tab + rm -fr $@.dir + touch $@ + +check_tables: checktab.awk $(YDATA) backward zone.tab zone1970.tab for tab in $(ZONETABLES); do \ test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \ $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \ @@ -911,10 +981,10 @@ check_zishrink_posix check_zishrink_right: \ touch $@ clean_misc: - rm -fr check_*.dir + rm -fr check_*.dir typecheck_*.dir rm -f *.o *.out $(TIME_T_ALTERNATIVES) \ check_* core typecheck_* \ - date tzselect version.h zdump zic libtz.a + date tzdir.h tzselect version.h zdump zic libtz.a clean: clean_misc rm -fr *.dir tzdb-*/ rm -f *.zi $(TZS_NEW) @@ -952,12 +1022,18 @@ $(MANTXTS): workman.sh # plus N if GNU ls and touch are available. SET_TIMESTAMP_N = sh -c '\ n=$$0 dest=$$1; shift; \ - touch -cmr `ls -t "$$@" | sed 1q` "$$dest" && \ + <"$$dest" && \ if test $$n != 0 && \ - lsout=`ls -n --time-style="+%s" "$$dest" 2>/dev/null`; then \ + lsout=`ls -nt --time-style="+%s" "$$@" 2>/dev/null`; then \ set x $$lsout && \ - touch -cmd @`expr $$7 + $$n` "$$dest"; \ - else :; fi' + timestamp=`expr $$7 + $$n` && \ + echo "+ touch -md @$$timestamp $$dest" && \ + touch -md @$$timestamp "$$dest"; \ + else \ + newest=`ls -t "$$@" | sed 1q` && \ + echo "+ touch -mr $$newest $$dest" && \ + touch -mr "$$newest" "$$dest"; \ + fi' # If DEST depends on A B C ... in this Makefile, callers should use # $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any # downstream 'make' that considers equal timestamps to be out of date. @@ -982,8 +1058,12 @@ set-timestamps.out: $(EIGHT_YARDS) rm -f test.out && \ for file in $$files; do \ if git diff --quiet $$file; then \ - time=`git log -1 --format='tformat:%ct' $$file` && \ - touch -cmd @$$time $$file; \ + time=`TZ=UTC0 git log -1 \ + --format='tformat:%cd' \ + --date='format:%Y-%m-%dT%H:%M:%SZ' \ + $$file` && \ + echo "+ touch -md $$time $$file" && \ + touch -md $$time $$file; \ else \ echo >&2 "$$file: warning: does not match repository"; \ fi || exit; \ @@ -1008,7 +1088,8 @@ check_public: $(VERSION_DEPS) rm -fr public.dir mkdir public.dir ln $(VERSION_DEPS) public.dir - cd public.dir && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL + cd public.dir \ + && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' TZDIR='$(TZDIR)' ALL for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi \ public.dir/vanguard.zi public.dir/main.zi \ public.dir/rearguard.zi; \ @@ -1139,7 +1220,7 @@ tzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out sed '1s/$$/-rearguard/' $@.dir/version : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier. $(CREATE_EMPTY) $@.dir/pacificnew - touch -cmr version $@.dir/version + touch -mr version $@.dir/version LC_ALL=C && export LC_ALL && \ (cd $@.dir && \ tar $(TARFLAGS) -cf - \ @@ -1163,7 +1244,7 @@ tzdata$(VERSION)-tailored.tar.gz: set-timestamps.out `test $(DATAFORM) = vanguard || echo pacificnew` (grep '^#' tzdata.zi && echo && cat $(DATAFORM).zi) \ >$@.dir/etcetera - touch -cmr tzdata.zi $@.dir/etcetera + touch -mr tzdata.zi $@.dir/etcetera sed -n \ -e '/^# *version *\(.*\)/h' \ -e '/^# *ddeps */H' \ @@ -1174,7 +1255,7 @@ tzdata$(VERSION)-tailored.tar.gz: set-timestamps.out -e 's/ /-/g' \ -e 'p' \ $@.dir/version - touch -cmr version $@.dir/version + touch -mr version $@.dir/version links= && \ for file in $(TZDATA_DIST); do \ test -f $@.dir/$$file || links="$$links $$file"; \ @@ -1226,10 +1307,10 @@ zonenames: tzdata.zi asctime.o: private.h tzfile.h date.o: private.h difftime.o: private.h -localtime.o: private.h tzfile.h +localtime.o: private.h tzfile.h tzdir.h strftime.o: private.h tzfile.h zdump.o: version.h -zic.o: private.h tzfile.h version.h +zic.o: private.h tzfile.h tzdir.h version.h .PHONY: ALL INSTALL all .PHONY: check check_mild check_time_t_alternatives diff --git a/contrib/tzdata/NEWS b/contrib/tzdata/NEWS index b54538aa4a82..031ba6a8a250 100644 --- a/contrib/tzdata/NEWS +++ b/contrib/tzdata/NEWS @@ -1,5 +1,109 @@ News for the tz database +Release 2023d - 2023-12-21 20:02:24 -0800 + + Briefly: + Ittoqqortoormiit, Greenland changes time zones on 2024-03-31. + Vostok, Antarctica changed time zones on 2023-12-18. + Casey, Antarctica changed time zones five times since 2020. + Code and data fixes for Palestine timestamps starting in 2072. + A new data file zonenow.tab for timestamps starting now. + + Changes to future timestamps + + Ittoqqortoormiit, Greenland (America/Scoresbysund) joins most of + the rest of Greenland's timekeeping practice on 2024-03-31, by + changing its time zone from -01/+00 to -02/-01 at the same moment + as the spring-forward transition. Its clocks will therefore not + spring forward as previously scheduled. The time zone change + reverts to its common practice before 1981. + + Fix predictions for DST transitions in Palestine in 2072-2075, + correcting a typo introduced in 2023a. + + Changes to past and future timestamps + + Vostok, Antarctica changed to +05 on 2023-12-18. It had been at + +07 (not +06) for years. (Thanks to Zakhary V. Akulov.) + + Change data for Casey, Antarctica to agree with timeanddate.com, + by adding five time zone changes since 2020. Casey is now at +08 + instead of +11. + + Changes to past tm_isdst flags + + Much of Greenland, represented by America/Nuuk, changed its + standard time from -03 to -02 on 2023-03-25, not on 2023-10-28. + This does not affect UTC offsets, only the tm_isdst flag. + (Thanks to Thomas M. Steenholdt.) + + New data file + + A new data file zonenow.tab helps configure applications that use + timestamps dated from now on. This simplifies configuration, + since users choose from a smaller Zone set. The file's format is + experimental and subject to change. + + Changes to code + + localtime.c no longer mishandles TZif files that contain a single + transition into a DST regime. Previously, it incorrectly assumed + DST was in effect before the transition too. (Thanks to Alois + Treindl for debugging help.) + + localtime.c's timeoff no longer collides with OpenBSD 7.4. + + The C code now uses _Generic only if __STDC_VERSION__ says the + compiler is C11 or later. + + tzselect now optionally reads zonenow.tab, to simplify when + configuring only for timestamps dated from now on. + + tzselect no longer creates temporary files. + + tzselect no longer mishandles the following: + + Spaces and most other special characters in BUGEMAIL, PACKAGE, + TZDIR, and VERSION. + + TZ strings when using mawk 1.4.3, which mishandles regular + expressions of the form /X{2,}/. + + ISO 6709 coordinates when using an awk that lacks the GNU + extension of newlines in -v option-arguments. + + Non UTF-8 locales when using an iconv command that lacks the GNU + //TRANSLIT extension. + + zic no longer mishandles data for Palestine after the year 2075. + Previously, it incorrectly omitted post-2075 transitions that are + predicted for just before and just after Ramadan. (Thanks to Ken + Murchison for debugging help.) + + zic now works again on Linux 2.6.16 and 2.6.17 (2006). + (Problem reported by Rune Torgersen.) + + Changes to build procedure + + The Makefile is now more compatible with POSIX: + * It no longer defines AR, CC, CFLAGS, LDFLAGS, and SHELL. + * It no longer uses its own 'cc' in place of CC. + * It now uses ARFLAGS, with default specified by POSIX. + * It does not use LFLAGS incompatibly with POSIX. + * It uses the special .POSIX target. + * It quotes special characters more carefully. + * It no longer mishandles builds in an ISO 8859 locale. + Due to the CC changes, TZDIR is now #defined in a file tzfile.h + built by 'make', not in a $(CC) -D option. Also, TZDEFAULT is + now treated like TZDIR as they have similar roles. + + Changes to commentary + + Limitations and hazards of the optional support for obsolescent + C89 platforms are documented better, along with a tentative + schedule for removing this support. + + Release 2023c - 2023-03-28 12:42:14 -0700 Changes to past and future timestamps @@ -76,11 +180,14 @@ Release 2023a - 2023-03-22 12:39:33 -0700 platform dependent and abbreviations were silently truncated to 16 bytes even when the limit was greater than 16. - The code by default is now designed for C99 or later. To build in - a C89 environment, compile with -DPORT_TO_C89. To support C89 - callers of the tzcode library, compile with -DSUPPORT_C89. The - two new macros are transitional aids planned to be removed in a - future version, when C99 or later will be required. + The code by default is now designed for C99 or later. To build on + a mostly-C89 platform, compile with -DPORT_TO_C89; this should + work on C89 platforms that also support C99 'long long' and + perhaps a few other extensions to C89. To support C89 callers of + tzcode's library, compile with -DSUPPORT_C89; however, this could + trigger latent bugs in C99-or-later callers. The two new macros + are transitional aids planned to be removed in a future version + (say, in 2029), when C99 or later will be required. The code now builds again on pre-C99 platforms, if you compile with -DPORT_TO_C89. This fixes a bug introduced in 2022f. @@ -723,6 +830,8 @@ Release 2021b - 2021-09-24 16:23:00 -0700 them, set the EXPIRES_LINE Makefile variable. If a TZif file uses this new feature it is marked with a new TZif version number 4, a format intended to be documented in a successor to RFC 8536. + The old-format "#expires" comments are now treated solely as + comments and have no effect on the TZif files. zic -L LEAPFILE -r @LO no longer generates an invalid TZif file that omits leap second information for the range LO..B when LO @@ -4302,7 +4411,7 @@ Release 2012j - 2012-11-12 18:34:49 -0800 now uses tz@iana.org rather than the old elsie address. zic -v now complains about abbreviations that are less than 3 - or more than 6 characters, as per Posix. Formerly, it checked + or more than 6 characters, as per POSIX. Formerly, it checked for abbreviations that were more than 3. 'make public' no longer puts its temporary directory under /tmp, @@ -4467,8 +4576,8 @@ Release data2011m - 2011-10-24 21:42:16 +0700 In particular, the typos in comments in the data (2011-11-17 should have been 2011-10-17 as Alan Barrett noted, and spelling of Tiraspol that Tim Parenti noted) have been fixed, and the change for Ukraine has been - made in all 4 Ukrainian zones, rather than just Kiev (again, thanks to - Tim Parenti, and also Denys Gavrysh) + made in all 4 Ukrainian zones, rather than just Europe/Kiev + (again, thanks to Tim Parenti, and also Denys Gavrysh). In addition, I added Europe/Tiraspol to zone.tab. diff --git a/contrib/tzdata/README b/contrib/tzdata/README index 145aacd495b7..edabd2e0690f 100644 --- a/contrib/tzdata/README +++ b/contrib/tzdata/README @@ -11,14 +11,17 @@ changes made by political bodies to time zone boundaries, UTC offsets, and daylight-saving rules. See or the -file tz-link.html for how to acquire the code and data. Once acquired, -read the comments in the file 'Makefile' and make any changes needed -to make things right for your system, especially if you are using some -platform other than GNU/Linux. Then run the following commands, -substituting your desired installation directory for "$HOME/tzdir": - - make TOPDIR=$HOME/tzdir install - $HOME/tzdir/usr/bin/zdump -v America/Los_Angeles +file tz-link.html for how to acquire the code and data. + +Once acquired, read the leading comments in the file "Makefile" +and make any changes needed to make things right for your system, +especially when using a platform other than current GNU/Linux. + +Then run the following commands, substituting your desired +installation directory for "$HOME/tzdir": + + make TOPDIR="$HOME/tzdir" install + "$HOME/tzdir/usr/bin/zdump" -v America/Los_Angeles See the file tz-how-to.html for examples of how to read the data files. diff --git a/contrib/tzdata/africa b/contrib/tzdata/africa index 6cf4e39c8c45..6fae18c0979f 100644 --- a/contrib/tzdata/africa +++ b/contrib/tzdata/africa @@ -285,13 +285,6 @@ Rule Egypt 2007 only - Sep Thu>=1 24:00 0 - # reproduced by other (more accessible) sites[, e.g.,]... # http://elgornal.net/news/news.aspx?id=4699258 -# From Paul Eggert (2014-06-04): -# Sarah El Deeb and Lee Keath of AP report that the Egyptian government says -# the change is because of blackouts in Cairo, even though Ahram Online (cited -# above) says DST had no affect on electricity consumption. There is -# no information about when DST will end this fall. See: -# http://abcnews.go.com/International/wireStory/el-sissi-pushes-egyptians-line-23614833 - # From Steffen Thorsen (2015-04-08): # Egypt will start DST on midnight after Thursday, April 30, 2015. # This is based on a law (no 35) from May 15, 2014 saying it starts the last diff --git a/contrib/tzdata/antarctica b/contrib/tzdata/antarctica index fc603e9996de..763c27253c99 100644 --- a/contrib/tzdata/antarctica +++ b/contrib/tzdata/antarctica @@ -80,6 +80,11 @@ # - 2018 Oct 7 4:00 - 2019 Mar 17 3:00 - 2019 Oct 4 3:00 - 2020 Mar 8 3:00 # and now - 2020 Oct 4 0:01 +# From Paul Eggert (2023-12-20): +# Transitions from 2021 on are taken from: +# https://www.timeanddate.com/time/zone/antarctica/casey +# retrieved at various dates. + # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Antarctica/Casey 0 - -00 1969 8:00 - +08 2009 Oct 18 2:00 @@ -93,7 +98,12 @@ Zone Antarctica/Casey 0 - -00 1969 8:00 - +08 2019 Oct 4 3:00 11:00 - +11 2020 Mar 8 3:00 8:00 - +08 2020 Oct 4 0:01 - 11:00 - +11 + 11:00 - +11 2021 Mar 14 0:00 + 8:00 - +08 2021 Oct 3 0:01 + 11:00 - +11 2022 Mar 13 0:00 + 8:00 - +08 2022 Oct 2 0:01 + 11:00 - +11 2023 Mar 9 3:00 + 8:00 - +08 Zone Antarctica/Davis 0 - -00 1957 Jan 13 7:00 - +07 1964 Nov 0 - -00 1969 Feb @@ -240,7 +250,50 @@ Zone Antarctica/Troll 0 - -00 2005 Feb 12 # year-round from 1960/61 to 1992 # Vostok, since 1957-12-16, temporarily closed 1994-02/1994-11 -# See Asia/Urumqi. +# From Craig Mundell (1994-12-15): +# http://quest.arc.nasa.gov/antarctica/QA/computers/Directions,Time,ZIP +# Vostok, which is one of the Russian stations, is set on the same +# time as Moscow, Russia. +# +# From Lee Hotz (2001-03-08): +# I queried the folks at Columbia who spent the summer at Vostok and this is +# what they had to say about time there: +# "in the US Camp (East Camp) we have been on New Zealand (McMurdo) +# time, which is 12 hours ahead of GMT. The Russian Station Vostok was +# 6 hours behind that (although only 2 miles away, i.e. 6 hours ahead +# of GMT). This is a time zone I think two hours east of Moscow. The +# natural time zone is in between the two: 8 hours ahead of GMT." +# +# From Paul Eggert (2001-05-04): +# This seems to be hopelessly confusing, so I asked Lee Hotz about it +# in person. He said that some Antarctic locations set their local +# time so that noon is the warmest part of the day, and that this +# changes during the year and does not necessarily correspond to mean +# solar noon. So the Vostok time might have been whatever the clocks +# happened to be during their visit. So we still don't really know what time +# it is at Vostok. +# +# From Zakhary V. Akulov (2023-12-17 22:00:48 +0700): +# ... from December, 18, 2023 00:00 by my decision the local time of +# the Antarctic research base Vostok will correspond to UTC+5. +# (2023-12-19): We constantly interact with Progress base, with company who +# builds new wintering station, with sledge convoys, with aviation - they all +# use UTC+5. Besides, difference between Moscow time is just 2 hours now, not 4. +# (2023-12-19, in response to the question "Has local time at Vostok +# been UTC+6 ever since 1957, or has it changed before?"): No. At least +# since my antarctic career start, 10 years ago, Vostok base has UTC+7. +# (In response to a 2023-12-18 question "from 02:00 to 00:00 today"): This. +# +# From Paul Eggert (2023-12-18): +# For lack of better info, guess Vostok was at +07 from founding through today, +# except when closed. + +# Zone NAME STDOFF RULES FORMAT [UNTIL] +Zone Antarctica/Vostok 0 - -00 1957 Dec 16 + 7:00 - +07 1994 Feb + 0 - -00 1994 Nov + 7:00 - +07 2023 Dec 18 2:00 + 5:00 - +05 # S Africa - year-round bases # Marion Island, -4653+03752 diff --git a/contrib/tzdata/asia b/contrib/tzdata/asia index a29a4dc0c4de..04526c196931 100644 --- a/contrib/tzdata/asia +++ b/contrib/tzdata/asia @@ -655,7 +655,6 @@ Zone Asia/Shanghai 8:05:43 - LMT 1901 8:00 PRC C%sT # Xinjiang time, used by many in western China; represented by Ürümqi / Ürümchi # / Wulumuqi. (Please use Asia/Shanghai if you prefer Beijing time.) -# Vostok base in Antarctica matches this since 1970. Zone Asia/Urumqi 5:50:20 - LMT 1928 6:00 - +06 @@ -3427,6 +3426,9 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # From Heba Hamad (2023-03-22): # ... summer time will begin in Palestine from Saturday 04-29-2023, # 02:00 AM by 60 minutes forward. +# From Heba Hemad (2023-10-09): +# ... winter time will begin in Palestine from Saturday 10-28-2023, +# 02:00 AM by 60 minutes back. # # From Paul Eggert (2023-03-22): # For now, guess that spring and fall transitions will normally @@ -3548,13 +3550,13 @@ Rule Palestine 2070 only - Oct 4 2:00 0 - Rule Palestine 2071 only - Sep 19 2:00 0 - Rule Palestine 2072 only - Sep 10 2:00 0 - Rule Palestine 2072 only - Oct 15 2:00 1:00 S +Rule Palestine 2072 max - Oct Sat<=30 2:00 0 - Rule Palestine 2073 only - Sep 2 2:00 0 - Rule Palestine 2073 only - Oct 7 2:00 1:00 S Rule Palestine 2074 only - Aug 18 2:00 0 - Rule Palestine 2074 only - Sep 29 2:00 1:00 S Rule Palestine 2075 only - Aug 10 2:00 0 - Rule Palestine 2075 only - Sep 14 2:00 1:00 S -Rule Palestine 2075 max - Oct Sat<=30 2:00 0 - Rule Palestine 2076 only - Jul 25 2:00 0 - Rule Palestine 2076 only - Sep 5 2:00 1:00 S Rule Palestine 2077 only - Jul 17 2:00 0 - diff --git a/contrib/tzdata/australasia b/contrib/tzdata/australasia index 0633a30efd8b..dc98c1e2de17 100644 --- a/contrib/tzdata/australasia +++ b/contrib/tzdata/australasia @@ -391,8 +391,14 @@ Zone Antarctica/Macquarie 0 - -00 1899 Nov # Please note that there will not be any daylight savings time change # in Fiji for 2022-2023.... # https://www.facebook.com/FijianGovernment/posts/pfbid0mmWVTYmTibn66ybpFda75pDcf34SSpoSaskJW5gXwaKo5Sgc7273Q4fXWc6kQV6Hl + +# From Almaz Mingaleev (2023-10-06): +# Cabinet approved the suspension of Daylight Saving and appropriate +# legislative changes will be considered including the repeal of the +# Daylight Saving Act 1998 +# https://www.fiji.gov.fj/Media-Centre/Speeches/English/CABINET-DECISIONS-3-OCTOBER-2023 # -# From Paul Eggert (2022-10-27): +# From Paul Eggert (2023-10-06): # For now, assume DST is suspended indefinitely. # Rule NAME FROM TO - IN ON AT SAVE LETTER/S diff --git a/contrib/tzdata/backward b/contrib/tzdata/backward index 421f2ec6b9f8..65c711b37bf4 100644 --- a/contrib/tzdata/backward +++ b/contrib/tzdata/backward @@ -205,7 +205,6 @@ Link America/Puerto_Rico America/Tortola Link Pacific/Port_Moresby Antarctica/DumontDUrville Link Pacific/Auckland Antarctica/McMurdo Link Asia/Riyadh Antarctica/Syowa -Link Asia/Urumqi Antarctica/Vostok Link Europe/Berlin Arctic/Longyearbyen Link Asia/Riyadh Asia/Aden Link Asia/Qatar Asia/Bahrain diff --git a/contrib/tzdata/backzone b/contrib/tzdata/backzone index 44d81c29e5ae..f45250340493 100644 --- a/contrib/tzdata/backzone +++ b/contrib/tzdata/backzone @@ -963,35 +963,6 @@ Link Antarctica/McMurdo Antarctica/South_Pole Zone Antarctica/Syowa 0 - -00 1957 Jan 29 3:00 - +03 -# Vostok, Antarctica -# -# Vostok, since 1957-12-16, temporarily closed 1994-02/1994-11 -# From Craig Mundell (1994-12-15): -# http://quest.arc.nasa.gov/antarctica/QA/computers/Directions,Time,ZIP -# Vostok, which is one of the Russian stations, is set on the same -# time as Moscow, Russia. -# -# From Lee Hotz (2001-03-08): -# I queried the folks at Columbia who spent the summer at Vostok and this is -# what they had to say about time there: -# "in the US Camp (East Camp) we have been on New Zealand (McMurdo) -# time, which is 12 hours ahead of GMT. The Russian Station Vostok was -# 6 hours behind that (although only 2 miles away, i.e. 6 hours ahead -# of GMT). This is a time zone I think two hours east of Moscow. The -# natural time zone is in between the two: 8 hours ahead of GMT." -# -# From Paul Eggert (2001-05-04): -# This seems to be hopelessly confusing, so I asked Lee Hotz about it -# in person. He said that some Antarctic locations set their local -# time so that noon is the warmest part of the day, and that this -# changes during the year and does not necessarily correspond to mean -# solar noon. So the Vostok time might have been whatever the clocks -# happened to be during their visit. So we still don't really know what time -# it is at Vostok. But we'll guess +06. -# -Zone Antarctica/Vostok 0 - -00 1957 Dec 16 - 6:00 - +06 - # Yemen # Milne says 2:59:54 was the meridian of the saluting battery at Aden, # and that Yemen was at 1:55:56, the meridian of the Hagia Sophia. diff --git a/contrib/tzdata/checknow.awk b/contrib/tzdata/checknow.awk new file mode 100644 index 000000000000..d722c03fd689 --- /dev/null +++ b/contrib/tzdata/checknow.awk @@ -0,0 +1,54 @@ +# Check zonenow.tab for consistency with primary data. + +# Contributed by Paul Eggert. This file is in the public domain. + +function record_zone(zone, data) { + if (zone) { + zone_data[zone] = data + zones[data] = zones[data] " " zone + } +} + +BEGIN { + while (getline >"/dev/stderr" status = 1 @@ -110,7 +110,7 @@ BEGIN { used_max_cc = cc } } - if (used_max <= 1 && comments) { + if (used_max <= 1 && comments && zone_table != "zonenow.tab") { printf "%s:%d: unnecessary comment '%s'\n", \ zone_table, i, comments \ >>"/dev/stderr" @@ -149,7 +149,8 @@ $1 ~ /^#/ { next } if ($3 ~ /%/) rulePercentUsed[$2] = 1 } if (tz && tz ~ /\// && tz !~ /^Etc\//) { - if (!tztab[tz] && FILENAME != "backward") { + if (!tztab[tz] && FILENAME != "backward" \ + && zone_table != "zonenow.tab") { printf "%s: no data for '%s'\n", zone_table, tz \ >>"/dev/stderr" status = 1 diff --git a/contrib/tzdata/europe b/contrib/tzdata/europe index 3907c055140a..27f821e77600 100644 --- a/contrib/tzdata/europe +++ b/contrib/tzdata/europe @@ -1123,6 +1123,23 @@ Zone Atlantic/Faroe -0:27:04 - LMT 1908 Jan 11 # Tórshavn # 2. The shift *from* DST in 2023 happens as normal, but coincides with the # shift to UTC-02 normaltime (people will not change their clocks here). # 3. After this, DST is still observed, but as -02/-01 instead of -03/-02. +# +# From Múte Bourup Egede via Jógvan Svabo Samuelsen (2023-03-15): +# Greenland will not switch to Daylight Saving Time this year, 2023, +# because the standard time for Greenland will change from UTC -3 to UTC -2. +# However, Greenland will change to Daylight Saving Time again in 2024 +# and onwards. + +# From a contributor who wishes to remain anonymous for now (2023-10-29): +# https://www.dr.dk/nyheder/seneste/i-nat-skal-uret-stilles-en-time-tilbage-men-foerste-gang-sker-det-ikke-i-groenland +# with a link to that page: +# https://naalakkersuisut.gl/Nyheder/2023/10/2710_sommertid *** 613 LINES SKIPPED *** From nobody Sun Dec 24 01:43:32 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SyP2D2Ng5z55Hrd; Sun, 24 Dec 2023 01:43: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SyP2D26ssz3VB9; Sun, 24 Dec 2023 01:43:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703382212; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qRZPAVvSQOZT1dQ57cTfavTAjZaPcPTYBS91hY11MaU=; b=Wuas50k6I87nTtLL3ADmjsTjMuQgWWCQK1Irh0BiEaXiTzd+36UpITiCzebXq7T6v0Ua3P zlSIaP7XA+gxfTGbjwj7PiflAaZ7UmbI4U0JtGVNxfBTrtrpb5NTX2RYtbPyfiL4vfu5+a dP6x8CoJ0v68sBs0pFZck7FgkrYqfGH9wCI1zHKtKM9XSO5uT063UgP5FPHr5bCqHituv9 BPuPnvmNMeQs8nZbFgPZaaGMOVb1KWDzxhYYTT/9CTxMJpbkZtBqNzl42ngtbKvRJkg5Jt U3wav1/ozOPi/PaOfnsHv3CYzfOyBzezpWx0Hl4jToi0Hm+Imj24Px7RWdapOQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703382212; a=rsa-sha256; cv=none; b=pBdsNJcBFSMlP7SFia2KqLq1DBzOPBy9D66d4vFp6BYRYdihVIeoSD/QievxVBhq4glKPC DShAtgaLHJFBGi9RED641KexyZS7XHzLnjpTAK0q+du/16MsQkxoYhVfYKCFWJRBHiIbkR v6h8d0qpsUj/GKbQnuAfzh9KPy1ivYMKH1SFilK7MOvmZGG9zmK+S81zBLGOaccpnQsllF lzD4PX2AsDXoG8PTyXqKo7VWK3UMQmpX3OVeA4tSRblioX6fTxlncuD7gYdBkfZc541cYd cA3g6nR68JSW0yI6Zm5t/BMdoXoBp1ptDP86xClSNY3XyydaSkMN9ZF9soz16w== 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=1703382212; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qRZPAVvSQOZT1dQ57cTfavTAjZaPcPTYBS91hY11MaU=; b=mCWDBe2sG/kQZFA0sBMiGjUDg6o3mhmByK4Q6zXyuum4L2+L0ctKszSD3hj5XLZvC5pC0x bj+MzFM+sW5W/YtUOFUosSBWl2W+sx+45jgzMABSu+8O4TfAFqQi4YqgbG/Dz67Zudmtcw AKUqgWfJCApWI1MWT3nBblxjspD1mUHCQgtjy/WP19ejq9TyQIZqWgN3llRvyyWKlZC3t8 TqJVnNcgHWgWRgJfwCvpfIJeq21cruoPr0k8E6UV+Hk+zZlW9oqe/uAoSVehEZdXOAuLii BVharhCSiPaYX1Y0FYb19QcbBz0pH8/cxtoFGMo2jB4A6c7HguYrAZ9Y8D3oRw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SyP2D1BTDz1Mb7; Sun, 24 Dec 2023 01:43:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BO1hWZH016281; Sun, 24 Dec 2023 01:43:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BO1hWrD016278; Sun, 24 Dec 2023 01:43:32 GMT (envelope-from git) Date: Sun, 24 Dec 2023 01:43:32 GMT Message-Id: <202312240143.3BO1hWrD016278@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Philip Paeps Subject: git: 436f43d41cc7 - stable/13 - contrib/tzdata: import tzdata 2023d List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 436f43d41cc78aa475015b4618f8787e1ed10000 Auto-Submitted: auto-generated The branch stable/13 has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=436f43d41cc78aa475015b4618f8787e1ed10000 commit 436f43d41cc78aa475015b4618f8787e1ed10000 Author: Philip Paeps AuthorDate: 2023-12-23 01:51:01 +0000 Commit: Philip Paeps CommitDate: 2023-12-24 01:42:30 +0000 contrib/tzdata: import tzdata 2023d Changes: https://github.com/eggert/tz/blob/2023d/NEWS (cherry picked from commit eebb9c2caea1584773ae4cec311cee1eea5b1655) --- contrib/tzdata/Makefile | 209 ++++++++++++++++++--------- contrib/tzdata/NEWS | 125 ++++++++++++++-- contrib/tzdata/README | 19 +-- contrib/tzdata/africa | 7 - contrib/tzdata/antarctica | 57 +++++++- contrib/tzdata/asia | 6 +- contrib/tzdata/australasia | 8 +- contrib/tzdata/backward | 1 - contrib/tzdata/backzone | 29 ---- contrib/tzdata/checknow.awk | 54 +++++++ contrib/tzdata/checktab.awk | 7 +- contrib/tzdata/europe | 29 +++- contrib/tzdata/leap-seconds.list | 8 +- contrib/tzdata/leapseconds | 8 +- contrib/tzdata/northamerica | 2 +- contrib/tzdata/southamerica | 6 + contrib/tzdata/version | 2 +- contrib/tzdata/zone.tab | 24 ++-- contrib/tzdata/zone1970.tab | 29 ++-- contrib/tzdata/zonenow.tab | 301 +++++++++++++++++++++++++++++++++++++++ 20 files changed, 763 insertions(+), 168 deletions(-) diff --git a/contrib/tzdata/Makefile b/contrib/tzdata/Makefile index 6edc73cc6ffb..4e45f93b915c 100644 --- a/contrib/tzdata/Makefile +++ b/contrib/tzdata/Makefile @@ -1,7 +1,25 @@ # 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: +# On older platforms you may need to scrounge for a POSIX-conforming 'make'. +# For example, on Solaris 10 (2005), use /usr/sfw/bin/gmake or +# /usr/xpg4/bin/make, not /usr/ccs/bin/make. + +# To affect how this Makefile works, you can run a shell script like this: +# +# #!/bin/sh +# make CC='gcc -std=gnu11' "$@" +# +# This example script is appropriate for a pre-2017 GNU/Linux system +# where a non-default setting is needed to support this package's use of C99. +# +# 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 @@ -191,8 +209,9 @@ UTF8_LOCALE= en_US.utf8 # On some hosts, this should have -lintl unless CFLAGS has -DHAVE_GETTEXT=0. LDLIBS= -# Add the following to the end of the "CFLAGS=" line as needed to override -# defaults specified in the source code. "-DFOO" is equivalent to "-DFOO=1". +# 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 @@ -234,11 +253,16 @@ LDLIBS= # -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 -# -DPORT_TO_C89 if tzcode should also run on C89 platforms+ +# -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=long on hosts like MS-Windows that lack ssize_t # -DSUPPORT_C89 if the tzcode library should support C89 callers+ +# However, this might trigger latent bugs in C99-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; @@ -270,11 +294,15 @@ LDLIBS= # -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. +# once the code assumes C99 or later, say in the year 2029. # # Select instrumentation via "make GCC_INSTRUMENT='whatever'". GCC_INSTRUMENT = \ @@ -353,9 +381,11 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \ # 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. -# "timelocal" is equivalent to "mktime". +# I.e., "offtime" is 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 @@ -378,7 +408,7 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \ # # 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 +# which claims to test C and POSIX conformance. If you want to pass PCTS, add # -DPCTS # to the end of the "CFLAGS=" line. # @@ -388,13 +418,21 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \ # 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= +#CFLAGS= -O 1 -# Linker flags. Default to $(LFLAGS) for backwards compatibility -# to release 2012h and earlier. -LDFLAGS= $(LFLAGS) +# 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 202x/D3. +#AR = ar +#ARFLAGS = -rv +#CC = c17 +#LDFLAGS = +#MAKE = make # For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in # submake command lines. The default is no leap seconds. @@ -418,18 +456,18 @@ ZFLAGS= ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS) -# The name of a Posix-compliant 'awk' on your system. +# 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. AWK= awk -# The full path name of a Posix-compliant shell, preferably one that supports +# 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 +# lacks 'select' or doesn't completely conform to POSIX, but /bin/bash # is typically nicer if it works. KSHELL= /bin/bash @@ -503,17 +541,16 @@ GZIPFLAGS= -9n DIFF_TZS= diff -u$$(! diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1 \ || echo ' -F^TZ=') -############################################################################### - -#MAKE= make +# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. +RANLIB= : -cc= cc -CC= $(cc) -DTZDIR='"$(TZDIR)"' +# 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 -AR= ar +# End of macros that one plausibly might want to tailor. +############################################################################### -# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. -RANLIB= : TZCOBJS= zic.o TZDOBJS= zdump.o localtime.o asctime.o strftime.o @@ -543,7 +580,7 @@ YDATA= $(PRIMARY_YDATA) etcetera NDATA= factory TDATA_TO_CHECK= $(YDATA) $(NDATA) backward TDATA= $(YDATA) $(NDATA) $(BACKWARD) -ZONETABLES= zone1970.tab zone.tab +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) \ @@ -551,7 +588,7 @@ TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) \ DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST) DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ leapseconds $(ZONETABLES) -AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk \ +AWK_SCRIPTS= checklinks.awk checknow.awk checktab.awk leapseconds.awk \ ziguard.awk zishrink.awk MISC= $(AWK_SCRIPTS) TZS_YEAR= 2050 @@ -572,7 +609,7 @@ VERSION_DEPS= \ calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \ africa antarctica asctime.c asia australasia \ backward backzone \ - checklinks.awk checktab.awk \ + checklinks.awk checknow.awk checktab.awk \ date.1 date.c difftime.c \ etcetera europe factory iso3166.tab \ leap-seconds.list leapseconds.awk localtime.c \ @@ -582,12 +619,7 @@ VERSION_DEPS= \ 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 - -# And for the benefit of csh users on systems that assume the user -# shell should be used to handle commands in Makefiles. . . - -SHELL= /bin/sh + zone.tab zone1970.tab zonenow.tab all: tzselect zic zdump libtz.a $(TABDATA) \ vanguard.zi main.zi rearguard.zi @@ -657,6 +689,16 @@ tzdata.zi: $(DATAFORM).zi version zishrink.awk $(DATAFORM).zi >$@.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 VERSION=`cat version` && printf '%s\n' \ 'static char const PKGVERSION[]="($(PACKAGE)) ";' \ @@ -763,7 +805,7 @@ force_tzs: $(TZS_NEW) libtz.a: $(LIBOBJS) rm -f $@ - $(AR) -rc $@ $(LIBOBJS) + $(AR) $(ARFLAGS) $@ $(LIBOBJS) $(RANLIB) $@ date: $(DATEOBJS) @@ -771,26 +813,32 @@ date: $(DATEOBJS) tzselect: tzselect.ksh version VERSION=`cat version` && sed \ - -e 's|#!/bin/bash|#!$(KSHELL)|g' \ - -e 's|AWK=[^}]*|AWK='\''$(AWK)'\''|g' \ - -e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \ - -e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \ - -e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \ - -e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \ - <$@.ksh >$@.out + -e "s'#!/bin/bash'#!"'$(KSHELL)'\' \ + -e s\''\(AWK\)=[^}]*'\''\1=\'\''$(AWK)\'\'\' \ + -e s\''\(PKGVERSION\)=.*'\''\1=\'\''($(PACKAGE)) \'\'\' \ + -e s\''\(REPORT_BUGS_TO\)=.*'\''\1=\'\''$(BUGEMAIL)\'\'\' \ + -e s\''\(TZDIR\)=[^}]*'\''\1=\'\''$(TZDIR)\'\'\' \ + -e s\''\(TZVERSION\)=.*'\''\1=\'"'$$VERSION\\''" \ + <$@.ksh >$@.out chmod +x $@.out mv $@.out $@ check: check_back check_mild check_mild: check_character_set check_white_space check_links \ - check_name_lengths check_slashed_abbrs check_sorted \ + check_name_lengths check_now \ + check_slashed_abbrs check_sorted \ check_tables check_web check_ziguard check_zishrink check_tzs +# 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 \ + || { LC_ALL='$(UTF8_LOCALE)'; export LC_ALL; false; }; } + check_character_set: $(ENCHILADA) - test ! '$(UTF8_LOCALE)' || \ - ! printf 'A\304\200B\n' | \ - LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 || { \ - LC_ALL='$(UTF8_LOCALE)' && export LC_ALL && \ + $(UTF8_LOCALE_MISSING) || { \ sharp='#' && \ ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \ $(MISC) $(SOURCES) $(WEB_PAGES) \ @@ -805,12 +853,12 @@ check_character_set: $(ENCHILADA) touch $@ check_white_space: $(ENCHILADA) + $(UTF8_LOCALE_MISSING) || { \ patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \ - ! grep -En "$$pat" \ - $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list) - ! grep -n '[$s]$$' \ - $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list) - touch $@ + ! grep -En "$$pat|[$s]\$$" \ + $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list); \ + } + touch $@ PRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+ FILE_NAME_COMPONENT_TOO_LONG = $(PRECEDES_FILE_NAME)[^$s]*[^/$s]{15} @@ -851,7 +899,29 @@ check_links: checklinks.awk tzdata.zi -f checklinks.awk tzdata.zi touch $@ -check_tables: checktab.awk $(YDATA) backward $(ZONETABLES) +# Check timestamps from now through 28 years from now, to make sure +# that zonenow.tab contains all sequences of planned timestamps, +# without any duplicate sequences. In theory this might require +# 2800 years but that would take a long time to check. +CHECK_NOW_TIMESTAMP = `./date +%s` +CHECK_NOW_FUTURE_YEARS = 28 +CHECK_NOW_FUTURE_SECS = $(CHECK_NOW_FUTURE_YEARS) '*' 366 '*' 24 '*' 60 '*' 60 +check_now: checknow.awk date tzdata.zi zdump zic zone1970.tab zonenow.tab + rm -fr $@.dir + mkdir $@.dir + ./zic -d $@.dir tzdata.zi + now=$(CHECK_NOW_TIMESTAMP) && \ + future=`expr $(CHECK_NOW_FUTURE_SECS) + $$now` && \ + ./zdump -i -t $$now,$$future \ + $$(find $$PWD/$@.dir/????*/ -type f) \ + >$@.dir/zdump.tab + $(AWK) \ + -v zdump_table=$@.dir/zdump.tab \ + -f checknow.awk zonenow.tab + rm -fr $@.dir + touch $@ + +check_tables: checktab.awk $(YDATA) backward zone.tab zone1970.tab for tab in $(ZONETABLES); do \ test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \ $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \ @@ -911,10 +981,10 @@ check_zishrink_posix check_zishrink_right: \ touch $@ clean_misc: - rm -fr check_*.dir + rm -fr check_*.dir typecheck_*.dir rm -f *.o *.out $(TIME_T_ALTERNATIVES) \ check_* core typecheck_* \ - date tzselect version.h zdump zic libtz.a + date tzdir.h tzselect version.h zdump zic libtz.a clean: clean_misc rm -fr *.dir tzdb-*/ rm -f *.zi $(TZS_NEW) @@ -952,12 +1022,18 @@ $(MANTXTS): workman.sh # plus N if GNU ls and touch are available. SET_TIMESTAMP_N = sh -c '\ n=$$0 dest=$$1; shift; \ - touch -cmr `ls -t "$$@" | sed 1q` "$$dest" && \ + <"$$dest" && \ if test $$n != 0 && \ - lsout=`ls -n --time-style="+%s" "$$dest" 2>/dev/null`; then \ + lsout=`ls -nt --time-style="+%s" "$$@" 2>/dev/null`; then \ set x $$lsout && \ - touch -cmd @`expr $$7 + $$n` "$$dest"; \ - else :; fi' + timestamp=`expr $$7 + $$n` && \ + echo "+ touch -md @$$timestamp $$dest" && \ + touch -md @$$timestamp "$$dest"; \ + else \ + newest=`ls -t "$$@" | sed 1q` && \ + echo "+ touch -mr $$newest $$dest" && \ + touch -mr "$$newest" "$$dest"; \ + fi' # If DEST depends on A B C ... in this Makefile, callers should use # $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any # downstream 'make' that considers equal timestamps to be out of date. @@ -982,8 +1058,12 @@ set-timestamps.out: $(EIGHT_YARDS) rm -f test.out && \ for file in $$files; do \ if git diff --quiet $$file; then \ - time=`git log -1 --format='tformat:%ct' $$file` && \ - touch -cmd @$$time $$file; \ + time=`TZ=UTC0 git log -1 \ + --format='tformat:%cd' \ + --date='format:%Y-%m-%dT%H:%M:%SZ' \ + $$file` && \ + echo "+ touch -md $$time $$file" && \ + touch -md $$time $$file; \ else \ echo >&2 "$$file: warning: does not match repository"; \ fi || exit; \ @@ -1008,7 +1088,8 @@ check_public: $(VERSION_DEPS) rm -fr public.dir mkdir public.dir ln $(VERSION_DEPS) public.dir - cd public.dir && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL + cd public.dir \ + && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' TZDIR='$(TZDIR)' ALL for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi \ public.dir/vanguard.zi public.dir/main.zi \ public.dir/rearguard.zi; \ @@ -1139,7 +1220,7 @@ tzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out sed '1s/$$/-rearguard/' $@.dir/version : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier. $(CREATE_EMPTY) $@.dir/pacificnew - touch -cmr version $@.dir/version + touch -mr version $@.dir/version LC_ALL=C && export LC_ALL && \ (cd $@.dir && \ tar $(TARFLAGS) -cf - \ @@ -1163,7 +1244,7 @@ tzdata$(VERSION)-tailored.tar.gz: set-timestamps.out `test $(DATAFORM) = vanguard || echo pacificnew` (grep '^#' tzdata.zi && echo && cat $(DATAFORM).zi) \ >$@.dir/etcetera - touch -cmr tzdata.zi $@.dir/etcetera + touch -mr tzdata.zi $@.dir/etcetera sed -n \ -e '/^# *version *\(.*\)/h' \ -e '/^# *ddeps */H' \ @@ -1174,7 +1255,7 @@ tzdata$(VERSION)-tailored.tar.gz: set-timestamps.out -e 's/ /-/g' \ -e 'p' \ $@.dir/version - touch -cmr version $@.dir/version + touch -mr version $@.dir/version links= && \ for file in $(TZDATA_DIST); do \ test -f $@.dir/$$file || links="$$links $$file"; \ @@ -1226,10 +1307,10 @@ zonenames: tzdata.zi asctime.o: private.h tzfile.h date.o: private.h difftime.o: private.h -localtime.o: private.h tzfile.h +localtime.o: private.h tzfile.h tzdir.h strftime.o: private.h tzfile.h zdump.o: version.h -zic.o: private.h tzfile.h version.h +zic.o: private.h tzfile.h tzdir.h version.h .PHONY: ALL INSTALL all .PHONY: check check_mild check_time_t_alternatives diff --git a/contrib/tzdata/NEWS b/contrib/tzdata/NEWS index b54538aa4a82..031ba6a8a250 100644 --- a/contrib/tzdata/NEWS +++ b/contrib/tzdata/NEWS @@ -1,5 +1,109 @@ News for the tz database +Release 2023d - 2023-12-21 20:02:24 -0800 + + Briefly: + Ittoqqortoormiit, Greenland changes time zones on 2024-03-31. + Vostok, Antarctica changed time zones on 2023-12-18. + Casey, Antarctica changed time zones five times since 2020. + Code and data fixes for Palestine timestamps starting in 2072. + A new data file zonenow.tab for timestamps starting now. + + Changes to future timestamps + + Ittoqqortoormiit, Greenland (America/Scoresbysund) joins most of + the rest of Greenland's timekeeping practice on 2024-03-31, by + changing its time zone from -01/+00 to -02/-01 at the same moment + as the spring-forward transition. Its clocks will therefore not + spring forward as previously scheduled. The time zone change + reverts to its common practice before 1981. + + Fix predictions for DST transitions in Palestine in 2072-2075, + correcting a typo introduced in 2023a. + + Changes to past and future timestamps + + Vostok, Antarctica changed to +05 on 2023-12-18. It had been at + +07 (not +06) for years. (Thanks to Zakhary V. Akulov.) + + Change data for Casey, Antarctica to agree with timeanddate.com, + by adding five time zone changes since 2020. Casey is now at +08 + instead of +11. + + Changes to past tm_isdst flags + + Much of Greenland, represented by America/Nuuk, changed its + standard time from -03 to -02 on 2023-03-25, not on 2023-10-28. + This does not affect UTC offsets, only the tm_isdst flag. + (Thanks to Thomas M. Steenholdt.) + + New data file + + A new data file zonenow.tab helps configure applications that use + timestamps dated from now on. This simplifies configuration, + since users choose from a smaller Zone set. The file's format is + experimental and subject to change. + + Changes to code + + localtime.c no longer mishandles TZif files that contain a single + transition into a DST regime. Previously, it incorrectly assumed + DST was in effect before the transition too. (Thanks to Alois + Treindl for debugging help.) + + localtime.c's timeoff no longer collides with OpenBSD 7.4. + + The C code now uses _Generic only if __STDC_VERSION__ says the + compiler is C11 or later. + + tzselect now optionally reads zonenow.tab, to simplify when + configuring only for timestamps dated from now on. + + tzselect no longer creates temporary files. + + tzselect no longer mishandles the following: + + Spaces and most other special characters in BUGEMAIL, PACKAGE, + TZDIR, and VERSION. + + TZ strings when using mawk 1.4.3, which mishandles regular + expressions of the form /X{2,}/. + + ISO 6709 coordinates when using an awk that lacks the GNU + extension of newlines in -v option-arguments. + + Non UTF-8 locales when using an iconv command that lacks the GNU + //TRANSLIT extension. + + zic no longer mishandles data for Palestine after the year 2075. + Previously, it incorrectly omitted post-2075 transitions that are + predicted for just before and just after Ramadan. (Thanks to Ken + Murchison for debugging help.) + + zic now works again on Linux 2.6.16 and 2.6.17 (2006). + (Problem reported by Rune Torgersen.) + + Changes to build procedure + + The Makefile is now more compatible with POSIX: + * It no longer defines AR, CC, CFLAGS, LDFLAGS, and SHELL. + * It no longer uses its own 'cc' in place of CC. + * It now uses ARFLAGS, with default specified by POSIX. + * It does not use LFLAGS incompatibly with POSIX. + * It uses the special .POSIX target. + * It quotes special characters more carefully. + * It no longer mishandles builds in an ISO 8859 locale. + Due to the CC changes, TZDIR is now #defined in a file tzfile.h + built by 'make', not in a $(CC) -D option. Also, TZDEFAULT is + now treated like TZDIR as they have similar roles. + + Changes to commentary + + Limitations and hazards of the optional support for obsolescent + C89 platforms are documented better, along with a tentative + schedule for removing this support. + + Release 2023c - 2023-03-28 12:42:14 -0700 Changes to past and future timestamps @@ -76,11 +180,14 @@ Release 2023a - 2023-03-22 12:39:33 -0700 platform dependent and abbreviations were silently truncated to 16 bytes even when the limit was greater than 16. - The code by default is now designed for C99 or later. To build in - a C89 environment, compile with -DPORT_TO_C89. To support C89 - callers of the tzcode library, compile with -DSUPPORT_C89. The - two new macros are transitional aids planned to be removed in a - future version, when C99 or later will be required. + The code by default is now designed for C99 or later. To build on + a mostly-C89 platform, compile with -DPORT_TO_C89; this should + work on C89 platforms that also support C99 'long long' and + perhaps a few other extensions to C89. To support C89 callers of + tzcode's library, compile with -DSUPPORT_C89; however, this could + trigger latent bugs in C99-or-later callers. The two new macros + are transitional aids planned to be removed in a future version + (say, in 2029), when C99 or later will be required. The code now builds again on pre-C99 platforms, if you compile with -DPORT_TO_C89. This fixes a bug introduced in 2022f. @@ -723,6 +830,8 @@ Release 2021b - 2021-09-24 16:23:00 -0700 them, set the EXPIRES_LINE Makefile variable. If a TZif file uses this new feature it is marked with a new TZif version number 4, a format intended to be documented in a successor to RFC 8536. + The old-format "#expires" comments are now treated solely as + comments and have no effect on the TZif files. zic -L LEAPFILE -r @LO no longer generates an invalid TZif file that omits leap second information for the range LO..B when LO @@ -4302,7 +4411,7 @@ Release 2012j - 2012-11-12 18:34:49 -0800 now uses tz@iana.org rather than the old elsie address. zic -v now complains about abbreviations that are less than 3 - or more than 6 characters, as per Posix. Formerly, it checked + or more than 6 characters, as per POSIX. Formerly, it checked for abbreviations that were more than 3. 'make public' no longer puts its temporary directory under /tmp, @@ -4467,8 +4576,8 @@ Release data2011m - 2011-10-24 21:42:16 +0700 In particular, the typos in comments in the data (2011-11-17 should have been 2011-10-17 as Alan Barrett noted, and spelling of Tiraspol that Tim Parenti noted) have been fixed, and the change for Ukraine has been - made in all 4 Ukrainian zones, rather than just Kiev (again, thanks to - Tim Parenti, and also Denys Gavrysh) + made in all 4 Ukrainian zones, rather than just Europe/Kiev + (again, thanks to Tim Parenti, and also Denys Gavrysh). In addition, I added Europe/Tiraspol to zone.tab. diff --git a/contrib/tzdata/README b/contrib/tzdata/README index 145aacd495b7..edabd2e0690f 100644 --- a/contrib/tzdata/README +++ b/contrib/tzdata/README @@ -11,14 +11,17 @@ changes made by political bodies to time zone boundaries, UTC offsets, and daylight-saving rules. See or the -file tz-link.html for how to acquire the code and data. Once acquired, -read the comments in the file 'Makefile' and make any changes needed -to make things right for your system, especially if you are using some -platform other than GNU/Linux. Then run the following commands, -substituting your desired installation directory for "$HOME/tzdir": - - make TOPDIR=$HOME/tzdir install - $HOME/tzdir/usr/bin/zdump -v America/Los_Angeles +file tz-link.html for how to acquire the code and data. + +Once acquired, read the leading comments in the file "Makefile" +and make any changes needed to make things right for your system, +especially when using a platform other than current GNU/Linux. + +Then run the following commands, substituting your desired +installation directory for "$HOME/tzdir": + + make TOPDIR="$HOME/tzdir" install + "$HOME/tzdir/usr/bin/zdump" -v America/Los_Angeles See the file tz-how-to.html for examples of how to read the data files. diff --git a/contrib/tzdata/africa b/contrib/tzdata/africa index 6cf4e39c8c45..6fae18c0979f 100644 --- a/contrib/tzdata/africa +++ b/contrib/tzdata/africa @@ -285,13 +285,6 @@ Rule Egypt 2007 only - Sep Thu>=1 24:00 0 - # reproduced by other (more accessible) sites[, e.g.,]... # http://elgornal.net/news/news.aspx?id=4699258 -# From Paul Eggert (2014-06-04): -# Sarah El Deeb and Lee Keath of AP report that the Egyptian government says -# the change is because of blackouts in Cairo, even though Ahram Online (cited -# above) says DST had no affect on electricity consumption. There is -# no information about when DST will end this fall. See: -# http://abcnews.go.com/International/wireStory/el-sissi-pushes-egyptians-line-23614833 - # From Steffen Thorsen (2015-04-08): # Egypt will start DST on midnight after Thursday, April 30, 2015. # This is based on a law (no 35) from May 15, 2014 saying it starts the last diff --git a/contrib/tzdata/antarctica b/contrib/tzdata/antarctica index fc603e9996de..763c27253c99 100644 --- a/contrib/tzdata/antarctica +++ b/contrib/tzdata/antarctica @@ -80,6 +80,11 @@ # - 2018 Oct 7 4:00 - 2019 Mar 17 3:00 - 2019 Oct 4 3:00 - 2020 Mar 8 3:00 # and now - 2020 Oct 4 0:01 +# From Paul Eggert (2023-12-20): +# Transitions from 2021 on are taken from: +# https://www.timeanddate.com/time/zone/antarctica/casey +# retrieved at various dates. + # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Antarctica/Casey 0 - -00 1969 8:00 - +08 2009 Oct 18 2:00 @@ -93,7 +98,12 @@ Zone Antarctica/Casey 0 - -00 1969 8:00 - +08 2019 Oct 4 3:00 11:00 - +11 2020 Mar 8 3:00 8:00 - +08 2020 Oct 4 0:01 - 11:00 - +11 + 11:00 - +11 2021 Mar 14 0:00 + 8:00 - +08 2021 Oct 3 0:01 + 11:00 - +11 2022 Mar 13 0:00 + 8:00 - +08 2022 Oct 2 0:01 + 11:00 - +11 2023 Mar 9 3:00 + 8:00 - +08 Zone Antarctica/Davis 0 - -00 1957 Jan 13 7:00 - +07 1964 Nov 0 - -00 1969 Feb @@ -240,7 +250,50 @@ Zone Antarctica/Troll 0 - -00 2005 Feb 12 # year-round from 1960/61 to 1992 # Vostok, since 1957-12-16, temporarily closed 1994-02/1994-11 -# See Asia/Urumqi. +# From Craig Mundell (1994-12-15): +# http://quest.arc.nasa.gov/antarctica/QA/computers/Directions,Time,ZIP +# Vostok, which is one of the Russian stations, is set on the same +# time as Moscow, Russia. +# +# From Lee Hotz (2001-03-08): +# I queried the folks at Columbia who spent the summer at Vostok and this is +# what they had to say about time there: +# "in the US Camp (East Camp) we have been on New Zealand (McMurdo) +# time, which is 12 hours ahead of GMT. The Russian Station Vostok was +# 6 hours behind that (although only 2 miles away, i.e. 6 hours ahead +# of GMT). This is a time zone I think two hours east of Moscow. The +# natural time zone is in between the two: 8 hours ahead of GMT." +# +# From Paul Eggert (2001-05-04): +# This seems to be hopelessly confusing, so I asked Lee Hotz about it +# in person. He said that some Antarctic locations set their local +# time so that noon is the warmest part of the day, and that this +# changes during the year and does not necessarily correspond to mean +# solar noon. So the Vostok time might have been whatever the clocks +# happened to be during their visit. So we still don't really know what time +# it is at Vostok. +# +# From Zakhary V. Akulov (2023-12-17 22:00:48 +0700): +# ... from December, 18, 2023 00:00 by my decision the local time of +# the Antarctic research base Vostok will correspond to UTC+5. +# (2023-12-19): We constantly interact with Progress base, with company who +# builds new wintering station, with sledge convoys, with aviation - they all +# use UTC+5. Besides, difference between Moscow time is just 2 hours now, not 4. +# (2023-12-19, in response to the question "Has local time at Vostok +# been UTC+6 ever since 1957, or has it changed before?"): No. At least +# since my antarctic career start, 10 years ago, Vostok base has UTC+7. +# (In response to a 2023-12-18 question "from 02:00 to 00:00 today"): This. +# +# From Paul Eggert (2023-12-18): +# For lack of better info, guess Vostok was at +07 from founding through today, +# except when closed. + +# Zone NAME STDOFF RULES FORMAT [UNTIL] +Zone Antarctica/Vostok 0 - -00 1957 Dec 16 + 7:00 - +07 1994 Feb + 0 - -00 1994 Nov + 7:00 - +07 2023 Dec 18 2:00 + 5:00 - +05 # S Africa - year-round bases # Marion Island, -4653+03752 diff --git a/contrib/tzdata/asia b/contrib/tzdata/asia index a29a4dc0c4de..04526c196931 100644 --- a/contrib/tzdata/asia +++ b/contrib/tzdata/asia @@ -655,7 +655,6 @@ Zone Asia/Shanghai 8:05:43 - LMT 1901 8:00 PRC C%sT # Xinjiang time, used by many in western China; represented by Ürümqi / Ürümchi # / Wulumuqi. (Please use Asia/Shanghai if you prefer Beijing time.) -# Vostok base in Antarctica matches this since 1970. Zone Asia/Urumqi 5:50:20 - LMT 1928 6:00 - +06 @@ -3427,6 +3426,9 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # From Heba Hamad (2023-03-22): # ... summer time will begin in Palestine from Saturday 04-29-2023, # 02:00 AM by 60 minutes forward. +# From Heba Hemad (2023-10-09): +# ... winter time will begin in Palestine from Saturday 10-28-2023, +# 02:00 AM by 60 minutes back. # # From Paul Eggert (2023-03-22): # For now, guess that spring and fall transitions will normally @@ -3548,13 +3550,13 @@ Rule Palestine 2070 only - Oct 4 2:00 0 - Rule Palestine 2071 only - Sep 19 2:00 0 - Rule Palestine 2072 only - Sep 10 2:00 0 - Rule Palestine 2072 only - Oct 15 2:00 1:00 S +Rule Palestine 2072 max - Oct Sat<=30 2:00 0 - Rule Palestine 2073 only - Sep 2 2:00 0 - Rule Palestine 2073 only - Oct 7 2:00 1:00 S Rule Palestine 2074 only - Aug 18 2:00 0 - Rule Palestine 2074 only - Sep 29 2:00 1:00 S Rule Palestine 2075 only - Aug 10 2:00 0 - Rule Palestine 2075 only - Sep 14 2:00 1:00 S -Rule Palestine 2075 max - Oct Sat<=30 2:00 0 - Rule Palestine 2076 only - Jul 25 2:00 0 - Rule Palestine 2076 only - Sep 5 2:00 1:00 S Rule Palestine 2077 only - Jul 17 2:00 0 - diff --git a/contrib/tzdata/australasia b/contrib/tzdata/australasia index 0633a30efd8b..dc98c1e2de17 100644 --- a/contrib/tzdata/australasia +++ b/contrib/tzdata/australasia @@ -391,8 +391,14 @@ Zone Antarctica/Macquarie 0 - -00 1899 Nov # Please note that there will not be any daylight savings time change # in Fiji for 2022-2023.... # https://www.facebook.com/FijianGovernment/posts/pfbid0mmWVTYmTibn66ybpFda75pDcf34SSpoSaskJW5gXwaKo5Sgc7273Q4fXWc6kQV6Hl + +# From Almaz Mingaleev (2023-10-06): +# Cabinet approved the suspension of Daylight Saving and appropriate +# legislative changes will be considered including the repeal of the +# Daylight Saving Act 1998 +# https://www.fiji.gov.fj/Media-Centre/Speeches/English/CABINET-DECISIONS-3-OCTOBER-2023 # -# From Paul Eggert (2022-10-27): +# From Paul Eggert (2023-10-06): # For now, assume DST is suspended indefinitely. # Rule NAME FROM TO - IN ON AT SAVE LETTER/S diff --git a/contrib/tzdata/backward b/contrib/tzdata/backward index 421f2ec6b9f8..65c711b37bf4 100644 --- a/contrib/tzdata/backward +++ b/contrib/tzdata/backward @@ -205,7 +205,6 @@ Link America/Puerto_Rico America/Tortola Link Pacific/Port_Moresby Antarctica/DumontDUrville Link Pacific/Auckland Antarctica/McMurdo Link Asia/Riyadh Antarctica/Syowa -Link Asia/Urumqi Antarctica/Vostok Link Europe/Berlin Arctic/Longyearbyen Link Asia/Riyadh Asia/Aden Link Asia/Qatar Asia/Bahrain diff --git a/contrib/tzdata/backzone b/contrib/tzdata/backzone index 44d81c29e5ae..f45250340493 100644 --- a/contrib/tzdata/backzone +++ b/contrib/tzdata/backzone @@ -963,35 +963,6 @@ Link Antarctica/McMurdo Antarctica/South_Pole Zone Antarctica/Syowa 0 - -00 1957 Jan 29 3:00 - +03 -# Vostok, Antarctica -# -# Vostok, since 1957-12-16, temporarily closed 1994-02/1994-11 -# From Craig Mundell (1994-12-15): -# http://quest.arc.nasa.gov/antarctica/QA/computers/Directions,Time,ZIP -# Vostok, which is one of the Russian stations, is set on the same -# time as Moscow, Russia. -# -# From Lee Hotz (2001-03-08): -# I queried the folks at Columbia who spent the summer at Vostok and this is -# what they had to say about time there: -# "in the US Camp (East Camp) we have been on New Zealand (McMurdo) -# time, which is 12 hours ahead of GMT. The Russian Station Vostok was -# 6 hours behind that (although only 2 miles away, i.e. 6 hours ahead -# of GMT). This is a time zone I think two hours east of Moscow. The -# natural time zone is in between the two: 8 hours ahead of GMT." -# -# From Paul Eggert (2001-05-04): -# This seems to be hopelessly confusing, so I asked Lee Hotz about it -# in person. He said that some Antarctic locations set their local -# time so that noon is the warmest part of the day, and that this -# changes during the year and does not necessarily correspond to mean -# solar noon. So the Vostok time might have been whatever the clocks -# happened to be during their visit. So we still don't really know what time -# it is at Vostok. But we'll guess +06. -# -Zone Antarctica/Vostok 0 - -00 1957 Dec 16 - 6:00 - +06 - # Yemen # Milne says 2:59:54 was the meridian of the saluting battery at Aden, # and that Yemen was at 1:55:56, the meridian of the Hagia Sophia. diff --git a/contrib/tzdata/checknow.awk b/contrib/tzdata/checknow.awk new file mode 100644 index 000000000000..d722c03fd689 --- /dev/null +++ b/contrib/tzdata/checknow.awk @@ -0,0 +1,54 @@ +# Check zonenow.tab for consistency with primary data. + +# Contributed by Paul Eggert. This file is in the public domain. + +function record_zone(zone, data) { + if (zone) { + zone_data[zone] = data + zones[data] = zones[data] " " zone + } +} + +BEGIN { + while (getline >"/dev/stderr" status = 1 @@ -110,7 +110,7 @@ BEGIN { used_max_cc = cc } } - if (used_max <= 1 && comments) { + if (used_max <= 1 && comments && zone_table != "zonenow.tab") { printf "%s:%d: unnecessary comment '%s'\n", \ zone_table, i, comments \ >>"/dev/stderr" @@ -149,7 +149,8 @@ $1 ~ /^#/ { next } if ($3 ~ /%/) rulePercentUsed[$2] = 1 } if (tz && tz ~ /\// && tz !~ /^Etc\//) { - if (!tztab[tz] && FILENAME != "backward") { + if (!tztab[tz] && FILENAME != "backward" \ + && zone_table != "zonenow.tab") { printf "%s: no data for '%s'\n", zone_table, tz \ >>"/dev/stderr" status = 1 diff --git a/contrib/tzdata/europe b/contrib/tzdata/europe index 3907c055140a..27f821e77600 100644 --- a/contrib/tzdata/europe +++ b/contrib/tzdata/europe @@ -1123,6 +1123,23 @@ Zone Atlantic/Faroe -0:27:04 - LMT 1908 Jan 11 # Tórshavn # 2. The shift *from* DST in 2023 happens as normal, but coincides with the # shift to UTC-02 normaltime (people will not change their clocks here). # 3. After this, DST is still observed, but as -02/-01 instead of -03/-02. +# +# From Múte Bourup Egede via Jógvan Svabo Samuelsen (2023-03-15): +# Greenland will not switch to Daylight Saving Time this year, 2023, +# because the standard time for Greenland will change from UTC -3 to UTC -2. +# However, Greenland will change to Daylight Saving Time again in 2024 +# and onwards. + +# From a contributor who wishes to remain anonymous for now (2023-10-29): +# https://www.dr.dk/nyheder/seneste/i-nat-skal-uret-stilles-en-time-tilbage-men-foerste-gang-sker-det-ikke-i-groenland +# with a link to that page: +# https://naalakkersuisut.gl/Nyheder/2023/10/2710_sommertid *** 613 LINES SKIPPED *** From nobody Sun Dec 24 01:43:44 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SyP2T0KQqz55J4W; Sun, 24 Dec 2023 01:43: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SyP2S71H1z3VYM; Sun, 24 Dec 2023 01:43:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703382224; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oybLsO/0Xu8xAMpxA3VmkOAr5cAPIKw6Va7EVveZFiI=; b=Gj+n5Aylwd4RncKTmYPUoN90YlMKEBCxJSfnvdaC9+2yxbDmOnICOYfkwH0OV1a4xgUmDD 5kEE1hOkOqfLCqxN1i7wFvTUTOD9Lk61cQmU1H0yPT3Qw56U/bPnnOhQB3cUz3Iy25cZXO ymrW7XZSjY0+tWs8TJ5updi7KD8GMXxSMcgozCJ3j23Hmv+vRka0rsu35TpJwmCEusAa5o VcqAEIK7uO+9IhjG5vbpqwVbLnE1ckjURdcn2m2R/Ixran5GiykYB1y16/tBF2M194qFIF Le4NTdeRtEqA0TFK3se2ZTd5fDchQlBzfuLGSwdAqKXZl6bS704P9a2ihazjBg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703382224; a=rsa-sha256; cv=none; b=E6k0HcDmJ4u50GOEyBQprlnNGS4hSzHWY5t3MrPa5Dde0S7IvM+6xlGgXd6fQT62Iy6ihT 1E2k4IYILuOBQ0gouxPexl03CF+lpZbv5E067HxSQD3aUm7Lvrc1Pdi8AqZjhZdqnSbDGo 6xX+RIMOXf5qI1wy+ULHARUqvaODUBdTotMMyH4jpL091Pvl6Ht0XjVXjwNJlJjmPFSiyj ABwiEvk0kpkhIniHbtJfxTPyoNgO/+x2t0QbQJLJceylEig9MhifC4ga/HC7jYFpyt0mli kMu69dou6fEATmZxd695Kn5Wefdjcgtgvkq7/z4VmQI5hqCpLwwXLTX2rPEwUA== 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=1703382224; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oybLsO/0Xu8xAMpxA3VmkOAr5cAPIKw6Va7EVveZFiI=; b=Aj5TbKFdEavaMpkwPlnraYmcSgSMbf39dtKAyRybNfjQZlSTpMiL1dWgdweOp0J0ZHTGwx 3QHTAhNIf380q5Dmz/lMAiPvKH9J9aq9nm59sjdQ9rqrKb8Ku6JqrryHIwZffA1u4GbxQm Tu6aDnlxkFMYMqnIuwkvhBI747xmyyZuOa1ykVeRBwv6NvBC2LbindQAibSEgDGpyopUJY cHmFLIFPOPSyTYogIb5tdqDxx8iCyuTn2q4I18hhLlmd1QwQ4izLjzMZ5Q5en8TfgE/owc nznV7D6uC0/kHMS16GKtPW7gy9ZDcmmvxi1oYKZe/o8ar+iEbYueaEqS/D+7/g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SyP2S64vGz1MyY; Sun, 24 Dec 2023 01:43:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BO1hiYK016454; Sun, 24 Dec 2023 01:43:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BO1hiNs016451; Sun, 24 Dec 2023 01:43:44 GMT (envelope-from git) Date: Sun, 24 Dec 2023 01:43:44 GMT Message-Id: <202312240143.3BO1hiNs016451@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Philip Paeps Subject: git: 98a75346bb65 - stable/12 - contrib/tzdata: import tzdata 2023d List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 98a75346bb6521c747dc976842456730627e93e9 Auto-Submitted: auto-generated The branch stable/12 has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=98a75346bb6521c747dc976842456730627e93e9 commit 98a75346bb6521c747dc976842456730627e93e9 Author: Philip Paeps AuthorDate: 2023-12-23 01:51:01 +0000 Commit: Philip Paeps CommitDate: 2023-12-24 01:42:38 +0000 contrib/tzdata: import tzdata 2023d Changes: https://github.com/eggert/tz/blob/2023d/NEWS (cherry picked from commit eebb9c2caea1584773ae4cec311cee1eea5b1655) --- contrib/tzdata/Makefile | 209 ++++++++++++++++++--------- contrib/tzdata/NEWS | 125 ++++++++++++++-- contrib/tzdata/README | 19 +-- contrib/tzdata/africa | 7 - contrib/tzdata/antarctica | 57 +++++++- contrib/tzdata/asia | 6 +- contrib/tzdata/australasia | 8 +- contrib/tzdata/backward | 1 - contrib/tzdata/backzone | 29 ---- contrib/tzdata/checknow.awk | 54 +++++++ contrib/tzdata/checktab.awk | 7 +- contrib/tzdata/europe | 29 +++- contrib/tzdata/leap-seconds.list | 8 +- contrib/tzdata/leapseconds | 8 +- contrib/tzdata/northamerica | 2 +- contrib/tzdata/southamerica | 6 + contrib/tzdata/version | 2 +- contrib/tzdata/zone.tab | 24 ++-- contrib/tzdata/zone1970.tab | 29 ++-- contrib/tzdata/zonenow.tab | 301 +++++++++++++++++++++++++++++++++++++++ 20 files changed, 763 insertions(+), 168 deletions(-) diff --git a/contrib/tzdata/Makefile b/contrib/tzdata/Makefile index 6edc73cc6ffb..4e45f93b915c 100644 --- a/contrib/tzdata/Makefile +++ b/contrib/tzdata/Makefile @@ -1,7 +1,25 @@ # 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: +# On older platforms you may need to scrounge for a POSIX-conforming 'make'. +# For example, on Solaris 10 (2005), use /usr/sfw/bin/gmake or +# /usr/xpg4/bin/make, not /usr/ccs/bin/make. + +# To affect how this Makefile works, you can run a shell script like this: +# +# #!/bin/sh +# make CC='gcc -std=gnu11' "$@" +# +# This example script is appropriate for a pre-2017 GNU/Linux system +# where a non-default setting is needed to support this package's use of C99. +# +# 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 @@ -191,8 +209,9 @@ UTF8_LOCALE= en_US.utf8 # On some hosts, this should have -lintl unless CFLAGS has -DHAVE_GETTEXT=0. LDLIBS= -# Add the following to the end of the "CFLAGS=" line as needed to override -# defaults specified in the source code. "-DFOO" is equivalent to "-DFOO=1". +# 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 @@ -234,11 +253,16 @@ LDLIBS= # -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 -# -DPORT_TO_C89 if tzcode should also run on C89 platforms+ +# -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=long on hosts like MS-Windows that lack ssize_t # -DSUPPORT_C89 if the tzcode library should support C89 callers+ +# However, this might trigger latent bugs in C99-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; @@ -270,11 +294,15 @@ LDLIBS= # -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. +# once the code assumes C99 or later, say in the year 2029. # # Select instrumentation via "make GCC_INSTRUMENT='whatever'". GCC_INSTRUMENT = \ @@ -353,9 +381,11 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \ # 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. -# "timelocal" is equivalent to "mktime". +# I.e., "offtime" is 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 @@ -378,7 +408,7 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \ # # 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 +# which claims to test C and POSIX conformance. If you want to pass PCTS, add # -DPCTS # to the end of the "CFLAGS=" line. # @@ -388,13 +418,21 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \ # 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= +#CFLAGS= -O 1 -# Linker flags. Default to $(LFLAGS) for backwards compatibility -# to release 2012h and earlier. -LDFLAGS= $(LFLAGS) +# 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 202x/D3. +#AR = ar +#ARFLAGS = -rv +#CC = c17 +#LDFLAGS = +#MAKE = make # For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in # submake command lines. The default is no leap seconds. @@ -418,18 +456,18 @@ ZFLAGS= ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS) -# The name of a Posix-compliant 'awk' on your system. +# 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. AWK= awk -# The full path name of a Posix-compliant shell, preferably one that supports +# 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 +# lacks 'select' or doesn't completely conform to POSIX, but /bin/bash # is typically nicer if it works. KSHELL= /bin/bash @@ -503,17 +541,16 @@ GZIPFLAGS= -9n DIFF_TZS= diff -u$$(! diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1 \ || echo ' -F^TZ=') -############################################################################### - -#MAKE= make +# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. +RANLIB= : -cc= cc -CC= $(cc) -DTZDIR='"$(TZDIR)"' +# 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 -AR= ar +# End of macros that one plausibly might want to tailor. +############################################################################### -# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. -RANLIB= : TZCOBJS= zic.o TZDOBJS= zdump.o localtime.o asctime.o strftime.o @@ -543,7 +580,7 @@ YDATA= $(PRIMARY_YDATA) etcetera NDATA= factory TDATA_TO_CHECK= $(YDATA) $(NDATA) backward TDATA= $(YDATA) $(NDATA) $(BACKWARD) -ZONETABLES= zone1970.tab zone.tab +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) \ @@ -551,7 +588,7 @@ TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) \ DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST) DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ leapseconds $(ZONETABLES) -AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk \ +AWK_SCRIPTS= checklinks.awk checknow.awk checktab.awk leapseconds.awk \ ziguard.awk zishrink.awk MISC= $(AWK_SCRIPTS) TZS_YEAR= 2050 @@ -572,7 +609,7 @@ VERSION_DEPS= \ calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \ africa antarctica asctime.c asia australasia \ backward backzone \ - checklinks.awk checktab.awk \ + checklinks.awk checknow.awk checktab.awk \ date.1 date.c difftime.c \ etcetera europe factory iso3166.tab \ leap-seconds.list leapseconds.awk localtime.c \ @@ -582,12 +619,7 @@ VERSION_DEPS= \ 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 - -# And for the benefit of csh users on systems that assume the user -# shell should be used to handle commands in Makefiles. . . - -SHELL= /bin/sh + zone.tab zone1970.tab zonenow.tab all: tzselect zic zdump libtz.a $(TABDATA) \ vanguard.zi main.zi rearguard.zi @@ -657,6 +689,16 @@ tzdata.zi: $(DATAFORM).zi version zishrink.awk $(DATAFORM).zi >$@.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 VERSION=`cat version` && printf '%s\n' \ 'static char const PKGVERSION[]="($(PACKAGE)) ";' \ @@ -763,7 +805,7 @@ force_tzs: $(TZS_NEW) libtz.a: $(LIBOBJS) rm -f $@ - $(AR) -rc $@ $(LIBOBJS) + $(AR) $(ARFLAGS) $@ $(LIBOBJS) $(RANLIB) $@ date: $(DATEOBJS) @@ -771,26 +813,32 @@ date: $(DATEOBJS) tzselect: tzselect.ksh version VERSION=`cat version` && sed \ - -e 's|#!/bin/bash|#!$(KSHELL)|g' \ - -e 's|AWK=[^}]*|AWK='\''$(AWK)'\''|g' \ - -e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \ - -e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \ - -e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \ - -e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \ - <$@.ksh >$@.out + -e "s'#!/bin/bash'#!"'$(KSHELL)'\' \ + -e s\''\(AWK\)=[^}]*'\''\1=\'\''$(AWK)\'\'\' \ + -e s\''\(PKGVERSION\)=.*'\''\1=\'\''($(PACKAGE)) \'\'\' \ + -e s\''\(REPORT_BUGS_TO\)=.*'\''\1=\'\''$(BUGEMAIL)\'\'\' \ + -e s\''\(TZDIR\)=[^}]*'\''\1=\'\''$(TZDIR)\'\'\' \ + -e s\''\(TZVERSION\)=.*'\''\1=\'"'$$VERSION\\''" \ + <$@.ksh >$@.out chmod +x $@.out mv $@.out $@ check: check_back check_mild check_mild: check_character_set check_white_space check_links \ - check_name_lengths check_slashed_abbrs check_sorted \ + check_name_lengths check_now \ + check_slashed_abbrs check_sorted \ check_tables check_web check_ziguard check_zishrink check_tzs +# 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 \ + || { LC_ALL='$(UTF8_LOCALE)'; export LC_ALL; false; }; } + check_character_set: $(ENCHILADA) - test ! '$(UTF8_LOCALE)' || \ - ! printf 'A\304\200B\n' | \ - LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 || { \ - LC_ALL='$(UTF8_LOCALE)' && export LC_ALL && \ + $(UTF8_LOCALE_MISSING) || { \ sharp='#' && \ ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \ $(MISC) $(SOURCES) $(WEB_PAGES) \ @@ -805,12 +853,12 @@ check_character_set: $(ENCHILADA) touch $@ check_white_space: $(ENCHILADA) + $(UTF8_LOCALE_MISSING) || { \ patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \ - ! grep -En "$$pat" \ - $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list) - ! grep -n '[$s]$$' \ - $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list) - touch $@ + ! grep -En "$$pat|[$s]\$$" \ + $$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list); \ + } + touch $@ PRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+ FILE_NAME_COMPONENT_TOO_LONG = $(PRECEDES_FILE_NAME)[^$s]*[^/$s]{15} @@ -851,7 +899,29 @@ check_links: checklinks.awk tzdata.zi -f checklinks.awk tzdata.zi touch $@ -check_tables: checktab.awk $(YDATA) backward $(ZONETABLES) +# Check timestamps from now through 28 years from now, to make sure +# that zonenow.tab contains all sequences of planned timestamps, +# without any duplicate sequences. In theory this might require +# 2800 years but that would take a long time to check. +CHECK_NOW_TIMESTAMP = `./date +%s` +CHECK_NOW_FUTURE_YEARS = 28 +CHECK_NOW_FUTURE_SECS = $(CHECK_NOW_FUTURE_YEARS) '*' 366 '*' 24 '*' 60 '*' 60 +check_now: checknow.awk date tzdata.zi zdump zic zone1970.tab zonenow.tab + rm -fr $@.dir + mkdir $@.dir + ./zic -d $@.dir tzdata.zi + now=$(CHECK_NOW_TIMESTAMP) && \ + future=`expr $(CHECK_NOW_FUTURE_SECS) + $$now` && \ + ./zdump -i -t $$now,$$future \ + $$(find $$PWD/$@.dir/????*/ -type f) \ + >$@.dir/zdump.tab + $(AWK) \ + -v zdump_table=$@.dir/zdump.tab \ + -f checknow.awk zonenow.tab + rm -fr $@.dir + touch $@ + +check_tables: checktab.awk $(YDATA) backward zone.tab zone1970.tab for tab in $(ZONETABLES); do \ test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \ $(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \ @@ -911,10 +981,10 @@ check_zishrink_posix check_zishrink_right: \ touch $@ clean_misc: - rm -fr check_*.dir + rm -fr check_*.dir typecheck_*.dir rm -f *.o *.out $(TIME_T_ALTERNATIVES) \ check_* core typecheck_* \ - date tzselect version.h zdump zic libtz.a + date tzdir.h tzselect version.h zdump zic libtz.a clean: clean_misc rm -fr *.dir tzdb-*/ rm -f *.zi $(TZS_NEW) @@ -952,12 +1022,18 @@ $(MANTXTS): workman.sh # plus N if GNU ls and touch are available. SET_TIMESTAMP_N = sh -c '\ n=$$0 dest=$$1; shift; \ - touch -cmr `ls -t "$$@" | sed 1q` "$$dest" && \ + <"$$dest" && \ if test $$n != 0 && \ - lsout=`ls -n --time-style="+%s" "$$dest" 2>/dev/null`; then \ + lsout=`ls -nt --time-style="+%s" "$$@" 2>/dev/null`; then \ set x $$lsout && \ - touch -cmd @`expr $$7 + $$n` "$$dest"; \ - else :; fi' + timestamp=`expr $$7 + $$n` && \ + echo "+ touch -md @$$timestamp $$dest" && \ + touch -md @$$timestamp "$$dest"; \ + else \ + newest=`ls -t "$$@" | sed 1q` && \ + echo "+ touch -mr $$newest $$dest" && \ + touch -mr "$$newest" "$$dest"; \ + fi' # If DEST depends on A B C ... in this Makefile, callers should use # $(SET_TIMESTAMP_DEP) DEST A B C ..., for the benefit of any # downstream 'make' that considers equal timestamps to be out of date. @@ -982,8 +1058,12 @@ set-timestamps.out: $(EIGHT_YARDS) rm -f test.out && \ for file in $$files; do \ if git diff --quiet $$file; then \ - time=`git log -1 --format='tformat:%ct' $$file` && \ - touch -cmd @$$time $$file; \ + time=`TZ=UTC0 git log -1 \ + --format='tformat:%cd' \ + --date='format:%Y-%m-%dT%H:%M:%SZ' \ + $$file` && \ + echo "+ touch -md $$time $$file" && \ + touch -md $$time $$file; \ else \ echo >&2 "$$file: warning: does not match repository"; \ fi || exit; \ @@ -1008,7 +1088,8 @@ check_public: $(VERSION_DEPS) rm -fr public.dir mkdir public.dir ln $(VERSION_DEPS) public.dir - cd public.dir && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL + cd public.dir \ + && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' TZDIR='$(TZDIR)' ALL for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi \ public.dir/vanguard.zi public.dir/main.zi \ public.dir/rearguard.zi; \ @@ -1139,7 +1220,7 @@ tzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out sed '1s/$$/-rearguard/' $@.dir/version : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier. $(CREATE_EMPTY) $@.dir/pacificnew - touch -cmr version $@.dir/version + touch -mr version $@.dir/version LC_ALL=C && export LC_ALL && \ (cd $@.dir && \ tar $(TARFLAGS) -cf - \ @@ -1163,7 +1244,7 @@ tzdata$(VERSION)-tailored.tar.gz: set-timestamps.out `test $(DATAFORM) = vanguard || echo pacificnew` (grep '^#' tzdata.zi && echo && cat $(DATAFORM).zi) \ >$@.dir/etcetera - touch -cmr tzdata.zi $@.dir/etcetera + touch -mr tzdata.zi $@.dir/etcetera sed -n \ -e '/^# *version *\(.*\)/h' \ -e '/^# *ddeps */H' \ @@ -1174,7 +1255,7 @@ tzdata$(VERSION)-tailored.tar.gz: set-timestamps.out -e 's/ /-/g' \ -e 'p' \ $@.dir/version - touch -cmr version $@.dir/version + touch -mr version $@.dir/version links= && \ for file in $(TZDATA_DIST); do \ test -f $@.dir/$$file || links="$$links $$file"; \ @@ -1226,10 +1307,10 @@ zonenames: tzdata.zi asctime.o: private.h tzfile.h date.o: private.h difftime.o: private.h -localtime.o: private.h tzfile.h +localtime.o: private.h tzfile.h tzdir.h strftime.o: private.h tzfile.h zdump.o: version.h -zic.o: private.h tzfile.h version.h +zic.o: private.h tzfile.h tzdir.h version.h .PHONY: ALL INSTALL all .PHONY: check check_mild check_time_t_alternatives diff --git a/contrib/tzdata/NEWS b/contrib/tzdata/NEWS index b54538aa4a82..031ba6a8a250 100644 --- a/contrib/tzdata/NEWS +++ b/contrib/tzdata/NEWS @@ -1,5 +1,109 @@ News for the tz database +Release 2023d - 2023-12-21 20:02:24 -0800 + + Briefly: + Ittoqqortoormiit, Greenland changes time zones on 2024-03-31. + Vostok, Antarctica changed time zones on 2023-12-18. + Casey, Antarctica changed time zones five times since 2020. + Code and data fixes for Palestine timestamps starting in 2072. + A new data file zonenow.tab for timestamps starting now. + + Changes to future timestamps + + Ittoqqortoormiit, Greenland (America/Scoresbysund) joins most of + the rest of Greenland's timekeeping practice on 2024-03-31, by + changing its time zone from -01/+00 to -02/-01 at the same moment + as the spring-forward transition. Its clocks will therefore not + spring forward as previously scheduled. The time zone change + reverts to its common practice before 1981. + + Fix predictions for DST transitions in Palestine in 2072-2075, + correcting a typo introduced in 2023a. + + Changes to past and future timestamps + + Vostok, Antarctica changed to +05 on 2023-12-18. It had been at + +07 (not +06) for years. (Thanks to Zakhary V. Akulov.) + + Change data for Casey, Antarctica to agree with timeanddate.com, + by adding five time zone changes since 2020. Casey is now at +08 + instead of +11. + + Changes to past tm_isdst flags + + Much of Greenland, represented by America/Nuuk, changed its + standard time from -03 to -02 on 2023-03-25, not on 2023-10-28. + This does not affect UTC offsets, only the tm_isdst flag. + (Thanks to Thomas M. Steenholdt.) + + New data file + + A new data file zonenow.tab helps configure applications that use + timestamps dated from now on. This simplifies configuration, + since users choose from a smaller Zone set. The file's format is + experimental and subject to change. + + Changes to code + + localtime.c no longer mishandles TZif files that contain a single + transition into a DST regime. Previously, it incorrectly assumed + DST was in effect before the transition too. (Thanks to Alois + Treindl for debugging help.) + + localtime.c's timeoff no longer collides with OpenBSD 7.4. + + The C code now uses _Generic only if __STDC_VERSION__ says the + compiler is C11 or later. + + tzselect now optionally reads zonenow.tab, to simplify when + configuring only for timestamps dated from now on. + + tzselect no longer creates temporary files. + + tzselect no longer mishandles the following: + + Spaces and most other special characters in BUGEMAIL, PACKAGE, + TZDIR, and VERSION. + + TZ strings when using mawk 1.4.3, which mishandles regular + expressions of the form /X{2,}/. + + ISO 6709 coordinates when using an awk that lacks the GNU + extension of newlines in -v option-arguments. + + Non UTF-8 locales when using an iconv command that lacks the GNU + //TRANSLIT extension. + + zic no longer mishandles data for Palestine after the year 2075. + Previously, it incorrectly omitted post-2075 transitions that are + predicted for just before and just after Ramadan. (Thanks to Ken + Murchison for debugging help.) + + zic now works again on Linux 2.6.16 and 2.6.17 (2006). + (Problem reported by Rune Torgersen.) + + Changes to build procedure + + The Makefile is now more compatible with POSIX: + * It no longer defines AR, CC, CFLAGS, LDFLAGS, and SHELL. + * It no longer uses its own 'cc' in place of CC. + * It now uses ARFLAGS, with default specified by POSIX. + * It does not use LFLAGS incompatibly with POSIX. + * It uses the special .POSIX target. + * It quotes special characters more carefully. + * It no longer mishandles builds in an ISO 8859 locale. + Due to the CC changes, TZDIR is now #defined in a file tzfile.h + built by 'make', not in a $(CC) -D option. Also, TZDEFAULT is + now treated like TZDIR as they have similar roles. + + Changes to commentary + + Limitations and hazards of the optional support for obsolescent + C89 platforms are documented better, along with a tentative + schedule for removing this support. + + Release 2023c - 2023-03-28 12:42:14 -0700 Changes to past and future timestamps @@ -76,11 +180,14 @@ Release 2023a - 2023-03-22 12:39:33 -0700 platform dependent and abbreviations were silently truncated to 16 bytes even when the limit was greater than 16. - The code by default is now designed for C99 or later. To build in - a C89 environment, compile with -DPORT_TO_C89. To support C89 - callers of the tzcode library, compile with -DSUPPORT_C89. The - two new macros are transitional aids planned to be removed in a - future version, when C99 or later will be required. + The code by default is now designed for C99 or later. To build on + a mostly-C89 platform, compile with -DPORT_TO_C89; this should + work on C89 platforms that also support C99 'long long' and + perhaps a few other extensions to C89. To support C89 callers of + tzcode's library, compile with -DSUPPORT_C89; however, this could + trigger latent bugs in C99-or-later callers. The two new macros + are transitional aids planned to be removed in a future version + (say, in 2029), when C99 or later will be required. The code now builds again on pre-C99 platforms, if you compile with -DPORT_TO_C89. This fixes a bug introduced in 2022f. @@ -723,6 +830,8 @@ Release 2021b - 2021-09-24 16:23:00 -0700 them, set the EXPIRES_LINE Makefile variable. If a TZif file uses this new feature it is marked with a new TZif version number 4, a format intended to be documented in a successor to RFC 8536. + The old-format "#expires" comments are now treated solely as + comments and have no effect on the TZif files. zic -L LEAPFILE -r @LO no longer generates an invalid TZif file that omits leap second information for the range LO..B when LO @@ -4302,7 +4411,7 @@ Release 2012j - 2012-11-12 18:34:49 -0800 now uses tz@iana.org rather than the old elsie address. zic -v now complains about abbreviations that are less than 3 - or more than 6 characters, as per Posix. Formerly, it checked + or more than 6 characters, as per POSIX. Formerly, it checked for abbreviations that were more than 3. 'make public' no longer puts its temporary directory under /tmp, @@ -4467,8 +4576,8 @@ Release data2011m - 2011-10-24 21:42:16 +0700 In particular, the typos in comments in the data (2011-11-17 should have been 2011-10-17 as Alan Barrett noted, and spelling of Tiraspol that Tim Parenti noted) have been fixed, and the change for Ukraine has been - made in all 4 Ukrainian zones, rather than just Kiev (again, thanks to - Tim Parenti, and also Denys Gavrysh) + made in all 4 Ukrainian zones, rather than just Europe/Kiev + (again, thanks to Tim Parenti, and also Denys Gavrysh). In addition, I added Europe/Tiraspol to zone.tab. diff --git a/contrib/tzdata/README b/contrib/tzdata/README index 145aacd495b7..edabd2e0690f 100644 --- a/contrib/tzdata/README +++ b/contrib/tzdata/README @@ -11,14 +11,17 @@ changes made by political bodies to time zone boundaries, UTC offsets, and daylight-saving rules. See or the -file tz-link.html for how to acquire the code and data. Once acquired, -read the comments in the file 'Makefile' and make any changes needed -to make things right for your system, especially if you are using some -platform other than GNU/Linux. Then run the following commands, -substituting your desired installation directory for "$HOME/tzdir": - - make TOPDIR=$HOME/tzdir install - $HOME/tzdir/usr/bin/zdump -v America/Los_Angeles +file tz-link.html for how to acquire the code and data. + +Once acquired, read the leading comments in the file "Makefile" +and make any changes needed to make things right for your system, +especially when using a platform other than current GNU/Linux. + +Then run the following commands, substituting your desired +installation directory for "$HOME/tzdir": + + make TOPDIR="$HOME/tzdir" install + "$HOME/tzdir/usr/bin/zdump" -v America/Los_Angeles See the file tz-how-to.html for examples of how to read the data files. diff --git a/contrib/tzdata/africa b/contrib/tzdata/africa index 6cf4e39c8c45..6fae18c0979f 100644 --- a/contrib/tzdata/africa +++ b/contrib/tzdata/africa @@ -285,13 +285,6 @@ Rule Egypt 2007 only - Sep Thu>=1 24:00 0 - # reproduced by other (more accessible) sites[, e.g.,]... # http://elgornal.net/news/news.aspx?id=4699258 -# From Paul Eggert (2014-06-04): -# Sarah El Deeb and Lee Keath of AP report that the Egyptian government says -# the change is because of blackouts in Cairo, even though Ahram Online (cited -# above) says DST had no affect on electricity consumption. There is -# no information about when DST will end this fall. See: -# http://abcnews.go.com/International/wireStory/el-sissi-pushes-egyptians-line-23614833 - # From Steffen Thorsen (2015-04-08): # Egypt will start DST on midnight after Thursday, April 30, 2015. # This is based on a law (no 35) from May 15, 2014 saying it starts the last diff --git a/contrib/tzdata/antarctica b/contrib/tzdata/antarctica index fc603e9996de..763c27253c99 100644 --- a/contrib/tzdata/antarctica +++ b/contrib/tzdata/antarctica @@ -80,6 +80,11 @@ # - 2018 Oct 7 4:00 - 2019 Mar 17 3:00 - 2019 Oct 4 3:00 - 2020 Mar 8 3:00 # and now - 2020 Oct 4 0:01 +# From Paul Eggert (2023-12-20): +# Transitions from 2021 on are taken from: +# https://www.timeanddate.com/time/zone/antarctica/casey +# retrieved at various dates. + # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Antarctica/Casey 0 - -00 1969 8:00 - +08 2009 Oct 18 2:00 @@ -93,7 +98,12 @@ Zone Antarctica/Casey 0 - -00 1969 8:00 - +08 2019 Oct 4 3:00 11:00 - +11 2020 Mar 8 3:00 8:00 - +08 2020 Oct 4 0:01 - 11:00 - +11 + 11:00 - +11 2021 Mar 14 0:00 + 8:00 - +08 2021 Oct 3 0:01 + 11:00 - +11 2022 Mar 13 0:00 + 8:00 - +08 2022 Oct 2 0:01 + 11:00 - +11 2023 Mar 9 3:00 + 8:00 - +08 Zone Antarctica/Davis 0 - -00 1957 Jan 13 7:00 - +07 1964 Nov 0 - -00 1969 Feb @@ -240,7 +250,50 @@ Zone Antarctica/Troll 0 - -00 2005 Feb 12 # year-round from 1960/61 to 1992 # Vostok, since 1957-12-16, temporarily closed 1994-02/1994-11 -# See Asia/Urumqi. +# From Craig Mundell (1994-12-15): +# http://quest.arc.nasa.gov/antarctica/QA/computers/Directions,Time,ZIP +# Vostok, which is one of the Russian stations, is set on the same +# time as Moscow, Russia. +# +# From Lee Hotz (2001-03-08): +# I queried the folks at Columbia who spent the summer at Vostok and this is +# what they had to say about time there: +# "in the US Camp (East Camp) we have been on New Zealand (McMurdo) +# time, which is 12 hours ahead of GMT. The Russian Station Vostok was +# 6 hours behind that (although only 2 miles away, i.e. 6 hours ahead +# of GMT). This is a time zone I think two hours east of Moscow. The +# natural time zone is in between the two: 8 hours ahead of GMT." +# +# From Paul Eggert (2001-05-04): +# This seems to be hopelessly confusing, so I asked Lee Hotz about it +# in person. He said that some Antarctic locations set their local +# time so that noon is the warmest part of the day, and that this +# changes during the year and does not necessarily correspond to mean +# solar noon. So the Vostok time might have been whatever the clocks +# happened to be during their visit. So we still don't really know what time +# it is at Vostok. +# +# From Zakhary V. Akulov (2023-12-17 22:00:48 +0700): +# ... from December, 18, 2023 00:00 by my decision the local time of +# the Antarctic research base Vostok will correspond to UTC+5. +# (2023-12-19): We constantly interact with Progress base, with company who +# builds new wintering station, with sledge convoys, with aviation - they all +# use UTC+5. Besides, difference between Moscow time is just 2 hours now, not 4. +# (2023-12-19, in response to the question "Has local time at Vostok +# been UTC+6 ever since 1957, or has it changed before?"): No. At least +# since my antarctic career start, 10 years ago, Vostok base has UTC+7. +# (In response to a 2023-12-18 question "from 02:00 to 00:00 today"): This. +# +# From Paul Eggert (2023-12-18): +# For lack of better info, guess Vostok was at +07 from founding through today, +# except when closed. + +# Zone NAME STDOFF RULES FORMAT [UNTIL] +Zone Antarctica/Vostok 0 - -00 1957 Dec 16 + 7:00 - +07 1994 Feb + 0 - -00 1994 Nov + 7:00 - +07 2023 Dec 18 2:00 + 5:00 - +05 # S Africa - year-round bases # Marion Island, -4653+03752 diff --git a/contrib/tzdata/asia b/contrib/tzdata/asia index a29a4dc0c4de..04526c196931 100644 --- a/contrib/tzdata/asia +++ b/contrib/tzdata/asia @@ -655,7 +655,6 @@ Zone Asia/Shanghai 8:05:43 - LMT 1901 8:00 PRC C%sT # Xinjiang time, used by many in western China; represented by Ürümqi / Ürümchi # / Wulumuqi. (Please use Asia/Shanghai if you prefer Beijing time.) -# Vostok base in Antarctica matches this since 1970. Zone Asia/Urumqi 5:50:20 - LMT 1928 6:00 - +06 @@ -3427,6 +3426,9 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # From Heba Hamad (2023-03-22): # ... summer time will begin in Palestine from Saturday 04-29-2023, # 02:00 AM by 60 minutes forward. +# From Heba Hemad (2023-10-09): +# ... winter time will begin in Palestine from Saturday 10-28-2023, +# 02:00 AM by 60 minutes back. # # From Paul Eggert (2023-03-22): # For now, guess that spring and fall transitions will normally @@ -3548,13 +3550,13 @@ Rule Palestine 2070 only - Oct 4 2:00 0 - Rule Palestine 2071 only - Sep 19 2:00 0 - Rule Palestine 2072 only - Sep 10 2:00 0 - Rule Palestine 2072 only - Oct 15 2:00 1:00 S +Rule Palestine 2072 max - Oct Sat<=30 2:00 0 - Rule Palestine 2073 only - Sep 2 2:00 0 - Rule Palestine 2073 only - Oct 7 2:00 1:00 S Rule Palestine 2074 only - Aug 18 2:00 0 - Rule Palestine 2074 only - Sep 29 2:00 1:00 S Rule Palestine 2075 only - Aug 10 2:00 0 - Rule Palestine 2075 only - Sep 14 2:00 1:00 S -Rule Palestine 2075 max - Oct Sat<=30 2:00 0 - Rule Palestine 2076 only - Jul 25 2:00 0 - Rule Palestine 2076 only - Sep 5 2:00 1:00 S Rule Palestine 2077 only - Jul 17 2:00 0 - diff --git a/contrib/tzdata/australasia b/contrib/tzdata/australasia index 0633a30efd8b..dc98c1e2de17 100644 --- a/contrib/tzdata/australasia +++ b/contrib/tzdata/australasia @@ -391,8 +391,14 @@ Zone Antarctica/Macquarie 0 - -00 1899 Nov # Please note that there will not be any daylight savings time change # in Fiji for 2022-2023.... # https://www.facebook.com/FijianGovernment/posts/pfbid0mmWVTYmTibn66ybpFda75pDcf34SSpoSaskJW5gXwaKo5Sgc7273Q4fXWc6kQV6Hl + +# From Almaz Mingaleev (2023-10-06): +# Cabinet approved the suspension of Daylight Saving and appropriate +# legislative changes will be considered including the repeal of the +# Daylight Saving Act 1998 +# https://www.fiji.gov.fj/Media-Centre/Speeches/English/CABINET-DECISIONS-3-OCTOBER-2023 # -# From Paul Eggert (2022-10-27): +# From Paul Eggert (2023-10-06): # For now, assume DST is suspended indefinitely. # Rule NAME FROM TO - IN ON AT SAVE LETTER/S diff --git a/contrib/tzdata/backward b/contrib/tzdata/backward index 421f2ec6b9f8..65c711b37bf4 100644 --- a/contrib/tzdata/backward +++ b/contrib/tzdata/backward @@ -205,7 +205,6 @@ Link America/Puerto_Rico America/Tortola Link Pacific/Port_Moresby Antarctica/DumontDUrville Link Pacific/Auckland Antarctica/McMurdo Link Asia/Riyadh Antarctica/Syowa -Link Asia/Urumqi Antarctica/Vostok Link Europe/Berlin Arctic/Longyearbyen Link Asia/Riyadh Asia/Aden Link Asia/Qatar Asia/Bahrain diff --git a/contrib/tzdata/backzone b/contrib/tzdata/backzone index 44d81c29e5ae..f45250340493 100644 --- a/contrib/tzdata/backzone +++ b/contrib/tzdata/backzone @@ -963,35 +963,6 @@ Link Antarctica/McMurdo Antarctica/South_Pole Zone Antarctica/Syowa 0 - -00 1957 Jan 29 3:00 - +03 -# Vostok, Antarctica -# -# Vostok, since 1957-12-16, temporarily closed 1994-02/1994-11 -# From Craig Mundell (1994-12-15): -# http://quest.arc.nasa.gov/antarctica/QA/computers/Directions,Time,ZIP -# Vostok, which is one of the Russian stations, is set on the same -# time as Moscow, Russia. -# -# From Lee Hotz (2001-03-08): -# I queried the folks at Columbia who spent the summer at Vostok and this is -# what they had to say about time there: -# "in the US Camp (East Camp) we have been on New Zealand (McMurdo) -# time, which is 12 hours ahead of GMT. The Russian Station Vostok was -# 6 hours behind that (although only 2 miles away, i.e. 6 hours ahead -# of GMT). This is a time zone I think two hours east of Moscow. The -# natural time zone is in between the two: 8 hours ahead of GMT." -# -# From Paul Eggert (2001-05-04): -# This seems to be hopelessly confusing, so I asked Lee Hotz about it -# in person. He said that some Antarctic locations set their local -# time so that noon is the warmest part of the day, and that this -# changes during the year and does not necessarily correspond to mean -# solar noon. So the Vostok time might have been whatever the clocks -# happened to be during their visit. So we still don't really know what time -# it is at Vostok. But we'll guess +06. -# -Zone Antarctica/Vostok 0 - -00 1957 Dec 16 - 6:00 - +06 - # Yemen # Milne says 2:59:54 was the meridian of the saluting battery at Aden, # and that Yemen was at 1:55:56, the meridian of the Hagia Sophia. diff --git a/contrib/tzdata/checknow.awk b/contrib/tzdata/checknow.awk new file mode 100644 index 000000000000..d722c03fd689 --- /dev/null +++ b/contrib/tzdata/checknow.awk @@ -0,0 +1,54 @@ +# Check zonenow.tab for consistency with primary data. + +# Contributed by Paul Eggert. This file is in the public domain. + +function record_zone(zone, data) { + if (zone) { + zone_data[zone] = data + zones[data] = zones[data] " " zone + } +} + +BEGIN { + while (getline >"/dev/stderr" status = 1 @@ -110,7 +110,7 @@ BEGIN { used_max_cc = cc } } - if (used_max <= 1 && comments) { + if (used_max <= 1 && comments && zone_table != "zonenow.tab") { printf "%s:%d: unnecessary comment '%s'\n", \ zone_table, i, comments \ >>"/dev/stderr" @@ -149,7 +149,8 @@ $1 ~ /^#/ { next } if ($3 ~ /%/) rulePercentUsed[$2] = 1 } if (tz && tz ~ /\// && tz !~ /^Etc\//) { - if (!tztab[tz] && FILENAME != "backward") { + if (!tztab[tz] && FILENAME != "backward" \ + && zone_table != "zonenow.tab") { printf "%s: no data for '%s'\n", zone_table, tz \ >>"/dev/stderr" status = 1 diff --git a/contrib/tzdata/europe b/contrib/tzdata/europe index 3907c055140a..27f821e77600 100644 --- a/contrib/tzdata/europe +++ b/contrib/tzdata/europe @@ -1123,6 +1123,23 @@ Zone Atlantic/Faroe -0:27:04 - LMT 1908 Jan 11 # Tórshavn # 2. The shift *from* DST in 2023 happens as normal, but coincides with the # shift to UTC-02 normaltime (people will not change their clocks here). # 3. After this, DST is still observed, but as -02/-01 instead of -03/-02. +# +# From Múte Bourup Egede via Jógvan Svabo Samuelsen (2023-03-15): +# Greenland will not switch to Daylight Saving Time this year, 2023, +# because the standard time for Greenland will change from UTC -3 to UTC -2. +# However, Greenland will change to Daylight Saving Time again in 2024 +# and onwards. + +# From a contributor who wishes to remain anonymous for now (2023-10-29): +# https://www.dr.dk/nyheder/seneste/i-nat-skal-uret-stilles-en-time-tilbage-men-foerste-gang-sker-det-ikke-i-groenland +# with a link to that page: +# https://naalakkersuisut.gl/Nyheder/2023/10/2710_sommertid *** 613 LINES SKIPPED *** From nobody Sun Dec 24 14:02:11 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SyjQW72gMz54fhV; Sun, 24 Dec 2023 14:02: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SyjQW5Zzpz4CwD; Sun, 24 Dec 2023 14:02:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703426531; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xtEHlZnukWtFh3GuW2esgwQg3oZPIGxnjhhRlQXF5Cw=; b=TLUO+qRqa+d0yQIse9Ppc1rrUkiM7+3AFIi0CZWvvXlQx63SInWCGGFN8wF+nGjo6RQd84 3OP3VnrnwB6s6oOQu7ptk+ZMySiy3UszhhMjRtyi7+261VkA7/Da76sI2ouK+ejwDc11v/ 9sGd7CwQgkYDGAPUHTGMEZjAyTUAWoiGQChsEfp8JDrDk4gNMae+MPjOP8soJNn66vA3+j UHlIdeA8pQJRMelFG4TH7kM0O/pTcFkt5WtslGpqTig4iFFxNBN3LFyFfpPNQ82K9d+841 fFzZdIznmY8DZjSjNicfQZ76eGRD4I0OnLWKyzt1iRV4LvUpc5E1yZVBqSQEKQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703426531; a=rsa-sha256; cv=none; b=om+zmwxXnI1Tk3grh9DIeghm61NeWnN/8wAiHtGEc7zWkUWer6yb2QaJ8g3f+9sVs38Xw8 n+bnCw0kWPEGqwa2MvYr/WKhGzdB4PmjB87Ba3rjZTfep5FBB1EbwqXicWBa9YM/Cce/Dv pzvqdIToeS+4fssBHhB5Iyv25gNrgXkSMLMEUl2pvMX26Y1LL0lt76hdbQVNTHkYBT3K35 EMLYXycHY98oCaQkIFIzEfFQ8lBkmGFJbkPex+Iq6X51mUHHhB5YmufYd1XVRDdn8RLbi2 6QU9MLnaf/lhKZwd9p3ag9FpKoHEq7s79Gp7+7GPMCwdhyalNeVg/7d0nNmCWQ== 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=1703426531; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xtEHlZnukWtFh3GuW2esgwQg3oZPIGxnjhhRlQXF5Cw=; b=Adathmtf61jN9MFRmVcW4P7tyTRwhR+5Fjqk78P5L6mWSiEibesGu8KMipMR0diWnsYu73 Wt5gJorZE3DzI2Pds3wwgLdz5vSMyjXAPL4j/hkneuoUbxwqRvhBu6kza/Av0YdfP8T59b WO2jhA1qwUdgxrxni/4CjzhG4W2u/GHagQDxYBXT6v9Z2vJ41XmAb8nrSJtQl7iGDE3hqD gvmtzL2Xx2daqs6bywQvKxrbrPimdUmJ0xgq29I9xzDaqQBw6gKbVK9QT095KnKf4YdZAh uSR47V7nOATABsw+m8txFXNyp0Mbls+UCtLzvc2HNgIKvJPsPuAxshFh6kRvHg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SyjQW4fV4zWYL; Sun, 24 Dec 2023 14:02:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BOE2BYg057058; Sun, 24 Dec 2023 14:02:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BOE2BBp057055; Sun, 24 Dec 2023 14:02:11 GMT (envelope-from git) Date: Sun, 24 Dec 2023 14:02:11 GMT Message-Id: <202312241402.3BOE2BBp057055@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: f23f9c0fd2bd - stable/14 - Silence VLA extension warnings in fusefs tests List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f23f9c0fd2bdea5aa5cc9d78dfb17841b5afc7dc Auto-Submitted: auto-generated The branch stable/14 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=f23f9c0fd2bdea5aa5cc9d78dfb17841b5afc7dc commit f23f9c0fd2bdea5aa5cc9d78dfb17841b5afc7dc Author: Dimitry Andric AuthorDate: 2023-12-21 22:41:57 +0000 Commit: Dimitry Andric CommitDate: 2023-12-24 13:59:28 +0000 Silence VLA extension warnings in fusefs tests Building tests/sys/fs/fusefs with clang 18 results the following warning: tests/sys/fs/fusefs/cache.cc:145:14: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] 145 | uint8_t buf[bufsize]; | ^~~~~~~ Because we do not particularly care that this is a clang extension, suppress the warning. MFC after: 3 days (cherry picked from commit dc0b4094abf6784bf1a9492c2fea3fb91116b014) --- tests/sys/fs/fusefs/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/sys/fs/fusefs/Makefile b/tests/sys/fs/fusefs/Makefile index 6b0a6ef366b0..f45f2f93e1c0 100644 --- a/tests/sys/fs/fusefs/Makefile +++ b/tests/sys/fs/fusefs/Makefile @@ -83,6 +83,10 @@ CXXWARNFLAGS+= -Wno-class-memaccess CXXWARNFLAGS.gcc+= -Wno-unused-but-set-variable # Suppress warnings about deprecated implicit copy constructors in gtest. CXXWARNFLAGS+= -Wno-deprecated-copy +.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 180000 +# clang 18.0.0 introduces a new warning about variable length arrays in C++. +CXXWARNFLAGS+= -Wno-vla-cxx-extension +.endif CXXFLAGS+= -I${SRCTOP}/tests CXXFLAGS+= -I${FUSEFS} CXXFLAGS+= -I${MOUNT} From nobody Sun Dec 24 14:02:09 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SyjQT5mFSz54ff5; Sun, 24 Dec 2023 14:02: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SyjQT3fR3z4CVB; Sun, 24 Dec 2023 14:02:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703426529; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SlAHV8reQh9ugiroE0aZrfoiMDODEX4akb2KsA6oE18=; b=F+PXjbxMOuAPxH0Z+Ta3/Wq+TJyKFnU+jAH+m3uhefOlcoCFnrjjhQxvXI1+qxeW8JfEFm rWIb10FEEFwMzdwfeZFEkyi8HrxKSvyFUN+As+Xv/OTsTAk4L8uQQ4gCGRGDndDKDi9e7T tNtaAn/qX+FLLB7dmq+grg4y18rvbjNvV1PSV+M8e+8yOQ3BSTPDCzxiSip2aV6PtsKY1H fAeWSut64fwaeT4KaOM065EbanFISkgL7cRiUPuiP3m2SjnzPErPNrRnNUurM9zj41F/Pc RhN5gEwKYPe+NMCy2qdvIThKsNDkIbO0yxelc9Xz/AoZikkNY+JhSQzhg4YyVA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703426529; a=rsa-sha256; cv=none; b=pPdEDDZeTi5LuTwd8pawXM2UteZL0+ftD447hODKMe7vvYIfC/BtvVk+Tx7lExOHTKMLh/ jB1KlwDygo4MRopnBK/fmaL9pKXpM9DTtk44CD7xmH4eUFlcSIqdZpO3UoNMwXaxbsXvv6 G76nribT+xex1n2OkLtUuwjXglRWNuZTCEhHazdjdb+3fUqdjYEZhZuY+URqfqxpfU4MDU aUIV0aSgkpIHjSRtIt6DsA+QQ9nqZ3F92shqibImKOX3gSS0iLFLsrwJD5Yr/39HWVfAbw lwh9gn1U2ehfDBnVQVheqzpCtMWoKE+jRwln0VBQ1R7f/QSEFS9/7Gc+iVyG+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=1703426529; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SlAHV8reQh9ugiroE0aZrfoiMDODEX4akb2KsA6oE18=; b=FabMxNAYYhi7Xi+iptw+PA0+wNpHDGBzEawMU4ERj2IsamLQta9DIbLXiS01BMyXCCheMQ O3cCzWR8v5xRCpr+wI5rIVThiaLAcJ2J9cDB8rDiqNoQgva+HIYOqf4Bq8stiBgdChvCeh JODjGwMfAfJeaIK5/qn8lqm/DyU+RMZqKpS/rkzdy/0LV/Lkevk73IB3o9hr9zAIKslZJP EtYG/KAKGuxPBRdT4LaQpW2NmYRuB6W3hyV2rQc1waKJDy1XbadinFqUeyuB5iWFRysRXk xfl0PupQIStls4XxrWkWwohBQxeuNOaL5VyJwl6gXSfntItAT60GWgWRbRNQfg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SyjQT2bzxzWH9; Sun, 24 Dec 2023 14:02:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BOE29Wf056956; Sun, 24 Dec 2023 14:02:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BOE29sU056953; Sun, 24 Dec 2023 14:02:09 GMT (envelope-from git) Date: Sun, 24 Dec 2023 14:02:09 GMT Message-Id: <202312241402.3BOE29sU056953@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 6bbffa1a329f - stable/14 - Merge commit 989879f8fded from llvm git (by Paul Walker): List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 6bbffa1a329f61c602bdc0b75d43dae06a4cea59 Auto-Submitted: auto-generated The branch stable/14 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=6bbffa1a329f61c602bdc0b75d43dae06a4cea59 commit 6bbffa1a329f61c602bdc0b75d43dae06a4cea59 Author: Dimitry Andric AuthorDate: 2023-12-04 17:59:02 +0000 Commit: Dimitry Andric CommitDate: 2023-12-24 13:59:13 +0000 Merge commit 989879f8fded from llvm git (by Paul Walker): [Clang] Allow C++11 style initialisation of SVE types. Fixes https://github.com/llvm/llvm-project/issues/63223 Differential Revision: https://reviews.llvm.org/D153560 Requested by: andrew MFC after: 3 days (cherry picked from commit 641efdd10cc3ad05fb7eaeeae20b15c5ad4128c8) --- contrib/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/contrib/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp b/contrib/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp index a0dcb978b1ac..ba8b5ab502d2 100644 --- a/contrib/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp +++ b/contrib/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp @@ -1861,6 +1861,23 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) { return Visit(E->getInit(0)); } + if (isa(VType)) { + if (NumInitElements == 0) { + // C++11 value-initialization for the vector. + return EmitNullValue(E->getType()); + } + + if (NumInitElements == 1) { + Expr *InitVector = E->getInit(0); + + // Initialize from another scalable vector of the same type. + if (InitVector->getType() == E->getType()) + return Visit(InitVector); + } + + llvm_unreachable("Unexpected initialization of a scalable vector!"); + } + unsigned ResElts = cast(VType)->getNumElements(); // Loop over initializers collecting the Value for each, and remembering From nobody Sun Dec 24 14:02:12 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SyjQY098wz54fcJ; Sun, 24 Dec 2023 14:02: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SyjQX6KYhz4Cng; Sun, 24 Dec 2023 14:02:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703426532; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hfcDdtjc5vYndw9bO9rpG3lYwmeHDaOzHknxD9EPLx4=; b=p/XQwJ1TY1AH8A3g7dQU8Z4+BQeTc3Q0ogB/4hQ30a8hB0brR5PiTTCKsUhkrYXneBjXu4 qm6jMkBXdrtrhE/raAY1jj5rWmres6j0/7j5OehwceiZwmIErVjMZf2QwWJVCCuMaCFCKp Z0D45laE2bUN1Qnuh3D24YfTFTXPqyjefV8UTPuz/GZrrtibtMWChpapQCCyODfL0Afn2f Gc6eETNb8HD6IG9uJyUCZCICxhaS7WCdWf7W23NuCFdzdoqpTqvCppuLi984jqdsTj6mRL 0SRcNJyvMI4UISh6kZ4ucrX5CjHwu7P8eatAlVOpzZQszDAy3KPe5w54Eu5m4A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703426532; a=rsa-sha256; cv=none; b=HuNzzvluy4jBgCaOjKugxkCkraPKt1it30gUrF9DHcZahJDsREKtZiztHyhqCZulFfgQHA aQD2ysxA9eA0zmatUtqCJNzyFJkH/hPJghIsNuCamj1rilw/TU9YIJa6BGQjshgov04hdw EKBmT/XqlCOkj8vJOqjk8Ifvw7myZOfsaP6Rx4QFNgTFzRlWf+kd6LzpQdzgt/6x4kUGXf Y4iUpfJTqZgWg1UKHOSdHBtdB7cJeg+AX+U2G5Ib4kKcGueRc7mPohOnjWBt5GH5puUjzF FbO9rJJUJ0w4qs/VFI6/X1hP0g0XUipvBrDohzjxsMRo/ltRuxBvav1dWZ55aQ== 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=1703426532; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hfcDdtjc5vYndw9bO9rpG3lYwmeHDaOzHknxD9EPLx4=; b=UxkZbz5MnZ9OSo8++LuSbrnc47S1jRex82IRw7KVGL/nq1rKTNCyeREOQD1j3GFkV6Dnsu ONEILnT8sTcpr4ZYo92I1me+v/U1kCSjxrhilJvUZsxsew8zcfkTPINiV7//7o5mOxjC7t usm3Ak0g8H24d1r7NelfLH18m69OZfi8NDO2p9HaKuJBu1eWxIFZEYNy5pWnCXxrqFeGb8 //IyHeIVQLxTbXpSix8mbM3Wl60aoDfNIZdNaFqlfJpa6rg28kHX0XWR4MVDYly5B+vhQ9 XEiw9oIKDOZNStk6Oxfgb5pMly3Nd4v2fionWgHPtoMEo6SnMD3BiHiTxZxvMw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SyjQX5R8hzWwL; Sun, 24 Dec 2023 14:02:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BOE2CVs057100; Sun, 24 Dec 2023 14:02:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BOE2CgY057097; Sun, 24 Dec 2023 14:02:12 GMT (envelope-from git) Date: Sun, 24 Dec 2023 14:02:12 GMT Message-Id: <202312241402.3BOE2CgY057097@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 60d9bb14e84d - stable/14 - Fix snprintf truncation in telnet List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 60d9bb14e84d6462fd04260dcd660a8e585a62c7 Auto-Submitted: auto-generated The branch stable/14 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=60d9bb14e84d6462fd04260dcd660a8e585a62c7 commit 60d9bb14e84d6462fd04260dcd660a8e585a62c7 Author: Dimitry Andric AuthorDate: 2023-12-21 22:35:17 +0000 Commit: Dimitry Andric CommitDate: 2023-12-24 13:59:34 +0000 Fix snprintf truncation in telnet Building telnet with clang 18 results in the following warning: contrib/telnet/telnet/telnet.c:231:5: error: 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 11 [-Werror,-Wformat-truncation] 231 | snprintf(temp2, sizeof(temp2), "%c%c%c%c....%c%c", IAC, SB, TELOPT_COMPORT, | ^ The temp2 buffer is 10 chars, while the format string also consists of 10 chars. Therefore, snprintf(3) will truncate the last character, 'SE' (end sub negotation) in this case. Bump the buffer to 11 chars to avoid truncation. MFC after: 3 days (cherry picked from commit c794d188222a4d3414233ff9630d47eedc090fbe) --- contrib/telnet/telnet/telnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/telnet/telnet/telnet.c b/contrib/telnet/telnet/telnet.c index a35ea40c4cd8..c936a85c9a23 100644 --- a/contrib/telnet/telnet/telnet.c +++ b/contrib/telnet/telnet/telnet.c @@ -206,7 +206,7 @@ unsigned char ComPortBaudRate[256]; void DoBaudRate(char *arg) { - char *temp, temp2[10]; + char *temp, temp2[11]; int i; uint32_t baudrate; From nobody Sun Dec 24 14:02:39 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SyjR32d1wz54fDb; Sun, 24 Dec 2023 14:02: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SyjR31gH2z4F9T; Sun, 24 Dec 2023 14:02:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703426559; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fpxMb/mVGmQXj/WlAQBu59vIG42ePzexhcHW38a5/go=; b=LdhPRHwPBTBpFiVFyZLEbFIJLjKeNthWfPZ4xQqIjOAbFIsUloGJzLNceKIUc1HOUmRaNa 1EsYl+XRroMeVf2Ibpm950nxhbAErYilz/sAAv/BuF/muaVLlmnViUa3xjd80hO6hiMNKP 4V0hWx0sifg19ceIR8YW1FU2gOSzBYBxYdUOX2H8JchE3/Hm1lq/66OPjqj6AUA4jFaHnk H14tCM/skTHjsN+kvNVGyfEl285qSC9hPCzyyIFBfF8WOnffOtOeP4NES0p5M3JvYEmKKk YL48DHwqPDrosEXsUMcPOCF52edPcw7IvREHEqnm9iYvicONp4f+lpzNY1Yn3Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703426559; a=rsa-sha256; cv=none; b=YOo/OEPjHT6dVgRML1hfbB2nIWkcOTIpHtuc9yhn6Kpc/pZgQFkXghVOjVmV8fHjCTqXwX SEB9auj1tH5nwZ3BXUE4ttqW4Q3OUdYWgX+fWTX7uGvmUOhCtOyYf+tDHTvVW+LCQtTW8M cKL1lYNjmz3yeOV2R89TJbWjO0qJu/LfGfJnoNxDgy4XDI1pZP3Qe7B9N6249tOpo9YReu purIOHgFmTNA3bP3CsG2o8EEqKvWidQr1ES135k+SksShkgIkNxfk43qd0z37Pv7lSzo4u CZ4khv4M5Q0YxkevB2qf4cv1LrrIoSniJ+G+6+wU5dbahHUx6hhIk5nhxULClg== 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=1703426559; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fpxMb/mVGmQXj/WlAQBu59vIG42ePzexhcHW38a5/go=; b=tmuDN5/ayQxK5kiO6YXH8bZBrvhhA9GKOIUUNf/GDbGpBUk4ea7HmzZE5QMjv+zb9gtP/z 93UqqCLTV476TuxIK1vK1JfWmFfnh7RtgVSf13XWseO8pQAljncowvo/lOYPFG5o1Aurx4 lXZAyH1PnVZcPoY0RJWXCAcNFefWet64Zr3tEzfugHWKxpJ/aKv2zI9dDRVAA3R5ItZEyD 55+wg9EtIoCdzgdcsNJvItheCIKeesQy8CRy5tDMiIvfKMJkYyVGHOqOtXPnD9TIzc+p7Y zlcoqWcwOhfDv180bE87DUJyp5xb3eKuP+DrOnjrDQfCKbbEp8XtA2q39EVriQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SyjR30kPDzWwR; Sun, 24 Dec 2023 14:02:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BOE2dYX057320; Sun, 24 Dec 2023 14:02:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BOE2dCk057317; Sun, 24 Dec 2023 14:02:39 GMT (envelope-from git) Date: Sun, 24 Dec 2023 14:02:39 GMT Message-Id: <202312241402.3BOE2dCk057317@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 0bb380693227 - stable/13 - Merge commit 989879f8fded from llvm git (by Paul Walker): List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0bb380693227a5f87235bfe07c16ce1eb8b65a84 Auto-Submitted: auto-generated The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=0bb380693227a5f87235bfe07c16ce1eb8b65a84 commit 0bb380693227a5f87235bfe07c16ce1eb8b65a84 Author: Dimitry Andric AuthorDate: 2023-12-04 17:59:02 +0000 Commit: Dimitry Andric CommitDate: 2023-12-24 13:59:50 +0000 Merge commit 989879f8fded from llvm git (by Paul Walker): [Clang] Allow C++11 style initialisation of SVE types. Fixes https://github.com/llvm/llvm-project/issues/63223 Differential Revision: https://reviews.llvm.org/D153560 Requested by: andrew MFC after: 3 days (cherry picked from commit 641efdd10cc3ad05fb7eaeeae20b15c5ad4128c8) --- contrib/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/contrib/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp b/contrib/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp index a0dcb978b1ac..ba8b5ab502d2 100644 --- a/contrib/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp +++ b/contrib/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp @@ -1861,6 +1861,23 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) { return Visit(E->getInit(0)); } + if (isa(VType)) { + if (NumInitElements == 0) { + // C++11 value-initialization for the vector. + return EmitNullValue(E->getType()); + } + + if (NumInitElements == 1) { + Expr *InitVector = E->getInit(0); + + // Initialize from another scalable vector of the same type. + if (InitVector->getType() == E->getType()) + return Visit(InitVector); + } + + llvm_unreachable("Unexpected initialization of a scalable vector!"); + } + unsigned ResElts = cast(VType)->getNumElements(); // Loop over initializers collecting the Value for each, and remembering From nobody Sun Dec 24 14:02:40 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SyjR43SdPz54fxT; Sun, 24 Dec 2023 14:02: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SyjR42xF2z4F9h; Sun, 24 Dec 2023 14:02:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703426560; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7OGHkjLdmfdixVKHVOru9upFiYIfyNFazCAVf3wRLFU=; b=HBaP52f8i4eYzohvaJG5wchN6NOaFxTBBmbZ7foe2vL9mkZJxTu4wQazmpKUl1gdWTd53u 768e35Q6aaE5s9sJpdV4yGb/0X+ZC8F1Qh835f9TVZLo7k5qNsFk1AzkfztmJR65tvD8Z4 ZcjIii5aLAYdh8ZMrOUnFsDrLLSCVJPGzrLP9St66OtqBggiaa6ielfW2BiORNh45SIloa XnYK/NRWHE/e0gISW0tLer+HFA7bNpIe4icBRUlNlEzJJe5oT9tTGse433Kr1+5LKsSbzU pW2znDMvI9XakpU94v+BXEyzEXkkVyJOl+kv9uTub5R3Sg8aElXO9IYvOJFYmA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703426560; a=rsa-sha256; cv=none; b=DMMfDde/2Ox25xzDX4VCVMd/FuMEcKGv+3pxydZpkybVzuAYKVPC3TXtPbzjRxjHKIOKrl Z7Fpss2tNVzR7rQv5aSVSuM1TNRedVSJDv7c0PVRvEjlTrDKhRMtXK0uxTsjXbVnXyQYOk tFkNhHQrFgasLaX/0y31EoiHb0MFpLsS/CHLR5nYg3k6Ei2KtnPsmCSLUc5kI++ahP2Pum wWELCe41/SkObZDd103WVDbvPelG27SvoSO9jUSSKUzmcrh2TYTuzIAqqW0AY88XYZfrp+ TLHJdPJBOENouqVAfkGWYw6MfQ9ftUoUFWtiI3lZhUDNPOPVsom5KEvTxqWH1A== 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=1703426560; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7OGHkjLdmfdixVKHVOru9upFiYIfyNFazCAVf3wRLFU=; b=FnfdqFo+QkgJIWBckB7smN4BbLRdyvDaSzZ+BUIeREoidIU6cR3Jyk7Nz8aAkHkNfpjUKP UbRgdcBPnKPM0BjJW94PfC0SQYqneMc38mlnNfxlORezLCbuJhDL1P9Tvf2DH5FJarIhG5 tUF4DRDG62mFowcJJoZweLxHuyY9Ct1od0KejJYWFoFseVhbJzzRXesRIPV5/znxbKoxNy MAp5jJKAcCFHDXplBtuODi33WnWA1rtbtMH0fkgc+k98bu4pNQMnCapZvgaHWoYz+EAaW2 6joTwy6zOrzuxQW6zZTBOwUAiS8WC6o2Y03Ewg9i1wpzY13REAYLr8eHdrNOQA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SyjR41lnfzWwg; Sun, 24 Dec 2023 14:02:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BOE2eMO057370; Sun, 24 Dec 2023 14:02:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BOE2eBm057367; Sun, 24 Dec 2023 14:02:40 GMT (envelope-from git) Date: Sun, 24 Dec 2023 14:02:40 GMT Message-Id: <202312241402.3BOE2eBm057367@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 0907c0ddbaf2 - stable/13 - Silence snprintf truncation warnings in printf_test examples List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0907c0ddbaf22cc6d5d0e6692885f911e3b4e85f Auto-Submitted: auto-generated The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=0907c0ddbaf22cc6d5d0e6692885f911e3b4e85f commit 0907c0ddbaf22cc6d5d0e6692885f911e3b4e85f Author: Dimitry Andric AuthorDate: 2023-12-21 22:39:15 +0000 Commit: Dimitry Andric CommitDate: 2023-12-24 14:01:19 +0000 Silence snprintf truncation warnings in printf_test examples Building share/examples/tests with clang 18 results in a few warnings like: share/examples/tests/tests/plain/printf_test.c:67:6: error: 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 17 [-Werror,-Wformat-truncation] 67 | if (snprintf(buffer, sizeof(buffer), "0123456789abcdef") != 16) | ^ Since these tests are meant as an example of testing snprintf overflow, suppress the warnings. MFC after: 3 days (cherry picked from commit 69c8025a498450b6bc4cc9e97ba779ed1c2e7f4b) --- share/examples/tests/tests/atf/Makefile | 4 ++++ share/examples/tests/tests/plain/Makefile | 4 ++++ share/examples/tests/tests/tap/Makefile | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/share/examples/tests/tests/atf/Makefile b/share/examples/tests/tests/atf/Makefile index 305d66c51f38..7614767b6e0a 100644 --- a/share/examples/tests/tests/atf/Makefile +++ b/share/examples/tests/tests/atf/Makefile @@ -46,3 +46,7 @@ file1: @echo "File 1" > ${.TARGET} .include + +.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 180000 +CWARNFLAGS.printf_test.c+= -Wno-format-truncation +.endif diff --git a/share/examples/tests/tests/plain/Makefile b/share/examples/tests/tests/plain/Makefile index 2594968a6f44..462324309f6a 100644 --- a/share/examples/tests/tests/plain/Makefile +++ b/share/examples/tests/tests/plain/Makefile @@ -46,3 +46,7 @@ file1: @echo "File 1" > ${.TARGET} .include + +.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 180000 +CWARNFLAGS.printf_test.c+= -Wno-format-truncation +.endif diff --git a/share/examples/tests/tests/tap/Makefile b/share/examples/tests/tests/tap/Makefile index 5b829afd5838..86d3f6805045 100644 --- a/share/examples/tests/tests/tap/Makefile +++ b/share/examples/tests/tests/tap/Makefile @@ -46,3 +46,7 @@ file1: @echo "File 1" > ${.TARGET} .include + +.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 180000 +CWARNFLAGS.printf_test.c+= -Wno-format-truncation +.endif From nobody Sun Dec 24 14:02:41 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SyjR549P2z54g2L; Sun, 24 Dec 2023 14:02: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SyjR53R0hz4F3f; Sun, 24 Dec 2023 14:02:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703426561; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=icHDkuPeavizqPsCO1Qz9aqkaJ4MUgTGHpCHyhOZJa4=; b=QgOkJH0ZFfdxU2CWbnvFyUr+YMb3KSflZ3Gqb6RONq+6/OgnucejjKIXCSzYekZSYVKe3R ChRQJQ7dXHSK82rLaipH66xG231xMve5vBOjJb1LxuFC1sy6nUGkmulbQJuERGlkt6kdHK R4pWoOLRxWNNhhcJa1l7KYi/0+tnLeOgPv0dIGXFk/GEmw0j16KeyTaxviiY+s5kKWfNko +zv8eNk3wn+0UGpkLcZ19eQa6gB1rYIw9AOC5QJBMlHXYGMTLgX2cHdBOHzMizDIKI9tTo VVzydmRFj16Bjijmaj89/XPb3kOLd3+o5IjQn4zCMdReCEfLjMkdkPYKDjykdw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703426561; a=rsa-sha256; cv=none; b=DvqT1DA7GWhTkvT8hHMJhhJ39P4G6SfxkTKRju8Moz0jneuEWlVpUVDCT38zbvTUWCbbAl tn+6Vux0uJQ3OXcp0+1X/JaUsQ/ygoJmKJqBTsnXBM0mfrTkFtrt0uhBFb3o/Ro76+eroY gQEH3rQuioyvaSBkBRMzLXECwSHBxlXd38QrjzjBnh4zbU762OKdCkx7q6pNf4k+S2rBro xToe7TUvo03r/c2BpCgrnIzlesOxs4y6dtWDh2Kir71aQVdxtn06Zh7s5jQf2uk+oBhEXK +rhq4WXJY2QZ/yCvlAYB418becKp23nLueqVslviVjUxOdXLYVKTA99PMojW0g== 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=1703426561; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=icHDkuPeavizqPsCO1Qz9aqkaJ4MUgTGHpCHyhOZJa4=; b=BqkmztnbXgIBJWGYeNg4S8xX3PCrF4BswUujyFps6wMGKGBVUKD8UUBIXKMNXPCR7d87EW zjovILueJNVGTOHt+b/ZOEtbGKihA04RheBx+tBUykLK/rKcc82t0FXiJRhPIX4SnXlqiC FIVPXfCrnvrJbDzMlAOSlXN3aH+QmBdDjn3qKreXbn8gMlNDCIFlGzBFoUg7g5z1xwyEhZ 4ogVisAexPnAwTiDgQxFJcDMdDpWgmI4RkTlQvWkrlICHV1T36CxpAoLLBWw7g861Wenei jEeoVrFmqwBTR4Hglwzn73J7NHoNL+HG1+Hzg93ao7s1N9edOvfoZToNHT0xsA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SyjR52XlpzWj0; Sun, 24 Dec 2023 14:02:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BOE2fnS057421; Sun, 24 Dec 2023 14:02:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BOE2f0P057418; Sun, 24 Dec 2023 14:02:41 GMT (envelope-from git) Date: Sun, 24 Dec 2023 14:02:41 GMT Message-Id: <202312241402.3BOE2f0P057418@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 4d9951cbb68b - stable/13 - Silence VLA extension warnings in fusefs tests List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4d9951cbb68b76d385264e222e5cf74a993b127e Auto-Submitted: auto-generated The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=4d9951cbb68b76d385264e222e5cf74a993b127e commit 4d9951cbb68b76d385264e222e5cf74a993b127e Author: Dimitry Andric AuthorDate: 2023-12-21 22:41:57 +0000 Commit: Dimitry Andric CommitDate: 2023-12-24 14:01:24 +0000 Silence VLA extension warnings in fusefs tests Building tests/sys/fs/fusefs with clang 18 results the following warning: tests/sys/fs/fusefs/cache.cc:145:14: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] 145 | uint8_t buf[bufsize]; | ^~~~~~~ Because we do not particularly care that this is a clang extension, suppress the warning. MFC after: 3 days (cherry picked from commit dc0b4094abf6784bf1a9492c2fea3fb91116b014) --- tests/sys/fs/fusefs/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/sys/fs/fusefs/Makefile b/tests/sys/fs/fusefs/Makefile index f62b88fe9271..8e6fdd10c377 100644 --- a/tests/sys/fs/fusefs/Makefile +++ b/tests/sys/fs/fusefs/Makefile @@ -81,6 +81,10 @@ CXXWARNFLAGS+= -Wno-class-memaccess .endif # Supress warnings about deprecated implicit copy constructors in gtest. CXXWARNFLAGS+= -Wno-deprecated-copy +.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 180000 +# clang 18.0.0 introduces a new warning about variable length arrays in C++. +CXXWARNFLAGS+= -Wno-vla-cxx-extension +.endif CXXFLAGS+= -I${SRCTOP}/tests CXXFLAGS+= -I${FUSEFS} CXXFLAGS+= -I${MOUNT} From nobody Sun Dec 24 14:02:42 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SyjR64wrsz54fhj; Sun, 24 Dec 2023 14:02: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SyjR64LCvz4FB5; Sun, 24 Dec 2023 14:02:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703426562; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lJbR3dc8QzSxFDL8G3x+qdnVB10wM74s6jsxxshmBTI=; b=PU0M8oIdKMc6xgFICYpdnO9zhL5kKjgCdoSxJ1nfw7eyTQ7oHyKSMtrr+rgnU/PMsnLQOw WlOolxRfaYzSyFP4Zmvhaf11I/xF5sPwG+Wq8zxuWbF64iqXdCkgQLR7KSZoKbmgQHSxV/ GjnnRcmqAs1ViWYVQNCNUDS8DiCBjoupM6c3OxlpWRJUrIuEvAvOlOIKAvdVClasZbv8CT /8rWfvAxA4vvYXV2/lShH246nmXx50y6PxChyMqt+HFNyDSl8XDa8tu31zXVCpGhQRpTpw CPTZ+f8g/jpfhSLc11jVEVQFU+Q3NWv4r1yVTcH9RQEHRf53NlyMSZd7sZygDA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703426562; a=rsa-sha256; cv=none; b=cKtb70urRh9kCqSVNTOYd9epJ3l+AC3y8+FRRbZ0fgmHO3qrPDsxWBZOcM8wdvdoq9uFsk fYCdcoaJFqEQUg7RMavgrUB7zuEPemmN25e8alJ3npeKqoXxAMVmjJKKfb5xMsdJ7yg3G7 CtUSWEDA/fVvjJ6emdpSedly9DewI6F6cbMyoYJXzXHIk2byfmjim+2SKmbbXvG4M28rcv +YuDxGyTLwm21OgOrCb7jHZiMqKFRkqNHq1tsFqVi7Zc2A+WN6J4E98an4kNQp/fn9f648 wqHbbPPf22egO+DNexOXPv6yxOQ+y6jJCplTnWb+e7+RnerN6O4Fqg0zguXkXQ== 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=1703426562; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lJbR3dc8QzSxFDL8G3x+qdnVB10wM74s6jsxxshmBTI=; b=wbCIxmPYbWNw69qXLRiJ+laWPdn8AsCj3q7nSCnRx1PLFLJbS8qlWZMN3JOHokbw+OfqsC OnfyX0sg1ySfPAb6+6H3EjgS6PsBFMPy8c6m3bOWCqnpGCPL5pzIaxQAZGFjGMgwc2IQ0b x8PufvDgS6LjfnqhTZ8hwkCdxnSBxd+77ADyOIJni3s6xM5xi6Fk4eR8s+1JAD7ixwJRSk ATOI+XX8Mw9NWnRXgNpoOHmHl7QN5SYO24yK1rRAjmXYUei5JdqfK7PlNf8yaXqEjC6qfm 2tS81yQUPk7Gtz9MhxCpK9W0GOIEkeFIzpSrdvxy1BVXjVaT7ZPuoqo1AiuI1g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SyjR63RwXzWSV; Sun, 24 Dec 2023 14:02:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BOE2gBt057463; Sun, 24 Dec 2023 14:02:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BOE2gKm057460; Sun, 24 Dec 2023 14:02:42 GMT (envelope-from git) Date: Sun, 24 Dec 2023 14:02:42 GMT Message-Id: <202312241402.3BOE2gKm057460@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 4f3aa626f614 - stable/13 - Fix snprintf truncation in telnet List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4f3aa626f614a5ea5cfdfff4f77caa9ec10980bb Auto-Submitted: auto-generated The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=4f3aa626f614a5ea5cfdfff4f77caa9ec10980bb commit 4f3aa626f614a5ea5cfdfff4f77caa9ec10980bb Author: Dimitry Andric AuthorDate: 2023-12-21 22:35:17 +0000 Commit: Dimitry Andric CommitDate: 2023-12-24 14:01:29 +0000 Fix snprintf truncation in telnet Building telnet with clang 18 results in the following warning: contrib/telnet/telnet/telnet.c:231:5: error: 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 11 [-Werror,-Wformat-truncation] 231 | snprintf(temp2, sizeof(temp2), "%c%c%c%c....%c%c", IAC, SB, TELOPT_COMPORT, | ^ The temp2 buffer is 10 chars, while the format string also consists of 10 chars. Therefore, snprintf(3) will truncate the last character, 'SE' (end sub negotation) in this case. Bump the buffer to 11 chars to avoid truncation. MFC after: 3 days (cherry picked from commit c794d188222a4d3414233ff9630d47eedc090fbe) --- contrib/telnet/telnet/telnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/telnet/telnet/telnet.c b/contrib/telnet/telnet/telnet.c index b6b2432ef3ec..a98dad499c7b 100644 --- a/contrib/telnet/telnet/telnet.c +++ b/contrib/telnet/telnet/telnet.c @@ -208,7 +208,7 @@ unsigned char ComPortBaudRate[256]; void DoBaudRate(char *arg) { - char *temp, temp2[10]; + char *temp, temp2[11]; int i; uint32_t baudrate; From nobody Sun Dec 24 14:03:53 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SyjSV07tbz54g7B; Sun, 24 Dec 2023 14:03:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SyjST6XRnz4G2Q; Sun, 24 Dec 2023 14:03:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703426633; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xFWB5nl8GvzUcpFwhLT4W1P0QwVLtvx71TlPWUxay/4=; b=tz6qJXuNPuupNXYs7X8Oimht7pp3j1PANbdWwuGDX/ut6kUy/kW+BZ9wmqZwfFhiRccEGK PQ8oZ3g2EhquIX0s+MNZ/l94jrn33/el95DqGllbzTAb5xtQJR0plwo9Rhqd8QTOBv9eco SNLVuNdmQahAm5uMTUXPKIdYI2ZLuSk/xGRB75qBx+D/ruYCDAuaKyawg5lMzaogEJGpSA XCtPnKrLqKU0cfAIrbzTWDGXswdu9vLQUZT8RqbKDy0h9535VZ2sUn8m98A7gfiT+j02+2 6ntkesLx4n1hxCDzc7qyFNSXL4PdE71zXGbqHSTzIPllyegUKAhKaMaQfA16CA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703426633; a=rsa-sha256; cv=none; b=MFvfuQ/t7GtuAABHYCX4McHAMGtvkJ7Gm0fzjF04BD6yXDvzxdvk3gxDZkyKRkF+Y+sm7p 7T3uKJeNjk5ps9iXMcTfUxv/ijmBDpZYuhAuORRbfQjvkrETHdLun9tB5uTpxntBBllWYM proeg00RegaUCXqUU7duD4N9jWiNJo0JcIL9Z0IF9NSQuXr73txOlTgA9rpVWpqqTrMU23 jLlIERXBtfqhdrACBNp4Y5RbvRIojLo0P+vgukyZVbM4NN3A1PrvVePSPgBgsg60zFxQzk 6Qy8xF34cJClgnuvue9lmBHjGo9G95AWuI6PKRZXTaegyPncjGSJNeqoK6gCjw== 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=1703426633; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xFWB5nl8GvzUcpFwhLT4W1P0QwVLtvx71TlPWUxay/4=; b=haqc9L7UJexKJQ2TaYt2Un271GNOhO6Phz1v4JVvGUutzQR/up5tCJUhRwlbJXBM5h0X65 zm6hBPeXmeD7zSeuaHXtQtvTrvGYnbwy1t+w3qaFy8lMhoB4cDxz2WvCN/Fa8AXcyWRLcI z5E2hROkpHu4D1qWRU3Hj02SEchpVEBMLRbcqQR5bjQVFx7SUQZZe5Y3QnqhCamZ+DVSIk w3dPiNdv0/yVcBfyOwgIB/7MOT2IuQNYvNwc3s+FcAofN8+JOcmV5Z4Z+XDZfygUbUJNIU hU3kJQrkqNVYq+/jVjmn5/UrQkJcZ3lGmR5oM6g5Y3H/c+mEo5McY3ghHw3cWg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SyjST5bC0zWSY; Sun, 24 Dec 2023 14:03:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BOE3rEY057751; Sun, 24 Dec 2023 14:03:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BOE3rZP057748; Sun, 24 Dec 2023 14:03:53 GMT (envelope-from git) Date: Sun, 24 Dec 2023 14:03:53 GMT Message-Id: <202312241403.3BOE3rZP057748@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 9734bad3611c - stable/12 - Fix snprintf truncation in telnet List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 9734bad3611c291798727ae9020f876304d4e849 Auto-Submitted: auto-generated The branch stable/12 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=9734bad3611c291798727ae9020f876304d4e849 commit 9734bad3611c291798727ae9020f876304d4e849 Author: Dimitry Andric AuthorDate: 2023-12-21 22:35:17 +0000 Commit: Dimitry Andric CommitDate: 2023-12-24 14:01:35 +0000 Fix snprintf truncation in telnet Building telnet with clang 18 results in the following warning: contrib/telnet/telnet/telnet.c:231:5: error: 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 11 [-Werror,-Wformat-truncation] 231 | snprintf(temp2, sizeof(temp2), "%c%c%c%c....%c%c", IAC, SB, TELOPT_COMPORT, | ^ The temp2 buffer is 10 chars, while the format string also consists of 10 chars. Therefore, snprintf(3) will truncate the last character, 'SE' (end sub negotation) in this case. Bump the buffer to 11 chars to avoid truncation. MFC after: 3 days (cherry picked from commit c794d188222a4d3414233ff9630d47eedc090fbe) --- contrib/telnet/telnet/telnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/telnet/telnet/telnet.c b/contrib/telnet/telnet/telnet.c index b6b2432ef3ec..a98dad499c7b 100644 --- a/contrib/telnet/telnet/telnet.c +++ b/contrib/telnet/telnet/telnet.c @@ -208,7 +208,7 @@ unsigned char ComPortBaudRate[256]; void DoBaudRate(char *arg) { - char *temp, temp2[10]; + char *temp, temp2[11]; int i; uint32_t baudrate; From nobody Sun Dec 24 23:03:57 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SyxRd5qtxz54lFb; Sun, 24 Dec 2023 23:03:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SyxRd55G8z3bdD; Sun, 24 Dec 2023 23:03:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703459037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vkBdJZgvjC0rustbCeTxHl0o5CcUYqtK8OQtwKlBEHc=; b=MDrygiVBGXKYbfobpMXBgbkp2rgmbvq7WFJo/EMsp4olgZZ0nOhw8DJaxkVv2Qvl3Pr6Wg 0FsbsqeORlJ3KnASLc4jzU0OcFnKbKHt0ZPewZjePWjJPiIyDNWuIuRhaSIl1S2fBSDRpI 4P+vUy0DZMvi1nmuXrRGgSGExfSXyCp+SKaONtLUXE1QgWOQzaKy5nEFR7ic7KrHINjIhS oHONXq+wX4VEJTWy/dDMQjB0ak++90g09GfNh+WBkQol3Fl25Tr9W8J3FCGfVQmPJ5rfhz wihmpfob2hJyQyM4qK7fAgvf96e93o/faM37X7T/1Y8Sate/ywGAvuewNKDTRQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703459037; a=rsa-sha256; cv=none; b=cIpRtTo7gNIvKNpATZ1XIOHGkG+mFSNHPtgIb+AP2t/zS4Ybu7b9sON5tLgwrWEC32lxCH x9zop7roGWHiaG3MUK27GGfa2VjX+1DtEIofKQlrB3A2HlC4tYaxP/6TvMjsReDseTy/7+ IukgGWX62LkilPwdHjB/qQ7YnubHr+4ZOancX6YRqUzyUwIqNKHg95Cz1HUQ+wG8bcWtbL XUo12WR4gAV2XMqzdcEOrOHM/xmjL817+FBbdwUmPY+ZMzB+zitkDaviMH6thbrA0oNZa0 siZsz5yg6JDtMHsLlieVUJ+pndefyH1ZcMA7t256rZWF5BE9qidGbtVa7k2t4A== 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=1703459037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vkBdJZgvjC0rustbCeTxHl0o5CcUYqtK8OQtwKlBEHc=; b=yBXtWsoG9AmDuH1Ypkd1cU5t1VHRue+hYlE8ezmBavY7hfUNpUbWExVAUEeupbrkOah9T3 96sKhgCdIYxobvQaECEbw3jVHzl/On5PLdtsjjNPxBoIV9+7Azff8OirLFJuzuwNIwTPAg wSSnM/rSk7aJInotMcpI3zt+6jlPgz6xS/ZTf66tXOw2uaivP4LXSI7q8VbeapwzteS+LA W9nu3i1FDliM6dL9uKSeZevDuk+aQiDTCMBFzjjI5+3Ezgdof9NhguSD/GDKjRf8EnCJVo UnNDORjt80y2o4UyAXCuKapn1BzeqTZt/K2P8H16QdePPimWTx/lNVbBv1rQiA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SyxRd47r5zmhr; Sun, 24 Dec 2023 23:03:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BON3vFf061493; Sun, 24 Dec 2023 23:03:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BON3vu5061490; Sun, 24 Dec 2023 23:03:57 GMT (envelope-from git) Date: Sun, 24 Dec 2023 23:03:57 GMT Message-Id: <202312242303.3BON3vu5061490@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: b8e137d8d32d - stable/14 - krpc: Display stats of TLS usage List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b8e137d8d32df3cc30610bd972055714c04da630 Auto-Submitted: auto-generated The branch stable/14 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=b8e137d8d32df3cc30610bd972055714c04da630 commit b8e137d8d32df3cc30610bd972055714c04da630 Author: Rick Macklem AuthorDate: 2023-11-02 21:07:01 +0000 Commit: Rick Macklem CommitDate: 2023-12-24 23:02:15 +0000 krpc: Display stats of TLS usage This patch adds some sysctls: kern.rpc.unenc.tx_msgcnt kern.rpc.unenc.tx_msgbytes kern.rpc.unenc.rx_msgcnt kern.rpc.unenc.rx_msgbytes kern.rpc.tls.tx_msgcnt kern.rpc.tls.tx_msgbytes kern.rpc.tls.rx_msgcnt kern.rpc.tls.rx_msgbytes kern.rpc.tls.handshake_success kern.rpc.tls.handshake_failed kern.rpc.tls.alerts which allow a NFS server sysadmin to determine how much NFS-over-TLS is being used. A large number of failed handshakes might also indicate an NFS confirguration problem. This patch moves the definition of "kern.rpc" from the kgssapi module to the krpc module. As such, both modules need to be rebuilt from sources. Since __FreeBSD_version was bumped yesterday, I will not bump it again. (cherry picked from commit 1a878807006cc10a5698cbca9e24a38b3412d7ed) --- sys/rpc/rpcsec_gss/svc_rpcsec_gss.c | 3 +- sys/rpc/rpcsec_tls.h | 4 ++ sys/rpc/rpcsec_tls/rpctls_impl.c | 21 ++++++++-- sys/rpc/svc_vc.c | 81 +++++++++++++++++++++++++++++++++++++ 4 files changed, 104 insertions(+), 5 deletions(-) diff --git a/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c b/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c index 90aa9e0d7d4f..89526544639a 100644 --- a/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c +++ b/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c @@ -174,8 +174,7 @@ struct svc_rpc_gss_cookedcred { u_int svc_rpc_gss_client_max = CLIENT_MAX; u_int svc_rpc_gss_client_hash_size = CLIENT_HASH_SIZE; -SYSCTL_NODE(_kern, OID_AUTO, rpc, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, - "RPC"); +SYSCTL_DECL(_kern_rpc); SYSCTL_NODE(_kern_rpc, OID_AUTO, gss, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "GSS"); diff --git a/sys/rpc/rpcsec_tls.h b/sys/rpc/rpcsec_tls.h index 1445c5c35f19..e3eed64863a1 100644 --- a/sys/rpc/rpcsec_tls.h +++ b/sys/rpc/rpcsec_tls.h @@ -86,10 +86,14 @@ bool rpctls_getinfo(u_int *maxlen, bool rpctlscd_run, /* Macros for VIMAGE. */ /* Just define the KRPC_VNETxxx() macros as VNETxxx() macros. */ +#define KRPC_VNET_NAME(n) VNET_NAME(n) +#define KRPC_VNET_DECLARE(t, n) VNET_DECLARE(t, n) #define KRPC_VNET_DEFINE(t, n) VNET_DEFINE(t, n) #define KRPC_VNET_DEFINE_STATIC(t, n) VNET_DEFINE_STATIC(t, n) #define KRPC_VNET(n) VNET(n) +#define CTLFLAG_KRPC_VNET CTLFLAG_VNET + #define KRPC_CURVNET_SET(n) CURVNET_SET(n) #define KRPC_CURVNET_SET_QUIET(n) CURVNET_SET_QUIET(n) #define KRPC_CURVNET_RESTORE() CURVNET_RESTORE() diff --git a/sys/rpc/rpcsec_tls/rpctls_impl.c b/sys/rpc/rpcsec_tls/rpctls_impl.c index c0e269e55932..64111eed62c0 100644 --- a/sys/rpc/rpcsec_tls/rpctls_impl.c +++ b/sys/rpc/rpcsec_tls/rpctls_impl.c @@ -78,6 +78,9 @@ static CLIENT *rpctls_connect_cl = NULL; static struct mtx rpctls_server_lock; static struct opaque_auth rpctls_null_verf; +KRPC_VNET_DECLARE(uint64_t, svc_vc_tls_handshake_success); +KRPC_VNET_DECLARE(uint64_t, svc_vc_tls_handshake_failed); + KRPC_VNET_DEFINE_STATIC(CLIENT **, rpctls_server_handle); KRPC_VNET_DEFINE_STATIC(struct socket *, rpctls_server_so) = NULL; KRPC_VNET_DEFINE_STATIC(SVCXPRT *, rpctls_server_xprt) = NULL; @@ -748,25 +751,33 @@ _svcauth_rpcsec_tls(struct svc_req *rqst, struct rpc_msg *msg) u_int maxlen; #endif + KRPC_CURVNET_SET_QUIET(KRPC_TD_TO_VNET(curthread)); + KRPC_VNET(svc_vc_tls_handshake_failed)++; /* Initialize reply. */ rqst->rq_verf = rpctls_null_verf; /* Check client credentials. */ if (rqst->rq_cred.oa_length != 0 || msg->rm_call.cb_verf.oa_length != 0 || - msg->rm_call.cb_verf.oa_flavor != AUTH_NULL) + msg->rm_call.cb_verf.oa_flavor != AUTH_NULL) { + KRPC_CURVNET_RESTORE(); return (AUTH_BADCRED); + } - if (rqst->rq_proc != NULLPROC) + if (rqst->rq_proc != NULLPROC) { + KRPC_CURVNET_RESTORE(); return (AUTH_REJECTEDCRED); + } call_stat = FALSE; #ifdef KERN_TLS if (rpctls_getinfo(&maxlen, false, true)) call_stat = TRUE; #endif - if (!call_stat) + if (!call_stat) { + KRPC_CURVNET_RESTORE(); return (AUTH_REJECTEDCRED); + } /* * Disable reception for the krpc so that the TLS handshake can @@ -787,6 +798,7 @@ _svcauth_rpcsec_tls(struct svc_req *rqst, struct rpc_msg *msg) xprt->xp_dontrcv = FALSE; sx_xunlock(&xprt->xp_lock); xprt_active(xprt); /* Harmless if already active. */ + KRPC_CURVNET_RESTORE(); return (AUTH_REJECTEDCRED); } @@ -809,9 +821,12 @@ _svcauth_rpcsec_tls(struct svc_req *rqst, struct rpc_msg *msg) xprt->xp_uid = uid; xprt->xp_gidp = gidp; } + KRPC_VNET(svc_vc_tls_handshake_failed)--; + KRPC_VNET(svc_vc_tls_handshake_success)++; } sx_xunlock(&xprt->xp_lock); xprt_active(xprt); /* Harmless if already active. */ + KRPC_CURVNET_RESTORE(); return (RPCSEC_GSS_NODISPATCH); } diff --git a/sys/rpc/svc_vc.c b/sys/rpc/svc_vc.c index e98e28de6982..69960079883b 100644 --- a/sys/rpc/svc_vc.c +++ b/sys/rpc/svc_vc.c @@ -74,6 +74,66 @@ static char *sccsid = "@(#)svc_tcp.c 2.2 88/08/01 4.0 RPCSRC"; #include +SYSCTL_NODE(_kern, OID_AUTO, rpc, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, + "RPC"); +SYSCTL_NODE(_kern_rpc, OID_AUTO, tls, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, + "TLS"); +SYSCTL_NODE(_kern_rpc, OID_AUTO, unenc, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, + "unencrypted"); + +KRPC_VNET_DEFINE_STATIC(uint64_t, svc_vc_rx_msgbytes) = 0; +SYSCTL_U64(_kern_rpc_unenc, OID_AUTO, rx_msgbytes, CTLFLAG_KRPC_VNET | CTLFLAG_RW, + &KRPC_VNET_NAME(svc_vc_rx_msgbytes), 0, "Count of non-TLS rx bytes"); + +KRPC_VNET_DEFINE_STATIC(uint64_t, svc_vc_rx_msgcnt) = 0; +SYSCTL_U64(_kern_rpc_unenc, OID_AUTO, rx_msgcnt, CTLFLAG_KRPC_VNET | CTLFLAG_RW, + &KRPC_VNET_NAME(svc_vc_rx_msgcnt), 0, "Count of non-TLS rx messages"); + +KRPC_VNET_DEFINE_STATIC(uint64_t, svc_vc_tx_msgbytes) = 0; +SYSCTL_U64(_kern_rpc_unenc, OID_AUTO, tx_msgbytes, CTLFLAG_KRPC_VNET | CTLFLAG_RW, + &KRPC_VNET_NAME(svc_vc_tx_msgbytes), 0, "Count of non-TLS tx bytes"); + +KRPC_VNET_DEFINE_STATIC(uint64_t, svc_vc_tx_msgcnt) = 0; +SYSCTL_U64(_kern_rpc_unenc, OID_AUTO, tx_msgcnt, CTLFLAG_KRPC_VNET | CTLFLAG_RW, + &KRPC_VNET_NAME(svc_vc_tx_msgcnt), 0, "Count of non-TLS tx messages"); + +KRPC_VNET_DEFINE_STATIC(uint64_t, svc_vc_tls_alerts) = 0; +SYSCTL_U64(_kern_rpc_tls, OID_AUTO, alerts, + CTLFLAG_KRPC_VNET | CTLFLAG_RW, &KRPC_VNET_NAME(svc_vc_tls_alerts), 0, + "Count of TLS alert messages"); + +KRPC_VNET_DEFINE(uint64_t, svc_vc_tls_handshake_failed) = 0; +SYSCTL_U64(_kern_rpc_tls, OID_AUTO, handshake_failed, + CTLFLAG_KRPC_VNET | CTLFLAG_RW, + &KRPC_VNET_NAME(svc_vc_tls_handshake_failed), 0, + "Count of TLS failed handshakes"); + +KRPC_VNET_DEFINE(uint64_t, svc_vc_tls_handshake_success) = 0; +SYSCTL_U64(_kern_rpc_tls, OID_AUTO, handshake_success, + CTLFLAG_KRPC_VNET | CTLFLAG_RW, + &KRPC_VNET_NAME(svc_vc_tls_handshake_success), 0, + "Count of TLS successful handshakes"); + +KRPC_VNET_DEFINE_STATIC(uint64_t, svc_vc_tls_rx_msgbytes) = 0; +SYSCTL_U64(_kern_rpc_tls, OID_AUTO, rx_msgbytes, + CTLFLAG_KRPC_VNET | CTLFLAG_RW, &KRPC_VNET_NAME(svc_vc_tls_rx_msgbytes), 0, + "Count of TLS rx bytes"); + +KRPC_VNET_DEFINE_STATIC(uint64_t, svc_vc_tls_rx_msgcnt) = 0; +SYSCTL_U64(_kern_rpc_tls, OID_AUTO, rx_msgcnt, + CTLFLAG_KRPC_VNET | CTLFLAG_RW, &KRPC_VNET_NAME(svc_vc_tls_rx_msgcnt), 0, + "Count of TLS rx messages"); + +KRPC_VNET_DEFINE_STATIC(uint64_t, svc_vc_tls_tx_msgbytes) = 0; +SYSCTL_U64(_kern_rpc_tls, OID_AUTO, tx_msgbytes, + CTLFLAG_KRPC_VNET | CTLFLAG_RW, &KRPC_VNET_NAME(svc_vc_tls_tx_msgbytes), 0, + "Count of TLS tx bytes"); + +KRPC_VNET_DEFINE_STATIC(uint64_t, svc_vc_tls_tx_msgcnt) = 0; +SYSCTL_U64(_kern_rpc_tls, OID_AUTO, tx_msgcnt, + CTLFLAG_KRPC_VNET | CTLFLAG_RW, &KRPC_VNET_NAME(svc_vc_tls_tx_msgcnt), 0, + "Count of TLS tx messages"); + static bool_t svc_vc_rendezvous_recv(SVCXPRT *, struct rpc_msg *, struct sockaddr **, struct mbuf **); static enum xprt_stat svc_vc_rendezvous_stat(SVCXPRT *); @@ -808,8 +868,11 @@ tryagain: * This record needs to be handled in userland * via an SSL_read() call, so do an upcall to the daemon. */ + KRPC_CURVNET_SET(so->so_vnet); if ((xprt->xp_tls & RPCTLS_FLAGS_HANDSHAKE) != 0 && error == ENXIO) { + KRPC_VNET(svc_vc_tls_alerts)++; + KRPC_CURVNET_RESTORE(); /* Disable reception. */ xprt->xp_dontrcv = TRUE; sx_xunlock(&xprt->xp_lock); @@ -832,6 +895,7 @@ tryagain: } if (error) { + KRPC_CURVNET_RESTORE(); SOCKBUF_LOCK(&so->so_rcv); if (xprt->xp_upcallset) { xprt->xp_upcallset = 0; @@ -845,6 +909,7 @@ tryagain: } if (!m) { + KRPC_CURVNET_RESTORE(); /* * EOF - the other end has closed the socket. */ @@ -870,11 +935,20 @@ tryagain: m_freem(m); m_free(ctrl); rcvflag = MSG_DONTWAIT | MSG_TLSAPPDATA; + KRPC_CURVNET_RESTORE(); goto tryagain; } + KRPC_VNET(svc_vc_tls_rx_msgcnt)++; + KRPC_VNET(svc_vc_tls_rx_msgbytes) += + 1000000000 - uio.uio_resid; } m_free(ctrl); + } else { + KRPC_VNET(svc_vc_rx_msgcnt)++; + KRPC_VNET(svc_vc_rx_msgbytes) += 1000000000 - + uio.uio_resid; } + KRPC_CURVNET_RESTORE(); if (cd->mpending) m_last(cd->mpending)->m_next = m; @@ -963,6 +1037,7 @@ svc_vc_reply(SVCXPRT *xprt, struct rpc_msg *msg, htonl(0x80000000 | (len - sizeof(uint32_t))); /* For RPC-over-TLS, copy mrep to a chain of ext_pgs. */ + KRPC_CURVNET_SET(xprt->xp_socket->so_vnet); if ((xprt->xp_tls & RPCTLS_FLAGS_HANDSHAKE) != 0) { /* * Copy the mbuf chain to a chain of @@ -974,7 +1049,13 @@ svc_vc_reply(SVCXPRT *xprt, struct rpc_msg *msg, maxextsiz = min(maxextsiz, maxlen); #endif mrep = _rpc_copym_into_ext_pgs(mrep, maxextsiz); + KRPC_VNET(svc_vc_tls_tx_msgcnt)++; + KRPC_VNET(svc_vc_tls_tx_msgbytes) += len; + } else { + KRPC_VNET(svc_vc_tx_msgcnt)++; + KRPC_VNET(svc_vc_tx_msgbytes) += len; } + KRPC_CURVNET_RESTORE(); atomic_add_32(&xprt->xp_snd_cnt, len); /* * sosend consumes mreq. From nobody Sun Dec 24 23:13:46 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Syxfy6lKRz54mLF; Sun, 24 Dec 2023 23:13: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Syxfy6DSbz3c5M; Sun, 24 Dec 2023 23:13:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703459626; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3IaeSgba/Z4pGfqO+6H+y3JfyYs0W3K0Btgj7tJY3KA=; b=lQXbMvS1txNzJCAPpd7ewBopXngHvbEnioJhxC40LS+PCK10cH4JFbWHGb81iprLJnYzhI 43jUeLUmxqW6JjS52Qt1PB9AXonXRBQOPBHEQk+3/tMFKi87JhbUiMhnwZMQ+79FkZihIo 53kaWljwRO9K9tAUJfs28mlajRp8tqqFTjj135cN5umgA2VknfF8fSn+yYtnGur0OoApwl FIum8pw2gVLVlAeKoQjw13A2lnbnQqGjwwbvSTKI17O3e9GODF/wOa2WvldR3DkNIrhv2M VqxLhi8Mr5J1Z3cDrcSnuR/LuruHWWNpgvG7bKc2PSlMrRi33PzdQdp2np1xIQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703459626; a=rsa-sha256; cv=none; b=G2CJl62jfmmoebqOwtlwyAHUda6HoTVkUxkB06qAkquCAjOxj7OvffLzBtKCzh9LkmyCWX /aQvlIgzj/dUykninxWkC8mUgwuoD77COp0VX9k3H6BUJKyerArwf4Zuao9JsVoYnnrYtr Q2XXrJAB3n55Fb+/MS++vRbN123ZNeKCWIl7yBE3RbMuqZFKIWFVVVEDydUkJQgAizhYTk UEiFUr7whbkYurSQW44YcqlZA1iC+Y//x/1oZLX2ZaZxh/v4cjP4t/WJhvtubA/2Oswh8E MGQOiGTmUTTlSkuYAi/G3N0EJUllJLtmX1O4CcMs+pEUdz8hMIcuaQWV6rCFBA== 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=1703459626; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3IaeSgba/Z4pGfqO+6H+y3JfyYs0W3K0Btgj7tJY3KA=; b=Bpg2LGqZMFMKczF/zHGKmJt9WChxAeqjhU0PWUMVZ2RjIHvFzGPwsa7R0NkVUHO2MG4mnX TQuD+l1bqW/UnnIfc3yBjCNM8rXMNJmxBvSZBuHKe7tl8fFJdCbSybaOu463jDH9XGBP3a iAo6gEQNjVXRKgBhiNlZkbrlZfROBhvdhG1R3oHLrQiURissWuKECmHRSpyfyhM3XjKsVT b3Uj8Qzzv/Zlmcym35A6+yaWrMdPZTWPYzjxGfAN0l0nX0Rb5NCmBTaim8aBNRyiEO8j6O GX0/xsj0fShUSWPkpCulGNdRfX06gpVDNS0etuYrRBEuPBpu6xcglx64grLcBQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Syxfy5HRHznHd; Sun, 24 Dec 2023 23:13:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BONDk24077909; Sun, 24 Dec 2023 23:13:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BONDkcn077906; Sun, 24 Dec 2023 23:13:46 GMT (envelope-from git) Date: Sun, 24 Dec 2023 23:13:46 GMT Message-Id: <202312242313.3BONDkcn077906@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 092abb839d1d - stable/14 - param.h: Bump __FreeBSD_version to 1400502 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 092abb839d1d2826533bb9c4c93d713f8b5043f9 Auto-Submitted: auto-generated The branch stable/14 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=092abb839d1d2826533bb9c4c93d713f8b5043f9 commit 092abb839d1d2826533bb9c4c93d713f8b5043f9 Author: Rick Macklem AuthorDate: 2023-12-24 23:12:44 +0000 Commit: Rick Macklem CommitDate: 2023-12-24 23:12:44 +0000 param.h: Bump __FreeBSD_version to 1400502 Commits acc704b36192 and b8e137d8d32d both modified the internal API between the kgssapi and krpc modules. As such, both of these modules need to be rebuilt from sources. I have bumped __FreeBSD_version to 1400502 for this. --- sys/sys/param.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/param.h b/sys/sys/param.h index 438b4808817b..3ed0d9ef6ddc 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -75,7 +75,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400501 +#define __FreeBSD_version 1400502 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From nobody Sun Dec 24 23:18:48 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Syxmm6Wpyz54mbP; Sun, 24 Dec 2023 23: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Syxmm5wGbz3cP5; Sun, 24 Dec 2023 23:18:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703459928; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MTN+X3QqQbcnKMDvqOpfs86073ahwKL+9zL6DO0qiEk=; b=rVXIOCxGCmZIdlSM9i5YvRHIIzPFW4GqVZl4NM9KAZK/0laLPZQcEha4mhZ8eiWDmyM5+C q+AGv0fUFIbC5BY7MObR1uzZ/2Aar9I0zXN5P36ztN3ozbgt7k6EyYPvr1xsB9Vjdf5rqV dhZiDuT0I8OiCVSfpRDO304WCTp/BtMpMh3FK3f5rd/6Bz2MI1lDq/0S1bbHTY6dGbWn/A 2dcU/BnpO2jbbYwmiWZ9qcNuZUQVmbRs/f2xqQuH8QgWmOEkrCr1gEj94WxckS27ErTRr8 KkF/1r3MDfxDLOF30trJNvBjcuXEHb9mXgajkGR7adpkHYKVLrwzx1FFhc5fIA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703459928; a=rsa-sha256; cv=none; b=iDEiWvm+EYaIaYdfQ8+M39q0pYdtkKoGFk2YIHeg5T86dvU5i2cHwjmeDdxDD4Ix2qlWwd epA/i/2YoW4662QjuwftebsZtTbjzeQ1kfvK6tEBVOcpDlCv8Cuc+BrysaPxWk/Fy6gnMp TelBzKbvR5rUWUtFPdYAcRk40ccBf0/Yz0/RrXgA7Y+zYgE6NKeb8q9/Hm5WYhh5tAiVr8 kQP6rlAGmIdcbvL8v8oMDL8Uavd5JDyLJK4D/sLhJUR2cw/fh2YRN/b6euAOHlT+/Y8OpY qKqrmQymKD1rPIM0JlXLM0jgDEpV6SFa35m1r3eIOtva/Mtd5a0h3eRONt3k0g== 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=1703459928; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MTN+X3QqQbcnKMDvqOpfs86073ahwKL+9zL6DO0qiEk=; b=N2/FSLiDdDl80b+Bbt626IVWXstzITLloC4ewVHggDXwZEOkZKCjSyPHM25E0LIvIt+Zcj LICKXaCXeo+B+8Qf/JKSMd5l+rI02pOIv4oszYQNcYJ2dTzJPAAeMaQzN/cU5jDdiHCdxR eINGN/vrmQlsVkFKJPSYsSuEzvxg9Y7oIbokGicz0IMdflGHA/0q7qMxYSMZBJ/qkh4/o3 uzeRkuNCkqRiniWNXfSz0nlCG3rr2FFPHAUP9U+7ctzGme2x4cYhvhFvea+Zcu+dCO2pr7 uC2igETm/god/Q10L4+zzGT0li11j327w2Yy5ZJw0kRBXYBO3TKpYg60j72d+A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Syxmm4wvgznKx; Sun, 24 Dec 2023 23:18:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BONImnS078928; Sun, 24 Dec 2023 23:18:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BONImcM078925; Sun, 24 Dec 2023 23:18:48 GMT (envelope-from git) Date: Sun, 24 Dec 2023 23:18:48 GMT Message-Id: <202312242318.3BONImcM078925@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 100b825b63cb - stable/14 - UPDATING: Add entry for __FreeBSD_version bump to 1400502 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 100b825b63cb360c5f1cf1d5cfefb00fe5662701 Auto-Submitted: auto-generated The branch stable/14 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=100b825b63cb360c5f1cf1d5cfefb00fe5662701 commit 100b825b63cb360c5f1cf1d5cfefb00fe5662701 Author: Rick Macklem AuthorDate: 2023-12-24 23:17:36 +0000 Commit: Rick Macklem CommitDate: 2023-12-24 23:17:36 +0000 UPDATING: Add entry for __FreeBSD_version bump to 1400502 --- UPDATING | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/UPDATING b/UPDATING index 9858822f4071..cea774197ec8 100644 --- a/UPDATING +++ b/UPDATING @@ -12,6 +12,13 @@ Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before updating system packages and/or ports. +20231224: + Commits acc704b36192 and b8e137d8d32d both modified the + internal API between the kgssapi and krpc modules. + As such, both of these modules need to be rebuilt from + sources. + As such, __FreeBSD_version has been bumped to 1400502. + 20230924: Enable splitting out pkgbase manpages into separate packages by default. To disable this, set WITHOUT_MANSPLITPKG=yes in src.conf. From nobody Mon Dec 25 03:57:52 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Sz3ym60SGz55HSX; Mon, 25 Dec 2023 03:57: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Sz3ym5Q8Hz4Wvk; Mon, 25 Dec 2023 03:57:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703476672; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8coG04IwTxUZVvUSEfxRciQHww7xLkrsKUhzFS/SpU0=; b=Y/8ifb8jKVJQTUKW+2X+oM143tJdzXIeIxj2Qh8bWHg1xt45UTY8Dsn2S1p6bJgvZm4Di0 Ss/HVoTWozg1JtOLeDKRPYlcGlFfCt3tKhSdFsDB/4hyeXCPMfA0P1xqPV9blfO85hNgZP F+8XyTR1vVkVULQwpEMCFtlR7kvP5eoYEfou115OzVZF2qO5iRKkMBWh442pmHpBYEUUzN B/ZGXngPH8Pep+Iqkh5SnaxGYXB5rUmTXI40+8uaL2GhZszSV8L3jhTne6Z7U5UcdvsMSl eIkik10oA+6bIn0ByLSutP/khtUAdKcpOFmmLZufxRBp/EhdaOlW0uGAepYaFA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703476672; a=rsa-sha256; cv=none; b=QL/kra/D1/x8+MRVeu1KPFack94b51y3nMZyJSVwhuuYmwHGfUEMVt7nfYuk6CLs+zPvFB J9HrMAqUkceMFG2pnEMRfslIZU1+P29+tuVqxaK1KCr7TuDlyhkOrAxjkMkxjH4FFuph1O 7XQaljQNXM2G2zHftF5bwVbLWf6aeooHYS4RrYx7e0GXvY2LzhETenCdC8m2qjuQrAcabt h4dL6PVXpyhEZVZpMqNnnUnksslI0xMSSRV9KOcbkgpC+hipi70YGEMTVMHDc1OA5PvKBp d2rWInPjx1CfllP/FE8FIQliSmfYb8781pfkfC2rYkHQEbbNmhM9v8Sl+EiJog== 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=1703476672; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8coG04IwTxUZVvUSEfxRciQHww7xLkrsKUhzFS/SpU0=; b=Tus076vOfD+/HqmGdVtq4zDYRAToKuf408pfMNXBAcQmpHTf90ghaSbiEHFP9mAl0XoxdG 7WRl2bWvfBSaGxVJV5AtN+vovORBAmf1OlPm87BfJegsKP8NPJZfwJVzbp2IEooEy/XO7g JJ1o7fSYwvWN5RIGtkM0JlERy1VQBb6lD+zvqrhd4wRNdQ4SY5oq2BEmTHeBl/sMXaKxWZ 3sa4ZhVoYmcSq37IEofvowYA8RIrzWzljEX3GqxeKaqKlLFgVLBqabMDihOnrWsfzG9wiR sShngnjLCAbKzmbT9SU73SzpvOY6xzFVRhJwqwDnD20sf91YYgH9ZiliGHYCEg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Sz3ym4SFwzvSs; Mon, 25 Dec 2023 03:57:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BP3vqKv047580; Mon, 25 Dec 2023 03:57:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BP3vqtn047577; Mon, 25 Dec 2023 03:57:52 GMT (envelope-from git) Date: Mon, 25 Dec 2023 03:57:52 GMT Message-Id: <202312250357.3BP3vqtn047577@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: c06a5fd3b110 - stable/14 - vmm.h: remove dup declaration List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: c06a5fd3b1108d9b54724d17fac008f60e46c0d7 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c06a5fd3b1108d9b54724d17fac008f60e46c0d7 commit c06a5fd3b1108d9b54724d17fac008f60e46c0d7 Author: Konstantin Belousov AuthorDate: 2023-12-20 23:40:00 +0000 Commit: Konstantin Belousov CommitDate: 2023-12-25 03:57:25 +0000 vmm.h: remove dup declaration (cherry picked from commit 7c8f16318499d2b05e916abd66148e5409284a9d) --- sys/amd64/include/vmm.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/amd64/include/vmm.h b/sys/amd64/include/vmm.h index 0210aeef80fd..2b18e1c97dd6 100644 --- a/sys/amd64/include/vmm.h +++ b/sys/amd64/include/vmm.h @@ -260,8 +260,6 @@ void *vm_gpa_hold(struct vcpu *vcpu, vm_paddr_t gpa, size_t len, int prot, void **cookie); void *vm_gpa_hold_global(struct vm *vm, vm_paddr_t gpa, size_t len, int prot, void **cookie); -void *vm_gpa_hold_global(struct vm *vm, vm_paddr_t gpa, size_t len, - int prot, void **cookie); void vm_gpa_release(void *cookie); bool vm_mem_allocated(struct vcpu *vcpu, vm_paddr_t gpa); From nobody Mon Dec 25 03:57:53 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Sz3yp00zNz55HJm; Mon, 25 Dec 2023 03:57:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Sz3yn6Hs7z4Wvs; Mon, 25 Dec 2023 03:57:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703476673; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4Mqe647wWwCpGlqQGcvENv2DYfOLaoxyOimyE9jHsIg=; b=EPEHzIqLN86ad+qJCFyvnJJCjgaf+hhT+hGvNjTKCsG0f09rZcciog+W3kVyetwOQdq3RK RL8z2Ace6NS4nIK/XjsldtZkrV0Hr4h8YRmUKsaX2kRy3upKDKz6V3AVXbX+epvIUgZ3Mb gF7ZLQ42hGyYspovuu9fsyjFg0wO1/XvE5yXzpOXCzYWxrknQlvJC8Ezk14AHc9eLT8iLK uRDAfje4YQo1PNkXP0RNXIEd6Z+9dcKJiJs+lOdPYfSD5Vzch4X12D4P8jISXa7kaly2Gr owrwG6YA5WpUR6b8J1TYL90J0zxd55YO3SD5773maTlboaLRybAXjXOW7UJ/IQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703476673; a=rsa-sha256; cv=none; b=XExIY75v8scV0NI4uo4ryojZ515O4GbcxcfZPiCs5yaXnsrl/QIHJ+/TKzO7ern1BuLyD3 ozfsY3ThBg/2ky1tYozqR5OR2StMb74hm581Cqz3ZEPFnMLcVjPq6pRltyAqrD+2XBqQs6 F/sji1vFp2BLfLrQQXKmbB0U5Wp3M/SeA85Feo1j5Byg/a/Oz+Vbu4+jzTzj/sacAamxT3 6GxijwIB1o11QuPEO6ZkWXK9PfsCcc31xiGb7DccuWpac2+SSEm/RjC7PfhSwiJxRTAeTk uDBKLlP5fQdGswph9GwzlC+vdyQS4r1KmK1IDBMROSJ7pt4p+e3f5OG4AWO6IQ== 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=1703476673; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4Mqe647wWwCpGlqQGcvENv2DYfOLaoxyOimyE9jHsIg=; b=XC9Z22EGO20wQZ6sCmihEkF3ytAFCPiMVK6JHAt4DzKgQ46fwQWxWlHOITJHSSNGv+fqB0 pVZdquIIFmjL+VvKEQCnL/5qdpZT1CTL8jquJUEz7TgbTsZpJCFHcyTaSQD+GJVddwIMwj sXwCGXgj+3dpgHbc66V4n4J05dqk42QuNl2l84f8Xd/eL1vWdMl8Co6+6JJ5U53XupeK7X 5iLSJNz8163afco7Q3fOZPEENDhDmW2oSAxrydBHVwLFHDPbQcztDnZ7iNZF+cq0Px3cMp rsWtntAlkNGFOahtxbZiKVS29Yum0vJNwLgCzDwjwK8x8IzyaqmgVhpGtYEQCA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Sz3yn5MPSzvqq; Mon, 25 Dec 2023 03:57:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BP3vrTS047626; Mon, 25 Dec 2023 03:57:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BP3vrkq047623; Mon, 25 Dec 2023 03:57:53 GMT (envelope-from git) Date: Mon, 25 Dec 2023 03:57:53 GMT Message-Id: <202312250357.3BP3vrkq047623@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 4c29e65cd8ce - stable/14 - bhyve.8: add missed dot List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 4c29e65cd8cea7f425eacaf240912da320af92f9 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4c29e65cd8cea7f425eacaf240912da320af92f9 commit 4c29e65cd8cea7f425eacaf240912da320af92f9 Author: Konstantin Belousov AuthorDate: 2023-12-21 23:54:39 +0000 Commit: Konstantin Belousov CommitDate: 2023-12-25 03:57:25 +0000 bhyve.8: add missed dot (cherry picked from commit 59a35b7c6b1a955920eff8dcade2ceec4d5d5fd6) --- usr.sbin/bhyve/bhyve.8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index 6afe37bcd58e..c6720af46dfb 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -244,7 +244,7 @@ flag description. .Sm on .Oc .Xc -Set the guest physical memory size +Set the guest physical memory size. This must be the same size that was given to .Xr bhyveload 8 . .Pp From nobody Mon Dec 25 03:58:24 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Sz3zP1cKsz55HhM; Mon, 25 Dec 2023 03:58: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Sz3zP15Msz4XMV; Mon, 25 Dec 2023 03:58:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703476705; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=imsY2ykYJZZM2z1akt/iLs+gUunwBsKFbaBi5AOQ0fw=; b=GvYmyfZPqo0u9opCCv7nSJaV7WvmBG4OnSq3lNVIFNSAKxM13n17ysU82IIf5vnINyqAzy f5euqNFxYnwJs7wwmOSQl3IuAd6lZukFqlawV1TmHakYmQK2VBMTbXd+eNVngC1YgOvYta +WqcSyKZI+RdOp4XdQ7V3MKzHciy0OXBtFr/iGALXgNVDAdn3crcuENb/YE/5p3ZJe2Oka +VZhwiJg08xjt+H6W9OJWkUCDKkcEsOW7Jy5vTyn0nvrmoTTjBDFCHtOrKhedh+KoBIVNw w2v7pzKhepVUFlndLQrA+J5k2pPdU7mydfXu0/3yASschNBUTAuLAUV5K3h4jg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703476705; a=rsa-sha256; cv=none; b=vBT30aM9OyCkeXQYS49rs1liBWdiuew9tC9ZdbDFxVWaW3FZdXIr2ThYU9NxdP/6h8UvI0 MXbtyYtedk6YdMc+yRhy3+IaJ2WLZOpNqiaPjdeECZBcKcOPPExJrsG3lSNk3duJr2X5V5 3lTpDPZ4ia4qEYOC8cXqg0kriAiMbj/XvVr2zBwK0nOfYHvcEfBcU454cPeZEECyAx6u/i D2Bio8yzbuc9kPkUf7HUoodeehwuqZJJlcKLwguu0cy+CUNMn7nrL7cywVPLsne9TzR9EH lF5dN3FPI0JH21pIj6gvE3wGkcc+elVLRN0uc+SumQ7Qc5/YMU/tqwAPSaJJaA== 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=1703476705; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=imsY2ykYJZZM2z1akt/iLs+gUunwBsKFbaBi5AOQ0fw=; b=DQlhE7cJ3StM8K1NxWXLkUy8sOBKJhhTTaX+lnOQBDVmW3SCVAC112pTw899qsgIh2yDjL X4R2HelsjYldlRLyE2WNiT/wWJBgyNFJWJ0G4MBUP4QuMP7xZYP6zklHn+lNROFAsVJGu0 ggcMWum+XaGH9+5mIiAwyOxLzUW9kju/y6IN6Mg4jCvIcDiF8JdhYl2b8COafOxNHjhWeQ omQl7GNJJj1/U1e8K8f9Q5PqL0Ufp/P/Yia033EQ12R5Yj2ceYtNLeMFysAtJUSs+fFmTZ UMQAgGKIxlHBnp/v4v/CGSOcjpzwx/6Otkw1+doDArZo5N/E7ZkzHOK2C/3a1g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Sz3zP08SSzw8v; Mon, 25 Dec 2023 03:58:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BP3wOKG047825; Mon, 25 Dec 2023 03:58:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BP3wOp2047822; Mon, 25 Dec 2023 03:58:24 GMT (envelope-from git) Date: Mon, 25 Dec 2023 03:58:24 GMT Message-Id: <202312250358.3BP3wOp2047822@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 7f5511c698bc - stable/13 - vmm.h: remove dup declaration List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7f5511c698bc5d1f036067df9470d2045ffcdb9e Auto-Submitted: auto-generated The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7f5511c698bc5d1f036067df9470d2045ffcdb9e commit 7f5511c698bc5d1f036067df9470d2045ffcdb9e Author: Konstantin Belousov AuthorDate: 2023-12-20 23:40:00 +0000 Commit: Konstantin Belousov CommitDate: 2023-12-25 03:58:03 +0000 vmm.h: remove dup declaration (cherry picked from commit 7c8f16318499d2b05e916abd66148e5409284a9d) --- sys/amd64/include/vmm.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/amd64/include/vmm.h b/sys/amd64/include/vmm.h index 222a8db50d11..4bd740489456 100644 --- a/sys/amd64/include/vmm.h +++ b/sys/amd64/include/vmm.h @@ -260,8 +260,6 @@ void *vm_gpa_hold(struct vcpu *vcpu, vm_paddr_t gpa, size_t len, int prot, void **cookie); void *vm_gpa_hold_global(struct vm *vm, vm_paddr_t gpa, size_t len, int prot, void **cookie); -void *vm_gpa_hold_global(struct vm *vm, vm_paddr_t gpa, size_t len, - int prot, void **cookie); void vm_gpa_release(void *cookie); bool vm_mem_allocated(struct vcpu *vcpu, vm_paddr_t gpa); From nobody Mon Dec 25 03:58:26 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Sz3zQ4Ccmz55HhN; Mon, 25 Dec 2023 03:58: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Sz3zQ2J5jz4X8s; Mon, 25 Dec 2023 03:58:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703476706; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=h6v9UON11aSCQpCiNQ5KPJFTLHK8NWO60PiY1O3Adpo=; b=ZmL16m8r0cHJTGKNmcyjKdL57544AFxF6BWi/s5QkEUo36IG2opBg8VNXdXjASwOtge65p yJGHDnbU76+omFLetGAkkgFwVGu/M3xSF8epldp6KTC+IUsZ7PUOVolxgV3d++D9pCdGjU mUvpr+doebjAQaHa6E/GaGXYG+wBtObh2EftzH+jk39oaSs/hWZpxPOqZrsqcPeqXF9dON X9qXvyNnlmIWClPrZ2jW9fXdGwDeWIeT9TDRlNZt3/3wlbREkLvbMtq1ovYzTd8AZ0Cb6l HAC9ERx1yxSoHoKLrihogCgfPeDwqYV7YryxNRO0RWzU8iJw7j835HLov/Qkhw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703476706; a=rsa-sha256; cv=none; b=aNhmP/pBBvVVZw8atIJt3BeKdT9OtPieLoybcl+gsSD4rSyO3HOpcZtquVwLVN7W9jtOfJ VSxAN7NZ40ka2KKFVMYBjn4m52b2wOXgkOgTlv5AmFxM4aFh7ZrnDGZ9irieraCzlPCO7f 8NYR6j8FPyj9UTl6hHFzQqGVBKBNEjhDyNsM26nl8/l6Cyj3XBHRTlN82d2JqhD56vbBlw bq6o0YbMdMpwAKrRMxfiTvDgTO6Qw1byZKkeI786HPzDFAtZB/AGO/n+BfISWrXwluCQIx X4C3JDZCXiMdJQz7+nznaJynX1IcVbY4JaDuwuJhCI6P6AkqpiBIpPUg7qqTsA== 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=1703476706; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=h6v9UON11aSCQpCiNQ5KPJFTLHK8NWO60PiY1O3Adpo=; b=VVn2h/OoNrUEBBAkpObqxKQu0Cw3RsMhqz8lZkDvQ8S5ZexwtFSHemgMJ6ObR8LpTQduyf nOfdRnRSzMiKs/5n8f2AMEeZuESlMrujmvljqfmAswRqvF1l8C5SkvR+J2EE6wpJL1M3hX LR68Rd5D7s/Yqw/g1FAKP/eGmLngD6oP3KjFZOpX7sLrm/Xnzyn2ZtW7DYN2iV6aqqT3UR IzJqiyPrsZtqi5XhOpostChysAfEFhLbuRNykrKAHd2Ga4GXZAd4RcU3Rc0pC31h2zv2kE OUx0LDMZwYnwMc2IXe2/Qhgx1GDHQg1eRkZ23Z3lH4VkN+9JFcgWoANsHPiXTA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Sz3zQ1P1ZzwN4; Mon, 25 Dec 2023 03:58:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BP3wQjp047868; Mon, 25 Dec 2023 03:58:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BP3wQVW047865; Mon, 25 Dec 2023 03:58:26 GMT (envelope-from git) Date: Mon, 25 Dec 2023 03:58:26 GMT Message-Id: <202312250358.3BP3wQVW047865@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 42b80d160b4d - stable/13 - bhyve.8: add missed dot List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 42b80d160b4d7bca63d48886bcb205663e93e3aa Auto-Submitted: auto-generated The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=42b80d160b4d7bca63d48886bcb205663e93e3aa commit 42b80d160b4d7bca63d48886bcb205663e93e3aa Author: Konstantin Belousov AuthorDate: 2023-12-21 23:54:39 +0000 Commit: Konstantin Belousov CommitDate: 2023-12-25 03:58:04 +0000 bhyve.8: add missed dot (cherry picked from commit 59a35b7c6b1a955920eff8dcade2ceec4d5d5fd6) --- usr.sbin/bhyve/bhyve.8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index 5adafd036ded..12b77554f404 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -242,7 +242,7 @@ flag description. .Sm on .Oc .Xc -Set the guest physical memory size +Set the guest physical memory size. This must be the same size that was given to .Xr bhyveload 8 . .Pp From nobody Mon Dec 25 08:56:37 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SzBbV0vg2z54K3d; Mon, 25 Dec 2023 08:56: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SzBbV04JLz3TMG; Mon, 25 Dec 2023 08:56:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703494598; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MO3z1W5Dlqgv6ifoO7/A/cwtNCbtg/kh5kImll8Dznk=; b=FAvNOIXVThKNJDxQlLHmdQJocXW/BkK7RmzPm2qXydr9/aZj7MrKfCpIXN7mhXePIH0F4u JW46PpbM5akdMUCOjZH4lA/THmEvWlc9tYg3XPDIQjd40Qrq6cTQV4CyWThul8r1Vn8Jo9 jJEXcvjS+mr4tDY5DtFUmSkvUkNwVzMHBxnBls8pxxNyg1fNb0dt0o6lBuyGYvFOOR7XiA PZCKNK/0on3N2EfxaSuEEGs/Fox8v7oYHM/u99kjC7d7Cp/F0zBw1F6fm6vHkqQxVRU90/ kA23MortYlR47ig3z5fEvF4e6tgUKUKbFmiqAmHYRV1IluW0aXLdv/z8iUiHqA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703494598; a=rsa-sha256; cv=none; b=cMVcRNHLqvmIbSr09SuFAZ5CsLwEdOsQzGZYlfMVmRoHEll3u3ElcEvgAFs1Fw/cOxcsTu PF5leGGMUHKEK/CwSQIuxsCr63aC8hgPz0ksQSckNcQk6sZR9Pd5pZ5hrs2SoZqbCU1I9H NjMH0HofURPTxTJi/eVqDEqZBC/0jemNUpuYOL9rSRgb7/XW+7R1AOE4FfUC61e7QbX/6V +8GdeZrRM3OCUEdXkNHJ9LDZXEH1QuBkyKw7hXFomdM4ru5ucUWuFZbpUvTHJZe2OhCxze WpXs/IPzxklCuo1yic8EHzlYII+1F3biYOoeJWQYbNH0YKA6JA8PAbyIE/JcPg== 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=1703494598; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MO3z1W5Dlqgv6ifoO7/A/cwtNCbtg/kh5kImll8Dznk=; b=vVMCUGTO63YvjVEDwP7cw2veMfO0HJsQA2HnPZT69cCPbW8i6BY+cfO6A/mZq2F+VyoS5N LZ4KoPZZHZOpQfA10GVGDcVU9RuD6nIOVqJDSEXR1kVtr57sUx54gwkuvtXdkvA5Wm3xA+ 8JCCf8F/Sb7zaXWGxANdVNjK7Jtf8bupfaPlcOLGHfMIykIdmBlJEUazRm0K9je8X5jAdA 9bw4DdFsHcO+k2vM+jNT+AWzc0E5qQp0kZ/0rdNCdaUqJ/PZmmV52kQf0BOJIOcOVlqMdV 3kYY1OMoK8jgfj5ckKiKJeOuHDmrmJopCk6SjeIN0ebCoh3YJM9NlDe36PJiQA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SzBbT6Dtcz14h9; Mon, 25 Dec 2023 08:56:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BP8ubqn049447; Mon, 25 Dec 2023 08:56:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BP8ubs4049444; Mon, 25 Dec 2023 08:56:37 GMT (envelope-from git) Date: Mon, 25 Dec 2023 08:56:37 GMT Message-Id: <202312250856.3BP8ubs4049444@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Richard Scheffenegger Subject: git: ac83f3fa44f3 - stable/14 - tcp: properly unroll SACK transmission on TX error with LRD List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: ac83f3fa44f3c64ddb4f817aa4c2032546a1ac92 Auto-Submitted: auto-generated The branch stable/14 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=ac83f3fa44f3c64ddb4f817aa4c2032546a1ac92 commit ac83f3fa44f3c64ddb4f817aa4c2032546a1ac92 Author: Richard Scheffenegger AuthorDate: 2023-12-18 12:01:28 +0000 Commit: Richard Scheffenegger CommitDate: 2023-12-24 13:32:29 +0000 tcp: properly unroll SACK transmission on TX error with LRD PR: 275798 Reported by: ddaniel@nvidia.com Reviewed by: tuexen, #transport MFC after: 1 week Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D43085 (cherry picked from commit e3b9058e5cd0f541da596624a366e14cabcf2e2a) --- sys/netinet/tcp_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index d83d4b8d65b1..8efea91e116f 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1654,7 +1654,7 @@ timer: ((flags & TH_SYN) == 0) && (error != EPERM)) { if (sack_rxmit) { - p->rxmit -= len; + p->rxmit = SEQ_MIN(p->end, p->rxmit) - len; tp->sackhint.sack_bytes_rexmit -= len; KASSERT(tp->sackhint.sack_bytes_rexmit >= 0, ("sackhint bytes rtx >= 0")); From nobody Tue Dec 26 02:08:23 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SzdV011g5z55Krq; Tue, 26 Dec 2023 02:08: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SzdV00nCVz4SM7; Tue, 26 Dec 2023 02:08:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703556504; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ou7/gS5SNDDPO2JojnUPEfWbZoTYpYOBTQJLJuGB5/I=; b=xMkjessvHeZHBPTgCWY8HITvd2xqo24lNBLnlDmfCDLC/8kExHlca3oaXITC7V88IbMbv3 MbvmgEw6O6nz3nQvuYcfGcGms52GBFeY9EAbm/Y9dgN+rEU/V35Suxbd8PkmbHj9hHukOi Irxg9SEQcaRcYG1ilM5JwCHgRZhzs20Di5ZxPRw0vaIdksoNWOEVBu5nn1mXvP1i/ra1fi KCgGdN+O1gkn7XjvYw6k1pjnoLjhpwSxYGnxm5C1iN2HO/lzLlkqsmcVNKrqtEAd+GFYq7 fD6z9KFO55iSoKs+kQfkc82yBnuID5+jc5PqZILhEhXVam7p+cwHtb/dEfh+Xg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703556504; a=rsa-sha256; cv=none; b=kygDaqhZ8Fr8FUZ7MC1FnnyG537fc3wT1eUdfmPh1DOQFqkt5lJqMitmUVFwXLalGcjMyh lllZuAmnKXpf1kJlFurISBr5UW4EM2lWjbTKu0AuCiUDVZBKRBYKO/IlHO0kz8AcAIYNA9 M9AH4+Q7zYS6OcwmFEbYU5xHT7Yk6D3oeuhOk5kqkLGDkEW/B/HsRbIqL2WncuYEZMEW4Q 0uqCjD/avepfVgrx889h4RBZwXi1ZL480mB1jvtzcCjTkEI5/iPAcBV8CEhtSpbWLwsCvh rylOMfw39Xh/sC54LWMfk9LNmirZbagNKixJaBP/kJQ+cJEUjxDp2qIVxI+kyA== 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=1703556504; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ou7/gS5SNDDPO2JojnUPEfWbZoTYpYOBTQJLJuGB5/I=; b=ESTUr/HDVQ2w0h0lveWkSYwOEOLNpsamD8r+oB27XKSVk4FtOHm2DRbkaBajAiQN24UZy5 TzcDitPBFRXaXu/q1icg3mI71OfYx3+C7yE6gz9WqE1GJ2zP3ROfZzsQmMnpLvG6PFhmGj 1jPbuHnTZrXkjN/U8aHgPOIoAmfV018GSWAWUDPj0tBgvnx6uclRyV+KyT30mP1NQTDhk/ x5eF+u9lphF0Q9P5btK9sqahOJqLRsrPUklqZZvweoGMAQRHmVN3osb8VkGFi8Ol9M5mdB VWviea2Y/c+v9yw11SjADCXiOBIjKyqetNbb9NRLSG41RfpVtHF4kxp2HlQzgQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SzdTz6xMVzblm; Tue, 26 Dec 2023 02:08:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BQ28NNu004589; Tue, 26 Dec 2023 02:08:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BQ28NPK004586; Tue, 26 Dec 2023 02:08:23 GMT (envelope-from git) Date: Tue, 26 Dec 2023 02:08:23 GMT Message-Id: <202312260208.3BQ28NPK004586@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 8b6d3fb0a79c - stable/14 - bhyve: Add a slirp network backend List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 8b6d3fb0a79cb1d0fa89afca47e0839dfd1572d1 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8b6d3fb0a79cb1d0fa89afca47e0839dfd1572d1 commit 8b6d3fb0a79cb1d0fa89afca47e0839dfd1572d1 Author: Mark Johnston AuthorDate: 2023-11-22 19:11:03 +0000 Commit: Mark Johnston CommitDate: 2023-12-25 16:57:14 +0000 bhyve: Add a slirp network backend This enables a subset of the functionality provided by QEMU's user networking implementation. In particular, it uses net/libslirp, the same library as QEMU. libslirp is permissively licensed but has some dependencies which make it impractical to bring into the base system (glib in particular). I thus opted to make bhyve dlopen the libslirp.so, which can be installed via pkg. The library header is imported into bhyve. The slirp backend takes a "hostfwd" which is identical to QEMU's hostfwd. When configured, bhyve opens a host socket and listens for connections, which get forwarded to the guest. For instance, "hostfwd=tcp::1234-:22" allows one to ssh into the guest by ssh'ing to port 1234 on the host, e.g., via 127.0.0.1. I didn't try to hook up guestfwd support since I don't personally have a use-case for it yet, and I think it won't interact nicely with the capsicum sandbox. Reviewed by: jhb Tested by: rew MFC after: 1 month Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D42510 (cherry picked from commit c5359e2af5ab582f9a0b862ce90ad3962f9f1d03) --- usr.sbin/bhyve/Makefile | 1 + usr.sbin/bhyve/bhyve.8 | 20 +- usr.sbin/bhyve/bhyve_config.5 | 22 +- usr.sbin/bhyve/libslirp.h | 365 ++++++++++++++++++++ usr.sbin/bhyve/net_backend_slirp.c | 662 +++++++++++++++++++++++++++++++++++++ 5 files changed, 1068 insertions(+), 2 deletions(-) diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index 6ce7f6c7ba62..b6cad38a6c39 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -34,6 +34,7 @@ SRCS= \ mem.c \ mevent.c \ net_backend_netmap.c \ + net_backend_slirp.c \ net_backends.c \ net_utils.c \ pci_emul.c \ diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index c6720af46dfb..ffdaf71d1d8a 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 12, 2023 +.Dd November 20, 2023 .Dt BHYVE 8 .Os .Sh NAME @@ -417,6 +417,10 @@ Network device backends: .Op Cm \&,mac= Ar xx:xx:xx:xx:xx:xx .Op Cm \&,mtu= Ar N .Xc +.It +.Xo +.Cm slirp,hostfwd= Ar proto : Ar hostaddr : Ar hostport - Ar guestaddr : Ar guestport +.Xc .El .Sm on .Pp @@ -460,6 +464,20 @@ must comply with .Xr netgraph 4 addressing rules. .Pp +The slirp backend can be used to provide a NATed network to the guest. +This backend has poor performance but does not require any network +configuration on the host system. +It depends on the +.Pa net/libslirp +port. +The +.Cm hostfwd +option takes a 5-tuple describing how connections from the host are to be +forwarded to the guest. +Multiple rules can be specified, separated by semicolons. +Note that semicolons must be escaped or quoted to prevent the shell from +interpreting them. +.Pp Block storage device backends: .Sm off .Bl -bullet diff --git a/usr.sbin/bhyve/bhyve_config.5 b/usr.sbin/bhyve/bhyve_config.5 index 6904ad096c0d..469ae06f36f4 100644 --- a/usr.sbin/bhyve/bhyve_config.5 +++ b/usr.sbin/bhyve/bhyve_config.5 @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd August 19, 2022 +.Dd November 20, 2023 .Dt BHYVE_CONFIG 5 .Os .Sh NAME @@ -401,6 +401,26 @@ The value of is passed to .Xr nm_open to connect to a netmap port. +.It slirp +Use the slirp backend to provide a userspace network stack. +The +.Va hostfwd +variable is used to configure how packets from the host are translated +before being sent to the guest. +.Bl -column "peerhook" "Format" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va hostfwd Ta string Ta Ta +A semicolon-separated list of host forwarding rules, each of the form +.Ar proto:haddr:hport-gaddr:gport , +where +.Ar proto +is either +.Ql tcp +or +.Ql udp . +If the guest address is equal to the empty string, packets will be +forwarded to the first DHCP-assigned address in the guest. +.El .El .Pp If diff --git a/usr.sbin/bhyve/libslirp.h b/usr.sbin/bhyve/libslirp.h new file mode 100644 index 000000000000..a679c4db7913 --- /dev/null +++ b/usr.sbin/bhyve/libslirp.h @@ -0,0 +1,365 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 1995,1996 Danny Gasparovski. 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. + * 3. Neither the name of the copyright holder 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 ``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 + * DANNY GASPAROVSKI 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 LIBSLIRP_H +#define LIBSLIRP_H + +#include +#include +#include + +#ifdef _WIN32 +#include +#include +#include +#include +typedef SSIZE_T slirp_ssize_t; +#ifdef BUILDING_LIBSLIRP +# define SLIRP_EXPORT __declspec(dllexport) +#else +# define SLIRP_EXPORT __declspec(dllimport) +#endif +#else +#include +typedef ssize_t slirp_ssize_t; +#include +#include +#define SLIRP_EXPORT +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Opaque structure containing the slirp state */ +typedef struct Slirp Slirp; + +/* Flags passed to SlirpAddPollCb and to be returned by SlirpGetREventsCb. */ +enum { + SLIRP_POLL_IN = 1 << 0, + SLIRP_POLL_OUT = 1 << 1, + SLIRP_POLL_PRI = 1 << 2, + SLIRP_POLL_ERR = 1 << 3, + SLIRP_POLL_HUP = 1 << 4, +}; + +/* Callback for application to get data from the guest */ +typedef slirp_ssize_t (*SlirpReadCb)(void *buf, size_t len, void *opaque); +/* Callback for application to send data to the guest */ +typedef slirp_ssize_t (*SlirpWriteCb)(const void *buf, size_t len, void *opaque); +/* Timer callback */ +typedef void (*SlirpTimerCb)(void *opaque); +/* Callback for libslirp to register polling callbacks */ +typedef int (*SlirpAddPollCb)(int fd, int events, void *opaque); +/* Callback for libslirp to get polling result */ +typedef int (*SlirpGetREventsCb)(int idx, void *opaque); + +/* For now libslirp creates only a timer for the IPv6 RA */ +typedef enum SlirpTimerId { + SLIRP_TIMER_RA, + SLIRP_TIMER_NUM, +} SlirpTimerId; + +/* + * Callbacks from slirp, to be set by the application. + * + * The opaque parameter is set to the opaque pointer given in the slirp_new / + * slirp_init call. + */ +typedef struct SlirpCb { + /* + * Send an ethernet frame to the guest network. The opaque parameter is the + * one given to slirp_init(). If the guest is not ready to receive a frame, + * the function can just drop the data. TCP will then handle retransmissions + * at a lower pace. + * <0 reports an IO error. + */ + SlirpWriteCb send_packet; + /* Print a message for an error due to guest misbehavior. */ + void (*guest_error)(const char *msg, void *opaque); + /* Return the virtual clock value in nanoseconds */ + int64_t (*clock_get_ns)(void *opaque); + /* Create a new timer with the given callback and opaque data. Not + * needed if timer_new_opaque is provided. */ + void *(*timer_new)(SlirpTimerCb cb, void *cb_opaque, void *opaque); + /* Remove and free a timer */ + void (*timer_free)(void *timer, void *opaque); + /* Modify a timer to expire at @expire_time (ms) */ + void (*timer_mod)(void *timer, int64_t expire_time, void *opaque); + /* Register a fd for future polling */ + void (*register_poll_fd)(int fd, void *opaque); + /* Unregister a fd */ + void (*unregister_poll_fd)(int fd, void *opaque); + /* Kick the io-thread, to signal that new events may be processed because some TCP buffer + * can now receive more data, i.e. slirp_socket_can_recv will return 1. */ + void (*notify)(void *opaque); + + /* + * Fields introduced in SlirpConfig version 4 begin + */ + + /* Initialization has completed and a Slirp* has been created. */ + void (*init_completed)(Slirp *slirp, void *opaque); + /* Create a new timer. When the timer fires, the application passes + * the SlirpTimerId and cb_opaque to slirp_handle_timer. */ + void *(*timer_new_opaque)(SlirpTimerId id, void *cb_opaque, void *opaque); +} SlirpCb; + +#define SLIRP_CONFIG_VERSION_MIN 1 +#define SLIRP_CONFIG_VERSION_MAX 5 + +typedef struct SlirpConfig { + /* Version must be provided */ + uint32_t version; + /* + * Fields introduced in SlirpConfig version 1 begin + */ + /* Whether to prevent the guest from accessing the Internet */ + int restricted; + /* Whether IPv4 is enabled */ + bool in_enabled; + /* Virtual network for the guest */ + struct in_addr vnetwork; + /* Mask for the virtual network for the guest */ + struct in_addr vnetmask; + /* Virtual address for the host exposed to the guest */ + struct in_addr vhost; + /* Whether IPv6 is enabled */ + bool in6_enabled; + /* Virtual IPv6 network for the guest */ + struct in6_addr vprefix_addr6; + /* Len of the virtual IPv6 network for the guest */ + uint8_t vprefix_len; + /* Virtual address for the host exposed to the guest */ + struct in6_addr vhost6; + /* Hostname exposed to the guest in DHCP hostname option */ + const char *vhostname; + /* Hostname exposed to the guest in the DHCP TFTP server name option */ + const char *tftp_server_name; + /* Path of the files served by TFTP */ + const char *tftp_path; + /* Boot file name exposed to the guest via DHCP */ + const char *bootfile; + /* Start of the DHCP range */ + struct in_addr vdhcp_start; + /* Virtual address for the DNS server exposed to the guest */ + struct in_addr vnameserver; + /* Virtual IPv6 address for the DNS server exposed to the guest */ + struct in6_addr vnameserver6; + /* DNS search names exposed to the guest via DHCP */ + const char **vdnssearch; + /* Domain name exposed to the guest via DHCP */ + const char *vdomainname; + /* MTU when sending packets to the guest */ + /* Default: IF_MTU_DEFAULT */ + size_t if_mtu; + /* MRU when receiving packets from the guest */ + /* Default: IF_MRU_DEFAULT */ + size_t if_mru; + /* Prohibit connecting to 127.0.0.1:* */ + bool disable_host_loopback; + /* + * Enable emulation code (*warning*: this code isn't safe, it is not + * recommended to enable it) + */ + bool enable_emu; + + /* + * Fields introduced in SlirpConfig version 2 begin + */ + /* Address to be used when sending data to the Internet */ + struct sockaddr_in *outbound_addr; + /* IPv6 Address to be used when sending data to the Internet */ + struct sockaddr_in6 *outbound_addr6; + + /* + * Fields introduced in SlirpConfig version 3 begin + */ + /* slirp will not redirect/serve any DNS packet */ + bool disable_dns; + + /* + * Fields introduced in SlirpConfig version 4 begin + */ + /* slirp will not reply to any DHCP requests */ + bool disable_dhcp; + + /* + * Fields introduced in SlirpConfig version 5 begin + */ + /* Manufacturer ID (IANA Private Enterprise number) */ + uint32_t mfr_id; + /* + * MAC address allocated for an out-of-band management controller, to be + * retrieved through NC-SI. + */ + uint8_t oob_eth_addr[6]; +} SlirpConfig; + +/* Create a new instance of a slirp stack */ +SLIRP_EXPORT +Slirp *slirp_new(const SlirpConfig *cfg, const SlirpCb *callbacks, + void *opaque); +/* slirp_init is deprecated in favor of slirp_new */ +SLIRP_EXPORT +Slirp *slirp_init(int restricted, bool in_enabled, struct in_addr vnetwork, + struct in_addr vnetmask, struct in_addr vhost, + bool in6_enabled, struct in6_addr vprefix_addr6, + uint8_t vprefix_len, struct in6_addr vhost6, + const char *vhostname, const char *tftp_server_name, + const char *tftp_path, const char *bootfile, + struct in_addr vdhcp_start, struct in_addr vnameserver, + struct in6_addr vnameserver6, const char **vdnssearch, + const char *vdomainname, const SlirpCb *callbacks, + void *opaque); +/* Shut down an instance of a slirp stack */ +SLIRP_EXPORT +void slirp_cleanup(Slirp *slirp); + +/* This is called by the application when it is about to sleep through poll(). + * *timeout is set to the amount of virtual time (in ms) that the application intends to + * wait (UINT32_MAX if infinite). slirp_pollfds_fill updates it according to + * e.g. TCP timers, so the application knows it should sleep a smaller amount of + * time. slirp_pollfds_fill calls add_poll for each file descriptor + * that should be monitored along the sleep. The opaque pointer is passed as + * such to add_poll, and add_poll returns an index. */ +SLIRP_EXPORT +void slirp_pollfds_fill(Slirp *slirp, uint32_t *timeout, + SlirpAddPollCb add_poll, void *opaque); + +/* This is called by the application after sleeping, to report which file + * descriptors are available. slirp_pollfds_poll calls get_revents on each file + * descriptor, giving it the index that add_poll returned during the + * slirp_pollfds_fill call, to know whether the descriptor is available for + * read/write/etc. (SLIRP_POLL_*) + * select_error should be passed 1 if poll() returned an error. */ +SLIRP_EXPORT +void slirp_pollfds_poll(Slirp *slirp, int select_error, + SlirpGetREventsCb get_revents, void *opaque); + +/* This is called by the application when the guest emits a packet on the + * guest network, to be interpreted by slirp. */ +SLIRP_EXPORT +void slirp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len); + +/* This is called by the application when a timer expires, if it provides + * the timer_new_opaque callback. It is not needed if the application only + * uses timer_new. */ +SLIRP_EXPORT +void slirp_handle_timer(Slirp *slirp, SlirpTimerId id, void *cb_opaque); + +/* These set up / remove port forwarding between a host port in the real world + * and the guest network. */ +SLIRP_EXPORT +int slirp_add_hostfwd(Slirp *slirp, int is_udp, struct in_addr host_addr, + int host_port, struct in_addr guest_addr, int guest_port); +SLIRP_EXPORT +int slirp_remove_hostfwd(Slirp *slirp, int is_udp, struct in_addr host_addr, + int host_port); + +#define SLIRP_HOSTFWD_UDP 1 +#define SLIRP_HOSTFWD_V6ONLY 2 +SLIRP_EXPORT +int slirp_add_hostxfwd(Slirp *slirp, + const struct sockaddr *haddr, socklen_t haddrlen, + const struct sockaddr *gaddr, socklen_t gaddrlen, + int flags); +SLIRP_EXPORT +int slirp_remove_hostxfwd(Slirp *slirp, + const struct sockaddr *haddr, socklen_t haddrlen, + int flags); + +/* Set up port forwarding between a port in the guest network and a + * command running on the host */ +SLIRP_EXPORT +int slirp_add_exec(Slirp *slirp, const char *cmdline, + struct in_addr *guest_addr, int guest_port); +/* Set up port forwarding between a port in the guest network and a + * Unix port on the host */ +SLIRP_EXPORT +int slirp_add_unix(Slirp *slirp, const char *unixsock, + struct in_addr *guest_addr, int guest_port); +/* Set up port forwarding between a port in the guest network and a + * callback that will receive the data coming from the port */ +SLIRP_EXPORT +int slirp_add_guestfwd(Slirp *slirp, SlirpWriteCb write_cb, void *opaque, + struct in_addr *guest_addr, int guest_port); + +/* TODO: rather identify a guestfwd through an opaque pointer instead of through + * the guest_addr */ + +/* This is called by the application for a guestfwd, to determine how much data + * can be received by the forwarded port through a call to slirp_socket_recv. */ +SLIRP_EXPORT +size_t slirp_socket_can_recv(Slirp *slirp, struct in_addr guest_addr, + int guest_port); +/* This is called by the application for a guestfwd, to provide the data to be + * sent on the forwarded port */ +SLIRP_EXPORT +void slirp_socket_recv(Slirp *slirp, struct in_addr guest_addr, int guest_port, + const uint8_t *buf, int size); + +/* Remove entries added by slirp_add_exec, slirp_add_unix or slirp_add_guestfwd */ +SLIRP_EXPORT +int slirp_remove_guestfwd(Slirp *slirp, struct in_addr guest_addr, + int guest_port); + +/* Return a human-readable state of the slirp stack */ +SLIRP_EXPORT +char *slirp_connection_info(Slirp *slirp); + +/* Return a human-readable state of the NDP/ARP tables */ +SLIRP_EXPORT +char *slirp_neighbor_info(Slirp *slirp); + +/* Save the slirp state through the write_cb. The opaque pointer is passed as + * such to the write_cb. */ +SLIRP_EXPORT +int slirp_state_save(Slirp *s, SlirpWriteCb write_cb, void *opaque); + +/* Returns the version of the slirp state, to be saved along the state */ +SLIRP_EXPORT +int slirp_state_version(void); + +/* Load the slirp state through the read_cb. The opaque pointer is passed as + * such to the read_cb. The version should be given as it was obtained from + * slirp_state_version when slirp_state_save was called. */ +SLIRP_EXPORT +int slirp_state_load(Slirp *s, int version_id, SlirpReadCb read_cb, + void *opaque); + +/* Return the version of the slirp implementation */ +SLIRP_EXPORT +const char *slirp_version_string(void); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LIBSLIRP_H */ diff --git a/usr.sbin/bhyve/net_backend_slirp.c b/usr.sbin/bhyve/net_backend_slirp.c new file mode 100644 index 000000000000..1c414f87084c --- /dev/null +++ b/usr.sbin/bhyve/net_backend_slirp.c @@ -0,0 +1,662 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2023 Mark Johnston + * + * This software was developed by the University of Cambridge Computer + * Laboratory (Department of Computer Science and Technology) under Innovate + * UK project 105694, "Digital Security by Design (DSbD) Technology Platform + * Prototype". + * + * 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. + */ + +/* + * The slirp backend enables unprivileged networking via libslirp, which must be + * installed on the host system via pkg or the ports tree. bhyve dlopen()s + * libslirp.so upon instantiating the slirp backend. Various network parameters + * are hard-coded in _slirp_init(). + * + * Packets received from the guest (i.e., transmitted by the frontend, such as a + * virtio NIC device model) are injected into the slirp backend via slirp_send(). + * Packets to be transmitted to the guest (i.e., inserted into the frontend's + * receive buffers) are buffered in a per-interface socket pair and read by the + * mevent loop. Sockets instantiated by libslirp are monitored by a thread + * which uses poll() and slirp_pollfds_poll() to drive libslirp events; this + * thread also handles timeout events from the libslirp context. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "config.h" +#include "debug.h" +#include "libslirp.h" +#include "mevent.h" +#include "net_backends.h" +#include "net_backends_priv.h" + +typedef int (*slirp_add_hostxfwd_p_t)(Slirp *, + const struct sockaddr *, socklen_t, const struct sockaddr *, socklen_t, + int); +typedef void (*slirp_cleanup_p_t)(Slirp *); +typedef void (*slirp_input_p_t)(Slirp *, const uint8_t *, int); +typedef Slirp *(*slirp_new_p_t)(const SlirpConfig *, const SlirpCb *, void *); +typedef void (*slirp_pollfds_fill_p_t)(Slirp *, uint32_t *timeout, + SlirpAddPollCb, void *); +typedef void (*slirp_pollfds_poll_p_t)(Slirp *, int, SlirpGetREventsCb, void *); + +/* Function pointer table, initialized by slirp_init_once(). */ +static slirp_add_hostxfwd_p_t slirp_add_hostxfwd_p; +static slirp_cleanup_p_t slirp_cleanup_p; +static slirp_input_p_t slirp_input_p; +static slirp_new_p_t slirp_new_p; +static slirp_pollfds_fill_p_t slirp_pollfds_fill_p; +static slirp_pollfds_poll_p_t slirp_pollfds_poll_p; + +static int +slirp_init_once(void) +{ + static void *handle = NULL; + + if (handle != NULL) + return (0); + handle = dlopen("libslirp.so.0", RTLD_LAZY); + if (handle == NULL) { + EPRINTLN("Unable to open libslirp.so.0: %s", dlerror()); + return (-1); + } + +#define IMPORT_SYM(sym) do { \ + sym##_p = (sym##_p_t)dlsym(handle, #sym); \ + if (sym##_p == NULL) { \ + EPRINTLN("failed to resolve %s", #sym); \ + goto err; \ + } \ +} while (0) + IMPORT_SYM(slirp_add_hostxfwd); + IMPORT_SYM(slirp_cleanup); + IMPORT_SYM(slirp_input); + IMPORT_SYM(slirp_new); + IMPORT_SYM(slirp_pollfds_fill); + IMPORT_SYM(slirp_pollfds_poll); +#undef IMPORT_SYM + + /* + * libslirp uses glib, which uses tzdata to format log messages. Help + * it out. + * + * XXX-MJ glib will also look for charset files, not sure what we can do + * about that... + */ + caph_cache_tzdata(); + + return (0); + +err: + dlclose(handle); + handle = NULL; + return (-1); +} + +struct slirp_priv { + Slirp *slirp; + +#define SLIRP_MTU 2048 + struct mevent *mevp; + int pipe[2]; + + pthread_t pollfd_td; + struct pollfd *pollfds; + size_t npollfds; + + /* Serializes libslirp calls. */ + pthread_mutex_t mtx; +}; + +static void +slirp_priv_init(struct slirp_priv *priv) +{ + int error; + + memset(priv, 0, sizeof(*priv)); + priv->pipe[0] = priv->pipe[1] = -1; + error = pthread_mutex_init(&priv->mtx, NULL); + assert(error == 0); +} + +static void +slirp_priv_cleanup(struct slirp_priv *priv) +{ + int error; + + if (priv->pipe[0] != -1) { + error = close(priv->pipe[0]); + assert(error == 0); + } + if (priv->pipe[1] != -1) { + error = close(priv->pipe[1]); + assert(error == 0); + } + if (priv->mevp) + mevent_delete(priv->mevp); + if (priv->slirp != NULL) + slirp_cleanup_p(priv->slirp); + error = pthread_mutex_destroy(&priv->mtx); + assert(error == 0); +} + +static int64_t +slirp_cb_clock_get_ns(void *param __unused) +{ + struct timespec ts; + int error; + + error = clock_gettime(CLOCK_MONOTONIC, &ts); + assert(error == 0); + return ((int64_t)(ts.tv_sec * 1000000000L + ts.tv_nsec)); +} + +static void +slirp_cb_notify(void *param __unused) +{ +} + +static void +slirp_cb_register_poll_fd(int fd, void *param __unused) +{ + const int one = 1; + + (void)setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &one, sizeof(int)); +} + +static ssize_t +slirp_cb_send_packet(const void *buf, size_t len, void *param) +{ + struct slirp_priv *priv; + ssize_t n; + + priv = param; + + assert(len <= SLIRP_MTU); + n = send(priv->pipe[1], buf, len, 0); + if (n < 0) { + EPRINTLN("slirp_cb_send_packet: send: %s", strerror(errno)); + return (n); + } + assert((size_t)n == len); + + return (n); +} + +static void +slirp_cb_unregister_poll_fd(int fd __unused, void *opaque __unused) +{ +} + +/* Callbacks invoked from within libslirp. */ +static const struct SlirpCb slirp_cbs = { + .clock_get_ns = slirp_cb_clock_get_ns, + .notify = slirp_cb_notify, + .register_poll_fd = slirp_cb_register_poll_fd, + .send_packet = slirp_cb_send_packet, + .unregister_poll_fd = slirp_cb_unregister_poll_fd, +}; + +static int +slirpev2pollev(int events) +{ + int ret; + + ret = 0; + if (events & SLIRP_POLL_IN) + ret |= POLLIN; + if (events & SLIRP_POLL_OUT) + ret |= POLLOUT; + if (events & SLIRP_POLL_PRI) + ret |= POLLPRI; + if (events & SLIRP_POLL_ERR) + ret |= POLLERR; + if (events & SLIRP_POLL_HUP) + ret |= POLLHUP; + return (ret); +} + +static int +pollev2slirpev(int events) +{ + int ret; + + ret = 0; + if (events & POLLIN) + ret |= SLIRP_POLL_IN; + if (events & POLLOUT) + ret |= SLIRP_POLL_OUT; + if (events & POLLPRI) + ret |= SLIRP_POLL_PRI; + if (events & POLLERR) + ret |= SLIRP_POLL_ERR; + if (events & POLLHUP) + ret |= SLIRP_POLL_HUP; + return (ret); +} + +static int +slirp_addpoll_cb(int fd, int events, void *param) +{ + struct slirp_priv *priv; + struct pollfd *pollfd, *pollfds; + size_t i; + + priv = param; + + for (i = 0; i < priv->npollfds; i++) + if (priv->pollfds[i].fd == -1) + break; + if (i == priv->npollfds) { + const size_t POLLFD_GROW = 4; + + priv->npollfds += POLLFD_GROW; + pollfds = realloc(priv->pollfds, + sizeof(*pollfds) * priv->npollfds); + if (pollfds == NULL) + return (-1); + for (i = priv->npollfds - POLLFD_GROW; i < priv->npollfds; i++) + pollfds[i].fd = -1; + priv->pollfds = pollfds; + + i = priv->npollfds - POLLFD_GROW; + } + pollfd = &priv->pollfds[i]; + pollfd->fd = fd; + pollfd->events = slirpev2pollev(events); + pollfd->revents = 0; + + return ((int)i); +} + +static int +slirp_poll_revents(int idx, void *param) +{ + struct slirp_priv *priv; + struct pollfd *pollfd; + + priv = param; + pollfd = &priv->pollfds[idx]; + assert(pollfd->fd != -1); + return (pollev2slirpev(pollfd->revents)); +} + +static void * +slirp_pollfd_td_loop(void *param) +{ + struct slirp_priv *priv; + struct pollfd *pollfds; + size_t npollfds; + uint32_t timeout; + int error; + + pthread_set_name_np(pthread_self(), "slirp pollfd"); + priv = param; + + pthread_mutex_lock(&priv->mtx); + for (;;) { + for (size_t i = 0; i < priv->npollfds; i++) + priv->pollfds[i].fd = -1; + + timeout = UINT32_MAX; + slirp_pollfds_fill_p(priv->slirp, &timeout, slirp_addpoll_cb, + priv); + + pollfds = priv->pollfds; + npollfds = priv->npollfds; + pthread_mutex_unlock(&priv->mtx); + for (;;) { + error = poll(pollfds, npollfds, timeout); + if (error == -1) { + if (errno != EINTR) { + EPRINTLN("poll: %s", strerror(errno)); + exit(1); + } + continue; + } + break; + } + pthread_mutex_lock(&priv->mtx); + slirp_pollfds_poll_p(priv->slirp, error == -1, + slirp_poll_revents, priv); + } +} + +static int +parse_addr(char *addr, struct sockaddr_in *sinp) +{ + char *port; + int error, porti; + + memset(sinp, 0, sizeof(*sinp)); + sinp->sin_family = AF_INET; + sinp->sin_len = sizeof(struct sockaddr_in); + + port = strchr(addr, ':'); + if (port == NULL) + return (EINVAL); + *port++ = '\0'; + + if (strlen(addr) > 0) { + error = inet_pton(AF_INET, addr, &sinp->sin_addr); + if (error != 1) + return (error == 0 ? EPFNOSUPPORT : errno); + } else { + sinp->sin_addr.s_addr = htonl(INADDR_ANY); + } + + porti = strlen(port) > 0 ? atoi(port) : 0; + if (porti < 0 || porti > UINT16_MAX) + return (EINVAL); + sinp->sin_port = htons(porti); + + return (0); +} + +static int +parse_hostfwd_rule(const char *descr, int *is_udp, struct sockaddr *hostaddr, + struct sockaddr *guestaddr) +{ + struct sockaddr_in *hostaddrp, *guestaddrp; + const char *proto; + char *p, *host, *guest; + int error; + + error = 0; + *is_udp = 0; + + p = strdup(descr); + if (p == NULL) + return (ENOMEM); + + host = strchr(p, ':'); + if (host == NULL) { + error = EINVAL; + goto out; + } + *host++ = '\0'; + + proto = p; + *is_udp = strcmp(proto, "udp") == 0; + + guest = strchr(host, '-'); + if (guest == NULL) { + error = EINVAL; + goto out; + } + *guest++ = '\0'; + + hostaddrp = (struct sockaddr_in *)hostaddr; + error = parse_addr(host, hostaddrp); + if (error != 0) + goto out; + + guestaddrp = (struct sockaddr_in *)guestaddr; + error = parse_addr(guest, guestaddrp); + if (error != 0) + goto out; + +out: + free(p); + return (error); +} + +static int +config_one_hostfwd(struct slirp_priv *priv, const char *rule) +{ + struct sockaddr hostaddr, guestaddr; + int error, is_udp; + + error = parse_hostfwd_rule(rule, &is_udp, &hostaddr, &guestaddr); + if (error != 0) { + EPRINTLN("Unable to parse hostfwd rule '%s': %s", + rule, strerror(error)); + return (error); + } + + error = slirp_add_hostxfwd_p(priv->slirp, &hostaddr, hostaddr.sa_len, + &guestaddr, guestaddr.sa_len, is_udp ? SLIRP_HOSTFWD_UDP : 0); + if (error != 0) { + EPRINTLN("Unable to add hostfwd rule '%s': %s", + rule, strerror(errno)); + return (error); + } + + return (0); +} + +static int +_slirp_init(struct net_backend *be, const char *devname __unused, + nvlist_t *nvl, net_be_rxeof_t cb, void *param) +{ + struct slirp_priv *priv = NET_BE_PRIV(be); *** 194 LINES SKIPPED *** From nobody Tue Dec 26 02:08:25 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SzdV13M1nz55L7Q; Tue, 26 Dec 2023 02:08: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SzdV12094z4SPj; Tue, 26 Dec 2023 02:08:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703556505; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7aS1zHhnAEy9mXGJuNWq/ggrb+8mlhS9tS7gyXexUs4=; b=b9fkc9Lpo28j2Ef+UNfDlGgRW3OHjAl1R5syjmFApYA3Xl+RMn08v0QhDBMlateGTl96K3 AO2wTb3KliXtogMJTPNcKO4W1VrTmLJyRu2o1RBx9gam8ONoKnRirJc0v5O789l1zM9TJZ jHVd64pRtEifotr0doCBtO4ZNsS1OZyKaUarsGtFEQ+jZjeqdPNGO1dThvzQHJ/bZ2weXJ j3JVgR+++a4jQ5nujYx0h60uGVKYqQFU+AdXSCj1/gQYN7TaS88HXmWAyP2UXCP46eb8pk sze8r61jRAU3aCNJi6k6hZNZR7ly58ADDFIocxTtyDDNdeYD5FR4RyMJqM3mhQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703556505; a=rsa-sha256; cv=none; b=KJWLVa3jSujK3VkwkN74s+xTSQntXQoQC1KXmgc/ZW0uLGXR0neUCHLIYopzJTNzVTFroS /2OH+yadCjVf+9GxB6f5I+8Xc2ejxO71hAXcDudMfdE52RfKxH3dMyp5+NLqaNudxondwR M4ZZaNhPbD/9C/ks54oG9GHpcSjY7iYT0D94k9AHZTU0+JclDz78ByZOXd02FIimzAvVr7 bUDQSh43BqyGBEY/OaVG7vThZ/gpucbTq7EwC4VuNQ6t5qiapDnnxb2mGjwKhfy6BkKZTF lbh/9UiSboYDo08MPjJrfhZPRbKzgqUuioy+jqGtniX560iKwTXfePFl38tFag== 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=1703556505; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7aS1zHhnAEy9mXGJuNWq/ggrb+8mlhS9tS7gyXexUs4=; b=puBLUiqYXQTDhWzlsKuJCgsbgHUEM1UwvAh7MMbvkg4EOdrFZR1UEu0hYgPJKhnMLzHKDv 6L2BLJ3mUCd5DoaAYROjzyW8GXRA7zCQh0Wx2aMbImmZR3GTXGIukvID4Aa0t4GRMF7B7D UsY6DGNTr1FaDTDiianqawqwAEFQT1grY+tkBvqRx1cp0jlxPHBTue1c/OIcNu8lkRH2Uw d/l+GNPsMSJ1LYj44AjWUXzQi/S+cH1TIABbeuJ/oTDKBYx1yDJ+/ItrDWm/8USypltNhf s0OyX8K/NpMlt3TUac0T7Ao7feK2L7AqaKIhwmEpI/hEKcj1YwreA0vT1ok9lg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SzdV10vjWzbhd; Tue, 26 Dec 2023 02:08:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BQ28PIN004658; Tue, 26 Dec 2023 02:08:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BQ28Pkq004655; Tue, 26 Dec 2023 02:08:25 GMT (envelope-from git) Date: Tue, 26 Dec 2023 02:08:25 GMT Message-Id: <202312260208.3BQ28Pkq004655@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 37eb7030a0fb - stable/14 - bhyve: Fix a leak that happens when we fail to load a hostfwd rule List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 37eb7030a0fb6543e402799fff2be31645e1dbac Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=37eb7030a0fb6543e402799fff2be31645e1dbac commit 37eb7030a0fb6543e402799fff2be31645e1dbac Author: Mark Johnston AuthorDate: 2023-12-01 14:46:31 +0000 Commit: Mark Johnston CommitDate: 2023-12-25 16:57:14 +0000 bhyve: Fix a leak that happens when we fail to load a hostfwd rule Reported by: Coverity Fixes: c5359e2af5ab ("bhyve: Add a slirp network backend") (cherry picked from commit 1cc96501e58057fba62cdebd514cdc9197d6e97c) --- usr.sbin/bhyve/net_backend_slirp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/net_backend_slirp.c b/usr.sbin/bhyve/net_backend_slirp.c index 1c414f87084c..1d6ed45b90f2 100644 --- a/usr.sbin/bhyve/net_backend_slirp.c +++ b/usr.sbin/bhyve/net_backend_slirp.c @@ -502,8 +502,10 @@ _slirp_init(struct net_backend *be, const char *devname __unused, goto err; while ((rule = strsep(&rules, ";")) != NULL) { error = config_one_hostfwd(priv, rule); - if (error != 0) + if (error != 0) { + free(tofree); goto err; + } } free(tofree); } From nobody Tue Dec 26 02:08:26 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SzdV26xJ1z55Krr; Tue, 26 Dec 2023 02:08: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SzdV23Wn8z4Scf; Tue, 26 Dec 2023 02:08:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703556506; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NpHInD8NgujJoXXKHA2GIrv7Ki1eiVCndFh7aAfJNiw=; b=QUwbrPqS1yOUPPP+rNdf8YQesrDxm7kSL2j/BtF+pWBtF0T6Ax2CoCgbioXiEkwxPL9uHP QScpDF1Ne05Rog1gutSBpb8wL3xIhQxuIrCOz0cznl61xIj8VQBPQp3OWWu69Klx60yOtU kAC6vGgZFILAyPDS612W20H/yGsI2kXfENku0faDIzBymW+KMTTDzp2s9+BXtjPwh6bBdy mD3NMpdzz0wQTN4Rlz2tALpJ4MzacS/dFwCctV//GXi9II5c40etwDhAUFMeSfUT1pm/f6 OO59IGBlVwv8N9e53hWtyIobPqm8ntp3YvKD5GbgpVStw+HGCefFUznmDFBxxw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703556506; a=rsa-sha256; cv=none; b=n4k7wfYN1ph8WNYudk9F9AE8eRzsRuyFnDw1vr41YKBRLc3LoAXtIkuD9PabpOX3vsh9k4 /b/jedwmSYYFLfFYS3pIzlxN0kpZ2+wUHnL/9IbMX4xcgabe4mlyW35lBTNyMRszivy2OJ bXJ558gV5nguezDZDQ43sk49UqkoBzixkQxbot+stzKW3fQ0/u06A2whq6Dhl7GGQGRxnV M4IeyQh+rJ36rQouEZb2r62zinyyTfstyfOoMVjQ5NdIws1LD2yOkuWdWWW61xpxpf86zQ C0fjY1FAf6Kyjw6ldnH/pF5aFWrC+xVvJmTdtNbl0nOHZKNdpEcv8y+eI6Y1RA== 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=1703556506; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NpHInD8NgujJoXXKHA2GIrv7Ki1eiVCndFh7aAfJNiw=; b=abVletxHmjAH7pY+kKz9kZGmRefpjOBucZ5f6gUxTRQftkDFp4ncIpUZoKlxOOCCdR+6IH WVq4+WzkFyBGWWg0ILblU8VAoMkhc97JIGYVti2XvM+0tUk2RKVHbNZAg80fRlLjiXFj1O vrjMqR1Bw18PuLOFx2CJdGb1Laasem9vpf2z2NeQjEkbrnsEUsckOj7/ZE8CENARbNfeZn tXqGeY89FWixf9uQ5G91518s32ELvEkpnkJ1na4jUn/IZKbgWhyC9IPq57OEOU3njJhj1g jv0SwSQBxG6jnycXUe1FH9jPoZmgimY72PsRkjnq7sWHC+FSwhYWPtYOYmncZg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SzdV21zZ0zbhf; Tue, 26 Dec 2023 02:08:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BQ28QJR004703; Tue, 26 Dec 2023 02:08:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BQ28QGZ004700; Tue, 26 Dec 2023 02:08:26 GMT (envelope-from git) Date: Tue, 26 Dec 2023 02:08:26 GMT Message-Id: <202312260208.3BQ28QGZ004700@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 2bc5d0db67e0 - stable/14 - arm64: Remove an unused global variable List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 2bc5d0db67e07e38f8068f062368dd1c382f236c Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2bc5d0db67e07e38f8068f062368dd1c382f236c commit 2bc5d0db67e07e38f8068f062368dd1c382f236c Author: Mark Johnston AuthorDate: 2023-11-03 16:30:49 +0000 Commit: Mark Johnston CommitDate: 2023-12-25 16:57:38 +0000 arm64: Remove an unused global variable No functional change intended. MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: Juniper Networks, Inc. (cherry picked from commit ccf8e1bb38a7833417850e205430a0c69581c8c3) --- sys/arm64/arm64/pmap.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 6f2afa0b98a3..320223c43345 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -7832,14 +7832,11 @@ pmap_is_valid_memattr(pmap_t pmap __unused, vm_memattr_t mode) } #if defined(KASAN) -static vm_paddr_t pmap_san_early_kernstart; static pd_entry_t *pmap_san_early_l2; void __nosanitizeaddress pmap_san_bootstrap(struct arm64_bootparams *abp) { - - pmap_san_early_kernstart = KERNBASE - abp->kern_delta; kasan_init_early(abp->kern_stack, KSTACK_PAGES * PAGE_SIZE); } From nobody Tue Dec 26 02:08:27 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SzdV36QqWz55Kk2; Tue, 26 Dec 2023 02:08: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SzdV33h3tz4SZJ; Tue, 26 Dec 2023 02:08:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703556507; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PZxE3hHXceQcww2XbULnn2nxfHYicvw4HJd7xHh77+Y=; b=cKXkwoTi80OXDcmxdaUDI1InNSSJABwl+y2gizJPfNiqHXFboG08o84t9VwlHtqL0z8B9A CKO6MJnThy4Ri90eXNpWgJN/CYxcpGXQ2YleWmW7Liy7NfX+TGL61P4vdMdQD2HghM7WhQ Pt4sVj6pJqqTdSRyk/Bd2LDVgLWJ/1zYnnxGWNakcD4X+4orYIPslFvMq6XQJzLVnY4N0n CPTpw2ge1DLduLVdmCks7eOau+FshZNixPiYf44Sr7BgWOzHwzJDJW3BBmhc8sQPRjP5qU JHRXmKiMJYBjPwu+sjmrCU8MXmeoYWt/Dsy8xKqxWW/+2dD+BF1RfPw7FUEOdg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703556507; a=rsa-sha256; cv=none; b=bP9ZqL96RYZNq+aRm6GEl8AjkAduK3xFRXhk6qoWeldZ/ljrLvYVDKU+rN4qxkkZSI/ZSz e36bLxP87+vJA6xagnAbdpmRUgIhc45wSjKfM3ce9bWyIABu80+iK9j31br+6styuVKsjx OO0ZuTw1ASrRacFmB6GJ8tJZ7JH2SYE1QlmsNnv0lwA2MKNnY+aj8lMznbyAT9vnGKEkZz FmbUU7EGoaW4ZXsEdoEo1Uc1/Mbu8YkomcvmvE4aHPJlcXKqFkwTrbAWpTcduJLNlZ0Eau TRBg0Hh2o/2rMCWhqQf45tT/dPbJCj+uZV75JBEMlTMwkgD4s2pClWp6ZTi2pw== 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=1703556507; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PZxE3hHXceQcww2XbULnn2nxfHYicvw4HJd7xHh77+Y=; b=rnLthHgnc1aLEZE+l7cgNWrNN6XOME6Z1OEf4nUWMkK4w4Zv8G+Xvyuns7cp76js+TC8g8 SOqnzLHzeqf2NeckDRBniirpgKmE8l0mjsNmbG1iNnyD2XW/EEHDePLPBv3ZKsFLWpONAd DHWQZrndZJeIvnnw0Rv5S5GaHm/xz0BA1Irsh2TgALBPc7R2WJHCnCxwyRI+3W1L1EAYww 2IYKX0YrncFInxZN+jMh3c5eLRjG+ah/wyOO0+Uc+0Kt6Ecci+cFk2xZT40NBDS4rupwLc Z79hduRO8EQJQOQ27tILEjoBTPvBXB5n9zsZPB0DEdXLlKwXbwTa/J7A2pleCg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SzdV32l4czbWd; Tue, 26 Dec 2023 02:08:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BQ28Rxs004765; Tue, 26 Dec 2023 02:08:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BQ28RsH004762; Tue, 26 Dec 2023 02:08:27 GMT (envelope-from git) Date: Tue, 26 Dec 2023 02:08:27 GMT Message-Id: <202312260208.3BQ28RsH004762@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: dcd747fda58a - stable/14 - nvme: Initialize HMB entries before loading them into the controller List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: dcd747fda58a4669c897822b10d4a53b802c4bb2 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=dcd747fda58a4669c897822b10d4a53b802c4bb2 commit dcd747fda58a4669c897822b10d4a53b802c4bb2 Author: Mark Johnston AuthorDate: 2023-12-18 22:45:24 +0000 Commit: Mark Johnston CommitDate: 2023-12-25 16:58:19 +0000 nvme: Initialize HMB entries before loading them into the controller struct nvme_hmb_desc contains a pad field which was not getting initialized before being synced. This doesn't have much consequence but triggers a report from KMSAN, which verifies that host-filled DMA memory is initialized before it is made visible to the device. So, let's just initialize it properly. Reported by: KMSAN Reviewed by: mav, imp MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D43090 (cherry picked from commit d9b7301bb791faab48b6c7733c34078427b9a374) --- sys/dev/nvme/nvme_ctrlr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 3eca24f1f6a5..5a57bbbd53af 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1037,6 +1037,8 @@ again: } for (i = 0; i < ctrlr->hmb_nchunks; i++) { + memset(&ctrlr->hmb_desc_vaddr[i], 0, + sizeof(struct nvme_hmb_desc)); ctrlr->hmb_desc_vaddr[i].addr = htole64(ctrlr->hmb_chunks[i].hmbc_paddr); ctrlr->hmb_desc_vaddr[i].size = htole32(ctrlr->hmb_chunk / ctrlr->page_size); From nobody Tue Dec 26 02:08:28 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SzdV50rtDz55Kk4; Tue, 26 Dec 2023 02:08: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SzdV44Q5Lz4SXD; Tue, 26 Dec 2023 02:08:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703556508; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=a14LRGT3fwVo+399ZtxpcUx9K1rP04P+qzrT+e1maUw=; b=weW0zC4APAdee5ktGB1DvDwJOYhtJUHinwS8rlpXV366dNcNk/aT1ia1f0oKwfs36OOjH8 3OuxOnGcqPi0Yz2kXOvVJsgsSn88AwVByXkBiLUI+s9xhKh8Uszfo4l/ztLOWHZz4vTnGJ OrN34HLTyIYLSsNyBlG6i2Nb7BNAVZUxBmBYYz3Gs0ygFLh0dWWTidzBtLxSN73ldJVGKp Gel4bbn9CBCSfBC0BYEtRMzlnamDHHQcsZxIplrgrIbosWi/jnWAsWQFOmmg/jgEcPSJVk Icutgc0weCfA326n6vX99LE2xj2yaqn9Fmr1NuJjWxjLsSzSj96h5gPs1pKY8g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703556508; a=rsa-sha256; cv=none; b=bknf/ecM3JtwyNuxHCSxZ77dZ6UA3cfPDiwQrB2XevJYuM7WknurtDHHIwQ6BriapuIhor xrgtJxNvHgyQ7GL/k+GmPbYy+nyUQ/7ixyr1ZHvfvCpzbv/r4ExZ6QtCRk1HQ0EcJS+xLK wfxSn2K2kibSbv1yoj9ecWPtF0SRHoocRu4C60e+mbJ+6r3GhZg+m+cgBvCyPOHS3248me THm7GSWUpb7A4dzA2Kte42zipHeUSGLrvku7F5bgYHgNaYAGvJxZfB8cKWVsiobqmnduzK buVe5r3mhM72VotWZIrZiMqlv/1s15epVWmnizJpl14smfRP0Tn7Ptl2qfzJjw== 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=1703556508; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=a14LRGT3fwVo+399ZtxpcUx9K1rP04P+qzrT+e1maUw=; b=HJoee7Eb0IRKLyj+tCcEpcrM82/PAtRlLpBImVBgI3Y5Y+F5jWnCxG/QD3X2pwJynfl1uI 4LLiiQQ1JQWJXi92NYcSh5dA2bAJ+vwZGlbKJkP45DvF1g1BqhWNLImJkJxULq8yh3bOA9 aWuflY4v0uMrVGkfqnRehqVwq42QiE6yd5DCU8uaPU3xDrQqROBpZ1n8lSYvwr4ZD//6AN WJTnmD2+7qZfHmo//m5WtFUQKNU9Xj85V9hJpO5YSgoUtsAOHynfuFQECUxFKHCFlTv57g aKlq5wEvrzpQ+AfcRKTRaRisCh09sUS1PlKxylVaVuJBpgW73RR2MOli+o8AMQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SzdV43SgLzbx6; Tue, 26 Dec 2023 02:08:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BQ28SRg004812; Tue, 26 Dec 2023 02:08:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BQ28S0m004809; Tue, 26 Dec 2023 02:08:28 GMT (envelope-from git) Date: Tue, 26 Dec 2023 02:08:28 GMT Message-Id: <202312260208.3BQ28S0m004809@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 3c77aabc7396 - stable/14 - kqueue.9: Update the description of knlist_clear() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 3c77aabc739659a09c01368c362a5f8073ab9bf9 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3c77aabc739659a09c01368c362a5f8073ab9bf9 commit 3c77aabc739659a09c01368c362a5f8073ab9bf9 Author: Mark Johnston AuthorDate: 2023-12-12 14:35:48 +0000 Commit: Mark Johnston CommitDate: 2023-12-25 16:58:27 +0000 kqueue.9: Update the description of knlist_clear() knlist_clear() does not free knotes and so does not call fdrop(), so remove the bit of the function description which claims otherwise. (The knote will be dropped by the next queue scan, and it is at that point that the fd reference will be dropped.) MFC after: 1 week (cherry picked from commit 604de40a024c760df5db542171d3953493f56bfb) --- share/man/man9/kqueue.9 | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/share/man/man9/kqueue.9 b/share/man/man9/kqueue.9 index 28a948481e3e..2f08d369191c 100644 --- a/share/man/man9/kqueue.9 +++ b/share/man/man9/kqueue.9 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd August 20, 2022 +.Dd December 18, 2023 .Dt KQUEUE 9 .Os .Sh NAME @@ -333,16 +333,6 @@ The function will be called when the .Vt knote is deleted during the next scan. -This function must not be used when -.Va f_isfd -is set in -.Vt "struct filterops" , -as the -.Fa td -argument of -.Fn fdrop -will be -.Dv NULL . .Pp The function .Fn knlist_delete From nobody Tue Dec 26 02:08:29 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SzdV56llnz55Kk8; Tue, 26 Dec 2023 02:08: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SzdV55jhnz4SdH; Tue, 26 Dec 2023 02:08:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703556509; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hK6JiBvTSB/55lULFHhwlMBf7QE6hK8QKWP8gA7Lle0=; b=H+IRcxVc3XprjJ1XFg+Ggif5P7VO4v6S6D7FC/60dAArwNhikh5zLNGQFuD8YAV8vJ5D8g Ko/611C+G0hSxFqtM9W9Y5sdfef+52yERSRMxs59A4mPSPBJQ6SKmahSLS2YiAd2Xz/IB+ M/P9j0R8Dcc9uHHj6cmgAxRFFiwpm4HYUw8Z5r4DWOWdPprcd8qqUV1atTtHmG6xAg3z32 fhTcbJij+ODjvUJSqigIDa5sGsJp46zodF/wAey0uNUS51mJICGhEP90IaoSmCkzGAhoDo 2pSDCRyEKrJOePelp7x35hQG659e4j3G4GZnaFVLVAUggm5LvtzdInK6JF63uw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703556509; a=rsa-sha256; cv=none; b=bHIHvVpPpjVhlbe5nzsmdfB/3GOZyXgwIPmWlWlDDvMM1EcR4qpWBZwghXameEHI7OS4cI yhQG5T5OjO4h5+sXRaGCAZdEzmnehAXtpSQglFzlgoApPm/9pwTdlDw05ae4ihHgnR49wr tt/A9pyEVkn2qSpHJCQVOX1AH9rBk2r07LB/qxNrHIoQGxkO73BUrG6hfoZrmE/r6csOb5 XmJmDjm9XuQLp9/oFp/HYA7ze0fn4EFAQyF2iIjuuRNUF8UUFZY1MvV4wirJjimD0NREhE fUOsjc2PPWIuYSUyOmaU6qjH/rNj+U5nBpuf5f32DydpZ7oAuH+TH4iH+pT6Ww== 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=1703556509; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hK6JiBvTSB/55lULFHhwlMBf7QE6hK8QKWP8gA7Lle0=; b=hny5u04/ZMbsmzvT5wIi8koHqTS4ObeiWLw/eAA6QzTXzsjUBLj+6nn0o95/0MLPFfhuU6 xeqG3AddtHNum1MKi+KMuczf4ZQ2GDGBrZmJDefH/g7y7uxlVyZPI12YcHuAxyyVLDbDuc 8bjCp733uy2eIEAmmGsbuz8czyulp5kVT1SxY+TExFNh7uH0bpsrkTTNz3I1uFg+3LgGwQ JvaiEC+BZrsK9YoJS42ebpp6b6BmBg56yZ7unJ0cg6sBqPDfq1FOUEmjEb0ZYlv/YLo4Ik DmmOqjd3hSo1Ilhlsi4HeuQfJ1OTuYcyJA4CaWti6USekEDqdCBGKaAx2UPRbA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SzdV54c4yzbx7; Tue, 26 Dec 2023 02:08:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BQ28TRd004871; Tue, 26 Dec 2023 02:08:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BQ28Tt7004868; Tue, 26 Dec 2023 02:08:29 GMT (envelope-from git) Date: Tue, 26 Dec 2023 02:08:29 GMT Message-Id: <202312260208.3BQ28Tt7004868@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 70025e767f28 - stable/14 - ieee80211: Check for copyout() errors in the SIOCG80211STATS handler List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 70025e767f28aa51b3010eed4ada897e391a5237 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=70025e767f28aa51b3010eed4ada897e391a5237 commit 70025e767f28aa51b3010eed4ada897e391a5237 Author: Mark Johnston AuthorDate: 2023-12-19 03:44:54 +0000 Commit: Mark Johnston CommitDate: 2023-12-26 02:08:06 +0000 ieee80211: Check for copyout() errors in the SIOCG80211STATS handler In preparation for annotating copyin() and related functions with __result_use_check. Reviewed by: bz, emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43095 (cherry picked from commit d760d74dbed81638979e662130e24111b3a5db0d) --- sys/net80211/ieee80211_ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c index 170cdc416276..d5b242b679d0 100644 --- a/sys/net80211/ieee80211_ioctl.c +++ b/sys/net80211/ieee80211_ioctl.c @@ -3636,8 +3636,8 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; case SIOCG80211STATS: ifr = (struct ifreq *)data; - copyout(&vap->iv_stats, ifr_data_get_ptr(ifr), - sizeof (vap->iv_stats)); + error = copyout(&vap->iv_stats, ifr_data_get_ptr(ifr), + sizeof(vap->iv_stats)); break; case SIOCSIFMTU: ifr = (struct ifreq *)data; From nobody Tue Dec 26 23:30:31 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T09xM4SX5z54XS4; Tue, 26 Dec 2023 23:30: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T09xM3qNRz4Dsn; Tue, 26 Dec 2023 23:30:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703633431; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wUTBS8LbW0++kU+myqsuI+5I3KGfJVMS+XgB/5TVEKQ=; b=B0v5Xm/ZvWGNBOtJEKgffYokTwwfoka1yE3NLAz/flcWWa+Nrjat2acbvYgIkA/Oj37ena 03MA+j1tGMVbw1y9sbZOh/gr6XOOvUcWKkOuNR5i6MaOdfiNiOYw3PX0GBI4BwU4TB1DtL nuDpMk/JoZEgSSZOyHfoLERn+4PPOpVe0H18XOIMbdmoJjqeIShNsoPWeQ5Mgfeiv1mUgp Afhmsycqc2pHgGhs9WBmK62QVouzN4vy8dujCpzLeGBGExsIwH7NzwpQ6DUJrvVTbKzy5O BPxVPy1Zf5NKWaVK/8NVz/pT/+G0fuYkqeWOG8IyTdXemrxi4yDjkLtYhF3z+w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703633431; a=rsa-sha256; cv=none; b=XI6kdLwVkRxyVlLoRG4KdDGMunrc4e+d6NamkdcmVy33/qjn4KK0MxAxkMZUtfxvxC7/Or 1cKI2FumgITyzuyYydgZvMV9lDsV1pyO0JSw2kBFKlyeDFpp23HvPqzlKc97rhph/vVrzm /z45eiS5xbsTCUT2nfYXabvGabiYuT+jDooixV6ivRw2wzivKO+dtHwr5HRtjaJ2Kt5aFs G0rWuH1Ygz1yPcTUzaUVJnnleGrVZas6CJgNlfuzZigPwPqM6hPCNx+sRjkGgRzqM2pjL7 szT1kE/hz51rnoC+lcMyXEHcwG0Uqt8VRjot22L/+P/M0ieFnUnfAya6r+u5NQ== 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=1703633431; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wUTBS8LbW0++kU+myqsuI+5I3KGfJVMS+XgB/5TVEKQ=; b=PUPGLkxELvsOeorlJV8T+i3Pr+Q7pHfT+CQJ07d1vmco+UyuPHlSaOBAdDuI2gJIiUgpOp uIVPgLBNdU7jeqSm4gU/xAJ4Igpr0S5vs5O2Hzwv+ErCq87JtWTasagDftyT361jZWVuTj eGCxHc+K9Id0fCRZ6GtfrHPF4vcedsiKkJhu4QUinID2amrrFLkJ0eGnOzrxpLlMJ2jv3t BGhrTISE1wgJvImiz7rf8mIOUT9AKCoUk9r4vnuPV5BvRKihPWDwT7YNUNdEOT0ERlLm61 UzSQBeYxH+pc/bA7n/FKlE4OU+IW88BDKvkqcBQbg5DjQwN89y53dJ1Wxl5jlw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T09xM2l7Lz12C; Tue, 26 Dec 2023 23:30:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BQNUVMI060057; Tue, 26 Dec 2023 23:30:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BQNUVPW060054; Tue, 26 Dec 2023 23:30:31 GMT (envelope-from git) Date: Tue, 26 Dec 2023 23:30:31 GMT Message-Id: <202312262330.3BQNUVPW060054@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: cce1cbbef71b - stable/14 - RELNOTES: Add an entry for commit b8e137d8d32d List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: cce1cbbef71b9f095c802adf0dc11afabfe73f1c Auto-Submitted: auto-generated The branch stable/14 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=cce1cbbef71b9f095c802adf0dc11afabfe73f1c commit cce1cbbef71b9f095c802adf0dc11afabfe73f1c Author: Rick Macklem AuthorDate: 2023-12-26 23:29:11 +0000 Commit: Rick Macklem CommitDate: 2023-12-26 23:29:11 +0000 RELNOTES: Add an entry for commit b8e137d8d32d --- RELNOTES | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/RELNOTES b/RELNOTES index c5686a4f30fb..3a3edc500152 100644 --- a/RELNOTES +++ b/RELNOTES @@ -10,6 +10,11 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +b8e137d8d32d: + This commit added some statistics collection to the NFS-over-TLS + code in the NFS server so that sysadmins can moditor usage. + The statistics are available via the kern.rpc.tls.* sysctls. + 41582f28ddf7: FreeBSD 15.0 will not include support for 32-bit platforms. However, 64-bit systems will still be able to run older 32-bit From nobody Wed Dec 27 00:24:34 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T0C7k5spXz54dDJ; Wed, 27 Dec 2023 00:24: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T0C7k5Mvtz4MHR; Wed, 27 Dec 2023 00:24:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703636674; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=X/k6PYyDopA79lzdgQwR9UmbbWOGS72sIsuFIMUlWlc=; b=NpjpU96cg2h7ITJlktxW39/6BV9xCP3rOX5GtE97JbcpCHki34lZJ822WEX7ZIJFINLRSV lw07qzMW/+EW7i4q6F/+ET400T/hWVNhVvuK31dLkB65vB2OyshmxLQaAUyZggV5ya+jlK LFNwGst7jhL2WA4PUAOophtQZdeVIhKIjzBVHnewrZx1CXLJn10u46iBaL0kTTK6TViV0L GTchnIR+bdmtwR6ehpK20ClhCRQt/X+DvbLI6+k9cN2P8v2NUoKllD5ee3di/cxr8pPIPs 8iv+mJq/4thlpiTPwscPtDS2ARZz5Xeyg/3XMjfF9DMMvWB1o2XYoebaqYVtBQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703636674; a=rsa-sha256; cv=none; b=HfN8eFDQ9ZX7Dq2ezPy1tpls4+tl1Ci8ml88XUdVDu7uToLAVqTLvAoKSO/xcHtw2nrElf uGIy/j5Dm4KaJeuFVoILIpZ71mcUe314k44JUAeYODJ58yoeI8DHKmSLZqEPxwK2xE3Pvo neYaebRqU5siU+iJoobcZ765/3+NJfpARRvQRaMB0BuXSkzgF8vqF0s4ghug3QNz6VRHAZ FBmnkBYWE7Xq9H3s9s629alStfvsSZW50FGBd8vEi8+L5bCh2PNk/MxWAgSF6ueu/62HRW WJUjE5b4Dndx7VK284Ecccd/BQUeAMzbdFt/vvJ+PYXsY9UAG9w1y+vqZSaf8g== 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=1703636674; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=X/k6PYyDopA79lzdgQwR9UmbbWOGS72sIsuFIMUlWlc=; b=Y3X9ocVKnDKtOjZW3y+HxHi6fMs8lzjlVYqwVZdqhNbWS0Oq/cnY3tJP9kuPdzhdn07OON F0+4DNB/8XYTQIB5tFWLBUaFEsXaqVM3BqqFyNNr1rvAzj8JfFRivvoSZ1K8+8zsc0WsUb curzLTf+HOkseD17Iz6H9jumjk4scMhGK4MURTwe5PulEselPKdNForKrOF8Y9Mjvhng7s NeCLwl9FbnweC7XcYQelLI3GilWLT+RXRbeT71r76eVannqzTypvUTTatIhjyilAUFaJFl Kw+yPpxaX3Xr94yD4N7GO/30UfgFVxOR/cANjLYmybiVi15C58Eg1BMOuAmJEA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T0C7k4QNKz2Pc; Wed, 27 Dec 2023 00:24:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BR0OY7x052619; Wed, 27 Dec 2023 00:24:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BR0OYqR052616; Wed, 27 Dec 2023 00:24:34 GMT (envelope-from git) Date: Wed, 27 Dec 2023 00:24:34 GMT Message-Id: <202312270024.3BR0OYqR052616@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: fd51a2e34282 - stable/14 - qat: Update firmware for 4xxx devices to version 1.1.20 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: fd51a2e34282f98a25f3584f16df1acc97ca007b Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fd51a2e34282f98a25f3584f16df1acc97ca007b commit fd51a2e34282f98a25f3584f16df1acc97ca007b Author: Michal Gulbicki AuthorDate: 2023-11-20 15:25:57 +0000 Commit: Mark Johnston CommitDate: 2023-12-27 00:24:12 +0000 qat: Update firmware for 4xxx devices to version 1.1.20 Key features: - added zeropadding feature for compression - added partial decompression support - added DC rate limiting support - added Admin ME capabilities reporting - added Hash+Compress chaining support MFC after: 2 weeks Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D42864 (cherry picked from commit 5437c3b6adade1d72971fa214ead90a0296c79f3) --- sys/contrib/dev/qat/qat_4xxx.bin | Bin 665356 -> 665356 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/sys/contrib/dev/qat/qat_4xxx.bin b/sys/contrib/dev/qat/qat_4xxx.bin index 66dd803fe419..23eb8077241a 100644 Binary files a/sys/contrib/dev/qat/qat_4xxx.bin and b/sys/contrib/dev/qat/qat_4xxx.bin differ From nobody Wed Dec 27 12:21:57 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T0W3T1ryNz55XCN; Wed, 27 Dec 2023 12:21:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T0W3T1gyFz4QhS; Wed, 27 Dec 2023 12:21:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703679717; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bDm1Cv04oySqwN4ET1nisZX0TiJzIf4j0fs3/iVZwBc=; b=Iut+xU4pS+GQR01aOmpb5kjQCsHCgxGgPEZSFEdJ3mylCaZT2sdY9iZp2lg0rlGf8gyFF3 OQffz7K8kTQGLwl4jylO9TGwgtqJGR1ZfRC5w63Ya4aVOYBwRDUz02Zub8le8x1W3JUUPB E/mqxwdV08V4fwQ/JYxYCj4VCtThhn3+wYnqfKT2wwxkQ8WH+U2yFAd8h7JOQFIcvO5fkk kYBBhM0OqMlYZEq1KLAw2r/neNSbhZkVj2Kn5cc2t+vVQoBjmGAaZkcsJFZvSIV2pK+Qw2 HhhtCVZRiuNg9T7ykyrgoOFu9j0DT2GgTawajlrnnKgs77x57d6T11Y8RisX9A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703679717; a=rsa-sha256; cv=none; b=ShGi4h35PVgLTL4hIXGs8bZwItells2LuFcsc/Tx0SipFFTHAGhxX41Qt/pSY9Y++VMWLP /TlX9tIQ4w1JfIgSq+B18V/IGLpXNdjasSMkz5Cia94uGimqGuVE4IYZhfVjnt7Q3lWljl YBrpNlLi+Kypve6Tufl0ZebyXWga6EmONQXEAja13BdxBkj8mW/j//uoUi2C1fLVPy1/d+ RmG4UP16qBtD2gEOSG8v2AQCT7ZQu/WccgSbe0gzXJtUv6E+aHay3UNMiKnHSTIFr/wBZg NWwCJzSGaXwBtbTSHKDHG6xFWds4XC0HJV3r0hTW2hkgRsVzt8KwDHewZc5DYA== 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=1703679717; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bDm1Cv04oySqwN4ET1nisZX0TiJzIf4j0fs3/iVZwBc=; b=irsqjycZ02SDuhmiTwo0yWfse54uAAKLnoLyhiI+KoUzbHxzwK4o7rk+VkVbfWvEkd9F4n zhmmDJjIpuppKfLfYBDAK5TRtfghFQgWO2RIpAIlppWrrszqN7Kjt4v9Bh41VbfKSOUhuk yIL2xFTMXpGYiDeFwL4F51CrUn7N+wPHCi7mtmLUXWcXhb31XCu8/n37EuT/S1ujsaowK+ QVmaeiIizV06nxy1RK7oXc2KMhPZI4g/LxFb4Z4rHQ+cEuTeeyw3UUv6ELplyFZH2L5cgC uVb4sKv+NiufbLse1w14ZtuS+UpBdX6liscCoJX8jWNrwMVahVRaT3L0UoK4jQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T0W3T0kNMzdZR; Wed, 27 Dec 2023 12:21:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BRCLvBR060019; Wed, 27 Dec 2023 12:21:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BRCLvOi060015; Wed, 27 Dec 2023 12:21:57 GMT (envelope-from git) Date: Wed, 27 Dec 2023 12:21:57 GMT Message-Id: <202312271221.3BRCLvOi060015@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ram Kishore Vegesna Subject: git: b70cf00842c8 - stable/14 - ocs_fc: IO timeout handling and error reporting fix. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ram X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b70cf00842c87a8440da9ba9ffc331dd3890eba4 Auto-Submitted: auto-generated The branch stable/14 has been updated by ram: URL: https://cgit.FreeBSD.org/src/commit/?id=b70cf00842c87a8440da9ba9ffc331dd3890eba4 commit b70cf00842c87a8440da9ba9ffc331dd3890eba4 Author: Ram Kishore Vegesna AuthorDate: 2023-12-12 15:22:58 +0000 Commit: Ram Kishore Vegesna CommitDate: 2023-12-27 12:16:08 +0000 ocs_fc: IO timeout handling and error reporting fix. Hardware timeout uses a 8-bit timeout value and expects the timeout to be less than 255 seconds. Added software timer implemetation to timeout and abort the IOs with timeout more than 255 seconds. Fix the timeout problem by dividing CAM timeouts by 1000 as hardware expects timeout value in seconds. Before this change, CAM timeouts in milliseconds were getting truncated to 8 bits and converted to seconds. So the actual timeout used when going down to the card would depend on the bottom 8 bits of the timeout used. Add the mapping of ocs_fc error status to CAM status. Reported by: ken Reviewed by: ken Tested by: ken, ram Approved by: ken MFC after: 1 week (cherry picked from commit 70547544ce931357c980be47d937e5b57a2d7f49) --- sys/dev/ocs_fc/ocs_cam.c | 87 ++++++++++++++++++++++++++++++++++++++++++++-- sys/dev/ocs_fc/ocs_hw.c | 70 +++++++++++++++++++++++-------------- sys/dev/ocs_fc/ocs_hw.h | 10 +++--- sys/dev/ocs_fc/ocs_scsi.c | 6 +++- sys/dev/ocs_fc/ocs_xport.c | 8 +++-- sys/dev/ocs_fc/sli4.h | 2 +- 6 files changed, 144 insertions(+), 39 deletions(-) diff --git a/sys/dev/ocs_fc/ocs_cam.c b/sys/dev/ocs_fc/ocs_cam.c index 4da1b6669047..0fa94083e898 100644 --- a/sys/dev/ocs_fc/ocs_cam.c +++ b/sys/dev/ocs_fc/ocs_cam.c @@ -44,6 +44,7 @@ #include "ocs.h" #include "ocs_scsi.h" #include "ocs_device.h" +#include /* Default IO timeout value for initiators is 30 seconds */ #define OCS_CAM_IO_TIMEOUT 30 @@ -55,6 +56,27 @@ typedef struct { int32_t rc; } ocs_dmamap_load_arg_t; +struct ocs_scsi_status_desc { + ocs_scsi_io_status_e status; + const char *desc; +} ocs_status_desc[] = { + { OCS_SCSI_STATUS_GOOD, "Good" }, + { OCS_SCSI_STATUS_ABORTED, "Aborted" }, + { OCS_SCSI_STATUS_ERROR, "Error" }, + { OCS_SCSI_STATUS_DIF_GUARD_ERROR, "DIF Guard Error" }, + { OCS_SCSI_STATUS_DIF_REF_TAG_ERROR, "DIF REF Tag Error" }, + { OCS_SCSI_STATUS_DIF_APP_TAG_ERROR, "DIF App Tag Error" }, + { OCS_SCSI_STATUS_DIF_UNKNOWN_ERROR, "DIF Unknown Error" }, + { OCS_SCSI_STATUS_PROTOCOL_CRC_ERROR, "Proto CRC Error" }, + { OCS_SCSI_STATUS_NO_IO, "No IO" }, + { OCS_SCSI_STATUS_ABORT_IN_PROGRESS, "Abort in Progress" }, + { OCS_SCSI_STATUS_CHECK_RESPONSE, "Check Response" }, + { OCS_SCSI_STATUS_COMMAND_TIMEOUT, "Command Timeout" }, + { OCS_SCSI_STATUS_TIMEDOUT_AND_ABORTED, "Timed out and Aborted" }, + { OCS_SCSI_STATUS_SHUTDOWN, "Shutdown" }, + { OCS_SCSI_STATUS_NEXUS_LOST, "Nexus Lost" } +}; + static void ocs_action(struct cam_sim *, union ccb *); static void ocs_poll(struct cam_sim *); @@ -1497,7 +1519,7 @@ static int32_t ocs_scsi_initiator_io_cb(ocs_io_t *io, * If we've already got a SCSI error, prefer that because it * will have more detail. */ - if ((rsp->residual < 0) && (ccb_status == CAM_REQ_CMP)) { + if ((rsp->residual < 0) && (ccb_status == CAM_REQ_CMP)) { ccb_status = CAM_DATA_RUN_ERR; } @@ -1517,7 +1539,62 @@ static int32_t ocs_scsi_initiator_io_cb(ocs_io_t *io, ocs_memcpy(&csio->sense_data, rsp->sense_data, sense_len); } } else if (scsi_status != OCS_SCSI_STATUS_GOOD) { - ccb_status = CAM_REQ_CMP_ERR; + const char *err_desc = NULL; + char path_str[64]; + char err_str[224]; + struct sbuf sb; + size_t i; + + sbuf_new(&sb, err_str, sizeof(err_str), 0); + + xpt_path_string(ccb->ccb_h.path, path_str, sizeof(path_str)); + sbuf_cat(&sb, path_str); + + for (i = 0; i < (sizeof(ocs_status_desc) / + sizeof(ocs_status_desc[0])); i++) { + if (scsi_status == ocs_status_desc[i].status) { + err_desc = ocs_status_desc[i].desc; + break; + } + } + if (ccb->ccb_h.func_code == XPT_SCSI_IO) { + scsi_command_string(&ccb->csio, &sb); + sbuf_printf(&sb, "length %d ", ccb->csio.dxfer_len); + } + sbuf_printf(&sb, "error status %d (%s)\n", scsi_status, + (err_desc != NULL) ? err_desc : "Unknown"); + sbuf_finish(&sb); + printf("%s", sbuf_data(&sb)); + + switch (scsi_status) { + case OCS_SCSI_STATUS_ABORTED: + case OCS_SCSI_STATUS_ABORT_IN_PROGRESS: + ccb_status = CAM_REQ_ABORTED; + break; + case OCS_SCSI_STATUS_DIF_GUARD_ERROR: + case OCS_SCSI_STATUS_DIF_REF_TAG_ERROR: + case OCS_SCSI_STATUS_DIF_APP_TAG_ERROR: + case OCS_SCSI_STATUS_DIF_UNKNOWN_ERROR: + case OCS_SCSI_STATUS_PROTOCOL_CRC_ERROR: + ccb_status = CAM_IDE; + break; + case OCS_SCSI_STATUS_ERROR: + case OCS_SCSI_STATUS_NO_IO: + ccb_status = CAM_REQ_CMP_ERR; + break; + case OCS_SCSI_STATUS_COMMAND_TIMEOUT: + case OCS_SCSI_STATUS_TIMEDOUT_AND_ABORTED: + ccb_status = CAM_CMD_TIMEOUT; + break; + case OCS_SCSI_STATUS_SHUTDOWN: + case OCS_SCSI_STATUS_NEXUS_LOST: + ccb_status = CAM_SCSI_IT_NEXUS_LOST; + break; + default: + ccb_status = CAM_REQ_CMP_ERR; + break; + } + } else { ccb_status = CAM_REQ_CMP; } @@ -1842,7 +1919,11 @@ ocs_initiator_io(struct ocs_softc *ocs, union ccb *ccb) } else if (ccb->ccb_h.timeout == CAM_TIME_DEFAULT) { io->timeout = OCS_CAM_IO_TIMEOUT; } else { - io->timeout = ccb->ccb_h.timeout; + if (ccb->ccb_h.timeout < 1000) + io->timeout = 1; + else { + io->timeout = ccb->ccb_h.timeout / 1000; + } } switch (csio->tag_action) { diff --git a/sys/dev/ocs_fc/ocs_hw.c b/sys/dev/ocs_fc/ocs_hw.c index 097228d12bfb..186b04b8b129 100644 --- a/sys/dev/ocs_fc/ocs_hw.c +++ b/sys/dev/ocs_fc/ocs_hw.c @@ -148,17 +148,29 @@ static void ocs_hw_check_sec_hio_list(ocs_hw_t *hw); static void target_wqe_timer_cb(void *arg); static void shutdown_target_wqe_timer(ocs_hw_t *hw); +/* WQE timeout for initiator IOs */ +static inline uint8_t +ocs_hw_set_io_wqe_timeout(ocs_hw_io_t *io, uint32_t timeout) +{ + if (timeout > 255) { + io->wqe_timeout = timeout; + return 0; + } else { + return timeout; + } +} + static inline void ocs_hw_add_io_timed_wqe(ocs_hw_t *hw, ocs_hw_io_t *io) { - if (hw->config.emulate_tgt_wqe_timeout && io->tgt_wqe_timeout) { + if (hw->config.emulate_wqe_timeout && io->wqe_timeout) { /* * Active WQE list currently only used for * target WQE timeouts. */ ocs_lock(&hw->io_lock); ocs_list_add_tail(&hw->io_timed_wqe, io); - io->submit_ticks = ocs_get_os_ticks(); + getmicrouptime(&io->submit_time); ocs_unlock(&hw->io_lock); } } @@ -166,7 +178,7 @@ ocs_hw_add_io_timed_wqe(ocs_hw_t *hw, ocs_hw_io_t *io) static inline void ocs_hw_remove_io_timed_wqe(ocs_hw_t *hw, ocs_hw_io_t *io) { - if (hw->config.emulate_tgt_wqe_timeout) { + if (hw->config.emulate_wqe_timeout) { /* * If target wqe timeouts are enabled, * remove from active wqe list. @@ -965,7 +977,7 @@ ocs_hw_init(ocs_hw_t *hw) } /* finally kick off periodic timer to check for timed out target WQEs */ - if (hw->config.emulate_tgt_wqe_timeout) { + if (hw->config.emulate_wqe_timeout) { ocs_setup_timer(hw->os, &hw->wqe_timer, target_wqe_timer_cb, hw, OCS_HW_WQ_TIMER_PERIOD_MS); } @@ -1695,8 +1707,8 @@ ocs_hw_get(ocs_hw_t *hw, ocs_hw_property_e prop, uint32_t *value) case OCS_HW_EMULATE_I_ONLY_AAB: *value = hw->config.i_only_aab; break; - case OCS_HW_EMULATE_TARGET_WQE_TIMEOUT: - *value = hw->config.emulate_tgt_wqe_timeout; + case OCS_HW_EMULATE_WQE_TIMEOUT: + *value = hw->config.emulate_wqe_timeout; break; case OCS_HW_VPD_LEN: *value = sli_get_vpd_len(&hw->sli); @@ -1996,8 +2008,8 @@ ocs_hw_set(ocs_hw_t *hw, ocs_hw_property_e prop, uint32_t value) case OCS_HW_EMULATE_I_ONLY_AAB: hw->config.i_only_aab = value; break; - case OCS_HW_EMULATE_TARGET_WQE_TIMEOUT: - hw->config.emulate_tgt_wqe_timeout = value; + case OCS_HW_EMULATE_WQE_TIMEOUT: + hw->config.emulate_wqe_timeout = value; break; case OCS_HW_BOUNCE: hw->config.bounce = value; @@ -3324,7 +3336,7 @@ ocs_hw_init_free_io(ocs_hw_io_t *io) io->type = 0xFFFF; io->wq = NULL; io->ul_io = NULL; - io->tgt_wqe_timeout = 0; + io->wqe_timeout = 0; } /** @@ -3738,7 +3750,7 @@ ocs_hw_check_sec_hio_list(ocs_hw_t *hw) flags &= ~SLI4_IO_CONTINUATION; } - io->tgt_wqe_timeout = io->sec_iparam.fcp_tgt.timeout; + io->wqe_timeout = io->sec_iparam.fcp_tgt.timeout; /* Complete (continue) TRECV IO */ if (io->xbusy) { @@ -4041,6 +4053,7 @@ ocs_hw_io_send(ocs_hw_t *hw, ocs_hw_io_type_e type, ocs_hw_io_t *io, ocs_hw_rtn_e rc = OCS_HW_RTN_SUCCESS; uint32_t rpi; uint8_t send_wqe = TRUE; + uint8_t timeout = 0; CPUTRACE(""); @@ -4075,6 +4088,8 @@ ocs_hw_io_send(ocs_hw_t *hw, ocs_hw_io_type_e type, ocs_hw_io_t *io, */ switch (type) { case OCS_HW_IO_INITIATOR_READ: + timeout = ocs_hw_set_io_wqe_timeout(io, iparam->fcp_ini.timeout); + /* * If use_dif_quarantine workaround is in effect, and dif_separates then mark the * initiator read IO for quarantine @@ -4090,12 +4105,14 @@ ocs_hw_io_send(ocs_hw_t *hw, ocs_hw_io_type_e type, ocs_hw_io_t *io, if (sli_fcp_iread64_wqe(&hw->sli, io->wqe.wqebuf, hw->sli.config.wqe_size, &io->def_sgl, io->first_data_sge, len, io->indicator, io->reqtag, SLI4_CQ_DEFAULT, rpi, rnode, iparam->fcp_ini.dif_oper, iparam->fcp_ini.blk_size, - iparam->fcp_ini.timeout)) { + timeout)) { ocs_log_err(hw->os, "IREAD WQE error\n"); rc = OCS_HW_RTN_ERROR; } break; case OCS_HW_IO_INITIATOR_WRITE: + timeout = ocs_hw_set_io_wqe_timeout(io, iparam->fcp_ini.timeout); + ocs_hw_io_ini_sge(hw, io, iparam->fcp_ini.cmnd, iparam->fcp_ini.cmnd_size, iparam->fcp_ini.rsp); @@ -4104,18 +4121,20 @@ ocs_hw_io_send(ocs_hw_t *hw, ocs_hw_io_type_e type, ocs_hw_io_t *io, io->indicator, io->reqtag, SLI4_CQ_DEFAULT, rpi, rnode, iparam->fcp_ini.dif_oper, iparam->fcp_ini.blk_size, - iparam->fcp_ini.timeout)) { + timeout)) { ocs_log_err(hw->os, "IWRITE WQE error\n"); rc = OCS_HW_RTN_ERROR; } break; case OCS_HW_IO_INITIATOR_NODATA: + timeout = ocs_hw_set_io_wqe_timeout(io, iparam->fcp_ini.timeout); + ocs_hw_io_ini_sge(hw, io, iparam->fcp_ini.cmnd, iparam->fcp_ini.cmnd_size, iparam->fcp_ini.rsp); if (sli_fcp_icmnd64_wqe(&hw->sli, io->wqe.wqebuf, hw->sli.config.wqe_size, &io->def_sgl, io->indicator, io->reqtag, SLI4_CQ_DEFAULT, - rpi, rnode, iparam->fcp_ini.timeout)) { + rpi, rnode, timeout)) { ocs_log_err(hw->os, "ICMND WQE error\n"); rc = OCS_HW_RTN_ERROR; } @@ -4137,7 +4156,7 @@ ocs_hw_io_send(ocs_hw_t *hw, ocs_hw_io_type_e type, ocs_hw_io_t *io, flags &= ~SLI4_IO_CONTINUATION; } - io->tgt_wqe_timeout = iparam->fcp_tgt.timeout; + io->wqe_timeout = iparam->fcp_tgt.timeout; /* * If use_dif_quarantine workaround is in effect, and this is a DIF enabled IO @@ -4227,7 +4246,7 @@ ocs_hw_io_send(ocs_hw_t *hw, ocs_hw_io_type_e type, ocs_hw_io_t *io, flags &= ~SLI4_IO_CONTINUATION; } - io->tgt_wqe_timeout = iparam->fcp_tgt.timeout; + io->wqe_timeout = iparam->fcp_tgt.timeout; if (sli_fcp_tsend64_wqe(&hw->sli, io->wqe.wqebuf, hw->sli.config.wqe_size, &io->def_sgl, io->first_data_sge, iparam->fcp_tgt.offset, len, io->indicator, io->reqtag, SLI4_CQ_DEFAULT, @@ -4260,7 +4279,7 @@ ocs_hw_io_send(ocs_hw_t *hw, ocs_hw_io_type_e type, ocs_hw_io_t *io, } } - io->tgt_wqe_timeout = iparam->fcp_tgt.timeout; + io->wqe_timeout = iparam->fcp_tgt.timeout; if (sli_fcp_trsp64_wqe(&hw->sli, io->wqe.wqebuf, hw->sli.config.wqe_size, &io->def_sgl, len, @@ -11173,9 +11192,8 @@ target_wqe_timer_nop_cb(ocs_hw_t *hw, int32_t status, uint8_t *mqe, void *arg) { ocs_hw_io_t *io = NULL; ocs_hw_io_t *io_next = NULL; - uint64_t ticks_current = ocs_get_os_ticks(); - uint32_t sec_elapsed; ocs_hw_rtn_e rc; + struct timeval cur_time; sli4_mbox_command_header_t *hdr = (sli4_mbox_command_header_t *)mqe; @@ -11188,27 +11206,28 @@ target_wqe_timer_nop_cb(ocs_hw_t *hw, int32_t status, uint8_t *mqe, void *arg) /* loop through active WQE list and check for timeouts */ ocs_lock(&hw->io_lock); ocs_list_foreach_safe(&hw->io_timed_wqe, io, io_next) { - sec_elapsed = ((ticks_current - io->submit_ticks) / ocs_get_os_tick_freq()); /* * If elapsed time > timeout, abort it. No need to check type since * it wouldn't be on this list unless it was a target WQE */ - if (sec_elapsed > io->tgt_wqe_timeout) { - ocs_log_test(hw->os, "IO timeout xri=0x%x tag=0x%x type=%d\n", - io->indicator, io->reqtag, io->type); + getmicrouptime(&cur_time); + timevalsub(&cur_time, &io->submit_time); + if (cur_time.tv_sec > io->wqe_timeout) { + ocs_log_info(hw->os, "IO timeout xri=0x%x tag=0x%x type=%d elasped time:%u\n", + io->indicator, io->reqtag, io->type, cur_time.tv_sec); /* remove from active_wqe list so won't try to abort again */ ocs_list_remove(&hw->io_timed_wqe, io); /* save status of "timed out" for when abort completes */ io->status_saved = 1; - io->saved_status = SLI4_FC_WCQE_STATUS_TARGET_WQE_TIMEOUT; + io->saved_status = SLI4_FC_WCQE_STATUS_WQE_TIMEOUT; io->saved_ext = 0; io->saved_len = 0; /* now abort outstanding IO */ - rc = ocs_hw_io_abort(hw, io, FALSE, NULL, NULL); + rc = ocs_hw_io_abort(hw, io, TRUE, NULL, NULL); if (rc) { ocs_log_test(hw->os, "abort failed xri=%#x tag=%#x rc=%d\n", @@ -11237,7 +11256,6 @@ target_wqe_timer_cb(void *arg) /* delete existing timer; will kick off new timer after checking wqe timeouts */ hw->in_active_wqe_timer = TRUE; - ocs_del_timer(&hw->wqe_timer); /* Forward timer callback to execute in the mailbox completion processing context */ if (ocs_hw_async_call(hw, target_wqe_timer_nop_cb, hw)) { @@ -11250,7 +11268,7 @@ shutdown_target_wqe_timer(ocs_hw_t *hw) { uint32_t iters = 100; - if (hw->config.emulate_tgt_wqe_timeout) { + if (hw->config.emulate_wqe_timeout) { /* request active wqe timer shutdown, then wait for it to complete */ hw->active_wqe_timer_shutdown = TRUE; diff --git a/sys/dev/ocs_fc/ocs_hw.h b/sys/dev/ocs_fc/ocs_hw.h index d4ee85c3f52a..671aa40871f2 100644 --- a/sys/dev/ocs_fc/ocs_hw.h +++ b/sys/dev/ocs_fc/ocs_hw.h @@ -211,7 +211,7 @@ typedef enum { OCS_HW_WAR_VERSION, OCS_HW_DISABLE_AR_TGT_DIF, OCS_HW_EMULATE_I_ONLY_AAB, /**< emulate IAAB=0 for initiator-commands only */ - OCS_HW_EMULATE_TARGET_WQE_TIMEOUT, /**< enable driver timeouts for target WQEs */ + OCS_HW_EMULATE_WQE_TIMEOUT, /**< enable driver timeouts for WQEs */ OCS_HW_LINK_CONFIG_SPEED, OCS_HW_CONFIG_TOPOLOGY, OCS_HW_BOUNCE, @@ -520,7 +520,7 @@ typedef union ocs_hw_io_param_u { ocs_hw_dif_blk_size_e blk_size; uint32_t cmnd_size; uint16_t flags; - uint8_t timeout; + uint32_t timeout; uint32_t first_burst; } fcp_ini; } ocs_hw_io_param_t; @@ -576,8 +576,8 @@ struct ocs_hw_io_s { void *abort_arg; /**< argument passed to "abort done" callback */ ocs_ref_t ref; /**< refcount object */ size_t length; /**< needed for bug O127585: length of IO */ - uint8_t tgt_wqe_timeout; /**< timeout value for target WQEs */ - uint64_t submit_ticks; /**< timestamp when current WQE was submitted */ + uint32_t wqe_timeout; /**< timeout value for WQEs */ + struct timeval submit_time; /**< timestamp when current WQE was submitted */ uint32_t status_saved:1, /**< if TRUE, latched status should be returned */ abort_in_progress:1, /**< if TRUE, abort is in progress */ @@ -915,7 +915,7 @@ struct ocs_hw_s { uint16_t auto_xfer_rdy_app_tag_value; uint8_t dif_mode; /**< DIF mode to use */ uint8_t i_only_aab; /** Enable initiator-only auto-abort */ - uint8_t emulate_tgt_wqe_timeout; /** Enable driver target wqe timeouts */ + uint8_t emulate_wqe_timeout; /** Enable driver wqe timeouts */ uint32_t bounce:1; const char *queue_topology; /**< Queue topology string */ uint8_t auto_xfer_rdy_t10_enable; /** Enable t10 PI for auto xfer ready */ diff --git a/sys/dev/ocs_fc/ocs_scsi.c b/sys/dev/ocs_fc/ocs_scsi.c index 0e87cc0bed4b..af9fc798b01c 100644 --- a/sys/dev/ocs_fc/ocs_scsi.c +++ b/sys/dev/ocs_fc/ocs_scsi.c @@ -413,7 +413,7 @@ ocs_target_io_cb(ocs_hw_io_t *hio, ocs_remote_node_t *rnode, uint32_t length, } break; - case SLI4_FC_WCQE_STATUS_TARGET_WQE_TIMEOUT: + case SLI4_FC_WCQE_STATUS_WQE_TIMEOUT: /* target IO timed out */ scsi_status = OCS_SCSI_STATUS_TIMEDOUT_AND_ABORTED; break; @@ -2209,6 +2209,10 @@ ocs_initiator_io_cb(ocs_hw_io_t *hio, ocs_remote_node_t *rnode, uint32_t length, scsi_status = OCS_SCSI_STATUS_ERROR; } break; + case SLI4_FC_WCQE_STATUS_WQE_TIMEOUT: + /* IO timed out */ + scsi_status = OCS_SCSI_STATUS_TIMEDOUT_AND_ABORTED; + break; case SLI4_FC_WCQE_STATUS_DI_ERROR: if (ext_status & 0x01) { scsi_status = OCS_SCSI_STATUS_DIF_GUARD_ERROR; diff --git a/sys/dev/ocs_fc/ocs_xport.c b/sys/dev/ocs_fc/ocs_xport.c index d6b0d8740906..d997ea245132 100644 --- a/sys/dev/ocs_fc/ocs_xport.c +++ b/sys/dev/ocs_fc/ocs_xport.c @@ -524,9 +524,11 @@ ocs_xport_initialize(ocs_xport_t *xport) } } - if (ocs->target_io_timer_sec) { - ocs_log_debug(ocs, "setting target io timer=%d\n", ocs->target_io_timer_sec); - ocs_hw_set(&ocs->hw, OCS_HW_EMULATE_TARGET_WQE_TIMEOUT, TRUE); + if (ocs->target_io_timer_sec || ocs->enable_ini) { + if (ocs->target_io_timer_sec) + ocs_log_debug(ocs, "setting target io timer=%d\n", ocs->target_io_timer_sec); + + ocs_hw_set(&ocs->hw, OCS_HW_EMULATE_WQE_TIMEOUT, TRUE); } ocs_hw_callback(&ocs->hw, OCS_HW_CB_DOMAIN, ocs_domain_cb, ocs); diff --git a/sys/dev/ocs_fc/sli4.h b/sys/dev/ocs_fc/sli4.h index 4d8686ce8841..e9271df1530f 100644 --- a/sys/dev/ocs_fc/sli4.h +++ b/sys/dev/ocs_fc/sli4.h @@ -5345,7 +5345,7 @@ typedef struct sli4_fc_wqec_s { #define SLI4_FC_WCQE_STATUS_RX_ABORT_REQUEST 0x1b /* driver generated status codes; better not overlap with chip's status codes! */ -#define SLI4_FC_WCQE_STATUS_TARGET_WQE_TIMEOUT 0xff +#define SLI4_FC_WCQE_STATUS_WQE_TIMEOUT 0xff #define SLI4_FC_WCQE_STATUS_SHUTDOWN 0xfe #define SLI4_FC_WCQE_STATUS_DISPATCH_ERROR 0xfd From nobody Wed Dec 27 12:25:42 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T0W7q01Q4z55Xvx; Wed, 27 Dec 2023 12:25: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T0W7p63Ssz4Rwf; Wed, 27 Dec 2023 12:25:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703679942; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dkLM0HKud/4Y0bNshrifOcUH8tNGdgmrkaRZKz0nlj0=; b=wQMr4YxBAQv5tmcbCdi9WkToQEA6jsXAdR/P8A8boMX23InCgehqBAZ2G0QrZNOickrUBO Q34AyYXlVez+IqYN9ahWqZRk8nOfbcfk7Dyep0yzgxXsnvZiBfU6zuEpHaBVa6Lazd7a3P Wk0vlmeKaOoWZh4AQBCgkp0Hn5eTkbmJ+8LTEaz49aMmsk3iPxu1kbsQO4aO3Z/PIyRaPD MtKDSeEV0Polpeuoov58fqNcjJDWsTlVOYcVXhnkp5b83PrDFboY8Qb9G2ITlL7dbt49jI 2UrQbBFxAUuCNwzXCyCRUMZjsMeYUhDuP4IU+VOXKd9O2m/W0J+kfPd460cD3Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703679942; a=rsa-sha256; cv=none; b=fTLIjMW+VI5JcFsDQQgLSDioDQdO+jRI+vlJXqW+ZauEeoewYYjXi5tUN5pNEGnv4G2XVY ryKzZxOU0ECpfWEAP6RsIf5JDPDZlP+7jyK5LDDLDom9IfrcqdUNKp6OwpiQVD9TaXjSjD /yv7hjibJDstOW0ZK5B1Pvd4FURE5/6YVJmBASqlby3a21/awFpnxgkBiWa3HfRPVTHdEP q4JeO92g/EDOzJBLxWyUNMjCdmIQE8Wf5qPS5/UOvKk64504jCS1qQW5q3bZ81BibubmKq 1L4OT2P7QOxPQW3yM68fcpGF1X5dFidkjPDJVvVQeXDkZxN8My+MENoj6nnEPQ== 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=1703679942; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dkLM0HKud/4Y0bNshrifOcUH8tNGdgmrkaRZKz0nlj0=; b=rFx8QsySwRsZZhPYkGwoImLvbREwhVB42kHOxS6Bnmyrmg7rG4JrE6ZhNoYIguzaZIt9ur pNH5O7LtokWMB5UMVbjqu4NEdLZV47LCV6vP5ek+qFPZrhp37jEY9okgpU0xequnrYVOT7 XjtP3R5mp27y+xuwJ+3pZj2On/XEgo19k3gvFkJdHiVaHfw8ZLBeeQpt5bSBhY9gofdhLZ B52ybZBE2zsMlJQJoRRNa8xYVnE9r7Wk7VsbXaYU5XA+wLnJf45l6u9chUcabaPX2ZfDG4 nXoCMfGZ4Ospa7niiGNw7/HhXBgtXZIfFm2bc60kREohqeI704hpyI7LLreMjg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T0W7p56xSzdrt; Wed, 27 Dec 2023 12:25:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BRCPgKq061725; Wed, 27 Dec 2023 12:25:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BRCPgVv061722; Wed, 27 Dec 2023 12:25:42 GMT (envelope-from git) Date: Wed, 27 Dec 2023 12:25:42 GMT Message-Id: <202312271225.3BRCPgVv061722@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ram Kishore Vegesna Subject: git: 0a6b61a89a68 - stable/14 - ocs_fc: Use xpt_path_sbuf() to copy the path to sbuf. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ram X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 0a6b61a89a68339e358fe5420994eb9f1b8898d8 Auto-Submitted: auto-generated The branch stable/14 has been updated by ram: URL: https://cgit.FreeBSD.org/src/commit/?id=0a6b61a89a68339e358fe5420994eb9f1b8898d8 commit 0a6b61a89a68339e358fe5420994eb9f1b8898d8 Author: Ram Kishore Vegesna AuthorDate: 2023-12-13 07:56:40 +0000 Commit: Ram Kishore Vegesna CommitDate: 2023-12-27 12:19:51 +0000 ocs_fc: Use xpt_path_sbuf() to copy the path to sbuf. Reported by: imp MFC after: 1 week (cherry picked from commit a9504d76ccdad240b7d5761f4208e252f57042dd) --- sys/dev/ocs_fc/ocs_cam.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/dev/ocs_fc/ocs_cam.c b/sys/dev/ocs_fc/ocs_cam.c index 0fa94083e898..a944c7628d85 100644 --- a/sys/dev/ocs_fc/ocs_cam.c +++ b/sys/dev/ocs_fc/ocs_cam.c @@ -1540,15 +1540,13 @@ static int32_t ocs_scsi_initiator_io_cb(ocs_io_t *io, } } else if (scsi_status != OCS_SCSI_STATUS_GOOD) { const char *err_desc = NULL; - char path_str[64]; char err_str[224]; struct sbuf sb; size_t i; sbuf_new(&sb, err_str, sizeof(err_str), 0); - xpt_path_string(ccb->ccb_h.path, path_str, sizeof(path_str)); - sbuf_cat(&sb, path_str); + xpt_path_sbuf(ccb->ccb_h.path, &sb); for (i = 0; i < (sizeof(ocs_status_desc) / sizeof(ocs_status_desc[0])); i++) { From nobody Wed Dec 27 12:32:44 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T0WHw4fkLz55YGs; Wed, 27 Dec 2023 12:32: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T0WHw4PCsz4TyH; Wed, 27 Dec 2023 12:32:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703680364; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=N409MeKC+OZvvHX0ukkhrsYgmmeQUENgCJeLqxdNzTE=; b=LyWarcsHxER1s7SWwEE7sBYbW/tjCfApdiwASlWziJFr+jHZaPBq1OfF4w5LQVh+3aqRLM Sb4rEnVaAz6n+x3IVEGR3QLVRNRw9uTpHPJEceQOsf9aYSPcT7wvWn8AV0HoSL3KGS8n2k XL+lKCHCKfBGi5/i4NJ4U8JL7Wrhj6loUddqcVBXr1tCvuP/1JQRTfZ4am1gflIIfyTkVB XC+Xot7FX18R+gky5Viav/d7wFbu32TGgAUmoIwc1drsV5oRuum1maWdzSYpz69PVw6xvK HKLesFpqk60U+s6p/FZ+asouTJO/v12LpSO2MNDVJUBxBFWiT4mzkrdzUsN1Rg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703680364; a=rsa-sha256; cv=none; b=RPK1pQLC7usWd6VEqRkxcF11D4cGWHuIb3+JzBrMWjX1uarbNh63TN6BGUaVetQh9Zhpt3 NAYAZ/z2qOYHmdEMInqPimIu7KlIgXPHkQKMXNzazKhEPAIkqCZ1dXj54zyzCpQ89qhVur trk+GcmDHQC2kdj2fhd+lcTGaIzDB5qnFJL969F7fa4adBlJbxhX0IDeLXFHfJSd7r7u7O uf1iAdrldJfbPPQ/jViYlvAPy7HlKGVnZNiszyNWALcXIK/LClE5HpfYHlPCNjy8JNMs69 KuIQ6yoG7Nz+wcNWvTUi0roZS+SA12ELFY86xR0vOfvC/HtNwFLQ3w4nVGp6RQ== 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=1703680364; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=N409MeKC+OZvvHX0ukkhrsYgmmeQUENgCJeLqxdNzTE=; b=Lg5LtHHXbi/j+0V5RMOuxtmEwgReO0SRE22oUJx4wuKYTCu1MQ8lArxOKRqht/T6NpfhZS 0W8wbZS6lBOL2zIXLXRkoddMRZJLDflK8GK1HHl+IQWw7Dn1Sgb1urNuB0OiOwhOofxup7 HnKF0iFnm/6PSCKeJBFm79wCvGz0A0Ozr4dcSkhlEOKqmTbmXBmdIUY+DyTx5iDzgnaASS Ilc6Gn2bGP6S+29qR+1VTp+DTEoKbN9f5Xi1CXCwGGQAk4ZupJOtw/qWVLhfmqeCeNmuvk ddxgDkmIuk9OqpmoACEpvsRqmhIZtJ/KQETUneIkBjFMCsHo1KCWiMc/ybhOkg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T0WHw3RT5zf4C; Wed, 27 Dec 2023 12:32:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BRCWiU2077971; Wed, 27 Dec 2023 12:32:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BRCWiW3077968; Wed, 27 Dec 2023 12:32:44 GMT (envelope-from git) Date: Wed, 27 Dec 2023 12:32:44 GMT Message-Id: <202312271232.3BRCWiW3077968@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ram Kishore Vegesna Subject: git: 104eae582c91 - stable/13 - ocs_fc: IO timeout handling and error reporting fix. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ram X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 104eae582c91f23d06b8de4b7872b8bc7fa13be7 Auto-Submitted: auto-generated The branch stable/13 has been updated by ram: URL: https://cgit.FreeBSD.org/src/commit/?id=104eae582c91f23d06b8de4b7872b8bc7fa13be7 commit 104eae582c91f23d06b8de4b7872b8bc7fa13be7 Author: Ram Kishore Vegesna AuthorDate: 2023-12-12 15:22:58 +0000 Commit: Ram Kishore Vegesna CommitDate: 2023-12-27 12:27:46 +0000 ocs_fc: IO timeout handling and error reporting fix. Hardware timeout uses a 8-bit timeout value and expects the timeout to be less than 255 seconds. Added software timer implemetation to timeout and abort the IOs with timeout more than 255 seconds. Fix the timeout problem by dividing CAM timeouts by 1000 as hardware expects timeout value in seconds. Before this change, CAM timeouts in milliseconds were getting truncated to 8 bits and converted to seconds. So the actual timeout used when going down to the card would depend on the bottom 8 bits of the timeout used. Add the mapping of ocs_fc error status to CAM status. Reported by: ken Reviewed by: ken Tested by: ken, ram Approved by: ken MFC after: 1 week (cherry picked from commit 70547544ce931357c980be47d937e5b57a2d7f49) --- sys/dev/ocs_fc/ocs_cam.c | 87 ++++++++++++++++++++++++++++++++++++++++++++-- sys/dev/ocs_fc/ocs_hw.c | 70 +++++++++++++++++++++++-------------- sys/dev/ocs_fc/ocs_hw.h | 10 +++--- sys/dev/ocs_fc/ocs_scsi.c | 6 +++- sys/dev/ocs_fc/ocs_xport.c | 8 +++-- sys/dev/ocs_fc/sli4.h | 2 +- 6 files changed, 144 insertions(+), 39 deletions(-) diff --git a/sys/dev/ocs_fc/ocs_cam.c b/sys/dev/ocs_fc/ocs_cam.c index 4da1b6669047..0fa94083e898 100644 --- a/sys/dev/ocs_fc/ocs_cam.c +++ b/sys/dev/ocs_fc/ocs_cam.c @@ -44,6 +44,7 @@ #include "ocs.h" #include "ocs_scsi.h" #include "ocs_device.h" +#include /* Default IO timeout value for initiators is 30 seconds */ #define OCS_CAM_IO_TIMEOUT 30 @@ -55,6 +56,27 @@ typedef struct { int32_t rc; } ocs_dmamap_load_arg_t; +struct ocs_scsi_status_desc { + ocs_scsi_io_status_e status; + const char *desc; +} ocs_status_desc[] = { + { OCS_SCSI_STATUS_GOOD, "Good" }, + { OCS_SCSI_STATUS_ABORTED, "Aborted" }, + { OCS_SCSI_STATUS_ERROR, "Error" }, + { OCS_SCSI_STATUS_DIF_GUARD_ERROR, "DIF Guard Error" }, + { OCS_SCSI_STATUS_DIF_REF_TAG_ERROR, "DIF REF Tag Error" }, + { OCS_SCSI_STATUS_DIF_APP_TAG_ERROR, "DIF App Tag Error" }, + { OCS_SCSI_STATUS_DIF_UNKNOWN_ERROR, "DIF Unknown Error" }, + { OCS_SCSI_STATUS_PROTOCOL_CRC_ERROR, "Proto CRC Error" }, + { OCS_SCSI_STATUS_NO_IO, "No IO" }, + { OCS_SCSI_STATUS_ABORT_IN_PROGRESS, "Abort in Progress" }, + { OCS_SCSI_STATUS_CHECK_RESPONSE, "Check Response" }, + { OCS_SCSI_STATUS_COMMAND_TIMEOUT, "Command Timeout" }, + { OCS_SCSI_STATUS_TIMEDOUT_AND_ABORTED, "Timed out and Aborted" }, + { OCS_SCSI_STATUS_SHUTDOWN, "Shutdown" }, + { OCS_SCSI_STATUS_NEXUS_LOST, "Nexus Lost" } +}; + static void ocs_action(struct cam_sim *, union ccb *); static void ocs_poll(struct cam_sim *); @@ -1497,7 +1519,7 @@ static int32_t ocs_scsi_initiator_io_cb(ocs_io_t *io, * If we've already got a SCSI error, prefer that because it * will have more detail. */ - if ((rsp->residual < 0) && (ccb_status == CAM_REQ_CMP)) { + if ((rsp->residual < 0) && (ccb_status == CAM_REQ_CMP)) { ccb_status = CAM_DATA_RUN_ERR; } @@ -1517,7 +1539,62 @@ static int32_t ocs_scsi_initiator_io_cb(ocs_io_t *io, ocs_memcpy(&csio->sense_data, rsp->sense_data, sense_len); } } else if (scsi_status != OCS_SCSI_STATUS_GOOD) { - ccb_status = CAM_REQ_CMP_ERR; + const char *err_desc = NULL; + char path_str[64]; + char err_str[224]; + struct sbuf sb; + size_t i; + + sbuf_new(&sb, err_str, sizeof(err_str), 0); + + xpt_path_string(ccb->ccb_h.path, path_str, sizeof(path_str)); + sbuf_cat(&sb, path_str); + + for (i = 0; i < (sizeof(ocs_status_desc) / + sizeof(ocs_status_desc[0])); i++) { + if (scsi_status == ocs_status_desc[i].status) { + err_desc = ocs_status_desc[i].desc; + break; + } + } + if (ccb->ccb_h.func_code == XPT_SCSI_IO) { + scsi_command_string(&ccb->csio, &sb); + sbuf_printf(&sb, "length %d ", ccb->csio.dxfer_len); + } + sbuf_printf(&sb, "error status %d (%s)\n", scsi_status, + (err_desc != NULL) ? err_desc : "Unknown"); + sbuf_finish(&sb); + printf("%s", sbuf_data(&sb)); + + switch (scsi_status) { + case OCS_SCSI_STATUS_ABORTED: + case OCS_SCSI_STATUS_ABORT_IN_PROGRESS: + ccb_status = CAM_REQ_ABORTED; + break; + case OCS_SCSI_STATUS_DIF_GUARD_ERROR: + case OCS_SCSI_STATUS_DIF_REF_TAG_ERROR: + case OCS_SCSI_STATUS_DIF_APP_TAG_ERROR: + case OCS_SCSI_STATUS_DIF_UNKNOWN_ERROR: + case OCS_SCSI_STATUS_PROTOCOL_CRC_ERROR: + ccb_status = CAM_IDE; + break; + case OCS_SCSI_STATUS_ERROR: + case OCS_SCSI_STATUS_NO_IO: + ccb_status = CAM_REQ_CMP_ERR; + break; + case OCS_SCSI_STATUS_COMMAND_TIMEOUT: + case OCS_SCSI_STATUS_TIMEDOUT_AND_ABORTED: + ccb_status = CAM_CMD_TIMEOUT; + break; + case OCS_SCSI_STATUS_SHUTDOWN: + case OCS_SCSI_STATUS_NEXUS_LOST: + ccb_status = CAM_SCSI_IT_NEXUS_LOST; + break; + default: + ccb_status = CAM_REQ_CMP_ERR; + break; + } + } else { ccb_status = CAM_REQ_CMP; } @@ -1842,7 +1919,11 @@ ocs_initiator_io(struct ocs_softc *ocs, union ccb *ccb) } else if (ccb->ccb_h.timeout == CAM_TIME_DEFAULT) { io->timeout = OCS_CAM_IO_TIMEOUT; } else { - io->timeout = ccb->ccb_h.timeout; + if (ccb->ccb_h.timeout < 1000) + io->timeout = 1; + else { + io->timeout = ccb->ccb_h.timeout / 1000; + } } switch (csio->tag_action) { diff --git a/sys/dev/ocs_fc/ocs_hw.c b/sys/dev/ocs_fc/ocs_hw.c index 097228d12bfb..186b04b8b129 100644 --- a/sys/dev/ocs_fc/ocs_hw.c +++ b/sys/dev/ocs_fc/ocs_hw.c @@ -148,17 +148,29 @@ static void ocs_hw_check_sec_hio_list(ocs_hw_t *hw); static void target_wqe_timer_cb(void *arg); static void shutdown_target_wqe_timer(ocs_hw_t *hw); +/* WQE timeout for initiator IOs */ +static inline uint8_t +ocs_hw_set_io_wqe_timeout(ocs_hw_io_t *io, uint32_t timeout) +{ + if (timeout > 255) { + io->wqe_timeout = timeout; + return 0; + } else { + return timeout; + } +} + static inline void ocs_hw_add_io_timed_wqe(ocs_hw_t *hw, ocs_hw_io_t *io) { - if (hw->config.emulate_tgt_wqe_timeout && io->tgt_wqe_timeout) { + if (hw->config.emulate_wqe_timeout && io->wqe_timeout) { /* * Active WQE list currently only used for * target WQE timeouts. */ ocs_lock(&hw->io_lock); ocs_list_add_tail(&hw->io_timed_wqe, io); - io->submit_ticks = ocs_get_os_ticks(); + getmicrouptime(&io->submit_time); ocs_unlock(&hw->io_lock); } } @@ -166,7 +178,7 @@ ocs_hw_add_io_timed_wqe(ocs_hw_t *hw, ocs_hw_io_t *io) static inline void ocs_hw_remove_io_timed_wqe(ocs_hw_t *hw, ocs_hw_io_t *io) { - if (hw->config.emulate_tgt_wqe_timeout) { + if (hw->config.emulate_wqe_timeout) { /* * If target wqe timeouts are enabled, * remove from active wqe list. @@ -965,7 +977,7 @@ ocs_hw_init(ocs_hw_t *hw) } /* finally kick off periodic timer to check for timed out target WQEs */ - if (hw->config.emulate_tgt_wqe_timeout) { + if (hw->config.emulate_wqe_timeout) { ocs_setup_timer(hw->os, &hw->wqe_timer, target_wqe_timer_cb, hw, OCS_HW_WQ_TIMER_PERIOD_MS); } @@ -1695,8 +1707,8 @@ ocs_hw_get(ocs_hw_t *hw, ocs_hw_property_e prop, uint32_t *value) case OCS_HW_EMULATE_I_ONLY_AAB: *value = hw->config.i_only_aab; break; - case OCS_HW_EMULATE_TARGET_WQE_TIMEOUT: - *value = hw->config.emulate_tgt_wqe_timeout; + case OCS_HW_EMULATE_WQE_TIMEOUT: + *value = hw->config.emulate_wqe_timeout; break; case OCS_HW_VPD_LEN: *value = sli_get_vpd_len(&hw->sli); @@ -1996,8 +2008,8 @@ ocs_hw_set(ocs_hw_t *hw, ocs_hw_property_e prop, uint32_t value) case OCS_HW_EMULATE_I_ONLY_AAB: hw->config.i_only_aab = value; break; - case OCS_HW_EMULATE_TARGET_WQE_TIMEOUT: - hw->config.emulate_tgt_wqe_timeout = value; + case OCS_HW_EMULATE_WQE_TIMEOUT: + hw->config.emulate_wqe_timeout = value; break; case OCS_HW_BOUNCE: hw->config.bounce = value; @@ -3324,7 +3336,7 @@ ocs_hw_init_free_io(ocs_hw_io_t *io) io->type = 0xFFFF; io->wq = NULL; io->ul_io = NULL; - io->tgt_wqe_timeout = 0; + io->wqe_timeout = 0; } /** @@ -3738,7 +3750,7 @@ ocs_hw_check_sec_hio_list(ocs_hw_t *hw) flags &= ~SLI4_IO_CONTINUATION; } - io->tgt_wqe_timeout = io->sec_iparam.fcp_tgt.timeout; + io->wqe_timeout = io->sec_iparam.fcp_tgt.timeout; /* Complete (continue) TRECV IO */ if (io->xbusy) { @@ -4041,6 +4053,7 @@ ocs_hw_io_send(ocs_hw_t *hw, ocs_hw_io_type_e type, ocs_hw_io_t *io, ocs_hw_rtn_e rc = OCS_HW_RTN_SUCCESS; uint32_t rpi; uint8_t send_wqe = TRUE; + uint8_t timeout = 0; CPUTRACE(""); @@ -4075,6 +4088,8 @@ ocs_hw_io_send(ocs_hw_t *hw, ocs_hw_io_type_e type, ocs_hw_io_t *io, */ switch (type) { case OCS_HW_IO_INITIATOR_READ: + timeout = ocs_hw_set_io_wqe_timeout(io, iparam->fcp_ini.timeout); + /* * If use_dif_quarantine workaround is in effect, and dif_separates then mark the * initiator read IO for quarantine @@ -4090,12 +4105,14 @@ ocs_hw_io_send(ocs_hw_t *hw, ocs_hw_io_type_e type, ocs_hw_io_t *io, if (sli_fcp_iread64_wqe(&hw->sli, io->wqe.wqebuf, hw->sli.config.wqe_size, &io->def_sgl, io->first_data_sge, len, io->indicator, io->reqtag, SLI4_CQ_DEFAULT, rpi, rnode, iparam->fcp_ini.dif_oper, iparam->fcp_ini.blk_size, - iparam->fcp_ini.timeout)) { + timeout)) { ocs_log_err(hw->os, "IREAD WQE error\n"); rc = OCS_HW_RTN_ERROR; } break; case OCS_HW_IO_INITIATOR_WRITE: + timeout = ocs_hw_set_io_wqe_timeout(io, iparam->fcp_ini.timeout); + ocs_hw_io_ini_sge(hw, io, iparam->fcp_ini.cmnd, iparam->fcp_ini.cmnd_size, iparam->fcp_ini.rsp); @@ -4104,18 +4121,20 @@ ocs_hw_io_send(ocs_hw_t *hw, ocs_hw_io_type_e type, ocs_hw_io_t *io, io->indicator, io->reqtag, SLI4_CQ_DEFAULT, rpi, rnode, iparam->fcp_ini.dif_oper, iparam->fcp_ini.blk_size, - iparam->fcp_ini.timeout)) { + timeout)) { ocs_log_err(hw->os, "IWRITE WQE error\n"); rc = OCS_HW_RTN_ERROR; } break; case OCS_HW_IO_INITIATOR_NODATA: + timeout = ocs_hw_set_io_wqe_timeout(io, iparam->fcp_ini.timeout); + ocs_hw_io_ini_sge(hw, io, iparam->fcp_ini.cmnd, iparam->fcp_ini.cmnd_size, iparam->fcp_ini.rsp); if (sli_fcp_icmnd64_wqe(&hw->sli, io->wqe.wqebuf, hw->sli.config.wqe_size, &io->def_sgl, io->indicator, io->reqtag, SLI4_CQ_DEFAULT, - rpi, rnode, iparam->fcp_ini.timeout)) { + rpi, rnode, timeout)) { ocs_log_err(hw->os, "ICMND WQE error\n"); rc = OCS_HW_RTN_ERROR; } @@ -4137,7 +4156,7 @@ ocs_hw_io_send(ocs_hw_t *hw, ocs_hw_io_type_e type, ocs_hw_io_t *io, flags &= ~SLI4_IO_CONTINUATION; } - io->tgt_wqe_timeout = iparam->fcp_tgt.timeout; + io->wqe_timeout = iparam->fcp_tgt.timeout; /* * If use_dif_quarantine workaround is in effect, and this is a DIF enabled IO @@ -4227,7 +4246,7 @@ ocs_hw_io_send(ocs_hw_t *hw, ocs_hw_io_type_e type, ocs_hw_io_t *io, flags &= ~SLI4_IO_CONTINUATION; } - io->tgt_wqe_timeout = iparam->fcp_tgt.timeout; + io->wqe_timeout = iparam->fcp_tgt.timeout; if (sli_fcp_tsend64_wqe(&hw->sli, io->wqe.wqebuf, hw->sli.config.wqe_size, &io->def_sgl, io->first_data_sge, iparam->fcp_tgt.offset, len, io->indicator, io->reqtag, SLI4_CQ_DEFAULT, @@ -4260,7 +4279,7 @@ ocs_hw_io_send(ocs_hw_t *hw, ocs_hw_io_type_e type, ocs_hw_io_t *io, } } - io->tgt_wqe_timeout = iparam->fcp_tgt.timeout; + io->wqe_timeout = iparam->fcp_tgt.timeout; if (sli_fcp_trsp64_wqe(&hw->sli, io->wqe.wqebuf, hw->sli.config.wqe_size, &io->def_sgl, len, @@ -11173,9 +11192,8 @@ target_wqe_timer_nop_cb(ocs_hw_t *hw, int32_t status, uint8_t *mqe, void *arg) { ocs_hw_io_t *io = NULL; ocs_hw_io_t *io_next = NULL; - uint64_t ticks_current = ocs_get_os_ticks(); - uint32_t sec_elapsed; ocs_hw_rtn_e rc; + struct timeval cur_time; sli4_mbox_command_header_t *hdr = (sli4_mbox_command_header_t *)mqe; @@ -11188,27 +11206,28 @@ target_wqe_timer_nop_cb(ocs_hw_t *hw, int32_t status, uint8_t *mqe, void *arg) /* loop through active WQE list and check for timeouts */ ocs_lock(&hw->io_lock); ocs_list_foreach_safe(&hw->io_timed_wqe, io, io_next) { - sec_elapsed = ((ticks_current - io->submit_ticks) / ocs_get_os_tick_freq()); /* * If elapsed time > timeout, abort it. No need to check type since * it wouldn't be on this list unless it was a target WQE */ - if (sec_elapsed > io->tgt_wqe_timeout) { - ocs_log_test(hw->os, "IO timeout xri=0x%x tag=0x%x type=%d\n", - io->indicator, io->reqtag, io->type); + getmicrouptime(&cur_time); + timevalsub(&cur_time, &io->submit_time); + if (cur_time.tv_sec > io->wqe_timeout) { + ocs_log_info(hw->os, "IO timeout xri=0x%x tag=0x%x type=%d elasped time:%u\n", + io->indicator, io->reqtag, io->type, cur_time.tv_sec); /* remove from active_wqe list so won't try to abort again */ ocs_list_remove(&hw->io_timed_wqe, io); /* save status of "timed out" for when abort completes */ io->status_saved = 1; - io->saved_status = SLI4_FC_WCQE_STATUS_TARGET_WQE_TIMEOUT; + io->saved_status = SLI4_FC_WCQE_STATUS_WQE_TIMEOUT; io->saved_ext = 0; io->saved_len = 0; /* now abort outstanding IO */ - rc = ocs_hw_io_abort(hw, io, FALSE, NULL, NULL); + rc = ocs_hw_io_abort(hw, io, TRUE, NULL, NULL); if (rc) { ocs_log_test(hw->os, "abort failed xri=%#x tag=%#x rc=%d\n", @@ -11237,7 +11256,6 @@ target_wqe_timer_cb(void *arg) /* delete existing timer; will kick off new timer after checking wqe timeouts */ hw->in_active_wqe_timer = TRUE; - ocs_del_timer(&hw->wqe_timer); /* Forward timer callback to execute in the mailbox completion processing context */ if (ocs_hw_async_call(hw, target_wqe_timer_nop_cb, hw)) { @@ -11250,7 +11268,7 @@ shutdown_target_wqe_timer(ocs_hw_t *hw) { uint32_t iters = 100; - if (hw->config.emulate_tgt_wqe_timeout) { + if (hw->config.emulate_wqe_timeout) { /* request active wqe timer shutdown, then wait for it to complete */ hw->active_wqe_timer_shutdown = TRUE; diff --git a/sys/dev/ocs_fc/ocs_hw.h b/sys/dev/ocs_fc/ocs_hw.h index d4ee85c3f52a..671aa40871f2 100644 --- a/sys/dev/ocs_fc/ocs_hw.h +++ b/sys/dev/ocs_fc/ocs_hw.h @@ -211,7 +211,7 @@ typedef enum { OCS_HW_WAR_VERSION, OCS_HW_DISABLE_AR_TGT_DIF, OCS_HW_EMULATE_I_ONLY_AAB, /**< emulate IAAB=0 for initiator-commands only */ - OCS_HW_EMULATE_TARGET_WQE_TIMEOUT, /**< enable driver timeouts for target WQEs */ + OCS_HW_EMULATE_WQE_TIMEOUT, /**< enable driver timeouts for WQEs */ OCS_HW_LINK_CONFIG_SPEED, OCS_HW_CONFIG_TOPOLOGY, OCS_HW_BOUNCE, @@ -520,7 +520,7 @@ typedef union ocs_hw_io_param_u { ocs_hw_dif_blk_size_e blk_size; uint32_t cmnd_size; uint16_t flags; - uint8_t timeout; + uint32_t timeout; uint32_t first_burst; } fcp_ini; } ocs_hw_io_param_t; @@ -576,8 +576,8 @@ struct ocs_hw_io_s { void *abort_arg; /**< argument passed to "abort done" callback */ ocs_ref_t ref; /**< refcount object */ size_t length; /**< needed for bug O127585: length of IO */ - uint8_t tgt_wqe_timeout; /**< timeout value for target WQEs */ - uint64_t submit_ticks; /**< timestamp when current WQE was submitted */ + uint32_t wqe_timeout; /**< timeout value for WQEs */ + struct timeval submit_time; /**< timestamp when current WQE was submitted */ uint32_t status_saved:1, /**< if TRUE, latched status should be returned */ abort_in_progress:1, /**< if TRUE, abort is in progress */ @@ -915,7 +915,7 @@ struct ocs_hw_s { uint16_t auto_xfer_rdy_app_tag_value; uint8_t dif_mode; /**< DIF mode to use */ uint8_t i_only_aab; /** Enable initiator-only auto-abort */ - uint8_t emulate_tgt_wqe_timeout; /** Enable driver target wqe timeouts */ + uint8_t emulate_wqe_timeout; /** Enable driver wqe timeouts */ uint32_t bounce:1; const char *queue_topology; /**< Queue topology string */ uint8_t auto_xfer_rdy_t10_enable; /** Enable t10 PI for auto xfer ready */ diff --git a/sys/dev/ocs_fc/ocs_scsi.c b/sys/dev/ocs_fc/ocs_scsi.c index 0e87cc0bed4b..af9fc798b01c 100644 --- a/sys/dev/ocs_fc/ocs_scsi.c +++ b/sys/dev/ocs_fc/ocs_scsi.c @@ -413,7 +413,7 @@ ocs_target_io_cb(ocs_hw_io_t *hio, ocs_remote_node_t *rnode, uint32_t length, } break; - case SLI4_FC_WCQE_STATUS_TARGET_WQE_TIMEOUT: + case SLI4_FC_WCQE_STATUS_WQE_TIMEOUT: /* target IO timed out */ scsi_status = OCS_SCSI_STATUS_TIMEDOUT_AND_ABORTED; break; @@ -2209,6 +2209,10 @@ ocs_initiator_io_cb(ocs_hw_io_t *hio, ocs_remote_node_t *rnode, uint32_t length, scsi_status = OCS_SCSI_STATUS_ERROR; } break; + case SLI4_FC_WCQE_STATUS_WQE_TIMEOUT: + /* IO timed out */ + scsi_status = OCS_SCSI_STATUS_TIMEDOUT_AND_ABORTED; + break; case SLI4_FC_WCQE_STATUS_DI_ERROR: if (ext_status & 0x01) { scsi_status = OCS_SCSI_STATUS_DIF_GUARD_ERROR; diff --git a/sys/dev/ocs_fc/ocs_xport.c b/sys/dev/ocs_fc/ocs_xport.c index d6b0d8740906..d997ea245132 100644 --- a/sys/dev/ocs_fc/ocs_xport.c +++ b/sys/dev/ocs_fc/ocs_xport.c @@ -524,9 +524,11 @@ ocs_xport_initialize(ocs_xport_t *xport) } } - if (ocs->target_io_timer_sec) { - ocs_log_debug(ocs, "setting target io timer=%d\n", ocs->target_io_timer_sec); - ocs_hw_set(&ocs->hw, OCS_HW_EMULATE_TARGET_WQE_TIMEOUT, TRUE); + if (ocs->target_io_timer_sec || ocs->enable_ini) { + if (ocs->target_io_timer_sec) + ocs_log_debug(ocs, "setting target io timer=%d\n", ocs->target_io_timer_sec); + + ocs_hw_set(&ocs->hw, OCS_HW_EMULATE_WQE_TIMEOUT, TRUE); } ocs_hw_callback(&ocs->hw, OCS_HW_CB_DOMAIN, ocs_domain_cb, ocs); diff --git a/sys/dev/ocs_fc/sli4.h b/sys/dev/ocs_fc/sli4.h index 4d8686ce8841..e9271df1530f 100644 --- a/sys/dev/ocs_fc/sli4.h +++ b/sys/dev/ocs_fc/sli4.h @@ -5345,7 +5345,7 @@ typedef struct sli4_fc_wqec_s { #define SLI4_FC_WCQE_STATUS_RX_ABORT_REQUEST 0x1b /* driver generated status codes; better not overlap with chip's status codes! */ -#define SLI4_FC_WCQE_STATUS_TARGET_WQE_TIMEOUT 0xff +#define SLI4_FC_WCQE_STATUS_WQE_TIMEOUT 0xff #define SLI4_FC_WCQE_STATUS_SHUTDOWN 0xfe #define SLI4_FC_WCQE_STATUS_DISPATCH_ERROR 0xfd From nobody Wed Dec 27 12:32:45 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T0WHx6kTkz55YYj; Wed, 27 Dec 2023 12:32: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T0WHx5d7Bz4V8c; Wed, 27 Dec 2023 12:32:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703680365; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1sub6R3RCtZ5A6L++6T3f2ABEXjdsMcQtcQaktn6RnM=; b=cXjuVANFscQVOiE6RVlRldK16pY8qe7ckclBL4+AjflgINKFUfF3maA7qVD7fEnBOwqqXp Z42TpMkhxhyOJRre3gSyKXtOvCUnf2aYR2KQ4mPPy8x9bxQo8i708B4Oaz+WQoZn1BAFYD harsp/TuYVdG9m7cM1vhhd/qTQ1prB7r9y8lmRoGHepPmt6Amh6mo8/6mbcO6yboKFz4Zg YMMKF269E4waJmFFoBmerjncL7z+Z4VY4ZB1vP36jS3gu6NsBUIAeF0dg/f6KYG6+DmgcJ vjboUr/shHXyQCf4T+pYJPOcv/NMsksTIO060uIiFCB/B2ya+GOBrBj7gSS/Uw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703680365; a=rsa-sha256; cv=none; b=hklnoa/knjg+yMQ56r2qXGt1MHPpjSXyX+52KCyV2lJeDpTe/LsLJ0Fa2EaIaGKoyI0dxh OOGfy5QoDeuBs0y3YtF8XlbAH0sdA3tXhtC4TDDvzDhfMKI2s8bdICjDmRTjlQ8J3/95sW Ix4xgam0463SxFacvO5IuJvVPZPvcjTnpQ66pl9aEP98MGM84/vniQfAo82tS+0utdLJVb 5JlqxA9cwoffBOa/joc2lekRuGBk2Uu7X3I19kY1tZFjAdUjBGiEaHsTm38c7rawInnp3C gBlt/J1gzfYwtav+PYMesIO6M1LDOGXG+TNVFpcgSUu02AP3fT5zv6Hxndg3mQ== 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=1703680365; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1sub6R3RCtZ5A6L++6T3f2ABEXjdsMcQtcQaktn6RnM=; b=rqaETfHQ6yIk7JrGkPFqQwfT93HbfOmWFcudGT7wop/qTqQ2bXd8v5zk9rjJlINX2T+OwL Bta5U6wey1M3k/VNhnUtTD0EW42p6DqxITDu0DxyPEUR8WGnsTmIG2NpP2hpJvldmnh2+e 3WT0KT/ANH6KX84I3MEngS7kBsxv2mrH+YrhIipHwO8jDa9rxxPeRrb7iUtgSn1mGFqtZT hR3+1mQ0G3AeCGK7ksXSrj/5hXak/kcFI/1pNVCs3iOifIKQxc0lXueS1Rx+2rDI5k+xqo 8bGRM8ZmUunCv4xjUV8elSgQcUCwNnC8cLMR8+9NtUAH4vbdaPETFzAE50w9/w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T0WHx4k9Szdsj; Wed, 27 Dec 2023 12:32:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BRCWjKH078029; Wed, 27 Dec 2023 12:32:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BRCWju6078026; Wed, 27 Dec 2023 12:32:45 GMT (envelope-from git) Date: Wed, 27 Dec 2023 12:32:45 GMT Message-Id: <202312271232.3BRCWju6078026@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ram Kishore Vegesna Subject: git: e8ff00285afb - stable/13 - ocs_fc: Use xpt_path_sbuf() to copy the path to sbuf. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ram X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e8ff00285afb3b9ab573f6c080a1095ab0f95c1e Auto-Submitted: auto-generated The branch stable/13 has been updated by ram: URL: https://cgit.FreeBSD.org/src/commit/?id=e8ff00285afb3b9ab573f6c080a1095ab0f95c1e commit e8ff00285afb3b9ab573f6c080a1095ab0f95c1e Author: Ram Kishore Vegesna AuthorDate: 2023-12-13 07:56:40 +0000 Commit: Ram Kishore Vegesna CommitDate: 2023-12-27 12:28:25 +0000 ocs_fc: Use xpt_path_sbuf() to copy the path to sbuf. Reported by: imp MFC after: 1 week (cherry picked from commit a9504d76ccdad240b7d5761f4208e252f57042dd) --- sys/dev/ocs_fc/ocs_cam.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/dev/ocs_fc/ocs_cam.c b/sys/dev/ocs_fc/ocs_cam.c index 0fa94083e898..a944c7628d85 100644 --- a/sys/dev/ocs_fc/ocs_cam.c +++ b/sys/dev/ocs_fc/ocs_cam.c @@ -1540,15 +1540,13 @@ static int32_t ocs_scsi_initiator_io_cb(ocs_io_t *io, } } else if (scsi_status != OCS_SCSI_STATUS_GOOD) { const char *err_desc = NULL; - char path_str[64]; char err_str[224]; struct sbuf sb; size_t i; sbuf_new(&sb, err_str, sizeof(err_str), 0); - xpt_path_string(ccb->ccb_h.path, path_str, sizeof(path_str)); - sbuf_cat(&sb, path_str); + xpt_path_sbuf(ccb->ccb_h.path, &sb); for (i = 0; i < (sizeof(ocs_status_desc) / sizeof(ocs_status_desc[0])); i++) { From nobody Wed Dec 27 21:06:17 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T0khT5fmMz56KNw; Wed, 27 Dec 2023 21:06: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T0khT3m4Rz4Z14; Wed, 27 Dec 2023 21:06:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703711177; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=C/Ac3IRKWd8YKwqig8S3VyEi2JB/L//bPbcpSnSpH6U=; b=gkoYxDq/mm5aU4YAotx3RbONCzbXS6dGXY+76dfM/oVriNw2c6nDy8EtxXJ/2CDUg8405P UFuRchIdVPApg5oPNFS8n8ARAmZJs8GyByuA1Pyvw84edLQLQdv89GOBltvgzqNU7epj1o GSvPE1Jmxqk4KjNVXDyiI0I7I8nnbPLwsouBvv5t0JaPmpD2efkw6yJofuufbYHeNK47Wg +nMS6qehADSq2BaeiOtzwKXRmUbIr8l3x9JHUutIlpLEYlL0cr01Iiw9mnlgzC0QvE07rI 6b3JvgzQyYWLb+efP/jLR0yuMk2O6Ic+fKqP7nLCOw8eikZMi4IDTIb+r1PLew== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703711177; a=rsa-sha256; cv=none; b=nJlWE5QW/G5/2IKNdTOrxl04F/14WFE9ZPE5qkKdLkXx6iQRp/Y9N2BZIzaRda9Gl57PQl z+GMmhHvdQXzJe5+sWjBpNhyYxZwU+ABpD1mffJBOhKop//Ljm0bVbAUK4zNZih3AH7J/D yJOiLztuvb0w/hyTne9IDv4eXeXC5VopWX4R4TlQQRn4ZfBdctY02c5blsPcoHfv1MjkL3 73X22V0k1Tsce0dW55sAAMTPb1o+HwTwW23AZJgOSrUNOjePz7WAAQV9KDrI/AU21LxZpl AEAou+qHMSdnI2+n5ia0wahCkEbOi3tvVIswHXL5TE9MEbKiCY3RU2bsCmDoKw== 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=1703711177; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=C/Ac3IRKWd8YKwqig8S3VyEi2JB/L//bPbcpSnSpH6U=; b=YOG2zmYEv1p+cgE1qAARwoyhRb0H3Nswl6zF2d25h22519PxyACLH3TtjqGR1mG6NXB83C 6F5Iv11/VMtE1S60uuGO57DwIMMKqBT20BvZf1QbtasMzx+8XSsKjA/v9YXFokqwHFCZt5 NhZ0hWbu5L0DNRmX9T3HwEWEaolmcnwm4a0GJtpgd5PAIgk6dqa0sgek52IRzWONWhbkiz hCmGyJFvZzXoobE1LgUuW9jkv84VdjILn0TMMAQIfxy5DqIU7aBsgHdEvF90y2wNCFLM/C wHrjtYpjaPmWRnrFIKFsZKiIFPvQ2gDjhP/JmhxotmSNNRLTJjT+1TeR/aRwJw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T0khT2jXQzv7C; Wed, 27 Dec 2023 21:06:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BRL6Hk5036291; Wed, 27 Dec 2023 21:06:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BRL6Hmt036288; Wed, 27 Dec 2023 21:06:17 GMT (envelope-from git) Date: Wed, 27 Dec 2023 21:06:17 GMT Message-Id: <202312272106.3BRL6Hmt036288@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 18fb9174cda5 - stable/14 - netlink: fix snl_writer and linear_buffer re-allocation logic List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 18fb9174cda527f107c072fb87aef72be4939da7 Auto-Submitted: auto-generated The branch stable/14 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=18fb9174cda527f107c072fb87aef72be4939da7 commit 18fb9174cda527f107c072fb87aef72be4939da7 Author: Igor Ostapenko AuthorDate: 2023-12-12 18:26:21 +0000 Commit: Kristof Provost CommitDate: 2023-12-27 21:01:38 +0000 netlink: fix snl_writer and linear_buffer re-allocation logic - Use the correct base pointer after re-allocation to avoid buffer overflows. - Maintain correct snl_writer.size, which avoids redundant memory allocation, e.g. a need for ~1k bytes may end up with ~32k linear_buffer actually allocated. This fixes a pfctl regression at least for armv7 after the addrule logic migration to netlink: ffbf25951e7b ("pf: convert rule addition to netlink") The add rule command creates a bigger than default size netlink requests which triggers the re-allocation logic. Reviewed by: kp MFC after: 2 weeks Differnetial Revision: https://reviews.freebsd.org/D43003 (cherry picked from commit 0c511bafdd5b309505c13c8dc7c6816686d1e103) --- sys/netlink/netlink_snl.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/sys/netlink/netlink_snl.h b/sys/netlink/netlink_snl.h index 8bb7b076b7b7..7bdf5424ddf3 100644 --- a/sys/netlink/netlink_snl.h +++ b/sys/netlink/netlink_snl.h @@ -1036,19 +1036,23 @@ snl_realloc_msg_buffer(struct snl_writer *nw, size_t sz) if (nw->error) return (false); - void *new_base = snl_allocz(nw->ss, new_size); - if (new_base == NULL) { + if (snl_allocz(nw->ss, new_size) == NULL) { nw->error = true; return (false); } + nw->size = new_size; - memcpy(new_base, nw->base, nw->offset); - if (nw->hdr != NULL) { - int hdr_off = (char *)(nw->hdr) - nw->base; + void *new_base = nw->ss->lb->base; + if (new_base != nw->base) { + memcpy(new_base, nw->base, nw->offset); + if (nw->hdr != NULL) { + int hdr_off = (char *)(nw->hdr) - nw->base; - nw->hdr = (struct nlmsghdr *)(void *)((char *)new_base + hdr_off); + nw->hdr = (struct nlmsghdr *) + (void *)((char *)new_base + hdr_off); + } + nw->base = new_base; } - nw->base = new_base; return (true); } From nobody Wed Dec 27 21:06:17 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T0khV4xPQz56KLY; Wed, 27 Dec 2023 21:06: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T0khV00jDz4Z3P; Wed, 27 Dec 2023 21:06:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703711178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1UXOfmRX4jiSe4JYeOzft46ZD75CKYzcqo/6h+CXyF0=; b=HTfhWUFfV8mRwFa3Kw/aeayKgj205B+8H/oRP9MpG/oyWm0KmRy1Qcsv/AAhTthiAD8dr4 2CqtyWQInqth4yraWEC8Tm+j+g3yOzTiqFEquqZJN2PkRYnV9nIr3hrS90PLph10XcedYG KJLH3J5pkNTNLC1Cv03gSQcSUloIBzWOW8tgrtu92CAIll0huoTupw3KprmC1oORC1VnHl tReBGs0u6qi/Y+/wjD9h6L7/7HuV5G6UcSyA52epEvQ1YFmrhdyRP5kKhCzWY10Nl17xb1 D9cyjjuZeuR0RieNRtzAXX6IZXRb+kv5vR2eJ2P4rl1OTtCsnVIQ1bYFW6nQsg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703711178; a=rsa-sha256; cv=none; b=WBmt8/hl+dUaPd38WuHfmt2YMtcaaKXSrBEKLtlrnT8anTi62F6VQRGA2kBX0bwzBebhGH JmQxZYTDiduOD9Io1uPYZriT7wYTqYj8mzbBZuZDBdUVNAVz68JPv/V2V3HL0VSSyviP5v tDgDY3rp1KE+6QybpLgG+KpG9VxLc9qyESW4cy375eWIiIOwmQhLObs1OhGef7PzzQzrWM ax2rFDXFIYTffeq6Kb/69BsaMaXOlWFuAZu6IGS9EFnQChhknQrH8DVbuEPn+MqIZjCfLh 4n95VUOO3Mny9Q2JF+RGcaar/IFV8hl1iwbhU44Q5Ifm+27VHHBisUp+qZyeag== 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=1703711178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1UXOfmRX4jiSe4JYeOzft46ZD75CKYzcqo/6h+CXyF0=; b=tBk8IKXbiCVkww/DvDLw13opCmiRjkJFJyHpODdc/WHr310JLt+kYN5btDsaWBE0xtWxHY FD6oc0gIblQvI0aMldWLuMMCJELTLkbCAlFZoo50r4cUXUKqAl+Lc7iHKAxzPtE2A6Do+O peL5fO2uwEZg6S1JOi7BGVxr1uCLlV+ee25pygbPfa4qkUMeRRE6T6VWJfZa6tf2AvTj4P rARG/NxxoOdc7jlV+5t4f518VIESm7o8G3t3Tv6Gvy7tyICP+3cj6LJJPesfuJgqU5evq7 7Y/vX7V3jJL/I/gmYMqH+QenkGHw3LyhRkdRNIlzCoQGPtnDXk9WQcTTzj/wGw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T0khT6BJwztwv; Wed, 27 Dec 2023 21:06:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BRL6H94036394; Wed, 27 Dec 2023 21:06:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BRL6Hf4036391; Wed, 27 Dec 2023 21:06:17 GMT (envelope-from git) Date: Wed, 27 Dec 2023 21:06:17 GMT Message-Id: <202312272106.3BRL6Hf4036391@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: c92ac2c311c6 - stable/13 - netlink: fix snl_writer and linear_buffer re-allocation logic List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c92ac2c311c6fe18d57dd4395c75686f0e053a87 Auto-Submitted: auto-generated The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c92ac2c311c6fe18d57dd4395c75686f0e053a87 commit c92ac2c311c6fe18d57dd4395c75686f0e053a87 Author: Igor Ostapenko AuthorDate: 2023-12-12 18:26:21 +0000 Commit: Kristof Provost CommitDate: 2023-12-27 20:53:21 +0000 netlink: fix snl_writer and linear_buffer re-allocation logic - Use the correct base pointer after re-allocation to avoid buffer overflows. - Maintain correct snl_writer.size, which avoids redundant memory allocation, e.g. a need for ~1k bytes may end up with ~32k linear_buffer actually allocated. This fixes a pfctl regression at least for armv7 after the addrule logic migration to netlink: ffbf25951e7b ("pf: convert rule addition to netlink") The add rule command creates a bigger than default size netlink requests which triggers the re-allocation logic. Reviewed by: kp MFC after: 2 weeks Differnetial Revision: https://reviews.freebsd.org/D43003 (cherry picked from commit 0c511bafdd5b309505c13c8dc7c6816686d1e103) --- sys/netlink/netlink_snl.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/sys/netlink/netlink_snl.h b/sys/netlink/netlink_snl.h index 78d0f75333e3..8c31c5d31671 100644 --- a/sys/netlink/netlink_snl.h +++ b/sys/netlink/netlink_snl.h @@ -714,18 +714,23 @@ snl_realloc_msg_buffer(struct snl_writer *nw, size_t sz) if (nw->error) return (false); - void *new_base = snl_allocz(nw->ss, new_size); - if (new_base == NULL) { + if (snl_allocz(nw->ss, new_size) == NULL) { nw->error = true; return (false); } + nw->size = new_size; - memcpy(new_base, nw->base, nw->offset); - if (nw->hdr != NULL) { - int hdr_off = (char *)(nw->hdr) - nw->base; - nw->hdr = (struct nlmsghdr *)(void *)((char *)new_base + hdr_off); + void *new_base = nw->ss->lb->base; + if (new_base != nw->base) { + memcpy(new_base, nw->base, nw->offset); + if (nw->hdr != NULL) { + int hdr_off = (char *)(nw->hdr) - nw->base; + + nw->hdr = (struct nlmsghdr *) + (void *)((char *)new_base + hdr_off); + } + nw->base = new_base; } - nw->base = new_base; return (true); } From nobody Thu Dec 28 03:01:06 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T0tYt6VDGz551fg; Thu, 28 Dec 2023 03:01: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T0tYt5KNSz3YkB; Thu, 28 Dec 2023 03:01:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703732466; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gnyDhiHEaoOLzhIVvxJg2yTj/NKPTKwyqCQ5h8AP398=; b=Na70VKXu6A9Po9FSuxajuU9k6yTdCVl6riiBSnj2pfPYc14IHO+6d1wVqWqNxCm5JqM96e vOXyAGABxonYB//ocWTi6lXCIY3BR0mCZPDmheITsRX8PvEUoDR6nTQPnGA11faCHZuvym Mnaw6JB96h0PJHu4vvsoPj8KN/9X/hms+vydf9PJmi9SwL3SNPfc0G1ghyI4pDbr2QvnFr Sskv+OB9y0Xy1aFuMp1v0/vJmYwmJhnAJDY5fqOMROm/hUv+tKrcMH6Tp2xTnLWTceIn1T LWzPApXot+gWRVrH8jpfNc2ZGkjWxxZfvqzwc6rEqJ/IFGdLFDQjuYfRdQharw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703732466; a=rsa-sha256; cv=none; b=q5RNsIAd5hH/kzZkDfJWR1QYxmuzIYgaeLDW57BsLrYMugxebHdN6OiEEiqgQPhDJzsK3+ +dqD9M+DiP0JiN+Ea9IP8j3DP4IqeJwYiqkLXCs1GbVXmC/n+KLw/1veeCbnVNO2jI8K1B /rCzW6f8X4vVtALA9XHfQv6Nsf456S3KkPpE6RtNjW2KfCXQj6a28b1SGXaVi5X+zB/A1S K4cTfW4hsSZvPvFzhW76UPEtzE+/diIgHNdzwNpcLzN5FvBKZ+AVes9xRkdzW+vaHyf1jE BZWrI2YGqA/64ptj72ReDtK3nucI3omYl0TnSL+/yBAfn1c2sqe7vqOsW+zLIw== 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=1703732466; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gnyDhiHEaoOLzhIVvxJg2yTj/NKPTKwyqCQ5h8AP398=; b=dAvcIUwfrsX6QlpWv7Bw03ex63biCOH6zhWd3pJJPUIMcnovotXlkG5cMaLw9dk2a00r3n l7aMGsgPkv3C+JQAPH3Dm4TzdXpsYDjX8gHA8ndm950D5Zym4X0zZUhuRL8o5mvJ1WtJEk zem1tb6JqhjTPFZkifDZvh5+tEXmOMIPv1PRdU0K9lvCLUSe3mpr6Xlq38hY8wQO+RYLSL vwhpRKdZjJaZqXdI0XADwxM9L30MVXn8D5Sq3vPv6KMlmzOyT6hzIcM0+ZDOyM9vI6+wLS seRLtMQytfhokW0NXrzGRoXJ2VXZ98CV2VJiSSj0cNFAj4rZDBBvP4lEPrm8Og== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T0tYt4Psbz14m4; Thu, 28 Dec 2023 03:01:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BS316Pr035647; Thu, 28 Dec 2023 03:01:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BS3168x035643; Thu, 28 Dec 2023 03:01:06 GMT (envelope-from git) Date: Thu, 28 Dec 2023 03:01:06 GMT Message-Id: <202312280301.3BS3168x035643@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 3e36ef48a063 - stable/14 - ufs: Update *eofflag upon a read of an unlinked directory List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 3e36ef48a0633271cbb913eee9b2562143db1da0 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3e36ef48a0633271cbb913eee9b2562143db1da0 commit 3e36ef48a0633271cbb913eee9b2562143db1da0 Author: Mark Johnston AuthorDate: 2023-12-21 18:26:13 +0000 Commit: Mark Johnston CommitDate: 2023-12-28 02:58:43 +0000 ufs: Update *eofflag upon a read of an unlinked directory If the directory is unlinked, no further entries will be returned, but we return no error. At least one caller (vn_dir_next_dirent()) asserts that a VOP_READDIR call which returns no error and no entries will set *eofflag != 0, so the current behaviour of UFS can trigger an assertion failure. Simply set *eofflag in this scenario. Reviewed by: olce, kib Reported by: syzkaller MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43089 (cherry picked from commit 3ff574c5e1d1d5d07763a14f22d6f9d7291550c6) --- sys/ufs/ufs/ufs_vnops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index ff1f2af7b65b..fcd5e7478cad 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -2419,8 +2419,10 @@ ufs_readdir( if (uio->uio_offset < 0) return (EINVAL); ip = VTOI(vp); - if (ip->i_effnlink == 0) + if (ip->i_effnlink == 0) { + *ap->a_eofflag = 1; return (0); + } if (ap->a_ncookies != NULL) { if (uio->uio_resid < 0) ncookies = 0; From nobody Thu Dec 28 03:01:07 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T0tYw1lpZz551XG; Thu, 28 Dec 2023 03:01: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T0tYv6L5zz3YmF; Thu, 28 Dec 2023 03:01:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703732467; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=siAo70XflxAeL3TtYkKoUg4J1WD53vAUAJZyydIxoLY=; b=wvIq7POcvCOXxMUI197ROuYggJF915sAayd2mk6zkoIhKwGh3pt5wBvVdcqFrOdxq0JBhr 46iW0pnvN11P5wLerQv3cXBvIW0yJbCMjiesvtDw6LrDJt6we6YH9It+GsUNTWzbpu7om3 aMkOTo15zj0VcfPfgmZsu2tXwt4d+xPorM5sUdkxO6u0pB/MgtAoaPa9Ha101+mMg1IO9W hfc9itoGgwGrnpSbJylumfl6jpympduTLsUYtMiYtX2DJT6u34QH/fUQi6q04lvWJNyqMN S9Lxn12IfBD/XvIMEzStLNYcyLketZSKXJ9v+87YkK1vh0Pe6Gu+DPlzbpGCyQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703732467; a=rsa-sha256; cv=none; b=pW2KLY5LrNoVkih4QbADmZxNwXoQeV7DCdG+vu2vtSvDXf1/96K3xS2M1utYE413WTGYMV GIBcZ8cJMJypE4T6Z1dXVCcCl2VoKMZcEdldsQ295zzSKSNfX+VZN0wwIQXIHwuA2GQrlq 10ydAULpjsfud+aaRrIFeoC9N0xnSBGC3+78gux5agpYQ7epMy6oSVleW+JsRWfu/TgqAX ChRzGJdBd9TBtf0yh1F3pEBvq7jPCRhA3KsPNqolEA2ZCydOsTunKQX2nbPdOhcqdb1yas TF7Fr15iNrsS/xDkk6YCoY9sHr9s0sHqU4Hv+Tl8WFflCyFlEGBiC5Ui9RiiUw== 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=1703732467; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=siAo70XflxAeL3TtYkKoUg4J1WD53vAUAJZyydIxoLY=; b=bqqXIMDc9jP0hJj9x+FZ7Pjn/wHZ7VKTqHe+Wgs3Zg0NI69t48PzHJufrZy14gzGWJZWtr wv45JCdA4Lh1GMc833KjSEarwBa8Y2IDyPHSkNPLlk0jzhuiL9YpqpyDGJQR9v8Xui51uQ UoNayRHBWRXr0wajtaUTW2qX1qLYbxNM8cwPmu0nxKWxXbextDnKAzLENk6NNSMYc3EddY okGoHwWYIWLpkmgi8k5Db8LTZeWyEStnfPB/waRTkSGZt/nR8q7oH5dG2NqPbklwgnIT2M mcQuqI+IdiRUZuTDJEvQonCHNjZE9OhcOf+ja4eJh3VdL+ZJdr1zgNhC6lD/dw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T0tYv5QSjz145x; Thu, 28 Dec 2023 03:01:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BS317T5035701; Thu, 28 Dec 2023 03:01:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BS317tV035698; Thu, 28 Dec 2023 03:01:07 GMT (envelope-from git) Date: Thu, 28 Dec 2023 03:01:07 GMT Message-Id: <202312280301.3BS317tV035698@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 137b36455d51 - stable/14 - freebsd32: Fix error handling for suword32() calls List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 137b36455d51f7303166bd4e1625b0bf969b9db5 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=137b36455d51f7303166bd4e1625b0bf969b9db5 commit 137b36455d51f7303166bd4e1625b0bf969b9db5 Author: Mark Johnston AuthorDate: 2023-12-21 16:51:29 +0000 Commit: Mark Johnston CommitDate: 2023-12-28 02:58:47 +0000 freebsd32: Fix error handling for suword32() calls suword32() returns -1 upon an error, not an errno value. MFC after: 1 week (cherry picked from commit bd1654ce92569bbfbe513749db08cdd781b3a036) --- sys/compat/freebsd32/freebsd32_capability.c | 5 +++-- sys/compat/freebsd32/freebsd32_misc.c | 5 ++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32_capability.c b/sys/compat/freebsd32/freebsd32_capability.c index 82db5da5898a..681e511a59de 100644 --- a/sys/compat/freebsd32/freebsd32_capability.c +++ b/sys/compat/freebsd32/freebsd32_capability.c @@ -117,9 +117,10 @@ freebsd32_cap_ioctls_get(struct thread *td, cmds = fdep->fde_ioctls; if (cmds32 != NULL && cmds != NULL) { for (i = 0; i < MIN(fdep->fde_nioctls, maxcmds); i++) { - error = suword32(&cmds32[i], cmds[i]); - if (error != 0) + if (suword32(&cmds32[i], cmds[i]) != 0) { + error = EFAULT; goto out; + } } } if (fdep->fde_nioctls == -1) diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index 2f5cf95b4e4a..5aafc459d60a 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -2700,9 +2700,8 @@ freebsd32___sysctlbyname(struct thread *td, &oldlen, uap->new, uap->newlen, &rv, SCTL_MASK32, 1); if (error != 0) return (error); - if (uap->oldlenp != NULL) - error = suword32(uap->oldlenp, rv); - + if (uap->oldlenp != NULL && suword32(uap->oldlenp, rv) != 0) + error = EFAULT; return (error); } From nobody Thu Dec 28 03:11:15 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T0tnb3ND5z552hR; Thu, 28 Dec 2023 03:11: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T0tnb2SNyz3bJ9; Thu, 28 Dec 2023 03:11:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703733075; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tvRUOHBRxvLcyE7xmf9BR3lpUlFqR0NABSNS2t41jzg=; b=ZhDTN+DDUS/wzhFpYKR/cA+pZoCgaaMJ5rO898EtNc6dm9Ty1F7hCI6/KpIkU8mEsf9lpi lN5SSF9dOZCQXAbxe8SFzWDP4s10EFPe+JLjv6sc87eSFkA1NM86W8lxaQqCbIPJ9sAMqI 7JKzQGpwzvuKsy/L0OF9G5+cUC2bhUDsjSrxvYvA0MBA+pwrTgQIUV2OuA9DeFbyUSeAhT 1mVChpON/hsDNpoqZHOi69pui5mHI/8WxGzI2n7MJ3n3NsKp8VQIoBO4m+KiYSCHG3mhRj HqgfryVNXUZ3XFx2xeO683CWbEaG+xsLw+2vZTaiQsKM2G0MuB11WPqfuD7noQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703733075; a=rsa-sha256; cv=none; b=D9H+BUPDv8IKm6JqkpGKyOGeXmVEGC0xlo8vqLFysrTXMpUtdJskSeJSWiC3/5Ta/wQVdf Ujs2w79Q5KeSl9K0VAJCS2QlcLOk9tcOjM63Eb3jloHN5/thZPp9iNCzFgPs2p2SW3zeDN eBnGwnEWP8V/060nVPsjMIPL0WaZVbmYCzFt7M6a2BfwyODgf28tJ6T6qey8hA8kJaftmF FBefHB/p0R1yc/4UstCwfV9k1yNOhnLkI6CaQtUG+wltji7O86h9nEqUVKlwEjRgMCaERB gPfDVxKUh2AHy0Ui1OS3R3Zx3+Q8uXElSdUiRT4XmWaux2X1CdSNE8k1GhGIkw== 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=1703733075; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tvRUOHBRxvLcyE7xmf9BR3lpUlFqR0NABSNS2t41jzg=; b=E6dkv8og4v4isXXSJ1NIx+E9k/0MeaiB/wRnMsfohCnXTu42KxGS/rHsYeFb7fcL/iN+7W MpFoAoW4l/PejBTb2uopnm3Wc2HaT61tJNIKFcQcp4AXBEcF6zSONwE8YltA9lWk8x9xt/ lb26q6pEb8SnKqCves0FaUnCBZHFCsHLXjkGxg0zHf2rI2V28zkWxGCM//TLRrOCwOdIQQ oKjbdkXhTqFYu2ybp30wpCitNv4DXmzC1pxYmm4G0lgpVZfyPbw4yt8y3+XADyT1DR2YI2 qGbdPgEJo00QxLSuJ1r08RyEjrxqtaM7wy9Mbe12gOLeocjzMElbaETiKo4tjQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T0tnb1Y9Zz14sJ; Thu, 28 Dec 2023 03:11:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BS3BF0M053100; Thu, 28 Dec 2023 03:11:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BS3BFhu053097; Thu, 28 Dec 2023 03:11:15 GMT (envelope-from git) Date: Thu, 28 Dec 2023 03:11:15 GMT Message-Id: <202312280311.3BS3BFhu053097@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: d2c1d1b2bc47 - stable/13 - kthread: Set *newtdp earlier in kthread_add1() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d2c1d1b2bc47e451a4cc77ca1a2b0d1648343110 Auto-Submitted: auto-generated The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d2c1d1b2bc47e451a4cc77ca1a2b0d1648343110 commit d2c1d1b2bc47e451a4cc77ca1a2b0d1648343110 Author: Mark Johnston AuthorDate: 2023-12-09 15:22:06 +0000 Commit: Mark Johnston CommitDate: 2023-12-28 03:01:26 +0000 kthread: Set *newtdp earlier in kthread_add1() syzbot reported a single boot-time crash in g_event_procbody(), a page fault when dereferencing g_event_td. g_event_td is initialized by the kproc_kthread_add() call which creates the GEOM event thread: kproc_kthread_add(g_event_procbody, NULL, &g_proc, &g_event_td, RFHIGHPID, 0, "geom", "g_event"); I believe that the caller of kproc_kthread_add() was preempted after adding the new thread to the scheduler, and before setting *newtdp, which is equal to g_event_td. Thus, since the first action of the GEOM event thread is to lock itself, it ended up dereferencing a NULL pointer. Fix the problem simply by initializing *newtdp earlier. I see no harm in that, and it matches kproc_create1(). The scheduler provides sufficient synchronization to ensure that the store is visible to the new thread, wherever it happens to run. Reported by: syzbot+5397f4d39219b85a9409@syzkaller.appspotmail.com Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D42986 (cherry picked from commit ae77041e0714627f9ec8045ca9ee2b6ea563138e) --- sys/kern/kern_kthread.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c index 6f7fd8b3d555..9cbc74658432 100644 --- a/sys/kern/kern_kthread.c +++ b/sys/kern/kern_kthread.c @@ -287,6 +287,13 @@ kthread_add1(void (*func)(void *), void *arg, struct proc *p, } oldtd = FIRST_THREAD_IN_PROC(p); + /* + * Set the new thread pointer before the thread starts running: *newtdp + * could be a pointer that is referenced by "func". + */ + if (newtdp != NULL) + *newtdp = newtd; + bzero(&newtd->td_startzero, __rangeof(struct thread, td_startzero, td_endzero)); bcopy(&oldtd->td_startcopy, &newtd->td_startcopy, @@ -331,8 +338,6 @@ kthread_add1(void (*func)(void *), void *arg, struct proc *p, thread_lock(newtd); sched_add(newtd, SRQ_BORING); } - if (newtdp) - *newtdp = newtd; return (0); } From nobody Thu Dec 28 03:11:16 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T0tnc62M8z552qJ; Thu, 28 Dec 2023 03:11: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T0tnc3SLnz3b8S; Thu, 28 Dec 2023 03:11:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703733076; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Yis0HX7vvYBNKrwSWEifjWchideNfQhJ9i070GAqF44=; b=TxGtfTGTvH0XSv1xo+7CEDFqyPOqodPuxg38Me3M8wRDwXEN+sjOjlQ8KFMlJKUF17QtP7 3ubYODdxVt9W/JofRLc7PBHBBVpA3WZq6zmcQs/zb78IhhaPoHz4Z8tTKAghy2zAh2PCZB TbVL/AJIm/CNPIlQAZ8RtdgfZjYr6PEBlmAcH9WT9Yf1kaUQOvhvVsCWTAtXhJtEIxIvdp m+yz3RASQiyUmv4QmfvFKoMiV9ZSR+17Gyqzy2qcWom3fdnYp0ZHmVAEQtR2cpuEivz24+ BGEfQ/Ywu4Nx0EQ2KY8/t0m9x3zNVUJWtYUZ4mp/lH89mDvZQ+gg3I9sfvgHjw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703733076; a=rsa-sha256; cv=none; b=Y8i+sOhZfes0tU8R9SdzKkG5OTMmIAWbsmPBAwJmvU9+/unkv3rD4QsNoqTD+nfktf0/00 3PV1TSrN+hJ4I6I3oRKAnjNLcaw3WL3hRhSiqBK7iw2tmGXFX2KMZtAi5RywvamnCtDSXl 7A3zc3tlloENrO4u1JAzgaJXpGdiUx07yW6qD/Ep6Q6oqMpKxREBztwOpWVNGdPNmWYSXE BX1VaATq3zkuQkYYAf2uf2fVXzDjcgfCXhhmVuiaYspRTOgdxLnBxbb37upOu+VLSWS8z4 M1KJ/hnezoz9znG8xkhfOJb2Y/p1/QDHBn9pZsuVhF46A+GsrpO3Oy7Fgg8z/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=1703733076; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Yis0HX7vvYBNKrwSWEifjWchideNfQhJ9i070GAqF44=; b=jG1myUwnH7Oy5JriEa4Y2oAtN083GuVdzbgIiEpsGLBNPKvWZMc30dsHLWrXYM9rIYEhTz 1w/o4l7zv5fnE/XmISOFcCw0DwzsU3y1yDLsre8KXo2x7FwW9dyOIgcxnmbjiaGGNUhXPu B1scP1BXz2bpCuWjdW0vC2WDpEX+jQuLymM5mUS19WG09PsYGhAx2RmWPk9x3V9gGycdII fT6u6ek9u1pXLnAgPk9NJ7mQ9nErLXn/VzcuXusIt+KGSo52LLfH6h4METigGWmke3IhyX CaS80nWOjiriaa3ff/j7UDwLtLdQzDiGqSbG8c7j8yHpq/LBHFh2Q6ASPQ22Gw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T0tnc2Y3kz155k; Thu, 28 Dec 2023 03:11:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BS3BGWJ053160; Thu, 28 Dec 2023 03:11:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BS3BGVP053157; Thu, 28 Dec 2023 03:11:16 GMT (envelope-from git) Date: Thu, 28 Dec 2023 03:11:16 GMT Message-Id: <202312280311.3BS3BGVP053157@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: f765ef3aabcd - stable/13 - ieee80211: Check for copyout() errors in the SIOCG80211STATS handler List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f765ef3aabcdfd69cb4501422906f0b30bc7de51 Auto-Submitted: auto-generated The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f765ef3aabcdfd69cb4501422906f0b30bc7de51 commit f765ef3aabcdfd69cb4501422906f0b30bc7de51 Author: Mark Johnston AuthorDate: 2023-12-19 03:44:54 +0000 Commit: Mark Johnston CommitDate: 2023-12-28 03:01:26 +0000 ieee80211: Check for copyout() errors in the SIOCG80211STATS handler In preparation for annotating copyin() and related functions with __result_use_check. Reviewed by: bz, emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43095 (cherry picked from commit d760d74dbed81638979e662130e24111b3a5db0d) --- sys/net80211/ieee80211_ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c index 35cfb139dd63..941338f2dc40 100644 --- a/sys/net80211/ieee80211_ioctl.c +++ b/sys/net80211/ieee80211_ioctl.c @@ -3635,8 +3635,8 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; case SIOCG80211STATS: ifr = (struct ifreq *)data; - copyout(&vap->iv_stats, ifr_data_get_ptr(ifr), - sizeof (vap->iv_stats)); + error = copyout(&vap->iv_stats, ifr_data_get_ptr(ifr), + sizeof(vap->iv_stats)); break; case SIOCSIFMTU: ifr = (struct ifreq *)data; From nobody Thu Dec 28 03:11:17 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T0tnd70tFz552f4; Thu, 28 Dec 2023 03:11: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T0tnd5cRlz3bKm; Thu, 28 Dec 2023 03:11:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703733077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QgFSi+7YEzrH7zXfSoIr8LDasOantmSHDgU763ESLX4=; b=tSHue8/RZDnCHuS0LKsBoF0GU4dXnl4cPrhQY2s3XQ7TwmZNL+eE2y9jZOdFSZnMU83iYJ tdGw0oQjZ55MoznVbmsWdZR4ra8RyAiXUjB/ux5j2bKFJegBRXvG8Z5RfVING/04YdWVib xmhu/6kHci3qtCbT+7WcQUiXe/Hcvn88W/qDvZhJ/ZdloPTH+ZCsGM+aSpmxDAgCmQnXHi t1ghcyL12P7/pflvep4eDZsO8gbciD0Qj2QUL+Qsg2Jk8SEiRs42GJ1ZYR3QILehoOwKNy P0P0h7sdNCHIsa26KcDtTNwpZCoSEXuOqlSH1r/coLESxMM0OdIq+IKFmwzkbw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703733077; a=rsa-sha256; cv=none; b=NCWj3M2RbZCWGskrd7xjgvjWtj1ddpLGVJ8k6TBhXAODWwxeVO3QNwPVz3INgo74PPCyTr A5YPh8UuAorvyK+lCbCZ5K4v1moLJirngOKXv/5DTOPcn/OKb5PnaRfq+3Ym26eNYscD0L URdVObDGSqjETUKr/q49ibTXqX6UYY/bmMgEp0w/IxQuZIgX2HZJjCCbFxo89sdxkM5BE3 J+QnAKdRVvqI5xra7/2rdsCP15oltNaEn05w67PnH4iBQpd5CKUH+4ovYhkmT4wLdlgZZH t+efe4bcZByT4QoDLEoBka3ZOFRXFpB/5scHUFEXEyAUiSfUVIAekLOjD7x5LA== 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=1703733077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QgFSi+7YEzrH7zXfSoIr8LDasOantmSHDgU763ESLX4=; b=PN5NZfSLODnNjlU4HGEg25SjqyzbiMfOT8hk9UF0zLVNiaEU/YfbRF5ehHLMuCjIeYhtFv l6txccJ+hvcQssbdlKbuA7ihXC6X5rRY9RAFSfJ8kWaZVN/XtGKd9DD8mgGfdUjk2tmsrO +ZXWn4rwDX3xUmnV/5aD5q9F/vv8zwUcTM9DHJngtuJEobwln1M2QIxnfuqmISN1yreLZy eTiKXA+GLzOByZhB+/HI9R6tR4LUl/jSZhpj9yeais6TcRb1QRAJaqPtfTcLItVxlUxP7K WbvRcpKyPa2hJFoS3UNLzKv44UFJmZHY4nqQGoQMZnWyKUunTUsmfrUL4bbnvw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T0tnd3dCtz15Kk; Thu, 28 Dec 2023 03:11:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BS3BHtO053217; Thu, 28 Dec 2023 03:11:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BS3BHgZ053214; Thu, 28 Dec 2023 03:11:17 GMT (envelope-from git) Date: Thu, 28 Dec 2023 03:11:17 GMT Message-Id: <202312280311.3BS3BHgZ053214@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: b525eaaa4aaf - stable/13 - ufs: Update *eofflag upon a read of an unlinked directory List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b525eaaa4aafeee857d1abef27d7ddf1af76846f Auto-Submitted: auto-generated The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b525eaaa4aafeee857d1abef27d7ddf1af76846f commit b525eaaa4aafeee857d1abef27d7ddf1af76846f Author: Mark Johnston AuthorDate: 2023-12-21 18:26:13 +0000 Commit: Mark Johnston CommitDate: 2023-12-28 03:04:22 +0000 ufs: Update *eofflag upon a read of an unlinked directory If the directory is unlinked, no further entries will be returned, but we return no error. At least one caller (vn_dir_next_dirent()) asserts that a VOP_READDIR call which returns no error and no entries will set *eofflag != 0, so the current behaviour of UFS can trigger an assertion failure. Simply set *eofflag in this scenario. Reviewed by: olce, kib Reported by: syzkaller MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43089 (cherry picked from commit 3ff574c5e1d1d5d07763a14f22d6f9d7291550c6) --- sys/ufs/ufs/ufs_vnops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 949e7bcc1bec..954f85e17a9f 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -2434,8 +2434,10 @@ ufs_readdir( if (uio->uio_offset < 0) return (EINVAL); ip = VTOI(vp); - if (ip->i_effnlink == 0) + if (ip->i_effnlink == 0) { + *ap->a_eofflag = 1; return (0); + } if (ap->a_ncookies != NULL) { if (uio->uio_resid < 0) ncookies = 0; From nobody Thu Dec 28 03:11:18 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T0tng0b67z552YP; Thu, 28 Dec 2023 03:11: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T0tnf6FPZz3b3T; Thu, 28 Dec 2023 03:11:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703733078; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lh8/SopQ25o5M1cL5ekN6vLnj+G+itfLG9F/OXpIynk=; b=tcxNctPudePMJqCSj02bSE9uSNFWaGPUwYf8Y+VPX1ex0cdAAI2xAlsMmgDLBlUVjCKxs7 TbqAV2Y4i2crLsQVKFe1Dl6gJrlhzC736HlNkpYfcPZSmfJybyST+xYjK5pPywXGYmykE9 tn3mLRJU/gBA4TzLNg7CvrQg8bpWsEzAIskh2e3Th8t6C+e4XqTiUew8uOuXZFtLLu4skl 0du51rAYlj8Vu/xMt7xd3zLX23IDhoqKLCtNibH8wtoUVT5N7rp52fJIPL9/DQ1yBvAHvZ TJ/Ej1MuOdxMu+aTHxWCaBoc5Qu8fHlLxjBCflrL+deLendK5gLkWUmvel+TRg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703733078; a=rsa-sha256; cv=none; b=YWwatJHhh0Dy+aCR5RtsqkW9LWLF4IH8X3ag5XwEk5BmW+4aG/LwMwKGQVaGmNVCCMl8cH ZXGaiorceyADQWerjN3fimntEgCBORz5OUp0GfAsvqNvfRO7SVcGi1npS6lvglWS3WPECU JicRL9L6BbnQJRFuTQCsFaWSvUr2od24tHFAb7wzxN/39jmYqkFAx+Fb+zq1fp/k/iE8fO 26wjnsuffKM7ozhSWvyYoZUEHYCsIpQP4xHFyOHqFtpdzyi6KDLJ0dANd3jGgf/VxXKMzG HtwTXWp4ifDbwrKMBuDau0Xe6LTzY6tCJAs2utz0pF2JBn71R/Qu4ZQHdx37Vg== 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=1703733078; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lh8/SopQ25o5M1cL5ekN6vLnj+G+itfLG9F/OXpIynk=; b=t1mx8tF6zq4xixWvdpC4748bD3sCpdl/Hma+TV2feFp+BNrT+8SiCEI1poDujiIYDOLSCN 9kKaZsgOVSciLN2ttw8IrznWOWFQ/WYg/jUhTUAuQKr3GMNktgJqE9kaFxwht6hEONDnYt FaLTBMCpxdmfi58GZ6ZMLITRf5crkA3mhitbBgeAr1s++QfraVzU7yNglhW/Y9+9UDbuTQ 8uAiH98Sru4FQ70E/A6zLF2xWVJzociXbb7qjRRX6mf9l8lMPpMPgg9jF+xfxxo2tFC1Lj l0rYliJ7LWj97S31fwyvDB0vlXdUjL9jFWCDJjj+lSxXvLOYat3/dzEUtPjQWA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T0tnf4fn7z14vq; Thu, 28 Dec 2023 03:11:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BS3BIxj053269; Thu, 28 Dec 2023 03:11:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BS3BIk6053266; Thu, 28 Dec 2023 03:11:18 GMT (envelope-from git) Date: Thu, 28 Dec 2023 03:11:18 GMT Message-Id: <202312280311.3BS3BIk6053266@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: c2ae37ad0ca9 - stable/13 - freebsd32: Fix error handling for suword32() calls List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c2ae37ad0ca9e77f9ddbdcaf0f3fc6ed4f5a5e53 Auto-Submitted: auto-generated The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c2ae37ad0ca9e77f9ddbdcaf0f3fc6ed4f5a5e53 commit c2ae37ad0ca9e77f9ddbdcaf0f3fc6ed4f5a5e53 Author: Mark Johnston AuthorDate: 2023-12-21 16:51:29 +0000 Commit: Mark Johnston CommitDate: 2023-12-28 03:04:23 +0000 freebsd32: Fix error handling for suword32() calls suword32() returns -1 upon an error, not an errno value. MFC after: 1 week (cherry picked from commit bd1654ce92569bbfbe513749db08cdd781b3a036) --- sys/compat/freebsd32/freebsd32_capability.c | 5 +++-- sys/compat/freebsd32/freebsd32_misc.c | 5 ++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32_capability.c b/sys/compat/freebsd32/freebsd32_capability.c index a5fb8f64a0fd..4a32e996cc75 100644 --- a/sys/compat/freebsd32/freebsd32_capability.c +++ b/sys/compat/freebsd32/freebsd32_capability.c @@ -117,9 +117,10 @@ freebsd32_cap_ioctls_get(struct thread *td, cmds = fdep->fde_ioctls; if (cmds32 != NULL && cmds != NULL) { for (i = 0; i < MIN(fdep->fde_nioctls, maxcmds); i++) { - error = suword32(&cmds32[i], cmds[i]); - if (error != 0) + if (suword32(&cmds32[i], cmds[i]) != 0) { + error = EFAULT; goto out; + } } } if (fdep->fde_nioctls == -1) diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index d708efcf91fe..65b7ddf83e3d 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -2568,9 +2568,8 @@ freebsd32___sysctlbyname(struct thread *td, &oldlen, uap->new, uap->newlen, &rv, SCTL_MASK32, 1); if (error != 0) return (error); - if (uap->oldlenp != NULL) - error = suword32(uap->oldlenp, rv); - + if (uap->oldlenp != NULL && suword32(uap->oldlenp, rv) != 0) + error = EFAULT; return (error); } From nobody Thu Dec 28 14:41:16 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T1B5m64pzz55xZc; Thu, 28 Dec 2023 14:41: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T1B5m5cgBz4g6T; Thu, 28 Dec 2023 14:41:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703774476; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=F8sWonuwEAe3Q0V686+5/ScPfRpdrCjqyQjunR58iuU=; b=kkEP91eJ8DGHDbiyO/nZOu7ztbTCt0aWmDfN9xfhmWL3wrzuAm4pIc9CkI1ZfEtJdKls0/ 4h//+AYbtE5fqP6WlURMC29MBh1c/ZO+7XD8O4u3KCtMtbsAjP0htrXBE2ak8l6fFuPLy3 KvpLG70ThQSGJCZSlMwxYQZ51X79iBopPiwt4yQbN9AHXt1x0wk+GEoq0gZAlZ+Qe6roc0 YQSVrNvadguRE7Cbzs2dkjegyDRAYWjhypD/AMAL3lKmMbNCLqq6Mlbsb5N1Qxunjx1QZC Zm7U2as07XVUkMM9nPnbooMnJbKYAwn38+7kusHrnO0W5PNkYYEQw6DVk7wh3A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703774476; a=rsa-sha256; cv=none; b=WPMhUFBJcrUG7D7fDZrr0qopQ3ThJthGAJOvzigcU1NQisL62OsTuvoIdzInE2i5DJaABB c7zaLOngmUzlZeCy2bmYgLZbBeXsJ50RiS+GPG720112/BFXAnNexow2lptvLBlRfStyVR Sn4u3mZ3In0SuoxVaE2FFvQJLvkXuRND+b+KIJlizwVy3u35mYrUpC6wPFiyxDoevdgT1M spmuQaTtakRSZkwvJYbrVHhSXH7q2zDSD1bqXONtYYNc84SG4SV5dbbr1lGHs+fiCr+sWD 5fnkwYe5Ara0q5g0iWDDHpUbf9bUbOLCIKazRmDvg6D7jMVxSFi+f3lcLS0lNg== 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=1703774476; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=F8sWonuwEAe3Q0V686+5/ScPfRpdrCjqyQjunR58iuU=; b=LhPw3kfxHYkp7xMreKqYOq02F43WDYrxF1qxPunzSOlZpEYgVjgoMNSAWOO9Ho1yarD2tc /UEmdMnICsdT9QXL3WhxpdoT7dvAy9JVuDD/LMu5vcH+/DjMZHDxVtkySb8GC/+GoZtd6D H8igaRg+bhIu6SZwI6q7ZrydSHFqBqR3PUnFI1vu4tYPQHYWbcsXIl0xIFsAwG7rz6GaQb Hd/LeTqiYgnnnxUNPF0xPwVImYowJCfLYr+sSvZO+nHeTbFyRhTcX25i+LcJE0wxv2kcSR z31Ts8o8hEIn2xOUrhYWkeXFXwH2137WGuaL0Xj7KNzTwJ56hsjEWlX/FdVG0Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T1B5m4gh9zC8t; Thu, 28 Dec 2023 14:41:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BSEfGXK013640; Thu, 28 Dec 2023 14:41:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BSEfGUl013637; Thu, 28 Dec 2023 14:41:16 GMT (envelope-from git) Date: Thu, 28 Dec 2023 14:41:16 GMT Message-Id: <202312281441.3BSEfGUl013637@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ronald Klop Subject: git: 028e4c6548e4 - stable/14 - Teach if_smsc to get MAC from bootargs. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ronald X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 028e4c6548e44f3d37210f0087bafb29d49704be Auto-Submitted: auto-generated The branch stable/14 has been updated by ronald: URL: https://cgit.FreeBSD.org/src/commit/?id=028e4c6548e44f3d37210f0087bafb29d49704be commit 028e4c6548e44f3d37210f0087bafb29d49704be Author: Ronald Klop AuthorDate: 2023-11-04 14:14:00 +0000 Commit: Ronald Klop CommitDate: 2023-12-28 14:40:31 +0000 Teach if_smsc to get MAC from bootargs. Some Raspberry Pi pass smsc95xx.macaddr=XX:XX:XX:XX:XX:XX as bootargs. Use this if no ethernet address is found in an EEPROM. As last resort fall back to ether_gen_addr() instead of random MAC. (cherry picked from commit 3878bbf1bb9e68f8579b57cde7d4e5c77de93320) if_smsc: fix build on armv6 & armv7 compile error was: /usr/src/sys/dev/usb/net/if_smsc.c:1597:40: error: format specifies type 'unsigned long' but the argument has type 'ssize_t' (aka 'int') [-Werror,-Wformat] "failed alloc for bootargs (%lu)", len); ~~~ ^~~ %zd (cherry picked from commit 8a0ee306227a17a998bdc7af2275fd94b9164342) PR: 274092 Reported by: Patrick M. Hausen (via ML) Reviewed by: imp, karels, zlei Tested by: Patrick M. Hausen Approved by: karels Relnotes: yes Differential Revision: https://reviews.freebsd.org/D42463 --- sys/dev/usb/net/if_smsc.c | 86 +++++++++++++++++++++++++++++++++++++++++++++-- sys/net/ethernet.h | 1 + sys/net/if_ethersubr.c | 10 ++++-- 3 files changed, 92 insertions(+), 5 deletions(-) diff --git a/sys/dev/usb/net/if_smsc.c b/sys/dev/usb/net/if_smsc.c index ec8197229f17..a59501b6bbff 100644 --- a/sys/dev/usb/net/if_smsc.c +++ b/sys/dev/usb/net/if_smsc.c @@ -179,6 +179,8 @@ static const struct usb_device_id smsc_devs[] = { #define ETHER_IS_VALID(addr) \ (!ETHER_IS_MULTICAST(addr) && !ETHER_IS_ZERO(addr)) +#define BOOTARGS_SMSC95XX "smsc95xx.macaddr" + static device_probe_t smsc_probe; static device_attach_t smsc_attach; static device_detach_t smsc_detach; @@ -1538,6 +1540,76 @@ smsc_ioctl(if_t ifp, u_long cmd, caddr_t data) return (rc); } +#ifdef FDT +static bool +smsc_get_smsc95xx_macaddr(char* bootargs, size_t len, struct usb_ether *ue) +{ + int values[6]; + int i; + char* p; + + p = strnstr(bootargs, BOOTARGS_SMSC95XX, len); + if (p == NULL) + return (false); + + if (sscanf(p, BOOTARGS_SMSC95XX "=%x:%x:%x:%x:%x:%x%*c", + &values[0], &values[1], &values[2], + &values[3], &values[4], &values[5]) != 6) { + smsc_warn_printf((struct smsc_softc *)ue->ue_sc, + "invalid mac from bootargs '%s'.\n", p); + return (false); + } + + for (i = 0; i < ETHER_ADDR_LEN; ++i) + ue->ue_eaddr[i] = values[i]; + + smsc_dbg_printf((struct smsc_softc *)ue->ue_sc, + "bootargs mac=%6D.\n", ue->ue_eaddr, ":"); + return (true); +} + +/** + * Raspberry Pi is known to pass smsc95xx.macaddr=XX:XX:XX:XX:XX:XX via + * bootargs. + */ +static bool +smsc_bootargs_get_mac_addr(device_t dev, struct usb_ether *ue) +{ + char *bootargs; + ssize_t len; + phandle_t node; + + /* only use bootargs for the first device + * to prevent duplicate mac addresses */ + if (device_get_unit(dev) != 0) + return (false); + node = OF_finddevice("/chosen"); + if (node == -1) + return (false); + if (OF_hasprop(node, "bootargs") == 0) { + smsc_dbg_printf((struct smsc_softc *)ue->ue_sc, + "bootargs not found"); + return (false); + } + len = OF_getprop_alloc(node, "bootargs", (void **)&bootargs); + if (len == -1 || bootargs == NULL) { + smsc_warn_printf((struct smsc_softc *)ue->ue_sc, + "failed alloc for bootargs (%zd)", len); + return (false); + } + smsc_dbg_printf((struct smsc_softc *)ue->ue_sc, "bootargs: %s.\n", + bootargs); + if (!smsc_get_smsc95xx_macaddr(bootargs, len, ue)) { + OF_prop_free(bootargs); + return (false); + } + OF_prop_free(bootargs); + device_printf(dev, "MAC address found in bootargs %6D.\n", + ue->ue_eaddr, ":"); + return (true); +} +#endif + /** * smsc_attach_post - Called after the driver attached to the USB interface * @ue: the USB ethernet device @@ -1552,8 +1624,10 @@ static void smsc_attach_post(struct usb_ether *ue) { struct smsc_softc *sc = uether_getsc(ue); + struct ether_addr eaddr; uint32_t mac_h, mac_l; int err; + int i; smsc_dbg_printf(sc, "smsc_attach_post\n"); @@ -1585,11 +1659,17 @@ smsc_attach_post(struct usb_ether *ue) #ifdef FDT if ((err != 0) || (!ETHER_IS_VALID(sc->sc_ue.ue_eaddr))) err = usb_fdt_get_mac_addr(sc->sc_ue.ue_dev, &sc->sc_ue); + if ((err != 0) || (!ETHER_IS_VALID(sc->sc_ue.ue_eaddr))) + err = smsc_bootargs_get_mac_addr(sc->sc_ue.ue_dev, + &sc->sc_ue) ? (0) : (1); #endif if ((err != 0) || (!ETHER_IS_VALID(sc->sc_ue.ue_eaddr))) { - read_random(sc->sc_ue.ue_eaddr, ETHER_ADDR_LEN); - sc->sc_ue.ue_eaddr[0] &= ~0x01; /* unicast */ - sc->sc_ue.ue_eaddr[0] |= 0x02; /* locally administered */ + smsc_dbg_printf(sc, "No MAC address found." + " Using ether_gen_addr().\n"); + ether_gen_addr_byname(device_get_nameunit(ue->ue_dev), + &eaddr); + for (i = 0; i < ETHER_ADDR_LEN; i++) + sc->sc_ue.ue_eaddr[i] = eaddr.octet[i]; } } diff --git a/sys/net/ethernet.h b/sys/net/ethernet.h index fca6748a0da7..e7313e78c5bb 100644 --- a/sys/net/ethernet.h +++ b/sys/net/ethernet.h @@ -448,6 +448,7 @@ struct mbuf *ether_vlanencap_proto(struct mbuf *, uint16_t, uint16_t); bool ether_8021q_frame(struct mbuf **mp, struct ifnet *ife, struct ifnet *p, const struct ether_8021q_tag *); void ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr); +void ether_gen_addr_byname(const char *nameunit, struct ether_addr *hwaddr); static __inline struct mbuf *ether_vlanencap(struct mbuf *m, uint16_t tag) { diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 2cbe0ea98f27..4a726831a3db 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1489,7 +1489,7 @@ ether_8021q_frame(struct mbuf **mp, struct ifnet *ife, struct ifnet *p, * allocate non-locally-administered addresses. */ void -ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr) +ether_gen_addr_byname(const char *nameunit, struct ether_addr *hwaddr) { SHA1_CTX ctx; char *buf; @@ -1508,7 +1508,7 @@ ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr) /* If each (vnet) jail would also have a unique hostuuid this would not * be necessary. */ getjailname(curthread->td_ucred, jailname, sizeof(jailname)); - sz = asprintf(&buf, M_TEMP, "%s-%s-%s", uuid, if_name(ifp), + sz = asprintf(&buf, M_TEMP, "%s-%s-%s", uuid, nameunit, jailname); if (sz < 0) { /* Fall back to a random mac address. */ @@ -1537,5 +1537,11 @@ rando: hwaddr->octet[0] |= 0x02; } +void +ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr) +{ + ether_gen_addr_byname(if_name(ifp), hwaddr); +} + DECLARE_MODULE(ether, ether_mod, SI_SUB_INIT_IF, SI_ORDER_ANY); MODULE_VERSION(ether, 1); From nobody Thu Dec 28 17:20:10 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T1Fd72Bx4z56C9k; Thu, 28 Dec 2023 17:20: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T1Fd701Fmz3ZXC; Thu, 28 Dec 2023 17:20:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703784011; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DnNHHXFCkObcIFcT7gFgTs0m6K9U7Wu2Qy6fpEEf7oA=; b=qyr9sq0B0XdUjHtGlCPniSpP9lGvoRZ9ofPpW0pSUWkDYvKfc/DN6bwXECMEPE3Exw+Zcz 1vajkoravuANp5kjHrGwLe+G54FuSg6g9eIhIg6dEiIoNx1I4myhN9PMq5R4NlmFVPD19j cykb48SqhwOedMPkQlqsJsSTHBr2tGdyqCvKSQ4hncf6gSj9PzMZ35i/MiBBZJ1cw3OScZ eQmHSsoIlYweK87TLB7r4KXqKMBmMyonUADgj8e82HczafYay/Mt/mPmEOSsEg1rj8lnck 5w22bA2ZxTcimQDpBQdyG/8mNh5dX2R4dW22fmdsPwS5ou6lctE3iCxsFN7daA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703784011; a=rsa-sha256; cv=none; b=xWQl64VCcl8zEy1eSvMVA2aerh59/ONGfBg6EEEB/pv/1ChVXH7UVJ8I7FBWDjN0NXB4xr gdeYAwxBjOJ4RBQE34sIjvH2i/674H0gDjSD7eHr9C1RQuquZ2+wjEhGs8sAIEfQ2PL+Hd g+Aov2kLrfRANKokJdqVDV4Ffu2YyoWmZCTQwFRu8/GYdJMQPoevu6Zhx7J+uE4OcXtxZd dR/sQIv8vRwXZ5seZCoS6dkrISKI2fvsX5jBZdfv4/FbmO/dx9qfFH+P6El57s9HyoRo3j juPKJH8VuqyxiXqVAEEuP+L4c68mEgDkX7/Npu/7ymNWYgO03qhLBFkPTUaEJA== 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=1703784011; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DnNHHXFCkObcIFcT7gFgTs0m6K9U7Wu2Qy6fpEEf7oA=; b=QttoGYgTtNi7EiJXXrE4nMvbTGfHX/0cYkn73hLPlB8i9xtjK99FToDs/C3brW5+OeBwNw IexpigNKzOg0TKomgKLTfE/+IZY+6RYAXHaB6BCbnH8BzoXvs5TcDkIKszcd4u1EUYX/pf rBcGh1OzXZIXRxnic0imJQpDXq7KStaKWLdSZ9EGCz6Kk/8K5U/jkA6AWwYJQi/vAnDcKu Ui5EsPYYM3Yqs76taby7mAzo7PDNQvn9OqhT+MAkvE/k281h8FcteH6inHGNKzL9LTETeg PKk/G0W/iAeCa2Sb+x38+w8mVSWJytZstcEa8ZuYMuioB3/iHU7xKbZehF9vQA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T1Fd665gYzXF3; Thu, 28 Dec 2023 17:20:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BSHKAGV078051; Thu, 28 Dec 2023 17:20:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BSHKA5S078042; Thu, 28 Dec 2023 17:20:10 GMT (envelope-from git) Date: Thu, 28 Dec 2023 17:20:10 GMT Message-Id: <202312281720.3BSHKA5S078042@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Robert Clausecker Subject: git: c35334b08561 - stable/14 - lib/libc/tests/string: add extended unit tests for strcmp() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: c35334b085616c8ad9a567a04cb1a5cbf6b76a80 Auto-Submitted: auto-generated The branch stable/14 has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=c35334b085616c8ad9a567a04cb1a5cbf6b76a80 commit c35334b085616c8ad9a567a04cb1a5cbf6b76a80 Author: Robert Clausecker AuthorDate: 2023-09-22 20:42:00 +0000 Commit: Robert Clausecker CommitDate: 2023-12-28 17:02:40 +0000 lib/libc/tests/string: add extended unit tests for strcmp() This changeset add a new set of tests that comprehensively test strcmp() on various alignments of the input. This made it easy to smoke out many exciting new bugs in the new SSE strcmp() implementation from D41971. MFC after: 1 week Reviewed by: ngie Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D41970 (cherry picked from commit b49596de2622a51e5673ba2c0b3718cd88a2aa41) --- lib/libc/tests/string/Makefile | 2 + lib/libc/tests/string/strcmp_test.c | 132 ++++++++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+) diff --git a/lib/libc/tests/string/Makefile b/lib/libc/tests/string/Makefile index 1994b128ab57..e9b066cacac7 100644 --- a/lib/libc/tests/string/Makefile +++ b/lib/libc/tests/string/Makefile @@ -11,6 +11,7 @@ ATF_TESTS_C+= flsll_test ATF_TESTS_C+= memcmp_test ATF_TESTS_C+= memset_s_test ATF_TESTS_C+= stpncpy_test +ATF_TESTS_C+= strcmp2_test ATF_TESTS_C+= strcspn_test ATF_TESTS_C+= strerror2_test ATF_TESTS_C+= strspn_test @@ -37,6 +38,7 @@ NETBSD_ATF_TESTS_C+= strpbrk_test NETBSD_ATF_TESTS_C+= strrchr_test NETBSD_ATF_TESTS_C+= swab_test +SRCS.strcmp2_test= strcmp_test.c SRCS.strerror2_test= strerror_test.c .include "../Makefile.netbsd-tests" diff --git a/lib/libc/tests/string/strcmp_test.c b/lib/libc/tests/string/strcmp_test.c new file mode 100644 index 000000000000..75ebcbcadda2 --- /dev/null +++ b/lib/libc/tests/string/strcmp_test.c @@ -0,0 +1,132 @@ +/*- + * Copyright (c) 2023 The FreeBSD Foundation + * + * This software was developed by Robert Clausecker + * under sponsorship from the FreeBSD Foundation. + * + * 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 + +int (*volatile strcmp_fn)(const char *, const char *); + +ATF_TC(strcmp_alignments); +ATF_TC_HEAD(strcmp_alignments, tc) +{ + atf_tc_set_md_var(tc, "descr", "Test strcmp(3) with various alignments"); +} + +static void +alignment_testcase(char *a, char *b, int want) +{ + int res; + + res = strcmp_fn(a, b); + ATF_CHECK_MSG(want == (res > 0) - (res < 0), + "strcmp(%p \"%s\", %p \"%s\") = %d != %d", + (void *)a, a, (void *)b, b, res, want); +} + +static void +check_strcmp_alignments(char a[], char b[], + size_t a_off, size_t b_off, size_t len, size_t pos) +{ + char *a_str, *b_str, a_orig, b_orig; + + a[a_off] = '\0'; + b[b_off] = '\0'; + + a_str = a + a_off + 1; + b_str = b + b_off + 1; + + a_str[len] = '\0'; + b_str[len] = '\0'; + a_str[len+1] = 'A'; + b_str[len+1] = 'B'; + + a_orig = a_str[pos]; + b_orig = b_str[pos]; + + alignment_testcase(a_str, b_str, 0); + + if (pos < len) { + a_str[pos] = '\0'; + alignment_testcase(a_str, b_str, -1); + a_str[pos] = a_orig; + b_str[pos] = '\0'; + alignment_testcase(a_str, b_str, 1); + b_str[pos] = b_orig; + } + + a_str[pos] = 'X'; + alignment_testcase(a_str, b_str, 1); + a_str[pos] = a_orig; + b_str[pos] = 'X'; + alignment_testcase(a_str, b_str, -1); + b_str[pos] = b_orig; + + a[a_off] = '-'; + b[b_off] = '-'; + a_str[len] = '-'; + b_str[len] = '-'; + a_str[len+1] = '-'; + b_str[len+1] = '-'; +} + +ATF_TC_BODY(strcmp_alignments, tc) +{ + size_t a_off, b_off, len, pos; + /* 16B alignment offset + 64B buffer + sentinel before/after + NUL */ + char a[64+16+3], b[64+16+3]; + + memset(a, '-', sizeof(a)); + memset(b, '-', sizeof(b)); + a[sizeof(a) - 1] = '\0'; + b[sizeof(b) - 1] = '\0'; + + /* check alignment offsets relevant for SSE routines */ + for (a_off = 0; a_off < 16; a_off++) + for (b_off = 0; b_off < 16; b_off++) + /* ensure main loop (@ 32B) is completed at least once */ + for (len = 1; len <= 64; len++) + for (pos = 0; pos <= len; pos++) + check_strcmp_alignments(a, b, a_off, b_off, len, pos); +} + +ATF_TP_ADD_TCS(tp) +{ + void *dl_handle; + + dl_handle = dlopen(NULL, RTLD_LAZY); + strcmp_fn = dlsym(dl_handle, "test_strcmp"); + if (strcmp_fn == NULL) + strcmp_fn = strcmp; + + ATF_TP_ADD_TC(tp, strcmp_alignments); + + return atf_no_error(); +} From nobody Thu Dec 28 17:20:11 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T1Fd81XWbz56CGf; Thu, 28 Dec 2023 17:20: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T1Fd80cMQz3ZlM; Thu, 28 Dec 2023 17:20:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703784012; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bB5yP0ojpzczIwYpPk2ytLfzTk0ir+ZDxSX6Ozaer4k=; b=jTIyFiVLlj4kfCYCNyh2QcShh701cHwCpUbHMstfUfDnyibW4UCe+Ae10oy3vyHiRlfv/P tpqYUhQYc7VWkRbWTZUJCBu/PXCZc3a5br/KLVlgVLmNzV3ZIE+0HcJFx/tOfYrzC3GoxJ DGDRetEu0bWGFLYNT3ci/gv0ww7vbjmYZGbjHtvUuT8Ot2Enj90zg371l+ODfWehQlN0mx V7nspJwoiiprUIUbVNcxbhQyledeehMz1zK3QEYpYQqMZzdNgG6gTTaNvqv/OTYvS6jyJi 5MvIgnq/QQxWwI306ynGW9dnOcwkU45sAFs5npIl8vkWx89Te82rr3CKHIDI+A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703784012; a=rsa-sha256; cv=none; b=cus1JlBjhr/iP7VnEDUCNh1usWzZhTAs95rdFVPwbAvJuSZ0sboqAwe+9sSRls5gTcCbiC rkVlssFBp9X1COSBC+LZXUL0WMmGMvCSe5Co8O47OFw+6kxZ/6CBoh8qyzW9csjAUqiwRC HV+p4qXzX7R/Q6TkRofDDflXko7+bq3MmIh8yFDv0XO0/tuuHqeZwlrkoH9GTb5tcsMDA2 EsjQQkTIp4/VbJ6HSNJgjBLTdB/Q1husk0cGswKn+aaV1vcfCzhBYCjjM4vtvGosnZWO0s hQeYQy9tosfk3wEoK3sHk19sgMSQpTx34E+aBEv8RAJWugwQirZKgrjNDk5fMg== 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=1703784012; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bB5yP0ojpzczIwYpPk2ytLfzTk0ir+ZDxSX6Ozaer4k=; b=mXvPjAykfwLfmne8FHW/q5rW4y9idWHo1eswKCmx5ee0TJ8ynamXchmVNWRg79IcVpVMS1 OmhXYsFgGbLbakFQw38aTkCS5b8QcItFpNcE9xEhs3uRIEUK4emf9DNRmctvW65L1G3vIH xtoZtSneInpeEr4OX/AWvdBcNXDM4s0xjPhDVHEhwqGxjtd2MF1MRNog9PYWDCpkBYn5Ew ZpQ1Uxpp5S5nREFbgu39yeHVHbXYPEZI0+1fdZjgRReYHENCgYViAq5WDOJ3QlT9Uf6/Yt 9/HPZhEPbUUxLG0t6UNAZfacuuBl/aPTD0TdMmUpB5WjwvLBDHG2Vn6oEvEsCQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T1Fd76gRVzXF4; Thu, 28 Dec 2023 17:20:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BSHKBcd078711; Thu, 28 Dec 2023 17:20:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BSHKBeF078702; Thu, 28 Dec 2023 17:20:11 GMT (envelope-from git) Date: Thu, 28 Dec 2023 17:20:11 GMT Message-Id: <202312281720.3BSHKBeF078702@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Robert Clausecker Subject: git: 7aaa37fa1db6 - stable/14 - lib/libc/tests/string/memcmp_test.c: extend test to support custom memcmp function List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 7aaa37fa1db603fe10143b03ed07f3a8db771484 Auto-Submitted: auto-generated The branch stable/14 has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=7aaa37fa1db603fe10143b03ed07f3a8db771484 commit 7aaa37fa1db603fe10143b03ed07f3a8db771484 Author: Robert Clausecker AuthorDate: 2023-07-14 11:56:12 +0000 Commit: Robert Clausecker CommitDate: 2023-12-28 17:02:41 +0000 lib/libc/tests/string/memcmp_test.c: extend test to support custom memcmp function Extend the tests to permit loading an external memcmp function and testing it over using the libc version. This was added by the example of other tests in the test suite doing the same thing and helped tremendously in development. This change was originally part of D41442 but was taken out to permit separate review as extrapolated from @ngie's request in D41349. Sponsored by: FreeBSD Foundation Approved by: ngie Differential Revision: https://reviews.freebsd.org/D41528 (cherry picked from commit b166580681e3af173ec368656019d02ba1cc55ad) --- lib/libc/tests/string/memcmp_test.c | 57 +++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/lib/libc/tests/string/memcmp_test.c b/lib/libc/tests/string/memcmp_test.c index bfe209dd1b85..824e0d27ac0e 100644 --- a/lib/libc/tests/string/memcmp_test.c +++ b/lib/libc/tests/string/memcmp_test.c @@ -25,18 +25,21 @@ */ #include +#include #include #include #include #include +static int (*memcmp_fn)(const void *, const void *, size_t); + ATF_TC_WITHOUT_HEAD(zero); ATF_TC_BODY(zero, tc) { - assert(memcmp("a", "b", 0) == 0); - assert(memcmp("", "", 0) == 0); + assert(memcmp_fn("a", "b", 0) == 0); + assert(memcmp_fn("", "", 0) == 0); } ATF_TC_WITHOUT_HEAD(eq); @@ -48,9 +51,9 @@ ATF_TC_BODY(eq, tc) for (i = 0; i < 256; i++) data1[i] = data2[i] = i ^ 0x55; for (i = 1; i < 256; i++) - assert(memcmp(data1, data2, i) == 0); + assert(memcmp_fn(data1, data2, i) == 0); for (i = 1; i < 256; i++) - assert(memcmp(data1 + i, data2 + i, 256 - i) == 0); + assert(memcmp_fn(data1 + i, data2 + i, 256 - i) == 0); } ATF_TC_WITHOUT_HEAD(neq); @@ -64,9 +67,9 @@ ATF_TC_BODY(neq, tc) data2[i] = i ^ 0x55; } for (i = 1; i < 256; i++) - assert(memcmp(data1, data2, i) != 0); + assert(memcmp_fn(data1, data2, i) != 0); for (i = 1; i < 256; i++) - assert(memcmp(data1 + i, data2 + i, 256 - i) != 0); + assert(memcmp_fn(data1 + i, data2 + i, 256 - i) != 0); } ATF_TC_WITHOUT_HEAD(diff); @@ -80,37 +83,43 @@ ATF_TC_BODY(diff, tc) data1[128] = 255; data2[128] = 0; for (i = 1; i < 66; i++) { - assert(memcmp(data1 + 128, data2 + 128, i) == 255); - assert(memcmp(data2 + 128, data1 + 128, i) == -255); - assert(memcmp(data1 + 129 - i, data2 + 129 - i, i) == 255); - assert(memcmp(data2 + 129 - i, data1 + 129 - i, i) == -255); - assert(memcmp(data1 + 129 - i, data2 + 129 - i, i * 2) == 255); - assert(memcmp(data2 + 129 - i, data1 + 129 - i, i * 2) == -255); + assert(memcmp_fn(data1 + 128, data2 + 128, i) == 255); + assert(memcmp_fn(data2 + 128, data1 + 128, i) == -255); + assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i) == 255); + assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i) == -255); + assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i * 2) == 255); + assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i * 2) == -255); } data1[128] = 'c'; data2[128] = 'e'; for (i = 1; i < 66; i++) { - assert(memcmp(data1 + 128, data2 + 128, i) == -2); - assert(memcmp(data2 + 128, data1 + 128, i) == 2); - assert(memcmp(data1 + 129 - i, data2 + 129 - i, i) == -2); - assert(memcmp(data2 + 129 - i, data1 + 129 - i, i) == 2); - assert(memcmp(data1 + 129 - i, data2 + 129 - i, i * 2) == -2); - assert(memcmp(data2 + 129 - i, data1 + 129 - i, i * 2) == 2); + assert(memcmp_fn(data1 + 128, data2 + 128, i) == -2); + assert(memcmp_fn(data2 + 128, data1 + 128, i) == 2); + assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i) == -2); + assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i) == 2); + assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i * 2) == -2); + assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i * 2) == 2); } memset(data1 + 129, 'A', sizeof(data1) - 129); memset(data2 + 129, 'Z', sizeof(data2) - 129); for (i = 1; i < 66; i++) { - assert(memcmp(data1 + 128, data2 + 128, i) == -2); - assert(memcmp(data2 + 128, data1 + 128, i) == 2); - assert(memcmp(data1 + 129 - i, data2 + 129 - i, i) == -2); - assert(memcmp(data2 + 129 - i, data1 + 129 - i, i) == 2); - assert(memcmp(data1 + 129 - i, data2 + 129 - i, i * 2) == -2); - assert(memcmp(data2 + 129 - i, data1 + 129 - i, i * 2) == 2); + assert(memcmp_fn(data1 + 128, data2 + 128, i) == -2); + assert(memcmp_fn(data2 + 128, data1 + 128, i) == 2); + assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i) == -2); + assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i) == 2); + assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i * 2) == -2); + assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i * 2) == 2); } } ATF_TP_ADD_TCS(tp) { + void *dl_handle; + + dl_handle = dlopen(NULL, RTLD_LAZY); + memcmp_fn = dlsym(dl_handle, "test_memcmp"); + if (memcmp_fn == NULL) + memcmp_fn = memcmp; ATF_TP_ADD_TC(tp, zero); ATF_TP_ADD_TC(tp, eq); From nobody Thu Dec 28 17:20:12 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T1Fd92jK9z56Bs9; Thu, 28 Dec 2023 17:20: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T1Fd91417z3ZXK; Thu, 28 Dec 2023 17:20:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703784013; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Yc0Os2VmO5z9gHrnJTUeGqlTowigh+jdcM4cMbhdLfw=; b=GGY/BtY/r8axKgOk+Nto3jBiWBKsugJaix+cygGDPQOKc5rFkLiNFBao7XEEcB0ZyPhe5v LSjrHnL01mIIdzdjMpYuhrkWmU/BZBMWSynolrt5dccYLeksl3l95z/5yE2NGv3vDfbI9B CVon9FqdEAYBMwzYJq7hqiDUxDjM3D9pi0l6sMVAPGIEde18c2PZnOZUedD/C2cNOcJAMX V5uVAb98E0vZlH9er+3MhEDt6RJKjy5HDOnJJah7eRDQ/9Pv8m5cFLpTMMxAkXD0I3I8ks KKXqEOYvlPcxwOvuqvF+wEZpzbl5FF2A1V7zt27KQ2acgK/NZTLsL+UeaxA7Qw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703784013; a=rsa-sha256; cv=none; b=tkcf0dWtBn6AehIWfZuPB7z+/2nJtfudAIEqlI9FUsnz/z6TpWMJEkug3OR2Ahpuk/kk0N itF6WwQ23IhtOpGRtk6VcARRYfu5htIXHlp1IBKzH09Tf0zz5HgP6uksslnXdnvVHyfZvt CqdLYuOlU/X1aib6Tn8TFgMxAdaT6W0s1MW8/g+qlkLQOg3AUSf/BjI3aELbR2gWheJs1T rDfFGxqLtZXVB74WOqZ2y/Gpcx7TnnEEhMdbuJ3ecPTTlplVLgzn8P0BKB0TGfzOpYu0Va ZJuuBuHj8Nsb5+CBr4QZOaqsK4CjfmvQ391jG5qK5/QXaYD7py3BUmdbaytdkw== 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=1703784013; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Yc0Os2VmO5z9gHrnJTUeGqlTowigh+jdcM4cMbhdLfw=; b=l2Xq9GUM7zKzTXnNhrhlHwjo73wpuBnjwDz9QEIjB9Ck5t+VX7mM9uofKE+lVJI4dsRphT Ihi4x6Rh0RU/le1cFd3ugcNfAjVrSXIvQ43R9iQA/ASyLDlGiJTsfrdu5aAkICRh56jg42 ehvCFFmqkjXE4E9sadWz7q8fuBAceQxGuTu0g5gBeQ86rJX/DtJUELC3uOlQv3xIFY2wdC /NUZIncCuhkuIt1g2UpI+9jWvE59RKuLfXY5T6BM/9OWqUXMTYZcsfQnlayjg7MDa91edT sgBnEGEJB1cOF8RIr9As0PInzDaWrCMFnsocXRQoEooDqhqKfDegZuU9wkhIuw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T1Fd908b1zXQq; Thu, 28 Dec 2023 17:20:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BSHKCVV079367; Thu, 28 Dec 2023 17:20:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BSHKCqB079359; Thu, 28 Dec 2023 17:20:12 GMT (envelope-from git) Date: Thu, 28 Dec 2023 17:20:12 GMT Message-Id: <202312281720.3BSHKCqB079359@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Robert Clausecker Subject: git: c91cfb7f9e7d - stable/14 - lib/libc/tests/string: expand memcmp test to bcmp, timingsafe_{b,mem}cmp List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: c91cfb7f9e7de392ca47b3092e981bf7c2fca86b Auto-Submitted: auto-generated The branch stable/14 has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=c91cfb7f9e7de392ca47b3092e981bf7c2fca86b commit c91cfb7f9e7de392ca47b3092e981bf7c2fca86b Author: Robert Clausecker AuthorDate: 2023-08-30 15:30:24 +0000 Commit: Robert Clausecker CommitDate: 2023-12-28 17:02:41 +0000 lib/libc/tests/string: expand memcmp test to bcmp, timingsafe_{b,mem}cmp The four functions more or less perform the same operation. Reuse the same unit test with slight changes so we can cover them all. Constant-time operation is not verified for the timingsafe_* functions. Sponsored by: The FreeBSD Foundation Approved by: ngie MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D41528 (cherry picked from commit c6cc06d465a98270ef734ffec7c9012ec3a1bd17) --- lib/libc/tests/string/Makefile | 3 + lib/libc/tests/string/bcmp_test.c | 32 ++++++++++ lib/libc/tests/string/memcmp_test.c | 82 ++++++++++++++++++-------- lib/libc/tests/string/timingsafe_bcmp_test.c | 32 ++++++++++ lib/libc/tests/string/timingsafe_memcmp_test.c | 32 ++++++++++ 5 files changed, 155 insertions(+), 26 deletions(-) diff --git a/lib/libc/tests/string/Makefile b/lib/libc/tests/string/Makefile index e9b066cacac7..a090e1bd3463 100644 --- a/lib/libc/tests/string/Makefile +++ b/lib/libc/tests/string/Makefile @@ -2,6 +2,7 @@ # ensure libc functions are tested, not clang's builtins CFLAGS+= -fno-builtin +ATF_TESTS_C+= bcmp_test ATF_TESTS_C+= ffs_test ATF_TESTS_C+= ffsl_test ATF_TESTS_C+= ffsll_test @@ -17,6 +18,8 @@ ATF_TESTS_C+= strerror2_test ATF_TESTS_C+= strspn_test ATF_TESTS_C+= strverscmp_test ATF_TESTS_C+= strxfrm_test +ATF_TESTS_C+= timingsafe_bcmp_test +ATF_TESTS_C+= timingsafe_memcmp_test ATF_TESTS_C+= wcscasecmp_test ATF_TESTS_C+= wcscoll_test ATF_TESTS_C+= wcsnlen_test diff --git a/lib/libc/tests/string/bcmp_test.c b/lib/libc/tests/string/bcmp_test.c new file mode 100644 index 000000000000..fdf5e48b3eb4 --- /dev/null +++ b/lib/libc/tests/string/bcmp_test.c @@ -0,0 +1,32 @@ +/*- + * Copyright (c) 2023 The FreeBSD Foundation + * + * This software was developed by Robert Clausecker + * under sponsorship from the FreeBSD Foundation. + * + * 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 + */ + +#define MEMCMP bcmp +#define RES(x) ((x) != 0) + +#include "memcmp_test.c" diff --git a/lib/libc/tests/string/memcmp_test.c b/lib/libc/tests/string/memcmp_test.c index 824e0d27ac0e..5286a0b994f3 100644 --- a/lib/libc/tests/string/memcmp_test.c +++ b/lib/libc/tests/string/memcmp_test.c @@ -1,7 +1,11 @@ /*- * Copyright (c) 2016 Jilles Tjoelker + * Copyright (c) 2023 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by Robert Clausecker + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -32,14 +36,40 @@ #include +#ifndef MEMCMP +#define MEMCMP memcmp +#endif + +/* + * On FreeBSD we demand that memcmp returns the difference between the + * characters at the first site of mismatch. However, ISO/IEC 9899:1990 + * only specifies that a number greater than, equal to, or less than + * zero shall be returned. If a unit test for this less strict + * behaviour is desired, define RES(x) to be (((x) > 0) - ((x) < 0)). + */ +#ifndef RES +#define RES(x) (x) +#endif + static int (*memcmp_fn)(const void *, const void *, size_t); +static void +check_memcmp(const char *a, const char *b, size_t len, int expected) +{ + int got; + + got = memcmp_fn(a, b, len); + ATF_CHECK_EQ_MSG(RES(expected), RES(got), + "%s(%p, %p, %zu) gave %d, but wanted %d", + __XSTRING(MEMCMP), a, b, len, got, expected); +} + ATF_TC_WITHOUT_HEAD(zero); ATF_TC_BODY(zero, tc) { - assert(memcmp_fn("a", "b", 0) == 0); - assert(memcmp_fn("", "", 0) == 0); + check_memcmp("a", "b", 0, 0); + check_memcmp("", "", 0, 0); } ATF_TC_WITHOUT_HEAD(eq); @@ -51,9 +81,9 @@ ATF_TC_BODY(eq, tc) for (i = 0; i < 256; i++) data1[i] = data2[i] = i ^ 0x55; for (i = 1; i < 256; i++) - assert(memcmp_fn(data1, data2, i) == 0); + check_memcmp(data1, data2, i, 0); for (i = 1; i < 256; i++) - assert(memcmp_fn(data1 + i, data2 + i, 256 - i) == 0); + check_memcmp(data1 + i, data2 + i, 256 - i, 0); } ATF_TC_WITHOUT_HEAD(neq); @@ -67,9 +97,9 @@ ATF_TC_BODY(neq, tc) data2[i] = i ^ 0x55; } for (i = 1; i < 256; i++) - assert(memcmp_fn(data1, data2, i) != 0); + check_memcmp(data1, data2, i, -0x55); for (i = 1; i < 256; i++) - assert(memcmp_fn(data1 + i, data2 + i, 256 - i) != 0); + check_memcmp(data1 + i, data2 + i, 256 - i, i - (i ^ 0x55)); } ATF_TC_WITHOUT_HEAD(diff); @@ -83,32 +113,32 @@ ATF_TC_BODY(diff, tc) data1[128] = 255; data2[128] = 0; for (i = 1; i < 66; i++) { - assert(memcmp_fn(data1 + 128, data2 + 128, i) == 255); - assert(memcmp_fn(data2 + 128, data1 + 128, i) == -255); - assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i) == 255); - assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i) == -255); - assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i * 2) == 255); - assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i * 2) == -255); + check_memcmp(data1 + 128, data2 + 128, i, 255); + check_memcmp(data2 + 128, data1 + 128, i, -255); + check_memcmp(data1 + 129 - i, data2 + 129 - i, i, 255); + check_memcmp(data2 + 129 - i, data1 + 129 - i, i, -255); + check_memcmp(data1 + 129 - i, data2 + 129 - i, i * 2, 255); + check_memcmp(data2 + 129 - i, data1 + 129 - i, i * 2, -255); } data1[128] = 'c'; data2[128] = 'e'; for (i = 1; i < 66; i++) { - assert(memcmp_fn(data1 + 128, data2 + 128, i) == -2); - assert(memcmp_fn(data2 + 128, data1 + 128, i) == 2); - assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i) == -2); - assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i) == 2); - assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i * 2) == -2); - assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i * 2) == 2); + check_memcmp(data1 + 128, data2 + 128, i, -2); + check_memcmp(data2 + 128, data1 + 128, i, 2); + check_memcmp(data1 + 129 - i, data2 + 129 - i, i, -2); + check_memcmp(data2 + 129 - i, data1 + 129 - i, i, 2); + check_memcmp(data1 + 129 - i, data2 + 129 - i, i * 2, -2); + check_memcmp(data2 + 129 - i, data1 + 129 - i, i * 2, 2); } memset(data1 + 129, 'A', sizeof(data1) - 129); memset(data2 + 129, 'Z', sizeof(data2) - 129); for (i = 1; i < 66; i++) { - assert(memcmp_fn(data1 + 128, data2 + 128, i) == -2); - assert(memcmp_fn(data2 + 128, data1 + 128, i) == 2); - assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i) == -2); - assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i) == 2); - assert(memcmp_fn(data1 + 129 - i, data2 + 129 - i, i * 2) == -2); - assert(memcmp_fn(data2 + 129 - i, data1 + 129 - i, i * 2) == 2); + check_memcmp(data1 + 128, data2 + 128, i, -2); + check_memcmp(data2 + 128, data1 + 128, i, 2); + check_memcmp(data1 + 129 - i, data2 + 129 - i, i, -2); + check_memcmp(data2 + 129 - i, data1 + 129 - i, i, 2); + check_memcmp(data1 + 129 - i, data2 + 129 - i, i * 2, -2); + check_memcmp(data2 + 129 - i, data1 + 129 - i, i * 2, 2); } } @@ -117,9 +147,9 @@ ATF_TP_ADD_TCS(tp) void *dl_handle; dl_handle = dlopen(NULL, RTLD_LAZY); - memcmp_fn = dlsym(dl_handle, "test_memcmp"); + memcmp_fn = dlsym(dl_handle, "test_" __XSTRING(MEMCMP)); if (memcmp_fn == NULL) - memcmp_fn = memcmp; + memcmp_fn = MEMCMP; ATF_TP_ADD_TC(tp, zero); ATF_TP_ADD_TC(tp, eq); diff --git a/lib/libc/tests/string/timingsafe_bcmp_test.c b/lib/libc/tests/string/timingsafe_bcmp_test.c new file mode 100644 index 000000000000..96bf789633f2 --- /dev/null +++ b/lib/libc/tests/string/timingsafe_bcmp_test.c @@ -0,0 +1,32 @@ +/*- + * Copyright (c) 2023 The FreeBSD Foundation + * + * This software was developed by Robert Clausecker + * under sponsorship from the FreeBSD Foundation. + * + * 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 + */ + +#define MEMCMP timingsafe_bcmp +#define RES(x) ((x) != 0) + +#include "memcmp_test.c" diff --git a/lib/libc/tests/string/timingsafe_memcmp_test.c b/lib/libc/tests/string/timingsafe_memcmp_test.c new file mode 100644 index 000000000000..5f97e41fcf8a --- /dev/null +++ b/lib/libc/tests/string/timingsafe_memcmp_test.c @@ -0,0 +1,32 @@ +/*- + * Copyright (c) 2023 The FreeBSD Foundation + * + * This software was developed by Robert Clausecker + * under sponsorship from the FreeBSD Foundation. + * + * 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 + */ + +#define MEMCMP timingsafe_memcmp +#define RES(x) (((x) > 0) - ((x) < 0)) + +#include "memcmp_test.c" From nobody Thu Dec 28 17:20:14 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T1FdB3bTlz56CDr; Thu, 28 Dec 2023 17:20: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T1FdB1d9Jz3ZjH; Thu, 28 Dec 2023 17:20:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703784014; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mkarzoyFChjT2Y3jeh8X4CRhNlg4nCMpxp/ZjCDsMis=; b=UIXubeV3uQIEMKatK+UaxuFaaZ1BV4pgRHPJQJqeXEq8tEBM1V0q4ZAPD+19TIh2PJY78V T98LRobwI+0JN8FVBxH2llZN6p9/gXph15PK0xmfbjLS1QqzJIrX7utt+rHwWM5ZaOx4ct s18pm5EAvhXgzEcHd6B9CgT9e8eETIfYGhRD/OhvMcOMVBqXzhyB4QRKrJBinfKU+WP07Z uL9+7pnCCWzgZMlx77rpkacPL2YrJH8h82t3zDmGJyY+X7axQbVytRxRq2d7dQCoauPwJx jwLeXdmKuxwE0l98Xocn9+kXkJuV8z58qvDg2PobVUgKtGyzT25MAJjGAlI46g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703784014; a=rsa-sha256; cv=none; b=M2Qwfs/vMdDcUCqbIMolw8+cAWAAolpat7W9aEY0qzoQeVNuATQAPH5vFc8bD05ucBuhxw Y1FS+vfg/u0sKzwzCwzvSrBmUgtJvwhzPWhGJciD01ZSO1ukqd1iwtBIj2t7yaE1S9Rek0 r2t3+yc+eMEpicJQ92eLDLLyIqgZ5AT0aS9lkJ8rW6bBbKzY/3bgkSXE5C+vz+6KH3qXvD FgHMk8OV2F4WFQ6e7scjQJlz2g5nBXtJ5IJRm7KcfhhZYO6hZQVKEAY4940l/P4nD6gTZt jFZad2KHsXQhmtqUjo0ut2vNJOTMTPCUUyVoCDgVZXFnpO0UqlrhJD3TX/3AeA== 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=1703784014; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mkarzoyFChjT2Y3jeh8X4CRhNlg4nCMpxp/ZjCDsMis=; b=a8+mnH8iUoAR3oa4QNVPHZQten+p1HQ9jOJAH6kL1NX4vvApF43OgJA554aC+MgI1vwHO8 AGjmkT2Ah/5AY9UXxZmaGg+9Cl5MSPMQQXlN682OJFnVD8HsBMplFeBtrUZQ/FrwnEpp8V TadzignPj3G0paGQtQ7peNkODCUFvieX58SmjB0KgXRlSMEUMWSPie80wrZ5L1Ssf5On14 MOtr2zVfcSc+4ZuI7qTtOFVeyJtzX2+vqblQpNW0DgRnFmPxyh1q2S73c2GtVKxNTpUHwn b5+SV80lmamc0KfiSGCMUVeNcARcx13CdXXrLd4N/fn0L0DHyvAf65n/c4RtKw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T1FdB0khgzWw5; Thu, 28 Dec 2023 17:20:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BSHKEwR080042; Thu, 28 Dec 2023 17:20:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BSHKECA080034; Thu, 28 Dec 2023 17:20:14 GMT (envelope-from git) Date: Thu, 28 Dec 2023 17:20:14 GMT Message-Id: <202312281720.3BSHKECA080034@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Robert Clausecker Subject: git: 08ad297599ee - stable/14 - lib/libc/tests/string/strcspn_test.c: add test for correct match order List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 08ad297599ee6c40b4346699dac81d71f1933f18 Auto-Submitted: auto-generated The branch stable/14 has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=08ad297599ee6c40b4346699dac81d71f1933f18 commit 08ad297599ee6c40b4346699dac81d71f1933f18 Author: Robert Clausecker AuthorDate: 2023-12-19 16:27:24 +0000 Commit: Robert Clausecker CommitDate: 2023-12-28 17:02:41 +0000 lib/libc/tests/string/strcspn_test.c: add test for correct match order This new unit test verifies that if there are multiple matches, the first match is returned, ignoring later matches. Approved by: mjg (blanket, via IRC) MFC after: 1 week MFC to: stable/14 (cherry picked from commit a0ecf2224ea35d029d33541878f0eee42f5fd84f) --- lib/libc/tests/string/strcspn_test.c | 51 +++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/lib/libc/tests/string/strcspn_test.c b/lib/libc/tests/string/strcspn_test.c index 6cb2a04d3e64..293fc2bc8d4e 100644 --- a/lib/libc/tests/string/strcspn_test.c +++ b/lib/libc/tests/string/strcspn_test.c @@ -150,7 +150,7 @@ ATF_TC_BODY(set_alignments, tc) #ifndef STRSPN /* test all positions in which set could match buf */ static void -test_match_positions(char *buf, char *set, size_t buflen, size_t setlen) +test_match_positions(char *buf, char *set, size_t buflen, size_t setlen) { size_t i, j, outcome; @@ -206,6 +206,54 @@ ATF_TC_BODY(match_positions, tc) test_match_positions(buf, set, 16, 8); test_match_positions(buf, set, 8, 8); } + +/* if there are two matches, check that the earlier match is taken */ +static void +test_match_order(char *buf, char *set, size_t buflen, size_t setlen) +{ + size_t i, j, k, l, outcome; + + memset(buf, '-', buflen); + + for (i = 0; i < setlen; i++) + set[i] = 'A' + i; + + buf[buflen] = '\0'; + set[setlen] = '\0'; + + for (i = 0; i < setlen; i++) + for (j = 0; j < setlen; j++) + for (k = 0; k + 1 < buflen; k++) + for (l = k + 1; l < buflen; l++) { + buf[k] = set[i]; + buf[l] = set[j]; + outcome = strcspn(buf, set); + ATF_CHECK_EQ_MSG(k, outcome, + "strcspn(\"%s\", \"%s\") = %zu != %zu", + buf, set, outcome, k); + buf[k] = '-'; + buf[l] = '-'; + } +} + +ATF_TC_WITHOUT_HEAD(match_order); +ATF_TC_BODY(match_order, tc) +{ + char buf[33], set[65]; + + test_match_order(buf, set, 32, 64); + test_match_order(buf, set, 16, 64); + test_match_order(buf, set, 8, 64); + test_match_order(buf, set, 32, 32); + test_match_order(buf, set, 16, 32); + test_match_order(buf, set, 8, 32); + test_match_order(buf, set, 32, 16); + test_match_order(buf, set, 16, 16); + test_match_order(buf, set, 8, 16); + test_match_order(buf, set, 32, 8); + test_match_order(buf, set, 16, 8); + test_match_order(buf, set, 8, 8); +} #endif /* !defined(STRSPN) */ ATF_TP_ADD_TCS(tp) @@ -214,6 +262,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, set_alignments); #ifndef STRSPN ATF_TP_ADD_TC(tp, match_positions); + ATF_TP_ADD_TC(tp, match_order); #endif return (atf_no_error()); From nobody Thu Dec 28 17:20:15 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T1FdC4NQfz56CDs; Thu, 28 Dec 2023 17:20: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T1FdC2NBnz3Zjc; Thu, 28 Dec 2023 17:20:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703784015; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Tpx9dDELM5PruNkNeK2DDW32wPbR43hnTsEWMT3uT8k=; b=EDJewL4DI6CRCDaEyHRBxj2cj4c6n8kCBASElQ0mU/7s5UvUrzrkz4+Bdm+k6ckAC/vz39 YvKFu0WYsg78l54rtr+nOlxAl2ljKiQB3WxgGjNeE44BPmY76IAzDj5DGPWbDd6M1GsdG2 rzAN/LYOLCghqak8MlfpjDEshHilpTeA3b6kO8NOFz/szAPB4N+wKsxaedjm+rvj5iL2Dx mj+MBulIZH8XfbnVp9vIc/OMDkYcLvRhP/xN2SwchmH1CTxgnFczbb3zyW6ZBMsO6VGHQC 0KruEZdUrwps+p+EfcEIZEUBh/qRBhYqfLmla1+CdYElksjpBXfll1LO1sAkSQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703784015; a=rsa-sha256; cv=none; b=lsZO8khG6rLKqaVT++xDw+vn5JTfCyRhSU0UJb0kPuTcJ7e5w0U1sUByrgF4dAECqVrQiM ScAAQ28xLtHQQ6HgiyPBCs59v8Tacpu2HcVsh6higAlvoVWBbF4XVDGKLe9CpFjkGkEMoQ CGVXJ5ocdN3qX4ki6uZX2Egm2WI9GZFWLeiLVSxkDaySIEfnpd/cK6J5kGI6ECJnzbPKgN kK2R8wTpBqaFBv/CxeSRrqa3aIUnVLQGMtX0hnYR29E+8QDEyaDFeN1q6LO9HxBW8RwAgf hpA6+VjIfjyL5LfXN8dWLmsIgKolgwHqeKN6EzLpWsiO8Wiya+VFqJJPggM2HQ== 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=1703784015; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Tpx9dDELM5PruNkNeK2DDW32wPbR43hnTsEWMT3uT8k=; b=nM545a24Hs6d2rY2+bpskN0tKrQeoWKmqqd0HK9txg+HgJ/n+FLNGg3T1X1K6g7uhyBOi3 quT2V3O+Si/CkL1heGwkT5sbXE6QiEWU5UZCdnnn04HBSh+8rKO92QgO/LcoHWJ9i7J60q /T9oO/eA20FEo9E4jlt5NfYlQRuDNP/0ThcnJx5JRguGshdudeCxShPiX5G+tX7J7F9glq dvk8y9NtD9S8Zhc2Z1U2YVKkYC282xfSBsOR09hlJRDf4KfiVIxxZwgyzNDdiQHN2MjBzN 8DMbzbLJnvujRHj8XRXdL297MXDwP2Fkt7pkh7cF3Wmk28IYaNvIfbZ1PeIrCQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T1FdC1JQQzXBj; Thu, 28 Dec 2023 17:20:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BSHKFEi080741; Thu, 28 Dec 2023 17:20:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BSHKFE6080732; Thu, 28 Dec 2023 17:20:15 GMT (envelope-from git) Date: Thu, 28 Dec 2023 17:20:15 GMT Message-Id: <202312281720.3BSHKFE6080732@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Robert Clausecker Subject: git: cec0236976cd - stable/14 - lib/libc/amd64/string/strcspn.S: always return earliest match in 17--32 char case List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: cec0236976cd0cce0c7c05b1031b7f4215ce9178 Auto-Submitted: auto-generated The branch stable/14 has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=cec0236976cd0cce0c7c05b1031b7f4215ce9178 commit cec0236976cd0cce0c7c05b1031b7f4215ce9178 Author: Robert Clausecker AuthorDate: 2023-12-19 17:28:57 +0000 Commit: Robert Clausecker CommitDate: 2023-12-28 17:02:41 +0000 lib/libc/amd64/string/strcspn.S: always return earliest match in 17--32 char case When matching against a set of 17--32 characters, strcspn() uses two invocations of PCMPISTRI to match against the first 16 characters of the set and then the remaining characters. If a match was found in the first half of the set, the code originally immediately returned that match. However, it is possible for a match in the second half of the set to occur earlier in the vector, leading to that match being overlooked. Fix the code by checking if there is a match in the second half of the set and taking the earlier of the two matches. The correctness of the function has been verified with extended unit tests and test runs against the glibc test suite. Approved by: mjg (implicit, via IRC) MFC after: 1 week MFC to: stable/14 (cherry picked from commit c91cd7d03a9dee649ba3a1b9b4014df9de111bb8) --- lib/libc/amd64/string/strcspn.S | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/lib/libc/amd64/string/strcspn.S b/lib/libc/amd64/string/strcspn.S index 53100eeea9a5..648635529e5b 100644 --- a/lib/libc/amd64/string/strcspn.S +++ b/lib/libc/amd64/string/strcspn.S @@ -255,19 +255,28 @@ ARCHENTRY(strcspn, x86_64_v2) leave ret + /* match in first set half during head */ +.Lheadmatchv2first: + mov %ecx, %eax + pcmpistri $0, %xmm0, %xmm3 # match in second set half? + cmp %ecx, %eax # before the first half match? + cmova %ecx, %eax # use the earlier match + leave + ret + .Lgt16v2: movdqu 48(%rsp, %rcx, 1), %xmm3 # second part of set /* set is 17--32 bytes in size */ pcmpistri $0, %xmm0, %xmm2 # match in first set half? - jb .Lheadmatchv2 + jb .Lheadmatchv2first pcmpistri $0, %xmm0, %xmm3 # match in second set half or end of string? jbe .Lheadmatchv2 ALIGN_TEXT 0: movdqa (%rax), %xmm0 pcmpistri $0, %xmm0, %xmm2 - jb 2f # match in first set half? + jb 4f # match in first set half? pcmpistri $0, %xmm0, %xmm3 jbe 1f # match in second set half or end of string? movdqa 16(%rax), %xmm0 @@ -277,7 +286,8 @@ ARCHENTRY(strcspn, x86_64_v2) pcmpistri $0, %xmm0, %xmm3 ja 0b # neither match in 2nd half nor string end? -3: lea -16(%rax), %rax # go back to second half + /* match in second half or NUL */ + lea -16(%rax), %rax # go back to second half 1: jc 2f # jump if match found pxor %xmm1, %xmm1 pcmpeqb %xmm1, %xmm0 # where is the NUL byte? @@ -288,6 +298,17 @@ ARCHENTRY(strcspn, x86_64_v2) leave ret + /* match in first half */ +3: sub $16, %rax # go back to second half +4: sub %rdi, %rax # offset of %xmm0 from beginning of string + mov %ecx, %edx + pcmpistri $0, %xmm0, %xmm3 # match in second set half? + cmp %ecx, %edx # before the first half match? + cmova %ecx, %edx # use the earlier match + add %rdx, %rax # return full ofset + leave + ret + /* set is empty, degrades to strlen */ .Lstrlenv2: leave From nobody Thu Dec 28 17:20:16 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T1FdD53P5z56C9v; Thu, 28 Dec 2023 17:20: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T1FdD2bXSz3Zr3; Thu, 28 Dec 2023 17:20:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703784016; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FTen5Uu2ukhUdWzOsje3nNDb4KAi9VfcdwDrT2jDNM0=; b=SSZCrWcClh4Kdhq0NRPVj1YST9FMc+mQRnGNFxqOQXMRZzPkkjrYnMc50G+aIqJNqXiEO4 MpNXIj4ibire5/JaIb33azR2o9AvZn5bpHLpHzypZsa8HRszQ63Rk8HtlIi38DKhJTuRtW AQ41H+EmetTcbl9DZ7/i1jRVbyCnXvGkC/h4xY+AmzJYz04HWJxaxbfNNo/SfvDbceJsKO vkZw7Lzk2VvHVo2jUUKIbIaS06c9dIwSozcfkeGkwVx8i7hzKiQ87VWsZNQ4ZVsQt3rxGp oyblCCRbBrp19q6Y7Y9esBblehIONZq5nLSWI0hr0yXthSMRxaeopAb46ZmiKA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703784016; a=rsa-sha256; cv=none; b=DNiCQzh5Be6BT4dQCDLv4OxsXQ11ojEtKi0dXCss0jAZ0r+BffN53cdzPD+wen31e1QtUl jWbZDIW0Dc/nayQZwRqQ60s8STqeMIU23gXQxKRkmT4j1wgEqpWfRzrGsqKHlauLES/4ue y+gClFLJ9ZRrJg/l0HUy+mHhcMac+WR/Be4ji7bgU2CGKGgj1r3U3Yzh6Z0TKJi9yXepl/ EDuCl2WrnIkTNf9eBloNllTvOesz8KwItjn1iDsPV+AvETfHWLJOJzD6LuSTW3ZZbjEXM9 b/mrYLUgFzMVU/H4A9pXbRpEosuBJCvbyO/ahMfV0sjt+iC6LpYYBSKQD7wozA== 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=1703784016; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FTen5Uu2ukhUdWzOsje3nNDb4KAi9VfcdwDrT2jDNM0=; b=Vps+jUpSpTfdXBCIe35zXI4Zm0lki0slr2qCkjOX09cCFdKyvrFMrJ87mTm7Ht27UOJq5a 9NgkxTPAbktgyWySVsNzc463QI1vGNityOjTY2l6EYSuxuiLlRjFe5UZs2rtLqxGgBBzID YVZB3IJi3Bts4jeGEW36NAGSwW61njea3gMMoW49+AsGZ9fOKgBRN7YqZ8rZqlrYg2AmOV XePId90XzyxFDCKBd+tgV5qej82AcdubzlbxEpJVal1ly2SBrmVM0XM7Z/wGwSFS0jVIYH MZ5EikgLr/0nb5ZXFuFFDQDHs+QYJ/ywbYbkBrnYPwUMlfAugolbxYfz0tBdVg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T1FdD1j08zWxY; Thu, 28 Dec 2023 17:20:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BSHKGmu081407; Thu, 28 Dec 2023 17:20:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BSHKGnS081402; Thu, 28 Dec 2023 17:20:16 GMT (envelope-from git) Date: Thu, 28 Dec 2023 17:20:16 GMT Message-Id: <202312281720.3BSHKGnS081402@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Robert Clausecker Subject: git: 1347ec5d5845 - stable/14 - lib/libc/amd64/string: add timingsafe_bcmp(3) scalar, baseline implementations List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 1347ec5d5845886a9da0903700f54110f0241b8a Auto-Submitted: auto-generated The branch stable/14 has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=1347ec5d5845886a9da0903700f54110f0241b8a commit 1347ec5d5845886a9da0903700f54110f0241b8a Author: Robert Clausecker AuthorDate: 2023-08-30 15:37:26 +0000 Commit: Robert Clausecker CommitDate: 2023-12-28 17:02:41 +0000 lib/libc/amd64/string: add timingsafe_bcmp(3) scalar, baseline implementations Very straightforward and similar to memcmp(3). The code has been written to use only instructions specified as having data operand independent timing by Intel. Sponsored by: The FreeBSD Foundation Approved by: security (cperciva) Differential Revision: https://reviews.freebsd.org/D41673 (cherry picked from commit 76c2b331bcd9f73c5c8c43a06e328fa0c7b8c39a) --- lib/libc/amd64/string/Makefile.inc | 3 +- lib/libc/amd64/string/timingsafe_bcmp.S | 232 ++++++++++++++++++++++++++++++++ 2 files changed, 234 insertions(+), 1 deletion(-) diff --git a/lib/libc/amd64/string/Makefile.inc b/lib/libc/amd64/string/Makefile.inc index 73973a6d69de..fc420de0450e 100644 --- a/lib/libc/amd64/string/Makefile.inc +++ b/lib/libc/amd64/string/Makefile.inc @@ -15,4 +15,5 @@ MDSRCS+= \ strcspn.S \ strlen.S \ strnlen.c \ - strspn.S + strspn.S \ + timingsafe_bcmp.S diff --git a/lib/libc/amd64/string/timingsafe_bcmp.S b/lib/libc/amd64/string/timingsafe_bcmp.S new file mode 100644 index 000000000000..c003da2ea9a7 --- /dev/null +++ b/lib/libc/amd64/string/timingsafe_bcmp.S @@ -0,0 +1,232 @@ +/*- + * Copyright (c) 2023 The FreeBSD Foundation + * + * This software was developed by Robert Clausecker + * under sponsorship from the FreeBSD Foundation. + * + * 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 "amd64_archlevel.h" + +#define ALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */ + +ARCHFUNCS(timingsafe_bcmp) + ARCHFUNC(timingsafe_bcmp, scalar) + ARCHFUNC(timingsafe_bcmp, baseline) +ENDARCHFUNCS(timingsafe_bcmp) + +ARCHENTRY(timingsafe_bcmp, scalar) + cmp $16, %rdx # at least 17 bytes to process? + ja .Lgt16 + + cmp $8, %edx # at least 9 bytes to process? + ja .L0916 + + cmp $4, %edx # at least 5 bytes to process? + ja .L0508 + + cmp $2, %edx # at least 3 bytes to process? + ja .L0304 + + test %edx, %edx # buffer empty? + jnz .L0102 + + xor %eax, %eax # empty buffer always matches + ret + +.L0102: movzbl (%rdi), %eax # load 1--2 bytes from first buffer + movzbl -1(%rdi, %rdx, 1), %ecx + xor (%rsi), %al # xor in second buffer + xor -1(%rsi, %rdx, 1), %cl + or %ecx, %eax # mismatch in any of the two? + ret + +.L0304: movzwl (%rdi), %eax + movzwl -2(%rdi, %rdx, 1), %ecx + xor (%rsi), %ax + xor -2(%rsi, %rdx, 1), %cx + or %ecx, %eax + ret + +.L0508: mov (%rdi), %eax + mov -4(%rdi, %rdx, 1), %ecx + xor (%rsi), %eax + xor -4(%rsi, %rdx, 1), %ecx + or %ecx, %eax + ret + +.L0916: mov (%rdi), %rax + mov -8(%rdi, %rdx, 1), %rcx + xor (%rsi), %rax + xor -8(%rsi, %rdx, 1), %rcx + or %rcx, %rax + setnz %al # ensure EAX nonzero even if only + ret # high bits of RAX were set + + /* more than 16 bytes: process buffer in a loop */ +.Lgt16: mov (%rdi), %rax # process first 16 bytes + mov 8(%rdi), %r9 + mov $32, %ecx + xor (%rsi), %rax + xor 8(%rsi), %r9 + or %r9, %rax + + cmp %rdx, %rcx # enough left for a full iteration? + jae .Ltail + + /* main loop processing 16 bytes per iteration */ + ALIGN_TEXT +0: mov -16(%rdi, %rcx, 1), %r8 + mov -8(%rdi, %rcx, 1), %r9 + xor -16(%rsi, %rcx, 1), %r8 + xor -8(%rsi, %rcx, 1), %r9 + add $16, %rcx + or %r9, %r8 + or %r8, %rax + + cmp %rdx, %rcx + jb 0b + + /* process last 16 bytes */ +.Ltail: mov -16(%rdi, %rdx, 1), %r8 + mov -8(%rdi, %rdx, 1), %r9 + xor -16(%rsi, %rdx, 1), %r8 + xor -8(%rsi, %rdx, 1), %r9 + or %r9, %r8 + or %r8, %rax + setnz %al + ret +ARCHEND(timingsafe_bcmp, scalar) + +ARCHENTRY(timingsafe_bcmp, baseline) + cmp $32, %rdx # at least 33 bytes to process? + ja .Lgt32b + + cmp $16, %edx # at least 17 bytes to process? + ja .L1732b + + cmp $8, %edx # at least 9 bytes to process? + ja .L0916b + + cmp $4, %edx # at least 5 bytes to process? + ja .L0508b + + cmp $2, %edx # at least 3 bytes to process? + ja .L0304b + + test %edx, %edx # buffer empty? + jnz .L0102b + + xor %eax, %eax # empty buffer always matches + ret + +.L0102b: + movzbl (%rdi), %eax # load 1--2 bytes from first buffer + movzbl -1(%rdi, %rdx, 1), %ecx + xor (%rsi), %al # xor in second buffer + xor -1(%rsi, %rdx, 1), %cl + or %ecx, %eax # mismatch in any of the two? + ret + +.L0304b: + movzwl (%rdi), %eax + movzwl -2(%rdi, %rdx, 1), %ecx + xor (%rsi), %ax + xor -2(%rsi, %rdx, 1), %cx + or %ecx, %eax + ret + +.L0508b: + mov (%rdi), %eax + mov -4(%rdi, %rdx, 1), %ecx + xor (%rsi), %eax + xor -4(%rsi, %rdx, 1), %ecx + or %ecx, %eax + ret + +.L0916b: + mov (%rdi), %rax + mov -8(%rdi, %rdx, 1), %rcx + xor (%rsi), %rax + xor -8(%rsi, %rdx, 1), %rcx + or %rcx, %rax + setnz %al # ensure EAX nonzero even if only + ret # high bits of RAX were set + +.L1732b: + movdqu (%rdi), %xmm0 + movdqu (%rsi), %xmm2 + movdqu -16(%rdi, %rdx, 1), %xmm1 + movdqu -16(%rsi, %rdx, 1), %xmm3 + pcmpeqb %xmm2, %xmm0 + pcmpeqb %xmm3, %xmm1 + pand %xmm1, %xmm0 + pmovmskb %xmm0, %eax # 1 where equal + xor $0xffff, %eax # 1 where not equal + ret + + /* more than 32 bytes: process buffer in a loop */ +.Lgt32b: + movdqu (%rdi), %xmm4 + movdqu (%rsi), %xmm2 + movdqu 16(%rdi), %xmm1 + movdqu 16(%rsi), %xmm3 + mov $64, %ecx + pcmpeqb %xmm2, %xmm4 + pcmpeqb %xmm3, %xmm1 + pand %xmm1, %xmm4 + cmp %rdx, %rcx # enough left for a full iteration? + jae .Ltailb + + /* main loop processing 32 bytes per iteration */ + ALIGN_TEXT +0: movdqu -32(%rdi, %rcx, 1), %xmm0 + movdqu -32(%rsi, %rcx, 1), %xmm2 + movdqu -16(%rdi, %rcx, 1), %xmm1 + movdqu -16(%rsi, %rcx, 1), %xmm3 + add $32, %rcx + pcmpeqb %xmm2, %xmm0 + pcmpeqb %xmm3, %xmm1 + pand %xmm1, %xmm0 + pand %xmm0, %xmm4 + cmp %rdx, %rcx + jb 0b + + /* process last 32 bytes */ +.Ltailb: + movdqu -32(%rdi, %rdx, 1), %xmm0 + movdqu -32(%rsi, %rdx, 1), %xmm2 + movdqu -16(%rdi, %rdx, 1), %xmm1 + movdqu -16(%rsi, %rdx, 1), %xmm3 + pcmpeqb %xmm2, %xmm0 + pcmpeqb %xmm3, %xmm1 + pand %xmm1, %xmm0 + pand %xmm4, %xmm0 + pmovmskb %xmm0, %eax + xor $0xffff, %eax + ret +ARCHEND(timingsafe_bcmp, baseline) + + .section .note.GNU-stack,"",%progbits From nobody Thu Dec 28 17:20:17 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T1FdF6DWsz56ByB; Thu, 28 Dec 2023 17:20: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T1FdF3PKbz3Zpl; Thu, 28 Dec 2023 17:20:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703784017; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m25k/OSigoQ5wxsLmCjOpV8KV3+t+zekw93EkTRyweQ=; b=CK9m6n30E0/rY3x0epb8q3/uZaa3/vHPRe2lz0dR38Apx5xq6uf2XJRR92OFrOH4VEThA3 F2GIBkJGadq+qMYLWLKzrp585yDByk6OtgdRtnyJ8NDsvtQdm1Ym9VHLyD/9753KO7XR2z N8e40cJQtbd/BjFMIxzqnAC3SJlGd8mD1ARQRwdL/j/PjtkaKFbn/Dl7T1BR1/KJ38+FMK 1wsthMY7mIx2pmDo6Z4oNHxp6fBLIKhHejSB4ceqJMu+Pe7tR4h8PCMc8AfwHB6Pq6EShm Ex7ZyCTwMeMDEupwXz9G7hUrtLFny6akQGMp8bfHlqdvAGD1IjIjHvk/wzw6cg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703784017; a=rsa-sha256; cv=none; b=rlkkkEol+fWt7g4z/HAsTSJ+AA5L4vE8zLCpR/TbLddWHre+kIvEryIVPa2831V08FCiKX 1bstDS4wkR9m+fKXEyHkBhjEt1DLm/Me+NsenscF+LsLhRH0w8ZLzo8PgMovIqGPa3te2d KpS2ot1brHEoe93L/D7CUb5NDtdtdBdD+OY2FUorTo9wswyrrzqz/Vm7CSvdZhJ1zs7Jyp GtYkDdTG8NRhcIMlVB0mJQ9ZrH60MmjUGXI+yZAbLGbfR56Ng+gMwZHbG9ptXH2CPQdpdZ WB/aWbau/nPEEddtwn9+mbZ+wBUkALzWFE7PW0iE/A1I7B+ogC3dIirgrq03iA== 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=1703784017; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m25k/OSigoQ5wxsLmCjOpV8KV3+t+zekw93EkTRyweQ=; b=g3vMvDqw+QXgAoRFWx3plRIOEbeH05Ee48g+U3U/xxHrbCXmJNqRlw44uQJMfHUE9MIDGF 16lYjvZEx4S3Z/IvGVHBycUyEo9InPjcoUC7/d+vNInkJ8+YWgohkK9ePT7vaMIxYL6fVa 2peIhLkWT1P/XHaLZo/tjUgX+ya84PTh11AFy/cCx08U0DqQVBWwU7z12x4t5F8Pw+FUC3 Smc5770kYvDDx9fnIM1J1FNSq3LzOEsUngt9Iv68g07+XbkZtfjHOORra7qHJ2V3OUUZRQ WbgkZtsij7SY4vKu/k/F5vJOR5EuJnLR0SYld1AZyswIP/SHC2mJrQpeOL9xhg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T1FdF2WGXzXBk; Thu, 28 Dec 2023 17:20:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BSHKHuB082032; Thu, 28 Dec 2023 17:20:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BSHKHrO082027; Thu, 28 Dec 2023 17:20:17 GMT (envelope-from git) Date: Thu, 28 Dec 2023 17:20:17 GMT Message-Id: <202312281720.3BSHKHrO082027@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Robert Clausecker Subject: git: 018743523a18 - stable/14 - share/man/man7/simd.7: document new timingsafe_bcmp(3) scalar, baseline implementations List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 018743523a18d118bc8b28415706e18822f8c4a2 Auto-Submitted: auto-generated The branch stable/14 has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=018743523a18d118bc8b28415706e18822f8c4a2 commit 018743523a18d118bc8b28415706e18822f8c4a2 Author: Robert Clausecker AuthorDate: 2023-08-31 15:34:44 +0000 Commit: Robert Clausecker CommitDate: 2023-12-28 17:02:41 +0000 share/man/man7/simd.7: document new timingsafe_bcmp(3) scalar, baseline implementations Sponsored by: The FreeBSD Foundation Approved by: security (cperciva) Differential Revision: https://reviews.freebsd.org/D41673 (cherry picked from commit a78879dfaa8cae5384fefc0f03f10e15dc28d994) --- share/man/man7/simd.7 | 69 ++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/share/man/man7/simd.7 b/share/man/man7/simd.7 index e5823f463ffb..057d74b944bc 100644 --- a/share/man/man7/simd.7 +++ b/share/man/man7/simd.7 @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE . -.Dd August 25, 2023 +.Dd August 31, 2023 .Dt SIMD 7 .Os .Sh NAME @@ -49,39 +49,40 @@ the environment variable can be used to override this mechanism. .Pp Enhanced functions are present in the following architectures: -.Bl -column FUNCTION__ aarch64_ arm_ amd64_ i386_ ppc64_ -offset indent -.It Em FUNCTION Ta Em AARCH64 Ta Em ARM Ta Em AMD64 Ta Em I386 Ta Em PPC64 -.It bcmp Ta Ta Ta S1 Ta S -.It bcopy Ta Ta S Ta S Ta S Ta SV -.It bzero Ta Ta S Ta S Ta S -.It div Ta Ta Ta S Ta S -.It index Ta S Ta Ta S1 -.It ldiv Ta Ta Ta S Ta S -.It lldiv Ta Ta Ta S -.It memchr Ta Ta Ta S1 -.It memcmp Ta Ta S Ta S1 Ta S -.It memcpy Ta S Ta S Ta S Ta S Ta SV -.It memmove Ta S Ta S Ta S Ta S Ta SV -.It memset Ta Ta S Ta S Ta S -.It rindex Ta S -.It stpcpy Ta Ta Ta S1 -.It strcat Ta Ta Ta S Ta S -.It strchr Ta S Ta Ta S1 Ta S -.It strchrnul Ta Ta Ta S1 -.It strcmp Ta Ta S Ta S Ta S -.It strcpy Ta Ta Ta S1 Ta S Ta S2 -.It strcspn Ta Ta Ta S2 -.It strlen Ta Ta S Ta S1 -.It strncmp Ta Ta S Ta Ta S -.It strncpy Ta Ta Ta Ta Ta S2 -.It strnlen Ta Ta Ta S1 -.It strrchr Ta S Ta Ta Ta S -.It strspn Ta Ta Ta S2 -.It swab Ta Ta Ta Ta S -.It wcschr Ta Ta Ta Ta S -.It wcscmp Ta Ta Ta Ta S -.It wcslen Ta Ta Ta Ta S -.It wmemchr Ta Ta Ta Ta S +.Bl -column FUNCTION________ aarch64_ arm_ amd64_ i386_ ppc64_ -offset indent +.It Em FUNCTION Ta Em AARCH64 Ta Em ARM Ta Em AMD64 Ta Em I386 Ta Em PPC64 +.It bcmp Ta Ta Ta S1 Ta S +.It bcopy Ta Ta S Ta S Ta S Ta SV +.It bzero Ta Ta S Ta S Ta S +.It div Ta Ta Ta S Ta S +.It index Ta S Ta Ta S1 +.It ldiv Ta Ta Ta S Ta S +.It lldiv Ta Ta Ta S +.It memchr Ta Ta Ta S1 +.It memcmp Ta Ta S Ta S1 Ta S +.It memcpy Ta S Ta S Ta S Ta S Ta SV +.It memmove Ta S Ta S Ta S Ta S Ta SV +.It memset Ta Ta S Ta S Ta S +.It rindex Ta S +.It stpcpy Ta Ta Ta S1 +.It strcat Ta Ta Ta S Ta S +.It strchr Ta S Ta Ta S1 Ta S +.It strchrnul Ta Ta Ta S1 +.It strcmp Ta Ta S Ta S Ta S +.It strcpy Ta Ta Ta S1 Ta S Ta S2 +.It strcspn Ta Ta Ta S2 +.It strlen Ta Ta S Ta S1 +.It strncmp Ta Ta S Ta Ta S +.It strncpy Ta Ta Ta Ta Ta S2 +.It strnlen Ta Ta Ta S1 +.It strrchr Ta S Ta Ta Ta S +.It strspn Ta Ta Ta S2 +.It swab Ta Ta Ta Ta S +.It timingsafe_bcmp Ta Ta Ta S1 +.It wcschr Ta Ta Ta Ta S +.It wcscmp Ta Ta Ta Ta S +.It wcslen Ta Ta Ta Ta S +.It wmemchr Ta Ta Ta Ta S .El .Pp .Sy S Ns :\ scalar (non-SIMD), From nobody Thu Dec 28 17:20:18 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T1FdG67tXz56CB4; Thu, 28 Dec 2023 17:20: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T1FdG4tbKz3Zpw; Thu, 28 Dec 2023 17:20:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703784018; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=g7CCQnv3Fup5JGP1qaipT8uUIWisyq5fJ/aNZUEoX1Q=; b=OXu6fUyaromXpUWAExsNkRwoHNi3HevDDFD3qwfW1dEymUaL1PoLSkAUoeAxMSCowS4jxm L7vxXQbZ0IZdNpxLC19oZSkfJxy5tJhxr87IwIvCLCBjMPrWrCtIBv72NR3gPIQpDfdqoG E7d6K1y49yLAjq8laC8K27jigg4I+ZxrfArmHKLAo2c57rVEzj8oQUPcjPJRltNCjuZRSe 5f6CJNDAHjKVItPDMFAoVE0WgXnleEr1uNr6PI22kts1owboowsHHj3jnt+n6oROgBSF3S gOWPeNYCLdUIob4KUARRoJSGpME7CZ+lFYYkrkCa0XuDLpDwbIqeF0hdSPBWzw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703784018; a=rsa-sha256; cv=none; b=b/POAdFTzMZKPjOdfZCeK1OpeZU6a2iOlbT5QxuPsZysOG7zxzwhwJz7+kj2wkxmsh2TE3 msmX2dEHiAw/W5l7Cjfnpmt8RIsMwcB0+ZpSiNA2+SKZx0a/voHJQeYq7UBiWKVefFWUA/ vbUoUndrF20A6tXO23RyseylSjfm/yfm++320xirtlptIejSBruPk2Jfi7/bfeNojyZ6Fm PjPofcSw/l6Vx1n+5OMNBYfilXfXsm0xKXPvYweYjkCvOtFGfxxaNJM1CTbKa2F66TYUQM +3Wm5vB2PZJNAaIoNvJamEPWsbzHk14CeBjpoZQcs3Hc1hWwjlEnyGIB0k8Dlg== 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=1703784018; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=g7CCQnv3Fup5JGP1qaipT8uUIWisyq5fJ/aNZUEoX1Q=; b=Tm0/x3wppigq2L6rxI1LTsrj8qUqyIz4zmMFacFoMYmluLplz3tfpEe6MDa1ThaS8Yj8tW kIRpfDu/4dMR/piv3V+Y2RxmuTqullAmUGlBGD2gQmH8+Q9OXHjg0yUmtdOVW8W08/l6OO 9V1568EAxCM9fCHMZlQZO4/cjGOTT2ru+2FeJlgjqwjspNcCQSd2TrG0N5iiBYYLWhQI76 haH+dW6OezoQtfmg0c+JsFaRi215IY6C603KGukZMq3SUWUlz7Q8+YsBCHkMF++qsj1KPK UHKFBOW1cyaLv/ByVrfXylEjuEBO89jgLYr8udJqxxydzglTxg5jbS1ntJrwUA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T1FdG3XfZzXQr; Thu, 28 Dec 2023 17:20:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BSHKIba082500; Thu, 28 Dec 2023 17:20:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BSHKI4L082497; Thu, 28 Dec 2023 17:20:18 GMT (envelope-from git) Date: Thu, 28 Dec 2023 17:20:18 GMT Message-Id: <202312281720.3BSHKI4L082497@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Robert Clausecker Subject: git: 9a6a587e672b - stable/14 - lib/libc/amd64/string: add timingsafe_memcmp() assembly implementation List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 9a6a587e672baaed3470f6cf4a27a0d1166ca372 Auto-Submitted: auto-generated The branch stable/14 has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=9a6a587e672baaed3470f6cf4a27a0d1166ca372 commit 9a6a587e672baaed3470f6cf4a27a0d1166ca372 Author: Robert Clausecker AuthorDate: 2023-10-15 19:25:53 +0000 Commit: Robert Clausecker CommitDate: 2023-12-28 17:02:41 +0000 lib/libc/amd64/string: add timingsafe_memcmp() assembly implementation Conceptually very similar to timingsafe_bcmp(), but with comparison logic inspired by Elijah Stone's fancy memcmp. A baseline (SSE) implementation was omitted this time as I was not able to get it to perform adequately. Best I got was 8% over the scalar version for long inputs, but slower for short inputs. Sponsored by: The FreeBSD Foundation Approved by: security (cperciva) Inspired by: https://github.com/moon-chilled/fancy-memcmp Differential Revision: https://reviews.freebsd.org/D41696 (cherry picked from commit 5048c1b85506c5e0f441ee7dd98dd8d96d0a4a24) --- lib/libc/amd64/string/Makefile.inc | 4 +- lib/libc/amd64/string/timingsafe_memcmp.S | 145 ++++++++++++++++++++++++++++++ 2 files changed, 147 insertions(+), 2 deletions(-) diff --git a/lib/libc/amd64/string/Makefile.inc b/lib/libc/amd64/string/Makefile.inc index fc420de0450e..09bf7c8f251e 100644 --- a/lib/libc/amd64/string/Makefile.inc +++ b/lib/libc/amd64/string/Makefile.inc @@ -1,4 +1,3 @@ - MDSRCS+= \ amd64_archlevel.c \ bcmp.S \ @@ -16,4 +15,5 @@ MDSRCS+= \ strlen.S \ strnlen.c \ strspn.S \ - timingsafe_bcmp.S + timingsafe_bcmp.S \ + timingsafe_memcmp.S diff --git a/lib/libc/amd64/string/timingsafe_memcmp.S b/lib/libc/amd64/string/timingsafe_memcmp.S new file mode 100644 index 000000000000..3f1eccdbd640 --- /dev/null +++ b/lib/libc/amd64/string/timingsafe_memcmp.S @@ -0,0 +1,145 @@ +/*- + * Copyright (c) 2023 The FreeBSD Foundation + * + * This software was developed by Robert Clausecker + * under sponsorship from the FreeBSD Foundation. + * + * 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 + +#define ALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */ + +/* int timingsafe_memcmp(const void *rdi, const void *rsi, size_t rdx) */ +ENTRY(timingsafe_memcmp) + cmp $16, %rdx # at least 17 bytes to process? + ja .Lgt16 + + cmp $8, %edx # at least 9 bytes to process? + ja .L0916 + + cmp $4, %edx # at least 5 bytes to process? + ja .L0508 + + cmp $2, %edx # at least 3 bytes to process? + ja .L0304 + + test %edx, %edx # buffer empty? + jnz .L0102 + + xor %eax, %eax # empty buffer always matches + ret + +.L0102: movzbl -1(%rdi, %rdx, 1), %eax # load 1--2 bytes from first buffer + movzbl -1(%rsi, %rdx, 1), %ecx + mov (%rdi), %ah # in big endian + mov (%rsi), %ch + sub %ecx, %eax + ret + +.L0304: movzwl -2(%rdi, %rdx, 1), %ecx + movzwl -2(%rsi, %rdx, 1), %edx + movzwl (%rdi), %eax + movzwl (%rsi), %esi + bswap %ecx # convert to big endian + bswap %edx # dito for edx, (e)ax, and (e)si + rol $8, %ax # ROLW is used here so the upper two + rol $8, %si # bytes stay clear, allowing us to + sub %edx, %ecx # save a SBB compared to .L0508 + sbb %esi, %eax + or %eax, %ecx # nonzero if not equal + setnz %al + ret + +.L0508: mov -4(%rdi, %rdx, 1), %ecx + mov -4(%rsi, %rdx, 1), %edx + mov (%rdi), %edi + mov (%rsi), %esi + bswap %ecx # compare in big endian + bswap %edx + bswap %edi + bswap %esi + sub %edx, %ecx + sbb %esi, %edi + sbb %eax, %eax # -1 if less, 0 if greater or equal + or %edi, %ecx # nonzero if not equal + setnz %al # negative if <, 0 if =, 1 if > + ret + +.L0916: mov -8(%rdi, %rdx, 1), %rcx + mov -8(%rsi, %rdx, 1), %rdx + mov (%rdi), %rdi + mov (%rsi), %rsi + bswap %rcx # compare in big endian + bswap %rdx + bswap %rdi + bswap %rsi + sub %rdx, %rcx + sbb %rsi, %rdi + sbb %eax, %eax # -1 if less, 0 if greater or equal + or %rdi, %rcx # nonzero if not equal + setnz %al # negative if <, 0 if =, 1 if > + ret + + /* compare 17+ bytes */ +.Lgt16: mov (%rdi), %r8 # process first 16 bytes + mov (%rsi), %r9 + mov $32, %ecx + cmp %r8, %r9 # mismatch in head? + cmove 8(%rdi), %r8 # if not, try second pair + cmove 8(%rsi), %r9 + cmp %rdx, %rcx + jae .Ltail + + /* main loop processing 16 bytes per iteration */ + ALIGN_TEXT +0: mov -16(%rdi, %rcx, 1), %r10 + mov -16(%rsi, %rcx, 1), %r11 + cmp %r10, %r11 # mismatch in first pair? + cmove -8(%rdi, %rcx, 1), %r10 # if not, try second pair + cmove -8(%rsi, %rcx, 1), %r11 + cmp %r8, %r9 # was there a mismatch previously? + cmove %r10, %r8 # apply new pair if there was not + cmove %r11, %r9 + add $16, %rcx + cmp %rdx, %rcx + jb 0b + +.Ltail: mov -8(%rdi, %rdx, 1), %r10 + mov -8(%rsi, %rdx, 1), %r11 + cmp %r8, %r9 + cmove -16(%rdi, %rdx, 1), %r8 + cmove -16(%rsi, %rdx, 1), %r9 + bswap %r10 # compare in big endian + bswap %r11 + bswap %r8 + bswap %r9 + sub %r11, %r10 + sbb %r9, %r8 + sbb %eax, %eax # -1 if less, 0 if greater or equal + or %r10, %r8 # nonzero if not equal + setnz %al # negative if <, 0 if =, 1 if > + ret +END(timingsafe_memcmp) + + .section .note.GNU-stack,"",%progbits From nobody Thu Dec 28 17:20:19 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T1FdJ0WS1z56C4M; Thu, 28 Dec 2023 17:20: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T1FdH59K9z3ZvG; Thu, 28 Dec 2023 17:20:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703784019; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ofP34gSMHYvYVGscafXLUaIN6IYGB9HxG3OlX7mG2dc=; b=HXy+vRcd+64vCFHQu3fC6wurQenGLpzCPlsSeQNkUJaKpjnZD511bEqp1I5E9Tuucy3DB6 7FH5u5EOZEstGngAHTNmV/47zXrqHeFaIkUy/dkF3vkcZ2gTcgl4VRv6aCumCadnI0nFlG a+3ZSw5BwP/YNCV13mJW6HnE/J8c/YUmyFtenF7JNIF7BRkTSxBNEj+pv2ou2DGoO+BBeR oJKOuoTTPaAz78pVDtHtJ/YA9yZtxdImwx9JZqFtypTvwfaWi/ZdD9vwUHGPW1LqlfAmz7 rP0wje4Dfu3eKr0Jq1aJoVpGxO/BP33m1UnSOMuW8HsOLbVJvFm3PBOBBM2gVQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703784019; a=rsa-sha256; cv=none; b=GeC70EFTpmM39qE7uqsIuefydk2Z+0OYaXhH2OSqYvt/Tx+PXxZlptzaND1vAThXmV8Aw4 YjbBbkiK9xVpMpFMmzqiGgPACVQddj61ZKH7nRluk1IN/2MozmEqT6sbzMPHCLA9ZZOGLB lPB4GlEV3seFOp6Zw70a3JXnZnx4QR5tZaYu33Clzf9KI1n5ny907DtnouV63ca4Q0KyYx lAmis+KfNZW0SOb0zoqknOhOpGPE/rHAY8veSrq5rHSJDQ743ErUDhV6IMQ4FV69AMhrWa RQUjXaRB8/4HExIZ+1Ans3eCC9tfF/Wdj0EdcNlisi0H8v7v7UuhdZ567lhk7g== 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=1703784019; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ofP34gSMHYvYVGscafXLUaIN6IYGB9HxG3OlX7mG2dc=; b=VITAlnLTbQnVxQhIgVWkXrsvtTCkxAM+2Di2udnihBvWS9d1Y/V0NO3IMJIqrwciIOZicp fA6KAscB8wbN3ypJpyEFGoUpU6g/hP6ofig1oPNhPfPtcATyB4pu8K8YYhdEH2Ewqkhe4U X7xdfrsc7I+KryoYDmSxJX7YvYaKtE5+zzzJVXbvh6/wFlw8/NpOWbkkIAXFdrLPIYbdTK Mvlg8T0UZyLl4mUGTe05OcGxWh1en5l3EcSjlwpqb+MlkA5PMgMMoAtOaG9tKHkFdccDz8 VJySLW2kXnWGCQw4konBk2SLPSr2qLjNtY8sWH4NQU/k5YZOpy/JJfeMc1c28w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T1FdH4HNxzWw6; Thu, 28 Dec 2023 17:20:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BSHKJ6w082542; Thu, 28 Dec 2023 17:20:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BSHKJw5082539; Thu, 28 Dec 2023 17:20:19 GMT (envelope-from git) Date: Thu, 28 Dec 2023 17:20:19 GMT Message-Id: <202312281720.3BSHKJw5082539@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Robert Clausecker Subject: git: 2e64c927d26e - stable/14 - share/man/man7/simd.7: document new amd64 timingsafe_memcmp() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 2e64c927d26ef36f64ec036ceb8945c7282dae6b Auto-Submitted: auto-generated The branch stable/14 has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=2e64c927d26ef36f64ec036ceb8945c7282dae6b commit 2e64c927d26ef36f64ec036ceb8945c7282dae6b Author: Robert Clausecker AuthorDate: 2023-10-15 19:29:20 +0000 Commit: Robert Clausecker CommitDate: 2023-12-28 17:02:41 +0000 share/man/man7/simd.7: document new amd64 timingsafe_memcmp() Sponsored by: The FreeBSD Foundation Approved by: security (cperciva) Differential Revision: https://reviews.freebsd.org/D41696 (cherry picked from commit a8cc4671c06ab77d5551a74cdebced8d859cac76) --- share/man/man7/simd.7 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/share/man/man7/simd.7 b/share/man/man7/simd.7 index 057d74b944bc..3fd8890c4f53 100644 --- a/share/man/man7/simd.7 +++ b/share/man/man7/simd.7 @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE . -.Dd August 31, 2023 +.Dd September 2, 2023 .Dt SIMD 7 .Os .Sh NAME @@ -49,7 +49,7 @@ the environment variable can be used to override this mechanism. .Pp Enhanced functions are present in the following architectures: -.Bl -column FUNCTION________ aarch64_ arm_ amd64_ i386_ ppc64_ -offset indent +.Bl -column FUNCTION_________ aarch64_ arm_ amd64_ i386_ ppc64_ -offset indent .It Em FUNCTION Ta Em AARCH64 Ta Em ARM Ta Em AMD64 Ta Em I386 Ta Em PPC64 .It bcmp Ta Ta Ta S1 Ta S .It bcopy Ta Ta S Ta S Ta S Ta SV @@ -79,6 +79,7 @@ Enhanced functions are present in the following architectures: .It strspn Ta Ta Ta S2 .It swab Ta Ta Ta Ta S .It timingsafe_bcmp Ta Ta Ta S1 +.It timingsafe_memcmp Ta Ta Ta S .It wcschr Ta Ta Ta Ta S .It wcscmp Ta Ta Ta Ta S .It wcslen Ta Ta Ta Ta S From nobody Fri Dec 29 00:34:57 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T1RGp0Hrtz551vx; Fri, 29 Dec 2023 00:34: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T1RGn6BPsz3Sf9; Fri, 29 Dec 2023 00:34:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703810097; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pdYQT1unfc283sCASh9mUw9Bcy/0sGETDSsjMhXiX3w=; b=QIJOLe7NqNYRAuRMMU9bX71oAJE611GWayTRjKbyeF8EPyM46ogTffut2UTT3OTzdtc9pg ic6ISbUcMfJnYGypzIEXE6euiPC18EsYo+K3J0SApOWp9vSDDrX6jQJE05iLk+5JZlTRH8 3iyHczYAnnOF/zvIc557dAlvwY7ajD2r5eVxeu4+O5fMQN579UwSKgmZAvMnBUjYEHJ4fn WuxVienNqGYHauW0mlfTchR/3jMq+DqL7w0g0P1+MGGzyJ9Bnj7Ri9EU1rUeaCBB4T6F9v QWgSF6iXEmRNjP41jm4+xoH58ygvmX3sBKIsHK/5fgXtrlluxE3+MSUAnOnbNA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703810097; a=rsa-sha256; cv=none; b=d1GY0csxCwO/XpanCH5aMsqeqN+q62cZwRgLPj2S+eh2ITxQWtOFvBD38OlzR+VCsa4Nma vsOf0apGCNgdnoo0a2/R4y7uJFFgwcetJUQFN+oKpNjacHQLGZe9XTf+4IgLKPXpzNTTYA KpzhCKcTgyeL9Mog7XtYR67TgT0V95cmJGH0ar5AkUilr193Ugp7tio06AMonGcOFRT+VV njjPhNkYYoz28UBZrVTy8JchsrK8E4uqPoSGpIVObn4uI8v84TRODotWx9qZeaViZBuM1z uUPCmFEZXVqFggPJo9A5ahytAE8u2wSsRANRL+/0zRAwaSOR7DL4RohnAmwTGA== 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=1703810097; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pdYQT1unfc283sCASh9mUw9Bcy/0sGETDSsjMhXiX3w=; b=kNfQugq64PAuRBzqZynRDZmAMUtEWmWi2/TqHG+BatKTi2GL03Y86Nd6vmHQz45x+Np7X4 Suhh+qA2zcSir1zwa9WbPedVj+ljZUhiHM8WNNyAxBrWvEEi+sr5oi8j+PmJOkIPUc+QlD vf2XgaU81ck4YgMgRuPAL4tAH7AgVBT4oPZbDuTzkiiBwqzRJ+DDDtVVkw3bqzq2mq8Ltg foUv3/P6pvwxZd8fubgo5FGvE3mCgY/+Jm7iKsSlrdzKpbHoC1AJZrXVfY/dhgHwGVVdQW zzWEak/NW/cjqld+Hclv46jQA60EAyPRc5HKxKxALkps0RgvmwHqdeoR2Bnb0Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T1RGn57lJzksk; Fri, 29 Dec 2023 00:34:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BT0Yvtq009679; Fri, 29 Dec 2023 00:34:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BT0Yv5T009676; Fri, 29 Dec 2023 00:34:57 GMT (envelope-from git) Date: Fri, 29 Dec 2023 00:34:57 GMT Message-Id: <202312290034.3BT0Yv5T009676@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 6ed6db3206ea - stable/14 - vmm_iommu_modify(): split vm_iommu_map()/unmap() into separate functions List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 6ed6db3206ea96c68ffd2a952a5d0188c73b1260 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=6ed6db3206ea96c68ffd2a952a5d0188c73b1260 commit 6ed6db3206ea96c68ffd2a952a5d0188c73b1260 Author: Konstantin Belousov AuthorDate: 2023-12-21 00:00:33 +0000 Commit: Konstantin Belousov CommitDate: 2023-12-29 00:33:21 +0000 vmm_iommu_modify(): split vm_iommu_map()/unmap() into separate functions (cherry picked from commit 3abc72f8716b55fc71e9463388f5a74fb6abf5ce) --- sys/amd64/vmm/vmm.c | 82 +++++++++++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 37 deletions(-) diff --git a/sys/amd64/vmm/vmm.c b/sys/amd64/vmm/vmm.c index bf5173d9d592..db81f63c9614 100644 --- a/sys/amd64/vmm/vmm.c +++ b/sys/amd64/vmm/vmm.c @@ -1040,54 +1040,68 @@ vmm_sysmem_maxaddr(struct vm *vm) } static void -vm_iommu_modify(struct vm *vm, bool map) +vm_iommu_map(struct vm *vm) { - int i, sz; vm_paddr_t gpa, hpa; struct mem_map *mm; - void *vp, *cookie, *host_domain; - - sz = PAGE_SIZE; - host_domain = iommu_host_domain(); + void *vp, *cookie; + int i; for (i = 0; i < VM_MAX_MEMMAPS; i++) { mm = &vm->mem_maps[i]; if (!sysmem_mapping(vm, mm)) continue; - if (map) { - KASSERT((mm->flags & VM_MEMMAP_F_IOMMU) == 0, - ("iommu map found invalid memmap %#lx/%#lx/%#x", - mm->gpa, mm->len, mm->flags)); - if ((mm->flags & VM_MEMMAP_F_WIRED) == 0) - continue; - mm->flags |= VM_MEMMAP_F_IOMMU; - } else { - if ((mm->flags & VM_MEMMAP_F_IOMMU) == 0) - continue; - mm->flags &= ~VM_MEMMAP_F_IOMMU; - KASSERT((mm->flags & VM_MEMMAP_F_WIRED) != 0, - ("iommu unmap found invalid memmap %#lx/%#lx/%#x", - mm->gpa, mm->len, mm->flags)); - } + KASSERT((mm->flags & VM_MEMMAP_F_IOMMU) == 0, + ("iommu map found invalid memmap %#lx/%#lx/%#x", + mm->gpa, mm->len, mm->flags)); + if ((mm->flags & VM_MEMMAP_F_WIRED) == 0) + continue; + mm->flags |= VM_MEMMAP_F_IOMMU; - gpa = mm->gpa; - while (gpa < mm->gpa + mm->len) { + for (gpa = mm->gpa; gpa < mm->gpa + mm->len; gpa += PAGE_SIZE) { vp = vm_gpa_hold_global(vm, gpa, PAGE_SIZE, VM_PROT_WRITE, &cookie); KASSERT(vp != NULL, ("vm(%s) could not map gpa %#lx", vm_name(vm), gpa)); - vm_gpa_release(cookie); hpa = DMAP_TO_PHYS((uintptr_t)vp); - if (map) { - iommu_create_mapping(vm->iommu, gpa, hpa, sz); - } else { - iommu_remove_mapping(vm->iommu, gpa, sz); - } + iommu_create_mapping(vm->iommu, gpa, hpa, PAGE_SIZE); + } + } + + iommu_invalidate_tlb(iommu_host_domain()); +} + +static void +vm_iommu_unmap(struct vm *vm) +{ + vm_paddr_t gpa; + struct mem_map *mm; + void *vp, *cookie; + int i; + + for (i = 0; i < VM_MAX_MEMMAPS; i++) { + mm = &vm->mem_maps[i]; + if (!sysmem_mapping(vm, mm)) + continue; + + if ((mm->flags & VM_MEMMAP_F_IOMMU) == 0) + continue; + mm->flags &= ~VM_MEMMAP_F_IOMMU; + KASSERT((mm->flags & VM_MEMMAP_F_WIRED) != 0, + ("iommu unmap found invalid memmap %#lx/%#lx/%#x", + mm->gpa, mm->len, mm->flags)); - gpa += PAGE_SIZE; + for (gpa = mm->gpa; gpa < mm->gpa + mm->len; gpa += PAGE_SIZE) { + vp = vm_gpa_hold_global(vm, gpa, PAGE_SIZE, + VM_PROT_WRITE, &cookie); + KASSERT(vp != NULL, ("vm(%s) could not map gpa %#lx", + vm_name(vm), gpa)); + vm_gpa_release(cookie); + + iommu_remove_mapping(vm->iommu, gpa, PAGE_SIZE); } } @@ -1095,15 +1109,9 @@ vm_iommu_modify(struct vm *vm, bool map) * Invalidate the cached translations associated with the domain * from which pages were removed. */ - if (map) - iommu_invalidate_tlb(host_domain); - else - iommu_invalidate_tlb(vm->iommu); + iommu_invalidate_tlb(vm->iommu); } -#define vm_iommu_unmap(vm) vm_iommu_modify((vm), false) -#define vm_iommu_map(vm) vm_iommu_modify((vm), true) - int vm_unassign_pptdev(struct vm *vm, int bus, int slot, int func) { From nobody Fri Dec 29 00:34:58 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T1RGq0XfBz551vy; Fri, 29 Dec 2023 00:34:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T1RGp6NPrz3SnT; Fri, 29 Dec 2023 00:34:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703810098; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=F1uO+gJ5kTSO2pfXvXsx4M93Hzdxi5jk7uP3tvSUxr8=; b=aByZ/DoFzHOU+Io20YlHlYwk1Id+0QT6pjU+cRl0VJAhBWwzBOllFD5b36bOGA0RLRB0OD Xpn4H1F0BXThaFaT5lxxBKuq5zInvxg6Xvqz4D7IAhzL1X2MfEHcqeUNUduekjf5IWKqEv UG4cC0W4I/LDDk80SPzDAHWC3QSFITYwfcV2YZGp9WIffa9wxAwX+R70nvLqhel2cKzH2a ymEG3XOx8ZgPj8jxlqm5jmWtteZQTmQe3DoWaeu6YyAHbhrmUdwb8TVceCgBKvprrNZ7kL wz5iP8t2cCLn3uDC4EieTFxOC95y2hptJiqsu3Xv1s/VUaBn5qbNNLcdgeXOOA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703810098; a=rsa-sha256; cv=none; b=ezqo+L9hwCWMVVCuzkFk+eWoy+O0U3AD7w+sYmYK4KLGoYcA3m+Ul/cslh9tSDTAH+fCN4 zE797EvOEYfkJs+pD+OJiVySppLcAiZKLI9c+SxArUNKV0KtCcfXwkBgDkmsvlOWuf2Sw4 NG1zur/PEWYzqlwpE7KxNZP9erOQkOJsvkiM6zWzLjcwKlPsigrbBMw9LsnyCUi5x75E9Y WHlg5wgaUSNzpQnIhmjr9DXrZnq0XV5VuMnF9Em8flFDY9WhzPBYYEL7dhiaY0envvsLvf zQyZd+W2iDdTNfBK/YVUHDM0cBLT8BehX+lHG4rl7gc1OC8ipGjIVfd5jYVXPg== 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=1703810098; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=F1uO+gJ5kTSO2pfXvXsx4M93Hzdxi5jk7uP3tvSUxr8=; b=AJlJ0Op+wrqL7iIcg2VtcZS2BB024K8gUjacr7LsygwmFrrVNBd9dXrMgZQTkX5qTKBMLq ywEDpMHZL3YemxZH2Uhc6HDWgwi+BxqSJQEgMuULbuFyFBu+6FOfD/DzTzn0E1MlDQ2/5h WgrALvQE/kGFQBwTBsBZ2aFe1yAZDFmYi0/F2Khza1jWtN2F64saDOzDbWY3iyNa1nfUxs fj5NhgpKxCu7dFY8rvaHcp/Ou1g3Nq9bBfyUlFF/x6HbycFqCBqMyOJo9zxNFawY7WB8He hiHbvL6imvNQlv98eO1kxYvxvibBUph/3tMTue7uWe1AA/9aAFsB8tVtSkVZ7Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T1RGp5SNYzl4G; Fri, 29 Dec 2023 00:34:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BT0YwPU009727; Fri, 29 Dec 2023 00:34:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BT0YwJS009724; Fri, 29 Dec 2023 00:34:58 GMT (envelope-from git) Date: Fri, 29 Dec 2023 00:34:58 GMT Message-Id: <202312290034.3BT0YwJS009724@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: e9251d68b206 - stable/14 - vm_iommu_map()/unmap(): stop transiently wiring already wired pages List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: e9251d68b206d4ea4be4413c17e008c76dd49e79 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e9251d68b206d4ea4be4413c17e008c76dd49e79 commit e9251d68b206d4ea4be4413c17e008c76dd49e79 Author: Konstantin Belousov AuthorDate: 2023-12-21 00:12:37 +0000 Commit: Konstantin Belousov CommitDate: 2023-12-29 00:33:21 +0000 vm_iommu_map()/unmap(): stop transiently wiring already wired pages (cherry picked from commit 671a00491d7ac9d6663cdc597ff8c13024eda00d) --- sys/amd64/vmm/vmm.c | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/sys/amd64/vmm/vmm.c b/sys/amd64/vmm/vmm.c index db81f63c9614..d44adc86252d 100644 --- a/sys/amd64/vmm/vmm.c +++ b/sys/amd64/vmm/vmm.c @@ -1044,9 +1044,10 @@ vm_iommu_map(struct vm *vm) { vm_paddr_t gpa, hpa; struct mem_map *mm; - void *vp, *cookie; int i; + sx_assert(&vm->mem_segs_lock, SX_LOCKED); + for (i = 0; i < VM_MAX_MEMMAPS; i++) { mm = &vm->mem_maps[i]; if (!sysmem_mapping(vm, mm)) @@ -1060,13 +1061,24 @@ vm_iommu_map(struct vm *vm) mm->flags |= VM_MEMMAP_F_IOMMU; for (gpa = mm->gpa; gpa < mm->gpa + mm->len; gpa += PAGE_SIZE) { - vp = vm_gpa_hold_global(vm, gpa, PAGE_SIZE, - VM_PROT_WRITE, &cookie); - KASSERT(vp != NULL, ("vm(%s) could not map gpa %#lx", - vm_name(vm), gpa)); - vm_gpa_release(cookie); + hpa = pmap_extract(vmspace_pmap(vm->vmspace), gpa); + + /* + * All mappings in the vmm vmspace must be + * present since they are managed by vmm in this way. + * Because we are in pass-through mode, the + * mappings must also be wired. This implies + * that all pages must be mapped and wired, + * allowing to use pmap_extract() and avoiding the + * need to use vm_gpa_hold_global(). + * + * This could change if/when we start + * supporting page faults on IOMMU maps. + */ + KASSERT(vm_page_wired(PHYS_TO_VM_PAGE(hpa)), + ("vm_iommu_map: vm %p gpa %jx hpa %jx not wired", + vm, (uintmax_t)gpa, (uintmax_t)hpa)); - hpa = DMAP_TO_PHYS((uintptr_t)vp); iommu_create_mapping(vm->iommu, gpa, hpa, PAGE_SIZE); } } @@ -1079,9 +1091,10 @@ vm_iommu_unmap(struct vm *vm) { vm_paddr_t gpa; struct mem_map *mm; - void *vp, *cookie; int i; + sx_assert(&vm->mem_segs_lock, SX_LOCKED); + for (i = 0; i < VM_MAX_MEMMAPS; i++) { mm = &vm->mem_maps[i]; if (!sysmem_mapping(vm, mm)) @@ -1095,12 +1108,10 @@ vm_iommu_unmap(struct vm *vm) mm->gpa, mm->len, mm->flags)); for (gpa = mm->gpa; gpa < mm->gpa + mm->len; gpa += PAGE_SIZE) { - vp = vm_gpa_hold_global(vm, gpa, PAGE_SIZE, - VM_PROT_WRITE, &cookie); - KASSERT(vp != NULL, ("vm(%s) could not map gpa %#lx", - vm_name(vm), gpa)); - vm_gpa_release(cookie); - + KASSERT(vm_page_wired(PHYS_TO_VM_PAGE(pmap_extract( + vmspace_pmap(vm->vmspace), gpa))), + ("vm_iommu_unmap: vm %p gpa %jx not wired", + vm, (uintmax_t)gpa)); iommu_remove_mapping(vm->iommu, gpa, PAGE_SIZE); } } From nobody Fri Dec 29 00:34:59 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T1RGr4Ztdz551xH; Fri, 29 Dec 2023 00:35: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T1RGr0YkKz3StS; Fri, 29 Dec 2023 00:35:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703810100; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nqTcQ65SGCcG30EN9hA0vfOdTJPJCYwhaah3bUCyhmU=; b=Ls2ungniSSzOfQabVodqksxS2kP5v6Ms4NbyRek3keLmbGDaHFuOrmnxclUp/G73JLhIVF GNnQmHIMfJowzgPjMqPAtpoRbhjxEnjMSysA0zNaaQhWZx1B75If0dq86c02MNW4eck+jF Hk9LKSHe+JrbdR1N7P42cMO648ZsO1AK1xQI8ay0rgLyG6CX4J262BCs1QXkLG86pQWGVs YAS+YhDBePepagkI5tTdyT7kNYYkRMWP4FR6ioEMP704JmpVQ3w0FWD4Y2ahvRk0kZWVMM CLV/zRPycLwLOH6c0mkbUMIEB7zKarT+tzLfs2CZma1ZOlLHUjGsGImudPHvPg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703810100; a=rsa-sha256; cv=none; b=DKHtkElsnrvuGHhhb3hRsbjy3d8PYVeQPS/ttwSSwXnlS7NEnaA30CVdOymi+DjVtRaS91 ScVJ36ZXvvSmulOE9ivQf49+hhwXJyBw88eNNm8QokB5dq1JZNQyzPL+A6bcSOqzglnuUA 5zt6U/66ilDR+IJesPpwx6u95rYcrbVsDc5c89lKmkSstqgF2GZeagpkb6vbpEjzifvCKN Iyb3RZFGxuhi6XoAKeGV1M+aGqkY2HOHQYKaH66E2ZMf0C+Pab8NQPomx76050niG6CmLY pVLSa2+n1yc3MRU1Lp2DYharYtIEOm28inc1ZYCnwuJ6hxtHME8ZKwxVvzaVsA== 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=1703810100; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nqTcQ65SGCcG30EN9hA0vfOdTJPJCYwhaah3bUCyhmU=; b=e6OeDaICJ9uuFlulylUzQDKsg8Irwetr0ttQagTX4hLJcW2MuqvOCMhQGT2hJOhEUzkaNP E7ahvepKMkBJI8WxiJ/SMvMdffb3L1HrbrerPJ9EA8U8HV39/PwfWDOMvGq1L3fOCC44dp F6FGC029VboCsrT7vuOJ5V7jMNcc8wjwa5xJxM6KlI85/JKt3/YPtDbEISVrMpXS9RiqxM gXeXF+j9aJEigMcuUYwg9sqQlNocqg5VMHYdpIwmvXDuggZXVNzKvGVcTUKQym2iMw2982 yVWysqHbdQ+yBLdGhfwCiMir62Wv0ii4Rc1iUpKbzoj60XfhmbsXD66sAr5P5Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T1RGq6SJrzl4H; Fri, 29 Dec 2023 00:34:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BT0YxPc009769; Fri, 29 Dec 2023 00:34:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BT0Yx8x009766; Fri, 29 Dec 2023 00:34:59 GMT (envelope-from git) Date: Fri, 29 Dec 2023 00:34:59 GMT Message-Id: <202312290034.3BT0Yx8x009766@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 2001d7f6a272 - stable/14 - vfs_domount_update(): correct fsidcmp() usage List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 2001d7f6a272cff780937b9bd9a4f625035fb92c Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2001d7f6a272cff780937b9bd9a4f625035fb92c commit 2001d7f6a272cff780937b9bd9a4f625035fb92c Author: Andrew Gierth AuthorDate: 2023-12-24 12:04:21 +0000 Commit: Konstantin Belousov CommitDate: 2023-12-29 00:34:07 +0000 vfs_domount_update(): correct fsidcmp() usage (cherry picked from commit 2a1d50fc12f6e604da834fbaea961d412aae6e85) --- sys/kern/vfs_mount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 1ba3b1559a69..79a23b058add 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -1389,7 +1389,7 @@ vfs_domount_update( error = EINVAL; goto end; } - if (fsidcmp(&fsid_up, &mp->mnt_stat.f_fsid) != 0) { + if (fsidcmp(fsid_up, &mp->mnt_stat.f_fsid) != 0) { error = ENOENT; goto end; } From nobody Fri Dec 29 00:36:12 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T1RJF1fHJz552Gh; Fri, 29 Dec 2023 00:36: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T1RJF14Dlz3Tb5; Fri, 29 Dec 2023 00:36:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703810173; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=s4S/FqXKiPGLo4uxg7rtA0uxJjq+Mc5voeYJy/o7dCA=; b=dBm/jcj6icdqUIOUN79quiax6dkus1QddovQGPMlrOj2s9E5rXTOXaE7/Gxe0bqRB8Byth WG8XbpDqhvgTRUV9282LXR7I3CuWTmeRIgzC/JSaMY9JRKlKa6/2lqf7g3bfz9/DP6nLfK lJwLdK9S6GEJ+sHb1lE1o7BbXp7trj0QzR2r1Ul+CkrVHVE5GphPieDnGoZ+PW1wNSZR01 aE+PD1GyY4u+L9Zilz7siRqAzF4hsnmKAb7jzbV5xtsf6uwHU7gmdkslUL7Nw6sL1QjFun I+vUrLm4YUcnNafcfrx25baFlWb6wQbnfn6JD4q9Db3AdBFdzr0WqN8Tllme4A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703810173; a=rsa-sha256; cv=none; b=u57GZ1yW102V1KrQe4yspf6JPKDzB6dt4N7bnpjP3YOzePJaadKy22iwNZ5+Qs7lidE7o9 v7gJfYbLB6qEMT6hx51xeYq7BtM+sAYXY8FG6qgJuyQacEGNK2qc0UBcXij+bo6HFUKE3t KaUAtpTlORB1ZhVc3cpfNxCTvz/ZEgyiQTMcvejCQn+MTns2PXXJBr2uh5uEIvSyrokvaK xtBNavdFv5gtboYYqLbn9Esfory6E5rZ2xKY4Lyr/OW8RPkBbHcxB5fbiIuMBvGIjj1YpB ry1l/QjorOEhni0drurbZfUd0RegQ0m/0td0n0jpx+a1Ry/YFyEYF1e75DVH0A== 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=1703810173; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=s4S/FqXKiPGLo4uxg7rtA0uxJjq+Mc5voeYJy/o7dCA=; b=bCM4ng7jyJ7fBEZmemLjxVXXjqmQz7Hh7uXOFEJlX070DRtUtdkfHphl0QkIRvcjkWAAz3 N2B60Z3ImEEw/riAdY602J+mtLcwmPM/bmszCEs3hPkTm0QVxhOqhDQwaRNE6KBNFcde3L c70XI9gCCeAsk4iqImfWMSC7K4JYRgpiKN8awmEnN4U+WVA0QH3kuYm4tCjDEomDFQlCCx +2bVwE7IEfW8CjhJXedHfJmrhUWp+CCrf7Vlo/9yorXJWF3ozbr0oJoovuKfkATUESeKib ssRdpwJEnjHC5ABe8e7e3LMuMcHBMmhS4/BcS3DLQYfoaqcV7Rq6JV5PoXrVQQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T1RJF07mkzksm; Fri, 29 Dec 2023 00:36:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BT0aCJB010083; Fri, 29 Dec 2023 00:36:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BT0aCnv010080; Fri, 29 Dec 2023 00:36:12 GMT (envelope-from git) Date: Fri, 29 Dec 2023 00:36:12 GMT Message-Id: <202312290036.3BT0aCnv010080@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 71fceff24809 - stable/13 - vfs_domount_update(): correct fsidcmp() usage List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 71fceff2480999b3fc921f47ec9adea9eff32041 Auto-Submitted: auto-generated The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=71fceff2480999b3fc921f47ec9adea9eff32041 commit 71fceff2480999b3fc921f47ec9adea9eff32041 Author: Andrew Gierth AuthorDate: 2023-12-24 12:04:21 +0000 Commit: Konstantin Belousov CommitDate: 2023-12-29 00:35:45 +0000 vfs_domount_update(): correct fsidcmp() usage (cherry picked from commit 2a1d50fc12f6e604da834fbaea961d412aae6e85) --- sys/kern/vfs_mount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index cefadf75a3a8..8ad5b34c729d 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -1230,7 +1230,7 @@ vfs_domount_update( error = EINVAL; goto end; } - if (fsidcmp(&fsid_up, &mp->mnt_stat.f_fsid) != 0) { + if (fsidcmp(fsid_up, &mp->mnt_stat.f_fsid) != 0) { error = ENOENT; goto end; } From nobody Fri Dec 29 23:08:52 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T21K03LCdz55THq; Fri, 29 Dec 2023 23:08: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T21K02Y2dz4GYb; Fri, 29 Dec 2023 23:08:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703891332; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tN01hN1eoLFFB9x1CewTwK/7sn9x+AXRc/pwQ2VUrUQ=; b=E2lcM4yGTneieGm4Bx08uXQ1e1ULTSNKwaXswnKT9ZJHPTpc2EbHX2hodlzfuTfBqMVwqc zN/4yolDJBTT6Bu13o3rzsP+d6rfb1x4Oh4H7BNKyyCXYWuADQmnjKCZ2hD68/mytphWDG kQsiSZYKgXDlD9SrKtn5S7g9XIy9K+lAS19B0FyWhpAnm3k8TAEvkUA6MEw8BT0Y5Dhz7A SNg6yhmYa90b89zYGF2NgY1X005m0F5hx161Wu2Z9pJpcOnWKSdE384NBLR7TD25o4GQ9Y HbAgv7xDzklW5Kf7AndCqoZf5uYIZJDlAzqwgWYaDeOlnBv2U+Q6BvRtc38HDA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703891332; a=rsa-sha256; cv=none; b=RB/tqYjoeq3k3yADJXqwSHhmHVbA0juDuaY3Oit6GSrqDmYUsVUJaAj/Mj/WNsSdKIB7Xz 2hhUPIfEnipSHBXQTElwBk4motfjZ2YHGmpyIUgFxtv3UHtsd/rzABwX3/BA6PQRXN87cS hbocu4T7HIMMfqvXzP+adC2UKfQvZAz+QQeZdNExOfUjGWwciU0RbmcS+VESM6/7lflchP J+PdVkR1yXgA9i9TeUixxLjZg9rotIORWLCmK9btWwBuosotcf9FuURY7MGhGFbA1am8l2 1LdbqUO0YW+/USq+5h8QIzeoCyzh9/1zNUn1ajTi0vMCf0mv9FyWAC/7X6mpsQ== 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=1703891332; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tN01hN1eoLFFB9x1CewTwK/7sn9x+AXRc/pwQ2VUrUQ=; b=kOgg2s17kZCkNjyzi8INm4Ubq86xnnvqwJp8qi1G9QpWR+RaNUJD2E+6STqBB8YYp+/1J/ eL9pd/1jvEeQwsDjfw5ShltpKFl3ozYb0WdQMpOCmrvPoOJxpzzUuUreZDBg/fFjYDbNuI Ftwtb9hl04iDLaFLIeVyjfm0h1mvL9E7VGPzfVYGhdvoTOfbKpDIdd5xYPjjJgskLPZ1V8 O8fY6sxOwwlnmkJEvxC7emp2/wB5rIHv8DTNV/t+nAf4VpexM6ccjvKPPdCSN35uyWvL4C 11rY0hixW16vxDoI3HSNdLLvWfoXnxnABuMZ7FN130Vx0G54CMR3U2N8PAspvw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T21K01Gj6z9HJ; Fri, 29 Dec 2023 23:08:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BTN8qki075396; Fri, 29 Dec 2023 23:08:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BTN8qjS075393; Fri, 29 Dec 2023 23:08:52 GMT (envelope-from git) Date: Fri, 29 Dec 2023 23:08:52 GMT Message-Id: <202312292308.3BTN8qjS075393@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 0609ca2f19d4 - stable/14 - padlock: Switch to using FPU_KERN_NOCTX List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 0609ca2f19d48d95005fc6b3b71422cce708c372 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=0609ca2f19d48d95005fc6b3b71422cce708c372 commit 0609ca2f19d48d95005fc6b3b71422cce708c372 Author: John Baldwin AuthorDate: 2023-08-25 19:34:05 +0000 Commit: John Baldwin CommitDate: 2023-12-29 21:49:41 +0000 padlock: Switch to using FPU_KERN_NOCTX Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D41582 (cherry picked from commit 3b0e353fe64221b6fbb335348b4a54d12de95243) --- sys/crypto/via/padlock.c | 23 +++++++++-------------- sys/crypto/via/padlock.h | 3 --- sys/crypto/via/padlock_cipher.c | 5 +++-- sys/crypto/via/padlock_hash.c | 5 +++-- 4 files changed, 15 insertions(+), 21 deletions(-) diff --git a/sys/crypto/via/padlock.c b/sys/crypto/via/padlock.c index 314beffbe2f5..b8dae256dbf4 100644 --- a/sys/crypto/via/padlock.c +++ b/sys/crypto/via/padlock.c @@ -36,6 +36,7 @@ #if defined(__amd64__) || defined(__i386__) #include #include +#include #include #include #endif @@ -62,8 +63,7 @@ static int padlock_probesession(device_t, const struct crypto_session_params *); static int padlock_newsession(device_t, crypto_session_t cses, const struct crypto_session_params *); static void padlock_freesession(device_t, crypto_session_t cses); -static void padlock_freesession_one(struct padlock_softc *sc, - struct padlock_session *ses); +static void padlock_freesession_one(struct padlock_session *ses); static int padlock_process(device_t, struct cryptop *crp, int hint __unused); MALLOC_DEFINE(M_PADLOCK, "padlock_data", "PadLock Data"); @@ -177,28 +177,25 @@ static int padlock_newsession(device_t dev, crypto_session_t cses, const struct crypto_session_params *csp) { - struct padlock_softc *sc = device_get_softc(dev); - struct padlock_session *ses = NULL; + struct padlock_session *ses; struct thread *td; int error; ses = crypto_get_driver_session(cses); - ses->ses_fpu_ctx = fpu_kern_alloc_ctx(FPU_KERN_NORMAL); error = padlock_cipher_setup(ses, csp); if (error != 0) { - padlock_freesession_one(sc, ses); + padlock_freesession_one(ses); return (error); } if (csp->csp_mode == CSP_MODE_ETA) { td = curthread; - fpu_kern_enter(td, ses->ses_fpu_ctx, FPU_KERN_NORMAL | - FPU_KERN_KTHR); + fpu_kern_enter(td, NULL, FPU_KERN_NORMAL | FPU_KERN_NOCTX); error = padlock_hash_setup(ses, csp); - fpu_kern_leave(td, ses->ses_fpu_ctx); + fpu_kern_leave(td, NULL); if (error != 0) { - padlock_freesession_one(sc, ses); + padlock_freesession_one(ses); return (error); } } @@ -207,21 +204,19 @@ padlock_newsession(device_t dev, crypto_session_t cses, } static void -padlock_freesession_one(struct padlock_softc *sc, struct padlock_session *ses) +padlock_freesession_one(struct padlock_session *ses) { padlock_hash_free(ses); - fpu_kern_free_ctx(ses->ses_fpu_ctx); } static void padlock_freesession(device_t dev, crypto_session_t cses) { - struct padlock_softc *sc = device_get_softc(dev); struct padlock_session *ses; ses = crypto_get_driver_session(cses); - padlock_freesession_one(sc, ses); + padlock_freesession_one(ses); } static int diff --git a/sys/crypto/via/padlock.h b/sys/crypto/via/padlock.h index 93ee9ab9c8b3..162d281506e2 100644 --- a/sys/crypto/via/padlock.h +++ b/sys/crypto/via/padlock.h @@ -30,8 +30,6 @@ #include #include -#include - union padlock_cw { uint64_t raw; struct { @@ -66,7 +64,6 @@ struct padlock_session { uint8_t *ses_ictx; uint8_t *ses_octx; int ses_mlen; - struct fpu_kern_ctx *ses_fpu_ctx; }; #define PADLOCK_ALIGN(p) (void *)(roundup2((uintptr_t)(p), 16)) diff --git a/sys/crypto/via/padlock_cipher.c b/sys/crypto/via/padlock_cipher.c index 253a84875626..136954870ae3 100644 --- a/sys/crypto/via/padlock_cipher.c +++ b/sys/crypto/via/padlock_cipher.c @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -221,10 +222,10 @@ padlock_cipher_process(struct padlock_session *ses, struct cryptop *crp, } td = curthread; - fpu_kern_enter(td, ses->ses_fpu_ctx, FPU_KERN_NORMAL | FPU_KERN_KTHR); + fpu_kern_enter(td, NULL, FPU_KERN_NORMAL | FPU_KERN_NOCTX); padlock_cbc(abuf, abuf, crp->crp_payload_length / AES_BLOCK_LEN, key, cw, iv); - fpu_kern_leave(td, ses->ses_fpu_ctx); + fpu_kern_leave(td, NULL); if (allocated) { crypto_copyback(crp, crp->crp_payload_start, diff --git a/sys/crypto/via/padlock_hash.c b/sys/crypto/via/padlock_hash.c index 706452c45a3e..d3cf46e10c5f 100644 --- a/sys/crypto/via/padlock_hash.c +++ b/sys/crypto/via/padlock_hash.c @@ -36,6 +36,7 @@ #if defined(__amd64__) || defined(__i386__) #include #include +#include #include #include #endif @@ -392,13 +393,13 @@ padlock_hash_process(struct padlock_session *ses, struct cryptop *crp, int error; td = curthread; - fpu_kern_enter(td, ses->ses_fpu_ctx, FPU_KERN_NORMAL | FPU_KERN_KTHR); + fpu_kern_enter(td, NULL, FPU_KERN_NORMAL | FPU_KERN_NOCTX); if (crp->crp_auth_key != NULL) padlock_hash_key_setup(ses, crp->crp_auth_key, csp->csp_auth_klen); error = padlock_authcompute(ses, crp); - fpu_kern_leave(td, ses->ses_fpu_ctx); + fpu_kern_leave(td, NULL); return (error); } From nobody Fri Dec 29 23:08:53 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T21K13xkbz55TCH; Fri, 29 Dec 2023 23:08: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T21K135mqz4GwW; Fri, 29 Dec 2023 23:08:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703891333; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YDGzL3ZE6vPTuZ5yOl6HsAIweXtpO7y3rqSxwW1PElA=; b=CyliZ4tGK3EEL2KjNcEiWTg+qMv5dVF37AYVvZgAPET0Ty8HIp+hseFLRgE/NsvbXQXdle TYf0oqsGSrhBIKcd1JaWiKDxJ2r8zBbzVrHgOQNW1FZOFrW59r1bRhDaKeyz49DPf1OKyx 6TLcA0qWCAl37AD69DicxSoQYo4GMMnYdiJUyjtmM28C8OEYj4MHr5+cmLDIqvAHDBqCu8 c9H6PUl7q19Uwpq4gmK9zrix3z/bhn4AzwXr4Obg7tgMBgKehj1jlIPrsiH97150PsIe88 IHHnY4SOg11Hcf8HCTO7+Zy75LT2z/LLxYBx0dMHAjiV6PK+X1uSHkuGCQ2EqQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703891333; a=rsa-sha256; cv=none; b=rWvZ4i5QAQCwc0sCMYGxCFE7bu6JDPN/sWGH3Enccn0TGYQDyxbs62h7yEscQk5ui1cPRw wRi3/VhdTzNeHmry5ppHK2j5qR6sD6rSbmUIudPquPW6xFhNHLTgpYYcxN7fmm+O5OixSt oIfAjUJ8v5QvRE+3Xc9RU50cqq1y54JVGutqRQPoanUBdgHff3miF3KgtMhsUtYSsD/Fwr POkexYaYOZVnAqUiWX5IAbZOsd09N1QltOC4McqY4tcNRTO314z607r8VT9tBdCVKGqgvn SLnCJYd8uI7Q1/F38wEoGni6Abc8C8w0fB7jVhQbMXVXbW41f4SY7NcAKYlxgA== 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=1703891333; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YDGzL3ZE6vPTuZ5yOl6HsAIweXtpO7y3rqSxwW1PElA=; b=leYqnVfoWW51jyfSdsQ9V991pbVvHCn6eKF5jJygXRVOTmo558T6VBd8hlzgZsDvaPDXNW yzP/wX3C0rqkH2e11SNLT+jiPLcWqblrII6blkbJJRWnxOJjOHfe4IrXPOHbRytjRav6Ck 7u2drl9ZZS0Xd88ns44CgV44nZ3P0xjHl2KrNeEkLuZYZGdFwXIbzB0mpJiUwJQem74c4L STqy8DoksjqhGmKJiyznFTsAj/kzsoTnX+d6/q1TnDrAlOvsvhArEamQZjiJM+uVDqk8H9 duMMycTBGjWB8+TAK+Ib5j+7KKfwaqmndSmHbD/4IA8ncxQepb2OjBVxdo8TKQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T21K128dXzBDJ; Fri, 29 Dec 2023 23:08:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BTN8rMG075441; Fri, 29 Dec 2023 23:08:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BTN8rG5075438; Fri, 29 Dec 2023 23:08:53 GMT (envelope-from git) Date: Fri, 29 Dec 2023 23:08:53 GMT Message-Id: <202312292308.3BTN8rG5075438@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 90ac116d5e46 - stable/14 - nehemiah RNG: Switch to using FPU_KERN_NOCTX List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 90ac116d5e466e631fc5b8ee8e9fd16bd10c8f07 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=90ac116d5e466e631fc5b8ee8e9fd16bd10c8f07 commit 90ac116d5e466e631fc5b8ee8e9fd16bd10c8f07 Author: John Baldwin AuthorDate: 2023-08-25 19:34:16 +0000 Commit: John Baldwin CommitDate: 2023-12-29 21:49:41 +0000 nehemiah RNG: Switch to using FPU_KERN_NOCTX Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D41583 (cherry picked from commit 7aec088cbce8381bd5bf730419b8fdcddf43b08d) --- sys/dev/random/nehemiah.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/sys/dev/random/nehemiah.c b/sys/dev/random/nehemiah.c index 09c8c32c6d39..e01fdb952108 100644 --- a/sys/dev/random/nehemiah.c +++ b/sys/dev/random/nehemiah.c @@ -43,8 +43,6 @@ #include -static void random_nehemiah_init(void); -static void random_nehemiah_deinit(void); static u_int random_nehemiah_read(void *, u_int); static struct random_source random_nehemiah = { @@ -53,8 +51,6 @@ static struct random_source random_nehemiah = { .rs_read = random_nehemiah_read }; -static struct fpu_kern_ctx *fpu_ctx_save; - /* This H/W source never stores more than 8 bytes in one go */ /* ARGSUSED */ static __inline size_t @@ -75,20 +71,6 @@ VIA_RNG_store(void *buf) return (0); } -static void -random_nehemiah_init(void) -{ - - fpu_ctx_save = fpu_kern_alloc_ctx(FPU_KERN_NORMAL); -} - -static void -random_nehemiah_deinit(void) -{ - - fpu_kern_free_ctx(fpu_ctx_save); -} - /* It is specifically allowed that buf is a multiple of sizeof(long) */ static u_int random_nehemiah_read(void *buf, u_int c) @@ -97,14 +79,14 @@ random_nehemiah_read(void *buf, u_int c) size_t count, ret; uint64_t tmp; - fpu_kern_enter(curthread, fpu_ctx_save, FPU_KERN_NORMAL); + fpu_kern_enter(curthread, NULL, FPU_KERN_NORMAL | FPU_KERN_NOCTX); b = buf; for (count = c; count > 0; count -= ret) { ret = MIN(VIA_RNG_store(&tmp), count); memcpy(b, &tmp, ret); b += ret; } - fpu_kern_leave(curthread, fpu_ctx_save); + fpu_kern_leave(curthread, NULL); return (c); } @@ -119,13 +101,11 @@ nehemiah_modevent(module_t mod, int type, void *unused) if (via_feature_rng & VIA_HAS_RNG) { random_source_register(&random_nehemiah); printf("random: fast provider: \"%s\"\n", random_nehemiah.rs_ident); - random_nehemiah_init(); } break; case MOD_UNLOAD: if (via_feature_rng & VIA_HAS_RNG) { - random_nehemiah_deinit(); random_source_deregister(&random_nehemiah); } break; From nobody Fri Dec 29 23:08:54 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T21K269Vsz55TDr; Fri, 29 Dec 2023 23:08:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T21K24Ghpz4GZ6; Fri, 29 Dec 2023 23:08:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703891334; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OLiRfKKWpV+A0oAm4jES1BmA0Sz4KP0nvPL7MHIuTi8=; b=EdAl5tIr0vFPfQP9jiLQQohTd4+UakEBtNd0JZyd1Xi/mstt6GOCD5HxF6iOuidrgi97FV AN9gVvYPCnKluKGGzT25v/vPyGy9Sf29oTa9hf0qRwfebam7i7ZH5iFYL6X+6zpW/xrIOS ehHuu+DA3JavgTMfS4HYUdvSM/5Xgm4NYwcj6JKOKWs1onENu18XApM1ywmkU6qLTnVaP2 KezKj6To5FZYi/9JVV43bCtZ/00B8m/73YEdUGH0Zt9Jn2cLyNpFHEIO0HESoLFFM1mVF6 wSOhXSbsv3a0Kr9xWcH4GaF1m3ACsKQGYbR5FgxaoxBMF9ZbiINh/W48+qO8vg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703891334; a=rsa-sha256; cv=none; b=Bok0sqaMq2jQrP+CIOBsTwBxgtj1XZ8ilHZ5sMaprQpDjE4Fl4ZEwkYzlRskX2lFT8b0Ww XWzGpY8yAwgGb6O2/XxAxxgjvX6RwqO0eNgZ4SB2UGpnSyoywfBQpRSiDFZJ3SbkbjyGs5 +9vSpQa6Fyc5tg/N2F+mZluv6ey0Wj4gRz6cNWOWWYD7jedkuBVtcW0bgCPIm0qtezsqtt rw3xeORTM1gHuWaEe7kUvbKajVjKDj5qofA0l9oZziQJbqKyyKhPQYfIHoICl5bpYVFJFd ZnckBp1P0O6sxZ4v2Lb6gOGM6hzE5VUe3Nhj3x6nAqbD1SENWQCFhtA/+KKq1Q== 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=1703891334; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OLiRfKKWpV+A0oAm4jES1BmA0Sz4KP0nvPL7MHIuTi8=; b=ep+SZySr4WQ81sJVeqXFZ5sizalYkRsLDAod7BZIjDxhxa6XZqeqNd2K0/+MhxyvuyOITp 7Jm6kbnXTH72FkV/UhkzDXljhSmEptal8Sqd+DVgT/nhYGtMcOoJJD7di78VNie6JA4nEe wqFCNZu8AmOdolCUQnRFvpO4I7n9LJUmn0HHEUbZlJSrWMGabEAZqhyuaFBDhRewnO+y2n 3jRT8Po7Oe7lImqa2qPf6vqcZpNcFZbmrPuhZdMzJ9ylwSmZQmBmnuptDMWEdok5JhG+Gq eSKC+KBLk/oKoJaFXfDzqfg/9HD39femTT5no5/ENm+WWii1JZlSAx2D6ZiEgw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T21K2387lzB9l; Fri, 29 Dec 2023 23:08:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BTN8scs075494; Fri, 29 Dec 2023 23:08:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BTN8sUH075491; Fri, 29 Dec 2023 23:08:54 GMT (envelope-from git) Date: Fri, 29 Dec 2023 23:08:54 GMT Message-Id: <202312292308.3BTN8sUH075491@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: cfc94a37d8d9 - stable/14 - aesni: Switch to using FPU_KERN_NOCTX. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: cfc94a37d8d9e7695f0d9bed14b88d4383d96798 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=cfc94a37d8d9e7695f0d9bed14b88d4383d96798 commit cfc94a37d8d9e7695f0d9bed14b88d4383d96798 Author: John Baldwin AuthorDate: 2023-08-28 23:22:15 +0000 Commit: John Baldwin CommitDate: 2023-12-29 21:49:42 +0000 aesni: Switch to using FPU_KERN_NOCTX. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D41577 (cherry picked from commit 937b4473be2129a700689fe4c8ea0311ccfb17b8) --- sys/crypto/aesni/aesni.c | 88 +++++------------------------------------------- 1 file changed, 9 insertions(+), 79 deletions(-) diff --git a/sys/crypto/aesni/aesni.c b/sys/crypto/aesni/aesni.c index 60e4a6e0f2fc..6d83743dece9 100644 --- a/sys/crypto/aesni/aesni.c +++ b/sys/crypto/aesni/aesni.c @@ -40,11 +40,9 @@ #include #include #include -#include #include #include #include -#include #include #include #include @@ -63,28 +61,12 @@ #include #include -static struct mtx_padalign *ctx_mtx; -static struct fpu_kern_ctx **ctx_fpu; - struct aesni_softc { int32_t cid; bool has_aes; bool has_sha; }; -#define ACQUIRE_CTX(i, ctx) \ - do { \ - (i) = PCPU_GET(cpuid); \ - mtx_lock(&ctx_mtx[(i)]); \ - (ctx) = ctx_fpu[(i)]; \ - } while (0) -#define RELEASE_CTX(i, ctx) \ - do { \ - mtx_unlock(&ctx_mtx[(i)]); \ - (i) = -1; \ - (ctx) = NULL; \ - } while (0) - static int aesni_cipher_setup(struct aesni_session *ses, const struct crypto_session_params *csp); static int aesni_cipher_process(struct aesni_session *ses, struct cryptop *crp); @@ -136,30 +118,10 @@ aesni_probe(device_t dev) return (0); } -static void -aesni_cleanctx(void) -{ - int i; - - /* XXX - no way to return driverid */ - CPU_FOREACH(i) { - if (ctx_fpu[i] != NULL) { - mtx_destroy(&ctx_mtx[i]); - fpu_kern_free_ctx(ctx_fpu[i]); - } - ctx_fpu[i] = NULL; - } - free(ctx_mtx, M_AESNI); - ctx_mtx = NULL; - free(ctx_fpu, M_AESNI); - ctx_fpu = NULL; -} - static int aesni_attach(device_t dev) { struct aesni_softc *sc; - int i; sc = device_get_softc(dev); @@ -171,21 +133,6 @@ aesni_attach(device_t dev) return (ENOMEM); } - ctx_mtx = malloc(sizeof *ctx_mtx * (mp_maxid + 1), M_AESNI, - M_WAITOK|M_ZERO); - ctx_fpu = malloc(sizeof *ctx_fpu * (mp_maxid + 1), M_AESNI, - M_WAITOK|M_ZERO); - - CPU_FOREACH(i) { -#ifdef __amd64__ - ctx_fpu[i] = fpu_kern_alloc_ctx_domain( - pcpu_find(i)->pc_domain, FPU_KERN_NORMAL); -#else - ctx_fpu[i] = fpu_kern_alloc_ctx(FPU_KERN_NORMAL); -#endif - mtx_init(&ctx_mtx[i], "anifpumtx", NULL, MTX_DEF|MTX_NEW); - } - detect_cpu_features(&sc->has_aes, &sc->has_sha); return (0); } @@ -199,8 +146,6 @@ aesni_detach(device_t dev) crypto_unregister_all(sc->cid); - aesni_cleanctx(); - return (0); } @@ -551,9 +496,9 @@ static int aesni_cipher_setup(struct aesni_session *ses, const struct crypto_session_params *csp) { - struct fpu_kern_ctx *ctx; uint8_t *schedbase; - int kt, ctxidx, error; + int error; + bool kt; schedbase = (uint8_t *)roundup2((uintptr_t)ses->schedules, AES_SCHED_ALIGN); @@ -607,11 +552,10 @@ aesni_cipher_setup(struct aesni_session *ses, ses->mlen = csp->csp_auth_mlen; } - kt = is_fpu_kern_thread(0) || (csp->csp_cipher_alg == 0); + kt = (csp->csp_cipher_alg == 0); if (!kt) { - ACQUIRE_CTX(ctxidx, ctx); - fpu_kern_enter(curthread, ctx, - FPU_KERN_NORMAL | FPU_KERN_KTHR); + fpu_kern_enter(curthread, NULL, + FPU_KERN_NORMAL | FPU_KERN_NOCTX); } error = 0; @@ -620,8 +564,7 @@ aesni_cipher_setup(struct aesni_session *ses, csp->csp_cipher_klen); if (!kt) { - fpu_kern_leave(curthread, ctx); - RELEASE_CTX(ctxidx, ctx); + fpu_kern_leave(curthread, NULL); } return (error); } @@ -630,9 +573,7 @@ static int aesni_cipher_process(struct aesni_session *ses, struct cryptop *crp) { const struct crypto_session_params *csp; - struct fpu_kern_ctx *ctx; - int error, ctxidx; - bool kt; + int error; csp = crypto_get_params(crp->crp_session); switch (csp->csp_cipher_alg) { @@ -653,15 +594,7 @@ aesni_cipher_process(struct aesni_session *ses, struct cryptop *crp) break; } - ctx = NULL; - ctxidx = 0; - error = 0; - kt = is_fpu_kern_thread(0); - if (!kt) { - ACQUIRE_CTX(ctxidx, ctx); - fpu_kern_enter(curthread, ctx, - FPU_KERN_NORMAL | FPU_KERN_KTHR); - } + fpu_kern_enter(curthread, NULL, FPU_KERN_NORMAL | FPU_KERN_NOCTX); /* Do work */ if (csp->csp_mode == CSP_MODE_ETA) { @@ -679,10 +612,7 @@ aesni_cipher_process(struct aesni_session *ses, struct cryptop *crp) else error = aesni_cipher_crypt(ses, crp, csp); - if (!kt) { - fpu_kern_leave(curthread, ctx); - RELEASE_CTX(ctxidx, ctx); - } + fpu_kern_leave(curthread, NULL); return (error); } From nobody Fri Dec 29 23:08:55 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T21K40Cmxz55TKY; Fri, 29 Dec 2023 23:08: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T21K352Jhz4Gfl; Fri, 29 Dec 2023 23:08:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703891335; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=W4D3MIaENswMHFg8RUVJaUToD+IQ2w2Mi1VnfDGVJpE=; b=ZrF9wfr90FHk2J1pkNX/iz64OjytSmeP/6TgWpdzrDhNjLje8qD+Rd68ZJx8Apj+UNpHRR ZHtF23ZLDI4fsEc78okwRP00UKthAO+7Ko6bqxoGal842mV9sjrl5Dx6wtWL93ratPG9/1 j91CqzYj7rXjU1+oKlM3RWJ6ngVi3ALQk3ssVQQZTZAMQs2xVTKvhxiOkOV7JZQgy9GidC WbsohciKwtHXGEv9uzmCLxVvMmP3wiD5dTGNkXBMGY5wboREpMhcn0JUQnY8l8HAXTsee7 bDY4FNB7qux7l/6uQV5MVJVfjwB+tECJntqu4DfANoEE0PEVhTmoULMcmT+I5A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703891335; a=rsa-sha256; cv=none; b=rDMHfa5znGBN640JBWIDeFDVhaUKTaIr4esVxlAMLP/TznB2+TSVa/nd6gz9zRzo+cO9Iw bHFI0z8dyTOp/WSGHZrUgMau8fhGHKk7umxVOkDjmS02mRFa2qkIit8CwRAjTHMlZJAUWs UsES39glxZLoBnakPJozHTd6vWoyThoVLSrzNCBdYnowRkfovFeJs6fGkMh/vG3Ti6cyIC PioBZ/EdAoA9b56UALddG5HA9JebzwzE5S5xBXhOYW25U0jsb6GfkyupDBg+ZxLRFLzoc7 BPA/00QAjSHBQT0F6PAEK1My3HccJc6cJwOBhpNCjuiCXsNjh89Zp9JMEGvDRQ== 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=1703891335; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=W4D3MIaENswMHFg8RUVJaUToD+IQ2w2Mi1VnfDGVJpE=; b=La02rVFSj2doI3Y4LuqeU0DqEt2b5CiJuvrJa7bRwUuMAzt4P1uJmc9t7QM06o0H6HHJPE BFy3awnT/183edq+nQZrmJzVA8hQzHJn2kd88LqEEIx68w0p61O5hnj1yIOBMEvwjh0g2m gf4c+OG1UZVVi4jP8HmPxpDRtGvxpm5jV7txs7TXt4z9XnG9sPabPsfFePoj6eNuTTSGDg vqhq0T4kfPdGr/8JLv7bxEz1g2SJtzpH0rzjXXXphynvmE52Z1VzWvec5YopxkuZQLJyqm bpU1fRHO0t5WNoMoiRPYXWEBuSCb0CPI/5phU9s0/dA11vMd9AJVk9UVDtgKBw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T21K348W5zBDK; Fri, 29 Dec 2023 23:08:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BTN8tdS075539; Fri, 29 Dec 2023 23:08:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BTN8tcx075536; Fri, 29 Dec 2023 23:08:55 GMT (envelope-from git) Date: Fri, 29 Dec 2023 23:08:55 GMT Message-Id: <202312292308.3BTN8tcx075536@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 276666497ed1 - stable/14 - aesni: Push FPU sections down further List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 276666497ed1072ff663cb174eb44fe333be9ee3 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=276666497ed1072ff663cb174eb44fe333be9ee3 commit 276666497ed1072ff663cb174eb44fe333be9ee3 Author: Mark Johnston AuthorDate: 2023-08-29 01:26:53 +0000 Commit: John Baldwin CommitDate: 2023-12-29 21:49:42 +0000 aesni: Push FPU sections down further After commit 937b4473be21 aesni_cipher_crypt() and aesni_cipher_mac() execute in a FPU_KERN_NOCTX section, which means that they must run with preemption disabled. These functions handle discontiguous I/O buffers by allocating a contiguous buffer and copying as necessary, but this allocation cannot happen with preemption disabled. Fix the problem by pushing the FPU section down into aesni_cipher_crypt() and aesni_cipher_mac(). In particular, encrypt-then-auth transforms need not be handled with a single FPU section. Reported by: syzbot+78258dbb02eb92157357@syzkaller.appspotmail.com Discussed with: jhb Fixes: 937b4473be21 ("aesni: Switch to using FPU_KERN_NOCTX.") (cherry picked from commit 6b635c74fd4135eaae68970bfc5aad9ae905fec7) --- sys/crypto/aesni/aesni.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/crypto/aesni/aesni.c b/sys/crypto/aesni/aesni.c index 6d83743dece9..5d5afd8aee41 100644 --- a/sys/crypto/aesni/aesni.c +++ b/sys/crypto/aesni/aesni.c @@ -594,8 +594,6 @@ aesni_cipher_process(struct aesni_session *ses, struct cryptop *crp) break; } - fpu_kern_enter(curthread, NULL, FPU_KERN_NORMAL | FPU_KERN_NOCTX); - /* Do work */ if (csp->csp_mode == CSP_MODE_ETA) { if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { @@ -612,7 +610,6 @@ aesni_cipher_process(struct aesni_session *ses, struct cryptop *crp) else error = aesni_cipher_crypt(ses, crp, csp); - fpu_kern_leave(curthread, NULL); return (error); } @@ -677,6 +674,8 @@ aesni_cipher_crypt(struct aesni_session *ses, struct cryptop *crp, outcopy = allocated; } + fpu_kern_enter(curthread, NULL, FPU_KERN_NORMAL | FPU_KERN_NOCTX); + error = 0; encflag = CRYPTO_OP_IS_ENCRYPT(crp->crp_op); if (crp->crp_cipher_key != NULL) @@ -749,6 +748,9 @@ aesni_cipher_crypt(struct aesni_session *ses, struct cryptop *crp, } break; } + + fpu_kern_leave(curthread, NULL); + if (outcopy && error == 0) crypto_copyback(crp, CRYPTO_HAS_OUTPUT_BUFFER(crp) ? crp->crp_payload_output_start : crp->crp_payload_start, @@ -784,6 +786,8 @@ aesni_cipher_mac(struct aesni_session *ses, struct cryptop *crp, key = csp->csp_auth_key; keylen = csp->csp_auth_klen; + fpu_kern_enter(curthread, NULL, FPU_KERN_NORMAL | FPU_KERN_NOCTX); + if (ses->hmac) { uint8_t hmac_key[SHA1_BLOCK_LEN] __aligned(16); @@ -849,6 +853,8 @@ aesni_cipher_mac(struct aesni_session *ses, struct cryptop *crp, ses->hash_finalize(res, &sctx); } + fpu_kern_leave(curthread, NULL); + if (crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) { uint32_t res2[SHA2_256_HASH_LEN / sizeof(uint32_t)]; From nobody Fri Dec 29 23:08:56 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T21K500Cvz55TDx; Fri, 29 Dec 2023 23:08:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T21K46GYnz4Gg1; Fri, 29 Dec 2023 23:08:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703891336; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=u3ReI1c0aV04UrEv+fk0I4XnTlMiAo99wQtjGCH7FnM=; b=dXgCCMsoDZwPQK4WKku+9x6/Zvmv1LxoHnOrtt4peODz8Me16D7toPWjzrtydO8qB2VCpJ zToPsiw0w7tOZc/40SdrkNzBn+lEY+d2f2qqf8Dwz3634Uj2LbG39IO8yviir7VqcrSjx1 hW6FVd9odiRvpp9C6KULe3rkQb5cRWhFKU0SHtDjNdvGuPw6S8QJnwIx8pJb1nKbfcSiPe xtWzyFHGXZpunYGzzlZ9XDphvATp/n9YOlqMPlqtWnh0u34XUhuaD4t5FCRFRq/Uzgwjyz fA8COhEy9np8egub2xZKHxXjP11IflV6J1tTu19fpjAGGZJc2J61mXstcaFaSQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703891336; a=rsa-sha256; cv=none; b=IPjRKR6I8sdqt//BC0OuoEzaQIn8Hl64ql9hIOp5SrY7S+YWw98Dpv3E3VvWBlGJ4DAuvS o7E81mSKcaXKMob+A6I3iuOfT9qKRRqswXGEXyhe/oUqW7qlFHfcePDLuPj4QWa3PCw1yU b97vMNLf+RpVgZ7e9M46ilVn1VKgiuQ2B0mp0rVWJDkz3+233WmAeglcExM+oWfYjeVGcU /xtc/OzeTbxiAUYdsi5KFQlF3rLWngMq8jRDCKHHJIc5gEFFebZ3NQVGkwFT1Zy5a/Nbr5 154Tln141Aa/Y5CQVYYPxy8BXzueGb+lD6KVwplNzg+mAxvfDyLk/ew/1/vuOQ== 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=1703891336; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=u3ReI1c0aV04UrEv+fk0I4XnTlMiAo99wQtjGCH7FnM=; b=YlXmRDMAwuBrpJWyAVWE9mLG62U1Cid5ujTMIa7MhYUx4Sp9uUJp3XV1exfcK2TrUP64jx BsTFoeI2gHYsNH9+dxDm52czctYVfxNBIKkt5WA4ENx3xOowDefM//qK9DCiX410IoHfDG MowZYoz7PK5t2wVT/UfmPaWA8TiLAEobDXXIAyL05FgfokI4CgyIJS8PFO6qwkipdknyLU 0D9QK/V+aSTgc5qSWas18aar1+4MHLt6fsHAhTsLoPaIxEXIsoBKAas89euqckjUo7P7sM jDuAICT9akwpkWd2de1eYBobvgVySVz5/5zIAT1DZQDL+MypYWFQRhlU7h2eZQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T21K459jmz9HK; Fri, 29 Dec 2023 23:08:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BTN8ujU075581; Fri, 29 Dec 2023 23:08:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BTN8ubS075578; Fri, 29 Dec 2023 23:08:56 GMT (envelope-from git) Date: Fri, 29 Dec 2023 23:08:56 GMT Message-Id: <202312292308.3BTN8ubS075578@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 991f34a04a97 - stable/14 - armv8_crypto: Switch to using FPU_KERN_NOCTX List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 991f34a04a97e63747ae9dafc8004fdc36c421bb Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=991f34a04a97e63747ae9dafc8004fdc36c421bb commit 991f34a04a97e63747ae9dafc8004fdc36c421bb Author: John Baldwin AuthorDate: 2023-08-28 23:22:33 +0000 Commit: John Baldwin CommitDate: 2023-12-29 21:49:42 +0000 armv8_crypto: Switch to using FPU_KERN_NOCTX Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D41578 (cherry picked from commit 6485286f536f1afb36d6d39e75fceabd114b082b) --- sys/crypto/armv8/armv8_crypto.c | 85 +++++------------------------------------ 1 file changed, 9 insertions(+), 76 deletions(-) diff --git a/sys/crypto/armv8/armv8_crypto.c b/sys/crypto/armv8/armv8_crypto.c index a1a9d4dfcdcd..a8d88c31edc0 100644 --- a/sys/crypto/armv8/armv8_crypto.c +++ b/sys/crypto/armv8/armv8_crypto.c @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include @@ -69,22 +68,6 @@ struct armv8_crypto_softc { bool has_pmul; }; -static struct mtx *ctx_mtx; -static struct fpu_kern_ctx **ctx_vfp; - -#define AQUIRE_CTX(i, ctx) \ - do { \ - (i) = PCPU_GET(cpuid); \ - mtx_lock(&ctx_mtx[(i)]); \ - (ctx) = ctx_vfp[(i)]; \ - } while (0) -#define RELEASE_CTX(i, ctx) \ - do { \ - mtx_unlock(&ctx_mtx[(i)]); \ - (i) = -1; \ - (ctx) = NULL; \ - } while (0) - static int armv8_crypto_cipher_process(struct armv8_crypto_session *, struct cryptop *); @@ -134,7 +117,6 @@ armv8_crypto_attach(device_t dev) { struct armv8_crypto_softc *sc; uint64_t reg; - int i; sc = device_get_softc(dev); sc->dieing = 0; @@ -153,16 +135,6 @@ armv8_crypto_attach(device_t dev) rw_init(&sc->lock, "armv8crypto"); - ctx_mtx = malloc(sizeof(*ctx_mtx) * (mp_maxid + 1), M_ARMV8_CRYPTO, - M_WAITOK|M_ZERO); - ctx_vfp = malloc(sizeof(*ctx_vfp) * (mp_maxid + 1), M_ARMV8_CRYPTO, - M_WAITOK|M_ZERO); - - CPU_FOREACH(i) { - ctx_vfp[i] = fpu_kern_alloc_ctx(0); - mtx_init(&ctx_mtx[i], "armv8cryptoctx", NULL, MTX_DEF|MTX_NEW); - } - return (0); } @@ -170,7 +142,6 @@ static int armv8_crypto_detach(device_t dev) { struct armv8_crypto_softc *sc; - int i; sc = device_get_softc(dev); @@ -181,18 +152,6 @@ armv8_crypto_detach(device_t dev) rw_destroy(&sc->lock); - CPU_FOREACH(i) { - if (ctx_vfp[i] != NULL) { - mtx_destroy(&ctx_mtx[i]); - fpu_kern_free_ctx(ctx_vfp[i]); - } - ctx_vfp[i] = NULL; - } - free(ctx_mtx, M_ARMV8_CRYPTO); - ctx_mtx = NULL; - free(ctx_vfp, M_ARMV8_CRYPTO); - ctx_vfp = NULL; - return (0); } @@ -271,8 +230,6 @@ armv8_crypto_cipher_setup(struct armv8_crypto_session *ses, const struct crypto_session_params *csp, const uint8_t *key, int keylen) { __uint128_val_t H; - struct fpu_kern_ctx *ctx; - int kt, i; if (csp->csp_cipher_alg == CRYPTO_AES_XTS) keylen /= 2; @@ -286,12 +243,7 @@ armv8_crypto_cipher_setup(struct armv8_crypto_session *ses, return (EINVAL); } - kt = is_fpu_kern_thread(0); - if (!kt) { - AQUIRE_CTX(i, ctx); - fpu_kern_enter(curthread, ctx, - FPU_KERN_NORMAL | FPU_KERN_KTHR); - } + fpu_kern_enter(curthread, NULL, FPU_KERN_NORMAL | FPU_KERN_NOCTX); aes_v8_set_encrypt_key(key, keylen * 8, &ses->enc_schedule); @@ -312,10 +264,7 @@ armv8_crypto_cipher_setup(struct armv8_crypto_session *ses, gcm_init_v8(ses->Htable, H.u); } - if (!kt) { - fpu_kern_leave(curthread, ctx); - RELEASE_CTX(i, ctx); - } + fpu_kern_leave(curthread, NULL); return (0); } @@ -378,12 +327,10 @@ armv8_crypto_cipher_process(struct armv8_crypto_session *ses, { struct crypto_buffer_cursor fromc, toc; const struct crypto_session_params *csp; - struct fpu_kern_ctx *ctx; uint8_t *authbuf; uint8_t iv[AES_BLOCK_LEN], tag[GMAC_DIGEST_LEN]; - int authallocated, i; + int authallocated; int encflag; - int kt; int error; csp = crypto_get_params(crp->crp_session); @@ -391,7 +338,6 @@ armv8_crypto_cipher_process(struct armv8_crypto_session *ses, authallocated = 0; authbuf = NULL; - kt = 1; if (csp->csp_cipher_alg == CRYPTO_AES_NIST_GCM_16) { if (crp->crp_aad != NULL) @@ -399,10 +345,8 @@ armv8_crypto_cipher_process(struct armv8_crypto_session *ses, else authbuf = armv8_crypto_cipher_alloc(crp, crp->crp_aad_start, crp->crp_aad_length, &authallocated); - if (authbuf == NULL) { - error = ENOMEM; - goto out; - } + if (authbuf == NULL) + return (ENOMEM); } crypto_cursor_init(&fromc, &crp->crp_buf); crypto_cursor_advance(&fromc, crp->crp_payload_start); @@ -413,12 +357,7 @@ armv8_crypto_cipher_process(struct armv8_crypto_session *ses, crypto_cursor_copy(&fromc, &toc); } - kt = is_fpu_kern_thread(0); - if (!kt) { - AQUIRE_CTX(i, ctx); - fpu_kern_enter(curthread, ctx, - FPU_KERN_NORMAL | FPU_KERN_KTHR); - } + fpu_kern_enter(curthread, NULL, FPU_KERN_NORMAL | FPU_KERN_NOCTX); if (crp->crp_cipher_key != NULL) { armv8_crypto_cipher_setup(ses, csp, crp->crp_cipher_key, @@ -427,11 +366,12 @@ armv8_crypto_cipher_process(struct armv8_crypto_session *ses, crypto_read_iv(crp, iv); + error = 0; switch (csp->csp_cipher_alg) { case CRYPTO_AES_CBC: if ((crp->crp_payload_length % AES_BLOCK_LEN) != 0) { error = EINVAL; - goto out; + break; } if (encflag) armv8_aes_encrypt_cbc(&ses->enc_schedule, @@ -464,18 +404,11 @@ armv8_crypto_cipher_process(struct armv8_crypto_session *ses, error = armv8_aes_decrypt_gcm(&ses->enc_schedule, crp->crp_payload_length, &fromc, &toc, crp->crp_aad_length, authbuf, tag, iv, ses->Htable); - if (error != 0) - goto out; } break; } - error = 0; -out: - if (!kt) { - fpu_kern_leave(curthread, ctx); - RELEASE_CTX(i, ctx); - } + fpu_kern_leave(curthread, NULL); if (authallocated) zfree(authbuf, M_ARMV8_CRYPTO); From nobody Fri Dec 29 23:08:57 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T21K62bHpz55TCM; Fri, 29 Dec 2023 23:08: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T21K574QBz4Gcc; Fri, 29 Dec 2023 23:08:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703891338; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bcHZlt+u4Xwarfh0lRBDkfBG4XI9IxDapdEmuxsMRhc=; b=AbZFkLd5RVeWeGSU7w4hBfgcCHs83N5ROv7TKwhs8dwzoqpRVX+u1WB6Cwc79e9v5FxRaJ yLxYMBJI2Tg1u8uQDltjNXm1twN9NRuaBpUBitqXKOKq+xesPle6rcUGaqLcfrK+6IIYiG RUFUwrp5PSeTTkLqN4FrsmM3iNI/d23AagI0LaImsQHSkWoj636JSM+eBYqNucegIWtcC/ WAQGwKivjjELLBeJAMK3MIrkOnL6Lss0BuSncjbuYaB1vF217Q+9OvzWz5XSH7IGw1mBw6 S9Kp2StOqaLbchb56mcK5dZ2vccI6XJn9ZkkIWmVK1zY9EIxotbUVuOGobjNeg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703891338; a=rsa-sha256; cv=none; b=K32wQiDyne9fHuUXhZ8C/BscdorL3pRCkgFZFkspW3m4N/MdbypOfyNAQMDpb+jC6T8Mqm 6MYjoanfmZX128FjCMiG3hAzV90o5mmVUv/K7DhvZGSCDQKbIXMIUtV+ZAYN+08Gxv7Ah+ Tpue964lwkTwsrRbbHj0BCcc7niVmW+tSicE5Gx/S8IvJaL+jpyy21OgFaXmhhtHNjZLlA GgDtFYwWuEYeRnUHUbgudqtMSAoiVlQNxl/EaSvVimYIaOcML+sKLEB5vQ38LdHCAy/40n BdnukmqnusVuut7RbFmRAyptjeqaGrFf7SufzXZCFNd703LZNtPWGE+8MCyhkQ== 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=1703891338; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bcHZlt+u4Xwarfh0lRBDkfBG4XI9IxDapdEmuxsMRhc=; b=fM+zXOheJ1zMbM1kl04CXJvU/N4KAvsSIB5oxLLRynUovtJRyxItO+Yk/tQ+VlINWdu5eT P9AyS33NX7SR/zQunYhIRg3Nn8ma3oHOPSOSzsEs0om2r1E073ITR7KRTjweJwcZJOzMeV QKFwo7LVuxTnENhJHRFRBrYqJ5NA/t/8WlcdMK7TnAEytnkp+uHKgf56fG6N4TlyHWe+ae KzU27QNb3rWc0MMGME4aBHX4BDd/3cruHS4ov1YZ/PWJDCVqiCOEkdiXruMnDnC6Irwox2 85NS+drvnzxhtK3PkQKrW9KgkWOYYEnQYQZ77uMfbSunt1dNrmOi7UusY/bkog== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T21K56BJcz9ft; Fri, 29 Dec 2023 23:08:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BTN8v8w075629; Fri, 29 Dec 2023 23:08:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BTN8vfo075626; Fri, 29 Dec 2023 23:08:57 GMT (envelope-from git) Date: Fri, 29 Dec 2023 23:08:57 GMT Message-Id: <202312292308.3BTN8vfo075626@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 7945b99a003f - stable/14 - armv8_crypto: Remove dieing flag and rw lock List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 7945b99a003fec545140532662412696e93f1ae1 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=7945b99a003fec545140532662412696e93f1ae1 commit 7945b99a003fec545140532662412696e93f1ae1 Author: John Baldwin AuthorDate: 2023-08-28 23:23:43 +0000 Commit: John Baldwin CommitDate: 2023-12-29 21:49:42 +0000 armv8_crypto: Remove dieing flag and rw lock crypto_unregister_all already disables new sessions and waits for existing sessions to be destroyed before returning. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D41579 (cherry picked from commit fdd51760c278302773edbd2466d35b35b865f5d9) --- sys/crypto/armv8/armv8_crypto.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/sys/crypto/armv8/armv8_crypto.c b/sys/crypto/armv8/armv8_crypto.c index a8d88c31edc0..fd1d845c29b0 100644 --- a/sys/crypto/armv8/armv8_crypto.c +++ b/sys/crypto/armv8/armv8_crypto.c @@ -44,12 +44,10 @@ #include #include #include -#include #include #include #include #include -#include #include #include @@ -62,9 +60,7 @@ #include struct armv8_crypto_softc { - int dieing; int32_t cid; - struct rwlock lock; bool has_pmul; }; @@ -119,7 +115,6 @@ armv8_crypto_attach(device_t dev) uint64_t reg; sc = device_get_softc(dev); - sc->dieing = 0; reg = READ_SPECIALREG(id_aa64isar0_el1); @@ -133,8 +128,6 @@ armv8_crypto_attach(device_t dev) return (ENOMEM); } - rw_init(&sc->lock, "armv8crypto"); - return (0); } @@ -145,13 +138,8 @@ armv8_crypto_detach(device_t dev) sc = device_get_softc(dev); - rw_wlock(&sc->lock); - sc->dieing = 1; - rw_wunlock(&sc->lock); crypto_unregister_all(sc->cid); - rw_destroy(&sc->lock); - return (0); } @@ -273,21 +261,12 @@ static int armv8_crypto_newsession(device_t dev, crypto_session_t cses, const struct crypto_session_params *csp) { - struct armv8_crypto_softc *sc; struct armv8_crypto_session *ses; int error; - sc = device_get_softc(dev); - rw_wlock(&sc->lock); - if (sc->dieing) { - rw_wunlock(&sc->lock); - return (EINVAL); - } - ses = crypto_get_driver_session(cses); error = armv8_crypto_cipher_setup(ses, csp, csp->csp_cipher_key, csp->csp_cipher_klen); - rw_wunlock(&sc->lock); return (error); } From nobody Fri Dec 29 23:08:58 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T21K73FLbz55T1P; Fri, 29 Dec 2023 23:08:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T21K71N8Hz4GvX; Fri, 29 Dec 2023 23:08:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703891339; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dOXJGX33M1L/sO1sgEe9KdXnM9Q6T9n9rYl7esQyGUU=; b=JktH/AChq5/qHOqpwVCpAT/kgA99IPO4cbXLNZcvPyKKXkQlAHkegwxig/e+4EhL6of801 Vx65UJzMw4IIniBs4iboe9HdD8voDl2DAUIdrRDYo//YakIsZgb66xfD7FDz0kWzgNdL23 TCi+KiKJq2FsYZ1n/uLDmfaQeDOB/uVTNHBhUAaF5Ua2yGM3qSzNmn+YrgBANjeTk1zkrC tguZvm54qIpA8d357lGyUj+SjpVL50AY7Z9+VdOhTTkG1IRZv582Jl2iH0cSPxzxLfcBHw UoDcrv0rKv5qoc86vcQJw/8FYKqWslGJm7EV7ox73rnfW9D0HRAizUQqt+L03g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703891339; a=rsa-sha256; cv=none; b=YnVQZAZgEBl9ibYiO+w3DfCFPr+hMWxzdnh8vljo5jzC3raJZGp4RwmZdgkzB0YzanDLXY 943QHiv/mYWOfNKbe8090W0gIWlqRQCcn3TjOTr9Ina7i8iTgZTWZpI1tnUcP7nOS8gsZv Q+Zjs11fcy9x3WzHDLiXMpAzg0UZIFuLJNvOdfiEmM72WZddSh5o9ITo+S/tY0yiZCGOzY C5R7xOYXEQFtnV9y+CubqBs3A6qW5rOYvTThzATv3Vl7EEA2juY5nnrNpGtmhPNPjPWSwz 4Hb1Voc6Vxh4MtrhEaUly4P5gjewpA3foqYn8l1YpjUqnOqYamNUJLkpPZtNeQ== 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=1703891339; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dOXJGX33M1L/sO1sgEe9KdXnM9Q6T9n9rYl7esQyGUU=; b=Slv/5Xjjt9+GFqF/5faCqVbGWxkdKce9yYlaJowjiNihoWTZ73B2z+PK5TFXQyTmPMA/TK e8hLGFO+q0nzFvC0u6QMcM8vPPQ+9ffH/ES6Y4o1/eJQ1wQReT8jvfXDy0pctHCwI73siP WOfJiMClSVe6nOth5uH6Ug1PZpCYQpMn29DcrG7reQAVXLp81YJpVyt+M2R2qcmoQwgmwJ jFAel4EY0BvbWZpdEUR2I3qIM7DCDwCL2wa5GZ2LACGjXMgtLB5fBMtpBWwFjI7cl1ddKa kqYQjBltf31OWOC9PmoSQPLCkjSkCIFajx4QX1eYzyowWhFlgs9vwWWOAFPFAg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T21K709z2zB9m; Fri, 29 Dec 2023 23:08:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BTN8wAv075671; Fri, 29 Dec 2023 23:08:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BTN8wD7075668; Fri, 29 Dec 2023 23:08:58 GMT (envelope-from git) Date: Fri, 29 Dec 2023 23:08:58 GMT Message-Id: <202312292308.3BTN8wD7075668@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: f7e5bdbc683a - stable/14 - armv8_crypto: fix recursive fpu_kern_enter call List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f7e5bdbc683acb6c3cfb9a2ae95716e75478e776 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=f7e5bdbc683acb6c3cfb9a2ae95716e75478e776 commit f7e5bdbc683acb6c3cfb9a2ae95716e75478e776 Author: Zachary Leaf AuthorDate: 2023-08-31 13:11:53 +0000 Commit: John Baldwin CommitDate: 2023-12-29 21:49:42 +0000 armv8_crypto: fix recursive fpu_kern_enter call Now armv8_crypto is using FPU_KERN_NOCTX, this results in a kernel panic in armv8_crypto.c:armv8_crypto_cipher_setup: panic: recursive fpu_kern_enter while in PCB_FP_NOSAVE state This is because in armv8_crypto.c:armv8_crypto_cipher_process, directly after calling fpu_kern_enter() a call is made to armv8_crypto_cipher_setup(), resulting in nested calls to fpu_kern_enter() without the required fpu_kern_leave() in between. Move fpu_kern_enter() in armv8_crypto_cipher_process() after the call to armv8_crypto_cipher_setup() to resolve this. Reviewed by: markj, andrew Fixes: 6485286f536f ("armv8_crypto: Switch to using FPU_KERN_NOCTX") Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D41671 (cherry picked from commit 565c887a775284bfb1a15eadee2c3f312d288c01) --- sys/crypto/armv8/armv8_crypto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/crypto/armv8/armv8_crypto.c b/sys/crypto/armv8/armv8_crypto.c index fd1d845c29b0..fcbc7e77de29 100644 --- a/sys/crypto/armv8/armv8_crypto.c +++ b/sys/crypto/armv8/armv8_crypto.c @@ -336,8 +336,6 @@ armv8_crypto_cipher_process(struct armv8_crypto_session *ses, crypto_cursor_copy(&fromc, &toc); } - fpu_kern_enter(curthread, NULL, FPU_KERN_NORMAL | FPU_KERN_NOCTX); - if (crp->crp_cipher_key != NULL) { armv8_crypto_cipher_setup(ses, csp, crp->crp_cipher_key, csp->csp_cipher_klen); @@ -345,6 +343,8 @@ armv8_crypto_cipher_process(struct armv8_crypto_session *ses, crypto_read_iv(crp, iv); + fpu_kern_enter(curthread, NULL, FPU_KERN_NORMAL | FPU_KERN_NOCTX); + error = 0; switch (csp->csp_cipher_alg) { case CRYPTO_AES_CBC: From nobody Fri Dec 29 23:09:00 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T21K82kj2z55T1Q; Fri, 29 Dec 2023 23:09: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T21K81sYyz4H2m; Fri, 29 Dec 2023 23:09:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703891340; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i1xijWklCXU2WbYy2mm6ao1by382KDCWXlGT4JyCN3Q=; b=loEZwgHko8tbRSiHZdGCusKEmV6KFFypk8wOcUgiVVTRLOckc46D/8PowUWeicdb/II6RO PLmFQ7QDwt/mNPZWZe1Zm1lfpJipOhTZYToDKX7zlJsOuZtiTwzQFA1l3ZO8yKQx4DyhW6 jXwMcr8sAoR8Z9fkP6IYtX1F34ETO+eA8l6njFzUa5dlxQQRtRUXCruKRGPtH0J9vZ2eue WePurj8eTNqqeQPNyWBT3m5K5G0fkSgcK71NV0BPmrFiqPB9cqmosC+3lphSBq/uwxEBio aZM8vxZtPvtWVzrRGCdWOLWd53BLE+k8kQ1P5xm/adqlT70djUifiBqHConV/Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703891340; a=rsa-sha256; cv=none; b=CAg71yp19Pma5HvaEzoOcO09kkUpBz4yYk372e9X2lPkSVxQRvOuWHQ9TU/zf5L4BL3DYy GE3p1v72VCavVXHM7+MILUdjizJaQeBDF9o6bBxUj0j94Zbe+ultZYE6MDNSxpsA+eMSom N5g0r8Qrgah6XSw1gcOCyCafmJodi3Y/5NCTtnvnyncYHRLYrQy2Kc2OFnLvxWLRx6qyZP Rya2g7VLoowtoZCYt14a3994hNM+hbA/Dv51em0RmRIF1lUzcrxTYGrE9aUsiuhRg0qiAM 1eefkTvdgxtGryrUQLdyuCZ3v34O0LOjfgok1xam6cvKfsoUgdzukrCgJLU2UA== 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=1703891340; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i1xijWklCXU2WbYy2mm6ao1by382KDCWXlGT4JyCN3Q=; b=Vf4MmiR+KNKqY56QpQhILD+Qv0/HcqSskFlamfNDt4rD4an/HUFTLtEjNoGKnEOS2IqI23 TsrlP5y0unflFTi3g6cHyod0q+nG5jjwIxJCz8EckL/4bWvDswyDhGuJKR//Bo9e9Ht99K 7iMiKZUTiPGLHohHdttxcPiOMFI7PL9A5vGK1n+xMlqzcUpMibr0ykWT2CuJCoixQGv8Ux +geVHL1JdH2guwi5VEIdnP7zPaP+lhx8Dob5RtSO8yyHpq/52iLu0T1C0MBXe/tb0SCD2D QeT2HjsE6w4xwuMeqiM9Tqld4SIgBCw3he3mn20HiyATnykN/BeayZHzZkivGQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T21K80zN1zBGX; Fri, 29 Dec 2023 23:09:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BTN909e075726; Fri, 29 Dec 2023 23:09:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BTN90GB075723; Fri, 29 Dec 2023 23:09:00 GMT (envelope-from git) Date: Fri, 29 Dec 2023 23:09:00 GMT Message-Id: <202312292309.3BTN90GB075723@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 332774b2aff1 - stable/14 - blake2: Switch to using FPU_KERN_NOCTX List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 332774b2aff18c848e4967be024627cdeb01e337 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=332774b2aff18c848e4967be024627cdeb01e337 commit 332774b2aff18c848e4967be024627cdeb01e337 Author: John Baldwin AuthorDate: 2023-08-28 23:24:32 +0000 Commit: John Baldwin CommitDate: 2023-12-29 21:49:42 +0000 blake2: Switch to using FPU_KERN_NOCTX Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D41580 (cherry picked from commit 3e912bdc31a9e5372d3cedf35c6f566871b8ede7) --- sys/crypto/blake2/blake2_cryptodev.c | 108 +++++++---------------------------- 1 file changed, 22 insertions(+), 86 deletions(-) diff --git a/sys/crypto/blake2/blake2_cryptodev.c b/sys/crypto/blake2/blake2_cryptodev.c index 77f7abaefcf8..755ac12c5d78 100644 --- a/sys/crypto/blake2/blake2_cryptodev.c +++ b/sys/crypto/blake2/blake2_cryptodev.c @@ -54,22 +54,6 @@ struct blake2_softc { struct rwlock lock; }; -static struct mtx_padalign *ctx_mtx; -static struct fpu_kern_ctx **ctx_fpu; - -#define ACQUIRE_CTX(i, ctx) \ - do { \ - (i) = PCPU_GET(cpuid); \ - mtx_lock(&ctx_mtx[(i)]); \ - (ctx) = ctx_fpu[(i)]; \ - } while (0) -#define RELEASE_CTX(i, ctx) \ - do { \ - mtx_unlock(&ctx_mtx[(i)]); \ - (i) = -1; \ - (ctx) = NULL; \ - } while (0) - static int blake2_cipher_setup(struct blake2_session *ses, const struct crypto_session_params *csp); static int blake2_cipher_process(struct blake2_session *ses, @@ -94,30 +78,10 @@ blake2_probe(device_t dev) return (0); } -static void -blake2_cleanctx(void) -{ - int i; - - /* XXX - no way to return driverid */ - CPU_FOREACH(i) { - if (ctx_fpu[i] != NULL) { - mtx_destroy(&ctx_mtx[i]); - fpu_kern_free_ctx(ctx_fpu[i]); - } - ctx_fpu[i] = NULL; - } - free(ctx_mtx, M_BLAKE2); - ctx_mtx = NULL; - free(ctx_fpu, M_BLAKE2); - ctx_fpu = NULL; -} - static int blake2_attach(device_t dev) { struct blake2_softc *sc; - int i; sc = device_get_softc(dev); sc->dying = false; @@ -130,21 +94,6 @@ blake2_attach(device_t dev) return (ENOMEM); } - ctx_mtx = malloc(sizeof(*ctx_mtx) * (mp_maxid + 1), M_BLAKE2, - M_WAITOK | M_ZERO); - ctx_fpu = malloc(sizeof(*ctx_fpu) * (mp_maxid + 1), M_BLAKE2, - M_WAITOK | M_ZERO); - - CPU_FOREACH(i) { -#ifdef __amd64__ - ctx_fpu[i] = fpu_kern_alloc_ctx_domain( - pcpu_find(i)->pc_domain, FPU_KERN_NORMAL); -#else - ctx_fpu[i] = fpu_kern_alloc_ctx(FPU_KERN_NORMAL); -#endif - mtx_init(&ctx_mtx[i], "bl2fpumtx", NULL, MTX_DEF | MTX_NEW); - } - rw_init(&sc->lock, "blake2_lock"); return (0); @@ -164,8 +113,6 @@ blake2_detach(device_t dev) rw_destroy(&sc->lock); - blake2_cleanctx(); - return (0); } @@ -332,80 +279,69 @@ blake2_cipher_process(struct blake2_session *ses, struct cryptop *crp) } bctx; char res[BLAKE2B_OUTBYTES], res2[BLAKE2B_OUTBYTES]; const struct crypto_session_params *csp; - struct fpu_kern_ctx *ctx; const void *key; - int ctxidx; - bool kt; int error, rc; unsigned klen; - ctx = NULL; - ctxidx = 0; - error = EINVAL; - - kt = is_fpu_kern_thread(0); - if (!kt) { - ACQUIRE_CTX(ctxidx, ctx); - fpu_kern_enter(curthread, ctx, - FPU_KERN_NORMAL | FPU_KERN_KTHR); - } - csp = crypto_get_params(crp->crp_session); if (crp->crp_auth_key != NULL) key = crp->crp_auth_key; else key = csp->csp_auth_key; klen = csp->csp_auth_klen; + + fpu_kern_enter(curthread, NULL, FPU_KERN_NORMAL | FPU_KERN_NOCTX); + switch (csp->csp_auth_alg) { case CRYPTO_BLAKE2B: if (klen > 0) rc = blake2b_init_key(&bctx.sb, ses->mlen, key, klen); else rc = blake2b_init(&bctx.sb, ses->mlen); - if (rc != 0) - goto out; + if (rc != 0) { + error = EINVAL; + break; + } error = crypto_apply(crp, crp->crp_payload_start, crp->crp_payload_length, blake2b_applicator, &bctx.sb); if (error != 0) - goto out; + break; rc = blake2b_final(&bctx.sb, res, ses->mlen); - if (rc != 0) { + if (rc != 0) error = EINVAL; - goto out; - } break; case CRYPTO_BLAKE2S: if (klen > 0) rc = blake2s_init_key(&bctx.ss, ses->mlen, key, klen); else rc = blake2s_init(&bctx.ss, ses->mlen); - if (rc != 0) - goto out; + if (rc != 0) { + error = EINVAL; + break; + } error = crypto_apply(crp, crp->crp_payload_start, crp->crp_payload_length, blake2s_applicator, &bctx.ss); if (error != 0) - goto out; + break; rc = blake2s_final(&bctx.ss, res, ses->mlen); - if (rc != 0) { + if (rc != 0) error = EINVAL; - goto out; - } break; default: - panic("unreachable"); + __assert_unreachable(); } + fpu_kern_leave(curthread, NULL); + + if (error != 0) + return (error); + if (crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) { crypto_copydata(crp, crp->crp_digest_start, ses->mlen, res2); if (timingsafe_bcmp(res, res2, ses->mlen) != 0) - return (EBADMSG); + error = EBADMSG; } else crypto_copyback(crp, crp->crp_digest_start, ses->mlen, res); -out: - if (!kt) { - fpu_kern_leave(curthread, ctx); - RELEASE_CTX(ctxidx, ctx); - } return (error); } From nobody Fri Dec 29 23:09:01 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T21KB00FTz55TJ6; Fri, 29 Dec 2023 23:09: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T21K9452Mz4H30; Fri, 29 Dec 2023 23:09:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703891341; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AZg8siVBVHxV8cq2hdIg/QfbqCwkgGtF5fUeeFvrrZ4=; b=trqDg3qr9S8TpwAnZ/YOyz6dR7Vror0ssP+6/L7XCzrCu9wfi+SU+rsn2yPBJ0XmM/trP5 zNNLEGQmc9exxQ6NwmTTXNZ7LBQAZoFnDz7kSvmZ44FCqo6plMOG0qM4AsvfYdN8Tg5NK3 BRhY/AXV9AXvweOV5E56oiuUuS3ABpRga6cdOP3ov4pqgS4/9YutlcB6K1vpe76NLB+4uk LY00ogADK52/yZ1S7evEsdq8mvsG+JBW2HeymM8hnHPdtlptgys2ADm9Ks3rpoaVRB66Fa moKLx3ZJ2J+N/nF0Ky49sTdv1M0RLwVPghkyY69pulBo0xxi4tc/6h3HbM7Gbw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703891341; a=rsa-sha256; cv=none; b=rmF36X5f/gerHhqog2fwOxGsGkDNJPBSPS0v+Eg0ypVJgMJKqNaorHfftlQEJ4py28Lf5S +5yPaeNVOEv4tBSFAfYzFHPsVwLjXQaM/jfdUuP++VauhMlmDFCo4OaV5wzJXqY6W4B13C xveu8fTvj0KfdLB/bYMV5gQBneFGDzLuAHxf5JeYOw/M7g5rwmpuhJR5SVZ5VxUkzpGWeD MxXC5LPXv773JP85iC56pXdh6Swwf6jHjh8hJfAr9fMP12usMlsUJut/Tj+2Q1ctsSRb6q JKvwxvTuze1mSDVt5fEjmfUh0rFOdsMmm3LRL9v/KG8bJITJZfA+pRMNtMyFcw== 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=1703891341; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AZg8siVBVHxV8cq2hdIg/QfbqCwkgGtF5fUeeFvrrZ4=; b=G5jln9FWy4sPG249P7htmt2o3HBCyXvCjUeA1H/qZ2WDPtFhSwwhBe9e9FBJ8zPSoxQOOM PaqSs+l8g66VDqPKfyIw97DokD4ZsthBWgqvcizKJH93gtNOhuJmoBJ8mt4yexmnTiT3Wo Wv1bJp3lzjUKRaD2CNWz2C8NpmWpic63y40CqJZ5gVXFQWc3+Hvd3OXHFGF1R49M0W4XCU 5rQCHb/bfmX89H+ue9X3mOD+Buh70QY/gCI9nwO19uSOsxULLnlAIE8yo4bbmxgQeCX5+a Lqj+CANKRQp1DQdK0UqmZGKMQHEIqJGyy4+I8ToLqMLg4iHCOf5zgVUuf1baWw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T21K927t7zB7j; Fri, 29 Dec 2023 23:09:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BTN91t4075776; Fri, 29 Dec 2023 23:09:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BTN91pD075773; Fri, 29 Dec 2023 23:09:01 GMT (envelope-from git) Date: Fri, 29 Dec 2023 23:09:01 GMT Message-Id: <202312292309.3BTN91pD075773@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 13d39efedb32 - stable/14 - blake2: Remove dieing flag and rw lock List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 13d39efedb32b31a49d4d1f1176200e993708124 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=13d39efedb32b31a49d4d1f1176200e993708124 commit 13d39efedb32b31a49d4d1f1176200e993708124 Author: John Baldwin AuthorDate: 2023-08-28 23:24:42 +0000 Commit: John Baldwin CommitDate: 2023-12-29 21:49:42 +0000 blake2: Remove dieing flag and rw lock crypto_unregister_all already disables new sessions and waits for existing sessions to be destroyed before returning. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D41581 (cherry picked from commit 79aeecc89f5c740f2a3b0c30238233d2a6bb7ec7) --- sys/crypto/blake2/blake2_cryptodev.c | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/sys/crypto/blake2/blake2_cryptodev.c b/sys/crypto/blake2/blake2_cryptodev.c index 755ac12c5d78..5c3ec07d7de7 100644 --- a/sys/crypto/blake2/blake2_cryptodev.c +++ b/sys/crypto/blake2/blake2_cryptodev.c @@ -29,11 +29,9 @@ #include #include #include -#include #include #include #include -#include #include #include @@ -49,9 +47,7 @@ struct blake2_session { CTASSERT((size_t)BLAKE2B_KEYBYTES > (size_t)BLAKE2S_KEYBYTES); struct blake2_softc { - bool dying; int32_t cid; - struct rwlock lock; }; static int blake2_cipher_setup(struct blake2_session *ses, @@ -84,7 +80,6 @@ blake2_attach(device_t dev) struct blake2_softc *sc; sc = device_get_softc(dev); - sc->dying = false; sc->cid = crypto_get_driverid(dev, sizeof(struct blake2_session), CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC | @@ -94,8 +89,6 @@ blake2_attach(device_t dev) return (ENOMEM); } - rw_init(&sc->lock, "blake2_lock"); - return (0); } @@ -106,13 +99,8 @@ blake2_detach(device_t dev) sc = device_get_softc(dev); - rw_wlock(&sc->lock); - sc->dying = true; - rw_wunlock(&sc->lock); crypto_unregister_all(sc->cid); - rw_destroy(&sc->lock); - return (0); } @@ -142,21 +130,11 @@ static int blake2_newsession(device_t dev, crypto_session_t cses, const struct crypto_session_params *csp) { - struct blake2_softc *sc; struct blake2_session *ses; int error; - sc = device_get_softc(dev); - ses = crypto_get_driver_session(cses); - rw_rlock(&sc->lock); - if (sc->dying) { - rw_runlock(&sc->lock); - return (EINVAL); - } - rw_runlock(&sc->lock); - error = blake2_cipher_setup(ses, csp); if (error != 0) { CRYPTDEB("setup failed"); From nobody Fri Dec 29 23:09:02 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T21KB5cTHz55TN4; Fri, 29 Dec 2023 23:09: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T21KB4Gwmz4HDK; Fri, 29 Dec 2023 23:09:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703891342; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lPqKeQlsKMOit9Twa+/+DY8dHT4GFxhw2K311pqqvAw=; b=TjdhqEOh4b024v6vpkkkvrhKrmX6rqwwWFT7MyDPp9q85SNyIhnpA+vKwHMCsApFZrnSCi 279ZzPge8D9JoXqIrsvLmQmbDls6OGhalBzy6qAjfuWrSAsqZmMIsaI1HXv/pbg+504Y36 CxCKI10rrnwuTidImNfy/r9jddV0tY0/4QlHiGPT8dR6nQy9ZTGlM2PIRWpsdO/+f9QLL6 hVTyyUIEgRtBnNrcPxAkg+w7dgCrZA8TZWH0RFDndU5YdfzCjGqMjgcoiMRNrE5hVR4RLw yNkx1P7VnK4cIgbYcmtWa4PdntqNzSDt4ClGfKufjI/oq9uvmeEF9K+CSt/w0A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703891342; a=rsa-sha256; cv=none; b=hpYJh0UMOsz5tKuyuMpXXtHQYfMVTNIyfJRWLJHS5iHZLYrUsbyOrkZe936E3x+U8JKA1C l1+BhkPjy0rJ4ECQUdWaBS/mnqvepFnrV6FZt/Vn9O/Xtm2MhEOXsZiVSo+It8Ao/4EXYl u7UHxqyR+XbPotYQoR8EkS4QnWRcVnvo+i0Mgd3705Fc3YCaB8MlOYnG41fqM4aFAt48OS SuoA8FrNJYcFvOe5X9WZA8AYOkoiVBIbfS+4QBKJvf6cHZW3u+NDQsn8Uc2Q7jygRCzdiU pdzzzYYaInnCwXAtfSeeLxwncdfErQu50w9fY1+jbp5e4tsRCn4RNiS854NbmA== 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=1703891342; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lPqKeQlsKMOit9Twa+/+DY8dHT4GFxhw2K311pqqvAw=; b=srKV5x2Aud779BcDZgtTVOdkKrf5OpvWH/D0qHHIRSCi03vD7axG1KvQWkMHX6BcIPZlii xiXdtnFw1ZQ6zY7bjXtbIXadZHxkWgSlY1An5QY4mgqqz4+fg15yRzvzlG1H1f3o2/NVTC E5xUc9gqkoq9dAVm7sR5b1f4dqt1vryI/5l04Ka7BQRKBMS9v2uShMQ52efDawfx7VTs5b ImM04FD0K+/7O4PSQy1Br7jVCwElruJ9qFTnb+sRFbCGW2egUzgcbSG7zA2BX2FouvKiyj zec/Fsr0Hd6dnSlBEjwnnSCMnAJUimIwVY/mOTl9w9asv7QBRUu3OsQIsFWi1A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T21KB3LcPz9rJ; Fri, 29 Dec 2023 23:09:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BTN92Zn075818; Fri, 29 Dec 2023 23:09:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BTN92WE075815; Fri, 29 Dec 2023 23:09:02 GMT (envelope-from git) Date: Fri, 29 Dec 2023 23:09:02 GMT Message-Id: <202312292309.3BTN92WE075815@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: f27c8ff817a6 - stable/14 - x86: Rename {stop,start}_emulating to fpu_{enable,disable} List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f27c8ff817a6f6b00ba37a6794e5b9f5d8db31b1 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=f27c8ff817a6f6b00ba37a6794e5b9f5d8db31b1 commit f27c8ff817a6f6b00ba37a6794e5b9f5d8db31b1 Author: John Baldwin AuthorDate: 2023-10-11 21:32:06 +0000 Commit: John Baldwin CommitDate: 2023-12-29 21:49:42 +0000 x86: Rename {stop,start}_emulating to fpu_{enable,disable} While here, centralize the macros in . Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D42135 (cherry picked from commit cc1cb9ea0c5607931fa9b7ecf786468d38fb8491) --- sys/amd64/amd64/fpu.c | 31 ++++++++++++++----------------- sys/amd64/vmm/vmm.c | 15 ++++++--------- sys/i386/i386/npx.c | 35 ++++++++++++++++------------------- sys/x86/include/fpu.h | 9 +++++++++ 4 files changed, 45 insertions(+), 45 deletions(-) diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c index c5b84d035d91..3432e62bf7f8 100644 --- a/sys/amd64/amd64/fpu.c +++ b/sys/amd64/amd64/fpu.c @@ -142,9 +142,6 @@ xsaveopt64(char *addr, uint64_t mask) "memory"); } -#define start_emulating() load_cr0(rcr0() | CR0_TS) -#define stop_emulating() clts() - CTASSERT(sizeof(struct savefpu) == 512); CTASSERT(sizeof(struct xstate_hdr) == 64); CTASSERT(sizeof(struct savefpu_ymm) == 832); @@ -263,7 +260,7 @@ fpususpend(void *addr) u_long cr0; cr0 = rcr0(); - stop_emulating(); + fpu_enable(); fpusave(addr); load_cr0(cr0); } @@ -274,7 +271,7 @@ fpuresume(void *addr) u_long cr0; cr0 = rcr0(); - stop_emulating(); + fpu_enable(); fninit(); if (use_xsave) load_xcr(XCR0, xsave_mask); @@ -393,13 +390,13 @@ fpuinit(void) * It is too early for critical_enter() to work on AP. */ saveintr = intr_disable(); - stop_emulating(); + fpu_enable(); fninit(); control = __INITIAL_FPUCW__; fldcw(control); mxcsr = __INITIAL_MXCSR__; ldmxcsr(mxcsr); - start_emulating(); + fpu_disable(); intr_restore(saveintr); TSEXIT(); } @@ -430,7 +427,7 @@ fpuinitstate(void *arg __unused) cpu_thread_alloc(&thread0); saveintr = intr_disable(); - stop_emulating(); + fpu_enable(); fpusave_fxsave(fpu_initialstate); if (fpu_initialstate->sv_env.en_mxcsr_mask) @@ -473,7 +470,7 @@ fpuinitstate(void *arg __unused) } } - start_emulating(); + fpu_disable(); intr_restore(saveintr); } /* EFIRT needs this to be initialized before we can enter our EFI environment */ @@ -488,9 +485,9 @@ fpuexit(struct thread *td) critical_enter(); if (curthread == PCPU_GET(fpcurthread)) { - stop_emulating(); + fpu_enable(); fpusave(curpcb->pcb_save); - start_emulating(); + fpu_disable(); PCPU_SET(fpcurthread, NULL); } critical_exit(); @@ -741,7 +738,7 @@ restore_fpu_curthread(struct thread *td) */ PCPU_SET(fpcurthread, td); - stop_emulating(); + fpu_enable(); fpu_clean_state(); pcb = td->td_pcb; @@ -803,7 +800,7 @@ fpudna(void) * regardless of the eager/lazy FPU context switch * mode. */ - stop_emulating(); + fpu_enable(); } else { if (__predict_false(PCPU_GET(fpcurthread) != NULL)) { panic( @@ -823,7 +820,7 @@ fpu_activate_sw(struct thread *td) if ((td->td_pflags & TDP_KTHREAD) != 0 || !PCB_USER_FPU(td->td_pcb)) { PCPU_SET(fpcurthread, NULL); - start_emulating(); + fpu_disable(); } else if (PCPU_GET(fpcurthread) != td) { restore_fpu_curthread(td); } @@ -839,7 +836,7 @@ fpudrop(void) CRITICAL_ASSERT(td); PCPU_SET(fpcurthread, NULL); clear_pcb_flags(td->td_pcb, PCB_FPUINITDONE); - start_emulating(); + fpu_disable(); } /* @@ -1139,7 +1136,7 @@ fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags) if ((flags & FPU_KERN_NOCTX) != 0) { critical_enter(); - stop_emulating(); + fpu_enable(); if (curthread == PCPU_GET(fpcurthread)) { fpusave(curpcb->pcb_save); PCPU_SET(fpcurthread, NULL); @@ -1190,7 +1187,7 @@ fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx) CRITICAL_ASSERT(td); clear_pcb_flags(pcb, PCB_FPUNOSAVE | PCB_FPUINITDONE); - start_emulating(); + fpu_disable(); } else { KASSERT((ctx->flags & FPU_KERN_CTX_INUSE) != 0, ("leaving not inuse ctx")); diff --git a/sys/amd64/vmm/vmm.c b/sys/amd64/vmm/vmm.c index d44adc86252d..74fa83ea18d9 100644 --- a/sys/amd64/vmm/vmm.c +++ b/sys/amd64/vmm/vmm.c @@ -256,9 +256,6 @@ DEFINE_VMMOPS_IFUNC(int, vcpu_snapshot, (void *vcpui, DEFINE_VMMOPS_IFUNC(int, restore_tsc, (void *vcpui, uint64_t now)) #endif -#define fpu_start_emulating() load_cr0(rcr0() | CR0_TS) -#define fpu_stop_emulating() clts() - SDT_PROVIDER_DEFINE(vmm); static MALLOC_DEFINE(M_VM, "vm", "vm"); @@ -1310,7 +1307,7 @@ restore_guest_fpustate(struct vcpu *vcpu) fpuexit(curthread); /* restore guest FPU state */ - fpu_stop_emulating(); + fpu_enable(); fpurestore(vcpu->guestfpu); /* restore guest XCR0 if XSAVE is enabled in the host */ @@ -1318,10 +1315,10 @@ restore_guest_fpustate(struct vcpu *vcpu) load_xcr(0, vcpu->guest_xcr0); /* - * The FPU is now "dirty" with the guest's state so turn on emulation - * to trap any access to the FPU by the host. + * The FPU is now "dirty" with the guest's state so disable + * the FPU to trap any access by the host. */ - fpu_start_emulating(); + fpu_disable(); } static void @@ -1338,9 +1335,9 @@ save_guest_fpustate(struct vcpu *vcpu) } /* save guest FPU state */ - fpu_stop_emulating(); + fpu_enable(); fpusave(vcpu->guestfpu); - fpu_start_emulating(); + fpu_disable(); } static VMM_STAT(VCPU_IDLE_TICKS, "number of ticks vcpu was idle"); diff --git a/sys/i386/i386/npx.c b/sys/i386/i386/npx.c index 689796821d80..26def3f433f1 100644 --- a/sys/i386/i386/npx.c +++ b/sys/i386/i386/npx.c @@ -123,9 +123,6 @@ xsaveopt(char *addr, uint64_t mask) "memory"); } -#define start_emulating() load_cr0(rcr0() | CR0_TS) -#define stop_emulating() clts() - #define GET_FPU_CW(thread) \ (cpu_fxsr ? \ (thread)->td_pcb->pcb_save->sv_xmm.sv_env.en_cw : \ @@ -224,7 +221,7 @@ npx_probe(void) /* * Don't trap while we're probing. */ - stop_emulating(); + fpu_enable(); /* * Finish resetting the coprocessor, if any. If there is an error @@ -413,7 +410,7 @@ npxinit(bool bsp) * It is too early for critical_enter() to work on AP. */ saveintr = intr_disable(); - stop_emulating(); + fpu_enable(); if (cpu_fxsr) fninit(); else @@ -424,7 +421,7 @@ npxinit(bool bsp) mxcsr = __INITIAL_MXCSR__; ldmxcsr(mxcsr); } - start_emulating(); + fpu_disable(); intr_restore(saveintr); } @@ -458,7 +455,7 @@ npxinitstate(void *arg __unused) } saveintr = intr_disable(); - stop_emulating(); + fpu_enable(); if (cpu_fxsr) fpusave_fxsave(npx_initialstate); @@ -515,7 +512,7 @@ npxinitstate(void *arg __unused) } } - start_emulating(); + fpu_disable(); intr_restore(saveintr); } SYSINIT(npxinitstate, SI_SUB_CPU, SI_ORDER_ANY, npxinitstate, NULL); @@ -529,9 +526,9 @@ npxexit(struct thread *td) critical_enter(); if (curthread == PCPU_GET(fpcurthread)) { - stop_emulating(); + fpu_enable(); fpusave(curpcb->pcb_save); - start_emulating(); + fpu_disable(); PCPU_SET(fpcurthread, NULL); } critical_exit(); @@ -810,7 +807,7 @@ restore_npx_curthread(struct thread *td, struct pcb *pcb) */ PCPU_SET(fpcurthread, td); - stop_emulating(); + fpu_enable(); if (cpu_fxsr) fpu_clean_state(); @@ -863,7 +860,7 @@ npxdna(void) * regardless of the eager/lazy FPU context switch * mode. */ - stop_emulating(); + fpu_enable(); } else { if (__predict_false(PCPU_GET(fpcurthread) != NULL)) { printf( @@ -891,7 +888,7 @@ void npxsave(union savefpu *addr) { - stop_emulating(); + fpu_enable(); fpusave(addr); } @@ -902,7 +899,7 @@ npxswitch(struct thread *td, struct pcb *pcb) if (lazy_fpu_switch || (td->td_pflags & TDP_KTHREAD) != 0 || !PCB_USER_FPU(pcb)) { - start_emulating(); + fpu_disable(); PCPU_SET(fpcurthread, NULL); } else if (PCPU_GET(fpcurthread) != td) { restore_npx_curthread(td, pcb); @@ -925,7 +922,7 @@ npxsuspend(union savefpu *addr) return; } cr0 = rcr0(); - stop_emulating(); + fpu_enable(); fpusave(addr); load_cr0(cr0); } @@ -940,7 +937,7 @@ npxresume(union savefpu *addr) cr0 = rcr0(); npxinit(false); - stop_emulating(); + fpu_enable(); fpurstor(addr); load_cr0(cr0); } @@ -962,7 +959,7 @@ npxdrop(void) CRITICAL_ASSERT(td); PCPU_SET(fpcurthread, NULL); td->td_pcb->pcb_flags &= ~PCB_NPXINITDONE; - start_emulating(); + fpu_disable(); } /* @@ -1397,7 +1394,7 @@ fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags) if ((flags & FPU_KERN_NOCTX) != 0) { critical_enter(); - stop_emulating(); + fpu_enable(); if (curthread == PCPU_GET(fpcurthread)) { fpusave(curpcb->pcb_save); PCPU_SET(fpcurthread, NULL); @@ -1448,7 +1445,7 @@ fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx) CRITICAL_ASSERT(td); pcb->pcb_flags &= ~(PCB_NPXNOSAVE | PCB_NPXINITDONE); - start_emulating(); + fpu_disable(); } else { KASSERT((ctx->flags & FPU_KERN_CTX_INUSE) != 0, ("leaving not inuse ctx")); diff --git a/sys/x86/include/fpu.h b/sys/x86/include/fpu.h index e1ec6a592d21..0debf65d6fb9 100644 --- a/sys/x86/include/fpu.h +++ b/sys/x86/include/fpu.h @@ -213,4 +213,13 @@ struct savefpu_ymm { */ #define X86_XSTATE_XCR0_OFFSET 464 +#ifdef _KERNEL +/* + * CR0_MP and CR0_EM are always set. Use CR0_TS to force traps when + * FPU access is disabled. + */ +#define fpu_enable() clts() +#define fpu_disable() load_cr0(rcr0() | CR0_TS) +#endif + #endif /* !_X86_FPU_H_ */ From nobody Fri Dec 29 23:17:40 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T21W86y3Jz55VP2; Fri, 29 Dec 2023 23:17: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T21W86RVKz4KZF; Fri, 29 Dec 2023 23:17:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703891860; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GW8Tct/I/Ail4L92uFj85ls5wSAu5bWSoVTcFVWwSv0=; b=YHjCJZYhWqLJUK3gNiX/Nz+14UQf4iv8mLiRuywyC/5m5Ab5F46SAiklp8qt2CIVCh4APB FtrYtvDBhn5i7j4tgsYS7QQoB3qPCy95iMM2RFHDGhAFIkDe/T1TqZIR7gT8oG+GLBxJl1 7I7rnLkHZu+6+bh5kHDp5KmjHfLVf5KsEWk+yEqW3gLHSQt390Bj6LdRC2Mep/aQV7QuRf 5y+Zxj2db66Y6F0QscdY1yZRe0dsQpIVDBuEBWsWtDmzlb7bLZHWrQCLOpg6G9tlVHeN23 /YI8CtyQH0YpJ+8pZ+66hEcvqfGBEmE9Uz+hZP5Gd1ySlW/F4CDyYJQ6TnY1NQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703891860; a=rsa-sha256; cv=none; b=ts6yUklXXILyk8rfIZprWmyU1evOcDQX/wu60DISlEVXtjRVMV3dBqBBZktUCSlJ8Eb6tr Ooooje8BvpBerF09l/xREHL0SEgCFC1fO9mn1GErMewEkouVpnrT6o1vdvCdI1RH0Fnhn4 WcLHBMD3DjwS9i5nQ7uoXf4tsqojK0/FCp9U+HQiT+XI0oMiq9evjQp403cMkFmqxfnv3J /GWU2ssdX8cR17FwNlqPCFUynZflZFbrbELnkr4P1Tg0DJA3x+cxBOgmSSuT3VlBYoGJxY wfEznWDJEG8hitKHFWVGKzRjjilzfO38vyZ+w4/O0rBfv1YoaXnY9w/V0N1i6g== 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=1703891860; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GW8Tct/I/Ail4L92uFj85ls5wSAu5bWSoVTcFVWwSv0=; b=Nr2gtiyabPnst/R3KtFaeBQeoNizn0AFfVVexu6eHa+3i7x6m7izWJWipR9MQJ631voUcd hwshMcWxziozqdZbnwFUl4bU0dtp4IFhfnczo1O5MYCj+NWLCWnF4OU0j5iGeuBgwNqCKH 1SDP8KQWZZvL5X1ZUr6juI53BaokMTmUOvB7YWOGoU5bK5V0P31/9X1KnkKw3EHsXMw2Fi q1vQTvr6ECFJJx42wYsMfS7GUQ85s+dqHgB8nac8/4qZoDnyVy35DXY+BTrJI1X9PEdxic UqqETJj1zicJafXM5UAq59hIrw5CL0NjDOkMNQv9qPjYaNmX9nPTgxKGknpyDg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T21W85SXszB0d; Fri, 29 Dec 2023 23:17:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BTNHeLB092500; Fri, 29 Dec 2023 23:17:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BTNHeio092497; Fri, 29 Dec 2023 23:17:40 GMT (envelope-from git) Date: Fri, 29 Dec 2023 23:17:40 GMT Message-Id: <202312292317.3BTNHeio092497@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 2c83f1ada435 - stable/14 - mountd: Update exports.5 for commit 7c5146da1286 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 2c83f1ada4356e61b0a33314f3f02736d7a2fb14 Auto-Submitted: auto-generated The branch stable/14 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=2c83f1ada4356e61b0a33314f3f02736d7a2fb14 commit 2c83f1ada4356e61b0a33314f3f02736d7a2fb14 Author: Rick Macklem AuthorDate: 2023-12-22 20:17:36 +0000 Commit: Rick Macklem CommitDate: 2023-12-29 23:16:16 +0000 mountd: Update exports.5 for commit 7c5146da1286 Commit 7c5146da1286 modified mountd so that it uses strunvis(3) to decode directory names in exports lines. This allows special characters, such as blanks, to be encoded in the directory names. This patch updates the exports.5 man page for this change. This is a content change. (cherry picked from commit 922e78f65fd9a58db9e52d84290ed7c187b09278) --- usr.sbin/mountd/exports.5 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/usr.sbin/mountd/exports.5 b/usr.sbin/mountd/exports.5 index 56facef29a12..e394bb036046 100644 --- a/usr.sbin/mountd/exports.5 +++ b/usr.sbin/mountd/exports.5 @@ -27,7 +27,7 @@ .\" .\" @(#)exports.5 8.3 (Berkeley) 3/29/95 .\" -.Dd August 16, 2022 +.Dd December 21, 2023 .Dt EXPORTS 5 .Os .Sh NAME @@ -108,6 +108,17 @@ any or .Dq Pa .. components. +Pathnames are decoded by +.Xr strunvis 3 +allowing special characters to be included in the directory name(s). +In particular, whitespace, such as embedded blanks in directory names +can be handled. +For example, a blank can be encoded as \(rs040. +.Xr vis 1 +with the +.Fl M +option may be used to encode directory name(s) with embedded special +characters. Mount points for a file system may appear on multiple lines each with different sets of hosts and export options. .Pp @@ -584,6 +595,8 @@ NFSv4 mount request for a directory that the client does not have permission for will succeed and read/write access will fail afterwards, whereas NFSv3 rejects the mount request. .Sh SEE ALSO +.Xr vis 1 , +.Xr strunvis 3 , .Xr nfsv4 4 , .Xr netgroup 5 , .Xr mountd 8 , From nobody Fri Dec 29 23:20:11 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T21Z33W9sz55VM5; Fri, 29 Dec 2023 23:20: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T21Z330xrz4LCB; Fri, 29 Dec 2023 23:20:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703892011; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=He7rjZFtgS7lgLD0nVefSzqWtpsfzkO+7WAGHirYpq0=; b=mLsuw/cKQB90tEmHA3DfDKBfBSo0lQThXCouO/50j7NcgKsOr+XIn9tL52pHAq7lBvZQOB oUG+giliAnUSk0ZfMI1WIZ56LqmJQm36nAQ5pwwYxt6+PXxeLYTiAHj5+ZxHkls5ljpbGn f5zLxq5/7vtVDAtX/Po+pDfTdXNHYw61VFXRCLUT2hjNHn7Bc/SJ5TTJAprZwP9Ap+9dxf uabOIdaEbsUQGPAzNKKIbW0pEOp3VM9tGqgOzvMw4pZIQI1YAuhP2P+ttWpyi/HhWHARdw tFTzRZBUz/SNceamq3peF97057SMvlHhgIGU4MOL4YoZ8IKju5dH5tfEc3EC6g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703892011; a=rsa-sha256; cv=none; b=yskidEtfsCVAAWdnLcjfFBHbzQkD1tbSUvApJRGAzX3CO3rvZtzqZTFwqtCtBB2SCyc8n8 P1llz/sYMNmIDd25iWtwQYGyQB2M2qiEkLKQ19ByThOagz93Fwc/58Y7Y4P/33WeA4T1Xv EWIZqdsViIfIfN+aZzIaMza7kRfxusM1phF1/3T+1moW1lyW+yF5RK0KdPWGVyarW9pRuA /VhTaj8wwOGKcrpgYAgN+5IfG0bune9EYuus/NpXZTiOt8qVEWuLA0p4t1laHPl1M1qZE3 EqOz5ABENhsUIwoiaMlfTYTZ9UYGQwHyWPa0irmo+9ucc/kiBDbq+1uUk80HBw== 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=1703892011; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=He7rjZFtgS7lgLD0nVefSzqWtpsfzkO+7WAGHirYpq0=; b=jTCEVdLMGlzGh19PapcMC98ZR4vTnkKl6gE63MqVY+nFRHM+HWvoEpv0PIbamY6tHJdgIA DqnScg/ClXqn75+wa6OPsGVHq02QNFcILQujWfNFwaLaUB/8yU4Gm8LD2PLrIVk0DKuhIW 80Tktg1GODk2RAKZ4xZPS0DR2hKkJroCKayUq3KRc2pDrnWQ7dFSQ9Sr68YX0CD4hPbGsJ rD7Tvb/eHaeAz+f1/vn4slG+8wBduoF8fUJlFNhoFD6AkuddyTDdj09XQGffy2p1V8fWia 5imMGV1NnBPZf4b0PrAbXQhib/YqnSgx9vLbtzRU791W1Gv44TS1U6RjWFvmLQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T21Z324j6zBFK; Fri, 29 Dec 2023 23:20:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BTNKBJm097692; Fri, 29 Dec 2023 23:20:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BTNKBuB097682; Fri, 29 Dec 2023 23:20:11 GMT (envelope-from git) Date: Fri, 29 Dec 2023 23:20:11 GMT Message-Id: <202312292320.3BTNKBuB097682@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 925d9b3abac2 - stable/14 - nfscl: Make NFSv4.2 Copy set atime on infd List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 925d9b3abac22404d671d40be7b2166a534cc8f8 Auto-Submitted: auto-generated The branch stable/14 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=925d9b3abac22404d671d40be7b2166a534cc8f8 commit 925d9b3abac22404d671d40be7b2166a534cc8f8 Author: Rick Macklem AuthorDate: 2023-10-18 20:07:39 +0000 Commit: Rick Macklem CommitDate: 2023-12-29 23:18:14 +0000 nfscl: Make NFSv4.2 Copy set atime on infd RFC7862 does not specify infile atime behaviour when a NFSv4.2 Copy operation is performed. Since the collective opinion of a mailing list discussion (on freebsd-hackers@) seemed to indicate that copy_file_range(2) should update atime on the infd, even if there is no data copied, this patch attempts to ensure that behaviour. For Copy, it preceeds the Copy operation with a Setattr of TimeAccess_Set(NFSv4. speak for atime) for the invp. For the case where no data will be copied, it does a Setattr RPC to set TimeAccess_Set for the invp. A __FreeBSD_version bump will be done as a separate commit, since this patch changes the internal interface between the nfscommon and nfscl modules. (cherry picked from commit 57ce37f9dcd0ec749e5e4512e1e44eb963565c68) --- sys/fs/nfs/nfs_commonsubs.c | 2 +- sys/fs/nfsclient/nfs_clrpcops.c | 35 +++++++++++++++++++++++++++++++++++ sys/fs/nfsclient/nfs_clvnops.c | 21 ++++++++++++++++++--- 3 files changed, 54 insertions(+), 4 deletions(-) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index f2305795e53e..832713e6c1de 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -296,7 +296,7 @@ static struct { { NFSV4OP_OPEN, 8, "CreateLayGet", 12, }, { NFSV4OP_IOADVISE, 1, "Advise", 6, }, { NFSV4OP_ALLOCATE, 2, "Allocate", 8, }, - { NFSV4OP_SAVEFH, 5, "Copy", 4, }, + { NFSV4OP_SAVEFH, 6, "Copy", 4, }, { NFSV4OP_SEEK, 2, "Seek", 4, }, { NFSV4OP_SEEK, 1, "SeekDS", 6, }, { NFSV4OP_GETXATTR, 2, "Getxattr", 8, }, diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 9d56d06c1c84..e9acedfb6473 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -8734,6 +8734,7 @@ nfsrpc_copyrpc(vnode_t invp, off_t inoff, vnode_t outvp, off_t outoff, struct nfsrv_descript *nd = &nfsd; struct nfsmount *nmp; nfsattrbit_t attrbits; + struct vattr va; uint64_t len; nmp = VFSTONFS(outvp->v_mount); @@ -8744,14 +8745,35 @@ nfsrpc_copyrpc(vnode_t invp, off_t inoff, vnode_t outvp, off_t outoff, if (len > nfs_maxcopyrange) len = nfs_maxcopyrange; NFSCL_REQSTART(nd, NFSPROC_COPY, invp, cred); + /* + * First do a Setattr of atime to the server's clock + * time. The FreeBSD "collective" was of the opinion + * that setting atime was necessary for this syscall. + * Do the Setattr before the Copy, so that it can be + * handled well if the server replies NFSERR_DELAY to + * the Setattr operation. + */ + NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(NFSV4OP_SETATTR); + nfsm_stateidtom(nd, instateidp, NFSSTATEID_PUTSTATEID); + VATTR_NULL(&va); + va.va_atime.tv_sec = va.va_atime.tv_nsec = 0; + va.va_vaflags = VA_UTIMES_NULL; + nfscl_fillsattr(nd, &va, invp, 0, 0); + + /* Now Getattr the invp attributes. */ NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); *tl = txdr_unsigned(NFSV4OP_GETATTR); NFSGETATTR_ATTRBIT(&attrbits); nfsrv_putattrbit(nd, &attrbits); + + /* Set outvp. */ NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); *tl = txdr_unsigned(NFSV4OP_PUTFH); (void)nfsm_fhtom(nmp, nd, VTONFS(outvp)->n_fhp->nfh_fh, VTONFS(outvp)->n_fhp->nfh_len, 0); + + /* Do the Copy. */ NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); *tl = txdr_unsigned(NFSV4OP_COPY); nfsm_stateidtom(nd, instateidp, NFSSTATEID_PUTSTATEID); @@ -8766,12 +8788,25 @@ nfsrpc_copyrpc(vnode_t invp, off_t inoff, vnode_t outvp, off_t outoff, *tl++ = newnfs_false; *tl++ = newnfs_true; *tl++ = 0; + + /* Get the outvp attributes. */ *tl = txdr_unsigned(NFSV4OP_GETATTR); NFSWRITEGETATTR_ATTRBIT(&attrbits); nfsrv_putattrbit(nd, &attrbits); + error = nfscl_request(nd, invp, p, cred); if (error != 0) return (error); + /* Skip over the Setattr reply. */ + if ((nd->nd_flag & ND_NOMOREDATA) == 0) { + NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_UNSIGNED); + if (*(tl + 1) == 0) { + error = nfsrv_getattrbits(nd, &attrbits, NULL, NULL); + if (error != 0) + goto nfsmout; + } else + nd->nd_flag |= ND_NOMOREDATA; + } if ((nd->nd_flag & ND_NOMOREDATA) == 0) { /* Get the input file's attributes. */ NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_UNSIGNED); diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index e93f8e83daa4..a690e988b4b3 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -3873,7 +3873,7 @@ nfs_copy_file_range(struct vop_copy_file_range_args *ap) struct vnode *outvp = ap->a_outvp; struct mount *mp; struct nfsvattr innfsva, outnfsva; - struct vattr *vap; + struct vattr va, *vap; struct uio io; struct nfsmount *nmp; size_t len, len2; @@ -3980,10 +3980,25 @@ generic_copy: * will not reply NFSERR_INVAL. * Setting "len == 0" for the RPC would be preferred, * but some Linux servers do not support that. + * If the len is being set to 0, do a Setattr RPC to + * set the server's atime. This behaviour was the + * preferred one for the FreeBSD "collective". */ - if (inoff >= vap->va_size) + if (inoff >= vap->va_size) { *ap->a_lenp = len = 0; - else if (inoff + len > vap->va_size) + VATTR_NULL(&va); + va.va_atime.tv_sec = va.va_atime.tv_nsec = 0; + va.va_vaflags = VA_UTIMES_NULL; + inattrflag = 0; + error = nfsrpc_setattr(invp, &va, NULL, + ap->a_incred, curthread, &innfsva, + &inattrflag); + if (inattrflag != 0) + ret = nfscl_loadattrcache(&invp, + &innfsva, NULL, 0, 1); + if (error == 0 && ret != 0) + error = ret; + } else if (inoff + len > vap->va_size) *ap->a_lenp = len = vap->va_size - inoff; } else error = 0; From nobody Fri Dec 29 23:24:55 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T21gW3ktMz55Vwb; Fri, 29 Dec 2023 23:24:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T21gW307kz4Lxf; Fri, 29 Dec 2023 23:24:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703892295; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=weD5FDRGDg8s0s3D7JggWdwkKazdeEPobqBzeC3hDfM=; b=P8fUhgzVEkHh+Qrk2+R2xpBEK/8ydC5FwR2buxQVziBwuTSMhJNR0k5O1E0HRiPpktCrv4 A3MdfigYfo336YT0Z4qTSKkZ9vNApcZFvjHfbMhVZeMYByAN4lsvJZgbW/dUi1D1Rdurjp p/Li0Al63xfecONKcXQR21EE0yCbw367Qzp3+Ha7rj2Wy/2fnKG51gWg1rOy5GFgLPyoI3 niw9z12iZc+YNVTs5cN5RfxZLFJlSurmDUSai2r77d4SGM1Nsw0O43uNgurJz15eMcFfIn 8MaRl5G1NErYHqdp6aqf6ARwEhPxCq7LwW2UOKl2xQ558NOPsC8/w059/DAsPQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703892295; a=rsa-sha256; cv=none; b=NFiHpKtsy7W0S4Yni0WOY4Uy/94xKGAAJFeQlVgdxMgcXYx6k6bOcjSs/ABh4cF9wKQheq zJJjhaDr+WxpNXCbaCBPdpSQlryP+uT6RzRZ/77T6iRZps3O1j48afOXyXaKIAtYLEV5T+ NKiFEJrDzStxil2Vl6bPMzMiCi2p5ceppbTbtWZYv9Q/stQ+cZQKCuCIryaABNh8tzfaNk G2UwmVUNHzbqJXO1T8MhnR/WemaI+tAku3J5y7p3SQZbxoKGn/hVcg95Jc7bB49Wg2PSEZ mD+d90O0S2tiicJ/Wh6FIa8WVE1s/8a4eCf/BKy4SKM2tzoXzmnMCtWW8ekiHg== 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=1703892295; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=weD5FDRGDg8s0s3D7JggWdwkKazdeEPobqBzeC3hDfM=; b=P5AXsryDDNiYW0Um3KFuKHZLdlKCLiJZT5DPrXQZ7Q/0gm+sqw/pbMi2imCAdvQm+qo/2Y oLquCatEwMZur5g5jFWmoEqGGhuSxUq4c+cEnw8bwG6WQtyECJgDuOFWZJAMFQ7mKRK2rC yFdjrX/SNvC/BNRc2Y8jCM8HZF4z57opCa044umTV1LJ6O2hEzLNwYTsHwxSQtSwLkQ33L rnS2SNhCipZOGkzDmjsZhgXiC+PDybJJ8vWs3F2WMuL/BMC7b9Ww9GBg3kaT4WsbPFYxzu w3QkD21mhswLdsnMHWZnvS0t222xLckK8xQi/qxPIpHZWP5ANH2QdjXovuIiBg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T21gW23JtzBhC; Fri, 29 Dec 2023 23:24:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BTNOtbX008703; Fri, 29 Dec 2023 23:24:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BTNOtn3008700; Fri, 29 Dec 2023 23:24:55 GMT (envelope-from git) Date: Fri, 29 Dec 2023 23:24:55 GMT Message-Id: <202312292324.3BTNOtn3008700@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: ba99d960884d - stable/14 - param.h: Bump __FreeBSD_version to 1400503 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: ba99d960884d50eb7d36146914206644ee132aa4 Auto-Submitted: auto-generated The branch stable/14 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=ba99d960884d50eb7d36146914206644ee132aa4 commit ba99d960884d50eb7d36146914206644ee132aa4 Author: Rick Macklem AuthorDate: 2023-12-29 23:22:07 +0000 Commit: Rick Macklem CommitDate: 2023-12-29 23:22:07 +0000 param.h: Bump __FreeBSD_version to 1400503 Commit 925d9b3abac2 changed the internal API between the nfscommon and nfscl modules. As such, both need to be rebuilt from sources. --- sys/sys/param.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/param.h b/sys/sys/param.h index 3ed0d9ef6ddc..7ceae8fa8365 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -75,7 +75,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400502 +#define __FreeBSD_version 1400503 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From nobody Fri Dec 29 23:29:42 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T21n24sB9z55WWp; Fri, 29 Dec 2023 23:29: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T21n22qGtz4MTM; Fri, 29 Dec 2023 23:29:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703892582; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vk89pZQA0kB5Jv24egYY7keNDbvc51jvmf/Na3E55zE=; b=phOJjPG/PBUlt7MbbFd1Pj4MjVDB6PWWN728r3KkzyNrjcadrtAD31hzZL5l0TZWqJNgg9 876BAjOVwNTqsw7cD/hOQWe8mUTUk3uxiTONSiKJYolfQZtNNOIClzoQJj0HEatvpwYJVq yub4QZ9KkmqwvX2k6VNJ9w1E+JCqpbVuXSGkVQZb65XL/N6jdOF2EU0G7X+x1P8gBajLEp pyV/Otsn6mhOP2kZ1IRttpM7gTRv68Ox1uJcokdqR73kg3LmOSVYBneuQTTBhXaP1vY7L5 hyGUBZiUXs+kcQJw8mg5OD12Vd3OmquZ9cwEUWCkA+E9Q1bsVbno17GhpdeXmw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703892582; a=rsa-sha256; cv=none; b=TY4vkMDdInMTsYoMbFmgunV+Fgt1xyZ8KBwGBC8EZN1wAnHlZG90Jl7xz1ZRSwmadk8glO oQKVbF4bYvFpIl0TpB6ECuLc+bxKZTo3R6TqqK3T1qkJpNL05Obd+EAvMZKUakXFnPYDp4 Tt9eYZC1fULWyb7RI6neZWtfxktVo4kq+6H/f0ltzJXQwCZ/UIrrv8YZ+Jd35oUPpQG9xA MhAewZpiOm69MqXZmbmGttIKqJj3ozDxk8sKPBg1gIj8KG5ZnxoejYSEEzC5GT+kf6XLs4 fm5DWl1N5ug/XyK8I69uqHLJInUP69X540kDU/S/GL9u7mf9LuquiT33swvaNw== 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=1703892582; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vk89pZQA0kB5Jv24egYY7keNDbvc51jvmf/Na3E55zE=; b=PZtntj35noZcS4Pjdy3164iAWgEVyRZrGcTKmu4PtJ20TN3ZTYSiHEdYGTs1YM0/SepVJS Nt866skOA7QXqLJSf79svlTNcrc+rCYkLVwTRB2JyeFu5ezMzWG+QoOXd3xb4x5KT4O/WX yfOJbjeNeCF/GEEZfQENLjQjX6NgE3CI87IlHe4WWpOBaV6Wsp/fPgiDYHpxgrcGWlMFUs lvefSxF2obQiJGmuS7EO+9fJV2B8IX7PpH4CNRTJs85oMOkmUi5H4ZDRb8JMvZw4XRiHWX kf/bTlW8GJRALDH4Lva2e1EnBUVjrLDt2gXcMdN3Ujs06OHC8oBSC9hCRdlcfw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T21n21pNjzBhD; Fri, 29 Dec 2023 23:29:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BTNTg1K009450; Fri, 29 Dec 2023 23:29:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BTNTgrw009447; Fri, 29 Dec 2023 23:29:42 GMT (envelope-from git) Date: Fri, 29 Dec 2023 23:29:42 GMT Message-Id: <202312292329.3BTNTgrw009447@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: ef38bebcb57c - stable/14 - UPDATING: Add an entry for commit ba99d960884d List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: ef38bebcb57c661179cb7328c8d2db54ff5e99b1 Auto-Submitted: auto-generated The branch stable/14 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=ef38bebcb57c661179cb7328c8d2db54ff5e99b1 commit ef38bebcb57c661179cb7328c8d2db54ff5e99b1 Author: Rick Macklem AuthorDate: 2023-12-29 23:28:23 +0000 Commit: Rick Macklem CommitDate: 2023-12-29 23:28:23 +0000 UPDATING: Add an entry for commit ba99d960884d --- UPDATING | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/UPDATING b/UPDATING index cea774197ec8..44f7115614ea 100644 --- a/UPDATING +++ b/UPDATING @@ -12,6 +12,13 @@ Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before updating system packages and/or ports. +20231229: + Commit 925d9b3abac2 modified the internal API between + the nfscommon and nfscl modules. + As such, both of these modules need to be rebuilt from + sources. Therefore, the __FreeBSD_version has been bumped + to 1400503. + 20231224: Commits acc704b36192 and b8e137d8d32d both modified the internal API between the kgssapi and krpc modules. From nobody Sat Dec 30 00:24:44 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T230Y08Ghz55cX7; Sat, 30 Dec 2023 00: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T230X6hCnz4TDb; Sat, 30 Dec 2023 00: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=1703895884; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=p7qPCvkMOD9FDRRn/zXrFFCAXa0d0y3ThuC3YOCiGR8=; b=QD8juiC5UDGk27nkzFAmzA6MXBq8B9xlyoj06td/l33oL65IcreyOU1LTX08UCTG+vWFOf 8sPva9Rggntc6XjRl8D8qYhYcRmDVrju9DSU5lrNJ2rFHMV2HQT2POglzGcCOO6h4FPU4g /Wn1SQLL9EEW+oGZX9RjWEOzn5PpVKmN8HCRu2ixSt1f6U0oJ8wcCGPNsHPzVNoRXrU1dy E9IR0XdCZvGq0ZXvWTlRcE2ggIwekYqnagdIdAQkW8CjXbg6SvQGzms3PF5BT5uE4ckNux srwdTz1fsexaUixsP4N9saXj+WpBVKNcocdBcTZYfS6ZvHytbgldKENOkVYWZQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703895884; a=rsa-sha256; cv=none; b=g7p3+3pbQFy8vBaCzmxUOs89KqWyBcSaNu19k/EgzAdo2fBMdfutah8e/mJqXzOoJvtKBU ItTKP72gBxkR7SKBWf8LK9qqLxqxcZUt9G8OXUZ4c/V0OQg8666pIohuedOlQiZa8tK4JY vvNJ89dM+iIS04cmmYg8od6DbEv4CxFX69l8TOTaZzcQEAMfF8wG485CcuQB+TtxgqDho1 ze2OW6aIp3wt7g8EdPU2rv7UPJUPQPPx4R0rQZ0k7ynPQ1ll5/foorpoVpygJl345VcR+V nQMiI6pFtc9DNtPwzwGB7RyOild2YkUWO+brqc5aSihRWNW3k5Fy9AVXLOqC9Q== 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=1703895884; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=p7qPCvkMOD9FDRRn/zXrFFCAXa0d0y3ThuC3YOCiGR8=; b=kpyj9Y7pQ+cVUmYvtsDS8t201gfhIAjp56zb8ucUZsQK8+S91iwqccQzb2pTJHNnKCO49f zELBRjFSskueEGVawXXmH8yBrqfDLhdTCm8KoMumB5GQg1c1xIgZcYk7owW8Bcn+PInD3g 8kqiCepj4rV/bNfuWU8InRNgntlKipWXuo+bUrEUfem6nSyFm+yy7nEqRw5IFtNTv1XGos m9iq3bFJTM3cYRU1+/gKJ+8XDS7zMOvw50zP38BCw3L0DWYbAsRO5XYYJbbESGAzOkjQQj Jao4FG0Owbr4+C8DOM0JVp/Ta12wGz9ETACz0PmrEKakfg7IBEOHSzirzYAjwQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T230X5jG7zCmD; Sat, 30 Dec 2023 00:24:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BU0Oi1d009606; Sat, 30 Dec 2023 00:24:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BU0OifH009603; Sat, 30 Dec 2023 00:24:44 GMT (envelope-from git) Date: Sat, 30 Dec 2023 00:24:44 GMT Message-Id: <202312300024.3BU0OifH009603@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 1e9df419f14c - stable/14 - mlx4(5): fix driver initialization List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 1e9df419f14c059aba8d6704256da5c7af4f182a Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1e9df419f14c059aba8d6704256da5c7af4f182a commit 1e9df419f14c059aba8d6704256da5c7af4f182a Author: Yuji Hagiwara AuthorDate: 2023-12-23 20:53:02 +0000 Commit: Konstantin Belousov CommitDate: 2023-12-30 00:24:07 +0000 mlx4(5): fix driver initialization PR: 275897 MFC after: 1 week (cherry picked from commit 553ed8e38bfdd4832deecdec1c0b023824dcff94) --- sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c b/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c index c26afc0099b5..583de1816d1b 100644 --- a/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c +++ b/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c @@ -2293,7 +2293,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, dev_addr[ETHER_ADDR_LEN - 1 - i] = (u8) (priv->mac >> (8 * i)); - ether_ifattach(dev, dev_addr); if_link_state_change(dev, LINK_STATE_DOWN); ifmedia_init(&priv->media, IFM_IMASK | IFM_ETH_FMASK, mlx4_en_media_change, mlx4_en_media_status); @@ -2306,6 +2305,8 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, DEBUGNET_SET(dev, mlx4_en); + ether_ifattach(dev, dev_addr); + en_warn(priv, "Using %d TX rings\n", prof->tx_ring_num); en_warn(priv, "Using %d RX rings\n", prof->rx_ring_num);