From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 01:53:37 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 37A1B4EED89; Mon, 1 Feb 2021 01:53:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DTWFF0sBNz3CmD; Mon, 1 Feb 2021 01:53:37 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1035C13214; Mon, 1 Feb 2021 01:53:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1111rajt051410; Mon, 1 Feb 2021 01:53:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1111ra7U051408; Mon, 1 Feb 2021 01:53:36 GMT (envelope-from git) Date: Mon, 1 Feb 2021 01:53:36 GMT Message-Id: <202102010153.1111ra7U051408@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 3f185aacc58b - stable/13 - Decode NFIT Platform Capabilities. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3f185aacc58bc21fee050c0a5049894ca4967a68 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 01:53:37 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=3f185aacc58bc21fee050c0a5049894ca4967a68 commit 3f185aacc58bc21fee050c0a5049894ca4967a68 Author: Alexander Motin AuthorDate: 2021-01-25 21:08:06 +0000 Commit: Alexander Motin CommitDate: 2021-02-01 01:53:23 +0000 Decode NFIT Platform Capabilities. (cherry picked from commit 1b109c69ed625ebf292c1d16f7a3efcab96722e5) --- usr.sbin/acpi/acpidump/acpi.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/usr.sbin/acpi/acpidump/acpi.c b/usr.sbin/acpi/acpidump/acpi.c index 27fe1de0a219..c573c02b7f92 100644 --- a/usr.sbin/acpi/acpidump/acpi.c +++ b/usr.sbin/acpi/acpidump/acpi.c @@ -1562,7 +1562,8 @@ static const char *nfit_types[] = { [ACPI_NFIT_TYPE_SMBIOS] = "SMBIOS", [ACPI_NFIT_TYPE_CONTROL_REGION] = "Control Region", [ACPI_NFIT_TYPE_DATA_REGION] = "Data Region", - [ACPI_NFIT_TYPE_FLUSH_ADDRESS] = "Flush Address" + [ACPI_NFIT_TYPE_FLUSH_ADDRESS] = "Flush Address", + [ACPI_NFIT_TYPE_CAPABILITIES] = "Platform Capabilities" }; @@ -1579,6 +1580,7 @@ acpi_print_nfit(ACPI_NFIT_HEADER *nfit) ACPI_NFIT_CONTROL_REGION *ctlreg; ACPI_NFIT_DATA_REGION *datareg; ACPI_NFIT_FLUSH_ADDRESS *fladdr; + ACPI_NFIT_CAPABILITIES *caps; if (nfit->Type < nitems(nfit_types)) printf("\tType=%s\n", nfit_types[nfit->Type]); @@ -1709,6 +1711,20 @@ acpi_print_nfit(ACPI_NFIT_HEADER *nfit) printf("\tHintCount=%u\n", (u_int)fladdr->HintCount); /* XXX fladdr->HintAddress[i] output is not supported */ break; + case ACPI_NFIT_TYPE_CAPABILITIES: + caps = (ACPI_NFIT_CAPABILITIES *)nfit; + printf("\tHighestCapability=%u\n", (u_int)caps->HighestCapability); + +#define PRINTFLAG(var, flag) printflag((var), ACPI_NFIT_CAPABILITY_## flag, #flag) + + printf("\tCapabilities="); + PRINTFLAG(caps->Capabilities, CACHE_FLUSH); + PRINTFLAG(caps->Capabilities, MEM_FLUSH); + PRINTFLAG(caps->Capabilities, MEM_MIRRORING); + PRINTFLAG_END(); + +#undef PRINTFLAG + break; } } From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 01:54:06 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2BB8C4EF51A; Mon, 1 Feb 2021 01:54: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 4DTWFp0f1pz3D3p; Mon, 1 Feb 2021 01:54:06 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 08F6612BEE; Mon, 1 Feb 2021 01:54:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1111s5oZ051539; Mon, 1 Feb 2021 01:54:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1111s5Yu051538; Mon, 1 Feb 2021 01:54:05 GMT (envelope-from git) Date: Mon, 1 Feb 2021 01:54:05 GMT Message-Id: <202102010154.1111s5Yu051538@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 0f763fade1af - stable/12 - Decode NFIT Platform Capabilities. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 0f763fade1af150b0c977c3c626fa1c38856956b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 01:54:06 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=0f763fade1af150b0c977c3c626fa1c38856956b commit 0f763fade1af150b0c977c3c626fa1c38856956b Author: Alexander Motin AuthorDate: 2021-01-25 21:08:06 +0000 Commit: Alexander Motin CommitDate: 2021-02-01 01:53:57 +0000 Decode NFIT Platform Capabilities. (cherry picked from commit 1b109c69ed625ebf292c1d16f7a3efcab96722e5) --- usr.sbin/acpi/acpidump/acpi.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/usr.sbin/acpi/acpidump/acpi.c b/usr.sbin/acpi/acpidump/acpi.c index 61bdad11eb17..f0ba4ee73e84 100644 --- a/usr.sbin/acpi/acpidump/acpi.c +++ b/usr.sbin/acpi/acpidump/acpi.c @@ -1556,7 +1556,8 @@ static const char *nfit_types[] = { [ACPI_NFIT_TYPE_SMBIOS] = "SMBIOS", [ACPI_NFIT_TYPE_CONTROL_REGION] = "Control Region", [ACPI_NFIT_TYPE_DATA_REGION] = "Data Region", - [ACPI_NFIT_TYPE_FLUSH_ADDRESS] = "Flush Address" + [ACPI_NFIT_TYPE_FLUSH_ADDRESS] = "Flush Address", + [ACPI_NFIT_TYPE_CAPABILITIES] = "Platform Capabilities" }; @@ -1573,6 +1574,7 @@ acpi_print_nfit(ACPI_NFIT_HEADER *nfit) ACPI_NFIT_CONTROL_REGION *ctlreg; ACPI_NFIT_DATA_REGION *datareg; ACPI_NFIT_FLUSH_ADDRESS *fladdr; + ACPI_NFIT_CAPABILITIES *caps; if (nfit->Type < nitems(nfit_types)) printf("\tType=%s\n", nfit_types[nfit->Type]); @@ -1703,6 +1705,20 @@ acpi_print_nfit(ACPI_NFIT_HEADER *nfit) printf("\tHintCount=%u\n", (u_int)fladdr->HintCount); /* XXX fladdr->HintAddress[i] output is not supported */ break; + case ACPI_NFIT_TYPE_CAPABILITIES: + caps = (ACPI_NFIT_CAPABILITIES *)nfit; + printf("\tHighestCapability=%u\n", (u_int)caps->HighestCapability); + +#define PRINTFLAG(var, flag) printflag((var), ACPI_NFIT_CAPABILITY_## flag, #flag) + + printf("\tCapabilities="); + PRINTFLAG(caps->Capabilities, CACHE_FLUSH); + PRINTFLAG(caps->Capabilities, MEM_FLUSH); + PRINTFLAG(caps->Capabilities, MEM_MIRRORING); + PRINTFLAG_END(); + +#undef PRINTFLAG + break; } } From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 05:43:02 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0C7545238D4; Mon, 1 Feb 2021 05:43: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 4DTcKx70sDz4hkR; Mon, 1 Feb 2021 05:43:01 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E353B1628A; Mon, 1 Feb 2021 05:43:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1115h1IV051348; Mon, 1 Feb 2021 05:43:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1115h1xj051347; Mon, 1 Feb 2021 05:43:01 GMT (envelope-from git) Date: Mon, 1 Feb 2021 05:43:01 GMT Message-Id: <202102010543.1115h1xj051347@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: b06fd805cc87 - stable/13 - tmpfs: push VEXEC check into tmpfs_lookup() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b06fd805cc871cbde03d3ce8310adf09c9d581b4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 05:43:02 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=b06fd805cc871cbde03d3ce8310adf09c9d581b4 commit b06fd805cc871cbde03d3ce8310adf09c9d581b4 Author: Kyle Evans AuthorDate: 2021-01-28 14:27:28 +0000 Commit: Kyle Evans CommitDate: 2021-02-01 05:42:30 +0000 tmpfs: push VEXEC check into tmpfs_lookup() vfs_cache_lookup() has already done the appropriate VEXEC check, therefore we must not re-check in VOP_CACHEDLOOKUP. This fixes O_SEARCH semantics on tmpfs and removes a redundant descent into VOP_ACCESS() in the common case. (cherry picked from commit 0f919ed4ae4df082eefb517afe02752b1790afd3) --- sys/fs/tmpfs/tmpfs_vnops.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 66568e07b4d7..f77692a10690 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -91,14 +91,10 @@ tmpfs_lookup1(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp) struct tmpfs_mount *tm; int error; + /* Caller assumes responsibility for ensuring access (VEXEC). */ dnode = VP_TO_TMPFS_DIR(dvp); *vpp = NULLVP; - /* Check accessibility of requested node as a first step. */ - error = vn_dir_check_exec(dvp, cnp); - if (error != 0) - goto out; - /* We cannot be requesting the parent directory of the root node. */ MPASS(IMPLIES(dnode->tn_type == VDIR && dnode->tn_dir.tn_parent == dnode, @@ -241,8 +237,17 @@ tmpfs_cached_lookup(struct vop_cachedlookup_args *v) static int tmpfs_lookup(struct vop_lookup_args *v) { + struct vnode *dvp = v->a_dvp; + struct vnode **vpp = v->a_vpp; + struct componentname *cnp = v->a_cnp; + int error; - return (tmpfs_lookup1(v->a_dvp, v->a_vpp, v->a_cnp)); + /* Check accessibility of requested node as a first step. */ + error = vn_dir_check_exec(dvp, cnp); + if (error != 0) + return (error); + + return (tmpfs_lookup1(dvp, vpp, cnp)); } static int From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 05:44:31 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5CD37524D23; Mon, 1 Feb 2021 05:44: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 4DTcMg28jFz4j4b; Mon, 1 Feb 2021 05:44:31 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3AE361601B; Mon, 1 Feb 2021 05:44:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1115iVsp051685; Mon, 1 Feb 2021 05:44:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1115iVUO051684; Mon, 1 Feb 2021 05:44:31 GMT (envelope-from git) Date: Mon, 1 Feb 2021 05:44:31 GMT Message-Id: <202102010544.1115iVUO051684@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: d2336460daff - stable/12 - tmpfs: push VEXEC check into tmpfs_lookup() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d2336460daffae7d2cb2344f52054a7a7a0047ad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 05:44:31 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=d2336460daffae7d2cb2344f52054a7a7a0047ad commit d2336460daffae7d2cb2344f52054a7a7a0047ad Author: Kyle Evans AuthorDate: 2021-01-28 14:27:28 +0000 Commit: Kyle Evans CommitDate: 2021-02-01 05:44:09 +0000 tmpfs: push VEXEC check into tmpfs_lookup() vfs_cache_lookup() has already done the appropriate VEXEC check, therefore we must not re-check in VOP_CACHEDLOOKUP. This fixes O_SEARCH semantics on tmpfs and removes a redundant descent into VOP_ACCESS() in the common case. Reported-by: arichardson (via CheriBSD Jenkins CI) (cherry picked from commit 0f919ed4ae4df082eefb517afe02752b1790afd3) --- sys/fs/tmpfs/tmpfs_vnops.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index bfb84c508c78..7df835113397 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -86,14 +86,10 @@ tmpfs_lookup1(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp) struct tmpfs_mount *tm; int error; + /* Caller assumes responsibility for ensuring access (VEXEC). */ dnode = VP_TO_TMPFS_DIR(dvp); *vpp = NULLVP; - /* Check accessibility of requested node as a first step. */ - error = vn_dir_check_exec(dvp, cnp); - if (error != 0) - goto out; - /* We cannot be requesting the parent directory of the root node. */ MPASS(IMPLIES(dnode->tn_type == VDIR && dnode->tn_dir.tn_parent == dnode, @@ -236,8 +232,17 @@ tmpfs_cached_lookup(struct vop_cachedlookup_args *v) static int tmpfs_lookup(struct vop_lookup_args *v) { + struct vnode *dvp = v->a_dvp; + struct vnode **vpp = v->a_vpp; + struct componentname *cnp = v->a_cnp; + int error; - return (tmpfs_lookup1(v->a_dvp, v->a_vpp, v->a_cnp)); + /* Check accessibility of requested node as a first step. */ + error = vn_dir_check_exec(dvp, cnp); + if (error != 0) + return (error); + + return (tmpfs_lookup1(dvp, vpp, cnp)); } static int From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 07:22:57 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F0E7F4F1029; Mon, 1 Feb 2021 07:22: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 4DTfYF6NkMz4sJH; Mon, 1 Feb 2021 07:22:57 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CE552173FD; Mon, 1 Feb 2021 07:22:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1117MvoR081702; Mon, 1 Feb 2021 07:22:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1117MvG4081701; Mon, 1 Feb 2021 07:22:57 GMT (envelope-from git) Date: Mon, 1 Feb 2021 07:22:57 GMT Message-Id: <202102010722.1117MvG4081701@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: b760436e1381 - stable/13 - firmware(9): extend firmware_get() by a "no warn" flag. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b760436e1381bc43368db9252a3da1427c5a4885 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 07:22:58 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=b760436e1381bc43368db9252a3da1427c5a4885 commit b760436e1381bc43368db9252a3da1427c5a4885 Author: Bjoern A. Zeeb AuthorDate: 2021-01-25 22:41:50 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-02-01 07:15:29 +0000 firmware(9): extend firmware_get() by a "no warn" flag. With the upcoming usage from LinuxKPI but also from drivers ported natively we are seeing more probing of various firmware (names). Add the ability to firmware(9) to silence the "firmware image loading/registering errors" by adding a new firmware_get_flags() functions extending firmware_get() and taking a flags argument as firmware_put() already does. Requested-by: zeising (for future LinuxKPI/DRM) Sponsored-by: The FreeBSD Foundation Sponsored-by: Rubicon Communications, LLC ("Netgate") MFC after: 3 days Reviewed-by: markj Differential Revision: https://reviews.freebsd.org/D27413 (cherry picked from commit 6f65b505468aa8cedc57235604bd8df540d42735) --- share/man/man9/firmware.9 | 40 +++++++++++++++++++++++++++++++++------- sys/kern/subr_firmware.c | 45 +++++++++++++++++++++++++++++++-------------- sys/sys/firmware.h | 5 +++++ 3 files changed, 69 insertions(+), 21 deletions(-) diff --git a/share/man/man9/firmware.9 b/share/man/man9/firmware.9 index b0d429573cf6..6d91beb3ddd1 100644 --- a/share/man/man9/firmware.9 +++ b/share/man/man9/firmware.9 @@ -23,13 +23,14 @@ .\" .\" $FreeBSD$ .\" -.Dd March 14, 2019 +.Dd January 27, 2021 .Dt FIRMWARE 9 .Os .Sh NAME .Nm firmware_register , .Nm firmware_unregister , .Nm firmware_get , +.Nm firmware_get_flags , .Nm firmware_put .Nd firmware image loading and management .Sh SYNOPSIS @@ -57,6 +58,8 @@ struct firmware { .Fn firmware_unregister "const char *imagename" .Ft "const struct firmware *" .Fn firmware_get "const char *imagename" +.Ft "const struct firmware *" +.Fn firmware_get_flags "const char *imagename" "uint32_t flags" .Ft void .Fn firmware_put "const struct firmware *fp" "int flags" .Sh DESCRIPTION @@ -97,7 +100,13 @@ by calling the function .Fn firmware_get with the .Nm imagename -they want as an argument. +they want as an argument, or by calling +.Fn firmware_get_flags +with the +.Nm imagename +and +.Nm flags +they want as an arguments. If a matching image is not already registered, the firmware subsystem will try to load it using the mechanisms specified below (typically, a kernel module @@ -134,11 +143,22 @@ if there are no pending references to the image, otherwise it does not unregister the image and returns EBUSY. .Pp .Fn firmware_get -returns the requested firmware image. +and +.Fn firmware_get_flags +return the requested firmware image. +The +.Fa flags +argument may be set to +.Dv FIRMWARE_GET_NOWARN +to indicate that errors on firmware load or registration should +only be logged in case of +.Nm booverbose . If the image is not yet registered with the system, -the function tries to load it. +the functions try to load it. This involves the linker subsystem and disk access, so .Fn firmware_get +or +.Fn firmware_get_flags must not be called with any locks (except for .Va Giant ) . Note also that if the firmware image is loaded from a filesystem @@ -149,9 +169,11 @@ already mounted. .Pp On success, .Fn firmware_get -returns a pointer to the image description and increases the reference count +and +.Fn firmware_get_flags +return a pointer to the image description and increase the reference count for this image. -On failure, the function returns NULL. +On failure, the functions return NULL. .Pp .Fn firmware_put drops a reference to a firmware image. @@ -183,10 +205,12 @@ these images in memory before calling .Pp When .Fn firmware_get +or +.Fn firmware_get_flags does not find the requested image, it tries to load it using one of the available loading mechanisms. At the moment, there is only one, namely -.Nm Loadable kernel modules : +.Nm Loadable kernel modules . .Pp A firmware image named .Nm foo @@ -203,6 +227,8 @@ which on most systems defaults to Note that in case a module contains multiple images, the caller should first request a .Fn firmware_get +or +.Fn firmware_get_flags for the first image contained in the module, followed by requests for the other images. .Sh BUILDING FIRMWARE LOADABLE MODULES diff --git a/sys/kern/subr_firmware.c b/sys/kern/subr_firmware.c index db262c121918..0465f2a88483 100644 --- a/sys/kern/subr_firmware.c +++ b/sys/kern/subr_firmware.c @@ -238,36 +238,42 @@ firmware_unregister(const char *imagename) return (err); } +struct fw_loadimage { + const char *imagename; + uint32_t flags; +}; + static void -loadimage(void *arg, int npending) +loadimage(void *arg, int npending __unused) { - char *imagename = arg; + struct fw_loadimage *fwli = arg; struct priv_fw *fp; linker_file_t result; int error; - error = linker_reference_module(imagename, NULL, &result); + error = linker_reference_module(fwli->imagename, NULL, &result); if (error != 0) { - printf("%s: could not load firmware image, error %d\n", - imagename, error); + if (bootverbose || (fwli->flags & FIRMWARE_GET_NOWARN) == 0) + printf("%s: could not load firmware image, error %d\n", + fwli->imagename, error); mtx_lock(&firmware_mtx); goto done; } mtx_lock(&firmware_mtx); - fp = lookup(imagename); + fp = lookup(fwli->imagename); if (fp == NULL || fp->file != NULL) { mtx_unlock(&firmware_mtx); if (fp == NULL) printf("%s: firmware image loaded, " - "but did not register\n", imagename); - (void) linker_release_module(imagename, NULL, NULL); + "but did not register\n", fwli->imagename); + (void) linker_release_module(fwli->imagename, NULL, NULL); mtx_lock(&firmware_mtx); goto done; } fp->file = result; /* record the module identity */ done: - wakeup_one(imagename); + wakeup_one(arg); mtx_unlock(&firmware_mtx); } @@ -279,7 +285,7 @@ done: * release this reference for the image to be eligible for removal/unload. */ const struct firmware * -firmware_get(const char *imagename) +firmware_get_flags(const char *imagename, uint32_t flags) { struct task fwload_task; struct thread *td; @@ -306,11 +312,15 @@ firmware_get(const char *imagename) * Also we must not hold any mtx's over this call which is problematic. */ if (!cold) { - TASK_INIT(&fwload_task, 0, loadimage, __DECONST(void *, - imagename)); + struct fw_loadimage fwli; + + fwli.imagename = imagename; + fwli.flags = flags; + TASK_INIT(&fwload_task, 0, loadimage, (void *)&fwli); taskqueue_enqueue(firmware_tq, &fwload_task); - msleep(__DECONST(void *, imagename), &firmware_mtx, 0, - "fwload", 0); + PHOLD(curproc); + msleep((void *)&fwli, &firmware_mtx, 0, "fwload", 0); + PRELE(curproc); } /* * After attempting to load the module, see if the image is registered. @@ -328,6 +338,13 @@ found: /* common exit point on success */ return &fp->fw; } +const struct firmware * +firmware_get(const char *imagename) +{ + + return (firmware_get_flags(imagename, 0)); +} + /* * Release a reference to a firmware image returned by firmware_get. * The caller may specify, with the FIRMWARE_UNLOAD flag, its desire diff --git a/sys/sys/firmware.h b/sys/sys/firmware.h index 8a9b2cf23bd7..0d74a749f4fc 100644 --- a/sys/sys/firmware.h +++ b/sys/sys/firmware.h @@ -60,7 +60,12 @@ struct firmware { const struct firmware *firmware_register(const char *, const void *, size_t, unsigned int, const struct firmware *); int firmware_unregister(const char *); + +#define FIRMWARE_GET_NOWARN 0x0001 /* Do not warn if firmware not found. */ +const struct firmware *firmware_get_flags(const char *, uint32_t flags); const struct firmware *firmware_get(const char *); + #define FIRMWARE_UNLOAD 0x0001 /* unload if unreferenced */ void firmware_put(const struct firmware *, int); + #endif /* _SYS_FIRMWARE_H_ */ From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 09:24:43 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CFA084F7B8D; Mon, 1 Feb 2021 09:24:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DTjFl5S6dz50Bd; Mon, 1 Feb 2021 09:24:43 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AD0DD18F0D; Mon, 1 Feb 2021 09:24:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1119Ohj2038626; Mon, 1 Feb 2021 09:24:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1119Oh78038625; Mon, 1 Feb 2021 09:24:43 GMT (envelope-from git) Date: Mon, 1 Feb 2021 09:24:43 GMT Message-Id: <202102010924.1119Oh78038625@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 22aca6726891 - stable/13 - MFC b8051298b0a3: Fix missing value in uar_page field for ratelimit in mlx5en(4). This is a regression issue after the new UAR API was introduced by f8f5b459d21e . MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 22aca672689130e683672e8e9164e24e598fe377 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 09:24:43 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=22aca672689130e683672e8e9164e24e598fe377 commit 22aca672689130e683672e8e9164e24e598fe377 Author: Hans Petter Selasky AuthorDate: 2021-01-26 16:01:34 +0000 Commit: Hans Petter Selasky CommitDate: 2021-02-01 09:23:25 +0000 MFC b8051298b0a3: Fix missing value in uar_page field for ratelimit in mlx5en(4). This is a regression issue after the new UAR API was introduced by f8f5b459d21e . Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit b8051298b0a345ae0bdfcd2ddf89bca1b96c6c2a) --- sys/dev/mlx5/mlx5_en/mlx5_en_rl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c b/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c index 95fb59726e24..33b93b1b5ced 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c @@ -66,6 +66,7 @@ mlx5e_rl_build_cq_param(struct mlx5e_rl_priv_data *rl, MLX5_SET(cqc, cqc, log_cq_size, log_sq_size); MLX5_SET(cqc, cqc, cq_period, rl->param.tx_coalesce_usecs); MLX5_SET(cqc, cqc, cq_max_count, rl->param.tx_coalesce_pkts); + MLX5_SET(cqc, cqc, uar_page, rl->priv->mdev->priv.uar->index); switch (rl->param.tx_coalesce_mode) { case 0: From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 09:26:03 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E2DE64F79BA; Mon, 1 Feb 2021 09:26:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DTjHH4w1Dz50dX; Mon, 1 Feb 2021 09:26:03 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9B49318F84; Mon, 1 Feb 2021 09:26:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1119Q3Jh038932; Mon, 1 Feb 2021 09:26:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1119Q3Hw038931; Mon, 1 Feb 2021 09:26:03 GMT (envelope-from git) Date: Mon, 1 Feb 2021 09:26:03 GMT Message-Id: <202102010926.1119Q3Hw038931@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 6bc1f8425560 - stable/13 - MFC 064009e79462: Add support for enabling and disabling IFCAP_VLAN_HWTSO via ifconfig(8) in mlx5en(4). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6bc1f8425560fa3e2ebc6ac3367967a083ccf6e0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 09:26:03 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=6bc1f8425560fa3e2ebc6ac3367967a083ccf6e0 commit 6bc1f8425560fa3e2ebc6ac3367967a083ccf6e0 Author: Hans Petter Selasky AuthorDate: 2021-01-25 10:22:55 +0000 Commit: Hans Petter Selasky CommitDate: 2021-02-01 09:25:16 +0000 MFC 064009e79462: Add support for enabling and disabling IFCAP_VLAN_HWTSO via ifconfig(8) in mlx5en(4). Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 064009e79462dea517aa7f1a857fb4d5393caa69) --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 0d4028e240ca..023f519f7ced 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -3413,6 +3413,8 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data) ifp->if_capenable ^= IFCAP_TSO6; ifp->if_hwassist ^= CSUM_IP6_TSO; } + if (mask & IFCAP_VLAN_HWTSO) + ifp->if_capenable ^= IFCAP_VLAN_HWTSO; if (mask & IFCAP_VLAN_HWFILTER) { if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) mlx5e_disable_vlan_filter(priv); From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 09:27:32 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D3974F7DBA; Mon, 1 Feb 2021 09:27: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 4DTjK042qrz50l1; Mon, 1 Feb 2021 09:27:32 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7D3A318DAA; Mon, 1 Feb 2021 09:27:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1119RWcl039268; Mon, 1 Feb 2021 09:27:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1119RWEb039267; Mon, 1 Feb 2021 09:27:32 GMT (envelope-from git) Date: Mon, 1 Feb 2021 09:27:32 GMT Message-Id: <202102010927.1119RWEb039267@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 918b98a06129 - stable/12 - MFC 064009e79462: Add support for enabling and disabling IFCAP_VLAN_HWTSO via ifconfig(8) in mlx5en(4). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 918b98a061293dba0efd3ba6524ca6a4a0ef1d2e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 09:27:32 -0000 The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=918b98a061293dba0efd3ba6524ca6a4a0ef1d2e commit 918b98a061293dba0efd3ba6524ca6a4a0ef1d2e Author: Hans Petter Selasky AuthorDate: 2021-01-25 10:22:55 +0000 Commit: Hans Petter Selasky CommitDate: 2021-02-01 09:27:01 +0000 MFC 064009e79462: Add support for enabling and disabling IFCAP_VLAN_HWTSO via ifconfig(8) in mlx5en(4). Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 064009e79462dea517aa7f1a857fb4d5393caa69) --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 79cf9d9b631d..1596ca0fb21a 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -3378,6 +3378,8 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data) ifp->if_capenable ^= IFCAP_TSO6; ifp->if_hwassist ^= CSUM_IP6_TSO; } + if (mask & IFCAP_VLAN_HWTSO) + ifp->if_capenable ^= IFCAP_VLAN_HWTSO; if (mask & IFCAP_VLAN_HWFILTER) { if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) mlx5e_disable_vlan_filter(priv); From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 09:28:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C7A634F81A2; Mon, 1 Feb 2021 09:28:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DTjLR5HvRz50gC; Mon, 1 Feb 2021 09:28:47 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A87D418B53; Mon, 1 Feb 2021 09:28:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1119Sl3X039568; Mon, 1 Feb 2021 09:28:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1119SlTd039567; Mon, 1 Feb 2021 09:28:47 GMT (envelope-from git) Date: Mon, 1 Feb 2021 09:28:47 GMT Message-Id: <202102010928.1119SlTd039567@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 8340ed8900e4 - stable/11 - MFC 064009e79462: Add support for enabling and disabling IFCAP_VLAN_HWTSO via ifconfig(8) in mlx5en(4). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 8340ed8900e4ff48e7a428f30a98c0e91c91da03 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 09:28:47 -0000 The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=8340ed8900e4ff48e7a428f30a98c0e91c91da03 commit 8340ed8900e4ff48e7a428f30a98c0e91c91da03 Author: Hans Petter Selasky AuthorDate: 2021-01-25 10:22:55 +0000 Commit: Hans Petter Selasky CommitDate: 2021-02-01 09:28:13 +0000 MFC 064009e79462: Add support for enabling and disabling IFCAP_VLAN_HWTSO via ifconfig(8) in mlx5en(4). Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 064009e79462dea517aa7f1a857fb4d5393caa69) --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index d1288ddd6f23..7f004ed96c70 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -3233,6 +3233,8 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data) ifp->if_capenable ^= IFCAP_TSO6; ifp->if_hwassist ^= CSUM_IP6_TSO; } + if (mask & IFCAP_VLAN_HWTSO) + ifp->if_capenable ^= IFCAP_VLAN_HWTSO; if (mask & IFCAP_VLAN_HWFILTER) { if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) mlx5e_disable_vlan_filter(priv); From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 09:32:44 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 39BBB4F85DD; Mon, 1 Feb 2021 09: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 4DTjR01Cx4z50w7; Mon, 1 Feb 2021 09:32:44 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1B96718CBE; Mon, 1 Feb 2021 09:32:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1119Wibj051503; Mon, 1 Feb 2021 09:32:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1119Wiob051502; Mon, 1 Feb 2021 09:32:44 GMT (envelope-from git) Date: Mon, 1 Feb 2021 09:32:44 GMT Message-Id: <202102010932.1119Wiob051502@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 671c393854a5 - stable/11 - MFC ea0efc370416: Add support for PL2303HXN to uplcom(4). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 671c393854a5ae60369beadfb74007e240bb18ab Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 09:32:44 -0000 The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=671c393854a5ae60369beadfb74007e240bb18ab commit 671c393854a5ae60369beadfb74007e240bb18ab Author: Hans Petter Selasky AuthorDate: 2021-01-07 14:34:26 +0000 Commit: Hans Petter Selasky CommitDate: 2021-02-01 09:31:58 +0000 MFC ea0efc370416: Add support for PL2303HXN to uplcom(4). Code changes in this commit were obtained from straight from OpenBSD's uplcom.c with almost no modification, the list of chip names and USB IDs was obtained from Linux. Differential Revision: https://reviews.freebsd.org/D27952 Submitted by: tomli_tomli.me (Yifeng Li) Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit ea0efc37041640686fbfb226e80ee60e58cb17f1) --- share/man/man4/uplcom.4 | 4 +- sys/dev/usb/serial/uplcom.c | 94 +++++++++++++++++++++++++++++++++++++++------ sys/dev/usb/usbdevs | 6 +++ 3 files changed, 92 insertions(+), 12 deletions(-) diff --git a/share/man/man4/uplcom.4 b/share/man/man4/uplcom.4 index b3f1fbb3ff18..ca29ee8d454d 100644 --- a/share/man/man4/uplcom.4 +++ b/share/man/man4/uplcom.4 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 26, 2017 +.Dd January 7, 2021 .Dt UPLCOM 4 .Os .Sh NAME @@ -132,6 +132,8 @@ PLANEX USB-RS232 URS-03 .It Prolific Generic USB-Serial Adapters .It +Prolific Generic USB-Serial Adapters (HXN) +.It Prolific Pharos USB-Serial Adapter .It RATOC REX-USB60 diff --git a/sys/dev/usb/serial/uplcom.c b/sys/dev/usb/serial/uplcom.c index 27858af68692..0913cc7890d4 100644 --- a/sys/dev/usb/serial/uplcom.c +++ b/sys/dev/usb/serial/uplcom.c @@ -129,8 +129,13 @@ SYSCTL_INT(_hw_usb_uplcom, OID_AUTO, debug, CTLFLAG_RWTUN, #define UPLCOM_BULK_BUF_SIZE 1024 /* bytes */ #define UPLCOM_SET_REQUEST 0x01 +#define UPLCOM_SET_REQUEST_PL2303HXN 0x80 #define UPLCOM_SET_CRTSCTS 0x41 #define UPLCOM_SET_CRTSCTS_PL2303X 0x61 +#define UPLCOM_SET_CRTSCTS_PL2303HXN 0xFA +#define UPLCOM_CLEAR_CRTSCTS_PL2303HXN 0xFF +#define UPLCOM_CRTSCTS_REG_PL2303HXN 0x0A +#define UPLCOM_STATUS_REG_PL2303HX 0x8080 #define RSAQ_STATUS_CTS 0x80 #define RSAQ_STATUS_OVERRUN_ERROR 0x40 #define RSAQ_STATUS_PARITY_ERROR 0x20 @@ -143,6 +148,7 @@ SYSCTL_INT(_hw_usb_uplcom, OID_AUTO, debug, CTLFLAG_RWTUN, #define TYPE_PL2303 0 #define TYPE_PL2303HX 1 #define TYPE_PL2303HXD 2 +#define TYPE_PL2303HXN 3 #define UPLCOM_STATE_INDEX 8 @@ -286,6 +292,12 @@ static const STRUCT_USB_HOST_ID uplcom_devs[] = { UPLCOM_DEV(PROLIFIC, MOTOROLA), /* Motorola cable */ UPLCOM_DEV(PROLIFIC, PHAROS), /* Prolific Pharos */ UPLCOM_DEV(PROLIFIC, PL2303), /* Generic adapter */ + UPLCOM_DEV(PROLIFIC, PL2303GC), /* Generic adapter (PL2303HXN, type GC) */ + UPLCOM_DEV(PROLIFIC, PL2303GB), /* Generic adapter (PL2303HXN, type GB) */ + UPLCOM_DEV(PROLIFIC, PL2303GT), /* Generic adapter (PL2303HXN, type GT) */ + UPLCOM_DEV(PROLIFIC, PL2303GL), /* Generic adapter (PL2303HXN, type GL) */ + UPLCOM_DEV(PROLIFIC, PL2303GE), /* Generic adapter (PL2303HXN, type GE) */ + UPLCOM_DEV(PROLIFIC, PL2303GS), /* Generic adapter (PL2303HXN, type GS) */ UPLCOM_DEV(PROLIFIC, RSAQ2), /* I/O DATA USB-RSAQ2 */ UPLCOM_DEV(PROLIFIC, RSAQ3), /* I/O DATA USB-RSAQ3 */ UPLCOM_DEV(PROLIFIC, UIC_MSR206), /* UIC MSR206 Card Reader */ @@ -365,6 +377,10 @@ uplcom_attach(device_t dev) struct usb_device_descriptor *dd; int error; + struct usb_device_request req; + usb_error_t err; + uint8_t buf[4]; + DPRINTFN(11, "\n"); device_set_usb_desc(dev); @@ -404,6 +420,25 @@ uplcom_attach(device_t dev) break; } + /* + * The new chip revision PL2303HXN is only compatible with the new + * UPLCOM_SET_REQUEST_PL2303HXN command. Issuing the old command + * UPLCOM_SET_REQUEST to the new chip raises an error. Thus, PL2303HX + * and PL2303HXN can be distinguished by issuing an old-style request + * (on a status register) to the new chip and checking the error. + */ + if (sc->sc_chiptype == TYPE_PL2303HX) { + req.bmRequestType = UT_READ_VENDOR_DEVICE; + req.bRequest = UPLCOM_SET_REQUEST; + USETW(req.wValue, UPLCOM_STATUS_REG_PL2303HX); + req.wIndex[0] = sc->sc_data_iface_no; + req.wIndex[1] = 0; + USETW(req.wLength, 1); + err = usbd_do_request(sc->sc_udev, NULL, &req, buf); + if (err) + sc->sc_chiptype = TYPE_PL2303HXN; + } + switch (sc->sc_chiptype) { case TYPE_PL2303: DPRINTF("chiptype: 2303\n"); @@ -411,6 +446,9 @@ uplcom_attach(device_t dev) case TYPE_PL2303HX: DPRINTF("chiptype: 2303HX/TA\n"); break; + case TYPE_PL2303HXN: + DPRINTF("chiptype: 2303HXN\n"); + break; case TYPE_PL2303HXD: DPRINTF("chiptype: 2303HXD/TB/RA/EA\n"); break; @@ -472,7 +510,8 @@ uplcom_attach(device_t dev) usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_WR]); usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); - } else { + } else if (sc->sc_chiptype == TYPE_PL2303HX || + sc->sc_chiptype == TYPE_PL2303HXD) { /* reset upstream data pipes */ if (uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 8, 0, 0) || @@ -480,6 +519,12 @@ uplcom_attach(device_t dev) UPLCOM_SET_REQUEST, 9, 0, 0)) { goto detach; } + } else if (sc->sc_chiptype == TYPE_PL2303HXN) { + /* reset upstream data pipes */ + if (uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE, + UPLCOM_SET_REQUEST_PL2303HXN, 0x07, 0x03, 0)) { + goto detach; + } } error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, @@ -543,6 +588,11 @@ uplcom_reset(struct uplcom_softc *sc, struct usb_device *udev) { struct usb_device_request req; + if (sc->sc_chiptype == TYPE_PL2303HXN) { + /* PL2303HXN doesn't need this reset sequence */ + return (0); + } + req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = UPLCOM_SET_REQUEST; USETW(req.wValue, 0); @@ -580,6 +630,11 @@ uplcom_pl2303_init(struct usb_device *udev, uint8_t chiptype) { int err; + if (chiptype == TYPE_PL2303HXN) { + /* PL2303HXN doesn't need this initialization sequence */ + return (0); + } + if (uplcom_pl2303_do(udev, UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1) || uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x0404, 0, 0) || uplcom_pl2303_do(udev, UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1) @@ -726,7 +781,7 @@ uplcom_pre_param(struct ucom_softc *ucom, struct termios *t) * * The PL2303 can only set specific baud rates, up to 1228800 baud. * The PL2303HX can set any baud rate up to 6Mb. - * The PL2303HX rev. D can set any baud rate up to 12Mb. + * The PL2303HX rev. D and PL2303HXN can set any baud rate up to 12Mb. * */ @@ -734,6 +789,10 @@ uplcom_pre_param(struct ucom_softc *ucom, struct termios *t) if (t->c_ospeed & 0x80000000) return 0; switch (sc->sc_chiptype) { + case TYPE_PL2303HXN: + if (t->c_ospeed <= 12000000) + return (0); + break; case TYPE_PL2303HXD: if (t->c_ospeed <= 12000000) return (0); @@ -871,21 +930,34 @@ uplcom_cfg_param(struct ucom_softc *ucom, struct termios *t) DPRINTF("crtscts = on\n"); req.bmRequestType = UT_WRITE_VENDOR_DEVICE; - req.bRequest = UPLCOM_SET_REQUEST; - USETW(req.wValue, 0); - if (sc->sc_chiptype != TYPE_PL2303) - USETW(req.wIndex, UPLCOM_SET_CRTSCTS_PL2303X); - else - USETW(req.wIndex, UPLCOM_SET_CRTSCTS); + if (sc->sc_chiptype == TYPE_PL2303HXN) { + req.bRequest = UPLCOM_SET_REQUEST_PL2303HXN; + USETW(req.wValue, UPLCOM_CRTSCTS_REG_PL2303HXN); + USETW(req.wIndex, UPLCOM_SET_CRTSCTS_PL2303HXN); + } else { + req.bRequest = UPLCOM_SET_REQUEST; + USETW(req.wValue, 0); + if (sc->sc_chiptype != TYPE_PL2303) + USETW(req.wIndex, UPLCOM_SET_CRTSCTS_PL2303X); + else + USETW(req.wIndex, UPLCOM_SET_CRTSCTS); + } USETW(req.wLength, 0); ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, &req, NULL, 0, 1000); } else { req.bmRequestType = UT_WRITE_VENDOR_DEVICE; - req.bRequest = UPLCOM_SET_REQUEST; - USETW(req.wValue, 0); - USETW(req.wIndex, 0); + if (sc->sc_chiptype == TYPE_PL2303HXN) { + req.bRequest = UPLCOM_SET_REQUEST_PL2303HXN; + USETW(req.wValue, UPLCOM_CRTSCTS_REG_PL2303HXN); + USETW(req.wIndex, UPLCOM_CLEAR_CRTSCTS_PL2303HXN); + } + else { + req.bRequest = UPLCOM_SET_REQUEST; + USETW(req.wValue, 0); + USETW(req.wIndex, 0); + } USETW(req.wLength, 0); ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, &req, NULL, 0, 1000); diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index 5d52ff0f7217..2bb5e05035f6 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -3654,6 +3654,12 @@ product PROLIFIC MICROMAX_610U 0x0612 Micromax 610U product PROLIFIC DCU11 0x1234 DCU-11 Phone Cable product PROLIFIC UIC_MSR206 0x206a UIC MSR206 Card Reader product PROLIFIC PL2303 0x2303 PL2303 Serial (ATEN/IOGEAR UC232A) +product PROLIFIC PL2303GC 0x23a3 PL2303HXN Serial, type GC +product PROLIFIC PL2303GB 0x23b3 PL2303HXN Serial, type GB +product PROLIFIC PL2303GT 0x23c3 PL2303HXN Serial, type GT +product PROLIFIC PL2303GL 0x23d3 PL2303HXN Serial, type GL +product PROLIFIC PL2303GE 0x23e3 PL2303HXN Serial, type GE +product PROLIFIC PL2303GS 0x23f3 PL2303HXN Serial, type GS product PROLIFIC PL2305 0x2305 Parallel printer product PROLIFIC ATAPI4 0x2307 ATAPI-4 Controller product PROLIFIC PL2501 0x2501 PL2501 Host-Host interface From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:40:31 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 21F2D4FE93E; Mon, 1 Feb 2021 12:40: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 4DTnbg0W5dz3Dms; Mon, 1 Feb 2021 12:40:31 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 043051B68F; Mon, 1 Feb 2021 12:40:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111CeU86094619; Mon, 1 Feb 2021 12:40:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111CeURH094618; Mon, 1 Feb 2021 12:40:30 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:30 GMT Message-Id: <202102011240.111CeURH094618@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: dcee9964238b - stable/13 - cache: add symlink support to lockless lookup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dcee9964238b12a8e55917f292139f074b1a80b2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:40:31 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=dcee9964238b12a8e55917f292139f074b1a80b2 commit dcee9964238b12a8e55917f292139f074b1a80b2 Author: Mateusz Guzik AuthorDate: 2021-01-23 13:40:48 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:37:46 +0000 cache: add symlink support to lockless lookup Reviewed by: kib (previous version) Tested by: pho (previous version) Differential Revision: https://reviews.freebsd.org/D27488 --- sys/fs/deadfs/dead_vnops.c | 1 + sys/kern/vfs_cache.c | 214 ++++++++++++++++++++++++++++++++++++++------- sys/kern/vfs_lookup.c | 11 ++- sys/kern/vfs_subr.c | 13 +++ sys/kern/vnode_if.src | 10 +++ sys/sys/namei.h | 4 +- sys/sys/param.h | 2 +- sys/sys/vnode.h | 9 ++ 8 files changed, 227 insertions(+), 37 deletions(-) diff --git a/sys/fs/deadfs/dead_vnops.c b/sys/fs/deadfs/dead_vnops.c index 49f852791387..09c3c996ee0e 100644 --- a/sys/fs/deadfs/dead_vnops.c +++ b/sys/fs/deadfs/dead_vnops.c @@ -80,6 +80,7 @@ struct vop_vector dead_vnodeops = { .vop_unset_text = dead_unset_text, .vop_write = dead_write, .vop_fplookup_vexec = VOP_EOPNOTSUPP, + .vop_fplookup_symlink = VOP_EAGAIN, }; VFS_VOP_VECTOR_REGISTER(dead_vnodeops); diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index cfa25dc59ee4..770c8ebf061b 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -562,6 +562,36 @@ static uma_zone_t __read_mostly cache_zone_small_ts; static uma_zone_t __read_mostly cache_zone_large; static uma_zone_t __read_mostly cache_zone_large_ts; +char * +cache_symlink_alloc(size_t size, int flags) +{ + + if (size < CACHE_ZONE_SMALL_SIZE) { + return (uma_zalloc_smr(cache_zone_small, flags)); + } + if (size < CACHE_ZONE_LARGE_SIZE) { + return (uma_zalloc_smr(cache_zone_large, flags)); + } + return (NULL); +} + +void +cache_symlink_free(char *string, size_t size) +{ + + MPASS(string != NULL); + + if (size < CACHE_ZONE_SMALL_SIZE) { + uma_zfree_smr(cache_zone_small, string); + return; + } + if (size < CACHE_ZONE_LARGE_SIZE) { + uma_zfree_smr(cache_zone_large, string); + return; + } + __assert_unreachable(); +} + static struct namecache * cache_alloc_uma(int len, bool ts) { @@ -3584,6 +3614,7 @@ cache_fast_lookup_enabled_recalc(void) #ifdef MAC mac_on = mac_vnode_check_lookup_enabled(); + mac_on |= mac_vnode_check_readlink_enabled(); #else mac_on = 0; #endif @@ -3615,6 +3646,7 @@ SYSCTL_PROC(_vfs, OID_AUTO, cache_fast_lookup, CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MP * need restoring in case fast path lookup fails. */ struct nameidata_outer { + size_t ni_pathlen; int cn_flags; }; @@ -3656,8 +3688,10 @@ static bool cache_fplookup_is_mp(struct cache_fpl *fpl); static int cache_fplookup_cross_mount(struct cache_fpl *fpl); static int cache_fplookup_partial_setup(struct cache_fpl *fpl); static int cache_fplookup_skip_slashes(struct cache_fpl *fpl); +static int cache_fplookup_preparse(struct cache_fpl *fpl); static void cache_fpl_pathlen_dec(struct cache_fpl *fpl); static void cache_fpl_pathlen_inc(struct cache_fpl *fpl); +static void cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n); static void cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n); static void @@ -3698,6 +3732,7 @@ static void cache_fpl_checkpoint_outer(struct cache_fpl *fpl) { + fpl->snd_outer.ni_pathlen = fpl->ndp->ni_pathlen; fpl->snd_outer.cn_flags = fpl->ndp->ni_cnd.cn_flags; } @@ -3731,6 +3766,7 @@ cache_fpl_restore_abort(struct cache_fpl *fpl) */ fpl->ndp->ni_resflags = 0; fpl->ndp->ni_cnd.cn_nameptr = fpl->ndp->ni_cnd.cn_pnbuf; + fpl->ndp->ni_pathlen = fpl->snd_outer.ni_pathlen; } #ifdef INVARIANTS @@ -3752,6 +3788,7 @@ cache_fpl_assert_status(struct cache_fpl *fpl) case CACHE_FPL_STATUS_UNSET: __assert_unreachable(); break; + case CACHE_FPL_STATUS_DESTROYED: case CACHE_FPL_STATUS_ABORTED: case CACHE_FPL_STATUS_PARTIAL: case CACHE_FPL_STATUS_HANDLED: @@ -3804,6 +3841,11 @@ cache_fpl_aborted_early_impl(struct cache_fpl *fpl, int line) static int __noinline cache_fpl_aborted_impl(struct cache_fpl *fpl, int line) { + struct nameidata *ndp; + struct componentname *cnp; + + ndp = fpl->ndp; + cnp = fpl->cnp; if (fpl->status != CACHE_FPL_STATUS_UNSET) { KASSERT(fpl->status == CACHE_FPL_STATUS_PARTIAL, @@ -3815,6 +3857,14 @@ cache_fpl_aborted_impl(struct cache_fpl *fpl, int line) if (fpl->in_smr) cache_fpl_smr_exit(fpl); cache_fpl_restore_abort(fpl); + /* + * Resolving symlinks overwrites data passed by the caller. + * Let namei know. + */ + if (ndp->ni_loopcnt > 0) { + fpl->status = CACHE_FPL_STATUS_DESTROYED; + cache_fpl_cleanup_cnp(cnp); + } return (CACHE_FPL_FAILED); } @@ -3955,13 +4005,6 @@ cache_fplookup_dirfd(struct cache_fpl *fpl, struct vnode **vpp) return (0); } -static bool -cache_fplookup_vnode_supported(struct vnode *vp) -{ - - return (vp->v_type != VLNK); -} - static int __noinline cache_fplookup_negative_promote(struct cache_fpl *fpl, struct namecache *oncp, uint32_t hash) @@ -4242,8 +4285,7 @@ cache_fplookup_final_modifying(struct cache_fpl *fpl) * Since we expect this to be the terminal vnode it should * almost never be true. */ - if (__predict_false(!cache_fplookup_vnode_supported(tvp) || - cache_fplookup_is_mp(fpl))) { + if (__predict_false(tvp->v_type == VLNK || cache_fplookup_is_mp(fpl))) { vput(dvp); vput(tvp); return (cache_fpl_aborted(fpl)); @@ -4546,8 +4588,7 @@ cache_fplookup_noentry(struct cache_fpl *fpl) return (cache_fpl_handled(fpl)); } - if (__predict_false(!cache_fplookup_vnode_supported(tvp) || - cache_fplookup_is_mp(fpl))) { + if (__predict_false(tvp->v_type == VLNK || cache_fplookup_is_mp(fpl))) { vput(dvp); vput(tvp); return (cache_fpl_aborted(fpl)); @@ -4688,6 +4729,102 @@ cache_fplookup_neg(struct cache_fpl *fpl, struct namecache *ncp, uint32_t hash) return (cache_fpl_handled_error(fpl, ENOENT)); } +/* + * Resolve a symlink. Called by filesystem-specific routines. + * + * Code flow is: + * ... -> cache_fplookup_symlink -> VOP_FPLOOKUP_SYMLINK -> cache_symlink_resolve + */ +int +cache_symlink_resolve(struct cache_fpl *fpl, const char *string, size_t len) +{ + struct nameidata *ndp; + struct componentname *cnp; + + ndp = fpl->ndp; + cnp = fpl->cnp; + + if (__predict_false(len == 0)) { + return (ENOENT); + } + + ndp->ni_pathlen = fpl->nulchar - cnp->cn_nameptr - cnp->cn_namelen + 1; +#ifdef INVARIANTS + if (ndp->ni_pathlen != fpl->debug.ni_pathlen) { + panic("%s: mismatch (%zu != %zu) nulchar %p nameptr %p [%s] ; full string [%s]\n", + __func__, ndp->ni_pathlen, fpl->debug.ni_pathlen, fpl->nulchar, + cnp->cn_nameptr, cnp->cn_nameptr, cnp->cn_pnbuf); + } +#endif + + if (__predict_false(len + ndp->ni_pathlen > MAXPATHLEN)) { + return (ENAMETOOLONG); + } + + if (__predict_false(ndp->ni_loopcnt++ >= MAXSYMLINKS)) { + return (ELOOP); + } + + if (ndp->ni_pathlen > 1) { + bcopy(ndp->ni_next, cnp->cn_pnbuf + len, ndp->ni_pathlen); + } else { + cnp->cn_pnbuf[len] = '\0'; + } + bcopy(string, cnp->cn_pnbuf, len); + + ndp->ni_pathlen += len; + cache_fpl_pathlen_add(fpl, len); + cnp->cn_nameptr = cnp->cn_pnbuf; + fpl->nulchar = &cnp->cn_nameptr[ndp->ni_pathlen - 1]; + + return (0); +} + +static int __noinline +cache_fplookup_symlink(struct cache_fpl *fpl) +{ + struct nameidata *ndp; + struct componentname *cnp; + struct vnode *dvp, *tvp; + int error; + + ndp = fpl->ndp; + cnp = fpl->cnp; + dvp = fpl->dvp; + tvp = fpl->tvp; + + if (cache_fpl_islastcn(ndp)) { + if ((cnp->cn_flags & FOLLOW) == 0) { + return (cache_fplookup_final(fpl)); + } + } + + error = VOP_FPLOOKUP_SYMLINK(tvp, fpl); + if (__predict_false(error != 0)) { + switch (error) { + case EAGAIN: + return (cache_fpl_partial(fpl)); + case ENOENT: + case ENAMETOOLONG: + case ELOOP: + cache_fpl_smr_exit(fpl); + return (cache_fpl_handled_error(fpl, error)); + default: + return (cache_fpl_aborted(fpl)); + } + } + + if (*(cnp->cn_nameptr) == '/') { + fpl->dvp = cache_fpl_handle_root(fpl); + fpl->dvp_seqc = vn_seqc_read_any(fpl->dvp); + if (seqc_in_modify(fpl->dvp_seqc)) { + return (cache_fpl_aborted(fpl)); + } + } + + return (cache_fplookup_preparse(fpl)); +} + static int cache_fplookup_next(struct cache_fpl *fpl) { @@ -4743,10 +4880,6 @@ cache_fplookup_next(struct cache_fpl *fpl) return (cache_fpl_partial(fpl)); } - if (!cache_fplookup_vnode_supported(tvp)) { - return (cache_fpl_partial(fpl)); - } - counter_u64_add(numposhits, 1); SDT_PROBE3(vfs, namecache, lookup, hit, dvp, ncp->nc_name, tvp); @@ -4931,7 +5064,16 @@ static void cache_fpl_pathlen_inc(struct cache_fpl *fpl) { - fpl->debug.ni_pathlen++; + cache_fpl_pathlen_add(fpl, 1); +} + +static void +cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n) +{ + + fpl->debug.ni_pathlen += n; + KASSERT(fpl->debug.ni_pathlen <= PATH_MAX, + ("%s: pathlen overflow to %zd\n", __func__, fpl->debug.ni_pathlen)); } static void @@ -4953,13 +5095,18 @@ cache_fpl_pathlen_inc(struct cache_fpl *fpl) { } +static void +cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n) +{ +} + static void cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n) { } #endif -static int +static int __always_inline cache_fplookup_preparse(struct cache_fpl *fpl) { struct componentname *cnp; @@ -5238,8 +5385,6 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) return (cache_fpl_aborted(fpl)); } - VNPASS(cache_fplookup_vnode_supported(fpl->dvp), fpl->dvp); - error = cache_fplookup_preparse(fpl); if (__predict_false(cache_fpl_terminated(fpl))) { return (error); @@ -5251,8 +5396,6 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) break; } - VNPASS(cache_fplookup_vnode_supported(fpl->dvp), fpl->dvp); - error = VOP_FPLOOKUP_VEXEC(fpl->dvp, cnp->cn_cred); if (__predict_false(error != 0)) { error = cache_fplookup_failed_vexec(fpl, error); @@ -5266,20 +5409,27 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) VNPASS(!seqc_in_modify(fpl->tvp_seqc), fpl->tvp); - if (cache_fpl_islastcn(ndp)) { - error = cache_fplookup_final(fpl); - break; - } + if (fpl->tvp->v_type == VLNK) { + error = cache_fplookup_symlink(fpl); + if (cache_fpl_terminated(fpl)) { + break; + } + } else { + if (cache_fpl_islastcn(ndp)) { + error = cache_fplookup_final(fpl); + break; + } - if (!vn_seqc_consistent(fpl->dvp, fpl->dvp_seqc)) { - error = cache_fpl_aborted(fpl); - break; - } + if (!vn_seqc_consistent(fpl->dvp, fpl->dvp_seqc)) { + error = cache_fpl_aborted(fpl); + break; + } - fpl->dvp = fpl->tvp; - fpl->dvp_seqc = fpl->tvp_seqc; + fpl->dvp = fpl->tvp; + fpl->dvp_seqc = fpl->tvp_seqc; + cache_fplookup_parse_advance(fpl); + } - cache_fplookup_parse_advance(fpl); cache_fpl_checkpoint(fpl); } diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index b6529623ecbb..ad65ab11bb1d 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -578,6 +578,7 @@ namei(struct nameidata *ndp) ndp->ni_startdir->v_type == VBAD); ndp->ni_lcf = 0; + ndp->ni_loopcnt = 0; ndp->ni_vp = NULL; error = namei_getpath(ndp); @@ -611,8 +612,16 @@ namei(struct nameidata *ndp) TAILQ_INIT(&ndp->ni_cap_tracker); dp = ndp->ni_startdir; break; + case CACHE_FPL_STATUS_DESTROYED: + ndp->ni_loopcnt = 0; + error = namei_getpath(ndp); + if (__predict_false(error != 0)) { + return (error); + } + /* FALLTHROUGH */ case CACHE_FPL_STATUS_ABORTED: TAILQ_INIT(&ndp->ni_cap_tracker); + MPASS(ndp->ni_lcf == 0); error = namei_setup(ndp, &dp, &pwd); if (error != 0) { namei_cleanup_cnp(cnp); @@ -621,8 +630,6 @@ namei(struct nameidata *ndp) break; } - ndp->ni_loopcnt = 0; - /* * Locked lookup. */ diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 8461fd0d49b5..047e4c54f0c5 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -5452,6 +5452,19 @@ vop_fplookup_vexec_debugpost(void *ap __unused, int rc __unused) VFS_SMR_ASSERT_ENTERED(); } +void +vop_fplookup_symlink_debugpre(void *ap __unused) +{ + + VFS_SMR_ASSERT_ENTERED(); +} + +void +vop_fplookup_symlink_debugpost(void *ap __unused, int rc __unused) +{ + + VFS_SMR_ASSERT_ENTERED(); +} void vop_strategy_debugpre(void *ap) { diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src index ed6f3bf9d61b..5d15d4a0c863 100644 --- a/sys/kern/vnode_if.src +++ b/sys/kern/vnode_if.src @@ -156,6 +156,16 @@ vop_fplookup_vexec { }; +%% fplookup_symlink vp - - - +%! fplookup_symlink debugpre vop_fplookup_symlink_debugpre +%! fplookup_symlink debugpost vop_fplookup_symlink_debugpost + +vop_fplookup_symlink { + IN struct vnode *vp; + IN struct cache_fpl *fpl; +}; + + %% access vp L L L vop_access { diff --git a/sys/sys/namei.h b/sys/sys/namei.h index c045bc7c6bc5..1f9bae9e2753 100644 --- a/sys/sys/namei.h +++ b/sys/sys/namei.h @@ -116,8 +116,8 @@ struct nameidata { #ifdef _KERNEL -enum cache_fpl_status { CACHE_FPL_STATUS_ABORTED, CACHE_FPL_STATUS_PARTIAL, - CACHE_FPL_STATUS_HANDLED, CACHE_FPL_STATUS_UNSET }; +enum cache_fpl_status { CACHE_FPL_STATUS_DESTROYED, CACHE_FPL_STATUS_ABORTED, + CACHE_FPL_STATUS_PARTIAL, CACHE_FPL_STATUS_HANDLED, CACHE_FPL_STATUS_UNSET }; int cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, struct pwd **pwdp); diff --git a/sys/sys/param.h b/sys/sys/param.h index 97ec07ed3a4d..afa5d9a2e3a8 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300137 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300138 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 0eadfec02313..ffd0bdad940d 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -66,6 +66,7 @@ enum vgetstate { VGET_NONE, VGET_HOLDCNT, VGET_USECOUNT }; */ struct namecache; +struct cache_fpl; struct vpollinfo { struct mtx vpi_lock; /* lock to protect below */ @@ -646,6 +647,10 @@ void cache_purge(struct vnode *vp); void cache_purge_vgone(struct vnode *vp); void cache_purge_negative(struct vnode *vp); void cache_purgevfs(struct mount *mp); +char *cache_symlink_alloc(size_t size, int flags); +void cache_symlink_free(char *string, size_t size); +int cache_symlink_resolve(struct cache_fpl *fpl, const char *string, + size_t len); void cache_vop_rename(struct vnode *fdvp, struct vnode *fvp, struct vnode *tdvp, struct vnode *tvp, struct componentname *fcnp, struct componentname *tcnp); void cache_vop_rmdir(struct vnode *dvp, struct vnode *vp); @@ -900,6 +905,8 @@ int vop_sigdefer(struct vop_vector *vop, struct vop_generic_args *a); #ifdef DEBUG_VFS_LOCKS void vop_fplookup_vexec_debugpre(void *a); void vop_fplookup_vexec_debugpost(void *a, int rc); +void vop_fplookup_symlink_debugpre(void *a); +void vop_fplookup_symlink_debugpost(void *a, int rc); void vop_strategy_debugpre(void *a); void vop_lock_debugpre(void *a); void vop_lock_debugpost(void *a, int rc); @@ -910,6 +917,8 @@ void vop_mkdir_debugpost(void *a, int rc); #else #define vop_fplookup_vexec_debugpre(x) do { } while (0) #define vop_fplookup_vexec_debugpost(x, y) do { } while (0) +#define vop_fplookup_symlink_debugpre(x) do { } while (0) +#define vop_fplookup_symlink_debugpost(x, y) do { } while (0) #define vop_strategy_debugpre(x) do { } while (0) #define vop_lock_debugpre(x) do { } while (0) #define vop_lock_debugpost(x, y) do { } while (0) From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:40:32 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 549464FE9B6; Mon, 1 Feb 2021 12:40: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 4DTnbh1VNGz3DqJ; Mon, 1 Feb 2021 12:40:32 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 24F001B2A7; Mon, 1 Feb 2021 12:40:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111CeWxS094638; Mon, 1 Feb 2021 12:40:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111CeWnU094637; Mon, 1 Feb 2021 12:40:32 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:32 GMT Message-Id: <202102011240.111CeWnU094637@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: afea6cb020db - stable/13 - ufs: denote lack of support for lockless symlink lookup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: afea6cb020db328a3cd8e6abcc58b1a5f0cb4b31 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:40:32 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=afea6cb020db328a3cd8e6abcc58b1a5f0cb4b31 commit afea6cb020db328a3cd8e6abcc58b1a5f0cb4b31 Author: Mateusz Guzik AuthorDate: 2021-01-23 13:42:16 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:38:23 +0000 ufs: denote lack of support for lockless symlink lookup It is unclear without investigating if it can be provided without using extra memory, so for the time being just don't. (cherry picked from commit c892d60a1d3e11c7e0651705bc4167b218a7415c) --- sys/ufs/ufs/ufs_vnops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index a3f790e16685..0e7ec7ae5453 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -2963,6 +2963,7 @@ struct vop_vector ufs_vnodeops = { .vop_accessx = ufs_accessx, .vop_bmap = ufs_bmap, .vop_fplookup_vexec = ufs_fplookup_vexec, + .vop_fplookup_symlink = VOP_EAGAIN, .vop_cachedlookup = ufs_lookup, .vop_close = ufs_close, .vop_create = ufs_create, From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:40:33 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DF3684FEB80; Mon, 1 Feb 2021 12:40:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-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 4DTnbj3lZJz3Dn1; Mon, 1 Feb 2021 12:40:33 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 53C541B2A8; Mon, 1 Feb 2021 12:40:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111CeXPU094660; Mon, 1 Feb 2021 12:40:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111CeX1m094659; Mon, 1 Feb 2021 12:40:33 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:33 GMT Message-Id: <202102011240.111CeX1m094659@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 080f14904607 - stable/13 - tmpfs: add support for lockless symlink lookup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 080f149046070dfd4c99ea3639634864b02d0f80 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:40:34 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=080f149046070dfd4c99ea3639634864b02d0f80 commit 080f149046070dfd4c99ea3639634864b02d0f80 Author: Mateusz Guzik AuthorDate: 2021-01-23 13:45:01 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:38:23 +0000 tmpfs: add support for lockless symlink lookup Reviewed by: kib (previous version) Tested by: pho (previous version) Differential Revision: https://reviews.freebsd.org/D27488 (cherry picked from commit 618029af508be2c01a84162c1bad02bfd000db27) --- sys/fs/tmpfs/tmpfs.h | 8 ++++++-- sys/fs/tmpfs/tmpfs_subr.c | 50 ++++++++++++++++++++++++++++++++++++++++++---- sys/fs/tmpfs/tmpfs_vnops.c | 30 +++++++++++++++++++++++++++- 3 files changed, 81 insertions(+), 7 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h index 811df5b2936f..28493a550252 100644 --- a/sys/fs/tmpfs/tmpfs.h +++ b/sys/fs/tmpfs/tmpfs.h @@ -277,7 +277,10 @@ struct tmpfs_node { /* Valid when tn_type == VLNK. */ /* The link's target, allocated from a string pool. */ - char * tn_link; /* (c) */ + struct tn_link { + char * tn_link_target; /* (c) */ + char tn_link_smr; /* (c) */ + } tn_link; /* Valid when tn_type == VREG. */ struct tn_reg { @@ -300,7 +303,8 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node); #define tn_rdev tn_spec.tn_rdev #define tn_dir tn_spec.tn_dir -#define tn_link tn_spec.tn_link +#define tn_link_target tn_spec.tn_link.tn_link_target +#define tn_link_smr tn_spec.tn_link.tn_link_smr #define tn_reg tn_spec.tn_reg #define tn_fifo tn_spec.tn_fifo diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index c74981db0f58..07e7ea11ad6e 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -252,6 +252,8 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type, { struct tmpfs_node *nnode; vm_object_t obj; + char *symlink; + char symlink_smr; /* If the root directory of the 'tmp' file system is not yet * allocated, this must be the request to do it. */ @@ -327,9 +329,41 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type, case VLNK: MPASS(strlen(target) < MAXPATHLEN); nnode->tn_size = strlen(target); - nnode->tn_link = malloc(nnode->tn_size, M_TMPFSNAME, - M_WAITOK); - memcpy(nnode->tn_link, target, nnode->tn_size); + + symlink = NULL; + if (!tmp->tm_nonc) { + symlink = cache_symlink_alloc(nnode->tn_size + 1, M_WAITOK); + symlink_smr = true; + } + if (symlink == NULL) { + symlink = malloc(nnode->tn_size + 1, M_TMPFSNAME, M_WAITOK); + symlink_smr = false; + } + memcpy(symlink, target, nnode->tn_size + 1); + + /* + * Allow safe symlink resolving for lockless lookup. + * tmpfs_fplookup_symlink references this comment. + * + * 1. nnode is not yet visible to the world + * 2. both tn_link_target and tn_link_smr get populated + * 3. release fence publishes their content + * 4. tn_link_target content is immutable until node destruction, + * where the pointer gets set to NULL + * 5. tn_link_smr is never changed once set + * + * As a result it is sufficient to issue load consume on the node + * pointer to also get the above content in a stable manner. + * Worst case tn_link_smr flag may be set to true despite being stale, + * while the target buffer is already cleared out. + * + * TODO: Since there is no load consume primitive provided + * right now, the load is performed with an acquire fence. + */ + atomic_store_ptr((uintptr_t *)&nnode->tn_link_target, + (uintptr_t)symlink); + atomic_store_char((char *)&nnode->tn_link_smr, symlink_smr); + atomic_thread_fence_rel(); break; case VREG: @@ -382,6 +416,7 @@ tmpfs_free_node_locked(struct tmpfs_mount *tmp, struct tmpfs_node *node, bool detach) { vm_object_t uobj; + char *symlink; bool last; TMPFS_MP_ASSERT_LOCKED(tmp); @@ -417,7 +452,14 @@ tmpfs_free_node_locked(struct tmpfs_mount *tmp, struct tmpfs_node *node, break; case VLNK: - free(node->tn_link, M_TMPFSNAME); + symlink = node->tn_link_target; + atomic_store_ptr((uintptr_t *)&node->tn_link_target, + (uintptr_t)NULL); + if (atomic_load_char(&node->tn_link_smr)) { + cache_symlink_free(symlink, node->tn_size + 1); + } else { + free(symlink, M_TMPFSNAME); + } break; case VREG: diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index f77692a10690..bc4caa4adecb 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -1449,13 +1449,40 @@ tmpfs_readlink(struct vop_readlink_args *v) node = VP_TO_TMPFS_NODE(vp); - error = uiomove(node->tn_link, MIN(node->tn_size, uio->uio_resid), + error = uiomove(node->tn_link_target, MIN(node->tn_size, uio->uio_resid), uio); tmpfs_set_accessed(VFS_TO_TMPFS(vp->v_mount), node); return (error); } +/* + * VOP_FPLOOKUP_SYMLINK routines are subject to special circumstances, see + * the comment above cache_fplookup for details. + * + * Check tmpfs_alloc_node for tmpfs-specific synchronisation notes. + */ +static int +tmpfs_fplookup_symlink(struct vop_fplookup_symlink_args *v) +{ + struct vnode *vp; + struct tmpfs_node *node; + char *symlink; + + vp = v->a_vp; + node = VP_TO_TMPFS_NODE_SMR(vp); + atomic_thread_fence_acq(); + if (__predict_false(node == NULL)) + return (EAGAIN); + if (!atomic_load_char(&node->tn_link_smr)) + return (EAGAIN); + symlink = atomic_load_ptr(&node->tn_link_target); + if (symlink == NULL) + return (EAGAIN); + + return (cache_symlink_resolve(v->a_fpl, symlink, node->tn_size)); +} + static int tmpfs_inactive(struct vop_inactive_args *v) { @@ -1812,6 +1839,7 @@ struct vop_vector tmpfs_vnodeop_entries = { .vop_open = tmpfs_open, .vop_close = tmpfs_close, .vop_fplookup_vexec = tmpfs_fplookup_vexec, + .vop_fplookup_symlink = tmpfs_fplookup_symlink, .vop_access = tmpfs_access, .vop_stat = tmpfs_stat, .vop_getattr = tmpfs_getattr, From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:40:34 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 94A9D4FEB82; Mon, 1 Feb 2021 12:40: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 4DTnbk3hLSz3DqY; Mon, 1 Feb 2021 12:40:34 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 6DB9F1B692; Mon, 1 Feb 2021 12:40:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111CeYV9094682; Mon, 1 Feb 2021 12:40:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111CeYhH094681; Mon, 1 Feb 2021 12:40:34 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:34 GMT Message-Id: <202102011240.111CeYhH094681@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: c5fcd06736f9 - stable/13 - zfs: add support for lockless symlink lookup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c5fcd06736f93ab6dd7b93d54dbeae68ae06ed7b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:40:34 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=c5fcd06736f93ab6dd7b93d54dbeae68ae06ed7b commit c5fcd06736f93ab6dd7b93d54dbeae68ae06ed7b Author: Mateusz Guzik AuthorDate: 2021-01-23 13:46:32 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:15 +0000 zfs: add support for lockless symlink lookup Reviewed by: kib (previous version) Tested by: pho (previous version) Differential Revision: https://reviews.freebsd.org/D27488 (cherry picked from commit 3110d4ebd6c0848cf5e25890d01791bb407e2a9b) --- .../include/os/freebsd/zfs/sys/zfs_znode_impl.h | 1 + .../openzfs/module/os/freebsd/zfs/zfs_vnops_os.c | 73 +++++++++++++++++++++- .../openzfs/module/os/freebsd/zfs/zfs_znode.c | 7 +++ 3 files changed, 78 insertions(+), 3 deletions(-) diff --git a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h index ac2625d9a8ab..091186f23174 100644 --- a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h +++ b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h @@ -53,6 +53,7 @@ extern "C" { #define ZNODE_OS_FIELDS \ struct zfsvfs *z_zfsvfs; \ vnode_t *z_vnode; \ + char *z_cached_symlink; \ uint64_t z_uid; \ uint64_t z_gid; \ uint64_t z_gen; \ diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c index 2e8eadb5e16e..1ee0895625a6 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c @@ -4463,6 +4463,29 @@ zfs_freebsd_fplookup_vexec(struct vop_fplookup_vexec_args *v) } #endif +static int +zfs_freebsd_fplookup_symlink(struct vop_fplookup_symlink_args *v) +{ + vnode_t *vp; + znode_t *zp; + char *target; + + vp = v->a_vp; + zp = VTOZ_SMR(vp); + if (__predict_false(zp == NULL)) { + return (EAGAIN); + } + + /* + * FIXME: Load consume would be sufficient but there is no primitive to do it. + */ + target = (char *)atomic_load_acq_ptr((uintptr_t *)&zp->z_cached_symlink); + if (target == NULL) { + return (EAGAIN); + } + return (cache_symlink_resolve(v->a_fpl, target, strlen(target))); +} + #ifndef _SYS_SYSPROTO_H_ struct vop_access_args { struct vnode *a_vp; @@ -4949,6 +4972,8 @@ zfs_freebsd_symlink(struct vop_symlink_args *ap) struct componentname *cnp = ap->a_cnp; vattr_t *vap = ap->a_vap; znode_t *zp = NULL; + char *symlink; + size_t symlink_len; int rc; ASSERT(cnp->cn_flags & SAVENAME); @@ -4959,8 +4984,19 @@ zfs_freebsd_symlink(struct vop_symlink_args *ap) rc = zfs_symlink(VTOZ(ap->a_dvp), cnp->cn_nameptr, vap, ap->a_target, &zp, cnp->cn_cred, 0 /* flags */); - if (rc == 0) + if (rc == 0) { *ap->a_vpp = ZTOV(zp); + ASSERT_VOP_ELOCKED(ZTOV(zp), __func__); + MPASS(zp->z_cached_symlink == NULL); + symlink_len = strlen(ap->a_target); + symlink = cache_symlink_alloc(symlink_len + 1, M_WAITOK); + if (symlink != NULL) { + memcpy(symlink, ap->a_target, symlink_len); + symlink[symlink_len] = '\0'; + atomic_store_rel_ptr((uintptr_t *)&zp->z_cached_symlink, + (uintptr_t)symlink); + } + } return (rc); } @@ -4975,8 +5011,36 @@ struct vop_readlink_args { static int zfs_freebsd_readlink(struct vop_readlink_args *ap) { - - return (zfs_readlink(ap->a_vp, ap->a_uio, ap->a_cred, NULL)); + znode_t *zp = VTOZ(ap->a_vp); + struct uio *auio; + char *symlink, *base; + size_t symlink_len; + int error; + bool trycache; + + auio = ap->a_uio; + trycache = false; + if (auio->uio_segflg == UIO_SYSSPACE && auio->uio_iovcnt == 1) { + base = auio->uio_iov->iov_base; + symlink_len = auio->uio_iov->iov_len; + trycache = true; + } + error = zfs_readlink(ap->a_vp, auio, ap->a_cred, NULL); + if (atomic_load_ptr(&zp->z_cached_symlink) != NULL || + error != 0 || !trycache) { + return (error); + } + symlink_len -= auio->uio_resid; + symlink = cache_symlink_alloc(symlink_len + 1, M_WAITOK); + if (symlink != NULL) { + memcpy(symlink, base, symlink_len); + symlink[symlink_len] = '\0'; + if (!atomic_cmpset_rel_ptr((uintptr_t *)&zp->z_cached_symlink, + (uintptr_t)NULL, (uintptr_t)symlink)) { + cache_symlink_free(symlink, symlink_len + 1); + } + } + return (error); } #ifndef _SYS_SYSPROTO_H_ @@ -5734,6 +5798,7 @@ struct vop_vector zfs_vnodeops = { #if __FreeBSD_version >= 1300102 .vop_fplookup_vexec = zfs_freebsd_fplookup_vexec, #endif + .vop_fplookup_symlink = zfs_freebsd_fplookup_symlink, .vop_access = zfs_freebsd_access, .vop_allocate = VOP_EINVAL, .vop_lookup = zfs_cache_lookup, @@ -5783,6 +5848,7 @@ struct vop_vector zfs_fifoops = { #if __FreeBSD_version >= 1300102 .vop_fplookup_vexec = zfs_freebsd_fplookup_vexec, #endif + .vop_fplookup_symlink = zfs_freebsd_fplookup_symlink, .vop_access = zfs_freebsd_access, .vop_getattr = zfs_freebsd_getattr, .vop_inactive = zfs_freebsd_inactive, @@ -5806,6 +5872,7 @@ struct vop_vector zfs_shareops = { #if __FreeBSD_version >= 1300121 .vop_fplookup_vexec = VOP_EAGAIN, #endif + .vop_fplookup_symlink = VOP_EAGAIN, .vop_access = zfs_freebsd_access, .vop_inactive = zfs_freebsd_inactive, .vop_reclaim = zfs_freebsd_reclaim, diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c index 6a21623c5f67..f9a0820eda2d 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c @@ -444,6 +444,7 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_buf_t *db, int blksz, zp->z_blksz = blksz; zp->z_seq = 0x7A4653; zp->z_sync_cnt = 0; + atomic_store_ptr((uintptr_t *)&zp->z_cached_symlink, (uintptr_t)NULL); vp = ZTOV(zp); @@ -1237,6 +1238,7 @@ void zfs_znode_free(znode_t *zp) { zfsvfs_t *zfsvfs = zp->z_zfsvfs; + char *symlink; ASSERT(zp->z_sa_hdl == NULL); zp->z_vnode = NULL; @@ -1245,6 +1247,11 @@ zfs_znode_free(znode_t *zp) list_remove(&zfsvfs->z_all_znodes, zp); zfsvfs->z_nr_znodes--; mutex_exit(&zfsvfs->z_znodes_lock); + symlink = atomic_load_ptr(&zp->z_cached_symlink); + if (symlink != NULL) { + atomic_store_rel_ptr((uintptr_t *)&zp->z_cached_symlink, (uintptr_t)NULL); + cache_symlink_free(symlink, strlen(symlink) + 1); + } if (zp->z_acl_cached) { zfs_acl_free(zp->z_acl_cached); From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:40:35 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C45C64FE8DE; Mon, 1 Feb 2021 12:40:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DTnbl4xfmz3DwB; Mon, 1 Feb 2021 12:40:35 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 97F651B693; Mon, 1 Feb 2021 12:40:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111CeZUN094700; Mon, 1 Feb 2021 12:40:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111CeZjh094699; Mon, 1 Feb 2021 12:40:35 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:35 GMT Message-Id: <202102011240.111CeZjh094699@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: ba0689009b71 - stable/13 - cache: add back target entry on rename MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ba0689009b712c558f4ec2b28202a4e45c5bab91 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:40:35 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=ba0689009b712c558f4ec2b28202a4e45c5bab91 commit ba0689009b712c558f4ec2b28202a4e45c5bab91 Author: Mateusz Guzik AuthorDate: 2021-01-23 17:21:42 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:15 +0000 cache: add back target entry on rename (cherry picked from commit 02ec31bdf60fa3a8530544cb3c8c4ec1df6cde0d) --- sys/kern/vfs_cache.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 770c8ebf061b..03bafc75acaa 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -367,6 +367,10 @@ static bool __read_frequently cache_fast_revlookup = true; SYSCTL_BOOL(_vfs, OID_AUTO, cache_fast_revlookup, CTLFLAG_RW, &cache_fast_revlookup, 0, ""); +static bool __read_mostly cache_rename_add = true; +SYSCTL_BOOL(_vfs, OID_AUTO, cache_rename_add, CTLFLAG_RW, + &cache_rename_add, 0, ""); + static u_int __exclusive_cache_line neg_cycle; #define ncneghash 3 @@ -2731,6 +2735,21 @@ cache_vop_rename(struct vnode *fdvp, struct vnode *fvp, struct vnode *tdvp, } else { cache_remove_cnp(tdvp, tcnp); } + + /* + * TODO + * + * Historically renaming was always purging all revelang entries, + * but that's quite wasteful. In particular turns out that in many cases + * the target file is immediately accessed after rename, inducing a cache + * miss. + * + * Recode this to reduce relocking and reuse the existing entry (if any) + * instead of just removing it above and allocating a new one here. + */ + if (cache_rename_add) { + cache_enter(tdvp, fvp, tcnp); + } } void From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:40:37 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 913CB4FE7D8; Mon, 1 Feb 2021 12:40:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DTnbn0TQlz3DlN; Mon, 1 Feb 2021 12:40:36 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AC5E81B705; Mon, 1 Feb 2021 12:40:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111CeajD094722; Mon, 1 Feb 2021 12:40:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111CeaUS094721; Mon, 1 Feb 2021 12:40:36 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:36 GMT Message-Id: <202102011240.111CeaUS094721@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 996912046b4d - stable/13 - libc: skip spurious stat in _gettemp MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 996912046b4d7188636cc4da6a3808010862e93e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:40:37 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=996912046b4d7188636cc4da6a3808010862e93e commit 996912046b4d7188636cc4da6a3808010862e93e Author: Mateusz Guzik AuthorDate: 2021-01-24 04:15:13 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:15 +0000 libc: skip spurious stat in _gettemp It was only done to catch ENOTDIR, but the kernel already returns the error where appropriate. (cherry picked from commit 97a463120bf99819fcb21a781e410fb43dde2a43) --- lib/libc/stdio/mktemp.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/lib/libc/stdio/mktemp.c b/lib/libc/stdio/mktemp.c index f08d92cc3ec7..f64eda748d0b 100644 --- a/lib/libc/stdio/mktemp.c +++ b/lib/libc/stdio/mktemp.c @@ -121,7 +121,6 @@ _gettemp(int dfd, char *path, int *doopen, int domkdir, int slen, int oflags) char *start, *trv, *suffp, *carryp; char *pad; struct stat sbuf; - int rval; uint32_t rand; char carrybuf[MAXPATHLEN]; @@ -156,26 +155,6 @@ _gettemp(int dfd, char *path, int *doopen, int domkdir, int slen, int oflags) /* save first combination of random characters */ memcpy(carrybuf, start, suffp - start); - /* - * check the target directory. - */ - if (doopen != NULL || domkdir) { - for (; trv > path; --trv) { - if (*trv == '/') { - *trv = '\0'; - rval = fstatat(dfd, path, &sbuf, 0); - *trv = '/'; - if (rval != 0) - return (0); - if (!S_ISDIR(sbuf.st_mode)) { - errno = ENOTDIR; - return (0); - } - break; - } - } - } - oflags |= O_CREAT | O_EXCL | O_RDWR; for (;;) { if (doopen) { From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:40:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 958424FEA40; Mon, 1 Feb 2021 12:40: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 4DTnbp18Byz3Dqw; Mon, 1 Feb 2021 12:40:38 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CA3DB1B628; Mon, 1 Feb 2021 12:40:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111Cebtm094744; Mon, 1 Feb 2021 12:40:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111CebIU094743; Mon, 1 Feb 2021 12:40:37 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:37 GMT Message-Id: <202102011240.111CebIU094743@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 410994f46335 - stable/13 - libc: remove open-coded strlen in _gettemp MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 410994f463351fe2899af77c797dd61c772b02cf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:40:39 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=410994f463351fe2899af77c797dd61c772b02cf commit 410994f463351fe2899af77c797dd61c772b02cf Author: Mateusz Guzik AuthorDate: 2021-01-24 04:32:46 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:15 +0000 libc: remove open-coded strlen in _gettemp (cherry picked from commit 6fe328ace8f418bab0ab7f78c6fa1f2e757dd8a9) --- lib/libc/stdio/mktemp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/libc/stdio/mktemp.c b/lib/libc/stdio/mktemp.c index f64eda748d0b..c47e0221e5cd 100644 --- a/lib/libc/stdio/mktemp.c +++ b/lib/libc/stdio/mktemp.c @@ -131,8 +131,7 @@ _gettemp(int dfd, char *path, int *doopen, int domkdir, int slen, int oflags) return (0); } - for (trv = path; *trv != '\0'; ++trv) - ; + trv = path + strlen(path); if (trv - path >= MAXPATHLEN) { errno = ENAMETOOLONG; return (0); From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:40:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D8914FEABF; Mon, 1 Feb 2021 12:40: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 4DTnbs0Qkmz3F02; Mon, 1 Feb 2021 12:40:40 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0E9B11B165; Mon, 1 Feb 2021 12:40:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111CedVV094784; Mon, 1 Feb 2021 12:40:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111CedgR094783; Mon, 1 Feb 2021 12:40:39 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:39 GMT Message-Id: <202102011240.111CedgR094783@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: c700b1babaa8 - stable/13 - cache: track calls to cache_symlink_alloc with unsupported size MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c700b1babaa874dc6327dd62e80c96b34109c6eb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:40:41 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=c700b1babaa874dc6327dd62e80c96b34109c6eb commit c700b1babaa874dc6327dd62e80c96b34109c6eb Author: Mateusz Guzik AuthorDate: 2021-01-24 20:00:03 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:15 +0000 cache: track calls to cache_symlink_alloc with unsupported size While here assert on size passed to free. (cherry picked from commit 1c7a65adb002cf96bda1f72d9a26dd4237368263) --- sys/kern/vfs_cache.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 03bafc75acaa..9d3b935a3047 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -122,6 +122,7 @@ SDT_PROBE_DEFINE2(vfs, namecache, zap_negative, done, "struct vnode *", "char *"); SDT_PROBE_DEFINE2(vfs, namecache, evict_negative, done, "struct vnode *", "char *"); +SDT_PROBE_DEFINE1(vfs, namecache, symlink, alloc__fail, "size_t"); SDT_PROBE_DEFINE3(vfs, fplookup, lookup, done, "struct nameidata", "int", "bool"); SDT_PROBE_DECLARE(vfs, namei, lookup, entry); @@ -477,6 +478,7 @@ STATNODE_COUNTER(fullpathfail2, numfullpathfail2, "Number of fullpath search errors (VOP_VPTOCNP failures)"); STATNODE_COUNTER(fullpathfail4, numfullpathfail4, "Number of fullpath search errors (ENOMEM)"); STATNODE_COUNTER(fullpathfound, numfullpathfound, "Number of successful fullpath calls"); +STATNODE_COUNTER(symlinktoobig, symlinktoobig, "Number of times symlink did not fit the cache"); /* * Debug or developer statistics. @@ -576,6 +578,8 @@ cache_symlink_alloc(size_t size, int flags) if (size < CACHE_ZONE_LARGE_SIZE) { return (uma_zalloc_smr(cache_zone_large, flags)); } + counter_u64_add(symlinktoobig, 1); + SDT_PROBE1(vfs, namecache, symlink, alloc__fail, size); return (NULL); } @@ -584,6 +588,8 @@ cache_symlink_free(char *string, size_t size) { MPASS(string != NULL); + KASSERT(size < CACHE_ZONE_LARGE_SIZE, + ("%s: size %zu too big", __func__, size)); if (size < CACHE_ZONE_SMALL_SIZE) { uma_zfree_smr(cache_zone_small, string); From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:40:40 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E3514FEA41; Mon, 1 Feb 2021 12:40: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 4DTnbq6pKDz3DtD; Mon, 1 Feb 2021 12:40:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EB3641B629; Mon, 1 Feb 2021 12:40:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111CecXu094762; Mon, 1 Feb 2021 12:40:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111CecuM094761; Mon, 1 Feb 2021 12:40:38 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:38 GMT Message-Id: <202102011240.111CecuM094761@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 3eae6412b50b - stable/13 - libc: try to skip memcpy in _gettemp MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3eae6412b50bbcfe1a7affc26202dc896aedd1ab Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:40:40 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=3eae6412b50bbcfe1a7affc26202dc896aedd1ab commit 3eae6412b50bbcfe1a7affc26202dc896aedd1ab Author: Mateusz Guzik AuthorDate: 2021-01-24 04:34:22 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:15 +0000 libc: try to skip memcpy in _gettemp (cherry picked from commit b22fdf45ff8ef1d1f9a6c28f1d7f59ca4b012da6) --- lib/libc/stdio/mktemp.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/libc/stdio/mktemp.c b/lib/libc/stdio/mktemp.c index c47e0221e5cd..0ede3058a3d5 100644 --- a/lib/libc/stdio/mktemp.c +++ b/lib/libc/stdio/mktemp.c @@ -123,6 +123,7 @@ _gettemp(int dfd, char *path, int *doopen, int domkdir, int slen, int oflags) struct stat sbuf; uint32_t rand; char carrybuf[MAXPATHLEN]; + int saved; if ((doopen != NULL && domkdir) || slen < 0 || (oflags & ~(O_APPEND | O_DIRECT | O_SHLOCK | O_EXLOCK | O_SYNC | @@ -151,9 +152,7 @@ _gettemp(int dfd, char *path, int *doopen, int domkdir, int slen, int oflags) } start = trv + 1; - /* save first combination of random characters */ - memcpy(carrybuf, start, suffp - start); - + saved = 0; oflags |= O_CREAT | O_EXCL | O_RDWR; for (;;) { if (doopen) { @@ -170,6 +169,12 @@ _gettemp(int dfd, char *path, int *doopen, int domkdir, int slen, int oflags) } else if (lstat(path, &sbuf)) return (errno == ENOENT); + /* save first combination of random characters */ + if (!saved) { + memcpy(carrybuf, start, suffp - start); + saved = 1; + } + /* If we have a collision, cycle through the space of filenames */ for (trv = start, carryp = carrybuf;;) { /* have we tried all possible permutations? */ From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:40:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A028B4FEAC3; Mon, 1 Feb 2021 12:40: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 4DTnbv1qJ5z3Dwq; Mon, 1 Feb 2021 12:40:42 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 597EA1B707; Mon, 1 Feb 2021 12:40:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111Cegaj094824; Mon, 1 Feb 2021 12:40:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111Cegkr094823; Mon, 1 Feb 2021 12:40:42 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:42 GMT Message-Id: <202102011240.111Cegkr094823@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: dde453cf7d3a - stable/13 - zfs: fix panics with invariant kernels from zfs_replay_setattr MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dde453cf7d3a272ee9319ba6d9e27d34e6b6da6f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:40:45 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=dde453cf7d3a272ee9319ba6d9e27d34e6b6da6f commit dde453cf7d3a272ee9319ba6d9e27d34e6b6da6f Author: Mateusz Guzik AuthorDate: 2021-01-25 21:28:05 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:16 +0000 zfs: fix panics with invariant kernels from zfs_replay_setattr (cherry picked from commit f40d6217f20d69427b58d82ce4e29d88bf4dfbd6) --- sys/contrib/openzfs/module/zfs/zfs_replay.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/contrib/openzfs/module/zfs/zfs_replay.c b/sys/contrib/openzfs/module/zfs/zfs_replay.c index cba5e8c9cd0b..53c7dbd5df43 100644 --- a/sys/contrib/openzfs/module/zfs/zfs_replay.c +++ b/sys/contrib/openzfs/module/zfs/zfs_replay.c @@ -859,7 +859,12 @@ zfs_replay_setattr(void *arg1, void *arg2, boolean_t byteswap) zfsvfs->z_fuid_replay = zfs_replay_fuid_domain(start, &start, lr->lr_uid, lr->lr_gid); + /* + * Satisfy assertions. + */ + vn_seqc_write_begin(ZTOV(zp)); error = zfs_setattr(zp, vap, 0, kcred); + vn_seqc_write_end(ZTOV(zp)); zfs_fuid_info_free(zfsvfs->z_fuid_replay); zfsvfs->z_fuid_replay = NULL; From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:40:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C75EC4FEB48; Mon, 1 Feb 2021 12:40: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 4DTnbv0j98z3DtP; Mon, 1 Feb 2021 12:40:42 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3A1D01B706; Mon, 1 Feb 2021 12:40:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111CefXX094806; Mon, 1 Feb 2021 12:40:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111Cefa0094805; Mon, 1 Feb 2021 12:40:41 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:41 GMT Message-Id: <202102011240.111Cefa0094805@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: aa411f6ba17b - stable/13 - cache: assorted cleanups MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: aa411f6ba17b91af720129bd7593df4c7093f8a4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:40:46 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=aa411f6ba17b91af720129bd7593df4c7093f8a4 commit aa411f6ba17b91af720129bd7593df4c7093f8a4 Author: Mateusz Guzik AuthorDate: 2021-01-24 20:04:01 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:15 +0000 cache: assorted cleanups (cherry picked from commit 868643e7229b7959024880cda396fef87602b948) --- sys/kern/vfs_cache.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 9d3b935a3047..e3098ac7c5d5 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -5079,54 +5079,54 @@ cache_fplookup_is_mp(struct cache_fpl *fpl) */ #ifdef INVARIANTS static void -cache_fpl_pathlen_dec(struct cache_fpl *fpl) +cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n) { - cache_fpl_pathlen_sub(fpl, 1); + fpl->debug.ni_pathlen += n; + KASSERT(fpl->debug.ni_pathlen <= PATH_MAX, + ("%s: pathlen overflow to %zd\n", __func__, fpl->debug.ni_pathlen)); } static void -cache_fpl_pathlen_inc(struct cache_fpl *fpl) +cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n) { - cache_fpl_pathlen_add(fpl, 1); + fpl->debug.ni_pathlen -= n; + KASSERT(fpl->debug.ni_pathlen <= PATH_MAX, + ("%s: pathlen underflow to %zd\n", __func__, fpl->debug.ni_pathlen)); } static void -cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n) +cache_fpl_pathlen_inc(struct cache_fpl *fpl) { - fpl->debug.ni_pathlen += n; - KASSERT(fpl->debug.ni_pathlen <= PATH_MAX, - ("%s: pathlen overflow to %zd\n", __func__, fpl->debug.ni_pathlen)); + cache_fpl_pathlen_add(fpl, 1); } static void -cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n) +cache_fpl_pathlen_dec(struct cache_fpl *fpl) { - fpl->debug.ni_pathlen -= n; - KASSERT(fpl->debug.ni_pathlen <= PATH_MAX, - ("%s: pathlen underflow to %zd\n", __func__, fpl->debug.ni_pathlen)); + cache_fpl_pathlen_sub(fpl, 1); } #else -static void __always_inline -cache_fpl_pathlen_dec(struct cache_fpl *fpl) +static void +cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n) { } -static void __always_inline -cache_fpl_pathlen_inc(struct cache_fpl *fpl) +static void +cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n) { } static void -cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n) +cache_fpl_pathlen_inc(struct cache_fpl *fpl) { } static void -cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n) +cache_fpl_pathlen_dec(struct cache_fpl *fpl) { } #endif @@ -5258,7 +5258,7 @@ cache_fplookup_parse_advance(struct cache_fpl *fpl) * * Lockless lookup tries to elide checking for spurious slashes and should they * be present is guaranteed to fail to find an entry. In this case the caller - * must check if the name starts with a slash and this call routine. It is + * must check if the name starts with a slash and call this routine. It is * going to fast forward across the spurious slashes and set the state up for * retry. */ @@ -5342,11 +5342,13 @@ cache_fplookup_failed_vexec(struct cache_fpl *fpl, int error) * Hack: handle O_SEARCH. * * Open Group Base Specifications Issue 7, 2018 edition states: + * * If the access mode of the open file description associated with the * file descriptor is not O_SEARCH, the function shall check whether * directory searches are permitted using the current permissions of * the directory underlying the file descriptor. If the access mode is * O_SEARCH, the function shall not perform the check. + * * * Regular lookup tests for the NOEXECCHECK flag for every path * component to decide whether to do the permission check. However, From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:40:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 652E04FE970; Mon, 1 Feb 2021 12:40:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DTnbz1tTNz3F0R; Mon, 1 Feb 2021 12:40:47 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 797271B696; Mon, 1 Feb 2021 12:40:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111Cehi2094846; Mon, 1 Feb 2021 12:40:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111CehGE094845; Mon, 1 Feb 2021 12:40:43 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:43 GMT Message-Id: <202102011240.111CehGE094845@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: e92ab3adf4f9 - stable/13 - atomic: make atomic_store_ptr type-aware MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e92ab3adf4f9848933439c9c2fca36df290c0884 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:40:47 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=e92ab3adf4f9848933439c9c2fca36df290c0884 commit e92ab3adf4f9848933439c9c2fca36df290c0884 Author: Mateusz Guzik AuthorDate: 2021-01-25 19:39:14 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:16 +0000 atomic: make atomic_store_ptr type-aware (cherry picked from commit cc96f92a570e05636a20fdd15d4616b127bb9ecc) --- sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c | 2 +- sys/fs/tmpfs/tmpfs_subr.c | 6 ++---- sys/sys/_cscan_atomic.h | 5 ++++- sys/sys/atomic_common.h | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c index f9a0820eda2d..d9f2635b0129 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c @@ -444,7 +444,7 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_buf_t *db, int blksz, zp->z_blksz = blksz; zp->z_seq = 0x7A4653; zp->z_sync_cnt = 0; - atomic_store_ptr((uintptr_t *)&zp->z_cached_symlink, (uintptr_t)NULL); + atomic_store_ptr(&zp->z_cached_symlink, NULL); vp = ZTOV(zp); diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 07e7ea11ad6e..3b3581fc81f6 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -360,8 +360,7 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type, * TODO: Since there is no load consume primitive provided * right now, the load is performed with an acquire fence. */ - atomic_store_ptr((uintptr_t *)&nnode->tn_link_target, - (uintptr_t)symlink); + atomic_store_ptr(&nnode->tn_link_target, symlink); atomic_store_char((char *)&nnode->tn_link_smr, symlink_smr); atomic_thread_fence_rel(); break; @@ -453,8 +452,7 @@ tmpfs_free_node_locked(struct tmpfs_mount *tmp, struct tmpfs_node *node, case VLNK: symlink = node->tn_link_target; - atomic_store_ptr((uintptr_t *)&node->tn_link_target, - (uintptr_t)NULL); + atomic_store_ptr(&node->tn_link_target, NULL); if (atomic_load_char(&node->tn_link_smr)) { cache_symlink_free(symlink, node->tn_size + 1); } else { diff --git a/sys/sys/_cscan_atomic.h b/sys/sys/_cscan_atomic.h index 19c05b179940..3bd9455102b1 100644 --- a/sys/sys/_cscan_atomic.h +++ b/sys/sys/_cscan_atomic.h @@ -243,7 +243,10 @@ void kcsan_atomic_thread_fence_seq_cst(void); #define atomic_subtract_ptr kcsan_atomic_subtract_ptr #define atomic_subtract_acq_ptr kcsan_atomic_subtract_acq_ptr #define atomic_subtract_rel_ptr kcsan_atomic_subtract_rel_ptr -#define atomic_store_ptr kcsan_atomic_store_ptr +#define atomic_store_ptr(x, v) ({ \ + __typeof(*x) __value = (v); \ + kcsan_atomic_store_ptr((volatile uintptr_t *)(x), (uintptr_t)(__value));\ +}) #define atomic_store_rel_ptr kcsan_atomic_store_rel_ptr #define atomic_swap_ptr kcsan_atomic_swap_ptr #define atomic_testandclear_ptr kcsan_atomic_testandclear_ptr diff --git a/sys/sys/atomic_common.h b/sys/sys/atomic_common.h index a3548977b940..4c29d132c369 100644 --- a/sys/sys/atomic_common.h +++ b/sys/sys/atomic_common.h @@ -58,7 +58,7 @@ #define atomic_store_long(p, v) \ (*(volatile u_long *)(p) = (u_long)(v)) #define atomic_store_ptr(p, v) \ - (*(volatile uintptr_t *)(p) = (uintptr_t)(v)) + (*(volatile __typeof(*p) *)(p) = (v)) #define atomic_store_8(p, v) \ (*(volatile uint8_t *)(p) = (uint8_t)(v)) #define atomic_store_16(p, v) \ From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:40:49 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B0524FEC39; Mon, 1 Feb 2021 12:40:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DTnc05kqnz3DrT; Mon, 1 Feb 2021 12:40:48 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 973541B439; Mon, 1 Feb 2021 12:40:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111CeiEe094868; Mon, 1 Feb 2021 12:40:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111CeiX9094867; Mon, 1 Feb 2021 12:40:44 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:44 GMT Message-Id: <202102011240.111CeiX9094867@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: fc301c224b27 - stable/13 - atomic: add stub atomic_load_consume_ptr MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fc301c224b272a522bff817e12fcbf99a7a17330 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:40:49 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=fc301c224b272a522bff817e12fcbf99a7a17330 commit fc301c224b272a522bff817e12fcbf99a7a17330 Author: Mateusz Guzik AuthorDate: 2021-01-25 20:09:41 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:16 +0000 atomic: add stub atomic_load_consume_ptr (cherry picked from commit 054ce2b0371042c0dbc4b3ab1d7e7795ad75d51e) --- sys/sys/_cscan_atomic.h | 5 +++++ sys/sys/atomic_common.h | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/sys/sys/_cscan_atomic.h b/sys/sys/_cscan_atomic.h index 3bd9455102b1..aed96580e1e4 100644 --- a/sys/sys/_cscan_atomic.h +++ b/sys/sys/_cscan_atomic.h @@ -236,6 +236,11 @@ void kcsan_atomic_thread_fence_seq_cst(void); __retptr; \ }) #define atomic_load_acq_ptr kcsan_atomic_load_acq_ptr +#define atomic_load_consume_ptr(x) ({ \ + __typeof(*x) __retptr; \ + __retptr = (void *)kcsan_atomic_load_acq_ptr((volatile uintptr_t *)(x));\ + __retptr; \ +}) #define atomic_readandclear_ptr kcsan_atomic_readandclear_ptr #define atomic_set_ptr kcsan_atomic_set_ptr #define atomic_set_acq_ptr kcsan_atomic_set_acq_ptr diff --git a/sys/sys/atomic_common.h b/sys/sys/atomic_common.h index 4c29d132c369..48f0a8b8939c 100644 --- a/sys/sys/atomic_common.h +++ b/sys/sys/atomic_common.h @@ -70,4 +70,12 @@ (*(volatile uint64_t *)(p) = (uint64_t)(v)) #endif +/* + * Currently all architectures provide acquire and release fences on their own, + * but they don't provide consume. Kludge below allows relevant code to stop + * openly resorting to the stronger acquire fence, to be sorted out. + */ +#define atomic_load_consume_ptr(p) \ + ((__typeof(*p)) atomic_load_acq_ptr((uintptr_t *)p)) + #endif From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:40:51 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F39514FEB54; Mon, 1 Feb 2021 12:40:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DTnc252WFz3DxQ; Mon, 1 Feb 2021 12:40:50 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A81231B697; Mon, 1 Feb 2021 12:40:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111CejES095329; Mon, 1 Feb 2021 12:40:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111CejdM095316; Mon, 1 Feb 2021 12:40:45 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:45 GMT Message-Id: <202102011240.111CejdM095316@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: e8d3e3884569 - stable/13 - vfs: use atomic_load_consume_ptr in vn_load_v_data_smr MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e8d3e38845697ae831a472870d0bddd991e9041b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:40:51 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=e8d3e38845697ae831a472870d0bddd991e9041b commit e8d3e38845697ae831a472870d0bddd991e9041b Author: Mateusz Guzik AuthorDate: 2021-01-25 20:19:08 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:16 +0000 vfs: use atomic_load_consume_ptr in vn_load_v_data_smr (cherry picked from commit 8d2a230e996c8aec2ec4883d45f7ac38070bd38f) --- sys/sys/vnode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index ffd0bdad940d..78fbec1bd0ba 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -1112,7 +1112,7 @@ int vn_dir_check_exec(struct vnode *vp, struct componentname *cnp); struct vnode *_vp = (vp); \ \ VFS_SMR_ASSERT_ENTERED(); \ - atomic_load_ptr(&(_vp)->v_data); \ + atomic_load_consume_ptr(&(_vp)->v_data);\ }) #endif /* _KERNEL */ From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:40:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AEC734FEC96; Mon, 1 Feb 2021 12:40: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 4DTnc50sn9z3Dry; Mon, 1 Feb 2021 12:40:53 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1CDD11B43B; Mon, 1 Feb 2021 12:40:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111CeniH097298; Mon, 1 Feb 2021 12:40:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111Cengc097297; Mon, 1 Feb 2021 12:40:49 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:49 GMT Message-Id: <202102011240.111Cengc097297@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 8a44ccd05889 - stable/13 - cache: store vnodes in local vars in cache_zap_locked MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8a44ccd0588966b5687c30644e83ab1eef9683e3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:40:54 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=8a44ccd0588966b5687c30644e83ab1eef9683e3 commit 8a44ccd0588966b5687c30644e83ab1eef9683e3 Author: Mateusz Guzik AuthorDate: 2021-01-23 19:41:40 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:16 +0000 cache: store vnodes in local vars in cache_zap_locked (cherry picked from commit ffcf8f97f8a8fb92689793003acabc0a2fe97af4) --- sys/kern/vfs_cache.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index e3098ac7c5d5..9d5b18aa4132 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -1422,10 +1422,14 @@ static void cache_zap_locked(struct namecache *ncp) { struct nchashhead *ncpp; + struct vnode *dvp, *vp; + + dvp = ncp->nc_dvp; + vp = ncp->nc_vp; if (!(ncp->nc_flag & NCF_NEGATIVE)) - cache_assert_vnode_locked(ncp->nc_vp); - cache_assert_vnode_locked(ncp->nc_dvp); + cache_assert_vnode_locked(vp); + cache_assert_vnode_locked(dvp); cache_assert_bucket_locked(ncp); cache_ncp_invalidate(ncp); @@ -1433,28 +1437,26 @@ cache_zap_locked(struct namecache *ncp) ncpp = NCP2BUCKET(ncp); CK_SLIST_REMOVE(ncpp, ncp, namecache, nc_hash); if (!(ncp->nc_flag & NCF_NEGATIVE)) { - SDT_PROBE3(vfs, namecache, zap, done, ncp->nc_dvp, - ncp->nc_name, ncp->nc_vp); - TAILQ_REMOVE(&ncp->nc_vp->v_cache_dst, ncp, nc_dst); - if (ncp == ncp->nc_vp->v_cache_dd) { - vn_seqc_write_begin_unheld(ncp->nc_vp); - ncp->nc_vp->v_cache_dd = NULL; - vn_seqc_write_end(ncp->nc_vp); + SDT_PROBE3(vfs, namecache, zap, done, dvp, ncp->nc_name, vp); + TAILQ_REMOVE(&vp->v_cache_dst, ncp, nc_dst); + if (ncp == vp->v_cache_dd) { + vn_seqc_write_begin_unheld(vp); + vp->v_cache_dd = NULL; + vn_seqc_write_end(vp); } } else { - SDT_PROBE2(vfs, namecache, zap_negative, done, ncp->nc_dvp, - ncp->nc_name); + SDT_PROBE2(vfs, namecache, zap_negative, done, dvp, ncp->nc_name); cache_neg_remove(ncp); } if (ncp->nc_flag & NCF_ISDOTDOT) { - if (ncp == ncp->nc_dvp->v_cache_dd) { - vn_seqc_write_begin_unheld(ncp->nc_dvp); - ncp->nc_dvp->v_cache_dd = NULL; - vn_seqc_write_end(ncp->nc_dvp); + if (ncp == dvp->v_cache_dd) { + vn_seqc_write_begin_unheld(dvp); + dvp->v_cache_dd = NULL; + vn_seqc_write_end(dvp); } } else { LIST_REMOVE(ncp, nc_src); - if (LIST_EMPTY(&ncp->nc_dvp->v_cache_src)) { + if (LIST_EMPTY(&dvp->v_cache_src)) { ncp->nc_flag |= NCF_DVDROP; } } From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:40:57 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 57E5D4FEA4E; Mon, 1 Feb 2021 12:40: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 4DTnc90MtWz3DpW; Mon, 1 Feb 2021 12:40:56 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 857871B69D; Mon, 1 Feb 2021 12:40:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111CeqMu097360; Mon, 1 Feb 2021 12:40:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111CeqCR097359; Mon, 1 Feb 2021 12:40:52 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:52 GMT Message-Id: <202102011240.111CeqCR097359@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 1f28a3afe4d2 - stable/13 - cache: change ->v_cache_dd synchronisation rules MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1f28a3afe4d227e1f401ea37c97a134eeff1b376 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:40:57 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=1f28a3afe4d227e1f401ea37c97a134eeff1b376 commit 1f28a3afe4d227e1f401ea37c97a134eeff1b376 Author: Mateusz Guzik AuthorDate: 2021-01-25 20:49:09 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:17 +0000 cache: change ->v_cache_dd synchronisation rules Instead of resorting to seqc modification take advantage of immutability of entries and check if the entry still matches after everything got prepared. (cherry picked from commit e7cf562a40fc093df054bd7fa6f34746069a984a) --- sys/kern/vfs_cache.c | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index fad7ce91ef44..a73e4843b5f3 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -1440,9 +1440,7 @@ cache_zap_locked(struct namecache *ncp) SDT_PROBE3(vfs, namecache, zap, done, dvp, ncp->nc_name, vp); TAILQ_REMOVE(&vp->v_cache_dst, ncp, nc_dst); if (ncp == vp->v_cache_dd) { - vn_seqc_write_begin_unheld(vp); atomic_store_ptr(&vp->v_cache_dd, NULL); - vn_seqc_write_end(vp); } } else { SDT_PROBE2(vfs, namecache, zap_negative, done, dvp, ncp->nc_name); @@ -1450,9 +1448,7 @@ cache_zap_locked(struct namecache *ncp) } if (ncp->nc_flag & NCF_ISDOTDOT) { if (ncp == dvp->v_cache_dd) { - vn_seqc_write_begin_unheld(dvp); atomic_store_ptr(&dvp->v_cache_dd, NULL); - vn_seqc_write_end(dvp); } } else { LIST_REMOVE(ncp, nc_src); @@ -1627,9 +1623,7 @@ retry_dotdot: mtx_unlock(dvlp2); cache_free(ncp); } else { - vn_seqc_write_begin(dvp); atomic_store_ptr(&dvp->v_cache_dd, NULL); - vn_seqc_write_end(dvp); mtx_unlock(dvlp); if (dvlp2 != NULL) mtx_unlock(dvlp2); @@ -2246,7 +2240,6 @@ cache_enter_dotdot_prep(struct vnode *dvp, struct vnode *vp, cache_celockstate_init(&cel); hash = cache_get_hash(cnp->cn_nameptr, len, dvp); cache_enter_lock_dd(&cel, dvp, vp, hash); - vn_seqc_write_begin(dvp); ncp = dvp->v_cache_dd; if (ncp != NULL && (ncp->nc_flag & NCF_ISDOTDOT)) { KASSERT(ncp->nc_dvp == dvp, ("wrong isdotdot parent")); @@ -2255,7 +2248,6 @@ cache_enter_dotdot_prep(struct vnode *dvp, struct vnode *vp, ncp = NULL; } atomic_store_ptr(&dvp->v_cache_dd, NULL); - vn_seqc_write_end(dvp); cache_enter_unlock(&cel); if (ncp != NULL) cache_free(ncp); @@ -2392,9 +2384,8 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, struct componentname *cnp, goto out_unlock_free; KASSERT(vp == NULL || vp->v_type == VDIR, ("wrong vnode type %p", vp)); - vn_seqc_write_begin(dvp); + atomic_thread_fence_rel(); atomic_store_ptr(&dvp->v_cache_dd, ncp); - vn_seqc_write_end(dvp); } if (vp != NULL) { @@ -2404,20 +2395,17 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, struct componentname *cnp, * directory name in it and the name ".." for the * directory's parent. */ - vn_seqc_write_begin(vp); if ((ndd = vp->v_cache_dd) != NULL) { if ((ndd->nc_flag & NCF_ISDOTDOT) != 0) cache_zap_locked(ndd); else ndd = NULL; } + atomic_thread_fence_rel(); atomic_store_ptr(&vp->v_cache_dd, ncp); - vn_seqc_write_end(vp); } else if (vp->v_type != VDIR) { if (vp->v_cache_dd != NULL) { - vn_seqc_write_begin(vp); atomic_store_ptr(&vp->v_cache_dd, NULL); - vn_seqc_write_end(vp); } } } @@ -3301,10 +3289,6 @@ vn_fullpath_any_smr(struct vnode *vp, struct vnode *rdir, char *buf, cache_rev_failed(&reason); goto out_abort; } - if (!cache_ncp_canuse(ncp)) { - cache_rev_failed(&reason); - goto out_abort; - } if (ncp->nc_nlen >= *buflen) { cache_rev_failed(&reason); error = ENOMEM; @@ -3324,6 +3308,17 @@ vn_fullpath_any_smr(struct vnode *vp, struct vnode *rdir, char *buf, cache_rev_failed(&reason); goto out_abort; } + /* + * Acquire fence provided by vn_seqc_read_any above. + */ + if (__predict_false(atomic_load_ptr(&vp->v_cache_dd) != ncp)) { + cache_rev_failed(&reason); + goto out_abort; + } + if (!cache_ncp_canuse(ncp)) { + cache_rev_failed(&reason); + goto out_abort; + } vp = tvp; vp_seqc = tvp_seqc; if (vp == rdir || vp == rootvnode) @@ -4719,15 +4714,22 @@ cache_fplookup_dotdot(struct cache_fpl *fpl) fpl->tvp = ncp->nc_dvp; } - if (!cache_ncp_canuse(ncp)) { - return (cache_fpl_aborted(fpl)); - } - fpl->tvp_seqc = vn_seqc_read_any(fpl->tvp); if (seqc_in_modify(fpl->tvp_seqc)) { return (cache_fpl_partial(fpl)); } + /* + * Acquire fence provided by vn_seqc_read_any above. + */ + if (__predict_false(atomic_load_ptr(&dvp->v_cache_dd) != ncp)) { + return (cache_fpl_aborted(fpl)); + } + + if (!cache_ncp_canuse(ncp)) { + return (cache_fpl_aborted(fpl)); + } + counter_u64_add(dotdothits, 1); return (0); } From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:40:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 253604FE9EF; Mon, 1 Feb 2021 12:40: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 4DTncB1Vp7z3Dy2; Mon, 1 Feb 2021 12:40:58 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AB09B1B16B; Mon, 1 Feb 2021 12:40:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111Cerrf097378; Mon, 1 Feb 2021 12:40:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111Cer6L097377; Mon, 1 Feb 2021 12:40:53 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:53 GMT Message-Id: <202102011240.111Cer6L097377@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 51927c36b8a9 - stable/13 - cache: convert cache_fplookup_parse to void now that it always succeeds MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 51927c36b8a9d789534258bfd94e0018ee96381f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:40:59 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=51927c36b8a9d789534258bfd94e0018ee96381f commit 51927c36b8a9d789534258bfd94e0018ee96381f Author: Mateusz Guzik AuthorDate: 2021-01-26 00:40:47 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:17 +0000 cache: convert cache_fplookup_parse to void now that it always succeeds (cherry picked from commit 6943671b481e571f2f1ffbe407a4d75241d1174e) --- sys/kern/vfs_cache.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index a73e4843b5f3..72669449c26a 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -5178,7 +5178,7 @@ cache_fplookup_preparse(struct cache_fpl *fpl) return (0); } -static int +static void cache_fplookup_parse(struct cache_fpl *fpl) { struct nameidata *ndp; @@ -5241,7 +5241,6 @@ cache_fplookup_parse(struct cache_fpl *fpl) panic("%s: ran into degenerate name from [%s]\n", __func__, cnp->cn_pnbuf); } #endif - return (0); } static void @@ -5426,10 +5425,7 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) } for (;;) { - error = cache_fplookup_parse(fpl); - if (__predict_false(error != 0)) { - break; - } + cache_fplookup_parse(fpl); error = VOP_FPLOOKUP_VEXEC(fpl->dvp, cnp->cn_cred); if (__predict_false(error != 0)) { From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:40:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D492D4FEBB2; Mon, 1 Feb 2021 12:40: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 4DTncB5flgz3F1X; Mon, 1 Feb 2021 12:40:58 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C11A81B43E; Mon, 1 Feb 2021 12:40:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111CesrK097400; Mon, 1 Feb 2021 12:40:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111Cesrp097399; Mon, 1 Feb 2021 12:40:54 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:54 GMT Message-Id: <202102011240.111Cesrp097399@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 82efef21d051 - stable/13 - cache: stop referring to removing entries as invalidating them MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 82efef21d051796c97796f85ff3fda76104bedb7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:41:00 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=82efef21d051796c97796f85ff3fda76104bedb7 commit 82efef21d051796c97796f85ff3fda76104bedb7 Author: Mateusz Guzik AuthorDate: 2021-01-26 20:31:16 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:17 +0000 cache: stop referring to removing entries as invalidating them Said use is a remnant from the old code and clashes with the NCF_INVALID flag. (cherry picked from commit a51eca7936db50a57d2324d945c3be715df749cd) --- sys/kern/vfs_cache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 72669449c26a..4e2cfa9edf53 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -2597,7 +2597,7 @@ cache_changesize(u_long newmaxvnodes) } /* - * Invalidate all entries from and to a particular vnode. + * Remove all entries from and to a particular vnode. */ static void cache_purge_impl(struct vnode *vp) @@ -2688,7 +2688,7 @@ cache_purge_vgone(struct vnode *vp) } /* - * Invalidate all negative entries for a particular directory vnode. + * Remove all negative entries for a particular directory vnode. */ void cache_purge_negative(struct vnode *vp) From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:41:03 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 53E654FEC7C; Mon, 1 Feb 2021 12:41:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DTncG2dCtz3F1q; Mon, 1 Feb 2021 12:41:02 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0EC631B440; Mon, 1 Feb 2021 12:40:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111CeuaR097440; Mon, 1 Feb 2021 12:40:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111Ceuew097439; Mon, 1 Feb 2021 12:40:56 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:56 GMT Message-Id: <202102011240.111Ceuew097439@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: dcba4f2b4380 - stable/13 - conf/kern.mk: save some work by using realpath instead of cd ; pwd MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dcba4f2b43809023a9ffb25080fb68c21e53e5df Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:41:04 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=dcba4f2b43809023a9ffb25080fb68c21e53e5df commit dcba4f2b43809023a9ffb25080fb68c21e53e5df Author: Mateusz Guzik AuthorDate: 2021-01-27 12:25:21 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:17 +0000 conf/kern.mk: save some work by using realpath instead of cd ; pwd I did not check if the entire ordeal can be avoided in the first place. (cherry picked from commit bcb7f57aa22757dd0206e88894bc003a93d0c351) --- sys/conf/kmod.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk index c245f447cefb..c0d4441af029 100644 --- a/sys/conf/kmod.mk +++ b/sys/conf/kmod.mk @@ -309,7 +309,7 @@ ${_ILINKS}: *) \ path=${SYSDIR}/${.TARGET:T}/include ;; \ esac ; \ - path=`(cd $$path && /bin/pwd)` ; \ + path=`realpath $$path`; \ ${ECHO} ${.TARGET:T} "->" $$path ; \ ln -fns $$path ${.TARGET:T} From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:41:05 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A1C64FEC7D; Mon, 1 Feb 2021 12:41:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DTncJ1jMCz3F9q; Mon, 1 Feb 2021 12:41:04 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 47C351B635; Mon, 1 Feb 2021 12:40:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111Cexvh098337; Mon, 1 Feb 2021 12:40:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111CextL098336; Mon, 1 Feb 2021 12:40:59 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:59 GMT Message-Id: <202102011240.111CextL098336@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 569ac576088b - stable/13 - cache: add missing MNT_NOSYMFOLLOW check to symlink traversal MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 569ac576088bdb44856d5992ecdc647483b0970b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:41:05 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=569ac576088bdb44856d5992ecdc647483b0970b commit 569ac576088bdb44856d5992ecdc647483b0970b Author: Mateusz Guzik AuthorDate: 2021-01-27 14:59:53 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:18 +0000 cache: add missing MNT_NOSYMFOLLOW check to symlink traversal (cherry picked from commit 5c325977b1138828367f39a3f2034af24c3654f0) --- sys/kern/vfs_cache.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index be06a2edc58b..ff8aad14001b 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -4816,6 +4816,7 @@ cache_symlink_resolve(struct cache_fpl *fpl, const char *string, size_t len) static int __noinline cache_fplookup_symlink(struct cache_fpl *fpl) { + struct mount *mp; struct nameidata *ndp; struct componentname *cnp; struct vnode *dvp, *tvp; @@ -4832,6 +4833,20 @@ cache_fplookup_symlink(struct cache_fpl *fpl) } } + mp = atomic_load_ptr(&dvp->v_mount); + if (__predict_false(mp == NULL)) { + return (cache_fpl_aborted(fpl)); + } + + /* + * Note this check races against setting the flag just like regular + * lookup. + */ + if (__predict_false((mp->mnt_flag & MNT_NOSYMFOLLOW) != 0)) { + cache_fpl_smr_exit(fpl); + return (cache_fpl_handled_error(fpl, EACCES)); + } + error = VOP_FPLOOKUP_SYMLINK(tvp, fpl); if (__predict_false(error != 0)) { switch (error) { From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:41:05 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 391674FEA5B; Mon, 1 Feb 2021 12:41:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DTncJ5mKDz3DvW; Mon, 1 Feb 2021 12:41:04 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 6D1591B170; Mon, 1 Feb 2021 12:41:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111Cf0cS098357; Mon, 1 Feb 2021 12:41:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111Cf0mm098356; Mon, 1 Feb 2021 12:41:00 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:41:00 GMT Message-Id: <202102011241.111Cf0mm098356@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 1077e49657fa - stable/13 - fd: add fget_only_user MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1077e49657faaae1477a31fd534375e113df2bd4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:41:05 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=1077e49657faaae1477a31fd534375e113df2bd4 commit 1077e49657faaae1477a31fd534375e113df2bd4 Author: Mateusz Guzik AuthorDate: 2021-01-28 23:27:44 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:18 +0000 fd: add fget_only_user This can be used by single-threaded processes which don't share a file descriptor table to access their file objects without having to reference them. For example select consumers tend to match the requirement and have several file descriptors to inspect. (cherry picked from commit eaad8d1303da500ed691bd774742a4555a05e729) --- sys/kern/kern_descrip.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++--- sys/sys/filedesc.h | 12 +++++++++ 2 files changed, 79 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 257b1de2a6ac..059e5123c7b5 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1860,10 +1860,14 @@ fdgrowtable(struct filedesc *fdp, int nfd) * which must not be freed. */ if (onfiles > NDFILE) { - if (curproc->p_numthreads == 1 && - refcount_load(&fdp->fd_refcnt) == 1) + /* + * Note we may be called here from fdinit while allocating a + * table for a new process in which case ->p_fd points + * elsewhere. + */ + if (curproc->p_fd != fdp || FILEDESC_IS_ONLY_USER(fdp)) { free(otable, M_FILEDESC); - else { + } else { ft = (struct freetable *)&otable->fdt_ofiles[onfiles]; fdp0 = (struct filedesc0 *)fdp; ft->ft_table = otable; @@ -3176,6 +3180,66 @@ out_fallback: return (fget_unlocked_seq(fdp, fd, needrightsp, fpp, NULL)); } +/* + * Translate fd -> file when the caller guarantees the file descriptor table + * can't be changed by others. + * + * Note this does not mean the file object itself is only visible to the caller, + * merely that it wont disappear without having to be referenced. + * + * Must be paired with fput_only_user. + */ +#ifdef CAPABILITIES +int +fget_only_user(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, + struct file **fpp) +{ + const struct filedescent *fde; + const struct fdescenttbl *fdt; + const cap_rights_t *haverights; + struct file *fp; + int error; + + MPASS(FILEDESC_IS_ONLY_USER(fdp)); + + if (__predict_false(fd >= fdp->fd_nfiles)) + return (EBADF); + + fdt = fdp->fd_files; + fde = &fdt->fdt_ofiles[fd]; + fp = fde->fde_file; + if (__predict_false(fp == NULL)) + return (EBADF); + MPASS(refcount_load(&fp->f_count) > 0); + haverights = cap_rights_fde_inline(fde); + error = cap_check_inline(haverights, needrightsp); + if (__predict_false(error != 0)) + return (EBADF); + *fpp = fp; + return (0); +} +#else +int +fget_only_user(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, + struct file **fpp) +{ + struct file *fp; + + MPASS(FILEDESC_IS_ONLY_USER(fdp)); + + if (__predict_false(fd >= fdp->fd_nfiles)) + return (EBADF); + + fp = fdp->fd_ofiles[fd].fde_file; + if (__predict_false(fp == NULL)) + return (EBADF); + + MPASS(refcount_load(&fp->f_count) > 0); + *fpp = fp; + return (0); +} +#endif + /* * Extract the file pointer associated with the specified descriptor for the * current user process. diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h index 9b65c7a66054..890232b7f160 100644 --- a/sys/sys/filedesc.h +++ b/sys/sys/filedesc.h @@ -177,6 +177,11 @@ struct filedesc_to_leader { SX_NOTRECURSED) #define FILEDESC_UNLOCK_ASSERT(fdp) sx_assert(&(fdp)->fd_sx, SX_UNLOCKED) +#define FILEDESC_IS_ONLY_USER(fdp) ({ \ + struct filedesc *_fdp = (fdp); \ + MPASS(curproc->p_fd == _fdp); \ + (curproc->p_numthreads == 1 && refcount_load(&_fdp->fd_refcnt) == 1); \ +}) #else /* @@ -272,6 +277,13 @@ int fget_unlocked_seq(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, struct file **fpp, seqc_t *seqp); int fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, struct file **fpp); +/* Return a file pointer without a ref. FILEDESC_IS_ONLY_USER must be true. */ +int fget_only_user(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, + struct file **fpp); +#define fput_only_user(fdp, fp) ({ \ + MPASS(FILEDESC_IS_ONLY_USER(fdp)); \ + MPASS(refcount_load(&fp->f_count) > 0); \ +}) /* Requires a FILEDESC_{S,X}LOCK held and returns without a ref. */ static __inline struct file * From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:41:09 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 992174FED90; Mon, 1 Feb 2021 12:41: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 4DTncL1XXWz3Dvk; Mon, 1 Feb 2021 12:41:05 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9105D1B5A1; Mon, 1 Feb 2021 12:41:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111Cf15i098377; Mon, 1 Feb 2021 12:41:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111Cf1li098376; Mon, 1 Feb 2021 12:41:01 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:41:01 GMT Message-Id: <202102011241.111Cf1li098376@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 233225ef7d56 - stable/13 - select: employ fget_only_user MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 233225ef7d5604162b6bda47e35fa7a8075bd559 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:41:09 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=233225ef7d5604162b6bda47e35fa7a8075bd559 commit 233225ef7d5604162b6bda47e35fa7a8075bd559 Author: Mateusz Guzik AuthorDate: 2021-01-28 23:33:46 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:18 +0000 select: employ fget_only_user Since most select users are single-threaded this avoid a lot of work in the common case. For example select of 16 fds (ops/s): before: 2114536 after: 2991010 (cherry picked from commit 6affe1b71238df7bbbca6e2059e5494d91e68d2d) --- sys/kern/sys_generic.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index a055f4a9b597..dc2cd56f5077 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -1304,13 +1304,6 @@ selsetbits(fd_mask **ibits, fd_mask **obits, int idx, fd_mask bit, int events) return (n); } -static __inline int -getselfd_cap(struct filedesc *fdp, int fd, struct file **fpp) -{ - - return (fget_unlocked(fdp, fd, &cap_event_rights, fpp)); -} - /* * Traverse the list of fds attached to this thread's seltd and check for * completion. @@ -1327,10 +1320,12 @@ selrescan(struct thread *td, fd_mask **ibits, fd_mask **obits) fd_mask bit; int fd, ev, n, idx; int error; + bool only_user; fdp = td->td_proc->p_fd; stp = td->td_sel; n = 0; + only_user = FILEDESC_IS_ONLY_USER(fdp); STAILQ_FOREACH_SAFE(sfp, &stp->st_selq, sf_link, sfn) { fd = (int)(uintptr_t)sfp->sf_cookie; si = sfp->sf_si; @@ -1338,13 +1333,19 @@ selrescan(struct thread *td, fd_mask **ibits, fd_mask **obits) /* If the selinfo wasn't cleared the event didn't fire. */ if (si != NULL) continue; - error = getselfd_cap(fdp, fd, &fp); - if (error) + if (only_user) + error = fget_only_user(fdp, fd, &cap_event_rights, &fp); + else + error = fget_unlocked(fdp, fd, &cap_event_rights, &fp); + if (__predict_false(error != 0)) return (error); idx = fd / NFDBITS; bit = (fd_mask)1 << (fd % NFDBITS); ev = fo_poll(fp, selflags(ibits, idx, bit), td->td_ucred, td); - fdrop(fp, td); + if (only_user) + fput_only_user(fdp, fp); + else + fdrop(fp, td); if (ev != 0) n += selsetbits(ibits, obits, idx, bit, ev); } @@ -1366,9 +1367,11 @@ selscan(struct thread *td, fd_mask **ibits, fd_mask **obits, int nfd) int ev, flags, end, fd; int n, idx; int error; + bool only_user; fdp = td->td_proc->p_fd; n = 0; + only_user = FILEDESC_IS_ONLY_USER(fdp); for (idx = 0, fd = 0; fd < nfd; idx++) { end = imin(fd + NFDBITS, nfd); for (bit = 1; fd < end; bit <<= 1, fd++) { @@ -1376,12 +1379,18 @@ selscan(struct thread *td, fd_mask **ibits, fd_mask **obits, int nfd) flags = selflags(ibits, idx, bit); if (flags == 0) continue; - error = getselfd_cap(fdp, fd, &fp); - if (error) + if (only_user) + error = fget_only_user(fdp, fd, &cap_event_rights, &fp); + else + error = fget_unlocked(fdp, fd, &cap_event_rights, &fp); + if (__predict_false(error != 0)) return (error); selfdalloc(td, (void *)(uintptr_t)fd); ev = fo_poll(fp, flags, td->td_ucred, td); - fdrop(fp, td); + if (only_user) + fput_only_user(fdp, fp); + else + fdrop(fp, td); if (ev != 0) n += selsetbits(ibits, obits, idx, bit, ev); } From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:41:10 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EDC214FEBD6; Mon, 1 Feb 2021 12:41: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 4DTncM4HBNz3F7k; Mon, 1 Feb 2021 12:41:07 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B5BB81B6A3; Mon, 1 Feb 2021 12:41:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111Cf2Ub098399; Mon, 1 Feb 2021 12:41:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111Cf25O098398; Mon, 1 Feb 2021 12:41:02 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:41:02 GMT Message-Id: <202102011241.111Cf25O098398@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 2bf72739da6f - stable/13 - poll: use fget_unlocked or fget_only_user when feasible MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2bf72739da6f54572597369a1b5892a124c6c9ce Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:41:10 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=2bf72739da6f54572597369a1b5892a124c6c9ce commit 2bf72739da6f54572597369a1b5892a124c6c9ce Author: Mateusz Guzik AuthorDate: 2021-01-28 23:52:08 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:18 +0000 poll: use fget_unlocked or fget_only_user when feasible This follows select by eleminating the use of filedesc lock. This is a win for single-threaded processes and a mixed bag for others as at small concurrency it is faster to take the lock instead of refing/unrefing each file descriptor. Nonetheless, removal of shared lock usage is a step towards a mtx-protected fd table. (cherry picked from commit 45e1f8541428c19f63dba65d78a8d138e1bc6915) --- sys/kern/sys_generic.c | 75 ++++++++++++++++---------------------------------- 1 file changed, 24 insertions(+), 51 deletions(-) diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index dc2cd56f5077..6fcdee7a088f 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -1547,49 +1547,6 @@ sys_ppoll(struct thread *td, struct ppoll_args *uap) return (kern_poll(td, uap->fds, uap->nfds, tsp, ssp)); } -#ifdef CAPABILITIES -static int -poll_fget(struct filedesc *fdp, int fd, struct file **fpp) -{ - const struct filedescent *fde; - const struct fdescenttbl *fdt; - const cap_rights_t *haverights; - struct file *fp; - int error; - - if (__predict_false(fd >= fdp->fd_nfiles)) - return (EBADF); - - fdt = fdp->fd_files; - fde = &fdt->fdt_ofiles[fd]; - fp = fde->fde_file; - if (__predict_false(fp == NULL)) - return (EBADF); - haverights = cap_rights_fde_inline(fde); - error = cap_check_inline(haverights, &cap_event_rights); - if (__predict_false(error != 0)) - return (EBADF); - *fpp = fp; - return (0); -} -#else -static int -poll_fget(struct filedesc *fdp, int fd, struct file **fpp) -{ - struct file *fp; - - if (__predict_false(fd >= fdp->fd_nfiles)) - return (EBADF); - - fp = fdp->fd_ofiles[fd].fde_file; - if (__predict_false(fp == NULL)) - return (EBADF); - - *fpp = fp; - return (0); -} -#endif - static int pollrescan(struct thread *td) { @@ -1600,12 +1557,13 @@ pollrescan(struct thread *td) struct filedesc *fdp; struct file *fp; struct pollfd *fd; - int n; + int n, error; + bool only_user; n = 0; fdp = td->td_proc->p_fd; stp = td->td_sel; - FILEDESC_SLOCK(fdp); + only_user = FILEDESC_IS_ONLY_USER(fdp); STAILQ_FOREACH_SAFE(sfp, &stp->st_selq, sf_link, sfn) { fd = (struct pollfd *)sfp->sf_cookie; si = sfp->sf_si; @@ -1613,7 +1571,11 @@ pollrescan(struct thread *td) /* If the selinfo wasn't cleared the event didn't fire. */ if (si != NULL) continue; - if (poll_fget(fdp, fd->fd, &fp) != 0) { + if (only_user) + error = fget_only_user(fdp, fd->fd, &cap_event_rights, &fp); + else + error = fget_unlocked(fdp, fd->fd, &cap_event_rights, &fp); + if (__predict_false(error != 0)) { fd->revents = POLLNVAL; n++; continue; @@ -1623,10 +1585,13 @@ pollrescan(struct thread *td) * POLLERR if appropriate. */ fd->revents = fo_poll(fp, fd->events, td->td_ucred, td); + if (only_user) + fput_only_user(fdp, fp); + else + fdrop(fp, td); if (fd->revents != 0) n++; } - FILEDESC_SUNLOCK(fdp); stp->st_flags = 0; td->td_retval[0] = n; return (0); @@ -1658,17 +1623,22 @@ pollscan(struct thread *td, struct pollfd *fds, u_int nfd) { struct filedesc *fdp; struct file *fp; - int i, n; + int i, n, error; + bool only_user; n = 0; fdp = td->td_proc->p_fd; - FILEDESC_SLOCK(fdp); + only_user = FILEDESC_IS_ONLY_USER(fdp); for (i = 0; i < nfd; i++, fds++) { if (fds->fd < 0) { fds->revents = 0; continue; } - if (poll_fget(fdp, fds->fd, &fp) != 0) { + if (only_user) + error = fget_only_user(fdp, fds->fd, &cap_event_rights, &fp); + else + error = fget_unlocked(fdp, fds->fd, &cap_event_rights, &fp); + if (__predict_false(error != 0)) { fds->revents = POLLNVAL; n++; continue; @@ -1680,6 +1650,10 @@ pollscan(struct thread *td, struct pollfd *fds, u_int nfd) selfdalloc(td, fds); fds->revents = fo_poll(fp, fds->events, td->td_ucred, td); + if (only_user) + fput_only_user(fdp, fp); + else + fdrop(fp, td); /* * POSIX requires POLLOUT to be never * set simultaneously with POLLHUP. @@ -1690,7 +1664,6 @@ pollscan(struct thread *td, struct pollfd *fds, u_int nfd) if (fds->revents != 0) n++; } - FILEDESC_SUNLOCK(fdp); td->td_retval[0] = n; return (0); } From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:41:11 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 341D04FED53; Mon, 1 Feb 2021 12:41: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 4DTncP67VSz3F42; Mon, 1 Feb 2021 12:41:09 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EAF1F1B6A5; Mon, 1 Feb 2021 12:41:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111Cf4Do098439; Mon, 1 Feb 2021 12:41:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111Cf4pA098438; Mon, 1 Feb 2021 12:41:04 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:41:04 GMT Message-Id: <202102011241.111Cf4pA098438@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 3975d4c9e1be - stable/13 - amd64: add missing ALIGN_TEXT to loops in memset and memmove MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3975d4c9e1be53c2a4977acaa314bcdc18c02416 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:41:12 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=3975d4c9e1be53c2a4977acaa314bcdc18c02416 commit 3975d4c9e1be53c2a4977acaa314bcdc18c02416 Author: Mateusz Guzik AuthorDate: 2021-01-29 15:09:14 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:18 +0000 amd64: add missing ALIGN_TEXT to loops in memset and memmove (cherry picked from commit 164c3b81848bc81dc200b12370999474225447a3) --- lib/libc/amd64/string/memmove.S | 2 ++ lib/libc/amd64/string/memset.S | 1 + sys/amd64/amd64/support.S | 3 +++ 3 files changed, 6 insertions(+) diff --git a/lib/libc/amd64/string/memmove.S b/lib/libc/amd64/string/memmove.S index accc86440610..4797140a1c16 100644 --- a/lib/libc/amd64/string/memmove.S +++ b/lib/libc/amd64/string/memmove.S @@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$"); cmpq $256,%rcx ja 1256f + ALIGN_TEXT 103200: movq (%rsi),%rdx movq %rdx,(%rdi) @@ -198,6 +199,7 @@ __FBSDID("$FreeBSD$"); cmpq $32,%rcx jb 2016f + ALIGN_TEXT 2032: movq (%rsi),%rdx movq %rdx,(%rdi) diff --git a/lib/libc/amd64/string/memset.S b/lib/libc/amd64/string/memset.S index 67f21714b3d1..0639573a4a3e 100644 --- a/lib/libc/amd64/string/memset.S +++ b/lib/libc/amd64/string/memset.S @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); cmpq $256,%rcx ja 1256f + ALIGN_TEXT 103200: movq %r10,(%rdi) movq %r10,8(%rdi) diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S index b0ef54a27ca1..35e73e413e87 100644 --- a/sys/amd64/amd64/support.S +++ b/sys/amd64/amd64/support.S @@ -322,6 +322,7 @@ END(memcmp) cmpq $256,%rcx ja 1256f + ALIGN_TEXT 103200: movq (%rsi),%rdx movq %rdx,(%rdi) @@ -455,6 +456,7 @@ END(memcmp) cmpq $32,%rcx jb 2016f + ALIGN_TEXT 2032: movq (%rsi),%rdx movq %rdx,(%rdi) @@ -595,6 +597,7 @@ END(memcpy_erms) cmpq $256,%rcx ja 1256f + ALIGN_TEXT 103200: movq %r10,(%rdi) movq %r10,8(%rdi) From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:41:11 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 362EB4FEF84; Mon, 1 Feb 2021 12:41: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 4DTncQ2FZyz3FDf; Mon, 1 Feb 2021 12:41:09 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2B8871B445; Mon, 1 Feb 2021 12:41:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111Cf6U5098461; Mon, 1 Feb 2021 12:41:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111Cf6kA098460; Mon, 1 Feb 2021 12:41:06 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:41:06 GMT Message-Id: <202102011241.111Cf6kA098460@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: be03df57d62f - stable/13 - amd64: retire sse2_pagezero MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: be03df57d62f4cc6161349f9127309ea20395c0d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:41:12 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=be03df57d62f4cc6161349f9127309ea20395c0d commit be03df57d62f4cc6161349f9127309ea20395c0d Author: Mateusz Guzik AuthorDate: 2021-01-30 00:17:15 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:18 +0000 amd64: retire sse2_pagezero All page zeroing is using temporal stores with rep movs*, the routine is unused for several years. Should a need arise for zeroing using non-temporal stores, a more optimized variant can be implemented with a more descriptive name. (cherry picked from commit d1de5698dfe6109308d4e5d6536a2ac93941d23a) --- sys/amd64/amd64/support.S | 24 ------------------------ sys/amd64/include/md_var.h | 1 - 2 files changed, 25 deletions(-) diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S index 35e73e413e87..49baa50ac294 100644 --- a/sys/amd64/amd64/support.S +++ b/sys/amd64/amd64/support.S @@ -81,30 +81,6 @@ ENTRY(pagecopy) ret END(pagecopy) -/* Address: %rdi */ -ENTRY(sse2_pagezero) - PUSH_FRAME_POINTER - movq $-PAGE_SIZE,%rdx - subq %rdx,%rdi - xorl %eax,%eax - jmp 1f - /* - * The loop takes 29 bytes. Ensure that it doesn't cross a 32-byte - * cache line. - */ - .p2align 5,0x90 -1: - movnti %rax,(%rdi,%rdx) - movnti %rax,8(%rdi,%rdx) - movnti %rax,16(%rdi,%rdx) - movnti %rax,24(%rdi,%rdx) - addq $32,%rdx - jne 1b - sfence - POP_FRAME_POINTER - ret -END(sse2_pagezero) - /* * memcmpy(b1, b2, len) * rdi,rsi,rdx diff --git a/sys/amd64/include/md_var.h b/sys/amd64/include/md_var.h index 6b6201e4c0f1..3b2454a4b441 100644 --- a/sys/amd64/include/md_var.h +++ b/sys/amd64/include/md_var.h @@ -85,7 +85,6 @@ void gsbase_load_fault(void) __asm(__STRING(gsbase_load_fault)); void fpstate_drop(struct thread *td); void pagezero(void *addr); void setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int ist); -void sse2_pagezero(void *addr); void set_top_of_stack_td(struct thread *td); struct savefpu *get_pcb_user_save_td(struct thread *td); struct savefpu *get_pcb_user_save_pcb(struct pcb *pcb); From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:41:12 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 30B2D4FEE97; Mon, 1 Feb 2021 12:41: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 4DTncP410Cz3FDV; Mon, 1 Feb 2021 12:41:09 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CE5081B444; Mon, 1 Feb 2021 12:41:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111Cf3mW098421; Mon, 1 Feb 2021 12:41:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111Cf3hj098420; Mon, 1 Feb 2021 12:41:03 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:41:03 GMT Message-Id: <202102011241.111Cf3hj098420@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: e5b674594e64 - stable/13 - Reimplement strlen MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e5b674594e64b86a34295a475bb6cdb67469f8da Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:41:12 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=e5b674594e64b86a34295a475bb6cdb67469f8da commit e5b674594e64b86a34295a475bb6cdb67469f8da Author: Mateusz Guzik AuthorDate: 2021-01-29 21:48:11 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:18 +0000 Reimplement strlen The previous code neglected to use primitives which can find the end of the string without having to branch on every character. While here augment the somewhat misleading commentary -- strlen as implemented here leaves performance on the table, especially so for userspace. Every arch should get a dedicated variant instead. In the meantime this commit lessens the problem. Tested with glibc test suite. Naive test just calling strlen in a loop on Haswell (ops/s): $(perl -e "print 'A' x 3"): before: 211198039 after: 338626619 $(perl -e "print 'A' x 100"): before: 83151997 after: 98285919 (cherry picked from commit 710e45c4b8539d028877769f1a4ec088c48fb5f1) --- lib/libc/string/strlen.c | 82 +++++++++++++++++------------------------------- sys/libkern/strlen.c | 79 +++++++++++++++------------------------------- 2 files changed, 53 insertions(+), 108 deletions(-) diff --git a/lib/libc/string/strlen.c b/lib/libc/string/strlen.c index a862ffc245ca..0bdc81d7bb9a 100644 --- a/lib/libc/string/strlen.c +++ b/lib/libc/string/strlen.c @@ -35,10 +35,6 @@ __FBSDID("$FreeBSD$"); /* * Portable strlen() for 32-bit and 64-bit systems. * - * Rationale: it is generally much more efficient to do word length - * operations and avoid branches on modern computer systems, as - * compared to byte-length operations with a lot of branches. - * * The expression: * * ((x - 0x01....01) & ~x & 0x80....80) @@ -46,18 +42,13 @@ __FBSDID("$FreeBSD$"); * would evaluate to a non-zero value iff any of the bytes in the * original word is zero. * - * On multi-issue processors, we can divide the above expression into: - * a) (x - 0x01....01) - * b) (~x & 0x80....80) - * c) a & b - * - * Where, a) and b) can be partially computed in parallel. - * * The algorithm above is found on "Hacker's Delight" by * Henry S. Warren, Jr. + * + * Note: this leaves performance on the table and each architecture + * would be best served with a tailor made routine instead. */ -/* Magic numbers for the algorithm */ #if LONG_BIT == 32 static const unsigned long mask01 = 0x01010101; static const unsigned long mask80 = 0x80808080; @@ -70,62 +61,45 @@ static const unsigned long mask80 = 0x8080808080808080; #define LONGPTR_MASK (sizeof(long) - 1) -/* - * Helper macro to return string length if we caught the zero - * byte. - */ -#define testbyte(x) \ - do { \ - if (p[x] == '\0') \ - return (p - str + x); \ - } while (0) +#if BYTE_ORDER == LITTLE_ENDIAN +#define FINDZERO __builtin_ctzl +#else +#define FINDZERO __builtin_clzl +#endif size_t strlen(const char *str) { - const char *p; const unsigned long *lp; + unsigned long mask; long va, vb; + long val; - /* - * Before trying the hard (unaligned byte-by-byte access) way - * to figure out whether there is a nul character, try to see - * if there is a nul character is within this accessible word - * first. - * - * p and (p & ~LONGPTR_MASK) must be equally accessible since - * they always fall in the same memory page, as long as page - * boundaries is integral multiple of word size. - */ - lp = (const unsigned long *)((uintptr_t)str & ~LONGPTR_MASK); - va = (*lp - mask01); - vb = ((~*lp) & mask80); - lp++; - if (va & vb) - /* Check if we have \0 in the first part */ - for (p = str; p < (const char *)lp; p++) - if (*p == '\0') - return (p - str); + lp = (unsigned long *) (uintptr_t) str; + if ((uintptr_t)lp & LONGPTR_MASK) { + lp = (__typeof(lp)) ((uintptr_t)lp & ~LONGPTR_MASK); +#if BYTE_ORDER == LITTLE_ENDIAN + mask = ~(~0UL << (((uintptr_t)str & LONGPTR_MASK) << 3)); +#else + mask = ~(~0UL >> (((uintptr_t)str & LONGPTR_MASK) << 3)); +#endif + val = *lp | mask; + va = (val - mask01); + vb = ((~val) & mask80); + if (va & vb) { + return ((const char *)lp - str + (FINDZERO(va & vb) >> 3)); + } + lp++; + } - /* Scan the rest of the string using word sized operation */ for (; ; lp++) { va = (*lp - mask01); vb = ((~*lp) & mask80); if (va & vb) { - p = (const char *)(lp); - testbyte(0); - testbyte(1); - testbyte(2); - testbyte(3); -#if (LONG_BIT >= 64) - testbyte(4); - testbyte(5); - testbyte(6); - testbyte(7); -#endif + return ((const char *)lp - str + (FINDZERO(va & vb) >> 3)); } } - /* NOTREACHED */ + __builtin_unreachable(); return (0); } diff --git a/sys/libkern/strlen.c b/sys/libkern/strlen.c index a8c7964f69a3..8fa5f3927ea9 100644 --- a/sys/libkern/strlen.c +++ b/sys/libkern/strlen.c @@ -34,10 +34,6 @@ __FBSDID("$FreeBSD$"); /* * Portable strlen() for 32-bit and 64-bit systems. * - * Rationale: it is generally much more efficient to do word length - * operations and avoid branches on modern computer systems, as - * compared to byte-length operations with a lot of branches. - * * The expression: * * ((x - 0x01....01) & ~x & 0x80....80) @@ -45,18 +41,10 @@ __FBSDID("$FreeBSD$"); * would evaluate to a non-zero value iff any of the bytes in the * original word is zero. * - * On multi-issue processors, we can divide the above expression into: - * a) (x - 0x01....01) - * b) (~x & 0x80....80) - * c) a & b - * - * Where, a) and b) can be partially computed in parallel. - * * The algorithm above is found on "Hacker's Delight" by * Henry S. Warren, Jr. */ -/* Magic numbers for the algorithm */ #if LONG_BIT == 32 static const unsigned long mask01 = 0x01010101; static const unsigned long mask80 = 0x80808080; @@ -69,62 +57,45 @@ static const unsigned long mask80 = 0x8080808080808080; #define LONGPTR_MASK (sizeof(long) - 1) -/* - * Helper macro to return string length if we caught the zero - * byte. - */ -#define testbyte(x) \ - do { \ - if (p[x] == '\0') \ - return (p - str + x); \ - } while (0) +#if BYTE_ORDER == LITTLE_ENDIAN +#define FINDZERO __builtin_ctzl +#else +#define FINDZERO __builtin_clzl +#endif size_t (strlen)(const char *str) { - const char *p; const unsigned long *lp; + unsigned long mask; long va, vb; + long val; - /* - * Before trying the hard (unaligned byte-by-byte access) way - * to figure out whether there is a nul character, try to see - * if there is a nul character is within this accessible word - * first. - * - * p and (p & ~LONGPTR_MASK) must be equally accessible since - * they always fall in the same memory page, as long as page - * boundaries is integral multiple of word size. - */ - lp = (const unsigned long *)((uintptr_t)str & ~LONGPTR_MASK); - va = (*lp - mask01); - vb = ((~*lp) & mask80); - lp++; - if (va & vb) - /* Check if we have \0 in the first part */ - for (p = str; p < (const char *)lp; p++) - if (*p == '\0') - return (p - str); + lp = (unsigned long *) (uintptr_t) str; + if ((uintptr_t)lp & LONGPTR_MASK) { + lp = (__typeof(lp)) ((uintptr_t)lp & ~LONGPTR_MASK); +#if BYTE_ORDER == LITTLE_ENDIAN + mask = ~(~0UL << (((uintptr_t)str & LONGPTR_MASK) << 3)); +#else + mask = ~(~0UL >> (((uintptr_t)str & LONGPTR_MASK) << 3)); +#endif + val = *lp | mask; + va = (val - mask01); + vb = ((~val) & mask80); + if (va & vb) { + return ((const char *)lp - str + (FINDZERO(va & vb) >> 3)); + } + lp++; + } - /* Scan the rest of the string using word sized operation */ for (; ; lp++) { va = (*lp - mask01); vb = ((~*lp) & mask80); if (va & vb) { - p = (const char *)(lp); - testbyte(0); - testbyte(1); - testbyte(2); - testbyte(3); -#if (LONG_BIT >= 64) - testbyte(4); - testbyte(5); - testbyte(6); - testbyte(7); -#endif + return ((const char *)lp - str + (FINDZERO(va & vb) >> 3)); } } - /* NOTREACHED */ + __builtin_unreachable(); return (0); } From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:41:12 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A2BF54FED55; Mon, 1 Feb 2021 12:41: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 4DTncQ6HXNz3FDg; Mon, 1 Feb 2021 12:41:10 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4ACF71B5A2; Mon, 1 Feb 2021 12:41:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111Cf7E2098483; Mon, 1 Feb 2021 12:41:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111Cf7HS098482; Mon, 1 Feb 2021 12:41:07 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:41:07 GMT Message-Id: <202102011241.111Cf7HS098482@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 6a3047840dfb - stable/13 - cache: handle NOFOLLOW requests for symlinks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6a3047840dfbbdb59d96a325f295f42755648545 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:41:12 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=6a3047840dfbbdb59d96a325f295f42755648545 commit 6a3047840dfbbdb59d96a325f295f42755648545 Author: Mateusz Guzik AuthorDate: 2021-01-26 22:14:49 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:18 +0000 cache: handle NOFOLLOW requests for symlinks Tested by: pho (cherry picked from commit 8cbd164a179c182e8fd4a71f366bc48fe840eafb) --- sys/kern/vfs_cache.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index ff8aad14001b..b8b876657211 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -4307,11 +4307,22 @@ cache_fplookup_final_modifying(struct cache_fpl *fpl) } /* - * Check if the target is either a symlink or a mount point. - * Since we expect this to be the terminal vnode it should - * almost never be true. + * If they want the symlink itself we are fine, but if they want to + * follow it regular lookup has to be engaged. */ - if (__predict_false(tvp->v_type == VLNK || cache_fplookup_is_mp(fpl))) { + if (tvp->v_type == VLNK) { + if ((cnp->cn_flags & FOLLOW) != 0) { + vput(dvp); + vput(tvp); + return (cache_fpl_aborted(fpl)); + } + } + + /* + * Since we expect this to be the terminal vnode it should almost never + * be a mount point. + */ + if (__predict_false(cache_fplookup_is_mp(fpl))) { vput(dvp); vput(tvp); return (cache_fpl_aborted(fpl)); @@ -4614,7 +4625,15 @@ cache_fplookup_noentry(struct cache_fpl *fpl) return (cache_fpl_handled(fpl)); } - if (__predict_false(tvp->v_type == VLNK || cache_fplookup_is_mp(fpl))) { + if (tvp->v_type == VLNK) { + if ((cnp->cn_flags & FOLLOW) != 0) { + vput(dvp); + vput(tvp); + return (cache_fpl_aborted(fpl)); + } + } + + if (__predict_false(cache_fplookup_is_mp(fpl))) { vput(dvp); vput(tvp); return (cache_fpl_aborted(fpl)); From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:41:15 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 204B54FEF5C; Mon, 1 Feb 2021 12:41: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 4DTncS6CCYz3F74; Mon, 1 Feb 2021 12:41:12 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 6CC881B70E; Mon, 1 Feb 2021 12:41:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111Cf8Up098502; Mon, 1 Feb 2021 12:41:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111Cf89L098500; Mon, 1 Feb 2021 12:41:08 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:41:08 GMT Message-Id: <202102011241.111Cf89L098500@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 006ec2ed1565 - stable/13 - cache: add trailing slash support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 006ec2ed15650778c36ef956c5058b5b38717de7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:41:15 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=006ec2ed15650778c36ef956c5058b5b38717de7 commit 006ec2ed15650778c36ef956c5058b5b38717de7 Author: Mateusz Guzik AuthorDate: 2021-01-26 00:38:21 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:19 +0000 cache: add trailing slash support Tested by: pho (cherry picked from commit e027e24bfac7dd311ddacaec73d6c42102069511) --- sys/kern/vfs_cache.c | 227 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 184 insertions(+), 43 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index b8b876657211..1780e8235dd3 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3714,6 +3714,7 @@ static bool cache_fplookup_is_mp(struct cache_fpl *fpl); static int cache_fplookup_cross_mount(struct cache_fpl *fpl); static int cache_fplookup_partial_setup(struct cache_fpl *fpl); static int cache_fplookup_skip_slashes(struct cache_fpl *fpl); +static int cache_fplookup_trailingslash(struct cache_fpl *fpl); static int cache_fplookup_preparse(struct cache_fpl *fpl); static void cache_fpl_pathlen_dec(struct cache_fpl *fpl); static void cache_fpl_pathlen_inc(struct cache_fpl *fpl); @@ -3971,6 +3972,13 @@ cache_fpl_islastcn(struct nameidata *ndp) return (*ndp->ni_next == 0); } +static bool +cache_fpl_istrailingslash(struct cache_fpl *fpl) +{ + + return (*(fpl->nulchar - 1) == '/'); +} + static bool cache_fpl_isdotdot(struct componentname *cnp) { @@ -4201,6 +4209,15 @@ cache_fplookup_final_modifying(struct cache_fpl *fpl) if (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME) docache = false; + /* + * Regular lookup nulifies the slash, which we don't do here. + * Don't take chances with filesystem routines seeing it for + * the last entry. + */ + if (cache_fpl_istrailingslash(fpl)) { + return (cache_fpl_partial(fpl)); + } + mp = atomic_load_ptr(&dvp->v_mount); if (__predict_false(mp == NULL)) { return (cache_fpl_aborted(fpl)); @@ -4533,7 +4550,6 @@ cache_fplookup_noentry(struct cache_fpl *fpl) dvp = fpl->dvp; dvp_seqc = fpl->dvp_seqc; - MPASS(*(cnp->cn_nameptr) != '/'); MPASS((cnp->cn_flags & MAKEENTRY) == 0); MPASS((cnp->cn_flags & ISDOTDOT) == 0); MPASS(!cache_fpl_isdotdot(cnp)); @@ -4546,6 +4562,14 @@ cache_fplookup_noentry(struct cache_fpl *fpl) return (cache_fpl_handled_error(fpl, ENAMETOOLONG)); } + if (cnp->cn_nameptr[0] == '/') { + return (cache_fplookup_skip_slashes(fpl)); + } + + if (cnp->cn_nameptr[0] == '\0') { + return (cache_fplookup_trailingslash(fpl)); + } + if (cnp->cn_nameiop != LOOKUP) { fpl->tvp = NULL; return (cache_fplookup_modifying(fpl)); @@ -4562,6 +4586,15 @@ cache_fplookup_noentry(struct cache_fpl *fpl) return (cache_fpl_partial(fpl)); } + /* + * Regular lookup nulifies the slash, which we don't do here. + * Don't take chances with filesystem routines seeing it for + * the last entry. + */ + if (cache_fpl_istrailingslash(fpl)) { + return (cache_fpl_partial(fpl)); + } + /* * Secure access to dvp; check cache_fplookup_partial_setup for * reasoning. @@ -4792,6 +4825,7 @@ cache_symlink_resolve(struct cache_fpl *fpl, const char *string, size_t len) { struct nameidata *ndp; struct componentname *cnp; + size_t adjust; ndp = fpl->ndp; cnp = fpl->cnp; @@ -4800,6 +4834,12 @@ cache_symlink_resolve(struct cache_fpl *fpl, const char *string, size_t len) return (ENOENT); } + if (__predict_false(len > MAXPATHLEN - 2)) { + if (cache_fpl_istrailingslash(fpl)) { + return (EAGAIN); + } + } + ndp->ni_pathlen = fpl->nulchar - cnp->cn_nameptr - cnp->cn_namelen + 1; #ifdef INVARIANTS if (ndp->ni_pathlen != fpl->debug.ni_pathlen) { @@ -4817,15 +4857,22 @@ cache_symlink_resolve(struct cache_fpl *fpl, const char *string, size_t len) return (ELOOP); } + adjust = len; if (ndp->ni_pathlen > 1) { bcopy(ndp->ni_next, cnp->cn_pnbuf + len, ndp->ni_pathlen); } else { - cnp->cn_pnbuf[len] = '\0'; + if (cache_fpl_istrailingslash(fpl)) { + adjust = len + 1; + cnp->cn_pnbuf[len] = '/'; + cnp->cn_pnbuf[len + 1] = '\0'; + } else { + cnp->cn_pnbuf[len] = '\0'; + } } bcopy(string, cnp->cn_pnbuf, len); - ndp->ni_pathlen += len; - cache_fpl_pathlen_add(fpl, len); + ndp->ni_pathlen += adjust; + cache_fpl_pathlen_add(fpl, adjust); cnp->cn_nameptr = cnp->cn_pnbuf; fpl->nulchar = &cnp->cn_nameptr[ndp->ni_pathlen - 1]; @@ -4925,9 +4972,6 @@ cache_fplookup_next(struct cache_fpl *fpl) } if (__predict_false(ncp == NULL)) { - if (cnp->cn_nameptr[0] == '/') { - return (cache_fplookup_skip_slashes(fpl)); - } return (cache_fplookup_noentry(fpl)); } @@ -5194,21 +5238,6 @@ cache_fplookup_preparse(struct cache_fpl *fpl) ("%s: mismatch on string (%p != %p) [%s]\n", __func__, &cnp->cn_nameptr[fpl->debug.ni_pathlen - 2], fpl->nulchar - 1, cnp->cn_pnbuf)); - if (__predict_false(*(fpl->nulchar - 1) == '/')) { - /* - * TODO - * Regular lookup performs the following: - * *ndp->ni_next = '\0'; - * cnp->cn_flags |= TRAILINGSLASH; - * - * Which is problematic since it modifies data read - * from userspace. Then if fast path lookup was to - * abort we would have to either restore it or convey - * the flag. Since this is a corner case just ignore - * it for simplicity. - */ - return (cache_fpl_aborted(fpl)); - } return (0); } @@ -5254,27 +5283,6 @@ cache_fplookup_parse(struct cache_fpl *fpl) * then it could not have been too long to begin with. */ ndp->ni_next = cp; - -#ifdef INVARIANTS - /* - * Code below is only here to assure compatibility with regular lookup. - * It covers handling of trailing slashes and names like "/", both of - * which of can be taken care of upfront which lockless lookup does - * in cache_fplookup_preparse. Regular lookup performs these for each - * path component. - */ - while (*cp == '/' && (cp[1] == '/' || cp[1] == '\0')) { - cp++; - if (*cp == '\0') { - panic("%s: ran into TRAILINGSLASH handling from [%s]\n", - __func__, cnp->cn_pnbuf); - } - } - - if (cnp->cn_nameptr[0] == '\0') { - panic("%s: ran into degenerate name from [%s]\n", __func__, cnp->cn_pnbuf); - } -#endif } static void @@ -5339,6 +5347,139 @@ cache_fplookup_skip_slashes(struct cache_fpl *fpl) return (0); } +/* + * Handle trailing slashes (e.g., "foo/"). + * + * If a trailing slash is found the terminal vnode must be a directory. + * Regular lookup shortens the path by nulifying the first trailing slash and + * sets the TRAILINGSLASH flag to denote this took place. There are several + * checks on it performed later. + * + * Similarly to spurious slashes, lockless lookup handles this in a speculative + * manner relying on an invariant that a non-directory vnode will get a miss. + * In this case cn_nameptr[0] == '\0' and cn_namelen == 0. + * + * Thus for a path like "foo/bar/" the code unwinds the state back to 'bar/' + * and denotes this is the last path component, which avoids looping back. + * + * Only plain lookups are supported for now to restrict corner cases to handle. + */ +static int __noinline +cache_fplookup_trailingslash(struct cache_fpl *fpl) +{ +#ifdef INVARIANTS + size_t ni_pathlen; +#endif + struct nameidata *ndp; + struct componentname *cnp; + struct namecache *ncp; + struct vnode *tvp; + char *cn_nameptr_orig, *cn_nameptr_slash; + seqc_t tvp_seqc; + u_char nc_flag; + + ndp = fpl->ndp; + cnp = fpl->cnp; + tvp = fpl->tvp; + tvp_seqc = fpl->tvp_seqc; + + MPASS(fpl->dvp == fpl->tvp); + KASSERT(cache_fpl_istrailingslash(fpl), + ("%s: expected trailing slash at %p; string [%s]\n", __func__, fpl->nulchar - 1, + cnp->cn_pnbuf)); + KASSERT(cnp->cn_nameptr[0] == '\0', + ("%s: expected nul char at %p; string [%s]\n", __func__, &cnp->cn_nameptr[0], + cnp->cn_pnbuf)); + KASSERT(cnp->cn_namelen == 0, + ("%s: namelen 0 but got %ld; string [%s]\n", __func__, cnp->cn_namelen, + cnp->cn_pnbuf)); + MPASS(cnp->cn_nameptr > cnp->cn_pnbuf); + + if (cnp->cn_nameiop != LOOKUP) { + return (cache_fpl_aborted(fpl)); + } + + if (__predict_false(tvp->v_type != VDIR)) { + if (!vn_seqc_consistent(tvp, tvp_seqc)) { + return (cache_fpl_aborted(fpl)); + } + cache_fpl_smr_exit(fpl); + return (cache_fpl_handled_error(fpl, ENOTDIR)); + } + + /* + * Denote the last component. + */ + ndp->ni_next = &cnp->cn_nameptr[0]; + MPASS(cache_fpl_islastcn(ndp)); + + /* + * Unwind trailing slashes. + */ + cn_nameptr_orig = cnp->cn_nameptr; + while (cnp->cn_nameptr >= cnp->cn_pnbuf) { + cnp->cn_nameptr--; + if (cnp->cn_nameptr[0] != '/') { + break; + } + } + + /* + * Unwind to the beginning of the path component. + * + * Note the path may or may not have started with a slash. + */ + cn_nameptr_slash = cnp->cn_nameptr; + while (cnp->cn_nameptr > cnp->cn_pnbuf) { + cnp->cn_nameptr--; + if (cnp->cn_nameptr[0] == '/') { + break; + } + } + if (cnp->cn_nameptr[0] == '/') { + cnp->cn_nameptr++; + } + + cnp->cn_namelen = cn_nameptr_slash - cnp->cn_nameptr + 1; + cache_fpl_pathlen_add(fpl, cn_nameptr_orig - cnp->cn_nameptr); + cache_fpl_checkpoint(fpl); + +#ifdef INVARIANTS + ni_pathlen = fpl->nulchar - cnp->cn_nameptr + 1; + if (ni_pathlen != fpl->debug.ni_pathlen) { + panic("%s: mismatch (%zu != %zu) nulchar %p nameptr %p [%s] ; full string [%s]\n", + __func__, ni_pathlen, fpl->debug.ni_pathlen, fpl->nulchar, + cnp->cn_nameptr, cnp->cn_nameptr, cnp->cn_pnbuf); + } +#endif + + /* + * The previous directory is this one. + */ + if (cnp->cn_nameptr[0] == '.' && cnp->cn_namelen == 1) { + return (0); + } + + /* + * The previous directory is something else. + */ + tvp = fpl->tvp; + ncp = atomic_load_consume_ptr(&tvp->v_cache_dd); + if (__predict_false(ncp == NULL)) { + return (cache_fpl_aborted(fpl)); + } + nc_flag = atomic_load_char(&ncp->nc_flag); + if ((nc_flag & NCF_ISDOTDOT) != 0) { + return (cache_fpl_aborted(fpl)); + } + fpl->dvp = ncp->nc_dvp; + fpl->dvp_seqc = vn_seqc_read_any(fpl->dvp); + if (seqc_in_modify(fpl->dvp_seqc)) { + return (cache_fpl_aborted(fpl)); + } + return (0); +} + /* * See the API contract for VOP_FPLOOKUP_VEXEC. */ From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:41:15 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 109334FEF5B; Mon, 1 Feb 2021 12:41: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 4DTncT361Nz3FDr; Mon, 1 Feb 2021 12:41:13 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 94C381B173; Mon, 1 Feb 2021 12:41:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111Cf90S098523; Mon, 1 Feb 2021 12:41:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111Cf9TX098522; Mon, 1 Feb 2021 12:41:09 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:41:09 GMT Message-Id: <202102011241.111Cf9TX098522@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 71b460513827 - stable/13 - Drop temporary compat in setproctitle MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 71b460513827a730c4e5dbf0c9a8eb3a18a95112 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:41:15 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=71b460513827a730c4e5dbf0c9a8eb3a18a95112 commit 71b460513827a730c4e5dbf0c9a8eb3a18a95112 Author: Mateusz Guzik AuthorDate: 2021-01-31 12:23:42 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:19 +0000 Drop temporary compat in setproctitle (cherry picked from commit 46f168bc665a1aee79d91bd102aef7d4754e7917) --- lib/libc/gen/setproctitle.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/lib/libc/gen/setproctitle.c b/lib/libc/gen/setproctitle.c index 991af38565cd..3f858952255c 100644 --- a/lib/libc/gen/setproctitle.c +++ b/lib/libc/gen/setproctitle.c @@ -185,17 +185,7 @@ setproctitle_fast(const char *fmt, ...) oid[1] = KERN_PROC; oid[2] = KERN_PROC_ARGS; oid[3] = -1; - if (sysctl(oid, 4, 0, 0, "", 0) != 0) { - /* - * Temporary compat for kernels which don't support - * passing -1. - */ - oid[0] = CTL_KERN; - oid[1] = KERN_PROC; - oid[2] = KERN_PROC_ARGS; - oid[3] = getpid(); - sysctl(oid, 4, 0, 0, "", 0); - } + sysctl(oid, 4, 0, 0, "", 0); fast_update = 1; } } @@ -217,17 +207,7 @@ setproctitle(const char *fmt, ...) oid[1] = KERN_PROC; oid[2] = KERN_PROC_ARGS; oid[3] = -1; - if (sysctl(oid, 4, 0, 0, buf, strlen(buf) + 1) != 0) { - /* - * Temporary compat for kernels which don't support - * passing -1. - */ - oid[0] = CTL_KERN; - oid[1] = KERN_PROC; - oid[2] = KERN_PROC_ARGS; - oid[3] = getpid(); - sysctl(oid, 4, 0, 0, buf, strlen(buf) + 1); - } + sysctl(oid, 4, 0, 0, buf, strlen(buf) + 1); fast_update = 0; } } From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:46:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1806C4FF8E7; Mon, 1 Feb 2021 12:46: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 4DTnkl022gz3JsR; Mon, 1 Feb 2021 12:46:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CB1621B709; Mon, 1 Feb 2021 12:40:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111CekFZ096896; Mon, 1 Feb 2021 12:40:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111CekWc096881; Mon, 1 Feb 2021 12:40:46 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:46 GMT Message-Id: <202102011240.111CekWc096881@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 7ba12ba0a2df - stable/13 - zfs: use atomic_load_consume_ptr for z_cached_symlink MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7ba12ba0a2df573d055c7f088e666d86e4fea898 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:46:39 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=7ba12ba0a2df573d055c7f088e666d86e4fea898 commit 7ba12ba0a2df573d055c7f088e666d86e4fea898 Author: Mateusz Guzik AuthorDate: 2021-01-25 20:15:19 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:16 +0000 zfs: use atomic_load_consume_ptr for z_cached_symlink (cherry picked from commit 7af02ef0b222eebad4827a264454e85134692e94) --- sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c index 1ee0895625a6..42f5786ce5c7 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c @@ -4476,10 +4476,7 @@ zfs_freebsd_fplookup_symlink(struct vop_fplookup_symlink_args *v) return (EAGAIN); } - /* - * FIXME: Load consume would be sufficient but there is no primitive to do it. - */ - target = (char *)atomic_load_acq_ptr((uintptr_t *)&zp->z_cached_symlink); + target = atomic_load_consume_ptr(&zp->z_cached_symlink); if (target == NULL) { return (EAGAIN); } From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:46:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E26E4FF438; Mon, 1 Feb 2021 12:46: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 4DTnkl15NTz3JkG; Mon, 1 Feb 2021 12:46:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 382E51B634; Mon, 1 Feb 2021 12:40:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111CewPu097477; Mon, 1 Feb 2021 12:40:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111Cew5v097470; Mon, 1 Feb 2021 12:40:58 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:58 GMT Message-Id: <202102011240.111Cew5v097470@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: e13587448ab1 - stable/13 - cache: fallback when encountering a mount point during .. lookup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e13587448ab1da930640563340b5e492325f2e10 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:46:39 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=e13587448ab1da930640563340b5e492325f2e10 commit e13587448ab1da930640563340b5e492325f2e10 Author: Mateusz Guzik AuthorDate: 2021-01-27 12:52:23 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:17 +0000 cache: fallback when encountering a mount point during .. lookup The current abort is overzealous. (cherry picked from commit 5fc384d1810a3a0a0acefc67abe1daf6d6cd09e4) --- sys/kern/vfs_cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index b759affcc0ac..be06a2edc58b 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -4697,7 +4697,7 @@ cache_fplookup_dotdot(struct cache_fpl *fpl) * TODO * The opposite of climb mount is needed here. */ - return (cache_fpl_aborted(fpl)); + return (cache_fpl_partial(fpl)); } ncp = atomic_load_consume_ptr(&dvp->v_cache_dd); From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:46:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E1CF4FF9EF; Mon, 1 Feb 2021 12:46: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 4DTnkl14nWz3JsS; Mon, 1 Feb 2021 12:46:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 438461B169; Mon, 1 Feb 2021 12:40:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111CeoH5097316; Mon, 1 Feb 2021 12:40:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111Ceo2A097315; Mon, 1 Feb 2021 12:40:50 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:50 GMT Message-Id: <202102011240.111Ceo2A097315@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 247f652e622d - stable/13 - cache: make ->nc_flag accesses atomic-clean for lockless usage MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 247f652e622d9aebda627ea34ba5af242dbb835e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:46:39 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=247f652e622d9aebda627ea34ba5af242dbb835e commit 247f652e622d9aebda627ea34ba5af242dbb835e Author: Mateusz Guzik AuthorDate: 2021-01-25 20:58:59 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:17 +0000 cache: make ->nc_flag accesses atomic-clean for lockless usage (cherry picked from commit 6ef8fede86f3feed7fb1e15b0e8a32ecfec33c6c) --- sys/kern/vfs_cache.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 9d5b18aa4132..ba3856ffe0b4 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -398,7 +398,7 @@ static inline struct negstate * NCP2NEGSTATE(struct namecache *ncp) { - MPASS(ncp->nc_flag & NCF_NEGATIVE); + MPASS(atomic_load_char(&ncp->nc_flag) & NCF_NEGATIVE); return (&ncp->nc_neg); } @@ -1994,7 +1994,7 @@ negative_success: } cache_out_ts(ncp, tsp, ticksp); - whiteout = (ncp->nc_flag & NCF_WHITE); + whiteout = (atomic_load_char(&ncp->nc_flag) & NCF_WHITE); neg_promote = cache_neg_hit_prep(ncp); if (!cache_ncp_canuse(ncp)) { cache_neg_hit_abort(ncp); @@ -2149,6 +2149,7 @@ cache_enter_lock(struct celockstate *cel, struct vnode *dvp, struct vnode *vp, { struct namecache *ncp; struct mtx *blps[2]; + u_char nc_flag; blps[0] = HASH2BUCKETLOCK(hash); for (;;) { @@ -2159,11 +2160,12 @@ cache_enter_lock(struct celockstate *cel, struct vnode *dvp, struct vnode *vp, ncp = vp->v_cache_dd; if (ncp == NULL) break; - if ((ncp->nc_flag & NCF_ISDOTDOT) == 0) + nc_flag = atomic_load_char(&ncp->nc_flag); + if ((nc_flag & NCF_ISDOTDOT) == 0) break; MPASS(ncp->nc_dvp == vp); blps[1] = NCP2BUCKETLOCK(ncp); - if (ncp->nc_flag & NCF_NEGATIVE) + if ((nc_flag & NCF_NEGATIVE) != 0) break; if (cache_lock_vnodes_cel_3(cel, ncp->nc_vp)) break; @@ -2190,6 +2192,7 @@ cache_enter_lock_dd(struct celockstate *cel, struct vnode *dvp, struct vnode *vp { struct namecache *ncp; struct mtx *blps[2]; + u_char nc_flag; blps[0] = HASH2BUCKETLOCK(hash); for (;;) { @@ -2198,11 +2201,12 @@ cache_enter_lock_dd(struct celockstate *cel, struct vnode *dvp, struct vnode *vp ncp = dvp->v_cache_dd; if (ncp == NULL) break; - if ((ncp->nc_flag & NCF_ISDOTDOT) == 0) + nc_flag = atomic_load_char(&ncp->nc_flag); + if ((nc_flag & NCF_ISDOTDOT) == 0) break; MPASS(ncp->nc_dvp == dvp); blps[1] = NCP2BUCKETLOCK(ncp); - if (ncp->nc_flag & NCF_NEGATIVE) + if ((nc_flag & NCF_NEGATIVE) != 0) break; if (cache_lock_vnodes_cel_3(cel, ncp->nc_vp)) break; @@ -2436,7 +2440,7 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, struct componentname *cnp, vp); } else { if (cnp->cn_flags & ISWHITEOUT) - ncp->nc_flag |= NCF_WHITE; + atomic_store_char(&ncp->nc_flag, ncp->nc_flag | NCF_WHITE); cache_neg_insert(ncp); SDT_PROBE2(vfs, namecache, enter_negative, done, dvp, ncp->nc_name); From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:46:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4643B4FF439; Mon, 1 Feb 2021 12:46: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 4DTnkl13Wlz3Jxx; Mon, 1 Feb 2021 12:46:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 67E231B62F; Mon, 1 Feb 2021 12:40:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111CepBj097338; Mon, 1 Feb 2021 12:40:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111CepG1097337; Mon, 1 Feb 2021 12:40:51 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:51 GMT Message-Id: <202102011240.111CepG1097337@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 9375a93b6c22 - stable/13 - cache: make ->v_cache_dd accesses atomic-clean for lockless usage MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9375a93b6c225d32b24bd141c0033402feebb185 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:46:39 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=9375a93b6c225d32b24bd141c0033402feebb185 commit 9375a93b6c225d32b24bd141c0033402feebb185 Author: Mateusz Guzik AuthorDate: 2021-01-25 20:29:54 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:17 +0000 cache: make ->v_cache_dd accesses atomic-clean for lockless usage (cherry picked from commit 6f0842764946ed57382293cc3361b86955308084) --- sys/kern/vfs_cache.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index ba3856ffe0b4..fad7ce91ef44 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -1441,7 +1441,7 @@ cache_zap_locked(struct namecache *ncp) TAILQ_REMOVE(&vp->v_cache_dst, ncp, nc_dst); if (ncp == vp->v_cache_dd) { vn_seqc_write_begin_unheld(vp); - vp->v_cache_dd = NULL; + atomic_store_ptr(&vp->v_cache_dd, NULL); vn_seqc_write_end(vp); } } else { @@ -1451,7 +1451,7 @@ cache_zap_locked(struct namecache *ncp) if (ncp->nc_flag & NCF_ISDOTDOT) { if (ncp == dvp->v_cache_dd) { vn_seqc_write_begin_unheld(dvp); - dvp->v_cache_dd = NULL; + atomic_store_ptr(&dvp->v_cache_dd, NULL); vn_seqc_write_end(dvp); } } else { @@ -1628,7 +1628,7 @@ retry_dotdot: cache_free(ncp); } else { vn_seqc_write_begin(dvp); - dvp->v_cache_dd = NULL; + atomic_store_ptr(&dvp->v_cache_dd, NULL); vn_seqc_write_end(dvp); mtx_unlock(dvlp); if (dvlp2 != NULL) @@ -2157,7 +2157,7 @@ cache_enter_lock(struct celockstate *cel, struct vnode *dvp, struct vnode *vp, cache_lock_vnodes_cel(cel, dvp, vp); if (vp == NULL || vp->v_type != VDIR) break; - ncp = vp->v_cache_dd; + ncp = atomic_load_consume_ptr(&vp->v_cache_dd); if (ncp == NULL) break; nc_flag = atomic_load_char(&ncp->nc_flag); @@ -2198,7 +2198,7 @@ cache_enter_lock_dd(struct celockstate *cel, struct vnode *dvp, struct vnode *vp for (;;) { blps[1] = NULL; cache_lock_vnodes_cel(cel, dvp, vp); - ncp = dvp->v_cache_dd; + ncp = atomic_load_consume_ptr(&dvp->v_cache_dd); if (ncp == NULL) break; nc_flag = atomic_load_char(&ncp->nc_flag); @@ -2240,7 +2240,7 @@ cache_enter_dotdot_prep(struct vnode *dvp, struct vnode *vp, uint32_t hash; int len; - if (dvp->v_cache_dd == NULL) + if (atomic_load_ptr(&dvp->v_cache_dd) == NULL) return; len = cnp->cn_namelen; cache_celockstate_init(&cel); @@ -2254,7 +2254,7 @@ cache_enter_dotdot_prep(struct vnode *dvp, struct vnode *vp, } else { ncp = NULL; } - dvp->v_cache_dd = NULL; + atomic_store_ptr(&dvp->v_cache_dd, NULL); vn_seqc_write_end(dvp); cache_enter_unlock(&cel); if (ncp != NULL) @@ -2393,7 +2393,7 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, struct componentname *cnp, KASSERT(vp == NULL || vp->v_type == VDIR, ("wrong vnode type %p", vp)); vn_seqc_write_begin(dvp); - dvp->v_cache_dd = ncp; + atomic_store_ptr(&dvp->v_cache_dd, ncp); vn_seqc_write_end(dvp); } @@ -2411,12 +2411,12 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, struct componentname *cnp, else ndd = NULL; } - vp->v_cache_dd = ncp; + atomic_store_ptr(&vp->v_cache_dd, ncp); vn_seqc_write_end(vp); } else if (vp->v_type != VDIR) { if (vp->v_cache_dd != NULL) { vn_seqc_write_begin(vp); - vp->v_cache_dd = NULL; + atomic_store_ptr(&vp->v_cache_dd, NULL); vn_seqc_write_end(vp); } } @@ -2658,7 +2658,7 @@ cache_has_entries(struct vnode *vp) { if (LIST_EMPTY(&vp->v_cache_src) && TAILQ_EMPTY(&vp->v_cache_dst) && - vp->v_cache_dd == NULL) + atomic_load_ptr(&vp->v_cache_dd) == NULL) return (false); return (true); } @@ -3291,7 +3291,7 @@ vn_fullpath_any_smr(struct vnode *vp, struct vnode *rdir, char *buf, vp_seqc = tvp_seqc; continue; } - ncp = atomic_load_ptr(&vp->v_cache_dd); + ncp = atomic_load_consume_ptr(&vp->v_cache_dd); if (ncp == NULL) { cache_rev_failed(&reason); goto out_abort; @@ -4705,7 +4705,7 @@ cache_fplookup_dotdot(struct cache_fpl *fpl) return (cache_fpl_aborted(fpl)); } - ncp = atomic_load_ptr(&dvp->v_cache_dd); + ncp = atomic_load_consume_ptr(&dvp->v_cache_dd); if (ncp == NULL) { return (cache_fpl_aborted(fpl)); } From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:46:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4D5854FF43A; Mon, 1 Feb 2021 12:46: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 4DTnkl1cKmz3JbV; Mon, 1 Feb 2021 12:46:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EE5961B1DD; Mon, 1 Feb 2021 12:40:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111Celsv097276; Mon, 1 Feb 2021 12:40:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111CelwN097275; Mon, 1 Feb 2021 12:40:47 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:47 GMT Message-Id: <202102011240.111CelwN097275@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 872a0097fd81 - stable/13 - tmpfs: drop acq fence now that vn_load_v_data_smr has consume semantics MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 872a0097fd81235cea5730e642daf725e8bf8afc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:46:39 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=872a0097fd81235cea5730e642daf725e8bf8afc commit 872a0097fd81235cea5730e642daf725e8bf8afc Author: Mateusz Guzik AuthorDate: 2021-01-25 20:17:48 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:16 +0000 tmpfs: drop acq fence now that vn_load_v_data_smr has consume semantics (cherry picked from commit c09f7992714559eaa874f13ea4a1d648f199cd08) --- sys/fs/tmpfs/tmpfs_subr.c | 3 --- sys/fs/tmpfs/tmpfs_vnops.c | 1 - 2 files changed, 4 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 3b3581fc81f6..84473a439c43 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -356,9 +356,6 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type, * pointer to also get the above content in a stable manner. * Worst case tn_link_smr flag may be set to true despite being stale, * while the target buffer is already cleared out. - * - * TODO: Since there is no load consume primitive provided - * right now, the load is performed with an acquire fence. */ atomic_store_ptr(&nnode->tn_link_target, symlink); atomic_store_char((char *)&nnode->tn_link_smr, symlink_smr); diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index bc4caa4adecb..7be2655dcf0b 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -1471,7 +1471,6 @@ tmpfs_fplookup_symlink(struct vop_fplookup_symlink_args *v) vp = v->a_vp; node = VP_TO_TMPFS_NODE_SMR(vp); - atomic_thread_fence_acq(); if (__predict_false(node == NULL)) return (EAGAIN); if (!atomic_load_char(&node->tn_link_smr)) From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 12:46:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4D5ED4FF7F8; Mon, 1 Feb 2021 12:46: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 4DTnkl1cxhz3JbW; Mon, 1 Feb 2021 12:46:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E41531B43F; Mon, 1 Feb 2021 12:40:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111CetTS097422; Mon, 1 Feb 2021 12:40:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111CetKn097421; Mon, 1 Feb 2021 12:40:55 GMT (envelope-from git) Date: Mon, 1 Feb 2021 12:40:55 GMT Message-Id: <202102011240.111CetKn097421@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 742285d28301 - stable/13 - cache: tidy up handling of foo/bar lookups where foo is not a directory MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 742285d283012c0022e9acdbe9ed1c7dd5cbb5e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 12:46:39 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=742285d283012c0022e9acdbe9ed1c7dd5cbb5e6 commit 742285d283012c0022e9acdbe9ed1c7dd5cbb5e6 Author: Mateusz Guzik AuthorDate: 2021-01-26 16:19:12 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-01 12:39:17 +0000 cache: tidy up handling of foo/bar lookups where foo is not a directory The code was performing an avoidable check for doomed state to account for foo being a VDIR but turning VBAD. Now that dooming puts a vnode in a permanent "modify" state this is no longer necessary as the final status check will catch it. (cherry picked from commit a098a831a162fcd55b0097c95e6840621d8c720a) --- sys/kern/vfs_cache.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 4e2cfa9edf53..b759affcc0ac 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -5328,20 +5328,11 @@ cache_fplookup_failed_vexec(struct cache_fpl *fpl, int error) } /* - * Hack: they may be looking up foo/bar, where foo is a - * regular file. In such a case we need to turn ENOTDIR, - * but we may happen to get here with a different error. + * Hack: they may be looking up foo/bar, where foo is not a directory. + * In such a case we need to return ENOTDIR, but we may happen to get + * here with a different error. */ if (dvp->v_type != VDIR) { - /* - * The check here is predominantly to catch - * EOPNOTSUPP from dead_vnodeops. If the vnode - * gets doomed past this point it is going to - * fail seqc verification. - */ - if (VN_IS_DOOMED(dvp)) { - return (cache_fpl_aborted(fpl)); - } error = ENOTDIR; } From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 13:05:32 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BF3BF528699; Mon, 1 Feb 2021 13:05: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 4DTp8X0JYrz3MCD; Mon, 1 Feb 2021 13:05:32 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D44B61B765; Mon, 1 Feb 2021 13:05:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111D5V0C026663; Mon, 1 Feb 2021 13:05:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111D5VpX026662; Mon, 1 Feb 2021 13:05:31 GMT (envelope-from git) Date: Mon, 1 Feb 2021 13:05:31 GMT Message-Id: <202102011305.111D5VpX026662@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 3728c4d31495 - stable/13 - diff: fix incorrectly displaying files as duplicates MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3728c4d3149553967532a97254737bdb2cd92417 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 13:05:32 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=3728c4d3149553967532a97254737bdb2cd92417 commit 3728c4d3149553967532a97254737bdb2cd92417 Author: Jamie Landeg-Jones AuthorDate: 2021-01-25 17:42:26 +0000 Commit: Baptiste Daroussin CommitDate: 2021-02-01 13:05:25 +0000 diff: fix incorrectly displaying files as duplicates When diff hits certain access errors, function diffreg() shows the error message, and then returns to the calling function, which calls print_status() with the return value. However, in these cases, the return value isn't changed from the initial default value of D_SAME. Normally, print_status() with a value of D_SAME does nothing, so this works out ok, however, if the "-s" flag is set, a message is displayed showing identicality: case D_SAME: if (sflag) printf("Files %s%s and %s%s are identical\n", path1, entry, path2, entry); break; This then produces such results as: % diff -s /COPYRIGHT /var/run/rpcbind.sock diff: /var/run/rpcbind.sock: Operation not supported Files /COPYRIGHT and /var/run/rpcbind.sock are identical % diff -s /COPYRIGHT /etc/master.passwd diff: /etc/master.passwd: Permission denied Files /COPYRIGHT and /etc/master.passwd are identical Create a D_ERROR status which is returned in such cases, and print_status() then deals with that status seperately from D_SAME PR: 252614 MFC after: 1 week (cherry picked from commit fefb3c46a80fdde6f307e73a2b5b5aed806df1ce) --- usr.bin/diff/diff.c | 2 ++ usr.bin/diff/diff.h | 1 + usr.bin/diff/diffreg.c | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c index 0e46b96f9667..1bad6226f49d 100644 --- a/usr.bin/diff/diff.c +++ b/usr.bin/diff/diff.c @@ -511,6 +511,8 @@ print_status(int val, char *path1, char *path2, const char *entry) printf("File %s%s is not a regular file or directory and was skipped\n", path2, entry); break; + case D_ERROR: + break; } } diff --git a/usr.bin/diff/diff.h b/usr.bin/diff/diff.h index 30387610fc19..1974b5cc08d6 100644 --- a/usr.bin/diff/diff.h +++ b/usr.bin/diff/diff.h @@ -83,6 +83,7 @@ #define D_MISMATCH2 4 /* path1 was a file, path2 a dir */ #define D_SKIPPED1 5 /* path1 was a special file */ #define D_SKIPPED2 6 /* path2 was a special file */ +#define D_ERROR 7 /* A file access error occurred */ struct excludes { char *pattern; diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index 7d2b20b43def..4e887ab27c7b 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -299,6 +299,7 @@ diffreg(char *file1, char *file2, int flags, int capsicum) if ((f1 = opentemp(file1)) == NULL || fstat(fileno(f1), &stb1) == -1) { warn("%s", file1); + rval = D_ERROR; status |= 2; goto closem; } @@ -309,6 +310,7 @@ diffreg(char *file1, char *file2, int flags, int capsicum) } if (f1 == NULL) { warn("%s", file1); + rval = D_ERROR; status |= 2; goto closem; } @@ -320,6 +322,7 @@ diffreg(char *file1, char *file2, int flags, int capsicum) if ((f2 = opentemp(file2)) == NULL || fstat(fileno(f2), &stb2) == -1) { warn("%s", file2); + rval = D_ERROR; status |= 2; goto closem; } @@ -330,6 +333,7 @@ diffreg(char *file1, char *file2, int flags, int capsicum) } if (f2 == NULL) { warn("%s", file2); + rval = D_ERROR; status |= 2; goto closem; } @@ -365,6 +369,7 @@ diffreg(char *file1, char *file2, int flags, int capsicum) break; default: /* error */ + rval = D_ERROR; status |= 2; goto closem; } From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 13:05:32 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 99089528258; Mon, 1 Feb 2021 13:05: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 4DTp8X01xtz3M4M; Mon, 1 Feb 2021 13:05:31 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B9BC51B764; Mon, 1 Feb 2021 13:05:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111D5UGd026645; Mon, 1 Feb 2021 13:05:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111D5Uom026644; Mon, 1 Feb 2021 13:05:30 GMT (envelope-from git) Date: Mon, 1 Feb 2021 13:05:30 GMT Message-Id: <202102011305.111D5Uom026644@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 0702bf9c495d - stable/13 - diff: add a test case for failed -s option MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0702bf9c495d517ef30432de1990f9a301598942 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 13:05:32 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=0702bf9c495d517ef30432de1990f9a301598942 commit 0702bf9c495d517ef30432de1990f9a301598942 Author: Baptiste Daroussin AuthorDate: 2021-01-25 17:40:12 +0000 Commit: Baptiste Daroussin CommitDate: 2021-02-01 13:05:24 +0000 diff: add a test case for failed -s option (cherry picked from commit 13860e71eb501f498a2263f44ea9244f6830b61c) --- usr.bin/diff/tests/diff_test.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/usr.bin/diff/tests/diff_test.sh b/usr.bin/diff/tests/diff_test.sh index 7ee88d1fe607..6da2bbaea34d 100755 --- a/usr.bin/diff/tests/diff_test.sh +++ b/usr.bin/diff/tests/diff_test.sh @@ -15,6 +15,7 @@ atf_test_case Nflag atf_test_case tabsize atf_test_case conflicting_format atf_test_case label +atf_test_case report_identical simple_body() { @@ -226,6 +227,15 @@ label_body() -s exit:1 diff --label hello --label world `which diff` `which ls` } +report_identical_body() +{ + printf "\tA\n" > A + printf "\tB\n" > B + chmod -r B + atf_check -s exit:2 -e inline:"diff: B: Permission denied\n" \ + -o empty diff -s A B +} + atf_init_test_cases() { atf_add_test_case simple @@ -243,4 +253,5 @@ atf_init_test_cases() atf_add_test_case tabsize atf_add_test_case conflicting_format atf_add_test_case label + atf_add_test_case report_identical } From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 13:52:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 76D0E52A5E3; Mon, 1 Feb 2021 13:52:45 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DTqC12Mvgz3R25; Mon, 1 Feb 2021 13:52:45 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 31B5226019D; Mon, 1 Feb 2021 14:52:42 +0100 (CET) Subject: Re: git: e92ab3adf4f9 - stable/13 - atomic: make atomic_store_ptr type-aware To: Mateusz Guzik , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org References: <202102011240.111CehGE094845@gitrepo.freebsd.org> From: Hans Petter Selasky Message-ID: <20583f6b-338b-21d6-5ae9-3e56488340d2@selasky.org> Date: Mon, 1 Feb 2021 14:52:29 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <202102011240.111CehGE094845@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DTqC12Mvgz3R25 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 13:52:45 -0000 On 2/1/21 1:40 PM, Mateusz Guzik wrote: > #define atomic_store_ptr(p, v) \ > - (*(volatile uintptr_t *)(p) = (uintptr_t)(v)) > + (*(volatile __typeof(*p) *)(p) = (v)) Are you missing an assert here? CASSERT(sizeof(*p) == sizeof(void *)); The way I read it atomic_store_ptr() can now store any type? --HPS From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 13:53:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7158F52A5F4; Mon, 1 Feb 2021 13:53:36 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DTqD02DNyz3QlN; Mon, 1 Feb 2021 13:53:35 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id D438C26019D; Mon, 1 Feb 2021 14:53:34 +0100 (CET) Subject: Re: git: fc301c224b27 - stable/13 - atomic: add stub atomic_load_consume_ptr To: Mateusz Guzik , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org References: <202102011240.111CeiX9094867@gitrepo.freebsd.org> From: Hans Petter Selasky Message-ID: <84f152e1-b1ed-b331-ab45-261dd3996903@selasky.org> Date: Mon, 1 Feb 2021 14:53:22 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <202102011240.111CeiX9094867@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DTqD02DNyz3QlN X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 13:53:36 -0000 On 2/1/21 1:40 PM, Mateusz Guzik wrote: > +/* > + * Currently all architectures provide acquire and release fences on their own, > + * but they don't provide consume. Kludge below allows relevant code to stop > + * openly resorting to the stronger acquire fence, to be sorted out. > + */ > +#define atomic_load_consume_ptr(p) \ > + ((__typeof(*p)) atomic_load_acq_ptr((uintptr_t *)p)) > + Are you missing: CTASSERT(sizeof(*p) == sizeof(void *)) ???? --HPS From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 13:56:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0638152A772 for ; Mon, 1 Feb 2021 13:56:00 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DTqGl6XTzz3RDQ for ; Mon, 1 Feb 2021 13:55:59 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f51.google.com with SMTP id u14so12716405wml.4 for ; Mon, 01 Feb 2021 05:55:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=R8/6DAYD7FaIAfNhFbxziww5jJQWPAUE5ZPZA3Kxl+Y=; b=ZWBKb2bml1clGdmzFQYfPFUJ+Eeqh2G6QDyCA2DgskE+f5snBKv+m88TQwRf3/ilXI HpKlY/yYuSELjmAbiKRRoSu/bMLrNCiwZXVF5Ed4KSJ3JywtXeLivEKioPE/jcnW7Dtc XYS4KuKkk/1jAFPQXQN0zxhdz27jlLObyQzYLxeppLNXyTuSc4B3UPXzA3F2MHI29ij0 ph6mx2VL56vUsppKNzEz5v8YQkxJeK3/BMWpPCpy4kf+im+zIywbDgQxwStVxIOT2WFZ Xy8jaWGakpuyhrSW25W9GrovK2gRqrjNxlhxyDL83vzicPyoJHemBNvTUCYIoR6EPZQS fvCQ== X-Gm-Message-State: AOAM532by41UbPO7UFwHjnoV52WP14NlHWi2lJT4SJFjBepGM4VWkHD4 n1DbXZzsqwfVH0W9+ZrXHR3PyA== X-Google-Smtp-Source: ABdhPJxGQ6h1Qng+YU28tNu8Jc35IsYv7ZJEa+RUSbFFf8i14eeC+gshJcRIfbgW9yLhOpn9MxKMJA== X-Received: by 2002:a1c:7d0c:: with SMTP id y12mr15172647wmc.184.1612187758125; Mon, 01 Feb 2021 05:55:58 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id b132sm21194988wmh.21.2021.02.01.05.55.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Feb 2021 05:55:57 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: fc301c224b27 - stable/13 - atomic: add stub atomic_load_consume_ptr From: Jessica Clarke In-Reply-To: <84f152e1-b1ed-b331-ab45-261dd3996903@selasky.org> Date: Mon, 1 Feb 2021 13:55:55 +0000 Cc: Mateusz Guzik , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-branches@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202102011240.111CeiX9094867@gitrepo.freebsd.org> <84f152e1-b1ed-b331-ab45-261dd3996903@selasky.org> To: Hans Petter Selasky X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4DTqGl6XTzz3RDQ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 13:56:00 -0000 On 1 Feb 2021, at 13:53, Hans Petter Selasky wrote: > On 2/1/21 1:40 PM, Mateusz Guzik wrote: >> +/* >> + * Currently all architectures provide acquire and release fences on = their own, >> + * but they don't provide consume. Kludge below allows relevant code = to stop >> + * openly resorting to the stronger acquire fence, to be sorted out. >> + */ >> +#define atomic_load_consume_ptr(p) \ >> + ((__typeof(*p)) atomic_load_acq_ptr((uintptr_t *)p)) >> + >=20 > Are you missing: >=20 > CTASSERT(sizeof(*p) =3D=3D sizeof(void *)) ???? I also commented on the head commit that this is a waste of time and will likely never be anything other than an acquire, but never got a reply. Jess From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 13:58:06 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 514A452AA95; Mon, 1 Feb 2021 13:58:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DTqKB1qwMz3gyv; Mon, 1 Feb 2021 13:58:06 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 317DE1C4AD; Mon, 1 Feb 2021 13:58:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111Dw6kQ091932; Mon, 1 Feb 2021 13:58:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111Dw60m091931; Mon, 1 Feb 2021 13:58:06 GMT (envelope-from git) Date: Mon, 1 Feb 2021 13:58:06 GMT Message-Id: <202102011358.111Dw60m091931@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 305b3ca5f40c - stable/12 - netgraph/ng_tag: permit variable length data MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 305b3ca5f40cbfff1e29f7e2e10a636331a8575c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 13:58:06 -0000 The branch stable/12 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=305b3ca5f40cbfff1e29f7e2e10a636331a8575c commit 305b3ca5f40cbfff1e29f7e2e10a636331a8575c Author: Lutz Donnerhacke AuthorDate: 2021-01-02 13:58:17 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-02-01 13:55:42 +0000 netgraph/ng_tag: permit variable length data ng_tag(4) operate on arbitrary data of mbuf_tags(9). Those structures are padded to the next multiple of the alignment by the compiler. Hence a valid argument has be at most as long as the data received. PR: 241462 Reviewed by: kp Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D22140 (cherry picked from commit 7c7c231c14246a709270bf3f3a4593208e84d01a) --- sys/netgraph/ng_tag.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/netgraph/ng_tag.c b/sys/netgraph/ng_tag.c index 9222d3bd3b20..bc3b39ec7f39 100644 --- a/sys/netgraph/ng_tag.c +++ b/sys/netgraph/ng_tag.c @@ -363,9 +363,8 @@ ng_tag_rcvmsg(node_p node, item_p item, hook_p lasthook) hook_p hook; /* Sanity check. */ - if (msg->header.arglen < sizeof(*hp) - || msg->header.arglen != - NG_TAG_HOOKIN_SIZE(hp->tag_len)) + if (msg->header.arglen < sizeof(*hp) || + msg->header.arglen < NG_TAG_HOOKIN_SIZE(hp->tag_len)) ERROUT(EINVAL); /* Find hook. */ @@ -385,9 +384,8 @@ ng_tag_rcvmsg(node_p node, item_p item, hook_p lasthook) hook_p hook; /* Sanity check. */ - if (msg->header.arglen < sizeof(*hp) - || msg->header.arglen != - NG_TAG_HOOKOUT_SIZE(hp->tag_len)) + if (msg->header.arglen < sizeof(*hp) || + msg->header.arglen < NG_TAG_HOOKOUT_SIZE(hp->tag_len)) ERROUT(EINVAL); /* Find hook. */ From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 14:08:07 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6F9EF52B607; Mon, 1 Feb 2021 14: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 4DTqXl2kG8z3hV5; Mon, 1 Feb 2021 14:08:07 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 507971C957; Mon, 1 Feb 2021 14:08:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111E879M004924; Mon, 1 Feb 2021 14:08:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111E87k3004923; Mon, 1 Feb 2021 14:08:07 GMT (envelope-from git) Date: Mon, 1 Feb 2021 14:08:07 GMT Message-Id: <202102011408.111E87k3004923@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 90d158c0cf25 - stable/11 - netgraph/ng_tag: permit variable length data MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 90d158c0cf2598fde2ea1c7cd58909cf5a21c471 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 14:08:07 -0000 The branch stable/11 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=90d158c0cf2598fde2ea1c7cd58909cf5a21c471 commit 90d158c0cf2598fde2ea1c7cd58909cf5a21c471 Author: Lutz Donnerhacke AuthorDate: 2021-01-02 13:58:17 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-02-01 14:07:31 +0000 netgraph/ng_tag: permit variable length data ng_tag(4) operate on arbitrary data of mbuf_tags(9). Those structures are padded to the next multiple of the alignment by the compiler. Hence a valid argument has be at most as long as the data received. PR: 241462 Reviewed by: kp Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D22140 (cherry picked from commit 7c7c231c14246a709270bf3f3a4593208e84d01a) --- sys/netgraph/ng_tag.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/netgraph/ng_tag.c b/sys/netgraph/ng_tag.c index 22d45a3174ad..1a9d44528a24 100644 --- a/sys/netgraph/ng_tag.c +++ b/sys/netgraph/ng_tag.c @@ -361,9 +361,8 @@ ng_tag_rcvmsg(node_p node, item_p item, hook_p lasthook) hook_p hook; /* Sanity check. */ - if (msg->header.arglen < sizeof(*hp) - || msg->header.arglen != - NG_TAG_HOOKIN_SIZE(hp->tag_len)) + if (msg->header.arglen < sizeof(*hp) || + msg->header.arglen < NG_TAG_HOOKIN_SIZE(hp->tag_len)) ERROUT(EINVAL); /* Find hook. */ @@ -383,9 +382,8 @@ ng_tag_rcvmsg(node_p node, item_p item, hook_p lasthook) hook_p hook; /* Sanity check. */ - if (msg->header.arglen < sizeof(*hp) - || msg->header.arglen != - NG_TAG_HOOKOUT_SIZE(hp->tag_len)) + if (msg->header.arglen < sizeof(*hp) || + msg->header.arglen < NG_TAG_HOOKOUT_SIZE(hp->tag_len)) ERROUT(EINVAL); /* Find hook. */ From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 14:54:49 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 466D452CAD4; Mon, 1 Feb 2021 14:54:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DTrZd1Yzpz3mgf; Mon, 1 Feb 2021 14:54:49 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 21E031D247; Mon, 1 Feb 2021 14:54:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111EsnJA070298; Mon, 1 Feb 2021 14:54:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111EsnaN070297; Mon, 1 Feb 2021 14:54:49 GMT (envelope-from git) Date: Mon, 1 Feb 2021 14:54:49 GMT Message-Id: <202102011454.111EsnaN070297@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 14640ac7897b - stable/13 - bsdinstall: create /efi/boot directory in ESP MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 14640ac7897b79d49e97e5c571f05ae563f4a8e2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 14:54:49 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=14640ac7897b79d49e97e5c571f05ae563f4a8e2 commit 14640ac7897b79d49e97e5c571f05ae563f4a8e2 Author: Mitchell Horne AuthorDate: 2021-01-15 16:14:27 +0000 Commit: Mitchell Horne CommitDate: 2021-02-01 14:53:21 +0000 bsdinstall: create /efi/boot directory in ESP If the installer is creating a new ESP, then this directory will not exist and the subsequent cp will fail silently. This is usually of no consequence if /efi/freebsd/loader.efi is set up correctly. Reviewed by: imp (cherry picked from commit 676b7d077c2c5f548334cea7fccfbfb5d097c9df) --- usr.sbin/bsdinstall/scripts/bootconfig | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/bootconfig b/usr.sbin/bsdinstall/scripts/bootconfig index 93a3bc0a53c2..1593545a1c2e 100755 --- a/usr.sbin/bsdinstall/scripts/bootconfig +++ b/usr.sbin/bsdinstall/scripts/bootconfig @@ -131,7 +131,10 @@ if [ "$(uname -m)" = "arm64" ] || [ "$X86_BOOTMETHOD" = "UEFI" ]; then # i386) ARCHBOOTNAME=ia32 ;; # no support for this in i386 kernels, rare machines *) die "Unsupported arch $(uname -m) for UEFI install" esac - BOOTNAME="/EFI/BOOT/BOOT${ARCHBOOTNAME}.EFI" + BOOTDIR="/efi/boot" + BOOTNAME="${BOOTDIR}/boot${ARCHBOOTNAME}.efi" + FREEBSD_BOOTDIR="/efi/freebsd" + FREEBSD_BOOTNAME="${FREEBSD_BOOTDIR}/loader.efi" for esp in $ESPS; do f_dprintf "Formatting /dev/${esp} as FAT32" @@ -148,8 +151,8 @@ if [ "$(uname -m)" = "arm64" ] || [ "$X86_BOOTMETHOD" = "UEFI" ]; then fi f_dprintf "Installing loader.efi onto ESP" - mkdir -p "$mntpt/EFI/freebsd" - cp "$BSDINSTALL_CHROOT/boot/loader.efi" "${mntpt}/EFI/freebsd/loader.efi" + mkdir -p "${mntpt}/${FREEBSD_BOOTDIR}" "${mntpt}/${BOOTDIR}" + cp "$BSDINSTALL_CHROOT/boot/loader.efi" "${mntpt}/${FREEBSD_BOOTNAME}" # # The following shouldn't be necessary. UEFI defines a way to @@ -173,7 +176,7 @@ if [ "$(uname -m)" = "arm64" ] || [ "$X86_BOOTMETHOD" = "UEFI" ]; then fi f_dprintf "Creating UEFI boot entry" - efibootmgr --create --activate --label "$bootlabel" --loader "${mntpt}/EFI/freebsd/loader.efi" > /dev/null + efibootmgr --create --activate --label "$bootlabel" --loader "${mntpt}/${FREEBSD_BOOTNAME}" > /dev/null f_dprintf "Unmounting ESP" umount "${mntpt}" From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 14:54:50 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 532B352C7FB; Mon, 1 Feb 2021 14:54:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DTrZf1vmVz3mKD; Mon, 1 Feb 2021 14:54:50 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 343851D248; Mon, 1 Feb 2021 14:54:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111EsojU070321; Mon, 1 Feb 2021 14:54:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111EsoqQ070320; Mon, 1 Feb 2021 14:54:50 GMT (envelope-from git) Date: Mon, 1 Feb 2021 14:54:50 GMT Message-Id: <202102011454.111EsoqQ070320@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: c415d0df47fc - stable/13 - bsdinstall: riscv-specific tweaks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c415d0df47fc4b144c029263fac47ad4df81a803 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 14:54:50 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=c415d0df47fc4b144c029263fac47ad4df81a803 commit c415d0df47fc4b144c029263fac47ad4df81a803 Author: Mitchell Horne AuthorDate: 2021-01-15 16:34:54 +0000 Commit: Mitchell Horne CommitDate: 2021-02-01 14:54:09 +0000 bsdinstall: riscv-specific tweaks Make the installer more useful, by allowing it to create a bootable installation. Also, enable the menu option for ZFS-on-root. Like arm64, RISC-V boots by UEFI only, so arm64's partedit implementation is renamed and shared among the two platforms. Reviewed by: gjb (cherry picked from commit 7b08a307e88bb1abe17d13d11288392a8e4739ce) --- usr.sbin/bsdinstall/partedit/Makefile | 2 ++ usr.sbin/bsdinstall/partedit/{partedit_arm64.c => partedit_efi.c} | 7 ++++++- usr.sbin/bsdinstall/scripts/auto | 2 +- usr.sbin/bsdinstall/scripts/bootconfig | 3 ++- usr.sbin/bsdinstall/scripts/zfsboot | 4 ++-- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/usr.sbin/bsdinstall/partedit/Makefile b/usr.sbin/bsdinstall/partedit/Makefile index 7d8f0659da25..a250302a1962 100644 --- a/usr.sbin/bsdinstall/partedit/Makefile +++ b/usr.sbin/bsdinstall/partedit/Makefile @@ -10,6 +10,8 @@ LIBADD+= geom ncursesw util dialog m PARTEDIT_ARCH= ${MACHINE} .if ${MACHINE} == "i386" || ${MACHINE} == "amd64" PARTEDIT_ARCH= x86 +.elif ${MACHINE} == "arm64" || ${MACHINE} == "riscv" +PARTEDIT_ARCH= efi .endif .if !exists(partedit_${PARTEDIT_ARCH}.c) PARTEDIT_ARCH= generic diff --git a/usr.sbin/bsdinstall/partedit/partedit_arm64.c b/usr.sbin/bsdinstall/partedit/partedit_efi.c similarity index 92% rename from usr.sbin/bsdinstall/partedit/partedit_arm64.c rename to usr.sbin/bsdinstall/partedit/partedit_efi.c index 934cd30c72f9..85b3b15d1853 100644 --- a/usr.sbin/bsdinstall/partedit/partedit_arm64.c +++ b/usr.sbin/bsdinstall/partedit/partedit_efi.c @@ -34,6 +34,11 @@ #include "partedit.h" +/* + * partedit implementation for platforms on which the installer only offers + * UEFI-based boot. Currently, this includes arm64 and RISC-V. + */ + /* EFI partition size in bytes */ #define EFI_BOOTPART_SIZE (260 * 1024 * 1024) @@ -94,7 +99,7 @@ const char * partcode_path(const char *part_type, const char *fs_type) { - /* No boot partition data for ARM64 */ + /* No boot partition data. */ return (NULL); } diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto index a58a63f2f70c..58e74acb2d92 100755 --- a/usr.sbin/bsdinstall/scripts/auto +++ b/usr.sbin/bsdinstall/scripts/auto @@ -301,7 +301,7 @@ PMODES=" CURARCH=$( uname -m ) case $CURARCH in - amd64|arm64|i386) # Booting ZFS Supported + amd64|arm64|i386|riscv) # Booting ZFS Supported PMODES=" '$msg_auto_zfs' '$msg_auto_zfs_desc' '$msg_auto_zfs_help' $PMODES diff --git a/usr.sbin/bsdinstall/scripts/bootconfig b/usr.sbin/bsdinstall/scripts/bootconfig index 1593545a1c2e..f07fb3065c23 100755 --- a/usr.sbin/bsdinstall/scripts/bootconfig +++ b/usr.sbin/bsdinstall/scripts/bootconfig @@ -51,7 +51,7 @@ if [ "$(uname -m)" = "amd64" ] || [ "$(uname -m)" = "i386" ]; then X86_BOOTMETHOD=$(sysctl -n machdep.bootmethod) fi -if [ "$(uname -m)" = "arm64" ] || [ "$X86_BOOTMETHOD" = "UEFI" ]; then +if [ "$(uname -m)" = "arm64" ] || [ "$(uname -m)" = "riscv" ] || [ "$X86_BOOTMETHOD" = "UEFI" ]; then UFSBOOT_ESPS=$(cat $TMPDIR/bsdinstall-esps 2>/dev/null) ZFSBOOT_DISKS=$(cat $TMPDIR/bsdinstall-zfsboot 2>/dev/null) num_esps=0 @@ -127,6 +127,7 @@ if [ "$(uname -m)" = "arm64" ] || [ "$X86_BOOTMETHOD" = "UEFI" ]; then case $(uname -m) in arm64) ARCHBOOTNAME=aa64 ;; amd64) ARCHBOOTNAME=x64 ;; + riscv) ARCHBOOTNAME=riscv64 ;; # arm) ARCHBOOTNAME=arm ;; # No other support for arm install # i386) ARCHBOOTNAME=ia32 ;; # no support for this in i386 kernels, rare machines *) die "Unsupported arch $(uname -m) for UEFI install" diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot index eef482b806c5..33cec0ef9ae9 100755 --- a/usr.sbin/bsdinstall/scripts/zfsboot +++ b/usr.sbin/bsdinstall/scripts/zfsboot @@ -1554,8 +1554,8 @@ f_dprintf "FSTAB_FMT=[%s]" "$FSTAB_FMT" # Determine default boot type # case $(uname -m) in -arm64) - # We support only UEFI boot for arm64 +arm64|riscv) + # We support only UEFI boot for arm64 and riscv. : ${ZFSBOOT_BOOT_TYPE:=UEFI} : ${ZFSBOOT_PARTITION_SCHEME:=GPT} ;; From owner-dev-commits-src-branches@freebsd.org Mon Feb 1 22:31:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 193BE4E98A3; Mon, 1 Feb 2021 22:31: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 4DV2k70Jc3z3L7X; Mon, 1 Feb 2021 22:31:59 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 F17C923337; Mon, 1 Feb 2021 22:31:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111MVwAx070279; Mon, 1 Feb 2021 22:31:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111MVw2D070278; Mon, 1 Feb 2021 22:31:58 GMT (envelope-from git) Date: Mon, 1 Feb 2021 22:31:58 GMT Message-Id: <202102012231.111MVw2D070278@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: f19a4e97d3b0 - stable/13 - newvers: tweak uname to be more useful MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f19a4e97d3b0905dfda5aaebba49f68a1e07fa3e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 22:31:59 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f19a4e97d3b0905dfda5aaebba49f68a1e07fa3e commit f19a4e97d3b0905dfda5aaebba49f68a1e07fa3e Author: Warner Losh AuthorDate: 2021-01-25 19:53:31 +0000 Commit: Warner Losh CommitDate: 2021-02-01 22:31:35 +0000 newvers: tweak uname to be more useful The current uname is branch-cXXXX-gHASH Three changes to make uname more useful. 1. Move from using git rev-list --count to git rev-lis --count --first-parent since that gives a better, incrementing number. 2. Report this count as 'nXXXXX' rather than 'cXXXXX' because c is part of a hash and we've changed the sematnics of XXXXX 3. Remove g to make HASH cut and pastable. Durting review, #1 & #3 had the largest consensus. There was a diversity of opinion on #2, but on the whole it was positive so I'll acknowledge the dissent, but move forward with something seems to have support since the dissent was all about what letter to use where I chose 'n'. MFC After: 3 days Reviewed by: rgrimes, emaste (earlier version) Differential Revision: https://reviews.freebsd.org/D28338 (cherry picked from commit 8a51f14a7833fd14e1f125e63a0af9d260dcd287) --- sys/conf/newvers.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index a40392d91b9b..12d4daa771be 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -253,9 +253,9 @@ fi if [ -n "$git_cmd" ] ; then git=$($git_cmd rev-parse --verify --short HEAD 2>/dev/null) if [ "$($git_cmd rev-parse --is-shallow-repository)" = false ] ; then - git_cnt=$($git_cmd rev-list --count HEAD 2>/dev/null) + git_cnt=$($git_cmd rev-list --first-parent --count HEAD 2>/dev/null) if [ -n "$git_cnt" ] ; then - git="c${git_cnt}-g${git}" + git="n${git_cnt}-${git}" fi fi git_b=$($git_cmd rev-parse --abbrev-ref HEAD) From owner-dev-commits-src-branches@freebsd.org Tue Feb 2 12:02:02 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 07EB452F8FD; Tue, 2 Feb 2021 12:02: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 4DVNhn6KVDz4tBn; Tue, 2 Feb 2021 12:02:01 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CB8845E14; Tue, 2 Feb 2021 12:02:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 112C21eB024026; Tue, 2 Feb 2021 12:02:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 112C21tU024025; Tue, 2 Feb 2021 12:02:01 GMT (envelope-from git) Date: Tue, 2 Feb 2021 12:02:01 GMT Message-Id: <202102021202.112C21tU024025@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: ffd05df71796 - stable/13 - LinuxKPI: add firmware loading support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ffd05df71796ff4cd56c3f8ef109d00165a9c10a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2021 12:02:02 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=ffd05df71796ff4cd56c3f8ef109d00165a9c10a commit ffd05df71796ff4cd56c3f8ef109d00165a9c10a Author: Bjoern A. Zeeb AuthorDate: 2021-01-28 16:05:32 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-02-02 11:50:38 +0000 LinuxKPI: add firmware loading support Implement linux firmware KPI compat code. This includes: request_firmware() request_firmware_nowait(), request_firmware_direct(), firmware_request_nowarn(), and release_firmware(). Given we will try to map requested names from natively ported or full-linuxkpi-using drivers to a firmware(9) auto-loading name format (.ko file name and image name matching), we quieten firmware(9) and print success or failure (unless the _nowarn() version was called) in the linuxkpi implementation. At the moment we try up-to 4 different naming combinations, with path stripped, original name, and requested name with '/' or '.' replaced. We do not currently defer loading in the "nowait" case. Sponsored-by: The FreeBSD Foundation Sponsored-by: Rubicon Communications, LLC ("Netgate") (firmware(9) nowarn update from D27413) MFC after: 3 days Reviewed by: kib, manu (looked at older versions) Differential Revision: https://reviews.freebsd.org/D27414 (cherry picked from commit a6c2507d1baedb183268e31bc6b6f659a9529904) (cherry picked from commit 4a26380ba6dc487a7525d909ee29fbc710b558d1) --- .../linuxkpi/common/include/linux/firmware.h | 105 ++++++++++++ sys/compat/linuxkpi/common/src/linux_firmware.c | 178 +++++++++++++++++++++ sys/compat/linuxkpi/common/src/linux_kmod.c | 1 + sys/conf/files | 2 + sys/modules/linuxkpi/Makefile | 1 + 5 files changed, 287 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/firmware.h b/sys/compat/linuxkpi/common/include/linux/firmware.h new file mode 100644 index 000000000000..ada7d0d73edf --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/firmware.h @@ -0,0 +1,105 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020-2021 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb 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. + * + * $FreeBSD$ + */ + +#ifndef _LINUXKPI_LINUX_FIRMWARE_H +#define _LINUXKPI_LINUX_FIRMWARE_H + +#include +#include +#include + +struct firmware; + +struct linuxkpi_firmware { + size_t size; + const uint8_t *data; + /* XXX Does Linux expose anything else? */ + + /* This is LinuxKPI implementation private. */ + const struct firmware *fbdfw; +}; + +int linuxkpi_request_firmware_nowait(struct module *, bool, const char *, + struct device *, gfp_t, void *, + void(*cont)(const struct linuxkpi_firmware *, void *)); +int linuxkpi_request_firmware(const struct linuxkpi_firmware **, + const char *, struct device *); +int linuxkpi_firmware_request_nowarn(const struct linuxkpi_firmware **, + const char *, struct device *); +void linuxkpi_release_firmware(const struct linuxkpi_firmware *); + + +static __inline int +request_firmware_nowait(struct module *mod, bool _t, + const char *fw_name, struct device *dev, gfp_t gfp, void *drv, + void(*cont)(const struct linuxkpi_firmware *, void *)) +{ + + + return (linuxkpi_request_firmware_nowait(mod, _t, fw_name, dev, gfp, + drv, cont)); +} + +static __inline int +request_firmware(const struct linuxkpi_firmware **fw, + const char *fw_name, struct device *dev) +{ + + return (linuxkpi_request_firmware(fw, fw_name, dev)); +} + +static __inline int +request_firmware_direct(const struct linuxkpi_firmware **fw, + const char *fw_name, struct device *dev) +{ + + return (linuxkpi_request_firmware(fw, fw_name, dev)); +} + +static __inline int +firmware_request_nowarn(const struct linuxkpi_firmware **fw, + const char *fw_name, struct device *dev) +{ + + return (linuxkpi_firmware_request_nowarn(fw, fw_name, dev)); +} + +static __inline void +release_firmware(const struct linuxkpi_firmware *fw) +{ + + linuxkpi_release_firmware(fw); +} + +#define firmware linuxkpi_firmware + +#endif /* _LINUXKPI_LINUX_FIRMWARE_H */ diff --git a/sys/compat/linuxkpi/common/src/linux_firmware.c b/sys/compat/linuxkpi/common/src/linux_firmware.c new file mode 100644 index 000000000000..75147a311827 --- /dev/null +++ b/sys/compat/linuxkpi/common/src/linux_firmware.c @@ -0,0 +1,178 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020-2021 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb 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. + * + * $FreeBSD$ + */ + +#include +#include +#include + +#include +#include + +#include +#undef firmware + +MALLOC_DEFINE(M_LKPI_FW, "lkpifw", "LinuxKPI firmware"); + +static int +_linuxkpi_request_firmware(const char *fw_name, const struct linuxkpi_firmware **fw, + struct device *dev, gfp_t gfp __unused, bool enoentok, bool warn) +{ + const struct firmware *fbdfw; + struct linuxkpi_firmware *lfw; + const char *fwimg; + char *p; + uint32_t flags; + + if (fw_name == NULL || fw == NULL || dev == NULL) + return (-EINVAL); + + /* Set independent on "warn". To debug, bootverbose is avail. */ + flags = FIRMWARE_GET_NOWARN; + + KASSERT(gfp == GFP_KERNEL, ("%s: gfp %#x\n", __func__, gfp)); + lfw = malloc(sizeof(*lfw), M_LKPI_FW, M_WAITOK | M_ZERO); + + /* + * Linux can have a path in the firmware which is hard to replicate + * for auto-firmware-module-loading. + * On FreeBSD, depending on what people do, the firmware will either + * be called "fw", or "dir_fw", or "modname_dir_fw". The latter the + * driver author has to deal with herself (requesting the special name). + * We also optionally flatten '/'s and '.'s as some firmware modules do. + * We probe in the least-of-work order avoiding memory operations. + * It will be preferred to build the firmware .ko in a well matching + * way rather than adding more name-mangling-hacks here in the future + * (though we could if needed). + */ + /* (1) Try any name removed of path. */ + fwimg = strrchr(fw_name, '/'); + if (fwimg != NULL) + fwimg++; + if (fwimg == NULL || *fwimg == '\0') + fwimg = fw_name; + fbdfw = firmware_get_flags(fwimg, flags); + /* (2) Try the original name if we have not yet. */ + if (fbdfw == NULL && fwimg != fw_name) { + fwimg = fw_name; + fbdfw = firmware_get_flags(fwimg, flags); + } + /* (3) Flatten '/' and then '.' to '_' and try with adjusted name. */ + if (fbdfw == NULL && + (strchr(fw_name, '/') != NULL || strchr(fw_name, '.') != NULL)) { + fwimg = strdup(fw_name, M_LKPI_FW); + if (fwimg != NULL) { + while ((p = strchr(fwimg, '/')) != NULL) + *p = '_'; + fbdfw = firmware_get_flags(fwimg, flags); + if (fbdfw == NULL) { + while ((p = strchr(fwimg, '.')) != NULL) + *p = '_'; + fbdfw = firmware_get_flags(fwimg, flags); + } + free(__DECONST(void *, fwimg), M_LKPI_FW); + } + } + if (fbdfw == NULL) { + if (enoentok) + *fw = lfw; + else { + free(lfw, M_LKPI_FW); + *fw = NULL; + } + if (warn) + device_printf(dev->bsddev, "could not load firmware " + "image '%s'\n", fw_name); + return (-ENOENT); + } + + device_printf(dev->bsddev,"successfully loaded firmware image '%s'\n", + fw_name); + lfw->fbdfw = fbdfw; + lfw->data = (const uint8_t *)fbdfw->data; + lfw->size = fbdfw->datasize; + *fw = lfw; + return (0); +} + +int +linuxkpi_request_firmware_nowait(struct module *mod __unused, bool _t __unused, + const char *fw_name, struct device *dev, gfp_t gfp, void *drv, + void(*cont)(const struct linuxkpi_firmware *, void *)) +{ + const struct linuxkpi_firmware *lfw; + int error; + + /* + * Linux seems to run the callback if it cannot find the firmware. + * The fact that this is "_nowait()" and has a callback seems to + * imply that this is run in a deferred conext which we currently + * do not do. Should it become necessary (a driver actually requiring + * it) we would need to implement it here. + */ + error = _linuxkpi_request_firmware(fw_name, &lfw, dev, gfp, true, true); + if (error == -ENOENT) + error = 0; + if (error == 0) + cont(lfw, drv); + + return (error); +} + +int +linuxkpi_request_firmware(const struct linuxkpi_firmware **fw, + const char *fw_name, struct device *dev) +{ + + return (_linuxkpi_request_firmware(fw_name, fw, dev, GFP_KERNEL, false, + true)); +} + +int +linuxkpi_firmware_request_nowarn(const struct linuxkpi_firmware **fw, + const char *fw_name, struct device *dev) +{ + + return (_linuxkpi_request_firmware(fw_name, fw, dev, GFP_KERNEL, false, + false)); +} + +void +linuxkpi_release_firmware(const struct linuxkpi_firmware *fw) +{ + + if (fw == NULL) + return; + + if (fw->fbdfw) + firmware_put(fw->fbdfw, FIRMWARE_UNLOAD); + free(__DECONST(void *, fw), M_LKPI_FW); +} diff --git a/sys/compat/linuxkpi/common/src/linux_kmod.c b/sys/compat/linuxkpi/common/src/linux_kmod.c index b9a916da650f..7fd73f0a7f45 100644 --- a/sys/compat/linuxkpi/common/src/linux_kmod.c +++ b/sys/compat/linuxkpi/common/src/linux_kmod.c @@ -31,5 +31,6 @@ __FBSDID("$FreeBSD$"); #include MODULE_VERSION(linuxkpi, 1); +MODULE_DEPEND(linuxkpi, firmware, 1, 1, 1); MODULE_DEPEND(linuxkpi, backlight, 1, 1, 1); MODULE_DEPEND(linuxkpi, pci, 1, 1, 1); diff --git a/sys/conf/files b/sys/conf/files index 552c496e922a..c7f6e97a6172 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4558,6 +4558,8 @@ compat/linuxkpi/common/src/linux_current.c optional compat_linuxkpi \ compile-with "${LINUXKPI_C}" compat/linuxkpi/common/src/linux_dmi.c optional compat_linuxkpi \ compile-with "${LINUXKPI_C}" +compat/linuxkpi/common/src/linux_firmware.c optional compat_linuxkpi \ + compile-with "${LINUXKPI_C}" compat/linuxkpi/common/src/linux_hrtimer.c optional compat_linuxkpi \ compile-with "${LINUXKPI_C}" compat/linuxkpi/common/src/linux_kthread.c optional compat_linuxkpi \ diff --git a/sys/modules/linuxkpi/Makefile b/sys/modules/linuxkpi/Makefile index f9ae0e60e339..7bb4080fa81d 100644 --- a/sys/modules/linuxkpi/Makefile +++ b/sys/modules/linuxkpi/Makefile @@ -5,6 +5,7 @@ KMOD= linuxkpi SRCS= linux_compat.c \ linux_current.c \ linux_dmi.c \ + linux_firmware.c \ linux_hrtimer.c \ linux_idr.c \ linux_kmod.c \ From owner-dev-commits-src-branches@freebsd.org Tue Feb 2 12:02:03 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5AEF852FB84; Tue, 2 Feb 2021 12:02:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DVNhq1516z4t68; Tue, 2 Feb 2021 12:02:03 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 15E2B6004; Tue, 2 Feb 2021 12:02:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 112C22tm024049; Tue, 2 Feb 2021 12:02:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 112C22KH024048; Tue, 2 Feb 2021 12:02:02 GMT (envelope-from git) Date: Tue, 2 Feb 2021 12:02:02 GMT Message-Id: <202102021202.112C22KH024048@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: ec06521ee872 - stable/13 - LinuxKPI: upstream a collection of drm-kmod conflicting changes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ec06521ee8728a8d3321bc8eb115a425524dd968 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2021 12:02:03 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=ec06521ee8728a8d3321bc8eb115a425524dd968 commit ec06521ee8728a8d3321bc8eb115a425524dd968 Author: Bjoern A. Zeeb AuthorDate: 2021-01-28 16:15:12 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-02-02 11:51:15 +0000 LinuxKPI: upstream a collection of drm-kmod conflicting changes The upcoming in-kernel implementations for LinuxKPI based on work on iwlwifi (and other wireless drivers) conflicts in a few places with the drm-kmod graphics work outside the base system. In order to transition smoothly extract the conflicting bits. This included "unaligned" accessor functions, sg_pcopy_from_buffer(), IS_*() macros (to be further restricted in the future), power management bits (possibly no longer conflicting with DRM), and other minor changes. Obtained-from: bz_iwlwifi Sponsored-by: The FreeBSD Foundation MFC after: 3 days Reviewed by: kib, hselasky, manu, bdragon (looked at earlier versions) Differential Revision: https://reviews.freebsd.org/D26598 (cherry picked from commit 4abbf816bf06aa70200c5d1d976dd61c2752bdaf) --- sys/compat/linuxkpi/common/include/asm/unaligned.h | 78 ++++++++++++++++++++++ sys/compat/linuxkpi/common/include/linux/kernel.h | 42 ++++++++++++ sys/compat/linuxkpi/common/include/linux/kobject.h | 14 ++++ sys/compat/linuxkpi/common/include/linux/lockdep.h | 1 + sys/compat/linuxkpi/common/include/linux/pm.h | 52 +++++++++++++++ .../linuxkpi/common/include/linux/scatterlist.h | 54 +++++++++++++++ 6 files changed, 241 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/asm/unaligned.h b/sys/compat/linuxkpi/common/include/asm/unaligned.h new file mode 100644 index 000000000000..7597f00f7596 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/asm/unaligned.h @@ -0,0 +1,78 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb 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. + * + * $FreeBSD$ + */ + +#ifndef _ASM_UNALIGNED_H +#define _ASM_UNALIGNED_H + +#include +#include + +static __inline uint32_t +get_unaligned_le32(const void *p) +{ + + return (le32_to_cpup((const __le32 *)p)); +} + +static __inline void +put_unaligned_le32(__le32 v, void *p) +{ + __le32 x; + + x = cpu_to_le32(v); + memcpy(p, &x, sizeof(x)); +} + +static __inline void +put_unaligned_le64(__le64 v, void *p) +{ + __le64 x; + + x = cpu_to_le64(v); + memcpy(p, &x, sizeof(x)); +} + +static __inline uint16_t +get_unaligned_be16(const void *p) +{ + + return (be16_to_cpup((const __be16 *)p)); +} + +static __inline uint32_t +get_unaligned_be32(const void *p) +{ + + return (be32_to_cpup((const __be32 *)p)); +} + +#endif /* _ASM_UNALIGNED_H */ diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h index 9b0a2df72322..daef6216a151 100644 --- a/sys/compat/linuxkpi/common/include/linux/kernel.h +++ b/sys/compat/linuxkpi/common/include/linux/kernel.h @@ -593,4 +593,46 @@ linux_ratelimited(linux_ratelimit_t *rl) #define TAINT_WARN 0 #define test_taint(x) (0) +/* + * Checking if an option is defined would be easy if we could do CPP inside CPP. + * The defined case whether -Dxxx or -Dxxx=1 are easy to deal with. In either + * case the defined value is "1". A more general -Dxxx= case will require + * more effort to deal with all possible "true" values. Hope we do not have + * to do this as well. + * The real problem is the undefined case. To avoid this problem we do the + * concat/varargs trick: "yyy" ## xxx can make two arguments if xxx is "1" + * by having a #define for yyy_1 which is "ignore,". + * Otherwise we will just get "yyy". + * Need to be careful about variable substitutions in macros though. + * This way we make a (true, false) problem a (don't care, true, false) or a + * (don't care true, false). Then we can use a variadic macro to only select + * the always well known and defined argument #2. And that seems to be + * exactly what we need. Use 1 for true and 0 for false to also allow + * #if IS_*() checks pre-compiler checks which do not like #if true. + */ +#define ___XAB_1 dontcare, +#define ___IS_XAB(_ignore, _x, ...) (_x) +#define __IS_XAB(_x) ___IS_XAB(_x 1, 0) +#define _IS_XAB(_x) __IS_XAB(__CONCAT(___XAB_, _x)) + +/* This is if CONFIG_ccc=y. */ +#define IS_BUILTIN(_x) _IS_XAB(_x) +/* This is if CONFIG_ccc=m. */ +#define IS_MODULE(_x) _IS_XAB(_x ## _MODULE) +/* This is if CONFIG_ccc is compiled in(=y) or a module(=m). */ +#define IS_ENABLED(_x) (IS_BUILTIN(_x) || IS_MODULE(_x)) +/* + * This is weird case. If the CONFIG_ccc is builtin (=y) this returns true; + * or if the CONFIG_ccc is a module (=m) and the caller is built as a module + * (-DMODULE defined) this returns true, but if the callers is not a module + * (-DMODULE not defined, which means caller is BUILTIN) then it returns + * false. In other words, a module can reach the kernel, a module can reach + * a module, but the kernel cannot reach a module, and code never compiled + * cannot be reached either. + * XXX -- I'd hope the module-to-module case would be handled by a proper + * module dependency definition (MODULE_DEPEND() in FreeBSD). + */ +#define IS_REACHABLE(_x) (IS_BUILTIN(_x) || \ + (IS_MODULE(_x) && IS_BUILTIN(MODULE))) + #endif /* _LINUX_KERNEL_H_ */ diff --git a/sys/compat/linuxkpi/common/include/linux/kobject.h b/sys/compat/linuxkpi/common/include/linux/kobject.h index bd9e1c4ec6f5..403ec1495c32 100644 --- a/sys/compat/linuxkpi/common/include/linux/kobject.h +++ b/sys/compat/linuxkpi/common/include/linux/kobject.h @@ -41,6 +41,8 @@ struct kobject; struct sysctl_oid; +#define KOBJ_CHANGE 0x01 + struct kobj_type { void (*release)(struct kobject *kobj); const struct sysfs_ops *sysfs_ops; @@ -151,4 +153,16 @@ int kobject_set_name(struct kobject *kobj, const char *fmt, ...); int kobject_init_and_add(struct kobject *kobj, const struct kobj_type *ktype, struct kobject *parent, const char *fmt, ...); +static __inline void +kobject_uevent_env(struct kobject *kobj, int action, char *envp[]) +{ + + /* + * iwlwifi(4) sends an INACCESSIBLE event when it detects that the card + * (pice endpoint) is gone and it attempts a removal cleanup. + * Not sure if we do anything related to udev/sysfs at the moment or + * need a shortcut or simply ignore it (for now). + */ +} + #endif /* _LINUX_KOBJECT_H_ */ diff --git a/sys/compat/linuxkpi/common/include/linux/lockdep.h b/sys/compat/linuxkpi/common/include/linux/lockdep.h index d2b3d4485dde..a86157ba5924 100644 --- a/sys/compat/linuxkpi/common/include/linux/lockdep.h +++ b/sys/compat/linuxkpi/common/include/linux/lockdep.h @@ -42,6 +42,7 @@ struct lock_class_key { #define lockdep_set_class_and_name(lock, key, name) #define lockdep_set_current_reclaim_state(g) do { } while (0) #define lockdep_clear_current_reclaim_state() do { } while (0) +#define lockdep_init_map(_map, _name, _key, _x) do { } while(0) #ifdef INVARIANTS #define lockdep_assert_held(m) do { \ diff --git a/sys/compat/linuxkpi/common/include/linux/pm.h b/sys/compat/linuxkpi/common/include/linux/pm.h new file mode 100644 index 000000000000..6b8a7e768a8c --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/pm.h @@ -0,0 +1,52 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb 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. + * + * $FreeBSD$ + */ + +#ifndef _LINUXKPI_LINUX_PM_H +#define _LINUXKPI_LINUX_PM_H + +#ifdef CONFIG_PM_SLEEP +#define SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \ +const struct dev_pm_ops _name = { \ + .suspend = _suspendfunc, \ + .resume = _resumefunc, \ + .freeze = _suspendfunc, \ + .thaw = _resumefunc, \ + .poweroff = _suspendfunc, \ + .restore = _resumefunc, \ +} +#else +#define SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \ +const struct dev_pm_ops _name = { \ +} +#endif + +#endif /* _LINUXKPI_LINUX_PM_H */ diff --git a/sys/compat/linuxkpi/common/include/linux/scatterlist.h b/sys/compat/linuxkpi/common/include/linux/scatterlist.h index 9104cb8dd78a..ebf0632f6f58 100644 --- a/sys/compat/linuxkpi/common/include/linux/scatterlist.h +++ b/sys/compat/linuxkpi/common/include/linux/scatterlist.h @@ -32,6 +32,9 @@ #ifndef _LINUX_SCATTERLIST_H_ #define _LINUX_SCATTERLIST_H_ +#include +#include + #include #include #include @@ -479,4 +482,55 @@ sg_page_iter_page(struct sg_page_iter *piter) return (nth_page(sg_page(piter->sg), piter->sg_pgoffset)); } +static __inline size_t +sg_pcopy_from_buffer(struct scatterlist *sgl, unsigned int nents, + const void *buf, size_t buflen, off_t skip) +{ + struct sg_page_iter piter; + struct page *page; + struct sf_buf *sf; + size_t len, copied; + char *p, *b; + + if (buflen == 0) + return (0); + + b = __DECONST(char *, buf); + copied = 0; + sched_pin(); + for_each_sg_page(sgl, &piter, nents, 0) { + + /* Skip to the start. */ + if (piter.sg->length <= skip) { + skip -= piter.sg->length; + continue; + } + + /* See how much to copy. */ + KASSERT(((piter.sg->length - skip) != 0 && (buflen != 0)), + ("%s: sg len %u - skip %ju || buflen %zu is 0\n", + __func__, piter.sg->length, (uintmax_t)skip, buflen)); + len = min(piter.sg->length - skip, buflen); + + page = sg_page_iter_page(&piter); + sf = sf_buf_alloc(page, SFB_CPUPRIVATE | SFB_NOWAIT); + if (sf == NULL) + break; + p = (char *)sf_buf_kva(sf) + piter.sg_pgoffset + skip; + memcpy(p, b, len); + sf_buf_free(sf); + + copied += len; + /* Either we exactly filled the page, or we are done. */ + buflen -= len; + if (buflen == 0) + break; + skip -= len; + b += len; + } + sched_unpin(); + + return (copied); +} + #endif /* _LINUX_SCATTERLIST_H_ */ From owner-dev-commits-src-branches@freebsd.org Tue Feb 2 12:02:04 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9E8052FA19; Tue, 2 Feb 2021 12:02:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DVNhr4J3wz4tKZ; Tue, 2 Feb 2021 12:02:04 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3B57C5DBA; Tue, 2 Feb 2021 12:02:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 112C24rX024067; Tue, 2 Feb 2021 12:02:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 112C24aO024066; Tue, 2 Feb 2021 12:02:04 GMT (envelope-from git) Date: Tue, 2 Feb 2021 12:02:04 GMT Message-Id: <202102021202.112C24aO024066@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 3ac9e87b762c - stable/13 - LinuxKPI: enhance PCI bits for DRM MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3ac9e87b762c711642c870fb7a43b84d812a6e91 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2021 12:02:04 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=3ac9e87b762c711642c870fb7a43b84d812a6e91 commit 3ac9e87b762c711642c870fb7a43b84d812a6e91 Author: Bjoern A. Zeeb AuthorDate: 2021-01-28 16:23:19 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-02-02 11:51:20 +0000 LinuxKPI: enhance PCI bits for DRM In pci_domain_nr() directly return the domain which got set in lkpifill_pci_dev() in all cases. This was missed between D27550 and 105a37cac76b971f7a94409fbdc4f508a7e97fa0 . In order to implement pci_dev_put() harmonize further code (which was started in the aforementioned commit) and add kobj related bits (through the now common lkpifill_pci_dev() code) to the DRM specific calls without adding the DRM allocated pci devices to the pci_devices list. Add a release for the lkpinew_pci_dev() (DRM) case so freeing will work. This allows the DRM created devices to use the normal kobj/refcount logic and work with, e.g., pci_dev_put(). (For a slightly more detailed code walk see the review). Sponsored-by: The FreeBSD Foundation Obtained-from: bz_iwlwifi (partially) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D28188 (cherry picked from commit 1fac2cb4d6e5cfa1b8ff689213011b0fe077ffa7) --- sys/compat/linuxkpi/common/include/linux/pci.h | 10 +++++- sys/compat/linuxkpi/common/src/linux_pci.c | 42 +++++++++++++++----------- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 6338f5795f0a..ddb3f0b222a5 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -338,6 +338,14 @@ pci_set_drvdata(struct pci_dev *pdev, void *data) dev_set_drvdata(&pdev->dev, data); } +static __inline void +pci_dev_put(struct pci_dev *pdev) +{ + + if (pdev != NULL) + put_device(&pdev->dev); +} + static inline int pci_enable_device(struct pci_dev *pdev) { @@ -1094,7 +1102,7 @@ static inline int pci_domain_nr(struct pci_bus *pbus) { - return (pci_get_domain(pbus->self->dev.bsddev)); + return (pbus->domain); } static inline int diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index 0e184b64884b..075df3c2adf7 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -220,24 +220,42 @@ lkpifill_pci_dev(device_t dev, struct pci_dev *pdev) pdev->devfn = PCI_DEVFN(pci_get_slot(dev), pci_get_function(dev)); pdev->vendor = pci_get_vendor(dev); pdev->device = pci_get_device(dev); + pdev->subsystem_vendor = pci_get_subvendor(dev); + pdev->subsystem_device = pci_get_subdevice(dev); pdev->class = pci_get_class(dev); pdev->revision = pci_get_revid(dev); - pdev->dev.bsddev = dev; + pdev->bus = malloc(sizeof(*pdev->bus), M_DEVBUF, M_WAITOK | M_ZERO); pdev->bus->self = pdev; pdev->bus->number = pci_get_bus(dev); pdev->bus->domain = pci_get_domain(dev); + pdev->dev.bsddev = dev; + pdev->dev.parent = &linux_root_device; + INIT_LIST_HEAD(&pdev->dev.irqents); + kobject_init(&pdev->dev.kobj, &linux_dev_ktype); + kobject_set_name(&pdev->dev.kobj, device_get_nameunit(dev)); + kobject_add(&pdev->dev.kobj, &linux_root_device.kobj, + kobject_name(&pdev->dev.kobj)); +} + +static void +lkpinew_pci_dev_release(struct device *dev) +{ + struct pci_dev *pdev; + + pdev = to_pci_dev(dev); + free(pdev->bus, M_DEVBUF); + free(pdev, M_DEVBUF); } static struct pci_dev * lkpinew_pci_dev(device_t dev) { struct pci_dev *pdev; - struct pci_bus *pbus; pdev = malloc(sizeof(*pdev), M_DEVBUF, M_WAITOK|M_ZERO); - pbus = malloc(sizeof(*pbus), M_DEVBUF, M_WAITOK|M_ZERO); - pdev->bus = pbus; lkpifill_pci_dev(dev, pdev); + pdev->dev.release = lkpinew_pci_dev_release; + return (pdev); } @@ -309,7 +327,6 @@ linux_pci_attach_device(device_t dev, struct pci_driver *pdrv, const struct pci_device_id *id, struct pci_dev *pdev) { struct resource_list_entry *rle; - struct pci_devinfo *dinfo; device_t parent; uintptr_t rid; int error; @@ -321,30 +338,19 @@ linux_pci_attach_device(device_t dev, struct pci_driver *pdrv, isdrm = pdrv != NULL && pdrv->isdrm; if (isdrm) { + struct pci_devinfo *dinfo; + dinfo = device_get_ivars(parent); device_set_ivars(dev, dinfo); - } else { - dinfo = device_get_ivars(dev); } - pdev->bus = malloc(sizeof(*pdev->bus), M_DEVBUF, M_WAITOK | M_ZERO); lkpifill_pci_dev(dev, pdev); - pdev->dev.parent = &linux_root_device; - INIT_LIST_HEAD(&pdev->dev.irqents); if (isdrm) PCI_GET_ID(device_get_parent(parent), parent, PCI_ID_RID, &rid); else PCI_GET_ID(parent, dev, PCI_ID_RID, &rid); pdev->devfn = rid; - pdev->device = dinfo->cfg.device; - pdev->vendor = dinfo->cfg.vendor; - pdev->subsystem_vendor = dinfo->cfg.subvendor; - pdev->subsystem_device = dinfo->cfg.subdevice; pdev->pdrv = pdrv; - kobject_init(&pdev->dev.kobj, &linux_dev_ktype); - kobject_set_name(&pdev->dev.kobj, device_get_nameunit(dev)); - kobject_add(&pdev->dev.kobj, &linux_root_device.kobj, - kobject_name(&pdev->dev.kobj)); rle = linux_pci_get_rle(pdev, SYS_RES_IRQ, 0); if (rle != NULL) pdev->dev.irq = rle->start; From owner-dev-commits-src-branches@freebsd.org Tue Feb 2 12:02:05 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 981BC52FB87; Tue, 2 Feb 2021 12:02:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DVNhs2fh0z4t6J; Tue, 2 Feb 2021 12:02:05 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 471DC57EC; Tue, 2 Feb 2021 12:02:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 112C25mg024089; Tue, 2 Feb 2021 12:02:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 112C25jt024088; Tue, 2 Feb 2021 12:02:05 GMT (envelope-from git) Date: Tue, 2 Feb 2021 12:02:05 GMT Message-Id: <202102021202.112C25jt024088@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: ff119f7c4a38 - stable/13 - LinuxKPI: implement devres() framework parts and two examples MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ff119f7c4a3894e20190cca37ca00c9fef88a6df Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2021 12:02:05 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=ff119f7c4a3894e20190cca37ca00c9fef88a6df commit ff119f7c4a3894e20190cca37ca00c9fef88a6df Author: Bjoern A. Zeeb AuthorDate: 2021-01-28 16:32:43 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-02-02 11:51:26 +0000 LinuxKPI: implement devres() framework parts and two examples This code implements a version of the devres framework found working for various iwlwifi use cases and also providing functions for ttm_page_alloc_dma.c from DRM. Part of the framework replicates the consumed KPI, while others are internal helper functions. In addition the simple devm_k*malloc() consumers were implemented and kvasprintf() was enhanced to also work for the devm_kasprintf() case. Addmittingly lkpi_devm_kmalloc_release() could be avoided but for the overall understanding of the code and possible memory tracing it may still be helpful. Further devsres consumer are implemented for iwlwifi but will follow later as the main reason for this change is to sort out overlap with DRM. Sponsored-by: The FreeBSD Foundation Obtained-from: bz_iwlwifi MFC After: 3 days Reviewed-by: hselasky, manu Differential Revision: https://reviews.freebsd.org/D28189 (cherry picked from commit fa765ca73e553399ffbad382e579e4c2b4d0fc12) --- sys/compat/linuxkpi/common/include/linux/device.h | 42 ++++ sys/compat/linuxkpi/common/src/linux_compat.c | 29 ++- sys/compat/linuxkpi/common/src/linux_devres.c | 226 ++++++++++++++++++++++ sys/conf/files | 2 + sys/modules/linuxkpi/Makefile | 1 + 5 files changed, 297 insertions(+), 3 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h index a55f6b0215ce..2ffe70f45c6e 100644 --- a/sys/compat/linuxkpi/common/include/linux/device.h +++ b/sys/compat/linuxkpi/common/include/linux/device.h @@ -562,5 +562,47 @@ dev_to_node(struct device *dev) char *kvasprintf(gfp_t, const char *, va_list); char *kasprintf(gfp_t, const char *, ...); +char *lkpi_devm_kasprintf(struct device *, gfp_t, const char *, ...); + +#define devm_kasprintf(_dev, _gfp, _fmt, ...) \ + lkpi_devm_kasprintf(_dev, _gfp, _fmt, ##__VA_ARGS__) + +void *lkpi_devres_alloc(void(*release)(struct device *, void *), size_t, gfp_t); +void lkpi_devres_add(struct device *, void *); +void lkpi_devres_free(void *); +void *lkpi_devres_find(struct device *, void(*release)(struct device *, void *), + int (*match)(struct device *, void *, void *), void *); +int lkpi_devres_destroy(struct device *, void(*release)(struct device *, void *), + int (*match)(struct device *, void *, void *), void *); +#define devres_alloc(_r, _s, _g) lkpi_devres_alloc(_r, _s, _g) +#define devres_add(_d, _p) lkpi_devres_add(_d, _p) +#define devres_free(_p) lkpi_devres_free(_p) +#define devres_find(_d, _rfn, _mfn, _mp) \ + lkpi_devres_find(_d, _rfn, _mfn, _mp) +#define devres_destroy(_d, _rfn, _mfn, _mp) \ + lkpi_devres_destroy(_d, _rfn, _mfn, _mp) + +/* LinuxKPI internal functions. */ +void lkpi_devres_release_free_list(struct device *); +void lkpi_devres_unlink(struct device *, void *); +void lkpi_devm_kmalloc_release(struct device *, void *); + +static __inline void * +devm_kmalloc(struct device *dev, size_t size, gfp_t gfp) +{ + void *p; + + p = lkpi_devres_alloc(lkpi_devm_kmalloc_release, size, gfp); + if (p != NULL) + lkpi_devres_add(dev, p); + + return (p); +} + +#define devm_kzalloc(_dev, _size, _gfp) \ + devm_kmalloc((_dev), (_size), (_gfp) | __GFP_ZERO) + +#define devm_kcalloc(_dev, _sizen, _size, _gfp) \ + devm_kmalloc((_dev), ((_sizen) * (_size)), (_gfp) | __GFP_ZERO) #endif /* _LINUX_DEVICE_H_ */ diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index b73f6fed03af..2ad936311204 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -1854,8 +1854,8 @@ vunmap(void *addr) kfree(vmmap); } -char * -kvasprintf(gfp_t gfp, const char *fmt, va_list ap) +static char * +devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt, va_list ap) { unsigned int len; char *p; @@ -1865,13 +1865,36 @@ kvasprintf(gfp_t gfp, const char *fmt, va_list ap) len = vsnprintf(NULL, 0, fmt, aq); va_end(aq); - p = kmalloc(len + 1, gfp); + if (dev != NULL) + p = devm_kmalloc(dev, len + 1, gfp); + else + p = kmalloc(len + 1, gfp); if (p != NULL) vsnprintf(p, len + 1, fmt, ap); return (p); } +char * +kvasprintf(gfp_t gfp, const char *fmt, va_list ap) +{ + + return (devm_kvasprintf(NULL, gfp, fmt, ap)); +} + +char * +lkpi_devm_kasprintf(struct device *dev, gfp_t gfp, const char *fmt, ...) +{ + va_list ap; + char *p; + + va_start(ap, fmt); + p = devm_kvasprintf(dev, gfp, fmt, ap); + va_end(ap); + + return (p); +} + char * kasprintf(gfp_t gfp, const char *fmt, ...) { diff --git a/sys/compat/linuxkpi/common/src/linux_devres.c b/sys/compat/linuxkpi/common/src/linux_devres.c new file mode 100644 index 000000000000..96ff3e486d1d --- /dev/null +++ b/sys/compat/linuxkpi/common/src/linux_devres.c @@ -0,0 +1,226 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020-2021 The FreeBSD Foundation + * + * This software was developed by Bj\xc3\xb6rn Zeeb 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 +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +/* + * Linux devres KPI implementation. + */ + +struct devres { + struct list_head entry; + void (*release)(struct device *, void *); + + /* Must come last. */ + uint8_t __drdata[0] __aligned(CACHE_LINE_SIZE); +}; + +void * +lkpi_devres_alloc(void(*release)(struct device *, void *), + size_t size, gfp_t gfp) +{ + void *p; + struct devres *dr; + size_t total; + + if (size == 0) + return (NULL); + + total = sizeof(*dr) + size; + dr = kmalloc(total, gfp); + if (dr == NULL) + return (NULL); + + INIT_LIST_HEAD(&dr->entry); + dr->release = release; + p = (void *)(dr+1); + + return (p); +} + +static void +lkpi_devres_free_dr(struct devres *dr) +{ + + /* + * We have no dev, so cannot lock. This means someone else has + * to do this prior to us if devres_add() had been called. + */ + KASSERT(list_empty_careful(&dr->entry), + ("%s: dr %p still on devres_head\n", __func__, dr)); + kfree(dr); +} + +void +lkpi_devres_free(void *p) +{ + struct devres *dr; + + if (p == NULL) + return; + + dr = container_of(p, struct devres, __drdata); + lkpi_devres_free_dr(dr); +} + +void +lkpi_devres_add(struct device *dev, void *p) +{ + struct devres *dr; + + KASSERT(dev != NULL && p != NULL, ("%s: dev %p p %p\n", + __func__, dev, p)); + + dr = container_of(p, struct devres, __drdata); + spin_lock(&dev->devres_lock); + list_add(&dr->entry, &dev->devres_head); + spin_unlock(&dev->devres_lock); +} + +static struct devres * +lkpi_devres_find_dr(struct device *dev, void(*release)(struct device *, void *), + int (*match)(struct device *, void *, void *), void *mp) +{ + struct devres *dr, *next; + void *p; + + KASSERT(dev != NULL, ("%s: dev %p\n", __func__, dev)); + assert_spin_locked(&dev->devres_lock); + + list_for_each_entry_safe(dr, next, &dev->devres_head, entry) { + if (dr->release != release) + continue; + p = (void *)(dr+1); + if (match != NULL && match(dev, p, mp) == false) + continue; + return (dr); + } + + return (NULL); +} + +void * +lkpi_devres_find(struct device *dev, void(*release)(struct device *, void *), + int (*match)(struct device *, void *, void *), void *mp) +{ + struct devres *dr; + + KASSERT(dev != NULL, ("%s: dev %p\n", __func__, dev)); + + spin_lock(&dev->devres_lock); + dr = lkpi_devres_find_dr(dev, release, match, mp); + spin_unlock(&dev->devres_lock); + + if (dr == NULL) + return (NULL); + + return ((void *)(dr + 1)); +} + +static void +lkpi_devres_unlink_locked(struct device *dev, struct devres *dr) +{ + KASSERT(dev != NULL, ("%s: dev %p\n", __func__, dev)); + KASSERT(dr != NULL, ("%s: dr %p\n", __func__, dr)); + assert_spin_locked(&dev->devres_lock); + + list_del_init(&dr->entry); +} + +void +lkpi_devres_unlink(struct device *dev, void *p) +{ + struct devres *dr; + + KASSERT(dev != NULL && p != NULL, ("%s: dev %p p %p\n", + __func__, dev, p)); + + dr = container_of(p, struct devres, __drdata); + spin_lock(&dev->devres_lock); + lkpi_devres_unlink_locked(dev, dr); + spin_unlock(&dev->devres_lock); +} + +/* This is called on device free. */ +void +lkpi_devres_release_free_list(struct device *dev) +{ + struct devres *dr, *next; + void *p; + + /* Free any resources allocated on the device. */ + /* No need to lock anymore. */ + list_for_each_entry_safe(dr, next, &dev->devres_head, entry) { + p = (void *)(dr+1); + if (dr->release != NULL) + dr->release(dev, p); + /* This should probably be a function of some kind. */ + list_del_init(&dr->entry); + lkpi_devres_free(p); + } +} + +int +lkpi_devres_destroy(struct device *dev, void(*release)(struct device *, void *), + int (*match)(struct device *, void *, void *), void *mp) +{ + struct devres *dr; + + spin_lock(&dev->devres_lock); + dr = lkpi_devres_find_dr(dev, release, match, mp); + if (dr != NULL) + lkpi_devres_unlink_locked(dev, dr); + spin_unlock(&dev->devres_lock); + + if (dr == NULL) + return (-ENOENT); + lkpi_devres_free_dr(dr); + + return (0); +} + +/* + * Devres release function for k*malloc(). + * While there is nothing to do here adding, e.g., tracing would be + * possible so we leave the empty function here. + * Also good for documentation as it is the simplest example. + */ +void +lkpi_devm_kmalloc_release(struct device *dev __unused, void *p __unused) +{ + + /* Nothing to do. Freed with the devres. */ +} diff --git a/sys/conf/files b/sys/conf/files index c7f6e97a6172..f0bf574b3236 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4556,6 +4556,8 @@ compat/linuxkpi/common/src/linux_compat.c optional compat_linuxkpi \ compile-with "${LINUXKPI_C}" compat/linuxkpi/common/src/linux_current.c optional compat_linuxkpi \ compile-with "${LINUXKPI_C}" +compat/linuxkpi/common/src/linux_devres.c optional compat_linuxkpi \ + compile-with "${LINUXKPI_C}" compat/linuxkpi/common/src/linux_dmi.c optional compat_linuxkpi \ compile-with "${LINUXKPI_C}" compat/linuxkpi/common/src/linux_firmware.c optional compat_linuxkpi \ diff --git a/sys/modules/linuxkpi/Makefile b/sys/modules/linuxkpi/Makefile index 7bb4080fa81d..4274d211b10e 100644 --- a/sys/modules/linuxkpi/Makefile +++ b/sys/modules/linuxkpi/Makefile @@ -4,6 +4,7 @@ KMOD= linuxkpi SRCS= linux_compat.c \ linux_current.c \ + linux_devres.c \ linux_dmi.c \ linux_firmware.c \ linux_hrtimer.c \ From owner-dev-commits-src-branches@freebsd.org Tue Feb 2 12:02:08 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC21952FA38; Tue, 2 Feb 2021 12:02: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 4DVNht6DhFz4tFQ; Tue, 2 Feb 2021 12:02:06 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5F55357ED; Tue, 2 Feb 2021 12:02:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 112C26bh024109; Tue, 2 Feb 2021 12:02:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 112C26KH024108; Tue, 2 Feb 2021 12:02:06 GMT (envelope-from git) Date: Tue, 2 Feb 2021 12:02:06 GMT Message-Id: <202102021202.112C26KH024108@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 91a07ed50ffc - stable/13 - Bump __FreeBSD_version for multiple LinuxKPI updates conflicting with DRM. Be sure to update your drm-kmod port to after the update. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 91a07ed50ffca4dfada3e7f1f050ea746c1bac66 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2021 12:02:08 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=91a07ed50ffca4dfada3e7f1f050ea746c1bac66 commit 91a07ed50ffca4dfada3e7f1f050ea746c1bac66 Author: Bjoern A. Zeeb AuthorDate: 2021-02-02 11:52:50 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-02-02 11:52:50 +0000 Bump __FreeBSD_version for multiple LinuxKPI updates conflicting with DRM. Be sure to update your drm-kmod port to after the update. Sponsored-by: The FreeBSD Foundation --- UPDATING | 5 +++++ sys/sys/param.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index 222dc6083ce7..c42fe6639b12 100644 --- a/UPDATING +++ b/UPDATING @@ -11,6 +11,11 @@ handbook: Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. +20210202: + Various LinuxKPI functionality was added which conflicts with DRM. + Please update your drm-kmod port to after the __FreeBSD_verison 1300139 + update. + 20210122: The stable/13 branch has been created from main. diff --git a/sys/sys/param.h b/sys/sys/param.h index afa5d9a2e3a8..c243c5072145 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300138 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300139 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-branches@freebsd.org Tue Feb 2 12:02:10 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 63EC952FB8A; Tue, 2 Feb 2021 12:02:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DVNhw3F4Sz4tNK; Tue, 2 Feb 2021 12:02:08 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7A0FD57EE; Tue, 2 Feb 2021 12:02:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 112C27Xp024129; Tue, 2 Feb 2021 12:02:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 112C27me024128; Tue, 2 Feb 2021 12:02:07 GMT (envelope-from git) Date: Tue, 2 Feb 2021 12:02:07 GMT Message-Id: <202102021202.112C27me024128@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 4d85bfa41202 - stable/13 - __FreeBSD_version: update the references to the doc tree MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4d85bfa4120256d7d023bcecb3b5efe7a4bea46d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2021 12:02:10 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=4d85bfa4120256d7d023bcecb3b5efe7a4bea46d commit 4d85bfa4120256d7d023bcecb3b5efe7a4bea46d Author: Bjoern A. Zeeb AuthorDate: 2021-01-29 10:57:50 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-02-02 11:54:30 +0000 __FreeBSD_version: update the references to the doc tree Update the reference of which file to update in the doc tree when bumping __FreeBSD_version. (cherry picked from commit abd619045a54c73f41a95b3e038a5ba083391400) --- 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 c243c5072145..a19091e17167 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -52,7 +52,7 @@ * there. * Currently this lives here in the doc/ repository: * - * head/en_US.ISO8859-1/books/porters-handbook/versions/chapter.xml + * documentation/content/en/books/porters-handbook/versions/chapter.adoc * * scheme is: Rxx * 'R' is in the range 0 to 4 if this is a release branch or From owner-dev-commits-src-branches@freebsd.org Tue Feb 2 12:28:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C54B530B85; Tue, 2 Feb 2021 12:28: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 4DVPGm3x0Fz3CH5; Tue, 2 Feb 2021 12:28:00 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 77F3F5FF9; Tue, 2 Feb 2021 12:28:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 112CS0ob052393; Tue, 2 Feb 2021 12:28:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 112CS0n4052392; Tue, 2 Feb 2021 12:28:00 GMT (envelope-from git) Date: Tue, 2 Feb 2021 12:28:00 GMT Message-Id: <202102021228.112CS0n4052392@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Marcin Wojtas Subject: git: cd1393dfe718 - stable/12 - marvell: ap806_clock: add missing frequency modes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: cd1393dfe7189c21739b4581b9cbdda680c54f59 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2021 12:28:00 -0000 The branch stable/12 has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=cd1393dfe7189c21739b4581b9cbdda680c54f59 commit cd1393dfe7189c21739b4581b9cbdda680c54f59 Author: Marcin Wojtas AuthorDate: 2021-01-26 10:49:35 +0000 Commit: Marcin Wojtas CommitDate: 2021-02-02 12:27:38 +0000 marvell: ap806_clock: add missing frequency modes In the driver init routine the CPU clock frequency value is obtained from a dedicated register. Until now only part of the values were handled by the mv_ap806_clock driver. Fix that by adding missing cases. Submitted by: Zyta Szpak MFC after: 1 week Obtained from: Semihalf Sponsored by: Marvell (cherry picked from commit a86b0839d7bf3fc06b1ae9c50e055b53c50a9d0b) --- sys/arm/mv/mv_ap806_clock.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/sys/arm/mv/mv_ap806_clock.c b/sys/arm/mv/mv_ap806_clock.c index 2516ce72d35c..bbbe875ee939 100644 --- a/sys/arm/mv/mv_ap806_clock.c +++ b/sys/arm/mv/mv_ap806_clock.c @@ -139,25 +139,51 @@ mv_ap806_clock_attach(device_t dev) return (ENXIO); } - /* - * We might miss some combinations - * Those are the only possible ones on the mcbin - */ reg = RD4(sc, 0x400); switch (reg & 0x1f) { case 0x0: case 0x1: clock_freq = 2000000000; break; + case 0x4: + clock_freq = 1600000000; + break; case 0x6: clock_freq = 1800000000; break; + case 0x7: + clock_freq = 1800000000; + break; + case 0xb: + clock_freq = 1600000000; + break; case 0xd: clock_freq = 1600000000; break; + case 0x13: + clock_freq = 1000000000; + break; case 0x14: clock_freq = 1333000000; break; + case 0x17: + clock_freq = 1333000000; + break; + case 0x19: + clock_freq = 1200000000; + break; + case 0x1a: + clock_freq = 1400000000; + break; + case 0x1b: + clock_freq = 600000000; + break; + case 0x1c: + clock_freq = 800000000; + break; + case 0x1d: + clock_freq = 1000000000; + break; default: device_printf(dev, "Cannot guess clock freq with reg %x\n", reg & 0x1f); From owner-dev-commits-src-branches@freebsd.org Tue Feb 2 12:28:54 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 21CD3530C10; Tue, 2 Feb 2021 12:28: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 4DVPHn71xbz3CR3; Tue, 2 Feb 2021 12:28:53 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E3FA462B5; Tue, 2 Feb 2021 12:28:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 112CSrF9052629; Tue, 2 Feb 2021 12:28:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 112CSrGb052628; Tue, 2 Feb 2021 12:28:53 GMT (envelope-from git) Date: Tue, 2 Feb 2021 12:28:53 GMT Message-Id: <202102021228.112CSrGb052628@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Marcin Wojtas Subject: git: cd925aaa73e1 - stable/13 - marvell: ap806_clock: add missing frequency modes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cd925aaa73e1bde159bb53ea049a45b6bd86bba3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2021 12:28:54 -0000 The branch stable/13 has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=cd925aaa73e1bde159bb53ea049a45b6bd86bba3 commit cd925aaa73e1bde159bb53ea049a45b6bd86bba3 Author: Marcin Wojtas AuthorDate: 2021-01-26 10:49:35 +0000 Commit: Marcin Wojtas CommitDate: 2021-02-02 12:28:35 +0000 marvell: ap806_clock: add missing frequency modes In the driver init routine the CPU clock frequency value is obtained from a dedicated register. Until now only part of the values were handled by the mv_ap806_clock driver. Fix that by adding missing cases. Submitted by: Zyta Szpak MFC after: 1 week Obtained from: Semihalf Sponsored by: Marvell (cherry picked from commit a86b0839d7bf3fc06b1ae9c50e055b53c50a9d0b) --- sys/arm/mv/mv_ap806_clock.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/sys/arm/mv/mv_ap806_clock.c b/sys/arm/mv/mv_ap806_clock.c index 378640633c03..56041a48d312 100644 --- a/sys/arm/mv/mv_ap806_clock.c +++ b/sys/arm/mv/mv_ap806_clock.c @@ -136,25 +136,51 @@ mv_ap806_clock_attach(device_t dev) return (ENXIO); } - /* - * We might miss some combinations - * Those are the only possible ones on the mcbin - */ reg = RD4(sc, 0x400); switch (reg & 0x1f) { case 0x0: case 0x1: clock_freq = 2000000000; break; + case 0x4: + clock_freq = 1600000000; + break; case 0x6: clock_freq = 1800000000; break; + case 0x7: + clock_freq = 1800000000; + break; + case 0xb: + clock_freq = 1600000000; + break; case 0xd: clock_freq = 1600000000; break; + case 0x13: + clock_freq = 1000000000; + break; case 0x14: clock_freq = 1333000000; break; + case 0x17: + clock_freq = 1333000000; + break; + case 0x19: + clock_freq = 1200000000; + break; + case 0x1a: + clock_freq = 1400000000; + break; + case 0x1b: + clock_freq = 600000000; + break; + case 0x1c: + clock_freq = 800000000; + break; + case 0x1d: + clock_freq = 1000000000; + break; default: device_printf(dev, "Cannot guess clock freq with reg %x\n", reg & 0x1f); From owner-dev-commits-src-branches@freebsd.org Tue Feb 2 12:41:09 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EE324530BEA; Tue, 2 Feb 2021 12:41: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 4DVPYx6VtHz3DFX; Tue, 2 Feb 2021 12:41:09 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D25AF65AB; Tue, 2 Feb 2021 12:41:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 112Cf99W073297; Tue, 2 Feb 2021 12:41:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 112Cf91S073296; Tue, 2 Feb 2021 12:41:09 GMT (envelope-from git) Date: Tue, 2 Feb 2021 12:41:09 GMT Message-Id: <202102021241.112Cf91S073296@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Toomas Soome Subject: git: 0d381d1b92e5 - stable/13 - loader: create built in font from bold font face MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0d381d1b92e5cc0a83f5fd6b4aa7f063d4d4f2c6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2021 12:41:10 -0000 The branch stable/13 has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=0d381d1b92e5cc0a83f5fd6b4aa7f063d4d4f2c6 commit 0d381d1b92e5cc0a83f5fd6b4aa7f063d4d4f2c6 Author: Toomas Soome AuthorDate: 2021-01-22 11:06:58 +0000 Commit: Toomas Soome CommitDate: 2021-02-02 10:00:30 +0000 loader: create built in font from bold font face We did replace full version of default font 8x16v with bold, also use bold version for built in font. (cherry picked from commit 6c789c55c4ba11014bfd1b59942c204615412ba6) --- stand/efi/loader/Makefile | 2 +- stand/i386/loader/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stand/efi/loader/Makefile b/stand/efi/loader/Makefile index f7032c78926d..dd25c940e0e9 100644 --- a/stand/efi/loader/Makefile +++ b/stand/efi/loader/Makefile @@ -87,7 +87,7 @@ VERSION_FILE= ${.CURDIR}/../loader/version CLEANFILES+= 8x16.c -8x16.c: ${SRCTOP}/contrib/terminus/ter-u16v.bdf +8x16.c: ${SRCTOP}/contrib/terminus/ter-u16b.bdf vtfontcvt -f compressed-source -o ${.TARGET} ${.ALLSRC} FILES+= ${LOADER}.efi diff --git a/stand/i386/loader/Makefile b/stand/i386/loader/Makefile index e80e19dfb9e6..ad95948ec50a 100644 --- a/stand/i386/loader/Makefile +++ b/stand/i386/loader/Makefile @@ -70,7 +70,7 @@ CFLAGS+= -I${BOOTSRC}/i386 #CFLAGS+= -g #LDFLAGS+= -g -8x16.c: ${SRCTOP}/contrib/terminus/ter-u16v.bdf +8x16.c: ${SRCTOP}/contrib/terminus/ter-u16b.bdf vtfontcvt -f compressed-source -o ${.TARGET} ${.ALLSRC} ${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN} From owner-dev-commits-src-branches@freebsd.org Tue Feb 2 12:56:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 92BC45314A0; Tue, 2 Feb 2021 12:56:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DVPvm3mr7z3DvL; Tue, 2 Feb 2021 12:56:36 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 704436AE2; Tue, 2 Feb 2021 12:56:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 112Cuabm091534; Tue, 2 Feb 2021 12:56:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 112Cuagx091533; Tue, 2 Feb 2021 12:56:36 GMT (envelope-from git) Date: Tue, 2 Feb 2021 12:56:36 GMT Message-Id: <202102021256.112Cuagx091533@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Toomas Soome Subject: git: b79f2bc6c5c7 - stable/13 - vt: panic while changing vt font MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b79f2bc6c5c7431fa1f7c02937ec97a64653ade1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2021 12:56:36 -0000 The branch stable/13 has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=b79f2bc6c5c7431fa1f7c02937ec97a64653ade1 commit b79f2bc6c5c7431fa1f7c02937ec97a64653ade1 Author: Toomas Soome AuthorDate: 2021-01-24 18:59:36 +0000 Commit: Toomas Soome CommitDate: 2021-02-02 10:11:38 +0000 vt: panic while changing vt font Set refcount for loader provided font to 1 to prevent this font from being released (so we can reset to default). As we get started with no memory allocator, we set up static font data for font passed by loader (if there is any). At this time, we also must set refcount 1, and refcount will get incremented in cnprobe() callback. At some point the memory allocator will be available, and we will set up properly allocated font data, but we should not disturb the refcount. PR: 252833 PR: 253147 (cherry picked and squashed 93ebd6307efeb95a29bc614edd0c67c2af850e98 and 1912d2b15e6d6f4a1d8c3886b03ab30d2f21f3fd) --- sys/dev/vt/vt_core.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index 2352ed823424..05c383829f49 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -1487,6 +1487,8 @@ parse_font_info_static(struct font_info *fi) vfp = &vt_font_loader; vfp->vf_height = fi->fi_height; vfp->vf_width = fi->fi_width; + /* This is default font, set refcount 1 to disable removal. */ + vfp->vf_refcount = 1; for (unsigned i = 0; i < VFNT_MAPS; i++) { if (fi->fi_map_count[i] == 0) continue; @@ -1499,6 +1501,12 @@ parse_font_info_static(struct font_info *fi) return (vfp); } +/* + * Set up default font with allocated data structures. + * However, we can not set refcount here, because it is already set and + * incremented in vtterm_cnprobe() to avoid being released by font load from + * userland. + */ static struct vt_font * parse_font_info(struct font_info *fi) { From owner-dev-commits-src-branches@freebsd.org Tue Feb 2 13:01:54 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AFA63531981; Tue, 2 Feb 2021 13:01: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 4DVQ1t4WGBz3Fbh; Tue, 2 Feb 2021 13:01:54 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8DB276BD3; Tue, 2 Feb 2021 13:01:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 112D1s7U000779; Tue, 2 Feb 2021 13:01:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 112D1sA3000778; Tue, 2 Feb 2021 13:01:54 GMT (envelope-from git) Date: Tue, 2 Feb 2021 13:01:54 GMT Message-Id: <202102021301.112D1sA3000778@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Toomas Soome Subject: git: a66467dcfd65 - stable/13 - userboot: provide stub gfx functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a66467dcfd65bc6d4915a3c2c1b5ab2ca77133d4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2021 13:01:54 -0000 The branch stable/13 has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=a66467dcfd65bc6d4915a3c2c1b5ab2ca77133d4 commit a66467dcfd65bc6d4915a3c2c1b5ab2ca77133d4 Author: Toomas Soome AuthorDate: 2021-01-30 19:16:20 +0000 Commit: Toomas Soome CommitDate: 2021-02-02 10:21:49 +0000 userboot: provide stub gfx functions Make sure we have needed functions present, to avoi getting undefined symbols error(s). PR: 253088 Reported by: John Kennedy (cherry picked b79f2bc6c5c7431fa1f7c02937ec97a64653ade1) --- stand/userboot/userboot/Makefile | 3 +- stand/userboot/userboot/gfx_fb.c | 78 +++++++++++++++++++++++++++++++++ stand/userboot/userboot/userboot_cons.c | 4 -- 3 files changed, 80 insertions(+), 5 deletions(-) diff --git a/stand/userboot/userboot/Makefile b/stand/userboot/userboot/Makefile index 49026375328e..767840101200 100644 --- a/stand/userboot/userboot/Makefile +++ b/stand/userboot/userboot/Makefile @@ -29,13 +29,14 @@ SRCS+= main.c SRCS+= userboot_cons.c SRCS+= userboot_disk.c SRCS+= vers.c +SRCS+= gfx_fb.c CFLAGS+= -Wall CFLAGS+= -I${BOOTSRC}/userboot CFLAGS.main.c+= -I${BOOTSRC}/libsa/zfs CFLAGS.main.c+= -I${SYSDIR}/contrib/openzfs/include CFLAGS.main.c+= -I${SYSDIR}/contrib/openzfs/include/os/freebsd/zfs -CFLAGS.userboot_cons.c+= -I$(SRCTOP)/sys/teken -I${SRCTOP}/contrib/pnglite +CFLAGS.gfx_fb.c+= -I$(SRCTOP)/sys/teken -I${SRCTOP}/contrib/pnglite CWARNFLAGS.main.c += -Wno-implicit-function-declaration LDFLAGS+= -nostdlib -Wl,-Bsymbolic diff --git a/stand/userboot/userboot/gfx_fb.c b/stand/userboot/userboot/gfx_fb.c new file mode 100644 index 000000000000..aef61814569a --- /dev/null +++ b/stand/userboot/userboot/gfx_fb.c @@ -0,0 +1,78 @@ +/*- + * Copyright 2021 Toomas Soome + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * userboot-specific gfx stubs. + */ + +#include +#include +#include "bootstrap.h" +#include "gfx_fb.h" + +font_list_t fonts = STAILQ_HEAD_INITIALIZER(fonts); +teken_gfx_t gfx_state = { 0 }; + +void +gfx_fb_setpixel(uint32_t x __unused, uint32_t y __unused) +{ +} + +void +gfx_fb_drawrect(uint32_t x1 __unused, uint32_t y1 __unused, + uint32_t x2 __unused, uint32_t y2 __unused, uint32_t fill __unused) +{ +} + +void +gfx_term_drawrect(uint32_t x1 __unused, uint32_t y1 __unused, + uint32_t x2 __unused, uint32_t y2 __unused) +{ +} + +void +gfx_fb_line(uint32_t x0 __unused, uint32_t y0 __unused, + uint32_t x1 __unused, uint32_t y1 __unused, uint32_t w __unused) +{ +} + +void +gfx_fb_bezier(uint32_t x0 __unused, uint32_t y0 __unused, + uint32_t x1 __unused, uint32_t y1 __unused, uint32_t x2 __unused, + uint32_t y2 __unused, uint32_t w __unused) +{ +} + +int +gfx_fb_putimage(png_t *png __unused, uint32_t ux1 __unused, + uint32_t uy1 __unused, uint32_t ux2 __unused, uint32_t uy2 __unused, + uint32_t flags __unused) +{ + return (1); +} diff --git a/stand/userboot/userboot/userboot_cons.c b/stand/userboot/userboot/userboot_cons.c index 528f9ac40af9..89c1e70b116f 100644 --- a/stand/userboot/userboot/userboot_cons.c +++ b/stand/userboot/userboot/userboot_cons.c @@ -29,13 +29,9 @@ __FBSDID("$FreeBSD$"); #include #include -#include "gfx_fb.h" #include "bootstrap.h" #include "libuserboot.h" -font_list_t fonts = STAILQ_HEAD_INITIALIZER(fonts); -teken_gfx_t gfx_state = { 0 }; - int console; static struct console *userboot_comconsp; From owner-dev-commits-src-branches@freebsd.org Tue Feb 2 14:26:52 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE397533E64; Tue, 2 Feb 2021 14:26: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 4DVRvw5Xwhz3MTV; Tue, 2 Feb 2021 14:26:52 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B12247770; Tue, 2 Feb 2021 14:26:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 112EQqAQ009476; Tue, 2 Feb 2021 14:26:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 112EQquw009475; Tue, 2 Feb 2021 14:26:52 GMT (envelope-from git) Date: Tue, 2 Feb 2021 14:26:52 GMT Message-Id: <202102021426.112EQquw009475@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: 9c40fca6c809 - stable/11 - ixl: Permit 802.1ad frames to pass though the chip MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 9c40fca6c809e845341aade54307f9fc84627480 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2021 14:26:52 -0000 The branch stable/11 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=9c40fca6c809e845341aade54307f9fc84627480 commit 9c40fca6c809e845341aade54307f9fc84627480 Author: Lutz Donnerhacke AuthorDate: 2021-02-02 14:22:55 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-02-02 14:25:19 +0000 ixl: Permit 802.1ad frames to pass though the chip This patch is a quick hack to change the internal Ethertype used within the chip. All frames with this type are dropped silently. This patch allows you to overwrite the factory default 0x88a8, which is used by IEEE 802.1ad VLAN stacking. Reviewed by: kp, philip, brueffer Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D24179 (cherry-picked from commit fa6662b3689eeb71cb63c2b230ca08e7342cabf0) --- share/man/man4/ixl.4 | 11 ++++++++++- sys/dev/ixl/ixl_pf_main.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/share/man/man4/ixl.4 b/share/man/man4/ixl.4 index 60aa5e67ac40..e7554b7bc854 100644 --- a/share/man/man4/ixl.4 +++ b/share/man/man4/ixl.4 @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 25, 2015 +.Dd January 19, 2021 .Dt IXL 4 .Os .Sh NAME @@ -151,6 +151,15 @@ this can cause a link at 10GB, 1GB, or 100MB. This is a display of the current setting. .It Va hw.ixl.fw_version This is a display of the Firmware version. +.It Va dev.ixl.#.debug.switch_vlans +Set the Ethertype used by the hardware itself to handle internal +services. +Frames with this Ethertype will be dropped without notice. +Defaults to +.Dv 0x88a8 , +which is a well known number for IEEE 802.1ad VLAN stacking. +If you need 802.1ad support, set this number to any another Ethertype i.e. +.Dv 0xffff . .El .Sh Interrupt Storms It is important to note that 40G operation can generate high diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index 1ddc21760d05..7d56e0562071 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -73,6 +73,7 @@ static int ixl_sysctl_phy_abilities(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_sw_filter_list(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_hw_res_alloc(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_switch_config(SYSCTL_HANDLER_ARGS); +static int ixl_sysctl_switch_vlans(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_hkey(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_hena(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_hlut(SYSCTL_HANDLER_ARGS); @@ -4529,6 +4530,10 @@ ixl_add_device_sysctls(struct ixl_pf *pf) OID_AUTO, "switch_config", CTLTYPE_STRING | CTLFLAG_RD, pf, 0, ixl_sysctl_switch_config, "A", "HW Switch Configuration"); + SYSCTL_ADD_PROC(ctx, debug_list, + OID_AUTO, "switch_vlans", CTLTYPE_INT | CTLFLAG_WR, + pf, 0, ixl_sysctl_switch_vlans, "I", "HW Switch VLAN Configuration"); + SYSCTL_ADD_PROC(ctx, debug_list, OID_AUTO, "rss_key", CTLTYPE_STRING | CTLFLAG_RD, pf, 0, ixl_sysctl_hkey, "A", "View RSS key"); @@ -6069,6 +6074,40 @@ ixl_sysctl_switch_config(SYSCTL_HANDLER_ARGS) return (error); } +static int +ixl_sysctl_switch_vlans(SYSCTL_HANDLER_ARGS) +{ + struct ixl_pf *pf = (struct ixl_pf *)arg1; + struct i40e_hw *hw = &pf->hw; + device_t dev = pf->dev; + int requested_vlan = -1; + enum i40e_status_code status = 0; + int error = 0; + + error = sysctl_handle_int(oidp, &requested_vlan, 0, req); + if ((error) || (req->newptr == NULL)) + return (error); + + if ((hw->flags & I40E_HW_FLAG_802_1AD_CAPABLE) == 0) { + device_printf(dev, "Flags disallow setting of vlans\n"); + return (ENODEV); + } + + hw->switch_tag = requested_vlan; + device_printf(dev, + "Setting switch config to switch_tag=%04x, first_tag=%04x, second_tag=%04x\n", + hw->switch_tag, hw->first_tag, hw->second_tag); + status = i40e_aq_set_switch_config(hw, 0, 0, 0, NULL); + if (status) { + device_printf(dev, + "%s: aq_set_switch_config() error %s, aq error %s\n", + __func__, i40e_stat_str(hw, status), + i40e_aq_str(hw, hw->aq.asq_last_status)); + return (status); + } + return (0); +} + static int ixl_sysctl_hkey(SYSCTL_HANDLER_ARGS) { From owner-dev-commits-src-branches@freebsd.org Tue Feb 2 14:43:48 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 42C7F534807; Tue, 2 Feb 2021 14:43: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 4DVSHS1N13z3NSg; Tue, 2 Feb 2021 14:43:48 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 222CC7CCB; Tue, 2 Feb 2021 14:43:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 112EhmY1035404; Tue, 2 Feb 2021 14:43:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 112Ehmdb035403; Tue, 2 Feb 2021 14:43:48 GMT (envelope-from git) Date: Tue, 2 Feb 2021 14:43:48 GMT Message-Id: <202102021443.112Ehmdb035403@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: a2c37aa836c0 - stable/12 - ixl: Permit 802.1ad frames to pass though the chip MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a2c37aa836c0d24b97102605d65971b887a8e957 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2021 14:43:48 -0000 The branch stable/12 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=a2c37aa836c0d24b97102605d65971b887a8e957 commit a2c37aa836c0d24b97102605d65971b887a8e957 Author: Lutz Donnerhacke AuthorDate: 2021-02-02 14:42:38 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-02-02 14:42:38 +0000 ixl: Permit 802.1ad frames to pass though the chip This patch is a quick hack to change the internal Ethertype used within the chip. All frames with this type are dropped silently. This patch allows you to overwrite the factory default 0x88a8, which is used by IEEE 802.1ad VLAN stacking. Reviewed by: kp, philip, brueffer Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D24179 (cherry picked from commit fa6662b3689eeb71cb63c2b230ca08e7342cabf0) --- share/man/man4/ixl.4 | 11 ++++++++++- sys/dev/ixl/ixl_pf_main.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/share/man/man4/ixl.4 b/share/man/man4/ixl.4 index 9f264de9d9c4..8d98d974ac43 100644 --- a/share/man/man4/ixl.4 +++ b/share/man/man4/ixl.4 @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 27, 2020 +.Dd January 19, 2021 .Dt IXL 4 .Os .Sh NAME @@ -227,6 +227,15 @@ contains the speeds that are allowed to be set. Displays the current speed. .It Va dev.ixl.#.fw_version Displays the current firmware and NVM versions of the adapter. +.It Va dev.ixl.#.debug.switch_vlans +Set the Ethertype used by the hardware itself to handle internal +services. +Frames with this Ethertype will be dropped without notice. +Defaults to +.Dv 0x88a8 , +which is a well known number for IEEE 802.1ad VLAN stacking. +If you need 802.1ad support, set this number to any another Ethertype i.e. +.Dv 0xffff . .El .Sh INTERRUPT STORMS It is important to note that 40G operation can generate high diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index 6990ef80a184..c563eca63605 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -67,6 +67,7 @@ static int ixl_sysctl_phy_abilities(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_sw_filter_list(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_hw_res_alloc(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_switch_config(SYSCTL_HANDLER_ARGS); +static int ixl_sysctl_switch_vlans(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_hkey(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_hena(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_hlut(SYSCTL_HANDLER_ARGS); @@ -2316,6 +2317,10 @@ ixl_add_device_sysctls(struct ixl_pf *pf) OID_AUTO, "switch_config", CTLTYPE_STRING | CTLFLAG_RD, pf, 0, ixl_sysctl_switch_config, "A", "HW Switch Configuration"); + SYSCTL_ADD_PROC(ctx, debug_list, + OID_AUTO, "switch_vlans", CTLTYPE_INT | CTLFLAG_WR, + pf, 0, ixl_sysctl_switch_vlans, "I", "HW Switch VLAN Configuration"); + SYSCTL_ADD_PROC(ctx, debug_list, OID_AUTO, "rss_key", CTLTYPE_STRING | CTLFLAG_RD, pf, 0, ixl_sysctl_hkey, "A", "View RSS key"); @@ -3456,6 +3461,40 @@ ixl_sysctl_switch_config(SYSCTL_HANDLER_ARGS) return (error); } +static int +ixl_sysctl_switch_vlans(SYSCTL_HANDLER_ARGS) +{ + struct ixl_pf *pf = (struct ixl_pf *)arg1; + struct i40e_hw *hw = &pf->hw; + device_t dev = pf->dev; + int requested_vlan = -1; + enum i40e_status_code status = 0; + int error = 0; + + error = sysctl_handle_int(oidp, &requested_vlan, 0, req); + if ((error) || (req->newptr == NULL)) + return (error); + + if ((hw->flags & I40E_HW_FLAG_802_1AD_CAPABLE) == 0) { + device_printf(dev, "Flags disallow setting of vlans\n"); + return (ENODEV); + } + + hw->switch_tag = requested_vlan; + device_printf(dev, + "Setting switch config to switch_tag=%04x, first_tag=%04x, second_tag=%04x\n", + hw->switch_tag, hw->first_tag, hw->second_tag); + status = i40e_aq_set_switch_config(hw, 0, 0, 0, NULL); + if (status) { + device_printf(dev, + "%s: aq_set_switch_config() error %s, aq error %s\n", + __func__, i40e_stat_str(hw, status), + i40e_aq_str(hw, hw->aq.asq_last_status)); + return (status); + } + return (0); +} + static int ixl_sysctl_hkey(SYSCTL_HANDLER_ARGS) { From owner-dev-commits-src-branches@freebsd.org Tue Feb 2 16:53:48 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A456C537408; Tue, 2 Feb 2021 16:53:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DVW9S4Jvqz3mFb; Tue, 2 Feb 2021 16:53:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (unknown [IPv6:2601:648:8681:1cb0:a03e:f824:f6c:d0c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 193722AC7C; Tue, 2 Feb 2021 16:53:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) To: Mateusz Guzik , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org References: <202102011240.111CehGE094845@gitrepo.freebsd.org> From: John Baldwin Subject: Re: git: e92ab3adf4f9 - stable/13 - atomic: make atomic_store_ptr type-aware Message-ID: Date: Tue, 2 Feb 2021 08:53:46 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <202102011240.111CehGE094845@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2021 16:53:48 -0000 On 2/1/21 4:40 AM, Mateusz Guzik wrote: > The branch stable/13 has been updated by mjg: > > URL: https://cgit.FreeBSD.org/src/commit/?id=e92ab3adf4f9848933439c9c2fca36df290c0884 > > commit e92ab3adf4f9848933439c9c2fca36df290c0884 > Author: Mateusz Guzik > AuthorDate: 2021-01-25 19:39:14 +0000 > Commit: Mateusz Guzik > CommitDate: 2021-02-01 12:39:16 +0000 > > atomic: make atomic_store_ptr type-aware > > (cherry picked from commit cc96f92a570e05636a20fdd15d4616b127bb9ecc) A couple of folks expressed concerns about this commit when it landed in main due to it being too flexible (it allows you to store pointers to non-pointer types, e.g.: char c; uintptr_t p; atomic_store_ptr(&c, p); Silently becomes: atomic_store_char(&c, (char)p); Are you planning to address this? -- John Baldwin From owner-dev-commits-src-branches@freebsd.org Tue Feb 2 16:57:43 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C23053743E; Tue, 2 Feb 2021 16:57:43 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DVWFz3vcyz3mqG; Tue, 2 Feb 2021 16:57:43 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm1-x330.google.com with SMTP id i9so2933616wmq.1; Tue, 02 Feb 2021 08:57:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ul7ClqMHgQAn/txdLP8TiV/T9fKC/+t+pP67I8pvcBY=; b=d3eSMT7WVmuajBG8aapozyPo2gLfu4zMXN/zsy21qJQMWFBtCJJu8bivDoRad9oMpH 6OtpBrLAZWUJxJT2Ie+BD2ZoOD3a3VMe475oOkFH1X5C6xK83zEUjPJ0fHSwONDp+ICy c28Up8dx2m8oj2DCsjmwuU/J1TvOEjGOSnxjYgFjzqWox/Q+lGd+lw+AIrFfYlHau+Rw ivYH/9tXJlM1ikcPEvwdEPoxpxGJWn+TcHzuJofTdX8VjO93XVe4508IZlrUUEsrh+fi 1HlF18tD6My/tf14Zg4c42RQ1NIfZdkviD7Lp/Y0ZXUp5EwHIVrr0/zvA1mD8T9ZifGi 39iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ul7ClqMHgQAn/txdLP8TiV/T9fKC/+t+pP67I8pvcBY=; b=KfABeL027ITRyoHOrD2EeFUq0ogTxAMfPp5lVSurvbWairk5pDRz4PUgyWkojXuD/F O7jhQIf/FAfpbh4TMqbSm7TVE86FUteqU4mMdLgFulhDEshZkr9lo3rdLeUFJDhhLrG2 GUh132BCsrOnqlY72dts65nIiFE4VLUqh9EVgoJvHG2SnDwltQLSzKAB+JkkRE+IEQ4d oUn258LmK6MTuekBRQUMH5XU784BeEkReezoMypkB3JfAPVwpnUVbIJzOJPEQA0+P27e OaK7pZqvMzf9u0gt29N1RQvcHzjSRygaooHfOBxlbpXZOv2vQGH0qA/9UlLQtQ7PRP5T n3zw== X-Gm-Message-State: AOAM531ShuyxLtRXpxl0vKnvdlomf+onOJoxD8FDEZt4M6sQTAQ7960H mlwUJZs4EfEc8W+UDmQlS6P5+t2dJs0Vx6a+DYDPjgi5PIw= X-Google-Smtp-Source: ABdhPJwUwvzs4wq8XHzPjEyPgSzI6AhFz+rRi2gGbQ0pOEbcvl6AYFSN1vjW9M01A8elKg37oVeycMFaM0M3xyGexJY= X-Received: by 2002:a1c:2ec2:: with SMTP id u185mr4478901wmu.83.1612285061614; Tue, 02 Feb 2021 08:57:41 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a5d:464c:0:0:0:0:0 with HTTP; Tue, 2 Feb 2021 08:57:40 -0800 (PST) In-Reply-To: References: <202102011240.111CehGE094845@gitrepo.freebsd.org> From: Mateusz Guzik Date: Tue, 2 Feb 2021 17:57:40 +0100 Message-ID: Subject: Re: git: e92ab3adf4f9 - stable/13 - atomic: make atomic_store_ptr type-aware To: John Baldwin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DVWFz3vcyz3mqG X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2021 16:57:43 -0000 I thought I responded to this bit, I did not address the (in my opinion incorrect) claim that a fence can't be avoided rendering consume primitive pointless. I have a somewhat reply for this. but tl;dr yes, I'll add validation for pointer types A bug was reported in the namecache which I want to take care of before I do other stuff. On 2/2/21, John Baldwin wrote: > On 2/1/21 4:40 AM, Mateusz Guzik wrote: >> The branch stable/13 has been updated by mjg: >> >> URL: >> https://cgit.FreeBSD.org/src/commit/?id=e92ab3adf4f9848933439c9c2fca36df290c0884 >> >> commit e92ab3adf4f9848933439c9c2fca36df290c0884 >> Author: Mateusz Guzik >> AuthorDate: 2021-01-25 19:39:14 +0000 >> Commit: Mateusz Guzik >> CommitDate: 2021-02-01 12:39:16 +0000 >> >> atomic: make atomic_store_ptr type-aware >> >> (cherry picked from commit cc96f92a570e05636a20fdd15d4616b127bb9ecc) > > A couple of folks expressed concerns about this commit when it landed > in main due to it being too flexible (it allows you to store pointers > to non-pointer types, e.g.: > > char c; > uintptr_t p; > > atomic_store_ptr(&c, p); > > Silently becomes: > > atomic_store_char(&c, (char)p); > > Are you planning to address this? > > -- > John Baldwin > -- Mateusz Guzik From owner-dev-commits-src-branches@freebsd.org Tue Feb 2 16:58:09 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 565B25371FF; Tue, 2 Feb 2021 16:58:09 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DVWGS4mrwz3n2N; Tue, 2 Feb 2021 16:58:08 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wr1-x42f.google.com with SMTP id 7so21256487wrz.0; Tue, 02 Feb 2021 08:58:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=iu23osRc+lLe3snSX5n69ppFkr1xRLXH6KjcJIqVSf4=; b=nO2lfMF+3tZZ1TzI/BfNGW4v+GSgNoJs3D9dmvKtJvnFwqUHFSEft9dXErR4LXhR1m n4x3fRvh8WbRZ883xWUg4VyD96jXM1tBfbXL2zgp/+C90i6ScuBr7kpAKmpv7Ja/vU1B aqUKS6X3Pohj0dbV8IIjDciOEyjufxU+OE8eDzKwsAY5nfjGDG4wWQ+MWpEayn/DQ7SY h7BVND5UEYM/J9q8kaxSkZwTmGzbZDat/a6tVvCXzt8Ocz8twCeY6iYXcoBhSFN677UX xjToj21QQjCgs1iSq5zB+7iH4+R7sJewhJObD4/TzVjbu4dkKm3ALNtRCVt8+ZgzVTaX OT5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=iu23osRc+lLe3snSX5n69ppFkr1xRLXH6KjcJIqVSf4=; b=UrT+emRfMDCzkGON+0azLIdqda4jHlqpYD8OG8yX+iFIB7oUHob1xCOywWIFPlazgY pb1aRx4JKgoDLUiAuBNs/QuL+2ucEWgS73OtXXNE5PU44tSiPss9DCtZ/9i8ut7w4yN7 gVz+R8v7egFEaw1xuL2kFqb5gAfGQ6Kuyh23mH2M8b3qrfmhS10C/apAyYwSGTWGxLr2 4VNV2aOW0Z7W4ET99zXkrgx7D37BWKV+f56pSSzJIQEUPkLcSy3TuMmjE03ez9JU/dMc /dbEH2V1jGXit9W5l3vqZKpj3ijfOFUJ13N/msu7sAc7rqGFDBrN3fu8itkSRd1pUmwB ZBqA== X-Gm-Message-State: AOAM531AtYVioeVJYh0QLX6343RI0NdBvptkGAvrVQN2y+AF6iHJ5TsB vIIGwoImHnGKdc86OlVb4kWZBroJIyi7sExSVBw8p6V8sKIlZA== X-Google-Smtp-Source: ABdhPJygkxtsa4PNhItr7x+TrUaw+/GHJBdFs89kRHwCK6mtNL0I20GPq6oGuEzAdFMSWtH174uEG5Urd/dswwOpZHY= X-Received: by 2002:adf:e511:: with SMTP id j17mr24726115wrm.17.1612285086545; Tue, 02 Feb 2021 08:58:06 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a5d:464c:0:0:0:0:0 with HTTP; Tue, 2 Feb 2021 08:58:05 -0800 (PST) In-Reply-To: References: <202102011240.111CehGE094845@gitrepo.freebsd.org> From: Mateusz Guzik Date: Tue, 2 Feb 2021 17:58:05 +0100 Message-ID: Subject: Re: git: e92ab3adf4f9 - stable/13 - atomic: make atomic_store_ptr type-aware To: John Baldwin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DVWGS4mrwz3n2N X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=nO2lfMF+; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::42f as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::42f:from]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; TO_DN_SOME(0.00)[]; NEURAL_SPAM_SHORT(1.00)[0.998]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::42f:from:127.0.2.255]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::42f:from]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-branches]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2021 16:58:09 -0000 On 2/2/21, Mateusz Guzik wrote: > I thought I responded to this bit, I did not address the (in my > opinion incorrect) claim that a fence can't be avoided rendering > consume primitive pointless. I have a somewhat reply for this. somewhat longer > > but tl;dr yes, I'll add validation for pointer types > > A bug was reported in the namecache which I want to take care of > before I do other stuff. > > On 2/2/21, John Baldwin wrote: >> On 2/1/21 4:40 AM, Mateusz Guzik wrote: >>> The branch stable/13 has been updated by mjg: >>> >>> URL: >>> https://cgit.FreeBSD.org/src/commit/?id=e92ab3adf4f9848933439c9c2fca36df290c0884 >>> >>> commit e92ab3adf4f9848933439c9c2fca36df290c0884 >>> Author: Mateusz Guzik >>> AuthorDate: 2021-01-25 19:39:14 +0000 >>> Commit: Mateusz Guzik >>> CommitDate: 2021-02-01 12:39:16 +0000 >>> >>> atomic: make atomic_store_ptr type-aware >>> >>> (cherry picked from commit >>> cc96f92a570e05636a20fdd15d4616b127bb9ecc) >> >> A couple of folks expressed concerns about this commit when it landed >> in main due to it being too flexible (it allows you to store pointers >> to non-pointer types, e.g.: >> >> char c; >> uintptr_t p; >> >> atomic_store_ptr(&c, p); >> >> Silently becomes: >> >> atomic_store_char(&c, (char)p); >> >> Are you planning to address this? >> >> -- >> John Baldwin >> > > > -- > Mateusz Guzik > -- Mateusz Guzik From owner-dev-commits-src-branches@freebsd.org Tue Feb 2 18:16:06 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C2A84539AA9; Tue, 2 Feb 2021 18:16: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 4DVY0Q4wJQz3tsv; Tue, 2 Feb 2021 18:16:06 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9A20712E21; Tue, 2 Feb 2021 18:16:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 112IG64X009893; Tue, 2 Feb 2021 18:16:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 112IG6AV009892; Tue, 2 Feb 2021 18:16:06 GMT (envelope-from git) Date: Tue, 2 Feb 2021 18:16:06 GMT Message-Id: <202102021816.112IG6AV009892@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 4e29933d0936 - stable/13 - cache: fix trailing slash support in face of permission problems MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4e29933d0936fd053f7591ee118dc1fc42617514 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2021 18:16:06 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=4e29933d0936fd053f7591ee118dc1fc42617514 commit 4e29933d0936fd053f7591ee118dc1fc42617514 Author: Mateusz Guzik AuthorDate: 2021-02-02 18:06:56 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-02 18:15:48 +0000 cache: fix trailing slash support in face of permission problems Reported by: Johan Hendriks Tested by: kevans (cherry picked from commit 45456abc4ce71053d07cf03ca63bd1ce459fec55) --- sys/kern/vfs_cache.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 1780e8235dd3..fe7e70ba1359 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -5494,6 +5494,16 @@ cache_fplookup_failed_vexec(struct cache_fpl *fpl, int error) dvp = fpl->dvp; dvp_seqc = fpl->dvp_seqc; + /* + * TODO: Due to ignoring slashes lookup will perform a permission check + * on the last dir when it should not have. If it fails, we get here. + * It is possible possible to fix it up fully without resorting to + * regular lookup, but for now just abort. + */ + if (cache_fpl_istrailingslash(fpl)) { + return (cache_fpl_aborted(fpl)); + } + /* * Hack: delayed name len checking. */ From owner-dev-commits-src-branches@freebsd.org Tue Feb 2 21:14:02 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4C47053DFEB; Tue, 2 Feb 2021 21:14: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 4DVcxk1h2sz4ZFm; Tue, 2 Feb 2021 21:14:02 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2C62B15059; Tue, 2 Feb 2021 21:14:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 112LE2Md044852; Tue, 2 Feb 2021 21:14:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 112LE2oi044851; Tue, 2 Feb 2021 21:14:02 GMT (envelope-from git) Date: Tue, 2 Feb 2021 21:14:02 GMT Message-Id: <202102022114.112LE2oi044851@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 58a9e1ca8579 - stable/12 - fstyp(8): Show exFAT volume labels with -l flag MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 58a9e1ca85797a050d3a39bffa6babcb9d3463a4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2021 21:14:02 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=58a9e1ca85797a050d3a39bffa6babcb9d3463a4 commit 58a9e1ca85797a050d3a39bffa6babcb9d3463a4 Author: Conrad Meyer AuthorDate: 2019-12-22 03:19:17 +0000 Commit: Ed Maste CommitDate: 2021-02-02 21:12:04 +0000 fstyp(8): Show exFAT volume labels with -l flag exfat is fundamentally the same design as fat32. The superblock differs marginally, and there are some additional optional features irrelevant to fstype(8); the structure of dirents has changed slightly to enable, among other things, larger files; the directory entries are no longer DOS 8.3 ASCII or local 8-bit encoding, but instead explicitly UCS-2-LE. (As a result, this change uses iconv to convert a found exfat volume label to the user's locale.) Locating the volume label is identical to FAT32: locate the root directory and walk through dirents until you find a volume label. Like FAT32, follow the FAT chain between root directory clusters as necessary. PR: 242225 Reported by: Victor Sudakov (cherry picked from commit 85b4c344c8c69ff7993bc0ac833aaf9a8108b88d) fstyp(8): Fix WITHOUT_ICONV build Reported by: olivier (cherry picked from commit 5ab1cb52b21fdc5524bd970e9b5cdff21a5bcabf) --- usr.sbin/fstyp/Makefile | 4 + usr.sbin/fstyp/exfat.c | 303 ++++++++++++++++++++++++++++++++++++- usr.sbin/fstyp/fstyp.c | 49 ++++-- usr.sbin/fstyp/fstyp.h | 7 + usr.sbin/fstyp/ntfs.c | 6 + usr.sbin/fstyp/tests/fstyp_test.sh | 10 ++ 6 files changed, 367 insertions(+), 12 deletions(-) diff --git a/usr.sbin/fstyp/Makefile b/usr.sbin/fstyp/Makefile index ebdfcc5ab6b5..f257d6472d8c 100644 --- a/usr.sbin/fstyp/Makefile +++ b/usr.sbin/fstyp/Makefile @@ -13,6 +13,10 @@ MAN= fstyp.8 WARNS?= 2 +.if ${MK_ICONV} == "yes" +CFLAGS+= -DWITH_ICONV +.endif + .include .if ${TARGET_ENDIANNESS} == 1234 diff --git a/usr.sbin/fstyp/exfat.c b/usr.sbin/fstyp/exfat.c index 9c379df0c3f6..d77ba9253d39 100644 --- a/usr.sbin/fstyp/exfat.c +++ b/usr.sbin/fstyp/exfat.c @@ -27,6 +27,16 @@ #include __FBSDID("$FreeBSD$"); +#include +#include + +#include +#include +#include +#ifdef WITH_ICONV +#include +#endif +#include #include #include #include @@ -34,6 +44,10 @@ __FBSDID("$FreeBSD$"); #include "fstyp.h" +/* + * https://docs.microsoft.com/en-us/windows/win32/fileio/exfat-specification + */ + struct exfat_vbr { char ev_jmp[3]; char ev_fsname[8]; @@ -55,19 +69,304 @@ struct exfat_vbr { uint8_t ev_percent_used; } __packed; +struct exfat_dirent { + uint8_t xde_type; +#define XDE_TYPE_INUSE_MASK 0x80 /* 1=in use */ +#define XDE_TYPE_INUSE_SHIFT 7 +#define XDE_TYPE_CATEGORY_MASK 0x40 /* 0=primary */ +#define XDE_TYPE_CATEGORY_SHIFT 6 +#define XDE_TYPE_IMPORTNC_MASK 0x20 /* 0=critical */ +#define XDE_TYPE_IMPORTNC_SHIFT 5 +#define XDE_TYPE_CODE_MASK 0x1f +/* InUse=0, ..., TypeCode=0: EOD. */ +#define XDE_TYPE_EOD 0x00 +#define XDE_TYPE_ALLOC_BITMAP (XDE_TYPE_INUSE_MASK | 0x01) +#define XDE_TYPE_UPCASE_TABLE (XDE_TYPE_INUSE_MASK | 0x02) +#define XDE_TYPE_VOL_LABEL (XDE_TYPE_INUSE_MASK | 0x03) +#define XDE_TYPE_FILE (XDE_TYPE_INUSE_MASK | 0x05) +#define XDE_TYPE_VOL_GUID (XDE_TYPE_INUSE_MASK | XDE_TYPE_IMPORTNC_MASK) +#define XDE_TYPE_STREAM_EXT (XDE_TYPE_INUSE_MASK | XDE_TYPE_CATEGORY_MASK) +#define XDE_TYPE_FILE_NAME (XDE_TYPE_INUSE_MASK | XDE_TYPE_CATEGORY_MASK | 0x01) +#define XDE_TYPE_VENDOR (XDE_TYPE_INUSE_MASK | XDE_TYPE_CATEGORY_MASK | XDE_TYPE_IMPORTNC_MASK) +#define XDE_TYPE_VENDOR_ALLOC (XDE_TYPE_INUSE_MASK | XDE_TYPE_CATEGORY_MASK | XDE_TYPE_IMPORTNC_MASK | 0x01) + union { + uint8_t xde_generic_[19]; + struct exde_primary { + /* + * Count of "secondary" dirents following this one. + * + * A single logical entity may be composed of a + * sequence of several dirents, starting with a primary + * one; the rest are secondary dirents. + */ + uint8_t xde_secondary_count_; + uint16_t xde_set_chksum_; + uint16_t xde_prim_flags_; + uint8_t xde_prim_generic_[14]; + } __packed xde_primary_; + struct exde_secondary { + uint8_t xde_sec_flags_; + uint8_t xde_sec_generic_[18]; + } __packed xde_secondary_; + } u; + uint32_t xde_first_cluster; + uint64_t xde_data_len; +} __packed; +#define xde_generic u.xde_generic_ +#define xde_secondary_count u.xde_primary_.xde_secondary_count +#define xde_set_chksum u.xde_primary_.xde_set_chksum_ +#define xde_prim_flags u.xde_primary_.xde_prim_flags_ +#define xde_sec_flags u.xde_secondary_.xde_sec_flags_ +_Static_assert(sizeof(struct exfat_dirent) == 32, "spec"); + +struct exfat_de_label { + uint8_t xdel_type; /* XDE_TYPE_VOL_LABEL */ + uint8_t xdel_char_cnt; /* Length of UCS-2 label */ + uint16_t xdel_vol_lbl[11]; + uint8_t xdel_reserved[8]; +} __packed; +_Static_assert(sizeof(struct exfat_de_label) == 32, "spec"); + +#define MAIN_BOOT_REGION_SECT 0 +#define BACKUP_BOOT_REGION_SECT 12 + +#define SUBREGION_CHKSUM_SECT 11 + +#define FIRST_CLUSTER 2 +#define BAD_BLOCK_SENTINEL 0xfffffff7u +#define END_CLUSTER_SENTINEL 0xffffffffu + +static inline void * +read_sectn(FILE *fp, off_t sect, unsigned count, unsigned bytespersec) +{ + return (read_buf(fp, sect * bytespersec, bytespersec * count)); +} + +static inline void * +read_sect(FILE *fp, off_t sect, unsigned bytespersec) +{ + return (read_sectn(fp, sect, 1, bytespersec)); +} + +/* + * Compute the byte-by-byte multi-sector checksum of the given boot region + * (MAIN or BACKUP), for a given bytespersec (typically 512 or 4096). + * + * Endian-safe; result is host endian. + */ +static int +exfat_compute_boot_chksum(FILE *fp, unsigned region, unsigned bytespersec, + uint32_t *result) +{ + unsigned char *sector; + unsigned n, sect; + uint32_t checksum; + + checksum = 0; + for (sect = 0; sect < 11; sect++) { + sector = read_sect(fp, region + sect, bytespersec); + if (sector == NULL) + return (ENXIO); + for (n = 0; n < bytespersec; n++) { + if (sect == 0) { + switch (n) { + case 106: + case 107: + case 112: + continue; + } + } + checksum = ((checksum & 1) ? 0x80000000u : 0u) + + (checksum >> 1) + (uint32_t)sector[n]; + } + free(sector); + } + + *result = checksum; + return (0); +} + +#ifdef WITH_ICONV +static void +convert_label(const uint16_t *ucs2label /* LE */, unsigned ucs2len, char + *label_out, size_t label_sz) +{ + const char *label; + char *label_out_orig; + iconv_t cd; + size_t srcleft, rc; + + /* Currently hardcoded in fstyp.c as 256 or so. */ + assert(label_sz > 1); + + if (ucs2len == 0) { + /* + * Kind of seems bogus, but the spec allows an empty label + * entry with the same meaning as no label. + */ + return; + } + + if (ucs2len > 11) { + warnx("exfat: Bogus volume label length: %u", ucs2len); + return; + } + + /* dstname="" means convert to the current locale. */ + cd = iconv_open("", EXFAT_ENC); + if (cd == (iconv_t)-1) { + warn("exfat: Could not open iconv"); + return; + } + + label_out_orig = label_out; + + /* Dummy up the byte pointer and byte length iconv's API wants. */ + label = (const void *)ucs2label; + srcleft = ucs2len * sizeof(*ucs2label); + + rc = iconv(cd, __DECONST(char **, &label), &srcleft, &label_out, + &label_sz); + if (rc == (size_t)-1) { + warn("exfat: iconv()"); + *label_out_orig = '\0'; + } else { + /* NUL-terminate result (iconv advances label_out). */ + if (label_sz == 0) + label_out--; + *label_out = '\0'; + } + + iconv_close(cd); +} + +/* + * Using the FAT table, look up the next cluster in this chain. + */ +static uint32_t +exfat_fat_next(FILE *fp, const struct exfat_vbr *ev, unsigned BPS, + uint32_t cluster) +{ + uint32_t fat_offset_sect, clsect, clsectoff; + uint32_t *fatsect, nextclust; + + fat_offset_sect = le32toh(ev->ev_fat_offset); + clsect = fat_offset_sect + (cluster / (BPS / sizeof(cluster))); + clsectoff = (cluster % (BPS / sizeof(cluster))); + + /* XXX This is pretty wasteful without a block cache for the FAT. */ + fatsect = read_sect(fp, clsect, BPS); + nextclust = le32toh(fatsect[clsectoff]); + free(fatsect); + + return (nextclust); +} + +static void +exfat_find_label(FILE *fp, const struct exfat_vbr *ev, unsigned BPS, + char *label_out, size_t label_sz) +{ + uint32_t rootdir_cluster, sects_per_clust, cluster_offset_sect; + off_t rootdir_sect; + struct exfat_dirent *declust, *it; + + cluster_offset_sect = le32toh(ev->ev_cluster_offset); + rootdir_cluster = le32toh(ev->ev_rootdir_cluster); + sects_per_clust = (1u << ev->ev_log_sect_per_clust); + + if (rootdir_cluster < FIRST_CLUSTER) { + warnx("%s: invalid rootdir cluster %u < %d", __func__, + rootdir_cluster, FIRST_CLUSTER); + return; + } + + + for (; rootdir_cluster != END_CLUSTER_SENTINEL; + rootdir_cluster = exfat_fat_next(fp, ev, BPS, rootdir_cluster)) { + if (rootdir_cluster == BAD_BLOCK_SENTINEL) { + warnx("%s: Bogus bad block in root directory chain", + __func__); + return; + } + + rootdir_sect = (rootdir_cluster - FIRST_CLUSTER) * + sects_per_clust + cluster_offset_sect; + declust = read_sectn(fp, rootdir_sect, sects_per_clust, BPS); + for (it = declust; + it < declust + (sects_per_clust * BPS / sizeof(*it)); it++) { + bool eod = false; + + /* + * Simplistic directory traversal; doesn't do any + * validation of "MUST" requirements in spec. + */ + switch (it->xde_type) { + case XDE_TYPE_EOD: + eod = true; + break; + case XDE_TYPE_VOL_LABEL: { + struct exfat_de_label *lde = (void*)it; + convert_label(lde->xdel_vol_lbl, + lde->xdel_char_cnt, label_out, label_sz); + free(declust); + return; + } + } + + if (eod) + break; + } + free(declust); + } +} +#endif /* WITH_ICONV */ + int fstyp_exfat(FILE *fp, char *label, size_t size) { struct exfat_vbr *ev; + uint32_t *cksect; + unsigned bytespersec; + uint32_t chksum; + int error; + cksect = NULL; ev = (struct exfat_vbr *)read_buf(fp, 0, 512); if (ev == NULL || strncmp(ev->ev_fsname, "EXFAT ", 8) != 0) goto fail; + if (ev->ev_log_bytes_per_sect < 9 || ev->ev_log_bytes_per_sect > 12) { + warnx("exfat: Invalid BytesPerSectorShift"); + goto done; + } + + bytespersec = (1u << ev->ev_log_bytes_per_sect); + + error = exfat_compute_boot_chksum(fp, MAIN_BOOT_REGION_SECT, + bytespersec, &chksum); + if (error != 0) + goto done; + + cksect = read_sect(fp, MAIN_BOOT_REGION_SECT + SUBREGION_CHKSUM_SECT, + bytespersec); + /* - * Reading the volume label requires walking the root directory to look - * for a special label file. Left as an exercise for the reader. + * Technically the entire sector should be full of repeating 4-byte + * checksum pattern, but we only verify the first. */ + if (chksum != le32toh(cksect[0])) { + warnx("exfat: Found checksum 0x%08x != computed 0x%08x", + le32toh(cksect[0]), chksum); + goto done; + } + +#ifdef WITH_ICONV + if (show_label) + exfat_find_label(fp, ev, bytespersec, label, size); +#endif + +done: + free(cksect); free(ev); return (0); diff --git a/usr.sbin/fstyp/fstyp.c b/usr.sbin/fstyp/fstyp.c index 31f7b34bde40..141090eb4312 100644 --- a/usr.sbin/fstyp/fstyp.c +++ b/usr.sbin/fstyp/fstyp.c @@ -38,6 +38,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef WITH_ICONV +#include +#endif +#include #include #include #include @@ -50,24 +54,27 @@ __FBSDID("$FreeBSD$"); #define LABEL_LEN 256 +bool show_label = false; + typedef int (*fstyp_function)(FILE *, char *, size_t); static struct { const char *name; fstyp_function function; bool unmountable; + char *precache_encoding; } fstypes[] = { - { "cd9660", &fstyp_cd9660, false }, - { "exfat", &fstyp_exfat, false }, - { "ext2fs", &fstyp_ext2fs, false }, - { "geli", &fstyp_geli, true }, - { "msdosfs", &fstyp_msdosfs, false }, - { "ntfs", &fstyp_ntfs, false }, - { "ufs", &fstyp_ufs, false }, + { "cd9660", &fstyp_cd9660, false, NULL }, + { "exfat", &fstyp_exfat, false, EXFAT_ENC }, + { "ext2fs", &fstyp_ext2fs, false, NULL }, + { "geli", &fstyp_geli, true, NULL }, + { "msdosfs", &fstyp_msdosfs, false, NULL }, + { "ntfs", &fstyp_ntfs, false, NULL }, + { "ufs", &fstyp_ufs, false, NULL }, #ifdef HAVE_ZFS - { "zfs", &fstyp_zfs, true }, + { "zfs", &fstyp_zfs, true, NULL }, #endif - { NULL, NULL, NULL } + { NULL, NULL, NULL, NULL } }; void * @@ -159,7 +166,7 @@ int main(int argc, char **argv) { int ch, error, i, nbytes; - bool ignore_type = false, show_label = false, show_unmountable = false; + bool ignore_type = false, show_unmountable = false; char label[LABEL_LEN + 1], strvised[LABEL_LEN * 4 + 1]; char *path; FILE *fp; @@ -188,6 +195,28 @@ main(int argc, char **argv) path = argv[0]; + if (setlocale(LC_CTYPE, "") == NULL) + err(1, "setlocale"); + caph_cache_catpages(); + +#ifdef WITH_ICONV + /* Cache iconv conversion data before entering capability mode. */ + if (show_label) { + for (i = 0; i < nitems(fstypes); i++) { + iconv_t cd; + + if (fstypes[i].precache_encoding == NULL) + continue; + cd = iconv_open("", fstypes[i].precache_encoding); + if (cd == (iconv_t)-1) + err(1, "%s: iconv_open %s", fstypes[i].name, + fstypes[i].precache_encoding); + /* Iconv keeps a small cache of unused encodings. */ + iconv_close(cd); + } + } +#endif + fp = fopen(path, "r"); if (fp == NULL) err(1, "%s", path); diff --git a/usr.sbin/fstyp/fstyp.h b/usr.sbin/fstyp/fstyp.h index f858b0c53827..3b8e80cfe71d 100644 --- a/usr.sbin/fstyp/fstyp.h +++ b/usr.sbin/fstyp/fstyp.h @@ -32,8 +32,15 @@ #ifndef FSTYP_H #define FSTYP_H +#include + #define MIN(a,b) (((a)<(b))?(a):(b)) +/* The spec doesn't seem to permit UTF-16 surrogates; definitely LE. */ +#define EXFAT_ENC "UCS-2LE" + +extern bool show_label; /* -l flag */ + void *read_buf(FILE *fp, off_t off, size_t len); char *checked_strdup(const char *s); void rtrim(char *label, size_t size); diff --git a/usr.sbin/fstyp/ntfs.c b/usr.sbin/fstyp/ntfs.c index 905841045e7d..6cf0bec1ae75 100644 --- a/usr.sbin/fstyp/ntfs.c +++ b/usr.sbin/fstyp/ntfs.c @@ -31,6 +31,8 @@ #include __FBSDID("$FreeBSD$"); +#ifdef WITH_ICONV +#endif #include #include #include @@ -92,6 +94,8 @@ struct ntfs_bootfile { uint32_t bf_volsn; } __packed; +#ifdef WITH_ICONV +#endif int fstyp_ntfs(FILE *fp, char *label, size_t size) { @@ -109,6 +113,7 @@ fstyp_ntfs(FILE *fp, char *label, size_t size) bf = (struct ntfs_bootfile *)read_buf(fp, 0, 512); if (bf == NULL || strncmp(bf->bf_sysid, "NTFS ", 8) != 0) goto fail; +#ifdef WITH_ICONV mftrecsz = bf->bf_mftrecsz; recsize = (mftrecsz > 0) ? (mftrecsz * bf->bf_bps * bf->bf_spc) : (1 << -mftrecsz); @@ -150,6 +155,7 @@ fstyp_ntfs(FILE *fp, char *label, size_t size) } } +#endif /* WITH_ICONV */ free(bf); free(filerecp); diff --git a/usr.sbin/fstyp/tests/fstyp_test.sh b/usr.sbin/fstyp/tests/fstyp_test.sh index 5103ba042746..8f76424f5f75 100755 --- a/usr.sbin/fstyp/tests/fstyp_test.sh +++ b/usr.sbin/fstyp/tests/fstyp_test.sh @@ -68,6 +68,15 @@ exfat_body() { atf_check -s exit:0 -o inline:"exfat\n" fstyp -u exfat.img } +atf_test_case exfat_label +exfat_label_head() { + atf_set "descr" "fstyp(8) can read exFAT labels" +} +exfat_label_body() { + bzcat $(atf_get_srcdir)/dfr-01-xfat.img.bz2 > exfat.img + atf_check -s exit:0 -o inline:"exfat exFat\n" fstyp -u -l exfat.img +} + atf_test_case empty empty_head() { atf_set "descr" "fstyp(8) should fail on an empty file" @@ -253,6 +262,7 @@ atf_init_test_cases() { atf_add_test_case dir atf_add_test_case empty atf_add_test_case exfat + atf_add_test_case exfat_label atf_add_test_case ext2 atf_add_test_case ext3 atf_add_test_case ext4 From owner-dev-commits-src-branches@freebsd.org Tue Feb 2 21:14:03 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 705EE53DAE8; Tue, 2 Feb 2021 21:14:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DVcxl2MPRz4ZLw; Tue, 2 Feb 2021 21:14:03 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 42292152D9; Tue, 2 Feb 2021 21:14:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 112LE3BZ044875; Tue, 2 Feb 2021 21:14:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 112LE32u044874; Tue, 2 Feb 2021 21:14:03 GMT (envelope-from git) Date: Tue, 2 Feb 2021 21:14:03 GMT Message-Id: <202102022114.112LE32u044874@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: a072e2133ed3 - stable/12 - fstyp(8): fix exfat detection MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a072e2133ed36f1edf899068e6b026b129c919d8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2021 21:14:03 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=a072e2133ed36f1edf899068e6b026b129c919d8 commit a072e2133ed36f1edf899068e6b026b129c919d8 Author: Conrad Meyer AuthorDate: 2021-01-17 19:55:06 +0000 Commit: Ed Maste CommitDate: 2021-02-02 21:12:31 +0000 fstyp(8): fix exfat detection In the presence of high-level errors (spec violations, bad boot blocks checksum), report non-detection instead of detection. PR: 252787 (related, but does not fully address) (cherry picked from commit ddf61156132b610915325769cbb93ea11be0d433) --- usr.sbin/fstyp/exfat.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/usr.sbin/fstyp/exfat.c b/usr.sbin/fstyp/exfat.c index d77ba9253d39..3f10cb6a9e5a 100644 --- a/usr.sbin/fstyp/exfat.c +++ b/usr.sbin/fstyp/exfat.c @@ -330,14 +330,15 @@ fstyp_exfat(FILE *fp, char *label, size_t size) uint32_t chksum; int error; + error = 1; cksect = NULL; ev = (struct exfat_vbr *)read_buf(fp, 0, 512); if (ev == NULL || strncmp(ev->ev_fsname, "EXFAT ", 8) != 0) - goto fail; + goto out; if (ev->ev_log_bytes_per_sect < 9 || ev->ev_log_bytes_per_sect > 12) { warnx("exfat: Invalid BytesPerSectorShift"); - goto done; + goto out; } bytespersec = (1u << ev->ev_log_bytes_per_sect); @@ -345,7 +346,7 @@ fstyp_exfat(FILE *fp, char *label, size_t size) error = exfat_compute_boot_chksum(fp, MAIN_BOOT_REGION_SECT, bytespersec, &chksum); if (error != 0) - goto done; + goto out; cksect = read_sect(fp, MAIN_BOOT_REGION_SECT + SUBREGION_CHKSUM_SECT, bytespersec); @@ -357,7 +358,8 @@ fstyp_exfat(FILE *fp, char *label, size_t size) if (chksum != le32toh(cksect[0])) { warnx("exfat: Found checksum 0x%08x != computed 0x%08x", le32toh(cksect[0]), chksum); - goto done; + error = 1; + goto out; } #ifdef WITH_ICONV @@ -365,12 +367,8 @@ fstyp_exfat(FILE *fp, char *label, size_t size) exfat_find_label(fp, ev, bytespersec, label, size); #endif -done: +out: free(cksect); free(ev); - return (0); - -fail: - free(ev); - return (1); + return (error != 0); } From owner-dev-commits-src-branches@freebsd.org Tue Feb 2 21:23:58 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6DD1753E584; Tue, 2 Feb 2021 21:23: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 4DVd9B2lXsz4b8Q; Tue, 2 Feb 2021 21:23:58 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 511D815683; Tue, 2 Feb 2021 21:23:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 112LNw5Q058430; Tue, 2 Feb 2021 21:23:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 112LNwi7058429; Tue, 2 Feb 2021 21:23:58 GMT (envelope-from git) Date: Tue, 2 Feb 2021 21:23:58 GMT Message-Id: <202102022123.112LNwi7058429@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 090deb5c64cf - stable/11 - Fix mdoc typo in auto_master.5 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 090deb5c64cf9729b9326f0a01349151f3df25c9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2021 21:23:58 -0000 The branch stable/11 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=090deb5c64cf9729b9326f0a01349151f3df25c9 commit 090deb5c64cf9729b9326f0a01349151f3df25c9 Author: Benjamin Kaduk AuthorDate: 2017-09-01 22:04:45 +0000 Commit: Ed Maste CommitDate: 2021-02-02 21:23:15 +0000 Fix mdoc typo in auto_master.5 There needs to be a space after the no-space macro in order for it to be interpreted. PR: 221986 Submitted by: Paul Townsend (cherry picked from commit fe8b4983b4f200c479846839b2632024136c0ff4) --- usr.sbin/autofs/auto_master.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/autofs/auto_master.5 b/usr.sbin/autofs/auto_master.5 index 89100f75faf5..e630028e0817 100644 --- a/usr.sbin/autofs/auto_master.5 +++ b/usr.sbin/autofs/auto_master.5 @@ -253,7 +253,7 @@ Query the remote NFS server and map exported shares. This map is traditionally mounted on .Pa /net . Access to files on a remote NFS server is provided through the -.Pf /net/ Ar nfs-server-ip Ns / Ns Ar share-name Ns/ +.Pf /net/ Ar nfs-server-ip Ns / Ns Ar share-name Ns / directory without any additional configuration. Directories for individual NFS servers are not present until the first access, when they are automatically created. From owner-dev-commits-src-branches@freebsd.org Wed Feb 3 04:08:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D44DD528CB1; Wed, 3 Feb 2021 04:08: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 4DVp8F5g9qz3Gxt; Wed, 3 Feb 2021 04:08:45 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B599E1A6D1; Wed, 3 Feb 2021 04:08:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11348jKM080339; Wed, 3 Feb 2021 04:08:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11348jKJ080338; Wed, 3 Feb 2021 04:08:45 GMT (envelope-from git) Date: Wed, 3 Feb 2021 04:08:45 GMT Message-Id: <202102030408.11348jKJ080338@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: c738bfc506af - stable/13 - cxgb(4): Remove assumption of physically contiguous mbufs. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c738bfc506af1feaff2f138534bb5fc99da7e042 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2021 04:08:45 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=c738bfc506af1feaff2f138534bb5fc99da7e042 commit c738bfc506af1feaff2f138534bb5fc99da7e042 Author: Alexander Motin AuthorDate: 2021-01-31 17:46:57 +0000 Commit: Alexander Motin CommitDate: 2021-02-03 04:08:43 +0000 cxgb(4): Remove assumption of physically contiguous mbufs. Investigation of iSCSI target data corruption reports brought me to discovery that cxgb(4) expects mbufs to be physically contiguous, that is not true after I've started using m_extaddref() in software iSCSI for large zero-copy transmissions. In case of fragmented memory the driver transmitted garbage from pages following the first one due to simple use of pmap_kextract() for the first pointer instead of proper bus_dmamap_load_mbuf_sg(). Seems like it was done as some optimization many years ago, and at very least it is wrong in a world of IOMMUs. This patch just removes that optimization, plus limits packet coalescing for mbufs crossing page boundary, also depending on assumption of one segment per packet. Sponsored by: iXsystems, Inc. (cherry picked from commit 9dc7c250b8bd2d5e669c7633e189a700a02c0571) --- sys/dev/cxgb/cxgb_sge.c | 3 ++- sys/dev/cxgb/sys/mvec.h | 14 -------------- sys/dev/cxgb/sys/uipc_mvec.c | 24 +++--------------------- 3 files changed, 5 insertions(+), 36 deletions(-) diff --git a/sys/dev/cxgb/cxgb_sge.c b/sys/dev/cxgb/cxgb_sge.c index 7f456ccff4ca..491d1a751f4a 100644 --- a/sys/dev/cxgb/cxgb_sge.c +++ b/sys/dev/cxgb/cxgb_sge.c @@ -322,7 +322,8 @@ coalesce_check(struct mbuf *m, void *arg) int *nbytes = &ci->nbytes; if ((*nbytes == 0) || ((*nbytes + m->m_len <= 10500) && - (*count < 7) && (m->m_next == NULL))) { + (*count < 7) && (m->m_next == NULL) && + ((mtod(m, vm_offset_t) & PAGE_MASK) + m->m_len <= PAGE_SIZE))) { *count += 1; *nbytes += m->m_len; return (1); diff --git a/sys/dev/cxgb/sys/mvec.h b/sys/dev/cxgb/sys/mvec.h index bdd0b55c5489..4989bff29ec4 100644 --- a/sys/dev/cxgb/sys/mvec.h +++ b/sys/dev/cxgb/sys/mvec.h @@ -33,20 +33,6 @@ #define _MVEC_H_ #include -static __inline void -busdma_map_mbuf_fast(bus_dma_tag_t tag, bus_dmamap_t map, - struct mbuf *m, bus_dma_segment_t *seg) -{ -#if defined(__i386__) || defined(__amd64__) - seg->ds_addr = pmap_kextract(mtod(m, vm_offset_t)); - seg->ds_len = m->m_len; -#else - int nsegstmp; - - bus_dmamap_load_mbuf_sg(tag, map, m, seg, &nsegstmp, 0); -#endif -} - int busdma_map_sg_collapse(bus_dma_tag_t tag, bus_dmamap_t map, struct mbuf **m, bus_dma_segment_t *segs, int *nsegs); void busdma_map_sg_vec(bus_dma_tag_t tag, bus_dmamap_t map, diff --git a/sys/dev/cxgb/sys/uipc_mvec.c b/sys/dev/cxgb/sys/uipc_mvec.c index ca31cf1897c7..02f437079468 100644 --- a/sys/dev/cxgb/sys/uipc_mvec.c +++ b/sys/dev/cxgb/sys/uipc_mvec.c @@ -65,26 +65,7 @@ busdma_map_sg_collapse(bus_dma_tag_t tag, bus_dmamap_t map, retry: psegs = segs; seg_count = 0; - if (n->m_next == NULL) { - busdma_map_mbuf_fast(tag, map, n, segs); - *nsegs = 1; - return (0); - } -#if defined(__i386__) || defined(__amd64__) - while (n && seg_count < TX_MAX_SEGS) { - /* - * firmware doesn't like empty segments - */ - if (__predict_true(n->m_len != 0)) { - seg_count++; - busdma_map_mbuf_fast(tag, map, n, psegs); - psegs++; - } - n = n->m_next; - } -#else err = bus_dmamap_load_mbuf_sg(tag, map, *m, segs, &seg_count, 0); -#endif if (seg_count == 0) { if (cxgb_debug) printf("empty segment chain\n"); @@ -117,8 +98,9 @@ void busdma_map_sg_vec(bus_dma_tag_t tag, bus_dmamap_t map, struct mbuf *m, bus_dma_segment_t *segs, int *nsegs) { + int n = 0; - for (*nsegs = 0; m != NULL ; segs++, *nsegs += 1, m = m->m_nextpkt) - busdma_map_mbuf_fast(tag, map, m, segs); + for (*nsegs = 0; m != NULL; segs += n, *nsegs += n, m = m->m_nextpkt) + bus_dmamap_load_mbuf_sg(tag, map, m, segs, &n, 0); } From owner-dev-commits-src-branches@freebsd.org Wed Feb 3 04:09:15 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B6E3528F3A; Wed, 3 Feb 2021 04:09: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 4DVp8q43jnz3H6C; Wed, 3 Feb 2021 04:09:15 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 740A51A73B; Wed, 3 Feb 2021 04:09:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11349Fji080517; Wed, 3 Feb 2021 04:09:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11349FAt080516; Wed, 3 Feb 2021 04:09:15 GMT (envelope-from git) Date: Wed, 3 Feb 2021 04:09:15 GMT Message-Id: <202102030409.11349FAt080516@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 4a1ea6a210b2 - stable/12 - cxgb(4): Remove assumption of physically contiguous mbufs. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4a1ea6a210b2729b7599e2e069cc846b7e0390f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2021 04:09:15 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=4a1ea6a210b2729b7599e2e069cc846b7e0390f8 commit 4a1ea6a210b2729b7599e2e069cc846b7e0390f8 Author: Alexander Motin AuthorDate: 2021-01-31 17:46:57 +0000 Commit: Alexander Motin CommitDate: 2021-02-03 04:09:05 +0000 cxgb(4): Remove assumption of physically contiguous mbufs. Investigation of iSCSI target data corruption reports brought me to discovery that cxgb(4) expects mbufs to be physically contiguous, that is not true after I've started using m_extaddref() in software iSCSI for large zero-copy transmissions. In case of fragmented memory the driver transmitted garbage from pages following the first one due to simple use of pmap_kextract() for the first pointer instead of proper bus_dmamap_load_mbuf_sg(). Seems like it was done as some optimization many years ago, and at very least it is wrong in a world of IOMMUs. This patch just removes that optimization, plus limits packet coalescing for mbufs crossing page boundary, also depending on assumption of one segment per packet. Sponsored by: iXsystems, Inc. (cherry picked from commit 9dc7c250b8bd2d5e669c7633e189a700a02c0571) --- sys/dev/cxgb/cxgb_sge.c | 3 ++- sys/dev/cxgb/sys/mvec.h | 14 -------------- sys/dev/cxgb/sys/uipc_mvec.c | 24 +++--------------------- 3 files changed, 5 insertions(+), 36 deletions(-) diff --git a/sys/dev/cxgb/cxgb_sge.c b/sys/dev/cxgb/cxgb_sge.c index 74c3b873f593..489d74459ae1 100644 --- a/sys/dev/cxgb/cxgb_sge.c +++ b/sys/dev/cxgb/cxgb_sge.c @@ -322,7 +322,8 @@ coalesce_check(struct mbuf *m, void *arg) int *nbytes = &ci->nbytes; if ((*nbytes == 0) || ((*nbytes + m->m_len <= 10500) && - (*count < 7) && (m->m_next == NULL))) { + (*count < 7) && (m->m_next == NULL) && + ((mtod(m, vm_offset_t) & PAGE_MASK) + m->m_len <= PAGE_SIZE))) { *count += 1; *nbytes += m->m_len; return (1); diff --git a/sys/dev/cxgb/sys/mvec.h b/sys/dev/cxgb/sys/mvec.h index bdd0b55c5489..4989bff29ec4 100644 --- a/sys/dev/cxgb/sys/mvec.h +++ b/sys/dev/cxgb/sys/mvec.h @@ -33,20 +33,6 @@ #define _MVEC_H_ #include -static __inline void -busdma_map_mbuf_fast(bus_dma_tag_t tag, bus_dmamap_t map, - struct mbuf *m, bus_dma_segment_t *seg) -{ -#if defined(__i386__) || defined(__amd64__) - seg->ds_addr = pmap_kextract(mtod(m, vm_offset_t)); - seg->ds_len = m->m_len; -#else - int nsegstmp; - - bus_dmamap_load_mbuf_sg(tag, map, m, seg, &nsegstmp, 0); -#endif -} - int busdma_map_sg_collapse(bus_dma_tag_t tag, bus_dmamap_t map, struct mbuf **m, bus_dma_segment_t *segs, int *nsegs); void busdma_map_sg_vec(bus_dma_tag_t tag, bus_dmamap_t map, diff --git a/sys/dev/cxgb/sys/uipc_mvec.c b/sys/dev/cxgb/sys/uipc_mvec.c index ca31cf1897c7..02f437079468 100644 --- a/sys/dev/cxgb/sys/uipc_mvec.c +++ b/sys/dev/cxgb/sys/uipc_mvec.c @@ -65,26 +65,7 @@ busdma_map_sg_collapse(bus_dma_tag_t tag, bus_dmamap_t map, retry: psegs = segs; seg_count = 0; - if (n->m_next == NULL) { - busdma_map_mbuf_fast(tag, map, n, segs); - *nsegs = 1; - return (0); - } -#if defined(__i386__) || defined(__amd64__) - while (n && seg_count < TX_MAX_SEGS) { - /* - * firmware doesn't like empty segments - */ - if (__predict_true(n->m_len != 0)) { - seg_count++; - busdma_map_mbuf_fast(tag, map, n, psegs); - psegs++; - } - n = n->m_next; - } -#else err = bus_dmamap_load_mbuf_sg(tag, map, *m, segs, &seg_count, 0); -#endif if (seg_count == 0) { if (cxgb_debug) printf("empty segment chain\n"); @@ -117,8 +98,9 @@ void busdma_map_sg_vec(bus_dma_tag_t tag, bus_dmamap_t map, struct mbuf *m, bus_dma_segment_t *segs, int *nsegs) { + int n = 0; - for (*nsegs = 0; m != NULL ; segs++, *nsegs += 1, m = m->m_nextpkt) - busdma_map_mbuf_fast(tag, map, m, segs); + for (*nsegs = 0; m != NULL; segs += n, *nsegs += n, m = m->m_nextpkt) + bus_dmamap_load_mbuf_sg(tag, map, m, segs, &n, 0); } From owner-dev-commits-src-branches@freebsd.org Wed Feb 3 05:06:49 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62DB252A564; Wed, 3 Feb 2021 05:06:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DVqRF2PX6z3Kyp; Wed, 3 Feb 2021 05:06:49 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 454561AEF7; Wed, 3 Feb 2021 05:06:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11356nBH057814; Wed, 3 Feb 2021 05:06:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11356n11057813; Wed, 3 Feb 2021 05:06:49 GMT (envelope-from git) Date: Wed, 3 Feb 2021 05:06:49 GMT Message-Id: <202102030506.11356n11057813@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Oleksandr Tymoshenko Subject: git: 10625515ad47 - stable/13 - MFC: mips: fix early kernel panic when setting up interrupt counters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gonzo X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 10625515ad47b52f38c13f4f1d8f8c848e9df4ee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2021 05:06:49 -0000 The branch stable/13 has been updated by gonzo: URL: https://cgit.FreeBSD.org/src/commit/?id=10625515ad47b52f38c13f4f1d8f8c848e9df4ee commit 10625515ad47b52f38c13f4f1d8f8c848e9df4ee Author: Oleksandr Tymoshenko AuthorDate: 2021-02-01 07:56:22 +0000 Commit: Oleksandr Tymoshenko CommitDate: 2021-02-03 05:06:37 +0000 MFC: mips: fix early kernel panic when setting up interrupt counters Commit 248f0ca converted intrcnt and intrnames from u_long[] and char[] to u_long* and char* respectively, but for non-INTRNG mips these symbols were defined in .S file as a pre-allocated static arrays, so the problem wasn't cought at compile time. Conversion from an array to a pointer requires pointer initialization and it wasn't done for MIPS, so whatever happenned to be in the begginning of intcnt[] array was used as a pointer value. Move intrcnt/intrnames to C code and allocate them dynamically although with a fixed size at the moment. Reviewed by: emaste PR: 253051 Differential Revision: https://reviews.freebsd.org/D28424 MFC after: 1 day (cherry picked from commit e0a0a3efcb09a10ad1de29aca622ea580b2663d2) mips: fix NLM platforms breakage caused by e0a0a3ef NetLogic platforms have their own implementation of cpu_init_interrupts. Apply the same logic to it as to intr_machdep.c. PR: 253051 (cherry picked from commit d6f9c5a6d2f87865f9714d2b8dfd1a9f3080c71e) --- sys/mips/mips/exception.S | 36 ------------------------------------ sys/mips/mips/intr_machdep.c | 22 ++++++++++++++++++++++ sys/mips/nlm/intr_machdep.c | 18 ++++++++++++++++++ 3 files changed, 40 insertions(+), 36 deletions(-) diff --git a/sys/mips/mips/exception.S b/sys/mips/mips/exception.S index 892bebc8f37f..719904ac83b7 100644 --- a/sys/mips/mips/exception.S +++ b/sys/mips/mips/exception.S @@ -80,12 +80,6 @@ dtrace_invop_calltrap_addr: .text #endif -/* - * Reasonable limit - */ -#define INTRCNT_COUNT 256 - - /* *---------------------------------------------------------------------------- * @@ -1206,36 +1200,6 @@ FPReturn: .set pop END(MipsFPTrap) -#ifndef INTRNG -/* - * Interrupt counters for vmstat. - */ - .data - .globl intrcnt - .globl sintrcnt - .globl intrnames - .globl sintrnames -intrnames: - .space INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 -sintrnames: -#ifdef __mips_n64 - .quad INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 -#else - .int INTRCNT_COUNT * (MAXCOMLEN + 1) * 2 -#endif - - .align (_MIPS_SZLONG / 8) -intrcnt: - .space INTRCNT_COUNT * (_MIPS_SZLONG / 8) * 2 -sintrcnt: -#ifdef __mips_n64 - .quad INTRCNT_COUNT * (_MIPS_SZLONG / 8) * 2 -#else - .int INTRCNT_COUNT * (_MIPS_SZLONG / 8) * 2 -#endif -#endif /* INTRNG */ - - /* * Vector to real handler in KSEG1. */ diff --git a/sys/mips/mips/intr_machdep.c b/sys/mips/mips/intr_machdep.c index 3b278276865c..a36944f657ca 100644 --- a/sys/mips/mips/intr_machdep.c +++ b/sys/mips/mips/intr_machdep.c @@ -50,6 +50,19 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef INTRNG +#define INTRCNT_COUNT 256 +#define INTRNAME_LEN (2*MAXCOMLEN + 1) + +MALLOC_DECLARE(M_MIPSINTR); +MALLOC_DEFINE(M_MIPSINTR, "mipsintr", "MIPS interrupt handling"); + +u_long *intrcnt; +char *intrnames; +size_t sintrcnt; +size_t sintrnames; +#endif + static struct intr_event *hardintr_events[NHARD_IRQS]; static struct intr_event *softintr_events[NSOFT_IRQS]; static mips_intrcnt_t mips_intr_counters[NSOFT_IRQS + NHARD_IRQS]; @@ -121,6 +134,15 @@ cpu_init_interrupts() int i; char name[MAXCOMLEN + 1]; +#ifndef INTRNG + intrcnt = mallocarray(INTRCNT_COUNT, sizeof(u_long), M_MIPSINTR, + M_WAITOK | M_ZERO); + intrnames = mallocarray(INTRCNT_COUNT, INTRNAME_LEN, M_MIPSINTR, + M_WAITOK | M_ZERO); + sintrcnt = INTRCNT_COUNT * sizeof(u_long); + sintrnames = INTRCNT_COUNT * INTRNAME_LEN; +#endif + /* * Initialize all available vectors so spare IRQ * would show up in systat output diff --git a/sys/mips/nlm/intr_machdep.c b/sys/mips/nlm/intr_machdep.c index b66118c06ee8..33bfad1fe882 100644 --- a/sys/mips/nlm/intr_machdep.c +++ b/sys/mips/nlm/intr_machdep.c @@ -59,6 +59,17 @@ __FBSDID("$FreeBSD$"); #include #include +#define INTRCNT_COUNT 256 +#define INTRNAME_LEN (2*MAXCOMLEN + 1) + +MALLOC_DECLARE(M_MIPSINTR); +MALLOC_DEFINE(M_MIPSINTR, "mipsintr", "MIPS interrupt handling"); + +u_long *intrcnt; +char *intrnames; +size_t sintrcnt; +size_t sintrnames; + struct xlp_intrsrc { void (*bus_ack)(int, void *); /* Additional ack */ void *bus_ack_arg; /* arg for additional ack */ @@ -295,6 +306,13 @@ cpu_init_interrupts() int i; char name[MAXCOMLEN + 1]; + intrcnt = mallocarray(INTRCNT_COUNT, sizeof(u_long), M_MIPSINTR, + M_WAITOK | M_ZERO); + intrnames = mallocarray(INTRCNT_COUNT, INTRNAME_LEN, M_MIPSINTR, + M_WAITOK | M_ZERO); + sintrcnt = INTRCNT_COUNT * sizeof(u_long); + sintrnames = INTRCNT_COUNT * INTRNAME_LEN; + /* * Initialize all available vectors so spare IRQ * would show up in systat output From owner-dev-commits-src-branches@freebsd.org Wed Feb 3 06:56:09 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F29BD52D594; Wed, 3 Feb 2021 06:56: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 4DVssP6YcXz3hGc; Wed, 3 Feb 2021 06:56:09 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C97BF1C86F; Wed, 3 Feb 2021 06:56:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1136u9H4000909; Wed, 3 Feb 2021 06:56:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1136u9OA000908; Wed, 3 Feb 2021 06:56:09 GMT (envelope-from git) Date: Wed, 3 Feb 2021 06:56:09 GMT Message-Id: <202102030656.1136u9OA000908@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 13de72571eb2 - stable/13 - stand: lua: enhance lfs.dir() to speed up kernels_autodetect MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 13de72571eb2532e253fb8d40edf47ebabb99e92 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2021 06:56:10 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=13de72571eb2532e253fb8d40edf47ebabb99e92 commit 13de72571eb2532e253fb8d40edf47ebabb99e92 Author: Kyle Evans AuthorDate: 2021-01-24 01:32:38 +0000 Commit: Kyle Evans CommitDate: 2021-02-03 06:55:47 +0000 stand: lua: enhance lfs.dir() to speed up kernels_autodetect This eliminates a lot of stat() calls that happen when lualoader renders the menu with the default settings, and greatly speeds up rendering on my laptop. ftype is nil if loader/loader.efi hasn't been updated yet, falling back to lfs.attributes() to test. This is technically incompatible with lfs, but not in a particularly terrible way. (cherry picked from commit e25ee296c919d6567aa76058a7049eac974797fb) --- libexec/flua/modules/lfs.c | 28 +++++++++++++++++++++++++++- stand/lua/core.lua | 8 ++++++-- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/libexec/flua/modules/lfs.c b/libexec/flua/modules/lfs.c index 52a30c1515a9..e36c78d3b35b 100644 --- a/libexec/flua/modules/lfs.c +++ b/libexec/flua/modules/lfs.c @@ -122,6 +122,27 @@ __FBSDID("$FreeBSD$"); #define DIR_METATABLE "directory iterator metatable" +static int +lua_dir_iter_pushtype(lua_State *L __unused, const struct dirent *ent __unused) +{ + + /* + * This is a non-standard extension to luafilesystem for loader's + * benefit. The extra stat() calls to determine the entry type can + * be quite expensive on some systems, so this speeds up enumeration of + * /boot greatly by providing the type up front. + * + * This extension is compatible enough with luafilesystem, in that we're + * just using an extra return value for the iterator. + */ +#ifdef _STANDALONE + lua_pushinteger(L, ent->d_type); + return 1; +#else + return 0; +#endif +} + static int lua_dir_iter_next(lua_State *L) { @@ -144,7 +165,7 @@ lua_dir_iter_next(lua_State *L) } lua_pushstring(L, entry->d_name); - return 1; + return 1 + lua_dir_iter_pushtype(L, entry); } static int @@ -420,5 +441,10 @@ luaopen_lfs(lua_State *L) { register_metatable(L); luaL_newlib(L, fslib); +#ifdef _STANDALONE + /* Non-standard extension for loader, used with lfs.dir(). */ + lua_pushinteger(L, DT_DIR); + lua_setfield(L, -2, "DT_DIR"); +#endif return 1; } diff --git a/stand/lua/core.lua b/stand/lua/core.lua index 9d331bc0ad3a..a119c3c258f8 100644 --- a/stand/lua/core.lua +++ b/stand/lua/core.lua @@ -240,14 +240,18 @@ function core.kernelList() -- Automatically detect other bootable kernel directories using a -- heuristic. Any directory in /boot that contains an ordinary file -- named "kernel" is considered eligible. - for file in lfs.dir("/boot") do + for file, ftype in lfs.dir("/boot") do local fname = "/boot/" .. file if file == "." or file == ".." then goto continue end - if lfs.attributes(fname, "mode") ~= "directory" then + if ftype then + if ftype ~= lfs.DT_DIR then + goto continue + end + elseif lfs.attributes(fname, "mode") ~= "directory" then goto continue end From owner-dev-commits-src-branches@freebsd.org Wed Feb 3 06:56:11 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 133FC52D57B; Wed, 3 Feb 2021 06:56: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 4DVssR05VHz3h9y; Wed, 3 Feb 2021 06:56:11 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EA9171CAC0; Wed, 3 Feb 2021 06:56:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1136uAaP000930; Wed, 3 Feb 2021 06:56:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1136uA5R000929; Wed, 3 Feb 2021 06:56:10 GMT (envelope-from git) Date: Wed, 3 Feb 2021 06:56:10 GMT Message-Id: <202102030656.1136uA5R000929@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: e3cd8246c756 - stable/13 - lualoader: position hyphens at the beginning of character classes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e3cd8246c756e568956da1ad8e90e1983d9af89f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2021 06:56:11 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=e3cd8246c756e568956da1ad8e90e1983d9af89f commit e3cd8246c756e568956da1ad8e90e1983d9af89f Author: Kyle Evans AuthorDate: 2021-01-31 15:51:39 +0000 Commit: Kyle Evans CommitDate: 2021-02-03 06:55:51 +0000 lualoader: position hyphens at the beginning of character classes According to the Lua 5.4 manual section 6.4.1 ("Patterns"), the interaction between ranges and classes is not defined and hyphens must be specified at either the beginning or the end of a set if they are not escaped. Move all such occurrences to the beginning. (cherry picked from commit b24872cf7b13314669ed2136c0262bb2eb007695) --- stand/lua/config.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stand/lua/config.lua b/stand/lua/config.lua index f569b2e00b76..9ef7c0796f46 100644 --- a/stand/lua/config.lua +++ b/stand/lua/config.lua @@ -62,10 +62,10 @@ local MSG_FAILSYN_EOLESC = "Stray escape at end of line" local MSG_FAILSYN_EOLVAR = "Unescaped $ at end of line" local MSG_FAILSYN_BADVAR = "Malformed variable expression at position '%d'" -local MODULEEXPR = '([%w-_]+)' +local MODULEEXPR = '([-%w_]+)' local QVALEXPR = '"(.*)"' local QVALREPL = QVALEXPR:gsub('%%', '%%%%') -local WORDEXPR = "([%w%d-][%w%d-_.]*)" +local WORDEXPR = "([-%w%d][-%w%d_.]*)" local WORDREPL = WORDEXPR:gsub('%%', '%%%%') -- Entries that should never make it into the environment; each one should have @@ -182,7 +182,7 @@ local function processEnvVar(value) -- Skip the $ vinit = i + 1 vdelim = nil - vpat = "^([%w][%w%d-_.]*)" + vpat = "^([%w][-%w%d_.]*)" end local name = value:match(vpat, vinit) @@ -346,7 +346,7 @@ local function getBlacklist() return blacklist end - for mod in blacklist_str:gmatch("[;, ]?([%w-_]+)[;, ]?") do + for mod in blacklist_str:gmatch("[;, ]?([-%w_]+)[;, ]?") do blacklist[mod] = true end return blacklist From owner-dev-commits-src-branches@freebsd.org Wed Feb 3 06:58:33 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D81A452D6A8; Wed, 3 Feb 2021 06:58:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-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 4DVsw95nJdz3hhJ; Wed, 3 Feb 2021 06:58:33 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AF0441C6D2; Wed, 3 Feb 2021 06:58:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1136wX2g001394; Wed, 3 Feb 2021 06:58:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1136wXVJ001393; Wed, 3 Feb 2021 06:58:33 GMT (envelope-from git) Date: Wed, 3 Feb 2021 06:58:33 GMT Message-Id: <202102030658.1136wXVJ001393@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 32b391d4a99c - stable/12 - stand: lua: enhance lfs.dir() to speed up kernels_autodetect MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 32b391d4a99c8c3a52ea1d2c0c82ee3208b77a19 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2021 06:58:33 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=32b391d4a99c8c3a52ea1d2c0c82ee3208b77a19 commit 32b391d4a99c8c3a52ea1d2c0c82ee3208b77a19 Author: Kyle Evans AuthorDate: 2021-01-24 01:32:38 +0000 Commit: Kyle Evans CommitDate: 2021-02-03 06:58:18 +0000 stand: lua: enhance lfs.dir() to speed up kernels_autodetect This eliminates a lot of stat() calls that happen when lualoader renders the menu with the default settings, and greatly speeds up rendering on my laptop. ftype is nil if loader/loader.efi hasn't been updated yet, falling back to lfs.attributes() to test. This is technically incompatible with lfs, but not in a particularly terrible way. (cherry picked from commit e25ee296c919d6567aa76058a7049eac974797fb) --- libexec/flua/modules/lfs.c | 28 +++++++++++++++++++++++++++- stand/lua/core.lua | 8 ++++++-- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/libexec/flua/modules/lfs.c b/libexec/flua/modules/lfs.c index 52a30c1515a9..e36c78d3b35b 100644 --- a/libexec/flua/modules/lfs.c +++ b/libexec/flua/modules/lfs.c @@ -122,6 +122,27 @@ __FBSDID("$FreeBSD$"); #define DIR_METATABLE "directory iterator metatable" +static int +lua_dir_iter_pushtype(lua_State *L __unused, const struct dirent *ent __unused) +{ + + /* + * This is a non-standard extension to luafilesystem for loader's + * benefit. The extra stat() calls to determine the entry type can + * be quite expensive on some systems, so this speeds up enumeration of + * /boot greatly by providing the type up front. + * + * This extension is compatible enough with luafilesystem, in that we're + * just using an extra return value for the iterator. + */ +#ifdef _STANDALONE + lua_pushinteger(L, ent->d_type); + return 1; +#else + return 0; +#endif +} + static int lua_dir_iter_next(lua_State *L) { @@ -144,7 +165,7 @@ lua_dir_iter_next(lua_State *L) } lua_pushstring(L, entry->d_name); - return 1; + return 1 + lua_dir_iter_pushtype(L, entry); } static int @@ -420,5 +441,10 @@ luaopen_lfs(lua_State *L) { register_metatable(L); luaL_newlib(L, fslib); +#ifdef _STANDALONE + /* Non-standard extension for loader, used with lfs.dir(). */ + lua_pushinteger(L, DT_DIR); + lua_setfield(L, -2, "DT_DIR"); +#endif return 1; } diff --git a/stand/lua/core.lua b/stand/lua/core.lua index ad9a3e353fd1..7f6b809761c4 100644 --- a/stand/lua/core.lua +++ b/stand/lua/core.lua @@ -238,14 +238,18 @@ function core.kernelList() -- Automatically detect other bootable kernel directories using a -- heuristic. Any directory in /boot that contains an ordinary file -- named "kernel" is considered eligible. - for file in lfs.dir("/boot") do + for file, ftype in lfs.dir("/boot") do local fname = "/boot/" .. file if file == "." or file == ".." then goto continue end - if lfs.attributes(fname, "mode") ~= "directory" then + if ftype then + if ftype ~= lfs.DT_DIR then + goto continue + end + elseif lfs.attributes(fname, "mode") ~= "directory" then goto continue end From owner-dev-commits-src-branches@freebsd.org Wed Feb 3 06:58:34 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EFD3A52D2EB; Wed, 3 Feb 2021 06:58:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DVswB6VQRz3hQb; Wed, 3 Feb 2021 06:58:34 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D188C1CAC1; Wed, 3 Feb 2021 06:58:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1136wY3w001417; Wed, 3 Feb 2021 06:58:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1136wYu7001416; Wed, 3 Feb 2021 06:58:34 GMT (envelope-from git) Date: Wed, 3 Feb 2021 06:58:34 GMT Message-Id: <202102030658.1136wYu7001416@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: eefddc38243d - stable/12 - lualoader: position hyphens at the beginning of character classes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: eefddc38243d53a6df41f72c17c65b17d8c46e9c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2021 06:58:35 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=eefddc38243d53a6df41f72c17c65b17d8c46e9c commit eefddc38243d53a6df41f72c17c65b17d8c46e9c Author: Kyle Evans AuthorDate: 2021-01-31 15:51:39 +0000 Commit: Kyle Evans CommitDate: 2021-02-03 06:58:24 +0000 lualoader: position hyphens at the beginning of character classes According to the Lua 5.4 manual section 6.4.1 ("Patterns"), the interaction between ranges and classes is not defined and hyphens must be specified at either the beginning or the end of a set if they are not escaped. Move all such occurrences to the beginning. (cherry picked from commit b24872cf7b13314669ed2136c0262bb2eb007695) --- stand/lua/config.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stand/lua/config.lua b/stand/lua/config.lua index 886d897b4621..6e779233373c 100644 --- a/stand/lua/config.lua +++ b/stand/lua/config.lua @@ -62,10 +62,10 @@ local MSG_FAILSYN_EOLESC = "Stray escape at end of line" local MSG_FAILSYN_EOLVAR = "Unescaped $ at end of line" local MSG_FAILSYN_BADVAR = "Malformed variable expression at position '%d'" -local MODULEEXPR = '([%w-_]+)' +local MODULEEXPR = '([-%w_]+)' local QVALEXPR = '"(.*)"' local QVALREPL = QVALEXPR:gsub('%%', '%%%%') -local WORDEXPR = "([%w%d-][%w%d-_.]*)" +local WORDEXPR = "([-%w%d][-%w%d_.]*)" local WORDREPL = WORDEXPR:gsub('%%', '%%%%') -- Entries that should never make it into the environment; each one should have @@ -182,7 +182,7 @@ local function processEnvVar(value) -- Skip the $ vinit = i + 1 vdelim = nil - vpat = "^([%w][%w%d-_.]*)" + vpat = "^([%w][-%w%d_.]*)" end local name = value:match(vpat, vinit) @@ -346,7 +346,7 @@ local function getBlacklist() return blacklist end - for mod in blacklist_str:gmatch("[;, ]?([%w-_]+)[;, ]?") do + for mod in blacklist_str:gmatch("[;, ]?([-%w_]+)[;, ]?") do blacklist[mod] = true end return blacklist From owner-dev-commits-src-branches@freebsd.org Wed Feb 3 10:41:05 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CBC24532E12; Wed, 3 Feb 2021 10:41:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DVyrx5Pk6z3wCN; Wed, 3 Feb 2021 10:41:05 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AC4141FA92; Wed, 3 Feb 2021 10:41:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 113Af5CZ096104; Wed, 3 Feb 2021 10:41:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 113Af5X6096103; Wed, 3 Feb 2021 10:41:05 GMT (envelope-from git) Date: Wed, 3 Feb 2021 10:41:05 GMT Message-Id: <202102031041.113Af5X6096103@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Stefan Eßer Subject: git: 601ac8219469 - stable/13 - bc: Vendor import of Gavin Howard's bc version 3.2.6 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 601ac82194693fcae9d7d2a7ec7d66ebaf3fd61e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2021 10:41:05 -0000 The branch stable/13 has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=601ac82194693fcae9d7d2a7ec7d66ebaf3fd61e commit 601ac82194693fcae9d7d2a7ec7d66ebaf3fd61e Author: Stefan Eßer AuthorDate: 2021-01-31 19:56:48 +0000 Commit: Stefan Eßer CommitDate: 2021-02-03 10:37:34 +0000 bc: Vendor import of Gavin Howard's bc version 3.2.6 (cherry picked from commit 47a52dc4d48f259ab7d9f9ba6b65f4f2331a22dc) --- .gitignore | 27 -- README.md | 82 ----- contrib/bc/.gitignore | 9 + contrib/bc/LICENSE.md | 52 ++- contrib/bc/Makefile.in | 122 ++++-- contrib/bc/NEWS.md | 35 ++ contrib/bc/NOTICE.md | 2 +- contrib/bc/README.md | 1 + contrib/bc/configure.sh | 348 +++++++++++++++--- contrib/bc/exec-install.sh | 2 +- contrib/bc/functions.sh | 90 +++-- contrib/bc/gen/bc_help.txt | 2 +- contrib/bc/gen/dc_help.txt | 2 +- contrib/bc/gen/lib.bc | 2 +- contrib/bc/gen/lib2.bc | 2 +- contrib/bc/gen/strgen.c | 4 +- contrib/bc/gen/strgen.sh | 4 +- contrib/bc/include/args.h | 2 +- contrib/bc/include/bc.h | 2 +- contrib/bc/include/bcl.h | 2 +- contrib/bc/include/dc.h | 2 +- contrib/bc/include/file.h | 2 +- contrib/bc/include/history.h | 2 +- contrib/bc/include/lang.h | 2 +- contrib/bc/include/lex.h | 2 +- contrib/bc/include/library.h | 2 +- contrib/bc/include/num.h | 4 +- contrib/bc/include/opt.h | 2 +- contrib/bc/include/parse.h | 2 +- contrib/bc/include/program.h | 2 +- contrib/bc/include/rand.h | 31 +- contrib/bc/include/read.h | 2 +- contrib/bc/include/status.h | 14 +- contrib/bc/include/vector.h | 3 +- contrib/bc/include/vm.h | 19 +- contrib/bc/karatsuba.py | 2 +- contrib/bc/link.sh | 2 +- contrib/bc/locale_install.sh | 2 +- contrib/bc/locale_uninstall.sh | 2 +- contrib/bc/locales/de_DE.ISO8859-1.msg | 2 +- contrib/bc/locales/de_DE.UTF-8.msg | 2 +- contrib/bc/locales/en_US.msg | 2 +- contrib/bc/locales/es_ES.ISO8859-1.msg | 2 +- contrib/bc/locales/es_ES.UTF-8.msg | 2 +- contrib/bc/locales/fr_FR.ISO8859-1.msg | 2 +- contrib/bc/locales/fr_FR.UTF-8.msg | 2 +- contrib/bc/locales/ja_JP.UTF-8.msg | 2 +- contrib/bc/locales/ja_JP.eucJP.msg | 2 +- contrib/bc/locales/nl_NL.ISO8859-1.msg | 2 +- contrib/bc/locales/nl_NL.UTF-8.msg | 2 +- contrib/bc/locales/pl_PL.ISO8859-2.msg | 2 +- contrib/bc/locales/pl_PL.UTF-8.msg | 2 +- contrib/bc/locales/pt_PT.ISO8859-1.msg | 2 +- contrib/bc/locales/pt_PT.UTF-8.msg | 2 +- contrib/bc/locales/ru_RU.CP1251.msg | 2 +- contrib/bc/locales/ru_RU.CP866.msg | 2 +- contrib/bc/locales/ru_RU.ISO8859-5.msg | 2 +- contrib/bc/locales/ru_RU.KOI8-R.msg | 2 +- contrib/bc/locales/ru_RU.UTF-8.msg | 2 +- contrib/bc/locales/zh_CN.GB18030.msg | 2 +- contrib/bc/locales/zh_CN.GB2312.msg | 2 +- contrib/bc/locales/zh_CN.GBK.msg | 2 +- contrib/bc/locales/zh_CN.UTF-8.msg | 2 +- contrib/bc/locales/zh_CN.eucCN.msg | 2 +- contrib/bc/manpage.sh | 2 +- contrib/bc/manuals/bc.1.md.in | 7 +- contrib/bc/manuals/bc/A.1 | 8 +- contrib/bc/manuals/bc/A.1.md | 7 +- contrib/bc/manuals/bc/E.1 | 4 +- contrib/bc/manuals/bc/E.1.md | 2 +- contrib/bc/manuals/bc/EH.1 | 4 +- contrib/bc/manuals/bc/EH.1.md | 2 +- contrib/bc/manuals/bc/EHN.1 | 4 +- contrib/bc/manuals/bc/EHN.1.md | 2 +- contrib/bc/manuals/bc/EHNP.1 | 4 +- contrib/bc/manuals/bc/EHNP.1.md | 2 +- contrib/bc/manuals/bc/EHP.1 | 4 +- contrib/bc/manuals/bc/EHP.1.md | 2 +- contrib/bc/manuals/bc/EN.1 | 4 +- contrib/bc/manuals/bc/EN.1.md | 2 +- contrib/bc/manuals/bc/ENP.1 | 4 +- contrib/bc/manuals/bc/ENP.1.md | 2 +- contrib/bc/manuals/bc/EP.1 | 4 +- contrib/bc/manuals/bc/EP.1.md | 2 +- contrib/bc/manuals/bc/H.1 | 8 +- contrib/bc/manuals/bc/H.1.md | 7 +- contrib/bc/manuals/bc/HN.1 | 8 +- contrib/bc/manuals/bc/HN.1.md | 7 +- contrib/bc/manuals/bc/HNP.1 | 8 +- contrib/bc/manuals/bc/HNP.1.md | 7 +- contrib/bc/manuals/bc/HP.1 | 8 +- contrib/bc/manuals/bc/HP.1.md | 7 +- contrib/bc/manuals/bc/N.1 | 8 +- contrib/bc/manuals/bc/N.1.md | 7 +- contrib/bc/manuals/bc/NP.1 | 8 +- contrib/bc/manuals/bc/NP.1.md | 7 +- contrib/bc/manuals/bc/P.1 | 8 +- contrib/bc/manuals/bc/P.1.md | 7 +- contrib/bc/manuals/bcl.3 | 4 +- contrib/bc/manuals/bcl.3.md | 2 +- contrib/bc/manuals/dc.1.md.in | 7 +- contrib/bc/manuals/dc/A.1 | 10 +- contrib/bc/manuals/dc/A.1.md | 7 +- contrib/bc/manuals/dc/E.1 | 4 +- contrib/bc/manuals/dc/E.1.md | 2 +- contrib/bc/manuals/dc/EH.1 | 4 +- contrib/bc/manuals/dc/EH.1.md | 2 +- contrib/bc/manuals/dc/EHN.1 | 4 +- contrib/bc/manuals/dc/EHN.1.md | 2 +- contrib/bc/manuals/dc/EHNP.1 | 4 +- contrib/bc/manuals/dc/EHNP.1.md | 2 +- contrib/bc/manuals/dc/EHP.1 | 4 +- contrib/bc/manuals/dc/EHP.1.md | 2 +- contrib/bc/manuals/dc/EN.1 | 4 +- contrib/bc/manuals/dc/EN.1.md | 2 +- contrib/bc/manuals/dc/ENP.1 | 4 +- contrib/bc/manuals/dc/ENP.1.md | 2 +- contrib/bc/manuals/dc/EP.1 | 4 +- contrib/bc/manuals/dc/EP.1.md | 2 +- contrib/bc/manuals/dc/H.1 | 10 +- contrib/bc/manuals/dc/H.1.md | 7 +- contrib/bc/manuals/dc/HN.1 | 10 +- contrib/bc/manuals/dc/HN.1.md | 7 +- contrib/bc/manuals/dc/HNP.1 | 10 +- contrib/bc/manuals/dc/HNP.1.md | 7 +- contrib/bc/manuals/dc/HP.1 | 10 +- contrib/bc/manuals/dc/HP.1.md | 7 +- contrib/bc/manuals/dc/N.1 | 10 +- contrib/bc/manuals/dc/N.1.md | 7 +- contrib/bc/manuals/dc/NP.1 | 10 +- contrib/bc/manuals/dc/NP.1.md | 7 +- contrib/bc/manuals/dc/P.1 | 10 +- contrib/bc/manuals/dc/P.1.md | 7 +- contrib/bc/manuals/header.txt | 2 +- contrib/bc/manuals/header_bc.txt | 2 +- contrib/bc/manuals/header_bcl.txt | 2 +- contrib/bc/manuals/header_dc.txt | 2 +- contrib/bc/release.sh | 18 +- contrib/bc/src/args.c | 2 +- contrib/bc/src/bc.c | 2 +- contrib/bc/src/bc_lex.c | 2 +- contrib/bc/src/bc_parse.c | 2 +- contrib/bc/src/data.c | 4 +- contrib/bc/src/dc.c | 2 +- contrib/bc/src/dc_lex.c | 6 +- contrib/bc/src/dc_parse.c | 2 +- contrib/bc/src/file.c | 4 +- contrib/bc/src/history.c | 15 +- contrib/bc/src/lang.c | 14 +- contrib/bc/src/lex.c | 4 +- contrib/bc/src/library.c | 12 +- contrib/bc/src/main.c | 13 +- contrib/bc/src/num.c | 10 +- contrib/bc/src/opt.c | 2 +- contrib/bc/src/parse.c | 8 +- contrib/bc/src/program.c | 31 +- contrib/bc/src/rand.c | 42 +-- contrib/bc/src/read.c | 6 +- contrib/bc/src/vector.c | 8 +- contrib/bc/src/vm.c | 86 ++++- contrib/bc/tests/afl.py | 22 +- contrib/bc/tests/all.sh | 191 +--------- contrib/bc/tests/bc/all.txt | 6 +- contrib/bc/tests/bc/scripts/all.txt | 15 + contrib/bc/tests/bc/timeconst.sh | 9 +- contrib/bc/tests/bcl.c | 2 +- contrib/bc/tests/dc/errors/30.txt | 1 + contrib/bc/tests/dc/errors/31.txt | 1 + contrib/bc/tests/dc/scripts/all.txt | 9 + contrib/bc/tests/diff.sh | 51 +++ contrib/bc/tests/errors.sh | 20 +- contrib/bc/tests/extra_required.txt | 7 + contrib/bc/tests/fuzzing/bc.dict | 68 ++++ contrib/bc/tests/fuzzing/bc_inputs1/abs.txt | 7 + contrib/bc/tests/fuzzing/bc_inputs1/add.txt | 146 ++++++++ contrib/bc/tests/fuzzing/bc_inputs1/arctangent.txt | 26 ++ contrib/bc/tests/fuzzing/bc_inputs1/array.bc | 60 +++ contrib/bc/tests/fuzzing/bc_inputs1/arrays.txt | 10 + .../bc/tests/fuzzing/bc_inputs1/assignments.txt | 122 ++++++ contrib/bc/tests/fuzzing/bc_inputs1/basic.txt | 7 + contrib/bc/tests/fuzzing/bc_inputs1/boolean.txt | 184 ++++++++++ contrib/bc/tests/fuzzing/bc_inputs1/cosine.txt | 44 +++ contrib/bc/tests/fuzzing/bc_inputs1/decimal.txt | 35 ++ contrib/bc/tests/fuzzing/bc_inputs1/divide.txt | 31 ++ .../bc/tests/fuzzing/bc_inputs1/engineering.txt | 19 + contrib/bc/tests/fuzzing/bc_inputs1/exponent.txt | 22 ++ contrib/bc/tests/fuzzing/bc_inputs1/functions.bc | 7 + contrib/bc/tests/fuzzing/bc_inputs1/functions.txt | 13 + contrib/bc/tests/fuzzing/bc_inputs1/globals.txt | 21 ++ contrib/bc/tests/fuzzing/bc_inputs1/len.bc | 48 +++ contrib/bc/tests/fuzzing/bc_inputs1/length.txt | 59 +++ contrib/bc/tests/fuzzing/bc_inputs1/lib10.txt | 4 + contrib/bc/tests/fuzzing/bc_inputs1/lib11.txt | 4 + contrib/bc/tests/fuzzing/bc_inputs1/lib12.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs1/lib2.txt | 15 + contrib/bc/tests/fuzzing/bc_inputs1/lib3.txt | 6 + contrib/bc/tests/fuzzing/bc_inputs1/lib4.txt | 10 + contrib/bc/tests/fuzzing/bc_inputs1/lib5.txt | 2 + contrib/bc/tests/fuzzing/bc_inputs1/lib6.txt | 5 + contrib/bc/tests/fuzzing/bc_inputs1/lib7.txt | 12 + contrib/bc/tests/fuzzing/bc_inputs1/lib8.txt | 3 + contrib/bc/tests/fuzzing/bc_inputs2/lib13.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib14.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib15.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib16.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib19.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib20.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib21.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib22.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib23.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib24.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/log.txt | 22 ++ contrib/bc/tests/fuzzing/bc_inputs2/misc.txt | 13 + contrib/bc/tests/fuzzing/bc_inputs2/misc1.txt | 76 ++++ contrib/bc/tests/fuzzing/bc_inputs2/misc2.txt | 110 ++++++ contrib/bc/tests/fuzzing/bc_inputs2/misc3.txt | 12 + contrib/bc/tests/fuzzing/bc_inputs2/modulus.txt | 69 ++++ contrib/bc/tests/fuzzing/bc_inputs2/multiply.txt | 40 ++ contrib/bc/tests/fuzzing/bc_inputs2/pi.txt | 4 + contrib/bc/tests/fuzzing/bc_inputs2/places.txt | 19 + contrib/bc/tests/fuzzing/bc_inputs2/power.txt | 44 +++ contrib/bc/tests/fuzzing/bc_inputs2/print2.txt | 194 ++++++++++ contrib/bc/tests/fuzzing/bc_inputs2/references.bc | 408 +++++++++++++++++++++ contrib/bc/tests/fuzzing/bc_inputs2/scale.txt | 57 +++ contrib/bc/tests/fuzzing/bc_inputs2/scientific.txt | 51 +++ contrib/bc/tests/fuzzing/bc_inputs2/shift.txt | 281 ++++++++++++++ contrib/bc/tests/fuzzing/bc_inputs2/sine.txt | 207 +++++++++++ contrib/bc/tests/fuzzing/bc_inputs3/01.txt | 339 +++++++++++++++++ contrib/bc/tests/fuzzing/bc_inputs3/02.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs3/03.txt | 2 + contrib/bc/tests/fuzzing/bc_inputs3/04.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs3/05.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs3/06.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs3/07.txt | 8 + contrib/bc/tests/fuzzing/bc_inputs3/08.txt | 3 + contrib/bc/tests/fuzzing/bc_inputs3/09.txt | 11 + contrib/bc/tests/fuzzing/bc_inputs3/10.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs3/11.txt | 99 +++++ contrib/bc/tests/fuzzing/bc_inputs3/12.txt | 2 + contrib/bc/tests/fuzzing/bc_inputs3/13.txt | 56 +++ contrib/bc/tests/fuzzing/bc_inputs3/14.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs3/15.txt | 3 + contrib/bc/tests/fuzzing/bc_inputs3/16.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs3/17.txt | 11 + contrib/bc/tests/fuzzing/bc_inputs3/18.txt | 3 + contrib/bc/tests/fuzzing/bc_inputs3/19.txt | 5 + contrib/bc/tests/fuzzing/bc_inputs3/20.txt | 51 +++ contrib/bc/tests/fuzzing/bc_inputs3/21.txt | 10 + contrib/bc/tests/fuzzing/bc_inputs3/22.txt | 2 + contrib/bc/tests/fuzzing/bc_inputs3/23.txt | Bin 0 -> 1024 bytes contrib/bc/tests/fuzzing/bc_inputs3/24.txt | 4 + contrib/bc/tests/fuzzing/bc_inputs3/sqrt.txt | 14 + contrib/bc/tests/fuzzing/bc_inputs3/strings.txt | 12 + contrib/bc/tests/fuzzing/bc_inputs3/subtract.txt | 153 ++++++++ contrib/bc/tests/fuzzing/bc_inputs3/trunc.txt | 15 + contrib/bc/tests/fuzzing/bc_inputs3/void.txt | 20 + contrib/bc/tests/fuzzing/dc_inputs/01.txt | 2 + contrib/bc/tests/fuzzing/dc_inputs/02.txt | 5 + contrib/bc/tests/fuzzing/dc_inputs/03.txt | 2 + contrib/bc/tests/fuzzing/dc_inputs/04.txt | 9 + contrib/bc/tests/fuzzing/dc_inputs/05.txt | 3 + contrib/bc/tests/fuzzing/dc_inputs/06.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/07.txt | 3 + contrib/bc/tests/fuzzing/dc_inputs/08.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/09.txt | 9 + contrib/bc/tests/fuzzing/dc_inputs/10.txt | 11 + contrib/bc/tests/fuzzing/dc_inputs/11.txt | 4 + contrib/bc/tests/fuzzing/dc_inputs/12.txt | 2 + contrib/bc/tests/fuzzing/dc_inputs/13.txt | 7 + contrib/bc/tests/fuzzing/dc_inputs/14.txt | 7 + contrib/bc/tests/fuzzing/dc_inputs/15.txt | 11 + contrib/bc/tests/fuzzing/dc_inputs/16.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/17.txt | 20 + contrib/bc/tests/fuzzing/dc_inputs/18.txt | 3 + contrib/bc/tests/fuzzing/dc_inputs/19.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/20.txt | 3 + contrib/bc/tests/fuzzing/dc_inputs/21.txt | 5 + contrib/bc/tests/fuzzing/dc_inputs/22.txt | 36 ++ contrib/bc/tests/fuzzing/dc_inputs/23.txt | 2 + contrib/bc/tests/fuzzing/dc_inputs/24.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/25.txt | 6 + contrib/bc/tests/fuzzing/dc_inputs/26.txt | 155 ++++++++ contrib/bc/tests/fuzzing/dc_inputs/27.txt | 2 + contrib/bc/tests/fuzzing/dc_inputs/28.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/29.txt | 13 + contrib/bc/tests/fuzzing/dc_inputs/30.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/31.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/abs.txt | 7 + contrib/bc/tests/fuzzing/dc_inputs/add.txt | 33 ++ contrib/bc/tests/fuzzing/dc_inputs/array.dc | 2 + contrib/bc/tests/fuzzing/dc_inputs/boolean.txt | 80 ++++ contrib/bc/tests/fuzzing/dc_inputs/decimal.txt | 36 ++ contrib/bc/tests/fuzzing/dc_inputs/divide.txt | 33 ++ contrib/bc/tests/fuzzing/dc_inputs/divmod.txt | 64 ++++ contrib/bc/tests/fuzzing/dc_inputs/else.dc | 4 + contrib/bc/tests/fuzzing/dc_inputs/engineering.txt | 19 + contrib/bc/tests/fuzzing/dc_inputs/loop.dc | 3 + contrib/bc/tests/fuzzing/dc_inputs/misc.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/modexp.txt | 103 ++++++ contrib/bc/tests/fuzzing/dc_inputs/modulus.txt | 70 ++++ contrib/bc/tests/fuzzing/dc_inputs/multiply.txt | 42 +++ contrib/bc/tests/fuzzing/dc_inputs/places.txt | 14 + contrib/bc/tests/fuzzing/dc_inputs/power.txt | 36 ++ contrib/bc/tests/fuzzing/dc_inputs/quit.dc | 2 + contrib/bc/tests/fuzzing/dc_inputs/scientific.txt | 51 +++ contrib/bc/tests/fuzzing/dc_inputs/shift.txt | 42 +++ contrib/bc/tests/fuzzing/dc_inputs/sqrt.txt | 14 + contrib/bc/tests/fuzzing/dc_inputs/stdin.txt | 205 +++++++++++ contrib/bc/tests/fuzzing/dc_inputs/stream.dc | 2 + contrib/bc/tests/fuzzing/dc_inputs/strings.txt | 50 +++ contrib/bc/tests/fuzzing/dc_inputs/subtract.txt | 33 ++ contrib/bc/tests/fuzzing/dc_inputs/trunc.txt | 11 + contrib/bc/tests/fuzzing/dc_inputs/vars.txt | 2 + contrib/bc/tests/fuzzing/dc_inputs/weird.dc | 2 + contrib/bc/tests/other.sh | 271 ++++++++++++++ contrib/bc/tests/radamsa.sh | 2 +- contrib/bc/tests/randmath.py | 2 +- contrib/bc/tests/read.sh | 23 +- contrib/bc/tests/script.sh | 26 +- contrib/bc/tests/scripts.sh | 9 +- contrib/bc/tests/stdin.sh | 23 +- contrib/bc/tests/test.sh | 32 +- tests/dc/errors/30.txt | 1 + tests/dc/errors/31.txt | 1 + tests/dc/scripts/all.txt | 9 + tests/diff.sh | 51 +++ tests/extra_required.txt | 7 + tests/fuzzing/bc.dict | 68 ++++ tests/fuzzing/bc_inputs1/abs.txt | 7 + tests/fuzzing/bc_inputs1/add.txt | 146 ++++++++ tests/fuzzing/bc_inputs1/arctangent.txt | 26 ++ tests/fuzzing/bc_inputs1/array.bc | 60 +++ tests/fuzzing/bc_inputs1/arrays.txt | 10 + tests/fuzzing/bc_inputs1/assignments.txt | 122 ++++++ tests/fuzzing/bc_inputs1/basic.txt | 7 + tests/fuzzing/bc_inputs1/boolean.txt | 184 ++++++++++ tests/fuzzing/bc_inputs1/cosine.txt | 44 +++ tests/fuzzing/bc_inputs1/decimal.txt | 35 ++ tests/fuzzing/bc_inputs1/divide.txt | 31 ++ tests/fuzzing/bc_inputs1/engineering.txt | 19 + tests/fuzzing/bc_inputs1/exponent.txt | 22 ++ tests/fuzzing/bc_inputs1/functions.bc | 7 + tests/fuzzing/bc_inputs1/functions.txt | 13 + tests/fuzzing/bc_inputs1/globals.txt | 21 ++ tests/fuzzing/bc_inputs1/len.bc | 48 +++ tests/fuzzing/bc_inputs1/length.txt | 59 +++ tests/fuzzing/bc_inputs1/lib10.txt | 4 + tests/fuzzing/bc_inputs1/lib11.txt | 4 + tests/fuzzing/bc_inputs1/lib12.txt | 1 + tests/fuzzing/bc_inputs1/lib2.txt | 15 + tests/fuzzing/bc_inputs1/lib3.txt | 6 + tests/fuzzing/bc_inputs1/lib4.txt | 10 + tests/fuzzing/bc_inputs1/lib5.txt | 2 + tests/fuzzing/bc_inputs1/lib6.txt | 5 + tests/fuzzing/bc_inputs1/lib7.txt | 12 + tests/fuzzing/bc_inputs1/lib8.txt | 3 + tests/fuzzing/bc_inputs2/lib13.txt | 1 + tests/fuzzing/bc_inputs2/lib14.txt | 1 + tests/fuzzing/bc_inputs2/lib15.txt | 1 + tests/fuzzing/bc_inputs2/lib16.txt | 1 + tests/fuzzing/bc_inputs2/lib19.txt | 1 + tests/fuzzing/bc_inputs2/lib20.txt | 1 + tests/fuzzing/bc_inputs2/lib21.txt | 1 + tests/fuzzing/bc_inputs2/lib22.txt | 1 + tests/fuzzing/bc_inputs2/lib23.txt | 1 + tests/fuzzing/bc_inputs2/lib24.txt | 1 + tests/fuzzing/bc_inputs2/log.txt | 22 ++ tests/fuzzing/bc_inputs2/misc.txt | 13 + tests/fuzzing/bc_inputs2/misc1.txt | 76 ++++ tests/fuzzing/bc_inputs2/misc2.txt | 110 ++++++ tests/fuzzing/bc_inputs2/misc3.txt | 12 + tests/fuzzing/bc_inputs2/modulus.txt | 69 ++++ tests/fuzzing/bc_inputs2/multiply.txt | 40 ++ tests/fuzzing/bc_inputs2/pi.txt | 4 + tests/fuzzing/bc_inputs2/places.txt | 19 + tests/fuzzing/bc_inputs2/power.txt | 44 +++ tests/fuzzing/bc_inputs2/print2.txt | 194 ++++++++++ tests/fuzzing/bc_inputs2/references.bc | 408 +++++++++++++++++++++ tests/fuzzing/bc_inputs2/scale.txt | 57 +++ tests/fuzzing/bc_inputs2/scientific.txt | 51 +++ tests/fuzzing/bc_inputs2/shift.txt | 281 ++++++++++++++ tests/fuzzing/bc_inputs2/sine.txt | 207 +++++++++++ tests/fuzzing/bc_inputs3/01.txt | 339 +++++++++++++++++ tests/fuzzing/bc_inputs3/02.txt | 1 + tests/fuzzing/bc_inputs3/03.txt | 2 + tests/fuzzing/bc_inputs3/04.txt | 1 + tests/fuzzing/bc_inputs3/05.txt | 1 + tests/fuzzing/bc_inputs3/06.txt | 1 + tests/fuzzing/bc_inputs3/07.txt | 8 + tests/fuzzing/bc_inputs3/08.txt | 3 + tests/fuzzing/bc_inputs3/09.txt | 11 + tests/fuzzing/bc_inputs3/10.txt | 1 + tests/fuzzing/bc_inputs3/11.txt | 99 +++++ tests/fuzzing/bc_inputs3/12.txt | 2 + tests/fuzzing/bc_inputs3/13.txt | 56 +++ tests/fuzzing/bc_inputs3/14.txt | 1 + tests/fuzzing/bc_inputs3/15.txt | 3 + tests/fuzzing/bc_inputs3/16.txt | 1 + tests/fuzzing/bc_inputs3/17.txt | 11 + tests/fuzzing/bc_inputs3/18.txt | 3 + tests/fuzzing/bc_inputs3/19.txt | 5 + tests/fuzzing/bc_inputs3/20.txt | 51 +++ tests/fuzzing/bc_inputs3/21.txt | 10 + tests/fuzzing/bc_inputs3/22.txt | 2 + tests/fuzzing/bc_inputs3/23.txt | Bin 0 -> 1024 bytes tests/fuzzing/bc_inputs3/24.txt | 4 + tests/fuzzing/bc_inputs3/sqrt.txt | 14 + tests/fuzzing/bc_inputs3/strings.txt | 12 + tests/fuzzing/bc_inputs3/subtract.txt | 153 ++++++++ tests/fuzzing/bc_inputs3/trunc.txt | 15 + tests/fuzzing/bc_inputs3/void.txt | 20 + tests/fuzzing/dc_inputs/01.txt | 2 + tests/fuzzing/dc_inputs/02.txt | 5 + tests/fuzzing/dc_inputs/03.txt | 2 + tests/fuzzing/dc_inputs/04.txt | 9 + tests/fuzzing/dc_inputs/05.txt | 3 + tests/fuzzing/dc_inputs/06.txt | 1 + tests/fuzzing/dc_inputs/07.txt | 3 + tests/fuzzing/dc_inputs/08.txt | 1 + tests/fuzzing/dc_inputs/09.txt | 9 + tests/fuzzing/dc_inputs/10.txt | 11 + tests/fuzzing/dc_inputs/11.txt | 4 + tests/fuzzing/dc_inputs/12.txt | 2 + tests/fuzzing/dc_inputs/13.txt | 7 + tests/fuzzing/dc_inputs/14.txt | 7 + tests/fuzzing/dc_inputs/15.txt | 11 + tests/fuzzing/dc_inputs/16.txt | 1 + tests/fuzzing/dc_inputs/17.txt | 20 + tests/fuzzing/dc_inputs/18.txt | 3 + tests/fuzzing/dc_inputs/19.txt | 1 + tests/fuzzing/dc_inputs/20.txt | 3 + tests/fuzzing/dc_inputs/21.txt | 5 + tests/fuzzing/dc_inputs/22.txt | 36 ++ tests/fuzzing/dc_inputs/23.txt | 2 + tests/fuzzing/dc_inputs/24.txt | 1 + tests/fuzzing/dc_inputs/25.txt | 6 + tests/fuzzing/dc_inputs/26.txt | 155 ++++++++ tests/fuzzing/dc_inputs/27.txt | 2 + tests/fuzzing/dc_inputs/28.txt | 1 + tests/fuzzing/dc_inputs/29.txt | 13 + tests/fuzzing/dc_inputs/30.txt | 1 + tests/fuzzing/dc_inputs/31.txt | 1 + tests/fuzzing/dc_inputs/abs.txt | 7 + tests/fuzzing/dc_inputs/add.txt | 33 ++ tests/fuzzing/dc_inputs/array.dc | 2 + tests/fuzzing/dc_inputs/boolean.txt | 80 ++++ tests/fuzzing/dc_inputs/decimal.txt | 36 ++ tests/fuzzing/dc_inputs/divide.txt | 33 ++ tests/fuzzing/dc_inputs/divmod.txt | 64 ++++ tests/fuzzing/dc_inputs/else.dc | 4 + tests/fuzzing/dc_inputs/engineering.txt | 19 + tests/fuzzing/dc_inputs/loop.dc | 3 + tests/fuzzing/dc_inputs/misc.txt | 1 + tests/fuzzing/dc_inputs/modexp.txt | 103 ++++++ tests/fuzzing/dc_inputs/modulus.txt | 70 ++++ tests/fuzzing/dc_inputs/multiply.txt | 42 +++ tests/fuzzing/dc_inputs/places.txt | 14 + tests/fuzzing/dc_inputs/power.txt | 36 ++ tests/fuzzing/dc_inputs/quit.dc | 2 + tests/fuzzing/dc_inputs/scientific.txt | 51 +++ tests/fuzzing/dc_inputs/shift.txt | 42 +++ tests/fuzzing/dc_inputs/sqrt.txt | 14 + tests/fuzzing/dc_inputs/stdin.txt | 205 +++++++++++ tests/fuzzing/dc_inputs/stream.dc | 2 + tests/fuzzing/dc_inputs/strings.txt | 50 +++ tests/fuzzing/dc_inputs/subtract.txt | 33 ++ tests/fuzzing/dc_inputs/trunc.txt | 11 + tests/fuzzing/dc_inputs/vars.txt | 2 + tests/fuzzing/dc_inputs/weird.dc | 2 + tests/other.sh | 271 ++++++++++++++ 470 files changed, 11313 insertions(+), 821 deletions(-) diff --git a/.gitignore b/.gitignore deleted file mode 100644 index c674e06fda50..000000000000 --- a/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -*.a -*.core -*.o -*.so -*.swp -*~ -_.tinderbox.* -_.universe-toolchain -_.amd64.* -_.arm.* -_.arm64.* -_.i386.* -_.ia64.* -_.mips.* -_.pc98.* -_.powerpc.* -_.riscv.* -_.sparc64.* -_.sun4v.* -GPATH -GRTAGS -GTAGS -ID -cscope.files -cscope.in.out -cscope.out -cscope.po.out diff --git a/README.md b/README.md deleted file mode 100644 index 72bd634cd813..000000000000 --- a/README.md +++ /dev/null @@ -1,82 +0,0 @@ -FreeBSD Source: ---------------- -This is the top level of the FreeBSD source directory. This file -was last revised on: -$FreeBSD$ - -FreeBSD is an operating system used to power modern servers, -desktops, and embedded platforms. A large community has -continually developed it for more than thirty years. Its -advanced networking, security, and storage features have -made FreeBSD the platform of choice for many of the -busiest web sites and most pervasive embedded networking -and storage devices. - -For copyright information, please see the file COPYRIGHT in this -directory. Additional copyright information also exists for some -sources in this tree - please see the specific source directories for -more information. - -The Makefile in this directory supports a number of targets for -building components (or all) of the FreeBSD source tree. See build(7), config(8), -https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html, and -https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html -for more information, including setting make(1) variables. - -Source Roadmap: ---------------- -``` -bin System/user commands. - -cddl Various commands and libraries under the Common Development - and Distribution License. - -contrib Packages contributed by 3rd parties. - -crypto Cryptography stuff (see crypto/README). - -etc Template files for /etc. - -gnu Various commands and libraries under the GNU Public License. - Please see gnu/COPYING* for more information. - -include System include files. - -kerberos5 Kerberos5 (Heimdal) package. - -lib System libraries. - -libexec System daemons. - -release Release building Makefile & associated tools. - -rescue Build system for statically linked /rescue utilities. - -sbin System commands. - -secure Cryptographic libraries and commands. - -share Shared resources. - -stand Boot loader sources. - -sys Kernel sources. - -sys//conf Kernel configuration files. GENERIC is the configuration - used in release builds. NOTES contains documentation of - all possible entries. - -tests Regression tests which can be run by Kyua. See tests/README - for additional information. - -tools Utilities for regression testing and miscellaneous tasks. - -usr.bin User commands. - -usr.sbin System administration commands. -``` - -For information on synchronizing your source tree with one or more of -the FreeBSD Project's development branches, please see: - - https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/current-stable.html diff --git a/contrib/bc/.gitignore b/contrib/bc/.gitignore index fb9bc5ab6aa2..5c2bbae866c0 100644 --- a/contrib/bc/.gitignore +++ b/contrib/bc/.gitignore @@ -34,6 +34,13 @@ config.mak timeconst.bc Makefile +tests/fuzzing/bc_outputs1/* +tests/fuzzing/bc_outputs2/* +tests/fuzzing/bc_outputs3/* +tests/fuzzing/dc_outputs/* +tests/bc_outputs/* +tests/dc_outputs/* + .gdb_history # Ignore the generated test files @@ -57,5 +64,7 @@ perf.data.old *.html *.profraw +core.* + cscope*.out tags diff --git a/contrib/bc/LICENSE.md b/contrib/bc/LICENSE.md index 1681a053e0de..269e131cc81d 100644 --- a/contrib/bc/LICENSE.md +++ b/contrib/bc/LICENSE.md @@ -1,6 +1,6 @@ # License -Copyright (c) 2018-2020 Gavin D. Howard +Copyright (c) 2018-2021 Gavin D. Howard Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -31,7 +31,7 @@ copyrights and license: Copyright (c) 2010-2014, Salvatore Sanfilippo
Copyright (c) 2010-2013, Pieter Noordhuis
Copyright (c) 2018 rain-1
-Copyright (c) 2018-2020, Gavin D. Howard +Copyright (c) 2018-2021, Gavin D. Howard Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -53,3 +53,51 @@ 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. + +## Rand + +The files `src/rand.c` and `include/rand.h` are under the following copyrights +and license: + +Copyright (c) 2014-2017 Melissa O'Neill and PCG Project contributors +Copyright (c) 2018-2021 Gavin D. Howard + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +## `safe-install.sh` + +The file `safe-install.sh` is under the following copyright and license: + +Copyright (c) 2021 Rich Felker + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Software”), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/contrib/bc/Makefile.in b/contrib/bc/Makefile.in index d17e74163397..8ae982bd99fe 100644 --- a/contrib/bc/Makefile.in +++ b/contrib/bc/Makefile.in @@ -1,7 +1,7 @@ # # SPDX-License-Identifier: BSD-2-Clause # -# Copyright (c) 2018-2020 Gavin D. Howard and contributors. +# Copyright (c) 2018-2021 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -29,7 +29,7 @@ # .POSIX: -VERSION = 3.2.4 +VERSION = 3.2.6 SRC = %%SRC%% OBJ = %%OBJ%% @@ -41,6 +41,13 @@ BC_ENABLED = %%BC_ENABLED%% DC_ENABLED_NAME = DC_ENABLED DC_ENABLED = %%DC_ENABLED%% +HEADERS = include/args.h include/file.h include/lang.h include/lex.h include/num.h include/opt.h include/parse.h include/program.h include/read.h include/status.h include/vector.h include/vm.h +BC_HEADERS = include/bc.h +DC_HEADERS = include/dc.h +HISTORY_HEADERS = include/history.h +EXTRA_MATH_HEADERS = include/rand.h +LIBRARY_HEADERS = include/bcl.h include/library.h + GEN_DIR = gen GEN = %%GEN%% GEN_EXEC = $(GEN_DIR)/$(GEN) @@ -82,6 +89,11 @@ DC = dc BC_EXEC = $(BIN)/$(EXEC_PREFIX)$(BC) DC_EXEC = $(BIN)/$(EXEC_PREFIX)$(DC) +BC_TEST_OUTPUTS = tests/bc_outputs +BC_FUZZ_OUTPUTS = tests/fuzzing/bc_outputs1 tests/fuzzing/bc_outputs2 tests/fuzzing/bc_outputs3 +DC_TEST_OUTPUTS = tests/dc_outputs +DC_FUZZ_OUTPUTS = tests/fuzzing/dc_outputs + LIB = libbcl LIB_NAME = $(LIB).a LIBBC = $(BIN)/$(LIB_NAME) @@ -125,6 +137,9 @@ BC_ENABLE_NLS = %%NLS%% BC_ENABLE_PROMPT = %%PROMPT%% BC_LONG_BIT = %%LONG_BIT%% +BC_ENABLE_AFL = %%FUZZ%% +BC_ENABLE_MEMCHECK = %%MEMCHECK%% + RM = rm MKDIR = mkdir @@ -138,6 +153,8 @@ LOCALE_UNINSTALL = ./locale_uninstall.sh VALGRIND_ARGS = --error-exitcode=100 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all +TEST_STARS = "***********************************************************************" + BC_NUM_KARATSUBA_LEN = %%KARATSUBA_LEN%% CPPFLAGS1 = -D$(BC_ENABLED_NAME)=$(BC_ENABLED) -D$(DC_ENABLED_NAME)=$(DC_ENABLED) @@ -147,7 +164,8 @@ CPPFLAGS4 = $(CPPFLAGS3) -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 CPPFLAGS5 = $(CPPFLAGS4) -DBC_NUM_KARATSUBA_LEN=$(BC_NUM_KARATSUBA_LEN) CPPFLAGS6 = $(CPPFLAGS5) -DBC_ENABLE_NLS=$(BC_ENABLE_NLS) -DBC_ENABLE_PROMPT=$(BC_ENABLE_PROMPT) CPPFLAGS7 = $(CPPFLAGS6) -D$(BC_ENABLE_EXTRA_MATH_NAME)=$(BC_ENABLE_EXTRA_MATH) -CPPFLAGS = $(CPPFLAGS7) -DBC_ENABLE_HISTORY=$(BC_ENABLE_HISTORY) -DBC_ENABLE_LIBRARY=$(BC_ENABLE_LIBRARY) +CPPFLAGS8 = $(CPPFLAGS7) -DBC_ENABLE_HISTORY=$(BC_ENABLE_HISTORY) -DBC_ENABLE_LIBRARY=$(BC_ENABLE_LIBRARY) +CPPFLAGS = $(CPPFLAGS8) -DBC_ENABLE_MEMCHECK=$(BC_ENABLE_MEMCHECK) -DBC_ENABLE_AFL=$(BC_ENABLE_AFL) CFLAGS = $(CPPFLAGS) %%CPPFLAGS%% %%CFLAGS%% LDFLAGS = %%LDFLAGS%% @@ -159,20 +177,15 @@ HOSTCC = %%HOSTCC%% BC_LIB_C_ARGS = bc_lib bc_lib_name $(BC_ENABLED_NAME) 1 BC_LIB2_C_ARGS = bc_lib2 bc_lib2_name "$(BC_ENABLED_NAME) && $(BC_ENABLE_EXTRA_MATH_NAME)" 1 -OBJS = $(BC_HELP_O) $(DC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ) -OBJ_TARGETS = $(DC_HELP_O) $(BC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ) +OBJS = $(DC_HELP_O) $(BC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ) -.c.o: - $(CC) $(CFLAGS) -o $@ -c $< - -all: %%ALL_PREREQ%% +all: %%DEFAULT_TARGET%% -execs: make_bin $(OBJ_TARGETS) - $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(EXEC) - %%LINK%% +%%DEFAULT_TARGET%%: %%DEFAULT_TARGET_PREREQS%% + %%DEFAULT_TARGET_CMD%% -library: make_bin $(OBJ) $(BC_LIB_O) $(BC_LIB2_O) - ar -r -cu $(LIBBC) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ) +%%SECOND_TARGET%%: %%SECOND_TARGET_PREREQS%% + %%SECOND_TARGET_CMD%% $(GEN_EXEC): %%GEN_EXEC_TARGET%% @@ -180,18 +193,32 @@ $(GEN_EXEC): $(BC_LIB_C): $(GEN_EXEC) $(BC_LIB) $(GEN_EMU) $(GEN_EXEC) $(BC_LIB) $(BC_LIB_C) $(BC_LIB_C_ARGS) +$(BC_LIB_O): $(BC_LIB_C) + $(CC) $(CFLAGS) -o $@ -c $< + $(BC_LIB2_C): $(GEN_EXEC) $(BC_LIB2) $(GEN_EMU) $(GEN_EXEC) $(BC_LIB2) $(BC_LIB2_C) $(BC_LIB2_C_ARGS) +$(BC_LIB2_O): $(BC_LIB2_C) + $(CC) $(CFLAGS) -o $@ -c $< + $(BC_HELP_C): $(GEN_EXEC) $(BC_HELP) $(GEN_EMU) $(GEN_EXEC) $(BC_HELP) $(BC_HELP_C) bc_help "" $(BC_ENABLED_NAME) +$(BC_HELP_O): $(BC_HELP_C) + $(CC) $(CFLAGS) -o $@ -c $< + $(DC_HELP_C): $(GEN_EXEC) $(DC_HELP) $(GEN_EMU) $(GEN_EXEC) $(DC_HELP) $(DC_HELP_C) dc_help "" $(DC_ENABLED_NAME) -make_bin: +$(DC_HELP_O): $(DC_HELP_C) + $(CC) $(CFLAGS) -o $@ -c $< + +$(BIN): $(MKDIR) -p $(BIN) +headers: %%HEADERS%% + help: @printf 'available targets:\n' @printf '\n' @@ -222,41 +249,68 @@ help: @printf ' valgrind_dc runs the dc test suite, if dc has been built,\n' @printf ' through valgrind\n' +run_all_tests: + %%BC_ALL_TESTS%% + %%TIMECONST_ALL_TESTS%% + %%DC_ALL_TESTS%% + check: test test: %%TESTS%% -test_bc: - %%BC_TEST%% +test_bc: test_bc_header test_bc_tests test_bc_scripts test_bc_stdin test_bc_read test_bc_errors test_bc_other + @printf '\nAll bc tests passed.\n\n$(TEST_STARS)\n' + +test_bc_tests:%%BC_TESTS%% + +test_bc_scripts:%%BC_SCRIPT_TESTS%% + +test_bc_stdin: + @sh tests/stdin.sh bc %%BC_TEST_EXEC%% + +test_bc_read: + @sh tests/read.sh bc %%BC_TEST_EXEC%% + +test_bc_errors: + @sh tests/errors.sh bc %%BC_TEST_EXEC%% + +test_bc_other: + @sh tests/other.sh bc %%BC_TEST_EXEC%% + +test_bc_header: + @printf '$(TEST_STARS)\n\nRunning bc tests...\n\n' -test_dc: - %%DC_TEST%% +test_dc: test_dc_header test_dc_tests test_dc_scripts test_dc_stdin test_dc_read test_dc_errors test_dc_other + @printf '\nAll dc tests passed.\n\n$(TEST_STARS)\n' -time_test: time_test_bc timeconst time_test_dc +test_dc_tests:%%DC_TESTS%% -time_test_bc: - %%BC_TIME_TEST%% +test_dc_scripts:%%DC_SCRIPT_TESTS%% -time_test_dc: - %%DC_TIME_TEST%% +test_dc_stdin: + @sh tests/stdin.sh dc %%DC_TEST_EXEC%% + +test_dc_read: + @sh tests/read.sh dc %%DC_TEST_EXEC%% + +test_dc_errors: + @sh tests/errors.sh dc %%DC_TEST_EXEC%% + +test_dc_other: + @sh tests/other.sh dc %%DC_TEST_EXEC%% + +test_dc_header: + @printf '$(TEST_STARS)\n\nRunning dc tests...\n\n' timeconst: %%TIMECONST%% -library_test: library +library_test: $(LIBBC) $(CC) $(CFLAGS) $(BCL_TEST_C) $(LIBBC) -o $(BCL_TEST) test_library: library_test $(BCL_TEST) -valgrind: valgrind_bc valgrind_dc - -valgrind_bc: - %%VG_BC_TEST%% - -valgrind_dc: - %%VG_DC_TEST%% - karatsuba: %%KARATSUBA%% @@ -296,6 +350,8 @@ clean:%%CLEAN_PREREQS%% @$(RM) -f $(BC_LIB2_C) $(BC_LIB2_O) @$(RM) -f $(BC_HELP_C) $(BC_HELP_O) @$(RM) -f $(DC_HELP_C) $(DC_HELP_O) + @$(RM) -fr $(BC_TEST_OUTPUTS) $(DC_TEST_OUTPUTS) + @$(RM) -fr $(BC_FUZZ_OUTPUTS) $(DC_FUZZ_OUTPUTS) clean_config: clean @printf 'Cleaning config...\n' diff --git a/contrib/bc/NEWS.md b/contrib/bc/NEWS.md index f4fc2f5779ce..5982defb754c 100644 --- a/contrib/bc/NEWS.md +++ b/contrib/bc/NEWS.md @@ -1,5 +1,40 @@ # News +## 3.2.6 + +This is a production release that fixes the build on FreeBSD. + +There was a syntax error in `configure.sh` that the Linux shell did not catch, +and FreeBSD depends on the existence of `tests/all.sh`. + +All users that already upgraded to `3.2.5` should update to this release, with +my apologies for the poor release of `3.2.5`. Other users should skip `3.2.5` in +favor of this version. + +## 3.2.5 + +This is a production release that fixes several bugs and adds a couple small +things. + +The two most important bugs were bugs that causes `dc` to access memory +out-of-bounds (crash in debug builds). This was found by upgrading to `afl++` +from `afl`. Both were caused by a failure to distinguish between the same two +cases. + +Another bug was the failure to put all of the licenses in the `LICENSE.md` file. + +Third, some warnings by `scan-build` were found and eliminated. This needed one +big change: `bc` and `dc` now bail out as fast as possible on fatal errors +instead of unwinding the stack. + +Fourth, the pseudo-random number now attempts to seed itself with `/dev/random` +if `/dev/urandom` fails. + +Finally, this release has a few quality-of-life changes to the build system. The +usage should not change at all; the only thing that changed was making sure the +`Makefile.in` was written to rebuild properly when headers changed and to not +rebuild when not necessary. + ## 3.2.4 This is a production release that fixes a warning on `gcc` 6 or older, which diff --git a/contrib/bc/NOTICE.md b/contrib/bc/NOTICE.md index 92117daa9a6c..56d2935ab4b3 100644 *** 16942 LINES SKIPPED *** From owner-dev-commits-src-branches@freebsd.org Wed Feb 3 14:11:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 87AE6537F90; Wed, 3 Feb 2021 14:11: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 4DW3Wx3SgQz4d9H; Wed, 3 Feb 2021 14:11:41 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 6A04C220E9; Wed, 3 Feb 2021 14:11:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 113EBfF0071727; Wed, 3 Feb 2021 14:11:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 113EBftK071725; Wed, 3 Feb 2021 14:11:41 GMT (envelope-from git) Date: Wed, 3 Feb 2021 14:11:41 GMT Message-Id: <202102031411.113EBftK071725@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Roger Pau Monné Subject: git: 51ab5e0d82c1 - stable/13 - stand/multiboot: adjust the protocol between loader and kernel MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 51ab5e0d82c1e9607c060976259bb9ae0d656a80 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2021 14:11:41 -0000 The branch stable/13 has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=51ab5e0d82c1e9607c060976259bb9ae0d656a80 commit 51ab5e0d82c1e9607c060976259bb9ae0d656a80 Author: Roger Pau Monné AuthorDate: 2021-01-27 10:12:07 +0000 Commit: Roger Pau Monné CommitDate: 2021-02-03 13:07:43 +0000 stand/multiboot: adjust the protocol between loader and kernel There's a currently ad-hoc protocol to hand off the FreeBSD kernel payload between the loader and the kernel itself when Xen is in the middle of the picture. Such protocol wasn't very resilient to changes to the loader itself, because it relied on moving metadata around to package it using a certain layout. This has proven to be fragile, so replace it with a more robust version. The new protocol requires using a xen_header structure that will be used to pass data between the FreeBSD loader and the FreeBSD kernel when booting in dom0 mode. At the moment the only data conveyed is the offset of the start of the module metadata relative to the start of the module itself. This is a slightly disruptive change since it also requires a change to the kernel which is contained in this patch. In order to update with this change the kernel must be updated before updating the loader, as described in the handbook. Note this is only required when booting a FreeBSD/Xen dom0. This change doesn't affect the normal FreeBSD boot protocol. This fixes booting FreeBSD/Xen in dom0 mode after 3630506b9daec9167a89bc4525638ea45a00769e. (cherry picked from commit b6d85a5f51e4147452b35d76478fb9e191b7734b) --- stand/i386/libi386/multiboot.c | 156 +++++++++++------------------------------ sys/x86/include/metadata.h | 21 ++++++ sys/x86/xen/pv.c | 67 +++++++++++++----- 3 files changed, 111 insertions(+), 133 deletions(-) diff --git a/stand/i386/libi386/multiboot.c b/stand/i386/libi386/multiboot.c index a29696e4baec..71fd63bb4c88 100644 --- a/stand/i386/libi386/multiboot.c +++ b/stand/i386/libi386/multiboot.c @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #define _MACHINE_ELF_WANT_32BIT #include +#include #include #include @@ -55,11 +56,6 @@ __FBSDID("$FreeBSD$"); #define MULTIBOOT_SUPPORTED_FLAGS \ (MULTIBOOT_PAGE_ALIGN|MULTIBOOT_MEMORY_INFO) #define NUM_MODULES 2 -#define METADATA_FIXED_SIZE (PAGE_SIZE*4) -#define METADATA_MODULE_SIZE PAGE_SIZE - -#define METADATA_RESV_SIZE(mod_num) \ - roundup(METADATA_FIXED_SIZE + METADATA_MODULE_SIZE * mod_num, PAGE_SIZE) extern int elf32_loadfile_raw(char *filename, uint64_t dest, struct preloaded_file **result, int multiboot); @@ -81,32 +77,6 @@ extern void multiboot_tramp(); static const char mbl_name[] = "FreeBSD Loader"; -static int -num_modules(struct preloaded_file *kfp) -{ - struct kernel_module *kmp; - int mod_num = 0; - - for (kmp = kfp->f_modules; kmp != NULL; kmp = kmp->m_next) - mod_num++; - - return (mod_num); -} - -static vm_offset_t -max_addr(void) -{ - struct preloaded_file *fp; - vm_offset_t addr = 0; - - for (fp = file_findfile(NULL, NULL); fp != NULL; fp = fp->f_next) { - if (addr < (fp->f_addr + fp->f_size)) - addr = fp->f_addr + fp->f_size; - } - - return (addr); -} - static int multiboot_loadfile(char *filename, uint64_t dest, struct preloaded_file **result) @@ -188,7 +158,6 @@ out: static int multiboot_exec(struct preloaded_file *fp) { - vm_offset_t module_start, last_addr, metadata_size; vm_offset_t modulep, kernend, entry; struct file_metadata *md; Elf_Ehdr *ehdr; @@ -197,6 +166,9 @@ multiboot_exec(struct preloaded_file *fp) char *cmdline = NULL; size_t len; int error, mod_num; + struct xen_header header; + + CTASSERT(sizeof(header) <= PAGE_SIZE); /* * Don't pass the memory size found by the bootloader, the memory @@ -260,13 +232,11 @@ multiboot_exec(struct preloaded_file *fp) * FreeBSD kernel loaded as a raw file. The second module is going * to contain the metadata info and the loaded modules. * - * On native FreeBSD loads all the modules and then places the - * metadata info at the end, but this is painful when running on Xen, - * because it relocates the second multiboot module wherever it - * likes. In order to workaround this limitation the metadata - * information is placed at the start of the second module and - * the original modulep value is saved together with the other - * metadata, so we can relocate everything. + * There's a small header prefixed in the second module that contains + * some information required to calculate the relocated address of + * modulep based on the original offset of modulep from the start of + * the module address. Note other fields might be added to this header + * if required. * * Native layout: * fp->f_addr + fp->f_size @@ -277,27 +247,16 @@ multiboot_exec(struct preloaded_file *fp) * +---------+----------------+------------+ * fp->f_addr modulep kernend * - * Xen layout: - * - * Initial: - * fp->f_addr + fp->f_size - * +---------+----------+----------------+------------+ - * | | | | | - * | Kernel | Reserved | Modules | Metadata | - * | | | | dry run | - * +---------+----------+----------------+------------+ - * fp->f_addr - * - * After metadata polacement (ie: final): - * fp->f_addr + fp->f_size - * +-----------+---------+----------+----------------+ - * | | | | | - * | Kernel | Free | Metadata | Modules | - * | | | | | - * +-----------+---------+----------+----------------+ - * fp->f_addr modulep kernend - * \__________/ \__________________________/ - * Multiboot module 0 Multiboot module 1 + * Xen dom0 layout: + * fp->f_addr fp->f_addr + fp->f_size + * +---------+------------+----------------+------------+ + * | | | | | + * | Kernel | xen_header | Modules | Metadata | + * | | | | | + * +---------+------------+----------------+------------+ + * modulep kernend + * \________/\__________________________________________/ + * module 0 module 1 */ fp = file_findfile(NULL, "elf kernel"); @@ -307,13 +266,6 @@ multiboot_exec(struct preloaded_file *fp) goto error; } - if (fp->f_metadata != NULL) { - printf("FreeBSD kernel already contains metadata, aborting\n"); - error = EINVAL; - goto error; - } - - mb_mod = malloc(sizeof(struct multiboot_mod_list) * NUM_MODULES); if (mb_mod == NULL) { error = ENOMEM; @@ -322,61 +274,34 @@ multiboot_exec(struct preloaded_file *fp) bzero(mb_mod, sizeof(struct multiboot_mod_list) * NUM_MODULES); - /* - * Calculate how much memory is needed for the metatdata. We did - * an approximation of the maximum size when loading the kernel, - * but now we know the exact size, so we can release some of this - * preallocated memory if not needed. - */ - last_addr = roundup(max_addr(), PAGE_SIZE); - mod_num = num_modules(fp); - - /* - * Place the metadata after the last used address in order to - * calculate it's size, this will not be used. - */ - error = bi_load64(fp->f_args, last_addr, &modulep, &kernend, 0); + error = bi_load64(fp->f_args, 0, &modulep, &kernend, 0); if (error != 0) { printf("bi_load64 failed: %d\n", error); goto error; } - metadata_size = roundup(kernend - last_addr, PAGE_SIZE); - /* Check that the size is not greater than what we have reserved */ - if (metadata_size > METADATA_RESV_SIZE(mod_num)) { - printf("Required memory for metadata is greater than reserved " - "space, please increase METADATA_FIXED_SIZE and " - "METADATA_MODULE_SIZE and rebuild the loader\n"); + mb_mod[0].mod_start = fp->f_addr; + mb_mod[0].mod_end = fp->f_addr + fp->f_size - PAGE_SIZE; + + mb_mod[1].mod_start = mb_mod[0].mod_end; + mb_mod[1].mod_end = kernend; + /* Indicate the kernel metadata is prefixed with a xen_header. */ + cmdline = strdup("header"); + if (cmdline == NULL) { + printf("Out of memory, aborting\n"); error = ENOMEM; goto error; } - - /* Clean the metadata added to the kernel in the bi_load64 dry run */ - file_removemetadata(fp); - - /* - * This is the position where the second multiboot module - * will be placed. - */ - module_start = fp->f_addr + fp->f_size - metadata_size; - - error = bi_load64(fp->f_args, module_start, &modulep, &kernend, 0); - if (error != 0) { - printf("bi_load64 failed: %d\n", error); - goto error; - } - - mb_mod[0].mod_start = fp->f_addr; - mb_mod[0].mod_end = fp->f_addr + fp->f_size; - mb_mod[0].mod_end -= METADATA_RESV_SIZE(mod_num); - - mb_mod[1].mod_start = module_start; - mb_mod[1].mod_end = last_addr; + mb_mod[1].cmdline = VTOP(cmdline); mb_info->mods_count = NUM_MODULES; mb_info->mods_addr = VTOP(mb_mod); mb_info->flags |= MULTIBOOT_INFO_MODS; + header.flags = XENHEADER_HAS_MODULEP_OFFSET; + header.modulep_offset = modulep - mb_mod[1].mod_start; + archsw.arch_copyin(&header, mb_mod[1].mod_start, sizeof(header)); + dev_cleanup(); __exec((void *)VTOP(multiboot_tramp), (void *)entry, (void *)VTOP(mb_info)); @@ -434,17 +359,14 @@ multiboot_obj_loadfile(char *filename, uint64_t dest, return (EINVAL); } + /* - * Save space at the end of the kernel in order to place - * the metadata information. We do an approximation of the - * max metadata size, this is not optimal but it's probably - * the best we can do at this point. Once all modules are - * loaded and the size of the metadata is known this - * space will be recovered if not used. + * Reserve one page at the end of the kernel to place some + * metadata in order to cope for Xen relocating the modules and + * the metadata information. */ - mod_num = num_modules(rfp); rfp->f_size = roundup(rfp->f_size, PAGE_SIZE); - rfp->f_size += METADATA_RESV_SIZE(mod_num); + rfp->f_size += PAGE_SIZE; *result = rfp; } else { /* The rest should be loaded as regular modules */ diff --git a/sys/x86/include/metadata.h b/sys/x86/include/metadata.h index d157df0307fd..be0eae43d34c 100644 --- a/sys/x86/include/metadata.h +++ b/sys/x86/include/metadata.h @@ -68,4 +68,25 @@ struct vbe_fb { uint32_t fb_bpp; }; +/* + * The structure below is used when FreeBSD kernel is booted as a dom0 kernel + * from Xen. In such scenario we need to accommodate the modules and the + * metadata as a contiguous memory region, so it can be passed as a multiboot + * module, and some extra information is required which is conveyed from the + * loader to the kernel using the xen_header structure below. + * + * See the comment in multiboot.c about how the structure below is packaged + * together with the rest of the kernel payload data. + */ +struct xen_header { + uint64_t flags; +#define XENHEADER_HAS_MODULEP_OFFSET (1ull << 0) + + /* + * Offset of the modulep location from the start of the multiboot + * module blob. + */ + uint64_t modulep_offset; +}; + #endif /* !_MACHINE_METADATA_H_ */ diff --git a/sys/x86/xen/pv.c b/sys/x86/xen/pv.c index 34fcbd990491..2fd698772f9d 100644 --- a/sys/x86/xen/pv.c +++ b/sys/x86/xen/pv.c @@ -568,25 +568,60 @@ xen_pvh_parse_preload_data(uint64_t modulep) if (start_info->modlist_paddr != 0) { struct hvm_modlist_entry *mod; + const char *cmdline; mod = (struct hvm_modlist_entry *) (start_info->modlist_paddr + KERNBASE); - preload_metadata = (caddr_t)(mod[0].paddr + KERNBASE); - - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) - kmdp = preload_search_by_type("elf64 kernel"); - KASSERT(kmdp != NULL, ("unable to find kernel")); - - /* - * Xen has relocated the metadata and the modules, - * so we need to recalculate it's position. This is - * done by saving the original modulep address and - * then calculating the offset with mod_start, - * which contains the relocated modulep address. - */ - metadata = MD_FETCH(kmdp, MODINFOMD_MODULEP, vm_paddr_t); - off = mod[0].paddr + KERNBASE - metadata; + cmdline = mod[0].cmdline_paddr ? + (const char *)(mod[0].cmdline_paddr + KERNBASE) : NULL; + + if (strcmp(cmdline, "header") == 0) { + struct xen_header *header; + + header = (struct xen_header *)(mod[0].paddr + KERNBASE); + + if ((header->flags & XENHEADER_HAS_MODULEP_OFFSET) != + XENHEADER_HAS_MODULEP_OFFSET) { + xc_printf("Unable to load module metadata\n"); + HYPERVISOR_shutdown(SHUTDOWN_crash); + } + + preload_metadata = (caddr_t)(mod[0].paddr + + header->modulep_offset + KERNBASE); + + kmdp = preload_search_by_type("elf kernel"); + if (kmdp == NULL) + kmdp = preload_search_by_type("elf64 kernel"); + if (kmdp == NULL) { + xc_printf("Unable to find kernel\n"); + HYPERVISOR_shutdown(SHUTDOWN_crash); + } + + /* + * Xen has relocated the metadata and the modules, so + * we need to recalculate it's position. This is done + * by saving the original modulep address and then + * calculating the offset from the real modulep + * position. + */ + metadata = MD_FETCH(kmdp, MODINFOMD_MODULEP, + vm_paddr_t); + off = mod[0].paddr + header->modulep_offset - metadata + + KERNBASE; + } else { + preload_metadata = (caddr_t)(mod[0].paddr + KERNBASE); + + kmdp = preload_search_by_type("elf kernel"); + if (kmdp == NULL) + kmdp = preload_search_by_type("elf64 kernel"); + if (kmdp == NULL) { + xc_printf("Unable to find kernel\n"); + HYPERVISOR_shutdown(SHUTDOWN_crash); + } + + metadata = MD_FETCH(kmdp, MODINFOMD_MODULEP, vm_paddr_t); + off = mod[0].paddr + KERNBASE - metadata; + } preload_bootstrap_relocate(off); From owner-dev-commits-src-branches@freebsd.org Wed Feb 3 14:20:02 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 896FE537C6E; Wed, 3 Feb 2021 14:20: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 4DW3jZ3X8gz4f7N; Wed, 3 Feb 2021 14:20:02 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 6C04D22704; Wed, 3 Feb 2021 14:20:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 113EK2Vn077193; Wed, 3 Feb 2021 14:20:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 113EK2QT077190; Wed, 3 Feb 2021 14:20:02 GMT (envelope-from git) Date: Wed, 3 Feb 2021 14:20:02 GMT Message-Id: <202102031420.113EK2QT077190@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: 18697b446b95 - stable/13 - pf: Improve pf_rule input validation 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: 18697b446b95722808c65b72d793de5975c5ae4b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2021 14:20:02 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=18697b446b95722808c65b72d793de5975c5ae4b commit 18697b446b95722808c65b72d793de5975c5ae4b Author: Kristof Provost AuthorDate: 2021-01-26 07:56:51 +0000 Commit: Kristof Provost CommitDate: 2021-02-03 14:19:52 +0000 pf: Improve pf_rule input validation Move the validation checks to pf_rule_to_krule() to reduce duplication. This also makes the checks consistent across different ioctls. Reported-by: syzbot+e9632d7ad17398f0bd8f@syzkaller.appspotmail.com Reviewed by: tuexen@, donner@ MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28362 (cherry picked from commit 7a808c5ee3296fdb72d8e8bc6c7ad6f316a520ab) --- sys/netpfil/pf/pf_ioctl.c | 72 +++++++++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 60c38a980d1e..644a091808cd 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1557,10 +1557,39 @@ pf_krule_to_rule(const struct pf_krule *krule, struct pf_rule *rule) rule->u_src_nodes = counter_u64_fetch(krule->src_nodes); } -static void +static int pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule) { +#ifndef INET + if (rule->af == AF_INET) { + return (EAFNOSUPPORT); + } +#endif /* INET */ +#ifndef INET6 + if (rule->af == AF_INET6) { + return (EAFNOSUPPORT); + } +#endif /* INET6 */ + + if (rule->src.addr.type != PF_ADDR_ADDRMASK && + rule->src.addr.type != PF_ADDR_DYNIFTL && + rule->src.addr.type != PF_ADDR_TABLE) { + return (EINVAL); + } + if (rule->src.addr.p.dyn != NULL) { + return (EINVAL); + } + + if (rule->dst.addr.type != PF_ADDR_ADDRMASK && + rule->dst.addr.type != PF_ADDR_DYNIFTL && + rule->dst.addr.type != PF_ADDR_TABLE) { + return (EINVAL); + } + if (rule->dst.addr.p.dyn != NULL) { + return (EINVAL); + } + bzero(krule, sizeof(*krule)); bcopy(&rule->src, &krule->src, sizeof(rule->src)); @@ -1641,6 +1670,8 @@ pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule) krule->set_prio[1] = rule->set_prio[1]; bcopy(&rule->divert, &krule->divert, sizeof(krule->divert)); + + return (0); } static int @@ -1815,26 +1846,13 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td error = EINVAL; break; } - if (pr->rule.src.addr.p.dyn != NULL || - pr->rule.dst.addr.p.dyn != NULL) { - error = EINVAL; - break; - } -#ifndef INET - if (pr->rule.af == AF_INET) { - error = EAFNOSUPPORT; - break; - } -#endif /* INET */ -#ifndef INET6 - if (pr->rule.af == AF_INET6) { - error = EAFNOSUPPORT; - break; - } -#endif /* INET6 */ rule = malloc(sizeof(*rule), M_PFRULE, M_WAITOK); - pf_rule_to_krule(&pr->rule, rule); + error = pf_rule_to_krule(&pr->rule, rule); + if (error != 0) { + free(rule, M_PFRULE); + break; + } if (rule->ifname[0]) kif = pf_kkif_create(M_WAITOK); @@ -2090,20 +2108,12 @@ DIOCADDRULE_error: } if (pcr->action != PF_CHANGE_REMOVE) { -#ifndef INET - if (pcr->rule.af == AF_INET) { - error = EAFNOSUPPORT; - break; - } -#endif /* INET */ -#ifndef INET6 - if (pcr->rule.af == AF_INET6) { - error = EAFNOSUPPORT; + newrule = malloc(sizeof(*newrule), M_PFRULE, M_WAITOK); + error = pf_rule_to_krule(&pcr->rule, newrule); + if (error != 0) { + free(newrule, M_PFRULE); break; } -#endif /* INET6 */ - newrule = malloc(sizeof(*newrule), M_PFRULE, M_WAITOK); - pf_rule_to_krule(&pcr->rule, newrule); if (newrule->ifname[0]) kif = pf_kkif_create(M_WAITOK); From owner-dev-commits-src-branches@freebsd.org Wed Feb 3 14:20:10 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B58D25380C2; Wed, 3 Feb 2021 14:20:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DW3jk2fgNz4f1r; Wed, 3 Feb 2021 14:20:09 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CB4F0222E0; Wed, 3 Feb 2021 14:20:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 113EK8O9078374; Wed, 3 Feb 2021 14:20:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 113EK8Ig078372; Wed, 3 Feb 2021 14:20:08 GMT (envelope-from git) Date: Wed, 3 Feb 2021 14:20:08 GMT Message-Id: <202102031420.113EK8Ig078372@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: 71abbe15d01f - stable/12 - pf: Improve pf_rule input validation 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/12 X-Git-Reftype: branch X-Git-Commit: 71abbe15d01f73a4e55a732f21180d339eab631d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2021 14:20:11 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=71abbe15d01f73a4e55a732f21180d339eab631d commit 71abbe15d01f73a4e55a732f21180d339eab631d Author: Kristof Provost AuthorDate: 2021-01-26 07:56:51 +0000 Commit: Kristof Provost CommitDate: 2021-02-03 09:09:14 +0000 pf: Improve pf_rule input validation Move the validation checks to pf_rule_to_krule() to reduce duplication. This also makes the checks consistent across different ioctls. Reported-by: syzbot+e9632d7ad17398f0bd8f@syzkaller.appspotmail.com Reviewed by: tuexen@, donner@ MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28362 (cherry picked from commit 7a808c5ee3296fdb72d8e8bc6c7ad6f316a520ab) --- sys/netpfil/pf/pf_ioctl.c | 72 +++++++++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 48f68fa249e2..bbb9cfe39586 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1558,10 +1558,39 @@ pf_krule_to_rule(const struct pf_krule *krule, struct pf_rule *rule) rule->u_src_nodes = counter_u64_fetch(krule->src_nodes); } -static void +static int pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule) { +#ifndef INET + if (rule->af == AF_INET) { + return (EAFNOSUPPORT); + } +#endif /* INET */ +#ifndef INET6 + if (rule->af == AF_INET6) { + return (EAFNOSUPPORT); + } +#endif /* INET6 */ + + if (rule->src.addr.type != PF_ADDR_ADDRMASK && + rule->src.addr.type != PF_ADDR_DYNIFTL && + rule->src.addr.type != PF_ADDR_TABLE) { + return (EINVAL); + } + if (rule->src.addr.p.dyn != NULL) { + return (EINVAL); + } + + if (rule->dst.addr.type != PF_ADDR_ADDRMASK && + rule->dst.addr.type != PF_ADDR_DYNIFTL && + rule->dst.addr.type != PF_ADDR_TABLE) { + return (EINVAL); + } + if (rule->dst.addr.p.dyn != NULL) { + return (EINVAL); + } + bzero(krule, sizeof(*krule)); bcopy(&rule->src, &krule->src, sizeof(rule->src)); @@ -1642,6 +1671,8 @@ pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule) krule->set_prio[1] = rule->set_prio[1]; bcopy(&rule->divert, &krule->divert, sizeof(krule->divert)); + + return (0); } static int @@ -1816,26 +1847,13 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td error = EINVAL; break; } - if (pr->rule.src.addr.p.dyn != NULL || - pr->rule.dst.addr.p.dyn != NULL) { - error = EINVAL; - break; - } -#ifndef INET - if (pr->rule.af == AF_INET) { - error = EAFNOSUPPORT; - break; - } -#endif /* INET */ -#ifndef INET6 - if (pr->rule.af == AF_INET6) { - error = EAFNOSUPPORT; - break; - } -#endif /* INET6 */ rule = malloc(sizeof(*rule), M_PFRULE, M_WAITOK); - pf_rule_to_krule(&pr->rule, rule); + error = pf_rule_to_krule(&pr->rule, rule); + if (error != 0) { + free(rule, M_PFRULE); + break; + } if (rule->ifname[0]) kif = pf_kkif_create(M_WAITOK); @@ -2092,20 +2110,12 @@ DIOCADDRULE_error: } if (pcr->action != PF_CHANGE_REMOVE) { -#ifndef INET - if (pcr->rule.af == AF_INET) { - error = EAFNOSUPPORT; - break; - } -#endif /* INET */ -#ifndef INET6 - if (pcr->rule.af == AF_INET6) { - error = EAFNOSUPPORT; + newrule = malloc(sizeof(*newrule), M_PFRULE, M_WAITOK); + error = pf_rule_to_krule(&pcr->rule, newrule); + if (error != 0) { + free(newrule, M_PFRULE); break; } -#endif /* INET6 */ - newrule = malloc(sizeof(*newrule), M_PFRULE, M_WAITOK); - pf_rule_to_krule(&pcr->rule, newrule); if (newrule->ifname[0]) kif = pf_kkif_create(M_WAITOK); From owner-dev-commits-src-branches@freebsd.org Wed Feb 3 14:37:25 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C191F53871F; Wed, 3 Feb 2021 14:37: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 4DW45d56Fzz4g0v; Wed, 3 Feb 2021 14:37:25 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A23A922ABC; Wed, 3 Feb 2021 14:37:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 113EbPbS001734; Wed, 3 Feb 2021 14:37:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 113EbPve001733; Wed, 3 Feb 2021 14:37:25 GMT (envelope-from git) Date: Wed, 3 Feb 2021 14:37:25 GMT Message-Id: <202102031437.113EbPve001733@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: 10ed8ab4ab9b - stable/12 - opencrypto: Fix assignment of crypto completions to worker threads 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/12 X-Git-Reftype: branch X-Git-Commit: 10ed8ab4ab9bd0239f2913ac2f35af9b9f76221d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2021 14:37:25 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=10ed8ab4ab9bd0239f2913ac2f35af9b9f76221d commit 10ed8ab4ab9bd0239f2913ac2f35af9b9f76221d Author: Mark Johnston AuthorDate: 2021-01-20 01:34:35 +0000 Commit: Mark Johnston CommitDate: 2021-02-03 14:37:17 +0000 opencrypto: Fix assignment of crypto completions to worker threads Since r336439 we simply take the session pointer value mod the number of worker threads (ncpu by default). On small systems this ends up funneling all completion work through a single thread, which becomes a bottleneck when processing IPSec traffic using hardware crypto drivers. (Software drivers such as aesni(4) are unaffected since they invoke completion handlers synchonously.) Instead, maintain an incrementing counter with a unique value per session, and use that to distribute work to completion threads. Reviewed by: cem, jhb Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D28159 (cherry picked from commit 98d788c867b9e1d7a7e290254443b87ea77d8ab1) --- sys/opencrypto/crypto.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index dfd22662e87f..bc23056e86ad 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -94,6 +94,7 @@ struct crypto_session { void *softc; uint32_t hid; uint32_t capabilities; + uint64_t id; }; SDT_PROVIDER_DEFINE(opencrypto); @@ -572,6 +573,7 @@ again: int crypto_newsession(crypto_session_t *cses, struct cryptoini *cri, int crid) { + static uint64_t sessid = 0; crypto_session_t res; void *softc_mem; struct cryptocap *cap; @@ -616,6 +618,7 @@ restart: softc_mem = malloc(softc_size, M_CRYPTO_DATA, M_WAITOK | M_ZERO); res = uma_zalloc(cryptoses_zone, M_WAITOK | M_ZERO); res->softc = softc_mem; + res->id = atomic_fetchadd_64(&sessid, 1); CRYPTO_DRIVER_LOCK(); cap = crypto_checkdriver(hid); @@ -1016,7 +1019,7 @@ crypto_dispatch(struct cryptop *crp) binuptime(&crp->crp_tstamp); #endif - crp->crp_retw_id = ((uintptr_t)crp->crp_session) % crypto_workers_num; + crp->crp_retw_id = crp->crp_session->id % crypto_workers_num; if (CRYPTOP_ASYNC(crp)) { if (crp->crp_flags & CRYPTO_F_ASYNC_KEEPORDER) { From owner-dev-commits-src-branches@freebsd.org Wed Feb 3 14:37:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CECBD5382EF; Wed, 3 Feb 2021 14:37:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DW4635QBTz4gRK; Wed, 3 Feb 2021 14:37:47 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 ACBC922ABE; Wed, 3 Feb 2021 14:37:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 113EblaC001890; Wed, 3 Feb 2021 14:37:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 113EblbP001889; Wed, 3 Feb 2021 14:37:47 GMT (envelope-from git) Date: Wed, 3 Feb 2021 14:37:47 GMT Message-Id: <202102031437.113EblbP001889@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: 1996360d7338 - stable/13 - qat: Add support for separate AAD and output buffers 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: 1996360d7338db8f12b9bda9572d4e2d85c89170 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2021 14:37:47 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1996360d7338db8f12b9bda9572d4e2d85c89170 commit 1996360d7338db8f12b9bda9572d4e2d85c89170 Author: Mark Johnston AuthorDate: 2021-01-27 20:30:58 +0000 Commit: Mark Johnston CommitDate: 2021-02-03 14:37:41 +0000 qat: Add support for separate AAD and output buffers Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit bd674d8b1fa808dff1afdcb6afc70226077ee78a) --- sys/dev/qat/qat.c | 293 +++++++++++++++++++++++++++++++++++++------------ sys/dev/qat/qat_hw15.c | 20 +++- sys/dev/qat/qat_hw17.c | 22 +++- sys/dev/qat/qatreg.h | 3 + sys/dev/qat/qatvar.h | 43 ++++---- 5 files changed, 281 insertions(+), 100 deletions(-) diff --git a/sys/dev/qat/qat.c b/sys/dev/qat/qat.c index 1e533d1bebcc..acfe0c6a1e07 100644 --- a/sys/dev/qat/qat.c +++ b/sys/dev/qat/qat.c @@ -1172,9 +1172,8 @@ static void qat_crypto_free_sym_cookie(struct qat_crypto_bank *qcb, struct qat_sym_cookie *qsc) { - - explicit_bzero(qsc->qsc_iv_buf, sizeof(qsc->qsc_iv_buf)); - explicit_bzero(qsc->qsc_auth_res, sizeof(qsc->qsc_auth_res)); + explicit_bzero(qsc->qsc_iv_buf, EALG_MAX_BLOCK_LEN); + explicit_bzero(qsc->qsc_auth_res, QAT_SYM_HASH_BUFFER_LEN); mtx_lock(&qcb->qcb_bank_mtx); qcb->qcb_symck_free[qcb->qcb_symck_free_count++] = qsc; @@ -1350,18 +1349,66 @@ struct qat_crypto_load_cb_arg { int error; }; +static int +qat_crypto_populate_buf_list(struct buffer_list_desc *buffers, + bus_dma_segment_t *segs, int niseg, int noseg, int skip) +{ + struct flat_buffer_desc *flatbuf; + bus_addr_t addr; + bus_size_t len; + int iseg, oseg; + + for (iseg = 0, oseg = noseg; iseg < niseg && oseg < QAT_MAXSEG; + iseg++) { + addr = segs[iseg].ds_addr; + len = segs[iseg].ds_len; + + if (skip > 0) { + if (skip < len) { + addr += skip; + len -= skip; + skip = 0; + } else { + skip -= len; + continue; + } + } + + flatbuf = &buffers->flat_bufs[oseg++]; + flatbuf->data_len_in_bytes = (uint32_t)len; + flatbuf->phy_buffer = (uint64_t)addr; + } + buffers->num_buffers = oseg; + return iseg < niseg ? E2BIG : 0; +} + static void -qat_crypto_load_cb(void *_arg, bus_dma_segment_t *segs, int nseg, +qat_crypto_load_aadbuf_cb(void *_arg, bus_dma_segment_t *segs, int nseg, + int error) +{ + struct qat_crypto_load_cb_arg *arg; + struct qat_sym_cookie *qsc; + + arg = _arg; + if (error != 0) { + arg->error = error; + return; + } + + qsc = arg->qsc; + arg->error = qat_crypto_populate_buf_list(&qsc->qsc_buf_list, segs, + nseg, 0, 0); +} + +static void +qat_crypto_load_buf_cb(void *_arg, bus_dma_segment_t *segs, int nseg, int error) { struct cryptop *crp; - struct flat_buffer_desc *flatbuf; struct qat_crypto_load_cb_arg *arg; struct qat_session *qs; struct qat_sym_cookie *qsc; - bus_addr_t addr; - bus_size_t len; - int iseg, oseg, skip; + int noseg, skip; arg = _arg; if (error != 0) { @@ -1374,43 +1421,70 @@ qat_crypto_load_cb(void *_arg, bus_dma_segment_t *segs, int nseg, qsc = arg->qsc; if (qs->qs_auth_algo == HW_AUTH_ALGO_GALOIS_128) { - /* - * The firmware expects AAD to be in a contiguous buffer and - * padded to a multiple of 16 bytes. To satisfy these - * constraints we bounce the AAD into a per-request buffer. - */ - crypto_copydata(crp, crp->crp_aad_start, crp->crp_aad_length, - qsc->qsc_gcm_aad); - memset(qsc->qsc_gcm_aad + crp->crp_aad_length, 0, - roundup2(crp->crp_aad_length, QAT_AES_GCM_AAD_ALIGN) - - crp->crp_aad_length); + /* AAD was handled in qat_crypto_load(). */ skip = crp->crp_payload_start; - } else if (crp->crp_aad_length > 0) { + noseg = 0; + } else if (crp->crp_aad == NULL && crp->crp_aad_length > 0) { skip = crp->crp_aad_start; + noseg = 0; } else { skip = crp->crp_payload_start; + noseg = crp->crp_aad == NULL ? + 0 : qsc->qsc_buf_list.num_buffers; } + arg->error = qat_crypto_populate_buf_list(&qsc->qsc_buf_list, segs, + nseg, noseg, skip); +} - for (iseg = oseg = 0; iseg < nseg; iseg++) { - addr = segs[iseg].ds_addr; - len = segs[iseg].ds_len; +static void +qat_crypto_load_obuf_cb(void *_arg, bus_dma_segment_t *segs, int nseg, + int error) +{ + struct buffer_list_desc *ibufs, *obufs; + struct flat_buffer_desc *ibuf, *obuf; + struct cryptop *crp; + struct qat_crypto_load_cb_arg *arg; + struct qat_session *qs; + struct qat_sym_cookie *qsc; + int buflen, osegs, tocopy; - if (skip > 0) { - if (skip < len) { - addr += skip; - len -= skip; - skip = 0; - } else { - skip -= len; - continue; - } - } + arg = _arg; + if (error != 0) { + arg->error = error; + return; + } - flatbuf = &qsc->qsc_flat_bufs[oseg++]; - flatbuf->data_len_in_bytes = (uint32_t)len; - flatbuf->phy_buffer = (uint64_t)addr; + crp = arg->crp; + qs = arg->qs; + qsc = arg->qsc; + + /* + * The payload must start at the same offset in the output SG list as in + * the input SG list. Copy over SG entries from the input corresponding + * to the AAD buffer. + */ + osegs = 0; + if (qs->qs_auth_algo != HW_AUTH_ALGO_GALOIS_128 && + crp->crp_aad_length > 0) { + tocopy = crp->crp_aad == NULL ? + crp->crp_payload_start - crp->crp_aad_start : + crp->crp_aad_length; + + ibufs = &qsc->qsc_buf_list; + obufs = &qsc->qsc_obuf_list; + for (; osegs < ibufs->num_buffers && tocopy > 0; osegs++) { + ibuf = &ibufs->flat_bufs[osegs]; + obuf = &obufs->flat_bufs[osegs]; + + obuf->phy_buffer = ibuf->phy_buffer; + buflen = imin(ibuf->data_len_in_bytes, tocopy); + obuf->data_len_in_bytes = buflen; + tocopy -= buflen; + } } - qsc->qsc_buf_list.num_buffers = oseg; + + arg->error = qat_crypto_populate_buf_list(&qsc->qsc_obuf_list, segs, + nseg, osegs, crp->crp_payload_output_start); } static int @@ -1426,10 +1500,52 @@ qat_crypto_load(struct qat_session *qs, struct qat_sym_cookie *qsc, arg.qs = qs; arg.qsc = qsc; arg.error = 0; - error = bus_dmamap_load_crp(qsc->qsc_buf_dma_tag, qsc->qsc_buf_dmamap, - crp, qat_crypto_load_cb, &arg, BUS_DMA_NOWAIT); - if (error == 0) - error = arg.error; + + error = 0; + if (qs->qs_auth_algo == HW_AUTH_ALGO_GALOIS_128 && + crp->crp_aad_length > 0) { + /* + * The firmware expects AAD to be in a contiguous buffer and + * padded to a multiple of 16 bytes. To satisfy these + * constraints we bounce the AAD into a per-request buffer. + * There is a small limit on the AAD size so this is not too + * onerous. + */ + memset(qsc->qsc_gcm_aad, 0, QAT_GCM_AAD_SIZE_MAX); + if (crp->crp_aad == NULL) { + crypto_copydata(crp, crp->crp_aad_start, + crp->crp_aad_length, qsc->qsc_gcm_aad); + } else { + memcpy(qsc->qsc_gcm_aad, crp->crp_aad, + crp->crp_aad_length); + } + } else if (crp->crp_aad != NULL) { + error = bus_dmamap_load( + qsc->qsc_dma[QAT_SYM_DMA_AADBUF].qsd_dma_tag, + qsc->qsc_dma[QAT_SYM_DMA_AADBUF].qsd_dmamap, + crp->crp_aad, crp->crp_aad_length, + qat_crypto_load_aadbuf_cb, &arg, BUS_DMA_NOWAIT); + if (error == 0) + error = arg.error; + } + if (error == 0) { + error = bus_dmamap_load_crp_buffer( + qsc->qsc_dma[QAT_SYM_DMA_BUF].qsd_dma_tag, + qsc->qsc_dma[QAT_SYM_DMA_BUF].qsd_dmamap, + &crp->crp_buf, qat_crypto_load_buf_cb, &arg, + BUS_DMA_NOWAIT); + if (error == 0) + error = arg.error; + } + if (error == 0 && CRYPTO_HAS_OUTPUT_BUFFER(crp)) { + error = bus_dmamap_load_crp_buffer( + qsc->qsc_dma[QAT_SYM_DMA_OBUF].qsd_dma_tag, + qsc->qsc_dma[QAT_SYM_DMA_OBUF].qsd_dmamap, + &crp->crp_obuf, qat_crypto_load_obuf_cb, &arg, + BUS_DMA_NOWAIT); + if (error == 0) + error = arg.error; + } return error; } @@ -1444,11 +1560,11 @@ qat_crypto_select_bank(struct qat_crypto *qcy) static int qat_crypto_setup_ring(struct qat_softc *sc, struct qat_crypto_bank *qcb) { - int error, i, bank; - int curname = 0; char *name; + int bank, curname, error, i, j; bank = qcb->qcb_bank; + curname = 0; name = qcb->qcb_ring_names[curname++]; snprintf(name, QAT_RING_NAME_SIZE, "bank%d sym_tx", bank); @@ -1480,10 +1596,16 @@ qat_crypto_setup_ring(struct qat_softc *sc, struct qat_crypto_bank *qcb) qsc->qsc_self_dma_tag = qdm->qdm_dma_tag; qsc->qsc_bulk_req_params_buf_paddr = qdm->qdm_dma_seg.ds_addr + offsetof(struct qat_sym_cookie, - u.qsc_bulk_cookie.qsbc_req_params_buf); + qsc_bulk_cookie.qsbc_req_params_buf); qsc->qsc_buffer_list_desc_paddr = qdm->qdm_dma_seg.ds_addr + offsetof(struct qat_sym_cookie, qsc_buf_list); + qsc->qsc_obuffer_list_desc_paddr = + qdm->qdm_dma_seg.ds_addr + offsetof(struct qat_sym_cookie, + qsc_obuf_list); + qsc->qsc_obuffer_list_desc_paddr = + qdm->qdm_dma_seg.ds_addr + offsetof(struct qat_sym_cookie, + qsc_obuf_list); qsc->qsc_iv_buf_paddr = qdm->qdm_dma_seg.ds_addr + offsetof(struct qat_sym_cookie, qsc_iv_buf); @@ -1499,24 +1621,25 @@ qat_crypto_setup_ring(struct qat_softc *sc, struct qat_crypto_bank *qcb) qcb->qcb_symck_free[i] = qsc; qcb->qcb_symck_free_count++; - error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), - 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - QAT_MAXLEN, /* maxsize */ - QAT_MAXSEG, /* nsegments */ - QAT_MAXLEN, /* maxsegsize */ - BUS_DMA_COHERENT, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &qsc->qsc_buf_dma_tag); - if (error != 0) - return error; - - error = bus_dmamap_create(qsc->qsc_buf_dma_tag, - BUS_DMA_COHERENT, &qsc->qsc_buf_dmamap); - if (error) - return error; + for (j = 0; j < QAT_SYM_DMA_COUNT; j++) { + error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), + 1, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + QAT_MAXLEN, /* maxsize */ + QAT_MAXSEG, /* nsegments */ + QAT_MAXLEN, /* maxsegsize */ + BUS_DMA_COHERENT, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &qsc->qsc_dma[j].qsd_dma_tag); + if (error != 0) + return error; + error = bus_dmamap_create(qsc->qsc_dma[j].qsd_dma_tag, + BUS_DMA_COHERENT, &qsc->qsc_dma[j].qsd_dmamap); + if (error != 0) + return error; + } } return 0; @@ -1534,10 +1657,17 @@ static void qat_crypto_bank_deinit(struct qat_softc *sc, struct qat_crypto_bank *qcb) { struct qat_dmamem *qdm; - int i; + struct qat_sym_cookie *qsc; + int i, j; for (i = 0; i < QAT_NSYMCOOKIE; i++) { qdm = &qcb->qcb_symck_dmamems[i]; + qsc = qcb->qcb_symck_free[i]; + for (j = 0; j < QAT_SYM_DMA_COUNT; j++) { + bus_dmamap_destroy(qsc->qsc_dma[j].qsd_dma_tag, + qsc->qsc_dma[j].qsd_dmamap); + bus_dma_tag_destroy(qsc->qsc_dma[j].qsd_dma_tag); + } qat_free_dmamem(sc, qdm); } qat_free_dmamem(sc, &qcb->qcb_sym_tx->qr_dma); @@ -1653,6 +1783,15 @@ qat_crypto_stop(struct qat_softc *sc) (void)crypto_unregister_all(qcy->qcy_cid); } +static void +qat_crypto_sym_dma_unload(struct qat_sym_cookie *qsc, enum qat_sym_dma i) +{ + bus_dmamap_sync(qsc->qsc_dma[i].qsd_dma_tag, qsc->qsc_dma[i].qsd_dmamap, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(qsc->qsc_dma[i].qsd_dma_tag, + qsc->qsc_dma[i].qsd_dmamap); +} + static int qat_crypto_sym_rxintr(struct qat_softc *sc, void *arg, void *msg) { @@ -1669,16 +1808,19 @@ qat_crypto_sym_rxintr(struct qat_softc *sc, void *arg, void *msg) qsc = *(void **)((uintptr_t)msg + sc->sc_hw.qhw_crypto_opaque_offset); - qsbc = &qsc->u.qsc_bulk_cookie; + qsbc = &qsc->qsc_bulk_cookie; qcy = qsbc->qsbc_crypto; qs = qsbc->qsbc_session; crp = qsbc->qsbc_cb_tag; bus_dmamap_sync(qsc->qsc_self_dma_tag, qsc->qsc_self_dmamap, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - bus_dmamap_sync(qsc->qsc_buf_dma_tag, qsc->qsc_buf_dmamap, - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(qsc->qsc_buf_dma_tag, qsc->qsc_buf_dmamap); + + if (crp->crp_aad != NULL) + qat_crypto_sym_dma_unload(qsc, QAT_SYM_DMA_AADBUF); + qat_crypto_sym_dma_unload(qsc, QAT_SYM_DMA_BUF); + if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) + qat_crypto_sym_dma_unload(qsc, QAT_SYM_DMA_OBUF); error = 0; if ((auth_sz = qs->qs_auth_mlen) != 0) { @@ -1719,6 +1861,10 @@ qat_crypto_sym_rxintr(struct qat_softc *sc, void *arg, void *msg) static int qat_probesession(device_t dev, const struct crypto_session_params *csp) { + if ((csp->csp_flags & ~(CSP_F_SEPARATE_OUTPUT | CSP_F_SEPARATE_AAD)) != + 0) + return EINVAL; + if (csp->csp_cipher_alg == CRYPTO_AES_XTS && qat_lookup(dev)->qatp_chip == QAT_CHIP_C2XXX) { /* @@ -2092,15 +2238,26 @@ qat_process(device_t dev, struct cryptop *crp, int hint) if (error != 0) goto fail2; - qsbc = &qsc->u.qsc_bulk_cookie; + qsbc = &qsc->qsc_bulk_cookie; qsbc->qsbc_crypto = qcy; qsbc->qsbc_session = qs; qsbc->qsbc_cb_tag = crp; sc->sc_hw.qhw_crypto_setup_req_params(qcb, qs, desc, qsc, crp); - bus_dmamap_sync(qsc->qsc_buf_dma_tag, qsc->qsc_buf_dmamap, + if (crp->crp_aad != NULL) { + bus_dmamap_sync(qsc->qsc_dma[QAT_SYM_DMA_AADBUF].qsd_dma_tag, + qsc->qsc_dma[QAT_SYM_DMA_AADBUF].qsd_dmamap, + BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); + } + bus_dmamap_sync(qsc->qsc_dma[QAT_SYM_DMA_BUF].qsd_dma_tag, + qsc->qsc_dma[QAT_SYM_DMA_BUF].qsd_dmamap, BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); + if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { + bus_dmamap_sync(qsc->qsc_dma[QAT_SYM_DMA_OBUF].qsd_dma_tag, + qsc->qsc_dma[QAT_SYM_DMA_OBUF].qsd_dmamap, + BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); + } bus_dmamap_sync(qsc->qsc_self_dma_tag, qsc->qsc_self_dmamap, BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); diff --git a/sys/dev/qat/qat_hw15.c b/sys/dev/qat/qat_hw15.c index 4f823a0a9ae4..aab5be9b647d 100644 --- a/sys/dev/qat/qat_hw15.c +++ b/sys/dev/qat/qat_hw15.c @@ -818,7 +818,7 @@ qat_hw15_crypto_setup_req_params(struct qat_crypto_bank *qcb, enum fw_la_cmd_id cmd_id = desc->qcd_cmd_id; enum fw_slice next_slice; - qsbc = &qsc->u.qsc_bulk_cookie; + qsbc = &qsc->qsc_bulk_cookie; bulk_req = (struct fw_la_bulk_req *)qsbc->qsbc_msg; memcpy(bulk_req, &desc->qcd_req_cache, QAT_HW15_SESSION_REQ_CACHE_SIZE); @@ -826,7 +826,13 @@ qat_hw15_crypto_setup_req_params(struct qat_crypto_bank *qcb, bulk_req->comn_hdr.comn_req_flags = qat_hw15_get_comn_req_flags(qcb->qcb_bank % 2); bulk_req->comn_mid.src_data_addr = qsc->qsc_buffer_list_desc_paddr; - bulk_req->comn_mid.dest_data_addr = qsc->qsc_buffer_list_desc_paddr; + if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { + bulk_req->comn_mid.dest_data_addr = + qsc->qsc_obuffer_list_desc_paddr; + } else { + bulk_req->comn_mid.dest_data_addr = + qsc->qsc_buffer_list_desc_paddr; + } bulk_req->req_params_addr = qsc->qsc_bulk_req_params_buf_paddr; bulk_req->comn_ftr.next_request_addr = 0; bulk_req->comn_mid.opaque_data = (uint64_t)(uintptr_t)qsc; @@ -918,8 +924,14 @@ qat_hw15_crypto_setup_req_params(struct qat_crypto_bank *qcb, cipher_req->curr_id = FW_SLICE_CIPHER; cipher_req->next_id = next_slice; - cipher_req->cipher_off = crp->crp_aad_length == 0 ? 0 : - crp->crp_payload_start - crp->crp_aad_start; + if (crp->crp_aad_length == 0) { + cipher_req->cipher_off = 0; + } else if (crp->crp_aad == NULL) { + cipher_req->cipher_off = + crp->crp_payload_start - crp->crp_aad_start; + } else { + cipher_req->cipher_off = crp->crp_aad_length; + } cipher_req->cipher_len = crp->crp_payload_length; cipher_req->state_address = qsc->qsc_iv_buf_paddr; } diff --git a/sys/dev/qat/qat_hw17.c b/sys/dev/qat/qat_hw17.c index 643b624ba840..92f2c1ee251d 100644 --- a/sys/dev/qat/qat_hw17.c +++ b/sys/dev/qat/qat_hw17.c @@ -581,13 +581,19 @@ qat_hw17_crypto_setup_req_params(struct qat_crypto_bank *qcb __unused, uint8_t *req_params_ptr; enum fw_la_cmd_id cmd_id = desc->qcd_cmd_id; - qsbc = &qsc->u.qsc_bulk_cookie; + qsbc = &qsc->qsc_bulk_cookie; bulk_req = (struct fw_la_bulk_req *)qsbc->qsbc_msg; memcpy(bulk_req, desc->qcd_req_cache, sizeof(struct fw_la_bulk_req)); bulk_req->comn_mid.opaque_data = (uint64_t)(uintptr_t)qsc; bulk_req->comn_mid.src_data_addr = qsc->qsc_buffer_list_desc_paddr; - bulk_req->comn_mid.dest_data_addr = qsc->qsc_buffer_list_desc_paddr; + if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { + bulk_req->comn_mid.dest_data_addr = + qsc->qsc_obuffer_list_desc_paddr; + } else { + bulk_req->comn_mid.dest_data_addr = + qsc->qsc_buffer_list_desc_paddr; + } if (__predict_false(crp->crp_cipher_key != NULL || crp->crp_auth_key != NULL)) qat_hw17_crypto_req_setkey(desc, qs, qsc, bulk_req, crp); @@ -643,9 +649,15 @@ qat_hw17_crypto_setup_req_params(struct qat_crypto_bank *qcb __unused, } } else { if (cmd_id != FW_LA_CMD_AUTH) { - cipher_param->cipher_offset = - crp->crp_aad_length == 0 ? 0 : - crp->crp_payload_start - crp->crp_aad_start; + if (crp->crp_aad_length == 0) { + cipher_param->cipher_offset = 0; + } else if (crp->crp_aad == NULL) { + cipher_param->cipher_offset = + crp->crp_payload_start - crp->crp_aad_start; + } else { + cipher_param->cipher_offset = + crp->crp_aad_length; + } cipher_param->cipher_length = crp->crp_payload_length; } if (cmd_id != FW_LA_CMD_CIPHER) { diff --git a/sys/dev/qat/qatreg.h b/sys/dev/qat/qatreg.h index 2a0be321b4f9..076354fc6108 100644 --- a/sys/dev/qat/qatreg.h +++ b/sys/dev/qat/qatreg.h @@ -1550,10 +1550,13 @@ struct flat_buffer_desc { uint64_t phy_buffer; }; +#define HW_MAXSEG 32 + struct buffer_list_desc { uint64_t resrvd; uint32_t num_buffers; uint32_t reserved; + struct flat_buffer_desc flat_bufs[HW_MAXSEG]; }; /* -------------------------------------------------------------------------- */ diff --git a/sys/dev/qat/qatvar.h b/sys/dev/qat/qatvar.h index 3326dc268fc1..3f0ecd411874 100644 --- a/sys/dev/qat/qatvar.h +++ b/sys/dev/qat/qatvar.h @@ -69,13 +69,11 @@ #define QAT_NSYMREQ 256 #define QAT_NSYMCOOKIE ((QAT_NSYMREQ * 2 + 1) * 2) -#define QAT_NASYMREQ 64 -#define QAT_BATCH_SUBMIT_FREE_SPACE 2 #define QAT_EV_NAME_SIZE 32 #define QAT_RING_NAME_SIZE 32 -#define QAT_MAXSEG 32 /* max segments for sg dma */ +#define QAT_MAXSEG HW_MAXSEG /* max segments for sg dma */ #define QAT_MAXLEN 65535 /* IP_MAXPACKET */ #define QAT_HB_INTERVAL 500 /* heartbeat msec */ @@ -519,7 +517,7 @@ struct qat_sym_hash_def { struct qat_sym_bulk_cookie { uint8_t qsbc_req_params_buf[QAT_SYM_REQ_PARAMS_SIZE_PADDED]; - /* memory block reserved for request params + /* memory block reserved for request params, QAT 1.5 only * NOTE: Field must be correctly aligned in memory for access by QAT * engine */ struct qat_crypto *qsbc_crypto; @@ -539,25 +537,26 @@ struct qat_sym_bulk_cookie { HASH_CONTENT_DESC_SIZE + CIPHER_CONTENT_DESC_SIZE, \ QAT_OPTIMAL_ALIGN) +enum qat_sym_dma { + QAT_SYM_DMA_AADBUF = 0, + QAT_SYM_DMA_BUF, + QAT_SYM_DMA_OBUF, + QAT_SYM_DMA_COUNT, +}; + +struct qat_sym_dmamap { + bus_dmamap_t qsd_dmamap; + bus_dma_tag_t qsd_dma_tag; +}; + struct qat_sym_cookie { - union qat_sym_cookie_u { - /* should be 64byte aligned */ - struct qat_sym_bulk_cookie qsc_bulk_cookie; - /* symmetric bulk cookie */ -#ifdef notyet - struct qat_sym_key_cookie qsc_key_cookie; - /* symmetric key cookie */ - struct qat_sym_nrbg_cookie qsc_nrbg_cookie; - /* symmetric NRBG cookie */ -#endif - } u; + struct qat_sym_bulk_cookie qsc_bulk_cookie; /* should be 64-byte aligned */ struct buffer_list_desc qsc_buf_list; - struct flat_buffer_desc qsc_flat_bufs[QAT_MAXSEG]; /* should be here */ + struct buffer_list_desc qsc_obuf_list; - bus_dmamap_t qsc_self_dmamap; /* self DMA mapping and - end of DMA region */ + bus_dmamap_t qsc_self_dmamap; bus_dma_tag_t qsc_self_dma_tag; uint8_t qsc_iv_buf[EALG_MAX_BLOCK_LEN]; @@ -565,12 +564,11 @@ struct qat_sym_cookie { uint8_t qsc_gcm_aad[QAT_GCM_AAD_SIZE_MAX]; uint8_t qsc_content_desc[CONTENT_DESC_MAX_SIZE]; - bus_dmamap_t qsc_buf_dmamap; /* qsc_flat_bufs DMA mapping */ - bus_dma_tag_t qsc_buf_dma_tag; - void *qsc_buf; + struct qat_sym_dmamap qsc_dma[QAT_SYM_DMA_COUNT]; bus_addr_t qsc_bulk_req_params_buf_paddr; bus_addr_t qsc_buffer_list_desc_paddr; + bus_addr_t qsc_obuffer_list_desc_paddr; bus_addr_t qsc_iv_buf_paddr; bus_addr_t qsc_auth_res_paddr; bus_addr_t qsc_gcm_aad_paddr; @@ -578,7 +576,7 @@ struct qat_sym_cookie { }; CTASSERT(offsetof(struct qat_sym_cookie, - u.qsc_bulk_cookie.qsbc_req_params_buf) % QAT_OPTIMAL_ALIGN == 0); + qsc_bulk_cookie.qsbc_req_params_buf) % QAT_OPTIMAL_ALIGN == 0); CTASSERT(offsetof(struct qat_sym_cookie, qsc_buf_list) % QAT_OPTIMAL_ALIGN == 0); #define MAX_CIPHER_SETUP_BLK_SZ \ @@ -614,7 +612,6 @@ struct qat_crypto_desc { uint8_t qcd_req_cache[QAT_MSG_SIZE_TO_BYTES(QAT_MAX_MSG_SIZE)]; } __aligned(QAT_OPTIMAL_ALIGN); -/* should be aligned to 64bytes */ struct qat_session { struct qat_crypto_desc *qs_dec_desc; /* should be at top of struct*/ /* decrypt or auth then decrypt or auth */ From owner-dev-commits-src-branches@freebsd.org Wed Feb 3 15:06:33 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C7D45539809; Wed, 3 Feb 2021 15:06:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-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 4DW4lF5MQrz4jJB; Wed, 3 Feb 2021 15:06:33 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AB18723019; Wed, 3 Feb 2021 15:06:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 113F6XTx040780; Wed, 3 Feb 2021 15:06:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 113F6XJV040779; Wed, 3 Feb 2021 15:06:33 GMT (envelope-from git) Date: Wed, 3 Feb 2021 15:06:33 GMT Message-Id: <202102031506.113F6XJV040779@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Li-Wen Hsu Subject: git: 928d45ccff73 - stable/12 - newvers: tweak uname to be more useful MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 928d45ccff730177581977eafcd1622a1923eb80 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2021 15:06:33 -0000 The branch stable/12 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=928d45ccff730177581977eafcd1622a1923eb80 commit 928d45ccff730177581977eafcd1622a1923eb80 Author: Warner Losh AuthorDate: 2021-01-25 19:53:31 +0000 Commit: Li-Wen Hsu CommitDate: 2021-02-03 15:00:44 +0000 newvers: tweak uname to be more useful The current uname is branch-cXXXX-gHASH Three changes to make uname more useful. 1. Move from using git rev-list --count to git rev-lis --count --first-parent since that gives a better, incrementing number. 2. Report this count as 'nXXXXX' rather than 'cXXXXX' because c is part of a hash and we've changed the sematnics of XXXXX 3. Remove g to make HASH cut and pastable. Durting review, #1 & #3 had the largest consensus. There was a diversity of opinion on #2, but on the whole it was positive so I'll acknowledge the dissent, but move forward with something seems to have support since the dissent was all about what letter to use where I chose 'n'. MFC After: 3 days Reviewed by: rgrimes, emaste (earlier version) Differential Revision: https://reviews.freebsd.org/D28338 (cherry picked from commit 8a51f14a7833fd14e1f125e63a0af9d260dcd287) --- sys/conf/newvers.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 48f778ed1223..22ef8dd1ac33 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -211,9 +211,9 @@ fi if [ -n "$git_cmd" ] ; then git=$($git_cmd rev-parse --verify --short HEAD 2>/dev/null) - git_cnt=$($git_cmd rev-list --count HEAD 2>/dev/null) + git_cnt=$($git_cmd rev-list --first-parent --count HEAD 2>/dev/null) if [ -n "$git_cnt" ] ; then - git="c${git_cnt}-g${git}" + git="n${git_cnt}-${git}" fi git_b=$($git_cmd rev-parse --abbrev-ref HEAD) if [ -n "$git_b" -a "$git_b" != "HEAD" ] ; then From owner-dev-commits-src-branches@freebsd.org Wed Feb 3 15:06:44 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 874DB53980F; Wed, 3 Feb 2021 15:06: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 4DW4lR5ntZz4jWw; Wed, 3 Feb 2021 15:06:42 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 864E022D54; Wed, 3 Feb 2021 15:06:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 113F6fl0040901; Wed, 3 Feb 2021 15:06:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 113F6fd3040900; Wed, 3 Feb 2021 15:06:41 GMT (envelope-from git) Date: Wed, 3 Feb 2021 15:06:41 GMT Message-Id: <202102031506.113F6fd3040900@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Li-Wen Hsu Subject: git: 3c1d72efd751 - stable/11 - newvers: tweak uname to be more useful MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 3c1d72efd7518bde6d96c6470efc85252fa8e64d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2021 15:06:44 -0000 The branch stable/11 has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=3c1d72efd7518bde6d96c6470efc85252fa8e64d commit 3c1d72efd7518bde6d96c6470efc85252fa8e64d Author: Warner Losh AuthorDate: 2021-01-25 19:53:31 +0000 Commit: Li-Wen Hsu CommitDate: 2021-02-03 15:01:51 +0000 newvers: tweak uname to be more useful The current uname is branch-cXXXX-gHASH Three changes to make uname more useful. 1. Move from using git rev-list --count to git rev-lis --count --first-parent since that gives a better, incrementing number. 2. Report this count as 'nXXXXX' rather than 'cXXXXX' because c is part of a hash and we've changed the sematnics of XXXXX 3. Remove g to make HASH cut and pastable. Durting review, #1 & #3 had the largest consensus. There was a diversity of opinion on #2, but on the whole it was positive so I'll acknowledge the dissent, but move forward with something seems to have support since the dissent was all about what letter to use where I chose 'n'. MFC After: 3 days Reviewed by: rgrimes, emaste (earlier version) Differential Revision: https://reviews.freebsd.org/D28338 (cherry picked from commit 8a51f14a7833fd14e1f125e63a0af9d260dcd287) --- sys/conf/newvers.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 9b7a1c19991a..e3c54f1649fb 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -213,9 +213,9 @@ fi if [ -n "$git_cmd" ] ; then git=$($git_cmd rev-parse --verify --short HEAD 2>/dev/null) - git_cnt=$($git_cmd rev-list --count HEAD 2>/dev/null) + git_cnt=$($git_cmd rev-list --first-parent --count HEAD 2>/dev/null) if [ -n "$git_cnt" ] ; then - git="c${git_cnt}-g${git}" + git="n${git_cnt}-${git}" fi git_b=$($git_cmd rev-parse --abbrev-ref HEAD) if [ -n "$git_b" -a "$git_b" != "HEAD" ] ; then From owner-dev-commits-src-branches@freebsd.org Wed Feb 3 19:39:57 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF34B5292C2; Wed, 3 Feb 2021 19:39:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWBpj5YYjz3NW0; Wed, 3 Feb 2021 19:39:57 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B1822268B5; Wed, 3 Feb 2021 19:39:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 113JdvdQ093283; Wed, 3 Feb 2021 19:39:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 113JdvYB093282; Wed, 3 Feb 2021 19:39:57 GMT (envelope-from git) Date: Wed, 3 Feb 2021 19:39:57 GMT Message-Id: <202102031939.113JdvYB093282@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 8a680912a190 - stable/13 - Revert "Reimplement strlen" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8a680912a190d619be6194f88917052eed327f7b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2021 19:39:57 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=8a680912a190d619be6194f88917052eed327f7b commit 8a680912a190d619be6194f88917052eed327f7b Author: Mateusz Guzik AuthorDate: 2021-02-03 19:38:10 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-03 19:39:49 +0000 Revert "Reimplement strlen" This reverts commit 710e45c4b8539d028877769f1a4ec088c48fb5f1. It breaks for some corner cases on big endian ppc64. Given the stage of the release process it is best to revert for now. Reported by: jhibbits (cherry picked from commit 33f0540b13d949c7cc226a79927ddc2062ff98bf) --- lib/libc/string/strlen.c | 82 +++++++++++++++++++++++++++++++----------------- sys/libkern/strlen.c | 79 +++++++++++++++++++++++++++++++--------------- 2 files changed, 108 insertions(+), 53 deletions(-) diff --git a/lib/libc/string/strlen.c b/lib/libc/string/strlen.c index 0bdc81d7bb9a..a862ffc245ca 100644 --- a/lib/libc/string/strlen.c +++ b/lib/libc/string/strlen.c @@ -35,6 +35,10 @@ __FBSDID("$FreeBSD$"); /* * Portable strlen() for 32-bit and 64-bit systems. * + * Rationale: it is generally much more efficient to do word length + * operations and avoid branches on modern computer systems, as + * compared to byte-length operations with a lot of branches. + * * The expression: * * ((x - 0x01....01) & ~x & 0x80....80) @@ -42,13 +46,18 @@ __FBSDID("$FreeBSD$"); * would evaluate to a non-zero value iff any of the bytes in the * original word is zero. * + * On multi-issue processors, we can divide the above expression into: + * a) (x - 0x01....01) + * b) (~x & 0x80....80) + * c) a & b + * + * Where, a) and b) can be partially computed in parallel. + * * The algorithm above is found on "Hacker's Delight" by * Henry S. Warren, Jr. - * - * Note: this leaves performance on the table and each architecture - * would be best served with a tailor made routine instead. */ +/* Magic numbers for the algorithm */ #if LONG_BIT == 32 static const unsigned long mask01 = 0x01010101; static const unsigned long mask80 = 0x80808080; @@ -61,45 +70,62 @@ static const unsigned long mask80 = 0x8080808080808080; #define LONGPTR_MASK (sizeof(long) - 1) -#if BYTE_ORDER == LITTLE_ENDIAN -#define FINDZERO __builtin_ctzl -#else -#define FINDZERO __builtin_clzl -#endif +/* + * Helper macro to return string length if we caught the zero + * byte. + */ +#define testbyte(x) \ + do { \ + if (p[x] == '\0') \ + return (p - str + x); \ + } while (0) size_t strlen(const char *str) { + const char *p; const unsigned long *lp; - unsigned long mask; long va, vb; - long val; - lp = (unsigned long *) (uintptr_t) str; - if ((uintptr_t)lp & LONGPTR_MASK) { - lp = (__typeof(lp)) ((uintptr_t)lp & ~LONGPTR_MASK); -#if BYTE_ORDER == LITTLE_ENDIAN - mask = ~(~0UL << (((uintptr_t)str & LONGPTR_MASK) << 3)); -#else - mask = ~(~0UL >> (((uintptr_t)str & LONGPTR_MASK) << 3)); -#endif - val = *lp | mask; - va = (val - mask01); - vb = ((~val) & mask80); - if (va & vb) { - return ((const char *)lp - str + (FINDZERO(va & vb) >> 3)); - } - lp++; - } + /* + * Before trying the hard (unaligned byte-by-byte access) way + * to figure out whether there is a nul character, try to see + * if there is a nul character is within this accessible word + * first. + * + * p and (p & ~LONGPTR_MASK) must be equally accessible since + * they always fall in the same memory page, as long as page + * boundaries is integral multiple of word size. + */ + lp = (const unsigned long *)((uintptr_t)str & ~LONGPTR_MASK); + va = (*lp - mask01); + vb = ((~*lp) & mask80); + lp++; + if (va & vb) + /* Check if we have \0 in the first part */ + for (p = str; p < (const char *)lp; p++) + if (*p == '\0') + return (p - str); + /* Scan the rest of the string using word sized operation */ for (; ; lp++) { va = (*lp - mask01); vb = ((~*lp) & mask80); if (va & vb) { - return ((const char *)lp - str + (FINDZERO(va & vb) >> 3)); + p = (const char *)(lp); + testbyte(0); + testbyte(1); + testbyte(2); + testbyte(3); +#if (LONG_BIT >= 64) + testbyte(4); + testbyte(5); + testbyte(6); + testbyte(7); +#endif } } - __builtin_unreachable(); + /* NOTREACHED */ return (0); } diff --git a/sys/libkern/strlen.c b/sys/libkern/strlen.c index 8fa5f3927ea9..a8c7964f69a3 100644 --- a/sys/libkern/strlen.c +++ b/sys/libkern/strlen.c @@ -34,6 +34,10 @@ __FBSDID("$FreeBSD$"); /* * Portable strlen() for 32-bit and 64-bit systems. * + * Rationale: it is generally much more efficient to do word length + * operations and avoid branches on modern computer systems, as + * compared to byte-length operations with a lot of branches. + * * The expression: * * ((x - 0x01....01) & ~x & 0x80....80) @@ -41,10 +45,18 @@ __FBSDID("$FreeBSD$"); * would evaluate to a non-zero value iff any of the bytes in the * original word is zero. * + * On multi-issue processors, we can divide the above expression into: + * a) (x - 0x01....01) + * b) (~x & 0x80....80) + * c) a & b + * + * Where, a) and b) can be partially computed in parallel. + * * The algorithm above is found on "Hacker's Delight" by * Henry S. Warren, Jr. */ +/* Magic numbers for the algorithm */ #if LONG_BIT == 32 static const unsigned long mask01 = 0x01010101; static const unsigned long mask80 = 0x80808080; @@ -57,45 +69,62 @@ static const unsigned long mask80 = 0x8080808080808080; #define LONGPTR_MASK (sizeof(long) - 1) -#if BYTE_ORDER == LITTLE_ENDIAN -#define FINDZERO __builtin_ctzl -#else -#define FINDZERO __builtin_clzl -#endif +/* + * Helper macro to return string length if we caught the zero + * byte. + */ +#define testbyte(x) \ + do { \ + if (p[x] == '\0') \ + return (p - str + x); \ + } while (0) size_t (strlen)(const char *str) { + const char *p; const unsigned long *lp; - unsigned long mask; long va, vb; - long val; - lp = (unsigned long *) (uintptr_t) str; - if ((uintptr_t)lp & LONGPTR_MASK) { - lp = (__typeof(lp)) ((uintptr_t)lp & ~LONGPTR_MASK); -#if BYTE_ORDER == LITTLE_ENDIAN - mask = ~(~0UL << (((uintptr_t)str & LONGPTR_MASK) << 3)); -#else - mask = ~(~0UL >> (((uintptr_t)str & LONGPTR_MASK) << 3)); -#endif - val = *lp | mask; - va = (val - mask01); - vb = ((~val) & mask80); - if (va & vb) { - return ((const char *)lp - str + (FINDZERO(va & vb) >> 3)); - } - lp++; - } + /* + * Before trying the hard (unaligned byte-by-byte access) way + * to figure out whether there is a nul character, try to see + * if there is a nul character is within this accessible word + * first. + * + * p and (p & ~LONGPTR_MASK) must be equally accessible since + * they always fall in the same memory page, as long as page + * boundaries is integral multiple of word size. + */ + lp = (const unsigned long *)((uintptr_t)str & ~LONGPTR_MASK); + va = (*lp - mask01); + vb = ((~*lp) & mask80); + lp++; + if (va & vb) + /* Check if we have \0 in the first part */ + for (p = str; p < (const char *)lp; p++) + if (*p == '\0') + return (p - str); + /* Scan the rest of the string using word sized operation */ for (; ; lp++) { va = (*lp - mask01); vb = ((~*lp) & mask80); if (va & vb) { - return ((const char *)lp - str + (FINDZERO(va & vb) >> 3)); + p = (const char *)(lp); + testbyte(0); + testbyte(1); + testbyte(2); + testbyte(3); +#if (LONG_BIT >= 64) + testbyte(4); + testbyte(5); + testbyte(6); + testbyte(7); +#endif } } - __builtin_unreachable(); + /* NOTREACHED */ return (0); } From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 02:31:57 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3C75534165; Thu, 4 Feb 2021 02:31: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 4DWMy54H2cz4fFY; Thu, 4 Feb 2021 02:31:57 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 854DC2BF90; Thu, 4 Feb 2021 02:31:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1142VvoB040070; Thu, 4 Feb 2021 02:31:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1142VvLK040069; Thu, 4 Feb 2021 02:31:57 GMT (envelope-from git) Date: Thu, 4 Feb 2021 02:31:57 GMT Message-Id: <202102040231.1142VvLK040069@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: bf96a6c762a7 - stable/12 - Remove FirstBurstLength limit for software iSCSI. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: bf96a6c762a79d974bd71322cd37e23984e0f3f3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 02:31:57 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=bf96a6c762a79d974bd71322cd37e23984e0f3f3 commit bf96a6c762a79d974bd71322cd37e23984e0f3f3 Author: Alexander Motin AuthorDate: 2021-01-21 02:33:14 +0000 Commit: Alexander Motin CommitDate: 2021-02-04 02:31:54 +0000 Remove FirstBurstLength limit for software iSCSI. For hardware offload solicited data may potentially be handled more efficiently than unsolicited due to direct data placement. Or there can be some unsolicited write buffering limitations. It may create situations where FirstBurstLength limit is really useful. Software driver though has no those factors, having to do memcopy() any way and having no so hard limit on the temporary storage. Same time more active use of unsolicited transfers allows to avoid some of Ready To Transfer (R2T) PDU round-trip times and processing. This change effectively doubles from 64KB to 128KB the maximum size of write command that can be transferred within one link RTT. Tests of (64KB, 128KB] QD1 writes mixed with simultaneous QD8 reads over the same connection, increasing RTT, shows almost double write speed and half latency, while we should be able to afford few megabytes of RAM for additional buffering on a target these days. Sponsored by: iXsystems, Inc. (cherry picked from commit ff751ee05c939eceab25c26ad60b1d56f989aec9) --- sys/dev/iscsi/icl_soft.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c index a9b787a25420..dd9210642ffa 100644 --- a/sys/dev/iscsi/icl_soft.c +++ b/sys/dev/iscsi/icl_soft.c @@ -1454,7 +1454,7 @@ icl_soft_limits(struct icl_drv_limits *idl) idl->idl_max_recv_data_segment_length = 128 * 1024; idl->idl_max_send_data_segment_length = 128 * 1024; idl->idl_max_burst_length = 262144; - idl->idl_first_burst_length = 65536; + idl->idl_first_burst_length = idl->idl_max_burst_length; return (0); } From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 02:56:09 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 81CE253494F; Thu, 4 Feb 2021 02:56: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 4DWNV13KHLz4ggM; Thu, 4 Feb 2021 02:56:09 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 609B12C536; Thu, 4 Feb 2021 02:56:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1142u9Zx067038; Thu, 4 Feb 2021 02:56:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1142u9pA067037; Thu, 4 Feb 2021 02:56:09 GMT (envelope-from git) Date: Thu, 4 Feb 2021 02:56:09 GMT Message-Id: <202102040256.1142u9pA067037@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 1535f6701704 - stable/13 - ofed: fix the WITH_OFED_EXTRA build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1535f6701704ef5bc58768490b05cbf0b0958671 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 02:56:09 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=1535f6701704ef5bc58768490b05cbf0b0958671 commit 1535f6701704ef5bc58768490b05cbf0b0958671 Author: Kyle Evans AuthorDate: 2021-01-30 05:48:28 +0000 Commit: Kyle Evans CommitDate: 2021-02-04 02:55:56 +0000 ofed: fix the WITH_OFED_EXTRA build This option was not tested when WARNS was globally lifted in the src tree up to 6. Drop WARNS back down to unbreak the build; note that this is still enabling more warnings than it had before the WARNS change, so the gcc build may need to be independently evaluated at this level. PR: 252865 (cherry picked from commit 9ca71db4959f674d75f7b4fd0f72bdc1e2e99abb) --- usr.bin/ofed/opensm/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.bin/ofed/opensm/Makefile b/usr.bin/ofed/opensm/Makefile index 2c1f504dc191..738b6ace31a1 100644 --- a/usr.bin/ofed/opensm/Makefile +++ b/usr.bin/ofed/opensm/Makefile @@ -99,4 +99,6 @@ CFLAGS+= -I${_spath:H} -DHAVE_CONFIG_H=1 CFLAGS+= -I${SYSROOT:U${DESTDIR}}/${INCLUDEDIR}/infiniband LIBADD= opensm osmvendor osmcomp wrap pthread +WARNS?= 2 + .include From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 02:56:10 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 98D0C534950; Thu, 4 Feb 2021 02:56:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWNV240Nhz4gRQ; Thu, 4 Feb 2021 02:56:10 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7A7022C2B8; Thu, 4 Feb 2021 02:56:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1142uA6r067057; Thu, 4 Feb 2021 02:56:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1142uAJa067056; Thu, 4 Feb 2021 02:56:10 GMT (envelope-from git) Date: Thu, 4 Feb 2021 02:56:10 GMT Message-Id: <202102040256.1142uAJa067056@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: f31de79df28a - stable/13 - kerberos5: fix the WITH_OPENLDAP build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f31de79df28a75f0ecbac8fc0cd909c5c78eefd0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 02:56:10 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=f31de79df28a75f0ecbac8fc0cd909c5c78eefd0 commit f31de79df28a75f0ecbac8fc0cd909c5c78eefd0 Author: Kyle Evans AuthorDate: 2021-01-30 06:07:17 +0000 Commit: Kyle Evans CommitDate: 2021-02-04 02:55:59 +0000 kerberos5: fix the WITH_OPENLDAP build Restore WARNS to its former glory prior to the global WARNS change to fix the build. (cherry picked from commit e948d980f78dd2789060b46d3d03ba0d96b23b59) --- kerberos5/lib/libhdb/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kerberos5/lib/libhdb/Makefile b/kerberos5/lib/libhdb/Makefile index 29ba7d2c58a2..fda622d6945a 100644 --- a/kerberos5/lib/libhdb/Makefile +++ b/kerberos5/lib/libhdb/Makefile @@ -7,6 +7,8 @@ LIBADD= asn1 com_err krb5 roken sqlite3 LDADD= ${LDAPLDADD} DPADD= ${LDAPDPADD} +WARNS?= 0 + MAN= HDB.3 hdb_entry_ex.3 MLINKS= HDB.3 hdb__del.3 \ From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 02:56:12 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16714534D5A; Thu, 4 Feb 2021 02:56: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 4DWNV35d7fz4gcp; Thu, 4 Feb 2021 02:56:11 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9D98C2C2B9; Thu, 4 Feb 2021 02:56:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1142uB7e067075; Thu, 4 Feb 2021 02:56:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1142uBgv067074; Thu, 4 Feb 2021 02:56:11 GMT (envelope-from git) Date: Thu, 4 Feb 2021 02:56:11 GMT Message-Id: <202102040256.1142uBgv067074@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: d37a305bc52f - stable/13 - build: options: mention ports in the WITH_OPENLDAP description MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d37a305bc52fdb6337c012f869fc54dba9408842 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 02:56:12 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=d37a305bc52fdb6337c012f869fc54dba9408842 commit d37a305bc52fdb6337c012f869fc54dba9408842 Author: Kyle Evans AuthorDate: 2021-01-30 06:09:10 +0000 Commit: Kyle Evans CommitDate: 2021-02-04 02:56:01 +0000 build: options: mention ports in the WITH_OPENLDAP description There's a third party dependency on this option; currently, net/openldap24-{,sasl-}client. At least mention that an openldap from ports is needed for this option. PR: 252866 (cherry picked from commit 7587d9823a8257b9a2d5b2e58c707026061058c6) --- share/man/man5/src.conf.5 | 4 ++-- tools/build/options/WITH_OPENLDAP | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index dafeb1efa248..6c02df1ac7de 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd January 28, 2021 +.Dd January 30, 2021 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1257,7 +1257,7 @@ Set to build the non-essential components of the .Dq "OpenFabrics Enterprise Distribution" Infiniband software stack, mostly examples. .It Va WITH_OPENLDAP -Enable building openldap support for kerberos. +Enable building LDAP support for kerberos using an openldap client from ports. .It Va WITHOUT_OPENMP Set to not build LLVM's OpenMP runtime. .Pp diff --git a/tools/build/options/WITH_OPENLDAP b/tools/build/options/WITH_OPENLDAP index 75f96822eb8c..c815e6160726 100644 --- a/tools/build/options/WITH_OPENLDAP +++ b/tools/build/options/WITH_OPENLDAP @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Enable building openldap support for kerberos. +Enable building LDAP support for kerberos using an openldap client from ports. From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 03:00:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 38FC6535296; Thu, 4 Feb 2021 03:00:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWNb80jklz4hXH; Thu, 4 Feb 2021 03:00:36 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 09DA62BF6F; Thu, 4 Feb 2021 03:00:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11430Zds075239; Thu, 4 Feb 2021 03:00:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11430Z1N075238; Thu, 4 Feb 2021 03:00:35 GMT (envelope-from git) Date: Thu, 4 Feb 2021 03:00:35 GMT Message-Id: <202102040300.11430Z1N075238@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alfredo Dal'Ava Junior" Subject: git: d0982de778a6 - stable/13 - [POWERPC64BE] mrsas: add big-endian support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alfredo X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d0982de778a678f4558c9444d585689c254f7850 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 03:00:36 -0000 The branch stable/13 has been updated by alfredo: URL: https://cgit.FreeBSD.org/src/commit/?id=d0982de778a678f4558c9444d585689c254f7850 commit d0982de778a678f4558c9444d585689c254f7850 Author: Alfredo Dal'Ava Junior AuthorDate: 2021-02-04 00:52:19 +0000 Commit: Alfredo Dal'Ava Junior CommitDate: 2021-02-04 05:58:19 +0000 [POWERPC64BE] mrsas: add big-endian support Add endiannes conversions in order to support big-endian platforms Submitted by: Andre Fernando da Silva Reviewed by: luporl, alfredo, kadesai (on email) Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D26531 --- sys/dev/mrsas/mrsas.c | 198 ++++++++++++++++--------------- sys/dev/mrsas/mrsas.h | 289 +++++++++++++++++++++++++++++++++++++++++++++- sys/dev/mrsas/mrsas_cam.c | 54 ++++----- sys/dev/mrsas/mrsas_fp.c | 170 ++++++++++++++------------- 4 files changed, 510 insertions(+), 201 deletions(-) diff --git a/sys/dev/mrsas/mrsas.c b/sys/dev/mrsas/mrsas.c index 32d85c803938..f4c34e237fc4 100644 --- a/sys/dev/mrsas/mrsas.c +++ b/sys/dev/mrsas/mrsas.c @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include /* * Function prototypes @@ -619,13 +620,13 @@ mrsas_get_seq_num(struct mrsas_softc *sc, dcmd->cmd = MFI_CMD_DCMD; dcmd->cmd_status = 0x0; dcmd->sge_count = 1; - dcmd->flags = MFI_FRAME_DIR_READ; + dcmd->flags = htole16(MFI_FRAME_DIR_READ); dcmd->timeout = 0; dcmd->pad_0 = 0; - dcmd->data_xfer_len = sizeof(struct mrsas_evt_log_info); - dcmd->opcode = MR_DCMD_CTRL_EVENT_GET_INFO; - dcmd->sgl.sge32[0].phys_addr = sc->el_info_phys_addr; - dcmd->sgl.sge32[0].length = sizeof(struct mrsas_evt_log_info); + dcmd->data_xfer_len = htole32(sizeof(struct mrsas_evt_log_info)); + dcmd->opcode = htole32(MR_DCMD_CTRL_EVENT_GET_INFO); + dcmd->sgl.sge32[0].phys_addr = htole32(sc->el_info_phys_addr & 0xFFFFFFFF); + dcmd->sgl.sge32[0].length = htole32(sizeof(struct mrsas_evt_log_info)); retcode = mrsas_issue_blocked_cmd(sc, cmd); if (retcode == ETIMEDOUT) @@ -681,7 +682,7 @@ mrsas_register_aen(struct mrsas_softc *sc, u_int32_t seq_num, curr_aen.word = class_locale_word; if (sc->aen_cmd) { - prev_aen.word = sc->aen_cmd->frame->dcmd.mbox.w[1]; + prev_aen.word = le32toh(sc->aen_cmd->frame->dcmd.mbox.w[1]); /* * A class whose enum value is smaller is inclusive of all @@ -732,16 +733,16 @@ mrsas_register_aen(struct mrsas_softc *sc, u_int32_t seq_num, dcmd->cmd = MFI_CMD_DCMD; dcmd->cmd_status = 0x0; dcmd->sge_count = 1; - dcmd->flags = MFI_FRAME_DIR_READ; + dcmd->flags = htole16(MFI_FRAME_DIR_READ); dcmd->timeout = 0; dcmd->pad_0 = 0; - dcmd->data_xfer_len = sizeof(struct mrsas_evt_detail); - dcmd->opcode = MR_DCMD_CTRL_EVENT_WAIT; - dcmd->mbox.w[0] = seq_num; + dcmd->data_xfer_len = htole32(sizeof(struct mrsas_evt_detail)); + dcmd->opcode = htole32(MR_DCMD_CTRL_EVENT_WAIT); + dcmd->mbox.w[0] = htole32(seq_num); sc->last_seq_num = seq_num; - dcmd->mbox.w[1] = curr_aen.word; - dcmd->sgl.sge32[0].phys_addr = (u_int32_t)sc->evt_detail_phys_addr; - dcmd->sgl.sge32[0].length = sizeof(struct mrsas_evt_detail); + dcmd->mbox.w[1] = htole32(curr_aen.word); + dcmd->sgl.sge32[0].phys_addr = htole32((u_int32_t)sc->evt_detail_phys_addr & 0xFFFFFFFF); + dcmd->sgl.sge32[0].length = htole32(sizeof(struct mrsas_evt_detail)); if (sc->aen_cmd != NULL) { mrsas_release_mfi_cmd(cmd); @@ -907,9 +908,6 @@ mrsas_attach(device_t dev) * Set up PCI and registers */ cmd = pci_read_config(dev, PCIR_COMMAND, 2); - if ((cmd & PCIM_CMD_PORTEN) == 0) { - return (ENXIO); - } /* Force the busmaster enable bit on. */ cmd |= PCIM_CMD_BUSMASTEREN; pci_write_config(dev, PCIR_COMMAND, cmd, 2); @@ -1704,7 +1702,7 @@ mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex) /* Find our reply descriptor for the command and process */ while ((desc_val.u.low != 0xFFFFFFFF) && (desc_val.u.high != 0xFFFFFFFF)) { - smid = reply_desc->SMID; + smid = le16toh(reply_desc->SMID); cmd_mpt = sc->mpt_cmd_list[smid - 1]; scsi_io_req = (MRSAS_RAID_SCSI_IO_REQUEST *) cmd_mpt->io_request; @@ -1736,7 +1734,7 @@ mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex) case MRSAS_MPI2_FUNCTION_LD_IO_REQUEST: if (cmd_mpt->r1_alt_dev_handle == MR_DEVHANDLE_INVALID) { mrsas_map_mpt_cmd_status(cmd_mpt, cmd_mpt->ccb_ptr, status, - extStatus, data_length, sense); + extStatus, le32toh(data_length), sense); mrsas_cmd_done(sc, cmd_mpt); mrsas_atomic_dec(&sc->fw_outstanding); } else { @@ -1764,7 +1762,7 @@ mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex) mrsas_release_mpt_cmd(r1_cmd); mrsas_atomic_dec(&sc->fw_outstanding); mrsas_map_mpt_cmd_status(cmd_mpt, cmd_mpt->ccb_ptr, status, - extStatus, data_length, sense); + extStatus, le32toh(data_length), sense); mrsas_cmd_done(sc, cmd_mpt); mrsas_atomic_dec(&sc->fw_outstanding); } @@ -1778,7 +1776,7 @@ mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex) * And also make sure that the issue_polled call should only be * used if INTERRUPT IS DISABLED. */ - if (cmd_mfi->frame->hdr.flags & MFI_FRAME_DONT_POST_IN_REPLY_QUEUE) + if (cmd_mfi->frame->hdr.flags & htole16(MFI_FRAME_DONT_POST_IN_REPLY_QUEUE)) mrsas_release_mfi_cmd(cmd_mfi); else mrsas_complete_mptmfi_passthru(sc, cmd_mfi, status); @@ -2593,6 +2591,13 @@ mrsas_init_adapter(struct mrsas_softc *sc) (MRSAS_MPI2_RAID_DEFAULT_IO_FRAME_SIZE * (sc->max_fw_cmds + 1)); scratch_pad_2 = mrsas_read_reg_with_retries(sc, offsetof(mrsas_reg_set, outbound_scratch_pad_2)); + + mrsas_dprint(sc, MRSAS_TRACE, "%s: sc->reply_q_depth 0x%x," + "sc->request_alloc_sz 0x%x, sc->reply_alloc_sz 0x%x," + "sc->io_frames_alloc_sz 0x%x\n", __func__, + sc->reply_q_depth, sc->request_alloc_sz, + sc->reply_alloc_sz, sc->io_frames_alloc_sz); + /* * If scratch_pad_2 & MEGASAS_MAX_CHAIN_SIZE_UNITS_MASK is set, * Firmware support extended IO chain frame which is 4 time more @@ -2617,8 +2622,10 @@ mrsas_init_adapter(struct mrsas_softc *sc) mrsas_dprint(sc, MRSAS_INFO, "max sge: 0x%x, max chain frame size: 0x%x, " - "max fw cmd: 0x%x\n", sc->max_num_sge, - sc->max_chain_frame_sz, sc->max_fw_cmds); + "max fw cmd: 0x%x sc->chain_frames_alloc_sz: 0x%x\n", + sc->max_num_sge, + sc->max_chain_frame_sz, sc->max_fw_cmds, + sc->chain_frames_alloc_sz); /* Used for pass thru MFI frame (DCMD) */ sc->chain_offset_mfi_pthru = offsetof(MRSAS_RAID_SCSI_IO_REQUEST, SGL) / 16; @@ -2738,19 +2745,19 @@ mrsas_ioc_init(struct mrsas_softc *sc) IOCInitMsg = (pMpi2IOCInitRequest_t)(((char *)sc->ioc_init_mem) + 1024); IOCInitMsg->Function = MPI2_FUNCTION_IOC_INIT; IOCInitMsg->WhoInit = MPI2_WHOINIT_HOST_DRIVER; - IOCInitMsg->MsgVersion = MPI2_VERSION; - IOCInitMsg->HeaderVersion = MPI2_HEADER_VERSION; - IOCInitMsg->SystemRequestFrameSize = MRSAS_MPI2_RAID_DEFAULT_IO_FRAME_SIZE / 4; - IOCInitMsg->ReplyDescriptorPostQueueDepth = sc->reply_q_depth; - IOCInitMsg->ReplyDescriptorPostQueueAddress = sc->reply_desc_phys_addr; - IOCInitMsg->SystemRequestFrameBaseAddress = sc->io_request_phys_addr; + IOCInitMsg->MsgVersion = htole16(MPI2_VERSION); + IOCInitMsg->HeaderVersion = htole16(MPI2_HEADER_VERSION); + IOCInitMsg->SystemRequestFrameSize = htole16(MRSAS_MPI2_RAID_DEFAULT_IO_FRAME_SIZE / 4); + IOCInitMsg->ReplyDescriptorPostQueueDepth = htole16(sc->reply_q_depth); + IOCInitMsg->ReplyDescriptorPostQueueAddress = htole64(sc->reply_desc_phys_addr); + IOCInitMsg->SystemRequestFrameBaseAddress = htole64(sc->io_request_phys_addr); IOCInitMsg->HostMSIxVectors = (sc->msix_vectors > 0 ? sc->msix_vectors : 0); IOCInitMsg->HostPageSize = MR_DEFAULT_NVME_PAGE_SHIFT; init_frame = (struct mrsas_init_frame *)sc->ioc_init_mem; init_frame->cmd = MFI_CMD_INIT; init_frame->cmd_status = 0xFF; - init_frame->flags |= MFI_FRAME_DONT_POST_IN_REPLY_QUEUE; + init_frame->flags |= htole16(MFI_FRAME_DONT_POST_IN_REPLY_QUEUE); /* driver support Extended MSIX */ if (sc->mrsas_gen3_ctrl || sc->is_ventura || sc->is_aero) { @@ -2768,11 +2775,16 @@ mrsas_ioc_init(struct mrsas_softc *sc) init_frame->driver_operations.mfi_capabilities.security_protocol_cmds_fw = 1; if (sc->max_chain_frame_sz > MEGASAS_CHAIN_FRAME_SZ_MIN) init_frame->driver_operations.mfi_capabilities.support_ext_io_size = 1; + + init_frame->driver_operations.reg = htole32(init_frame->driver_operations.reg); + phys_addr = (bus_addr_t)sc->ioc_init_phys_mem + 1024; - init_frame->queue_info_new_phys_addr_lo = phys_addr; - init_frame->data_xfer_len = sizeof(Mpi2IOCInitRequest_t); + init_frame->queue_info_new_phys_addr_lo = htole32(phys_addr); + init_frame->data_xfer_len = htole32(sizeof(Mpi2IOCInitRequest_t)); + + req_desc.addr.u.low = htole32((bus_addr_t)sc->ioc_init_phys_mem & 0xFFFFFFFF); + req_desc.addr.u.high = htole32((bus_addr_t)sc->ioc_init_phys_mem >> 32); - req_desc.addr.Words = (bus_addr_t)sc->ioc_init_phys_mem; req_desc.MFAIo.RequestFlags = (MRSAS_REQ_DESCRIPT_FLAGS_MFA << MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); @@ -2923,9 +2935,9 @@ mrsas_write_64bit_req_desc(struct mrsas_softc *sc, u_int32_t req_desc_lo, { mtx_lock(&sc->pci_lock); mrsas_write_reg(sc, offsetof(mrsas_reg_set, inbound_low_queue_port), - req_desc_lo); + le32toh(req_desc_lo)); mrsas_write_reg(sc, offsetof(mrsas_reg_set, inbound_high_queue_port), - req_desc_hi); + le32toh(req_desc_hi)); mtx_unlock(&sc->pci_lock); } @@ -2944,7 +2956,7 @@ mrsas_fire_cmd(struct mrsas_softc *sc, u_int32_t req_desc_lo, { if (sc->atomic_desc_support) mrsas_write_reg(sc, offsetof(mrsas_reg_set, inbound_single_queue_port), - req_desc_lo); + le32toh(req_desc_lo)); else mrsas_write_64bit_req_desc(sc, req_desc_lo, req_desc_hi); } @@ -3103,7 +3115,6 @@ mrsas_ocr_thread(void *arg) sc = (struct mrsas_softc *)arg; mrsas_dprint(sc, MRSAS_TRACE, "%s\n", __func__); - sc->ocr_thread_active = 1; mtx_lock(&sc->sim_lock); for (;;) { @@ -3642,10 +3653,10 @@ mrsas_get_ctrl_info(struct mrsas_softc *sc) dcmd->flags = MFI_FRAME_DIR_READ; dcmd->timeout = 0; dcmd->pad_0 = 0; - dcmd->data_xfer_len = sizeof(struct mrsas_ctrl_info); - dcmd->opcode = MR_DCMD_CTRL_GET_INFO; - dcmd->sgl.sge32[0].phys_addr = sc->ctlr_info_phys_addr; - dcmd->sgl.sge32[0].length = sizeof(struct mrsas_ctrl_info); + dcmd->data_xfer_len = htole32(sizeof(struct mrsas_ctrl_info)); + dcmd->opcode = htole32(MR_DCMD_CTRL_GET_INFO); + dcmd->sgl.sge32[0].phys_addr = htole32(sc->ctlr_info_phys_addr & 0xFFFFFFFF); + dcmd->sgl.sge32[0].length = htole32(sizeof(struct mrsas_ctrl_info)); if (!sc->mask_interrupts) retcode = mrsas_issue_blocked_cmd(sc, cmd); @@ -3654,8 +3665,13 @@ mrsas_get_ctrl_info(struct mrsas_softc *sc) if (retcode == ETIMEDOUT) goto dcmd_timeout; - else + else { memcpy(sc->ctrl_info, sc->ctlr_info_mem, sizeof(struct mrsas_ctrl_info)); + le32_to_cpus(&sc->ctrl_info->properties.OnOffProperties); + le32_to_cpus(&sc->ctrl_info->adapterOperations2); + le32_to_cpus(&sc->ctrl_info->adapterOperations3); + le16_to_cpus(&sc->ctrl_info->adapterOperations4); + } do_ocr = 0; mrsas_update_ext_vd_details(sc); @@ -3813,7 +3829,7 @@ mrsas_issue_polled(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd) int i, retcode = SUCCESS; frame_hdr->cmd_status = 0xFF; - frame_hdr->flags |= MFI_FRAME_DONT_POST_IN_REPLY_QUEUE; + frame_hdr->flags |= htole16(MFI_FRAME_DONT_POST_IN_REPLY_QUEUE); /* Issue the frame using inbound queue port */ if (mrsas_issue_dcmd(sc, cmd)) { @@ -3892,7 +3908,7 @@ mrsas_build_mpt_cmd(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd) req_desc->addr.Words = 0; req_desc->SCSIIO.RequestFlags = (MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO << MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); - req_desc->SCSIIO.SMID = index; + req_desc->SCSIIO.SMID = htole16(index); return (req_desc); } @@ -3927,7 +3943,7 @@ mrsas_build_mptmfi_passthru(struct mrsas_softc *sc, struct mrsas_mfi_cmd *mfi_cm * mrsas_complete_cmd. */ - if (frame_hdr->flags & MFI_FRAME_DONT_POST_IN_REPLY_QUEUE) + if (frame_hdr->flags & htole16(MFI_FRAME_DONT_POST_IN_REPLY_QUEUE)) mpt_cmd->flags = MFI_FRAME_DONT_POST_IN_REPLY_QUEUE; io_req = mpt_cmd->io_request; @@ -3944,12 +3960,12 @@ mrsas_build_mptmfi_passthru(struct mrsas_softc *sc, struct mrsas_mfi_cmd *mfi_cm io_req->SGLOffset0 = offsetof(MRSAS_RAID_SCSI_IO_REQUEST, SGL) / 4; io_req->ChainOffset = sc->chain_offset_mfi_pthru; - mpi25_ieee_chain->Address = mfi_cmd->frame_phys_addr; + mpi25_ieee_chain->Address = htole64(mfi_cmd->frame_phys_addr); mpi25_ieee_chain->Flags = IEEE_SGE_FLAGS_CHAIN_ELEMENT | MPI2_IEEE_SGE_FLAGS_IOCPLBNTA_ADDR; - mpi25_ieee_chain->Length = sc->max_chain_frame_sz; + mpi25_ieee_chain->Length = htole32(sc->max_chain_frame_sz); return (0); } @@ -4100,7 +4116,7 @@ mrsas_complete_mptmfi_passthru(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd break; } /* See if got an event notification */ - if (cmd->frame->dcmd.opcode == MR_DCMD_CTRL_EVENT_WAIT) + if (le32toh(cmd->frame->dcmd.opcode) == MR_DCMD_CTRL_EVENT_WAIT) mrsas_complete_aen(sc, cmd); else mrsas_wakeup(sc, cmd); @@ -4264,14 +4280,14 @@ megasas_sync_pd_seq_num(struct mrsas_softc *sc, boolean_t pend) dcmd->sge_count = 1; dcmd->timeout = 0; dcmd->pad_0 = 0; - dcmd->data_xfer_len = (pd_seq_map_sz); - dcmd->opcode = (MR_DCMD_SYSTEM_PD_MAP_GET_INFO); - dcmd->sgl.sge32[0].phys_addr = (pd_seq_h); - dcmd->sgl.sge32[0].length = (pd_seq_map_sz); + dcmd->data_xfer_len = htole32(pd_seq_map_sz); + dcmd->opcode = htole32(MR_DCMD_SYSTEM_PD_MAP_GET_INFO); + dcmd->sgl.sge32[0].phys_addr = htole32(pd_seq_h & 0xFFFFFFFF); + dcmd->sgl.sge32[0].length = htole32(pd_seq_map_sz); if (pend) { dcmd->mbox.b[0] = MRSAS_DCMD_MBOX_PEND_FLAG; - dcmd->flags = (MFI_FRAME_DIR_WRITE); + dcmd->flags = htole16(MFI_FRAME_DIR_WRITE); sc->jbod_seq_cmd = cmd; if (mrsas_issue_dcmd(sc, cmd)) { device_printf(sc->mrsas_dev, @@ -4280,13 +4296,13 @@ megasas_sync_pd_seq_num(struct mrsas_softc *sc, boolean_t pend) } else return 0; } else - dcmd->flags = MFI_FRAME_DIR_READ; + dcmd->flags = htole16(MFI_FRAME_DIR_READ); retcode = mrsas_issue_polled(sc, cmd); if (retcode == ETIMEDOUT) goto dcmd_timeout; - if (pd_sync->count > MAX_PHYSICAL_DEVICES) { + if (le32toh(pd_sync->count) > MAX_PHYSICAL_DEVICES) { device_printf(sc->mrsas_dev, "driver supports max %d JBOD, but FW reports %d\n", MAX_PHYSICAL_DEVICES, pd_sync->count); @@ -4364,13 +4380,13 @@ mrsas_get_ld_map_info(struct mrsas_softc *sc) dcmd->cmd = MFI_CMD_DCMD; dcmd->cmd_status = 0xFF; dcmd->sge_count = 1; - dcmd->flags = MFI_FRAME_DIR_READ; + dcmd->flags = htole16(MFI_FRAME_DIR_READ); dcmd->timeout = 0; dcmd->pad_0 = 0; - dcmd->data_xfer_len = sc->current_map_sz; - dcmd->opcode = MR_DCMD_LD_MAP_GET_INFO; - dcmd->sgl.sge32[0].phys_addr = map_phys_addr; - dcmd->sgl.sge32[0].length = sc->current_map_sz; + dcmd->data_xfer_len = htole32(sc->current_map_sz); + dcmd->opcode = htole32(MR_DCMD_LD_MAP_GET_INFO); + dcmd->sgl.sge32[0].phys_addr = htole32(map_phys_addr & 0xFFFFFFFF); + dcmd->sgl.sge32[0].length = htole32(sc->current_map_sz); retcode = mrsas_issue_polled(sc, cmd); if (retcode == ETIMEDOUT) @@ -4427,15 +4443,15 @@ mrsas_sync_map_info(struct mrsas_softc *sc) dcmd->cmd = MFI_CMD_DCMD; dcmd->cmd_status = 0xFF; dcmd->sge_count = 1; - dcmd->flags = MFI_FRAME_DIR_WRITE; + dcmd->flags = htole16(MFI_FRAME_DIR_WRITE); dcmd->timeout = 0; dcmd->pad_0 = 0; - dcmd->data_xfer_len = sc->current_map_sz; + dcmd->data_xfer_len = htole32(sc->current_map_sz); dcmd->mbox.b[0] = num_lds; dcmd->mbox.b[1] = MRSAS_DCMD_MBOX_PEND_FLAG; - dcmd->opcode = MR_DCMD_LD_MAP_GET_INFO; - dcmd->sgl.sge32[0].phys_addr = map_phys_addr; - dcmd->sgl.sge32[0].length = sc->current_map_sz; + dcmd->opcode = htole32(MR_DCMD_LD_MAP_GET_INFO); + dcmd->sgl.sge32[0].phys_addr = htole32(map_phys_addr & 0xFFFFFFFF); + dcmd->sgl.sge32[0].length = htole32(sc->current_map_sz); sc->map_update_cmd = cmd; if (mrsas_issue_dcmd(sc, cmd)) { @@ -4472,17 +4488,17 @@ mrsas_get_pd_info(struct mrsas_softc *sc, u_int16_t device_id) memset(sc->pd_info_mem, 0, sizeof(struct mrsas_pd_info)); memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE); - dcmd->mbox.s[0] = device_id; + dcmd->mbox.s[0] = htole16(device_id); dcmd->cmd = MFI_CMD_DCMD; dcmd->cmd_status = 0xFF; dcmd->sge_count = 1; dcmd->flags = MFI_FRAME_DIR_READ; dcmd->timeout = 0; dcmd->pad_0 = 0; - dcmd->data_xfer_len = sizeof(struct mrsas_pd_info); - dcmd->opcode = MR_DCMD_PD_GET_INFO; - dcmd->sgl.sge32[0].phys_addr = (u_int32_t)sc->pd_info_phys_addr; - dcmd->sgl.sge32[0].length = sizeof(struct mrsas_pd_info); + dcmd->data_xfer_len = htole32(sizeof(struct mrsas_pd_info)); + dcmd->opcode = htole32(MR_DCMD_PD_GET_INFO); + dcmd->sgl.sge32[0].phys_addr = htole32((u_int32_t)sc->pd_info_phys_addr & 0xFFFFFFFF); + dcmd->sgl.sge32[0].length = htole32(sizeof(struct mrsas_pd_info)); if (!sc->mask_interrupts) retcode = mrsas_issue_blocked_cmd(sc, cmd); @@ -4493,7 +4509,7 @@ mrsas_get_pd_info(struct mrsas_softc *sc, u_int16_t device_id) goto dcmd_timeout; sc->target_list[device_id].interface_type = - sc->pd_info_mem->state.ddf.pdType.intf; + le16toh(sc->pd_info_mem->state.ddf.pdType.intf); do_ocr = 0; @@ -4572,6 +4588,7 @@ mrsas_get_pd_list(struct mrsas_softc *sc) struct MR_PD_ADDRESS *pd_addr; bus_addr_t pd_list_phys_addr = 0; struct mrsas_tmp_dcmd *tcmd; + u_int16_t dev_id; cmd = mrsas_get_mfi_cmd(sc); if (!cmd) { @@ -4601,13 +4618,13 @@ mrsas_get_pd_list(struct mrsas_softc *sc) dcmd->cmd = MFI_CMD_DCMD; dcmd->cmd_status = 0xFF; dcmd->sge_count = 1; - dcmd->flags = MFI_FRAME_DIR_READ; + dcmd->flags = htole16(MFI_FRAME_DIR_READ); dcmd->timeout = 0; dcmd->pad_0 = 0; - dcmd->data_xfer_len = MRSAS_MAX_PD * sizeof(struct MR_PD_LIST); - dcmd->opcode = MR_DCMD_PD_LIST_QUERY; - dcmd->sgl.sge32[0].phys_addr = pd_list_phys_addr; - dcmd->sgl.sge32[0].length = MRSAS_MAX_PD * sizeof(struct MR_PD_LIST); + dcmd->data_xfer_len = htole32(MRSAS_MAX_PD * sizeof(struct MR_PD_LIST)); + dcmd->opcode = htole32(MR_DCMD_PD_LIST_QUERY); + dcmd->sgl.sge32[0].phys_addr = htole32(pd_list_phys_addr & 0xFFFFFFFF); + dcmd->sgl.sge32[0].length = htole32(MRSAS_MAX_PD * sizeof(struct MR_PD_LIST)); if (!sc->mask_interrupts) retcode = mrsas_issue_blocked_cmd(sc, cmd); @@ -4620,17 +4637,18 @@ mrsas_get_pd_list(struct mrsas_softc *sc) /* Get the instance PD list */ pd_count = MRSAS_MAX_PD; pd_addr = pd_list_mem->addr; - if (pd_list_mem->count < pd_count) { + if (le32toh(pd_list_mem->count) < pd_count) { memset(sc->local_pd_list, 0, MRSAS_MAX_PD * sizeof(struct mrsas_pd_list)); - for (pd_index = 0; pd_index < pd_list_mem->count; pd_index++) { - sc->local_pd_list[pd_addr->deviceId].tid = pd_addr->deviceId; - sc->local_pd_list[pd_addr->deviceId].driveType = - pd_addr->scsiDevType; - sc->local_pd_list[pd_addr->deviceId].driveState = + for (pd_index = 0; pd_index < le32toh(pd_list_mem->count); pd_index++) { + dev_id = le16toh(pd_addr->deviceId); + sc->local_pd_list[dev_id].tid = dev_id; + sc->local_pd_list[dev_id].driveType = + le16toh(pd_addr->scsiDevType); + sc->local_pd_list[dev_id].driveState = MR_PD_STATE_SYSTEM; - if (sc->target_list[pd_addr->deviceId].target_id == 0xffff) - mrsas_add_target(sc, pd_addr->deviceId); + if (sc->target_list[dev_id].target_id == 0xffff) + mrsas_add_target(sc, dev_id); pd_addr++; } for (pd_index = 0; pd_index < MRSAS_MAX_PD; pd_index++) { @@ -4711,10 +4729,10 @@ mrsas_get_ld_list(struct mrsas_softc *sc) dcmd->sge_count = 1; dcmd->flags = MFI_FRAME_DIR_READ; dcmd->timeout = 0; - dcmd->data_xfer_len = sizeof(struct MR_LD_LIST); - dcmd->opcode = MR_DCMD_LD_GET_LIST; - dcmd->sgl.sge32[0].phys_addr = ld_list_phys_addr; - dcmd->sgl.sge32[0].length = sizeof(struct MR_LD_LIST); + dcmd->data_xfer_len = htole32(sizeof(struct MR_LD_LIST)); + dcmd->opcode = htole32(MR_DCMD_LD_GET_LIST); + dcmd->sgl.sge32[0].phys_addr = htole32(ld_list_phys_addr); + dcmd->sgl.sge32[0].length = htole32(sizeof(struct MR_LD_LIST)); dcmd->pad_0 = 0; if (!sc->mask_interrupts) @@ -4730,10 +4748,10 @@ mrsas_get_ld_list(struct mrsas_softc *sc) #endif /* Get the instance LD list */ - if (ld_list_mem->ldCount <= sc->fw_supported_vd_count) { - sc->CurLdCount = ld_list_mem->ldCount; + if (le32toh(ld_list_mem->ldCount) <= sc->fw_supported_vd_count) { + sc->CurLdCount = le32toh(ld_list_mem->ldCount); memset(sc->ld_ids, 0xff, MAX_LOGICAL_DRIVES_EXT); - for (ld_index = 0; ld_index < ld_list_mem->ldCount; ld_index++) { + for (ld_index = 0; ld_index < le32toh(ld_list_mem->ldCount); ld_index++) { ids = ld_list_mem->ldList[ld_index].ref.ld_context.targetId; drv_tgt_id = ids + MRSAS_MAX_PD; if (ld_list_mem->ldList[ld_index].state != 0) { diff --git a/sys/dev/mrsas/mrsas.h b/sys/dev/mrsas/mrsas.h index fbb08215b7b1..069db02fadff 100644 --- a/sys/dev/mrsas/mrsas.h +++ b/sys/dev/mrsas/mrsas.h @@ -165,14 +165,22 @@ do { \ device_printf(sc->mrsas_dev, msg, ##args); \ } while (0) +#define le32_to_cpus(x) do { *((u_int32_t *)(x)) = le32toh((*(u_int32_t *)x)); } while (0) +#define le16_to_cpus(x) do { *((u_int16_t *)(x)) = le16toh((*(u_int16_t *)x)); } while (0) + /**************************************************************************** * Raid Context structure which describes MegaRAID specific IO Paramenters * This resides at offset 0x60 where the SGL normally starts in MPT IO Frames ****************************************************************************/ typedef struct _RAID_CONTEXT { +#if _BYTE_ORDER == _LITTLE_ENDIAN u_int8_t Type:4; u_int8_t nseg:4; +#else + u_int8_t nseg:4; + u_int8_t Type:4; +#endif u_int8_t resvd0; u_int16_t timeoutValue; u_int8_t regLockFlags; @@ -197,12 +205,19 @@ typedef struct _RAID_CONTEXT { * This resides at offset 0x60 where the SGL normally starts in MPT IO Frames */ typedef struct _RAID_CONTEXT_G35 { +#if _BYTE_ORDER == _LITTLE_ENDIAN u_int16_t Type:4; u_int16_t nseg:4; u_int16_t resvd0:8; +#else + u_int16_t resvd0:8; + u_int16_t nseg:4; + u_int16_t Type:4; +#endif u_int16_t timeoutValue; union { struct { +#if _BYTE_ORDER == _LITTLE_ENDIAN u_int16_t reserved:1; u_int16_t sld:1; u_int16_t c2f:1; @@ -213,6 +228,18 @@ typedef struct _RAID_CONTEXT_G35 { u_int16_t log:1; u_int16_t cpuSel:4; u_int16_t setDivert:4; +#else + u_int16_t setDivert:4; + u_int16_t cpuSel:4; + u_int16_t log:1; + u_int16_t rw:1; + u_int16_t sbs:1; + u_int16_t sqn:1; + u_int16_t fwn:1; + u_int16_t c2f:1; + u_int16_t sld:1; + u_int16_t reserved:1; +#endif } bits; u_int16_t s; } routingFlags; @@ -228,9 +255,15 @@ typedef struct _RAID_CONTEXT_G35 { u_int8_t RAIDFlags; u_int8_t spanArm; u_int16_t configSeqNum; +#if _BYTE_ORDER == _LITTLE_ENDIAN u_int16_t numSGE:12; u_int16_t reserved:3; u_int16_t streamDetected:1; +#else + u_int16_t streamDetected:1; + u_int16_t reserved:3; + u_int16_t numSGE:12; +#endif u_int8_t resvd2[2]; } RAID_CONTEXT_G35; @@ -433,9 +466,15 @@ typedef struct _MR_TASK_MANAGE_REQUEST { MR_TM_REQUEST TmRequest; union { struct { +#if _BYTE_ORDER == _LITTLE_ENDIAN u_int32_t isTMForLD:1; u_int32_t isTMForPD:1; u_int32_t reserved1:30; +#else + u_int32_t reserved1:30; + u_int32_t isTMForPD:1; + u_int32_t isTMForLD:1; +#endif u_int32_t reserved2; } tmReqFlags; MR_TM_REPLY TMReply; @@ -808,6 +847,7 @@ typedef struct _MR_SPAN_BLOCK_INFO { typedef struct _MR_LD_RAID { struct { +#if _BYTE_ORDER == _LITTLE_ENDIAN u_int32_t fpCapable:1; u_int32_t raCapable:1; u_int32_t reserved5:2; @@ -822,6 +862,22 @@ typedef struct _MR_LD_RAID { u_int32_t tmCapable:1; u_int32_t fpCacheBypassCapable:1; u_int32_t reserved4:5; +#else + u_int32_t reserved4:5; + u_int32_t fpCacheBypassCapable:1; + u_int32_t tmCapable:1; + u_int32_t fpNonRWCapable:1; + u_int32_t fpReadAcrossStripe:1; + u_int32_t fpWriteAcrossStripe:1; + u_int32_t fpReadCapable:1; + u_int32_t fpWriteCapable:1; + u_int32_t encryptionType:8; + u_int32_t pdPiMode:4; + u_int32_t ldPiMode:4; + u_int32_t reserved5:2; + u_int32_t raCapable:1; + u_int32_t fpCapable:1; +#endif } capability; u_int32_t reserved6; u_int64_t size; @@ -844,9 +900,15 @@ typedef struct _MR_LD_RAID { u_int16_t seqNum; struct { +#if _BYTE_ORDER == _LITTLE_ENDIAN + u_int32_t reserved:30; + u_int32_t regTypeReqOnReadLsValid:1; + u_int32_t ldSyncRequired:1; +#else u_int32_t ldSyncRequired:1; u_int32_t regTypeReqOnReadLsValid:1; u_int32_t reserved:30; +#endif } flags; u_int8_t LUN[8]; @@ -854,9 +916,15 @@ typedef struct _MR_LD_RAID { u_int8_t reserved2[3]; u_int32_t logicalBlockLength; struct { +#if _BYTE_ORDER == _LITTLE_ENDIAN + u_int32_t reserved1:24; + u_int32_t LdLogicalBlockExp:4; + u_int32_t LdPiExp:4; +#else u_int32_t LdPiExp:4; u_int32_t LdLogicalBlockExp:4; u_int32_t reserved1:24; +#endif } exponent; u_int8_t reserved3[0x80 - 0x38]; } MR_LD_RAID; @@ -1039,8 +1107,13 @@ struct MR_PD_CFG_SEQ { u_int16_t seqNum; u_int16_t devHandle; struct { +#if _BYTE_ORDER == _LITTLE_ENDIAN u_int8_t tmCapable:1; u_int8_t reserved:7; +#else + u_int8_t reserved:7; + u_int8_t tmCapable:1; +#endif } capability; u_int8_t reserved; u_int16_t pdTargetId; @@ -1868,6 +1941,7 @@ struct mrsas_ctrl_prop { * structure. */ struct { +#if _BYTE_ORDER == _LITTLE_ENDIAN u_int32_t copyBackDisabled:1; u_int32_t SMARTerEnabled:1; u_int32_t prCorrectUnconfiguredAreas:1; @@ -1899,6 +1973,39 @@ struct mrsas_ctrl_prop { u_int32_t enableSwZone:1; u_int32_t limitMaxRateSATA3G:1; u_int32_t reserved:2; +#else + u_int32_t reserved:2; + u_int32_t limitMaxRateSATA3G:1; + u_int32_t enableSwZone:1; + u_int32_t ignore64ldRestriction:1; + u_int32_t disableT10RebuildAssist:1; + u_int32_t disableImmediateIO:1; + u_int32_t enableAutoLockRecovery:1; + u_int32_t enableVirtualCache:1; + u_int32_t enableConfigAutoBalance:1; + u_int32_t forceSGPIOForQuadOnly:1; + u_int32_t useEmergencySparesforSMARTer:1; + u_int32_t useUnconfGoodForEmergency:1; + u_int32_t useGlobalSparesForEmergency:1; + u_int32_t preventPIImport:1; + u_int32_t enablePI:1; + u_int32_t useDiskActivityForLocate:1; + u_int32_t disableCacheBypass:1; + u_int32_t enableJBOD:1; + u_int32_t disableSpinDownHS:1; + u_int32_t allowBootWithPinnedCache:1; + u_int32_t disableOnlineCtrlReset:1; + u_int32_t enableSecretKeyControl:1; + u_int32_t autoEnhancedImport:1; + u_int32_t enableSpinDownUnconfigured:1; + u_int32_t SSDPatrolReadEnabled:1; + u_int32_t SSDSMARTerEnabled:1; + u_int32_t disableNCQ:1; + u_int32_t useFdeOnly:1; + u_int32_t prCorrectUnconfiguredAreas:1; + u_int32_t SMARTerEnabled:1; + u_int32_t copyBackDisabled:1; +#endif } OnOffProperties; u_int8_t autoSnapVDSpace; u_int8_t viewSpace; @@ -2170,6 +2277,7 @@ struct mrsas_ctrl_info { u_int16_t cacheMemorySize; /* 0x7A2 */ struct { /* 0x7A4 */ +#if _BYTE_ORDER == _LITTLE_ENDIAN u_int32_t supportPIcontroller:1; u_int32_t supportLdPIType1:1; u_int32_t supportLdPIType2:1; @@ -2194,6 +2302,30 @@ struct mrsas_ctrl_info { u_int32_t supportUnevenSpans:1; u_int32_t reserved:11; +#else + u_int32_t reserved:11; + u_int32_t supportUnevenSpans:1; + u_int32_t dedicatedHotSparesLimited:1; + u_int32_t headlessMode:1; + u_int32_t supportEmulatedDrives:1; + u_int32_t supportResetNow:1; + u_int32_t realTimeScheduler:1; + u_int32_t supportSSDPatrolRead:1; + u_int32_t supportPerfTuning:1; + u_int32_t disableOnlinePFKChange:1; + u_int32_t supportJBOD:1; + u_int32_t supportBootTimePFKChange:1; + u_int32_t supportSetLinkSpeed:1; + u_int32_t supportEmergencySpares:1; + u_int32_t supportSuspendResumeBGops:1; + u_int32_t blockSSDWriteCacheChange:1; + u_int32_t supportShieldState:1; + u_int32_t supportLdBBMInfo:1; + u_int32_t supportLdPIType3:1; + u_int32_t supportLdPIType2:1; + u_int32_t supportLdPIType1:1; + u_int32_t supportPIcontroller:1; +#endif } adapterOperations2; u_int8_t driverVersion[32]; /* 0x7A8 */ @@ -2206,6 +2338,7 @@ struct mrsas_ctrl_info { u_int8_t reserved5[2]; /* 0x7CD reserved */ struct { +#if _BYTE_ORDER == _LITTLE_ENDIAN u_int32_t peerIsPresent:1; u_int32_t peerIsIncompatible:1; @@ -2214,6 +2347,15 @@ struct mrsas_ctrl_info { u_int32_t ctrlPropIncompatible:1; u_int32_t premiumFeatureMismatch:1; u_int32_t reserved:26; +#else + u_int32_t reserved:26; + u_int32_t premiumFeatureMismatch:1; + u_int32_t ctrlPropIncompatible:1; + u_int32_t fwVersionMismatch:1; + u_int32_t hwIncompatible:1; + u_int32_t peerIsIncompatible:1; + u_int32_t peerIsPresent:1; +#endif } cluster; char clusterId[16]; /* 0x7D4 */ @@ -2221,6 +2363,7 @@ struct mrsas_ctrl_info { char reserved6[4]; /* 0x7E4 RESERVED FOR IOV */ struct { /* 0x7E8 */ +#if _BYTE_ORDER == _LITTLE_ENDIAN u_int32_t supportPersonalityChange:2; u_int32_t supportThermalPollInterval:1; u_int32_t supportDisableImmediateIO:1; @@ -2246,11 +2389,39 @@ struct mrsas_ctrl_info { u_int32_t supportExtendedSSCSize:1; u_int32_t useSeqNumJbodFP:1; u_int32_t reserved:7; +#else + u_int32_t reserved:7; + u_int32_t useSeqNumJbodFP:1; + u_int32_t supportExtendedSSCSize:1; + u_int32_t supportDiskCacheSettingForSysPDs:1; + u_int32_t supportCPLDUpdate:1; + u_int32_t supportTTYLogCompression:1; + u_int32_t discardCacheDuringLDDelete:1; + u_int32_t supportSecurityonJBOD:1; + u_int32_t supportCacheBypassModes:1; + u_int32_t supportDisableSESMonitoring:1; + u_int32_t supportForceFlash:1; + u_int32_t supportNVDRAM:1; + u_int32_t supportDrvActivityLEDSetting:1; + u_int32_t supportAllowedOpsforDrvRemoval:1; + u_int32_t supportHOQRebuild:1; + u_int32_t supportForceTo512e:1; + u_int32_t supportNVCacheErase:1; + u_int32_t supportDebugQueue:1; + u_int32_t supportSwZone:1; + u_int32_t supportCrashDump:1; + u_int32_t supportMaxExtLDs:1; + u_int32_t supportT10RebuildAssist:1; + u_int32_t supportDisableImmediateIO:1; + u_int32_t supportThermalPollInterval:1; + u_int32_t supportPersonalityChange:2; +#endif } adapterOperations3; u_int8_t pad_cpld[16]; struct { +#if _BYTE_ORDER == _LITTLE_ENDIAN u_int16_t ctrlInfoExtSupported:1; u_int16_t supportIbuttonLess:1; u_int16_t supportedEncAlgo:1; @@ -2260,6 +2431,17 @@ struct mrsas_ctrl_info { u_int16_t supportPdMapTargetId:1; u_int16_t FWSwapsBBUVPDInfo:1; u_int16_t reserved:8; +#else + u_int16_t reserved:8; + u_int16_t FWSwapsBBUVPDInfo:1; + u_int16_t supportPdMapTargetId:1; + u_int16_t supportSESCtrlInMultipathCfg:1; + u_int16_t imageUploadSupported:1; + u_int16_t supportEncryptedMfc:1; + u_int16_t supportedEncAlgo:1; + u_int16_t supportIbuttonLess:1; + u_int16_t ctrlInfoExtSupported:1; +#endif } adapterOperations4; u_int8_t pad[0x800 - 0x7FE]; /* 0x7FE */ @@ -2332,6 +2514,7 @@ struct mrsas_ctrl_info { typedef union _MFI_CAPABILITIES { struct { +#if _BYTE_ORDER == _LITTLE_ENDIAN u_int32_t support_fp_remote_lun:1; u_int32_t support_additional_msix:1; u_int32_t support_fastpath_wb:1; @@ -2342,6 +2525,18 @@ typedef union _MFI_CAPABILITIES { u_int32_t support_ext_queue_depth:1; u_int32_t support_ext_io_size:1; u_int32_t reserved:23; +#else + u_int32_t reserved:23; + u_int32_t support_ext_io_size:1; + u_int32_t support_ext_queue_depth:1; + u_int32_t security_protocol_cmds_fw:1; + u_int32_t support_core_affinity:1; + u_int32_t support_ndrive_r1_lb:1; + u_int32_t support_max_255lds:1; + u_int32_t support_fastpath_wb:1; + u_int32_t support_additional_msix:1; + u_int32_t support_fp_remote_lun:1; +#endif } mfi_capabilities; u_int32_t reg; } MFI_CAPABILITIES; @@ -2602,9 +2797,15 @@ union mrsas_frame { #pragma pack(1) union mrsas_evt_class_locale { struct { +#if _BYTE_ORDER == _LITTLE_ENDIAN u_int16_t locale; u_int8_t reserved; int8_t class; +#else + int8_t class; + u_int8_t reserved; + u_int16_t locale; +#endif } __packed members; u_int32_t word; @@ -2890,6 +3091,7 @@ typedef struct _MRSAS_DRV_PCI_COMMON_HEADER { typedef struct _MRSAS_DRV_PCI_LINK_CAPABILITY { union { struct { +#if _BYTE_ORDER == _LITTLE_ENDIAN u_int32_t linkSpeed:4; u_int32_t linkWidth:6; u_int32_t aspmSupport:2; @@ -2897,6 +3099,15 @@ typedef struct _MRSAS_DRV_PCI_LINK_CAPABILITY { u_int32_t l1ExitLatency:3; u_int32_t rsvdp:6; u_int32_t portNumber:8; +#else + u_int32_t portNumber:8; + u_int32_t rsvdp:6; + u_int32_t l1ExitLatency:3; + u_int32_t losExitLatency:3; + u_int32_t aspmSupport:2; + u_int32_t linkWidth:6; + u_int32_t linkSpeed:4; +#endif } bits; u_int32_t asUlong; @@ -2908,12 +3119,21 @@ typedef struct _MRSAS_DRV_PCI_LINK_CAPABILITY { typedef struct _MRSAS_DRV_PCI_LINK_STATUS_CAPABILITY { union { struct { +#if _BYTE_ORDER == _LITTLE_ENDIAN u_int16_t linkSpeed:4; u_int16_t negotiatedLinkWidth:6; u_int16_t linkTrainingError:1; u_int16_t linkTraning:1; u_int16_t slotClockConfig:1; u_int16_t rsvdZ:3; +#else + u_int16_t rsvdZ:3; + u_int16_t slotClockConfig:1; + u_int16_t linkTraning:1; + u_int16_t linkTrainingError:1; + u_int16_t negotiatedLinkWidth:6; + u_int16_t linkSpeed:4; +#endif } bits; u_int16_t asUshort; @@ -2967,6 +3187,7 @@ union MR_PD_DDF_TYPE { struct { union { struct { +#if _BYTE_ORDER == _LITTLE_ENDIAN u_int16_t forcedPDGUID:1; u_int16_t inVD:1; u_int16_t isGlobalSpare:1; @@ -2974,6 +3195,15 @@ union MR_PD_DDF_TYPE { u_int16_t isForeign:1; u_int16_t reserved:7; u_int16_t intf:4; +#else + u_int16_t intf:4; + u_int16_t reserved:7; + u_int16_t isForeign:1; + u_int16_t isSpare:1; + u_int16_t isGlobalSpare:1; + u_int16_t inVD:1; + u_int16_t forcedPDGUID:1; +#endif } pdType; u_int16_t type; }; @@ -3004,6 +3234,7 @@ union MR_PROGRESS { */ struct MR_PD_PROGRESS { struct { +#if _BYTE_ORDER == _LITTLE_ENDIAN u_int32_t rbld:1; u_int32_t patrol:1; u_int32_t clear:1; @@ -3011,6 +3242,15 @@ struct MR_PD_PROGRESS { u_int32_t erase:1; u_int32_t locate:1; u_int32_t reserved:26; *** 783 LINES SKIPPED *** From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 03:00:37 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4BD4853507B; Thu, 4 Feb 2021 03:00:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWNb91XPKz4hLH; Thu, 4 Feb 2021 03:00:37 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 262C92C2BB; Thu, 4 Feb 2021 03:00:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11430bgr075262; Thu, 4 Feb 2021 03:00:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11430bHc075261; Thu, 4 Feb 2021 03:00:37 GMT (envelope-from git) Date: Thu, 4 Feb 2021 03:00:37 GMT Message-Id: <202102040300.11430bHc075261@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alfredo Dal'Ava Junior" Subject: git: 37fed6c86003 - stable/13 - [POWERPC64BE] add mrsas driver to GENERIC64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alfredo X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 37fed6c860035396c306bffb07f2511c12af3f74 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 03:00:37 -0000 The branch stable/13 has been updated by alfredo: URL: https://cgit.FreeBSD.org/src/commit/?id=37fed6c860035396c306bffb07f2511c12af3f74 commit 37fed6c860035396c306bffb07f2511c12af3f74 Author: Alfredo Dal'Ava Junior AuthorDate: 2021-02-04 01:02:28 +0000 Commit: Alfredo Dal'Ava Junior CommitDate: 2021-02-04 05:58:19 +0000 [POWERPC64BE] add mrsas driver to GENERIC64 Submitted by: Andre Fernando da Silva Reviewed by: luporl, alfredo, kadesai (on email) Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D26531 --- sys/powerpc/conf/GENERIC64 | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/powerpc/conf/GENERIC64 b/sys/powerpc/conf/GENERIC64 index 0e201d718b3e..249823d4efa9 100644 --- a/sys/powerpc/conf/GENERIC64 +++ b/sys/powerpc/conf/GENERIC64 @@ -135,6 +135,7 @@ device ahc # AHA2940 and onboard AIC7xxx devices options AHC_ALLOW_MEMIO # Attempt to use memory mapped I/O device isp # Qlogic family device ispfw # Firmware module for Qlogic host adapters +device mrsas # LSI/Avago MegaRAID SAS/SATA, 6Gb/s and 12Gb/s device mpt # LSI-Logic MPT-Fusion device mps # LSI-Logic MPT-Fusion 2 device sym # NCR/Symbios/LSI Logic 53C8XX/53C1010/53C1510D From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 03:14:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5928F535CE2; Thu, 4 Feb 2021 03:14: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 4DWNvh1mDxz4jn6; Thu, 4 Feb 2021 03:14:56 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2F0502C849; Thu, 4 Feb 2021 03:14:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1143EuOY093520; Thu, 4 Feb 2021 03:14:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1143EujL093519; Thu, 4 Feb 2021 03:14:56 GMT (envelope-from git) Date: Thu, 4 Feb 2021 03:14:56 GMT Message-Id: <202102040314.1143EujL093519@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: d6898bc06ae9 - stable/12 - login.conf(5): set a default PATH for the daemon class MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d6898bc06ae9637ffa35705c5753fdecc518d73b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 03:14:56 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=d6898bc06ae9637ffa35705c5753fdecc518d73b commit d6898bc06ae9637ffa35705c5753fdecc518d73b Author: Andrew Gierth AuthorDate: 2020-02-05 04:27:08 +0000 Commit: Kyle Evans CommitDate: 2021-02-04 03:14:12 +0000 login.conf(5): set a default PATH for the daemon class This is a sensible default used by, e.g., cron(8), and useful if one wanted to honor it. This is a part of D21481. (cherry picked from commit ed6f64ff8a90eee579fefef510329b5e9f1f9a65) --- usr.bin/login/login.conf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/usr.bin/login/login.conf b/usr.bin/login/login.conf index 974d4485eadc..44174dd12d03 100644 --- a/usr.bin/login/login.conf +++ b/usr.bin/login/login.conf @@ -61,7 +61,13 @@ xuser:\ :tc=default: staff:\ :tc=default: + +# This PATH may be clobbered by individual applications. Notably, by default, +# rc(8), service(8), and cron(8) will all override it with a default PATH that +# may not include /usr/local/sbin and /usr/local/bin when starting services or +# jobs. daemon:\ + :path=/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin:\ :mail@:\ :memorylocked=128M:\ :tc=default: From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 03:14:57 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 73EBF535DB1; Thu, 4 Feb 2021 03:14: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 4DWNvj2tS1z4jVP; Thu, 4 Feb 2021 03:14:57 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 53DF62C7CD; Thu, 4 Feb 2021 03:14:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1143EvXW093540; Thu, 4 Feb 2021 03:14:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1143EvBT093539; Thu, 4 Feb 2021 03:14:57 GMT (envelope-from git) Date: Thu, 4 Feb 2021 03:14:57 GMT Message-Id: <202102040314.1143EvBT093539@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: f6512d13154a - stable/12 - init(8): set environment variables from the "daemon" class as well MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f6512d13154acdd324b09a5db8dc56a4dfeca27a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 03:14:57 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=f6512d13154acdd324b09a5db8dc56a4dfeca27a commit f6512d13154acdd324b09a5db8dc56a4dfeca27a Author: Andrew Gierth AuthorDate: 2020-02-05 04:27:44 +0000 Commit: Kyle Evans CommitDate: 2021-02-04 03:14:19 +0000 init(8): set environment variables from the "daemon" class as well Specifically, when running /etc/rc. This allows one to specify via login.conf(5) an environment that should be used when running services to ease, e.g., setting up env vars for an HTTP proxy consistently across cron and services alike. Future changes will extend cron(8)/service(8) to use environment vars pecified in login.conf(5) as well to promote a more cohesive experience. This is a part of D21481. (cherry picked from commit 21c1a93c048fdd9c276899e72dcb8dc93cc18e09) --- sbin/init/init.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sbin/init/init.c b/sbin/init/init.c index 4b75e5763c8d..1bb35dbe5803 100644 --- a/sbin/init/init.c +++ b/sbin/init/init.c @@ -2033,6 +2033,7 @@ setprocresources(const char *cname) login_cap_t *lc; if ((lc = login_getclassbyname(cname, NULL)) != NULL) { setusercontext(lc, (struct passwd*)NULL, 0, + LOGIN_SETENV | LOGIN_SETPRIORITY | LOGIN_SETRESOURCES | LOGIN_SETLOGINCLASS | LOGIN_SETCPUMASK); login_close(lc); From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 03:15:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AFBE5535DBB; Thu, 4 Feb 2021 03:15: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 4DWNvm0wvjz4jsp; Thu, 4 Feb 2021 03:14:59 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9C88F2C8DB; Thu, 4 Feb 2021 03:14:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1143ExCg093583; Thu, 4 Feb 2021 03:14:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1143ExiG093582; Thu, 4 Feb 2021 03:14:59 GMT (envelope-from git) Date: Thu, 4 Feb 2021 03:14:59 GMT Message-Id: <202102040314.1143ExiG093582@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: d5461e9a792a - stable/12 - cron(8): set the environment variables of the user and/or login class MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d5461e9a792ae0d2c4d606046dbe5b425045f5f2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 03:15:01 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=d5461e9a792ae0d2c4d606046dbe5b425045f5f2 commit d5461e9a792ae0d2c4d606046dbe5b425045f5f2 Author: Andrew Gierth AuthorDate: 2020-02-05 04:35:54 +0000 Commit: Kyle Evans CommitDate: 2021-02-04 03:14:33 +0000 cron(8): set the environment variables of the user and/or login class Prior to processing environment variable set in the crontab file as those should be of higher precedent, pull in the user or login class environment. This is another supporting feature for allowing one to configure system-wide settings that may affect both regular cron jobs as well as services. This is the final part of D21481. (cherry picked from commit 7466dbd684879cbe8d034f388f0c7da703e00c31) --- usr.sbin/cron/cron/do_command.c | 27 +++++++++++++++++++++------ usr.sbin/cron/crontab/crontab.5 | 12 ++++++++++-- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/usr.sbin/cron/cron/do_command.c b/usr.sbin/cron/cron/do_command.c index 5687323f8c64..214baf2133ed 100644 --- a/usr.sbin/cron/cron/do_command.c +++ b/usr.sbin/cron/cron/do_command.c @@ -42,6 +42,8 @@ static void child_process(entry *, user *); static WAIT_T wait_on_child(PID_T, const char *); +extern char *environ; + void do_command(e, u) entry *e; @@ -275,9 +277,11 @@ child_process(e, u) close(stdin_pipe[READ_PIPE]); close(stdout_pipe[WRITE_PIPE]); + environ = NULL; + # if defined(LOGIN_CAP) - /* Set user's entire context, but skip the environment - * as cron provides a separate interface for this + /* Set user's entire context, but note that PATH will + * be overridden later */ if ((pwd = getpwnam(usernm)) == NULL) pwd = getpwuid(e->uid); @@ -289,7 +293,7 @@ child_process(e, u) } if (pwd && setusercontext(lc, pwd, e->uid, - LOGIN_SETALL & ~(LOGIN_SETPATH|LOGIN_SETENV)) == 0) + LOGIN_SETALL) == 0) (void) endpwent(); else { /* fall back to the old method */ @@ -332,6 +336,18 @@ child_process(e, u) */ { char *shell = env_get("SHELL", e->envp); + char **p; + + /* Apply the environment from the entry, overriding existing + * values (this will always set PATH, LOGNAME, etc.) putenv + * should not fail unless malloc does. + */ + for (p = e->envp; *p; ++p) { + if (putenv(*p) != 0) { + warn("putenv"); + _exit(ERROR_EXIT); + } + } # if DEBUGGING if (DebugFlags & DTEST) { @@ -342,9 +358,8 @@ child_process(e, u) _exit(OK_EXIT); } # endif /*DEBUGGING*/ - execle(shell, shell, "-c", e->cmd, (char *)NULL, - e->envp); - warn("execle: couldn't exec `%s'", shell); + execl(shell, shell, "-c", e->cmd, (char *)NULL); + warn("execl: couldn't exec `%s'", shell); _exit(ERROR_EXIT); } break; diff --git a/usr.sbin/cron/crontab/crontab.5 b/usr.sbin/cron/crontab/crontab.5 index 9943adfaf356..adc2b2b5ae95 100644 --- a/usr.sbin/cron/crontab/crontab.5 +++ b/usr.sbin/cron/crontab/crontab.5 @@ -17,7 +17,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 24, 2019 +.Dd January 19, 2020 .Dt CRONTAB 5 .Os .Sh NAME @@ -82,10 +82,18 @@ and are set from the .Pa /etc/passwd line of the crontab's owner. +In addition, the environment variables of the +user's login class, with the exception of +.Ev PATH , +will be set from +.Pa /etc/login.conf.db +and +.Pa ~/.login_conf . .Ev HOME , .Ev PATH and -.Ev SHELL +.Ev SHELL , +and any variables set from the login class, may be overridden by settings in the crontab; .Ev LOGNAME may not. From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 03:14:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 316A5535CED; Thu, 4 Feb 2021 03:14: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 4DWNvk5R9fz4jsh; Thu, 4 Feb 2021 03:14:58 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7247F2C8DA; Thu, 4 Feb 2021 03:14:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1143EwLg093561; Thu, 4 Feb 2021 03:14:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1143EwZZ093560; Thu, 4 Feb 2021 03:14:58 GMT (envelope-from git) Date: Thu, 4 Feb 2021 03:14:58 GMT Message-Id: <202102040314.1143EwZZ093560@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: f7ba064978f8 - stable/12 - service(8): set the environment of the "daemon" class before invoking MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f7ba064978f84d07cd3ebbcbba3decc8a515cee3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 03:15:02 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=f7ba064978f84d07cd3ebbcbba3decc8a515cee3 commit f7ba064978f84d07cd3ebbcbba3decc8a515cee3 Author: Andrew Gierth AuthorDate: 2020-02-05 04:32:49 +0000 Commit: Kyle Evans CommitDate: 2021-02-04 03:14:27 +0000 service(8): set the environment of the "daemon" class before invoking As mentioned in r357562, this gives the user a single place to configure environment variables that need to be used for various services -- the "daemon" class -- for, e.g., configuring a system-wide HTTP proxy. This is a part of D21481. (cherry picked from commit 736a5a6d1dbbdae68eb102c2ba9c114aafd61821) --- usr.sbin/service/service.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/service/service.sh b/usr.sbin/service/service.sh index fa002fb0a817..42a50fcf61b9 100755 --- a/usr.sbin/service/service.sh +++ b/usr.sbin/service/service.sh @@ -165,7 +165,7 @@ cd / for dir in /etc/rc.d $local_startup; do if [ -x "$dir/$script" ]; then [ -n "$VERBOSE" ] && echo "$script is located in $dir" - exec env -i HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin $dir/$script "$@" + exec env -i -L 0/daemon HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin "$dir/$script" "$@" fi done From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 03:16:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 180BF536194; Thu, 4 Feb 2021 03:16: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 4DWNy30DVYz4kLw; Thu, 4 Feb 2021 03:16:59 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EEDEA2C8DC; Thu, 4 Feb 2021 03:16:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1143GwxI094013; Thu, 4 Feb 2021 03:16:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1143GwmV094012; Thu, 4 Feb 2021 03:16:58 GMT (envelope-from git) Date: Thu, 4 Feb 2021 03:16:58 GMT Message-Id: <202102040316.1143GwmV094012@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: ca9e7ac2fbbb - stable/13 - du: tests: use dollar-single quotes where appropriate MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ca9e7ac2fbbbb393a0221ff96ae03f9cac1745b3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 03:16:59 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=ca9e7ac2fbbbb393a0221ff96ae03f9cac1745b3 commit ca9e7ac2fbbbb393a0221ff96ae03f9cac1745b3 Author: Kyle Evans AuthorDate: 2021-01-29 03:01:12 +0000 Commit: Kyle Evans CommitDate: 2021-02-04 03:16:51 +0000 du: tests: use dollar-single quotes where appropriate No need for "foo$(printf "\t")", $'\t' is both more readable and still functional. (cherry picked from commit bf59049c27ef86669a94ffd43f7216107b5c57ff) --- usr.bin/du/tests/du_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/du/tests/du_test.sh b/usr.bin/du/tests/du_test.sh index 92a26deae02b..1c283b58fef4 100755 --- a/usr.bin/du/tests/du_test.sh +++ b/usr.bin/du/tests/du_test.sh @@ -46,7 +46,7 @@ H_flag_body() { local paths1='testdir/A/B testdir/A testdir/C testdir' local paths2='testdir/C/B testdir/C' - local lineprefix="^[0-9]+$(printf "\t")" + local lineprefix=$'^[0-9]+\t' local sep="\$\n${lineprefix}" atf_check mkdir testdir From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 09:40:45 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CBCF853DDEC for ; Thu, 4 Feb 2021 09:40:45 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic317-22.consmr.mail.gq1.yahoo.com (sonic317-22.consmr.mail.gq1.yahoo.com [98.137.66.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWYSr6nw0z3MHg for ; Thu, 4 Feb 2021 09:40:44 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1612431643; bh=27KDaiY4dasEdTcRKrylvg+mT6JgnxqH92j3DZQrFKV=; h=X-Sonic-MF:From:Subject:Date:To:From:Subject; b=UYYE88/FH+2RYEuMLuyNxhCKk9zeoEUH21yzsr46Ena5mG1FY7+GlI2kPEJKvzuAKovv2xGLk9JhdKGPBkC48XcqzxwYvF6Wwv5G3Wn3ksLK0v8CGZINlLUUxdvZbIq+L30H3IxEchi1AWl67upQ0d3I1enaQGO9OqQjmqXZB/IGjwUNqDAjjjQzHpYQWRzP3JL2huG1TLIFUh9St6jv1gz2VSeW/ocgv5wEohrcqQKAPk6bpdFEf6nPJowlGKiA5dN2X14nlx+xypliEe7iaxveK2Z8kn54kcVEIvdT1a9P4cR93sWfmzAHZLSVtugVEG8ji0FNj9KiJeX/hav62w== X-YMail-OSG: OQ7yVZ4VM1lwvEtftdQ6eaeZAF6_LaKGdNlbCgbZsScbp6KoCQkcPApdzqda26I 2XQWfOL8PIPlrG_A7HBALMnV5ajZrNpmQ4XnIaLqHeLG3AETnJPq9HJar2xw3FSQkyxp.YGBvRPm KwMGHIq8JkBUy9y8psa_KDKxJ9Pbo1Jx7MgrnlQJ9fRErCEoxL4tJfXVxicbIu8rcBjgBoLVva7m gj9FjBp9Ge0pxgSTU2JJoPs.3VgiA6gNbyfq3ZRF_AfQsCq4xEKEUPVOTkSnMW4DFBu.ZsfYlSBU e2ZgxiUsdRFTA9rHP8_RO3ySX7YZk9Q64pu896l.1kwKidjmq9Tn5A5N.1dG_YLENza19MrH1esr KLlvZaYPFTnX6uFoNzJLzO9hohRArAOTRJtTh0cHOJ9IJael1JleKyIbzmuRj5pWyLbmM4Vm19eE nNJCkk.G0yAUSYSwiwhGS1DPSgU7eyN_qDn0M5MkvDCdkRCavK1HtFyD2BEbPBKJIm4UOtgN9JX2 FK0Qxtjoc0E3hbADYllWm36wOqwjqbMM1h4A0KUPEOj1RXKOrmBDk2Rz05K2jAb39tXvkQcVU8_l PkCcjingLpS5dtoTlJwrJZRTbdoCUWbUNY95oGKklvZxGcNmj5GDH9Pyn1AJT0ZLnrOS.20O.ERS F_ZWDlwE.gNAtVAjJa22oquUfTiw.AqaoBIhjbmGUA9dMuzxoL9.d0vnXN4d76L.SMD_FbpJuNcf c.WTWuqGusmoDS_6ndOkQPzGxVnqizHSjQ9v2CaytjIY5G7kYa0bg3pC1oYmJakun.WX8ruGmbYD IWlkRtcUCWJ7kiw1SafWD4xWMsnHEg85oHS523zwTA8yvUb8Bizc5gKFvj2viPHd7i7Ujvgy72Y6 Esde3_SckfN80gefMGqmw8aM6iSANwc7mtamWIowTvEmpCx5Ac0VkCyFPxQdMt.elPMTxWoMyPwH LOpO2ltQ2AQk9FNJqRm3Zm2CP6rUB4Q8LltVuJBCq1.G2xagtwLT6u182WXbZbVi8OGTZfYhKhF5 d4znPkHlafCi_7Ue1tcFAyp8RZeTGqwA.EmYxpiouNfWIX7QptKfH7kzKq9ZX42IbeIbVJnBpllx 4hjRBNqfYsyAiaGZnmCbTh1WMql4zJDumgdDsccmRftPCWAlc3pLPu7ix2DjB0QN8OqtZajzfKED xhGNQQeK3EfIYbW9GYD_e_arhkCSsg44M2p6IhrfEmQhu5so8O617nSJFwIxW9odtldjGYonh6LB irIw90Z9bMxZmv2K81r5DGCvp3n.1M_Yd0BLr2rriCbrPm5hVzS.jmqEuCWuMQNu1Ecrz2DNfeBM KolG2p9PI7_3kkEJ4FLtXBTPZpfeoSCejyU2v__0GrmH57Scm7j6IQOhhrPtl_IzBFTI_GX9aZuX QROqfCYLgWnS0awdwOyBdf._xhmq4rjisfP58zs5CWdhNmPdF_S6JqNrJshdTUNrQdw0ZVIkUzvL hqVdzOgyy68a7A_vDeEiuL.0.Eho3C5ctItJTlSDyjffMioepXeNZ8YPD37KGUti5uz8KSuS49Xo CKOe5Ap7WKjCfub.uoYSH8R.Whn0LaGPfmlCQG7o0Jm5qnpclffIkECbClwek7dVbdJKLuAa.YB6 sL.6bD3MGGzPfBkjsiZiG0ZYCSaRB7Yl7oAaHQXYQKbxIM5pxC5rb7k_ss57MIiGuyr61NejyNdq 5336HU_aCvmtyASHT2F_mt.eLQW5bsBStvVdXaUUuQKgCAoaKYYA46xut2otQRuRgb3RKAy4ElAs 1N4Z7Ky6OQyZaLxtRjPWD_CxpUh1L3t1_5unRxHWT035Gi8Or56Ymy1hU6NUSw8DSJTcJzj0ngdL cyh8k18sc2APcBCyFfPl_ey6tyizXFhCr0RPqnqkdzk8K.WDH2Pjoky5iSqH5tW57tVMOnLr4EUJ fnmz2Z_fcVegbVabFlOyNiAG4wBmZjhJcvDp9naSoq6Bi0S0D294BzD3l6O_aZ2gMuZKlxCgZzRn DXBV1LQ86_oZgX7b2ynVrBk_oueagee.mP21wZW7vgA65J_iPBBsg_qVwEU2fOP.WnoIKXXV8MtC SXGml8ht0CBOJvzm_I6PXfSwBYmYYBPplpioKDcI7SHVIZUIJEBpsplcwxxMQpvbGeNa5DUQVK7l Y_2HtCnFSunzIzkoyTdN..qv2upC0b1ahPpBnBUwP675BPLcQAccadwzeJOJDfX7.uV0G34s6c8k oqnRS5w9c1f6_3K3D5LyTnq3Of4dpqr4U4fspDkxk6nyxxwJKg4cGDu9.1wdQn6oZx51mMkbn87O iG2nHmQivY0awjetkRuAJO5KE4eKvngeJIRt2S5uYgyJcQIXAPIYCfanaScm5nvifQuwot8tHI3f Xur_N.AsShgmSl2nAL4qfCox2JrUBAR4i.LT3Z6Bqt2uGI9P4CuSvpJcd9ZyRRlvbX9IjhjaCnqI aNB4fj7RjxIe7x80FV78bM4j6m7G2H1PGbxWeYINjHTKswGisoLRP1H6YwzJcLV5Glpq5OxW5a9K v6ZkAc4at X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic317.consmr.mail.gq1.yahoo.com with HTTP; Thu, 4 Feb 2021 09:40:43 +0000 Received: by smtp416.mail.ne1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID a9a0383bc5a774e699ed4f4e3f359269; Thu, 04 Feb 2021 09:40:37 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.40.0.2.32\)) Subject: Re: git: 10ed8ab4ab9b - stable/12 - opencrypto: Fix assignment of crypto completions to worker threads Message-Id: Date: Thu, 4 Feb 2021 01:40:35 -0800 To: Mark Johnston , dev-commits-src-branches@freebsd.org X-Mailer: Apple Mail (2.3654.40.0.2.32) References: X-Rspamd-Queue-Id: 4DWYSr6nw0z3MHg X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.50 / 15.00]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; DKIM_TRACE(0.00)[yahoo.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/20, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[98.137.66.148:from]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; SPAMHAUS_ZRD(0.00)[98.137.66.148:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[98.137.66.148:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.66.148:from]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-branches] X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 09:40:45 -0000 The use of atomic_fetchadd_64 broke the 32-bit powerpc and powerpcspe=20 stable/12 builds via the likes of: 07:16:19 crypto.o: In function `crypto_newsession': 07:16:19 /usr/src/sys/opencrypto/crypto.c:621: undefined reference to = `atomic_fetchadd_64' from the: + res->id =3D atomic_fetchadd_64(&sessid, 1); (No ci.freebsd.org results exist for stable/13 or for main yet.) =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 14:03:25 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F2BF5440CF; Thu, 4 Feb 2021 14:03: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 4DWgHx37vRz3tHr; Thu, 4 Feb 2021 14:03:25 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5EAF55055; Thu, 4 Feb 2021 14:03:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114E3P5C040110; Thu, 4 Feb 2021 14:03:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114E3Plx040109; Thu, 4 Feb 2021 14:03:25 GMT (envelope-from git) Date: Thu, 4 Feb 2021 14:03:25 GMT Message-Id: <202102041403.114E3Plx040109@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 63a3f5906676 - stable/13 - src.opts.mk: set MK_ZFS conditional on MK_OPENSSL MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 63a3f59066765c251de8cb80bf841b916b4f4061 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 14:03:25 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=63a3f59066765c251de8cb80bf841b916b4f4061 commit 63a3f59066765c251de8cb80bf841b916b4f4061 Author: Mitchell Horne AuthorDate: 2021-01-30 19:04:08 +0000 Commit: Mitchell Horne CommitDate: 2021-02-04 13:57:31 +0000 src.opts.mk: set MK_ZFS conditional on MK_OPENSSL PR: 252841 Reviewed by: kevans, freqlabs (cherry picked from commit e5cc1c47484160969e0a7c13cdbc71081d7dd60e) --- share/mk/src.opts.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index a7eddb12d2c8..6c8100bac548 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -432,6 +432,7 @@ MK_LDNS:= no MK_PKGBOOTSTRAP:= no MK_SVN:= no MK_SVNLITE:= no +MK_ZFS:= no .endif .if ${MK_LDNS} == "no" From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 14:03:26 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CDC205443F2; Thu, 4 Feb 2021 14:03: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 4DWgHy50hcz3t6p; Thu, 4 Feb 2021 14:03:26 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8642C4F3C; Thu, 4 Feb 2021 14:03:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114E3QKn040133; Thu, 4 Feb 2021 14:03:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114E3QqN040132; Thu, 4 Feb 2021 14:03:26 GMT (envelope-from git) Date: Thu, 4 Feb 2021 14:03:26 GMT Message-Id: <202102041403.114E3QqN040132@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: b6cbf02ad87e - stable/13 - src.conf.5: regenerate MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b6cbf02ad87e2aa088aefb3176b94225890ce1b6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 14:03:27 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=b6cbf02ad87e2aa088aefb3176b94225890ce1b6 commit b6cbf02ad87e2aa088aefb3176b94225890ce1b6 Author: Mitchell Horne AuthorDate: 2021-02-04 14:00:11 +0000 Commit: Mitchell Horne CommitDate: 2021-02-04 14:02:56 +0000 src.conf.5: regenerate Direct commit to stable/13. --- share/man/man5/src.conf.5 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index 6c02df1ac7de..a3802b59a3f5 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd January 30, 2021 +.Dd February 4, 2021 .Dt SRC.CONF 5 .Os .Sh NAME @@ -400,6 +400,8 @@ When set, it enforces these options: .Va WITHOUT_SVNLITE .It .Va WITHOUT_UNBOUND +.It +.Va WITHOUT_ZFS .El .Pp When set, these options are also in effect: @@ -1295,6 +1297,8 @@ When set, it enforces these options: .Va WITHOUT_SVNLITE .It .Va WITHOUT_UNBOUND +.It +.Va WITHOUT_ZFS .El .Pp When set, these options are also in effect: From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 14:23:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 518A55449E3; Thu, 4 Feb 2021 14:23:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWgkX1y2wz3vHr; Thu, 4 Feb 2021 14:23:00 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 35C1755B1; Thu, 4 Feb 2021 14:23:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114EN0L3066371; Thu, 4 Feb 2021 14:23:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114EN0qv066370; Thu, 4 Feb 2021 14:23:00 GMT (envelope-from git) Date: Thu, 4 Feb 2021 14:23:00 GMT Message-Id: <202102041423.114EN0qv066370@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: 683d086626cd - stable/13 - bridge: fix STP roles and protos strings 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: 683d086626cd41a1c22c7ab5cd1c3c52591c5bf7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 14:23:00 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=683d086626cd41a1c22c7ab5cd1c3c52591c5bf7 commit 683d086626cd41a1c22c7ab5cd1c3c52591c5bf7 Author: Jonah Caplan AuthorDate: 2021-01-30 13:54:09 +0000 Commit: Kristof Provost CommitDate: 2021-02-04 14:22:45 +0000 bridge: fix STP roles and protos strings Add the missing commas that got lost in e5539fb618cc7. PR: 252532 Reviewd by: kp@, donner@, freqlabs@ MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D28425 (cherry picked from commit 88be0e11205e4a2dc77e29f7b4a2e82b8d7c9a5c) --- sys/net/if_bridgevar.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/net/if_bridgevar.h b/sys/net/if_bridgevar.h index fef252821be7..c12ee4598548 100644 --- a/sys/net/if_bridgevar.h +++ b/sys/net/if_bridgevar.h @@ -278,15 +278,15 @@ struct ifbpstpconf { "discarding" #define STP_PROTOS \ - "stp" \ - "-" \ + "stp", \ + "-", \ "rstp" #define STP_ROLES \ - "disabled" \ - "root" \ - "designated" \ - "alternate" \ + "disabled", \ + "root", \ + "designated", \ + "alternate", \ "backup" #define PV2ID(pv, epri, eaddr) do { \ From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 14:23:01 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 65C1B544D02; Thu, 4 Feb 2021 14:23:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWgkY2QCCz3v7K; Thu, 4 Feb 2021 14:23:01 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4609F55B2; Thu, 4 Feb 2021 14:23:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114EN1AB066402; Thu, 4 Feb 2021 14:23:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114EN1cZ066401; Thu, 4 Feb 2021 14:23:01 GMT (envelope-from git) Date: Thu, 4 Feb 2021 14:23:01 GMT Message-Id: <202102041423.114EN1cZ066401@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: 620455079f47 - stable/13 - ipfw(8) crashes when ext6hdr option is omitted 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: 620455079f47a9d7361b46b965abf273ac6787de Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 14:23:01 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=620455079f47a9d7361b46b965abf273ac6787de commit 620455079f47a9d7361b46b965abf273ac6787de Author: Evgeniy Khramtsov <2khramtsov@gmail.com> AuthorDate: 2021-02-01 19:03:57 +0000 Commit: Kristof Provost CommitDate: 2021-02-04 14:22:45 +0000 ipfw(8) crashes when ext6hdr option is omitted Verify that the option is passed, error out if it's not. The problem can be trivially triggered with `ipfw add allow ext6hdr`. PR: 253169 Reviewed by: kp@ MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D28447 (cherry picked from commit 682c31db4ecfb8fc6cac0e8ad4945c03379ea3d1) --- sbin/ipfw/ipfw2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 67303d8bb1e7..19f7f331091d 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -4961,6 +4961,7 @@ read_options: break; case TOK_EXT6HDR: + NEED1("missing extension header"); fill_ext6hdr( cmd, *av ); av++; break; From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 14:23:03 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 578B1544D81; Thu, 4 Feb 2021 14:23:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWgkZ4TsNz3vHy; Thu, 4 Feb 2021 14:23:02 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 66E695536; Thu, 4 Feb 2021 14:23:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114EN2x3066486; Thu, 4 Feb 2021 14:23:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114EN2Zb066479; Thu, 4 Feb 2021 14:23:02 GMT (envelope-from git) Date: Thu, 4 Feb 2021 14:23:02 GMT Message-Id: <202102041423.114EN2Zb066479@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: ad6079266683 - stable/12 - bridge: fix STP roles and protos strings 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/12 X-Git-Reftype: branch X-Git-Commit: ad60792666831d6beafbc555cc1fec0305d7f8f5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 14:23:06 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ad60792666831d6beafbc555cc1fec0305d7f8f5 commit ad60792666831d6beafbc555cc1fec0305d7f8f5 Author: Jonah Caplan AuthorDate: 2021-01-30 13:54:09 +0000 Commit: Kristof Provost CommitDate: 2021-02-04 08:13:43 +0000 bridge: fix STP roles and protos strings Add the missing commas that got lost in e5539fb618cc7. PR: 252532 Reviewd by: kp@, donner@, freqlabs@ MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D28425 (cherry picked from commit 88be0e11205e4a2dc77e29f7b4a2e82b8d7c9a5c) --- sys/net/if_bridgevar.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/net/if_bridgevar.h b/sys/net/if_bridgevar.h index fef252821be7..c12ee4598548 100644 --- a/sys/net/if_bridgevar.h +++ b/sys/net/if_bridgevar.h @@ -278,15 +278,15 @@ struct ifbpstpconf { "discarding" #define STP_PROTOS \ - "stp" \ - "-" \ + "stp", \ + "-", \ "rstp" #define STP_ROLES \ - "disabled" \ - "root" \ - "designated" \ - "alternate" \ + "disabled", \ + "root", \ + "designated", \ + "alternate", \ "backup" #define PV2ID(pv, epri, eaddr) do { \ From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 14:23:04 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E973E544D8A; Thu, 4 Feb 2021 14:23:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWgkc04xMz3vWd; Thu, 4 Feb 2021 14:23:03 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 83DFE5537; Thu, 4 Feb 2021 14:23:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114EN36t066541; Thu, 4 Feb 2021 14:23:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114EN3ZC066540; Thu, 4 Feb 2021 14:23:03 GMT (envelope-from git) Date: Thu, 4 Feb 2021 14:23:03 GMT Message-Id: <202102041423.114EN3ZC066540@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: d2eeacf7728a - stable/12 - ipfw(8) crashes when ext6hdr option is omitted 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/12 X-Git-Reftype: branch X-Git-Commit: d2eeacf7728a04ee04be8a69b2b1bf375ff24994 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 14:23:05 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d2eeacf7728a04ee04be8a69b2b1bf375ff24994 commit d2eeacf7728a04ee04be8a69b2b1bf375ff24994 Author: Evgeniy Khramtsov <2khramtsov@gmail.com> AuthorDate: 2021-02-01 19:03:57 +0000 Commit: Kristof Provost CommitDate: 2021-02-04 08:13:46 +0000 ipfw(8) crashes when ext6hdr option is omitted Verify that the option is passed, error out if it's not. The problem can be trivially triggered with `ipfw add allow ext6hdr`. PR: 253169 Reviewed by: kp@ MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D28447 (cherry picked from commit 682c31db4ecfb8fc6cac0e8ad4945c03379ea3d1) --- sbin/ipfw/ipfw2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 85347b1add03..30a4da92343f 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -4961,6 +4961,7 @@ read_options: break; case TOK_EXT6HDR: + NEED1("missing extension header"); fill_ext6hdr( cmd, *av ); av++; break; From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 14:44:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0879E545A87; Thu, 4 Feb 2021 14:44: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 4DWhCt6dhfz4S6J; Thu, 4 Feb 2021 14:44:58 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D6B5E5A16; Thu, 4 Feb 2021 14:44:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114Eiwma092740; Thu, 4 Feb 2021 14:44:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114Eiw8J092739; Thu, 4 Feb 2021 14:44:58 GMT (envelope-from git) Date: Thu, 4 Feb 2021 14:44:58 GMT Message-Id: <202102041444.114Eiw8J092739@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: 40a37d24a8ed - stable/12 - Revert "opencrypto: Fix assignment of crypto completions to worker threads" 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/12 X-Git-Reftype: branch X-Git-Commit: 40a37d24a8ed2d6e81919ed3c124494cbcf5c527 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 14:44:59 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=40a37d24a8ed2d6e81919ed3c124494cbcf5c527 commit 40a37d24a8ed2d6e81919ed3c124494cbcf5c527 Author: Mark Johnston AuthorDate: 2021-02-04 14:43:10 +0000 Commit: Mark Johnston CommitDate: 2021-02-04 14:44:53 +0000 Revert "opencrypto: Fix assignment of crypto completions to worker threads" atomic_fetchadd_64 is not available on all platforms on stable/12. This reverts commit 10ed8ab4ab9bd0239f2913ac2f35af9b9f76221d. Reported by: Mark Millard --- sys/opencrypto/crypto.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index bc23056e86ad..dfd22662e87f 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -94,7 +94,6 @@ struct crypto_session { void *softc; uint32_t hid; uint32_t capabilities; - uint64_t id; }; SDT_PROVIDER_DEFINE(opencrypto); @@ -573,7 +572,6 @@ again: int crypto_newsession(crypto_session_t *cses, struct cryptoini *cri, int crid) { - static uint64_t sessid = 0; crypto_session_t res; void *softc_mem; struct cryptocap *cap; @@ -618,7 +616,6 @@ restart: softc_mem = malloc(softc_size, M_CRYPTO_DATA, M_WAITOK | M_ZERO); res = uma_zalloc(cryptoses_zone, M_WAITOK | M_ZERO); res->softc = softc_mem; - res->id = atomic_fetchadd_64(&sessid, 1); CRYPTO_DRIVER_LOCK(); cap = crypto_checkdriver(hid); @@ -1019,7 +1016,7 @@ crypto_dispatch(struct cryptop *crp) binuptime(&crp->crp_tstamp); #endif - crp->crp_retw_id = crp->crp_session->id % crypto_workers_num; + crp->crp_retw_id = ((uintptr_t)crp->crp_session) % crypto_workers_num; if (CRYPTOP_ASYNC(crp)) { if (crp->crp_flags & CRYPTO_F_ASYNC_KEEPORDER) { From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 14:46:18 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A776F545B31 for ; Thu, 4 Feb 2021 14:46:18 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWhFP4cgKz4SQc for ; Thu, 4 Feb 2021 14:46:17 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk1-x72d.google.com with SMTP id k193so3479077qke.6 for ; Thu, 04 Feb 2021 06:46:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=R+V4NSn4noplHzoE/5NbYACtCtuH5y3iU8vbyRaGw7Q=; b=CxbCaHX/8IM69kapH3bBZrcaZh2oZLXABQMaqafG8wQn7e2c8jHqkMIHsKQRvKSPC2 geFMeK4Hh0+CswXOAzauBlGIGMti8fAKxutDBWwtx6DCeykq/AVK5OkLmbnjc206iDQ/ e2DNEM8DTfLpdNLi7V2PyKnmxNcVZ1LpQ3omEs0br2S/Bj8/LFbU5vkMtzhw9nq0+YOa fsX9pXCNBfHlKxr69inX51A5B20DJHEBrWETw7hmD149iqJZ30xJy9fwdIZhkl2PaBLf orRVNg6uB5hCsE5wQbXKOnFNtxNLgxbpxna1BfEE0wQUZQLnV0ss4vjP418KjIKT4jXi LRLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=R+V4NSn4noplHzoE/5NbYACtCtuH5y3iU8vbyRaGw7Q=; b=rNP0+WS/EIklvF7BdVJa/19MhYIio9poMg0UIJMKGIUrm00xhS2fODnmwFPWB8M3CU NP3rVGcUUkk1q5PKVcnRhbwHLyCgPKSl3B8c3z9aqgdZQxO5OPPnWVtxIVqAs2AJMm3P +JOY/7kxz6HmN+RXnoC9QnivXBRK3CFhhQL8xl2+6U4az5JVMrRGhMA9C8zYGwrIcp+d EM4p0JyYVFbymbt0YeaWlBQiQyBGvzkApZS0ntRbGLi3wUB9UeXoshpfPdG8sFX+JLtl q0Q68gxbuP0znFrERY9tTseschG63jNdWxiaroXWVrhKLTi3HRRxnyVyC4zMqXypfjD/ eEaQ== X-Gm-Message-State: AOAM531snj4ffGQ3BfeOPXh6QrixOFurFgn5jaQ3nWfkd0fFSqEwrPqB s/bIOZXZS8Bl6zxT6kN7tMQ= X-Google-Smtp-Source: ABdhPJznsQtHhVrBOwyoscm+6K5rWUC44Fe0Ygxt0rJfGkyEUB489LcTvUlJHkZAYpSgjUOALfJGMg== X-Received: by 2002:a37:702:: with SMTP id 2mr7517324qkh.50.1612449976965; Thu, 04 Feb 2021 06:46:16 -0800 (PST) Received: from raichu ([142.126.164.150]) by smtp.gmail.com with ESMTPSA id t14sm5294189qkt.50.2021.02.04.06.46.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 06:46:16 -0800 (PST) Sender: Mark Johnston Date: Thu, 4 Feb 2021 09:46:14 -0500 From: Mark Johnston To: Mark Millard Cc: dev-commits-src-branches@freebsd.org Subject: Re: git: 10ed8ab4ab9b - stable/12 - opencrypto: Fix assignment of crypto completions to worker threads Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4DWhFP4cgKz4SQc X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=CxbCaHX/; dmarc=none; spf=pass (mx1.freebsd.org: domain of markjdb@gmail.com designates 2607:f8b0:4864:20::72d as permitted sender) smtp.mailfrom=markjdb@gmail.com X-Spamd-Result: default: False [-0.70 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; FREEMAIL_TO(0.00)[yahoo.com]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::72d:from]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[markj@freebsd.org,markjdb@gmail.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(1.00)[1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-branches@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::72d:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::72d:from]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-branches] X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 14:46:18 -0000 On Thu, Feb 04, 2021 at 01:40:35AM -0800, Mark Millard wrote: > > The use of atomic_fetchadd_64 broke the 32-bit powerpc and powerpcspe > stable/12 builds via the likes of: > > 07:16:19 crypto.o: In function `crypto_newsession': > 07:16:19 /usr/src/sys/opencrypto/crypto.c:621: undefined reference to `atomic_fetchadd_64' > > from the: > > + res->id = atomic_fetchadd_64(&sessid, 1); Thanks for the report, I reverted the change on stable/12 for now. > (No ci.freebsd.org results exist for stable/13 or for main yet.) atomic_fetchadd_64 should be available on all platforms in 13 and later. From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 16:18:10 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1FC60547EA5; Thu, 4 Feb 2021 16:18:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWkHQ0R1fz4YPm; Thu, 4 Feb 2021 16:18:10 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EB37F6BAE; Thu, 4 Feb 2021 16:18:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114GI9rD011044; Thu, 4 Feb 2021 16:18:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114GI9YP011043; Thu, 4 Feb 2021 16:18:09 GMT (envelope-from git) Date: Thu, 4 Feb 2021 16:18:09 GMT Message-Id: <202102041618.114GI9YP011043@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: b680dba47653 - stable/13 - riscv: add SBI system reset extension MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b680dba47653451aeda9292dd6dcda2f79b905e7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 16:18:10 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=b680dba47653451aeda9292dd6dcda2f79b905e7 commit b680dba47653451aeda9292dd6dcda2f79b905e7 Author: Mitchell Horne AuthorDate: 2021-01-27 21:27:15 +0000 Commit: Mitchell Horne CommitDate: 2021-02-04 16:17:31 +0000 riscv: add SBI system reset extension (cherry picked from commit 9bae4ce661c59be88fec89b2531148e36dd1a23e) (cherry picked from commit a6405133b7e14929f8e8e61cf30d7152b1410e59) --- sys/riscv/include/sbi.h | 28 +++++++++++++++++++++------- sys/riscv/riscv/sbi.c | 34 ++++++++++++++++++++++++++-------- sys/riscv/riscv/vm_machdep.c | 2 +- 3 files changed, 48 insertions(+), 16 deletions(-) diff --git a/sys/riscv/include/sbi.h b/sys/riscv/include/sbi.h index 50cacb3e6e5a..9d3f4076dcb2 100644 --- a/sys/riscv/include/sbi.h +++ b/sys/riscv/include/sbi.h @@ -99,6 +99,15 @@ #define SBI_HSM_STATUS_START_PENDING 2 #define SBI_HSM_STATUS_STOP_PENDING 3 +/* System Reset (SRST) Extension */ +#define SBI_EXT_ID_SRST 0x53525354 +#define SBI_SRST_SYSTEM_RESET 0 +#define SBI_SRST_TYPE_SHUTDOWN 0 +#define SBI_SRST_TYPE_COLD_REBOOT 1 +#define SBI_SRST_TYPE_WARM_REBOOT 2 +#define SBI_SRST_REASON_NONE 0 +#define SBI_SRST_REASON_SYSTEM_FAILURE 1 + /* Legacy Extensions */ #define SBI_SET_TIMER 0 #define SBI_CONSOLE_PUTCHAR 1 @@ -199,6 +208,18 @@ void sbi_hsm_hart_stop(void); */ int sbi_hsm_hart_status(u_long hart); +/* System Reset extension functions. */ + +/* + * Reset the system based on the following 'type' and 'reason' chosen from: + * - SBI_SRST_TYPE_SHUTDOWN + * - SBI_SRST_TYPE_COLD_REBOOT + * - SBI_SRST_TYPE_WARM_REBOOT + * - SBI_SRST_REASON_NONE + * - SBI_SRST_REASON_SYSTEM_FAILURE + */ +void sbi_system_reset(u_long reset_type, u_long reset_reason); + /* Legacy extension functions. */ static __inline void sbi_console_putchar(int ch) @@ -218,13 +239,6 @@ sbi_console_getchar(void) return (SBI_CALL0(SBI_CONSOLE_GETCHAR, 0).error); } -static __inline void -sbi_shutdown(void) -{ - - (void)SBI_CALL0(SBI_SHUTDOWN, 0); -} - void sbi_print_version(void); void sbi_init(void); diff --git a/sys/riscv/riscv/sbi.c b/sys/riscv/riscv/sbi.c index d529d2d08351..6897fce9cad3 100644 --- a/sys/riscv/riscv/sbi.c +++ b/sys/riscv/riscv/sbi.c @@ -49,6 +49,7 @@ u_long sbi_impl_version; static bool has_time_extension = false; static bool has_ipi_extension = false; static bool has_rfnc_extension = false; +static bool has_srst_extension = false; static struct sbi_ret sbi_get_spec_version(void) @@ -90,7 +91,18 @@ static void sbi_shutdown_final(void *dummy __unused, int howto) { if ((howto & RB_POWEROFF) != 0) - sbi_shutdown(); + sbi_system_reset(SBI_SRST_TYPE_SHUTDOWN, SBI_SRST_REASON_NONE); +} + +void +sbi_system_reset(u_long reset_type, u_long reset_reason) +{ + /* Use the SRST extension, if available. */ + if (has_srst_extension) { + (void)SBI_CALL2(SBI_EXT_ID_SRST, SBI_SRST_SYSTEM_RESET, + reset_type, reset_reason); + } + (void)SBI_CALL0(SBI_SHUTDOWN, 0); } void @@ -111,10 +123,12 @@ sbi_print_version(void) printf("SBI: Berkely Boot Loader %lu\n", sbi_impl_version); break; case (SBI_IMPL_ID_XVISOR): - printf("SBI: eXtensible Versatile hypervISOR %lu\n", sbi_impl_version); + printf("SBI: eXtensible Versatile hypervISOR %lu\n", + sbi_impl_version); break; case (SBI_IMPL_ID_KVM): - printf("SBI: Kernel-based Virtual Machine %lu\n", sbi_impl_version); + printf("SBI: Kernel-based Virtual Machine %lu\n", + sbi_impl_version); break; case (SBI_IMPL_ID_RUSTSBI): printf("SBI: RustSBI %lu\n", sbi_impl_version); @@ -206,8 +220,9 @@ sbi_remote_sfence_vma_asid(const u_long *hart_mask, u_long start, u_long size, /* Use the RFENCE legacy replacement extension, if available. */ if (has_rfnc_extension) { - ret = SBI_CALL5(SBI_EXT_ID_RFNC, SBI_RFNC_REMOTE_SFENCE_VMA_ASID, - *hart_mask, 0, start, size, asid); + ret = SBI_CALL5(SBI_EXT_ID_RFNC, + SBI_RFNC_REMOTE_SFENCE_VMA_ASID, *hart_mask, 0, start, + size, asid); MPASS(ret.error == SBI_SUCCESS); } else { (void)SBI_CALL4(SBI_REMOTE_SFENCE_VMA_ASID, 0, @@ -220,7 +235,8 @@ sbi_hsm_hart_start(u_long hart, u_long start_addr, u_long priv) { struct sbi_ret ret; - ret = SBI_CALL3(SBI_EXT_ID_HSM, SBI_HSM_HART_START, hart, start_addr, priv); + ret = SBI_CALL3(SBI_EXT_ID_HSM, SBI_HSM_HART_START, hart, start_addr, + priv); return (ret.error != 0 ? (int)ret.error : 0); } @@ -273,6 +289,8 @@ sbi_init(void) has_ipi_extension = true; if (sbi_probe_extension(SBI_EXT_ID_RFNC) != 0) has_rfnc_extension = true; + if (sbi_probe_extension(SBI_EXT_ID_SRST) != 0) + has_srst_extension = true; /* * Probe for legacy extensions. We still rely on many of them to be @@ -295,8 +313,8 @@ sbi_init(void) KASSERT(has_rfnc_extension || sbi_probe_extension(SBI_REMOTE_SFENCE_VMA_ASID) != 0, ("SBI doesn't implement sbi_remote_sfence_vma_asid()")); - KASSERT(sbi_probe_extension(SBI_SHUTDOWN) != 0, - ("SBI doesn't implement sbi_shutdown()")); + KASSERT(has_srst_extension || sbi_probe_extension(SBI_SHUTDOWN) != 0, + ("SBI doesn't implement a shutdown or reset extension")); } static void diff --git a/sys/riscv/riscv/vm_machdep.c b/sys/riscv/riscv/vm_machdep.c index f38f1c04caa8..094662413f4e 100644 --- a/sys/riscv/riscv/vm_machdep.c +++ b/sys/riscv/riscv/vm_machdep.c @@ -110,7 +110,7 @@ void cpu_reset(void) { - sbi_shutdown(); + sbi_system_reset(SBI_SRST_TYPE_COLD_REBOOT, SBI_SRST_REASON_NONE); while(1); } From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 16:39:14 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 438EB528610; Thu, 4 Feb 2021 16:39: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 4DWklk1Ww6z4ZdT; Thu, 4 Feb 2021 16:39:14 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 279AA6D46; Thu, 4 Feb 2021 16:39:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114GdE3n037076; Thu, 4 Feb 2021 16:39:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114GdEw9037075; Thu, 4 Feb 2021 16:39:14 GMT (envelope-from git) Date: Thu, 4 Feb 2021 16:39:14 GMT Message-Id: <202102041639.114GdEw9037075@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 1cb79e809a0f - stable/13 - wg(4): Fix Copyright statement in man page MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1cb79e809a0f091660df6bc1bc6ed0332563ab7b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 16:39:14 -0000 The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=1cb79e809a0f091660df6bc1bc6ed0332563ab7b commit 1cb79e809a0f091660df6bc1bc6ed0332563ab7b Author: Gordon Bergling AuthorDate: 2021-02-02 19:16:52 +0000 Commit: Gordon Bergling CommitDate: 2021-02-04 16:38:16 +0000 wg(4): Fix Copyright statement in man page (cherry picked from commit 064e52c2d874abc83dd2af61644d14dc90e26ec3) --- share/man/man4/wg.4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/man/man4/wg.4 b/share/man/man4/wg.4 index e343dceaa0d6..096aee50148a 100644 --- a/share/man/man4/wg.4 +++ b/share/man/man4/wg.4 @@ -1,4 +1,4 @@ -.\" Copyright (c) 2020 Gordon Bergling .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 16:39:13 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2B30A5284A7; Thu, 4 Feb 2021 16:39: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 4DWklj0hkJz4ZbC; Thu, 4 Feb 2021 16:39:13 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0A91C68F5; Thu, 4 Feb 2021 16:39:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114GdCE2037058; Thu, 4 Feb 2021 16:39:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114GdC1b037057; Thu, 4 Feb 2021 16:39:12 GMT (envelope-from git) Date: Thu, 4 Feb 2021 16:39:12 GMT Message-Id: <202102041639.114GdC1b037057@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 4295dd589e05 - stable/13 - Add a wg(4) manual page MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4295dd589e05de2d20c97381318efd8cd001a6c5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 16:39:13 -0000 The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=4295dd589e05de2d20c97381318efd8cd001a6c5 commit 4295dd589e05de2d20c97381318efd8cd001a6c5 Author: Gordon Bergling AuthorDate: 2021-02-02 19:13:53 +0000 Commit: Gordon Bergling CommitDate: 2021-02-04 16:37:18 +0000 Add a wg(4) manual page Reviewed by: brueffer, donner, debdrup, ygy MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D27783 (cherry picked from commit e59d9cb412846cb5d2bc4c641d3cc44d243cd52d) --- share/man/man4/Makefile | 1 + share/man/man4/wg.4 | 244 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 245 insertions(+) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index ffc7a08292e9..b66dcf135733 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -583,6 +583,7 @@ MAN= aac.4 \ vtnet.4 \ watchdog.4 \ ${_wbwd.4} \ + wg.4 \ witness.4 \ wlan.4 \ wlan_acl.4 \ diff --git a/share/man/man4/wg.4 b/share/man/man4/wg.4 new file mode 100644 index 000000000000..e343dceaa0d6 --- /dev/null +++ b/share/man/man4/wg.4 @@ -0,0 +1,244 @@ +.\" Copyright (c) 2020 Gordon Bergling Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D14DA529FC7; Thu, 4 Feb 2021 17:41: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 4DWm7T5cqNz4fmJ; Thu, 4 Feb 2021 17:41:25 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B3BAE7F05; Thu, 4 Feb 2021 17:41:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114HfPKp026750; Thu, 4 Feb 2021 17:41:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114HfPK1026749; Thu, 4 Feb 2021 17:41:25 GMT (envelope-from git) Date: Thu, 4 Feb 2021 17:41:25 GMT Message-Id: <202102041741.114HfPK1026749@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: 9c829699aa3c - stable/13 - zfs: update zfs_config.h to match OpenZFS gf11b09dec MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9c829699aa3cae4fa2b736de489c8aac1da068e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 17:41:25 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=9c829699aa3cae4fa2b736de489c8aac1da068e6 commit 9c829699aa3cae4fa2b736de489c8aac1da068e6 Author: Martin Matuska AuthorDate: 2021-02-01 21:08:19 +0000 Commit: Martin Matuska CommitDate: 2021-02-04 17:40:55 +0000 zfs: update zfs_config.h to match OpenZFS gf11b09dec Update zfs_config.h to match latest merge in FreeBSD The version string is declared as 2.0.0-FreeBSD_gf11b09dec to provide more information about the loaded module: - the OpenZFS version in base is 2.0 - we are using the in tree-module ("FreeBSD") - the last merged OpenZFS git revision ("gf11b09dec") With future merges the git revision tag should be updated. As we are merging from OpenZFS master branch and already include features like dRAID, referencing patchlevel releases (2.0.1, 2.0.2) is pointless. Reviewed by: freqlabs Differential Revision: https://reviews.freebsd.org/D28447 (cherry picked from commit 8fb966790e1c87276cc26932efee1b29c046cb8a) --- sys/modules/zfs/zfs_config.h | 131 ++++++++++++++++++++++++++++++++----------- 1 file changed, 97 insertions(+), 34 deletions(-) diff --git a/sys/modules/zfs/zfs_config.h b/sys/modules/zfs/zfs_config.h index 6d73d1b8a341..358ecb609a05 100644 --- a/sys/modules/zfs/zfs_config.h +++ b/sys/modules/zfs/zfs_config.h @@ -21,9 +21,6 @@ /* bdi_setup_and_register() wants 2 args */ /* #undef HAVE_2ARGS_BDI_SETUP_AND_REGISTER */ -/* lookup_bdev() wants 2 args */ -/* #undef HAVE_2ARGS_LOOKUP_BDEV */ - /* vfs_getattr wants 2 args */ /* #undef HAVE_2ARGS_VFS_GETATTR */ @@ -85,6 +82,12 @@ #define HAVE_AVX512VL 1 #endif +/* bdev_check_media_change() exists */ +/* #undef HAVE_BDEV_CHECK_MEDIA_CHANGE */ + +/* bdev_whole() is available */ +/* #undef HAVE_BDEV_WHOLE */ + /* bio->bi_opf is defined */ /* #undef HAVE_BIO_BI_OPF */ @@ -94,6 +97,9 @@ /* bio has bi_iter */ /* #undef HAVE_BIO_BVEC_ITER */ +/* bio_*_io_acct() available */ +/* #undef HAVE_BIO_IO_ACCT */ + /* bio_set_dev() is available */ /* #undef HAVE_BIO_SET_DEV */ @@ -115,6 +121,9 @@ /* blk_alloc_queue() expects request function */ /* #undef HAVE_BLK_ALLOC_QUEUE_REQUEST_FN */ +/* blk_alloc_queue_rh() expects request function */ +/* #undef HAVE_BLK_ALLOC_QUEUE_REQUEST_FN_RH */ + /* blk queue backing_dev_info is dynamic */ /* #undef HAVE_BLK_QUEUE_BDI_DYNAMIC */ @@ -154,12 +163,24 @@ the CoreFoundation framework. */ /* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ +/* check_disk_change() exists */ +/* #undef HAVE_CHECK_DISK_CHANGE */ + /* clear_inode() is available */ /* #undef HAVE_CLEAR_INODE */ /* dentry uses const struct dentry_operations */ /* #undef HAVE_CONST_DENTRY_OPERATIONS */ +/* copy_from_iter() is available */ +/* #undef HAVE_COPY_FROM_ITER */ + +/* copy_to_iter() is available */ +/* #undef HAVE_COPY_TO_ITER */ + +/* yes */ +/* #undef HAVE_CPU_HOTPLUG */ + /* current_time() exists */ /* #undef HAVE_CURRENT_TIME */ @@ -170,6 +191,9 @@ /* DECLARE_EVENT_CLASS() is available */ /* #undef HAVE_DECLARE_EVENT_CLASS */ +/* lookup_bdev() wants dev_t arg */ +/* #undef HAVE_DEVT_LOOKUP_BDEV */ + /* sops->dirty_inode() wants flags */ /* #undef HAVE_DIRTY_INODE_WITH_FLAGS */ @@ -212,10 +236,10 @@ /* fops->fsync() without dentry */ /* #undef HAVE_FSYNC_WITHOUT_DENTRY */ -/* generic_start_io_acct()/generic_end_io_acct() available */ +/* generic_*_io_acct() 3 arg available */ /* #undef HAVE_GENERIC_IO_ACCT_3ARG */ -/* generic_start_io_acct()/generic_end_io_acct() 4 arg available */ +/* generic_*_io_acct() 4 arg available */ /* #undef HAVE_GENERIC_IO_ACCT_4ARG */ /* generic_readlink is global */ @@ -230,9 +254,6 @@ /* Define if the GNU gettext() function is already present or preinstalled. */ /* #undef HAVE_GETTEXT */ -/* get_disk_and_module() is available */ -/* #undef HAVE_GET_DISK_AND_MODULE */ - /* iops->get_link() cookie */ /* #undef HAVE_GET_LINK_COOKIE */ @@ -242,6 +263,9 @@ /* group_info->gid exists */ /* #undef HAVE_GROUP_INFO_GID */ +/* has_capability() is available */ +/* #undef HAVE_HAS_CAPABILITY */ + /* Define if you have the iconv() function and it works. */ #define HAVE_ICONV 1 @@ -266,6 +290,27 @@ /* in_compat_syscall() is available */ /* #undef HAVE_IN_COMPAT_SYSCALL */ +/* iov_iter_advance() is available */ +/* #undef HAVE_IOV_ITER_ADVANCE */ + +/* iov_iter_count() is available */ +/* #undef HAVE_IOV_ITER_COUNT */ + +/* iov_iter_fault_in_readable() is available */ +/* #undef HAVE_IOV_ITER_FAULT_IN_READABLE */ + +/* iov_iter_init() is available */ +/* #undef HAVE_IOV_ITER_INIT */ + +/* iov_iter_init() is available */ +/* #undef HAVE_IOV_ITER_INIT_LEGACY */ + +/* iov_iter_revert() is available */ +/* #undef HAVE_IOV_ITER_REVERT */ + +/* iov_iter types are available */ +/* #undef HAVE_IOV_ITER_TYPES */ + /* yes */ /* #undef HAVE_IO_SCHEDULE_TIMEOUT */ @@ -287,6 +332,9 @@ /* kernel does stack verification */ /* #undef HAVE_KERNEL_OBJTOOL */ +/* kernel has linux/objtool.h */ +/* #undef HAVE_KERNEL_OBJTOOL_HEADER */ + /* kernel_read() take loff_t pointer */ /* #undef HAVE_KERNEL_READ_PPOS */ @@ -320,25 +368,22 @@ /* kernel has large stacks */ /* #undef HAVE_LARGE_STACKS */ -/* Define if you have libaio */ +/* Define if you have [aio] */ /* #undef HAVE_LIBAIO */ -/* Define if you have libblkid */ +/* Define if you have [blkid] */ /* #undef HAVE_LIBBLKID */ -/* Define if you have libssl */ -#define HAVE_LIBSSL 1 +/* Define if you have [crypto] */ +#define HAVE_LIBCRYPTO 1 -/* Define to 1 if you have the `tirpc' library (-ltirpc). */ +/* Define if you have [tirpc] */ /* #undef HAVE_LIBTIRPC */ -/* Define if you have libudev */ +/* Define if you have [udev] */ /* #undef HAVE_LIBUDEV */ -/* Define if udev_device_get_is_initialized is available */ -/* #undef HAVE_LIBUDEV_UDEV_DEVICE_GET_IS_INITIALIZED */ - -/* Define if you have libuuid */ +/* Define if you have [uuid] */ /* #undef HAVE_LIBUUID */ /* lseek_execute() is available */ @@ -365,6 +410,9 @@ /* Define to 1 if you have the `mlockall' function. */ #define HAVE_MLOCKALL 1 +/* lookup_bdev() wants mode arg */ +/* #undef HAVE_MODE_LOOKUP_BDEV */ + /* Define if host toolchain supports MOVBE */ #define HAVE_MOVBE 1 @@ -377,6 +425,9 @@ /* Define if host toolchain supports PCLMULQDQ */ #define HAVE_PCLMULQDQ 1 +/* percpu_counter_init() wants gfp_t */ +/* #undef HAVE_PERCPU_COUNTER_INIT_WITH_GFP */ + /* posix_acl_chmod() exists */ /* #undef HAVE_POSIX_ACL_CHMOD */ @@ -431,6 +482,12 @@ /* REQ_PREFLUSH is defined */ /* #undef HAVE_REQ_PREFLUSH */ +/* revalidate_disk() is available */ +/* #undef HAVE_REVALIDATE_DISK */ + +/* revalidate_disk_size() is available */ +/* #undef HAVE_REVALIDATE_DISK_SIZE */ + /* struct rw_semaphore has member activity */ /* #undef HAVE_RWSEM_ACTIVITY */ @@ -440,6 +497,9 @@ /* linux/sched/signal.h exists */ /* #undef HAVE_SCHED_SIGNAL_HEADER */ +/* Define to 1 if you have the header file. */ +#define HAVE_SECURITY_PAM_MODULES_H 1 + /* setattr_prepare() is available */ /* #undef HAVE_SETATTR_PREPARE */ @@ -499,6 +559,9 @@ /* Define to 1 if you have the `strlcpy' function. */ #define HAVE_STRLCPY 1 +/* submit_bio is member of struct block_device_operations */ +/* #undef HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS */ + /* super_setup_bdi_name() exits */ /* #undef HAVE_SUPER_SETUP_BDI_NAME */ @@ -520,6 +583,9 @@ /* kernel has totalram_pages() */ /* #undef HAVE_TOTALRAM_PAGES_FUNC */ +/* Define to 1 if you have the `udev_device_get_is_initialized' function. */ +/* #undef HAVE_UDEV_DEVICE_GET_IS_INITIALIZED */ + /* kernel has __kernel_fpu_* functions */ /* #undef HAVE_UNDERSCORE_KERNEL_FPU */ @@ -541,6 +607,9 @@ /* aops->direct_IO() uses iov_iter with rw and offset */ /* #undef HAVE_VFS_DIRECT_IO_ITER_RW_OFFSET */ +/* All required iov_iter interfaces are available */ +/* #undef HAVE_VFS_IOV_ITER */ + /* fops->iterate() is available */ /* #undef HAVE_VFS_ITERATE */ @@ -595,15 +664,12 @@ /* xattr_handler->set() wants xattr_handler */ /* #undef HAVE_XATTR_SET_HANDLER */ -/* Define if you have zlib */ +/* Define if you have [z] */ #define HAVE_ZLIB 1 /* __posix_acl_chmod() exists */ /* #undef HAVE___POSIX_ACL_CHMOD */ -/* Define as const if the declaration of iconv() needs const. */ -#define ICONV_CONST - /* kernel exports FPU functions */ /* #undef KERNEL_EXPORTS_X86_FPU */ @@ -635,7 +701,7 @@ /* #undef SYSTEM_LINUX */ /* zfs debugging enabled */ -/* #define ZFS_DEBUG 1 */ +/* #undef ZFS_DEBUG */ /* /dev/zfs minor */ /* #undef ZFS_DEVICE_MINOR */ @@ -649,9 +715,6 @@ /* enum node_stat_item contains NR_INACTIVE_FILE */ /* #undef ZFS_ENUM_NODE_STAT_ITEM_NR_INACTIVE_FILE */ -/* enum node_stat_item contains NR_SLAB_RECLAIMABLE */ -/* #undef ZFS_ENUM_NODE_STAT_ITEM_NR_SLAB_RECLAIMABLE */ - /* enum zone_stat_item contains NR_FILE_PAGES */ /* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_FILE_PAGES */ @@ -661,9 +724,6 @@ /* enum zone_stat_item contains NR_INACTIVE_FILE */ /* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_INACTIVE_FILE */ -/* enum zone_stat_item contains NR_SLAB_RECLAIMABLE */ -/* #undef ZFS_ENUM_ZONE_STAT_ITEM_NR_SLAB_RECLAIMABLE */ - /* global_node_page_state() exists */ /* #undef ZFS_GLOBAL_NODE_PAGE_STATE */ @@ -674,16 +734,16 @@ /* #undef ZFS_IS_GPL_COMPATIBLE */ /* Define the project alias string. */ -#define ZFS_META_ALIAS "zfs-0.8.0-1" +#define ZFS_META_ALIAS "zfs-2.0.0-FreeBSD_gf11b09dec" /* Define the project author. */ -#define ZFS_META_AUTHOR "OpenZFS on Linux" +#define ZFS_META_AUTHOR "OpenZFS" /* Define the project release date. */ /* #undef ZFS_META_DATA */ /* Define the maximum compatible kernel version. */ -#define ZFS_META_KVER_MAX "5.6" +#define ZFS_META_KVER_MAX "5.10" /* Define the minimum compatible kernel version. */ #define ZFS_META_KVER_MIN "3.10" @@ -704,8 +764,11 @@ #define ZFS_META_NAME "zfs" /* Define the project release. */ -#define ZFS_META_RELEASE "1" +#define ZFS_META_RELEASE "FreeBSD_gf11b09dec" /* Define the project version. */ -#define ZFS_META_VERSION "0.8.0" +#define ZFS_META_VERSION "2.0.0" + +/* count is located in percpu_ref.data */ +/* #undef ZFS_PERCPU_REF_COUNT_IN_DATA */ From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 17:46:39 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CBFC752A01E; Thu, 4 Feb 2021 17:46: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 4DWmFW5JxFz4g51; Thu, 4 Feb 2021 17:46:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A47EB7E51; Thu, 4 Feb 2021 17:46:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114HkdJk028401; Thu, 4 Feb 2021 17:46:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114HkdxE028400; Thu, 4 Feb 2021 17:46:39 GMT (envelope-from git) Date: Thu, 4 Feb 2021 17:46:39 GMT Message-Id: <202102041746.114HkdxE028400@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: 397aaa3bcc78 - stable/13 - cxgbe(4): Fixes to tx coalescing. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 397aaa3bcc78196f5c794ebd1de751568562a7a3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 17:46:39 -0000 The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=397aaa3bcc78196f5c794ebd1de751568562a7a3 commit 397aaa3bcc78196f5c794ebd1de751568562a7a3 Author: Navdeep Parhar AuthorDate: 2021-02-01 11:00:09 +0000 Commit: Navdeep Parhar CommitDate: 2021-02-04 17:43:36 +0000 cxgbe(4): Fixes to tx coalescing. - The behavior implemented in r362905 resulted in delayed transmission of packets in some cases, causing performance issues. Use a different heuristic to predict tx requests. - Add a tunable/sysctl (hw.cxgbe.tx_coalesce) to disable tx coalescing entirely. It can be changed at any time. There is no change in default behavior. (cherry picked from commit 3447df8bc5b342bd88d565641435284ff620ee2a) --- sys/dev/cxgbe/adapter.h | 4 ++- sys/dev/cxgbe/t4_main.c | 1 + sys/dev/cxgbe/t4_sge.c | 69 ++++++++++++++++++++++++++++++++++++++++--------- sys/dev/cxgbe/t4_vf.c | 1 + 4 files changed, 62 insertions(+), 13 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 37afa7cf7780..4b2f86d00052 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -561,7 +561,7 @@ struct txpkts { uint8_t wr_type; /* type 0 or type 1 */ uint8_t npkt; /* # of packets in this work request */ uint8_t len16; /* # of 16B pieces used by this work request */ - uint8_t score; /* 1-10. coalescing attempted if score > 3 */ + uint8_t score; uint8_t max_npkt; /* maximum number of packets allowed */ uint16_t plen; /* total payload (sum of all packets) */ @@ -584,6 +584,7 @@ struct sge_txq { struct sglist *gl; __be32 cpl_ctrl0; /* for convenience */ int tc_idx; /* traffic class */ + uint64_t last_tx; /* cycle count when eth_tx was last called */ struct txpkts txp; struct task tx_reclaim_task; @@ -599,6 +600,7 @@ struct sge_txq { uint64_t txpkts1_wrs; /* # of type1 coalesced tx work requests */ uint64_t txpkts0_pkts; /* # of frames in type0 coalesced tx WRs */ uint64_t txpkts1_pkts; /* # of frames in type1 coalesced tx WRs */ + uint64_t txpkts_flush; /* # of times txp had to be sent by tx_update */ uint64_t raw_wrs; /* # of raw work requests (alloc_wr_mbuf) */ uint64_t vxlan_tso_wrs; /* # of VXLAN TSO work requests */ uint64_t vxlan_txcsum; diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 32a229bed52b..e01429f93825 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -10718,6 +10718,7 @@ clear_stats(struct adapter *sc, u_int port_id) txq->txpkts1_wrs = 0; txq->txpkts0_pkts = 0; txq->txpkts1_pkts = 0; + txq->txpkts_flush = 0; txq->raw_wrs = 0; txq->vxlan_tso_wrs = 0; txq->vxlan_txcsum = 0; diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index f9553bbbce67..45f07358f0db 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -212,6 +212,22 @@ static counter_u64_t defrags; SYSCTL_COUNTER_U64(_hw_cxgbe, OID_AUTO, defrags, CTLFLAG_RD, &defrags, "Number of mbuf defrags performed"); +static int t4_tx_coalesce = 1; +SYSCTL_INT(_hw_cxgbe, OID_AUTO, tx_coalesce, CTLFLAG_RWTUN, &t4_tx_coalesce, 0, + "tx coalescing allowed"); + +/* + * The driver will make aggressive attempts at tx coalescing if it sees these + * many packets eligible for coalescing in quick succession, with no more than + * the specified gap in between the eth_tx calls that delivered the packets. + */ +static int t4_tx_coalesce_pkts = 32; +SYSCTL_INT(_hw_cxgbe, OID_AUTO, tx_coalesce_pkts, CTLFLAG_RWTUN, + &t4_tx_coalesce_pkts, 0, + "# of consecutive packets (1 - 255) that will trigger tx coalescing"); +static int t4_tx_coalesce_gap = 5; +SYSCTL_INT(_hw_cxgbe, OID_AUTO, tx_coalesce_gap, CTLFLAG_RWTUN, + &t4_tx_coalesce_gap, 0, "tx gap (in microseconds)"); static int service_iq(struct sge_iq *, int); static int service_iq_fl(struct sge_iq *, int); @@ -3120,6 +3136,26 @@ set_txupdate_flags(struct sge_txq *txq, u_int avail, } } +#if defined(__i386__) || defined(__amd64__) +extern uint64_t tsc_freq; +#endif + +static inline bool +record_eth_tx_time(struct sge_txq *txq) +{ + const uint64_t cycles = get_cyclecount(); + const uint64_t last_tx = txq->last_tx; +#if defined(__i386__) || defined(__amd64__) + const uint64_t itg = tsc_freq * t4_tx_coalesce_gap / 1000000; +#else + const uint64_t itg = 0; +#endif + + MPASS(cycles >= last_tx); + txq->last_tx = cycles; + return (cycles - last_tx < itg); +} + /* * r->items[cidx] to r->items[pidx], with a wraparound at r->size, are ready to * be consumed. Return the actual number consumed. 0 indicates a stall. @@ -3137,10 +3173,11 @@ eth_tx(struct mp_ring *r, u_int cidx, u_int pidx, bool *coalescing) u_int n, avail, dbdiff; /* # of hardware descriptors */ int i, rc; struct mbuf *m0; - bool snd; + bool snd, recent_tx; void *wr; /* start of the last WR written to the ring */ TXQ_LOCK_ASSERT_OWNED(txq); + recent_tx = record_eth_tx_time(txq); remaining = IDXDIFF(pidx, cidx, r->size); if (__predict_false(discard_tx(eq))) { @@ -3159,17 +3196,15 @@ eth_tx(struct mp_ring *r, u_int cidx, u_int pidx, bool *coalescing) } /* How many hardware descriptors do we have readily available. */ - if (eq->pidx == eq->cidx) { + if (eq->pidx == eq->cidx) avail = eq->sidx - 1; - if (txp->score++ >= 5) - txp->score = 5; /* tx is completely idle, reset. */ - } else + else avail = IDXDIFF(eq->cidx, eq->pidx, eq->sidx) - 1; total = 0; if (remaining == 0) { - if (txp->score-- == 1) /* egr_update had to drain txpkts */ - txp->score = 1; + txp->score = 0; + txq->txpkts_flush++; goto send_txpkts; } @@ -3183,7 +3218,17 @@ eth_tx(struct mp_ring *r, u_int cidx, u_int pidx, bool *coalescing) if (avail < 2 * SGE_MAX_WR_NDESC) avail += reclaim_tx_descs(txq, 64); - if (txp->npkt > 0 || remaining > 1 || txp->score > 3 || + if (t4_tx_coalesce == 0 && txp->npkt == 0) + goto skip_coalescing; + if (cannot_use_txpkts(m0)) + txp->score = 0; + else if (recent_tx) { + if (++txp->score == 0) + txp->score = UINT8_MAX; + } else + txp->score = 1; + if (txp->npkt > 0 || remaining > 1 || + txp->score >= t4_tx_coalesce_pkts || atomic_load_int(&txq->eq.equiq) != 0) { if (vi->flags & TX_USES_VM_WR) rc = add_to_txpkts_vf(sc, txq, m0, avail, &snd); @@ -3198,8 +3243,6 @@ eth_tx(struct mp_ring *r, u_int cidx, u_int pidx, bool *coalescing) for (i = 0; i < txp->npkt; i++) ETHER_BPF_MTAP(ifp, txp->mb[i]); if (txp->npkt > 1) { - if (txp->score++ >= 10) - txp->score = 10; MPASS(avail >= tx_len16_to_desc(txp->len16)); if (vi->flags & TX_USES_VM_WR) n = write_txpkts_vm_wr(sc, txq); @@ -3239,7 +3282,7 @@ eth_tx(struct mp_ring *r, u_int cidx, u_int pidx, bool *coalescing) MPASS(rc != 0 && rc != EAGAIN); MPASS(txp->npkt == 0); - +skip_coalescing: n = tx_len16_to_desc(mbuf_len16(m0)); if (__predict_false(avail < n)) { avail += reclaim_tx_descs(txq, min(n, 32)); @@ -4304,7 +4347,6 @@ alloc_txq(struct vi_info *vi, struct sge_txq *txq, int idx, M_ZERO | M_WAITOK); txp = &txq->txp; - txp->score = 5; MPASS(nitems(txp->mb) >= sc->params.max_pkts_per_eth_tx_pkts_wr); txq->txp.max_npkt = min(nitems(txp->mb), sc->params.max_pkts_per_eth_tx_pkts_wr); @@ -4363,6 +4405,9 @@ alloc_txq(struct vi_info *vi, struct sge_txq *txq, int idx, SYSCTL_ADD_UQUAD(&vi->ctx, children, OID_AUTO, "txpkts1_pkts", CTLFLAG_RD, &txq->txpkts1_pkts, "# of frames tx'd using type1 txpkts work requests"); + SYSCTL_ADD_UQUAD(&vi->ctx, children, OID_AUTO, "txpkts_flush", + CTLFLAG_RD, &txq->txpkts_flush, + "# of times txpkts had to be flushed out by an egress-update"); SYSCTL_ADD_UQUAD(&vi->ctx, children, OID_AUTO, "raw_wrs", CTLFLAG_RD, &txq->raw_wrs, "# of raw work requests (non-packets)"); SYSCTL_ADD_UQUAD(&vi->ctx, children, OID_AUTO, "vxlan_tso_wrs", diff --git a/sys/dev/cxgbe/t4_vf.c b/sys/dev/cxgbe/t4_vf.c index 223ffe7aeaa0..6c736e37faac 100644 --- a/sys/dev/cxgbe/t4_vf.c +++ b/sys/dev/cxgbe/t4_vf.c @@ -893,6 +893,7 @@ t4vf_ioctl(struct cdev *dev, unsigned long cmd, caddr_t data, int fflag, txq->txpkts1_wrs = 0; txq->txpkts0_pkts = 0; txq->txpkts1_pkts = 0; + txq->txpkts_flush = 0; mp_ring_reset_stats(txq->r); } } From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 18:01:50 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52FBF52A759; Thu, 4 Feb 2021 18:01:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWmb21wz2z4hP7; Thu, 4 Feb 2021 18:01:50 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3510A10451; Thu, 4 Feb 2021 18:01:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114I1ob1052678; Thu, 4 Feb 2021 18:01:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114I1odP052677; Thu, 4 Feb 2021 18:01:50 GMT (envelope-from git) Date: Thu, 4 Feb 2021 18:01:50 GMT Message-Id: <202102041801.114I1odP052677@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 068f2402d28b - stable/13 - amd64: add a note about simd to libc memset, memmove and memcmp MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 068f2402d28bf2ddee884c83be1dff3a7631569b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 18:01:50 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=068f2402d28bf2ddee884c83be1dff3a7631569b commit 068f2402d28bf2ddee884c83be1dff3a7631569b Author: Mateusz Guzik AuthorDate: 2021-01-31 15:50:34 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-04 17:59:05 +0000 amd64: add a note about simd to libc memset, memmove and memcmp (cherry picked from commit 0db6aef407f30c138982b8cde43189aad098b337) --- lib/libc/amd64/string/memcmp.S | 6 ++++++ lib/libc/amd64/string/memmove.S | 6 ++++++ lib/libc/amd64/string/memset.S | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/lib/libc/amd64/string/memcmp.S b/lib/libc/amd64/string/memcmp.S index 231ab2175804..67c7df280679 100644 --- a/lib/libc/amd64/string/memcmp.S +++ b/lib/libc/amd64/string/memcmp.S @@ -31,6 +31,12 @@ #include __FBSDID("$FreeBSD$"); +/* + * Note: this routine was written with kernel use in mind (read: no simd), + * it is only present in userspace as a temporary measure until something + * better gets imported. + */ + #define ALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */ ENTRY(memcmp) diff --git a/lib/libc/amd64/string/memmove.S b/lib/libc/amd64/string/memmove.S index 4797140a1c16..3d75ff45c798 100644 --- a/lib/libc/amd64/string/memmove.S +++ b/lib/libc/amd64/string/memmove.S @@ -29,6 +29,12 @@ #include __FBSDID("$FreeBSD$"); +/* + * Note: this routine was written with kernel use in mind (read: no simd), + * it is only present in userspace as a temporary measure until something + * better gets imported. + */ + #define ALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */ /* diff --git a/lib/libc/amd64/string/memset.S b/lib/libc/amd64/string/memset.S index 0639573a4a3e..050711302354 100644 --- a/lib/libc/amd64/string/memset.S +++ b/lib/libc/amd64/string/memset.S @@ -31,6 +31,12 @@ #include __FBSDID("$FreeBSD$"); +/* + * Note: this routine was written with kernel use in mind (read: no simd), + * it is only present in userspace as a temporary measure until something + * better gets imported. + */ + #define ALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */ .macro MEMSET erms From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 18:01:51 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 69DC452A767; Thu, 4 Feb 2021 18:01:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWmb32csSz4hJb; Thu, 4 Feb 2021 18:01:51 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4CAA21078D; Thu, 4 Feb 2021 18:01:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114I1p0i052701; Thu, 4 Feb 2021 18:01:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114I1pt0052700; Thu, 4 Feb 2021 18:01:51 GMT (envelope-from git) Date: Thu, 4 Feb 2021 18:01:51 GMT Message-Id: <202102041801.114I1pt0052700@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 88a580ebeea1 - stable/13 - amd64: move memcmp checks upfront MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 88a580ebeea10e7bf9eb823dbbf48349eb8da540 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 18:01:51 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=88a580ebeea10e7bf9eb823dbbf48349eb8da540 commit 88a580ebeea10e7bf9eb823dbbf48349eb8da540 Author: Mateusz Guzik AuthorDate: 2021-01-31 15:46:18 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-04 17:59:10 +0000 amd64: move memcmp checks upfront This is a tradeoff which saves jumps for smaller sizes while making the 8-16 range slower (roughly in line with the other cases). Tested with glibc test suite. For example size 3 (most common with vfs namecache) (ops/s): before: 407086026 after: 461391995 The regressed range of 8-16 (with 8 as example): before: 540850489 after: 461671032 (cherry picked from commit f1be262ec11c1c35e6485f432415b5b52adb505d) --- lib/libc/amd64/string/memcmp.S | 50 ++++++++++++++++++++++------------------ sys/amd64/amd64/support.S | 52 +++++++++++++++++++++++------------------- 2 files changed, 57 insertions(+), 45 deletions(-) diff --git a/lib/libc/amd64/string/memcmp.S b/lib/libc/amd64/string/memcmp.S index 67c7df280679..0c8121f9d885 100644 --- a/lib/libc/amd64/string/memcmp.S +++ b/lib/libc/amd64/string/memcmp.S @@ -45,9 +45,25 @@ ENTRY(memcmp) cmpq $16,%rdx ja 101632f -100816: cmpb $8,%dl - jl 100408f + jg 100816f + + cmpb $4,%dl + jg 100408f + + cmpb $2,%dl + jge 100204f + + cmpb $1,%dl + jl 100000f + movzbl (%rdi),%eax + movzbl (%rsi),%r8d + subl %r8d,%eax +100000: + ret + + ALIGN_TEXT +100816: movq (%rdi),%r8 movq (%rsi),%r9 cmpq %r8,%r9 @@ -57,9 +73,8 @@ ENTRY(memcmp) cmpq %r8,%r9 jne 10081608f ret + ALIGN_TEXT 100408: - cmpb $4,%dl - jl 100204f movl (%rdi),%r8d movl (%rsi),%r9d cmpl %r8d,%r9d @@ -69,9 +84,8 @@ ENTRY(memcmp) cmpl %r8d,%r9d jne 10040804f ret + ALIGN_TEXT 100204: - cmpb $2,%dl - jl 100001f movzwl (%rdi),%r8d movzwl (%rsi),%r9d cmpl %r8d,%r9d @@ -81,15 +95,7 @@ ENTRY(memcmp) cmpl %r8d,%r9d jne 1f ret -100001: - cmpb $1,%dl - jl 100000f - movzbl (%rdi),%eax - movzbl (%rsi),%r8d - subl %r8d,%eax -100000: - ret -ALIGN_TEXT + ALIGN_TEXT 101632: cmpq $32,%rdx ja 103200f @@ -110,7 +116,7 @@ ALIGN_TEXT cmpq %r8,%r9 jne 10163224f ret -ALIGN_TEXT + ALIGN_TEXT 103200: movq (%rdi),%r8 movq 8(%rdi),%r9 @@ -140,7 +146,7 @@ ALIGN_TEXT * * Before we compute it we narrow down the range (16 -> 8 -> 4 bytes). */ -ALIGN_TEXT + ALIGN_TEXT 10320016: leaq 16(%rdi),%rdi leaq 16(%rsi),%rsi @@ -152,29 +158,29 @@ ALIGN_TEXT leaq 8(%rdi),%rdi leaq 8(%rsi),%rsi jmp 80f -ALIGN_TEXT + ALIGN_TEXT 10081608: 10163224: leaq -8(%rdi,%rdx),%rdi leaq -8(%rsi,%rdx),%rsi jmp 80f -ALIGN_TEXT + ALIGN_TEXT 10163216: leaq -16(%rdi,%rdx),%rdi leaq -16(%rsi,%rdx),%rsi jmp 80f -ALIGN_TEXT + ALIGN_TEXT 10163208: leaq 8(%rdi),%rdi leaq 8(%rsi),%rsi jmp 80f -ALIGN_TEXT + ALIGN_TEXT 10040804: leaq -4(%rdi,%rdx),%rdi leaq -4(%rsi,%rdx),%rsi jmp 1f -ALIGN_TEXT + ALIGN_TEXT 80: movl (%rdi),%r8d movl (%rsi),%r9d diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S index 49baa50ac294..b623fba277db 100644 --- a/sys/amd64/amd64/support.S +++ b/sys/amd64/amd64/support.S @@ -93,9 +93,26 @@ ENTRY(memcmp) cmpq $16,%rdx ja 101632f -100816: cmpb $8,%dl - jl 100408f + jg 100816f + + cmpb $4,%dl + jg 100408f + + cmpb $2,%dl + jge 100204f + + cmpb $1,%dl + jl 100000f + movzbl (%rdi),%eax + movzbl (%rsi),%r8d + subl %r8d,%eax +100000: + POP_FRAME_POINTER + ret + + ALIGN_TEXT +100816: movq (%rdi),%r8 movq (%rsi),%r9 cmpq %r8,%r9 @@ -106,9 +123,8 @@ ENTRY(memcmp) jne 10081608f POP_FRAME_POINTER ret + ALIGN_TEXT 100408: - cmpb $4,%dl - jl 100204f movl (%rdi),%r8d movl (%rsi),%r9d cmpl %r8d,%r9d @@ -119,9 +135,8 @@ ENTRY(memcmp) jne 10040804f POP_FRAME_POINTER ret + ALIGN_TEXT 100204: - cmpb $2,%dl - jl 100001f movzwl (%rdi),%r8d movzwl (%rsi),%r9d cmpl %r8d,%r9d @@ -132,16 +147,7 @@ ENTRY(memcmp) jne 1f POP_FRAME_POINTER ret -100001: - cmpb $1,%dl - jl 100000f - movzbl (%rdi),%eax - movzbl (%rsi),%r8d - subl %r8d,%eax -100000: - POP_FRAME_POINTER - ret -ALIGN_TEXT + ALIGN_TEXT 101632: cmpq $32,%rdx ja 103200f @@ -163,7 +169,7 @@ ALIGN_TEXT jne 10163224f POP_FRAME_POINTER ret -ALIGN_TEXT + ALIGN_TEXT 103200: movq (%rdi),%r8 movq 8(%rdi),%r9 @@ -194,7 +200,7 @@ ALIGN_TEXT * * Before we compute it we narrow down the range (16 -> 8 -> 4 bytes). */ -ALIGN_TEXT + ALIGN_TEXT 10320016: leaq 16(%rdi),%rdi leaq 16(%rsi),%rsi @@ -206,29 +212,29 @@ ALIGN_TEXT leaq 8(%rdi),%rdi leaq 8(%rsi),%rsi jmp 80f -ALIGN_TEXT + ALIGN_TEXT 10081608: 10163224: leaq -8(%rdi,%rdx),%rdi leaq -8(%rsi,%rdx),%rsi jmp 80f -ALIGN_TEXT + ALIGN_TEXT 10163216: leaq -16(%rdi,%rdx),%rdi leaq -16(%rsi,%rdx),%rsi jmp 80f -ALIGN_TEXT + ALIGN_TEXT 10163208: leaq 8(%rdi),%rdi leaq 8(%rsi),%rsi jmp 80f -ALIGN_TEXT + ALIGN_TEXT 10040804: leaq -4(%rdi,%rdx),%rdi leaq -4(%rsi,%rdx),%rsi jmp 1f -ALIGN_TEXT + ALIGN_TEXT 80: movl (%rdi),%r8d movl (%rsi),%r9d From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 18:01:52 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DAA1252A4D8; Thu, 4 Feb 2021 18:01: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 4DWmb44FY7z4hLk; Thu, 4 Feb 2021 18:01:52 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 799421078E; Thu, 4 Feb 2021 18:01:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114I1q7X052722; Thu, 4 Feb 2021 18:01:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114I1q8a052720; Thu, 4 Feb 2021 18:01:52 GMT (envelope-from git) Date: Thu, 4 Feb 2021 18:01:52 GMT Message-Id: <202102041801.114I1q8a052720@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 55764c48f5f8 - stable/13 - cache: move hash computation into the parsing loop MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 55764c48f5f8535d8441764d392bb90dd6a6c9e0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 18:01:53 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=55764c48f5f8535d8441764d392bb90dd6a6c9e0 commit 55764c48f5f8535d8441764d392bb90dd6a6c9e0 Author: Mateusz Guzik AuthorDate: 2021-01-31 18:25:18 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-04 17:59:15 +0000 cache: move hash computation into the parsing loop (cherry picked from commit bbfb1edd70e15241d852d82eb7e1c1049a01b886) --- sys/kern/vfs_cache.c | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index fe7e70ba1359..b13ebf66c49a 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -722,6 +722,27 @@ cache_get_hash(char *name, u_char len, struct vnode *dvp) return (fnv_32_buf(name, len, dvp->v_nchash)); } +static uint32_t +cache_get_hash_iter_start(struct vnode *dvp) +{ + + return (dvp->v_nchash); +} + +static uint32_t +cache_get_hash_iter(char c, uint32_t hash) +{ + + return (fnv_32_buf(&c, 1, hash)); +} + +static uint32_t +cache_get_hash_iter_finish(uint32_t hash) +{ + + return (hash); +} + static inline struct nchashhead * NCP2BUCKET(struct namecache *ncp) { @@ -3693,11 +3714,11 @@ struct cache_fpl { struct nameidata *ndp; struct componentname *cnp; char *nulchar; - struct pwd **pwd; struct vnode *dvp; struct vnode *tvp; seqc_t dvp_seqc; seqc_t tvp_seqc; + uint32_t hash; struct nameidata_saved snd; struct nameidata_outer snd_outer; int line; @@ -3705,6 +3726,7 @@ struct cache_fpl { bool in_smr; bool fsearch; bool savename; + struct pwd **pwd; #ifdef INVARIANTS struct cache_fpl_debug debug; #endif @@ -4951,6 +4973,7 @@ cache_fplookup_next(struct cache_fpl *fpl) cnp = fpl->cnp; dvp = fpl->dvp; + hash = fpl->hash; if (__predict_false(cnp->cn_nameptr[0] == '.')) { if (cnp->cn_namelen == 1) { @@ -4963,8 +4986,6 @@ cache_fplookup_next(struct cache_fpl *fpl) MPASS(!cache_fpl_isdotdot(cnp)); - hash = cache_get_hash(cnp->cn_nameptr, cnp->cn_namelen, dvp); - CK_SLIST_FOREACH(ncp, (NCHHASH(hash)), nc_hash) { if (ncp->nc_dvp == dvp && ncp->nc_nlen == cnp->cn_namelen && !bcmp(ncp->nc_name, cnp->cn_nameptr, ncp->nc_nlen)) @@ -5246,10 +5267,13 @@ cache_fplookup_parse(struct cache_fpl *fpl) { struct nameidata *ndp; struct componentname *cnp; + struct vnode *dvp; char *cp; + uint32_t hash; ndp = fpl->ndp; cnp = fpl->cnp; + dvp = fpl->dvp; /* * Find the end of this path component, it is either / or nul. @@ -5257,6 +5281,8 @@ cache_fplookup_parse(struct cache_fpl *fpl) * Store / as a temporary sentinel so that we only have one character * to test for. Pathnames tend to be short so this should not be * resulting in cache misses. + * + * TODO: fix this to be word-sized. */ KASSERT(&cnp->cn_nameptr[fpl->debug.ni_pathlen - 1] == fpl->nulchar, ("%s: mismatch between pathlen (%zu) and nulchar (%p != %p), string [%s]\n", @@ -5265,17 +5291,30 @@ cache_fplookup_parse(struct cache_fpl *fpl) KASSERT(*fpl->nulchar == '\0', ("%s: expected nul at %p; string [%s]\n", __func__, fpl->nulchar, cnp->cn_pnbuf)); + hash = cache_get_hash_iter_start(dvp); *fpl->nulchar = '/'; for (cp = cnp->cn_nameptr; *cp != '/'; cp++) { KASSERT(*cp != '\0', ("%s: encountered unexpected nul; string [%s]\n", __func__, cnp->cn_nameptr)); + hash = cache_get_hash_iter(*cp, hash); continue; } *fpl->nulchar = '\0'; + fpl->hash = cache_get_hash_iter_finish(hash); cnp->cn_namelen = cp - cnp->cn_nameptr; cache_fpl_pathlen_sub(fpl, cnp->cn_namelen); + +#ifdef INVARIANTS + if (cnp->cn_namelen <= NAME_MAX) { + if (fpl->hash != cache_get_hash(cnp->cn_nameptr, cnp->cn_namelen, dvp)) { + panic("%s: mismatched hash for [%s] len %ld", __func__, + cnp->cn_nameptr, cnp->cn_namelen); + } + } +#endif + /* * Hack: we have to check if the found path component's length exceeds * NAME_MAX. However, the condition is very rarely true and check can From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 18:01:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 36D1A52A855; Thu, 4 Feb 2021 18:01: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 4DWmb56kwfz4hdL; Thu, 4 Feb 2021 18:01:53 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A399C10452; Thu, 4 Feb 2021 18:01:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114I1r45052741; Thu, 4 Feb 2021 18:01:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114I1rQV052740; Thu, 4 Feb 2021 18:01:53 GMT (envelope-from git) Date: Thu, 4 Feb 2021 18:01:53 GMT Message-Id: <202102041801.114I1rQV052740@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 2edd6140e9a1 - stable/13 - cache: add delayed degenerate path handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2edd6140e9a157b5493cb287e30f8a15038eb95e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 18:01:56 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=2edd6140e9a157b5493cb287e30f8a15038eb95e commit 2edd6140e9a157b5493cb287e30f8a15038eb95e Author: Mateusz Guzik AuthorDate: 2021-01-31 20:54:35 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-04 18:00:57 +0000 cache: add delayed degenerate path handling (cherry picked from commit 6f19dc2124a31aadf419743288d2ec1abd895563) --- sys/kern/vfs_cache.c | 57 +++++++++++++++++++++++----------------------------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index b13ebf66c49a..db482ea4eba3 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3737,7 +3737,6 @@ static int cache_fplookup_cross_mount(struct cache_fpl *fpl); static int cache_fplookup_partial_setup(struct cache_fpl *fpl); static int cache_fplookup_skip_slashes(struct cache_fpl *fpl); static int cache_fplookup_trailingslash(struct cache_fpl *fpl); -static int cache_fplookup_preparse(struct cache_fpl *fpl); static void cache_fpl_pathlen_dec(struct cache_fpl *fpl); static void cache_fpl_pathlen_inc(struct cache_fpl *fpl); static void cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n); @@ -4518,6 +4517,9 @@ cache_fplookup_degenerate(struct cache_fpl *fpl) struct vnode *dvp; enum vgetstate dvs; int error, lkflags; +#ifdef INVARIANTS + char *cp; +#endif fpl->tvp = fpl->dvp; fpl->tvp_seqc = fpl->dvp_seqc; @@ -4525,6 +4527,14 @@ cache_fplookup_degenerate(struct cache_fpl *fpl) cnp = fpl->cnp; dvp = fpl->dvp; +#ifdef INVARIANTS + for (cp = cnp->cn_pnbuf; *cp != '\0'; cp++) { + KASSERT(*cp == '/', + ("%s: encountered non-slash; string [%s]\n", __func__, + cnp->cn_pnbuf)); + } +#endif + if (__predict_false(cnp->cn_nameiop != LOOKUP)) { cache_fpl_smr_exit(fpl); return (cache_fpl_handled_error(fpl, EISDIR)); @@ -4589,6 +4599,9 @@ cache_fplookup_noentry(struct cache_fpl *fpl) } if (cnp->cn_nameptr[0] == '\0') { + if (fpl->tvp == NULL) { + return (cache_fplookup_degenerate(fpl)); + } return (cache_fplookup_trailingslash(fpl)); } @@ -4897,7 +4910,7 @@ cache_symlink_resolve(struct cache_fpl *fpl, const char *string, size_t len) cache_fpl_pathlen_add(fpl, adjust); cnp->cn_nameptr = cnp->cn_pnbuf; fpl->nulchar = &cnp->cn_nameptr[ndp->ni_pathlen - 1]; - + fpl->tvp = NULL; return (0); } @@ -4957,8 +4970,7 @@ cache_fplookup_symlink(struct cache_fpl *fpl) return (cache_fpl_aborted(fpl)); } } - - return (cache_fplookup_preparse(fpl)); + return (0); } static int @@ -5238,30 +5250,6 @@ cache_fpl_pathlen_dec(struct cache_fpl *fpl) } #endif -static int __always_inline -cache_fplookup_preparse(struct cache_fpl *fpl) -{ - struct componentname *cnp; - - cnp = fpl->cnp; - - if (__predict_false(cnp->cn_nameptr[0] == '\0')) { - return (cache_fplookup_degenerate(fpl)); - } - - /* - * By this point the shortest possible pathname is one character + nul - * terminator, hence 2. - */ - KASSERT(fpl->debug.ni_pathlen >= 2, ("%s: pathlen %zu\n", __func__, - fpl->debug.ni_pathlen)); - KASSERT(&cnp->cn_nameptr[fpl->debug.ni_pathlen - 2] == fpl->nulchar - 1, - ("%s: mismatch on string (%p != %p) [%s]\n", __func__, - &cnp->cn_nameptr[fpl->debug.ni_pathlen - 2], fpl->nulchar - 1, - cnp->cn_pnbuf)); - return (0); -} - static void cache_fplookup_parse(struct cache_fpl *fpl) { @@ -5543,6 +5531,13 @@ cache_fplookup_failed_vexec(struct cache_fpl *fpl, int error) return (cache_fpl_aborted(fpl)); } + /* + * Hack: delayed degenerate path checking. + */ + if (cnp->cn_nameptr[0] == '\0' && fpl->tvp == NULL) { + return (cache_fplookup_degenerate(fpl)); + } + /* * Hack: delayed name len checking. */ @@ -5634,10 +5629,7 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) return (cache_fpl_aborted(fpl)); } - error = cache_fplookup_preparse(fpl); - if (__predict_false(cache_fpl_terminated(fpl))) { - return (error); - } + MPASS(fpl->tvp == NULL); for (;;) { cache_fplookup_parse(fpl); @@ -5797,6 +5789,7 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, fpl.nulchar = &cnp->cn_nameptr[ndp->ni_pathlen - 1]; fpl.fsearch = false; fpl.savename = (cnp->cn_flags & SAVENAME) != 0; + fpl.tvp = NULL; /* for degenerate path handling */ fpl.pwd = pwdp; pwd = pwd_get_smr(); *(fpl.pwd) = pwd; From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 18:01:58 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9477552A6E0; Thu, 4 Feb 2021 18:01: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 4DWmb85Swxz4hdW; Thu, 4 Feb 2021 18:01:56 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EB8F47EFD; Thu, 4 Feb 2021 18:01:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114I1sPV052763; Thu, 4 Feb 2021 18:01:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114I1scD052762; Thu, 4 Feb 2021 18:01:54 GMT (envelope-from git) Date: Thu, 4 Feb 2021 18:01:54 GMT Message-Id: <202102041801.114I1scD052762@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 6d3ce617f398 - stable/13 - amd64: use compiler intrinsics for bsf* and bsr* MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6d3ce617f398d4066780555210270b97c30e7c0e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 18:01:58 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=6d3ce617f398d4066780555210270b97c30e7c0e commit 6d3ce617f398d4066780555210270b97c30e7c0e Author: Mateusz Guzik AuthorDate: 2021-01-31 23:35:30 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-04 18:01:08 +0000 amd64: use compiler intrinsics for bsf* and bsr* (cherry picked from commit aae89f6f09576351cc3a9a54959649e60fdd849b) --- sys/amd64/include/cpufunc.h | 36 ++++-------------------------------- 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/sys/amd64/include/cpufunc.h b/sys/amd64/include/cpufunc.h index 763ed2c64c8a..8ef298e1d7d5 100644 --- a/sys/amd64/include/cpufunc.h +++ b/sys/amd64/include/cpufunc.h @@ -65,41 +65,13 @@ breakpoint(void) __asm __volatile("int $3"); } -static __inline __pure2 u_int -bsfl(u_int mask) -{ - u_int result; - - __asm __volatile("bsfl %1,%0" : "=r" (result) : "rm" (mask)); - return (result); -} - -static __inline __pure2 u_long -bsfq(u_long mask) -{ - u_long result; - - __asm __volatile("bsfq %1,%0" : "=r" (result) : "rm" (mask)); - return (result); -} - -static __inline __pure2 u_int -bsrl(u_int mask) -{ - u_int result; +#define bsfl(mask) __builtin_ctz(mask) - __asm __volatile("bsrl %1,%0" : "=r" (result) : "rm" (mask)); - return (result); -} +#define bsfq(mask) __builtin_ctzl(mask) -static __inline __pure2 u_long -bsrq(u_long mask) -{ - u_long result; +#define bsrl(mask) (__builtin_clz(mask) ^ 0x1f) - __asm __volatile("bsrq %1,%0" : "=r" (result) : "rm" (mask)); - return (result); -} +#define bsrq(mask) (__builtin_clzl(mask) ^ 0x3f) static __inline void clflush(u_long addr) From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 18:02:01 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E319152AA03; Thu, 4 Feb 2021 18:02:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWmbD36vRz4hQ4; Thu, 4 Feb 2021 18:01:59 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 04D8B7EFE; Thu, 4 Feb 2021 18:01:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114I1taa052783; Thu, 4 Feb 2021 18:01:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114I1tWv052782; Thu, 4 Feb 2021 18:01:55 GMT (envelope-from git) Date: Thu, 4 Feb 2021 18:01:55 GMT Message-Id: <202102041801.114I1tWv052782@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 1a2bc12c4b25 - stable/13 - x86: use compiler intrinsics for bswap* MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1a2bc12c4b2563628f329e2e971d1619e0240429 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 18:02:02 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=1a2bc12c4b2563628f329e2e971d1619e0240429 commit 1a2bc12c4b2563628f329e2e971d1619e0240429 Author: Mateusz Guzik AuthorDate: 2021-02-01 03:00:13 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-04 18:01:13 +0000 x86: use compiler intrinsics for bswap* (cherry picked from commit e6ff6154d2034c13f3d0da73c1e00d69fdb36516) --- sys/x86/include/endian.h | 62 +++--------------------------------------------- 1 file changed, 3 insertions(+), 59 deletions(-) diff --git a/sys/x86/include/endian.h b/sys/x86/include/endian.h index 9c39f4fddf80..18d52fb8a6fa 100644 --- a/sys/x86/include/endian.h +++ b/sys/x86/include/endian.h @@ -65,65 +65,9 @@ #define BYTE_ORDER _BYTE_ORDER #endif -#define __bswap16_gen(x) (__uint16_t)((x) << 8 | (x) >> 8) -#define __bswap32_gen(x) \ - (((__uint32_t)__bswap16((x) & 0xffff) << 16) | __bswap16((x) >> 16)) -#define __bswap64_gen(x) \ - (((__uint64_t)__bswap32((x) & 0xffffffff) << 32) | __bswap32((x) >> 32)) - -#ifdef __GNUCLIKE_BUILTIN_CONSTANT_P -#define __bswap16(x) \ - ((__uint16_t)(__builtin_constant_p(x) ? \ - __bswap16_gen((__uint16_t)(x)) : __bswap16_var(x))) -#define __bswap32(x) \ - (__builtin_constant_p(x) ? \ - __bswap32_gen((__uint32_t)(x)) : __bswap32_var(x)) -#define __bswap64(x) \ - (__builtin_constant_p(x) ? \ - __bswap64_gen((__uint64_t)(x)) : __bswap64_var(x)) -#else -/* XXX these are broken for use in static initializers. */ -#define __bswap16(x) __bswap16_var(x) -#define __bswap32(x) __bswap32_var(x) -#define __bswap64(x) __bswap64_var(x) -#endif - -/* These are defined as functions to avoid multiple evaluation of x. */ - -static __inline __uint16_t -__bswap16_var(__uint16_t _x) -{ - - return (__bswap16_gen(_x)); -} - -static __inline __uint32_t -__bswap32_var(__uint32_t _x) -{ - -#ifdef __GNUCLIKE_ASM - __asm("bswap %0" : "+r" (_x)); - return (_x); -#else - return (__bswap32_gen(_x)); -#endif -} - -static __inline __uint64_t -__bswap64_var(__uint64_t _x) -{ - -#if defined(__amd64__) && defined(__GNUCLIKE_ASM) - __asm("bswap %0" : "+r" (_x)); - return (_x); -#else - /* - * It is important for the optimizations that the following is not - * really generic, but expands to 2 __bswap32_var()'s. - */ - return (__bswap64_gen(_x)); -#endif -} +#define __bswap16(x) __builtin_bswap16(x) +#define __bswap32(x) __builtin_bswap32(x) +#define __bswap64(x) __builtin_bswap64(x) #define __htonl(x) __bswap32(x) #define __htons(x) __bswap16(x) From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 18:04:18 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5EB6452ABA5; Thu, 4 Feb 2021 18:04: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 4DWmdt2Gw6z4jTn; Thu, 4 Feb 2021 18:04:18 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 413CF1059F; Thu, 4 Feb 2021 18:04:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114I4IhA055041; Thu, 4 Feb 2021 18:04:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114I4IEr055040; Thu, 4 Feb 2021 18:04:18 GMT (envelope-from git) Date: Thu, 4 Feb 2021 18:04:18 GMT Message-Id: <202102041804.114I4IEr055040@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Doug Ambrisko Subject: git: 1fb5b2860444 - stable/13 - VMD support for new devices. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ambrisko X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1fb5b2860444ba8954abcf14a4e2f5f1ddd2fcd3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 18:04:18 -0000 The branch stable/13 has been updated by ambrisko: URL: https://cgit.FreeBSD.org/src/commit/?id=1fb5b2860444ba8954abcf14a4e2f5f1ddd2fcd3 commit 1fb5b2860444ba8954abcf14a4e2f5f1ddd2fcd3 Author: Doug Ambrisko AuthorDate: 2021-01-28 23:12:14 +0000 Commit: Doug Ambrisko CommitDate: 2021-02-04 18:04:09 +0000 VMD support for new devices. Add support for some more Intel VMD controllers. Some of the newer controller have a sparce bus space that can be figured out by probing the HW. This gives the starting bus number. When reading the PCI config. space behind the VMD controller, the offset of the starting bus needs to be subtracted from the bus being read. Fixed a bug in which in which not all of the devices directly attached to the VMD controller would be probed. On my initial test HW, a switch was found at bus 0, slot 0 and function 0. All of the NVME drives were behind that switch. Now scan for all slots and functions attached to bus 0. If a something was found then run attach after the scan. On detach also go through all slots and functions on bus 0. Tested with device ID's: 0x201d & 0x9a0b Tested by: nc@ MFC: 5c689e21361 PR: 252253 (cherry picked from commit 0c852bb9b9282b30fd047ac1de398358f33777f4) --- sys/dev/vmd/vmd.c | 75 ++++++++++++++++++++++++++++++++++++++++++++------- sys/dev/vmd/vmd.h | 1 + sys/dev/vmd/vmd_bus.c | 73 ++++++++++++++++++++++++++++++------------------- 3 files changed, 113 insertions(+), 36 deletions(-) diff --git a/sys/dev/vmd/vmd.c b/sys/dev/vmd/vmd.c index 616fd4c8373e..80eeda4639fa 100644 --- a/sys/dev/vmd/vmd.c +++ b/sys/dev/vmd/vmd.c @@ -61,16 +61,32 @@ struct vmd_type { u_int16_t vmd_vid; u_int16_t vmd_did; char *vmd_name; + int flags; +#define BUS_RESTRICT 1 }; #define INTEL_VENDOR_ID 0x8086 -#define INTEL_DEVICE_ID_VMD 0x201d -#define INTEL_DEVICE_ID_VMD2 0x28c0 +#define INTEL_DEVICE_ID_201d 0x201d +#define INTEL_DEVICE_ID_28c0 0x28c0 +#define INTEL_DEVICE_ID_467f 0x467f +#define INTEL_DEVICE_ID_4c3d 0x4c3d +#define INTEL_DEVICE_ID_9a0b 0x9a0b + +#define VMD_CAP 0x40 +#define VMD_BUS_RESTRICT 0x1 + +#define VMD_CONFIG 0x44 +#define VMD_BUS_START(x) ((x >> 8) & 0x3) + +#define VMD_LOCK 0x70 static struct vmd_type vmd_devs[] = { - { INTEL_VENDOR_ID, INTEL_DEVICE_ID_VMD, "Intel Volume Management Device" }, - { INTEL_VENDOR_ID, INTEL_DEVICE_ID_VMD2, "Intel Volume Management Device" }, - { 0, 0, NULL } + { INTEL_VENDOR_ID, INTEL_DEVICE_ID_201d, "Intel Volume Management Device", 0 }, + { INTEL_VENDOR_ID, INTEL_DEVICE_ID_28c0, "Intel Volume Management Device", BUS_RESTRICT }, + { INTEL_VENDOR_ID, INTEL_DEVICE_ID_467f, "Intel Volume Management Device", BUS_RESTRICT }, + { INTEL_VENDOR_ID, INTEL_DEVICE_ID_4c3d, "Intel Volume Management Device", BUS_RESTRICT }, + { INTEL_VENDOR_ID, INTEL_DEVICE_ID_9a0b, "Intel Volume Management Device", BUS_RESTRICT }, + { 0, 0, NULL, 0 } }; static int @@ -92,7 +108,7 @@ vmd_probe(device_t dev) t++; } -return (ENXIO); + return (ENXIO); } static void @@ -157,8 +173,12 @@ vmd_read_config(device_t dev, u_int b, u_int s, u_int f, u_int reg, int width) struct vmd_softc *sc; bus_addr_t offset; - offset = (b << 20) + (s << 15) + (f << 12) + reg; sc = device_get_softc(dev); + if (b < sc->vmd_bus_start) + return (0xffffffff); + + offset = ((b - sc->vmd_bus_start) << 20) + (s << 15) + (f << 12) + reg; + switch(width) { case 4: return (bus_space_read_4(sc->vmd_btag, sc->vmd_bhandle, @@ -183,8 +203,11 @@ vmd_write_config(device_t dev, u_int b, u_int s, u_int f, u_int reg, struct vmd_softc *sc; bus_addr_t offset; - offset = (b << 20) + (s << 15) + (f << 12) + reg; sc = device_get_softc(dev); + if (b < sc->vmd_bus_start) + return; + + offset = ((b - sc->vmd_bus_start) << 20) + (s << 15) + (f << 12) + reg; switch(width) { case 4: @@ -271,6 +294,8 @@ vmd_attach(device_t dev) { struct vmd_softc *sc; struct pcib_secbus *bus; + struct vmd_type *t; + uint16_t vid, did; uint32_t bar; int i, j, error; int rid, sec_reg; @@ -325,13 +350,45 @@ vmd_attach(device_t dev) pci_write_config(dev, PCIR_PRIBUS_2, pcib_get_bus(device_get_parent(dev)), 1); + t = vmd_devs; + vid = pci_get_vendor(dev); + did = pci_get_device(dev); + + sc->vmd_bus_start = 0; + while (t->vmd_name != NULL) { + if (vid == t->vmd_vid && + did == t->vmd_did) { + if (t->flags == BUS_RESTRICT) { + if (pci_read_config(dev, VMD_CAP, 2) & + VMD_BUS_RESTRICT) + switch (VMD_BUS_START(pci_read_config( + dev, VMD_CONFIG, 2))) { + case 1: + sc->vmd_bus_start = 128; + break; + case 2: + sc->vmd_bus_start = 224; + break; + case 3: + device_printf(dev, + "Unknown bug offset\n"); + goto fail; + break; + } + } + } + t++; + } + + device_printf(dev, "VMD bus starts at %d\n", sc->vmd_bus_start); + sec_reg = PCIR_SECBUS_1; bus = &sc->vmd_bus; bus->sub_reg = PCIR_SUBBUS_1; bus->sec = vmd_read_config(dev, b, s, f, sec_reg, 1); bus->sub = vmd_read_config(dev, b, s, f, bus->sub_reg, 1); bus->dev = dev; - bus->rman.rm_start = 0; + bus->rman.rm_start = sc->vmd_bus_start; bus->rman.rm_end = PCI_BUSMAX; bus->rman.rm_type = RMAN_ARRAY; snprintf(buf, sizeof(buf), "%s bus numbers", device_get_nameunit(dev)); diff --git a/sys/dev/vmd/vmd.h b/sys/dev/vmd/vmd.h index f86630d72c24..e51448c7733e 100644 --- a/sys/dev/vmd/vmd.h +++ b/sys/dev/vmd/vmd.h @@ -78,6 +78,7 @@ struct vmd_softc void *vmd_intr; struct vmd_irq *vmd_irq; int vmd_msix_count; + uint8_t vmd_bus_start; #ifdef TASK_QUEUE_INTR struct taskqueue *vmd_irq_tq; struct task vmd_irq_task; diff --git a/sys/dev/vmd/vmd_bus.c b/sys/dev/vmd/vmd_bus.c index 74a6faa812b1..5eed6176630f 100644 --- a/sys/dev/vmd/vmd_bus.c +++ b/sys/dev/vmd/vmd_bus.c @@ -71,32 +71,45 @@ vmd_bus_attach(device_t dev) struct pci_devinfo *dinfo; rman_res_t start, end; int b, s, f; + int found; sc = device_get_softc(device_get_parent(dev)); - /* Start at max PCI vmd_domain and work down */ - b = s = f = 0; - dinfo = pci_read_device(device_get_parent(dev), dev, - PCI_DOMAINMAX - device_get_unit(device_get_parent(dev)), - b, s, f); - if (dinfo == NULL) { - device_printf(dev, "Cannot allocate dinfo!\n"); - return (ENOENT); + /* + * Start at max PCI vmd_domain and work down. Only VMD + * starting bus is connect to VMD device directly. Scan al + * lslots and function connected to starting bus. + */ + + b = sc->vmd_bus_start; + + found = 0; + for (s = 0; s < PCI_SLOTMAX; s++) { + for (f = 0; f < PCI_FUNCMAX; f++) { + dinfo = pci_read_device(device_get_parent(dev), dev, + PCI_DOMAINMAX - device_get_unit( + device_get_parent(dev)), b, s, f); + if (dinfo != NULL) { + found = 1; + pci_add_child(dev, dinfo); + + start = rman_get_start(sc->vmd_regs_resource[1]); + end = rman_get_end(sc->vmd_regs_resource[1]); + resource_list_add_next(&dinfo->resources, + SYS_RES_MEMORY, start, end, end - start + 1); + + start = rman_get_start(sc->vmd_io_resource); + end = rman_get_end(sc->vmd_io_resource); + resource_list_add_next(&dinfo->resources, + SYS_RES_IOPORT, start, end, end - start + 1); + + } + } } - pci_add_child(dev, dinfo); - - start = rman_get_start(sc->vmd_regs_resource[1]); - end = rman_get_end(sc->vmd_regs_resource[1]); - resource_list_add_next(&dinfo->resources, SYS_RES_MEMORY, start, end, - end - start + 1); - - start = rman_get_start(sc->vmd_io_resource); - end = rman_get_end(sc->vmd_io_resource); - resource_list_add_next(&dinfo->resources, SYS_RES_IOPORT, start, end, - end - start + 1); - - bus_generic_attach(dev); + if (found) { + bus_generic_attach(dev); + } return (0); } @@ -104,17 +117,23 @@ vmd_bus_attach(device_t dev) static int vmd_bus_detach(device_t dev) { + struct vmd_softc *sc; struct pci_devinfo *dinfo; int b, s, f; device_delete_children(dev); - b = s = f = 0; - dinfo = pci_read_device(device_get_parent(dev), dev, - PCI_DOMAINMAX - device_get_unit(device_get_parent(dev)), - b, s, f); - if (dinfo == NULL) { - resource_list_free(&dinfo->resources); + sc = device_get_softc(device_get_parent(dev)); + b = sc->vmd_bus_start; + + for (s = 0; s < PCI_SLOTMAX; s++) { + for (f = 0; f < PCI_FUNCMAX; f++) { + dinfo = pci_read_device(device_get_parent(dev), dev, + PCI_DOMAINMAX - device_get_unit( + device_get_parent(dev)), b, s, f); + if (dinfo != NULL) + resource_list_free(&dinfo->resources); + } } return (0); } From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 20:44:09 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8025452E6E7; Thu, 4 Feb 2021 20:44: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 4DWrBK3CGPz4t7v; Thu, 4 Feb 2021 20:44:09 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 60E92125D5; Thu, 4 Feb 2021 20:44:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114Ki9ZN063321; Thu, 4 Feb 2021 20:44:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114Ki94o063320; Thu, 4 Feb 2021 20:44:09 GMT (envelope-from git) Date: Thu, 4 Feb 2021 20:44:09 GMT Message-Id: <202102042044.114Ki94o063320@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: 06eda1d83cbb - stable/13 - release: update workaround during transition to git MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 06eda1d83cbb80eb05711cfa5509b6b0df580973 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 20:44:09 -0000 The branch stable/13 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=06eda1d83cbb80eb05711cfa5509b6b0df580973 commit 06eda1d83cbb80eb05711cfa5509b6b0df580973 Author: Glen Barber AuthorDate: 2021-02-02 17:19:36 +0000 Commit: Glen Barber CommitDate: 2021-02-04 20:43:40 +0000 release: update workaround during transition to git PR: 253181 Submitted by: Yasuhiro Kimura Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 70dfc101b6324b25ba353465f0d6c610399741fc) --- release/release.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/release/release.sh b/release/release.sh index fbd64bb8234d..372f69177f7e 100755 --- a/release/release.sh +++ b/release/release.sh @@ -246,8 +246,11 @@ chroot_setup() { fi fi if [ -z "${NOPORTS}" ] && [ -z "${PORTS_UPDATE_SKIP}" ]; then - if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then - git -C ${CHROOTDIR}/usr/ports pull -q + # if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then + # git -C ${CHROOTDIR}/usr/ports pull -q + # XXX: Workaround for the overlap in the Git conversion timeframe. + if [ -d "${CHROOTDIR}/usr/ports/.svn" ]; then + ${SVNCMD} update ${CHROOTDIR}/usr/ports else #${VCSCMD} ${PORT} -b ${PORTBRANCH} ${CHROOTDIR}/usr/ports # XXX: Workaround for the overlap in the Git From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 21:01:20 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3297852EDD6; Thu, 4 Feb 2021 21:01: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 4DWrZ80TZqz4tbM; Thu, 4 Feb 2021 21:01:20 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 036B912999; Thu, 4 Feb 2021 21:01:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114L1JwG086265; Thu, 4 Feb 2021 21:01:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114L1Jve086264; Thu, 4 Feb 2021 21:01:19 GMT (envelope-from git) Date: Thu, 4 Feb 2021 21:01:19 GMT Message-Id: <202102042101.114L1Jve086264@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 31026a4677d0 - stable/13 - hcons: Fix manpage typo MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 31026a4677d0bbfc55433ba4f375700ec919e3bf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 21:01:20 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=31026a4677d0bbfc55433ba4f375700ec919e3bf commit 31026a4677d0bbfc55433ba4f375700ec919e3bf Author: Vladimir Kondratyev AuthorDate: 2021-01-23 19:19:50 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-02-04 20:59:43 +0000 hcons: Fix manpage typo Submitted by: Shunchao Hu Reviewed by: wulf, gbe Differential revision: https://reviews.freebsd.org/D28294 (cherry picked from commit 0d528e6354141dd097f8719e858b3ae3686d2062) --- share/man/man4/hcons.4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/man/man4/hcons.4 b/share/man/man4/hcons.4 index a8fe22983453..68a920fba9d8 100644 --- a/share/man/man4/hcons.4 +++ b/share/man/man4/hcons.4 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 14, 2020 +.Dd January 23, 2021 .Dt HCONS 4 .Os .Sh NAME @@ -45,7 +45,7 @@ Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent -hgame_load="YES" +hcons_load="YES" .Ed .Sh DESCRIPTION The From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 21:01:21 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2EF7452F127; Thu, 4 Feb 2021 21:01: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 4DWrZ90vXjz4tkR; Thu, 4 Feb 2021 21:01:21 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 121EB127EC; Thu, 4 Feb 2021 21:01:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114L1LKP086283; Thu, 4 Feb 2021 21:01:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114L1LBS086282; Thu, 4 Feb 2021 21:01:21 GMT (envelope-from git) Date: Thu, 4 Feb 2021 21:01:21 GMT Message-Id: <202102042101.114L1LBS086282@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 6d4bc364ab5a - stable/13 - hsctrl: Fix manpage typo MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6d4bc364ab5ae7559caef8c6e62a8d26694e6bde Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 21:01:21 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=6d4bc364ab5ae7559caef8c6e62a8d26694e6bde commit 6d4bc364ab5ae7559caef8c6e62a8d26694e6bde Author: Vladimir Kondratyev AuthorDate: 2021-01-28 21:35:11 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-02-04 20:59:49 +0000 hsctrl: Fix manpage typo Use hsctrl_load to load the module at boot time. Submitted by: Shunchao Hu Reviewed by: wulf Differential revision: https://reviews.freebsd.org/D28343 (cherry picked from commit 5c689e213614bff65e9789875f839aa05053126b) --- share/man/man4/hsctrl.4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/man/man4/hsctrl.4 b/share/man/man4/hsctrl.4 index ba7976c3c03d..e4a44ce11630 100644 --- a/share/man/man4/hsctrl.4 +++ b/share/man/man4/hsctrl.4 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 14, 2020 +.Dd January 26, 2021 .Dt HSCTRL 4 .Os .Sh NAME @@ -45,7 +45,7 @@ Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent -hgame_load="YES" +hsctrl_load="YES" .Ed .Sh DESCRIPTION The From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 21:34:20 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34E3F52FF17; Thu, 4 Feb 2021 21:34:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWsJD151dz3CL5; Thu, 4 Feb 2021 21:34:20 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1815A12E74; Thu, 4 Feb 2021 21:34:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114LYKME029526; Thu, 4 Feb 2021 21:34:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114LYKEp029525; Thu, 4 Feb 2021 21:34:20 GMT (envelope-from git) Date: Thu, 4 Feb 2021 21:34:20 GMT Message-Id: <202102042134.114LYKEp029525@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Toomas Soome Subject: git: 0c839497c174 - stable/13 - loader.efi: There are systems without ConOut, also use ConOutDev MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0c839497c174e961fc71f7d3329d05b10ec5525b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 21:34:20 -0000 The branch stable/13 has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=0c839497c174e961fc71f7d3329d05b10ec5525b commit 0c839497c174e961fc71f7d3329d05b10ec5525b Author: Toomas Soome AuthorDate: 2021-02-04 20:49:02 +0000 Commit: Toomas Soome CommitDate: 2021-02-04 21:33:15 +0000 loader.efi: There are systems without ConOut, also use ConOutDev Conout does contian the default output device name. ConOutDev does contain all possible output device names, so we can use it as fallback, when there is no ConOut. PR: 253253 (cherry picked from commit 2bd4ff2d8911009283e4e615ca4aad35a845f48b) --- stand/efi/loader/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index ca41cd4a2610..32b278950745 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -735,6 +735,8 @@ parse_uefi_con_out(void) how = 0; sz = sizeof(buf); rv = efi_global_getenv("ConOut", buf, &sz); + if (rv != EFI_SUCCESS) + rv = efi_global_getenv("ConOutDev", buf, &sz); if (rv != EFI_SUCCESS) { /* If we don't have any ConOut default to serial */ how = RB_SERIAL; From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 22:34:50 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD0FE5312C0; Thu, 4 Feb 2021 22:34:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWtf25sChz3Gmn; Thu, 4 Feb 2021 22:34:50 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 BBFEB13CC2; Thu, 4 Feb 2021 22:34:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114MYovG007460; Thu, 4 Feb 2021 22:34:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114MYoY5007457; Thu, 4 Feb 2021 22:34:50 GMT (envelope-from git) Date: Thu, 4 Feb 2021 22:34:50 GMT Message-Id: <202102042234.114MYoY5007457@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 87cefd5c3dc6 - stable/13 - MFC eb0b1b33: Enable multipath routing by default. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 87cefd5c3dc6e52609be1b01087b33511f1d16a8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 22:34:50 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=87cefd5c3dc6e52609be1b01087b33511f1d16a8 commit 87cefd5c3dc6e52609be1b01087b33511f1d16a8 Author: Alexander V. Chernikov AuthorDate: 2021-02-03 08:49:46 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-02-04 22:17:17 +0000 MFC eb0b1b33: Enable multipath routing by default. ROUTE_MPATH was added to the GENERIC kernel in r368648. According to the plan in D27428, it was enabled with `net.route.multipath` sysctl set to 0. Given enough time has passed, this change enables route multipath by default. The goal is to ship FreeBSD 13 with multipath turned on. Reviewed By: donner, olivier Relnotes: yes Differential Revision: https://reviews.freebsd.org/D28423 --- sys/net/route/route_ctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index 230d23845c64..955b1df9029f 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -101,7 +101,7 @@ SYSCTL_DECL(_net_route); #else #define _MP_FLAGS CTLFLAG_RD #endif -VNET_DEFINE(u_int, rib_route_multipath) = 0; +VNET_DEFINE(u_int, rib_route_multipath) = 1; SYSCTL_UINT(_net_route, OID_AUTO, multipath, _MP_FLAGS | CTLFLAG_VNET, &VNET_NAME(rib_route_multipath), 0, "Enable route multipath"); #undef _MP_FLAGS From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 22:34:53 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 660FA5312C5; Thu, 4 Feb 2021 22:34: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 4DWtf515WMz3Gtn; Thu, 4 Feb 2021 22:34:53 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0DA6313C23; Thu, 4 Feb 2021 22:34:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114MYqOw007498; Thu, 4 Feb 2021 22:34:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114MYqmj007497; Thu, 4 Feb 2021 22:34:52 GMT (envelope-from git) Date: Thu, 4 Feb 2021 22:34:52 GMT Message-Id: <202102042234.114MYqmj007497@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 88452cb15155 - stable/13 - MFC cb984c62d705: Fix multipath support for rib_lookup_info(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 88452cb1515550b5a9eb78ed2d88c97d09a57ee4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 22:34:53 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=88452cb1515550b5a9eb78ed2d88c97d09a57ee4 commit 88452cb1515550b5a9eb78ed2d88c97d09a57ee4 Author: Alexander V. Chernikov AuthorDate: 2021-01-29 23:10:52 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-02-04 22:33:20 +0000 MFC cb984c62d705: Fix multipath support for rib_lookup_info(). The initial plan was to remove rib_lookup_info() before FreeBSD 13. As several customers are still remaining, fix rib_lookup_info() for the multipath use case. --- sys/net/route.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sys/net/route.c b/sys/net/route.c index 7e087569d45f..a68e46c37861 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -79,8 +79,8 @@ EVENTHANDLER_LIST_DEFINE(rt_addrmsg); static int rt_ifdelroute(const struct rtentry *rt, const struct nhop_object *, void *arg); -static int rt_exportinfo(struct rtentry *rt, struct rt_addrinfo *info, - int flags); +static int rt_exportinfo(struct rtentry *rt, struct nhop_object *nh, + struct rt_addrinfo *info, int flags); /* * route initialization must occur before ip6_init2(), which happenas at @@ -330,15 +330,14 @@ ifa_ifwithroute(int flags, const struct sockaddr *dst, * * Returns 0 on success. */ -int -rt_exportinfo(struct rtentry *rt, struct rt_addrinfo *info, int flags) +static int +rt_exportinfo(struct rtentry *rt, struct nhop_object *nh, + struct rt_addrinfo *info, int flags) { struct rt_metrics *rmx; struct sockaddr *src, *dst; - struct nhop_object *nh; int sa_len; - nh = rt->rt_nhop; if (flags & NHR_COPY) { /* Copy destination if dst is non-zero */ src = rt_key(rt); @@ -424,6 +423,7 @@ rib_lookup_info(uint32_t fibnum, const struct sockaddr *dst, uint32_t flags, struct rib_head *rh; struct radix_node *rn; struct rtentry *rt; + struct nhop_object *nh; int error; KASSERT((fibnum < rt_numfibs), ("rib_lookup_rte: bad fibnum")); @@ -435,10 +435,11 @@ rib_lookup_info(uint32_t fibnum, const struct sockaddr *dst, uint32_t flags, rn = rh->rnh_matchaddr(__DECONST(void *, dst), &rh->head); if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) { rt = RNTORT(rn); + nh = nhop_select(rt->rt_nhop, flowid); /* Ensure route & ifp is UP */ - if (RT_LINK_IS_UP(rt->rt_nhop->nh_ifp)) { + if (RT_LINK_IS_UP(nh->nh_ifp)) { flags = (flags & NHR_REF) | NHR_COPY; - error = rt_exportinfo(rt, info, flags); + error = rt_exportinfo(rt, nh, info, flags); RIB_RUNLOCK(rh); return (error); From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 22:34:52 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 06B1D53149B; Thu, 4 Feb 2021 22:34: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 4DWtf36qL9z3H0S; Thu, 4 Feb 2021 22:34:51 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 DD02513E21; Thu, 4 Feb 2021 22:34:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114MYp2R007480; Thu, 4 Feb 2021 22:34:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114MYpAI007479; Thu, 4 Feb 2021 22:34:51 GMT (envelope-from git) Date: Thu, 4 Feb 2021 22:34:51 GMT Message-Id: <202102042234.114MYpAI007479@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 8efe1ef1c741 - stable/13 - MFC 53729367d388: Fix subinterface vlan creation. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8efe1ef1c7415c17899e6d1b5e1984bb3a95c55b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 22:34:52 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=8efe1ef1c7415c17899e6d1b5e1984bb3a95c55b commit 8efe1ef1c7415c17899e6d1b5e1984bb3a95c55b Author: Alexander V. Chernikov AuthorDate: 2021-01-26 07:22:23 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-02-04 22:21:00 +0000 MFC 53729367d388: Fix subinterface vlan creation. D26436 introduced support for stacked vlans that changed the way vlans are configured. In particular, this change broke setups that have same-number vlans as subinterfaces. Vlan support was initially created assuming "vlanX" semantics. In this paradigm, automatic number assignment supported by cloning (ifconfig vlan create) was a natural fit. When "ifaceX.Y" support was added, allowing to have the same vlan number on multiple devices, cloning code became more complex, as the is no unified "vlan" namespace anymore. Such interfaces got the first spare index from "vlan" cloner. This, in turn, led to the following problem: ifconfig ix0.333 create -> index 1 ifconfig ix0.444 create -> index 2 ifconfig vlan2 create -> allocation failure This change fixes such allocations by using cloning indexes only for "vlanX" interfaces. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D27505 --- sys/net/if_clone.c | 7 +++-- sys/net/if_vlan.c | 75 +++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 54 insertions(+), 28 deletions(-) diff --git a/sys/net/if_clone.c b/sys/net/if_clone.c index a55ce9c3005d..a98e43328e0c 100644 --- a/sys/net/if_clone.c +++ b/sys/net/if_clone.c @@ -571,7 +571,7 @@ if_clone_addgroup(struct ifnet *ifp, struct if_clone *ifc) /* * A utility function to extract unit numbers from interface names of - * the form name###[.###]. + * the form name###. * * Returns 0 on success and an error on failure. */ @@ -582,9 +582,8 @@ ifc_name2unit(const char *name, int *unit) int cutoff = INT_MAX / 10; int cutlim = INT_MAX % 10; - if ((cp = strrchr(name, '.')) == NULL) - cp = name; - for (; *cp != '\0' && (*cp < '0' || *cp > '9'); cp++); + for (cp = name; *cp != '\0' && (*cp < '0' || *cp > '9'); cp++) + ; if (*cp == '\0') { *unit = -1; } else if (cp[0] == '0' && cp[1] != '\0') { diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 9358724844cb..26fb48257c11 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -977,63 +977,86 @@ static int vlan_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params) { char *dp; - int wildcard; + bool wildcard = false; + bool subinterface = false; int unit; int error; - int vid; - uint16_t proto; + int vid = 0; + uint16_t proto = ETHERTYPE_VLAN; struct ifvlan *ifv; struct ifnet *ifp; - struct ifnet *p; + struct ifnet *p = NULL; struct ifaddr *ifa; struct sockaddr_dl *sdl; struct vlanreq vlr; static const u_char eaddr[ETHER_ADDR_LEN]; /* 00:00:00:00:00:00 */ - proto = ETHERTYPE_VLAN; /* - * There are two ways to specify the cloned device: + * There are three ways to specify the cloned device: * o pass a parameter block with the clone request. + * o specify parameters in the text of the clone device name * o specify no parameters and get an unattached device that * must be configured separately. - * The first technique is preferred; the latter is supported + * The first technique is preferred; the latter two are supported * for backwards compatibility. * * XXXRW: Note historic use of the word "tag" here. New ioctls may be * called for. */ + if (params) { error = copyin(params, &vlr, sizeof(vlr)); if (error) return error; + vid = vlr.vlr_tag; + proto = vlr.vlr_proto; + p = ifunit_ref(vlr.vlr_parent); if (p == NULL) return (ENXIO); - error = ifc_name2unit(name, &unit); - if (error != 0) { - if_rele(p); - return (error); - } - vid = vlr.vlr_tag; - proto = vlr.vlr_proto; - wildcard = (unit < 0); - } else { - p = NULL; - error = ifc_name2unit(name, &unit); - if (error != 0) - return (error); + } + + if ((error = ifc_name2unit(name, &unit)) == 0) { + /* + * vlanX interface. Set wildcard to true if the unit number + * is not fixed (-1) + */ wildcard = (unit < 0); + } else { + struct ifnet *p_tmp = vlan_clone_match_ethervid(name, &vid); + if (p_tmp != NULL) { + error = 0; + subinterface = true; + unit = IF_DUNIT_NONE; + wildcard = false; + if (p != NULL) { + if_rele(p_tmp); + if (p != p_tmp) + error = EINVAL; + } else + p = p_tmp; + } else + error = ENXIO; } - error = ifc_alloc_unit(ifc, &unit); if (error != 0) { if (p != NULL) if_rele(p); return (error); } + if (!subinterface) { + /* vlanX interface, mark X as busy or allocate new unit # */ + error = ifc_alloc_unit(ifc, &unit); + if (error != 0) { + if (p != NULL) + if_rele(p); + return (error); + } + } + /* In the wildcard case, we need to update the name. */ if (wildcard) { for (dp = name; *dp != '\0'; dp++); @@ -1046,7 +1069,8 @@ vlan_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params) ifv = malloc(sizeof(struct ifvlan), M_VLAN, M_WAITOK | M_ZERO); ifp = ifv->ifv_ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { - ifc_free_unit(ifc, unit); + if (!subinterface) + ifc_free_unit(ifc, unit); free(ifv, M_VLAN); if (p != NULL) if_rele(p); @@ -1094,7 +1118,8 @@ vlan_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params) ether_ifdetach(ifp); vlan_unconfig(ifp); if_free(ifp); - ifc_free_unit(ifc, unit); + if (!subinterface) + ifc_free_unit(ifc, unit); free(ifv, M_VLAN); return (error); @@ -1108,6 +1133,7 @@ static int vlan_clone_destroy(struct if_clone *ifc, struct ifnet *ifp) { struct ifvlan *ifv = ifp->if_softc; + int unit = ifp->if_dunit; if (ifp->if_vlantrunk) return (EBUSY); @@ -1123,7 +1149,8 @@ vlan_clone_destroy(struct if_clone *ifc, struct ifnet *ifp) NET_EPOCH_WAIT(); if_free(ifp); free(ifv, M_VLAN); - ifc_free_unit(ifc, ifp->if_dunit); + if (unit != IF_DUNIT_NONE) + ifc_free_unit(ifc, unit); return (0); } From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 22:34:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4FCB453147F; Thu, 4 Feb 2021 22:34: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 4DWtf66WHCz3Gtt; Thu, 4 Feb 2021 22:34:54 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5B00E13E22; Thu, 4 Feb 2021 22:34:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114MYse3007517; Thu, 4 Feb 2021 22:34:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114MYsbr007516; Thu, 4 Feb 2021 22:34:54 GMT (envelope-from git) Date: Thu, 4 Feb 2021 22:34:54 GMT Message-Id: <202102042234.114MYsbr007516@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 10977b9f8435 - stable/13 - MFC 91f2c69ec206: Fix unused-function waring when compiling with FIB_ALGO. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 10977b9f84352c7312a192e99f03dc155db79c54 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 22:34:57 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=10977b9f84352c7312a192e99f03dc155db79c54 commit 10977b9f84352c7312a192e99f03dc155db79c54 Author: Alexander V. Chernikov AuthorDate: 2021-01-30 23:24:26 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-02-04 22:33:53 +0000 MFC 91f2c69ec206: Fix unused-function waring when compiling with FIB_ALGO. --- sys/netinet6/in6_fib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/netinet6/in6_fib.c b/sys/netinet6/in6_fib.c index 3fbddbc28e3d..614f8111409a 100644 --- a/sys/netinet6/in6_fib.c +++ b/sys/netinet6/in6_fib.c @@ -218,6 +218,7 @@ check_urpf(struct nhop_object *nh, uint32_t flags, return (check_urpf_nhop(nh, flags, src_if)); } +#ifndef FIB_ALGO static struct nhop_object * lookup_nhop(uint32_t fibnum, const struct in6_addr *dst6, uint32_t scopeid) @@ -251,6 +252,7 @@ lookup_nhop(uint32_t fibnum, const struct in6_addr *dst6, return (nh); } +#endif /* * Performs reverse path forwarding lookup. From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 22:34:58 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3DB9053158E; Thu, 4 Feb 2021 22: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 4DWtf80wTtz3Gps; Thu, 4 Feb 2021 22:34:56 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B1D6E13CC3; Thu, 4 Feb 2021 22:34:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114MYt91007537; Thu, 4 Feb 2021 22:34:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114MYtPD007536; Thu, 4 Feb 2021 22:34:55 GMT (envelope-from git) Date: Thu, 4 Feb 2021 22:34:55 GMT Message-Id: <202102042234.114MYtPD007536@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 74216f4caef2 - stable/13 - MFC f8b7ebea4905: Improve fib_algo debug messages. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 74216f4caef2a4772c2903a04ac2843278fe00a8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 22:34:59 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=74216f4caef2a4772c2903a04ac2843278fe00a8 commit 74216f4caef2a4772c2903a04ac2843278fe00a8 Author: Alexander V. Chernikov AuthorDate: 2021-01-30 22:06:40 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-02-04 22:34:15 +0000 MFC f8b7ebea4905: Improve fib_algo debug messages. * Move per-prefix debug lines under LOG_DEBUG2 * Create fib instance counter to distingush log messages between instances * Add more messages on rebuild reason. MFC after: 3 days --- sys/net/route/fib_algo.c | 62 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/sys/net/route/fib_algo.c b/sys/net/route/fib_algo.c index b84217034e16..1f040ad259c5 100644 --- a/sys/net/route/fib_algo.c +++ b/sys/net/route/fib_algo.c @@ -118,6 +118,9 @@ SYSCTL_NODE(_net_route_algo, OID_AUTO, inet, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "IPv4 longest prefix match lookups"); #endif +/* Fib instance counter */ +static uint32_t fib_gen = 0; + struct nhop_ref_table { uint32_t count; int32_t refcnt[0]; @@ -137,7 +140,7 @@ struct fib_data { uint8_t fd_family; /* family */ uint32_t fd_fibnum; /* fibnum */ uint32_t fd_failed_rebuilds; /* stat: failed rebuilds */ - uint32_t fd_algo_mask; /* bitmask for algo data */ + uint32_t fd_gen; /* instance gen# */ struct callout fd_callout; /* rebuild callout */ void *fd_algo_data; /* algorithm data */ struct nhop_object **nh_idx; /* nhop idx->ptr array */ @@ -191,12 +194,15 @@ static int flm_debug_level = LOG_NOTICE; SYSCTL_INT(_net_route_algo, OID_AUTO, debug_level, CTLFLAG_RW | CTLFLAG_RWTUN, &flm_debug_level, 0, "debuglevel"); #define FLM_MAX_DEBUG_LEVEL LOG_DEBUG +#ifndef LOG_DEBUG2 +#define LOG_DEBUG2 8 +#endif #define _PASS_MSG(_l) (flm_debug_level >= (_l)) #define ALGO_PRINTF(_fmt, ...) printf("[fib_algo] %s: " _fmt "\n", __func__, ##__VA_ARGS__) -#define _ALGO_PRINTF(_fib, _fam, _aname, _func, _fmt, ...) \ - printf("[fib_algo] %s.%u (%s) %s: " _fmt "\n",\ - print_family(_fam), _fib, _aname, _func, ## __VA_ARGS__) +#define _ALGO_PRINTF(_fib, _fam, _aname, _gen, _func, _fmt, ...) \ + printf("[fib_algo] %s.%u (%s#%u) %s: " _fmt "\n",\ + print_family(_fam), _fib, _aname, _gen, _func, ## __VA_ARGS__) #define _RH_PRINTF(_fib, _fam, _func, _fmt, ...) \ printf("[fib_algo] %s.%u %s: " _fmt "\n", print_family(_fam), _fib, _func, ## __VA_ARGS__) #define RH_PRINTF(_l, _rh, _fmt, ...) if (_PASS_MSG(_l)) { \ @@ -205,8 +211,13 @@ SYSCTL_INT(_net_route_algo, OID_AUTO, debug_level, CTLFLAG_RW | CTLFLAG_RWTUN, #define FD_PRINTF(_l, _fd, _fmt, ...) FD_PRINTF_##_l(_l, _fd, _fmt, ## __VA_ARGS__) #define _FD_PRINTF(_l, _fd, _fmt, ...) if (_PASS_MSG(_l)) { \ _ALGO_PRINTF(_fd->fd_fibnum, _fd->fd_family, _fd->fd_flm->flm_name, \ - __func__, _fmt, ## __VA_ARGS__); \ + _fd->fd_gen, __func__, _fmt, ## __VA_ARGS__); \ } +#if FLM_MAX_DEBUG_LEVEL>=LOG_DEBUG2 +#define FD_PRINTF_LOG_DEBUG2 _FD_PRINTF +#else +#define FD_PRINTF_LOG_DEBUG2(_l, _fd, _fmt, ...) +#endif #if FLM_MAX_DEBUG_LEVEL>=LOG_DEBUG #define FD_PRINTF_LOG_DEBUG _FD_PRINTF #else @@ -371,7 +382,7 @@ fib_printf(int level, struct fib_data *fd, const char *func, char *fmt, ...) va_end(ap); _ALGO_PRINTF(fd->fd_fibnum, fd->fd_family, fd->fd_flm->flm_name, - func, "%s", buf); + fd->fd_gen, func, "%s", buf); } /* @@ -450,7 +461,7 @@ schedule_callout(struct fib_data *fd, int delay_ms) } static void -schedule_fd_rebuild(struct fib_data *fd) +schedule_fd_rebuild(struct fib_data *fd, const char *reason) { FIB_MOD_LOCK(); @@ -461,7 +472,8 @@ schedule_fd_rebuild(struct fib_data *fd) * Potentially re-schedules pending callout * initiated by schedule_algo_eval. */ - FD_PRINTF(LOG_INFO, fd, "Scheduling rebuilt"); + FD_PRINTF(LOG_INFO, fd, "Scheduling rebuild: %s (failures=%d)", + reason, fd->fd_failed_rebuilds); schedule_callout(fd, callout_calc_delay_ms(fd)); } FIB_MOD_UNLOCK(); @@ -527,7 +539,7 @@ handle_rtable_change_cb(struct rib_head *rnh, struct rib_cmd_info *rc, if (rc->rc_nh_new != NULL) { if (fib_ref_nhop(fd, rc->rc_nh_new) == 0) { /* ran out of indexes */ - schedule_fd_rebuild(fd); + schedule_fd_rebuild(fd, "ran out of nhop indexes"); return; } } @@ -546,7 +558,7 @@ handle_rtable_change_cb(struct rib_head *rnh, struct rib_cmd_info *rc, * Algo is not able to apply the update. * Schedule algo rebuild. */ - schedule_fd_rebuild(fd); + schedule_fd_rebuild(fd, "algo requested rebuild"); break; case FLM_ERROR: @@ -558,7 +570,7 @@ handle_rtable_change_cb(struct rib_head *rnh, struct rib_cmd_info *rc, FD_PRINTF(LOG_ERR, fd, "algo reported non-recoverable error"); if (!flm_error_add(fd->fd_flm, fd->fd_fibnum)) FD_PRINTF(LOG_ERR, fd, "failed to ban algo"); - schedule_fd_rebuild(fd); + schedule_fd_rebuild(fd, "algo reported non-recoverable error"); } } @@ -667,8 +679,9 @@ sync_algo(struct fib_data *fd) rib_walk_ext_internal(fd->fd_rh, true, sync_algo_cb, sync_algo_end_cb, &w); - FD_PRINTF(LOG_INFO, fd, "initial dump completed, result: %s", - print_op_result(w.result)); + FD_PRINTF(LOG_INFO, fd, + "initial dump completed (rtable version: %d), result: %s", + fd->fd_rh->rnh_gen, print_op_result(w.result)); return (w.result); } @@ -794,7 +807,7 @@ destroy_fd_instance(struct fib_data *fd) if ((fd->nh_idx != NULL) && (fd->nh_ref_table != NULL)) { for (int i = 0; i < fd->number_nhops; i++) { if (!is_idx_free(fd, i)) { - FD_PRINTF(LOG_DEBUG, fd, " FREE nhop %d %p", + FD_PRINTF(LOG_DEBUG2, fd, " FREE nhop %d %p", i, fd->nh_idx[i]); nhop_free_any(fd->nh_idx[i]); } @@ -845,6 +858,7 @@ try_setup_fd_instance(struct fib_lookup_module *flm, struct rib_head *rh, fd = malloc(sizeof(struct fib_data), M_RTABLE, M_NOWAIT | M_ZERO); if (fd == NULL) { *pfd = NULL; + RH_PRINTF(LOG_INFO, rh, "Unable to allocate fib_data structure"); return (FLM_REBUILD); } *pfd = fd; @@ -852,12 +866,15 @@ try_setup_fd_instance(struct fib_lookup_module *flm, struct rib_head *rh, estimate_nhop_scale(old_fd, fd); fd->fd_rh = rh; + fd->fd_gen = ++fib_gen; fd->fd_family = rh->rib_family; fd->fd_fibnum = rh->rib_fibnum; callout_init(&fd->fd_callout, 1); fd->fd_vnet = curvnet; fd->fd_flm = flm; + FD_PRINTF(LOG_DEBUG, fd, "allocated fd %p", fd); + FIB_MOD_LOCK(); flm->flm_refcount++; FIB_MOD_UNLOCK(); @@ -883,21 +900,27 @@ try_setup_fd_instance(struct fib_lookup_module *flm, struct rib_head *rh, /* Okay, we're ready for algo init */ void *old_algo_data = (old_fd != NULL) ? old_fd->fd_algo_data : NULL; result = flm->flm_init_cb(fd->fd_fibnum, fd, old_algo_data, &fd->fd_algo_data); - if (result != FLM_SUCCESS) + if (result != FLM_SUCCESS) { + FD_PRINTF(LOG_INFO, fd, "%s algo init failed", flm->flm_name); return (result); + } /* Try to subscribe */ if (flm->flm_change_rib_item_cb != NULL) { fd->fd_rs = rib_subscribe_internal(fd->fd_rh, handle_rtable_change_cb, fd, RIB_NOTIFY_IMMEDIATE, 0); - if (fd->fd_rs == NULL) + if (fd->fd_rs == NULL) { + FD_PRINTF(LOG_INFO, fd, "failed to subscribe to the rib changes"); return (FLM_REBUILD); + } } /* Dump */ result = sync_algo(fd); - if (result != FLM_SUCCESS) + if (result != FLM_SUCCESS) { + FD_PRINTF(LOG_INFO, fd, "rib sync failed"); return (result); + } FD_PRINTF(LOG_INFO, fd, "DUMP completed successfully."); FIB_MOD_LOCK(); @@ -953,6 +976,9 @@ setup_fd_instance(struct fib_lookup_module *flm, struct rib_head *rh, } if (result != FLM_SUCCESS) { + RH_PRINTF(LOG_WARNING, rh, + "%s algo instance setup failed, failures=%d", flm->flm_name, + orig_fd ? orig_fd->fd_failed_rebuilds + 1 : 0); /* update failure count */ FIB_MOD_LOCK(); if (orig_fd != NULL) @@ -1370,7 +1396,7 @@ fib_ref_nhop(struct fib_data *fd, struct nhop_object *nh) nhop_ref_any(nh); fd->nh_idx[idx] = nh; fd->nh_ref_table->count++; - FD_PRINTF(LOG_DEBUG, fd, " REF nhop %u %p", idx, fd->nh_idx[idx]); + FD_PRINTF(LOG_DEBUG2, fd, " REF nhop %u %p", idx, fd->nh_idx[idx]); } fd->nh_ref_table->refcnt[idx]++; From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 22:35:00 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B149531331; Thu, 4 Feb 2021 22: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 4DWtfC2pFtz3GsQ; Thu, 4 Feb 2021 22:34:58 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A462D13EA9; Thu, 4 Feb 2021 22:34:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114MYuE5007555; Thu, 4 Feb 2021 22:34:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114MYu5E007554; Thu, 4 Feb 2021 22:34:56 GMT (envelope-from git) Date: Thu, 4 Feb 2021 22:34:56 GMT Message-Id: <202102042234.114MYu5E007554@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: f5f50ec15688 - stable/13 - MFC ab6d9aaed76e: Move business logic from rebuild_fd_callout() into rebuild_fd(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f5f50ec15688d6aab67d3fb8fb0c98b89e4dbce0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 22:35:01 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=f5f50ec15688d6aab67d3fb8fb0c98b89e4dbce0 commit f5f50ec15688d6aab67d3fb8fb0c98b89e4dbce0 Author: Alexander V. Chernikov AuthorDate: 2021-01-30 22:32:42 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-02-04 22:34:15 +0000 MFC ab6d9aaed76e: Move business logic from rebuild_fd_callout() into rebuild_fd(). This simplifies code a bit and allows for future non-callout callers to request rebuild. --- sys/net/route/fib_algo.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/sys/net/route/fib_algo.c b/sys/net/route/fib_algo.c index 1f040ad259c5..f7a8b3f82431 100644 --- a/sys/net/route/fib_algo.c +++ b/sys/net/route/fib_algo.c @@ -155,6 +155,7 @@ struct fib_data { TAILQ_ENTRY(fib_data) entries; /* list of all fds in vnet */ }; +static bool rebuild_fd(struct fib_data *fd); static void rebuild_fd_callout(void *_data); static void destroy_fd_instance_epoch(epoch_context_t ctx); static enum flm_op_result attach_datapath(struct fib_data *fd); @@ -1011,13 +1012,28 @@ setup_fd_instance(struct fib_lookup_module *flm, struct rib_head *rh, static void rebuild_fd_callout(void *_data) { - struct fib_data *fd, *fd_new, *fd_tmp; + struct fib_data *fd = (struct fib_data *)_data; + + FD_PRINTF(LOG_INFO, fd, "running callout rebuild"); + + CURVNET_SET(fd->fd_vnet); + rebuild_fd(fd); + CURVNET_RESTORE(); +} + +/* + * Tries to create new algo instance based on @fd data. + * Returns true on success. + */ +static bool +rebuild_fd(struct fib_data *fd) +{ + struct fib_data *fd_new, *fd_tmp; struct fib_lookup_module *flm_new = NULL; struct epoch_tracker et; enum flm_op_result result; bool need_rebuild = false; - fd = (struct fib_data *)_data; FIB_MOD_LOCK(); need_rebuild = fd->fd_need_rebuild; @@ -1026,15 +1042,12 @@ rebuild_fd_callout(void *_data) fd->fd_num_changes = 0; FIB_MOD_UNLOCK(); - CURVNET_SET(fd->fd_vnet); - /* First, check if we're still OK to use this algo */ if (!is_algo_fixed(fd->fd_rh)) flm_new = fib_check_best_algo(fd->fd_rh, fd->fd_flm); if ((flm_new == NULL) && (!need_rebuild)) { /* Keep existing algo, no need to rebuild. */ - CURVNET_RESTORE(); - return; + return (true); } if (flm_new == NULL) { @@ -1051,19 +1064,16 @@ rebuild_fd_callout(void *_data) } if (result != FLM_SUCCESS) { FD_PRINTF(LOG_NOTICE, fd, "table rebuild failed"); - CURVNET_RESTORE(); - return; + return (false); } FD_PRINTF(LOG_INFO, fd_new, "switched to new instance"); - /* Remove old instance removal */ - if (fd != NULL) { - NET_EPOCH_ENTER(et); - schedule_destroy_fd_instance(fd, true); - NET_EPOCH_EXIT(et); - } + /* Remove old instance */ + NET_EPOCH_ENTER(et); + schedule_destroy_fd_instance(fd, true); + NET_EPOCH_EXIT(et); - CURVNET_RESTORE(); + return (true); } /* From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 22:35:01 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 050E75311BB; Thu, 4 Feb 2021 22:35:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWtfD0lgbz3GsR; Thu, 4 Feb 2021 22:35:00 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D56ED14003; Thu, 4 Feb 2021 22:34:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114MYxYL007615; Thu, 4 Feb 2021 22:34:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114MYxM3007614; Thu, 4 Feb 2021 22:34:59 GMT (envelope-from git) Date: Thu, 4 Feb 2021 22:34:59 GMT Message-Id: <202102042234.114MYxM3007614@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 211afd1e2391 - stable/13 - MFC 78c93a172114: Use process fib for inet/inet6 fib_algo sysctls. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 211afd1e2391ba5aa7a7a5af5b4b7d71d404d15e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 22:35:01 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=211afd1e2391ba5aa7a7a5af5b4b7d71d404d15e commit 211afd1e2391ba5aa7a7a5af5b4b7d71d404d15e Author: Alexander V. Chernikov AuthorDate: 2021-01-31 10:48:47 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-02-04 22:34:15 +0000 MFC 78c93a172114: Use process fib for inet/inet6 fib_algo sysctls. This allows to set/query fib algo for non-default fibs. --- sys/net/route/fib_algo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/net/route/fib_algo.c b/sys/net/route/fib_algo.c index 21b6ba924069..b2aa2de087de 100644 --- a/sys/net/route/fib_algo.c +++ b/sys/net/route/fib_algo.c @@ -1202,7 +1202,7 @@ static int set_algo_inet_sysctl_handler(SYSCTL_HANDLER_ARGS) { - return (set_fib_algo(RT_DEFAULT_FIB, AF_INET, oidp, req)); + return (set_fib_algo(curthread->td_proc->p_fibnum, AF_INET, oidp, req)); } SYSCTL_PROC(_net_route_algo_inet, OID_AUTO, algo, CTLFLAG_VNET | CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, 0, @@ -1214,7 +1214,7 @@ static int set_algo_inet6_sysctl_handler(SYSCTL_HANDLER_ARGS) { - return (set_fib_algo(RT_DEFAULT_FIB, AF_INET6, oidp, req)); + return (set_fib_algo(curthread->td_proc->p_fibnum, AF_INET6, oidp, req)); } SYSCTL_PROC(_net_route_algo_inet6, OID_AUTO, algo, CTLFLAG_VNET | CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, 0, From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 22:35:01 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 28571531332; Thu, 4 Feb 2021 22:35:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWtfD0lmlz3GsS; Thu, 4 Feb 2021 22:35:00 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B3ED913E23; Thu, 4 Feb 2021 22:34:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114MYvI9007573; Thu, 4 Feb 2021 22:34:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114MYvk4007572; Thu, 4 Feb 2021 22:34:57 GMT (envelope-from git) Date: Thu, 4 Feb 2021 22:34:57 GMT Message-Id: <202102042234.114MYvk4007572@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 2a3cbb6c8954 - stable/13 - MFC dd9163003cb1: Add rib_subscribe_locked() and rib_unsubsribe_locked() to support subscriptions during RIB modifications. Add new subscriptions to the beginning of the lists instead of the end. This fixes the situation when new subscription is created int the callback for the existing subscription, leading to the subscription notification handler pick it. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2a3cbb6c8954b71ee5bcd49cd2d05e41b960975d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 22:35:01 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=2a3cbb6c8954b71ee5bcd49cd2d05e41b960975d commit 2a3cbb6c8954b71ee5bcd49cd2d05e41b960975d Author: Alexander V. Chernikov AuthorDate: 2021-01-30 21:52:44 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-02-04 22:34:15 +0000 MFC dd9163003cb1: Add rib_subscribe_locked() and rib_unsubsribe_locked() to support subscriptions during RIB modifications. Add new subscriptions to the beginning of the lists instead of the end. This fixes the situation when new subscription is created int the callback for the existing subscription, leading to the subscription notification handler pick it. --- sys/net/route/route_ctl.c | 34 +++++++++++++++++++++++++++++++++- sys/net/route/route_ctl.h | 3 +++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index 955b1df9029f..6b0869196d12 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -1407,13 +1407,31 @@ rib_subscribe_internal(struct rib_head *rnh, rib_subscription_cb_t *f, void *arg NET_EPOCH_ENTER(et); RIB_WLOCK(rnh); - CK_STAILQ_INSERT_TAIL(&rnh->rnh_subscribers, rs, next); + CK_STAILQ_INSERT_HEAD(&rnh->rnh_subscribers, rs, next); RIB_WUNLOCK(rnh); NET_EPOCH_EXIT(et); return (rs); } +struct rib_subscription * +rib_subscribe_locked(struct rib_head *rnh, rib_subscription_cb_t *f, void *arg, + enum rib_subscription_type type) +{ + struct rib_subscription *rs; + + NET_EPOCH_ASSERT(); + RIB_WLOCK_ASSERT(rnh); + + if ((rs = allocate_subscription(f, arg, type, false)) == NULL) + return (NULL); + rs->rnh = rnh; + + CK_STAILQ_INSERT_HEAD(&rnh->rnh_subscribers, rs, next); + + return (rs); +} + /* * Remove rtable subscription @rs from the routing table. * Needs to be run in network epoch. @@ -1433,6 +1451,20 @@ rib_unsibscribe(struct rib_subscription *rs) &rs->epoch_ctx); } +void +rib_unsibscribe_locked(struct rib_subscription *rs) +{ + struct rib_head *rnh = rs->rnh; + + NET_EPOCH_ASSERT(); + RIB_WLOCK_ASSERT(rnh); + + CK_STAILQ_REMOVE(&rnh->rnh_subscribers, rs, rib_subscription, next); + + epoch_call(net_epoch_preempt, destroy_subscription_epoch, + &rs->epoch_ctx); +} + /* * Epoch callback indicating subscription is safe to destroy */ diff --git a/sys/net/route/route_ctl.h b/sys/net/route/route_ctl.h index ecbc9ee91dc0..bd256e9f0834 100644 --- a/sys/net/route/route_ctl.h +++ b/sys/net/route/route_ctl.h @@ -144,6 +144,9 @@ struct rib_subscription *rib_subscribe(uint32_t fibnum, int family, struct rib_subscription *rib_subscribe_internal(struct rib_head *rnh, rib_subscription_cb_t *f, void *arg, enum rib_subscription_type type, bool waitok); +struct rib_subscription *rib_subscribe_locked(struct rib_head *rnh, + rib_subscription_cb_t *f, void *arg, enum rib_subscription_type type); void rib_unsibscribe(struct rib_subscription *rs); +void rib_unsibscribe_locked(struct rib_subscription *rs); #endif From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 22:35:01 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9825D5311BF; Thu, 4 Feb 2021 22:35:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWtfD0mGJz3Gy1; Thu, 4 Feb 2021 22:35:00 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 BDB0113FF7; Thu, 4 Feb 2021 22:34:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114MYwOC007595; Thu, 4 Feb 2021 22:34:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114MYwDq007594; Thu, 4 Feb 2021 22:34:58 GMT (envelope-from git) Date: Thu, 4 Feb 2021 22:34:58 GMT Message-Id: <202102042234.114MYwDq007594@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 6bc5d49aba14 - stable/13 - MFC 151ec796a230: Fix the design problem with delayed algorithm sync. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6bc5d49aba14c6ce102d4392cd53bcdf8b61c2fc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 22:35:01 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=6bc5d49aba14c6ce102d4392cd53bcdf8b61c2fc commit 6bc5d49aba14c6ce102d4392cd53bcdf8b61c2fc Author: Alexander V. Chernikov AuthorDate: 2021-01-30 22:45:46 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-02-04 22:34:15 +0000 MFC 151ec796a230: Fix the design problem with delayed algorithm sync. Currently, if the immutable algorithm like bsearch or radix_lockless receives rtable update notification, it schedules algorithm rebuild. This rebuild is executed by the callout after ~50 milliseconds. It is possible that a script adding an interface address and than route with the gateway bound to that address will fail. It can happen due to the fact that fib is not updated by the time the route addition request arrives. Fix this by allowing synchronous algorithm rebuilds based on certain conditions. By default, these conditions assume: 1) less than net.route.algo.fib_sync_limit=100 routes 2) routes without gateway. * Move algo instance build entirely under rib WLOCK. Rib lock is only used for control plane (except radix algo, but there are no rebuilds). * Add rib_walk_ext_locked() function to allow RIB iteration with rib lock already held. * Fix rare potential callout use-after-free for fds by binding fd callout to the relevant rib rmlock. In that case, callout_stop() under rib WLOCK guarantees no callout will be executed afterwards. --- sys/net/route/fib_algo.c | 110 ++++++++++++++++++++++++++++-------------- sys/net/route/route_ctl.h | 2 + sys/net/route/route_helpers.c | 17 +++++-- 3 files changed, 87 insertions(+), 42 deletions(-) diff --git a/sys/net/route/fib_algo.c b/sys/net/route/fib_algo.c index f7a8b3f82431..21b6ba924069 100644 --- a/sys/net/route/fib_algo.c +++ b/sys/net/route/fib_algo.c @@ -105,6 +105,11 @@ SYSCTL_DECL(_net_route); SYSCTL_NODE(_net_route, OID_AUTO, algo, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "Fib algorithm lookups"); +VNET_DEFINE(int, fib_sync_limit) = 100; +#define V_fib_sync_limit VNET(fib_sync_limit) +SYSCTL_INT(_net_route_algo, OID_AUTO, fib_sync_limit, CTLFLAG_RW | CTLFLAG_VNET, + &VNET_NAME(fib_sync_limit), 0, "Guarantee synchronous fib till route limit"); + #ifdef INET6 VNET_DEFINE_STATIC(bool, algo_fixed_inet6) = false; #define V_algo_fixed_inet6 VNET(algo_fixed_inet6) @@ -465,7 +470,8 @@ static void schedule_fd_rebuild(struct fib_data *fd, const char *reason) { - FIB_MOD_LOCK(); + RIB_WLOCK_ASSERT(fd->fd_rh); + if (!fd->fd_need_rebuild) { fd->fd_need_rebuild = true; @@ -477,30 +483,52 @@ schedule_fd_rebuild(struct fib_data *fd, const char *reason) reason, fd->fd_failed_rebuilds); schedule_callout(fd, callout_calc_delay_ms(fd)); } - FIB_MOD_UNLOCK(); } static void schedule_algo_eval(struct fib_data *fd) { + RIB_WLOCK_ASSERT(fd->fd_rh); + if (fd->fd_num_changes++ == 0) { /* Start callout to consider switch */ - FIB_MOD_LOCK(); if (!callout_pending(&fd->fd_callout)) schedule_callout(fd, ALGO_EVAL_DELAY_MS); - FIB_MOD_UNLOCK(); } else if (fd->fd_num_changes > ALGO_EVAL_NUM_ROUTES && !fd->fd_force_eval) { /* Reset callout to exec immediately */ - FIB_MOD_LOCK(); if (!fd->fd_need_rebuild) { fd->fd_force_eval = true; schedule_callout(fd, 1); } - FIB_MOD_UNLOCK(); } } +static bool +need_immediate_rebuild(struct fib_data *fd, struct rib_cmd_info *rc) +{ + struct nhop_object *nh; + + if ((V_fib_sync_limit == 0) || (fd->fd_rh->rnh_prefixes <= V_fib_sync_limit)) + return (true); + + /* Sync addition/removal of interface routes */ + switch (rc->rc_cmd) { + case RTM_ADD: + nh = rc->rc_nh_new; + if (!NH_IS_NHGRP(nh) && (!(nh->nh_flags & NHF_GATEWAY))) + return (true); + break; + case RTM_DELETE: + nh = rc->rc_nh_old; + if (!NH_IS_NHGRP(nh) && (!(nh->nh_flags & NHF_GATEWAY))) + return (true); + break; + } + + return (false); +} + /* * Rib subscription handler. Checks if the algorithm is ready to * receive updates, handles nexthop refcounting and passes change @@ -559,7 +587,15 @@ handle_rtable_change_cb(struct rib_head *rnh, struct rib_cmd_info *rc, * Algo is not able to apply the update. * Schedule algo rebuild. */ - schedule_fd_rebuild(fd, "algo requested rebuild"); + if (!need_immediate_rebuild(fd, rc)) { + schedule_fd_rebuild(fd, "algo requested rebuild"); + break; + } + + fd->fd_need_rebuild = true; + FD_PRINTF(LOG_INFO, fd, "running sync rebuild"); + if (!rebuild_fd(fd)) + schedule_fd_rebuild(fd, "sync rebuild failed"); break; case FLM_ERROR: @@ -678,7 +714,7 @@ sync_algo(struct fib_data *fd) .result = FLM_SUCCESS, }; - rib_walk_ext_internal(fd->fd_rh, true, sync_algo_cb, sync_algo_end_cb, &w); + rib_walk_ext_locked(fd->fd_rh, sync_algo_cb, sync_algo_end_cb, &w); FD_PRINTF(LOG_INFO, fd, "initial dump completed (rtable version: %d), result: %s", @@ -702,6 +738,7 @@ schedule_destroy_fd_instance(struct fib_data *fd, bool in_callout) bool is_dead; NET_EPOCH_ASSERT(); + RIB_WLOCK_ASSERT(fd->fd_rh); FIB_MOD_LOCK(); is_dead = fd->fd_dead; @@ -718,27 +755,13 @@ schedule_destroy_fd_instance(struct fib_data *fd, bool in_callout) FD_PRINTF(LOG_INFO, fd, "DETACH"); if (fd->fd_rs != NULL) - rib_unsibscribe(fd->fd_rs); + rib_unsibscribe_locked(fd->fd_rs); /* * After rib_unsubscribe() no _new_ handle_rtable_change_cb() calls * will be executed, hence no _new_ callout schedules will happen. - * - * There can be 2 possible scenarious here: - * 1) we're running inside a callout when we're deleting ourselves - * due to migration to a newer fd - * 2) we're running from rt_table_destroy() and callout is scheduled - * for execution OR is executing - * - * For (2) we need to wait for the callout termination, as the routing table - * will be destroyed after this function returns. - * For (1) we cannot call drain, but can ensure that this is the last invocation. */ - - if (in_callout) - callout_stop(&fd->fd_callout); - else - callout_drain(&fd->fd_callout); + callout_stop(&fd->fd_callout); epoch_call(net_epoch_preempt, destroy_fd_instance_epoch, &fd->fd_epoch_ctx); @@ -774,7 +797,11 @@ fib_cleanup_algo(struct rib_head *rh, bool keep_first, bool in_callout) /* Pass 2: remove each entry */ NET_EPOCH_ENTER(et); TAILQ_FOREACH_SAFE(fd, &tmp_head, entries, fd_tmp) { + if (!in_callout) + RIB_WLOCK(fd->fd_rh); schedule_destroy_fd_instance(fd, in_callout); + if (!in_callout) + RIB_WUNLOCK(fd->fd_rh); } NET_EPOCH_EXIT(et); } @@ -870,7 +897,7 @@ try_setup_fd_instance(struct fib_lookup_module *flm, struct rib_head *rh, fd->fd_gen = ++fib_gen; fd->fd_family = rh->rib_family; fd->fd_fibnum = rh->rib_fibnum; - callout_init(&fd->fd_callout, 1); + callout_init_rm(&fd->fd_callout, &rh->rib_lock, 0); fd->fd_vnet = curvnet; fd->fd_flm = flm; @@ -908,8 +935,8 @@ try_setup_fd_instance(struct fib_lookup_module *flm, struct rib_head *rh, /* Try to subscribe */ if (flm->flm_change_rib_item_cb != NULL) { - fd->fd_rs = rib_subscribe_internal(fd->fd_rh, - handle_rtable_change_cb, fd, RIB_NOTIFY_IMMEDIATE, 0); + fd->fd_rs = rib_subscribe_locked(fd->fd_rh, + handle_rtable_change_cb, fd, RIB_NOTIFY_IMMEDIATE); if (fd->fd_rs == NULL) { FD_PRINTF(LOG_INFO, fd, "failed to subscribe to the rib changes"); return (FLM_REBUILD); @@ -946,13 +973,14 @@ setup_fd_instance(struct fib_lookup_module *flm, struct rib_head *rh, struct fib_data *orig_fd, struct fib_data **pfd, bool attach) { struct fib_data *prev_fd, *new_fd; - struct epoch_tracker et; enum flm_op_result result; + NET_EPOCH_ASSERT(); + RIB_WLOCK_ASSERT(rh); + prev_fd = orig_fd; new_fd = NULL; for (int i = 0; i < FIB_MAX_TRIES; i++) { - NET_EPOCH_ENTER(et); result = try_setup_fd_instance(flm, rh, prev_fd, &new_fd); if ((result == FLM_SUCCESS) && attach) @@ -962,7 +990,6 @@ setup_fd_instance(struct fib_lookup_module *flm, struct rib_head *rh, schedule_destroy_fd_instance(prev_fd, false); prev_fd = NULL; } - NET_EPOCH_EXIT(et); RH_PRINTF(LOG_INFO, rh, "try %d: fib algo result: %s", i, print_op_result(result)); @@ -990,14 +1017,12 @@ setup_fd_instance(struct fib_lookup_module *flm, struct rib_head *rh, if (result == FLM_ERROR) flm_error_add(flm, rh->rib_fibnum); - NET_EPOCH_ENTER(et); if ((prev_fd != NULL) && (prev_fd != orig_fd)) schedule_destroy_fd_instance(prev_fd, false); if (new_fd != NULL) { schedule_destroy_fd_instance(new_fd, false); new_fd = NULL; } - NET_EPOCH_EXIT(et); } *pfd = new_fd; @@ -1013,12 +1038,15 @@ static void rebuild_fd_callout(void *_data) { struct fib_data *fd = (struct fib_data *)_data; + struct epoch_tracker et; FD_PRINTF(LOG_INFO, fd, "running callout rebuild"); + NET_EPOCH_ENTER(et); CURVNET_SET(fd->fd_vnet); rebuild_fd(fd); CURVNET_RESTORE(); + NET_EPOCH_EXIT(et); } /* @@ -1030,17 +1058,16 @@ rebuild_fd(struct fib_data *fd) { struct fib_data *fd_new, *fd_tmp; struct fib_lookup_module *flm_new = NULL; - struct epoch_tracker et; enum flm_op_result result; bool need_rebuild = false; + NET_EPOCH_ASSERT(); + RIB_WLOCK_ASSERT(fd->fd_rh); - FIB_MOD_LOCK(); need_rebuild = fd->fd_need_rebuild; fd->fd_need_rebuild = false; fd->fd_force_eval = false; fd->fd_num_changes = 0; - FIB_MOD_UNLOCK(); /* First, check if we're still OK to use this algo */ if (!is_algo_fixed(fd->fd_rh)) @@ -1069,9 +1096,7 @@ rebuild_fd(struct fib_data *fd) FD_PRINTF(LOG_INFO, fd_new, "switched to new instance"); /* Remove old instance */ - NET_EPOCH_ENTER(et); schedule_destroy_fd_instance(fd, true); - NET_EPOCH_EXIT(et); return (true); } @@ -1116,6 +1141,7 @@ set_fib_algo(uint32_t fibnum, int family, struct sysctl_oid *oidp, struct sysctl char old_algo_name[32], algo_name[32]; struct rib_head *rh = NULL; enum flm_op_result result; + struct epoch_tracker et; int error; /* Fetch current algo/rib for af/family */ @@ -1149,7 +1175,11 @@ set_fib_algo(uint32_t fibnum, int family, struct sysctl_oid *oidp, struct sysctl } fd = NULL; + NET_EPOCH_ENTER(et); + RIB_WLOCK(rh); result = setup_fd_instance(flm, rh, NULL, &fd, true); + RIB_WUNLOCK(rh); + NET_EPOCH_EXIT(et); fib_unref_algo(flm); if (result != FLM_SUCCESS) return (EINVAL); @@ -1558,6 +1588,7 @@ fib_select_algo_initial(struct rib_head *rh) struct fib_lookup_module *flm; struct fib_data *fd = NULL; enum flm_op_result result; + struct epoch_tracker et; int error = 0; flm = fib_check_best_algo(rh, NULL); @@ -1567,7 +1598,12 @@ fib_select_algo_initial(struct rib_head *rh) } RH_PRINTF(LOG_INFO, rh, "selected algo %s", flm->flm_name); + NET_EPOCH_ENTER(et); + RIB_WLOCK(rh); result = setup_fd_instance(flm, rh, NULL, &fd, false); + RIB_WUNLOCK(rh); + NET_EPOCH_EXIT(et); + RH_PRINTF(LOG_DEBUG, rh, "result=%d fd=%p", result, fd); if (result == FLM_SUCCESS) { diff --git a/sys/net/route/route_ctl.h b/sys/net/route/route_ctl.h index bd256e9f0834..46dba759f8df 100644 --- a/sys/net/route/route_ctl.h +++ b/sys/net/route/route_ctl.h @@ -75,6 +75,8 @@ void rib_walk_ext(uint32_t fibnum, int af, bool wlock, rib_walktree_f_t *wa_f, rib_walk_hook_f_t *hook_f, void *arg); void rib_walk_ext_internal(struct rib_head *rnh, bool wlock, rib_walktree_f_t *wa_f, rib_walk_hook_f_t *hook_f, void *arg); +void rib_walk_ext_locked(struct rib_head *rnh, rib_walktree_f_t *wa_f, + rib_walk_hook_f_t *hook_f, void *arg); void rib_walk_del(u_int fibnum, int family, rib_filter_f_t *filter_f, void *arg, bool report); diff --git a/sys/net/route/route_helpers.c b/sys/net/route/route_helpers.c index 88733fff419b..782e160ca51b 100644 --- a/sys/net/route/route_helpers.c +++ b/sys/net/route/route_helpers.c @@ -67,6 +67,17 @@ __FBSDID("$FreeBSD$"); * RIB helper functions. */ +void +rib_walk_ext_locked(struct rib_head *rnh, rib_walktree_f_t *wa_f, + rib_walk_hook_f_t *hook_f, void *arg) +{ + if (hook_f != NULL) + hook_f(rnh, RIB_WALK_HOOK_PRE, arg); + rnh->rnh_walktree(&rnh->head, (walktree_f_t *)wa_f, arg); + if (hook_f != NULL) + hook_f(rnh, RIB_WALK_HOOK_POST, arg); +} + /* * Calls @wa_f with @arg for each entry in the table specified by * @af and @fibnum. @@ -86,11 +97,7 @@ rib_walk_ext_internal(struct rib_head *rnh, bool wlock, rib_walktree_f_t *wa_f, RIB_WLOCK(rnh); else RIB_RLOCK(rnh); - if (hook_f != NULL) - hook_f(rnh, RIB_WALK_HOOK_PRE, arg); - rnh->rnh_walktree(&rnh->head, (walktree_f_t *)wa_f, arg); - if (hook_f != NULL) - hook_f(rnh, RIB_WALK_HOOK_POST, arg); + rib_walk_ext_locked(rnh, wa_f, hook_f, arg); if (wlock) RIB_WUNLOCK(rnh); else From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 22:59:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01B0C53243B; Thu, 4 Feb 2021 22:59:41 +0000 (UTC) (envelope-from rob.fx907@gmail.com) Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWvBh6TGGz3KTt; Thu, 4 Feb 2021 22:59:40 +0000 (UTC) (envelope-from rob.fx907@gmail.com) Received: by mail-oi1-x230.google.com with SMTP id m7so5476226oiw.12; Thu, 04 Feb 2021 14:59:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=JCW8DKbgrNIRCcT7Nl9UCt2G+fKTq9upCpSmxZ8TWnY=; b=YF7m26ShpkH3P3tbvWfYEbl78K5Tnq/axMXPRNNIol7YczjtdoSnfXsB9Ils1srqCT MQsL4RsB168svPJdIJ0WSBoeBkVPS54w+VamDSgG0M5E5wiBJvhI5veVNqE2RM6ztSyw p/I1Z1KbpjUbMm/MsFZfFJERHjLcvoyqkmyivSU9f5JwWFbZgpzExzFbXmkkuzWrxpVx gerWGvIfbEPgok4nomaB7FJlA8sfDVTOEybj0apscfCw8kqe7HJPTvIiIAV+UxvePxx9 2UH0RIjEocne8hmbrOhbAaCTmjGjEl5jSbAOqSVVMxcSik2R9AHi9luQVvND0OQZdM3e bMtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=JCW8DKbgrNIRCcT7Nl9UCt2G+fKTq9upCpSmxZ8TWnY=; b=k4T9FGa2NZkH39hcjmbLarvP20vmbkAJ5Y8adjrIQ0Th6spV06wRSwQzYsij8xU9tD 2AMAk66cxm4CX3s1eQ9w37+ENRpXN9bdzYWH60iNi7EW32zzvaOvomdPRkt2XCrpdxtl zIkEUlxgmrlNSryvLUZOnUPAlfXwzBTp0EXJ6TMhheU4COEVhtkTW6AwwhLalTngTAZt /cSxlYO4voDbwEhuLgxvpQwte7qEmGHOLJp9BELgrSnLAQwpl9Xe1kFig/zoPM3tDyyu Z+RGK05gACiysEyrTs1yOgcGNJ2XRNWcr0FyftByuqKzqU6vpS7yt+rvVWzYILaWJcVg ir+w== X-Gm-Message-State: AOAM533Qca5LHkaf3BcSLIsB6yr44FQDxF3aOCvP53DaM4BVdE+tmh0S ssfw/e73B2aZ6k0GJCNO56HbZqPejZdl25HIwTcmYU01ibs= X-Google-Smtp-Source: ABdhPJx4HsXVt4pGR4yUVZiGQyxRhKF0syU52p6A0r4lxsjKMoJxMq5NQcBhK+KJTD9YtjnTCwVSH8z7fukAtSKolEk= X-Received: by 2002:a05:6808:8a:: with SMTP id s10mr1253858oic.152.1612479579877; Thu, 04 Feb 2021 14:59:39 -0800 (PST) MIME-Version: 1.0 Received: by 2002:ac9:3170:0:0:0:0:0 with HTTP; Thu, 4 Feb 2021 14:59:39 -0800 (PST) In-Reply-To: <202102042234.114MYu5E007554@gitrepo.freebsd.org> References: <202102042234.114MYu5E007554@gitrepo.freebsd.org> From: Rob Wing Date: Thu, 4 Feb 2021 13:59:39 -0900 Message-ID: Subject: Re: git: f5f50ec15688 - stable/13 - MFC ab6d9aaed76e: Move business logic from rebuild_fd_callout() into rebuild_fd(). To: "Alexander V. Chernikov" Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-branches@freebsd.org" X-Rspamd-Queue-Id: 4DWvBh6TGGz3KTt X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 22:59:41 -0000 I=E2=80=99m not opinionated on this, only pointing out that most MFC commit= s lately have trended towards using git cherry-pick and dropping the MFC: xxxxxx in the commit message. I know Warner encourages this, as documented at https://github.com/bsdimp/freebsd-git-docs/blob/main/MFC.md#marking-mfcs -Rob On Thursday, February 4, 2021, Alexander V. Chernikov wrote: > The branch stable/13 has been updated by melifaro: > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D > f5f50ec15688d6aab67d3fb8fb0c98b89e4dbce0 > > commit f5f50ec15688d6aab67d3fb8fb0c98b89e4dbce0 > Author: Alexander V. Chernikov > AuthorDate: 2021-01-30 22:32:42 +0000 > Commit: Alexander V. Chernikov > CommitDate: 2021-02-04 22:34:15 +0000 > > MFC ab6d9aaed76e: Move business logic from rebuild_fd_callout() into > rebuild_fd(). > > This simplifies code a bit and allows for future non-callout > callers to request rebuild. > --- > sys/net/route/fib_algo.c | 40 +++++++++++++++++++++++++--------------- > 1 file changed, 25 insertions(+), 15 deletions(-) > > diff --git a/sys/net/route/fib_algo.c b/sys/net/route/fib_algo.c > index 1f040ad259c5..f7a8b3f82431 100644 > --- a/sys/net/route/fib_algo.c > +++ b/sys/net/route/fib_algo.c > @@ -155,6 +155,7 @@ struct fib_data { > TAILQ_ENTRY(fib_data) entries; /* list of all fds in vne= t > */ > }; > > +static bool rebuild_fd(struct fib_data *fd); > static void rebuild_fd_callout(void *_data); > static void destroy_fd_instance_epoch(epoch_context_t ctx); > static enum flm_op_result attach_datapath(struct fib_data *fd); > @@ -1011,13 +1012,28 @@ setup_fd_instance(struct fib_lookup_module *flm, > struct rib_head *rh, > static void > rebuild_fd_callout(void *_data) > { > - struct fib_data *fd, *fd_new, *fd_tmp; > + struct fib_data *fd =3D (struct fib_data *)_data; > + > + FD_PRINTF(LOG_INFO, fd, "running callout rebuild"); > + > + CURVNET_SET(fd->fd_vnet); > + rebuild_fd(fd); > + CURVNET_RESTORE(); > +} > + > +/* > + * Tries to create new algo instance based on @fd data. > + * Returns true on success. > + */ > +static bool > +rebuild_fd(struct fib_data *fd) > +{ > + struct fib_data *fd_new, *fd_tmp; > struct fib_lookup_module *flm_new =3D NULL; > struct epoch_tracker et; > enum flm_op_result result; > bool need_rebuild =3D false; > > - fd =3D (struct fib_data *)_data; > > FIB_MOD_LOCK(); > need_rebuild =3D fd->fd_need_rebuild; > @@ -1026,15 +1042,12 @@ rebuild_fd_callout(void *_data) > fd->fd_num_changes =3D 0; > FIB_MOD_UNLOCK(); > > - CURVNET_SET(fd->fd_vnet); > - > /* First, check if we're still OK to use this algo */ > if (!is_algo_fixed(fd->fd_rh)) > flm_new =3D fib_check_best_algo(fd->fd_rh, fd->fd_flm); > if ((flm_new =3D=3D NULL) && (!need_rebuild)) { > /* Keep existing algo, no need to rebuild. */ > - CURVNET_RESTORE(); > - return; > + return (true); > } > > if (flm_new =3D=3D NULL) { > @@ -1051,19 +1064,16 @@ rebuild_fd_callout(void *_data) > } > if (result !=3D FLM_SUCCESS) { > FD_PRINTF(LOG_NOTICE, fd, "table rebuild failed"); > - CURVNET_RESTORE(); > - return; > + return (false); > } > FD_PRINTF(LOG_INFO, fd_new, "switched to new instance"); > > - /* Remove old instance removal */ > - if (fd !=3D NULL) { > - NET_EPOCH_ENTER(et); > - schedule_destroy_fd_instance(fd, true); > - NET_EPOCH_EXIT(et); > - } > + /* Remove old instance */ > + NET_EPOCH_ENTER(et); > + schedule_destroy_fd_instance(fd, true); > + NET_EPOCH_EXIT(et); > > - CURVNET_RESTORE(); > + return (true); > } > > /* > From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 23:15:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB0F1532A56; Thu, 4 Feb 2021 23:15: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 4DWvYS4rktz3LQ7; Thu, 4 Feb 2021 23:15:56 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 99C3414471; Thu, 4 Feb 2021 23:15:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114NFuoB061507; Thu, 4 Feb 2021 23:15:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114NFunx061506; Thu, 4 Feb 2021 23:15:56 GMT (envelope-from git) Date: Thu, 4 Feb 2021 23:15:56 GMT Message-Id: <202102042315.114NFunx061506@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jamie Gritton Subject: git: 3f3b216c0b4b - stable/13 - MFC jail: A jail could be removed without calling OSD methods MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jamie X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3f3b216c0b4b90e02b5637f5b07cc9446e1bcee7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 23:15:56 -0000 The branch stable/13 has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=3f3b216c0b4b90e02b5637f5b07cc9446e1bcee7 commit 3f3b216c0b4b90e02b5637f5b07cc9446e1bcee7 Author: Jamie Gritton AuthorDate: 2021-01-22 18:50:10 +0000 Commit: Jamie Gritton CommitDate: 2021-02-04 23:13:36 +0000 MFC jail: A jail could be removed without calling OSD methods Fix a long-standing bug where setting nopersist on a process-less jail would remove it without calling the the OSD PR_METHOD_REMOVE methods. (cherry picked from commit 39c8ef90f6d035cd3c3ab40e051b1c0f419c76be) --- sys/kern/kern_jail.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index e869bafc96b8..318f81fb13be 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -1741,8 +1741,8 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) prison_hold(pr); refcount_acquire(&pr->pr_uref); } else { - refcount_release(&pr->pr_uref); refcount_release(&pr->pr_ref); + drflags |= PD_DEUREF; } } pr->pr_flags = (pr->pr_flags & ~ch_flags) | pr_flags; From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 23:15:58 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7CCBB532AA9; Thu, 4 Feb 2021 23:15: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 4DWvYT5pkQz3Lhf; Thu, 4 Feb 2021 23:15:57 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 BA17014807; Thu, 4 Feb 2021 23:15:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114NFvXX061530; Thu, 4 Feb 2021 23:15:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114NFvKS061529; Thu, 4 Feb 2021 23:15:57 GMT (envelope-from git) Date: Thu, 4 Feb 2021 23:15:57 GMT Message-Id: <202102042315.114NFvKS061529@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jamie Gritton Subject: git: 7726fc9940d6 - stable/13 - MFC jail: fix dangling reference bug from 6754ae2572eb MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jamie X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7726fc9940d688af35753a374391de48bad1e1ca Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 23:15:58 -0000 The branch stable/13 has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=7726fc9940d688af35753a374391de48bad1e1ca commit 7726fc9940d688af35753a374391de48bad1e1ca Author: Jamie Gritton AuthorDate: 2021-01-22 18:56:24 +0000 Commit: Jamie Gritton CommitDate: 2021-02-04 23:13:47 +0000 MFC jail: fix dangling reference bug from 6754ae2572eb The change to use refcounts for pr_uref was mishandled in prison_proc_free, so killing a jail's last process could add an extra reference, leaving it an unkillable zombie. (cherry picked from commit 195cd6ae2481dd5ad555ed65c226b6f20908d66a) --- sys/kern/kern_jail.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 318f81fb13be..064f1afa4133 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -2705,7 +2705,6 @@ prison_proc_hold(struct prison *pr) void prison_proc_free(struct prison *pr) { - int lasturef; /* * Locking is only required when releasing the last reference. @@ -2714,11 +2713,7 @@ prison_proc_free(struct prison *pr) */ KASSERT(refcount_load(&pr->pr_uref) > 0, ("Trying to kill a process in a dead prison (jid=%d)", pr->pr_id)); - if (refcount_release_if_not_last(&pr->pr_uref)) - return; - mtx_lock(&pr->pr_mtx); - lasturef = refcount_release(&pr->pr_uref); - if (lasturef) { + if (!refcount_release_if_not_last(&pr->pr_uref)) { /* * Don't remove the last user reference in this context, * which is expected to be a process that is not only locked, @@ -2726,11 +2721,8 @@ prison_proc_free(struct prison *pr) * prison_free() won't re-submit the task. */ refcount_acquire(&pr->pr_ref); - mtx_unlock(&pr->pr_mtx); taskqueue_enqueue(taskqueue_thread, &pr->pr_task); - return; } - mtx_unlock(&pr->pr_mtx); } /* From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 23:15:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C9B60532C99; Thu, 4 Feb 2021 23:15: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 4DWvYV6sRzz3Lf7; Thu, 4 Feb 2021 23:15:58 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 DD03D14555; Thu, 4 Feb 2021 23:15:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 114NFwPr061550; Thu, 4 Feb 2021 23:15:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 114NFwvS061549; Thu, 4 Feb 2021 23:15:58 GMT (envelope-from git) Date: Thu, 4 Feb 2021 23:15:58 GMT Message-Id: <202102042315.114NFwvS061549@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jamie Gritton Subject: git: 4c44dbde5491 - stable/13 - MFC jail: Handle a parent jail when a child is added to it MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jamie X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4c44dbde5491516eba8725dc51d39c1dcc817472 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 23:15:59 -0000 The branch stable/13 has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=4c44dbde5491516eba8725dc51d39c1dcc817472 commit 4c44dbde5491516eba8725dc51d39c1dcc817472 Author: Jamie Gritton AuthorDate: 2021-01-29 05:51:09 +0000 Commit: Jamie Gritton CommitDate: 2021-02-04 23:13:54 +0000 MFC jail: Handle a parent jail when a child is added to it It's possible when adding a jail that its dying parent comes back to life. Only allow that to happen when JAIL_DYING is specified. And if it does happen, call PR_METHOD_CREATE on it. (cherry picked from commit c050ea803eaa1087313b86628b5d486c0e59e41b) --- sys/kern/kern_jail.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 064f1afa4133..ece0aa33e642 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -1105,6 +1105,14 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) "jail \"%s\" not found", name); goto done_deref; } + if (!(flags & JAIL_DYING) && + !prison_isalive(ppr)) { + mtx_unlock(&ppr->pr_mtx); + error = ENOENT; + vfs_opterror(opts, + "jail \"%s\" is dying", name); + goto done_deref; + } mtx_unlock(&ppr->pr_mtx); *namelc = '.'; } @@ -1200,8 +1208,18 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) goto done_deref; } prison_hold(ppr); - refcount_acquire(&ppr->pr_uref); - mtx_unlock(&ppr->pr_mtx); + if (refcount_acquire(&ppr->pr_uref)) + mtx_unlock(&ppr->pr_mtx); + else { + /* This brings the parent back to life. */ + mtx_unlock(&ppr->pr_mtx); + error = osd_jail_call(ppr, PR_METHOD_CREATE, opts); + if (error) { + pr = ppr; + drflags |= PD_DEREF | PD_DEUREF; + goto done_deref; + } + } if (jid == 0 && (jid = get_next_prid(&inspr)) == 0) { error = EAGAIN; From owner-dev-commits-src-branches@freebsd.org Thu Feb 4 23:56:30 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9F755534001 for ; Thu, 4 Feb 2021 23:56:30 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWwSG3z2dz3PPw for ; Thu, 4 Feb 2021 23:56:30 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82c.google.com with SMTP id z22so3807269qto.7 for ; Thu, 04 Feb 2021 15:56:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Jx30byh333ior8Gj6CbNspcK76/Tlh5/RkJlrIk3B28=; b=iWEbtIkOvloJJja1Wft/gFqYR+Btv4mn31WRBW3PfYPruaoHvSbGxn8a3gRuKIP5p9 pUHmcvHP/MLvkG+x9WN3pFhfvLcJ7pg+s2VfNjKdIq6j9RdpGgZw6UcxAOf18XzwXXaW nV1FoRuilgPfn9aXOVkFRZWg5jTxrZZb3dTYrykVvu/Aun1iWc06I73yz93ezckturXl kFj23mFO+p0jo8bjMQ2ABb+7d1DejUOHzEzTx5M14uXGUp9mN775ytOCjk4gi1wI/vOb 4PH6sSzevW176LIpfF5UNjM9ZNo8LjlKC0U9rsqrHujb1ESI585nOHDEqAQl9vkwsd66 GlCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Jx30byh333ior8Gj6CbNspcK76/Tlh5/RkJlrIk3B28=; b=HSCz5smcLV82YvdIXMG58LduhaeVNErincq503t5qzMiJ7bgetYGiDziL2VVzy7/R0 cgRnUFpVcQzmsnJuCUyEyTJhSATsIdolR+T1M2BP681TaAMoCgSY518SvVfRGq815hdz BQJkuyMrbM5ho3WGXL9HeZMuOJJocaCQ4zndQk1tZr/X//AFHk931B6YGXRjJ82xEeoH 8QhOtfM5cHtpAj67BGyujJU7H/lJFg4gHVHAFd0WAYIXAdps0NHTTo1EPXQrI9b2d4fl QGiW0Rkw+QsD1O/JoYPwR/W7Nvh3J2Fej5+JqZwgyvqwOldZiJWipnXO4kmBzu9kAB5t G5YA== X-Gm-Message-State: AOAM530bSDyvtmqtY+Oq1O5+Gr5ziiobc6ICQomd/UIdvVoXQpA3nRrP tbshJzC53JfrknkYVum0mb7Wo1f9zHenxVFntIFrKA== X-Google-Smtp-Source: ABdhPJzf3cfojyc7Q8kgzzjo4JEtl7wTM4WfwLOLg6VrMFfQa+ddyr5kpXvIBT+a0lwDChGtsOkWeO+GNopbCPz1NZo= X-Received: by 2002:a05:622a:1c9:: with SMTP id t9mr2072560qtw.244.1612482989370; Thu, 04 Feb 2021 15:56:29 -0800 (PST) MIME-Version: 1.0 References: <202102042134.114LYKEp029525@gitrepo.freebsd.org> In-Reply-To: <202102042134.114LYKEp029525@gitrepo.freebsd.org> From: Warner Losh Date: Thu, 4 Feb 2021 16:56:17 -0700 Message-ID: Subject: Re: git: 0c839497c174 - stable/13 - loader.efi: There are systems without ConOut, also use ConOutDev To: Toomas Soome Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org X-Rspamd-Queue-Id: 4DWwSG3z2dz3PPw X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2021 23:56:30 -0000 And why the instaMFC? Changes are supposed to cook force days before merging... I have questions about the wisdom of this change... Warner On Thu, Feb 4, 2021, 2:34 PM Toomas Soome wrote: > The branch stable/13 has been updated by tsoome: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=0c839497c174e961fc71f7d3329d05b10ec5525b > > commit 0c839497c174e961fc71f7d3329d05b10ec5525b > Author: Toomas Soome > AuthorDate: 2021-02-04 20:49:02 +0000 > Commit: Toomas Soome > CommitDate: 2021-02-04 21:33:15 +0000 > > loader.efi: There are systems without ConOut, also use ConOutDev > > Conout does contian the default output device name. > ConOutDev does contain all possible output device names, so we can > use it as fallback, when there is no ConOut. > > PR: 253253 > > (cherry picked from commit 2bd4ff2d8911009283e4e615ca4aad35a845f48b) > --- > stand/efi/loader/main.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c > index ca41cd4a2610..32b278950745 100644 > --- a/stand/efi/loader/main.c > +++ b/stand/efi/loader/main.c > @@ -735,6 +735,8 @@ parse_uefi_con_out(void) > how = 0; > sz = sizeof(buf); > rv = efi_global_getenv("ConOut", buf, &sz); > + if (rv != EFI_SUCCESS) > + rv = efi_global_getenv("ConOutDev", buf, &sz); > if (rv != EFI_SUCCESS) { > /* If we don't have any ConOut default to serial */ > how = RB_SERIAL; > From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 00:02:28 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D30653435F; Fri, 5 Feb 2021 00:02:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWwb82hFYz3QPC; Fri, 5 Feb 2021 00:02:28 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4EE4B15060; Fri, 5 Feb 2021 00:02:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11502SU3026367; Fri, 5 Feb 2021 00:02:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11502Sro026366; Fri, 5 Feb 2021 00:02:28 GMT (envelope-from git) Date: Fri, 5 Feb 2021 00:02:28 GMT Message-Id: <202102050002.11502Sro026366@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: 3d544e6b0bc4 - stable/13 - Rename stable/13 to -STABLE now that releng/13.0 has branched MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3d544e6b0bc4000c0a485d84c95ed2b699916f3a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 00:02:28 -0000 The branch stable/13 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=3d544e6b0bc4000c0a485d84c95ed2b699916f3a commit 3d544e6b0bc4000c0a485d84c95ed2b699916f3a Author: Glen Barber AuthorDate: 2021-02-05 00:02:14 +0000 Commit: Glen Barber CommitDate: 2021-02-05 00:02:14 +0000 Rename stable/13 to -STABLE now that releng/13.0 has branched Bump __FreeBSD_version Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/conf/newvers.sh | 2 +- sys/sys/param.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 12d4daa771be..0b5b76847320 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -54,7 +54,7 @@ TYPE="FreeBSD" REVISION="13.0" -BRANCH="ALPHA3" +BRANCH="STABLE" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi diff --git a/sys/sys/param.h b/sys/sys/param.h index a19091e17167..497832e1ba15 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300139 /* Master, propagated to newvers */ +#define __FreeBSD_version 1305000 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 00:04:31 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7D49753454F; Fri, 5 Feb 2021 00:04: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 4DWwdW37dzz3QRs; Fri, 5 Feb 2021 00:04:31 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5DE3215286; Fri, 5 Feb 2021 00:04:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11504V2V026816; Fri, 5 Feb 2021 00:04:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11504VeU026815; Fri, 5 Feb 2021 00:04:31 GMT (envelope-from git) Date: Fri, 5 Feb 2021 00:04:31 GMT Message-Id: <202102050004.11504VeU026815@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: fa3b2ad265d3 - stable/13 - Fix ldd to work with more ELF files. 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/13 X-Git-Reftype: branch X-Git-Commit: fa3b2ad265d311191c1c8337bf3aa356f28480cb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 00:04:31 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=fa3b2ad265d311191c1c8337bf3aa356f28480cb commit fa3b2ad265d311191c1c8337bf3aa356f28480cb Author: John Baldwin AuthorDate: 2021-01-29 18:53:50 +0000 Commit: John Baldwin CommitDate: 2021-02-05 00:03:20 +0000 Fix ldd to work with more ELF files. - Use libelf to parse ELF data structures and remove code duplication for ELF32. - Don't require the OSABI field to be set to the FreeBSD OSABI for shared libraries. Both AArch64 and RISC-V leave it set to "none" and instead depend on the ABI tag note. For ldd, this means falling back to walking the notes in PT_NOTE segments to find the ABI tag note to determine if an ELF shared library without OSABI set in the header file is a FreeBSD shared library. (cherry picked from commit 9d4104b214963bb3371ada05cae8006940121634) --- usr.bin/ldd/Makefile | 2 + usr.bin/ldd/ldd.c | 335 ++++++++++++++++++++++++++++----------------------- 2 files changed, 187 insertions(+), 150 deletions(-) diff --git a/usr.bin/ldd/Makefile b/usr.bin/ldd/Makefile index 5d2beb7bb6c0..78e551d80a33 100644 --- a/usr.bin/ldd/Makefile +++ b/usr.bin/ldd/Makefile @@ -3,4 +3,6 @@ PROG?= ldd SRCS= ldd.c +LIBADD= elf + .include diff --git a/usr.bin/ldd/ldd.c b/usr.bin/ldd/ldd.c index 08c91d829bd7..f948b7312863 100644 --- a/usr.bin/ldd/ldd.c +++ b/usr.bin/ldd/ldd.c @@ -33,6 +33,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include @@ -43,6 +44,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include +#include #include #include #include @@ -259,179 +263,210 @@ usage(void) exit(1); } -static int -is_executable(const char *fname, int fd, int *is_shlib, int *type) +static bool +has_freebsd_abi_tag(const char *fname, Elf *elf, GElf_Ehdr *ehdr, off_t offset, + size_t len) { - union { -#if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED) - Elf32_Ehdr elf32; -#endif - Elf_Ehdr elf; - } hdr; - Elf_Phdr phdr, dynphdr; - Elf_Dyn *dynp; - void *dyndata; -#if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED) - Elf32_Phdr phdr32, dynphdr32; - Elf32_Dyn *dynp32; -#endif - int df1pie, dynamic, i, n; - - *is_shlib = 0; - *type = TYPE_UNKNOWN; - df1pie = 0; + Elf_Data dst, src; + const Elf_Note *note; + char *buf; + const char *name; + void *copy; + size_t namesz, descsz; + bool has_abi_tag; + + buf = elf_rawfile(elf, NULL); + if (buf == NULL) { + warnx("%s: %s", fname, elf_errmsg(0)); + return (false); + } - if ((n = read(fd, &hdr, sizeof(hdr))) == -1) { - warn("%s: can't read program header", fname); - return (0); + memset(&src, 0, sizeof(src)); + src.d_buf = buf + offset; + src.d_size = len; + src.d_type = ELF_T_NOTE; + src.d_version = EV_CURRENT; + + memset(&dst, 0, sizeof(dst)); + dst.d_buf = copy = malloc(len); + dst.d_size = len; + dst.d_type = ELF_T_NOTE; + dst.d_version = EV_CURRENT; + + if (gelf_xlatetom(elf, &dst, &src, ehdr->e_ident[EI_DATA]) == NULL) { + warnx("%s: failed to parse notes: %s", fname, elf_errmsg(0)); + free(copy); + return (false); } -#if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED) - if ((size_t)n >= sizeof(hdr.elf32) && IS_ELF(hdr.elf32) && - hdr.elf32.e_ident[EI_CLASS] == ELFCLASS32) { - /* Handle 32 bit ELF objects */ + buf = copy; + has_abi_tag = false; + for (;;) { + if (len < sizeof(*note)) + break; - dynamic = 0; - *type = TYPE_ELF32; + note = (const void *)buf; + buf += sizeof(*note); + len -= sizeof(*note); - if (lseek(fd, hdr.elf32.e_phoff, SEEK_SET) == -1) { - warnx("%s: header too short", fname); - return (0); - } - for (i = 0; i < hdr.elf32.e_phnum; i++) { - if (read(fd, &phdr32, hdr.elf32.e_phentsize) != - sizeof(phdr32)) { - warnx("%s: can't read program header", fname); - return (0); - } - if (phdr32.p_type == PT_DYNAMIC) { - dynamic = 1; - dynphdr32 = phdr32; - break; - } - } + namesz = roundup2(note->n_namesz, sizeof(uint32_t)); + descsz = roundup2(note->n_descsz, sizeof(uint32_t)); + if (len < namesz + descsz) + break; - if (!dynamic) { - warnx("%s: not a dynamic ELF executable", fname); - return (0); + name = buf; + if (note->n_namesz == sizeof(ELF_NOTE_FREEBSD) && + strncmp(name, ELF_NOTE_FREEBSD, note->n_namesz) == 0 && + note->n_type == NT_FREEBSD_ABI_TAG && + note->n_descsz == sizeof(uint32_t)) { + has_abi_tag = true; + break; } - if (hdr.elf32.e_type == ET_DYN) { - if (lseek(fd, dynphdr32.p_offset, SEEK_SET) == -1) { - warnx("%s: dynamic segment out of range", - fname); - return (0); - } - dyndata = malloc(dynphdr32.p_filesz); - if (dyndata == NULL) { - warn("malloc"); - return (0); - } - if (read(fd, dyndata, dynphdr32.p_filesz) != - (ssize_t)dynphdr32.p_filesz) { - free(dyndata); - warnx("%s: can't read dynamic segment", fname); - return (0); - } - for (dynp32 = dyndata; dynp32->d_tag != DT_NULL; - dynp32++) { - if (dynp32->d_tag != DT_FLAGS_1) - continue; - df1pie = (dynp32->d_un.d_val & DF_1_PIE) != 0; - break; - } - free(dyndata); + buf += namesz + descsz; + len -= namesz + descsz; + } - if (hdr.elf32.e_ident[EI_OSABI] == ELFOSABI_FREEBSD) { - if (!df1pie) - *is_shlib = 1; - return (1); - } - warnx("%s: not a FreeBSD ELF shared object", fname); - return (0); - } + free(copy); + return (has_abi_tag); +} - return (1); +static bool +is_pie(const char *fname, Elf *elf, GElf_Ehdr *ehdr, off_t offset, size_t len) +{ + Elf_Data dst, src; + char *buf; + void *copy; + const GElf_Dyn *dyn; + size_t dynsize; + u_int count, i; + bool pie; + + buf = elf_rawfile(elf, NULL); + if (buf == NULL) { + warnx("%s: %s", fname, elf_errmsg(0)); + return (false); } -#endif - if ((size_t)n >= sizeof(hdr.elf) && IS_ELF(hdr.elf) && - hdr.elf.e_ident[EI_CLASS] == ELF_TARG_CLASS) { - /* Handle default ELF objects on this architecture */ + dynsize = gelf_fsize(elf, ELF_T_DYN, 1, EV_CURRENT); + if (dynsize == 0) { + warnx("%s: %s", fname, elf_errmsg(0)); + return (false); + } + count = len / dynsize; + + memset(&src, 0, sizeof(src)); + src.d_buf = buf + offset; + src.d_size = len; + src.d_type = ELF_T_DYN; + src.d_version = EV_CURRENT; + + memset(&dst, 0, sizeof(dst)); + dst.d_buf = copy = malloc(count * sizeof(*dyn)); + dst.d_size = count * sizeof(*dyn); + dst.d_type = ELF_T_DYN; + dst.d_version = EV_CURRENT; + + if (gelf_xlatetom(elf, &dst, &src, ehdr->e_ident[EI_DATA]) == NULL) { + warnx("%s: failed to parse .dynamic: %s", fname, elf_errmsg(0)); + free(copy); + return (false); + } + + dyn = copy; + pie = false; + for (i = 0; i < count; i++) { + if (dyn[i].d_tag != DT_FLAGS_1) + continue; + + pie = (dyn[i].d_un.d_val & DF_1_PIE) != 0; + break; + } + + free(copy); + return (pie); +} + +static int +is_executable(const char *fname, int fd, int *is_shlib, int *type) +{ + Elf *elf; + GElf_Ehdr ehdr; + GElf_Phdr phdr; + bool dynamic, freebsd, pie; + int i; + + *is_shlib = 0; + *type = TYPE_UNKNOWN; + dynamic = false; + freebsd = false; + pie = false; + + if (elf_version(EV_CURRENT) == EV_NONE) { + warnx("unsupported libelf"); + return (0); + } + elf = elf_begin(fd, ELF_C_READ, NULL); + if (elf == NULL) { + warnx("%s: %s", fname, elf_errmsg(0)); + return (0); + } + if (elf_kind(elf) != ELF_K_ELF) { + elf_end(elf); + warnx("%s: not a dynamic ELF executable", fname); + return (0); + } + if (gelf_getehdr(elf, &ehdr) == NULL) { + warnx("%s: %s", fname, elf_errmsg(0)); + elf_end(elf); + return (0); + } - dynamic = 0; - *type = TYPE_ELF; + *type = TYPE_ELF; +#if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED) + if (gelf_getclass(elf) == ELFCLASS32) { + *type = TYPE_ELF32; + } +#endif - if (lseek(fd, hdr.elf.e_phoff, SEEK_SET) == -1) { - warnx("%s: header too short", fname); + freebsd = ehdr.e_ident[EI_OSABI] == ELFOSABI_FREEBSD; + for (i = 0; i < ehdr.e_phnum; i++) { + if (gelf_getphdr(elf, i, &phdr) == NULL) { + warnx("%s: %s", fname, elf_errmsg(0)); + elf_end(elf); return (0); } - for (i = 0; i < hdr.elf.e_phnum; i++) { - if (read(fd, &phdr, hdr.elf.e_phentsize) - != sizeof(phdr)) { - warnx("%s: can't read program header", fname); - return (0); - } - if (phdr.p_type == PT_DYNAMIC) { - dynamic = 1; - dynphdr = phdr; - break; - } + switch (phdr.p_type) { + case PT_NOTE: + if (ehdr.e_ident[EI_OSABI] == ELFOSABI_NONE && !freebsd) + freebsd = has_freebsd_abi_tag(fname, elf, &ehdr, + phdr.p_offset, phdr.p_filesz); + break; + case PT_DYNAMIC: + dynamic = true; + if (ehdr.e_type == ET_DYN) + pie = is_pie(fname, elf, &ehdr, phdr.p_offset, + phdr.p_filesz); + break; } + } - if (!dynamic) { - warnx("%s: not a dynamic ELF executable", fname); - return (0); - } + if (!dynamic) { + elf_end(elf); + warnx("%s: not a dynamic ELF executable", fname); + return (0); + } - if (hdr.elf.e_type == ET_DYN) { - if (lseek(fd, dynphdr.p_offset, SEEK_SET) == -1) { - warnx("%s: dynamic segment out of range", - fname); - return (0); - } - dyndata = malloc(dynphdr.p_filesz); - if (dyndata == NULL) { - warn("malloc"); - return (0); - } - if (read(fd, dyndata, dynphdr.p_filesz) != - (ssize_t)dynphdr.p_filesz) { - free(dyndata); - warnx("%s: can't read dynamic segment", fname); - return (0); - } - for (dynp = dyndata; dynp->d_tag != DT_NULL; dynp++) { - if (dynp->d_tag != DT_FLAGS_1) - continue; - df1pie = (dynp->d_un.d_val & DF_1_PIE) != 0; - break; - } - free(dyndata); - - switch (hdr.elf.e_ident[EI_OSABI]) { - case ELFOSABI_FREEBSD: - if (!df1pie) - *is_shlib = 1; - return (1); -#ifdef __ARM_EABI__ - case ELFOSABI_NONE: - if (hdr.elf.e_machine != EM_ARM) - break; - if (EF_ARM_EABI_VERSION(hdr.elf.e_flags) < - EF_ARM_EABI_FREEBSD_MIN) - break; - *is_shlib = 1; - return (1); -#endif - } + if (ehdr.e_type == ET_DYN && !pie) { + *is_shlib = 1; + + if (!freebsd) { + elf_end(elf); warnx("%s: not a FreeBSD ELF shared object", fname); return (0); } - - return (1); } - warnx("%s: not a dynamic executable", fname); - return (0); + elf_end(elf); + return (1); } From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 00:04:32 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A5BC253470E; Fri, 5 Feb 2021 00:04: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 4DWwdX4GsMz3Q26; Fri, 5 Feb 2021 00:04:32 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 859FE15287; Fri, 5 Feb 2021 00:04:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11504WfQ026834; Fri, 5 Feb 2021 00:04:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11504WtX026833; Fri, 5 Feb 2021 00:04:32 GMT (envelope-from git) Date: Fri, 5 Feb 2021 00:04:32 GMT Message-Id: <202102050004.11504WtX026833@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: c1c52cd57e88 - stable/13 - OpenSSL: Support for kernel TLS offload (KTLS) 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/13 X-Git-Reftype: branch X-Git-Commit: c1c52cd57e8810ca294d02220dfa72607c9a5567 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 00:04:32 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c1c52cd57e8810ca294d02220dfa72607c9a5567 commit c1c52cd57e8810ca294d02220dfa72607c9a5567 Author: John Baldwin AuthorDate: 2021-01-16 00:17:31 +0000 Commit: John Baldwin CommitDate: 2021-02-05 00:03:20 +0000 OpenSSL: Support for kernel TLS offload (KTLS) This merges upstream patches from OpenSSL's master branch to add KTLS infrastructure for TLS 1.0-1.3 including both RX and TX offload and SSL_sendfile support on both Linux and FreeBSD. Note that TLS 1.3 only supports TX offload. A new WITH/WITHOUT_OPENSSL_KTLS determines if OpenSSL is built with KTLS support. It defaults to enabled on amd64 and disabled on all other architectures. Sponsored by: Netflix (cherry picked from commit aa906e2a4957db700d9e6cc60857e1afe1aecc85) --- crypto/openssl/CHANGES | 5 + crypto/openssl/Configure | 29 ++ crypto/openssl/INSTALL | 9 + crypto/openssl/apps/s_client.c | 6 + crypto/openssl/apps/s_server.c | 6 + crypto/openssl/crypto/bio/b_sock2.c | 12 + crypto/openssl/crypto/bio/bss_conn.c | 46 ++- crypto/openssl/crypto/bio/bss_sock.c | 57 ++- crypto/openssl/crypto/err/openssl.txt | 1 + crypto/openssl/crypto/evp/e_aes.c | 8 + crypto/openssl/doc/man3/BIO_ctrl.pod | 21 +- crypto/openssl/doc/man3/SSL_CTX_set_mode.pod | 17 + .../man3/SSL_CTX_set_record_padding_callback.pod | 10 +- crypto/openssl/doc/man3/SSL_write.pod | 31 +- crypto/openssl/engines/e_afalg.c | 3 +- crypto/openssl/include/internal/bio.h | 39 ++ crypto/openssl/include/internal/ktls.h | 403 +++++++++++++++++++++ crypto/openssl/include/openssl/bio.h | 20 + crypto/openssl/include/openssl/err.h | 1 + crypto/openssl/include/openssl/evp.h | 2 + crypto/openssl/include/openssl/ssl.h | 12 +- crypto/openssl/include/openssl/sslerr.h | 1 + crypto/openssl/ssl/build.info | 5 + crypto/openssl/ssl/ktls.c | 221 +++++++++++ crypto/openssl/ssl/record/rec_layer_s3.c | 137 +++++-- crypto/openssl/ssl/record/record.h | 2 + crypto/openssl/ssl/record/record_local.h | 3 + crypto/openssl/ssl/record/ssl3_buffer.c | 33 +- crypto/openssl/ssl/record/ssl3_record.c | 47 ++- crypto/openssl/ssl/ssl_err.c | 1 + crypto/openssl/ssl/ssl_lib.c | 104 +++++- crypto/openssl/ssl/ssl_local.h | 13 + crypto/openssl/ssl/t1_enc.c | 128 +++++++ crypto/openssl/ssl/tls13_enc.c | 81 ++++- secure/lib/libcrypto/Makefile | 18 +- secure/lib/libcrypto/opensslconf.h.in | 3 + secure/lib/libssl/Makefile | 6 + secure/lib/libssl/Version.map | 6 + share/mk/src.opts.mk | 7 + tools/build/options/WITHOUT_OPENSSL_KTLS | 1 + tools/build/options/WITH_OPENSSL_KTLS | 1 + 41 files changed, 1465 insertions(+), 91 deletions(-) diff --git a/crypto/openssl/CHANGES b/crypto/openssl/CHANGES index 37dd60b726ee..4d61c1dadbaa 100644 --- a/crypto/openssl/CHANGES +++ b/crypto/openssl/CHANGES @@ -390,6 +390,11 @@ necessary to configure just to create a source distribution. [Richard Levitte] + *) Added support for Linux Kernel TLS data-path. The Linux Kernel data-path + improves application performance by removing data copies and providing + applications with zero-copy system calls such as sendfile and splice. + [Boris Pismenny] + Changes between 1.1.1 and 1.1.1a [20 Nov 2018] *) Timing vulnerability in DSA signature generation diff --git a/crypto/openssl/Configure b/crypto/openssl/Configure index 1d73d06e1b3b..1423e1bfe14f 100755 --- a/crypto/openssl/Configure +++ b/crypto/openssl/Configure @@ -387,6 +387,7 @@ my @disablables = ( "heartbeats", "hw(-.+)?", "idea", + "ktls", "makedepend", "md2", "md4", @@ -474,6 +475,7 @@ our %disabled = ( # "what" => "comment" "weak-ssl-ciphers" => "default", "zlib" => "default", "zlib-dynamic" => "default", + "ktls" => "default", ); # Note: => pair form used for aesthetics, not to truly make a hash table @@ -1580,6 +1582,33 @@ unless ($disabled{devcryptoeng}) { } } +unless ($disabled{ktls}) { + $config{ktls}=""; + if ($target =~ m/^linux/) { + my $usr = "/usr/$config{cross_compile_prefix}"; + chop($usr); + if ($config{cross_compile_prefix} eq "") { + $usr = "/usr"; + } + my $minver = (4 << 16) + (13 << 8) + 0; + my @verstr = split(" ",`cat $usr/include/linux/version.h | grep LINUX_VERSION_CODE`); + + if ($verstr[2] < $minver) { + disable('too-old-kernel', 'ktls'); + } + } elsif ($target =~ m/^BSD/) { + my $cc = $config{CROSS_COMPILE}.$config{CC}; + system("printf '#include \n#include ' | $cc -E - >/dev/null 2>&1"); + if ($? != 0) { + disable('too-old-freebsd', 'ktls'); + } + } else { + disable('not-linux-or-freebsd', 'ktls'); + } +} + +push @{$config{openssl_other_defines}}, "OPENSSL_NO_KTLS" if ($disabled{ktls}); + # Get the extra flags used when building shared libraries and modules. We # do this late because some of them depend on %disabled. diff --git a/crypto/openssl/INSTALL b/crypto/openssl/INSTALL index f5118428b3bc..be84f2aa8e5d 100644 --- a/crypto/openssl/INSTALL +++ b/crypto/openssl/INSTALL @@ -262,6 +262,15 @@ Don't build the AFALG engine. This option will be forced if on a platform that does not support AFALG. + enable-ktls + Build with Kernel TLS support. This option will enable the + use of the Kernel TLS data-path, which can improve + performance and allow for the use of sendfile and splice + system calls on TLS sockets. The Kernel may use TLS + accelerators if any are available on the system. + This option will be forced off on systems that do not support + the Kernel TLS data-path. + enable-asan Build with the Address sanitiser. This is a developer option only. It may not work on all platforms and should never be diff --git a/crypto/openssl/apps/s_client.c b/crypto/openssl/apps/s_client.c index 83b3fc9c7f13..68bd9ced015f 100644 --- a/crypto/openssl/apps/s_client.c +++ b/crypto/openssl/apps/s_client.c @@ -3282,6 +3282,12 @@ static void print_stuff(BIO *bio, SSL *s, int full) BIO_printf(bio, "Expansion: %s\n", expansion ? SSL_COMP_get_name(expansion) : "NONE"); #endif +#ifndef OPENSSL_NO_KTLS + if (BIO_get_ktls_send(SSL_get_wbio(s))) + BIO_printf(bio_err, "Using Kernel TLS for sending\n"); + if (BIO_get_ktls_recv(SSL_get_rbio(s))) + BIO_printf(bio_err, "Using Kernel TLS for receiving\n"); +#endif #ifdef SSL_DEBUG { diff --git a/crypto/openssl/apps/s_server.c b/crypto/openssl/apps/s_server.c index 0ba75999fd28..ddc0b4bcd76d 100644 --- a/crypto/openssl/apps/s_server.c +++ b/crypto/openssl/apps/s_server.c @@ -2923,6 +2923,12 @@ static void print_connection_info(SSL *con) } OPENSSL_free(exportedkeymat); } +#ifndef OPENSSL_NO_KTLS + if (BIO_get_ktls_send(SSL_get_wbio(con))) + BIO_printf(bio_err, "Using Kernel TLS for sending\n"); + if (BIO_get_ktls_recv(SSL_get_rbio(con))) + BIO_printf(bio_err, "Using Kernel TLS for receiving\n"); +#endif (void)BIO_flush(bio_s_out); } diff --git a/crypto/openssl/crypto/bio/b_sock2.c b/crypto/openssl/crypto/bio/b_sock2.c index 335dfabc6180..80ef348d9254 100644 --- a/crypto/openssl/crypto/bio/b_sock2.c +++ b/crypto/openssl/crypto/bio/b_sock2.c @@ -12,6 +12,7 @@ #include #include "bio_local.h" +#include "internal/ktls.h" #include @@ -50,6 +51,17 @@ int BIO_socket(int domain, int socktype, int protocol, int options) BIOerr(BIO_F_BIO_SOCKET, BIO_R_UNABLE_TO_CREATE_SOCKET); return INVALID_SOCKET; } +# ifndef OPENSSL_NO_KTLS + { + /* + * The new socket is created successfully regardless of ktls_enable. + * ktls_enable doesn't change any functionality of the socket, except + * changing the setsockopt to enable the processing of ktls_start. + * Thus, it is not a problem to call it for non-TLS sockets. + */ + ktls_enable(sock); + } +# endif return sock; } diff --git a/crypto/openssl/crypto/bio/bss_conn.c b/crypto/openssl/crypto/bio/bss_conn.c index 807a82b23ba2..d4786442803e 100644 --- a/crypto/openssl/crypto/bio/bss_conn.c +++ b/crypto/openssl/crypto/bio/bss_conn.c @@ -11,6 +11,7 @@ #include #include "bio_local.h" +#include "internal/ktls.h" #ifndef OPENSSL_NO_SOCK @@ -20,6 +21,9 @@ typedef struct bio_connect_st { char *param_hostname; char *param_service; int connect_mode; +# ifndef OPENSSL_NO_KTLS + unsigned char record_type; +# endif BIO_ADDRINFO *addr_first; const BIO_ADDRINFO *addr_iter; @@ -320,7 +324,12 @@ static int conn_read(BIO *b, char *out, int outl) if (out != NULL) { clear_socket_error(); - ret = readsocket(b->num, out, outl); +# ifndef OPENSSL_NO_KTLS + if (BIO_get_ktls_recv(b)) + ret = ktls_read_record(b->num, out, outl); + else +# endif + ret = readsocket(b->num, out, outl); BIO_clear_retry_flags(b); if (ret <= 0) { if (BIO_sock_should_retry(ret)) @@ -345,7 +354,16 @@ static int conn_write(BIO *b, const char *in, int inl) } clear_socket_error(); - ret = writesocket(b->num, in, inl); +# ifndef OPENSSL_NO_KTLS + if (BIO_should_ktls_ctrl_msg_flag(b)) { + ret = ktls_send_ctrl_message(b->num, data->record_type, in, inl); + if (ret >= 0) { + ret = inl; + BIO_clear_ktls_ctrl_msg_flag(b); + } + } else +# endif + ret = writesocket(b->num, in, inl); BIO_clear_retry_flags(b); if (ret <= 0) { if (BIO_sock_should_retry(ret)) @@ -361,6 +379,9 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) const char **pptr = NULL; long ret = 1; BIO_CONNECT *data; +# ifndef OPENSSL_NO_KTLS + ktls_crypto_info_t *crypto_info; +# endif data = (BIO_CONNECT *)b->ptr; @@ -520,6 +541,27 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) case BIO_CTRL_EOF: ret = (b->flags & BIO_FLAGS_IN_EOF) != 0 ? 1 : 0; break; +# ifndef OPENSSL_NO_KTLS + case BIO_CTRL_SET_KTLS: + crypto_info = (ktls_crypto_info_t *)ptr; + ret = ktls_start(b->num, crypto_info, num); + if (ret) + BIO_set_ktls_flag(b, num); + break; + case BIO_CTRL_GET_KTLS_SEND: + return BIO_should_ktls_flag(b, 1); + case BIO_CTRL_GET_KTLS_RECV: + return BIO_should_ktls_flag(b, 0); + case BIO_CTRL_SET_KTLS_TX_SEND_CTRL_MSG: + BIO_set_ktls_ctrl_msg_flag(b); + data->record_type = num; + ret = 0; + break; + case BIO_CTRL_CLEAR_KTLS_TX_CTRL_MSG: + BIO_clear_ktls_ctrl_msg_flag(b); + ret = 0; + break; +# endif default: ret = 0; break; diff --git a/crypto/openssl/crypto/bio/bss_sock.c b/crypto/openssl/crypto/bio/bss_sock.c index 6251f3d46a17..a1fc23c7c938 100644 --- a/crypto/openssl/crypto/bio/bss_sock.c +++ b/crypto/openssl/crypto/bio/bss_sock.c @@ -11,6 +11,7 @@ #include #include "bio_local.h" #include "internal/cryptlib.h" +#include "internal/ktls.h" #ifndef OPENSSL_NO_SOCK @@ -64,6 +65,17 @@ BIO *BIO_new_socket(int fd, int close_flag) if (ret == NULL) return NULL; BIO_set_fd(ret, fd, close_flag); +# ifndef OPENSSL_NO_KTLS + { + /* + * The new socket is created successfully regardless of ktls_enable. + * ktls_enable doesn't change any functionality of the socket, except + * changing the setsockopt to enable the processing of ktls_start. + * Thus, it is not a problem to call it for non-TLS sockets. + */ + ktls_enable(fd); + } +# endif return ret; } @@ -96,7 +108,12 @@ static int sock_read(BIO *b, char *out, int outl) if (out != NULL) { clear_socket_error(); - ret = readsocket(b->num, out, outl); +# ifndef OPENSSL_NO_KTLS + if (BIO_get_ktls_recv(b)) + ret = ktls_read_record(b->num, out, outl); + else +# endif + ret = readsocket(b->num, out, outl); BIO_clear_retry_flags(b); if (ret <= 0) { if (BIO_sock_should_retry(ret)) @@ -110,10 +127,20 @@ static int sock_read(BIO *b, char *out, int outl) static int sock_write(BIO *b, const char *in, int inl) { - int ret; + int ret = 0; clear_socket_error(); - ret = writesocket(b->num, in, inl); +# ifndef OPENSSL_NO_KTLS + if (BIO_should_ktls_ctrl_msg_flag(b)) { + unsigned char record_type = (intptr_t)b->ptr; + ret = ktls_send_ctrl_message(b->num, record_type, in, inl); + if (ret >= 0) { + ret = inl; + BIO_clear_ktls_ctrl_msg_flag(b); + } + } else +# endif + ret = writesocket(b->num, in, inl); BIO_clear_retry_flags(b); if (ret <= 0) { if (BIO_sock_should_retry(ret)) @@ -126,6 +153,9 @@ static long sock_ctrl(BIO *b, int cmd, long num, void *ptr) { long ret = 1; int *ip; +# ifndef OPENSSL_NO_KTLS + ktls_crypto_info_t *crypto_info; +# endif switch (cmd) { case BIO_C_SET_FD: @@ -153,6 +183,27 @@ static long sock_ctrl(BIO *b, int cmd, long num, void *ptr) case BIO_CTRL_FLUSH: ret = 1; break; +# ifndef OPENSSL_NO_KTLS + case BIO_CTRL_SET_KTLS: + crypto_info = (ktls_crypto_info_t *)ptr; + ret = ktls_start(b->num, crypto_info, num); + if (ret) + BIO_set_ktls_flag(b, num); + break; + case BIO_CTRL_GET_KTLS_SEND: + return BIO_should_ktls_flag(b, 1); + case BIO_CTRL_GET_KTLS_RECV: + return BIO_should_ktls_flag(b, 0); + case BIO_CTRL_SET_KTLS_TX_SEND_CTRL_MSG: + BIO_set_ktls_ctrl_msg_flag(b); + b->ptr = (void *)num; + ret = 0; + break; + case BIO_CTRL_CLEAR_KTLS_TX_CTRL_MSG: + BIO_clear_ktls_ctrl_msg_flag(b); + ret = 0; + break; +# endif case BIO_CTRL_EOF: ret = (b->flags & BIO_FLAGS_IN_EOF) != 0 ? 1 : 0; break; diff --git a/crypto/openssl/crypto/err/openssl.txt b/crypto/openssl/crypto/err/openssl.txt index 815460b24f67..d547c45913d6 100644 --- a/crypto/openssl/crypto/err/openssl.txt +++ b/crypto/openssl/crypto/err/openssl.txt @@ -1318,6 +1318,7 @@ SSL_F_SSL_RENEGOTIATE:516:SSL_renegotiate SSL_F_SSL_RENEGOTIATE_ABBREVIATED:546:SSL_renegotiate_abbreviated SSL_F_SSL_SCAN_CLIENTHELLO_TLSEXT:320:* SSL_F_SSL_SCAN_SERVERHELLO_TLSEXT:321:* +SSL_F_SSL_SENDFILE:639:SSL_sendfile SSL_F_SSL_SESSION_DUP:348:ssl_session_dup SSL_F_SSL_SESSION_NEW:189:SSL_SESSION_new SSL_F_SSL_SESSION_PRINT_FP:190:SSL_SESSION_print_fp diff --git a/crypto/openssl/crypto/evp/e_aes.c b/crypto/openssl/crypto/evp/e_aes.c index 405ddbf9bf09..4640c7528a20 100644 --- a/crypto/openssl/crypto/evp/e_aes.c +++ b/crypto/openssl/crypto/evp/e_aes.c @@ -2895,6 +2895,14 @@ static int aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) memcpy(ptr, c->buf, arg); return 1; + case EVP_CTRL_GET_IV: + if (gctx->iv_gen != 1) + return 0; + if (gctx->ivlen != arg) + return 0; + memcpy(ptr, gctx->iv, arg); + return 1; + case EVP_CTRL_GCM_SET_IV_FIXED: /* Special case: -1 length restores whole IV */ if (arg == -1) { diff --git a/crypto/openssl/doc/man3/BIO_ctrl.pod b/crypto/openssl/doc/man3/BIO_ctrl.pod index 2e438c3ce952..31b18b2879fe 100644 --- a/crypto/openssl/doc/man3/BIO_ctrl.pod +++ b/crypto/openssl/doc/man3/BIO_ctrl.pod @@ -5,7 +5,8 @@ BIO_ctrl, BIO_callback_ctrl, BIO_ptr_ctrl, BIO_int_ctrl, BIO_reset, BIO_seek, BIO_tell, BIO_flush, BIO_eof, BIO_set_close, BIO_get_close, BIO_pending, BIO_wpending, BIO_ctrl_pending, BIO_ctrl_wpending, -BIO_get_info_callback, BIO_set_info_callback, BIO_info_cb +BIO_get_info_callback, BIO_set_info_callback, BIO_info_cb, BIO_get_ktls_send, +BIO_get_ktls_recv - BIO control operations =head1 SYNOPSIS @@ -34,6 +35,9 @@ BIO_get_info_callback, BIO_set_info_callback, BIO_info_cb int BIO_get_info_callback(BIO *b, BIO_info_cb **cbp); int BIO_set_info_callback(BIO *b, BIO_info_cb *cb); + int BIO_get_ktls_send(BIO *b); + int BIO_get_ktls_recv(BIO *b); + =head1 DESCRIPTION BIO_ctrl(), BIO_callback_ctrl(), BIO_ptr_ctrl() and BIO_int_ctrl() @@ -72,6 +76,11 @@ Not all BIOs support these calls. BIO_ctrl_pending() and BIO_ctrl_wpending() return a size_t type and are functions, BIO_pending() and BIO_wpending() are macros which call BIO_ctrl(). +BIO_get_ktls_send() returns 1 if the BIO is using the Kernel TLS data-path for +sending. Otherwise, it returns zero. +BIO_get_ktls_recv() returns 1 if the BIO is using the Kernel TLS data-path for +receiving. Otherwise, it returns zero. + =head1 RETURN VALUES BIO_reset() normally returns 1 for success and 0 or -1 for failure. File @@ -92,6 +101,11 @@ BIO_get_close() returns the close flag value: BIO_CLOSE or BIO_NOCLOSE. BIO_pending(), BIO_ctrl_pending(), BIO_wpending() and BIO_ctrl_wpending() return the amount of pending data. +BIO_get_ktls_send() returns 1 if the BIO is using the Kernel TLS data-path for +sending. Otherwise, it returns zero. +BIO_get_ktls_recv() returns 1 if the BIO is using the Kernel TLS data-path for +receiving. Otherwise, it returns zero. + =head1 NOTES BIO_flush(), because it can write data may return 0 or -1 indicating @@ -124,6 +138,11 @@ particular a return value of 0 can be returned if an operation is not supported, if an error occurred, if EOF has not been reached and in the case of BIO_seek() on a file BIO for a successful operation. +=head1 HISTORY + +The BIO_get_ktls_send() and BIO_get_ktls_recv() functions were added in +OpenSSL 3.0.0. + =head1 COPYRIGHT Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved. diff --git a/crypto/openssl/doc/man3/SSL_CTX_set_mode.pod b/crypto/openssl/doc/man3/SSL_CTX_set_mode.pod index 85e3353e0e2c..27eaebad1ea0 100644 --- a/crypto/openssl/doc/man3/SSL_CTX_set_mode.pod +++ b/crypto/openssl/doc/man3/SSL_CTX_set_mode.pod @@ -114,6 +114,22 @@ enables this behaviour to allow interoperability with such broken implementations. Please note that setting this option breaks interoperability with correct implementations. This option only applies to DTLS over SCTP. +=item SSL_MODE_NO_KTLS_TX + +Disable the use of the kernel TLS egress data-path. +By default kernel TLS is enabled if it is supported by the negotiated ciphersuites +and extensions and OpenSSL has been compiled with support for it. +The kernel TLS data-path implements the record layer, +and the crypto algorithm. The kernel will utilize the best hardware +available for crypto. Using the kernel data-path should reduce the memory +footprint of OpenSSL because no buffering is required. Also, the throughput +should improve because data copy is avoided when user data is encrypted into +kernel memory instead of the usual encrypt than copy to kernel. + +Kernel TLS might not support all the features of OpenSSL. For instance, +renegotiation, and setting the maximum fragment size is not possible as of +Linux 4.20. + =back All modes are off by default except for SSL_MODE_AUTO_RETRY which is on by @@ -134,6 +150,7 @@ L, L =head1 HISTORY SSL_MODE_ASYNC was added in OpenSSL 1.1.0. +SSL_MODE_NO_KTLS_TX was first added to OpenSSL 3.0.0. =head1 COPYRIGHT diff --git a/crypto/openssl/doc/man3/SSL_CTX_set_record_padding_callback.pod b/crypto/openssl/doc/man3/SSL_CTX_set_record_padding_callback.pod index 13e56f0c57f6..247a39fc0355 100644 --- a/crypto/openssl/doc/man3/SSL_CTX_set_record_padding_callback.pod +++ b/crypto/openssl/doc/man3/SSL_CTX_set_record_padding_callback.pod @@ -16,7 +16,7 @@ SSL_set_block_padding - install callback to specify TLS 1.3 record padding #include void SSL_CTX_set_record_padding_callback(SSL_CTX *ctx, size_t (*cb)(SSL *s, int type, size_t len, void *arg)); - void SSL_set_record_padding_callback(SSL *ssl, size_t (*cb)(SSL *s, int type, size_t len, void *arg)); + int SSL_set_record_padding_callback(SSL *ssl, size_t (*cb)(SSL *s, int type, size_t len, void *arg)); void SSL_CTX_set_record_padding_callback_arg(SSL_CTX *ctx, void *arg); void *SSL_CTX_get_record_padding_callback_arg(const SSL_CTX *ctx); @@ -32,6 +32,8 @@ SSL_set_block_padding - install callback to specify TLS 1.3 record padding SSL_CTX_set_record_padding_callback() or SSL_set_record_padding_callback() can be used to assign a callback function I to specify the padding for TLS 1.3 records. The value set in B is copied to a new SSL by SSL_new(). +Kernel TLS is not possible if the record padding callback is set, and the callback +function cannot be set if Kernel TLS is already configured for the current SSL object. SSL_CTX_set_record_padding_callback_arg() and SSL_set_record_padding_callback_arg() assign a value B that is passed to the callback when it is invoked. The value @@ -64,6 +66,9 @@ indicates no padding will be added. A return value that causes the record to exceed the maximum record size (SSL3_RT_MAX_PLAIN_LENGTH) will pad out to the maximum record size. +The SSL_CTX_get_record_padding_callback_arg() function returns 1 on success or 0 if +the callback function is not set because Kernel TLS is configured for the SSL object. + =head1 NOTES The default behavior is to add no padding to the record. @@ -84,6 +89,9 @@ L, L The record padding API was added for TLS 1.3 support in OpenSSL 1.1.1. +The return type of SSL_CTX_set_record_padding_callback() function was +changed to int in OpenSSL 3.0. + =head1 COPYRIGHT Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved. diff --git a/crypto/openssl/doc/man3/SSL_write.pod b/crypto/openssl/doc/man3/SSL_write.pod index 5e3ce1e7e4dd..20c7953deb06 100644 --- a/crypto/openssl/doc/man3/SSL_write.pod +++ b/crypto/openssl/doc/man3/SSL_write.pod @@ -2,12 +2,13 @@ =head1 NAME -SSL_write_ex, SSL_write - write bytes to a TLS/SSL connection +SSL_write_ex, SSL_write, SSL_sendfile - write bytes to a TLS/SSL connection =head1 SYNOPSIS #include + ossl_ssize_t SSL_sendfile(SSL *s, int fd, off_t offset, size_t size, int flags); int SSL_write_ex(SSL *s, const void *buf, size_t num, size_t *written); int SSL_write(SSL *ssl, const void *buf, int num); @@ -17,6 +18,14 @@ SSL_write_ex() and SSL_write() write B bytes from the buffer B into the specified B connection. On success SSL_write_ex() will store the number of bytes written in B<*written>. +SSL_sendfile() writes B bytes from offset B in the file +descriptor B to the specified SSL connection B. This function provides +efficient zero-copy semantics. SSL_sendfile() is available only when +Kernel TLS is enabled, which can be checked by calling BIO_get_ktls_send(). +It is provided here to allow users to maintain the same interface. +The meaning of B is platform dependent. +Currently, under Linux it is ignored. + =head1 NOTES In the paragraphs below a "write function" is defined as one of either @@ -104,17 +113,35 @@ You should instead call SSL_get_error() to find out if it's retryable. =back +For SSL_sendfile(), the following return values can occur: + +=over 4 + +=item Z<>>= 0 + +The write operation was successful, the return value is the number +of bytes of the file written to the TLS/SSL connection. + +=item E 0 + +The write operation was not successful, because either the connection was +closed, an error occured or action must be taken by the calling process. +Call SSL_get_error() with the return value to find out the reason. + +=back + =head1 SEE ALSO L, L, L L, L, L, L -L, +L, L, L, L =head1 HISTORY The SSL_write_ex() function was added in OpenSSL 1.1.1. +The SSL_sendfile() function was added in OpenSSL 3.0.0. =head1 COPYRIGHT diff --git a/crypto/openssl/engines/e_afalg.c b/crypto/openssl/engines/e_afalg.c index 4b1722846133..5ef3a8d457e6 100644 --- a/crypto/openssl/engines/e_afalg.c +++ b/crypto/openssl/engines/e_afalg.c @@ -407,7 +407,7 @@ static int afalg_start_cipher_sk(afalg_ctx *actx, const unsigned char *in, size_t inl, const unsigned char *iv, unsigned int enc) { - struct msghdr msg = { 0 }; + struct msghdr msg; struct cmsghdr *cmsg; struct iovec iov; ssize_t sbytes; @@ -416,6 +416,7 @@ static int afalg_start_cipher_sk(afalg_ctx *actx, const unsigned char *in, # endif char cbuf[CMSG_SPACE(ALG_IV_LEN(ALG_AES_IV_LEN)) + CMSG_SPACE(ALG_OP_LEN)]; + memset(&msg, 0, sizeof(msg)); memset(cbuf, 0, sizeof(cbuf)); msg.msg_control = cbuf; msg.msg_controllen = sizeof(cbuf); diff --git a/crypto/openssl/include/internal/bio.h b/crypto/openssl/include/internal/bio.h index c343b276295c..521b5fa2198f 100644 --- a/crypto/openssl/include/internal/bio.h +++ b/crypto/openssl/include/internal/bio.h @@ -7,6 +7,9 @@ * https://www.openssl.org/source/license.html */ +#ifndef HEADER_INTERNAL_BIO_H +# define HEADER_INTERNAL_BIO_H + #include struct bio_method_st { @@ -31,3 +34,39 @@ void bio_cleanup(void); /* Old style to new style BIO_METHOD conversion functions */ int bwrite_conv(BIO *bio, const char *data, size_t datal, size_t *written); int bread_conv(BIO *bio, char *data, size_t datal, size_t *read); + +/* Changes to these internal BIOs must also update include/openssl/bio.h */ +# define BIO_CTRL_SET_KTLS 72 +# define BIO_CTRL_SET_KTLS_TX_SEND_CTRL_MSG 74 +# define BIO_CTRL_CLEAR_KTLS_TX_CTRL_MSG 75 + +/* + * This is used with socket BIOs: + * BIO_FLAGS_KTLS_TX means we are using ktls with this BIO for sending. + * BIO_FLAGS_KTLS_TX_CTRL_MSG means we are about to send a ctrl message next. + * BIO_FLAGS_KTLS_RX means we are using ktls with this BIO for receiving. + */ +# define BIO_FLAGS_KTLS_TX 0x800 +# define BIO_FLAGS_KTLS_TX_CTRL_MSG 0x1000 +# define BIO_FLAGS_KTLS_RX 0x2000 + +/* KTLS related controls and flags */ +# define BIO_set_ktls_flag(b, is_tx) \ + BIO_set_flags(b, (is_tx) ? BIO_FLAGS_KTLS_TX : BIO_FLAGS_KTLS_RX) +# define BIO_should_ktls_flag(b, is_tx) \ + BIO_test_flags(b, (is_tx) ? BIO_FLAGS_KTLS_TX : BIO_FLAGS_KTLS_RX) +# define BIO_set_ktls_ctrl_msg_flag(b) \ + BIO_set_flags(b, BIO_FLAGS_KTLS_TX_CTRL_MSG) +# define BIO_should_ktls_ctrl_msg_flag(b) \ + BIO_test_flags(b, BIO_FLAGS_KTLS_TX_CTRL_MSG) +# define BIO_clear_ktls_ctrl_msg_flag(b) \ + BIO_clear_flags(b, BIO_FLAGS_KTLS_TX_CTRL_MSG) + +# define BIO_set_ktls(b, keyblob, is_tx) \ + BIO_ctrl(b, BIO_CTRL_SET_KTLS, is_tx, keyblob) +# define BIO_set_ktls_ctrl_msg(b, record_type) \ + BIO_ctrl(b, BIO_CTRL_SET_KTLS_TX_SEND_CTRL_MSG, record_type, NULL) +# define BIO_clear_ktls_ctrl_msg(b) \ + BIO_ctrl(b, BIO_CTRL_CLEAR_KTLS_TX_CTRL_MSG, 0, NULL) + +#endif diff --git a/crypto/openssl/include/internal/ktls.h b/crypto/openssl/include/internal/ktls.h new file mode 100644 index 000000000000..9032c0ed6174 --- /dev/null +++ b/crypto/openssl/include/internal/ktls.h @@ -0,0 +1,403 @@ +/* + * Copyright 2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#if defined(OPENSSL_SYS_LINUX) +# ifndef OPENSSL_NO_KTLS +# include +# if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) +# define OPENSSL_NO_KTLS +# ifndef PEDANTIC +# warning "KTLS requires Kernel Headers >= 4.13.0" +# warning "Skipping Compilation of KTLS" +# endif +# endif +# endif +#endif + +#ifndef HEADER_INTERNAL_KTLS +# define HEADER_INTERNAL_KTLS +# ifndef OPENSSL_NO_KTLS + +# if defined(__FreeBSD__) +# include +# include +# include +# include +# include +# include "openssl/ssl3.h" + +# ifndef TCP_RXTLS_ENABLE +# define OPENSSL_NO_KTLS_RX +# endif +# define OPENSSL_KTLS_AES_GCM_128 +# define OPENSSL_KTLS_AES_GCM_256 +# define OPENSSL_KTLS_TLS13 + +/* + * Only used by the tests in sslapitest.c. + */ +# define TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE 8 +# define TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE 8 + +typedef struct tls_enable ktls_crypto_info_t; + +/* + * FreeBSD does not require any additional steps to enable KTLS before + * setting keys. + */ +static ossl_inline int ktls_enable(int fd) +{ + return 1; +} + +/* + * The TCP_TXTLS_ENABLE socket option marks the outgoing socket buffer + * as using TLS. If successful, then data sent using this socket will + * be encrypted and encapsulated in TLS records using the tls_en + * provided here. + * + * The TCP_RXTLS_ENABLE socket option marks the incoming socket buffer + * as using TLS. If successful, then data received for this socket will + * be authenticated and decrypted using the tls_en provided here. + */ +static ossl_inline int ktls_start(int fd, ktls_crypto_info_t *tls_en, int is_tx) +{ + if (is_tx) + return setsockopt(fd, IPPROTO_TCP, TCP_TXTLS_ENABLE, + tls_en, sizeof(*tls_en)) ? 0 : 1; +# ifndef OPENSSL_NO_KTLS_RX + return setsockopt(fd, IPPROTO_TCP, TCP_RXTLS_ENABLE, tls_en, + sizeof(*tls_en)) ? 0 : 1; +# else + return 0; +# endif +} + +/* + * Send a TLS record using the tls_en provided in ktls_start and use + * record_type instead of the default SSL3_RT_APPLICATION_DATA. + * When the socket is non-blocking, then this call either returns EAGAIN or + * the entire record is pushed to TCP. It is impossible to send a partial + * record using this control message. + */ +static ossl_inline int ktls_send_ctrl_message(int fd, unsigned char record_type, + const void *data, size_t length) +{ + struct msghdr msg = { 0 }; + int cmsg_len = sizeof(record_type); + struct cmsghdr *cmsg; + char buf[CMSG_SPACE(cmsg_len)]; + struct iovec msg_iov; /* Vector of data to send/receive into */ + + msg.msg_control = buf; + msg.msg_controllen = sizeof(buf); + cmsg = CMSG_FIRSTHDR(&msg); + cmsg->cmsg_level = IPPROTO_TCP; + cmsg->cmsg_type = TLS_SET_RECORD_TYPE; + cmsg->cmsg_len = CMSG_LEN(cmsg_len); + *((unsigned char *)CMSG_DATA(cmsg)) = record_type; + msg.msg_controllen = cmsg->cmsg_len; + + msg_iov.iov_base = (void *)data; + msg_iov.iov_len = length; + msg.msg_iov = &msg_iov; + msg.msg_iovlen = 1; + + return sendmsg(fd, &msg, 0); +} + +# ifdef OPENSSL_NO_KTLS_RX + +static ossl_inline int ktls_read_record(int fd, void *data, size_t length) +{ + return -1; +} + +# else /* !defined(OPENSSL_NO_KTLS_RX) */ + +/* + * Receive a TLS record using the tls_en provided in ktls_start. The + * kernel strips any explicit IV and authentication tag, but provides + * the TLS record header via a control message. If there is an error + * with the TLS record such as an invalid header, invalid padding, or + * authentication failure recvmsg() will fail with an error. + */ +static ossl_inline int ktls_read_record(int fd, void *data, size_t length) +{ + struct msghdr msg = { 0 }; + int cmsg_len = sizeof(struct tls_get_record); + struct tls_get_record *tgr; + struct cmsghdr *cmsg; + char buf[CMSG_SPACE(cmsg_len)]; + struct iovec msg_iov; /* Vector of data to send/receive into */ + int ret; + unsigned char *p = data; + const size_t prepend_length = SSL3_RT_HEADER_LENGTH; + + if (length <= prepend_length) { + errno = EINVAL; + return -1; + } + + msg.msg_control = buf; + msg.msg_controllen = sizeof(buf); + + msg_iov.iov_base = p + prepend_length; + msg_iov.iov_len = length - prepend_length; + msg.msg_iov = &msg_iov; + msg.msg_iovlen = 1; + + ret = recvmsg(fd, &msg, 0); + if (ret <= 0) + return ret; + + if ((msg.msg_flags & (MSG_EOR | MSG_CTRUNC)) != MSG_EOR) { + errno = EMSGSIZE; + return -1; + } + + if (msg.msg_controllen == 0) { + errno = EBADMSG; + return -1; + } + + cmsg = CMSG_FIRSTHDR(&msg); + if (cmsg->cmsg_level != IPPROTO_TCP || cmsg->cmsg_type != TLS_GET_RECORD + || cmsg->cmsg_len != CMSG_LEN(cmsg_len)) { + errno = EBADMSG; + return -1; + } + + tgr = (struct tls_get_record *)CMSG_DATA(cmsg); + p[0] = tgr->tls_type; + p[1] = tgr->tls_vmajor; + p[2] = tgr->tls_vminor; + *(uint16_t *)(p + 3) = htons(ret); + + return ret + prepend_length; +} + +# endif /* OPENSSL_NO_KTLS_RX */ + +/* + * KTLS enables the sendfile system call to send data from a file over + * TLS. + */ +static ossl_inline ossl_ssize_t ktls_sendfile(int s, int fd, off_t off, + size_t size, int flags) +{ + off_t sbytes; + int ret; + + ret = sendfile(fd, s, off, size, NULL, &sbytes, flags); + if (ret == -1) { + if (errno == EAGAIN && sbytes != 0) + return sbytes; + return -1; + } + return sbytes; +} + +# endif /* __FreeBSD__ */ + +# if defined(OPENSSL_SYS_LINUX) + +# include +# if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) +# define OPENSSL_NO_KTLS_RX +# ifndef PEDANTIC +# warning "KTLS requires Kernel Headers >= 4.17.0 for receiving" +# warning "Skipping Compilation of KTLS receive data path" +# endif +# endif +# define OPENSSL_KTLS_AES_GCM_128 +# if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) +# define OPENSSL_KTLS_AES_GCM_256 +# define OPENSSL_KTLS_TLS13 +# if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0) +# define OPENSSL_KTLS_AES_CCM_128 +# endif +# endif + +# include +# include +# include +# include "openssl/ssl3.h" +# include "openssl/tls1.h" +# include "openssl/evp.h" + +# ifndef SOL_TLS +# define SOL_TLS 282 +# endif + +# ifndef TCP_ULP +# define TCP_ULP 31 +# endif + +# ifndef TLS_RX +# define TLS_RX 2 +# endif + +struct tls_crypto_info_all { *** 1677 LINES SKIPPED *** From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 00:04:35 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B0E4534558; Fri, 5 Feb 2021 00:04:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWwdZ1Dq6z3QJ5; Fri, 5 Feb 2021 00:04:34 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 06DF3150C7; Fri, 5 Feb 2021 00:04:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11504XlX026857; Fri, 5 Feb 2021 00:04:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11504X09026856; Fri, 5 Feb 2021 00:04:33 GMT (envelope-from git) Date: Fri, 5 Feb 2021 00:04:33 GMT Message-Id: <202102050004.11504X09026856@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: 3e09120f7984 - stable/13 - OpenSSL: Regenerate manual pages. 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/13 X-Git-Reftype: branch X-Git-Commit: 3e09120f7984c990530d6e6860941ffb1e281f8b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 00:04:36 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=3e09120f7984c990530d6e6860941ffb1e281f8b commit 3e09120f7984c990530d6e6860941ffb1e281f8b Author: Jung-uk Kim AuthorDate: 2021-01-26 22:26:51 +0000 Commit: John Baldwin CommitDate: 2021-02-05 00:03:21 +0000 OpenSSL: Regenerate manual pages. (cherry picked from commit bb8acd558e66bd4bae31602fcbe569863f47382c) --- secure/lib/libcrypto/man/man3/ADMISSIONS.3 | 2 +- .../libcrypto/man/man3/ASN1_INTEGER_get_int64.3 | 2 +- secure/lib/libcrypto/man/man3/ASN1_ITEM_lookup.3 | 2 +- secure/lib/libcrypto/man/man3/ASN1_OBJECT_new.3 | 2 +- .../lib/libcrypto/man/man3/ASN1_STRING_TABLE_add.3 | 2 +- secure/lib/libcrypto/man/man3/ASN1_STRING_length.3 | 2 +- secure/lib/libcrypto/man/man3/ASN1_STRING_new.3 | 2 +- .../lib/libcrypto/man/man3/ASN1_STRING_print_ex.3 | 2 +- secure/lib/libcrypto/man/man3/ASN1_TIME_set.3 | 2 +- secure/lib/libcrypto/man/man3/ASN1_TYPE_get.3 | 2 +- .../lib/libcrypto/man/man3/ASN1_generate_nconf.3 | 2 +- secure/lib/libcrypto/man/man3/ASYNC_WAIT_CTX_new.3 | 2 +- secure/lib/libcrypto/man/man3/ASYNC_start_job.3 | 2 +- secure/lib/libcrypto/man/man3/BF_encrypt.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_ADDR.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_ADDRINFO.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_connect.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_ctrl.3 | 23 +- secure/lib/libcrypto/man/man3/BIO_f_base64.3 | 4 +- secure/lib/libcrypto/man/man3/BIO_f_buffer.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_f_cipher.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_f_md.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_f_null.3 | 4 +- secure/lib/libcrypto/man/man3/BIO_f_ssl.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_find_type.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_get_data.3 | 2 +- .../lib/libcrypto/man/man3/BIO_get_ex_new_index.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_get_ktls_recv.3 | 280 +++++++++++++++++++++ secure/lib/libcrypto/man/man3/BIO_get_ktls_send.3 | 280 +++++++++++++++++++++ secure/lib/libcrypto/man/man3/BIO_meth_new.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_new.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_new_CMS.3 | 4 +- secure/lib/libcrypto/man/man3/BIO_parse_hostserv.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_printf.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_push.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_read.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_s_accept.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_s_bio.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_s_connect.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_s_fd.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_s_file.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_s_mem.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_s_null.3 | 4 +- secure/lib/libcrypto/man/man3/BIO_s_socket.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_set_callback.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_should_retry.3 | 2 +- secure/lib/libcrypto/man/man3/BN_BLINDING_new.3 | 2 +- secure/lib/libcrypto/man/man3/BN_CTX_new.3 | 2 +- secure/lib/libcrypto/man/man3/BN_CTX_start.3 | 2 +- secure/lib/libcrypto/man/man3/BN_add.3 | 2 +- secure/lib/libcrypto/man/man3/BN_add_word.3 | 2 +- secure/lib/libcrypto/man/man3/BN_bn2bin.3 | 2 +- secure/lib/libcrypto/man/man3/BN_cmp.3 | 2 +- secure/lib/libcrypto/man/man3/BN_copy.3 | 2 +- secure/lib/libcrypto/man/man3/BN_generate_prime.3 | 2 +- secure/lib/libcrypto/man/man3/BN_mod_inverse.3 | 4 +- .../lib/libcrypto/man/man3/BN_mod_mul_montgomery.3 | 2 +- .../lib/libcrypto/man/man3/BN_mod_mul_reciprocal.3 | 2 +- secure/lib/libcrypto/man/man3/BN_new.3 | 2 +- secure/lib/libcrypto/man/man3/BN_num_bytes.3 | 2 +- secure/lib/libcrypto/man/man3/BN_rand.3 | 2 +- secure/lib/libcrypto/man/man3/BN_security_bits.3 | 4 +- secure/lib/libcrypto/man/man3/BN_set_bit.3 | 2 +- secure/lib/libcrypto/man/man3/BN_swap.3 | 4 +- secure/lib/libcrypto/man/man3/BN_zero.3 | 2 +- secure/lib/libcrypto/man/man3/BUF_MEM_new.3 | 2 +- secure/lib/libcrypto/man/man3/CMS_add0_cert.3 | 2 +- .../libcrypto/man/man3/CMS_add1_recipient_cert.3 | 2 +- secure/lib/libcrypto/man/man3/CMS_add1_signer.3 | 2 +- secure/lib/libcrypto/man/man3/CMS_compress.3 | 4 +- secure/lib/libcrypto/man/man3/CMS_decrypt.3 | 4 +- secure/lib/libcrypto/man/man3/CMS_encrypt.3 | 4 +- secure/lib/libcrypto/man/man3/CMS_final.3 | 4 +- .../libcrypto/man/man3/CMS_get0_RecipientInfos.3 | 2 +- .../lib/libcrypto/man/man3/CMS_get0_SignerInfos.3 | 2 +- secure/lib/libcrypto/man/man3/CMS_get0_type.3 | 2 +- .../libcrypto/man/man3/CMS_get1_ReceiptRequest.3 | 2 +- secure/lib/libcrypto/man/man3/CMS_sign.3 | 4 +- secure/lib/libcrypto/man/man3/CMS_sign_receipt.3 | 4 +- secure/lib/libcrypto/man/man3/CMS_uncompress.3 | 4 +- secure/lib/libcrypto/man/man3/CMS_verify.3 | 2 +- secure/lib/libcrypto/man/man3/CMS_verify_receipt.3 | 4 +- secure/lib/libcrypto/man/man3/CONF_modules_free.3 | 2 +- .../libcrypto/man/man3/CONF_modules_load_file.3 | 2 +- .../libcrypto/man/man3/CRYPTO_THREAD_run_once.3 | 2 +- .../libcrypto/man/man3/CRYPTO_get_ex_new_index.3 | 2 +- secure/lib/libcrypto/man/man3/CRYPTO_memcmp.3 | 4 +- .../man/man3/CTLOG_STORE_get0_log_by_id.3 | 4 +- secure/lib/libcrypto/man/man3/CTLOG_STORE_new.3 | 2 +- secure/lib/libcrypto/man/man3/CTLOG_new.3 | 2 +- .../libcrypto/man/man3/CT_POLICY_EVAL_CTX_new.3 | 2 +- secure/lib/libcrypto/man/man3/DEFINE_STACK_OF.3 | 2 +- secure/lib/libcrypto/man/man3/DES_random_key.3 | 2 +- secure/lib/libcrypto/man/man3/DH_generate_key.3 | 2 +- .../libcrypto/man/man3/DH_generate_parameters.3 | 2 +- secure/lib/libcrypto/man/man3/DH_get0_pqg.3 | 2 +- secure/lib/libcrypto/man/man3/DH_get_1024_160.3 | 2 +- secure/lib/libcrypto/man/man3/DH_meth_new.3 | 2 +- secure/lib/libcrypto/man/man3/DH_new.3 | 2 +- secure/lib/libcrypto/man/man3/DH_new_by_nid.3 | 2 +- secure/lib/libcrypto/man/man3/DH_set_method.3 | 2 +- secure/lib/libcrypto/man/man3/DH_size.3 | 2 +- secure/lib/libcrypto/man/man3/DSA_SIG_new.3 | 2 +- secure/lib/libcrypto/man/man3/DSA_do_sign.3 | 2 +- secure/lib/libcrypto/man/man3/DSA_dup_DH.3 | 4 +- secure/lib/libcrypto/man/man3/DSA_generate_key.3 | 4 +- .../libcrypto/man/man3/DSA_generate_parameters.3 | 2 +- secure/lib/libcrypto/man/man3/DSA_get0_pqg.3 | 2 +- secure/lib/libcrypto/man/man3/DSA_meth_new.3 | 2 +- secure/lib/libcrypto/man/man3/DSA_new.3 | 2 +- secure/lib/libcrypto/man/man3/DSA_set_method.3 | 2 +- secure/lib/libcrypto/man/man3/DSA_sign.3 | 2 +- secure/lib/libcrypto/man/man3/DSA_size.3 | 2 +- secure/lib/libcrypto/man/man3/DTLS_get_data_mtu.3 | 4 +- secure/lib/libcrypto/man/man3/DTLS_set_timer_cb.3 | 2 +- secure/lib/libcrypto/man/man3/DTLSv1_listen.3 | 2 +- secure/lib/libcrypto/man/man3/ECDSA_SIG_new.3 | 2 +- .../lib/libcrypto/man/man3/ECPKParameters_print.3 | 2 +- .../lib/libcrypto/man/man3/EC_GFp_simple_method.3 | 2 +- secure/lib/libcrypto/man/man3/EC_GROUP_copy.3 | 2 +- secure/lib/libcrypto/man/man3/EC_GROUP_new.3 | 2 +- .../lib/libcrypto/man/man3/EC_KEY_get_enc_flags.3 | 2 +- secure/lib/libcrypto/man/man3/EC_KEY_new.3 | 2 +- secure/lib/libcrypto/man/man3/EC_POINT_add.3 | 2 +- secure/lib/libcrypto/man/man3/EC_POINT_new.3 | 2 +- secure/lib/libcrypto/man/man3/ENGINE_add.3 | 2 +- secure/lib/libcrypto/man/man3/ERR_GET_LIB.3 | 2 +- secure/lib/libcrypto/man/man3/ERR_clear_error.3 | 4 +- secure/lib/libcrypto/man/man3/ERR_error_string.3 | 2 +- secure/lib/libcrypto/man/man3/ERR_get_error.3 | 2 +- .../libcrypto/man/man3/ERR_load_crypto_strings.3 | 2 +- secure/lib/libcrypto/man/man3/ERR_load_strings.3 | 2 +- secure/lib/libcrypto/man/man3/ERR_print_errors.3 | 2 +- secure/lib/libcrypto/man/man3/ERR_put_error.3 | 2 +- secure/lib/libcrypto/man/man3/ERR_remove_state.3 | 2 +- secure/lib/libcrypto/man/man3/ERR_set_mark.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_BytesToKey.3 | 4 +- .../man/man3/EVP_CIPHER_CTX_get_cipher_data.3 | 2 +- .../lib/libcrypto/man/man3/EVP_CIPHER_meth_new.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_DigestInit.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_DigestSignInit.3 | 2 +- .../lib/libcrypto/man/man3/EVP_DigestVerifyInit.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_EncodeInit.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_EncryptInit.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_MD_meth_new.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_OpenInit.3 | 2 +- .../lib/libcrypto/man/man3/EVP_PKEY_ASN1_METHOD.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_CTX_ctrl.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_CTX_new.3 | 2 +- .../man/man3/EVP_PKEY_CTX_set1_pbe_pass.3 | 4 +- .../libcrypto/man/man3/EVP_PKEY_CTX_set_hkdf_md.3 | 2 +- .../man/man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md.3 | 2 +- .../libcrypto/man/man3/EVP_PKEY_CTX_set_scrypt_N.3 | 2 +- .../man/man3/EVP_PKEY_CTX_set_tls1_prf_md.3 | 2 +- .../libcrypto/man/man3/EVP_PKEY_asn1_get_count.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_cmp.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_decrypt.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_derive.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_encrypt.3 | 2 +- .../man/man3/EVP_PKEY_get_default_digest_nid.3 | 4 +- secure/lib/libcrypto/man/man3/EVP_PKEY_keygen.3 | 2 +- .../libcrypto/man/man3/EVP_PKEY_meth_get_count.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_meth_new.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_new.3 | 2 +- .../libcrypto/man/man3/EVP_PKEY_print_private.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_set1_RSA.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_sign.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_size.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_verify.3 | 2 +- .../libcrypto/man/man3/EVP_PKEY_verify_recover.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_SealInit.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_SignInit.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_VerifyInit.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_aes.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_aria.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_bf_cbc.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_blake2b512.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_camellia.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_cast5_cbc.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_chacha20.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_des.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_desx_cbc.3 | 4 +- secure/lib/libcrypto/man/man3/EVP_idea_cbc.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_md2.3 | 4 +- secure/lib/libcrypto/man/man3/EVP_md4.3 | 4 +- secure/lib/libcrypto/man/man3/EVP_md5.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_mdc2.3 | 4 +- secure/lib/libcrypto/man/man3/EVP_rc2_cbc.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_rc4.3 | 2 +- .../lib/libcrypto/man/man3/EVP_rc5_32_12_16_cbc.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_ripemd160.3 | 4 +- secure/lib/libcrypto/man/man3/EVP_seed_cbc.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_sha1.3 | 4 +- secure/lib/libcrypto/man/man3/EVP_sha224.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_sha3_224.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_sm3.3 | 4 +- secure/lib/libcrypto/man/man3/EVP_sm4_cbc.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_whirlpool.3 | 4 +- secure/lib/libcrypto/man/man3/HMAC.3 | 2 +- secure/lib/libcrypto/man/man3/MD5.3 | 2 +- secure/lib/libcrypto/man/man3/MDC2_Init.3 | 2 +- secure/lib/libcrypto/man/man3/Makefile | 3 + secure/lib/libcrypto/man/man3/OBJ_nid2obj.3 | 2 +- secure/lib/libcrypto/man/man3/OCSP_REQUEST_new.3 | 2 +- secure/lib/libcrypto/man/man3/OCSP_cert_to_id.3 | 2 +- .../libcrypto/man/man3/OCSP_request_add1_nonce.3 | 2 +- .../lib/libcrypto/man/man3/OCSP_resp_find_status.3 | 2 +- .../lib/libcrypto/man/man3/OCSP_response_status.3 | 2 +- secure/lib/libcrypto/man/man3/OCSP_sendreq_new.3 | 2 +- secure/lib/libcrypto/man/man3/OPENSSL_Applink.3 | 4 +- .../lib/libcrypto/man/man3/OPENSSL_LH_COMPFUNC.3 | 2 +- secure/lib/libcrypto/man/man3/OPENSSL_LH_stats.3 | 2 +- .../libcrypto/man/man3/OPENSSL_VERSION_NUMBER.3 | 2 +- secure/lib/libcrypto/man/man3/OPENSSL_config.3 | 2 +- .../lib/libcrypto/man/man3/OPENSSL_fork_prepare.3 | 2 +- secure/lib/libcrypto/man/man3/OPENSSL_ia32cap.3 | 4 +- .../lib/libcrypto/man/man3/OPENSSL_init_crypto.3 | 2 +- secure/lib/libcrypto/man/man3/OPENSSL_init_ssl.3 | 4 +- .../libcrypto/man/man3/OPENSSL_instrument_bus.3 | 2 +- .../man/man3/OPENSSL_load_builtin_modules.3 | 2 +- secure/lib/libcrypto/man/man3/OPENSSL_malloc.3 | 2 +- .../lib/libcrypto/man/man3/OPENSSL_secure_malloc.3 | 2 +- secure/lib/libcrypto/man/man3/OSSL_STORE_INFO.3 | 2 +- secure/lib/libcrypto/man/man3/OSSL_STORE_LOADER.3 | 2 +- secure/lib/libcrypto/man/man3/OSSL_STORE_SEARCH.3 | 2 +- secure/lib/libcrypto/man/man3/OSSL_STORE_expect.3 | 2 +- secure/lib/libcrypto/man/man3/OSSL_STORE_open.3 | 2 +- .../man/man3/OpenSSL_add_all_algorithms.3 | 2 +- secure/lib/libcrypto/man/man3/PEM_bytes_read_bio.3 | 2 +- secure/lib/libcrypto/man/man3/PEM_read.3 | 2 +- secure/lib/libcrypto/man/man3/PEM_read_CMS.3 | 2 +- .../libcrypto/man/man3/PEM_read_bio_PrivateKey.3 | 2 +- secure/lib/libcrypto/man/man3/PEM_read_bio_ex.3 | 2 +- .../libcrypto/man/man3/PEM_write_bio_CMS_stream.3 | 4 +- .../man/man3/PEM_write_bio_PKCS7_stream.3 | 4 +- secure/lib/libcrypto/man/man3/PKCS12_create.3 | 4 +- secure/lib/libcrypto/man/man3/PKCS12_newpass.3 | 4 +- secure/lib/libcrypto/man/man3/PKCS12_parse.3 | 4 +- secure/lib/libcrypto/man/man3/PKCS5_PBKDF2_HMAC.3 | 2 +- secure/lib/libcrypto/man/man3/PKCS7_decrypt.3 | 4 +- secure/lib/libcrypto/man/man3/PKCS7_encrypt.3 | 4 +- secure/lib/libcrypto/man/man3/PKCS7_sign.3 | 4 +- .../lib/libcrypto/man/man3/PKCS7_sign_add_signer.3 | 4 +- secure/lib/libcrypto/man/man3/PKCS7_verify.3 | 2 +- secure/lib/libcrypto/man/man3/RAND_DRBG_generate.3 | 2 +- .../lib/libcrypto/man/man3/RAND_DRBG_get0_master.3 | 2 +- secure/lib/libcrypto/man/man3/RAND_DRBG_new.3 | 2 +- secure/lib/libcrypto/man/man3/RAND_DRBG_reseed.3 | 2 +- .../libcrypto/man/man3/RAND_DRBG_set_callbacks.3 | 2 +- .../lib/libcrypto/man/man3/RAND_DRBG_set_ex_data.3 | 2 +- secure/lib/libcrypto/man/man3/RAND_add.3 | 2 +- secure/lib/libcrypto/man/man3/RAND_bytes.3 | 2 +- secure/lib/libcrypto/man/man3/RAND_cleanup.3 | 4 +- secure/lib/libcrypto/man/man3/RAND_egd.3 | 2 +- secure/lib/libcrypto/man/man3/RAND_load_file.3 | 2 +- .../lib/libcrypto/man/man3/RAND_set_rand_method.3 | 2 +- secure/lib/libcrypto/man/man3/RC4_set_key.3 | 2 +- secure/lib/libcrypto/man/man3/RIPEMD160_Init.3 | 2 +- secure/lib/libcrypto/man/man3/RSA_blinding_on.3 | 2 +- secure/lib/libcrypto/man/man3/RSA_check_key.3 | 2 +- secure/lib/libcrypto/man/man3/RSA_generate_key.3 | 2 +- secure/lib/libcrypto/man/man3/RSA_get0_key.3 | 2 +- secure/lib/libcrypto/man/man3/RSA_meth_new.3 | 2 +- secure/lib/libcrypto/man/man3/RSA_new.3 | 2 +- .../man/man3/RSA_padding_add_PKCS1_type_1.3 | 2 +- secure/lib/libcrypto/man/man3/RSA_print.3 | 2 +- .../lib/libcrypto/man/man3/RSA_private_encrypt.3 | 2 +- secure/lib/libcrypto/man/man3/RSA_public_encrypt.3 | 2 +- secure/lib/libcrypto/man/man3/RSA_set_method.3 | 2 +- secure/lib/libcrypto/man/man3/RSA_sign.3 | 2 +- .../man/man3/RSA_sign_ASN1_OCTET_STRING.3 | 2 +- secure/lib/libcrypto/man/man3/RSA_size.3 | 2 +- secure/lib/libcrypto/man/man3/SCT_new.3 | 2 +- secure/lib/libcrypto/man/man3/SCT_print.3 | 2 +- secure/lib/libcrypto/man/man3/SCT_validate.3 | 2 +- secure/lib/libcrypto/man/man3/SHA256_Init.3 | 2 +- secure/lib/libcrypto/man/man3/SMIME_read_CMS.3 | 4 +- secure/lib/libcrypto/man/man3/SMIME_read_PKCS7.3 | 4 +- secure/lib/libcrypto/man/man3/SMIME_write_CMS.3 | 4 +- secure/lib/libcrypto/man/man3/SMIME_write_PKCS7.3 | 4 +- .../lib/libcrypto/man/man3/SSL_CIPHER_get_name.3 | 2 +- .../man/man3/SSL_COMP_add_compression_method.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_CONF_CTX_new.3 | 2 +- .../libcrypto/man/man3/SSL_CONF_CTX_set1_prefix.3 | 4 +- .../libcrypto/man/man3/SSL_CONF_CTX_set_flags.3 | 2 +- .../libcrypto/man/man3/SSL_CONF_CTX_set_ssl_ctx.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_CONF_cmd.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_CONF_cmd_argv.3 | 4 +- .../libcrypto/man/man3/SSL_CTX_add1_chain_cert.3 | 2 +- .../man/man3/SSL_CTX_add_extra_chain_cert.3 | 2 +- .../lib/libcrypto/man/man3/SSL_CTX_add_session.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_CTX_config.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_CTX_ctrl.3 | 2 +- .../lib/libcrypto/man/man3/SSL_CTX_dane_enable.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_flush_sessions.3 | 4 +- secure/lib/libcrypto/man/man3/SSL_CTX_free.3 | 4 +- secure/lib/libcrypto/man/man3/SSL_CTX_get0_param.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_get_verify_mode.3 | 2 +- .../man/man3/SSL_CTX_has_client_custom_ext.3 | 4 +- .../man/man3/SSL_CTX_load_verify_locations.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_CTX_new.3 | 2 +- .../lib/libcrypto/man/man3/SSL_CTX_sess_number.3 | 2 +- .../man/man3/SSL_CTX_sess_set_cache_size.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_sess_set_get_cb.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_CTX_sessions.3 | 4 +- .../lib/libcrypto/man/man3/SSL_CTX_set0_CA_list.3 | 2 +- .../lib/libcrypto/man/man3/SSL_CTX_set1_curves.3 | 2 +- .../lib/libcrypto/man/man3/SSL_CTX_set1_sigalgs.3 | 2 +- .../man/man3/SSL_CTX_set1_verify_cert_store.3 | 2 +- .../man/man3/SSL_CTX_set_alpn_select_cb.3 | 2 +- .../lib/libcrypto/man/man3/SSL_CTX_set_cert_cb.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_set_cert_store.3 | 2 +- .../man/man3/SSL_CTX_set_cert_verify_callback.3 | 4 +- .../libcrypto/man/man3/SSL_CTX_set_cipher_list.3 | 2 +- .../man/man3/SSL_CTX_set_client_cert_cb.3 | 2 +- .../man/man3/SSL_CTX_set_client_hello_cb.3 | 2 +- .../man/man3/SSL_CTX_set_ct_validation_callback.3 | 2 +- .../man/man3/SSL_CTX_set_ctlog_list_file.3 | 2 +- .../man/man3/SSL_CTX_set_default_passwd_cb.3 | 2 +- .../lib/libcrypto/man/man3/SSL_CTX_set_ex_data.3 | 2 +- .../man/man3/SSL_CTX_set_generate_session_id.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_set_info_callback.3 | 2 +- .../man/man3/SSL_CTX_set_keylog_callback.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_set_max_cert_list.3 | 2 +- .../man/man3/SSL_CTX_set_min_proto_version.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_CTX_set_mode.3 | 20 +- .../libcrypto/man/man3/SSL_CTX_set_msg_callback.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_set_num_tickets.3 | 2 +- .../lib/libcrypto/man/man3/SSL_CTX_set_options.3 | 2 +- .../man/man3/SSL_CTX_set_psk_client_callback.3 | 2 +- .../man/man3/SSL_CTX_set_quiet_shutdown.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_set_read_ahead.3 | 2 +- .../man/man3/SSL_CTX_set_record_padding_callback.3 | 14 +- .../man/man3/SSL_CTX_set_security_level.3 | 2 +- .../man/man3/SSL_CTX_set_session_cache_mode.3 | 2 +- .../man/man3/SSL_CTX_set_session_id_context.3 | 2 +- .../man/man3/SSL_CTX_set_session_ticket_cb.3 | 2 +- .../man/man3/SSL_CTX_set_split_send_fragment.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_set_ssl_version.3 | 2 +- .../SSL_CTX_set_stateless_cookie_generate_cb.3 | 2 +- .../lib/libcrypto/man/man3/SSL_CTX_set_timeout.3 | 2 +- .../man3/SSL_CTX_set_tlsext_servername_callback.3 | 2 +- .../man/man3/SSL_CTX_set_tlsext_status_cb.3 | 2 +- .../man/man3/SSL_CTX_set_tlsext_ticket_key_cb.3 | 4 +- .../man/man3/SSL_CTX_set_tlsext_use_srtp.3 | 2 +- .../man/man3/SSL_CTX_set_tmp_dh_callback.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_CTX_set_verify.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_use_certificate.3 | 2 +- .../man/man3/SSL_CTX_use_psk_identity_hint.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_use_serverinfo.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_SESSION_free.3 | 2 +- .../libcrypto/man/man3/SSL_SESSION_get0_cipher.3 | 2 +- .../libcrypto/man/man3/SSL_SESSION_get0_hostname.3 | 2 +- .../man/man3/SSL_SESSION_get0_id_context.3 | 2 +- .../lib/libcrypto/man/man3/SSL_SESSION_get0_peer.3 | 4 +- .../man/man3/SSL_SESSION_get_compress_id.3 | 4 +- .../libcrypto/man/man3/SSL_SESSION_get_ex_data.3 | 2 +- .../man/man3/SSL_SESSION_get_protocol_version.3 | 2 +- .../lib/libcrypto/man/man3/SSL_SESSION_get_time.3 | 2 +- .../libcrypto/man/man3/SSL_SESSION_has_ticket.3 | 2 +- .../libcrypto/man/man3/SSL_SESSION_is_resumable.3 | 4 +- secure/lib/libcrypto/man/man3/SSL_SESSION_print.3 | 2 +- .../lib/libcrypto/man/man3/SSL_SESSION_set1_id.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_accept.3 | 4 +- .../lib/libcrypto/man/man3/SSL_alert_type_string.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_alloc_buffers.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_check_chain.3 | 4 +- secure/lib/libcrypto/man/man3/SSL_clear.3 | 4 +- secure/lib/libcrypto/man/man3/SSL_connect.3 | 4 +- secure/lib/libcrypto/man/man3/SSL_do_handshake.3 | 4 +- .../man/man3/SSL_export_keying_material.3 | 2 +- .../libcrypto/man/man3/SSL_extension_supported.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_free.3 | 4 +- secure/lib/libcrypto/man/man3/SSL_get0_peer_scts.3 | 4 +- secure/lib/libcrypto/man/man3/SSL_get_SSL_CTX.3 | 4 +- .../lib/libcrypto/man/man3/SSL_get_all_async_fds.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_get_ciphers.3 | 2 +- .../lib/libcrypto/man/man3/SSL_get_client_random.3 | 2 +- .../libcrypto/man/man3/SSL_get_current_cipher.3 | 2 +- .../libcrypto/man/man3/SSL_get_default_timeout.3 | 4 +- secure/lib/libcrypto/man/man3/SSL_get_error.3 | 4 +- .../lib/libcrypto/man/man3/SSL_get_extms_support.3 | 4 +- secure/lib/libcrypto/man/man3/SSL_get_fd.3 | 2 +- .../libcrypto/man/man3/SSL_get_peer_cert_chain.3 | 2 +- .../libcrypto/man/man3/SSL_get_peer_certificate.3 | 4 +- .../man/man3/SSL_get_peer_signature_nid.3 | 2 +- .../lib/libcrypto/man/man3/SSL_get_peer_tmp_key.3 | 2 +- .../lib/libcrypto/man/man3/SSL_get_psk_identity.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_get_rbio.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_get_session.3 | 2 +- .../libcrypto/man/man3/SSL_get_shared_sigalgs.3 | 2 +- .../lib/libcrypto/man/man3/SSL_get_verify_result.3 | 4 +- secure/lib/libcrypto/man/man3/SSL_get_version.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_in_init.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_key_update.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_library_init.3 | 2 +- .../libcrypto/man/man3/SSL_load_client_CA_file.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_new.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_pending.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_read.3 | 2 +- .../lib/libcrypto/man/man3/SSL_read_early_data.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_rstate_string.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_session_reused.3 | 4 +- secure/lib/libcrypto/man/man3/SSL_set1_host.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_set_bio.3 | 2 +- .../lib/libcrypto/man/man3/SSL_set_connect_state.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_set_fd.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_set_session.3 | 4 +- secure/lib/libcrypto/man/man3/SSL_set_shutdown.3 | 2 +- .../lib/libcrypto/man/man3/SSL_set_verify_result.3 | 4 +- secure/lib/libcrypto/man/man3/SSL_shutdown.3 | 4 +- secure/lib/libcrypto/man/man3/SSL_state_string.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_want.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_write.3 | 29 ++- secure/lib/libcrypto/man/man3/UI_STRING.3 | 2 +- secure/lib/libcrypto/man/man3/UI_UTIL_read_pw.3 | 2 +- secure/lib/libcrypto/man/man3/UI_create_method.3 | 2 +- secure/lib/libcrypto/man/man3/UI_new.3 | 2 +- secure/lib/libcrypto/man/man3/X509V3_get_d2i.3 | 2 +- secure/lib/libcrypto/man/man3/X509_ALGOR_dup.3 | 2 +- .../libcrypto/man/man3/X509_CRL_get0_by_serial.3 | 2 +- .../libcrypto/man/man3/X509_EXTENSION_set_object.3 | 2 +- secure/lib/libcrypto/man/man3/X509_LOOKUP.3 | 2 +- .../lib/libcrypto/man/man3/X509_LOOKUP_hash_dir.3 | 2 +- .../lib/libcrypto/man/man3/X509_LOOKUP_meth_new.3 | 2 +- .../man/man3/X509_NAME_ENTRY_get_object.3 | 2 +- .../man/man3/X509_NAME_add_entry_by_txt.3 | 2 +- secure/lib/libcrypto/man/man3/X509_NAME_get0_der.3 | 4 +- .../man/man3/X509_NAME_get_index_by_NID.3 | 2 +- secure/lib/libcrypto/man/man3/X509_NAME_print_ex.3 | 2 +- secure/lib/libcrypto/man/man3/X509_PUBKEY_new.3 | 2 +- secure/lib/libcrypto/man/man3/X509_SIG_get0.3 | 2 +- .../libcrypto/man/man3/X509_STORE_CTX_get_error.3 | 2 +- secure/lib/libcrypto/man/man3/X509_STORE_CTX_new.3 | 2 +- .../man/man3/X509_STORE_CTX_set_verify_cb.3 | 2 +- .../lib/libcrypto/man/man3/X509_STORE_add_cert.3 | 2 +- .../lib/libcrypto/man/man3/X509_STORE_get0_param.3 | 2 +- secure/lib/libcrypto/man/man3/X509_STORE_new.3 | 2 +- .../man/man3/X509_STORE_set_verify_cb_func.3 | 2 +- .../man/man3/X509_VERIFY_PARAM_set_flags.3 | 2 +- secure/lib/libcrypto/man/man3/X509_check_ca.3 | 4 +- secure/lib/libcrypto/man/man3/X509_check_host.3 | 2 +- secure/lib/libcrypto/man/man3/X509_check_issued.3 | 4 +- .../libcrypto/man/man3/X509_check_private_key.3 | 2 +- secure/lib/libcrypto/man/man3/X509_check_purpose.3 | 4 +- secure/lib/libcrypto/man/man3/X509_cmp.3 | 2 +- secure/lib/libcrypto/man/man3/X509_cmp_time.3 | 2 +- secure/lib/libcrypto/man/man3/X509_digest.3 | 2 +- secure/lib/libcrypto/man/man3/X509_dup.3 | 2 +- .../lib/libcrypto/man/man3/X509_get0_notBefore.3 | 2 +- .../lib/libcrypto/man/man3/X509_get0_signature.3 | 2 +- secure/lib/libcrypto/man/man3/X509_get0_uids.3 | 4 +- .../libcrypto/man/man3/X509_get_extension_flags.3 | 2 +- secure/lib/libcrypto/man/man3/X509_get_pubkey.3 | 2 +- .../lib/libcrypto/man/man3/X509_get_serialNumber.3 | 2 +- .../lib/libcrypto/man/man3/X509_get_subject_name.3 | 2 +- secure/lib/libcrypto/man/man3/X509_get_version.3 | 2 +- secure/lib/libcrypto/man/man3/X509_new.3 | 2 +- secure/lib/libcrypto/man/man3/X509_sign.3 | 2 +- secure/lib/libcrypto/man/man3/X509_verify_cert.3 | 4 +- .../lib/libcrypto/man/man3/X509v3_get_ext_by_NID.3 | 2 +- secure/lib/libcrypto/man/man3/d2i_DHparams.3 | 2 +- .../libcrypto/man/man3/d2i_PKCS8PrivateKey_bio.3 | 2 +- secure/lib/libcrypto/man/man3/d2i_PrivateKey.3 | 2 +- secure/lib/libcrypto/man/man3/d2i_SSL_SESSION.3 | 2 +- secure/lib/libcrypto/man/man3/d2i_X509.3 | 2 +- secure/lib/libcrypto/man/man3/i2d_CMS_bio_stream.3 | 4 +- .../lib/libcrypto/man/man3/i2d_PKCS7_bio_stream.3 | 4 +- secure/lib/libcrypto/man/man3/i2d_re_X509_tbs.3 | 2 +- secure/lib/libcrypto/man/man3/o2i_SCT_LIST.3 | 2 +- secure/lib/libcrypto/man/man5/x509v3_config.5 | 2 +- secure/lib/libcrypto/man/man7/Ed25519.7 | 2 +- secure/lib/libcrypto/man/man7/RAND.7 | 4 +- secure/lib/libcrypto/man/man7/RAND_DRBG.7 | 4 +- secure/lib/libcrypto/man/man7/RSA-PSS.7 | 4 +- secure/lib/libcrypto/man/man7/SM2.7 | 4 +- secure/lib/libcrypto/man/man7/X25519.7 | 2 +- secure/lib/libcrypto/man/man7/bio.7 | 4 +- secure/lib/libcrypto/man/man7/ct.7 | 4 +- secure/lib/libcrypto/man/man7/des_modes.7 | 4 +- secure/lib/libcrypto/man/man7/evp.7 | 4 +- secure/lib/libcrypto/man/man7/ossl_store-file.7 | 4 +- secure/lib/libcrypto/man/man7/ossl_store.7 | 4 +- .../lib/libcrypto/man/man7/passphrase-encoding.7 | 4 +- secure/lib/libcrypto/man/man7/proxy-certificates.7 | 4 +- secure/lib/libcrypto/man/man7/scrypt.7 | 4 +- secure/lib/libcrypto/man/man7/ssl.7 | 4 +- secure/lib/libcrypto/man/man7/x509.7 | 4 +- secure/usr.bin/openssl/man/CA.pl.1 | 4 +- secure/usr.bin/openssl/man/asn1parse.1 | 2 +- secure/usr.bin/openssl/man/ca.1 | 2 +- secure/usr.bin/openssl/man/ciphers.1 | 2 +- secure/usr.bin/openssl/man/cms.1 | 2 +- secure/usr.bin/openssl/man/crl.1 | 2 +- secure/usr.bin/openssl/man/crl2pkcs7.1 | 2 +- secure/usr.bin/openssl/man/dgst.1 | 2 +- secure/usr.bin/openssl/man/dhparam.1 | 2 +- secure/usr.bin/openssl/man/dsa.1 | 2 +- secure/usr.bin/openssl/man/dsaparam.1 | 2 +- secure/usr.bin/openssl/man/ec.1 | 2 +- secure/usr.bin/openssl/man/ecparam.1 | 2 +- secure/usr.bin/openssl/man/enc.1 | 2 +- secure/usr.bin/openssl/man/engine.1 | 2 +- secure/usr.bin/openssl/man/errstr.1 | 2 +- secure/usr.bin/openssl/man/gendsa.1 | 2 +- secure/usr.bin/openssl/man/genpkey.1 | 2 +- secure/usr.bin/openssl/man/genrsa.1 | 2 +- secure/usr.bin/openssl/man/list.1 | 2 +- secure/usr.bin/openssl/man/nseq.1 | 2 +- secure/usr.bin/openssl/man/ocsp.1 | 2 +- secure/usr.bin/openssl/man/openssl.1 | 4 +- secure/usr.bin/openssl/man/passwd.1 | 2 +- secure/usr.bin/openssl/man/pkcs12.1 | 2 +- secure/usr.bin/openssl/man/pkcs7.1 | 2 +- secure/usr.bin/openssl/man/pkcs8.1 | 2 +- secure/usr.bin/openssl/man/pkey.1 | 2 +- secure/usr.bin/openssl/man/pkeyparam.1 | 2 +- secure/usr.bin/openssl/man/pkeyutl.1 | 2 +- secure/usr.bin/openssl/man/prime.1 | 2 +- secure/usr.bin/openssl/man/rand.1 | 2 +- secure/usr.bin/openssl/man/req.1 | 2 +- secure/usr.bin/openssl/man/rsa.1 | 2 +- secure/usr.bin/openssl/man/rsautl.1 | 2 +- secure/usr.bin/openssl/man/s_client.1 | 2 +- secure/usr.bin/openssl/man/s_server.1 | 2 +- secure/usr.bin/openssl/man/s_time.1 | 2 +- secure/usr.bin/openssl/man/sess_id.1 | 2 +- secure/usr.bin/openssl/man/smime.1 | 2 +- secure/usr.bin/openssl/man/speed.1 | 2 +- secure/usr.bin/openssl/man/spkac.1 | 2 +- secure/usr.bin/openssl/man/srp.1 | 2 +- secure/usr.bin/openssl/man/storeutl.1 | 2 +- secure/usr.bin/openssl/man/ts.1 | 2 +- secure/usr.bin/openssl/man/tsget.1 | 2 +- secure/usr.bin/openssl/man/verify.1 | 2 +- secure/usr.bin/openssl/man/version.1 | 2 +- secure/usr.bin/openssl/man/x509.1 | 2 +- 537 files changed, 1269 insertions(+), 644 deletions(-) diff --git a/secure/lib/libcrypto/man/man3/ADMISSIONS.3 b/secure/lib/libcrypto/man/man3/ADMISSIONS.3 index 787f87e8f013..048d4fc2b64b 100644 --- a/secure/lib/libcrypto/man/man3/ADMISSIONS.3 +++ b/secure/lib/libcrypto/man/man3/ADMISSIONS.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/ASN1_INTEGER_get_int64.3 b/secure/lib/libcrypto/man/man3/ASN1_INTEGER_get_int64.3 index 4277347439b2..135a622a91c8 100644 --- a/secure/lib/libcrypto/man/man3/ASN1_INTEGER_get_int64.3 +++ b/secure/lib/libcrypto/man/man3/ASN1_INTEGER_get_int64.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/ASN1_ITEM_lookup.3 b/secure/lib/libcrypto/man/man3/ASN1_ITEM_lookup.3 index f469ec947480..9ac1969ef577 100644 --- a/secure/lib/libcrypto/man/man3/ASN1_ITEM_lookup.3 +++ b/secure/lib/libcrypto/man/man3/ASN1_ITEM_lookup.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/ASN1_OBJECT_new.3 b/secure/lib/libcrypto/man/man3/ASN1_OBJECT_new.3 index 3e36faa9efcc..f5a4c0f68510 100644 --- a/secure/lib/libcrypto/man/man3/ASN1_OBJECT_new.3 +++ b/secure/lib/libcrypto/man/man3/ASN1_OBJECT_new.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/ASN1_STRING_TABLE_add.3 b/secure/lib/libcrypto/man/man3/ASN1_STRING_TABLE_add.3 index af133ca346e2..9b9613637d3a 100644 --- a/secure/lib/libcrypto/man/man3/ASN1_STRING_TABLE_add.3 +++ b/secure/lib/libcrypto/man/man3/ASN1_STRING_TABLE_add.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/ASN1_STRING_length.3 b/secure/lib/libcrypto/man/man3/ASN1_STRING_length.3 index 1976aa20db2a..ad33ca4b7b2a 100644 --- a/secure/lib/libcrypto/man/man3/ASN1_STRING_length.3 +++ b/secure/lib/libcrypto/man/man3/ASN1_STRING_length.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/ASN1_STRING_new.3 b/secure/lib/libcrypto/man/man3/ASN1_STRING_new.3 index 15a6dfc41f63..f2c2afe53015 100644 --- a/secure/lib/libcrypto/man/man3/ASN1_STRING_new.3 +++ b/secure/lib/libcrypto/man/man3/ASN1_STRING_new.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/ASN1_STRING_print_ex.3 b/secure/lib/libcrypto/man/man3/ASN1_STRING_print_ex.3 index 193dd4715024..d2394acf12e7 100644 --- a/secure/lib/libcrypto/man/man3/ASN1_STRING_print_ex.3 +++ b/secure/lib/libcrypto/man/man3/ASN1_STRING_print_ex.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/ASN1_TIME_set.3 b/secure/lib/libcrypto/man/man3/ASN1_TIME_set.3 index fc26c41498f0..562929c6cd9f 100644 --- a/secure/lib/libcrypto/man/man3/ASN1_TIME_set.3 +++ b/secure/lib/libcrypto/man/man3/ASN1_TIME_set.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/ASN1_TYPE_get.3 b/secure/lib/libcrypto/man/man3/ASN1_TYPE_get.3 index bbcf08b8fdd4..930a32de6d33 100644 --- a/secure/lib/libcrypto/man/man3/ASN1_TYPE_get.3 +++ b/secure/lib/libcrypto/man/man3/ASN1_TYPE_get.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/ASN1_generate_nconf.3 b/secure/lib/libcrypto/man/man3/ASN1_generate_nconf.3 index bb8ab5bebd01..c139f0a79d4a 100644 --- a/secure/lib/libcrypto/man/man3/ASN1_generate_nconf.3 +++ b/secure/lib/libcrypto/man/man3/ASN1_generate_nconf.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/ASYNC_WAIT_CTX_new.3 b/secure/lib/libcrypto/man/man3/ASYNC_WAIT_CTX_new.3 index ab3b56231eba..b09d540d97e5 100644 --- a/secure/lib/libcrypto/man/man3/ASYNC_WAIT_CTX_new.3 +++ b/secure/lib/libcrypto/man/man3/ASYNC_WAIT_CTX_new.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/ASYNC_start_job.3 b/secure/lib/libcrypto/man/man3/ASYNC_start_job.3 index f9bb9aea0fe9..0917cbf28d0a 100644 --- a/secure/lib/libcrypto/man/man3/ASYNC_start_job.3 +++ b/secure/lib/libcrypto/man/man3/ASYNC_start_job.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/BF_encrypt.3 b/secure/lib/libcrypto/man/man3/BF_encrypt.3 index 263e9f4aee6a..1e67cea75097 100644 --- a/secure/lib/libcrypto/man/man3/BF_encrypt.3 +++ b/secure/lib/libcrypto/man/man3/BF_encrypt.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/BIO_ADDR.3 b/secure/lib/libcrypto/man/man3/BIO_ADDR.3 index 4867c770113f..3f0f0cfd2170 100644 --- a/secure/lib/libcrypto/man/man3/BIO_ADDR.3 +++ b/secure/lib/libcrypto/man/man3/BIO_ADDR.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/BIO_ADDRINFO.3 b/secure/lib/libcrypto/man/man3/BIO_ADDRINFO.3 index 4f6558313eaf..5df20d27fde8 100644 --- a/secure/lib/libcrypto/man/man3/BIO_ADDRINFO.3 +++ b/secure/lib/libcrypto/man/man3/BIO_ADDRINFO.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/BIO_connect.3 b/secure/lib/libcrypto/man/man3/BIO_connect.3 index 72e03a6d0908..f9fdd9b15d37 100644 --- a/secure/lib/libcrypto/man/man3/BIO_connect.3 +++ b/secure/lib/libcrypto/man/man3/BIO_connect.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/BIO_ctrl.3 b/secure/lib/libcrypto/man/man3/BIO_ctrl.3 index 31c70dbb37a8..487f6d192c8c 100644 --- a/secure/lib/libcrypto/man/man3/BIO_ctrl.3 +++ b/secure/lib/libcrypto/man/man3/BIO_ctrl.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== @@ -133,13 +133,13 @@ .\" ======================================================================== .\" .IX Title "BIO_CTRL 3" -.TH BIO_CTRL 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH BIO_CTRL 3 "2021-01-21" "1.1.1i" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" -BIO_ctrl, BIO_callback_ctrl, BIO_ptr_ctrl, BIO_int_ctrl, BIO_reset, BIO_seek, BIO_tell, BIO_flush, BIO_eof, BIO_set_close, BIO_get_close, BIO_pending, BIO_wpending, BIO_ctrl_pending, BIO_ctrl_wpending, BIO_get_info_callback, BIO_set_info_callback, BIO_info_cb \&\- BIO control operations +BIO_ctrl, BIO_callback_ctrl, BIO_ptr_ctrl, BIO_int_ctrl, BIO_reset, BIO_seek, BIO_tell, BIO_flush, BIO_eof, BIO_set_close, BIO_get_close, BIO_pending, BIO_wpending, BIO_ctrl_pending, BIO_ctrl_wpending, BIO_get_info_callback, BIO_set_info_callback, BIO_info_cb, BIO_get_ktls_send, BIO_get_ktls_recv \&\- BIO control operations .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 @@ -166,6 +166,9 @@ BIO_ctrl, BIO_callback_ctrl, BIO_ptr_ctrl, BIO_int_ctrl, BIO_reset, BIO_seek, BI \& \& int BIO_get_info_callback(BIO *b, BIO_info_cb **cbp); \& int BIO_set_info_callback(BIO *b, BIO_info_cb *cb); +\& +\& int BIO_get_ktls_send(BIO *b); +\& int BIO_get_ktls_recv(BIO *b); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" @@ -204,6 +207,11 @@ return the number of pending characters in the BIOs read and write buffers. Not all BIOs support these calls. \fBBIO_ctrl_pending()\fR and \fBBIO_ctrl_wpending()\fR return a size_t type and are functions, \fBBIO_pending()\fR and \fBBIO_wpending()\fR are macros which call \fBBIO_ctrl()\fR. +.PP +\&\fBBIO_get_ktls_send()\fR returns 1 if the \s-1BIO\s0 is using the Kernel \s-1TLS\s0 data-path for +sending. Otherwise, it returns zero. +\&\fBBIO_get_ktls_recv()\fR returns 1 if the \s-1BIO\s0 is using the Kernel \s-1TLS\s0 data-path for +receiving. Otherwise, it returns zero. .SH "RETURN VALUES" .IX Header "RETURN VALUES" \&\fBBIO_reset()\fR normally returns 1 for success and 0 or \-1 for failure. File @@ -223,6 +231,11 @@ for success and \-1 for failure. .PP \&\fBBIO_pending()\fR, \fBBIO_ctrl_pending()\fR, \fBBIO_wpending()\fR and \fBBIO_ctrl_wpending()\fR return the amount of pending data. +.PP +\&\fBBIO_get_ktls_send()\fR returns 1 if the \s-1BIO\s0 is using the Kernel \s-1TLS\s0 data-path for +sending. Otherwise, it returns zero. +\&\fBBIO_get_ktls_recv()\fR returns 1 if the \s-1BIO\s0 is using the Kernel \s-1TLS\s0 data-path for +receiving. Otherwise, it returns zero. .SH "NOTES" .IX Header "NOTES" \&\fBBIO_flush()\fR, because it can write data may return 0 or \-1 indicating @@ -253,6 +266,10 @@ Some of the return values are ambiguous and care should be taken. In particular a return value of 0 can be returned if an operation is not supported, if an error occurred, if \s-1EOF\s0 has not been reached and in the case of \fBBIO_seek()\fR on a file \s-1BIO\s0 for a successful operation. +.SH "HISTORY" +.IX Header "HISTORY" +The \fBBIO_get_ktls_send()\fR and \fBBIO_get_ktls_recv()\fR functions were added in +OpenSSL 3.0.0. .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2000\-2020 The OpenSSL Project Authors. All Rights Reserved. diff --git a/secure/lib/libcrypto/man/man3/BIO_f_base64.3 b/secure/lib/libcrypto/man/man3/BIO_f_base64.3 index 6c2c7de56ed1..d42d2eb6c9ec 100644 --- a/secure/lib/libcrypto/man/man3/BIO_f_base64.3 +++ b/secure/lib/libcrypto/man/man3/BIO_f_base64.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "BIO_F_BASE64 3" -.TH BIO_F_BASE64 3 "2020-09-22" "1.1.1h" "OpenSSL" +.TH BIO_F_BASE64 3 "2020-12-08" "1.1.1i" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/BIO_f_buffer.3 b/secure/lib/libcrypto/man/man3/BIO_f_buffer.3 index 6105f2a83361..9b4bc1c800c5 100644 --- a/secure/lib/libcrypto/man/man3/BIO_f_buffer.3 +++ b/secure/lib/libcrypto/man/man3/BIO_f_buffer.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/BIO_f_cipher.3 b/secure/lib/libcrypto/man/man3/BIO_f_cipher.3 index ae9a6747fcb4..a26d0f5cca2f 100644 --- a/secure/lib/libcrypto/man/man3/BIO_f_cipher.3 +++ b/secure/lib/libcrypto/man/man3/BIO_f_cipher.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/BIO_f_md.3 b/secure/lib/libcrypto/man/man3/BIO_f_md.3 index 8e3cd75c5553..ba7f598a14fc 100644 --- a/secure/lib/libcrypto/man/man3/BIO_f_md.3 +++ b/secure/lib/libcrypto/man/man3/BIO_f_md.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/BIO_f_null.3 b/secure/lib/libcrypto/man/man3/BIO_f_null.3 index e01f9b021520..44d680123203 100644 --- a/secure/lib/libcrypto/man/man3/BIO_f_null.3 +++ b/secure/lib/libcrypto/man/man3/BIO_f_null.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "BIO_F_NULL 3" -.TH BIO_F_NULL 3 "2020-09-22" "1.1.1h" "OpenSSL" +.TH BIO_F_NULL 3 "2020-12-08" "1.1.1i" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/BIO_f_ssl.3 b/secure/lib/libcrypto/man/man3/BIO_f_ssl.3 index 3779dfbfeba3..ce95b5d29fd3 100644 --- a/secure/lib/libcrypto/man/man3/BIO_f_ssl.3 +++ b/secure/lib/libcrypto/man/man3/BIO_f_ssl.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/BIO_find_type.3 b/secure/lib/libcrypto/man/man3/BIO_find_type.3 index 878e2c65b24f..8ed77ea8ae03 100644 --- a/secure/lib/libcrypto/man/man3/BIO_find_type.3 +++ b/secure/lib/libcrypto/man/man3/BIO_find_type.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/BIO_get_data.3 b/secure/lib/libcrypto/man/man3/BIO_get_data.3 index 4069639cc4aa..dc9eb33aba84 100644 --- a/secure/lib/libcrypto/man/man3/BIO_get_data.3 +++ b/secure/lib/libcrypto/man/man3/BIO_get_data.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/BIO_get_ex_new_index.3 b/secure/lib/libcrypto/man/man3/BIO_get_ex_new_index.3 index 93a2e5521f3a..a1ff83189d93 100644 --- a/secure/lib/libcrypto/man/man3/BIO_get_ex_new_index.3 +++ b/secure/lib/libcrypto/man/man3/BIO_get_ex_new_index.3 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.41) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== diff --git a/secure/lib/libcrypto/man/man3/BIO_get_ktls_recv.3 b/secure/lib/libcrypto/man/man3/BIO_get_ktls_recv.3 new file mode 100644 index 000000000000..487f6d192c8c --- /dev/null +++ b/secure/lib/libcrypto/man/man3/BIO_get_ktls_recv.3 @@ -0,0 +1,280 @@ +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +. ds C` +. ds C' +'br\} +.\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" +.\" If the F register is >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 *** 6631 LINES SKIPPED *** From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 00:04:36 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C6FCB5344D8; Fri, 5 Feb 2021 00:04:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWwdb4nVGz3QSG; Fri, 5 Feb 2021 00:04:35 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 185E914E49; Fri, 5 Feb 2021 00:04:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11504YT2026890; Fri, 5 Feb 2021 00:04:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11504YCI026889; Fri, 5 Feb 2021 00:04:34 GMT (envelope-from git) Date: Fri, 5 Feb 2021 00:04:34 GMT Message-Id: <202102050004.11504YCI026889@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: 3cf25a7802a2 - stable/13 - Disable MK_OPENSSL_KTLS for stable/13. 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/13 X-Git-Reftype: branch X-Git-Commit: 3cf25a7802a26ae3be9159c585fda6aea3d0dc08 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 00:04:37 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=3cf25a7802a26ae3be9159c585fda6aea3d0dc08 commit 3cf25a7802a26ae3be9159c585fda6aea3d0dc08 Author: John Baldwin AuthorDate: 2021-02-04 21:40:25 +0000 Commit: John Baldwin CommitDate: 2021-02-05 00:03:21 +0000 Disable MK_OPENSSL_KTLS for stable/13. Due to the pending release of 13.0 and the recent bug in serf exposed by the KTLS changes, disable OpenSSL's KTLS by default. This keeps crypto/openssl in sync with main while lowering the risk of introducing instability into 13.0. Discussed with: gjb (re), jkim, emaste (secteam) --- share/mk/src.opts.mk | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 75405c1bc050..d01472c7fae6 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -212,6 +212,7 @@ __DEFAULT_NO_OPTIONS = \ LOADER_VERIEXEC_PASS_MANIFEST \ OFED_EXTRA \ OPENLDAP \ + OPENSSL_KTLS \ RPCBIND_WARMSTART_SUPPORT \ SORT_THREADS \ SVN \ @@ -330,13 +331,6 @@ BROKEN_OPTIONS+=LOADER_UBOOT BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA .endif -# Kernel TLS is enabled by default on amd64 -.if ${__T} == "amd64" -__DEFAULT_YES_OPTIONS+=OPENSSL_KTLS -.else -__DEFAULT_NO_OPTIONS+=OPENSSL_KTLS -.endif - .if ${__T:Mmips64*} # profiling won't work on MIPS64 because there is only assembly for o32 BROKEN_OPTIONS+=PROFILE From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 00:04:38 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82C9C53480C; Fri, 5 Feb 2021 00:04: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 4DWwdc4hcQz3Q9q; Fri, 5 Feb 2021 00:04:36 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2F60A14E4A; Fri, 5 Feb 2021 00:04:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11504amU026909; Fri, 5 Feb 2021 00:04:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11504aXk026908; Fri, 5 Feb 2021 00:04:36 GMT (envelope-from git) Date: Fri, 5 Feb 2021 00:04:36 GMT Message-Id: <202102050004.11504aXk026908@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: ab537343065a - stable/13 - Regenerate src.conf(5). 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/13 X-Git-Reftype: branch X-Git-Commit: ab537343065a6925e62001165a4743a17e050118 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 00:04:39 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=ab537343065a6925e62001165a4743a17e050118 commit ab537343065a6925e62001165a4743a17e050118 Author: John Baldwin AuthorDate: 2021-02-04 21:47:26 +0000 Commit: John Baldwin CommitDate: 2021-02-05 00:03:21 +0000 Regenerate src.conf(5). --- share/man/man5/src.conf.5 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index a3802b59a3f5..90905413175e 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1309,6 +1309,8 @@ When set, these options are also in effect: .Va WITH_GSSAPI is set explicitly) .El +.It Va WITH_OPENSSL_KTLS +Set to include kernel TLS support in OpenSSL. .It Va WITHOUT_PAM Set to not build PAM library and modules. .Bf -symbolic From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 00:27:28 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5082F535A4D; Fri, 5 Feb 2021 00:27:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWx801qzYz3jKK; Fri, 5 Feb 2021 00:27:28 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 31D7015444; Fri, 5 Feb 2021 00:27:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1150RShw054304; Fri, 5 Feb 2021 00:27:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1150RSY9054303; Fri, 5 Feb 2021 00:27:28 GMT (envelope-from git) Date: Fri, 5 Feb 2021 00:27:28 GMT Message-Id: <202102050027.1150RSY9054303@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: dbe043d42cda - stable/13 - Correct description for kern.proc.proc_td MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dbe043d42cda38e7f4186f0c0ed39569b713f05b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 00:27:28 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=dbe043d42cda38e7f4186f0c0ed39569b713f05b commit dbe043d42cda38e7f4186f0c0ed39569b713f05b Author: Ed Maste AuthorDate: 2021-02-02 21:55:51 +0000 Commit: Ed Maste CommitDate: 2021-02-05 00:26:10 +0000 Correct description for kern.proc.proc_td kern.proc.proc_td returns the process table with an entry for each thread. Previously the description included "no threads", presumably a cut-and-pasteo in 2648efa621748. Description suggested by PauAmma. PR: 253146 MFC after: 3 days Sponsored by: The FreeBSD Foundation (cherry picked from commit edc374e7c41d3d9e28e0b3a76bc9ed021d7db571) --- sys/kern/kern_proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index ae80ba9ed5ed..305bc7e8a2ef 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -3186,7 +3186,7 @@ static SYSCTL_NODE(_kern_proc, (KERN_PROC_PID | KERN_PROC_INC_THREAD), pid_td, static SYSCTL_NODE(_kern_proc, (KERN_PROC_PROC | KERN_PROC_INC_THREAD), proc_td, CTLFLAG_RD | CTLFLAG_MPSAFE, sysctl_kern_proc, - "Return process table, no threads"); + "Return process table, including threads"); #ifdef COMPAT_FREEBSD7 static SYSCTL_NODE(_kern_proc, KERN_PROC_OVMMAP, ovmmap, CTLFLAG_RD | From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 01:28:04 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D6B0D538715; Fri, 5 Feb 2021 01:28:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DWyTw5kXzz3nTB; Fri, 5 Feb 2021 01:28:04 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B75FC163A3; Fri, 5 Feb 2021 01:28:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1151S4OK032572; Fri, 5 Feb 2021 01:28:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1151S4FV032571; Fri, 5 Feb 2021 01:28:04 GMT (envelope-from git) Date: Fri, 5 Feb 2021 01:28:04 GMT Message-Id: <202102050128.1151S4FV032571@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: e4a6846c34d2 - stable/13 - WITH_OFED build option: fix 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: e4a6846c34d2bf5365199411a5ad680462ab8f9d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 01:28:04 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e4a6846c34d2bf5365199411a5ad680462ab8f9d commit e4a6846c34d2bf5365199411a5ad680462ab8f9d Author: Konstantin Belousov AuthorDate: 2021-02-02 13:01:26 +0000 Commit: Konstantin Belousov CommitDate: 2021-02-05 01:27:33 +0000 WITH_OFED build option: fix (cherry picked from commit ff975f15d86001d5b948ab538de1e4aca852d2f5) --- sys/conf/kern.opts.mk | 2 +- tools/build/options/WITHOUT_OFED | 4 ++++ tools/build/options/WITH_OFED | 4 ---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/conf/kern.opts.mk b/sys/conf/kern.opts.mk index 5a66849b36da..7361cdd70076 100644 --- a/sys/conf/kern.opts.mk +++ b/sys/conf/kern.opts.mk @@ -41,6 +41,7 @@ __DEFAULT_YES_OPTIONS = \ ISCSI \ KERNEL_SYMBOLS \ NETGRAPH \ + OFED \ PF \ SCTP_SUPPORT \ SOURCELESS_HOST \ @@ -55,7 +56,6 @@ __DEFAULT_NO_OPTIONS = \ INIT_ALL_PATTERN \ INIT_ALL_ZERO \ KERNEL_RETPOLINE \ - OFED \ RATELIMIT \ REPRODUCIBLE_BUILD diff --git a/tools/build/options/WITHOUT_OFED b/tools/build/options/WITHOUT_OFED new file mode 100644 index 000000000000..18a6943b3580 --- /dev/null +++ b/tools/build/options/WITHOUT_OFED @@ -0,0 +1,4 @@ +.\" $FreeBSD$ +Set to disable the build of the +.Dq "OpenFabrics Enterprise Distribution" +Infiniband software stack, including kernel modules and userspace libraries. diff --git a/tools/build/options/WITH_OFED b/tools/build/options/WITH_OFED deleted file mode 100644 index a995fb8cdab8..000000000000 --- a/tools/build/options/WITH_OFED +++ /dev/null @@ -1,4 +0,0 @@ -.\" $FreeBSD$ -Set to build the -.Dq "OpenFabrics Enterprise Distribution" -Infiniband software stack. From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 02:00:26 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3C673538E49; Fri, 5 Feb 2021 02:00: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 4DWzCG1CDTz3pm2; Fri, 5 Feb 2021 02:00:26 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1C3D6165B0; Fri, 5 Feb 2021 02:00:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11520QwG079786; Fri, 5 Feb 2021 02:00:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11520QCt079785; Fri, 5 Feb 2021 02:00:26 GMT (envelope-from git) Date: Fri, 5 Feb 2021 02:00:26 GMT Message-Id: <202102050200.11520QCt079785@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: 6e1fe6d26ea2 - stable/13 - Bump shared library versions after ncurses bump in 13. 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/13 X-Git-Reftype: branch X-Git-Commit: 6e1fe6d26ea2939656c8286ccbd105a89d3349a3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 02:00:26 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=6e1fe6d26ea2939656c8286ccbd105a89d3349a3 commit 6e1fe6d26ea2939656c8286ccbd105a89d3349a3 Author: John Baldwin AuthorDate: 2021-02-02 01:09:33 +0000 Commit: John Baldwin CommitDate: 2021-02-05 01:51:45 +0000 Bump shared library versions after ncurses bump in 13. A few shared libraries in the base system link against ncurses. An upgrade from a 12.x host to 13 results in ABI breakage for existing binaries since the newer versions of these libraries link against the newer ncurses while the binary itself links against the older ncurses. For example, dialog4ports built on 12.x sometimes crashes on 13 since it depends on libdialog which links against ncurses internally. (cherry picked from commit 0b7f1af804f06a285717b490bef80e24648adcbe) --- ObsoleteFiles.inc | 11 +++++++++++ gnu/lib/libdialog/Makefile | 2 +- lib/libdpv/Makefile | 2 +- lib/libedit/Makefile | 2 +- lib/ncurses/form/Makefile | 1 + lib/ncurses/menu/Makefile | 1 + lib/ncurses/panel/Makefile | 1 + 7 files changed, 17 insertions(+), 3 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 1d0766ec894a..7ebff0441581 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -36,6 +36,17 @@ # xargs -n1 | sort | uniq -d; # done +# 20210204: bump shared libraries which link against ncurses +OLD_LIBS+=lib/libedit.so.7 +OLD_LIBS+=usr/lib/libdialog.so.8 +OLD_LIBS+=usr/lib/libdpv.so.1 +OLD_LIBS+=usr/lib/libform.so.5 +OLD_LIBS+=usr/lib/libformw.so.5 +OLD_LIBS+=usr/lib/libmenu.so.5 +OLD_LIBS+=usr/lib/libmenuw.so.5 +OLD_LIBS+=usr/lib/libpanel.so.5 +OLD_LIBS+=usr/lib/libpanelw.so.5 + # 20210116: if_wl_wavelan.h removed .if ${TARGET_ARCH} == "i386" OLD_FILES+=usr/include/machine/if_wl_wavelan.h diff --git a/gnu/lib/libdialog/Makefile b/gnu/lib/libdialog/Makefile index 69d8dbd3fdb8..e4f1b62121d9 100644 --- a/gnu/lib/libdialog/Makefile +++ b/gnu/lib/libdialog/Makefile @@ -3,7 +3,7 @@ DIALOG= ${SRCTOP}/contrib/dialog LIB= dialog -SHLIB_MAJOR= 8 +SHLIB_MAJOR= 9 SRCS= argv.c arrows.c buildlist.c buttons.c calendar.c checklist.c \ columns.c dlg_keys.c editbox.c fselect.c formbox.c guage.c \ help.c inputbox.c inputstr.c menubox.c mixedform.c \ diff --git a/lib/libdpv/Makefile b/lib/libdpv/Makefile index d2334ee38186..be28debc70bc 100644 --- a/lib/libdpv/Makefile +++ b/lib/libdpv/Makefile @@ -2,7 +2,7 @@ PACKAGE= dpv LIB= dpv -SHLIB_MAJOR= 1 +SHLIB_MAJOR= 2 INCS= dpv.h MAN= dpv.3 MLINKS= dpv.3 dpv_free.3 diff --git a/lib/libedit/Makefile b/lib/libedit/Makefile index f1dbad42db22..963063ef90fa 100644 --- a/lib/libedit/Makefile +++ b/lib/libedit/Makefile @@ -7,7 +7,7 @@ PACKAGE=clibs EDITDIR= ${SRCTOP}/contrib/libedit .PATH: ${EDITDIR} -SHLIB_MAJOR= 7 +SHLIB_MAJOR= 8 SHLIBDIR?= /lib WARNS?= 3 diff --git a/lib/ncurses/form/Makefile b/lib/ncurses/form/Makefile index a8e636d6ce1b..a6b186936dc5 100644 --- a/lib/ncurses/form/Makefile +++ b/lib/ncurses/form/Makefile @@ -6,6 +6,7 @@ SRCDIR= ${NCURSES_DIR}/form LIB= formw +SHLIB_MAJOR= 6 .PATH: ${SRCDIR} SRCS= \ diff --git a/lib/ncurses/menu/Makefile b/lib/ncurses/menu/Makefile index 7844cd4d936c..9bd92723fed9 100644 --- a/lib/ncurses/menu/Makefile +++ b/lib/ncurses/menu/Makefile @@ -6,6 +6,7 @@ SRCDIR= ${NCURSES_DIR}/menu LIB= menuw +SHLIB_MAJOR= 6 .PATH: ${SRCDIR} SRCS= \ diff --git a/lib/ncurses/panel/Makefile b/lib/ncurses/panel/Makefile index a22df4d89570..9dd950496b1b 100644 --- a/lib/ncurses/panel/Makefile +++ b/lib/ncurses/panel/Makefile @@ -6,6 +6,7 @@ SRCDIR= ${NCURSES_DIR}/panel LIB= panelw +SHLIB_MAJOR= 6 .PATH: ${SRCDIR} SRCS= \ From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 02:52:48 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7AE2853A6E6; Fri, 5 Feb 2021 02:52: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 4DX0Mh33Lgz3sbX; Fri, 5 Feb 2021 02:52:48 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5B1FB16CFD; Fri, 5 Feb 2021 02:52:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1152qmun050511; Fri, 5 Feb 2021 02:52:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1152qmtd050510; Fri, 5 Feb 2021 02:52:48 GMT (envelope-from git) Date: Fri, 5 Feb 2021 02:52:48 GMT Message-Id: <202102050252.1152qmtd050510@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 7523914d08f9 - stable/12 - Correct description for kern.proc.proc_td MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 7523914d08f9afba1b15f051bc34245cd551c725 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 02:52:48 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=7523914d08f9afba1b15f051bc34245cd551c725 commit 7523914d08f9afba1b15f051bc34245cd551c725 Author: Ed Maste AuthorDate: 2021-02-02 21:55:51 +0000 Commit: Ed Maste CommitDate: 2021-02-05 02:51:45 +0000 Correct description for kern.proc.proc_td kern.proc.proc_td returns the process table with an entry for each thread. Previously the description included "no threads", presumably a cut-and-pasteo in 2648efa621748. Description suggested by PauAmma. PR: 253146 MFC after: 3 days Sponsored by: The FreeBSD Foundation (cherry picked from commit edc374e7c41d3d9e28e0b3a76bc9ed021d7db571) --- sys/kern/kern_proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 566b9a8ea43a..04d82d30f8c2 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -3167,7 +3167,7 @@ static SYSCTL_NODE(_kern_proc, (KERN_PROC_PID | KERN_PROC_INC_THREAD), pid_td, static SYSCTL_NODE(_kern_proc, (KERN_PROC_PROC | KERN_PROC_INC_THREAD), proc_td, CTLFLAG_RD | CTLFLAG_MPSAFE, sysctl_kern_proc, - "Return process table, no threads"); + "Return process table, including threads"); #ifdef COMPAT_FREEBSD7 static SYSCTL_NODE(_kern_proc, KERN_PROC_OVMMAP, ovmmap, CTLFLAG_RD | From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 06:38:44 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 39C1253E8A3 for ; Fri, 5 Feb 2021 06:38:44 +0000 (UTC) (envelope-from tsoome@me.com) Received: from pv50p00im-zteg10011501.me.com (pv50p00im-zteg10011501.me.com [17.58.6.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DX5NN0H7Wz4Z8N for ; Fri, 5 Feb 2021 06:38:43 +0000 (UTC) (envelope-from tsoome@me.com) Received: from [192.168.150.141] (148-52-235-80.sta.estpak.ee [80.235.52.148]) by pv50p00im-zteg10011501.me.com (Postfix) with ESMTPSA id EA24AB00459; Fri, 5 Feb 2021 06:38:41 +0000 (UTC) From: Toomas Soome Mime-Version: 1.0 (1.0) Subject: Re: git: 0c839497c174 - stable/13 - loader.efi: There are systems without ConOut, also use ConOutDev Date: Fri, 5 Feb 2021 08:38:39 +0200 Message-Id: References: Cc: Toomas Soome , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org In-Reply-To: To: Warner Losh X-Mailer: iPhone Mail (18D52) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.737 definitions=2021-02-05_04:2021-02-05, 2021-02-05 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2006250000 definitions=main-2102050043 X-Rspamd-Queue-Id: 4DX5NN0H7Wz4Z8N X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 06:38:44 -0000 > On 5. Feb 2021, at 01:56, Warner Losh wrote: >=20 > =EF=BB=BF > And why the instaMFC? Changes are supposed to cook force days before mergi= ng... I have questions about the wisdom of this change... >=20 > Warner=20 >=20 Reason is in PR. There is someone with the system without ConOut but ConOutD= ev is set. Instead of falling back to arbitrary device (which in this case w= as totally wrong choice), we can try the possible devices list. We do not ch= ange the ConOut parsing. If it would appear, there are systems with unusable devices listed in ConOut= Dev, then we need to think how to handle such case. Thanks, Toomas >> On Thu, Feb 4, 2021, 2:34 PM Toomas Soome wrote: >> The branch stable/13 has been updated by tsoome: >>=20 >> URL: https://cgit.FreeBSD.org/src/commit/?id=3D0c839497c174e961fc71f7d332= 9d05b10ec5525b >>=20 >> commit 0c839497c174e961fc71f7d3329d05b10ec5525b >> Author: Toomas Soome >> AuthorDate: 2021-02-04 20:49:02 +0000 >> Commit: Toomas Soome >> CommitDate: 2021-02-04 21:33:15 +0000 >>=20 >> loader.efi: There are systems without ConOut, also use ConOutDev >>=20 >> Conout does contian the default output device name. >> ConOutDev does contain all possible output device names, so we can >> use it as fallback, when there is no ConOut. >>=20 >> PR: 253253 >>=20 >> (cherry picked from commit 2bd4ff2d8911009283e4e615ca4aad35a845f48b) >> --- >> stand/efi/loader/main.c | 2 ++ >> 1 file changed, 2 insertions(+) >>=20 >> diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c >> index ca41cd4a2610..32b278950745 100644 >> --- a/stand/efi/loader/main.c >> +++ b/stand/efi/loader/main.c >> @@ -735,6 +735,8 @@ parse_uefi_con_out(void) >> how =3D 0; >> sz =3D sizeof(buf); >> rv =3D efi_global_getenv("ConOut", buf, &sz); >> + if (rv !=3D EFI_SUCCESS) >> + rv =3D efi_global_getenv("ConOutDev", buf, &sz); >> if (rv !=3D EFI_SUCCESS) { >> /* If we don't have any ConOut default to serial */ >> how =3D RB_SERIAL; From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 10:19:14 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2EC12543858; Fri, 5 Feb 2021 10:19: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 4DXBGp0r93z4nMt; Fri, 5 Feb 2021 10:19:14 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0F8DB1CCEF; Fri, 5 Feb 2021 10:19:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 115AJDHW029907; Fri, 5 Feb 2021 10:19:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 115AJDam029906; Fri, 5 Feb 2021 10:19:13 GMT (envelope-from git) Date: Fri, 5 Feb 2021 10:19:13 GMT Message-Id: <202102051019.115AJDam029906@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 4e33793cf41c - stable/12 - psm(4): Always initialize Synaptics touchpad report range with defaults MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4e33793cf41c0ec6b5db68bca1451db3e3d79a91 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 10:19:14 -0000 The branch stable/12 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=4e33793cf41c0ec6b5db68bca1451db3e3d79a91 commit 4e33793cf41c0ec6b5db68bca1451db3e3d79a91 Author: Vladimir Kondratyev AuthorDate: 2020-12-22 20:44:42 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-02-05 10:15:00 +0000 psm(4): Always initialize Synaptics touchpad report range with defaults Otherwise libinput refuses to recoginize some Synaptics touchpads with "kernel bug: device has min == max on ABS_X" message in Xorg.log. PR: 251149 Reported-by: Jens Grassel Tested-by: Jens Grassel MFC-after: 2 weeks (cherry picked from commit 2ac1c1927258e649e3ca3269aea40fb4c63e2296) --- sys/dev/atkbdc/psm.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c index d15adb63acb0..f9b8b098ea87 100644 --- a/sys/dev/atkbdc/psm.c +++ b/sys/dev/atkbdc/psm.c @@ -6387,6 +6387,15 @@ enable_synaptics(struct psm_softc *sc, enum probearg arg) printf(" infoGeometry: %d\n", synhw.infoGeometry); } + /* + * Typical bezel limits. Taken from 'Synaptics + * PS/2 * TouchPad Interfacing Guide' p.3.2.3. + */ + synhw.maximumXCoord = 5472; + synhw.maximumYCoord = 4448; + synhw.minimumXCoord = 1472; + synhw.minimumYCoord = 1408; + /* Read the extended capability bits. */ if (mouse_ext_command(kbdc, SYNAPTICS_READ_CAPABILITIES) == 0) return (FALSE); @@ -6528,13 +6537,6 @@ enable_synaptics(struct psm_softc *sc, enum probearg arg) ((status[1] & 0x0f) << 1); synhw.maximumYCoord = (status[2] << 5) | ((status[1] & 0xf0) >> 3); - } else { - /* - * Typical bezel limits. Taken from 'Synaptics - * PS/2 * TouchPad Interfacing Guide' p.3.2.3. - */ - synhw.maximumXCoord = 5472; - synhw.maximumYCoord = 4448; } if (synhw.capReportsMin) { @@ -6550,13 +6552,6 @@ enable_synaptics(struct psm_softc *sc, enum probearg arg) ((status[1] & 0x0f) << 1); synhw.minimumYCoord = (status[2] << 5) | ((status[1] & 0xf0) >> 3); - } else { - /* - * Typical bezel limits. Taken from 'Synaptics - * PS/2 * TouchPad Interfacing Guide' p.3.2.3. - */ - synhw.minimumXCoord = 1472; - synhw.minimumYCoord = 1408; } /* From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 10:19:15 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F9F654366A; Fri, 5 Feb 2021 10:19: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 4DXBGq1pCtz4nFd; Fri, 5 Feb 2021 10:19:15 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 30D461D042; Fri, 5 Feb 2021 10:19:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 115AJF07029925; Fri, 5 Feb 2021 10:19:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 115AJFUd029924; Fri, 5 Feb 2021 10:19:15 GMT (envelope-from git) Date: Fri, 5 Feb 2021 10:19:15 GMT Message-Id: <202102051019.115AJFUd029924@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 4932ef733d23 - stable/12 - ukbd(4): Do not serialize evdev key events MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4932ef733d2336a7f76b753824091be6f9f1197a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 10:19:15 -0000 The branch stable/12 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=4932ef733d2336a7f76b753824091be6f9f1197a commit 4932ef733d2336a7f76b753824091be6f9f1197a Author: Vladimir Kondratyev AuthorDate: 2020-12-24 18:56:33 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-02-05 10:17:41 +0000 ukbd(4): Do not serialize evdev key events Unlike AT keyboards, HID devices are able to send all pc105 key states within a single report. Let evdev to transmit all key state changes within a single report too. Reviewed by: hselasky Obtained from: sysutils/iichid MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D27749 (cherry picked from commit 769935a4edf8a75805000900d44a66ad5d2eaabe) --- sys/dev/usb/input/ukbd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/dev/usb/input/ukbd.c b/sys/dev/usb/input/ukbd.c index e058a55cc661..cf1c11069ffc 100644 --- a/sys/dev/usb/input/ukbd.c +++ b/sys/dev/usb/input/ukbd.c @@ -389,11 +389,9 @@ ukbd_put_key(struct ukbd_softc *sc, uint32_t key) (key & KEY_RELEASE) ? "released" : "pressed"); #ifdef EVDEV_SUPPORT - if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD && sc->sc_evdev != NULL) { + if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD && sc->sc_evdev != NULL) evdev_push_event(sc->sc_evdev, EV_KEY, evdev_hid2key(KEY_INDEX(key)), !(key & KEY_RELEASE)); - evdev_sync(sc->sc_evdev); - } #endif if (sc->sc_inputs < UKBD_IN_BUF_SIZE) { @@ -560,6 +558,11 @@ ukbd_interrupt(struct ukbd_softc *sc) } } +#ifdef EVDEV_SUPPORT + if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD && sc->sc_evdev != NULL) + evdev_sync(sc->sc_evdev); +#endif + /* wakeup keyboard system */ ukbd_event_keyinput(sc); } From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 10:19:18 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B44095435F9; Fri, 5 Feb 2021 10:19: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 4DXBGs1MJGz4ndx; Fri, 5 Feb 2021 10:19:17 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8246D1CCF0; Fri, 5 Feb 2021 10:19:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 115AJGOh029948; Fri, 5 Feb 2021 10:19:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 115AJGBr029947; Fri, 5 Feb 2021 10:19:16 GMT (envelope-from git) Date: Fri, 5 Feb 2021 10:19:16 GMT Message-Id: <202102051019.115AJGBr029947@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: e8eded55f237 - stable/12 - ukbd(4): Push LED events in ioctl handler rather than in xfer callback MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e8eded55f2372406e872282914a48adcba5dfeef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 10:19:20 -0000 The branch stable/12 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=e8eded55f2372406e872282914a48adcba5dfeef commit e8eded55f2372406e872282914a48adcba5dfeef Author: Vladimir Kondratyev AuthorDate: 2020-12-24 19:08:04 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-02-05 10:17:52 +0000 ukbd(4): Push LED events in ioctl handler rather than in xfer callback If LED state is set through evdev interface, than asynchronous nature of USB transfer callback can lead to change of order of events echoed back to userland as it causes LED events to be echoed with some lag. Fix that with echoing of LED events synchronously in ioctl handler. Reviewed by: hselasky Obtained from: sysutils/iichid MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D27750 (cherry picked from commit 30f34a519372ebce29c4439d0e6a7bc8c2df0566) --- sys/dev/usb/input/ukbd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/dev/usb/input/ukbd.c b/sys/dev/usb/input/ukbd.c index cf1c11069ffc..e438a1521f97 100644 --- a/sys/dev/usb/input/ukbd.c +++ b/sys/dev/usb/input/ukbd.c @@ -846,11 +846,6 @@ ukbd_set_leds_callback(struct usb_xfer *xfer, usb_error_t error) if (!any) break; -#ifdef EVDEV_SUPPORT - if (sc->sc_evdev != NULL) - evdev_push_leds(sc->sc_evdev, sc->sc_leds); -#endif - /* range check output report length */ len = sc->sc_led_size; if (len > (UKBD_BUFFER_SIZE - 1)) @@ -1978,6 +1973,11 @@ ukbd_set_leds(struct ukbd_softc *sc, uint8_t leds) UKBD_LOCK_ASSERT(); DPRINTF("leds=0x%02x\n", leds); +#ifdef EVDEV_SUPPORT + if (sc->sc_evdev != NULL) + evdev_push_leds(sc->sc_evdev, leds); +#endif + sc->sc_leds = leds; sc->sc_flags |= UKBD_FLAG_SET_LEDS; From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 16:40:15 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A8EAA54BF58; Fri, 5 Feb 2021 16:40: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 4DXLkR4NHCz3jjP; Fri, 5 Feb 2021 16:40:15 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8913921F61; Fri, 5 Feb 2021 16:40:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 115GeFk2029023; Fri, 5 Feb 2021 16:40:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 115GeFdP029017; Fri, 5 Feb 2021 16:40:15 GMT (envelope-from git) Date: Fri, 5 Feb 2021 16:40:15 GMT Message-Id: <202102051640.115GeFdP029017@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: 3c6a89748a01 - stable/13 - param.h: fix __FreeBSD_version convention MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3c6a89748a01869c18955d5e3bfcdf35f6705d26 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 16:40:15 -0000 The branch stable/13 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=3c6a89748a01869c18955d5e3bfcdf35f6705d26 commit 3c6a89748a01869c18955d5e3bfcdf35f6705d26 Author: Glen Barber AuthorDate: 2021-02-05 16:38:27 +0000 Commit: Glen Barber CommitDate: 2021-02-05 16:38:27 +0000 param.h: fix __FreeBSD_version convention Note, this has the side effect of __FreeBSD_version going backwards. If this causes too many problems, I will bump it to 1301500 with a comment in the file as a reminder for 13.1. Submitted by: Ka Ho Ng Sponsored by: Rubicon Communications, LLC ("Netgate") --- 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 497832e1ba15..28a1cf981a58 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1305000 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300500 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 16:44:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 873AA54C393 for ; Fri, 5 Feb 2021 16:44:56 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qv1-xf33.google.com (mail-qv1-xf33.google.com [IPv6:2607:f8b0:4864:20::f33]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DXLqq5ZtRz3knR for ; Fri, 5 Feb 2021 16:44:55 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qv1-xf33.google.com with SMTP id a1so3707187qvd.13 for ; Fri, 05 Feb 2021 08:44:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fMmUFIIiiUyxZLeFcAIKiNQmlWZuvXNzqd7lqK7ZSn0=; b=of1s0PTuBf3VrEHi0hdc94GjXYQ17xyOAoTt/z3wFX889QegY1K17OC9G0FiDaR0cO 92LqO+v5VBEX5cig9hFeLVGaT3ia4v1FMVIGNdGw0fTe5kvRr/307hep7cNb9uGRvJC5 YJDA3Q8fT7FnC+Cu5lithUDoVUT7Ckv0LD0f+gT8J2FPeADbodnjFv1rXSHRpvYrE/kd sjy0BWTrk/W3M3KHrURbYHDtOgtrrs6gK4ml4eTx9P3tWVBhXmrtlbAPS+ity8OGXec9 jbFfB0RJef0ois+zySqjUyqHKlM3Pv0nQY8WGMM+CjFZcGJ+Eoy328L9VKhghErEm2AQ Nk9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fMmUFIIiiUyxZLeFcAIKiNQmlWZuvXNzqd7lqK7ZSn0=; b=eEgddXmOhfr4cKa+Y55HFJyBNKsMdZ/J8fnmotSq+GFmMgrv/Dgb5ozj3JRSbdZY9T Hdhf771L/NCJICT5aCCXxpAbz+X+xngCUU9qFyBwYJFRhbOd2PzDqKSIC/Hw/yRhfeUJ iIC1OjYXYQtfUIWB6EXFaSNmPUfvIE/iWwilZn0yNN2oE2CR6J3GBGBadsqaFYVqJ06U rcvCjmjDBLxRWkMHA2wFENCvuqYNSFCOYVCJ9C0AhF380MYSaz1Oh4TfvQhnkuDqj73T jBQqXFPjG2ERaybLQt6bU4Z66ggFARifoKMyHOlEyPXCUigPx8MBX6rPbpSuwGrgsuMo pADg== X-Gm-Message-State: AOAM532EGNoz0VqvQIyaiJMRWrlPm+OhNGDYxek6MPWM115/8kMiKoD+ /t0czDZgxltQe+/haLJiwZQaKIkynMTksdyyuiYm3A== X-Google-Smtp-Source: ABdhPJw2kUseLNjyPrJTBvdBz8h4bQ5UDgeFYY6bX0JImwWyiOG0YBAEcbKnyqRoXDz6vKMauxvpVJveAFCHNfdn6vU= X-Received: by 2002:ad4:576a:: with SMTP id r10mr5029232qvx.29.1612543493274; Fri, 05 Feb 2021 08:44:53 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Warner Losh Date: Fri, 5 Feb 2021 09:44:42 -0700 Message-ID: Subject: Re: git: 0c839497c174 - stable/13 - loader.efi: There are systems without ConOut, also use ConOutDev To: Toomas Soome Cc: Toomas Soome , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org X-Rspamd-Queue-Id: 4DXLqq5ZtRz3knR X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=of1s0PTu; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::f33) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.00 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-branches@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::f33:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::f33:from]; R_SPF_NA(0.00)[no SPF record]; FREEMAIL_TO(0.00)[me.com]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::f33:from]; RCVD_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; MAILMAN_DEST(0.00)[dev-commits-src-branches] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 16:44:56 -0000 On Thu, Feb 4, 2021 at 11:38 PM Toomas Soome wrote: > > > On 5. Feb 2021, at 01:56, Warner Losh wrote: > > =EF=BB=BF > And why the instaMFC? Changes are supposed to cook force days before > merging... I have questions about the wisdom of this change... > > Warner > > > Reason is in PR. There is someone with the system without ConOut but > ConOutDev is set. Instead of falling back to arbitrary device (which in > this case was totally wrong choice), we can try the possible devices list= . > We do not change the ConOut parsing. > We could have the same effect defaulting to Video. This bug should have been discussed / reviewed before it was committed. If it would appear, there are systems with unusable devices listed in > ConOutDev, then we need to think how to handle such case. > Yes. We fall back to the arbitrary device... It's just a flag that can be overridden. We can easily fall back to video too. Please seek more review is the point I'd hoped to make in the private email. This could easily have been reviewed. There was no urgent rush that required it to go in w/o review or even discussion. However, you didn't answer my question: Why the instant MFC? There's a 3 day minimum for changes in head... And there's nothing so urgent that requires a short-circuit. Warner > Thanks, > Toomas > > On Thu, Feb 4, 2021, 2:34 PM Toomas Soome wrote: > >> The branch stable/13 has been updated by tsoome: >> >> URL: >> https://cgit.FreeBSD.org/src/commit/?id=3D0c839497c174e961fc71f7d3329d05= b10ec5525b >> >> commit 0c839497c174e961fc71f7d3329d05b10ec5525b >> Author: Toomas Soome >> AuthorDate: 2021-02-04 20:49:02 +0000 >> Commit: Toomas Soome >> CommitDate: 2021-02-04 21:33:15 +0000 >> >> loader.efi: There are systems without ConOut, also use ConOutDev >> >> Conout does contian the default output device name. >> ConOutDev does contain all possible output device names, so we can >> use it as fallback, when there is no ConOut. >> >> PR: 253253 >> >> (cherry picked from commit 2bd4ff2d8911009283e4e615ca4aad35a845f48b) >> --- >> stand/efi/loader/main.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c >> index ca41cd4a2610..32b278950745 100644 >> --- a/stand/efi/loader/main.c >> +++ b/stand/efi/loader/main.c >> @@ -735,6 +735,8 @@ parse_uefi_con_out(void) >> how =3D 0; >> sz =3D sizeof(buf); >> rv =3D efi_global_getenv("ConOut", buf, &sz); >> + if (rv !=3D EFI_SUCCESS) >> + rv =3D efi_global_getenv("ConOutDev", buf, &sz); >> if (rv !=3D EFI_SUCCESS) { >> /* If we don't have any ConOut default to serial */ >> how =3D RB_SERIAL; >> > From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 16:52:34 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5501754C3E1; Fri, 5 Feb 2021 16:52: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 4DXM0f1vvsz3lYK; Fri, 5 Feb 2021 16:52:34 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 346ED21CCB; Fri, 5 Feb 2021 16:52:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 115GqY8D049750; Fri, 5 Feb 2021 16:52:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 115GqYVS049749; Fri, 5 Feb 2021 16:52:34 GMT (envelope-from git) Date: Fri, 5 Feb 2021 16:52:34 GMT Message-Id: <202102051652.115GqYVS049749@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alfredo Dal'Ava Junior" Subject: git: 6bf9668d9d02 - stable/13 - mrsas: unbreak i386 build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alfredo X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6bf9668d9d02bdf3e0dafc4ba1010ef6a9b12247 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 16:52:34 -0000 The branch stable/13 has been updated by alfredo: URL: https://cgit.FreeBSD.org/src/commit/?id=6bf9668d9d02bdf3e0dafc4ba1010ef6a9b12247 commit 6bf9668d9d02bdf3e0dafc4ba1010ef6a9b12247 Author: Alfredo Dal'Ava Junior AuthorDate: 2021-02-05 18:43:48 +0000 Commit: Alfredo Dal'Ava Junior CommitDate: 2021-02-05 19:50:21 +0000 mrsas: unbreak i386 build Fix build regression introduced by e34a057ca6ebdf8e30ec8b0dc21d18eb450bf36a Reviewed by: jhibbits Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D28494 (cherry picked from commit 59fffbcf46ba6369420e655ff9173571410c643d) --- sys/dev/mrsas/mrsas.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/dev/mrsas/mrsas.c b/sys/dev/mrsas/mrsas.c index f4c34e237fc4..01173387c8d4 100644 --- a/sys/dev/mrsas/mrsas.c +++ b/sys/dev/mrsas/mrsas.c @@ -2782,9 +2782,7 @@ mrsas_ioc_init(struct mrsas_softc *sc) init_frame->queue_info_new_phys_addr_lo = htole32(phys_addr); init_frame->data_xfer_len = htole32(sizeof(Mpi2IOCInitRequest_t)); - req_desc.addr.u.low = htole32((bus_addr_t)sc->ioc_init_phys_mem & 0xFFFFFFFF); - req_desc.addr.u.high = htole32((bus_addr_t)sc->ioc_init_phys_mem >> 32); - + req_desc.addr.Words = htole64((bus_addr_t)sc->ioc_init_phys_mem); req_desc.MFAIo.RequestFlags = (MRSAS_REQ_DESCRIPT_FLAGS_MFA << MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 16:56:02 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D12B54C7B4; Fri, 5 Feb 2021 16:56:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DXM4d5wx9z3ljc; Fri, 5 Feb 2021 16:56:01 +0000 (UTC) (envelope-from avg@FreeBSD.org) X-Originating-IP: 195.64.148.76 Received: from [192.168.0.88] (unknown [195.64.148.76]) (Authenticated sender: andriy.gapon@uabsd.com) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id E4D4DC0012; Fri, 5 Feb 2021 16:55:58 +0000 (UTC) Subject: Re: git: 6bf9668d9d02 - stable/13 - mrsas: unbreak i386 build To: Alfredo Dal'Ava Junior , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org References: <202102051652.115GqYVS049749@gitrepo.freebsd.org> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; keydata= mDMEX1iFDhYJKwYBBAHaRw8BAQdAiu8JG/oLFkVkOAJqJc7Dx5KI/Q6C3SBI20EQm+DXnAu0 HkFuZHJpeSBHYXBvbiA8YXZnQEZyZWVCU0Qub3JnPoiWBBMWCAA+FiEEyCHHZM09l0OE3Ir/ 1A1+Gq8+L1EFAl9YhQ4CGwMFCQeEzgAFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AACgkQ1A1+ Gq8+L1Fc0wD/ZjmhHfbCJywZU3aOxXIPjcz73FYEGMvqMCCLAWyLbSABALFL+1ZNrjV3BGjq 889cOYFuboA/Yn3eWezS+tfqYBsGuDgEX1iFDhIKKwYBBAGXVQEFAQEHQL6B20Xi600TrkpG P9fWjl7JtHNxqrHKhX6Kg7kgb4ILAwEIB4h+BBgWCAAmFiEEyCHHZM09l0OE3Ir/1A1+Gq8+ L1EFAl9YhQ4CGwwFCQeEzgAACgkQ1A1+Gq8+L1F3cgEAktp4h+IJUJxL1vn6zMOt//znni/J TanKfQuA8wGXcGkBAKpZJhqMkg+pKk7MGvJhgJ6nCpTZ+rMK6vZVZLUWc3QF Message-ID: <9f35a234-4c6f-7c86-523f-824dc52656aa@FreeBSD.org> Date: Fri, 5 Feb 2021 18:55:57 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Firefox/60.0 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <202102051652.115GqYVS049749@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DXM4d5wx9z3ljc X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 16:56:02 -0000 On 05/02/2021 18:52, Alfredo Dal'Ava Junior wrote: > The branch stable/13 has been updated by alfredo: > > URL: https://cgit.FreeBSD.org/src/commit/?id=6bf9668d9d02bdf3e0dafc4ba1010ef6a9b12247 > > commit 6bf9668d9d02bdf3e0dafc4ba1010ef6a9b12247 > Author: Alfredo Dal'Ava Junior > AuthorDate: 2021-02-05 18:43:48 +0000 > Commit: Alfredo Dal'Ava Junior > CommitDate: 2021-02-05 19:50:21 +0000 > > mrsas: unbreak i386 build > > Fix build regression introduced by > e34a057ca6ebdf8e30ec8b0dc21d18eb450bf36a > > Reviewed by: jhibbits Was it? I do not see an approval in the review request. > Sponsored by: Eldorado Research Institute (eldorado.org.br) > Differential Revision: https://reviews.freebsd.org/D28494 > > (cherry picked from commit 59fffbcf46ba6369420e655ff9173571410c643d) Why the insta-MFC _again_? Especially while there is still a discussion in the review request. > sys/dev/mrsas/mrsas.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/sys/dev/mrsas/mrsas.c b/sys/dev/mrsas/mrsas.c > index f4c34e237fc4..01173387c8d4 100644 > --- a/sys/dev/mrsas/mrsas.c > +++ b/sys/dev/mrsas/mrsas.c > @@ -2782,9 +2782,7 @@ mrsas_ioc_init(struct mrsas_softc *sc) > init_frame->queue_info_new_phys_addr_lo = htole32(phys_addr); > init_frame->data_xfer_len = htole32(sizeof(Mpi2IOCInitRequest_t)); > > - req_desc.addr.u.low = htole32((bus_addr_t)sc->ioc_init_phys_mem & 0xFFFFFFFF); > - req_desc.addr.u.high = htole32((bus_addr_t)sc->ioc_init_phys_mem >> 32); > - > + req_desc.addr.Words = htole64((bus_addr_t)sc->ioc_init_phys_mem); > req_desc.MFAIo.RequestFlags = > (MRSAS_REQ_DESCRIPT_FLAGS_MFA << MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); > > -- Andriy Gapon From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 17:12:59 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B0BF454CBFA; Fri, 5 Feb 2021 17:12:59 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DXMSC3yn4z3nGk; Fri, 5 Feb 2021 17:12:59 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-io1-xd34.google.com with SMTP id n201so7815552iod.12; Fri, 05 Feb 2021 09:12:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:message-id:in-reply-to:references:subject :mime-version:content-transfer-encoding; bh=8mOdqa7kHQu3XbuZn0Eda5R7aV0IVQCQCG8vRfzSva4=; b=gC/ebv+gsV13wmVOCvJE+IVu2ichfIcoPbYDM3NNv/MSoxWVUyqsMc//poPBF8EXhc 7NUCfN15KPA9PVT3eF5J8AWdMBMiXkhj9CnCwFuHnfhjcgQBRqG5NrNcFbtpBRpHGDDk EsmyCVD4RCQThllORVE/mJ3t5NBbd37sp3XtOldnpD0EgfSEfav5jfrlhnkO2kgx7y0i nV23V7qhGXn7V5em63t3cgZMQinQ24xgPOgorbC0H5grOr+1GBVZhwJHFQpULAjn/GKG 0sjyvh01KTlfgn8ptd83qAO0DZpFz54pOVMhPU/tvT3AxMkBbIqRcsG6IFxuOVOsRB/g InKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:message-id:in-reply-to :references:subject:mime-version:content-transfer-encoding; bh=8mOdqa7kHQu3XbuZn0Eda5R7aV0IVQCQCG8vRfzSva4=; b=YL4ZI2GYs3G+spiEP2PEFrhGmf58z9VabIx7lKvvOe/G7C0JyTuRxMzbc0jtSC+zue izkf1IZrUNRb5TIXkA42Z+t7Lzrec1UK59EQB86a+vyUN58jmIn2zlM/YyU3YkCT8tuT phXVkrtmyqGVS/J4Ym+Pe4qzURQpvyxEN+TUwJ1mY08Z5QVkOQ3DOzxbPOLL/64+jy3g /O0tp/1qdS3RHvS9fnFuaNmbt0yF0jcJk5OB5hLihETiDn6hL6I4GgziaW7EZyZSkfwI lEvAPjUchJeifmNUdJ8ffNzy/DuM5cUI7XrWo9wUIBFiCAf78Vn8ADiWX6yIBSsIGAXm a7NA== X-Gm-Message-State: AOAM532kItfE4UQdkBihSc7F02nrRM5mkZW1NG9llFHeyHu3xYJs4BdS AFSa2F2bv1UmWZ+1voUitv+c5YyYu9GYaQ== X-Google-Smtp-Source: ABdhPJxazJkwoQhjV5zFfANKq+ubO9+6/bhoeDDPyzlvjqZKRWnm1fpQTaSVAhVNzw1aq3jMx4McaQ== X-Received: by 2002:a05:6638:a36:: with SMTP id 22mr6074822jao.109.1612545178156; Fri, 05 Feb 2021 09:12:58 -0800 (PST) Received: from [127.0.0.1] (173-18-9-215.client.mchsi.com. [173.18.9.215]) by smtp.gmail.com with ESMTPSA id f16sm4594967iob.16.2021.02.05.09.12.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Feb 2021 09:12:57 -0800 (PST) Date: Fri, 5 Feb 2021 17:12:50 +0000 (UTC) From: Justin Hibbits To: Andriy Gapon Cc: Alfredo Dal'Ava Junior , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Message-ID: <5066e1e2-e4ce-48c3-8015-74810e7b727c@gmail.com> In-Reply-To: <9f35a234-4c6f-7c86-523f-824dc52656aa@FreeBSD.org> References: <202102051652.115GqYVS049749@gitrepo.freebsd.org> <9f35a234-4c6f-7c86-523f-824dc52656aa@FreeBSD.org> Subject: Re: git: 6bf9668d9d02 - stable/13 - mrsas: unbreak i386 build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Correlation-ID: <5066e1e2-e4ce-48c3-8015-74810e7b727c@gmail.com> X-Rspamd-Queue-Id: 4DXMSC3yn4z3nGk X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 17:12:59 -0000 Feb 5, 2021 10:56:13 Andriy Gapon : > On 05/02/2021 18:52, Alfredo Dal'Ava Junior wrote: >> The branch stable/13 has been updated by alfredo: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=3D6bf9668d9d02bdf3e0dafc4ba= 1010ef6a9b12247 >> >> commit 6bf9668d9d02bdf3e0dafc4ba1010ef6a9b12247 >> Author:=C2=A0=C2=A0=C2=A0=C2=A0 Alfredo Dal'Ava Junior >> AuthorDate: 2021-02-05 18:43:48 +0000 >> Commit:=C2=A0=C2=A0=C2=A0=C2=A0 Alfredo Dal'Ava Junior >> CommitDate: 2021-02-05 19:50:21 +0000 >> >> =C2=A0=C2=A0=C2=A0 mrsas: unbreak i386 build >> =C2=A0=C2=A0=C2=A0 >> =C2=A0=C2=A0=C2=A0 Fix build regression introduced by >> =C2=A0=C2=A0=C2=A0 e34a057ca6ebdf8e30ec8b0dc21d18eb450bf36a >> =C2=A0=C2=A0=C2=A0 >> =C2=A0=C2=A0=C2=A0 Reviewed by:=C2=A0=C2=A0=C2=A0 jhibbits > > Was it?=C2=A0 I do not see an approval in the review request. Yes,=C2=A0 it was reviewed by me,=C2=A0 since he took exactly what I sugges= ted, and we discussed over IRC. > >> =C2=A0=C2=A0=C2=A0 Sponsored by:=C2=A0=C2=A0 Eldorado Research Institute= (eldorado.org.br) >> =C2=A0=C2=A0=C2=A0 Differential Revision:=C2=A0 https://reviews.freebsd.= org/D28494 >> =C2=A0=C2=A0=C2=A0 >> =C2=A0=C2=A0=C2=A0 (cherry picked from commit 59fffbcf46ba6369420e655ff9= 173571410c643d) > > Why the insta-MFC _again_? > Especially while there is still a discussion in the review request. Agree here, but not sure the best resolution for the breakage in this case. > >> sys/dev/mrsas/mrsas.c | 4 +--- >> 1 file changed, 1 insertion(+), 3 deletions(-) >> >> diff --git a/sys/dev/mrsas/mrsas.c b/sys/dev/mrsas/mrsas.c >> index f4c34e237fc4..01173387c8d4 100644 >> --- a/sys/dev/mrsas/mrsas.c >> +++ b/sys/dev/mrsas/mrsas.c >> @@ -2782,9 +2782,7 @@ mrsas_ioc_init(struct mrsas_softc *sc) >> =C2=A0 init_frame->queue_info_new_phys_addr_lo =3D htole32(phys_addr); >> =C2=A0 init_frame->data_xfer_len =3D htole32(sizeof(Mpi2IOCInitRequest_t= )); >> >> - req_desc.addr.u.low =3D htole32((bus_addr_t)sc->ioc_init_phys_mem & 0x= FFFFFFFF); >> - req_desc.addr.u.high =3D htole32((bus_addr_t)sc->ioc_init_phys_mem >> = 32); >> - >> + req_desc.addr.Words =3D htole64((bus_addr_t)sc->ioc_init_phys_mem); >> =C2=A0 req_desc.MFAIo.RequestFlags =3D >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (MRSAS_REQ_DESCRIPT_FLAGS_MFA << MRSAS_RE= Q_DESCRIPT_FLAGS_TYPE_SHIFT); >> >> > > > -- > Andriy Gapon - Justin From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 17:14:38 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 36D8854CCE4; Fri, 5 Feb 2021 17:14:38 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DXMV52qZJz3nMq; Fri, 5 Feb 2021 17:14:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) X-Originating-IP: 195.64.148.76 Received: from [192.168.0.88] (unknown [195.64.148.76]) (Authenticated sender: andriy.gapon@uabsd.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id DA5E420016; Fri, 5 Feb 2021 17:14:32 +0000 (UTC) Subject: Re: git: 6bf9668d9d02 - stable/13 - mrsas: unbreak i386 build To: Justin Hibbits , Alfredo Dal'Ava Junior Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org References: <202102051652.115GqYVS049749@gitrepo.freebsd.org> <9f35a234-4c6f-7c86-523f-824dc52656aa@FreeBSD.org> <5066e1e2-e4ce-48c3-8015-74810e7b727c@gmail.com> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; keydata= mDMEX1iFDhYJKwYBBAHaRw8BAQdAiu8JG/oLFkVkOAJqJc7Dx5KI/Q6C3SBI20EQm+DXnAu0 HkFuZHJpeSBHYXBvbiA8YXZnQEZyZWVCU0Qub3JnPoiWBBMWCAA+FiEEyCHHZM09l0OE3Ir/ 1A1+Gq8+L1EFAl9YhQ4CGwMFCQeEzgAFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AACgkQ1A1+ Gq8+L1Fc0wD/ZjmhHfbCJywZU3aOxXIPjcz73FYEGMvqMCCLAWyLbSABALFL+1ZNrjV3BGjq 889cOYFuboA/Yn3eWezS+tfqYBsGuDgEX1iFDhIKKwYBBAGXVQEFAQEHQL6B20Xi600TrkpG P9fWjl7JtHNxqrHKhX6Kg7kgb4ILAwEIB4h+BBgWCAAmFiEEyCHHZM09l0OE3Ir/1A1+Gq8+ L1EFAl9YhQ4CGwwFCQeEzgAACgkQ1A1+Gq8+L1F3cgEAktp4h+IJUJxL1vn6zMOt//znni/J TanKfQuA8wGXcGkBAKpZJhqMkg+pKk7MGvJhgJ6nCpTZ+rMK6vZVZLUWc3QF Message-ID: <2c848b11-ea07-8107-bf7a-5fa617fe3265@FreeBSD.org> Date: Fri, 5 Feb 2021 19:14:31 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Firefox/60.0 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <5066e1e2-e4ce-48c3-8015-74810e7b727c@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4DXMV52qZJz3nMq X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 17:14:38 -0000 On 05/02/2021 19:12, Justin Hibbits wrote: > Feb 5, 2021 10:56:13 Andriy Gapon : > >> On 05/02/2021 18:52, Alfredo Dal'Ava Junior wrote: >>> The branch stable/13 has been updated by alfredo: >>> >>> URL: https://cgit.FreeBSD.org/src/commit/?id=6bf9668d9d02bdf3e0dafc4ba1010ef6a9b12247 >>> >>> commit 6bf9668d9d02bdf3e0dafc4ba1010ef6a9b12247 >>> Author:     Alfredo Dal'Ava Junior >>> AuthorDate: 2021-02-05 18:43:48 +0000 >>> Commit:     Alfredo Dal'Ava Junior >>> CommitDate: 2021-02-05 19:50:21 +0000 >>> >>>     mrsas: unbreak i386 build >>>     >>>     Fix build regression introduced by >>>     e34a057ca6ebdf8e30ec8b0dc21d18eb450bf36a >>>     >>>     Reviewed by:    jhibbits >> Was it?  I do not see an approval in the review request. > Yes,  it was reviewed by me,  since he took exactly what I suggested, and we discussed over IRC. > My apologies then. I was confused by the fact that you commented in phabricator but accepted over IRC (which I didn't know). -- Andriy Gapon From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 17:24:42 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D727F54D4CE for ; Fri, 5 Feb 2021 17:24:42 +0000 (UTC) (envelope-from tsoome@me.com) Received: from pv50p00im-ztbu10011701.me.com (pv50p00im-ztbu10011701.me.com [17.58.6.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DXMjk4tYzz3nqr for ; Fri, 5 Feb 2021 17:24:42 +0000 (UTC) (envelope-from tsoome@me.com) Received: from nazgul.lan (148-52-235-80.sta.estpak.ee [80.235.52.148]) by pv50p00im-ztbu10011701.me.com (Postfix) with ESMTPSA id A33468A05D5; Fri, 5 Feb 2021 17:24:37 +0000 (UTC) From: Toomas Soome Message-Id: <97F5C09F-7AE3-4763-AD32-BFEA25101CE5@me.com> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: git: 0c839497c174 - stable/13 - loader.efi: There are systems without ConOut, also use ConOutDev Date: Fri, 5 Feb 2021 19:24:35 +0200 In-Reply-To: Cc: Toomas Soome , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org To: Warner Losh References: X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.737 definitions=2021-02-05_10:2021-02-05, 2021-02-05 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2006250000 definitions=main-2102050110 X-Rspamd-Queue-Id: 4DXMjk4tYzz3nqr X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 17:24:42 -0000 > On 5. Feb 2021, at 18:44, Warner Losh wrote: >=20 >=20 >=20 > On Thu, Feb 4, 2021 at 11:38 PM Toomas Soome > wrote: >=20 >=20 >> On 5. Feb 2021, at 01:56, Warner Losh > wrote: >>=20 >> =EF=BB=BF >> And why the instaMFC? Changes are supposed to cook force days before = merging... I have questions about the wisdom of this change... >>=20 >> Warner=20 >>=20 >=20 > Reason is in PR. There is someone with the system without ConOut but = ConOutDev is set. Instead of falling back to arbitrary device (which in = this case was totally wrong choice), we can try the possible devices = list. We do not change the ConOut parsing. >=20 > We could have the same effect defaulting to Video. This bug should = have been discussed / reviewed before it was committed. How is is different from defaulting to serial, it is just as bad? we can = not guess there, thats why we do have ConOutDev list. >=20 > If it would appear, there are systems with unusable devices listed in = ConOutDev, then we need to think how to handle such case. >=20 > Yes. We fall back to the arbitrary device... It's just a flag that can = be overridden. We can easily fall back to video too. We *should not* fall back on arbitrary devices when there is source for = alternate options. And that option is from specification: "The ConInDev, ConOutDev, and ErrOutDev variables each contain an = EFI_DEVICE_PATH_PROTOCOL descriptor that defines all the possible = default devices to use on boot. These variables are volatile, and are = set dynamically on every boot. ConIn, ConOut, and ErrOut are always = proper subsets of ConInDev, ConOutDev, and ErrOutDev.=E2=80=9D UEFI Spec 2.8A, Page 82. There may or may not be Video (or Serial) device listed. If not, there = are good chance we will be in trouble because the firmware internals may = not be set up properly and we can just as well end up in hung system. >=20 > Please seek more review is the point I'd hoped to make in the private = email. This could easily have been reviewed. There was no urgent rush = that required it to go in w/o review or even discussion. >=20 > However, you didn't answer my question: Why the instant MFC? There's a = 3 day minimum for changes in head... And there's nothing so urgent that = requires a short-circuit. >=20 > Warner Because the issues is reported on 13. well, I guess You are right there, = could have waited a bit more. thanks, toomas >=20 > =20 > Thanks, > Toomas >=20 >> On Thu, Feb 4, 2021, 2:34 PM Toomas Soome > wrote: >> The branch stable/13 has been updated by tsoome: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D0c839497c174e961fc71f7d3329d05b1= 0ec5525b = >>=20 >> commit 0c839497c174e961fc71f7d3329d05b10ec5525b >> Author: Toomas Soome >> AuthorDate: 2021-02-04 20:49:02 +0000 >> Commit: Toomas Soome >> CommitDate: 2021-02-04 21:33:15 +0000 >>=20 >> loader.efi: There are systems without ConOut, also use ConOutDev >>=20 >> Conout does contian the default output device name. >> ConOutDev does contain all possible output device names, so we = can >> use it as fallback, when there is no ConOut. >>=20 >> PR: 253253 >>=20 >> (cherry picked from commit = 2bd4ff2d8911009283e4e615ca4aad35a845f48b) >> --- >> stand/efi/loader/main.c | 2 ++ >> 1 file changed, 2 insertions(+) >>=20 >> diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c >> index ca41cd4a2610..32b278950745 100644 >> --- a/stand/efi/loader/main.c >> +++ b/stand/efi/loader/main.c >> @@ -735,6 +735,8 @@ parse_uefi_con_out(void) >> how =3D 0; >> sz =3D sizeof(buf); >> rv =3D efi_global_getenv("ConOut", buf, &sz); >> + if (rv !=3D EFI_SUCCESS) >> + rv =3D efi_global_getenv("ConOutDev", buf, &sz); >> if (rv !=3D EFI_SUCCESS) { >> /* If we don't have any ConOut default to serial */ >> how =3D RB_SERIAL; From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 17:24:58 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3EC3F54D460; Fri, 5 Feb 2021 17:24:58 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DXMk212gfz3pCs; Fri, 5 Feb 2021 17:24:57 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-io1-xd2d.google.com with SMTP id s24so7911173iob.6; Fri, 05 Feb 2021 09:24:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:message-id:in-reply-to:references:subject :mime-version:content-transfer-encoding; bh=YXUQ8fCAtlUWut/gGqMSZzYn1GOP6xiHeTMGTn7JSx8=; b=C+FxP5Om84F7xm6yM7I6YUL+MBe5suJyNY47nHAu9O2F8M60lIxR2zlOpDCwS2AZwe aK3xyXgTjEFxyBc0FpcNDjxCBRxZeNUR5Ii7b3uy/4pNeONNs9V7tbkUJ9bMb3Tn6NXV LVYARllYlbMfiBz/yRGpCPe3IQdZk/L8Owzl5itgT1xu16Mvpjzq7lu82xCzWDIWda8u jYEFHjW27Uhn8aTmn72/TvTnFdcbH5TsYIWhUsCHIS5WMNYRHAt3HvWGCjBXshCA07ub tcOC34fsibwVbhRRb+M4X/aU3nSi9bfrDFhYlwO31zvxSMn2jtQI0GmM7Gwt8gj/fWSc i+eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:message-id:in-reply-to :references:subject:mime-version:content-transfer-encoding; bh=YXUQ8fCAtlUWut/gGqMSZzYn1GOP6xiHeTMGTn7JSx8=; b=VfXaN5wgS6/AH1othaH2I8DTTsErQUz3quC/iFPZNQPFBcyQHTiXPsolRh7/4E0f2e /T1UqaQu1hoDP4cAzjwsDRAfeBwtfwexW+uzC0R7ivT5GryghdgAt1bBr9XoRuuMZ2bQ CyjoYwR9qmDhOHDwivvLF2pWRPrYDcPVqrQweEL45sfVdMEld5ErznOh0OUoKBt/1kZV ls6c8a6ey9Ac0nxAXeaBeGSYCypOiliFkhxHMyNB8IGeGv+cJ3XIhN5ay4KVXhOMq51E DTT5f31re1iXnLssDa7cQ5Tam6oJMxQBVyAEkLGAfbS8vEky4/gnwFCwFCRV4appDP01 eYEA== X-Gm-Message-State: AOAM530IPZcbTxX6DSVbd/e3p+UoK4GKjfCM+1be41Yy8e4fJiYcT4Xq csSRX4Clh85zjrMA+S/CYS0GPi+MCDVc6w== X-Google-Smtp-Source: ABdhPJxXPJNCRNRrxNEKxavKyKsiPgoH3pQNgfRN0PCh69lXwmdTuK2Zw0LqihXkMJwn86lkJkjN4A== X-Received: by 2002:a5d:9413:: with SMTP id v19mr4788516ion.46.1612545896798; Fri, 05 Feb 2021 09:24:56 -0800 (PST) Received: from [127.0.0.1] (173-18-9-215.client.mchsi.com. [173.18.9.215]) by smtp.gmail.com with ESMTPSA id k3sm4758273ioq.22.2021.02.05.09.24.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Feb 2021 09:24:56 -0800 (PST) Date: Fri, 5 Feb 2021 17:24:55 +0000 (UTC) From: Justin Hibbits To: Andriy Gapon Cc: Alfredo Dal'Ava Junior , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Message-ID: In-Reply-To: <2c848b11-ea07-8107-bf7a-5fa617fe3265@FreeBSD.org> References: <202102051652.115GqYVS049749@gitrepo.freebsd.org> <9f35a234-4c6f-7c86-523f-824dc52656aa@FreeBSD.org> <5066e1e2-e4ce-48c3-8015-74810e7b727c@gmail.com> <2c848b11-ea07-8107-bf7a-5fa617fe3265@FreeBSD.org> Subject: Re: git: 6bf9668d9d02 - stable/13 - mrsas: unbreak i386 build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Correlation-ID: X-Rspamd-Queue-Id: 4DXMk212gfz3pCs X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 17:24:58 -0000 Feb 5, 2021 11:14:34 Andriy Gapon : > On 05/02/2021 19:12, Justin Hibbits wrote: >> Feb 5, 2021 10:56:13 Andriy Gapon : >> >>> On 05/02/2021 18:52, Alfredo Dal'Ava Junior wrote: >>>> The branch stable/13 has been updated by alfredo: >>>> >>>> URL: https://cgit.FreeBSD.org/src/commit/?id=3D6bf9668d9d02bdf3e0dafc4= ba1010ef6a9b12247 >>>> >>>> commit 6bf9668d9d02bdf3e0dafc4ba1010ef6a9b12247 >>>> Author:=C2=A0=C2=A0=C2=A0=C2=A0 Alfredo Dal'Ava Junior >>>> AuthorDate: 2021-02-05 18:43:48 +0000 >>>> Commit:=C2=A0=C2=A0=C2=A0=C2=A0 Alfredo Dal'Ava Junior >>>> CommitDate: 2021-02-05 19:50:21 +0000 >>>> >>>> =C2=A0=C2=A0=C2=A0 mrsas: unbreak i386 build >>>> =C2=A0=C2=A0=C2=A0 >>>> =C2=A0=C2=A0=C2=A0 Fix build regression introduced by >>>> =C2=A0=C2=A0=C2=A0 e34a057ca6ebdf8e30ec8b0dc21d18eb450bf36a >>>> =C2=A0=C2=A0=C2=A0 >>>> =C2=A0=C2=A0=C2=A0 Reviewed by:=C2=A0=C2=A0=C2=A0 jhibbits >>> Was it?=C2=A0 I do not see an approval in the review request. >> Yes,=C2=A0 it was reviewed by me,=C2=A0 since he took exactly what I sug= gested, and we discussed over IRC. >> > > My apologies then. > I was confused by the fact that you commented in phabricator but accepted= over > IRC (which I didn't know). > > -- > Andriy Gapon Fully understandable,=C2=A0 especially given the timing of the review to co= mmit,=C2=A0 and in relation to the release process going on. - Justin From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 19:44:11 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD3705286A9 for ; Fri, 5 Feb 2021 19:44:11 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DXQpf61Sgz4Rd9 for ; Fri, 5 Feb 2021 19:44:10 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72d.google.com with SMTP id a7so8064567qkb.13 for ; Fri, 05 Feb 2021 11:44:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CXdXexmwjSVSsGxsH8Sl8jXqJi9f4fMaUazAdgHRWrk=; b=WFVyXTOLGxpUJ43KSqUmYcZ2Fk26aJLPRjrWgqPtmeWm6ne1ldKkg6bhNDXQKvmTtS 6wZkGR6pJpvS1ebIbWaYgq9hy53DFr9CWFrp+6l/izAuy2cG3wKtyFv30dVQ9lnyxB0M ZZwx2CjzWhmJIKHHftV0XpV1zK3D6/dSQ46SzF64rHloR9Xz1t3oOdyvekihJLtDXuSN 7noCk6hFibvZ4SPwr0k/ocnTSkVAmDaC1nGwmDBQgYAeBWfwcL+1EFGEYZYumjurwCQV mn8veMV3FXo8jLgBesaH3lNkqgmANvHf8t5pLahXabHkDyE71gIPck8T08aKkFbvgUm4 oNzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CXdXexmwjSVSsGxsH8Sl8jXqJi9f4fMaUazAdgHRWrk=; b=pZLPdyIdd+fWVMuSpY92tTkPEMWnKaDa7UZs6ZiJ+QGtQnd34CXrFqlAQDqPhoyL9z EfjWSriRNdAPe3BUABpYjDOevwjjSOCsSQVChMOZ1fmZRWF/87XkjlnhEpk91TVmSylR H8pI32wuXuH5z0hi9iHs9Ej7GkRXEbF5BnEtmgSA3nq945XMcCn0eV0ERacG8skN4SOC NKBLgnE3tCheJW2yV40DynYXkWI+PLNprUkmHh1YE6aQrZmEzITgNefK1T5SbPcfc1Ev tf9b1C4TjQg8ZCn8zoeidWWSVryhQxc1+7T+4SVbmTaKA6/YqwIGNe2l68xF9o0C0jEg uLFg== X-Gm-Message-State: AOAM531j3AUnEkLttZD+FkWZQ+IRHeYieKclv7+38tUeNAtkv+TDU5Jg pdhFcrxYXe5zRO48C935nyNllOyht6ClC7y6eYtp6w== X-Google-Smtp-Source: ABdhPJzQRLpmj7Rvr85T+kJaihERtYVIvhOJ/+ZxGm/h2cFKC29ONLlfItUijPW020dIIKjXVSqc1LQVnnYnRD0Qz9Q= X-Received: by 2002:a37:a34f:: with SMTP id m76mr5862632qke.89.1612554249518; Fri, 05 Feb 2021 11:44:09 -0800 (PST) MIME-Version: 1.0 References: <97F5C09F-7AE3-4763-AD32-BFEA25101CE5@me.com> In-Reply-To: <97F5C09F-7AE3-4763-AD32-BFEA25101CE5@me.com> From: Warner Losh Date: Fri, 5 Feb 2021 12:43:58 -0700 Message-ID: Subject: Re: git: 0c839497c174 - stable/13 - loader.efi: There are systems without ConOut, also use ConOutDev To: Toomas Soome Cc: Toomas Soome , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org X-Rspamd-Queue-Id: 4DXQpf61Sgz4Rd9 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=WFVyXTOL; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72d) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.00 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-branches@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::72d:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::72d:from]; R_SPF_NA(0.00)[no SPF record]; FREEMAIL_TO(0.00)[me.com]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::72d:from]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; MAILMAN_DEST(0.00)[dev-commits-src-branches]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 19:44:11 -0000 On Fri, Feb 5, 2021 at 10:24 AM Toomas Soome wrote: > > > On 5. Feb 2021, at 18:44, Warner Losh wrote: > > > > On Thu, Feb 4, 2021 at 11:38 PM Toomas Soome wrote: > >> >> >> On 5. Feb 2021, at 01:56, Warner Losh wrote: >> >> =EF=BB=BF >> And why the instaMFC? Changes are supposed to cook force days before >> merging... I have questions about the wisdom of this change... >> >> Warner >> >> >> Reason is in PR. There is someone with the system without ConOut but >> ConOutDev is set. Instead of falling back to arbitrary device (which in >> this case was totally wrong choice), we can try the possible devices lis= t. >> We do not change the ConOut parsing. >> > > We could have the same effect defaulting to Video. This bug should have > been discussed / reviewed before it was committed. > > > How is is different from defaulting to serial, it is just as bad? we can > not guess there, thats why we do have ConOutDev list. > > > > If it would appear, there are systems with unusable devices listed in >> ConOutDev, then we need to think how to handle such case. >> > > Yes. We fall back to the arbitrary device... It's just a flag that can be > overridden. We can easily fall back to video too. > > > We *should not* fall back on arbitrary devices when there is source for > alternate options. And that option is from specification: > > "The ConInDev, ConOutDev, and ErrOutDev variables each contain an EFI_DEV= ICE_PATH_PROTOCOL > descriptor that defines all the possible default devices to use on boot. > These variables are volatile, and are set dynamically on every boot. ConI= n, > ConOut, and ErrOut are always proper subsets of ConInDev, ConOutDev, and > ErrOutDev.*=E2=80=9D* > Right. Except they aren't a proper subset in this case. Since they aren't a proper subset, can you count on them having any meaningful meaning? In the cases you found they do, but it's just as arbitrary. > UEFI Spec 2.8A, Page 82. > > There may or may not be Video (or Serial) device listed. If not, there ar= e > good chance we will be in trouble because the firmware internals may not = be > set up properly and we can just as well end up in hung system. > For x86, there's almost always Video. For !x86 it gets more troublesome. The kernel shouldn't hang when we give it the wrong console because if the device isn't there, it won't cninit won't work. > Please seek more review is the point I'd hoped to make in the private > email. This could easily have been reviewed. There was no urgent rush tha= t > required it to go in w/o review or even discussion. > > > However, you didn't answer my question: Why the instant MFC? There's a 3 > day minimum for changes in head... And there's nothing so urgent that > requires a short-circuit. > > Warner > > > > Because the issues is reported on 13. well, I guess You are right there, > could have waited a bit more. > Right. Exactly my point.... Warner > thanks, > toomas > > > > > > >> Thanks, >> Toomas >> >> On Thu, Feb 4, 2021, 2:34 PM Toomas Soome wrote: >> >>> The branch stable/13 has been updated by tsoome: >>> >>> URL: >>> https://cgit.FreeBSD.org/src/commit/?id=3D0c839497c174e961fc71f7d3329d0= 5b10ec5525b >>> >>> >>> commit 0c839497c174e961fc71f7d3329d05b10ec5525b >>> Author: Toomas Soome >>> AuthorDate: 2021-02-04 20:49:02 +0000 >>> Commit: Toomas Soome >>> CommitDate: 2021-02-04 21:33:15 +0000 >>> >>> loader.efi: There are systems without ConOut, also use ConOutDev >>> >>> Conout does contian the default output device name. >>> ConOutDev does contain all possible output device names, so we can >>> use it as fallback, when there is no ConOut. >>> >>> PR: 253253 >>> >>> (cherry picked from commit 2bd4ff2d8911009283e4e615ca4aad35a845f48b= ) >>> --- >>> stand/efi/loader/main.c | 2 ++ >>> 1 file changed, 2 insertions(+) >>> >>> diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c >>> index ca41cd4a2610..32b278950745 100644 >>> --- a/stand/efi/loader/main.c >>> +++ b/stand/efi/loader/main.c >>> @@ -735,6 +735,8 @@ parse_uefi_con_out(void) >>> how =3D 0; >>> sz =3D sizeof(buf); >>> rv =3D efi_global_getenv("ConOut", buf, &sz); >>> + if (rv !=3D EFI_SUCCESS) >>> + rv =3D efi_global_getenv("ConOutDev", buf, &sz); >>> if (rv !=3D EFI_SUCCESS) { >>> /* If we don't have any ConOut default to serial */ >>> how =3D RB_SERIAL; >> >> > From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 20:09:24 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5AAC7528EA9 for ; Fri, 5 Feb 2021 20:09:24 +0000 (UTC) (envelope-from tsoome@me.com) Received: from pv50p00im-tydg10011801.me.com (pv50p00im-tydg10011801.me.com [17.58.6.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DXRMm1LxKz4TJB for ; Fri, 5 Feb 2021 20:09:23 +0000 (UTC) (envelope-from tsoome@me.com) Received: from nazgul.lan (148-52-235-80.sta.estpak.ee [80.235.52.148]) by pv50p00im-tydg10011801.me.com (Postfix) with ESMTPSA id CA7C5660531; Fri, 5 Feb 2021 20:09:19 +0000 (UTC) From: Toomas Soome Message-Id: <014891C8-7B1F-4908-9495-2ED1A5FAABCF@me.com> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: git: 0c839497c174 - stable/13 - loader.efi: There are systems without ConOut, also use ConOutDev Date: Fri, 5 Feb 2021 22:09:16 +0200 In-Reply-To: Cc: Toomas Soome , src-committers , "" , dev-commits-src-branches@freebsd.org To: Warner Losh References: <97F5C09F-7AE3-4763-AD32-BFEA25101CE5@me.com> X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.737 definitions=2021-02-05_11:2021-02-05, 2021-02-05 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2006250000 definitions=main-2102050125 X-Rspamd-Queue-Id: 4DXRMm1LxKz4TJB X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 20:09:24 -0000 > On 5. Feb 2021, at 21:43, Warner Losh wrote: >=20 >=20 >=20 > On Fri, Feb 5, 2021 at 10:24 AM Toomas Soome > wrote: >=20 >=20 >> On 5. Feb 2021, at 18:44, Warner Losh > wrote: >>=20 >>=20 >>=20 >> On Thu, Feb 4, 2021 at 11:38 PM Toomas Soome > wrote: >>=20 >>=20 >>> On 5. Feb 2021, at 01:56, Warner Losh > wrote: >>>=20 >>> =EF=BB=BF >>> And why the instaMFC? Changes are supposed to cook force days before = merging... I have questions about the wisdom of this change... >>>=20 >>> Warner=20 >>>=20 >>=20 >> Reason is in PR. There is someone with the system without ConOut but = ConOutDev is set. Instead of falling back to arbitrary device (which in = this case was totally wrong choice), we can try the possible devices = list. We do not change the ConOut parsing. >>=20 >> We could have the same effect defaulting to Video. This bug should = have been discussed / reviewed before it was committed. >=20 > How is is different from defaulting to serial, it is just as bad? we = can not guess there, thats why we do have ConOutDev list. >=20 >=20 >>=20 >> If it would appear, there are systems with unusable devices listed in = ConOutDev, then we need to think how to handle such case. >>=20 >> Yes. We fall back to the arbitrary device... It's just a flag that = can be overridden. We can easily fall back to video too. >=20 > We *should not* fall back on arbitrary devices when there is source = for alternate options. And that option is from specification: >=20 > "The ConInDev, ConOutDev, and ErrOutDev variables each contain an = EFI_DEVICE_PATH_PROTOCOL descriptor that defines all the possible = default devices to use on boot. These variables are volatile, and are = set dynamically on every boot. ConIn, ConOut, and ErrOut are always = proper subsets of ConInDev, ConOutDev, and ErrOutDev.=E2=80=9D >=20 > Right. Except they aren't a proper subset in this case. Since they = aren't a proper subset, can you count on them having any meaningful = meaning? In the cases you found they do, but it's just as arbitrary. Well, we can argue if empty set is or is not subset of (any) other set. = But, we do have specification. And we should not arbitrary pick what = part we are going to follow and what not. > =20 > UEFI Spec 2.8A, Page 82. >=20 > There may or may not be Video (or Serial) device listed. If not, there = are good chance we will be in trouble because the firmware internals may = not be set up properly and we can just as well end up in hung system. >=20 > For x86, there's almost always Video. For !x86 it gets more = troublesome. There is almost always ConOut as well. Except when there is not. And in = this case, there is not. I still do not get what it is we are arguing about. Do we have case = where ConOut is not set and ConOutDev does have garbage? rgds, toomas >=20 > The kernel shouldn't hang when we give it the wrong console because if = the device isn't there, it won't cninit won't work. >> Please seek more review is the point I'd hoped to make in the private = email. This could easily have been reviewed. There was no urgent rush = that required it to go in w/o review or even discussion. >>=20 >> However, you didn't answer my question: Why the instant MFC? There's = a 3 day minimum for changes in head... And there's nothing so urgent = that requires a short-circuit. >>=20 >> Warner >=20 >=20 > Because the issues is reported on 13. well, I guess You are right = there, could have waited a bit more. >=20 > Right. Exactly my point.... >=20 > Warner > =20 > thanks, > toomas >=20 >=20 >=20 >>=20 >> =20 >> Thanks, >> Toomas >>=20 >>> On Thu, Feb 4, 2021, 2:34 PM Toomas Soome > wrote: >>> The branch stable/13 has been updated by tsoome: >>>=20 >>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D0c839497c174e961fc71f7d3329d05b1= 0ec5525b = >>>=20 >>> commit 0c839497c174e961fc71f7d3329d05b10ec5525b >>> Author: Toomas Soome > >>> AuthorDate: 2021-02-04 20:49:02 +0000 >>> Commit: Toomas Soome > >>> CommitDate: 2021-02-04 21:33:15 +0000 >>>=20 >>> loader.efi: There are systems without ConOut, also use ConOutDev >>>=20 >>> Conout does contian the default output device name. >>> ConOutDev does contain all possible output device names, so we = can >>> use it as fallback, when there is no ConOut. >>>=20 >>> PR: 253253 >>>=20 >>> (cherry picked from commit = 2bd4ff2d8911009283e4e615ca4aad35a845f48b) >>> --- >>> stand/efi/loader/main.c | 2 ++ >>> 1 file changed, 2 insertions(+) >>>=20 >>> diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c >>> index ca41cd4a2610..32b278950745 100644 >>> --- a/stand/efi/loader/main.c >>> +++ b/stand/efi/loader/main.c >>> @@ -735,6 +735,8 @@ parse_uefi_con_out(void) >>> how =3D 0; >>> sz =3D sizeof(buf); >>> rv =3D efi_global_getenv("ConOut", buf, &sz); >>> + if (rv !=3D EFI_SUCCESS) >>> + rv =3D efi_global_getenv("ConOutDev", buf, &sz); >>> if (rv !=3D EFI_SUCCESS) { >>> /* If we don't have any ConOut default to serial */ >>> how =3D RB_SERIAL; From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 20:21:51 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB93A529509 for ; Fri, 5 Feb 2021 20:21:51 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qv1-xf36.google.com (mail-qv1-xf36.google.com [IPv6:2607:f8b0:4864:20::f36]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DXRf61gwfz4VLX for ; Fri, 5 Feb 2021 20:21:50 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qv1-xf36.google.com with SMTP id h21so4089304qvb.8 for ; Fri, 05 Feb 2021 12:21:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ktaCHAHoDKFDrx5XZH9UWMchOoQVyW2RernLwvgZELM=; b=q1P2KxcpGwS6L64Xr0gmxm4/r36DgqfJVw1ih2P/NM2Jom/Rsq5KQPm1IKr2Odcb4M nvCSNyOUUO2GsCQnj1G8XflGlBQffIZ8zzgsOsfrVFxHBUIlFM3ar/uGgAH9d9BgLON4 ATZuWghnKsleP3r9Utw8kNpIohly+DJMMBN6Yn7g6bO5YSUEkcN3GStir7AKWpMIueJk 9hqFAqdHeHC4mE2STU1VHTZaSFodGuDj4cJ33ZBNwYAyZq59tKsZMZFhS4vq32uXHN+J KxfZ+/xno/0c/Hy4ZP55WTTGN1N8kx3WIfWxGeiYjoK+2qTTSX6jipPjN16WWZtFAvlq 9VOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ktaCHAHoDKFDrx5XZH9UWMchOoQVyW2RernLwvgZELM=; b=unwbTzc9ez/EjZPS1Cx1csaILZDSX0QjbAXm1EFNN4v4bpyna2gDXv6AWllC4lBUag MLqbu3+NXrPtgitnUNLfRvP6ui+QK55wpl2nTa7SBjWc8fxz10nnSkfQaueUJ9pRzLlO SKWkInpxLWNE7BrZmVOX6+3JgiGW+LUZ6TFA2grQZqZupnGJvvZo+RtDyCfJPGyjYD50 zUecqjTrT3GvrIIMx68B4mAvVZmGJCRZtBK+TEooHcoS66GUpR86sWO52HCyKKGWdy/p axo+kxphcNvVsTozEiG+owfLSu9tD+IC9XvFY+Q3ua2WsLLb6ec8MzE+A57ad4/4KQoJ emCA== X-Gm-Message-State: AOAM531noLJfY8N3j9JZ9SXaSnqFnjt7R5kLBCBIj5rqnoYD4931D9Y5 wdDg9a8mTA3z6fRZo4iUYYlhMaUzgMjEQuEdqjQVQg== X-Google-Smtp-Source: ABdhPJzwhPZT50fr4LJ/RbuLv+Dywwt+/hi8dK8HrbcaNGh5SV0H5ecQ18XpwnOEodKZ74C6O0RuF+TCoBUUa7N9PSY= X-Received: by 2002:a05:6214:14e2:: with SMTP id k2mr5986069qvw.24.1612556509269; Fri, 05 Feb 2021 12:21:49 -0800 (PST) MIME-Version: 1.0 References: <97F5C09F-7AE3-4763-AD32-BFEA25101CE5@me.com> <014891C8-7B1F-4908-9495-2ED1A5FAABCF@me.com> In-Reply-To: <014891C8-7B1F-4908-9495-2ED1A5FAABCF@me.com> From: Warner Losh Date: Fri, 5 Feb 2021 13:21:38 -0700 Message-ID: Subject: Re: git: 0c839497c174 - stable/13 - loader.efi: There are systems without ConOut, also use ConOutDev To: Toomas Soome Cc: Toomas Soome , src-committers , "" , dev-commits-src-branches@freebsd.org X-Rspamd-Queue-Id: 4DXRf61gwfz4VLX X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=q1P2Kxcp; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::f36) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.00 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-branches@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::f36:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::f36:from]; R_SPF_NA(0.00)[no SPF record]; FREEMAIL_TO(0.00)[me.com]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::f36:from]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; MAILMAN_DEST(0.00)[dev-commits-src-branches]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 20:21:51 -0000 On Fri, Feb 5, 2021 at 1:09 PM Toomas Soome wrote: > > > On 5. Feb 2021, at 21:43, Warner Losh wrote: > > > > On Fri, Feb 5, 2021 at 10:24 AM Toomas Soome wrote: > >> >> >> On 5. Feb 2021, at 18:44, Warner Losh wrote: >> >> >> >> On Thu, Feb 4, 2021 at 11:38 PM Toomas Soome wrote: >> >>> >>> >>> On 5. Feb 2021, at 01:56, Warner Losh wrote: >>> >>> =EF=BB=BF >>> And why the instaMFC? Changes are supposed to cook force days before >>> merging... I have questions about the wisdom of this change... >>> >>> Warner >>> >>> >>> Reason is in PR. There is someone with the system without ConOut but >>> ConOutDev is set. Instead of falling back to arbitrary device (which in >>> this case was totally wrong choice), we can try the possible devices li= st. >>> We do not change the ConOut parsing. >>> >> >> We could have the same effect defaulting to Video. This bug should have >> been discussed / reviewed before it was committed. >> >> >> How is is different from defaulting to serial, it is just as bad? we can >> not guess there, thats why we do have ConOutDev list. >> >> >> >> If it would appear, there are systems with unusable devices listed in >>> ConOutDev, then we need to think how to handle such case. >>> >> >> Yes. We fall back to the arbitrary device... It's just a flag that can b= e >> overridden. We can easily fall back to video too. >> >> >> We *should not* fall back on arbitrary devices when there is source for >> alternate options. And that option is from specification: >> >> "The ConInDev, ConOutDev, and ErrOutDev variables each contain an >> EFI_DEVICE_PATH_PROTOCOL descriptor that defines all the possible >> default devices to use on boot. These variables are volatile, and are se= t >> dynamically on every boot. ConIn, ConOut, and ErrOut are always proper >> subsets of ConInDev, ConOutDev, and ErrOutDev.*=E2=80=9D* >> > > Right. Except they aren't a proper subset in this case. Since they aren't > a proper subset, can you count on them having any meaningful meaning? In > the cases you found they do, but it's just as arbitrary. > > > Well, we can argue if empty set is or is not subset of (any) other set. > But, we do have specification. And we should not arbitrary pick what part > we are going to follow and what not. > The empty set isn't a proper subset. It is a subset, but not a proper subset, by definition. Therefore, it's not standards complaint. > > >> UEFI Spec 2.8A, Page 82. >> >> There may or may not be Video (or Serial) device listed. If not, there >> are good chance we will be in trouble because the firmware internals may >> not be set up properly and we can just as well end up in hung system. >> > > For x86, there's almost always Video. For !x86 it gets more troublesome. > > > There is almost always ConOut as well. Except when there is not. And in > this case, there is not. > > I still do not get what it is we are arguing about. Do we have case where > ConOut is not set and ConOutDev does have garbage? > We have one sighting of 'ConOut' being missing. Any extrapolation from there is tricky. We know in this one case the info appears to be good. But this is not standards compliant, so how can we be sure that others will be similar? Warner > rgds, > toomas > > > The kernel shouldn't hang when we give it the wrong console because if th= e > device isn't there, it won't cninit won't work. > >> Please seek more review is the point I'd hoped to make in the private >> email. This could easily have been reviewed. There was no urgent rush th= at >> required it to go in w/o review or even discussion. >> >> >> However, you didn't answer my question: Why the instant MFC? There's a 3 >> day minimum for changes in head... And there's nothing so urgent that >> requires a short-circuit. >> >> Warner >> >> >> >> Because the issues is reported on 13. well, I guess You are right there, >> could have waited a bit more. >> > > Right. Exactly my point.... > > Warner > > >> thanks, >> toomas >> >> >> >> >> >> >>> Thanks, >>> Toomas >>> >>> On Thu, Feb 4, 2021, 2:34 PM Toomas Soome wrote: >>> >>>> The branch stable/13 has been updated by tsoome: >>>> >>>> URL: >>>> https://cgit.FreeBSD.org/src/commit/?id=3D0c839497c174e961fc71f7d3329d= 05b10ec5525b >>>> >>>> >>>> commit 0c839497c174e961fc71f7d3329d05b10ec5525b >>>> Author: Toomas Soome >>>> AuthorDate: 2021-02-04 20:49:02 +0000 >>>> Commit: Toomas Soome >>>> CommitDate: 2021-02-04 21:33:15 +0000 >>>> >>>> loader.efi: There are systems without ConOut, also use ConOutDev >>>> >>>> Conout does contian the default output device name. >>>> ConOutDev does contain all possible output device names, so we can >>>> use it as fallback, when there is no ConOut. >>>> >>>> PR: 253253 >>>> >>>> (cherry picked from commit >>>> 2bd4ff2d8911009283e4e615ca4aad35a845f48b) >>>> --- >>>> stand/efi/loader/main.c | 2 ++ >>>> 1 file changed, 2 insertions(+) >>>> >>>> diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c >>>> index ca41cd4a2610..32b278950745 100644 >>>> --- a/stand/efi/loader/main.c >>>> +++ b/stand/efi/loader/main.c >>>> @@ -735,6 +735,8 @@ parse_uefi_con_out(void) >>>> how =3D 0; >>>> sz =3D sizeof(buf); >>>> rv =3D efi_global_getenv("ConOut", buf, &sz); >>>> + if (rv !=3D EFI_SUCCESS) >>>> + rv =3D efi_global_getenv("ConOutDev", buf, &sz); >>>> if (rv !=3D EFI_SUCCESS) { >>>> /* If we don't have any ConOut default to serial */ >>>> how =3D RB_SERIAL; >>> >>> > From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 20:26:01 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 219B2529598 for ; Fri, 5 Feb 2021 20:26:01 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DXRkx03bzz4V7l for ; Fri, 5 Feb 2021 20:26:00 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f45.google.com with SMTP id d16so9032868wro.11 for ; Fri, 05 Feb 2021 12:26:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=hcZB/9ER0d7HW414f5dvOlXvkYUP+L8mV/Jym18iz3Y=; b=pZj9yeWfmmv6P7ufNMa4Yw6clLSjZLpLBuwjoaeYRH3Q7AYgk71JROjrtZ2gdvFPDa fbFEDzVuoto6wbi99ut65E5+6qERToiAfdL3LVsSbXUc7isKI+z9iPABOVoAhegj4qev 3WEhlJ9EIi2Mo55zsAr3rKhPxRYlpuz3bNDfw/Hbw2vPhXX8caeImj4Kj3sKkbovfl+8 PVGhPs2NVpygS3ntMjZMQIOd0sZB9gLXfVV2zw7nd1/581+az9f3L6573v3fHNBCqRkD tvvZxOkAQLDQrGgNNeCxfbNL+czcFQI/9vcj0oyKQ42VyJosawxTxCZ0U/0lLX0pkRUo CzeA== X-Gm-Message-State: AOAM531Mkl6Q6RcMg7worUKZi3jdjY9CmhYWVmQSVyIIHasGuUxGf8L4 80Pxp6YjuHiCqcuy+K2/TuEwcQ== X-Google-Smtp-Source: ABdhPJzS1GD/ytChZge60aAM10DlBJEoyAAeQzrZKCE44R4z9LfD574k43ilfcUx4BT3IKEVmHePow== X-Received: by 2002:a5d:4a11:: with SMTP id m17mr6714571wrq.39.1612556759465; Fri, 05 Feb 2021 12:25:59 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id w25sm9981726wmc.42.2021.02.05.12.25.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Feb 2021 12:25:58 -0800 (PST) From: Jessica Clarke Message-Id: Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: 0c839497c174 - stable/13 - loader.efi: There are systems without ConOut, also use ConOutDev Date: Fri, 5 Feb 2021 20:25:56 +0000 In-Reply-To: Cc: Toomas Soome , Toomas Soome , src-committers , "" , dev-commits-src-branches@freebsd.org To: Warner Losh References: <97F5C09F-7AE3-4763-AD32-BFEA25101CE5@me.com> <014891C8-7B1F-4908-9495-2ED1A5FAABCF@me.com> X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4DXRkx03bzz4V7l X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 20:26:01 -0000 > On 5 Feb 2021, at 20:21, Warner Losh wrote: >=20 >=20 >=20 > On Fri, Feb 5, 2021 at 1:09 PM Toomas Soome > wrote: >=20 >=20 >> On 5. Feb 2021, at 21:43, Warner Losh > wrote: >>=20 >>=20 >>=20 >> On Fri, Feb 5, 2021 at 10:24 AM Toomas Soome > wrote: >>=20 >>=20 >>> On 5. Feb 2021, at 18:44, Warner Losh > wrote: >>>=20 >>>=20 >>>=20 >>> On Thu, Feb 4, 2021 at 11:38 PM Toomas Soome > wrote: >>>=20 >>>=20 >>>> On 5. Feb 2021, at 01:56, Warner Losh > wrote: >>>>=20 >>>> =EF=BB=BF >>>> And why the instaMFC? Changes are supposed to cook force days = before merging... I have questions about the wisdom of this change... >>>>=20 >>>> Warner=20 >>>>=20 >>>=20 >>> Reason is in PR. There is someone with the system without ConOut but = ConOutDev is set. Instead of falling back to arbitrary device (which in = this case was totally wrong choice), we can try the possible devices = list. We do not change the ConOut parsing. >>>=20 >>> We could have the same effect defaulting to Video. This bug should = have been discussed / reviewed before it was committed. >>=20 >> How is is different from defaulting to serial, it is just as bad? we = can not guess there, thats why we do have ConOutDev list. >>=20 >>=20 >>>=20 >>> If it would appear, there are systems with unusable devices listed = in ConOutDev, then we need to think how to handle such case. >>>=20 >>> Yes. We fall back to the arbitrary device... It's just a flag that = can be overridden. We can easily fall back to video too. >>=20 >> We *should not* fall back on arbitrary devices when there is source = for alternate options. And that option is from specification: >>=20 >> "The ConInDev, ConOutDev, and ErrOutDev variables each contain an = EFI_DEVICE_PATH_PROTOCOL descriptor that defines all the possible = default devices to use on boot. These variables are volatile, and are = set dynamically on every boot. ConIn, ConOut, and ErrOut are always = proper subsets of ConInDev, ConOutDev, and ErrOutDev.=E2=80=9D >>=20 >> Right. Except they aren't a proper subset in this case. Since they = aren't a proper subset, can you count on them having any meaningful = meaning? In the cases you found they do, but it's just as arbitrary. >=20 > Well, we can argue if empty set is or is not subset of (any) other = set. But, we do have specification. And we should not arbitrary pick = what part we are going to follow and what not. >=20 > The empty set isn't a proper subset. It is a subset, but not a proper = subset, by definition. Therefore, it's not standards complaint. The empty set is a proper subset of any non-empty set. Proper just means = that it's not equal to the original set. Perhaps you're thinking of = trivial subsets (which are the empty set and, if not empty, the original = set)? Jess From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 20:26:47 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B6340529627 for ; Fri, 5 Feb 2021 20:26:47 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qv1-xf2b.google.com (mail-qv1-xf2b.google.com [IPv6:2607:f8b0:4864:20::f2b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DXRlq0pc3z4Vdc for ; Fri, 5 Feb 2021 20:26:47 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qv1-xf2b.google.com with SMTP id j4so4103543qvk.6 for ; Fri, 05 Feb 2021 12:26:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mDi1cuBJfAjZD6twYIxn+1LpY1MeNrzofV545yAOJMc=; b=byh4yTE3bV+MFaD9F4rsSq5zeJ0PYRw7ffapDtSS2c3/g25LdeJSMMWtu+oe6mfcI5 FBugx09+TljN2e1O7Ihvm6QqnVHCT4bNfVMNr7x3NOWYDXIjXELhItBNO+YmJB5NxQf4 IZZBgxPvb4M794/Vj5rztSBgwCTlayohloXuB+FG3+LjO4Eo8YjobnF9QmmDM339Z2Pi Xw5djy8FuWAfCSn2EaJgBNs4SJz2e6+/01gA0PNvvkg9Kr0bg5H9dxL+08cvW9bnnJgx 6wYVzPOm2czLr6NEpd3g89JanRCZfJqj51yU2b8mVYVvyKLx2ee3pEl+EWQeEqWdJiVX VsyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mDi1cuBJfAjZD6twYIxn+1LpY1MeNrzofV545yAOJMc=; b=BRtXtj1RHxksVPgUF7mmzl3BBRVWmlB7sSZVLxvS9mc8z6eR94mxTHRZdB+ExeDNGE 03AjJDFjU3Qjjs/+dpS7GVN0/dNsOPAXm/E7SexC8OTEow0zbqoEy0qr5GRBt2LTOAkb 4pq8/8R6rUQrDEgoB5A4/TeRtXrDYHZltmId0OnPBydrYZW6wTiWpNOFB4zxDyVybLRA Rt6FMLOBa0KfVE8DkwcZYA9U+XqWJ2/TtQldZX1pH2R1VDsGp5e22RnXuESiW5kWcNqM oSJ3AnZYlDLd846+BNNFLme3fXWgN7aItvMktrKe4FkcvDKPMKct7900rM3z/MIr09gq Xt2w== X-Gm-Message-State: AOAM531mMUk0ltkiaxNE4E6Wvq4CsLXp/xfozI4jmFVVj2kN88shnOCK NrLrT0j09gwfgwNzK+NqHWaHmQ+dALgxI21VVhfxn8KNY514VA== X-Google-Smtp-Source: ABdhPJystaQ4SKUGGFMzBQoXE0TBCYcXv5xtnlClv3bW/HimE6naHkQXXIQE9QX2Bn7IphHgmHe4lfuKRpXG2BlawLo= X-Received: by 2002:a0c:eb4c:: with SMTP id c12mr5969951qvq.62.1612556806222; Fri, 05 Feb 2021 12:26:46 -0800 (PST) MIME-Version: 1.0 References: <97F5C09F-7AE3-4763-AD32-BFEA25101CE5@me.com> <014891C8-7B1F-4908-9495-2ED1A5FAABCF@me.com> In-Reply-To: From: Warner Losh Date: Fri, 5 Feb 2021 13:26:35 -0700 Message-ID: Subject: Re: git: 0c839497c174 - stable/13 - loader.efi: There are systems without ConOut, also use ConOutDev To: Toomas Soome Cc: Toomas Soome , src-committers , "" , dev-commits-src-branches@freebsd.org X-Rspamd-Queue-Id: 4DXRlq0pc3z4Vdc X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=byh4yTE3; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::f2b) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.00 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-branches@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::f2b:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::f2b:from]; R_SPF_NA(0.00)[no SPF record]; FREEMAIL_TO(0.00)[me.com]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::f2b:from]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; MAILMAN_DEST(0.00)[dev-commits-src-branches]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 20:26:47 -0000 On Fri, Feb 5, 2021 at 1:21 PM Warner Losh wrote: > > > On Fri, Feb 5, 2021 at 1:09 PM Toomas Soome wrote: > >> >> >> On 5. Feb 2021, at 21:43, Warner Losh wrote: >> >> >> >> On Fri, Feb 5, 2021 at 10:24 AM Toomas Soome wrote: >> >>> >>> >>> On 5. Feb 2021, at 18:44, Warner Losh wrote: >>> >>> >>> >>> On Thu, Feb 4, 2021 at 11:38 PM Toomas Soome wrote: >>> >>>> >>>> >>>> On 5. Feb 2021, at 01:56, Warner Losh wrote: >>>> >>>> =EF=BB=BF >>>> And why the instaMFC? Changes are supposed to cook force days before >>>> merging... I have questions about the wisdom of this change... >>>> >>>> Warner >>>> >>>> >>>> Reason is in PR. There is someone with the system without ConOut but >>>> ConOutDev is set. Instead of falling back to arbitrary device (which i= n >>>> this case was totally wrong choice), we can try the possible devices l= ist. >>>> We do not change the ConOut parsing. >>>> >>> >>> We could have the same effect defaulting to Video. This bug should have >>> been discussed / reviewed before it was committed. >>> >>> >>> How is is different from defaulting to serial, it is just as bad? we ca= n >>> not guess there, thats why we do have ConOutDev list. >>> >>> >>> >>> If it would appear, there are systems with unusable devices listed in >>>> ConOutDev, then we need to think how to handle such case. >>>> >>> >>> Yes. We fall back to the arbitrary device... It's just a flag that can >>> be overridden. We can easily fall back to video too. >>> >>> >>> We *should not* fall back on arbitrary devices when there is source for >>> alternate options. And that option is from specification: >>> >>> "The ConInDev, ConOutDev, and ErrOutDev variables each contain an >>> EFI_DEVICE_PATH_PROTOCOL descriptor that defines all the possible >>> default devices to use on boot. These variables are volatile, and are s= et >>> dynamically on every boot. ConIn, ConOut, and ErrOut are always proper >>> subsets of ConInDev, ConOutDev, and ErrOutDev.*=E2=80=9D* >>> >> >> Right. Except they aren't a proper subset in this case. Since they aren'= t >> a proper subset, can you count on them having any meaningful meaning? In >> the cases you found they do, but it's just as arbitrary. >> >> >> Well, we can argue if empty set is or is not subset of (any) other set. >> But, we do have specification. And we should not arbitrary pick what par= t >> we are going to follow and what not. >> > > The empty set isn't a proper subset. It is a subset, but not a proper > subset, by definition. Therefore, it's not standards complaint. > Hmmm, I just looked up 'proper subset' and it's the other end: ConOut must be smaller than ConOutDev according to this wording. However, that makes no sense here. > >> >>> UEFI Spec 2.8A, Page 82. >>> >>> There may or may not be Video (or Serial) device listed. If not, there >>> are good chance we will be in trouble because the firmware internals ma= y >>> not be set up properly and we can just as well end up in hung system. >>> >> >> For x86, there's almost always Video. For !x86 it gets more troublesome. >> >> >> There is almost always ConOut as well. Except when there is not. And in >> this case, there is not. >> >> I still do not get what it is we are arguing about. Do we have case wher= e >> ConOut is not set and ConOutDev does have garbage? >> > > We have one sighting of 'ConOut' being missing. Any extrapolation from > there is tricky. We know in this one case the info appears to be good. Bu= t > this is not standards compliant, so how can we be sure that others will b= e > similar? > > Warner > > >> rgds, >> toomas >> >> >> The kernel shouldn't hang when we give it the wrong console because if >> the device isn't there, it won't cninit won't work. >> >>> Please seek more review is the point I'd hoped to make in the private >>> email. This could easily have been reviewed. There was no urgent rush t= hat >>> required it to go in w/o review or even discussion. >>> >>> >>> However, you didn't answer my question: Why the instant MFC? There's a = 3 >>> day minimum for changes in head... And there's nothing so urgent that >>> requires a short-circuit. >>> >>> Warner >>> >>> >>> >>> Because the issues is reported on 13. well, I guess You are right there= , >>> could have waited a bit more. >>> >> >> Right. Exactly my point.... >> >> Warner >> >> >>> thanks, >>> toomas >>> >>> >>> >>> >>> >>> >>>> Thanks, >>>> Toomas >>>> >>>> On Thu, Feb 4, 2021, 2:34 PM Toomas Soome wrote: >>>> >>>>> The branch stable/13 has been updated by tsoome: >>>>> >>>>> URL: >>>>> https://cgit.FreeBSD.org/src/commit/?id=3D0c839497c174e961fc71f7d3329= d05b10ec5525b >>>>> >>>>> >>>>> commit 0c839497c174e961fc71f7d3329d05b10ec5525b >>>>> Author: Toomas Soome >>>>> AuthorDate: 2021-02-04 20:49:02 +0000 >>>>> Commit: Toomas Soome >>>>> CommitDate: 2021-02-04 21:33:15 +0000 >>>>> >>>>> loader.efi: There are systems without ConOut, also use ConOutDev >>>>> >>>>> Conout does contian the default output device name. >>>>> ConOutDev does contain all possible output device names, so we ca= n >>>>> use it as fallback, when there is no ConOut. >>>>> >>>>> PR: 253253 >>>>> >>>>> (cherry picked from commit >>>>> 2bd4ff2d8911009283e4e615ca4aad35a845f48b) >>>>> --- >>>>> stand/efi/loader/main.c | 2 ++ >>>>> 1 file changed, 2 insertions(+) >>>>> >>>>> diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c >>>>> index ca41cd4a2610..32b278950745 100644 >>>>> --- a/stand/efi/loader/main.c >>>>> +++ b/stand/efi/loader/main.c >>>>> @@ -735,6 +735,8 @@ parse_uefi_con_out(void) >>>>> how =3D 0; >>>>> sz =3D sizeof(buf); >>>>> rv =3D efi_global_getenv("ConOut", buf, &sz); >>>>> + if (rv !=3D EFI_SUCCESS) >>>>> + rv =3D efi_global_getenv("ConOutDev", buf, &sz); >>>>> if (rv !=3D EFI_SUCCESS) { >>>>> /* If we don't have any ConOut default to serial */ >>>>> how =3D RB_SERIAL; >>>> >>>> >> From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 20:28:38 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 492BA529649 for ; Fri, 5 Feb 2021 20:28:38 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DXRny1HSmz4Vn2 for ; Fri, 5 Feb 2021 20:28:37 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72d.google.com with SMTP id x81so8296373qkb.0 for ; Fri, 05 Feb 2021 12:28:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9cDzxxaoaqNvi8c4xHh4L5Xcdvn7rwTTsZ2JgJdMo3E=; b=bPfC96bE/fxLUoGRbk6ALk1JZKUGY39Gyz3XxiK4KDxob4Ne2spjx02sQ2FQiDJDnR QOz1M3ByjbA9rCw9xMTLQqXNZf0UAogpapuUsVc58lV8x0Suc/wjaSebCAPJm+/elR9j EChZdRN905HyaRbsDCJYSlx/+STP90FsXdUhkttosnKujwG3nrl2UBWaA5Wit27FVJsZ L8p3i7IxoxeHXCmgo7PRH6EWst4hcV9ncH9pZnStkN0LOOhi3tZRoXhGaSUfczLnX2yk unR3OAKMnPXuITiI1Rp/ofgujxnOiWGU9LzVVIYd0w7Vj0IzqaPN5CQNMu/HPcl8Qt9Z prtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9cDzxxaoaqNvi8c4xHh4L5Xcdvn7rwTTsZ2JgJdMo3E=; b=uXiUKgi+pYlxOzECgGkl0TgY1wiX3jFYecMyFaZ6Yy155TI1J7KJ7PrfIZQEdUGqlm 3g7F6G9hZP4BJKG+hQrz6jSQy9XttvTuwYyxY0/FVRjznczVd5MyW38PMwnsRQeEjqXz sbBKb199H7YMWSHxOozk+LziSYcEr7pT4jcrdku2EOpn8GDE9I4JdhvoepY2tQE1vGdI aUXsri3s2eb/WdTKmsqYWuvJEiU86z1+lH5SCPBlugRYu8/mIiJGDGxWHYvslNQ1hM1h 1ioKwg370NUiUpAH+zvrVAA3Cold0CkNVX5uybPK+62ocCB+VyEe+6LTfvJDX8eZP7LQ QwKg== X-Gm-Message-State: AOAM531+yDQcfjhSA/gAaK9D/ACBI/CNbvLGcfaRfEE7gRblYmBCk4qU AASI+1us8hICBjdUvsMw7iHul6M+1fAJavSHkq1dIw== X-Google-Smtp-Source: ABdhPJyBN5iOjYDObbjg7cCD0FlatJ7IlB6hWS141ztQRPFt7nzYaSnfYeNskG5keRntxUqNEW8ytrC/Jm4eAv5RmPY= X-Received: by 2002:a37:a34f:: with SMTP id m76mr6053390qke.89.1612556917322; Fri, 05 Feb 2021 12:28:37 -0800 (PST) MIME-Version: 1.0 References: <97F5C09F-7AE3-4763-AD32-BFEA25101CE5@me.com> <014891C8-7B1F-4908-9495-2ED1A5FAABCF@me.com> In-Reply-To: From: Warner Losh Date: Fri, 5 Feb 2021 13:28:26 -0700 Message-ID: Subject: Re: git: 0c839497c174 - stable/13 - loader.efi: There are systems without ConOut, also use ConOutDev To: Jessica Clarke Cc: Toomas Soome , Toomas Soome , src-committers , "" , dev-commits-src-branches@freebsd.org X-Rspamd-Queue-Id: 4DXRny1HSmz4Vn2 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 20:28:38 -0000 On Fri, Feb 5, 2021 at 1:25 PM Jessica Clarke wrote: > On 5 Feb 2021, at 20:21, Warner Losh wrote: > > > > On Fri, Feb 5, 2021 at 1:09 PM Toomas Soome wrote: > >> >> >> On 5. Feb 2021, at 21:43, Warner Losh wrote: >> >> >> >> On Fri, Feb 5, 2021 at 10:24 AM Toomas Soome wrote: >> >>> >>> >>> On 5. Feb 2021, at 18:44, Warner Losh wrote: >>> >>> >>> >>> On Thu, Feb 4, 2021 at 11:38 PM Toomas Soome wrote: >>> >>>> >>>> >>>> On 5. Feb 2021, at 01:56, Warner Losh wrote: >>>> >>>> =EF=BB=BF >>>> And why the instaMFC? Changes are supposed to cook force days before >>>> merging... I have questions about the wisdom of this change... >>>> >>>> Warner >>>> >>>> >>>> Reason is in PR. There is someone with the system without ConOut but >>>> ConOutDev is set. Instead of falling back to arbitrary device (which i= n >>>> this case was totally wrong choice), we can try the possible devices l= ist. >>>> We do not change the ConOut parsing. >>>> >>> >>> We could have the same effect defaulting to Video. This bug should have >>> been discussed / reviewed before it was committed. >>> >>> >>> How is is different from defaulting to serial, it is just as bad? we ca= n >>> not guess there, thats why we do have ConOutDev list. >>> >>> >>> >>> If it would appear, there are systems with unusable devices listed in >>>> ConOutDev, then we need to think how to handle such case. >>>> >>> >>> Yes. We fall back to the arbitrary device... It's just a flag that can >>> be overridden. We can easily fall back to video too. >>> >>> >>> We *should not* fall back on arbitrary devices when there is source for >>> alternate options. And that option is from specification: >>> >>> "The ConInDev, ConOutDev, and ErrOutDev variables each contain an >>> EFI_DEVICE_PATH_PROTOCOL descriptor that defines all the possible >>> default devices to use on boot. These variables are volatile, and are s= et >>> dynamically on every boot. ConIn, ConOut, and ErrOut are always proper >>> subsets of ConInDev, ConOutDev, and ErrOutDev.*=E2=80=9D* >>> >> >> Right. Except they aren't a proper subset in this case. Since they aren'= t >> a proper subset, can you count on them having any meaningful meaning? In >> the cases you found they do, but it's just as arbitrary. >> >> >> Well, we can argue if empty set is or is not subset of (any) other set. >> But, we do have specification. And we should not arbitrary pick what par= t >> we are going to follow and what not. >> > > The empty set isn't a proper subset. It is a subset, but not a proper > subset, by definition. Therefore, it's not standards complaint. > > > The empty set is a proper subset of any non-empty set. Proper just means > that it's not equal to the original set. Perhaps you're thinking of trivi= al > subsets (which are the empty set and, if not empty, the original set)? > Yes. I was confusing the two, but 'proper subset' doesn't make sense in the original standard wording since it's often the case that ConOut and ConOutDev are exactly the same. And there's a difference between ConOut being present, but empty (which would be a subset) and it being absent, imho, that puts us in 'what to do in non-standard-compliant' behavior of the BIOS... Warner From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 20:33:08 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 26DA9529853 for ; Fri, 5 Feb 2021 20:33:08 +0000 (UTC) (envelope-from tsoome@me.com) Received: from pv50p00im-ztdg10012101.me.com (pv50p00im-ztdg10012101.me.com [17.58.6.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DXRv76rVxz4W7x for ; Fri, 5 Feb 2021 20:33:07 +0000 (UTC) (envelope-from tsoome@me.com) Received: from nazgul.lan (148-52-235-80.sta.estpak.ee [80.235.52.148]) by pv50p00im-ztdg10012101.me.com (Postfix) with ESMTPSA id CD7A084020B; Fri, 5 Feb 2021 20:33:04 +0000 (UTC) From: Toomas Soome Message-Id: <68A78067-CE19-4024-B6A9-D924F8972A35@me.com> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: git: 0c839497c174 - stable/13 - loader.efi: There are systems without ConOut, also use ConOutDev Date: Fri, 5 Feb 2021 22:33:02 +0200 In-Reply-To: Cc: Toomas Soome , src-committers , "" , dev-commits-src-branches@freebsd.org To: Warner Losh References: <97F5C09F-7AE3-4763-AD32-BFEA25101CE5@me.com> <014891C8-7B1F-4908-9495-2ED1A5FAABCF@me.com> X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.737 definitions=2021-02-05_11:2021-02-05, 2021-02-05 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2006250000 definitions=main-2102050128 X-Rspamd-Queue-Id: 4DXRv76rVxz4W7x X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 20:33:08 -0000 > On 5. Feb 2021, at 22:21, Warner Losh wrote: >=20 >=20 >=20 > On Fri, Feb 5, 2021 at 1:09 PM Toomas Soome > wrote: >=20 >=20 >> On 5. Feb 2021, at 21:43, Warner Losh > wrote: >>=20 >>=20 >>=20 >> On Fri, Feb 5, 2021 at 10:24 AM Toomas Soome > wrote: >>=20 >>=20 >>> On 5. Feb 2021, at 18:44, Warner Losh > wrote: >>>=20 >>>=20 >>>=20 >>> On Thu, Feb 4, 2021 at 11:38 PM Toomas Soome > wrote: >>>=20 >>>=20 >>>> On 5. Feb 2021, at 01:56, Warner Losh > wrote: >>>>=20 >>>> =EF=BB=BF >>>> And why the instaMFC? Changes are supposed to cook force days = before merging... I have questions about the wisdom of this change... >>>>=20 >>>> Warner=20 >>>>=20 >>>=20 >>> Reason is in PR. There is someone with the system without ConOut but = ConOutDev is set. Instead of falling back to arbitrary device (which in = this case was totally wrong choice), we can try the possible devices = list. We do not change the ConOut parsing. >>>=20 >>> We could have the same effect defaulting to Video. This bug should = have been discussed / reviewed before it was committed. >>=20 >> How is is different from defaulting to serial, it is just as bad? we = can not guess there, thats why we do have ConOutDev list. >>=20 >>=20 >>>=20 >>> If it would appear, there are systems with unusable devices listed = in ConOutDev, then we need to think how to handle such case. >>>=20 >>> Yes. We fall back to the arbitrary device... It's just a flag that = can be overridden. We can easily fall back to video too. >>=20 >> We *should not* fall back on arbitrary devices when there is source = for alternate options. And that option is from specification: >>=20 >> "The ConInDev, ConOutDev, and ErrOutDev variables each contain an = EFI_DEVICE_PATH_PROTOCOL descriptor that defines all the possible = default devices to use on boot. These variables are volatile, and are = set dynamically on every boot. ConIn, ConOut, and ErrOut are always = proper subsets of ConInDev, ConOutDev, and ErrOutDev.=E2=80=9D >>=20 >> Right. Except they aren't a proper subset in this case. Since they = aren't a proper subset, can you count on them having any meaningful = meaning? In the cases you found they do, but it's just as arbitrary. >=20 > Well, we can argue if empty set is or is not subset of (any) other = set. But, we do have specification. And we should not arbitrary pick = what part we are going to follow and what not. >=20 > The empty set isn't a proper subset. It is a subset, but not a proper = subset, by definition. Therefore, it's not standards complaint. >> =20 >> UEFI Spec 2.8A, Page 82. >>=20 >> There may or may not be Video (or Serial) device listed. If not, = there are good chance we will be in trouble because the firmware = internals may not be set up properly and we can just as well end up in = hung system. >>=20 >> For x86, there's almost always Video. For !x86 it gets more = troublesome. >=20 > There is almost always ConOut as well. Except when there is not. And = in this case, there is not. >=20 > I still do not get what it is we are arguing about. Do we have case = where ConOut is not set and ConOutDev does have garbage? >=20 > We have one sighting of 'ConOut' being missing. Any extrapolation from = there is tricky. We know in this one case the info appears to be good. = But this is not standards compliant, so how can we be sure that others = will be similar? >=20 > Warner It is tricky, agree. But we also have other assumptions. Like we can = get handles for all devices (vmware devs at one point in time did decide = to only give handles for devices used at boot time - no handles fot = non-boot disks, serial ports and such). But we are not going to tell user to buy better computer, do we?:) = Otherwise, we should tell the same for other non-standard cases we = already do know about=E2=80=A6 Thanks for all the feedback, toomas From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 21:15:17 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA0E552A178; Fri, 5 Feb 2021 21:15: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 4DXSqn4PhVz4YMC; Fri, 5 Feb 2021 21:15:17 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 89DD4258B3; Fri, 5 Feb 2021 21:15:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 115LFHWm089167; Fri, 5 Feb 2021 21:15:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 115LFHYK089164; Fri, 5 Feb 2021 21:15:17 GMT (envelope-from git) Date: Fri, 5 Feb 2021 21:15:17 GMT Message-Id: <202102052115.115LFHYK089164@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Stefan Eßer Subject: git: bf77fadc22c4 - stable/13 - Revert "bc: Vendor import of Gavin Howard's bc version 3.2.6" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bf77fadc22c4c73f5e300309551e07c48bbe3a86 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 21:15:17 -0000 The branch stable/13 has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=bf77fadc22c4c73f5e300309551e07c48bbe3a86 commit bf77fadc22c4c73f5e300309551e07c48bbe3a86 Author: Stefan Eßer AuthorDate: 2021-02-05 19:53:34 +0000 Commit: Stefan Eßer CommitDate: 2021-02-05 19:53:34 +0000 Revert "bc: Vendor import of Gavin Howard's bc version 3.2.6" This reverts commit 601ac82194693fcae9d7d2a7ec7d66ebaf3fd61e. Seems that git cherry-pick mis-merges files for this software. It associates files in completely unrelated sub-trees with same name files from this package, e.g. README.md and .gitignore. My attempt to fix the mis-merge was incomplete and wrong. Therefore I'm reverting the commit that as a result of my failed attempt at conflict resolution lead to README.md and .gitignore in the top source directory to be deleted. This mistake has been carried over to releng/13.0, which now also lacks README.md and .gitignore in /usr/src. I'll try to re-apply the failed commit over the next hours and to get the fix merged to releng/13.0 with re approval. --- .gitignore | 27 ++ README.md | 82 +++++ contrib/bc/.gitignore | 9 - contrib/bc/LICENSE.md | 52 +-- contrib/bc/Makefile.in | 122 ++---- contrib/bc/NEWS.md | 35 -- contrib/bc/NOTICE.md | 2 +- contrib/bc/README.md | 1 - contrib/bc/configure.sh | 348 +++--------------- contrib/bc/exec-install.sh | 2 +- contrib/bc/functions.sh | 90 ++--- contrib/bc/gen/bc_help.txt | 2 +- contrib/bc/gen/dc_help.txt | 2 +- contrib/bc/gen/lib.bc | 2 +- contrib/bc/gen/lib2.bc | 2 +- contrib/bc/gen/strgen.c | 4 +- contrib/bc/gen/strgen.sh | 4 +- contrib/bc/include/args.h | 2 +- contrib/bc/include/bc.h | 2 +- contrib/bc/include/bcl.h | 2 +- contrib/bc/include/dc.h | 2 +- contrib/bc/include/file.h | 2 +- contrib/bc/include/history.h | 2 +- contrib/bc/include/lang.h | 2 +- contrib/bc/include/lex.h | 2 +- contrib/bc/include/library.h | 2 +- contrib/bc/include/num.h | 4 +- contrib/bc/include/opt.h | 2 +- contrib/bc/include/parse.h | 2 +- contrib/bc/include/program.h | 2 +- contrib/bc/include/rand.h | 31 +- contrib/bc/include/read.h | 2 +- contrib/bc/include/status.h | 14 +- contrib/bc/include/vector.h | 3 +- contrib/bc/include/vm.h | 19 +- contrib/bc/karatsuba.py | 2 +- contrib/bc/link.sh | 2 +- contrib/bc/locale_install.sh | 2 +- contrib/bc/locale_uninstall.sh | 2 +- contrib/bc/locales/de_DE.ISO8859-1.msg | 2 +- contrib/bc/locales/de_DE.UTF-8.msg | 2 +- contrib/bc/locales/en_US.msg | 2 +- contrib/bc/locales/es_ES.ISO8859-1.msg | 2 +- contrib/bc/locales/es_ES.UTF-8.msg | 2 +- contrib/bc/locales/fr_FR.ISO8859-1.msg | 2 +- contrib/bc/locales/fr_FR.UTF-8.msg | 2 +- contrib/bc/locales/ja_JP.UTF-8.msg | 2 +- contrib/bc/locales/ja_JP.eucJP.msg | 2 +- contrib/bc/locales/nl_NL.ISO8859-1.msg | 2 +- contrib/bc/locales/nl_NL.UTF-8.msg | 2 +- contrib/bc/locales/pl_PL.ISO8859-2.msg | 2 +- contrib/bc/locales/pl_PL.UTF-8.msg | 2 +- contrib/bc/locales/pt_PT.ISO8859-1.msg | 2 +- contrib/bc/locales/pt_PT.UTF-8.msg | 2 +- contrib/bc/locales/ru_RU.CP1251.msg | 2 +- contrib/bc/locales/ru_RU.CP866.msg | 2 +- contrib/bc/locales/ru_RU.ISO8859-5.msg | 2 +- contrib/bc/locales/ru_RU.KOI8-R.msg | 2 +- contrib/bc/locales/ru_RU.UTF-8.msg | 2 +- contrib/bc/locales/zh_CN.GB18030.msg | 2 +- contrib/bc/locales/zh_CN.GB2312.msg | 2 +- contrib/bc/locales/zh_CN.GBK.msg | 2 +- contrib/bc/locales/zh_CN.UTF-8.msg | 2 +- contrib/bc/locales/zh_CN.eucCN.msg | 2 +- contrib/bc/manpage.sh | 2 +- contrib/bc/manuals/bc.1.md.in | 7 +- contrib/bc/manuals/bc/A.1 | 8 +- contrib/bc/manuals/bc/A.1.md | 7 +- contrib/bc/manuals/bc/E.1 | 4 +- contrib/bc/manuals/bc/E.1.md | 2 +- contrib/bc/manuals/bc/EH.1 | 4 +- contrib/bc/manuals/bc/EH.1.md | 2 +- contrib/bc/manuals/bc/EHN.1 | 4 +- contrib/bc/manuals/bc/EHN.1.md | 2 +- contrib/bc/manuals/bc/EHNP.1 | 4 +- contrib/bc/manuals/bc/EHNP.1.md | 2 +- contrib/bc/manuals/bc/EHP.1 | 4 +- contrib/bc/manuals/bc/EHP.1.md | 2 +- contrib/bc/manuals/bc/EN.1 | 4 +- contrib/bc/manuals/bc/EN.1.md | 2 +- contrib/bc/manuals/bc/ENP.1 | 4 +- contrib/bc/manuals/bc/ENP.1.md | 2 +- contrib/bc/manuals/bc/EP.1 | 4 +- contrib/bc/manuals/bc/EP.1.md | 2 +- contrib/bc/manuals/bc/H.1 | 8 +- contrib/bc/manuals/bc/H.1.md | 7 +- contrib/bc/manuals/bc/HN.1 | 8 +- contrib/bc/manuals/bc/HN.1.md | 7 +- contrib/bc/manuals/bc/HNP.1 | 8 +- contrib/bc/manuals/bc/HNP.1.md | 7 +- contrib/bc/manuals/bc/HP.1 | 8 +- contrib/bc/manuals/bc/HP.1.md | 7 +- contrib/bc/manuals/bc/N.1 | 8 +- contrib/bc/manuals/bc/N.1.md | 7 +- contrib/bc/manuals/bc/NP.1 | 8 +- contrib/bc/manuals/bc/NP.1.md | 7 +- contrib/bc/manuals/bc/P.1 | 8 +- contrib/bc/manuals/bc/P.1.md | 7 +- contrib/bc/manuals/bcl.3 | 4 +- contrib/bc/manuals/bcl.3.md | 2 +- contrib/bc/manuals/dc.1.md.in | 7 +- contrib/bc/manuals/dc/A.1 | 10 +- contrib/bc/manuals/dc/A.1.md | 7 +- contrib/bc/manuals/dc/E.1 | 4 +- contrib/bc/manuals/dc/E.1.md | 2 +- contrib/bc/manuals/dc/EH.1 | 4 +- contrib/bc/manuals/dc/EH.1.md | 2 +- contrib/bc/manuals/dc/EHN.1 | 4 +- contrib/bc/manuals/dc/EHN.1.md | 2 +- contrib/bc/manuals/dc/EHNP.1 | 4 +- contrib/bc/manuals/dc/EHNP.1.md | 2 +- contrib/bc/manuals/dc/EHP.1 | 4 +- contrib/bc/manuals/dc/EHP.1.md | 2 +- contrib/bc/manuals/dc/EN.1 | 4 +- contrib/bc/manuals/dc/EN.1.md | 2 +- contrib/bc/manuals/dc/ENP.1 | 4 +- contrib/bc/manuals/dc/ENP.1.md | 2 +- contrib/bc/manuals/dc/EP.1 | 4 +- contrib/bc/manuals/dc/EP.1.md | 2 +- contrib/bc/manuals/dc/H.1 | 10 +- contrib/bc/manuals/dc/H.1.md | 7 +- contrib/bc/manuals/dc/HN.1 | 10 +- contrib/bc/manuals/dc/HN.1.md | 7 +- contrib/bc/manuals/dc/HNP.1 | 10 +- contrib/bc/manuals/dc/HNP.1.md | 7 +- contrib/bc/manuals/dc/HP.1 | 10 +- contrib/bc/manuals/dc/HP.1.md | 7 +- contrib/bc/manuals/dc/N.1 | 10 +- contrib/bc/manuals/dc/N.1.md | 7 +- contrib/bc/manuals/dc/NP.1 | 10 +- contrib/bc/manuals/dc/NP.1.md | 7 +- contrib/bc/manuals/dc/P.1 | 10 +- contrib/bc/manuals/dc/P.1.md | 7 +- contrib/bc/manuals/header.txt | 2 +- contrib/bc/manuals/header_bc.txt | 2 +- contrib/bc/manuals/header_bcl.txt | 2 +- contrib/bc/manuals/header_dc.txt | 2 +- contrib/bc/release.sh | 18 +- contrib/bc/src/args.c | 2 +- contrib/bc/src/bc.c | 2 +- contrib/bc/src/bc_lex.c | 2 +- contrib/bc/src/bc_parse.c | 2 +- contrib/bc/src/data.c | 4 +- contrib/bc/src/dc.c | 2 +- contrib/bc/src/dc_lex.c | 6 +- contrib/bc/src/dc_parse.c | 2 +- contrib/bc/src/file.c | 4 +- contrib/bc/src/history.c | 15 +- contrib/bc/src/lang.c | 14 +- contrib/bc/src/lex.c | 4 +- contrib/bc/src/library.c | 12 +- contrib/bc/src/main.c | 13 +- contrib/bc/src/num.c | 10 +- contrib/bc/src/opt.c | 2 +- contrib/bc/src/parse.c | 8 +- contrib/bc/src/program.c | 31 +- contrib/bc/src/rand.c | 42 ++- contrib/bc/src/read.c | 6 +- contrib/bc/src/vector.c | 8 +- contrib/bc/src/vm.c | 86 +---- contrib/bc/tests/afl.py | 22 +- contrib/bc/tests/all.sh | 191 +++++++++- contrib/bc/tests/bc/all.txt | 6 +- contrib/bc/tests/bc/scripts/all.txt | 15 - contrib/bc/tests/bc/timeconst.sh | 9 +- contrib/bc/tests/bcl.c | 2 +- contrib/bc/tests/dc/errors/30.txt | 1 - contrib/bc/tests/dc/errors/31.txt | 1 - contrib/bc/tests/dc/scripts/all.txt | 9 - contrib/bc/tests/diff.sh | 51 --- contrib/bc/tests/errors.sh | 20 +- contrib/bc/tests/extra_required.txt | 7 - contrib/bc/tests/fuzzing/bc.dict | 68 ---- contrib/bc/tests/fuzzing/bc_inputs1/abs.txt | 7 - contrib/bc/tests/fuzzing/bc_inputs1/add.txt | 146 -------- contrib/bc/tests/fuzzing/bc_inputs1/arctangent.txt | 26 -- contrib/bc/tests/fuzzing/bc_inputs1/array.bc | 60 --- contrib/bc/tests/fuzzing/bc_inputs1/arrays.txt | 10 - .../bc/tests/fuzzing/bc_inputs1/assignments.txt | 122 ------ contrib/bc/tests/fuzzing/bc_inputs1/basic.txt | 7 - contrib/bc/tests/fuzzing/bc_inputs1/boolean.txt | 184 ---------- contrib/bc/tests/fuzzing/bc_inputs1/cosine.txt | 44 --- contrib/bc/tests/fuzzing/bc_inputs1/decimal.txt | 35 -- contrib/bc/tests/fuzzing/bc_inputs1/divide.txt | 31 -- .../bc/tests/fuzzing/bc_inputs1/engineering.txt | 19 - contrib/bc/tests/fuzzing/bc_inputs1/exponent.txt | 22 -- contrib/bc/tests/fuzzing/bc_inputs1/functions.bc | 7 - contrib/bc/tests/fuzzing/bc_inputs1/functions.txt | 13 - contrib/bc/tests/fuzzing/bc_inputs1/globals.txt | 21 -- contrib/bc/tests/fuzzing/bc_inputs1/len.bc | 48 --- contrib/bc/tests/fuzzing/bc_inputs1/length.txt | 59 --- contrib/bc/tests/fuzzing/bc_inputs1/lib10.txt | 4 - contrib/bc/tests/fuzzing/bc_inputs1/lib11.txt | 4 - contrib/bc/tests/fuzzing/bc_inputs1/lib12.txt | 1 - contrib/bc/tests/fuzzing/bc_inputs1/lib2.txt | 15 - contrib/bc/tests/fuzzing/bc_inputs1/lib3.txt | 6 - contrib/bc/tests/fuzzing/bc_inputs1/lib4.txt | 10 - contrib/bc/tests/fuzzing/bc_inputs1/lib5.txt | 2 - contrib/bc/tests/fuzzing/bc_inputs1/lib6.txt | 5 - contrib/bc/tests/fuzzing/bc_inputs1/lib7.txt | 12 - contrib/bc/tests/fuzzing/bc_inputs1/lib8.txt | 3 - contrib/bc/tests/fuzzing/bc_inputs2/lib13.txt | 1 - contrib/bc/tests/fuzzing/bc_inputs2/lib14.txt | 1 - contrib/bc/tests/fuzzing/bc_inputs2/lib15.txt | 1 - contrib/bc/tests/fuzzing/bc_inputs2/lib16.txt | 1 - contrib/bc/tests/fuzzing/bc_inputs2/lib19.txt | 1 - contrib/bc/tests/fuzzing/bc_inputs2/lib20.txt | 1 - contrib/bc/tests/fuzzing/bc_inputs2/lib21.txt | 1 - contrib/bc/tests/fuzzing/bc_inputs2/lib22.txt | 1 - contrib/bc/tests/fuzzing/bc_inputs2/lib23.txt | 1 - contrib/bc/tests/fuzzing/bc_inputs2/lib24.txt | 1 - contrib/bc/tests/fuzzing/bc_inputs2/log.txt | 22 -- contrib/bc/tests/fuzzing/bc_inputs2/misc.txt | 13 - contrib/bc/tests/fuzzing/bc_inputs2/misc1.txt | 76 ---- contrib/bc/tests/fuzzing/bc_inputs2/misc2.txt | 110 ------ contrib/bc/tests/fuzzing/bc_inputs2/misc3.txt | 12 - contrib/bc/tests/fuzzing/bc_inputs2/modulus.txt | 69 ---- contrib/bc/tests/fuzzing/bc_inputs2/multiply.txt | 40 -- contrib/bc/tests/fuzzing/bc_inputs2/pi.txt | 4 - contrib/bc/tests/fuzzing/bc_inputs2/places.txt | 19 - contrib/bc/tests/fuzzing/bc_inputs2/power.txt | 44 --- contrib/bc/tests/fuzzing/bc_inputs2/print2.txt | 194 ---------- contrib/bc/tests/fuzzing/bc_inputs2/references.bc | 408 --------------------- contrib/bc/tests/fuzzing/bc_inputs2/scale.txt | 57 --- contrib/bc/tests/fuzzing/bc_inputs2/scientific.txt | 51 --- contrib/bc/tests/fuzzing/bc_inputs2/shift.txt | 281 -------------- contrib/bc/tests/fuzzing/bc_inputs2/sine.txt | 207 ----------- contrib/bc/tests/fuzzing/bc_inputs3/01.txt | 339 ----------------- contrib/bc/tests/fuzzing/bc_inputs3/02.txt | 1 - contrib/bc/tests/fuzzing/bc_inputs3/03.txt | 2 - contrib/bc/tests/fuzzing/bc_inputs3/04.txt | 1 - contrib/bc/tests/fuzzing/bc_inputs3/05.txt | 1 - contrib/bc/tests/fuzzing/bc_inputs3/06.txt | 1 - contrib/bc/tests/fuzzing/bc_inputs3/07.txt | 8 - contrib/bc/tests/fuzzing/bc_inputs3/08.txt | 3 - contrib/bc/tests/fuzzing/bc_inputs3/09.txt | 11 - contrib/bc/tests/fuzzing/bc_inputs3/10.txt | 1 - contrib/bc/tests/fuzzing/bc_inputs3/11.txt | 99 ----- contrib/bc/tests/fuzzing/bc_inputs3/12.txt | 2 - contrib/bc/tests/fuzzing/bc_inputs3/13.txt | 56 --- contrib/bc/tests/fuzzing/bc_inputs3/14.txt | 1 - contrib/bc/tests/fuzzing/bc_inputs3/15.txt | 3 - contrib/bc/tests/fuzzing/bc_inputs3/16.txt | 1 - contrib/bc/tests/fuzzing/bc_inputs3/17.txt | 11 - contrib/bc/tests/fuzzing/bc_inputs3/18.txt | 3 - contrib/bc/tests/fuzzing/bc_inputs3/19.txt | 5 - contrib/bc/tests/fuzzing/bc_inputs3/20.txt | 51 --- contrib/bc/tests/fuzzing/bc_inputs3/21.txt | 10 - contrib/bc/tests/fuzzing/bc_inputs3/22.txt | 2 - contrib/bc/tests/fuzzing/bc_inputs3/23.txt | Bin 1024 -> 0 bytes contrib/bc/tests/fuzzing/bc_inputs3/24.txt | 4 - contrib/bc/tests/fuzzing/bc_inputs3/sqrt.txt | 14 - contrib/bc/tests/fuzzing/bc_inputs3/strings.txt | 12 - contrib/bc/tests/fuzzing/bc_inputs3/subtract.txt | 153 -------- contrib/bc/tests/fuzzing/bc_inputs3/trunc.txt | 15 - contrib/bc/tests/fuzzing/bc_inputs3/void.txt | 20 - contrib/bc/tests/fuzzing/dc_inputs/01.txt | 2 - contrib/bc/tests/fuzzing/dc_inputs/02.txt | 5 - contrib/bc/tests/fuzzing/dc_inputs/03.txt | 2 - contrib/bc/tests/fuzzing/dc_inputs/04.txt | 9 - contrib/bc/tests/fuzzing/dc_inputs/05.txt | 3 - contrib/bc/tests/fuzzing/dc_inputs/06.txt | 1 - contrib/bc/tests/fuzzing/dc_inputs/07.txt | 3 - contrib/bc/tests/fuzzing/dc_inputs/08.txt | 1 - contrib/bc/tests/fuzzing/dc_inputs/09.txt | 9 - contrib/bc/tests/fuzzing/dc_inputs/10.txt | 11 - contrib/bc/tests/fuzzing/dc_inputs/11.txt | 4 - contrib/bc/tests/fuzzing/dc_inputs/12.txt | 2 - contrib/bc/tests/fuzzing/dc_inputs/13.txt | 7 - contrib/bc/tests/fuzzing/dc_inputs/14.txt | 7 - contrib/bc/tests/fuzzing/dc_inputs/15.txt | 11 - contrib/bc/tests/fuzzing/dc_inputs/16.txt | 1 - contrib/bc/tests/fuzzing/dc_inputs/17.txt | 20 - contrib/bc/tests/fuzzing/dc_inputs/18.txt | 3 - contrib/bc/tests/fuzzing/dc_inputs/19.txt | 1 - contrib/bc/tests/fuzzing/dc_inputs/20.txt | 3 - contrib/bc/tests/fuzzing/dc_inputs/21.txt | 5 - contrib/bc/tests/fuzzing/dc_inputs/22.txt | 36 -- contrib/bc/tests/fuzzing/dc_inputs/23.txt | 2 - contrib/bc/tests/fuzzing/dc_inputs/24.txt | 1 - contrib/bc/tests/fuzzing/dc_inputs/25.txt | 6 - contrib/bc/tests/fuzzing/dc_inputs/26.txt | 155 -------- contrib/bc/tests/fuzzing/dc_inputs/27.txt | 2 - contrib/bc/tests/fuzzing/dc_inputs/28.txt | 1 - contrib/bc/tests/fuzzing/dc_inputs/29.txt | 13 - contrib/bc/tests/fuzzing/dc_inputs/30.txt | 1 - contrib/bc/tests/fuzzing/dc_inputs/31.txt | 1 - contrib/bc/tests/fuzzing/dc_inputs/abs.txt | 7 - contrib/bc/tests/fuzzing/dc_inputs/add.txt | 33 -- contrib/bc/tests/fuzzing/dc_inputs/array.dc | 2 - contrib/bc/tests/fuzzing/dc_inputs/boolean.txt | 80 ---- contrib/bc/tests/fuzzing/dc_inputs/decimal.txt | 36 -- contrib/bc/tests/fuzzing/dc_inputs/divide.txt | 33 -- contrib/bc/tests/fuzzing/dc_inputs/divmod.txt | 64 ---- contrib/bc/tests/fuzzing/dc_inputs/else.dc | 4 - contrib/bc/tests/fuzzing/dc_inputs/engineering.txt | 19 - contrib/bc/tests/fuzzing/dc_inputs/loop.dc | 3 - contrib/bc/tests/fuzzing/dc_inputs/misc.txt | 1 - contrib/bc/tests/fuzzing/dc_inputs/modexp.txt | 103 ------ contrib/bc/tests/fuzzing/dc_inputs/modulus.txt | 70 ---- contrib/bc/tests/fuzzing/dc_inputs/multiply.txt | 42 --- contrib/bc/tests/fuzzing/dc_inputs/places.txt | 14 - contrib/bc/tests/fuzzing/dc_inputs/power.txt | 36 -- contrib/bc/tests/fuzzing/dc_inputs/quit.dc | 2 - contrib/bc/tests/fuzzing/dc_inputs/scientific.txt | 51 --- contrib/bc/tests/fuzzing/dc_inputs/shift.txt | 42 --- contrib/bc/tests/fuzzing/dc_inputs/sqrt.txt | 14 - contrib/bc/tests/fuzzing/dc_inputs/stdin.txt | 205 ----------- contrib/bc/tests/fuzzing/dc_inputs/stream.dc | 2 - contrib/bc/tests/fuzzing/dc_inputs/strings.txt | 50 --- contrib/bc/tests/fuzzing/dc_inputs/subtract.txt | 33 -- contrib/bc/tests/fuzzing/dc_inputs/trunc.txt | 11 - contrib/bc/tests/fuzzing/dc_inputs/vars.txt | 2 - contrib/bc/tests/fuzzing/dc_inputs/weird.dc | 2 - contrib/bc/tests/other.sh | 271 -------------- contrib/bc/tests/radamsa.sh | 2 +- contrib/bc/tests/randmath.py | 2 +- contrib/bc/tests/read.sh | 23 +- contrib/bc/tests/script.sh | 26 +- contrib/bc/tests/scripts.sh | 9 +- contrib/bc/tests/stdin.sh | 23 +- contrib/bc/tests/test.sh | 32 +- tests/dc/errors/30.txt | 1 - tests/dc/errors/31.txt | 1 - tests/dc/scripts/all.txt | 9 - tests/diff.sh | 51 --- tests/extra_required.txt | 7 - tests/fuzzing/bc.dict | 68 ---- tests/fuzzing/bc_inputs1/abs.txt | 7 - tests/fuzzing/bc_inputs1/add.txt | 146 -------- tests/fuzzing/bc_inputs1/arctangent.txt | 26 -- tests/fuzzing/bc_inputs1/array.bc | 60 --- tests/fuzzing/bc_inputs1/arrays.txt | 10 - tests/fuzzing/bc_inputs1/assignments.txt | 122 ------ tests/fuzzing/bc_inputs1/basic.txt | 7 - tests/fuzzing/bc_inputs1/boolean.txt | 184 ---------- tests/fuzzing/bc_inputs1/cosine.txt | 44 --- tests/fuzzing/bc_inputs1/decimal.txt | 35 -- tests/fuzzing/bc_inputs1/divide.txt | 31 -- tests/fuzzing/bc_inputs1/engineering.txt | 19 - tests/fuzzing/bc_inputs1/exponent.txt | 22 -- tests/fuzzing/bc_inputs1/functions.bc | 7 - tests/fuzzing/bc_inputs1/functions.txt | 13 - tests/fuzzing/bc_inputs1/globals.txt | 21 -- tests/fuzzing/bc_inputs1/len.bc | 48 --- tests/fuzzing/bc_inputs1/length.txt | 59 --- tests/fuzzing/bc_inputs1/lib10.txt | 4 - tests/fuzzing/bc_inputs1/lib11.txt | 4 - tests/fuzzing/bc_inputs1/lib12.txt | 1 - tests/fuzzing/bc_inputs1/lib2.txt | 15 - tests/fuzzing/bc_inputs1/lib3.txt | 6 - tests/fuzzing/bc_inputs1/lib4.txt | 10 - tests/fuzzing/bc_inputs1/lib5.txt | 2 - tests/fuzzing/bc_inputs1/lib6.txt | 5 - tests/fuzzing/bc_inputs1/lib7.txt | 12 - tests/fuzzing/bc_inputs1/lib8.txt | 3 - tests/fuzzing/bc_inputs2/lib13.txt | 1 - tests/fuzzing/bc_inputs2/lib14.txt | 1 - tests/fuzzing/bc_inputs2/lib15.txt | 1 - tests/fuzzing/bc_inputs2/lib16.txt | 1 - tests/fuzzing/bc_inputs2/lib19.txt | 1 - tests/fuzzing/bc_inputs2/lib20.txt | 1 - tests/fuzzing/bc_inputs2/lib21.txt | 1 - tests/fuzzing/bc_inputs2/lib22.txt | 1 - tests/fuzzing/bc_inputs2/lib23.txt | 1 - tests/fuzzing/bc_inputs2/lib24.txt | 1 - tests/fuzzing/bc_inputs2/log.txt | 22 -- tests/fuzzing/bc_inputs2/misc.txt | 13 - tests/fuzzing/bc_inputs2/misc1.txt | 76 ---- tests/fuzzing/bc_inputs2/misc2.txt | 110 ------ tests/fuzzing/bc_inputs2/misc3.txt | 12 - tests/fuzzing/bc_inputs2/modulus.txt | 69 ---- tests/fuzzing/bc_inputs2/multiply.txt | 40 -- tests/fuzzing/bc_inputs2/pi.txt | 4 - tests/fuzzing/bc_inputs2/places.txt | 19 - tests/fuzzing/bc_inputs2/power.txt | 44 --- tests/fuzzing/bc_inputs2/print2.txt | 194 ---------- tests/fuzzing/bc_inputs2/references.bc | 408 --------------------- tests/fuzzing/bc_inputs2/scale.txt | 57 --- tests/fuzzing/bc_inputs2/scientific.txt | 51 --- tests/fuzzing/bc_inputs2/shift.txt | 281 -------------- tests/fuzzing/bc_inputs2/sine.txt | 207 ----------- tests/fuzzing/bc_inputs3/01.txt | 339 ----------------- tests/fuzzing/bc_inputs3/02.txt | 1 - tests/fuzzing/bc_inputs3/03.txt | 2 - tests/fuzzing/bc_inputs3/04.txt | 1 - tests/fuzzing/bc_inputs3/05.txt | 1 - tests/fuzzing/bc_inputs3/06.txt | 1 - tests/fuzzing/bc_inputs3/07.txt | 8 - tests/fuzzing/bc_inputs3/08.txt | 3 - tests/fuzzing/bc_inputs3/09.txt | 11 - tests/fuzzing/bc_inputs3/10.txt | 1 - tests/fuzzing/bc_inputs3/11.txt | 99 ----- tests/fuzzing/bc_inputs3/12.txt | 2 - tests/fuzzing/bc_inputs3/13.txt | 56 --- tests/fuzzing/bc_inputs3/14.txt | 1 - tests/fuzzing/bc_inputs3/15.txt | 3 - tests/fuzzing/bc_inputs3/16.txt | 1 - tests/fuzzing/bc_inputs3/17.txt | 11 - tests/fuzzing/bc_inputs3/18.txt | 3 - tests/fuzzing/bc_inputs3/19.txt | 5 - tests/fuzzing/bc_inputs3/20.txt | 51 --- tests/fuzzing/bc_inputs3/21.txt | 10 - tests/fuzzing/bc_inputs3/22.txt | 2 - tests/fuzzing/bc_inputs3/23.txt | Bin 1024 -> 0 bytes tests/fuzzing/bc_inputs3/24.txt | 4 - tests/fuzzing/bc_inputs3/sqrt.txt | 14 - tests/fuzzing/bc_inputs3/strings.txt | 12 - tests/fuzzing/bc_inputs3/subtract.txt | 153 -------- tests/fuzzing/bc_inputs3/trunc.txt | 15 - tests/fuzzing/bc_inputs3/void.txt | 20 - tests/fuzzing/dc_inputs/01.txt | 2 - tests/fuzzing/dc_inputs/02.txt | 5 - tests/fuzzing/dc_inputs/03.txt | 2 - tests/fuzzing/dc_inputs/04.txt | 9 - tests/fuzzing/dc_inputs/05.txt | 3 - tests/fuzzing/dc_inputs/06.txt | 1 - tests/fuzzing/dc_inputs/07.txt | 3 - tests/fuzzing/dc_inputs/08.txt | 1 - tests/fuzzing/dc_inputs/09.txt | 9 - tests/fuzzing/dc_inputs/10.txt | 11 - tests/fuzzing/dc_inputs/11.txt | 4 - tests/fuzzing/dc_inputs/12.txt | 2 - tests/fuzzing/dc_inputs/13.txt | 7 - tests/fuzzing/dc_inputs/14.txt | 7 - tests/fuzzing/dc_inputs/15.txt | 11 - tests/fuzzing/dc_inputs/16.txt | 1 - tests/fuzzing/dc_inputs/17.txt | 20 - tests/fuzzing/dc_inputs/18.txt | 3 - tests/fuzzing/dc_inputs/19.txt | 1 - tests/fuzzing/dc_inputs/20.txt | 3 - tests/fuzzing/dc_inputs/21.txt | 5 - tests/fuzzing/dc_inputs/22.txt | 36 -- tests/fuzzing/dc_inputs/23.txt | 2 - tests/fuzzing/dc_inputs/24.txt | 1 - tests/fuzzing/dc_inputs/25.txt | 6 - tests/fuzzing/dc_inputs/26.txt | 155 -------- tests/fuzzing/dc_inputs/27.txt | 2 - tests/fuzzing/dc_inputs/28.txt | 1 - tests/fuzzing/dc_inputs/29.txt | 13 - tests/fuzzing/dc_inputs/30.txt | 1 - tests/fuzzing/dc_inputs/31.txt | 1 - tests/fuzzing/dc_inputs/abs.txt | 7 - tests/fuzzing/dc_inputs/add.txt | 33 -- tests/fuzzing/dc_inputs/array.dc | 2 - tests/fuzzing/dc_inputs/boolean.txt | 80 ---- tests/fuzzing/dc_inputs/decimal.txt | 36 -- tests/fuzzing/dc_inputs/divide.txt | 33 -- tests/fuzzing/dc_inputs/divmod.txt | 64 ---- tests/fuzzing/dc_inputs/else.dc | 4 - tests/fuzzing/dc_inputs/engineering.txt | 19 - tests/fuzzing/dc_inputs/loop.dc | 3 - tests/fuzzing/dc_inputs/misc.txt | 1 - tests/fuzzing/dc_inputs/modexp.txt | 103 ------ tests/fuzzing/dc_inputs/modulus.txt | 70 ---- tests/fuzzing/dc_inputs/multiply.txt | 42 --- tests/fuzzing/dc_inputs/places.txt | 14 - tests/fuzzing/dc_inputs/power.txt | 36 -- tests/fuzzing/dc_inputs/quit.dc | 2 - tests/fuzzing/dc_inputs/scientific.txt | 51 --- tests/fuzzing/dc_inputs/shift.txt | 42 --- tests/fuzzing/dc_inputs/sqrt.txt | 14 - tests/fuzzing/dc_inputs/stdin.txt | 205 ----------- tests/fuzzing/dc_inputs/stream.dc | 2 - tests/fuzzing/dc_inputs/strings.txt | 50 --- tests/fuzzing/dc_inputs/subtract.txt | 33 -- tests/fuzzing/dc_inputs/trunc.txt | 11 - tests/fuzzing/dc_inputs/vars.txt | 2 - tests/fuzzing/dc_inputs/weird.dc | 2 - tests/other.sh | 271 -------------- 470 files changed, 821 insertions(+), 11313 deletions(-) diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..c674e06fda50 --- /dev/null +++ b/.gitignore @@ -0,0 +1,27 @@ +*.a +*.core +*.o +*.so +*.swp +*~ +_.tinderbox.* +_.universe-toolchain +_.amd64.* +_.arm.* +_.arm64.* +_.i386.* +_.ia64.* +_.mips.* +_.pc98.* +_.powerpc.* +_.riscv.* +_.sparc64.* +_.sun4v.* +GPATH +GRTAGS +GTAGS +ID +cscope.files +cscope.in.out +cscope.out +cscope.po.out diff --git a/README.md b/README.md new file mode 100644 index 000000000000..72bd634cd813 --- /dev/null +++ b/README.md @@ -0,0 +1,82 @@ +FreeBSD Source: +--------------- +This is the top level of the FreeBSD source directory. This file +was last revised on: +$FreeBSD$ + +FreeBSD is an operating system used to power modern servers, +desktops, and embedded platforms. A large community has +continually developed it for more than thirty years. Its +advanced networking, security, and storage features have +made FreeBSD the platform of choice for many of the +busiest web sites and most pervasive embedded networking +and storage devices. + +For copyright information, please see the file COPYRIGHT in this +directory. Additional copyright information also exists for some +sources in this tree - please see the specific source directories for +more information. + +The Makefile in this directory supports a number of targets for +building components (or all) of the FreeBSD source tree. See build(7), config(8), +https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html, and +https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html +for more information, including setting make(1) variables. + +Source Roadmap: +--------------- +``` +bin System/user commands. + +cddl Various commands and libraries under the Common Development + and Distribution License. + +contrib Packages contributed by 3rd parties. + +crypto Cryptography stuff (see crypto/README). + +etc Template files for /etc. + +gnu Various commands and libraries under the GNU Public License. + Please see gnu/COPYING* for more information. + +include System include files. + +kerberos5 Kerberos5 (Heimdal) package. + +lib System libraries. + +libexec System daemons. + +release Release building Makefile & associated tools. + +rescue Build system for statically linked /rescue utilities. + +sbin System commands. + +secure Cryptographic libraries and commands. + +share Shared resources. + +stand Boot loader sources. + +sys Kernel sources. + +sys//conf Kernel configuration files. GENERIC is the configuration + used in release builds. NOTES contains documentation of + all possible entries. + +tests Regression tests which can be run by Kyua. See tests/README + for additional information. + +tools Utilities for regression testing and miscellaneous tasks. + +usr.bin User commands. + +usr.sbin System administration commands. +``` + +For information on synchronizing your source tree with one or more of +the FreeBSD Project's development branches, please see: + + https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/current-stable.html diff --git a/contrib/bc/.gitignore b/contrib/bc/.gitignore index 5c2bbae866c0..fb9bc5ab6aa2 100644 --- a/contrib/bc/.gitignore +++ b/contrib/bc/.gitignore @@ -34,13 +34,6 @@ config.mak timeconst.bc Makefile -tests/fuzzing/bc_outputs1/* -tests/fuzzing/bc_outputs2/* -tests/fuzzing/bc_outputs3/* -tests/fuzzing/dc_outputs/* -tests/bc_outputs/* -tests/dc_outputs/* - .gdb_history # Ignore the generated test files @@ -64,7 +57,5 @@ perf.data.old *.html *.profraw -core.* - cscope*.out tags diff --git a/contrib/bc/LICENSE.md b/contrib/bc/LICENSE.md index 269e131cc81d..1681a053e0de 100644 --- a/contrib/bc/LICENSE.md +++ b/contrib/bc/LICENSE.md @@ -1,6 +1,6 @@ # License -Copyright (c) 2018-2021 Gavin D. Howard +Copyright (c) 2018-2020 Gavin D. Howard Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -31,7 +31,7 @@ copyrights and license: Copyright (c) 2010-2014, Salvatore Sanfilippo
Copyright (c) 2010-2013, Pieter Noordhuis
Copyright (c) 2018 rain-1
-Copyright (c) 2018-2021, Gavin D. Howard +Copyright (c) 2018-2020, Gavin D. Howard Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -53,51 +53,3 @@ 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. - -## Rand - -The files `src/rand.c` and `include/rand.h` are under the following copyrights -and license: - -Copyright (c) 2014-2017 Melissa O'Neill and PCG Project contributors -Copyright (c) 2018-2021 Gavin D. Howard - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -## `safe-install.sh` - -The file `safe-install.sh` is under the following copyright and license: - -Copyright (c) 2021 Rich Felker - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the “Software”), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/contrib/bc/Makefile.in b/contrib/bc/Makefile.in index 8ae982bd99fe..d17e74163397 100644 --- a/contrib/bc/Makefile.in +++ b/contrib/bc/Makefile.in @@ -1,7 +1,7 @@ # # SPDX-License-Identifier: BSD-2-Clause # -# Copyright (c) 2018-2021 Gavin D. Howard and contributors. +# Copyright (c) 2018-2020 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -29,7 +29,7 @@ # .POSIX: -VERSION = 3.2.6 +VERSION = 3.2.4 SRC = %%SRC%% OBJ = %%OBJ%% @@ -41,13 +41,6 @@ BC_ENABLED = %%BC_ENABLED%% DC_ENABLED_NAME = DC_ENABLED DC_ENABLED = %%DC_ENABLED%% -HEADERS = include/args.h include/file.h include/lang.h include/lex.h include/num.h include/opt.h include/parse.h include/program.h include/read.h include/status.h include/vector.h include/vm.h -BC_HEADERS = include/bc.h -DC_HEADERS = include/dc.h -HISTORY_HEADERS = include/history.h -EXTRA_MATH_HEADERS = include/rand.h -LIBRARY_HEADERS = include/bcl.h include/library.h - GEN_DIR = gen GEN = %%GEN%% GEN_EXEC = $(GEN_DIR)/$(GEN) @@ -89,11 +82,6 @@ DC = dc BC_EXEC = $(BIN)/$(EXEC_PREFIX)$(BC) DC_EXEC = $(BIN)/$(EXEC_PREFIX)$(DC) -BC_TEST_OUTPUTS = tests/bc_outputs -BC_FUZZ_OUTPUTS = tests/fuzzing/bc_outputs1 tests/fuzzing/bc_outputs2 tests/fuzzing/bc_outputs3 -DC_TEST_OUTPUTS = tests/dc_outputs -DC_FUZZ_OUTPUTS = tests/fuzzing/dc_outputs - LIB = libbcl LIB_NAME = $(LIB).a LIBBC = $(BIN)/$(LIB_NAME) @@ -137,9 +125,6 @@ BC_ENABLE_NLS = %%NLS%% BC_ENABLE_PROMPT = %%PROMPT%% BC_LONG_BIT = %%LONG_BIT%% -BC_ENABLE_AFL = %%FUZZ%% -BC_ENABLE_MEMCHECK = %%MEMCHECK%% - RM = rm MKDIR = mkdir @@ -153,8 +138,6 @@ LOCALE_UNINSTALL = ./locale_uninstall.sh VALGRIND_ARGS = --error-exitcode=100 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all -TEST_STARS = "***********************************************************************" - BC_NUM_KARATSUBA_LEN = %%KARATSUBA_LEN%% CPPFLAGS1 = -D$(BC_ENABLED_NAME)=$(BC_ENABLED) -D$(DC_ENABLED_NAME)=$(DC_ENABLED) @@ -164,8 +147,7 @@ CPPFLAGS4 = $(CPPFLAGS3) -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 CPPFLAGS5 = $(CPPFLAGS4) -DBC_NUM_KARATSUBA_LEN=$(BC_NUM_KARATSUBA_LEN) CPPFLAGS6 = $(CPPFLAGS5) -DBC_ENABLE_NLS=$(BC_ENABLE_NLS) -DBC_ENABLE_PROMPT=$(BC_ENABLE_PROMPT) CPPFLAGS7 = $(CPPFLAGS6) -D$(BC_ENABLE_EXTRA_MATH_NAME)=$(BC_ENABLE_EXTRA_MATH) -CPPFLAGS8 = $(CPPFLAGS7) -DBC_ENABLE_HISTORY=$(BC_ENABLE_HISTORY) -DBC_ENABLE_LIBRARY=$(BC_ENABLE_LIBRARY) -CPPFLAGS = $(CPPFLAGS8) -DBC_ENABLE_MEMCHECK=$(BC_ENABLE_MEMCHECK) -DBC_ENABLE_AFL=$(BC_ENABLE_AFL) +CPPFLAGS = $(CPPFLAGS7) -DBC_ENABLE_HISTORY=$(BC_ENABLE_HISTORY) -DBC_ENABLE_LIBRARY=$(BC_ENABLE_LIBRARY) CFLAGS = $(CPPFLAGS) %%CPPFLAGS%% %%CFLAGS%% LDFLAGS = %%LDFLAGS%% @@ -177,15 +159,20 @@ HOSTCC = %%HOSTCC%% BC_LIB_C_ARGS = bc_lib bc_lib_name $(BC_ENABLED_NAME) 1 BC_LIB2_C_ARGS = bc_lib2 bc_lib2_name "$(BC_ENABLED_NAME) && $(BC_ENABLE_EXTRA_MATH_NAME)" 1 -OBJS = $(DC_HELP_O) $(BC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ) +OBJS = $(BC_HELP_O) $(DC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ) +OBJ_TARGETS = $(DC_HELP_O) $(BC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ) -all: %%DEFAULT_TARGET%% +.c.o: + $(CC) $(CFLAGS) -o $@ -c $< + +all: %%ALL_PREREQ%% -%%DEFAULT_TARGET%%: %%DEFAULT_TARGET_PREREQS%% - %%DEFAULT_TARGET_CMD%% +execs: make_bin $(OBJ_TARGETS) + $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(EXEC) + %%LINK%% -%%SECOND_TARGET%%: %%SECOND_TARGET_PREREQS%% - %%SECOND_TARGET_CMD%% +library: make_bin $(OBJ) $(BC_LIB_O) $(BC_LIB2_O) + ar -r -cu $(LIBBC) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ) $(GEN_EXEC): %%GEN_EXEC_TARGET%% @@ -193,32 +180,18 @@ $(GEN_EXEC): $(BC_LIB_C): $(GEN_EXEC) $(BC_LIB) $(GEN_EMU) $(GEN_EXEC) $(BC_LIB) $(BC_LIB_C) $(BC_LIB_C_ARGS) -$(BC_LIB_O): $(BC_LIB_C) - $(CC) $(CFLAGS) -o $@ -c $< - $(BC_LIB2_C): $(GEN_EXEC) $(BC_LIB2) $(GEN_EMU) $(GEN_EXEC) $(BC_LIB2) $(BC_LIB2_C) $(BC_LIB2_C_ARGS) -$(BC_LIB2_O): $(BC_LIB2_C) - $(CC) $(CFLAGS) -o $@ -c $< - $(BC_HELP_C): $(GEN_EXEC) $(BC_HELP) $(GEN_EMU) $(GEN_EXEC) $(BC_HELP) $(BC_HELP_C) bc_help "" $(BC_ENABLED_NAME) -$(BC_HELP_O): $(BC_HELP_C) - $(CC) $(CFLAGS) -o $@ -c $< - $(DC_HELP_C): $(GEN_EXEC) $(DC_HELP) $(GEN_EMU) $(GEN_EXEC) $(DC_HELP) $(DC_HELP_C) dc_help "" $(DC_ENABLED_NAME) -$(DC_HELP_O): $(DC_HELP_C) - $(CC) $(CFLAGS) -o $@ -c $< - -$(BIN): +make_bin: $(MKDIR) -p $(BIN) -headers: %%HEADERS%% - help: @printf 'available targets:\n' @printf '\n' @@ -249,68 +222,41 @@ help: @printf ' valgrind_dc runs the dc test suite, if dc has been built,\n' @printf ' through valgrind\n' -run_all_tests: - %%BC_ALL_TESTS%% - %%TIMECONST_ALL_TESTS%% - %%DC_ALL_TESTS%% - check: test test: %%TESTS%% -test_bc: test_bc_header test_bc_tests test_bc_scripts test_bc_stdin test_bc_read test_bc_errors test_bc_other - @printf '\nAll bc tests passed.\n\n$(TEST_STARS)\n' - -test_bc_tests:%%BC_TESTS%% - -test_bc_scripts:%%BC_SCRIPT_TESTS%% - -test_bc_stdin: - @sh tests/stdin.sh bc %%BC_TEST_EXEC%% - -test_bc_read: - @sh tests/read.sh bc %%BC_TEST_EXEC%% - -test_bc_errors: - @sh tests/errors.sh bc %%BC_TEST_EXEC%% - -test_bc_other: - @sh tests/other.sh bc %%BC_TEST_EXEC%% - -test_bc_header: - @printf '$(TEST_STARS)\n\nRunning bc tests...\n\n' +test_bc: + %%BC_TEST%% -test_dc: test_dc_header test_dc_tests test_dc_scripts test_dc_stdin test_dc_read test_dc_errors test_dc_other - @printf '\nAll dc tests passed.\n\n$(TEST_STARS)\n' +test_dc: + %%DC_TEST%% -test_dc_tests:%%DC_TESTS%% +time_test: time_test_bc timeconst time_test_dc -test_dc_scripts:%%DC_SCRIPT_TESTS%% +time_test_bc: + %%BC_TIME_TEST%% -test_dc_stdin: - @sh tests/stdin.sh dc %%DC_TEST_EXEC%% - -test_dc_read: - @sh tests/read.sh dc %%DC_TEST_EXEC%% - -test_dc_errors: - @sh tests/errors.sh dc %%DC_TEST_EXEC%% - -test_dc_other: - @sh tests/other.sh dc %%DC_TEST_EXEC%% - -test_dc_header: - @printf '$(TEST_STARS)\n\nRunning dc tests...\n\n' +time_test_dc: + %%DC_TIME_TEST%% timeconst: %%TIMECONST%% -library_test: $(LIBBC) +library_test: library $(CC) $(CFLAGS) $(BCL_TEST_C) $(LIBBC) -o $(BCL_TEST) test_library: library_test $(BCL_TEST) +valgrind: valgrind_bc valgrind_dc + +valgrind_bc: + %%VG_BC_TEST%% + +valgrind_dc: + %%VG_DC_TEST%% + karatsuba: %%KARATSUBA%% @@ -350,8 +296,6 @@ clean:%%CLEAN_PREREQS%% @$(RM) -f $(BC_LIB2_C) $(BC_LIB2_O) @$(RM) -f $(BC_HELP_C) $(BC_HELP_O) @$(RM) -f $(DC_HELP_C) $(DC_HELP_O) - @$(RM) -fr $(BC_TEST_OUTPUTS) $(DC_TEST_OUTPUTS) - @$(RM) -fr $(BC_FUZZ_OUTPUTS) $(DC_FUZZ_OUTPUTS) clean_config: clean @printf 'Cleaning config...\n' diff --git a/contrib/bc/NEWS.md b/contrib/bc/NEWS.md index 5982defb754c..f4fc2f5779ce 100644 --- a/contrib/bc/NEWS.md +++ b/contrib/bc/NEWS.md @@ -1,40 +1,5 @@ # News -## 3.2.6 - -This is a production release that fixes the build on FreeBSD. - -There was a syntax error in `configure.sh` that the Linux shell did not catch, -and FreeBSD depends on the existence of `tests/all.sh`. - -All users that already upgraded to `3.2.5` should update to this release, with -my apologies for the poor release of `3.2.5`. Other users should skip `3.2.5` in -favor of this version. - -## 3.2.5 - -This is a production release that fixes several bugs and adds a couple small -things. - -The two most important bugs were bugs that causes `dc` to access memory -out-of-bounds (crash in debug builds). This was found by upgrading to `afl++` -from `afl`. Both were caused by a failure to distinguish between the same two -cases. - -Another bug was the failure to put all of the licenses in the `LICENSE.md` file. - -Third, some warnings by `scan-build` were found and eliminated. This needed one -big change: `bc` and `dc` now bail out as fast as possible on fatal errors *** 16957 LINES SKIPPED *** From owner-dev-commits-src-branches@freebsd.org Fri Feb 5 21:15:18 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E4CBD52A434; Fri, 5 Feb 2021 21:15: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 4DXSqp68SWz4YMG; Fri, 5 Feb 2021 21:15:18 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C68A125A29; Fri, 5 Feb 2021 21:15:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 115LFIPc089188; Fri, 5 Feb 2021 21:15:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 115LFIer089187; Fri, 5 Feb 2021 21:15:18 GMT (envelope-from git) Date: Fri, 5 Feb 2021 21:15:18 GMT Message-Id: <202102052115.115LFIer089187@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Stefan Eßer Subject: git: 106efdb060ae - stable/13 - Vendor import of Gavin Howard's bc version 3.2.6 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 106efdb060ae523a88caf5ddc3516500cf5b1d64 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Feb 2021 21:15:19 -0000 The branch stable/13 has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=106efdb060ae523a88caf5ddc3516500cf5b1d64 commit 106efdb060ae523a88caf5ddc3516500cf5b1d64 Author: Stefan Eßer AuthorDate: 2021-01-31 19:56:48 +0000 Commit: Stefan Eßer CommitDate: 2021-02-05 21:01:25 +0000 Vendor import of Gavin Howard's bc version 3.2.6 (cherry picked from commit 47a52dc4d48f259ab7d9f9ba6b65f4f2331a22dc) Second attempt after revert of a previous commit that affected files with similar names in unrelated directories. Thanks go to Martin Birgmaier for reporting the issue and identifying the cause of git getting confused: files from the root of the vendor files were associated with files in the FreeBSD base root directory. Martin Birgmaier points out that to make this cherry-pick succeed, the option -Xsubtree=contrib/bc has to be passed to prevent files outside that path to be considered. --- contrib/bc/.gitignore | 9 + contrib/bc/LICENSE.md | 52 ++- contrib/bc/Makefile.in | 122 ++++-- contrib/bc/NEWS.md | 35 ++ contrib/bc/NOTICE.md | 2 +- contrib/bc/README.md | 1 + contrib/bc/configure.sh | 348 +++++++++++++++--- contrib/bc/exec-install.sh | 2 +- contrib/bc/functions.sh | 90 +++-- contrib/bc/gen/bc_help.txt | 2 +- contrib/bc/gen/dc_help.txt | 2 +- contrib/bc/gen/lib.bc | 2 +- contrib/bc/gen/lib2.bc | 2 +- contrib/bc/gen/strgen.c | 4 +- contrib/bc/gen/strgen.sh | 4 +- contrib/bc/include/args.h | 2 +- contrib/bc/include/bc.h | 2 +- contrib/bc/include/bcl.h | 2 +- contrib/bc/include/dc.h | 2 +- contrib/bc/include/file.h | 2 +- contrib/bc/include/history.h | 2 +- contrib/bc/include/lang.h | 2 +- contrib/bc/include/lex.h | 2 +- contrib/bc/include/library.h | 2 +- contrib/bc/include/num.h | 4 +- contrib/bc/include/opt.h | 2 +- contrib/bc/include/parse.h | 2 +- contrib/bc/include/program.h | 2 +- contrib/bc/include/rand.h | 31 +- contrib/bc/include/read.h | 2 +- contrib/bc/include/status.h | 14 +- contrib/bc/include/vector.h | 3 +- contrib/bc/include/vm.h | 19 +- contrib/bc/karatsuba.py | 2 +- contrib/bc/link.sh | 2 +- contrib/bc/locale_install.sh | 2 +- contrib/bc/locale_uninstall.sh | 2 +- contrib/bc/locales/de_DE.ISO8859-1.msg | 2 +- contrib/bc/locales/de_DE.UTF-8.msg | 2 +- contrib/bc/locales/en_US.msg | 2 +- contrib/bc/locales/es_ES.ISO8859-1.msg | 2 +- contrib/bc/locales/es_ES.UTF-8.msg | 2 +- contrib/bc/locales/fr_FR.ISO8859-1.msg | 2 +- contrib/bc/locales/fr_FR.UTF-8.msg | 2 +- contrib/bc/locales/ja_JP.UTF-8.msg | 2 +- contrib/bc/locales/ja_JP.eucJP.msg | 2 +- contrib/bc/locales/nl_NL.ISO8859-1.msg | 2 +- contrib/bc/locales/nl_NL.UTF-8.msg | 2 +- contrib/bc/locales/pl_PL.ISO8859-2.msg | 2 +- contrib/bc/locales/pl_PL.UTF-8.msg | 2 +- contrib/bc/locales/pt_PT.ISO8859-1.msg | 2 +- contrib/bc/locales/pt_PT.UTF-8.msg | 2 +- contrib/bc/locales/ru_RU.CP1251.msg | 2 +- contrib/bc/locales/ru_RU.CP866.msg | 2 +- contrib/bc/locales/ru_RU.ISO8859-5.msg | 2 +- contrib/bc/locales/ru_RU.KOI8-R.msg | 2 +- contrib/bc/locales/ru_RU.UTF-8.msg | 2 +- contrib/bc/locales/zh_CN.GB18030.msg | 2 +- contrib/bc/locales/zh_CN.GB2312.msg | 2 +- contrib/bc/locales/zh_CN.GBK.msg | 2 +- contrib/bc/locales/zh_CN.UTF-8.msg | 2 +- contrib/bc/locales/zh_CN.eucCN.msg | 2 +- contrib/bc/manpage.sh | 2 +- contrib/bc/manuals/bc.1.md.in | 7 +- contrib/bc/manuals/bc/A.1 | 8 +- contrib/bc/manuals/bc/A.1.md | 7 +- contrib/bc/manuals/bc/E.1 | 4 +- contrib/bc/manuals/bc/E.1.md | 2 +- contrib/bc/manuals/bc/EH.1 | 4 +- contrib/bc/manuals/bc/EH.1.md | 2 +- contrib/bc/manuals/bc/EHN.1 | 4 +- contrib/bc/manuals/bc/EHN.1.md | 2 +- contrib/bc/manuals/bc/EHNP.1 | 4 +- contrib/bc/manuals/bc/EHNP.1.md | 2 +- contrib/bc/manuals/bc/EHP.1 | 4 +- contrib/bc/manuals/bc/EHP.1.md | 2 +- contrib/bc/manuals/bc/EN.1 | 4 +- contrib/bc/manuals/bc/EN.1.md | 2 +- contrib/bc/manuals/bc/ENP.1 | 4 +- contrib/bc/manuals/bc/ENP.1.md | 2 +- contrib/bc/manuals/bc/EP.1 | 4 +- contrib/bc/manuals/bc/EP.1.md | 2 +- contrib/bc/manuals/bc/H.1 | 8 +- contrib/bc/manuals/bc/H.1.md | 7 +- contrib/bc/manuals/bc/HN.1 | 8 +- contrib/bc/manuals/bc/HN.1.md | 7 +- contrib/bc/manuals/bc/HNP.1 | 8 +- contrib/bc/manuals/bc/HNP.1.md | 7 +- contrib/bc/manuals/bc/HP.1 | 8 +- contrib/bc/manuals/bc/HP.1.md | 7 +- contrib/bc/manuals/bc/N.1 | 8 +- contrib/bc/manuals/bc/N.1.md | 7 +- contrib/bc/manuals/bc/NP.1 | 8 +- contrib/bc/manuals/bc/NP.1.md | 7 +- contrib/bc/manuals/bc/P.1 | 8 +- contrib/bc/manuals/bc/P.1.md | 7 +- contrib/bc/manuals/bcl.3 | 4 +- contrib/bc/manuals/bcl.3.md | 2 +- contrib/bc/manuals/dc.1.md.in | 7 +- contrib/bc/manuals/dc/A.1 | 10 +- contrib/bc/manuals/dc/A.1.md | 7 +- contrib/bc/manuals/dc/E.1 | 4 +- contrib/bc/manuals/dc/E.1.md | 2 +- contrib/bc/manuals/dc/EH.1 | 4 +- contrib/bc/manuals/dc/EH.1.md | 2 +- contrib/bc/manuals/dc/EHN.1 | 4 +- contrib/bc/manuals/dc/EHN.1.md | 2 +- contrib/bc/manuals/dc/EHNP.1 | 4 +- contrib/bc/manuals/dc/EHNP.1.md | 2 +- contrib/bc/manuals/dc/EHP.1 | 4 +- contrib/bc/manuals/dc/EHP.1.md | 2 +- contrib/bc/manuals/dc/EN.1 | 4 +- contrib/bc/manuals/dc/EN.1.md | 2 +- contrib/bc/manuals/dc/ENP.1 | 4 +- contrib/bc/manuals/dc/ENP.1.md | 2 +- contrib/bc/manuals/dc/EP.1 | 4 +- contrib/bc/manuals/dc/EP.1.md | 2 +- contrib/bc/manuals/dc/H.1 | 10 +- contrib/bc/manuals/dc/H.1.md | 7 +- contrib/bc/manuals/dc/HN.1 | 10 +- contrib/bc/manuals/dc/HN.1.md | 7 +- contrib/bc/manuals/dc/HNP.1 | 10 +- contrib/bc/manuals/dc/HNP.1.md | 7 +- contrib/bc/manuals/dc/HP.1 | 10 +- contrib/bc/manuals/dc/HP.1.md | 7 +- contrib/bc/manuals/dc/N.1 | 10 +- contrib/bc/manuals/dc/N.1.md | 7 +- contrib/bc/manuals/dc/NP.1 | 10 +- contrib/bc/manuals/dc/NP.1.md | 7 +- contrib/bc/manuals/dc/P.1 | 10 +- contrib/bc/manuals/dc/P.1.md | 7 +- contrib/bc/manuals/header.txt | 2 +- contrib/bc/manuals/header_bc.txt | 2 +- contrib/bc/manuals/header_bcl.txt | 2 +- contrib/bc/manuals/header_dc.txt | 2 +- contrib/bc/release.sh | 18 +- contrib/bc/src/args.c | 2 +- contrib/bc/src/bc.c | 2 +- contrib/bc/src/bc_lex.c | 2 +- contrib/bc/src/bc_parse.c | 2 +- contrib/bc/src/data.c | 4 +- contrib/bc/src/dc.c | 2 +- contrib/bc/src/dc_lex.c | 6 +- contrib/bc/src/dc_parse.c | 2 +- contrib/bc/src/file.c | 4 +- contrib/bc/src/history.c | 15 +- contrib/bc/src/lang.c | 14 +- contrib/bc/src/lex.c | 4 +- contrib/bc/src/library.c | 12 +- contrib/bc/src/main.c | 13 +- contrib/bc/src/num.c | 10 +- contrib/bc/src/opt.c | 2 +- contrib/bc/src/parse.c | 8 +- contrib/bc/src/program.c | 31 +- contrib/bc/src/rand.c | 42 +-- contrib/bc/src/read.c | 6 +- contrib/bc/src/vector.c | 8 +- contrib/bc/src/vm.c | 86 ++++- contrib/bc/tests/afl.py | 22 +- contrib/bc/tests/all.sh | 191 +--------- contrib/bc/tests/bc/all.txt | 6 +- contrib/bc/tests/bc/scripts/all.txt | 15 + contrib/bc/tests/bc/timeconst.sh | 9 +- contrib/bc/tests/bcl.c | 2 +- contrib/bc/tests/dc/errors/30.txt | 1 + contrib/bc/tests/dc/errors/31.txt | 1 + contrib/bc/tests/dc/scripts/all.txt | 9 + contrib/bc/tests/diff.sh | 51 +++ contrib/bc/tests/errors.sh | 20 +- contrib/bc/tests/extra_required.txt | 7 + contrib/bc/tests/fuzzing/bc.dict | 68 ++++ contrib/bc/tests/fuzzing/bc_inputs1/abs.txt | 7 + contrib/bc/tests/fuzzing/bc_inputs1/add.txt | 146 ++++++++ contrib/bc/tests/fuzzing/bc_inputs1/arctangent.txt | 26 ++ contrib/bc/tests/fuzzing/bc_inputs1/array.bc | 60 +++ contrib/bc/tests/fuzzing/bc_inputs1/arrays.txt | 10 + .../bc/tests/fuzzing/bc_inputs1/assignments.txt | 122 ++++++ contrib/bc/tests/fuzzing/bc_inputs1/basic.txt | 7 + contrib/bc/tests/fuzzing/bc_inputs1/boolean.txt | 184 ++++++++++ contrib/bc/tests/fuzzing/bc_inputs1/cosine.txt | 44 +++ contrib/bc/tests/fuzzing/bc_inputs1/decimal.txt | 35 ++ contrib/bc/tests/fuzzing/bc_inputs1/divide.txt | 31 ++ .../bc/tests/fuzzing/bc_inputs1/engineering.txt | 19 + contrib/bc/tests/fuzzing/bc_inputs1/exponent.txt | 22 ++ contrib/bc/tests/fuzzing/bc_inputs1/functions.bc | 7 + contrib/bc/tests/fuzzing/bc_inputs1/functions.txt | 13 + contrib/bc/tests/fuzzing/bc_inputs1/globals.txt | 21 ++ contrib/bc/tests/fuzzing/bc_inputs1/len.bc | 48 +++ contrib/bc/tests/fuzzing/bc_inputs1/length.txt | 59 +++ contrib/bc/tests/fuzzing/bc_inputs1/lib10.txt | 4 + contrib/bc/tests/fuzzing/bc_inputs1/lib11.txt | 4 + contrib/bc/tests/fuzzing/bc_inputs1/lib12.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs1/lib2.txt | 15 + contrib/bc/tests/fuzzing/bc_inputs1/lib3.txt | 6 + contrib/bc/tests/fuzzing/bc_inputs1/lib4.txt | 10 + contrib/bc/tests/fuzzing/bc_inputs1/lib5.txt | 2 + contrib/bc/tests/fuzzing/bc_inputs1/lib6.txt | 5 + contrib/bc/tests/fuzzing/bc_inputs1/lib7.txt | 12 + contrib/bc/tests/fuzzing/bc_inputs1/lib8.txt | 3 + contrib/bc/tests/fuzzing/bc_inputs2/lib13.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib14.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib15.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib16.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib19.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib20.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib21.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib22.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib23.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib24.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/log.txt | 22 ++ contrib/bc/tests/fuzzing/bc_inputs2/misc.txt | 13 + contrib/bc/tests/fuzzing/bc_inputs2/misc1.txt | 76 ++++ contrib/bc/tests/fuzzing/bc_inputs2/misc2.txt | 110 ++++++ contrib/bc/tests/fuzzing/bc_inputs2/misc3.txt | 12 + contrib/bc/tests/fuzzing/bc_inputs2/modulus.txt | 69 ++++ contrib/bc/tests/fuzzing/bc_inputs2/multiply.txt | 40 ++ contrib/bc/tests/fuzzing/bc_inputs2/pi.txt | 4 + contrib/bc/tests/fuzzing/bc_inputs2/places.txt | 19 + contrib/bc/tests/fuzzing/bc_inputs2/power.txt | 44 +++ contrib/bc/tests/fuzzing/bc_inputs2/print2.txt | 194 ++++++++++ contrib/bc/tests/fuzzing/bc_inputs2/references.bc | 408 +++++++++++++++++++++ contrib/bc/tests/fuzzing/bc_inputs2/scale.txt | 57 +++ contrib/bc/tests/fuzzing/bc_inputs2/scientific.txt | 51 +++ contrib/bc/tests/fuzzing/bc_inputs2/shift.txt | 281 ++++++++++++++ contrib/bc/tests/fuzzing/bc_inputs2/sine.txt | 207 +++++++++++ contrib/bc/tests/fuzzing/bc_inputs3/01.txt | 339 +++++++++++++++++ contrib/bc/tests/fuzzing/bc_inputs3/02.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs3/03.txt | 2 + contrib/bc/tests/fuzzing/bc_inputs3/04.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs3/05.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs3/06.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs3/07.txt | 8 + contrib/bc/tests/fuzzing/bc_inputs3/08.txt | 3 + contrib/bc/tests/fuzzing/bc_inputs3/09.txt | 11 + contrib/bc/tests/fuzzing/bc_inputs3/10.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs3/11.txt | 99 +++++ contrib/bc/tests/fuzzing/bc_inputs3/12.txt | 2 + contrib/bc/tests/fuzzing/bc_inputs3/13.txt | 56 +++ contrib/bc/tests/fuzzing/bc_inputs3/14.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs3/15.txt | 3 + contrib/bc/tests/fuzzing/bc_inputs3/16.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs3/17.txt | 11 + contrib/bc/tests/fuzzing/bc_inputs3/18.txt | 3 + contrib/bc/tests/fuzzing/bc_inputs3/19.txt | 5 + contrib/bc/tests/fuzzing/bc_inputs3/20.txt | 51 +++ contrib/bc/tests/fuzzing/bc_inputs3/21.txt | 10 + contrib/bc/tests/fuzzing/bc_inputs3/22.txt | 2 + contrib/bc/tests/fuzzing/bc_inputs3/23.txt | Bin 0 -> 1024 bytes contrib/bc/tests/fuzzing/bc_inputs3/24.txt | 4 + contrib/bc/tests/fuzzing/bc_inputs3/sqrt.txt | 14 + contrib/bc/tests/fuzzing/bc_inputs3/strings.txt | 12 + contrib/bc/tests/fuzzing/bc_inputs3/subtract.txt | 153 ++++++++ contrib/bc/tests/fuzzing/bc_inputs3/trunc.txt | 15 + contrib/bc/tests/fuzzing/bc_inputs3/void.txt | 20 + contrib/bc/tests/fuzzing/dc_inputs/01.txt | 2 + contrib/bc/tests/fuzzing/dc_inputs/02.txt | 5 + contrib/bc/tests/fuzzing/dc_inputs/03.txt | 2 + contrib/bc/tests/fuzzing/dc_inputs/04.txt | 9 + contrib/bc/tests/fuzzing/dc_inputs/05.txt | 3 + contrib/bc/tests/fuzzing/dc_inputs/06.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/07.txt | 3 + contrib/bc/tests/fuzzing/dc_inputs/08.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/09.txt | 9 + contrib/bc/tests/fuzzing/dc_inputs/10.txt | 11 + contrib/bc/tests/fuzzing/dc_inputs/11.txt | 4 + contrib/bc/tests/fuzzing/dc_inputs/12.txt | 2 + contrib/bc/tests/fuzzing/dc_inputs/13.txt | 7 + contrib/bc/tests/fuzzing/dc_inputs/14.txt | 7 + contrib/bc/tests/fuzzing/dc_inputs/15.txt | 11 + contrib/bc/tests/fuzzing/dc_inputs/16.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/17.txt | 20 + contrib/bc/tests/fuzzing/dc_inputs/18.txt | 3 + contrib/bc/tests/fuzzing/dc_inputs/19.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/20.txt | 3 + contrib/bc/tests/fuzzing/dc_inputs/21.txt | 5 + contrib/bc/tests/fuzzing/dc_inputs/22.txt | 36 ++ contrib/bc/tests/fuzzing/dc_inputs/23.txt | 2 + contrib/bc/tests/fuzzing/dc_inputs/24.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/25.txt | 6 + contrib/bc/tests/fuzzing/dc_inputs/26.txt | 155 ++++++++ contrib/bc/tests/fuzzing/dc_inputs/27.txt | 2 + contrib/bc/tests/fuzzing/dc_inputs/28.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/29.txt | 13 + contrib/bc/tests/fuzzing/dc_inputs/30.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/31.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/abs.txt | 7 + contrib/bc/tests/fuzzing/dc_inputs/add.txt | 33 ++ contrib/bc/tests/fuzzing/dc_inputs/array.dc | 2 + contrib/bc/tests/fuzzing/dc_inputs/boolean.txt | 80 ++++ contrib/bc/tests/fuzzing/dc_inputs/decimal.txt | 36 ++ contrib/bc/tests/fuzzing/dc_inputs/divide.txt | 33 ++ contrib/bc/tests/fuzzing/dc_inputs/divmod.txt | 64 ++++ contrib/bc/tests/fuzzing/dc_inputs/else.dc | 4 + contrib/bc/tests/fuzzing/dc_inputs/engineering.txt | 19 + contrib/bc/tests/fuzzing/dc_inputs/loop.dc | 3 + contrib/bc/tests/fuzzing/dc_inputs/misc.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/modexp.txt | 103 ++++++ contrib/bc/tests/fuzzing/dc_inputs/modulus.txt | 70 ++++ contrib/bc/tests/fuzzing/dc_inputs/multiply.txt | 42 +++ contrib/bc/tests/fuzzing/dc_inputs/places.txt | 14 + contrib/bc/tests/fuzzing/dc_inputs/power.txt | 36 ++ contrib/bc/tests/fuzzing/dc_inputs/quit.dc | 2 + contrib/bc/tests/fuzzing/dc_inputs/scientific.txt | 51 +++ contrib/bc/tests/fuzzing/dc_inputs/shift.txt | 42 +++ contrib/bc/tests/fuzzing/dc_inputs/sqrt.txt | 14 + contrib/bc/tests/fuzzing/dc_inputs/stdin.txt | 205 +++++++++++ contrib/bc/tests/fuzzing/dc_inputs/stream.dc | 2 + contrib/bc/tests/fuzzing/dc_inputs/strings.txt | 50 +++ contrib/bc/tests/fuzzing/dc_inputs/subtract.txt | 33 ++ contrib/bc/tests/fuzzing/dc_inputs/trunc.txt | 11 + contrib/bc/tests/fuzzing/dc_inputs/vars.txt | 2 + contrib/bc/tests/fuzzing/dc_inputs/weird.dc | 2 + contrib/bc/tests/other.sh | 271 ++++++++++++++ contrib/bc/tests/radamsa.sh | 2 +- contrib/bc/tests/randmath.py | 2 +- contrib/bc/tests/read.sh | 23 +- contrib/bc/tests/script.sh | 26 +- contrib/bc/tests/scripts.sh | 9 +- contrib/bc/tests/stdin.sh | 23 +- contrib/bc/tests/test.sh | 32 +- 320 files changed, 6246 insertions(+), 712 deletions(-) diff --git a/contrib/bc/.gitignore b/contrib/bc/.gitignore index fb9bc5ab6aa2..5c2bbae866c0 100644 --- a/contrib/bc/.gitignore +++ b/contrib/bc/.gitignore @@ -34,6 +34,13 @@ config.mak timeconst.bc Makefile +tests/fuzzing/bc_outputs1/* +tests/fuzzing/bc_outputs2/* +tests/fuzzing/bc_outputs3/* +tests/fuzzing/dc_outputs/* +tests/bc_outputs/* +tests/dc_outputs/* + .gdb_history # Ignore the generated test files @@ -57,5 +64,7 @@ perf.data.old *.html *.profraw +core.* + cscope*.out tags diff --git a/contrib/bc/LICENSE.md b/contrib/bc/LICENSE.md index 1681a053e0de..269e131cc81d 100644 --- a/contrib/bc/LICENSE.md +++ b/contrib/bc/LICENSE.md @@ -1,6 +1,6 @@ # License -Copyright (c) 2018-2020 Gavin D. Howard +Copyright (c) 2018-2021 Gavin D. Howard Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -31,7 +31,7 @@ copyrights and license: Copyright (c) 2010-2014, Salvatore Sanfilippo
Copyright (c) 2010-2013, Pieter Noordhuis
Copyright (c) 2018 rain-1
-Copyright (c) 2018-2020, Gavin D. Howard +Copyright (c) 2018-2021, Gavin D. Howard Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -53,3 +53,51 @@ 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. + +## Rand + +The files `src/rand.c` and `include/rand.h` are under the following copyrights +and license: + +Copyright (c) 2014-2017 Melissa O'Neill and PCG Project contributors +Copyright (c) 2018-2021 Gavin D. Howard + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +## `safe-install.sh` + +The file `safe-install.sh` is under the following copyright and license: + +Copyright (c) 2021 Rich Felker + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Software”), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/contrib/bc/Makefile.in b/contrib/bc/Makefile.in index d17e74163397..8ae982bd99fe 100644 --- a/contrib/bc/Makefile.in +++ b/contrib/bc/Makefile.in @@ -1,7 +1,7 @@ # # SPDX-License-Identifier: BSD-2-Clause # -# Copyright (c) 2018-2020 Gavin D. Howard and contributors. +# Copyright (c) 2018-2021 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -29,7 +29,7 @@ # .POSIX: -VERSION = 3.2.4 +VERSION = 3.2.6 SRC = %%SRC%% OBJ = %%OBJ%% @@ -41,6 +41,13 @@ BC_ENABLED = %%BC_ENABLED%% DC_ENABLED_NAME = DC_ENABLED DC_ENABLED = %%DC_ENABLED%% +HEADERS = include/args.h include/file.h include/lang.h include/lex.h include/num.h include/opt.h include/parse.h include/program.h include/read.h include/status.h include/vector.h include/vm.h +BC_HEADERS = include/bc.h +DC_HEADERS = include/dc.h +HISTORY_HEADERS = include/history.h +EXTRA_MATH_HEADERS = include/rand.h +LIBRARY_HEADERS = include/bcl.h include/library.h + GEN_DIR = gen GEN = %%GEN%% GEN_EXEC = $(GEN_DIR)/$(GEN) @@ -82,6 +89,11 @@ DC = dc BC_EXEC = $(BIN)/$(EXEC_PREFIX)$(BC) DC_EXEC = $(BIN)/$(EXEC_PREFIX)$(DC) +BC_TEST_OUTPUTS = tests/bc_outputs +BC_FUZZ_OUTPUTS = tests/fuzzing/bc_outputs1 tests/fuzzing/bc_outputs2 tests/fuzzing/bc_outputs3 +DC_TEST_OUTPUTS = tests/dc_outputs +DC_FUZZ_OUTPUTS = tests/fuzzing/dc_outputs + LIB = libbcl LIB_NAME = $(LIB).a LIBBC = $(BIN)/$(LIB_NAME) @@ -125,6 +137,9 @@ BC_ENABLE_NLS = %%NLS%% BC_ENABLE_PROMPT = %%PROMPT%% BC_LONG_BIT = %%LONG_BIT%% +BC_ENABLE_AFL = %%FUZZ%% +BC_ENABLE_MEMCHECK = %%MEMCHECK%% + RM = rm MKDIR = mkdir @@ -138,6 +153,8 @@ LOCALE_UNINSTALL = ./locale_uninstall.sh VALGRIND_ARGS = --error-exitcode=100 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all +TEST_STARS = "***********************************************************************" + BC_NUM_KARATSUBA_LEN = %%KARATSUBA_LEN%% CPPFLAGS1 = -D$(BC_ENABLED_NAME)=$(BC_ENABLED) -D$(DC_ENABLED_NAME)=$(DC_ENABLED) @@ -147,7 +164,8 @@ CPPFLAGS4 = $(CPPFLAGS3) -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 CPPFLAGS5 = $(CPPFLAGS4) -DBC_NUM_KARATSUBA_LEN=$(BC_NUM_KARATSUBA_LEN) CPPFLAGS6 = $(CPPFLAGS5) -DBC_ENABLE_NLS=$(BC_ENABLE_NLS) -DBC_ENABLE_PROMPT=$(BC_ENABLE_PROMPT) CPPFLAGS7 = $(CPPFLAGS6) -D$(BC_ENABLE_EXTRA_MATH_NAME)=$(BC_ENABLE_EXTRA_MATH) -CPPFLAGS = $(CPPFLAGS7) -DBC_ENABLE_HISTORY=$(BC_ENABLE_HISTORY) -DBC_ENABLE_LIBRARY=$(BC_ENABLE_LIBRARY) +CPPFLAGS8 = $(CPPFLAGS7) -DBC_ENABLE_HISTORY=$(BC_ENABLE_HISTORY) -DBC_ENABLE_LIBRARY=$(BC_ENABLE_LIBRARY) +CPPFLAGS = $(CPPFLAGS8) -DBC_ENABLE_MEMCHECK=$(BC_ENABLE_MEMCHECK) -DBC_ENABLE_AFL=$(BC_ENABLE_AFL) CFLAGS = $(CPPFLAGS) %%CPPFLAGS%% %%CFLAGS%% LDFLAGS = %%LDFLAGS%% @@ -159,20 +177,15 @@ HOSTCC = %%HOSTCC%% BC_LIB_C_ARGS = bc_lib bc_lib_name $(BC_ENABLED_NAME) 1 BC_LIB2_C_ARGS = bc_lib2 bc_lib2_name "$(BC_ENABLED_NAME) && $(BC_ENABLE_EXTRA_MATH_NAME)" 1 -OBJS = $(BC_HELP_O) $(DC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ) -OBJ_TARGETS = $(DC_HELP_O) $(BC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ) +OBJS = $(DC_HELP_O) $(BC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ) -.c.o: - $(CC) $(CFLAGS) -o $@ -c $< - -all: %%ALL_PREREQ%% +all: %%DEFAULT_TARGET%% -execs: make_bin $(OBJ_TARGETS) - $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(EXEC) - %%LINK%% +%%DEFAULT_TARGET%%: %%DEFAULT_TARGET_PREREQS%% + %%DEFAULT_TARGET_CMD%% -library: make_bin $(OBJ) $(BC_LIB_O) $(BC_LIB2_O) - ar -r -cu $(LIBBC) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ) +%%SECOND_TARGET%%: %%SECOND_TARGET_PREREQS%% + %%SECOND_TARGET_CMD%% $(GEN_EXEC): %%GEN_EXEC_TARGET%% @@ -180,18 +193,32 @@ $(GEN_EXEC): $(BC_LIB_C): $(GEN_EXEC) $(BC_LIB) $(GEN_EMU) $(GEN_EXEC) $(BC_LIB) $(BC_LIB_C) $(BC_LIB_C_ARGS) +$(BC_LIB_O): $(BC_LIB_C) + $(CC) $(CFLAGS) -o $@ -c $< + $(BC_LIB2_C): $(GEN_EXEC) $(BC_LIB2) $(GEN_EMU) $(GEN_EXEC) $(BC_LIB2) $(BC_LIB2_C) $(BC_LIB2_C_ARGS) +$(BC_LIB2_O): $(BC_LIB2_C) + $(CC) $(CFLAGS) -o $@ -c $< + $(BC_HELP_C): $(GEN_EXEC) $(BC_HELP) $(GEN_EMU) $(GEN_EXEC) $(BC_HELP) $(BC_HELP_C) bc_help "" $(BC_ENABLED_NAME) +$(BC_HELP_O): $(BC_HELP_C) + $(CC) $(CFLAGS) -o $@ -c $< + $(DC_HELP_C): $(GEN_EXEC) $(DC_HELP) $(GEN_EMU) $(GEN_EXEC) $(DC_HELP) $(DC_HELP_C) dc_help "" $(DC_ENABLED_NAME) -make_bin: +$(DC_HELP_O): $(DC_HELP_C) + $(CC) $(CFLAGS) -o $@ -c $< + +$(BIN): $(MKDIR) -p $(BIN) +headers: %%HEADERS%% + help: @printf 'available targets:\n' @printf '\n' @@ -222,41 +249,68 @@ help: @printf ' valgrind_dc runs the dc test suite, if dc has been built,\n' @printf ' through valgrind\n' +run_all_tests: + %%BC_ALL_TESTS%% + %%TIMECONST_ALL_TESTS%% + %%DC_ALL_TESTS%% + check: test test: %%TESTS%% -test_bc: - %%BC_TEST%% +test_bc: test_bc_header test_bc_tests test_bc_scripts test_bc_stdin test_bc_read test_bc_errors test_bc_other + @printf '\nAll bc tests passed.\n\n$(TEST_STARS)\n' + +test_bc_tests:%%BC_TESTS%% + +test_bc_scripts:%%BC_SCRIPT_TESTS%% + +test_bc_stdin: + @sh tests/stdin.sh bc %%BC_TEST_EXEC%% + +test_bc_read: + @sh tests/read.sh bc %%BC_TEST_EXEC%% + +test_bc_errors: + @sh tests/errors.sh bc %%BC_TEST_EXEC%% + +test_bc_other: + @sh tests/other.sh bc %%BC_TEST_EXEC%% + +test_bc_header: + @printf '$(TEST_STARS)\n\nRunning bc tests...\n\n' -test_dc: - %%DC_TEST%% +test_dc: test_dc_header test_dc_tests test_dc_scripts test_dc_stdin test_dc_read test_dc_errors test_dc_other + @printf '\nAll dc tests passed.\n\n$(TEST_STARS)\n' -time_test: time_test_bc timeconst time_test_dc +test_dc_tests:%%DC_TESTS%% -time_test_bc: - %%BC_TIME_TEST%% +test_dc_scripts:%%DC_SCRIPT_TESTS%% -time_test_dc: - %%DC_TIME_TEST%% +test_dc_stdin: + @sh tests/stdin.sh dc %%DC_TEST_EXEC%% + +test_dc_read: + @sh tests/read.sh dc %%DC_TEST_EXEC%% + +test_dc_errors: + @sh tests/errors.sh dc %%DC_TEST_EXEC%% + +test_dc_other: + @sh tests/other.sh dc %%DC_TEST_EXEC%% + +test_dc_header: + @printf '$(TEST_STARS)\n\nRunning dc tests...\n\n' timeconst: %%TIMECONST%% -library_test: library +library_test: $(LIBBC) $(CC) $(CFLAGS) $(BCL_TEST_C) $(LIBBC) -o $(BCL_TEST) test_library: library_test $(BCL_TEST) -valgrind: valgrind_bc valgrind_dc - -valgrind_bc: - %%VG_BC_TEST%% - -valgrind_dc: - %%VG_DC_TEST%% - karatsuba: %%KARATSUBA%% @@ -296,6 +350,8 @@ clean:%%CLEAN_PREREQS%% @$(RM) -f $(BC_LIB2_C) $(BC_LIB2_O) @$(RM) -f $(BC_HELP_C) $(BC_HELP_O) @$(RM) -f $(DC_HELP_C) $(DC_HELP_O) + @$(RM) -fr $(BC_TEST_OUTPUTS) $(DC_TEST_OUTPUTS) + @$(RM) -fr $(BC_FUZZ_OUTPUTS) $(DC_FUZZ_OUTPUTS) clean_config: clean @printf 'Cleaning config...\n' diff --git a/contrib/bc/NEWS.md b/contrib/bc/NEWS.md index f4fc2f5779ce..5982defb754c 100644 --- a/contrib/bc/NEWS.md +++ b/contrib/bc/NEWS.md @@ -1,5 +1,40 @@ # News +## 3.2.6 + +This is a production release that fixes the build on FreeBSD. + +There was a syntax error in `configure.sh` that the Linux shell did not catch, +and FreeBSD depends on the existence of `tests/all.sh`. + +All users that already upgraded to `3.2.5` should update to this release, with +my apologies for the poor release of `3.2.5`. Other users should skip `3.2.5` in +favor of this version. + +## 3.2.5 + +This is a production release that fixes several bugs and adds a couple small +things. + +The two most important bugs were bugs that causes `dc` to access memory +out-of-bounds (crash in debug builds). This was found by upgrading to `afl++` +from `afl`. Both were caused by a failure to distinguish between the same two +cases. + +Another bug was the failure to put all of the licenses in the `LICENSE.md` file. + +Third, some warnings by `scan-build` were found and eliminated. This needed one +big change: `bc` and `dc` now bail out as fast as possible on fatal errors +instead of unwinding the stack. + +Fourth, the pseudo-random number now attempts to seed itself with `/dev/random` +if `/dev/urandom` fails. + +Finally, this release has a few quality-of-life changes to the build system. The +usage should not change at all; the only thing that changed was making sure the +`Makefile.in` was written to rebuild properly when headers changed and to not +rebuild when not necessary. + ## 3.2.4 This is a production release that fixes a warning on `gcc` 6 or older, which diff --git a/contrib/bc/NOTICE.md b/contrib/bc/NOTICE.md index 92117daa9a6c..56d2935ab4b3 100644 --- a/contrib/bc/NOTICE.md +++ b/contrib/bc/NOTICE.md @@ -1,6 +1,6 @@ # Notice -Copyright 2018-2020 Gavin D. Howard and contributors. +Copyright 2018-2021 Gavin D. Howard and contributors. ## Contributors diff --git a/contrib/bc/README.md b/contrib/bc/README.md index 6f3c3f252cbc..beda88d23f90 100644 --- a/contrib/bc/README.md +++ b/contrib/bc/README.md @@ -39,6 +39,7 @@ Systems that are known to work: * Mac OSX * Solaris* (as long as the Solaris version supports POSIX 2008) * AIX +* HP-UX* (except for history) Please submit bug reports if this `bc` does not build out of the box on any system besides Windows. If Windows binaries are needed, they can be found at diff --git a/contrib/bc/configure.sh b/contrib/bc/configure.sh index b6caf3debba3..ae1675cde97d 100755 --- a/contrib/bc/configure.sh +++ b/contrib/bc/configure.sh @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: BSD-2-Clause # -# Copyright (c) 2018-2020 Gavin D. Howard and contributors. +# Copyright (c) 2018-2021 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -33,6 +33,8 @@ script=$(basename "$script") . "$scriptdir/functions.sh" +cd "$scriptdir" + usage() { if [ $# -gt 0 ]; then @@ -48,7 +50,7 @@ usage() { printf 'usage:\n' printf ' %s -h\n' "$script" printf ' %s --help\n' "$script" - printf ' %s [-a|-bD|-dB|-c] [-EfgGHlMNPT] [-O OPT_LEVEL] [-k KARATSUBA_LEN]\n' "$script" + printf ' %s [-a|-bD|-dB|-c] [-CEfgGHlmMNPtTvz] [-O OPT_LEVEL] [-k KARATSUBA_LEN]\n' "$script" printf ' %s \\\n' "$script" printf ' [--library|--bc-only --disable-dc|--dc-only --disable-bc|--coverage]\\\n' printf ' [--force --debug --disable-extra-math --disable-generated-tests] \\\n' @@ -73,6 +75,8 @@ usage() { printf ' Generate test coverage code. Requires gcov and regcovr.\n' printf ' It is an error if either "-b" ("-D") or "-d" ("-B") is specified.\n' printf ' Requires a compiler that use gcc-compatible coverage options\n' + printf ' -C, --disable-clean\n' + printf ' Disable the clean that configure.sh does before configure.\n' printf ' -d, --dc-only\n' printf ' Build dc only. It is an error if "-b", "--bc-only", "-D", or\n' printf ' "--disable-dc" are specified too.\n' @@ -107,6 +111,8 @@ usage() { printf ' Installs all locales, regardless of how many are on the system. This\n' printf ' option is useful for package maintainers who want to make sure that\n' printf ' a package contains all of the locales that end users might need.\n' + printf ' -m, --enable-memcheck\n' + printf ' Enable memcheck mode, to ensure no memory leaks. For development only.\n' printf ' -M, --disable-man-pages\n' printf ' Disable installing manpages.\n' printf ' -N, --disable-nls\n' @@ -119,9 +125,15 @@ usage() { printf ' Disables the prompt in the built bc. The prompt will never show up,\n' printf ' or in other words, it will be permanently disabled and cannot be\n' printf ' enabled.\n' + printf ' -t, --enable-test-timing\n' + printf ' Enable the timing of tests. This is for development only.\n' printf ' -T, --disable-strip\n' printf ' Disable stripping symbols from the compiled binary or binaries.\n' printf ' Stripping symbols only happens when debug mode is off.\n' + printf ' -v, --enable-valgrind\n' + printf ' Enable a build appropriate for valgrind. For development only.\n' + printf ' -z, --enable-fuzz-mode\n' + printf ' Enable fuzzing mode. THIS IS FOR DEVELOPMENT ONLY.\n' printf ' --prefix PREFIX\n' printf ' The prefix to install to. Overrides "$PREFIX" if it exists.\n' printf ' If PREFIX is "/usr", install path will be "/usr/bin".\n' @@ -277,6 +289,23 @@ replace() { substring_replace "$_replace_str" "%%$_replace_needle%%" "$_replace_replacement" } +find_src_files() { + + if [ "$#" -ge 1 ] && [ "$1" != "" ]; then + + while [ "$#" -ge 1 ]; do + _find_src_files_a="${1## }" + shift + _find_src_files_args="$_find_src_files_args ! -path src/${_find_src_files_a}" + done + + else + _find_src_files_args="-print" + fi + + printf '%s\n' $(find src/ -depth -name "*.c" $_find_src_files_args) +} + gen_file_list() { if [ "$#" -lt 1 ]; then @@ -291,15 +320,9 @@ gen_file_list() { cd "$scriptdir" if [ "$#" -ge 1 ]; then - - while [ "$#" -ge 1 ]; do - a="$1" - shift - args="$args ! -path src/${a}" - done - + _gen_file_list_unneeded="$@" else - args="-print" + _gen_file_list_unneeded="" fi _gen_file_list_needle_src="SRC" @@ -307,7 +330,7 @@ gen_file_list() { _gen_file_list_needle_gcda="GCDA" _gen_file_list_needle_gcno="GCNO" - _gen_file_list_replacement=$(find src/ -depth -name "*.c" $args | tr '\n' ' ') + _gen_file_list_replacement=$(find_src_files $_gen_file_list_unneeded | tr '\n' ' ') _gen_file_list_contents=$(replace "$_gen_file_list_contents" \ "$_gen_file_list_needle_src" "$_gen_file_list_replacement") @@ -328,6 +351,101 @@ gen_file_list() { printf '%s\n' "$_gen_file_list_contents" } +gen_tests() { + + _gen_tests_name="$1" + shift + + _gen_tests_uname="$1" + shift + + _gen_tests_extra_math="$1" + shift + + _gen_tests_time_tests="$1" + shift + + _gen_tests_extra_required=$(cat tests/extra_required.txt) + + for _gen_tests_t in $(cat "$scriptdir/tests/$_gen_tests_name/all.txt"); do + + if [ "$_gen_tests_extra_math" -eq 0 ]; then + + if [ -z "${_gen_tests_extra_required##*$_gen_tests_t*}" ]; then + printf 'test_%s_%s:\n\t@printf "Skipping %s %s\\n"\n\n' \ + "$_gen_tests_name" "$_gen_tests_t" "$_gen_tests_name" \ + "$_gen_tests_t" >> "$scriptdir/Makefile" + continue + fi + + fi + + printf 'test_%s_%s:\n\t@sh tests/test.sh %s %s %s %s %s\n\n' \ + "$_gen_tests_name" "$_gen_tests_t" "$_gen_tests_name" \ + "$_gen_tests_t" "$generate_tests" "$time_tests" \ + "$*" >> "$scriptdir/Makefile" + + done +} + +gen_test_targets() { + + _gen_test_targets_name="$1" + shift + + _gen_test_targets_tests=$(cat "$scriptdir/tests/${_gen_test_targets_name}/all.txt") + + for _gen_test_targets_t in $_gen_test_targets_tests; do + printf ' test_%s_%s' "$_gen_test_targets_name" "$_gen_test_targets_t" + done + + printf '\n' +} + +gen_script_tests() { + + _gen_script_tests_name="$1" + shift + + _gen_script_tests_extra_math="$1" + shift + + _gen_script_tests_generate="$1" + shift + + _gen_script_tests_time="$1" + shift + + _gen_script_tests_tests=$(cat "$scriptdir/tests/$_gen_script_tests_name/scripts/all.txt") + + for _gen_script_tests_f in $_gen_script_tests_tests; do + + _gen_script_tests_b=$(basename "$_gen_script_tests_f" ".${_gen_script_tests_name}") + + printf 'test_%s_script_%s:\n\t@sh tests/script.sh %s %s %s 1 %s %s %s\n\n' \ + "$_gen_script_tests_name" "$_gen_script_tests_b" "$_gen_script_tests_name" \ + "$_gen_script_tests_f" "$_gen_script_tests_extra_math" "$_gen_script_tests_generate" \ + "$_gen_script_tests_time" "$*" >> "$scriptdir/Makefile" + done +} + +gen_script_test_targets() { + + _gen_script_test_targets_name="$1" + shift + + _gen_script_test_targets_tests=$(cat "$scriptdir/tests/$_gen_script_test_targets_name/scripts/all.txt") + + for _gen_script_test_targets_f in $_gen_script_test_targets_tests; do + _gen_script_test_targets_b=$(basename "$_gen_script_test_targets_f" \ + ".$_gen_script_test_targets_name") + printf ' test_%s_script_%s' "$_gen_script_test_targets_name" \ + "$_gen_script_test_targets_b" + done + + printf '\n' +} + bc_only=0 dc_only=0 coverage=0 @@ -344,14 +462,20 @@ force=0 strip_bin=1 all_locales=0 library=0 +fuzz=0 +time_tests=0 +vg=0 +memcheck=0 +clean=1 -while getopts "abBcdDEfgGhHk:lMNO:PST-" opt; do +while getopts "abBcdDEfgGhHk:lMmNO:PStTvz-" opt; do case "$opt" in a) library=1 ;; b) bc_only=1 ;; B) dc_only=1 ;; c) coverage=1 ;; + C) clean=0 ;; d) dc_only=1 ;; *** 10727 LINES SKIPPED *** From owner-dev-commits-src-branches@freebsd.org Sat Feb 6 02:33:46 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 299E1531294; Sat, 6 Feb 2021 02:33: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 4DXbvF6xdzz4vLL; Sat, 6 Feb 2021 02:33:45 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E07351C04; Sat, 6 Feb 2021 02:33:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1162XjiH005858; Sat, 6 Feb 2021 02:33:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1162XjpB005857; Sat, 6 Feb 2021 02:33:45 GMT (envelope-from git) Date: Sat, 6 Feb 2021 02:33:45 GMT Message-Id: <202102060233.1162XjpB005857@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Piotr Kubaj Subject: git: 154207a59bd2 - stable/13 - powerpc64le: readd COMPAT_FREEBSD11 and COMPAT_FREEBSD12 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pkubaj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 154207a59bd296d7192c9e4659d64992606e9cd2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Feb 2021 02:33:46 -0000 The branch stable/13 has been updated by pkubaj (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=154207a59bd296d7192c9e4659d64992606e9cd2 commit 154207a59bd296d7192c9e4659d64992606e9cd2 Author: Piotr Kubaj AuthorDate: 2021-02-06 02:21:55 +0000 Commit: Piotr Kubaj CommitDate: 2021-02-06 02:33:36 +0000 powerpc64le: readd COMPAT_FREEBSD11 and COMPAT_FREEBSD12 lang/rust needs COMPAT_FREEBSD11 to build, even though powerpc64le itself is supported only since 13.0. I also corrected a comment, because if we ever have lib32 for powerpc64le, it will be for powerpcle. Reviewed by: bdragon (on IRC) (cherry picked from commit 8b804ee616b4c8810015b69e37e31ef0c4161511) --- sys/powerpc/conf/GENERIC64LE | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/powerpc/conf/GENERIC64LE b/sys/powerpc/conf/GENERIC64LE index fd87f22df334..d3b00a63c31f 100644 --- a/sys/powerpc/conf/GENERIC64LE +++ b/sys/powerpc/conf/GENERIC64LE @@ -65,7 +65,9 @@ options TMPFS #Efficient memory filesystem options GEOM_PART_APM #Apple Partition Maps. options GEOM_PART_GPT #GUID Partition Tables. options GEOM_LABEL #Provides labelization -#options COMPAT_FREEBSD32 #Compatible with FreeBSD/powerpc binaries +#options COMPAT_FREEBSD32 #Compatible with FreeBSD/powerpcle binaries +options COMPAT_FREEBSD11 # Compatible with FreeBSD11 +options COMPAT_FREEBSD12 # Compatible with FreeBSD12 options SCSI_DELAY=5000 #Delay (in ms) before probing SCSI options KTRACE #ktrace(1) syscall trace support options STACK #stack(9) support From owner-dev-commits-src-branches@freebsd.org Sat Feb 6 06:10:06 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C778B53BA25; Sat, 6 Feb 2021 06:10: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 4DXhht5G5gz3Prp; Sat, 6 Feb 2021 06:10:06 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A612147D9; Sat, 6 Feb 2021 06:10:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1166A6tf085681; Sat, 6 Feb 2021 06:10:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1166A6hq085678; Sat, 6 Feb 2021 06:10:06 GMT (envelope-from git) Date: Sat, 6 Feb 2021 06:10:06 GMT Message-Id: <202102060610.1166A6hq085678@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Peter Grehan Subject: git: 6136a10e355a - stable/13 - Always clamp curve25519 keys prior to use. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: grehan X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6136a10e355a7a837edecbccbed04c34b4bc32c9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Feb 2021 06:10:06 -0000 The branch stable/13 has been updated by grehan: URL: https://cgit.FreeBSD.org/src/commit/?id=6136a10e355a7a837edecbccbed04c34b4bc32c9 commit 6136a10e355a7a837edecbccbed04c34b4bc32c9 Author: Peter Grehan AuthorDate: 2021-02-03 09:05:09 +0000 Commit: Peter Grehan CommitDate: 2021-02-06 04:01:18 +0000 Always clamp curve25519 keys prior to use. This fixes an issue where a private key contained bits that should have been cleared by the clamping process, but were passed through to the scalar multiplication routine and resulted in an invalid public key. Issue diagnosed (and an initial fix proposed) by shamaz.mazum in PR 252894. This fix suggested by Jason Donenfeld. PR: 252894 Reported by: shamaz.mazum (cherry picked from commit 5aaea4b99e5cc724e97e24a68876e8768d3d8012) --- sys/dev/if_wg/module/curve25519.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/if_wg/module/curve25519.c b/sys/dev/if_wg/module/curve25519.c index e21d00bd2818..16f0b0337eb6 100644 --- a/sys/dev/if_wg/module/curve25519.c +++ b/sys/dev/if_wg/module/curve25519.c @@ -767,6 +767,7 @@ void curve25519_generic(u8 out[CURVE25519_KEY_SIZE], u8 e[32]; memcpy(e, scalar, 32); + curve25519_clamp_secret(e); /* The following implementation was transcribed to Coq and proven to * correspond to unary scalar multiplication in affine coordinates given From owner-dev-commits-src-branches@freebsd.org Sun Feb 7 12:10:48 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9F88A52AF89; Sun, 7 Feb 2021 12:10: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 4DYSfc3mYHz4YSs; Sun, 7 Feb 2021 12:10:48 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 741792409E; Sun, 7 Feb 2021 12:10:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 117CAmSW037640; Sun, 7 Feb 2021 12:10:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 117CAmqP037639; Sun, 7 Feb 2021 12:10:48 GMT (envelope-from git) Date: Sun, 7 Feb 2021 12:10:48 GMT Message-Id: <202102071210.117CAmqP037639@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 5c9700a7fe3f - stable/12 - Add a manual page for axp(4) / AMD 10G Ethernet driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 5c9700a7fe3f80132a78628f10dd6bcf1b663a71 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Feb 2021 12:10:48 -0000 The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=5c9700a7fe3f80132a78628f10dd6bcf1b663a71 commit 5c9700a7fe3f80132a78628f10dd6bcf1b663a71 Author: Gordon Bergling AuthorDate: 2021-01-24 13:57:16 +0000 Commit: Gordon Bergling CommitDate: 2021-02-07 12:10:22 +0000 Add a manual page for axp(4) / AMD 10G Ethernet driver Submitted by: Rajesh Kumar Reviewed by: bcr, brueffer, rpokala Differential Revision: https://reviews.freebsd.org/D27800 (cherry picked from commit 1f73236b0302cdf47630c99687c2dfd4e514ab54) --- share/man/man4/Makefile | 1 + share/man/man4/axp.4 | 225 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 226 insertions(+) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 5a3365a888b0..f3b227efcfde 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -74,6 +74,7 @@ MAN= aac.4 \ aue.4 \ axe.4 \ axge.4 \ + axp.4 \ bce.4 \ bcma.4 \ bfe.4 \ diff --git a/share/man/man4/axp.4 b/share/man/man4/axp.4 new file mode 100644 index 000000000000..598e6a968e7a --- /dev/null +++ b/share/man/man4/axp.4 @@ -0,0 +1,225 @@ +.\" Copyright (c) 2020, Advanced Micro Devices Inc. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions are met: +.\" +.\" 1. Redistributions of source code must retain the above copyright notice, +.\" this list of conditions and the following disclaimer. +.\" +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" 3. Neither the name of Advanced Micro Devices Inc., nor the names of its +.\" contributors may be used to endorse or promote products derived from +.\" this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. +.\" +.\" * Other names and brands may be claimed as the property of others. +.\" +.Dd January 24, 2021 +.Dt AXP 4 +.Os +.Sh NAME +.Nm axp +.Nd "Advanced Micro Devices 10G Ethernet driver" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device iflib" +.Cd "device axp" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_axp_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver enables PCI-E based 10G Ethernet controller inbuilt in the +AMD EPYC processors. +.Pp +The following features are supported. +.Pp +.Bl -bullet -compact +.It +1G/10G SFP+ Link +.It +Jumbo frames (9000 Bytes) +.It +Transmit and Receive checksum offload +.It +TCP segmentation offload (TSO) +.It +VLAN tag insertion/extraction +.It +VLAN checksum offload +.It +VLAN TSO +.It +Receive side steering (RSS) +.It +IPV4 and IPV6 capable +.It +MSI-X interrupts +.It +Split header +.El +.Pp +All the above mentioned features are enabled by default. +.Pp +For hardware related questions, please refer the documentation supplied +along with AMD EPYC processors. +.Sh SYSCTL VARIABLES +The following variables are available as +.Xr sysctl 8 +variables: +.Bl -tag -width indent +.It Va dev.ax.X.mac_stats +Dumps the transmit and receive statistics counter values for the controller. +This includes statistics specific to each transmit and receive queue. +.It Va dev.ax.X.channels_info +Dumps the permissible and default configured transmit and receive channel +information. +.It Va dev.ax.X.ringparam_info +Dumps the permissible and default configured descriptor information for the +transmit and receive queue. +.It Va dev.ax.X.link_ksettings_info +Dumps the current link setting like link mode, speed, duplex settings. +.It Va dev.ax.X.pauseparam_info +Dumps the current flow-control settings. +.It Va dev.ax.X.coalesce_info +Dumps the current interrupt coalescing settings. +.It Va dev.ax.X.link_info +Dumps the current state of the Link. +.It Va dev.ax.X.drv_info +Dumps the driver and controller firmware version information. +.It Va dev.ax.X.YYYY_register +.It Va dev.ax.X.YYYY_register_values +Sysctl to dump a specific register from a specific block of the controller. +YYYY specifies the block. +The following blocks are supported. +.Bl -bullet -compact +.It +xpcs +.It +xgmac +.It +xprop +.It +xi2c +.El +.Pp +Set the offset of the register to the first variable, and then read the value +of the register by reading the second variable. +.It Va dev.ax.X.axgbe_debug_level +Configure the log-level for the driver. +Default is 0. +Supports 0-3. +.It Va dev.ax.X.single_fl +This variable must be set before loading the driver, either via +.Xr loader.conf 5 +or through the use of +.Xr kenv 1 . +This cannot be modified when driver is loaded. +.Pp +Setting this variable in +.Xr loader.conf 5 +needs the system to be restarted to take effect. +When using +.Xr kenv 1 , +use the wrapper variable +.Va dev.ax.single_fl\&, +which will configure all AMD interfaces with single freelist per receive queue. +Default is 2 freelist per receive queue. +.Pp +This variable is to configure the interface when single freelist is needed. +(For Eg. netmap). +Basically, this will control the software behavior of how the receive +descriptors are used. +.Pp +Setting this variable to 1, will use 1 Freelist per receive queue. +.Pp +Setting this variable to 0, will use 2 Freelist per receive queue. +.Pp +Based on the setting, the receive buffers are programmed accordingly on the +received descriptors. +.Pp +By default, this variable will be set to 0, meaning the interfaces will be +configured for regular data traffic (not netmap traffic). +.It Va dev.ax.X.sph_enabled +This variable must be set before loading the driver, either via +.Xr loader.conf 5 +or through the use of +.Xr kenv 1 . +This cannot be modified when driver is loaded. +.Pp +Setting this variable in +.Xr loader.conf 5 +needs the system to be restarted to take effect. +When using +.Xr kenv 1 , +use the wrapper variable +.Va dev.ax.sph_enable\&, +which will configure(enable/disable) split header support in all +AMD interfaces. +.Pp +This variable is to control enable/disable of the split header feature in +the interface. +.Pp +Setting this variable to 1, will enable split header feature. +.Pp +Setting this variable to 0, will disable split header feature. +.Pp +By default, this variable will be set to 1, meaning the Split header support be +enabled. +.Pp +NOTE: It is recommended to use this variable only when +.Va single_fl\& +is configured. +Otherwise let it be default value. +.El +.Sh SEE ALSO +.Xr arp 4 , +.Xr iflib 4 , +.Xr netmap 4 , +.Xr vlan 4 , +.Xr ifconfig 8 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 13.0 . +.Pp +Another version of the driver is already present in +.Fx . +This driver was named as "axgbe" earlier, which is renamed as "axa" now. +This driver is for the ACPI based Ethernet controllers in the previous/older +version of the hardware. +This driver is authored by +.Aq Mt andrew@FreeBSD.org . +.Sh AUTHORS +The +.Nm +device driver was written by +.An Advanced Micro Devices Inc . +.Pp +For any issues and support requirements, email the details to +.Aq Mt rajesh1.kumar@amd.com .