From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 00:02: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 B0A875B42F5; Mon, 29 Mar 2021 00:02: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 4F7t7h4dWQz3q7G; Mon, 29 Mar 2021 00:02: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 921A716A1; Mon, 29 Mar 2021 00:02: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 12T02uJk082328; Mon, 29 Mar 2021 00:02:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12T02uP9082327; Mon, 29 Mar 2021 00:02:56 GMT (envelope-from git) Date: Mon, 29 Mar 2021 00:02:56 GMT Message-Id: <202103290002.12T02uP9082327@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: 2e70fcbb1543 - releng/13.0 - 13.0: update to RC4 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: 2e70fcbb154359d7eb5cebfa0c895887f3400ae0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 00:02:56 -0000 The branch releng/13.0 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=2e70fcbb154359d7eb5cebfa0c895887f3400ae0 commit 2e70fcbb154359d7eb5cebfa0c895887f3400ae0 Author: Glen Barber AuthorDate: 2021-03-28 23:51:40 +0000 Commit: Glen Barber CommitDate: 2021-03-28 23:51:40 +0000 13.0: update to RC4 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 50fcab5609a2..79d64cfbfb2a 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -54,7 +54,7 @@ TYPE="FreeBSD" REVISION="13.0" -BRANCH="RC3-p1" +BRANCH="RC4" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 08:54: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 2AC405C1C84; Mon, 29 Mar 2021 08:54: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 4F85x20k0fz4prs; Mon, 29 Mar 2021 08:54: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 0BA0D109FF; Mon, 29 Mar 2021 08:54: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 12T8sTgZ024118; Mon, 29 Mar 2021 08:54:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12T8sTrU024117; Mon, 29 Mar 2021 08:54:29 GMT (envelope-from git) Date: Mon, 29 Mar 2021 08:54:29 GMT Message-Id: <202103290854.12T8sTrU024117@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wei Hu Subject: git: 1aadba9cc8af - stable/12 - Hyper-V: hn: Store host hash value in flowid MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 1aadba9cc8af4c1925eb27215eaf6d68e6fbf4d8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 08:54:30 -0000 The branch stable/12 has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=1aadba9cc8af4c1925eb27215eaf6d68e6fbf4d8 commit 1aadba9cc8af4c1925eb27215eaf6d68e6fbf4d8 Author: Wei Hu AuthorDate: 2021-02-24 05:07:46 +0000 Commit: Wei Hu CommitDate: 2021-03-29 08:32:39 +0000 Hyper-V: hn: Store host hash value in flowid When rx packet contains hash value sent from host, store it in the mbuf's flowid field so when the same mbuf is on the tx path, the hash value can be used by the host to determine the outgoing network queue. MFC after: 2 weeks Sponsored by: Microsoft (cherry picked from commit 80f39bd95f22322152709ea5fae3a3c546044c9c) --- sys/dev/hyperv/netvsc/if_hn.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c index 1945732590cc..b77f3118b777 100644 --- a/sys/dev/hyperv/netvsc/if_hn.c +++ b/sys/dev/hyperv/netvsc/if_hn.c @@ -3073,13 +3073,24 @@ hn_encap(struct ifnet *ifp, struct hn_tx_ring *txr, struct hn_txdesc *txd, if (txr->hn_tx_flags & HN_TX_FLAG_HASHVAL) { /* - * Set the hash value for this packet, so that the host could - * dispatch the TX done event for this packet back to this TX - * ring's channel. + * Set the hash value for this packet. */ pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN, HN_NDIS_HASH_VALUE_SIZE, HN_NDIS_PKTINFO_TYPE_HASHVAL); - *pi_data = txr->hn_tx_idx; + + if (M_HASHTYPE_ISHASH(m_head)) + /* + * The flowid field contains the hash value host + * set in the rx queue if it is a ip forwarding pkt. + * Set the same hash value so host can send on the + * cpu it was received. + */ + *pi_data = m_head->m_pkthdr.flowid; + else + /* + * Otherwise just put the tx queue index. + */ + *pi_data = txr->hn_tx_idx; } if (m_head->m_flags & M_VLANTAG) { From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 09:12: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 E4BB05C2741; Mon, 29 Mar 2021 09:12: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 4F86KT5vSlz4s4x; Mon, 29 Mar 2021 09:12: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 BD72110CC9; Mon, 29 Mar 2021 09:12: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 12T9CDiL052725; Mon, 29 Mar 2021 09:12:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12T9CDTY052724; Mon, 29 Mar 2021 09:12:13 GMT (envelope-from git) Date: Mon, 29 Mar 2021 09:12:13 GMT Message-Id: <202103290912.12T9CDTY052724@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wei Hu Subject: git: 4150446f6467 - stable/12 - Hyper-V: hn: Enable vSwitch RSC support in hn netvsc driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4150446f6467f585595803db211f58152cd3587a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 09:12:14 -0000 The branch stable/12 has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=4150446f6467f585595803db211f58152cd3587a commit 4150446f6467f585595803db211f58152cd3587a Author: Wei Hu AuthorDate: 2021-03-12 04:35:16 +0000 Commit: Wei Hu CommitDate: 2021-03-29 08:55:18 +0000 Hyper-V: hn: Enable vSwitch RSC support in hn netvsc driver Receive Segment Coalescing (RSC) in the vSwitch is a feature available in Windows Server 2019 hosts and later. It reduces the per packet processing overhead by coalescing multiple TCP segments when possible. This happens mostly when TCP traffics are among different guests on same host. This patch adds netvsc driver support for this feature. The patch also updates NVS version to 6.1 as needed for RSC enablement. MFC after: 2 weeks Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D29075 (cherry picked from commit a491581f3f8df07cdff0236bd556895205929af4) --- sys/dev/hyperv/netvsc/hn_nvs.c | 5 + sys/dev/hyperv/netvsc/hn_rndis.c | 25 ++++ sys/dev/hyperv/netvsc/if_hn.c | 258 ++++++++++++++++++++++++++++----------- sys/dev/hyperv/netvsc/if_hnreg.h | 14 +++ sys/dev/hyperv/netvsc/if_hnvar.h | 19 ++- sys/dev/hyperv/netvsc/ndis.h | 31 +++-- sys/net/rndis.h | 7 +- 7 files changed, 269 insertions(+), 90 deletions(-) diff --git a/sys/dev/hyperv/netvsc/hn_nvs.c b/sys/dev/hyperv/netvsc/hn_nvs.c index 73a112c4e5e1..4dbc28996617 100644 --- a/sys/dev/hyperv/netvsc/hn_nvs.c +++ b/sys/dev/hyperv/netvsc/hn_nvs.c @@ -80,6 +80,8 @@ struct hn_nvs_sendctx hn_nvs_sendctx_none = HN_NVS_SENDCTX_INITIALIZER(hn_nvs_sent_none, NULL); static const uint32_t hn_nvs_version[] = { + HN_NVS_VERSION_61, + HN_NVS_VERSION_6, HN_NVS_VERSION_5, HN_NVS_VERSION_4, HN_NVS_VERSION_2, @@ -508,6 +510,9 @@ hn_nvs_conf_ndis(struct hn_softc *sc, int mtu) conf.nvs_caps = HN_NVS_NDIS_CONF_VLAN; if (sc->hn_nvs_ver >= HN_NVS_VERSION_5) conf.nvs_caps |= HN_NVS_NDIS_CONF_SRIOV; + if (sc->hn_nvs_ver >= HN_NVS_VERSION_61) + conf.nvs_caps |= HN_NVS_NDIS_CONF_RSC; + /* NOTE: No response. */ error = hn_nvs_req_send(sc, &conf, sizeof(conf)); diff --git a/sys/dev/hyperv/netvsc/hn_rndis.c b/sys/dev/hyperv/netvsc/hn_rndis.c index b9bf683fe811..794a82cf3957 100644 --- a/sys/dev/hyperv/netvsc/hn_rndis.c +++ b/sys/dev/hyperv/netvsc/hn_rndis.c @@ -723,6 +723,17 @@ hn_rndis_conf_offload(struct hn_softc *sc, int mtu) params.ndis_udp6csum = NDIS_OFFLOAD_PARAM_RX; } + /* RSC offload */ + if (hwcaps.ndis_hdr.ndis_rev >= NDIS_OFFLOAD_PARAMS_REV_3) { + if (hwcaps.ndis_rsc.ndis_ip4 && hwcaps.ndis_rsc.ndis_ip6) { + params.ndis_rsc_ip4 = NDIS_OFFLOAD_RSC_ON; + params.ndis_rsc_ip6 = NDIS_OFFLOAD_RSC_ON; + } else { + params.ndis_rsc_ip4 = NDIS_OFFLOAD_RSC_OFF; + params.ndis_rsc_ip6 = NDIS_OFFLOAD_RSC_OFF; + } + } + if (bootverbose) { if_printf(sc->hn_ifp, "offload csum: " "ip4 %u, tcp4 %u, udp4 %u, tcp6 %u, udp6 %u\n", @@ -734,6 +745,10 @@ hn_rndis_conf_offload(struct hn_softc *sc, int mtu) if_printf(sc->hn_ifp, "offload lsov2: ip4 %u, ip6 %u\n", params.ndis_lsov2_ip4, params.ndis_lsov2_ip6); + if (hwcaps.ndis_hdr.ndis_rev >= NDIS_OFFLOAD_PARAMS_REV_3) + if_printf(sc->hn_ifp, "offload rsc: ip4 %u, ip6 %u\n", + params.ndis_rsc_ip4, + params.ndis_rsc_ip6); } error = hn_rndis_set(sc, OID_TCP_OFFLOAD_PARAMETERS, ¶ms, paramsz); @@ -969,6 +984,11 @@ hn_rndis_query_hwcaps(struct hn_softc *sc, struct ndis_offload *caps) if_printf(sc->hn_ifp, "invalid NDIS objsize %u\n", caps->ndis_hdr.ndis_size); return (EINVAL); + } else if (caps->ndis_hdr.ndis_rev >= NDIS_OFFLOAD_REV_3 && + caps->ndis_hdr.ndis_size < NDIS_OFFLOAD_SIZE) { + if_printf(sc->hn_ifp, "invalid NDIS rev3 objsize %u\n", + caps->ndis_hdr.ndis_size); + return (EINVAL); } if (bootverbose) { @@ -1001,6 +1021,11 @@ hn_rndis_query_hwcaps(struct hn_softc *sc, struct ndis_offload *caps) caps->ndis_lsov2.ndis_ip6_minsg, caps->ndis_lsov2.ndis_ip6_encap, caps->ndis_lsov2.ndis_ip6_opts); + if (caps->ndis_hdr.ndis_rev >= NDIS_OFFLOAD_REV_3) + if_printf(sc->hn_ifp, "hwcaps rsc: " + "ip4 %u ip6 %u\n", + caps->ndis_rsc.ndis_ip4, + caps->ndis_rsc.ndis_ip6); } return (0); } diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c index b77f3118b777..1e90e8ef14fb 100644 --- a/sys/dev/hyperv/netvsc/if_hn.c +++ b/sys/dev/hyperv/netvsc/if_hn.c @@ -223,11 +223,25 @@ struct hn_txdesc { #define HN_TXD_FLAG_DMAMAP 0x0002 #define HN_TXD_FLAG_ONAGG 0x0004 +#define HN_NDIS_PKTINFO_SUBALLOC 0x01 +#define HN_NDIS_PKTINFO_1ST_FRAG 0x02 +#define HN_NDIS_PKTINFO_LAST_FRAG 0x04 + +struct packet_info_id { + uint8_t ver; + uint8_t flag; + uint16_t pkt_id; +}; + +#define NDIS_PKTINFOID_SZ sizeof(struct packet_info_id) + + struct hn_rxinfo { - uint32_t vlan_info; - uint32_t csum_info; - uint32_t hash_info; - uint32_t hash_value; + const uint32_t *vlan_info; + const uint32_t *csum_info; + const uint32_t *hash_info; + const uint32_t *hash_value; + const struct packet_info_id *pktinfo_id; }; struct hn_rxvf_setarg { @@ -239,15 +253,13 @@ struct hn_rxvf_setarg { #define HN_RXINFO_CSUM 0x0002 #define HN_RXINFO_HASHINF 0x0004 #define HN_RXINFO_HASHVAL 0x0008 +#define HN_RXINFO_PKTINFO_ID 0x0010 #define HN_RXINFO_ALL \ (HN_RXINFO_VLAN | \ HN_RXINFO_CSUM | \ HN_RXINFO_HASHINF | \ - HN_RXINFO_HASHVAL) - -#define HN_NDIS_VLAN_INFO_INVALID 0xffffffff -#define HN_NDIS_RXCSUM_INFO_INVALID 0 -#define HN_NDIS_HASH_INFO_INVALID 0 + HN_RXINFO_HASHVAL | \ + HN_RXINFO_PKTINFO_ID) static int hn_probe(device_t); static int hn_attach(device_t); @@ -396,8 +408,7 @@ static int hn_rxfilter_config(struct hn_softc *); static int hn_rss_reconfig(struct hn_softc *); static void hn_rss_ind_fixup(struct hn_softc *); static void hn_rss_mbuf_hash(struct hn_softc *, uint32_t); -static int hn_rxpkt(struct hn_rx_ring *, const void *, - int, const struct hn_rxinfo *); +static int hn_rxpkt(struct hn_rx_ring *); static uint32_t hn_rss_type_fromndis(uint32_t); static uint32_t hn_rss_type_tondis(uint32_t); @@ -3349,9 +3360,10 @@ again: * allocated with cluster size MJUMPAGESIZE, and filled * accordingly. * - * Return 1 if able to complete the job; otherwise 0. + * Return the last mbuf in the chain or NULL if failed to + * allocate new mbuf. */ -static int +static struct mbuf * hv_m_append(struct mbuf *m0, int len, c_caddr_t cp) { struct mbuf *m, *n; @@ -3379,7 +3391,7 @@ hv_m_append(struct mbuf *m0, int len, c_caddr_t cp) */ n = m_getjcl(M_NOWAIT, m->m_type, 0, MJUMPAGESIZE); if (n == NULL) - break; + return NULL; n->m_len = min(MJUMPAGESIZE, remainder); bcopy(cp, mtod(n, caddr_t), n->m_len); cp += n->m_len; @@ -3387,10 +3399,8 @@ hv_m_append(struct mbuf *m0, int len, c_caddr_t cp) m->m_next = n; m = n; } - if (m0->m_flags & M_PKTHDR) - m0->m_pkthdr.len += len - remainder; - return (remainder == 0); + return m; } #if defined(INET) || defined(INET6) @@ -3408,14 +3418,14 @@ hn_lro_rx(struct lro_ctrl *lc, struct mbuf *m) #endif static int -hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, - const struct hn_rxinfo *info) +hn_rxpkt(struct hn_rx_ring *rxr) { struct ifnet *ifp, *hn_ifp = rxr->hn_ifp; - struct mbuf *m_new; + struct mbuf *m_new, *n; int size, do_lro = 0, do_csum = 1, is_vf = 0; int hash_type = M_HASHTYPE_NONE; int l3proto = ETHERTYPE_MAX, l4proto = IPPROTO_DONE; + int i; ifp = hn_ifp; if (rxr->hn_rxvf_ifp != NULL) { @@ -3442,20 +3452,20 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, return (0); } - if (__predict_false(dlen < ETHER_HDR_LEN)) { + if (__predict_false(rxr->rsc.pktlen < ETHER_HDR_LEN)) { if_inc_counter(hn_ifp, IFCOUNTER_IERRORS, 1); return (0); } - if (dlen <= MHLEN) { + if (rxr->rsc.cnt == 1 && rxr->rsc.pktlen <= MHLEN) { m_new = m_gethdr(M_NOWAIT, MT_DATA); if (m_new == NULL) { if_inc_counter(hn_ifp, IFCOUNTER_IQDROPS, 1); return (0); } - memcpy(mtod(m_new, void *), data, dlen); - m_new->m_pkthdr.len = m_new->m_len = dlen; - rxr->hn_small_pkts++; + memcpy(mtod(m_new, void *), rxr->rsc.frag_data[0], + rxr->rsc.frag_len[0]); + m_new->m_pkthdr.len = m_new->m_len = rxr->rsc.frag_len[0]; } else { /* * Get an mbuf with a cluster. For packets 2K or less, @@ -3464,7 +3474,7 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, * if looped around to the Hyper-V TX channel, so avoid them. */ size = MCLBYTES; - if (dlen > MCLBYTES) { + if (rxr->rsc.pktlen > MCLBYTES) { /* 4096 */ size = MJUMPAGESIZE; } @@ -3475,29 +3485,42 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, return (0); } - hv_m_append(m_new, dlen, data); + n = m_new; + for (i = 0; i < rxr->rsc.cnt; i++) { + n = hv_m_append(n, rxr->rsc.frag_len[i], + rxr->rsc.frag_data[i]); + if (n == NULL) { + if_inc_counter(hn_ifp, IFCOUNTER_IQDROPS, 1); + return (0); + } else { + m_new->m_pkthdr.len += rxr->rsc.frag_len[i]; + } + } } + if (rxr->rsc.pktlen <= MHLEN) + rxr->hn_small_pkts++; + m_new->m_pkthdr.rcvif = ifp; if (__predict_false((hn_ifp->if_capenable & IFCAP_RXCSUM) == 0)) do_csum = 0; /* receive side checksum offload */ - if (info->csum_info != HN_NDIS_RXCSUM_INFO_INVALID) { + if (rxr->rsc.csum_info != NULL) { /* IP csum offload */ - if ((info->csum_info & NDIS_RXCSUM_INFO_IPCS_OK) && do_csum) { + if ((*(rxr->rsc.csum_info) & NDIS_RXCSUM_INFO_IPCS_OK) && do_csum) { m_new->m_pkthdr.csum_flags |= (CSUM_IP_CHECKED | CSUM_IP_VALID); rxr->hn_csum_ip++; } /* TCP/UDP csum offload */ - if ((info->csum_info & (NDIS_RXCSUM_INFO_UDPCS_OK | + if ((*(rxr->rsc.csum_info) & (NDIS_RXCSUM_INFO_UDPCS_OK | NDIS_RXCSUM_INFO_TCPCS_OK)) && do_csum) { m_new->m_pkthdr.csum_flags |= (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); m_new->m_pkthdr.csum_data = 0xffff; - if (info->csum_info & NDIS_RXCSUM_INFO_TCPCS_OK) + if (*(rxr->rsc.csum_info) & NDIS_RXCSUM_INFO_TCPCS_OK) rxr->hn_csum_tcp++; else rxr->hn_csum_udp++; @@ -3510,7 +3533,7 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, * the do_lro setting here is actually _not_ accurate. We * depend on the RSS hash type check to reset do_lro. */ - if ((info->csum_info & + if ((*(rxr->rsc.csum_info) & (NDIS_RXCSUM_INFO_TCPCS_OK | NDIS_RXCSUM_INFO_IPCS_OK)) == (NDIS_RXCSUM_INFO_TCPCS_OK | NDIS_RXCSUM_INFO_IPCS_OK)) do_lro = 1; @@ -3547,11 +3570,11 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, } } - if (info->vlan_info != HN_NDIS_VLAN_INFO_INVALID) { + if (rxr->rsc.vlan_info != NULL) { m_new->m_pkthdr.ether_vtag = EVL_MAKETAG( - NDIS_VLAN_INFO_ID(info->vlan_info), - NDIS_VLAN_INFO_PRI(info->vlan_info), - NDIS_VLAN_INFO_CFI(info->vlan_info)); + NDIS_VLAN_INFO_ID(*(rxr->rsc.vlan_info)), + NDIS_VLAN_INFO_PRI(*(rxr->rsc.vlan_info)), + NDIS_VLAN_INFO_CFI(*(rxr->rsc.vlan_info))); m_new->m_flags |= M_VLANTAG; } @@ -3577,14 +3600,14 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, * matter here), do _not_ mess with unsupported hash types or * functions. */ - if (info->hash_info != HN_NDIS_HASH_INFO_INVALID) { + if (rxr->rsc.hash_info != NULL) { rxr->hn_rss_pkts++; - m_new->m_pkthdr.flowid = info->hash_value; + m_new->m_pkthdr.flowid = *(rxr->rsc.hash_value); if (!is_vf) hash_type = M_HASHTYPE_OPAQUE_HASH; - if ((info->hash_info & NDIS_HASH_FUNCTION_MASK) == + if ((*(rxr->rsc.hash_info) & NDIS_HASH_FUNCTION_MASK) == NDIS_HASH_FUNCTION_TOEPLITZ) { - uint32_t type = (info->hash_info & NDIS_HASH_TYPE_MASK & + uint32_t type = (*(rxr->rsc.hash_info) & NDIS_HASH_TYPE_MASK & rxr->hn_mbuf_hash); /* @@ -5029,6 +5052,16 @@ hn_create_rx_data(struct hn_softc *sc, int ring_cnt) OID_AUTO, "rss_pkts", CTLFLAG_RW, &rxr->hn_rss_pkts, "# of packets w/ RSS info received"); + SYSCTL_ADD_ULONG(ctx, + SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree), + OID_AUTO, "rsc_pkts", CTLFLAG_RW, + &rxr->hn_rsc_pkts, + "# of RSC packets received"); + SYSCTL_ADD_ULONG(ctx, + SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree), + OID_AUTO, "rsc_drop", CTLFLAG_RW, + &rxr->hn_rsc_drop, + "# of RSC fragments dropped"); SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree), OID_AUTO, "pktbuf_len", CTLFLAG_RD, @@ -7053,37 +7086,56 @@ hn_rndis_rxinfo(const void *info_data, int info_dlen, struct hn_rxinfo *info) dlen = pi->rm_size - pi->rm_pktinfooffset; data = pi->rm_data; - switch (pi->rm_type) { - case NDIS_PKTINFO_TYPE_VLAN: - if (__predict_false(dlen < NDIS_VLAN_INFO_SIZE)) - return (EINVAL); - info->vlan_info = *((const uint32_t *)data); - mask |= HN_RXINFO_VLAN; - break; + if (pi->rm_internal == 1) { + switch (pi->rm_type) { + case NDIS_PKTINFO_IT_PKTINFO_ID: + if (__predict_false(dlen < NDIS_PKTINFOID_SZ)) + return (EINVAL); + info->pktinfo_id = + (const struct packet_info_id *)data; + mask |= HN_RXINFO_PKTINFO_ID; + break; - case NDIS_PKTINFO_TYPE_CSUM: - if (__predict_false(dlen < NDIS_RXCSUM_INFO_SIZE)) - return (EINVAL); - info->csum_info = *((const uint32_t *)data); - mask |= HN_RXINFO_CSUM; - break; + default: + goto next; + } + } else { + switch (pi->rm_type) { + case NDIS_PKTINFO_TYPE_VLAN: + if (__predict_false(dlen + < NDIS_VLAN_INFO_SIZE)) + return (EINVAL); + info->vlan_info = (const uint32_t *)data; + mask |= HN_RXINFO_VLAN; + break; - case HN_NDIS_PKTINFO_TYPE_HASHVAL: - if (__predict_false(dlen < HN_NDIS_HASH_VALUE_SIZE)) - return (EINVAL); - info->hash_value = *((const uint32_t *)data); - mask |= HN_RXINFO_HASHVAL; - break; + case NDIS_PKTINFO_TYPE_CSUM: + if (__predict_false(dlen + < NDIS_RXCSUM_INFO_SIZE)) + return (EINVAL); + info->csum_info = (const uint32_t *)data; + mask |= HN_RXINFO_CSUM; + break; - case HN_NDIS_PKTINFO_TYPE_HASHINF: - if (__predict_false(dlen < HN_NDIS_HASH_INFO_SIZE)) - return (EINVAL); - info->hash_info = *((const uint32_t *)data); - mask |= HN_RXINFO_HASHINF; - break; + case HN_NDIS_PKTINFO_TYPE_HASHVAL: + if (__predict_false(dlen + < HN_NDIS_HASH_VALUE_SIZE)) + return (EINVAL); + info->hash_value = (const uint32_t *)data; + mask |= HN_RXINFO_HASHVAL; + break; - default: - goto next; + case HN_NDIS_PKTINFO_TYPE_HASHINF: + if (__predict_false(dlen + < HN_NDIS_HASH_INFO_SIZE)) + return (EINVAL); + info->hash_info = (const uint32_t *)data; + mask |= HN_RXINFO_HASHINF; + break; + + default: + goto next; + } } if (mask == HN_RXINFO_ALL) { @@ -7100,7 +7152,7 @@ next: * - If there is no hash value, invalidate the hash info. */ if ((mask & HN_RXINFO_HASHVAL) == 0) - info->hash_info = HN_NDIS_HASH_INFO_INVALID; + info->hash_info = NULL; return (0); } @@ -7118,12 +7170,34 @@ hn_rndis_check_overlap(int off, int len, int check_off, int check_len) return (true); } +static __inline void +hn_rsc_add_data(struct hn_rx_ring *rxr, const void *data, + uint32_t len, struct hn_rxinfo *info) +{ + uint32_t cnt = rxr->rsc.cnt; + + if (cnt) { + rxr->rsc.pktlen += len; + } else { + rxr->rsc.vlan_info = info->vlan_info; + rxr->rsc.csum_info = info->csum_info; + rxr->rsc.hash_info = info->hash_info; + rxr->rsc.hash_value = info->hash_value; + rxr->rsc.pktlen = len; + } + + rxr->rsc.frag_data[cnt] = data; + rxr->rsc.frag_len[cnt] = len; + rxr->rsc.cnt++; +} + static void hn_rndis_rx_data(struct hn_rx_ring *rxr, const void *data, int dlen) { const struct rndis_packet_msg *pkt; struct hn_rxinfo info; int data_off, pktinfo_off, data_len, pktinfo_len; + bool rsc_more= false; /* * Check length. @@ -7231,9 +7305,11 @@ hn_rndis_rx_data(struct hn_rx_ring *rxr, const void *data, int dlen) /* * Check per-packet-info coverage and find useful per-packet-info. */ - info.vlan_info = HN_NDIS_VLAN_INFO_INVALID; - info.csum_info = HN_NDIS_RXCSUM_INFO_INVALID; - info.hash_info = HN_NDIS_HASH_INFO_INVALID; + info.vlan_info = NULL; + info.csum_info = NULL; + info.hash_info = NULL; + info.pktinfo_id = NULL; + if (__predict_true(pktinfo_len != 0)) { bool overlap; int error; @@ -7277,7 +7353,43 @@ hn_rndis_rx_data(struct hn_rx_ring *rxr, const void *data, int dlen) pkt->rm_len, data_off, data_len); return; } - hn_rxpkt(rxr, ((const uint8_t *)pkt) + data_off, data_len, &info); + + /* Identify RSC fragments, drop invalid packets */ + if ((info.pktinfo_id != NULL) && + (info.pktinfo_id->flag & HN_NDIS_PKTINFO_SUBALLOC)) { + if (info.pktinfo_id->flag & HN_NDIS_PKTINFO_1ST_FRAG) { + rxr->rsc.cnt = 0; + rxr->hn_rsc_pkts++; + } else if (rxr->rsc.cnt == 0) + goto drop; + + rsc_more = true; + + if (info.pktinfo_id->flag & HN_NDIS_PKTINFO_LAST_FRAG) + rsc_more = false; + + if (rsc_more && rxr->rsc.is_last) + goto drop; + } else { + rxr->rsc.cnt = 0; + } + + if (__predict_false(rxr->rsc.cnt >= HN_NVS_RSC_MAX)) + goto drop; + + /* Store data in per rx ring structure */ + hn_rsc_add_data(rxr,((const uint8_t *)pkt) + data_off, + data_len, &info); + + if (rsc_more) + return; + + hn_rxpkt(rxr); + rxr->rsc.cnt = 0; + return; +drop: + rxr->hn_rsc_drop++; + return; } static __inline void @@ -7390,6 +7502,8 @@ hn_nvs_handle_rxbuf(struct hn_rx_ring *rxr, struct vmbus_channel *chan, "ofs %d, len %d\n", i, ofs, len); continue; } + + rxr->rsc.is_last = (i == (count - 1)); hn_rndis_rxpkt(rxr, rxr->hn_rxbuf + ofs, len); } diff --git a/sys/dev/hyperv/netvsc/if_hnreg.h b/sys/dev/hyperv/netvsc/if_hnreg.h index 154d69264679..54db556cc56d 100644 --- a/sys/dev/hyperv/netvsc/if_hnreg.h +++ b/sys/dev/hyperv/netvsc/if_hnreg.h @@ -48,6 +48,8 @@ #define HN_NVS_VERSION_2 0x30002 #define HN_NVS_VERSION_4 0x40000 #define HN_NVS_VERSION_5 0x50000 +#define HN_NVS_VERSION_6 0x60000 +#define HN_NVS_VERSION_61 0x60001 #define HN_NVS_RXBUF_SIG 0xcafe #define HN_NVS_CHIM_SIG 0xface @@ -101,6 +103,7 @@ struct hn_nvs_init { uint32_t nvs_ver_min; uint32_t nvs_ver_max; uint8_t nvs_rsvd[20]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_init) >= HN_NVS_REQSIZE_MIN); @@ -118,11 +121,13 @@ struct hn_nvs_ndis_conf { uint32_t nvs_rsvd; uint64_t nvs_caps; /* HN_NVS_NDIS_CONF_ */ uint8_t nvs_rsvd1[12]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_ndis_conf) >= HN_NVS_REQSIZE_MIN); #define HN_NVS_NDIS_CONF_SRIOV 0x0004 #define HN_NVS_NDIS_CONF_VLAN 0x0008 +#define HN_NVS_NDIS_CONF_RSC 0x0080 /* No response */ struct hn_nvs_ndis_init { @@ -130,6 +135,7 @@ struct hn_nvs_ndis_init { uint32_t nvs_ndis_major; /* NDIS_VERSION_MAJOR_ */ uint32_t nvs_ndis_minor; /* NDIS_VERSION_MINOR_ */ uint8_t nvs_rsvd[20]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_ndis_init) >= HN_NVS_REQSIZE_MIN); @@ -141,6 +147,7 @@ struct hn_nvs_datapath { uint32_t nvs_type; /* HN_NVS_TYPE_SET_DATAPATH */ uint32_t nvs_active_path;/* HN_NVS_DATAPATH_* */ uint32_t nvs_rsvd[6]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_datapath) >= HN_NVS_REQSIZE_MIN); @@ -149,6 +156,7 @@ struct hn_nvs_rxbuf_conn { uint32_t nvs_gpadl; /* RXBUF vmbus GPADL */ uint16_t nvs_sig; /* HN_NVS_RXBUF_SIG */ uint8_t nvs_rsvd[22]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_rxbuf_conn) >= HN_NVS_REQSIZE_MIN); @@ -171,6 +179,7 @@ struct hn_nvs_rxbuf_disconn { uint32_t nvs_type; /* HN_NVS_TYPE_RXBUF_DISCONN */ uint16_t nvs_sig; /* HN_NVS_RXBUF_SIG */ uint8_t nvs_rsvd[26]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_rxbuf_disconn) >= HN_NVS_REQSIZE_MIN); @@ -179,6 +188,7 @@ struct hn_nvs_chim_conn { uint32_t nvs_gpadl; /* chimney buf vmbus GPADL */ uint16_t nvs_sig; /* NDIS_NVS_CHIM_SIG */ uint8_t nvs_rsvd[22]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_chim_conn) >= HN_NVS_REQSIZE_MIN); @@ -193,6 +203,7 @@ struct hn_nvs_chim_disconn { uint32_t nvs_type; /* HN_NVS_TYPE_CHIM_DISCONN */ uint16_t nvs_sig; /* HN_NVS_CHIM_SIG */ uint8_t nvs_rsvd[26]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_chim_disconn) >= HN_NVS_REQSIZE_MIN); @@ -203,6 +214,7 @@ struct hn_nvs_subch_req { uint32_t nvs_op; /* HN_NVS_SUBCH_OP_ */ uint32_t nvs_nsubch; uint8_t nvs_rsvd[20]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_subch_req) >= HN_NVS_REQSIZE_MIN); @@ -226,6 +238,7 @@ struct hn_nvs_rndis { uint32_t nvs_chim_idx; uint32_t nvs_chim_sz; uint8_t nvs_rsvd[16]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_rndis) >= HN_NVS_REQSIZE_MIN); @@ -233,6 +246,7 @@ struct hn_nvs_rndis_ack { uint32_t nvs_type; /* HN_NVS_TYPE_RNDIS_ACK */ uint32_t nvs_status; /* HN_NVS_STATUS_ */ uint8_t nvs_rsvd[24]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_rndis_ack) >= HN_NVS_REQSIZE_MIN); diff --git a/sys/dev/hyperv/netvsc/if_hnvar.h b/sys/dev/hyperv/netvsc/if_hnvar.h index c0e17c9643e0..27d93db5395e 100644 --- a/sys/dev/hyperv/netvsc/if_hnvar.h +++ b/sys/dev/hyperv/netvsc/if_hnvar.h @@ -33,7 +33,7 @@ #define HN_CHIM_SIZE (15 * 1024 * 1024) -#define HN_RXBUF_SIZE (16 * 1024 * 1024) +#define HN_RXBUF_SIZE (31 * 1024 * 1024) #define HN_RXBUF_SIZE_COMPAT (15 * 1024 * 1024) #define HN_MTU_MAX (65535 - ETHER_ADDR_LEN) @@ -56,6 +56,20 @@ struct buf_ring; #endif struct hn_tx_ring; +#define HN_NVS_RSC_MAX 562 /* Max RSC frags in one vmbus packet */ + +struct hn_rx_rsc { + const uint32_t *vlan_info; + const uint32_t *csum_info; + const uint32_t *hash_info; + const uint32_t *hash_value; + uint32_t cnt; /* fragment count */ + uint32_t pktlen; /* full packet length */ + uint8_t is_last; /* last fragment */ + const void *frag_data[HN_NVS_RSC_MAX]; + uint32_t frag_len[HN_NVS_RSC_MAX]; +}; + struct hn_rx_ring { struct ifnet *hn_ifp; struct ifnet *hn_rxvf_ifp; /* SR-IOV VF for RX */ @@ -66,6 +80,7 @@ struct hn_rx_ring { uint32_t hn_mbuf_hash; /* NDIS_HASH_ */ uint8_t *hn_rxbuf; /* shadow sc->hn_rxbuf */ int hn_rx_idx; + struct hn_rx_rsc rsc; /* Trust csum verification on host side */ int hn_trust_hcsum; /* HN_TRUST_HCSUM_ */ @@ -80,6 +95,8 @@ struct hn_rx_ring { u_long hn_pkts; u_long hn_rss_pkts; u_long hn_ack_failed; + u_long hn_rsc_pkts; + u_long hn_rsc_drop; /* Rarely used stuffs */ struct sysctl_oid *hn_rx_sysctl_tree; diff --git a/sys/dev/hyperv/netvsc/ndis.h b/sys/dev/hyperv/netvsc/ndis.h index 32b6aa307452..c69da7807a63 100644 --- a/sys/dev/hyperv/netvsc/ndis.h +++ b/sys/dev/hyperv/netvsc/ndis.h @@ -115,8 +115,8 @@ struct ndis_offload_params { /* NDIS >= 6.30 */ uint8_t ndis_rsc_ip4; /* NDIS_OFFLOAD_RSC_ */ uint8_t ndis_rsc_ip6; /* NDIS_OFFLOAD_RSC_ */ - uint32_t ndis_encap; /* NDIS_OFFLOAD_SET_ */ - uint32_t ndis_encap_types;/* NDIS_ENCAP_TYPE_ */ + uint8_t ndis_encap; /* NDIS_OFFLOAD_SET_ */ + uint8_t ndis_encap_types;/* NDIS_ENCAP_TYPE_ */ }; #define NDIS_OFFLOAD_PARAMS_SIZE sizeof(struct ndis_offload_params) @@ -305,17 +305,17 @@ struct ndis_lsov2_offload { struct ndis_ipsecv2_offload { uint32_t ndis_encap; /*NDIS_OFFLOAD_ENCAP_*/ - uint16_t ndis_ip6; - uint16_t ndis_ip4opt; - uint16_t ndis_ip6ext; - uint16_t ndis_ah; - uint16_t ndis_esp; - uint16_t ndis_ah_esp; - uint16_t ndis_xport; - uint16_t ndis_tun; - uint16_t ndis_xport_tun; - uint16_t ndis_lso; - uint16_t ndis_extseq; + uint8_t ndis_ip6; + uint8_t ndis_ip4opt; + uint8_t ndis_ip6ext; + uint8_t ndis_ah; + uint8_t ndis_esp; + uint8_t ndis_ah_esp; + uint8_t ndis_xport; + uint8_t ndis_tun; + uint8_t ndis_xport_tun; + uint8_t ndis_lso; + uint8_t ndis_extseq; uint32_t ndis_udp_esp; uint32_t ndis_auth; uint32_t ndis_crypto; @@ -323,8 +323,8 @@ struct ndis_ipsecv2_offload { }; struct ndis_rsc_offload { - uint16_t ndis_ip4; - uint16_t ndis_ip6; + uint8_t ndis_ip4; + uint8_t ndis_ip6; }; struct ndis_encap_offload { @@ -419,5 +419,4 @@ struct ndis_offload { #define NDIS_TXCSUM_INFO_MKUDPCS(thoff) \ NDIS_TXCSUM_INFO_MKL4CS((thoff), NDIS_TXCSUM_INFO_UDPCS) - #endif /* !_NET_NDIS_H_ */ diff --git a/sys/net/rndis.h b/sys/net/rndis.h index 5d45469a4b52..56350dbb7824 100644 --- a/sys/net/rndis.h +++ b/sys/net/rndis.h @@ -142,7 +142,8 @@ struct rndis_packet_msg { /* Per-packet-info for RNDIS data message */ struct rndis_pktinfo { uint32_t rm_size; - uint32_t rm_type; /* NDIS_PKTINFO_TYPE_ */ + uint32_t rm_type:31; /* NDIS_PKTINFO_TYPE_ */ + uint32_t rm_internal:1; /* Indicate if internal type */ uint32_t rm_pktinfooffset; uint8_t rm_data[]; }; @@ -165,6 +166,10 @@ struct rndis_pktinfo { #define NDIS_PKTINFO_TYPE_CACHE_NBLIST 10 #define NDIS_PKTINFO_TYPE_PKT_PAD 11 +/* Per-packet-info internal type */ +#define NDIS_PKTINFO_IT_PKTINFO_ID 1 +/* Add more internal type here */ + /* * RNDIS control messages */ From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 09:16: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 C46FA5C2769; Mon, 29 Mar 2021 09:16: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 4F86Px5D6Xz4sSL; Mon, 29 Mar 2021 09:16: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 A5E5F106EC; Mon, 29 Mar 2021 09:16: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 12T9G59K053403; Mon, 29 Mar 2021 09:16:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12T9G54c053402; Mon, 29 Mar 2021 09:16:05 GMT (envelope-from git) Date: Mon, 29 Mar 2021 09:16:05 GMT Message-Id: <202103290916.12T9G54c053402@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wei Hu Subject: git: 2a321939b02b - stable/12 - Hyper-V: hn: Initialize the internal field of per packet info on tx path MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2a321939b02bbf6123ba029f1967778c10538fe6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 09:16:05 -0000 The branch stable/12 has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=2a321939b02bbf6123ba029f1967778c10538fe6 commit 2a321939b02bbf6123ba029f1967778c10538fe6 Author: Wei Hu AuthorDate: 2021-03-15 10:20:52 +0000 Commit: Wei Hu CommitDate: 2021-03-29 09:12:56 +0000 Hyper-V: hn: Initialize the internal field of per packet info on tx path The RSC support feature introduced a bit field "rm_internal" in struct rndis_pktinfo with total size unchanged. The guest does not use this field in the tx path. However we need to initialize it to zero in case older hosts which are not aware of this field. Fixes: a491581f ("Hyper-V: hn: Enable vSwitch RSC support") MFC after: 2 weeks Sponsored by: Microsoft (cherry picked from commit 805dbff6c36a6cd84491aa53a02315fa025734cc) --- sys/dev/hyperv/netvsc/if_hn.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c index 1e90e8ef14fb..54d2e41c36c8 100644 --- a/sys/dev/hyperv/netvsc/if_hn.c +++ b/sys/dev/hyperv/netvsc/if_hn.c @@ -2928,6 +2928,7 @@ hn_rndis_pktinfo_append(struct rndis_packet_msg *pkt, size_t pktsize, pi->rm_size = pi_size; pi->rm_type = pi_type; + pi->rm_internal = 0; pi->rm_pktinfooffset = RNDIS_PKTINFO_OFFSET; return (pi->rm_data); From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 10:19: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 C48F65C3F01; Mon, 29 Mar 2021 10:19: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 4F87pX4P5zz3D5r; Mon, 29 Mar 2021 10:19: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 8992011A40; Mon, 29 Mar 2021 10:19: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 12TAJ0W1037568; Mon, 29 Mar 2021 10:19:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TAJ0SS037567; Mon, 29 Mar 2021 10:19:00 GMT (envelope-from git) Date: Mon, 29 Mar 2021 10:19:00 GMT Message-Id: <202103291019.12TAJ0SS037567@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wei Hu Subject: git: a86be0da9a03 - stable/13 - Hyper-V: hn: Store host hash value in flowid MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a86be0da9a03840bcf19499428e8868728c0082e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 10:19:00 -0000 The branch stable/13 has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=a86be0da9a03840bcf19499428e8868728c0082e commit a86be0da9a03840bcf19499428e8868728c0082e Author: Wei Hu AuthorDate: 2021-02-24 05:07:46 +0000 Commit: Wei Hu CommitDate: 2021-03-29 10:18:20 +0000 Hyper-V: hn: Store host hash value in flowid When rx packet contains hash value sent from host, store it in the mbuf's flowid field so when the same mbuf is on the tx path, the hash value can be used by the host to determine the outgoing network queue. MFC after: 2 weeks Sponsored by: Microsoft (cherry picked from commit 80f39bd95f22322152709ea5fae3a3c546044c9c) --- sys/dev/hyperv/netvsc/if_hn.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c index 5a57ea796d0e..9243ff226f5b 100644 --- a/sys/dev/hyperv/netvsc/if_hn.c +++ b/sys/dev/hyperv/netvsc/if_hn.c @@ -3077,13 +3077,24 @@ hn_encap(struct ifnet *ifp, struct hn_tx_ring *txr, struct hn_txdesc *txd, if (txr->hn_tx_flags & HN_TX_FLAG_HASHVAL) { /* - * Set the hash value for this packet, so that the host could - * dispatch the TX done event for this packet back to this TX - * ring's channel. + * Set the hash value for this packet. */ pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN, HN_NDIS_HASH_VALUE_SIZE, HN_NDIS_PKTINFO_TYPE_HASHVAL); - *pi_data = txr->hn_tx_idx; + + if (M_HASHTYPE_ISHASH(m_head)) + /* + * The flowid field contains the hash value host + * set in the rx queue if it is a ip forwarding pkt. + * Set the same hash value so host can send on the + * cpu it was received. + */ + *pi_data = m_head->m_pkthdr.flowid; + else + /* + * Otherwise just put the tx queue index. + */ + *pi_data = txr->hn_tx_idx; } if (m_head->m_flags & M_VLANTAG) { From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 10:20: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 1688E5C3CD2; Mon, 29 Mar 2021 10:20: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 4F87rh090kz3D7M; Mon, 29 Mar 2021 10:20: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 EC8EC11758; Mon, 29 Mar 2021 10:20: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 12TAKpBB046106; Mon, 29 Mar 2021 10:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TAKpGs046105; Mon, 29 Mar 2021 10:20:51 GMT (envelope-from git) Date: Mon, 29 Mar 2021 10:20:51 GMT Message-Id: <202103291020.12TAKpGs046105@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wei Hu Subject: git: cdc59163ff8e - stable/13 - Hyper-V: hn: Enable vSwitch RSC support in hn netvsc driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cdc59163ff8e8f2a98ef8ca02773d1d2047e3aae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 10:20:52 -0000 The branch stable/13 has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=cdc59163ff8e8f2a98ef8ca02773d1d2047e3aae commit cdc59163ff8e8f2a98ef8ca02773d1d2047e3aae Author: Wei Hu AuthorDate: 2021-03-12 04:35:16 +0000 Commit: Wei Hu CommitDate: 2021-03-29 10:20:03 +0000 Hyper-V: hn: Enable vSwitch RSC support in hn netvsc driver Receive Segment Coalescing (RSC) in the vSwitch is a feature available in Windows Server 2019 hosts and later. It reduces the per packet processing overhead by coalescing multiple TCP segments when possible. This happens mostly when TCP traffics are among different guests on same host. This patch adds netvsc driver support for this feature. The patch also updates NVS version to 6.1 as needed for RSC enablement. MFC after: 2 weeks Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D29075 (cherry picked from commit a491581f3f8df07cdff0236bd556895205929af4) --- sys/dev/hyperv/netvsc/hn_nvs.c | 5 + sys/dev/hyperv/netvsc/hn_rndis.c | 25 ++++ sys/dev/hyperv/netvsc/if_hn.c | 258 ++++++++++++++++++++++++++++----------- sys/dev/hyperv/netvsc/if_hnreg.h | 14 +++ sys/dev/hyperv/netvsc/if_hnvar.h | 19 ++- sys/dev/hyperv/netvsc/ndis.h | 31 +++-- sys/net/rndis.h | 7 +- 7 files changed, 269 insertions(+), 90 deletions(-) diff --git a/sys/dev/hyperv/netvsc/hn_nvs.c b/sys/dev/hyperv/netvsc/hn_nvs.c index 73a112c4e5e1..4dbc28996617 100644 --- a/sys/dev/hyperv/netvsc/hn_nvs.c +++ b/sys/dev/hyperv/netvsc/hn_nvs.c @@ -80,6 +80,8 @@ struct hn_nvs_sendctx hn_nvs_sendctx_none = HN_NVS_SENDCTX_INITIALIZER(hn_nvs_sent_none, NULL); static const uint32_t hn_nvs_version[] = { + HN_NVS_VERSION_61, + HN_NVS_VERSION_6, HN_NVS_VERSION_5, HN_NVS_VERSION_4, HN_NVS_VERSION_2, @@ -508,6 +510,9 @@ hn_nvs_conf_ndis(struct hn_softc *sc, int mtu) conf.nvs_caps = HN_NVS_NDIS_CONF_VLAN; if (sc->hn_nvs_ver >= HN_NVS_VERSION_5) conf.nvs_caps |= HN_NVS_NDIS_CONF_SRIOV; + if (sc->hn_nvs_ver >= HN_NVS_VERSION_61) + conf.nvs_caps |= HN_NVS_NDIS_CONF_RSC; + /* NOTE: No response. */ error = hn_nvs_req_send(sc, &conf, sizeof(conf)); diff --git a/sys/dev/hyperv/netvsc/hn_rndis.c b/sys/dev/hyperv/netvsc/hn_rndis.c index b9bf683fe811..794a82cf3957 100644 --- a/sys/dev/hyperv/netvsc/hn_rndis.c +++ b/sys/dev/hyperv/netvsc/hn_rndis.c @@ -723,6 +723,17 @@ hn_rndis_conf_offload(struct hn_softc *sc, int mtu) params.ndis_udp6csum = NDIS_OFFLOAD_PARAM_RX; } + /* RSC offload */ + if (hwcaps.ndis_hdr.ndis_rev >= NDIS_OFFLOAD_PARAMS_REV_3) { + if (hwcaps.ndis_rsc.ndis_ip4 && hwcaps.ndis_rsc.ndis_ip6) { + params.ndis_rsc_ip4 = NDIS_OFFLOAD_RSC_ON; + params.ndis_rsc_ip6 = NDIS_OFFLOAD_RSC_ON; + } else { + params.ndis_rsc_ip4 = NDIS_OFFLOAD_RSC_OFF; + params.ndis_rsc_ip6 = NDIS_OFFLOAD_RSC_OFF; + } + } + if (bootverbose) { if_printf(sc->hn_ifp, "offload csum: " "ip4 %u, tcp4 %u, udp4 %u, tcp6 %u, udp6 %u\n", @@ -734,6 +745,10 @@ hn_rndis_conf_offload(struct hn_softc *sc, int mtu) if_printf(sc->hn_ifp, "offload lsov2: ip4 %u, ip6 %u\n", params.ndis_lsov2_ip4, params.ndis_lsov2_ip6); + if (hwcaps.ndis_hdr.ndis_rev >= NDIS_OFFLOAD_PARAMS_REV_3) + if_printf(sc->hn_ifp, "offload rsc: ip4 %u, ip6 %u\n", + params.ndis_rsc_ip4, + params.ndis_rsc_ip6); } error = hn_rndis_set(sc, OID_TCP_OFFLOAD_PARAMETERS, ¶ms, paramsz); @@ -969,6 +984,11 @@ hn_rndis_query_hwcaps(struct hn_softc *sc, struct ndis_offload *caps) if_printf(sc->hn_ifp, "invalid NDIS objsize %u\n", caps->ndis_hdr.ndis_size); return (EINVAL); + } else if (caps->ndis_hdr.ndis_rev >= NDIS_OFFLOAD_REV_3 && + caps->ndis_hdr.ndis_size < NDIS_OFFLOAD_SIZE) { + if_printf(sc->hn_ifp, "invalid NDIS rev3 objsize %u\n", + caps->ndis_hdr.ndis_size); + return (EINVAL); } if (bootverbose) { @@ -1001,6 +1021,11 @@ hn_rndis_query_hwcaps(struct hn_softc *sc, struct ndis_offload *caps) caps->ndis_lsov2.ndis_ip6_minsg, caps->ndis_lsov2.ndis_ip6_encap, caps->ndis_lsov2.ndis_ip6_opts); + if (caps->ndis_hdr.ndis_rev >= NDIS_OFFLOAD_REV_3) + if_printf(sc->hn_ifp, "hwcaps rsc: " + "ip4 %u ip6 %u\n", + caps->ndis_rsc.ndis_ip4, + caps->ndis_rsc.ndis_ip6); } return (0); } diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c index 9243ff226f5b..f4bdbb1ee788 100644 --- a/sys/dev/hyperv/netvsc/if_hn.c +++ b/sys/dev/hyperv/netvsc/if_hn.c @@ -223,11 +223,25 @@ struct hn_txdesc { #define HN_TXD_FLAG_DMAMAP 0x0002 #define HN_TXD_FLAG_ONAGG 0x0004 +#define HN_NDIS_PKTINFO_SUBALLOC 0x01 +#define HN_NDIS_PKTINFO_1ST_FRAG 0x02 +#define HN_NDIS_PKTINFO_LAST_FRAG 0x04 + +struct packet_info_id { + uint8_t ver; + uint8_t flag; + uint16_t pkt_id; +}; + +#define NDIS_PKTINFOID_SZ sizeof(struct packet_info_id) + + struct hn_rxinfo { - uint32_t vlan_info; - uint32_t csum_info; - uint32_t hash_info; - uint32_t hash_value; + const uint32_t *vlan_info; + const uint32_t *csum_info; + const uint32_t *hash_info; + const uint32_t *hash_value; + const struct packet_info_id *pktinfo_id; }; struct hn_rxvf_setarg { @@ -239,15 +253,13 @@ struct hn_rxvf_setarg { #define HN_RXINFO_CSUM 0x0002 #define HN_RXINFO_HASHINF 0x0004 #define HN_RXINFO_HASHVAL 0x0008 +#define HN_RXINFO_PKTINFO_ID 0x0010 #define HN_RXINFO_ALL \ (HN_RXINFO_VLAN | \ HN_RXINFO_CSUM | \ HN_RXINFO_HASHINF | \ - HN_RXINFO_HASHVAL) - -#define HN_NDIS_VLAN_INFO_INVALID 0xffffffff -#define HN_NDIS_RXCSUM_INFO_INVALID 0 -#define HN_NDIS_HASH_INFO_INVALID 0 + HN_RXINFO_HASHVAL | \ + HN_RXINFO_PKTINFO_ID) static int hn_probe(device_t); static int hn_attach(device_t); @@ -396,8 +408,7 @@ static int hn_rxfilter_config(struct hn_softc *); static int hn_rss_reconfig(struct hn_softc *); static void hn_rss_ind_fixup(struct hn_softc *); static void hn_rss_mbuf_hash(struct hn_softc *, uint32_t); -static int hn_rxpkt(struct hn_rx_ring *, const void *, - int, const struct hn_rxinfo *); +static int hn_rxpkt(struct hn_rx_ring *); static uint32_t hn_rss_type_fromndis(uint32_t); static uint32_t hn_rss_type_tondis(uint32_t); @@ -3353,9 +3364,10 @@ again: * allocated with cluster size MJUMPAGESIZE, and filled * accordingly. * - * Return 1 if able to complete the job; otherwise 0. + * Return the last mbuf in the chain or NULL if failed to + * allocate new mbuf. */ -static int +static struct mbuf * hv_m_append(struct mbuf *m0, int len, c_caddr_t cp) { struct mbuf *m, *n; @@ -3383,7 +3395,7 @@ hv_m_append(struct mbuf *m0, int len, c_caddr_t cp) */ n = m_getjcl(M_NOWAIT, m->m_type, 0, MJUMPAGESIZE); if (n == NULL) - break; + return NULL; n->m_len = min(MJUMPAGESIZE, remainder); bcopy(cp, mtod(n, caddr_t), n->m_len); cp += n->m_len; @@ -3391,10 +3403,8 @@ hv_m_append(struct mbuf *m0, int len, c_caddr_t cp) m->m_next = n; m = n; } - if (m0->m_flags & M_PKTHDR) - m0->m_pkthdr.len += len - remainder; - return (remainder == 0); + return m; } #if defined(INET) || defined(INET6) @@ -3412,14 +3422,14 @@ hn_lro_rx(struct lro_ctrl *lc, struct mbuf *m) #endif static int -hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, - const struct hn_rxinfo *info) +hn_rxpkt(struct hn_rx_ring *rxr) { struct ifnet *ifp, *hn_ifp = rxr->hn_ifp; - struct mbuf *m_new; + struct mbuf *m_new, *n; int size, do_lro = 0, do_csum = 1, is_vf = 0; int hash_type = M_HASHTYPE_NONE; int l3proto = ETHERTYPE_MAX, l4proto = IPPROTO_DONE; + int i; ifp = hn_ifp; if (rxr->hn_rxvf_ifp != NULL) { @@ -3446,20 +3456,20 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, return (0); } - if (__predict_false(dlen < ETHER_HDR_LEN)) { + if (__predict_false(rxr->rsc.pktlen < ETHER_HDR_LEN)) { if_inc_counter(hn_ifp, IFCOUNTER_IERRORS, 1); return (0); } - if (dlen <= MHLEN) { + if (rxr->rsc.cnt == 1 && rxr->rsc.pktlen <= MHLEN) { m_new = m_gethdr(M_NOWAIT, MT_DATA); if (m_new == NULL) { if_inc_counter(hn_ifp, IFCOUNTER_IQDROPS, 1); return (0); } - memcpy(mtod(m_new, void *), data, dlen); - m_new->m_pkthdr.len = m_new->m_len = dlen; - rxr->hn_small_pkts++; + memcpy(mtod(m_new, void *), rxr->rsc.frag_data[0], + rxr->rsc.frag_len[0]); + m_new->m_pkthdr.len = m_new->m_len = rxr->rsc.frag_len[0]; } else { /* * Get an mbuf with a cluster. For packets 2K or less, @@ -3468,7 +3478,7 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, * if looped around to the Hyper-V TX channel, so avoid them. */ size = MCLBYTES; - if (dlen > MCLBYTES) { + if (rxr->rsc.pktlen > MCLBYTES) { /* 4096 */ size = MJUMPAGESIZE; } @@ -3479,29 +3489,42 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, return (0); } - hv_m_append(m_new, dlen, data); + n = m_new; + for (i = 0; i < rxr->rsc.cnt; i++) { + n = hv_m_append(n, rxr->rsc.frag_len[i], + rxr->rsc.frag_data[i]); + if (n == NULL) { + if_inc_counter(hn_ifp, IFCOUNTER_IQDROPS, 1); + return (0); + } else { + m_new->m_pkthdr.len += rxr->rsc.frag_len[i]; + } + } } + if (rxr->rsc.pktlen <= MHLEN) + rxr->hn_small_pkts++; + m_new->m_pkthdr.rcvif = ifp; if (__predict_false((hn_ifp->if_capenable & IFCAP_RXCSUM) == 0)) do_csum = 0; /* receive side checksum offload */ - if (info->csum_info != HN_NDIS_RXCSUM_INFO_INVALID) { + if (rxr->rsc.csum_info != NULL) { /* IP csum offload */ - if ((info->csum_info & NDIS_RXCSUM_INFO_IPCS_OK) && do_csum) { + if ((*(rxr->rsc.csum_info) & NDIS_RXCSUM_INFO_IPCS_OK) && do_csum) { m_new->m_pkthdr.csum_flags |= (CSUM_IP_CHECKED | CSUM_IP_VALID); rxr->hn_csum_ip++; } /* TCP/UDP csum offload */ - if ((info->csum_info & (NDIS_RXCSUM_INFO_UDPCS_OK | + if ((*(rxr->rsc.csum_info) & (NDIS_RXCSUM_INFO_UDPCS_OK | NDIS_RXCSUM_INFO_TCPCS_OK)) && do_csum) { m_new->m_pkthdr.csum_flags |= (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); m_new->m_pkthdr.csum_data = 0xffff; - if (info->csum_info & NDIS_RXCSUM_INFO_TCPCS_OK) + if (*(rxr->rsc.csum_info) & NDIS_RXCSUM_INFO_TCPCS_OK) rxr->hn_csum_tcp++; else rxr->hn_csum_udp++; @@ -3514,7 +3537,7 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, * the do_lro setting here is actually _not_ accurate. We * depend on the RSS hash type check to reset do_lro. */ - if ((info->csum_info & + if ((*(rxr->rsc.csum_info) & (NDIS_RXCSUM_INFO_TCPCS_OK | NDIS_RXCSUM_INFO_IPCS_OK)) == (NDIS_RXCSUM_INFO_TCPCS_OK | NDIS_RXCSUM_INFO_IPCS_OK)) do_lro = 1; @@ -3551,11 +3574,11 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, } } - if (info->vlan_info != HN_NDIS_VLAN_INFO_INVALID) { + if (rxr->rsc.vlan_info != NULL) { m_new->m_pkthdr.ether_vtag = EVL_MAKETAG( - NDIS_VLAN_INFO_ID(info->vlan_info), - NDIS_VLAN_INFO_PRI(info->vlan_info), - NDIS_VLAN_INFO_CFI(info->vlan_info)); + NDIS_VLAN_INFO_ID(*(rxr->rsc.vlan_info)), + NDIS_VLAN_INFO_PRI(*(rxr->rsc.vlan_info)), + NDIS_VLAN_INFO_CFI(*(rxr->rsc.vlan_info))); m_new->m_flags |= M_VLANTAG; } @@ -3581,14 +3604,14 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, * matter here), do _not_ mess with unsupported hash types or * functions. */ - if (info->hash_info != HN_NDIS_HASH_INFO_INVALID) { + if (rxr->rsc.hash_info != NULL) { rxr->hn_rss_pkts++; - m_new->m_pkthdr.flowid = info->hash_value; + m_new->m_pkthdr.flowid = *(rxr->rsc.hash_value); if (!is_vf) hash_type = M_HASHTYPE_OPAQUE_HASH; - if ((info->hash_info & NDIS_HASH_FUNCTION_MASK) == + if ((*(rxr->rsc.hash_info) & NDIS_HASH_FUNCTION_MASK) == NDIS_HASH_FUNCTION_TOEPLITZ) { - uint32_t type = (info->hash_info & NDIS_HASH_TYPE_MASK & + uint32_t type = (*(rxr->rsc.hash_info) & NDIS_HASH_TYPE_MASK & rxr->hn_mbuf_hash); /* @@ -5033,6 +5056,16 @@ hn_create_rx_data(struct hn_softc *sc, int ring_cnt) OID_AUTO, "rss_pkts", CTLFLAG_RW, &rxr->hn_rss_pkts, "# of packets w/ RSS info received"); + SYSCTL_ADD_ULONG(ctx, + SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree), + OID_AUTO, "rsc_pkts", CTLFLAG_RW, + &rxr->hn_rsc_pkts, + "# of RSC packets received"); + SYSCTL_ADD_ULONG(ctx, + SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree), + OID_AUTO, "rsc_drop", CTLFLAG_RW, + &rxr->hn_rsc_drop, + "# of RSC fragments dropped"); SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree), OID_AUTO, "pktbuf_len", CTLFLAG_RD, @@ -7057,37 +7090,56 @@ hn_rndis_rxinfo(const void *info_data, int info_dlen, struct hn_rxinfo *info) dlen = pi->rm_size - pi->rm_pktinfooffset; data = pi->rm_data; - switch (pi->rm_type) { - case NDIS_PKTINFO_TYPE_VLAN: - if (__predict_false(dlen < NDIS_VLAN_INFO_SIZE)) - return (EINVAL); - info->vlan_info = *((const uint32_t *)data); - mask |= HN_RXINFO_VLAN; - break; + if (pi->rm_internal == 1) { + switch (pi->rm_type) { + case NDIS_PKTINFO_IT_PKTINFO_ID: + if (__predict_false(dlen < NDIS_PKTINFOID_SZ)) + return (EINVAL); + info->pktinfo_id = + (const struct packet_info_id *)data; + mask |= HN_RXINFO_PKTINFO_ID; + break; - case NDIS_PKTINFO_TYPE_CSUM: - if (__predict_false(dlen < NDIS_RXCSUM_INFO_SIZE)) - return (EINVAL); - info->csum_info = *((const uint32_t *)data); - mask |= HN_RXINFO_CSUM; - break; + default: + goto next; + } + } else { + switch (pi->rm_type) { + case NDIS_PKTINFO_TYPE_VLAN: + if (__predict_false(dlen + < NDIS_VLAN_INFO_SIZE)) + return (EINVAL); + info->vlan_info = (const uint32_t *)data; + mask |= HN_RXINFO_VLAN; + break; - case HN_NDIS_PKTINFO_TYPE_HASHVAL: - if (__predict_false(dlen < HN_NDIS_HASH_VALUE_SIZE)) - return (EINVAL); - info->hash_value = *((const uint32_t *)data); - mask |= HN_RXINFO_HASHVAL; - break; + case NDIS_PKTINFO_TYPE_CSUM: + if (__predict_false(dlen + < NDIS_RXCSUM_INFO_SIZE)) + return (EINVAL); + info->csum_info = (const uint32_t *)data; + mask |= HN_RXINFO_CSUM; + break; - case HN_NDIS_PKTINFO_TYPE_HASHINF: - if (__predict_false(dlen < HN_NDIS_HASH_INFO_SIZE)) - return (EINVAL); - info->hash_info = *((const uint32_t *)data); - mask |= HN_RXINFO_HASHINF; - break; + case HN_NDIS_PKTINFO_TYPE_HASHVAL: + if (__predict_false(dlen + < HN_NDIS_HASH_VALUE_SIZE)) + return (EINVAL); + info->hash_value = (const uint32_t *)data; + mask |= HN_RXINFO_HASHVAL; + break; - default: - goto next; + case HN_NDIS_PKTINFO_TYPE_HASHINF: + if (__predict_false(dlen + < HN_NDIS_HASH_INFO_SIZE)) + return (EINVAL); + info->hash_info = (const uint32_t *)data; + mask |= HN_RXINFO_HASHINF; + break; + + default: + goto next; + } } if (mask == HN_RXINFO_ALL) { @@ -7104,7 +7156,7 @@ next: * - If there is no hash value, invalidate the hash info. */ if ((mask & HN_RXINFO_HASHVAL) == 0) - info->hash_info = HN_NDIS_HASH_INFO_INVALID; + info->hash_info = NULL; return (0); } @@ -7122,12 +7174,34 @@ hn_rndis_check_overlap(int off, int len, int check_off, int check_len) return (true); } +static __inline void +hn_rsc_add_data(struct hn_rx_ring *rxr, const void *data, + uint32_t len, struct hn_rxinfo *info) +{ + uint32_t cnt = rxr->rsc.cnt; + + if (cnt) { + rxr->rsc.pktlen += len; + } else { + rxr->rsc.vlan_info = info->vlan_info; + rxr->rsc.csum_info = info->csum_info; + rxr->rsc.hash_info = info->hash_info; + rxr->rsc.hash_value = info->hash_value; + rxr->rsc.pktlen = len; + } + + rxr->rsc.frag_data[cnt] = data; + rxr->rsc.frag_len[cnt] = len; + rxr->rsc.cnt++; +} + static void hn_rndis_rx_data(struct hn_rx_ring *rxr, const void *data, int dlen) { const struct rndis_packet_msg *pkt; struct hn_rxinfo info; int data_off, pktinfo_off, data_len, pktinfo_len; + bool rsc_more= false; /* * Check length. @@ -7235,9 +7309,11 @@ hn_rndis_rx_data(struct hn_rx_ring *rxr, const void *data, int dlen) /* * Check per-packet-info coverage and find useful per-packet-info. */ - info.vlan_info = HN_NDIS_VLAN_INFO_INVALID; - info.csum_info = HN_NDIS_RXCSUM_INFO_INVALID; - info.hash_info = HN_NDIS_HASH_INFO_INVALID; + info.vlan_info = NULL; + info.csum_info = NULL; + info.hash_info = NULL; + info.pktinfo_id = NULL; + if (__predict_true(pktinfo_len != 0)) { bool overlap; int error; @@ -7281,7 +7357,43 @@ hn_rndis_rx_data(struct hn_rx_ring *rxr, const void *data, int dlen) pkt->rm_len, data_off, data_len); return; } - hn_rxpkt(rxr, ((const uint8_t *)pkt) + data_off, data_len, &info); + + /* Identify RSC fragments, drop invalid packets */ + if ((info.pktinfo_id != NULL) && + (info.pktinfo_id->flag & HN_NDIS_PKTINFO_SUBALLOC)) { + if (info.pktinfo_id->flag & HN_NDIS_PKTINFO_1ST_FRAG) { + rxr->rsc.cnt = 0; + rxr->hn_rsc_pkts++; + } else if (rxr->rsc.cnt == 0) + goto drop; + + rsc_more = true; + + if (info.pktinfo_id->flag & HN_NDIS_PKTINFO_LAST_FRAG) + rsc_more = false; + + if (rsc_more && rxr->rsc.is_last) + goto drop; + } else { + rxr->rsc.cnt = 0; + } + + if (__predict_false(rxr->rsc.cnt >= HN_NVS_RSC_MAX)) + goto drop; + + /* Store data in per rx ring structure */ + hn_rsc_add_data(rxr,((const uint8_t *)pkt) + data_off, + data_len, &info); + + if (rsc_more) + return; + + hn_rxpkt(rxr); + rxr->rsc.cnt = 0; + return; +drop: + rxr->hn_rsc_drop++; + return; } static __inline void @@ -7394,6 +7506,8 @@ hn_nvs_handle_rxbuf(struct hn_rx_ring *rxr, struct vmbus_channel *chan, "ofs %d, len %d\n", i, ofs, len); continue; } + + rxr->rsc.is_last = (i == (count - 1)); hn_rndis_rxpkt(rxr, rxr->hn_rxbuf + ofs, len); } diff --git a/sys/dev/hyperv/netvsc/if_hnreg.h b/sys/dev/hyperv/netvsc/if_hnreg.h index 154d69264679..54db556cc56d 100644 --- a/sys/dev/hyperv/netvsc/if_hnreg.h +++ b/sys/dev/hyperv/netvsc/if_hnreg.h @@ -48,6 +48,8 @@ #define HN_NVS_VERSION_2 0x30002 #define HN_NVS_VERSION_4 0x40000 #define HN_NVS_VERSION_5 0x50000 +#define HN_NVS_VERSION_6 0x60000 +#define HN_NVS_VERSION_61 0x60001 #define HN_NVS_RXBUF_SIG 0xcafe #define HN_NVS_CHIM_SIG 0xface @@ -101,6 +103,7 @@ struct hn_nvs_init { uint32_t nvs_ver_min; uint32_t nvs_ver_max; uint8_t nvs_rsvd[20]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_init) >= HN_NVS_REQSIZE_MIN); @@ -118,11 +121,13 @@ struct hn_nvs_ndis_conf { uint32_t nvs_rsvd; uint64_t nvs_caps; /* HN_NVS_NDIS_CONF_ */ uint8_t nvs_rsvd1[12]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_ndis_conf) >= HN_NVS_REQSIZE_MIN); #define HN_NVS_NDIS_CONF_SRIOV 0x0004 #define HN_NVS_NDIS_CONF_VLAN 0x0008 +#define HN_NVS_NDIS_CONF_RSC 0x0080 /* No response */ struct hn_nvs_ndis_init { @@ -130,6 +135,7 @@ struct hn_nvs_ndis_init { uint32_t nvs_ndis_major; /* NDIS_VERSION_MAJOR_ */ uint32_t nvs_ndis_minor; /* NDIS_VERSION_MINOR_ */ uint8_t nvs_rsvd[20]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_ndis_init) >= HN_NVS_REQSIZE_MIN); @@ -141,6 +147,7 @@ struct hn_nvs_datapath { uint32_t nvs_type; /* HN_NVS_TYPE_SET_DATAPATH */ uint32_t nvs_active_path;/* HN_NVS_DATAPATH_* */ uint32_t nvs_rsvd[6]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_datapath) >= HN_NVS_REQSIZE_MIN); @@ -149,6 +156,7 @@ struct hn_nvs_rxbuf_conn { uint32_t nvs_gpadl; /* RXBUF vmbus GPADL */ uint16_t nvs_sig; /* HN_NVS_RXBUF_SIG */ uint8_t nvs_rsvd[22]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_rxbuf_conn) >= HN_NVS_REQSIZE_MIN); @@ -171,6 +179,7 @@ struct hn_nvs_rxbuf_disconn { uint32_t nvs_type; /* HN_NVS_TYPE_RXBUF_DISCONN */ uint16_t nvs_sig; /* HN_NVS_RXBUF_SIG */ uint8_t nvs_rsvd[26]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_rxbuf_disconn) >= HN_NVS_REQSIZE_MIN); @@ -179,6 +188,7 @@ struct hn_nvs_chim_conn { uint32_t nvs_gpadl; /* chimney buf vmbus GPADL */ uint16_t nvs_sig; /* NDIS_NVS_CHIM_SIG */ uint8_t nvs_rsvd[22]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_chim_conn) >= HN_NVS_REQSIZE_MIN); @@ -193,6 +203,7 @@ struct hn_nvs_chim_disconn { uint32_t nvs_type; /* HN_NVS_TYPE_CHIM_DISCONN */ uint16_t nvs_sig; /* HN_NVS_CHIM_SIG */ uint8_t nvs_rsvd[26]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_chim_disconn) >= HN_NVS_REQSIZE_MIN); @@ -203,6 +214,7 @@ struct hn_nvs_subch_req { uint32_t nvs_op; /* HN_NVS_SUBCH_OP_ */ uint32_t nvs_nsubch; uint8_t nvs_rsvd[20]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_subch_req) >= HN_NVS_REQSIZE_MIN); @@ -226,6 +238,7 @@ struct hn_nvs_rndis { uint32_t nvs_chim_idx; uint32_t nvs_chim_sz; uint8_t nvs_rsvd[16]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_rndis) >= HN_NVS_REQSIZE_MIN); @@ -233,6 +246,7 @@ struct hn_nvs_rndis_ack { uint32_t nvs_type; /* HN_NVS_TYPE_RNDIS_ACK */ uint32_t nvs_status; /* HN_NVS_STATUS_ */ uint8_t nvs_rsvd[24]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_rndis_ack) >= HN_NVS_REQSIZE_MIN); diff --git a/sys/dev/hyperv/netvsc/if_hnvar.h b/sys/dev/hyperv/netvsc/if_hnvar.h index c0e17c9643e0..27d93db5395e 100644 --- a/sys/dev/hyperv/netvsc/if_hnvar.h +++ b/sys/dev/hyperv/netvsc/if_hnvar.h @@ -33,7 +33,7 @@ #define HN_CHIM_SIZE (15 * 1024 * 1024) -#define HN_RXBUF_SIZE (16 * 1024 * 1024) +#define HN_RXBUF_SIZE (31 * 1024 * 1024) #define HN_RXBUF_SIZE_COMPAT (15 * 1024 * 1024) #define HN_MTU_MAX (65535 - ETHER_ADDR_LEN) @@ -56,6 +56,20 @@ struct buf_ring; #endif struct hn_tx_ring; +#define HN_NVS_RSC_MAX 562 /* Max RSC frags in one vmbus packet */ + +struct hn_rx_rsc { + const uint32_t *vlan_info; + const uint32_t *csum_info; + const uint32_t *hash_info; + const uint32_t *hash_value; + uint32_t cnt; /* fragment count */ + uint32_t pktlen; /* full packet length */ + uint8_t is_last; /* last fragment */ + const void *frag_data[HN_NVS_RSC_MAX]; + uint32_t frag_len[HN_NVS_RSC_MAX]; +}; + struct hn_rx_ring { struct ifnet *hn_ifp; struct ifnet *hn_rxvf_ifp; /* SR-IOV VF for RX */ @@ -66,6 +80,7 @@ struct hn_rx_ring { uint32_t hn_mbuf_hash; /* NDIS_HASH_ */ uint8_t *hn_rxbuf; /* shadow sc->hn_rxbuf */ int hn_rx_idx; + struct hn_rx_rsc rsc; /* Trust csum verification on host side */ int hn_trust_hcsum; /* HN_TRUST_HCSUM_ */ @@ -80,6 +95,8 @@ struct hn_rx_ring { u_long hn_pkts; u_long hn_rss_pkts; u_long hn_ack_failed; + u_long hn_rsc_pkts; + u_long hn_rsc_drop; /* Rarely used stuffs */ struct sysctl_oid *hn_rx_sysctl_tree; diff --git a/sys/dev/hyperv/netvsc/ndis.h b/sys/dev/hyperv/netvsc/ndis.h index 32b6aa307452..c69da7807a63 100644 --- a/sys/dev/hyperv/netvsc/ndis.h +++ b/sys/dev/hyperv/netvsc/ndis.h @@ -115,8 +115,8 @@ struct ndis_offload_params { /* NDIS >= 6.30 */ uint8_t ndis_rsc_ip4; /* NDIS_OFFLOAD_RSC_ */ uint8_t ndis_rsc_ip6; /* NDIS_OFFLOAD_RSC_ */ - uint32_t ndis_encap; /* NDIS_OFFLOAD_SET_ */ - uint32_t ndis_encap_types;/* NDIS_ENCAP_TYPE_ */ + uint8_t ndis_encap; /* NDIS_OFFLOAD_SET_ */ + uint8_t ndis_encap_types;/* NDIS_ENCAP_TYPE_ */ }; #define NDIS_OFFLOAD_PARAMS_SIZE sizeof(struct ndis_offload_params) @@ -305,17 +305,17 @@ struct ndis_lsov2_offload { struct ndis_ipsecv2_offload { uint32_t ndis_encap; /*NDIS_OFFLOAD_ENCAP_*/ - uint16_t ndis_ip6; - uint16_t ndis_ip4opt; - uint16_t ndis_ip6ext; - uint16_t ndis_ah; - uint16_t ndis_esp; - uint16_t ndis_ah_esp; - uint16_t ndis_xport; - uint16_t ndis_tun; - uint16_t ndis_xport_tun; - uint16_t ndis_lso; - uint16_t ndis_extseq; + uint8_t ndis_ip6; + uint8_t ndis_ip4opt; + uint8_t ndis_ip6ext; + uint8_t ndis_ah; + uint8_t ndis_esp; + uint8_t ndis_ah_esp; + uint8_t ndis_xport; + uint8_t ndis_tun; + uint8_t ndis_xport_tun; + uint8_t ndis_lso; + uint8_t ndis_extseq; uint32_t ndis_udp_esp; uint32_t ndis_auth; uint32_t ndis_crypto; @@ -323,8 +323,8 @@ struct ndis_ipsecv2_offload { }; struct ndis_rsc_offload { - uint16_t ndis_ip4; - uint16_t ndis_ip6; + uint8_t ndis_ip4; + uint8_t ndis_ip6; }; struct ndis_encap_offload { @@ -419,5 +419,4 @@ struct ndis_offload { #define NDIS_TXCSUM_INFO_MKUDPCS(thoff) \ NDIS_TXCSUM_INFO_MKL4CS((thoff), NDIS_TXCSUM_INFO_UDPCS) - #endif /* !_NET_NDIS_H_ */ diff --git a/sys/net/rndis.h b/sys/net/rndis.h index 5d45469a4b52..56350dbb7824 100644 --- a/sys/net/rndis.h +++ b/sys/net/rndis.h @@ -142,7 +142,8 @@ struct rndis_packet_msg { /* Per-packet-info for RNDIS data message */ struct rndis_pktinfo { uint32_t rm_size; - uint32_t rm_type; /* NDIS_PKTINFO_TYPE_ */ + uint32_t rm_type:31; /* NDIS_PKTINFO_TYPE_ */ + uint32_t rm_internal:1; /* Indicate if internal type */ uint32_t rm_pktinfooffset; uint8_t rm_data[]; }; @@ -165,6 +166,10 @@ struct rndis_pktinfo { #define NDIS_PKTINFO_TYPE_CACHE_NBLIST 10 #define NDIS_PKTINFO_TYPE_PKT_PAD 11 +/* Per-packet-info internal type */ +#define NDIS_PKTINFO_IT_PKTINFO_ID 1 +/* Add more internal type here */ + /* * RNDIS control messages */ From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 10:22: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 67E055C4106; Mon, 29 Mar 2021 10:22: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 4F87tL2T8Hz3DdK; Mon, 29 Mar 2021 10:22: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 47C2211BA4; Mon, 29 Mar 2021 10:22: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 12TAMIaK050253; Mon, 29 Mar 2021 10:22:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TAMIrF050252; Mon, 29 Mar 2021 10:22:18 GMT (envelope-from git) Date: Mon, 29 Mar 2021 10:22:18 GMT Message-Id: <202103291022.12TAMIrF050252@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wei Hu Subject: git: 2fbdbfaa0c44 - stable/13 - Hyper-V: hn: Initialize the internal field of per packet info on tx path MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2fbdbfaa0c4407547060f8a0ca4d0d04bbf09f9e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 10:22:18 -0000 The branch stable/13 has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=2fbdbfaa0c4407547060f8a0ca4d0d04bbf09f9e commit 2fbdbfaa0c4407547060f8a0ca4d0d04bbf09f9e Author: Wei Hu AuthorDate: 2021-03-15 10:20:52 +0000 Commit: Wei Hu CommitDate: 2021-03-29 10:21:30 +0000 Hyper-V: hn: Initialize the internal field of per packet info on tx path The RSC support feature introduced a bit field "rm_internal" in struct rndis_pktinfo with total size unchanged. The guest does not use this field in the tx path. However we need to initialize it to zero in case older hosts which are not aware of this field. Fixes: a491581f ("Hyper-V: hn: Enable vSwitch RSC support") MFC after: 2 weeks Sponsored by: Microsoft (cherry picked from commit 805dbff6c36a6cd84491aa53a02315fa025734cc) --- sys/dev/hyperv/netvsc/if_hn.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c index f4bdbb1ee788..cd0b5a5fa8b9 100644 --- a/sys/dev/hyperv/netvsc/if_hn.c +++ b/sys/dev/hyperv/netvsc/if_hn.c @@ -2932,6 +2932,7 @@ hn_rndis_pktinfo_append(struct rndis_packet_msg *pkt, size_t pktsize, pi->rm_size = pi_size; pi->rm_type = pi_type; + pi->rm_internal = 0; pi->rm_pktinfooffset = RNDIS_PKTINFO_OFFSET; return (pi->rm_data); From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 15:12: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 573A757A556; Mon, 29 Mar 2021 15:12: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 4F8GK924mgz3n8V; Mon, 29 Mar 2021 15:12: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 3A2F3157B0; Mon, 29 Mar 2021 15:12: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 12TFCTU6058178; Mon, 29 Mar 2021 15:12:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TFCTVI058177; Mon, 29 Mar 2021 15:12:29 GMT (envelope-from git) Date: Mon, 29 Mar 2021 15:12:29 GMT Message-Id: <202103291512.12TFCTVI058177@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: b92b2ffd1233 - stable/13 - align nfsdumpstate column output MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b92b2ffd1233d9513dfcbb412c2bb578eef70e05 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 15:12:29 -0000 The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=b92b2ffd1233d9513dfcbb412c2bb578eef70e05 commit b92b2ffd1233d9513dfcbb412c2bb578eef70e05 Author: Caleb St. John AuthorDate: 2021-03-24 20:33:41 +0000 Commit: Ryan Moeller CommitDate: 2021-03-29 13:33:14 +0000 align nfsdumpstate column output There are scenarios where an NFS client will mount an NFSv4 export without specifying a callback address. When running nfsdumpstate under this circumstance, the column output is shifted incorrectly which places the "ClientID" value underneath the "Clientaddr" column. This diff is a small cosmetic change that prints a blank in the "Clientaddr" column and ensures the data for the columns are aligned appropriately. Submitted by: Caleb St. John Reviewed by: sef (previous version) MFC after: 3 days Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D18958 (cherry picked from commit efad9c8ba3cec7f6e39b128b90afab70701fd8d9) --- usr.sbin/nfsdumpstate/nfsdumpstate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr.sbin/nfsdumpstate/nfsdumpstate.c b/usr.sbin/nfsdumpstate/nfsdumpstate.c index 4334a3ddf506..c7e086655f79 100644 --- a/usr.sbin/nfsdumpstate/nfsdumpstate.c +++ b/usr.sbin/nfsdumpstate/nfsdumpstate.c @@ -162,6 +162,9 @@ dump_openstate(void) printf("%-45s ", " "); break; #endif + default: + printf("%-45s ", " "); + break; } for (i = 0; i < dp[cnt].ndcl_clid.nclid_idlen; i++) printf("%02x", dp[cnt].ndcl_clid.nclid_id[i]); From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 15:12: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 727D357A71A; Mon, 29 Mar 2021 15:12: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 4F8GKB2jzZz3nRB; Mon, 29 Mar 2021 15:12: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 4F77C15922; Mon, 29 Mar 2021 15:12: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 12TFCURf058201; Mon, 29 Mar 2021 15:12:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TFCUmC058200; Mon, 29 Mar 2021 15:12:30 GMT (envelope-from git) Date: Mon, 29 Mar 2021 15:12:30 GMT Message-Id: <202103291512.12TFCUmC058200@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: af68f5380642 - stable/13 - rpc.lockd: Unconditionally close fds as daemon MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: af68f5380642b3beb7be25cdacd73848f9c680e3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 15:12:30 -0000 The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=af68f5380642b3beb7be25cdacd73848f9c680e3 commit af68f5380642b3beb7be25cdacd73848f9c680e3 Author: Caleb St. John AuthorDate: 2021-03-26 18:00:14 +0000 Commit: Ryan Moeller CommitDate: 2021-03-29 13:33:35 +0000 rpc.lockd: Unconditionally close fds as daemon When lockd is configured with a debug level of > 0 and foreground == 0, the process is daemonized with a truth noclose argument to daemon(). This doesn't seem to be the desired behavior because that prevents stdout and stderr from being closed, however, stdout and stderr aren't used anywhere else. Furthermore, the man pages state that with a higher debug level it will use the syslog facilities to do so. Submitted by: Caleb St. John Discussed with: rmacklem MFC after: 3 days Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D29415 (cherry picked from commit badcfbacf3840a4097bb79192054481c7674e7d2) --- usr.sbin/rpc.lockd/lockd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/rpc.lockd/lockd.c b/usr.sbin/rpc.lockd/lockd.c index 9aac9273b3fd..e25cef9993bb 100644 --- a/usr.sbin/rpc.lockd/lockd.c +++ b/usr.sbin/rpc.lockd/lockd.c @@ -426,7 +426,7 @@ main(int argc, char **argv) * Note that it is NOT sensible to run this program from inetd - the * protocol assumes that it will run immediately at boot time. */ - if ((foreground == 0) && daemon(0, debug_level > 0)) { + if ((foreground == 0) && daemon(0, 0)) { err(1, "cannot fork"); /* NOTREACHED */ } From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 15:12: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 26D2957A567; Mon, 29 Mar 2021 15:12: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 4F8GKC3ggvz3nRG; Mon, 29 Mar 2021 15:12: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 6E15715645; Mon, 29 Mar 2021 15:12: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 12TFCVmE058219; Mon, 29 Mar 2021 15:12:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TFCVqU058218; Mon, 29 Mar 2021 15:12:31 GMT (envelope-from git) Date: Mon, 29 Mar 2021 15:12:31 GMT Message-Id: <202103291512.12TFCVqU058218@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: 16443ffd4108 - stable/13 - bsdinstall: Drop vestigial bsdinstall-esps cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 16443ffd4108bed3c290fee90d7337ba6877bb3e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 15:12:33 -0000 The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=16443ffd4108bed3c290fee90d7337ba6877bb3e commit 16443ffd4108bed3c290fee90d7337ba6877bb3e Author: Ryan Moeller AuthorDate: 2021-03-26 18:12:18 +0000 Commit: Ryan Moeller CommitDate: 2021-03-29 13:34:12 +0000 bsdinstall: Drop vestigial bsdinstall-esps cleanup This is not needed after 0b7472b3d8d2f1e90fade5236b44fd98d8e396c2. MFC after: 3 days Sponsored by: iXsystems, Inc. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D29325 (cherry picked from commit b07b7aec6534052d60cffe010c0426a7ab986d85) --- usr.sbin/bsdinstall/partedit/partedit.c | 14 +------------- usr.sbin/bsdinstall/partedit/partedit.h | 2 -- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/usr.sbin/bsdinstall/partedit/partedit.c b/usr.sbin/bsdinstall/partedit/partedit.c index 6d045428dd32..84f7ef032ba9 100644 --- a/usr.sbin/bsdinstall/partedit/partedit.c +++ b/usr.sbin/bsdinstall/partedit/partedit.c @@ -45,7 +45,6 @@ #include "partedit.h" struct pmetadata_head part_metadata; -int tmpdfd; static int sade_mode = 0; static int apply_changes(struct gmesh *mesh); @@ -69,8 +68,6 @@ sigint_handler(int sig) end_dialog(); - close(tmpdfd); - exit(1); } @@ -78,7 +75,7 @@ int main(int argc, const char **argv) { struct partition_metadata *md; - const char *progname, *prompt, *tmpdir; + const char *progname, *prompt; struct partedit_item *items = NULL; struct gmesh mesh; int i, op, nitems, nscroll; @@ -90,14 +87,6 @@ main(int argc, const char **argv) TAILQ_INIT(&part_metadata); - tmpdir = getenv("TMPDIR"); - if (tmpdir == NULL) - tmpdir = "/tmp"; - tmpdfd = open(tmpdir, O_DIRECTORY); - if (tmpdfd < 0) - err(EX_OSERR, "%s", tmpdir); - unlinkat(tmpdfd, "bsdinstall-esps", 0); - init_fstab_metadata(); init_dialog(stdin, stdout); @@ -233,7 +222,6 @@ main(int argc, const char **argv) geom_deletetree(&mesh); free(items); end_dialog(); - close(tmpdfd); return (error); } diff --git a/usr.sbin/bsdinstall/partedit/partedit.h b/usr.sbin/bsdinstall/partedit/partedit.h index e989decc2359..1dccc653aea1 100644 --- a/usr.sbin/bsdinstall/partedit/partedit.h +++ b/usr.sbin/bsdinstall/partedit/partedit.h @@ -39,8 +39,6 @@ struct gprovider; struct gmesh; struct ggeom; -extern int tmpdfd; - TAILQ_HEAD(pmetadata_head, partition_metadata); extern struct pmetadata_head part_metadata; From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 16:13: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 521A457BBFD; Mon, 29 Mar 2021 16:13: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 4F8Hgn1r3lz3rqy; Mon, 29 Mar 2021 16:13: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 31E701653F; Mon, 29 Mar 2021 16:13: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 12TGDfhQ042291; Mon, 29 Mar 2021 16:13:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TGDfYx042290; Mon, 29 Mar 2021 16:13:41 GMT (envelope-from git) Date: Mon, 29 Mar 2021 16:13:41 GMT Message-Id: <202103291613.12TGDfYx042290@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: 57593b2bca76 - stable/12 - align nfsdumpstate column output MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 57593b2bca76db683ec6c589c1b051132181d55b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 16:13:41 -0000 The branch stable/12 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=57593b2bca76db683ec6c589c1b051132181d55b commit 57593b2bca76db683ec6c589c1b051132181d55b Author: Caleb St. John AuthorDate: 2021-03-24 20:33:41 +0000 Commit: Ryan Moeller CommitDate: 2021-03-29 15:13:06 +0000 align nfsdumpstate column output There are scenarios where an NFS client will mount an NFSv4 export without specifying a callback address. When running nfsdumpstate under this circumstance, the column output is shifted incorrectly which places the "ClientID" value underneath the "Clientaddr" column. This diff is a small cosmetic change that prints a blank in the "Clientaddr" column and ensures the data for the columns are aligned appropriately. Submitted by: Caleb St. John Reviewed by: sef (previous version) MFC after: 3 days Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D18958 (cherry picked from commit efad9c8ba3cec7f6e39b128b90afab70701fd8d9) --- usr.sbin/nfsdumpstate/nfsdumpstate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr.sbin/nfsdumpstate/nfsdumpstate.c b/usr.sbin/nfsdumpstate/nfsdumpstate.c index 4334a3ddf506..c7e086655f79 100644 --- a/usr.sbin/nfsdumpstate/nfsdumpstate.c +++ b/usr.sbin/nfsdumpstate/nfsdumpstate.c @@ -162,6 +162,9 @@ dump_openstate(void) printf("%-45s ", " "); break; #endif + default: + printf("%-45s ", " "); + break; } for (i = 0; i < dp[cnt].ndcl_clid.nclid_idlen; i++) printf("%02x", dp[cnt].ndcl_clid.nclid_id[i]); From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 16:13: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 7C16557BE79; Mon, 29 Mar 2021 16:13: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 4F8Hgp35yPz3rlF; Mon, 29 Mar 2021 16:13: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 5D92316621; Mon, 29 Mar 2021 16:13: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 12TGDg4O042313; Mon, 29 Mar 2021 16:13:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TGDgjE042312; Mon, 29 Mar 2021 16:13:42 GMT (envelope-from git) Date: Mon, 29 Mar 2021 16:13:42 GMT Message-Id: <202103291613.12TGDgjE042312@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: 4fd5354e85e4 - stable/12 - rpc.lockd: Unconditionally close fds as daemon MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4fd5354e85e4e72b91e7690595173b3bbde21490 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 16:13:42 -0000 The branch stable/12 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=4fd5354e85e4e72b91e7690595173b3bbde21490 commit 4fd5354e85e4e72b91e7690595173b3bbde21490 Author: Caleb St. John AuthorDate: 2021-03-26 18:00:14 +0000 Commit: Ryan Moeller CommitDate: 2021-03-29 15:13:16 +0000 rpc.lockd: Unconditionally close fds as daemon When lockd is configured with a debug level of > 0 and foreground == 0, the process is daemonized with a truth noclose argument to daemon(). This doesn't seem to be the desired behavior because that prevents stdout and stderr from being closed, however, stdout and stderr aren't used anywhere else. Furthermore, the man pages state that with a higher debug level it will use the syslog facilities to do so. Submitted by: Caleb St. John Discussed with: rmacklem MFC after: 3 days Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D29415 (cherry picked from commit badcfbacf3840a4097bb79192054481c7674e7d2) --- usr.sbin/rpc.lockd/lockd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/rpc.lockd/lockd.c b/usr.sbin/rpc.lockd/lockd.c index 9aac9273b3fd..e25cef9993bb 100644 --- a/usr.sbin/rpc.lockd/lockd.c +++ b/usr.sbin/rpc.lockd/lockd.c @@ -426,7 +426,7 @@ main(int argc, char **argv) * Note that it is NOT sensible to run this program from inetd - the * protocol assumes that it will run immediately at boot time. */ - if ((foreground == 0) && daemon(0, debug_level > 0)) { + if ((foreground == 0) && daemon(0, 0)) { err(1, "cannot fork"); /* NOTREACHED */ } From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 22:11: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 6B1155AD4AA; Mon, 29 Mar 2021 22:11: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 4F8Rd92fwGz4mB8; Mon, 29 Mar 2021 22:11: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 43B851B1F1; Mon, 29 Mar 2021 22:11: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 12TMBvPK062184; Mon, 29 Mar 2021 22:11:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMBvMf062183; Mon, 29 Mar 2021 22:11:57 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:11:57 GMT Message-Id: <202103292211.12TMBvMf062183@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 57d7992b50ba - stable/13 - amd64: Only update fsbase/gsbase in pcb for curthread. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 57d7992b50ba36290422bd208d45033de8946307 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 22:11:57 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=57d7992b50ba36290422bd208d45033de8946307 commit 57d7992b50ba36290422bd208d45033de8946307 Author: John Baldwin AuthorDate: 2021-03-12 17:45:18 +0000 Commit: John Baldwin CommitDate: 2021-03-29 18:09:26 +0000 amd64: Only update fsbase/gsbase in pcb for curthread. Before the pcb is copied to the new thread during cpu_fork() and cpu_copy_thread(), the kernel re-reads the current register values in case they are stale. This is done by setting PCB_FULL_IRET in pcb_flags. This works fine for user threads, but the creation of kernel processes and kernel threads do not follow the normal synchronization rules for pcb_flags. Specifically, new kernel processes are always forked from thread0, not from curthread, so adjusting pcb_flags via a simple instruction without the LOCK prefix can race with thread0 running on another CPU. Similarly, kthread_add() clones from the first thread in the relevant kernel process, not from curthread. In practice, Netflix encountered a panic where the pcb_flags in the first kthread of the KTLS process were trashed due to update_pcb_bases() in cpu_copy_thread() running from thread0 to create one of the other KTLS threads racing with the first KTLS kthread calling fpu_kern_thread() on another CPU. In the panicking case, the write to update pcb_flags in fpu_kern_thread() was lost triggering an "Unregistered use of FPU in kernel" panic when the first KTLS kthread later tried to use the FPU. Sponsored by: Netflix (cherry picked from commit 92211458689b448cda52a659f9d192fef5a9dd50) --- sys/amd64/amd64/vm_machdep.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 1d9eacd8a8b8..76f7f400dd9c 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -166,7 +166,8 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) /* Ensure that td1's pcb is up to date. */ fpuexit(td1); - update_pcb_bases(td1->td_pcb); + if (td1 == curthread) + update_pcb_bases(td1->td_pcb); /* Point the stack and pcb to the actual location */ set_top_of_stack_td(td2); @@ -568,7 +569,8 @@ cpu_copy_thread(struct thread *td, struct thread *td0) * Those not loaded individually below get their default * values here. */ - update_pcb_bases(td0->td_pcb); + if (td0 == curthread) + update_pcb_bases(td0->td_pcb); bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | PCB_KERNFPU); From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 22:11: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 7BA1F5AD176; Mon, 29 Mar 2021 22:11: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 4F8RdB2z3Yz4mGk; Mon, 29 Mar 2021 22:11: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 56F221B1F2; Mon, 29 Mar 2021 22:11: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 12TMBwge062230; Mon, 29 Mar 2021 22:11:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMBwFR062224; Mon, 29 Mar 2021 22:11:58 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:11:58 GMT Message-Id: <202103292211.12TMBwFR062224@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 77dfa7cfafb7 - stable/13 - amd64: Cleanups to setting TLS registers for Linux binaries. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 77dfa7cfafb7afb6095f6f4ff30c4c22646b4989 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 22:11:58 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=77dfa7cfafb7afb6095f6f4ff30c4c22646b4989 commit 77dfa7cfafb7afb6095f6f4ff30c4c22646b4989 Author: John Baldwin AuthorDate: 2021-03-12 17:47:31 +0000 Commit: John Baldwin CommitDate: 2021-03-29 18:09:41 +0000 amd64: Cleanups to setting TLS registers for Linux binaries. - Use update_pcb_bases() when updating FS or GS base addresses to permit use of FSBASE and GSBASE in Linux processes. This also sets PCB_FULL_IRET. linux32 was setting PCB_32BIT which should be a no-op (exec sets it). - Remove write-only variables to construct unused segment descriptors for linux32. Sponsored by: Netflix (cherry picked from commit 704547ce1ca56e1123048cd152ed4e468d41d703) --- sys/amd64/linux/linux_machdep.c | 5 +++-- sys/amd64/linux32/linux32_machdep.c | 21 ++------------------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/sys/amd64/linux/linux_machdep.c b/sys/amd64/linux/linux_machdep.c index c2aebcf7df19..1a9d79b0c1ba 100644 --- a/sys/amd64/linux/linux_machdep.c +++ b/sys/amd64/linux/linux_machdep.c @@ -251,7 +251,7 @@ linux_arch_prctl(struct thread *td, struct linux_arch_prctl_args *args) switch (args->code) { case LINUX_ARCH_SET_GS: if (args->addr < VM_MAXUSER_ADDRESS) { - set_pcb_flags(pcb, PCB_FULL_IRET); + update_pcb_bases(pcb); pcb->pcb_gsbase = args->addr; td->td_frame->tf_gs = _ugssel; error = 0; @@ -260,7 +260,7 @@ linux_arch_prctl(struct thread *td, struct linux_arch_prctl_args *args) break; case LINUX_ARCH_SET_FS: if (args->addr < VM_MAXUSER_ADDRESS) { - set_pcb_flags(pcb, PCB_FULL_IRET); + update_pcb_bases(pcb); pcb->pcb_fsbase = args->addr; td->td_frame->tf_fs = _ufssel; error = 0; @@ -290,6 +290,7 @@ linux_set_cloned_tls(struct thread *td, void *desc) return (EPERM); pcb = td->td_pcb; + update_pcb_bases(pcb); pcb->pcb_fsbase = (register_t)desc; td->td_frame->tf_fs = _ufssel; diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c index 1883b18eeb60..fde180d74d73 100644 --- a/sys/amd64/linux32/linux32_machdep.c +++ b/sys/amd64/linux32/linux32_machdep.c @@ -394,11 +394,9 @@ linux_old_select(struct thread *td, struct linux_old_select_args *args) int linux_set_cloned_tls(struct thread *td, void *desc) { - struct user_segment_descriptor sd; struct l_user_desc info; struct pcb *pcb; int error; - int a[2]; error = copyin(desc, &info, sizeof(struct l_user_desc)); if (error) { @@ -410,14 +408,10 @@ linux_set_cloned_tls(struct thread *td, void *desc) if (error) linux_msg(td, "set_cloned_tls copyout info failed!"); - a[0] = LINUX_LDT_entry_a(&info); - a[1] = LINUX_LDT_entry_b(&info); - - memcpy(&sd, &a, sizeof(a)); pcb = td->td_pcb; + update_pcb_bases(pcb); pcb->pcb_gsbase = (register_t)info.base_addr; td->td_frame->tf_gs = GSEL(GUGS32_SEL, SEL_UPL); - set_pcb_flags(pcb, PCB_32BIT); } return (error); @@ -668,9 +662,7 @@ linux_set_thread_area(struct thread *td, struct linux_set_thread_area_args *args) { struct l_user_desc info; - struct user_segment_descriptor sd; struct pcb *pcb; - int a[2]; int error; error = copyin(args->desc, &info, sizeof(struct l_user_desc)); @@ -721,18 +713,9 @@ linux_set_thread_area(struct thread *td, if (error) return (error); - if (LINUX_LDT_empty(&info)) { - a[0] = 0; - a[1] = 0; - } else { - a[0] = LINUX_LDT_entry_a(&info); - a[1] = LINUX_LDT_entry_b(&info); - } - - memcpy(&sd, &a, sizeof(a)); pcb = td->td_pcb; + update_pcb_bases(pcb); pcb->pcb_gsbase = (register_t)info.base_addr; - set_pcb_flags(pcb, PCB_32BIT); update_gdt_gsbase(td, info.base_addr); return (0); From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 22:12: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 04C615ACFFB; Mon, 29 Mar 2021 22:11: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 4F8RdC3wNjz4mK9; Mon, 29 Mar 2021 22:11: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 72B261B218; Mon, 29 Mar 2021 22:11: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 12TMBxiW063677; Mon, 29 Mar 2021 22:11:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMBxst063664; Mon, 29 Mar 2021 22:11:59 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:11:59 GMT Message-Id: <202103292211.12TMBxst063664@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 1ebb5d7920fe - stable/13 - x86: Copy the FPU/XSAVE state from the creating thread to new threads. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1ebb5d7920fea1b8bb849d07bf930bd579f0695c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 22:12:00 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1ebb5d7920fea1b8bb849d07bf930bd579f0695c commit 1ebb5d7920fea1b8bb849d07bf930bd579f0695c Author: John Baldwin AuthorDate: 2021-03-12 17:47:41 +0000 Commit: John Baldwin CommitDate: 2021-03-29 18:10:37 +0000 x86: Copy the FPU/XSAVE state from the creating thread to new threads. POSIX states that new threads created via pthread_create() should inherit the "floating point environment" from the creating thread. Sponsored by: Netflix (cherry picked from commit 755efb8d8fcacc6607bc46469750d78497f89378) --- sys/amd64/amd64/vm_machdep.c | 10 ++++++---- sys/i386/i386/vm_machdep.c | 12 +++++++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 76f7f400dd9c..f10d0339a65a 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -564,16 +564,18 @@ cpu_copy_thread(struct thread *td, struct thread *td0) pcb2 = td->td_pcb; + /* Ensure that td0's pcb is up to date. */ + fpuexit(td0); + if (td0 == curthread) + update_pcb_bases(td0->td_pcb); + /* * Copy the upcall pcb. This loads kernel regs. * Those not loaded individually below get their default * values here. */ - if (td0 == curthread) - update_pcb_bases(td0->td_pcb); bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); - clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | - PCB_KERNFPU); + clear_pcb_flags(pcb2, PCB_KERNFPU); pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, cpu_max_ext_state_size); diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index d3182cb224bf..502de6e7f38f 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -428,14 +428,21 @@ cpu_copy_thread(struct thread *td, struct thread *td0) /* Point the pcb to the top of the stack. */ pcb2 = td->td_pcb; + /* Ensure that td0's pcb is up to date. */ + if (td0 == curthread) + td0->td_pcb->pcb_gs = rgs(); + critical_enter(); + if (PCPU_GET(fpcurthread) == td0) + npxsave(td0->td_pcb->pcb_save); + critical_exit(); + /* * Copy the upcall pcb. This loads kernel regs. * Those not loaded individually below get their default * values here. */ bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); - pcb2->pcb_flags &= ~(PCB_NPXINITDONE | PCB_NPXUSERINITDONE | - PCB_KERNNPX); + pcb2->pcb_flags &= ~PCB_KERNNPX; pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, cpu_max_ext_state_size); @@ -463,7 +470,6 @@ cpu_copy_thread(struct thread *td, struct thread *td0) pcb2->pcb_esp = (int)td->td_frame - sizeof(void *); /* trampoline arg */ pcb2->pcb_ebx = (int)td; /* trampoline arg */ pcb2->pcb_eip = (int)fork_trampoline + setidt_disp; - pcb2->pcb_gs = rgs(); /* * If we didn't copy the pcb, we'd need to do the following registers: * pcb2->pcb_cr3: cloned above. From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 22:12: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 C40895AD17E; Mon, 29 Mar 2021 22:12: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 4F8RdF3vZpz4mKH; Mon, 29 Mar 2021 22:12: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 8E30A1B219; Mon, 29 Mar 2021 22:12: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 12TMC0JH064608; Mon, 29 Mar 2021 22:12:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMC0Yb064607; Mon, 29 Mar 2021 22:12:00 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:12:00 GMT Message-Id: <202103292212.12TMC0Yb064607@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 1a325aa20403 - stable/13 - Remove unused wrappers around kproc_create() and kproc_exit(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1a325aa2040385c12555b3dbb599b7fa9edc1bf5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 22:12:02 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1a325aa2040385c12555b3dbb599b7fa9edc1bf5 commit 1a325aa2040385c12555b3dbb599b7fa9edc1bf5 Author: John Baldwin AuthorDate: 2021-03-12 17:47:58 +0000 Commit: John Baldwin CommitDate: 2021-03-29 18:10:43 +0000 Remove unused wrappers around kproc_create() and kproc_exit(). Sponsored by: Netflix (cherry picked from commit 645b15e558dc102ff70a6332b1d0b0aa733fd2bb) --- sys/dev/mpr/mprvar.h | 4 ---- sys/dev/mps/mpsvar.h | 4 ---- 2 files changed, 8 deletions(-) diff --git a/sys/dev/mpr/mprvar.h b/sys/dev/mpr/mprvar.h index ce755188d706..5abcdd5d4299 100644 --- a/sys/dev/mpr/mprvar.h +++ b/sys/dev/mpr/mprvar.h @@ -913,10 +913,6 @@ int mprsas_send_reset(struct mpr_softc *sc, struct mpr_command *tm, SYSCTL_DECL(_hw_mpr); /* Compatibility shims for different OS versions */ -#define mpr_kproc_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \ - kproc_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) -#define mpr_kproc_exit(arg) kproc_exit(arg) - #if defined(CAM_PRIORITY_XPT) #define MPR_PRIORITY_XPT CAM_PRIORITY_XPT #else diff --git a/sys/dev/mps/mpsvar.h b/sys/dev/mps/mpsvar.h index 2029b570c01d..6e6c9fd28c2b 100644 --- a/sys/dev/mps/mpsvar.h +++ b/sys/dev/mps/mpsvar.h @@ -831,10 +831,6 @@ int mpssas_send_reset(struct mps_softc *sc, struct mps_command *tm, SYSCTL_DECL(_hw_mps); /* Compatibility shims for different OS versions */ -#define mps_kproc_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \ - kproc_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) -#define mps_kproc_exit(arg) kproc_exit(arg) - #if defined(CAM_PRIORITY_XPT) #define MPS_PRIORITY_XPT CAM_PRIORITY_XPT #else From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 22:12: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 742E95AD421; Mon, 29 Mar 2021 22:12: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 4F8RdJ1PnFz4mKN; Mon, 29 Mar 2021 22:12: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 B88E81AF58; Mon, 29 Mar 2021 22:12: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 12TMC13U064629; Mon, 29 Mar 2021 22:12:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMC1BZ064628; Mon, 29 Mar 2021 22:12:01 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:12:01 GMT Message-Id: <202103292212.12TMC1BZ064628@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: cc6d86f2ff9c - stable/13 - Don't pass RFPROC to kproc_create(), it is redundant. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cc6d86f2ff9c18f35fd7925d2b0785252af9b892 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 22:12:07 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=cc6d86f2ff9c18f35fd7925d2b0785252af9b892 commit cc6d86f2ff9c18f35fd7925d2b0785252af9b892 Author: John Baldwin AuthorDate: 2021-03-12 17:48:10 +0000 Commit: John Baldwin CommitDate: 2021-03-29 18:10:49 +0000 Don't pass RFPROC to kproc_create(), it is redundant. Sponsored by: Netflix (cherry picked from commit 5a50eb6585ef8d1a40c8086bab8639cc56f00df9) --- sys/netinet/sctp_bsd_addr.c | 2 +- sys/netinet/sctp_pcb.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/sctp_bsd_addr.c b/sys/netinet/sctp_bsd_addr.c index aad84f71a678..2a00885d8ddd 100644 --- a/sys/netinet/sctp_bsd_addr.c +++ b/sys/netinet/sctp_bsd_addr.c @@ -108,7 +108,7 @@ sctp_startup_iterator(void) kproc_create(sctp_iterator_thread, (void *)NULL, &sctp_it_ctl.thread_proc, - RFPROC, + 0, SCTP_KTHREAD_PAGES, SCTP_KTRHEAD_NAME); } diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 4d09ad3a7353..f4264ab387f1 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -5678,7 +5678,7 @@ sctp_startup_mcore_threads(void) (void)kproc_create(sctp_mcore_thread, (void *)&sctp_mcore_workers[cpu], &sctp_mcore_workers[cpu].thread_proc, - RFPROC, + 0, SCTP_KTHREAD_PAGES, SCTP_MCORE_NAME); } From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 22:12: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 59A915AD70A; Mon, 29 Mar 2021 22:12: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 4F8RdJ3Qctz4mKW; Mon, 29 Mar 2021 22:12: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 CC4D91AD51; Mon, 29 Mar 2021 22:12: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 12TMC2Uh064650; Mon, 29 Mar 2021 22:12:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMC2CD064649; Mon, 29 Mar 2021 22:12:02 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:12:02 GMT Message-Id: <202103292212.12TMC2CD064649@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 053eb17635e1 - stable/13 - Set TDP_KTHREAD before calling cpu_fork() and cpu_copy_thread(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 053eb17635e19c5cfe8140d0d33dd9330bf6bc22 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 22:12:07 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=053eb17635e19c5cfe8140d0d33dd9330bf6bc22 commit 053eb17635e19c5cfe8140d0d33dd9330bf6bc22 Author: John Baldwin AuthorDate: 2021-03-12 17:48:20 +0000 Commit: John Baldwin CommitDate: 2021-03-29 18:10:54 +0000 Set TDP_KTHREAD before calling cpu_fork() and cpu_copy_thread(). This permits these routines to use special logic for initializing MD kthread state. For the kproc case, this required moving the logic to set these flags from kproc_create() into do_fork(). Sponsored by: Netflix (cherry picked from commit 640d54045bdbf894ae3c75cd9818c29fc2f6e5e7) --- sys/kern/kern_fork.c | 12 ++++++++++-- sys/kern/kern_kthread.c | 17 +++++------------ sys/sys/proc.h | 1 + 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 870ae494de5d..3da8205d8ab0 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -497,9 +497,12 @@ do_fork(struct thread *td, struct fork_req *fr, struct proc *p2, struct thread * } else { sigacts_copy(newsigacts, p1->p_sigacts); p2->p_sigacts = newsigacts; - if ((fr->fr_flags2 & FR2_DROPSIG_CAUGHT) != 0) { + if ((fr->fr_flags2 & (FR2_DROPSIG_CAUGHT | FR2_KPROC)) != 0) { mtx_lock(&p2->p_sigacts->ps_mtx); - sig_drop_caught(p2); + if ((fr->fr_flags2 & FR2_DROPSIG_CAUGHT) != 0) + sig_drop_caught(p2); + if ((fr->fr_flags2 & FR2_KPROC) != 0) + p2->p_sigacts->ps_flag |= PS_NOCLDWAIT; mtx_unlock(&p2->p_sigacts->ps_mtx); } } @@ -511,6 +514,11 @@ do_fork(struct thread *td, struct fork_req *fr, struct proc *p2, struct thread * else p2->p_sigparent = SIGCHLD; + if ((fr->fr_flags2 & FR2_KPROC) != 0) { + p2->p_flag |= P_SYSTEM | P_KPROC; + td2->td_pflags |= TDP_KTHREAD; + } + p2->p_textvp = p1->p_textvp; p2->p_fd = fd; p2->p_fdtol = fdtol; diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c index d049a099847c..32832bde2f53 100644 --- a/sys/kern/kern_kthread.c +++ b/sys/kern/kern_kthread.c @@ -95,6 +95,7 @@ kproc_create(void (*func)(void *), void *arg, bzero(&fr, sizeof(fr)); fr.fr_flags = RFMEM | RFFDG | RFPROC | RFSTOPPED | flags; + fr.fr_flags2 = FR2_KPROC; fr.fr_pages = pages; fr.fr_procp = &p2; error = fork1(&thread0, &fr); @@ -105,21 +106,11 @@ kproc_create(void (*func)(void *), void *arg, if (newpp != NULL) *newpp = p2; - /* this is a non-swapped system process */ - PROC_LOCK(p2); - td = FIRST_THREAD_IN_PROC(p2); - p2->p_flag |= P_SYSTEM | P_KPROC; - td->td_pflags |= TDP_KTHREAD; - mtx_lock(&p2->p_sigacts->ps_mtx); - p2->p_sigacts->ps_flag |= PS_NOCLDWAIT; - mtx_unlock(&p2->p_sigacts->ps_mtx); - PROC_UNLOCK(p2); - /* set up arg0 for 'ps', et al */ va_start(ap, fmt); vsnprintf(p2->p_comm, sizeof(p2->p_comm), fmt, ap); va_end(ap); - /* set up arg0 for 'ps', et al */ + td = FIRST_THREAD_IN_PROC(p2); va_start(ap, fmt); vsnprintf(td->td_name, sizeof(td->td_name), fmt, ap); va_end(ap); @@ -295,12 +286,14 @@ kthread_add(void (*func)(void *), void *arg, struct proc *p, TSTHREAD(newtd, newtd->td_name); newtd->td_proc = p; /* needed for cpu_copy_thread */ + newtd->td_pflags |= TDP_KTHREAD; + /* might be further optimized for kthread */ cpu_copy_thread(newtd, oldtd); + /* put the designated function(arg) as the resume context */ cpu_fork_kthread_handler(newtd, func, arg); - newtd->td_pflags |= TDP_KTHREAD; thread_cow_get_proc(newtd, p); /* this code almost the same as create_thread() in kern_thr.c */ diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 99257878c2e0..783c3896298c 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1043,6 +1043,7 @@ struct fork_req { int fr_flags2; #define FR2_DROPSIG_CAUGHT 0x00000001 /* Drop caught non-DFL signals */ #define FR2_SHARE_PATHS 0x00000002 /* Invert sense of RFFDG for paths */ +#define FR2_KPROC 0x00000004 /* Create a kernel process */ }; /* From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 22:12: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 57BA55AD3E7; Mon, 29 Mar 2021 22:12: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 4F8RdL01Glz4mHG; Mon, 29 Mar 2021 22:12: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 0DAB11B21C; Mon, 29 Mar 2021 22:12: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 12TMC3iU064671; Mon, 29 Mar 2021 22:12:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMC3oX064670; Mon, 29 Mar 2021 22:12:03 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:12:03 GMT Message-Id: <202103292212.12TMC3oX064670@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 60ae7f745da0 - stable/13 - x86: Always use clean FPU and segment base state for new kthreads. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 60ae7f745da0ec03f9a08b92f4db2fc9101b7123 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 22:12:10 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=60ae7f745da0ec03f9a08b92f4db2fc9101b7123 commit 60ae7f745da0ec03f9a08b92f4db2fc9101b7123 Author: John Baldwin AuthorDate: 2021-03-12 17:48:36 +0000 Commit: John Baldwin CommitDate: 2021-03-29 18:10:59 +0000 x86: Always use clean FPU and segment base state for new kthreads. Sponsored by: Netflix (cherry picked from commit c7b021352332a2f79907d68f971849f74b73e1c6) --- sys/amd64/amd64/vm_machdep.c | 46 +++++++++++++++++++++++++--------- sys/i386/i386/sys_machdep.c | 6 +++-- sys/i386/i386/vm_machdep.c | 59 +++++++++++++++++++++++++++++++------------- 3 files changed, 81 insertions(+), 30 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index f10d0339a65a..6e60f2b3faff 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -164,10 +164,12 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) return; } - /* Ensure that td1's pcb is up to date. */ - fpuexit(td1); - if (td1 == curthread) + /* Ensure that td1's pcb is up to date for user processes. */ + if ((td2->td_pflags & TDP_KTHREAD) == 0) { + MPASS(td1 == curthread); + fpuexit(td1); update_pcb_bases(td1->td_pcb); + } /* Point the stack and pcb to the actual location */ set_top_of_stack_td(td2); @@ -178,8 +180,18 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) /* Properly initialize pcb_save */ pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), - cpu_max_ext_state_size); + + /* Kernel processes start with clean FPU and segment bases. */ + if ((td2->td_pflags & TDP_KTHREAD) != 0) { + pcb2->pcb_fsbase = 0; + pcb2->pcb_gsbase = 0; + clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | + PCB_KERNFPU | PCB_KERNFPU_THR); + } else { + MPASS((pcb2->pcb_flags & (PCB_KERNFPU | PCB_KERNFPU_THR)) == 0); + bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), + cpu_max_ext_state_size); + } /* Point mdproc and then copy over td1's contents */ mdp2 = &p2->p_md; @@ -564,10 +576,12 @@ cpu_copy_thread(struct thread *td, struct thread *td0) pcb2 = td->td_pcb; - /* Ensure that td0's pcb is up to date. */ - fpuexit(td0); - if (td0 == curthread) + /* Ensure that td0's pcb is up to date for user threads. */ + if ((td->td_pflags & TDP_KTHREAD) == 0) { + MPASS(td0 == curthread); + fpuexit(td0); update_pcb_bases(td0->td_pcb); + } /* * Copy the upcall pcb. This loads kernel regs. @@ -575,12 +589,22 @@ cpu_copy_thread(struct thread *td, struct thread *td0) * values here. */ bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); - clear_pcb_flags(pcb2, PCB_KERNFPU); pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, - cpu_max_ext_state_size); + + /* Kernel threads start with clean FPU and segment bases. */ + if ((td->td_pflags & TDP_KTHREAD) != 0) { + pcb2->pcb_fsbase = 0; + pcb2->pcb_gsbase = 0; + clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | + PCB_KERNFPU | PCB_KERNFPU_THR); + } else { + MPASS((pcb2->pcb_flags & (PCB_KERNFPU | PCB_KERNFPU_THR)) == 0); + bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, + cpu_max_ext_state_size); + } set_pcb_flags_raw(pcb2, PCB_FULL_IRET); + /* * Create a new fresh stack for the new thread. */ diff --git a/sys/i386/i386/sys_machdep.c b/sys/i386/i386/sys_machdep.c index 3f650b65e160..a0a1c273f467 100644 --- a/sys/i386/i386/sys_machdep.c +++ b/sys/i386/i386/sys_machdep.c @@ -108,7 +108,8 @@ set_fsbase(struct thread *td, uint32_t base) fill_based_sd(&sd, base); critical_enter(); td->td_pcb->pcb_fsd = sd; - PCPU_GET(fsgs_gdt)[0] = sd; + if (td == curthread) + PCPU_GET(fsgs_gdt)[0] = sd; critical_exit(); } @@ -120,7 +121,8 @@ set_gsbase(struct thread *td, uint32_t base) fill_based_sd(&sd, base); critical_enter(); td->td_pcb->pcb_gsd = sd; - PCPU_GET(fsgs_gdt)[1] = sd; + if (td == curthread) + PCPU_GET(fsgs_gdt)[1] = sd; critical_exit(); } diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 502de6e7f38f..471128e1713d 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -167,13 +167,15 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) return; } - /* Ensure that td1's pcb is up to date. */ - if (td1 == curthread) + /* Ensure that td1's pcb is up to date for user processes. */ + if ((td2->td_pflags & TDP_KTHREAD) == 0) { + MPASS(td1 == curthread); td1->td_pcb->pcb_gs = rgs(); - critical_enter(); - if (PCPU_GET(fpcurthread) == td1) - npxsave(td1->td_pcb->pcb_save); - critical_exit(); + critical_enter(); + if (PCPU_GET(fpcurthread) == td1) + npxsave(td1->td_pcb->pcb_save); + critical_exit(); + } /* Point the pcb to the top of the stack */ pcb2 = get_pcb_td(td2); @@ -184,8 +186,19 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) /* Properly initialize pcb_save */ pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), - cpu_max_ext_state_size); + + /* Kernel processes start with clean NPX and segment bases. */ + if ((td2->td_pflags & TDP_KTHREAD) != 0) { + pcb2->pcb_gs = _udatasel; + set_fsbase(td2, 0); + set_gsbase(td2, 0); + pcb2->pcb_flags &= ~(PCB_NPXINITDONE | PCB_NPXUSERINITDONE | + PCB_KERNNPX | PCB_KERNNPX_THR); + } else { + MPASS((pcb2->pcb_flags & (PCB_KERNNPX | PCB_KERNNPX_THR)) == 0); + bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), + cpu_max_ext_state_size); + } /* Point mdproc and then copy over td1's contents */ mdp2 = &p2->p_md; @@ -428,13 +441,15 @@ cpu_copy_thread(struct thread *td, struct thread *td0) /* Point the pcb to the top of the stack. */ pcb2 = td->td_pcb; - /* Ensure that td0's pcb is up to date. */ - if (td0 == curthread) + /* Ensure that td0's pcb is up to date for user threads. */ + if ((td->td_pflags & TDP_KTHREAD) == 0) { + MPASS(td0 == curthread); td0->td_pcb->pcb_gs = rgs(); - critical_enter(); - if (PCPU_GET(fpcurthread) == td0) - npxsave(td0->td_pcb->pcb_save); - critical_exit(); + critical_enter(); + if (PCPU_GET(fpcurthread) == td0) + npxsave(td0->td_pcb->pcb_save); + critical_exit(); + } /* * Copy the upcall pcb. This loads kernel regs. @@ -442,10 +457,20 @@ cpu_copy_thread(struct thread *td, struct thread *td0) * values here. */ bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); - pcb2->pcb_flags &= ~PCB_KERNNPX; pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, - cpu_max_ext_state_size); + + /* Kernel threads start with clean NPX and segment bases. */ + if ((td->td_pflags & TDP_KTHREAD) != 0) { + pcb2->pcb_gs = _udatasel; + set_fsbase(td, 0); + set_gsbase(td, 0); + pcb2->pcb_flags &= ~(PCB_NPXINITDONE | PCB_NPXUSERINITDONE | + PCB_KERNNPX | PCB_KERNNPX_THR); + } else { + MPASS((pcb2->pcb_flags & (PCB_KERNNPX | PCB_KERNNPX_THR)) == 0); + bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, + cpu_max_ext_state_size); + } /* * Create a new fresh stack for the new thread. From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 22:12: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 D28375AD69F; Mon, 29 Mar 2021 22:12: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 4F8RdM6gflz4lxp; Mon, 29 Mar 2021 22:12: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 2D1C91B1F6; Mon, 29 Mar 2021 22:12: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 12TMC5UO064692; Mon, 29 Mar 2021 22:12:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMC5kA064691; Mon, 29 Mar 2021 22:12:05 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:12:05 GMT Message-Id: <202103292212.12TMC5kA064691@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: d8debda0d0a3 - stable/13 - x86: Update some stale comments in cpu_fork() and cpu_copy_thread(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d8debda0d0a324c0925f23227514301eb7670b26 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 22:12:12 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d8debda0d0a324c0925f23227514301eb7670b26 commit d8debda0d0a324c0925f23227514301eb7670b26 Author: John Baldwin AuthorDate: 2021-03-12 17:48:49 +0000 Commit: John Baldwin CommitDate: 2021-03-29 18:11:03 +0000 x86: Update some stale comments in cpu_fork() and cpu_copy_thread(). Neither of these routines allocate stacks. Sponsored by: Netflix (cherry picked from commit 40d593d17eb6d70ea717d6546a16794858944176) --- sys/amd64/amd64/vm_machdep.c | 6 ++++-- sys/i386/i386/vm_machdep.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 6e60f2b3faff..a17ddd4ba6d8 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -198,7 +198,6 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) bcopy(&p1->p_md, mdp2, sizeof(*mdp2)); /* - * Create a new fresh stack for the new process. * Copy the trap frame for the return to user mode as if from a * syscall. This copies most of the user mode register values. */ @@ -606,7 +605,10 @@ cpu_copy_thread(struct thread *td, struct thread *td0) /* - * Create a new fresh stack for the new thread. + * Copy user general-purpose registers. + * + * Some of these registers are rewritten by cpu_set_upcall() + * and linux_set_upcall_kse(). */ bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 471128e1713d..5947ae5a6d15 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -205,7 +205,6 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) bcopy(&p1->p_md, mdp2, sizeof(*mdp2)); /* - * Create a new fresh stack for the new process. * Copy the trap frame for the return to user mode as if from a * syscall. This copies most of the user mode register values. * The -VM86_STACK_SPACE (-16) is so we can expand the trapframe @@ -473,7 +472,10 @@ cpu_copy_thread(struct thread *td, struct thread *td0) } /* - * Create a new fresh stack for the new thread. + * Copy user general-purpose registers. + * + * Some of these registers are rewritten by cpu_set_upcall() + * and linux_set_upcall_kse(). */ bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 22:35: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 8BE285ADE77; Mon, 29 Mar 2021 22:35: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 4F8S7x3TxPz4pCJ; Mon, 29 Mar 2021 22:35: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 664D81B644; Mon, 29 Mar 2021 22:35: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 12TMZ9nE093451; Mon, 29 Mar 2021 22:35:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMZ97h093450; Mon, 29 Mar 2021 22:35:09 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:35:09 GMT Message-Id: <202103292235.12TMZ97h093450@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: c6b96921a819 - stable/13 - aarch64: Clear TLS registers during exec(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c6b96921a81968aa768b45e32195854aaec81331 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 22:35:09 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c6b96921a81968aa768b45e32195854aaec81331 commit c6b96921a81968aa768b45e32195854aaec81331 Author: John Baldwin AuthorDate: 2021-03-17 20:19:04 +0000 Commit: John Baldwin CommitDate: 2021-03-29 22:17:04 +0000 aarch64: Clear TLS registers during exec(). These are not stored in the trapframe so must be cleared explicitly. This is similar to one of the MIPS changes in 822d2d6ac94f. Obtained from: CheriBSD Sponsored by: DARPA (cherry picked from commit 0723b409150ae302eb021cbde86a5f77348a1bb4) --- sys/arm64/arm64/machdep.c | 5 +++++ sys/arm64/linux/linux_sysvec.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index c825c1a18c70..8a1e7520aacb 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -560,6 +560,11 @@ exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) tf->tf_lr = imgp->entry_addr; tf->tf_elr = imgp->entry_addr; + td->td_pcb->pcb_tpidr_el0 = 0; + td->td_pcb->pcb_tpidrro_el0 = 0; + WRITE_SPECIALREG(tpidrro_el0, 0); + WRITE_SPECIALREG(tpidr_el0, 0); + #ifdef VFP vfp_reset_state(td, pcb); #endif diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index 67feacfa876b..df16db4040a7 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -365,6 +365,11 @@ linux_exec_setregs(struct thread *td, struct image_params *imgp, #endif regs->tf_elr = imgp->entry_addr; + td->td_pcb->pcb_tpidr_el0 = 0; + td->td_pcb->pcb_tpidrro_el0 = 0; + WRITE_SPECIALREG(tpidrro_el0, 0); + WRITE_SPECIALREG(tpidr_el0, 0); + #ifdef VFP vfp_reset_state(td, td->td_pcb); #endif From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 22:45: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 08D4C5AEB87; Mon, 29 Mar 2021 22:45: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 4F8SNM4NNbz4qBM; Mon, 29 Mar 2021 22:45: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 8913E1BA88; Mon, 29 Mar 2021 22:45: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 12TMjt3g007611; Mon, 29 Mar 2021 22:45:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMjtMR007610; Mon, 29 Mar 2021 22:45:55 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:45:55 GMT Message-Id: <202103292245.12TMjtMR007610@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 10438a42f166 - stable/13 - x86: Reduce code duplication in cpu_fork() and cpu_copy_thread(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 10438a42f1665c00f7669e123a0aec49b74d757e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 22:45:56 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=10438a42f1665c00f7669e123a0aec49b74d757e commit 10438a42f1665c00f7669e123a0aec49b74d757e Author: John Baldwin AuthorDate: 2021-03-18 19:13:17 +0000 Commit: John Baldwin CommitDate: 2021-03-29 22:35:47 +0000 x86: Reduce code duplication in cpu_fork() and cpu_copy_thread(). Add copy_thread() to hold shared code. Sponsored by: Netflix (cherry picked from commit a7883464fcc45b78e6aa01222682ae40f787a378) --- sys/amd64/amd64/vm_machdep.c | 167 +++++++++++++++------------------------ sys/i386/i386/vm_machdep.c | 184 +++++++++++++++++-------------------------- 2 files changed, 137 insertions(+), 214 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index a17ddd4ba6d8..0527ef95cf3b 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -136,6 +136,65 @@ alloc_fpusave(int flags) return (res); } +/* + * Common code shared between cpu_fork() and cpu_copy_thread() for + * initializing a thread. + */ +static void +copy_thread(struct thread *td1, struct thread *td2) +{ + struct pcb *pcb2; + + pcb2 = td2->td_pcb; + + /* Ensure that td1's pcb is up to date for user threads. */ + if ((td2->td_pflags & TDP_KTHREAD) == 0) { + MPASS(td1 == curthread); + fpuexit(td1); + update_pcb_bases(td1->td_pcb); + } + + /* Copy td1's pcb */ + bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); + + /* Properly initialize pcb_save */ + pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); + + /* Kernel threads start with clean FPU and segment bases. */ + if ((td2->td_pflags & TDP_KTHREAD) != 0) { + pcb2->pcb_fsbase = 0; + pcb2->pcb_gsbase = 0; + clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | + PCB_KERNFPU | PCB_KERNFPU_THR); + } else { + MPASS((pcb2->pcb_flags & (PCB_KERNFPU | PCB_KERNFPU_THR)) == 0); + bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), + cpu_max_ext_state_size); + } + + /* + * Set registers for trampoline to user mode. Leave space for the + * return address on stack. These are the kernel mode register values. + */ + pcb2->pcb_r12 = (register_t)fork_return; /* fork_trampoline argument */ + pcb2->pcb_rbp = 0; + pcb2->pcb_rsp = (register_t)td2->td_frame - sizeof(void *); + pcb2->pcb_rbx = (register_t)td2; /* fork_trampoline argument */ + pcb2->pcb_rip = (register_t)fork_trampoline; + /*- + * pcb2->pcb_dr*: cloned above. + * pcb2->pcb_savefpu: cloned above. + * pcb2->pcb_flags: cloned above. + * pcb2->pcb_onfault: cloned above (always NULL here?). + * pcb2->pcb_[fg]sbase: cloned above + */ + + /* Setup to release spin count in fork_exit(). */ + td2->td_md.md_spinlock_count = 1; + td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; + pmap_thread_init_invl_gen(td2); +} + /* * Finish a fork operation, with process p2 nearly set up. * Copy and update the pcb, set up the stack so that the child @@ -164,36 +223,13 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) return; } - /* Ensure that td1's pcb is up to date for user processes. */ - if ((td2->td_pflags & TDP_KTHREAD) == 0) { - MPASS(td1 == curthread); - fpuexit(td1); - update_pcb_bases(td1->td_pcb); - } - /* Point the stack and pcb to the actual location */ set_top_of_stack_td(td2); td2->td_pcb = pcb2 = get_pcb_td(td2); - /* Copy td1's pcb */ - bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); - - /* Properly initialize pcb_save */ - pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); + copy_thread(td1, td2); - /* Kernel processes start with clean FPU and segment bases. */ - if ((td2->td_pflags & TDP_KTHREAD) != 0) { - pcb2->pcb_fsbase = 0; - pcb2->pcb_gsbase = 0; - clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | - PCB_KERNFPU | PCB_KERNFPU_THR); - } else { - MPASS((pcb2->pcb_flags & (PCB_KERNFPU | PCB_KERNFPU_THR)) == 0); - bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), - cpu_max_ext_state_size); - } - - /* Point mdproc and then copy over td1's contents */ + /* Point mdproc and then copy over p1's contents */ mdp2 = &p2->p_md; bcopy(&p1->p_md, mdp2, sizeof(*mdp2)); @@ -215,29 +251,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) */ td2->td_frame->tf_rflags &= ~PSL_T; - /* - * Set registers for trampoline to user mode. Leave space for the - * return address on stack. These are the kernel mode register values. - */ - pcb2->pcb_r12 = (register_t)fork_return; /* fork_trampoline argument */ - pcb2->pcb_rbp = 0; - pcb2->pcb_rsp = (register_t)td2->td_frame - sizeof(void *); - pcb2->pcb_rbx = (register_t)td2; /* fork_trampoline argument */ - pcb2->pcb_rip = (register_t)fork_trampoline; - /*- - * pcb2->pcb_dr*: cloned above. - * pcb2->pcb_savefpu: cloned above. - * pcb2->pcb_flags: cloned above. - * pcb2->pcb_onfault: cloned above (always NULL here?). - * pcb2->pcb_[fg]sbase: cloned above - */ - - /* Setup to release spin count in fork_exit(). */ - td2->td_md.md_spinlock_count = 1; - td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; - pmap_thread_init_invl_gen(td2); - - /* As an i386, do not copy io permission bitmap. */ + /* As on i386, do not copy io permission bitmap. */ pcb2->pcb_tssp = NULL; /* New segment registers. */ @@ -275,7 +289,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) * pcb_rsp is loaded pointing to the cpu_switch() stack frame * containing the return address when exiting cpu_switch. * This will normally be to fork_trampoline(), which will have - * %ebx loaded with the new proc's pointer. fork_trampoline() + * %rbx loaded with the new proc's pointer. fork_trampoline() * will set up a stack to call fork_return(p, frame); to complete * the return to user-mode. */ @@ -571,38 +585,7 @@ cpu_set_syscall_retval(struct thread *td, int error) void cpu_copy_thread(struct thread *td, struct thread *td0) { - struct pcb *pcb2; - - pcb2 = td->td_pcb; - - /* Ensure that td0's pcb is up to date for user threads. */ - if ((td->td_pflags & TDP_KTHREAD) == 0) { - MPASS(td0 == curthread); - fpuexit(td0); - update_pcb_bases(td0->td_pcb); - } - - /* - * Copy the upcall pcb. This loads kernel regs. - * Those not loaded individually below get their default - * values here. - */ - bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); - pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - - /* Kernel threads start with clean FPU and segment bases. */ - if ((td->td_pflags & TDP_KTHREAD) != 0) { - pcb2->pcb_fsbase = 0; - pcb2->pcb_gsbase = 0; - clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | - PCB_KERNFPU | PCB_KERNFPU_THR); - } else { - MPASS((pcb2->pcb_flags & (PCB_KERNFPU | PCB_KERNFPU_THR)) == 0); - bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, - cpu_max_ext_state_size); - } - set_pcb_flags_raw(pcb2, PCB_FULL_IRET); - + copy_thread(td0, td); /* * Copy user general-purpose registers. @@ -620,27 +603,7 @@ cpu_copy_thread(struct thread *td, struct thread *td0) */ td->td_frame->tf_rflags &= ~PSL_T; - /* - * Set registers for trampoline to user mode. Leave space for the - * return address on stack. These are the kernel mode register values. - */ - pcb2->pcb_r12 = (register_t)fork_return; /* trampoline arg */ - pcb2->pcb_rbp = 0; - pcb2->pcb_rsp = (register_t)td->td_frame - sizeof(void *); /* trampoline arg */ - pcb2->pcb_rbx = (register_t)td; /* trampoline arg */ - pcb2->pcb_rip = (register_t)fork_trampoline; - /* - * If we didn't copy the pcb, we'd need to do the following registers: - * pcb2->pcb_dr*: cloned above. - * pcb2->pcb_savefpu: cloned above. - * pcb2->pcb_onfault: cloned above (always NULL here?). - * pcb2->pcb_[fg]sbase: cloned above - */ - - /* Setup to release spin count in fork_exit(). */ - td->td_md.md_spinlock_count = 1; - td->td_md.md_saved_flags = PSL_KERNEL | PSL_I; - pmap_thread_init_invl_gen(td); + set_pcb_flags_raw(td->td_pcb, PCB_FULL_IRET); } /* diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 5947ae5a6d15..5bbdfdb77b2d 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -133,6 +133,74 @@ alloc_fpusave(int flags) } return (res); } + +/* + * Common code shared between cpu_fork() and cpu_copy_thread() for + * initializing a thread. + */ +static void +copy_thread(struct thread *td1, struct thread *td2) +{ + struct pcb *pcb2; + + pcb2 = td2->td_pcb; + + /* Ensure that td1's pcb is up to date for user threads. */ + if ((td2->td_pflags & TDP_KTHREAD) == 0) { + MPASS(td1 == curthread); + td1->td_pcb->pcb_gs = rgs(); + critical_enter(); + if (PCPU_GET(fpcurthread) == td1) + npxsave(td1->td_pcb->pcb_save); + critical_exit(); + } + + /* Copy td1's pcb */ + bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); + + /* Properly initialize pcb_save */ + pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); + + /* Kernel threads start with clean NPX and segment bases. */ + if ((td2->td_pflags & TDP_KTHREAD) != 0) { + pcb2->pcb_gs = _udatasel; + set_fsbase(td2, 0); + set_gsbase(td2, 0); + pcb2->pcb_flags &= ~(PCB_NPXINITDONE | PCB_NPXUSERINITDONE | + PCB_KERNNPX | PCB_KERNNPX_THR); + } else { + MPASS((pcb2->pcb_flags & (PCB_KERNNPX | PCB_KERNNPX_THR)) == 0); + bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), + cpu_max_ext_state_size); + } + + /* + * Set registers for trampoline to user mode. Leave space for the + * return address on stack. These are the kernel mode register values. + */ + pcb2->pcb_edi = 0; + pcb2->pcb_esi = (int)fork_return; /* trampoline arg */ + pcb2->pcb_ebp = 0; + pcb2->pcb_esp = (int)td2->td_frame - sizeof(void *); /* trampoline arg */ + pcb2->pcb_ebx = (int)td2; /* trampoline arg */ + pcb2->pcb_eip = (int)fork_trampoline + setidt_disp; + /* + * If we didn't copy the pcb, we'd need to do the following registers: + * pcb2->pcb_cr3: cloned above. + * pcb2->pcb_dr*: cloned above. + * pcb2->pcb_savefpu: cloned above. + * pcb2->pcb_flags: cloned above. + * pcb2->pcb_onfault: cloned above (always NULL here?). + * pcb2->pcb_gs: cloned above. + * pcb2->pcb_ext: cleared below. + */ + pcb2->pcb_ext = NULL; + + /* Setup to release spin count in fork_exit(). */ + td2->td_md.md_spinlock_count = 1; + td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; +} + /* * Finish a fork operation, with process p2 nearly set up. * Copy and update the pcb, set up the stack so that the child @@ -167,38 +235,11 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) return; } - /* Ensure that td1's pcb is up to date for user processes. */ - if ((td2->td_pflags & TDP_KTHREAD) == 0) { - MPASS(td1 == curthread); - td1->td_pcb->pcb_gs = rgs(); - critical_enter(); - if (PCPU_GET(fpcurthread) == td1) - npxsave(td1->td_pcb->pcb_save); - critical_exit(); - } - /* Point the pcb to the top of the stack */ pcb2 = get_pcb_td(td2); td2->td_pcb = pcb2; - /* Copy td1's pcb */ - bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); - - /* Properly initialize pcb_save */ - pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - - /* Kernel processes start with clean NPX and segment bases. */ - if ((td2->td_pflags & TDP_KTHREAD) != 0) { - pcb2->pcb_gs = _udatasel; - set_fsbase(td2, 0); - set_gsbase(td2, 0); - pcb2->pcb_flags &= ~(PCB_NPXINITDONE | PCB_NPXUSERINITDONE | - PCB_KERNNPX | PCB_KERNNPX_THR); - } else { - MPASS((pcb2->pcb_flags & (PCB_KERNNPX | PCB_KERNNPX_THR)) == 0); - bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), - cpu_max_ext_state_size); - } + copy_thread(td1, td2); /* Point mdproc and then copy over td1's contents */ mdp2 = &p2->p_md; @@ -225,30 +266,13 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) */ td2->td_frame->tf_eflags &= ~PSL_T; - /* - * Set registers for trampoline to user mode. Leave space for the - * return address on stack. These are the kernel mode register values. - */ + /* Set cr3 for the new process. */ pcb2->pcb_cr3 = pmap_get_cr3(vmspace_pmap(p2->p_vmspace)); - pcb2->pcb_edi = 0; - pcb2->pcb_esi = (int)fork_return; /* fork_trampoline argument */ - pcb2->pcb_ebp = 0; - pcb2->pcb_esp = (int)td2->td_frame - sizeof(void *); - pcb2->pcb_ebx = (int)td2; /* fork_trampoline argument */ - pcb2->pcb_eip = (int)fork_trampoline + setidt_disp; - /*- - * pcb2->pcb_dr*: cloned above. - * pcb2->pcb_savefpu: cloned above. - * pcb2->pcb_flags: cloned above. - * pcb2->pcb_onfault: cloned above (always NULL here?). - * pcb2->pcb_gs: cloned above. - * pcb2->pcb_ext: cleared below. - */ /* * XXX don't copy the i/o pages. this should probably be fixed. */ - pcb2->pcb_ext = 0; + pcb2->pcb_ext = NULL; /* Copy the LDT, if necessary. */ mtx_lock_spin(&dt_lock); @@ -264,10 +288,6 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) } mtx_unlock_spin(&dt_lock); - /* Setup to release spin count in fork_exit(). */ - td2->td_md.md_spinlock_count = 1; - td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; - /* * Now, cpu_switch() can schedule the new process. * pcb_esp is loaded pointing to the cpu_switch() stack frame @@ -435,41 +455,7 @@ cpu_set_syscall_retval(struct thread *td, int error) void cpu_copy_thread(struct thread *td, struct thread *td0) { - struct pcb *pcb2; - - /* Point the pcb to the top of the stack. */ - pcb2 = td->td_pcb; - - /* Ensure that td0's pcb is up to date for user threads. */ - if ((td->td_pflags & TDP_KTHREAD) == 0) { - MPASS(td0 == curthread); - td0->td_pcb->pcb_gs = rgs(); - critical_enter(); - if (PCPU_GET(fpcurthread) == td0) - npxsave(td0->td_pcb->pcb_save); - critical_exit(); - } - - /* - * Copy the upcall pcb. This loads kernel regs. - * Those not loaded individually below get their default - * values here. - */ - bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); - pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - - /* Kernel threads start with clean NPX and segment bases. */ - if ((td->td_pflags & TDP_KTHREAD) != 0) { - pcb2->pcb_gs = _udatasel; - set_fsbase(td, 0); - set_gsbase(td, 0); - pcb2->pcb_flags &= ~(PCB_NPXINITDONE | PCB_NPXUSERINITDONE | - PCB_KERNNPX | PCB_KERNNPX_THR); - } else { - MPASS((pcb2->pcb_flags & (PCB_KERNNPX | PCB_KERNNPX_THR)) == 0); - bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, - cpu_max_ext_state_size); - } + copy_thread(td0, td); /* * Copy user general-purpose registers. @@ -486,32 +472,6 @@ cpu_copy_thread(struct thread *td, struct thread *td0) * instruction after returning to userland. */ td->td_frame->tf_eflags &= ~PSL_T; - - /* - * Set registers for trampoline to user mode. Leave space for the - * return address on stack. These are the kernel mode register values. - */ - pcb2->pcb_edi = 0; - pcb2->pcb_esi = (int)fork_return; /* trampoline arg */ - pcb2->pcb_ebp = 0; - pcb2->pcb_esp = (int)td->td_frame - sizeof(void *); /* trampoline arg */ - pcb2->pcb_ebx = (int)td; /* trampoline arg */ - pcb2->pcb_eip = (int)fork_trampoline + setidt_disp; - /* - * If we didn't copy the pcb, we'd need to do the following registers: - * pcb2->pcb_cr3: cloned above. - * pcb2->pcb_dr*: cloned above. - * pcb2->pcb_savefpu: cloned above. - * pcb2->pcb_flags: cloned above. - * pcb2->pcb_onfault: cloned above (always NULL here?). - * pcb2->pcb_gs: cloned above. - * pcb2->pcb_ext: cleared below. - */ - pcb2->pcb_ext = NULL; - - /* Setup to release spin count in fork_exit(). */ - td->td_md.md_spinlock_count = 1; - td->td_md.md_saved_flags = PSL_KERNEL | PSL_I; } /* From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 22:45: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 BA43A5AEB94; Mon, 29 Mar 2021 22:45: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 4F8SNN5gyPz4qHH; Mon, 29 Mar 2021 22:45: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 AB40A1B9AA; Mon, 29 Mar 2021 22:45: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 12TMjurp007637; Mon, 29 Mar 2021 22:45:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMjulF007636; Mon, 29 Mar 2021 22:45:56 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:45:56 GMT Message-Id: <202103292245.12TMjulF007636@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: f9d590884ae3 - stable/13 - Rename linux_set_upcall_kse() to linux_set_upcall(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f9d590884ae31a6689c9e472046f7176f3eb57c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 22:45:57 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=f9d590884ae31a6689c9e472046f7176f3eb57c4 commit f9d590884ae31a6689c9e472046f7176f3eb57c4 Author: John Baldwin AuthorDate: 2021-03-18 19:14:34 +0000 Commit: John Baldwin CommitDate: 2021-03-29 22:36:11 +0000 Rename linux_set_upcall_kse() to linux_set_upcall(). This matches the rename of cpu_set_upcall_kse() in 5c2cf818454375536fda522ba83cf67c50929e6b. Sponsored by: DARPA (cherry picked from commit 3b57ddb029daf225a8385dade491019269da82e8) --- sys/amd64/amd64/vm_machdep.c | 2 +- sys/amd64/linux/linux_machdep.c | 2 +- sys/amd64/linux32/linux32_machdep.c | 2 +- sys/arm64/linux/linux_machdep.c | 8 ++++---- sys/compat/linux/linux_fork.c | 4 ++-- sys/compat/linux/linux_misc.h | 2 +- sys/i386/i386/vm_machdep.c | 2 +- sys/i386/linux/linux_machdep.c | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 0527ef95cf3b..f64259decbff 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -591,7 +591,7 @@ cpu_copy_thread(struct thread *td, struct thread *td0) * Copy user general-purpose registers. * * Some of these registers are rewritten by cpu_set_upcall() - * and linux_set_upcall_kse(). + * and linux_set_upcall(). */ bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); diff --git a/sys/amd64/linux/linux_machdep.c b/sys/amd64/linux/linux_machdep.c index 1a9d79b0c1ba..4736fd3d1682 100644 --- a/sys/amd64/linux/linux_machdep.c +++ b/sys/amd64/linux/linux_machdep.c @@ -118,7 +118,7 @@ linux_execve(struct thread *td, struct linux_execve_args *args) } int -linux_set_upcall_kse(struct thread *td, register_t stack) +linux_set_upcall(struct thread *td, register_t stack) { if (stack) diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c index fde180d74d73..8ae82f3df8ca 100644 --- a/sys/amd64/linux32/linux32_machdep.c +++ b/sys/amd64/linux32/linux32_machdep.c @@ -418,7 +418,7 @@ linux_set_cloned_tls(struct thread *td, void *desc) } int -linux_set_upcall_kse(struct thread *td, register_t stack) +linux_set_upcall(struct thread *td, register_t stack) { if (stack) diff --git a/sys/arm64/linux/linux_machdep.c b/sys/arm64/linux/linux_machdep.c index 512bf1cc3398..711ccb4fd63d 100644 --- a/sys/arm64/linux/linux_machdep.c +++ b/sys/arm64/linux/linux_machdep.c @@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$"); LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); /* DTrace probes */ -LIN_SDT_PROBE_DEFINE0(machdep, linux_set_upcall_kse, todo); +LIN_SDT_PROBE_DEFINE0(machdep, linux_set_upcall, todo); LIN_SDT_PROBE_DEFINE0(machdep, linux_mmap2, todo); LIN_SDT_PROBE_DEFINE0(machdep, linux_rt_sigsuspend, todo); LIN_SDT_PROBE_DEFINE0(machdep, linux_sigaltstack, todo); @@ -84,12 +84,12 @@ linux_execve(struct thread *td, struct linux_execve_args *uap) return (error); } -/* LINUXTODO: implement (or deduplicate) arm64 linux_set_upcall_kse */ +/* LINUXTODO: implement (or deduplicate) arm64 linux_set_upcall */ int -linux_set_upcall_kse(struct thread *td, register_t stack) +linux_set_upcall(struct thread *td, register_t stack) { - LIN_SDT_PROBE0(machdep, linux_set_upcall_kse, todo); + LIN_SDT_PROBE0(machdep, linux_set_upcall, todo); return (EDOOFUS); } diff --git a/sys/compat/linux/linux_fork.c b/sys/compat/linux/linux_fork.c index 3ba40fc2705e..ed4adcf8a175 100644 --- a/sys/compat/linux/linux_fork.c +++ b/sys/compat/linux/linux_fork.c @@ -205,7 +205,7 @@ linux_clone_proc(struct thread *td, struct linux_clone_args *args) * stack. This is what normal fork() does, so we just keep tf_rsp arg * intact. */ - linux_set_upcall_kse(td2, PTROUT(args->stack)); + linux_set_upcall(td2, PTROUT(args->stack)); if (args->flags & LINUX_CLONE_SETTLS) linux_set_cloned_tls(td2, args->tls); @@ -304,7 +304,7 @@ linux_clone_thread(struct thread *td, struct linux_clone_args *args) cpu_thread_clean(newtd); - linux_set_upcall_kse(newtd, PTROUT(args->stack)); + linux_set_upcall(newtd, PTROUT(args->stack)); PROC_LOCK(p); p->p_flag |= P_HADTHREADS; diff --git a/sys/compat/linux/linux_misc.h b/sys/compat/linux/linux_misc.h index c7e4fa38682c..da76753e3d24 100644 --- a/sys/compat/linux/linux_misc.h +++ b/sys/compat/linux/linux_misc.h @@ -181,7 +181,7 @@ extern int stclohz; int linux_ptrace_status(struct thread *td, int pid, int status); #endif void linux_to_bsd_waitopts(int options, int *bsdopts); -int linux_set_upcall_kse(struct thread *td, register_t stack); +int linux_set_upcall(struct thread *td, register_t stack); int linux_set_cloned_tls(struct thread *td, void *desc); struct thread *linux_tdfind(struct thread *, lwpid_t, pid_t); diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 5bbdfdb77b2d..c04fb57db4b1 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -461,7 +461,7 @@ cpu_copy_thread(struct thread *td, struct thread *td0) * Copy user general-purpose registers. * * Some of these registers are rewritten by cpu_set_upcall() - * and linux_set_upcall_kse(). + * and linux_set_upcall(). */ bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c index 624a6ef6ae87..d2d713d4776d 100644 --- a/sys/i386/linux/linux_machdep.c +++ b/sys/i386/linux/linux_machdep.c @@ -314,7 +314,7 @@ linux_set_cloned_tls(struct thread *td, void *desc) } int -linux_set_upcall_kse(struct thread *td, register_t stack) +linux_set_upcall(struct thread *td, register_t stack) { if (stack) From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 22:45: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 0EF955AE993; Mon, 29 Mar 2021 22:45: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 4F8SNQ0F5lz4qF8; Mon, 29 Mar 2021 22:45: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 C00381B6C7; Mon, 29 Mar 2021 22:45: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 12TMjvBB007660; Mon, 29 Mar 2021 22:45:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TMjvNM007659; Mon, 29 Mar 2021 22:45:57 GMT (envelope-from git) Date: Mon, 29 Mar 2021 22:45:57 GMT Message-Id: <202103292245.12TMjvNM007659@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 325427f71d37 - stable/13 - xnb: Don't pass SIOC{ADD, DEL}MULTI to ifmedia_ioctl(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 325427f71d379bac9a7708d5f87b4063e584ab54 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 22:45:59 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=325427f71d379bac9a7708d5f87b4063e584ab54 commit 325427f71d379bac9a7708d5f87b4063e584ab54 Author: John Baldwin AuthorDate: 2021-03-22 16:55:49 +0000 Commit: John Baldwin CommitDate: 2021-03-29 22:36:36 +0000 xnb: Don't pass SIOC{ADD,DEL}MULTI to ifmedia_ioctl(). ifmedia_ioctl() doesn't handle these requests, and this matches what xn does. Sponsored by: DARPA (cherry picked from commit 71ba16a0a02f4a3fd56d03e908615a8b5f701ba4) --- sys/dev/xen/netback/netback.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/xen/netback/netback.c b/sys/dev/xen/netback/netback.c index 44159f60d996..8710120ecef3 100644 --- a/sys/dev/xen/netback/netback.c +++ b/sys/dev/xen/netback/netback.c @@ -2296,6 +2296,7 @@ xnb_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; case SIOCADDMULTI: case SIOCDELMULTI: + break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &xnb->sc_media, cmd); From owner-dev-commits-src-branches@freebsd.org Mon Mar 29 23:24: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 EC91E5AFE4D; Mon, 29 Mar 2021 23:24: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 4F8TDX1N0gz4sfs; Mon, 29 Mar 2021 23:24: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 ADB571C0CB; Mon, 29 Mar 2021 23:24: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 12TNOA55063775; Mon, 29 Mar 2021 23:24:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12TNOACF063774; Mon, 29 Mar 2021 23:24:10 GMT (envelope-from git) Date: Mon, 29 Mar 2021 23:24:10 GMT Message-Id: <202103292324.12TNOACF063774@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 77ffc9399dad - stable/13 - Stop installing kernel-only crypto headers to /usr/include/crypto. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 77ffc9399dadaf5d512f3f3e4d51c30edfed2c2a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 29 Mar 2021 23:24:14 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=77ffc9399dadaf5d512f3f3e4d51c30edfed2c2a commit 77ffc9399dadaf5d512f3f3e4d51c30edfed2c2a Author: John Baldwin AuthorDate: 2021-03-16 00:00:21 +0000 Commit: John Baldwin CommitDate: 2021-03-29 23:23:36 +0000 Stop installing kernel-only crypto headers to /usr/include/crypto. The only user-facing header from OCF is . Sponsored by: Chelsio Communications (cherry picked from commit afbee98232f41fc05fa8a5b9a8cda4c4c65ff448) (cherry picked from commit 2fc640d5bc0a17024dc1eb996ab00af42a5c6dbd) (cherry picked from commit 283352dd4f6a3bb2f3c7cb45ce5dca3d86f5e3f4) (cherry picked from commit 9946b2f4e0b478de69ebd687e2132c318a4d7c21) (cherry picked from commit 7af04dff025d98e2feff979756ecde8ef0ace390) --- ObsoleteFiles.inc | 14 ++++++++++++++ include/Makefile | 22 ++-------------------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index d72eebbe7de1..4fd7275fb8fa 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -36,6 +36,20 @@ # xargs -n1 | sort | uniq -d; # done +# 20210329: Remove kernel-only crypto headers from /usr/include +OLD_FILES+=usr/include/crypto/_cryptodev.h +OLD_FILES+=usr/include/crypto/cbc_mac.h +OLD_FILES+=usr/include/crypto/deflate.h +OLD_FILES+=usr/include/crypto/gfmult.h +OLD_FILES+=usr/include/crypto/gmac.h +OLD_FILES+=usr/include/crypto/rijndael.h +OLD_FILES+=usr/include/crypto/rmd160.h +OLD_FILES+=usr/include/crypto/xform.h +OLD_FILES+=usr/include/crypto/xform_auth.h +OLD_FILES+=usr/include/crypto/xform_comp.h +OLD_FILES+=usr/include/crypto/xform_enc.h +OLD_FILES+=usr/include/crypto/xform_poly1305.h + # 20210204: bump shared libraries which link against ncurses OLD_LIBS+=lib/libedit.so.7 OLD_LIBS+=usr/lib/libdialog.so.8 diff --git a/include/Makefile b/include/Makefile index b6eb63e5ef15..ffa0b1c01f6a 100644 --- a/include/Makefile +++ b/include/Makefile @@ -84,10 +84,6 @@ FS9660= cd9660_mount.h \ iso_rrip.h FS9660DIR= ${INCLUDEDIR}/isofs/cd9660 -.PATH: ${SRCTOP}/sys/crypto -CRYPTO= rijndael/rijndael.h -CRYPTODIR= ${INCLUDEDIR}/crypto - .PATH: ${SRCTOP}/sys/dev/evdev EVDEV= input.h \ input-event-codes.h \ @@ -105,18 +101,7 @@ HYPERV= hv_snapshot.h \ HYPERVDIR= ${INCLUDEDIR}/dev/hyperv .PATH: ${SRCTOP}/sys/opencrypto -OPENCRYPTO= _cryptodev.h \ - cbc_mac.h \ - cryptodev.h \ - deflate.h \ - gfmult.h \ - gmac.h \ - rmd160.h \ - xform.h \ - xform_auth.h \ - xform_comp.h \ - xform_enc.h \ - xform_poly1305.h +OPENCRYPTO= cryptodev.h OPENCRYPTODIR= ${INCLUDEDIR}/crypto .PATH: ${SRCTOP}/sys/dev/pci @@ -359,10 +344,7 @@ symlinks: .PHONY .META $$(printf '../../../../%s ' sys/netpfil/pf/*.h) \ ${SDESTDIR}${INCLUDEDIR}/netpfil/pf; .endif - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/crypto/rijndael/rijndael.h \ - ${SDESTDIR}${INCLUDEDIR}/crypto; \ - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../%s ' sys/opencrypto/*.h) \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/opencrypto/cryptodev.h \ ${SDESTDIR}${INCLUDEDIR}/crypto; \ cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ $$(printf '../../../%s ' sys/${MACHINE}/include/*.h) \ From owner-dev-commits-src-branches@freebsd.org Tue Mar 30 08:01: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 AE0C25BF189; Tue, 30 Mar 2021 08:01:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8hj84bN4z3vyc; Tue, 30 Mar 2021 08:01:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9104423102; Tue, 30 Mar 2021 08:01:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12U81G6f089352; Tue, 30 Mar 2021 08:01:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12U81GXX089351; Tue, 30 Mar 2021 08:01:16 GMT (envelope-from git) Date: Tue, 30 Mar 2021 08:01:16 GMT Message-Id: <202103300801.12U81GXX089351@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 923e7f7e1267 - stable/13 - Fix nexhtop group index array scaling. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 923e7f7e12670e97b097a195e69c848a6e8773a2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 30 Mar 2021 08:01:16 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=923e7f7e12670e97b097a195e69c848a6e8773a2 commit 923e7f7e12670e97b097a195e69c848a6e8773a2 Author: Alexander V. Chernikov AuthorDate: 2021-03-29 23:00:17 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-30 07:34:31 +0000 Fix nexhtop group index array scaling. The current code has the limit of 127 nexthop groups due to the wrongly-checked bitmask_copy() return value. PR: 254303 Reported by: Aleks (cherry picked from commit 9095dc7da4cf0c484fb1160b2180b7329b09b107) --- sys/net/route/nhgrp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/net/route/nhgrp.c b/sys/net/route/nhgrp.c index c25f4f09865b..f6638b12ebea 100644 --- a/sys/net/route/nhgrp.c +++ b/sys/net/route/nhgrp.c @@ -243,8 +243,8 @@ consider_resize(struct nh_control *ctl, uint32_t new_nh_buckets, uint32_t new_id CHT_SLIST_RESIZE(&ctl->gr_head, mpath, nh_ptr, new_nh_buckets); } if (nh_idx_ptr != NULL) { - if (bitmask_copy(&ctl->gr_idx_head, nh_idx_ptr, new_idx_items)) - bitmask_swap(&ctl->nh_idx_head, nh_idx_ptr, new_idx_items, &old_idx_ptr); + if (bitmask_copy(&ctl->gr_idx_head, nh_idx_ptr, new_idx_items) == 0) + bitmask_swap(&ctl->gr_idx_head, nh_idx_ptr, new_idx_items, &old_idx_ptr); } NHOPS_WUNLOCK(ctl); From owner-dev-commits-src-branches@freebsd.org Tue Mar 30 08:01:17 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9CB445BF12C; Tue, 30 Mar 2021 08:01:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8hj940xlz3vwD; Tue, 30 Mar 2021 08:01:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A4A622F0F; Tue, 30 Mar 2021 08:01:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12U81He9089377; Tue, 30 Mar 2021 08:01:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12U81HoS089376; Tue, 30 Mar 2021 08:01:17 GMT (envelope-from git) Date: Tue, 30 Mar 2021 08:01:17 GMT Message-Id: <202103300801.12U81HoS089376@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 145ca12d22a4 - stable/13 - Put bandaid for nhgrp_dump_sysctl() malloc KASSERT(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 145ca12d22a40a9136ba6cd1ce434d3d044bddea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 30 Mar 2021 08:01:17 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=145ca12d22a40a9136ba6cd1ce434d3d044bddea commit 145ca12d22a40a9136ba6cd1ce434d3d044bddea Author: Alexander V. Chernikov AuthorDate: 2021-03-29 23:12:11 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-30 07:36:04 +0000 Put bandaid for nhgrp_dump_sysctl() malloc KASSERT(). Recent rtsock changes widened epoch and covered nhgrp_dump_sysctl(), resulting in `netstat -4On` triggering with KASSERT. (cherry picked from commit 9fa8d1582b44b4850d40699c9adb104732328b7d) --- sys/net/route/nhgrp_ctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/net/route/nhgrp_ctl.c b/sys/net/route/nhgrp_ctl.c index b228c3bcee37..49866499ac86 100644 --- a/sys/net/route/nhgrp_ctl.c +++ b/sys/net/route/nhgrp_ctl.c @@ -806,7 +806,9 @@ nhgrp_dump_sysctl(struct rib_head *rh, struct sysctl_req *w) sz = sizeof(struct rt_msghdr) + sizeof(struct nhgrp_external); sz += 2 * sizeof(struct nhgrp_container); sz += 2 * sizeof(struct nhgrp_nhop_external) * RIB_MAX_MPATH_WIDTH; - buffer = malloc(sz, M_TEMP, M_WAITOK); + buffer = malloc(sz, M_TEMP, M_NOWAIT); + if (buffer == NULL) + return (ENOMEM); NET_EPOCH_ENTER(et); NHOPS_RLOCK(ctl); From owner-dev-commits-src-branches@freebsd.org Tue Mar 30 15:04: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 E4C11579C0C; Tue, 30 Mar 2021 15:04:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F8t5D67w6z4rHm; Tue, 30 Mar 2021 15:04:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C58837A3; Tue, 30 Mar 2021 15:04:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12UF4G6a082183; Tue, 30 Mar 2021 15:04:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12UF4Gh4082182; Tue, 30 Mar 2021 15:04:16 GMT (envelope-from git) Date: Tue, 30 Mar 2021 15:04:16 GMT Message-Id: <202103301504.12UF4Gh4082182@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: a42a0b77f0de - stable/11 - Fix array out of bound panic introduced in r306219. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: a42a0b77f0de636a91f79fa2fde8a507d88b79b7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 30 Mar 2021 15:04:17 -0000 The branch stable/11 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=a42a0b77f0de636a91f79fa2fde8a507d88b79b7 commit a42a0b77f0de636a91f79fa2fde8a507d88b79b7 Author: Alexander Motin AuthorDate: 2019-05-28 18:32:04 +0000 Commit: Ryan Moeller CommitDate: 2021-03-30 15:02:24 +0000 Fix array out of bound panic introduced in r306219. As I see, different NICs in different configurations may have different numbers of TX and RX queues. The code was assuming 1:1 mapping between event queues (interrupts) and TX/RX queues. Since number of interrupts is set to maximum of TX and RX queues, when those two are different, the system is doomed. I have no documentation or deep knowledge about this hardware, so this change is based on general observations and code reading. If some of my guesses are wrong, please do better. I just confirmed HP NC550SFP NICs are working now. MFC after: 2 weeks Sponsored by: iXsystems, Inc. (cherry picked from commit 3582828053556ca0e05ed9aab3e78008a0595e09) --- sys/dev/oce/oce_if.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/sys/dev/oce/oce_if.c b/sys/dev/oce/oce_if.c index 1de38d4528fc..362bc1776890 100644 --- a/sys/dev/oce/oce_if.c +++ b/sys/dev/oce/oce_if.c @@ -2395,10 +2395,20 @@ oce_eqd_set_periodic(POCE_SOFTC sc) goto modify_eqd; } - rq = sc->rq[i]; - rxpkts = rq->rx_stats.rx_pkts; - wq = sc->wq[i]; - tx_reqs = wq->tx_stats.tx_reqs; + if (i == 0) { + rq = sc->rq[0]; + rxpkts = rq->rx_stats.rx_pkts; + } else + rxpkts = 0; + if (i + 1 < sc->nrqs) { + rq = sc->rq[i + 1]; + rxpkts += rq->rx_stats.rx_pkts; + } + if (i < sc->nwqs) { + wq = sc->wq[i]; + tx_reqs = wq->tx_stats.tx_reqs; + } else + tx_reqs = 0; now = ticks; if (!aic->ticks || now < aic->ticks || From owner-dev-commits-src-branches@freebsd.org Wed Mar 31 10:50: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 494EC5C3712; Wed, 31 Mar 2021 10:50: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 4F9NQH1fpwz4tFh; Wed, 31 Mar 2021 10:50: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 2C6DB186C2; Wed, 31 Mar 2021 10:50: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 12VAolUN056375; Wed, 31 Mar 2021 10:50:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VAolnu056374; Wed, 31 Mar 2021 10:50:47 GMT (envelope-from git) Date: Wed, 31 Mar 2021 10:50:47 GMT Message-Id: <202103311050.12VAolnu056374@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Jonathan T. Looney" Subject: git: a25c17022e2d - stable/13 - Fetch the sigfastblock value in syscalls that wait for signals MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jtl X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a25c17022e2d6344dcbc6192af276d2798d76d44 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 31 Mar 2021 10:50:47 -0000 The branch stable/13 has been updated by jtl: URL: https://cgit.FreeBSD.org/src/commit/?id=a25c17022e2d6344dcbc6192af276d2798d76d44 commit a25c17022e2d6344dcbc6192af276d2798d76d44 Author: Jonathan T. Looney AuthorDate: 2021-03-12 18:14:17 +0000 Commit: Jonathan T. Looney CommitDate: 2021-03-30 23:39:57 +0000 Fetch the sigfastblock value in syscalls that wait for signals We have seen several cases of processes which have become "stuck" in kern_sigsuspend(). When this occurs, the kernel's td_sigblock_val is set to 0x10 (one block outstanding) and the userspace copy of the word is set to 0 (unblocked). Because the kernel's cached value shows that signals are blocked, kern_sigsuspend() blocks almost all signals, which means the process hangs indefinitely in sigsuspend(). It is not entirely clear what is causing this condition to occur. However, it seems to make sense to add some protection against this case by fetching the latest sigfastblock value from userspace for syscalls which will sleep waiting for signals. Here, the change is applied to kern_sigsuspend() and kern_sigtimedwait(). (cherry picked from commit dbec10e08808e375365fb2a2462f306e0cdfda32) --- sys/kern/kern_sig.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 7884b5be9f91..3d55405d3151 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1268,6 +1268,9 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, ksiginfo_t *ksi, ets.tv_nsec = 0; traced = false; + /* Ensure the sigfastblock value is up to date. */ + sigfastblock_fetch(td); + if (timeout != NULL) { if (timeout->tv_nsec >= 0 && timeout->tv_nsec < 1000000000) { timevalid = 1; @@ -1527,6 +1530,9 @@ kern_sigsuspend(struct thread *td, sigset_t mask) struct proc *p = td->td_proc; int has_sig, sig; + /* Ensure the sigfastblock value is up to date. */ + sigfastblock_fetch(td); + /* * When returning from sigsuspend, we want * the old mask to be restored after the From owner-dev-commits-src-branches@freebsd.org Wed Mar 31 13:12: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 0CCCF5C7AC4; Wed, 31 Mar 2021 13:12: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 4F9RZ66vJ6z3L0D; Wed, 31 Mar 2021 13:12: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 DDCE41A2E0; Wed, 31 Mar 2021 13:12: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 12VDCkM8057481; Wed, 31 Mar 2021 13:12:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VDCk2l057480; Wed, 31 Mar 2021 13:12:46 GMT (envelope-from git) Date: Wed, 31 Mar 2021 13:12:46 GMT Message-Id: <202103311312.12VDCk2l057480@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: e99aa5c2cf6b - stable/13 - pf tests: pfsync bulk update 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/13 X-Git-Reftype: branch X-Git-Commit: e99aa5c2cf6b0eadcc29c62243d51de0eb36937c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 31 Mar 2021 13:12:47 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e99aa5c2cf6b0eadcc29c62243d51de0eb36937c commit e99aa5c2cf6b0eadcc29c62243d51de0eb36937c Author: Kristof Provost AuthorDate: 2021-03-15 13:10:55 +0000 Commit: Kristof Provost CommitDate: 2021-03-31 13:09:08 +0000 pf tests: pfsync bulk update test Test that pfsync works as expected with bulk updates. That is, create some state before setting up the second firewall. Let that firewall request a bulk update so it can catch up, and check that it got the state which was created before it enable pfsync. PR: 254236 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29272 (cherry picked from commit 8ad7d25dfc808ca00300f7553a9b28dfc0e99c18) --- tests/sys/netpfil/pf/pfsync.sh | 68 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/tests/sys/netpfil/pf/pfsync.sh b/tests/sys/netpfil/pf/pfsync.sh index d8cb0a13efb7..a6fc7ec9f7e9 100644 --- a/tests/sys/netpfil/pf/pfsync.sh +++ b/tests/sys/netpfil/pf/pfsync.sh @@ -112,8 +112,76 @@ defer_cleanup() pfsynct_cleanup } +atf_test_case "bulk" "cleanup" +bulk_head() +{ + atf_set descr 'Test bulk updates' + atf_set require.user root +} + +bulk_body() +{ + pfsynct_init + + epair_sync=$(vnet_mkepair) + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + + vnet_mkjail one ${epair_one}a ${epair_sync}a + vnet_mkjail two ${epair_two}a ${epair_sync}b + + # pfsync interface + jexec one ifconfig ${epair_sync}a 192.0.2.1/24 up + jexec one ifconfig ${epair_one}a 198.51.100.1/24 up + jexec one ifconfig pfsync0 \ + syncdev ${epair_sync}a \ + maxupd 1\ + up + jexec two ifconfig ${epair_two}a 198.51.100.2/24 up + jexec two ifconfig ${epair_sync}b 192.0.2.2/24 up + + # Enable pf + jexec one pfctl -e + pft_set_rules one \ + "set skip on ${epair_sync}a" \ + "pass keep state" + jexec two pfctl -e + pft_set_rules two \ + "set skip on ${epair_sync}b" \ + "pass keep state" + + ifconfig ${epair_one}b 198.51.100.254/24 up + + # Create state prior to setting up pfsync + ping -c 1 -S 198.51.100.254 198.51.100.1 + + # Wait before setting up pfsync on two, so we don't accidentally catch + # the update anyway. + sleep 1 + + # Now set up pfsync in jail two + jexec two ifconfig pfsync0 \ + syncdev ${epair_sync}b \ + up + + # Give pfsync time to do its thing + sleep 2 + + jexec two pfctl -s states + if ! jexec two pfctl -s states | grep icmp | grep 198.51.100.1 | \ + grep 198.51.100.2 ; then + atf_fail "state not found on synced host" + fi +} + +bulk_cleanup() +{ + pfsynct_cleanup +} + atf_init_test_cases() { atf_add_test_case "basic" atf_add_test_case "defer" + atf_add_test_case "bulk" } From owner-dev-commits-src-branches@freebsd.org Wed Mar 31 13:12: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 E934E5C7ABD; Wed, 31 Mar 2021 13:12: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 4F9RZ55rXTz3L24; Wed, 31 Mar 2021 13:12: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 BB9F61A0B5; Wed, 31 Mar 2021 13:12: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 12VDCjSx057457; Wed, 31 Mar 2021 13:12:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VDCjCx057456; Wed, 31 Mar 2021 13:12:45 GMT (envelope-from git) Date: Wed, 31 Mar 2021 13:12:45 GMT Message-Id: <202103311312.12VDCjCx057456@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: 343fee4cd023 - stable/13 - pfsync: Unconditionally push packets when requesting state updates 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: 343fee4cd023da0f7ed64e19f3d2351083fe963c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 31 Mar 2021 13:12:46 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=343fee4cd023da0f7ed64e19f3d2351083fe963c commit 343fee4cd023da0f7ed64e19f3d2351083fe963c Author: Thomas Kurschel AuthorDate: 2021-03-15 13:28:52 +0000 Commit: Kristof Provost CommitDate: 2021-03-31 13:09:08 +0000 pfsync: Unconditionally push packets when requesting state updates When we request a bulk sync we need to ensure we actually send out that request, not just buffer it until we have enough data to send a full packet. PR: 254236 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29271 (cherry picked from commit 9f2e5184173f6af70306678b018270df9a9600f2) --- sys/netpfil/pf/if_pfsync.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index cf2ff2ef0926..06bad556e885 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -1960,7 +1960,7 @@ pfsync_request_update(u_int32_t creatorid, u_int64_t id) nlen += sizeof(struct pfsync_subheader); if (b->b_len + nlen > sc->sc_ifp->if_mtu) { - pfsync_sendout(1, 0); + pfsync_sendout(0, 0); nlen = sizeof(struct pfsync_subheader) + sizeof(struct pfsync_upd_req); @@ -1968,6 +1968,8 @@ pfsync_request_update(u_int32_t creatorid, u_int64_t id) TAILQ_INSERT_TAIL(&b->b_upd_req_list, item, ur_entry); b->b_len += nlen; + + pfsync_push(b); } static bool From owner-dev-commits-src-branches@freebsd.org Wed Mar 31 13:13: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 B9FFC5C7F2A; Wed, 31 Mar 2021 13:13: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 4F9RZW4mhhz3L5J; Wed, 31 Mar 2021 13:13: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 959DA1A05A; Wed, 31 Mar 2021 13:13: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 12VDD7YQ057670; Wed, 31 Mar 2021 13:13:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VDD7mC057669; Wed, 31 Mar 2021 13:13:07 GMT (envelope-from git) Date: Wed, 31 Mar 2021 13:13:07 GMT Message-Id: <202103311313.12VDD7mC057669@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: aab309b4134a - stable/12 - pfsync: Unconditionally push packets when requesting state updates 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: aab309b4134a1822fab48d799580e4afdf90ac4a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 31 Mar 2021 13:13:07 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=aab309b4134a1822fab48d799580e4afdf90ac4a commit aab309b4134a1822fab48d799580e4afdf90ac4a Author: Thomas Kurschel AuthorDate: 2021-03-15 13:28:52 +0000 Commit: Kristof Provost CommitDate: 2021-03-31 08:56:46 +0000 pfsync: Unconditionally push packets when requesting state updates When we request a bulk sync we need to ensure we actually send out that request, not just buffer it until we have enough data to send a full packet. PR: 254236 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29271 (cherry picked from commit 9f2e5184173f6af70306678b018270df9a9600f2) --- sys/netpfil/pf/if_pfsync.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index dc149ff486d5..65dd64b02bbd 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -1959,7 +1959,7 @@ pfsync_request_update(u_int32_t creatorid, u_int64_t id) nlen += sizeof(struct pfsync_subheader); if (b->b_len + nlen > sc->sc_ifp->if_mtu) { - pfsync_sendout(1, 0); + pfsync_sendout(0, 0); nlen = sizeof(struct pfsync_subheader) + sizeof(struct pfsync_upd_req); @@ -1967,6 +1967,8 @@ pfsync_request_update(u_int32_t creatorid, u_int64_t id) TAILQ_INSERT_TAIL(&b->b_upd_req_list, item, ur_entry); b->b_len += nlen; + + pfsync_push(b); } static bool From owner-dev-commits-src-branches@freebsd.org Wed Mar 31 13:13: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 D25625C7D3C; Wed, 31 Mar 2021 13:13: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 4F9RZX5Thgz3LMl; Wed, 31 Mar 2021 13:13: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 ADE481A05B; Wed, 31 Mar 2021 13:13: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 12VDD8i9057691; Wed, 31 Mar 2021 13:13:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VDD8mJ057690; Wed, 31 Mar 2021 13:13:08 GMT (envelope-from git) Date: Wed, 31 Mar 2021 13:13:08 GMT Message-Id: <202103311313.12VDD8mJ057690@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: f8d706fdd106 - stable/12 - pf tests: pfsync bulk update 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: f8d706fdd106f94ca048d809d504fef651d4a23e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 31 Mar 2021 13:13:09 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=f8d706fdd106f94ca048d809d504fef651d4a23e commit f8d706fdd106f94ca048d809d504fef651d4a23e Author: Kristof Provost AuthorDate: 2021-03-15 13:10:55 +0000 Commit: Kristof Provost CommitDate: 2021-03-31 08:57:24 +0000 pf tests: pfsync bulk update test Test that pfsync works as expected with bulk updates. That is, create some state before setting up the second firewall. Let that firewall request a bulk update so it can catch up, and check that it got the state which was created before it enable pfsync. PR: 254236 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29272 (cherry picked from commit 8ad7d25dfc808ca00300f7553a9b28dfc0e99c18) --- tests/sys/netpfil/pf/pfsync.sh | 68 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/tests/sys/netpfil/pf/pfsync.sh b/tests/sys/netpfil/pf/pfsync.sh index 95209b832c62..8b94f6dee29f 100755 --- a/tests/sys/netpfil/pf/pfsync.sh +++ b/tests/sys/netpfil/pf/pfsync.sh @@ -87,8 +87,76 @@ defer_cleanup() pfsynct_cleanup } +atf_test_case "bulk" "cleanup" +bulk_head() +{ + atf_set descr 'Test bulk updates' + atf_set require.user root +} + +bulk_body() +{ + pfsynct_init + + epair_sync=$(vnet_mkepair) + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + + vnet_mkjail one ${epair_one}a ${epair_sync}a + vnet_mkjail two ${epair_two}a ${epair_sync}b + + # pfsync interface + jexec one ifconfig ${epair_sync}a 192.0.2.1/24 up + jexec one ifconfig ${epair_one}a 198.51.100.1/24 up + jexec one ifconfig pfsync0 \ + syncdev ${epair_sync}a \ + maxupd 1\ + up + jexec two ifconfig ${epair_two}a 198.51.100.2/24 up + jexec two ifconfig ${epair_sync}b 192.0.2.2/24 up + + # Enable pf + jexec one pfctl -e + pft_set_rules one \ + "set skip on ${epair_sync}a" \ + "pass keep state" + jexec two pfctl -e + pft_set_rules two \ + "set skip on ${epair_sync}b" \ + "pass keep state" + + ifconfig ${epair_one}b 198.51.100.254/24 up + + # Create state prior to setting up pfsync + ping -c 1 -S 198.51.100.254 198.51.100.1 + + # Wait before setting up pfsync on two, so we don't accidentally catch + # the update anyway. + sleep 1 + + # Now set up pfsync in jail two + jexec two ifconfig pfsync0 \ + syncdev ${epair_sync}b \ + up + + # Give pfsync time to do its thing + sleep 2 + + jexec two pfctl -s states + if ! jexec two pfctl -s states | grep icmp | grep 198.51.100.1 | \ + grep 198.51.100.2 ; then + atf_fail "state not found on synced host" + fi +} + +bulk_cleanup() +{ + pfsynct_cleanup +} + atf_init_test_cases() { atf_add_test_case "basic" atf_add_test_case "defer" + atf_add_test_case "bulk" } From owner-dev-commits-src-branches@freebsd.org Wed Mar 31 13:16: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 D13595C7AEF; Wed, 31 Mar 2021 13:16: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 4F9RfP5ZT8z3LlL; Wed, 31 Mar 2021 13:16: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 AE0A41A0B8; Wed, 31 Mar 2021 13:16: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 12VDGTSp058334; Wed, 31 Mar 2021 13:16:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VDGT4B058333; Wed, 31 Mar 2021 13:16:29 GMT (envelope-from git) Date: Wed, 31 Mar 2021 13:16:29 GMT Message-Id: <202103311316.12VDGT4B058333@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: 381ba4357c74 - stable/13 - Fix several dev_clone callbacks to avoid out-of-bounds reads 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: 381ba4357c7452d9a5ee38832f0adf47b2428a48 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 31 Mar 2021 13:16:29 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=381ba4357c7452d9a5ee38832f0adf47b2428a48 commit 381ba4357c7452d9a5ee38832f0adf47b2428a48 Author: Mark Johnston AuthorDate: 2021-03-28 15:08:36 +0000 Commit: Mark Johnston CommitDate: 2021-03-31 13:15:58 +0000 Fix several dev_clone callbacks to avoid out-of-bounds reads Use strncmp() instead of bcmp(), so that we don't have to find the minimum of the string lengths before comparing. Reviewed by: kib Reported by: KASAN Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29463 (cherry picked from commit 3428b6c050d102ba7f95514b29f4f5685d76b645) --- sys/dev/sound/pcm/dsp.c | 3 +-- sys/kern/kern_conf.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 0593a585b0fd..cce05f4ecf37 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -2294,8 +2294,7 @@ dsp_stdclone(char *name, char *namep, char *sep, int use_sep, int *u, int *c) size_t len; len = strlen(namep); - - if (bcmp(name, namep, len) != 0) + if (strncmp(name, namep, len) != 0) return (ENODEV); name += len; diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 29103f83c049..3a07c95e74d0 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -1255,7 +1255,7 @@ dev_stdclone(char *name, char **namep, const char *stem, int *unit) int u, i; i = strlen(stem); - if (bcmp(stem, name, i) != 0) + if (strncmp(stem, name, i) != 0) return (0); if (!isdigit(name[i])) return (0); From owner-dev-commits-src-branches@freebsd.org Wed Mar 31 13:16: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 E583F5C7D68; Wed, 31 Mar 2021 13:16: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 4F9RfQ6C50z3LqT; Wed, 31 Mar 2021 13:16: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 C81DE1A05E; Wed, 31 Mar 2021 13:16: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 12VDGUPT058357; Wed, 31 Mar 2021 13:16:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VDGUfs058356; Wed, 31 Mar 2021 13:16:30 GMT (envelope-from git) Date: Wed, 31 Mar 2021 13:16:30 GMT Message-Id: <202103311316.12VDGUfs058356@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: 5e96fbdfc421 - stable/13 - amd64: Make KPDPphys local to pmap.c 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: 5e96fbdfc4218a4bdb1ca1e8b7ea85ba8fb808f3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 31 Mar 2021 13:16:31 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5e96fbdfc4218a4bdb1ca1e8b7ea85ba8fb808f3 commit 5e96fbdfc4218a4bdb1ca1e8b7ea85ba8fb808f3 Author: Mark Johnston AuthorDate: 2021-03-24 13:55:22 +0000 Commit: Mark Johnston CommitDate: 2021-03-31 13:16:11 +0000 amd64: Make KPDPphys local to pmap.c Sponsored by: The FreeBSD Foundation (cherry picked from commit 7ae2e703366e5ac56373509ececae53ecaa5bc59) --- sys/amd64/amd64/pmap.c | 2 +- sys/amd64/include/pmap.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index bd23fd176e88..54dbadfb95c3 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -419,7 +419,7 @@ static int pat_index[PAT_INDEX_SIZE]; /* cache mode to PAT index conversion */ static u_int64_t KPTphys; /* phys addr of kernel level 1 */ static u_int64_t KPDphys; /* phys addr of kernel level 2 */ -u_int64_t KPDPphys; /* phys addr of kernel level 3 */ +static u_int64_t KPDPphys; /* phys addr of kernel level 3 */ u_int64_t KPML4phys; /* phys addr of kernel level 4 */ u_int64_t KPML5phys; /* phys addr of kernel level 5, if supported */ diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h index ef69ba9b6f9f..8ba654cb2e7c 100644 --- a/sys/amd64/include/pmap.h +++ b/sys/amd64/include/pmap.h @@ -303,7 +303,6 @@ typedef u_int64_t pml5_entry_t; #define P5Dmap ((pd_entry_t *)(addr_P5Dmap)) extern int nkpt; /* Initial number of kernel page tables */ -extern u_int64_t KPDPphys; /* physical address of kernel level 3 */ extern u_int64_t KPML4phys; /* physical address of kernel level 4 */ extern u_int64_t KPML5phys; /* physical address of kernel level 5 */ From owner-dev-commits-src-branches@freebsd.org Wed Mar 31 13:22: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 058C25781B9; Wed, 31 Mar 2021 13:22: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 4F9Rnf6kV5z3Lyf; Wed, 31 Mar 2021 13:22: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 D9B261A711; Wed, 31 Mar 2021 13:22: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 12VDMk1P072106; Wed, 31 Mar 2021 13:22:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VDMkn5072105; Wed, 31 Mar 2021 13:22:46 GMT (envelope-from git) Date: Wed, 31 Mar 2021 13:22:46 GMT Message-Id: <202103311322.12VDMkn5072105@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: f9fcb518e728 - stable/12 - Fix several dev_clone callbacks to avoid out-of-bounds reads 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: f9fcb518e7289489d8fc577565f21f95a51a33cd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 31 Mar 2021 13:22:47 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f9fcb518e7289489d8fc577565f21f95a51a33cd commit f9fcb518e7289489d8fc577565f21f95a51a33cd Author: Mark Johnston AuthorDate: 2021-03-28 15:08:36 +0000 Commit: Mark Johnston CommitDate: 2021-03-31 13:16:51 +0000 Fix several dev_clone callbacks to avoid out-of-bounds reads Use strncmp() instead of bcmp(), so that we don't have to find the minimum of the string lengths before comparing. Reviewed by: kib Reported by: KASAN Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29463 (cherry picked from commit 3428b6c050d102ba7f95514b29f4f5685d76b645) --- sys/dev/sound/pcm/dsp.c | 3 +-- sys/kern/kern_conf.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 100fe452d52b..7a3187807fa1 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -2295,8 +2295,7 @@ dsp_stdclone(char *name, char *namep, char *sep, int use_sep, int *u, int *c) size_t len; len = strlen(namep); - - if (bcmp(name, namep, len) != 0) + if (strncmp(name, namep, len) != 0) return (ENODEV); name += len; diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 089ec5bd6c3f..e1c67876241f 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -1256,7 +1256,7 @@ dev_stdclone(char *name, char **namep, const char *stem, int *unit) int u, i; i = strlen(stem); - if (bcmp(stem, name, i) != 0) + if (strncmp(stem, name, i) != 0) return (0); if (!isdigit(name[i])) return (0); From owner-dev-commits-src-branches@freebsd.org Wed Mar 31 13:22: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 2CD1B5C7FF6; Wed, 31 Mar 2021 13:22: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 4F9Rnh0Vtdz3MQp; Wed, 31 Mar 2021 13:22: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 F41751A1F1; Wed, 31 Mar 2021 13:22: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 12VDMlfi072132; Wed, 31 Mar 2021 13:22:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VDMlOm072131; Wed, 31 Mar 2021 13:22:47 GMT (envelope-from git) Date: Wed, 31 Mar 2021 13:22:47 GMT Message-Id: <202103311322.12VDMlOm072131@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: 9be668867476 - stable/12 - amd64: Make KPDPphys local to pmap.c 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: 9be66886747651104235642e457b23b7fa090cb0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 31 Mar 2021 13:22:48 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9be66886747651104235642e457b23b7fa090cb0 commit 9be66886747651104235642e457b23b7fa090cb0 Author: Mark Johnston AuthorDate: 2021-03-24 13:55:22 +0000 Commit: Mark Johnston CommitDate: 2021-03-31 13:16:58 +0000 amd64: Make KPDPphys local to pmap.c Sponsored by: The FreeBSD Foundation (cherry picked from commit 7ae2e703366e5ac56373509ececae53ecaa5bc59) --- sys/amd64/amd64/pmap.c | 2 +- sys/amd64/include/pmap.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index d67823729a48..c6f56c1cd73b 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -383,7 +383,7 @@ static int pat_index[PAT_INDEX_SIZE]; /* cache mode to PAT index conversion */ static u_int64_t KPTphys; /* phys addr of kernel level 1 */ static u_int64_t KPDphys; /* phys addr of kernel level 2 */ -u_int64_t KPDPphys; /* phys addr of kernel level 3 */ +static u_int64_t KPDPphys; /* phys addr of kernel level 3 */ u_int64_t KPML4phys; /* phys addr of kernel level 4 */ static u_int64_t DMPDphys; /* phys addr of direct mapped level 2 */ diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h index 7176e9c6ef4d..3520594de9bd 100644 --- a/sys/amd64/include/pmap.h +++ b/sys/amd64/include/pmap.h @@ -274,7 +274,6 @@ typedef u_int64_t pml4_entry_t; #define PML4pml4e ((pd_entry_t *)(addr_PML4pml4e)) extern int nkpt; /* Initial number of kernel page tables */ -extern u_int64_t KPDPphys; /* physical address of kernel level 3 */ extern u_int64_t KPML4phys; /* physical address of kernel level 4 */ /* From owner-dev-commits-src-branches@freebsd.org Wed Mar 31 16:01:21 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F80557CC93; Wed, 31 Mar 2021 16:01:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9WJd1krLz3m4x; Wed, 31 Mar 2021 16:01:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2EBD11C59C; Wed, 31 Mar 2021 16:01:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VG1Lg3095910; Wed, 31 Mar 2021 16:01:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VG1Lbu095909; Wed, 31 Mar 2021 16:01:21 GMT (envelope-from git) Date: Wed, 31 Mar 2021 16:01:21 GMT Message-Id: <202103311601.12VG1Lbu095909@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: 407e5a8d68aa - releng/13.0 - mn: report that this driver is removed in 14, not 13 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: 407e5a8d68aaf0ea461f7568a1983e91a6d41de0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 31 Mar 2021 16:01:21 -0000 The branch releng/13.0 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=407e5a8d68aaf0ea461f7568a1983e91a6d41de0 commit 407e5a8d68aaf0ea461f7568a1983e91a6d41de0 Author: Ed Maste AuthorDate: 2021-03-25 02:35:38 +0000 Commit: Ed Maste CommitDate: 2021-03-31 16:00:57 +0000 mn: report that this driver is removed in 14, not 13 (cherry picked from commit a66e75d9e2ddd9a84f8de204438282a25bb1a954) mn: bump deprecation version to 14 in man page as well Fixes: 66e75d9e2ddd ("mn: report that this driver is removed in 14, not 13") (cherry picked from commit 6acecf247f60fcd3ba9662d54c59fc7bd46fb67a) Approved by: re (gjb) --- share/man/man4/mn.4 | 4 ++-- sys/dev/mn/if_mn.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/share/man/man4/mn.4 b/share/man/man4/mn.4 index f034a1b10d45..e67eb1e5284f 100644 --- a/share/man/man4/mn.4 +++ b/share/man/man4/mn.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 6, 2020 +.Dd March 24, 2021 .Dt MN 4 .Os .Sh NAME @@ -37,7 +37,7 @@ The .Nm driver is not present in -.Fx 13.0 +.Fx 14.0 and later. .Sh HARDWARE The diff --git a/sys/dev/mn/if_mn.c b/sys/dev/mn/if_mn.c index bb329b24c24e..7c7699656743 100644 --- a/sys/dev/mn/if_mn.c +++ b/sys/dev/mn/if_mn.c @@ -1392,7 +1392,7 @@ mn_attach (device_t self) default: printf(" Rev 0x%x\n", sc->f54r->vstr); } - gone_in_dev(self, 13, "sync serial (T1/E1) driver"); + gone_in_dev(self, 14, "sync serial (T1/E1) driver"); if (ng_make_node_common(&mntypestruct, &sc->node) != 0) { printf("ng_make_node_common failed\n"); From owner-dev-commits-src-branches@freebsd.org Wed Mar 31 16:02: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 1628F57CF8A; Wed, 31 Mar 2021 16:02: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 4F9WL3089Wz3mf3; Wed, 31 Mar 2021 16:02: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 EBEB61C5BE; Wed, 31 Mar 2021 16: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 12VG2Yk6097004; Wed, 31 Mar 2021 16: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 12VG2YDc097003; Wed, 31 Mar 2021 16:02:34 GMT (envelope-from git) Date: Wed, 31 Mar 2021 16:02:34 GMT Message-Id: <202103311602.12VG2YDc097003@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: 42d99e4efa83 - releng/13.0 - arm64: implement COMPAT_FREEBSD32 fill/set dbregs/fpregs 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: 42d99e4efa83e1118b796967cdac6a5b7c190298 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 31 Mar 2021 16:02:35 -0000 The branch releng/13.0 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=42d99e4efa83e1118b796967cdac6a5b7c190298 commit 42d99e4efa83e1118b796967cdac6a5b7c190298 Author: Ed Maste AuthorDate: 2021-03-17 14:10:41 +0000 Commit: Ed Maste CommitDate: 2021-03-31 16:01:54 +0000 arm64: implement COMPAT_FREEBSD32 fill/set dbregs/fpregs On FreeBSD/arm fill_fpregs, fill_dbregs are stubs that zero the reg struct and return success. set_fpregs and set_dbregs do nothing and return success. Provide the same implementation for arm64 COMPAT_FREEBSD32. Reviewed by: andrew Approved by: re (gjb) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29314 (cherry picked from commit 5be27cbf16c85ce95d21db57349f61494f851821) (cherry picked from commit db50c8123469e3eab07e931019bf6d4df2d55c78) --- sys/arm64/arm64/machdep.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 73b06beeba7e..d33eb3ff4b76 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -489,36 +489,35 @@ set_regs32(struct thread *td, struct reg32 *regs) return (0); } +/* XXX fill/set dbregs/fpregs are stubbed on 32-bit arm. */ int fill_fpregs32(struct thread *td, struct fpreg32 *regs) { - printf("ARM64TODO: fill_fpregs32"); - return (EDOOFUS); + memset(regs, 0, sizeof(*regs)); + return (0); } int set_fpregs32(struct thread *td, struct fpreg32 *regs) { - printf("ARM64TODO: set_fpregs32"); - return (EDOOFUS); + return (0); } int fill_dbregs32(struct thread *td, struct dbreg32 *regs) { - printf("ARM64TODO: fill_dbregs32"); - return (EDOOFUS); + memset(regs, 0, sizeof(*regs)); + return (0); } int set_dbregs32(struct thread *td, struct dbreg32 *regs) { - printf("ARM64TODO: set_dbregs32"); - return (EDOOFUS); + return (0); } #endif From owner-dev-commits-src-branches@freebsd.org Wed Mar 31 16:07: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 BA85E57CE7A; Wed, 31 Mar 2021 16:07: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 4F9WRQ4yfwz3n0L; Wed, 31 Mar 2021 16:07: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 9DA151C628; Wed, 31 Mar 2021 16:07: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 12VG7EAg097841; Wed, 31 Mar 2021 16:07:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VG7EV3097839; Wed, 31 Mar 2021 16:07:14 GMT (envelope-from git) Date: Wed, 31 Mar 2021 16:07:14 GMT Message-Id: <202103311607.12VG7EV3097839@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: 7745d7159777 - releng/13.0 - Tune DTrace 'aframes' for the FBT and profile providers on arm64. 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: 7745d71597771f193b1bfb0b4d8842cea16ef6d4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 31 Mar 2021 16:07:14 -0000 The branch releng/13.0 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=7745d71597771f193b1bfb0b4d8842cea16ef6d4 commit 7745d71597771f193b1bfb0b4d8842cea16ef6d4 Author: Robert Watson AuthorDate: 2021-03-21 00:01:54 +0000 Commit: Ed Maste CommitDate: 2021-03-31 16:03:53 +0000 Tune DTrace 'aframes' for the FBT and profile providers on arm64. In both cases, too few frames were trimmed, leading to exception handling or DTrace internals being exposed in stack traces exposed by D's stack() primitive. Reviewed by: emaste, andrew Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D29356 (cherry picked from commit 599fb1d198ec6792ba062114d2589ca9f01a3568) (cherry picked from commit fcc700abe4fa85b0f0ec9d953436725533cecc17) --- sys/cddl/dev/fbt/aarch64/fbt_isa.c | 5 +++-- sys/cddl/dev/profile/profile.c | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/cddl/dev/fbt/aarch64/fbt_isa.c b/sys/cddl/dev/fbt/aarch64/fbt_isa.c index f15bc12291d3..6bc351ad74f6 100644 --- a/sys/cddl/dev/fbt/aarch64/fbt_isa.c +++ b/sys/cddl/dev/fbt/aarch64/fbt_isa.c @@ -44,6 +44,7 @@ #define FBT_PATCHVAL (AARCH64_BRK | AARCH64_BRK_IMM16_VAL) #define FBT_ENTRY "entry" #define FBT_RETURN "return" +#define FBT_AFRAMES 4 int fbt_invop(uintptr_t addr, struct trapframe *frame, uintptr_t rval) @@ -141,7 +142,7 @@ fbt_provide_module_function(linker_file_t lf, int symindx, fbt = malloc(sizeof (fbt_probe_t), M_FBT, M_WAITOK | M_ZERO); fbt->fbtp_name = name; fbt->fbtp_id = dtrace_probe_create(fbt_id, modname, - name, FBT_ENTRY, 3, fbt); + name, FBT_ENTRY, FBT_AFRAMES, fbt); fbt->fbtp_patchpoint = instr; fbt->fbtp_ctl = lf; fbt->fbtp_loadcnt = lf->loadcnt; @@ -183,7 +184,7 @@ again: fbt->fbtp_name = name; if (retfbt == NULL) { fbt->fbtp_id = dtrace_probe_create(fbt_id, modname, - name, FBT_RETURN, 3, fbt); + name, FBT_RETURN, FBT_AFRAMES, fbt); } else { retfbt->fbtp_probenext = fbt; fbt->fbtp_id = retfbt->fbtp_id; diff --git a/sys/cddl/dev/profile/profile.c b/sys/cddl/dev/profile/profile.c index 4fc9f6f22eef..ca373f50a1a0 100644 --- a/sys/cddl/dev/profile/profile.c +++ b/sys/cddl/dev/profile/profile.c @@ -140,8 +140,7 @@ struct profile_probe_percpu; #endif #ifdef __aarch64__ -/* TODO: verify */ -#define PROF_ARTIFICIAL_FRAMES 10 +#define PROF_ARTIFICIAL_FRAMES 12 #endif #ifdef __riscv From owner-dev-commits-src-branches@freebsd.org Wed Mar 31 16:07: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 DE84E57CE7C; Wed, 31 Mar 2021 16:07: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 4F9WRR60Zwz3msG; Wed, 31 Mar 2021 16:07: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 C0FB51C355; Wed, 31 Mar 2021 16:07: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 12VG7FLt097868; Wed, 31 Mar 2021 16:07:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VG7F8n097867; Wed, 31 Mar 2021 16:07:15 GMT (envelope-from git) Date: Wed, 31 Mar 2021 16:07:15 GMT Message-Id: <202103311607.12VG7F8n097867@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: 6605a2a1634f - releng/13.0 - Teach DTrace that unaligned accesses are OK on aarch64, not just x86. 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: 6605a2a1634f5db4b9aeed33d0077399185992c9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 31 Mar 2021 16:07:15 -0000 The branch releng/13.0 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=6605a2a1634f5db4b9aeed33d0077399185992c9 commit 6605a2a1634f5db4b9aeed33d0077399185992c9 Author: Robert Watson AuthorDate: 2021-03-22 01:50:00 +0000 Commit: Ed Maste CommitDate: 2021-03-31 16:05:26 +0000 Teach DTrace that unaligned accesses are OK on aarch64, not just x86. Reviewed by: andrew Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D29369 (cherry picked from commit fb581531c1a0e6f1bf5392a2e97ed39d21d6e1fd) (cherry picked from commit ba08ba5226ff8551ea3926ce49b8604b71c9cabf) --- sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c index b212185a4578..ca6fa5481856 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c @@ -475,7 +475,7 @@ static kmutex_t dtrace_errlock; #define DTRACE_STORE(type, tomax, offset, what) \ *((type *)((uintptr_t)(tomax) + (uintptr_t)offset)) = (type)(what); -#ifndef __x86 +#if !defined(__x86) && !defined(__aarch64__) #define DTRACE_ALIGNCHECK(addr, size, flags) \ if (addr & (size - 1)) { \ *flags |= CPU_DTRACE_BADALIGN; \ From owner-dev-commits-src-branches@freebsd.org Wed Mar 31 19:56:02 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D8925ADE16; Wed, 31 Mar 2021 19:56: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 4F9cWQ2BXNz4Y9S; Wed, 31 Mar 2021 19:56: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 3A08A1F743; Wed, 31 Mar 2021 19:56: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 12VJu2Aa019211; Wed, 31 Mar 2021 19:56:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VJu2TK019210; Wed, 31 Mar 2021 19:56:02 GMT (envelope-from git) Date: Wed, 31 Mar 2021 19:56:02 GMT Message-Id: <202103311956.12VJu2TK019210@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Jonathan T. Looney" Subject: git: 40d278253d20 - releng/13.0 - Fetch the sigfastblock value in syscalls that wait for signals MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jtl X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 40d278253d205f35ec368c93b7400baddda1b81e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 31 Mar 2021 19:56:02 -0000 The branch releng/13.0 has been updated by jtl: URL: https://cgit.FreeBSD.org/src/commit/?id=40d278253d205f35ec368c93b7400baddda1b81e commit 40d278253d205f35ec368c93b7400baddda1b81e Author: Jonathan T. Looney AuthorDate: 2021-03-12 18:14:17 +0000 Commit: Jonathan T. Looney CommitDate: 2021-03-31 19:55:24 +0000 Fetch the sigfastblock value in syscalls that wait for signals We have seen several cases of processes which have become "stuck" in kern_sigsuspend(). When this occurs, the kernel's td_sigblock_val is set to 0x10 (one block outstanding) and the userspace copy of the word is set to 0 (unblocked). Because the kernel's cached value shows that signals are blocked, kern_sigsuspend() blocks almost all signals, which means the process hangs indefinitely in sigsuspend(). It is not entirely clear what is causing this condition to occur. However, it seems to make sense to add some protection against this case by fetching the latest sigfastblock value from userspace for syscalls which will sleep waiting for signals. Here, the change is applied to kern_sigsuspend() and kern_sigtimedwait(). Approved by: re (gjb) (cherry picked from commit dbec10e08808e375365fb2a2462f306e0cdfda32) (cherry picked from commit a25c17022e2d6344dcbc6192af276d2798d76d44) --- sys/kern/kern_sig.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 7884b5be9f91..3d55405d3151 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1268,6 +1268,9 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, ksiginfo_t *ksi, ets.tv_nsec = 0; traced = false; + /* Ensure the sigfastblock value is up to date. */ + sigfastblock_fetch(td); + if (timeout != NULL) { if (timeout->tv_nsec >= 0 && timeout->tv_nsec < 1000000000) { timevalid = 1; @@ -1527,6 +1530,9 @@ kern_sigsuspend(struct thread *td, sigset_t mask) struct proc *p = td->td_proc; int has_sig, sig; + /* Ensure the sigfastblock value is up to date. */ + sigfastblock_fetch(td); + /* * When returning from sigsuspend, we want * the old mask to be restored after the From owner-dev-commits-src-branches@freebsd.org Wed Mar 31 20:09:17 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 424EA5AE3DA; Wed, 31 Mar 2021 20:09:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9cpj1SFzz4Z19; Wed, 31 Mar 2021 20:09:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24DAC1F92A; Wed, 31 Mar 2021 20:09:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12VK9HvI034281; Wed, 31 Mar 2021 20:09:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VK9Hie034280; Wed, 31 Mar 2021 20:09:17 GMT (envelope-from git) Date: Wed, 31 Mar 2021 20:09:17 GMT Message-Id: <202103312009.12VK9Hie034280@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: b7fbdb5042c6 - releng/13.0 - Fix nexhtop group index array scaling. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: b7fbdb5042c619221ee0b97573affcb8bcb59458 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 31 Mar 2021 20:09:17 -0000 The branch releng/13.0 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=b7fbdb5042c619221ee0b97573affcb8bcb59458 commit b7fbdb5042c619221ee0b97573affcb8bcb59458 Author: Alexander V. Chernikov AuthorDate: 2021-03-29 23:00:17 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-31 20:00:10 +0000 Fix nexhtop group index array scaling. The current code has the limit of 127 nexthop groups due to the wrongly-checked bitmask_copy() return value. PR: 254303 Reported by: Aleks Approved by: re (gjb) (cherry picked from commit 923e7f7e12670e97b097a195e69c848a6e8773a2) --- sys/net/route/nhgrp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/net/route/nhgrp.c b/sys/net/route/nhgrp.c index c25f4f09865b..f6638b12ebea 100644 --- a/sys/net/route/nhgrp.c +++ b/sys/net/route/nhgrp.c @@ -243,8 +243,8 @@ consider_resize(struct nh_control *ctl, uint32_t new_nh_buckets, uint32_t new_id CHT_SLIST_RESIZE(&ctl->gr_head, mpath, nh_ptr, new_nh_buckets); } if (nh_idx_ptr != NULL) { - if (bitmask_copy(&ctl->gr_idx_head, nh_idx_ptr, new_idx_items)) - bitmask_swap(&ctl->nh_idx_head, nh_idx_ptr, new_idx_items, &old_idx_ptr); + if (bitmask_copy(&ctl->gr_idx_head, nh_idx_ptr, new_idx_items) == 0) + bitmask_swap(&ctl->gr_idx_head, nh_idx_ptr, new_idx_items, &old_idx_ptr); } NHOPS_WUNLOCK(ctl); From owner-dev-commits-src-branches@freebsd.org Wed Mar 31 20:09: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 636D55AE4FA; Wed, 31 Mar 2021 20:09: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 4F9cpk2MyLz4Z87; Wed, 31 Mar 2021 20:09: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 445A71F92B; Wed, 31 Mar 2021 20:09: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 12VK9ISi034304; Wed, 31 Mar 2021 20:09:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12VK9IWZ034303; Wed, 31 Mar 2021 20:09:18 GMT (envelope-from git) Date: Wed, 31 Mar 2021 20:09:18 GMT Message-Id: <202103312009.12VK9IWZ034303@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 0e7f02a1a996 - releng/13.0 - Zero `struct weightened_nhop` fields in nhgrp_get_addition_group(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 0e7f02a1a996960895d7cf8a39a407bcdb43168c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 31 Mar 2021 20:09:18 -0000 The branch releng/13.0 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=0e7f02a1a996960895d7cf8a39a407bcdb43168c commit 0e7f02a1a996960895d7cf8a39a407bcdb43168c Author: Alexander V. Chernikov AuthorDate: 2021-03-20 08:26:03 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-31 20:00:10 +0000 Zero `struct weightened_nhop` fields in nhgrp_get_addition_group(). `struct weightened_nhop` has spare 32bit between the fields due to the alignment (on amd64). Not zeroing these spare bits results in duplicating nhop groups in the kernel due to the way how comparison works. Approved by: re (gjb) (cherry picked from commit 6f43c72b472ee78e04f1ebd347ca0ae7787ee876) --- sys/net/route/nhgrp_ctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/route/nhgrp_ctl.c b/sys/net/route/nhgrp_ctl.c index b329b907144f..b228c3bcee37 100644 --- a/sys/net/route/nhgrp_ctl.c +++ b/sys/net/route/nhgrp_ctl.c @@ -646,7 +646,7 @@ nhgrp_get_addition_group(struct rib_head *rh, struct route_nhop_data *rnd_orig, { struct nh_control *ctl = rh->nh_control; struct nhgrp_priv *nhg_priv; - struct weightened_nhop wn[2]; + struct weightened_nhop wn[2] = {}; int error; if (rnd_orig->rnd_nhop == NULL) { From owner-dev-commits-src-branches@freebsd.org Thu Apr 1 07:59: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 84E835C261D; Thu, 1 Apr 2021 07:59: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 4F9wZ53MM7z4sC0; Thu, 1 Apr 2021 07:59: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 662901289; Thu, 1 Apr 2021 07:59: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 1317xPJU029950; Thu, 1 Apr 2021 07:59:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1317xPWJ029949; Thu, 1 Apr 2021 07:59:25 GMT (envelope-from git) Date: Thu, 1 Apr 2021 07:59:25 GMT Message-Id: <202104010759.1317xPWJ029949@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: 3802433d25c9 - stable/12 - Fix warning about signed comparison and drop WARNS for ktrdump(8). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3802433d25c9274fe71f024bbf260aa1450a3e1a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 01 Apr 2021 07:59:25 -0000 The branch stable/12 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=3802433d25c9274fe71f024bbf260aa1450a3e1a commit 3802433d25c9274fe71f024bbf260aa1450a3e1a Author: Dmitry Chagin AuthorDate: 2021-03-24 07:51:25 +0000 Commit: Dmitry Chagin CommitDate: 2021-04-01 07:52:34 +0000 Fix warning about signed comparison and drop WARNS for ktrdump(8). Reviewed By: jhb, imp Differential Revision: https://reviews.freebsd.org/D29381 (cherry picked from commit 9e5aeba51b431256adfd18b087ee61b09bfd6a79) --- usr.bin/ktrdump/Makefile | 2 -- usr.bin/ktrdump/ktrdump.c | 14 +++++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/usr.bin/ktrdump/Makefile b/usr.bin/ktrdump/Makefile index 63cd2cf2cea9..796569977f0f 100644 --- a/usr.bin/ktrdump/Makefile +++ b/usr.bin/ktrdump/Makefile @@ -4,6 +4,4 @@ PROG= ktrdump LIBADD= kvm MAN= ktrdump.8 -WARNS?= 2 - .include diff --git a/usr.bin/ktrdump/ktrdump.c b/usr.bin/ktrdump/ktrdump.c index 750f138f5485..bbe8fb19aae9 100644 --- a/usr.bin/ktrdump/ktrdump.c +++ b/usr.bin/ktrdump/ktrdump.c @@ -56,11 +56,11 @@ __FBSDID("$FreeBSD$"); static void usage(void); static struct nlist nl[] = { - { "_ktr_version" }, - { "_ktr_entries" }, - { "_ktr_idx" }, - { "_ktr_buf" }, - { NULL } + { .n_name = "_ktr_version" }, + { .n_name = "_ktr_entries" }, + { .n_name = "_ktr_idx" }, + { .n_name = "_ktr_buf" }, + { .n_name = NULL } }; static int cflag; @@ -262,7 +262,7 @@ main(int ac, char **av) fprintf(out, "\n"); } - tlast = -1; + tlast = UINTPTR_MAX; /* * Now tear through the trace buffer. * @@ -327,7 +327,7 @@ next: if ((c = *p++) == '\0') if (tflag) { tnow = (uintmax_t)buf[i].ktr_timestamp; if (rflag) { - if (tlast == -1) + if (tlast == UINTPTR_MAX) tlast = tnow; fprintf(out, "%16ju ", !iflag ? tlast - tnow : tnow - tlast); From owner-dev-commits-src-branches@freebsd.org Thu Apr 1 08:01: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 5E3845C2EA0; Thu, 1 Apr 2021 08:01: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 4F9wcZ21MKz4sgC; Thu, 1 Apr 2021 08:01: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 38A8C12A2; Thu, 1 Apr 2021 08:01: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 13181YYO040931; Thu, 1 Apr 2021 08:01:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13181Y8Z040930; Thu, 1 Apr 2021 08:01:34 GMT (envelope-from git) Date: Thu, 1 Apr 2021 08:01:34 GMT Message-Id: <202104010801.13181Y8Z040930@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: b4dc951c417e - stable/13 - Fix warning about signed comparison and drop WARNS for ktrdump(8). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b4dc951c417ec3afbc7064c1c7c4d2ce9fe03ad9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 01 Apr 2021 08:01:34 -0000 The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=b4dc951c417ec3afbc7064c1c7c4d2ce9fe03ad9 commit b4dc951c417ec3afbc7064c1c7c4d2ce9fe03ad9 Author: Dmitry Chagin AuthorDate: 2021-03-24 07:51:25 +0000 Commit: Dmitry Chagin CommitDate: 2021-04-01 07:55:03 +0000 Fix warning about signed comparison and drop WARNS for ktrdump(8). Reviewed By: jhb, imp Differential Revision: https://reviews.freebsd.org/D29381 (cherry picked from commit 9e5aeba51b431256adfd18b087ee61b09bfd6a79) --- usr.bin/ktrdump/Makefile | 2 -- usr.bin/ktrdump/ktrdump.c | 14 +++++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/usr.bin/ktrdump/Makefile b/usr.bin/ktrdump/Makefile index 63cd2cf2cea9..796569977f0f 100644 --- a/usr.bin/ktrdump/Makefile +++ b/usr.bin/ktrdump/Makefile @@ -4,6 +4,4 @@ PROG= ktrdump LIBADD= kvm MAN= ktrdump.8 -WARNS?= 2 - .include diff --git a/usr.bin/ktrdump/ktrdump.c b/usr.bin/ktrdump/ktrdump.c index 750f138f5485..bbe8fb19aae9 100644 --- a/usr.bin/ktrdump/ktrdump.c +++ b/usr.bin/ktrdump/ktrdump.c @@ -56,11 +56,11 @@ __FBSDID("$FreeBSD$"); static void usage(void); static struct nlist nl[] = { - { "_ktr_version" }, - { "_ktr_entries" }, - { "_ktr_idx" }, - { "_ktr_buf" }, - { NULL } + { .n_name = "_ktr_version" }, + { .n_name = "_ktr_entries" }, + { .n_name = "_ktr_idx" }, + { .n_name = "_ktr_buf" }, + { .n_name = NULL } }; static int cflag; @@ -262,7 +262,7 @@ main(int ac, char **av) fprintf(out, "\n"); } - tlast = -1; + tlast = UINTPTR_MAX; /* * Now tear through the trace buffer. * @@ -327,7 +327,7 @@ next: if ((c = *p++) == '\0') if (tflag) { tnow = (uintmax_t)buf[i].ktr_timestamp; if (rflag) { - if (tlast == -1) + if (tlast == UINTPTR_MAX) tlast = tnow; fprintf(out, "%16ju ", !iflag ? tlast - tnow : tnow - tlast); From owner-dev-commits-src-branches@freebsd.org Thu Apr 1 08:04: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 8A7B85C2FFD; Thu, 1 Apr 2021 08:04: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 4F9wgX3Ltdz4svR; Thu, 1 Apr 2021 08:04: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 63DE21420; Thu, 1 Apr 2021 08:04: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 131848ar043904; Thu, 1 Apr 2021 08:04:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131848X8043903; Thu, 1 Apr 2021 08:04:08 GMT (envelope-from git) Date: Thu, 1 Apr 2021 08:04:08 GMT Message-Id: <202104010804.131848X8043903@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: f5209bef0f61 - stable/13 - Get rid of i386 ref here as linux64 is a 64-bit module. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f5209bef0f6103d3ccc2380d438e85a8a8367e52 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 01 Apr 2021 08:04:08 -0000 The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=f5209bef0f6103d3ccc2380d438e85a8a8367e52 commit f5209bef0f6103d3ccc2380d438e85a8a8367e52 Author: Dmitry Chagin AuthorDate: 2021-03-24 15:56:46 +0000 Commit: Dmitry Chagin CommitDate: 2021-04-01 08:03:35 +0000 Get rid of i386 ref here as linux64 is a 64-bit module. Reviewed By: emaste, imp Differential Revision: https://reviews.freebsd.org/D29412 (cherry picked from commit 88588c4b7611a39cdf965c3c07d8fcc13ed553b4) --- sys/modules/linux64/Makefile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sys/modules/linux64/Makefile b/sys/modules/linux64/Makefile index ebc69168bd4a..c081151e3fc5 100644 --- a/sys/modules/linux64/Makefile +++ b/sys/modules/linux64/Makefile @@ -1,7 +1,7 @@ # $FreeBSD$ .PATH: ${SRCTOP}/sys/compat/linux ${SRCTOP}/sys/${MACHINE}/linux -.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +.if ${MACHINE_CPUARCH} == "amd64" .PATH: ${SRCTOP}/sys/x86/linux .endif @@ -16,16 +16,13 @@ SRCS= linux_fork.c linux_dummy_machdep.c linux_file.c linux_event.c \ opt_compat.h opt_inet6.h opt_posix.h opt_usb.h \ vnode_if.h device_if.h bus_if.h \ linux_support.s -.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +.if ${MACHINE_CPUARCH} == "amd64" SRCS+= linux_dummy_x86.c .endif DPSRCS= assym.inc linux_genassym.c # XXX: for assym.inc SRCS+= opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h -.if ${MACHINE_CPUARCH} == "i386" -SRCS+= opt_apic.h -.endif CLEANFILES= linux_assym.h linux_genassym.o linux_locore.o \ genassym.o From owner-dev-commits-src-branches@freebsd.org Thu Apr 1 09:16: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 08E0F5C57AE; Thu, 1 Apr 2021 09:16: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 4F9yHX6tTpz3FQF; Thu, 1 Apr 2021 09:16: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 DAD5F1F52; Thu, 1 Apr 2021 09:16: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 1319GuOj042113; Thu, 1 Apr 2021 09:16:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1319Guww042112; Thu, 1 Apr 2021 09:16:56 GMT (envelope-from git) Date: Thu, 1 Apr 2021 09:16:56 GMT Message-Id: <202104010916.1319Guww042112@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: 484bc45f544a - stable/13 - MFC 31070b5bc77a: Set default alternate setting when USB audio devices are not in use, to activate power save features. 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: 484bc45f544a10790e866d683ecfe05846107c09 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 01 Apr 2021 09:16:57 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=484bc45f544a10790e866d683ecfe05846107c09 commit 484bc45f544a10790e866d683ecfe05846107c09 Author: Hans Petter Selasky AuthorDate: 2021-03-09 16:41:18 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-01 09:13:10 +0000 MFC 31070b5bc77a: Set default alternate setting when USB audio devices are not in use, to activate power save features. Differential Revision: https://reviews.freebsd.org/D28032 Suggested by: Shichun_Ma@Dell.com Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 31070b5bc77a499009a835650eb9d4bf2eceaa15) --- sys/dev/sound/usb/uaudio.c | 199 +++++++++++++++++++++++---------------------- 1 file changed, 104 insertions(+), 95 deletions(-) diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index 095078b47e65..538e4180f6de 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -945,6 +945,27 @@ uaudio_set_spdif_dummy(struct uaudio_softc *sc, int flags) return (0); } +static usb_error_t +uaudio_force_power_save(struct uaudio_softc *sc, uint8_t iface_index) +{ + struct usb_interface *iface; + usb_error_t err; + + iface = usbd_get_iface(sc->sc_udev, iface_index); + if (iface == NULL || iface->idesc == NULL) + return (USB_ERR_INVAL); + + /* check if correct alternate setting is already selected */ + if (iface->alt_index == 0) { + /* force power save mode by selecting default alternate setting */ + err = usbd_req_set_alt_interface_no(sc->sc_udev, NULL, iface_index, + iface->idesc->bAlternateSetting); + } else { + err = usbd_set_alt_interface_index(sc->sc_udev, iface_index, 0); + } + return (err); +} + static int uaudio_attach(device_t dev) { @@ -1019,16 +1040,16 @@ uaudio_attach(device_t dev) /* * Need to set a default alternate interface, else - * some USB audio devices might go into an infinte + * some USB audio devices might go into an infinite * re-enumeration loop: */ - err = usbd_set_alt_interface_index(sc->sc_udev, - sc->sc_play_chan[i].usb_alt[0].iface_index, - sc->sc_play_chan[i].usb_alt[0].iface_alt_index); + err = uaudio_force_power_save(sc, + sc->sc_play_chan[i].usb_alt[0].iface_index); if (err) { DPRINTF("setting of alternate index failed: %s!\n", usbd_errstr(err)); } + for (x = 0; x != sc->sc_play_chan[i].num_alt; x++) { device_printf(dev, "Play[%u]: %d Hz, %d ch, %s format, " "2x%dms buffer.\n", i, @@ -1049,16 +1070,16 @@ uaudio_attach(device_t dev) /* * Need to set a default alternate interface, else - * some USB audio devices might go into an infinte + * some USB audio devices might go into an infinite * re-enumeration loop: */ - err = usbd_set_alt_interface_index(sc->sc_udev, - sc->sc_rec_chan[i].usb_alt[0].iface_index, - sc->sc_rec_chan[i].usb_alt[0].iface_alt_index); + err = uaudio_force_power_save(sc, + sc->sc_rec_chan[i].usb_alt[0].iface_index); if (err) { DPRINTF("setting of alternate index failed: %s!\n", usbd_errstr(err)); } + for (x = 0; x != sc->sc_rec_chan[i].num_alt; x++) { device_printf(dev, "Record[%u]: %d Hz, %d ch, %s format, " "2x%dms buffer.\n", i, @@ -1307,7 +1328,7 @@ uaudio_configure_msg_sub(struct uaudio_softc *sc, uint32_t frames; uint32_t buf_size; uint16_t fps; - uint8_t set_alt; + uint8_t next_alt; uint8_t fps_shift; uint8_t operation; usb_error_t err; @@ -1319,22 +1340,51 @@ uaudio_configure_msg_sub(struct uaudio_softc *sc, usb_proc_explore_lock(sc->sc_udev); operation = chan->operation; - chan->operation = CHAN_OP_NONE; + switch (operation) { + case CHAN_OP_START: + case CHAN_OP_STOP: + chan->operation = CHAN_OP_NONE; + break; + default: + break; + } usb_proc_explore_unlock(sc->sc_udev); - mtx_lock(chan->pcm_mtx); - if (chan->cur_alt != chan->set_alt) - set_alt = chan->set_alt; - else - set_alt = CHAN_MAX_ALT; - mtx_unlock(chan->pcm_mtx); + switch (operation) { + case CHAN_OP_STOP: + /* Unsetup prior USB transfers, if any. */ + usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); - if (set_alt >= chan->num_alt) - goto done; + mtx_lock(chan->pcm_mtx); + chan->cur_alt = CHAN_MAX_ALT; + mtx_unlock(chan->pcm_mtx); - chan_alt = chan->usb_alt + set_alt; + /* + * The first alternate setting is typically used for + * power saving mode. Set this alternate setting as + * part of entering stop. + */ + err = usbd_set_alt_interface_index(sc->sc_udev, chan->iface_index, 0); + if (err) { + DPRINTF("setting of default alternate index failed: %s!\n", + usbd_errstr(err)); + } + return; - usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); + case CHAN_OP_START: + /* Unsetup prior USB transfers, if any. */ + usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); + break; + + default: + return; + } + + mtx_lock(chan->pcm_mtx); + next_alt = chan->set_alt; + mtx_unlock(chan->pcm_mtx); + + chan_alt = chan->usb_alt + next_alt; err = usbd_set_alt_interface_index(sc->sc_udev, chan_alt->iface_index, chan_alt->iface_alt_index); @@ -1438,32 +1488,16 @@ uaudio_configure_msg_sub(struct uaudio_softc *sc, goto error; } - mtx_lock(chan->pcm_mtx); - chan->cur_alt = set_alt; - mtx_unlock(chan->pcm_mtx); - -done: #if (UAUDIO_NCHANBUFS != 2) -#error "please update code" +#error "Please update code below!" #endif - switch (operation) { - case CHAN_OP_START: - mtx_lock(chan->pcm_mtx); - usbd_transfer_start(chan->xfer[0]); - usbd_transfer_start(chan->xfer[1]); - mtx_unlock(chan->pcm_mtx); - break; - case CHAN_OP_STOP: - mtx_lock(chan->pcm_mtx); - usbd_transfer_stop(chan->xfer[0]); - usbd_transfer_stop(chan->xfer[1]); - mtx_unlock(chan->pcm_mtx); - break; - default: - break; - } - return; + mtx_lock(chan->pcm_mtx); + chan->cur_alt = next_alt; + usbd_transfer_start(chan->xfer[0]); + usbd_transfer_start(chan->xfer[1]); + mtx_unlock(chan->pcm_mtx); + return; error: usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); @@ -2746,27 +2780,24 @@ uaudio_chan_set_param_format(struct uaudio_chan *ch, uint32_t format) } static void -uaudio_chan_start_sub(struct uaudio_chan *ch) +uaudio_chan_reconfigure(struct uaudio_chan *ch, uint8_t operation) { struct uaudio_softc *sc = ch->priv_sc; - int do_start = 0; - - if (ch->operation != CHAN_OP_DRAIN) { - if (ch->cur_alt == ch->set_alt && - ch->operation == CHAN_OP_NONE && - mtx_owned(ch->pcm_mtx) != 0) { - /* save doing the explore task */ - do_start = 1; - } else { - ch->operation = CHAN_OP_START; - (void)usb_proc_explore_msignal(sc->sc_udev, - &sc->sc_config_msg[0], &sc->sc_config_msg[1]); - } - } - if (do_start) { - usbd_transfer_start(ch->xfer[0]); - usbd_transfer_start(ch->xfer[1]); - } + + /* Check for shutdown. */ + if (ch->operation == CHAN_OP_DRAIN) + return; + + /* Set next operation. */ + ch->operation = operation; + + /* + * Because changing the alternate setting modifies the USB + * configuration, this part must be executed from the USB + * explore process. + */ + (void)usb_proc_explore_msignal(sc->sc_udev, + &sc->sc_config_msg[0], &sc->sc_config_msg[1]); } static int @@ -2819,10 +2850,10 @@ uaudio_chan_start(struct uaudio_chan *ch) * Start both endpoints because of need for * jitter information: */ - uaudio_chan_start_sub(&sc->sc_rec_chan[i]); - uaudio_chan_start_sub(&sc->sc_play_chan[i]); + uaudio_chan_reconfigure(&sc->sc_rec_chan[i], CHAN_OP_START); + uaudio_chan_reconfigure(&sc->sc_play_chan[i], CHAN_OP_START); } else { - uaudio_chan_start_sub(ch); + uaudio_chan_reconfigure(ch, CHAN_OP_START); } } @@ -2830,30 +2861,6 @@ uaudio_chan_start(struct uaudio_chan *ch) usb_proc_explore_unlock(sc->sc_udev); } -static void -uaudio_chan_stop_sub(struct uaudio_chan *ch) -{ - struct uaudio_softc *sc = ch->priv_sc; - int do_stop = 0; - - if (ch->operation != CHAN_OP_DRAIN) { - if (ch->cur_alt == ch->set_alt && - ch->operation == CHAN_OP_NONE && - mtx_owned(ch->pcm_mtx) != 0) { - /* save doing the explore task */ - do_stop = 1; - } else { - ch->operation = CHAN_OP_STOP; - (void)usb_proc_explore_msignal(sc->sc_udev, - &sc->sc_config_msg[0], &sc->sc_config_msg[1]); - } - } - if (do_stop) { - usbd_transfer_stop(ch->xfer[0]); - usbd_transfer_stop(ch->xfer[1]); - } -} - void uaudio_chan_stop(struct uaudio_chan *ch) { @@ -2882,10 +2889,10 @@ uaudio_chan_stop(struct uaudio_chan *ch) * Stop both endpoints in case the one was used for * jitter information: */ - uaudio_chan_stop_sub(&sc->sc_rec_chan[i]); - uaudio_chan_stop_sub(&sc->sc_play_chan[i]); + uaudio_chan_reconfigure(&sc->sc_rec_chan[i], CHAN_OP_STOP); + uaudio_chan_reconfigure(&sc->sc_play_chan[i], CHAN_OP_STOP); } else { - uaudio_chan_stop_sub(ch); + uaudio_chan_reconfigure(ch, CHAN_OP_STOP); } } @@ -5961,9 +5968,11 @@ umidi_probe(device_t dev) if (usb_test_quirk(uaa, UQ_SINGLE_CMD_MIDI)) chan->single_command = 1; - if (usbd_set_alt_interface_index(sc->sc_udev, chan->iface_index, - chan->iface_alt_index)) { - DPRINTF("setting of alternate index failed!\n"); + error = usbd_set_alt_interface_index(sc->sc_udev, + chan->iface_index, chan->iface_alt_index); + if (error) { + DPRINTF("setting of alternate index failed: %s\n", + usbd_errstr(error)); goto detach; } usbd_set_parent_iface(sc->sc_udev, chan->iface_index, From owner-dev-commits-src-branches@freebsd.org Thu Apr 1 09:18: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 D0A805C57D6; Thu, 1 Apr 2021 09:18: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 4F9yKM5bqRz3FTV; Thu, 1 Apr 2021 09:18: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 B2F19231A; Thu, 1 Apr 2021 09:18: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 1319IVtS042477; Thu, 1 Apr 2021 09:18:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1319IVdP042476; Thu, 1 Apr 2021 09:18:31 GMT (envelope-from git) Date: Thu, 1 Apr 2021 09:18:31 GMT Message-Id: <202104010918.1319IVdP042476@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: 8d1867e2b749 - stable/12 - MFC 31070b5bc77a: Set default alternate setting when USB audio devices are not in use, to activate power save features. 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: 8d1867e2b749ee4d75d8e08fe177e25489e2913d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 01 Apr 2021 09:18:31 -0000 The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=8d1867e2b749ee4d75d8e08fe177e25489e2913d commit 8d1867e2b749ee4d75d8e08fe177e25489e2913d Author: Hans Petter Selasky AuthorDate: 2021-03-09 16:41:18 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-01 09:16:39 +0000 MFC 31070b5bc77a: Set default alternate setting when USB audio devices are not in use, to activate power save features. Differential Revision: https://reviews.freebsd.org/D28032 Suggested by: Shichun_Ma@Dell.com Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 31070b5bc77a499009a835650eb9d4bf2eceaa15) --- sys/dev/sound/usb/uaudio.c | 199 +++++++++++++++++++++++---------------------- 1 file changed, 104 insertions(+), 95 deletions(-) diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index 895456d84c58..e2e86fe5df63 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -946,6 +946,27 @@ uaudio_set_spdif_dummy(struct uaudio_softc *sc, int flags) return (0); } +static usb_error_t +uaudio_force_power_save(struct uaudio_softc *sc, uint8_t iface_index) +{ + struct usb_interface *iface; + usb_error_t err; + + iface = usbd_get_iface(sc->sc_udev, iface_index); + if (iface == NULL || iface->idesc == NULL) + return (USB_ERR_INVAL); + + /* check if correct alternate setting is already selected */ + if (iface->alt_index == 0) { + /* force power save mode by selecting default alternate setting */ + err = usbd_req_set_alt_interface_no(sc->sc_udev, NULL, iface_index, + iface->idesc->bAlternateSetting); + } else { + err = usbd_set_alt_interface_index(sc->sc_udev, iface_index, 0); + } + return (err); +} + static int uaudio_attach(device_t dev) { @@ -1020,16 +1041,16 @@ uaudio_attach(device_t dev) /* * Need to set a default alternate interface, else - * some USB audio devices might go into an infinte + * some USB audio devices might go into an infinite * re-enumeration loop: */ - err = usbd_set_alt_interface_index(sc->sc_udev, - sc->sc_play_chan[i].usb_alt[0].iface_index, - sc->sc_play_chan[i].usb_alt[0].iface_alt_index); + err = uaudio_force_power_save(sc, + sc->sc_play_chan[i].usb_alt[0].iface_index); if (err) { DPRINTF("setting of alternate index failed: %s!\n", usbd_errstr(err)); } + for (x = 0; x != sc->sc_play_chan[i].num_alt; x++) { device_printf(dev, "Play[%u]: %d Hz, %d ch, %s format, " "2x%dms buffer.\n", i, @@ -1050,16 +1071,16 @@ uaudio_attach(device_t dev) /* * Need to set a default alternate interface, else - * some USB audio devices might go into an infinte + * some USB audio devices might go into an infinite * re-enumeration loop: */ - err = usbd_set_alt_interface_index(sc->sc_udev, - sc->sc_rec_chan[i].usb_alt[0].iface_index, - sc->sc_rec_chan[i].usb_alt[0].iface_alt_index); + err = uaudio_force_power_save(sc, + sc->sc_rec_chan[i].usb_alt[0].iface_index); if (err) { DPRINTF("setting of alternate index failed: %s!\n", usbd_errstr(err)); } + for (x = 0; x != sc->sc_rec_chan[i].num_alt; x++) { device_printf(dev, "Record[%u]: %d Hz, %d ch, %s format, " "2x%dms buffer.\n", i, @@ -1310,7 +1331,7 @@ uaudio_configure_msg_sub(struct uaudio_softc *sc, uint32_t frames; uint32_t buf_size; uint16_t fps; - uint8_t set_alt; + uint8_t next_alt; uint8_t fps_shift; uint8_t operation; usb_error_t err; @@ -1322,22 +1343,51 @@ uaudio_configure_msg_sub(struct uaudio_softc *sc, usb_proc_explore_lock(sc->sc_udev); operation = chan->operation; - chan->operation = CHAN_OP_NONE; + switch (operation) { + case CHAN_OP_START: + case CHAN_OP_STOP: + chan->operation = CHAN_OP_NONE; + break; + default: + break; + } usb_proc_explore_unlock(sc->sc_udev); - mtx_lock(chan->pcm_mtx); - if (chan->cur_alt != chan->set_alt) - set_alt = chan->set_alt; - else - set_alt = CHAN_MAX_ALT; - mtx_unlock(chan->pcm_mtx); + switch (operation) { + case CHAN_OP_STOP: + /* Unsetup prior USB transfers, if any. */ + usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); - if (set_alt >= chan->num_alt) - goto done; + mtx_lock(chan->pcm_mtx); + chan->cur_alt = CHAN_MAX_ALT; + mtx_unlock(chan->pcm_mtx); - chan_alt = chan->usb_alt + set_alt; + /* + * The first alternate setting is typically used for + * power saving mode. Set this alternate setting as + * part of entering stop. + */ + err = usbd_set_alt_interface_index(sc->sc_udev, chan->iface_index, 0); + if (err) { + DPRINTF("setting of default alternate index failed: %s!\n", + usbd_errstr(err)); + } + return; - usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); + case CHAN_OP_START: + /* Unsetup prior USB transfers, if any. */ + usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); + break; + + default: + return; + } + + mtx_lock(chan->pcm_mtx); + next_alt = chan->set_alt; + mtx_unlock(chan->pcm_mtx); + + chan_alt = chan->usb_alt + next_alt; err = usbd_set_alt_interface_index(sc->sc_udev, chan_alt->iface_index, chan_alt->iface_alt_index); @@ -1441,32 +1491,16 @@ uaudio_configure_msg_sub(struct uaudio_softc *sc, goto error; } - mtx_lock(chan->pcm_mtx); - chan->cur_alt = set_alt; - mtx_unlock(chan->pcm_mtx); - -done: #if (UAUDIO_NCHANBUFS != 2) -#error "please update code" +#error "Please update code below!" #endif - switch (operation) { - case CHAN_OP_START: - mtx_lock(chan->pcm_mtx); - usbd_transfer_start(chan->xfer[0]); - usbd_transfer_start(chan->xfer[1]); - mtx_unlock(chan->pcm_mtx); - break; - case CHAN_OP_STOP: - mtx_lock(chan->pcm_mtx); - usbd_transfer_stop(chan->xfer[0]); - usbd_transfer_stop(chan->xfer[1]); - mtx_unlock(chan->pcm_mtx); - break; - default: - break; - } - return; + mtx_lock(chan->pcm_mtx); + chan->cur_alt = next_alt; + usbd_transfer_start(chan->xfer[0]); + usbd_transfer_start(chan->xfer[1]); + mtx_unlock(chan->pcm_mtx); + return; error: usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); @@ -2758,27 +2792,24 @@ uaudio_chan_set_param_format(struct uaudio_chan *ch, uint32_t format) } static void -uaudio_chan_start_sub(struct uaudio_chan *ch) +uaudio_chan_reconfigure(struct uaudio_chan *ch, uint8_t operation) { struct uaudio_softc *sc = ch->priv_sc; - int do_start = 0; - - if (ch->operation != CHAN_OP_DRAIN) { - if (ch->cur_alt == ch->set_alt && - ch->operation == CHAN_OP_NONE && - mtx_owned(ch->pcm_mtx) != 0) { - /* save doing the explore task */ - do_start = 1; - } else { - ch->operation = CHAN_OP_START; - (void)usb_proc_explore_msignal(sc->sc_udev, - &sc->sc_config_msg[0], &sc->sc_config_msg[1]); - } - } - if (do_start) { - usbd_transfer_start(ch->xfer[0]); - usbd_transfer_start(ch->xfer[1]); - } + + /* Check for shutdown. */ + if (ch->operation == CHAN_OP_DRAIN) + return; + + /* Set next operation. */ + ch->operation = operation; + + /* + * Because changing the alternate setting modifies the USB + * configuration, this part must be executed from the USB + * explore process. + */ + (void)usb_proc_explore_msignal(sc->sc_udev, + &sc->sc_config_msg[0], &sc->sc_config_msg[1]); } static int @@ -2831,10 +2862,10 @@ uaudio_chan_start(struct uaudio_chan *ch) * Start both endpoints because of need for * jitter information: */ - uaudio_chan_start_sub(&sc->sc_rec_chan[i]); - uaudio_chan_start_sub(&sc->sc_play_chan[i]); + uaudio_chan_reconfigure(&sc->sc_rec_chan[i], CHAN_OP_START); + uaudio_chan_reconfigure(&sc->sc_play_chan[i], CHAN_OP_START); } else { - uaudio_chan_start_sub(ch); + uaudio_chan_reconfigure(ch, CHAN_OP_START); } } @@ -2842,30 +2873,6 @@ uaudio_chan_start(struct uaudio_chan *ch) usb_proc_explore_unlock(sc->sc_udev); } -static void -uaudio_chan_stop_sub(struct uaudio_chan *ch) -{ - struct uaudio_softc *sc = ch->priv_sc; - int do_stop = 0; - - if (ch->operation != CHAN_OP_DRAIN) { - if (ch->cur_alt == ch->set_alt && - ch->operation == CHAN_OP_NONE && - mtx_owned(ch->pcm_mtx) != 0) { - /* save doing the explore task */ - do_stop = 1; - } else { - ch->operation = CHAN_OP_STOP; - (void)usb_proc_explore_msignal(sc->sc_udev, - &sc->sc_config_msg[0], &sc->sc_config_msg[1]); - } - } - if (do_stop) { - usbd_transfer_stop(ch->xfer[0]); - usbd_transfer_stop(ch->xfer[1]); - } -} - void uaudio_chan_stop(struct uaudio_chan *ch) { @@ -2894,10 +2901,10 @@ uaudio_chan_stop(struct uaudio_chan *ch) * Stop both endpoints in case the one was used for * jitter information: */ - uaudio_chan_stop_sub(&sc->sc_rec_chan[i]); - uaudio_chan_stop_sub(&sc->sc_play_chan[i]); + uaudio_chan_reconfigure(&sc->sc_rec_chan[i], CHAN_OP_STOP); + uaudio_chan_reconfigure(&sc->sc_play_chan[i], CHAN_OP_STOP); } else { - uaudio_chan_stop_sub(ch); + uaudio_chan_reconfigure(ch, CHAN_OP_STOP); } } @@ -6001,9 +6008,11 @@ umidi_probe(device_t dev) if (usb_test_quirk(uaa, UQ_SINGLE_CMD_MIDI)) chan->single_command = 1; - if (usbd_set_alt_interface_index(sc->sc_udev, chan->iface_index, - chan->iface_alt_index)) { - DPRINTF("setting of alternate index failed!\n"); + error = usbd_set_alt_interface_index(sc->sc_udev, + chan->iface_index, chan->iface_alt_index); + if (error) { + DPRINTF("setting of alternate index failed: %s\n", + usbd_errstr(error)); goto detach; } usbd_set_parent_iface(sc->sc_udev, chan->iface_index, From owner-dev-commits-src-branches@freebsd.org Thu Apr 1 09:19: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 EC4185C5476; Thu, 1 Apr 2021 09:19: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 4F9yM36MzVz3FX9; Thu, 1 Apr 2021 09:19: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 CD95D1F55; Thu, 1 Apr 2021 09:19: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 1319JxHv042817; Thu, 1 Apr 2021 09:19:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1319Jx9x042816; Thu, 1 Apr 2021 09:19:59 GMT (envelope-from git) Date: Thu, 1 Apr 2021 09:19:59 GMT Message-Id: <202104010919.1319Jx9x042816@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: ba535b10228f - stable/11 - MFC 31070b5bc77a: Set default alternate setting when USB audio devices are not in use, to activate power save features. 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: ba535b10228f0af8021f64890e25f44c446a6cd9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 01 Apr 2021 09:20:00 -0000 The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=ba535b10228f0af8021f64890e25f44c446a6cd9 commit ba535b10228f0af8021f64890e25f44c446a6cd9 Author: Hans Petter Selasky AuthorDate: 2021-03-09 16:41:18 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-01 09:18:15 +0000 MFC 31070b5bc77a: Set default alternate setting when USB audio devices are not in use, to activate power save features. Differential Revision: https://reviews.freebsd.org/D28032 Suggested by: Shichun_Ma@Dell.com Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 31070b5bc77a499009a835650eb9d4bf2eceaa15) --- sys/dev/sound/usb/uaudio.c | 199 +++++++++++++++++++++++---------------------- 1 file changed, 104 insertions(+), 95 deletions(-) diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index 2ccdaac63196..cd6037faaa0d 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -944,6 +944,27 @@ uaudio_set_spdif_dummy(struct uaudio_softc *sc, int flags) return (0); } +static usb_error_t +uaudio_force_power_save(struct uaudio_softc *sc, uint8_t iface_index) +{ + struct usb_interface *iface; + usb_error_t err; + + iface = usbd_get_iface(sc->sc_udev, iface_index); + if (iface == NULL || iface->idesc == NULL) + return (USB_ERR_INVAL); + + /* check if correct alternate setting is already selected */ + if (iface->alt_index == 0) { + /* force power save mode by selecting default alternate setting */ + err = usbd_req_set_alt_interface_no(sc->sc_udev, NULL, iface_index, + iface->idesc->bAlternateSetting); + } else { + err = usbd_set_alt_interface_index(sc->sc_udev, iface_index, 0); + } + return (err); +} + static int uaudio_attach(device_t dev) { @@ -1018,16 +1039,16 @@ uaudio_attach(device_t dev) /* * Need to set a default alternate interface, else - * some USB audio devices might go into an infinte + * some USB audio devices might go into an infinite * re-enumeration loop: */ - err = usbd_set_alt_interface_index(sc->sc_udev, - sc->sc_play_chan[i].usb_alt[0].iface_index, - sc->sc_play_chan[i].usb_alt[0].iface_alt_index); + err = uaudio_force_power_save(sc, + sc->sc_play_chan[i].usb_alt[0].iface_index); if (err) { DPRINTF("setting of alternate index failed: %s!\n", usbd_errstr(err)); } + for (x = 0; x != sc->sc_play_chan[i].num_alt; x++) { device_printf(dev, "Play[%u]: %d Hz, %d ch, %s format, " "2x%dms buffer.\n", i, @@ -1048,16 +1069,16 @@ uaudio_attach(device_t dev) /* * Need to set a default alternate interface, else - * some USB audio devices might go into an infinte + * some USB audio devices might go into an infinite * re-enumeration loop: */ - err = usbd_set_alt_interface_index(sc->sc_udev, - sc->sc_rec_chan[i].usb_alt[0].iface_index, - sc->sc_rec_chan[i].usb_alt[0].iface_alt_index); + err = uaudio_force_power_save(sc, + sc->sc_rec_chan[i].usb_alt[0].iface_index); if (err) { DPRINTF("setting of alternate index failed: %s!\n", usbd_errstr(err)); } + for (x = 0; x != sc->sc_rec_chan[i].num_alt; x++) { device_printf(dev, "Record[%u]: %d Hz, %d ch, %s format, " "2x%dms buffer.\n", i, @@ -1308,7 +1329,7 @@ uaudio_configure_msg_sub(struct uaudio_softc *sc, uint32_t frames; uint32_t buf_size; uint16_t fps; - uint8_t set_alt; + uint8_t next_alt; uint8_t fps_shift; uint8_t operation; usb_error_t err; @@ -1320,22 +1341,51 @@ uaudio_configure_msg_sub(struct uaudio_softc *sc, usb_proc_explore_lock(sc->sc_udev); operation = chan->operation; - chan->operation = CHAN_OP_NONE; + switch (operation) { + case CHAN_OP_START: + case CHAN_OP_STOP: + chan->operation = CHAN_OP_NONE; + break; + default: + break; + } usb_proc_explore_unlock(sc->sc_udev); - mtx_lock(chan->pcm_mtx); - if (chan->cur_alt != chan->set_alt) - set_alt = chan->set_alt; - else - set_alt = CHAN_MAX_ALT; - mtx_unlock(chan->pcm_mtx); + switch (operation) { + case CHAN_OP_STOP: + /* Unsetup prior USB transfers, if any. */ + usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); - if (set_alt >= chan->num_alt) - goto done; + mtx_lock(chan->pcm_mtx); + chan->cur_alt = CHAN_MAX_ALT; + mtx_unlock(chan->pcm_mtx); - chan_alt = chan->usb_alt + set_alt; + /* + * The first alternate setting is typically used for + * power saving mode. Set this alternate setting as + * part of entering stop. + */ + err = usbd_set_alt_interface_index(sc->sc_udev, chan->iface_index, 0); + if (err) { + DPRINTF("setting of default alternate index failed: %s!\n", + usbd_errstr(err)); + } + return; - usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); + case CHAN_OP_START: + /* Unsetup prior USB transfers, if any. */ + usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); + break; + + default: + return; + } + + mtx_lock(chan->pcm_mtx); + next_alt = chan->set_alt; + mtx_unlock(chan->pcm_mtx); + + chan_alt = chan->usb_alt + next_alt; err = usbd_set_alt_interface_index(sc->sc_udev, chan_alt->iface_index, chan_alt->iface_alt_index); @@ -1439,32 +1489,16 @@ uaudio_configure_msg_sub(struct uaudio_softc *sc, goto error; } - mtx_lock(chan->pcm_mtx); - chan->cur_alt = set_alt; - mtx_unlock(chan->pcm_mtx); - -done: #if (UAUDIO_NCHANBUFS != 2) -#error "please update code" +#error "Please update code below!" #endif - switch (operation) { - case CHAN_OP_START: - mtx_lock(chan->pcm_mtx); - usbd_transfer_start(chan->xfer[0]); - usbd_transfer_start(chan->xfer[1]); - mtx_unlock(chan->pcm_mtx); - break; - case CHAN_OP_STOP: - mtx_lock(chan->pcm_mtx); - usbd_transfer_stop(chan->xfer[0]); - usbd_transfer_stop(chan->xfer[1]); - mtx_unlock(chan->pcm_mtx); - break; - default: - break; - } - return; + mtx_lock(chan->pcm_mtx); + chan->cur_alt = next_alt; + usbd_transfer_start(chan->xfer[0]); + usbd_transfer_start(chan->xfer[1]); + mtx_unlock(chan->pcm_mtx); + return; error: usbd_transfer_unsetup(chan->xfer, UAUDIO_NCHANBUFS + 1); @@ -2756,27 +2790,24 @@ uaudio_chan_set_param_format(struct uaudio_chan *ch, uint32_t format) } static void -uaudio_chan_start_sub(struct uaudio_chan *ch) +uaudio_chan_reconfigure(struct uaudio_chan *ch, uint8_t operation) { struct uaudio_softc *sc = ch->priv_sc; - int do_start = 0; - - if (ch->operation != CHAN_OP_DRAIN) { - if (ch->cur_alt == ch->set_alt && - ch->operation == CHAN_OP_NONE && - mtx_owned(ch->pcm_mtx) != 0) { - /* save doing the explore task */ - do_start = 1; - } else { - ch->operation = CHAN_OP_START; - (void)usb_proc_explore_msignal(sc->sc_udev, - &sc->sc_config_msg[0], &sc->sc_config_msg[1]); - } - } - if (do_start) { - usbd_transfer_start(ch->xfer[0]); - usbd_transfer_start(ch->xfer[1]); - } + + /* Check for shutdown. */ + if (ch->operation == CHAN_OP_DRAIN) + return; + + /* Set next operation. */ + ch->operation = operation; + + /* + * Because changing the alternate setting modifies the USB + * configuration, this part must be executed from the USB + * explore process. + */ + (void)usb_proc_explore_msignal(sc->sc_udev, + &sc->sc_config_msg[0], &sc->sc_config_msg[1]); } static int @@ -2829,10 +2860,10 @@ uaudio_chan_start(struct uaudio_chan *ch) * Start both endpoints because of need for * jitter information: */ - uaudio_chan_start_sub(&sc->sc_rec_chan[i]); - uaudio_chan_start_sub(&sc->sc_play_chan[i]); + uaudio_chan_reconfigure(&sc->sc_rec_chan[i], CHAN_OP_START); + uaudio_chan_reconfigure(&sc->sc_play_chan[i], CHAN_OP_START); } else { - uaudio_chan_start_sub(ch); + uaudio_chan_reconfigure(ch, CHAN_OP_START); } } @@ -2840,30 +2871,6 @@ uaudio_chan_start(struct uaudio_chan *ch) usb_proc_explore_unlock(sc->sc_udev); } -static void -uaudio_chan_stop_sub(struct uaudio_chan *ch) -{ - struct uaudio_softc *sc = ch->priv_sc; - int do_stop = 0; - - if (ch->operation != CHAN_OP_DRAIN) { - if (ch->cur_alt == ch->set_alt && - ch->operation == CHAN_OP_NONE && - mtx_owned(ch->pcm_mtx) != 0) { - /* save doing the explore task */ - do_stop = 1; - } else { - ch->operation = CHAN_OP_STOP; - (void)usb_proc_explore_msignal(sc->sc_udev, - &sc->sc_config_msg[0], &sc->sc_config_msg[1]); - } - } - if (do_stop) { - usbd_transfer_stop(ch->xfer[0]); - usbd_transfer_stop(ch->xfer[1]); - } -} - void uaudio_chan_stop(struct uaudio_chan *ch) { @@ -2892,10 +2899,10 @@ uaudio_chan_stop(struct uaudio_chan *ch) * Stop both endpoints in case the one was used for * jitter information: */ - uaudio_chan_stop_sub(&sc->sc_rec_chan[i]); - uaudio_chan_stop_sub(&sc->sc_play_chan[i]); + uaudio_chan_reconfigure(&sc->sc_rec_chan[i], CHAN_OP_STOP); + uaudio_chan_reconfigure(&sc->sc_play_chan[i], CHAN_OP_STOP); } else { - uaudio_chan_stop_sub(ch); + uaudio_chan_reconfigure(ch, CHAN_OP_STOP); } } @@ -5999,9 +6006,11 @@ umidi_probe(device_t dev) if (usb_test_quirk(uaa, UQ_SINGLE_CMD_MIDI)) chan->single_command = 1; - if (usbd_set_alt_interface_index(sc->sc_udev, chan->iface_index, - chan->iface_alt_index)) { - DPRINTF("setting of alternate index failed!\n"); + error = usbd_set_alt_interface_index(sc->sc_udev, + chan->iface_index, chan->iface_alt_index); + if (error) { + DPRINTF("setting of alternate index failed: %s\n", + usbd_errstr(error)); goto detach; } usbd_set_parent_iface(sc->sc_udev, chan->iface_index, From owner-dev-commits-src-branches@freebsd.org Thu Apr 1 09:21: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 370595C5D11; Thu, 1 Apr 2021 09:21: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 4F9yP16Nnjz3FnW; Thu, 1 Apr 2021 09:21: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 A95FA2584; Thu, 1 Apr 2021 09:21: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 1319Lcf4053025; Thu, 1 Apr 2021 09:21:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1319LcpR053024; Thu, 1 Apr 2021 09:21:38 GMT (envelope-from git) Date: Thu, 1 Apr 2021 09:21:38 GMT Message-Id: <202104010921.1319LcpR053024@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: eb008a6793db - stable/13 - MFC 4e38478c595a: ipoib: Fix incorrectly computed IPOIB_CM_RX_SG value. 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: eb008a6793dbbda39ad0a2fb3136eb542d7424e2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 01 Apr 2021 09:21:44 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=eb008a6793dbbda39ad0a2fb3136eb542d7424e2 commit eb008a6793dbbda39ad0a2fb3136eb542d7424e2 Author: Hans Petter Selasky AuthorDate: 2021-03-25 15:55:02 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-01 09:19:42 +0000 MFC 4e38478c595a: ipoib: Fix incorrectly computed IPOIB_CM_RX_SG value. The computed IPOIB_CM_RX_SG is too small. It doesn't account for fallback to mbuf clusters when jumbo frames are not available and it also doesn't account for the packet header and trailer mbuf. This causes a memory overwrite situation when IPOIB_CM is configured. While at it add a kernel assert to ensure the mapping array is not overwritten. PR: 254474 Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 4e38478c595a9e6225b525890d7ee269a203c200) --- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h | 7 +++---- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c | 2 +- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c | 7 ++++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h index 8a2b3333abb5..eb1cb87dc888 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h @@ -117,12 +117,11 @@ enum { IPOIB_ENCAP_LEN = 4, IPOIB_HEADER_LEN = IPOIB_ENCAP_LEN + INFINIBAND_ALEN, IPOIB_UD_MAX_MTU = 4 * 1024, -// IPOIB_UD_RX_SG = (IPOIB_UD_MAX_MTU / MJUMPAGESIZE), - IPOIB_UD_RX_SG = 2, + IPOIB_UD_RX_SG = 2, /* packet header and one cluster */ IPOIB_UD_TX_SG = (IPOIB_UD_MAX_MTU / MCLBYTES) + 2, IPOIB_CM_MAX_MTU = (64 * 1024), IPOIB_CM_TX_SG = (IPOIB_CM_MAX_MTU / MCLBYTES) + 2, - IPOIB_CM_RX_SG = (IPOIB_CM_MAX_MTU / MJUMPAGESIZE), + IPOIB_CM_RX_SG = (IPOIB_CM_MAX_MTU / MCLBYTES) + 2, IPOIB_RX_RING_SIZE = 256, IPOIB_TX_RING_SIZE = 128, IPOIB_MAX_RX_SG = MAX(IPOIB_CM_RX_SG, IPOIB_UD_RX_SG), @@ -529,7 +528,7 @@ int ipoib_poll_tx(struct ipoib_dev_priv *priv, bool do_start); void ipoib_dma_unmap_rx(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req); void ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int length); -struct mbuf *ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, int align, int size); +struct mbuf *ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, int align, int size, int max_frags); void ipoib_set_ethtool_ops(struct ifnet *dev); diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 50c9a4f305e9..b61ebfd1495a 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c @@ -153,7 +153,7 @@ static struct mbuf * ipoib_cm_alloc_rx_mb(struct ipoib_dev_priv *priv, struct ipoib_cm_rx_buf *rx_req) { return ipoib_alloc_map_mb(priv, (struct ipoib_rx_buf *)rx_req, - sizeof(struct ipoib_pseudoheader), priv->cm.max_cm_mtu); + sizeof(struct ipoib_pseudoheader), priv->cm.max_cm_mtu, IPOIB_CM_RX_SG); } static void ipoib_cm_free_rx_ring(struct ipoib_dev_priv *priv, diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c index cb52e3db75a4..a5db9a256204 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c @@ -112,7 +112,7 @@ ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int length) struct mbuf * ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, - int align, int size) + int align, int size, int max_frags) { struct mbuf *mb, *m; int i, j; @@ -122,6 +122,8 @@ ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, if (mb == NULL) return (NULL); for (i = 0, m = mb; m != NULL; m = m->m_next, i++) { + MPASS(i < max_frags); + m->m_len = M_SIZE(m) - align; m->m_data += align; align = 0; @@ -174,9 +176,8 @@ static int ipoib_ib_post_receive(struct ipoib_dev_priv *priv, int id) static struct mbuf * ipoib_alloc_rx_mb(struct ipoib_dev_priv *priv, int id) { - return ipoib_alloc_map_mb(priv, &priv->rx_ring[id], - 0, priv->max_ib_mtu + IB_GRH_BYTES); + 0, priv->max_ib_mtu + IB_GRH_BYTES, IPOIB_UD_RX_SG); } static int ipoib_ib_post_receives(struct ipoib_dev_priv *priv) From owner-dev-commits-src-branches@freebsd.org Thu Apr 1 09:22: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 713A05C5F00; Thu, 1 Apr 2021 09:22: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 4F9yQB2kHqz3GMM; Thu, 1 Apr 2021 09:22: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 5051A1F7F; Thu, 1 Apr 2021 09:22: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 1319MgqD055673; Thu, 1 Apr 2021 09:22:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1319MgGD055672; Thu, 1 Apr 2021 09:22:42 GMT (envelope-from git) Date: Thu, 1 Apr 2021 09:22:42 GMT Message-Id: <202104010922.1319MgGD055672@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: 4316db31c2c8 - stable/12 - MFC 4e38478c595a: ipoib: Fix incorrectly computed IPOIB_CM_RX_SG value. 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: 4316db31c2c861c60ba39af35f5a781ce7db95da Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 01 Apr 2021 09:22:42 -0000 The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=4316db31c2c861c60ba39af35f5a781ce7db95da commit 4316db31c2c861c60ba39af35f5a781ce7db95da Author: Hans Petter Selasky AuthorDate: 2021-03-25 15:55:02 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-01 09:20:44 +0000 MFC 4e38478c595a: ipoib: Fix incorrectly computed IPOIB_CM_RX_SG value. The computed IPOIB_CM_RX_SG is too small. It doesn't account for fallback to mbuf clusters when jumbo frames are not available and it also doesn't account for the packet header and trailer mbuf. This causes a memory overwrite situation when IPOIB_CM is configured. While at it add a kernel assert to ensure the mapping array is not overwritten. PR: 254474 Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 4e38478c595a9e6225b525890d7ee269a203c200) --- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h | 7 +++---- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c | 2 +- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c | 7 ++++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h index 8a2b3333abb5..eb1cb87dc888 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h @@ -117,12 +117,11 @@ enum { IPOIB_ENCAP_LEN = 4, IPOIB_HEADER_LEN = IPOIB_ENCAP_LEN + INFINIBAND_ALEN, IPOIB_UD_MAX_MTU = 4 * 1024, -// IPOIB_UD_RX_SG = (IPOIB_UD_MAX_MTU / MJUMPAGESIZE), - IPOIB_UD_RX_SG = 2, + IPOIB_UD_RX_SG = 2, /* packet header and one cluster */ IPOIB_UD_TX_SG = (IPOIB_UD_MAX_MTU / MCLBYTES) + 2, IPOIB_CM_MAX_MTU = (64 * 1024), IPOIB_CM_TX_SG = (IPOIB_CM_MAX_MTU / MCLBYTES) + 2, - IPOIB_CM_RX_SG = (IPOIB_CM_MAX_MTU / MJUMPAGESIZE), + IPOIB_CM_RX_SG = (IPOIB_CM_MAX_MTU / MCLBYTES) + 2, IPOIB_RX_RING_SIZE = 256, IPOIB_TX_RING_SIZE = 128, IPOIB_MAX_RX_SG = MAX(IPOIB_CM_RX_SG, IPOIB_UD_RX_SG), @@ -529,7 +528,7 @@ int ipoib_poll_tx(struct ipoib_dev_priv *priv, bool do_start); void ipoib_dma_unmap_rx(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req); void ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int length); -struct mbuf *ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, int align, int size); +struct mbuf *ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, int align, int size, int max_frags); void ipoib_set_ethtool_ops(struct ifnet *dev); diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c index f9e0ada7275c..0e3198cc072c 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c @@ -153,7 +153,7 @@ static struct mbuf * ipoib_cm_alloc_rx_mb(struct ipoib_dev_priv *priv, struct ipoib_cm_rx_buf *rx_req) { return ipoib_alloc_map_mb(priv, (struct ipoib_rx_buf *)rx_req, - sizeof(struct ipoib_pseudoheader), priv->cm.max_cm_mtu); + sizeof(struct ipoib_pseudoheader), priv->cm.max_cm_mtu, IPOIB_CM_RX_SG); } static void ipoib_cm_free_rx_ring(struct ipoib_dev_priv *priv, diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c index cb52e3db75a4..a5db9a256204 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c @@ -112,7 +112,7 @@ ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int length) struct mbuf * ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, - int align, int size) + int align, int size, int max_frags) { struct mbuf *mb, *m; int i, j; @@ -122,6 +122,8 @@ ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, if (mb == NULL) return (NULL); for (i = 0, m = mb; m != NULL; m = m->m_next, i++) { + MPASS(i < max_frags); + m->m_len = M_SIZE(m) - align; m->m_data += align; align = 0; @@ -174,9 +176,8 @@ static int ipoib_ib_post_receive(struct ipoib_dev_priv *priv, int id) static struct mbuf * ipoib_alloc_rx_mb(struct ipoib_dev_priv *priv, int id) { - return ipoib_alloc_map_mb(priv, &priv->rx_ring[id], - 0, priv->max_ib_mtu + IB_GRH_BYTES); + 0, priv->max_ib_mtu + IB_GRH_BYTES, IPOIB_UD_RX_SG); } static int ipoib_ib_post_receives(struct ipoib_dev_priv *priv) From owner-dev-commits-src-branches@freebsd.org Thu Apr 1 09:28: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 120B05C5F59; Thu, 1 Apr 2021 09:28:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9yXk01nXz3GXF; Thu, 1 Apr 2021 09:28: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 E7BE62608; Thu, 1 Apr 2021 09:28: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 1319SL3C056631; Thu, 1 Apr 2021 09:28:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1319SLuZ056630; Thu, 1 Apr 2021 09:28:21 GMT (envelope-from git) Date: Thu, 1 Apr 2021 09:28:21 GMT Message-Id: <202104010928.1319SLuZ056630@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: 9d03dfae43d2 - stable/11 - MFC 4e38478c595a: ipoib: Fix incorrectly computed IPOIB_CM_RX_SG value. 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: 9d03dfae43d2a1a91c846db38223bc33516d1130 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 01 Apr 2021 09:28:22 -0000 The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=9d03dfae43d2a1a91c846db38223bc33516d1130 commit 9d03dfae43d2a1a91c846db38223bc33516d1130 Author: Hans Petter Selasky AuthorDate: 2021-03-25 15:55:02 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-01 09:25:55 +0000 MFC 4e38478c595a: ipoib: Fix incorrectly computed IPOIB_CM_RX_SG value. The computed IPOIB_CM_RX_SG is too small. It doesn't account for fallback to mbuf clusters when jumbo frames are not available and it also doesn't account for the packet header and trailer mbuf. This causes a memory overwrite situation when IPOIB_CM is configured. While at it add a kernel assert to ensure the mapping array is not overwritten. PR: 254474 Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 4e38478c595a9e6225b525890d7ee269a203c200) --- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h | 7 +++---- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c | 2 +- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c | 7 ++++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h index c458eebd8f50..7c012bdcdb2c 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h @@ -115,12 +115,11 @@ enum { IPOIB_ENCAP_LEN = 4, IPOIB_HEADER_LEN = IPOIB_ENCAP_LEN + INFINIBAND_ALEN, IPOIB_UD_MAX_MTU = 4 * 1024, -// IPOIB_UD_RX_SG = (IPOIB_UD_MAX_MTU / MJUMPAGESIZE), - IPOIB_UD_RX_SG = 2, + IPOIB_UD_RX_SG = 2, /* packet header and one cluster */ IPOIB_UD_TX_SG = (IPOIB_UD_MAX_MTU / MCLBYTES) + 2, IPOIB_CM_MAX_MTU = (64 * 1024), IPOIB_CM_TX_SG = (IPOIB_CM_MAX_MTU / MCLBYTES) + 2, - IPOIB_CM_RX_SG = (IPOIB_CM_MAX_MTU / MJUMPAGESIZE), + IPOIB_CM_RX_SG = (IPOIB_CM_MAX_MTU / MCLBYTES) + 2, IPOIB_RX_RING_SIZE = 256, IPOIB_TX_RING_SIZE = 128, IPOIB_MAX_RX_SG = MAX(IPOIB_CM_RX_SG, IPOIB_UD_RX_SG), @@ -538,7 +537,7 @@ int ipoib_poll_tx(struct ipoib_dev_priv *priv, bool do_start); void ipoib_dma_unmap_rx(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req); void ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int length); -struct mbuf *ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, int size); +struct mbuf *ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, int size, int max_frags); void ipoib_set_ethtool_ops(struct ifnet *dev); diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 5e6dea75f0ae..9bc584cbfe94 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c @@ -151,7 +151,7 @@ static struct mbuf * ipoib_cm_alloc_rx_mb(struct ipoib_dev_priv *priv, struct ipoib_cm_rx_buf *rx_req) { return ipoib_alloc_map_mb(priv, (struct ipoib_rx_buf *)rx_req, - priv->cm.max_cm_mtu); + priv->cm.max_cm_mtu, IPOIB_CM_RX_SG); } static void ipoib_cm_free_rx_ring(struct ipoib_dev_priv *priv, diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c index a144681ea0d8..5f5a7323b7e8 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c @@ -110,7 +110,7 @@ ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int length) struct mbuf * ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, - int size) + int size, int max_frags) { struct mbuf *mb, *m; int i, j; @@ -120,6 +120,8 @@ ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, if (mb == NULL) return (NULL); for (i = 0, m = mb; m != NULL; m = m->m_next, i++) { + MPASS(i < max_frags); + m->m_len = M_SIZE(m); mb->m_pkthdr.len += m->m_len; rx_req->mapping[i] = ib_dma_map_single(priv->ca, @@ -170,9 +172,8 @@ static int ipoib_ib_post_receive(struct ipoib_dev_priv *priv, int id) static struct mbuf * ipoib_alloc_rx_mb(struct ipoib_dev_priv *priv, int id) { - return ipoib_alloc_map_mb(priv, &priv->rx_ring[id], - priv->max_ib_mtu + IB_GRH_BYTES); + priv->max_ib_mtu + IB_GRH_BYTES, IPOIB_UD_RX_SG); } static int ipoib_ib_post_receives(struct ipoib_dev_priv *priv) From owner-dev-commits-src-branches@freebsd.org Thu Apr 1 09:50: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 D75BB5C698F; Thu, 1 Apr 2021 09:50: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 4F9z1h5lvbz3Hqp; Thu, 1 Apr 2021 09:50: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 B84C22A02; Thu, 1 Apr 2021 09:50: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 1319o07Z085642; Thu, 1 Apr 2021 09:50:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1319o0Kv085625; Thu, 1 Apr 2021 09:50:00 GMT (envelope-from git) Date: Thu, 1 Apr 2021 09:50:00 GMT Message-Id: <202104010950.1319o0Kv085625@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: ca32a11644b1 - stable/10 - MFC 4e38478c595a: ipoib: Fix incorrectly computed IPOIB_CM_RX_SG value. 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: ca32a11644b182ae9176631cdff1f4dcd7e49b32 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 01 Apr 2021 09:50:00 -0000 The branch stable/10 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=ca32a11644b182ae9176631cdff1f4dcd7e49b32 commit ca32a11644b182ae9176631cdff1f4dcd7e49b32 Author: Hans Petter Selasky AuthorDate: 2021-03-25 15:55:02 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-01 09:34:24 +0000 MFC 4e38478c595a: ipoib: Fix incorrectly computed IPOIB_CM_RX_SG value. The computed IPOIB_CM_RX_SG is too small. It doesn't account for fallback to mbuf clusters when jumbo frames are not available and it also doesn't account for the packet header and trailer mbuf. This causes a memory overwrite situation when IPOIB_CM is configured. While at it add a kernel assert to ensure the mapping array is not overwritten. PR: 254474 Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 4e38478c595a9e6225b525890d7ee269a203c200) --- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h | 7 +++---- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c | 2 +- sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c | 7 ++++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h index 3ddd19aba2f8..10a63593a937 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h @@ -111,12 +111,11 @@ enum { IPOIB_ENCAP_LEN = 4, IPOIB_HEADER_LEN = IPOIB_ENCAP_LEN + INFINIBAND_ALEN, IPOIB_UD_MAX_MTU = 4 * 1024, -// IPOIB_UD_RX_SG = (IPOIB_UD_MAX_MTU / MJUMPAGESIZE), - IPOIB_UD_RX_SG = 2, + IPOIB_UD_RX_SG = 2, /* packet header and one cluster */ IPOIB_UD_TX_SG = (IPOIB_UD_MAX_MTU / MCLBYTES) + 2, IPOIB_CM_MAX_MTU = (64 * 1024), IPOIB_CM_TX_SG = (IPOIB_CM_MAX_MTU / MCLBYTES) + 2, - IPOIB_CM_RX_SG = (IPOIB_CM_MAX_MTU / MJUMPAGESIZE), + IPOIB_CM_RX_SG = (IPOIB_CM_MAX_MTU / MCLBYTES) + 2, IPOIB_RX_RING_SIZE = 256, IPOIB_TX_RING_SIZE = 128, IPOIB_MAX_RX_SG = MAX(IPOIB_CM_RX_SG, IPOIB_UD_RX_SG), @@ -533,7 +532,7 @@ int ipoib_poll_tx(struct ipoib_dev_priv *priv); void ipoib_dma_unmap_rx(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req); void ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int length); -struct mbuf *ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, int size); +struct mbuf *ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, int size, int max_frags); void ipoib_set_ethtool_ops(struct ifnet *dev); diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 03f903723d6f..bdd7ace6e5d6 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c @@ -148,7 +148,7 @@ static struct mbuf * ipoib_cm_alloc_rx_mb(struct ipoib_dev_priv *priv, struct ipoib_cm_rx_buf *rx_req) { return ipoib_alloc_map_mb(priv, (struct ipoib_rx_buf *)rx_req, - priv->cm.max_cm_mtu); + priv->cm.max_cm_mtu, IPOIB_CM_RX_SG); } static void ipoib_cm_free_rx_ring(struct ipoib_dev_priv *priv, diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 339e30500786..d4ea61a3aba5 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c @@ -107,7 +107,7 @@ ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int length) struct mbuf * ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, - int size) + int size, int max_frags) { struct mbuf *mb, *m; int i, j; @@ -117,6 +117,8 @@ ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, if (mb == NULL) return (NULL); for (i = 0, m = mb; m != NULL; m = m->m_next, i++) { + MPASS(i < max_frags); + m->m_len = (m->m_flags & M_EXT) ? m->m_ext.ext_size : ((m->m_flags & M_PKTHDR) ? MHLEN : MLEN); mb->m_pkthdr.len += m->m_len; @@ -168,9 +170,8 @@ static int ipoib_ib_post_receive(struct ipoib_dev_priv *priv, int id) static struct mbuf * ipoib_alloc_rx_mb(struct ipoib_dev_priv *priv, int id) { - return ipoib_alloc_map_mb(priv, &priv->rx_ring[id], - priv->max_ib_mtu + IB_GRH_BYTES); + priv->max_ib_mtu + IB_GRH_BYTES, IPOIB_UD_RX_SG); } static int ipoib_ib_post_receives(struct ipoib_dev_priv *priv) From owner-dev-commits-src-branches@freebsd.org Thu Apr 1 13:25: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 A970F5CE2E8; Thu, 1 Apr 2021 13:25: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 4FB3pY4Rn8z3nMC; Thu, 1 Apr 2021 13:25: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 8B8895A56; Thu, 1 Apr 2021 13:25: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 131DPfX9095919; Thu, 1 Apr 2021 13:25:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131DPfXn095918; Thu, 1 Apr 2021 13:25:41 GMT (envelope-from git) Date: Thu, 1 Apr 2021 13:25:41 GMT Message-Id: <202104011325.131DPfXn095918@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: 76af2649b078 - stable/13 - MFC 874b1a35486b570513680c3d456b062ba097e1d9: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 76af2649b078a6c1eb27d492710409c991cfc76f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 01 Apr 2021 13:25:41 -0000 The branch stable/13 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=76af2649b078a6c1eb27d492710409c991cfc76f commit 76af2649b078a6c1eb27d492710409c991cfc76f Author: Cy Schubert AuthorDate: 2021-03-23 03:11:58 +0000 Commit: Cy Schubert CommitDate: 2021-04-01 13:24:19 +0000 MFC 874b1a35486b570513680c3d456b062ba097e1d9: ipfilter: simplify ipf_proxy_check() return codes ipf_proxy_check() returns -1 for an error and 0 or 1 for success. ipf_proxy_check()'s callers check for error and if the return code is 0, they change it to 1 prior to returning to their callers. Simply by returning -1 or 1 we reduce complexity and cycles burned changing 0 to 1. (cherry picked from commit 874b1a35486b570513680c3d456b062ba097e1d9) --- sys/contrib/ipfilter/netinet/ip_nat.c | 4 +--- sys/contrib/ipfilter/netinet/ip_nat6.c | 4 +--- sys/contrib/ipfilter/netinet/ip_proxy.c | 3 +-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/sys/contrib/ipfilter/netinet/ip_nat.c b/sys/contrib/ipfilter/netinet/ip_nat.c index 33d190c61a0a..084c79bbee9a 100644 --- a/sys/contrib/ipfilter/netinet/ip_nat.c +++ b/sys/contrib/ipfilter/netinet/ip_nat.c @@ -5312,9 +5312,7 @@ ipf_nat_out(fin, nat, natadd, nflags) /* ------------------------------------------------------------- */ if ((np != NULL) && (np->in_apr != NULL)) { i = ipf_proxy_check(fin, nat); - if (i == 0) { - i = 1; - } else if (i == -1) { + if (i == -1) { NBUMPSIDED(1, ns_ipf_proxy_fail); } } else { diff --git a/sys/contrib/ipfilter/netinet/ip_nat6.c b/sys/contrib/ipfilter/netinet/ip_nat6.c index 921eefc0ea3f..baa3c302504a 100644 --- a/sys/contrib/ipfilter/netinet/ip_nat6.c +++ b/sys/contrib/ipfilter/netinet/ip_nat6.c @@ -2976,9 +2976,7 @@ ipf_nat6_out(fin, nat, natadd, nflags) /* ------------------------------------------------------------- */ if ((np != NULL) && (np->in_apr != NULL)) { i = ipf_proxy_check(fin, nat); - if (i == 0) { - i = 1; - } else if (i == -1) { + if (i == -1) { NBUMPSIDE6D(1, ns_ipf_proxy_fail); } } else { diff --git a/sys/contrib/ipfilter/netinet/ip_proxy.c b/sys/contrib/ipfilter/netinet/ip_proxy.c index b4773bb6f358..87051b6e6839 100644 --- a/sys/contrib/ipfilter/netinet/ip_proxy.c +++ b/sys/contrib/ipfilter/netinet/ip_proxy.c @@ -1048,9 +1048,8 @@ ipf_proxy_check(fin, nat) } aps->aps_bytes += fin->fin_plen; aps->aps_pkts++; - return 1; } - return 0; + return 1; } From owner-dev-commits-src-branches@freebsd.org Thu Apr 1 13: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 7033A5CE49D; Thu, 1 Apr 2021 13: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 4FB3pg4fZnz3nJs; Thu, 1 Apr 2021 13:25: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 CE3B7527E; Thu, 1 Apr 2021 13:25: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 131DPk4W096034; Thu, 1 Apr 2021 13:25:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131DPkC1096033; Thu, 1 Apr 2021 13:25:46 GMT (envelope-from git) Date: Thu, 1 Apr 2021 13:25:46 GMT Message-Id: <202104011325.131DPkC1096033@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: 671c492e884a - stable/12 - MFC 874b1a35486b570513680c3d456b062ba097e1d9: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 671c492e884ad51d7fed89c14fd5eb48d5a9567d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 01 Apr 2021 13:25:49 -0000 The branch stable/12 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=671c492e884ad51d7fed89c14fd5eb48d5a9567d commit 671c492e884ad51d7fed89c14fd5eb48d5a9567d Author: Cy Schubert AuthorDate: 2021-03-23 03:11:58 +0000 Commit: Cy Schubert CommitDate: 2021-04-01 13:24:11 +0000 MFC 874b1a35486b570513680c3d456b062ba097e1d9: ipfilter: simplify ipf_proxy_check() return codes ipf_proxy_check() returns -1 for an error and 0 or 1 for success. ipf_proxy_check()'s callers check for error and if the return code is 0, they change it to 1 prior to returning to their callers. Simply by returning -1 or 1 we reduce complexity and cycles burned changing 0 to 1. (cherry picked from commit 874b1a35486b570513680c3d456b062ba097e1d9) --- sys/contrib/ipfilter/netinet/ip_nat.c | 4 +--- sys/contrib/ipfilter/netinet/ip_nat6.c | 4 +--- sys/contrib/ipfilter/netinet/ip_proxy.c | 3 +-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/sys/contrib/ipfilter/netinet/ip_nat.c b/sys/contrib/ipfilter/netinet/ip_nat.c index 6fdc006e88f0..bbf78877249c 100644 --- a/sys/contrib/ipfilter/netinet/ip_nat.c +++ b/sys/contrib/ipfilter/netinet/ip_nat.c @@ -5312,9 +5312,7 @@ ipf_nat_out(fin, nat, natadd, nflags) /* ------------------------------------------------------------- */ if ((np != NULL) && (np->in_apr != NULL)) { i = ipf_proxy_check(fin, nat); - if (i == 0) { - i = 1; - } else if (i == -1) { + if (i == -1) { NBUMPSIDED(1, ns_ipf_proxy_fail); } } else { diff --git a/sys/contrib/ipfilter/netinet/ip_nat6.c b/sys/contrib/ipfilter/netinet/ip_nat6.c index 921eefc0ea3f..baa3c302504a 100644 --- a/sys/contrib/ipfilter/netinet/ip_nat6.c +++ b/sys/contrib/ipfilter/netinet/ip_nat6.c @@ -2976,9 +2976,7 @@ ipf_nat6_out(fin, nat, natadd, nflags) /* ------------------------------------------------------------- */ if ((np != NULL) && (np->in_apr != NULL)) { i = ipf_proxy_check(fin, nat); - if (i == 0) { - i = 1; - } else if (i == -1) { + if (i == -1) { NBUMPSIDE6D(1, ns_ipf_proxy_fail); } } else { diff --git a/sys/contrib/ipfilter/netinet/ip_proxy.c b/sys/contrib/ipfilter/netinet/ip_proxy.c index b4773bb6f358..87051b6e6839 100644 --- a/sys/contrib/ipfilter/netinet/ip_proxy.c +++ b/sys/contrib/ipfilter/netinet/ip_proxy.c @@ -1048,9 +1048,8 @@ ipf_proxy_check(fin, nat) } aps->aps_bytes += fin->fin_plen; aps->aps_pkts++; - return 1; } - return 0; + return 1; } From owner-dev-commits-src-branches@freebsd.org Thu Apr 1 13:26:01 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B1C2C5CE4AB; Thu, 1 Apr 2021 13:26: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 4FB3pw1HDVz3nSB; Thu, 1 Apr 2021 13:25: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 ABA27592B; Thu, 1 Apr 2021 13:25: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 131DPvH7096167; Thu, 1 Apr 2021 13:25:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131DPv7B096166; Thu, 1 Apr 2021 13:25:57 GMT (envelope-from git) Date: Thu, 1 Apr 2021 13:25:57 GMT Message-Id: <202104011325.131DPv7B096166@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: f4722627bce2 - stable/11 - MFC 874b1a35486b570513680c3d456b062ba097e1d9: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: f4722627bce29607179fa566c620cdda13fd96df Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 01 Apr 2021 13:26:01 -0000 The branch stable/11 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=f4722627bce29607179fa566c620cdda13fd96df commit f4722627bce29607179fa566c620cdda13fd96df Author: Cy Schubert AuthorDate: 2021-03-23 03:11:58 +0000 Commit: Cy Schubert CommitDate: 2021-04-01 13:23:59 +0000 MFC 874b1a35486b570513680c3d456b062ba097e1d9: ipfilter: simplify ipf_proxy_check() return codes ipf_proxy_check() returns -1 for an error and 0 or 1 for success. ipf_proxy_check()'s callers check for error and if the return code is 0, they change it to 1 prior to returning to their callers. Simply by returning -1 or 1 we reduce complexity and cycles burned changing 0 to 1. (cherry picked from commit 874b1a35486b570513680c3d456b062ba097e1d9) --- sys/contrib/ipfilter/netinet/ip_nat.c | 4 +--- sys/contrib/ipfilter/netinet/ip_nat6.c | 4 +--- sys/contrib/ipfilter/netinet/ip_proxy.c | 3 +-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/sys/contrib/ipfilter/netinet/ip_nat.c b/sys/contrib/ipfilter/netinet/ip_nat.c index 6c6479dd1616..d5abe81ee84d 100644 --- a/sys/contrib/ipfilter/netinet/ip_nat.c +++ b/sys/contrib/ipfilter/netinet/ip_nat.c @@ -5312,9 +5312,7 @@ ipf_nat_out(fin, nat, natadd, nflags) /* ------------------------------------------------------------- */ if ((np != NULL) && (np->in_apr != NULL)) { i = ipf_proxy_check(fin, nat); - if (i == 0) { - i = 1; - } else if (i == -1) { + if (i == -1) { NBUMPSIDED(1, ns_ipf_proxy_fail); } } else { diff --git a/sys/contrib/ipfilter/netinet/ip_nat6.c b/sys/contrib/ipfilter/netinet/ip_nat6.c index 921eefc0ea3f..baa3c302504a 100644 --- a/sys/contrib/ipfilter/netinet/ip_nat6.c +++ b/sys/contrib/ipfilter/netinet/ip_nat6.c @@ -2976,9 +2976,7 @@ ipf_nat6_out(fin, nat, natadd, nflags) /* ------------------------------------------------------------- */ if ((np != NULL) && (np->in_apr != NULL)) { i = ipf_proxy_check(fin, nat); - if (i == 0) { - i = 1; - } else if (i == -1) { + if (i == -1) { NBUMPSIDE6D(1, ns_ipf_proxy_fail); } } else { diff --git a/sys/contrib/ipfilter/netinet/ip_proxy.c b/sys/contrib/ipfilter/netinet/ip_proxy.c index b4773bb6f358..87051b6e6839 100644 --- a/sys/contrib/ipfilter/netinet/ip_proxy.c +++ b/sys/contrib/ipfilter/netinet/ip_proxy.c @@ -1048,9 +1048,8 @@ ipf_proxy_check(fin, nat) } aps->aps_bytes += fin->fin_plen; aps->aps_pkts++; - return 1; } - return 0; + return 1; } From owner-dev-commits-src-branches@freebsd.org Thu Apr 1 16:56: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 B9CC957F8CE; Thu, 1 Apr 2021 16:56: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 4FB8V34whnz4Xg9; Thu, 1 Apr 2021 16:56: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 9B9E910B8D; Thu, 1 Apr 2021 16:56: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 131GuhuS090397; Thu, 1 Apr 2021 16:56:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131GuhCO090396; Thu, 1 Apr 2021 16:56:43 GMT (envelope-from git) Date: Thu, 1 Apr 2021 16:56:43 GMT Message-Id: <202104011656.131GuhCO090396@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: f7488064d914 - stable/13 - nfsv4 pnfs client: fix updating of the layout stateid.seqid 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: f7488064d914fb13457035b19cdbc298bfee89b5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 01 Apr 2021 16:56:43 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=f7488064d914fb13457035b19cdbc298bfee89b5 commit f7488064d914fb13457035b19cdbc298bfee89b5 Author: Rick Macklem AuthorDate: 2021-03-18 19:20:25 +0000 Commit: Rick Macklem CommitDate: 2021-04-01 16:53:47 +0000 nfsv4 pnfs client: fix updating of the layout stateid.seqid During a recent NFSv4 testing event a test server was replying NFSERR_OLDSTATEID for layout stateids presented to the server for LayoutReturn operations. Upon rereading RFC5661, it was apparent that the FreeBSD NFSv4.1/4.2 pNFS client did not maintain the seqid field of the layout stateid correctly. This patch is believed to correct the problem. Tested against a FreeBSD pNFS server with diagnostics added to check the stateid's seqid did not indicate problems. Unfortunately, testing aginst this server will not happen in the near future, so the fix may not be correct yet. (cherry picked from commit fd232a21bb35e8ba8b62c2314b16b2f1d7c00afc) --- sys/fs/nfsclient/nfs_clstate.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index a1aa7c04e8a3..227d82a5f7f3 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -3495,11 +3495,18 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p) len, stateid.seqid, 0, 0, NULL, recallp); + if (error == 0 && + stateid.seqid > + lyp->nfsly_stateid.seqid) + lyp->nfsly_stateid.seqid = + stateid.seqid; recallp = NULL; wakeup(clp); NFSCL_DEBUG(4, - "aft layrcal=%d\n", - error); + "aft layrcal=%d " + "layseqid=%d\n", + error, + lyp->nfsly_stateid.seqid); } else error = NFSERR_NOMATCHLAYOUT; @@ -4881,6 +4888,8 @@ nfscl_layout(struct nfsmount *nmp, vnode_t vp, u_int8_t *fhp, int fhlen, } else { if (retonclose != 0) lyp->nfsly_flags |= NFSLY_RETONCLOSE; + if (stateidp->seqid > lyp->nfsly_stateid.seqid) + lyp->nfsly_stateid.seqid = stateidp->seqid; TAILQ_REMOVE(&clp->nfsc_layout, lyp, nfsly_list); TAILQ_INSERT_HEAD(&clp->nfsc_layout, lyp, nfsly_list); lyp->nfsly_timestamp = NFSD_MONOSEC + 120; @@ -4893,7 +4902,7 @@ nfscl_layout(struct nfsmount *nmp, vnode_t vp, u_int8_t *fhp, int fhlen, return (EPERM); } *lypp = lyp; - } else + } else if (stateidp->seqid > lyp->nfsly_stateid.seqid) lyp->nfsly_stateid.seqid = stateidp->seqid; /* Merge the new list of File Layouts into the list. */ From owner-dev-commits-src-branches@freebsd.org Thu Apr 1 17:29: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 819235B0E2C; Thu, 1 Apr 2021 17:29: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 4FB9D93Cnnz4ZTY; Thu, 1 Apr 2021 17:29: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 5CB6B11039; Thu, 1 Apr 2021 17:29: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 131HTj0A033438; Thu, 1 Apr 2021 17:29:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131HTjLN033437; Thu, 1 Apr 2021 17:29:45 GMT (envelope-from git) Date: Thu, 1 Apr 2021 17:29:45 GMT Message-Id: <202104011729.131HTjLN033437@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: 223d6caabd2e - stable/13 - init: use explicit_bzero() for clearing passwords 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: 223d6caabd2ebaa8f0498a4e33b3418661173dad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 01 Apr 2021 17:29:45 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=223d6caabd2ebaa8f0498a4e33b3418661173dad commit 223d6caabd2ebaa8f0498a4e33b3418661173dad Author: Kyle Evans AuthorDate: 2021-03-03 03:38:37 +0000 Commit: Kyle Evans CommitDate: 2021-04-01 17:29:06 +0000 init: use explicit_bzero() for clearing passwords This is a nop in practice, because it cannot be proven that this particular bzero() is not significant. Make it explicit anyways, rather than relying on an implementation detail of how the password is collected. Discussed with: Andrew Gierth (cherry picked from commit 852f70b24043885f0e438e8fecedd482a9a96d5e) --- sbin/init/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/init/init.c b/sbin/init/init.c index c5f3c121f7f9..943db9f26bd3 100644 --- a/sbin/init/init.c +++ b/sbin/init/init.c @@ -908,7 +908,7 @@ single_user(void) if (clear == NULL || *clear == '\0') _exit(0); password = crypt(clear, pp->pw_passwd); - bzero(clear, _PASSWORD_LEN); + explicit_bzero(clear, _PASSWORD_LEN); if (password != NULL && strcmp(password, pp->pw_passwd) == 0) break; From owner-dev-commits-src-branches@freebsd.org Thu Apr 1 17:29: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 899245B0EEA; Thu, 1 Apr 2021 17:29: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 4FB9DB3VRrz4ZMH; Thu, 1 Apr 2021 17:29: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 6B2B210DDE; Thu, 1 Apr 2021 17:29: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 131HTk7W033459; Thu, 1 Apr 2021 17:29:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131HTkfA033458; Thu, 1 Apr 2021 17:29:46 GMT (envelope-from git) Date: Thu, 1 Apr 2021 17:29:46 GMT Message-Id: <202104011729.131HTkfA033458@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: e0ad785a5d29 - stable/13 - libevent1: fix layout of duplicated RB_ENTRY() definition 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: e0ad785a5d29d33ff8f382ddf055950444cc92e2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 01 Apr 2021 17:29:46 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=e0ad785a5d29d33ff8f382ddf055950444cc92e2 commit e0ad785a5d29d33ff8f382ddf055950444cc92e2 Author: Kyle Evans AuthorDate: 2021-03-24 04:31:02 +0000 Commit: Kyle Evans CommitDate: 2021-04-01 17:29:20 +0000 libevent1: fix layout of duplicated RB_ENTRY() definition 3a509754ded1 removed the color field from our definition, but libevent1 has a copy of it off to the side to prevent event.h consumers from *needing* to pull in sys/queue.h and sys/tree.h. Update the event.h definition so that we don't accidentally end up with two different views of struct event. This appears to have no functional effect on anything in tree, but this came up in a local patch to port if_switch(4) and related components from OpenBSD. (cherry picked from commit 64c01719e476923fe1b24e5a6c6012a677cd017f) --- contrib/pf/libevent/event.h | 1 - 1 file changed, 1 deletion(-) diff --git a/contrib/pf/libevent/event.h b/contrib/pf/libevent/event.h index 3f2032dd068e..0c19201611b5 100644 --- a/contrib/pf/libevent/event.h +++ b/contrib/pf/libevent/event.h @@ -73,7 +73,6 @@ struct { \ struct type *rbe_left; /* left element */ \ struct type *rbe_right; /* right element */ \ struct type *rbe_parent; /* parent element */ \ - int rbe_color; /* node color */ \ } #endif /* !RB_ENTRY */ From owner-dev-commits-src-branches@freebsd.org Thu Apr 1 17:31: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 CF8D65B11A7; Thu, 1 Apr 2021 17:31: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 4FB9G95NKhz4b7J; Thu, 1 Apr 2021 17:31: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 AB81711421; Thu, 1 Apr 2021 17:31: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 131HVTmn042688; Thu, 1 Apr 2021 17:31:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131HVTV8042687; Thu, 1 Apr 2021 17:31:29 GMT (envelope-from git) Date: Thu, 1 Apr 2021 17:31:29 GMT Message-Id: <202104011731.131HVTV8042687@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: 4752dc88e64d - stable/12 - init: use explicit_bzero() for clearing passwords 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: 4752dc88e64dbd90ead7030057f2985297f3453b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 01 Apr 2021 17:31:29 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=4752dc88e64dbd90ead7030057f2985297f3453b commit 4752dc88e64dbd90ead7030057f2985297f3453b Author: Kyle Evans AuthorDate: 2021-03-03 03:38:37 +0000 Commit: Kyle Evans CommitDate: 2021-04-01 17:30:07 +0000 init: use explicit_bzero() for clearing passwords This is a nop in practice, because it cannot be proven that this particular bzero() is not significant. Make it explicit anyways, rather than relying on an implementation detail of how the password is collected. Discussed with: Andrew Gierth (cherry picked from commit 852f70b24043885f0e438e8fecedd482a9a96d5e) --- sbin/init/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/init/init.c b/sbin/init/init.c index 1bb35dbe5803..59bcfb6893dd 100644 --- a/sbin/init/init.c +++ b/sbin/init/init.c @@ -911,7 +911,7 @@ single_user(void) if (clear == NULL || *clear == '\0') _exit(0); password = crypt(clear, pp->pw_passwd); - bzero(clear, _PASSWORD_LEN); + explicit_bzero(clear, _PASSWORD_LEN); if (password != NULL && strcmp(password, pp->pw_passwd) == 0) break; From owner-dev-commits-src-branches@freebsd.org Thu Apr 1 23:00: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 08D325B9D62; Thu, 1 Apr 2021 23:00: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 4FBJYL6kJZz3DPV; Thu, 1 Apr 2021 23:00: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 CF483154BE; Thu, 1 Apr 2021 23:00: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 131N061U098838; Thu, 1 Apr 2021 23:00:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 131N06ZL098835; Thu, 1 Apr 2021 23:00:06 GMT (envelope-from git) Date: Thu, 1 Apr 2021 23:00:06 GMT Message-Id: <202104012300.131N06ZL098835@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: e655b00a964f - stable/12 - nfsv4 pnfs client: fix updating of the layout stateid.seqid 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: e655b00a964f834995b5164dd1edeeafb6b74a44 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 01 Apr 2021 23:00:07 -0000 The branch stable/12 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=e655b00a964f834995b5164dd1edeeafb6b74a44 commit e655b00a964f834995b5164dd1edeeafb6b74a44 Author: Rick Macklem AuthorDate: 2021-03-18 19:20:25 +0000 Commit: Rick Macklem CommitDate: 2021-04-01 22:56:56 +0000 nfsv4 pnfs client: fix updating of the layout stateid.seqid During a recent NFSv4 testing event a test server was replying NFSERR_OLDSTATEID for layout stateids presented to the server for LayoutReturn operations. Upon rereading RFC5661, it was apparent that the FreeBSD NFSv4.1/4.2 pNFS client did not maintain the seqid field of the layout stateid correctly. This patch is believed to correct the problem. Tested against a FreeBSD pNFS server with diagnostics added to check the stateid's seqid did not indicate problems. Unfortunately, testing aginst this server will not happen in the near future, so the fix may not be correct yet. (cherry picked from commit fd232a21bb35e8ba8b62c2314b16b2f1d7c00afc) --- sys/fs/nfsclient/nfs_clstate.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 4c219607af91..79a18a12f91f 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -3469,11 +3469,18 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p) len, stateid.seqid, 0, 0, NULL, recallp); + if (error == 0 && + stateid.seqid > + lyp->nfsly_stateid.seqid) + lyp->nfsly_stateid.seqid = + stateid.seqid; recallp = NULL; wakeup(clp); NFSCL_DEBUG(4, - "aft layrcal=%d\n", - error); + "aft layrcal=%d " + "layseqid=%d\n", + error, + lyp->nfsly_stateid.seqid); } else error = NFSERR_NOMATCHLAYOUT; @@ -4855,6 +4862,8 @@ nfscl_layout(struct nfsmount *nmp, vnode_t vp, u_int8_t *fhp, int fhlen, } else { if (retonclose != 0) lyp->nfsly_flags |= NFSLY_RETONCLOSE; + if (stateidp->seqid > lyp->nfsly_stateid.seqid) + lyp->nfsly_stateid.seqid = stateidp->seqid; TAILQ_REMOVE(&clp->nfsc_layout, lyp, nfsly_list); TAILQ_INSERT_HEAD(&clp->nfsc_layout, lyp, nfsly_list); lyp->nfsly_timestamp = NFSD_MONOSEC + 120; @@ -4867,7 +4876,7 @@ nfscl_layout(struct nfsmount *nmp, vnode_t vp, u_int8_t *fhp, int fhlen, return (EPERM); } *lypp = lyp; - } else + } else if (stateidp->seqid > lyp->nfsly_stateid.seqid) lyp->nfsly_stateid.seqid = stateidp->seqid; /* Merge the new list of File Layouts into the list. */ From owner-dev-commits-src-branches@freebsd.org Fri Apr 2 00:26: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 C616F5BBD93; Fri, 2 Apr 2021 00:26:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBLSv5Fw6z3HyL; Fri, 2 Apr 2021 00:26: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 A786816915; Fri, 2 Apr 2021 00:26: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 1320QNRX021502; Fri, 2 Apr 2021 00:26:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1320QNjA021501; Fri, 2 Apr 2021 00:26:23 GMT (envelope-from git) Date: Fri, 2 Apr 2021 00:26:23 GMT Message-Id: <202104020026.1320QNjA021501@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: f8a134d0ef1d - releng/13.0 - 13.0: update to RC5 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: f8a134d0ef1d430efb24b4e6bd6cd58a07ebc376 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 02 Apr 2021 00:26:23 -0000 The branch releng/13.0 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=f8a134d0ef1d430efb24b4e6bd6cd58a07ebc376 commit f8a134d0ef1d430efb24b4e6bd6cd58a07ebc376 Author: Glen Barber AuthorDate: 2021-04-02 00:26:03 +0000 Commit: Glen Barber CommitDate: 2021-04-02 00:26:03 +0000 13.0: update to RC5 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 79d64cfbfb2a..1afb885e9c9d 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -54,7 +54,7 @@ TYPE="FreeBSD" REVISION="13.0" -BRANCH="RC4" +BRANCH="RC5" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-dev-commits-src-branches@freebsd.org Fri Apr 2 00:30: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 1A7825BC0A0; Fri, 2 Apr 2021 00:30: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 4FBLYD0HN4z3JLW; Fri, 2 Apr 2021 00:30: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 EC316160EB; Fri, 2 Apr 2021 00:30: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 1320U79T025075; Fri, 2 Apr 2021 00:30:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1320U7iP025073; Fri, 2 Apr 2021 00:30:07 GMT (envelope-from git) Date: Fri, 2 Apr 2021 00:30:07 GMT Message-Id: <202104020030.1320U7iP025073@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: fd1c5c6cfca5 - stable/12 - nfsv4 client: fix forced dismount when sleeping on nfsv4lck 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: fd1c5c6cfca58a47bc087b0722360f76024a2594 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 02 Apr 2021 00:30:08 -0000 The branch stable/12 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=fd1c5c6cfca58a47bc087b0722360f76024a2594 commit fd1c5c6cfca58a47bc087b0722360f76024a2594 Author: Rick Macklem AuthorDate: 2021-03-19 21:09:33 +0000 Commit: Rick Macklem CommitDate: 2021-04-02 00:26:44 +0000 nfsv4 client: fix forced dismount when sleeping on nfsv4lck During a recent NFSv4 testing event a test server caused a hang where "umount -N" failed. The renew thread was sleeping on "nfsv4lck" and the "umount" was sleeping, waiting for the renew thread to terminate. This is the first of two patches that is hoped to fix the renew thread so that it will terminate when "umount -N" is done on the mount. nfsv4_lock() checks for forced dismount, but only after it wakes up from msleep(). Without this patch, a wakeup() call was required. This patch adds a 1second timeout on the msleep(), so that it will wake up and see the forced dismount flag. Normally a wakeup() will occur in less than 1second, but if a premature return from msleep() does occur, it will simply loop around and msleep() again. While here, replace the nfsmsleep() wrapper that was used for portability with the actual msleep() call and make the same change for nfsv4_getref(). (cherry picked from commit 5f742d3879deb1f46f2d151d5ef84f49e8d6afe6) --- sys/fs/nfs/nfs_commonsubs.c | 10 ++++------ sys/fs/nfs/nfs_var.h | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 7c54b503b286..9c6bee466272 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -2224,7 +2224,7 @@ nfsmout: */ int nfsv4_lock(struct nfsv4lock *lp, int iwantlock, int *isleptp, - void *mutex, struct mount *mp) + struct mtx *mutex, struct mount *mp) { if (isleptp) @@ -2252,8 +2252,7 @@ nfsv4_lock(struct nfsv4lock *lp, int iwantlock, int *isleptp, lp->nfslock_lock |= NFSV4LOCK_WANTED; if (isleptp) *isleptp = 1; - (void) nfsmsleep(&lp->nfslock_lock, mutex, - PZERO - 1, "nfsv4lck", NULL); + msleep(&lp->nfslock_lock, mutex, PVFS, "nfsv4lck", hz); if (iwantlock && !(lp->nfslock_lock & NFSV4LOCK_LOCK) && lp->nfslock_usecnt == 0) { lp->nfslock_lock &= ~NFSV4LOCK_LOCKWANTED; @@ -2303,7 +2302,7 @@ nfsv4_relref(struct nfsv4lock *lp) * return without getting a refcnt for that case. */ void -nfsv4_getref(struct nfsv4lock *lp, int *isleptp, void *mutex, +nfsv4_getref(struct nfsv4lock *lp, int *isleptp, struct mtx *mutex, struct mount *mp) { @@ -2319,8 +2318,7 @@ nfsv4_getref(struct nfsv4lock *lp, int *isleptp, void *mutex, lp->nfslock_lock |= NFSV4LOCK_WANTED; if (isleptp) *isleptp = 1; - (void) nfsmsleep(&lp->nfslock_lock, mutex, - PZERO - 1, "nfsv4gr", NULL); + msleep(&lp->nfslock_lock, mutex, PVFS, "nfsv4gr", hz); } if (mp != NULL && NFSCL_FORCEDISM(mp)) return; diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index 08701b68bb40..4bc1101e3b8d 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -325,10 +325,10 @@ int nfsv4_loadattr(struct nfsrv_descript *, vnode_t, struct nfsv3_pathconf *, struct statfs *, struct nfsstatfs *, struct nfsfsinfo *, NFSACL_T *, int, int *, u_int32_t *, u_int32_t *, NFSPROC_T *, struct ucred *); -int nfsv4_lock(struct nfsv4lock *, int, int *, void *, struct mount *); +int nfsv4_lock(struct nfsv4lock *, int, int *, struct mtx *, struct mount *); void nfsv4_unlock(struct nfsv4lock *, int); void nfsv4_relref(struct nfsv4lock *); -void nfsv4_getref(struct nfsv4lock *, int *, void *, struct mount *); +void nfsv4_getref(struct nfsv4lock *, int *, struct mtx *, struct mount *); int nfsv4_getref_nonblock(struct nfsv4lock *); int nfsv4_testlock(struct nfsv4lock *); int nfsrv_mtostr(struct nfsrv_descript *, char *, int); From owner-dev-commits-src-branches@freebsd.org Fri Apr 2 00:39: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 9C6375BBC91; Fri, 2 Apr 2021 00:39: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 4FBLmb41g3z3JxS; Fri, 2 Apr 2021 00:39: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 78232168BA; Fri, 2 Apr 2021 00:39: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 1320dxuH036097; Fri, 2 Apr 2021 00:39:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1320dxW9036096; Fri, 2 Apr 2021 00:39:59 GMT (envelope-from git) Date: Fri, 2 Apr 2021 00:39:59 GMT Message-Id: <202104020039.1320dxW9036096@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: 320a5f34acf6 - stable/13 - nfsv4 client: fix forced dismount when sleeping on nfsv4lck 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: 320a5f34acf6da39a7b3c6cee3ba60822ec3ac08 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 02 Apr 2021 00:39:59 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=320a5f34acf6da39a7b3c6cee3ba60822ec3ac08 commit 320a5f34acf6da39a7b3c6cee3ba60822ec3ac08 Author: Rick Macklem AuthorDate: 2021-03-19 21:09:33 +0000 Commit: Rick Macklem CommitDate: 2021-04-02 00:36:58 +0000 nfsv4 client: fix forced dismount when sleeping on nfsv4lck During a recent NFSv4 testing event a test server caused a hang where "umount -N" failed. The renew thread was sleeping on "nfsv4lck" and the "umount" was sleeping, waiting for the renew thread to terminate. This is the first of two patches that is hoped to fix the renew thread so that it will terminate when "umount -N" is done on the mount. nfsv4_lock() checks for forced dismount, but only after it wakes up from msleep(). Without this patch, a wakeup() call was required. This patch adds a 1second timeout on the msleep(), so that it will wake up and see the forced dismount flag. Normally a wakeup() will occur in less than 1second, but if a premature return from msleep() does occur, it will simply loop around and msleep() again. While here, replace the nfsmsleep() wrapper that was used for portability with the actual msleep() call and make the same change for nfsv4_getref(). (cherry picked from commit 5f742d3879deb1f46f2d151d5ef84f49e8d6afe6) --- sys/fs/nfs/nfs_commonsubs.c | 10 ++++------ sys/fs/nfs/nfs_var.h | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index d44ff122a95c..e9b2af17d8b4 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -2252,7 +2252,7 @@ nfsmout: */ int nfsv4_lock(struct nfsv4lock *lp, int iwantlock, int *isleptp, - void *mutex, struct mount *mp) + struct mtx *mutex, struct mount *mp) { if (isleptp) @@ -2280,8 +2280,7 @@ nfsv4_lock(struct nfsv4lock *lp, int iwantlock, int *isleptp, lp->nfslock_lock |= NFSV4LOCK_WANTED; if (isleptp) *isleptp = 1; - (void) nfsmsleep(&lp->nfslock_lock, mutex, - PZERO - 1, "nfsv4lck", NULL); + msleep(&lp->nfslock_lock, mutex, PVFS, "nfsv4lck", hz); if (iwantlock && !(lp->nfslock_lock & NFSV4LOCK_LOCK) && lp->nfslock_usecnt == 0) { lp->nfslock_lock &= ~NFSV4LOCK_LOCKWANTED; @@ -2331,7 +2330,7 @@ nfsv4_relref(struct nfsv4lock *lp) * return without getting a refcnt for that case. */ void -nfsv4_getref(struct nfsv4lock *lp, int *isleptp, void *mutex, +nfsv4_getref(struct nfsv4lock *lp, int *isleptp, struct mtx *mutex, struct mount *mp) { @@ -2347,8 +2346,7 @@ nfsv4_getref(struct nfsv4lock *lp, int *isleptp, void *mutex, lp->nfslock_lock |= NFSV4LOCK_WANTED; if (isleptp) *isleptp = 1; - (void) nfsmsleep(&lp->nfslock_lock, mutex, - PZERO - 1, "nfsv4gr", NULL); + msleep(&lp->nfslock_lock, mutex, PVFS, "nfsv4gr", hz); } if (mp != NULL && NFSCL_FORCEDISM(mp)) return; diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index 0a1fe3ce053d..aba5c5124e72 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -335,10 +335,10 @@ int nfsv4_loadattr(struct nfsrv_descript *, vnode_t, struct nfsv3_pathconf *, struct statfs *, struct nfsstatfs *, struct nfsfsinfo *, NFSACL_T *, int, int *, u_int32_t *, u_int32_t *, NFSPROC_T *, struct ucred *); -int nfsv4_lock(struct nfsv4lock *, int, int *, void *, struct mount *); +int nfsv4_lock(struct nfsv4lock *, int, int *, struct mtx *, struct mount *); void nfsv4_unlock(struct nfsv4lock *, int); void nfsv4_relref(struct nfsv4lock *); -void nfsv4_getref(struct nfsv4lock *, int *, void *, struct mount *); +void nfsv4_getref(struct nfsv4lock *, int *, struct mtx *, struct mount *); int nfsv4_getref_nonblock(struct nfsv4lock *); int nfsv4_testlock(struct nfsv4lock *); int nfsrv_mtostr(struct nfsrv_descript *, char *, int); From owner-dev-commits-src-branches@freebsd.org Fri Apr 2 02:46: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 34C295BF5B9; Fri, 2 Apr 2021 02:46:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FBPZq130xz3RFB; Fri, 2 Apr 2021 02:46: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 1692C18780; Fri, 2 Apr 2021 02:46: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 1322kg0p017796; Fri, 2 Apr 2021 02:46:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1322kgH5017795; Fri, 2 Apr 2021 02:46:42 GMT (envelope-from git) Date: Fri, 2 Apr 2021 02:46:42 GMT Message-Id: <202104020246.1322kgH5017795@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lawrence Stewart Subject: git: 9141b58b50a8 - stable/13 - stats(3): Improve t-digest merging of samples which result in mu adjustment underflow. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lstewart X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9141b58b50a86a94667a79f221dcba59240ce3f4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 02 Apr 2021 02:46:43 -0000 The branch stable/13 has been updated by lstewart: URL: https://cgit.FreeBSD.org/src/commit/?id=9141b58b50a86a94667a79f221dcba59240ce3f4 commit 9141b58b50a86a94667a79f221dcba59240ce3f4 Author: Lawrence Stewart AuthorDate: 2021-04-02 01:29:29 +0000 Commit: Lawrence Stewart CommitDate: 2021-04-02 02:29:55 +0000 stats(3): Improve t-digest merging of samples which result in mu adjustment underflow. Allow the calculation of the mu adjustment factor to underflow instead of rejecting the VOI sample from the digest and logging an error. This trades off some (currently unquantified) additional centroid error in exchange for better fidelity of the distribution's density, which is the right trade off at the moment until follow up work to better handle and track accumulated error can be undertaken. Obtained from: Netflix MFC after: immediately (cherry picked from commit 1eb402e47af35b3980e6bd51ec462de3a3faa2c8) --- sys/kern/subr_stats.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_stats.c b/sys/kern/subr_stats.c index 9dd874fcbcf8..946999263898 100644 --- a/sys/kern/subr_stats.c +++ b/sys/kern/subr_stats.c @@ -3255,9 +3255,41 @@ stats_v1_vsd_tdgst_add(enum vsd_dtype vs_dtype, struct voistatdata_tdgst *tdgst, if (is32bit) { ctd32 = (struct voistatdata_tdgstctd32 *)closest; error = Q_QSUBQ(&x, ctd32->mu); + /* + * The following calculation "x / (cnt + weight)" + * computes the amount by which to adjust the centroid's + * mu value in order to merge in the VOI sample. + * + * It can underflow (Q_QDIVI() returns ERANGE) when the + * user centroids' fractional precision (which is + * inherited by 'x') is too low to represent the result. + * + * A sophisticated approach to dealing with this issue + * would minimise accumulation of error by tracking + * underflow per centroid and making an adjustment when + * a LSB's worth of underflow has accumulated. + * + * A simpler approach is to let the result underflow + * i.e. merge the VOI sample into the centroid without + * adjusting the centroid's mu, and rely on the user to + * specify their t-digest with sufficient centroid + * fractional precision such that the accumulation of + * error from multiple underflows is of no material + * consequence to the centroid's final value of mu. + * + * For the moment, the latter approach is employed by + * simply ignoring ERANGE here. + * + * XXXLAS: Per-centroid underflow tracking is likely too + * onerous, but it probably makes sense to accumulate a + * single underflow error variable across all centroids + * and report it as part of the digest to provide + * additional visibility into the digest's fidelity. + */ error = error ? error : Q_QDIVI(&x, ctd32->cnt + weight); - if (error || (error = Q_QADDQ(&ctd32->mu, x))) { + if ((error && error != ERANGE) + || (error = Q_QADDQ(&ctd32->mu, x))) { #ifdef DIAGNOSTIC KASSERT(!error, ("%s: unexpected error %d", __func__, error)); @@ -3276,7 +3308,9 @@ stats_v1_vsd_tdgst_add(enum vsd_dtype vs_dtype, struct voistatdata_tdgst *tdgst, error = Q_QSUBQ(&x, ctd64->mu); error = error ? error : Q_QDIVI(&x, ctd64->cnt + weight); - if (error || (error = Q_QADDQ(&ctd64->mu, x))) { + /* Refer to is32bit ERANGE discussion above. */ + if ((error && error != ERANGE) + || (error = Q_QADDQ(&ctd64->mu, x))) { KASSERT(!error, ("%s: unexpected error %d", __func__, error)); return (error); From owner-dev-commits-src-branches@freebsd.org Fri Apr 2 17:23: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 E57AD57CC51; Fri, 2 Apr 2021 17:23: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 4FBn2b60H1z3QFG; Fri, 2 Apr 2021 17:23: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 C05F4235E0; Fri, 2 Apr 2021 17:23: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 132HNZes052201; Fri, 2 Apr 2021 17:23:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 132HNZLk052200; Fri, 2 Apr 2021 17:23:35 GMT (envelope-from git) Date: Fri, 2 Apr 2021 17:23:35 GMT Message-Id: <202104021723.132HNZLk052200@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Neel Chauhan Subject: git: ea96dcc6e233 - stable/13 - ichsmb: Add PCI IDs for Intel Comet Lake and Tiger Lake MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nc X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ea96dcc6e2333a33509ee318be7882fcbdb88ed4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 02 Apr 2021 17:23:36 -0000 The branch stable/13 has been updated by nc (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=ea96dcc6e2333a33509ee318be7882fcbdb88ed4 commit ea96dcc6e2333a33509ee318be7882fcbdb88ed4 Author: Neel Chauhan AuthorDate: 2021-03-27 21:08:34 +0000 Commit: Neel Chauhan CommitDate: 2021-04-02 17:22:46 +0000 ichsmb: Add PCI IDs for Intel Comet Lake and Tiger Lake Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D27859 MFC after: 2 weeks (cherry picked from commit a94d15af26b51cea480030b26c751c3550b1b4bb) --- sys/dev/ichsmb/ichsmb_pci.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/dev/ichsmb/ichsmb_pci.c b/sys/dev/ichsmb/ichsmb_pci.c index e0aa3bfdb383..ff4b287dd020 100644 --- a/sys/dev/ichsmb/ichsmb_pci.c +++ b/sys/dev/ichsmb/ichsmb_pci.c @@ -105,6 +105,10 @@ __FBSDID("$FreeBSD$"); #define ID_LEWISBURG2 0xa223 #define ID_KABYLAKE 0xa2a3 #define ID_CANNONLAKE 0xa323 +#define ID_COMETLAKE 0x02a3 +#define ID_COMETLAKE2 0x06a3 +#define ID_TIGERLAKE 0xa0a3 +#define ID_TIGERLAKE2 0x43a3 static const struct pci_device_table ichsmb_devices[] = { { PCI_DEV(PCI_VENDOR_INTEL, ID_82801AA), @@ -187,6 +191,14 @@ static const struct pci_device_table ichsmb_devices[] = { PCI_DESCR("Intel Kaby Lake SMBus controller") }, { PCI_DEV(PCI_VENDOR_INTEL, ID_CANNONLAKE), PCI_DESCR("Intel Cannon Lake SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_COMETLAKE), + PCI_DESCR("Intel Comet Lake SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_COMETLAKE2), + PCI_DESCR("Intel Comet Lake SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_TIGERLAKE), + PCI_DESCR("Intel Tiger Lake SMBus controller") }, + { PCI_DEV(PCI_VENDOR_INTEL, ID_TIGERLAKE2), + PCI_DESCR("Intel Tiger Lake SMBus controller") }, }; /* Internal functions */ From owner-dev-commits-src-branches@freebsd.org Fri Apr 2 21:49: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 E1D7B5B34D3; Fri, 2 Apr 2021 21:49: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 4FBtxd5zK6z4S0g; Fri, 2 Apr 2021 21:49: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 C0483272C4; Fri, 2 Apr 2021 21:49: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 132Lnfxn017736; Fri, 2 Apr 2021 21:49:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 132Lnf4S017735; Fri, 2 Apr 2021 21:49:41 GMT (envelope-from git) Date: Fri, 2 Apr 2021 21:49:41 GMT Message-Id: <202104022149.132Lnf4S017735@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: fab7c18ce322 - stable/13 - Fix fsck_ffs Pass 1b error exit "bad inode number 2 to nextinode". MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fab7c18ce3229d53b732fdfdbb6e9a1a1c72739a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 02 Apr 2021 21:49:42 -0000 The branch stable/13 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=fab7c18ce3229d53b732fdfdbb6e9a1a1c72739a commit fab7c18ce3229d53b732fdfdbb6e9a1a1c72739a Author: Kirk McKusick AuthorDate: 2021-03-24 23:50:24 +0000 Commit: Kirk McKusick CommitDate: 2021-04-02 21:52:49 +0000 Fix fsck_ffs Pass 1b error exit "bad inode number 2 to nextinode". (cherry picked from commit bc444e2ec6e6cc9d96d35ab7ce3c02c0da952fad) --- sbin/fsck_ffs/pass1b.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sbin/fsck_ffs/pass1b.c b/sbin/fsck_ffs/pass1b.c index 8c09ef36acad..b44e0107c982 100644 --- a/sbin/fsck_ffs/pass1b.c +++ b/sbin/fsck_ffs/pass1b.c @@ -78,8 +78,10 @@ pass1b(void) continue; setinodebuf(c, inosused); for (i = 0; i < inosused; i++, inumber++) { - if (inumber < UFS_ROOTINO) + if (inumber < UFS_ROOTINO) { + (void)getnextinode(inumber, 0); continue; + } dp = getnextinode(inumber, 0); idesc.id_number = inumber; idesc.id_type = inoinfo(inumber)->ino_idtype; From owner-dev-commits-src-branches@freebsd.org Fri Apr 2 21:52: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 B42725B3CC6; Fri, 2 Apr 2021 21:52: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 4FBv0d1hyjz4ShX; Fri, 2 Apr 2021 21:52:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A2E127454; Fri, 2 Apr 2021 21: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 132LqAej030444; Fri, 2 Apr 2021 21: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 132LqARj030438; Fri, 2 Apr 2021 21:52:10 GMT (envelope-from git) Date: Fri, 2 Apr 2021 21:52:10 GMT Message-Id: <202104022152.132LqARj030438@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: 343b9e6219e1 - stable/13 - Fix fsck_ffs -R finds unfixed duplicate block errors when rerunning. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 343b9e6219e1579efe8980612655ec52d61b0d57 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 02 Apr 2021 21:52:19 -0000 The branch stable/13 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=343b9e6219e1579efe8980612655ec52d61b0d57 commit 343b9e6219e1579efe8980612655ec52d61b0d57 Author: Kirk McKusick AuthorDate: 2021-03-25 00:23:33 +0000 Commit: Kirk McKusick CommitDate: 2021-04-02 21:55:58 +0000 Fix fsck_ffs -R finds unfixed duplicate block errors when rerunning. (cherry picked from commit 7848b25edd2a513f115de6d91f0a5a8d8fa1aa58) --- sbin/fsck_ffs/inode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c index 60019425c825..020a69dd72f8 100644 --- a/sbin/fsck_ffs/inode.c +++ b/sbin/fsck_ffs/inode.c @@ -600,6 +600,9 @@ setinodebuf(int cg, ino_t inosused) nextino = inum; lastinum = inum; readcount = 0; + /* Flush old contents in case they have been updated */ + flush(fswritefd, &inobuf); + inobuf.b_bno = 0; if (inobuf.b_un.b_buf == NULL) { inobufsize = blkroundup(&sblock, MAX(INOBUFSIZE, sblock.fs_bsize)); From owner-dev-commits-src-branches@freebsd.org Sat Apr 3 00:53: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 9BEAE5B8A41; Sat, 3 Apr 2021 00:53: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 4FBz1Z3rnZz4dtp; Sat, 3 Apr 2021 00:53: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 753B3164A; Sat, 3 Apr 2021 00:53: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 1330rMDC082459; Sat, 3 Apr 2021 00:53:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1330rMsW082458; Sat, 3 Apr 2021 00:53:22 GMT (envelope-from git) Date: Sat, 3 Apr 2021 00:53:22 GMT Message-Id: <202104030053.1330rMsW082458@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: b2ebf64aaef5 - stable/13 - vm_fault: handle KERN_PROTECTION_FAILURE 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: b2ebf64aaef53802a1be25fbc6adcd9ad76085a8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 03 Apr 2021 00:53:22 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b2ebf64aaef53802a1be25fbc6adcd9ad76085a8 commit b2ebf64aaef53802a1be25fbc6adcd9ad76085a8 Author: Konstantin Belousov AuthorDate: 2021-03-27 11:08:52 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-03 00:39:06 +0000 vm_fault: handle KERN_PROTECTION_FAILURE (cherry picked from commit c7b913aa47bac8b35b6a0679497ad28e561318c2) --- sys/vm/vm_fault.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index da7b1f1d2d8e..585e1544415d 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -506,6 +506,8 @@ vm_fault_populate(struct faultstate *fs) PMAP_ENTER_LARGEPAGE, bdry_idx); VM_OBJECT_WLOCK(fs->first_object); vm_page_xunbusy(m); + if (rv != KERN_SUCCESS) + goto out; if ((fs->fault_flags & VM_FAULT_WIRE) != 0) { for (i = 0; i < atop(pagesizes[bdry_idx]); i++) vm_page_wire(m + i); @@ -586,7 +588,7 @@ vm_fault_populate(struct faultstate *fs) } out: curthread->td_ru.ru_majflt++; - return (KERN_SUCCESS); + return (rv); } static int prot_fault_translation; @@ -1073,6 +1075,7 @@ vm_fault_allocate(struct faultstate *fs) switch (rv) { case KERN_SUCCESS: case KERN_FAILURE: + case KERN_PROTECTION_FAILURE: case KERN_RESTART: return (rv); case KERN_NOT_RECEIVER: @@ -1343,6 +1346,7 @@ RetryFault: goto RetryFault; case KERN_SUCCESS: case KERN_FAILURE: + case KERN_PROTECTION_FAILURE: case KERN_OUT_OF_BOUNDS: unlock_and_deallocate(&fs); return (rv); @@ -1410,6 +1414,7 @@ RetryFault: goto RetryFault; case KERN_SUCCESS: case KERN_FAILURE: + case KERN_PROTECTION_FAILURE: case KERN_OUT_OF_BOUNDS: unlock_and_deallocate(&fs); return (rv); From owner-dev-commits-src-branches@freebsd.org Sat Apr 3 06:20: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 0D7015C11BB; Sat, 3 Apr 2021 06:20: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 4FC6GR6gHRz3GRw; Sat, 3 Apr 2021 06:19: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 D77815E33; Sat, 3 Apr 2021 06:19: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 1336JxNF033028; Sat, 3 Apr 2021 06:19:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1336JxKs033027; Sat, 3 Apr 2021 06:19:59 GMT (envelope-from git) Date: Sat, 3 Apr 2021 06:19:59 GMT Message-Id: <202104030619.1336JxKs033027@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ka Ho Ng Subject: git: 98740ead97c6 - stable/13 - virtio_pci_legacy: Use the table BAR and PBA BAR from MSI-X cap MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 98740ead97c60caca1d7cb3e996108c75f499beb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 03 Apr 2021 06:20:00 -0000 The branch stable/13 has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=98740ead97c60caca1d7cb3e996108c75f499beb commit 98740ead97c60caca1d7cb3e996108c75f499beb Author: Ka Ho Ng AuthorDate: 2021-03-20 07:40:52 +0000 Commit: Ka Ho Ng CommitDate: 2021-04-03 06:09:31 +0000 virtio_pci_legacy: Use the table BAR and PBA BAR from MSI-X cap The MSI-X resource shouldn't be assumed to be always on BAR1. The Virtio v1.1 Spec did not specify that MSI-X table and PBA BAR has to be BAR1 either. Reported by: Yuan Rui Reviewed by: bryanv, jhb Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D28817 (cherry picked from commit faf9a4e9142a02c289ee543a6091bd4b925c6a63) --- sys/dev/virtio/pci/virtio_pci_legacy.c | 74 +++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 14 deletions(-) diff --git a/sys/dev/virtio/pci/virtio_pci_legacy.c b/sys/dev/virtio/pci/virtio_pci_legacy.c index 22e369097e2e..d74983099110 100644 --- a/sys/dev/virtio/pci/virtio_pci_legacy.c +++ b/sys/dev/virtio/pci/virtio_pci_legacy.c @@ -60,7 +60,8 @@ struct vtpci_legacy_softc { device_t vtpci_dev; struct vtpci_common vtpci_common; struct resource *vtpci_res; - struct resource *vtpci_msix_res; + struct resource *vtpci_msix_table_res; + struct resource *vtpci_msix_pba_res; }; static int vtpci_legacy_probe(device_t); @@ -97,6 +98,8 @@ static void vtpci_legacy_notify_vq(device_t, uint16_t, bus_size_t); static void vtpci_legacy_read_dev_config(device_t, bus_size_t, void *, int); static void vtpci_legacy_write_dev_config(device_t, bus_size_t, void *, int); +static bool vtpci_legacy_setup_msix(struct vtpci_legacy_softc *sc); +static void vtpci_legacy_teardown_msix(struct vtpci_legacy_softc *sc); static int vtpci_legacy_alloc_resources(struct vtpci_legacy_softc *); static void vtpci_legacy_free_resources(struct vtpci_legacy_softc *); @@ -232,6 +235,13 @@ vtpci_legacy_attach(device_t dev) return (error); } + if (vtpci_is_msix_available(&sc->vtpci_common) && + !vtpci_legacy_setup_msix(sc)) { + device_printf(dev, "cannot setup MSI-x resources\n"); + error = ENXIO; + goto fail; + } + vtpci_legacy_reset(sc); /* Tell the host we've noticed this device. */ @@ -265,6 +275,7 @@ vtpci_legacy_detach(device_t dev) return (error); vtpci_legacy_reset(sc); + vtpci_legacy_teardown_msix(sc); vtpci_legacy_free_resources(sc); return (0); @@ -539,6 +550,54 @@ vtpci_legacy_write_dev_config(device_t dev, bus_size_t offset, } } +static bool +vtpci_legacy_setup_msix(struct vtpci_legacy_softc *sc) +{ + device_t dev; + int rid, table_rid; + + dev = sc->vtpci_dev; + + rid = table_rid = pci_msix_table_bar(dev); + if (rid != PCIR_BAR(0)) { + sc->vtpci_msix_table_res = bus_alloc_resource_any( + dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); + if (sc->vtpci_msix_table_res == NULL) + return (false); + } + + rid = pci_msix_pba_bar(dev); + if (rid != table_rid && rid != PCIR_BAR(0)) { + sc->vtpci_msix_pba_res = bus_alloc_resource_any( + dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); + if (sc->vtpci_msix_pba_res == NULL) + return (false); + } + + return (true); +} + +static void +vtpci_legacy_teardown_msix(struct vtpci_legacy_softc *sc) +{ + device_t dev; + + dev = sc->vtpci_dev; + + if (sc->vtpci_msix_pba_res != NULL) { + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->vtpci_msix_pba_res), + sc->vtpci_msix_pba_res); + sc->vtpci_msix_pba_res = NULL; + } + if (sc->vtpci_msix_table_res != NULL) { + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->vtpci_msix_table_res), + sc->vtpci_msix_table_res); + sc->vtpci_msix_table_res = NULL; + } +} + static int vtpci_legacy_alloc_resources(struct vtpci_legacy_softc *sc) { @@ -552,13 +611,6 @@ vtpci_legacy_alloc_resources(struct vtpci_legacy_softc *sc) &rid, RF_ACTIVE)) == NULL) return (ENXIO); - if (vtpci_is_msix_available(&sc->vtpci_common)) { - rid = PCIR_BAR(1); - if ((sc->vtpci_msix_res = bus_alloc_resource_any(dev, - SYS_RES_MEMORY, &rid, RF_ACTIVE)) == NULL) - return (ENXIO); - } - return (0); } @@ -569,12 +621,6 @@ vtpci_legacy_free_resources(struct vtpci_legacy_softc *sc) dev = sc->vtpci_dev; - if (sc->vtpci_msix_res != NULL) { - bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BAR(1), - sc->vtpci_msix_res); - sc->vtpci_msix_res = NULL; - } - if (sc->vtpci_res != NULL) { bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(0), sc->vtpci_res); From owner-dev-commits-src-branches@freebsd.org Sat Apr 3 06:20: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 364755C1313; Sat, 3 Apr 2021 06:20: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 4FC6GT0nY9z3GPV; Sat, 3 Apr 2021 06:20: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 02D2B5EF1; Sat, 3 Apr 2021 06:20: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 1336K0nK034058; Sat, 3 Apr 2021 06:20:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1336K0sn034047; Sat, 3 Apr 2021 06:20:00 GMT (envelope-from git) Date: Sat, 3 Apr 2021 06:20:00 GMT Message-Id: <202104030620.1336K0sn034047@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ka Ho Ng Subject: git: 2e107638eac2 - stable/13 - virtio_pci_legacy: Allow memory space for configuration MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2e107638eac2a721bc024314ae79d4688edfc130 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 03 Apr 2021 06:20:01 -0000 The branch stable/13 has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=2e107638eac2a721bc024314ae79d4688edfc130 commit 2e107638eac2a721bc024314ae79d4688edfc130 Author: Ka Ho Ng AuthorDate: 2021-03-20 07:40:55 +0000 Commit: Ka Ho Ng CommitDate: 2021-04-03 06:09:50 +0000 virtio_pci_legacy: Allow memory space for configuration For guests running under some kind of VMMs, configuration structure is available in memory space but not I/O space. Reported by: Yuan Rui Reviewed by: rpokala, bryanv, jhb Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D28818 (cherry picked from commit cf5d1112408ddef3fdff8212599727c49ba90fa4) --- sys/dev/virtio/pci/virtio_pci_legacy.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/sys/dev/virtio/pci/virtio_pci_legacy.c b/sys/dev/virtio/pci/virtio_pci_legacy.c index d74983099110..a17dd22aa953 100644 --- a/sys/dev/virtio/pci/virtio_pci_legacy.c +++ b/sys/dev/virtio/pci/virtio_pci_legacy.c @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); struct vtpci_legacy_softc { device_t vtpci_dev; struct vtpci_common vtpci_common; + int vtpci_res_type; struct resource *vtpci_res; struct resource *vtpci_msix_table_res; struct resource *vtpci_msix_pba_res; @@ -231,7 +232,7 @@ vtpci_legacy_attach(device_t dev) error = vtpci_legacy_alloc_resources(sc); if (error) { - device_printf(dev, "cannot map I/O space\n"); + device_printf(dev, "cannot map I/O space nor memory space\n"); return (error); } @@ -601,14 +602,25 @@ vtpci_legacy_teardown_msix(struct vtpci_legacy_softc *sc) static int vtpci_legacy_alloc_resources(struct vtpci_legacy_softc *sc) { + const int res_types[] = { SYS_RES_IOPORT, SYS_RES_MEMORY }; device_t dev; - int rid; + int rid, i; dev = sc->vtpci_dev; - rid = PCIR_BAR(0); - if ((sc->vtpci_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &rid, RF_ACTIVE)) == NULL) + /* + * Most hypervisors export the common configuration structure in IO + * space, but some use memory space; try both. + */ + for (i = 0; nitems(res_types); i++) { + rid = PCIR_BAR(0); + sc->vtpci_res_type = res_types[i]; + sc->vtpci_res = bus_alloc_resource_any(dev, res_types[i], &rid, + RF_ACTIVE); + if (sc->vtpci_res != NULL) + break; + } + if (sc->vtpci_res == NULL) return (ENXIO); return (0); @@ -622,7 +634,7 @@ vtpci_legacy_free_resources(struct vtpci_legacy_softc *sc) dev = sc->vtpci_dev; if (sc->vtpci_res != NULL) { - bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(0), + bus_release_resource(dev, sc->vtpci_res_type, PCIR_BAR(0), sc->vtpci_res); sc->vtpci_res = NULL; } From owner-dev-commits-src-branches@freebsd.org Sat Apr 3 11:29: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 25CE45B12C4; Sat, 3 Apr 2021 11:29:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCF7p0WSkz3r1J; Sat, 3 Apr 2021 11:29: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 0486412175; Sat, 3 Apr 2021 11:29: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 133BTfpQ068096; Sat, 3 Apr 2021 11:29:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 133BTfvY068095; Sat, 3 Apr 2021 11:29:41 GMT (envelope-from git) Date: Sat, 3 Apr 2021 11:29:41 GMT Message-Id: <202104031129.133BTfvY068095@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 7f8acc8d3d3a - stable/13 - zfs: Cherry-pick upstream commit ef977fce6636 to fix macOS/arm64 bootstrap MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7f8acc8d3d3a5094cd4055f39ad05fc753a90707 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 03 Apr 2021 11:29:42 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=7f8acc8d3d3a5094cd4055f39ad05fc753a90707 commit 7f8acc8d3d3a5094cd4055f39ad05fc753a90707 Author: Jessica Clarke AuthorDate: 2021-03-27 02:23:59 +0000 Commit: Jessica Clarke CommitDate: 2021-04-03 11:29:31 +0000 zfs: Cherry-pick upstream commit ef977fce6636 to fix macOS/arm64 bootstrap Upstream commit message: Support running FreeBSD buildworld on Arm-based macOS hosts Arm-based Macs are like FreeBSD and provide a full 64-bit stat from the start, so have no stat64 variants. Thus, define stat64 and fstat64 as aliases for the normal versions. Reviewed-by: Ryan Moeller Signed-off-by: Jessica Clarke Closes #11771 (cherry picked from commit 3a314eb5bb444ec019457e5aefaabb656fcb3d54) --- sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/stat.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/stat.h b/sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/stat.h index 07f9762f09ee..38c684d62a1b 100644 --- a/sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/stat.h +++ b/sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/stat.h @@ -29,6 +29,7 @@ #include_next /* Note: this file can be used on linux/macOS when bootstrapping tools. */ + #if defined(__FreeBSD__) #include /* for BLKGETSIZE64 */ @@ -71,4 +72,14 @@ fstat64_blk(int fd, struct stat64 *st) return (0); } #endif /* defined(__FreeBSD__) */ + +/* + * Only Intel-based Macs have a separate stat64; Arm-based Macs are like + * FreeBSD and have a full 64-bit stat from the start. + */ +#if defined(__APPLE__) && !(defined(__i386__) || defined(__x86_64__)) +#define stat64 stat +#define fstat64 fstat +#endif + #endif /* _LIBSPL_SYS_STAT_H */ From owner-dev-commits-src-branches@freebsd.org Sat Apr 3 15:14: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 6D2705B6AD5; Sat, 3 Apr 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 4FCL6s2bnRz4Yxs; Sat, 3 Apr 2021 15:14: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 4AB6B149E3; Sat, 3 Apr 2021 15:14: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 133FEDe6089276; Sat, 3 Apr 2021 15:14:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 133FED2n089275; Sat, 3 Apr 2021 15:14:13 GMT (envelope-from git) Date: Sat, 3 Apr 2021 15:14:13 GMT Message-Id: <202104031514.133FED2n089275@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: 69f4805c3698 - stable/13 - sendfile: Fix error initialization in sendfile_getobj() 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: 69f4805c3698407a7cb3e107e37823c08419915d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 03 Apr 2021 15:14:13 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=69f4805c3698407a7cb3e107e37823c08419915d commit 69f4805c3698407a7cb3e107e37823c08419915d Author: Mark Johnston AuthorDate: 2021-04-02 21:12:56 +0000 Commit: Mark Johnston CommitDate: 2021-04-03 15:11:39 +0000 sendfile: Fix error initialization in sendfile_getobj() Reviewed by: chs, kib Reported by: jhb Fixes: faa998f6ff695 Differential Revision: https://reviews.freebsd.org/D29540 (cherry picked from commit 52a99c72b5e1e58a8297d1e62854a5b765dc7d33) --- sys/kern/kern_sendfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c index 95bfba0538dc..520b7c9c62d0 100644 --- a/sys/kern/kern_sendfile.c +++ b/sys/kern/kern_sendfile.c @@ -571,6 +571,7 @@ sendfile_getobj(struct thread *td, struct file *fp, vm_object_t *obj_res, struct shmfd *shmfd; int error; + error = 0; vp = *vp_res = NULL; obj = NULL; shmfd = *shmfd_res = NULL; @@ -610,7 +611,6 @@ sendfile_getobj(struct thread *td, struct file *fp, vm_object_t *obj_res, 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); From owner-dev-commits-src-branches@freebsd.org Sat Apr 3 15:14: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 8ABB45B65FE; Sat, 3 Apr 2021 15:14: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 4FCL6t3XwQz4YvN; Sat, 3 Apr 2021 15:14: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 6C6A114DF7; Sat, 3 Apr 2021 15:14: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 133FEEJD089301; Sat, 3 Apr 2021 15:14:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 133FEE62089300; Sat, 3 Apr 2021 15:14:14 GMT (envelope-from git) Date: Sat, 3 Apr 2021 15:14:14 GMT Message-Id: <202104031514.133FEE62089300@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: cbadf77834e1 - stable/13 - libctf: Fix an out-of-bounds read in ctf_lookup_by_name() 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: cbadf77834e145d42ff9805694c4fccd44df7f8b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 03 Apr 2021 15:14:14 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=cbadf77834e145d42ff9805694c4fccd44df7f8b commit cbadf77834e145d42ff9805694c4fccd44df7f8b Author: Domagoj Stolfa AuthorDate: 2021-03-27 18:04:12 +0000 Commit: Mark Johnston CommitDate: 2021-04-03 15:11:55 +0000 libctf: Fix an out-of-bounds read in ctf_lookup_by_name() When prefixes such as struct, union, etc. are compared with the current type (e.g. struct foo), a comparison is made with the prefix. The code currently assumes that every type is a valid C type with a prefix, however at times, garbage ends up in this function causing an unpredictable crash with DTrace due to the isspace(*p) call or subsequent calls. An example that I've seen of this is the letter 's' being passed in, comparing true with struct as the comparison size was (q - p) == 1, but then we increment p with the length of "struct", resulting in an out of bounds read. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D29435 (cherry picked from commit 410556f1f10fd35b350102725fd8504c3cb0afc8) --- cddl/contrib/opensolaris/common/ctf/ctf_lookup.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cddl/contrib/opensolaris/common/ctf/ctf_lookup.c b/cddl/contrib/opensolaris/common/ctf/ctf_lookup.c index aa58663309b6..5912cc1a36e8 100644 --- a/cddl/contrib/opensolaris/common/ctf/ctf_lookup.c +++ b/cddl/contrib/opensolaris/common/ctf/ctf_lookup.c @@ -132,8 +132,9 @@ ctf_lookup_by_name(ctf_file_t *fp, const char *name) continue; /* skip qualifier keyword */ for (lp = fp->ctf_lookups; lp->ctl_prefix != NULL; lp++) { - if (lp->ctl_prefix[0] == '\0' || - strncmp(p, lp->ctl_prefix, (size_t)(q - p)) == 0) { + if ((size_t)(q - p) >= lp->ctl_len && + (lp->ctl_prefix[0] == '\0' || + strncmp(p, lp->ctl_prefix, (size_t)(q - p)) == 0)) { for (p += lp->ctl_len; isspace(*p); p++) continue; /* skip prefix and next ws */ From owner-dev-commits-src-branches@freebsd.org Sat Apr 3 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 070E45B6E8A; Sat, 3 Apr 2021 15:14:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FCL6v5f8dz4ZBT; Sat, 3 Apr 2021 15:14: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 A1CEC149E4; Sat, 3 Apr 2021 15:14: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 133FEF8W089323; Sat, 3 Apr 2021 15:14:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 133FEF6U089322; Sat, 3 Apr 2021 15:14:15 GMT (envelope-from git) Date: Sat, 3 Apr 2021 15:14:15 GMT Message-Id: <202104031514.133FEF6U089322@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: e3b1b9d625ca - stable/13 - libctf: Adjust logic to match upstream after 410556f1f 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: e3b1b9d625ca6e816b91e0e58142cfc7743cacb8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 03 Apr 2021 15:14:16 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e3b1b9d625ca6e816b91e0e58142cfc7743cacb8 commit e3b1b9d625ca6e816b91e0e58142cfc7743cacb8 Author: Mark Johnston AuthorDate: 2021-03-28 00:36:44 +0000 Commit: Mark Johnston CommitDate: 2021-04-03 15:12:09 +0000 libctf: Adjust logic to match upstream after 410556f1f No functional change intended. Suggested by: jrtc27 (cherry picked from commit 3c065eeaa7a5ebb56991f5c8123e343a83bf0f0d) --- cddl/contrib/opensolaris/common/ctf/ctf_lookup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cddl/contrib/opensolaris/common/ctf/ctf_lookup.c b/cddl/contrib/opensolaris/common/ctf/ctf_lookup.c index 5912cc1a36e8..cd9c71436938 100644 --- a/cddl/contrib/opensolaris/common/ctf/ctf_lookup.c +++ b/cddl/contrib/opensolaris/common/ctf/ctf_lookup.c @@ -132,9 +132,9 @@ ctf_lookup_by_name(ctf_file_t *fp, const char *name) continue; /* skip qualifier keyword */ for (lp = fp->ctf_lookups; lp->ctl_prefix != NULL; lp++) { - if ((size_t)(q - p) >= lp->ctl_len && - (lp->ctl_prefix[0] == '\0' || - strncmp(p, lp->ctl_prefix, (size_t)(q - p)) == 0)) { + if (lp->ctl_prefix[0] == '\0' || + ((size_t)(q - p) >= lp->ctl_len && strncmp(p, + lp->ctl_prefix, (size_t)(q - p)) == 0)) { for (p += lp->ctl_len; isspace(*p); p++) continue; /* skip prefix and next ws */ From owner-dev-commits-src-branches@freebsd.org Sat Apr 3 15:14: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 0AD565B6C70; Sat, 3 Apr 2021 15:14: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 4FCL6w73Kdz4ZH9; Sat, 3 Apr 2021 15:14:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ABA8F1528C; Sat, 3 Apr 2021 15:14:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 133FEGev089348; Sat, 3 Apr 2021 15:14:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 133FEGKH089347; Sat, 3 Apr 2021 15:14:16 GMT (envelope-from git) Date: Sat, 3 Apr 2021 15:14:16 GMT Message-Id: <202104031514.133FEGKH089347@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: ca20444e2ad6 - stable/13 - vfs: Add an assertion around name length limits 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: ca20444e2ad664c34bb12f1a24f4ca6dc407a5bc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 03 Apr 2021 15:14:22 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ca20444e2ad664c34bb12f1a24f4ca6dc407a5bc commit ca20444e2ad664c34bb12f1a24f4ca6dc407a5bc Author: Mark Johnston AuthorDate: 2021-03-27 17:42:48 +0000 Commit: Mark Johnston CommitDate: 2021-04-03 15:12:21 +0000 vfs: Add an assertion around name length limits Some filesystems assume that they can copy a name component, with length bounded by NAME_MAX, into a dirent buffer of size MAXNAMLEN. These constants have the same value; add a compile-time assertion to that effect. Reported by: Alexey Kulaev Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29431 (cherry picked from commit 71c160a8f614fa4812838002ba9d266af3cf988c) --- sys/kern/vfs_lookup.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index e881e8f909a4..07c89e634de4 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -747,6 +748,14 @@ needs_exclusive_leaf(struct mount *mp, int flags) return (0); } +/* + * Various filesystems expect to be able to copy a name component with length + * bounded by NAME_MAX into a directory entry buffer of size MAXNAMLEN. Make + * sure that these are the same size. + */ +_Static_assert(MAXNAMLEN == NAME_MAX, + "MAXNAMLEN and NAME_MAX have different values"); + /* * Search a pathname. * This is a very central and rather complicated routine. From owner-dev-commits-src-branches@freebsd.org Sun Apr 4 08:18: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 463A45CEBE7; Sun, 4 Apr 2021 08:18: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 4FCmsG17hnz4bqc; Sun, 4 Apr 2021 08:18: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 18EB9225A0; Sun, 4 Apr 2021 08:18: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 1348IvHv017707; Sun, 4 Apr 2021 08:18:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1348Iv7k017706; Sun, 4 Apr 2021 08:18:57 GMT (envelope-from git) Date: Sun, 4 Apr 2021 08:18:57 GMT Message-Id: <202104040818.1348Iv7k017706@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: d019c774e906 - stable/13 - loader: insert spaces around menu title 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: d019c774e9063e36c0a80e75df02df8b4b202f47 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 04 Apr 2021 08:18:58 -0000 The branch stable/13 has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=d019c774e9063e36c0a80e75df02df8b4b202f47 commit d019c774e9063e36c0a80e75df02df8b4b202f47 Author: Toomas Soome AuthorDate: 2021-03-23 05:04:48 +0000 Commit: Toomas Soome CommitDate: 2021-04-03 23:03:33 +0000 loader: insert spaces around menu title Small visual nit, make menu title more clean (cherry picked from 62ffcaab8f3ccba6053d4a5622c5ef2de9f636b5) --- stand/forth/menu.4th | 3 ++- stand/lua/drawer.lua | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/stand/forth/menu.4th b/stand/forth/menu.4th index 6b0869cfe3b9..a336b9f9e7aa 100644 --- a/stand/forth/menu.4th +++ b/stand/forth/menu.4th @@ -489,7 +489,8 @@ also menu-infrastructure definitions if ( use default center alignement? ) menuX @ 19 + over 2 / - menuY @ 1- then - at-xy type + swap 1- swap + at-xy space type space \ If $menu_init is set, evaluate it (allowing for whole menus to be \ constructed dynamically -- as this function could conceivably set diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index eb9b18117cd3..523735a75d06 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -285,8 +285,8 @@ local function drawbox() if menu_header_x == nil then menu_header_x = x + (w // 2) - (#menu_header // 2) end - screen.setcursor(menu_header_x, y) - printc(menu_header) + screen.setcursor(menu_header_x - 1, y) + printc(" " .. menu_header .. " ") end local function drawbrand() From owner-dev-commits-src-branches@freebsd.org Sun Apr 4 08:44: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 9DC8E5CFDD8; Sun, 4 Apr 2021 08:44: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 4FCnQh3bJ7z4f5d; Sun, 4 Apr 2021 08:44: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 69DEA22D08; Sun, 4 Apr 2021 08:44:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1348iSwU058930; Sun, 4 Apr 2021 08:44:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1348iSQB058929; Sun, 4 Apr 2021 08:44:28 GMT (envelope-from git) Date: Sun, 4 Apr 2021 08:44:28 GMT Message-Id: <202104040844.1348iSQB058929@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 1260724822b5 - stable/13 - Fix `netstat -rs` reporting. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1260724822b5830411cbf56d48e997be1628e53b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 04 Apr 2021 08:44:28 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=1260724822b5830411cbf56d48e997be1628e53b commit 1260724822b5830411cbf56d48e997be1628e53b Author: Alexander V. Chernikov AuthorDate: 2021-03-31 20:56:26 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-04 08:44:01 +0000 Fix `netstat -rs` reporting. rttrash (unused but not yet delete entries) were eliminated during routing rework. Remove reading these symbols from the kernel. PR: 254681 Reported by: rashey@superbox.pl (cherry picked from commit 4084b1ab0413d15dab496b1c24c3875601c71438) --- usr.bin/netstat/nlist_symbols | 1 - usr.bin/netstat/route.c | 13 +------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/usr.bin/netstat/nlist_symbols b/usr.bin/netstat/nlist_symbols index afad45d353bd..1c09d81c0b98 100644 --- a/usr.bin/netstat/nlist_symbols +++ b/usr.bin/netstat/nlist_symbols @@ -39,7 +39,6 @@ all _rip6stat all _ripcbinfo all _rtree all _rtstat -all _rttrash all _sctpstat all _sfstat all _tcbinfo diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index ba47a4b56ac5..317e3ffb9607 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -699,19 +699,13 @@ void rt_stats(void) { struct rtstat rtstat; - u_long rtsaddr, rttaddr; - int rttrash; + u_long rtsaddr; if ((rtsaddr = nl[N_RTSTAT].n_value) == 0) { xo_emit("{W:rtstat: symbol not in namelist}\n"); return; } - if ((rttaddr = nl[N_RTTRASH].n_value) == 0) { - xo_emit("{W:rttrash: symbol not in namelist}\n"); - return; - } kread_counters(rtsaddr, (char *)&rtstat, sizeof (rtstat)); - kread(rttaddr, (char *)&rttrash, sizeof (rttrash)); xo_emit("{T:routing}:\n"); #define p(f, m) if (rtstat.f || sflag <= 1) \ @@ -728,9 +722,4 @@ rt_stats(void) p(rts_wildcard, "\t{:wildcard-uses/%ju} " "{N:/use%s of a wildcard route}\n"); #undef p - - if (rttrash || sflag <= 1) - xo_emit("\t{:unused-but-not-freed/%u} " - "{N:/route%s not in table but not freed}\n", - rttrash, plural(rttrash)); } From owner-dev-commits-src-branches@freebsd.org Sun Apr 4 13:19: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 BEA545D6F47; Sun, 4 Apr 2021 13:19: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 4FCvWT4cMdz3C5j; Sun, 4 Apr 2021 13:19: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 88C55263A0; Sun, 4 Apr 2021 13:19: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 134DJ15N036900; Sun, 4 Apr 2021 13:19:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 134DJ1Ul036899; Sun, 4 Apr 2021 13:19:01 GMT (envelope-from git) Date: Sun, 4 Apr 2021 13:19:01 GMT Message-Id: <202104041319.134DJ1Ul036899@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: cf2a72643460 - stable/13 - zfs: merge OpenZFS master-9305ff2ed 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: cf2a72643460a2bb50fcdf78fb8721a692315793 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 04 Apr 2021 13:19:02 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=cf2a72643460a2bb50fcdf78fb8721a692315793 commit cf2a72643460a2bb50fcdf78fb8721a692315793 Author: Martin Matuska AuthorDate: 2021-03-14 01:23:51 +0000 Commit: Martin Matuska CommitDate: 2021-04-04 13:18:45 +0000 zfs: merge OpenZFS master-9305ff2ed Notable upstream pull request merges: #11153 Scalable teardown lock for FreeBSD #11651 Don't bomb out when using keylocation=file:// #11667 zvol: call zil_replaying() during replay #11683 abd_get_offset_struct() may allocate new abd #11693 Intentionally allow ZFS_READONLY in zfs_write #11716 zpool import cachefile improvements #11720 FreeBSD: Clean up zfsdev_close to match Linux #11730 FreeBSD: bring back possibility to rewind the checkpoint from bootloader Obtained from: OpenZFS (cherry picked from commit 9db44a8e5da9bf1ce6dd1c0f1468ddafed6d6c91) --- .../openzfs/.github/workflows/checkstyle.yaml | 2 +- sys/contrib/openzfs/cmd/vdev_id/vdev_id | 9 +- sys/contrib/openzfs/cmd/zpool/zpool_main.c | 307 +++++++++++++-------- sys/contrib/openzfs/cmd/zstream/zstream_redup.c | 1 + sys/contrib/openzfs/config/zfs-build.m4 | 36 +++ sys/contrib/openzfs/configure.ac | 1 + .../openzfs/include/os/freebsd/spl/sys/Makefile.am | 3 + .../openzfs/include/os/freebsd/spl/sys/debug.h | 80 +++--- .../include/os/freebsd/zfs/sys/zfs_vfsops_os.h | 2 +- .../openzfs/include/os/linux/spl/sys/debug.h | 78 +++--- .../include/os/linux/zfs/sys/zfs_vfsops_os.h | 33 +++ .../include/os/linux/zfs/sys/zfs_znode_impl.h | 4 +- sys/contrib/openzfs/include/sys/dmu_redact.h | 2 + sys/contrib/openzfs/include/sys/zfs_ioctl.h | 1 - sys/contrib/openzfs/lib/libzfs/libzfs_crypto.c | 10 +- sys/contrib/openzfs/lib/libzfs/libzfs_mount.c | 25 +- .../openzfs/lib/libzfs/os/freebsd/libzfs_zmount.c | 5 +- .../openzfs/lib/libzfs/os/linux/libzfs_mount_os.c | 6 +- sys/contrib/openzfs/lib/libzutil/zutil_import.c | 177 +++++++++--- sys/contrib/openzfs/man/man8/zfs-receive.8 | 10 + sys/contrib/openzfs/man/man8/zfs-send.8 | 7 +- sys/contrib/openzfs/module/Makefile.in | 5 + .../openzfs/module/os/freebsd/zfs/kmod_core.c | 18 +- .../openzfs/module/os/freebsd/zfs/zfs_dir.c | 2 - .../openzfs/module/os/freebsd/zfs/zvol_os.c | 9 +- sys/contrib/openzfs/module/os/linux/zfs/zfs_acl.c | 26 +- .../openzfs/module/os/linux/zfs/zio_crypt.c | 1 + sys/contrib/openzfs/module/os/linux/zfs/zvol_os.c | 102 +++++-- sys/contrib/openzfs/module/zcommon/zfs_prop.c | 2 +- sys/contrib/openzfs/module/zfs/abd.c | 6 +- sys/contrib/openzfs/module/zfs/spa_misc.c | 4 +- sys/contrib/openzfs/module/zfs/zfs_vnops.c | 6 +- sys/contrib/openzfs/module/zfs/zvol.c | 15 +- sys/contrib/openzfs/tests/runfiles/common.run | 1 + .../openzfs/tests/zfs-tests/include/commands.cfg | 2 +- .../openzfs/tests/zfs-tests/include/libtest.shlib | 19 +- .../openzfs/tests/zfs-tests/include/tunables.cfg | 8 +- .../functional/cli_root/zpool/zpool_002_pos.ksh | 37 ++- .../functional/cli_root/zpool/zpool_003_pos.ksh | 39 ++- .../functional/cli_root/zpool_import/Makefile.am | 1 + .../import_cachefile_paths_changed.ksh | 117 ++++++++ .../tests/functional/events/events_002_pos.ksh | 7 +- .../tests/functional/xattr/xattr_003_neg.ksh | 44 +-- sys/modules/zfs/zfs_config.h | 4 +- 44 files changed, 896 insertions(+), 378 deletions(-) diff --git a/sys/contrib/openzfs/.github/workflows/checkstyle.yaml b/sys/contrib/openzfs/.github/workflows/checkstyle.yaml index 1707f5bb21db..8dcd5047a748 100644 --- a/sys/contrib/openzfs/.github/workflows/checkstyle.yaml +++ b/sys/contrib/openzfs/.github/workflows/checkstyle.yaml @@ -6,7 +6,7 @@ on: jobs: checkstyle: - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 with: diff --git a/sys/contrib/openzfs/cmd/vdev_id/vdev_id b/sys/contrib/openzfs/cmd/vdev_id/vdev_id index 8a379a72690e..d8918da1078c 100755 --- a/sys/contrib/openzfs/cmd/vdev_id/vdev_id +++ b/sys/contrib/openzfs/cmd/vdev_id/vdev_id @@ -298,8 +298,15 @@ sas_handler() { # Utilize DM device name to gather subordinate block devices # using sysfs to avoid userspace utilities - DMDEV=$(ls -l --full-time /dev/mapper | grep $DM_NAME | + + # If our DEVNAME is something like /dev/dm-177, then we may be + # able to get our DMDEV from it. + DMDEV=$(echo $DEVNAME | sed 's;/dev/;;g') + if [ ! -e /sys/block/$DMDEV/slaves/* ] ; then + # It's not there, try looking in /dev/mapper + DMDEV=$(ls -l --full-time /dev/mapper | grep $DM_NAME | awk '{gsub("../", " "); print $NF}') + fi # Use sysfs pointers in /sys/block/dm-X/slaves because using # userspace tools creates lots of overhead and should be avoided diff --git a/sys/contrib/openzfs/cmd/zpool/zpool_main.c b/sys/contrib/openzfs/cmd/zpool/zpool_main.c index e89eb3bea770..e23604b3d81c 100644 --- a/sys/contrib/openzfs/cmd/zpool/zpool_main.c +++ b/sys/contrib/openzfs/cmd/zpool/zpool_main.c @@ -2623,8 +2623,8 @@ print_class_vdevs(zpool_handle_t *zhp, status_cbdata_t *cb, nvlist_t *nv, /* * Display the status for the given pool. */ -static void -show_import(nvlist_t *config) +static int +show_import(nvlist_t *config, boolean_t report_error) { uint64_t pool_state; vdev_stat_t *vs; @@ -2656,6 +2656,13 @@ show_import(nvlist_t *config) reason = zpool_import_status(config, &msgid, &errata); + /* + * If we're importing using a cachefile, then we won't report any + * errors unless we are in the scan phase of the import. + */ + if (reason != ZPOOL_STATUS_OK && !report_error) + return (reason); + (void) printf(gettext(" pool: %s\n"), name); (void) printf(gettext(" id: %llu\n"), (u_longlong_t)guid); (void) printf(gettext(" state: %s"), health); @@ -2983,6 +2990,7 @@ show_import(nvlist_t *config) "be part of this pool, though their\n\texact " "configuration cannot be determined.\n")); } + return (0); } static boolean_t @@ -3121,6 +3129,121 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts, return (ret); } +static int +import_pools(nvlist_t *pools, nvlist_t *props, char *mntopts, int flags, + char *orig_name, char *new_name, + boolean_t do_destroyed, boolean_t pool_specified, boolean_t do_all, + importargs_t *import) +{ + nvlist_t *config = NULL; + nvlist_t *found_config = NULL; + uint64_t pool_state; + + /* + * At this point we have a list of import candidate configs. Even if + * we were searching by pool name or guid, we still need to + * post-process the list to deal with pool state and possible + * duplicate names. + */ + int err = 0; + nvpair_t *elem = NULL; + boolean_t first = B_TRUE; + while ((elem = nvlist_next_nvpair(pools, elem)) != NULL) { + + verify(nvpair_value_nvlist(elem, &config) == 0); + + verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE, + &pool_state) == 0); + if (!do_destroyed && pool_state == POOL_STATE_DESTROYED) + continue; + if (do_destroyed && pool_state != POOL_STATE_DESTROYED) + continue; + + verify(nvlist_add_nvlist(config, ZPOOL_LOAD_POLICY, + import->policy) == 0); + + if (!pool_specified) { + if (first) + first = B_FALSE; + else if (!do_all) + (void) printf("\n"); + + if (do_all) { + err |= do_import(config, NULL, mntopts, + props, flags); + } else { + /* + * If we're importing from cachefile, then + * we don't want to report errors until we + * are in the scan phase of the import. If + * we get an error, then we return that error + * to invoke the scan phase. + */ + if (import->cachefile && !import->scan) + err = show_import(config, B_FALSE); + else + (void) show_import(config, B_TRUE); + } + } else if (import->poolname != NULL) { + char *name; + + /* + * We are searching for a pool based on name. + */ + verify(nvlist_lookup_string(config, + ZPOOL_CONFIG_POOL_NAME, &name) == 0); + + if (strcmp(name, import->poolname) == 0) { + if (found_config != NULL) { + (void) fprintf(stderr, gettext( + "cannot import '%s': more than " + "one matching pool\n"), + import->poolname); + (void) fprintf(stderr, gettext( + "import by numeric ID instead\n")); + err = B_TRUE; + } + found_config = config; + } + } else { + uint64_t guid; + + /* + * Search for a pool by guid. + */ + verify(nvlist_lookup_uint64(config, + ZPOOL_CONFIG_POOL_GUID, &guid) == 0); + + if (guid == import->guid) + found_config = config; + } + } + + /* + * If we were searching for a specific pool, verify that we found a + * pool, and then do the import. + */ + if (pool_specified && err == 0) { + if (found_config == NULL) { + (void) fprintf(stderr, gettext("cannot import '%s': " + "no such pool available\n"), orig_name); + err = B_TRUE; + } else { + err |= do_import(found_config, new_name, + mntopts, props, flags); + } + } + + /* + * If we were just looking for pools, report an error if none were + * found. + */ + if (!pool_specified && first) + (void) fprintf(stderr, + gettext("no pools available to import\n")); + return (err); +} + typedef struct target_exists_args { const char *poolname; uint64_t poolguid; @@ -3248,51 +3371,54 @@ zpool_do_checkpoint(int argc, char **argv) /* * zpool import [-d dir] [-D] * import [-o mntopts] [-o prop=value] ... [-R root] [-D] [-l] - * [-d dir | -c cachefile] [-f] -a + * [-d dir | -c cachefile | -s] [-f] -a * import [-o mntopts] [-o prop=value] ... [-R root] [-D] [-l] - * [-d dir | -c cachefile] [-f] [-n] [-F] [newpool] + * [-d dir | -c cachefile | -s] [-f] [-n] [-F] + * [newpool] * - * -c Read pool information from a cachefile instead of searching - * devices. + * -c Read pool information from a cachefile instead of searching + * devices. If importing from a cachefile config fails, then + * fallback to searching for devices only in the directories that + * exist in the cachefile. * - * -d Scan in a specific directory, other than /dev/. More than + * -d Scan in a specific directory, other than /dev/. More than * one directory can be specified using multiple '-d' options. * - * -D Scan for previously destroyed pools or import all or only - * specified destroyed pools. + * -D Scan for previously destroyed pools or import all or only + * specified destroyed pools. * - * -R Temporarily import the pool, with all mountpoints relative to + * -R Temporarily import the pool, with all mountpoints relative to * the given root. The pool will remain exported when the machine * is rebooted. * - * -V Import even in the presence of faulted vdevs. This is an - * intentionally undocumented option for testing purposes, and - * treats the pool configuration as complete, leaving any bad + * -V Import even in the presence of faulted vdevs. This is an + * intentionally undocumented option for testing purposes, and + * treats the pool configuration as complete, leaving any bad * vdevs in the FAULTED state. In other words, it does verbatim * import. * - * -f Force import, even if it appears that the pool is active. + * -f Force import, even if it appears that the pool is active. * - * -F Attempt rewind if necessary. + * -F Attempt rewind if necessary. * - * -n See if rewind would work, but don't actually rewind. + * -n See if rewind would work, but don't actually rewind. * - * -N Import the pool but don't mount datasets. + * -N Import the pool but don't mount datasets. * - * -T Specify a starting txg to use for import. This option is - * intentionally undocumented option for testing purposes. + * -T Specify a starting txg to use for import. This option is + * intentionally undocumented option for testing purposes. * - * -a Import all pools found. + * -a Import all pools found. * - * -l Load encryption keys while importing. + * -l Load encryption keys while importing. * - * -o Set property=value and/or temporary mount options (without '='). + * -o Set property=value and/or temporary mount options (without '='). * - * -s Scan using the default search path, the libblkid cache will - * not be consulted. + * -s Scan using the default search path, the libblkid cache will + * not be consulted. * - * --rewind-to-checkpoint - * Import the pool and revert back to the checkpoint. + * --rewind-to-checkpoint + * Import the pool and revert back to the checkpoint. * * The import command scans for pools to import, and import pools based on pool * name and GUID. The pool can also be renamed as part of the import process. @@ -3309,15 +3435,11 @@ zpool_do_import(int argc, char **argv) boolean_t do_all = B_FALSE; boolean_t do_destroyed = B_FALSE; char *mntopts = NULL; - nvpair_t *elem; - nvlist_t *config; uint64_t searchguid = 0; char *searchname = NULL; char *propval; - nvlist_t *found_config; nvlist_t *policy = NULL; nvlist_t *props = NULL; - boolean_t first; int flags = ZFS_IMPORT_NORMAL; uint32_t rewind_policy = ZPOOL_NO_REWIND; boolean_t dryrun = B_FALSE; @@ -3325,7 +3447,8 @@ zpool_do_import(int argc, char **argv) boolean_t xtreme_rewind = B_FALSE; boolean_t do_scan = B_FALSE; boolean_t pool_exists = B_FALSE; - uint64_t pool_state, txg = -1ULL; + boolean_t pool_specified = B_FALSE; + uint64_t txg = -1ULL; char *cachefile = NULL; importargs_t idata = { 0 }; char *endptr; @@ -3447,6 +3570,11 @@ zpool_do_import(int argc, char **argv) usage(B_FALSE); } + if (cachefile && do_scan) { + (void) fprintf(stderr, gettext("-c is incompatible with -s\n")); + usage(B_FALSE); + } + if ((flags & ZFS_IMPORT_LOAD_KEYS) && (flags & ZFS_IMPORT_ONLY)) { (void) fprintf(stderr, gettext("-l is incompatible with -N\n")); usage(B_FALSE); @@ -3527,7 +3655,7 @@ zpool_do_import(int argc, char **argv) searchname = argv[0]; searchguid = 0; } - found_config = NULL; + pool_specified = B_TRUE; /* * User specified a name or guid. Ensure it's unique. @@ -3606,98 +3734,33 @@ zpool_do_import(int argc, char **argv) return (1); } + err = import_pools(pools, props, mntopts, flags, argv[0], + argc == 1 ? NULL : argv[1], do_destroyed, pool_specified, + do_all, &idata); + /* - * At this point we have a list of import candidate configs. Even if - * we were searching by pool name or guid, we still need to - * post-process the list to deal with pool state and possible - * duplicate names. + * If we're using the cachefile and we failed to import, then + * fallback to scanning the directory for pools that match + * those in the cachefile. */ - err = 0; - elem = NULL; - first = B_TRUE; - while ((elem = nvlist_next_nvpair(pools, elem)) != NULL) { - - verify(nvpair_value_nvlist(elem, &config) == 0); - - verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE, - &pool_state) == 0); - if (!do_destroyed && pool_state == POOL_STATE_DESTROYED) - continue; - if (do_destroyed && pool_state != POOL_STATE_DESTROYED) - continue; - - verify(nvlist_add_nvlist(config, ZPOOL_LOAD_POLICY, - policy) == 0); - - if (argc == 0) { - if (first) - first = B_FALSE; - else if (!do_all) - (void) printf("\n"); - - if (do_all) { - err |= do_import(config, NULL, mntopts, - props, flags); - } else { - show_import(config); - } - } else if (searchname != NULL) { - char *name; - - /* - * We are searching for a pool based on name. - */ - verify(nvlist_lookup_string(config, - ZPOOL_CONFIG_POOL_NAME, &name) == 0); + if (err != 0 && cachefile != NULL) { + (void) printf(gettext("cachefile import failed, retrying\n")); - if (strcmp(name, searchname) == 0) { - if (found_config != NULL) { - (void) fprintf(stderr, gettext( - "cannot import '%s': more than " - "one matching pool\n"), searchname); - (void) fprintf(stderr, gettext( - "import by numeric ID instead\n")); - err = B_TRUE; - } - found_config = config; - } - } else { - uint64_t guid; - - /* - * Search for a pool by guid. - */ - verify(nvlist_lookup_uint64(config, - ZPOOL_CONFIG_POOL_GUID, &guid) == 0); - - if (guid == searchguid) - found_config = config; - } - } + /* + * We use the scan flag to gather the directories that exist + * in the cachefile. If we need to fallback to searching for + * the pool config, we will only search devices in these + * directories. + */ + idata.scan = B_TRUE; + nvlist_free(pools); + pools = zpool_search_import(g_zfs, &idata, &libzfs_config_ops); - /* - * If we were searching for a specific pool, verify that we found a - * pool, and then do the import. - */ - if (argc != 0 && err == 0) { - if (found_config == NULL) { - (void) fprintf(stderr, gettext("cannot import '%s': " - "no such pool available\n"), argv[0]); - err = B_TRUE; - } else { - err |= do_import(found_config, argc == 1 ? NULL : - argv[1], mntopts, props, flags); - } + err = import_pools(pools, props, mntopts, flags, argv[0], + argc == 1 ? NULL : argv[1], do_destroyed, pool_specified, + do_all, &idata); } - /* - * If we were just looking for pools, report an error if none were - * found. - */ - if (argc == 0 && first) - (void) fprintf(stderr, - gettext("no pools available to import\n")); - error: nvlist_free(props); nvlist_free(pools); @@ -7785,8 +7848,8 @@ print_removal_status(zpool_handle_t *zhp, pool_removal_stat_t *prs) * do not print estimated time if hours_left is more than * 30 days */ - (void) printf(gettext(" %s copied out of %s at %s/s, " - "%.2f%% done"), + (void) printf(gettext( + "\t%s copied out of %s at %s/s, %.2f%% done"), examined_buf, total_buf, rate_buf, 100 * fraction_done); if (hours_left < (30 * 24)) { (void) printf(gettext(", %lluh%um to go\n"), @@ -7801,8 +7864,8 @@ print_removal_status(zpool_handle_t *zhp, pool_removal_stat_t *prs) if (prs->prs_mapping_memory > 0) { char mem_buf[7]; zfs_nicenum(prs->prs_mapping_memory, mem_buf, sizeof (mem_buf)); - (void) printf(gettext(" %s memory used for " - "removed device mappings\n"), + (void) printf(gettext( + "\t%s memory used for removed device mappings\n"), mem_buf); } } diff --git a/sys/contrib/openzfs/cmd/zstream/zstream_redup.c b/sys/contrib/openzfs/cmd/zstream/zstream_redup.c index 41f1068e3dfc..15dd8a1ed126 100644 --- a/sys/contrib/openzfs/cmd/zstream/zstream_redup.c +++ b/sys/contrib/openzfs/cmd/zstream/zstream_redup.c @@ -248,6 +248,7 @@ zfs_redup_stream(int infd, int outfd, boolean_t verbose) fflags = DMU_GET_FEATUREFLAGS(drrb->drr_versioninfo); fflags &= ~(DMU_BACKUP_FEATURE_DEDUP | DMU_BACKUP_FEATURE_DEDUPPROPS); + /* cppcheck-suppress syntaxError */ DMU_SET_FEATUREFLAGS(drrb->drr_versioninfo, fflags); int sz = drr->drr_payloadlen; diff --git a/sys/contrib/openzfs/config/zfs-build.m4 b/sys/contrib/openzfs/config/zfs-build.m4 index 305d0c6936b2..cd5996c0424c 100644 --- a/sys/contrib/openzfs/config/zfs-build.m4 +++ b/sys/contrib/openzfs/config/zfs-build.m4 @@ -11,6 +11,7 @@ AC_DEFUN([ZFS_AC_DEBUG_ENABLE], [ DEBUG_CPPFLAGS="-DDEBUG -UNDEBUG" DEBUG_LDFLAGS="" DEBUG_ZFS="_with_debug" + WITH_DEBUG="true" AC_DEFINE(ZFS_DEBUG, 1, [zfs debugging enabled]) KERNEL_DEBUG_CFLAGS="-Werror" @@ -22,6 +23,7 @@ AC_DEFUN([ZFS_AC_DEBUG_DISABLE], [ DEBUG_CPPFLAGS="-UDEBUG -DNDEBUG" DEBUG_LDFLAGS="" DEBUG_ZFS="_without_debug" + WITH_DEBUG="" KERNEL_DEBUG_CFLAGS="" KERNEL_DEBUG_CPPFLAGS="-UDEBUG -DNDEBUG" @@ -51,6 +53,7 @@ AC_DEFUN([ZFS_AC_DEBUG], [ AC_SUBST(DEBUG_CPPFLAGS) AC_SUBST(DEBUG_LDFLAGS) AC_SUBST(DEBUG_ZFS) + AC_SUBST(WITH_DEBUG) AC_SUBST(KERNEL_DEBUG_CFLAGS) AC_SUBST(KERNEL_DEBUG_CPPFLAGS) @@ -152,6 +155,39 @@ AC_DEFUN([ZFS_AC_DEBUG_KMEM_TRACKING], [ AC_MSG_RESULT([$enable_debug_kmem_tracking]) ]) +AC_DEFUN([ZFS_AC_DEBUG_INVARIANTS_DETECT_FREEBSD], [ + AS_IF([sysctl -n kern.conftxt | fgrep -qx $'options\tINVARIANTS'], + [enable_invariants="yes"], + [enable_invariants="no"]) +]) + +AC_DEFUN([ZFS_AC_DEBUG_INVARIANTS_DETECT], [ + AM_COND_IF([BUILD_FREEBSD], + [ZFS_AC_DEBUG_INVARIANTS_DETECT_FREEBSD], + [enable_invariants="no"]) +]) + +dnl # +dnl # Detected for the running kernel by default, enables INVARIANTS features +dnl # in the FreeBSD kernel module. This feature must be used when building +dnl # for a FreeBSD kernel with "options INVARIANTS" in the KERNCONF and must +dnl # not be used when the INVARIANTS option is absent. +dnl # +AC_DEFUN([ZFS_AC_DEBUG_INVARIANTS], [ + AC_MSG_CHECKING([whether FreeBSD kernel INVARIANTS checks are enabled]) + AC_ARG_ENABLE([invariants], + [AS_HELP_STRING([--enable-invariants], + [Enable FreeBSD kernel INVARIANTS checks [[default: detect]]])], + [], [ZFS_AC_DEBUG_INVARIANTS_DETECT]) + + AS_IF([test "x$enable_invariants" = xyes], + [WITH_INVARIANTS="true"], + [WITH_INVARIANTS=""]) + AC_SUBST(WITH_INVARIANTS) + + AC_MSG_RESULT([$enable_invariants]) +]) + AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [ AX_COUNT_CPUS([]) AC_SUBST(CPU_COUNT) diff --git a/sys/contrib/openzfs/configure.ac b/sys/contrib/openzfs/configure.ac index b2d88554ed7d..07f590b390bd 100644 --- a/sys/contrib/openzfs/configure.ac +++ b/sys/contrib/openzfs/configure.ac @@ -61,6 +61,7 @@ ZFS_AC_DEBUG ZFS_AC_DEBUGINFO ZFS_AC_DEBUG_KMEM ZFS_AC_DEBUG_KMEM_TRACKING +ZFS_AC_DEBUG_INVARIANTS AC_CONFIG_FILES([ Makefile diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/Makefile.am b/sys/contrib/openzfs/include/os/freebsd/spl/sys/Makefile.am index ca45b42b6b8d..6bee47830d9c 100644 --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/Makefile.am +++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/Makefile.am @@ -4,6 +4,7 @@ KERNEL_H = \ atomic.h \ byteorder.h \ callb.h \ + ccompat.h \ ccompile.h \ cmn_err.h \ condvar.h \ @@ -18,9 +19,11 @@ KERNEL_H = \ fcntl.h \ file.h \ freebsd_rwlock.h \ + idmap.h \ inttypes.h \ isa_defs.h \ kmem_cache.h \ + kidmap.h \ kmem.h \ kstat.h \ list_impl.h \ diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/debug.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/debug.h index 2751f57801f7..1f820bc3345f 100644 --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/debug.h +++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/debug.h @@ -68,65 +68,65 @@ void spl_dumpstack(void); #define PANIC(fmt, a...) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, fmt, ## a) -#define VERIFY(cond) \ - (void) (unlikely(!(cond)) && \ +#define VERIFY(cond) \ + (void) (unlikely(!(cond)) && \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "%s", "VERIFY(" #cond ") failed\n")) -#define VERIFY3B(LEFT, OP, RIGHT) do { \ - boolean_t _verify3_left = (boolean_t)(LEFT); \ - boolean_t _verify3_right = (boolean_t)(RIGHT); \ - if (!(_verify3_left OP _verify3_right)) \ +#define VERIFY3B(LEFT, OP, RIGHT) do { \ + const boolean_t _verify3_left = (boolean_t)(LEFT); \ + const boolean_t _verify3_right = (boolean_t)(RIGHT);\ + if (unlikely(!(_verify3_left OP _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (%d " #OP " %d)\n", \ - (boolean_t) (_verify3_left), \ - (boolean_t) (_verify3_right)); \ + "failed (%d " #OP " %d)\n", \ + (boolean_t) (_verify3_left), \ + (boolean_t) (_verify3_right)); \ } while (0) -#define VERIFY3S(LEFT, OP, RIGHT) do { \ - int64_t _verify3_left = (int64_t)(LEFT); \ - int64_t _verify3_right = (int64_t)(RIGHT); \ - if (!(_verify3_left OP _verify3_right)) \ +#define VERIFY3S(LEFT, OP, RIGHT) do { \ + const int64_t _verify3_left = (int64_t)(LEFT); \ + const int64_t _verify3_right = (int64_t)(RIGHT); \ + if (unlikely(!(_verify3_left OP _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (%lld " #OP " %lld)\n", \ - (long long) (_verify3_left), \ - (long long) (_verify3_right)); \ + "failed (%lld " #OP " %lld)\n", \ + (long long) (_verify3_left), \ + (long long) (_verify3_right)); \ } while (0) -#define VERIFY3U(LEFT, OP, RIGHT) do { \ - uint64_t _verify3_left = (uint64_t)(LEFT); \ - uint64_t _verify3_right = (uint64_t)(RIGHT); \ - if (!(_verify3_left OP _verify3_right)) \ +#define VERIFY3U(LEFT, OP, RIGHT) do { \ + const uint64_t _verify3_left = (uint64_t)(LEFT); \ + const uint64_t _verify3_right = (uint64_t)(RIGHT); \ + if (unlikely(!(_verify3_left OP _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (%llu " #OP " %llu)\n", \ - (unsigned long long) (_verify3_left), \ - (unsigned long long) (_verify3_right)); \ + "failed (%llu " #OP " %llu)\n", \ + (unsigned long long) (_verify3_left), \ + (unsigned long long) (_verify3_right)); \ } while (0) -#define VERIFY3P(LEFT, OP, RIGHT) do { \ - uintptr_t _verify3_left = (uintptr_t)(LEFT); \ - uintptr_t _verify3_right = (uintptr_t)(RIGHT); \ - if (!(_verify3_left OP _verify3_right)) \ +#define VERIFY3P(LEFT, OP, RIGHT) do { \ + const uintptr_t _verify3_left = (uintptr_t)(LEFT); \ + const uintptr_t _verify3_right = (uintptr_t)(RIGHT);\ + if (unlikely(!(_verify3_left OP _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (%px " #OP " %px)\n", \ - (void *) (_verify3_left), \ - (void *) (_verify3_right)); \ + "failed (%px " #OP " %px)\n", \ + (void *) (_verify3_left), \ + (void *) (_verify3_right)); \ } while (0) -#define VERIFY0(RIGHT) do { \ - int64_t _verify3_left = (int64_t)(0); \ - int64_t _verify3_right = (int64_t)(RIGHT); \ - if (!(_verify3_left == _verify3_right)) \ +#define VERIFY0(RIGHT) do { \ + const int64_t _verify3_left = (int64_t)(0); \ + const int64_t _verify3_right = (int64_t)(RIGHT); \ + if (unlikely(!(_verify3_left == _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ - "VERIFY3(0 == " #RIGHT ") " \ - "failed (0 == %lld)\n", \ - (long long) (_verify3_right)); \ + "VERIFY3(0 == " #RIGHT ") " \ + "failed (0 == %lld)\n", \ + (long long) (_verify3_right)); \ } while (0) -#define CTASSERT_GLOBAL(x) CTASSERT(x) +#define CTASSERT_GLOBAL(x) CTASSERT(x) /* * Debugging disabled (--disable-debug) @@ -154,11 +154,11 @@ void spl_dumpstack(void); #define ASSERT0 VERIFY0 #define ASSERT VERIFY #define IMPLY(A, B) \ - ((void)(((!(A)) || (B)) || \ + ((void)(likely((!(A)) || (B)) || \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "(" #A ") implies (" #B ")"))) #define EQUIV(A, B) \ - ((void)((!!(A) == !!(B)) || \ + ((void)(likely(!!(A) == !!(B)) || \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "(" #A ") is equivalent to (" #B ")"))) /* END CSTYLED */ diff --git a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h index 5d8e5978a3cb..a263b48f7517 100644 --- a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h +++ b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h @@ -27,7 +27,7 @@ #ifndef _SYS_FS_ZFS_VFSOPS_H #define _SYS_FS_ZFS_VFSOPS_H -#if __FreeBSD_version >= 1300109 +#if __FreeBSD_version >= 1300125 #define TEARDOWN_RMS #endif diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/debug.h b/sys/contrib/openzfs/include/os/linux/spl/sys/debug.h index 46da5c783397..dc6b85eebff7 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/debug.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/debug.h @@ -62,63 +62,63 @@ void spl_dumpstack(void); #define PANIC(fmt, a...) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, fmt, ## a) -#define VERIFY(cond) \ - (void) (unlikely(!(cond)) && \ +#define VERIFY(cond) \ + (void) (unlikely(!(cond)) && \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "%s", "VERIFY(" #cond ") failed\n")) -#define VERIFY3B(LEFT, OP, RIGHT) do { \ - boolean_t _verify3_left = (boolean_t)(LEFT); \ - boolean_t _verify3_right = (boolean_t)(RIGHT); \ - if (!(_verify3_left OP _verify3_right)) \ +#define VERIFY3B(LEFT, OP, RIGHT) do { \ + const boolean_t _verify3_left = (boolean_t)(LEFT); \ + const boolean_t _verify3_right = (boolean_t)(RIGHT);\ + if (unlikely(!(_verify3_left OP _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (%d " #OP " %d)\n", \ - (boolean_t) (_verify3_left), \ - (boolean_t) (_verify3_right)); \ + "failed (%d " #OP " %d)\n", \ + (boolean_t) (_verify3_left), \ + (boolean_t) (_verify3_right)); \ } while (0) -#define VERIFY3S(LEFT, OP, RIGHT) do { \ - int64_t _verify3_left = (int64_t)(LEFT); \ - int64_t _verify3_right = (int64_t)(RIGHT); \ - if (!(_verify3_left OP _verify3_right)) \ +#define VERIFY3S(LEFT, OP, RIGHT) do { \ + const int64_t _verify3_left = (int64_t)(LEFT); \ + const int64_t _verify3_right = (int64_t)(RIGHT); \ + if (unlikely(!(_verify3_left OP _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (%lld " #OP " %lld)\n", \ - (long long) (_verify3_left), \ - (long long) (_verify3_right)); \ + "failed (%lld " #OP " %lld)\n", \ + (long long) (_verify3_left), \ + (long long) (_verify3_right)); \ } while (0) -#define VERIFY3U(LEFT, OP, RIGHT) do { \ - uint64_t _verify3_left = (uint64_t)(LEFT); \ - uint64_t _verify3_right = (uint64_t)(RIGHT); \ - if (!(_verify3_left OP _verify3_right)) \ +#define VERIFY3U(LEFT, OP, RIGHT) do { \ + const uint64_t _verify3_left = (uint64_t)(LEFT); \ + const uint64_t _verify3_right = (uint64_t)(RIGHT); \ + if (unlikely(!(_verify3_left OP _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (%llu " #OP " %llu)\n", \ - (unsigned long long) (_verify3_left), \ - (unsigned long long) (_verify3_right)); \ + "failed (%llu " #OP " %llu)\n", \ + (unsigned long long) (_verify3_left), \ + (unsigned long long) (_verify3_right)); \ } while (0) -#define VERIFY3P(LEFT, OP, RIGHT) do { \ - uintptr_t _verify3_left = (uintptr_t)(LEFT); \ - uintptr_t _verify3_right = (uintptr_t)(RIGHT); \ - if (!(_verify3_left OP _verify3_right)) \ +#define VERIFY3P(LEFT, OP, RIGHT) do { \ + const uintptr_t _verify3_left = (uintptr_t)(LEFT); \ + const uintptr_t _verify3_right = (uintptr_t)(RIGHT);\ + if (unlikely(!(_verify3_left OP _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (%px " #OP " %px)\n", \ - (void *) (_verify3_left), \ - (void *) (_verify3_right)); \ + "failed (%px " #OP " %px)\n", \ + (void *) (_verify3_left), \ + (void *) (_verify3_right)); \ } while (0) -#define VERIFY0(RIGHT) do { \ - int64_t _verify3_left = (int64_t)(0); \ - int64_t _verify3_right = (int64_t)(RIGHT); \ - if (!(_verify3_left == _verify3_right)) \ +#define VERIFY0(RIGHT) do { \ + const int64_t _verify3_left = (int64_t)(0); \ + const int64_t _verify3_right = (int64_t)(RIGHT); \ + if (unlikely(!(_verify3_left == _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ - "VERIFY3(0 == " #RIGHT ") " \ - "failed (0 == %lld)\n", \ - (long long) (_verify3_right)); \ + "VERIFY3(0 == " #RIGHT ") " \ + "failed (0 == %lld)\n", \ + (long long) (_verify3_right)); \ } while (0) #define CTASSERT_GLOBAL(x) _CTASSERT(x, __LINE__) @@ -154,11 +154,11 @@ void spl_dumpstack(void); #define ASSERT0 VERIFY0 #define ASSERT VERIFY #define IMPLY(A, B) \ - ((void)(((!(A)) || (B)) || \ + ((void)(likely((!(A)) || (B)) || \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "(" #A ") implies (" #B ")"))) #define EQUIV(A, B) \ - ((void)((!!(A) == !!(B)) || \ + ((void)(likely(!!(A) == !!(B)) || \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "(" #A ") is equivalent to (" #B ")"))) /* END CSTYLED */ diff --git a/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_vfsops_os.h b/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_vfsops_os.h index 24a0a2e6a05f..7b4a1aac9aad 100644 --- a/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_vfsops_os.h +++ b/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_vfsops_os.h @@ -138,6 +138,39 @@ struct zfsvfs { taskqid_t z_drain_task; /* task id for the unlink drain task */ }; +#define ZFS_TEARDOWN_INIT(zfsvfs) \ + rrm_init(&(zfsvfs)->z_teardown_lock, B_FALSE) + +#define ZFS_TEARDOWN_DESTROY(zfsvfs) \ + rrm_destroy(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_TRY_ENTER_READ(zfsvfs) \ + rw_tryenter(&(zfsvfs)->z_teardown_lock, RW_READER) + +#define ZFS_TEARDOWN_ENTER_READ(zfsvfs, tag) \ + rrm_enter_read(&(zfsvfs)->z_teardown_lock, tag); + +#define ZFS_TEARDOWN_EXIT_READ(zfsvfs, tag) \ + rrm_exit(&(zfsvfs)->z_teardown_lock, tag) + +#define ZFS_TEARDOWN_ENTER_WRITE(zfsvfs, tag) \ + rrm_enter(&(zfsvfs)->z_teardown_lock, RW_WRITER, tag) + +#define ZFS_TEARDOWN_EXIT_WRITE(zfsvfs) \ + rrm_exit(&(zfsvfs)->z_teardown_lock, tag) + +#define ZFS_TEARDOWN_EXIT(zfsvfs, tag) \ + rrm_exit(&(zfsvfs)->z_teardown_lock, tag) + +#define ZFS_TEARDOWN_READ_HELD(zfsvfs) \ + RRM_READ_HELD(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_WRITE_HELD(zfsvfs) \ + RRM_WRITE_HELD(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_HELD(zfsvfs) \ + RRM_LOCK_HELD(&(zfsvfs)->z_teardown_lock) + #define ZSB_XATTR 0x0001 /* Enable user xattrs */ /* diff --git a/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h b/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h index 41bdf932511d..b1b3aec4c70f 100644 --- a/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h +++ b/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h @@ -81,7 +81,7 @@ extern "C" { do { \ ZFS_TEARDOWN_ENTER_READ(zfsvfs, FTAG); \ if (unlikely((zfsvfs)->z_unmounted)) { \ - ZFS_EXIT_READ(zfsvfs, FTAG); \ + ZFS_TEARDOWN_EXIT_READ(zfsvfs, FTAG); \ return (error); \ } \ } while (0) @@ -92,7 +92,7 @@ do { \ #define ZFS_EXIT(zfsvfs) \ do { \ zfs_exit_fs(zfsvfs); \ - ZFS_EXIT_READ(zfsvfs, FTAG); \ + ZFS_TEARDOWN_EXIT_READ(zfsvfs, FTAG); \ } while (0) #define ZPL_EXIT(zfsvfs) \ diff --git a/sys/contrib/openzfs/include/sys/dmu_redact.h b/sys/contrib/openzfs/include/sys/dmu_redact.h index 207fdbb5cfda..85f4b0522891 100644 --- a/sys/contrib/openzfs/include/sys/dmu_redact.h +++ b/sys/contrib/openzfs/include/sys/dmu_redact.h @@ -39,6 +39,7 @@ redact_block_get_size(redact_block_phys_t *rbp) static inline void redact_block_set_size(redact_block_phys_t *rbp, uint64_t size) { + /* cppcheck-suppress syntaxError */ BF64_SET_SB((rbp)->rbp_size_count, 48, 16, SPA_MINBLOCKSHIFT, 0, size); } @@ -51,6 +52,7 @@ redact_block_get_count(redact_block_phys_t *rbp) static inline void redact_block_set_count(redact_block_phys_t *rbp, uint64_t count) { + /* cppcheck-suppress syntaxError */ *** 1423 LINES SKIPPED *** From owner-dev-commits-src-branches@freebsd.org Sun Apr 4 13:19: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 321F55D710E; Sun, 4 Apr 2021 13:19: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 4FCvWw0j9Xz3CWC; Sun, 4 Apr 2021 13:19: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 0978B25EEA; Sun, 4 Apr 2021 13:19: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 134DJNZm037067; Sun, 4 Apr 2021 13:19:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 134DJN9t037065; Sun, 4 Apr 2021 13:19:23 GMT (envelope-from git) Date: Sun, 4 Apr 2021 13:19:23 GMT Message-Id: <202104041319.134DJN9t037065@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: 93d1c189bc36 - stable/13 - zfs: merge OpenZFS master-891568c99 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: 93d1c189bc368bf1e9a661673cbc44142780be75 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: 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, 04 Apr 2021 13:19:24 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=93d1c189bc368bf1e9a661673cbc44142780be75 commit 93d1c189bc368bf1e9a661673cbc44142780be75 Author: Martin Matuska AuthorDate: 2021-03-21 00:46:08 +0000 Commit: Martin Matuska CommitDate: 2021-04-04 13:19:09 +0000 zfs: merge OpenZFS master-891568c99 Notable upstream pull request merges: #11652 Split dmu_zfetch() speculation and execution parts #11682 Fix zfs_get_data access to files with wrong generation #11735 Clean up RAIDZ/DRAID ereport code #11737 Initialize metaslab range trees in metaslab_init #11739 FreeBSD: make seqc asserts conditional on replay #11763 Allow setting bootfs property on pools with indirect vdevs #11767 FreeBSD: Fix memory leaks in kstats Obtained from: OpenZFS (cherry picked from commit f9693bef8dc83284e7ac905adc346f7d866b5245) --- sys/contrib/openzfs/README.md | 2 +- sys/contrib/openzfs/cmd/raidz_test/raidz_test.c | 2 - sys/contrib/openzfs/cmd/ztest/ztest.c | 4 +- sys/contrib/openzfs/config/kernel-bio_max_segs.m4 | 23 ++ .../openzfs/config/kernel-generic_fillattr.m4 | 28 +++ sys/contrib/openzfs/config/kernel-inode-create.m4 | 43 +++- sys/contrib/openzfs/config/kernel-inode-getattr.m4 | 63 ++++- .../openzfs/config/kernel-is_owner_or_cap.m4 | 23 +- sys/contrib/openzfs/config/kernel-mkdir-umode-t.m4 | 32 --- sys/contrib/openzfs/config/kernel-mkdir.m4 | 65 +++++ sys/contrib/openzfs/config/kernel-mknod.m4 | 30 +++ sys/contrib/openzfs/config/kernel-rename.m4 | 50 +++- .../openzfs/config/kernel-setattr-prepare.m4 | 45 +++- sys/contrib/openzfs/config/kernel-symlink.m4 | 30 +++ sys/contrib/openzfs/config/kernel-xattr-handler.m4 | 78 ++++-- sys/contrib/openzfs/config/kernel.m4 | 20 +- sys/contrib/openzfs/configure.ac | 1 + .../include/os/linux/kernel/linux/kmap_compat.h | 4 +- .../include/os/linux/kernel/linux/vfs_compat.h | 24 +- .../include/os/linux/kernel/linux/xattr_compat.h | 17 +- .../include/os/linux/zfs/sys/zfs_vnops_os.h | 3 +- .../include/os/linux/zfs/sys/zfs_znode_impl.h | 8 +- sys/contrib/openzfs/include/os/linux/zfs/sys/zpl.h | 18 ++ sys/contrib/openzfs/include/sys/dmu_zfetch.h | 23 +- sys/contrib/openzfs/include/sys/vdev_raidz.h | 2 + sys/contrib/openzfs/include/sys/vdev_raidz_impl.h | 7 +- sys/contrib/openzfs/include/sys/zil.h | 3 +- sys/contrib/openzfs/include/sys/zio.h | 10 +- sys/contrib/openzfs/include/sys/zvol_impl.h | 4 +- .../openzfs/man/man5/zfs-module-parameters.5 | 25 +- sys/contrib/openzfs/man/man8/zfs-allow.8 | 3 + sys/contrib/openzfs/man/man8/zgenhostid.8 | 4 +- sys/contrib/openzfs/man/man8/zpoolconcepts.8 | 17 ++ .../openzfs/module/os/freebsd/spl/spl_kstat.c | 11 +- .../openzfs/module/os/freebsd/zfs/sysctl_os.c | 6 - sys/contrib/openzfs/module/os/linux/zfs/abd_os.c | 10 +- sys/contrib/openzfs/module/os/linux/zfs/policy.c | 2 +- .../openzfs/module/os/linux/zfs/vdev_disk.c | 5 + .../openzfs/module/os/linux/zfs/zfs_ctldir.c | 3 +- sys/contrib/openzfs/module/os/linux/zfs/zfs_uio.c | 4 +- .../openzfs/module/os/linux/zfs/zfs_vfsops.c | 6 +- .../openzfs/module/os/linux/zfs/zfs_vnops_os.c | 5 +- .../openzfs/module/os/linux/zfs/zpl_ctldir.c | 51 +++- sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c | 2 +- .../openzfs/module/os/linux/zfs/zpl_inode.c | 52 +++- .../openzfs/module/os/linux/zfs/zpl_xattr.c | 4 +- sys/contrib/openzfs/module/zfs/dbuf.c | 5 +- sys/contrib/openzfs/module/zfs/dmu.c | 35 ++- sys/contrib/openzfs/module/zfs/dmu_zfetch.c | 250 +++++++++++-------- sys/contrib/openzfs/module/zfs/metaslab.c | 149 +++++------- sys/contrib/openzfs/module/zfs/refcount.c | 10 +- sys/contrib/openzfs/module/zfs/vdev.c | 4 +- sys/contrib/openzfs/module/zfs/vdev_draid.c | 240 +------------------ sys/contrib/openzfs/module/zfs/vdev_indirect.c | 1 - sys/contrib/openzfs/module/zfs/vdev_mirror.c | 5 +- sys/contrib/openzfs/module/zfs/vdev_raidz.c | 266 +++------------------ sys/contrib/openzfs/module/zfs/zfs_fm.c | 8 +- sys/contrib/openzfs/module/zfs/zfs_fuid.c | 4 - sys/contrib/openzfs/module/zfs/zfs_log.c | 5 + sys/contrib/openzfs/module/zfs/zfs_vnops.c | 14 +- sys/contrib/openzfs/module/zfs/zil.c | 3 +- sys/contrib/openzfs/module/zfs/zio.c | 4 +- sys/contrib/openzfs/module/zfs/zvol.c | 3 +- sys/contrib/openzfs/tests/runfiles/common.run | 8 +- sys/contrib/openzfs/tests/runfiles/freebsd.run | 4 + sys/contrib/openzfs/tests/runfiles/sanity.run | 4 + .../zfs-tests/tests/functional/acl/Makefile.am | 2 +- .../zfs-tests/tests/functional/acl/off/.gitignore | 1 + .../zfs-tests/tests/functional/acl/off/Makefile.am | 16 ++ .../zfs-tests/tests/functional/acl/off/cleanup.ksh | 33 +++ .../zfs-tests/tests/functional/acl/off/dosmode.ksh | 199 +++++++++++++++ .../functional/acl/off/dosmode_readonly_write.c | 61 +++++ .../tests/functional/acl/off/posixmode.ksh | 145 +++++++++++ .../zfs-tests/tests/functional/acl/off/setup.ksh | 44 ++++ .../tests/functional/redacted_send/Makefile.am | 1 + .../functional/redacted_send/redacted_panic.ksh | 44 ++++ sys/modules/zfs/zfs_config.h | 4 +- 77 files changed, 1561 insertions(+), 883 deletions(-) diff --git a/sys/contrib/openzfs/README.md b/sys/contrib/openzfs/README.md index 31d99386e90e..d666df7af309 100644 --- a/sys/contrib/openzfs/README.md +++ b/sys/contrib/openzfs/README.md @@ -32,4 +32,4 @@ For more details see the NOTICE, LICENSE and COPYRIGHT files; `UCRL-CODE-235197` # Supported Kernels * The `META` file contains the officially recognized supported Linux kernel versions. - * Supported FreeBSD versions are 12-STABLE and 13-CURRENT. + * Supported FreeBSD versions are any supported branches and releases starting from 12.2-RELEASE. diff --git a/sys/contrib/openzfs/cmd/raidz_test/raidz_test.c b/sys/contrib/openzfs/cmd/raidz_test/raidz_test.c index e3eb4f4ce44a..9a8be549c5cb 100644 --- a/sys/contrib/openzfs/cmd/raidz_test/raidz_test.c +++ b/sys/contrib/openzfs/cmd/raidz_test/raidz_test.c @@ -448,7 +448,6 @@ vdev_raidz_map_alloc_expanded(abd_t *abd, uint64_t size, uint64_t offset, rr->rr_missingdata = 0; rr->rr_missingparity = 0; rr->rr_firstdatacol = nparity; - rr->rr_abd_copy = NULL; rr->rr_abd_empty = NULL; rr->rr_nempty = 0; @@ -459,7 +458,6 @@ vdev_raidz_map_alloc_expanded(abd_t *abd, uint64_t size, uint64_t offset, } rr->rr_col[c].rc_devidx = child_id; rr->rr_col[c].rc_offset = child_offset; - rr->rr_col[c].rc_gdata = NULL; rr->rr_col[c].rc_orig_data = NULL; rr->rr_col[c].rc_error = 0; rr->rr_col[c].rc_tried = 0; diff --git a/sys/contrib/openzfs/cmd/ztest/ztest.c b/sys/contrib/openzfs/cmd/ztest/ztest.c index 1a030280704a..7193eafe3d21 100644 --- a/sys/contrib/openzfs/cmd/ztest/ztest.c +++ b/sys/contrib/openzfs/cmd/ztest/ztest.c @@ -2287,8 +2287,8 @@ ztest_get_done(zgd_t *zgd, int error) } static int -ztest_get_data(void *arg, lr_write_t *lr, char *buf, struct lwb *lwb, - zio_t *zio) +ztest_get_data(void *arg, uint64_t arg2, lr_write_t *lr, char *buf, + struct lwb *lwb, zio_t *zio) { ztest_ds_t *zd = arg; objset_t *os = zd->zd_os; diff --git a/sys/contrib/openzfs/config/kernel-bio_max_segs.m4 b/sys/contrib/openzfs/config/kernel-bio_max_segs.m4 new file mode 100644 index 000000000000..a90d75455c13 --- /dev/null +++ b/sys/contrib/openzfs/config/kernel-bio_max_segs.m4 @@ -0,0 +1,23 @@ +dnl # +dnl # 5.12 API change removes BIO_MAX_PAGES in favor of bio_max_segs() +dnl # which will handle the logic of setting the upper-bound to a +dnl # BIO_MAX_PAGES, internally. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_MAX_SEGS], [ + ZFS_LINUX_TEST_SRC([bio_max_segs], [ + #include + ],[ + bio_max_segs(1); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BIO_MAX_SEGS], [ + AC_MSG_CHECKING([whether bio_max_segs() exists]) + ZFS_LINUX_TEST_RESULT([bio_max_segs], [ + AC_MSG_RESULT(yes) + + AC_DEFINE([HAVE_BIO_MAX_SEGS], 1, [bio_max_segs() is implemented]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/sys/contrib/openzfs/config/kernel-generic_fillattr.m4 b/sys/contrib/openzfs/config/kernel-generic_fillattr.m4 new file mode 100644 index 000000000000..50c8031305b3 --- /dev/null +++ b/sys/contrib/openzfs/config/kernel-generic_fillattr.m4 @@ -0,0 +1,28 @@ +dnl # +dnl # 5.12 API +dnl # +dnl # generic_fillattr in linux/fs.h now requires a struct user_namespace* +dnl # as the first arg, to support idmapped mounts. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_FILLATTR_USERNS], [ + ZFS_LINUX_TEST_SRC([generic_fillattr_userns], [ + #include + ],[ + struct user_namespace *userns = NULL; + struct inode *in = NULL; + struct kstat *k = NULL; + generic_fillattr(userns, in, k); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_GENERIC_FILLATTR_USERNS], [ + AC_MSG_CHECKING([whether generic_fillattr requres struct user_namespace*]) + ZFS_LINUX_TEST_RESULT([generic_fillattr_userns], [ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_GENERIC_FILLATTR_USERNS, 1, + [generic_fillattr requires struct user_namespace*]) + ],[ + AC_MSG_RESULT([no]) + ]) +]) + diff --git a/sys/contrib/openzfs/config/kernel-inode-create.m4 b/sys/contrib/openzfs/config/kernel-inode-create.m4 index 9f28bcbd4f7f..a6ea11fb61b2 100644 --- a/sys/contrib/openzfs/config/kernel-inode-create.m4 +++ b/sys/contrib/openzfs/config/kernel-inode-create.m4 @@ -1,7 +1,25 @@ -dnl # -dnl # 3.6 API change -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE_FLAGS], [ +AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE], [ + dnl # + dnl # 5.12 API change that added the struct user_namespace* arg + dnl # to the front of this function type's arg list. + dnl # + ZFS_LINUX_TEST_SRC([create_userns], [ + #include + #include + + int inode_create(struct user_namespace *userns, + struct inode *inode ,struct dentry *dentry, + umode_t umode, bool flag) { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .create = inode_create, + }; + ],[]) + + dnl # + dnl # 3.6 API change + dnl # ZFS_LINUX_TEST_SRC([create_flags], [ #include #include @@ -16,11 +34,20 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE_FLAGS], [ ],[]) ]) -AC_DEFUN([ZFS_AC_KERNEL_CREATE_FLAGS], [ - AC_MSG_CHECKING([whether iops->create() passes flags]) - ZFS_LINUX_TEST_RESULT([create_flags], [ +AC_DEFUN([ZFS_AC_KERNEL_CREATE], [ + AC_MSG_CHECKING([whether iops->create() takes struct user_namespace*]) + ZFS_LINUX_TEST_RESULT([create_userns], [ AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_IOPS_CREATE_USERNS, 1, + [iops->create() takes struct user_namespace*]) ],[ - ZFS_LINUX_TEST_ERROR([iops->create()]) + AC_MSG_RESULT(no) + + AC_MSG_CHECKING([whether iops->create() passes flags]) + ZFS_LINUX_TEST_RESULT([create_flags], [ + AC_MSG_RESULT(yes) + ],[ + ZFS_LINUX_TEST_ERROR([iops->create()]) + ]) ]) ]) diff --git a/sys/contrib/openzfs/config/kernel-inode-getattr.m4 b/sys/contrib/openzfs/config/kernel-inode-getattr.m4 index 48391d66f8bd..f62e82f5230a 100644 --- a/sys/contrib/openzfs/config/kernel-inode-getattr.m4 +++ b/sys/contrib/openzfs/config/kernel-inode-getattr.m4 @@ -1,8 +1,29 @@ -dnl # -dnl # Linux 4.11 API -dnl # See torvalds/linux@a528d35 -dnl # AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_GETATTR], [ + dnl # + dnl # Linux 5.12 API + dnl # The getattr I/O operations handler type was extended to require + dnl # a struct user_namespace* as its first arg, to support idmapped + dnl # mounts. + dnl # + ZFS_LINUX_TEST_SRC([inode_operations_getattr_userns], [ + #include + + int test_getattr( + struct user_namespace *userns, + const struct path *p, struct kstat *k, + u32 request_mask, unsigned int query_flags) + { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .getattr = test_getattr, + }; + ],[]) + + dnl # + dnl # Linux 4.11 API + dnl # See torvalds/linux@a528d35 + dnl # ZFS_LINUX_TEST_SRC([inode_operations_getattr_path], [ #include @@ -33,21 +54,39 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_GETATTR], [ ]) AC_DEFUN([ZFS_AC_KERNEL_INODE_GETATTR], [ - AC_MSG_CHECKING([whether iops->getattr() takes a path]) - ZFS_LINUX_TEST_RESULT([inode_operations_getattr_path], [ + dnl # + dnl # Kernel 5.12 test + dnl # + AC_MSG_CHECKING([whether iops->getattr() takes user_namespace]) + ZFS_LINUX_TEST_RESULT([inode_operations_getattr_userns], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_PATH_IOPS_GETATTR, 1, - [iops->getattr() takes a path]) + AC_DEFINE(HAVE_USERNS_IOPS_GETATTR, 1, + [iops->getattr() takes struct user_namespace*]) ],[ AC_MSG_RESULT(no) - AC_MSG_CHECKING([whether iops->getattr() takes a vfsmount]) - ZFS_LINUX_TEST_RESULT([inode_operations_getattr_vfsmount], [ + dnl # + dnl # Kernel 4.11 test + dnl # + AC_MSG_CHECKING([whether iops->getattr() takes a path]) + ZFS_LINUX_TEST_RESULT([inode_operations_getattr_path], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_VFSMOUNT_IOPS_GETATTR, 1, - [iops->getattr() takes a vfsmount]) + AC_DEFINE(HAVE_PATH_IOPS_GETATTR, 1, + [iops->getattr() takes a path]) ],[ AC_MSG_RESULT(no) + + dnl # + dnl # Kernel < 4.11 test + dnl # + AC_MSG_CHECKING([whether iops->getattr() takes a vfsmount]) + ZFS_LINUX_TEST_RESULT([inode_operations_getattr_vfsmount], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_VFSMOUNT_IOPS_GETATTR, 1, + [iops->getattr() takes a vfsmount]) + ],[ + AC_MSG_RESULT(no) + ]) ]) ]) ]) diff --git a/sys/contrib/openzfs/config/kernel-is_owner_or_cap.m4 b/sys/contrib/openzfs/config/kernel-is_owner_or_cap.m4 index 3df6163da270..3c3c6ad2240f 100644 --- a/sys/contrib/openzfs/config/kernel-is_owner_or_cap.m4 +++ b/sys/contrib/openzfs/config/kernel-is_owner_or_cap.m4 @@ -11,13 +11,32 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OWNER_OR_CAPABLE], [ struct inode *ip = NULL; (void) inode_owner_or_capable(ip); ]) + + ZFS_LINUX_TEST_SRC([inode_owner_or_capable_idmapped], [ + #include + ],[ + struct inode *ip = NULL; + (void) inode_owner_or_capable(&init_user_ns, ip); + ]) ]) AC_DEFUN([ZFS_AC_KERNEL_INODE_OWNER_OR_CAPABLE], [ AC_MSG_CHECKING([whether inode_owner_or_capable() exists]) ZFS_LINUX_TEST_RESULT([inode_owner_or_capable], [ AC_MSG_RESULT(yes) - ],[ - ZFS_LINUX_TEST_ERROR([capability]) + AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE, 1, + [inode_owner_or_capable() exists]) + ], [ + AC_MSG_RESULT(no) + + AC_MSG_CHECKING( + [whether inode_owner_or_capable() takes user_ns]) + ZFS_LINUX_TEST_RESULT([inode_owner_or_capable_idmapped], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE_IDMAPPED, 1, + [inode_owner_or_capable() takes user_ns]) + ],[ + ZFS_LINUX_TEST_ERROR([capability]) + ]) ]) ]) diff --git a/sys/contrib/openzfs/config/kernel-mkdir-umode-t.m4 b/sys/contrib/openzfs/config/kernel-mkdir-umode-t.m4 deleted file mode 100644 index 19599670df3b..000000000000 --- a/sys/contrib/openzfs/config/kernel-mkdir-umode-t.m4 +++ /dev/null @@ -1,32 +0,0 @@ -dnl # -dnl # 3.3 API change -dnl # The VFS .create, .mkdir and .mknod callbacks were updated to take a -dnl # umode_t type rather than an int. The expectation is that any backport -dnl # would also change all three prototypes. However, if it turns out that -dnl # some distribution doesn't backport the whole thing this could be -dnl # broken apart into three separate checks. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_MKDIR_UMODE_T], [ - ZFS_LINUX_TEST_SRC([inode_operations_mkdir], [ - #include - - int mkdir(struct inode *inode, struct dentry *dentry, - umode_t umode) { return 0; } - - static const struct inode_operations - iops __attribute__ ((unused)) = { - .mkdir = mkdir, - }; - ],[]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_MKDIR_UMODE_T], [ - AC_MSG_CHECKING([whether iops->create()/mkdir()/mknod() take umode_t]) - ZFS_LINUX_TEST_RESULT([inode_operations_mkdir], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_MKDIR_UMODE_T, 1, - [iops->create()/mkdir()/mknod() take umode_t]) - ],[ - ZFS_LINUX_TEST_ERROR([mkdir()]) - ]) -]) diff --git a/sys/contrib/openzfs/config/kernel-mkdir.m4 b/sys/contrib/openzfs/config/kernel-mkdir.m4 new file mode 100644 index 000000000000..a162bcd880ff --- /dev/null +++ b/sys/contrib/openzfs/config/kernel-mkdir.m4 @@ -0,0 +1,65 @@ +dnl # +dnl # Supported mkdir() interfaces checked newest to oldest. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_MKDIR], [ + dnl # + dnl # 5.12 API change + dnl # The struct user_namespace arg was added as the first argument to + dnl # mkdir() + dnl # + ZFS_LINUX_TEST_SRC([mkdir_user_namespace], [ + #include + + int mkdir(struct user_namespace *userns, + struct inode *inode, struct dentry *dentry, + umode_t umode) { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .mkdir = mkdir, + }; + ],[]) + + dnl # + dnl # 3.3 API change + dnl # The VFS .create, .mkdir and .mknod callbacks were updated to take a + dnl # umode_t type rather than an int. The expectation is that any backport + dnl # would also change all three prototypes. However, if it turns out that + dnl # some distribution doesn't backport the whole thing this could be + dnl # broken apart into three separate checks. + dnl # + ZFS_LINUX_TEST_SRC([inode_operations_mkdir], [ + #include + + int mkdir(struct inode *inode, struct dentry *dentry, + umode_t umode) { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .mkdir = mkdir, + }; + ],[]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_MKDIR], [ + dnl # + dnl # 5.12 API change + dnl # The struct user_namespace arg was added as the first argument to + dnl # mkdir() of the iops structure. + dnl # + AC_MSG_CHECKING([whether iops->mkdir() takes struct user_namespace*]) + ZFS_LINUX_TEST_RESULT([mkdir_user_namespace], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_IOPS_MKDIR_USERNS, 1, + [iops->mkdir() takes struct user_namespace*]) + ],[ + AC_MSG_CHECKING([whether iops->mkdir() takes umode_t]) + ZFS_LINUX_TEST_RESULT([inode_operations_mkdir], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_MKDIR_UMODE_T, 1, + [iops->mkdir() takes umode_t]) + ],[ + ZFS_LINUX_TEST_ERROR([mkdir()]) + ]) + ]) +]) diff --git a/sys/contrib/openzfs/config/kernel-mknod.m4 b/sys/contrib/openzfs/config/kernel-mknod.m4 new file mode 100644 index 000000000000..ffe45106003a --- /dev/null +++ b/sys/contrib/openzfs/config/kernel-mknod.m4 @@ -0,0 +1,30 @@ +AC_DEFUN([ZFS_AC_KERNEL_SRC_MKNOD], [ + dnl # + dnl # 5.12 API change that added the struct user_namespace* arg + dnl # to the front of this function type's arg list. + dnl # + ZFS_LINUX_TEST_SRC([mknod_userns], [ + #include + #include + + int tmp_mknod(struct user_namespace *userns, + struct inode *inode ,struct dentry *dentry, + umode_t u, dev_t d) { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .mknod = tmp_mknod, + }; + ],[]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_MKNOD], [ + AC_MSG_CHECKING([whether iops->mknod() takes struct user_namespace*]) + ZFS_LINUX_TEST_RESULT([mknod_userns], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_IOPS_MKNOD_USERNS, 1, + [iops->mknod() takes struct user_namespace*]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/sys/contrib/openzfs/config/kernel-rename.m4 b/sys/contrib/openzfs/config/kernel-rename.m4 index f707391539d8..31d199f33bba 100644 --- a/sys/contrib/openzfs/config/kernel-rename.m4 +++ b/sys/contrib/openzfs/config/kernel-rename.m4 @@ -1,10 +1,10 @@ -dnl # -dnl # 4.9 API change, -dnl # iops->rename2() merged into iops->rename(), and iops->rename() now wants -dnl # flags. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME_WANTS_FLAGS], [ - ZFS_LINUX_TEST_SRC([inode_operations_rename], [ +AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME], [ + dnl # + dnl # 4.9 API change, + dnl # iops->rename2() merged into iops->rename(), and iops->rename() now wants + dnl # flags. + dnl # + ZFS_LINUX_TEST_SRC([inode_operations_rename_flags], [ #include int rename_fn(struct inode *sip, struct dentry *sdp, struct inode *tip, struct dentry *tdp, @@ -15,15 +15,41 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME_WANTS_FLAGS], [ .rename = rename_fn, }; ],[]) + + dnl # + dnl # 5.12 API change, + dnl # + dnl # Linux 5.12 introduced passing struct user_namespace* as the first argument + dnl # of the rename() and other inode_operations members. + dnl # + ZFS_LINUX_TEST_SRC([inode_operations_rename_userns], [ + #include + int rename_fn(struct user_namespace *user_ns, struct inode *sip, + struct dentry *sdp, struct inode *tip, struct dentry *tdp, + unsigned int flags) { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .rename = rename_fn, + }; + ],[]) ]) -AC_DEFUN([ZFS_AC_KERNEL_RENAME_WANTS_FLAGS], [ - AC_MSG_CHECKING([whether iops->rename() wants flags]) - ZFS_LINUX_TEST_RESULT([inode_operations_rename], [ +AC_DEFUN([ZFS_AC_KERNEL_RENAME], [ + AC_MSG_CHECKING([whether iops->rename() takes struct user_namespace*]) + ZFS_LINUX_TEST_RESULT([inode_operations_rename_userns], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_RENAME_WANTS_FLAGS, 1, - [iops->rename() wants flags]) + AC_DEFINE(HAVE_IOPS_RENAME_USERNS, 1, + [iops->rename() takes struct user_namespace*]) ],[ AC_MSG_RESULT(no) + + ZFS_LINUX_TEST_RESULT([inode_operations_rename_flags], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_RENAME_WANTS_FLAGS, 1, + [iops->rename() wants flags]) + ],[ + AC_MSG_RESULT(no) + ]) ]) ]) diff --git a/sys/contrib/openzfs/config/kernel-setattr-prepare.m4 b/sys/contrib/openzfs/config/kernel-setattr-prepare.m4 index 45408c45c69b..24245aa53448 100644 --- a/sys/contrib/openzfs/config/kernel-setattr-prepare.m4 +++ b/sys/contrib/openzfs/config/kernel-setattr-prepare.m4 @@ -1,27 +1,52 @@ -dnl # -dnl # 4.9 API change -dnl # The inode_change_ok() function has been renamed setattr_prepare() -dnl # and updated to take a dentry rather than an inode. -dnl # AC_DEFUN([ZFS_AC_KERNEL_SRC_SETATTR_PREPARE], [ + dnl # + dnl # 4.9 API change + dnl # The inode_change_ok() function has been renamed setattr_prepare() + dnl # and updated to take a dentry rather than an inode. + dnl # ZFS_LINUX_TEST_SRC([setattr_prepare], [ #include ], [ struct dentry *dentry = NULL; struct iattr *attr = NULL; int error __attribute__ ((unused)) = - setattr_prepare(dentry, attr); + setattr_prepare(dentry, attr); + ]) + + dnl # + dnl # 5.12 API change + dnl # The setattr_prepare() function has been changed to accept a new argument + dnl # for struct user_namespace* + dnl # + ZFS_LINUX_TEST_SRC([setattr_prepare_userns], [ + #include + ], [ + struct dentry *dentry = NULL; + struct iattr *attr = NULL; + struct user_namespace *userns = NULL; + int error __attribute__ ((unused)) = + setattr_prepare(userns, dentry, attr); ]) ]) AC_DEFUN([ZFS_AC_KERNEL_SETATTR_PREPARE], [ - AC_MSG_CHECKING([whether setattr_prepare() is available]) - ZFS_LINUX_TEST_RESULT_SYMBOL([setattr_prepare], + AC_MSG_CHECKING([whether setattr_prepare() is available and accepts struct user_namespace*]) + ZFS_LINUX_TEST_RESULT_SYMBOL([setattr_prepare_userns], [setattr_prepare], [fs/attr.c], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_SETATTR_PREPARE, 1, - [setattr_prepare() is available]) + AC_DEFINE(HAVE_SETATTR_PREPARE_USERNS, 1, + [setattr_prepare() accepts user_namespace]) ], [ AC_MSG_RESULT(no) + + AC_MSG_CHECKING([whether setattr_prepare() is available, doesn't accept user_namespace]) + ZFS_LINUX_TEST_RESULT_SYMBOL([setattr_prepare], + [setattr_prepare], [fs/attr.c], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SETATTR_PREPARE_NO_USERNS, 1, + [setattr_prepare() is available, doesn't accept user_namespace]) + ], [ + AC_MSG_RESULT(no) + ]) ]) ]) diff --git a/sys/contrib/openzfs/config/kernel-symlink.m4 b/sys/contrib/openzfs/config/kernel-symlink.m4 new file mode 100644 index 000000000000..d90366d04b72 --- /dev/null +++ b/sys/contrib/openzfs/config/kernel-symlink.m4 @@ -0,0 +1,30 @@ +AC_DEFUN([ZFS_AC_KERNEL_SRC_SYMLINK], [ + dnl # + dnl # 5.12 API change that added the struct user_namespace* arg + dnl # to the front of this function type's arg list. + dnl # + ZFS_LINUX_TEST_SRC([symlink_userns], [ + #include + #include + + int tmp_symlink(struct user_namespace *userns, + struct inode *inode ,struct dentry *dentry, + const char *path) { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .symlink = tmp_symlink, + }; + ],[]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_SYMLINK], [ + AC_MSG_CHECKING([whether iops->symlink() takes struct user_namespace*]) + ZFS_LINUX_TEST_RESULT([symlink_userns], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_IOPS_SYMLINK_USERNS, 1, + [iops->symlink() takes struct user_namespace*]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/sys/contrib/openzfs/config/kernel-xattr-handler.m4 b/sys/contrib/openzfs/config/kernel-xattr-handler.m4 index 137bf4a8aff0..00b1e74a9ccb 100644 --- a/sys/contrib/openzfs/config/kernel-xattr-handler.m4 +++ b/sys/contrib/openzfs/config/kernel-xattr-handler.m4 @@ -152,6 +152,21 @@ dnl # dnl # Supported xattr handler set() interfaces checked newest to oldest. dnl # AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [ + ZFS_LINUX_TEST_SRC([xattr_handler_set_userns], [ + #include + + int set(const struct xattr_handler *handler, + struct user_namespace *mnt_userns, + struct dentry *dentry, struct inode *inode, + const char *name, const void *buffer, + size_t size, int flags) + { return 0; } + static const struct xattr_handler + xops __attribute__ ((unused)) = { + .set = set, + }; + ],[]) + ZFS_LINUX_TEST_SRC([xattr_handler_set_dentry_inode], [ #include @@ -194,45 +209,58 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [ dnl # - dnl # 4.7 API change, - dnl # The xattr_handler->set() callback was changed to take both - dnl # dentry and inode. + dnl # 5.12 API change, + dnl # The xattr_handler->set() callback was changed to 8 arguments, and + dnl # struct user_namespace* was inserted as arg #2 dnl # - AC_MSG_CHECKING([whether xattr_handler->set() wants dentry and inode]) - ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry_inode], [ + AC_MSG_CHECKING([whether xattr_handler->set() wants dentry, inode, and user_namespace]) + ZFS_LINUX_TEST_RESULT([xattr_handler_set_userns], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1, - [xattr_handler->set() wants both dentry and inode]) + AC_DEFINE(HAVE_XATTR_SET_USERNS, 1, + [xattr_handler->set() takes user_namespace]) ],[ dnl # - dnl # 4.4 API change, - dnl # The xattr_handler->set() callback was changed to take a - dnl # xattr_handler, and handler_flags argument was removed and - dnl # should be accessed by handler->flags. + dnl # 4.7 API change, + dnl # The xattr_handler->set() callback was changed to take both + dnl # dentry and inode. dnl # AC_MSG_RESULT(no) - AC_MSG_CHECKING( - [whether xattr_handler->set() wants xattr_handler]) - ZFS_LINUX_TEST_RESULT([xattr_handler_set_xattr_handler], [ + AC_MSG_CHECKING([whether xattr_handler->set() wants dentry and inode]) + ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry_inode], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1, - [xattr_handler->set() wants xattr_handler]) + AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1, + [xattr_handler->set() wants both dentry and inode]) ],[ dnl # - dnl # 2.6.33 API change, - dnl # The xattr_handler->set() callback was changed - dnl # to take a dentry instead of an inode, and a - dnl # handler_flags argument was added. + dnl # 4.4 API change, + dnl # The xattr_handler->set() callback was changed to take a + dnl # xattr_handler, and handler_flags argument was removed and + dnl # should be accessed by handler->flags. dnl # AC_MSG_RESULT(no) AC_MSG_CHECKING( - [whether xattr_handler->set() wants dentry]) - ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry], [ + [whether xattr_handler->set() wants xattr_handler]) + ZFS_LINUX_TEST_RESULT([xattr_handler_set_xattr_handler], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1, - [xattr_handler->set() wants dentry]) + AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1, + [xattr_handler->set() wants xattr_handler]) ],[ - ZFS_LINUX_TEST_ERROR([xattr set()]) + dnl # + dnl # 2.6.33 API change, + dnl # The xattr_handler->set() callback was changed + dnl # to take a dentry instead of an inode, and a + dnl # handler_flags argument was added. + dnl # + AC_MSG_RESULT(no) + AC_MSG_CHECKING( + [whether xattr_handler->set() wants dentry]) + ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1, + [xattr_handler->set() wants dentry]) + ],[ + ZFS_LINUX_TEST_ERROR([xattr set()]) + ]) ]) ]) ]) diff --git a/sys/contrib/openzfs/config/kernel.m4 b/sys/contrib/openzfs/config/kernel.m4 index f31be845f5d9..dfb6165d879d 100644 --- a/sys/contrib/openzfs/config/kernel.m4 +++ b/sys/contrib/openzfs/config/kernel.m4 @@ -79,9 +79,9 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ ZFS_AC_KERNEL_SRC_EVICT_INODE ZFS_AC_KERNEL_SRC_DIRTY_INODE ZFS_AC_KERNEL_SRC_SHRINKER - ZFS_AC_KERNEL_SRC_MKDIR_UMODE_T + ZFS_AC_KERNEL_SRC_MKDIR ZFS_AC_KERNEL_SRC_LOOKUP_FLAGS - ZFS_AC_KERNEL_SRC_CREATE_FLAGS + ZFS_AC_KERNEL_SRC_CREATE ZFS_AC_KERNEL_SRC_GET_LINK ZFS_AC_KERNEL_SRC_PUT_LINK ZFS_AC_KERNEL_SRC_TMPFILE @@ -115,7 +115,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ ZFS_AC_KERNEL_SRC_KUIDGID_T ZFS_AC_KERNEL_SRC_KUID_HELPERS ZFS_AC_KERNEL_SRC_MODULE_PARAM_CALL_CONST - ZFS_AC_KERNEL_SRC_RENAME_WANTS_FLAGS + ZFS_AC_KERNEL_SRC_RENAME ZFS_AC_KERNEL_SRC_CURRENT_TIME ZFS_AC_KERNEL_SRC_USERNS_CAPABILITIES ZFS_AC_KERNEL_SRC_IN_COMPAT_SYSCALL @@ -125,6 +125,10 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ ZFS_AC_KERNEL_SRC_KSTRTOUL ZFS_AC_KERNEL_SRC_PERCPU ZFS_AC_KERNEL_SRC_CPU_HOTPLUG + ZFS_AC_KERNEL_SRC_GENERIC_FILLATTR_USERNS + ZFS_AC_KERNEL_SRC_MKNOD + ZFS_AC_KERNEL_SRC_SYMLINK + ZFS_AC_KERNEL_SRC_BIO_MAX_SEGS AC_MSG_CHECKING([for available kernel interfaces]) ZFS_LINUX_TEST_COMPILE_ALL([kabi]) @@ -177,9 +181,9 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ ZFS_AC_KERNEL_EVICT_INODE ZFS_AC_KERNEL_DIRTY_INODE ZFS_AC_KERNEL_SHRINKER - ZFS_AC_KERNEL_MKDIR_UMODE_T + ZFS_AC_KERNEL_MKDIR ZFS_AC_KERNEL_LOOKUP_FLAGS - ZFS_AC_KERNEL_CREATE_FLAGS + ZFS_AC_KERNEL_CREATE ZFS_AC_KERNEL_GET_LINK ZFS_AC_KERNEL_PUT_LINK ZFS_AC_KERNEL_TMPFILE @@ -213,7 +217,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ ZFS_AC_KERNEL_KUIDGID_T ZFS_AC_KERNEL_KUID_HELPERS ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST - ZFS_AC_KERNEL_RENAME_WANTS_FLAGS + ZFS_AC_KERNEL_RENAME ZFS_AC_KERNEL_CURRENT_TIME ZFS_AC_KERNEL_USERNS_CAPABILITIES ZFS_AC_KERNEL_IN_COMPAT_SYSCALL @@ -223,6 +227,10 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ ZFS_AC_KERNEL_KSTRTOUL ZFS_AC_KERNEL_PERCPU ZFS_AC_KERNEL_CPU_HOTPLUG + ZFS_AC_KERNEL_GENERIC_FILLATTR_USERNS + ZFS_AC_KERNEL_MKNOD + ZFS_AC_KERNEL_SYMLINK + ZFS_AC_KERNEL_BIO_MAX_SEGS ]) dnl # diff --git a/sys/contrib/openzfs/configure.ac b/sys/contrib/openzfs/configure.ac index 07f590b390bd..e31d12271394 100644 --- a/sys/contrib/openzfs/configure.ac +++ b/sys/contrib/openzfs/configure.ac @@ -240,6 +240,7 @@ AC_CONFIG_FILES([ tests/zfs-tests/tests/Makefile tests/zfs-tests/tests/functional/Makefile tests/zfs-tests/tests/functional/acl/Makefile + tests/zfs-tests/tests/functional/acl/off/Makefile tests/zfs-tests/tests/functional/acl/posix/Makefile tests/zfs-tests/tests/functional/acl/posix-sa/Makefile tests/zfs-tests/tests/functional/alloc_class/Makefile diff --git a/sys/contrib/openzfs/include/os/linux/kernel/linux/kmap_compat.h b/sys/contrib/openzfs/include/os/linux/kernel/linux/kmap_compat.h index a7e63944ea16..42f463ab9ae9 100644 --- a/sys/contrib/openzfs/include/os/linux/kernel/linux/kmap_compat.h +++ b/sys/contrib/openzfs/include/os/linux/kernel/linux/kmap_compat.h @@ -30,8 +30,8 @@ #include /* 2.6.37 API change */ -#define zfs_kmap_atomic(page, km_type) kmap_atomic(page) -#define zfs_kunmap_atomic(addr, km_type) kunmap_atomic(addr) +#define zfs_kmap_atomic(page) kmap_atomic(page) +#define zfs_kunmap_atomic(addr) kunmap_atomic(addr) /* 5.0 API change - no more 'type' argument for access_ok() */ #ifdef HAVE_ACCESS_OK_TYPE diff --git a/sys/contrib/openzfs/include/os/linux/kernel/linux/vfs_compat.h b/sys/contrib/openzfs/include/os/linux/kernel/linux/vfs_compat.h index c35e80d31cd7..91e908598fbb 100644 --- a/sys/contrib/openzfs/include/os/linux/kernel/linux/vfs_compat.h +++ b/sys/contrib/openzfs/include/os/linux/kernel/linux/vfs_compat.h @@ -343,7 +343,8 @@ static inline void zfs_gid_write(struct inode *ip, gid_t gid) /* * 4.9 API change */ -#ifndef HAVE_SETATTR_PREPARE +#if !(defined(HAVE_SETATTR_PREPARE_NO_USERNS) || \ + defined(HAVE_SETATTR_PREPARE_USERNS)) static inline int setattr_prepare(struct dentry *dentry, struct iattr *ia) { @@ -389,6 +390,15 @@ func(const struct path *path, struct kstat *stat, u32 request_mask, \ { \ return (func##_impl(path, stat, request_mask, query_flags)); \ } +#elif defined(HAVE_USERNS_IOPS_GETATTR) +#define ZPL_GETATTR_WRAPPER(func) \ +static int \ +func(struct user_namespace *user_ns, const struct path *path, \ + struct kstat *stat, u32 request_mask, unsigned int query_flags) \ +{ \ + return (func##_impl(user_ns, path, stat, request_mask, \ + query_flags)); \ +} #else #error #endif @@ -436,4 +446,16 @@ zpl_is_32bit_api(void) #endif } +/* + * 5.12 API change + * To support id-mapped mounts, generic_fillattr() was modified to + * accept a new struct user_namespace* as its first arg. + */ +#ifdef HAVE_GENERIC_FILLATTR_USERNS +#define zpl_generic_fillattr(user_ns, ip, sp) \ + generic_fillattr(user_ns, ip, sp) +#else +#define zpl_generic_fillattr(user_ns, ip, sp) generic_fillattr(ip, sp) +#endif + #endif /* _ZFS_VFS_H */ diff --git a/sys/contrib/openzfs/include/os/linux/kernel/linux/xattr_compat.h b/sys/contrib/openzfs/include/os/linux/kernel/linux/xattr_compat.h index 8348e99198af..54690727eab9 100644 --- a/sys/contrib/openzfs/include/os/linux/kernel/linux/xattr_compat.h +++ b/sys/contrib/openzfs/include/os/linux/kernel/linux/xattr_compat.h @@ -119,12 +119,27 @@ fn(struct dentry *dentry, const char *name, void *buffer, size_t size, \ #error "Unsupported kernel" #endif +/* + * 5.12 API change, + * The xattr_handler->set() callback was changed to take the + * struct user_namespace* as the first arg, to support idmapped + * mounts. + */ +#if defined(HAVE_XATTR_SET_USERNS) +#define ZPL_XATTR_SET_WRAPPER(fn) \ +static int \ +fn(const struct xattr_handler *handler, struct user_namespace *user_ns, \ + struct dentry *dentry, struct inode *inode, const char *name, \ + const void *buffer, size_t size, int flags) \ +{ \ + return (__ ## fn(inode, name, buffer, size, flags)); \ *** 3309 LINES SKIPPED ***