From owner-dev-commits-src-branches@freebsd.org Mon Mar 1 00:32: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 199485512E0; Mon, 1 Mar 2021 00:32: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 4Dph6p06qQz3QBq; Mon, 1 Mar 2021 00:32: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 EB2571A1F6; Mon, 1 Mar 2021 00:32: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 1210WXUh071769; Mon, 1 Mar 2021 00:32:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1210WXXW071768; Mon, 1 Mar 2021 00:32:33 GMT (envelope-from git) Date: Mon, 1 Mar 2021 00:32:33 GMT Message-Id: <202103010032.1210WXXW071768@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: ba0d063cd6a5 - stable/13 - uma: Update the comment above startup_alloc() to reflect reality 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: ba0d063cd6a5b7b6218242a866169a2d8fe32f17 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 Mar 2021 00:32:34 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ba0d063cd6a5b7b6218242a866169a2d8fe32f17 commit ba0d063cd6a5b7b6218242a866169a2d8fe32f17 Author: Mark Johnston AuthorDate: 2021-02-22 23:21:49 +0000 Commit: Mark Johnston CommitDate: 2021-03-01 00:31:58 +0000 uma: Update the comment above startup_alloc() to reflect reality The scheme used for early slab allocations changed in commit a81c400e75. Reported by: alc Reviewed by: alc (cherry picked from commit 537f92cd351090c09b178a1749cd1d0326f74dc7) --- sys/vm/uma_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 0b6e02861785..8cbd1216678a 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -1642,9 +1642,9 @@ fail: } /* - * This function is intended to be used early on in place of page_alloc() so - * that we may use the boot time page cache to satisfy allocations before - * the VM is ready. + * This function is intended to be used early on in place of page_alloc(). It + * performs contiguous physical memory allocations and uses a bump allocator for + * KVA, so is usable before the kernel map is initialized. */ static void * startup_alloc(uma_zone_t zone, vm_size_t bytes, int domain, uint8_t *pflag, From owner-dev-commits-src-branches@freebsd.org Mon Mar 1 00:32: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 403955513D8; Mon, 1 Mar 2021 00:32: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 4Dph6q1LQlz3QSZ; Mon, 1 Mar 2021 00:32: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 20E4E19D7B; Mon, 1 Mar 2021 00:32: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 1210WZC2071792; Mon, 1 Mar 2021 00:32:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1210WZTw071791; Mon, 1 Mar 2021 00:32:35 GMT (envelope-from git) Date: Mon, 1 Mar 2021 00:32:35 GMT Message-Id: <202103010032.1210WZTw071791@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: 1eee54cbf040 - stable/13 - m_uiotombuf_nomap(): Stop clearing PG_ZERO in newly allocated pages 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: 1eee54cbf040adba158e42150332905630253264 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 Mar 2021 00:32:35 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1eee54cbf040adba158e42150332905630253264 commit 1eee54cbf040adba158e42150332905630253264 Author: Mark Johnston AuthorDate: 2021-02-22 15:03:37 +0000 Commit: Mark Johnston CommitDate: 2021-03-01 00:32:18 +0000 m_uiotombuf_nomap(): Stop clearing PG_ZERO in newly allocated pages The caller should not be passing M_ZERO in the first place, so PG_ZERO will not be preserved by the page allocator and clearing it accomplishes nothing. Reviewed by: gallatin, jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28808 (cherry picked from commit 608c44f96e88f28f9607374a6c9327d13d3d3d0e) --- sys/kern/uipc_mbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index f73bfab07eaf..5296aac0edc4 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1656,6 +1656,7 @@ m_uiotombuf_nomap(struct uio *uio, int how, int len, int maxseg, int flags) VM_ALLOC_WIRED; MPASS((flags & M_PKTHDR) == 0); + MPASS((how & M_ZERO) == 0); /* * len can be zero or an arbitrary large value bound by @@ -1709,7 +1710,6 @@ retry_page: goto retry_page; } } - pg_array[i]->flags &= ~PG_ZERO; mb->m_epg_pa[i] = VM_PAGE_TO_PHYS(pg_array[i]); mb->m_epg_npgs++; } From owner-dev-commits-src-branches@freebsd.org Mon Mar 1 00:33: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 A5F2B551907; Mon, 1 Mar 2021 00:33: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 4Dph7X4LnGz3QgK; Mon, 1 Mar 2021 00:33: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 88B391A1F8; Mon, 1 Mar 2021 00:33:12 +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 1210XCNt072017; Mon, 1 Mar 2021 00:33:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1210XCYE072016; Mon, 1 Mar 2021 00:33:12 GMT (envelope-from git) Date: Mon, 1 Mar 2021 00:33:12 GMT Message-Id: <202103010033.1210XCYE072016@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: 113bd64cdf4e - releng/13.0 - pmap: Fix largemap restart checks in the kernel_maps sysctl handler MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 113bd64cdf4ef3f54fffcd9874ae7ec07afd882e 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 Mar 2021 00:33:12 -0000 The branch releng/13.0 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=113bd64cdf4ef3f54fffcd9874ae7ec07afd882e commit 113bd64cdf4ef3f54fffcd9874ae7ec07afd882e Author: Mark Johnston AuthorDate: 2021-02-25 23:49:47 +0000 Commit: Mark Johnston CommitDate: 2021-03-01 00:32:58 +0000 pmap: Fix largemap restart checks in the kernel_maps sysctl handler The purpose of these checks is to ensure that the address of the next-level page table page is valid, since nothing is synchronizing with a concurrent update of the large map and large map PTPs are freed to the system. However, if PG_PS is set, there is no next level. Approved by: re (gjb) Reported by: rpokala Reviewed by: kib Tested by: rpokala Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28922 (cherry picked from commit aac25e222525780db8939d07a594d3e090c0a148) (cherry picked from commit 5966aae9c7c25707c785ec056cb8462a037a480e) --- sys/amd64/amd64/pmap.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 0e1d1c02d1fc..bd23fd176e88 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -11349,9 +11349,6 @@ restart: continue; } pa = pdpe & PG_FRAME; - if (PMAP_ADDRESS_IN_LARGEMAP(sva) && - vm_phys_paddr_to_vm_page(pa) == NULL) - goto restart; if ((pdpe & PG_PS) != 0) { sva = rounddown2(sva, NBPDP); sysctl_kmaps_check(sb, &range, sva, pml4e, pdpe, @@ -11360,6 +11357,15 @@ restart: sva += NBPDP; continue; } + if (PMAP_ADDRESS_IN_LARGEMAP(sva) && + vm_phys_paddr_to_vm_page(pa) == NULL) { + /* + * Page table pages for the large map may be + * freed. Validate the next-level address + * before descending. + */ + goto restart; + } pd = (pd_entry_t *)PHYS_TO_DMAP(pa); for (k = pmap_pde_index(sva); k < NPDEPG; k++) { @@ -11371,9 +11377,6 @@ restart: continue; } pa = pde & PG_FRAME; - if (PMAP_ADDRESS_IN_LARGEMAP(sva) && - vm_phys_paddr_to_vm_page(pa) == NULL) - goto restart; if ((pde & PG_PS) != 0) { sva = rounddown2(sva, NBPDR); sysctl_kmaps_check(sb, &range, sva, @@ -11382,6 +11385,15 @@ restart: sva += NBPDR; continue; } + if (PMAP_ADDRESS_IN_LARGEMAP(sva) && + vm_phys_paddr_to_vm_page(pa) == NULL) { + /* + * Page table pages for the large map + * may be freed. Validate the + * next-level address before descending. + */ + goto restart; + } pt = (pt_entry_t *)PHYS_TO_DMAP(pa); for (l = pmap_pte_index(sva); l < NPTEPG; l++, From owner-dev-commits-src-branches@freebsd.org Mon Mar 1 07:05: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 E6503550A2F; Mon, 1 Mar 2021 07:05: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 4Dprqy64r7z3Mm2; Mon, 1 Mar 2021 07:05: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 BB6CE1F530; Mon, 1 Mar 2021 07:05: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 12175IM7086696; Mon, 1 Mar 2021 07:05:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12175IBs086695; Mon, 1 Mar 2021 07:05:18 GMT (envelope-from git) Date: Mon, 1 Mar 2021 07:05:18 GMT Message-Id: <202103010705.12175IBs086695@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: a7926435c12e - releng/13.0 - pf: Fix incorrect fragment handling 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: a7926435c12e2304f46c9efadd4216f469f68acc 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 Mar 2021 07:05:19 -0000 The branch releng/13.0 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a7926435c12e2304f46c9efadd4216f469f68acc commit a7926435c12e2304f46c9efadd4216f469f68acc Author: Kristof Provost AuthorDate: 2021-02-25 07:07:36 +0000 Commit: Kristof Provost CommitDate: 2021-03-01 07:04:47 +0000 pf: Fix incorrect fragment handling A sequence of overlapping IPv4 fragments could crash the kernel in pf due to an assertion. Approved by: re (gjb) Reported by: Alexander Bluhm Obtained from: OpenBSD MFC after: 3 days Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 5f1b1f184b7f12330cf4a027e3db7c6700c67640) (cherry picked from commit 86ebf4d3e12c3eae94d3e9a8dcf5bd5741889b58) --- sys/netpfil/pf/pf_norm.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c index b7a84437630b..d7310c7bccb4 100644 --- a/sys/netpfil/pf/pf_norm.c +++ b/sys/netpfil/pf/pf_norm.c @@ -549,6 +549,7 @@ pf_fillup_fragment(struct pf_fragment_cmp *key, struct pf_frent *frent, struct pf_frent *after, *next, *prev; struct pf_fragment *frag; uint16_t total; + int old_index, new_index; PF_FRAG_ASSERT(); @@ -660,8 +661,30 @@ pf_fillup_fragment(struct pf_fragment_cmp *key, struct pf_frent *frent, DPFPRINTF(("adjust overlap %d\n", aftercut)); if (aftercut < after->fe_len) { m_adj(after->fe_m, aftercut); + old_index = pf_frent_index(after); after->fe_off += aftercut; after->fe_len -= aftercut; + new_index = pf_frent_index(after); + if (old_index != new_index) { + DPFPRINTF(("frag index %d, new %d", + old_index, new_index)); + /* Fragment switched queue as fe_off changed */ + after->fe_off -= aftercut; + after->fe_len += aftercut; + /* Remove restored fragment from old queue */ + pf_frent_remove(frag, after); + after->fe_off += aftercut; + after->fe_len -= aftercut; + /* Insert into correct queue */ + if (pf_frent_insert(frag, after, prev)) { + DPFPRINTF( + ("fragment requeue limit exceeded")); + m_freem(after->fe_m); + uma_zfree(V_pf_frent_z, after); + /* There is not way to recover */ + goto bad_fragment; + } + } break; } From owner-dev-commits-src-branches@freebsd.org Mon Mar 1 07:48: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 DD425552FB3; Mon, 1 Mar 2021 07:48: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 4DpsnH4NpPz3QdR; Mon, 1 Mar 2021 07:48: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 7FD6B1FC51; Mon, 1 Mar 2021 07:48: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 1217m3QC039298; Mon, 1 Mar 2021 07:48:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1217m3QR039297; Mon, 1 Mar 2021 07:48:03 GMT (envelope-from git) Date: Mon, 1 Mar 2021 07:48:03 GMT Message-Id: <202103010748.1217m3QR039297@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Richard Scheffenegger Subject: git: 9596751563dc - stable/13 - Include new data sent in PRR calculation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9596751563dc1819d177fa3ec6660a3bdc18021c 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 Mar 2021 07:48:03 -0000 The branch stable/13 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=9596751563dc1819d177fa3ec6660a3bdc18021c commit 9596751563dc1819d177fa3ec6660a3bdc18021c Author: Richard Scheffenegger AuthorDate: 2021-02-26 21:30:33 +0000 Commit: Richard Scheffenegger CommitDate: 2021-03-01 07:24:24 +0000 Include new data sent in PRR calculation Reviewed By: #transport, kbowling MFC after: 3 days Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D28941 (cherry picked from commit 9e83a6a556ed8d9a2821de5d5f5c7d4b1292c694) --- sys/netinet/tcp_input.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 42f983f64502..f16c62ae6a1f 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -2602,7 +2602,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, imax(1, tp->snd_nxt - tp->snd_una); snd_cnt = howmany((long)tp->sackhint.prr_delivered * tp->snd_ssthresh, tp->sackhint.recover_fs) - - tp->sackhint.sack_bytes_rexmit; + (tp->sackhint.sack_bytes_rexmit + + (tp->snd_nxt - tp->snd_recover)); } else { if (V_tcp_do_prr_conservative) limit = tp->sackhint.prr_delivered - @@ -3951,7 +3952,8 @@ tcp_prr_partialack(struct tcpcb *tp, struct tcphdr *th) imax(1, tp->snd_nxt - tp->snd_una); snd_cnt = howmany((long)tp->sackhint.prr_delivered * tp->snd_ssthresh, tp->sackhint.recover_fs) - - tp->sackhint.sack_bytes_rexmit; + (tp->sackhint.sack_bytes_rexmit + + (tp->snd_nxt - tp->snd_recover)); } else { if (V_tcp_do_prr_conservative) limit = tp->sackhint.prr_delivered - From owner-dev-commits-src-branches@freebsd.org Mon Mar 1 10: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 F04BE558D27; Mon, 1 Mar 2021 10: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 4Dpxwp6Sxcz3srg; Mon, 1 Mar 2021 10: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 D0D2A222EA; Mon, 1 Mar 2021 10: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 121Asord088990; Mon, 1 Mar 2021 10: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 121Aso2D088989; Mon, 1 Mar 2021 10:54:50 GMT (envelope-from git) Date: Mon, 1 Mar 2021 10:54:50 GMT Message-Id: <202103011054.121Aso2D088989@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: 05e4a34e4360 - stable/13 - loader: autoload_font will hung loader when there is no local console 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: 05e4a34e4360f54ec62616730465410726c96ba2 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 Mar 2021 10:54:51 -0000 The branch stable/13 has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=05e4a34e4360f54ec62616730465410726c96ba2 commit 05e4a34e4360f54ec62616730465410726c96ba2 Author: Toomas Soome AuthorDate: 2021-02-21 10:32:18 +0000 Commit: Toomas Soome CommitDate: 2021-03-01 10:54:36 +0000 loader: autoload_font will hung loader when there is no local console If we start with console set to comconsole, the local console (vidconsole, efi) is never initialized and attempt to use the data can render the loader hung. (cherry picked from commit 61c50cbc096d28e44cb8b627e524ae58158c423a) Reported by: Kamigishi Rei --- stand/efi/libefi/efi_console.c | 3 +++ stand/i386/libi386/vidconsole.c | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/stand/efi/libefi/efi_console.c b/stand/efi/libefi/efi_console.c index 7024f9c8b2f2..3cbd121c41da 100644 --- a/stand/efi/libefi/efi_console.c +++ b/stand/efi/libefi/efi_console.c @@ -886,6 +886,9 @@ cons_update_mode(bool use_gfx_mode) EFI_STATUS status; char env[10], *ptr; + if (!efi_started) + return (false); + /* * Despite the use_gfx_mode, we want to make sure we call * efi_find_framebuffer(). This will populate the fb data, diff --git a/stand/i386/libi386/vidconsole.c b/stand/i386/libi386/vidconsole.c index f94ed2d26712..b933a7807687 100644 --- a/stand/i386/libi386/vidconsole.c +++ b/stand/i386/libi386/vidconsole.c @@ -53,7 +53,7 @@ static int vidc_getchar(void); static int vidc_ischar(void); static void cons_draw_frame(teken_attr_t *); -static int vidc_started; +static bool vidc_started; static uint16_t *vgatext; static tf_bell_t vidc_cons_bell; @@ -877,6 +877,10 @@ cons_update_mode(bool use_gfx_mode) char env[10], *ptr; int format, roff, goff, boff; + /* vidc_init() is not called yet. */ + if (!vidc_started) + return (false); + gfx_state.tg_tp.tp_row = TEXT_ROWS; gfx_state.tg_tp.tp_col = TEXT_COLS; @@ -996,7 +1000,7 @@ vidc_init(int arg) if (vidc_started && arg == 0) return (0); - vidc_started = 1; + vidc_started = true; vbe_init(); /* From owner-dev-commits-src-branches@freebsd.org Mon Mar 1 19:00:23 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 74227548644; Mon, 1 Mar 2021 19:00:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dq8j32wHlz3NV0; Mon, 1 Mar 2021 19:00:23 +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 570E19D2; Mon, 1 Mar 2021 19:00:23 +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 121J0N7H030726; Mon, 1 Mar 2021 19:00:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 121J0NTL030725; Mon, 1 Mar 2021 19:00:23 GMT (envelope-from git) Date: Mon, 1 Mar 2021 19:00:23 GMT Message-Id: <202103011900.121J0NTL030725@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: 84c6bae8db2e - releng/13.0 - acpi: limit the AMDI0020/AMDI0010 workaround to an option 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 84c6bae8db2e0ae98e321f928364b61a7a13cda5 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 Mar 2021 19:00:23 -0000 The branch releng/13.0 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=84c6bae8db2e0ae98e321f928364b61a7a13cda5 commit 84c6bae8db2e0ae98e321f928364b61a7a13cda5 Author: Warner Losh AuthorDate: 2021-02-08 21:43:25 +0000 Commit: Warner Losh CommitDate: 2021-03-01 18:58:52 +0000 acpi: limit the AMDI0020/AMDI0010 workaround to an option It appears that production versions of EPYC firmware get the _STA method right for these nodes. In fact, this workaround breaks on production hardware by including too many uart nodes. This work around was for pre-release hardware that wound up not having a large deployment. Move this work around to a kernel option since the machines that needed it have been powered off and are difficult to resurrect. Should there be a more significant deployment than is understood, we can restrict it based on smbios strings. Discussed with: mmacy@, seanc@, jhb@ MFC After: 3 days Approved by: re@ (gjb) (cherry picked from commit 35af933173d516101f4c44af328fbe2d6e587869) (cherry picked from commit a60c5de933e1516f65ead98b0ee141224ad607f4) --- sys/conf/options | 1 + sys/dev/acpica/acpi.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/sys/conf/options b/sys/conf/options index 77979b72fe58..2f324143c574 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -705,6 +705,7 @@ ACPI_DEBUG opt_acpi.h ACPI_MAX_TASKS opt_acpi.h ACPI_MAX_THREADS opt_acpi.h DEV_ACPI opt_acpi.h +ACPI_EARLY_EPYC_WAR opt_acpi.h # options for IOMMU support IOMMU opt_iommu.h diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 04c8c1b27625..18623a6ab240 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -2273,6 +2273,8 @@ acpi_DeviceIsPresent(device_t dev) h = acpi_get_handle(dev); if (h == NULL) return (FALSE); + +#ifdef ACPI_EARLY_EPYC_WAR /* * Certain Treadripper boards always returns 0 for FreeBSD because it * only returns non-zero for the OS string "Windows 2015". Otherwise it @@ -2281,6 +2283,7 @@ acpi_DeviceIsPresent(device_t dev) */ if (acpi_MatchHid(h, "AMDI0020") || acpi_MatchHid(h, "AMDI0010")) return (TRUE); +#endif status = acpi_GetInteger(h, "_STA", &s); From owner-dev-commits-src-branches@freebsd.org Mon Mar 1 19:00: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 875155485A8; Mon, 1 Mar 2021 19:00:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dq8j43T4Vz3NV1; Mon, 1 Mar 2021 19:00:24 +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 6A8F5B92; Mon, 1 Mar 2021 19:00:24 +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 121J0Oae030749; Mon, 1 Mar 2021 19:00:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 121J0O4G030748; Mon, 1 Mar 2021 19:00:24 GMT (envelope-from git) Date: Mon, 1 Mar 2021 19:00:24 GMT Message-Id: <202103011900.121J0O4G030748@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: 5a1ecfa5a986 - releng/13.0 - hid: bump HID_ITEM_MAXUSAGES to 8 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 5a1ecfa5a986b888c5d6c8c38383ad38d2adb03a 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 Mar 2021 19:00:24 -0000 The branch releng/13.0 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5a1ecfa5a986b888c5d6c8c38383ad38d2adb03a commit 5a1ecfa5a986b888c5d6c8c38383ad38d2adb03a Author: Warner Losh AuthorDate: 2021-02-08 19:29:20 +0000 Commit: Warner Losh CommitDate: 2021-03-01 18:59:13 +0000 hid: bump HID_ITEM_MAXUSAGES to 8 My YOGA requires a minimum of 7 to parse w/o an error. Since the memory savings are trivial and the yoga a popular system, bump the default up to 8. There's no API/ABI issues in doing this. This hid_item struct isn't exported to userland and the one libusbhid has is different and only shares a name... MFC After: 3 days Reviewed by: wulf@ Differential Revision: https://reviews.freebsd.org/D28543 Approved by: re@ (gjb) (cherry picked from commit db2f512381ac3c0c227f5c0354690bb929dcac17) (cherry picked from commit 0dc5c9467b5bbcf26a8232553a1c213bb95ce635) --- sys/dev/hid/hid.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/hid/hid.h b/sys/dev/hid/hid.h index e88cbba04d9a..37ab8c9cdf7e 100644 --- a/sys/dev/hid/hid.h +++ b/sys/dev/hid/hid.h @@ -189,7 +189,7 @@ #if defined(_KERNEL) || defined(_STANDALONE) -#define HID_ITEM_MAXUSAGE 4 +#define HID_ITEM_MAXUSAGE 8 #define HID_MAX_AUTO_QUIRK 8 /* maximum number of dynamic quirks */ #define HID_PNP_ID_SIZE 20 /* includes null terminator */ From owner-dev-commits-src-branches@freebsd.org Mon Mar 1 19:00: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 DC1C454857E; Mon, 1 Mar 2021 19:00: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 4Dq8j55HX7z3NV6; Mon, 1 Mar 2021 19:00: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 99C4C95D; Mon, 1 Mar 2021 19:00: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 121J0Pva030767; Mon, 1 Mar 2021 19:00:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 121J0PYD030766; Mon, 1 Mar 2021 19:00:25 GMT (envelope-from git) Date: Mon, 1 Mar 2021 19:00:25 GMT Message-Id: <202103011900.121J0PYD030766@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: 5eabef5a8223 - releng/13.0 - Giant: move back Giant removal until 14 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 5eabef5a82232aa4346c2059b113c608420a1f9f 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 Mar 2021 19:00:26 -0000 The branch releng/13.0 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5eabef5a82232aa4346c2059b113c608420a1f9f commit 5eabef5a82232aa4346c2059b113c608420a1f9f Author: Warner Losh AuthorDate: 2021-02-17 16:28:41 +0000 Commit: Warner Losh CommitDate: 2021-03-01 18:59:18 +0000 Giant: move back Giant removal until 14 Update the Giant Lock warning message to FreeBSD 14. It's growing increasling clear that this won't be done before 13.0. MFC: Insta (re@'s request) Approved by: re@ (gjb) (cherry picked from commit 00065c7630c25850298dd3ba6919c2d3628e8ad9) (cherry picked from commit d2fb8eb1472ccc1b2175238f7668816544bf15f7) --- sys/kern/kern_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 5211422199bb..29103f83c049 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -667,7 +667,7 @@ prep_cdevsw(struct cdevsw *devsw, int flags) if (devsw->d_flags & D_NEEDGIANT) { printf("WARNING: Device \"%s\" is Giant locked and may be " - "deleted before FreeBSD 13.0.\n", + "deleted before FreeBSD 14.0.\n", devsw->d_name == NULL ? "???" : devsw->d_name); if (devsw->d_gianttrick == NULL) { memcpy(dsw2, devsw, sizeof *dsw2); From owner-dev-commits-src-branches@freebsd.org Mon Mar 1 19:00:27 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 559C5548708; Mon, 1 Mar 2021 19:00:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dq8j661Lcz3NZJ; Mon, 1 Mar 2021 19: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 B044995E; Mon, 1 Mar 2021 19: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 121J0QWh030789; Mon, 1 Mar 2021 19: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 121J0QMP030788; Mon, 1 Mar 2021 19:00:26 GMT (envelope-from git) Date: Mon, 1 Mar 2021 19:00:26 GMT Message-Id: <202103011900.121J0QMP030788@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: 963c8fa8b231 - releng/13.0 - boot: remove gptboot.efifat, it never should have been 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 963c8fa8b231b0313ca3c270ee32cdec49a39bd8 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 Mar 2021 19:00:27 -0000 The branch releng/13.0 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=963c8fa8b231b0313ca3c270ee32cdec49a39bd8 commit 963c8fa8b231b0313ca3c270ee32cdec49a39bd8 Author: Warner Losh AuthorDate: 2021-02-19 22:34:25 +0000 Commit: Warner Losh CommitDate: 2021-03-01 18:59:26 +0000 boot: remove gptboot.efifat, it never should have been conical hat reduction: Make sure we also remove gotboot.efifat. It was created, briefly, and shouldn't have existed in the first place. Kill it at the same place we kill boot1.efifat. Pointy Hat to: imp@ Approved by: re@ (gjb) (cherry picked from commit 8cd1b2b1a7ab55e96aaf40a401d8792f2697b274) (cherry picked from commit dd9b24be14d4311ca6056f41a2d81801d2c0fa03) --- ObsoleteFiles.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 7ebff0441581..5f4495c50ee6 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -2601,8 +2601,9 @@ OLD_FILES+=usr/bin/mklocale OLD_FILES+=usr/share/man/man1/mklocale.1.gz OLD_FILES+=usr/bin/colldef OLD_FILES+=usr/share/man/man1/colldef.1.gz -# 20190904: Remove boot1.efifat +# 20190904: Remove boot1.efifat and gptboot.efifat (which never should have been) OLD_FILES+=boot/boot1.efifat +OLD_FILES+=boot/gptboot.efifat # 20190903: pc-sysinstall(8) removed OLD_FILES+=usr/share/examples/pc-sysinstall/README OLD_FILES+=usr/share/examples/pc-sysinstall/pc-autoinstall.conf From owner-dev-commits-src-branches@freebsd.org Mon Mar 1 19:00:29 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 2238A5483B3; Mon, 1 Mar 2021 19:00:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dq8j804xDz3NXS; Mon, 1 Mar 2021 19:00:27 +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 CACE995F; Mon, 1 Mar 2021 19:00:27 +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 121J0Rq2030811; Mon, 1 Mar 2021 19:00:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 121J0RnC030810; Mon, 1 Mar 2021 19:00:27 GMT (envelope-from git) Date: Mon, 1 Mar 2021 19:00:27 GMT Message-Id: <202103011900.121J0RnC030810@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: eb62c494bfa0 - releng/13.0 - uart: only use MSI on devices that advertise 1 MSI vector 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: eb62c494bfa0771581dae96f6ae6bdcf4d3f21b9 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 Mar 2021 19:00:29 -0000 The branch releng/13.0 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=eb62c494bfa0771581dae96f6ae6bdcf4d3f21b9 commit eb62c494bfa0771581dae96f6ae6bdcf4d3f21b9 Author: Warner Losh AuthorDate: 2021-02-17 22:08:19 +0000 Commit: Warner Losh CommitDate: 2021-03-01 18:59:30 +0000 uart: only use MSI on devices that advertise 1 MSI vector This updates r311987/fb1d9b7f4113d which allowed any number of vectors to be used. Since we're just attaching one instance, the meaning of more than one vector is not clear and seems to cause problems. Fall back to old methods for these cards. PR: 235016 Submitted by: David Cross Approved by: re@ (gjb) (cherry picked from commit 955b6109bb36036e9357006be42dfa89cd7cb0f2) (cherry picked from commit ef1f2056084202c554d5482af9586a8995e604d5) --- sys/dev/uart/uart_bus_pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/uart/uart_bus_pci.c b/sys/dev/uart/uart_bus_pci.c index 0ed3d7f4f974..fbd1d68b88ca 100644 --- a/sys/dev/uart/uart_bus_pci.c +++ b/sys/dev/uart/uart_bus_pci.c @@ -227,10 +227,10 @@ uart_pci_attach(device_t dev) sc = device_get_softc(dev); /* - * Use MSI in preference to legacy IRQ if available. - * Whilst some PCIe UARTs support >1 MSI vector, use only the first. + * Use MSI in preference to legacy IRQ if available. However, experience + * suggests this is only reliable when one MSI vector is advertised. */ - if (pci_msi_count(dev) > 0) { + if (pci_msi_count(dev) == 1) { count = 1; if (pci_alloc_msi(dev, &count) == 0) { sc->sc_irid = 1; From owner-dev-commits-src-branches@freebsd.org Mon Mar 1 19:00: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 1AD8454825A; Mon, 1 Mar 2021 19:00: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 4Dq8j975HMz3NlZ; Mon, 1 Mar 2021 19:00:29 +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 08801B93; Mon, 1 Mar 2021 19:00:29 +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 121J0SpC030831; Mon, 1 Mar 2021 19:00:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 121J0SDD030830; Mon, 1 Mar 2021 19:00:28 GMT (envelope-from git) Date: Mon, 1 Mar 2021 19:00:28 GMT Message-Id: <202103011900.121J0SDD030830@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: 3e95150e8cb3 - releng/13.0 - Remove incorrect statement about EFI environment variables being unsupported. 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 3e95150e8cb38795e6e3d06924e4d6c8c6c94cb9 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 Mar 2021 19:00:33 -0000 The branch releng/13.0 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3e95150e8cb38795e6e3d06924e4d6c8c6c94cb9 commit 3e95150e8cb38795e6e3d06924e4d6c8c6c94cb9 Author: Warner Losh AuthorDate: 2021-02-22 20:19:21 +0000 Commit: Warner Losh CommitDate: 2021-03-01 18:59:34 +0000 Remove incorrect statement about EFI environment variables being unsupported. Our uefi support has included environment variable support for several years now. Remove the bogus blanket statement saying we don't support them. MFC After: 3 days Approved by: re@ (gjb) (cherry picked from commit ab77cc9e7bf6d0c2d862dfd514539b81ae248dfd) (cherry picked from commit 78050d4966c5a9c8e953cab2a286450238d51e4f) --- share/man/man8/uefi.8 | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/share/man/man8/uefi.8 b/share/man/man8/uefi.8 index 4224af835738..05c74caa6c20 100644 --- a/share/man/man8/uefi.8 +++ b/share/man/man8/uefi.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 9, 2020 +.Dd February 22, 2021 .Dt UEFI 8 .Os .Sh NAME @@ -143,7 +143,3 @@ boot support for amd64 first appeared in .Fx 10.1 and for arm64 in .Fx 11.0 . -.Sh CAVEATS -EFI environment variables are not supported by -.Xr loader 8 -or the kernel. From owner-dev-commits-src-branches@freebsd.org Mon Mar 1 19:00: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 25FD8548437; Mon, 1 Mar 2021 19:00: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 4Dq8jC40fHz3Nlh; Mon, 1 Mar 2021 19:00: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 324E066F; Mon, 1 Mar 2021 19:00: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 121J0VrY030873; Mon, 1 Mar 2021 19:00:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 121J0VIP030872; Mon, 1 Mar 2021 19:00:31 GMT (envelope-from git) Date: Mon, 1 Mar 2021 19:00:31 GMT Message-Id: <202103011900.121J0VIP030872@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: de3e66f4bb2d - releng/13.0 - Restore missing word 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: de3e66f4bb2d2e72be2d12301fbda1a1525a0ef5 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 Mar 2021 19:00:35 -0000 The branch releng/13.0 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=de3e66f4bb2d2e72be2d12301fbda1a1525a0ef5 commit de3e66f4bb2d2e72be2d12301fbda1a1525a0ef5 Author: Warner Losh AuthorDate: 2021-02-22 21:39:04 +0000 Commit: Warner Losh CommitDate: 2021-03-01 18:59:41 +0000 Restore missing word "in" got dropped when I shuffled things around. Noticed by: rpokala@ MFC After: 3 days Approved by: re@ (gjb) (cherry picked from commit f11e9f325aee3459fee94f3a660a8e6c1a25c2ac) (cherry picked from commit 1df1b4190b41ee3237486e9daa0a751cbc56312d) --- share/man/man8/uefi.8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/man/man8/uefi.8 b/share/man/man8/uefi.8 index dfc144718f7b..3ecfe05ac1c4 100644 --- a/share/man/man8/uefi.8 +++ b/share/man/man8/uefi.8 @@ -141,7 +141,7 @@ EFI boot support for the ia64 architecture first appeared in .Nm boot support for amd64 first appeared in .Fx 10.1 ; -for arm64 +for arm64 in .Fx 11.0 ; and for armv6 and armv7 in .Fx 12.0 . From owner-dev-commits-src-branches@freebsd.org Mon Mar 1 19:00: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 AC4DB5485BC; Mon, 1 Mar 2021 19:00: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 4Dq8jB35J2z3NRy; Mon, 1 Mar 2021 19:00:30 +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 12D50960; Mon, 1 Mar 2021 19:00: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 121J0TS7030851; Mon, 1 Mar 2021 19:00:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 121J0TkG030850; Mon, 1 Mar 2021 19:00:29 GMT (envelope-from git) Date: Mon, 1 Mar 2021 19:00:29 GMT Message-Id: <202103011900.121J0TkG030850@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: abe709deefdf - releng/13.0 - uefi: add historical details 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: abe709deefdfe831f26bbcb5b2eb2f0bca6072ca 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 Mar 2021 19:00:34 -0000 The branch releng/13.0 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=abe709deefdfe831f26bbcb5b2eb2f0bca6072ca commit abe709deefdfe831f26bbcb5b2eb2f0bca6072ca Author: Warner Losh AuthorDate: 2021-02-22 21:20:00 +0000 Commit: Warner Losh CommitDate: 2021-03-01 18:59:38 +0000 uefi: add historical details Add details about when armv6 and armv7 support was added. Approved by: re@ (gjb) (cherry picked from commit 8c09ecb2e25155b4f1490a177826608d52b1bd1b) (cherry picked from commit f88db54fd87471802b44520715d8e373ddf86f60) --- share/man/man8/uefi.8 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/share/man/man8/uefi.8 b/share/man/man8/uefi.8 index 05c74caa6c20..dfc144718f7b 100644 --- a/share/man/man8/uefi.8 +++ b/share/man/man8/uefi.8 @@ -140,6 +140,8 @@ EFI boot support for the ia64 architecture first appeared in .Fx 5.0 . .Nm boot support for amd64 first appeared in -.Fx 10.1 -and for arm64 in -.Fx 11.0 . +.Fx 10.1 ; +for arm64 +.Fx 11.0 ; +and for armv6 and armv7 in +.Fx 12.0 . From owner-dev-commits-src-branches@freebsd.org Mon Mar 1 19: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 A85935485C0; Mon, 1 Mar 2021 19: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 4Dq8jH1bByz3Nb1; Mon, 1 Mar 2021 19:00: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 46262C0C; Mon, 1 Mar 2021 19:00: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 121J0Wcf030893; Mon, 1 Mar 2021 19:00:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 121J0Wdl030892; Mon, 1 Mar 2021 19:00:32 GMT (envelope-from git) Date: Mon, 1 Mar 2021 19:00:32 GMT Message-Id: <202103011900.121J0Wdl030892@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: f495e9ed95c9 - releng/13.0 - uefi: Add riscv to historical details 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: f495e9ed95c9ff3cf31cfc6554b43fce7a475af6 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 Mar 2021 19:00:37 -0000 The branch releng/13.0 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f495e9ed95c9ff3cf31cfc6554b43fce7a475af6 commit f495e9ed95c9ff3cf31cfc6554b43fce7a475af6 Author: Jessica Clarke AuthorDate: 2021-02-22 22:27:00 +0000 Commit: Warner Losh CommitDate: 2021-03-01 18:59:44 +0000 uefi: Add riscv to historical details Approved by: re@ (gjb) (cherry picked from commit 963cf6cb0fd7e8708c455ecf567fbc34fe2a7156) (cherry picked from commit 44f483e0fa52c42c8f97cf1600c1f7272a283707) --- share/man/man8/uefi.8 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/share/man/man8/uefi.8 b/share/man/man8/uefi.8 index 3ecfe05ac1c4..64bc30139f97 100644 --- a/share/man/man8/uefi.8 +++ b/share/man/man8/uefi.8 @@ -143,5 +143,7 @@ boot support for amd64 first appeared in .Fx 10.1 ; for arm64 in .Fx 11.0 ; -and for armv6 and armv7 in -.Fx 12.0 . +for armv6 and armv7 in +.Fx 12.0 ; +and for riscv in +.Fx 13.0 . From owner-dev-commits-src-branches@freebsd.org Mon Mar 1 19:00: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 0EBC154879E; Mon, 1 Mar 2021 19:00: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 4Dq8jK5HPrz3Nnw; Mon, 1 Mar 2021 19: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 72E987E5; Mon, 1 Mar 2021 19:00: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 121J0XLf030913; Mon, 1 Mar 2021 19:00:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 121J0X6D030912; Mon, 1 Mar 2021 19:00:33 GMT (envelope-from git) Date: Mon, 1 Mar 2021 19:00:33 GMT Message-Id: <202103011900.121J0X6D030912@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: c0708f6835bf - releng/13.0 - efibootmgr: Check for efi supported after parsing args 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: c0708f6835bf752ccfb2b1c48e7c47f9ead529a6 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 Mar 2021 19:00:38 -0000 The branch releng/13.0 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c0708f6835bf752ccfb2b1c48e7c47f9ead529a6 commit c0708f6835bf752ccfb2b1c48e7c47f9ead529a6 Author: Warner Losh AuthorDate: 2021-02-11 23:06:30 +0000 Commit: Warner Losh CommitDate: 2021-03-01 18:59:49 +0000 efibootmgr: Check for efi supported after parsing args Move the check for efi variables being supported to after parsing the args. This allows '-h' to produce both as a normal user as well as on all systems. Approved by: re@ (gjb) (cherry picked from commit 7fe2f504f8a0e4237872f8528e911c5f7b7ed59d) (cherry picked from commit b8b867a10f56b4a78b680fb5d2a97c83e745a0ce) --- usr.sbin/efibootmgr/efibootmgr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.sbin/efibootmgr/efibootmgr.c b/usr.sbin/efibootmgr/efibootmgr.c index 8c7ba82cb5a5..53bc417c4e07 100644 --- a/usr.sbin/efibootmgr/efibootmgr.c +++ b/usr.sbin/efibootmgr/efibootmgr.c @@ -1072,11 +1072,12 @@ int main(int argc, char *argv[]) { + memset(&opts, 0, sizeof (bmgr_opts_t)); + parse_args(argc, argv); + if (!efi_variables_supported()) errx(1, "efi variables not supported on this system. root? kldload efirt?"); - memset(&opts, 0, sizeof (bmgr_opts_t)); - parse_args(argc, argv); read_vars(); if (opts.create) From owner-dev-commits-src-branches@freebsd.org Mon Mar 1 21:05: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 6C74654C7AE; Mon, 1 Mar 2021 21:05: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 4DqCTm2JFVz3qrM; Mon, 1 Mar 2021 21:05: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 41E182444; Mon, 1 Mar 2021 21:05: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 121L5mgD096752; Mon, 1 Mar 2021 21:05:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 121L5m3L096751; Mon, 1 Mar 2021 21:05:48 GMT (envelope-from git) Date: Mon, 1 Mar 2021 21:05:48 GMT Message-Id: <202103012105.121L5m3L096751@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: b96e66349ed8 - stable/13 - getdirentries.2: fix for NFS mounts MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b96e66349ed80f2537777c0cc04266de1a3768b0 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 Mar 2021 21:05:48 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=b96e66349ed80f2537777c0cc04266de1a3768b0 commit b96e66349ed80f2537777c0cc04266de1a3768b0 Author: Rick Macklem AuthorDate: 2021-02-15 02:16:58 +0000 Commit: Rick Macklem CommitDate: 2021-03-01 21:00:38 +0000 getdirentries.2: fix for NFS mounts It was reported that getdirentries(2) was returning dirents with d_off set to 0 for an NFS mount. This is believed to be correct behaviour at this time (it may change for some NFS mounts in the future), but is inconsistent with what the getdirentries(2) man page says. This patch fixes the man page. This is a content change. PR: 253428 (cherry picked from commit a0698341cd894ba4a640e9a9bb0f72c2133d1228) --- lib/libc/sys/getdirentries.2 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/libc/sys/getdirentries.2 b/lib/libc/sys/getdirentries.2 index f2d1c05240d5..658be9459af5 100644 --- a/lib/libc/sys/getdirentries.2 +++ b/lib/libc/sys/getdirentries.2 @@ -28,7 +28,7 @@ .\" @(#)getdirentries.2 8.2 (Berkeley) 5/3/95 .\" $FreeBSD$ .\" -.Dd March 30, 2020 +.Dd February 14, 2021 .Dt GETDIRENTRIES 2 .Os .Sh NAME @@ -89,7 +89,7 @@ have the same .Fa d_fileno . The .Fa d_off -field returns a cookie which can be used with +field returns a cookie which, if non-zero, can be used with .Xr lseek 2 to position the directory descriptor to the next entry. The @@ -148,14 +148,16 @@ only .Pc , a value returned in the .Fa d_off -field, +field if it is non-zero, or zero. .Sh IMPLEMENTATION NOTES The .Fa d_off -field is being used as a cookie to readdir for nfs servers. -These cookies can be cached and allow to read directory entries at a specific -offset on demand. +field is currently set to 0 by the NFS client, since the +directory offset cookies returned by an NFS server cannot +be used by +.Xr lseek 2 +at this time. .Sh RETURN VALUES If successful, the number of bytes actually transferred is returned. Otherwise, -1 is returned and the global variable From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 00:43: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 308EA552782; Tue, 2 Mar 2021 00:43: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 4DqJJg0w9zz4Z7r; Tue, 2 Mar 2021 00:43: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 1231155B6; Tue, 2 Mar 2021 00:43: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 1220hEMZ086205; Tue, 2 Mar 2021 00:43:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1220hE49086204; Tue, 2 Mar 2021 00:43:14 GMT (envelope-from git) Date: Tue, 2 Mar 2021 00:43:14 GMT Message-Id: <202103020043.1220hE49086204@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: 2224a2872be1 - stable/13 - Bump CTL block backend threads from 14 to 32 per LUN. 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: 2224a2872be189055ce5ff96700502a950bfd548 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 Mar 2021 00:43:15 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=2224a2872be189055ce5ff96700502a950bfd548 commit 2224a2872be189055ce5ff96700502a950bfd548 Author: Alexander Motin AuthorDate: 2021-02-23 15:58:56 +0000 Commit: Alexander Motin CommitDate: 2021-03-02 00:43:09 +0000 Bump CTL block backend threads from 14 to 32 per LUN. This makes random read benchmarks look better on a wide ZFS pools. I am not sure where the original value goes from, but it is there for too long now. MFC after: 1 week (cherry picked from commit 7d4c444374d53e54ce197138df64bf40c1fb05a3) --- sys/cam/ctl/ctl_backend_block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index cd4fab766844..c4e5e0dcf26d 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -226,7 +226,7 @@ struct ctl_be_block_io { extern struct ctl_softc *control_softc; -static int cbb_num_threads = 14; +static int cbb_num_threads = 32; SYSCTL_NODE(_kern_cam_ctl, OID_AUTO, block, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "CAM Target Layer Block Backend"); SYSCTL_INT(_kern_cam_ctl_block, OID_AUTO, num_threads, CTLFLAG_RWTUN, From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 00:44: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 5A22F552913; Tue, 2 Mar 2021 00:44: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 4DqJLf28Gjz4ZP4; Tue, 2 Mar 2021 00: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 3CA2C56C0; Tue, 2 Mar 2021 00: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 1220iw8u086577; Tue, 2 Mar 2021 00: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 1220iw8w086575; Tue, 2 Mar 2021 00:44:58 GMT (envelope-from git) Date: Tue, 2 Mar 2021 00:44:58 GMT Message-Id: <202103020044.1220iw8w086575@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: 67dedc2a115e - stable/12 - Bump CTL block backend threads from 14 to 32 per LUN. 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: 67dedc2a115e3330365809eeb35d313e02785dcf 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 Mar 2021 00:44:58 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=67dedc2a115e3330365809eeb35d313e02785dcf commit 67dedc2a115e3330365809eeb35d313e02785dcf Author: Alexander Motin AuthorDate: 2021-02-23 15:58:56 +0000 Commit: Alexander Motin CommitDate: 2021-03-02 00:44:45 +0000 Bump CTL block backend threads from 14 to 32 per LUN. This makes random read benchmarks look better on a wide ZFS pools. I am not sure where the original value goes from, but it is there for too long now. MFC after: 1 week (cherry picked from commit 7d4c444374d53e54ce197138df64bf40c1fb05a3) --- sys/cam/ctl/ctl_backend_block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index bd233165b10d..85787d35eb6c 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -225,7 +225,7 @@ struct ctl_be_block_io { extern struct ctl_softc *control_softc; -static int cbb_num_threads = 14; +static int cbb_num_threads = 32; SYSCTL_NODE(_kern_cam_ctl, OID_AUTO, block, CTLFLAG_RD, 0, "CAM Target Layer Block Backend"); SYSCTL_INT(_kern_cam_ctl_block, OID_AUTO, num_threads, CTLFLAG_RWTUN, From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 00:49: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 88D8B5525F7; Tue, 2 Mar 2021 00:49: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 4DqJSG3VJcz4ZZX; Tue, 2 Mar 2021 00:49: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 6AF745718; Tue, 2 Mar 2021 00:49: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 1220no5m087442; Tue, 2 Mar 2021 00:49:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1220noIa087441; Tue, 2 Mar 2021 00:49:50 GMT (envelope-from git) Date: Tue, 2 Mar 2021 00:49:50 GMT Message-Id: <202103020049.1220noIa087441@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: d742dfbddd87 - stable/13 - riscv: Don't set __NO_TLS to disable some uses of TLS. 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: d742dfbddd87769ba417f751a2c8a3d1ff4f11eb 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 Mar 2021 00:49:50 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d742dfbddd87769ba417f751a2c8a3d1ff4f11eb commit d742dfbddd87769ba417f751a2c8a3d1ff4f11eb Author: John Baldwin AuthorDate: 2021-02-18 00:33:09 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-02 00:49:42 +0000 riscv: Don't set __NO_TLS to disable some uses of TLS. (cherry picked from commit dd176fd7e7b5aad231cd6ebf49fd14ae7394dfee) --- sys/sys/cdefs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 75bedd4b8128..4de1ef011756 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -768,7 +768,7 @@ #endif #endif /* __STDC_WANT_LIB_EXT1__ */ -#if defined(__mips) || defined(__riscv) || \ +#if defined(__mips) || \ (defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1)) #define __NO_TLS 1 #endif From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 00:49: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 ACFCE5527CC; Tue, 2 Mar 2021 00:49: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 4DqJSH4Qp3z4ZZY; Tue, 2 Mar 2021 00:49: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 8AD455796; Tue, 2 Mar 2021 00:49: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 1220np4m087465; Tue, 2 Mar 2021 00:49:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1220npEP087464; Tue, 2 Mar 2021 00:49:51 GMT (envelope-from git) Date: Tue, 2 Mar 2021 00:49:51 GMT Message-Id: <202103020049.1220npEP087464@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: 49fe71bb1e8f - stable/13 - mips: Don't set __NO_TLS to disable some uses of TLS. 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: 49fe71bb1e8f3e916fe856da80486461e3e2c29d 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 Mar 2021 00:49:51 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=49fe71bb1e8f3e916fe856da80486461e3e2c29d commit 49fe71bb1e8f3e916fe856da80486461e3e2c29d Author: John Baldwin AuthorDate: 2021-02-18 00:34:23 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-02 00:49:42 +0000 mips: Don't set __NO_TLS to disable some uses of TLS. (cherry picked from commit 24fd63e0970f91189dd2acde987bd2e4c8c04a50) --- sys/sys/cdefs.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 4de1ef011756..1e670fd87d6f 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -768,8 +768,7 @@ #endif #endif /* __STDC_WANT_LIB_EXT1__ */ -#if defined(__mips) || \ - (defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1)) +#if defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1) #define __NO_TLS 1 #endif From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 00:49: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 DC8CD5528AC; Tue, 2 Mar 2021 00:49: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 4DqJSJ5XRZz4Zd5; Tue, 2 Mar 2021 00:49: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 AFE7C5797; Tue, 2 Mar 2021 00:49: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 1220nq8N087487; Tue, 2 Mar 2021 00:49:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1220nqrW087486; Tue, 2 Mar 2021 00:49:52 GMT (envelope-from git) Date: Tue, 2 Mar 2021 00:49:52 GMT Message-Id: <202103020049.1220nqrW087486@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: 73dc6674e08c - stable/13 - Remove __NO_TLS. 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: 73dc6674e08c40151c1500860f60f7b22994a0ff 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 Mar 2021 00:49:53 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=73dc6674e08c40151c1500860f60f7b22994a0ff commit 73dc6674e08c40151c1500860f60f7b22994a0ff Author: Konstantin Belousov AuthorDate: 2021-02-19 15:20:29 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-02 00:49:42 +0000 Remove __NO_TLS. MFC note: this plus the merge of two preliminary removal of __NO_TLS definitions for mips and risc-v break ABI. It was decided that doing ABI break on tier 2 platforms at this stage of 13.0 release process is better than drag on __NO_TLS presence for the 13.x branch lifetime. (cherry picked from commit 3ae8d83d04a7a6ec11b64c89ee60c180b0bde30e) --- include/runetype.h | 4 ++-- lib/libc/gen/getutxent.c | 5 ----- lib/libc/gen/utxdb.c | 4 ---- lib/libc/locale/setrunelocale.c | 4 ---- lib/libc/locale/xlocale.c | 15 +-------------- lib/libc/locale/xlocale_private.h | 5 +---- lib/libc/string/strerror.c | 5 ----- lib/libgssapi/gss_display_status.c | 10 ---------- sys/sys/cdefs.h | 4 ---- tests/sys/opencrypto/cryptodevh.py | 1 - 10 files changed, 4 insertions(+), 53 deletions(-) diff --git a/include/runetype.h b/include/runetype.h index 4aca128f8c8a..93007809dbf8 100644 --- a/include/runetype.h +++ b/include/runetype.h @@ -88,7 +88,7 @@ typedef struct { __BEGIN_DECLS extern const _RuneLocale _DefaultRuneLocale; extern const _RuneLocale *_CurrentRuneLocale; -#if defined(__NO_TLS) || defined(__RUNETYPE_INTERNAL) +#ifdef __RUNETYPE_INTERNAL extern const _RuneLocale *__getCurrentRuneLocale(void); #else extern _Thread_local const _RuneLocale *_ThreadRuneLocale; @@ -99,7 +99,7 @@ static __inline const _RuneLocale *__getCurrentRuneLocale(void) return _ThreadRuneLocale; return _CurrentRuneLocale; } -#endif /* __NO_TLS || __RUNETYPE_INTERNAL */ +#endif /*__RUNETYPE_INTERNAL */ #define _CurrentRuneLocale (__getCurrentRuneLocale()) __END_DECLS diff --git a/lib/libc/gen/getutxent.c b/lib/libc/gen/getutxent.c index e0d993221e7e..664498126f13 100644 --- a/lib/libc/gen/getutxent.c +++ b/lib/libc/gen/getutxent.c @@ -40,13 +40,8 @@ __FBSDID("$FreeBSD$"); #include "utxdb.h" #include "un-namespace.h" -#ifdef __NO_TLS -static FILE *uf = NULL; -static int udb; -#else static _Thread_local FILE *uf = NULL; static _Thread_local int udb; -#endif int setutxdb(int db, const char *file) diff --git a/lib/libc/gen/utxdb.c b/lib/libc/gen/utxdb.c index f8dea105702c..3edccdbd2c2f 100644 --- a/lib/libc/gen/utxdb.c +++ b/lib/libc/gen/utxdb.c @@ -128,11 +128,7 @@ utx_to_futx(const struct utmpx *ut, struct futx *fu) struct utmpx * futx_to_utx(const struct futx *fu) { -#ifdef __NO_TLS - static struct utmpx *ut; -#else static _Thread_local struct utmpx *ut; -#endif if (ut == NULL) { ut = calloc(1, sizeof *ut); diff --git a/lib/libc/locale/setrunelocale.c b/lib/libc/locale/setrunelocale.c index 2e6fed9466e4..551d32b7ab6a 100644 --- a/lib/libc/locale/setrunelocale.c +++ b/lib/libc/locale/setrunelocale.c @@ -56,12 +56,10 @@ __FBSDID("$FreeBSD$"); #undef _CurrentRuneLocale extern _RuneLocale const *_CurrentRuneLocale; -#ifndef __NO_TLS /* * A cached version of the runes for this thread. Used by ctype.h */ _Thread_local const _RuneLocale *_ThreadRuneLocale; -#endif extern int __mb_sb_limit; @@ -199,7 +197,6 @@ __wrap_setrunelocale(const char *locale) return (_LDP_LOADED); } -#ifndef __NO_TLS void __set_thread_rune_locale(locale_t loc) { @@ -212,7 +209,6 @@ __set_thread_rune_locale(locale_t loc) _ThreadRuneLocale = XLOCALE_CTYPE(loc)->runes; } } -#endif void * __ctype_load(const char *locale, locale_t unused __unused) diff --git a/lib/libc/locale/xlocale.c b/lib/libc/locale/xlocale.c index fb674f86bbff..d64262da809e 100644 --- a/lib/libc/locale/xlocale.c +++ b/lib/libc/locale/xlocale.c @@ -55,12 +55,11 @@ extern struct xlocale_component __xlocale_global_messages; extern struct xlocale_component __xlocale_C_collate; extern struct xlocale_component __xlocale_C_ctype; -#ifndef __NO_TLS /* * The locale for this thread. */ _Thread_local locale_t __thread_locale; -#endif + /* * Flag indicating that one or more per-thread locales exist. */ @@ -143,16 +142,6 @@ get_thread_locale(void) pthread_getspecific(locale_info_key)); } -#ifdef __NO_TLS -locale_t -__get_locale(void) -{ - locale_t l = get_thread_locale(); - return (l ? l : &__xlocale_global_locale); - -} -#endif - static void set_thread_locale(locale_t loc) { @@ -172,10 +161,8 @@ set_thread_locale(locale_t loc) } else { pthread_setspecific(locale_info_key, l); } -#ifndef __NO_TLS __thread_locale = l; __set_thread_rune_locale(loc); -#endif } /** diff --git a/lib/libc/locale/xlocale_private.h b/lib/libc/locale/xlocale_private.h index 391e375bc03d..bc40f28fc9eb 100644 --- a/lib/libc/locale/xlocale_private.h +++ b/lib/libc/locale/xlocale_private.h @@ -185,7 +185,7 @@ void __set_thread_rune_locale(locale_t loc); * locale has ever been set, then we always use the global locale. */ extern int __has_thread_locale; -#ifndef __NO_TLS + /** * The per-thread locale. Avoids the need to use pthread lookup functions when * getting the per-thread locale. @@ -206,9 +206,6 @@ static inline locale_t __get_locale(void) } return (__thread_locale ? __thread_locale : &__xlocale_global_locale); } -#else -locale_t __get_locale(void); -#endif /** * Two magic values are allowed for locale_t objects. NULL and -1. This diff --git a/lib/libc/string/strerror.c b/lib/libc/string/strerror.c index 11b9701d968f..bb685e4f7dc9 100644 --- a/lib/libc/string/strerror.c +++ b/lib/libc/string/strerror.c @@ -128,16 +128,11 @@ strerror_r(int errnum, char *strerrbuf, size_t buflen) char * strerror_l(int num, locale_t locale) { -#ifndef __NO_TLS static _Thread_local char ebuf[NL_TEXTMAX]; if (strerror_rl(num, ebuf, sizeof(ebuf), locale) != 0) errno = EINVAL; return (ebuf); -#else - errno = ENOTSUP; - return (NULL); -#endif } char * diff --git a/lib/libgssapi/gss_display_status.c b/lib/libgssapi/gss_display_status.c index 55ca83ce9aa8..d0c3453a0d6b 100644 --- a/lib/libgssapi/gss_display_status.c +++ b/lib/libgssapi/gss_display_status.c @@ -174,16 +174,6 @@ supplementary_error(OM_uint32 v) return msgs[v]; } -#if defined(__NO_TLS) - -/* - * These platforms don't support TLS on FreeBSD - threads will just - * have to step on each other's error values for now. - */ -#define __thread - -#endif - struct mg_thread_ctx { gss_OID mech; OM_uint32 maj_stat; diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 1e670fd87d6f..d11bee96e10a 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -768,10 +768,6 @@ #endif #endif /* __STDC_WANT_LIB_EXT1__ */ -#if defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1) -#define __NO_TLS 1 -#endif - /* * Old versions of GCC use non-standard ARM arch symbols; acle-compat.h * translates them to __ARM_ARCH and the modern feature symbols defined by ARM. diff --git a/tests/sys/opencrypto/cryptodevh.py b/tests/sys/opencrypto/cryptodevh.py index be853f496930..c5719e47c8c1 100644 --- a/tests/sys/opencrypto/cryptodevh.py +++ b/tests/sys/opencrypto/cryptodevh.py @@ -133,7 +133,6 @@ __POSIX_VISIBLE = 200809 __XSI_VISIBLE = 700 __BSD_VISIBLE = 1 __ISO_C_VISIBLE = 2011 -__NO_TLS = 1 CRYPTO_DRIVERS_INITIAL = 4 CRYPTO_SW_SESSIONS = 32 NULL_HASH_LEN = 16 From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 01:08: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 64480552E47; Tue, 2 Mar 2021 01:08: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 4DqJsG2Rz7z4bXG; Tue, 2 Mar 2021 01:08: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 474D95938; Tue, 2 Mar 2021 01:08: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 122182TV013917; Tue, 2 Mar 2021 01:08:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122182uA013916; Tue, 2 Mar 2021 01:08:02 GMT (envelope-from git) Date: Tue, 2 Mar 2021 01:08:02 GMT Message-Id: <202103020108.122182uA013916@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: b22315c7983a - stable/13 - cardbus: Be sure to acquire Giant when calling into newbus 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: b22315c7983a03538f3f2a96aa20f0d119555087 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 Mar 2021 01:08:02 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=b22315c7983a03538f3f2a96aa20f0d119555087 commit b22315c7983a03538f3f2a96aa20f0d119555087 Author: Warner Losh AuthorDate: 2021-02-27 07:00:52 +0000 Commit: Warner Losh CommitDate: 2021-03-02 01:07:50 +0000 cardbus: Be sure to acquire Giant when calling into newbus Acquire Giant in cardbus_detach_card. This used to be done above us, but no more. Tested by: kargl@ MFC After: 3 days (cherry picked from commit c01da939b0998f8de068a23c9016c377e761255e) --- sys/dev/cardbus/cardbus.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/dev/cardbus/cardbus.c b/sys/dev/cardbus/cardbus.c index 391267944ec4..50a21dfc0b82 100644 --- a/sys/dev/cardbus/cardbus.c +++ b/sys/dev/cardbus/cardbus.c @@ -256,10 +256,11 @@ cardbus_detach_card(device_t cbdev) { int err = 0; + mtx_lock(&Giant); err = bus_generic_detach(cbdev); - if (err) - return (err); - err = device_delete_children(cbdev); + if (err == 0) + err = device_delete_children(cbdev); + mtx_unlock(&Giant); if (err) return (err); From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 12:47: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 125B15686AE; Tue, 2 Mar 2021 12:47: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 4DqcNQ03Fnz3qG1; Tue, 2 Mar 2021 12:47: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 E4B7816BDA; Tue, 2 Mar 2021 12:47: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 122ClXV4037541; Tue, 2 Mar 2021 12:47:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122ClXbw037540; Tue, 2 Mar 2021 12:47:33 GMT (envelope-from git) Date: Tue, 2 Mar 2021 12:47:33 GMT Message-Id: <202103021247.122ClXbw037540@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 459f1b906515 - stable/13 - sctp: improve consistency MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 459f1b906515076b7ce30a06ab69a60891d8cbe8 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 Mar 2021 12:47:34 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=459f1b906515076b7ce30a06ab69a60891d8cbe8 commit 459f1b906515076b7ce30a06ab69a60891d8cbe8 Author: Michael Tuexen AuthorDate: 2021-01-23 19:56:45 +0000 Commit: Michael Tuexen CommitDate: 2021-03-02 12:22:40 +0000 sctp: improve consistency No functional change intended. (cherry picked from commit 7a051c0a7890dc8e490ebe125bfc70a28e89ddaf) --- sys/netinet/sctp_input.c | 2 +- sys/netinet/sctp_output.c | 18 +++++++++--------- sys/netinet/sctp_structs.h | 32 ++++++++++++++++---------------- sys/netinet/sctputil.c | 6 +++--- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 1606e4d9d1cf..43a2b06d1c79 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -1871,9 +1871,9 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, asoc->strmout[i].abandoned_sent[0] = 0; asoc->strmout[i].abandoned_unsent[0] = 0; #endif - stcb->asoc.strmout[i].sid = i; stcb->asoc.strmout[i].next_mid_ordered = 0; stcb->asoc.strmout[i].next_mid_unordered = 0; + stcb->asoc.strmout[i].sid = i; stcb->asoc.strmout[i].last_msg_incomplete = 0; } TAILQ_FOREACH_SAFE(strrst, &asoc->resetHead, next_resp, nstrrst) { diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index d8cf063c6b53..67b1aad32f1c 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -3629,9 +3629,8 @@ sctp_process_cmsgs_for_init(struct sctp_tcb *stcb, struct mbuf *control, int *er } for (i = 0; i < stcb->asoc.streamoutcnt; i++) { TAILQ_INIT(&stcb->asoc.strmout[i].outqueue); + stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], NULL); stcb->asoc.strmout[i].chunks_on_queues = 0; - stcb->asoc.strmout[i].next_mid_ordered = 0; - stcb->asoc.strmout[i].next_mid_unordered = 0; #if defined(SCTP_DETAILED_STR_STATS) for (j = 0; j < SCTP_PR_SCTP_MAX + 1; j++) { stcb->asoc.strmout[i].abandoned_sent[j] = 0; @@ -3641,10 +3640,11 @@ sctp_process_cmsgs_for_init(struct sctp_tcb *stcb, struct mbuf *control, int *er stcb->asoc.strmout[i].abandoned_sent[0] = 0; stcb->asoc.strmout[i].abandoned_unsent[0] = 0; #endif + stcb->asoc.strmout[i].next_mid_ordered = 0; + stcb->asoc.strmout[i].next_mid_unordered = 0; stcb->asoc.strmout[i].sid = i; stcb->asoc.strmout[i].last_msg_incomplete = 0; stcb->asoc.strmout[i].state = SCTP_STREAM_OPENING; - stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], NULL); } } break; @@ -12136,18 +12136,18 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb, stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 0, 1); for (i = 0; i < stcb->asoc.streamoutcnt; i++) { TAILQ_INIT(&stcb->asoc.strmout[i].outqueue); - stcb->asoc.strmout[i].chunks_on_queues = oldstream[i].chunks_on_queues; - stcb->asoc.strmout[i].next_mid_ordered = oldstream[i].next_mid_ordered; - stcb->asoc.strmout[i].next_mid_unordered = oldstream[i].next_mid_unordered; - stcb->asoc.strmout[i].last_msg_incomplete = oldstream[i].last_msg_incomplete; - stcb->asoc.strmout[i].sid = i; - stcb->asoc.strmout[i].state = oldstream[i].state; /* FIX ME FIX ME */ /* * This should be a SS_COPY operation FIX ME STREAM * SCHEDULER EXPERT */ stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], &oldstream[i]); + stcb->asoc.strmout[i].chunks_on_queues = oldstream[i].chunks_on_queues; + stcb->asoc.strmout[i].next_mid_ordered = oldstream[i].next_mid_ordered; + stcb->asoc.strmout[i].next_mid_unordered = oldstream[i].next_mid_unordered; + stcb->asoc.strmout[i].last_msg_incomplete = oldstream[i].last_msg_incomplete; + stcb->asoc.strmout[i].sid = i; + stcb->asoc.strmout[i].state = oldstream[i].state; /* now anything on those queues? */ TAILQ_FOREACH_SAFE(sp, &oldstream[i].outqueue, next, nsp) { TAILQ_REMOVE(&oldstream[i].outqueue, sp, next); diff --git a/sys/netinet/sctp_structs.h b/sys/netinet/sctp_structs.h index 52fe30098ad7..a22dac047971 100644 --- a/sys/netinet/sctp_structs.h +++ b/sys/netinet/sctp_structs.h @@ -548,6 +548,20 @@ struct sctp_stream_in { TAILQ_HEAD(sctpwheel_listhead, sctp_stream_out); TAILQ_HEAD(sctplist_listhead, sctp_stream_queue_pending); +/* + * This union holds all data necessary for + * different stream schedulers. + */ +struct scheduling_data { + struct sctp_stream_out *locked_on_sending; + /* circular looking for output selection */ + struct sctp_stream_out *last_out_stream; + union { + struct sctpwheel_listhead wheel; + struct sctplist_listhead list; + } out; +}; + /* Round-robin schedulers */ struct ss_rr { /* next link in wheel */ @@ -570,20 +584,6 @@ struct ss_fb { int32_t rounds; }; -/* - * This union holds all data necessary for - * different stream schedulers. - */ -struct scheduling_data { - struct sctp_stream_out *locked_on_sending; - /* circular looking for output selection */ - struct sctp_stream_out *last_out_stream; - union { - struct sctpwheel_listhead wheel; - struct sctplist_listhead list; - } out; -}; - /* * This union holds all parameters per stream * necessary for different stream schedulers. @@ -601,8 +601,6 @@ union scheduling_parameters { #define SCTP_STREAM_RESET_PENDING 0x03 #define SCTP_STREAM_RESET_IN_FLIGHT 0x04 -#define SCTP_MAX_STREAMS_AT_ONCE_RESET 200 - /* This struct is used to track the traffic on outbound streams */ struct sctp_stream_out { struct sctp_streamhead outqueue; @@ -627,6 +625,8 @@ struct sctp_stream_out { uint8_t state; }; +#define SCTP_MAX_STREAMS_AT_ONCE_RESET 200 + /* used to keep track of the addresses yet to try to add/delete */ TAILQ_HEAD(sctp_asconf_addrhead, sctp_asconf_addr); struct sctp_asconf_addr { diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 7772ebd57327..084b7bd6af72 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -1291,9 +1291,8 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, * that were dropped must be notified to the upper layer as * failed to send. */ - asoc->strmout[i].next_mid_ordered = 0; - asoc->strmout[i].next_mid_unordered = 0; TAILQ_INIT(&asoc->strmout[i].outqueue); + asoc->ss_functions.sctp_ss_init_stream(stcb, &asoc->strmout[i], NULL); asoc->strmout[i].chunks_on_queues = 0; #if defined(SCTP_DETAILED_STR_STATS) for (j = 0; j < SCTP_PR_SCTP_MAX + 1; j++) { @@ -1304,10 +1303,11 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, asoc->strmout[i].abandoned_sent[0] = 0; asoc->strmout[i].abandoned_unsent[0] = 0; #endif + asoc->strmout[i].next_mid_ordered = 0; + asoc->strmout[i].next_mid_unordered = 0; asoc->strmout[i].sid = i; asoc->strmout[i].last_msg_incomplete = 0; asoc->strmout[i].state = SCTP_STREAM_OPENING; - asoc->ss_functions.sctp_ss_init_stream(stcb, &asoc->strmout[i], NULL); } asoc->ss_functions.sctp_ss_init(stcb, asoc, 0); From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 12:50: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 942925684AE; Tue, 2 Mar 2021 12:50: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 4DqcSG3qrdz3qP3; Tue, 2 Mar 2021 12:50: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 7684B17116; Tue, 2 Mar 2021 12:50: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 122CosRM046347; Tue, 2 Mar 2021 12:50:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122CosQw046346; Tue, 2 Mar 2021 12:50:54 GMT (envelope-from git) Date: Tue, 2 Mar 2021 12:50:54 GMT Message-Id: <202103021250.122CosQw046346@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 21398f02b0c7 - stable/13 - sctp: fix PR-SCTP stats when adding addtional streams MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 21398f02b0c7913f815ae6ded426da60d92c635b 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 Mar 2021 12:50:54 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=21398f02b0c7913f815ae6ded426da60d92c635b commit 21398f02b0c7913f815ae6ded426da60d92c635b Author: Michael Tuexen AuthorDate: 2021-01-23 23:50:33 +0000 Commit: Michael Tuexen CommitDate: 2021-03-02 12:27:13 +0000 sctp: fix PR-SCTP stats when adding addtional streams (cherry picked from commit 0f7573ffd6141b19419c9a6238246b9ba0e6dce6) --- sys/netinet/sctp_output.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 67b1aad32f1c..d58ebf785238 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -12143,6 +12143,15 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb, */ stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], &oldstream[i]); stcb->asoc.strmout[i].chunks_on_queues = oldstream[i].chunks_on_queues; +#if defined(SCTP_DETAILED_STR_STATS) + for (j = 0; j < SCTP_PR_SCTP_MAX + 1; j++) { + stcb->asoc.strmout[i].abandoned_sent[j] = oldstream[i].abandoned_sent[j]; + stcb->asoc.strmout[i].abandoned_unsent[j] = oldstream[i].abandoned_unsent[j]; + } +#else + stcb->asoc.strmout[i].abandoned_sent[0] = oldstream[i].abandoned_sent[0]; + stcb->asoc.strmout[i].abandoned_unsent[0] = oldstream[i].abandoned_unsent[0]; +#endif stcb->asoc.strmout[i].next_mid_ordered = oldstream[i].next_mid_ordered; stcb->asoc.strmout[i].next_mid_unordered = oldstream[i].next_mid_unordered; stcb->asoc.strmout[i].last_msg_incomplete = oldstream[i].last_msg_incomplete; From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 12:51: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 532425684BE; Tue, 2 Mar 2021 12:51: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 4DqcTS1xfHz3qks; Tue, 2 Mar 2021 12:51: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 35E2F17129; Tue, 2 Mar 2021 12:51: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 122CpubS050467; Tue, 2 Mar 2021 12:51:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122Cpuu1050466; Tue, 2 Mar 2021 12:51:56 GMT (envelope-from git) Date: Tue, 2 Mar 2021 12:51:56 GMT Message-Id: <202103021251.122Cpuu1050466@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 3fa95c0fe60b - stable/13 - sctp: fix a locking issue for old unordered data MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3fa95c0fe60bbd67db6043c7e18910387bbe1bac 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 Mar 2021 12:51:56 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=3fa95c0fe60bbd67db6043c7e18910387bbe1bac commit 3fa95c0fe60bbd67db6043c7e18910387bbe1bac Author: Michael Tuexen AuthorDate: 2021-01-31 09:46:23 +0000 Commit: Michael Tuexen CommitDate: 2021-03-02 12:28:09 +0000 sctp: fix a locking issue for old unordered data Thanks to Anatoly Korniltsev for reporting the issue for the userland stack. (cherry picked from commit 8dc6a1edca6de0c64f6c082f69097746d1346592) --- sys/netinet/sctp_indata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/sctp_indata.c b/sys/netinet/sctp_indata.c index 08af27c934fb..6997a0099c88 100644 --- a/sys/netinet/sctp_indata.c +++ b/sys/netinet/sctp_indata.c @@ -803,7 +803,7 @@ restart: } memset(nc, 0, sizeof(struct sctp_queued_to_read)); TAILQ_REMOVE(&control->reasm, chk, sctp_next); - sctp_add_chk_to_control(control, strm, stcb, asoc, chk, SCTP_READ_LOCK_NOT_HELD); + sctp_add_chk_to_control(control, strm, stcb, asoc, chk, inp_read_lock_held); fsn++; cnt_added++; chk = NULL; From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 12:52: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 55500568A07; Tue, 2 Mar 2021 12:52: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 4DqcVM1yzVz3qpS; Tue, 2 Mar 2021 12:52: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 365F71736A; Tue, 2 Mar 2021 12:52: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 122Cqh39050723; Tue, 2 Mar 2021 12:52:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122CqhrK050722; Tue, 2 Mar 2021 12:52:43 GMT (envelope-from git) Date: Tue, 2 Mar 2021 12:52:43 GMT Message-Id: <202103021252.122CqhrK050722@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 16b538975024 - stable/13 - sctp: improve input validation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 16b538975024e2b7038807bf5b712124f5a7b889 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 Mar 2021 12:52:43 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=16b538975024e2b7038807bf5b712124f5a7b889 commit 16b538975024e2b7038807bf5b712124f5a7b889 Author: Michael Tuexen AuthorDate: 2021-01-31 22:43:15 +0000 Commit: Michael Tuexen CommitDate: 2021-03-02 12:29:00 +0000 sctp: improve input validation Improve the handling of INIT chunks in specific szenarios and report and appropriate error cause. Thanks to Anatoly Korniltsev for reporting the issue for the userland stack. (cherry picked from commit af885c57d65d33c0306e91d3e090e76772a0d012) --- sys/netinet/sctp_output.c | 100 ++++++++++++++++++++++++++++------------------ 1 file changed, 62 insertions(+), 38 deletions(-) diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index d58ebf785238..0f7ade931e61 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -5232,31 +5232,33 @@ invalid_size: return (op_err); } -static int +/* + * Given a INIT chunk, look through the parameters to verify that there + * are no new addresses. + * Return true, if there is a new address or there is a problem parsing + the parameters. Provide an optional error cause used when sending an ABORT. + * Return false, if there are no new addresses and there is no problem in + parameter processing. + */ +static bool sctp_are_there_new_addresses(struct sctp_association *asoc, - struct mbuf *in_initpkt, int offset, struct sockaddr *src) + struct mbuf *in_initpkt, int offset, int limit, struct sockaddr *src, + struct mbuf **op_err) { - /* - * Given a INIT packet, look through the packet to verify that there - * are NO new addresses. As we go through the parameters add reports - * of any un-understood parameters that require an error. Also we - * must return (1) to drop the packet if we see a un-understood - * parameter that tells us to drop the chunk. - */ struct sockaddr *sa_touse; struct sockaddr *sa; struct sctp_paramhdr *phdr, params; - uint16_t ptype, plen; - uint8_t fnd; struct sctp_nets *net; - int check_src; #ifdef INET struct sockaddr_in sin4, *sa4; #endif #ifdef INET6 struct sockaddr_in6 sin6, *sa6; #endif + uint16_t ptype, plen; + bool fnd, check_src; + *op_err = NULL; #ifdef INET memset(&sin4, 0, sizeof(sin4)); sin4.sin_family = AF_INET; @@ -5268,19 +5270,19 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, sin6.sin6_len = sizeof(sin6); #endif /* First what about the src address of the pkt ? */ - check_src = 0; + check_src = false; switch (src->sa_family) { #ifdef INET case AF_INET: if (asoc->scope.ipv4_addr_legal) { - check_src = 1; + check_src = true; } break; #endif #ifdef INET6 case AF_INET6: if (asoc->scope.ipv6_addr_legal) { - check_src = 1; + check_src = true; } break; #endif @@ -5289,7 +5291,7 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, break; } if (check_src) { - fnd = 0; + fnd = false; TAILQ_FOREACH(net, &asoc->nets, sctp_next) { sa = (struct sockaddr *)&net->ro._l_addr; if (sa->sa_family == src->sa_family) { @@ -5300,7 +5302,7 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, sa4 = (struct sockaddr_in *)sa; src4 = (struct sockaddr_in *)src; if (sa4->sin_addr.s_addr == src4->sin_addr.s_addr) { - fnd = 1; + fnd = true; break; } } @@ -5312,16 +5314,22 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, sa6 = (struct sockaddr_in6 *)sa; src6 = (struct sockaddr_in6 *)src; if (SCTP6_ARE_ADDR_EQUAL(sa6, src6)) { - fnd = 1; + fnd = true; break; } } #endif } } - if (fnd == 0) { - /* New address added! no need to look further. */ - return (1); + if (!fnd) { + /* + * If sending an ABORT in case of an additional + * address, don't use the new address error cause. + * This looks no different than if no listener was + * present. + */ + *op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Address added"); + return (true); } } /* Ok so far lets munge through the rest of the packet */ @@ -5331,6 +5339,14 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, sa_touse = NULL; ptype = ntohs(phdr->param_type); plen = ntohs(phdr->param_length); + if (offset + plen > limit) { + *op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, "Partial parameter"); + return (true); + } + if (plen < sizeof(struct sctp_paramhdr)) { + *op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, "Parameter length too small"); + return (true); + } switch (ptype) { #ifdef INET case SCTP_IPV4_ADDRESS: @@ -5338,12 +5354,14 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, struct sctp_ipv4addr_param *p4, p4_buf; if (plen != sizeof(struct sctp_ipv4addr_param)) { - return (1); + *op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, "Parameter length illegal"); + return (true); } phdr = sctp_get_next_param(in_initpkt, offset, (struct sctp_paramhdr *)&p4_buf, sizeof(p4_buf)); if (phdr == NULL) { - return (1); + *op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, ""); + return (true); } if (asoc->scope.ipv4_addr_legal) { p4 = (struct sctp_ipv4addr_param *)phdr; @@ -5359,12 +5377,14 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, struct sctp_ipv6addr_param *p6, p6_buf; if (plen != sizeof(struct sctp_ipv6addr_param)) { - return (1); + *op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, "Parameter length illegal"); + return (true); } phdr = sctp_get_next_param(in_initpkt, offset, (struct sctp_paramhdr *)&p6_buf, sizeof(p6_buf)); if (phdr == NULL) { - return (1); + *op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, ""); + return (true); } if (asoc->scope.ipv6_addr_legal) { p6 = (struct sctp_ipv6addr_param *)phdr; @@ -5381,7 +5401,7 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, } if (sa_touse) { /* ok, sa_touse points to one to check */ - fnd = 0; + fnd = false; TAILQ_FOREACH(net, &asoc->nets, sctp_next) { sa = (struct sockaddr *)&net->ro._l_addr; if (sa->sa_family != sa_touse->sa_family) { @@ -5392,7 +5412,7 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, sa4 = (struct sockaddr_in *)sa; if (sa4->sin_addr.s_addr == sin4.sin_addr.s_addr) { - fnd = 1; + fnd = true; break; } } @@ -5402,21 +5422,31 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, sa6 = (struct sockaddr_in6 *)sa; if (SCTP6_ARE_ADDR_EQUAL( sa6, &sin6)) { - fnd = 1; + fnd = true; break; } } #endif } if (!fnd) { - /* New addr added! no need to look further */ - return (1); + /* + * If sending an ABORT in case of an + * additional address, don't use the new + * address error cause. This looks no + * different than if no listener was + * present. + */ + *op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Address added"); + return (true); } } offset += SCTP_SIZE32(plen); + if (offset >= limit) { + break; + } phdr = sctp_get_next_param(in_initpkt, offset, ¶ms, sizeof(params)); } - return (0); + return (false); } /* @@ -5472,17 +5502,11 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb, } if ((asoc != NULL) && (SCTP_GET_STATE(stcb) != SCTP_STATE_COOKIE_WAIT)) { - if (sctp_are_there_new_addresses(asoc, init_pkt, offset, src)) { + if (sctp_are_there_new_addresses(asoc, init_pkt, offset, offset + ntohs(init_chk->ch.chunk_length), src, &op_err)) { /* * new addresses, out of here in non-cookie-wait * states - * - * Send an ABORT, without the new address error - * cause. This looks no different than if no - * listener was present. */ - op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), - "Address added"); sctp_send_abort(init_pkt, iphlen, src, dst, sh, 0, op_err, mflowtype, mflowid, inp->fibnum, vrf_id, port); From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 12:53:27 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 586F55689B2; Tue, 2 Mar 2021 12:53:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DqcWC1VC3z3r2X; Tue, 2 Mar 2021 12:53:27 +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 26447170E1; Tue, 2 Mar 2021 12:53:27 +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 122CrRFJ050975; Tue, 2 Mar 2021 12:53:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122CrRt0050974; Tue, 2 Mar 2021 12:53:27 GMT (envelope-from git) Date: Tue, 2 Mar 2021 12:53:27 GMT Message-Id: <202103021253.122CrRt0050974@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 5573b94fa67f - stable/13 - sctp: small cleanup, no functional change intended. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5573b94fa67f954dd0db57de328e60941ee8c9d1 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 Mar 2021 12:53:27 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=5573b94fa67f954dd0db57de328e60941ee8c9d1 commit 5573b94fa67f954dd0db57de328e60941ee8c9d1 Author: Michael Tuexen AuthorDate: 2021-02-01 13:03:41 +0000 Commit: Michael Tuexen CommitDate: 2021-03-02 12:29:46 +0000 sctp: small cleanup, no functional change intended. (cherry picked from commit bdd4630c9a9cea64830f981fc897ac953c48892c) --- sys/netinet/sctputil.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 084b7bd6af72..319344842d5f 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -2032,14 +2032,13 @@ sctp_timeout_handler(void *t) sctp_inpcb_free(inp, SCTP_FREE_SHOULD_USE_ABORT, SCTP_CALLED_FROM_INPKILL_TIMER); inp = NULL; - goto out_no_decr; + goto out_decr; case SCTP_TIMER_TYPE_ASOCKILL: KASSERT(inp != NULL && stcb != NULL && net == NULL, ("timeout of type %d: inp = %p, stcb = %p, net = %p", type, inp, stcb, net)); SCTP_STAT_INCR(sctps_timoassockill); /* Can we free it yet? */ - SCTP_INP_DECR_REF(inp); sctp_timer_stop(SCTP_TIMER_TYPE_ASOCKILL, inp, stcb, NULL, SCTP_FROM_SCTPUTIL + SCTP_LOC_1); (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, @@ -2049,7 +2048,7 @@ sctp_timeout_handler(void *t) * duplicate unlock or unlock of a free mtx :-0 */ stcb = NULL; - goto out_no_decr; + goto out_decr; case SCTP_TIMER_TYPE_ADDR_WQ: KASSERT(inp == NULL && stcb == NULL && net == NULL, ("timeout of type %d: inp = %p, stcb = %p, net = %p", @@ -2107,7 +2106,6 @@ out_decr: if (net != NULL) { sctp_free_remote_addr(net); } -out_no_decr: SCTPDBG(SCTP_DEBUG_TIMER2, "Timer type %d handler finished.\n", type); CURVNET_RESTORE(); NET_EPOCH_EXIT(et); From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 12: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 5F1CA568B19; Tue, 2 Mar 2021 12: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 4DqcWy2G5Bz3qvX; Tue, 2 Mar 2021 12: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 409B217133; Tue, 2 Mar 2021 12: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 122Cs6OQ051203; Tue, 2 Mar 2021 12:54:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122Cs6V0051202; Tue, 2 Mar 2021 12:54:06 GMT (envelope-from git) Date: Tue, 2 Mar 2021 12:54:06 GMT Message-Id: <202103021254.122Cs6V0051202@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 2a9b68d5e1bb - stable/13 - libsysdecode: fix decoding of TCP_NOPUSH and TCP_MD5SIG MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2a9b68d5e1bba633c37cc829f52e79e1281e910b 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 Mar 2021 12:54:06 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=2a9b68d5e1bba633c37cc829f52e79e1281e910b commit 2a9b68d5e1bba633c37cc829f52e79e1281e910b Author: Michael Tuexen AuthorDate: 2021-02-09 22:35:55 +0000 Commit: Michael Tuexen CommitDate: 2021-03-02 12:30:24 +0000 libsysdecode: fix decoding of TCP_NOPUSH and TCP_MD5SIG TCP_FASTOPEN_MIN_COOKIE_LEN was incorrectly registered as a name of a IPPROTO_TCP level socket option, which overwrote TCP_NOPUSH. TCP_FASTOPEN_PSK_LEN was incorrectly registered as a name of an IPPROTO_TCP level socket option, which overwrote TCP_MD5SIG. Sponsored by: Netflix, Inc. (cherry picked from commit f25266bee7dafb10f03e06537c8127cc17335bed) --- lib/libsysdecode/mktables | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libsysdecode/mktables b/lib/libsysdecode/mktables index 3a0284a2deb4..3d152a3a2646 100644 --- a/lib/libsysdecode/mktables +++ b/lib/libsysdecode/mktables @@ -140,7 +140,7 @@ gen_table "sockopt" "SO_[A-Z]+[[:space:]]+0x[0-9]+" "sys/ gen_table "sockoptip" "(IP_[[:alnum:]_]+|MCAST_[[:alnum:]_]+_GROUP)[[:space:]]+" "netinet/in.h" "IP_DEFAULT|IP_MIN|IP_MAX|IP_PORTRANGE" gen_table "sockoptipv6" "IPV6_[[:alnum:]_]+[[:space:]]+[0-9]+" "netinet6/in6.h" "IPV6_ADDR_|IPV6_TAG_DIRECT|IPV6_OPTIONS|IPV6_RECVOPTS|IPV6_RECVRETOPTS|IPV6_RECVDSTADDR|IPV6_RETOPTS|IPV6_2292|IPV6_RECVRTHDRDSTOPTS|IPV6_REACHCONF|IPV6_PKTOPTIONS" gen_table "sockoptsctp" "SCTP_[[:alnum:]_]+[[:space:]]+[0-9]+" "netinet/sctp.h" -gen_table "sockopttcp" "TCP_[[:alnum:]_]+[[:space:]]+[0-9]+" "netinet/tcp.h" "TCP_MIN|TCP_MAX[^S]|TCP_MSS|TCP_[[:alnum:]_]+_MAX" +gen_table "sockopttcp" "TCP_[[:alnum:]_]+[[:space:]]+[0-9]+" "netinet/tcp.h" "TCP_MIN|TCP_MAX[^S]|TCP_MSS|TCP_[[:alnum:]_]+_MAX|TCP_FASTOPEN_MIN_COOKIE_LEN|TCP_FASTOPEN_PSK_LEN" gen_table "sockoptudp" "UDP_[[:alnum:]]+[[:space:]]+[0-9]+" "netinet/udp.h" "UDP_ENCAP_" gen_table "sockoptudplite" "UDPLITE_[[:alnum:]_]+[[:space:]]+[0-9]+" "netinet/udplite.h" gen_table "socktype" "SOCK_[A-Z]+[[:space:]]+[1-9]+[0-9]*" "sys/socket.h" From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 12:54: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 0EC2F568BB1; Tue, 2 Mar 2021 12:54: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 4DqcXZ74Yvz3r97; Tue, 2 Mar 2021 12:54: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 E575C16FD2; Tue, 2 Mar 2021 12:54: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 122Cschr051407; Tue, 2 Mar 2021 12:54:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122CscVE051406; Tue, 2 Mar 2021 12:54:38 GMT (envelope-from git) Date: Tue, 2 Mar 2021 12:54:38 GMT Message-Id: <202103021254.122CscVE051406@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: e949dcc283cd - stable/13 - tcp: improve behaviour when using TCP_NOOPT MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e949dcc283cd3b19e8e3113d8d3e10a72c2bbe6e 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 Mar 2021 12:54:39 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=e949dcc283cd3b19e8e3113d8d3e10a72c2bbe6e commit e949dcc283cd3b19e8e3113d8d3e10a72c2bbe6e Author: Michael Tuexen AuthorDate: 2021-02-14 11:10:31 +0000 Commit: Michael Tuexen CommitDate: 2021-03-02 12:31:01 +0000 tcp: improve behaviour when using TCP_NOOPT Use ISS for SEG.SEQ when sending a SYN-ACK segment in response to an SYN segment received in the SYN-SENT state on a socket having the IPPROTO_TCP level socket option TCP_NOOPT enabled. Reviewed by: rscheff Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D28656 (cherry picked from commit ed782b9f5a7a05debe944a33b4ac9e5629a95803) --- sys/netinet/tcp_output.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index cacc0c51bd8e..b4c7ab0a1ab7 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -785,6 +785,10 @@ send: #endif hdrlen = sizeof (struct tcpiphdr); + if (flags & TH_SYN) { + tp->snd_nxt = tp->iss; + } + /* * Compute options for segment. * We only have to care about SYN and established connection @@ -795,7 +799,6 @@ send: if ((tp->t_flags & TF_NOOPT) == 0) { /* Maximum segment size. */ if (flags & TH_SYN) { - tp->snd_nxt = tp->iss; to.to_mss = tcp_mssopt(&tp->t_inpcb->inp_inc); to.to_flags |= TOF_MSS; From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 12:55: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 45FF15688F0; Tue, 2 Mar 2021 12:55: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 4DqcYL1VVZz3rNp; Tue, 2 Mar 2021 12:55: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 26C1E17134; Tue, 2 Mar 2021 12:55: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 122CtIoI051658; Tue, 2 Mar 2021 12:55:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122CtI3R051657; Tue, 2 Mar 2021 12:55:18 GMT (envelope-from git) Date: Tue, 2 Mar 2021 12:55:18 GMT Message-Id: <202103021255.122CtI3R051657@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 04c13928d9f3 - stable/13 - sctp: clear a pointer to a net which will be removed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 04c13928d9f306a7d7ac34452644a538d2be6fdc 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 Mar 2021 12:55:18 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=04c13928d9f306a7d7ac34452644a538d2be6fdc commit 04c13928d9f306a7d7ac34452644a538d2be6fdc Author: Michael Tuexen AuthorDate: 2021-02-21 12:03:57 +0000 Commit: Michael Tuexen CommitDate: 2021-03-02 12:31:35 +0000 sctp: clear a pointer to a net which will be removed (cherry picked from commit 5ac839029d01c0f48e1b1ff1a599cb47cf5e98ee) --- sys/netinet/sctp_pcb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 2e082570cfc1..4d09ad3a7353 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -4443,6 +4443,10 @@ out: /* Clear net */ asoc->last_control_chunk_from = NULL; } + if (net == asoc->last_net_cmt_send_started) { + /* Clear net */ + asoc->last_net_cmt_send_started = NULL; + } if (net == stcb->asoc.alternate) { sctp_free_remote_addr(stcb->asoc.alternate); stcb->asoc.alternate = NULL; From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 12:56: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 A3E81568C35; Tue, 2 Mar 2021 12:56: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 4DqcZD4FKQz3rJj; Tue, 2 Mar 2021 12:56: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 8469D17229; Tue, 2 Mar 2021 12:56: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 122Cu4ge051914; Tue, 2 Mar 2021 12:56:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122Cu45Z051913; Tue, 2 Mar 2021 12:56:04 GMT (envelope-from git) Date: Tue, 2 Mar 2021 12:56:04 GMT Message-Id: <202103021256.122Cu45Z051913@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 8cf046aff971 - stable/13 - sctp: improve computation of an alternate net MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8cf046aff9719779b665f7f4f4a8bad4b3945341 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 Mar 2021 12:56:04 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=8cf046aff9719779b665f7f4f4a8bad4b3945341 commit 8cf046aff9719779b665f7f4f4a8bad4b3945341 Author: Michael Tuexen AuthorDate: 2021-02-21 16:13:06 +0000 Commit: Michael Tuexen CommitDate: 2021-03-02 12:32:21 +0000 sctp: improve computation of an alternate net Espeially handle the case where the net passed in is about to be deleted and therefore not in the list of nets anymore. Reported by: syzbot+9756917a7c8381adf5e8@syzkaller.appspotmail.com (cherry picked from commit b963ce4588b33f733aef3f7a7f3fbe5018a89728) --- sys/netinet/sctp_timer.c | 85 ++++++++++++++++++++++++++++-------------------- 1 file changed, 49 insertions(+), 36 deletions(-) diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c index bce1f5cd166d..582abd8e8854 100644 --- a/sys/netinet/sctp_timer.c +++ b/sys/netinet/sctp_timer.c @@ -164,8 +164,8 @@ sctp_threshold_management(struct sctp_inpcb *inp, struct sctp_tcb *stcb, } /* - * sctp_find_alternate_net() returns a non-NULL pointer as long - * the argument net is non-NULL. + * sctp_find_alternate_net() returns a non-NULL pointer as long as there + * exists nets, which are not being deleted. */ struct sctp_nets * sctp_find_alternate_net(struct sctp_tcb *stcb, @@ -174,14 +174,14 @@ sctp_find_alternate_net(struct sctp_tcb *stcb, { /* Find and return an alternate network if possible */ struct sctp_nets *alt, *mnet, *min_errors_net = NULL, *max_cwnd_net = NULL; - int once; + bool looped; /* JRS 5/14/07 - Initialize min_errors to an impossible value. */ int min_errors = -1; uint32_t max_cwnd = 0; if (stcb->asoc.numnets == 1) { - /* No others but net */ + /* No selection can be made. */ return (TAILQ_FIRST(&stcb->asoc.nets)); } /* @@ -328,25 +328,22 @@ sctp_find_alternate_net(struct sctp_tcb *stcb, return (max_cwnd_net); } } - mnet = net; - once = 0; - - if (mnet == NULL) { - mnet = TAILQ_FIRST(&stcb->asoc.nets); - if (mnet == NULL) { - return (NULL); - } + /* Look for an alternate net, which is active. */ + if ((net != NULL) && ((net->dest_state & SCTP_ADDR_BEING_DELETED) == 0)) { + alt = TAILQ_NEXT(net, sctp_next);; + } else { + alt = TAILQ_FIRST(&stcb->asoc.nets); } + looped = false; for (;;) { - alt = TAILQ_NEXT(mnet, sctp_next); if (alt == NULL) { - once++; - if (once > 1) { - break; + if (!looped) { + alt = TAILQ_FIRST(&stcb->asoc.nets); + looped = true; } - alt = TAILQ_FIRST(&stcb->asoc.nets); + /* Definitely out of candidates. */ if (alt == NULL) { - return (NULL); + break; } } if (alt->ro.ro_nh == NULL) { @@ -358,43 +355,59 @@ sctp_find_alternate_net(struct sctp_tcb *stcb, } if (((alt->dest_state & SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE) && (alt->ro.ro_nh != NULL) && - (!(alt->dest_state & SCTP_ADDR_UNCONFIRMED))) { - /* Found a reachable address */ + (!(alt->dest_state & SCTP_ADDR_UNCONFIRMED)) && + (alt != net)) { + /* Found an alternate net, which is reachable. */ break; } - mnet = alt; + alt = TAILQ_NEXT(alt, sctp_next); } if (alt == NULL) { - /* Case where NO insv network exists (dormant state) */ - /* we rotate destinations */ - once = 0; - mnet = net; + /* + * In case no active alternate net has been found, look for + * an alternate net, which is confirmed. + */ + if ((net != NULL) && ((net->dest_state & SCTP_ADDR_BEING_DELETED) == 0)) { + alt = TAILQ_NEXT(net, sctp_next);; + } else { + alt = TAILQ_FIRST(&stcb->asoc.nets); + } + looped = false; for (;;) { - if (mnet == NULL) { - return (TAILQ_FIRST(&stcb->asoc.nets)); - } - alt = TAILQ_NEXT(mnet, sctp_next); if (alt == NULL) { - once++; - if (once > 1) { - break; + if (!looped) { + alt = TAILQ_FIRST(&stcb->asoc.nets); + looped = true; } - alt = TAILQ_FIRST(&stcb->asoc.nets); + /* Definitely out of candidates. */ if (alt == NULL) { break; } } if ((!(alt->dest_state & SCTP_ADDR_UNCONFIRMED)) && (alt != net)) { - /* Found an alternate address */ + /* + * Found an alternate net, which is + * confirmed. + */ break; } - mnet = alt; + alt = TAILQ_NEXT(alt, sctp_next); } } if (alt == NULL) { - return (net); + /* + * In case no confirmed alternate net has been found, just + * return net, if it is not being deleted. In the other case + * just return the first net. + */ + if ((net != NULL) && ((net->dest_state & SCTP_ADDR_BEING_DELETED) == 0)) { + alt = net; + } + if (alt == NULL) { + alt = TAILQ_FIRST(&stcb->asoc.nets); + } } return (alt); } From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 12:56: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 09463568B4D; Tue, 2 Mar 2021 12:56: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 4DqcZv6pPPz3rS8; Tue, 2 Mar 2021 12:56: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 DC99716FD4; Tue, 2 Mar 2021 12:56: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 122CudtX052141; Tue, 2 Mar 2021 12:56:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122Cudnr052140; Tue, 2 Mar 2021 12:56:39 GMT (envelope-from git) Date: Tue, 2 Mar 2021 12:56:39 GMT Message-Id: <202103021256.122Cudnr052140@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: f7c20120c19b - stable/13 - sctp: avoid integer overflow when starting the HB timer MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f7c20120c19b6307536908a7f779be2832b133f3 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 Mar 2021 12:56:40 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=f7c20120c19b6307536908a7f779be2832b133f3 commit f7c20120c19b6307536908a7f779be2832b133f3 Author: Michael Tuexen AuthorDate: 2021-02-27 22:27:30 +0000 Commit: Michael Tuexen CommitDate: 2021-03-02 12:33:01 +0000 sctp: avoid integer overflow when starting the HB timer MFC after: 3 days Reported by: syzbot+14b9d7c3c64208fae62f@syzkaller.appspotmail.com (cherry picked from commit 70e95f0b6917a8b8cd4a2a5f883f3e9753fc86d8) --- sys/netinet/sctputil.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 319344842d5f..7ddb4c3710df 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -2277,14 +2277,19 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, struct sctp_tcb *stcb, } rndval = sctp_select_initial_TSN(&inp->sctp_ep); jitter = rndval % to_ticks; - if (jitter >= (to_ticks >> 1)) { - to_ticks = to_ticks + (jitter - (to_ticks >> 1)); + to_ticks >>= 1; + if (jitter < (UINT32_MAX - to_ticks)) { + to_ticks += jitter; } else { - to_ticks = to_ticks - jitter; + to_ticks = UINT32_MAX; } if (!(net->dest_state & SCTP_ADDR_UNCONFIRMED) && !(net->dest_state & SCTP_ADDR_PF)) { - to_ticks += net->heart_beat_delay; + if (net->heart_beat_delay < (UINT32_MAX - to_ticks)) { + to_ticks += net->heart_beat_delay; + } else { + to_ticks = UINT32_MAX; + } } /* * Now we must convert the to_ticks that are now in ms to From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 13:02: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 8C1B7568B74; Tue, 2 Mar 2021 13:02: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 4Dqcjk3bD6z3sJg; Tue, 2 Mar 2021 13:02: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 6E3F717580; Tue, 2 Mar 2021 13:02: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 122D2Yhi065853; Tue, 2 Mar 2021 13:02:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122D2YxQ065852; Tue, 2 Mar 2021 13:02:34 GMT (envelope-from git) Date: Tue, 2 Mar 2021 13:02:34 GMT Message-Id: <202103021302.122D2YxQ065852@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: 135fa1610fa1 - stable/13 - pwm_backlight: Add MODULE_DEPEND on backlight MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 135fa1610fa177bb8c77aab951cfb4395edc249f 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 Mar 2021 13:02:34 -0000 The branch stable/13 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=135fa1610fa177bb8c77aab951cfb4395edc249f commit 135fa1610fa177bb8c77aab951cfb4395edc249f Author: Brett Mastbergen AuthorDate: 2021-02-22 10:28:28 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-02 13:02:13 +0000 pwm_backlight: Add MODULE_DEPEND on backlight Make the pwm_backlight module depend on backlight, so it has access to the backlight interface symbols. Otherwise you'll get an error like: link_elf: symbol backlight_get_info_desc undefined Signed-off-by: Brett Mastbergen MFC after: 3 days PR: 253765 (cherry picked from commit 43d4dfac96f7f8285a27989f315c075d28aadb12) --- sys/dev/pwm/pwm_backlight.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/pwm/pwm_backlight.c b/sys/dev/pwm/pwm_backlight.c index 352a5a02fed5..3a6ec7f61fec 100644 --- a/sys/dev/pwm/pwm_backlight.c +++ b/sys/dev/pwm/pwm_backlight.c @@ -308,4 +308,5 @@ devclass_t pwm_backlight_devclass; DRIVER_MODULE(pwm_backlight, simplebus, pwm_backlight_driver, pwm_backlight_devclass, 0, 0); +MODULE_DEPEND(pwm_backlight, backlight, 1, 1, 1); OFWBUS_PNP_INFO(compat_data); From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 13:03: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 E6552569022; Tue, 2 Mar 2021 13:03: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 4DqckH348xz3sQn; Tue, 2 Mar 2021 13:03: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 6D7C2171CE; Tue, 2 Mar 2021 13:03: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 122D32rU066058; Tue, 2 Mar 2021 13:03:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122D326O066057; Tue, 2 Mar 2021 13:03:02 GMT (envelope-from git) Date: Tue, 2 Mar 2021 13:03:02 GMT Message-Id: <202103021303.122D326O066057@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: 9c5f4f8e4ee8 - stable/13 - mkimg: We always want the last block of the last inserted partition MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9c5f4f8e4ee8261a669ab99257bffd439bad6635 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 Mar 2021 13:03:04 -0000 The branch stable/13 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=9c5f4f8e4ee8261a669ab99257bffd439bad6635 commit 9c5f4f8e4ee8261a669ab99257bffd439bad6635 Author: Emmanuel Vadot AuthorDate: 2021-02-25 15:34:28 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-02 13:02:45 +0000 mkimg: We always want the last block of the last inserted partition Even with an absolute offset we want to know the last block the partition otherwise we endup with an image the size of the metadata. This allow to create image with the ESP placed at a specific position which is useful on arm/arm64 where u-boot have always a hard time to read the ESP if it's not aligned on 512k. mkimg -v -o sdcard -s gpt -p efi::54M:1M -p freebsd-ufs::1G now works. MFC after: 3 days (cherry picked from commit 3b6268bb9e4aea939c4ce7f37353174aa90e6751) --- usr.bin/mkimg/mkimg.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/usr.bin/mkimg/mkimg.c b/usr.bin/mkimg/mkimg.c index d870f3a8f0c3..c4f0acbe3927 100644 --- a/usr.bin/mkimg/mkimg.c +++ b/usr.bin/mkimg/mkimg.c @@ -528,10 +528,8 @@ mkimg(void) (long long)blkoffset); } } - if (!abs_offset) { - block = scheme_metadata(SCHEME_META_PART_AFTER, - part->block + part->size); - } + block = scheme_metadata(SCHEME_META_PART_AFTER, + part->block + part->size); } mkimg_validate(); From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 13:03: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 099FF568FB0; Tue, 2 Mar 2021 13:03: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 4DqckH6T6Pz3sHw; Tue, 2 Mar 2021 13:03: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 8A4FA17581; Tue, 2 Mar 2021 13:03: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 122D33vf066083; Tue, 2 Mar 2021 13:03:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122D33nb066082; Tue, 2 Mar 2021 13:03:03 GMT (envelope-from git) Date: Tue, 2 Mar 2021 13:03:03 GMT Message-Id: <202103021303.122D33nb066082@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: 6f6c6480047b - stable/13 - mkimg: Add support for offset if the source is an image MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6f6c6480047ba1ebbc398c1052446e35f8a4ecab 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 Mar 2021 13:03:04 -0000 The branch stable/13 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=6f6c6480047ba1ebbc398c1052446e35f8a4ecab commit 6f6c6480047ba1ebbc398c1052446e35f8a4ecab Author: Emmanuel Vadot AuthorDate: 2021-02-25 17:10:19 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-02 13:02:51 +0000 mkimg: Add support for offset if the source is an image This allow us to create image with the following format: mkimg -v -o sdcard -s gpt -p efi:=esp_aarch64.img:1M -p freebsd-ufs::1G Which will add a efi partition at a 1M offset on the image with its content coming from the esp_aarch64.img file. MFC after: 3 days (cherry picked from commit 8f3c71c85e5f6a4d2bddbfead225d33b96dbd7d7) --- usr.bin/mkimg/mkimg.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/usr.bin/mkimg/mkimg.c b/usr.bin/mkimg/mkimg.c index c4f0acbe3927..e5e6c036575b 100644 --- a/usr.bin/mkimg/mkimg.c +++ b/usr.bin/mkimg/mkimg.c @@ -174,8 +174,10 @@ usage(const char *why) fprintf(stderr, "\t[/]::[:[+]]\t- " "empty partition of given size and\n\t\t\t\t\t" " optional relative or absolute offset\n"); - fprintf(stderr, "\t[/]:=\t\t- partition content and size " - "are\n\t\t\t\t\t determined by the named file\n"); + fprintf(stderr, "\t[/]:=[:[+]offset]\t- partition " + "content and size are\n\t\t\t\t\t" + " determined by the named file and\n" + "\t\t\t\t\t optional relative or absolute offset\n"); fprintf(stderr, "\t[/]:-\t\t- partition content and size " "are taken\n\t\t\t\t\t from the output of the command to run\n"); fprintf(stderr, "\t-\t\t\t\t- unused partition entry\n"); @@ -459,9 +461,11 @@ mkimg(void) /* Look for an offset. Set size too if we can. */ switch (part->kind) { case PART_KIND_SIZE: + case PART_KIND_FILE: offset = part->contents; size = strsep(&offset, ":"); - if (expand_number(size, &bytesize) == -1) + if (part->kind == PART_KIND_SIZE && + expand_number(size, &bytesize) == -1) error = errno; if (offset != NULL) { if (*offset != '+') @@ -476,14 +480,13 @@ mkimg(void) /* Work out exactly where the partition starts. */ blkoffset = (byteoffset + secsz - 1) / secsz; - if (abs_offset) { - part->block = scheme_metadata(SCHEME_META_PART_ABSOLUTE, + if (abs_offset) + block = scheme_metadata(SCHEME_META_PART_ABSOLUTE, blkoffset); - } else { + else block = scheme_metadata(SCHEME_META_PART_BEFORE, block + blkoffset); - part->block = block; - } + part->block = block; if (verbose) fprintf(stderr, "partition %d: starting block %llu " From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 14:20:23 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 0A2C256AC83; Tue, 2 Mar 2021 14:20:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DqfRV6t6gz4RHr; Tue, 2 Mar 2021 14:20:22 +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 DEC92182B5; Tue, 2 Mar 2021 14:20:22 +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 122EKMkS067510; Tue, 2 Mar 2021 14:20:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122EKMd6067509; Tue, 2 Mar 2021 14:20:22 GMT (envelope-from git) Date: Tue, 2 Mar 2021 14:20:22 GMT Message-Id: <202103021420.122EKMd6067509@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: 90cf334642c2 - releng/13.0 - pwm_backlight: Add MODULE_DEPEND on backlight MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 90cf334642c234675a70721a8b06a7c92c014a8e 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 Mar 2021 14:20:23 -0000 The branch releng/13.0 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=90cf334642c234675a70721a8b06a7c92c014a8e commit 90cf334642c234675a70721a8b06a7c92c014a8e Author: Brett Mastbergen AuthorDate: 2021-02-22 10:28:28 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-02 14:19:51 +0000 pwm_backlight: Add MODULE_DEPEND on backlight Make the pwm_backlight module depend on backlight, so it has access to the backlight interface symbols. Otherwise you'll get an error like: link_elf: symbol backlight_get_info_desc undefined Approved by: re (gjb) Signed-off-by: Brett Mastbergen MFC after: 3 days PR: 253765 (cherry picked from commit 43d4dfac96f7f8285a27989f315c075d28aadb12) (cherry picked from commit 135fa1610fa177bb8c77aab951cfb4395edc249f) --- sys/dev/pwm/pwm_backlight.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/pwm/pwm_backlight.c b/sys/dev/pwm/pwm_backlight.c index 352a5a02fed5..3a6ec7f61fec 100644 --- a/sys/dev/pwm/pwm_backlight.c +++ b/sys/dev/pwm/pwm_backlight.c @@ -308,4 +308,5 @@ devclass_t pwm_backlight_devclass; DRIVER_MODULE(pwm_backlight, simplebus, pwm_backlight_driver, pwm_backlight_devclass, 0, 0); +MODULE_DEPEND(pwm_backlight, backlight, 1, 1, 1); OFWBUS_PNP_INFO(compat_data); From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 14:21:29 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 661ED56ABA7; Tue, 2 Mar 2021 14:21:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DqfSn2Gt9z4RH4; Tue, 2 Mar 2021 14:21:29 +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 4114B17EC7; Tue, 2 Mar 2021 14:21:29 +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 122ELTsF068642; Tue, 2 Mar 2021 14:21:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122ELTtd068641; Tue, 2 Mar 2021 14:21:29 GMT (envelope-from git) Date: Tue, 2 Mar 2021 14:21:29 GMT Message-Id: <202103021421.122ELTtd068641@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: f3054d18bfbd - releng/13.0 - mkimg: We always want the last block of the last inserted partition MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: f3054d18bfbd4629cb695922f3cd1fab36b1dc5b 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 Mar 2021 14:21:29 -0000 The branch releng/13.0 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=f3054d18bfbd4629cb695922f3cd1fab36b1dc5b commit f3054d18bfbd4629cb695922f3cd1fab36b1dc5b Author: Emmanuel Vadot AuthorDate: 2021-02-25 15:34:28 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-02 14:20:53 +0000 mkimg: We always want the last block of the last inserted partition Even with an absolute offset we want to know the last block the partition otherwise we endup with an image the size of the metadata. This allow to create image with the ESP placed at a specific position which is useful on arm/arm64 where u-boot have always a hard time to read the ESP if it's not aligned on 512k. mkimg -v -o sdcard -s gpt -p efi::54M:1M -p freebsd-ufs::1G now works. MFC after: 3 days Approved by: re (gjb) (cherry picked from commit 3b6268bb9e4aea939c4ce7f37353174aa90e6751) (cherry picked from commit 9c5f4f8e4ee8261a669ab99257bffd439bad6635) --- usr.bin/mkimg/mkimg.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/usr.bin/mkimg/mkimg.c b/usr.bin/mkimg/mkimg.c index d870f3a8f0c3..c4f0acbe3927 100644 --- a/usr.bin/mkimg/mkimg.c +++ b/usr.bin/mkimg/mkimg.c @@ -528,10 +528,8 @@ mkimg(void) (long long)blkoffset); } } - if (!abs_offset) { - block = scheme_metadata(SCHEME_META_PART_AFTER, - part->block + part->size); - } + block = scheme_metadata(SCHEME_META_PART_AFTER, + part->block + part->size); } mkimg_validate(); From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 14:21: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 848C256AC32; Tue, 2 Mar 2021 14:21:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DqfSp32Hwz4R7g; Tue, 2 Mar 2021 14:21:30 +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 593B117EC9; Tue, 2 Mar 2021 14:21: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 122ELUwZ068664; Tue, 2 Mar 2021 14:21:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122ELUFk068663; Tue, 2 Mar 2021 14:21:30 GMT (envelope-from git) Date: Tue, 2 Mar 2021 14:21:30 GMT Message-Id: <202103021421.122ELUFk068663@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: 856af5ff745f - releng/13.0 - mkimg: Add support for offset if the source is an image MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 856af5ff745f2687015a5564f8daf0cf6cde368d 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 Mar 2021 14:21:30 -0000 The branch releng/13.0 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=856af5ff745f2687015a5564f8daf0cf6cde368d commit 856af5ff745f2687015a5564f8daf0cf6cde368d Author: Emmanuel Vadot AuthorDate: 2021-02-25 17:10:19 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-02 14:21:08 +0000 mkimg: Add support for offset if the source is an image This allow us to create image with the following format: mkimg -v -o sdcard -s gpt -p efi:=esp_aarch64.img:1M -p freebsd-ufs::1G Which will add a efi partition at a 1M offset on the image with its content coming from the esp_aarch64.img file. MFC after: 3 days Approved by: re (gjb) (cherry picked from commit 8f3c71c85e5f6a4d2bddbfead225d33b96dbd7d7) (cherry picked from commit 6f6c6480047ba1ebbc398c1052446e35f8a4ecab) --- usr.bin/mkimg/mkimg.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/usr.bin/mkimg/mkimg.c b/usr.bin/mkimg/mkimg.c index c4f0acbe3927..e5e6c036575b 100644 --- a/usr.bin/mkimg/mkimg.c +++ b/usr.bin/mkimg/mkimg.c @@ -174,8 +174,10 @@ usage(const char *why) fprintf(stderr, "\t[/]::[:[+]]\t- " "empty partition of given size and\n\t\t\t\t\t" " optional relative or absolute offset\n"); - fprintf(stderr, "\t[/]:=\t\t- partition content and size " - "are\n\t\t\t\t\t determined by the named file\n"); + fprintf(stderr, "\t[/]:=[:[+]offset]\t- partition " + "content and size are\n\t\t\t\t\t" + " determined by the named file and\n" + "\t\t\t\t\t optional relative or absolute offset\n"); fprintf(stderr, "\t[/]:-\t\t- partition content and size " "are taken\n\t\t\t\t\t from the output of the command to run\n"); fprintf(stderr, "\t-\t\t\t\t- unused partition entry\n"); @@ -459,9 +461,11 @@ mkimg(void) /* Look for an offset. Set size too if we can. */ switch (part->kind) { case PART_KIND_SIZE: + case PART_KIND_FILE: offset = part->contents; size = strsep(&offset, ":"); - if (expand_number(size, &bytesize) == -1) + if (part->kind == PART_KIND_SIZE && + expand_number(size, &bytesize) == -1) error = errno; if (offset != NULL) { if (*offset != '+') @@ -476,14 +480,13 @@ mkimg(void) /* Work out exactly where the partition starts. */ blkoffset = (byteoffset + secsz - 1) / secsz; - if (abs_offset) { - part->block = scheme_metadata(SCHEME_META_PART_ABSOLUTE, + if (abs_offset) + block = scheme_metadata(SCHEME_META_PART_ABSOLUTE, blkoffset); - } else { + else block = scheme_metadata(SCHEME_META_PART_BEFORE, block + blkoffset); - part->block = block; - } + part->block = block; if (verbose) fprintf(stderr, "partition %d: starting block %llu " From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 14:26: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 7E37D56AE1F; Tue, 2 Mar 2021 14:26: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 4DqfZd38clz4RpB; Tue, 2 Mar 2021 14:26: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 5A67E18595; Tue, 2 Mar 2021 14:26: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 122EQXp4072619; Tue, 2 Mar 2021 14:26:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122EQXjq072618; Tue, 2 Mar 2021 14:26:33 GMT (envelope-from git) Date: Tue, 2 Mar 2021 14:26:33 GMT Message-Id: <202103021426.122EQXjq072618@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: 9019e7b388c6 - stable/13 - nvi: fix catalog generation 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: 9019e7b388c6a999262d24aa355c11fb53d2e528 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 Mar 2021 14:26:33 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=9019e7b388c6a999262d24aa355c11fb53d2e528 commit 9019e7b388c6a999262d24aa355c11fb53d2e528 Author: dankm AuthorDate: 2021-02-26 15:32:01 +0000 Commit: Baptiste Daroussin CommitDate: 2021-03-02 14:26:08 +0000 nvi: fix catalog generation Upstream broke catalog generation with some over-eagre style cleanups. This brings in my pull request. Obtained from: https://github.com/lichray/nvi2/pull/88 Differential Revision: https://reviews.freebsd.org/D28594 (cherry picked from commit 888ae5725257c251319f14f31c2e941717b675f2) --- contrib/nvi/catalog/dump.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/nvi/catalog/dump.c b/contrib/nvi/catalog/dump.c index 8390e5022841..74ab53b2f12c 100644 --- a/contrib/nvi/catalog/dump.c +++ b/contrib/nvi/catalog/dump.c @@ -36,24 +36,24 @@ parse(FILE *fp) { int ch, s1, s2, s3; -#define TESTD(s) do { \ +#define TESTD(s) { \ if ((s = getc(fp)) == EOF) \ return; \ if (!isdigit(s)) \ continue; \ -} while (0) -#define TESTP do { \ +} +#define TESTP { \ if ((ch = getc(fp)) == EOF) \ return; \ if (ch != '|') \ continue; \ -} while (0) -#define MOVEC(t) do { \ +} +#define MOVEC(t) { \ do { \ if ((ch = getc(fp)) == EOF) \ return; \ } while (ch != (t)); \ -} while (0) +} for (;;) { MOVEC('"'); TESTD(s1); From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 14:57: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 F2A0156BCE6; Tue, 2 Mar 2021 14:57: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 4DqgFm6XYYz4Tqm; Tue, 2 Mar 2021 14:57: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 CEE9F186F5; Tue, 2 Mar 2021 14:57: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 122Ev0VA012026; Tue, 2 Mar 2021 14:57:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122Ev07c012025; Tue, 2 Mar 2021 14:57:00 GMT (envelope-from git) Date: Tue, 2 Mar 2021 14:57:00 GMT Message-Id: <202103021457.122Ev07c012025@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 59b8f72a21b3 - releng/13.0 - libsysdecode: fix decoding of TCP_NOPUSH and TCP_MD5SIG MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 59b8f72a21b3e81465dc4ecd96f64dbaa44a4a9f 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 Mar 2021 14:57:01 -0000 The branch releng/13.0 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=59b8f72a21b3e81465dc4ecd96f64dbaa44a4a9f commit 59b8f72a21b3e81465dc4ecd96f64dbaa44a4a9f Author: Michael Tuexen AuthorDate: 2021-02-09 22:35:55 +0000 Commit: Michael Tuexen CommitDate: 2021-03-02 14:55:22 +0000 libsysdecode: fix decoding of TCP_NOPUSH and TCP_MD5SIG TCP_FASTOPEN_MIN_COOKIE_LEN was incorrectly registered as a name of a IPPROTO_TCP level socket option, which overwrote TCP_NOPUSH. TCP_FASTOPEN_PSK_LEN was incorrectly registered as a name of an IPPROTO_TCP level socket option, which overwrote TCP_MD5SIG. Approved by: re (gjb) Sponsored by: Netflix, Inc. (cherry picked from commit f25266bee7dafb10f03e06537c8127cc17335bed) (cherry picked from commit 2a9b68d5e1bba633c37cc829f52e79e1281e910b) --- lib/libsysdecode/mktables | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libsysdecode/mktables b/lib/libsysdecode/mktables index 3a0284a2deb4..3d152a3a2646 100644 --- a/lib/libsysdecode/mktables +++ b/lib/libsysdecode/mktables @@ -140,7 +140,7 @@ gen_table "sockopt" "SO_[A-Z]+[[:space:]]+0x[0-9]+" "sys/ gen_table "sockoptip" "(IP_[[:alnum:]_]+|MCAST_[[:alnum:]_]+_GROUP)[[:space:]]+" "netinet/in.h" "IP_DEFAULT|IP_MIN|IP_MAX|IP_PORTRANGE" gen_table "sockoptipv6" "IPV6_[[:alnum:]_]+[[:space:]]+[0-9]+" "netinet6/in6.h" "IPV6_ADDR_|IPV6_TAG_DIRECT|IPV6_OPTIONS|IPV6_RECVOPTS|IPV6_RECVRETOPTS|IPV6_RECVDSTADDR|IPV6_RETOPTS|IPV6_2292|IPV6_RECVRTHDRDSTOPTS|IPV6_REACHCONF|IPV6_PKTOPTIONS" gen_table "sockoptsctp" "SCTP_[[:alnum:]_]+[[:space:]]+[0-9]+" "netinet/sctp.h" -gen_table "sockopttcp" "TCP_[[:alnum:]_]+[[:space:]]+[0-9]+" "netinet/tcp.h" "TCP_MIN|TCP_MAX[^S]|TCP_MSS|TCP_[[:alnum:]_]+_MAX" +gen_table "sockopttcp" "TCP_[[:alnum:]_]+[[:space:]]+[0-9]+" "netinet/tcp.h" "TCP_MIN|TCP_MAX[^S]|TCP_MSS|TCP_[[:alnum:]_]+_MAX|TCP_FASTOPEN_MIN_COOKIE_LEN|TCP_FASTOPEN_PSK_LEN" gen_table "sockoptudp" "UDP_[[:alnum:]]+[[:space:]]+[0-9]+" "netinet/udp.h" "UDP_ENCAP_" gen_table "sockoptudplite" "UDPLITE_[[:alnum:]_]+[[:space:]]+[0-9]+" "netinet/udplite.h" gen_table "socktype" "SOCK_[A-Z]+[[:space:]]+[1-9]+[0-9]*" "sys/socket.h" From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 15:17: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 6B8BF56C450; Tue, 2 Mar 2021 15:17: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 4Dqgjl2cmqz4Wsh; Tue, 2 Mar 2021 15:17: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 4D0AB18EAF; Tue, 2 Mar 2021 15:17: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 122FHlhE039423; Tue, 2 Mar 2021 15:17:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FHlUF039422; Tue, 2 Mar 2021 15:17:47 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:17:47 GMT Message-Id: <202103021517.122FHlUF039422@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: 02a34c9198d2 - stable/12 - bridge: Support STP on VLAN devices 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: 02a34c9198d2d9c73150e4cae4910fe4af21a39c 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 Mar 2021 15:17:47 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=02a34c9198d2d9c73150e4cae4910fe4af21a39c commit 02a34c9198d2d9c73150e4cae4910fe4af21a39c Author: Kristof Provost AuthorDate: 2021-02-20 09:11:30 +0000 Commit: Kristof Provost CommitDate: 2021-03-02 08:30:37 +0000 bridge: Support STP on VLAN devices VLAN devices have type IFT_L2VLAN, so the STP code mistakenly believed they couldn't be used for STP. That's not the case, so add the ITF_L2VLAN to the check. Reviewed by: donner@ MFC after: 1 week Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D28857 (cherry picked from commit 711ed156b94562c3dcb2ee9c1b3f240f960a75d2) --- sys/net/bridgestp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/net/bridgestp.c b/sys/net/bridgestp.c index d613051eb565..ed83a2d646f5 100644 --- a/sys/net/bridgestp.c +++ b/sys/net/bridgestp.c @@ -2232,6 +2232,7 @@ bstp_enable(struct bstp_port *bp) switch (ifp->if_type) { case IFT_ETHER: /* These can do spanning tree. */ + case IFT_L2VLAN: break; default: /* Nothing else can. */ From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 15:17: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 8A16156C717; Tue, 2 Mar 2021 15:17: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 4Dqgjm3XRnz4WcS; Tue, 2 Mar 2021 15:17: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 61F2818EB0; Tue, 2 Mar 2021 15:17: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 122FHm9t039448; Tue, 2 Mar 2021 15:17:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FHm3D039447; Tue, 2 Mar 2021 15:17:48 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:17:48 GMT Message-Id: <202103021517.122FHm3D039447@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: 6a0355a0fe75 - stable/12 - bridge: Remove members when assigned to a new vnet 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: 6a0355a0fe751368c66ea2e7debee86badb50d2a 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 Mar 2021 15:17:48 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6a0355a0fe751368c66ea2e7debee86badb50d2a commit 6a0355a0fe751368c66ea2e7debee86badb50d2a Author: Kristof Provost AuthorDate: 2021-02-21 20:20:32 +0000 Commit: Kristof Provost CommitDate: 2021-03-02 08:31:02 +0000 bridge: Remove members when assigned to a new vnet When the bridge is moved to a different vnet we must remove all of its member interfaces (and span interfaces), because we don't know if those will be moved along with it. We don't want to hold references to interfaces not in our vnet. Reviewed by: donner@ MFC after: 1 week Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D28859 (cherry picked from commit 38c0951386d82f4c51cf4e245253cdef18d2254a) --- sys/net/ethernet.h | 4 ++++ sys/net/if_bridge.c | 25 +++++++++++++++++++++++++ sys/net/if_ethersubr.c | 3 --- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/sys/net/ethernet.h b/sys/net/ethernet.h index fdfc41b55037..1f718e6e69d2 100644 --- a/sys/net/ethernet.h +++ b/sys/net/ethernet.h @@ -429,6 +429,10 @@ extern uint32_t ether_crc32_be(const uint8_t *, size_t); extern void ether_demux(struct ifnet *, struct mbuf *); extern void ether_ifattach(struct ifnet *, const u_int8_t *); extern void ether_ifdetach(struct ifnet *); +#ifdef VIMAGE +struct vnet; +extern void ether_reassign(struct ifnet *, struct vnet *, char *); +#endif extern int ether_ioctl(struct ifnet *, u_long, caddr_t); extern int ether_output(struct ifnet *, struct mbuf *, const struct sockaddr *, struct route *); diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 6ff9cd95e090..4e5c9ada12d1 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -674,6 +674,28 @@ SYSCTL_PROC(_net_link_bridge, OID_AUTO, ipfw, &VNET_NAME(pfil_ipfw), 0, &sysctl_pfil_ipfw, "I", "Layer2 filter with IPFW"); +#ifdef VIMAGE +static void +bridge_reassign(struct ifnet *ifp, struct vnet *newvnet, char *arg) +{ + struct bridge_softc *sc = ifp->if_softc; + struct bridge_iflist *bif; + + BRIDGE_LOCK(sc); + + while ((bif = CK_LIST_FIRST(&sc->sc_iflist)) != NULL) + bridge_delete_member(sc, bif, 0); + + while ((bif = CK_LIST_FIRST(&sc->sc_spanlist)) != NULL) { + bridge_delete_span(sc, bif); + } + + BRIDGE_UNLOCK(sc); + + ether_reassign(ifp, newvnet, arg); +} +#endif + /* * bridge_clone_create: * @@ -756,6 +778,9 @@ bridge_clone_create(struct if_clone *ifc, int unit, caddr_t params) /* Now undo some of the damage... */ ifp->if_baudrate = 0; ifp->if_type = IFT_BRIDGE; +#ifdef VIMAGE + ifp->if_reassign = bridge_reassign; +#endif BRIDGE_LIST_LOCK(); LIST_INSERT_HEAD(&V_bridge_list, sc, sc_list); diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 532d6a7a342b..5e255f862221 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -117,9 +117,6 @@ static const u_char etherbroadcastaddr[ETHER_ADDR_LEN] = static int ether_resolvemulti(struct ifnet *, struct sockaddr **, struct sockaddr *); -#ifdef VIMAGE -static void ether_reassign(struct ifnet *, struct vnet *, char *); -#endif static int ether_requestencap(struct ifnet *, struct if_encap_req *); From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 15:17: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 E495156C7A1; Tue, 2 Mar 2021 15:17: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 4Dqgjm66XGz4WcT; Tue, 2 Mar 2021 15:17: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 C4D28188F8; Tue, 2 Mar 2021 15:17: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 122FHm45039531; Tue, 2 Mar 2021 15:17:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FHmZF039530; Tue, 2 Mar 2021 15:17:48 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:17:48 GMT Message-Id: <202103021517.122FHmZF039530@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: c3438a8438fe - stable/13 - bridge: Support STP on VLAN devices 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: c3438a8438fe44be4d63f1f9091f844cafdcb482 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 Mar 2021 15:17:49 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c3438a8438fe44be4d63f1f9091f844cafdcb482 commit c3438a8438fe44be4d63f1f9091f844cafdcb482 Author: Kristof Provost AuthorDate: 2021-02-20 09:11:30 +0000 Commit: Kristof Provost CommitDate: 2021-03-02 14:50:21 +0000 bridge: Support STP on VLAN devices VLAN devices have type IFT_L2VLAN, so the STP code mistakenly believed they couldn't be used for STP. That's not the case, so add the ITF_L2VLAN to the check. Reviewed by: donner@ MFC after: 1 week Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D28857 (cherry picked from commit 711ed156b94562c3dcb2ee9c1b3f240f960a75d2) --- sys/net/bridgestp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/net/bridgestp.c b/sys/net/bridgestp.c index a8bb51c11f51..c36dc61d1397 100644 --- a/sys/net/bridgestp.c +++ b/sys/net/bridgestp.c @@ -2232,6 +2232,7 @@ bstp_enable(struct bstp_port *bp) switch (ifp->if_type) { case IFT_ETHER: /* These can do spanning tree. */ + case IFT_L2VLAN: break; default: /* Nothing else can. */ From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 15:17: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 9645D56C456; Tue, 2 Mar 2021 15:17: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 4Dqgjr3x93z4WwJ; Tue, 2 Mar 2021 15:17: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 1DCA018F10; Tue, 2 Mar 2021 15:17: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 122FHo7f039608; Tue, 2 Mar 2021 15:17:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FHoSR039607; Tue, 2 Mar 2021 15:17:50 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:17:50 GMT Message-Id: <202103021517.122FHoSR039607@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: 05ac80ac0f3a - stable/13 - arp/nd: Cope with late calls to iflladdr_event 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: 05ac80ac0f3a41092a07e947fea1ed2e5f047d15 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 Mar 2021 15:17:55 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=05ac80ac0f3a41092a07e947fea1ed2e5f047d15 commit 05ac80ac0f3a41092a07e947fea1ed2e5f047d15 Author: Kristof Provost AuthorDate: 2021-02-22 07:19:43 +0000 Commit: Kristof Provost CommitDate: 2021-03-02 14:50:21 +0000 arp/nd: Cope with late calls to iflladdr_event When tearing down vnet jails we can move an if_bridge out (as part of the normal vnet_if_return()). This can, when it's clearing out its list of member interfaces, change its link layer address. That sends an iflladdr_event, but at that point we've already freed the AF_INET/AF_INET6 if_afdata pointers. In other words: when the iflladdr_event callbacks fire we can't assume that ifp->if_afdata[AF_INET] will be set. Reviewed by: donner@, melifaro@ MFC after: 1 week Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D28860 (cherry picked from commit c139b3c19b52abe3b5ba23a8175e58e70c7a528d) --- sys/netinet/if_ether.c | 4 ++++ sys/netinet6/nd6.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index e09ad3d47382..ef50ec9ca964 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1479,6 +1479,10 @@ arp_handle_ifllchange(struct ifnet *ifp) static void arp_iflladdr(void *arg __unused, struct ifnet *ifp) { + /* if_bridge can update its lladdr during if_vmove(), after we've done + * if_detach_internal()/dom_ifdetach(). */ + if (ifp->if_afdata[AF_INET] == NULL) + return; lltable_update_ifaddr(LLTABLE(ifp)); diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 497c0bfc10e8..62f0ac733a23 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -208,6 +208,8 @@ nd6_lle_event(void *arg __unused, struct llentry *lle, int evt) static void nd6_iflladdr(void *arg __unused, struct ifnet *ifp) { + if (ifp->if_afdata[AF_INET6] == NULL) + return; lltable_update_ifaddr(LLTABLE6(ifp)); } From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 15:17:55 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 9FC1656C37E; Tue, 2 Mar 2021 15:17: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 4Dqgjr3fcmz4Wt2; Tue, 2 Mar 2021 15:17: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 DA4D319077; Tue, 2 Mar 2021 15:17: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 122FHojV039590; Tue, 2 Mar 2021 15:17:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FHoRs039589; Tue, 2 Mar 2021 15:17:50 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:17:50 GMT Message-Id: <202103021517.122FHoRs039589@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: 2d1773f32319 - stable/12 - bridge/stp: Ensure we enter NET_EPOCH whenever we can send traffic 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: 2d1773f323195f2ff4910b1ce0f66207dcae79f3 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 Mar 2021 15:17:56 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2d1773f323195f2ff4910b1ce0f66207dcae79f3 commit 2d1773f323195f2ff4910b1ce0f66207dcae79f3 Author: Kristof Provost AuthorDate: 2021-02-21 20:18:46 +0000 Commit: Kristof Provost CommitDate: 2021-03-02 13:03:06 +0000 bridge/stp: Ensure we enter NET_EPOCH whenever we can send traffic Reviewed by: donner@ MFC after: 1 week Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D28858 (cherry picked from commit 89fa9c34d76bbf85cd7cda60c1868f5e3dba4ec7) --- sys/net/bridgestp.c | 2 ++ sys/net/if_bridge.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/net/bridgestp.c b/sys/net/bridgestp.c index ed83a2d646f5..d0259c37bf84 100644 --- a/sys/net/bridgestp.c +++ b/sys/net/bridgestp.c @@ -1871,6 +1871,7 @@ bstp_tick(void *arg) if (bs->bs_running == 0) return; + NET_EPOCH_ENTER(); CURVNET_SET(bs->bs_vnet); /* poll link events on interfaces that do not support linkstate */ @@ -1909,6 +1910,7 @@ bstp_tick(void *arg) } CURVNET_RESTORE(); + NET_EPOCH_EXIT(); callout_reset(&bs->bs_bstpcallout, hz, bstp_tick, bs); } diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 4e5c9ada12d1..8b25c28eb554 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1408,11 +1408,15 @@ bridge_ioctl_sifflags(struct bridge_softc *sc, void *arg) /* SPAN is readonly */ return (EINVAL); + NET_EPOCH_ENTER(); + if (req->ifbr_ifsflags & IFBIF_STP) { if ((bif->bif_flags & IFBIF_STP) == 0) { error = bstp_enable(&bif->bif_stp); - if (error) + if (error) { + NET_EPOCH_EXIT(); return (error); + } } } else { if ((bif->bif_flags & IFBIF_STP) != 0) @@ -1428,6 +1432,8 @@ bridge_ioctl_sifflags(struct bridge_softc *sc, void *arg) /* Save the bits relating to the bridge */ bif->bif_flags = req->ifbr_ifsflags & IFBIFMASK; + NET_EPOCH_EXIT(); + return (0); } From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 15:17: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 724D556C454; Tue, 2 Mar 2021 15:17: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 4Dqgjq0H7wz4WqL; Tue, 2 Mar 2021 15:17: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 0C68418EB1; Tue, 2 Mar 2021 15:17: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 122FHncR039572; Tue, 2 Mar 2021 15:17:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FHntC039571; Tue, 2 Mar 2021 15:17:49 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:17:49 GMT Message-Id: <202103021517.122FHntC039571@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: a20033be9ed8 - stable/13 - bridge: Remove members when assigned to a new vnet 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: a20033be9ed86295d3baac176d99b59c2f6ec7e5 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 Mar 2021 15:17:54 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a20033be9ed86295d3baac176d99b59c2f6ec7e5 commit a20033be9ed86295d3baac176d99b59c2f6ec7e5 Author: Kristof Provost AuthorDate: 2021-02-21 20:20:32 +0000 Commit: Kristof Provost CommitDate: 2021-03-02 14:50:21 +0000 bridge: Remove members when assigned to a new vnet When the bridge is moved to a different vnet we must remove all of its member interfaces (and span interfaces), because we don't know if those will be moved along with it. We don't want to hold references to interfaces not in our vnet. Reviewed by: donner@ MFC after: 1 week Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D28859 (cherry picked from commit 38c0951386d82f4c51cf4e245253cdef18d2254a) --- sys/net/ethernet.h | 4 ++++ sys/net/if_bridge.c | 25 +++++++++++++++++++++++++ sys/net/if_ethersubr.c | 3 --- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/sys/net/ethernet.h b/sys/net/ethernet.h index 38c0aa249272..f174ca9eb143 100644 --- a/sys/net/ethernet.h +++ b/sys/net/ethernet.h @@ -437,6 +437,10 @@ extern uint32_t ether_crc32_be(const uint8_t *, size_t); extern void ether_demux(struct ifnet *, struct mbuf *); extern void ether_ifattach(struct ifnet *, const u_int8_t *); extern void ether_ifdetach(struct ifnet *); +#ifdef VIMAGE +struct vnet; +extern void ether_reassign(struct ifnet *, struct vnet *, char *); +#endif extern int ether_ioctl(struct ifnet *, u_long, caddr_t); extern int ether_output(struct ifnet *, struct mbuf *, const struct sockaddr *, struct route *); diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 7c4e48ff04c6..24338267229b 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -670,6 +670,28 @@ SYSCTL_PROC(_net_link_bridge, OID_AUTO, ipfw, &VNET_NAME(pfil_ipfw), 0, &sysctl_pfil_ipfw, "I", "Layer2 filter with IPFW"); +#ifdef VIMAGE +static void +bridge_reassign(struct ifnet *ifp, struct vnet *newvnet, char *arg) +{ + struct bridge_softc *sc = ifp->if_softc; + struct bridge_iflist *bif; + + BRIDGE_LOCK(sc); + + while ((bif = CK_LIST_FIRST(&sc->sc_iflist)) != NULL) + bridge_delete_member(sc, bif, 0); + + while ((bif = CK_LIST_FIRST(&sc->sc_spanlist)) != NULL) { + bridge_delete_span(sc, bif); + } + + BRIDGE_UNLOCK(sc); + + ether_reassign(ifp, newvnet, arg); +} +#endif + /* * bridge_clone_create: * @@ -716,6 +738,9 @@ bridge_clone_create(struct if_clone *ifc, int unit, caddr_t params) /* Now undo some of the damage... */ ifp->if_baudrate = 0; ifp->if_type = IFT_BRIDGE; +#ifdef VIMAGE + ifp->if_reassign = bridge_reassign; +#endif BRIDGE_LIST_LOCK(); LIST_INSERT_HEAD(&V_bridge_list, sc, sc_list); diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 77c138d7a092..01c2d2f7b3e8 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -117,9 +117,6 @@ static const u_char etherbroadcastaddr[ETHER_ADDR_LEN] = static int ether_resolvemulti(struct ifnet *, struct sockaddr **, struct sockaddr *); -#ifdef VIMAGE -static void ether_reassign(struct ifnet *, struct vnet *, char *); -#endif static int ether_requestencap(struct ifnet *, struct if_encap_req *); #define senderr(e) do { error = (e); goto bad;} while (0) From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 15:17: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 6135756C7A5; Tue, 2 Mar 2021 15:17: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 4Dqgjn6CH3z4Wh7; Tue, 2 Mar 2021 15:17: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 93AB618C46; Tue, 2 Mar 2021 15:17: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 122FHnXX039552; Tue, 2 Mar 2021 15:17:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FHn9S039550; Tue, 2 Mar 2021 15:17:49 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:17:49 GMT Message-Id: <202103021517.122FHn9S039550@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: a285c84d517f - stable/12 - arp/nd: Cope with late calls to iflladdr_event 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: a285c84d517f4b987dfbbcec876d1fd812065a27 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 Mar 2021 15:17:55 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a285c84d517f4b987dfbbcec876d1fd812065a27 commit a285c84d517f4b987dfbbcec876d1fd812065a27 Author: Kristof Provost AuthorDate: 2021-02-22 07:19:43 +0000 Commit: Kristof Provost CommitDate: 2021-03-02 08:31:13 +0000 arp/nd: Cope with late calls to iflladdr_event When tearing down vnet jails we can move an if_bridge out (as part of the normal vnet_if_return()). This can, when it's clearing out its list of member interfaces, change its link layer address. That sends an iflladdr_event, but at that point we've already freed the AF_INET/AF_INET6 if_afdata pointers. In other words: when the iflladdr_event callbacks fire we can't assume that ifp->if_afdata[AF_INET] will be set. Reviewed by: donner@, melifaro@ MFC after: 1 week Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D28860 (cherry picked from commit c139b3c19b52abe3b5ba23a8175e58e70c7a528d) --- sys/netinet/if_ether.c | 4 ++++ sys/netinet6/nd6.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index a05001999ca4..538f6abb9855 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1461,6 +1461,10 @@ arp_handle_ifllchange(struct ifnet *ifp) static void arp_iflladdr(void *arg __unused, struct ifnet *ifp) { + /* if_bridge can update its lladdr during if_vmove(), after we've done + * if_detach_internal()/dom_ifdetach(). */ + if (ifp->if_afdata[AF_INET] == NULL) + return; lltable_update_ifaddr(LLTABLE(ifp)); diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 50fcc3226f97..d1d4b7c7fa88 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -206,6 +206,8 @@ nd6_lle_event(void *arg __unused, struct llentry *lle, int evt) static void nd6_iflladdr(void *arg __unused, struct ifnet *ifp) { + if (ifp->if_afdata[AF_INET6] == NULL) + return; lltable_update_ifaddr(LLTABLE6(ifp)); } From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 15:17:55 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 2762856C7A6; Tue, 2 Mar 2021 15:17: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 4Dqgjs3D5Dz4Wt8; Tue, 2 Mar 2021 15:17: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 3942518FC6; Tue, 2 Mar 2021 15:17: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 122FHqLR039648; Tue, 2 Mar 2021 15:17:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FHqaD039647; Tue, 2 Mar 2021 15:17:52 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:17:52 GMT Message-Id: <202103021517.122FHqaD039647@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: eaba3fe1483f - stable/13 - bridge/stp: Ensure we enter NET_EPOCH whenever we can send traffic 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: eaba3fe1483fe82baccb6d3930347bbd548c6fcd 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 Mar 2021 15:17:56 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=eaba3fe1483fe82baccb6d3930347bbd548c6fcd commit eaba3fe1483fe82baccb6d3930347bbd548c6fcd Author: Kristof Provost AuthorDate: 2021-02-21 20:18:46 +0000 Commit: Kristof Provost CommitDate: 2021-03-02 14:50:21 +0000 bridge/stp: Ensure we enter NET_EPOCH whenever we can send traffic Reviewed by: donner@ MFC after: 1 week Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D28858 (cherry picked from commit 89fa9c34d76bbf85cd7cda60c1868f5e3dba4ec7) --- sys/net/bridgestp.c | 9 +++++++++ sys/net/if_bridge.c | 9 ++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/sys/net/bridgestp.c b/sys/net/bridgestp.c index c36dc61d1397..82524440c241 100644 --- a/sys/net/bridgestp.c +++ b/sys/net/bridgestp.c @@ -154,6 +154,8 @@ static void bstp_reinit(struct bstp_state *); static void bstp_transmit(struct bstp_state *bs, struct bstp_port *bp) { + NET_EPOCH_ASSERT(); + if (bs->bs_running == 0) return; @@ -346,6 +348,7 @@ bstp_send_bpdu(struct bstp_state *bs, struct bstp_port *bp, struct ether_header *eh; BSTP_LOCK_ASSERT(bs); + NET_EPOCH_ASSERT(); ifp = bp->bp_ifp; @@ -923,6 +926,8 @@ bstp_update_state(struct bstp_state *bs, struct bstp_port *bp) static void bstp_update_roles(struct bstp_state *bs, struct bstp_port *bp) { + NET_EPOCH_ASSERT(); + switch (bp->bp_role) { case BSTP_ROLE_DISABLED: /* Clear any flags if set */ @@ -1862,6 +1867,7 @@ bstp_disable_port(struct bstp_state *bs, struct bstp_port *bp) static void bstp_tick(void *arg) { + struct epoch_tracker et; struct bstp_state *bs = arg; struct bstp_port *bp; @@ -1870,6 +1876,7 @@ bstp_tick(void *arg) if (bs->bs_running == 0) return; + NET_EPOCH_ENTER(et); CURVNET_SET(bs->bs_vnet); /* poll link events on interfaces that do not support linkstate */ @@ -1908,6 +1915,7 @@ bstp_tick(void *arg) } CURVNET_RESTORE(); + NET_EPOCH_EXIT(et); callout_reset(&bs->bs_bstpcallout, hz, bstp_tick, bs); } @@ -2229,6 +2237,7 @@ bstp_enable(struct bstp_port *bp) struct ifnet *ifp = bp->bp_ifp; KASSERT(bp->bp_active == 0, ("already a bstp member")); + NET_EPOCH_ASSERT(); /* Because bstp_update_roles() causes traffic. */ switch (ifp->if_type) { case IFT_ETHER: /* These can do spanning tree. */ diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 24338267229b..3e6b5ba8e0c2 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1351,6 +1351,7 @@ bridge_ioctl_gifflags(struct bridge_softc *sc, void *arg) static int bridge_ioctl_sifflags(struct bridge_softc *sc, void *arg) { + struct epoch_tracker et; struct ifbreq *req = arg; struct bridge_iflist *bif; struct bstp_port *bp; @@ -1365,11 +1366,15 @@ bridge_ioctl_sifflags(struct bridge_softc *sc, void *arg) /* SPAN is readonly */ return (EINVAL); + NET_EPOCH_ENTER(et); + if (req->ifbr_ifsflags & IFBIF_STP) { if ((bif->bif_flags & IFBIF_STP) == 0) { error = bstp_enable(&bif->bif_stp); - if (error) + if (error) { + NET_EPOCH_EXIT(et); return (error); + } } } else { if ((bif->bif_flags & IFBIF_STP) != 0) @@ -1385,6 +1390,8 @@ bridge_ioctl_sifflags(struct bridge_softc *sc, void *arg) /* Save the bits relating to the bridge */ bif->bif_flags = req->ifbr_ifsflags & IFBIFMASK; + NET_EPOCH_EXIT(et); + return (0); } From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 15:17: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 74E6456C7B2; Tue, 2 Mar 2021 15:17: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 4Dqgjv2Lkqz4Wqg; Tue, 2 Mar 2021 15:17: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 5575919078; Tue, 2 Mar 2021 15:17: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 122FHrJr039688; Tue, 2 Mar 2021 15:17:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FHrhH039687; Tue, 2 Mar 2021 15:17:53 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:17:53 GMT Message-Id: <202103021517.122FHrhH039687@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: 2c19b99c2f1c - stable/13 - bridge tests: Test STP on top of VLAN devices 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: 2c19b99c2f1c78bebb931f9465146ad4e7f1dec9 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 Mar 2021 15:17:58 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2c19b99c2f1c78bebb931f9465146ad4e7f1dec9 commit 2c19b99c2f1c78bebb931f9465146ad4e7f1dec9 Author: Kristof Provost AuthorDate: 2021-02-20 09:13:33 +0000 Commit: Kristof Provost CommitDate: 2021-03-02 14:50:21 +0000 bridge tests: Test STP on top of VLAN devices This is basically the same test as the existing STP test, but now on top of VLAN interfaces instead of directly using the epair devices. MFC after: 1 week Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D28861 (cherry picked from commit 26492ba2716f8b839f743bb663ce47405990fdf0) --- tests/sys/net/if_bridge_test.sh | 66 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index b848a03b273d..bc9add68ce25 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -124,6 +124,71 @@ stp_cleanup() vnet_cleanup } +atf_test_case "stp_vlan" "cleanup" +stp_vlan_head() +{ + atf_set descr 'Spanning tree on VLAN test' + atf_set require.user root +} + +stp_vlan_body() +{ + vnet_init + + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + bridge_a=$(vnet_mkbridge) + bridge_b=$(vnet_mkbridge) + + vnet_mkjail a ${bridge_a} ${epair_one}a ${epair_two}a + vnet_mkjail b ${bridge_b} ${epair_one}b ${epair_two}b + + jexec a ifconfig ${epair_one}a up + jexec a ifconfig ${epair_two}a up + vlan_a_one=$(jexec a ifconfig vlan create vlandev ${epair_one}a vlan 42) + vlan_a_two=$(jexec a ifconfig vlan create vlandev ${epair_two}a vlan 42) + jexec a ifconfig ${vlan_a_one} up + jexec a ifconfig ${vlan_a_two} up + jexec a ifconfig ${bridge_a} addm ${vlan_a_one} + jexec a ifconfig ${bridge_a} addm ${vlan_a_two} + + jexec b ifconfig ${epair_one}b up + jexec b ifconfig ${epair_two}b up + vlan_b_one=$(jexec b ifconfig vlan create vlandev ${epair_one}b vlan 42) + vlan_b_two=$(jexec b ifconfig vlan create vlandev ${epair_two}b vlan 42) + jexec b ifconfig ${vlan_b_one} up + jexec b ifconfig ${vlan_b_two} up + jexec b ifconfig ${bridge_b} addm ${vlan_b_one} + jexec b ifconfig ${bridge_b} addm ${vlan_b_two} + + jexec a ifconfig ${bridge_a} 192.0.2.1/24 + + # Enable spanning tree + jexec a ifconfig ${bridge_a} stp ${vlan_a_one} + jexec a ifconfig ${bridge_a} stp ${vlan_a_two} + jexec b ifconfig ${bridge_b} stp ${vlan_b_one} + jexec b ifconfig ${bridge_b} stp ${vlan_b_two} + + jexec b ifconfig ${bridge_b} up + jexec a ifconfig ${bridge_a} up + + # Give STP time to do its thing + sleep 5 + + a_discard=$(jexec a ifconfig ${bridge_a} | grep discarding) + b_discard=$(jexec b ifconfig ${bridge_b} | grep discarding) + + if [ -z "${a_discard}" ] && [ -z "${b_discard}" ] + then + atf_fail "STP failed to detect bridging loop" + fi +} + +stp_vlan_cleanup() +{ + vnet_cleanup +} + atf_test_case "static" "cleanup" static_head() { @@ -329,6 +394,7 @@ atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" atf_add_test_case "stp" + atf_add_test_case "stp_vlan" atf_add_test_case "static" atf_add_test_case "span" atf_add_test_case "inherit_mac" From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 15:17: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 0E5D256C811; Tue, 2 Mar 2021 15:17: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 4Dqgjt2JkGz4WfS; Tue, 2 Mar 2021 15:17: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 405F318C47; Tue, 2 Mar 2021 15:17: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 122FHpMC039630; Tue, 2 Mar 2021 15:17:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FHp27039629; Tue, 2 Mar 2021 15:17:51 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:17:51 GMT Message-Id: <202103021517.122FHp27039629@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: 791f370cb5d6 - stable/12 - bridge: Basic test case 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: 791f370cb5d6a24a1938a4e0147cc2734df6d076 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 Mar 2021 15:17:58 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=791f370cb5d6a24a1938a4e0147cc2734df6d076 commit 791f370cb5d6a24a1938a4e0147cc2734df6d076 Author: Kristof Provost AuthorDate: 2020-02-16 13:16:40 +0000 Commit: Kristof Provost CommitDate: 2021-03-02 13:03:06 +0000 bridge: Basic test case Very basic bridge test: Set up two jails and test that they can pass IPv4 traffic over the bridge. Reviewed by: melifaro, philip Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D23697 (cherry picked from commit 095aabf7dc814ae96d83bc5327a4b1f2e23be419) --- tests/sys/common/vnet.subr | 7 ++++ tests/sys/net/Makefile | 5 +-- tests/sys/net/if_bridge_test.sh | 74 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 2 deletions(-) diff --git a/tests/sys/common/vnet.subr b/tests/sys/common/vnet.subr index 53b387ec07e5..d86afaf6aafa 100644 --- a/tests/sys/common/vnet.subr +++ b/tests/sys/common/vnet.subr @@ -16,6 +16,13 @@ vnet_mkepair() echo ${ifname%a} } +vnet_mkbridge() +{ + ifname=$(ifconfig bridge create) + echo $ifname >> created_interfaces.lst + echo ${ifname} +} + vnet_mkjail() { jailname=$1 diff --git a/tests/sys/net/Makefile b/tests/sys/net/Makefile index 5989f8be0727..bbb1d1337b2f 100644 --- a/tests/sys/net/Makefile +++ b/tests/sys/net/Makefile @@ -5,10 +5,11 @@ TESTSDIR= ${TESTSBASE}/sys/net BINDIR= ${TESTSDIR} -ATF_TESTS_SH+= if_lagg_test +ATF_TESTS_C+= if_epair +ATF_TESTS_SH+= if_bridge_test ATF_TESTS_SH+= if_clone_test +ATF_TESTS_SH+= if_lagg_test ATF_TESTS_SH+= if_tun_test -ATF_TESTS_C+= if_epair # The tests are written to be run in parallel, but doing so leads to random # panics. I think it's because the kernel's list of interfaces isn't properly diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh new file mode 100755 index 000000000000..384857bff589 --- /dev/null +++ b/tests/sys/net/if_bridge_test.sh @@ -0,0 +1,74 @@ +# $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2020 The FreeBSD Foundation +# All rights reserved. +# +# This software was developed by Kristof Provost 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. + +. $(atf_get_srcdir)/../common/vnet.subr + +atf_test_case "bridge_transmit_ipv4_unicast" "cleanup" +bridge_transmit_ipv4_unicast_head() +{ + atf_set descr 'bridge_transmit_ipv4_unicast bridging test' + atf_set require.user root +} + +bridge_transmit_ipv4_unicast_body() +{ + vnet_init + + epair_alcatraz=$(vnet_mkepair) + epair_singsing=$(vnet_mkepair) + + vnet_mkjail alcatraz ${epair_alcatraz}b + vnet_mkjail singsing ${epair_singsing}b + + jexec alcatraz ifconfig ${epair_alcatraz}b 192.0.2.1/24 up + jexec singsing ifconfig ${epair_singsing}b 192.0.2.2/24 up + + bridge=$(vnet_mkbridge) + + ifconfig ${bridge} up + ifconfig ${epair_alcatraz}a up + ifconfig ${epair_singsing}a up + ifconfig ${bridge} addm ${epair_alcatraz}a + ifconfig ${bridge} addm ${epair_singsing}a + + atf_check -s exit:0 -o ignore jexec alcatraz ping -c 3 -t 1 192.0.2.2 + atf_check -s exit:0 -o ignore jexec singsing ping -c 3 -t 1 192.0.2.1 +} + +bridge_transmit_ipv4_unicast_cleanup() +{ + vnet_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "bridge_transmit_ipv4_unicast" +} From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 15:17: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 6FA7656C7B1; Tue, 2 Mar 2021 15:17: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 4Dqgjv16fFz4Wmq; Tue, 2 Mar 2021 15:17: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 E2E8418FC7; Tue, 2 Mar 2021 15:17: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 122FHql4039668; Tue, 2 Mar 2021 15:17:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FHqOa039667; Tue, 2 Mar 2021 15:17:52 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:17:52 GMT Message-Id: <202103021517.122FHqOa039667@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: 40fc07a85577 - stable/12 - bridge tests: Remove unneeded 'All rights reserved.' 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: 40fc07a85577bb22b923978b1fc9e99ce147d4a1 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 Mar 2021 15:17:58 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=40fc07a85577bb22b923978b1fc9e99ce147d4a1 commit 40fc07a85577bb22b923978b1fc9e99ce147d4a1 Author: Kristof Provost AuthorDate: 2020-02-19 16:44:16 +0000 Commit: Kristof Provost CommitDate: 2021-03-02 13:03:06 +0000 bridge tests: Remove unneeded 'All rights reserved.' The FreeBSD foundation no longer requires this, as per https://lists.freebsd.org/pipermail/svn-src-all/2019-February/177215.html and private communications. Sponsored by: The FreeBSD Foundation (cherry picked from commit e3c73f3d74c77b2c168519b10bdb6910a84287ef) --- tests/sys/net/if_bridge_test.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index 384857bff589..c51321187018 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -3,7 +3,6 @@ # SPDX-License-Identifier: BSD-2-Clause-FreeBSD # # Copyright (c) 2020 The FreeBSD Foundation -# All rights reserved. # # This software was developed by Kristof Provost under sponsorship # from the FreeBSD Foundation. From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 15:17: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 74B9456C75B; Tue, 2 Mar 2021 15:17: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 4Dqgjw6pY2z4Wyg; Tue, 2 Mar 2021 15:17: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 1D87B19079; Tue, 2 Mar 2021 15:17: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 122FHrhS039706; Tue, 2 Mar 2021 15:17:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FHr1R039705; Tue, 2 Mar 2021 15:17:53 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:17:53 GMT Message-Id: <202103021517.122FHr1R039705@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: 5b8932427605 - stable/12 - bridge test: spanning tree 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: 5b893242760570495abb09974455ab32a8fd6b95 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 Mar 2021 15:17:59 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5b893242760570495abb09974455ab32a8fd6b95 commit 5b893242760570495abb09974455ab32a8fd6b95 Author: Kristof Provost AuthorDate: 2020-03-10 06:28:45 +0000 Commit: Kristof Provost CommitDate: 2021-03-02 13:03:06 +0000 bridge test: spanning tree Basic test case where we create a bridge loop, verify that we really are looping and then enable spanning tree to resolve the loop. Reviewed by: philip Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D23959 (cherry picked from commit 6f0a65b080aac1b3144c7489b020b26b345d1a1b) --- tests/sys/net/if_bridge_test.sh | 69 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index c51321187018..afb260a86cc3 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -67,7 +67,76 @@ bridge_transmit_ipv4_unicast_cleanup() vnet_cleanup } +atf_test_case "stp" "cleanup" +stp_head() +{ + atf_set descr 'Spanning tree test' + atf_set require.user root + atf_set require.progs jq +} + +stp_body() +{ + vnet_init + + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + bridge_a=$(vnet_mkbridge) + bridge_b=$(vnet_mkbridge) + + vnet_mkjail a ${bridge_a} ${epair_one}a ${epair_two}a + vnet_mkjail b ${bridge_b} ${epair_one}b ${epair_two}b + + jexec a ifconfig ${bridge_a} up + jexec a ifconfig ${epair_one}a up + jexec a ifconfig ${epair_two}a up + jexec a ifconfig ${bridge_a} addm ${epair_one}a + jexec a ifconfig ${bridge_a} addm ${epair_two}a + + jexec b ifconfig ${bridge_b} up + jexec b ifconfig ${epair_one}b up + jexec b ifconfig ${epair_two}b up + jexec b ifconfig ${bridge_b} addm ${epair_one}b + jexec b ifconfig ${bridge_b} addm ${epair_two}b + + jexec a ifconfig ${bridge_a} 192.0.2.1/24 + + # Give the interfaces some time to come up and pass some traffic + sleep 5 + + # Confirm that there's looping traffic + nbr=$(jexec a netstat -I ${bridge_a} --libxo json \ + | jq ".statistics.interface[0].\"received-packets\"") + if [ ${nbr} -lt 100 ] + then + atf_fail "Expected bridging loop, but found very few packets." + fi + + # Enable spanning tree + jexec a ifconfig ${bridge_a} stp ${epair_one}a + jexec a ifconfig ${bridge_a} stp ${epair_two}a + jexec b ifconfig ${bridge_b} stp ${epair_one}b + jexec b ifconfig ${bridge_b} stp ${epair_two}b + + # Give STP time to do its thing + sleep 5 + + a_discard=$(jexec a ifconfig ${bridge_a} | grep discarding) + b_discard=$(jexec b ifconfig ${bridge_b} | grep discarding) + + if [ -z "${a_discard}" ] && [ -z "${b_discard}" ] + then + atf_fail "STP failed to detect bridging loop" + fi +} + +stp_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" + atf_add_test_case "stp" } From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 15:18: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 0239356C471; Tue, 2 Mar 2021 15:18: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 4Dqgjz2JmSz4Whv; Tue, 2 Mar 2021 15:17: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 878A818E7B; Tue, 2 Mar 2021 15:17: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 122FHvYd039811; Tue, 2 Mar 2021 15:17:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FHvBS039810; Tue, 2 Mar 2021 15:17:57 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:17:57 GMT Message-Id: <202103021517.122FHvBS039810@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: e180cc2fb9c5 - stable/12 - bridge tests: Test deleting a bridge with members 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: e180cc2fb9c5d7eb2d198470f54f7dbebbf4bf7c 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 Mar 2021 15:18:01 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e180cc2fb9c5d7eb2d198470f54f7dbebbf4bf7c commit e180cc2fb9c5d7eb2d198470f54f7dbebbf4bf7c Author: Kristof Provost AuthorDate: 2020-04-17 14:57:15 +0000 Commit: Kristof Provost CommitDate: 2021-03-02 13:03:06 +0000 bridge tests: Test deleting a bridge with members Reviewed by: philip, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D24337 (cherry picked from commit 3f359bfd47430183f69b9c03f34458217e7c7970) --- tests/sys/net/if_bridge_test.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index 7b26b97967ad..cb9c297220b6 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -245,10 +245,37 @@ span_cleanup() vnet_cleanup } +atf_test_case "delete_with_members" "cleanup" +delete_with_members_head() +{ + atf_set descr 'Delete a bridge which still has member interfaces' + atf_set require.user root +} + +delete_with_members_body() +{ + vnet_init + + bridge=$(vnet_mkbridge) + epair=$(vnet_mkepair) + + ifconfig ${bridge} 192.0.2.1/24 up + ifconfig ${epair}a up + ifconfig ${bridge} addm ${epair}a + + ifconfig ${bridge} destroy +} + +delete_with_members_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" atf_add_test_case "stp" atf_add_test_case "static" atf_add_test_case "span" + atf_add_test_case "delete_with_members" } From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 15:18: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 4B8D956C575; Tue, 2 Mar 2021 15:18: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 4Dqgjz2Mcsz4Wyr; Tue, 2 Mar 2021 15:17: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 58EFA18EB2; Tue, 2 Mar 2021 15:17: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 122FHuxs039793; Tue, 2 Mar 2021 15:17:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FHugH039792; Tue, 2 Mar 2021 15:17:56 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:17:56 GMT Message-Id: <202103021517.122FHugH039792@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: c4bf12b43711 - stable/12 - bridge tests: Basic span test 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: c4bf12b4371112ea5e875b51befbb4c12b9707db 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 Mar 2021 15:18:02 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c4bf12b4371112ea5e875b51befbb4c12b9707db commit c4bf12b4371112ea5e875b51befbb4c12b9707db Author: Kristof Provost AuthorDate: 2020-03-16 08:44:46 +0000 Commit: Kristof Provost CommitDate: 2021-03-02 13:03:06 +0000 bridge tests: Basic span test Reviewed by: philip, emaste (previous version) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D23961 (cherry picked from commit bb490fcf195450d9cbbac00e6338b352aac32c5c) --- tests/sys/net/if_bridge_test.sh | 55 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index 34b72c33bb36..7b26b97967ad 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -191,9 +191,64 @@ static_cleanup() vnet_cleanup } +atf_test_case "span" "cleanup" +span_head() +{ + atf_set descr 'Bridge span test' + atf_set require.user root +} + +span_body() +{ + set -x + vnet_init + + epair=$(vnet_mkepair) + epair_span=$(vnet_mkepair) + bridge=$(vnet_mkbridge) + + vnet_mkjail one ${bridge} ${epair}a ${epair_span}a + + ifconfig ${epair}b up + ifconfig ${epair_span}b up + + jexec one ifconfig ${bridge} up + jexec one ifconfig ${epair}a up + jexec one ifconfig ${epair_span}a up + jexec one ifconfig ${bridge} addm ${epair}a + + jexec one ifconfig ${bridge} span ${epair_span}a + jexec one ifconfig ${bridge} 192.0.2.1/24 + + # Send some traffic through the span + jexec one ping -c 1 -t 1 192.0.2.2 + + # Check that we see the traffic on the span interface + atf_check -s exit:0 \ + $(atf_get_srcdir)/../netpfil/common/pft_ping.py \ + --sendif ${epair}b \ + --to 192.0.2.2 \ + --recvif ${epair_span}b + + jexec one ifconfig ${bridge} -span ${epair_span}a + + # And no more traffic after we remove the span + atf_check -s exit:1 \ + $(atf_get_srcdir)/../netpfil/common/pft_ping.py \ + --sendif ${epair}b \ + --to 192.0.2.2 \ + --recvif ${epair_span}b +} + +span_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" atf_add_test_case "stp" atf_add_test_case "static" + atf_add_test_case "span" } From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 15:18: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 464D856C823; Tue, 2 Mar 2021 15:18: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 4Dqgk14mbsz4X00; Tue, 2 Mar 2021 15:18: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 9EA1C18EB3; Tue, 2 Mar 2021 15:17: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 122FHwrO039833; Tue, 2 Mar 2021 15:17:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FHwWD039832; Tue, 2 Mar 2021 15:17:58 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:17:58 GMT Message-Id: <202103021517.122FHwWD039832@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: e11329536494 - stable/12 - bridge tests: Ensure that bridges in different jails get different MAC addresses 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: e1132953649454ed7ae40e156c23de20d6a3827c 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 Mar 2021 15:18:03 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e1132953649454ed7ae40e156c23de20d6a3827c commit e1132953649454ed7ae40e156c23de20d6a3827c Author: Kristof Provost AuthorDate: 2020-04-19 16:30:49 +0000 Commit: Kristof Provost CommitDate: 2021-03-02 13:03:06 +0000 bridge tests: Ensure that bridges in different jails get different MAC addresses We used to have a problem where bridges created in different vnet jails would end up having the same mac address. This is now fixed by including the jail name as a seed for the mac address generation, but we should verify that it doesn't regress. (cherry picked from commit 2885ae0c3ca3ea93e1f227ecb3003db2e94f4129) --- tests/sys/net/if_bridge_test.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index cb9c297220b6..111281799e9d 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -271,6 +271,44 @@ delete_with_members_cleanup() vnet_cleanup } +atf_test_case "mac_conflict" "cleanup" +mac_conflict_head() +{ + atf_set descr 'Ensure that bridges in different jails get different mac addresses' + atf_set require.user root +} + +mac_conflict_body() +{ + vnet_init + + epair=$(vnet_mkepair) + + # Ensure the bridge module is loaded so jails can use it. + tmpbridge=$(vnet_mkbridge) + + vnet_mkjail bridge_mac_conflict_one ${epair}a + vnet_mkjail bridge_mac_conflict_two ${epair}b + + jexec bridge_mac_conflict_one ifconfig bridge create + jexec bridge_mac_conflict_one ifconfig bridge0 192.0.2.1/24 up \ + addm ${epair}a + jexec bridge_mac_conflict_one ifconfig ${epair}a up + + jexec bridge_mac_conflict_two ifconfig bridge create + jexec bridge_mac_conflict_two ifconfig bridge0 192.0.2.2/24 up \ + addm ${epair}b + jexec bridge_mac_conflict_two ifconfig ${epair}b up + + atf_check -s exit:0 -o ignore \ + jexec bridge_mac_conflict_one ping -c 3 192.0.2.2 +} + +mac_conflict_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" @@ -278,4 +316,5 @@ atf_init_test_cases() atf_add_test_case "static" atf_add_test_case "span" atf_add_test_case "delete_with_members" + atf_add_test_case "mac_conflict" } From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 15:17: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 59BA456C46A; Tue, 2 Mar 2021 15:17: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 4Dqgjw6qLWz4Wfb; Tue, 2 Mar 2021 15:17: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 3F07F1907A; Tue, 2 Mar 2021 15:17: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 122FHtG1039771; Tue, 2 Mar 2021 15:17:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FHtuO039770; Tue, 2 Mar 2021 15:17:55 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:17:55 GMT Message-Id: <202103021517.122FHtuO039770@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: 51ddfd32cc99 - stable/12 - bridge test: adding and removing static addresses 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: 51ddfd32cc9952a916d63b0c6780322b90f0873c 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 Mar 2021 15:18:00 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=51ddfd32cc9952a916d63b0c6780322b90f0873c commit 51ddfd32cc9952a916d63b0c6780322b90f0873c Author: Kristof Provost AuthorDate: 2020-03-10 06:29:59 +0000 Commit: Kristof Provost CommitDate: 2021-03-02 13:03:06 +0000 bridge test: adding and removing static addresses Reviewed by: philip Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D23960 (cherry picked from commit d99bb677c1cf43b22e91d54c49a8b7f0592e6fce) --- tests/sys/net/if_bridge_test.sh | 57 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index afb260a86cc3..34b72c33bb36 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -135,8 +135,65 @@ stp_cleanup() vnet_cleanup } +atf_test_case "static" "cleanup" +static_head() +{ + atf_set descr 'Bridge static address test' + atf_set require.user root +} + +static_body() +{ + vnet_init + + epair=$(vnet_mkepair) + bridge=$(vnet_mkbridge) + + vnet_mkjail one ${bridge} ${epair}a + + ifconfig ${epair}b up + + jexec one ifconfig ${bridge} up + jexec one ifconfig ${epair}a up + jexec one ifconfig ${bridge} addm ${epair}a + + # Wrong interface + atf_check -s exit:1 -o ignore -e ignore \ + jexec one ifconfig ${bridge} static ${epair}b 00:01:02:03:04:05 + + # Bad address format + atf_check -s exit:1 -o ignore -e ignore \ + jexec one ifconfig ${bridge} static ${epair}a 00:01:02:03:04 + + # Correct add + atf_check -s exit:0 -o ignore \ + jexec one ifconfig ${bridge} static ${epair}a 00:01:02:03:04:05 + + # List addresses + atf_check -s exit:0 -o ignore \ + jexec one ifconfig ${bridge} addr + + # Delete with bad address format + atf_check -s exit:1 -o ignore -e ignore \ + jexec one ifconfig ${bridge} deladdr 00:01:02:03:04 + + # Delete with unlisted address + atf_check -s exit:1 -o ignore -e ignore \ + jexec one ifconfig ${bridge} deladdr 00:01:02:03:04:06 + + # Correct delete + atf_check -s exit:0 -o ignore \ + jexec one ifconfig ${bridge} deladdr 00:01:02:03:04:05 +} + +static_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" atf_add_test_case "stp" + atf_add_test_case "static" } From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 15:18: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 57AA156C991; Tue, 2 Mar 2021 15:18: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 4Dqgk33bm3z4WtY; Tue, 2 Mar 2021 15:18: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 C6F131907B; Tue, 2 Mar 2021 15:17: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 122FHxax039855; Tue, 2 Mar 2021 15:17:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FHxqJ039854; Tue, 2 Mar 2021 15:17:59 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:17:59 GMT Message-Id: <202103021517.122FHxqJ039854@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: 1b73cd3d0a7c - stable/12 - bridge tests: Test for #216510 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: 1b73cd3d0a7c9fa9b19e28a3bd8e79f405309348 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 Mar 2021 15:18:07 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=1b73cd3d0a7c9fa9b19e28a3bd8e79f405309348 commit 1b73cd3d0a7c9fa9b19e28a3bd8e79f405309348 Author: Kristof Provost AuthorDate: 2020-04-26 16:27:03 +0000 Commit: Kristof Provost CommitDate: 2021-03-02 13:03:07 +0000 bridge tests: Test for #216510 We used to have an issue with recursive locking with net.link.bridge.inherit_mac. This causes us to send an ARP request while we hold the BRIDGE_LOCK, which used to cause us to acquire the BRIDGE_LOCK again. We can't re-acquire it, so this caused a panic. Now that we no longer need to acquire the BRIDGE_LOCK for bridge_transmit() this should no longer panic. Test this. PR: 216510 Reviewed by: emaste, philip MFC after: 2 months Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D24251 (cherry picked from commit 5377560783d95b92fce3bea3caac37d2860b1d48) --- tests/sys/net/if_bridge_test.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index 111281799e9d..a20eae49998f 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -309,12 +309,40 @@ mac_conflict_cleanup() vnet_cleanup } +atf_test_case "inherit_mac" "cleanup" +inherit_mac_head() +{ + atf_set descr 'Bridge inherit_mac test, #216510' + atf_set require.user root +} + +inherit_mac_body() +{ + vnet_init + + bridge=$(vnet_mkbridge) + epair=$(vnet_mkepair) + vnet_mkjail one ${bridge} ${epair}a + + jexec one sysctl net.link.bridge.inherit_mac=1 + + # Attempt to provoke the panic described in #216510 + jexec one ifconfig ${bridge} 192.0.0.1/24 up + jexec one ifconfig ${bridge} addm ${epair}a +} + +inherit_mac_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" atf_add_test_case "stp" atf_add_test_case "static" atf_add_test_case "span" + atf_add_test_case "inherit_mac" atf_add_test_case "delete_with_members" atf_add_test_case "mac_conflict" } From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 15:18: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 6690756C828; Tue, 2 Mar 2021 15:18: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 4Dqgk369dxz4WlY; Tue, 2 Mar 2021 15:18: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 E0A0718EB4; Tue, 2 Mar 2021 15:18: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 122FI05n039874; Tue, 2 Mar 2021 15:18:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FI0jt039872; Tue, 2 Mar 2021 15:18:00 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:18:00 GMT Message-Id: <202103021518.122FI0jt039872@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: fd5828b62bdb - stable/12 - bridge tests: Avoid building a switching loop 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: fd5828b62bdb5738143c81edb139365aa4151567 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 Mar 2021 15:18:07 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fd5828b62bdb5738143c81edb139365aa4151567 commit fd5828b62bdb5738143c81edb139365aa4151567 Author: Kristof Provost AuthorDate: 2020-06-01 19:26:16 +0000 Commit: Kristof Provost CommitDate: 2021-03-02 13:03:07 +0000 bridge tests: Avoid building a switching loop Enable STP before bringing the bridges up. This avoids a switching loop, which has a tendency to drown out progress in userspace processes, especially on single-core systems. Only check that we have indeed shut down one of the looped interfaces PR: 246448 Reviewed by: melifaro Differential Revision: https://reviews.freebsd.org/D25084 (cherry picked from commit e07e002e950aa673266e3d4b30c43e1198af65e0) --- tests/sys/net/if_bridge_test.sh | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index a20eae49998f..b848a03b273d 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -72,7 +72,6 @@ stp_head() { atf_set descr 'Spanning tree test' atf_set require.user root - atf_set require.progs jq } stp_body() @@ -87,13 +86,11 @@ stp_body() vnet_mkjail a ${bridge_a} ${epair_one}a ${epair_two}a vnet_mkjail b ${bridge_b} ${epair_one}b ${epair_two}b - jexec a ifconfig ${bridge_a} up jexec a ifconfig ${epair_one}a up jexec a ifconfig ${epair_two}a up jexec a ifconfig ${bridge_a} addm ${epair_one}a jexec a ifconfig ${bridge_a} addm ${epair_two}a - jexec b ifconfig ${bridge_b} up jexec b ifconfig ${epair_one}b up jexec b ifconfig ${epair_two}b up jexec b ifconfig ${bridge_b} addm ${epair_one}b @@ -101,23 +98,15 @@ stp_body() jexec a ifconfig ${bridge_a} 192.0.2.1/24 - # Give the interfaces some time to come up and pass some traffic - sleep 5 - - # Confirm that there's looping traffic - nbr=$(jexec a netstat -I ${bridge_a} --libxo json \ - | jq ".statistics.interface[0].\"received-packets\"") - if [ ${nbr} -lt 100 ] - then - atf_fail "Expected bridging loop, but found very few packets." - fi - # Enable spanning tree jexec a ifconfig ${bridge_a} stp ${epair_one}a jexec a ifconfig ${bridge_a} stp ${epair_two}a jexec b ifconfig ${bridge_b} stp ${epair_one}b jexec b ifconfig ${bridge_b} stp ${epair_two}b + jexec b ifconfig ${bridge_b} up + jexec a ifconfig ${bridge_a} up + # Give STP time to do its thing sleep 5 From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 15:18: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 7831756C8A5; Tue, 2 Mar 2021 15:18: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 4Dqgk52QgFz4Wr9; Tue, 2 Mar 2021 15:18: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 0AA9918C48; Tue, 2 Mar 2021 15:18: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 122FI1Pi039895; Tue, 2 Mar 2021 15:18:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FI1WN039894; Tue, 2 Mar 2021 15:18:01 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:18:01 GMT Message-Id: <202103021518.122FI1WN039894@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: 81d747ace024 - stable/12 - bridge tests: Test STP on top of VLAN devices 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: 81d747ace024ff71746f003f4d108f26b69bfede 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 Mar 2021 15:18:07 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=81d747ace024ff71746f003f4d108f26b69bfede commit 81d747ace024ff71746f003f4d108f26b69bfede Author: Kristof Provost AuthorDate: 2021-02-20 09:13:33 +0000 Commit: Kristof Provost CommitDate: 2021-03-02 13:03:07 +0000 bridge tests: Test STP on top of VLAN devices This is basically the same test as the existing STP test, but now on top of VLAN interfaces instead of directly using the epair devices. MFC after: 1 week Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D28861 (cherry picked from commit 26492ba2716f8b839f743bb663ce47405990fdf0) --- tests/sys/net/if_bridge_test.sh | 66 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index b848a03b273d..bc9add68ce25 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -124,6 +124,71 @@ stp_cleanup() vnet_cleanup } +atf_test_case "stp_vlan" "cleanup" +stp_vlan_head() +{ + atf_set descr 'Spanning tree on VLAN test' + atf_set require.user root +} + +stp_vlan_body() +{ + vnet_init + + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + bridge_a=$(vnet_mkbridge) + bridge_b=$(vnet_mkbridge) + + vnet_mkjail a ${bridge_a} ${epair_one}a ${epair_two}a + vnet_mkjail b ${bridge_b} ${epair_one}b ${epair_two}b + + jexec a ifconfig ${epair_one}a up + jexec a ifconfig ${epair_two}a up + vlan_a_one=$(jexec a ifconfig vlan create vlandev ${epair_one}a vlan 42) + vlan_a_two=$(jexec a ifconfig vlan create vlandev ${epair_two}a vlan 42) + jexec a ifconfig ${vlan_a_one} up + jexec a ifconfig ${vlan_a_two} up + jexec a ifconfig ${bridge_a} addm ${vlan_a_one} + jexec a ifconfig ${bridge_a} addm ${vlan_a_two} + + jexec b ifconfig ${epair_one}b up + jexec b ifconfig ${epair_two}b up + vlan_b_one=$(jexec b ifconfig vlan create vlandev ${epair_one}b vlan 42) + vlan_b_two=$(jexec b ifconfig vlan create vlandev ${epair_two}b vlan 42) + jexec b ifconfig ${vlan_b_one} up + jexec b ifconfig ${vlan_b_two} up + jexec b ifconfig ${bridge_b} addm ${vlan_b_one} + jexec b ifconfig ${bridge_b} addm ${vlan_b_two} + + jexec a ifconfig ${bridge_a} 192.0.2.1/24 + + # Enable spanning tree + jexec a ifconfig ${bridge_a} stp ${vlan_a_one} + jexec a ifconfig ${bridge_a} stp ${vlan_a_two} + jexec b ifconfig ${bridge_b} stp ${vlan_b_one} + jexec b ifconfig ${bridge_b} stp ${vlan_b_two} + + jexec b ifconfig ${bridge_b} up + jexec a ifconfig ${bridge_a} up + + # Give STP time to do its thing + sleep 5 + + a_discard=$(jexec a ifconfig ${bridge_a} | grep discarding) + b_discard=$(jexec b ifconfig ${bridge_b} | grep discarding) + + if [ -z "${a_discard}" ] && [ -z "${b_discard}" ] + then + atf_fail "STP failed to detect bridging loop" + fi +} + +stp_vlan_cleanup() +{ + vnet_cleanup +} + atf_test_case "static" "cleanup" static_head() { @@ -329,6 +394,7 @@ atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" atf_add_test_case "stp" + atf_add_test_case "stp_vlan" atf_add_test_case "static" atf_add_test_case "span" atf_add_test_case "inherit_mac" From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 15: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 5F3CE56C94F; Tue, 2 Mar 2021 15: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 4DqglN4nv8z4XXM; Tue, 2 Mar 2021 15:19: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 4050C18E7E; Tue, 2 Mar 2021 15:19: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 122FJAZM040306; Tue, 2 Mar 2021 15:19:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FJAdZ040305; Tue, 2 Mar 2021 15:19:10 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:19:10 GMT Message-Id: <202103021519.122FJAdZ040305@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: 91a611e52160 - releng/13.0 - mips: Don't set __NO_TLS to disable some uses of TLS. 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 91a611e5216027ca9e82770882b5f7e8d98a2f15 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 Mar 2021 15:19:14 -0000 The branch releng/13.0 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=91a611e5216027ca9e82770882b5f7e8d98a2f15 commit 91a611e5216027ca9e82770882b5f7e8d98a2f15 Author: John Baldwin AuthorDate: 2021-02-18 00:34:23 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-02 15:18:56 +0000 mips: Don't set __NO_TLS to disable some uses of TLS. Approved by: re (gjb) (cherry picked from commit 24fd63e0970f91189dd2acde987bd2e4c8c04a50) --- sys/sys/cdefs.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 4de1ef011756..1e670fd87d6f 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -768,8 +768,7 @@ #endif #endif /* __STDC_WANT_LIB_EXT1__ */ -#if defined(__mips) || \ - (defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1)) +#if defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1) #define __NO_TLS 1 #endif From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 15: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 8B67656C86F; Tue, 2 Mar 2021 15: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 4DqglN2JWlz4Xgt; Tue, 2 Mar 2021 15:19: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 5DFDE188F9; Tue, 2 Mar 2021 15:19: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 122FJBp9040328; Tue, 2 Mar 2021 15:19:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FJBKf040327; Tue, 2 Mar 2021 15:19:11 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:19:11 GMT Message-Id: <202103021519.122FJBKf040327@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: 811deba9df26 - releng/13.0 - Remove __NO_TLS. 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 811deba9df266fbe148c95f10ba8fb2a1b32e7bf 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 Mar 2021 15:19:14 -0000 The branch releng/13.0 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=811deba9df266fbe148c95f10ba8fb2a1b32e7bf commit 811deba9df266fbe148c95f10ba8fb2a1b32e7bf Author: Konstantin Belousov AuthorDate: 2021-02-19 15:20:29 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-02 15:18:56 +0000 Remove __NO_TLS. Approved by: re (gjb) (cherry picked from commit 3ae8d83d04a7a6ec11b64c89ee60c180b0bde30e) --- include/runetype.h | 4 ++-- lib/libc/gen/getutxent.c | 5 ----- lib/libc/gen/utxdb.c | 4 ---- lib/libc/locale/setrunelocale.c | 4 ---- lib/libc/locale/xlocale.c | 15 +-------------- lib/libc/locale/xlocale_private.h | 5 +---- lib/libc/string/strerror.c | 5 ----- lib/libgssapi/gss_display_status.c | 10 ---------- sys/sys/cdefs.h | 4 ---- tests/sys/opencrypto/cryptodevh.py | 1 - 10 files changed, 4 insertions(+), 53 deletions(-) diff --git a/include/runetype.h b/include/runetype.h index 4aca128f8c8a..93007809dbf8 100644 --- a/include/runetype.h +++ b/include/runetype.h @@ -88,7 +88,7 @@ typedef struct { __BEGIN_DECLS extern const _RuneLocale _DefaultRuneLocale; extern const _RuneLocale *_CurrentRuneLocale; -#if defined(__NO_TLS) || defined(__RUNETYPE_INTERNAL) +#ifdef __RUNETYPE_INTERNAL extern const _RuneLocale *__getCurrentRuneLocale(void); #else extern _Thread_local const _RuneLocale *_ThreadRuneLocale; @@ -99,7 +99,7 @@ static __inline const _RuneLocale *__getCurrentRuneLocale(void) return _ThreadRuneLocale; return _CurrentRuneLocale; } -#endif /* __NO_TLS || __RUNETYPE_INTERNAL */ +#endif /*__RUNETYPE_INTERNAL */ #define _CurrentRuneLocale (__getCurrentRuneLocale()) __END_DECLS diff --git a/lib/libc/gen/getutxent.c b/lib/libc/gen/getutxent.c index e0d993221e7e..664498126f13 100644 --- a/lib/libc/gen/getutxent.c +++ b/lib/libc/gen/getutxent.c @@ -40,13 +40,8 @@ __FBSDID("$FreeBSD$"); #include "utxdb.h" #include "un-namespace.h" -#ifdef __NO_TLS -static FILE *uf = NULL; -static int udb; -#else static _Thread_local FILE *uf = NULL; static _Thread_local int udb; -#endif int setutxdb(int db, const char *file) diff --git a/lib/libc/gen/utxdb.c b/lib/libc/gen/utxdb.c index f8dea105702c..3edccdbd2c2f 100644 --- a/lib/libc/gen/utxdb.c +++ b/lib/libc/gen/utxdb.c @@ -128,11 +128,7 @@ utx_to_futx(const struct utmpx *ut, struct futx *fu) struct utmpx * futx_to_utx(const struct futx *fu) { -#ifdef __NO_TLS - static struct utmpx *ut; -#else static _Thread_local struct utmpx *ut; -#endif if (ut == NULL) { ut = calloc(1, sizeof *ut); diff --git a/lib/libc/locale/setrunelocale.c b/lib/libc/locale/setrunelocale.c index 2e6fed9466e4..551d32b7ab6a 100644 --- a/lib/libc/locale/setrunelocale.c +++ b/lib/libc/locale/setrunelocale.c @@ -56,12 +56,10 @@ __FBSDID("$FreeBSD$"); #undef _CurrentRuneLocale extern _RuneLocale const *_CurrentRuneLocale; -#ifndef __NO_TLS /* * A cached version of the runes for this thread. Used by ctype.h */ _Thread_local const _RuneLocale *_ThreadRuneLocale; -#endif extern int __mb_sb_limit; @@ -199,7 +197,6 @@ __wrap_setrunelocale(const char *locale) return (_LDP_LOADED); } -#ifndef __NO_TLS void __set_thread_rune_locale(locale_t loc) { @@ -212,7 +209,6 @@ __set_thread_rune_locale(locale_t loc) _ThreadRuneLocale = XLOCALE_CTYPE(loc)->runes; } } -#endif void * __ctype_load(const char *locale, locale_t unused __unused) diff --git a/lib/libc/locale/xlocale.c b/lib/libc/locale/xlocale.c index fb674f86bbff..d64262da809e 100644 --- a/lib/libc/locale/xlocale.c +++ b/lib/libc/locale/xlocale.c @@ -55,12 +55,11 @@ extern struct xlocale_component __xlocale_global_messages; extern struct xlocale_component __xlocale_C_collate; extern struct xlocale_component __xlocale_C_ctype; -#ifndef __NO_TLS /* * The locale for this thread. */ _Thread_local locale_t __thread_locale; -#endif + /* * Flag indicating that one or more per-thread locales exist. */ @@ -143,16 +142,6 @@ get_thread_locale(void) pthread_getspecific(locale_info_key)); } -#ifdef __NO_TLS -locale_t -__get_locale(void) -{ - locale_t l = get_thread_locale(); - return (l ? l : &__xlocale_global_locale); - -} -#endif - static void set_thread_locale(locale_t loc) { @@ -172,10 +161,8 @@ set_thread_locale(locale_t loc) } else { pthread_setspecific(locale_info_key, l); } -#ifndef __NO_TLS __thread_locale = l; __set_thread_rune_locale(loc); -#endif } /** diff --git a/lib/libc/locale/xlocale_private.h b/lib/libc/locale/xlocale_private.h index 391e375bc03d..bc40f28fc9eb 100644 --- a/lib/libc/locale/xlocale_private.h +++ b/lib/libc/locale/xlocale_private.h @@ -185,7 +185,7 @@ void __set_thread_rune_locale(locale_t loc); * locale has ever been set, then we always use the global locale. */ extern int __has_thread_locale; -#ifndef __NO_TLS + /** * The per-thread locale. Avoids the need to use pthread lookup functions when * getting the per-thread locale. @@ -206,9 +206,6 @@ static inline locale_t __get_locale(void) } return (__thread_locale ? __thread_locale : &__xlocale_global_locale); } -#else -locale_t __get_locale(void); -#endif /** * Two magic values are allowed for locale_t objects. NULL and -1. This diff --git a/lib/libc/string/strerror.c b/lib/libc/string/strerror.c index 11b9701d968f..bb685e4f7dc9 100644 --- a/lib/libc/string/strerror.c +++ b/lib/libc/string/strerror.c @@ -128,16 +128,11 @@ strerror_r(int errnum, char *strerrbuf, size_t buflen) char * strerror_l(int num, locale_t locale) { -#ifndef __NO_TLS static _Thread_local char ebuf[NL_TEXTMAX]; if (strerror_rl(num, ebuf, sizeof(ebuf), locale) != 0) errno = EINVAL; return (ebuf); -#else - errno = ENOTSUP; - return (NULL); -#endif } char * diff --git a/lib/libgssapi/gss_display_status.c b/lib/libgssapi/gss_display_status.c index 55ca83ce9aa8..d0c3453a0d6b 100644 --- a/lib/libgssapi/gss_display_status.c +++ b/lib/libgssapi/gss_display_status.c @@ -174,16 +174,6 @@ supplementary_error(OM_uint32 v) return msgs[v]; } -#if defined(__NO_TLS) - -/* - * These platforms don't support TLS on FreeBSD - threads will just - * have to step on each other's error values for now. - */ -#define __thread - -#endif - struct mg_thread_ctx { gss_OID mech; OM_uint32 maj_stat; diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 1e670fd87d6f..d11bee96e10a 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -768,10 +768,6 @@ #endif #endif /* __STDC_WANT_LIB_EXT1__ */ -#if defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1) -#define __NO_TLS 1 -#endif - /* * Old versions of GCC use non-standard ARM arch symbols; acle-compat.h * translates them to __ARM_ARCH and the modern feature symbols defined by ARM. diff --git a/tests/sys/opencrypto/cryptodevh.py b/tests/sys/opencrypto/cryptodevh.py index be853f496930..c5719e47c8c1 100644 --- a/tests/sys/opencrypto/cryptodevh.py +++ b/tests/sys/opencrypto/cryptodevh.py @@ -133,7 +133,6 @@ __POSIX_VISIBLE = 200809 __XSI_VISIBLE = 700 __BSD_VISIBLE = 1 __ISO_C_VISIBLE = 2011 -__NO_TLS = 1 CRYPTO_DRIVERS_INITIAL = 4 CRYPTO_SW_SESSIONS = 32 NULL_HASH_LEN = 16 From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 15: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 80A9B56CA36; Tue, 2 Mar 2021 15: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 4DqglP4zmGz4XXS; Tue, 2 Mar 2021 15:19: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 1278F18EB7; Tue, 2 Mar 2021 15:19: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 122FJ8AC040283; Tue, 2 Mar 2021 15:19:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122FJ8n2040282; Tue, 2 Mar 2021 15:19:08 GMT (envelope-from git) Date: Tue, 2 Mar 2021 15:19:08 GMT Message-Id: <202103021519.122FJ8n2040282@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: 229f1e4b1424 - releng/13.0 - riscv: Don't set __NO_TLS to disable some uses of TLS. 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 229f1e4b14246cf950ed0536f15fd2b1d563fbf7 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 Mar 2021 15:19:14 -0000 The branch releng/13.0 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=229f1e4b14246cf950ed0536f15fd2b1d563fbf7 commit 229f1e4b14246cf950ed0536f15fd2b1d563fbf7 Author: John Baldwin AuthorDate: 2021-02-18 00:33:09 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-02 15:18:56 +0000 riscv: Don't set __NO_TLS to disable some uses of TLS. Approved by: re (gjb) (cherry picked from commit dd176fd7e7b5aad231cd6ebf49fd14ae7394dfee) --- sys/sys/cdefs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 75bedd4b8128..4de1ef011756 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -768,7 +768,7 @@ #endif #endif /* __STDC_WANT_LIB_EXT1__ */ -#if defined(__mips) || defined(__riscv) || \ +#if defined(__mips) || \ (defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1)) #define __NO_TLS 1 #endif From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 16:42: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 D7FD956F7A3; Tue, 2 Mar 2021 16:42: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 4Dqjbl5nvMz4hJ2; Tue, 2 Mar 2021 16:42: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 B9BA71A316; Tue, 2 Mar 2021 16:42: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 122Ggh2I058868; Tue, 2 Mar 2021 16:42:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122GghHT058867; Tue, 2 Mar 2021 16:42:43 GMT (envelope-from git) Date: Tue, 2 Mar 2021 16:42:43 GMT Message-Id: <202103021642.122GghHT058867@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 2751e264dfef - releng/13.0 - tcp: improve behaviour when using TCP_NOOPT MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 2751e264dfef1e59e9c45d511a2d3ee99839651e 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 Mar 2021 16:42:43 -0000 The branch releng/13.0 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=2751e264dfef1e59e9c45d511a2d3ee99839651e commit 2751e264dfef1e59e9c45d511a2d3ee99839651e Author: Michael Tuexen AuthorDate: 2021-02-14 11:10:31 +0000 Commit: Michael Tuexen CommitDate: 2021-03-02 15:17:25 +0000 tcp: improve behaviour when using TCP_NOOPT Use ISS for SEG.SEQ when sending a SYN-ACK segment in response to an SYN segment received in the SYN-SENT state on a socket having the IPPROTO_TCP level socket option TCP_NOOPT enabled. Approved by: re (gjb) Reviewed by: rscheff Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D28656 (cherry picked from commit ed782b9f5a7a05debe944a33b4ac9e5629a95803) (cherry picked from commit e949dcc283cd3b19e8e3113d8d3e10a72c2bbe6e) --- sys/netinet/tcp_output.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index cacc0c51bd8e..b4c7ab0a1ab7 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -785,6 +785,10 @@ send: #endif hdrlen = sizeof (struct tcpiphdr); + if (flags & TH_SYN) { + tp->snd_nxt = tp->iss; + } + /* * Compute options for segment. * We only have to care about SYN and established connection @@ -795,7 +799,6 @@ send: if ((tp->t_flags & TF_NOOPT) == 0) { /* Maximum segment size. */ if (flags & TH_SYN) { - tp->snd_nxt = tp->iss; to.to_mss = tcp_mssopt(&tp->t_inpcb->inp_inc); to.to_flags |= TOF_MSS; From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 17:13: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 A1CD9548AF7; Tue, 2 Mar 2021 17:13: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 4DqkHc4Br3z4l0m; Tue, 2 Mar 2021 17:13: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 82F631A894; Tue, 2 Mar 2021 17:13: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 122HDmWZ099535; Tue, 2 Mar 2021 17:13:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122HDmTi099534; Tue, 2 Mar 2021 17:13:48 GMT (envelope-from git) Date: Tue, 2 Mar 2021 17:13:48 GMT Message-Id: <202103021713.122HDmTi099534@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Richard Scheffenegger Subject: git: 15a7c88058d4 - stable/13 - update the SACK loss recovery to RFC6675, with the following new features: - improved pipe calculation which does not degrade under heavy loss - engaging in Loss Recovery earlier under adverse conditions - Rescue Retransmission in case some of the trailing packets of a request got lost MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 15a7c88058d419e3347673ab891ae77ba28ae1bd 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 Mar 2021 17:13:48 -0000 The branch stable/13 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=15a7c88058d419e3347673ab891ae77ba28ae1bd commit 15a7c88058d419e3347673ab891ae77ba28ae1bd Author: Richard Scheffenegger AuthorDate: 2021-02-16 11:18:43 +0000 Commit: Richard Scheffenegger CommitDate: 2021-03-02 15:59:58 +0000 update the SACK loss recovery to RFC6675, with the following new features: - improved pipe calculation which does not degrade under heavy loss - engaging in Loss Recovery earlier under adverse conditions - Rescue Retransmission in case some of the trailing packets of a request got lost All above changes are toggled with the sysctl "rfc6675_pipe" (disabled by default). Reviewers: #transport, tuexen, lstewart, slavash, jtl, hselasky, kib, rgrimes, chengc_netapp.com, thj, #manpages, kbowling, #netapp, rscheff Reviewed By: #transport MFC after: 2 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D18985 (cherry picked from commit 3c40e1d52cd86168779cf99dbabe58df465d7e3f) --- share/man/man4/tcp.4 | 10 +++++++++- sys/netinet/tcp_input.c | 34 +++++++++++++++++++++++++++++----- sys/netinet/tcp_sack.c | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 6 deletions(-) diff --git a/share/man/man4/tcp.4 b/share/man/man4/tcp.4 index 431bcd95513b..16cf02184516 100644 --- a/share/man/man4/tcp.4 +++ b/share/man/man4/tcp.4 @@ -34,7 +34,7 @@ .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd February 11, 2021 +.Dd February 13, 2021 .Dt TCP 4 .Os .Sh NAME @@ -560,6 +560,14 @@ high losses leading to RTO, but reduces PRR effectiveness in more common setting .It Va rfc6675_pipe Calculate the bytes in flight using the algorithm described in RFC 6675, and is also an improvement when Proportional Rate Reduction is enabled. +Also enables two other mechanisms from RFC6675. +Rescue Retransmission helps timely loss recovery, when the trailing segments +of a transmission are lost, while no additional data is ready to be sent. +In case a partial ACK without a SACK block is received during SACK loss +recovery, the trailing segment is immediately resent, rather than waiting +for a Retransmission timeout. +SACK loss recovery is also engaged, once two segments plus one byte are +SACKed - even if no traditional duplicate ACKs were seen. .It Va rfc3042 Enable the Limited Transmit algorithm as described in RFC 3042. It helps avoid timeouts on lossy links and also when the congestion window diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index f16c62ae6a1f..1a4a4619c4bf 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1507,6 +1507,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, struct mbuf *mfree; struct tcpopt to; int tfo_syn; + u_int maxseg; #ifdef TCPDEBUG /* @@ -2512,8 +2513,6 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, #endif if (SEQ_LEQ(th->th_ack, tp->snd_una)) { - u_int maxseg; - maxseg = tcp_maxseg(tp); if (tlen == 0 && (tiwin == tp->snd_wnd || @@ -2648,7 +2647,21 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, tp->snd_cwnd += maxseg; (void) tp->t_fb->tfb_tcp_output(tp); goto drop; - } else if (tp->t_dupacks == tcprexmtthresh) { + } else if (tp->t_dupacks == tcprexmtthresh || + (tp->t_flags & TF_SACK_PERMIT && + V_tcp_do_rfc6675_pipe && + tp->sackhint.sacked_bytes > + (tcprexmtthresh - 1) * maxseg)) { +enter_recovery: + /* + * Above is the RFC6675 trigger condition of + * more than (dupthresh-1)*maxseg sacked data. + * If the count of holes in the + * scoreboard is >= dupthresh, we could + * also enter loss recovery, but don't + * have that value readily available. + */ + tp->t_dupacks = tcprexmtthresh; tcp_seq onxt = tp->snd_nxt; /* @@ -2693,6 +2706,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, tp->snd_recover = tp->snd_nxt; tp->snd_cwnd = maxseg; (void) tp->t_fb->tfb_tcp_output(tp); + if (SEQ_GT(th->th_ack, tp->snd_una)) + goto resume_partialack; goto drop; } tp->snd_nxt = th->th_ack; @@ -2779,10 +2794,19 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, */ if ((tp->t_flags & TF_SACK_PERMIT) && (to.to_flags & TOF_SACK) && - sack_changed) + sack_changed) { tp->t_dupacks++; + /* limit overhead by setting maxseg last */ + if (!IN_FASTRECOVERY(tp->t_flags) && + (tp->sackhint.sacked_bytes > + ((tcprexmtthresh - 1) * + (maxseg = tcp_maxseg(tp))))) { + goto enter_recovery; + } + } } +resume_partialack: KASSERT(SEQ_GT(th->th_ack, tp->snd_una), ("%s: th_ack <= snd_una", __func__)); @@ -2793,7 +2817,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, if (IN_FASTRECOVERY(tp->t_flags)) { if (SEQ_LT(th->th_ack, tp->snd_recover)) { if (tp->t_flags & TF_SACK_PERMIT) - if (V_tcp_do_prr) + if (V_tcp_do_prr && to.to_flags & TOF_SACK) tcp_prr_partialack(tp, th); else tcp_sack_partialack(tp, th); diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c index 2cae6a560c48..28cd5c93f106 100644 --- a/sys/netinet/tcp_sack.c +++ b/sys/netinet/tcp_sack.c @@ -750,6 +750,16 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tcp_seq th_ack) else sblkp--; } + if (!(to->to_flags & TOF_SACK)) + /* + * If this ACK did not contain any + * SACK blocks, any only moved the + * left edge right, it is a pure + * cumulative ACK. Do not count + * DupAck for this. Also required + * for RFC6675 rescue retransmission. + */ + sack_changed = 0; tp->sackhint.delivered_data = delivered_data; tp->sackhint.sacked_bytes += delivered_data - left_edge_delta; KASSERT((delivered_data >= 0), ("delivered_data < 0")); @@ -800,6 +810,31 @@ tcp_sack_partialack(struct tcpcb *tp, struct tcphdr *th) if (tp->snd_cwnd > tp->snd_ssthresh) tp->snd_cwnd = tp->snd_ssthresh; tp->t_flags |= TF_ACKNOW; + /* + * RFC6675 rescue retransmission + * Add a hole between th_ack (snd_una is not yet set) and snd_max, + * if this was a pure cumulative ACK and no data was send beyond + * recovery point. Since the data in the socket has not been freed + * at this point, we check if the scoreboard is empty, and the ACK + * delivered some new data, indicating a full ACK. Also, if the + * recovery point is still at snd_max, we are probably application + * limited. However, this inference might not always be true. The + * rescue retransmission may rarely be slightly premature + * compared to RFC6675. + * The corresponding ACK+SACK will cause any further outstanding + * segments to be retransmitted. This addresses a corner case, when + * the trailing packets of a window are lost and no further data + * is available for sending. + */ + if ((V_tcp_do_rfc6675_pipe) && + SEQ_LT(th->th_ack, tp->snd_recover) && + (tp->snd_recover == tp->snd_max) && + TAILQ_EMPTY(&tp->snd_holes) && + (tp->sackhint.delivered_data > 0)) { + struct sackhole *hole; + int maxseg = tcp_maxseg(tp); + hole = tcp_sackhole_insert(tp, SEQ_MAX(th->th_ack, tp->snd_max - maxseg), tp->snd_max, NULL); + } (void) tp->t_fb->tfb_tcp_output(tp); } From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 18:12: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 545CB54A5AD; Tue, 2 Mar 2021 18:12: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 4Dqlbk22DJz4nwP; Tue, 2 Mar 2021 18:12: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 389761B3F2; Tue, 2 Mar 2021 18:12: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 122ICoCC078643; Tue, 2 Mar 2021 18:12:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122ICouP078642; Tue, 2 Mar 2021 18:12:50 GMT (envelope-from git) Date: Tue, 2 Mar 2021 18:12:50 GMT Message-Id: <202103021812.122ICouP078642@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Chris Rees Subject: git: ce94bedf475a - stable/13 - Create dhclient pid directory if it doesn't exist MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: crees X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ce94bedf475ac17307be0d5cbc66a8abe0741bf6 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 Mar 2021 18:12:50 -0000 The branch stable/13 has been updated by crees (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=ce94bedf475ac17307be0d5cbc66a8abe0741bf6 commit ce94bedf475ac17307be0d5cbc66a8abe0741bf6 Author: Chris Rees AuthorDate: 2021-02-21 18:56:56 +0000 Commit: Chris Rees CommitDate: 2021-03-02 18:12:34 +0000 Create dhclient pid directory if it doesn't exist - Upgrading from older FreeBSD versions can result in errors - /var/run can be a tmpfs, and this should be handled correctly Approved by: markj Differential: https://reviews.freebsd.org/D28843 MFC after: 2 weeks --- libexec/rc/rc.d/dhclient | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libexec/rc/rc.d/dhclient b/libexec/rc/rc.d/dhclient index 520a0850ccbc..765e38266408 100755 --- a/libexec/rc/rc.d/dhclient +++ b/libexec/rc/rc.d/dhclient @@ -49,6 +49,11 @@ dhclient_prestart() rc_flags="${rc_flags} -b" fi + + # /var/run/dhclient is not guaranteed to exist, + # e.g. if /var/run is a tmpfs + install -d -o root -g wheel -m 755 ${pidfile%/*} + rc_flags="${rc_flags} ${ifn}" } From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 18:15: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 005EB54AAA3; Tue, 2 Mar 2021 18:15: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 4Dqlg66dP2z4pfg; Tue, 2 Mar 2021 18:15:46 +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 D68971B5AB; Tue, 2 Mar 2021 18:15: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 122IFk3l079227; Tue, 2 Mar 2021 18:15:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122IFk2I079226; Tue, 2 Mar 2021 18:15:46 GMT (envelope-from git) Date: Tue, 2 Mar 2021 18:15:46 GMT Message-Id: <202103021815.122IFk2I079226@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 6f930137ca6d - releng/13.0 - sctp: several fixes and improvements MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 6f930137ca6dac436d10b462a2058b5d9d975c5d 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 Mar 2021 18:15:47 -0000 The branch releng/13.0 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=6f930137ca6dac436d10b462a2058b5d9d975c5d commit 6f930137ca6dac436d10b462a2058b5d9d975c5d Author: Michael Tuexen AuthorDate: 2021-01-23 19:56:45 +0000 Commit: Michael Tuexen CommitDate: 2021-03-02 15:57:23 +0000 sctp: several fixes and improvements Approved by: re (gjb) sctp: improve consistency No functional change intended. (cherry picked from commit 7a051c0a7890dc8e490ebe125bfc70a28e89ddaf) (cherry picked from commit 459f1b906515076b7ce30a06ab69a60891d8cbe8) sctp: fix PR-SCTP stats when adding addtional streams (cherry picked from commit 0f7573ffd6141b19419c9a6238246b9ba0e6dce6) (cherry picked from commit 21398f02b0c7913f815ae6ded426da60d92c635b) sctp: fix a locking issue for old unordered data Thanks to Anatoly Korniltsev for reporting the issue for the userland stack. (cherry picked from commit 8dc6a1edca6de0c64f6c082f69097746d1346592) (cherry picked from commit 3fa95c0fe60bbd67db6043c7e18910387bbe1bac) sctp: improve input validation Improve the handling of INIT chunks in specific szenarios and report and appropriate error cause. Thanks to Anatoly Korniltsev for reporting the issue for the userland stack. (cherry picked from commit af885c57d65d33c0306e91d3e090e76772a0d012) (cherry picked from commit 16b538975024e2b7038807bf5b712124f5a7b889) sctp: small cleanup, no functional change intended. (cherry picked from commit bdd4630c9a9cea64830f981fc897ac953c48892c) (cherry picked from commit 5573b94fa67f954dd0db57de328e60941ee8c9d1) sctp: clear a pointer to a net which will be removed (cherry picked from commit 5ac839029d01c0f48e1b1ff1a599cb47cf5e98ee) (cherry picked from commit 04c13928d9f306a7d7ac34452644a538d2be6fdc) sctp: improve computation of an alternate net Espeially handle the case where the net passed in is about to be deleted and therefore not in the list of nets anymore. Reported by: syzbot+9756917a7c8381adf5e8@syzkaller.appspotmail.com (cherry picked from commit b963ce4588b33f733aef3f7a7f3fbe5018a89728) (cherry picked from commit 8cf046aff9719779b665f7f4f4a8bad4b3945341) sctp: avoid integer overflow when starting the HB timer Reported by: syzbot+14b9d7c3c64208fae62f@syzkaller.appspotmail.com (cherry picked from commit 70e95f0b6917a8b8cd4a2a5f883f3e9753fc86d8) (cherry picked from commit f7c20120c19b6307536908a7f779be2832b133f3) --- sys/netinet/sctp_indata.c | 2 +- sys/netinet/sctp_input.c | 2 +- sys/netinet/sctp_output.c | 127 ++++++++++++++++++++++++++++----------------- sys/netinet/sctp_pcb.c | 4 ++ sys/netinet/sctp_structs.h | 32 ++++++------ sys/netinet/sctp_timer.c | 85 +++++++++++++++++------------- sys/netinet/sctputil.c | 25 +++++---- 7 files changed, 165 insertions(+), 112 deletions(-) diff --git a/sys/netinet/sctp_indata.c b/sys/netinet/sctp_indata.c index 08af27c934fb..6997a0099c88 100644 --- a/sys/netinet/sctp_indata.c +++ b/sys/netinet/sctp_indata.c @@ -803,7 +803,7 @@ restart: } memset(nc, 0, sizeof(struct sctp_queued_to_read)); TAILQ_REMOVE(&control->reasm, chk, sctp_next); - sctp_add_chk_to_control(control, strm, stcb, asoc, chk, SCTP_READ_LOCK_NOT_HELD); + sctp_add_chk_to_control(control, strm, stcb, asoc, chk, inp_read_lock_held); fsn++; cnt_added++; chk = NULL; diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 1606e4d9d1cf..43a2b06d1c79 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -1871,9 +1871,9 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, asoc->strmout[i].abandoned_sent[0] = 0; asoc->strmout[i].abandoned_unsent[0] = 0; #endif - stcb->asoc.strmout[i].sid = i; stcb->asoc.strmout[i].next_mid_ordered = 0; stcb->asoc.strmout[i].next_mid_unordered = 0; + stcb->asoc.strmout[i].sid = i; stcb->asoc.strmout[i].last_msg_incomplete = 0; } TAILQ_FOREACH_SAFE(strrst, &asoc->resetHead, next_resp, nstrrst) { diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index d8cf063c6b53..0f7ade931e61 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -3629,9 +3629,8 @@ sctp_process_cmsgs_for_init(struct sctp_tcb *stcb, struct mbuf *control, int *er } for (i = 0; i < stcb->asoc.streamoutcnt; i++) { TAILQ_INIT(&stcb->asoc.strmout[i].outqueue); + stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], NULL); stcb->asoc.strmout[i].chunks_on_queues = 0; - stcb->asoc.strmout[i].next_mid_ordered = 0; - stcb->asoc.strmout[i].next_mid_unordered = 0; #if defined(SCTP_DETAILED_STR_STATS) for (j = 0; j < SCTP_PR_SCTP_MAX + 1; j++) { stcb->asoc.strmout[i].abandoned_sent[j] = 0; @@ -3641,10 +3640,11 @@ sctp_process_cmsgs_for_init(struct sctp_tcb *stcb, struct mbuf *control, int *er stcb->asoc.strmout[i].abandoned_sent[0] = 0; stcb->asoc.strmout[i].abandoned_unsent[0] = 0; #endif + stcb->asoc.strmout[i].next_mid_ordered = 0; + stcb->asoc.strmout[i].next_mid_unordered = 0; stcb->asoc.strmout[i].sid = i; stcb->asoc.strmout[i].last_msg_incomplete = 0; stcb->asoc.strmout[i].state = SCTP_STREAM_OPENING; - stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], NULL); } } break; @@ -5232,31 +5232,33 @@ invalid_size: return (op_err); } -static int +/* + * Given a INIT chunk, look through the parameters to verify that there + * are no new addresses. + * Return true, if there is a new address or there is a problem parsing + the parameters. Provide an optional error cause used when sending an ABORT. + * Return false, if there are no new addresses and there is no problem in + parameter processing. + */ +static bool sctp_are_there_new_addresses(struct sctp_association *asoc, - struct mbuf *in_initpkt, int offset, struct sockaddr *src) + struct mbuf *in_initpkt, int offset, int limit, struct sockaddr *src, + struct mbuf **op_err) { - /* - * Given a INIT packet, look through the packet to verify that there - * are NO new addresses. As we go through the parameters add reports - * of any un-understood parameters that require an error. Also we - * must return (1) to drop the packet if we see a un-understood - * parameter that tells us to drop the chunk. - */ struct sockaddr *sa_touse; struct sockaddr *sa; struct sctp_paramhdr *phdr, params; - uint16_t ptype, plen; - uint8_t fnd; struct sctp_nets *net; - int check_src; #ifdef INET struct sockaddr_in sin4, *sa4; #endif #ifdef INET6 struct sockaddr_in6 sin6, *sa6; #endif + uint16_t ptype, plen; + bool fnd, check_src; + *op_err = NULL; #ifdef INET memset(&sin4, 0, sizeof(sin4)); sin4.sin_family = AF_INET; @@ -5268,19 +5270,19 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, sin6.sin6_len = sizeof(sin6); #endif /* First what about the src address of the pkt ? */ - check_src = 0; + check_src = false; switch (src->sa_family) { #ifdef INET case AF_INET: if (asoc->scope.ipv4_addr_legal) { - check_src = 1; + check_src = true; } break; #endif #ifdef INET6 case AF_INET6: if (asoc->scope.ipv6_addr_legal) { - check_src = 1; + check_src = true; } break; #endif @@ -5289,7 +5291,7 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, break; } if (check_src) { - fnd = 0; + fnd = false; TAILQ_FOREACH(net, &asoc->nets, sctp_next) { sa = (struct sockaddr *)&net->ro._l_addr; if (sa->sa_family == src->sa_family) { @@ -5300,7 +5302,7 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, sa4 = (struct sockaddr_in *)sa; src4 = (struct sockaddr_in *)src; if (sa4->sin_addr.s_addr == src4->sin_addr.s_addr) { - fnd = 1; + fnd = true; break; } } @@ -5312,16 +5314,22 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, sa6 = (struct sockaddr_in6 *)sa; src6 = (struct sockaddr_in6 *)src; if (SCTP6_ARE_ADDR_EQUAL(sa6, src6)) { - fnd = 1; + fnd = true; break; } } #endif } } - if (fnd == 0) { - /* New address added! no need to look further. */ - return (1); + if (!fnd) { + /* + * If sending an ABORT in case of an additional + * address, don't use the new address error cause. + * This looks no different than if no listener was + * present. + */ + *op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Address added"); + return (true); } } /* Ok so far lets munge through the rest of the packet */ @@ -5331,6 +5339,14 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, sa_touse = NULL; ptype = ntohs(phdr->param_type); plen = ntohs(phdr->param_length); + if (offset + plen > limit) { + *op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, "Partial parameter"); + return (true); + } + if (plen < sizeof(struct sctp_paramhdr)) { + *op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, "Parameter length too small"); + return (true); + } switch (ptype) { #ifdef INET case SCTP_IPV4_ADDRESS: @@ -5338,12 +5354,14 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, struct sctp_ipv4addr_param *p4, p4_buf; if (plen != sizeof(struct sctp_ipv4addr_param)) { - return (1); + *op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, "Parameter length illegal"); + return (true); } phdr = sctp_get_next_param(in_initpkt, offset, (struct sctp_paramhdr *)&p4_buf, sizeof(p4_buf)); if (phdr == NULL) { - return (1); + *op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, ""); + return (true); } if (asoc->scope.ipv4_addr_legal) { p4 = (struct sctp_ipv4addr_param *)phdr; @@ -5359,12 +5377,14 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, struct sctp_ipv6addr_param *p6, p6_buf; if (plen != sizeof(struct sctp_ipv6addr_param)) { - return (1); + *op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, "Parameter length illegal"); + return (true); } phdr = sctp_get_next_param(in_initpkt, offset, (struct sctp_paramhdr *)&p6_buf, sizeof(p6_buf)); if (phdr == NULL) { - return (1); + *op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, ""); + return (true); } if (asoc->scope.ipv6_addr_legal) { p6 = (struct sctp_ipv6addr_param *)phdr; @@ -5381,7 +5401,7 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, } if (sa_touse) { /* ok, sa_touse points to one to check */ - fnd = 0; + fnd = false; TAILQ_FOREACH(net, &asoc->nets, sctp_next) { sa = (struct sockaddr *)&net->ro._l_addr; if (sa->sa_family != sa_touse->sa_family) { @@ -5392,7 +5412,7 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, sa4 = (struct sockaddr_in *)sa; if (sa4->sin_addr.s_addr == sin4.sin_addr.s_addr) { - fnd = 1; + fnd = true; break; } } @@ -5402,21 +5422,31 @@ sctp_are_there_new_addresses(struct sctp_association *asoc, sa6 = (struct sockaddr_in6 *)sa; if (SCTP6_ARE_ADDR_EQUAL( sa6, &sin6)) { - fnd = 1; + fnd = true; break; } } #endif } if (!fnd) { - /* New addr added! no need to look further */ - return (1); + /* + * If sending an ABORT in case of an + * additional address, don't use the new + * address error cause. This looks no + * different than if no listener was + * present. + */ + *op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Address added"); + return (true); } } offset += SCTP_SIZE32(plen); + if (offset >= limit) { + break; + } phdr = sctp_get_next_param(in_initpkt, offset, ¶ms, sizeof(params)); } - return (0); + return (false); } /* @@ -5472,17 +5502,11 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb, } if ((asoc != NULL) && (SCTP_GET_STATE(stcb) != SCTP_STATE_COOKIE_WAIT)) { - if (sctp_are_there_new_addresses(asoc, init_pkt, offset, src)) { + if (sctp_are_there_new_addresses(asoc, init_pkt, offset, offset + ntohs(init_chk->ch.chunk_length), src, &op_err)) { /* * new addresses, out of here in non-cookie-wait * states - * - * Send an ABORT, without the new address error - * cause. This looks no different than if no - * listener was present. */ - op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), - "Address added"); sctp_send_abort(init_pkt, iphlen, src, dst, sh, 0, op_err, mflowtype, mflowid, inp->fibnum, vrf_id, port); @@ -12136,18 +12160,27 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb, stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 0, 1); for (i = 0; i < stcb->asoc.streamoutcnt; i++) { TAILQ_INIT(&stcb->asoc.strmout[i].outqueue); - stcb->asoc.strmout[i].chunks_on_queues = oldstream[i].chunks_on_queues; - stcb->asoc.strmout[i].next_mid_ordered = oldstream[i].next_mid_ordered; - stcb->asoc.strmout[i].next_mid_unordered = oldstream[i].next_mid_unordered; - stcb->asoc.strmout[i].last_msg_incomplete = oldstream[i].last_msg_incomplete; - stcb->asoc.strmout[i].sid = i; - stcb->asoc.strmout[i].state = oldstream[i].state; /* FIX ME FIX ME */ /* * This should be a SS_COPY operation FIX ME STREAM * SCHEDULER EXPERT */ stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], &oldstream[i]); + stcb->asoc.strmout[i].chunks_on_queues = oldstream[i].chunks_on_queues; +#if defined(SCTP_DETAILED_STR_STATS) + for (j = 0; j < SCTP_PR_SCTP_MAX + 1; j++) { + stcb->asoc.strmout[i].abandoned_sent[j] = oldstream[i].abandoned_sent[j]; + stcb->asoc.strmout[i].abandoned_unsent[j] = oldstream[i].abandoned_unsent[j]; + } +#else + stcb->asoc.strmout[i].abandoned_sent[0] = oldstream[i].abandoned_sent[0]; + stcb->asoc.strmout[i].abandoned_unsent[0] = oldstream[i].abandoned_unsent[0]; +#endif + stcb->asoc.strmout[i].next_mid_ordered = oldstream[i].next_mid_ordered; + stcb->asoc.strmout[i].next_mid_unordered = oldstream[i].next_mid_unordered; + stcb->asoc.strmout[i].last_msg_incomplete = oldstream[i].last_msg_incomplete; + stcb->asoc.strmout[i].sid = i; + stcb->asoc.strmout[i].state = oldstream[i].state; /* now anything on those queues? */ TAILQ_FOREACH_SAFE(sp, &oldstream[i].outqueue, next, nsp) { TAILQ_REMOVE(&oldstream[i].outqueue, sp, next); diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 2e082570cfc1..4d09ad3a7353 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -4443,6 +4443,10 @@ out: /* Clear net */ asoc->last_control_chunk_from = NULL; } + if (net == asoc->last_net_cmt_send_started) { + /* Clear net */ + asoc->last_net_cmt_send_started = NULL; + } if (net == stcb->asoc.alternate) { sctp_free_remote_addr(stcb->asoc.alternate); stcb->asoc.alternate = NULL; diff --git a/sys/netinet/sctp_structs.h b/sys/netinet/sctp_structs.h index 52fe30098ad7..a22dac047971 100644 --- a/sys/netinet/sctp_structs.h +++ b/sys/netinet/sctp_structs.h @@ -548,6 +548,20 @@ struct sctp_stream_in { TAILQ_HEAD(sctpwheel_listhead, sctp_stream_out); TAILQ_HEAD(sctplist_listhead, sctp_stream_queue_pending); +/* + * This union holds all data necessary for + * different stream schedulers. + */ +struct scheduling_data { + struct sctp_stream_out *locked_on_sending; + /* circular looking for output selection */ + struct sctp_stream_out *last_out_stream; + union { + struct sctpwheel_listhead wheel; + struct sctplist_listhead list; + } out; +}; + /* Round-robin schedulers */ struct ss_rr { /* next link in wheel */ @@ -570,20 +584,6 @@ struct ss_fb { int32_t rounds; }; -/* - * This union holds all data necessary for - * different stream schedulers. - */ -struct scheduling_data { - struct sctp_stream_out *locked_on_sending; - /* circular looking for output selection */ - struct sctp_stream_out *last_out_stream; - union { - struct sctpwheel_listhead wheel; - struct sctplist_listhead list; - } out; -}; - /* * This union holds all parameters per stream * necessary for different stream schedulers. @@ -601,8 +601,6 @@ union scheduling_parameters { #define SCTP_STREAM_RESET_PENDING 0x03 #define SCTP_STREAM_RESET_IN_FLIGHT 0x04 -#define SCTP_MAX_STREAMS_AT_ONCE_RESET 200 - /* This struct is used to track the traffic on outbound streams */ struct sctp_stream_out { struct sctp_streamhead outqueue; @@ -627,6 +625,8 @@ struct sctp_stream_out { uint8_t state; }; +#define SCTP_MAX_STREAMS_AT_ONCE_RESET 200 + /* used to keep track of the addresses yet to try to add/delete */ TAILQ_HEAD(sctp_asconf_addrhead, sctp_asconf_addr); struct sctp_asconf_addr { diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c index bce1f5cd166d..582abd8e8854 100644 --- a/sys/netinet/sctp_timer.c +++ b/sys/netinet/sctp_timer.c @@ -164,8 +164,8 @@ sctp_threshold_management(struct sctp_inpcb *inp, struct sctp_tcb *stcb, } /* - * sctp_find_alternate_net() returns a non-NULL pointer as long - * the argument net is non-NULL. + * sctp_find_alternate_net() returns a non-NULL pointer as long as there + * exists nets, which are not being deleted. */ struct sctp_nets * sctp_find_alternate_net(struct sctp_tcb *stcb, @@ -174,14 +174,14 @@ sctp_find_alternate_net(struct sctp_tcb *stcb, { /* Find and return an alternate network if possible */ struct sctp_nets *alt, *mnet, *min_errors_net = NULL, *max_cwnd_net = NULL; - int once; + bool looped; /* JRS 5/14/07 - Initialize min_errors to an impossible value. */ int min_errors = -1; uint32_t max_cwnd = 0; if (stcb->asoc.numnets == 1) { - /* No others but net */ + /* No selection can be made. */ return (TAILQ_FIRST(&stcb->asoc.nets)); } /* @@ -328,25 +328,22 @@ sctp_find_alternate_net(struct sctp_tcb *stcb, return (max_cwnd_net); } } - mnet = net; - once = 0; - - if (mnet == NULL) { - mnet = TAILQ_FIRST(&stcb->asoc.nets); - if (mnet == NULL) { - return (NULL); - } + /* Look for an alternate net, which is active. */ + if ((net != NULL) && ((net->dest_state & SCTP_ADDR_BEING_DELETED) == 0)) { + alt = TAILQ_NEXT(net, sctp_next);; + } else { + alt = TAILQ_FIRST(&stcb->asoc.nets); } + looped = false; for (;;) { - alt = TAILQ_NEXT(mnet, sctp_next); if (alt == NULL) { - once++; - if (once > 1) { - break; + if (!looped) { + alt = TAILQ_FIRST(&stcb->asoc.nets); + looped = true; } - alt = TAILQ_FIRST(&stcb->asoc.nets); + /* Definitely out of candidates. */ if (alt == NULL) { - return (NULL); + break; } } if (alt->ro.ro_nh == NULL) { @@ -358,43 +355,59 @@ sctp_find_alternate_net(struct sctp_tcb *stcb, } if (((alt->dest_state & SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE) && (alt->ro.ro_nh != NULL) && - (!(alt->dest_state & SCTP_ADDR_UNCONFIRMED))) { - /* Found a reachable address */ + (!(alt->dest_state & SCTP_ADDR_UNCONFIRMED)) && + (alt != net)) { + /* Found an alternate net, which is reachable. */ break; } - mnet = alt; + alt = TAILQ_NEXT(alt, sctp_next); } if (alt == NULL) { - /* Case where NO insv network exists (dormant state) */ - /* we rotate destinations */ - once = 0; - mnet = net; + /* + * In case no active alternate net has been found, look for + * an alternate net, which is confirmed. + */ + if ((net != NULL) && ((net->dest_state & SCTP_ADDR_BEING_DELETED) == 0)) { + alt = TAILQ_NEXT(net, sctp_next);; + } else { + alt = TAILQ_FIRST(&stcb->asoc.nets); + } + looped = false; for (;;) { - if (mnet == NULL) { - return (TAILQ_FIRST(&stcb->asoc.nets)); - } - alt = TAILQ_NEXT(mnet, sctp_next); if (alt == NULL) { - once++; - if (once > 1) { - break; + if (!looped) { + alt = TAILQ_FIRST(&stcb->asoc.nets); + looped = true; } - alt = TAILQ_FIRST(&stcb->asoc.nets); + /* Definitely out of candidates. */ if (alt == NULL) { break; } } if ((!(alt->dest_state & SCTP_ADDR_UNCONFIRMED)) && (alt != net)) { - /* Found an alternate address */ + /* + * Found an alternate net, which is + * confirmed. + */ break; } - mnet = alt; + alt = TAILQ_NEXT(alt, sctp_next); } } if (alt == NULL) { - return (net); + /* + * In case no confirmed alternate net has been found, just + * return net, if it is not being deleted. In the other case + * just return the first net. + */ + if ((net != NULL) && ((net->dest_state & SCTP_ADDR_BEING_DELETED) == 0)) { + alt = net; + } + if (alt == NULL) { + alt = TAILQ_FIRST(&stcb->asoc.nets); + } } return (alt); } diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 7772ebd57327..7ddb4c3710df 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -1291,9 +1291,8 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, * that were dropped must be notified to the upper layer as * failed to send. */ - asoc->strmout[i].next_mid_ordered = 0; - asoc->strmout[i].next_mid_unordered = 0; TAILQ_INIT(&asoc->strmout[i].outqueue); + asoc->ss_functions.sctp_ss_init_stream(stcb, &asoc->strmout[i], NULL); asoc->strmout[i].chunks_on_queues = 0; #if defined(SCTP_DETAILED_STR_STATS) for (j = 0; j < SCTP_PR_SCTP_MAX + 1; j++) { @@ -1304,10 +1303,11 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, asoc->strmout[i].abandoned_sent[0] = 0; asoc->strmout[i].abandoned_unsent[0] = 0; #endif + asoc->strmout[i].next_mid_ordered = 0; + asoc->strmout[i].next_mid_unordered = 0; asoc->strmout[i].sid = i; asoc->strmout[i].last_msg_incomplete = 0; asoc->strmout[i].state = SCTP_STREAM_OPENING; - asoc->ss_functions.sctp_ss_init_stream(stcb, &asoc->strmout[i], NULL); } asoc->ss_functions.sctp_ss_init(stcb, asoc, 0); @@ -2032,14 +2032,13 @@ sctp_timeout_handler(void *t) sctp_inpcb_free(inp, SCTP_FREE_SHOULD_USE_ABORT, SCTP_CALLED_FROM_INPKILL_TIMER); inp = NULL; - goto out_no_decr; + goto out_decr; case SCTP_TIMER_TYPE_ASOCKILL: KASSERT(inp != NULL && stcb != NULL && net == NULL, ("timeout of type %d: inp = %p, stcb = %p, net = %p", type, inp, stcb, net)); SCTP_STAT_INCR(sctps_timoassockill); /* Can we free it yet? */ - SCTP_INP_DECR_REF(inp); sctp_timer_stop(SCTP_TIMER_TYPE_ASOCKILL, inp, stcb, NULL, SCTP_FROM_SCTPUTIL + SCTP_LOC_1); (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, @@ -2049,7 +2048,7 @@ sctp_timeout_handler(void *t) * duplicate unlock or unlock of a free mtx :-0 */ stcb = NULL; - goto out_no_decr; + goto out_decr; case SCTP_TIMER_TYPE_ADDR_WQ: KASSERT(inp == NULL && stcb == NULL && net == NULL, ("timeout of type %d: inp = %p, stcb = %p, net = %p", @@ -2107,7 +2106,6 @@ out_decr: if (net != NULL) { sctp_free_remote_addr(net); } -out_no_decr: SCTPDBG(SCTP_DEBUG_TIMER2, "Timer type %d handler finished.\n", type); CURVNET_RESTORE(); NET_EPOCH_EXIT(et); @@ -2279,14 +2277,19 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, struct sctp_tcb *stcb, } rndval = sctp_select_initial_TSN(&inp->sctp_ep); jitter = rndval % to_ticks; - if (jitter >= (to_ticks >> 1)) { - to_ticks = to_ticks + (jitter - (to_ticks >> 1)); + to_ticks >>= 1; + if (jitter < (UINT32_MAX - to_ticks)) { + to_ticks += jitter; } else { - to_ticks = to_ticks - jitter; + to_ticks = UINT32_MAX; } if (!(net->dest_state & SCTP_ADDR_UNCONFIRMED) && !(net->dest_state & SCTP_ADDR_PF)) { - to_ticks += net->heart_beat_delay; + if (net->heart_beat_delay < (UINT32_MAX - to_ticks)) { + to_ticks += net->heart_beat_delay; + } else { + to_ticks = UINT32_MAX; + } } /* * Now we must convert the to_ticks that are now in ms to From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 18:43: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 AC0FD54C204; Tue, 2 Mar 2021 18:43: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 4DqmHJ4T33z4tPV; Tue, 2 Mar 2021 18:43: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 8C22E1BC62; Tue, 2 Mar 2021 18:43: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 122IheZk018699; Tue, 2 Mar 2021 18:43:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122Iheaa018698; Tue, 2 Mar 2021 18:43:40 GMT (envelope-from git) Date: Tue, 2 Mar 2021 18:43:40 GMT Message-Id: <202103021843.122Iheaa018698@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Edward Tomasz Napierala Subject: git: e681d7d702d6 - stable/13 - msdosfs: fix double unlock if the source file disappears MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e681d7d702d65f7a44e3bb42e86e7a1784edf847 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 Mar 2021 18:43:40 -0000 The branch stable/13 has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=e681d7d702d65f7a44e3bb42e86e7a1784edf847 commit e681d7d702d65f7a44e3bb42e86e7a1784edf847 Author: Edward Tomasz Napierala AuthorDate: 2021-01-31 21:07:02 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-03-02 18:43:26 +0000 msdosfs: fix double unlock if the source file disappears We would unlock fvp here, only to unlock it again below, just before "bad". Reviewed By: kib Tested by: pho Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D27339 (cherry picked from commit cb696212495995c8374d9fe12fbae340614af45c) --- sys/fs/msdosfs/msdosfs_vnops.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index b940633e0cfd..e1e679d92146 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1139,7 +1139,6 @@ abortit: if (xp != ip) { if (doingdirectory) panic("rename: lost dir entry"); - VOP_UNLOCK(fvp); if (newparent) VOP_UNLOCK(fdvp); vrele(ap->a_fvp); From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 18:43: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 DBDA954C1A7; Tue, 2 Mar 2021 18:43: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 4DqmHK5SBDz4tRV; Tue, 2 Mar 2021 18:43: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 ADE651BB44; Tue, 2 Mar 2021 18:43: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 122IhfiV018718; Tue, 2 Mar 2021 18:43:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122Ihfpn018717; Tue, 2 Mar 2021 18:43:41 GMT (envelope-from git) Date: Tue, 2 Mar 2021 18:43:41 GMT Message-Id: <202103021843.122Ihfpn018717@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Edward Tomasz Napierala Subject: git: f6082ba9d2e0 - stable/13 - msdosfs: fix vnode leak with msdosfs_rename() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f6082ba9d2e0f3ba3cfcbdfdccdf2315e3698b8d 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 Mar 2021 18:43:41 -0000 The branch stable/13 has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=f6082ba9d2e0f3ba3cfcbdfdccdf2315e3698b8d commit f6082ba9d2e0f3ba3cfcbdfdccdf2315e3698b8d Author: Edward Tomasz Napierala AuthorDate: 2021-01-31 21:37:41 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-03-02 18:43:26 +0000 msdosfs: fix vnode leak with msdosfs_rename() This could happen when failing due to disappearing source file. Reviewed By: kib Tested by: pho Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D27338 (cherry picked from commit b8073b3c74342113398f36a1c68f442ae9e092e6) --- sys/fs/msdosfs/msdosfs_vnops.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index e1e679d92146..8885ac856588 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1122,6 +1122,14 @@ abortit: VOP_UNLOCK(tdvp); vrele(tdvp); vrele(ap->a_fvp); + /* + * fdvp may be locked and has a reference. We need to + * release the lock and reference, unless to and from + * directories are the same. In that case it is already + * unlocked. + */ + if (tdvp != fdvp) + vput(fdvp); return 0; } xp = VTODE(fvp); From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 18:43: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 274CC54C06B; Tue, 2 Mar 2021 18:43:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DqmHN0cPLz4tKL; Tue, 2 Mar 2021 18:43: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 F2D4D1BC8A; Tue, 2 Mar 2021 18:43: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 122Ihh2g018762; Tue, 2 Mar 2021 18:43:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122IhhSV018761; Tue, 2 Mar 2021 18:43:43 GMT (envelope-from git) Date: Tue, 2 Mar 2021 18:43:43 GMT Message-Id: <202103021843.122IhhSV018761@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 1b2802ed4ed0 - stable/13 - Use compat.linux.emul_path instead of hardcoded path in /etc/rc.d/linux MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1b2802ed4ed09746d6870080f85d79a9ccd782b0 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 Mar 2021 18:43:45 -0000 The branch stable/13 has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=1b2802ed4ed09746d6870080f85d79a9ccd782b0 commit 1b2802ed4ed09746d6870080f85d79a9ccd782b0 Author: Edward Tomasz Napierala AuthorDate: 2021-02-02 14:40:38 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-03-02 18:43:26 +0000 Use compat.linux.emul_path instead of hardcoded path in /etc/rc.d/linux In /etc/rc.d/linux the mounting paths of procfs, sysfs and devfs are hardcoded to "/compat/linux". Switching to the content of compat.linux.emul_path sysctl would allow to switch linuxulator to different place. Submitted by: freebsdnewbie_freenet.de Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27807 (cherry picked from commit e40787f900f3c262d5134d342e5a16757dd2193c) --- libexec/rc/rc.d/linux | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libexec/rc/rc.d/linux b/libexec/rc/rc.d/linux index 4fe9cee6e751..4381b62cc660 100755 --- a/libexec/rc/rc.d/linux +++ b/libexec/rc/rc.d/linux @@ -18,6 +18,7 @@ stop_cmd=":" linux_start() { local _emul_path _tmpdir + _emul_path="$(sysctl -n compat.linux.emul_path)" load_kld -e 'linux(aout|elf)' linux case `sysctl -n hw.machine_arch` in @@ -25,11 +26,11 @@ linux_start() load_kld -e 'linux64elf' linux64 ;; esac - if [ -x /compat/linux/sbin/ldconfigDisabled ]; then + if [ -x ${_emul_path}/sbin/ldconfigDisabled ]; then _tmpdir=`mktemp -d -t linux-ldconfig` - /compat/linux/sbin/ldconfig -C ${_tmpdir}/ld.so.cache - if ! cmp -s ${_tmpdir}/ld.so.cache /compat/linux/etc/ld.so.cache; then - cat ${_tmpdir}/ld.so.cache > /compat/linux/etc/ld.so.cache + ${_emul_path}/sbin/ldconfig -C ${_tmpdir}/ld.so.cache + if ! cmp -s ${_tmpdir}/ld.so.cache ${_emul_path}/etc/ld.so.cache; then + cat ${_tmpdir}/ld.so.cache > ${_emul_path}/etc/ld.so.cache fi rm -rf ${_tmpdir} fi @@ -47,7 +48,6 @@ linux_start() fi if checkyesno linux_mounts_enable; then - _emul_path="/compat/linux" mount -o nocover -t linprocfs linprocfs "${_emul_path}/proc" mount -o nocover -t linsysfs linsysfs "${_emul_path}/sys" mount -o nocover -t devfs devfs "${_emul_path}/dev" From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 18:43: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 1C6CA54BE5F; Tue, 2 Mar 2021 18:43:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DqmHM0ngTz4tPf; Tue, 2 Mar 2021 18:43: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 EA4861BC63; Tue, 2 Mar 2021 18:43: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 122IhgGt018740; Tue, 2 Mar 2021 18:43:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122IhgMb018739; Tue, 2 Mar 2021 18:43:42 GMT (envelope-from git) Date: Tue, 2 Mar 2021 18:43:42 GMT Message-Id: <202103021843.122IhgMb018739@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Edward Tomasz Napierala Subject: git: a3576b620707 - stable/13 - libc: fix buffer overrun in getrpcport(3) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a3576b6207074ba5182be253c26af72f8fb51759 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 Mar 2021 18:43:45 -0000 The branch stable/13 has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=a3576b6207074ba5182be253c26af72f8fb51759 commit a3576b6207074ba5182be253c26af72f8fb51759 Author: Edward Tomasz Napierala AuthorDate: 2021-01-31 21:41:55 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-03-02 18:43:26 +0000 libc: fix buffer overrun in getrpcport(3) Reviewed By: markj Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D27332 (cherry picked from commit 5299d64b2b9f7a25e423ef1785d9402a0ef198d3) --- lib/libc/rpc/getrpcport.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/libc/rpc/getrpcport.c b/lib/libc/rpc/getrpcport.c index 2b2d459c8887..4abc9a0c16af 100644 --- a/lib/libc/rpc/getrpcport.c +++ b/lib/libc/rpc/getrpcport.c @@ -62,14 +62,14 @@ getrpcport(char *host, int prognum, int versnum, int proto) assert(host != NULL); - if ((hp = gethostbyname(host)) == NULL) + if ((hp = gethostbyname2(host, AF_INET)) == NULL) return (0); memset(&addr, 0, sizeof(addr)); addr.sin_len = sizeof(struct sockaddr_in); addr.sin_family = AF_INET; addr.sin_port = 0; - if (hp->h_length > addr.sin_len) - hp->h_length = addr.sin_len; + if (hp->h_length > sizeof(addr.sin_addr.s_addr)) + hp->h_length = sizeof(addr.sin_addr.s_addr); memcpy(&addr.sin_addr.s_addr, hp->h_addr, (size_t)hp->h_length); /* Inconsistent interfaces need casts! :-( */ return (pmap_getport(&addr, (u_long)prognum, (u_long)versnum, From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 18: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 1A89154C131; Tue, 2 Mar 2021 18: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 4DqmHP3qrwz4tPx; Tue, 2 Mar 2021 18:43: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 273E01BA78; Tue, 2 Mar 2021 18:43: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 122Ihikn018780; Tue, 2 Mar 2021 18:43:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122Ihit4018779; Tue, 2 Mar 2021 18:43:44 GMT (envelope-from git) Date: Tue, 2 Mar 2021 18:43:44 GMT Message-Id: <202103021843.122Ihit4018779@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 5dc2e1bcf41f - stable/13 - Don't check compat.linux.emul_path before loading linux(4) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5dc2e1bcf41f853b31b6d08a5c2d643408e890f3 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 Mar 2021 18:43:48 -0000 The branch stable/13 has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=5dc2e1bcf41f853b31b6d08a5c2d643408e890f3 commit 5dc2e1bcf41f853b31b6d08a5c2d643408e890f3 Author: Edward Tomasz Napierala AuthorDate: 2021-02-08 21:52:31 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-03-02 18:43:26 +0000 Don't check compat.linux.emul_path before loading linux(4) Fix e40787f900f to make libexec/rc/rc.d/linux retrieve the sysctl after loading the kernel module which provides it, not before. Reported By: jkim Sponsored By: The FreeBSD Foundation (cherry picked from commit 07cac176fba947381c8111b8e02e8067e7fa542a) --- libexec/rc/rc.d/linux | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/linux b/libexec/rc/rc.d/linux index 4381b62cc660..f44a9d02fc8d 100755 --- a/libexec/rc/rc.d/linux +++ b/libexec/rc/rc.d/linux @@ -18,7 +18,6 @@ stop_cmd=":" linux_start() { local _emul_path _tmpdir - _emul_path="$(sysctl -n compat.linux.emul_path)" load_kld -e 'linux(aout|elf)' linux case `sysctl -n hw.machine_arch` in @@ -26,6 +25,9 @@ linux_start() load_kld -e 'linux64elf' linux64 ;; esac + + _emul_path="$(sysctl -n compat.linux.emul_path)" + if [ -x ${_emul_path}/sbin/ldconfigDisabled ]; then _tmpdir=`mktemp -d -t linux-ldconfig` ${_emul_path}/sbin/ldconfig -C ${_tmpdir}/ld.so.cache From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 18:43: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 3BED354BEDE; Tue, 2 Mar 2021 18:43: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 4DqmHQ74gFz4tQ6; Tue, 2 Mar 2021 18:43:46 +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 60FF41BB45; Tue, 2 Mar 2021 18:43: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 122IhknT018802; Tue, 2 Mar 2021 18:43:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122IhkJY018801; Tue, 2 Mar 2021 18:43:46 GMT (envelope-from git) Date: Tue, 2 Mar 2021 18:43:46 GMT Message-Id: <202103021843.122IhkJY018801@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 9d930fb09072 - stable/13 - linux: fix handling of flags for 32 bit send(2) syscall MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9d930fb09072d21464288df8c834cb8d0b760073 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 Mar 2021 18:43:50 -0000 The branch stable/13 has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=9d930fb09072d21464288df8c834cb8d0b760073 commit 9d930fb09072d21464288df8c834cb8d0b760073 Author: Edward Tomasz Napierala AuthorDate: 2021-02-05 17:24:23 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-03-02 18:43:27 +0000 linux: fix handling of flags for 32 bit send(2) syscall Previously the flags were passed as-is, which could resulted in spurious EAGAIN returned for non-blocking sockets, which broke some Steam games. PR: 248065 Reported By: Alex S Tested By: Alex S Reviewed By: emaste MFC After: 3 days Sponsored By: The FreeBSD Foundation (cherry picked from commit f6e8256a965d5b7a7d43034ea31b2430a3b51066) --- sys/compat/linux/linux_socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 5bfcdbb8fd21..c723af9dfba0 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -1178,7 +1178,7 @@ linux_send(struct thread *td, struct linux_send_args *args) bsd_args.s = args->s; bsd_args.buf = (caddr_t)PTRIN(args->msg); bsd_args.len = args->len; - bsd_args.flags = args->flags; + bsd_args.flags = linux_to_bsd_msg_flags(args->flags); bsd_args.to = NULL; bsd_args.tolen = 0; error = sys_sendto(td, &bsd_args); From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 18:43: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 E1C8554BEF4; Tue, 2 Mar 2021 18:43: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 4DqmHT4ggjz4tVZ; Tue, 2 Mar 2021 18:43: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 8F23A1B6DB; Tue, 2 Mar 2021 18:43: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 122IhlZO018824; Tue, 2 Mar 2021 18:43:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122IhlBs018823; Tue, 2 Mar 2021 18:43:47 GMT (envelope-from git) Date: Tue, 2 Mar 2021 18:43:47 GMT Message-Id: <202103021843.122IhlBs018823@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 47d6ee406e03 - stable/13 - linux: add support for SO_PEERSEC getsockopt MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 47d6ee406e03061be2e8c333e1931531bb074a9e 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 Mar 2021 18:43:52 -0000 The branch stable/13 has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=47d6ee406e03061be2e8c333e1931531bb074a9e commit 47d6ee406e03061be2e8c333e1931531bb074a9e Author: Edward Tomasz Napierala AuthorDate: 2021-02-07 20:28:35 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-03-02 18:43:27 +0000 linux: add support for SO_PEERSEC getsockopt It returns "unconfined", like Linux without SELinux would. Sponsored By: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28164 (cherry picked from commit e44a78ce6f249f1eb7df94cb6953698953ebd88b) --- sys/compat/linux/linux_socket.c | 26 ++++++++++++++++++++++++++ sys/compat/linux/linux_socket.h | 1 + 2 files changed, 27 insertions(+) diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index c723af9dfba0..a4c5bf0b581e 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -82,6 +82,8 @@ __FBSDID("$FreeBSD$"); #include #include +#define SECURITY_CONTEXT_STRING "unconfined" + static int linux_sendmsg_common(struct thread *, l_int, struct l_msghdr *, l_uint); static int linux_recvmsg_common(struct thread *, l_int, struct l_msghdr *, @@ -1861,6 +1863,28 @@ linux_setsockopt(struct thread *td, struct linux_setsockopt_args *args) return (error); } +static int +linux_getsockopt_so_peersec(struct thread *td, + struct linux_getsockopt_args *args) +{ + socklen_t len; + int error; + + len = sizeof(SECURITY_CONTEXT_STRING); + if (args->optlen < len) { + error = copyout(&len, PTRIN(args->optlen), sizeof(len)); + if (error == 0) + error = ERANGE; + return (error); + } + + error = copyout(SECURITY_CONTEXT_STRING, + PTRIN(args->optval), sizeof(SECURITY_CONTEXT_STRING)); + if (error == 0) + error = copyout(&len, PTRIN(args->optlen), sizeof(len)); + return (error); +} + int linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args) { @@ -1875,6 +1899,8 @@ linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args) level = linux_to_bsd_sockopt_level(args->level); switch (level) { case SOL_SOCKET: + if (args->optname == LINUX_SO_PEERSEC) + return (linux_getsockopt_so_peersec(td, args)); name = linux_to_bsd_so_sockopt(args->optname); switch (name) { case LOCAL_CREDS_PERSISTENT: diff --git a/sys/compat/linux/linux_socket.h b/sys/compat/linux/linux_socket.h index 5ebd6392264b..32a19a348312 100644 --- a/sys/compat/linux/linux_socket.h +++ b/sys/compat/linux/linux_socket.h @@ -195,6 +195,7 @@ int linux_accept(struct thread *td, struct linux_accept_args *args); #endif #define LINUX_SO_TIMESTAMP 29 #define LINUX_SO_ACCEPTCONN 30 +#define LINUX_SO_PEERSEC 31 #define LINUX_SO_SNDBUFFORCE 32 #define LINUX_SO_RCVBUFFORCE 33 #define LINUX_SO_PROTOCOL 38 From owner-dev-commits-src-branches@freebsd.org Tue Mar 2 19:16: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 7D78254D3C4; Tue, 2 Mar 2021 19:16: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 4Dqn1037jMz3Dc7; Tue, 2 Mar 2021 19:16: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 59D511BDD7; Tue, 2 Mar 2021 19:16: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 122JGKnI059467; Tue, 2 Mar 2021 19:16:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 122JGKDv059466; Tue, 2 Mar 2021 19:16:20 GMT (envelope-from git) Date: Tue, 2 Mar 2021 19:16:20 GMT Message-Id: <202103021916.122JGKDv059466@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Chris Rees Subject: git: 945184b92f65 - releng/13.0 - Create dhclient pid directory if it doesn't exist MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: crees X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 945184b92f654e50692a42e58b477f9c473b948d 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 Mar 2021 19:16:20 -0000 The branch releng/13.0 has been updated by crees (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=945184b92f654e50692a42e58b477f9c473b948d commit 945184b92f654e50692a42e58b477f9c473b948d Author: Chris Rees AuthorDate: 2021-02-21 18:56:56 +0000 Commit: Chris Rees CommitDate: 2021-03-02 19:16:06 +0000 Create dhclient pid directory if it doesn't exist - Upgrading from older FreeBSD versions can result in errors - /var/run can be a tmpfs, and this should be handled correctly Approved by: re (gjb) Approved by: markj Differential: https://reviews.freebsd.org/D28843 MFC after: 2 weeks (cherry picked from commit ce94bedf475ac17307be0d5cbc66a8abe0741bf6) --- libexec/rc/rc.d/dhclient | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libexec/rc/rc.d/dhclient b/libexec/rc/rc.d/dhclient index 520a0850ccbc..765e38266408 100755 --- a/libexec/rc/rc.d/dhclient +++ b/libexec/rc/rc.d/dhclient @@ -49,6 +49,11 @@ dhclient_prestart() rc_flags="${rc_flags} -b" fi + + # /var/run/dhclient is not guaranteed to exist, + # e.g. if /var/run is a tmpfs + install -d -o root -g wheel -m 755 ${pidfile%/*} + rc_flags="${rc_flags} ${ifn}" } From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 00:35: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 7B72A557193; Wed, 3 Mar 2021 00:35:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dqw552GvWz3rsR; Wed, 3 Mar 2021 00:35: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 410781FDF9; Wed, 3 Mar 2021 00:35: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 1230ZLb2080686; Wed, 3 Mar 2021 00:35:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1230ZLDe080685; Wed, 3 Mar 2021 00:35:21 GMT (envelope-from git) Date: Wed, 3 Mar 2021 00:35:21 GMT Message-Id: <202103030035.1230ZLDe080685@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: 68b5d0bea6d2 - stable/11 - rmlock: Add a required compiler membar to the rlock slow path 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/11 X-Git-Reftype: branch X-Git-Commit: 68b5d0bea6d244093e1923ddf350dff1b5a1ebe9 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 Mar 2021 00:35:21 -0000 The branch stable/11 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=68b5d0bea6d244093e1923ddf350dff1b5a1ebe9 commit 68b5d0bea6d244093e1923ddf350dff1b5a1ebe9 Author: Mark Johnston AuthorDate: 2021-02-24 02:15:50 +0000 Commit: Mark Johnston CommitDate: 2021-03-03 00:34:34 +0000 rmlock: Add a required compiler membar to the rlock slow path The tracker flags need to be loaded only after the tracker is removed from its per-CPU queue. Otherwise, readers may fail to synchronize with pending writers attempting to propagate priority to active readers, and readers and writers deadlock on each other. This was observed in a stable/12-based armv7 kernel where the compiler had reordered the load of rmp_flags to before the stores updating the queue. Reviewed by: rlibby, scottl Discussed with: kib Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D28821 (cherry picked from commit 1d44514fcd68809cfd493a7352ace29ddad443d6) --- sys/kern/kern_rmlock.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c index c7661bc30cb3..a630f3b0acb5 100644 --- a/sys/kern/kern_rmlock.c +++ b/sys/kern/kern_rmlock.c @@ -359,7 +359,11 @@ _rm_rlock_hard(struct rmlock *rm, struct rm_priotracker *tracker, int trylock) /* Remove our tracker from the per-cpu list. */ rm_tracker_remove(pc, tracker); - /* Check to see if the IPI granted us the lock after all. */ + /* + * Check to see if the IPI granted us the lock after all. The load of + * rmp_flags must happen after the tracker is removed from the list. + */ + __compiler_membar(); if (tracker->rmp_flags) { /* Just add back tracker - we hold the lock. */ rm_tracker_add(pc, tracker); From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 00:35: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 06D46557194; Wed, 3 Mar 2021 00:35: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 4Dqw586mQbz3rbq; Wed, 3 Mar 2021 00:35:24 +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 DA1551FEDD; Wed, 3 Mar 2021 00:35:24 +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 1230ZOlp080801; Wed, 3 Mar 2021 00:35:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1230ZO6f080800; Wed, 3 Mar 2021 00:35:24 GMT (envelope-from git) Date: Wed, 3 Mar 2021 00:35:24 GMT Message-Id: <202103030035.1230ZO6f080800@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: 2655a711df3c - stable/12 - rmlock: Add a required compiler membar to the rlock slow path 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: 2655a711df3cc525d054dd372e67b7803ea2acfa 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 Mar 2021 00:35:25 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2655a711df3cc525d054dd372e67b7803ea2acfa commit 2655a711df3cc525d054dd372e67b7803ea2acfa Author: Mark Johnston AuthorDate: 2021-02-24 02:15:50 +0000 Commit: Mark Johnston CommitDate: 2021-03-03 00:34:22 +0000 rmlock: Add a required compiler membar to the rlock slow path The tracker flags need to be loaded only after the tracker is removed from its per-CPU queue. Otherwise, readers may fail to synchronize with pending writers attempting to propagate priority to active readers, and readers and writers deadlock on each other. This was observed in a stable/12-based armv7 kernel where the compiler had reordered the load of rmp_flags to before the stores updating the queue. Reviewed by: rlibby, scottl Discussed with: kib Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D28821 (cherry picked from commit 1d44514fcd68809cfd493a7352ace29ddad443d6) --- sys/kern/kern_rmlock.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c index 5cb18fbfa582..de2a5818c5bf 100644 --- a/sys/kern/kern_rmlock.c +++ b/sys/kern/kern_rmlock.c @@ -361,7 +361,11 @@ _rm_rlock_hard(struct rmlock *rm, struct rm_priotracker *tracker, int trylock) /* Remove our tracker from the per-cpu list. */ rm_tracker_remove(pc, tracker); - /* Check to see if the IPI granted us the lock after all. */ + /* + * Check to see if the IPI granted us the lock after all. The load of + * rmp_flags must happen after the tracker is removed from the list. + */ + __compiler_membar(); if (tracker->rmp_flags) { /* Just add back tracker - we hold the lock. */ rm_tracker_add(pc, tracker); From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 00:35: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 34C5F5570B2; Wed, 3 Mar 2021 00:35: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 4Dqw5F35Ghz3rf2; Wed, 3 Mar 2021 00:35:29 +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 322AE202E8; Wed, 3 Mar 2021 00:35:29 +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 1230ZTgN080915; Wed, 3 Mar 2021 00:35:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1230ZT98080914; Wed, 3 Mar 2021 00:35:29 GMT (envelope-from git) Date: Wed, 3 Mar 2021 00:35:29 GMT Message-Id: <202103030035.1230ZT98080914@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: c29d3ecdc8b3 - stable/13 - rmlock: Add a required compiler membar to the rlock slow path 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: c29d3ecdc8b3903d812c0467319ced6f85872d0e 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 Mar 2021 00:35:31 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c29d3ecdc8b3903d812c0467319ced6f85872d0e commit c29d3ecdc8b3903d812c0467319ced6f85872d0e Author: Mark Johnston AuthorDate: 2021-02-24 02:15:50 +0000 Commit: Mark Johnston CommitDate: 2021-03-03 00:34:11 +0000 rmlock: Add a required compiler membar to the rlock slow path The tracker flags need to be loaded only after the tracker is removed from its per-CPU queue. Otherwise, readers may fail to synchronize with pending writers attempting to propagate priority to active readers, and readers and writers deadlock on each other. This was observed in a stable/12-based armv7 kernel where the compiler had reordered the load of rmp_flags to before the stores updating the queue. Reviewed by: rlibby, scottl Discussed with: kib Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D28821 (cherry picked from commit 1d44514fcd68809cfd493a7352ace29ddad443d6) --- sys/kern/kern_rmlock.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c index 401445d3d03f..9135709d88cf 100644 --- a/sys/kern/kern_rmlock.c +++ b/sys/kern/kern_rmlock.c @@ -362,7 +362,11 @@ _rm_rlock_hard(struct rmlock *rm, struct rm_priotracker *tracker, int trylock) /* Remove our tracker from the per-cpu list. */ rm_tracker_remove(pc, tracker); - /* Check to see if the IPI granted us the lock after all. */ + /* + * Check to see if the IPI granted us the lock after all. The load of + * rmp_flags must happen after the tracker is removed from the list. + */ + __compiler_membar(); if (tracker->rmp_flags) { /* Just add back tracker - we hold the lock. */ rm_tracker_add(pc, tracker); From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 01:19: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 3CDB65582BD; Wed, 3 Mar 2021 01:19: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 4Dqx4H1GLrz3v85; Wed, 3 Mar 2021 01:19: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 1E41220E85; Wed, 3 Mar 2021 01:19: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 1231Jh3g034768; Wed, 3 Mar 2021 01:19:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1231Jhna034767; Wed, 3 Mar 2021 01:19:43 GMT (envelope-from git) Date: Wed, 3 Mar 2021 01:19:43 GMT Message-Id: <202103030119.1231Jhna034767@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: 20f9e2a723f5 - releng/13.0 - rmlock: Add a required compiler membar to the rlock slow path MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 20f9e2a723f5f560d6219e28f36dd3b8f8561b3a 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 Mar 2021 01:19:43 -0000 The branch releng/13.0 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=20f9e2a723f5f560d6219e28f36dd3b8f8561b3a commit 20f9e2a723f5f560d6219e28f36dd3b8f8561b3a Author: Mark Johnston AuthorDate: 2021-02-24 02:15:50 +0000 Commit: Mark Johnston CommitDate: 2021-03-03 01:16:54 +0000 rmlock: Add a required compiler membar to the rlock slow path The tracker flags need to be loaded only after the tracker is removed from its per-CPU queue. Otherwise, readers may fail to synchronize with pending writers attempting to propagate priority to active readers, and readers and writers deadlock on each other. This was observed in a stable/12-based armv7 kernel where the compiler had reordered the load of rmp_flags to before the stores updating the queue. Approved by: re (gjb) Reviewed by: rlibby, scottl Discussed with: kib Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D28821 (cherry picked from commit 1d44514fcd68809cfd493a7352ace29ddad443d6) (cherry picked from commit c29d3ecdc8b3903d812c0467319ced6f85872d0e) --- sys/kern/kern_rmlock.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c index 401445d3d03f..9135709d88cf 100644 --- a/sys/kern/kern_rmlock.c +++ b/sys/kern/kern_rmlock.c @@ -362,7 +362,11 @@ _rm_rlock_hard(struct rmlock *rm, struct rm_priotracker *tracker, int trylock) /* Remove our tracker from the per-cpu list. */ rm_tracker_remove(pc, tracker); - /* Check to see if the IPI granted us the lock after all. */ + /* + * Check to see if the IPI granted us the lock after all. The load of + * rmp_flags must happen after the tracker is removed from the list. + */ + __compiler_membar(); if (tracker->rmp_flags) { /* Just add back tracker - we hold the lock. */ rm_tracker_add(pc, tracker); From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 02:00: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 999FA5593AE; Wed, 3 Mar 2021 02:00: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 4Dqxzh35qBz4SJs; Wed, 3 Mar 2021 02:00: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 5D88721700; Wed, 3 Mar 2021 02:00: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 12320mDI096500; Wed, 3 Mar 2021 02:00:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12320mCi096499; Wed, 3 Mar 2021 02:00:48 GMT (envelope-from git) Date: Wed, 3 Mar 2021 02:00:48 GMT Message-Id: <202103030200.12320mCi096499@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: f08e17c8a251 - stable/13 - zfs: fix overly broad locking in spa_vdev_config_exit() 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: f08e17c8a251210b58d63b52bfe1a77dccff6e78 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 Mar 2021 02:00:48 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=f08e17c8a251210b58d63b52bfe1a77dccff6e78 commit f08e17c8a251210b58d63b52bfe1a77dccff6e78 Author: Martin Matuska AuthorDate: 2021-03-03 01:25:03 +0000 Commit: Martin Matuska CommitDate: 2021-03-03 01:25:03 +0000 zfs: fix overly broad locking in spa_vdev_config_exit() Resolves a deadlock which can occur when the ZED or zpool command attaches a new device. From the openzfs 75a089ed3 commit message: Calling vdev_free() only requires the we acquire the spa config SCL_STATE_ALL locks, not the SCL_ALL locks. In particular, we need need to avoid taking the SCL_CONFIG lock (included in SCL_ALL) as a writer since this can lead to a deadlock. The txg_sync_thread() may block in spa_txg_history_init_io() when taking the SCL_CONFIG lock as a reading when it detects there's a pending writer. Obtained from: openzfs/zfs@75a089ed34befb8d11df9be92a4438cc49554bf6 MFS after: 3 days (direct commit) --- sys/contrib/openzfs/module/zfs/spa_misc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/contrib/openzfs/module/zfs/spa_misc.c b/sys/contrib/openzfs/module/zfs/spa_misc.c index f49be8eec01a..f11ec0f60574 100644 --- a/sys/contrib/openzfs/module/zfs/spa_misc.c +++ b/sys/contrib/openzfs/module/zfs/spa_misc.c @@ -1275,9 +1275,9 @@ spa_vdev_config_exit(spa_t *spa, vdev_t *vd, uint64_t txg, int error, char *tag) */ vdev_autotrim_stop_wait(vd); - spa_config_enter(spa, SCL_ALL, spa, RW_WRITER); + spa_config_enter(spa, SCL_STATE_ALL, spa, RW_WRITER); vdev_free(vd); - spa_config_exit(spa, SCL_ALL, spa); + spa_config_exit(spa, SCL_STATE_ALL, spa); } /* From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 02:01: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 6752F5594B8; Wed, 3 Mar 2021 02:01: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 4Dqy0C2LFJz4SfP; Wed, 3 Mar 2021 02:01: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 968002184D; Wed, 3 Mar 2021 02:01: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 12321Dxc096670; Wed, 3 Mar 2021 02:01:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12321DdU096669; Wed, 3 Mar 2021 02:01:13 GMT (envelope-from git) Date: Wed, 3 Mar 2021 02:01:13 GMT Message-Id: <202103030201.12321DdU096669@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: c70690631443 - stable/13 - zfs: fix vdev_rebuild_thread deadlock 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: c7069063144395b025c0ef178431eb2cafdbe1ca 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 Mar 2021 02:01:15 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=c7069063144395b025c0ef178431eb2cafdbe1ca commit c7069063144395b025c0ef178431eb2cafdbe1ca Author: Martin Matuska AuthorDate: 2021-03-03 01:28:56 +0000 Commit: Martin Matuska CommitDate: 2021-03-03 01:28:56 +0000 zfs: fix vdev_rebuild_thread deadlock From the openzfs 8e43fa12c commit message: The metaslab_disable() call may block waiting for a txg sync. Therefore it's important that vdev_rebuild_thread release the SCL_CONFIG read lock it is holding before this call. Failure to do so can result in the txg_sync thread getting blocked waiting for this lock which results in a deadlock. Obtained from: openzfs/zfs@8e43fa12c571878f32119122771888ab9092a75a MFS after: 3 days (direct commit) --- sys/contrib/openzfs/module/zfs/vdev_rebuild.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/contrib/openzfs/module/zfs/vdev_rebuild.c b/sys/contrib/openzfs/module/zfs/vdev_rebuild.c index 784d1af15a81..112c04d0ba04 100644 --- a/sys/contrib/openzfs/module/zfs/vdev_rebuild.c +++ b/sys/contrib/openzfs/module/zfs/vdev_rebuild.c @@ -804,8 +804,8 @@ vdev_rebuild_thread(void *arg) ASSERT0(range_tree_space(vr->vr_scan_tree)); /* Disable any new allocations to this metaslab */ - metaslab_disable(msp); spa_config_exit(spa, SCL_CONFIG, FTAG); + metaslab_disable(msp); mutex_enter(&msp->ms_sync_lock); mutex_enter(&msp->ms_lock); From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 02:01: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 9F667559263; Wed, 3 Mar 2021 02:01: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 4Dqy0S3sw4z4T07; Wed, 3 Mar 2021 02:01: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 4263E21902; Wed, 3 Mar 2021 02:01:27 +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 12321RJZ097507; Wed, 3 Mar 2021 02:01:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12321R8h097506; Wed, 3 Mar 2021 02:01:27 GMT (envelope-from git) Date: Wed, 3 Mar 2021 02:01:27 GMT Message-Id: <202103030201.12321R8h097506@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: 19049a2b2bd7 - stable/13 - zfs: fix assert in FreeBSD-specific dmu_read_pages 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: 19049a2b2bd7119ef7b34102513f6bbfdf9ff862 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 Mar 2021 02:01:28 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=19049a2b2bd7119ef7b34102513f6bbfdf9ff862 commit 19049a2b2bd7119ef7b34102513f6bbfdf9ff862 Author: Martin Matuska AuthorDate: 2021-03-03 01:32:59 +0000 Commit: Martin Matuska CommitDate: 2021-03-03 01:32:59 +0000 zfs: fix assert in FreeBSD-specific dmu_read_pages From the openzfs 2e160dee9 commit message: The function has three similar pieces of code: for read-behind pages, requested pages and read-ahead pages. All three pieces had an assert to ensure that the page is not mapped. Later the assert was relaxed to require that the page is not mapped for writing. But that was done in two places out of three. This change fixes the third piece, read-ahead. Obtained from: openzfs/zfs@2e160dee97a4badbc318561f76ea56451c916d2f MFS after: 3 days (direct commit) --- sys/contrib/openzfs/module/os/freebsd/zfs/dmu_os.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/dmu_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/dmu_os.c index 8e412d9c1359..fb8f560316ea 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/dmu_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/dmu_os.c @@ -319,7 +319,7 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_t *ma, int count, break; } ASSERT(m->dirty == 0); - ASSERT(!pmap_page_is_mapped(m)); + ASSERT(!pmap_page_is_write_mapped(m)); ASSERT(db->db_size > PAGE_SIZE); bufoff = IDX_TO_OFF(m->pindex) % db->db_size; From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 02:01: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 E8412559794; Wed, 3 Mar 2021 02:01: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 4Dqy0m6GpLz4T14; Wed, 3 Mar 2021 02:01: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 CA026210E0; Wed, 3 Mar 2021 02:01: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 12321ioF097651; Wed, 3 Mar 2021 02:01:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12321i4I097650; Wed, 3 Mar 2021 02:01:44 GMT (envelope-from git) Date: Wed, 3 Mar 2021 02:01:44 GMT Message-Id: <202103030201.12321i4I097650@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: dc2743434f6c - stable/13 - zfs: cancel TRIM or initialize on FAULTED non-writeable vdevs 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: dc2743434f6cc73ca8ec1d551aba03a678eac804 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 Mar 2021 02:01:45 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=dc2743434f6cc73ca8ec1d551aba03a678eac804 commit dc2743434f6cc73ca8ec1d551aba03a678eac804 Author: Martin Matuska AuthorDate: 2021-03-03 01:38:09 +0000 Commit: Martin Matuska CommitDate: 2021-03-03 01:38:09 +0000 zfs: cancel TRIM or initialize on FAULTED non-writeable vdevs From the openzfs commit message: When a device which is actively trimming or initializing becomes FAULTED, and therefore no longer writable, cancel the active TRIM or initialization. When the device is merely taken offline with `zpool offline` then stop the operation but do not cancel it. When the device is brought back online the operation will be resumed if possible. Obtained from: openzfs/zfs@bedbc13daa6dfe9e0221bfadb8d8db2378deaacc MFS after: 3 days (direct commit) --- sys/contrib/openzfs/module/zfs/vdev_initialize.c | 10 +++- sys/contrib/openzfs/module/zfs/vdev_trim.c | 15 ++++-- sys/contrib/openzfs/tests/runfiles/common.run | 2 + .../cli_root/zpool_initialize/Makefile.am | 1 + ...zpool_initialize_fault_export_import_online.ksh | 59 ++++++++++++++++++++ .../functional/cli_root/zpool_trim/Makefile.am | 1 + .../zpool_trim_fault_export_import_online.ksh | 62 ++++++++++++++++++++++ 7 files changed, 144 insertions(+), 6 deletions(-) diff --git a/sys/contrib/openzfs/module/zfs/vdev_initialize.c b/sys/contrib/openzfs/module/zfs/vdev_initialize.c index 083ad2861b5b..e9156c32f384 100644 --- a/sys/contrib/openzfs/module/zfs/vdev_initialize.c +++ b/sys/contrib/openzfs/module/zfs/vdev_initialize.c @@ -553,8 +553,14 @@ vdev_initialize_thread(void *arg) vd->vdev_initialize_tree = NULL; mutex_enter(&vd->vdev_initialize_lock); - if (!vd->vdev_initialize_exit_wanted && vdev_writeable(vd)) { - vdev_initialize_change_state(vd, VDEV_INITIALIZE_COMPLETE); + if (!vd->vdev_initialize_exit_wanted) { + if (vdev_writeable(vd)) { + vdev_initialize_change_state(vd, + VDEV_INITIALIZE_COMPLETE); + } else if (vd->vdev_faulted) { + vdev_initialize_change_state(vd, + VDEV_INITIALIZE_CANCELED); + } } ASSERT(vd->vdev_initialize_thread != NULL || vd->vdev_initialize_inflight == 0); diff --git a/sys/contrib/openzfs/module/zfs/vdev_trim.c b/sys/contrib/openzfs/module/zfs/vdev_trim.c index 895957bda195..deea7fedd770 100644 --- a/sys/contrib/openzfs/module/zfs/vdev_trim.c +++ b/sys/contrib/openzfs/module/zfs/vdev_trim.c @@ -22,6 +22,7 @@ /* * Copyright (c) 2016 by Delphix. All rights reserved. * Copyright (c) 2019 by Lawrence Livermore National Security, LLC. + * Copyright (c) 2021 Hewlett Packard Enterprise Development LP */ #include @@ -930,10 +931,16 @@ vdev_trim_thread(void *arg) range_tree_destroy(ta.trim_tree); mutex_enter(&vd->vdev_trim_lock); - if (!vd->vdev_trim_exit_wanted && vdev_writeable(vd)) { - vdev_trim_change_state(vd, VDEV_TRIM_COMPLETE, - vd->vdev_trim_rate, vd->vdev_trim_partial, - vd->vdev_trim_secure); + if (!vd->vdev_trim_exit_wanted) { + if (vdev_writeable(vd)) { + vdev_trim_change_state(vd, VDEV_TRIM_COMPLETE, + vd->vdev_trim_rate, vd->vdev_trim_partial, + vd->vdev_trim_secure); + } else if (vd->vdev_faulted) { + vdev_trim_change_state(vd, VDEV_TRIM_CANCELED, + vd->vdev_trim_rate, vd->vdev_trim_partial, + vd->vdev_trim_secure); + } } ASSERT(vd->vdev_trim_thread != NULL || vd->vdev_trim_inflight[0] == 0); diff --git a/sys/contrib/openzfs/tests/runfiles/common.run b/sys/contrib/openzfs/tests/runfiles/common.run index c0bfc09ac5b3..290b9ffba65c 100644 --- a/sys/contrib/openzfs/tests/runfiles/common.run +++ b/sys/contrib/openzfs/tests/runfiles/common.run @@ -413,6 +413,7 @@ tags = ['functional', 'cli_root', 'zpool_labelclear'] [tests/functional/cli_root/zpool_initialize] tests = ['zpool_initialize_attach_detach_add_remove', + 'zpool_initialize_fault_export_import_online', 'zpool_initialize_import_export', 'zpool_initialize_offline_export_import_online', 'zpool_initialize_online_offline', @@ -477,6 +478,7 @@ tags = ['functional', 'cli_root', 'zpool_sync'] [tests/functional/cli_root/zpool_trim] tests = ['zpool_trim_attach_detach_add_remove', + 'zpool_trim_fault_export_import_online', 'zpool_trim_import_export', 'zpool_trim_multiple', 'zpool_trim_neg', 'zpool_trim_offline_export_import_online', 'zpool_trim_online_offline', 'zpool_trim_partial', 'zpool_trim_rate', 'zpool_trim_rate_neg', diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/Makefile.am index 2ebc376d9cb9..3968902ec36d 100644 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/Makefile.am +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/Makefile.am @@ -2,6 +2,7 @@ pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_init dist_pkgdata_SCRIPTS = \ cleanup.ksh \ zpool_initialize_attach_detach_add_remove.ksh \ + zpool_initialize_fault_export_import_online.ksh \ zpool_initialize_import_export.ksh \ zpool_initialize_offline_export_import_online.ksh \ zpool_initialize_online_offline.ksh \ diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_fault_export_import_online.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_fault_export_import_online.ksh new file mode 100755 index 000000000000..11b8a483e662 --- /dev/null +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_fault_export_import_online.ksh @@ -0,0 +1,59 @@ +#!/bin/ksh -p +# +# CDDL HEADER START +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# +# CDDL HEADER END +# + +# +# Copyright (c) 2021 Lawrence Livermore National Security, LLC. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/cli_root/zpool_initialize/zpool_initialize.kshlib + +# +# DESCRIPTION: +# Miscellaneous complex sequences of operations function as expected. +# +# STRATEGY: +# 1. Create a pool with a two-way mirror. +# 2. Start initializing, fault, export, import, online and verify along +# the way that the initializing was cancelled and not restarted. +# + +DISK1="$(echo $DISKS | cut -d' ' -f1)" +DISK2="$(echo $DISKS | cut -d' ' -f2)" + +log_must zpool create -f $TESTPOOL mirror $DISK1 $DISK2 + +log_must zpool initialize $TESTPOOL $DISK1 +progress="$(initialize_progress $TESTPOOL $DISK1)" +[[ -z "$progress" ]] && log_fail "Initializing did not start" + +log_must zpool offline -f $TESTPOOL $DISK1 +log_must check_vdev_state $TESTPOOL $DISK1 "FAULTED" +log_must eval "zpool status -i $TESTPOOL | grep $DISK1 | grep uninitialized" + +log_must zpool export $TESTPOOL +log_must zpool import $TESTPOOL + +log_must check_vdev_state $TESTPOOL $DISK1 "FAULTED" +log_must eval "zpool status -i $TESTPOOL | grep $DISK1 | grep uninitialized" + +log_must zpool online $TESTPOOL $DISK1 +log_must zpool clear $TESTPOOL $DISK1 +log_must check_vdev_state $TESTPOOL $DISK1 "ONLINE" +log_must eval "zpool status -i $TESTPOOL | grep $DISK1 | grep uninitialized" + +log_pass "Initializing behaves as expected at each step of:" \ + "initialize + fault + export + import + online" diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/Makefile.am index d2d3b4ae88bb..0411ab4e0070 100644 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/Makefile.am +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/Makefile.am @@ -3,6 +3,7 @@ dist_pkgdata_SCRIPTS = \ setup.ksh \ cleanup.ksh \ zpool_trim_attach_detach_add_remove.ksh \ + zpool_trim_fault_export_import_online.ksh \ zpool_trim_import_export.ksh \ zpool_trim_multiple.ksh \ zpool_trim_neg.ksh \ diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/zpool_trim_fault_export_import_online.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/zpool_trim_fault_export_import_online.ksh new file mode 100755 index 000000000000..6bb9fc346daf --- /dev/null +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/zpool_trim_fault_export_import_online.ksh @@ -0,0 +1,62 @@ +#!/bin/ksh -p +# +# CDDL HEADER START +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# +# CDDL HEADER END +# + +# +# Copyright (c) 2019 by Tim Chase. All rights reserved. +# Copyright (c) 2021 Lawrence Livermore National Security, LLC. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/cli_root/zpool_trim/zpool_trim.kshlib + +# +# DESCRIPTION: +# Miscellaneous complex sequences of operations function as expected. +# +# STRATEGY: +# 1. Create a pool with a two-way mirror. +# 2. Start trimming, fault, export, import, online and verify along +# the way that the trim was cancelled and not restarted. +# + +DISK1="$(echo $DISKS | cut -d' ' -f1)" +DISK2="$(echo $DISKS | cut -d' ' -f2)" + +log_must zpool create -f $TESTPOOL mirror $DISK1 $DISK2 + +log_must zpool trim -r 128M $TESTPOOL $DISK1 +progress="$(trim_progress $TESTPOOL $DISK1)" +[[ -z "$progress" ]] && log_fail "Trimming did not start" + +log_must zpool offline -f $TESTPOOL $DISK1 +log_must check_vdev_state $TESTPOOL $DISK1 "FAULTED" +log_must eval "zpool status -t $TESTPOOL | grep $DISK1 | grep untrimmed" + +log_must zpool export $TESTPOOL +log_must zpool import $TESTPOOL + +# Note: the expected state here is unsupported since the faulted device +# cannot be checked to determine if it supports TRIM. +log_must check_vdev_state $TESTPOOL $DISK1 "FAULTED" +log_must eval "zpool status -t $TESTPOOL | grep $DISK1 | grep unsupported" + +log_must zpool online $TESTPOOL $DISK1 +log_must zpool clear $TESTPOOL $DISK1 +log_must check_vdev_state $TESTPOOL $DISK1 "ONLINE" +log_must eval "zpool status -t $TESTPOOL | grep $DISK1 | grep untrimmed" + +log_pass "Trimming behaves as expected at each step of:" \ + "trim + fault + export + import + online" From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 03:49: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 6352E55B995; Wed, 3 Mar 2021 03:49: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 4Dr0Np2Lh7z4Z25; Wed, 3 Mar 2021 03:49: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 43F2B22E7B; Wed, 3 Mar 2021 03:49: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 1233nEYP034745; Wed, 3 Mar 2021 03:49:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1233nERW034744; Wed, 3 Mar 2021 03:49:14 GMT (envelope-from git) Date: Wed, 3 Mar 2021 03:49:14 GMT Message-Id: <202103030349.1233nERW034744@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: e7be16de5044 - stable/13 - atomic: add atomic_interrupt_fence() 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: e7be16de504447e258593ffd290d3d0aef5f1cdf 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 Mar 2021 03:49:14 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e7be16de504447e258593ffd290d3d0aef5f1cdf commit e7be16de504447e258593ffd290d3d0aef5f1cdf Author: Konstantin Belousov AuthorDate: 2021-02-23 22:12:29 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-03 03:08:15 +0000 atomic: add atomic_interrupt_fence() (cherry picked from commit e2494f7561c852951d8ac567314f5e12f19ee7af) --- share/man/man9/atomic.9 | 13 ++++++++++++- sys/sys/atomic_common.h | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/share/man/man9/atomic.9 b/share/man/man9/atomic.9 index 39a4fa9c6f96..397a8fcd6b18 100644 --- a/share/man/man9/atomic.9 +++ b/share/man/man9/atomic.9 @@ -22,7 +22,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 18, 2019 +.Dd February 24, 2021 .Dt ATOMIC 9 .Os .Sh NAME @@ -31,6 +31,7 @@ .Nm atomic_cmpset , .Nm atomic_fcmpset , .Nm atomic_fetchadd , +.Nm atomic_interrupt_fence , .Nm atomic_load , .Nm atomic_readandclear , .Nm atomic_set , @@ -59,6 +60,8 @@ .Fc .Ft .Fn atomic_fetchadd_ "volatile *p" " v" +.Ft void +.Fn atomic_interrupt_fence "void" .Ft .Fn atomic_load_[acq_] "volatile *p" .Ft @@ -292,6 +295,14 @@ release stores, by separating access from ordering, they can sometimes facilitate more efficient implementations of synchronization primitives. For example, they can be used to avoid executing a memory barrier until a memory access shows that some condition is satisfied. +.Ss Interrupt Fence Operations +The +.Fn atomic_interrupt_fence() +function establishes ordering between its call location and any interrupt +handler executing on the same CPU. +It is modeled after the similar C11 function +.Fn atomic_signal_fence() , +and adapted for the kernel environment. .Ss Multiple Processors In multiprocessor systems, the atomicity of the atomic operations on memory depends on support for cache coherence in the underlying architecture. diff --git a/sys/sys/atomic_common.h b/sys/sys/atomic_common.h index 48f0a8b8939c..403b3de8a092 100644 --- a/sys/sys/atomic_common.h +++ b/sys/sys/atomic_common.h @@ -78,4 +78,6 @@ #define atomic_load_consume_ptr(p) \ ((__typeof(*p)) atomic_load_acq_ptr((uintptr_t *)p)) +#define atomic_interrupt_fence() __compiler_membar() + #endif From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 03:49: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 4637355B91C; Wed, 3 Mar 2021 03:49: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 4Dr0Nn1QF2z4ZHB; Wed, 3 Mar 2021 03:49: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 2347A22B63; Wed, 3 Mar 2021 03:49: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 1233nD3W034721; Wed, 3 Mar 2021 03:49:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1233nDSQ034720; Wed, 3 Mar 2021 03:49:13 GMT (envelope-from git) Date: Wed, 3 Mar 2021 03:49:13 GMT Message-Id: <202103030349.1233nDSQ034720@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: c79e239ceeda - stable/13 - Add VOP_READ_PGCACHE(9) 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: c79e239ceedae35b63334cc2879fb7a771224d0f 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 Mar 2021 03:49:13 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c79e239ceedae35b63334cc2879fb7a771224d0f commit c79e239ceedae35b63334cc2879fb7a771224d0f Author: Konstantin Belousov AuthorDate: 2021-02-28 01:08:37 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-03 03:07:59 +0000 Add VOP_READ_PGCACHE(9) PR: 253894 (cherry picked from commit 55eb51ab6649c3c10bf201f82a4ec410fe4da4a2) --- share/man/man9/Makefile | 1 + share/man/man9/VOP_RDWR.9 | 1 + share/man/man9/VOP_READ_PGCACHE.9 | 134 ++++++++++++++++++++++++++++++++++++++ share/man/man9/vnode.9 | 1 + 4 files changed, 137 insertions(+) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 7b55bf8516c7..50e760d3e047 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -425,6 +425,7 @@ MAN= accept_filter.9 \ VOP_PATHCONF.9 \ VOP_PRINT.9 \ VOP_RDWR.9 \ + VOP_READ_PGCACHE.9 \ VOP_READDIR.9 \ VOP_READLINK.9 \ VOP_REALLOCBLKS.9 \ diff --git a/share/man/man9/VOP_RDWR.9 b/share/man/man9/VOP_RDWR.9 index 4719ebabd094..2de7f9c9e7d2 100644 --- a/share/man/man9/VOP_RDWR.9 +++ b/share/man/man9/VOP_RDWR.9 @@ -83,6 +83,7 @@ Data already in VMIO space. .El .Sh LOCKS The file should be locked on entry and will still be locked on exit. +Rangelock covering the whole i/o range should be owned around the call. .Sh RETURN VALUES Zero is returned on success, otherwise an error code is returned. .Sh ERRORS diff --git a/share/man/man9/VOP_READ_PGCACHE.9 b/share/man/man9/VOP_READ_PGCACHE.9 new file mode 100644 index 000000000000..3e6ae9be4fc7 --- /dev/null +++ b/share/man/man9/VOP_READ_PGCACHE.9 @@ -0,0 +1,134 @@ +.\" Copyright (c) 2021 The FreeBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This documentation was written by +.\" Konstantin Belousov 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 AUTHORS 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 AUTHORS 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$ +.\" +.Dd February 28, 2021 +.Dt VOP_READ_PGCACHE 9 +.Os +.Sh NAME +.Nm VOP_READ_PGCACHE +.Nd read a file, fast +.Sh SYNOPSIS +.In sys/param.h +.In sys/vnode.h +.In sys/uio.h +.Ft int +.Fo VOP_READ_PGCACHE +.Fa "struct vnode *vp" +.Fa "struct uio *uio" +.Fa "int ioflag" +.Fa "struct ucred *cred" +.Fc +.Sh DESCRIPTION +This entry point reads the contents of a file. +The intent is to provide the data from caches, which do not require +expensive operations or any disk IO. +For instance, if filesystem uses normal VM page cache and maintains +.Dv v_object +lifetime, it can use +.Xr vn_read_from_obj 9 +helper to return data from the resident +.Dv vp->v_object +pages. +.Pp +The filesystem indicates support for the +.Nm +on specific vnode by setting the +.Dv VIRF_PGREAD +flag in +.Dv vp->v_irflag . +.Pp +The function does not need to satisfy the whole request; it also might choose +to not provide any data. +In these cases, the +.Fa uio +must be advanced by the amount of read data, +.Nm +should return +.Er EJUSTRETURN , +and VFS would handle the rest of the read operation using the +.Xr VOP_READ 9 . +.Pp +The VFS layer does the same deadlock avoidance for accessing userspace +pages from +.Nm +as for +.Xr VOP_READ 9 . +.Pp +Vnode is not locked on the call entry and should not be locked on return. +For a filesystem that requires vnode lock to return any data, it does +not make sense to implement +.Nm +(and set +.Dv VIRF_PGREAD +flag) since VFS arranges the call to +.Xr VOP_READ 9 +as needed. +.Pp +The arguments are: +.Bl -tag -width ioflag +.It Fa vp +The vnode of the file. +.It Fa uio +The location of the data to be read. +.It Fa ioflag +Various flags, see +.Xr VOP_READ 9 +for the list. +.It Fa cred +The credentials of the caller. +.El +.Pp +.Nm +does not handle non-zero +.Fa ioflag +argument. +.Sh LOCKS +The file should be referenced on entry on entry and will still be +referenced on exit. +Rangelock covering the whole read range should be owned around the call. +.Sh RETURN VALUES +Zero is returned on success, when the whole request is satisfied, and no +more data cannot be provided for it by any means. +If more data can be returned, but +.Nm +was unable to provide it, +.Er EJUSTRETURN +must be returned. +The +.Dv uio +records should be updated according to the partial operation done. +.Pp +Otherwise an error code is returned, +same as from +.Xr VOP_READ 9 +.Sh SEE ALSO +.Xr uiomove 9 , +.Xr vnode 9 , +.Xr VOP_READ 9 diff --git a/share/man/man9/vnode.9 b/share/man/man9/vnode.9 index 91360a755fbc..7a58f07b22b0 100644 --- a/share/man/man9/vnode.9 +++ b/share/man/man9/vnode.9 @@ -181,6 +181,7 @@ intertwining of VM Objects and Vnodes. .Xr VOP_PATHCONF 9 , .Xr VOP_PRINT 9 , .Xr VOP_RDWR 9 , +.Xr VOP_READ_PGCACHE 9 , .Xr VOP_READDIR 9 , .Xr VOP_READLINK 9 , .Xr VOP_REALLOCBLKS 9 , From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 07:07: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 8733A5600F7; Wed, 3 Mar 2021 07:07: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 4Dr4nN3RWqz4llD; Wed, 3 Mar 2021 07:07: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 6943A2526C; Wed, 3 Mar 2021 07:07: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 12377KET000335; Wed, 3 Mar 2021 07:07:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12377KRn000334; Wed, 3 Mar 2021 07:07:20 GMT (envelope-from git) Date: Wed, 3 Mar 2021 07:07:20 GMT Message-Id: <202103030707.12377KRn000334@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: 06eba90acb62 - stable/12 - atomic: add atomic_interrupt_fence() 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/12 X-Git-Reftype: branch X-Git-Commit: 06eba90acb6201bbf2af76ca8acee5232abf9f82 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 Mar 2021 07:07:20 -0000 The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=06eba90acb6201bbf2af76ca8acee5232abf9f82 commit 06eba90acb6201bbf2af76ca8acee5232abf9f82 Author: Konstantin Belousov AuthorDate: 2021-02-23 22:12:29 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-03 07:07:05 +0000 atomic: add atomic_interrupt_fence() (cherry picked from commit e2494f7561c852951d8ac567314f5e12f19ee7af) --- share/man/man9/atomic.9 | 13 ++++++++++++- sys/sys/atomic_common.h | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/share/man/man9/atomic.9 b/share/man/man9/atomic.9 index 914da97764f0..7e72d127e168 100644 --- a/share/man/man9/atomic.9 +++ b/share/man/man9/atomic.9 @@ -22,7 +22,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 18, 2019 +.Dd February 24, 2021 .Dt ATOMIC 9 .Os .Sh NAME @@ -31,6 +31,7 @@ .Nm atomic_cmpset , .Nm atomic_fcmpset , .Nm atomic_fetchadd , +.Nm atomic_interrupt_fence , .Nm atomic_load , .Nm atomic_readandclear , .Nm atomic_set , @@ -59,6 +60,8 @@ .Fc .Ft .Fn atomic_fetchadd_ "volatile *p" " v" +.Ft void +.Fn atomic_interrupt_fence "void" .Ft .Fn atomic_load_[acq_] "volatile *p" .Ft @@ -290,6 +293,14 @@ release stores, by separating access from ordering, they can sometimes facilitate more efficient implementations of synchronization primitives. For example, they can be used to avoid executing a memory barrier until a memory access shows that some condition is satisfied. +.Ss Interrupt Fence Operations +The +.Fn atomic_interrupt_fence() +function establishes ordering between its call location and any interrupt +handler executing on the same CPU. +It is modeled after the similar C11 function +.Fn atomic_signal_fence() , +and adapted for the kernel environment. .Ss Multiple Processors In multiprocessor systems, the atomicity of the atomic operations on memory depends on support for cache coherence in the underlying architecture. diff --git a/sys/sys/atomic_common.h b/sys/sys/atomic_common.h index 16db4a81eb28..3d1920069362 100644 --- a/sys/sys/atomic_common.h +++ b/sys/sys/atomic_common.h @@ -70,4 +70,6 @@ (*(volatile uint64_t *)(p) = (uint64_t)(v)) #endif +#define atomic_interrupt_fence() __compiler_membar() + #endif From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 07:57: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 023DD5611B7; Wed, 3 Mar 2021 07:57: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 4Dr5tg6MrJz4nTM; Wed, 3 Mar 2021 07:56: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 C967C26164; Wed, 3 Mar 2021 07:56: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 1237uxhI066033; Wed, 3 Mar 2021 07:56:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1237uxNO066032; Wed, 3 Mar 2021 07:56:59 GMT (envelope-from git) Date: Wed, 3 Mar 2021 07:56:59 GMT Message-Id: <202103030756.1237uxNO066032@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Richard Scheffenegger Subject: git: 2b43cd2ea26f - stable/13 - Improve PRR initial transmission timing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2b43cd2ea26f758d23e8c009cf7521c4ddec7353 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 Mar 2021 07:57:00 -0000 The branch stable/13 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=2b43cd2ea26f758d23e8c009cf7521c4ddec7353 commit 2b43cd2ea26f758d23e8c009cf7521c4ddec7353 Author: Richard Scheffenegger AuthorDate: 2021-02-28 14:46:38 +0000 Commit: Richard Scheffenegger CommitDate: 2021-03-03 07:12:49 +0000 Improve PRR initial transmission timing Reviewed By: tuexen, #transport MFC after: 3 days Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D28953 (cherry picked from commit e9071000c9a04e3f685579500e24da9848944bb1) --- sys/netinet/tcp_input.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 1a4a4619c4bf..f7ef3ed81da2 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -2595,7 +2595,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, pipe = (tp->snd_nxt - tp->snd_fack) + tp->sackhint.sack_bytes_rexmit; tp->sackhint.prr_delivered += del_data; - if (pipe > tp->snd_ssthresh) { + if (pipe >= tp->snd_ssthresh) { if (tp->sackhint.recover_fs == 0) tp->sackhint.recover_fs = imax(1, tp->snd_nxt - tp->snd_una); @@ -2695,7 +2695,8 @@ enter_recovery: * snd_ssthresh is already updated by * cc_cong_signal. */ - tp->sackhint.prr_delivered = 0; + tp->sackhint.prr_delivered = + tp->sackhint.sacked_bytes; tp->sackhint.sack_bytes_rexmit = 0; tp->sackhint.recover_fs = max(1, tp->snd_nxt - tp->snd_una); @@ -3970,7 +3971,7 @@ tcp_prr_partialack(struct tcpcb *tp, struct tcphdr *th) /* * Proportional Rate Reduction */ - if (pipe > tp->snd_ssthresh) { + if (pipe >= tp->snd_ssthresh) { if (tp->sackhint.recover_fs == 0) tp->sackhint.recover_fs = imax(1, tp->snd_nxt - tp->snd_una); From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 09:49: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 164A3564F25; Wed, 3 Mar 2021 09:49: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 4Dr8N070llz3D4X; Wed, 3 Mar 2021 09:49: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 E3410275CE; Wed, 3 Mar 2021 09:49: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 1239n4UC014225; Wed, 3 Mar 2021 09:49:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1239n4d7014224; Wed, 3 Mar 2021 09:49:04 GMT (envelope-from git) Date: Wed, 3 Mar 2021 09:49:04 GMT Message-Id: <202103030949.1239n4d7014224@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: 17cc6689eb16 - stable/13 - MFC 9febbc454190: Fix for natd(8) sending wrong sequence number after TCP retransmission, terminating a TCP connection. 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: 17cc6689eb16302f897023c1b227c30de1e373a4 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 Mar 2021 09:49:05 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=17cc6689eb16302f897023c1b227c30de1e373a4 commit 17cc6689eb16302f897023c1b227c30de1e373a4 Author: Hans Petter Selasky AuthorDate: 2021-02-22 10:58:46 +0000 Commit: Hans Petter Selasky CommitDate: 2021-03-03 09:47:44 +0000 MFC 9febbc454190: Fix for natd(8) sending wrong sequence number after TCP retransmission, terminating a TCP connection. If a TCP packet must be retransmitted and the data length has changed in the retransmitted packet, due to the internal workings of TCP, typically when ACK packets are lost, then there is a 30% chance that the logic in GetDeltaSeqOut() will find the correct length, which is the last length received. This can be explained as follows: If a "227 Entering Passive Mode" packet must be retransmittet and the length changes from 51 to 50 bytes, for example, then we have three cases for the list scan in GetDeltaSeqOut(), depending on how many prior packets were received modulus N_LINK_TCP_DATA=3: case 1: index 0: original packet 51 index 1: retransmitted packet 50 index 2: not relevant case 2: index 0: not relevant index 1: original packet 51 index 2: retransmitted packet 50 case 3: index 0: retransmitted packet 50 index 1: not relevant index 2: original packet 51 This patch simply changes the searching order for TCP packets, always starting at the last received packet instead of any received packet, in GetDeltaAckIn() and GetDeltaSeqOut(). Else no functional changes. Discussed with: rscheff@ Submitted by: Andreas Longwitz PR: 230755 Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 9febbc4541903bb8e6b0f1c84988c98b2f7c96ef) --- sys/netinet/libalias/alias_db.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index 1f85a606b2d5..c87273c863ca 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -1937,14 +1937,18 @@ TCP packet. To do this, a circular list of ACK numbers where the TCP packet size was altered is searched. */ - int i; + int i, j; int delta, ack_diff_min; delta = 0; ack_diff_min = -1; - for (i = 0; i < N_LINK_TCP_DATA; i++) { + i = lnk->data.tcp->state.index; + for (j = 0; j < N_LINK_TCP_DATA; j++) { struct ack_data_record x; + if (i == 0) + i = N_LINK_TCP_DATA; + i--; x = lnk->data.tcp->ack[i]; if (x.active == 1) { int ack_diff; @@ -1976,14 +1980,18 @@ TCP packet. To do this, a circular list of ACK numbers where the TCP packet size was altered is searched. */ - int i; + int i, j; int delta, seq_diff_min; delta = 0; seq_diff_min = -1; - for (i = 0; i < N_LINK_TCP_DATA; i++) { + i = lnk->data.tcp->state.index; + for (j = 0; j < N_LINK_TCP_DATA; j++) { struct ack_data_record x; + if (i == 0) + i = N_LINK_TCP_DATA; + i--; x = lnk->data.tcp->ack[i]; if (x.active == 1) { int seq_diff; From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 09:51:19 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 828F3564D43; Wed, 3 Mar 2021 09:51:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dr8Qb39xTz3DPq; Wed, 3 Mar 2021 09:51:19 +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 5EA4527739; Wed, 3 Mar 2021 09:51:19 +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 1239pJwN022063; Wed, 3 Mar 2021 09:51:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1239pJUA022062; Wed, 3 Mar 2021 09:51:19 GMT (envelope-from git) Date: Wed, 3 Mar 2021 09:51:19 GMT Message-Id: <202103030951.1239pJUA022062@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: 25858ea74b07 - stable/12 - MFC 9febbc454190: Fix for natd(8) sending wrong sequence number after TCP retransmission, terminating a TCP connection. 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: 25858ea74b07383145d91773635107ceddf7ca33 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 Mar 2021 09:51:19 -0000 The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=25858ea74b07383145d91773635107ceddf7ca33 commit 25858ea74b07383145d91773635107ceddf7ca33 Author: Hans Petter Selasky AuthorDate: 2021-02-22 10:58:46 +0000 Commit: Hans Petter Selasky CommitDate: 2021-03-03 09:50:11 +0000 MFC 9febbc454190: Fix for natd(8) sending wrong sequence number after TCP retransmission, terminating a TCP connection. If a TCP packet must be retransmitted and the data length has changed in the retransmitted packet, due to the internal workings of TCP, typically when ACK packets are lost, then there is a 30% chance that the logic in GetDeltaSeqOut() will find the correct length, which is the last length received. This can be explained as follows: If a "227 Entering Passive Mode" packet must be retransmittet and the length changes from 51 to 50 bytes, for example, then we have three cases for the list scan in GetDeltaSeqOut(), depending on how many prior packets were received modulus N_LINK_TCP_DATA=3: case 1: index 0: original packet 51 index 1: retransmitted packet 50 index 2: not relevant case 2: index 0: not relevant index 1: original packet 51 index 2: retransmitted packet 50 case 3: index 0: retransmitted packet 50 index 1: not relevant index 2: original packet 51 This patch simply changes the searching order for TCP packets, always starting at the last received packet instead of any received packet, in GetDeltaAckIn() and GetDeltaSeqOut(). Else no functional changes. Discussed with: rscheff@ Submitted by: Andreas Longwitz PR: 230755 Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 9febbc4541903bb8e6b0f1c84988c98b2f7c96ef) --- sys/netinet/libalias/alias_db.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index b3792c748c56..9eb6901ed5bc 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -1998,14 +1998,18 @@ TCP packet. To do this, a circular list of ACK numbers where the TCP packet size was altered is searched. */ - int i; + int i, j; int delta, ack_diff_min; delta = 0; ack_diff_min = -1; - for (i = 0; i < N_LINK_TCP_DATA; i++) { + i = lnk->data.tcp->state.index; + for (j = 0; j < N_LINK_TCP_DATA; j++) { struct ack_data_record x; + if (i == 0) + i = N_LINK_TCP_DATA; + i--; x = lnk->data.tcp->ack[i]; if (x.active == 1) { int ack_diff; @@ -2037,14 +2041,18 @@ TCP packet. To do this, a circular list of ACK numbers where the TCP packet size was altered is searched. */ - int i; + int i, j; int delta, seq_diff_min; delta = 0; seq_diff_min = -1; - for (i = 0; i < N_LINK_TCP_DATA; i++) { + i = lnk->data.tcp->state.index; + for (j = 0; j < N_LINK_TCP_DATA; j++) { struct ack_data_record x; + if (i == 0) + i = N_LINK_TCP_DATA; + i--; x = lnk->data.tcp->ack[i]; if (x.active == 1) { int seq_diff; From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 09:52: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 D6004565295; Wed, 3 Mar 2021 09:52: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 4Dr8Rz5lbjz3DTK; Wed, 3 Mar 2021 09:52: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 B835427756; Wed, 3 Mar 2021 09:52: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 1239qV95026292; Wed, 3 Mar 2021 09:52:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1239qVqi026291; Wed, 3 Mar 2021 09:52:31 GMT (envelope-from git) Date: Wed, 3 Mar 2021 09:52:31 GMT Message-Id: <202103030952.1239qVqi026291@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: e3d9b9cc02b6 - stable/11 - MFC 9febbc454190: Fix for natd(8) sending wrong sequence number after TCP retransmission, terminating a TCP connection. 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: e3d9b9cc02b6e00858526d302c82bfa1dbeb87ee 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 Mar 2021 09:52:31 -0000 The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=e3d9b9cc02b6e00858526d302c82bfa1dbeb87ee commit e3d9b9cc02b6e00858526d302c82bfa1dbeb87ee Author: Hans Petter Selasky AuthorDate: 2021-02-22 10:58:46 +0000 Commit: Hans Petter Selasky CommitDate: 2021-03-03 09:51:48 +0000 MFC 9febbc454190: Fix for natd(8) sending wrong sequence number after TCP retransmission, terminating a TCP connection. If a TCP packet must be retransmitted and the data length has changed in the retransmitted packet, due to the internal workings of TCP, typically when ACK packets are lost, then there is a 30% chance that the logic in GetDeltaSeqOut() will find the correct length, which is the last length received. This can be explained as follows: If a "227 Entering Passive Mode" packet must be retransmittet and the length changes from 51 to 50 bytes, for example, then we have three cases for the list scan in GetDeltaSeqOut(), depending on how many prior packets were received modulus N_LINK_TCP_DATA=3: case 1: index 0: original packet 51 index 1: retransmitted packet 50 index 2: not relevant case 2: index 0: not relevant index 1: original packet 51 index 2: retransmitted packet 50 case 3: index 0: retransmitted packet 50 index 1: not relevant index 2: original packet 51 This patch simply changes the searching order for TCP packets, always starting at the last received packet instead of any received packet, in GetDeltaAckIn() and GetDeltaSeqOut(). Else no functional changes. Discussed with: rscheff@ Submitted by: Andreas Longwitz PR: 230755 Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 9febbc4541903bb8e6b0f1c84988c98b2f7c96ef) --- sys/netinet/libalias/alias_db.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index 4f8159ba753a..a057b9847313 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -1985,14 +1985,18 @@ TCP packet. To do this, a circular list of ACK numbers where the TCP packet size was altered is searched. */ - int i; + int i, j; int delta, ack_diff_min; delta = 0; ack_diff_min = -1; - for (i = 0; i < N_LINK_TCP_DATA; i++) { + i = lnk->data.tcp->state.index; + for (j = 0; j < N_LINK_TCP_DATA; j++) { struct ack_data_record x; + if (i == 0) + i = N_LINK_TCP_DATA; + i--; x = lnk->data.tcp->ack[i]; if (x.active == 1) { int ack_diff; @@ -2024,14 +2028,18 @@ TCP packet. To do this, a circular list of ACK numbers where the TCP packet size was altered is searched. */ - int i; + int i, j; int delta, seq_diff_min; delta = 0; seq_diff_min = -1; - for (i = 0; i < N_LINK_TCP_DATA; i++) { + i = lnk->data.tcp->state.index; + for (j = 0; j < N_LINK_TCP_DATA; j++) { struct ack_data_record x; + if (i == 0) + i = N_LINK_TCP_DATA; + i--; x = lnk->data.tcp->ack[i]; if (x.active == 1) { int seq_diff; From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 09:58: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 56E745651F5; Wed, 3 Mar 2021 09:58: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 4Dr8bL1yMrz3F5W; Wed, 3 Mar 2021 09:58: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 313F92717D; Wed, 3 Mar 2021 09:58: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 1239wss1027435; Wed, 3 Mar 2021 09:58:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1239wsEm027434; Wed, 3 Mar 2021 09:58:54 GMT (envelope-from git) Date: Wed, 3 Mar 2021 09:58:54 GMT Message-Id: <202103030958.1239wsEm027434@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: 0a62368c6a53 - stable/10 - MFC 9febbc454190: Fix for natd(8) sending wrong sequence number after TCP retransmission, terminating a TCP connection. 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/10 X-Git-Reftype: branch X-Git-Commit: 0a62368c6a53054fcc255583cf6308f85a1533d2 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 Mar 2021 09:58:54 -0000 The branch stable/10 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=0a62368c6a53054fcc255583cf6308f85a1533d2 commit 0a62368c6a53054fcc255583cf6308f85a1533d2 Author: Hans Petter Selasky AuthorDate: 2021-02-22 10:58:46 +0000 Commit: Hans Petter Selasky CommitDate: 2021-03-03 09:57:29 +0000 MFC 9febbc454190: Fix for natd(8) sending wrong sequence number after TCP retransmission, terminating a TCP connection. If a TCP packet must be retransmitted and the data length has changed in the retransmitted packet, due to the internal workings of TCP, typically when ACK packets are lost, then there is a 30% chance that the logic in GetDeltaSeqOut() will find the correct length, which is the last length received. This can be explained as follows: If a "227 Entering Passive Mode" packet must be retransmittet and the length changes from 51 to 50 bytes, for example, then we have three cases for the list scan in GetDeltaSeqOut(), depending on how many prior packets were received modulus N_LINK_TCP_DATA=3: case 1: index 0: original packet 51 index 1: retransmitted packet 50 index 2: not relevant case 2: index 0: not relevant index 1: original packet 51 index 2: retransmitted packet 50 case 3: index 0: retransmitted packet 50 index 1: not relevant index 2: original packet 51 This patch simply changes the searching order for TCP packets, always starting at the last received packet instead of any received packet, in GetDeltaAckIn() and GetDeltaSeqOut(). Else no functional changes. Discussed with: rscheff@ Submitted by: Andreas Longwitz PR: 230755 Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 9febbc4541903bb8e6b0f1c84988c98b2f7c96ef) --- sys/netinet/libalias/alias_db.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index 052e04563fa1..a0144d3ef9f3 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -1992,14 +1992,18 @@ TCP packet. To do this, a circular list of ACK numbers where the TCP packet size was altered is searched. */ - int i; + int i, j; int delta, ack_diff_min; delta = 0; ack_diff_min = -1; - for (i = 0; i < N_LINK_TCP_DATA; i++) { + i = lnk->data.tcp->state.index; + for (j = 0; j < N_LINK_TCP_DATA; j++) { struct ack_data_record x; + if (i == 0) + i = N_LINK_TCP_DATA; + i--; x = lnk->data.tcp->ack[i]; if (x.active == 1) { int ack_diff; @@ -2031,14 +2035,18 @@ TCP packet. To do this, a circular list of ACK numbers where the TCP packet size was altered is searched. */ - int i; + int i, j; int delta, seq_diff_min; delta = 0; seq_diff_min = -1; - for (i = 0; i < N_LINK_TCP_DATA; i++) { + i = lnk->data.tcp->state.index; + for (j = 0; j < N_LINK_TCP_DATA; j++) { struct ack_data_record x; + if (i == 0) + i = N_LINK_TCP_DATA; + i--; x = lnk->data.tcp->ack[i]; if (x.active == 1) { int seq_diff; From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 13:34: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 9B74056AA55; Wed, 3 Mar 2021 13:34: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 4DrFMq40qgz3kwv; Wed, 3 Mar 2021 13:34: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 77E2C28AB; Wed, 3 Mar 2021 13:34: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 123DYFdK016516; Wed, 3 Mar 2021 13:34:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 123DYFNn016515; Wed, 3 Mar 2021 13:34:15 GMT (envelope-from git) Date: Wed, 3 Mar 2021 13:34:15 GMT Message-Id: <202103031334.123DYFNn016515@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: cdef48b528b6 - stable/10 - MFC 12148d4300db: Fix for locking order reversal in USB audio driver, when using mmap(). 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/10 X-Git-Reftype: branch X-Git-Commit: cdef48b528b6d4ac2771bac376c09905aa7edfd2 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 Mar 2021 13:34:15 -0000 The branch stable/10 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=cdef48b528b6d4ac2771bac376c09905aa7edfd2 commit cdef48b528b6d4ac2771bac376c09905aa7edfd2 Author: Hans Petter Selasky AuthorDate: 2021-02-14 19:29:16 +0000 Commit: Hans Petter Selasky CommitDate: 2021-03-03 13:33:16 +0000 MFC 12148d4300db: Fix for locking order reversal in USB audio driver, when using mmap(). Locking the second lock which causes the LOR, can be skipped because the code updating the shared variables is always executing from the same USB thread. lock order reversal: 1st 0xfffff80005cc3840 pcm7:play:dsp7.p0 (pcm play channel, sleep mutex) @ usb_transfer.c:2342 2nd 0xfffff80005cc3860 pcm7:record:dsp7.r0 (pcm record channel, sleep mutex) @ uaudio.c:2317 lock order pcm record channel -> pcm play channel established at: witness_checkorder+0x461 __mtx_lock_flags+0x98 dsp_mmap_single+0x151 vm_mmap_cdev+0x65 devfs_mmap_f+0x143 kern_mmap_req+0x594 sys_mmap+0x46 amd64_syscall+0x12e fast_syscall_common+0xf8 lock order pcm play channel -> pcm record channel attempted at: witness_checkorder+0xd82 __mtx_lock_flags+0x98 uaudio_chan_play_callback+0xeb usbd_callback_wrapper+0x7ec usb_command_wrapper+0x7e usb_callback_proc+0x8e usb_process+0xf3 fork_exit+0x80 fork_trampoline+0xe Found by: Stefan Ehmann Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 12148d4300dbbd93260bf2801cdb9eda8b3b05a4) --- sys/dev/sound/usb/uaudio.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index fb2c98132879..ea54e1b4232c 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -2320,11 +2320,16 @@ uaudio_chan_play_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: tr_setup: if (ch_rec != NULL) { + /* + * NOTE: The play and record callbacks are + * executed from the same USB thread and + * locking the record channel mutex here is + * not needed. This avoids a LOR situation. + */ + /* reset receive jitter counters */ - mtx_lock(ch_rec->pcm_mtx); ch_rec->jitter_curr = 0; ch_rec->jitter_rem = 0; - mtx_unlock(ch_rec->pcm_mtx); } /* reset transmit jitter counters */ @@ -2345,10 +2350,17 @@ tr_setup: */ if (ch_rec != NULL && uaudio_chan_is_async(ch, ch->cur_alt) != 0) { - mtx_lock(ch_rec->pcm_mtx); - if (ch_rec->cur_alt < ch_rec->num_alt) { + uint32_t rec_alt = ch_rec->cur_alt; + if (rec_alt < ch_rec->num_alt) { int64_t tx_jitter; int64_t rx_rate; + /* + * NOTE: The play and record callbacks + * are executed from the same USB + * thread and locking the record + * channel mutex here is not needed. + * This avoids a LOR situation. + */ /* translate receive jitter into transmit jitter */ tx_jitter = ch->usb_alt[ch->cur_alt].sample_rate; @@ -2360,11 +2372,10 @@ tr_setup: ch_rec->jitter_rem = 0; /* compute exact number of transmit jitter samples */ - rx_rate = ch_rec->usb_alt[ch_rec->cur_alt].sample_rate; + rx_rate = ch_rec->usb_alt[rec_alt].sample_rate; ch->jitter_curr += tx_jitter / rx_rate; ch->jitter_rem = tx_jitter % rx_rate; } - mtx_unlock(ch_rec->pcm_mtx); } /* start the SYNC transfer one time per second, if any */ From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 14:49:19 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 838BD56CA18; Wed, 3 Mar 2021 14:49:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DrH2R3J2Mz3rZd; Wed, 3 Mar 2021 14:49:19 +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 5FAC033B7; Wed, 3 Mar 2021 14:49:19 +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 123EnJ58009802; Wed, 3 Mar 2021 14:49:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 123EnJ8D009801; Wed, 3 Mar 2021 14:49:19 GMT (envelope-from git) Date: Wed, 3 Mar 2021 14:49:19 GMT Message-Id: <202103031449.123EnJ8D009801@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 902a18d50aef - stable/13 - copy_file_range(2): Fix for small values of input file offset and len MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 902a18d50aef8775aa833dde3638356f994e28e8 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 Mar 2021 14:49:19 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=902a18d50aef8775aa833dde3638356f994e28e8 commit 902a18d50aef8775aa833dde3638356f994e28e8 Author: Rick Macklem AuthorDate: 2021-03-01 14:28:30 +0000 Commit: Rick Macklem CommitDate: 2021-03-03 14:46:33 +0000 copy_file_range(2): Fix for small values of input file offset and len r366302 broke copy_file_range(2) for small values of input file offset and len. It was possible for rem to be greater than len and then "len - rem" was a large value, since both variables are unsigned. (cherry picked from commit a5f9fe2bab789f49e8b53da3a62dbd34725e23ea) --- sys/kern/vfs_vnops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 781968f2db53..7a0951fb07ca 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -3143,7 +3143,7 @@ vn_generic_copy_file_range(struct vnode *invp, off_t *inoffp, rem = *inoffp % blksize; if (rem > 0) rem = blksize - rem; - if (len - rem > blksize) + if (len > rem && len - rem > blksize) len = savlen = rounddown(len - rem, blksize) + rem; } From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 15:11: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 14C2256D36B; Wed, 3 Mar 2021 15:11: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 4DrHXR06zmz3tdg; Wed, 3 Mar 2021 15:11: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 EB6C43E89; Wed, 3 Mar 2021 15:11: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 123FBo8v048448; Wed, 3 Mar 2021 15:11:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 123FBoNq048447; Wed, 3 Mar 2021 15:11:50 GMT (envelope-from git) Date: Wed, 3 Mar 2021 15:11:50 GMT Message-Id: <202103031511.123FBoNq048447@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: a2a4cfc3157f - stable/13 - nfsclient: fix panic in cache_enter_time() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a2a4cfc3157ff19a192eff96c017169ede15c054 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 Mar 2021 15:11:51 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=a2a4cfc3157ff19a192eff96c017169ede15c054 commit a2a4cfc3157ff19a192eff96c017169ede15c054 Author: Rick Macklem AuthorDate: 2021-02-28 01:54:05 +0000 Commit: Rick Macklem CommitDate: 2021-03-03 15:10:51 +0000 nfsclient: fix panic in cache_enter_time() Juraj Lutter (otis@) reported a panic "dvp != vp not true" in cache_enter_time() called from the NFS client's nfsrpc_readdirplus() function. This is specific to an NFSv3 mount with the "rdirplus" mount option. Unlike NFSv4, NFSv3 replies to ReaddirPlus includes entries for the current directory. This trivial patch avoids doing a cache_enter_time() call for the current directory to avoid the panic. (cherry picked from commit 3fe2c68ba20fb3365ef91e0b85f88237b5369f38) --- sys/fs/nfsclient/nfs_clrpcops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index b4f2d5301d13..c95d4dc58e7a 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -3761,6 +3761,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, ndp->ni_vp = newvp; NFSCNHASH(cnp, HASHINIT); if (cnp->cn_namelen <= NCHNAMLEN && + ndp->ni_dvp != ndp->ni_vp && (newvp->v_type != VDIR || dctime.tv_sec != 0)) { cache_enter_time(ndp->ni_dvp, From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 15:34: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 C3EE556E023; Wed, 3 Mar 2021 15:34: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 4DrJ2m59bdz3w7m; Wed, 3 Mar 2021 15:34: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 9FFAA3EC2; Wed, 3 Mar 2021 15:34: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 123FYe6F075455; Wed, 3 Mar 2021 15:34:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 123FYeTn075454; Wed, 3 Mar 2021 15:34:40 GMT (envelope-from git) Date: Wed, 3 Mar 2021 15:34:40 GMT Message-Id: <202103031534.123FYeTn075454@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Chris Rees Subject: git: 949eb16e3b4d - stable/12 - Clarify kld_list format MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: crees X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 949eb16e3b4dff61fa99c0c0a8be49ba38bea053 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 Mar 2021 15:34:40 -0000 The branch stable/12 has been updated by crees (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=949eb16e3b4dff61fa99c0c0a8be49ba38bea053 commit 949eb16e3b4dff61fa99c0c0a8be49ba38bea053 Author: Chris Rees AuthorDate: 2018-12-24 10:47:48 +0000 Commit: Chris Rees CommitDate: 2021-03-03 15:34:09 +0000 Clarify kld_list format PR: docs/234248 Submitted by: David Fiander Submitted by: Miroslav Lachman (cherry picked from commit 261e62db4c62ecab7c8d8055b1a548acb80c16dc) --- share/man/man5/rc.conf.5 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index 25666f9810e0..fdb48845da26 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -258,12 +258,14 @@ A whitespace-separated list of kernel modules to be ignored by .Xr devmatch 8 . .It Va kld_list .Pq Vt str -A list of kernel modules to load right after the local -disks are mounted. +A whitespace-separated list of kernel modules to load right after +the local disks are mounted, without any +.Pa .ko +extension or path. Loading modules at this point in the boot process is much faster than doing it via .Pa /boot/loader.conf -for those modules not necessary for mounting local disk. +for those modules not necessary for mounting local disks. .It Va kldxref_enable .Pq Vt bool Set to From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 15:41:55 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 4959656DFDF; Wed, 3 Mar 2021 15:41:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DrJC71bHMz3wLS; Wed, 3 Mar 2021 15:41:55 +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 2821840E3; Wed, 3 Mar 2021 15:41: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 123FftdU084821; Wed, 3 Mar 2021 15:41:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 123FftBC084820; Wed, 3 Mar 2021 15:41:55 GMT (envelope-from git) Date: Wed, 3 Mar 2021 15:41:55 GMT Message-Id: <202103031541.123FftBC084820@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 2d379aed1e5c - releng/13.0 - copy_file_range(2): Fix for small values of input file offset and len MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 2d379aed1e5c52956c5257d286a781e9a32e68b3 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 Mar 2021 15:41:55 -0000 The branch releng/13.0 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=2d379aed1e5c52956c5257d286a781e9a32e68b3 commit 2d379aed1e5c52956c5257d286a781e9a32e68b3 Author: Rick Macklem AuthorDate: 2021-03-01 14:28:30 +0000 Commit: Rick Macklem CommitDate: 2021-03-03 15:40:39 +0000 copy_file_range(2): Fix for small values of input file offset and len r366302 broke copy_file_range(2) for small values of input file offset and len. It was possible for rem to be greater than len and then "len - rem" was a large value, since both variables are unsigned. Approved by: re (gjb) (cherry picked from commit a5f9fe2bab789f49e8b53da3a62dbd34725e23ea) --- sys/kern/vfs_vnops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 71dd379558cb..9ea792833255 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -3126,7 +3126,7 @@ vn_generic_copy_file_range(struct vnode *invp, off_t *inoffp, rem = *inoffp % blksize; if (rem > 0) rem = blksize - rem; - if (len - rem > blksize) + if (len > rem && len - rem > blksize) len = savlen = rounddown(len - rem, blksize) + rem; } From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 16: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 A771256F05A; Wed, 3 Mar 2021 16: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 4DrJyR1gtCz4TL5; Wed, 3 Mar 2021 16:15: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 2CA824C9C; Wed, 3 Mar 2021 16:15: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 123GFxiQ028934; Wed, 3 Mar 2021 16:15:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 123GFxgQ028933; Wed, 3 Mar 2021 16:15:59 GMT (envelope-from git) Date: Wed, 3 Mar 2021 16:15:59 GMT Message-Id: <202103031615.123GFxgQ028933@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: 0ae676239927 - stable/13 - armv8crypto: add missing newline 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: 0ae67623992788538b90b7c0e2882c4aa645a81f 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 Mar 2021 16:15:59 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=0ae67623992788538b90b7c0e2882c4aa645a81f commit 0ae67623992788538b90b7c0e2882c4aa645a81f Author: Elliott Mitchell AuthorDate: 2021-02-28 20:03:44 +0000 Commit: Mitchell Horne CommitDate: 2021-03-03 16:14:51 +0000 armv8crypto: add missing newline The missing newline mildly garbles boot-time messages and this can be troublesome if you need those. Reported by: Mike Karels (mike@karels.net) Reviewed By: gonzo (cherry picked from commit 530d38441d55b7ac62ebae6ac8ea76903a4a3b0c) --- sys/crypto/armv8/armv8_crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/crypto/armv8/armv8_crypto.c b/sys/crypto/armv8/armv8_crypto.c index be39168d50f3..24f6eff5608d 100644 --- a/sys/crypto/armv8/armv8_crypto.c +++ b/sys/crypto/armv8/armv8_crypto.c @@ -122,7 +122,7 @@ armv8_crypto_probe(device_t dev) default: break; case ID_AA64ISAR0_AES_NONE: - device_printf(dev, "CPU lacks AES instructions"); + device_printf(dev, "CPU lacks AES instructions\n"); break; } From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 16:28:23 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 68E6D56FBE2; Wed, 3 Mar 2021 16:28:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DrKDl2W1Qz4Vsv; Wed, 3 Mar 2021 16:28:23 +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 48C284F12; Wed, 3 Mar 2021 16:28:23 +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 123GSNk7043051; Wed, 3 Mar 2021 16:28:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 123GSNc2043050; Wed, 3 Mar 2021 16:28:23 GMT (envelope-from git) Date: Wed, 3 Mar 2021 16:28:23 GMT Message-Id: <202103031628.123GSNc2043050@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 3664067ea91a - releng/13.0 - nfsclient: fix panic in cache_enter_time() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 3664067ea91a5484e0f75c9938d559ec1134a565 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 Mar 2021 16:28:23 -0000 The branch releng/13.0 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=3664067ea91a5484e0f75c9938d559ec1134a565 commit 3664067ea91a5484e0f75c9938d559ec1134a565 Author: Rick Macklem AuthorDate: 2021-02-28 01:54:05 +0000 Commit: Rick Macklem CommitDate: 2021-03-03 16:27:06 +0000 nfsclient: fix panic in cache_enter_time() Juraj Lutter (otis@) reported a panic "dvp != vp not true" in cache_enter_time() called from the NFS client's nfsrpc_readdirplus() function. This is specific to an NFSv3 mount with the "rdirplus" mount option. Unlike NFSv4, NFSv3 replies to ReaddirPlus includes entries for the current directory. This trivial patch avoids doing a cache_enter_time() call for the current directory to avoid the panic. Approved by: re (gjb) (cherry picked from commit 3fe2c68ba20fb3365ef91e0b85f88237b5369f38) --- sys/fs/nfsclient/nfs_clrpcops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index b4f2d5301d13..c95d4dc58e7a 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -3761,6 +3761,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, ndp->ni_vp = newvp; NFSCNHASH(cnp, HASHINIT); if (cnp->cn_namelen <= NCHNAMLEN && + ndp->ni_dvp != ndp->ni_vp && (newvp->v_type != VDIR || dctime.tv_sec != 0)) { cache_enter_time(ndp->ni_dvp, From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 18:58: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 AC71454DD1C; Wed, 3 Mar 2021 18:58: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 4DrNZC4SRRz3C94; Wed, 3 Mar 2021 18:58: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 878E26E1E; Wed, 3 Mar 2021 18:58: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 123IwhlC041126; Wed, 3 Mar 2021 18:58:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 123Iwh8H041125; Wed, 3 Mar 2021 18:58:43 GMT (envelope-from git) Date: Wed, 3 Mar 2021 18:58:43 GMT Message-Id: <202103031858.123Iwh8H041125@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rajesh Kumar M A Subject: git: 2845cb445f76 - stable/13 - Update manpage for AMD 10GbE driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rajeshasp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2845cb445f76190aced1f81d174ef1d0a7d228c2 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 Mar 2021 18:58:43 -0000 The branch stable/13 has been updated by rajeshasp: URL: https://cgit.FreeBSD.org/src/commit/?id=2845cb445f76190aced1f81d174ef1d0a7d228c2 commit 2845cb445f76190aced1f81d174ef1d0a7d228c2 Author: Rajesh Kumar M A AuthorDate: 2021-02-24 05:01:10 +0000 Commit: Rajesh Kumar M A CommitDate: 2021-03-03 18:58:11 +0000 Update manpage for AMD 10GbE driver Approved by: vmaffione, gallatin Differential Revision: https://reviews.freebsd.org/D28724 (cherry picked from commit ec786886661ac8d6c41420c4460eba8461308e0b) --- share/man/man4/axp.4 | 196 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+) diff --git a/share/man/man4/axp.4 b/share/man/man4/axp.4 new file mode 100644 index 000000000000..41c2737bc7f1 --- /dev/null +++ b/share/man/man4/axp.4 @@ -0,0 +1,196 @@ +.\" 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 February 19, 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.link_workaround +This variable enables the workaround for an intermittent link issue. +When link does not come up for long time, this variable can be set to 1 to +reset the phy and bring up the link. +.El +.Sh LOADER TUNABLES +The following variable is available as +.Xr loader.conf 5 +tunable. +.Bl -tag -width indent +.It Va dev.ax.X.sph_enable +This variable controls split header feature for the interface. +Default is 1, meaning the split header support is enabled. +.Pp +This variable must be set before loading the driver, either via +.Xr loader.conf 5 +or through +.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 for all +.Nm +interfaces. +.Pp +To use netmap with this device, split header support must be disabled +(set this variable to 0). +.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 . From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 21:55: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 235C555225C; Wed, 3 Mar 2021 21:55: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 4DrSTs0Ss9z3NWP; Wed, 3 Mar 2021 21:55: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 F2C2A11465; Wed, 3 Mar 2021 21:55:12 +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 123LtCTe078135; Wed, 3 Mar 2021 21:55:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 123LtCoQ078134; Wed, 3 Mar 2021 21:55:12 GMT (envelope-from git) Date: Wed, 3 Mar 2021 21:55:12 GMT Message-Id: <202103032155.123LtCoQ078134@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: d2d99e6757fb - releng/13.0 - armv8crypto: add missing newline 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: d2d99e6757fb69f5b02711bba444774222ee9b3e 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 Mar 2021 21:55:13 -0000 The branch releng/13.0 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=d2d99e6757fb69f5b02711bba444774222ee9b3e commit d2d99e6757fb69f5b02711bba444774222ee9b3e Author: Elliott Mitchell AuthorDate: 2021-02-28 20:03:44 +0000 Commit: Mitchell Horne CommitDate: 2021-03-03 21:54:22 +0000 armv8crypto: add missing newline The missing newline mildly garbles boot-time messages and this can be troublesome if you need those. Reported by: Mike Karels (mike@karels.net) Reviewed by: gonzo Approved by: re (gjb) (cherry picked from commit 530d38441d55b7ac62ebae6ac8ea76903a4a3b0c) (cherry picked from commit 0ae67623992788538b90b7c0e2882c4aa645a81f) --- sys/crypto/armv8/armv8_crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/crypto/armv8/armv8_crypto.c b/sys/crypto/armv8/armv8_crypto.c index be39168d50f3..24f6eff5608d 100644 --- a/sys/crypto/armv8/armv8_crypto.c +++ b/sys/crypto/armv8/armv8_crypto.c @@ -122,7 +122,7 @@ armv8_crypto_probe(device_t dev) default: break; case ID_AA64ISAR0_AES_NONE: - device_printf(dev, "CPU lacks AES instructions"); + device_printf(dev, "CPU lacks AES instructions\n"); break; } From owner-dev-commits-src-branches@freebsd.org Wed Mar 3 21:55: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 2DE155522AF; Wed, 3 Mar 2021 21:55: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 4DrSTt0smqz3NT8; Wed, 3 Mar 2021 21:55: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 0DCB111733; Wed, 3 Mar 2021 21:55: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 123LtDxd078156; Wed, 3 Mar 2021 21:55:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 123LtDN2078154; Wed, 3 Mar 2021 21:55:13 GMT (envelope-from git) Date: Wed, 3 Mar 2021 21:55:13 GMT Message-Id: <202103032155.123LtDN2078154@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: 661e2b8e1486 - releng/13.0 - ddb: fix show devmap output on 32-bit arm 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 661e2b8e1486cc966304ff98f766463de07e3f02 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 Mar 2021 21:55:14 -0000 The branch releng/13.0 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=661e2b8e1486cc966304ff98f766463de07e3f02 commit 661e2b8e1486cc966304ff98f766463de07e3f02 Author: Thomas Skibo AuthorDate: 2021-01-11 20:58:12 +0000 Commit: Mitchell Horne CommitDate: 2021-03-03 21:54:45 +0000 ddb: fix show devmap output on 32-bit arm The output has been broken since 1b6dd6d772ca. Casting to uintmax_t before the call to printf is necessary to ensure that 32-bit addresses are interpreted correctly. PR: 243236 Approved by: re (gjb) (cherry picked from commit 9976b42b697ce203b1d257b2a6fe64c8a2961645) (cherry picked from commit 0a223cf980b5ef8bea726a843fe5a7faf2278330) --- sys/kern/subr_devmap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/kern/subr_devmap.c b/sys/kern/subr_devmap.c index 8e07199b7f73..23baceb05129 100644 --- a/sys/kern/subr_devmap.c +++ b/sys/kern/subr_devmap.c @@ -74,7 +74,9 @@ devmap_dump_table(int (*prfunc)(const char *, ...)) prfunc("Static device mappings:\n"); for (pd = devmap_table; pd->pd_size != 0; ++pd) { prfunc(" 0x%08jx - 0x%08jx mapped at VA 0x%08jx\n", - pd->pd_pa, pd->pd_pa + pd->pd_size - 1, pd->pd_va); + (uintmax_t)pd->pd_pa, + (uintmax_t)(pd->pd_pa + pd->pd_size - 1), + (uintmax_t)pd->pd_va); } } From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 01:32:55 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 07320559EED; Thu, 4 Mar 2021 01:32:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DrYK26rCgz4Qsj; Thu, 4 Mar 2021 01:32: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 DDA6514713; Thu, 4 Mar 2021 01:32: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 1241Ws1t068392; Thu, 4 Mar 2021 01:32:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1241WsZl068391; Thu, 4 Mar 2021 01:32:54 GMT (envelope-from git) Date: Thu, 4 Mar 2021 01:32:54 GMT Message-Id: <202103040132.1241WsZl068391@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 0dcfb6d761cc - stable/12 - getdirentries.2: fix for NFS mounts MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 0dcfb6d761ccc8bd45b68231f9a5f4ff4c6d989f 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 Mar 2021 01:32:55 -0000 The branch stable/12 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=0dcfb6d761ccc8bd45b68231f9a5f4ff4c6d989f commit 0dcfb6d761ccc8bd45b68231f9a5f4ff4c6d989f Author: Rick Macklem AuthorDate: 2021-02-15 02:16:58 +0000 Commit: Rick Macklem CommitDate: 2021-03-04 01:30:23 +0000 getdirentries.2: fix for NFS mounts It was reported that getdirentries(2) was returning dirents with d_off set to 0 for an NFS mount. This is believed to be correct behaviour at this time (it may change for some NFS mounts in the future), but is inconsistent with what the getdirentries(2) man page says. This patch fixes the man page. This is a content change. PR: 253428 (cherry picked from commit a0698341cd894ba4a640e9a9bb0f72c2133d1228) --- lib/libc/sys/getdirentries.2 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/libc/sys/getdirentries.2 b/lib/libc/sys/getdirentries.2 index f2d1c05240d5..658be9459af5 100644 --- a/lib/libc/sys/getdirentries.2 +++ b/lib/libc/sys/getdirentries.2 @@ -28,7 +28,7 @@ .\" @(#)getdirentries.2 8.2 (Berkeley) 5/3/95 .\" $FreeBSD$ .\" -.Dd March 30, 2020 +.Dd February 14, 2021 .Dt GETDIRENTRIES 2 .Os .Sh NAME @@ -89,7 +89,7 @@ have the same .Fa d_fileno . The .Fa d_off -field returns a cookie which can be used with +field returns a cookie which, if non-zero, can be used with .Xr lseek 2 to position the directory descriptor to the next entry. The @@ -148,14 +148,16 @@ only .Pc , a value returned in the .Fa d_off -field, +field if it is non-zero, or zero. .Sh IMPLEMENTATION NOTES The .Fa d_off -field is being used as a cookie to readdir for nfs servers. -These cookies can be cached and allow to read directory entries at a specific -offset on demand. +field is currently set to 0 by the NFS client, since the +directory offset cookies returned by an NFS server cannot +be used by +.Xr lseek 2 +at this time. .Sh RETURN VALUES If successful, the number of bytes actually transferred is returned. Otherwise, -1 is returned and the global variable From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 02:04: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 F349B55C690; Thu, 4 Mar 2021 02:04:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DrZ1M67yWz4TfV; Thu, 4 Mar 2021 02:04:23 +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 C5D451497B; Thu, 4 Mar 2021 02:04:23 +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 12424NT5008799; Thu, 4 Mar 2021 02:04:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12424N4a008798; Thu, 4 Mar 2021 02:04:23 GMT (envelope-from git) Date: Thu, 4 Mar 2021 02:04:23 GMT Message-Id: <202103040204.12424N4a008798@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: c4ccb6d1be1f - stable/13 - jail: allow root to implicitly widen its cpuset to attach 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: c4ccb6d1be1f00ebcda9e83f06db55f9d6c152ac 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 Mar 2021 02:04:24 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=c4ccb6d1be1f00ebcda9e83f06db55f9d6c152ac commit c4ccb6d1be1f00ebcda9e83f06db55f9d6c152ac Author: Kyle Evans AuthorDate: 2021-02-26 21:46:47 +0000 Commit: Kyle Evans CommitDate: 2021-03-04 02:04:10 +0000 jail: allow root to implicitly widen its cpuset to attach The default behavior for attaching processes to jails is that the jail's cpuset augments the attaching processes, so that it cannot be used to escalate a user's ability to take advantage of more CPUs than the administrator wanted them to. This is problematic when root needs to manage jails that have disjoint sets with whatever process is attaching, as this would otherwise result in a deadlock. Therefore, if we did not have an appropriate common subset of cpus/domains for our new policy, we now allow the process to simply take on the jail set *if* it has the privilege to widen its mask anyways. With the new logic, root can still usefully cpuset a process that attaches to a jail with the desire of maintaining the set it was given pre-attachment while still retaining the ability to manage child jails without jumping through hoops. A test has been added to demonstrate the issue; cpuset of a process down to just the first CPU and attempting to attach to a jail without access to any of the same CPUs previously resulted in EDEADLK and now results in taking on the jail's mask for privileged users. PR: 253724 (cherry picked from commit 60c4ec806dfd0f79edf8ca3abc04bbb69c0418f7) --- lib/libc/tests/sys/cpuset_test.c | 203 ++++++++++++++++++++++++++++++++++++++- sys/kern/kern_cpuset.c | 8 ++ 2 files changed, 210 insertions(+), 1 deletion(-) diff --git a/lib/libc/tests/sys/cpuset_test.c b/lib/libc/tests/sys/cpuset_test.c index d6dd69e7e3c1..52c0dc877ab8 100644 --- a/lib/libc/tests/sys/cpuset_test.c +++ b/lib/libc/tests/sys/cpuset_test.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2020 Kyle Evans + * Copyright (c) 2020-2021 Kyle Evans * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,6 +31,8 @@ __FBSDID("$FreeBSD"); #include #include #include +#include +#include #include #include #include @@ -64,6 +66,10 @@ typedef void (*jail_test_cb)(struct jail_test_cb_params *); #define FAILURE_JAILSET 44 #define FAILURE_PIDSET 45 #define FAILURE_SEND 46 +#define FAILURE_DEADLK 47 +#define FAILURE_ATTACH 48 +#define FAILURE_BADAFFIN 49 +#define FAILURE_SUCCESS 50 static const char * do_jail_errstr(int error) @@ -80,6 +86,14 @@ do_jail_errstr(int error) return ("Failed to get the pid setid"); case FAILURE_SEND: return ("Failed to send(2) cpuset information"); + case FAILURE_DEADLK: + return ("Deadlock hit trying to attach to jail"); + case FAILURE_ATTACH: + return ("jail_attach(2) failed"); + case FAILURE_BADAFFIN: + return ("Unexpected post-attach affinity"); + case FAILURE_SUCCESS: + return ("jail_attach(2) succeeded, but should have failed."); default: return (NULL); } @@ -444,6 +458,192 @@ ATF_TC_BODY(jail_attach_plain, tc) do_jail_test(1, false, &jail_attach_plain_pro, &jail_attach_jset_epi); } +static int +jail_attach_disjoint_newjail(int fd) +{ + struct iovec iov[2]; + char *name; + int jid; + + if (asprintf(&name, "cpuset_%d", getpid()) == -1) + _exit(42); + + iov[0].iov_base = "name"; + iov[0].iov_len = sizeof("name"); + + iov[1].iov_base = name; + iov[1].iov_len = strlen(name) + 1; + + if ((jid = jail_set(iov, 2, JAIL_CREATE | JAIL_ATTACH)) < 0) + return (FAILURE_JAIL); + + /* Signal that we're ready. */ + write(fd, &jid, sizeof(jid)); + for (;;) { + /* Spin */ + } +} + +static int +wait_jail(int fd, int pfd) +{ + fd_set lset; + struct timeval tv; + int error, jid, maxfd; + + FD_ZERO(&lset); + FD_SET(fd, &lset); + FD_SET(pfd, &lset); + + maxfd = MAX(fd, pfd); + + tv.tv_sec = 5; + tv.tv_usec = 0; + + /* Wait for jid to be written. */ + do { + error = select(maxfd + 1, &lset, NULL, NULL, &tv); + } while (error == -1 && errno == EINTR); + + if (error == 0) { + atf_tc_fail("Jail creator did not respond in time."); + } + + ATF_REQUIRE_MSG(error > 0, "Unexpected error %d from select()", errno); + + if (FD_ISSET(pfd, &lset)) { + /* Process died */ + atf_tc_fail("Jail creator died unexpectedly."); + } + + ATF_REQUIRE(FD_ISSET(fd, &lset)); + ATF_REQUIRE_EQ(sizeof(jid), recv(fd, &jid, sizeof(jid), 0)); + + return (jid); +} + +static int +try_attach_child(int jid, cpuset_t *expected_mask) +{ + cpuset_t mask; + + if (jail_attach(jid) == -1) { + if (errno == EDEADLK) + return (FAILURE_DEADLK); + return (FAILURE_ATTACH); + } + + if (expected_mask == NULL) + return (FAILURE_SUCCESS); + + /* If we had an expected mask, check it against the new process mask. */ + CPU_ZERO(&mask); + if (cpuset_getaffinity(CPU_LEVEL_CPUSET, CPU_WHICH_PID, + -1, sizeof(mask), &mask) != 0) { + return (FAILURE_MASK); + } + + if (CPU_CMP(expected_mask, &mask) != 0) + return (FAILURE_BADAFFIN); + + return (0); +} + +static void +try_attach(int jid, cpuset_t *expected_mask) +{ + const char *errstr; + pid_t pid; + int error, fail, status; + + ATF_REQUIRE(expected_mask != NULL); + ATF_REQUIRE((pid = fork()) != -1); + if (pid == 0) + _exit(try_attach_child(jid, expected_mask)); + + while ((error = waitpid(pid, &status, 0)) == -1 && errno == EINTR) { + /* Try again. */ + } + + /* Sanity check the exit info. */ + ATF_REQUIRE_EQ(pid, error); + ATF_REQUIRE(WIFEXITED(status)); + if ((fail = WEXITSTATUS(status)) != 0) { + errstr = do_jail_errstr(fail); + if (errstr != NULL) + atf_tc_fail("%s", errstr); + else + atf_tc_fail("Unknown error '%d'", WEXITSTATUS(status)); + } +} + +ATF_TC(jail_attach_disjoint); +ATF_TC_HEAD(jail_attach_disjoint, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test root attachment into completely disjoint jail cpuset."); + atf_tc_set_md_var(tc, "require.user", "root"); +} +ATF_TC_BODY(jail_attach_disjoint, tc) +{ + cpuset_t smask, jmask; + int sockpair[2]; + cpusetid_t setid; + pid_t pid; + int fcpu, jid, pfd, sock, scpu; + + ATF_REQUIRE_EQ(0, cpuset(&setid)); + + skip_ltncpu(2, &jmask); + fcpu = CPU_FFS(&jmask) - 1; + ATF_REQUIRE_EQ(0, socketpair(PF_UNIX, SOCK_STREAM, 0, sockpair)); + + /* We'll wait on the procdesc, too, so we can fail faster if it dies. */ + ATF_REQUIRE((pid = pdfork(&pfd, 0)) != -1); + + if (pid == 0) { + /* First child sets up the jail. */ + sock = sockpair[SP_CHILD]; + close(sockpair[SP_PARENT]); + + _exit(jail_attach_disjoint_newjail(sock)); + } + + close(sockpair[SP_CHILD]); + sock = sockpair[SP_PARENT]; + + ATF_REQUIRE((jid = wait_jail(sock, pfd)) > 0); + + /* + * This process will be clamped down to the first cpu, while the jail + * will simply have the first CPU removed to make it a completely + * disjoint operation. + */ + CPU_ZERO(&smask); + CPU_SET(fcpu, &smask); + CPU_CLR(fcpu, &jmask); + + /* + * We'll test with the first and second cpu set as well. Only the + * second cpu should be used. + */ + scpu = CPU_FFS(&jmask) - 1; + + ATF_REQUIRE_EQ(0, cpuset_setaffinity(CPU_LEVEL_ROOT, CPU_WHICH_JAIL, + jid, sizeof(jmask), &jmask)); + ATF_REQUIRE_EQ(0, cpuset_setaffinity(CPU_LEVEL_CPUSET, CPU_WHICH_CPUSET, + setid, sizeof(smask), &smask)); + + try_attach(jid, &jmask); + + CPU_SET(scpu, &smask); + ATF_REQUIRE_EQ(0, cpuset_setaffinity(CPU_LEVEL_CPUSET, CPU_WHICH_CPUSET, + setid, sizeof(smask), &smask)); + + CPU_CLR(fcpu, &smask); + try_attach(jid, &smask); +} + ATF_TC(badparent); ATF_TC_HEAD(badparent, tc) { @@ -488,6 +688,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, jail_attach_newbase_plain); ATF_TP_ADD_TC(tp, jail_attach_prevbase); ATF_TP_ADD_TC(tp, jail_attach_plain); + ATF_TP_ADD_TC(tp, jail_attach_disjoint); ATF_TP_ADD_TC(tp, badparent); return (atf_no_error()); } diff --git a/sys/kern/kern_cpuset.c b/sys/kern/kern_cpuset.c index 18cc0c56d697..19ad3fd20955 100644 --- a/sys/kern/kern_cpuset.c +++ b/sys/kern/kern_cpuset.c @@ -1255,6 +1255,11 @@ cpuset_setproc(pid_t pid, struct cpuset *set, cpuset_t *mask, * as the parent, then we'll check if the process was previously using * the root set and, if it wasn't, create a new base with the process's * mask applied to it. + * + * If the new root is incompatible with the existing mask, then we allow + * the process to take on the new root if and only if they have + * privilege to widen their mask anyways. Unprivileged processes get + * rejected with EDEADLK. */ if (set != NULL && rebase && nroot != tdroot) { cpusetid_t base_id, root_id; @@ -1265,6 +1270,9 @@ cpuset_setproc(pid_t pid, struct cpuset *set, cpuset_t *mask, if (base_id != root_id) { error = cpuset_setproc_newbase(td, set, nroot, &base, &freelist, &domainlist); + if (error == EDEADLK && + priv_check(td, PRIV_SCHED_CPUSET) == 0) + error = 0; if (error != 0) goto unlock_out; } From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 02:42: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 094E455E75C; Thu, 4 Mar 2021 02:42: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 4DrZry6vlMz4X5j; Thu, 4 Mar 2021 02:42: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 E0349154ED; Thu, 4 Mar 2021 02:42: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 1242gAdb060454; Thu, 4 Mar 2021 02:42:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1242gA3Y060453; Thu, 4 Mar 2021 02:42:10 GMT (envelope-from git) Date: Thu, 4 Mar 2021 02:42:10 GMT Message-Id: <202103040242.1242gA3Y060453@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: 5fdc5c5dbac4 - releng/13.0 - jail: allow root to implicitly widen its cpuset to attach 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 5fdc5c5dbac400a2ff05820ba8a63cdec8603c92 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 Mar 2021 02:42:11 -0000 The branch releng/13.0 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=5fdc5c5dbac400a2ff05820ba8a63cdec8603c92 commit 5fdc5c5dbac400a2ff05820ba8a63cdec8603c92 Author: Kyle Evans AuthorDate: 2021-02-26 21:46:47 +0000 Commit: Kyle Evans CommitDate: 2021-03-04 02:41:48 +0000 jail: allow root to implicitly widen its cpuset to attach The default behavior for attaching processes to jails is that the jail's cpuset augments the attaching processes, so that it cannot be used to escalate a user's ability to take advantage of more CPUs than the administrator wanted them to. This is problematic when root needs to manage jails that have disjoint sets with whatever process is attaching, as this would otherwise result in a deadlock. Therefore, if we did not have an appropriate common subset of cpus/domains for our new policy, we now allow the process to simply take on the jail set *if* it has the privilege to widen its mask anyways. With the new logic, root can still usefully cpuset a process that attaches to a jail with the desire of maintaining the set it was given pre-attachment while still retaining the ability to manage child jails without jumping through hoops. A test has been added to demonstrate the issue; cpuset of a process down to just the first CPU and attempting to attach to a jail without access to any of the same CPUs previously resulted in EDEADLK and now results in taking on the jail's mask for privileged users. PR: 253724 Approved by: re (gjb) (cherry picked from commit 60c4ec806dfd0f79edf8ca3abc04bbb69c0418f7) (cherry picked from commit c4ccb6d1be1f00ebcda9e83f06db55f9d6c152ac) --- lib/libc/tests/sys/cpuset_test.c | 203 ++++++++++++++++++++++++++++++++++++++- sys/kern/kern_cpuset.c | 8 ++ 2 files changed, 210 insertions(+), 1 deletion(-) diff --git a/lib/libc/tests/sys/cpuset_test.c b/lib/libc/tests/sys/cpuset_test.c index d6dd69e7e3c1..52c0dc877ab8 100644 --- a/lib/libc/tests/sys/cpuset_test.c +++ b/lib/libc/tests/sys/cpuset_test.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2020 Kyle Evans + * Copyright (c) 2020-2021 Kyle Evans * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,6 +31,8 @@ __FBSDID("$FreeBSD"); #include #include #include +#include +#include #include #include #include @@ -64,6 +66,10 @@ typedef void (*jail_test_cb)(struct jail_test_cb_params *); #define FAILURE_JAILSET 44 #define FAILURE_PIDSET 45 #define FAILURE_SEND 46 +#define FAILURE_DEADLK 47 +#define FAILURE_ATTACH 48 +#define FAILURE_BADAFFIN 49 +#define FAILURE_SUCCESS 50 static const char * do_jail_errstr(int error) @@ -80,6 +86,14 @@ do_jail_errstr(int error) return ("Failed to get the pid setid"); case FAILURE_SEND: return ("Failed to send(2) cpuset information"); + case FAILURE_DEADLK: + return ("Deadlock hit trying to attach to jail"); + case FAILURE_ATTACH: + return ("jail_attach(2) failed"); + case FAILURE_BADAFFIN: + return ("Unexpected post-attach affinity"); + case FAILURE_SUCCESS: + return ("jail_attach(2) succeeded, but should have failed."); default: return (NULL); } @@ -444,6 +458,192 @@ ATF_TC_BODY(jail_attach_plain, tc) do_jail_test(1, false, &jail_attach_plain_pro, &jail_attach_jset_epi); } +static int +jail_attach_disjoint_newjail(int fd) +{ + struct iovec iov[2]; + char *name; + int jid; + + if (asprintf(&name, "cpuset_%d", getpid()) == -1) + _exit(42); + + iov[0].iov_base = "name"; + iov[0].iov_len = sizeof("name"); + + iov[1].iov_base = name; + iov[1].iov_len = strlen(name) + 1; + + if ((jid = jail_set(iov, 2, JAIL_CREATE | JAIL_ATTACH)) < 0) + return (FAILURE_JAIL); + + /* Signal that we're ready. */ + write(fd, &jid, sizeof(jid)); + for (;;) { + /* Spin */ + } +} + +static int +wait_jail(int fd, int pfd) +{ + fd_set lset; + struct timeval tv; + int error, jid, maxfd; + + FD_ZERO(&lset); + FD_SET(fd, &lset); + FD_SET(pfd, &lset); + + maxfd = MAX(fd, pfd); + + tv.tv_sec = 5; + tv.tv_usec = 0; + + /* Wait for jid to be written. */ + do { + error = select(maxfd + 1, &lset, NULL, NULL, &tv); + } while (error == -1 && errno == EINTR); + + if (error == 0) { + atf_tc_fail("Jail creator did not respond in time."); + } + + ATF_REQUIRE_MSG(error > 0, "Unexpected error %d from select()", errno); + + if (FD_ISSET(pfd, &lset)) { + /* Process died */ + atf_tc_fail("Jail creator died unexpectedly."); + } + + ATF_REQUIRE(FD_ISSET(fd, &lset)); + ATF_REQUIRE_EQ(sizeof(jid), recv(fd, &jid, sizeof(jid), 0)); + + return (jid); +} + +static int +try_attach_child(int jid, cpuset_t *expected_mask) +{ + cpuset_t mask; + + if (jail_attach(jid) == -1) { + if (errno == EDEADLK) + return (FAILURE_DEADLK); + return (FAILURE_ATTACH); + } + + if (expected_mask == NULL) + return (FAILURE_SUCCESS); + + /* If we had an expected mask, check it against the new process mask. */ + CPU_ZERO(&mask); + if (cpuset_getaffinity(CPU_LEVEL_CPUSET, CPU_WHICH_PID, + -1, sizeof(mask), &mask) != 0) { + return (FAILURE_MASK); + } + + if (CPU_CMP(expected_mask, &mask) != 0) + return (FAILURE_BADAFFIN); + + return (0); +} + +static void +try_attach(int jid, cpuset_t *expected_mask) +{ + const char *errstr; + pid_t pid; + int error, fail, status; + + ATF_REQUIRE(expected_mask != NULL); + ATF_REQUIRE((pid = fork()) != -1); + if (pid == 0) + _exit(try_attach_child(jid, expected_mask)); + + while ((error = waitpid(pid, &status, 0)) == -1 && errno == EINTR) { + /* Try again. */ + } + + /* Sanity check the exit info. */ + ATF_REQUIRE_EQ(pid, error); + ATF_REQUIRE(WIFEXITED(status)); + if ((fail = WEXITSTATUS(status)) != 0) { + errstr = do_jail_errstr(fail); + if (errstr != NULL) + atf_tc_fail("%s", errstr); + else + atf_tc_fail("Unknown error '%d'", WEXITSTATUS(status)); + } +} + +ATF_TC(jail_attach_disjoint); +ATF_TC_HEAD(jail_attach_disjoint, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test root attachment into completely disjoint jail cpuset."); + atf_tc_set_md_var(tc, "require.user", "root"); +} +ATF_TC_BODY(jail_attach_disjoint, tc) +{ + cpuset_t smask, jmask; + int sockpair[2]; + cpusetid_t setid; + pid_t pid; + int fcpu, jid, pfd, sock, scpu; + + ATF_REQUIRE_EQ(0, cpuset(&setid)); + + skip_ltncpu(2, &jmask); + fcpu = CPU_FFS(&jmask) - 1; + ATF_REQUIRE_EQ(0, socketpair(PF_UNIX, SOCK_STREAM, 0, sockpair)); + + /* We'll wait on the procdesc, too, so we can fail faster if it dies. */ + ATF_REQUIRE((pid = pdfork(&pfd, 0)) != -1); + + if (pid == 0) { + /* First child sets up the jail. */ + sock = sockpair[SP_CHILD]; + close(sockpair[SP_PARENT]); + + _exit(jail_attach_disjoint_newjail(sock)); + } + + close(sockpair[SP_CHILD]); + sock = sockpair[SP_PARENT]; + + ATF_REQUIRE((jid = wait_jail(sock, pfd)) > 0); + + /* + * This process will be clamped down to the first cpu, while the jail + * will simply have the first CPU removed to make it a completely + * disjoint operation. + */ + CPU_ZERO(&smask); + CPU_SET(fcpu, &smask); + CPU_CLR(fcpu, &jmask); + + /* + * We'll test with the first and second cpu set as well. Only the + * second cpu should be used. + */ + scpu = CPU_FFS(&jmask) - 1; + + ATF_REQUIRE_EQ(0, cpuset_setaffinity(CPU_LEVEL_ROOT, CPU_WHICH_JAIL, + jid, sizeof(jmask), &jmask)); + ATF_REQUIRE_EQ(0, cpuset_setaffinity(CPU_LEVEL_CPUSET, CPU_WHICH_CPUSET, + setid, sizeof(smask), &smask)); + + try_attach(jid, &jmask); + + CPU_SET(scpu, &smask); + ATF_REQUIRE_EQ(0, cpuset_setaffinity(CPU_LEVEL_CPUSET, CPU_WHICH_CPUSET, + setid, sizeof(smask), &smask)); + + CPU_CLR(fcpu, &smask); + try_attach(jid, &smask); +} + ATF_TC(badparent); ATF_TC_HEAD(badparent, tc) { @@ -488,6 +688,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, jail_attach_newbase_plain); ATF_TP_ADD_TC(tp, jail_attach_prevbase); ATF_TP_ADD_TC(tp, jail_attach_plain); + ATF_TP_ADD_TC(tp, jail_attach_disjoint); ATF_TP_ADD_TC(tp, badparent); return (atf_no_error()); } diff --git a/sys/kern/kern_cpuset.c b/sys/kern/kern_cpuset.c index 18cc0c56d697..19ad3fd20955 100644 --- a/sys/kern/kern_cpuset.c +++ b/sys/kern/kern_cpuset.c @@ -1255,6 +1255,11 @@ cpuset_setproc(pid_t pid, struct cpuset *set, cpuset_t *mask, * as the parent, then we'll check if the process was previously using * the root set and, if it wasn't, create a new base with the process's * mask applied to it. + * + * If the new root is incompatible with the existing mask, then we allow + * the process to take on the new root if and only if they have + * privilege to widen their mask anyways. Unprivileged processes get + * rejected with EDEADLK. */ if (set != NULL && rebase && nroot != tdroot) { cpusetid_t base_id, root_id; @@ -1265,6 +1270,9 @@ cpuset_setproc(pid_t pid, struct cpuset *set, cpuset_t *mask, if (base_id != root_id) { error = cpuset_setproc_newbase(td, set, nroot, &base, &freelist, &domainlist); + if (error == EDEADLK && + priv_check(td, PRIV_SCHED_CPUSET) == 0) + error = 0; if (error != 0) goto unlock_out; } From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 08:27: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 A735E566659; Thu, 4 Mar 2021 08:27: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 4DrkWy4Ksdz4pfZ; Thu, 4 Mar 2021 08:27: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 87CE819E53; Thu, 4 Mar 2021 08:27: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 1248RwNu013528; Thu, 4 Mar 2021 08:27:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1248Rw69013527; Thu, 4 Mar 2021 08:27:58 GMT (envelope-from git) Date: Thu, 4 Mar 2021 08:27:58 GMT Message-Id: <202103040827.1248Rw69013527@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Richard Scheffenegger Subject: git: 05e742af6f54 - stable/13 - calculate prr_out correctly when pipe < ssthresh MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 05e742af6f548364909ed671f0b3774e54dc77d1 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 Mar 2021 08:27:58 -0000 The branch stable/13 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=05e742af6f548364909ed671f0b3774e54dc77d1 commit 05e742af6f548364909ed671f0b3774e54dc77d1 Author: Richard Scheffenegger AuthorDate: 2021-03-01 15:25:46 +0000 Commit: Richard Scheffenegger CommitDate: 2021-03-04 08:13:51 +0000 calculate prr_out correctly when pipe < ssthresh Reviewed By: #transport, tuexen MFC after: 3 days Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D28998 (cherry picked from commit 0b0f8b359d0b94b09cfec35e5d5de01b23c7fbf1) --- sys/netinet/tcp_input.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index f7ef3ed81da2..0cb99ce8f2c5 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -2606,10 +2606,12 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, } else { if (V_tcp_do_prr_conservative) limit = tp->sackhint.prr_delivered - - tp->sackhint.sack_bytes_rexmit; + (tp->sackhint.sack_bytes_rexmit + + (tp->snd_nxt - tp->snd_recover)); else limit = imax(tp->sackhint.prr_delivered - - tp->sackhint.sack_bytes_rexmit, + (tp->sackhint.sack_bytes_rexmit + + (tp->snd_nxt - tp->snd_recover)), del_data) + maxseg; snd_cnt = imin(tp->snd_ssthresh - pipe, limit); } @@ -3982,10 +3984,12 @@ tcp_prr_partialack(struct tcpcb *tp, struct tcphdr *th) } else { if (V_tcp_do_prr_conservative) limit = tp->sackhint.prr_delivered - - tp->sackhint.sack_bytes_rexmit; + (tp->sackhint.sack_bytes_rexmit + + (tp->snd_nxt - tp->snd_recover)); else limit = imax(tp->sackhint.prr_delivered - - tp->sackhint.sack_bytes_rexmit, + (tp->sackhint.sack_bytes_rexmit + + (tp->snd_nxt - tp->snd_recover)), del_data) + maxseg; snd_cnt = imin((tp->snd_ssthresh - pipe), limit); } From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 09:20: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 4DF0C569196; Thu, 4 Mar 2021 09:20: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 4DrlhT1QRWz4tV1; Thu, 4 Mar 2021 09:20: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 23D381A833; Thu, 4 Mar 2021 09:20: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 1249KP1K087434; Thu, 4 Mar 2021 09:20:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1249KPho087433; Thu, 4 Mar 2021 09:20:25 GMT (envelope-from git) Date: Thu, 4 Mar 2021 09:20:25 GMT Message-Id: <202103040920.1249KPho087433@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Andrey V. Elsukov" Subject: git: 8d0f1438b0d7 - stable/13 - ipfw: make algo name argument optional for some table types MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ae X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8d0f1438b0d73dfa880cfafc5d09beb4e7100a3f 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 Mar 2021 09:20:25 -0000 The branch stable/13 has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=8d0f1438b0d73dfa880cfafc5d09beb4e7100a3f commit 8d0f1438b0d73dfa880cfafc5d09beb4e7100a3f Author: Andrey V. Elsukov AuthorDate: 2021-02-25 13:57:47 +0000 Commit: Andrey V. Elsukov CommitDate: 2021-03-04 09:19:31 +0000 ipfw: make algo name argument optional for some table types Most of table types currently supported by ipfw have only one algorithm implementation. When user creates such tables, allow to omit algo name in arguments. E.g. now it is possible: ipfw table T1 create type number ipfw table T2 create type iface ipfw table T3 create type flow PR: 233072 Sponsored by: Yandex LLC (cherry picked from commit 13ad237a19b7368124483d9d1dc3258c27880fef) --- sbin/ipfw/tables.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/sbin/ipfw/tables.c b/sbin/ipfw/tables.c index 57b8cef00889..81cf7e392586 100644 --- a/sbin/ipfw/tables.c +++ b/sbin/ipfw/tables.c @@ -83,6 +83,15 @@ static struct _s_x tabletypes[] = { { NULL, 0 } }; +/* Default algorithms for various table types */ +static struct _s_x tablealgos[] = { + { "addr:radix", IPFW_TABLE_ADDR }, + { "flow:hash", IPFW_TABLE_FLOW }, + { "iface:array", IPFW_TABLE_INTERFACE }, + { "number:array", IPFW_TABLE_NUMBER }, + { NULL, 0 } +}; + static struct _s_x tablevaltypes[] = { { "skipto", IPFW_VTYPE_SKIPTO }, { "pipe", IPFW_VTYPE_PIPE }, @@ -468,8 +477,15 @@ table_create(ipfw_obj_header *oh, int ac, char *av[]) } /* Set some defaults to preserve compatibility. */ - if (xi.algoname[0] == '\0' && xi.type == 0) - xi.type = IPFW_TABLE_ADDR; + if (xi.algoname[0] == '\0') { + const char *algo; + + if (xi.type == 0) + xi.type = IPFW_TABLE_ADDR; + algo = match_value(tablealgos, xi.type); + if (algo != NULL) + strlcpy(xi.algoname, algo, sizeof(xi.algoname)); + } if (xi.vmask == 0) xi.vmask = IPFW_VTYPE_LEGACY; From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 09:22: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 D121556938B; Thu, 4 Mar 2021 09:22: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 4DrlkP5VtKz4tnm; Thu, 4 Mar 2021 09:22: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 AFC771A859; Thu, 4 Mar 2021 09:22: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 1249M5WI092334; Thu, 4 Mar 2021 09:22:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1249M5Le092333; Thu, 4 Mar 2021 09:22:05 GMT (envelope-from git) Date: Thu, 4 Mar 2021 09:22:05 GMT Message-Id: <202103040922.1249M5Le092333@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Andrey V. Elsukov" Subject: git: f8317f3a4c7d - stable/12 - ipfw: make algo name argument optional for some table types MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ae X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f8317f3a4c7dc01438328edd21c984d794286ec5 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 Mar 2021 09:22:05 -0000 The branch stable/12 has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=f8317f3a4c7dc01438328edd21c984d794286ec5 commit f8317f3a4c7dc01438328edd21c984d794286ec5 Author: Andrey V. Elsukov AuthorDate: 2021-02-25 13:57:47 +0000 Commit: Andrey V. Elsukov CommitDate: 2021-03-04 09:21:28 +0000 ipfw: make algo name argument optional for some table types Most of table types currently supported by ipfw have only one algorithm implementation. When user creates such tables, allow to omit algo name in arguments. E.g. now it is possible: ipfw table T1 create type number ipfw table T2 create type iface ipfw table T3 create type flow PR: 233072 Sponsored by: Yandex LLC (cherry picked from commit 13ad237a19b7368124483d9d1dc3258c27880fef) --- sbin/ipfw/tables.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/sbin/ipfw/tables.c b/sbin/ipfw/tables.c index 57b8cef00889..81cf7e392586 100644 --- a/sbin/ipfw/tables.c +++ b/sbin/ipfw/tables.c @@ -83,6 +83,15 @@ static struct _s_x tabletypes[] = { { NULL, 0 } }; +/* Default algorithms for various table types */ +static struct _s_x tablealgos[] = { + { "addr:radix", IPFW_TABLE_ADDR }, + { "flow:hash", IPFW_TABLE_FLOW }, + { "iface:array", IPFW_TABLE_INTERFACE }, + { "number:array", IPFW_TABLE_NUMBER }, + { NULL, 0 } +}; + static struct _s_x tablevaltypes[] = { { "skipto", IPFW_VTYPE_SKIPTO }, { "pipe", IPFW_VTYPE_PIPE }, @@ -468,8 +477,15 @@ table_create(ipfw_obj_header *oh, int ac, char *av[]) } /* Set some defaults to preserve compatibility. */ - if (xi.algoname[0] == '\0' && xi.type == 0) - xi.type = IPFW_TABLE_ADDR; + if (xi.algoname[0] == '\0') { + const char *algo; + + if (xi.type == 0) + xi.type = IPFW_TABLE_ADDR; + algo = match_value(tablealgos, xi.type); + if (algo != NULL) + strlcpy(xi.algoname, algo, sizeof(xi.algoname)); + } if (xi.vmask == 0) xi.vmask = IPFW_VTYPE_LEGACY; From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 09:24:19 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 5A3425696DA; Thu, 4 Mar 2021 09:24:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Drlmz25kDz4v11; Thu, 4 Mar 2021 09:24:19 +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 3AE001AB9B; Thu, 4 Mar 2021 09:24:19 +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 1249OJ0H092799; Thu, 4 Mar 2021 09:24:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1249OJrE092797; Thu, 4 Mar 2021 09:24:19 GMT (envelope-from git) Date: Thu, 4 Mar 2021 09:24:19 GMT Message-Id: <202103040924.1249OJrE092797@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Andrey V. Elsukov" Subject: git: 952ad2822359 - stable/11 - ipfw: make algo name argument optional for some table types MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ae X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 952ad28223596ef4e323a9a7da81ef3faf1c919a 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 Mar 2021 09:24:19 -0000 The branch stable/11 has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=952ad28223596ef4e323a9a7da81ef3faf1c919a commit 952ad28223596ef4e323a9a7da81ef3faf1c919a Author: Andrey V. Elsukov AuthorDate: 2021-02-25 13:57:47 +0000 Commit: Andrey V. Elsukov CommitDate: 2021-03-04 09:23:01 +0000 ipfw: make algo name argument optional for some table types Most of table types currently supported by ipfw have only one algorithm implementation. When user creates such tables, allow to omit algo name in arguments. E.g. now it is possible: ipfw table T1 create type number ipfw table T2 create type iface ipfw table T3 create type flow PR: 233072 Sponsored by: Yandex LLC (cherry picked from commit 13ad237a19b7368124483d9d1dc3258c27880fef) --- sbin/ipfw/tables.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/sbin/ipfw/tables.c b/sbin/ipfw/tables.c index e914ad63343c..12e5a4cc435f 100644 --- a/sbin/ipfw/tables.c +++ b/sbin/ipfw/tables.c @@ -83,6 +83,15 @@ static struct _s_x tabletypes[] = { { NULL, 0 } }; +/* Default algorithms for various table types */ +static struct _s_x tablealgos[] = { + { "addr:radix", IPFW_TABLE_ADDR }, + { "flow:hash", IPFW_TABLE_FLOW }, + { "iface:array", IPFW_TABLE_INTERFACE }, + { "number:array", IPFW_TABLE_NUMBER }, + { NULL, 0 } +}; + static struct _s_x tablevaltypes[] = { { "skipto", IPFW_VTYPE_SKIPTO }, { "pipe", IPFW_VTYPE_PIPE }, @@ -469,8 +478,15 @@ table_create(ipfw_obj_header *oh, int ac, char *av[]) } /* Set some defaults to preserve compatibility. */ - if (xi.algoname[0] == '\0' && xi.type == 0) - xi.type = IPFW_TABLE_ADDR; + if (xi.algoname[0] == '\0') { + const char *algo; + + if (xi.type == 0) + xi.type = IPFW_TABLE_ADDR; + algo = match_value(tablealgos, xi.type); + if (algo != NULL) + strlcpy(xi.algoname, algo, sizeof(xi.algoname)); + } if (xi.vmask == 0) xi.vmask = IPFW_VTYPE_LEGACY; From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 09:33: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 39DE2569FE3; Thu, 4 Mar 2021 09:33: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 4DrlzP19Yfz3Bmf; Thu, 4 Mar 2021 09:33: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 1B3321AB7A; Thu, 4 Mar 2021 09:33: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 1249XLBN005906; Thu, 4 Mar 2021 09:33:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1249XL6Y005905; Thu, 4 Mar 2021 09:33:21 GMT (envelope-from git) Date: Thu, 4 Mar 2021 09:33:21 GMT Message-Id: <202103040933.1249XL6Y005905@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: e7705585fed8 - stable/12 - bridgestp: Ensure we send STP on VLAN interfaces 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: e7705585fed8ef9612388729a4e3247ceed3f038 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 Mar 2021 09:33:21 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e7705585fed8ef9612388729a4e3247ceed3f038 commit e7705585fed8ef9612388729a4e3247ceed3f038 Author: Kristof Provost AuthorDate: 2021-02-24 15:38:53 +0000 Commit: Kristof Provost CommitDate: 2021-03-04 09:30:26 +0000 bridgestp: Ensure we send STP on VLAN interfaces Reviewed by: donner@ MFC after: 1 week X-MFC-with: 711ed156b94562c3dcb2ee9c1b3f240f960a75d2 Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D28916 (cherry picked from commit f5537cd0693c85efdb2180a0a107c51eae15ba39) --- sys/net/bridgestp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/bridgestp.c b/sys/net/bridgestp.c index d0259c37bf84..4be8e2f20819 100644 --- a/sys/net/bridgestp.c +++ b/sys/net/bridgestp.c @@ -2046,7 +2046,7 @@ bstp_reinit(struct bstp_state *bs) */ IFNET_RLOCK_NOSLEEP(); CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) { - if (ifp->if_type != IFT_ETHER) + if (ifp->if_type != IFT_ETHER && ifp->if_type != IFT_L2VLAN) continue; /* Not Ethernet */ if (ifp->if_bridge != bridgeptr) From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 09:33:23 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 22DE9569D42; Thu, 4 Mar 2021 09:33:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DrlzQ6DMRz3Bml; Thu, 4 Mar 2021 09:33:22 +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 B5DFD1ABC3; Thu, 4 Mar 2021 09:33:22 +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 1249XM9w006002; Thu, 4 Mar 2021 09:33:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1249XMah006001; Thu, 4 Mar 2021 09:33:22 GMT (envelope-from git) Date: Thu, 4 Mar 2021 09:33:22 GMT Message-Id: <202103040933.1249XMah006001@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: 772b39d6309b - stable/13 - bridgestp: Ensure we send STP on VLAN interfaces 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: 772b39d6309b1d62934870869e65f5334f6af79c 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 Mar 2021 09:33:23 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=772b39d6309b1d62934870869e65f5334f6af79c commit 772b39d6309b1d62934870869e65f5334f6af79c Author: Kristof Provost AuthorDate: 2021-02-24 15:38:53 +0000 Commit: Kristof Provost CommitDate: 2021-03-04 09:30:13 +0000 bridgestp: Ensure we send STP on VLAN interfaces Reviewed by: donner@ MFC after: 1 week X-MFC-with: 711ed156b94562c3dcb2ee9c1b3f240f960a75d2 Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D28916 (cherry picked from commit f5537cd0693c85efdb2180a0a107c51eae15ba39) --- sys/net/bridgestp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/bridgestp.c b/sys/net/bridgestp.c index 82524440c241..9e3a3e14ecda 100644 --- a/sys/net/bridgestp.c +++ b/sys/net/bridgestp.c @@ -2052,7 +2052,7 @@ bstp_reinit(struct bstp_state *bs) */ NET_EPOCH_ENTER(et); CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) { - if (ifp->if_type != IFT_ETHER) + if (ifp->if_type != IFT_ETHER && ifp->if_type != IFT_L2VLAN) continue; /* Not Ethernet */ if (ifp->if_bridge != bridgeptr) From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 09:33:22 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 63F4F569E22; Thu, 4 Mar 2021 09:33:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DrlzQ2NlXz3Bmg; Thu, 4 Mar 2021 09:33:22 +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 451381AB7B; Thu, 4 Mar 2021 09:33:22 +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 1249XMff005930; Thu, 4 Mar 2021 09:33:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1249XMGE005929; Thu, 4 Mar 2021 09:33:22 GMT (envelope-from git) Date: Thu, 4 Mar 2021 09:33:22 GMT Message-Id: <202103040933.1249XMGE005929@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: eb4221b9fb91 - stable/12 - bridge tests: Test that we also forward on some interfaces 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: eb4221b9fb91980ea43dcf55e6610c6d044954e7 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 Mar 2021 09:33:22 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=eb4221b9fb91980ea43dcf55e6610c6d044954e7 commit eb4221b9fb91980ea43dcf55e6610c6d044954e7 Author: Kristof Provost AuthorDate: 2021-02-24 15:40:37 +0000 Commit: Kristof Provost CommitDate: 2021-03-04 09:30:26 +0000 bridge tests: Test that we also forward on some interfaces Ensure that we not only block on some interfaces, but also forward on some. Without the previous commit we wound up discarding on all ports, rather than only on the ports needed to break the loop. MFC after: 1 week Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D28917 (cherry picked from commit 7a4dbffa4205fc274b4884a6332d4831c5791320) --- tests/sys/net/if_bridge_test.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index bc9add68ce25..1f10fe325a2c 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -117,6 +117,15 @@ stp_body() then atf_fail "STP failed to detect bridging loop" fi + + # We must also have at least some forwarding interfaces + a_forwarding=$(jexec a ifconfig ${bridge_a} | grep forwarding) + b_forwarding=$(jexec b ifconfig ${bridge_b} | grep forwarding) + + if [ -z "${a_forwarding}" ] && [ -z "${b_forwarding}" ] + then + atf_fail "STP failed to detect bridging loop" + fi } stp_cleanup() @@ -182,6 +191,15 @@ stp_vlan_body() then atf_fail "STP failed to detect bridging loop" fi + + # We must also have at least some forwarding interfaces + a_forwarding=$(jexec a ifconfig ${bridge_a} | grep forwarding) + b_forwarding=$(jexec b ifconfig ${bridge_b} | grep forwarding) + + if [ -z "${a_forwarding}" ] && [ -z "${b_forwarding}" ] + then + atf_fail "STP failed to detect bridging loop" + fi } stp_vlan_cleanup() From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 09:33: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 9E9B3569C30; Thu, 4 Mar 2021 09:33: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 4DrlzS60jdz3Bwk; Thu, 4 Mar 2021 09:33:24 +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 0873E1AC22; Thu, 4 Mar 2021 09:33:23 +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 1249XNpZ006050; Thu, 4 Mar 2021 09:33:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1249XN3e006049; Thu, 4 Mar 2021 09:33:23 GMT (envelope-from git) Date: Thu, 4 Mar 2021 09:33:23 GMT Message-Id: <202103040933.1249XN3e006049@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: 9c744d299243 - stable/13 - bridge tests: Test that we also forward on some interfaces 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: 9c744d29924323fafa4326d499971edfff55a89c 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 Mar 2021 09:33:27 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9c744d29924323fafa4326d499971edfff55a89c commit 9c744d29924323fafa4326d499971edfff55a89c Author: Kristof Provost AuthorDate: 2021-02-24 15:40:37 +0000 Commit: Kristof Provost CommitDate: 2021-03-04 09:30:14 +0000 bridge tests: Test that we also forward on some interfaces Ensure that we not only block on some interfaces, but also forward on some. Without the previous commit we wound up discarding on all ports, rather than only on the ports needed to break the loop. MFC after: 1 week Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D28917 (cherry picked from commit 7a4dbffa4205fc274b4884a6332d4831c5791320) --- tests/sys/net/if_bridge_test.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index bc9add68ce25..1f10fe325a2c 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -117,6 +117,15 @@ stp_body() then atf_fail "STP failed to detect bridging loop" fi + + # We must also have at least some forwarding interfaces + a_forwarding=$(jexec a ifconfig ${bridge_a} | grep forwarding) + b_forwarding=$(jexec b ifconfig ${bridge_b} | grep forwarding) + + if [ -z "${a_forwarding}" ] && [ -z "${b_forwarding}" ] + then + atf_fail "STP failed to detect bridging loop" + fi } stp_cleanup() @@ -182,6 +191,15 @@ stp_vlan_body() then atf_fail "STP failed to detect bridging loop" fi + + # We must also have at least some forwarding interfaces + a_forwarding=$(jexec a ifconfig ${bridge_a} | grep forwarding) + b_forwarding=$(jexec b ifconfig ${bridge_b} | grep forwarding) + + if [ -z "${a_forwarding}" ] && [ -z "${b_forwarding}" ] + then + atf_fail "STP failed to detect bridging loop" + fi } stp_vlan_cleanup() From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 09:45: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 4DA6956A412; Thu, 4 Mar 2021 09:45: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 4DrmF71jMTz3D5S; Thu, 4 Mar 2021 09:45: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 2D7C91AEAE; Thu, 4 Mar 2021 09:45: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 1249jFHX019399; Thu, 4 Mar 2021 09:45:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1249jF0R019398; Thu, 4 Mar 2021 09:45:15 GMT (envelope-from git) Date: Thu, 4 Mar 2021 09:45:15 GMT Message-Id: <202103040945.1249jF0R019398@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: ae608d4ee720 - stable/13 - RACK: fix an issue triggered by using the CDG CC module MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ae608d4ee7202cc34603e620bc551547e772c4d2 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 Mar 2021 09:45:15 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=ae608d4ee7202cc34603e620bc551547e772c4d2 commit ae608d4ee7202cc34603e620bc551547e772c4d2 Author: Michael Tuexen AuthorDate: 2021-03-02 11:32:16 +0000 Commit: Michael Tuexen CommitDate: 2021-03-04 09:44:50 +0000 RACK: fix an issue triggered by using the CDG CC module Obtained from: rrs@ PR: 238741 Sponsored by: Netlix, Inc. (cherry picked from commit 99adf230061268175a36061130e6adb0882270e8) --- sys/netinet/tcp_stacks/rack.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 8e00cae85496..4d1a4cc8a0eb 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -12305,7 +12305,7 @@ again: sb_offset = tp->snd_nxt - tp->snd_una; else sb_offset = 0; - if ((IN_RECOVERY(tp->t_flags) == 0) || rack->rack_no_prr) { + if ((IN_FASTRECOVERY(tp->t_flags) == 0) || rack->rack_no_prr) { if (rack->r_ctl.rc_tlp_new_data) { /* TLP is forcing out new data */ if (rack->r_ctl.rc_tlp_new_data > (uint32_t) (avail - sb_offset)) { @@ -12319,7 +12319,7 @@ again: new_data_tlp = doing_tlp = 1; } else len = rack_what_can_we_send(tp, rack, cwnd_to_use, avail, sb_offset); - if (IN_RECOVERY(tp->t_flags) && (len > segsiz)) { + if (IN_FASTRECOVERY(tp->t_flags) && (len > segsiz)) { /* * For prr=off, we need to send only 1 MSS * at a time. We do this because another sack could From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 10:36: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 BA6D956C085; Thu, 4 Mar 2021 10:36: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 4DrnNR4yZZz3H4K; Thu, 4 Mar 2021 10:36: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 9D1C61B5F0; Thu, 4 Mar 2021 10:36: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 124AadLh085728; Thu, 4 Mar 2021 10:36:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124AadXs085727; Thu, 4 Mar 2021 10:36:39 GMT (envelope-from git) Date: Thu, 4 Mar 2021 10:36:39 GMT Message-Id: <202103041036.124AadXs085727@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: dc27d5312b78 - stable/12 - RACK: fix an issue triggered by using the CDG CC module MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: dc27d5312b782b72740d71d81435a80dfe8b78bd 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 Mar 2021 10:36:39 -0000 The branch stable/12 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=dc27d5312b782b72740d71d81435a80dfe8b78bd commit dc27d5312b782b72740d71d81435a80dfe8b78bd Author: Michael Tuexen AuthorDate: 2021-03-02 11:32:16 +0000 Commit: Michael Tuexen CommitDate: 2021-03-04 10:35:03 +0000 RACK: fix an issue triggered by using the CDG CC module Manually resolved merge conflics. Obtained from: rrs@ PR: 238741 Sponsored by: Netlix, Inc. (cherry picked from commit 99adf230061268175a36061130e6adb0882270e8) --- sys/netinet/tcp_stacks/rack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 1d063a8a1f6f..fd1e3d18de08 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -7383,7 +7383,7 @@ again: sb_offset = tp->snd_nxt - tp->snd_una; else sb_offset = 0; - if (IN_RECOVERY(tp->t_flags) == 0) { + if (IN_FASTRECOVERY(tp->t_flags) == 0) { if (rack->r_ctl.rc_tlp_new_data) { /* TLP is forcing out new data */ if (rack->r_ctl.rc_tlp_new_data > (uint32_t) (avail - sb_offset)) { From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 11:01: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 E0B0856C77F; Thu, 4 Mar 2021 11:01: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 4DrnxJ64stz3JTW; Thu, 4 Mar 2021 11:01: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 C39C11BFC1; Thu, 4 Mar 2021 11:01: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 124B1eml024728; Thu, 4 Mar 2021 11:01:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124B1ekk024727; Thu, 4 Mar 2021 11:01:40 GMT (envelope-from git) Date: Thu, 4 Mar 2021 11:01:40 GMT Message-Id: <202103041101.124B1ekk024727@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 43a2f41379f5 - releng/13.0 - RACK: fix an issue triggered by using the CDG CC module MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 43a2f41379f5b2a5aea94cc8389b181bf2d35b65 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 Mar 2021 11:01:40 -0000 The branch releng/13.0 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=43a2f41379f5b2a5aea94cc8389b181bf2d35b65 commit 43a2f41379f5b2a5aea94cc8389b181bf2d35b65 Author: Michael Tuexen AuthorDate: 2021-03-02 11:32:16 +0000 Commit: Michael Tuexen CommitDate: 2021-03-04 11:00:34 +0000 RACK: fix an issue triggered by using the CDG CC module Obtained from: rrs@ Approved by: re (gjb) PR: 238741 Sponsored by: Netlix, Inc. (cherry picked from commit 99adf230061268175a36061130e6adb0882270e8) (cherry picked from commit ae608d4ee7202cc34603e620bc551547e772c4d2) --- sys/netinet/tcp_stacks/rack.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 8e00cae85496..4d1a4cc8a0eb 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -12305,7 +12305,7 @@ again: sb_offset = tp->snd_nxt - tp->snd_una; else sb_offset = 0; - if ((IN_RECOVERY(tp->t_flags) == 0) || rack->rack_no_prr) { + if ((IN_FASTRECOVERY(tp->t_flags) == 0) || rack->rack_no_prr) { if (rack->r_ctl.rc_tlp_new_data) { /* TLP is forcing out new data */ if (rack->r_ctl.rc_tlp_new_data > (uint32_t) (avail - sb_offset)) { @@ -12319,7 +12319,7 @@ again: new_data_tlp = doing_tlp = 1; } else len = rack_what_can_we_send(tp, rack, cwnd_to_use, avail, sb_offset); - if (IN_RECOVERY(tp->t_flags) && (len > segsiz)) { + if (IN_FASTRECOVERY(tp->t_flags) && (len > segsiz)) { /* * For prr=off, we need to send only 1 MSS * at a time. We do this because another sack could From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 12:00: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 B0A3B56EA27; Thu, 4 Mar 2021 12:00:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DrqFb4Wb6z3Nbc; Thu, 4 Mar 2021 12:00: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 8E8841CBB8; Thu, 4 Mar 2021 12:00: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 124C0pKM001074; Thu, 4 Mar 2021 12:00:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124C0p9Z001073; Thu, 4 Mar 2021 12:00:51 GMT (envelope-from git) Date: Thu, 4 Mar 2021 12:00:51 GMT Message-Id: <202103041200.124C0p9Z001073@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Richard Scheffenegger Subject: git: b8ffda0a37e1 - releng/13.0 - tcp: various improvements and fixes to PRR - Ensure cwnd doesn't shrink to zero with PRR - use accurate rfc6675_pipe when enabled - Address two incorrect calculations and enhance readability - address second instance of cwnd potentially becoming zero - fix sublte bug due to implicit int to uint typecase in max() - fix bug due to typo in hand-coded CEILING() function by using howmany() macro - use int instead of long, and add a missing long typecast - replace if conditionals with easier to read imax/imin (as in pseudocode) - Avoid accounting left-edge twice in partial ACK. - Include new data sent in PRR calculation - Improve PRR initial transmission timing - Fix prr_out when pipe < ssthresh MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: b8ffda0a37e126623069bce49e8096dbdb4bfde3 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 Mar 2021 12:00:51 -0000 The branch releng/13.0 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=b8ffda0a37e126623069bce49e8096dbdb4bfde3 commit b8ffda0a37e126623069bce49e8096dbdb4bfde3 Author: Richard Scheffenegger AuthorDate: 2021-02-19 12:52:06 +0000 Commit: Richard Scheffenegger CommitDate: 2021-03-04 11:56:35 +0000 tcp: various improvements and fixes to PRR - Ensure cwnd doesn't shrink to zero with PRR - use accurate rfc6675_pipe when enabled - Address two incorrect calculations and enhance readability - address second instance of cwnd potentially becoming zero - fix sublte bug due to implicit int to uint typecase in max() - fix bug due to typo in hand-coded CEILING() function by using howmany() macro - use int instead of long, and add a missing long typecast - replace if conditionals with easier to read imax/imin (as in pseudocode) - Avoid accounting left-edge twice in partial ACK. - Include new data sent in PRR calculation - Improve PRR initial transmission timing - Fix prr_out when pipe < ssthresh Reviewed By: #transport, kbowling, tuexen Reported by: Liang Tian Approved by: re (gjb) MFC after: 3 days Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D28780 Differential Revision: https://reviews.freebsd.org/D28816 Differential Revision: https://reviews.freebsd.org/D28813 Differential Revision: https://reviews.freebsd.org/D28819 Differential Revision: https://reviews.freebsd.org/D28941 Differential Revision: https://reviews.freebsd.org/D28953 Differential Revision: https://reviews.freebsd.org/D28998 (cherry picked from commit 853fd7a2e39802e46bd3d6476529796ac22412d9) (cherry picked from commit c3aa4ba5dfc084e40e4151b25a0d5f8d24a036ba) (cherry picked from commit a8e431e1537d056a3f9e466eaceec28c399c220b) (cherry picked from commit 32ed0ef06b8326271c4665406cac81fa47d0d29c) (cherry picked from commit 48396dc77922c68377ecac0ead2f8b0b5453c451) (cherry picked from commit ffbf1b809ef5080afa130c11fa4afce9fef7e7fe) (cherry picked from commit 31d7a27c6e88c3d5bd0907774ec70176a92da5bb) (cherry picked from commit 25fb4c363b299c26c35158fa059379af4a007253) (cherry picked from commit 9e83a6a556ed8d9a2821de5d5f5c7d4b1292c694) (cherry picked from commit 9596751563dc1819d177fa3ec6660a3bdc18021c) (cherry picked from commit e9071000c9a04e3f685579500e24da9848944bb1) (cherry picked from commit 2b43cd2ea26f758d23e8c009cf7521c4ddec7353) (cherry picked from commit 0b0f8b359d0b94b09cfec35e5d5de01b23c7fbf1) (cherry picked from commit 05e742af6f548364909ed671f0b3774e54dc77d1) --- sys/netinet/tcp_input.c | 95 ++++++++++++++++++++++++------------------------- 1 file changed, 47 insertions(+), 48 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 459b78cd444a..f2edbecbb079 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -2577,8 +2577,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, if (V_tcp_do_prr && IN_FASTRECOVERY(tp->t_flags) && (tp->t_flags & TF_SACK_PERMIT)) { - long snd_cnt = 0, limit = 0; - long del_data = 0, pipe = 0; + int snd_cnt = 0, limit = 0; + int del_data = 0, pipe = 0; /* * In a duplicate ACK del_data is only the * diff_in_sack. If no SACK is used del_data @@ -2586,45 +2586,41 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, * estimate to be in the network. */ del_data = tp->sackhint.delivered_data; - pipe = (tp->snd_nxt - tp->snd_fack) + - tp->sackhint.sack_bytes_rexmit; + if (V_tcp_do_rfc6675_pipe) + pipe = tcp_compute_pipe(tp); + else + pipe = (tp->snd_nxt - tp->snd_fack) + + tp->sackhint.sack_bytes_rexmit; tp->sackhint.prr_delivered += del_data; - if (pipe > tp->snd_ssthresh) { + if (pipe >= tp->snd_ssthresh) { if (tp->sackhint.recover_fs == 0) tp->sackhint.recover_fs = - max(1, tp->snd_nxt - tp->snd_una); - snd_cnt = (tp->sackhint.prr_delivered * - tp->snd_ssthresh / - tp->sackhint.recover_fs) + - 1 - tp->sackhint.sack_bytes_rexmit; + imax(1, tp->snd_nxt - tp->snd_una); + snd_cnt = howmany((long)tp->sackhint.prr_delivered * + tp->snd_ssthresh, tp->sackhint.recover_fs) - + (tp->sackhint.sack_bytes_rexmit + + (tp->snd_nxt - tp->snd_recover)); } else { if (V_tcp_do_prr_conservative) limit = tp->sackhint.prr_delivered - - tp->sackhint.sack_bytes_rexmit; + (tp->sackhint.sack_bytes_rexmit + + (tp->snd_nxt - tp->snd_recover)); else - if ((tp->sackhint.prr_delivered - - tp->sackhint.sack_bytes_rexmit) > - del_data) - limit = tp->sackhint.prr_delivered - - tp->sackhint.sack_bytes_rexmit + - maxseg; - else - limit = del_data + maxseg; - if ((tp->snd_ssthresh - pipe) < limit) - snd_cnt = tp->snd_ssthresh - pipe; - else - snd_cnt = limit; + limit = imax(tp->sackhint.prr_delivered - + (tp->sackhint.sack_bytes_rexmit + + (tp->snd_nxt - tp->snd_recover)), + del_data) + maxseg; + snd_cnt = imin(tp->snd_ssthresh - pipe, limit); } - snd_cnt = max((snd_cnt / maxseg), 0); + snd_cnt = imax(snd_cnt, 0) / maxseg; /* * Send snd_cnt new data into the network in * response to this ACK. If there is a going * to be a SACK retransmission, adjust snd_cwnd * accordingly. */ - tp->snd_cwnd = tp->snd_nxt - tp->snd_recover + - tp->sackhint.sack_bytes_rexmit + - (snd_cnt * maxseg); + tp->snd_cwnd = imax(maxseg, tp->snd_nxt - tp->snd_recover + + tp->sackhint.sack_bytes_rexmit + (snd_cnt * maxseg)); } else if ((tp->t_flags & TF_SACK_PERMIT) && IN_FASTRECOVERY(tp->t_flags)) { int awnd; @@ -2684,7 +2680,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, * snd_ssthresh is already updated by * cc_cong_signal. */ - tp->sackhint.prr_delivered = 0; + tp->sackhint.prr_delivered = + tp->sackhint.sacked_bytes; tp->sackhint.sack_bytes_rexmit = 0; tp->sackhint.recover_fs = max(1, tp->snd_nxt - tp->snd_una); @@ -3927,7 +3924,7 @@ tcp_mssopt(struct in_conninfo *inc) void tcp_prr_partialack(struct tcpcb *tp, struct tcphdr *th) { - long snd_cnt = 0, limit = 0, del_data = 0, pipe = 0; + int snd_cnt = 0, limit = 0, del_data = 0, pipe = 0; int maxseg = tcp_maxseg(tp); INP_WLOCK_ASSERT(tp->t_inpcb); @@ -3939,41 +3936,43 @@ tcp_prr_partialack(struct tcpcb *tp, struct tcphdr *th) * (del_data) and an estimate of how many bytes are in the * network. */ - if (SEQ_GEQ(th->th_ack, tp->snd_una)) - del_data = BYTES_THIS_ACK(tp, th); - del_data += tp->sackhint.delivered_data; - pipe = (tp->snd_nxt - tp->snd_fack) + tp->sackhint.sack_bytes_rexmit; + del_data = tp->sackhint.delivered_data; + if (V_tcp_do_rfc6675_pipe) + pipe = tcp_compute_pipe(tp); + else + pipe = (tp->snd_nxt - tp->snd_fack) + tp->sackhint.sack_bytes_rexmit; tp->sackhint.prr_delivered += del_data; /* * Proportional Rate Reduction */ - if (pipe > tp->snd_ssthresh) { + if (pipe >= tp->snd_ssthresh) { if (tp->sackhint.recover_fs == 0) tp->sackhint.recover_fs = - max(1, tp->snd_nxt - tp->snd_una); - snd_cnt = (tp->sackhint.prr_delivered * tp->snd_ssthresh / - tp->sackhint.recover_fs) - tp->sackhint.sack_bytes_rexmit; + imax(1, tp->snd_nxt - tp->snd_una); + snd_cnt = howmany((long)tp->sackhint.prr_delivered * + tp->snd_ssthresh, tp->sackhint.recover_fs) - + (tp->sackhint.sack_bytes_rexmit + + (tp->snd_nxt - tp->snd_recover)); } else { if (V_tcp_do_prr_conservative) limit = tp->sackhint.prr_delivered - - tp->sackhint.sack_bytes_rexmit; + (tp->sackhint.sack_bytes_rexmit + + (tp->snd_nxt - tp->snd_recover)); else - if ((tp->sackhint.prr_delivered - - tp->sackhint.sack_bytes_rexmit) > del_data) - limit = tp->sackhint.prr_delivered - - tp->sackhint.sack_bytes_rexmit + maxseg; - else - limit = del_data + maxseg; - snd_cnt = min((tp->snd_ssthresh - pipe), limit); + limit = imax(tp->sackhint.prr_delivered - + (tp->sackhint.sack_bytes_rexmit + + (tp->snd_nxt - tp->snd_recover)), + del_data) + maxseg; + snd_cnt = imin((tp->snd_ssthresh - pipe), limit); } - snd_cnt = max((snd_cnt / maxseg), 0); + snd_cnt = imax(snd_cnt, 0) / maxseg; /* * Send snd_cnt new data into the network in response to this ack. * If there is going to be a SACK retransmission, adjust snd_cwnd * accordingly. */ - tp->snd_cwnd = tp->snd_nxt - tp->snd_recover + - tp->sackhint.sack_bytes_rexmit + (snd_cnt * maxseg); + tp->snd_cwnd = imax(maxseg, tp->snd_nxt - tp->snd_recover + + tp->sackhint.sack_bytes_rexmit + (snd_cnt * maxseg)); tp->t_flags |= TF_ACKNOW; (void) tcp_output(tp); } From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 13:21: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 78239548ADE; Thu, 4 Mar 2021 13:21: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 4Drs2531msz3kVM; Thu, 4 Mar 2021 13:21: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 5A96E1DA49; Thu, 4 Mar 2021 13:21: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 124DL18B009448; Thu, 4 Mar 2021 13:21:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124DL11Y009447; Thu, 4 Mar 2021 13:21:01 GMT (envelope-from git) Date: Thu, 4 Mar 2021 13:21:01 GMT Message-Id: <202103041321.124DL11Y009447@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: 095558ac8949 - stable/13 - sendfile: Use the pager size to determine the file extent when possible 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: 095558ac894977906fbbdf74c34b6d13fea7c8ed 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 Mar 2021 13:21:01 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=095558ac894977906fbbdf74c34b6d13fea7c8ed commit 095558ac894977906fbbdf74c34b6d13fea7c8ed Author: Mark Johnston AuthorDate: 2021-02-25 15:04:44 +0000 Commit: Mark Johnston CommitDate: 2021-03-04 13:19:51 +0000 sendfile: Use the pager size to determine the file extent when possible Previously sendfile would issue a VOP_GETATTR and use the returned size, i.e., the file size. When paging in file data, sendfile_swapin() will use the pager to determine whether it needs to zero-fill, most often because of a hole in a sparse file. An attempt to page in beyond the end of a file is treated this way, and occurs when the requested page is past the end of the pager. In other words, both the file size and pager size were used interchangeably. With ZFS, updates to the pager and file sizes are not synchronized by the exclusive vnode lock, at least partially due to its use of MNTK_SHARED_WRITES. In particular, the pager size is updated after the file size, so in the presence of a writer concurrently extending the file, sendfile could incorrectly instantiate "holes" in the page cache pages backing the file, which manifests as data corruption when reading the file back from the page cache. The on-disk copy is unaffected. Fix this by consistently using the pager size when available. Reported by: dumbbell Reviewed by: chs, kib Tested by: dumbbell, pho Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28811 (cherry picked from commit faa998f6ff69573fe82765c77c7268ee89ac945e) --- sys/kern/kern_sendfile.c | 55 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c index 7d7be6f072e9..95bfba0538dc 100644 --- a/sys/kern/kern_sendfile.c +++ b/sys/kern/kern_sendfile.c @@ -588,28 +588,40 @@ sendfile_getobj(struct thread *td, struct file *fp, vm_object_t *obj_res, goto out; } *bsize = vp->v_mount->mnt_stat.f_iosize; - error = VOP_GETATTR(vp, &va, td->td_ucred); - if (error != 0) - goto out; - *obj_size = va.va_size; obj = vp->v_object; if (obj == NULL) { error = EINVAL; goto out; } + + /* + * Use the pager size when available to simplify synchronization + * with filesystems, which otherwise must atomically update both + * the vnode pager size and file size. + */ + if (obj->type == OBJT_VNODE) { + VM_OBJECT_RLOCK(obj); + *obj_size = obj->un_pager.vnp.vnp_size; + } else { + error = VOP_GETATTR(vp, &va, td->td_ucred); + if (error != 0) + goto out; + *obj_size = va.va_size; + VM_OBJECT_RLOCK(obj); + } } else if (fp->f_type == DTYPE_SHM) { error = 0; shmfd = fp->f_data; obj = shmfd->shm_object; + VM_OBJECT_RLOCK(obj); *obj_size = shmfd->shm_size; } else { error = EINVAL; goto out; } - VM_OBJECT_WLOCK(obj); if ((obj->flags & OBJ_DEAD) != 0) { - VM_OBJECT_WUNLOCK(obj); + VM_OBJECT_RUNLOCK(obj); error = EBADF; goto out; } @@ -620,7 +632,7 @@ sendfile_getobj(struct thread *td, struct file *fp, vm_object_t *obj_res, * immediately destroy it. */ vm_object_reference_locked(obj); - VM_OBJECT_WUNLOCK(obj); + VM_OBJECT_RUNLOCK(obj); *obj_res = obj; *vp_res = vp; *shmfd_res = shmfd; @@ -679,7 +691,7 @@ vn_sendfile(struct file *fp, int sockfd, struct uio *hdr_uio, struct shmfd *shmfd; struct sendfile_sync *sfs; struct vattr va; - off_t off, sbytes, rem, obj_size; + off_t off, sbytes, rem, obj_size, nobj_size; int bsize, error, ext_pgs_idx, hdrlen, max_pgs, softerr; #ifdef KERN_TLS int tls_enq_cnt; @@ -852,15 +864,30 @@ retry_space: error = vn_lock(vp, LK_SHARED); if (error != 0) goto done; - error = VOP_GETATTR(vp, &va, td->td_ucred); - if (error != 0 || off >= va.va_size) { + + /* + * Check to see if the file size has changed. + */ + if (obj->type == OBJT_VNODE) { + VM_OBJECT_RLOCK(obj); + nobj_size = obj->un_pager.vnp.vnp_size; + VM_OBJECT_RUNLOCK(obj); + } else { + error = VOP_GETATTR(vp, &va, td->td_ucred); + if (error != 0) { + VOP_UNLOCK(vp); + goto done; + } + nobj_size = va.va_size; + } + if (off >= nobj_size) { VOP_UNLOCK(vp); goto done; } - if (va.va_size != obj_size) { - obj_size = va.va_size; - rem = nbytes ? - omin(nbytes + offset, obj_size) : obj_size; + if (nobj_size != obj_size) { + obj_size = nobj_size; + rem = nbytes ? omin(nbytes + offset, obj_size) : + obj_size; rem -= off; } } From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 13:21: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 9C09C5494A2; Thu, 4 Mar 2021 13:21: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 4Drs2641rJz3kVQ; Thu, 4 Mar 2021 13:21: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 7D01D1DD96; Thu, 4 Mar 2021 13:21: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 124DL2AO009466; Thu, 4 Mar 2021 13:21:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124DL2h5009465; Thu, 4 Mar 2021 13:21:02 GMT (envelope-from git) Date: Thu, 4 Mar 2021 13:21:02 GMT Message-Id: <202103041321.124DL2h5009465@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: 05812ed9e71b - stable/13 - buf: Fix the dirtybufthresh check 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: 05812ed9e71b434293989f4e915264e6f3bc7a0d 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 Mar 2021 13:21:02 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=05812ed9e71b434293989f4e915264e6f3bc7a0d commit 05812ed9e71b434293989f4e915264e6f3bc7a0d Author: Mark Johnston AuthorDate: 2021-02-25 15:04:44 +0000 Commit: Mark Johnston CommitDate: 2021-03-04 13:20:12 +0000 buf: Fix the dirtybufthresh check dirtybufthresh is a watermark, slightly below the high watermark for dirty buffers. When a delayed write is issued, the dirtying thread will start flushing buffers if the dirtybufthresh watermark is reached. This helps ensure that the high watermark is not reached, otherwise performance will degrade as clustering and other optimizations are disabled (see buf_dirty_count_severe()). When the buffer cache was partitioned into "domains", the dirtybufthresh threshold checks were not updated. Fix this. Reported by: Shrikanth R Kamath Reviewed by: rlibby, mckusick, kib, bdrewery Sponsored by: Juniper Networks, Inc., Klara, Inc. Fixes: 3cec5c77d6 Differential Revision: https://reviews.freebsd.org/D28901 (cherry picked from commit 369706a6f887f8ffe1037d78bc31565ec701d72b) --- sys/kern/vfs_bio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 9264388e9a3e..8519afe96633 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -2325,11 +2325,13 @@ void bufbdflush(struct bufobj *bo, struct buf *bp) { struct buf *nbp; + struct bufdomain *bd; - if (bo->bo_dirty.bv_cnt > dirtybufthresh + 10) { + bd = &bdomain[bo->bo_domain]; + if (bo->bo_dirty.bv_cnt > bd->bd_dirtybufthresh + 10) { (void) VOP_FSYNC(bp->b_vp, MNT_NOWAIT, curthread); altbufferflushes++; - } else if (bo->bo_dirty.bv_cnt > dirtybufthresh) { + } else if (bo->bo_dirty.bv_cnt > bd->bd_dirtybufthresh) { BO_LOCK(bo); /* * Try to find a buffer to flush. From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 14:06: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 29B2654AC6B; Thu, 4 Mar 2021 14:06: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 4Drt2v0d2Xz3prV; Thu, 4 Mar 2021 14:06: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 081851E729; Thu, 4 Mar 2021 14:06: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 124E6khl066609; Thu, 4 Mar 2021 14:06:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124E6kbl066608; Thu, 4 Mar 2021 14:06:46 GMT (envelope-from git) Date: Thu, 4 Mar 2021 14:06:46 GMT Message-Id: <202103041406.124E6kbl066608@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: 0bec69d1898f - stable/12 - buf: Fix the dirtybufthresh check 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: 0bec69d1898ff310aaf4915626e00887d803bfaf 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 Mar 2021 14:06:47 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0bec69d1898ff310aaf4915626e00887d803bfaf commit 0bec69d1898ff310aaf4915626e00887d803bfaf Author: Mark Johnston AuthorDate: 2021-02-25 15:04:44 +0000 Commit: Mark Johnston CommitDate: 2021-03-04 14:06:43 +0000 buf: Fix the dirtybufthresh check dirtybufthresh is a watermark, slightly below the high watermark for dirty buffers. When a delayed write is issued, the dirtying thread will start flushing buffers if the dirtybufthresh watermark is reached. This helps ensure that the high watermark is not reached, otherwise performance will degrade as clustering and other optimizations are disabled (see buf_dirty_count_severe()). When the buffer cache was partitioned into "domains", the dirtybufthresh threshold checks were not updated. Fix this. Reported by: Shrikanth R Kamath Reviewed by: rlibby, mckusick, kib, bdrewery Sponsored by: Juniper Networks, Inc., Klara, Inc. Fixes: 3cec5c77d6 Differential Revision: https://reviews.freebsd.org/D28901 (cherry picked from commit 369706a6f887f8ffe1037d78bc31565ec701d72b) --- sys/kern/vfs_bio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index d23a19f37907..6c5286d30871 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -2305,11 +2305,13 @@ void bufbdflush(struct bufobj *bo, struct buf *bp) { struct buf *nbp; + struct bufdomain *bd; - if (bo->bo_dirty.bv_cnt > dirtybufthresh + 10) { + bd = &bdomain[bo->bo_domain]; + if (bo->bo_dirty.bv_cnt > bd->bd_dirtybufthresh + 10) { (void) VOP_FSYNC(bp->b_vp, MNT_NOWAIT, curthread); altbufferflushes++; - } else if (bo->bo_dirty.bv_cnt > dirtybufthresh) { + } else if (bo->bo_dirty.bv_cnt > bd->bd_dirtybufthresh) { BO_LOCK(bo); /* * Try to find a buffer to flush. From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 14:09: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 DF50854AEA2; Thu, 4 Mar 2021 14:09: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 4Drt6L5zq5z3pXd; Thu, 4 Mar 2021 14:09:46 +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 C0D911E900; Thu, 4 Mar 2021 14:09: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 124E9k4G067223; Thu, 4 Mar 2021 14:09:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124E9k00067222; Thu, 4 Mar 2021 14:09:46 GMT (envelope-from git) Date: Thu, 4 Mar 2021 14:09:46 GMT Message-Id: <202103041409.124E9k00067222@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: 065b9549d356 - releng/13.0 - sendfile: Use the pager size to determine the file extent when possible MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 065b9549d35676dcd7af45ca3ebd05e9ca082cbe 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 Mar 2021 14:09:46 -0000 The branch releng/13.0 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=065b9549d35676dcd7af45ca3ebd05e9ca082cbe commit 065b9549d35676dcd7af45ca3ebd05e9ca082cbe Author: Mark Johnston AuthorDate: 2021-02-25 15:04:44 +0000 Commit: Mark Johnston CommitDate: 2021-03-04 14:09:36 +0000 sendfile: Use the pager size to determine the file extent when possible Previously sendfile would issue a VOP_GETATTR and use the returned size, i.e., the file size. When paging in file data, sendfile_swapin() will use the pager to determine whether it needs to zero-fill, most often because of a hole in a sparse file. An attempt to page in beyond the end of a file is treated this way, and occurs when the requested page is past the end of the pager. In other words, both the file size and pager size were used interchangeably. With ZFS, updates to the pager and file sizes are not synchronized by the exclusive vnode lock, at least partially due to its use of MNTK_SHARED_WRITES. In particular, the pager size is updated after the file size, so in the presence of a writer concurrently extending the file, sendfile could incorrectly instantiate "holes" in the page cache pages backing the file, which manifests as data corruption when reading the file back from the page cache. The on-disk copy is unaffected. Fix this by consistently using the pager size when available. Approved by: re (gjb) Reported by: dumbbell Reviewed by: chs, kib Tested by: dumbbell, pho Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28811 (cherry picked from commit faa998f6ff69573fe82765c77c7268ee89ac945e) (cherry picked from commit 095558ac894977906fbbdf74c34b6d13fea7c8ed) --- sys/kern/kern_sendfile.c | 55 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c index 7d7be6f072e9..95bfba0538dc 100644 --- a/sys/kern/kern_sendfile.c +++ b/sys/kern/kern_sendfile.c @@ -588,28 +588,40 @@ sendfile_getobj(struct thread *td, struct file *fp, vm_object_t *obj_res, goto out; } *bsize = vp->v_mount->mnt_stat.f_iosize; - error = VOP_GETATTR(vp, &va, td->td_ucred); - if (error != 0) - goto out; - *obj_size = va.va_size; obj = vp->v_object; if (obj == NULL) { error = EINVAL; goto out; } + + /* + * Use the pager size when available to simplify synchronization + * with filesystems, which otherwise must atomically update both + * the vnode pager size and file size. + */ + if (obj->type == OBJT_VNODE) { + VM_OBJECT_RLOCK(obj); + *obj_size = obj->un_pager.vnp.vnp_size; + } else { + error = VOP_GETATTR(vp, &va, td->td_ucred); + if (error != 0) + goto out; + *obj_size = va.va_size; + VM_OBJECT_RLOCK(obj); + } } else if (fp->f_type == DTYPE_SHM) { error = 0; shmfd = fp->f_data; obj = shmfd->shm_object; + VM_OBJECT_RLOCK(obj); *obj_size = shmfd->shm_size; } else { error = EINVAL; goto out; } - VM_OBJECT_WLOCK(obj); if ((obj->flags & OBJ_DEAD) != 0) { - VM_OBJECT_WUNLOCK(obj); + VM_OBJECT_RUNLOCK(obj); error = EBADF; goto out; } @@ -620,7 +632,7 @@ sendfile_getobj(struct thread *td, struct file *fp, vm_object_t *obj_res, * immediately destroy it. */ vm_object_reference_locked(obj); - VM_OBJECT_WUNLOCK(obj); + VM_OBJECT_RUNLOCK(obj); *obj_res = obj; *vp_res = vp; *shmfd_res = shmfd; @@ -679,7 +691,7 @@ vn_sendfile(struct file *fp, int sockfd, struct uio *hdr_uio, struct shmfd *shmfd; struct sendfile_sync *sfs; struct vattr va; - off_t off, sbytes, rem, obj_size; + off_t off, sbytes, rem, obj_size, nobj_size; int bsize, error, ext_pgs_idx, hdrlen, max_pgs, softerr; #ifdef KERN_TLS int tls_enq_cnt; @@ -852,15 +864,30 @@ retry_space: error = vn_lock(vp, LK_SHARED); if (error != 0) goto done; - error = VOP_GETATTR(vp, &va, td->td_ucred); - if (error != 0 || off >= va.va_size) { + + /* + * Check to see if the file size has changed. + */ + if (obj->type == OBJT_VNODE) { + VM_OBJECT_RLOCK(obj); + nobj_size = obj->un_pager.vnp.vnp_size; + VM_OBJECT_RUNLOCK(obj); + } else { + error = VOP_GETATTR(vp, &va, td->td_ucred); + if (error != 0) { + VOP_UNLOCK(vp); + goto done; + } + nobj_size = va.va_size; + } + if (off >= nobj_size) { VOP_UNLOCK(vp); goto done; } - if (va.va_size != obj_size) { - obj_size = va.va_size; - rem = nbytes ? - omin(nbytes + offset, obj_size) : obj_size; + if (nobj_size != obj_size) { + obj_size = nobj_size; + rem = nbytes ? omin(nbytes + offset, obj_size) : + obj_size; rem -= off; } } From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 14:39: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 6B8AC54CAD5; Thu, 4 Mar 2021 14:39: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 4Drtn02dTqz3rgm; Thu, 4 Mar 2021 14:39: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 3EA971F009; Thu, 4 Mar 2021 14:39: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 124EdmKI006549; Thu, 4 Mar 2021 14:39:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124Edm4S006548; Thu, 4 Mar 2021 14:39:48 GMT (envelope-from git) Date: Thu, 4 Mar 2021 14:39:48 GMT Message-Id: <202103041439.124Edm4S006548@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: a00bf7d9bba1 - stable/13 - Make DataSN counter of solicited Data-Out local. 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: a00bf7d9bba1dd359f521b3d11b483e32fb4de2a 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 Mar 2021 14:39:48 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=a00bf7d9bba1dd359f521b3d11b483e32fb4de2a commit a00bf7d9bba1dd359f521b3d11b483e32fb4de2a Author: Alexander Motin AuthorDate: 2021-02-02 18:37:13 +0000 Commit: Alexander Motin CommitDate: 2021-03-04 14:39:43 +0000 Make DataSN counter of solicited Data-Out local. DataSN for solicited Data-Out is per-R2T. Since we handle whole R2T in one go, we don't need to store it anywhere, especially in global per-command structure. This may allow us to handle multiple R2T per command at once, if we decide, or may be relax locking. Rename the second use of that field to io_referenced_task_tag. MFC after: 1 month (cherry picked from commit 3dd2a7a5ea2f1641c7525f692eed416fa02c28e6) --- sys/dev/iscsi/iscsi.c | 9 ++++----- sys/dev/iscsi/iscsi.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c index 5e6c80255bff..c4123d9f4aa7 100644 --- a/sys/dev/iscsi/iscsi.c +++ b/sys/dev/iscsi/iscsi.c @@ -1018,7 +1018,7 @@ iscsi_pdu_handle_task_response(struct icl_pdu *response) ISCSI_SESSION_WARN(is, "task response 0x%x", bhstmr->bhstmr_response); } else { - aio = iscsi_outstanding_find(is, io->io_datasn); + aio = iscsi_outstanding_find(is, io->io_referenced_task_tag); if (aio != NULL && aio->io_ccb != NULL) iscsi_session_terminate_task(is, aio, CAM_REQ_ABORTED); } @@ -1157,6 +1157,7 @@ iscsi_pdu_handle_r2t(struct icl_pdu *response) struct ccb_scsiio *csio; size_t off, len, total_len; int error; + uint32_t datasn = 0; is = PDU_SESSION(response); @@ -1183,8 +1184,6 @@ iscsi_pdu_handle_r2t(struct icl_pdu *response) * XXX: Verify R2TSN. */ - io->io_datasn = 0; - off = ntohl(bhsr2t->bhsr2t_buffer_offset); if (off > csio->dxfer_len) { ISCSI_SESSION_WARN(is, "target requested invalid offset " @@ -1234,7 +1233,7 @@ iscsi_pdu_handle_r2t(struct icl_pdu *response) bhsr2t->bhsr2t_initiator_task_tag; bhsdo->bhsdo_target_transfer_tag = bhsr2t->bhsr2t_target_transfer_tag; - bhsdo->bhsdo_datasn = htonl(io->io_datasn++); + bhsdo->bhsdo_datasn = htonl(datasn++); bhsdo->bhsdo_buffer_offset = htonl(off); error = icl_pdu_append_data(request, csio->data_ptr + off, len, M_NOWAIT); @@ -2204,7 +2203,7 @@ iscsi_action_abort(struct iscsi_session *is, union ccb *ccb) xpt_done(ccb); return; } - io->io_datasn = aio->io_initiator_task_tag; + io->io_referenced_task_tag = aio->io_initiator_task_tag; bhstmr = (struct iscsi_bhs_task_management_request *)request->ip_bhs; bhstmr->bhstmr_opcode = ISCSI_BHS_OPCODE_TASK_REQUEST; diff --git a/sys/dev/iscsi/iscsi.h b/sys/dev/iscsi/iscsi.h index ddd88ffc5289..80ac9d877107 100644 --- a/sys/dev/iscsi/iscsi.h +++ b/sys/dev/iscsi/iscsi.h @@ -45,7 +45,7 @@ struct iscsi_outstanding { union ccb *io_ccb; size_t io_received; uint32_t io_initiator_task_tag; - uint32_t io_datasn; + uint32_t io_referenced_task_tag; void *io_icl_prv; }; From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 14: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 8829854CD66; Thu, 4 Mar 2021 14: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 4Drtp53MmQz3rrH; Thu, 4 Mar 2021 14:40: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 5827C1F010; Thu, 4 Mar 2021 14: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 124EejMw014995; Thu, 4 Mar 2021 14: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 124EejwT014994; Thu, 4 Mar 2021 14:40:45 GMT (envelope-from git) Date: Thu, 4 Mar 2021 14:40:45 GMT Message-Id: <202103041440.124EejwT014994@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: 3e1da9a9f85b - stable/12 - Make DataSN counter of solicited Data-Out local. 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: 3e1da9a9f85bbfbb216829b5de528b86d16c888f 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 Mar 2021 14:40:45 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=3e1da9a9f85bbfbb216829b5de528b86d16c888f commit 3e1da9a9f85bbfbb216829b5de528b86d16c888f Author: Alexander Motin AuthorDate: 2021-02-02 18:37:13 +0000 Commit: Alexander Motin CommitDate: 2021-03-04 14:40:37 +0000 Make DataSN counter of solicited Data-Out local. DataSN for solicited Data-Out is per-R2T. Since we handle whole R2T in one go, we don't need to store it anywhere, especially in global per-command structure. This may allow us to handle multiple R2T per command at once, if we decide, or may be relax locking. Rename the second use of that field to io_referenced_task_tag. MFC after: 1 month (cherry picked from commit 3dd2a7a5ea2f1641c7525f692eed416fa02c28e6) --- sys/dev/iscsi/iscsi.c | 9 ++++----- sys/dev/iscsi/iscsi.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c index 0c891a32feea..685b635a4411 100644 --- a/sys/dev/iscsi/iscsi.c +++ b/sys/dev/iscsi/iscsi.c @@ -1018,7 +1018,7 @@ iscsi_pdu_handle_task_response(struct icl_pdu *response) ISCSI_SESSION_WARN(is, "task response 0x%x", bhstmr->bhstmr_response); } else { - aio = iscsi_outstanding_find(is, io->io_datasn); + aio = iscsi_outstanding_find(is, io->io_referenced_task_tag); if (aio != NULL && aio->io_ccb != NULL) iscsi_session_terminate_task(is, aio, CAM_REQ_ABORTED); } @@ -1157,6 +1157,7 @@ iscsi_pdu_handle_r2t(struct icl_pdu *response) struct ccb_scsiio *csio; size_t off, len, total_len; int error; + uint32_t datasn = 0; is = PDU_SESSION(response); @@ -1183,8 +1184,6 @@ iscsi_pdu_handle_r2t(struct icl_pdu *response) * XXX: Verify R2TSN. */ - io->io_datasn = 0; - off = ntohl(bhsr2t->bhsr2t_buffer_offset); if (off > csio->dxfer_len) { ISCSI_SESSION_WARN(is, "target requested invalid offset " @@ -1234,7 +1233,7 @@ iscsi_pdu_handle_r2t(struct icl_pdu *response) bhsr2t->bhsr2t_initiator_task_tag; bhsdo->bhsdo_target_transfer_tag = bhsr2t->bhsr2t_target_transfer_tag; - bhsdo->bhsdo_datasn = htonl(io->io_datasn++); + bhsdo->bhsdo_datasn = htonl(datasn++); bhsdo->bhsdo_buffer_offset = htonl(off); error = icl_pdu_append_data(request, csio->data_ptr + off, len, M_NOWAIT); @@ -2204,7 +2203,7 @@ iscsi_action_abort(struct iscsi_session *is, union ccb *ccb) xpt_done(ccb); return; } - io->io_datasn = aio->io_initiator_task_tag; + io->io_referenced_task_tag = aio->io_initiator_task_tag; bhstmr = (struct iscsi_bhs_task_management_request *)request->ip_bhs; bhstmr->bhstmr_opcode = ISCSI_BHS_OPCODE_TASK_REQUEST; diff --git a/sys/dev/iscsi/iscsi.h b/sys/dev/iscsi/iscsi.h index 607d0a7386f6..33c892a00d50 100644 --- a/sys/dev/iscsi/iscsi.h +++ b/sys/dev/iscsi/iscsi.h @@ -46,7 +46,7 @@ struct iscsi_outstanding { union ccb *io_ccb; size_t io_received; uint32_t io_initiator_task_tag; - uint32_t io_datasn; + uint32_t io_referenced_task_tag; void *io_icl_prv; }; From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 15:14: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 2BAB854E706; Thu, 4 Mar 2021 15:14: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 4DrvXZ0k26z3vpB; Thu, 4 Mar 2021 15:14: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 0141B1F5BD; Thu, 4 Mar 2021 15:14: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 124FE5aq058912; Thu, 4 Mar 2021 15:14:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124FE5We058911; Thu, 4 Mar 2021 15:14:05 GMT (envelope-from git) Date: Thu, 4 Mar 2021 15:14:05 GMT Message-Id: <202103041514.124FE5We058911@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: ba47eae9819a - stable/12 - amdtemp(4): Refactor shared temperature calculation logic 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: ba47eae9819a758e693697a780741931dd6546d5 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 Mar 2021 15:14:06 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=ba47eae9819a758e693697a780741931dd6546d5 commit ba47eae9819a758e693697a780741931dd6546d5 Author: Conrad Meyer AuthorDate: 2020-01-28 01:38:51 +0000 Commit: Alexander Motin CommitDate: 2021-03-04 15:04:52 +0000 amdtemp(4): Refactor shared temperature calculation logic No functional change intended. (cherry picked from commit 02f700029357ddf31b538bbb5a23785d4ca4c7a8) --- sys/dev/amdtemp/amdtemp.c | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/sys/dev/amdtemp/amdtemp.c b/sys/dev/amdtemp/amdtemp.c index d30fceba5894..023a88b46120 100644 --- a/sys/dev/amdtemp/amdtemp.c +++ b/sys/dev/amdtemp/amdtemp.c @@ -651,26 +651,46 @@ amdtemp_gettemp0f(device_t dev, amdsensor_t sensor) } static uint32_t -amdtemp_decode_fam10h_to_16h(int32_t sc_offset, uint32_t val) +amdtemp_decode_fam10h_to_17h(int32_t sc_offset, uint32_t val, bool minus49) { uint32_t temp; /* Convert raw register subfield units (0.125C) to units of 0.1C. */ - temp = ((val >> AMDTEMP_REPTMP10H_CURTMP_SHIFT) & - AMDTEMP_REPTMP10H_CURTMP_MASK) * 5 / 4; + temp = (val & AMDTEMP_REPTMP10H_CURTMP_MASK) * 5 / 4; + + if (minus49) + temp -= AMDTEMP_CURTMP_RANGE_ADJUST; + + temp += AMDTEMP_ZERO_C_TO_K + sc_offset * 10; + return (temp); +} + +static uint32_t +amdtemp_decode_fam10h_to_16h(int32_t sc_offset, uint32_t val) +{ + bool minus49; /* * On Family 15h and higher, if CurTmpTjSel is 11b, the range is * adjusted down by 49.0 degrees Celsius. (This adjustment is not * documented in BKDGs prior to family 15h model 00h.) */ - if (CPUID_TO_FAMILY(cpu_id) >= 0x15 && + minus49 = (CPUID_TO_FAMILY(cpu_id) >= 0x15 && ((val >> AMDTEMP_REPTMP10H_TJSEL_SHIFT) & - AMDTEMP_REPTMP10H_TJSEL_MASK) == 0x3) - temp -= AMDTEMP_CURTMP_RANGE_ADJUST; + AMDTEMP_REPTMP10H_TJSEL_MASK) == 0x3); - temp += AMDTEMP_ZERO_C_TO_K + sc_offset * 10; - return (temp); + return (amdtemp_decode_fam10h_to_17h(sc_offset, + val >> AMDTEMP_REPTMP10H_CURTMP_SHIFT, minus49)); +} + +static uint32_t +amdtemp_decode_fam17h_tctl(int32_t sc_offset, uint32_t val) +{ + bool minus49; + + minus49 = ((val & AMDTEMP_17H_CUR_TMP_RANGE_SEL) != 0); + return (amdtemp_decode_fam10h_to_17h(sc_offset, + val >> AMDTEMP_REPTMP10H_CURTMP_SHIFT, minus49)); } static int32_t @@ -699,16 +719,11 @@ static int32_t amdtemp_gettemp17h(device_t dev, amdsensor_t sensor) { struct amdtemp_softc *sc = device_get_softc(dev); - uint32_t temp, val; + uint32_t val; int error; error = amdsmn_read(sc->sc_smn, AMDTEMP_17H_CUR_TMP, &val); KASSERT(error == 0, ("amdsmn_read")); - temp = ((val >> 21) & 0x7ff) * 5 / 4; - if ((val & AMDTEMP_17H_CUR_TMP_RANGE_SEL) != 0) - temp -= AMDTEMP_CURTMP_RANGE_ADJUST; - temp += AMDTEMP_ZERO_C_TO_K + sc->sc_offset * 10; - - return (temp); + return (amdtemp_decode_fam17h_tctl(sc->sc_offset, val)); } From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 15:14: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 37DC954E78C; Thu, 4 Mar 2021 15:14: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 4DrvXb14ysz3w66; Thu, 4 Mar 2021 15:14: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 183841F6FB; Thu, 4 Mar 2021 15:14: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 124FE7KA058934; Thu, 4 Mar 2021 15:14:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124FE76q058933; Thu, 4 Mar 2021 15:14:07 GMT (envelope-from git) Date: Thu, 4 Mar 2021 15:14:07 GMT Message-Id: <202103041514.124FE76q058933@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: 4b8f69d7805b - stable/12 - amdtemp(4): Add support for Family 17h CCD sensors 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: 4b8f69d7805b17dd8fef910e548dac65076f6ad5 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 Mar 2021 15:14:07 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=4b8f69d7805b17dd8fef910e548dac65076f6ad5 commit 4b8f69d7805b17dd8fef910e548dac65076f6ad5 Author: Conrad Meyer AuthorDate: 2020-01-28 01:39:50 +0000 Commit: Alexander Motin CommitDate: 2021-03-04 15:05:09 +0000 amdtemp(4): Add support for Family 17h CCD sensors Probe Family 17h CPUs for up to 4 (Zen, Zen+) or 8 (Zen2) CCD temperature sensors. These were discovered by Ondrej ÄŒerman (https://github.com/ocerman) and collaborators experimentally, and are not currently documented in any datasheet I have access to. (cherry picked from commit c59b9a4f8d2c7a34782a3885f1c76fb1decea174) --- sys/dev/amdsmn/amdsmn.c | 2 +- sys/dev/amdtemp/amdtemp.c | 102 ++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 94 insertions(+), 10 deletions(-) diff --git a/sys/dev/amdsmn/amdsmn.c b/sys/dev/amdsmn/amdsmn.c index 0c4460c1100f..ec09dbc4d8e5 100644 --- a/sys/dev/amdsmn/amdsmn.c +++ b/sys/dev/amdsmn/amdsmn.c @@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$"); #define PCI_DEVICE_ID_AMD_15H_M60H_ROOT 0x1576 #define PCI_DEVICE_ID_AMD_17H_ROOT 0x1450 #define PCI_DEVICE_ID_AMD_17H_M10H_ROOT 0x15d0 -#define PCI_DEVICE_ID_AMD_17H_M30H_ROOT 0x1480 +#define PCI_DEVICE_ID_AMD_17H_M30H_ROOT 0x1480 /* Also M70H. */ struct pciid; struct amdsmn_softc { diff --git a/sys/dev/amdtemp/amdtemp.c b/sys/dev/amdtemp/amdtemp.c index 023a88b46120..8eb279c19cb8 100644 --- a/sys/dev/amdtemp/amdtemp.c +++ b/sys/dev/amdtemp/amdtemp.c @@ -5,8 +5,7 @@ * Copyright (c) 2009 Norikatsu Shigemura * Copyright (c) 2009-2012 Jung-uk Kim * All rights reserved. - * Copyright (c) 2017-2019 Conrad Meyer - * All rights reserved. + * Copyright (c) 2017-2020 Conrad Meyer . All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -61,7 +60,18 @@ typedef enum { CORE1_SENSOR0, CORE1_SENSOR1, CORE0, - CORE1 + CORE1, + CCD1, + CCD_BASE = CCD1, + CCD2, + CCD3, + CCD4, + CCD5, + CCD6, + CCD7, + CCD8, + CCD_MAX = CCD8, + NUM_CCDS = CCD_MAX - CCD_BASE + 1, } amdsensor_t; struct amdtemp_softc { @@ -96,7 +106,7 @@ struct amdtemp_softc { #define DEVICEID_AMD_MISC16_M30H 0x1583 #define DEVICEID_AMD_HOSTB17H_ROOT 0x1450 #define DEVICEID_AMD_HOSTB17H_M10H_ROOT 0x15d0 -#define DEVICEID_AMD_HOSTB17H_M30H_ROOT 0x1480 +#define DEVICEID_AMD_HOSTB17H_M30H_ROOT 0x1480 /* Also M70h. */ static const struct amdtemp_product { uint16_t amdtemp_vendorid; @@ -149,7 +159,15 @@ static const struct amdtemp_product { * to -49..206C. */ #define AMDTEMP_17H_CUR_TMP 0x59800 -#define AMDTEMP_17H_CUR_TMP_RANGE_SEL (1 << 19) +#define AMDTEMP_17H_CUR_TMP_RANGE_SEL (1u << 19) +/* + * The following register set was discovered experimentally by Ondrej ÄŒerman + * and collaborators, but is not (yet) documented in a PPR/OSRR (other than + * the M70H PPR SMN memory map showing [0x59800, +0x314] as allocated to + * SMU::THM). It seems plausible and the Linux sensor folks have adopted it. + */ +#define AMDTEMP_17H_CCD_TMP_BASE 0x59954 +#define AMDTEMP_17H_CCD_TMP_VALID (1u << 11) /* * AMD temperature range adjustment, in deciKelvins (i.e., 49.0 Celsius). @@ -186,6 +204,7 @@ static int32_t amdtemp_gettemp0f(device_t dev, amdsensor_t sensor); static int32_t amdtemp_gettemp(device_t dev, amdsensor_t sensor); static int32_t amdtemp_gettemp15hm60h(device_t dev, amdsensor_t sensor); static int32_t amdtemp_gettemp17h(device_t dev, amdsensor_t sensor); +static void amdtemp_probe_ccd_sensors17h(device_t dev, uint32_t model); static int amdtemp_sysctl(SYSCTL_HANDLER_ARGS); static device_method_t amdtemp_methods[] = { @@ -485,7 +504,9 @@ amdtemp_attach(device_t dev) dev, CORE0_SENSOR0, amdtemp_sysctl, "IK", "Core 0 / Sensor 0 temperature"); - if (sc->sc_ntemps > 1) { + if (family == 0x17) + amdtemp_probe_ccd_sensors17h(dev, model); + else if (sc->sc_ntemps > 1) { SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sysctlnode), OID_AUTO, "sensor1", CTLTYPE_INT | CTLFLAG_RD, @@ -638,6 +659,8 @@ amdtemp_gettemp0f(device_t dev, amdsensor_t sensor) if ((sc->sc_flags & AMDTEMP_FLAG_CS_SWAP) == 0) temp |= AMDTEMP_TTSR_SELCORE; break; + default: + __unreachable(); } pci_write_config(dev, AMDTEMP_THERMTP_STAT, temp, 1); @@ -722,8 +745,69 @@ amdtemp_gettemp17h(device_t dev, amdsensor_t sensor) uint32_t val; int error; - error = amdsmn_read(sc->sc_smn, AMDTEMP_17H_CUR_TMP, &val); - KASSERT(error == 0, ("amdsmn_read")); + switch (sensor) { + case CORE0_SENSOR0: + /* Tctl */ + error = amdsmn_read(sc->sc_smn, AMDTEMP_17H_CUR_TMP, &val); + KASSERT(error == 0, ("amdsmn_read")); + return (amdtemp_decode_fam17h_tctl(sc->sc_offset, val)); + case CCD_BASE ... CCD_MAX: + /* Tccd */ + error = amdsmn_read(sc->sc_smn, AMDTEMP_17H_CCD_TMP_BASE + + (((int)sensor - CCD_BASE) * sizeof(val)), &val); + KASSERT(error == 0, ("amdsmn_read2")); + KASSERT((val & AMDTEMP_17H_CCD_TMP_VALID) != 0, + ("sensor %d: not valid", (int)sensor)); + return (amdtemp_decode_fam10h_to_17h(sc->sc_offset, val, true)); + default: +#if 0 + KASSERT(false, ("%s: invalid sensor %d", __func__, + (int)sensor)); + return (-1); +#endif + __unreachable(); + } +} + +static void +amdtemp_probe_ccd_sensors17h(device_t dev, uint32_t model) +{ + char sensor_name[16], sensor_descr[32]; + struct amdtemp_softc *sc; + uint32_t maxreg, i, val; + int error; + + switch (model) { + case 0x00 ... 0x1f: /* Zen1, Zen+ */ + maxreg = 4; + break; + case 0x30 ... 0x3f: /* Zen2 TR/Epyc */ + case 0x70 ... 0x7f: /* Zen2 Ryzen */ + maxreg = 8; + _Static_assert((int)NUM_CCDS >= 8, ""); + break; + default: + device_printf(dev, + "Unrecognized Family 17h Model: %02xh\n", model); + return; + } - return (amdtemp_decode_fam17h_tctl(sc->sc_offset, val)); + sc = device_get_softc(dev); + for (i = 0; i < maxreg; i++) { + error = amdsmn_read(sc->sc_smn, AMDTEMP_17H_CCD_TMP_BASE + + (i * sizeof(val)), &val); + if (error != 0) + continue; + if ((val & AMDTEMP_17H_CCD_TMP_VALID) == 0) + continue; + + snprintf(sensor_name, sizeof(sensor_name), "ccd%u", i); + snprintf(sensor_descr, sizeof(sensor_descr), + "CCD %u temperature (Tccd%u)", i, i); + + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, + sensor_name, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, + dev, CCD_BASE + i, amdtemp_sysctl, "IK", sensor_descr); + } } From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 15:14: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 47D7A54E4C7; Thu, 4 Mar 2021 15:14: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 4DrvXc45jwz3vvQ; Thu, 4 Mar 2021 15:14: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 5DCFF1F52B; Thu, 4 Mar 2021 15:14: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 124FE8FQ058953; Thu, 4 Mar 2021 15:14:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124FE85f058952; Thu, 4 Mar 2021 15:14:08 GMT (envelope-from git) Date: Thu, 4 Mar 2021 15:14:08 GMT Message-Id: <202103041514.124FE85f058952@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: 40c0c3ef1f7d - stable/12 - amdtemp(4): Remove dead code that snuck in with r357190 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: 40c0c3ef1f7d1b932e8c22e0a62d2336a4f898e9 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 Mar 2021 15:14:15 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=40c0c3ef1f7d1b932e8c22e0a62d2336a4f898e9 commit 40c0c3ef1f7d1b932e8c22e0a62d2336a4f898e9 Author: Conrad Meyer AuthorDate: 2020-01-28 03:27:06 +0000 Commit: Alexander Motin CommitDate: 2021-03-04 15:09:18 +0000 amdtemp(4): Remove dead code that snuck in with r357190 I intended to remove this before committing, but neglected to. (cherry picked from commit cc3b01385bfd7e7f67866c4ac0a1b43370d7e6b7) --- sys/dev/amdtemp/amdtemp.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sys/dev/amdtemp/amdtemp.c b/sys/dev/amdtemp/amdtemp.c index 8eb279c19cb8..38be7d9bd1b5 100644 --- a/sys/dev/amdtemp/amdtemp.c +++ b/sys/dev/amdtemp/amdtemp.c @@ -760,11 +760,6 @@ amdtemp_gettemp17h(device_t dev, amdsensor_t sensor) ("sensor %d: not valid", (int)sensor)); return (amdtemp_decode_fam10h_to_17h(sc->sc_offset, val, true)); default: -#if 0 - KASSERT(false, ("%s: invalid sensor %d", __func__, - (int)sensor)); - return (-1); -#endif __unreachable(); } } From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 15:14: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 1960E54E5AA; Thu, 4 Mar 2021 15:14: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 4DrvXg014Zz3w9f; Thu, 4 Mar 2021 15:14: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 A2CA51F70B; Thu, 4 Mar 2021 15:14: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 124FE9mf058975; Thu, 4 Mar 2021 15:14:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124FE9l3058974; Thu, 4 Mar 2021 15:14:09 GMT (envelope-from git) Date: Thu, 4 Mar 2021 15:14:09 GMT Message-Id: <202103041514.124FE9l3058974@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: 89f349bab6d6 - stable/12 - amdtemp(4), amdsmn(4): Attach to Ryzen 4000 APU (Zen 2, "Renoir") 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: 89f349bab6d6e6176704b83bd0ec358f9689a6cf 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 Mar 2021 15:14:16 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=89f349bab6d6e6176704b83bd0ec358f9689a6cf commit 89f349bab6d6e6176704b83bd0ec358f9689a6cf Author: Conrad Meyer AuthorDate: 2020-09-25 04:16:28 +0000 Commit: Alexander Motin CommitDate: 2021-03-04 15:10:39 +0000 amdtemp(4), amdsmn(4): Attach to Ryzen 4000 APU (Zen 2, "Renoir") PR: 249864 Reported by: Florian Millet Tested by: Florian Millet (cherry picked from commit 5b505170794dfaae633294aaf178bd797b7a1b11) --- sys/dev/amdsmn/amdsmn.c | 9 ++++++++- sys/dev/amdtemp/amdtemp.c | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/dev/amdsmn/amdsmn.c b/sys/dev/amdsmn/amdsmn.c index ec09dbc4d8e5..ebc45256d14d 100644 --- a/sys/dev/amdsmn/amdsmn.c +++ b/sys/dev/amdsmn/amdsmn.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2017-2019 Conrad Meyer + * Copyright (c) 2017-2020 Conrad Meyer * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #define PCI_DEVICE_ID_AMD_17H_ROOT 0x1450 #define PCI_DEVICE_ID_AMD_17H_M10H_ROOT 0x15d0 #define PCI_DEVICE_ID_AMD_17H_M30H_ROOT 0x1480 /* Also M70H. */ +#define PCI_DEVICE_ID_AMD_17H_M60H_ROOT 0x1630 struct pciid; struct amdsmn_softc { @@ -97,6 +98,12 @@ static const struct pciid { .amdsmn_addr_reg = F17H_SMN_ADDR_REG, .amdsmn_data_reg = F17H_SMN_DATA_REG, }, + { + .amdsmn_vendorid = CPU_VENDOR_AMD, + .amdsmn_deviceid = PCI_DEVICE_ID_AMD_17H_M60H_ROOT, + .amdsmn_addr_reg = F17H_SMN_ADDR_REG, + .amdsmn_data_reg = F17H_SMN_DATA_REG, + }, }; /* diff --git a/sys/dev/amdtemp/amdtemp.c b/sys/dev/amdtemp/amdtemp.c index 38be7d9bd1b5..5847f9da00e1 100644 --- a/sys/dev/amdtemp/amdtemp.c +++ b/sys/dev/amdtemp/amdtemp.c @@ -107,6 +107,7 @@ struct amdtemp_softc { #define DEVICEID_AMD_HOSTB17H_ROOT 0x1450 #define DEVICEID_AMD_HOSTB17H_M10H_ROOT 0x15d0 #define DEVICEID_AMD_HOSTB17H_M30H_ROOT 0x1480 /* Also M70h. */ +#define DEVICEID_AMD_HOSTB17H_M60H_ROOT 0x1630 static const struct amdtemp_product { uint16_t amdtemp_vendorid; @@ -130,6 +131,7 @@ static const struct amdtemp_product { { VENDORID_AMD, DEVICEID_AMD_HOSTB17H_ROOT, false }, { VENDORID_AMD, DEVICEID_AMD_HOSTB17H_M10H_ROOT, false }, { VENDORID_AMD, DEVICEID_AMD_HOSTB17H_M30H_ROOT, false }, + { VENDORID_AMD, DEVICEID_AMD_HOSTB17H_M60H_ROOT, false }, }; /* From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 15:14: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 AE2D254E5A8; Thu, 4 Mar 2021 15:14: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 4DrvXg6ghmz3w1R; Thu, 4 Mar 2021 15:14: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 9A8CC1F5BE; Thu, 4 Mar 2021 15:14: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 124FEALq058996; Thu, 4 Mar 2021 15:14:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124FEA9l058994; Thu, 4 Mar 2021 15:14:10 GMT (envelope-from git) Date: Thu, 4 Mar 2021 15:14:10 GMT Message-Id: <202103041514.124FEA9l058994@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: c7d9dcb97ab7 - stable/12 - amdsmn(4), amdtemp(4): add support for Family 19h (Zen 3) 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: c7d9dcb97ab74cf6f5116df6622d1eff455f5df1 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 Mar 2021 15:14:16 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=c7d9dcb97ab74cf6f5116df6622d1eff455f5df1 commit c7d9dcb97ab74cf6f5116df6622d1eff455f5df1 Author: Conrad Meyer AuthorDate: 2020-12-12 19:34:12 +0000 Commit: Alexander Motin CommitDate: 2021-03-04 15:10:50 +0000 amdsmn(4), amdtemp(4): add support for Family 19h (Zen 3) Zen 3 "Vermeer" support, tested on Ryzen 9 5950X. Model numbers from https://en.wikichip.org/wiki/amd/cpuid "Extended Model" column. Submitted by: Greg V Differential Revision: https://reviews.freebsd.org/D27552 (cherry picked from commit ea6189d3a470ce9ffb19335f915eab6af0cfef57) --- sys/dev/amdsmn/amdsmn.c | 3 ++- sys/dev/amdtemp/amdtemp.c | 69 ++++++++++++++++++++++++++++++++++------------- 2 files changed, 53 insertions(+), 19 deletions(-) diff --git a/sys/dev/amdsmn/amdsmn.c b/sys/dev/amdsmn/amdsmn.c index ebc45256d14d..e83219b02705 100644 --- a/sys/dev/amdsmn/amdsmn.c +++ b/sys/dev/amdsmn/amdsmn.c @@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$"); #define PCI_DEVICE_ID_AMD_15H_M60H_ROOT 0x1576 #define PCI_DEVICE_ID_AMD_17H_ROOT 0x1450 #define PCI_DEVICE_ID_AMD_17H_M10H_ROOT 0x15d0 -#define PCI_DEVICE_ID_AMD_17H_M30H_ROOT 0x1480 /* Also M70H. */ +#define PCI_DEVICE_ID_AMD_17H_M30H_ROOT 0x1480 /* Also M70H, F19H M00H/M20H */ #define PCI_DEVICE_ID_AMD_17H_M60H_ROOT 0x1630 struct pciid; @@ -187,6 +187,7 @@ amdsmn_probe(device_t dev) switch (family) { case 0x15: case 0x17: + case 0x19: break; default: return (ENXIO); diff --git a/sys/dev/amdtemp/amdtemp.c b/sys/dev/amdtemp/amdtemp.c index 5847f9da00e1..48c4341a67cb 100644 --- a/sys/dev/amdtemp/amdtemp.c +++ b/sys/dev/amdtemp/amdtemp.c @@ -106,7 +106,7 @@ struct amdtemp_softc { #define DEVICEID_AMD_MISC16_M30H 0x1583 #define DEVICEID_AMD_HOSTB17H_ROOT 0x1450 #define DEVICEID_AMD_HOSTB17H_M10H_ROOT 0x15d0 -#define DEVICEID_AMD_HOSTB17H_M30H_ROOT 0x1480 /* Also M70h. */ +#define DEVICEID_AMD_HOSTB17H_M30H_ROOT 0x1480 /* Also M70H, F19H M00H/M20H */ #define DEVICEID_AMD_HOSTB17H_M60H_ROOT 0x1630 static const struct amdtemp_product { @@ -207,6 +207,7 @@ static int32_t amdtemp_gettemp(device_t dev, amdsensor_t sensor); static int32_t amdtemp_gettemp15hm60h(device_t dev, amdsensor_t sensor); static int32_t amdtemp_gettemp17h(device_t dev, amdsensor_t sensor); static void amdtemp_probe_ccd_sensors17h(device_t dev, uint32_t model); +static void amdtemp_probe_ccd_sensors19h(device_t dev, uint32_t model); static int amdtemp_sysctl(SYSCTL_HANDLER_ARGS); static device_method_t amdtemp_methods[] = { @@ -294,6 +295,7 @@ amdtemp_probe(device_t dev) case 0x15: case 0x16: case 0x17: + case 0x19: break; default: return (ENXIO); @@ -451,6 +453,7 @@ amdtemp_attach(device_t dev) sc->sc_gettemp = amdtemp_gettemp; break; case 0x17: + case 0x19: sc->sc_ntemps = 1; sc->sc_gettemp = amdtemp_gettemp17h; needsmn = true; @@ -508,6 +511,8 @@ amdtemp_attach(device_t dev) if (family == 0x17) amdtemp_probe_ccd_sensors17h(dev, model); + else if (family == 0x19) + amdtemp_probe_ccd_sensors19h(dev, model); else if (sc->sc_ntemps > 1) { SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sysctlnode), @@ -767,28 +772,13 @@ amdtemp_gettemp17h(device_t dev, amdsensor_t sensor) } static void -amdtemp_probe_ccd_sensors17h(device_t dev, uint32_t model) +amdtemp_probe_ccd_sensors(device_t dev, uint32_t maxreg) { char sensor_name[16], sensor_descr[32]; struct amdtemp_softc *sc; - uint32_t maxreg, i, val; + uint32_t i, val; int error; - switch (model) { - case 0x00 ... 0x1f: /* Zen1, Zen+ */ - maxreg = 4; - break; - case 0x30 ... 0x3f: /* Zen2 TR/Epyc */ - case 0x70 ... 0x7f: /* Zen2 Ryzen */ - maxreg = 8; - _Static_assert((int)NUM_CCDS >= 8, ""); - break; - default: - device_printf(dev, - "Unrecognized Family 17h Model: %02xh\n", model); - return; - } - sc = device_get_softc(dev); for (i = 0; i < maxreg; i++) { error = amdsmn_read(sc->sc_smn, AMDTEMP_17H_CCD_TMP_BASE + @@ -808,3 +798,46 @@ amdtemp_probe_ccd_sensors17h(device_t dev, uint32_t model) dev, CCD_BASE + i, amdtemp_sysctl, "IK", sensor_descr); } } + +static void +amdtemp_probe_ccd_sensors17h(device_t dev, uint32_t model) +{ + uint32_t maxreg; + + switch (model) { + case 0x00 ... 0x1f: /* Zen1, Zen+ */ + maxreg = 4; + break; + case 0x30 ... 0x3f: /* Zen2 TR/EPYC */ + case 0x70 ... 0x7f: /* Zen2 Ryzen */ + maxreg = 8; + _Static_assert((int)NUM_CCDS >= 8, ""); + break; + default: + device_printf(dev, + "Unrecognized Family 17h Model: %02xh\n", model); + return; + } + + amdtemp_probe_ccd_sensors(dev, maxreg); +} + +static void +amdtemp_probe_ccd_sensors19h(device_t dev, uint32_t model) +{ + uint32_t maxreg; + + switch (model) { + case 0x00 ... 0x0f: /* Zen3 EPYC "Milan" */ + case 0x20 ... 0x2f: /* Zen3 Ryzen "Vermeer" */ + maxreg = 8; + _Static_assert((int)NUM_CCDS >= 8, ""); + break; + default: + device_printf(dev, + "Unrecognized Family 19h Model: %02xh\n", model); + return; + } + + amdtemp_probe_ccd_sensors(dev, maxreg); +} From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 15:14:16 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 893F654E2FB; Thu, 4 Mar 2021 15:14: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 4DrvXh5LYwz3w7y; Thu, 4 Mar 2021 15:14: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 A75FC1F5BF; Thu, 4 Mar 2021 15:14: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 124FEBeG059015; Thu, 4 Mar 2021 15:14:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124FEBnK059014; Thu, 4 Mar 2021 15:14:11 GMT (envelope-from git) Date: Thu, 4 Mar 2021 15:14:11 GMT Message-Id: <202103041514.124FEBnK059014@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: e549b1bc5373 - stable/12 - amdtemp(4): Add missing Family 17h models 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: e549b1bc537377528bf966fef92f72dd1c1be8d3 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 Mar 2021 15:14:17 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=e549b1bc537377528bf966fef92f72dd1c1be8d3 commit e549b1bc537377528bf966fef92f72dd1c1be8d3 Author: Conrad Meyer AuthorDate: 2020-12-12 19:43:38 +0000 Commit: Alexander Motin CommitDate: 2021-03-04 15:11:02 +0000 amdtemp(4): Add missing Family 17h models Add missing model numbers M20h (Dali, Zen1), M60H (Renoir, Zen2), and M90H (Van Gogh, Zen2). Submitted by: Greg V (cherry picked from commit b499ab877f3d6bf5e2c894edfcfdcf89ce7c79d3) --- sys/dev/amdtemp/amdtemp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/dev/amdtemp/amdtemp.c b/sys/dev/amdtemp/amdtemp.c index 48c4341a67cb..ba7c98bdb278 100644 --- a/sys/dev/amdtemp/amdtemp.c +++ b/sys/dev/amdtemp/amdtemp.c @@ -805,11 +805,12 @@ amdtemp_probe_ccd_sensors17h(device_t dev, uint32_t model) uint32_t maxreg; switch (model) { - case 0x00 ... 0x1f: /* Zen1, Zen+ */ + case 0x00 ... 0x2f: /* Zen1, Zen+ */ maxreg = 4; break; - case 0x30 ... 0x3f: /* Zen2 TR/EPYC */ - case 0x70 ... 0x7f: /* Zen2 Ryzen */ + case 0x30 ... 0x3f: /* Zen2 TR (Castle Peak)/EPYC (Rome) */ + case 0x60 ... 0x7f: /* Zen2 Ryzen (Renoir APU, Matisse) */ + case 0x90 ... 0x9f: /* Zen2 Ryzen (Van Gogh APU) */ maxreg = 8; _Static_assert((int)NUM_CCDS >= 8, ""); break; From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 17:44: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 6CDC355312E; Thu, 4 Mar 2021 17:44: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 4DrytG1tKhz4bgB; Thu, 4 Mar 2021 17:44: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 3347A2116C; Thu, 4 Mar 2021 17:44: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 124Hic3Q056122; Thu, 4 Mar 2021 17:44:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124Hich3056121; Thu, 4 Mar 2021 17:44:38 GMT (envelope-from git) Date: Thu, 4 Mar 2021 17:44:38 GMT Message-Id: <202103041744.124Hich3056121@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 6d85483f4c4d - stable/13 - qeueue.h: Add {SLIST, STAILQ, LIST, TAILQ}_END() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6d85483f4c4d5636da141816273d52b145af3df6 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 Mar 2021 17:44:38 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=6d85483f4c4d5636da141816273d52b145af3df6 commit 6d85483f4c4d5636da141816273d52b145af3df6 Author: Alex Richardson AuthorDate: 2021-01-25 14:11:45 +0000 Commit: Alex Richardson CommitDate: 2021-03-04 17:43:48 +0000 qeueue.h: Add {SLIST,STAILQ,LIST,TAILQ}_END() We provide these for compat with other queue.h headers since some software assumes it exists (e.g. the libevent contrib code), but we are not encouraging their use (NULL should be used instead). This fixes the following warning (which should arguable be an error since it results in a function call to an undefined function): .../contrib/libevent/buffer.c:495:16: warning: implicit declaration of function 'LIST_END' is invalid in C99 [-Wimplicit-function-declaration] cbent != LIST_END(&buffer->callbacks); ^ .../contrib/libevent/buffer.c:495:13: warning: comparison between pointer and integer ('struct evbuffer_cb_entry *' and 'int') [-Wpointer-integer-compare] cbent != LIST_END(&buffer->callbacks); ~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Reviewed By: jhb Differential Revision: https://reviews.freebsd.org/D27151 (cherry picked from commit 8d55837dc1331a5cdacad539b1788ab1070159b4) --- sys/fs/nfs/nfsport.h | 2 ++ sys/sys/queue.h | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/sys/fs/nfs/nfsport.h b/sys/fs/nfs/nfsport.h index 7d1c3b1c8cea..9f2789f57bec 100644 --- a/sys/fs/nfs/nfsport.h +++ b/sys/fs/nfs/nfsport.h @@ -880,9 +880,11 @@ int nfsmsleep(void *, void *, int, const char *, struct timespec *); /* * Some queue.h files don't have these dfined in them. */ +#ifndef LIST_END #define LIST_END(head) NULL #define SLIST_END(head) NULL #define TAILQ_END(head) NULL +#endif /* * This must be defined to be a global variable that increments once diff --git a/sys/sys/queue.h b/sys/sys/queue.h index 14d55905dfc0..25091ec815f1 100644 --- a/sys/sys/queue.h +++ b/sys/sys/queue.h @@ -91,6 +91,7 @@ * _CLASS_ENTRY + + + + * _INIT + + + + * _EMPTY + + + + + * _END + + + + * _FIRST + + + + * _NEXT + + + + * _PREV - + - + @@ -305,6 +306,8 @@ struct { \ SLIST_FIRST(head2) = swap_first; \ } while (0) +#define SLIST_END(head) NULL + /* * Singly-linked Tail queue declarations. */ @@ -437,6 +440,9 @@ struct { \ (head2)->stqh_last = &STAILQ_FIRST(head2); \ } while (0) +#define STAILQ_END(head) NULL + + /* * List declarations. */ @@ -611,6 +617,8 @@ struct { \ swap_tmp->field.le_prev = &LIST_FIRST((head2)); \ } while (0) +#define LIST_END(head) NULL + /* * Tail queue declarations. */ @@ -867,4 +875,6 @@ struct { \ (head2)->tqh_last = &(head2)->tqh_first; \ } while (0) +#define TAILQ_END(head) NULL + #endif /* !_SYS_QUEUE_H_ */ From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 19:24: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 A05ED55606F; Thu, 4 Mar 2021 19:24: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 4Ds16148RCz4kcx; Thu, 4 Mar 2021 19:24: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 813A922C28; Thu, 4 Mar 2021 19:24: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 124JOvnR087907; Thu, 4 Mar 2021 19:24:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124JOvsY087906; Thu, 4 Mar 2021 19:24:57 GMT (envelope-from git) Date: Thu, 4 Mar 2021 19:24:57 GMT Message-Id: <202103041924.124JOvsY087906@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: def8b2b427ea - stable/13 - FFS extattr: fix handling of the tail 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: def8b2b427ea5bff099e70b2a8351312be9e997a 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 Mar 2021 19:24:57 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=def8b2b427ea5bff099e70b2a8351312be9e997a commit def8b2b427ea5bff099e70b2a8351312be9e997a Author: Konstantin Belousov AuthorDate: 2021-03-01 15:24:11 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-04 19:07:25 +0000 FFS extattr: fix handling of the tail (cherry picked from commit 8742817ba62ec604156c139727155d36f5fbad06) --- sys/ufs/ffs/ffs_vnops.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index af03b369a280..582ccccc2e12 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1346,13 +1346,20 @@ ffs_rdextattr(u_char **p, struct vnode *vp, struct thread *td) /* Validate disk xattrfile contents. */ for (eap = (void *)eae, eaend = (void *)(eae + easize); eap < eaend; eap = eapnext) { + /* Detect zeroed out tail */ + if (eap->ea_length < sizeof(*eap) || eap->ea_length == 0) { + easize = (const u_char *)eap - eae; + break; + } + eapnext = EXTATTR_NEXT(eap); - /* Bogusly short entry or bogusly long entry. */ - if (eap->ea_length < sizeof(*eap) || eapnext > eaend) { + /* Bogusly long entry. */ + if (eapnext > eaend) { free(eae, M_TEMP); return (EINTEGRITY); } } + ip->i_ea_len = easize; *p = eae; return (0); } @@ -1407,7 +1414,6 @@ ffs_open_ea(struct vnode *vp, struct ucred *cred, struct thread *td) ffs_unlock_ea(vp); return (error); } - ip->i_ea_len = dp->di_extsize; ip->i_ea_error = 0; ip->i_ea_refs++; ffs_unlock_ea(vp); @@ -1426,6 +1432,7 @@ ffs_close_ea(struct vnode *vp, int commit, struct ucred *cred, struct thread *td struct ufs2_dinode *dp; size_t ea_len, tlen; int error, i, lcnt; + bool truncate; ip = VTOI(vp); @@ -1436,6 +1443,7 @@ ffs_close_ea(struct vnode *vp, int commit, struct ucred *cred, struct thread *td } dp = ip->i_din2; error = ip->i_ea_error; + truncate = false; if (commit && error == 0) { ASSERT_VOP_ELOCKED(vp, "ffs_close_ea commit"); if (cred == NOCRED) @@ -1452,12 +1460,12 @@ ffs_close_ea(struct vnode *vp, int commit, struct ucred *cred, struct thread *td liovec[0].iov_base = ip->i_ea_area; liovec[0].iov_len = ip->i_ea_len; - for (i = 1, tlen = ea_len; i < lcnt; i++) { + for (i = 1, tlen = ea_len - ip->i_ea_len; i < lcnt; i++) { liovec[i].iov_base = __DECONST(void *, zero_region); liovec[i].iov_len = MIN(ZERO_REGION_SIZE, tlen); tlen -= liovec[i].iov_len; } - MPASS(tlen == ip->i_ea_len); + MPASS(tlen == 0); luio.uio_iov = liovec; luio.uio_offset = 0; @@ -1466,6 +1474,8 @@ ffs_close_ea(struct vnode *vp, int commit, struct ucred *cred, struct thread *td luio.uio_rw = UIO_WRITE; luio.uio_td = td; error = ffs_extwrite(vp, &luio, IO_EXT | IO_SYNC, cred); + if (error == 0 && ip->i_ea_len == 0) + truncate = true; } if (--ip->i_ea_refs == 0) { free(ip->i_ea_area, M_TEMP); @@ -1475,7 +1485,7 @@ ffs_close_ea(struct vnode *vp, int commit, struct ucred *cred, struct thread *td } ffs_unlock_ea(vp); - if (commit && error == 0 && ip->i_ea_len == 0) + if (truncate) ffs_truncate(vp, 0, IO_EXT, cred); return (error); } From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 19: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 C64A755659A; Thu, 4 Mar 2021 19:24: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 4Ds16258Ptz4krr; Thu, 4 Mar 2021 19:24: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 A279622A60; Thu, 4 Mar 2021 19:24: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 124JOwDF087930; Thu, 4 Mar 2021 19:24:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124JOweT087929; Thu, 4 Mar 2021 19:24:58 GMT (envelope-from git) Date: Thu, 4 Mar 2021 19:24:58 GMT Message-Id: <202103041924.124JOweT087929@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: efc5f3d45469 - stable/13 - fhlink(2): the syscalls do not take flag 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: efc5f3d454696625fdbd363a53df35eeb176f209 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 Mar 2021 19:24:58 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=efc5f3d454696625fdbd363a53df35eeb176f209 commit efc5f3d454696625fdbd363a53df35eeb176f209 Author: Konstantin Belousov AuthorDate: 2021-02-28 00:38:11 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-04 19:10:39 +0000 fhlink(2): the syscalls do not take flag (cherry picked from commit 600756afb532a86a39fb488f5c4fc7e248921655) --- lib/libc/sys/fhlink.2 | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/lib/libc/sys/fhlink.2 b/lib/libc/sys/fhlink.2 index da35d2b103e6..029ec8d7c2eb 100644 --- a/lib/libc/sys/fhlink.2 +++ b/lib/libc/sys/fhlink.2 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt FHLINK 2 .Os .Sh NAME @@ -95,33 +95,6 @@ the directory associated with the file descriptor .Fa tofd instead of the current working directory. .Pp -Values for -.Fa flag -are constructed by a bitwise-inclusive OR of flags from the following -list, defined in -.In fcntl.h : -.Bl -tag -width indent -.It Dv AT_SYMLINK_FOLLOW -If -.Fa fhp -names a symbolic link, a new link for the target of the symbolic link is -created. -.It Dv AT_BENEATH -Only allow to link to a file which is beneath of the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. -.It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. -See the description of the -.Dv O_RESOLVE_BENEATH -flag in the -.Xr open 2 -manual page. -.El -.Pp If .Fn fhlinkat is passed the special value From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 19:25: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 2EEC45566A0; Thu, 4 Mar 2021 19:25: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 4Ds1635Nklz4kjs; Thu, 4 Mar 2021 19:24: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 A5D1B22D93; Thu, 4 Mar 2021 19:24: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 124JOxSZ087951; Thu, 4 Mar 2021 19:24:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124JOxvA087949; Thu, 4 Mar 2021 19:24:59 GMT (envelope-from git) Date: Thu, 4 Mar 2021 19:24:59 GMT Message-Id: <202103041924.124JOxvA087949@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: 6da53183f9ff - stable/13 - open(2): Remove O_BENEATH and AT_BENEATH 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: 6da53183f9ff77561f7653ac202be2042638fb10 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 Mar 2021 19:25:00 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=6da53183f9ff77561f7653ac202be2042638fb10 commit 6da53183f9ff77561f7653ac202be2042638fb10 Author: Konstantin Belousov AuthorDate: 2021-02-16 03:31:40 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-04 19:10:44 +0000 open(2): Remove O_BENEATH and AT_BENEATH (cherry picked from commit 20e91ca36a56b8db1e6677f577ad011b66dd6eb3) --- lib/libc/sys/access.2 | 24 +++------------ lib/libc/sys/chflags.2 | 29 +++++------------- lib/libc/sys/chmod.2 | 29 +++++------------- lib/libc/sys/chown.2 | 29 +++++------------- lib/libc/sys/getfh.2 | 37 +++++------------------ lib/libc/sys/link.2 | 28 +++++------------ lib/libc/sys/open.2 | 77 ++++++++--------------------------------------- lib/libc/sys/stat.2 | 50 +++++-------------------------- lib/libc/sys/unlink.2 | 29 +++++------------- lib/libc/sys/utimensat.2 | 29 +++++------------- sys/kern/vfs_lookup.c | 78 +++++++----------------------------------------- sys/kern/vfs_syscalls.c | 51 +++++++++++++------------------ sys/kern/vfs_vnops.c | 2 -- sys/sys/fcntl.h | 14 ++++----- sys/sys/namei.h | 5 ---- 15 files changed, 112 insertions(+), 399 deletions(-) diff --git a/lib/libc/sys/access.2 b/lib/libc/sys/access.2 index 1cd7eed1301b..13bfd7e5a88a 100644 --- a/lib/libc/sys/access.2 +++ b/lib/libc/sys/access.2 @@ -28,7 +28,7 @@ .\" @(#)access.2 8.2 (Berkeley) 4/1/94 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt ACCESS 2 .Os .Sh NAME @@ -120,15 +120,10 @@ list, defined in The checks for accessibility are performed using the effective user and group IDs instead of the real user and group ID as required in a call to .Fn access . -.It Dv AT_BENEATH -Only operate on files and directories below the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -218,17 +213,6 @@ or contained a ".." component leading to a directory outside of the directory hierarchy specified by .Fa fd , and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fn faccessat , -and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. .El .Sh SEE ALSO .Xr chmod 2 , diff --git a/lib/libc/sys/chflags.2 b/lib/libc/sys/chflags.2 index b6b0b43249c7..a44713904599 100644 --- a/lib/libc/sys/chflags.2 +++ b/lib/libc/sys/chflags.2 @@ -28,7 +28,7 @@ .\" @(#)chflags.2 8.3 (Berkeley) 5/2/95 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt CHFLAGS 2 .Os .Sh NAME @@ -94,16 +94,10 @@ defined in If .Fa path names a symbolic link, then the flags of the symbolic link are changed. -.It Dv AT_BENEATH -Only allow to change flags for a file which is beneath of -the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -327,18 +321,9 @@ is an absolute path, or contained a ".." component leading to a directory outside of the directory hierarchy specified by .Fa fd , -and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fn chflagsat , -and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. +and the process is in capability mode or the +.Dv AT_RESOLVE_BENEATH +flag was specified. .El .Sh SEE ALSO .Xr chflags 1 , diff --git a/lib/libc/sys/chmod.2 b/lib/libc/sys/chmod.2 index 1d66408e3891..0127a5b629e4 100644 --- a/lib/libc/sys/chmod.2 +++ b/lib/libc/sys/chmod.2 @@ -28,7 +28,7 @@ .\" @(#)chmod.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt CHMOD 2 .Os .Sh NAME @@ -101,16 +101,10 @@ in If .Fa path names a symbolic link, then the mode of the symbolic link is changed. -.It Dv AT_BENEATH -Only allow to change permissions of a file which is beneath of -the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -310,18 +304,9 @@ is an absolute path, or contained a ".." component leading to a directory outside of the directory hierarchy specified by .Fa fd , -and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fn fchmodat , -and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. +and the process is in capability mode or the +.Dv AT_RESOLVE_BENEATH +flag was specified. .El .Sh SEE ALSO .Xr chmod 1 , diff --git a/lib/libc/sys/chown.2 b/lib/libc/sys/chown.2 index 64bfdeaa961c..4c45ce9174bb 100644 --- a/lib/libc/sys/chown.2 +++ b/lib/libc/sys/chown.2 @@ -28,7 +28,7 @@ .\" @(#)chown.2 8.4 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt CHOWN 2 .Os .Sh NAME @@ -118,16 +118,10 @@ list, defined in If .Fa path names a symbolic link, ownership of the symbolic link is changed. -.It Dv AT_BENEATH -Only allow to change ownership of a file which is beneath of -the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -252,18 +246,9 @@ is an absolute path, or contained a ".." component leading to a directory outside of the directory hierarchy specified by .Fa fd , -and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fn fchownat , -and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. +and the process is in capability mode or the +.Dv AT_RESOLVE_BENEATH +flag was specified. .El .Sh SEE ALSO .Xr chgrp 1 , diff --git a/lib/libc/sys/getfh.2 b/lib/libc/sys/getfh.2 index 5dc5896af6d8..cd3d54f54d7f 100644 --- a/lib/libc/sys/getfh.2 +++ b/lib/libc/sys/getfh.2 @@ -29,7 +29,7 @@ .\" @(#)getfh.2 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt GETFH 2 .Os .Sh NAME @@ -76,9 +76,7 @@ and .Fn lgetfh except when the .Fa path -specifies a relative path, or the -.Dv AT_BENEATH -flag is provided. +specifies a relative path. For .Fn getfhat and relative @@ -87,13 +85,6 @@ the status is retrieved from a file relative to the directory associated with the file descriptor .Fa fd instead of the current working directory. -For -.Dv AT_BENEATH -and absolute -.Fa path , -the status is retrieved from a file specified by the -.Fa path , -but additional permission checks are performed, see below. .Pp The values for the .Fa flag @@ -105,15 +96,10 @@ defined in If .Fa path names a symbolic link, the status of the symbolic link is returned. -.It Dv AT_BENEATH -Only stat files and directories below the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -140,19 +126,10 @@ bit is set in When .Fn getfhat is called with an absolute -.Fa path -without the -.Dv AT_BENEATH -flag, it ignores the -.Fa fd -argument. -When -.Dv AT_BENEATH -is specified with an absolute .Fa path , -a directory passed by the +it ignores the .Fa fd -argument is used as the topping point for the resolution. +argument. These system calls are restricted to the superuser. .Sh RETURN VALUES .Rv -std diff --git a/lib/libc/sys/link.2 b/lib/libc/sys/link.2 index c3451da10884..de0efd5e510f 100644 --- a/lib/libc/sys/link.2 +++ b/lib/libc/sys/link.2 @@ -28,7 +28,7 @@ .\" @(#)link.2 8.3 (Berkeley) 1/12/94 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt LINK 2 .Os .Sh NAME @@ -115,15 +115,10 @@ If .Fa name1 names a symbolic link, a new link for the target of the symbolic link is created. -.It Dv AT_BENEATH -Only allow to link to a file which is beneath of the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -281,18 +276,9 @@ For example, is absolute or includes a ".." component that escapes the directory hierarchy specified by .Fa fd , -and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fa linkat -and the absolute path -.Fa name1 -does not have its tail fully contained under the topping directory, -or the relative path -.Fa name1 -escapes it. +and the process is in capability mode or the +.Dv AT_RESOLVE_BENEATH +flag was specified. .El .Sh SEE ALSO .Xr chflags 2 , diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2 index e43d012770df..e24c823d039a 100644 --- a/lib/libc/sys/open.2 +++ b/lib/libc/sys/open.2 @@ -28,7 +28,7 @@ .\" @(#)open.2 8.2 (Berkeley) 11/16/93 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt OPEN 2 .Os .Sh NAME @@ -75,9 +75,7 @@ function is equivalent to the .Fn open function except in the case where the .Fa path -specifies a relative path, or the -.Dv O_BENEATH -flag is provided. +specifies a relative path. For .Fn openat and relative @@ -104,28 +102,10 @@ and the behavior is identical to a call to When .Fn openat is called with an absolute -.Fa path -without the -.Dv O_BENEATH -flag, it ignores the -.Fa fd -argument. -When -.Dv O_BENEATH -is specified with an absolute .Fa path , -a directory passed by the -.Fa fd -argument is used as the topping point for the resolution. -When -.Dv O_BENEATH -is specified with a relative path, the +it ignores the .Fa fd -argument is used both as the starting point, and as the topping point -for the resolution. -See the definition of the -.Dv O_BENEATH -flag below. +argument. .Pp In .Xr capsicum 4 @@ -137,9 +117,7 @@ The argument to .Fn openat must be strictly relative to a file descriptor -.Fa fd , -as defined in -.Pa sys/kern/vfs_lookup.c . +.Fa fd . .Fa path must not be an absolute path and must not contain ".." components which cause the path resolution to escape the directory hierarchy @@ -156,9 +134,8 @@ If the .Dv vfs.lookup_cap_dotdot .Xr sysctl 3 MIB is set to zero, ".." components in the paths, -used in capability mode, or with the -.Dv O_BENEATH -flag, are completely disabled. +used in capability mode, +are completely disabled. If the .Dv vfs.lookup_cap_dotdot_nonlocal MIB is set to zero, ".." is not allowed if found on non-local filesystem. @@ -190,8 +167,7 @@ O_TTY_INIT ignored O_DIRECTORY error if file is not a directory O_CLOEXEC set FD_CLOEXEC upon open O_VERIFY verify the contents of the file -O_BENEATH require resolved path to be strictly relative to topping directory -O_RESOLVE_BENEATH require walked path to be strictly relative to topping directory +O_RESOLVE_BENEATH path resolution must not cross the fd directory .Ed .Pp Opening a file with @@ -319,32 +295,12 @@ means is implementation specific. The run-time linker (rtld) uses this flag to ensure shared objects have been verified before operating on them. .Pp -.Dv O_BENEATH -returns -.Er ENOTCAPABLE -if the specified path, after resolving all symlinks and ".." -references, does not end up with tail residing in the directory hierarchy of -children beneath the topping directory. -Topping directory is the process current directory if relative -.Fa path -is used for -.Fn open , -and the directory referenced by the -.Fa fd -argument when using -.Fn openat . -.Dv O_BENEATH -allows arbitrary prefix that ends up at the topping directory, -after which all further resolved components must be under it. -.Pp .Dv O_RESOLVE_BENEATH returns .Er ENOTCAPABLE if any intermediate component of the specified relative path does not -reside in the directory hierarchy beneath the topping directory. -Comparing to -.Dv O_BENEATH , -absolute paths or even the temporal escape from beneath of the topping +reside in the directory hierarchy beneath the starting directory. +Absolute paths or even the temporal escape from beneath of the starting directory is not allowed. .Pp When @@ -601,19 +557,12 @@ directory outside of the directory hierarchy specified by and the process is in capability mode. .It Bq Er ENOTCAPABLE The -.Dv O_BENEATH -flag was provided, and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. -.It Bq Er ENOTCAPABLE -The .Dv O_RESOLVE_BENEATH flag was provided, and the relative .Fa path -escapes topping directory. +escapes the +.Ar fd +directory. .El .Sh SEE ALSO .Xr chmod 2 , diff --git a/lib/libc/sys/stat.2 b/lib/libc/sys/stat.2 index 4759d297e8da..0ed70620af63 100644 --- a/lib/libc/sys/stat.2 +++ b/lib/libc/sys/stat.2 @@ -28,7 +28,7 @@ .\" @(#)stat.2 8.4 (Berkeley) 5/1/95 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt STAT 2 .Os .Sh NAME @@ -84,9 +84,7 @@ and .Fn lstat except when the .Fa path -specifies a relative path, or the -.Dv AT_BENEATH -flag is provided. +specifies a relative path. For .Fn fstatat and relative @@ -95,13 +93,6 @@ the status is retrieved from a file relative to the directory associated with the file descriptor .Fa fd instead of the current working directory. -For -.Dv AT_BENEATH -and absolute -.Fa path , -the status is retrieved from a file specified by the -.Fa path , -but additional permission checks are performed, see below. .Pp The values for the .Fa flag @@ -113,15 +104,8 @@ defined in If .Fa path names a symbolic link, the status of the symbolic link is returned. -.It Dv AT_BENEATH -Only stat files and directories below the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the starting directory. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -148,19 +132,10 @@ bit is set in When .Fn fstatat is called with an absolute -.Fa path -without the -.Dv AT_BENEATH -flag, it ignores the -.Fa fd -argument. -When -.Dv AT_BENEATH -is specified with an absolute .Fa path , -a directory passed by the +it ignores the .Fa fd -argument is used as the topping point for the resolution. +argument. .Pp The .Fa sb @@ -459,18 +434,9 @@ is an absolute path, or contained a ".." component leading to a directory outside of the directory hierarchy specified by .Fa fd , -and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fn fstatat , -and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. +and the process is in capability mode or the +.Dv AT_RESOLVE_BENEATH +flag was specified. .El .Sh SEE ALSO .Xr access 2 , diff --git a/lib/libc/sys/unlink.2 b/lib/libc/sys/unlink.2 index 838d4da68af2..11fff875abad 100644 --- a/lib/libc/sys/unlink.2 +++ b/lib/libc/sys/unlink.2 @@ -28,7 +28,7 @@ .\" @(#)unlink.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt UNLINK 2 .Os .Sh NAME @@ -92,16 +92,10 @@ Remove the directory entry specified by and .Fa path as a directory, not a normal file. -.It Dv AT_BENEATH -Only unlink files and directories which are beneath of the topping -directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -246,18 +240,9 @@ is an absolute path, or contained a ".." component leading to a directory outside of the directory hierarchy specified by .Fa fd , -and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fn unlinkat , -and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. +and the process is in capability mode or the +.Dv AT_RESOLVE_BENEATH +flag was specified. .El .Pp In addition to the errors returned by diff --git a/lib/libc/sys/utimensat.2 b/lib/libc/sys/utimensat.2 index 3016d1af72aa..d31ee1f1515a 100644 --- a/lib/libc/sys/utimensat.2 +++ b/lib/libc/sys/utimensat.2 @@ -31,7 +31,7 @@ .\" @(#)utimes.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt UTIMENSAT 2 .Os .Sh NAME @@ -146,16 +146,10 @@ names a symbolic link, the symbolic link's times are changed. By default, .Fn utimensat changes the times of the file referenced by the symbolic link. -.It Dv AT_BENEATH -Only allow to change the times of a file which is beneath of -the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -290,18 +284,9 @@ is an absolute path, or contained a ".." component leading to a directory outside of the directory hierarchy specified by .Fa fd , -and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fn utimensat , -and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. +and the process is in capability mode or the +.Dv AT_RESOLVE_BENEATH +flag was specified. .El .Sh SEE ALSO .Xr chflags 2 , diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index ad65ab11bb1d..4ddd7b63ce5c 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -182,13 +182,6 @@ nameicap_tracker_add(struct nameidata *ndp, struct vnode *dp) if ((ndp->ni_lcf & NI_LCF_CAP_DOTDOT) == 0 || dp->v_type != VDIR) return; cnp = &ndp->ni_cnd; - if ((cnp->cn_flags & BENEATH) != 0 && - (ndp->ni_lcf & NI_LCF_BENEATH_LATCHED) == 0) { - MPASS((ndp->ni_lcf & NI_LCF_LATCH) != 0); - if (dp != ndp->ni_beneath_latch) - return; - ndp->ni_lcf |= NI_LCF_BENEATH_LATCHED; - } nt = malloc(sizeof(*nt), M_NAMEITRACKER, M_WAITOK); vhold(dp); nt->dp = dp; @@ -196,7 +189,7 @@ nameicap_tracker_add(struct nameidata *ndp, struct vnode *dp) } static void -nameicap_cleanup(struct nameidata *ndp, bool clean_latch) +nameicap_cleanup(struct nameidata *ndp) { struct nameicap_tracker *nt, *nt1; @@ -207,10 +200,6 @@ nameicap_cleanup(struct nameidata *ndp, bool clean_latch) vdrop(nt->dp); free(nt, M_NAMEITRACKER); } - if (clean_latch && (ndp->ni_lcf & NI_LCF_LATCH) != 0) { - ndp->ni_lcf &= ~NI_LCF_LATCH; - vrele(ndp->ni_beneath_latch); - } } /* @@ -230,21 +219,17 @@ nameicap_check_dotdot(struct nameidata *ndp, struct vnode *dp) struct nameicap_tracker *nt; struct mount *mp; - if ((ndp->ni_lcf & NI_LCF_CAP_DOTDOT) == 0 || dp == NULL || - dp->v_type != VDIR) + if (dp == NULL || dp->v_type != VDIR || (ndp->ni_lcf & + NI_LCF_STRICTRELATIVE) == 0) return (0); + if ((ndp->ni_lcf & NI_LCF_CAP_DOTDOT) == 0) + return (ENOTCAPABLE); mp = dp->v_mount; if (lookup_cap_dotdot_nonlocal == 0 && mp != NULL && (mp->mnt_flag & MNT_LOCAL) == 0) return (ENOTCAPABLE); TAILQ_FOREACH_REVERSE(nt, &ndp->ni_cap_tracker, nameicap_tracker_head, nm_link) { - if ((ndp->ni_lcf & NI_LCF_LATCH) != 0 && - ndp->ni_beneath_latch == nt->dp) { - ndp->ni_lcf &= ~NI_LCF_BENEATH_LATCHED; - nameicap_cleanup(ndp, false); - return (0); - } if (dp == nt->dp) return (0); } @@ -275,11 +260,6 @@ namei_handle_root(struct nameidata *ndp, struct vnode **dpp) #endif return (ENOTCAPABLE); } - if ((cnp->cn_flags & BENEATH) != 0) { - ndp->ni_lcf |= NI_LCF_BENEATH_ABS; - ndp->ni_lcf &= ~NI_LCF_BENEATH_LATCHED; - nameicap_cleanup(ndp, false); - } while (*(cnp->cn_nameptr) == '/') { cnp->cn_nameptr++; ndp->ni_pathlen--; @@ -297,7 +277,6 @@ namei_setup(struct nameidata *ndp, struct vnode **dpp, struct pwd **pwdp) struct thread *td; struct pwd *pwd; cap_rights_t rights; - struct filecaps dirfd_caps; int error; bool startdir_used; @@ -410,26 +389,8 @@ namei_setup(struct nameidata *ndp, struct vnode **dpp, struct pwd **pwdp) if (error == 0 && (*dpp)->v_type != VDIR) error = ENOTDIR; } - if (error == 0 && (cnp->cn_flags & BENEATH) != 0) { - if (ndp->ni_dirfd == AT_FDCWD) { - ndp->ni_beneath_latch = pwd->pwd_cdir; - vrefact(ndp->ni_beneath_latch); - } else { - rights = *ndp->ni_rightsneeded; - cap_rights_set_one(&rights, CAP_LOOKUP); - error = fgetvp_rights(td, ndp->ni_dirfd, &rights, - &dirfd_caps, &ndp->ni_beneath_latch); - if (error == 0 && (*dpp)->v_type != VDIR) { - vrele(ndp->ni_beneath_latch); - error = ENOTDIR; - } - } - if (error == 0) - ndp->ni_lcf |= NI_LCF_LATCH; - } if (error == 0 && (cnp->cn_flags & RBENEATH) != 0) { - if (cnp->cn_pnbuf[0] == '/' || - (ndp->ni_lcf & NI_LCF_BENEATH_ABS) != 0) { + if (cnp->cn_pnbuf[0] == '/') { error = EINVAL; } else if ((ndp->ni_lcf & NI_LCF_STRICTRELATIVE) == 0) { ndp->ni_lcf |= NI_LCF_STRICTRELATIVE | @@ -452,12 +413,8 @@ namei_setup(struct nameidata *ndp, struct vnode **dpp, struct pwd **pwdp) pwd_drop(pwd); return (error); } - MPASS((ndp->ni_lcf & (NI_LCF_BENEATH_ABS | NI_LCF_LATCH)) != - NI_LCF_BENEATH_ABS); - if (((ndp->ni_lcf & NI_LCF_STRICTRELATIVE) != 0 && - lookup_cap_dotdot != 0) || - ((ndp->ni_lcf & NI_LCF_STRICTRELATIVE) == 0 && - (cnp->cn_flags & BENEATH) != 0)) + if ((ndp->ni_lcf & NI_LCF_STRICTRELATIVE) != 0 && + lookup_cap_dotdot != 0) ndp->ni_lcf |= NI_LCF_CAP_DOTDOT; SDT_PROBE4(vfs, namei, lookup, entry, *dpp, cnp->cn_pnbuf, cnp->cn_flags, false); @@ -636,16 +593,8 @@ namei(struct nameidata *ndp) for (;;) { ndp->ni_startdir = dp; error = lookup(ndp); - if (error != 0) { - /* - * Override an error to not allow user to use - * BENEATH as an oracle. - */ - if ((ndp->ni_lcf & (NI_LCF_LATCH | - NI_LCF_BENEATH_LATCHED)) == NI_LCF_LATCH) - error = ENOTCAPABLE; + if (error != 0) goto out; - } /* * If not a symbolic link, we're done. @@ -657,12 +606,7 @@ namei(struct nameidata *ndp) namei_cleanup_cnp(cnp); } else cnp->cn_flags |= HASBUF; - if ((ndp->ni_lcf & (NI_LCF_LATCH | - NI_LCF_BENEATH_LATCHED)) == NI_LCF_LATCH) { - NDFREE(ndp, 0); - error = ENOTCAPABLE; - } - nameicap_cleanup(ndp, true); + nameicap_cleanup(ndp); pwd_drop(pwd); if (error == 0) NDVALIDATE(ndp); @@ -739,7 +683,7 @@ out: MPASS(error != 0); SDT_PROBE4(vfs, namei, lookup, return, error, NULL, false, ndp); namei_cleanup_cnp(cnp); - nameicap_cleanup(ndp, true); + nameicap_cleanup(ndp); pwd_drop(pwd); return (error); } diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index a51d693446e3..52604d3da829 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -120,8 +120,6 @@ at2cnpflags(u_int at_flags, u_int mask) res = 0; at_flags &= mask; - if ((at_flags & AT_BENEATH) != 0) - res |= BENEATH; if ((at_flags & AT_RESOLVE_BENEATH) != 0) res |= RBENEATH; if ((at_flags & AT_SYMLINK_FOLLOW) != 0) @@ -1500,12 +1498,11 @@ sys_linkat(struct thread *td, struct linkat_args *uap) int flag; flag = uap->flag; - if ((flag & ~(AT_SYMLINK_FOLLOW | AT_BENEATH | - AT_RESOLVE_BENEATH)) != 0) + if ((flag & ~(AT_SYMLINK_FOLLOW | AT_RESOLVE_BENEATH)) != 0) return (EINVAL); return (kern_linkat(td, uap->fd1, uap->fd2, uap->path1, uap->path2, - UIO_USERSPACE, at2cnpflags(flag, AT_SYMLINK_FOLLOW | AT_BENEATH | + UIO_USERSPACE, at2cnpflags(flag, AT_SYMLINK_FOLLOW | AT_RESOLVE_BENEATH))); } @@ -1875,7 +1872,7 @@ kern_funlinkat(struct thread *td, int dfd, const char *path, int fd, restart: bwillwrite(); NDINIT_ATRIGHTS(&nd, DELETE, LOCKPARENT | LOCKLEAF | AUDITVNODE1 | - at2cnpflags(flag, AT_BENEATH | AT_RESOLVE_BENEATH), + at2cnpflags(flag, AT_RESOLVE_BENEATH), pathseg, path, dfd, &cap_unlinkat_rights, td); if ((error = namei(&nd)) != 0) { if (error == EINVAL) @@ -2080,7 +2077,7 @@ kern_accessat(struct thread *td, int fd, const char *path, struct nameidata nd; int error; - if ((flag & ~(AT_EACCESS | AT_BENEATH | AT_RESOLVE_BENEATH)) != 0) + if ((flag & ~(AT_EACCESS | AT_RESOLVE_BENEATH)) != 0) return (EINVAL); if (amode != F_OK && (amode & ~(R_OK | W_OK | X_OK)) != 0) return (EINVAL); @@ -2101,7 +2098,7 @@ kern_accessat(struct thread *td, int fd, const char *path, usecred = cred; AUDIT_ARG_VALUE(amode); NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | - AUDITVNODE1 | at2cnpflags(flag, AT_BENEATH | AT_RESOLVE_BENEATH), + AUDITVNODE1 | at2cnpflags(flag, AT_RESOLVE_BENEATH), pathseg, path, fd, &cap_fstat_rights, td); if ((error = namei(&nd)) != 0) goto out; @@ -2392,13 +2389,12 @@ kern_statat(struct thread *td, int flag, int fd, const char *path, struct nameidata nd; int error; - if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_BENEATH | - AT_RESOLVE_BENEATH)) != 0) + if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_RESOLVE_BENEATH)) != 0) return (EINVAL); - NDINIT_ATRIGHTS(&nd, LOOKUP, at2cnpflags(flag, AT_BENEATH | - AT_RESOLVE_BENEATH | AT_SYMLINK_NOFOLLOW) | LOCKSHARED | LOCKLEAF | - AUDITVNODE1, pathseg, path, fd, &cap_fstat_rights, td); + NDINIT_ATRIGHTS(&nd, LOOKUP, at2cnpflags(flag, AT_RESOLVE_BENEATH | + AT_SYMLINK_NOFOLLOW) | LOCKSHARED | LOCKLEAF | AUDITVNODE1, + pathseg, path, fd, &cap_fstat_rights, td); if ((error = namei(&nd)) != 0) return (error); @@ -2716,8 +2712,7 @@ int sys_chflagsat(struct thread *td, struct chflagsat_args *uap) { - if ((uap->atflag & ~(AT_SYMLINK_NOFOLLOW | AT_BENEATH | - AT_RESOLVE_BENEATH)) != 0) + if ((uap->atflag & ~(AT_SYMLINK_NOFOLLOW | AT_RESOLVE_BENEATH)) != 0) return (EINVAL); return (kern_chflagsat(td, uap->fd, uap->path, UIO_USERSPACE, @@ -2750,7 +2745,7 @@ kern_chflagsat(struct thread *td, int fd, const char *path, *** 167 LINES SKIPPED *** From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 19:25: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 462A3556707; Thu, 4 Mar 2021 19:25: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 4Ds1675c0Hz4kd7; Thu, 4 Mar 2021 19:25: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 0DC1822AB9; Thu, 4 Mar 2021 19:25: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 124JP1RB087998; Thu, 4 Mar 2021 19:25:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124JP18S087997; Thu, 4 Mar 2021 19:25:01 GMT (envelope-from git) Date: Thu, 4 Mar 2021 19:25:01 GMT Message-Id: <202103041925.124JP18S087997@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: 11c6aa5c504d - stable/13 - nameicap_tracker_add: avoid duplicates in the tracker list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 11c6aa5c504d76e50dcd9481020c0f350ce0bb00 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 Mar 2021 19:25:06 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=11c6aa5c504d76e50dcd9481020c0f350ce0bb00 commit 11c6aa5c504d76e50dcd9481020c0f350ce0bb00 Author: Konstantin Belousov AuthorDate: 2021-02-28 00:13:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-04 19:11:00 +0000 nameicap_tracker_add: avoid duplicates in the tracker list (cherry picked from commit 2388ad7c293fbc89ee239a1adcb87fd158c4e8e9) --- sys/kern/vfs_lookup.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 73290e8da05f..cdd4a914239f 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -182,6 +182,9 @@ nameicap_tracker_add(struct nameidata *ndp, struct vnode *dp) if ((ndp->ni_lcf & NI_LCF_CAP_DOTDOT) == 0 || dp->v_type != VDIR) return; cnp = &ndp->ni_cnd; + nt = TAILQ_LAST(&ndp->ni_cap_tracker, nameicap_tracker_head); + if (nt != NULL && nt->dp == dp) + return; nt = malloc(sizeof(*nt), M_NAMEITRACKER, M_WAITOK); vhold(dp); nt->dp = dp; From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 19:25: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 5BA17556077; Thu, 4 Mar 2021 19:25: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 4Ds16611Tvz4ks5; Thu, 4 Mar 2021 19:25: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 D7EAD22A61; Thu, 4 Mar 2021 19:25: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 124JP0ZM087976; Thu, 4 Mar 2021 19:25:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124JP0R0087975; Thu, 4 Mar 2021 19:25:00 GMT (envelope-from git) Date: Thu, 4 Mar 2021 19:25:00 GMT Message-Id: <202103041925.124JP0R0087975@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: 7a1e21f194e4 - stable/13 - Do not call nameicap_tracker_add() for dotdot case. 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: 7a1e21f194e44d57f4d89012b5d7dd61668d7da8 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 Mar 2021 19:25:06 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7a1e21f194e44d57f4d89012b5d7dd61668d7da8 commit 7a1e21f194e44d57f4d89012b5d7dd61668d7da8 Author: Konstantin Belousov AuthorDate: 2021-02-28 00:12:43 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-04 19:10:55 +0000 Do not call nameicap_tracker_add() for dotdot case. (cherry picked from commit 59e749428111c029116a4302a544c7cc18b33772) --- sys/kern/vfs_lookup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 4ddd7b63ce5c..73290e8da05f 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -1258,7 +1258,8 @@ success: } } if (ndp->ni_vp != NULL) { - nameicap_tracker_add(ndp, ndp->ni_vp); + if ((cnp->cn_flags & ISDOTDOT) == 0) + nameicap_tracker_add(ndp, ndp->ni_vp); if ((cnp->cn_flags & (FAILIFEXISTS | ISSYMLINK)) == FAILIFEXISTS) goto bad_eexist; } From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 19:25: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 1919255670B; Thu, 4 Mar 2021 19:25: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 4Ds1692TMPz4kdC; Thu, 4 Mar 2021 19:25: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 3112D22A62; Thu, 4 Mar 2021 19:25: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 124JP2JR088020; Thu, 4 Mar 2021 19:25:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124JP2X7088019; Thu, 4 Mar 2021 19:25:02 GMT (envelope-from git) Date: Thu, 4 Mar 2021 19:25:02 GMT Message-Id: <202103041925.124JP2X7088019@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: 68230041eb29 - stable/13 - Add nameicap_cleanup_from(), to clean tracker list starting from some element 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: 68230041eb292f26132c73de9369e695ab6ada6e 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 Mar 2021 19:25:08 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=68230041eb292f26132c73de9369e695ab6ada6e commit 68230041eb292f26132c73de9369e695ab6ada6e Author: Konstantin Belousov AuthorDate: 2021-02-28 00:14:43 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-04 19:11:05 +0000 Add nameicap_cleanup_from(), to clean tracker list starting from some element (cherry picked from commit e8a2862aa0384c75603f801625e309a3dae0ed05) --- sys/kern/vfs_lookup.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index cdd4a914239f..abc01c73e24c 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -192,19 +192,26 @@ nameicap_tracker_add(struct nameidata *ndp, struct vnode *dp) } static void -nameicap_cleanup(struct nameidata *ndp) +nameicap_cleanup_from(struct nameidata *ndp, struct nameicap_tracker *first) { struct nameicap_tracker *nt, *nt1; - KASSERT(TAILQ_EMPTY(&ndp->ni_cap_tracker) || - (ndp->ni_lcf & NI_LCF_CAP_DOTDOT) != 0, ("not strictrelative")); - TAILQ_FOREACH_SAFE(nt, &ndp->ni_cap_tracker, nm_link, nt1) { + nt = first; + TAILQ_FOREACH_FROM_SAFE(nt, &ndp->ni_cap_tracker, nm_link, nt1) { TAILQ_REMOVE(&ndp->ni_cap_tracker, nt, nm_link); vdrop(nt->dp); free(nt, M_NAMEITRACKER); } } +static void +nameicap_cleanup(struct nameidata *ndp) +{ + KASSERT(TAILQ_EMPTY(&ndp->ni_cap_tracker) || + (ndp->ni_lcf & NI_LCF_CAP_DOTDOT) != 0, ("not strictrelative")); + nameicap_cleanup_from(ndp, NULL); +} + /* * For dotdot lookups in capability mode, only allow the component * lookup to succeed if the resulting directory was already traversed From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 19:25: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 3F717556718; Thu, 4 Mar 2021 19:25:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ds16C21t5z4kqb; Thu, 4 Mar 2021 19:25: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 3996722C29; Thu, 4 Mar 2021 19:25: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 124JP4S8088038; Thu, 4 Mar 2021 19:25:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124JP4kP088037; Thu, 4 Mar 2021 19:25:04 GMT (envelope-from git) Date: Thu, 4 Mar 2021 19:25:04 GMT Message-Id: <202103041925.124JP4kP088037@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: af188c01b303 - stable/13 - nameicap_check_dotdot: trim tracker on check 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: af188c01b303f0f13cd3835d5c6a2fa8aecdb9bb 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 Mar 2021 19:25:08 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=af188c01b303f0f13cd3835d5c6a2fa8aecdb9bb commit af188c01b303f0f13cd3835d5c6a2fa8aecdb9bb Author: Konstantin Belousov AuthorDate: 2021-02-28 00:15:21 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-04 19:11:09 +0000 nameicap_check_dotdot: trim tracker on check (cherry picked from commit 49c98a4bf3a87ace0df99056fa683805c1645e61) --- sys/kern/vfs_lookup.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index abc01c73e24c..b4280f85c5b6 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -240,8 +240,12 @@ nameicap_check_dotdot(struct nameidata *ndp, struct vnode *dp) return (ENOTCAPABLE); TAILQ_FOREACH_REVERSE(nt, &ndp->ni_cap_tracker, nameicap_tracker_head, nm_link) { - if (dp == nt->dp) + if (dp == nt->dp) { + nt = TAILQ_NEXT(nt, nm_link); + if (nt != NULL) + nameicap_cleanup_from(ndp, nt); return (0); + } } return (ENOTCAPABLE); } From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 19:25: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 22A49556780; Thu, 4 Mar 2021 19:25: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 4Ds16D229Bz4kxm; Thu, 4 Mar 2021 19:25: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 4DF6A22E01; Thu, 4 Mar 2021 19:25: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 124JP5Os088060; Thu, 4 Mar 2021 19:25:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124JP5Ws088059; Thu, 4 Mar 2021 19:25:05 GMT (envelope-from git) Date: Thu, 4 Mar 2021 19:25:05 GMT Message-Id: <202103041925.124JP5Ws088059@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: e8b0f76b6130 - stable/13 - O_RELATIVE_BENEATH: return ENOTCAPABLE instead of EINVAL for abs path 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: e8b0f76b613033298b07570391b5885346f358d7 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 Mar 2021 19:25:10 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e8b0f76b613033298b07570391b5885346f358d7 commit e8b0f76b613033298b07570391b5885346f358d7 Author: Konstantin Belousov AuthorDate: 2021-02-28 23:59:12 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-04 19:11:15 +0000 O_RELATIVE_BENEATH: return ENOTCAPABLE instead of EINVAL for abs path (cherry picked from commit 28cd3a673e0e32b009fd573764956b280d1affe1) --- sys/kern/vfs_lookup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index b4280f85c5b6..e881e8f909a4 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -405,7 +405,7 @@ namei_setup(struct nameidata *ndp, struct vnode **dpp, struct pwd **pwdp) } if (error == 0 && (cnp->cn_flags & RBENEATH) != 0) { if (cnp->cn_pnbuf[0] == '/') { - error = EINVAL; + error = ENOTCAPABLE; } else if ((ndp->ni_lcf & NI_LCF_STRICTRELATIVE) == 0) { ndp->ni_lcf |= NI_LCF_STRICTRELATIVE | NI_LCF_CAP_DOTDOT; From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 20:08: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 95D7D557F51; Thu, 4 Mar 2021 20:08: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 4Ds24W3rplz4qK3; Thu, 4 Mar 2021 20:08: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 772872380E; Thu, 4 Mar 2021 20:08: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 124K8h1m041928; Thu, 4 Mar 2021 20:08:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124K8hxu041927; Thu, 4 Mar 2021 20:08:43 GMT (envelope-from git) Date: Thu, 4 Mar 2021 20:08:43 GMT Message-Id: <202103042008.124K8hxu041927@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: 3bde9c57df17 - releng/13.0 - FFS extattr: fix handling of the tail 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 3bde9c57df178c5cbe79f0f3f96c86557211fa69 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 Mar 2021 20:08:43 -0000 The branch releng/13.0 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3bde9c57df178c5cbe79f0f3f96c86557211fa69 commit 3bde9c57df178c5cbe79f0f3f96c86557211fa69 Author: Konstantin Belousov AuthorDate: 2021-03-01 15:24:11 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-04 20:07:33 +0000 FFS extattr: fix handling of the tail Approved by: re (gjb) (cherry picked from commit 8742817ba62ec604156c139727155d36f5fbad06) --- sys/ufs/ffs/ffs_vnops.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index af03b369a280..582ccccc2e12 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1346,13 +1346,20 @@ ffs_rdextattr(u_char **p, struct vnode *vp, struct thread *td) /* Validate disk xattrfile contents. */ for (eap = (void *)eae, eaend = (void *)(eae + easize); eap < eaend; eap = eapnext) { + /* Detect zeroed out tail */ + if (eap->ea_length < sizeof(*eap) || eap->ea_length == 0) { + easize = (const u_char *)eap - eae; + break; + } + eapnext = EXTATTR_NEXT(eap); - /* Bogusly short entry or bogusly long entry. */ - if (eap->ea_length < sizeof(*eap) || eapnext > eaend) { + /* Bogusly long entry. */ + if (eapnext > eaend) { free(eae, M_TEMP); return (EINTEGRITY); } } + ip->i_ea_len = easize; *p = eae; return (0); } @@ -1407,7 +1414,6 @@ ffs_open_ea(struct vnode *vp, struct ucred *cred, struct thread *td) ffs_unlock_ea(vp); return (error); } - ip->i_ea_len = dp->di_extsize; ip->i_ea_error = 0; ip->i_ea_refs++; ffs_unlock_ea(vp); @@ -1426,6 +1432,7 @@ ffs_close_ea(struct vnode *vp, int commit, struct ucred *cred, struct thread *td struct ufs2_dinode *dp; size_t ea_len, tlen; int error, i, lcnt; + bool truncate; ip = VTOI(vp); @@ -1436,6 +1443,7 @@ ffs_close_ea(struct vnode *vp, int commit, struct ucred *cred, struct thread *td } dp = ip->i_din2; error = ip->i_ea_error; + truncate = false; if (commit && error == 0) { ASSERT_VOP_ELOCKED(vp, "ffs_close_ea commit"); if (cred == NOCRED) @@ -1452,12 +1460,12 @@ ffs_close_ea(struct vnode *vp, int commit, struct ucred *cred, struct thread *td liovec[0].iov_base = ip->i_ea_area; liovec[0].iov_len = ip->i_ea_len; - for (i = 1, tlen = ea_len; i < lcnt; i++) { + for (i = 1, tlen = ea_len - ip->i_ea_len; i < lcnt; i++) { liovec[i].iov_base = __DECONST(void *, zero_region); liovec[i].iov_len = MIN(ZERO_REGION_SIZE, tlen); tlen -= liovec[i].iov_len; } - MPASS(tlen == ip->i_ea_len); + MPASS(tlen == 0); luio.uio_iov = liovec; luio.uio_offset = 0; @@ -1466,6 +1474,8 @@ ffs_close_ea(struct vnode *vp, int commit, struct ucred *cred, struct thread *td luio.uio_rw = UIO_WRITE; luio.uio_td = td; error = ffs_extwrite(vp, &luio, IO_EXT | IO_SYNC, cred); + if (error == 0 && ip->i_ea_len == 0) + truncate = true; } if (--ip->i_ea_refs == 0) { free(ip->i_ea_area, M_TEMP); @@ -1475,7 +1485,7 @@ ffs_close_ea(struct vnode *vp, int commit, struct ucred *cred, struct thread *td } ffs_unlock_ea(vp); - if (commit && error == 0 && ip->i_ea_len == 0) + if (truncate) ffs_truncate(vp, 0, IO_EXT, cred); return (error); } From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 20:08: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 9BDAE5582AE; Thu, 4 Mar 2021 20:08: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 4Ds24X44RVz4qGB; Thu, 4 Mar 2021 20:08: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 7EE0923792; Thu, 4 Mar 2021 20:08: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 124K8itq041951; Thu, 4 Mar 2021 20:08:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124K8iq8041950; Thu, 4 Mar 2021 20:08:44 GMT (envelope-from git) Date: Thu, 4 Mar 2021 20:08:44 GMT Message-Id: <202103042008.124K8iq8041950@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: 9f1e0822cdf4 - releng/13.0 - fhlink(2): the syscalls do not take flag 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 9f1e0822cdf4b2d2ab14cbe42ddc71a6603a9644 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 Mar 2021 20:08:44 -0000 The branch releng/13.0 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9f1e0822cdf4b2d2ab14cbe42ddc71a6603a9644 commit 9f1e0822cdf4b2d2ab14cbe42ddc71a6603a9644 Author: Konstantin Belousov AuthorDate: 2021-02-28 00:38:11 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-04 20:07:42 +0000 fhlink(2): the syscalls do not take flag Approved by: re (gjb) (cherry picked from commit 600756afb532a86a39fb488f5c4fc7e248921655) --- lib/libc/sys/fhlink.2 | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/lib/libc/sys/fhlink.2 b/lib/libc/sys/fhlink.2 index da35d2b103e6..029ec8d7c2eb 100644 --- a/lib/libc/sys/fhlink.2 +++ b/lib/libc/sys/fhlink.2 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt FHLINK 2 .Os .Sh NAME @@ -95,33 +95,6 @@ the directory associated with the file descriptor .Fa tofd instead of the current working directory. .Pp -Values for -.Fa flag -are constructed by a bitwise-inclusive OR of flags from the following -list, defined in -.In fcntl.h : -.Bl -tag -width indent -.It Dv AT_SYMLINK_FOLLOW -If -.Fa fhp -names a symbolic link, a new link for the target of the symbolic link is -created. -.It Dv AT_BENEATH -Only allow to link to a file which is beneath of the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. -.It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. -See the description of the -.Dv O_RESOLVE_BENEATH -flag in the -.Xr open 2 -manual page. -.El -.Pp If .Fn fhlinkat is passed the special value From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 20: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 C702F558074; Thu, 4 Mar 2021 20: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 4Ds24Y4x0fz4qGF; Thu, 4 Mar 2021 20: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 9BDB8235C9; Thu, 4 Mar 2021 20: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 124K8jFs041973; Thu, 4 Mar 2021 20: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 124K8jbc041970; Thu, 4 Mar 2021 20:08:45 GMT (envelope-from git) Date: Thu, 4 Mar 2021 20:08:45 GMT Message-Id: <202103042008.124K8jbc041970@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: 22c1852a04b0 - releng/13.0 - open(2): Remove O_BENEATH and AT_BENEATH 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 22c1852a04b0fec9d91a74cb13de8f2827800029 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 Mar 2021 20:08:45 -0000 The branch releng/13.0 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=22c1852a04b0fec9d91a74cb13de8f2827800029 commit 22c1852a04b0fec9d91a74cb13de8f2827800029 Author: Konstantin Belousov AuthorDate: 2021-02-16 03:31:40 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-04 20:07:46 +0000 open(2): Remove O_BENEATH and AT_BENEATH Approved by: re (gjb) (cherry picked from commit 20e91ca36a56b8db1e6677f577ad011b66dd6eb3) --- lib/libc/sys/access.2 | 24 +++------------ lib/libc/sys/chflags.2 | 29 +++++------------- lib/libc/sys/chmod.2 | 29 +++++------------- lib/libc/sys/chown.2 | 29 +++++------------- lib/libc/sys/getfh.2 | 37 +++++------------------ lib/libc/sys/link.2 | 28 +++++------------ lib/libc/sys/open.2 | 77 ++++++++--------------------------------------- lib/libc/sys/stat.2 | 50 +++++-------------------------- lib/libc/sys/unlink.2 | 29 +++++------------- lib/libc/sys/utimensat.2 | 29 +++++------------- sys/kern/vfs_lookup.c | 78 +++++++----------------------------------------- sys/kern/vfs_syscalls.c | 51 +++++++++++++------------------ sys/kern/vfs_vnops.c | 2 -- sys/sys/fcntl.h | 14 ++++----- sys/sys/namei.h | 5 ---- 15 files changed, 112 insertions(+), 399 deletions(-) diff --git a/lib/libc/sys/access.2 b/lib/libc/sys/access.2 index 1cd7eed1301b..13bfd7e5a88a 100644 --- a/lib/libc/sys/access.2 +++ b/lib/libc/sys/access.2 @@ -28,7 +28,7 @@ .\" @(#)access.2 8.2 (Berkeley) 4/1/94 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt ACCESS 2 .Os .Sh NAME @@ -120,15 +120,10 @@ list, defined in The checks for accessibility are performed using the effective user and group IDs instead of the real user and group ID as required in a call to .Fn access . -.It Dv AT_BENEATH -Only operate on files and directories below the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -218,17 +213,6 @@ or contained a ".." component leading to a directory outside of the directory hierarchy specified by .Fa fd , and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fn faccessat , -and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. .El .Sh SEE ALSO .Xr chmod 2 , diff --git a/lib/libc/sys/chflags.2 b/lib/libc/sys/chflags.2 index b6b0b43249c7..a44713904599 100644 --- a/lib/libc/sys/chflags.2 +++ b/lib/libc/sys/chflags.2 @@ -28,7 +28,7 @@ .\" @(#)chflags.2 8.3 (Berkeley) 5/2/95 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt CHFLAGS 2 .Os .Sh NAME @@ -94,16 +94,10 @@ defined in If .Fa path names a symbolic link, then the flags of the symbolic link are changed. -.It Dv AT_BENEATH -Only allow to change flags for a file which is beneath of -the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -327,18 +321,9 @@ is an absolute path, or contained a ".." component leading to a directory outside of the directory hierarchy specified by .Fa fd , -and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fn chflagsat , -and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. +and the process is in capability mode or the +.Dv AT_RESOLVE_BENEATH +flag was specified. .El .Sh SEE ALSO .Xr chflags 1 , diff --git a/lib/libc/sys/chmod.2 b/lib/libc/sys/chmod.2 index 1d66408e3891..0127a5b629e4 100644 --- a/lib/libc/sys/chmod.2 +++ b/lib/libc/sys/chmod.2 @@ -28,7 +28,7 @@ .\" @(#)chmod.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt CHMOD 2 .Os .Sh NAME @@ -101,16 +101,10 @@ in If .Fa path names a symbolic link, then the mode of the symbolic link is changed. -.It Dv AT_BENEATH -Only allow to change permissions of a file which is beneath of -the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -310,18 +304,9 @@ is an absolute path, or contained a ".." component leading to a directory outside of the directory hierarchy specified by .Fa fd , -and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fn fchmodat , -and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. +and the process is in capability mode or the +.Dv AT_RESOLVE_BENEATH +flag was specified. .El .Sh SEE ALSO .Xr chmod 1 , diff --git a/lib/libc/sys/chown.2 b/lib/libc/sys/chown.2 index 64bfdeaa961c..4c45ce9174bb 100644 --- a/lib/libc/sys/chown.2 +++ b/lib/libc/sys/chown.2 @@ -28,7 +28,7 @@ .\" @(#)chown.2 8.4 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt CHOWN 2 .Os .Sh NAME @@ -118,16 +118,10 @@ list, defined in If .Fa path names a symbolic link, ownership of the symbolic link is changed. -.It Dv AT_BENEATH -Only allow to change ownership of a file which is beneath of -the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -252,18 +246,9 @@ is an absolute path, or contained a ".." component leading to a directory outside of the directory hierarchy specified by .Fa fd , -and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fn fchownat , -and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. +and the process is in capability mode or the +.Dv AT_RESOLVE_BENEATH +flag was specified. .El .Sh SEE ALSO .Xr chgrp 1 , diff --git a/lib/libc/sys/getfh.2 b/lib/libc/sys/getfh.2 index 5dc5896af6d8..cd3d54f54d7f 100644 --- a/lib/libc/sys/getfh.2 +++ b/lib/libc/sys/getfh.2 @@ -29,7 +29,7 @@ .\" @(#)getfh.2 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt GETFH 2 .Os .Sh NAME @@ -76,9 +76,7 @@ and .Fn lgetfh except when the .Fa path -specifies a relative path, or the -.Dv AT_BENEATH -flag is provided. +specifies a relative path. For .Fn getfhat and relative @@ -87,13 +85,6 @@ the status is retrieved from a file relative to the directory associated with the file descriptor .Fa fd instead of the current working directory. -For -.Dv AT_BENEATH -and absolute -.Fa path , -the status is retrieved from a file specified by the -.Fa path , -but additional permission checks are performed, see below. .Pp The values for the .Fa flag @@ -105,15 +96,10 @@ defined in If .Fa path names a symbolic link, the status of the symbolic link is returned. -.It Dv AT_BENEATH -Only stat files and directories below the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -140,19 +126,10 @@ bit is set in When .Fn getfhat is called with an absolute -.Fa path -without the -.Dv AT_BENEATH -flag, it ignores the -.Fa fd -argument. -When -.Dv AT_BENEATH -is specified with an absolute .Fa path , -a directory passed by the +it ignores the .Fa fd -argument is used as the topping point for the resolution. +argument. These system calls are restricted to the superuser. .Sh RETURN VALUES .Rv -std diff --git a/lib/libc/sys/link.2 b/lib/libc/sys/link.2 index c3451da10884..de0efd5e510f 100644 --- a/lib/libc/sys/link.2 +++ b/lib/libc/sys/link.2 @@ -28,7 +28,7 @@ .\" @(#)link.2 8.3 (Berkeley) 1/12/94 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt LINK 2 .Os .Sh NAME @@ -115,15 +115,10 @@ If .Fa name1 names a symbolic link, a new link for the target of the symbolic link is created. -.It Dv AT_BENEATH -Only allow to link to a file which is beneath of the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -281,18 +276,9 @@ For example, is absolute or includes a ".." component that escapes the directory hierarchy specified by .Fa fd , -and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fa linkat -and the absolute path -.Fa name1 -does not have its tail fully contained under the topping directory, -or the relative path -.Fa name1 -escapes it. +and the process is in capability mode or the +.Dv AT_RESOLVE_BENEATH +flag was specified. .El .Sh SEE ALSO .Xr chflags 2 , diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2 index e43d012770df..e24c823d039a 100644 --- a/lib/libc/sys/open.2 +++ b/lib/libc/sys/open.2 @@ -28,7 +28,7 @@ .\" @(#)open.2 8.2 (Berkeley) 11/16/93 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt OPEN 2 .Os .Sh NAME @@ -75,9 +75,7 @@ function is equivalent to the .Fn open function except in the case where the .Fa path -specifies a relative path, or the -.Dv O_BENEATH -flag is provided. +specifies a relative path. For .Fn openat and relative @@ -104,28 +102,10 @@ and the behavior is identical to a call to When .Fn openat is called with an absolute -.Fa path -without the -.Dv O_BENEATH -flag, it ignores the -.Fa fd -argument. -When -.Dv O_BENEATH -is specified with an absolute .Fa path , -a directory passed by the -.Fa fd -argument is used as the topping point for the resolution. -When -.Dv O_BENEATH -is specified with a relative path, the +it ignores the .Fa fd -argument is used both as the starting point, and as the topping point -for the resolution. -See the definition of the -.Dv O_BENEATH -flag below. +argument. .Pp In .Xr capsicum 4 @@ -137,9 +117,7 @@ The argument to .Fn openat must be strictly relative to a file descriptor -.Fa fd , -as defined in -.Pa sys/kern/vfs_lookup.c . +.Fa fd . .Fa path must not be an absolute path and must not contain ".." components which cause the path resolution to escape the directory hierarchy @@ -156,9 +134,8 @@ If the .Dv vfs.lookup_cap_dotdot .Xr sysctl 3 MIB is set to zero, ".." components in the paths, -used in capability mode, or with the -.Dv O_BENEATH -flag, are completely disabled. +used in capability mode, +are completely disabled. If the .Dv vfs.lookup_cap_dotdot_nonlocal MIB is set to zero, ".." is not allowed if found on non-local filesystem. @@ -190,8 +167,7 @@ O_TTY_INIT ignored O_DIRECTORY error if file is not a directory O_CLOEXEC set FD_CLOEXEC upon open O_VERIFY verify the contents of the file -O_BENEATH require resolved path to be strictly relative to topping directory -O_RESOLVE_BENEATH require walked path to be strictly relative to topping directory +O_RESOLVE_BENEATH path resolution must not cross the fd directory .Ed .Pp Opening a file with @@ -319,32 +295,12 @@ means is implementation specific. The run-time linker (rtld) uses this flag to ensure shared objects have been verified before operating on them. .Pp -.Dv O_BENEATH -returns -.Er ENOTCAPABLE -if the specified path, after resolving all symlinks and ".." -references, does not end up with tail residing in the directory hierarchy of -children beneath the topping directory. -Topping directory is the process current directory if relative -.Fa path -is used for -.Fn open , -and the directory referenced by the -.Fa fd -argument when using -.Fn openat . -.Dv O_BENEATH -allows arbitrary prefix that ends up at the topping directory, -after which all further resolved components must be under it. -.Pp .Dv O_RESOLVE_BENEATH returns .Er ENOTCAPABLE if any intermediate component of the specified relative path does not -reside in the directory hierarchy beneath the topping directory. -Comparing to -.Dv O_BENEATH , -absolute paths or even the temporal escape from beneath of the topping +reside in the directory hierarchy beneath the starting directory. +Absolute paths or even the temporal escape from beneath of the starting directory is not allowed. .Pp When @@ -601,19 +557,12 @@ directory outside of the directory hierarchy specified by and the process is in capability mode. .It Bq Er ENOTCAPABLE The -.Dv O_BENEATH -flag was provided, and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. -.It Bq Er ENOTCAPABLE -The .Dv O_RESOLVE_BENEATH flag was provided, and the relative .Fa path -escapes topping directory. +escapes the +.Ar fd +directory. .El .Sh SEE ALSO .Xr chmod 2 , diff --git a/lib/libc/sys/stat.2 b/lib/libc/sys/stat.2 index 4759d297e8da..0ed70620af63 100644 --- a/lib/libc/sys/stat.2 +++ b/lib/libc/sys/stat.2 @@ -28,7 +28,7 @@ .\" @(#)stat.2 8.4 (Berkeley) 5/1/95 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt STAT 2 .Os .Sh NAME @@ -84,9 +84,7 @@ and .Fn lstat except when the .Fa path -specifies a relative path, or the -.Dv AT_BENEATH -flag is provided. +specifies a relative path. For .Fn fstatat and relative @@ -95,13 +93,6 @@ the status is retrieved from a file relative to the directory associated with the file descriptor .Fa fd instead of the current working directory. -For -.Dv AT_BENEATH -and absolute -.Fa path , -the status is retrieved from a file specified by the -.Fa path , -but additional permission checks are performed, see below. .Pp The values for the .Fa flag @@ -113,15 +104,8 @@ defined in If .Fa path names a symbolic link, the status of the symbolic link is returned. -.It Dv AT_BENEATH -Only stat files and directories below the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the starting directory. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -148,19 +132,10 @@ bit is set in When .Fn fstatat is called with an absolute -.Fa path -without the -.Dv AT_BENEATH -flag, it ignores the -.Fa fd -argument. -When -.Dv AT_BENEATH -is specified with an absolute .Fa path , -a directory passed by the +it ignores the .Fa fd -argument is used as the topping point for the resolution. +argument. .Pp The .Fa sb @@ -459,18 +434,9 @@ is an absolute path, or contained a ".." component leading to a directory outside of the directory hierarchy specified by .Fa fd , -and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fn fstatat , -and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. +and the process is in capability mode or the +.Dv AT_RESOLVE_BENEATH +flag was specified. .El .Sh SEE ALSO .Xr access 2 , diff --git a/lib/libc/sys/unlink.2 b/lib/libc/sys/unlink.2 index 838d4da68af2..11fff875abad 100644 --- a/lib/libc/sys/unlink.2 +++ b/lib/libc/sys/unlink.2 @@ -28,7 +28,7 @@ .\" @(#)unlink.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt UNLINK 2 .Os .Sh NAME @@ -92,16 +92,10 @@ Remove the directory entry specified by and .Fa path as a directory, not a normal file. -.It Dv AT_BENEATH -Only unlink files and directories which are beneath of the topping -directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -246,18 +240,9 @@ is an absolute path, or contained a ".." component leading to a directory outside of the directory hierarchy specified by .Fa fd , -and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fn unlinkat , -and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. +and the process is in capability mode or the +.Dv AT_RESOLVE_BENEATH +flag was specified. .El .Pp In addition to the errors returned by diff --git a/lib/libc/sys/utimensat.2 b/lib/libc/sys/utimensat.2 index 3016d1af72aa..d31ee1f1515a 100644 --- a/lib/libc/sys/utimensat.2 +++ b/lib/libc/sys/utimensat.2 @@ -31,7 +31,7 @@ .\" @(#)utimes.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt UTIMENSAT 2 .Os .Sh NAME @@ -146,16 +146,10 @@ names a symbolic link, the symbolic link's times are changed. By default, .Fn utimensat changes the times of the file referenced by the symbolic link. -.It Dv AT_BENEATH -Only allow to change the times of a file which is beneath of -the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -290,18 +284,9 @@ is an absolute path, or contained a ".." component leading to a directory outside of the directory hierarchy specified by .Fa fd , -and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fn utimensat , -and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. +and the process is in capability mode or the +.Dv AT_RESOLVE_BENEATH +flag was specified. .El .Sh SEE ALSO .Xr chflags 2 , diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index ad65ab11bb1d..4ddd7b63ce5c 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -182,13 +182,6 @@ nameicap_tracker_add(struct nameidata *ndp, struct vnode *dp) if ((ndp->ni_lcf & NI_LCF_CAP_DOTDOT) == 0 || dp->v_type != VDIR) return; cnp = &ndp->ni_cnd; - if ((cnp->cn_flags & BENEATH) != 0 && - (ndp->ni_lcf & NI_LCF_BENEATH_LATCHED) == 0) { - MPASS((ndp->ni_lcf & NI_LCF_LATCH) != 0); - if (dp != ndp->ni_beneath_latch) - return; - ndp->ni_lcf |= NI_LCF_BENEATH_LATCHED; - } nt = malloc(sizeof(*nt), M_NAMEITRACKER, M_WAITOK); vhold(dp); nt->dp = dp; @@ -196,7 +189,7 @@ nameicap_tracker_add(struct nameidata *ndp, struct vnode *dp) } static void -nameicap_cleanup(struct nameidata *ndp, bool clean_latch) +nameicap_cleanup(struct nameidata *ndp) { struct nameicap_tracker *nt, *nt1; @@ -207,10 +200,6 @@ nameicap_cleanup(struct nameidata *ndp, bool clean_latch) vdrop(nt->dp); free(nt, M_NAMEITRACKER); } - if (clean_latch && (ndp->ni_lcf & NI_LCF_LATCH) != 0) { - ndp->ni_lcf &= ~NI_LCF_LATCH; - vrele(ndp->ni_beneath_latch); - } } /* @@ -230,21 +219,17 @@ nameicap_check_dotdot(struct nameidata *ndp, struct vnode *dp) struct nameicap_tracker *nt; struct mount *mp; - if ((ndp->ni_lcf & NI_LCF_CAP_DOTDOT) == 0 || dp == NULL || - dp->v_type != VDIR) + if (dp == NULL || dp->v_type != VDIR || (ndp->ni_lcf & + NI_LCF_STRICTRELATIVE) == 0) return (0); + if ((ndp->ni_lcf & NI_LCF_CAP_DOTDOT) == 0) + return (ENOTCAPABLE); mp = dp->v_mount; if (lookup_cap_dotdot_nonlocal == 0 && mp != NULL && (mp->mnt_flag & MNT_LOCAL) == 0) return (ENOTCAPABLE); TAILQ_FOREACH_REVERSE(nt, &ndp->ni_cap_tracker, nameicap_tracker_head, nm_link) { - if ((ndp->ni_lcf & NI_LCF_LATCH) != 0 && - ndp->ni_beneath_latch == nt->dp) { - ndp->ni_lcf &= ~NI_LCF_BENEATH_LATCHED; - nameicap_cleanup(ndp, false); - return (0); - } if (dp == nt->dp) return (0); } @@ -275,11 +260,6 @@ namei_handle_root(struct nameidata *ndp, struct vnode **dpp) #endif return (ENOTCAPABLE); } - if ((cnp->cn_flags & BENEATH) != 0) { - ndp->ni_lcf |= NI_LCF_BENEATH_ABS; - ndp->ni_lcf &= ~NI_LCF_BENEATH_LATCHED; - nameicap_cleanup(ndp, false); - } while (*(cnp->cn_nameptr) == '/') { cnp->cn_nameptr++; ndp->ni_pathlen--; @@ -297,7 +277,6 @@ namei_setup(struct nameidata *ndp, struct vnode **dpp, struct pwd **pwdp) struct thread *td; struct pwd *pwd; cap_rights_t rights; - struct filecaps dirfd_caps; int error; bool startdir_used; @@ -410,26 +389,8 @@ namei_setup(struct nameidata *ndp, struct vnode **dpp, struct pwd **pwdp) if (error == 0 && (*dpp)->v_type != VDIR) error = ENOTDIR; } - if (error == 0 && (cnp->cn_flags & BENEATH) != 0) { - if (ndp->ni_dirfd == AT_FDCWD) { - ndp->ni_beneath_latch = pwd->pwd_cdir; - vrefact(ndp->ni_beneath_latch); - } else { - rights = *ndp->ni_rightsneeded; - cap_rights_set_one(&rights, CAP_LOOKUP); - error = fgetvp_rights(td, ndp->ni_dirfd, &rights, - &dirfd_caps, &ndp->ni_beneath_latch); - if (error == 0 && (*dpp)->v_type != VDIR) { - vrele(ndp->ni_beneath_latch); - error = ENOTDIR; - } - } - if (error == 0) - ndp->ni_lcf |= NI_LCF_LATCH; - } if (error == 0 && (cnp->cn_flags & RBENEATH) != 0) { - if (cnp->cn_pnbuf[0] == '/' || - (ndp->ni_lcf & NI_LCF_BENEATH_ABS) != 0) { + if (cnp->cn_pnbuf[0] == '/') { error = EINVAL; } else if ((ndp->ni_lcf & NI_LCF_STRICTRELATIVE) == 0) { ndp->ni_lcf |= NI_LCF_STRICTRELATIVE | @@ -452,12 +413,8 @@ namei_setup(struct nameidata *ndp, struct vnode **dpp, struct pwd **pwdp) pwd_drop(pwd); return (error); } - MPASS((ndp->ni_lcf & (NI_LCF_BENEATH_ABS | NI_LCF_LATCH)) != - NI_LCF_BENEATH_ABS); - if (((ndp->ni_lcf & NI_LCF_STRICTRELATIVE) != 0 && - lookup_cap_dotdot != 0) || - ((ndp->ni_lcf & NI_LCF_STRICTRELATIVE) == 0 && - (cnp->cn_flags & BENEATH) != 0)) + if ((ndp->ni_lcf & NI_LCF_STRICTRELATIVE) != 0 && + lookup_cap_dotdot != 0) ndp->ni_lcf |= NI_LCF_CAP_DOTDOT; SDT_PROBE4(vfs, namei, lookup, entry, *dpp, cnp->cn_pnbuf, cnp->cn_flags, false); @@ -636,16 +593,8 @@ namei(struct nameidata *ndp) for (;;) { ndp->ni_startdir = dp; error = lookup(ndp); - if (error != 0) { - /* - * Override an error to not allow user to use - * BENEATH as an oracle. - */ - if ((ndp->ni_lcf & (NI_LCF_LATCH | - NI_LCF_BENEATH_LATCHED)) == NI_LCF_LATCH) - error = ENOTCAPABLE; + if (error != 0) goto out; - } /* * If not a symbolic link, we're done. @@ -657,12 +606,7 @@ namei(struct nameidata *ndp) namei_cleanup_cnp(cnp); } else cnp->cn_flags |= HASBUF; - if ((ndp->ni_lcf & (NI_LCF_LATCH | - NI_LCF_BENEATH_LATCHED)) == NI_LCF_LATCH) { - NDFREE(ndp, 0); - error = ENOTCAPABLE; - } - nameicap_cleanup(ndp, true); + nameicap_cleanup(ndp); pwd_drop(pwd); if (error == 0) NDVALIDATE(ndp); @@ -739,7 +683,7 @@ out: MPASS(error != 0); SDT_PROBE4(vfs, namei, lookup, return, error, NULL, false, ndp); namei_cleanup_cnp(cnp); - nameicap_cleanup(ndp, true); + nameicap_cleanup(ndp); pwd_drop(pwd); return (error); } diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index a51d693446e3..52604d3da829 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -120,8 +120,6 @@ at2cnpflags(u_int at_flags, u_int mask) res = 0; at_flags &= mask; - if ((at_flags & AT_BENEATH) != 0) - res |= BENEATH; if ((at_flags & AT_RESOLVE_BENEATH) != 0) res |= RBENEATH; if ((at_flags & AT_SYMLINK_FOLLOW) != 0) @@ -1500,12 +1498,11 @@ sys_linkat(struct thread *td, struct linkat_args *uap) int flag; flag = uap->flag; - if ((flag & ~(AT_SYMLINK_FOLLOW | AT_BENEATH | - AT_RESOLVE_BENEATH)) != 0) + if ((flag & ~(AT_SYMLINK_FOLLOW | AT_RESOLVE_BENEATH)) != 0) return (EINVAL); return (kern_linkat(td, uap->fd1, uap->fd2, uap->path1, uap->path2, - UIO_USERSPACE, at2cnpflags(flag, AT_SYMLINK_FOLLOW | AT_BENEATH | + UIO_USERSPACE, at2cnpflags(flag, AT_SYMLINK_FOLLOW | AT_RESOLVE_BENEATH))); } @@ -1875,7 +1872,7 @@ kern_funlinkat(struct thread *td, int dfd, const char *path, int fd, restart: bwillwrite(); NDINIT_ATRIGHTS(&nd, DELETE, LOCKPARENT | LOCKLEAF | AUDITVNODE1 | - at2cnpflags(flag, AT_BENEATH | AT_RESOLVE_BENEATH), + at2cnpflags(flag, AT_RESOLVE_BENEATH), pathseg, path, dfd, &cap_unlinkat_rights, td); if ((error = namei(&nd)) != 0) { if (error == EINVAL) @@ -2080,7 +2077,7 @@ kern_accessat(struct thread *td, int fd, const char *path, struct nameidata nd; int error; - if ((flag & ~(AT_EACCESS | AT_BENEATH | AT_RESOLVE_BENEATH)) != 0) + if ((flag & ~(AT_EACCESS | AT_RESOLVE_BENEATH)) != 0) return (EINVAL); if (amode != F_OK && (amode & ~(R_OK | W_OK | X_OK)) != 0) return (EINVAL); @@ -2101,7 +2098,7 @@ kern_accessat(struct thread *td, int fd, const char *path, usecred = cred; AUDIT_ARG_VALUE(amode); NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | - AUDITVNODE1 | at2cnpflags(flag, AT_BENEATH | AT_RESOLVE_BENEATH), + AUDITVNODE1 | at2cnpflags(flag, AT_RESOLVE_BENEATH), pathseg, path, fd, &cap_fstat_rights, td); if ((error = namei(&nd)) != 0) goto out; @@ -2392,13 +2389,12 @@ kern_statat(struct thread *td, int flag, int fd, const char *path, struct nameidata nd; int error; - if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_BENEATH | - AT_RESOLVE_BENEATH)) != 0) + if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_RESOLVE_BENEATH)) != 0) return (EINVAL); - NDINIT_ATRIGHTS(&nd, LOOKUP, at2cnpflags(flag, AT_BENEATH | - AT_RESOLVE_BENEATH | AT_SYMLINK_NOFOLLOW) | LOCKSHARED | LOCKLEAF | - AUDITVNODE1, pathseg, path, fd, &cap_fstat_rights, td); + NDINIT_ATRIGHTS(&nd, LOOKUP, at2cnpflags(flag, AT_RESOLVE_BENEATH | + AT_SYMLINK_NOFOLLOW) | LOCKSHARED | LOCKLEAF | AUDITVNODE1, + pathseg, path, fd, &cap_fstat_rights, td); if ((error = namei(&nd)) != 0) return (error); @@ -2716,8 +2712,7 @@ int sys_chflagsat(struct thread *td, struct chflagsat_args *uap) { - if ((uap->atflag & ~(AT_SYMLINK_NOFOLLOW | AT_BENEATH | - AT_RESOLVE_BENEATH)) != 0) + if ((uap->atflag & ~(AT_SYMLINK_NOFOLLOW | AT_RESOLVE_BENEATH)) != 0) return (EINVAL); return (kern_chflagsat(td, uap->fd, uap->path, UIO_USERSPACE, *** 169 LINES SKIPPED *** From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 20:08: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 65BA15583B2; Thu, 4 Mar 2021 20:08: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 4Ds24b2pfrz4qQ2; Thu, 4 Mar 2021 20:08: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 D877122FF6; Thu, 4 Mar 2021 20:08: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 124K8kYP041991; Thu, 4 Mar 2021 20:08:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124K8kq7041990; Thu, 4 Mar 2021 20:08:46 GMT (envelope-from git) Date: Thu, 4 Mar 2021 20:08:46 GMT Message-Id: <202103042008.124K8kq7041990@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: cea301aee3e1 - releng/13.0 - Do not call nameicap_tracker_add() for dotdot case. 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: cea301aee3e1dc5f7006f45c5b11bcff315775e0 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 Mar 2021 20:08:49 -0000 The branch releng/13.0 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=cea301aee3e1dc5f7006f45c5b11bcff315775e0 commit cea301aee3e1dc5f7006f45c5b11bcff315775e0 Author: Konstantin Belousov AuthorDate: 2021-02-28 00:12:43 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-04 20:07:50 +0000 Do not call nameicap_tracker_add() for dotdot case. Approved by: re (gjb) (cherry picked from commit 59e749428111c029116a4302a544c7cc18b33772) --- sys/kern/vfs_lookup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 4ddd7b63ce5c..73290e8da05f 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -1258,7 +1258,8 @@ success: } } if (ndp->ni_vp != NULL) { - nameicap_tracker_add(ndp, ndp->ni_vp); + if ((cnp->cn_flags & ISDOTDOT) == 0) + nameicap_tracker_add(ndp, ndp->ni_vp); if ((cnp->cn_flags & (FAILIFEXISTS | ISSYMLINK)) == FAILIFEXISTS) goto bad_eexist; } From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 20:08: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 606F2558322; Thu, 4 Mar 2021 20:08: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 4Ds24d5gNyz4qZ7; Thu, 4 Mar 2021 20:08: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 34A7D234C7; Thu, 4 Mar 2021 20:08: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 124K8lMh042013; Thu, 4 Mar 2021 20:08:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124K8lWo042012; Thu, 4 Mar 2021 20:08:47 GMT (envelope-from git) Date: Thu, 4 Mar 2021 20:08:47 GMT Message-Id: <202103042008.124K8lWo042012@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: 4a5108cdc927 - releng/13.0 - nameicap_tracker_add: avoid duplicates in the tracker list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 4a5108cdc92795ff035758a79b09cd0376ecec12 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 Mar 2021 20:08:55 -0000 The branch releng/13.0 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4a5108cdc92795ff035758a79b09cd0376ecec12 commit 4a5108cdc92795ff035758a79b09cd0376ecec12 Author: Konstantin Belousov AuthorDate: 2021-02-28 00:13:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-04 20:07:54 +0000 nameicap_tracker_add: avoid duplicates in the tracker list Approved by: re (gjb) (cherry picked from commit 2388ad7c293fbc89ee239a1adcb87fd158c4e8e9) --- sys/kern/vfs_lookup.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 73290e8da05f..cdd4a914239f 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -182,6 +182,9 @@ nameicap_tracker_add(struct nameidata *ndp, struct vnode *dp) if ((ndp->ni_lcf & NI_LCF_CAP_DOTDOT) == 0 || dp->v_type != VDIR) return; cnp = &ndp->ni_cnd; + nt = TAILQ_LAST(&ndp->ni_cap_tracker, nameicap_tracker_head); + if (nt != NULL && nt->dp == dp) + return; nt = malloc(sizeof(*nt), M_NAMEITRACKER, M_WAITOK); vhold(dp); nt->dp = dp; From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 20:08: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 3324B558323; Thu, 4 Mar 2021 20:08:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ds24f5xxLz4qGb; Thu, 4 Mar 2021 20:08: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 4137422FF7; Thu, 4 Mar 2021 20:08: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 124K8mGJ042035; Thu, 4 Mar 2021 20:08:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124K8m8T042034; Thu, 4 Mar 2021 20:08:48 GMT (envelope-from git) Date: Thu, 4 Mar 2021 20:08:48 GMT Message-Id: <202103042008.124K8m8T042034@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: bd7a41bed081 - releng/13.0 - Add nameicap_cleanup_from(), to clean tracker list starting from some element 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: bd7a41bed0818edf233743a96ed1c394e8e34936 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 Mar 2021 20:08:55 -0000 The branch releng/13.0 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=bd7a41bed0818edf233743a96ed1c394e8e34936 commit bd7a41bed0818edf233743a96ed1c394e8e34936 Author: Konstantin Belousov AuthorDate: 2021-02-28 00:14:43 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-04 20:07:58 +0000 Add nameicap_cleanup_from(), to clean tracker list starting from some element Approved by: re (gjb) (cherry picked from commit e8a2862aa0384c75603f801625e309a3dae0ed05) --- sys/kern/vfs_lookup.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index cdd4a914239f..abc01c73e24c 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -192,19 +192,26 @@ nameicap_tracker_add(struct nameidata *ndp, struct vnode *dp) } static void -nameicap_cleanup(struct nameidata *ndp) +nameicap_cleanup_from(struct nameidata *ndp, struct nameicap_tracker *first) { struct nameicap_tracker *nt, *nt1; - KASSERT(TAILQ_EMPTY(&ndp->ni_cap_tracker) || - (ndp->ni_lcf & NI_LCF_CAP_DOTDOT) != 0, ("not strictrelative")); - TAILQ_FOREACH_SAFE(nt, &ndp->ni_cap_tracker, nm_link, nt1) { + nt = first; + TAILQ_FOREACH_FROM_SAFE(nt, &ndp->ni_cap_tracker, nm_link, nt1) { TAILQ_REMOVE(&ndp->ni_cap_tracker, nt, nm_link); vdrop(nt->dp); free(nt, M_NAMEITRACKER); } } +static void +nameicap_cleanup(struct nameidata *ndp) +{ + KASSERT(TAILQ_EMPTY(&ndp->ni_cap_tracker) || + (ndp->ni_lcf & NI_LCF_CAP_DOTDOT) != 0, ("not strictrelative")); + nameicap_cleanup_from(ndp, NULL); +} + /* * For dotdot lookups in capability mode, only allow the component * lookup to succeed if the resulting directory was already traversed From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 20:08: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 5128F558412; Thu, 4 Mar 2021 20:08:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ds24h0Lgcz4qWp; Thu, 4 Mar 2021 20:08: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 5746B235CA; Thu, 4 Mar 2021 20:08: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 124K8oD5042053; Thu, 4 Mar 2021 20:08:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124K8oY3042052; Thu, 4 Mar 2021 20:08:50 GMT (envelope-from git) Date: Thu, 4 Mar 2021 20:08:50 GMT Message-Id: <202103042008.124K8oY3042052@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: 8ae87de4df1d - releng/13.0 - nameicap_check_dotdot: trim tracker on check 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 8ae87de4df1ddd748883ab00666a152d3b8e7301 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 Mar 2021 20:08:56 -0000 The branch releng/13.0 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8ae87de4df1ddd748883ab00666a152d3b8e7301 commit 8ae87de4df1ddd748883ab00666a152d3b8e7301 Author: Konstantin Belousov AuthorDate: 2021-02-28 00:15:21 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-04 20:08:02 +0000 nameicap_check_dotdot: trim tracker on check Approved by: re (gjb) (cherry picked from commit 49c98a4bf3a87ace0df99056fa683805c1645e61) --- sys/kern/vfs_lookup.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index abc01c73e24c..b4280f85c5b6 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -240,8 +240,12 @@ nameicap_check_dotdot(struct nameidata *ndp, struct vnode *dp) return (ENOTCAPABLE); TAILQ_FOREACH_REVERSE(nt, &ndp->ni_cap_tracker, nameicap_tracker_head, nm_link) { - if (dp == nt->dp) + if (dp == nt->dp) { + nt = TAILQ_NEXT(nt, nm_link); + if (nt != NULL) + nameicap_cleanup_from(ndp, nt); return (0); + } } return (ENOTCAPABLE); } From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 20:08:55 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 12CC155832A; Thu, 4 Mar 2021 20:08:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ds24h0752z4qMX; Thu, 4 Mar 2021 20:08: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 501A42363C; Thu, 4 Mar 2021 20:08: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 124K8p51042075; Thu, 4 Mar 2021 20:08:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124K8pZS042074; Thu, 4 Mar 2021 20:08:51 GMT (envelope-from git) Date: Thu, 4 Mar 2021 20:08:51 GMT Message-Id: <202103042008.124K8pZS042074@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: ac94eec58a1a - releng/13.0 - O_RELATIVE_BENEATH: return ENOTCAPABLE instead of EINVAL for abs path 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: ac94eec58a1ab6e484bac7d148fc6f96e622d0a7 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 Mar 2021 20:08:56 -0000 The branch releng/13.0 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ac94eec58a1ab6e484bac7d148fc6f96e622d0a7 commit ac94eec58a1ab6e484bac7d148fc6f96e622d0a7 Author: Konstantin Belousov AuthorDate: 2021-02-28 23:59:12 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-04 20:08:07 +0000 O_RELATIVE_BENEATH: return ENOTCAPABLE instead of EINVAL for abs path Approved by: re (gjb) (cherry picked from commit 28cd3a673e0e32b009fd573764956b280d1affe1) --- sys/kern/vfs_lookup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index b4280f85c5b6..e881e8f909a4 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -405,7 +405,7 @@ namei_setup(struct nameidata *ndp, struct vnode **dpp, struct pwd **pwdp) } if (error == 0 && (cnp->cn_flags & RBENEATH) != 0) { if (cnp->cn_pnbuf[0] == '/') { - error = EINVAL; + error = ENOTCAPABLE; } else if ((ndp->ni_lcf & NI_LCF_STRICTRELATIVE) == 0) { ndp->ni_lcf |= NI_LCF_STRICTRELATIVE | NI_LCF_CAP_DOTDOT; From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 20:55: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 4991855A0E5; Thu, 4 Mar 2021 20:55: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 4Ds36r1dFjz4vHL; Thu, 4 Mar 2021 20:55: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 265A524286; Thu, 4 Mar 2021 20:55: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 124KtmQi008587; Thu, 4 Mar 2021 20:55:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124KtmAI008586; Thu, 4 Mar 2021 20:55:48 GMT (envelope-from git) Date: Thu, 4 Mar 2021 20:55:48 GMT Message-Id: <202103042055.124KtmAI008586@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: 3d4229b5decc - stable/12 - Revert "MFC kern: cpuset: properly rebase when attaching to a jail" 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: 3d4229b5decc74b5276fa0b3930ed1552c5f00f5 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 Mar 2021 20:55:48 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=3d4229b5decc74b5276fa0b3930ed1552c5f00f5 commit 3d4229b5decc74b5276fa0b3930ed1552c5f00f5 Author: Kyle Evans AuthorDate: 2021-03-04 20:13:55 +0000 Commit: Kyle Evans CommitDate: 2021-03-04 20:50:34 +0000 Revert "MFC kern: cpuset: properly rebase when attaching to a jail" This behavior change is too invasive to be made between minor versions, back it out in stable/12 -- it will be first introduced in 13.0. The cpuset test has been adjusted to account for the legacy behavior, with a note added as to why it's different and doesn't work if run as-is on 13.0. This reverts commit 7bb960ce6447bd535e0fbb648e4d9edbb1dc067f. --- lib/libc/tests/sys/cpuset_test.c | 11 +++- sys/kern/kern_cpuset.c | 121 +++++++-------------------------------- 2 files changed, 31 insertions(+), 101 deletions(-) diff --git a/lib/libc/tests/sys/cpuset_test.c b/lib/libc/tests/sys/cpuset_test.c index d6dd69e7e3c1..e3332540eb29 100644 --- a/lib/libc/tests/sys/cpuset_test.c +++ b/lib/libc/tests/sys/cpuset_test.c @@ -360,7 +360,16 @@ jail_attach_newbase_epi(struct jail_test_cb_params *cbp) */ ATF_REQUIRE(info->jail_cpuset != cbp->rootid); ATF_REQUIRE(info->jail_cpuset != cbp->setid); - ATF_REQUIRE(info->jail_cpuset != info->jail_child_cpuset); + + /* + * The historical behavior has been that the process will simply take on + * and mask the jail's cpuset. As of FreeBSD 13.0, this behavior will + * change so that an attaching process will rebase its cpuset onto the + * jail's if it had one distinct from its own jail's root, thus breaking + * this condition. + */ + ATF_REQUIRE(info->jail_cpuset == info->jail_child_cpuset); + ATF_REQUIRE_EQ(0, CPU_CMP(mask, &info->jail_tidmask)); } diff --git a/sys/kern/kern_cpuset.c b/sys/kern/kern_cpuset.c index 368acdb2be16..e2e45f53c0af 100644 --- a/sys/kern/kern_cpuset.c +++ b/sys/kern/kern_cpuset.c @@ -1138,63 +1138,14 @@ cpuset_setproc_setthread(struct cpuset *tdset, struct cpuset *set, domainlist); } -static int -cpuset_setproc_newbase(struct thread *td, struct cpuset *set, - struct cpuset *nroot, struct cpuset **nsetp, - struct setlist *cpusets, struct domainlist *domainlist) -{ - struct domainset ndomain; - cpuset_t nmask; - struct cpuset *pbase; - int error; - - pbase = cpuset_getbase(td->td_cpuset); - - /* Copy process mask, then further apply the new root mask. */ - CPU_COPY(&pbase->cs_mask, &nmask); - CPU_AND(&nmask, &nroot->cs_mask); - - domainset_copy(pbase->cs_domain, &ndomain); - DOMAINSET_AND(&ndomain.ds_mask, &set->cs_domain->ds_mask); - - /* Policy is too restrictive, will not work. */ - if (CPU_EMPTY(&nmask) || DOMAINSET_EMPTY(&ndomain.ds_mask)) - return (EDEADLK); - - /* - * Remove pbase from the freelist in advance, it'll be pushed to - * cpuset_ids on success. We assume here that cpuset_create() will not - * touch pbase on failure, and we just enqueue it back to the freelist - * to remain in a consistent state. - */ - pbase = LIST_FIRST(cpusets); - LIST_REMOVE(pbase, cs_link); - error = cpuset_create(&pbase, set, &nmask); - if (error != 0) { - LIST_INSERT_HEAD(cpusets, pbase, cs_link); - return (error); - } - - /* Duplicates some work from above... oh well. */ - pbase->cs_domain = domainset_shadow(set->cs_domain, &ndomain, - domainlist); - *nsetp = pbase; - return (0); -} - /* - * Handle four cases for updating an entire process. + * Handle three cases for updating an entire process. * - * 1) Set is non-null and the process is not rebasing onto a new root. This - * reparents all anonymous sets to the provided set and replaces all - * non-anonymous td_cpusets with the provided set. - * 2) Set is non-null and the process is rebasing onto a new root. This - * creates a new base set if the process previously had its own base set, - * then reparents all anonymous sets either to that set or the provided set - * if one was not created. Non-anonymous sets are similarly replaced. - * 3) Mask is non-null. This replaces or creates anonymous sets for every + * 1) Set is non-null. This reparents all anonymous sets to the provided + * set and replaces all non-anonymous td_cpusets with the provided set. + * 2) Mask is non-null. This replaces or creates anonymous sets for every * thread with the existing base as a parent. - * 4) domain is non-null. This creates anonymous sets for every thread + * 3) domain is non-null. This creates anonymous sets for every thread * and replaces the domain set. * * This is overly complicated because we can't allocate while holding a @@ -1203,15 +1154,15 @@ cpuset_setproc_newbase(struct thread *td, struct cpuset *set, */ static int cpuset_setproc(pid_t pid, struct cpuset *set, cpuset_t *mask, - struct domainset *domain, bool rebase) + struct domainset *domain) { struct setlist freelist; struct setlist droplist; struct domainlist domainlist; - struct cpuset *base, *nset, *nroot, *tdroot; + struct cpuset *nset; struct thread *td; struct proc *p; - int needed; + int threads; int nfree; int error; @@ -1227,49 +1178,21 @@ cpuset_setproc(pid_t pid, struct cpuset *set, cpuset_t *mask, nfree = 1; LIST_INIT(&droplist); nfree = 0; - base = set; - nroot = NULL; - if (set != NULL) - nroot = cpuset_getroot(set); for (;;) { error = cpuset_which(CPU_WHICH_PID, pid, &p, &td, &nset); if (error) goto out; - tdroot = cpuset_getroot(td->td_cpuset); - needed = p->p_numthreads; - if (set != NULL && rebase && tdroot != nroot) - needed++; - if (nfree >= needed) + if (nfree >= p->p_numthreads) break; + threads = p->p_numthreads; PROC_UNLOCK(p); - if (nfree < needed) { - cpuset_freelist_add(&freelist, needed - nfree); - domainset_freelist_add(&domainlist, needed - nfree); - nfree = needed; + if (nfree < threads) { + cpuset_freelist_add(&freelist, threads - nfree); + domainset_freelist_add(&domainlist, threads - nfree); + nfree = threads; } } PROC_LOCK_ASSERT(p, MA_OWNED); - - /* - * If we're changing roots and the root set is what has been specified - * as the parent, then we'll check if the process was previously using - * the root set and, if it wasn't, create a new base with the process's - * mask applied to it. - */ - if (set != NULL && rebase && nroot != tdroot) { - cpusetid_t base_id, root_id; - - root_id = td->td_ucred->cr_prison->pr_cpuset->cs_id; - base_id = cpuset_getbase(td->td_cpuset)->cs_id; - - if (base_id != root_id) { - error = cpuset_setproc_newbase(td, set, nroot, &base, - &freelist, &domainlist); - if (error != 0) - goto unlock_out; - } - } - /* * Now that the appropriate locks are held and we have enough cpusets, * make sure the operation will succeed before applying changes. The @@ -1280,7 +1203,7 @@ cpuset_setproc(pid_t pid, struct cpuset *set, cpuset_t *mask, thread_lock(td); if (set != NULL) error = cpuset_setproc_test_setthread(td->td_cpuset, - base); + set); else error = cpuset_setproc_test_maskthread(td->td_cpuset, mask, domain); @@ -1296,7 +1219,7 @@ cpuset_setproc(pid_t pid, struct cpuset *set, cpuset_t *mask, FOREACH_THREAD_IN_PROC(p, td) { thread_lock(td); if (set != NULL) - error = cpuset_setproc_setthread(td->td_cpuset, base, + error = cpuset_setproc_setthread(td->td_cpuset, set, &nset, &freelist, &domainlist); else error = cpuset_setproc_maskthread(td->td_cpuset, mask, @@ -1311,8 +1234,6 @@ cpuset_setproc(pid_t pid, struct cpuset *set, cpuset_t *mask, unlock_out: PROC_UNLOCK(p); out: - if (base != NULL && base != set) - cpuset_rel(base); while ((nset = LIST_FIRST(&droplist)) != NULL) cpuset_rel_complete(nset); cpuset_freelist_free(&freelist); @@ -1697,7 +1618,7 @@ cpuset_setproc_update_set(struct proc *p, struct cpuset *set) KASSERT(set != NULL, ("[%s:%d] invalid set", __func__, __LINE__)); cpuset_ref(set); - error = cpuset_setproc(p->p_pid, set, NULL, NULL, true); + error = cpuset_setproc(p->p_pid, set, NULL, NULL); if (error) return (error); cpuset_rel(set); @@ -1747,7 +1668,7 @@ sys_cpuset(struct thread *td, struct cpuset_args *uap) return (error); error = copyout(&set->cs_id, uap->setid, sizeof(set->cs_id)); if (error == 0) - error = cpuset_setproc(-1, set, NULL, NULL, false); + error = cpuset_setproc(-1, set, NULL, NULL); cpuset_rel(set); return (error); } @@ -1781,7 +1702,7 @@ kern_cpuset_setid(struct thread *td, cpuwhich_t which, set = cpuset_lookup(setid, td); if (set == NULL) return (ESRCH); - error = cpuset_setproc(id, set, NULL, NULL, false); + error = cpuset_setproc(id, set, NULL, NULL); cpuset_rel(set); return (error); } @@ -2060,7 +1981,7 @@ kern_cpuset_setaffinity(struct thread *td, cpulevel_t level, cpuwhich_t which, error = cpuset_setthread(id, mask); break; case CPU_WHICH_PID: - error = cpuset_setproc(id, NULL, mask, NULL, false); + error = cpuset_setproc(id, NULL, mask, NULL); break; case CPU_WHICH_CPUSET: case CPU_WHICH_JAIL: @@ -2349,7 +2270,7 @@ kern_cpuset_setdomain(struct thread *td, cpulevel_t level, cpuwhich_t which, error = _cpuset_setthread(id, NULL, &domain); break; case CPU_WHICH_PID: - error = cpuset_setproc(id, NULL, NULL, &domain, false); + error = cpuset_setproc(id, NULL, NULL, &domain); break; case CPU_WHICH_CPUSET: case CPU_WHICH_JAIL: From owner-dev-commits-src-branches@freebsd.org Thu Mar 4 21:00:23 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 D490555A33C; Thu, 4 Mar 2021 21:00:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ds3D75hlRz4vlm; Thu, 4 Mar 2021 21:00:23 +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 B6CCF23EE0; Thu, 4 Mar 2021 21:00:23 +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 124L0Nlw017650; Thu, 4 Mar 2021 21:00:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 124L0NJ2017649; Thu, 4 Mar 2021 21:00:23 GMT (envelope-from git) Date: Thu, 4 Mar 2021 21:00:23 GMT Message-Id: <202103042100.124L0NJ2017649@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: 209247b9614f - stable/13 - loader: use display pixel density for font autoselection 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: 209247b9614f157c17a1e3aebefca4292653536b 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 Mar 2021 21:00:23 -0000 The branch stable/13 has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=209247b9614f157c17a1e3aebefca4292653536b commit 209247b9614f157c17a1e3aebefca4292653536b Author: Toomas Soome AuthorDate: 2021-02-20 08:51:28 +0000 Commit: Toomas Soome CommitDate: 2021-03-04 15:38:37 +0000 loader: use display pixel density for font autoselection Calculate font size from 16 density independent pixels (dp) by using: size = 16 * ppi/160 * display_factor We are specifying font size 16dp, and assuming 1dp = 160ppi. Also apply scaling factor 2 (display_factor). (cherry picked from commit becaac3972f1fde4e3c44516399468ba5ca65c9b) --- stand/common/gfx_fb.c | 110 +++++++++++++++++++++++++++++++++++++++++ stand/common/gfx_fb.h | 2 + stand/efi/libefi/efi_console.c | 23 ++++++--- stand/efi/loader/framebuffer.c | 96 +++++++++++++++++++++++++++++++++-- stand/i386/libi386/vbe.c | 25 ++++++---- 5 files changed, 237 insertions(+), 19 deletions(-) diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c index 02a0a3d2be22..77cf1d39854f 100644 --- a/stand/common/gfx_fb.c +++ b/stand/common/gfx_fb.c @@ -1863,6 +1863,113 @@ reset_font_flags(void) } } +/* Return w^2 + h^2 or 0, if the dimensions are unknown */ +static unsigned +edid_diagonal_squared(void) +{ + unsigned w, h; + + if (edid_info == NULL) + return (0); + + w = edid_info->display.max_horizontal_image_size; + h = edid_info->display.max_vertical_image_size; + + /* If either one is 0, we have aspect ratio, not size */ + if (w == 0 || h == 0) + return (0); + + /* + * some monitors encode the aspect ratio instead of the physical size. + */ + if ((w == 16 && h == 9) || (w == 16 && h == 10) || + (w == 4 && h == 3) || (w == 5 && h == 4)) + return (0); + + /* + * translate cm to inch, note we scale by 100 here. + */ + w = w * 100 / 254; + h = h * 100 / 254; + + /* Return w^2 + h^2 */ + return (w * w + h * h); +} + +/* + * calculate pixels per inch. + */ +static unsigned +gfx_get_ppi(void) +{ + unsigned dp, di; + + di = edid_diagonal_squared(); + if (di == 0) + return (0); + + dp = gfx_state.tg_fb.fb_width * + gfx_state.tg_fb.fb_width + + gfx_state.tg_fb.fb_height * + gfx_state.tg_fb.fb_height; + + return (isqrt(dp / di)); +} + +/* + * Calculate font size from density independent pixels (dp): + * ((16dp * ppi) / 160) * display_factor. + * Here we are using fixed constants: 1dp == 160 ppi and + * display_factor 2. + * + * We are rounding font size up and are searching for font which is + * not smaller than calculated size value. + */ +static vt_font_bitmap_data_t * +gfx_get_font(void) +{ + unsigned ppi, size; + vt_font_bitmap_data_t *font = NULL; + struct fontlist *fl, *next; + + /* Text mode is not supported here. */ + if (gfx_state.tg_fb_type == FB_TEXT) + return (NULL); + + ppi = gfx_get_ppi(); + if (ppi == 0) + return (NULL); + + /* + * We will search for 16dp font. + * We are using scale up by 10 for roundup. + */ + size = (16 * ppi * 10) / 160; + /* Apply display factor 2. */ + size = roundup(size * 2, 10) / 10; + + STAILQ_FOREACH(fl, &fonts, font_next) { + next = STAILQ_NEXT(fl, font_next); + + /* + * If this is last font or, if next font is smaller, + * we have our font. Make sure, it actually is loaded. + */ + if (next == NULL || next->font_data->vfbd_height < size) { + font = fl->font_data; + if (font->vfbd_font == NULL || + fl->font_flags == FONT_RELOAD) { + if (fl->font_load != NULL && + fl->font_name != NULL) + font = fl->font_load(fl->font_name); + } + break; + } + } + + return (font); +} + static vt_font_bitmap_data_t * set_font(teken_unit_t *rows, teken_unit_t *cols, teken_unit_t h, teken_unit_t w) { @@ -1887,6 +1994,9 @@ set_font(teken_unit_t *rows, teken_unit_t *cols, teken_unit_t h, teken_unit_t w) } } + if (font == NULL) + font = gfx_get_font(); + if (font != NULL) { *rows = height / font->vfbd_height; *cols = width / font->vfbd_width; diff --git a/stand/common/gfx_fb.h b/stand/common/gfx_fb.h index 04076a2c6d38..ac63d7939cef 100644 --- a/stand/common/gfx_fb.h +++ b/stand/common/gfx_fb.h @@ -109,6 +109,8 @@ struct vesa_edid_info { uint8_t checksum; } __packed; +extern struct vesa_edid_info *edid_info; + #define STD_TIMINGS 8 #define DET_TIMINGS 4 diff --git a/stand/efi/libefi/efi_console.c b/stand/efi/libefi/efi_console.c index 3cbd121c41da..0c40b362f276 100644 --- a/stand/efi/libefi/efi_console.c +++ b/stand/efi/libefi/efi_console.c @@ -952,13 +952,24 @@ cons_update_mode(bool use_gfx_mode) /* * setup_font() can adjust terminal size. - * Note, we do use UEFI terminal dimensions first, - * this is because the font selection will attempt - * to achieve at least this terminal dimension and - * we do not end up with too small font. + * We can see two kind of bad happening. + * We either can get too small console font - requested + * terminal size is large, display resolution is + * large, and we get very small font. + * Or, we can get too large font - requested + * terminal size is small and this will cause large + * font to be selected. + * Now, the setup_font() is updated to consider + * display density and this should give us mostly + * acceptable font. However, the catch is, not all + * display devices will give us display density. + * Still, we do hope, external monitors do - this is + * where the display size will matter the most. + * And for laptop screens, we should still get good + * results by requesting 80x25 terminal. */ - gfx_state.tg_tp.tp_row = rows; - gfx_state.tg_tp.tp_col = cols; + gfx_state.tg_tp.tp_row = 25; + gfx_state.tg_tp.tp_col = 80; setup_font(&gfx_state, fb_height, fb_width); rows = gfx_state.tg_tp.tp_row; cols = gfx_state.tg_tp.tp_col; diff --git a/stand/efi/loader/framebuffer.c b/stand/efi/loader/framebuffer.c index 509c41844dcb..adb9dfb62cee 100644 --- a/stand/efi/loader/framebuffer.c +++ b/stand/efi/loader/framebuffer.c @@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include "bootstrap.h" @@ -47,6 +49,12 @@ static EFI_GUID conout_guid = EFI_CONSOLE_OUT_DEVICE_GUID; EFI_GUID gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; static EFI_GUID pciio_guid = EFI_PCI_IO_PROTOCOL_GUID; static EFI_GUID uga_guid = EFI_UGA_DRAW_PROTOCOL_GUID; +static EFI_GUID active_edid_guid = EFI_EDID_ACTIVE_PROTOCOL_GUID; +static EFI_GUID discovered_edid_guid = EFI_EDID_DISCOVERED_PROTOCOL_GUID; +static EFI_HANDLE gop_handle; + +/* Cached EDID. */ +struct vesa_edid_info *edid_info = NULL; static EFI_GRAPHICS_OUTPUT *gop; static EFI_UGA_DRAW_PROTOCOL *uga; @@ -467,10 +475,71 @@ efifb_from_uga(struct efi_fb *efifb) return (0); } +/* + * Fetch EDID info. Caller must free the buffer. + */ +static struct vesa_edid_info * +efifb_gop_get_edid(EFI_HANDLE h) +{ + const uint8_t magic[] = EDID_MAGIC; + EFI_EDID_ACTIVE_PROTOCOL *edid; + struct vesa_edid_info *edid_infop; + EFI_GUID *guid; + EFI_STATUS status; + size_t size; + + guid = &active_edid_guid; + status = BS->OpenProtocol(h, guid, (void **)&edid, IH, NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL); + if (status != EFI_SUCCESS || + edid->SizeOfEdid == 0) { + guid = &discovered_edid_guid; + status = BS->OpenProtocol(h, guid, (void **)&edid, IH, NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL); + if (status != EFI_SUCCESS || + edid->SizeOfEdid == 0) + return (NULL); + } + + size = MAX(sizeof(*edid_infop), edid->SizeOfEdid); + + edid_infop = calloc(1, size); + if (edid_infop == NULL) + return (NULL); + + memcpy(edid_infop, edid->Edid, edid->SizeOfEdid); + + /* Validate EDID */ + if (memcmp(edid_infop, magic, sizeof (magic)) != 0) + goto error; + + if (edid_infop->header.version != 1) + goto error; + + return (edid_infop); +error: + free(edid_infop); + return (NULL); +} + +static bool +efifb_get_edid(edid_res_list_t *res) +{ + bool rv = false; + + if (edid_info == NULL) + edid_info = efifb_gop_get_edid(gop_handle); + + if (edid_info != NULL) + rv = gfx_get_edid_resolution(edid_info, res); + + return (rv); +} + int efi_find_framebuffer(teken_gfx_t *gfx_state) { - EFI_HANDLE h, *hlist; + EFI_HANDLE *hlist; UINTN nhandles, i, hsize; struct efi_fb efifb; EFI_STATUS status; @@ -498,23 +567,25 @@ efi_find_framebuffer(teken_gfx_t *gfx_state) /* * Search for ConOut protocol, if not found, use first handle. */ - h = *hlist; + gop_handle = *hlist; for (i = 0; i < nhandles; i++) { void *dummy = NULL; status = OpenProtocolByHandle(hlist[i], &conout_guid, &dummy); if (status == EFI_SUCCESS) { - h = hlist[i]; + gop_handle = hlist[i]; break; } } - status = OpenProtocolByHandle(h, &gop_guid, (void **)&gop); + status = OpenProtocolByHandle(gop_handle, &gop_guid, (void **)&gop); free(hlist); if (status == EFI_SUCCESS) { gfx_state->tg_fb_type = FB_GOP; gfx_state->tg_private = gop; + if (edid_info == NULL) + edid_info = efifb_gop_get_edid(gop_handle); } else { status = BS->LocateProtocol(&uga_guid, NULL, (VOID **)&uga); if (status == EFI_SUCCESS) { @@ -767,9 +838,25 @@ command_gop(int argc, char *argv[]) } else if (strcmp(argv[1], "off") == 0) { (void) cons_update_mode(false); } else if (strcmp(argv[1], "get") == 0) { + edid_res_list_t res; + if (argc != 2) goto usage; + TAILQ_INIT(&res); efifb_from_gop(&efifb, gop->Mode, gop->Mode->Info); + if (efifb_get_edid(&res)) { + struct resolution *rp; + + printf("EDID"); + while ((rp = TAILQ_FIRST(&res)) != NULL) { + printf(" %dx%d", rp->width, rp->height); + TAILQ_REMOVE(&res, rp, next); + free(rp); + } + printf("\n"); + } else { + printf("no EDID information\n"); + } print_efifb(gop->Mode->Mode, &efifb, 1); printf("\n"); } else if (!strcmp(argv[1], "list")) { @@ -778,6 +865,7 @@ command_gop(int argc, char *argv[]) if (argc != 2) goto usage; + pager_open(); for (mode = 0; mode < gop->Mode->MaxMode; mode++) { status = gop->QueryMode(gop, mode, &infosz, &info); diff --git a/stand/i386/libi386/vbe.c b/stand/i386/libi386/vbe.c index 0e9f6929ac05..ef4daffa8380 100644 --- a/stand/i386/libi386/vbe.c +++ b/stand/i386/libi386/vbe.c @@ -51,6 +51,7 @@ static struct modeinfoblock *vbe_mode; static uint16_t *vbe_mode_list; static size_t vbe_mode_list_size; +struct vesa_edid_info *edid_info = NULL; /* The default VGA color palette format is 6 bits per primary color. */ int palette_format = 6; @@ -836,34 +837,40 @@ vbe_dump_mode(int modenum, struct modeinfoblock *mi) static bool vbe_get_edid(edid_res_list_t *res) { - struct vesa_edid_info *edid_info; + struct vesa_edid_info *edidp; const uint8_t magic[] = EDID_MAGIC; int ddc_caps; bool ret = false; + if (edid_info != NULL) + return (gfx_get_edid_resolution(edid_info, res)); + ddc_caps = biosvbe_ddc_caps(); if (ddc_caps == 0) { return (ret); } - edid_info = bio_alloc(sizeof (*edid_info)); - if (edid_info == NULL) + edidp = bio_alloc(sizeof(*edidp)); + if (edidp == NULL) return (ret); - memset(edid_info, 0, sizeof (*edid_info)); + memset(edidp, 0, sizeof(*edidp)); - if (VBE_ERROR(biosvbe_ddc_read_edid(0, edid_info))) + if (VBE_ERROR(biosvbe_ddc_read_edid(0, edidp))) goto done; - if (memcmp(edid_info, magic, sizeof (magic)) != 0) + if (memcmp(edidp, magic, sizeof(magic)) != 0) goto done; /* Unknown EDID version. */ - if (edid_info->header.version != 1) + if (edidp->header.version != 1) goto done; - ret = gfx_get_edid_resolution(edid_info, res); + ret = gfx_get_edid_resolution(edidp, res); + edid_info = malloc(sizeof(*edid_info)); + if (edid_info != NULL) + memcpy(edid_info, edidp, sizeof (*edid_info)); done: - bio_free(edid_info, sizeof (*edid_info)); + bio_free(edidp, sizeof(*edidp)); return (ret); } From owner-dev-commits-src-branches@freebsd.org Fri Mar 5 00:36: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 59B4355F2A9; Fri, 5 Mar 2021 00:36: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 4Ds81d264qz56Rk; Fri, 5 Mar 2021 00:36: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 3B54326F94; Fri, 5 Mar 2021 00:36: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 1250aber098523; Fri, 5 Mar 2021 00:36:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1250abMV098522; Fri, 5 Mar 2021 00:36:37 GMT (envelope-from git) Date: Fri, 5 Mar 2021 00:36:37 GMT Message-Id: <202103050036.1250abMV098522@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 9bf608d00a4f - releng/13.0 - libc: fix buffer overrun in getrpcport(3) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 9bf608d00a4fa2f2028e555cfd1d7e4f8e56bd38 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 Mar 2021 00:36:37 -0000 The branch releng/13.0 has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=9bf608d00a4fa2f2028e555cfd1d7e4f8e56bd38 commit 9bf608d00a4fa2f2028e555cfd1d7e4f8e56bd38 Author: Edward Tomasz Napierala AuthorDate: 2021-01-31 21:41:55 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-03-04 23:29:00 +0000 libc: fix buffer overrun in getrpcport(3) Approved by: re (gjb) Reviewed By: markj Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D27332 (cherry picked from commit 5299d64b2b9f7a25e423ef1785d9402a0ef198d3) (cherry picked from commit a3576b6207074ba5182be253c26af72f8fb51759) --- lib/libc/rpc/getrpcport.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/libc/rpc/getrpcport.c b/lib/libc/rpc/getrpcport.c index 2b2d459c8887..4abc9a0c16af 100644 --- a/lib/libc/rpc/getrpcport.c +++ b/lib/libc/rpc/getrpcport.c @@ -62,14 +62,14 @@ getrpcport(char *host, int prognum, int versnum, int proto) assert(host != NULL); - if ((hp = gethostbyname(host)) == NULL) + if ((hp = gethostbyname2(host, AF_INET)) == NULL) return (0); memset(&addr, 0, sizeof(addr)); addr.sin_len = sizeof(struct sockaddr_in); addr.sin_family = AF_INET; addr.sin_port = 0; - if (hp->h_length > addr.sin_len) - hp->h_length = addr.sin_len; + if (hp->h_length > sizeof(addr.sin_addr.s_addr)) + hp->h_length = sizeof(addr.sin_addr.s_addr); memcpy(&addr.sin_addr.s_addr, hp->h_addr, (size_t)hp->h_length); /* Inconsistent interfaces need casts! :-( */ return (pmap_getport(&addr, (u_long)prognum, (u_long)versnum, From owner-dev-commits-src-branches@freebsd.org Fri Mar 5 00:36: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 7C2E655F1EC; Fri, 5 Mar 2021 00:36: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 4Ds81f34qGz56Gl; Fri, 5 Mar 2021 00:36: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 5C6AA26E70; Fri, 5 Mar 2021 00:36: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 1250aceo098541; Fri, 5 Mar 2021 00:36:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1250acus098540; Fri, 5 Mar 2021 00:36:38 GMT (envelope-from git) Date: Fri, 5 Mar 2021 00:36:38 GMT Message-Id: <202103050036.1250acus098540@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Edward Tomasz Napierala Subject: git: f122a8719225 - releng/13.0 - Use compat.linux.emul_path instead of hardcoded path in /etc/rc.d/linux MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: f122a871922561b7857ec80745f3e2d9531a8862 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 Mar 2021 00:36:38 -0000 The branch releng/13.0 has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=f122a871922561b7857ec80745f3e2d9531a8862 commit f122a871922561b7857ec80745f3e2d9531a8862 Author: Edward Tomasz Napierala AuthorDate: 2021-02-02 14:40:38 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-03-04 23:29:08 +0000 Use compat.linux.emul_path instead of hardcoded path in /etc/rc.d/linux In /etc/rc.d/linux the mounting paths of procfs, sysfs and devfs are hardcoded to "/compat/linux". Switching to the content of compat.linux.emul_path sysctl would allow to switch linuxulator to different place. Approved by: re (gjb) Submitted by: freebsdnewbie_freenet.de Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27807 (cherry picked from commit e40787f900f3c262d5134d342e5a16757dd2193c) (cherry picked from commit 1b2802ed4ed09746d6870080f85d79a9ccd782b0) --- libexec/rc/rc.d/linux | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libexec/rc/rc.d/linux b/libexec/rc/rc.d/linux index 4fe9cee6e751..4381b62cc660 100755 --- a/libexec/rc/rc.d/linux +++ b/libexec/rc/rc.d/linux @@ -18,6 +18,7 @@ stop_cmd=":" linux_start() { local _emul_path _tmpdir + _emul_path="$(sysctl -n compat.linux.emul_path)" load_kld -e 'linux(aout|elf)' linux case `sysctl -n hw.machine_arch` in @@ -25,11 +26,11 @@ linux_start() load_kld -e 'linux64elf' linux64 ;; esac - if [ -x /compat/linux/sbin/ldconfigDisabled ]; then + if [ -x ${_emul_path}/sbin/ldconfigDisabled ]; then _tmpdir=`mktemp -d -t linux-ldconfig` - /compat/linux/sbin/ldconfig -C ${_tmpdir}/ld.so.cache - if ! cmp -s ${_tmpdir}/ld.so.cache /compat/linux/etc/ld.so.cache; then - cat ${_tmpdir}/ld.so.cache > /compat/linux/etc/ld.so.cache + ${_emul_path}/sbin/ldconfig -C ${_tmpdir}/ld.so.cache + if ! cmp -s ${_tmpdir}/ld.so.cache ${_emul_path}/etc/ld.so.cache; then + cat ${_tmpdir}/ld.so.cache > ${_emul_path}/etc/ld.so.cache fi rm -rf ${_tmpdir} fi @@ -47,7 +48,6 @@ linux_start() fi if checkyesno linux_mounts_enable; then - _emul_path="/compat/linux" mount -o nocover -t linprocfs linprocfs "${_emul_path}/proc" mount -o nocover -t linsysfs linsysfs "${_emul_path}/sys" mount -o nocover -t devfs devfs "${_emul_path}/dev" From owner-dev-commits-src-branches@freebsd.org Fri Mar 5 00:36: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 3D91B55F315; Fri, 5 Mar 2021 00:36: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 4Ds81g6KyLz56BP; Fri, 5 Mar 2021 00:36: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 9814926BAC; Fri, 5 Mar 2021 00:36: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 1250adJu098563; Fri, 5 Mar 2021 00:36:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1250adOu098562; Fri, 5 Mar 2021 00:36:39 GMT (envelope-from git) Date: Fri, 5 Mar 2021 00:36:39 GMT Message-Id: <202103050036.1250adOu098562@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 9d39df7bd9c0 - releng/13.0 - Don't check compat.linux.emul_path before loading linux(4) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 9d39df7bd9c03cca8ad9f90e08f1577db55e4449 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 Mar 2021 00:36:40 -0000 The branch releng/13.0 has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=9d39df7bd9c03cca8ad9f90e08f1577db55e4449 commit 9d39df7bd9c03cca8ad9f90e08f1577db55e4449 Author: Edward Tomasz Napierala AuthorDate: 2021-02-08 21:52:31 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-03-04 23:29:15 +0000 Don't check compat.linux.emul_path before loading linux(4) Fix e40787f900f to make libexec/rc/rc.d/linux retrieve the sysctl after loading the kernel module which provides it, not before. Approved by: re (gjb) Reported By: jkim Sponsored By: The FreeBSD Foundation (cherry picked from commit 07cac176fba947381c8111b8e02e8067e7fa542a) (cherry picked from commit 5dc2e1bcf41f853b31b6d08a5c2d643408e890f3) --- libexec/rc/rc.d/linux | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/linux b/libexec/rc/rc.d/linux index 4381b62cc660..f44a9d02fc8d 100755 --- a/libexec/rc/rc.d/linux +++ b/libexec/rc/rc.d/linux @@ -18,7 +18,6 @@ stop_cmd=":" linux_start() { local _emul_path _tmpdir - _emul_path="$(sysctl -n compat.linux.emul_path)" load_kld -e 'linux(aout|elf)' linux case `sysctl -n hw.machine_arch` in @@ -26,6 +25,9 @@ linux_start() load_kld -e 'linux64elf' linux64 ;; esac + + _emul_path="$(sysctl -n compat.linux.emul_path)" + if [ -x ${_emul_path}/sbin/ldconfigDisabled ]; then _tmpdir=`mktemp -d -t linux-ldconfig` ${_emul_path}/sbin/ldconfig -C ${_tmpdir}/ld.so.cache From owner-dev-commits-src-branches@freebsd.org Fri Mar 5 00:36: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 E04E255EC4B; Fri, 5 Mar 2021 00:36: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 4Ds81h6zv7z56VV; Fri, 5 Mar 2021 00:36: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 BD44B26BAD; Fri, 5 Mar 2021 00:36: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 1250aeUl098582; Fri, 5 Mar 2021 00:36:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1250aeL6098581; Fri, 5 Mar 2021 00:36:40 GMT (envelope-from git) Date: Fri, 5 Mar 2021 00:36:40 GMT Message-Id: <202103050036.1250aeL6098581@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Edward Tomasz Napierala Subject: git: fdd7609f1023 - releng/13.0 - linux: fix handling of flags for 32 bit send(2) syscall MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: fdd7609f10236df34c8d8ae2d6f2dae46e0e96cf 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 Mar 2021 00:36:42 -0000 The branch releng/13.0 has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=fdd7609f10236df34c8d8ae2d6f2dae46e0e96cf commit fdd7609f10236df34c8d8ae2d6f2dae46e0e96cf Author: Edward Tomasz Napierala AuthorDate: 2021-02-05 17:24:23 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-03-04 23:29:22 +0000 linux: fix handling of flags for 32 bit send(2) syscall Previously the flags were passed as-is, which could resulted in spurious EAGAIN returned for non-blocking sockets, which broke some Steam games. Approved by: re (gjb) PR: 248065 Reported By: Alex S Tested By: Alex S Reviewed By: emaste MFC After: 3 days Sponsored By: The FreeBSD Foundation (cherry picked from commit f6e8256a965d5b7a7d43034ea31b2430a3b51066) (cherry picked from commit 9d930fb09072d21464288df8c834cb8d0b760073) --- sys/compat/linux/linux_socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 5bfcdbb8fd21..c723af9dfba0 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -1178,7 +1178,7 @@ linux_send(struct thread *td, struct linux_send_args *args) bsd_args.s = args->s; bsd_args.buf = (caddr_t)PTRIN(args->msg); bsd_args.len = args->len; - bsd_args.flags = args->flags; + bsd_args.flags = linux_to_bsd_msg_flags(args->flags); bsd_args.to = NULL; bsd_args.tolen = 0; error = sys_sendto(td, &bsd_args); From owner-dev-commits-src-branches@freebsd.org Fri Mar 5 00:52: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 442B455F8EA; Fri, 5 Mar 2021 00:52:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ds8Md1X0Mz57fZ; Fri, 5 Mar 2021 00:52: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 277E227169; Fri, 5 Mar 2021 00:52: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 1250qDeK023821; Fri, 5 Mar 2021 00:52:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1250qDsW023820; Fri, 5 Mar 2021 00:52:13 GMT (envelope-from git) Date: Fri, 5 Mar 2021 00:52:13 GMT Message-Id: <202103050052.1250qDsW023820@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: 60e8939aa85b - releng/13.0 - update to RC1 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 60e8939aa85b07f3271dcc01730727dda04c8bf6 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 Mar 2021 00:52:13 -0000 The branch releng/13.0 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=60e8939aa85b07f3271dcc01730727dda04c8bf6 commit 60e8939aa85b07f3271dcc01730727dda04c8bf6 Author: Glen Barber AuthorDate: 2021-03-05 00:51:39 +0000 Commit: Glen Barber CommitDate: 2021-03-05 00:52:07 +0000 update to RC1 Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/conf/newvers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 1056611889cf..e2c07563f53b 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -54,7 +54,7 @@ TYPE="FreeBSD" REVISION="13.0" -BRANCH="BETA4" +BRANCH="RC1" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-dev-commits-src-branches@freebsd.org Fri Mar 5 00:53:55 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 9D50455FF92; Fri, 5 Mar 2021 00:53:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ds8Pb42KVz57kP; Fri, 5 Mar 2021 00:53:55 +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 7D5F527385; Fri, 5 Mar 2021 00:53: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 1250rtKV024179; Fri, 5 Mar 2021 00:53:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1250rtTO024178; Fri, 5 Mar 2021 00:53:55 GMT (envelope-from git) Date: Fri, 5 Mar 2021 00:53:55 GMT Message-Id: <202103050053.1250rtTO024178@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: 5ea5c72f5226 - stable/13 - Remove pointless lun->be_lun checks. 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: 5ea5c72f5226a5d06e6e994ab45f889030f35fa4 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 Mar 2021 00:53:55 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=5ea5c72f5226a5d06e6e994ab45f889030f35fa4 commit 5ea5c72f5226a5d06e6e994ab45f889030f35fa4 Author: Alexander Motin AuthorDate: 2021-02-26 00:45:59 +0000 Commit: Alexander Motin CommitDate: 2021-03-05 00:53:53 +0000 Remove pointless lun->be_lun checks. There is no such thing as LUN without backend, at least for years. MFC after: 1 week (cherry picked from commit a9bd22814f680ce87259d56155204f9294e684ce) --- sys/cam/ctl/ctl.c | 13 +++++-------- sys/cam/ctl/ctl_tpc.c | 6 +++--- sys/cam/ctl/ctl_tpc_local.c | 6 +++--- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index 37962eb3522c..bb8fbf910857 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -11023,16 +11023,15 @@ ctl_check_for_blockage(struct ctl_lun *lun, union ctl_io *pending_io, return (CTL_ACTION_BLOCK); case CTL_SER_EXTENT: return (ctl_extent_check(ooa_io, pending_io, - (lun->be_lun && lun->be_lun->serseq == CTL_LUN_SERSEQ_ON))); + (lun->be_lun->serseq == CTL_LUN_SERSEQ_ON))); case CTL_SER_EXTENTOPT: if ((lun->MODE_CTRL.queue_flags & SCP_QUEUE_ALG_MASK) != SCP_QUEUE_ALG_UNRESTRICTED) return (ctl_extent_check(ooa_io, pending_io, - (lun->be_lun && - lun->be_lun->serseq == CTL_LUN_SERSEQ_ON))); + (lun->be_lun->serseq == CTL_LUN_SERSEQ_ON))); return (CTL_ACTION_PASS); case CTL_SER_EXTENTSEQ: - if (lun->be_lun && lun->be_lun->serseq != CTL_LUN_SERSEQ_OFF) + if (lun->be_lun->serseq != CTL_LUN_SERSEQ_OFF) return (ctl_extent_check_seq(ooa_io, pending_io)); return (CTL_ACTION_PASS); case CTL_SER_PASS: @@ -11276,8 +11275,7 @@ ctl_scsiio_lun_check(struct ctl_lun *lun, } if (entry->pattern & CTL_LUN_PAT_WRITE) { - if (lun->be_lun && - lun->be_lun->flags & CTL_LUN_FLAG_READONLY) { + if (lun->be_lun->flags & CTL_LUN_FLAG_READONLY) { ctl_set_hw_write_protected(ctsio); retval = 1; goto bailout; @@ -13269,8 +13267,7 @@ ctl_serseq_done(union ctl_io *io) { struct ctl_lun *lun = CTL_LUN(io); - if (lun->be_lun == NULL || - lun->be_lun->serseq == CTL_LUN_SERSEQ_OFF) + if (lun->be_lun->serseq == CTL_LUN_SERSEQ_OFF) return; mtx_lock(&lun->lun_lock); io->io_hdr.flags |= CTL_FLAG_SERSEQ_DONE; diff --git a/sys/cam/ctl/ctl_tpc.c b/sys/cam/ctl/ctl_tpc.c index 456157749c89..d63435b38762 100644 --- a/sys/cam/ctl/ctl_tpc.c +++ b/sys/cam/ctl/ctl_tpc.c @@ -759,12 +759,12 @@ tpc_resolve(struct tpc_list *list, uint16_t idx, uint32_t *ss, { if (idx == 0xffff) { - if (ss && list->lun->be_lun) + if (ss) *ss = list->lun->be_lun->blocksize; - if (pb && list->lun->be_lun) + if (pb) *pb = list->lun->be_lun->blocksize << list->lun->be_lun->pblockexp; - if (pbo && list->lun->be_lun) + if (pbo) *pbo = list->lun->be_lun->blocksize * list->lun->be_lun->pblockoff; return (list->lun->lun); diff --git a/sys/cam/ctl/ctl_tpc_local.c b/sys/cam/ctl/ctl_tpc_local.c index 714240fe8228..c2d628033037 100644 --- a/sys/cam/ctl/ctl_tpc_local.c +++ b/sys/cam/ctl/ctl_tpc_local.c @@ -294,12 +294,12 @@ tpcl_resolve(struct ctl_softc *softc, int init_port, lun->lun_devid->len, &cscdid->codeset, cscdid->length + 4) == 0) { lunid = lun->lun; - if (ss && lun->be_lun) + if (ss) *ss = lun->be_lun->blocksize; - if (ps && lun->be_lun) + if (ps) *ps = lun->be_lun->blocksize << lun->be_lun->pblockexp; - if (pso && lun->be_lun) + if (pso) *pso = lun->be_lun->blocksize * lun->be_lun->pblockoff; break; From owner-dev-commits-src-branches@freebsd.org Fri Mar 5 00:54: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 E140955FF9D; Fri, 5 Mar 2021 00:54:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ds8Pr5cVzz57nb; Fri, 5 Mar 2021 00:54: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 9066227046; Fri, 5 Mar 2021 00:54: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 1250s84G024315; Fri, 5 Mar 2021 00:54:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1250s8qi024314; Fri, 5 Mar 2021 00:54:08 GMT (envelope-from git) Date: Fri, 5 Mar 2021 00:54:08 GMT Message-Id: <202103050054.1250s8qi024314@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: 3f926f5aed36 - stable/12 - Remove pointless lun->be_lun checks. 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: 3f926f5aed36764246b45d0f2d5353700c4e9efb 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 Mar 2021 00:54:09 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=3f926f5aed36764246b45d0f2d5353700c4e9efb commit 3f926f5aed36764246b45d0f2d5353700c4e9efb Author: Alexander Motin AuthorDate: 2021-02-26 00:45:59 +0000 Commit: Alexander Motin CommitDate: 2021-03-05 00:54:06 +0000 Remove pointless lun->be_lun checks. There is no such thing as LUN without backend, at least for years. MFC after: 1 week (cherry picked from commit a9bd22814f680ce87259d56155204f9294e684ce) --- sys/cam/ctl/ctl.c | 13 +++++-------- sys/cam/ctl/ctl_tpc.c | 6 +++--- sys/cam/ctl/ctl_tpc_local.c | 6 +++--- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index eba493746589..5ee6810f960a 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -11035,16 +11035,15 @@ ctl_check_for_blockage(struct ctl_lun *lun, union ctl_io *pending_io, return (CTL_ACTION_BLOCK); case CTL_SER_EXTENT: return (ctl_extent_check(ooa_io, pending_io, - (lun->be_lun && lun->be_lun->serseq == CTL_LUN_SERSEQ_ON))); + (lun->be_lun->serseq == CTL_LUN_SERSEQ_ON))); case CTL_SER_EXTENTOPT: if ((lun->MODE_CTRL.queue_flags & SCP_QUEUE_ALG_MASK) != SCP_QUEUE_ALG_UNRESTRICTED) return (ctl_extent_check(ooa_io, pending_io, - (lun->be_lun && - lun->be_lun->serseq == CTL_LUN_SERSEQ_ON))); + (lun->be_lun->serseq == CTL_LUN_SERSEQ_ON))); return (CTL_ACTION_PASS); case CTL_SER_EXTENTSEQ: - if (lun->be_lun && lun->be_lun->serseq != CTL_LUN_SERSEQ_OFF) + if (lun->be_lun->serseq != CTL_LUN_SERSEQ_OFF) return (ctl_extent_check_seq(ooa_io, pending_io)); return (CTL_ACTION_PASS); case CTL_SER_PASS: @@ -11288,8 +11287,7 @@ ctl_scsiio_lun_check(struct ctl_lun *lun, } if (entry->pattern & CTL_LUN_PAT_WRITE) { - if (lun->be_lun && - lun->be_lun->flags & CTL_LUN_FLAG_READONLY) { + if (lun->be_lun->flags & CTL_LUN_FLAG_READONLY) { ctl_set_hw_write_protected(ctsio); retval = 1; goto bailout; @@ -13288,8 +13286,7 @@ ctl_serseq_done(union ctl_io *io) { struct ctl_lun *lun = CTL_LUN(io);; - if (lun->be_lun == NULL || - lun->be_lun->serseq == CTL_LUN_SERSEQ_OFF) + if (lun->be_lun->serseq == CTL_LUN_SERSEQ_OFF) return; mtx_lock(&lun->lun_lock); io->io_hdr.flags |= CTL_FLAG_SERSEQ_DONE; diff --git a/sys/cam/ctl/ctl_tpc.c b/sys/cam/ctl/ctl_tpc.c index 00fb3a52b3d4..fb9cce5de258 100644 --- a/sys/cam/ctl/ctl_tpc.c +++ b/sys/cam/ctl/ctl_tpc.c @@ -759,12 +759,12 @@ tpc_resolve(struct tpc_list *list, uint16_t idx, uint32_t *ss, { if (idx == 0xffff) { - if (ss && list->lun->be_lun) + if (ss) *ss = list->lun->be_lun->blocksize; - if (pb && list->lun->be_lun) + if (pb) *pb = list->lun->be_lun->blocksize << list->lun->be_lun->pblockexp; - if (pbo && list->lun->be_lun) + if (pbo) *pbo = list->lun->be_lun->blocksize * list->lun->be_lun->pblockoff; return (list->lun->lun); diff --git a/sys/cam/ctl/ctl_tpc_local.c b/sys/cam/ctl/ctl_tpc_local.c index f88565db8355..60a8630218af 100644 --- a/sys/cam/ctl/ctl_tpc_local.c +++ b/sys/cam/ctl/ctl_tpc_local.c @@ -295,12 +295,12 @@ tpcl_resolve(struct ctl_softc *softc, int init_port, lun->lun_devid->len, &cscdid->codeset, cscdid->length + 4) == 0) { lunid = lun->lun; - if (ss && lun->be_lun) + if (ss) *ss = lun->be_lun->blocksize; - if (ps && lun->be_lun) + if (ps) *ps = lun->be_lun->blocksize << lun->be_lun->pblockexp; - if (pso && lun->be_lun) + if (pso) *pso = lun->be_lun->blocksize * lun->be_lun->pblockoff; break; From owner-dev-commits-src-branches@freebsd.org Fri Mar 5 01:23: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 C2B63561855; Fri, 5 Mar 2021 01:23:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ds93y56nfz3C6M; Fri, 5 Mar 2021 01:23: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 A269827731; Fri, 5 Mar 2021 01:23: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 1251NgCl064438; Fri, 5 Mar 2021 01:23:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1251NgtZ064436; Fri, 5 Mar 2021 01:23:42 GMT (envelope-from git) Date: Fri, 5 Mar 2021 01:23:42 GMT Message-Id: <202103050123.1251NgtZ064436@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: 7e166d608eec - stable/13 - ixl(4): Fix VLAN HW filtering MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7e166d608eecf0188bbb7edf6b3d9abffe1dfc6b 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 Mar 2021 01:23:42 -0000 The branch stable/13 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=7e166d608eecf0188bbb7edf6b3d9abffe1dfc6b commit 7e166d608eecf0188bbb7edf6b3d9abffe1dfc6b Author: Krzysztof Galazka AuthorDate: 2021-02-03 23:22:55 +0000 Commit: Eric Joyner CommitDate: 2021-03-05 01:23:18 +0000 ixl(4): Fix VLAN HW filtering X700 family of controllers has limited number of available VLAN HW filters. Driver did not handle properly a case when user assigned more VLANs to the interface which had all filters already in use. Fix that by disabling HW filtering when it is impossible to create filters for all requested VLANs. Keep track of registered VLANs using bitstring to be able to re-enable HW filtering when number of requested VLANs drops below the limit. Also switch all allocations to use M_IXL malloc type to ease detecting memory leaks in the driver. Reviewed by: erj Tested by: gowtham.kumar.ks@intel.com MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28137 (cherry picked from commit 7d4dceec103039e2b2fa90793ceeb71a8d6684aa) --- sys/dev/ixl/i40e_osdep.c | 4 +- sys/dev/ixl/iavf.h | 7 + sys/dev/ixl/iavf_vc.c | 20 +- sys/dev/ixl/if_iavf.c | 20 +- sys/dev/ixl/if_ixl.c | 81 ++++--- sys/dev/ixl/ixl.h | 49 ++-- sys/dev/ixl/ixl_iw.c | 8 +- sys/dev/ixl/ixl_pf.h | 19 +- sys/dev/ixl/ixl_pf_iflib.c | 37 +-- sys/dev/ixl/ixl_pf_iov.c | 4 +- sys/dev/ixl/ixl_pf_main.c | 551 ++++++++++++++++++++++++++++++--------------- 11 files changed, 487 insertions(+), 313 deletions(-) diff --git a/sys/dev/ixl/i40e_osdep.c b/sys/dev/ixl/i40e_osdep.c index df6848dff3f2..20eb02c85d67 100644 --- a/sys/dev/ixl/i40e_osdep.c +++ b/sys/dev/ixl/i40e_osdep.c @@ -51,14 +51,14 @@ i40e_dmamap_cb(void *arg, bus_dma_segment_t * segs, int nseg, int error) i40e_status i40e_allocate_virt_mem(struct i40e_hw *hw, struct i40e_virt_mem *mem, u32 size) { - mem->va = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); + mem->va = malloc(size, M_IXL, M_NOWAIT | M_ZERO); return (mem->va == NULL); } i40e_status i40e_free_virt_mem(struct i40e_hw *hw, struct i40e_virt_mem *mem) { - free(mem->va, M_DEVBUF); + free(mem->va, M_IXL); mem->va = NULL; return (I40E_SUCCESS); diff --git a/sys/dev/ixl/iavf.h b/sys/dev/ixl/iavf.h index e2a546f450d4..9a7716c5e5a2 100644 --- a/sys/dev/ixl/iavf.h +++ b/sys/dev/ixl/iavf.h @@ -43,6 +43,13 @@ #define IAVF_MAX_QUEUES 16 #define IAVF_AQ_TIMEOUT (1 * hz) +/* MacVlan Flags */ +#define IAVF_FILTER_USED (u16)(1 << 0) +#define IAVF_FILTER_VLAN (u16)(1 << 1) +#define IAVF_FILTER_ADD (u16)(1 << 2) +#define IAVF_FILTER_DEL (u16)(1 << 3) +#define IAVF_FILTER_MC (u16)(1 << 4) + #define IAVF_FLAG_AQ_ENABLE_QUEUES (u32)(1 << 0) #define IAVF_FLAG_AQ_DISABLE_QUEUES (u32)(1 << 1) #define IAVF_FLAG_AQ_ADD_MAC_FILTER (u32)(1 << 2) diff --git a/sys/dev/ixl/iavf_vc.c b/sys/dev/ixl/iavf_vc.c index 2a77f390faaa..ed9cc8432438 100644 --- a/sys/dev/ixl/iavf_vc.c +++ b/sys/dev/ixl/iavf_vc.c @@ -456,7 +456,7 @@ iavf_add_vlans(struct iavf_sc *sc) /* Get count of VLAN filters to add */ SLIST_FOREACH(f, sc->vlan_filters, next) { - if (f->flags & IXL_FILTER_ADD) + if (f->flags & IAVF_FILTER_ADD) cnt++; } @@ -484,9 +484,9 @@ iavf_add_vlans(struct iavf_sc *sc) /* Scan the filter array */ SLIST_FOREACH_SAFE(f, sc->vlan_filters, next, ftmp) { - if (f->flags & IXL_FILTER_ADD) { + if (f->flags & IAVF_FILTER_ADD) { bcopy(&f->vlan, &v->vlan_id[i], sizeof(u16)); - f->flags = IXL_FILTER_USED; + f->flags = IAVF_FILTER_USED; i++; } if (i == cnt) @@ -514,7 +514,7 @@ iavf_del_vlans(struct iavf_sc *sc) /* Get count of VLAN filters to delete */ SLIST_FOREACH(f, sc->vlan_filters, next) { - if (f->flags & IXL_FILTER_DEL) + if (f->flags & IAVF_FILTER_DEL) cnt++; } @@ -542,7 +542,7 @@ iavf_del_vlans(struct iavf_sc *sc) /* Scan the filter array */ SLIST_FOREACH_SAFE(f, sc->vlan_filters, next, ftmp) { - if (f->flags & IXL_FILTER_DEL) { + if (f->flags & IAVF_FILTER_DEL) { bcopy(&f->vlan, &v->vlan_id[i], sizeof(u16)); i++; SLIST_REMOVE(sc->vlan_filters, f, iavf_vlan_filter, next); @@ -575,7 +575,7 @@ iavf_add_ether_filters(struct iavf_sc *sc) /* Get count of MAC addresses to add */ SLIST_FOREACH(f, sc->mac_filters, next) { - if (f->flags & IXL_FILTER_ADD) + if (f->flags & IAVF_FILTER_ADD) cnt++; } if (cnt == 0) { /* Should not happen... */ @@ -597,9 +597,9 @@ iavf_add_ether_filters(struct iavf_sc *sc) /* Scan the filter array */ SLIST_FOREACH(f, sc->mac_filters, next) { - if (f->flags & IXL_FILTER_ADD) { + if (f->flags & IAVF_FILTER_ADD) { bcopy(f->macaddr, a->list[j].addr, ETHER_ADDR_LEN); - f->flags &= ~IXL_FILTER_ADD; + f->flags &= ~IAVF_FILTER_ADD; j++; iavf_dbg_vc(sc, "ADD: " MAC_FORMAT "\n", @@ -633,7 +633,7 @@ iavf_del_ether_filters(struct iavf_sc *sc) /* Get count of MAC addresses to delete */ SLIST_FOREACH(f, sc->mac_filters, next) { - if (f->flags & IXL_FILTER_DEL) + if (f->flags & IAVF_FILTER_DEL) cnt++; } if (cnt == 0) { @@ -655,7 +655,7 @@ iavf_del_ether_filters(struct iavf_sc *sc) /* Scan the filter array */ SLIST_FOREACH_SAFE(f, sc->mac_filters, next, f_temp) { - if (f->flags & IXL_FILTER_DEL) { + if (f->flags & IAVF_FILTER_DEL) { bcopy(f->macaddr, d->list[j].addr, ETHER_ADDR_LEN); iavf_dbg_vc(sc, "DEL: " MAC_FORMAT "\n", MAC_FORMAT_ARGS(f->macaddr)); diff --git a/sys/dev/ixl/if_iavf.c b/sys/dev/ixl/if_iavf.c index 2079e2d7306b..394656d27a2f 100644 --- a/sys/dev/ixl/if_iavf.c +++ b/sys/dev/ixl/if_iavf.c @@ -663,7 +663,7 @@ iavf_if_init(if_ctx_t ctx) iavf_send_vc_msg(sc, IAVF_FLAG_AQ_DISABLE_QUEUES); bcopy(IF_LLADDR(ifp), tmpaddr, ETHER_ADDR_LEN); - if (!cmp_etheraddr(hw->mac.addr, tmpaddr) && + if (!ixl_ether_is_equal(hw->mac.addr, tmpaddr) && (i40e_validate_mac_addr(tmpaddr) == I40E_SUCCESS)) { error = iavf_del_mac_filter(sc, hw->mac.addr); if (error == 0) @@ -1233,7 +1233,7 @@ iavf_mc_filter_apply(void *arg, struct sockaddr_dl *sdl, u_int count __unused) struct iavf_sc *sc = arg; int error; - error = iavf_add_mac_filter(sc, (u8*)LLADDR(sdl), IXL_FILTER_MC); + error = iavf_add_mac_filter(sc, (u8*)LLADDR(sdl), IAVF_FILTER_MC); return (!error); } @@ -1404,7 +1404,7 @@ iavf_if_vlan_register(if_ctx_t ctx, u16 vtag) v = malloc(sizeof(struct iavf_vlan_filter), M_IAVF, M_WAITOK | M_ZERO); SLIST_INSERT_HEAD(sc->vlan_filters, v, next); v->vlan = vtag; - v->flags = IXL_FILTER_ADD; + v->flags = IAVF_FILTER_ADD; iavf_send_vc_msg(sc, IAVF_FLAG_AQ_ADD_VLAN_FILTER); } @@ -1422,7 +1422,7 @@ iavf_if_vlan_unregister(if_ctx_t ctx, u16 vtag) SLIST_FOREACH(v, sc->vlan_filters, next) { if (v->vlan == vtag) { - v->flags = IXL_FILTER_DEL; + v->flags = IAVF_FILTER_DEL; ++i; --vsi->num_vlans; } @@ -1624,7 +1624,7 @@ iavf_find_mac_filter(struct iavf_sc *sc, u8 *macaddr) bool match = FALSE; SLIST_FOREACH(f, sc->mac_filters, next) { - if (cmp_etheraddr(f->macaddr, macaddr)) { + if (ixl_ether_is_equal(f->macaddr, macaddr)) { match = TRUE; break; } @@ -1828,9 +1828,9 @@ iavf_init_multi(struct iavf_sc *sc) /* First clear any multicast filters */ SLIST_FOREACH(f, sc->mac_filters, next) { - if ((f->flags & IXL_FILTER_USED) - && (f->flags & IXL_FILTER_MC)) { - f->flags |= IXL_FILTER_DEL; + if ((f->flags & IAVF_FILTER_USED) + && (f->flags & IAVF_FILTER_MC)) { + f->flags |= IAVF_FILTER_DEL; mcnt++; } } @@ -2034,7 +2034,7 @@ iavf_add_mac_filter(struct iavf_sc *sc, u8 *macaddr, u16 flags) MAC_FORMAT_ARGS(macaddr)); bcopy(macaddr, f->macaddr, ETHER_ADDR_LEN); - f->flags |= (IXL_FILTER_ADD | IXL_FILTER_USED); + f->flags |= (IAVF_FILTER_ADD | IAVF_FILTER_USED); f->flags |= flags; return (0); } @@ -2051,7 +2051,7 @@ iavf_del_mac_filter(struct iavf_sc *sc, u8 *macaddr) if (f == NULL) return (ENOENT); - f->flags |= IXL_FILTER_DEL; + f->flags |= IAVF_FILTER_DEL; return (0); } diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index 097d4b480891..340565d66bc8 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -127,7 +127,6 @@ static void ixl_if_vflr_handle(if_ctx_t ctx); #endif /*** Other ***/ -static u_int ixl_mc_filter_apply(void *, struct sockaddr_dl *, u_int); static void ixl_save_pf_tunables(struct ixl_pf *); static int ixl_allocate_pci_resources(struct ixl_pf *); static void ixl_setup_ssctx(struct ixl_pf *pf); @@ -862,7 +861,7 @@ ixl_if_detach(if_ctx_t ctx) ixl_pf_qmgr_destroy(&pf->qmgr); ixl_free_pci_resources(pf); - ixl_free_mac_filters(vsi); + ixl_free_filters(&vsi->ftl); INIT_DBG_DEV(dev, "end"); return (0); } @@ -937,9 +936,9 @@ ixl_if_init(if_ctx_t ctx) /* Get the latest mac address... User might use a LAA */ bcopy(IF_LLADDR(vsi->ifp), tmpaddr, ETH_ALEN); - if (!cmp_etheraddr(hw->mac.addr, tmpaddr) && + if (!ixl_ether_is_equal(hw->mac.addr, tmpaddr) && (i40e_validate_mac_addr(tmpaddr) == I40E_SUCCESS)) { - ixl_del_filter(vsi, hw->mac.addr, IXL_VLAN_ANY); + ixl_del_all_vlan_filters(vsi, hw->mac.addr); bcopy(tmpaddr, hw->mac.addr, ETH_ALEN); ret = i40e_aq_mac_address_write(hw, I40E_AQC_WRITE_TYPE_LAA_ONLY, @@ -948,7 +947,10 @@ ixl_if_init(if_ctx_t ctx) device_printf(dev, "LLA address change failed!!\n"); return; } - ixl_add_filter(vsi, hw->mac.addr, IXL_VLAN_ANY); + /* + * New filters are configured by ixl_reconfigure_filters + * at the end of ixl_init_locked. + */ } iflib_set_mac(ctx, hw->mac.addr); @@ -1385,7 +1387,7 @@ ixl_if_update_admin_status(if_ctx_t ctx) struct i40e_hw *hw = &pf->hw; u16 pending; - if (pf->state & IXL_PF_STATE_ADAPTER_RESETTING) + if (IXL_PF_IS_RESETTING(pf)) ixl_handle_empr_reset(pf); /* @@ -1418,32 +1420,22 @@ ixl_if_multi_set(if_ctx_t ctx) struct ixl_pf *pf = iflib_get_softc(ctx); struct ixl_vsi *vsi = &pf->vsi; struct i40e_hw *hw = vsi->hw; - int mcnt, flags; - int del_mcnt; + int mcnt; IOCTL_DEBUGOUT("ixl_if_multi_set: begin"); - mcnt = min(if_llmaddr_count(iflib_get_ifp(ctx)), MAX_MULTICAST_ADDR); /* Delete filters for removed multicast addresses */ - del_mcnt = ixl_del_multi(vsi); - vsi->num_macs -= del_mcnt; + ixl_del_multi(vsi, false); + mcnt = min(if_llmaddr_count(iflib_get_ifp(ctx)), MAX_MULTICAST_ADDR); if (__predict_false(mcnt == MAX_MULTICAST_ADDR)) { i40e_aq_set_vsi_multicast_promiscuous(hw, vsi->seid, TRUE, NULL); + ixl_del_multi(vsi, true); return; } - /* (re-)install filters for all mcast addresses */ - /* XXX: This bypasses filter count tracking code! */ - mcnt = if_foreach_llmaddr(iflib_get_ifp(ctx), ixl_mc_filter_apply, vsi); - if (mcnt > 0) { - vsi->num_macs += mcnt; - flags = (IXL_FILTER_ADD | IXL_FILTER_USED | IXL_FILTER_MC); - ixl_add_hw_filters(vsi, flags, mcnt); - } - ixl_dbg_filter(pf, "%s: filter mac total: %d\n", - __func__, vsi->num_macs); + ixl_add_multi(vsi); IOCTL_DEBUGOUT("ixl_if_multi_set: end"); } @@ -1661,12 +1653,35 @@ ixl_if_vlan_register(if_ctx_t ctx, u16 vtag) struct ixl_pf *pf = iflib_get_softc(ctx); struct ixl_vsi *vsi = &pf->vsi; struct i40e_hw *hw = vsi->hw; + if_t ifp = iflib_get_ifp(ctx); if ((vtag == 0) || (vtag > 4095)) /* Invalid */ return; + /* + * Keep track of registered VLANS to know what + * filters have to be configured when VLAN_HWFILTER + * capability is enabled. + */ ++vsi->num_vlans; - ixl_add_filter(vsi, hw->mac.addr, vtag); + bit_set(vsi->vlans_map, vtag); + + if ((if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER) == 0) + return; + + if (vsi->num_vlans < IXL_MAX_VLAN_FILTERS) + ixl_add_filter(vsi, hw->mac.addr, vtag); + else if (vsi->num_vlans == IXL_MAX_VLAN_FILTERS) { + /* + * There is not enough HW resources to add filters + * for all registered VLANs. Re-configure filtering + * to allow reception of all expected traffic. + */ + device_printf(vsi->dev, + "Not enough HW filters for all VLANs. VLAN HW filtering disabled"); + ixl_del_all_vlan_filters(vsi, hw->mac.addr); + ixl_add_filter(vsi, hw->mac.addr, IXL_VLAN_ANY); + } } static void @@ -1675,12 +1690,23 @@ ixl_if_vlan_unregister(if_ctx_t ctx, u16 vtag) struct ixl_pf *pf = iflib_get_softc(ctx); struct ixl_vsi *vsi = &pf->vsi; struct i40e_hw *hw = vsi->hw; + if_t ifp = iflib_get_ifp(ctx); if ((vtag == 0) || (vtag > 4095)) /* Invalid */ return; --vsi->num_vlans; - ixl_del_filter(vsi, hw->mac.addr, vtag); + bit_clear(vsi->vlans_map, vtag); + + if ((if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER) == 0) + return; + + if (vsi->num_vlans < IXL_MAX_VLAN_FILTERS) + ixl_del_filter(vsi, hw->mac.addr, vtag); + else if (vsi->num_vlans == IXL_MAX_VLAN_FILTERS) { + ixl_del_filter(vsi, hw->mac.addr, IXL_VLAN_ANY); + ixl_add_vlan_filters(vsi, hw->mac.addr); + } } static uint64_t @@ -1798,15 +1824,6 @@ ixl_if_needs_restart(if_ctx_t ctx __unused, enum iflib_restart_event event) } } -static u_int -ixl_mc_filter_apply(void *arg, struct sockaddr_dl *sdl, u_int count __unused) -{ - struct ixl_vsi *vsi = arg; - - ixl_add_mc_filter(vsi, (u8*)LLADDR(sdl)); - return (1); -} - /* * Sanity check and save off tunable values. */ diff --git a/sys/dev/ixl/ixl.h b/sys/dev/ixl/ixl.h index 65e92c470a6c..3eb0fa4f6b5a 100644 --- a/sys/dev/ixl/ixl.h +++ b/sys/dev/ixl/ixl.h @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -187,15 +188,15 @@ #define IXL_BULK_LATENCY 2 /* MacVlan Flags */ -#define IXL_FILTER_USED (u16)(1 << 0) -#define IXL_FILTER_VLAN (u16)(1 << 1) -#define IXL_FILTER_ADD (u16)(1 << 2) -#define IXL_FILTER_DEL (u16)(1 << 3) -#define IXL_FILTER_MC (u16)(1 << 4) +#define IXL_FILTER_VLAN (u16)(1 << 0) +#define IXL_FILTER_MC (u16)(1 << 1) /* used in the vlan field of the filter when not a vlan */ #define IXL_VLAN_ANY -1 +/* Maximum number of MAC/VLAN filters supported by HW */ +#define IXL_MAX_VLAN_FILTERS 256 + #define CSUM_OFFLOAD_IPV4 (CSUM_IP|CSUM_TCP|CSUM_UDP|CSUM_SCTP) #define CSUM_OFFLOAD_IPV6 (CSUM_TCP_IPV6|CSUM_UDP_IPV6|CSUM_SCTP_IPV6) #define CSUM_OFFLOAD (CSUM_OFFLOAD_IPV4|CSUM_OFFLOAD_IPV6|CSUM_TSO) @@ -303,16 +304,18 @@ /* For stats sysctl naming */ #define IXL_QUEUE_NAME_LEN 32 +MALLOC_DECLARE(M_IXL); + #define IXL_DEV_ERR(_dev, _format, ...) \ device_printf(_dev, "%s: " _format " (%s:%d)\n", __func__, ##__VA_ARGS__, __FILE__, __LINE__) /* ***************************************************************************** * vendor_info_array - * + * * This array contains the list of Subvendor/Subdevice IDs on which the driver * should load. - * + * ***************************************************************************** */ typedef struct _ixl_vendor_info_t { @@ -328,7 +331,7 @@ typedef struct _ixl_vendor_info_t { ** addresses, vlans, and mac filters all use it. */ struct ixl_mac_filter { - SLIST_ENTRY(ixl_mac_filter) next; + LIST_ENTRY(ixl_mac_filter) ftle; u8 macaddr[ETHER_ADDR_LEN]; s16 vlan; u16 flags; @@ -414,7 +417,7 @@ struct ixl_rx_queue { /* ** Virtual Station Interface */ -SLIST_HEAD(ixl_ftl_head, ixl_mac_filter); +LIST_HEAD(ixl_ftl_head, ixl_mac_filter); struct ixl_vsi { if_ctx_t ctx; if_softc_ctx_t shared; @@ -452,6 +455,8 @@ struct ixl_vsi { /* Contains readylist & stat counter id */ struct i40e_aqc_vsi_properties_data info; +#define IXL_VLANS_MAP_LEN EVL_VLID_MASK + 1 + bitstr_t bit_decl(vlans_map, IXL_VLANS_MAP_LEN); u16 num_vlans; /* Per-VSI stats from hardware */ @@ -478,32 +483,16 @@ struct ixl_vsi { struct sysctl_ctx_list sysctl_ctx; }; -/* -** Creates new filter with given MAC address and VLAN ID -*/ -static inline struct ixl_mac_filter * -ixl_new_filter(struct ixl_vsi *vsi, const u8 *macaddr, s16 vlan) -{ - struct ixl_mac_filter *f; - - /* create a new empty filter */ - f = malloc(sizeof(struct ixl_mac_filter), - M_DEVBUF, M_NOWAIT | M_ZERO); - if (f) { - SLIST_INSERT_HEAD(&vsi->ftl, f, next); - bcopy(macaddr, f->macaddr, ETHER_ADDR_LEN); - f->vlan = vlan; - f->flags |= (IXL_FILTER_ADD | IXL_FILTER_USED); - } - - return (f); -} +struct ixl_add_maddr_arg { + struct ixl_ftl_head to_add; + struct ixl_vsi *vsi; +}; /* ** Compare two ethernet addresses */ static inline bool -cmp_etheraddr(const u8 *ea1, const u8 *ea2) +ixl_ether_is_equal(const u8 *ea1, const u8 *ea2) { return (bcmp(ea1, ea2, ETHER_ADDR_LEN) == 0); } diff --git a/sys/dev/ixl/ixl_iw.c b/sys/dev/ixl/ixl_iw.c index 6557e9dca4b3..5e2d7cfcb30b 100644 --- a/sys/dev/ixl/ixl_iw.c +++ b/sys/dev/ixl/ixl_iw.c @@ -238,7 +238,7 @@ ixl_iw_pf_attach(struct ixl_pf *pf) } pf_entry = malloc(sizeof(struct ixl_iw_pf_entry), - M_DEVBUF, M_NOWAIT | M_ZERO); + M_IXL, M_NOWAIT | M_ZERO); if (pf_entry == NULL) { device_printf(pf->dev, "%s: failed to allocate memory to attach new PF\n", @@ -289,7 +289,7 @@ ixl_iw_pf_detach(struct ixl_pf *pf) goto out; } LIST_REMOVE(pf_entry, node); - free(pf_entry, M_DEVBUF); + free(pf_entry, M_IXL); ixl_iw_ref_cnt--; out: @@ -414,7 +414,7 @@ ixl_iw_register(struct ixl_iw_ops *ops) taskqueue_start_threads(&ixl_iw.tq, 1, PI_NET, "ixl iw"); ixl_iw.ops = malloc(sizeof(struct ixl_iw_ops), - M_DEVBUF, M_NOWAIT | M_ZERO); + M_IXL, M_NOWAIT | M_ZERO); if (ixl_iw.ops == NULL) { printf("%s: failed to allocate memory\n", __func__); taskqueue_free(ixl_iw.tq); @@ -481,7 +481,7 @@ ixl_iw_unregister(void) taskqueue_drain(ixl_iw.tq, &pf_entry->iw_task); taskqueue_free(ixl_iw.tq); ixl_iw.tq = NULL; - free(ixl_iw.ops, M_DEVBUF); + free(ixl_iw.ops, M_IXL); ixl_iw.ops = NULL; return (0); diff --git a/sys/dev/ixl/ixl_pf.h b/sys/dev/ixl/ixl_pf.h index 0521ae5a4bc5..c3fbdc91d358 100644 --- a/sys/dev/ixl/ixl_pf.h +++ b/sys/dev/ixl/ixl_pf.h @@ -78,7 +78,7 @@ enum ixl_i2c_access_method_t { /* Used in struct ixl_pf's state field */ enum ixl_pf_state { IXL_PF_STATE_RECOVERY_MODE = (1 << 0), - IXL_PF_STATE_ADAPTER_RESETTING = (1 << 1), + IXL_PF_STATE_RESETTING = (1 << 1), IXL_PF_STATE_MDD_PENDING = (1 << 2), IXL_PF_STATE_PF_RESET_REQ = (1 << 3), IXL_PF_STATE_VF_RESET_REQ = (1 << 4), @@ -93,6 +93,8 @@ enum ixl_pf_state { #define IXL_PF_IN_RECOVERY_MODE(pf) \ ((atomic_load_acq_32(&pf->state) & IXL_PF_STATE_RECOVERY_MODE) != 0) +#define IXL_PF_IS_RESETTING(pf) \ + ((atomic_load_acq_32(&pf->state) & IXL_PF_STATE_RESETTING) != 0) struct ixl_vf { struct ixl_vsi vsi; @@ -258,8 +260,6 @@ struct ixl_pf { "\t1 - Enable (VEB)\n" \ "Enabling this will allow VFs in separate VMs to communicate over the hardware bridge." -MALLOC_DECLARE(M_IXL); - /*** Functions / Macros ***/ /* Adjust the level here to 10 or over to print stats messages */ #define I40E_VC_DEBUG(p, level, ...) \ @@ -367,6 +367,8 @@ void ixl_set_queue_tx_itr(struct ixl_tx_queue *); void ixl_add_filter(struct ixl_vsi *, const u8 *, s16 vlan); void ixl_del_filter(struct ixl_vsi *, const u8 *, s16 vlan); +void ixl_add_vlan_filters(struct ixl_vsi *, const u8 *); +void ixl_del_all_vlan_filters(struct ixl_vsi *, const u8 *); void ixl_reconfigure_filters(struct ixl_vsi *vsi); int ixl_disable_rings(struct ixl_pf *, struct ixl_vsi *, struct ixl_pf_qtag *); @@ -391,16 +393,15 @@ void ixl_enable_intr(struct ixl_vsi *); void ixl_disable_rings_intr(struct ixl_vsi *); void ixl_set_promisc(struct ixl_vsi *); void ixl_add_multi(struct ixl_vsi *); -int ixl_del_multi(struct ixl_vsi *); +void ixl_del_multi(struct ixl_vsi *, bool); void ixl_setup_vlan_filters(struct ixl_vsi *); void ixl_init_filters(struct ixl_vsi *); -void ixl_add_hw_filters(struct ixl_vsi *, int, int); -void ixl_del_hw_filters(struct ixl_vsi *, int); +void ixl_free_filters(struct ixl_ftl_head *); +void ixl_add_hw_filters(struct ixl_vsi *, struct ixl_ftl_head *, int); +void ixl_del_hw_filters(struct ixl_vsi *, struct ixl_ftl_head *, int); void ixl_del_default_hw_filters(struct ixl_vsi *); struct ixl_mac_filter * - ixl_find_filter(struct ixl_vsi *, const u8 *, s16); -void ixl_add_mc_filter(struct ixl_vsi *, u8 *); -void ixl_free_mac_filters(struct ixl_vsi *vsi); + ixl_find_filter(struct ixl_ftl_head *, const u8 *, s16); void ixl_update_vsi_stats(struct ixl_vsi *); void ixl_vsi_reset_stats(struct ixl_vsi *); diff --git a/sys/dev/ixl/ixl_pf_iflib.c b/sys/dev/ixl/ixl_pf_iflib.c index 4351f65ee5ab..2b3d035fbcfe 100644 --- a/sys/dev/ixl/ixl_pf_iflib.c +++ b/sys/dev/ixl/ixl_pf_iflib.c @@ -185,7 +185,7 @@ ixl_msix_adminq(void *arg) } device_printf(dev, "Reset Requested! (%s)\n", reset_type); /* overload admin queue task to check reset progress */ - atomic_set_int(&pf->state, IXL_PF_STATE_ADAPTER_RESETTING); + atomic_set_int(&pf->state, IXL_PF_STATE_RESETTING); do_task = TRUE; } @@ -866,41 +866,6 @@ ixl_set_rss_hlut(struct ixl_pf *pf) } } -/* -** This routine updates vlan filters, called by init -** it scans the filter table and then updates the hw -** after a soft reset. -*/ -void -ixl_setup_vlan_filters(struct ixl_vsi *vsi) -{ - struct ixl_mac_filter *f; - int cnt = 0, flags; - - if (vsi->num_vlans == 0) - return; - /* - ** Scan the filter list for vlan entries, - ** mark them for addition and then call - ** for the AQ update. - */ - SLIST_FOREACH(f, &vsi->ftl, next) { - if (f->flags & IXL_FILTER_VLAN) { - f->flags |= - (IXL_FILTER_ADD | - IXL_FILTER_USED); - cnt++; - } - } - if (cnt == 0) { - printf("setup vlan: no filters found!\n"); - return; - } - flags = IXL_FILTER_VLAN; - flags |= (IXL_FILTER_ADD | IXL_FILTER_USED); - ixl_add_hw_filters(vsi, flags, cnt); -} - /* For PF VSI only */ int ixl_enable_rings(struct ixl_vsi *vsi) diff --git a/sys/dev/ixl/ixl_pf_iov.c b/sys/dev/ixl/ixl_pf_iov.c index 92e434eab9fc..c3cf90d1c4b5 100644 --- a/sys/dev/ixl/ixl_pf_iov.c +++ b/sys/dev/ixl/ixl_pf_iov.c @@ -1025,7 +1025,7 @@ ixl_vf_mac_valid(struct ixl_vf *vf, const uint8_t *addr) * is not its assigned MAC. */ if (!(vf->vf_flags & VF_FLAG_SET_MAC_CAP) && - !(ETHER_IS_MULTICAST(addr) || cmp_etheraddr(addr, vf->mac))) + !(ETHER_IS_MULTICAST(addr) || !ixl_ether_is_equal(addr, vf->mac))) return (EPERM); return (0); @@ -1717,7 +1717,7 @@ ixl_if_iov_uninit(if_ctx_t ctx) if (pf->vfs[i].vsi.seid != 0) i40e_aq_delete_element(hw, pf->vfs[i].vsi.seid, NULL); ixl_pf_qmgr_release(&pf->qmgr, &pf->vfs[i].qtag); - ixl_free_mac_filters(&pf->vfs[i].vsi); + ixl_free_filters(&pf->vfs[i].vsi.ftl); ixl_dbg_iov(pf, "VF %d: %d released\n", i, pf->vfs[i].qtag.num_allocated); ixl_dbg_iov(pf, "Unallocated total: %d\n", ixl_pf_qmgr_get_num_free(&pf->qmgr)); diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index eddd4dfaab0d..2714b1a0e6d8 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -326,7 +326,7 @@ ixl_get_hw_capabilities(struct ixl_pf *pf) len = 40 * sizeof(struct i40e_aqc_list_capabilities_element_resp); retry: if (!(buf = (struct i40e_aqc_list_capabilities_element_resp *) - malloc(len, M_DEVBUF, M_NOWAIT | M_ZERO))) { + malloc(len, M_IXL, M_NOWAIT | M_ZERO))) { device_printf(dev, "Unable to allocate cap memory\n"); return (ENOMEM); } @@ -334,7 +334,7 @@ retry: /* This populates the hw struct */ status = i40e_aq_discover_capabilities(hw, buf, len, &needed, i40e_aqc_opc_list_func_capabilities, NULL); - free(buf, M_DEVBUF); + free(buf, M_IXL); if ((pf->hw.aq.asq_last_status == I40E_AQ_RC_ENOMEM) && (again == TRUE)) { /* retry once with a larger buffer */ @@ -452,12 +452,67 @@ err_out: return (status); } +/* +** Creates new filter with given MAC address and VLAN ID +*/ +static struct ixl_mac_filter * +ixl_new_filter(struct ixl_ftl_head *headp, const u8 *macaddr, s16 vlan) +{ + struct ixl_mac_filter *f; + + /* create a new empty filter */ + f = malloc(sizeof(struct ixl_mac_filter), + M_IXL, M_NOWAIT | M_ZERO); + if (f) { + LIST_INSERT_HEAD(headp, f, ftle); + bcopy(macaddr, f->macaddr, ETHER_ADDR_LEN); + f->vlan = vlan; + } + + return (f); +} + +/** + * ixl_free_filters - Free all filters in given list + * headp - pointer to list head + * + * Frees memory used by each entry in the list. + * Does not remove filters from HW. + */ +void +ixl_free_filters(struct ixl_ftl_head *headp) +{ + struct ixl_mac_filter *f, *nf; + + f = LIST_FIRST(headp); + while (f != NULL) { + nf = LIST_NEXT(f, ftle); + free(f, M_IXL); + f = nf; + } + + LIST_INIT(headp); +} + static u_int ixl_add_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) { - struct ixl_vsi *vsi = arg; + struct ixl_add_maddr_arg *ama = arg; + struct ixl_vsi *vsi = ama->vsi; + const u8 *macaddr = (u8*)LLADDR(sdl); + struct ixl_mac_filter *f; - ixl_add_mc_filter(vsi, (u8*)LLADDR(sdl)); + /* Does one already exist */ + f = ixl_find_filter(&vsi->ftl, macaddr, IXL_VLAN_ANY); + if (f != NULL) + return (0); + + f = ixl_new_filter(&ama->to_add, macaddr, IXL_VLAN_ANY); + if (f == NULL) { + device_printf(vsi->dev, "WARNING: no filter available!!\n"); + return (0); + } + f->flags |= IXL_FILTER_MC; return (1); } @@ -473,28 +528,26 @@ ixl_add_multi(struct ixl_vsi *vsi) { struct ifnet *ifp = vsi->ifp; struct i40e_hw *hw = vsi->hw; - int mcnt = 0, flags; + int mcnt = 0; + struct ixl_add_maddr_arg cb_arg; IOCTL_DEBUGOUT("ixl_add_multi: begin"); - /* - ** First just get a count, to decide if we - ** we simply use multicast promiscuous. - */ mcnt = if_llmaddr_count(ifp); if (__predict_false(mcnt >= MAX_MULTICAST_ADDR)) { - /* delete existing MC filters */ - ixl_del_hw_filters(vsi, mcnt); i40e_aq_set_vsi_multicast_promiscuous(hw, vsi->seid, TRUE, NULL); + /* delete all existing MC filters */ + ixl_del_multi(vsi, true); return; } - mcnt = if_foreach_llmaddr(ifp, ixl_add_maddr, vsi); - if (mcnt > 0) { - flags = (IXL_FILTER_ADD | IXL_FILTER_USED | IXL_FILTER_MC); - ixl_add_hw_filters(vsi, flags, mcnt); - } + cb_arg.vsi = vsi; + LIST_INIT(&cb_arg.to_add); + + mcnt = if_foreach_llmaddr(ifp, ixl_add_maddr, &cb_arg); + if (mcnt > 0) + ixl_add_hw_filters(vsi, &cb_arg.to_add, mcnt); IOCTL_DEBUGOUT("ixl_add_multi: end"); } @@ -504,34 +557,36 @@ ixl_match_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) { struct ixl_mac_filter *f = arg; - if (cmp_etheraddr(f->macaddr, (u8 *)LLADDR(sdl))) + if (ixl_ether_is_equal(f->macaddr, (u8 *)LLADDR(sdl))) return (1); else return (0); } -int -ixl_del_multi(struct ixl_vsi *vsi) +void +ixl_del_multi(struct ixl_vsi *vsi, bool all) { + struct ixl_ftl_head to_del; struct ifnet *ifp = vsi->ifp; - struct ixl_mac_filter *f; + struct ixl_mac_filter *f, *fn; int mcnt = 0; IOCTL_DEBUGOUT("ixl_del_multi: begin"); + LIST_INIT(&to_del); /* Search for removed multicast addresses */ - SLIST_FOREACH(f, &vsi->ftl, next) - if ((f->flags & IXL_FILTER_USED) && - (f->flags & IXL_FILTER_MC) && - (if_foreach_llmaddr(ifp, ixl_match_maddr, f) == 0)) { - f->flags |= IXL_FILTER_DEL; - mcnt++; - } + LIST_FOREACH_SAFE(f, &vsi->ftl, ftle, fn) { + if ((f->flags & IXL_FILTER_MC) == 0 || + (!all && (if_foreach_llmaddr(ifp, ixl_match_maddr, f) == 0))) + continue; - if (mcnt > 0) - ixl_del_hw_filters(vsi, mcnt); + LIST_REMOVE(f, ftle); + LIST_INSERT_HEAD(&to_del, f, ftle); + mcnt++; + } - return (mcnt); + if (mcnt > 0) + ixl_del_hw_filters(vsi, &to_del, mcnt); } void @@ -738,20 +793,6 @@ ixl_switch_config(struct ixl_pf *pf) return (ret); } -void -ixl_free_mac_filters(struct ixl_vsi *vsi) -{ - struct ixl_mac_filter *f; - - while (!SLIST_EMPTY(&vsi->ftl)) { - f = SLIST_FIRST(&vsi->ftl); - SLIST_REMOVE_HEAD(&vsi->ftl, next); - free(f, M_DEVBUF); - } - - vsi->num_hw_filters = 0; -} - void ixl_vsi_add_sysctls(struct ixl_vsi * vsi, const char * sysctl_name, bool queues_sysctls) { @@ -1019,7 +1060,7 @@ ixl_init_filters(struct ixl_vsi *vsi) ixl_dbg_filter(pf, "%s: start\n", __func__); /* Initialize mac filter list for VSI */ - SLIST_INIT(&vsi->ftl); + LIST_INIT(&vsi->ftl); vsi->num_hw_filters = 0; /* Receive broadcast Ethernet frames */ @@ -1045,30 +1086,35 @@ ixl_init_filters(struct ixl_vsi *vsi) #endif } -/* -** This routine adds mulicast filters -*/ void -ixl_add_mc_filter(struct ixl_vsi *vsi, u8 *macaddr) +ixl_reconfigure_filters(struct ixl_vsi *vsi) { - struct ixl_mac_filter *f; + struct i40e_hw *hw = vsi->hw; + struct ixl_ftl_head tmp; + int cnt; - /* Does one already exist */ - f = ixl_find_filter(vsi, macaddr, IXL_VLAN_ANY); - if (f != NULL) - return; + /* + * The ixl_add_hw_filters function adds filters configured + * in HW to a list in VSI. Move all filters to a temporary + * list to avoid corrupting it by concatenating to itself. + */ + LIST_INIT(&tmp); + LIST_CONCAT(&tmp, &vsi->ftl, ixl_mac_filter, ftle); + cnt = vsi->num_hw_filters; + vsi->num_hw_filters = 0; - f = ixl_new_filter(vsi, macaddr, IXL_VLAN_ANY); - if (f != NULL) - f->flags |= IXL_FILTER_MC; - else - printf("WARNING: no filter available!!\n"); -} + ixl_add_hw_filters(vsi, &tmp, cnt); -void -ixl_reconfigure_filters(struct ixl_vsi *vsi) -{ - ixl_add_hw_filters(vsi, IXL_FILTER_USED, vsi->num_macs); + /* Filter could be removed if MAC address was changed */ + ixl_add_filter(vsi, hw->mac.addr, IXL_VLAN_ANY); + + if ((if_getcapenable(vsi->ifp) & IFCAP_VLAN_HWFILTER) == 0) + return; + /* + * VLAN HW filtering is enabled, make sure that filters + * for all registered VLAN tags are configured + */ + ixl_add_vlan_filters(vsi, hw->mac.addr); } /* @@ -1082,82 +1128,205 @@ ixl_add_filter(struct ixl_vsi *vsi, const u8 *macaddr, s16 vlan) struct ixl_mac_filter *f, *tmp; struct ixl_pf *pf; device_t dev; + struct ixl_ftl_head to_add; + int to_add_cnt; *** 551 LINES SKIPPED *** From owner-dev-commits-src-branches@freebsd.org Fri Mar 5 01:23: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 DBF005619CA; Fri, 5 Mar 2021 01:23: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 4Ds93z5ww9z3BqX; Fri, 5 Mar 2021 01:23: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 BE34A27645; Fri, 5 Mar 2021 01:23: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 1251NhbL064457; Fri, 5 Mar 2021 01:23:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1251Nh1t064456; Fri, 5 Mar 2021 01:23:43 GMT (envelope-from git) Date: Fri, 5 Mar 2021 01:23:43 GMT Message-Id: <202103050123.1251Nh1t064456@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: 8fa11f892256 - stable/13 - ix(4): Report RX errors as sum of all RX error counters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8fa11f89225695c185a8a92c7530e270e77552f8 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 Mar 2021 01:23:43 -0000 The branch stable/13 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=8fa11f89225695c185a8a92c7530e270e77552f8 commit 8fa11f89225695c185a8a92c7530e270e77552f8 Author: Piotr Pietruszewski AuthorDate: 2021-03-03 01:21:58 +0000 Commit: Eric Joyner CommitDate: 2021-03-05 01:23:18 +0000 ix(4): Report RX errors as sum of all RX error counters HW keeps track of RX errors using several counters, each for specific type of errors. Report RX errors to OS as sum of all those counters: CRC errors, illegal bytes, checksum, length, undersize, fragment, oversize and jabber errors. Also, add new "rx_errs" sysctl in the dev.ix.N.mac_stats tree. This is to provide an another way to display the sum of RX errors. Signed-off-by: Piotr Pietruszewski Reviewed By: erj Tested By: gowtham.kumar.ks@intel.com Sponsored By: Intel Corporation Differential Revision: https://reviews.freebsd.org/D27191 (cherry picked from commit afb1aa4e6df245d38fd2ba683fa521d5dabe8392) --- sys/dev/ixgbe/if_ix.c | 19 ++++++++++++++++++- sys/dev/ixgbe/ixgbe.h | 12 ++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 7eb32077f8b0..9f3674cdab5d 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -1531,7 +1531,22 @@ ixgbe_update_stats_counters(struct adapter *adapter) IXGBE_SET_OMCASTS(adapter, stats->mptc); IXGBE_SET_COLLISIONS(adapter, 0); IXGBE_SET_IQDROPS(adapter, total_missed_rx); - IXGBE_SET_IERRORS(adapter, stats->crcerrs + stats->rlec); + + /* + * Aggregate following types of errors as RX errors: + * - CRC error count, + * - illegal byte error count, + * - checksum error count, + * - missed packets count, + * - length error count, + * - undersized packets count, + * - fragmented packets count, + * - oversized packets count, + * - jabber count. + */ + IXGBE_SET_IERRORS(adapter, stats->crcerrs + stats->illerrc + stats->xec + + stats->mpc[0] + stats->rlec + stats->ruc + stats->rfc + stats->roc + + stats->rjc); } /* ixgbe_update_stats_counters */ /************************************************************************ @@ -1621,6 +1636,8 @@ ixgbe_add_hw_stats(struct adapter *adapter) CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "MAC Statistics"); stat_list = SYSCTL_CHILDREN(stat_node); + SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "rx_errs", + CTLFLAG_RD, &adapter->ierrors, IXGBE_SYSCTL_DESC_RX_ERRS); SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "crc_errs", CTLFLAG_RD, &stats->crcerrs, "CRC Errors"); SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "ill_errs", diff --git a/sys/dev/ixgbe/ixgbe.h b/sys/dev/ixgbe/ixgbe.h index 1502c7fb866e..30dd1d5368fb 100644 --- a/sys/dev/ixgbe/ixgbe.h +++ b/sys/dev/ixgbe/ixgbe.h @@ -536,6 +536,18 @@ struct adapter { "\t2 - tx pause\n" \ "\t3 - tx and rx pause" +#define IXGBE_SYSCTL_DESC_RX_ERRS \ + "\nSum of the following RX errors counters:\n" \ + " * CRC errors,\n" \ + " * illegal byte error count,\n" \ + " * checksum error count,\n" \ + " * missed packet count,\n" \ + " * length error count,\n" \ + " * undersized packets count,\n" \ + " * fragmented packets count,\n" \ + " * oversized packets count,\n" \ + " * jabber count." + /* Workaround to make 8.0 buildable */ #if __FreeBSD_version >= 800000 && __FreeBSD_version < 800504 static __inline int From owner-dev-commits-src-branches@freebsd.org Fri Mar 5 01:23: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 3CB5D561C1D; Fri, 5 Mar 2021 01:23: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 4Ds9412K6gz3C6X; Fri, 5 Mar 2021 01:23: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 F1CDA2786E; Fri, 5 Mar 2021 01:23: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 1251NiER064476; Fri, 5 Mar 2021 01:23:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1251NilY064475; Fri, 5 Mar 2021 01:23:44 GMT (envelope-from git) Date: Fri, 5 Mar 2021 01:23:44 GMT Message-Id: <202103050123.1251NilY064475@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: b149f7c23d13 - stable/13 - ixl(4): Report RX errors as sum of all RX error counters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b149f7c23d13e73b92c2bf8c3691e3e1ebd833c1 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 Mar 2021 01:23:46 -0000 The branch stable/13 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=b149f7c23d13e73b92c2bf8c3691e3e1ebd833c1 commit b149f7c23d13e73b92c2bf8c3691e3e1ebd833c1 Author: Krzysztof Galazka AuthorDate: 2021-03-03 01:33:11 +0000 Commit: Eric Joyner CommitDate: 2021-03-05 01:23:18 +0000 ixl(4): Report RX errors as sum of all RX error counters HW keeps track of RX errors using several counters, each for specific type of errors. Report RX errors to OS as sum of all those counters: CRC errors, illegal bytes, checksum, length, undersize, fragment, oversize and jabber errors. There is no HW counter for frames with invalid L3/L4 checksums so add a SW one. Also add a "rx_errors" sysctl with a copy of netstat IERRORS counter value to make it easier accessible from scripts. Reviewed By: erj Tested By: gowtham.kumar.ks@intel.com Sponsored By: Intel Corporation Differential Revision: https://reviews.freebsd.org/D27639 (cherry picked from commit 9f99061ef9c95b171fc92d34026222bb5e052337) --- sys/dev/ixl/ixl.h | 1 + sys/dev/ixl/ixl_pf_main.c | 15 +++++++++++++-- sys/dev/ixl/ixl_txrx.c | 16 +++++++++------- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/sys/dev/ixl/ixl.h b/sys/dev/ixl/ixl.h index 3eb0fa4f6b5a..9828760e4ea6 100644 --- a/sys/dev/ixl/ixl.h +++ b/sys/dev/ixl/ixl.h @@ -390,6 +390,7 @@ struct rx_ring { u64 rx_packets; u64 rx_bytes; u64 desc_errs; + u64 csum_errs; }; /* diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index 2714b1a0e6d8..070ddaef522e 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -808,6 +808,11 @@ ixl_vsi_add_sysctls(struct ixl_vsi * vsi, const char * sysctl_name, bool queues_ vsi_list = SYSCTL_CHILDREN(vsi->vsi_node); ixl_add_sysctls_eth_stats(&vsi->sysctl_ctx, vsi_list, &vsi->eth_stats); + /* Copy of netstat RX errors counter for validation purposes */ + SYSCTL_ADD_UQUAD(&vsi->sysctl_ctx, vsi_list, OID_AUTO, "rx_errors", + CTLFLAG_RD, &vsi->ierrors, + "RX packet errors"); + if (queues_sysctls) ixl_vsi_add_queues_stats(vsi, &vsi->sysctl_ctx); } @@ -2183,7 +2188,7 @@ ixl_update_vsi_stats(struct ixl_vsi *vsi) struct ixl_pf *pf; struct ifnet *ifp; struct i40e_eth_stats *es; - u64 tx_discards; + u64 tx_discards, csum_errs; struct i40e_hw_port_stats *nsd; @@ -2196,6 +2201,11 @@ ixl_update_vsi_stats(struct ixl_vsi *vsi) tx_discards = es->tx_discards + nsd->tx_dropped_link_down; + csum_errs = 0; + for (int i = 0; i < vsi->num_rx_queues; i++) + csum_errs += vsi->rx_queues[i].rxr.csum_errs; + nsd->checksum_error = csum_errs; + /* Update ifnet stats */ IXL_SET_IPACKETS(vsi, es->rx_unicast + es->rx_multicast + @@ -2209,7 +2219,8 @@ ixl_update_vsi_stats(struct ixl_vsi *vsi) IXL_SET_OMCASTS(vsi, es->tx_multicast); IXL_SET_IERRORS(vsi, nsd->crc_errors + nsd->illegal_bytes + - nsd->rx_undersize + nsd->rx_oversize + nsd->rx_fragments + + nsd->checksum_error + nsd->rx_length_errors + + nsd->rx_undersize + nsd->rx_fragments + nsd->rx_oversize + nsd->rx_jabber); IXL_SET_OERRORS(vsi, es->tx_errors); IXL_SET_IQDROPS(vsi, es->rx_discards + nsd->eth.rx_discards); diff --git a/sys/dev/ixl/ixl_txrx.c b/sys/dev/ixl/ixl_txrx.c index e589bb8392cd..bdd3cb8725f8 100644 --- a/sys/dev/ixl/ixl_txrx.c +++ b/sys/dev/ixl/ixl_txrx.c @@ -51,7 +51,7 @@ #endif /* Local Prototypes */ -static void ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype); +static u8 ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype); static int ixl_isc_txd_encap(void *arg, if_pkt_info_t pi); static void ixl_isc_txd_flush(void *arg, uint16_t txqid, qidx_t pidx); @@ -720,7 +720,7 @@ ixl_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) rxr->rx_packets++; if ((if_getcapenable(vsi->ifp) & IFCAP_RXCSUM) != 0) - ixl_rx_checksum(ri, status, error, ptype); + rxr->csum_errs += ixl_rx_checksum(ri, status, error, ptype); ri->iri_flowid = le32toh(cur->wb.qword0.hi_dword.rss); ri->iri_rsstype = ixl_ptype_to_hash(ptype); ri->iri_vtag = vtag; @@ -737,7 +737,7 @@ ixl_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) * doesn't spend time verifying the checksum. * *********************************************************************/ -static void +static u8 ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype) { struct i40e_rx_ptype_decoded decoded; @@ -746,7 +746,7 @@ ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype) /* No L3 or L4 checksum was calculated */ if (!(status & (1 << I40E_RX_DESC_STATUS_L3L4P_SHIFT))) - return; + return (0); decoded = decode_rx_desc_ptype(ptype); @@ -756,7 +756,7 @@ ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype) if (status & (1 << I40E_RX_DESC_STATUS_IPV6EXADD_SHIFT)) { ri->iri_csum_flags = 0; - return; + return (1); } } @@ -764,17 +764,19 @@ ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype) /* IPv4 checksum error */ if (error & (1 << I40E_RX_DESC_ERROR_IPE_SHIFT)) - return; + return (1); ri->iri_csum_flags |= CSUM_L3_VALID; ri->iri_csum_flags |= CSUM_L4_CALC; /* L4 checksum error */ if (error & (1 << I40E_RX_DESC_ERROR_L4E_SHIFT)) - return; + return (1); ri->iri_csum_flags |= CSUM_L4_VALID; ri->iri_csum_data |= htons(0xffff); + + return (0); } /* Set Report Status queue fields to 0 */ From owner-dev-commits-src-branches@freebsd.org Fri Mar 5 01:23: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 08A53561C9B; Fri, 5 Mar 2021 01:23: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 4Ds9432RFWz3C9F; Fri, 5 Mar 2021 01:23:46 +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 140DE276E5; Fri, 5 Mar 2021 01:23: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 1251NjLk064497; Fri, 5 Mar 2021 01:23:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1251Nj0T064496; Fri, 5 Mar 2021 01:23:45 GMT (envelope-from git) Date: Fri, 5 Mar 2021 01:23:45 GMT Message-Id: <202103050123.1251Nj0T064496@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: 2b94bda05a6d - stable/13 - ixl(4): Add ability to control link state on ifconfig down MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2b94bda05a6d43e89c4a785c0f1cd569a41cb200 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 Mar 2021 01:23:48 -0000 The branch stable/13 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=2b94bda05a6d43e89c4a785c0f1cd569a41cb200 commit 2b94bda05a6d43e89c4a785c0f1cd569a41cb200 Author: Krzysztof Galazka AuthorDate: 2021-03-03 01:38:51 +0000 Commit: Eric Joyner CommitDate: 2021-03-05 01:23:19 +0000 ixl(4): Add ability to control link state on ifconfig down Add sysctl link_active_on_if_down, which allows user to control if interface is kept in active state when it is brought down with ifconfig. Set it to enabled by default to preserve backwards compatibility. Reviewed by: erj Tested by: gowtham.kumar.ks@intel.com Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D28028 (cherry picked from commit 21802a127d83e8a8c721d69b697e7ddb223d7797) --- sys/dev/ixl/if_ixl.c | 18 +++++++ sys/dev/ixl/ixl_pf.h | 7 +++ sys/dev/ixl/ixl_pf_iflib.c | 2 + sys/dev/ixl/ixl_pf_main.c | 128 ++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 154 insertions(+), 1 deletion(-) diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index 340565d66bc8..a79648de274f 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -770,6 +770,12 @@ ixl_if_attach_post(if_ctx_t ctx) ixl_update_stats_counters(pf); ixl_add_hw_stats(pf); + /* + * Driver may have been reloaded. Ensure that the link state + * is consistent with current settings. + */ + ixl_set_link(pf, (pf->state & IXL_PF_STATE_LINK_ACTIVE_ON_DOWN) != 0); + hw->phy.get_link_info = true; i40e_get_link_status(hw, &pf->link_up); ixl_update_link_status(pf); @@ -961,6 +967,8 @@ ixl_if_init(if_ctx_t ctx) return; } + ixl_set_link(pf, true); + /* Reconfigure multicast filters in HW */ ixl_if_multi_set(ctx); @@ -1003,6 +1011,7 @@ void ixl_if_stop(if_ctx_t ctx) { struct ixl_pf *pf = iflib_get_softc(ctx); + struct ifnet *ifp = iflib_get_ifp(ctx); struct ixl_vsi *vsi = &pf->vsi; INIT_DEBUGOUT("ixl_if_stop: begin\n"); @@ -1019,6 +1028,15 @@ ixl_if_stop(if_ctx_t ctx) ixl_disable_rings_intr(vsi); ixl_disable_rings(pf, vsi, &pf->qtag); + + /* + * Don't set link state if only reconfiguring + * e.g. on MTU change. + */ + if ((if_getflags(ifp) & IFF_UP) == 0 && + (atomic_load_acq_32(&pf->state) & + IXL_PF_STATE_LINK_ACTIVE_ON_DOWN) == 0) + ixl_set_link(pf, false); } static int diff --git a/sys/dev/ixl/ixl_pf.h b/sys/dev/ixl/ixl_pf.h index c3fbdc91d358..83c764bc617c 100644 --- a/sys/dev/ixl/ixl_pf.h +++ b/sys/dev/ixl/ixl_pf.h @@ -88,6 +88,7 @@ enum ixl_pf_state { IXL_PF_STATE_EMP_RESET_REQ = (1 << 8), IXL_PF_STATE_FW_LLDP_DISABLED = (1 << 9), IXL_PF_STATE_EEE_ENABLED = (1 << 10), + IXL_PF_STATE_LINK_ACTIVE_ON_DOWN = (1 << 11), }; #define IXL_PF_IN_RECOVERY_MODE(pf) \ @@ -229,6 +230,11 @@ struct ixl_pf { "\t0 - disable\n" \ "\t1 - enable\n" +#define IXL_SYSCTL_HELP_SET_LINK_ACTIVE \ +"\nKeep link active after setting interface down:\n" \ +"\t0 - disable\n" \ +"\t1 - enable\n" + #define IXL_SYSCTL_HELP_READ_I2C \ "\nRead a byte from I2C bus\n" \ "Input: 32-bit value\n" \ @@ -351,6 +357,7 @@ void ixl_pf_reset_stats(struct ixl_pf *); void ixl_get_bus_info(struct ixl_pf *pf); int ixl_aq_get_link_status(struct ixl_pf *, struct i40e_aqc_get_link_status *); +void ixl_set_link(struct ixl_pf *, bool); int ixl_handle_nvmupd_cmd(struct ixl_pf *, struct ifdrv *); int ixl_handle_i2c_eeprom_read_cmd(struct ixl_pf *, struct ifreq *ifr); diff --git a/sys/dev/ixl/ixl_pf_iflib.c b/sys/dev/ixl/ixl_pf_iflib.c index 2b3d035fbcfe..23d9f30299a9 100644 --- a/sys/dev/ixl/ixl_pf_iflib.c +++ b/sys/dev/ixl/ixl_pf_iflib.c @@ -413,6 +413,8 @@ ixl_link_event(struct ixl_pf *pf, struct i40e_arq_event_info *e) /* Print out message if an unqualified module is found */ if ((status->link_info & I40E_AQ_MEDIA_AVAILABLE) && (pf->advertised_speed) && + (atomic_load_32(&pf->state) & + IXL_PF_STATE_LINK_ACTIVE_ON_DOWN) != 0 && (!(status->an_info & I40E_AQ_QUALIFIED_MODULE)) && (!(status->link_info & I40E_AQ_LINK_UP))) device_printf(dev, "Link failed because " diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index 070ddaef522e..b546701608f1 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -62,6 +62,7 @@ static int ixl_sysctl_pf_tx_itr(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_pf_rx_itr(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_eee_enable(SYSCTL_HANDLER_ARGS); +static int ixl_sysctl_set_link_active(SYSCTL_HANDLER_ARGS); /* Debug Sysctls */ static int ixl_sysctl_link_status(SYSCTL_HANDLER_ARGS); @@ -385,6 +386,9 @@ retry: break; } + /* Keep link active by default */ + atomic_set_32(&pf->state, IXL_PF_STATE_LINK_ACTIVE_ON_DOWN); + /* Print a subset of the capability information. */ device_printf(dev, "PF-ID[%d]: VFs %d, MSI-X %d, VF MSI-X %d, QPs %d, %s\n", @@ -2499,6 +2503,12 @@ ixl_add_device_sysctls(struct ixl_pf *pf) CTLFLAG_RD | CTLFLAG_MPSAFE, &pf->stats.rx_lpi_count, "RX LPI count"); + SYSCTL_ADD_PROC(ctx, ctx_list, OID_AUTO, + "link_active_on_if_down", + CTLTYPE_INT | CTLFLAG_RWTUN, + pf, 0, ixl_sysctl_set_link_active, "I", + IXL_SYSCTL_HELP_SET_LINK_ACTIVE); + /* Add sysctls meant to print debug information, but don't list them * in "sysctl -a" output. */ debug_node = SYSCTL_ADD_NODE(ctx, ctx_list, @@ -2519,6 +2529,11 @@ ixl_add_device_sysctls(struct ixl_pf *pf) CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, pf, 0, ixl_sysctl_link_status, "A", IXL_SYSCTL_HELP_LINK_STATUS); + SYSCTL_ADD_PROC(ctx, debug_list, + OID_AUTO, "phy_abilities_init", + CTLTYPE_STRING | CTLFLAG_RD, + pf, 1, ixl_sysctl_phy_abilities, "A", "Initial PHY Abilities"); + SYSCTL_ADD_PROC(ctx, debug_list, OID_AUTO, "phy_abilities", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, @@ -3107,6 +3122,95 @@ ixl_find_i2c_interface(struct ixl_pf *pf) return (-1); } +void +ixl_set_link(struct ixl_pf *pf, bool enable) +{ + struct i40e_hw *hw = &pf->hw; + device_t dev = pf->dev; + struct i40e_aq_get_phy_abilities_resp abilities; + struct i40e_aq_set_phy_config config; + enum i40e_status_code aq_error = 0; + u32 phy_type, phy_type_ext; + + /* Get initial capability information */ + aq_error = i40e_aq_get_phy_capabilities(hw, + FALSE, TRUE, &abilities, NULL); + if (aq_error) { + device_printf(dev, + "%s: Error getting phy capabilities %d," + " aq error: %d\n", __func__, aq_error, + hw->aq.asq_last_status); + return; + } + + phy_type = abilities.phy_type; + phy_type_ext = abilities.phy_type_ext; + + /* Get current capability information */ + aq_error = i40e_aq_get_phy_capabilities(hw, + FALSE, FALSE, &abilities, NULL); + if (aq_error) { + device_printf(dev, + "%s: Error getting phy capabilities %d," + " aq error: %d\n", __func__, aq_error, + hw->aq.asq_last_status); + return; + } + + /* Prepare new config */ + memset(&config, 0, sizeof(config)); + config.link_speed = abilities.link_speed; + config.abilities = abilities.abilities; + config.eee_capability = abilities.eee_capability; + config.eeer = abilities.eeer_val; + config.low_power_ctrl = abilities.d3_lpan; + config.fec_config = abilities.fec_cfg_curr_mod_ext_info + & I40E_AQ_PHY_FEC_CONFIG_MASK; + config.phy_type = 0; + config.phy_type_ext = 0; + + if (enable) { + config.phy_type = phy_type; + config.phy_type_ext = phy_type_ext; + + config.abilities &= ~(I40E_AQ_PHY_FLAG_PAUSE_TX | + I40E_AQ_PHY_FLAG_PAUSE_RX); + + switch (pf->fc) { + case I40E_FC_FULL: + config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_TX | + I40E_AQ_PHY_FLAG_PAUSE_RX; + break; + case I40E_FC_RX_PAUSE: + config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_RX; + break; + case I40E_FC_TX_PAUSE: + config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_TX; + break; + default: + break; + } + } + + aq_error = i40e_aq_set_phy_config(hw, &config, NULL); + if (aq_error) { + device_printf(dev, + "%s: Error setting new phy config %d," + " aq error: %d\n", __func__, aq_error, + hw->aq.asq_last_status); + return; + } + + aq_error = i40e_aq_set_link_restart_an(hw, enable, NULL); + if (aq_error) { + device_printf(dev, + "%s: Error set link config %d," + " aq error: %d\n", __func__, aq_error, + hw->aq.asq_last_status); + return; + } +} + static char * ixl_phy_type_string(u32 bit_pos, bool ext) { @@ -3265,7 +3369,7 @@ ixl_sysctl_phy_abilities(SYSCTL_HANDLER_ARGS) } status = i40e_aq_get_phy_capabilities(hw, - FALSE, FALSE, &abilities, NULL); + FALSE, arg2 != 0, &abilities, NULL); if (status) { device_printf(dev, "%s: i40e_aq_get_phy_capabilities() status %s, aq error %s\n", @@ -4447,6 +4551,28 @@ ixl_sysctl_eee_enable(SYSCTL_HANDLER_ARGS) return (0); } +static int +ixl_sysctl_set_link_active(SYSCTL_HANDLER_ARGS) +{ + struct ixl_pf *pf = (struct ixl_pf *)arg1; + int error, state; + + state = !!(atomic_load_acq_32(&pf->state) & + IXL_PF_STATE_LINK_ACTIVE_ON_DOWN); + + error = sysctl_handle_int(oidp, &state, 0, req); + if ((error) || (req->newptr == NULL)) + return (error); + + if (state == 0) + atomic_clear_32(&pf->state, IXL_PF_STATE_LINK_ACTIVE_ON_DOWN); + else + atomic_set_32(&pf->state, IXL_PF_STATE_LINK_ACTIVE_ON_DOWN); + + return (0); +} + + int ixl_attach_get_link_status(struct ixl_pf *pf) { From owner-dev-commits-src-branches@freebsd.org Fri Mar 5 03:23: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 93DDF564489; Fri, 5 Mar 2021 03:23:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DsCkQ3pX1z3K7R; Fri, 5 Mar 2021 03:23: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 7580BFC4; Fri, 5 Mar 2021 03:23: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 1253Ng5D023746; Fri, 5 Mar 2021 03:23:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1253NgQw023745; Fri, 5 Mar 2021 03:23:42 GMT (envelope-from git) Date: Fri, 5 Mar 2021 03:23:42 GMT Message-Id: <202103050323.1253NgQw023745@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: 96aabea8bd23 - stable/13 - Import wireguard fixes from pfSense 2.5 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: 96aabea8bd238b503e949753355dc5b6a857aa9c 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 Mar 2021 03:23:42 -0000 The branch stable/13 has been updated by grehan: URL: https://cgit.FreeBSD.org/src/commit/?id=96aabea8bd238b503e949753355dc5b6a857aa9c commit 96aabea8bd238b503e949753355dc5b6a857aa9c Author: Peter Grehan AuthorDate: 2021-02-27 04:15:04 +0000 Commit: Peter Grehan CommitDate: 2021-03-05 01:23:14 +0000 Import wireguard fixes from pfSense 2.5 Merge the following fixes from https://github.com/pfsense/FreeBSD-src 1940e7d3 Save address of ingress packets to allow wg to work on HA 8f5531f1 Fix connection to IPv6 endpoint 825ed9ee Fix tcpdump for wg IPv6 rx tunnel traffic 2ec232d3 Fix issue with replying to INITIATION messages in server mode ec77593a Return immediately in wg_init if in DETACH'd state 0f0dde6f Remove unnecessary wg debug printf on transmit 2766dc94 Detect and fix case in wg_init() where sockets weren't cleaned up b62cc7ac Close the UDP tunnel sockets when the interface has been stopped Obtained from: pfSense 2.5 Relnotes: yes Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 95331c228a39b44cb96c4d0142ed8afec8a4d063) --- sys/dev/if_wg/module/if_wg_session.c | 45 +++++++++++++++++++++++++++++++++--- sys/dev/if_wg/module/module.c | 23 ++++++++++++++---- 2 files changed, 60 insertions(+), 8 deletions(-) diff --git a/sys/dev/if_wg/module/if_wg_session.c b/sys/dev/if_wg/module/if_wg_session.c index 54e63d053847..084bc789039d 100644 --- a/sys/dev/if_wg/module/if_wg_session.c +++ b/sys/dev/if_wg/module/if_wg_session.c @@ -1394,8 +1394,8 @@ wg_deliver_in(struct wg_peer *peer) CURVNET_SET(inp->inp_vnet); ip_input(m); CURVNET_RESTORE(); - } else if (version == 6) { - af = AF_INET; + } else if (version == 6) { + af = AF_INET6; BPF_MTAP2(sc->sc_ifp, &af, sizeof(af), m); inp = sotoinpcb(so->so_so6); CURVNET_SET(inp->inp_vnet); @@ -1531,6 +1531,7 @@ wg_handshake(struct wg_softc *sc, struct mbuf *m) peer = CONTAINER_OF(remote, struct wg_peer, p_remote); DPRINTF(sc, "Receiving handshake initiation from peer %llu\n", (unsigned long long)peer->p_id); + wg_peer_set_endpoint_from_tag(peer, t); res = wg_send_response(peer); if (res == 0 && noise_remote_begin_session(&peer->p_remote) == 0) wg_timers_event_session_derived(&peer->p_timers); @@ -1851,6 +1852,40 @@ wg_index_drop(struct wg_softc *sc, uint32_t key0) SLIST_INSERT_HEAD(&peer->p_unused_index, iter, i_unused_entry); } +static int +wg_update_endpoint_addrs(struct wg_endpoint *e, const struct sockaddr *srcsa, + struct ifnet *rcvif) +{ + const struct sockaddr_in *sa4; + const struct sockaddr_in6 *sa6; + int ret = 0; + + /* + * UDP passes a 2-element sockaddr array: first element is the + * source addr/port, second the destination addr/port. + */ + if (srcsa->sa_family == AF_INET) { + sa4 = (const struct sockaddr_in *)srcsa; + e->e_remote.r_sin = sa4[0]; + /* Only update dest if not mcast/bcast */ + if (!(IN_MULTICAST(ntohl(sa4[1].sin_addr.s_addr)) || + sa4[1].sin_addr.s_addr == INADDR_BROADCAST || + in_broadcast(sa4[1].sin_addr, rcvif))) { + e->e_local.l_in = sa4[1].sin_addr; + } + } else if (srcsa->sa_family == AF_INET6) { + sa6 = (const struct sockaddr_in6 *)srcsa; + e->e_remote.r_sin6 = sa6[0]; + /* Only update dest if not multicast */ + if (!IN6_IS_ADDR_MULTICAST(&sa6[1].sin6_addr)) + e->e_local.l_in6 = sa6[1].sin6_addr; + } else { + ret = EAFNOSUPPORT; + } + + return (ret); +} + static void wg_input(struct mbuf *m0, int offset, struct inpcb *inpcb, const struct sockaddr *srcsa, void *_sc) @@ -1882,7 +1917,11 @@ wg_input(struct mbuf *m0, int offset, struct inpcb *inpcb, goto free; } e = wg_mbuf_endpoint_get(m); - e->e_remote.r_sa = *srcsa; + + if (wg_update_endpoint_addrs(e, srcsa, m->m_pkthdr.rcvif)) { + DPRINTF(sc, "unknown family\n"); + goto free; + } verify_endpoint(m); if_inc_counter(sc->sc_ifp, IFCOUNTER_IPACKETS, 1); diff --git a/sys/dev/if_wg/module/module.c b/sys/dev/if_wg/module/module.c index 76c7db01cba1..a40a304616c7 100644 --- a/sys/dev/if_wg/module/module.c +++ b/sys/dev/if_wg/module/module.c @@ -255,7 +255,6 @@ wg_transmit(struct ifnet *ifp, struct mbuf *m) peer = wg_route_lookup(&sc->sc_routes, m, OUT); if (__predict_false(peer == NULL)) { rc = ENOKEY; - printf("peer not found - dropping %p\n", m); /* XXX log */ goto err; } @@ -360,8 +359,15 @@ wg_init(if_ctx_t ctx) struct wg_softc *sc; int rc; + if (iflib_in_detach(ctx)) + return; + sc = iflib_get_softc(ctx); ifp = iflib_get_ifp(ctx); + if (sc->sc_socket.so_so4 != NULL) + printf("XXX wg_init, socket non-NULL %p\n", + sc->sc_socket.so_so4); + wg_socket_reinit(sc, NULL, NULL); rc = wg_socket_init(sc); if (rc) return; @@ -377,6 +383,7 @@ wg_stop(if_ctx_t ctx) sc = iflib_get_softc(ctx); ifp = iflib_get_ifp(ctx); if_link_state_change(ifp, LINK_STATE_DOWN); + wg_socket_reinit(sc, NULL, NULL); } static nvlist_t * @@ -386,13 +393,20 @@ wg_peer_to_nvl(struct wg_peer *peer) int i, count; nvlist_t *nvl; caddr_t key; + size_t sa_sz; struct wg_allowedip *aip; + struct wg_endpoint *ep; if ((nvl = nvlist_create(0)) == NULL) return (NULL); key = peer->p_remote.r_public; nvlist_add_binary(nvl, "public-key", key, WG_KEY_SIZE); - nvlist_add_binary(nvl, "endpoint", &peer->p_endpoint.e_remote, sizeof(struct sockaddr)); + ep = &peer->p_endpoint; + if (ep->e_remote.r_sa.sa_family != 0) { + sa_sz = (ep->e_remote.r_sa.sa_family == AF_INET) ? + sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6); + nvlist_add_binary(nvl, "endpoint", &ep->e_remote, sa_sz); + } i = count = 0; CK_LIST_FOREACH(rt, &peer->p_routes, r_entry) { count++; @@ -587,13 +601,12 @@ wg_peer_add(struct wg_softc *sc, const nvlist_t *nvl) } if (nvlist_exists_binary(nvl, "endpoint")) { endpoint = nvlist_get_binary(nvl, "endpoint", &size); - if (size != sizeof(*endpoint)) { + if (size > sizeof(peer->p_endpoint.e_remote)) { device_printf(dev, "%s bad length for endpoint %zu\n", __func__, size); err = EBADMSG; goto out; } - memcpy(&peer->p_endpoint.e_remote, endpoint, - sizeof(peer->p_endpoint.e_remote)); + memcpy(&peer->p_endpoint.e_remote, endpoint, size); } if (nvlist_exists_binary(nvl, "pre-shared-key")) { const void *key; From owner-dev-commits-src-branches@freebsd.org Fri Mar 5 17:48: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 116A25609FC; Fri, 5 Mar 2021 17:48: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 4DsZwm00smz3BvY; Fri, 5 Mar 2021 17:48: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 E744914CF6; Fri, 5 Mar 2021 17:48: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 125Hmtnr060976; Fri, 5 Mar 2021 17:48:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 125Hmt32060975; Fri, 5 Mar 2021 17:48:55 GMT (envelope-from git) Date: Fri, 5 Mar 2021 17:48:55 GMT Message-Id: <202103051748.125Hmt32060975@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: 765cc83260b1 - stable/13 - cxgbetool: correct utilties typo 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: 765cc83260b1c6acca5404b650fe8c1e94a31c16 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 Mar 2021 17:48:56 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=765cc83260b1c6acca5404b650fe8c1e94a31c16 commit 765cc83260b1c6acca5404b650fe8c1e94a31c16 Author: Ed Maste AuthorDate: 2021-01-24 15:21:53 +0000 Commit: Ed Maste CommitDate: 2021-03-05 17:40:55 +0000 cxgbetool: correct utilties typo (cherry picked from commit 25611bc0abf8a21f90cf3a702d6163b23bb7bed5) --- usr.sbin/cxgbetool/tcb_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/cxgbetool/tcb_common.c b/usr.sbin/cxgbetool/tcb_common.c index b17889f94a88..c6c3fed19c3e 100644 --- a/usr.sbin/cxgbetool/tcb_common.c +++ b/usr.sbin/cxgbetool/tcb_common.c @@ -169,7 +169,7 @@ tcb_startswith_nc(char *cs, char *ct) /***:----------------------------------------------------------------------- - ***: print utilties + ***: print utilities ***:----------------------------------------------------------------------- */ From owner-dev-commits-src-branches@freebsd.org Fri Mar 5 17:48: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 2FFB6560FC0; Fri, 5 Mar 2021 17:48: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 4DsZwn0v5dz3BmR; Fri, 5 Mar 2021 17:48: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 11A8D14BAA; Fri, 5 Mar 2021 17:48: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 125Hmuth060999; Fri, 5 Mar 2021 17:48:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 125HmuaB060998; Fri, 5 Mar 2021 17:48:56 GMT (envelope-from git) Date: Fri, 5 Mar 2021 17:48:56 GMT Message-Id: <202103051748.125HmuaB060998@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: 812a476244c4 - stable/13 - tests/sys/audit: force PIE off 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: 812a476244c4c2458942f957cf1188f05459a5d8 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 Mar 2021 17:48:57 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=812a476244c4c2458942f957cf1188f05459a5d8 commit 812a476244c4c2458942f957cf1188f05459a5d8 Author: Ed Maste AuthorDate: 2021-02-19 01:41:33 +0000 Commit: Ed Maste CommitDate: 2021-03-05 17:46:11 +0000 tests/sys/audit: force PIE off df093aa9463b linked against libprivateauditd.a, but that is currently (and incorrectly) built as position-dependent. For now just force PIE off for this test to fix the WITH_PIE build. Sponsored by: The FreeBSD Foundation (cherry picked from commit 4621c4f2fd179eff0923140da9af122c42dbe78b) --- tests/sys/audit/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/sys/audit/Makefile b/tests/sys/audit/Makefile index c2267e52698f..215740020eb5 100644 --- a/tests/sys/audit/Makefile +++ b/tests/sys/audit/Makefile @@ -51,6 +51,7 @@ TEST_METADATA+= required_user="root" TEST_METADATA+= is_exclusive="true" TEST_METADATA+= required_files="/etc/rc.d/auditd /dev/auditpipe" +MK_PIE:= no # XXX libprivateauditd.a is not PIE LDFLAGS+= -lbsm -lutil CFLAGS.process-control.c+= -I${SRCTOP}/tests From owner-dev-commits-src-branches@freebsd.org Fri Mar 5 17:48: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 60439560D45; Fri, 5 Mar 2021 17:48: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 4DsZwp1gKbz3BmX; Fri, 5 Mar 2021 17:48: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 2AFA514BAB; Fri, 5 Mar 2021 17:48: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 125Hmw3G061017; Fri, 5 Mar 2021 17:48:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 125Hmw8H061016; Fri, 5 Mar 2021 17:48:58 GMT (envelope-from git) Date: Fri, 5 Mar 2021 17:48:58 GMT Message-Id: <202103051748.125Hmw8H061016@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: 680867cb7029 - stable/13 - newvers.sh: add newline at EOF in generated vers.c 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: 680867cb7029cf60a401603794e202c588172dd1 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 Mar 2021 17:48:58 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=680867cb7029cf60a401603794e202c588172dd1 commit 680867cb7029cf60a401603794e202c588172dd1 Author: Ed Maste AuthorDate: 2021-01-25 19:53:47 +0000 Commit: Ed Maste CommitDate: 2021-03-05 17:46:12 +0000 newvers.sh: add newline at EOF in generated vers.c Previously we omitted the newline, which did not cause a functional issue for the build but resulted in suboptimal output from e.g. `cat vers.c`. (cherry picked from commit 8564660237aec4c679e8b607dbbf861c90fafc4c) --- sys/conf/newvers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 0b5b76847320..acbebbd780b7 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -311,7 +311,7 @@ EOF ) vers_content_old=$(cat vers.c 2>/dev/null || true) if [ "$vers_content_new" != "$vers_content_old" ]; then - printf "%s" "$vers_content_new" > vers.c + printf "%s\n" "$vers_content_new" > vers.c fi echo $((v + 1)) > version From owner-dev-commits-src-branches@freebsd.org Fri Mar 5 17:49: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 C2F96561012; Fri, 5 Mar 2021 17:49: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 4DsZwr084Zz3BsC; Fri, 5 Mar 2021 17:48: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 4BE9F14BAC; Fri, 5 Mar 2021 17:48: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 125Hmx3I061039; Fri, 5 Mar 2021 17:48:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 125Hmx33061038; Fri, 5 Mar 2021 17:48:59 GMT (envelope-from git) Date: Fri, 5 Mar 2021 17:48:59 GMT Message-Id: <202103051748.125Hmx33061038@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: de40e928fb5a - stable/13 - Cirrus-CI: remove svn2git remnant 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: de40e928fb5ae58567a08372e1ab793b9c4a2a24 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 Mar 2021 17:49:01 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=de40e928fb5ae58567a08372e1ab793b9c4a2a24 commit de40e928fb5ae58567a08372e1ab793b9c4a2a24 Author: Ed Maste AuthorDate: 2021-01-29 14:34:27 +0000 Commit: Ed Maste CommitDate: 2021-03-05 17:46:12 +0000 Cirrus-CI: remove svn2git remnant Previously Cirrus was skipped on svn_head to avoid running CI on two different branches with identical content. With the transition to git this serves no purpose. Reported by: kevans Sponsored by: The FreeBSD Foundation (cherry picked from commit f17fc5439f517d06ac8976f53354789cde5a7427) --- .cirrus.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 71bd02a2ca8c..c577ca8aeca3 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -11,7 +11,6 @@ env: CIRRUS_CLONE_DEPTH: 1 task: - only_if: $CIRRUS_BRANCH != 'svn_head' timeout_in: 120m install_script: - pkg install -y qemu42 uefi-edk2-qemu-x86_64 llvm11 From owner-dev-commits-src-branches@freebsd.org Fri Mar 5 17:52: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 2FE6A561141; Fri, 5 Mar 2021 17:52:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dsb0S0hGkz3CW2; Fri, 5 Mar 2021 17:52: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 0A887148FC; Fri, 5 Mar 2021 17:52: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 125Hq7AB072185; Fri, 5 Mar 2021 17:52:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 125Hq7nN072184; Fri, 5 Mar 2021 17:52:07 GMT (envelope-from git) Date: Fri, 5 Mar 2021 17:52:07 GMT Message-Id: <202103051752.125Hq7nN072184@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: 31cbc4f946ae - stable/13 - Cirrus-CI: add df/du to track down disk full issues 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: 31cbc4f946ae0e69dbb76898713a1fc3df1a19f3 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 Mar 2021 17:52:08 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=31cbc4f946ae0e69dbb76898713a1fc3df1a19f3 commit 31cbc4f946ae0e69dbb76898713a1fc3df1a19f3 Author: Ed Maste AuthorDate: 2021-03-01 03:07:05 +0000 Commit: Ed Maste CommitDate: 2021-03-05 17:49:59 +0000 Cirrus-CI: add df/du to track down disk full issues Cirrus-CI: show mounted filesystems and free space at start CI runs have been encountering disk full errors. Add a `df` invocation so that we can see what we're working with. (cherry picked from commit af11c2029006b64da41a78f2e2dcc910e13ce07a) Cirrus-CI: Add more information to help track down disk full issues Execute df(1) before and after the build (reporting in MiB for consistency), and du(1) of /usr/obj. Also include the uname. (cherry picked from commit f2f24008a2b1b3c7a1c4b75e9b9c2d0f08abc27b) --- .cirrus.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index c577ca8aeca3..840e0eb81e23 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -14,7 +14,9 @@ task: timeout_in: 120m install_script: - pkg install -y qemu42 uefi-edk2-qemu-x86_64 llvm11 - setup_user_script: + setup_script: + - uname -a + - df -m - pw useradd user - mkdir -p /usr/obj/$(pwd -P) - chown user:user /usr/obj/$(pwd -P) @@ -24,3 +26,6 @@ task: - su user -c "make CROSS_TOOLCHAIN=llvm11 WITHOUT_TOOLCHAIN=yes PKG_FORMAT=tar packages" test_script: - sh tools/boot/ci-qemu-test.sh + post_script: + - df -m + - du -m -s /usr/obj \ No newline at end of file From owner-dev-commits-src-branches@freebsd.org Fri Mar 5 17:52: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 48CB2560D9C; Fri, 5 Mar 2021 17:52: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 4Dsb0T1ffQz3CSc; Fri, 5 Mar 2021 17:52: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 2BA6414F03; Fri, 5 Mar 2021 17:52: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 125Hq9wQ072208; Fri, 5 Mar 2021 17:52:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 125Hq9sw072207; Fri, 5 Mar 2021 17:52:09 GMT (envelope-from git) Date: Fri, 5 Mar 2021 17:52:09 GMT Message-Id: <202103051752.125Hq9sw072207@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: 982cd9620615 - stable/13 - Cirrus-CI: temporarily avoid qemu smoke test boot 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: 982cd962061552fbeb43e3bce2a5d7fd05231dde 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 Mar 2021 17:52:09 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=982cd962061552fbeb43e3bce2a5d7fd05231dde commit 982cd962061552fbeb43e3bce2a5d7fd05231dde Author: Ed Maste AuthorDate: 2021-03-05 17:49:23 +0000 Commit: Ed Maste CommitDate: 2021-03-05 17:51:04 +0000 Cirrus-CI: temporarily avoid qemu smoke test boot Cirrus-CI has been red for some time because we're running out of disk space on the ephemeral GCP VMs. For now remove the package + qemu boot, and just check for build regressions. This change to be reverted once we have identified and addressed the underlying issue. Sponsored by: The FreeBSD Foundation (cherry picked from commit a7d593dd1da27833b5384349700bc3c7bcae6aad) --- .cirrus.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 840e0eb81e23..323567685b68 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -13,7 +13,7 @@ env: task: timeout_in: 120m install_script: - - pkg install -y qemu42 uefi-edk2-qemu-x86_64 llvm11 + - pkg install -y llvm11 setup_script: - uname -a - df -m @@ -22,10 +22,6 @@ task: - chown user:user /usr/obj/$(pwd -P) script: - su user -c "make -j$(sysctl -n hw.ncpu) CROSS_TOOLCHAIN=llvm11 WITHOUT_TOOLCHAIN=yes buildworld buildkernel" - package_script: - - su user -c "make CROSS_TOOLCHAIN=llvm11 WITHOUT_TOOLCHAIN=yes PKG_FORMAT=tar packages" - test_script: - - sh tools/boot/ci-qemu-test.sh post_script: - df -m - du -m -s /usr/obj \ No newline at end of file From owner-dev-commits-src-branches@freebsd.org Fri Mar 5 17:52: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 412E4560D9D; Fri, 5 Mar 2021 17:52:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dsb0V3Fnsz3CSm; Fri, 5 Mar 2021 17:52: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 5510214D1A; Fri, 5 Mar 2021 17:52: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 125HqAxO072228; Fri, 5 Mar 2021 17:52:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 125HqAbC072227; Fri, 5 Mar 2021 17:52:10 GMT (envelope-from git) Date: Fri, 5 Mar 2021 17:52:10 GMT Message-Id: <202103051752.125HqAbC072227@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: 8ea77f39ec17 - stable/13 - bsdinstall: replace multiple ifs with case 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: 8ea77f39ec170d1a8b1cc2bf514dfefe69cf86aa 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 Mar 2021 17:52:11 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=8ea77f39ec170d1a8b1cc2bf514dfefe69cf86aa commit 8ea77f39ec170d1a8b1cc2bf514dfefe69cf86aa Author: Ed Maste AuthorDate: 2021-01-29 19:00:29 +0000 Commit: Ed Maste CommitDate: 2021-03-05 17:51:04 +0000 bsdinstall: replace multiple ifs with case Reduce copy-paste and use a more typical construct. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28417 (cherry picked from commit fbc57e2df95b582f7d3287ed3919337bfec5711a) --- usr.sbin/bsdinstall/scripts/hardening | 46 ++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/hardening b/usr.sbin/bsdinstall/scripts/hardening index 9fea1b6aed5d..58ea0a112e26 100755 --- a/usr.sbin/bsdinstall/scripts/hardening +++ b/usr.sbin/bsdinstall/scripts/hardening @@ -52,38 +52,40 @@ FEATURES=$( dialog --backtitle "FreeBSD Installer" \ exec 3>&- for feature in $FEATURES; do - if [ "$feature" = "hide_uids" ]; then + case "$feature" in + hide_uids) echo security.bsd.see_other_uids=0 >> $BSDINSTALL_TMPETC/sysctl.conf.hardening - fi - if [ "$feature" = "hide_gids" ]; then + ;; + hide_gids) echo security.bsd.see_other_gids=0 >> $BSDINSTALL_TMPETC/sysctl.conf.hardening - fi - if [ "$feature" = "hide_jail" ]; then + ;; + hide_jail) echo security.bsd.see_jail_proc=0 >> $BSDINSTALL_TMPETC/sysctl.conf.hardening - fi - if [ "$feature" = "read_msgbuf" ]; then + ;; + read_msgbuf) echo security.bsd.unprivileged_read_msgbuf=0 >> $BSDINSTALL_TMPETC/sysctl.conf.hardening - fi - if [ "$feature" = "proc_debug" ]; then + ;; + proc_debug) echo security.bsd.unprivileged_proc_debug=0 >> $BSDINSTALL_TMPETC/sysctl.conf.hardening - fi - if [ "$feature" = "random_pid" ]; then + ;; + random_pid) echo kern.randompid=1 >> $BSDINSTALL_TMPETC/sysctl.conf.hardening - fi - if [ "$feature" = "clear_tmp" ]; then + ;; + clear_tmp) echo 'clear_tmp_enable="YES"' >> $BSDINSTALL_TMPETC/rc.conf.hardening - fi - if [ "$feature" = "disable_syslogd" ]; then + ;; + disable_syslogd) echo 'syslogd_flags="-ss"' >> $BSDINSTALL_TMPETC/rc.conf.hardening - fi - if [ "$feature" = "disable_sendmail" ]; then + ;; + disable_sendmail) echo 'sendmail_enable="NONE"' >> $BSDINSTALL_TMPETC/rc.conf.hardening - fi - if [ "$feature" = "secure_console" ]; then + ;; + secure_console) sed "s/unknown off secure/unknown off insecure/g" $BSDINSTALL_CHROOT/etc/ttys > $BSDINSTALL_TMPETC/ttys.hardening - fi - if [ "$feature" = "disable_ddtrace" ]; then + ;; + disable_ddtrace) echo 'security.bsd.allow_destructive_dtrace=0' >> $BSDINSTALL_TMPBOOT/loader.conf.hardening - fi + ;; + esac done From owner-dev-commits-src-branches@freebsd.org Fri Mar 5 17:52: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 966B0561235; Fri, 5 Mar 2021 17:52: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 4Dsb0Y1ys8z3CXm; Fri, 5 Mar 2021 17:52: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 92A64149D0; Fri, 5 Mar 2021 17:52: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 125HqBJf072248; Fri, 5 Mar 2021 17:52:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 125HqBAp072247; Fri, 5 Mar 2021 17:52:11 GMT (envelope-from git) Date: Fri, 5 Mar 2021 17:52:11 GMT Message-Id: <202103051752.125HqBAp072247@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: 41b9a5af2e19 - stable/13 - bsdinstall: add knob to set ASLR sysctls 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: 41b9a5af2e19cc3715028b9a6e45e0a2e1bceb74 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 Mar 2021 17:52:15 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=41b9a5af2e19cc3715028b9a6e45e0a2e1bceb74 commit 41b9a5af2e19cc3715028b9a6e45e0a2e1bceb74 Author: Ed Maste AuthorDate: 2021-01-29 19:15:28 +0000 Commit: Ed Maste CommitDate: 2021-03-05 17:51:04 +0000 bsdinstall: add knob to set ASLR sysctls Reviewed by: mw Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28418 (cherry picked from commit 020f4112559ebf7e94665c9a69f89d21929ce82a) --- usr.sbin/bsdinstall/scripts/hardening | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/usr.sbin/bsdinstall/scripts/hardening b/usr.sbin/bsdinstall/scripts/hardening index 58ea0a112e26..67ee3672712d 100755 --- a/usr.sbin/bsdinstall/scripts/hardening +++ b/usr.sbin/bsdinstall/scripts/hardening @@ -28,6 +28,20 @@ : ${DIALOG_OK=0} +set_aslr_sysctls() +{ + for bit in 32 64; do + if ! sysctl -Nq kern.elf$bit.aslr.enable >/dev/null; then + continue + fi + cat >> $BSDINSTALL_TMPETC/sysctl.conf.hardening <<-EOF + kern.elf$bit.aslr.enable=1 + kern.elf$bit.aslr.pie_enable=1 + kern.elf$bit.aslr.honor_sbrk=0 + EOF + done +} + echo -n > $BSDINSTALL_TMPETC/rc.conf.hardening echo -n > $BSDINSTALL_TMPETC/sysctl.conf.hardening echo -n > $BSDINSTALL_TMPBOOT/loader.conf.hardening @@ -48,6 +62,7 @@ FEATURES=$( dialog --backtitle "FreeBSD Installer" \ "8 disable_sendmail" "Disable Sendmail service" ${disable_sendmail:-off} \ "9 secure_console" "Enable console password prompt" ${secure_console:-off} \ "10 disable_ddtrace" "Disallow DTrace destructive-mode" ${disable_ddtrace:-off} \ + "11 enable_aslr" "Enable address layout randomization" ${enable_aslr:-off} \ 2>&1 1>&3 ) exec 3>&- @@ -86,6 +101,9 @@ for feature in $FEATURES; do disable_ddtrace) echo 'security.bsd.allow_destructive_dtrace=0' >> $BSDINSTALL_TMPBOOT/loader.conf.hardening ;; + enable_aslr) + set_aslr_sysctls + ;; esac done From owner-dev-commits-src-branches@freebsd.org Fri Mar 5 19:37: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 D5042564E17; Fri, 5 Mar 2021 19:37: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 4DsdKZ5fJYz3Mvq; Fri, 5 Mar 2021 19:37: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 B4C431604F; Fri, 5 Mar 2021 19:37: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 125Jb6fn006465; Fri, 5 Mar 2021 19:37:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 125Jb6ea006464; Fri, 5 Mar 2021 19:37:06 GMT (envelope-from git) Date: Fri, 5 Mar 2021 19:37:06 GMT Message-Id: <202103051937.125Jb6ea006464@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: acd98bcb2821 - releng/13.0 - loader: use display pixel density for font autoselection 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: acd98bcb28216a5a52c011b02adf074f7131f55b 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 Mar 2021 19:37:06 -0000 The branch releng/13.0 has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=acd98bcb28216a5a52c011b02adf074f7131f55b commit acd98bcb28216a5a52c011b02adf074f7131f55b Author: Toomas Soome AuthorDate: 2021-02-20 08:51:28 +0000 Commit: Toomas Soome CommitDate: 2021-03-05 13:56:58 +0000 loader: use display pixel density for font autoselection Calculate font size from 16 density independent pixels (dp) by using: size = 16 * ppi/160 * display_factor We are specifying font size 16dp, and assuming 1dp = 160ppi. Also apply scaling factor 2 (display_factor). (cherry picked from commit becaac3972f1fde4e3c44516399468ba5ca65c9b) Approved by: re (gjb) --- stand/common/gfx_fb.c | 110 +++++++++++++++++++++++++++++++++++++++++ stand/common/gfx_fb.h | 2 + stand/efi/libefi/efi_console.c | 23 ++++++--- stand/efi/loader/framebuffer.c | 96 +++++++++++++++++++++++++++++++++-- stand/i386/libi386/vbe.c | 25 ++++++---- 5 files changed, 237 insertions(+), 19 deletions(-) diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c index 02a0a3d2be22..77cf1d39854f 100644 --- a/stand/common/gfx_fb.c +++ b/stand/common/gfx_fb.c @@ -1863,6 +1863,113 @@ reset_font_flags(void) } } +/* Return w^2 + h^2 or 0, if the dimensions are unknown */ +static unsigned +edid_diagonal_squared(void) +{ + unsigned w, h; + + if (edid_info == NULL) + return (0); + + w = edid_info->display.max_horizontal_image_size; + h = edid_info->display.max_vertical_image_size; + + /* If either one is 0, we have aspect ratio, not size */ + if (w == 0 || h == 0) + return (0); + + /* + * some monitors encode the aspect ratio instead of the physical size. + */ + if ((w == 16 && h == 9) || (w == 16 && h == 10) || + (w == 4 && h == 3) || (w == 5 && h == 4)) + return (0); + + /* + * translate cm to inch, note we scale by 100 here. + */ + w = w * 100 / 254; + h = h * 100 / 254; + + /* Return w^2 + h^2 */ + return (w * w + h * h); +} + +/* + * calculate pixels per inch. + */ +static unsigned +gfx_get_ppi(void) +{ + unsigned dp, di; + + di = edid_diagonal_squared(); + if (di == 0) + return (0); + + dp = gfx_state.tg_fb.fb_width * + gfx_state.tg_fb.fb_width + + gfx_state.tg_fb.fb_height * + gfx_state.tg_fb.fb_height; + + return (isqrt(dp / di)); +} + +/* + * Calculate font size from density independent pixels (dp): + * ((16dp * ppi) / 160) * display_factor. + * Here we are using fixed constants: 1dp == 160 ppi and + * display_factor 2. + * + * We are rounding font size up and are searching for font which is + * not smaller than calculated size value. + */ +static vt_font_bitmap_data_t * +gfx_get_font(void) +{ + unsigned ppi, size; + vt_font_bitmap_data_t *font = NULL; + struct fontlist *fl, *next; + + /* Text mode is not supported here. */ + if (gfx_state.tg_fb_type == FB_TEXT) + return (NULL); + + ppi = gfx_get_ppi(); + if (ppi == 0) + return (NULL); + + /* + * We will search for 16dp font. + * We are using scale up by 10 for roundup. + */ + size = (16 * ppi * 10) / 160; + /* Apply display factor 2. */ + size = roundup(size * 2, 10) / 10; + + STAILQ_FOREACH(fl, &fonts, font_next) { + next = STAILQ_NEXT(fl, font_next); + + /* + * If this is last font or, if next font is smaller, + * we have our font. Make sure, it actually is loaded. + */ + if (next == NULL || next->font_data->vfbd_height < size) { + font = fl->font_data; + if (font->vfbd_font == NULL || + fl->font_flags == FONT_RELOAD) { + if (fl->font_load != NULL && + fl->font_name != NULL) + font = fl->font_load(fl->font_name); + } + break; + } + } + + return (font); +} + static vt_font_bitmap_data_t * set_font(teken_unit_t *rows, teken_unit_t *cols, teken_unit_t h, teken_unit_t w) { @@ -1887,6 +1994,9 @@ set_font(teken_unit_t *rows, teken_unit_t *cols, teken_unit_t h, teken_unit_t w) } } + if (font == NULL) + font = gfx_get_font(); + if (font != NULL) { *rows = height / font->vfbd_height; *cols = width / font->vfbd_width; diff --git a/stand/common/gfx_fb.h b/stand/common/gfx_fb.h index 04076a2c6d38..ac63d7939cef 100644 --- a/stand/common/gfx_fb.h +++ b/stand/common/gfx_fb.h @@ -109,6 +109,8 @@ struct vesa_edid_info { uint8_t checksum; } __packed; +extern struct vesa_edid_info *edid_info; + #define STD_TIMINGS 8 #define DET_TIMINGS 4 diff --git a/stand/efi/libefi/efi_console.c b/stand/efi/libefi/efi_console.c index 3cbd121c41da..0c40b362f276 100644 --- a/stand/efi/libefi/efi_console.c +++ b/stand/efi/libefi/efi_console.c @@ -952,13 +952,24 @@ cons_update_mode(bool use_gfx_mode) /* * setup_font() can adjust terminal size. - * Note, we do use UEFI terminal dimensions first, - * this is because the font selection will attempt - * to achieve at least this terminal dimension and - * we do not end up with too small font. + * We can see two kind of bad happening. + * We either can get too small console font - requested + * terminal size is large, display resolution is + * large, and we get very small font. + * Or, we can get too large font - requested + * terminal size is small and this will cause large + * font to be selected. + * Now, the setup_font() is updated to consider + * display density and this should give us mostly + * acceptable font. However, the catch is, not all + * display devices will give us display density. + * Still, we do hope, external monitors do - this is + * where the display size will matter the most. + * And for laptop screens, we should still get good + * results by requesting 80x25 terminal. */ - gfx_state.tg_tp.tp_row = rows; - gfx_state.tg_tp.tp_col = cols; + gfx_state.tg_tp.tp_row = 25; + gfx_state.tg_tp.tp_col = 80; setup_font(&gfx_state, fb_height, fb_width); rows = gfx_state.tg_tp.tp_row; cols = gfx_state.tg_tp.tp_col; diff --git a/stand/efi/loader/framebuffer.c b/stand/efi/loader/framebuffer.c index 509c41844dcb..adb9dfb62cee 100644 --- a/stand/efi/loader/framebuffer.c +++ b/stand/efi/loader/framebuffer.c @@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include "bootstrap.h" @@ -47,6 +49,12 @@ static EFI_GUID conout_guid = EFI_CONSOLE_OUT_DEVICE_GUID; EFI_GUID gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; static EFI_GUID pciio_guid = EFI_PCI_IO_PROTOCOL_GUID; static EFI_GUID uga_guid = EFI_UGA_DRAW_PROTOCOL_GUID; +static EFI_GUID active_edid_guid = EFI_EDID_ACTIVE_PROTOCOL_GUID; +static EFI_GUID discovered_edid_guid = EFI_EDID_DISCOVERED_PROTOCOL_GUID; +static EFI_HANDLE gop_handle; + +/* Cached EDID. */ +struct vesa_edid_info *edid_info = NULL; static EFI_GRAPHICS_OUTPUT *gop; static EFI_UGA_DRAW_PROTOCOL *uga; @@ -467,10 +475,71 @@ efifb_from_uga(struct efi_fb *efifb) return (0); } +/* + * Fetch EDID info. Caller must free the buffer. + */ +static struct vesa_edid_info * +efifb_gop_get_edid(EFI_HANDLE h) +{ + const uint8_t magic[] = EDID_MAGIC; + EFI_EDID_ACTIVE_PROTOCOL *edid; + struct vesa_edid_info *edid_infop; + EFI_GUID *guid; + EFI_STATUS status; + size_t size; + + guid = &active_edid_guid; + status = BS->OpenProtocol(h, guid, (void **)&edid, IH, NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL); + if (status != EFI_SUCCESS || + edid->SizeOfEdid == 0) { + guid = &discovered_edid_guid; + status = BS->OpenProtocol(h, guid, (void **)&edid, IH, NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL); + if (status != EFI_SUCCESS || + edid->SizeOfEdid == 0) + return (NULL); + } + + size = MAX(sizeof(*edid_infop), edid->SizeOfEdid); + + edid_infop = calloc(1, size); + if (edid_infop == NULL) + return (NULL); + + memcpy(edid_infop, edid->Edid, edid->SizeOfEdid); + + /* Validate EDID */ + if (memcmp(edid_infop, magic, sizeof (magic)) != 0) + goto error; + + if (edid_infop->header.version != 1) + goto error; + + return (edid_infop); +error: + free(edid_infop); + return (NULL); +} + +static bool +efifb_get_edid(edid_res_list_t *res) +{ + bool rv = false; + + if (edid_info == NULL) + edid_info = efifb_gop_get_edid(gop_handle); + + if (edid_info != NULL) + rv = gfx_get_edid_resolution(edid_info, res); + + return (rv); +} + int efi_find_framebuffer(teken_gfx_t *gfx_state) { - EFI_HANDLE h, *hlist; + EFI_HANDLE *hlist; UINTN nhandles, i, hsize; struct efi_fb efifb; EFI_STATUS status; @@ -498,23 +567,25 @@ efi_find_framebuffer(teken_gfx_t *gfx_state) /* * Search for ConOut protocol, if not found, use first handle. */ - h = *hlist; + gop_handle = *hlist; for (i = 0; i < nhandles; i++) { void *dummy = NULL; status = OpenProtocolByHandle(hlist[i], &conout_guid, &dummy); if (status == EFI_SUCCESS) { - h = hlist[i]; + gop_handle = hlist[i]; break; } } - status = OpenProtocolByHandle(h, &gop_guid, (void **)&gop); + status = OpenProtocolByHandle(gop_handle, &gop_guid, (void **)&gop); free(hlist); if (status == EFI_SUCCESS) { gfx_state->tg_fb_type = FB_GOP; gfx_state->tg_private = gop; + if (edid_info == NULL) + edid_info = efifb_gop_get_edid(gop_handle); } else { status = BS->LocateProtocol(&uga_guid, NULL, (VOID **)&uga); if (status == EFI_SUCCESS) { @@ -767,9 +838,25 @@ command_gop(int argc, char *argv[]) } else if (strcmp(argv[1], "off") == 0) { (void) cons_update_mode(false); } else if (strcmp(argv[1], "get") == 0) { + edid_res_list_t res; + if (argc != 2) goto usage; + TAILQ_INIT(&res); efifb_from_gop(&efifb, gop->Mode, gop->Mode->Info); + if (efifb_get_edid(&res)) { + struct resolution *rp; + + printf("EDID"); + while ((rp = TAILQ_FIRST(&res)) != NULL) { + printf(" %dx%d", rp->width, rp->height); + TAILQ_REMOVE(&res, rp, next); + free(rp); + } + printf("\n"); + } else { + printf("no EDID information\n"); + } print_efifb(gop->Mode->Mode, &efifb, 1); printf("\n"); } else if (!strcmp(argv[1], "list")) { @@ -778,6 +865,7 @@ command_gop(int argc, char *argv[]) if (argc != 2) goto usage; + pager_open(); for (mode = 0; mode < gop->Mode->MaxMode; mode++) { status = gop->QueryMode(gop, mode, &infosz, &info); diff --git a/stand/i386/libi386/vbe.c b/stand/i386/libi386/vbe.c index 0e9f6929ac05..ef4daffa8380 100644 --- a/stand/i386/libi386/vbe.c +++ b/stand/i386/libi386/vbe.c @@ -51,6 +51,7 @@ static struct modeinfoblock *vbe_mode; static uint16_t *vbe_mode_list; static size_t vbe_mode_list_size; +struct vesa_edid_info *edid_info = NULL; /* The default VGA color palette format is 6 bits per primary color. */ int palette_format = 6; @@ -836,34 +837,40 @@ vbe_dump_mode(int modenum, struct modeinfoblock *mi) static bool vbe_get_edid(edid_res_list_t *res) { - struct vesa_edid_info *edid_info; + struct vesa_edid_info *edidp; const uint8_t magic[] = EDID_MAGIC; int ddc_caps; bool ret = false; + if (edid_info != NULL) + return (gfx_get_edid_resolution(edid_info, res)); + ddc_caps = biosvbe_ddc_caps(); if (ddc_caps == 0) { return (ret); } - edid_info = bio_alloc(sizeof (*edid_info)); - if (edid_info == NULL) + edidp = bio_alloc(sizeof(*edidp)); + if (edidp == NULL) return (ret); - memset(edid_info, 0, sizeof (*edid_info)); + memset(edidp, 0, sizeof(*edidp)); - if (VBE_ERROR(biosvbe_ddc_read_edid(0, edid_info))) + if (VBE_ERROR(biosvbe_ddc_read_edid(0, edidp))) goto done; - if (memcmp(edid_info, magic, sizeof (magic)) != 0) + if (memcmp(edidp, magic, sizeof(magic)) != 0) goto done; /* Unknown EDID version. */ - if (edid_info->header.version != 1) + if (edidp->header.version != 1) goto done; - ret = gfx_get_edid_resolution(edid_info, res); + ret = gfx_get_edid_resolution(edidp, res); + edid_info = malloc(sizeof(*edid_info)); + if (edid_info != NULL) + memcpy(edid_info, edidp, sizeof (*edid_info)); done: - bio_free(edid_info, sizeof (*edid_info)); + bio_free(edidp, sizeof(*edidp)); return (ret); } From owner-dev-commits-src-branches@freebsd.org Fri Mar 5 21:52: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 C3016569364; Fri, 5 Mar 2021 21:52: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 4DshLM58wFz3nWg; Fri, 5 Mar 2021 21:52: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 A3CB718126; Fri, 5 Mar 2021 21:52: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 125LqxgC090011; Fri, 5 Mar 2021 21:52:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 125LqxPF090010; Fri, 5 Mar 2021 21:52:59 GMT (envelope-from git) Date: Fri, 5 Mar 2021 21:52:59 GMT Message-Id: <202103052152.125LqxPF090010@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 2c76eebca71b - stable/13 - nfs-over-tls: add user space daemons rpc.tlsclntd and rpc.tlsservd MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2c76eebca71b8e17881dfcc01faeb0537d87e0af 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 Mar 2021 21:52:59 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=2c76eebca71b8e17881dfcc01faeb0537d87e0af commit 2c76eebca71b8e17881dfcc01faeb0537d87e0af Author: Rick Macklem AuthorDate: 2021-02-18 22:08:19 +0000 Commit: Rick Macklem CommitDate: 2021-03-05 21:49:46 +0000 nfs-over-tls: add user space daemons rpc.tlsclntd and rpc.tlsservd The kernel changes needed for nfs-over-tls have been committed to main. However, nfs-over-tls requires user space daemons to handle the TLS handshake and other non-application data TLS records. There is one daemon (rpc.tlsclntd) for the client side and one daemon (rpc.tlsservd) for the server side, although they share a fair amount of code found in rpc.tlscommon.c and rpc.tlscommon.h. They use a KTLS enabled OpenSSL to perform the actual work and, as such, are only built when MK_OPENSSL_KTLS is set. Communication with the kernel is done via upcall RPCs done on AF_LOCAL sockets and the custom system call rpctls_syscall. Relnotes: yes (cherry picked from commit b9cbc85d727214cf3e13196ab7e7564e53037f77) --- usr.sbin/Makefile | 2 + usr.sbin/rpc.tlsclntd/Makefile | 29 ++ usr.sbin/rpc.tlsclntd/rpc.tlsclntd.8 | 201 ++++++++ usr.sbin/rpc.tlsclntd/rpc.tlsclntd.c | 730 ++++++++++++++++++++++++++++ usr.sbin/rpc.tlsservd/Makefile | 29 ++ usr.sbin/rpc.tlsservd/rpc.tlscommon.c | 295 +++++++++++ usr.sbin/rpc.tlsservd/rpc.tlscommon.h | 68 +++ usr.sbin/rpc.tlsservd/rpc.tlsservd.8 | 348 +++++++++++++ usr.sbin/rpc.tlsservd/rpc.tlsservd.c | 886 ++++++++++++++++++++++++++++++++++ 9 files changed, 2588 insertions(+) diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index 39913a327b87..259ab72f2281 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -182,6 +182,8 @@ SUBDIR.${MK_NIS}+= ypserv SUBDIR.${MK_NIS}+= ypset SUBDIR.${MK_NTP}+= ntp SUBDIR.${MK_OPENSSL}+= keyserv +SUBDIR.${MK_OPENSSL_KTLS}+= rpc.tlsclntd +SUBDIR.${MK_OPENSSL_KTLS}+= rpc.tlsservd SUBDIR.${MK_PF}+= ftp-proxy SUBDIR.${MK_PKGBOOTSTRAP}+= pkg SUBDIR.${MK_PMC}+= pmc pmcannotate pmccontrol pmcstat pmcstudy diff --git a/usr.sbin/rpc.tlsclntd/Makefile b/usr.sbin/rpc.tlsclntd/Makefile new file mode 100644 index 000000000000..1c8481a7889c --- /dev/null +++ b/usr.sbin/rpc.tlsclntd/Makefile @@ -0,0 +1,29 @@ +# $FreeBSD$ + +.include + +PROG= rpc.tlsclntd +MAN= rpc.tlsclntd.8 +SRCS= rpc.tlsclntd.c rpc.tlscommon.c rpctlscd.h rpctlscd_svc.c rpctlscd_xdr.c + +CFLAGS+= -I. -I${SRCTOP}/usr.sbin/rpc.tlsservd + +LIBADD= ssl crypto util + +CLEANFILES= rpctlscd_svc.c rpctlscd_xdr.c rpctlscd.h + +RPCSRC= ${SRCTOP}/sys/rpc/rpcsec_tls/rpctlscd.x +RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -L -C -M + +rpctlscd_svc.c: ${RPCSRC} rpctlscd.h + ${RPCGEN} -m -o ${.TARGET} ${RPCSRC} + +rpctlscd_xdr.c: ${RPCSRC} rpctlscd.h + ${RPCGEN} -c -o ${.TARGET} ${RPCSRC} + +rpctlscd.h: ${RPCSRC} + ${RPCGEN} -h -o ${.TARGET} ${RPCSRC} + +.PATH: ${SRCTOP}/sys/rpc/rpcsec_tls ${SRCTOP}/usr.sbin/rpc.tlsservd + +.include diff --git a/usr.sbin/rpc.tlsclntd/rpc.tlsclntd.8 b/usr.sbin/rpc.tlsclntd/rpc.tlsclntd.8 new file mode 100644 index 000000000000..23a9d05495c1 --- /dev/null +++ b/usr.sbin/rpc.tlsclntd/rpc.tlsclntd.8 @@ -0,0 +1,201 @@ +.\" Copyright (c) 2008 Isilon Inc http://www.isilon.com/ +.\" Authors: Doug Rabson +.\" Developed with Red Inc: Alfred Perlstein +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.\" Modified from gssd.8 for rpc.tlsclntd.8 by Rick Macklem. +.Dd February 17, 2021 +.Dt RPC.TLSCLNTD 8 +.Os +.Sh NAME +.Nm rpc.tlsclntd +.Nd "Sun RPC over TLS Client Daemon" +.Sh SYNOPSIS +.Nm +.Op Fl C Ar preferred_ciphers +.Op Fl D Ar certdir +.Op Fl d +.Op Fl l Ar CAfile +.Op Fl m +.Op Fl p Ar CApath +.Op Fl r Ar CRLfile +.Op Fl v +.Sh DESCRIPTION +The +.Nm +program provides support for the client side of the kernel Sun RPC over TLS +implementation. +This daemon must be running for the kernel RPC to be able to do a TLS +connection to a server for an NFS over TLS mount. +This daemon requires that the kernel be built with +.Dq options KERNEL_TLS +and be running on an architecture such as +.Dq amd64 +that supports a direct map (not i386) with +.Xr ktls 4 +enabled. +.Pp +If either of the +.Fl l +or +.Fl p +options have been specified, the daemon will require the server's +certificate to verify +and have a Fully Qualified Domain Name (FQDN) in it. +This FQDN must match +the reverse DNS name for the IP address that +the server is using for the TCP connection. +The FQDN may be +in either the DNS field of the subjectAltName or the CN field of the +subjectName in the certificate and +cannot have a wildcard +.Dq * +in it. +.Pp +If a SIGHUP signal is sent to the daemon it will reload the +.Dq CRLfile +and will shut down any extant connections that presented certificates +during TLS handshake that have been revoked. +If the +.Fl r +option was not specified, the SIGHUP signal will be ignored. +.Pp +The daemon will log failed certificate verifications via +.Xr syslogd 8 +using LOG_INFO | LOG_DAEMON when the +.Fl l +or +.Fl p +option has been specified. +.Pp +The options are as follows: +.Bl -tag -width indent +.It Fl C Ar preferred_ciphers , Fl Fl ciphers= Ns Ar preferred_ciphers +Specify what preferred ciphers are to be used. +If this option is specified, +.Dq SSL_CTX_set_cipher_list() +will be called with +.Dq preferred_ciphers +as the argument. +If this option is not specified, the cipher will be chosen by +.Xr ssl 7 . +.It Fl D Ar certdir , Fl Fl certdir= Ns Ar certdir +Use +.Dq certdir +instead of /etc/rpc.tlsclntd for the +.Fl m +option. +.It Fl d , Fl Fl debuglevel +Run in debug mode. +In this mode, +.Nm +will not fork when it starts. +.It Fl l Ar CAfile , Fl Fl verifylocs= Ns Ar CAfile +This specifies the path name of a CAfile which holds the information +for server certificate verification. +This path name is used in +.Dq SSL_CTX_load_verify_locations(ctx,CAfile,NULL) +and +.Dq SSL_CTX_set0_CA_list(ctx,SSL_load_client_CA_file(CAfile)) +openssl library calls. +Note that this is a path name for the file and is not assumed to be +in +.Dq certdir . +.It Fl m , Fl Fl mutualverf +Enable support for mutual authentication. +A certificate and associated key must be found in /etc/rpc.tlsclntd +(or the directory specified by the +.Fl D +option) +in case a server requests a peer certificate. +The first certificate needs to be in a file named +.Dq cert.pem +and the associated key in a file named +.Dq certkey.pem . +The +.Xr mount_nfs 8 +option +.Fl tlscertname +can be used to override the default certificate for a given +NFS mount, where the files use the alternate naming specified by the option. +If there is a passphrase on the +.Dq certkey.pem +file, this daemon will prompt for the passphrase during startup. +The keys for alternate certificates cannot have passphrases. +.It Fl p Ar CApath , Fl Fl verifydir= Ns Ar CApath +This option is similar to the +.Fl l +option, but specifies the path of a directory with CA +certificates in it. +When this option is used, +.Dq SSL_CTX_set0_CA_list(ctx,SSL_load_client_CA_file()) +is not called, so a list of CA names is not be passed +to the server during the TLS handshake. +The openssl documentation indicates this call is rarely needed. +.It Fl r Ar CRLfile , Fl Fl crl= Ns Ar CRLfile +This option specifies a Certificate Revocation List (CRL) file +that is to be loaded into the verify certificate store and +checked during verification of the server's certificate. +This option is meaningless unless either the +.Fl l +or +.Fl p +have been specified. +.It Fl v , Fl Fl verbose +Run in verbose mode. +In this mode, +.Nm +will log activity messages to syslog using LOG_INFO | LOG_DAEMON or to +stderr, if the +.Fl d +option has also been specified. +.El +.Sh EXIT STATUS +.Ex -std +.Sh SEE ALSO +.Xr openssl 1 , +.Xr ktls 4 , +.Xr mount_nfs 8 , +.Xr rpc.tlsservd 8 , +.Xr ssl 7 , +.Xr syslogd 8 +.Sh STANDARDS +The implementation is based on the specification in +.Rs +.%B "RFC NNNN" +.%T "Towards Remote Procedure Call Encryption By Default" +.Re +.Sh HISTORY +The +.Nm +manual page first appeared in +.Fx 13.0 . +.Sh BUGS +This daemon cannot be safely shut down and restarted if there are +any active RPC-over-TLS connections. +Doing so will orphan the KERNEL_TLS connections, so that they +can no longer do upcalls successfully, since the +.Dq SSL * +structures in userspace have been lost. diff --git a/usr.sbin/rpc.tlsclntd/rpc.tlsclntd.c b/usr.sbin/rpc.tlsclntd/rpc.tlsclntd.c new file mode 100644 index 000000000000..af803f203ffd --- /dev/null +++ b/usr.sbin/rpc.tlsclntd/rpc.tlsclntd.c @@ -0,0 +1,730 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2008 Isilon Inc http://www.isilon.com/ + * Authors: Doug Rabson + * Developed with Red Inc: Alfred Perlstein + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Extensively modified from /usr/src/usr.sbin/gssd.c r344402 for + * the client side of kernel RPC-over-TLS by Rick Macklem. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "rpctlscd.h" +#include "rpc.tlscommon.h" + +#ifndef _PATH_RPCTLSCDSOCK +#define _PATH_RPCTLSCDSOCK "/var/run/rpc.tlsclntd.sock" +#endif +#ifndef _PATH_CERTANDKEY +#define _PATH_CERTANDKEY "/etc/rpc.tlsclntd/" +#endif +#ifndef _PATH_RPCTLSCDPID +#define _PATH_RPCTLSCDPID "/var/run/rpc.tlsclntd.pid" +#endif + +/* Global variables also used by rpc.tlscommon.c. */ +int rpctls_debug_level; +bool rpctls_verbose; +SSL_CTX *rpctls_ctx = NULL; +const char *rpctls_verify_cafile = NULL; +const char *rpctls_verify_capath = NULL; +char *rpctls_crlfile = NULL; +bool rpctls_cert = false; +bool rpctls_gothup = false; +struct ssl_list rpctls_ssllist; + +static struct pidfh *rpctls_pfh = NULL; +static const char *rpctls_certdir = _PATH_CERTANDKEY; +static const char *rpctls_ciphers = NULL; +static uint64_t rpctls_ssl_refno = 0; +static uint64_t rpctls_ssl_sec = 0; +static uint64_t rpctls_ssl_usec = 0; + +static void rpctlscd_terminate(int); +static SSL_CTX *rpctls_setupcl_ssl(void); +static SSL *rpctls_connect(SSL_CTX *ctx, int s, char *certname, + u_int certlen, X509 **certp); +static void rpctls_huphandler(int sig __unused); + +extern void rpctlscd_1(struct svc_req *rqstp, SVCXPRT *transp); + +static struct option longopts[] = { + { "certdir", required_argument, NULL, 'D' }, + { "ciphers", required_argument, NULL, 'C' }, + { "debuglevel", no_argument, NULL, 'd' }, + { "verifylocs", required_argument, NULL, 'l' }, + { "mutualverf", no_argument, NULL, 'm' }, + { "verifydir", required_argument, NULL, 'p' }, + { "crl", required_argument, NULL, 'r' }, + { "verbose", no_argument, NULL, 'v' }, + { NULL, 0, NULL, 0 } +}; + +int +main(int argc, char **argv) +{ + /* + * We provide an RPC service on a local-domain socket. The + * kernel rpctls code will upcall to this daemon to do the initial + * TLS handshake. + */ + struct sockaddr_un sun; + int ch, fd, oldmask; + SVCXPRT *xprt; + bool tls_enable; + struct timeval tm; + struct timezone tz; + pid_t otherpid; + size_t tls_enable_len; + + /* Check that another rpctlscd isn't already running. */ + rpctls_pfh = pidfile_open(_PATH_RPCTLSCDPID, 0600, &otherpid); + if (rpctls_pfh == NULL) { + if (errno == EEXIST) + errx(1, "rpctlscd already running, pid: %d.", otherpid); + warn("cannot open or create pidfile"); + } + + /* Check to see that the ktls is enabled. */ + tls_enable_len = sizeof(tls_enable); + if (sysctlbyname("kern.ipc.tls.enable", &tls_enable, &tls_enable_len, + NULL, 0) != 0 || !tls_enable) + errx(1, "Kernel TLS not enabled"); + + /* Get the time when this daemon is started. */ + gettimeofday(&tm, &tz); + rpctls_ssl_sec = tm.tv_sec; + rpctls_ssl_usec = tm.tv_usec; + + rpctls_verbose = false; + while ((ch = getopt_long(argc, argv, "CD:dl:mp:r:v", longopts, NULL)) != + -1) { + switch (ch) { + case 'C': + rpctls_ciphers = optarg; + break; + case 'D': + rpctls_certdir = optarg; + break; + case 'd': + rpctls_debug_level++; + break; + case 'l': + rpctls_verify_cafile = optarg; + break; + case 'm': + rpctls_cert = true; + break; + case 'p': + rpctls_verify_capath = optarg; + break; + case 'r': + rpctls_crlfile = optarg; + break; + case 'v': + rpctls_verbose = true; + break; + default: + fprintf(stderr, "usage: %s " + "[-C/--ciphers preferred_ciphers] " + "[-D/--certdir certdir] [-d/--debuglevel] " + "[-l/--verifylocs CAfile] [-m/--mutualverf] " + "[-p/--verifydir CApath] [-r/--crl CRLfile] " + "[-v/--verbose]\n", argv[0]); + exit(1); + break; + } + } + if (rpctls_crlfile != NULL && rpctls_verify_cafile == NULL && + rpctls_verify_capath == NULL) + errx(1, "-r requires the -l and/or " + "-p options"); + + if (modfind("krpc") < 0) { + /* Not present in kernel, try loading it */ + if (kldload("krpc") < 0 || modfind("krpc") < 0) + errx(1, "Kernel RPC is not available"); + } + + /* + * Set up the SSL_CTX *. + * Do it now, before daemonizing, in case the private key + * is encrypted and requires a passphrase to be entered. + */ + rpctls_ctx = rpctls_setupcl_ssl(); + if (rpctls_ctx == NULL) { + if (rpctls_debug_level == 0) { + syslog(LOG_ERR, "Can't set up TLS context"); + exit(1); + } + err(1, "Can't set up TLS context"); + } + LIST_INIT(&rpctls_ssllist); + + if (!rpctls_debug_level) { + if (daemon(0, 0) != 0) + err(1, "Can't daemonize"); + signal(SIGINT, SIG_IGN); + signal(SIGQUIT, SIG_IGN); + signal(SIGHUP, SIG_IGN); + } + signal(SIGTERM, rpctlscd_terminate); + signal(SIGPIPE, SIG_IGN); + signal(SIGHUP, rpctls_huphandler); + + pidfile_write(rpctls_pfh); + + memset(&sun, 0, sizeof sun); + sun.sun_family = AF_LOCAL; + unlink(_PATH_RPCTLSCDSOCK); + strcpy(sun.sun_path, _PATH_RPCTLSCDSOCK); + sun.sun_len = SUN_LEN(&sun); + fd = socket(AF_LOCAL, SOCK_STREAM, 0); + if (fd < 0) { + if (rpctls_debug_level == 0) { + syslog(LOG_ERR, "Can't create local rpctlscd socket"); + exit(1); + } + err(1, "Can't create local rpctlscd socket"); + } + oldmask = umask(S_IXUSR|S_IRWXG|S_IRWXO); + if (bind(fd, (struct sockaddr *)&sun, sun.sun_len) < 0) { + if (rpctls_debug_level == 0) { + syslog(LOG_ERR, "Can't bind local rpctlscd socket"); + exit(1); + } + err(1, "Can't bind local rpctlscd socket"); + } + umask(oldmask); + if (listen(fd, SOMAXCONN) < 0) { + if (rpctls_debug_level == 0) { + syslog(LOG_ERR, + "Can't listen on local rpctlscd socket"); + exit(1); + } + err(1, "Can't listen on local rpctlscd socket"); + } + xprt = svc_vc_create(fd, RPC_MAXDATASIZE, RPC_MAXDATASIZE); + if (!xprt) { + if (rpctls_debug_level == 0) { + syslog(LOG_ERR, + "Can't create transport for local rpctlscd socket"); + exit(1); + } + err(1, "Can't create transport for local rpctlscd socket"); + } + if (!svc_reg(xprt, RPCTLSCD, RPCTLSCDVERS, rpctlscd_1, NULL)) { + if (rpctls_debug_level == 0) { + syslog(LOG_ERR, + "Can't register service for local rpctlscd socket"); + exit(1); + } + err(1, "Can't register service for local rpctlscd socket"); + } + + rpctls_syscall(RPCTLS_SYSC_CLSETPATH, _PATH_RPCTLSCDSOCK); + + rpctls_svc_run(); + + rpctls_syscall(RPCTLS_SYSC_CLSHUTDOWN, ""); + + SSL_CTX_free(rpctls_ctx); + EVP_cleanup(); + return (0); +} + +bool_t +rpctlscd_null_1_svc(__unused void *argp, __unused void *result, + __unused struct svc_req *rqstp) +{ + + rpctls_verbose_out("rpctlscd_null: done\n"); + return (TRUE); +} + +bool_t +rpctlscd_connect_1_svc(struct rpctlscd_connect_arg *argp, + struct rpctlscd_connect_res *result, __unused struct svc_req *rqstp) +{ + int s; + SSL *ssl; + struct ssl_entry *newslp; + X509 *cert; + + rpctls_verbose_out("rpctlsd_connect: started\n"); + /* Get the socket fd from the kernel. */ + s = rpctls_syscall(RPCTLS_SYSC_CLSOCKET, ""); + if (s < 0) { + result->reterr = RPCTLSERR_NOSOCKET; + return (TRUE); + } + + /* Do a TLS connect handshake. */ + ssl = rpctls_connect(rpctls_ctx, s, argp->certname.certname_val, + argp->certname.certname_len, &cert); + if (ssl == NULL) { + rpctls_verbose_out("rpctlsd_connect: can't do TLS " + "handshake\n"); + result->reterr = RPCTLSERR_NOSSL; + } else { + result->reterr = RPCTLSERR_OK; + result->sec = rpctls_ssl_sec; + result->usec = rpctls_ssl_usec; + result->ssl = ++rpctls_ssl_refno; + /* Hard to believe this will ever wrap around.. */ + if (rpctls_ssl_refno == 0) + result->ssl = ++rpctls_ssl_refno; + } + + if (ssl == NULL) { + /* + * For RPC-over-TLS, this upcall is expected + * to close off the socket. + */ + close(s); + return (TRUE); + } + + /* Maintain list of all current SSL *'s */ + newslp = malloc(sizeof(*newslp)); + newslp->refno = rpctls_ssl_refno; + newslp->s = s; + newslp->shutoff = false; + newslp->ssl = ssl; + newslp->cert = cert; + LIST_INSERT_HEAD(&rpctls_ssllist, newslp, next); + return (TRUE); +} + +bool_t +rpctlscd_handlerecord_1_svc(struct rpctlscd_handlerecord_arg *argp, + struct rpctlscd_handlerecord_res *result, __unused struct svc_req *rqstp) +{ + struct ssl_entry *slp; + int ret; + char junk; + + slp = NULL; + if (argp->sec == rpctls_ssl_sec && argp->usec == + rpctls_ssl_usec) { + LIST_FOREACH(slp, &rpctls_ssllist, next) { + if (slp->refno == argp->ssl) + break; + } + } + + if (slp != NULL) { + rpctls_verbose_out("rpctlscd_handlerecord fd=%d\n", + slp->s); + /* + * An SSL_read() of 0 bytes should fail, but it should + * handle the non-application data record before doing so. + */ + ret = SSL_read(slp->ssl, &junk, 0); + if (ret <= 0) { + /* Check to see if this was a close alert. */ + ret = SSL_get_shutdown(slp->ssl); + if ((ret & (SSL_SENT_SHUTDOWN | + SSL_RECEIVED_SHUTDOWN)) == SSL_RECEIVED_SHUTDOWN) + SSL_shutdown(slp->ssl); + } else { + if (rpctls_debug_level == 0) + syslog(LOG_ERR, "SSL_read returned %d", ret); + else + fprintf(stderr, "SSL_read returned %d\n", ret); + } + result->reterr = RPCTLSERR_OK; + } else + result->reterr = RPCTLSERR_NOSSL; + return (TRUE); +} + +bool_t +rpctlscd_disconnect_1_svc(struct rpctlscd_disconnect_arg *argp, + struct rpctlscd_disconnect_res *result, __unused struct svc_req *rqstp) +{ + struct ssl_entry *slp; + int ret; + + slp = NULL; + if (argp->sec == rpctls_ssl_sec && argp->usec == + rpctls_ssl_usec) { + LIST_FOREACH(slp, &rpctls_ssllist, next) { + if (slp->refno == argp->ssl) + break; + } + } + + if (slp != NULL) { + rpctls_verbose_out("rpctlscd_disconnect: fd=%d closed\n", + slp->s); + LIST_REMOVE(slp, next); + if (!slp->shutoff) { + ret = SSL_get_shutdown(slp->ssl); + /* + * Do an SSL_shutdown() unless a close alert has + * already been sent. + */ + if ((ret & SSL_SENT_SHUTDOWN) == 0) + SSL_shutdown(slp->ssl); + } + SSL_free(slp->ssl); + if (slp->cert != NULL) + X509_free(slp->cert); + /* + * For RPC-over-TLS, this upcall is expected + * to close off the socket. + */ + if (!slp->shutoff) + shutdown(slp->s, SHUT_WR); + close(slp->s); + free(slp); + result->reterr = RPCTLSERR_OK; + } else + result->reterr = RPCTLSERR_NOCLOSE; + return (TRUE); +} + +int +rpctlscd_1_freeresult(__unused SVCXPRT *transp, __unused xdrproc_t xdr_result, + __unused caddr_t result) +{ + + return (TRUE); +} + +static void +rpctlscd_terminate(int sig __unused) +{ + + rpctls_syscall(RPCTLS_SYSC_CLSHUTDOWN, ""); + pidfile_remove(rpctls_pfh); + exit(0); +} + +static SSL_CTX * +rpctls_setupcl_ssl(void) +{ + SSL_CTX *ctx; + long flags; + char path[PATH_MAX]; + size_t len, rlen; + int ret; + + SSL_library_init(); + SSL_load_error_strings(); + OpenSSL_add_all_algorithms(); + + ctx = SSL_CTX_new(TLS_client_method()); + if (ctx == NULL) { + rpctls_verbose_out("rpctls_setupcl_ssl: SSL_CTX_new " + "failed\n"); + return (NULL); + } + SSL_CTX_set_ecdh_auto(ctx, 1); + + if (rpctls_ciphers != NULL) { + /* + * Set preferred ciphers, since KERN_TLS only supports a + * few of them. + */ + ret = SSL_CTX_set_cipher_list(ctx, rpctls_ciphers); + if (ret == 0) { + rpctls_verbose_out("rpctls_setupcl_ssl: " + "SSL_CTX_set_cipher_list failed: %s\n", + rpctls_ciphers); + SSL_CTX_free(ctx); + return (NULL); + } + } + + /* + * If rpctls_cert is true, a certificate and key exists in + * rpctls_certdir, so that it can do mutual authentication. + */ + if (rpctls_cert) { + /* Get the cert.pem and certkey.pem files. */ + len = strlcpy(path, rpctls_certdir, sizeof(path)); + rlen = sizeof(path) - len; + if (strlcpy(&path[len], "cert.pem", rlen) != 8) { + SSL_CTX_free(ctx); + return (NULL); + } + ret = SSL_CTX_use_certificate_file(ctx, path, + SSL_FILETYPE_PEM); + if (ret != 1) { + rpctls_verbose_out("rpctls_setupcl_ssl: can't use " + "certificate file path=%s ret=%d\n", path, ret); + SSL_CTX_free(ctx); + return (NULL); + } + if (strlcpy(&path[len], "certkey.pem", rlen) != 11) { + SSL_CTX_free(ctx); + return (NULL); + } + ret = SSL_CTX_use_PrivateKey_file(ctx, path, + SSL_FILETYPE_PEM); + if (ret != 1) { + rpctls_verbose_out("rpctls_setupcl_ssl: Can't use " + "private key path=%s ret=%d\n", path, ret); + SSL_CTX_free(ctx); + return (NULL); + } + } + + if (rpctls_verify_cafile != NULL || rpctls_verify_capath != NULL) { + if (rpctls_crlfile != NULL) { + ret = rpctls_loadcrlfile(ctx); + if (ret == 0) { + rpctls_verbose_out("rpctls_setupcl_ssl: " + "Load CRLfile failed\n"); + SSL_CTX_free(ctx); + return (NULL); + } + } +#if OPENSSL_VERSION_NUMBER >= 0x30000000 + ret = 1; + if (rpctls_verify_cafile != NULL) + ret = SSL_CTX_load_verify_file(ctx, + rpctls_verify_cafile); + if (ret != 0 && rpctls_verify_capath != NULL) + ret = SSL_CTX_load_verify_dir(ctx, + rpctls_verify_capath); +#else + ret = SSL_CTX_load_verify_locations(ctx, + rpctls_verify_cafile, rpctls_verify_capath); +#endif + if (ret == 0) { + rpctls_verbose_out("rpctls_setupcl_ssl: " + "Can't load verify locations\n"); + SSL_CTX_free(ctx); + return (NULL); + } + /* + * The man page says that the + * SSL_CTX_set0_CA_list() call is not normally + * needed, but I believe it is harmless. + */ + if (rpctls_verify_cafile != NULL) + SSL_CTX_set0_CA_list(ctx, + SSL_load_client_CA_file(rpctls_verify_cafile)); + } + + /* RPC-over-TLS must use TLSv1.3, according to the IETF draft.*/ +#ifdef notyet + flags = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | + SSL_OP_NO_TLSv1_1 | SSL_OP_NO_TLSv1_2; +#else + flags = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1_3; +#endif + SSL_CTX_set_options(ctx, flags); + SSL_CTX_clear_mode(ctx, SSL_MODE_NO_KTLS_TX | SSL_MODE_NO_KTLS_RX); + return (ctx); +} + +static SSL * +rpctls_connect(SSL_CTX *ctx, int s, char *certname, u_int certlen, X509 **certp) +{ + SSL *ssl; + X509 *cert; + struct sockaddr_storage ad; + struct sockaddr *sad; + char hostnam[NI_MAXHOST], path[PATH_MAX]; + int gethostret, ret; + char *cp, *cp2; + size_t len, rlen; + long verfret; + + *certp = NULL; + sad = (struct sockaddr *)&ad; + ssl = SSL_new(ctx); + if (ssl == NULL) { + rpctls_verbose_out("rpctls_connect: " + "SSL_new failed\n"); + return (NULL); + } + if (SSL_set_fd(ssl, s) != 1) { + rpctls_verbose_out("rpctls_connect: " + "SSL_set_fd failed\n"); + SSL_free(ssl); + return (NULL); + } + + /* + * If rpctls_cert is true and certname is set, a alternate certificate + * and key exists in files named .pem and key.pem + * in rpctls_certdir that is to be used for mutual authentication. + */ + if (rpctls_cert && certlen > 0) { + len = strlcpy(path, rpctls_certdir, sizeof(path)); + rlen = sizeof(path) - len; + if (rlen <= certlen) { + SSL_free(ssl); + return (NULL); + } + memcpy(&path[len], certname, certlen); + rlen -= certlen; + len += certlen; + path[len] = '\0'; + if (strlcpy(&path[len], ".pem", rlen) != 4) { + SSL_free(ssl); + return (NULL); + } + ret = SSL_use_certificate_file(ssl, path, SSL_FILETYPE_PEM); + if (ret != 1) { + rpctls_verbose_out("rpctls_connect: can't use " + "certificate file path=%s ret=%d\n", path, ret); + SSL_free(ssl); + return (NULL); + } + if (strlcpy(&path[len], "key.pem", rlen) != 7) { + SSL_free(ssl); + return (NULL); + } + ret = SSL_use_PrivateKey_file(ssl, path, SSL_FILETYPE_PEM); + if (ret != 1) { + rpctls_verbose_out("rpctls_connect: Can't use " + "private key path=%s ret=%d\n", path, ret); + SSL_free(ssl); + return (NULL); + } + } + + ret = SSL_connect(ssl); + if (ret != 1) { + rpctls_verbose_out("rpctls_connect: " + "SSL_connect failed %d\n", + ret); + SSL_free(ssl); + return (NULL); + } + + cert = SSL_get_peer_certificate(ssl); + if (cert == NULL) { + rpctls_verbose_out("rpctls_connect: get peer" + " certificate failed\n"); + SSL_free(ssl); + return (NULL); + } + gethostret = rpctls_gethost(s, sad, hostnam, sizeof(hostnam)); + if (gethostret == 0) + hostnam[0] = '\0'; + verfret = SSL_get_verify_result(ssl); + if (verfret == X509_V_OK && (rpctls_verify_cafile != NULL || + rpctls_verify_capath != NULL) && (gethostret == 0 || + rpctls_checkhost(sad, cert, X509_CHECK_FLAG_NO_WILDCARDS) != 1)) + verfret = X509_V_ERR_HOSTNAME_MISMATCH; + if (verfret != X509_V_OK && (rpctls_verify_cafile != NULL || + rpctls_verify_capath != NULL)) { + if (verfret != X509_V_OK) { + cp = X509_NAME_oneline(X509_get_issuer_name(cert), + NULL, 0); + cp2 = X509_NAME_oneline(X509_get_subject_name(cert), + NULL, 0); + if (rpctls_debug_level == 0) + syslog(LOG_INFO | LOG_DAEMON, + "rpctls_connect: client IP %s " + "issuerName=%s subjectName=%s verify " + "failed %s\n", hostnam, cp, cp2, + X509_verify_cert_error_string(verfret)); + else + fprintf(stderr, *** 1698 LINES SKIPPED *** From owner-dev-commits-src-branches@freebsd.org Fri Mar 5 21:57: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 EB23D5695F7; Fri, 5 Mar 2021 21:57: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 4DshRf6KGfz3ndc; Fri, 5 Mar 2021 21:57: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 BD4CB18128; Fri, 5 Mar 2021 21:57: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 125LvYUi090825; Fri, 5 Mar 2021 21:57:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 125LvYHB090824; Fri, 5 Mar 2021 21:57:34 GMT (envelope-from git) Date: Fri, 5 Mar 2021 21:57:34 GMT Message-Id: <202103052157.125LvYHB090824@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 59f6f5e23c1a - stable/13 - nfs-over-tls: add rc scripts for rpc.tlsclntd and rpc.tlsservd MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 59f6f5e23c1a33ce0b335b52870fdd9c0223284a 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 Mar 2021 21:57:35 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=59f6f5e23c1a33ce0b335b52870fdd9c0223284a commit 59f6f5e23c1a33ce0b335b52870fdd9c0223284a Author: Rick Macklem AuthorDate: 2021-02-18 22:38:01 +0000 Commit: Rick Macklem CommitDate: 2021-03-05 21:55:44 +0000 nfs-over-tls: add rc scripts for rpc.tlsclntd and rpc.tlsservd Add rc.d scripts that control the recently committed rpc.tlsclntd(8) and rpc.tlsservd(8) daemons. (cherry picked from commit 2f48313ab26ef257ca8d46052a33fb6ad6abdb4f) --- libexec/rc/rc.conf | 4 ++++ libexec/rc/rc.d/Makefile | 4 ++++ libexec/rc/rc.d/tlsclntd | 21 +++++++++++++++++++++ libexec/rc/rc.d/tlsservd | 25 +++++++++++++++++++++++++ 4 files changed, 54 insertions(+) diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf index 56d6bb30f811..53bd8c81c2d7 100644 --- a/libexec/rc/rc.conf +++ b/libexec/rc/rc.conf @@ -385,6 +385,10 @@ nfscbd_enable="NO" # NFSv4 client side callback daemon nfscbd_flags="" # Flags for nfscbd nfsuserd_enable="NO" # NFSv4 user/group name mapping daemon nfsuserd_flags="" # Flags for nfsuserd +tlsclntd_enable="NO" # Run rpc.tlsclntd needed for NFS-over-TLS mount +tlsclntd_flags="" # Flags for rpc.tlsclntd +tlsservd_enable="NO" # Run rpc.tlsservd needed for NFS-over-TLS nfsd +tlsservd_flags="" # Flags for rpc.tlsservd ### Network Time Services options: ### timed_enable="NO" # Run the time daemon (or NO). diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile index a8277e08932c..1a61e89aa215 100644 --- a/libexec/rc/rc.d/Makefile +++ b/libexec/rc/rc.d/Makefile @@ -271,6 +271,10 @@ _opensm= opensm .if ${MK_OPENSSL} != "no" CONFS+= keyserv +.if ${MK_OPENSSL_KTLS} != "no" +CONFS+= tlsclntd \ + tlsservd +.endif .endif .if ${MK_OPENSSH} != "no" diff --git a/libexec/rc/rc.d/tlsclntd b/libexec/rc/rc.d/tlsclntd new file mode 100755 index 000000000000..4566ceb67abd --- /dev/null +++ b/libexec/rc/rc.d/tlsclntd @@ -0,0 +1,21 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: tlsclntd +# REQUIRE: NETWORKING root mountcritlocal sysctl +# BEFORE: nfscbd +# KEYWORD: nojail shutdown + +. /etc/rc.subr + +name="tlsclntd" +desc="NFS over TLS client side daemon" +rcvar="tlsclntd_enable" +command="/usr/sbin/rpc.${name}" +pidfile="/var/run/rpc.${name}.pid" + +load_rc_config $name + +run_rc_command "$1" diff --git a/libexec/rc/rc.d/tlsservd b/libexec/rc/rc.d/tlsservd new file mode 100755 index 000000000000..cca28ed60ffe --- /dev/null +++ b/libexec/rc/rc.d/tlsservd @@ -0,0 +1,25 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: tlsservd +# REQUIRE: NETWORKING root mountcritlocal sysctl +# BEFORE: nfsd +# KEYWORD: nojail shutdown + +. /etc/rc.subr + +name="tlsservd" +desc="NFS over TLS server side daemon" +rcvar="tlsservd_enable" +command="/usr/sbin/rpc.${name}" + +pidfile="/var/run/rpc.${name}.pid" +required_files="/etc/rpc.tlsservd/cert.pem /etc/rpc.tlsservd/certkey.pem" +extra_commands="reload" + + +load_rc_config $name + +run_rc_command "$1" From owner-dev-commits-src-branches@freebsd.org Sat Mar 6 01:12: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 5421856D9E9; Sat, 6 Mar 2021 01:12: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 4Dsmmf1B0nz4V3F; Sat, 6 Mar 2021 01:12: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 BAA611A7DA; Sat, 6 Mar 2021 01:12: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 1261CXRO053500; Sat, 6 Mar 2021 01:12:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1261CXqi053499; Sat, 6 Mar 2021 01:12:33 GMT (envelope-from git) Date: Sat, 6 Mar 2021 01:12:33 GMT Message-Id: <202103060112.1261CXqi053499@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: b5920128c7eb - stable/13 - growfs: allow operation on RW-mounted filesystems 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: b5920128c7ebcf5060605928263a54b31b317993 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 Mar 2021 01:12:34 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=b5920128c7ebcf5060605928263a54b31b317993 commit b5920128c7ebcf5060605928263a54b31b317993 Author: Ed Maste AuthorDate: 2021-03-02 22:35:48 +0000 Commit: Ed Maste CommitDate: 2021-03-06 01:12:12 +0000 growfs: allow operation on RW-mounted filesystems growfs supports growing mounted filesystems (writes are temporarily suspended while the grow happens). Drop the check for fs_clean == 0 to restore this case. Leave fs_flags check for FS_UNCLEAN or FS_NEEDSFSCK which represent the state of the filesystem when it was mounted, and fsck should be run first if they are set. PR: 253754 Reviewed by: mckusick Fixes: 6eb925f8450f ("Filesystem utilities that modify the...") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29021 (cherry picked from commit 0dcde5cc12744e5188300711a8829e5e6a9cd0de) --- sbin/growfs/growfs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c index d1098210f088..510192dada0b 100644 --- a/sbin/growfs/growfs.c +++ b/sbin/growfs/growfs.c @@ -1461,10 +1461,9 @@ main(int argc, char **argv) } } /* - * Check for unclean filesystem. + * Check for filesystem that was unclean at mount time. */ - if (fs->fs_clean == 0 || - (fs->fs_flags & (FS_UNCLEAN | FS_NEEDSFSCK)) != 0) + if ((fs->fs_flags & (FS_UNCLEAN | FS_NEEDSFSCK)) != 0) errx(1, "%s is not clean - run fsck.\n", *argv); memcpy(&osblock, fs, fs->fs_sbsize); free(fs); From owner-dev-commits-src-branches@freebsd.org Sat Mar 6 01:13:29 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 AE69356DEC0; Sat, 6 Mar 2021 01:13:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dsmnj4cCHz4VtX; Sat, 6 Mar 2021 01:13:29 +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 8F33D1A7DF; Sat, 6 Mar 2021 01:13:29 +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 1261DTRb053758; Sat, 6 Mar 2021 01:13:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1261DTUV053757; Sat, 6 Mar 2021 01:13:29 GMT (envelope-from git) Date: Sat, 6 Mar 2021 01:13:29 GMT Message-Id: <202103060113.1261DTUV053757@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: 56d80e35a333 - stable/12 - growfs: allow operation on RW-mounted filesystems 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: 56d80e35a3338e10e7670823f264cd82443c9d1e 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 Mar 2021 01:13:29 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=56d80e35a3338e10e7670823f264cd82443c9d1e commit 56d80e35a3338e10e7670823f264cd82443c9d1e Author: Ed Maste AuthorDate: 2021-03-02 22:35:48 +0000 Commit: Ed Maste CommitDate: 2021-03-06 01:13:09 +0000 growfs: allow operation on RW-mounted filesystems growfs supports growing mounted filesystems (writes are temporarily suspended while the grow happens). Drop the check for fs_clean == 0 to restore this case. Leave fs_flags check for FS_UNCLEAN or FS_NEEDSFSCK which represent the state of the filesystem when it was mounted, and fsck should be run first if they are set. PR: 253754 Reviewed by: mckusick Fixes: 6eb925f8450f ("Filesystem utilities that modify the...") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29021 (cherry picked from commit 0dcde5cc12744e5188300711a8829e5e6a9cd0de) --- sbin/growfs/growfs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c index 919ce86cc7b6..d1e42ed7c3d0 100644 --- a/sbin/growfs/growfs.c +++ b/sbin/growfs/growfs.c @@ -1443,10 +1443,9 @@ main(int argc, char **argv) } } /* - * Check for unclean filesystem. + * Check for filesystem that was unclean at mount time. */ - if (fs->fs_clean == 0 || - (fs->fs_flags & (FS_UNCLEAN | FS_NEEDSFSCK)) != 0) + if ((fs->fs_flags & (FS_UNCLEAN | FS_NEEDSFSCK)) != 0) errx(1, "%s is not clean - run fsck.\n", *argv); memcpy(&osblock, fs, fs->fs_sbsize); free(fs); From owner-dev-commits-src-branches@freebsd.org Sat Mar 6 01:44: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 7A03F56FC98; Sat, 6 Mar 2021 01:44: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 4DsnSx34Qpz4Yf8; Sat, 6 Mar 2021 01:44: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 5BCB51AF2F; Sat, 6 Mar 2021 01:44: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 1261i15U093307; Sat, 6 Mar 2021 01:44:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1261i1UM093306; Sat, 6 Mar 2021 01:44:01 GMT (envelope-from git) Date: Sat, 6 Mar 2021 01:44:01 GMT Message-Id: <202103060144.1261i1UM093306@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 0bdc21952ae6 - stable/11 - arcmsr(4): Fixed no action of hot plugging device on type_F adapter. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 0bdc21952ae606b9f33fc455986f5a8cc61ab189 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 Mar 2021 01:44:01 -0000 The branch stable/11 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=0bdc21952ae606b9f33fc455986f5a8cc61ab189 commit 0bdc21952ae606b9f33fc455986f5a8cc61ab189 Author: Xin LI AuthorDate: 2021-03-03 06:57:20 +0000 Commit: Xin LI CommitDate: 2021-03-06 01:43:42 +0000 arcmsr(4): Fixed no action of hot plugging device on type_F adapter. Many thanks to Areca for continuing to support FreeBSD. Submitted by: 黃清隆 MFC after: 3 days (cherry picked from commit 5842073a9b7471831e0da48d29dd984d575f4e9e) --- sys/dev/arcmsr/arcmsr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/arcmsr/arcmsr.c b/sys/dev/arcmsr/arcmsr.c index e228f358f480..c2027eb8e987 100644 --- a/sys/dev/arcmsr/arcmsr.c +++ b/sys/dev/arcmsr/arcmsr.c @@ -80,6 +80,7 @@ ** 1.40.00.00 07/11/2017 Ching Huang Added support ARC1884 ** 1.40.00.01 10/30/2017 Ching Huang Fixed release memory resource ** 1.50.00.00 09/30/2020 Ching Huang Added support ARC-1886, NVMe/SAS/SATA controller +** 1.50.00.01 02/26/2021 Ching Huang Fixed no action of hot plugging device on type_F adapter ****************************************************************************************** */ @@ -137,7 +138,7 @@ __FBSDID("$FreeBSD$"); #define arcmsr_callout_init(a) callout_init(a, /*mpsafe*/1); -#define ARCMSR_DRIVER_VERSION "arcmsr version 1.50.00.00 2020-09-30" +#define ARCMSR_DRIVER_VERSION "arcmsr version 1.50.00.01 2021-02-26" #include /* ************************************************************************** @@ -1901,7 +1902,10 @@ static void arcmsr_hbe_message_isr(struct AdapterControlBlock *acb) { u_int32_t outbound_message; CHIP_REG_WRITE32(HBE_MessageUnit, 0, host_int_status, 0); - outbound_message = CHIP_REG_READ32(HBE_MessageUnit, 0, msgcode_rwbuffer[0]); + if (acb->adapter_type == ACB_ADAPTER_TYPE_E) + outbound_message = CHIP_REG_READ32(HBE_MessageUnit, 0, msgcode_rwbuffer[0]); + else + outbound_message = acb->msgcode_rwbuffer[0]; if (outbound_message == ARCMSR_SIGNATURE_GET_CONFIG) arcmsr_dr_handle( acb ); } From owner-dev-commits-src-branches@freebsd.org Sat Mar 6 01:45: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 9148356FEEE; Sat, 6 Mar 2021 01:45: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 4DsnVT3hW8z4Ylh; Sat, 6 Mar 2021 01:45: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 6708F1ADD7; Sat, 6 Mar 2021 01:45: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 1261jLFk093628; Sat, 6 Mar 2021 01:45:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1261jLl4093627; Sat, 6 Mar 2021 01:45:21 GMT (envelope-from git) Date: Sat, 6 Mar 2021 01:45:21 GMT Message-Id: <202103060145.1261jLl4093627@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 0824ed18916c - stable/12 - arcmsr(4): Fixed no action of hot plugging device on type_F adapter. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 0824ed18916cf8310adf4d4754d1de7746f75d53 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 Mar 2021 01:45:21 -0000 The branch stable/12 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=0824ed18916cf8310adf4d4754d1de7746f75d53 commit 0824ed18916cf8310adf4d4754d1de7746f75d53 Author: Xin LI AuthorDate: 2021-03-03 06:57:20 +0000 Commit: Xin LI CommitDate: 2021-03-06 01:45:02 +0000 arcmsr(4): Fixed no action of hot plugging device on type_F adapter. Many thanks to Areca for continuing to support FreeBSD. Submitted by: 黃清隆 MFC after: 3 days (cherry picked from commit 5842073a9b7471831e0da48d29dd984d575f4e9e) --- sys/dev/arcmsr/arcmsr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/arcmsr/arcmsr.c b/sys/dev/arcmsr/arcmsr.c index 8a250da05cab..16fe5ee959e6 100644 --- a/sys/dev/arcmsr/arcmsr.c +++ b/sys/dev/arcmsr/arcmsr.c @@ -82,6 +82,7 @@ ** 1.40.00.00 07/11/2017 Ching Huang Added support ARC1884 ** 1.40.00.01 10/30/2017 Ching Huang Fixed release memory resource ** 1.50.00.00 09/30/2020 Ching Huang Added support ARC-1886, NVMe/SAS/SATA controller +** 1.50.00.01 02/26/2021 Ching Huang Fixed no action of hot plugging device on type_F adapter ****************************************************************************************** */ @@ -139,7 +140,7 @@ __FBSDID("$FreeBSD$"); #define arcmsr_callout_init(a) callout_init(a, /*mpsafe*/1); -#define ARCMSR_DRIVER_VERSION "arcmsr version 1.50.00.00 2020-09-30" +#define ARCMSR_DRIVER_VERSION "arcmsr version 1.50.00.01 2021-02-26" #include /* ************************************************************************** @@ -1903,7 +1904,10 @@ static void arcmsr_hbe_message_isr(struct AdapterControlBlock *acb) { u_int32_t outbound_message; CHIP_REG_WRITE32(HBE_MessageUnit, 0, host_int_status, 0); - outbound_message = CHIP_REG_READ32(HBE_MessageUnit, 0, msgcode_rwbuffer[0]); + if (acb->adapter_type == ACB_ADAPTER_TYPE_E) + outbound_message = CHIP_REG_READ32(HBE_MessageUnit, 0, msgcode_rwbuffer[0]); + else + outbound_message = acb->msgcode_rwbuffer[0]; if (outbound_message == ARCMSR_SIGNATURE_GET_CONFIG) arcmsr_dr_handle( acb ); } From owner-dev-commits-src-branches@freebsd.org Sat Mar 6 01:46: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 B4313570106; Sat, 6 Mar 2021 01:46:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DsnWN4ldjz4YkH; Sat, 6 Mar 2021 01:46: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 95D3F1AEDB; Sat, 6 Mar 2021 01:46: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 1261k84f093861; Sat, 6 Mar 2021 01:46:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1261k8gh093860; Sat, 6 Mar 2021 01:46:08 GMT (envelope-from git) Date: Sat, 6 Mar 2021 01:46:08 GMT Message-Id: <202103060146.1261k8gh093860@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: e298c1c3c257 - stable/13 - arcmsr(4): Fixed no action of hot plugging device on type_F adapter. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e298c1c3c257446eba06945a0b4755ca30387012 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 Mar 2021 01:46:08 -0000 The branch stable/13 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=e298c1c3c257446eba06945a0b4755ca30387012 commit e298c1c3c257446eba06945a0b4755ca30387012 Author: Xin LI AuthorDate: 2021-03-03 06:57:20 +0000 Commit: Xin LI CommitDate: 2021-03-06 01:46:04 +0000 arcmsr(4): Fixed no action of hot plugging device on type_F adapter. Many thanks to Areca for continuing to support FreeBSD. Submitted by: 黃清隆 MFC after: 3 days (cherry picked from commit 5842073a9b7471831e0da48d29dd984d575f4e9e) --- sys/dev/arcmsr/arcmsr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/arcmsr/arcmsr.c b/sys/dev/arcmsr/arcmsr.c index cba2a956ff37..f2217deb1ce0 100644 --- a/sys/dev/arcmsr/arcmsr.c +++ b/sys/dev/arcmsr/arcmsr.c @@ -82,6 +82,7 @@ ** 1.40.00.00 07/11/2017 Ching Huang Added support ARC1884 ** 1.40.00.01 10/30/2017 Ching Huang Fixed release memory resource ** 1.50.00.00 09/30/2020 Ching Huang Added support ARC-1886, NVMe/SAS/SATA controller +** 1.50.00.01 02/26/2021 Ching Huang Fixed no action of hot plugging device on type_F adapter ****************************************************************************************** */ @@ -139,7 +140,7 @@ __FBSDID("$FreeBSD$"); #define arcmsr_callout_init(a) callout_init(a, /*mpsafe*/1); -#define ARCMSR_DRIVER_VERSION "arcmsr version 1.50.00.00 2020-09-30" +#define ARCMSR_DRIVER_VERSION "arcmsr version 1.50.00.01 2021-02-26" #include /* ************************************************************************** @@ -1902,7 +1903,10 @@ static void arcmsr_hbe_message_isr(struct AdapterControlBlock *acb) { u_int32_t outbound_message; CHIP_REG_WRITE32(HBE_MessageUnit, 0, host_int_status, 0); - outbound_message = CHIP_REG_READ32(HBE_MessageUnit, 0, msgcode_rwbuffer[0]); + if (acb->adapter_type == ACB_ADAPTER_TYPE_E) + outbound_message = CHIP_REG_READ32(HBE_MessageUnit, 0, msgcode_rwbuffer[0]); + else + outbound_message = acb->msgcode_rwbuffer[0]; if (outbound_message == ARCMSR_SIGNATURE_GET_CONFIG) arcmsr_dr_handle( acb ); } From owner-dev-commits-src-branches@freebsd.org Sat Mar 6 02:07: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 9753C5703ED; Sat, 6 Mar 2021 02:07: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 4DsnzW3gJ0z4bHp; Sat, 6 Mar 2021 02:07: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 70C061B3BE; Sat, 6 Mar 2021 02:07: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 1262739h021345; Sat, 6 Mar 2021 02:07:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 126273wA021344; Sat, 6 Mar 2021 02:07:03 GMT (envelope-from git) Date: Sat, 6 Mar 2021 02:07:03 GMT Message-Id: <202103060207.126273wA021344@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: a552da13fc8f - stable/13 - kcsan: add atomic_interrupt_fence 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: a552da13fc8f803ffc51755436441f3c14e3c817 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 Mar 2021 02:07:03 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a552da13fc8f803ffc51755436441f3c14e3c817 commit a552da13fc8f803ffc51755436441f3c14e3c817 Author: Mateusz Guzik AuthorDate: 2021-03-01 07:42:15 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-06 02:06:55 +0000 kcsan: add atomic_interrupt_fence (cherry picked from commit 2c1c1255e41ac3fecd79f9f704c934642f34fd60) --- sys/sys/_cscan_atomic.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/sys/_cscan_atomic.h b/sys/sys/_cscan_atomic.h index aed96580e1e4..b458c24841bf 100644 --- a/sys/sys/_cscan_atomic.h +++ b/sys/sys/_cscan_atomic.h @@ -373,6 +373,7 @@ void kcsan_atomic_thread_fence_seq_cst(void); #define atomic_thread_fence_acq_rel kcsan_atomic_thread_fence_acq_rel #define atomic_thread_fence_rel kcsan_atomic_thread_fence_rel #define atomic_thread_fence_seq_cst kcsan_atomic_thread_fence_seq_cst +#define atomic_interrupt_fence __compiler_membar #endif /* !KCSAN_RUNTIME */ From owner-dev-commits-src-branches@freebsd.org Sat Mar 6 02:07: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 A9E79570C56; Sat, 6 Mar 2021 02:07: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 4DsnzX4HQWz4bLB; Sat, 6 Mar 2021 02:07: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 864AD1B338; Sat, 6 Mar 2021 02:07: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 126274WN021365; Sat, 6 Mar 2021 02:07:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 126274uN021364; Sat, 6 Mar 2021 02:07:04 GMT (envelope-from git) Date: Sat, 6 Mar 2021 02:07:04 GMT Message-Id: <202103060207.126274uN021364@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: c10e0a4656bf - stable/13 - Use atomic_interrupt_fence() instead of bare __compiler_membar() 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: c10e0a4656bfe650bb3bf46fcf026a8a51a34a69 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 Mar 2021 02:07:04 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c10e0a4656bfe650bb3bf46fcf026a8a51a34a69 commit c10e0a4656bfe650bb3bf46fcf026a8a51a34a69 Author: Konstantin Belousov AuthorDate: 2021-02-26 23:54:17 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-06 02:06:55 +0000 Use atomic_interrupt_fence() instead of bare __compiler_membar() (cherry picked from commit b5449c92b489445635c7962875ce73b2c9211bba) --- sys/kern/kern_rmlock.c | 32 +++++++++++++++----------------- sys/sys/kpilite.h | 5 ++--- sys/sys/mount.h | 4 ++-- sys/sys/sched.h | 4 ++-- sys/sys/systm.h | 6 +++--- 5 files changed, 24 insertions(+), 27 deletions(-) diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c index 9135709d88cf..f661e209b633 100644 --- a/sys/kern/kern_rmlock.c +++ b/sys/kern/kern_rmlock.c @@ -366,7 +366,7 @@ _rm_rlock_hard(struct rmlock *rm, struct rm_priotracker *tracker, int trylock) * Check to see if the IPI granted us the lock after all. The load of * rmp_flags must happen after the tracker is removed from the list. */ - __compiler_membar(); + atomic_interrupt_fence(); if (tracker->rmp_flags) { /* Just add back tracker - we hold the lock. */ rm_tracker_add(pc, tracker); @@ -448,7 +448,7 @@ _rm_rlock(struct rmlock *rm, struct rm_priotracker *tracker, int trylock) td->td_critnest++; /* critical_enter(); */ - __compiler_membar(); + atomic_interrupt_fence(); pc = cpuid_to_pcpu[td->td_oncpu]; /* pcpu_find(td->td_oncpu); */ @@ -456,7 +456,7 @@ _rm_rlock(struct rmlock *rm, struct rm_priotracker *tracker, int trylock) sched_pin(); - __compiler_membar(); + atomic_interrupt_fence(); td->td_critnest--; @@ -873,17 +873,15 @@ db_show_rm(const struct lock_object *lock) * Concurrent writers take turns taking the lock while going off cpu. If this is * of concern for your usecase, this is not the right primitive. * - * Neither rms_rlock nor rms_runlock use fences. Instead compiler barriers are - * inserted to prevert reordering of generated code. Execution ordering is - * provided with the use of an IPI handler. + * Neither rms_rlock nor rms_runlock use thread fences. Instead interrupt + * fences are inserted to ensure ordering with the code executed in the IPI + * handler. * * No attempt is made to track which CPUs read locked at least once, * consequently write locking sends IPIs to all of them. This will become a * problem at some point. The easiest way to lessen it is to provide a bitmap. */ -#define rms_int_membar() __compiler_membar() - #define RMS_NOOWNER ((void *)0x1) #define RMS_TRANSIENT ((void *)0x2) #define RMS_FLAGMASK 0xf @@ -1030,14 +1028,14 @@ rms_rlock(struct rmslock *rms) critical_enter(); pcpu = rms_int_pcpu(rms); rms_int_influx_enter(rms, pcpu); - rms_int_membar(); + atomic_interrupt_fence(); if (__predict_false(rms->writers > 0)) { rms_rlock_fallback(rms); return; } - rms_int_membar(); + atomic_interrupt_fence(); rms_int_readers_inc(rms, pcpu); - rms_int_membar(); + atomic_interrupt_fence(); rms_int_influx_exit(rms, pcpu); critical_exit(); } @@ -1052,15 +1050,15 @@ rms_try_rlock(struct rmslock *rms) critical_enter(); pcpu = rms_int_pcpu(rms); rms_int_influx_enter(rms, pcpu); - rms_int_membar(); + atomic_interrupt_fence(); if (__predict_false(rms->writers > 0)) { rms_int_influx_exit(rms, pcpu); critical_exit(); return (0); } - rms_int_membar(); + atomic_interrupt_fence(); rms_int_readers_inc(rms, pcpu); - rms_int_membar(); + atomic_interrupt_fence(); rms_int_influx_exit(rms, pcpu); critical_exit(); return (1); @@ -1092,14 +1090,14 @@ rms_runlock(struct rmslock *rms) critical_enter(); pcpu = rms_int_pcpu(rms); rms_int_influx_enter(rms, pcpu); - rms_int_membar(); + atomic_interrupt_fence(); if (__predict_false(rms->writers > 0)) { rms_runlock_fallback(rms); return; } - rms_int_membar(); + atomic_interrupt_fence(); rms_int_readers_dec(rms, pcpu); - rms_int_membar(); + atomic_interrupt_fence(); rms_int_influx_exit(rms, pcpu); critical_exit(); } diff --git a/sys/sys/kpilite.h b/sys/sys/kpilite.h index 8742ef5cfbe8..2a7e9743f799 100644 --- a/sys/sys/kpilite.h +++ b/sys/sys/kpilite.h @@ -38,7 +38,7 @@ sched_pin_lite(struct thread_lite *td) KASSERT((struct thread *)td == curthread, ("sched_pin called on non curthread")); td->td_pinned++; - __compiler_membar(); + atomic_interrupt_fence(); } static __inline void @@ -47,9 +47,8 @@ sched_unpin_lite(struct thread_lite *td) KASSERT((struct thread *)td == curthread, ("sched_unpin called on non curthread")); KASSERT(td->td_pinned > 0, ("sched_unpin called on non pinned thread")); - __compiler_membar(); + atomic_interrupt_fence(); td->td_pinned--; - __compiler_membar(); } #endif #endif diff --git a/sys/sys/mount.h b/sys/sys/mount.h index f965dd72d7ba..98d50161bed5 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -1086,7 +1086,7 @@ void resume_all_fs(void); _mpcpu = vfs_mount_pcpu(mp); \ MPASS(mpcpu->mntp_thread_in_ops == 0); \ _mpcpu->mntp_thread_in_ops = 1; \ - __compiler_membar(); \ + atomic_interrupt_fence(); \ if (__predict_false(mp->mnt_vfs_ops > 0)) { \ vfs_op_thread_exit_crit(mp, _mpcpu); \ _retval_crit = false; \ @@ -1106,7 +1106,7 @@ void resume_all_fs(void); #define vfs_op_thread_exit_crit(mp, _mpcpu) do { \ MPASS(_mpcpu == vfs_mount_pcpu(mp)); \ MPASS(_mpcpu->mntp_thread_in_ops == 1); \ - __compiler_membar(); \ + atomic_interrupt_fence(); \ _mpcpu->mntp_thread_in_ops = 0; \ } while (0) diff --git a/sys/sys/sched.h b/sys/sys/sched.h index d734ec61266e..64651ffa9c90 100644 --- a/sys/sys/sched.h +++ b/sys/sys/sched.h @@ -173,13 +173,13 @@ static __inline void sched_pin(void) { curthread->td_pinned++; - __compiler_membar(); + atomic_interrupt_fence(); } static __inline void sched_unpin(void) { - __compiler_membar(); + atomic_interrupt_fence(); curthread->td_pinned--; } diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 5de12e5bc1e5..72a10c401af9 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -284,7 +284,7 @@ critical_enter(void) td = (struct thread_lite *)curthread; td->td_critnest++; - __compiler_membar(); + atomic_interrupt_fence(); } static __inline void @@ -295,9 +295,9 @@ critical_exit(void) td = (struct thread_lite *)curthread; KASSERT(td->td_critnest != 0, ("critical_exit: td_critnest == 0")); - __compiler_membar(); + atomic_interrupt_fence(); td->td_critnest--; - __compiler_membar(); + atomic_interrupt_fence(); if (__predict_false(td->td_owepreempt)) critical_exit_preempt(); From owner-dev-commits-src-branches@freebsd.org Sat Mar 6 04:59: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 49758575010; Sat, 6 Mar 2021 04:59: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 4Dsspm1Mwfz4lY4; Sat, 6 Mar 2021 04:59: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 1E5651D755; Sat, 6 Mar 2021 04:59: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 1264xiFq046432; Sat, 6 Mar 2021 04:59:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1264xiF5046431; Sat, 6 Mar 2021 04:59:44 GMT (envelope-from git) Date: Sat, 6 Mar 2021 04:59:44 GMT Message-Id: <202103060459.1264xiF5046431@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 85ec7f28cba3 - releng/13.0 - arcmsr(4): Fixed no action of hot plugging device on type_F adapter. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 85ec7f28cba326dc1460ada971e85671cf5a6c75 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 Mar 2021 04:59:44 -0000 The branch releng/13.0 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=85ec7f28cba326dc1460ada971e85671cf5a6c75 commit 85ec7f28cba326dc1460ada971e85671cf5a6c75 Author: Xin LI AuthorDate: 2021-03-03 06:57:20 +0000 Commit: Xin LI CommitDate: 2021-03-06 04:59:21 +0000 arcmsr(4): Fixed no action of hot plugging device on type_F adapter. Many thanks to Areca for continuing to support FreeBSD. Submitted by: 黃清隆 Approved by: re (gjb) (cherry picked from commit 5842073a9b7471831e0da48d29dd984d575f4e9e) (cherry picked from commit e298c1c3c257446eba06945a0b4755ca30387012) --- sys/dev/arcmsr/arcmsr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/arcmsr/arcmsr.c b/sys/dev/arcmsr/arcmsr.c index cba2a956ff37..f2217deb1ce0 100644 --- a/sys/dev/arcmsr/arcmsr.c +++ b/sys/dev/arcmsr/arcmsr.c @@ -82,6 +82,7 @@ ** 1.40.00.00 07/11/2017 Ching Huang Added support ARC1884 ** 1.40.00.01 10/30/2017 Ching Huang Fixed release memory resource ** 1.50.00.00 09/30/2020 Ching Huang Added support ARC-1886, NVMe/SAS/SATA controller +** 1.50.00.01 02/26/2021 Ching Huang Fixed no action of hot plugging device on type_F adapter ****************************************************************************************** */ @@ -139,7 +140,7 @@ __FBSDID("$FreeBSD$"); #define arcmsr_callout_init(a) callout_init(a, /*mpsafe*/1); -#define ARCMSR_DRIVER_VERSION "arcmsr version 1.50.00.00 2020-09-30" +#define ARCMSR_DRIVER_VERSION "arcmsr version 1.50.00.01 2021-02-26" #include /* ************************************************************************** @@ -1902,7 +1903,10 @@ static void arcmsr_hbe_message_isr(struct AdapterControlBlock *acb) { u_int32_t outbound_message; CHIP_REG_WRITE32(HBE_MessageUnit, 0, host_int_status, 0); - outbound_message = CHIP_REG_READ32(HBE_MessageUnit, 0, msgcode_rwbuffer[0]); + if (acb->adapter_type == ACB_ADAPTER_TYPE_E) + outbound_message = CHIP_REG_READ32(HBE_MessageUnit, 0, msgcode_rwbuffer[0]); + else + outbound_message = acb->msgcode_rwbuffer[0]; if (outbound_message == ARCMSR_SIGNATURE_GET_CONFIG) arcmsr_dr_handle( acb ); } From owner-dev-commits-src-branches@freebsd.org Sat Mar 6 06:13: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 CBC58552A06; Sat, 6 Mar 2021 06:13: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 4DsvRM5FsKz4ry4; Sat, 6 Mar 2021 06:13: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 A72711E995; Sat, 6 Mar 2021 06:13: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 1266D3tx051171; Sat, 6 Mar 2021 06:13:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1266D3NS051170; Sat, 6 Mar 2021 06:13:03 GMT (envelope-from git) Date: Sat, 6 Mar 2021 06:13:03 GMT Message-Id: <202103060613.1266D3NS051170@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: 9705c012c1f0 - releng/13.0 - Import wireguard fixes from pfSense 2.5 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 9705c012c1f0c7a9ac0f6c8618bebe3e66280a8a 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 Mar 2021 06:13:03 -0000 The branch releng/13.0 has been updated by grehan: URL: https://cgit.FreeBSD.org/src/commit/?id=9705c012c1f0c7a9ac0f6c8618bebe3e66280a8a commit 9705c012c1f0c7a9ac0f6c8618bebe3e66280a8a Author: Peter Grehan AuthorDate: 2021-02-27 04:15:04 +0000 Commit: Peter Grehan CommitDate: 2021-03-06 04:12:29 +0000 Import wireguard fixes from pfSense 2.5 Merge the following fixes from https://github.com/pfsense/FreeBSD-src 1940e7d3 Save address of ingress packets to allow wg to work on HA 8f5531f1 Fix connection to IPv6 endpoint 825ed9ee Fix tcpdump for wg IPv6 rx tunnel traffic 2ec232d3 Fix issue with replying to INITIATION messages in server mode ec77593a Return immediately in wg_init if in DETACH'd state 0f0dde6f Remove unnecessary wg debug printf on transmit 2766dc94 Detect and fix case in wg_init() where sockets weren't cleaned up b62cc7ac Close the UDP tunnel sockets when the interface has been stopped Approved by: re (kib) Obtained from: pfSense 2.5 Relnotes: yes Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 96aabea8bd238b503e949753355dc5b6a857aa9c) --- sys/dev/if_wg/module/if_wg_session.c | 45 +++++++++++++++++++++++++++++++++--- sys/dev/if_wg/module/module.c | 23 ++++++++++++++---- 2 files changed, 60 insertions(+), 8 deletions(-) diff --git a/sys/dev/if_wg/module/if_wg_session.c b/sys/dev/if_wg/module/if_wg_session.c index 54e63d053847..084bc789039d 100644 --- a/sys/dev/if_wg/module/if_wg_session.c +++ b/sys/dev/if_wg/module/if_wg_session.c @@ -1394,8 +1394,8 @@ wg_deliver_in(struct wg_peer *peer) CURVNET_SET(inp->inp_vnet); ip_input(m); CURVNET_RESTORE(); - } else if (version == 6) { - af = AF_INET; + } else if (version == 6) { + af = AF_INET6; BPF_MTAP2(sc->sc_ifp, &af, sizeof(af), m); inp = sotoinpcb(so->so_so6); CURVNET_SET(inp->inp_vnet); @@ -1531,6 +1531,7 @@ wg_handshake(struct wg_softc *sc, struct mbuf *m) peer = CONTAINER_OF(remote, struct wg_peer, p_remote); DPRINTF(sc, "Receiving handshake initiation from peer %llu\n", (unsigned long long)peer->p_id); + wg_peer_set_endpoint_from_tag(peer, t); res = wg_send_response(peer); if (res == 0 && noise_remote_begin_session(&peer->p_remote) == 0) wg_timers_event_session_derived(&peer->p_timers); @@ -1851,6 +1852,40 @@ wg_index_drop(struct wg_softc *sc, uint32_t key0) SLIST_INSERT_HEAD(&peer->p_unused_index, iter, i_unused_entry); } +static int +wg_update_endpoint_addrs(struct wg_endpoint *e, const struct sockaddr *srcsa, + struct ifnet *rcvif) +{ + const struct sockaddr_in *sa4; + const struct sockaddr_in6 *sa6; + int ret = 0; + + /* + * UDP passes a 2-element sockaddr array: first element is the + * source addr/port, second the destination addr/port. + */ + if (srcsa->sa_family == AF_INET) { + sa4 = (const struct sockaddr_in *)srcsa; + e->e_remote.r_sin = sa4[0]; + /* Only update dest if not mcast/bcast */ + if (!(IN_MULTICAST(ntohl(sa4[1].sin_addr.s_addr)) || + sa4[1].sin_addr.s_addr == INADDR_BROADCAST || + in_broadcast(sa4[1].sin_addr, rcvif))) { + e->e_local.l_in = sa4[1].sin_addr; + } + } else if (srcsa->sa_family == AF_INET6) { + sa6 = (const struct sockaddr_in6 *)srcsa; + e->e_remote.r_sin6 = sa6[0]; + /* Only update dest if not multicast */ + if (!IN6_IS_ADDR_MULTICAST(&sa6[1].sin6_addr)) + e->e_local.l_in6 = sa6[1].sin6_addr; + } else { + ret = EAFNOSUPPORT; + } + + return (ret); +} + static void wg_input(struct mbuf *m0, int offset, struct inpcb *inpcb, const struct sockaddr *srcsa, void *_sc) @@ -1882,7 +1917,11 @@ wg_input(struct mbuf *m0, int offset, struct inpcb *inpcb, goto free; } e = wg_mbuf_endpoint_get(m); - e->e_remote.r_sa = *srcsa; + + if (wg_update_endpoint_addrs(e, srcsa, m->m_pkthdr.rcvif)) { + DPRINTF(sc, "unknown family\n"); + goto free; + } verify_endpoint(m); if_inc_counter(sc->sc_ifp, IFCOUNTER_IPACKETS, 1); diff --git a/sys/dev/if_wg/module/module.c b/sys/dev/if_wg/module/module.c index 76c7db01cba1..a40a304616c7 100644 --- a/sys/dev/if_wg/module/module.c +++ b/sys/dev/if_wg/module/module.c @@ -255,7 +255,6 @@ wg_transmit(struct ifnet *ifp, struct mbuf *m) peer = wg_route_lookup(&sc->sc_routes, m, OUT); if (__predict_false(peer == NULL)) { rc = ENOKEY; - printf("peer not found - dropping %p\n", m); /* XXX log */ goto err; } @@ -360,8 +359,15 @@ wg_init(if_ctx_t ctx) struct wg_softc *sc; int rc; + if (iflib_in_detach(ctx)) + return; + sc = iflib_get_softc(ctx); ifp = iflib_get_ifp(ctx); + if (sc->sc_socket.so_so4 != NULL) + printf("XXX wg_init, socket non-NULL %p\n", + sc->sc_socket.so_so4); + wg_socket_reinit(sc, NULL, NULL); rc = wg_socket_init(sc); if (rc) return; @@ -377,6 +383,7 @@ wg_stop(if_ctx_t ctx) sc = iflib_get_softc(ctx); ifp = iflib_get_ifp(ctx); if_link_state_change(ifp, LINK_STATE_DOWN); + wg_socket_reinit(sc, NULL, NULL); } static nvlist_t * @@ -386,13 +393,20 @@ wg_peer_to_nvl(struct wg_peer *peer) int i, count; nvlist_t *nvl; caddr_t key; + size_t sa_sz; struct wg_allowedip *aip; + struct wg_endpoint *ep; if ((nvl = nvlist_create(0)) == NULL) return (NULL); key = peer->p_remote.r_public; nvlist_add_binary(nvl, "public-key", key, WG_KEY_SIZE); - nvlist_add_binary(nvl, "endpoint", &peer->p_endpoint.e_remote, sizeof(struct sockaddr)); + ep = &peer->p_endpoint; + if (ep->e_remote.r_sa.sa_family != 0) { + sa_sz = (ep->e_remote.r_sa.sa_family == AF_INET) ? + sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6); + nvlist_add_binary(nvl, "endpoint", &ep->e_remote, sa_sz); + } i = count = 0; CK_LIST_FOREACH(rt, &peer->p_routes, r_entry) { count++; @@ -587,13 +601,12 @@ wg_peer_add(struct wg_softc *sc, const nvlist_t *nvl) } if (nvlist_exists_binary(nvl, "endpoint")) { endpoint = nvlist_get_binary(nvl, "endpoint", &size); - if (size != sizeof(*endpoint)) { + if (size > sizeof(peer->p_endpoint.e_remote)) { device_printf(dev, "%s bad length for endpoint %zu\n", __func__, size); err = EBADMSG; goto out; } - memcpy(&peer->p_endpoint.e_remote, endpoint, - sizeof(peer->p_endpoint.e_remote)); + memcpy(&peer->p_endpoint.e_remote, endpoint, size); } if (nvlist_exists_binary(nvl, "pre-shared-key")) { const void *key; From owner-dev-commits-src-branches@freebsd.org Sat Mar 6 09:07: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 59EAE55D9F4; Sat, 6 Mar 2021 09:07: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 4DszJT1rlRz3LG1; Sat, 6 Mar 2021 09:07: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 2F57220E64; Sat, 6 Mar 2021 09:07: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 12697LrZ076690; Sat, 6 Mar 2021 09:07:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12697LWC076689; Sat, 6 Mar 2021 09:07:21 GMT (envelope-from git) Date: Sat, 6 Mar 2021 09:07:21 GMT Message-Id: <202103060907.12697LWC076689@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: 99e1b2d79868 - stable/13 - loader_4th: brand image is aligned right 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: 99e1b2d79868eb8bad371b6d4d64fa1aab99fbc4 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 Mar 2021 09:07:21 -0000 The branch stable/13 has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=99e1b2d79868eb8bad371b6d4d64fa1aab99fbc4 commit 99e1b2d79868eb8bad371b6d4d64fa1aab99fbc4 Author: Toomas Soome AuthorDate: 2021-03-06 08:54:08 +0000 Commit: Toomas Soome CommitDate: 2021-03-06 09:06:51 +0000 loader_4th: brand image is aligned right With screen border removed, I forgot to update forth brand image coordinates to avoid image alignment. (cherry picked from commit 6a3095aa6d0350dda89bac66d26f22a01e2257c4) --- stand/forth/brand-fbsd.4th | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/forth/brand-fbsd.4th b/stand/forth/brand-fbsd.4th index b8e43e601c96..84245ef232b6 100644 --- a/stand/forth/brand-fbsd.4th +++ b/stand/forth/brand-fbsd.4th @@ -38,7 +38,7 @@ s" term-putimage" sfind if \ note, we use 0, 0 for image upper left as origin, \ and 0, 7 for lower right to preserve aspect ratio - >r 0 0 0 0 7 + >r 0 1 1 0 7 s" /boot/images/freebsd-brand-rev.png" r> execute if 2drop exit then else From owner-dev-commits-src-branches@freebsd.org Sat Mar 6 09:36: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 7212A55F132; Sat, 6 Mar 2021 09:36:36 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from vtr.rulingia.com (vtr.rulingia.com [IPv6:2001:19f0:5801:ebe:5400:1ff:fe53:30fd]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "vtr.rulingia.com", Issuer "R3" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DszyC2qR6z3N6k; Sat, 6 Mar 2021 09:36:31 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from server.rulingia.com (ppp239-208.static.internode.on.net [59.167.239.208]) by vtr.rulingia.com (8.16.1/8.15.2) with ESMTPS id 1269aNOc066892 (version=TLSv1.3 cipher=AEAD-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 6 Mar 2021 20:36:28 +1100 (AEDT) (envelope-from peter@rulingia.com) DKIM-Filter: OpenDKIM Filter v2.10.3 vtr.rulingia.com 1269aNOc066892 X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.16.1/8.16.1) with ESMTPS id 1269aHsg039531 (version=TLSv1.3 cipher=AEAD-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 6 Mar 2021 20:36:18 +1100 (AEDT) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.16.1/8.16.1/Submit) id 1269aHgI039530; Sat, 6 Mar 2021 20:36:17 +1100 (AEDT) (envelope-from peter) Date: Sat, 6 Mar 2021 20:36:17 +1100 From: Peter Jeremy To: Oleksandr Tymoshenko Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-branches@freebsd.org Subject: Re: git: f76393a6305b - stable/13 - armv8crypto: add AES-GCM support Message-ID: References: <202101230635.10N6Zf9L012423@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="3AtvwTlPa3p/4zAP" Content-Disposition: inline In-Reply-To: <202101230635.10N6Zf9L012423@gitrepo.freebsd.org> X-PGP-Key: http://www.rulingia.com/keys/peter.pgp X-Rspamd-Queue-Id: 4DszyC2qR6z3N6k X-Spamd-Bar: ------ X-Spamd-Result: default: False [-6.10 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[rulingia.com:s=default]; FREEFALL_USER(0.00)[peter]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; R_SPF_ALLOW(-0.20)[+mx]; NEURAL_HAM_LONG(-1.00)[-1.000]; SPAMHAUS_ZRD(0.00)[2001:19f0:5801:ebe:5400:1ff:fe53:30fd:from:127.0.2.255]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[rulingia.com:+]; DMARC_POLICY_ALLOW(-0.50)[rulingia.com,quarantine]; NEURAL_HAM_SHORT(-1.00)[-1.000]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2001:19f0:5801:ebe:5400:1ff:fe53:30fd:from]; ASN(0.00)[asn:20473, ipnet:2001:19f0:5800::/38, country:US]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-branches,dev-commits-src-all] 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 Mar 2021 09:36:36 -0000 --3AtvwTlPa3p/4zAP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2021-Jan-23 06:35:41 +0000, Oleksandr Tymoshenko wro= te: >The branch stable/13 has been updated by gonzo: > >URL: https://cgit.FreeBSD.org/src/commit/?id=3Df76393a6305b67c0f3439ba684c= 5d49a2aafe2a0 > >commit f76393a6305b67c0f3439ba684c5d49a2aafe2a0 >Author: Oleksandr Tymoshenko >AuthorDate: 2021-01-13 06:27:10 +0000 >Commit: Oleksandr Tymoshenko >CommitDate: 2021-01-23 06:34:37 +0000 > > armv8crypto: add AES-GCM support > =20 > Add support for AES-GCM using OpenSSL's accelerated routines. This breaks geli using AES-XTS 128. I have a geli partition last written on 12-stable about a year ago. I can read it successfully on a RockPro64 (RK3399) running 13.0-ALPHA2 (c256201-g02611ef8ee9) but it fails on 13.0-BETA4 (releng/13.0-n244592-e32bc253629) as well as releng/13.0 60e8939aa85b and main 028616d0dd69. If I start with releng/13.0 60e8939aa85b and revert f76393a6305b, the problem goes away. By "fail": geli attaches without issue but the .eli device returns garbage (though the garbage is consistent between reboots). --=20 Peter Jeremy --3AtvwTlPa3p/4zAP Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEE7rKYbDBnHnTmXCJ+FqWXoOSiCzQFAmBDTRFfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEVF QjI5ODZDMzA2NzFFNzRFNjVDMjI3RTE2QTU5N0EwRTRBMjBCMzQACgkQFqWXoOSi CzTDfA//RsGsPQIl42ll++Q4pJugOvVFsfET8J4T0bCX5x5gtU1592oriis3qDZp zVx4VvIZphUryy7hoYLjN3BKpFnlz8BY+RJOIXreRBzT8AQgXRLSHSNs58/hQJCs FO+DQnOkSTdC4rPn1sCnqQuJUhv8+wiK4FnPCq4mNM2BxNa4D710XV0zYFFRBlAJ xVFLYa2Uuf0mmhq8LSFUXlEGgdesYANJ1420IwUBv5lAFxRHn+6SM3jLtDK9OQQV h5OC9bPPRuekqtvpA0RUXzfWf5zKMqaTvufdAOaYA2ct+7A1bEsCOe9HFlKeIHUm fTXOh6f0PHY5Vtp5bBqZL+aDFEzpHkMAi19zKYRKR7kYlwy7vJHd4DBUJJLTlLE8 JpAAQO/r0oA6I3AsdekF9uRHChZko4Hq9dtRgKtimTr1kXZWLTV9ISDmshn9SZZn Cb5EXr6Ky3PUrNifgOd/3WnSDFvXXBERkXw3er9I5TGup2SoSj/6jX3iaRGjWiGv fBNKPV7+mGAX4MuK2E5PZUQbGgo73hvECVGiI654yvYivfpSmEFeXuxi5vqCz696 rDt3qYrc4lNYjqTpy92NlKmSs0G9btGqYtICkK3soDSFAF+Cwhv3hMjLrxZMEZXC H/f2ynnMqeTGe65USA00P8KWCWAcUEFBVb4eR9D7rb3qz/Tdlsk= =eC4u -----END PGP SIGNATURE----- --3AtvwTlPa3p/4zAP-- From owner-dev-commits-src-branches@freebsd.org Sat Mar 6 09:37: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 4D70355F2D1; Sat, 6 Mar 2021 09:37: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 4DszzM1WN1z3NMh; Sat, 6 Mar 2021 09:37: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 1FD2920D65; Sat, 6 Mar 2021 09:37: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 1269bYY4016052; Sat, 6 Mar 2021 09:37:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1269bYJ9016051; Sat, 6 Mar 2021 09:37:34 GMT (envelope-from git) Date: Sat, 6 Mar 2021 09:37:34 GMT Message-Id: <202103060937.1269bYJ9016051@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: bafab32168c8 - releng/13.0 - loader_4th: brand image is aligned right 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: bafab32168c82f979151c912f2c61b100a64b7c8 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 Mar 2021 09:37:35 -0000 The branch releng/13.0 has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=bafab32168c82f979151c912f2c61b100a64b7c8 commit bafab32168c82f979151c912f2c61b100a64b7c8 Author: Toomas Soome AuthorDate: 2021-03-06 08:54:08 +0000 Commit: Toomas Soome CommitDate: 2021-03-06 09:37:16 +0000 loader_4th: brand image is aligned right With screen border removed, I forgot to update forth brand image coordinates to avoid image alignment. (cherry picked from commit 6a3095aa6d0350dda89bac66d26f22a01e2257c4) Approved by: re (delphij) --- stand/forth/brand-fbsd.4th | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/forth/brand-fbsd.4th b/stand/forth/brand-fbsd.4th index b8e43e601c96..84245ef232b6 100644 --- a/stand/forth/brand-fbsd.4th +++ b/stand/forth/brand-fbsd.4th @@ -38,7 +38,7 @@ s" term-putimage" sfind if \ note, we use 0, 0 for image upper left as origin, \ and 0, 7 for lower right to preserve aspect ratio - >r 0 0 0 0 7 + >r 0 1 1 0 7 s" /boot/images/freebsd-brand-rev.png" r> execute if 2drop exit then else From owner-dev-commits-src-branches@freebsd.org Sat Mar 6 19:38: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 9E30157128F; Sat, 6 Mar 2021 19:38:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DtFJs45l6z4l7R; Sat, 6 Mar 2021 19:38: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 7B669E9A; Sat, 6 Mar 2021 19:38: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 126JcbAR007034; Sat, 6 Mar 2021 19:38:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 126JcbeD007033; Sat, 6 Mar 2021 19:38:37 GMT (envelope-from git) Date: Sat, 6 Mar 2021 19:38:37 GMT Message-Id: <202103061938.126JcbeD007033@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jung-uk Kim Subject: git: eda8f0575dda - stable/13 - libkvm: Plug couple of memory leaks and check possible calloc(3) failure MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jkim X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: eda8f0575dda15346116d3be84b205c51c83e20b 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 Mar 2021 19:38:37 -0000 The branch stable/13 has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=eda8f0575dda15346116d3be84b205c51c83e20b commit eda8f0575dda15346116d3be84b205c51c83e20b Author: Jung-uk Kim AuthorDate: 2021-03-03 23:10:00 +0000 Commit: Jung-uk Kim CommitDate: 2021-03-06 19:32:51 +0000 libkvm: Plug couple of memory leaks and check possible calloc(3) failure First, r204494 introduced dpcpu_off in struct __kvm and it was allocated from _kvm_dpcpu_init() but it was not free(3)'ed from kvm_close(3). Second, r291406 introduced kvm_nlist2(3) and converted kvm_nlist(3) to use the new function but it did not free the temporary buffer. Also, check possible calloc(3) failure while I am in the neighborhood. Differential Revision: https://reviews.freebsd.org/D29019 (cherry picked from commit 645eaa2ccaed6eea801d07d6a092974fc1713896) (cherry picked from commit 483c6da3a20b2064cd655f7cb19e6b98dee677ff) --- lib/libkvm/kvm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c index 95c5a580a2dd..b98f2f25e619 100644 --- a/lib/libkvm/kvm.c +++ b/lib/libkvm/kvm.c @@ -297,6 +297,8 @@ kvm_close(kvm_t *kd) free((void *) kd->argspc); if (kd->argv != 0) free((void *)kd->argv); + if (kd->dpcpu_initialized != 0) + free(kd->dpcpu_off); if (kd->pt_map != NULL) free(kd->pt_map); if (kd->page_map != NULL) @@ -340,6 +342,10 @@ kvm_nlist(kvm_t *kd, struct nlist *nl) if (count == 0) return (0); kl = calloc(count + 1, sizeof(*kl)); + if (kl == NULL) { + _kvm_err(kd, kd->program, "cannot allocate memory"); + return (-1); + } for (i = 0; i < count; i++) kl[i].n_name = nl[i].n_name; nfail = kvm_nlist2(kd, kl); @@ -349,6 +355,7 @@ kvm_nlist(kvm_t *kd, struct nlist *nl) nl[i].n_desc = 0; nl[i].n_value = kl[i].n_value; } + free(kl); return (nfail); } From owner-dev-commits-src-branches@freebsd.org Sat Mar 6 19:38: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 4100C5711A1; Sat, 6 Mar 2021 19:38: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 4DtFK22RYvz4lM0; Sat, 6 Mar 2021 19:38:46 +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 1714CE9B; Sat, 6 Mar 2021 19:38: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 126Jci4Y007154; Sat, 6 Mar 2021 19:38:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 126JcimQ007153; Sat, 6 Mar 2021 19:38:44 GMT (envelope-from git) Date: Sat, 6 Mar 2021 19:38:44 GMT Message-Id: <202103061938.126JcimQ007153@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jung-uk Kim Subject: git: 24ee1eb2b680 - stable/12 - libkvm: Plug couple of memory leaks and check possible calloc(3) failure MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jkim X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 24ee1eb2b680b5ee1e6943f6dbc76d98a640d9d8 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 Mar 2021 19:38:47 -0000 The branch stable/12 has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=24ee1eb2b680b5ee1e6943f6dbc76d98a640d9d8 commit 24ee1eb2b680b5ee1e6943f6dbc76d98a640d9d8 Author: Jung-uk Kim AuthorDate: 2021-03-03 23:10:00 +0000 Commit: Jung-uk Kim CommitDate: 2021-03-06 19:35:10 +0000 libkvm: Plug couple of memory leaks and check possible calloc(3) failure First, r204494 introduced dpcpu_off in struct __kvm and it was allocated from _kvm_dpcpu_init() but it was not free(3)'ed from kvm_close(3). Second, r291406 introduced kvm_nlist2(3) and converted kvm_nlist(3) to use the new function but it did not free the temporary buffer. Also, check possible calloc(3) failure while I am in the neighborhood. Differential Revision: https://reviews.freebsd.org/D29019 (cherry picked from commit 645eaa2ccaed6eea801d07d6a092974fc1713896) (cherry picked from commit 483c6da3a20b2064cd655f7cb19e6b98dee677ff) --- lib/libkvm/kvm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c index 2f35f26df1ca..2a148399a211 100644 --- a/lib/libkvm/kvm.c +++ b/lib/libkvm/kvm.c @@ -295,6 +295,8 @@ kvm_close(kvm_t *kd) free((void *) kd->argspc); if (kd->argv != 0) free((void *)kd->argv); + if (kd->dpcpu_initialized != 0) + free(kd->dpcpu_off); if (kd->pt_map != NULL) free(kd->pt_map); if (kd->page_map != NULL) @@ -338,6 +340,10 @@ kvm_nlist(kvm_t *kd, struct nlist *nl) if (count == 0) return (0); kl = calloc(count + 1, sizeof(*kl)); + if (kl == NULL) { + _kvm_err(kd, kd->program, "cannot allocate memory"); + return (-1); + } for (i = 0; i < count; i++) kl[i].n_name = nl[i].n_name; nfail = kvm_nlist2(kd, kl); @@ -347,6 +353,7 @@ kvm_nlist(kvm_t *kd, struct nlist *nl) nl[i].n_desc = 0; nl[i].n_value = kl[i].n_value; } + free(kl); return (nfail); } From owner-dev-commits-src-branches@freebsd.org Sat Mar 6 19:46: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 DFD1A5711F7; Sat, 6 Mar 2021 19:46: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 4DtFVG61Bfz4lwy; Sat, 6 Mar 2021 19:46:46 +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 C12201153; Sat, 6 Mar 2021 19:46: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 126JkklS019857; Sat, 6 Mar 2021 19:46:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 126JkkjE019856; Sat, 6 Mar 2021 19:46:46 GMT (envelope-from git) Date: Sat, 6 Mar 2021 19:46:46 GMT Message-Id: <202103061946.126JkkjE019856@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: 8d25741b633a - releng/13.0 - growfs: allow operation on RW-mounted filesystems 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 8d25741b633af6652fe8bfff1cb157a31e66cc60 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 Mar 2021 19:46:46 -0000 The branch releng/13.0 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=8d25741b633af6652fe8bfff1cb157a31e66cc60 commit 8d25741b633af6652fe8bfff1cb157a31e66cc60 Author: Ed Maste AuthorDate: 2021-03-02 22:35:48 +0000 Commit: Ed Maste CommitDate: 2021-03-06 19:46:31 +0000 growfs: allow operation on RW-mounted filesystems growfs supports growing mounted filesystems (writes are temporarily suspended while the grow happens). Drop the check for fs_clean == 0 to restore this case. Leave fs_flags check for FS_UNCLEAN or FS_NEEDSFSCK which represent the state of the filesystem when it was mounted, and fsck should be run first if they are set. PR: 253754 Reviewed by: mckusick Approved by: re (gjb) Fixes: 6eb925f8450f ("Filesystem utilities that modify the...") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29021 (cherry picked from commit 0dcde5cc12744e5188300711a8829e5e6a9cd0de) (cherry picked from commit b5920128c7ebcf5060605928263a54b31b317993) --- sbin/growfs/growfs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c index d1098210f088..510192dada0b 100644 --- a/sbin/growfs/growfs.c +++ b/sbin/growfs/growfs.c @@ -1461,10 +1461,9 @@ main(int argc, char **argv) } } /* - * Check for unclean filesystem. + * Check for filesystem that was unclean at mount time. */ - if (fs->fs_clean == 0 || - (fs->fs_flags & (FS_UNCLEAN | FS_NEEDSFSCK)) != 0) + if ((fs->fs_flags & (FS_UNCLEAN | FS_NEEDSFSCK)) != 0) errx(1, "%s is not clean - run fsck.\n", *argv); memcpy(&osblock, fs, fs->fs_sbsize); free(fs); From owner-dev-commits-src-branches@freebsd.org Sat Mar 6 20:04: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 CBCC657156F; Sat, 6 Mar 2021 20:04: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 4DtFvH5QP4z4mZl; Sat, 6 Mar 2021 20:04: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 AD103117D; Sat, 6 Mar 2021 20:04: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 126K4xlh047753; Sat, 6 Mar 2021 20:04:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 126K4xXj047752; Sat, 6 Mar 2021 20:04:59 GMT (envelope-from git) Date: Sat, 6 Mar 2021 20:04:59 GMT Message-Id: <202103062004.126K4xXj047752@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jung-uk Kim Subject: git: 859105d755ce - stable/11 - libkvm: Plug couple of memory leaks and check possible calloc(3) failure MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jkim X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 859105d755ce0ead5ab356c67a6234b10650477f 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 Mar 2021 20:04:59 -0000 The branch stable/11 has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=859105d755ce0ead5ab356c67a6234b10650477f commit 859105d755ce0ead5ab356c67a6234b10650477f Author: Jung-uk Kim AuthorDate: 2021-03-03 23:10:00 +0000 Commit: Jung-uk Kim CommitDate: 2021-03-06 20:04:32 +0000 libkvm: Plug couple of memory leaks and check possible calloc(3) failure First, r204494 introduced dpcpu_off in struct __kvm and it was allocated from _kvm_dpcpu_init() but it was not free(3)'ed from kvm_close(3). Second, r291406 introduced kvm_nlist2(3) and converted kvm_nlist(3) to use the new function but it did not free the temporary buffer. Also, check possible calloc(3) failure while I am in the neighborhood. MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29019 (cherry picked from commit 645eaa2ccaed6eea801d07d6a092974fc1713896) --- lib/libkvm/kvm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c index d6cc7d847ee6..66f38cef41f6 100644 --- a/lib/libkvm/kvm.c +++ b/lib/libkvm/kvm.c @@ -559,6 +559,8 @@ kvm_close(kvm_t *kd) free((void *) kd->argspc); if (kd->argv != 0) free((void *)kd->argv); + if (kd->dpcpu_initialized != 0) + free(kd->dpcpu_off); free((void *)kd); return (error); @@ -797,6 +799,10 @@ kvm_nlist(kvm_t *kd, struct nlist *nl) if (count == 0) return (0); kl = calloc(count + 1, sizeof(*kl)); + if (kl == NULL) { + _kvm_err(kd, kd->program, "cannot allocate memory"); + return (-1); + } for (i = 0; i < count; i++) kl[i].n_name = nl[i].n_name; nfail = kvm_nlist2(kd, kl); @@ -806,6 +812,7 @@ kvm_nlist(kvm_t *kd, struct nlist *nl) nl[i].n_desc = 0; nl[i].n_value = kl[i].n_value; } + free(kl); return (nfail); } From owner-dev-commits-src-branches@freebsd.org Sat Mar 6 20:25: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 F23455720EE; Sat, 6 Mar 2021 20:25: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 4DtGLS6WVHz4nVN; Sat, 6 Mar 2021 20:25: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 D29911838; Sat, 6 Mar 2021 20:25: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 126KP48D074202; Sat, 6 Mar 2021 20:25:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 126KP4vj074201; Sat, 6 Mar 2021 20:25:04 GMT (envelope-from git) Date: Sat, 6 Mar 2021 20:25:04 GMT Message-Id: <202103062025.126KP4vj074201@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: 2fa2d50ead44 - releng/13.0 - zfs: fix overly broad locking in spa_vdev_config_exit() 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 2fa2d50ead44d148482a05284f5c3524475c8e6e 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 Mar 2021 20:25:05 -0000 The branch releng/13.0 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=2fa2d50ead44d148482a05284f5c3524475c8e6e commit 2fa2d50ead44d148482a05284f5c3524475c8e6e Author: Martin Matuska AuthorDate: 2021-03-03 01:25:03 +0000 Commit: Martin Matuska CommitDate: 2021-03-06 20:23:22 +0000 zfs: fix overly broad locking in spa_vdev_config_exit() Resolves a deadlock which can occur when the ZED or zpool command attaches a new device. From the openzfs 75a089ed3 commit message: Calling vdev_free() only requires the we acquire the spa config SCL_STATE_ALL locks, not the SCL_ALL locks. In particular, we need need to avoid taking the SCL_CONFIG lock (included in SCL_ALL) as a writer since this can lead to a deadlock. The txg_sync_thread() may block in spa_txg_history_init_io() when taking the SCL_CONFIG lock as a reading when it detects there's a pending writer. Obtained from: openzfs/zfs@75a089ed34befb8d11df9be92a4438cc49554bf6 Approved by: re (delphij) (cherry picked from commit f08e17c8a251210b58d63b52bfe1a77dccff6e78) --- sys/contrib/openzfs/module/zfs/spa_misc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/contrib/openzfs/module/zfs/spa_misc.c b/sys/contrib/openzfs/module/zfs/spa_misc.c index f49be8eec01a..f11ec0f60574 100644 --- a/sys/contrib/openzfs/module/zfs/spa_misc.c +++ b/sys/contrib/openzfs/module/zfs/spa_misc.c @@ -1275,9 +1275,9 @@ spa_vdev_config_exit(spa_t *spa, vdev_t *vd, uint64_t txg, int error, char *tag) */ vdev_autotrim_stop_wait(vd); - spa_config_enter(spa, SCL_ALL, spa, RW_WRITER); + spa_config_enter(spa, SCL_STATE_ALL, spa, RW_WRITER); vdev_free(vd); - spa_config_exit(spa, SCL_ALL, spa); + spa_config_exit(spa, SCL_STATE_ALL, spa); } /* From owner-dev-commits-src-branches@freebsd.org Sat Mar 6 20:25: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 2BB42572299; Sat, 6 Mar 2021 20:25: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 4DtGLn0hVdz4ndM; Sat, 6 Mar 2021 20:25: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 0AD9215E3; Sat, 6 Mar 2021 20:25: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 126KPKWE074346; Sat, 6 Mar 2021 20:25:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 126KPK2D074345; Sat, 6 Mar 2021 20:25:20 GMT (envelope-from git) Date: Sat, 6 Mar 2021 20:25:20 GMT Message-Id: <202103062025.126KPK2D074345@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: e33a2b2905a8 - releng/13.0 - zfs: fix vdev_rebuild_thread deadlock 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: e33a2b2905a886e98ab4b8f8d83ed30f6d8bb254 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 Mar 2021 20:25:21 -0000 The branch releng/13.0 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=e33a2b2905a886e98ab4b8f8d83ed30f6d8bb254 commit e33a2b2905a886e98ab4b8f8d83ed30f6d8bb254 Author: Martin Matuska AuthorDate: 2021-03-03 01:28:56 +0000 Commit: Martin Matuska CommitDate: 2021-03-06 20:23:22 +0000 zfs: fix vdev_rebuild_thread deadlock From the openzfs 8e43fa12c commit message: The metaslab_disable() call may block waiting for a txg sync. Therefore it's important that vdev_rebuild_thread release the SCL_CONFIG read lock it is holding before this call. Failure to do so can result in the txg_sync thread getting blocked waiting for this lock which results in a deadlock. Obtained from: openzfs/zfs@8e43fa12c571878f32119122771888ab9092a75a Approved by: re (delphij) (cherry picked from commit c7069063144395b025c0ef178431eb2cafdbe1ca) --- sys/contrib/openzfs/module/zfs/vdev_rebuild.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/contrib/openzfs/module/zfs/vdev_rebuild.c b/sys/contrib/openzfs/module/zfs/vdev_rebuild.c index 784d1af15a81..112c04d0ba04 100644 --- a/sys/contrib/openzfs/module/zfs/vdev_rebuild.c +++ b/sys/contrib/openzfs/module/zfs/vdev_rebuild.c @@ -804,8 +804,8 @@ vdev_rebuild_thread(void *arg) ASSERT0(range_tree_space(vr->vr_scan_tree)); /* Disable any new allocations to this metaslab */ - metaslab_disable(msp); spa_config_exit(spa, SCL_CONFIG, FTAG); + metaslab_disable(msp); mutex_enter(&msp->ms_sync_lock); mutex_enter(&msp->ms_lock); From owner-dev-commits-src-branches@freebsd.org Sat Mar 6 20:25: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 ADB69571FD9; Sat, 6 Mar 2021 20:25: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 4DtGM14ZgFz4p1q; Sat, 6 Mar 2021 20:25: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 9079618A2; Sat, 6 Mar 2021 20:25: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 126KPX2Z074478; Sat, 6 Mar 2021 20:25:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 126KPXxC074477; Sat, 6 Mar 2021 20:25:33 GMT (envelope-from git) Date: Sat, 6 Mar 2021 20:25:33 GMT Message-Id: <202103062025.126KPXxC074477@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: d2faf2e6b2d4 - releng/13.0 - zfs: fix assert in FreeBSD-specific dmu_read_pages 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: d2faf2e6b2d43eafbae27a6d4909984c260e2631 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 Mar 2021 20:25:33 -0000 The branch releng/13.0 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=d2faf2e6b2d43eafbae27a6d4909984c260e2631 commit d2faf2e6b2d43eafbae27a6d4909984c260e2631 Author: Martin Matuska AuthorDate: 2021-03-03 01:32:59 +0000 Commit: Martin Matuska CommitDate: 2021-03-06 20:23:22 +0000 zfs: fix assert in FreeBSD-specific dmu_read_pages From the openzfs 2e160dee9 commit message: The function has three similar pieces of code: for read-behind pages, requested pages and read-ahead pages. All three pieces had an assert to ensure that the page is not mapped. Later the assert was relaxed to require that the page is not mapped for writing. But that was done in two places out of three. This change fixes the third piece, read-ahead. Obtained from: openzfs/zfs@2e160dee97a4badbc318561f76ea56451c916d2f Approved by: re (delphij) (cherry picked from commit 19049a2b2bd7119ef7b34102513f6bbfdf9ff862) --- sys/contrib/openzfs/module/os/freebsd/zfs/dmu_os.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/dmu_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/dmu_os.c index 8e412d9c1359..fb8f560316ea 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/dmu_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/dmu_os.c @@ -319,7 +319,7 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_t *ma, int count, break; } ASSERT(m->dirty == 0); - ASSERT(!pmap_page_is_mapped(m)); + ASSERT(!pmap_page_is_write_mapped(m)); ASSERT(db->db_size > PAGE_SIZE); bufoff = IDX_TO_OFF(m->pindex) % db->db_size; From owner-dev-commits-src-branches@freebsd.org Sat Mar 6 20:25: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 BA29E572496; Sat, 6 Mar 2021 20:25: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 4DtGMD47qXz4p6c; Sat, 6 Mar 2021 20:25: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 334971839; Sat, 6 Mar 2021 20:25: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 126KPhYS074606; Sat, 6 Mar 2021 20:25:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 126KPhlN074605; Sat, 6 Mar 2021 20:25:43 GMT (envelope-from git) Date: Sat, 6 Mar 2021 20:25:43 GMT Message-Id: <202103062025.126KPhlN074605@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: eed4d02d7ff7 - releng/13.0 - zfs: cancel TRIM or initialize on FAULTED non-writeable vdevs 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: eed4d02d7ff7067259a23b7ccabc8c2253f1eff0 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 Mar 2021 20:25:44 -0000 The branch releng/13.0 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=eed4d02d7ff7067259a23b7ccabc8c2253f1eff0 commit eed4d02d7ff7067259a23b7ccabc8c2253f1eff0 Author: Martin Matuska AuthorDate: 2021-03-03 01:38:09 +0000 Commit: Martin Matuska CommitDate: 2021-03-06 20:23:23 +0000 zfs: cancel TRIM or initialize on FAULTED non-writeable vdevs From the openzfs commit message: When a device which is actively trimming or initializing becomes FAULTED, and therefore no longer writable, cancel the active TRIM or initialization. When the device is merely taken offline with `zpool offline` then stop the operation but do not cancel it. When the device is brought back online the operation will be resumed if possible. Obtained from: openzfs/zfs@bedbc13daa6dfe9e0221bfadb8d8db2378deaacc Approved by: re (delphij) (cherry picked from commit dc2743434f6cc73ca8ec1d551aba03a678eac804) --- sys/contrib/openzfs/module/zfs/vdev_initialize.c | 10 +++- sys/contrib/openzfs/module/zfs/vdev_trim.c | 15 ++++-- sys/contrib/openzfs/tests/runfiles/common.run | 2 + .../cli_root/zpool_initialize/Makefile.am | 1 + ...zpool_initialize_fault_export_import_online.ksh | 59 ++++++++++++++++++++ .../functional/cli_root/zpool_trim/Makefile.am | 1 + .../zpool_trim_fault_export_import_online.ksh | 62 ++++++++++++++++++++++ 7 files changed, 144 insertions(+), 6 deletions(-) diff --git a/sys/contrib/openzfs/module/zfs/vdev_initialize.c b/sys/contrib/openzfs/module/zfs/vdev_initialize.c index 083ad2861b5b..e9156c32f384 100644 --- a/sys/contrib/openzfs/module/zfs/vdev_initialize.c +++ b/sys/contrib/openzfs/module/zfs/vdev_initialize.c @@ -553,8 +553,14 @@ vdev_initialize_thread(void *arg) vd->vdev_initialize_tree = NULL; mutex_enter(&vd->vdev_initialize_lock); - if (!vd->vdev_initialize_exit_wanted && vdev_writeable(vd)) { - vdev_initialize_change_state(vd, VDEV_INITIALIZE_COMPLETE); + if (!vd->vdev_initialize_exit_wanted) { + if (vdev_writeable(vd)) { + vdev_initialize_change_state(vd, + VDEV_INITIALIZE_COMPLETE); + } else if (vd->vdev_faulted) { + vdev_initialize_change_state(vd, + VDEV_INITIALIZE_CANCELED); + } } ASSERT(vd->vdev_initialize_thread != NULL || vd->vdev_initialize_inflight == 0); diff --git a/sys/contrib/openzfs/module/zfs/vdev_trim.c b/sys/contrib/openzfs/module/zfs/vdev_trim.c index 895957bda195..deea7fedd770 100644 --- a/sys/contrib/openzfs/module/zfs/vdev_trim.c +++ b/sys/contrib/openzfs/module/zfs/vdev_trim.c @@ -22,6 +22,7 @@ /* * Copyright (c) 2016 by Delphix. All rights reserved. * Copyright (c) 2019 by Lawrence Livermore National Security, LLC. + * Copyright (c) 2021 Hewlett Packard Enterprise Development LP */ #include @@ -930,10 +931,16 @@ vdev_trim_thread(void *arg) range_tree_destroy(ta.trim_tree); mutex_enter(&vd->vdev_trim_lock); - if (!vd->vdev_trim_exit_wanted && vdev_writeable(vd)) { - vdev_trim_change_state(vd, VDEV_TRIM_COMPLETE, - vd->vdev_trim_rate, vd->vdev_trim_partial, - vd->vdev_trim_secure); + if (!vd->vdev_trim_exit_wanted) { + if (vdev_writeable(vd)) { + vdev_trim_change_state(vd, VDEV_TRIM_COMPLETE, + vd->vdev_trim_rate, vd->vdev_trim_partial, + vd->vdev_trim_secure); + } else if (vd->vdev_faulted) { + vdev_trim_change_state(vd, VDEV_TRIM_CANCELED, + vd->vdev_trim_rate, vd->vdev_trim_partial, + vd->vdev_trim_secure); + } } ASSERT(vd->vdev_trim_thread != NULL || vd->vdev_trim_inflight[0] == 0); diff --git a/sys/contrib/openzfs/tests/runfiles/common.run b/sys/contrib/openzfs/tests/runfiles/common.run index c0bfc09ac5b3..290b9ffba65c 100644 --- a/sys/contrib/openzfs/tests/runfiles/common.run +++ b/sys/contrib/openzfs/tests/runfiles/common.run @@ -413,6 +413,7 @@ tags = ['functional', 'cli_root', 'zpool_labelclear'] [tests/functional/cli_root/zpool_initialize] tests = ['zpool_initialize_attach_detach_add_remove', + 'zpool_initialize_fault_export_import_online', 'zpool_initialize_import_export', 'zpool_initialize_offline_export_import_online', 'zpool_initialize_online_offline', @@ -477,6 +478,7 @@ tags = ['functional', 'cli_root', 'zpool_sync'] [tests/functional/cli_root/zpool_trim] tests = ['zpool_trim_attach_detach_add_remove', + 'zpool_trim_fault_export_import_online', 'zpool_trim_import_export', 'zpool_trim_multiple', 'zpool_trim_neg', 'zpool_trim_offline_export_import_online', 'zpool_trim_online_offline', 'zpool_trim_partial', 'zpool_trim_rate', 'zpool_trim_rate_neg', diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/Makefile.am index 2ebc376d9cb9..3968902ec36d 100644 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/Makefile.am +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/Makefile.am @@ -2,6 +2,7 @@ pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_init dist_pkgdata_SCRIPTS = \ cleanup.ksh \ zpool_initialize_attach_detach_add_remove.ksh \ + zpool_initialize_fault_export_import_online.ksh \ zpool_initialize_import_export.ksh \ zpool_initialize_offline_export_import_online.ksh \ zpool_initialize_online_offline.ksh \ diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_fault_export_import_online.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_fault_export_import_online.ksh new file mode 100755 index 000000000000..11b8a483e662 --- /dev/null +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_fault_export_import_online.ksh @@ -0,0 +1,59 @@ +#!/bin/ksh -p +# +# CDDL HEADER START +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# +# CDDL HEADER END +# + +# +# Copyright (c) 2021 Lawrence Livermore National Security, LLC. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/cli_root/zpool_initialize/zpool_initialize.kshlib + +# +# DESCRIPTION: +# Miscellaneous complex sequences of operations function as expected. +# +# STRATEGY: +# 1. Create a pool with a two-way mirror. +# 2. Start initializing, fault, export, import, online and verify along +# the way that the initializing was cancelled and not restarted. +# + +DISK1="$(echo $DISKS | cut -d' ' -f1)" +DISK2="$(echo $DISKS | cut -d' ' -f2)" + +log_must zpool create -f $TESTPOOL mirror $DISK1 $DISK2 + +log_must zpool initialize $TESTPOOL $DISK1 +progress="$(initialize_progress $TESTPOOL $DISK1)" +[[ -z "$progress" ]] && log_fail "Initializing did not start" + +log_must zpool offline -f $TESTPOOL $DISK1 +log_must check_vdev_state $TESTPOOL $DISK1 "FAULTED" +log_must eval "zpool status -i $TESTPOOL | grep $DISK1 | grep uninitialized" + +log_must zpool export $TESTPOOL +log_must zpool import $TESTPOOL + +log_must check_vdev_state $TESTPOOL $DISK1 "FAULTED" +log_must eval "zpool status -i $TESTPOOL | grep $DISK1 | grep uninitialized" + +log_must zpool online $TESTPOOL $DISK1 +log_must zpool clear $TESTPOOL $DISK1 +log_must check_vdev_state $TESTPOOL $DISK1 "ONLINE" +log_must eval "zpool status -i $TESTPOOL | grep $DISK1 | grep uninitialized" + +log_pass "Initializing behaves as expected at each step of:" \ + "initialize + fault + export + import + online" diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/Makefile.am index d2d3b4ae88bb..0411ab4e0070 100644 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/Makefile.am +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/Makefile.am @@ -3,6 +3,7 @@ dist_pkgdata_SCRIPTS = \ setup.ksh \ cleanup.ksh \ zpool_trim_attach_detach_add_remove.ksh \ + zpool_trim_fault_export_import_online.ksh \ zpool_trim_import_export.ksh \ zpool_trim_multiple.ksh \ zpool_trim_neg.ksh \ diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/zpool_trim_fault_export_import_online.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/zpool_trim_fault_export_import_online.ksh new file mode 100755 index 000000000000..6bb9fc346daf --- /dev/null +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/zpool_trim_fault_export_import_online.ksh @@ -0,0 +1,62 @@ +#!/bin/ksh -p +# +# CDDL HEADER START +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# +# CDDL HEADER END +# + +# +# Copyright (c) 2019 by Tim Chase. All rights reserved. +# Copyright (c) 2021 Lawrence Livermore National Security, LLC. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/cli_root/zpool_trim/zpool_trim.kshlib + +# +# DESCRIPTION: +# Miscellaneous complex sequences of operations function as expected. +# +# STRATEGY: +# 1. Create a pool with a two-way mirror. +# 2. Start trimming, fault, export, import, online and verify along +# the way that the trim was cancelled and not restarted. +# + +DISK1="$(echo $DISKS | cut -d' ' -f1)" +DISK2="$(echo $DISKS | cut -d' ' -f2)" + +log_must zpool create -f $TESTPOOL mirror $DISK1 $DISK2 + +log_must zpool trim -r 128M $TESTPOOL $DISK1 +progress="$(trim_progress $TESTPOOL $DISK1)" +[[ -z "$progress" ]] && log_fail "Trimming did not start" + +log_must zpool offline -f $TESTPOOL $DISK1 +log_must check_vdev_state $TESTPOOL $DISK1 "FAULTED" +log_must eval "zpool status -t $TESTPOOL | grep $DISK1 | grep untrimmed" + +log_must zpool export $TESTPOOL +log_must zpool import $TESTPOOL + +# Note: the expected state here is unsupported since the faulted device +# cannot be checked to determine if it supports TRIM. +log_must check_vdev_state $TESTPOOL $DISK1 "FAULTED" +log_must eval "zpool status -t $TESTPOOL | grep $DISK1 | grep unsupported" + +log_must zpool online $TESTPOOL $DISK1 +log_must zpool clear $TESTPOOL $DISK1 +log_must check_vdev_state $TESTPOOL $DISK1 "ONLINE" +log_must eval "zpool status -t $TESTPOOL | grep $DISK1 | grep untrimmed" + +log_pass "Trimming behaves as expected at each step of:" \ + "trim + fault + export + import + online" From owner-dev-commits-src-branches@freebsd.org Sun Mar 7 00:25: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 7B749577469; Sun, 7 Mar 2021 00:25: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 4DtMhF35stz3JQY; Sun, 7 Mar 2021 00:25: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 596654BCD; Sun, 7 Mar 2021 00:25: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 1270PndV090256; Sun, 7 Mar 2021 00:25:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1270Pns5090255; Sun, 7 Mar 2021 00:25:49 GMT (envelope-from git) Date: Sun, 7 Mar 2021 00:25:49 GMT Message-Id: <202103070025.1270Pns5090255@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: 05083436a6e5 - stable/13 - Fix diroffdiroff, probably copy/paste bug. 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: 05083436a6e5ca19e0caed4dd34ced8d172303a4 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 Mar 2021 00:25:49 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=05083436a6e5ca19e0caed4dd34ced8d172303a4 commit 05083436a6e5ca19e0caed4dd34ced8d172303a4 Author: Alexander Motin AuthorDate: 2021-02-28 14:07:13 +0000 Commit: Alexander Motin CommitDate: 2021-03-07 00:25:45 +0000 Fix diroffdiroff, probably copy/paste bug. Too long name looks bad in `vmstat -m`. MFC after: 1 week (cherry picked from commit d01032736cf067d63e66d6428ffc08e47652600f) --- sys/fs/nfs/nfs_commonport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nfs/nfs_commonport.c b/sys/fs/nfs/nfs_commonport.c index a7ce2d4bd015..47038980c640 100644 --- a/sys/fs/nfs/nfs_commonport.c +++ b/sys/fs/nfs/nfs_commonport.c @@ -123,7 +123,7 @@ MALLOC_DEFINE(M_NEWNFSCLLOCKOWNER, "NFSCL lckown", "NFSCL Lock Owner"); MALLOC_DEFINE(M_NEWNFSCLLOCK, "NFSCL lck", "NFSCL Lock"); MALLOC_DEFINE(M_NEWNFSV4NODE, "NEWNFSnode", "NFS vnode"); MALLOC_DEFINE(M_NEWNFSDIRECTIO, "NEWdirectio", "NFS Direct IO buffer"); -MALLOC_DEFINE(M_NEWNFSDIROFF, "NFSCL diroffdiroff", +MALLOC_DEFINE(M_NEWNFSDIROFF, "NFSCL diroff", "NFS directory offset data"); MALLOC_DEFINE(M_NEWNFSDROLLBACK, "NFSD rollback", "NFS local lock rollback"); From owner-dev-commits-src-branches@freebsd.org Sun Mar 7 00:26: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 1AA565773A7; Sun, 7 Mar 2021 00:26: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 4DtMhl0DcCz3Jcr; Sun, 7 Mar 2021 00:26: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 EF1344A54; Sun, 7 Mar 2021 00:26: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 1270QEJ4090424; Sun, 7 Mar 2021 00:26:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1270QET5090423; Sun, 7 Mar 2021 00:26:14 GMT (envelope-from git) Date: Sun, 7 Mar 2021 00:26:14 GMT Message-Id: <202103070026.1270QET5090423@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: bff56d9cff25 - stable/12 - Fix diroffdiroff, probably copy/paste bug. 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: bff56d9cff25231d6f05a9d6e40b43838da821db 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 Mar 2021 00:26:15 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=bff56d9cff25231d6f05a9d6e40b43838da821db commit bff56d9cff25231d6f05a9d6e40b43838da821db Author: Alexander Motin AuthorDate: 2021-02-28 14:07:13 +0000 Commit: Alexander Motin CommitDate: 2021-03-07 00:26:08 +0000 Fix diroffdiroff, probably copy/paste bug. Too long name looks bad in `vmstat -m`. MFC after: 1 week (cherry picked from commit d01032736cf067d63e66d6428ffc08e47652600f) --- sys/fs/nfs/nfs_commonport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nfs/nfs_commonport.c b/sys/fs/nfs/nfs_commonport.c index 1a1e64cd823b..214ad51f759d 100644 --- a/sys/fs/nfs/nfs_commonport.c +++ b/sys/fs/nfs/nfs_commonport.c @@ -119,7 +119,7 @@ MALLOC_DEFINE(M_NEWNFSCLLOCKOWNER, "NFSCL lckown", "NFSCL Lock Owner"); MALLOC_DEFINE(M_NEWNFSCLLOCK, "NFSCL lck", "NFSCL Lock"); MALLOC_DEFINE(M_NEWNFSV4NODE, "NEWNFSnode", "NFS vnode"); MALLOC_DEFINE(M_NEWNFSDIRECTIO, "NEWdirectio", "NFS Direct IO buffer"); -MALLOC_DEFINE(M_NEWNFSDIROFF, "NFSCL diroffdiroff", +MALLOC_DEFINE(M_NEWNFSDIROFF, "NFSCL diroff", "NFS directory offset data"); MALLOC_DEFINE(M_NEWNFSDROLLBACK, "NFSD rollback", "NFS local lock rollback"); From owner-dev-commits-src-branches@freebsd.org Sun Mar 7 15:13: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 07C9956977A; Sun, 7 Mar 2021 15:13: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 4DtlMz6qsyz4tMC; Sun, 7 Mar 2021 15:13: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 DD3121879C; Sun, 7 Mar 2021 15:13: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 127FD3q6060855; Sun, 7 Mar 2021 15:13:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 127FD3UQ060854; Sun, 7 Mar 2021 15:13:03 GMT (envelope-from git) Date: Sun, 7 Mar 2021 15:13:03 GMT Message-Id: <202103071513.127FD3UQ060854@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 4663b1baa8ac - stable/13 - Add an entry for NFS-over-TLS. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4663b1baa8acc35e3bf0ae8dde1ce534c86268e3 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 Mar 2021 15:13:04 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=4663b1baa8acc35e3bf0ae8dde1ce534c86268e3 commit 4663b1baa8acc35e3bf0ae8dde1ce534c86268e3 Author: Rick Macklem AuthorDate: 2021-03-07 15:11:50 +0000 Commit: Rick Macklem CommitDate: 2021-03-07 15:11:50 +0000 Add an entry for NFS-over-TLS. --- RELNOTES | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/RELNOTES b/RELNOTES index 602170394523..40fae9249b53 100644 --- a/RELNOTES +++ b/RELNOTES @@ -10,6 +10,15 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +2c76eebca71b, 59f6f5e23c1a: + Add two daemons rpc.tlsclntd(8) and rpc.tlsservd(8) that provide + support for NFS-over-TLS as described in the Internet Draft titled + "Towards Remote Procedure Call Encryption By Default". + These daemons are only built when WITH_OPENSSL_KTLS is specified + and are only tested on amd64 at this time. + They use KTLS to encrypt/decrypt all NFS RPC message traffic, plus + optional verification of machine identity via X.509 certificates. + f76393a6305b6: Add AES-GCM support to armv8crypto(4) providing accelerated support for KTLS, IPsec, and other crypto API consumers. From owner-dev-commits-src-branches@freebsd.org Sun Mar 7 16:18: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 8CF0956B423; Sun, 7 Mar 2021 16:18:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dtmqw3g6gz3DK4; Sun, 7 Mar 2021 16:18: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 70D1B191B9; Sun, 7 Mar 2021 16:18: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 127GIqY3040298; Sun, 7 Mar 2021 16:18:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 127GIqLp040297; Sun, 7 Mar 2021 16:18:52 GMT (envelope-from git) Date: Sun, 7 Mar 2021 16:18:52 GMT Message-Id: <202103071618.127GIqLp040297@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: abbf5f02fa1a - stable/13 - [skip ci] Add RELNOTES entries for aio_writev and fusefs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: abbf5f02fa1ac0c7de2d4a0f7161f78fb1eba8db 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 Mar 2021 16:18:52 -0000 The branch stable/13 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=abbf5f02fa1ac0c7de2d4a0f7161f78fb1eba8db commit abbf5f02fa1ac0c7de2d4a0f7161f78fb1eba8db Author: Alan Somers AuthorDate: 2021-03-07 16:17:41 +0000 Commit: Alan Somers CommitDate: 2021-03-07 16:17:41 +0000 [skip ci] Add RELNOTES entries for aio_writev and fusefs --- RELNOTES | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/RELNOTES b/RELNOTES index 40fae9249b53..320d947c24e7 100644 --- a/RELNOTES +++ b/RELNOTES @@ -39,6 +39,14 @@ f76393a6305b6: Add AES-XTS support to armv8crypto(4) providing accelerated software support for the default GELI cipher on arm64 systems. +022ca2fc7fe0: + Add aio_writev(2) and aio_readv(2), vectored analogues of aio_write(2) + and aio_read(2). + +92bbfe1f0d1f: + The fusefs(5) protocol has been updated to 7.28. Support for + FUSE_COPY_FILE_RANGE and FUSE_LSEEK is added. + r368667: GDB 6.1.1 was removed. Users of crashinfo(8) should install the gdb package or devel/gdb port. From owner-dev-commits-src-branches@freebsd.org Sun Mar 7 20:57: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 CB78457353C; Sun, 7 Mar 2021 20:57: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 4Dtv1k5NWYz3mQr; Sun, 7 Mar 2021 20:57:46 +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 AB8CC1C94A; Sun, 7 Mar 2021 20:57: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 127Kvk60008326; Sun, 7 Mar 2021 20:57:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 127Kvkfk008325; Sun, 7 Mar 2021 20:57:46 GMT (envelope-from git) Date: Sun, 7 Mar 2021 20:57:46 GMT Message-Id: <202103072057.127Kvkfk008325@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: 4ecfdf7b47b2 - stable/13 - armv8crypto: fix AES-XTS regression introduced by ed9b7f44 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: 4ecfdf7b47b2ca6ef038610339a96586d04de5ab 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 Mar 2021 20:57:46 -0000 The branch stable/13 has been updated by gonzo: URL: https://cgit.FreeBSD.org/src/commit/?id=4ecfdf7b47b2ca6ef038610339a96586d04de5ab commit 4ecfdf7b47b2ca6ef038610339a96586d04de5ab Author: Oleksandr Tymoshenko AuthorDate: 2021-03-07 20:03:47 +0000 Commit: Oleksandr Tymoshenko CommitDate: 2021-03-07 20:41:15 +0000 armv8crypto: fix AES-XTS regression introduced by ed9b7f44 Initialization of the XTS key schedule was accidentally dropped when adding AES-GCM support so all-zero schedule was used instead. This rendered previously created GELI partitions unusable. This change restores proper XTS key schedule initialization. Reported by: Peter Jeremy MFC after: immediately (cherry picked from commit 748be78e60ccc4a26325a636347debb1f7e6749b) --- sys/crypto/armv8/armv8_crypto.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/crypto/armv8/armv8_crypto.c b/sys/crypto/armv8/armv8_crypto.c index 24f6eff5608d..95bb96124323 100644 --- a/sys/crypto/armv8/armv8_crypto.c +++ b/sys/crypto/armv8/armv8_crypto.c @@ -305,6 +305,9 @@ armv8_crypto_cipher_setup(struct armv8_crypto_session *ses, aes_v8_set_decrypt_key(key, keylen * 8, &ses->dec_schedule); + if (csp->csp_cipher_alg == CRYPTO_AES_XTS) + aes_v8_set_encrypt_key(key + keylen, keylen * 8, &ses->xts_schedule); + if (csp->csp_cipher_alg == CRYPTO_AES_NIST_GCM_16) { memset(H.c, 0, sizeof(H.c)); aes_v8_encrypt(H.c, H.c, &ses->enc_schedule); From owner-dev-commits-src-branches@freebsd.org Sun Mar 7 21:39: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 72F9D5754EB; Sun, 7 Mar 2021 21:39: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 4Dtvy01x6Xz3qw3; Sun, 7 Mar 2021 21:39: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 356051D676; Sun, 7 Mar 2021 21:39: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 127LdaVj061413; Sun, 7 Mar 2021 21:39:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 127Ldasq061412; Sun, 7 Mar 2021 21:39:36 GMT (envelope-from git) Date: Sun, 7 Mar 2021 21:39:36 GMT Message-Id: <202103072139.127Ldasq061412@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: bdd61b6914f1 - stable/13 - jail(8): reset to root cpuset before attaching to run commands 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: bdd61b6914f1f961b5f414b2d5cc623a5a829b89 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 Mar 2021 21:39:36 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=bdd61b6914f1f961b5f414b2d5cc623a5a829b89 commit bdd61b6914f1f961b5f414b2d5cc623a5a829b89 Author: Kyle Evans AuthorDate: 2021-03-04 19:28:53 +0000 Commit: Kyle Evans CommitDate: 2021-03-07 21:39:29 +0000 jail(8): reset to root cpuset before attaching to run commands Recent changes have made it such that attaching to a jail will augment the attaching process' cpu mask with the jail's cpuset. While this is convenient for allowing the administrator to cpuset arbitrary programs that will attach to a jail, this is decidedly not convenient for executing long-running daemons during jail creation. This change inserts a reset of the process cpuset to the root cpuset between the fork and attach to execute a command. This allows commands executed to have the widest mask possible, and the administrator can cpuset(1) it back down inside the jail as needed. With this applied, one should be able to change a jail's cpuset at exec.poststart in addition to exec.created. The former was made difficult if jail(8) itself was running with a constrained set, as then some processes may have been spawned inside the jail with a non-root set. The latter is the preferred option so that processes starting in the jail are constrained appropriately up front. Note that all system commands are still run with the process' initial cpuset applied. PR: 253724 (cherry picked from commit 466df976babed65f8a8de9e36d7f016a444609af) --- usr.sbin/jail/command.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/usr.sbin/jail/command.c b/usr.sbin/jail/command.c index a5c1839849fd..c1d418d6cc69 100644 --- a/usr.sbin/jail/command.c +++ b/usr.sbin/jail/command.c @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -84,6 +85,20 @@ static struct cfstring dummystring = { .len = 1 }; static struct phhead phash[PHASH_SIZE]; static int kq; +static cpusetid_t +root_cpuset_id(void) +{ + static cpusetid_t setid = CPUSET_INVALID; + static int error; + + /* Only try to get the cpuset once. */ + if (error == 0 && setid == CPUSET_INVALID) + error = cpuset_getid(CPU_LEVEL_ROOT, CPU_WHICH_PID, -1, &setid); + if (error != 0) + return (CPUSET_INVALID); + return (setid); +} + /* * Run the next command associated with a jail. */ @@ -283,6 +298,7 @@ run_command(struct cfjail *j) enum intparam comparam; size_t comlen; pid_t pid; + cpusetid_t setid; int argc, bg, clean, consfd, down, fib, i, injail, sjuser, timeout; #if defined(INET) || defined(INET6) char *addr, *extrap, *p, *val; @@ -632,6 +648,10 @@ run_command(struct cfjail *j) injail = comparam == IP_EXEC_START || comparam == IP_COMMAND || comparam == IP_EXEC_STOP; + if (injail) + setid = root_cpuset_id(); + else + setid = CPUSET_INVALID; clean = bool_param(j->intparams[IP_EXEC_CLEAN]); username = string_param(j->intparams[injail ? IP_EXEC_JAIL_USER : IP_EXEC_SYSTEM_USER]); @@ -700,6 +720,19 @@ run_command(struct cfjail *j) jail_warnx(j, "setfib: %s", strerror(errno)); exit(1); } + + /* + * We wouldn't have specialized our affinity, so just setid to + * root. We do this prior to attaching to avoid the kernel + * having to create a transient cpuset that we'll promptly + * free up with a reset to the jail's cpuset. + * + * This is just a best-effort to use as wide of mask as + * possible. + */ + if (setid != CPUSET_INVALID) + (void)cpuset_setid(CPU_WHICH_PID, -1, setid); + if (jail_attach(j->jid) < 0) { jail_warnx(j, "jail_attach: %s", strerror(errno)); exit(1); From owner-dev-commits-src-branches@freebsd.org Sun Mar 7 21:39: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 6AA9757547F; Sun, 7 Mar 2021 21:39: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 4Dtvy12X7Pz3rDP; Sun, 7 Mar 2021 21:39: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 49CD11D677; Sun, 7 Mar 2021 21:39: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 127Ldb1A061434; Sun, 7 Mar 2021 21:39:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 127Ldb9e061433; Sun, 7 Mar 2021 21:39:37 GMT (envelope-from git) Date: Sun, 7 Mar 2021 21:39:37 GMT Message-Id: <202103072139.127Ldb9e061433@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: 872ec7e5b6f3 - stable/13 - service(8): use an environment more consistent with init(8) 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: 872ec7e5b6f35d84745b49c02f58572632de22ed 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 Mar 2021 21:39:37 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=872ec7e5b6f35d84745b49c02f58572632de22ed commit 872ec7e5b6f35d84745b49c02f58572632de22ed Author: Andrew Gierth AuthorDate: 2021-03-03 18:25:11 +0000 Commit: Kyle Evans CommitDate: 2021-03-07 21:39:30 +0000 service(8): use an environment more consistent with init(8) init(8) sets the "daemon" login class without specifying a pw entry (so no substitutions are done on the variables). service(8)'s use of env -L had the effect of specifying root's pw entry, with two effects: getpwnam and getpwuid are being called, which may not be entirely safe depending on what nsswitch is up to and what stage of boot we are at, and substitutions would have been done. Fix by teaching env(8) to allow -L -/classname to set the class environment with no pw entry at all specified, and use it in service(8). PR: 253959 (cherry picked from commit 55deb0a5f089c8a27cfc1666655b93881c2b47ae) (cherry picked from commit 0c1a5eaae83267365330437adb60f44e1a622a2b) --- usr.bin/env/env.1 | 7 ++++++- usr.bin/env/env.c | 25 ++++++++++++++++--------- usr.sbin/service/service.sh | 2 +- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/usr.bin/env/env.1 b/usr.bin/env/env.1 index 8c0527608506..9aff9508e47b 100644 --- a/usr.bin/env/env.1 +++ b/usr.bin/env/env.1 @@ -31,7 +31,7 @@ .\" From FreeBSD: src/usr.bin/printenv/printenv.1,v 1.17 2002/11/26 17:33:35 ru Exp .\" $FreeBSD$ .\" -.Dd November 11, 2020 +.Dd March 3, 2021 .Dt ENV 1 .Os .Sh NAME @@ -104,6 +104,11 @@ is used, then the specified user's .Pa ~/.login_conf is read as well. The user may be specified by name or by uid. +If a username of +.Sq Li \&- +is given, then no user lookup will be done, the login class will default to +.Sq Li default +if not explicitly given, and no substitutions will be done on the values. .\" -P .It Fl P Ar altpath Search the set of directories as specified by diff --git a/usr.bin/env/env.c b/usr.bin/env/env.c index e408577ea7a4..a0f55d665a9a 100644 --- a/usr.bin/env/env.c +++ b/usr.bin/env/env.c @@ -144,16 +144,23 @@ main(int argc, char **argv) login_class = strchr(login_name, '/'); if (login_class) *login_class++ = '\0'; - pw = getpwnam(login_name); - if (pw == NULL) { - char *endp = NULL; - errno = 0; - uid = strtoul(login_name, &endp, 10); - if (errno == 0 && *endp == '\0') - pw = getpwuid(uid); + if (*login_name != '\0' && strcmp(login_name, "-") != 0) { + pw = getpwnam(login_name); + if (pw == NULL) { + char *endp = NULL; + errno = 0; + uid = strtoul(login_name, &endp, 10); + if (errno == 0 && *endp == '\0') + pw = getpwuid(uid); + } + if (pw == NULL) + errx(EXIT_FAILURE, "no such user: %s", login_name); } - if (pw == NULL) - errx(EXIT_FAILURE, "no such user: %s", login_name); + /* + * Note that it is safe for pw to be null here; the libutil + * code handles that, bypassing substitution of $ and using + * the class "default" if no class name is given either. + */ if (login_class != NULL) { lc = login_getclass(login_class); if (lc == NULL) diff --git a/usr.sbin/service/service.sh b/usr.sbin/service/service.sh index 42a50fcf61b9..df2869f98a6c 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 -L 0/daemon HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin "$dir/$script" "$@" + exec env -i -L -/daemon HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin "$dir/$script" "$@" fi done