From owner-svn-src-all@freebsd.org Sun Jul 7 00:30:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0587B15D754C; Sun, 7 Jul 2019 00:30:22 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8D7F988501; Sun, 7 Jul 2019 00:30:21 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 675D913AF; Sun, 7 Jul 2019 00:30:21 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x670ULlj001004; Sun, 7 Jul 2019 00:30:21 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x670UKx9001002; Sun, 7 Jul 2019 00:30:20 GMT (envelope-from np@FreeBSD.org) Message-Id: <201907070030.x670UKx9001002@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sun, 7 Jul 2019 00:30:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349795 - stable/12/sys/dev/cxgbe/tom X-SVN-Group: stable-12 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/12/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 349795 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8D7F988501 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 00:30:22 -0000 Author: np Date: Sun Jul 7 00:30:20 2019 New Revision: 349795 URL: https://svnweb.freebsd.org/changeset/base/349795 Log: MFC r349242, r349501, r349514, and r349517. r349242: cxgbe/t4_tom: DDP_DEAD is a ddp flag and not a toepcb flag. The driver was in effect setting TPF_ABORT_SHUTDOWN on the toepcb instead of what was intended. Sponsored by: Chelsio Communications r349501: cxgbe/t4_tom: Mark the socket's receive as done before calling handle_ddp_close. This eliminates a bad race where an aio_ddp_requeue that happened to run after handle_ddp_close could bump up the active count. Discussed with: jhb@ Sponsored by: Chelsio Communications r349514: cxgbe/t4_tom: the AIO tx job queue must be empty by the time the driver releases the offload resources associated with the tid. Reviewed by: jhb@ Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D20798 r349517: cxgbe/t4_tom: Tweaks to some of the AIO related CTRs. Reviewed by: jhb@ Sponsored by: Chelsio Communications Modified: stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c stable/12/sys/dev/cxgbe/tom/t4_ddp.c stable/12/sys/dev/cxgbe/tom/t4_tom.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c Sat Jul 6 20:31:37 2019 (r349794) +++ stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c Sun Jul 7 00:30:20 2019 (r349795) @@ -722,8 +722,8 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep ("%s: ulp_mode %u for toep %p", __func__, toep->ulp_mode, toep)); #ifdef VERBOSE_TRACES - CTR4(KTR_CXGBE, "%s: tid %d toep flags %#x tp flags %#x drop %d", - __func__, toep->tid, toep->flags, tp->t_flags); + CTR5(KTR_CXGBE, "%s: tid %d toep flags %#x tp flags %#x drop %d", + __func__, toep->tid, toep->flags, tp->t_flags, drop); #endif if (__predict_false(toep->flags & TPF_ABORT_SHUTDOWN)) return; @@ -1242,8 +1242,10 @@ do_peer_close(struct sge_iq *iq, const struct rss_head INP_WLOCK(inp); tp = intotcpcb(inp); - CTR5(KTR_CXGBE, "%s: tid %u (%s), toep_flags 0x%x, inp %p", __func__, - tid, tp ? tcpstates[tp->t_state] : "no tp", toep->flags, inp); + CTR6(KTR_CXGBE, + "%s: tid %u (%s), toep_flags 0x%x, ddp_flags 0x%x, inp %p", + __func__, tid, tp ? tcpstates[tp->t_state] : "no tp", toep->flags, + toep->ddp.flags, inp); if (toep->flags & TPF_ABORT_SHUTDOWN) goto done; @@ -1251,6 +1253,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_head tp->rcv_nxt++; /* FIN */ so = inp->inp_socket; + socantrcvmore(so); if (toep->ulp_mode == ULP_MODE_TCPDDP) { DDP_LOCK(toep); if (__predict_false(toep->ddp.flags & @@ -1258,7 +1261,6 @@ do_peer_close(struct sge_iq *iq, const struct rss_head handle_ddp_close(toep, tp, cpl->rcv_nxt); DDP_UNLOCK(toep); } - socantrcvmore(so); if (toep->ulp_mode != ULP_MODE_RDMA) { KASSERT(tp->rcv_nxt == be32toh(cpl->rcv_nxt), @@ -2223,7 +2225,7 @@ t4_aiotx_queue_toep(struct toepcb *toep) SOCKBUF_LOCK_ASSERT(&toep->inp->inp_socket->so_snd); #ifdef VERBOSE_TRACES CTR3(KTR_CXGBE, "%s: queueing aiotx task for tid %d, active = %s", - __func__, toep->tid, toep->aiotx_task_active ? "true" : "false"); + __func__, toep->tid, toep->aiotx_so != NULL ? "true" : "false"); #endif if (toep->aiotx_task_active) return; @@ -2278,7 +2280,7 @@ t4_aio_queue_aiotx(struct socket *so, struct kaiocb *j SOCKBUF_LOCK(&so->so_snd); #ifdef VERBOSE_TRACES - CTR2(KTR_CXGBE, "%s: queueing %p", __func__, job); + CTR3(KTR_CXGBE, "%s: queueing %p for tid %u", __func__, job, toep->tid); #endif if (!aio_set_cancel_function(job, t4_aiotx_cancel)) panic("new job was cancelled"); Modified: stable/12/sys/dev/cxgbe/tom/t4_ddp.c ============================================================================== --- stable/12/sys/dev/cxgbe/tom/t4_ddp.c Sat Jul 6 20:31:37 2019 (r349794) +++ stable/12/sys/dev/cxgbe/tom/t4_ddp.c Sun Jul 7 00:30:20 2019 (r349795) @@ -220,7 +220,7 @@ release_ddp_resources(struct toepcb *toep) int i; DDP_LOCK(toep); - toep->flags |= DDP_DEAD; + toep->ddp.flags |= DDP_DEAD; for (i = 0; i < nitems(toep->ddp.db); i++) { free_ddp_buffer(toep->td, &toep->ddp.db[i]); } @@ -263,8 +263,8 @@ complete_ddp_buffer(struct toepcb *toep, struct ddp_bu } else toep->ddp.active_id ^= 1; #ifdef VERBOSE_TRACES - CTR2(KTR_CXGBE, "%s: ddp_active_id = %d", __func__, - toep->ddp.active_id); + CTR3(KTR_CXGBE, "%s: tid %u, ddp_active_id = %d", __func__, + toep->tid, toep->ddp.active_id); #endif } else { KASSERT(toep->ddp.active_count != 0 && @@ -534,8 +534,8 @@ handle_ddp_data(struct toepcb *toep, __be32 ddp_report tp->rcv_wnd -= len; #endif #ifdef VERBOSE_TRACES - CTR4(KTR_CXGBE, "%s: DDP[%d] placed %d bytes (%#x)", __func__, db_idx, - len, report); + CTR5(KTR_CXGBE, "%s: tid %u, DDP[%d] placed %d bytes (%#x)", __func__, + toep->tid, db_idx, len, report); #endif /* receive buffer autosize */ @@ -573,8 +573,9 @@ handle_ddp_data(struct toepcb *toep, __be32 ddp_report } else { copied = job->aio_received; #ifdef VERBOSE_TRACES - CTR4(KTR_CXGBE, "%s: completing %p (copied %ld, placed %d)", - __func__, job, copied, len); + CTR5(KTR_CXGBE, + "%s: tid %u, completing %p (copied %ld, placed %d)", + __func__, toep->tid, job, copied, len); #endif aio_complete(job, copied + len, 0); t4_rcvd(&toep->td->tod, tp); @@ -1791,8 +1792,9 @@ sbcopy: } #ifdef VERBOSE_TRACES - CTR5(KTR_CXGBE, "%s: scheduling %p for DDP[%d] (flags %#lx/%#lx)", - __func__, job, db_idx, ddp_flags, ddp_flags_mask); + CTR6(KTR_CXGBE, + "%s: tid %u, scheduling %p for DDP[%d] (flags %#lx/%#lx)", __func__, + toep->tid, job, db_idx, ddp_flags, ddp_flags_mask); #endif /* Give the chip the go-ahead. */ t4_wrq_tx(sc, wr); @@ -1918,7 +1920,7 @@ t4_aio_queue_ddp(struct socket *so, struct kaiocb *job */ #ifdef VERBOSE_TRACES - CTR2(KTR_CXGBE, "%s: queueing %p", __func__, job); + CTR3(KTR_CXGBE, "%s: queueing %p for tid %u", __func__, job, toep->tid); #endif if (!aio_set_cancel_function(job, t4_aio_cancel_queued)) panic("new job was cancelled"); Modified: stable/12/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- stable/12/sys/dev/cxgbe/tom/t4_tom.c Sat Jul 6 20:31:37 2019 (r349794) +++ stable/12/sys/dev/cxgbe/tom/t4_tom.c Sun Jul 7 00:30:20 2019 (r349795) @@ -294,6 +294,7 @@ release_offload_resources(struct toepcb *toep) if (toep->ulp_mode == ULP_MODE_TCPDDP) ddp_assert_empty(toep); #endif + MPASS(TAILQ_EMPTY(&toep->aiotx_jobq)); if (toep->l2te) t4_l2t_release(toep->l2te); From owner-svn-src-all@freebsd.org Sun Jul 7 00:43:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90BAF15D7A44; Sun, 7 Jul 2019 00:43:39 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 36F8F89006; Sun, 7 Jul 2019 00:43:39 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1149116F2; Sun, 7 Jul 2019 00:43:39 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x670hciB011526; Sun, 7 Jul 2019 00:43:38 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x670hcpH011525; Sun, 7 Jul 2019 00:43:38 GMT (envelope-from np@FreeBSD.org) Message-Id: <201907070043.x670hcpH011525@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sun, 7 Jul 2019 00:43:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349796 - stable/12/sys/dev/cxgbe/iw_cxgbe X-SVN-Group: stable-12 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/12/sys/dev/cxgbe/iw_cxgbe X-SVN-Commit-Revision: 349796 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 36F8F89006 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.955,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 00:43:39 -0000 Author: np Date: Sun Jul 7 00:43:38 2019 New Revision: 349796 URL: https://svnweb.freebsd.org/changeset/base/349796 Log: MFC r349499: cxgbe/iw_cxgbe: Remove unused field from the endpoint structure. Modified: stable/12/sys/dev/cxgbe/iw_cxgbe/cm.c stable/12/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cxgbe/iw_cxgbe/cm.c ============================================================================== --- stable/12/sys/dev/cxgbe/iw_cxgbe/cm.c Sun Jul 7 00:30:20 2019 (r349795) +++ stable/12/sys/dev/cxgbe/iw_cxgbe/cm.c Sun Jul 7 00:43:38 2019 (r349796) @@ -528,7 +528,6 @@ set_tcpinfo(struct c4iw_ep *ep) ep->hwtid = toep->tid; ep->snd_seq = tp->snd_nxt; ep->rcv_seq = tp->rcv_nxt; - ep->emss = max(tp->t_maxseg, 128); done: INP_WUNLOCK(inp); return (rc); Modified: stable/12/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h ============================================================================== --- stable/12/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Sun Jul 7 00:30:20 2019 (r349795) +++ stable/12/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Sun Jul 7 00:43:38 2019 (r349796) @@ -862,7 +862,6 @@ struct c4iw_ep { u32 tx_chan; u32 mtu; u16 mss; - u16 emss; u16 plen; u16 rss_qid; u16 txq_idx; From owner-svn-src-all@freebsd.org Sun Jul 7 05:33:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F144F15DC451; Sun, 7 Jul 2019 05:33:50 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DA54289305; Sun, 7 Jul 2019 05:31:00 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A5852379D; Sun, 7 Jul 2019 05:30:08 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x675U8GB058232; Sun, 7 Jul 2019 05:30:08 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x675U7dZ058230; Sun, 7 Jul 2019 05:30:07 GMT (envelope-from np@FreeBSD.org) Message-Id: <201907070530.x675U7dZ058230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sun, 7 Jul 2019 05:30:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349797 - stable/12/sys/dev/cxgbe/tom X-SVN-Group: stable-12 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/12/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 349797 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DA54289305 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.90 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.90)[-0.903,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 05:33:51 -0000 Author: np Date: Sun Jul 7 05:30:07 2019 New Revision: 349797 URL: https://svnweb.freebsd.org/changeset/base/349797 Log: MFC r349500: cxgbe/t4_tom: Fix regression in t_maxseg usage within t4_tom. t_maxseg was changed in r293284 to not have any adjustment for TCP timestamps. t4_tom inadvertently went back to pre-r293284 semantics in r332506. Sponsored by: Chelsio Communications Modified: stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c stable/12/sys/dev/cxgbe/tom/t4_tom.c stable/12/sys/dev/cxgbe/tom/t4_tom.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c Sun Jul 7 00:43:38 2019 (r349796) +++ stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c Sun Jul 7 05:30:07 2019 (r349797) @@ -327,31 +327,33 @@ send_reset(struct adapter *sc, struct toepcb *toep, ui * reported by HW to FreeBSD's native format. */ static void -assign_rxopt(struct tcpcb *tp, unsigned int opt) +assign_rxopt(struct tcpcb *tp, uint16_t opt) { struct toepcb *toep = tp->t_toe; struct inpcb *inp = tp->t_inpcb; struct adapter *sc = td_adapter(toep->td); - int n; INP_LOCK_ASSERT(inp); + toep->tcp_opt = opt; + toep->mtu_idx = G_TCPOPT_MSS(opt); + tp->t_maxseg = sc->params.mtus[toep->mtu_idx]; if (inp->inp_inc.inc_flags & INC_ISIPV6) - n = sizeof(struct ip6_hdr) + sizeof(struct tcphdr); + tp->t_maxseg -= sizeof(struct ip6_hdr) + sizeof(struct tcphdr); else - n = sizeof(struct ip) + sizeof(struct tcphdr); - tp->t_maxseg = sc->params.mtus[G_TCPOPT_MSS(opt)] - n; + tp->t_maxseg -= sizeof(struct ip) + sizeof(struct tcphdr); + toep->emss = tp->t_maxseg; if (G_TCPOPT_TSTAMP(opt)) { tp->t_flags |= TF_RCVD_TSTMP; /* timestamps ok */ tp->ts_recent = 0; /* hmmm */ tp->ts_recent_age = tcp_ts_getticks(); - tp->t_maxseg -= TCPOLEN_TSTAMP_APPA; + toep->emss -= TCPOLEN_TSTAMP_APPA; } - CTR5(KTR_CXGBE, "%s: tid %d, mtu_idx %u (%u), mss %u", __func__, - toep->tid, G_TCPOPT_MSS(opt), sc->params.mtus[G_TCPOPT_MSS(opt)], - tp->t_maxseg); + CTR6(KTR_CXGBE, "%s: tid %d, mtu_idx %u (%u), t_maxseg %u, emss %u", + __func__, toep->tid, toep->mtu_idx, + sc->params.mtus[G_TCPOPT_MSS(opt)], tp->t_maxseg, toep->emss); if (G_TCPOPT_SACK(opt)) tp->t_flags |= TF_SACK_PERMIT; /* should already be set */ @@ -399,7 +401,7 @@ make_established(struct toepcb *toep, uint32_t iss, ui tp->irs = irs; tcp_rcvseqinit(tp); - tp->rcv_wnd = toep->opt0_rcv_bufsize << 10; + tp->rcv_wnd = (u_int)toep->opt0_rcv_bufsize << 10; tp->rcv_adv += tp->rcv_wnd; tp->last_ack_sent = tp->rcv_nxt; @@ -421,7 +423,7 @@ make_established(struct toepcb *toep, uint32_t iss, ui ftxp.snd_nxt = tp->snd_nxt; ftxp.rcv_nxt = tp->rcv_nxt; ftxp.snd_space = bufsize; - ftxp.mss = tp->t_maxseg; + ftxp.mss = toep->emss; send_flowc_wr(toep, &ftxp); soisconnected(so); @@ -613,7 +615,7 @@ write_tx_wr(void *dst, struct toepcb *toep, unsigned i if (txalign > 0) { struct tcpcb *tp = intotcpcb(toep->inp); - if (plen < 2 * tp->t_maxseg) + if (plen < 2 * toep->emss) txwr->lsodisable_to_flags |= htobe32(F_FW_OFLD_TX_DATA_WR_LSODISABLE); else Modified: stable/12/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- stable/12/sys/dev/cxgbe/tom/t4_tom.c Sun Jul 7 00:43:38 2019 (r349796) +++ stable/12/sys/dev/cxgbe/tom/t4_tom.c Sun Jul 7 05:30:07 2019 (r349797) @@ -852,8 +852,7 @@ remove_tid(struct adapter *sc, int tid, int ntids) * What mtu_idx to use, given a 4-tuple. Note that both s->mss and tcp_mssopt * have the MSS that we should advertise in our SYN. Advertised MSS doesn't * account for any TCP options so the effective MSS (only payload, no headers or - * options) could be different. We fill up tp->t_maxseg with the effective MSS - * at the end of the 3-way handshake. + * options) could be different. */ int find_best_mtu_idx(struct adapter *sc, struct in_conninfo *inc, Modified: stable/12/sys/dev/cxgbe/tom/t4_tom.h ============================================================================== --- stable/12/sys/dev/cxgbe/tom/t4_tom.h Sun Jul 7 00:43:38 2019 (r349796) +++ stable/12/sys/dev/cxgbe/tom/t4_tom.h Sun Jul 7 05:30:07 2019 (r349797) @@ -181,7 +181,10 @@ struct toepcb { u_int tx_nocompl; /* tx WR credits since last compl request */ u_int plen_nocompl; /* payload since last compl request */ - int opt0_rcv_bufsize; /* XXX: save full opt0/opt2 for later? */ + uint16_t opt0_rcv_bufsize; /* XXX: save full opt0/opt2 for later? */ + uint16_t mtu_idx; + uint16_t emss; + uint16_t tcp_opt; u_int ulp_mode; /* ULP mode */ void *ulpcb; From owner-svn-src-all@freebsd.org Sun Jul 7 06:06:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4D9615DCB6C; Sun, 7 Jul 2019 06:06:49 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 613FE6ECBD; Sun, 7 Jul 2019 06:06:49 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3AF2224D57; Sun, 7 Jul 2019 06:06:49 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6766nrU078856; Sun, 7 Jul 2019 06:06:49 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6766nYa078855; Sun, 7 Jul 2019 06:06:49 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201907070606.x6766nYa078855@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 7 Jul 2019 06:06:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349798 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 349798 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 613FE6ECBD X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.92)[-0.919,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 06:06:50 -0000 Author: alc Date: Sun Jul 7 06:06:48 2019 New Revision: 349798 URL: https://svnweb.freebsd.org/changeset/base/349798 Log: Three changes to pmap_enter(): 1. Use _pmap_alloc_l3() instead of pmap_alloc_l3() in order to handle the possibility that a superpage mapping for "va" was created while we slept. (This is derived from the amd64 version.) 2. Eliminate code for allocating kernel page table pages. Kernel page table pages are preallocated by pmap_growkernel(). 3. Eliminate duplicated unlock operations when KERN_RESOURCE_SHORTAGE is returned. MFC after: 2 weeks Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Sun Jul 7 05:30:07 2019 (r349797) +++ head/sys/arm64/arm64/pmap.c Sun Jul 7 06:06:48 2019 (r349798) @@ -3134,8 +3134,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v pt_entry_t new_l3, orig_l3; pt_entry_t *l2, *l3; pv_entry_t pv; - vm_paddr_t opa, pa, l1_pa, l2_pa, l3_pa; - vm_page_t mpte, om, l1_m, l2_m, l3_m; + vm_paddr_t opa, pa; + vm_page_t mpte, om; boolean_t nosleep; int lvl, rv; @@ -3159,7 +3159,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v CTR2(KTR_PMAP, "pmap_enter: %.16lx -> %.16lx", va, pa); lock = NULL; - mpte = NULL; PMAP_LOCK(pmap); if (psind == 1) { /* Assert the required virtual and physical alignment. */ @@ -3169,9 +3168,22 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v flags, m, &lock); goto out; } + mpte = NULL; + /* + * In the case that a page table page is not + * resident, we are creating it here. + */ +retry: pde = pmap_pde(pmap, va, &lvl); - if (pde != NULL && lvl == 1) { + if (pde != NULL && lvl == 2) { + l3 = pmap_l2_to_l3(pde, va); + if (va < VM_MAXUSER_ADDRESS && mpte == NULL) { + mpte = PHYS_TO_VM_PAGE(pmap_load(pde) & ~ATTR_MASK); + mpte->wire_count++; + } + goto havel3; + } else if (pde != NULL && lvl == 1) { l2 = pmap_l1_to_l2(pde, va); if ((pmap_load(l2) & ATTR_DESCR_MASK) == L2_BLOCK && (l3 = pmap_demote_l2_locked(pmap, l2, va, &lock)) != NULL) { @@ -3183,83 +3195,26 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v } goto havel3; } + /* We need to allocate an L3 table. */ } - if (va < VM_MAXUSER_ADDRESS) { nosleep = (flags & PMAP_ENTER_NOSLEEP) != 0; - mpte = pmap_alloc_l3(pmap, va, nosleep ? NULL : &lock); + + /* + * We use _pmap_alloc_l3() instead of pmap_alloc_l3() in order + * to handle the possibility that a superpage mapping for "va" + * was created while we slept. + */ + mpte = _pmap_alloc_l3(pmap, pmap_l2_pindex(va), + nosleep ? NULL : &lock); if (mpte == NULL && nosleep) { CTR0(KTR_PMAP, "pmap_enter: mpte == NULL"); - if (lock != NULL) - rw_wunlock(lock); - PMAP_UNLOCK(pmap); - return (KERN_RESOURCE_SHORTAGE); + rv = KERN_RESOURCE_SHORTAGE; + goto out; } - pde = pmap_pde(pmap, va, &lvl); - KASSERT(pde != NULL, - ("pmap_enter: Invalid page entry, va: 0x%lx", va)); - KASSERT(lvl == 2, - ("pmap_enter: Invalid level %d", lvl)); - } else { - /* - * If we get a level 2 pde it must point to a level 3 entry - * otherwise we will need to create the intermediate tables - */ - if (lvl < 2) { - switch (lvl) { - default: - case -1: - /* Get the l0 pde to update */ - pde = pmap_l0(pmap, va); - KASSERT(pde != NULL, ("...")); - - l1_m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | - VM_ALLOC_ZERO); - if (l1_m == NULL) - panic("pmap_enter: l1 pte_m == NULL"); - if ((l1_m->flags & PG_ZERO) == 0) - pmap_zero_page(l1_m); - - l1_pa = VM_PAGE_TO_PHYS(l1_m); - pmap_load_store(pde, l1_pa | L0_TABLE); - /* FALLTHROUGH */ - case 0: - /* Get the l1 pde to update */ - pde = pmap_l1_to_l2(pde, va); - KASSERT(pde != NULL, ("...")); - - l2_m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | - VM_ALLOC_ZERO); - if (l2_m == NULL) - panic("pmap_enter: l2 pte_m == NULL"); - if ((l2_m->flags & PG_ZERO) == 0) - pmap_zero_page(l2_m); - - l2_pa = VM_PAGE_TO_PHYS(l2_m); - pmap_load_store(pde, l2_pa | L1_TABLE); - /* FALLTHROUGH */ - case 1: - /* Get the l2 pde to update */ - pde = pmap_l1_to_l2(pde, va); - KASSERT(pde != NULL, ("...")); - - l3_m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | - VM_ALLOC_ZERO); - if (l3_m == NULL) - panic("pmap_enter: l3 pte_m == NULL"); - if ((l3_m->flags & PG_ZERO) == 0) - pmap_zero_page(l3_m); - - l3_pa = VM_PAGE_TO_PHYS(l3_m); - pmap_load_store(pde, l3_pa | L2_TABLE); - break; - } - } - } - l3 = pmap_l2_to_l3(pde, va); + goto retry; + } else + panic("pmap_enter: missing L3 table for kernel va %#lx", va); havel3: orig_l3 = pmap_load(l3); From owner-svn-src-all@freebsd.org Sun Jul 7 06:57:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FE2315DD6B2; Sun, 7 Jul 2019 06:57:05 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2D076705E1; Sun, 7 Jul 2019 06:57:05 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 109CF2559F; Sun, 7 Jul 2019 06:57:05 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x676v4oh005444; Sun, 7 Jul 2019 06:57:04 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x676v40s005443; Sun, 7 Jul 2019 06:57:04 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201907070657.x676v40s005443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Sun, 7 Jul 2019 06:57:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349799 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 349799 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2D076705E1 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.92)[-0.917,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 06:57:05 -0000 Author: dougm Date: Sun Jul 7 06:57:04 2019 New Revision: 349799 URL: https://svnweb.freebsd.org/changeset/base/349799 Log: A style-related change, r349791, made unclear the meaning of a comment. Rewrite that comment to improve its clarity. Reported by: cem Reviewed by: alc, cem Approved by: kib, markj (mentors, implicit) Differential Revision: https://reviews.freebsd.org/D20871 Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Sun Jul 7 06:06:48 2019 (r349798) +++ head/sys/vm/swap_pager.c Sun Jul 7 06:57:04 2019 (r349799) @@ -523,8 +523,8 @@ swap_pager_swap_init(void) * but it isn't very efficient). * * The nsw_cluster_max is constrained by the bp->b_pages[] - * array MAXPHYS / PAGE_SIZE and our locally defined - * MAX_PAGEOUT_CLUSTER. Also be aware that swap ops are + * array, which has MAXPHYS / PAGE_SIZE entries, and our locally + * defined MAX_PAGEOUT_CLUSTER. Also be aware that swap ops are * constrained by the swap device interleave stripe size. * * Currently we hardwire nsw_wcount_async to 4. This limit is From owner-svn-src-all@freebsd.org Sun Jul 7 08:53:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7018D15DF748; Sun, 7 Jul 2019 08:53:53 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 121D7744D7; Sun, 7 Jul 2019 08:53:53 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DFAE2269DE; Sun, 7 Jul 2019 08:53:52 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x678rqi9066948; Sun, 7 Jul 2019 08:53:52 GMT (envelope-from fsu@FreeBSD.org) Received: (from fsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x678rqRa066947; Sun, 7 Jul 2019 08:53:52 GMT (envelope-from fsu@FreeBSD.org) Message-Id: <201907070853.x678rqRa066947@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fsu set sender to fsu@FreeBSD.org using -f From: Fedor Uporov Date: Sun, 7 Jul 2019 08:53:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349800 - head/sys/fs/ext2fs X-SVN-Group: head X-SVN-Commit-Author: fsu X-SVN-Commit-Paths: head/sys/fs/ext2fs X-SVN-Commit-Revision: 349800 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 121D7744D7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.935,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 08:53:53 -0000 Author: fsu Date: Sun Jul 7 08:53:52 2019 New Revision: 349800 URL: https://svnweb.freebsd.org/changeset/base/349800 Log: Remove unneeded mount point unlock call. Reported by: Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of Fraunhofer FKIE Reported as: FS-11-EXT2-6: Denial Of Service in write-1 (ext2_balloc) MFC after: 2 weeks Modified: head/sys/fs/ext2fs/ext2_balloc.c Modified: head/sys/fs/ext2fs/ext2_balloc.c ============================================================================== --- head/sys/fs/ext2fs/ext2_balloc.c Sun Jul 7 06:57:04 2019 (r349799) +++ head/sys/fs/ext2fs/ext2_balloc.c Sun Jul 7 08:53:52 2019 (r349800) @@ -308,7 +308,6 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size */ if ((error = bwrite(nbp)) != 0) { ext2_blkfree(ip, nb, fs->e2fs_bsize); - EXT2_UNLOCK(ump); brelse(bp); return (error); } From owner-svn-src-all@freebsd.org Sun Jul 7 08:56:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47CAA15DF866; Sun, 7 Jul 2019 08:56:14 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1172C746B6; Sun, 7 Jul 2019 08:56:14 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0855269E6; Sun, 7 Jul 2019 08:56:13 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x678uD9Z067109; Sun, 7 Jul 2019 08:56:13 GMT (envelope-from fsu@FreeBSD.org) Received: (from fsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x678uDeR067108; Sun, 7 Jul 2019 08:56:13 GMT (envelope-from fsu@FreeBSD.org) Message-Id: <201907070856.x678uDeR067108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fsu set sender to fsu@FreeBSD.org using -f From: Fedor Uporov Date: Sun, 7 Jul 2019 08:56:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349801 - head/sys/fs/ext2fs X-SVN-Group: head X-SVN-Commit-Author: fsu X-SVN-Commit-Paths: head/sys/fs/ext2fs X-SVN-Commit-Revision: 349801 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1172C746B6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.937,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 08:56:14 -0000 Author: fsu Date: Sun Jul 7 08:56:13 2019 New Revision: 349801 URL: https://svnweb.freebsd.org/changeset/base/349801 Log: Remove ufs fragments logic. The ext2fs fragments are different from ufs fragments. In case of ext2fs the fragment should be equal or more then block size. The values more than block size are used only in case of bigalloc feature, which is does not supported for now. Reported by: Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of Fraunhofer FKIE Reported as: FS-22-EXT2-9: Denial of service in ftruncate-0 (ext2_balloc) MFC after: 2 weeks Modified: head/sys/fs/ext2fs/ext2_balloc.c Modified: head/sys/fs/ext2fs/ext2_balloc.c ============================================================================== --- head/sys/fs/ext2fs/ext2_balloc.c Sun Jul 7 08:53:52 2019 (r349800) +++ head/sys/fs/ext2fs/ext2_balloc.c Sun Jul 7 08:56:13 2019 (r349801) @@ -62,7 +62,7 @@ ext2_ext_balloc(struct inode *ip, uint32_t lbn, int si struct buf *bp = NULL; struct vnode *vp = ITOV(ip); daddr_t newblk; - int osize, nsize, blks, error, allocated; + int blks, error, allocated; fs = ip->i_e2fs; blks = howmany(size, fs->e2fs_bsize); @@ -72,47 +72,22 @@ ext2_ext_balloc(struct inode *ip, uint32_t lbn, int si return (error); if (allocated) { - if (ip->i_size < (lbn + 1) * fs->e2fs_bsize) - nsize = fragroundup(fs, size); - else - nsize = fs->e2fs_bsize; - - bp = getblk(vp, lbn, nsize, 0, 0, 0); + bp = getblk(vp, lbn, fs->e2fs_bsize, 0, 0, 0); if(!bp) return (EIO); - - bp->b_blkno = fsbtodb(fs, newblk); - if (flags & BA_CLRBUF) - vfs_bio_clrbuf(bp); } else { - if (ip->i_size >= (lbn + 1) * fs->e2fs_bsize) { - - error = bread(vp, lbn, fs->e2fs_bsize, NOCRED, &bp); - if (error) { - brelse(bp); - return (error); - } - bp->b_blkno = fsbtodb(fs, newblk); - *bpp = bp; - return (0); - } - - /* - * Consider need to reallocate a fragment. - */ - osize = fragroundup(fs, blkoff(fs, ip->i_size)); - nsize = fragroundup(fs, size); - if (nsize <= osize) - error = bread(vp, lbn, osize, NOCRED, &bp); - else - error = bread(vp, lbn, fs->e2fs_bsize, NOCRED, &bp); + error = bread(vp, lbn, fs->e2fs_bsize, NOCRED, &bp); if (error) { brelse(bp); return (error); } - bp->b_blkno = fsbtodb(fs, newblk); } + + bp->b_blkno = fsbtodb(fs, newblk); + if (flags & BA_CLRBUF) + vfs_bio_clrbuf(bp); + *bpp = bp; return (error); @@ -134,7 +109,7 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size struct indir indirs[EXT2_NIADDR + 2]; e4fs_daddr_t nb, newb; e2fs_daddr_t *bap, pref; - int osize, nsize, num, i, error; + int num, i, error; *bpp = NULL; if (lbn < 0) @@ -164,53 +139,22 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size * no new block is to be allocated, and no need to expand * the file */ - if (nb != 0 && ip->i_size >= (lbn + 1) * fs->e2fs_bsize) { + if (nb != 0) { error = bread(vp, lbn, fs->e2fs_bsize, NOCRED, &bp); if (error) { brelse(bp); return (error); } bp->b_blkno = fsbtodb(fs, nb); - *bpp = bp; - return (0); - } - if (nb != 0) { - /* - * Consider need to reallocate a fragment. - */ - osize = fragroundup(fs, blkoff(fs, ip->i_size)); - nsize = fragroundup(fs, size); - if (nsize <= osize) { - error = bread(vp, lbn, osize, NOCRED, &bp); - if (error) { - brelse(bp); - return (error); - } - bp->b_blkno = fsbtodb(fs, nb); - } else { - /* - * Godmar thinks: this shouldn't happen w/o - * fragments - */ - printf("nsize %d(%d) > osize %d(%d) nb %d\n", - (int)nsize, (int)size, (int)osize, - (int)ip->i_size, (int)nb); - panic( - "ext2_balloc: Something is terribly wrong"); -/* - * please note there haven't been any changes from here on - - * FFS seems to work. - */ + if (ip->i_size >= (lbn + 1) * fs->e2fs_bsize) { + *bpp = bp; + return (0); } } else { - if (ip->i_size < (lbn + 1) * fs->e2fs_bsize) - nsize = fragroundup(fs, size); - else - nsize = fs->e2fs_bsize; EXT2_LOCK(ump); error = ext2_alloc(ip, lbn, ext2_blkpref(ip, lbn, (int)lbn, &ip->i_db[0], 0), - nsize, cred, &newb); + fs->e2fs_bsize, cred, &newb); if (error) return (error); /* @@ -219,7 +163,7 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size */ if (newb > UINT_MAX) return (EFBIG); - bp = getblk(vp, lbn, nsize, 0, 0, 0); + bp = getblk(vp, lbn, fs->e2fs_bsize, 0, 0, 0); bp->b_blkno = fsbtodb(fs, newb); if (flags & BA_CLRBUF) vfs_bio_clrbuf(bp); From owner-svn-src-all@freebsd.org Sun Jul 7 08:58:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA33515DF991; Sun, 7 Jul 2019 08:58:03 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7E5E974885; Sun, 7 Jul 2019 08:58:03 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52ED6269E7; Sun, 7 Jul 2019 08:58:03 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x678w3rY067223; Sun, 7 Jul 2019 08:58:03 GMT (envelope-from fsu@FreeBSD.org) Received: (from fsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x678w3go067222; Sun, 7 Jul 2019 08:58:03 GMT (envelope-from fsu@FreeBSD.org) Message-Id: <201907070858.x678w3go067222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fsu set sender to fsu@FreeBSD.org using -f From: Fedor Uporov Date: Sun, 7 Jul 2019 08:58:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349802 - head/sys/fs/ext2fs X-SVN-Group: head X-SVN-Commit-Author: fsu X-SVN-Commit-Paths: head/sys/fs/ext2fs X-SVN-Commit-Revision: 349802 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7E5E974885 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.936,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 08:58:04 -0000 Author: fsu Date: Sun Jul 7 08:58:02 2019 New Revision: 349802 URL: https://svnweb.freebsd.org/changeset/base/349802 Log: Add additional check for 'blocks per group' and 'fragments per group' superblock fields. These fields will not be equal only in case if bigalloc filesystem feature is turned on. This feature is not supported for now. Reported by: Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of Fraunhofer FKIE Reported as: FS-27-EXT2-12: Denial of Service in openat-0 (vm_fault_hold/ext2_clusteracct) MFC after: 2 weeks Modified: head/sys/fs/ext2fs/ext2_vfsops.c Modified: head/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- head/sys/fs/ext2fs/ext2_vfsops.c Sun Jul 7 08:56:13 2019 (r349801) +++ head/sys/fs/ext2fs/ext2_vfsops.c Sun Jul 7 08:58:02 2019 (r349802) @@ -559,7 +559,12 @@ ext2_compute_sb_data(struct vnode *devvp, struct ext2f SDT_PROBE1(ext2fs, , vfsops, ext2_compute_sb_data_error, "zero blocks/fragments per group"); return (EINVAL); + } else if (fs->e2fs_bpg != fs->e2fs_fpg) { + SDT_PROBE1(ext2fs, , vfsops, ext2_compute_sb_data_error, + "blocks per group not equal fragments per group"); + return (EINVAL); } + if (fs->e2fs_bpg != fs->e2fs_bsize * 8) { SDT_PROBE1(ext2fs, , vfsops, ext2_compute_sb_data_error, "non-standard group size unsupported"); From owner-svn-src-all@freebsd.org Sun Jul 7 12:15:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FB7D15E3979; Sun, 7 Jul 2019 12:15:26 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C5A7384517; Sun, 7 Jul 2019 12:15:25 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 972B4C23; Sun, 7 Jul 2019 12:15:25 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67CFPUe072553; Sun, 7 Jul 2019 12:15:25 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67CFO5a072548; Sun, 7 Jul 2019 12:15:24 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201907071215.x67CFO5a072548@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Sun, 7 Jul 2019 12:15:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349803 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349803 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C5A7384517 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.950,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 12:15:26 -0000 Author: vmaffione Date: Sun Jul 7 12:15:24 2019 New Revision: 349803 URL: https://svnweb.freebsd.org/changeset/base/349803 Log: bhyve: abstraction for network backends Bhyve can currently emulate two virtual NICs, namely virtio-net and e1000, and connect to the host network through two backends, namely tap and netmap. However, there is no interface between virtual NIC functionalities and backend functionalities. As a result, the backend code is duplicated between the two virtual NIC implementations and also within the same virtual NIC. Also, e1000 cannot currently use netmap as a backend. This patch introduces a network backend API between virtio-net/e1000 and tap/netmap, to improve code reuse and add missing functionalities. Virtual NICs and backends can negotiate virtio-net features, such as checksum offload and TSO. If the backend supports the features, it will propagate this information to the guest, so that the latter can make use of them. Currently, only netmap VALE ports support the features, but support should be added to tap in the future. Reviewed by: jhb, bryanv MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20659 Added: head/usr.sbin/bhyve/net_backends.c (contents, props changed) head/usr.sbin/bhyve/net_backends.h (contents, props changed) Modified: head/usr.sbin/bhyve/Makefile head/usr.sbin/bhyve/pci_e82545.c head/usr.sbin/bhyve/pci_virtio_net.c Modified: head/usr.sbin/bhyve/Makefile ============================================================================== --- head/usr.sbin/bhyve/Makefile Sun Jul 7 08:58:02 2019 (r349802) +++ head/usr.sbin/bhyve/Makefile Sun Jul 7 12:15:24 2019 (r349803) @@ -34,6 +34,7 @@ SRCS= \ mem.c \ mevent.c \ mptbl.c \ + net_backends.c \ net_utils.c \ pci_ahci.c \ pci_e82545.c \ Added: head/usr.sbin/bhyve/net_backends.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bhyve/net_backends.c Sun Jul 7 12:15:24 2019 (r349803) @@ -0,0 +1,806 @@ +/*- + * Copyright (c) 2019 Vincenzo Maffione + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * This file implements multiple network backends (tap, netmap, ...), + * to be used by network frontends such as virtio-net and e1000. + * The API to access the backend (e.g. send/receive packets, negotiate + * features) is exported by net_backends.h. + */ + +#include /* u_short etc */ +#ifndef WITHOUT_CAPSICUM +#include +#endif +#include +#include +#include +#include + +#include +#include +#include +#define NETMAP_WITH_LIBS +#include + +#ifndef WITHOUT_CAPSICUM +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include "iov.h" +#include "mevent.h" +#include "net_backends.h" + +#include + +/* + * Each network backend registers a set of function pointers that are + * used to implement the net backends API. + * This might need to be exposed if we implement backends in separate files. + */ +struct net_backend { + const char *prefix; /* prefix matching this backend */ + + /* + * Routines used to initialize and cleanup the resources needed + * by a backend. The cleanup function is used internally, + * and should not be called by the frontend. + */ + int (*init)(struct net_backend *be, const char *devname, + net_be_rxeof_t cb, void *param); + void (*cleanup)(struct net_backend *be); + + /* + * Called to serve a guest transmit request. The scatter-gather + * vector provided by the caller has 'iovcnt' elements and contains + * the packet to send. + */ + ssize_t (*send)(struct net_backend *be, struct iovec *iov, int iovcnt); + + /* + * Called to receive a packet from the backend. When the function + * returns a positive value 'len', the scatter-gather vector + * provided by the caller contains a packet with such length. + * The function returns 0 if the backend doesn't have a new packet to + * receive. + */ + ssize_t (*recv)(struct net_backend *be, struct iovec *iov, int iovcnt); + + /* + * Ask the backend for the virtio-net features it is able to + * support. Possible features are TSO, UFO and checksum offloading + * in both rx and tx direction and for both IPv4 and IPv6. + */ + uint64_t (*get_cap)(struct net_backend *be); + + /* + * Tell the backend to enable/disable the specified virtio-net + * features (capabilities). + */ + int (*set_cap)(struct net_backend *be, uint64_t features, + unsigned int vnet_hdr_len); + + struct pci_vtnet_softc *sc; + int fd; + + /* + * Length of the virtio-net header used by the backend and the + * frontend, respectively. A zero value means that the header + * is not used. + */ + unsigned int be_vnet_hdr_len; + unsigned int fe_vnet_hdr_len; + + /* Size of backend-specific private data. */ + size_t priv_size; + + /* Room for backend-specific data. */ + char opaque[0]; +}; + +SET_DECLARE(net_backend_set, struct net_backend); + +#define VNET_HDR_LEN sizeof(struct virtio_net_rxhdr) + +#define WPRINTF(params) printf params + +/* + * The tap backend + */ + +struct tap_priv { + struct mevent *mevp; +}; + +static void +tap_cleanup(struct net_backend *be) +{ + struct tap_priv *priv = (struct tap_priv *)be->opaque; + + if (priv->mevp) { + mevent_delete(priv->mevp); + } + if (be->fd != -1) { + close(be->fd); + be->fd = -1; + } +} + +static int +tap_init(struct net_backend *be, const char *devname, + net_be_rxeof_t cb, void *param) +{ + struct tap_priv *priv = (struct tap_priv *)be->opaque; + char tbuf[80]; + int fd; + int opt = 1; +#ifndef WITHOUT_CAPSICUM + cap_rights_t rights; +#endif + + if (cb == NULL) { + WPRINTF(("TAP backend requires non-NULL callback\n")); + return (-1); + } + + strcpy(tbuf, "/dev/"); + strlcat(tbuf, devname, sizeof(tbuf)); + + fd = open(tbuf, O_RDWR); + if (fd == -1) { + WPRINTF(("open of tap device %s failed\n", tbuf)); + goto error; + } + + /* + * Set non-blocking and register for read + * notifications with the event loop + */ + if (ioctl(fd, FIONBIO, &opt) < 0) { + WPRINTF(("tap device O_NONBLOCK failed\n")); + goto error; + } + +#ifndef WITHOUT_CAPSICUM + cap_rights_init(&rights, CAP_EVENT, CAP_READ, CAP_WRITE); + if (caph_rights_limit(fd, &rights) == -1) + errx(EX_OSERR, "Unable to apply rights for sandbox"); +#endif + + priv->mevp = mevent_add(fd, EVF_READ, cb, param); + if (priv->mevp == NULL) { + WPRINTF(("Could not register event\n")); + goto error; + } + + be->fd = fd; + + return (0); + +error: + tap_cleanup(be); + return (-1); +} + +/* + * Called to send a buffer chain out to the tap device + */ +static ssize_t +tap_send(struct net_backend *be, struct iovec *iov, int iovcnt) +{ + return (writev(be->fd, iov, iovcnt)); +} + +static ssize_t +tap_recv(struct net_backend *be, struct iovec *iov, int iovcnt) +{ + ssize_t ret; + + /* Should never be called without a valid tap fd */ + assert(be->fd != -1); + + ret = readv(be->fd, iov, iovcnt); + + if (ret < 0 && errno == EWOULDBLOCK) { + return (0); + } + + return (ret); +} + +static uint64_t +tap_get_cap(struct net_backend *be) +{ + + return (0); /* no capabilities for now */ +} + +static int +tap_set_cap(struct net_backend *be, uint64_t features, + unsigned vnet_hdr_len) +{ + + return ((features || vnet_hdr_len) ? -1 : 0); +} + +static struct net_backend tap_backend = { + .prefix = "tap", + .priv_size = sizeof(struct tap_priv), + .init = tap_init, + .cleanup = tap_cleanup, + .send = tap_send, + .recv = tap_recv, + .get_cap = tap_get_cap, + .set_cap = tap_set_cap, +}; + +/* A clone of the tap backend, with a different prefix. */ +static struct net_backend vmnet_backend = { + .prefix = "vmnet", + .priv_size = sizeof(struct tap_priv), + .init = tap_init, + .cleanup = tap_cleanup, + .send = tap_send, + .recv = tap_recv, + .get_cap = tap_get_cap, + .set_cap = tap_set_cap, +}; + +DATA_SET(net_backend_set, tap_backend); +DATA_SET(net_backend_set, vmnet_backend); + +/* + * The netmap backend + */ + +/* The virtio-net features supported by netmap. */ +#define NETMAP_FEATURES (VIRTIO_NET_F_CSUM | VIRTIO_NET_F_HOST_TSO4 | \ + VIRTIO_NET_F_HOST_TSO6 | VIRTIO_NET_F_HOST_UFO | \ + VIRTIO_NET_F_GUEST_CSUM | VIRTIO_NET_F_GUEST_TSO4 | \ + VIRTIO_NET_F_GUEST_TSO6 | VIRTIO_NET_F_GUEST_UFO) + +struct netmap_priv { + char ifname[IFNAMSIZ]; + struct nm_desc *nmd; + uint16_t memid; + struct netmap_ring *rx; + struct netmap_ring *tx; + struct mevent *mevp; + net_be_rxeof_t cb; + void *cb_param; +}; + +static void +nmreq_init(struct nmreq *req, char *ifname) +{ + + memset(req, 0, sizeof(*req)); + strlcpy(req->nr_name, ifname, sizeof(req->nr_name)); + req->nr_version = NETMAP_API; +} + +static int +netmap_set_vnet_hdr_len(struct net_backend *be, int vnet_hdr_len) +{ + int err; + struct nmreq req; + struct netmap_priv *priv = (struct netmap_priv *)be->opaque; + + nmreq_init(&req, priv->ifname); + req.nr_cmd = NETMAP_BDG_VNET_HDR; + req.nr_arg1 = vnet_hdr_len; + err = ioctl(be->fd, NIOCREGIF, &req); + if (err) { + WPRINTF(("Unable to set vnet header length %d\n", + vnet_hdr_len)); + return (err); + } + + be->be_vnet_hdr_len = vnet_hdr_len; + + return (0); +} + +static int +netmap_has_vnet_hdr_len(struct net_backend *be, unsigned vnet_hdr_len) +{ + int prev_hdr_len = be->be_vnet_hdr_len; + int ret; + + if (vnet_hdr_len == prev_hdr_len) { + return (1); + } + + ret = netmap_set_vnet_hdr_len(be, vnet_hdr_len); + if (ret) { + return (0); + } + + netmap_set_vnet_hdr_len(be, prev_hdr_len); + + return (1); +} + +static uint64_t +netmap_get_cap(struct net_backend *be) +{ + + return (netmap_has_vnet_hdr_len(be, VNET_HDR_LEN) ? + NETMAP_FEATURES : 0); +} + +static int +netmap_set_cap(struct net_backend *be, uint64_t features, + unsigned vnet_hdr_len) +{ + + return (netmap_set_vnet_hdr_len(be, vnet_hdr_len)); +} + +static int +netmap_init(struct net_backend *be, const char *devname, + net_be_rxeof_t cb, void *param) +{ + struct netmap_priv *priv = (struct netmap_priv *)be->opaque; + + strlcpy(priv->ifname, devname, sizeof(priv->ifname)); + priv->ifname[sizeof(priv->ifname) - 1] = '\0'; + + priv->nmd = nm_open(priv->ifname, NULL, NETMAP_NO_TX_POLL, NULL); + if (priv->nmd == NULL) { + WPRINTF(("Unable to nm_open(): interface '%s', errno (%s)\n", + devname, strerror(errno))); + free(priv); + return (-1); + } + + priv->memid = priv->nmd->req.nr_arg2; + priv->tx = NETMAP_TXRING(priv->nmd->nifp, 0); + priv->rx = NETMAP_RXRING(priv->nmd->nifp, 0); + priv->cb = cb; + priv->cb_param = param; + be->fd = priv->nmd->fd; + + priv->mevp = mevent_add(be->fd, EVF_READ, cb, param); + if (priv->mevp == NULL) { + WPRINTF(("Could not register event\n")); + return (-1); + } + + return (0); +} + +static void +netmap_cleanup(struct net_backend *be) +{ + struct netmap_priv *priv = (struct netmap_priv *)be->opaque; + + if (priv->mevp) { + mevent_delete(priv->mevp); + } + if (priv->nmd) { + nm_close(priv->nmd); + } + be->fd = -1; +} + +static ssize_t +netmap_send(struct net_backend *be, struct iovec *iov, + int iovcnt) +{ + struct netmap_priv *priv = (struct netmap_priv *)be->opaque; + struct netmap_ring *ring; + ssize_t totlen = 0; + int nm_buf_size; + int nm_buf_len; + uint32_t head; + void *nm_buf; + int j; + + ring = priv->tx; + head = ring->head; + if (head == ring->tail) { + WPRINTF(("No space, drop %zu bytes\n", count_iov(iov, iovcnt))); + goto txsync; + } + nm_buf = NETMAP_BUF(ring, ring->slot[head].buf_idx); + nm_buf_size = ring->nr_buf_size; + nm_buf_len = 0; + + for (j = 0; j < iovcnt; j++) { + int iov_frag_size = iov[j].iov_len; + void *iov_frag_buf = iov[j].iov_base; + + totlen += iov_frag_size; + + /* + * Split each iovec fragment over more netmap slots, if + * necessary. + */ + for (;;) { + int copylen; + + copylen = iov_frag_size < nm_buf_size ? iov_frag_size : nm_buf_size; + memcpy(nm_buf, iov_frag_buf, copylen); + + iov_frag_buf += copylen; + iov_frag_size -= copylen; + nm_buf += copylen; + nm_buf_size -= copylen; + nm_buf_len += copylen; + + if (iov_frag_size == 0) { + break; + } + + ring->slot[head].len = nm_buf_len; + ring->slot[head].flags = NS_MOREFRAG; + head = nm_ring_next(ring, head); + if (head == ring->tail) { + /* + * We ran out of netmap slots while + * splitting the iovec fragments. + */ + WPRINTF(("No space, drop %zu bytes\n", + count_iov(iov, iovcnt))); + goto txsync; + } + nm_buf = NETMAP_BUF(ring, ring->slot[head].buf_idx); + nm_buf_size = ring->nr_buf_size; + nm_buf_len = 0; + } + } + + /* Complete the last slot, which must not have NS_MOREFRAG set. */ + ring->slot[head].len = nm_buf_len; + ring->slot[head].flags = 0; + head = nm_ring_next(ring, head); + + /* Now update ring->head and ring->cur. */ + ring->head = ring->cur = head; +txsync: + ioctl(be->fd, NIOCTXSYNC, NULL); + + return (totlen); +} + +static ssize_t +netmap_recv(struct net_backend *be, struct iovec *iov, int iovcnt) +{ + struct netmap_priv *priv = (struct netmap_priv *)be->opaque; + struct netmap_slot *slot = NULL; + struct netmap_ring *ring; + void *iov_frag_buf; + int iov_frag_size; + ssize_t totlen = 0; + uint32_t head; + + assert(iovcnt); + + ring = priv->rx; + head = ring->head; + iov_frag_buf = iov->iov_base; + iov_frag_size = iov->iov_len; + + do { + int nm_buf_len; + void *nm_buf; + + if (head == ring->tail) { + return (0); + } + + slot = ring->slot + head; + nm_buf = NETMAP_BUF(ring, slot->buf_idx); + nm_buf_len = slot->len; + + for (;;) { + int copylen = nm_buf_len < iov_frag_size ? + nm_buf_len : iov_frag_size; + + memcpy(iov_frag_buf, nm_buf, copylen); + nm_buf += copylen; + nm_buf_len -= copylen; + iov_frag_buf += copylen; + iov_frag_size -= copylen; + totlen += copylen; + + if (nm_buf_len == 0) { + break; + } + + iov++; + iovcnt--; + if (iovcnt == 0) { + /* No space to receive. */ + WPRINTF(("Short iov, drop %zd bytes\n", + totlen)); + return (-ENOSPC); + } + iov_frag_buf = iov->iov_base; + iov_frag_size = iov->iov_len; + } + + head = nm_ring_next(ring, head); + + } while (slot->flags & NS_MOREFRAG); + + /* Release slots to netmap. */ + ring->head = ring->cur = head; + + return (totlen); +} + +static struct net_backend netmap_backend = { + .prefix = "netmap", + .priv_size = sizeof(struct netmap_priv), + .init = netmap_init, + .cleanup = netmap_cleanup, + .send = netmap_send, + .recv = netmap_recv, + .get_cap = netmap_get_cap, + .set_cap = netmap_set_cap, +}; + +/* A clone of the netmap backend, with a different prefix. */ +static struct net_backend vale_backend = { + .prefix = "vale", + .priv_size = sizeof(struct netmap_priv), + .init = netmap_init, + .cleanup = netmap_cleanup, + .send = netmap_send, + .recv = netmap_recv, + .get_cap = netmap_get_cap, + .set_cap = netmap_set_cap, +}; + +DATA_SET(net_backend_set, netmap_backend); +DATA_SET(net_backend_set, vale_backend); + +/* + * Initialize a backend and attach to the frontend. + * This is called during frontend initialization. + * @pbe is a pointer to the backend to be initialized + * @devname is the backend-name as supplied on the command line, + * e.g. -s 2:0,frontend-name,backend-name[,other-args] + * @cb is the receive callback supplied by the frontend, + * and it is invoked in the event loop when a receive + * event is generated in the hypervisor, + * @param is a pointer to the frontend, and normally used as + * the argument for the callback. + */ +int +netbe_init(struct net_backend **ret, const char *devname, net_be_rxeof_t cb, + void *param) +{ + struct net_backend **pbe, *nbe, *tbe = NULL; + int err; + + /* + * Find the network backend that matches the user-provided + * device name. net_backend_set is built using a linker set. + */ + SET_FOREACH(pbe, net_backend_set) { + if (strncmp(devname, (*pbe)->prefix, + strlen((*pbe)->prefix)) == 0) { + tbe = *pbe; + assert(tbe->init != NULL); + assert(tbe->cleanup != NULL); + assert(tbe->send != NULL); + assert(tbe->recv != NULL); + assert(tbe->get_cap != NULL); + assert(tbe->set_cap != NULL); + break; + } + } + + *ret = NULL; + if (tbe == NULL) + return (EINVAL); + nbe = calloc(1, sizeof(*nbe) + tbe->priv_size); + *nbe = *tbe; /* copy the template */ + nbe->fd = -1; + nbe->sc = param; + nbe->be_vnet_hdr_len = 0; + nbe->fe_vnet_hdr_len = 0; + + /* Initialize the backend. */ + err = nbe->init(nbe, devname, cb, param); + if (err) { + free(nbe); + return (err); + } + + *ret = nbe; + + return (0); +} + +void +netbe_cleanup(struct net_backend *be) +{ + + if (be != NULL) { + be->cleanup(be); + free(be); + } +} + +uint64_t +netbe_get_cap(struct net_backend *be) +{ + + assert(be != NULL); + return (be->get_cap(be)); +} + +int +netbe_set_cap(struct net_backend *be, uint64_t features, + unsigned vnet_hdr_len) +{ + int ret; + + assert(be != NULL); + + /* There are only three valid lengths, i.e., 0, 10 and 12. */ + if (vnet_hdr_len && vnet_hdr_len != VNET_HDR_LEN + && vnet_hdr_len != (VNET_HDR_LEN - sizeof(uint16_t))) + return (-1); + + be->fe_vnet_hdr_len = vnet_hdr_len; + + ret = be->set_cap(be, features, vnet_hdr_len); + assert(be->be_vnet_hdr_len == 0 || + be->be_vnet_hdr_len == be->fe_vnet_hdr_len); + + return (ret); +} + +static __inline struct iovec * +iov_trim(struct iovec *iov, int *iovcnt, unsigned int tlen) +{ + struct iovec *riov; + + /* XXX short-cut: assume first segment is >= tlen */ + assert(iov[0].iov_len >= tlen); + + iov[0].iov_len -= tlen; + if (iov[0].iov_len == 0) { + assert(*iovcnt > 1); + *iovcnt -= 1; + riov = &iov[1]; + } else { + iov[0].iov_base = (void *)((uintptr_t)iov[0].iov_base + tlen); + riov = &iov[0]; + } + + return (riov); +} + +ssize_t +netbe_send(struct net_backend *be, struct iovec *iov, int iovcnt) +{ + + assert(be != NULL); + if (be->be_vnet_hdr_len != be->fe_vnet_hdr_len) { + /* + * The frontend uses a virtio-net header, but the backend + * does not. We ignore it (as it must be all zeroes) and + * strip it. + */ + assert(be->be_vnet_hdr_len == 0); + iov = iov_trim(iov, &iovcnt, be->fe_vnet_hdr_len); + } + + return (be->send(be, iov, iovcnt)); +} + +/* + * Try to read a packet from the backend, without blocking. + * If no packets are available, return 0. In case of success, return + * the length of the packet just read. Return -1 in case of errors. + */ +ssize_t +netbe_recv(struct net_backend *be, struct iovec *iov, int iovcnt) +{ + /* Length of prepended virtio-net header. */ + unsigned int hlen = be->fe_vnet_hdr_len; + int ret; + + assert(be != NULL); + + if (hlen && hlen != be->be_vnet_hdr_len) { + /* + * The frontend uses a virtio-net header, but the backend + * does not. We need to prepend a zeroed header. + */ + struct virtio_net_rxhdr *vh; + + assert(be->be_vnet_hdr_len == 0); + + /* + * Get a pointer to the rx header, and use the + * data immediately following it for the packet buffer. + */ + vh = iov[0].iov_base; + iov = iov_trim(iov, &iovcnt, hlen); + + /* + * The only valid field in the rx packet header is the + * number of buffers if merged rx bufs were negotiated. + */ + memset(vh, 0, hlen); + if (hlen == VNET_HDR_LEN) { + vh->vrh_bufs = 1; + } + } + + ret = be->recv(be, iov, iovcnt); + if (ret > 0) { + ret += hlen; + } + + return (ret); +} + +/* + * Read a packet from the backend and discard it. + * Returns the size of the discarded packet or zero if no packet was available. + * A negative error code is returned in case of read error. + */ +ssize_t +netbe_rx_discard(struct net_backend *be) +{ + /* + * MP note: the dummybuf is only used to discard frames, + * so there is no need for it to be per-vtnet or locked. + * We only make it large enough for TSO-sized segment. + */ + static uint8_t dummybuf[65536 + 64]; + struct iovec iov; + + iov.iov_base = dummybuf; + iov.iov_len = sizeof(dummybuf); + + return netbe_recv(be, &iov, 1); +} + Added: head/usr.sbin/bhyve/net_backends.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bhyve/net_backends.h Sun Jul 7 12:15:24 2019 (r349803) @@ -0,0 +1,87 @@ +/*- + * Copyright (c) 2019 Vincenzo Maffione + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __NET_BACKENDS_H__ +#define __NET_BACKENDS_H__ + +#include + +/* Opaque type representing a network backend. */ +typedef struct net_backend net_backend_t; + +/* Interface between network frontends and the network backends. */ +typedef void (*net_be_rxeof_t)(int, enum ev_type, void *param); +int netbe_init(net_backend_t **be, const char *devname, net_be_rxeof_t cb, + void *param); +void netbe_cleanup(net_backend_t *be); +uint64_t netbe_get_cap(net_backend_t *be); +int netbe_set_cap(net_backend_t *be, uint64_t cap, + unsigned vnet_hdr_len); +ssize_t netbe_send(net_backend_t *be, struct iovec *iov, int iovcnt); +ssize_t netbe_recv(net_backend_t *be, struct iovec *iov, int iovcnt); +ssize_t netbe_rx_discard(net_backend_t *be); + + +/* + * Network device capabilities taken from the VirtIO standard. + * Despite the name, these capabilities can be used by different frontents + * (virtio-net, ptnet) and supported by different backends (netmap, tap, ...). + */ +#define VIRTIO_NET_F_CSUM (1 << 0) /* host handles partial cksum */ +#define VIRTIO_NET_F_GUEST_CSUM (1 << 1) /* guest handles partial cksum */ +#define VIRTIO_NET_F_MAC (1 << 5) /* host supplies MAC */ +#define VIRTIO_NET_F_GSO_DEPREC (1 << 6) /* deprecated: host handles GSO */ +#define VIRTIO_NET_F_GUEST_TSO4 (1 << 7) /* guest can rcv TSOv4 */ +#define VIRTIO_NET_F_GUEST_TSO6 (1 << 8) /* guest can rcv TSOv6 */ +#define VIRTIO_NET_F_GUEST_ECN (1 << 9) /* guest can rcv TSO with ECN */ +#define VIRTIO_NET_F_GUEST_UFO (1 << 10) /* guest can rcv UFO */ +#define VIRTIO_NET_F_HOST_TSO4 (1 << 11) /* host can rcv TSOv4 */ +#define VIRTIO_NET_F_HOST_TSO6 (1 << 12) /* host can rcv TSOv6 */ +#define VIRTIO_NET_F_HOST_ECN (1 << 13) /* host can rcv TSO with ECN */ +#define VIRTIO_NET_F_HOST_UFO (1 << 14) /* host can rcv UFO */ +#define VIRTIO_NET_F_MRG_RXBUF (1 << 15) /* host can merge RX buffers */ +#define VIRTIO_NET_F_STATUS (1 << 16) /* config status field available */ +#define VIRTIO_NET_F_CTRL_VQ (1 << 17) /* control channel available */ +#define VIRTIO_NET_F_CTRL_RX (1 << 18) /* control channel RX mode support */ +#define VIRTIO_NET_F_CTRL_VLAN (1 << 19) /* control channel VLAN filtering */ +#define VIRTIO_NET_F_GUEST_ANNOUNCE \ + (1 << 21) /* guest can send gratuitous pkts */ + +/* + * Fixed network header size + */ +struct virtio_net_rxhdr { + uint8_t vrh_flags; + uint8_t vrh_gso_type; + uint16_t vrh_hdr_len; + uint16_t vrh_gso_size; + uint16_t vrh_csum_start; + uint16_t vrh_csum_offset; + uint16_t vrh_bufs; +} __packed; + +#endif /* __NET_BACKENDS_H__ */ Modified: head/usr.sbin/bhyve/pci_e82545.c ============================================================================== --- head/usr.sbin/bhyve/pci_e82545.c Sun Jul 7 08:58:02 2019 (r349802) +++ head/usr.sbin/bhyve/pci_e82545.c Sun Jul 7 12:15:24 2019 (r349803) @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include "pci_emul.h" #include "mevent.h" #include "net_utils.h" +#include "net_backends.h" /* Hardware/register definitions XXX: move some to common code. */ #define E82545_VENDOR_ID_INTEL 0x8086 @@ -245,11 +246,10 @@ struct eth_uni { struct e82545_softc { struct pci_devinst *esc_pi; struct vmctx *esc_ctx; - struct mevent *esc_mevp; struct mevent *esc_mevpitr; pthread_mutex_t esc_mtx; struct ether_addr esc_mac; - int esc_tapfd; + net_backend_t *esc_be; /* General */ uint32_t esc_CTRL; /* x0000 device ctl */ @@ -355,7 +355,7 @@ struct e82545_softc { static void e82545_reset(struct e82545_softc *sc, int dev); static void e82545_rx_enable(struct e82545_softc *sc); static void e82545_rx_disable(struct e82545_softc *sc); -static void e82545_tap_callback(int fd, enum ev_type type, void *param); +static void e82545_rx_callback(int fd, enum ev_type type, void *param); static void e82545_tx_start(struct e82545_softc *sc); static void e82545_tx_enable(struct e82545_softc *sc); static void e82545_tx_disable(struct e82545_softc *sc); @@ -824,11 +824,9 @@ e82545_bufsz(uint32_t rctl) return (256); /* Forbidden value. */ } -static uint8_t dummybuf[2048]; - /* XXX one packet at a time until this is debugged */ static void -e82545_tap_callback(int fd, enum ev_type type, void *param) +e82545_rx_callback(int fd, enum ev_type type, void *param) { struct e82545_softc *sc = param; struct e1000_rx_desc *rxd; @@ -843,7 +841,7 @@ e82545_tap_callback(int fd, enum ev_type type, void *p if (!sc->esc_rx_enabled || sc->esc_rx_loopback) { DPRINTF("rx disabled (!%d || %d) -- packet(s) dropped\r\n", sc->esc_rx_enabled, sc->esc_rx_loopback); - while (read(sc->esc_tapfd, dummybuf, sizeof(dummybuf)) > 0) { + while (netbe_rx_discard(sc->esc_be) > 0) { } goto done1; } @@ -856,7 +854,7 @@ e82545_tap_callback(int fd, enum ev_type type, void *p if (left < maxpktdesc) { DPRINTF("rx overflow (%d < %d) -- packet(s) dropped\r\n", left, maxpktdesc); - while (read(sc->esc_tapfd, dummybuf, sizeof(dummybuf)) > 0) { + while (netbe_rx_discard(sc->esc_be) > 0) { } goto done1; } @@ -873,9 +871,9 @@ e82545_tap_callback(int fd, enum ev_type type, void *p rxd->buffer_addr, bufsz); vec[i].iov_len = bufsz; } - len = readv(sc->esc_tapfd, vec, maxpktdesc); + len = netbe_recv(sc->esc_be, vec, maxpktdesc); if (len <= 0) { - DPRINTF("tap: readv() returned %d\n", len); + DPRINTF("netbe_recv() returned %d\n", len); goto done; } @@ -1050,10 +1048,10 @@ static void e82545_transmit_backend(struct e82545_softc *sc, struct iovec *iov, int iovcnt) { - if (sc->esc_tapfd == -1) + if (sc->esc_be == NULL) return; - (void) writev(sc->esc_tapfd, iov, iovcnt); + (void) netbe_send(sc->esc_be, iov, iovcnt); } static void @@ -2209,56 +2207,6 @@ e82545_reset(struct e82545_softc *sc, int drvr) sc->esc_TXDCTL = 0; } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Jul 7 14:19:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E93415E573D; Sun, 7 Jul 2019 14:19:20 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9C4988857C; Sun, 7 Jul 2019 14:19:19 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 710832082; Sun, 7 Jul 2019 14:19:19 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67EJJH6034474; Sun, 7 Jul 2019 14:19:19 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67EJJT0034473; Sun, 7 Jul 2019 14:19:19 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907071419.x67EJJT0034473@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 7 Jul 2019 14:19:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349804 - stable/12/contrib/elftoolchain/elfcopy X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/contrib/elftoolchain/elfcopy X-SVN-Commit-Revision: 349804 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9C4988857C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.92)[-0.916,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 14:19:20 -0000 Author: markj Date: Sun Jul 7 14:19:19 2019 New Revision: 349804 URL: https://svnweb.freebsd.org/changeset/base/349804 Log: MFC r349730: elfcopy: Clear errors after fetching the shstrtab index. Modified: stable/12/contrib/elftoolchain/elfcopy/sections.c Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/elftoolchain/elfcopy/sections.c ============================================================================== --- stable/12/contrib/elftoolchain/elfcopy/sections.c Sun Jul 7 12:15:24 2019 (r349803) +++ stable/12/contrib/elftoolchain/elfcopy/sections.c Sun Jul 7 14:19:19 2019 (r349804) @@ -1403,7 +1403,7 @@ init_shstrtab(struct elfcopy *ecp) struct section *s; size_t indx, sizehint; - if (elf_getshstrndx(ecp->ein, &indx) != 0) { + if (elf_getshdrstrndx(ecp->ein, &indx) == 0) { shstrtab = elf_getscn(ecp->ein, indx); if (shstrtab == NULL) errx(EXIT_FAILURE, "elf_getscn failed: %s", @@ -1413,6 +1413,8 @@ init_shstrtab(struct elfcopy *ecp) elf_errmsg(-1)); sizehint = shdr.sh_size; } else { + /* Clear the error from elf_getshdrstrndx(3). */ + (void)elf_errno(); sizehint = 0; } From owner-svn-src-all@freebsd.org Sun Jul 7 14:19:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC81D15E577D; Sun, 7 Jul 2019 14:19:47 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8429488697; Sun, 7 Jul 2019 14:19:47 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5CE582083; Sun, 7 Jul 2019 14:19:47 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67EJlFB034538; Sun, 7 Jul 2019 14:19:47 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67EJlRl034537; Sun, 7 Jul 2019 14:19:47 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907071419.x67EJlRl034537@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 7 Jul 2019 14:19:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349805 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 349805 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8429488697 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.92)[-0.916,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 14:19:48 -0000 Author: markj Date: Sun Jul 7 14:19:46 2019 New Revision: 349805 URL: https://svnweb.freebsd.org/changeset/base/349805 Log: MFC r349733: Defer funsetown() calls for a TTY to tty_rel_free(). Modified: stable/12/sys/kern/tty.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/tty.c ============================================================================== --- stable/12/sys/kern/tty.c Sun Jul 7 14:19:19 2019 (r349804) +++ stable/12/sys/kern/tty.c Sun Jul 7 14:19:46 2019 (r349805) @@ -231,9 +231,6 @@ ttydev_leave(struct tty *tp) tp->t_flags |= TF_OPENCLOSE; - /* Stop asynchronous I/O. */ - funsetown(&tp->t_sigio); - /* Remove console TTY. */ if (constty == tp) constty_clear(); @@ -1123,6 +1120,9 @@ tty_rel_free(struct tty *tp) tty_unlock(tp); return; } + + /* Stop asynchronous I/O. */ + funsetown(&tp->t_sigio); /* TTY can be deallocated. */ dev = tp->t_dev; From owner-svn-src-all@freebsd.org Sun Jul 7 14:20:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D69315E57E1; Sun, 7 Jul 2019 14:20:15 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 45584887D1; Sun, 7 Jul 2019 14:20:15 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1D2D42087; Sun, 7 Jul 2019 14:20:15 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67EKEdY034635; Sun, 7 Jul 2019 14:20:14 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67EKEu4034634; Sun, 7 Jul 2019 14:20:14 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907071420.x67EKEu4034634@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 7 Jul 2019 14:20:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349806 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 349806 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 45584887D1 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.92)[-0.916,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 14:20:15 -0000 Author: markj Date: Sun Jul 7 14:20:14 2019 New Revision: 349806 URL: https://svnweb.freebsd.org/changeset/base/349806 Log: MFC r349733: Defer funsetown() calls for a TTY to tty_rel_free(). Modified: stable/11/sys/kern/tty.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/tty.c ============================================================================== --- stable/11/sys/kern/tty.c Sun Jul 7 14:19:46 2019 (r349805) +++ stable/11/sys/kern/tty.c Sun Jul 7 14:20:14 2019 (r349806) @@ -230,9 +230,6 @@ ttydev_leave(struct tty *tp) tp->t_flags |= TF_OPENCLOSE; - /* Stop asynchronous I/O. */ - funsetown(&tp->t_sigio); - /* Remove console TTY. */ if (constty == tp) constty_clear(); @@ -1122,6 +1119,9 @@ tty_rel_free(struct tty *tp) tty_unlock(tp); return; } + + /* Stop asynchronous I/O. */ + funsetown(&tp->t_sigio); /* TTY can be deallocated. */ dev = tp->t_dev; From owner-svn-src-all@freebsd.org Sun Jul 7 13:04:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EDD4D15E481D; Sun, 7 Jul 2019 13:04:48 +0000 (UTC) (envelope-from mike@karels.net) Received: from mail.karels.net (mail.karels.net [216.160.39.52]) by mx1.freebsd.org (Postfix) with ESMTP id 64869860DE; Sun, 7 Jul 2019 13:04:42 +0000 (UTC) (envelope-from mike@karels.net) Received: from mail.karels.net (localhost [127.0.0.1]) by mail.karels.net (8.15.2/8.15.2) with ESMTP id x67D4fm6060233; Sun, 7 Jul 2019 08:04:41 -0500 (CDT) (envelope-from mike@karels.net) Message-Id: <201907071304.x67D4fm6060233@mail.karels.net> From: Mike Karels Date: Sun, 07 Jul 2019 08:04:41 -0500 Subject: btoc()/ctob() (was Re: svn commit: r349791 - head/sys/vm) X-Rspamd-Queue-Id: 64869860DE X-Spamd-Bar: +++++ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [5.97 / 15.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(1.00)[0.996,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[karels.net]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(1.00)[0.995,0]; IP_SCORE(-0.01)[asn: 209(-0.02), country: US(-0.06)]; MX_GOOD(-0.01)[mail.karels.net]; NEURAL_SPAM_LONG(1.00)[1.000,0]; MISSING_TO(2.00)[]; R_SPF_NA(0.00)[]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:209, ipnet:216.160.0.0/15, country:US]; RCVD_COUNT_TWO(0.00)[2] X-Mailman-Approved-At: Sun, 07 Jul 2019 14:24:39 +0000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 13:04:49 -0000 ------- Blind-Carbon-Copy To: arch@freebsd.org cc: brde@optusnet.com.au, alc@feeebsd.org From: Mike Karels Reply-to: mike@karels.net Subject: btoc()/ctob() (was Re: svn commit: r349791 - head/sys/vm) In-reply-to: Your message of Sun, 07 Jul 2019 03:48:54 +1000. <20190707023441.B2047@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <60189.1562504486.1@mail.karels.net> Content-Transfer-Encoding: quoted-printable Date: Sun, 07 Jul 2019 08:04:41 -0500 [I moved my reply/new question to arch@, and bcc'd src-committers@ et al, where the interaction started. Excuse the top post, but the previous message is included just for reference; it need not be included in any replies. Followups to arch@, please.] [Sorry if this topic has been covered before; just let me know. Neither my freebsd.org or Google searches located anything, although I didn't try all that hard.] I am astounded to hear that the btoc() macro still lives on, along with ctob() (bytes to clicks, and clicks to bytes). They don't seem to have suitable MI replacements (at least not in ). For those who don't know/remember: these macros were used to convert physical addresses to values for the segment base registers (PARs) on the PDP-11, where there was no actual "page size" analogous to newer hardware. (A click, the 'c' in btoc/ctob, was 64 bytes, the unit of scaling to keep physical addresses in the hardware registers fitting in 16 bits.) Since then, the macros hav= e been subverted to operate in pages, starting with the VAX in 32/V, rather than coming up with a new, more appropriate name. I am wondering whether it is finally time to deprecate PDP-11-based nomenclature. Clicks have not been a "thing" for many years; but pages are nearly universal (modulo superpages, etc). I see that many architectures have architecture-dependent xxx_btop() and xxx_ptob() macros, which are similar but annoyingly different in details like casts. Unlike btoc(), the xxx_btop() versions do not round. I wonde= r, though, whether it is time to hoist *_btop/*_ptob into a new architecture- independent replacement for btoc/ctob. btop() and ptob() come to mind, although I don't know what Linux (etc) does along these lines. I see just over 100 uses of btoc()/ctob() overall, but of course we would need to keep deprecated versions for a while. Thoughts on changing the KPI here? We'd have to agree on details like rounding and casting, but my first reaction would be no to both. Mike > Date: Sun, 7 Jul 2019 03:48:54 +1000 (EST) > From: Bruce Evans > X-X-Sender: bde@besplex.bde.org > To: Doug Moore > cc: src-committers@freebsd.org, svn-src-all@freebsd.org, > svn-src-head@freebsd.org > Subject: Re: svn commit: r349791 - head/sys/vm > In-Reply-To: <201907061555.x66FtGsg025314@repo.freebsd.org> > Message-ID: <20190707023441.B2047@besplex.bde.org> > References: <201907061555.x66FtGsg025314@repo.freebsd.org> > MIME-Version: 1.0 > Content-Type: TEXT/PLAIN; charset=3DUS-ASCII; format=3Dflowed > X-Optus-CM-Score: 0 > X-Optus-CM-Analysis: v=3D2.2 cv=3DP6RKvmIu c=3D1 sm=3D1 tr=3D0 cx=3Da_id= p_d > a=3DPalzARQSbocsUSjMRkwAPg=3D=3D:117 a=3DPalzARQSbocsUSjMRkwAPg=3D=3D:1= 7 > a=3DjpOVt7BSZ2e4Z31A5e1TngXxSK0=3D:19 a=3Dkj9zAlcOel0A:10 > a=3Dk1N1_3MYVckZGDfFxwYA:9 a=3DCjuIK1q_8ugA:10 > Precedence: bulk > X-Loop: FreeBSD.org > Sender: owner-src-committers@freebsd.org > List-Id: FreeBSD mail > X-Rspamd-Queue-Id: 158A46ECA9 > X-Spamd-Bar: ------ > Authentication-Results: mx1.freebsd.org > X-Spamd-Result: default: False [-6.98 / 15.00]; > NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; > NEURAL_HAM_SHORT(-0.98)[-0.982,0]; > REPLY(-4.00)[]; > NEURAL_HAM_LONG(-1.00)[-1.000,0] > X-UID: 364675 > Status: RO > X-Keywords: $NotJunk NonJunk = > Content-Length: 5846 > On Sat, 6 Jul 2019, Doug Moore wrote: > > Log: > > Fix style(9) violations involving division by PAGE_SIZE. > It is style violation to even use an explicit division by PAGE_SIZE > instead of the btoc() conversion macro (*). > > Modified: head/sys/vm/swap_pager.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > > --- head/sys/vm/swap_pager.c Sat Jul 6 15:34:23 2019 (r349790) > > +++ head/sys/vm/swap_pager.c Sat Jul 6 15:55:16 2019 (r349791) > > @@ -523,7 +523,7 @@ swap_pager_swap_init(void) > > * but it isn't very efficient). > > * > > * The nsw_cluster_max is constrained by the bp->b_pages[] > > - * array (MAXPHYS/PAGE_SIZE) and our locally defined > > + * array MAXPHYS / PAGE_SIZE and our locally defined > > * MAX_PAGEOUT_CLUSTER. Also be aware that swap ops are > > * constrained by the swap device interleave stripe size. > > * > The macro is less readable in comments. > > @@ -538,7 +538,7 @@ swap_pager_swap_init(void) > > * have one NFS swap device due to the command/ack latency over NFS. > > * So it all works out pretty well. > > */ > > - nsw_cluster_max =3D min((MAXPHYS/PAGE_SIZE), MAX_PAGEOUT_CLUSTER); > > + nsw_cluster_max =3D min(MAXPHYS / PAGE_SIZE, MAX_PAGEOUT_CLUSTER); > > > > nsw_wcount_async =3D 4; > > nsw_wcount_async_max =3D nsw_wcount_async; > > > > Modified: head/sys/vm/vnode_pager.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > > --- head/sys/vm/vnode_pager.c Sat Jul 6 15:34:23 2019 (r349790) > > +++ head/sys/vm/vnode_pager.c Sat Jul 6 15:55:16 2019 (r349791) > > @@ -544,8 +544,8 @@ vnode_pager_addr(struct vnode *vp, vm_ooffset_t ad= dres > > *rtaddress +=3D voffset / DEV_BSIZE; > > ... > Using explicit division by DEV_BSIZE instead of the btodb() conversion > macro is another style bug. > (*) The macros use shifts while the divisions use division. The hard-co= ded > versions could use shifts too, so there is another set of style bugs fro= m > only using shifts sometimes. Shifts are faster if the type of the divid= end > is signed. > Oops. The macro also rounds up. So hard-coding the division is not jus= t > a style bug. It is wrong unless the dividend is a multiple of the page > size. This shouldn't be assumed for values like MAXBSIZE. > There are many more style bugs involving btoc(): > - 'c' in it means 'click', which might mean a virtual page size while > PAGE_SIZE might mean the physical page size. Or vice versa. dyson > retired from BSD not long after I asked him to clean this up 20+ > years ago. > - btoc() is the only clearly MI macro for this. The better-named macros > amd64_ptob() and i386_ptob() are of course MD. amd64_ptob() is never > used in sys/amd64. i386_ptob() is used 8 times in sys/i386 (all in > pmap.c), and 1 of these uses is in a macro which is used 22 times. > These uses give another set of style bugs. They are just obfuscation= s > if clicks are the same as pages, and probably incomplete otherwise. > However, it is correct for MD code to use physical pages unless it is > implementing virtual pages. > These macros don't round up, so they are not equivalent to btoc() eve= n > if the click size is PAGE_SIZE. > - there is also the better-named macro atop(). This doesn't round up. > I think it is supposed to be MI. It is replicated > for all arches. 'a' in it means 'address', which is less general tha= n > 'b' for 'byte, so it is a worse name than btop(). > - the macro with the best name btop() doesn't exist. > In the opposite direction, there are ctob(), {amd64,i386}_ptob(), > ptoa(), and direct multiplications by PAGE_SIZE and direct shifts by > PAGE_SHIFT. {amd64,i386}_ptob() is not used even on i386. This directi= on > is trickier since the (npages << PAGE_SHIFT) overflows if npages has the > correct type (int). The caller should convert npages to something like > vm_offset_t before using the macro and the need for this is less obvious > than for a direct expression. This is of course undocumented except by > the source code which shows: > - ctob(), ptoa() and i386_ptob() need conversion in the caller, but > amd64_ptob() converts to unsigned long in the macro. Since the last > macro is unused, the caller should convert in all used cases. Covers= ion > is most important on 64-bit arches. On i386, overflow occurs at 2G > starting with int npages but u_int npages works up to 4G which is > enough for i386 addresses but not for amd64 addresses or i386-PAE > byte counts. > I once sprinkled conversions in the macros. btodb() still uses my old > code for this, where the code is sophisticated so as to avoid using > the long long abomination, but which became mostly nonsense when daddr_t > was expanded from 32 bits to 64. Since this macro shifts right, > conversion is not really necessary, and conversion to daddr_t gives > much the same pessimations as conversion to the abomination. dbtodb() > simply converts to daddr_t. I forget if I wrote that. btoc() converts > to vm_offset_t, but since it shifts right conversion is not really > necessary. > Conversions in macros are a wrong way to do this. jake taught me this > in connection with sparc64 i386-PAE work. Conversion in the caller > allows the caller to control the type of the result and to not pessimize > by expanding the type. I think jake intentionally left out conversions > in the sparc64 macros but didn't change the x86 macros much. Other arch= es > use a random mixture. E.g., ptoa() converts to unsigned long on amd64, > arm64, riscv and sparc64 (so jake didn't change this?), to unsigned > on arm, and doesn't convert on i386, mips or powerpc. Always converting > to vm_offset_t would be reasonable, but gives namespace problems. It > is stupid that the MI uses vm_offset_t for btoc() where > conversion is not really needed, while is more careful > about namespace problems so it avoids using even u_long for ptoa(). > Bruce ------- End of Blind-Carbon-Copy From owner-svn-src-all@freebsd.org Sun Jul 7 17:15:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6AA8C15E8E40; Sun, 7 Jul 2019 17:15:46 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 11F288EF60; Sun, 7 Jul 2019 17:15:46 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D56994266; Sun, 7 Jul 2019 17:15:45 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67HFjHl027277; Sun, 7 Jul 2019 17:15:45 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67HFjCK027276; Sun, 7 Jul 2019 17:15:45 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201907071715.x67HFjCK027276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 7 Jul 2019 17:15:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349807 - head/usr.sbin/periodic/etc/daily X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/usr.sbin/periodic/etc/daily X-SVN-Commit-Revision: 349807 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 11F288EF60 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.936,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 17:15:46 -0000 Author: ian Date: Sun Jul 7 17:15:45 2019 New Revision: 349807 URL: https://svnweb.freebsd.org/changeset/base/349807 Log: Eliminate spurious periodic.daily error message for rotating accounting log. In 2011, r218961 removed local code for rotating logs in favor of using the rotate_log command in etc/rc.d/accounting. If the accounting service is activated then subsequently de-activated in rc.conf but still remains active in periodic.conf, then you get an error message every day in the periodic jobs about being unable to rotate the logs. With this change to use "onerotate_log", the log rotation will happen the first time periodic daily runs after accounting was disabled but periodic accounting was left enabled. After that happens once, the /var/account/acct will no longer exist, which results in a different path through the periodic code and no more error messages will appear (unless daily_show_badconfig is set, in which case the admin will be told that periodic security processing is enabled but the accounting file is not present). This is only a partial fix for the problems reported in PR 202203. PR: 202203 Modified: head/usr.sbin/periodic/etc/daily/310.accounting Modified: head/usr.sbin/periodic/etc/daily/310.accounting ============================================================================== --- head/usr.sbin/periodic/etc/daily/310.accounting Sun Jul 7 14:20:14 2019 (r349806) +++ head/usr.sbin/periodic/etc/daily/310.accounting Sun Jul 7 17:15:45 2019 (r349807) @@ -47,7 +47,7 @@ case "$daily_accounting_enable" in n=$(($n - 1)) done - /etc/rc.d/accounting rotate_log || rc=3 + /etc/rc.d/accounting onerotate_log || rc=3 rm -f acct.merge && cp acct.0 acct.merge || rc=3 sa -s $daily_accounting_flags /var/account/acct.merge || rc=3 From owner-svn-src-all@freebsd.org Sun Jul 7 17:30:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58C4015E9251; Sun, 7 Jul 2019 17:30:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EC2218F8DB; Sun, 7 Jul 2019 17:30:23 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A966E4458; Sun, 7 Jul 2019 17:30:23 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67HUN36032992; Sun, 7 Jul 2019 17:30:23 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67HUN80032991; Sun, 7 Jul 2019 17:30:23 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907071730.x67HUN80032991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 7 Jul 2019 17:30:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349808 - stable/12/sys/amd64/vmm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/amd64/vmm X-SVN-Commit-Revision: 349808 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EC2218F8DB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.93)[-0.931,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 17:30:24 -0000 Author: markj Date: Sun Jul 7 17:30:23 2019 New Revision: 349808 URL: https://svnweb.freebsd.org/changeset/base/349808 Log: MFC r349441 (by rgrimes): Emulate the "TEST r/m{16,32,64}, imm{16,32,32}" instructions (opcode F7H). PR: 238794 Modified: stable/12/sys/amd64/vmm/vmm_instruction_emul.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/vmm/vmm_instruction_emul.c ============================================================================== --- stable/12/sys/amd64/vmm/vmm_instruction_emul.c Sun Jul 7 17:15:45 2019 (r349807) +++ stable/12/sys/amd64/vmm/vmm_instruction_emul.c Sun Jul 7 17:30:23 2019 (r349808) @@ -78,6 +78,7 @@ enum { VIE_OP_TYPE_BITTEST, VIE_OP_TYPE_TWOB_GRP15, VIE_OP_TYPE_ADD, + VIE_OP_TYPE_TEST, VIE_OP_TYPE_LAST }; @@ -221,6 +222,12 @@ static const struct vie_op one_byte_opcodes[256] = { .op_byte = 0x8F, .op_type = VIE_OP_TYPE_POP, }, + [0xF7] = { + /* XXX Group 3 extended opcode - not just TEST */ + .op_byte = 0xF7, + .op_type = VIE_OP_TYPE_TEST, + .op_flags = VIE_OP_F_IMM, + }, [0xFF] = { /* XXX Group 5 extended opcode - not just PUSH */ .op_byte = 0xFF, @@ -450,6 +457,41 @@ getaddflags(int opsize, uint64_t x, uint64_t y) return (getaddflags64(x, y)); } +/* + * Return the status flags that would result from doing (x & y). + */ +#define GETANDFLAGS(sz) \ +static u_long \ +getandflags##sz(uint##sz##_t x, uint##sz##_t y) \ +{ \ + u_long rflags; \ + \ + __asm __volatile("and %2,%1; pushfq; popq %0" : \ + "=r" (rflags), "+r" (x) : "m" (y)); \ + return (rflags); \ +} struct __hack + +GETANDFLAGS(8); +GETANDFLAGS(16); +GETANDFLAGS(32); +GETANDFLAGS(64); + +static u_long +getandflags(int opsize, uint64_t x, uint64_t y) +{ + KASSERT(opsize == 1 || opsize == 2 || opsize == 4 || opsize == 8, + ("getandflags: invalid operand size %d", opsize)); + + if (opsize == 1) + return (getandflags8(x, y)); + else if (opsize == 2) + return (getandflags16(x, y)); + else if (opsize == 4) + return (getandflags32(x, y)); + else + return (getandflags64(x, y)); +} + static int emulate_mov(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, mem_region_read_t memread, mem_region_write_t memwrite, void *arg) @@ -1219,6 +1261,55 @@ emulate_cmp(void *vm, int vcpuid, uint64_t gpa, struct } static int +emulate_test(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, + mem_region_read_t memread, mem_region_write_t memwrite, void *arg) +{ + int error, size; + uint64_t op1, rflags, rflags2; + + size = vie->opsize; + error = EINVAL; + + switch (vie->op.op_byte) { + case 0xF7: + /* + * F7 /0 test r/m16, imm16 + * F7 /0 test r/m32, imm32 + * REX.W + F7 /0 test r/m64, imm32 sign-extended to 64 + * + * Test mem (ModRM:r/m) with immediate and set status + * flags according to the results. The comparison is + * performed by anding the immediate from the first + * operand and then setting the status flags. + */ + if ((vie->reg & 7) != 0) + return (EINVAL); + + error = memread(vm, vcpuid, gpa, &op1, size, arg); + if (error) + return (error); + + rflags2 = getandflags(size, op1, vie->immediate); + break; + default: + return (EINVAL); + } + error = vie_read_register(vm, vcpuid, VM_REG_GUEST_RFLAGS, &rflags); + if (error) + return (error); + + /* + * OF and CF are cleared; the SF, ZF and PF flags are set according + * to the result; AF is undefined. + */ + rflags &= ~RFLAGS_STATUS_BITS; + rflags |= rflags2 & (PSL_PF | PSL_Z | PSL_N); + + error = vie_update_register(vm, vcpuid, VM_REG_GUEST_RFLAGS, rflags, 8); + return (error); +} + +static int emulate_add(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, mem_region_read_t memread, mem_region_write_t memwrite, void *arg) { @@ -1642,6 +1733,10 @@ vmm_emulate_instruction(void *vm, int vcpuid, uint64_t case VIE_OP_TYPE_ADD: error = emulate_add(vm, vcpuid, gpa, vie, memread, memwrite, memarg); + break; + case VIE_OP_TYPE_TEST: + error = emulate_test(vm, vcpuid, gpa, vie, + memread, memwrite, memarg); break; default: error = EINVAL; From owner-svn-src-all@freebsd.org Sun Jul 7 17:31:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63B2315E92C7; Sun, 7 Jul 2019 17:31:14 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0B63F8FAC4; Sun, 7 Jul 2019 17:31:14 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9CF5045AB; Sun, 7 Jul 2019 17:31:13 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67HVDtG033803; Sun, 7 Jul 2019 17:31:13 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67HVDZs033802; Sun, 7 Jul 2019 17:31:13 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907071731.x67HVDZs033802@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 7 Jul 2019 17:31:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349809 - stable/11/sys/amd64/vmm X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/amd64/vmm X-SVN-Commit-Revision: 349809 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0B63F8FAC4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 17:31:14 -0000 Author: markj Date: Sun Jul 7 17:31:13 2019 New Revision: 349809 URL: https://svnweb.freebsd.org/changeset/base/349809 Log: MFC r349441 (by rgrimes): Emulate the "TEST r/m{16,32,64}, imm{16,32,32}" instructions (opcode F7H). PR: 238794 Modified: stable/11/sys/amd64/vmm/vmm_instruction_emul.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/vmm/vmm_instruction_emul.c ============================================================================== --- stable/11/sys/amd64/vmm/vmm_instruction_emul.c Sun Jul 7 17:30:23 2019 (r349808) +++ stable/11/sys/amd64/vmm/vmm_instruction_emul.c Sun Jul 7 17:31:13 2019 (r349809) @@ -76,6 +76,7 @@ enum { VIE_OP_TYPE_BITTEST, VIE_OP_TYPE_TWOB_GRP15, VIE_OP_TYPE_ADD, + VIE_OP_TYPE_TEST, VIE_OP_TYPE_LAST }; @@ -219,6 +220,12 @@ static const struct vie_op one_byte_opcodes[256] = { .op_byte = 0x8F, .op_type = VIE_OP_TYPE_POP, }, + [0xF7] = { + /* XXX Group 3 extended opcode - not just TEST */ + .op_byte = 0xF7, + .op_type = VIE_OP_TYPE_TEST, + .op_flags = VIE_OP_F_IMM, + }, [0xFF] = { /* XXX Group 5 extended opcode - not just PUSH */ .op_byte = 0xFF, @@ -448,6 +455,41 @@ getaddflags(int opsize, uint64_t x, uint64_t y) return (getaddflags64(x, y)); } +/* + * Return the status flags that would result from doing (x & y). + */ +#define GETANDFLAGS(sz) \ +static u_long \ +getandflags##sz(uint##sz##_t x, uint##sz##_t y) \ +{ \ + u_long rflags; \ + \ + __asm __volatile("and %2,%1; pushfq; popq %0" : \ + "=r" (rflags), "+r" (x) : "m" (y)); \ + return (rflags); \ +} struct __hack + +GETANDFLAGS(8); +GETANDFLAGS(16); +GETANDFLAGS(32); +GETANDFLAGS(64); + +static u_long +getandflags(int opsize, uint64_t x, uint64_t y) +{ + KASSERT(opsize == 1 || opsize == 2 || opsize == 4 || opsize == 8, + ("getandflags: invalid operand size %d", opsize)); + + if (opsize == 1) + return (getandflags8(x, y)); + else if (opsize == 2) + return (getandflags16(x, y)); + else if (opsize == 4) + return (getandflags32(x, y)); + else + return (getandflags64(x, y)); +} + static int emulate_mov(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, mem_region_read_t memread, mem_region_write_t memwrite, void *arg) @@ -1217,6 +1259,55 @@ emulate_cmp(void *vm, int vcpuid, uint64_t gpa, struct } static int +emulate_test(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, + mem_region_read_t memread, mem_region_write_t memwrite, void *arg) +{ + int error, size; + uint64_t op1, rflags, rflags2; + + size = vie->opsize; + error = EINVAL; + + switch (vie->op.op_byte) { + case 0xF7: + /* + * F7 /0 test r/m16, imm16 + * F7 /0 test r/m32, imm32 + * REX.W + F7 /0 test r/m64, imm32 sign-extended to 64 + * + * Test mem (ModRM:r/m) with immediate and set status + * flags according to the results. The comparison is + * performed by anding the immediate from the first + * operand and then setting the status flags. + */ + if ((vie->reg & 7) != 0) + return (EINVAL); + + error = memread(vm, vcpuid, gpa, &op1, size, arg); + if (error) + return (error); + + rflags2 = getandflags(size, op1, vie->immediate); + break; + default: + return (EINVAL); + } + error = vie_read_register(vm, vcpuid, VM_REG_GUEST_RFLAGS, &rflags); + if (error) + return (error); + + /* + * OF and CF are cleared; the SF, ZF and PF flags are set according + * to the result; AF is undefined. + */ + rflags &= ~RFLAGS_STATUS_BITS; + rflags |= rflags2 & (PSL_PF | PSL_Z | PSL_N); + + error = vie_update_register(vm, vcpuid, VM_REG_GUEST_RFLAGS, rflags, 8); + return (error); +} + +static int emulate_add(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, mem_region_read_t memread, mem_region_write_t memwrite, void *arg) { @@ -1640,6 +1731,10 @@ vmm_emulate_instruction(void *vm, int vcpuid, uint64_t case VIE_OP_TYPE_ADD: error = emulate_add(vm, vcpuid, gpa, vie, memread, memwrite, memarg); + break; + case VIE_OP_TYPE_TEST: + error = emulate_test(vm, vcpuid, gpa, vie, + memread, memwrite, memarg); break; default: error = EINVAL; From owner-svn-src-all@freebsd.org Sun Jul 7 17:43:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2059F15E98B1; Sun, 7 Jul 2019 17:43:16 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B70A8685DC; Sun, 7 Jul 2019 17:43:15 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C67047B5; Sun, 7 Jul 2019 17:43:15 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67HhFFH043223; Sun, 7 Jul 2019 17:43:15 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67HhFMA043222; Sun, 7 Jul 2019 17:43:15 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907071743.x67HhFMA043222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 7 Jul 2019 17:43:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349810 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 349810 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B70A8685DC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 17:43:16 -0000 Author: markj Date: Sun Jul 7 17:43:15 2019 New Revision: 349810 URL: https://svnweb.freebsd.org/changeset/base/349810 Log: MFC r349599: Fix handling of errors from sblock() in soreceive_stream(). PR: 238789 Modified: stable/12/sys/kern/uipc_socket.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/uipc_socket.c ============================================================================== --- stable/12/sys/kern/uipc_socket.c Sun Jul 7 17:31:13 2019 (r349809) +++ stable/12/sys/kern/uipc_socket.c Sun Jul 7 17:43:15 2019 (r349810) @@ -2196,7 +2196,7 @@ soreceive_stream(struct socket *so, struct sockaddr ** /* Prevent other readers from entering the socket. */ error = sblock(sb, SBLOCKWAIT(flags)); if (error) - goto out; + return (error); SOCKBUF_LOCK(sb); /* Easy one, no space to copyout anything. */ From owner-svn-src-all@freebsd.org Sun Jul 7 17:43:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5463915E98F8; Sun, 7 Jul 2019 17:43:46 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AEEBD69A7A; Sun, 7 Jul 2019 17:43:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8AD0B47B7; Sun, 7 Jul 2019 17:43:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67HhjxM043303; Sun, 7 Jul 2019 17:43:45 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67HhjR0043302; Sun, 7 Jul 2019 17:43:45 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907071743.x67HhjR0043302@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 7 Jul 2019 17:43:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349811 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 349811 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AEEBD69A7A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 17:43:46 -0000 Author: markj Date: Sun Jul 7 17:43:45 2019 New Revision: 349811 URL: https://svnweb.freebsd.org/changeset/base/349811 Log: MFC r349599: Fix handling of errors from sblock() in soreceive_stream(). PR: 238789 Modified: stable/11/sys/kern/uipc_socket.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/uipc_socket.c ============================================================================== --- stable/11/sys/kern/uipc_socket.c Sun Jul 7 17:43:15 2019 (r349810) +++ stable/11/sys/kern/uipc_socket.c Sun Jul 7 17:43:45 2019 (r349811) @@ -1969,7 +1969,7 @@ soreceive_stream(struct socket *so, struct sockaddr ** /* Prevent other readers from entering the socket. */ error = sblock(sb, SBLOCKWAIT(flags)); if (error) - goto out; + return (error); SOCKBUF_LOCK(sb); /* Easy one, no space to copyout anything. */ From owner-svn-src-all@freebsd.org Sun Jul 7 17:45:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2DC6F15E9AA4; Sun, 7 Jul 2019 17:45:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C58D869DEC; Sun, 7 Jul 2019 17:45:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9FF9B47BB; Sun, 7 Jul 2019 17:45:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67HjH8l043453; Sun, 7 Jul 2019 17:45:17 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67HjHoI043452; Sun, 7 Jul 2019 17:45:17 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907071745.x67HjHoI043452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 7 Jul 2019 17:45:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349812 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 349812 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C58D869DEC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 17:45:18 -0000 Author: markj Date: Sun Jul 7 17:45:17 2019 New Revision: 349812 URL: https://svnweb.freebsd.org/changeset/base/349812 Log: MFC r349671: Cache the next queue element when traversing a page queue. Modified: stable/12/sys/vm/vm_pageout.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_pageout.c ============================================================================== --- stable/12/sys/vm/vm_pageout.c Sun Jul 7 17:43:45 2019 (r349811) +++ stable/12/sys/vm/vm_pageout.c Sun Jul 7 17:45:17 2019 (r349812) @@ -265,7 +265,7 @@ static __always_inline void vm_pageout_collect_batch(struct scan_state *ss, const bool dequeue) { struct vm_pagequeue *pq; - vm_page_t m, marker; + vm_page_t m, marker, n; marker = ss->marker; pq = ss->pq; @@ -276,7 +276,8 @@ vm_pageout_collect_batch(struct scan_state *ss, const vm_pagequeue_lock(pq); for (m = TAILQ_NEXT(marker, plinks.q); m != NULL && ss->scanned < ss->maxscan && ss->bq.bq_cnt < VM_BATCHQUEUE_SIZE; - m = TAILQ_NEXT(m, plinks.q), ss->scanned++) { + m = n, ss->scanned++) { + n = TAILQ_NEXT(m, plinks.q); if ((m->flags & PG_MARKER) == 0) { KASSERT((m->aflags & PGA_ENQUEUED) != 0, ("page %p not enqueued", m)); From owner-svn-src-all@freebsd.org Sun Jul 7 18:29:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 473CA15EA8B3; Sun, 7 Jul 2019 18:29:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E27E66BC90; Sun, 7 Jul 2019 18:29:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD6654EC6; Sun, 7 Jul 2019 18:29:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67ITALM064401; Sun, 7 Jul 2019 18:29:10 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67ITAJs064400; Sun, 7 Jul 2019 18:29:10 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201907071829.x67ITAJs064400@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 7 Jul 2019 18:29:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349813 - stable/12/sys/cam/scsi X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam/scsi X-SVN-Commit-Revision: 349813 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E27E66BC90 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 18:29:11 -0000 Author: mav Date: Sun Jul 7 18:29:10 2019 New Revision: 349813 URL: https://svnweb.freebsd.org/changeset/base/349813 Log: MFC r349281: Fix individual_element_index when some type has 0 elements. When some type has 0 elements, saved_individual_element_index was set to -1 on second type bump, since individual_element_index was not restored after the first. To me it looks easier just to increment saved_individual_element_index separately than think when to save it. Modified: stable/12/sys/cam/scsi/scsi_enc_ses.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_enc_ses.c Sun Jul 7 17:45:17 2019 (r349812) +++ stable/12/sys/cam/scsi/scsi_enc_ses.c Sun Jul 7 18:29:10 2019 (r349813) @@ -444,6 +444,7 @@ ses_iter_next(struct ses_iterator *iter) iter->type_element_index = ITERATOR_INDEX_END; iter->global_element_index = ITERATOR_INDEX_END; iter->individual_element_index = ITERATOR_INDEX_END; + iter->saved_individual_element_index = ITERATOR_INDEX_END; return (NULL); } @@ -468,17 +469,12 @@ ses_iter_next(struct ses_iterator *iter) */ iter->type_index++; iter->type_element_index = 0; - iter->saved_individual_element_index - = iter->individual_element_index; iter->individual_element_index = ITERATOR_INDEX_INVALID; } if (iter->type_element_index > 0) { - if (iter->type_element_index == 1) { - iter->individual_element_index - = iter->saved_individual_element_index; - } - iter->individual_element_index++; + iter->individual_element_index = + ++iter->saved_individual_element_index; } return (&iter->cache->elm_map[iter->global_element_index]); From owner-svn-src-all@freebsd.org Sun Jul 7 18:29:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7324E15EA917; Sun, 7 Jul 2019 18:29:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3B4716BDDC; Sun, 7 Jul 2019 18:29:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E7114EC7; Sun, 7 Jul 2019 18:29:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67ITbsY064472; Sun, 7 Jul 2019 18:29:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67ITbCb064471; Sun, 7 Jul 2019 18:29:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201907071829.x67ITbCb064471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 7 Jul 2019 18:29:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349814 - stable/11/sys/cam/scsi X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cam/scsi X-SVN-Commit-Revision: 349814 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3B4716BDDC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 18:29:38 -0000 Author: mav Date: Sun Jul 7 18:29:37 2019 New Revision: 349814 URL: https://svnweb.freebsd.org/changeset/base/349814 Log: MFC r349281: Fix individual_element_index when some type has 0 elements. When some type has 0 elements, saved_individual_element_index was set to -1 on second type bump, since individual_element_index was not restored after the first. To me it looks easier just to increment saved_individual_element_index separately than think when to save it. Modified: stable/11/sys/cam/scsi/scsi_enc_ses.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_enc_ses.c Sun Jul 7 18:29:10 2019 (r349813) +++ stable/11/sys/cam/scsi/scsi_enc_ses.c Sun Jul 7 18:29:37 2019 (r349814) @@ -442,6 +442,7 @@ ses_iter_next(struct ses_iterator *iter) iter->type_element_index = ITERATOR_INDEX_END; iter->global_element_index = ITERATOR_INDEX_END; iter->individual_element_index = ITERATOR_INDEX_END; + iter->saved_individual_element_index = ITERATOR_INDEX_END; return (NULL); } @@ -466,17 +467,12 @@ ses_iter_next(struct ses_iterator *iter) */ iter->type_index++; iter->type_element_index = 0; - iter->saved_individual_element_index - = iter->individual_element_index; iter->individual_element_index = ITERATOR_INDEX_INVALID; } if (iter->type_element_index > 0) { - if (iter->type_element_index == 1) { - iter->individual_element_index - = iter->saved_individual_element_index; - } - iter->individual_element_index++; + iter->individual_element_index = + ++iter->saved_individual_element_index; } return (&iter->cache->elm_map[iter->global_element_index]); From owner-svn-src-all@freebsd.org Sun Jul 7 18:31:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C29D15EABC0; Sun, 7 Jul 2019 18:31:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 252F26C272; Sun, 7 Jul 2019 18:31:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F3BB34F2A; Sun, 7 Jul 2019 18:31:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67IVrUr068378; Sun, 7 Jul 2019 18:31:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67IVrVj068377; Sun, 7 Jul 2019 18:31:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201907071831.x67IVrVj068377@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 7 Jul 2019 18:31:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349815 - stable/12/sys/cam/scsi X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam/scsi X-SVN-Commit-Revision: 349815 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 252F26C272 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 18:31:54 -0000 Author: mav Date: Sun Jul 7 18:31:53 2019 New Revision: 349815 URL: https://svnweb.freebsd.org/changeset/base/349815 Log: MFC r349284: Make ELEMENT INDEX validation more strict. SES specifications tell: "The Additional Element Status descriptors shall be in the same order as the status elements in the Enclosure Status diagnostic page". It allows us to question ELEMENT INDEX that is lower then values we already processed. There are many SAS2 enclosures with this kind of problem. While there, add more specific error messages for cases when ELEMENT INDEX is obviously wrong. Also skip elements with INVALID bit set. Modified: stable/12/sys/cam/scsi/scsi_enc_ses.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_enc_ses.c Sun Jul 7 18:29:37 2019 (r349814) +++ stable/12/sys/cam/scsi/scsi_enc_ses.c Sun Jul 7 18:31:53 2019 (r349815) @@ -1681,7 +1681,6 @@ ses_process_elm_addlstatus(enc_softc_t *enc, struct en struct ses_iterator iter, titer; int eip; int err; - int ignore_index = 0; int length; int offset; enc_cache_t *enc_cache; @@ -1752,7 +1751,7 @@ ses_process_elm_addlstatus(enc_softc_t *enc, struct en elm_hdr = (struct ses_elm_addlstatus_base_hdr *)&buf[offset]; eip = ses_elm_addlstatus_eip(elm_hdr); - if (eip && !ignore_index) { + if (eip) { struct ses_elm_addlstatus_eip_hdr *eip_hdr; int expected_index, index; ses_elem_index_type_t index_type; @@ -1765,17 +1764,44 @@ ses_process_elm_addlstatus(enc_softc_t *enc, struct en index_type = SES_ELEM_INDEX_INDIVIDUAL; expected_index = iter.individual_element_index; } + if (eip_hdr->element_index < expected_index) { + ENC_VLOG(enc, "%s: provided %selement index " + "%d is lower then expected %d\n", + __func__, (eip_hdr->byte2 & + SES_ADDL_EIP_EIIOE) ? "global " : "", + eip_hdr->element_index, expected_index); + goto badindex; + } titer = iter; telement = ses_iter_seek_to(&titer, eip_hdr->element_index, index_type); - if (telement != NULL && - (ses_typehasaddlstatus(enc, titer.type_index) != - TYPE_ADDLSTATUS_NONE || - titer.type_index > ELMTYP_SAS_CONN)) { + if (telement == NULL) { + ENC_VLOG(enc, "%s: provided %selement index " + "%d does not exist\n", __func__, + (eip_hdr->byte2 & SES_ADDL_EIP_EIIOE) ? + "global " : "", eip_hdr->element_index); + goto badindex; + } + if (ses_typehasaddlstatus(enc, titer.type_index) == + TYPE_ADDLSTATUS_NONE) { + ENC_VLOG(enc, "%s: provided %selement index " + "%d can't have additional status\n", + __func__, + (eip_hdr->byte2 & SES_ADDL_EIP_EIIOE) ? + "global " : "", eip_hdr->element_index); +badindex: + /* + * If we expected mandatory element, we may + * guess it was just a wrong index and we may + * use the status. If element was optional, + * then we have no idea where status belongs. + */ + if (status_type == TYPE_ADDLSTATUS_OPTIONAL) + break; + } else { iter = titer; element = telement; - } else - ignore_index = 1; + } if (eip_hdr->byte2 & SES_ADDL_EIP_EIIOE) index = iter.global_element_index; @@ -1797,35 +1823,41 @@ ses_process_elm_addlstatus(enc_softc_t *enc, struct en "type element index=%d, offset=0x%x, " "byte0=0x%x, length=0x%x\n", __func__, iter.global_element_index, iter.type_index, - iter.type_element_index, offset, elmpriv->addl.hdr->byte0, - elmpriv->addl.hdr->length); + iter.type_element_index, offset, elm_hdr->byte0, + elm_hdr->length); /* Skip to after the length field */ offset += sizeof(struct ses_elm_addlstatus_base_hdr); /* Make sure the descriptor is within bounds */ - if ((offset + elmpriv->addl.hdr->length) > length) { + if ((offset + elm_hdr->length) > length) { ENC_VLOG(enc, "Element %d Beyond End " "of Additional Element Status Descriptors\n", iter.global_element_index); break; } + /* Skip elements marked as invalid. */ + if (ses_elm_addlstatus_invalid(elm_hdr)) { + offset += elm_hdr->length; + continue; + } + /* Advance to the protocol data, skipping eip bytes if needed */ offset += (eip * SES_EIP_HDR_EXTRA_LEN); - proto_info_len = elmpriv->addl.hdr->length + proto_info_len = elm_hdr->length - (eip * SES_EIP_HDR_EXTRA_LEN); /* Errors in this block are ignored as they are non-fatal */ - switch(ses_elm_addlstatus_proto(elmpriv->addl.hdr)) { + switch(ses_elm_addlstatus_proto(elm_hdr)) { case SPSP_PROTO_FC: - if (elmpriv->addl.hdr->length == 0) + if (elm_hdr->length == 0) break; ses_get_elm_addlstatus_fc(enc, enc_cache, &buf[offset], proto_info_len); break; case SPSP_PROTO_SAS: - if (elmpriv->addl.hdr->length <= 2) + if (elm_hdr->length <= 2) break; ses_get_elm_addlstatus_sas(enc, enc_cache, &buf[offset], @@ -1836,7 +1868,7 @@ ses_process_elm_addlstatus(enc_softc_t *enc, struct en default: ENC_VLOG(enc, "Element %d: Unknown Additional Element " "Protocol 0x%x\n", iter.global_element_index, - ses_elm_addlstatus_proto(elmpriv->addl.hdr)); + ses_elm_addlstatus_proto(elm_hdr)); break; } From owner-svn-src-all@freebsd.org Sun Jul 7 18:32:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0C4015EAC6F; Sun, 7 Jul 2019 18:32:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 836886C43B; Sun, 7 Jul 2019 18:32:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D7A1506C; Sun, 7 Jul 2019 18:32:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67IWZ3r069401; Sun, 7 Jul 2019 18:32:35 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67IWZ5g069399; Sun, 7 Jul 2019 18:32:35 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201907071832.x67IWZ5g069399@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 7 Jul 2019 18:32:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349816 - stable/12/sys/cam/scsi X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam/scsi X-SVN-Commit-Revision: 349816 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 836886C43B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 18:32:36 -0000 Author: mav Date: Sun Jul 7 18:32:34 2019 New Revision: 349816 URL: https://svnweb.freebsd.org/changeset/base/349816 Log: MFC r349287: Remove ancient SCSI-2/3 mentioning. Modified: stable/12/sys/cam/scsi/scsi_enc.c stable/12/sys/cam/scsi/scsi_enc_internal.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/scsi/scsi_enc.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_enc.c Sun Jul 7 18:31:53 2019 (r349815) +++ stable/12/sys/cam/scsi/scsi_enc.c Sun Jul 7 18:32:34 2019 (r349816) @@ -684,14 +684,8 @@ enc_type(struct ccb_getdev *cgd) buflen = min(sizeof(cgd->inq_data), SID_ADDITIONAL_LENGTH(&cgd->inq_data)); - if ((iqd[0] & 0x1f) == T_ENCLOSURE) { - if ((iqd[2] & 0x7) > 2) { - return (ENC_SES); - } else { - return (ENC_SES_SCSI2); - } - return (ENC_NONE); - } + if ((iqd[0] & 0x1f) == T_ENCLOSURE) + return (ENC_SES); #ifdef SES_ENABLE_PASSTHROUGH if ((iqd[6] & 0x40) && (iqd[2] & 0x7) >= 2) { @@ -928,7 +922,6 @@ enc_ctor(struct cam_periph *periph, void *arg) switch (enc->enc_type) { case ENC_SES: - case ENC_SES_SCSI2: case ENC_SES_PASSTHROUGH: case ENC_SEMB_SES: err = ses_softc_init(enc); @@ -1017,17 +1010,14 @@ enc_ctor(struct cam_periph *periph, void *arg) case ENC_NONE: tname = "No ENC device"; break; - case ENC_SES_SCSI2: - tname = "SCSI-2 ENC Device"; - break; case ENC_SES: - tname = "SCSI-3 ENC Device"; + tname = "SES Device"; break; case ENC_SES_PASSTHROUGH: - tname = "ENC Passthrough Device"; + tname = "SES Passthrough Device"; break; case ENC_SAFT: - tname = "SAF-TE Compliant Device"; + tname = "SAF-TE Device"; break; case ENC_SEMB_SES: tname = "SEMB SES Device"; Modified: stable/12/sys/cam/scsi/scsi_enc_internal.h ============================================================================== --- stable/12/sys/cam/scsi/scsi_enc_internal.h Sun Jul 7 18:31:53 2019 (r349815) +++ stable/12/sys/cam/scsi/scsi_enc_internal.h Sun Jul 7 18:32:34 2019 (r349816) @@ -55,10 +55,8 @@ typedef struct enc_element { typedef enum { ENC_NONE, - ENC_SES_SCSI2, ENC_SES, ENC_SES_PASSTHROUGH, - ENC_SEN, ENC_SAFT, ENC_SEMB_SES, ENC_SEMB_SAFT From owner-svn-src-all@freebsd.org Sun Jul 7 18:33:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D234E15EAD29; Sun, 7 Jul 2019 18:33:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6B60A6C5FD; Sun, 7 Jul 2019 18:33:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 183A0506D; Sun, 7 Jul 2019 18:33:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67IXL8s069511; Sun, 7 Jul 2019 18:33:21 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67IXLTW069508; Sun, 7 Jul 2019 18:33:21 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201907071833.x67IXLTW069508@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 7 Jul 2019 18:33:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349817 - stable/12/sys/cam/scsi X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam/scsi X-SVN-Commit-Revision: 349817 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6B60A6C5FD X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 18:33:23 -0000 Author: mav Date: Sun Jul 7 18:33:21 2019 New Revision: 349817 URL: https://svnweb.freebsd.org/changeset/base/349817 Log: MFC r349292: Decouple enc/ses verbosity from bootverbose. I don't want to be regularly notified that my enclosure violates standards until there is some real problem I want to debug. Modified: stable/12/sys/cam/scsi/scsi_enc.c stable/12/sys/cam/scsi/scsi_enc_internal.h stable/12/sys/cam/scsi/scsi_enc_safte.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/scsi/scsi_enc.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_enc.c Sun Jul 7 18:32:34 2019 (r349816) +++ stable/12/sys/cam/scsi/scsi_enc.c Sun Jul 7 18:33:21 2019 (r349817) @@ -81,6 +81,14 @@ static enctyp enc_type(struct ccb_getdev *); SYSCTL_NODE(_kern_cam, OID_AUTO, enc, CTLFLAG_RD, 0, "CAM Enclosure Services driver"); +#if defined(DEBUG) || defined(ENC_DEBUG) +int enc_verbose = 1; +#else +int enc_verbose = 0; +#endif +SYSCTL_INT(_kern_cam_enc, OID_AUTO, verbose, CTLFLAG_RWTUN, + &enc_verbose, 0, "Enable verbose logging"); + static struct periph_driver encdriver = { enc_init, "ses", TAILQ_HEAD_INITIALIZER(encdriver.units), /* generation */ 0 Modified: stable/12/sys/cam/scsi/scsi_enc_internal.h ============================================================================== --- stable/12/sys/cam/scsi/scsi_enc_internal.h Sun Jul 7 18:32:34 2019 (r349816) +++ stable/12/sys/cam/scsi/scsi_enc_internal.h Sun Jul 7 18:33:21 2019 (r349817) @@ -36,6 +36,8 @@ #ifndef __SCSI_ENC_INTERNAL_H__ #define __SCSI_ENC_INTERNAL_H__ +#include + typedef struct enc_element { uint32_t enctype : 8, /* enclosure type */ @@ -204,6 +206,9 @@ enc_softc_init_t ses_softc_init; /* SAF-TE interface */ enc_softc_init_t safte_softc_init; +SYSCTL_DECL(_kern_cam_enc); +extern int enc_verbose; + /* Helper macros */ MALLOC_DECLARE(M_SCSIENC); #define ENC_CFLAGS CAM_RETRY_SELTO @@ -216,7 +221,7 @@ MALLOC_DECLARE(M_SCSIENC); #else #define ENC_DLOG if (0) enc_log #endif -#define ENC_VLOG if (bootverbose) enc_log +#define ENC_VLOG if (enc_verbose) enc_log #define ENC_MALLOC(amt) malloc(amt, M_SCSIENC, M_NOWAIT) #define ENC_MALLOCZ(amt) malloc(amt, M_SCSIENC, M_ZERO|M_NOWAIT) /* Cast away const avoiding GCC warnings. */ Modified: stable/12/sys/cam/scsi/scsi_enc_safte.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_enc_safte.c Sun Jul 7 18:32:34 2019 (r349816) +++ stable/12/sys/cam/scsi/scsi_enc_safte.c Sun Jul 7 18:33:21 2019 (r349817) @@ -227,7 +227,6 @@ static char *safte_2little = "Too Little Data Returned } int emulate_array_devices = 1; -SYSCTL_DECL(_kern_cam_enc); SYSCTL_INT(_kern_cam_enc, OID_AUTO, emulate_array_devices, CTLFLAG_RWTUN, &emulate_array_devices, 0, "Emulate Array Devices for SAF-TE"); From owner-svn-src-all@freebsd.org Sun Jul 7 18:37:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B6AB15EAEAB; Sun, 7 Jul 2019 18:37:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DECA86C926; Sun, 7 Jul 2019 18:37:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B4D895070; Sun, 7 Jul 2019 18:37:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67IbkYW069749; Sun, 7 Jul 2019 18:37:46 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67IbkAr069748; Sun, 7 Jul 2019 18:37:46 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201907071837.x67IbkAr069748@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 7 Jul 2019 18:37:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349818 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 349818 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DECA86C926 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 18:37:47 -0000 Author: mav Date: Sun Jul 7 18:37:46 2019 New Revision: 349818 URL: https://svnweb.freebsd.org/changeset/base/349818 Log: MFC r349006: Move write aggregation memory copy out of vq_lock. Memory copy is too heavy operation to do under the congested lock. Moving it out reduces congestion by many times to almost invisible. Since the original zio removed from the queue, and the child zio is not executed yet, I don't see why would the copy need protection. My guess it just remained like this from the time when lock was not dropped here, which was added later to fix lock ordering issue. Multi-threaded sequential write tests with both HDD and SSD pools with ZVOL block sizes of 4KB, 16KB, 64KB and 128KB all show major reduction of lock congestion, saving from 15% to 35% of CPU time and increasing throughput from 10% to 40%. Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Sun Jul 7 18:33:21 2019 (r349817) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Sun Jul 7 18:37:46 2019 (r349818) @@ -815,6 +815,18 @@ vdev_queue_aggregate(vdev_queue_t *vq, zio_t *zio) do { dio = nio; nio = AVL_NEXT(t, dio); + zio_add_child(dio, aio); + vdev_queue_io_remove(vq, dio); + } while (dio != last); + + /* + * We need to drop the vdev queue's lock during zio_execute() to + * avoid a deadlock that we could encounter due to lock order + * reversal between vq_lock and io_lock in zio_change_priority(). + * Use the dropped lock to do memory copy without congestion. + */ + mutex_exit(&vq->vq_lock); + while ((dio = zio_walk_parents(aio, &zl)) != NULL) { ASSERT3U(dio->io_type, ==, aio->io_type); if (dio->io_flags & ZIO_FLAG_NODATA) { @@ -826,16 +838,6 @@ vdev_queue_aggregate(vdev_queue_t *vq, zio_t *zio) dio->io_offset - aio->io_offset, 0, dio->io_size); } - zio_add_child(dio, aio); - vdev_queue_io_remove(vq, dio); - } while (dio != last); - - /* - * We need to drop the vdev queue's lock to avoid a deadlock that we - * could encounter since this I/O will complete immediately. - */ - mutex_exit(&vq->vq_lock); - while ((dio = zio_walk_parents(aio, &zl)) != NULL) { zio_vdev_io_bypass(dio); zio_execute(dio); } From owner-svn-src-all@freebsd.org Sun Jul 7 18:38:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB3B415EAF60; Sun, 7 Jul 2019 18:38:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6DBFF6CB0B; Sun, 7 Jul 2019 18:38:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46E2F508B; Sun, 7 Jul 2019 18:38:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67IcfUJ069841; Sun, 7 Jul 2019 18:38:41 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67IcfOw069840; Sun, 7 Jul 2019 18:38:41 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201907071838.x67IcfOw069840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 7 Jul 2019 18:38:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349819 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 349819 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6DBFF6CB0B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 18:38:42 -0000 Author: mav Date: Sun Jul 7 18:38:40 2019 New Revision: 349819 URL: https://svnweb.freebsd.org/changeset/base/349819 Log: MFC r349029: Update td_runtime of running thread on each statclock(). Normally td_runtime is updated on context switch, but there are some kernel threads that due to high absolute priority may run for many seconds without context switches (yes, that is bad, but that is true), which means their td_runtime was not updated all that time, that made them invisible for top other then as some general CPU usage. Modified: stable/12/sys/kern/kern_clock.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_clock.c ============================================================================== --- stable/12/sys/kern/kern_clock.c Sun Jul 7 18:37:46 2019 (r349818) +++ stable/12/sys/kern/kern_clock.c Sun Jul 7 18:38:40 2019 (r349819) @@ -631,6 +631,7 @@ statclock(int cnt, int usermode) struct proc *p; long rss; long *cp_time; + uint64_t runtime, new_switchtime; td = curthread; p = td->td_proc; @@ -686,6 +687,17 @@ statclock(int cnt, int usermode) "prio:%d", td->td_priority, "stathz:%d", (stathz)?stathz:hz); SDT_PROBE2(sched, , , tick, td, td->td_proc); thread_lock_flags(td, MTX_QUIET); + + /* + * Compute the amount of time during which the current + * thread was running, and add that to its total so far. + */ + new_switchtime = cpu_ticks(); + runtime = new_switchtime - PCPU_GET(switchtime); + td->td_runtime += runtime; + td->td_incruntime += runtime; + PCPU_SET(switchtime, new_switchtime); + for ( ; cnt > 0; cnt--) sched_clock(td); thread_unlock(td); From owner-svn-src-all@freebsd.org Sun Jul 7 18:39:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A79E115EB013; Sun, 7 Jul 2019 18:39:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B9B16CCD7; Sun, 7 Jul 2019 18:39:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2753750A6; Sun, 7 Jul 2019 18:39:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67IdXAn069933; Sun, 7 Jul 2019 18:39:33 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67IdXUP069932; Sun, 7 Jul 2019 18:39:33 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201907071839.x67IdXUP069932@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 7 Jul 2019 18:39:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349820 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Commit-Revision: 349820 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4B9B16CCD7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 18:39:33 -0000 Author: mav Date: Sun Jul 7 18:39:32 2019 New Revision: 349820 URL: https://svnweb.freebsd.org/changeset/base/349820 Log: MFC r349035: Properly align struct multilist_sublist to cache line. Manual Illumos alignment does not fit us due to different kmutex_t size. Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h Sun Jul 7 18:38:40 2019 (r349819) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/multilist.h Sun Jul 7 18:39:32 2019 (r349820) @@ -44,11 +44,10 @@ struct multilist_sublist { */ list_t mls_list; /* - * Pad to cache line (64 bytes), in an effort to try and prevent - * cache line contention. + * Pad to cache line, in an effort to try and prevent cache line + * contention. */ - uint8_t mls_pad[24]; -}; +} __aligned(CACHE_LINE_SIZE); struct multilist { /* From owner-svn-src-all@freebsd.org Sun Jul 7 18:40:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E48FD15EB0C5; Sun, 7 Jul 2019 18:40:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 894BD6CE8A; Sun, 7 Jul 2019 18:40:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 63A0150AE; Sun, 7 Jul 2019 18:40:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67Iea3b070054; Sun, 7 Jul 2019 18:40:36 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67Ieamh070053; Sun, 7 Jul 2019 18:40:36 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201907071840.x67Ieamh070053@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 7 Jul 2019 18:40:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349821 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 349821 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 894BD6CE8A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.946,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 18:40:37 -0000 Author: mav Date: Sun Jul 7 18:40:35 2019 New Revision: 349821 URL: https://svnweb.freebsd.org/changeset/base/349821 Log: MFC r349039: Alike to ZoL disable metaslab allocation tracing code. It is too generous to collect in production debug traces that can only be read with kernel debugger. Illumos includes special code in their mdb debugger to read it, we don't. Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Sun Jul 7 18:39:32 2019 (r349820) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Sun Jul 7 18:40:35 2019 (r349821) @@ -259,7 +259,9 @@ int zfs_metaslab_switch_threshold = 2; * Internal switch to enable/disable the metaslab allocation tracing * facility. */ +#ifdef _METASLAB_TRACING boolean_t metaslab_trace_enabled = B_TRUE; +#endif /* * Maximum entries that the metaslab allocation tracing facility will keep @@ -269,7 +271,9 @@ boolean_t metaslab_trace_enabled = B_TRUE; * to every exceed this value. In debug mode, the system will panic if this * limit is ever reached allowing for further investigation. */ +#ifdef _METASLAB_TRACING uint64_t metaslab_trace_max_entries = 5000; +#endif static uint64_t metaslab_weight(metaslab_t *); static void metaslab_set_fragmentation(metaslab_t *); @@ -277,8 +281,9 @@ static void metaslab_free_impl(vdev_t *, uint64_t, uin static void metaslab_check_free_impl(vdev_t *, uint64_t, uint64_t); static void metaslab_passivate(metaslab_t *msp, uint64_t weight); static uint64_t metaslab_weight_from_range_tree(metaslab_t *msp); - +#ifdef _METASLAB_TRACING kmem_cache_t *metaslab_alloc_trace_cache; +#endif /* * ========================================================================== @@ -2797,6 +2802,7 @@ metaslab_distance(metaslab_t *msp, dva_t *dva) * Metaslab allocation tracing facility * ========================================================================== */ +#ifdef _METASLAB_TRACING kstat_t *metaslab_trace_ksp; kstat_named_t metaslab_trace_over_limit; @@ -2900,6 +2906,32 @@ metaslab_trace_fini(zio_alloc_list_t *zal) list_destroy(&zal->zal_list); zal->zal_size = 0; } + +#else + +#define metaslab_trace_add(zal, mg, msp, psize, id, off, alloc) + +void +metaslab_alloc_trace_init(void) +{ +} + +void +metaslab_alloc_trace_fini(void) +{ +} + +void +metaslab_trace_init(zio_alloc_list_t *zal) +{ +} + +void +metaslab_trace_fini(zio_alloc_list_t *zal) +{ +} + +#endif /* _METASLAB_TRACING */ /* * ========================================================================== From owner-svn-src-all@freebsd.org Sun Jul 7 18:42:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C423515EB2E2; Sun, 7 Jul 2019 18:42:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6A3A46D2E9; Sun, 7 Jul 2019 18:42:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44F655272; Sun, 7 Jul 2019 18:42:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67IgQxl074954; Sun, 7 Jul 2019 18:42:26 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67IgQiU074953; Sun, 7 Jul 2019 18:42:26 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201907071842.x67IgQiU074953@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 7 Jul 2019 18:42:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349822 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 349822 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6A3A46D2E9 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 18:42:27 -0000 Author: mav Date: Sun Jul 7 18:42:25 2019 New Revision: 349822 URL: https://svnweb.freebsd.org/changeset/base/349822 Log: MFC r349040: Minimize aggsum_compare(&arc_size, arc_c) calls. For busy ARC situation when arc_size close to arc_c is desired. But then it is quite likely that aggsum_compare(&arc_size, arc_c) will need to flush per-CPU buckets to find exact comparison result. Doing that often in a hot path penalizes whole idea of aggsum usage there, since it replaces few simple atomic additions with dozens of lock acquisitions. Replacing aggsum_compare() with aggsum_upper_bound() in code increasing arc_p when ARC is growing (arc_size < arc_c) according to PMC profiles allows to save ~5% of CPU time in aggsum code during sequential write to 12 ZVOLs with 16KB block size on large dual-socket system. I suppose there some minor arc_p behavior change due to lower precision of the new code, but I don't think it is a big deal, since it should affect only very small window in time (aggsum buckets are flushed every second) and in ARC size (buckets are limited to 10 average ARC blocks per CPU). Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun Jul 7 18:40:35 2019 (r349821) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun Jul 7 18:42:25 2019 (r349822) @@ -5269,7 +5269,7 @@ arc_get_data_impl(arc_buf_hdr_t *hdr, uint64_t size, v * If we are growing the cache, and we are adding anonymous * data, and we have outgrown arc_p, update arc_p */ - if (aggsum_compare(&arc_size, arc_c) < 0 && + if (aggsum_upper_bound(&arc_size) < arc_c && hdr->b_l1hdr.b_state == arc_anon && (refcount_count(&arc_anon->arcs_size) + refcount_count(&arc_mru->arcs_size) > arc_p)) From owner-svn-src-all@freebsd.org Sun Jul 7 18:44:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62B2D15EB390; Sun, 7 Jul 2019 18:44:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 064506D4A8; Sun, 7 Jul 2019 18:44:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC553527E; Sun, 7 Jul 2019 18:44:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67IiqSw075122; Sun, 7 Jul 2019 18:44:52 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67IipTD075118; Sun, 7 Jul 2019 18:44:51 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201907071844.x67IipTD075118@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 7 Jul 2019 18:44:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349823 - in stable/12/sys: geom kern sys X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys: geom kern sys X-SVN-Commit-Revision: 349823 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 064506D4A8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.946,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 18:44:53 -0000 Author: mav Date: Sun Jul 7 18:44:51 2019 New Revision: 349823 URL: https://svnweb.freebsd.org/changeset/base/349823 Log: MFC r349178: Optimize kern.geom.conf* sysctls. On large systems those sysctls may generate megabytes of output. Before this change sbuf(9) code was resizing buffer by 4KB each time many times, generating tons of TLB shootdowns. Unfortunately in this case existing sbuf_new_for_sysctl() mechanism, supposed to help with this issue, is not applicable, since all the sbuf writes are done in different kernel thread. This change improves situation in two ways: - on first sysctl call, not providing any output buffer, it sets special sbuf drain function, just counting the data and so not needing big buffer; - on second sysctl call it uses as initial buffer size value saved on previous call, so that in most cases there will be no reallocation, unless GEOM topology changed significantly. Modified: stable/12/sys/geom/geom_kern.c stable/12/sys/kern/imgact_elf.c stable/12/sys/kern/subr_sbuf.c stable/12/sys/sys/sbuf.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/geom/geom_kern.c ============================================================================== --- stable/12/sys/geom/geom_kern.c Sun Jul 7 18:42:25 2019 (r349822) +++ stable/12/sys/geom/geom_kern.c Sun Jul 7 18:44:51 2019 (r349823) @@ -157,42 +157,51 @@ g_init(void) } static int -sysctl_kern_geom_conftxt(SYSCTL_HANDLER_ARGS) +sysctl_kern_geom_confany(struct sysctl_req *req, g_event_t *func, size_t *hint) { - int error; + size_t len = 0; + int error = 0; struct sbuf *sb; - sb = sbuf_new_auto(); - g_waitfor_event(g_conftxt, sb, M_WAITOK, NULL); - error = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1); + if (req->oldptr == NULL) { + sb = sbuf_new(NULL, NULL, PAGE_SIZE, SBUF_FIXEDLEN | + SBUF_INCLUDENUL); + sbuf_set_drain(sb, sbuf_count_drain, &len); + g_waitfor_event(func, sb, M_WAITOK, NULL); + req->oldidx = *hint = len; + } else { + sb = sbuf_new(NULL, NULL, *hint, SBUF_AUTOEXTEND | + SBUF_INCLUDENUL); + g_waitfor_event(func, sb, M_WAITOK, NULL); + *hint = sbuf_len(sb); + error = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb)); + } sbuf_delete(sb); return error; } + +static int +sysctl_kern_geom_conftxt(SYSCTL_HANDLER_ARGS) +{ + static size_t hint = PAGE_SIZE; + + return (sysctl_kern_geom_confany(req, g_conftxt, &hint)); +} static int sysctl_kern_geom_confdot(SYSCTL_HANDLER_ARGS) { - int error; - struct sbuf *sb; + static size_t hint = PAGE_SIZE; - sb = sbuf_new_auto(); - g_waitfor_event(g_confdot, sb, M_WAITOK, NULL); - error = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1); - sbuf_delete(sb); - return error; + return (sysctl_kern_geom_confany(req, g_confdot, &hint)); } - + static int sysctl_kern_geom_confxml(SYSCTL_HANDLER_ARGS) { - int error; - struct sbuf *sb; + static size_t hint = PAGE_SIZE; - sb = sbuf_new_auto(); - g_waitfor_event(g_confxml, sb, M_WAITOK, NULL); - error = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1); - sbuf_delete(sb); - return error; + return (sysctl_kern_geom_confany(req, g_confxml, &hint)); } SYSCTL_NODE(_kern, OID_AUTO, geom, CTLFLAG_RW, 0, "GEOMetry management"); Modified: stable/12/sys/kern/imgact_elf.c ============================================================================== --- stable/12/sys/kern/imgact_elf.c Sun Jul 7 18:42:25 2019 (r349822) +++ stable/12/sys/kern/imgact_elf.c Sun Jul 7 18:44:51 2019 (r349823) @@ -1423,7 +1423,6 @@ static void __elfN(puthdr)(struct thread *, void *, si static void __elfN(putnote)(struct note_info *, struct sbuf *); static size_t register_note(struct note_info_list *, int, outfunc_t, void *); static int sbuf_drain_core_output(void *, const char *, int); -static int sbuf_drain_count(void *arg, const char *data, int len); static void __elfN(note_fpregset)(void *, struct sbuf *, size_t *); static void __elfN(note_prpsinfo)(void *, struct sbuf *, size_t *); @@ -1553,19 +1552,6 @@ sbuf_drain_core_output(void *arg, const char *data, in return (len); } -/* - * Drain into a counter. - */ -static int -sbuf_drain_count(void *arg, const char *data __unused, int len) -{ - size_t *sizep; - - sizep = (size_t *)arg; - *sizep += len; - return (len); -} - int __elfN(coredump)(struct thread *td, struct vnode *vp, off_t limit, int flags) { @@ -2342,7 +2328,7 @@ note_procstat_files(void *arg, struct sbuf *sb, size_t if (sb == NULL) { size = 0; sb = sbuf_new(NULL, NULL, 128, SBUF_FIXEDLEN); - sbuf_set_drain(sb, sbuf_drain_count, &size); + sbuf_set_drain(sb, sbuf_count_drain, &size); sbuf_bcat(sb, &structsize, sizeof(structsize)); PROC_LOCK(p); kern_proc_filedesc_out(p, sb, -1, filedesc_flags); @@ -2393,7 +2379,7 @@ note_procstat_vmmap(void *arg, struct sbuf *sb, size_t if (sb == NULL) { size = 0; sb = sbuf_new(NULL, NULL, 128, SBUF_FIXEDLEN); - sbuf_set_drain(sb, sbuf_drain_count, &size); + sbuf_set_drain(sb, sbuf_count_drain, &size); sbuf_bcat(sb, &structsize, sizeof(structsize)); PROC_LOCK(p); kern_proc_vmmap_out(p, sb, -1, vmmap_flags); @@ -2521,7 +2507,7 @@ __elfN(note_procstat_auxv)(void *arg, struct sbuf *sb, if (sb == NULL) { size = 0; sb = sbuf_new(NULL, NULL, 128, SBUF_FIXEDLEN); - sbuf_set_drain(sb, sbuf_drain_count, &size); + sbuf_set_drain(sb, sbuf_count_drain, &size); sbuf_bcat(sb, &structsize, sizeof(structsize)); PHOLD(p); proc_getauxv(curthread, p, sb); Modified: stable/12/sys/kern/subr_sbuf.c ============================================================================== --- stable/12/sys/kern/subr_sbuf.c Sun Jul 7 18:42:25 2019 (r349822) +++ stable/12/sys/kern/subr_sbuf.c Sun Jul 7 18:44:51 2019 (r349823) @@ -342,6 +342,21 @@ sbuf_setpos(struct sbuf *s, ssize_t pos) } /* + * Drain into a counter. Counts amount of data without prodicing output. + * Useful for cases like sysctl, where user may first request only size. + * This allows to avoid pointless allocation/freeing of large buffers. + */ +int +sbuf_count_drain(void *arg, const char *data __unused, int len) +{ + size_t *sizep; + + sizep = (size_t *)arg; + *sizep += len; + return (len); +} + +/* * Set up a drain function and argument on an sbuf to flush data to * when the sbuf buffer overflows. */ Modified: stable/12/sys/sys/sbuf.h ============================================================================== --- stable/12/sys/sys/sbuf.h Sun Jul 7 18:42:25 2019 (r349822) +++ stable/12/sys/sys/sbuf.h Sun Jul 7 18:44:51 2019 (r349823) @@ -103,6 +103,7 @@ void sbuf_start_section(struct sbuf *, ssize_t *); ssize_t sbuf_end_section(struct sbuf *, ssize_t, size_t, int); void sbuf_hexdump(struct sbuf *, const void *, int, const char *, int); +int sbuf_count_drain(void *arg, const char *data, int len); void sbuf_putbuf(struct sbuf *); #ifdef _KERNEL From owner-svn-src-all@freebsd.org Sun Jul 7 18:45:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B8DC15EB3FB; Sun, 7 Jul 2019 18:45:58 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A6A476D600; Sun, 7 Jul 2019 18:45:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75304527F; Sun, 7 Jul 2019 18:45:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67Ijv4f075226; Sun, 7 Jul 2019 18:45:57 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67Ijv9V075225; Sun, 7 Jul 2019 18:45:57 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201907071845.x67Ijv9V075225@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 7 Jul 2019 18:45:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349824 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 349824 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A6A476D600 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 18:45:58 -0000 Author: mav Date: Sun Jul 7 18:45:57 2019 New Revision: 349824 URL: https://svnweb.freebsd.org/changeset/base/349824 Log: MFC r349190: Fix typo in r349178. Modified: stable/12/sys/kern/subr_sbuf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/subr_sbuf.c ============================================================================== --- stable/12/sys/kern/subr_sbuf.c Sun Jul 7 18:44:51 2019 (r349823) +++ stable/12/sys/kern/subr_sbuf.c Sun Jul 7 18:45:57 2019 (r349824) @@ -342,7 +342,7 @@ sbuf_setpos(struct sbuf *s, ssize_t pos) } /* - * Drain into a counter. Counts amount of data without prodicing output. + * Drain into a counter. Counts amount of data without producing output. * Useful for cases like sysctl, where user may first request only size. * This allows to avoid pointless allocation/freeing of large buffers. */ From owner-svn-src-all@freebsd.org Sun Jul 7 18:47:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D11015EB473; Sun, 7 Jul 2019 18:47:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EF14E6D760; Sun, 7 Jul 2019 18:47:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C80105280; Sun, 7 Jul 2019 18:47:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67Il4lC075344; Sun, 7 Jul 2019 18:47:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67Il1I5075329; Sun, 7 Jul 2019 18:47:01 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201907071847.x67Il1I5075329@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 7 Jul 2019 18:47:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349825 - in stable/12/sys: geom geom/concat geom/eli geom/journal geom/mirror geom/multipath geom/part geom/raid geom/raid3 geom/stripe kern X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys: geom geom/concat geom/eli geom/journal geom/mirror geom/multipath geom/part geom/raid geom/raid3 geom/stripe kern X-SVN-Commit-Revision: 349825 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EF14E6D760 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 18:47:05 -0000 Author: mav Date: Sun Jul 7 18:47:01 2019 New Revision: 349825 URL: https://svnweb.freebsd.org/changeset/base/349825 Log: MFC r349195: Use sbuf_cat() in GEOM confxml generation. When it comes to megabytes of text, difference between sbuf_printf() and sbuf_cat() becomes substantial. Modified: stable/12/sys/geom/concat/g_concat.c stable/12/sys/geom/eli/g_eli.c stable/12/sys/geom/geom_disk.c stable/12/sys/geom/geom_dump.c stable/12/sys/geom/geom_int.h stable/12/sys/geom/journal/g_journal.c stable/12/sys/geom/mirror/g_mirror.c stable/12/sys/geom/multipath/g_multipath.c stable/12/sys/geom/part/g_part_apm.c stable/12/sys/geom/part/g_part_bsd64.c stable/12/sys/geom/part/g_part_gpt.c stable/12/sys/geom/part/g_part_mbr.c stable/12/sys/geom/raid/g_raid.c stable/12/sys/geom/raid3/g_raid3.c stable/12/sys/geom/stripe/g_stripe.c stable/12/sys/kern/kern_uuid.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/geom/concat/g_concat.c ============================================================================== --- stable/12/sys/geom/concat/g_concat.c Sun Jul 7 18:45:57 2019 (r349824) +++ stable/12/sys/geom/concat/g_concat.c Sun Jul 7 18:47:01 2019 (r349825) @@ -1004,24 +1004,24 @@ g_concat_dumpconf(struct sbuf *sb, const char *indent, sbuf_printf(sb, "%s", indent); switch (sc->sc_type) { case G_CONCAT_TYPE_AUTOMATIC: - sbuf_printf(sb, "AUTOMATIC"); + sbuf_cat(sb, "AUTOMATIC"); break; case G_CONCAT_TYPE_MANUAL: - sbuf_printf(sb, "MANUAL"); + sbuf_cat(sb, "MANUAL"); break; default: - sbuf_printf(sb, "UNKNOWN"); + sbuf_cat(sb, "UNKNOWN"); break; } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%sTotal=%u, Online=%u\n", indent, sc->sc_ndisks, g_concat_nvalid(sc)); sbuf_printf(sb, "%s", indent); if (sc->sc_provider != NULL && sc->sc_provider->error == 0) - sbuf_printf(sb, "UP"); + sbuf_cat(sb, "UP"); else - sbuf_printf(sb, "DOWN"); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "DOWN"); + sbuf_cat(sb, "\n"); } } Modified: stable/12/sys/geom/eli/g_eli.c ============================================================================== --- stable/12/sys/geom/eli/g_eli.c Sun Jul 7 18:45:57 2019 (r349824) +++ stable/12/sys/geom/eli/g_eli.c Sun Jul 7 18:47:01 2019 (r349825) @@ -1243,17 +1243,17 @@ g_eli_dumpconf(struct sbuf *sb, const char *indent, st (uintmax_t)sc->sc_ekeys_allocated); sbuf_printf(sb, "%s", indent); if (sc->sc_flags == 0) - sbuf_printf(sb, "NONE"); + sbuf_cat(sb, "NONE"); else { int first = 1; #define ADD_FLAG(flag, name) do { \ if (sc->sc_flags & (flag)) { \ if (!first) \ - sbuf_printf(sb, ", "); \ + sbuf_cat(sb, ", "); \ else \ first = 0; \ - sbuf_printf(sb, name); \ + sbuf_cat(sb, name); \ } \ } while (0) ADD_FLAG(G_ELI_FLAG_SUSPEND, "SUSPEND"); @@ -1272,7 +1272,7 @@ g_eli_dumpconf(struct sbuf *sb, const char *indent, st ADD_FLAG(G_ELI_FLAG_GELIDISPLAYPASS, "GELIDISPLAYPASS"); #undef ADD_FLAG } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); if (!(sc->sc_flags & G_ELI_FLAG_ONETIME)) { sbuf_printf(sb, "%s%u\n", indent, @@ -1282,16 +1282,16 @@ g_eli_dumpconf(struct sbuf *sb, const char *indent, st sbuf_printf(sb, "%s", indent); switch (sc->sc_crypto) { case G_ELI_CRYPTO_HW: - sbuf_printf(sb, "hardware"); + sbuf_cat(sb, "hardware"); break; case G_ELI_CRYPTO_SW: - sbuf_printf(sb, "software"); + sbuf_cat(sb, "software"); break; default: - sbuf_printf(sb, "UNKNOWN"); + sbuf_cat(sb, "UNKNOWN"); break; } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); if (sc->sc_flags & G_ELI_FLAG_AUTH) { sbuf_printf(sb, "%s%s\n", Modified: stable/12/sys/geom/geom_disk.c ============================================================================== --- stable/12/sys/geom/geom_disk.c Sun Jul 7 18:45:57 2019 (r349824) +++ stable/12/sys/geom/geom_disk.c Sun Jul 7 18:47:01 2019 (r349825) @@ -599,15 +599,15 @@ g_disk_dumpconf(struct sbuf *sb, const char *indent, s */ sbuf_printf(sb, "%s", indent); if (dp->d_rotation_rate == DISK_RR_UNKNOWN) /* Old drives */ - sbuf_printf(sb, "unknown"); /* don't report RPM. */ + sbuf_cat(sb, "unknown"); /* don't report RPM. */ else if (dp->d_rotation_rate == DISK_RR_NON_ROTATING) - sbuf_printf(sb, "0"); + sbuf_cat(sb, "0"); else if ((dp->d_rotation_rate >= DISK_RR_MIN) && (dp->d_rotation_rate <= DISK_RR_MAX)) sbuf_printf(sb, "%u", dp->d_rotation_rate); else - sbuf_printf(sb, "invalid"); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "invalid"); + sbuf_cat(sb, "\n"); if (dp->d_getattr != NULL) { buf = g_malloc(DISK_IDENT_SIZE, M_WAITOK); bp = g_alloc_bio(); @@ -617,35 +617,34 @@ g_disk_dumpconf(struct sbuf *sb, const char *indent, s bp->bio_data = buf; res = dp->d_getattr(bp); sbuf_printf(sb, "%s", indent); - g_conf_printf_escaped(sb, "%s", - res == 0 ? buf: dp->d_ident); - sbuf_printf(sb, "\n"); + g_conf_cat_escaped(sb, res == 0 ? buf : dp->d_ident); + sbuf_cat(sb, "\n"); bp->bio_attribute = "GEOM::lunid"; bp->bio_length = DISK_IDENT_SIZE; bp->bio_data = buf; if (dp->d_getattr(bp) == 0) { sbuf_printf(sb, "%s", indent); - g_conf_printf_escaped(sb, "%s", buf); - sbuf_printf(sb, "\n"); + g_conf_cat_escaped(sb, buf); + sbuf_cat(sb, "\n"); } bp->bio_attribute = "GEOM::lunname"; bp->bio_length = DISK_IDENT_SIZE; bp->bio_data = buf; if (dp->d_getattr(bp) == 0) { sbuf_printf(sb, "%s", indent); - g_conf_printf_escaped(sb, "%s", buf); - sbuf_printf(sb, "\n"); + g_conf_cat_escaped(sb, buf); + sbuf_cat(sb, "\n"); } g_destroy_bio(bp); g_free(buf); } else { sbuf_printf(sb, "%s", indent); - g_conf_printf_escaped(sb, "%s", dp->d_ident); - sbuf_printf(sb, "\n"); + g_conf_cat_escaped(sb, dp->d_ident); + sbuf_cat(sb, "\n"); } sbuf_printf(sb, "%s", indent); - g_conf_printf_escaped(sb, "%s", dp->d_descr); - sbuf_printf(sb, "\n"); + g_conf_cat_escaped(sb, dp->d_descr); + sbuf_cat(sb, "\n"); } } Modified: stable/12/sys/geom/geom_dump.c ============================================================================== --- stable/12/sys/geom/geom_dump.c Sun Jul 7 18:45:57 2019 (r349824) +++ stable/12/sys/geom/geom_dump.c Sun Jul 7 18:47:01 2019 (r349825) @@ -105,10 +105,10 @@ g_confdot(void *p, int flag ) KASSERT(flag != EV_CANCEL, ("g_confdot was cancelled")); sb = p; g_topology_assert(); - sbuf_printf(sb, "digraph geom {\n"); + sbuf_cat(sb, "digraph geom {\n"); LIST_FOREACH(mp, &g_classes, class) g_confdot_class(sb, mp); - sbuf_printf(sb, "}\n"); + sbuf_cat(sb, "}\n"); sbuf_finish(sb); } @@ -125,7 +125,7 @@ g_conftxt_geom(struct sbuf *sb, struct g_geom *gp, int pp->name, (uintmax_t)pp->mediasize, pp->sectorsize); if (gp->dumpconf != NULL) gp->dumpconf(sb, NULL, gp, NULL, pp); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); LIST_FOREACH(cp, &pp->consumers, consumers) g_conftxt_geom(sb, cp->geom, level + 1); } @@ -156,12 +156,26 @@ g_conftxt(void *p, int flag) sbuf_finish(sb); } +void +g_conf_cat_escaped(struct sbuf *sb, const char *buf) +{ + const u_char *c; + for (c = buf; *c != '\0'; c++) { + if (*c == '&' || *c == '<' || *c == '>' || + *c == '\'' || *c == '"' || *c > 0x7e) + sbuf_printf(sb, "&#x%X;", *c); + else if (*c == '\t' || *c == '\n' || *c == '\r' || *c > 0x1f) + sbuf_putc(sb, *c); + else + sbuf_putc(sb, '?'); + } +} + void g_conf_printf_escaped(struct sbuf *sb, const char *fmt, ...) { struct sbuf *s; - const u_char *c; va_list ap; s = sbuf_new_auto(); @@ -170,15 +184,7 @@ g_conf_printf_escaped(struct sbuf *sb, const char *fmt va_end(ap); sbuf_finish(s); - for (c = sbuf_data(s); *c != '\0'; c++) { - if (*c == '&' || *c == '<' || *c == '>' || - *c == '\'' || *c == '"' || *c > 0x7e) - sbuf_printf(sb, "&#x%X;", *c); - else if (*c == '\t' || *c == '\n' || *c == '\r' || *c > 0x1f) - sbuf_putc(sb, *c); - else - sbuf_putc(sb, '?'); - } + g_conf_cat_escaped(sb, sbuf_data(s)); sbuf_delete(s); } @@ -195,11 +201,11 @@ g_conf_consumer(struct sbuf *sb, struct g_consumer *cp if (cp->geom->flags & G_GEOM_WITHER) ; else if (cp->geom->dumpconf != NULL) { - sbuf_printf(sb, "\t \n"); + sbuf_cat(sb, "\t \n"); cp->geom->dumpconf(sb, "\t ", cp->geom, cp, NULL); - sbuf_printf(sb, "\t \n"); + sbuf_cat(sb, "\t \n"); } - sbuf_printf(sb, "\t\n"); + sbuf_cat(sb, "\t\n"); } static void @@ -210,24 +216,24 @@ g_conf_provider(struct sbuf *sb, struct g_provider *pp sbuf_printf(sb, "\t \n", pp->geom); sbuf_printf(sb, "\t r%dw%de%d\n", pp->acr, pp->acw, pp->ace); - sbuf_printf(sb, "\t "); - g_conf_printf_escaped(sb, "%s", pp->name); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\t "); + g_conf_cat_escaped(sb, pp->name); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "\t %jd\n", (intmax_t)pp->mediasize); sbuf_printf(sb, "\t %u\n", pp->sectorsize); sbuf_printf(sb, "\t %u\n", pp->stripesize); sbuf_printf(sb, "\t %u\n", pp->stripeoffset); if (pp->flags & G_PF_WITHER) - sbuf_printf(sb, "\t \n"); + sbuf_cat(sb, "\t \n"); else if (pp->geom->flags & G_GEOM_WITHER) ; else if (pp->geom->dumpconf != NULL) { - sbuf_printf(sb, "\t \n"); + sbuf_cat(sb, "\t \n"); pp->geom->dumpconf(sb, "\t ", pp->geom, NULL, pp); - sbuf_printf(sb, "\t \n"); + sbuf_cat(sb, "\t \n"); } - sbuf_printf(sb, "\t\n"); + sbuf_cat(sb, "\t\n"); } @@ -240,16 +246,16 @@ g_conf_geom(struct sbuf *sb, struct g_geom *gp, struct sbuf_printf(sb, " \n", gp); sbuf_printf(sb, " \n", gp->class); - sbuf_printf(sb, " "); - g_conf_printf_escaped(sb, "%s", gp->name); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, " "); + g_conf_cat_escaped(sb, gp->name); + sbuf_cat(sb, "\n"); sbuf_printf(sb, " %d\n", gp->rank); if (gp->flags & G_GEOM_WITHER) - sbuf_printf(sb, " \n"); + sbuf_cat(sb, " \n"); else if (gp->dumpconf != NULL) { - sbuf_printf(sb, " \n"); + sbuf_cat(sb, " \n"); gp->dumpconf(sb, "\t", gp, NULL, NULL); - sbuf_printf(sb, " \n"); + sbuf_cat(sb, " \n"); } LIST_FOREACH(cp2, &gp->consumer, consumer) { if (cp != NULL && cp != cp2) @@ -263,11 +269,11 @@ g_conf_geom(struct sbuf *sb, struct g_geom *gp, struct g_conf_provider(sb, pp2); } LIST_FOREACH(gap, &gp->aliases, ga_next) { - sbuf_printf(sb, " \n"); - g_conf_printf_escaped(sb, "%s", gap->ga_alias); - sbuf_printf(sb, " \n"); + sbuf_cat(sb, " \n"); + g_conf_cat_escaped(sb, gap->ga_alias); + sbuf_cat(sb, " \n"); } - sbuf_printf(sb, " \n"); + sbuf_cat(sb, " \n"); } static void @@ -276,15 +282,15 @@ g_conf_class(struct sbuf *sb, struct g_class *mp, stru struct g_geom *gp2; sbuf_printf(sb, " \n", mp); - sbuf_printf(sb, " "); - g_conf_printf_escaped(sb, "%s", mp->name); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, " "); + g_conf_cat_escaped(sb, mp->name); + sbuf_cat(sb, "\n"); LIST_FOREACH(gp2, &mp->geom, geom) { if (gp != NULL && gp != gp2) continue; g_conf_geom(sb, gp2, pp, cp); } - sbuf_printf(sb, " \n"); + sbuf_cat(sb, " \n"); } void @@ -293,13 +299,13 @@ g_conf_specific(struct sbuf *sb, struct g_class *mp, s struct g_class *mp2; g_topology_assert(); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); LIST_FOREACH(mp2, &g_classes, class) { if (mp != NULL && mp != mp2) continue; g_conf_class(sb, mp2, gp, pp, cp); } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_finish(sb); } Modified: stable/12/sys/geom/geom_int.h ============================================================================== --- stable/12/sys/geom/geom_int.h Sun Jul 7 18:45:57 2019 (r349824) +++ stable/12/sys/geom/geom_int.h Sun Jul 7 18:47:01 2019 (r349825) @@ -59,6 +59,7 @@ extern int g_debugflags; /* geom_dump.c */ void g_confxml(void *, int flag); void g_conf_specific(struct sbuf *sb, struct g_class *mp, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp); +void g_conf_cat_escaped(struct sbuf *sb, const char *buf); void g_conf_printf_escaped(struct sbuf *sb, const char *fmt, ...); void g_confdot(void *, int flag); void g_conftxt(void *, int flag); Modified: stable/12/sys/geom/journal/g_journal.c ============================================================================== --- stable/12/sys/geom/journal/g_journal.c Sun Jul 7 18:45:57 2019 (r349824) +++ stable/12/sys/geom/journal/g_journal.c Sun Jul 7 18:47:01 2019 (r349825) @@ -2623,15 +2623,15 @@ g_journal_dumpconf(struct sbuf *sb, const char *indent sbuf_printf(sb, "%s", indent); if (cp == sc->sc_dconsumer) { - sbuf_printf(sb, "Data"); + sbuf_cat(sb, "Data"); first = 0; } if (cp == sc->sc_jconsumer) { if (!first) - sbuf_printf(sb, ","); - sbuf_printf(sb, "Journal"); + sbuf_cat(sb, ","); + sbuf_cat(sb, "Journal"); } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); if (cp == sc->sc_jconsumer) { sbuf_printf(sb, "%jd\n", (intmax_t)sc->sc_jstart); Modified: stable/12/sys/geom/mirror/g_mirror.c ============================================================================== --- stable/12/sys/geom/mirror/g_mirror.c Sun Jul 7 18:45:57 2019 (r349824) +++ stable/12/sys/geom/mirror/g_mirror.c Sun Jul 7 18:47:01 2019 (r349825) @@ -3334,12 +3334,12 @@ g_mirror_dumpconf(struct sbuf *sb, const char *indent, if (disk->d_state == G_MIRROR_DISK_STATE_SYNCHRONIZING) { sbuf_printf(sb, "%s", indent); if (disk->d_sync.ds_offset == 0) - sbuf_printf(sb, "0%%"); + sbuf_cat(sb, "0%"); else sbuf_printf(sb, "%u%%", (u_int)((disk->d_sync.ds_offset * 100) / sc->sc_mediasize)); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); if (disk->d_sync.ds_offset > 0) sbuf_printf(sb, "%s%jd" "\n", indent, @@ -3351,17 +3351,17 @@ g_mirror_dumpconf(struct sbuf *sb, const char *indent, disk->d_genid); sbuf_printf(sb, "%s", indent); if (disk->d_flags == 0) - sbuf_printf(sb, "NONE"); + sbuf_cat(sb, "NONE"); else { int first = 1; #define ADD_FLAG(flag, name) do { \ if ((disk->d_flags & (flag)) != 0) { \ if (!first) \ - sbuf_printf(sb, ", "); \ + sbuf_cat(sb, ", "); \ else \ first = 0; \ - sbuf_printf(sb, name); \ + sbuf_cat(sb, name); \ } \ } while (0) ADD_FLAG(G_MIRROR_DISK_FLAG_DIRTY, "DIRTY"); @@ -3373,7 +3373,7 @@ g_mirror_dumpconf(struct sbuf *sb, const char *indent, ADD_FLAG(G_MIRROR_DISK_FLAG_BROKEN, "BROKEN"); #undef ADD_FLAG } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%s%u\n", indent, disk->d_priority); sbuf_printf(sb, "%s%s\n", indent, @@ -3382,39 +3382,39 @@ g_mirror_dumpconf(struct sbuf *sb, const char *indent, sbuf_printf(sb, "%s", indent); switch (sc->sc_type) { case G_MIRROR_TYPE_AUTOMATIC: - sbuf_printf(sb, "AUTOMATIC"); + sbuf_cat(sb, "AUTOMATIC"); break; case G_MIRROR_TYPE_MANUAL: - sbuf_printf(sb, "MANUAL"); + sbuf_cat(sb, "MANUAL"); break; default: - sbuf_printf(sb, "UNKNOWN"); + sbuf_cat(sb, "UNKNOWN"); break; } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%s%u\n", indent, (u_int)sc->sc_id); sbuf_printf(sb, "%s%u\n", indent, sc->sc_syncid); sbuf_printf(sb, "%s%u\n", indent, sc->sc_genid); sbuf_printf(sb, "%s", indent); if (sc->sc_flags == 0) - sbuf_printf(sb, "NONE"); + sbuf_cat(sb, "NONE"); else { int first = 1; #define ADD_FLAG(flag, name) do { \ if ((sc->sc_flags & (flag)) != 0) { \ if (!first) \ - sbuf_printf(sb, ", "); \ + sbuf_cat(sb, ", "); \ else \ first = 0; \ - sbuf_printf(sb, name); \ + sbuf_cat(sb, name); \ } \ } while (0) ADD_FLAG(G_MIRROR_DEVICE_FLAG_NOFAILSYNC, "NOFAILSYNC"); ADD_FLAG(G_MIRROR_DEVICE_FLAG_NOAUTOSYNC, "NOAUTOSYNC"); #undef ADD_FLAG } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%s%u\n", indent, (u_int)sc->sc_slice); sbuf_printf(sb, "%s%s\n", indent, @@ -3429,7 +3429,7 @@ g_mirror_dumpconf(struct sbuf *sb, const char *indent, sbuf_printf(sb, "%s", "COMPLETE"); else sbuf_printf(sb, "%s", "DEGRADED"); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); } } Modified: stable/12/sys/geom/multipath/g_multipath.c ============================================================================== --- stable/12/sys/geom/multipath/g_multipath.c Sun Jul 7 18:45:57 2019 (r349824) +++ stable/12/sys/geom/multipath/g_multipath.c Sun Jul 7 18:47:01 2019 (r349825) @@ -1450,7 +1450,7 @@ g_multipath_ctl_getactive(struct gctl_req *req, struct } else if (sc->sc_active && sc->sc_active->provider) { sbuf_printf(sb, "%s\n", sc->sc_active->provider->name); } else { - sbuf_printf(sb, "none\n"); + sbuf_cat(sb, "none\n"); } sbuf_finish(sb); gctl_set_param_err(req, "output", sbuf_data(sb), sbuf_len(sb) + 1); Modified: stable/12/sys/geom/part/g_part_apm.c ============================================================================== --- stable/12/sys/geom/part/g_part_apm.c Sun Jul 7 18:45:57 2019 (r349824) +++ stable/12/sys/geom/part/g_part_apm.c Sun Jul 7 18:47:01 2019 (r349825) @@ -310,13 +310,13 @@ g_part_apm_dumpconf(struct g_part_table *table, struct strncpy(u.name, entry->ent.ent_name, APM_ENT_NAMELEN); u.name[APM_ENT_NAMELEN] = '\0'; sbuf_printf(sb, "%s\n"); + g_conf_cat_escaped(sb, u.name); + sbuf_cat(sb, "\n"); strncpy(u.type, entry->ent.ent_type, APM_ENT_TYPELEN); u.type[APM_ENT_TYPELEN] = '\0'; sbuf_printf(sb, "%s", indent); - g_conf_printf_escaped(sb, "%s", u.type); - sbuf_printf(sb, "\n"); + g_conf_cat_escaped(sb, u.type); + sbuf_cat(sb, "\n"); } else { /* confxml: scheme information */ } Modified: stable/12/sys/geom/part/g_part_bsd64.c ============================================================================== --- stable/12/sys/geom/part/g_part_bsd64.c Sun Jul 7 18:45:57 2019 (r349824) +++ stable/12/sys/geom/part/g_part_bsd64.c Sun Jul 7 18:47:01 2019 (r349825) @@ -385,11 +385,11 @@ g_part_bsd64_dumpconf(struct g_part_table *basetable, if (!EQUUID(&bsd64_uuid_unused, &entry->type_uuid)) { sbuf_printf(sb, "%s", indent); sbuf_printf_uuid(sb, &entry->type_uuid); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); } sbuf_printf(sb, "%s", indent); sbuf_printf_uuid(sb, &entry->stor_uuid); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); } else { /* confxml: scheme information */ table = (struct g_part_bsd64_table *)basetable; @@ -400,12 +400,12 @@ g_part_bsd64_dumpconf(struct g_part_table *basetable, indent, (uintmax_t)table->d_abase); sbuf_printf(sb, "%s", indent); sbuf_printf_uuid(sb, &table->d_stor_uuid); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%s\n"); + g_conf_cat_escaped(sb, buf); + sbuf_cat(sb, "\n"); } } Modified: stable/12/sys/geom/part/g_part_gpt.c ============================================================================== --- stable/12/sys/geom/part/g_part_gpt.c Sun Jul 7 18:45:57 2019 (r349824) +++ stable/12/sys/geom/part/g_part_gpt.c Sun Jul 7 18:47:01 2019 (r349825) @@ -712,14 +712,14 @@ g_part_gpt_dumpconf(struct g_part_table *table, struct entry = (struct g_part_gpt_entry *)baseentry; if (indent == NULL) { /* conftxt: libdisk compatibility */ - sbuf_printf(sb, " xs GPT xt "); + sbuf_cat(sb, " xs GPT xt "); sbuf_printf_uuid(sb, &entry->ent.ent_type); } else if (entry != NULL) { /* confxml: partition entry information */ sbuf_printf(sb, "%s\n"); + sbuf_cat(sb, "\n"); if (entry->ent.ent_attr & GPT_ENT_ATTR_BOOTME) sbuf_printf(sb, "%sbootme\n", indent); if (entry->ent.ent_attr & GPT_ENT_ATTR_BOOTONCE) { @@ -732,16 +732,16 @@ g_part_gpt_dumpconf(struct g_part_table *table, struct } sbuf_printf(sb, "%s", indent); sbuf_printf_uuid(sb, &entry->ent.ent_type); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%s", indent); sbuf_printf_uuid(sb, &entry->ent.ent_uuid); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%s", indent); sbuf_printf(sb, "HD(%d,GPT,", entry->base.gpe_index); sbuf_printf_uuid(sb, &entry->ent.ent_uuid); sbuf_printf(sb, ",%#jx,%#jx)", (intmax_t)entry->base.gpe_start, (intmax_t)(entry->base.gpe_end - entry->base.gpe_start + 1)); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); } else { /* confxml: scheme information */ } Modified: stable/12/sys/geom/part/g_part_mbr.c ============================================================================== --- stable/12/sys/geom/part/g_part_mbr.c Sun Jul 7 18:45:57 2019 (r349824) +++ stable/12/sys/geom/part/g_part_mbr.c Sun Jul 7 18:47:01 2019 (r349825) @@ -330,7 +330,7 @@ g_part_mbr_dumpconf(struct g_part_table *basetable, st sbuf_printf(sb, "%sHD(%d,MBR,%#08x,%#jx,%#jx)", indent, entry->base.gpe_index, dsn, (intmax_t)entry->base.gpe_start, (intmax_t)(entry->base.gpe_end - entry->base.gpe_start + 1)); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); } else { /* confxml: scheme information */ } Modified: stable/12/sys/geom/raid/g_raid.c ============================================================================== --- stable/12/sys/geom/raid/g_raid.c Sun Jul 7 18:45:57 2019 (r349824) +++ stable/12/sys/geom/raid/g_raid.c Sun Jul 7 18:47:01 2019 (r349825) @@ -2372,7 +2372,7 @@ g_raid_dumpconf(struct sbuf *sb, const char *indent, s sbuf_printf(sb, "%s ", g_raid_get_diskname(sd->sd_disk)); } else { - sbuf_printf(sb, "NONE "); + sbuf_cat(sb, "NONE "); } sbuf_printf(sb, "(%s", g_raid_subdisk_state2str(sd->sd_state)); @@ -2382,11 +2382,11 @@ g_raid_dumpconf(struct sbuf *sb, const char *indent, s (int)(sd->sd_rebuild_pos * 100 / sd->sd_size)); } - sbuf_printf(sb, ")"); + sbuf_cat(sb, ")"); if (i + 1 < vol->v_disks_count) - sbuf_printf(sb, ", "); + sbuf_cat(sb, ", "); } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sx_xunlock(&sc->sc_lock); g_topology_lock(); } else if (cp != NULL) { @@ -2398,7 +2398,7 @@ g_raid_dumpconf(struct sbuf *sb, const char *indent, s sbuf_printf(sb, "%s%s", indent, g_raid_disk_state2str(disk->d_state)); if (!TAILQ_EMPTY(&disk->d_subdisks)) { - sbuf_printf(sb, " ("); + sbuf_cat(sb, " ("); TAILQ_FOREACH(sd, &disk->d_subdisks, sd_next) { sbuf_printf(sb, "%s", g_raid_subdisk_state2str(sd->sd_state)); @@ -2409,11 +2409,11 @@ g_raid_dumpconf(struct sbuf *sb, const char *indent, s sd->sd_size)); } if (TAILQ_NEXT(sd, sd_next)) - sbuf_printf(sb, ", "); + sbuf_cat(sb, ", "); } - sbuf_printf(sb, ")"); + sbuf_cat(sb, ")"); } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%s", indent); TAILQ_FOREACH(sd, &disk->d_subdisks, sd_next) { sbuf_printf(sb, "r%d(%s):%d@%ju", @@ -2421,9 +2421,9 @@ g_raid_dumpconf(struct sbuf *sb, const char *indent, s sd->sd_volume->v_name, sd->sd_pos, sd->sd_offset); if (TAILQ_NEXT(sd, sd_next)) - sbuf_printf(sb, ", "); + sbuf_cat(sb, ", "); } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%s%d\n", indent, disk->d_read_errs); sx_xunlock(&sc->sc_lock); Modified: stable/12/sys/geom/raid3/g_raid3.c ============================================================================== --- stable/12/sys/geom/raid3/g_raid3.c Sun Jul 7 18:45:57 2019 (r349824) +++ stable/12/sys/geom/raid3/g_raid3.c Sun Jul 7 18:47:01 2019 (r349825) @@ -3424,22 +3424,22 @@ g_raid3_dumpconf(struct sbuf *sb, const char *indent, sx_xlock(&sc->sc_lock); sbuf_printf(sb, "%s", indent); if (disk->d_no == sc->sc_ndisks - 1) - sbuf_printf(sb, "PARITY"); + sbuf_cat(sb, "PARITY"); else - sbuf_printf(sb, "DATA"); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "DATA"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%s%u\n", indent, (u_int)disk->d_no); if (disk->d_state == G_RAID3_DISK_STATE_SYNCHRONIZING) { sbuf_printf(sb, "%s", indent); if (disk->d_sync.ds_offset == 0) - sbuf_printf(sb, "0%%"); + sbuf_cat(sb, "0%"); else { sbuf_printf(sb, "%u%%", (u_int)((disk->d_sync.ds_offset * 100) / (sc->sc_mediasize / (sc->sc_ndisks - 1)))); } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); if (disk->d_sync.ds_offset > 0) { sbuf_printf(sb, "%s%jd" "\n", indent, @@ -3451,17 +3451,17 @@ g_raid3_dumpconf(struct sbuf *sb, const char *indent, sbuf_printf(sb, "%s%u\n", indent, disk->d_genid); sbuf_printf(sb, "%s", indent); if (disk->d_flags == 0) - sbuf_printf(sb, "NONE"); + sbuf_cat(sb, "NONE"); else { int first = 1; #define ADD_FLAG(flag, name) do { \ if ((disk->d_flags & (flag)) != 0) { \ if (!first) \ - sbuf_printf(sb, ", "); \ + sbuf_cat(sb, ", "); \ else \ first = 0; \ - sbuf_printf(sb, name); \ + sbuf_cat(sb, name); \ } \ } while (0) ADD_FLAG(G_RAID3_DISK_FLAG_DIRTY, "DIRTY"); @@ -3472,7 +3472,7 @@ g_raid3_dumpconf(struct sbuf *sb, const char *indent, ADD_FLAG(G_RAID3_DISK_FLAG_BROKEN, "BROKEN"); #undef ADD_FLAG } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%s%s\n", indent, g_raid3_disk_state2str(disk->d_state)); sx_xunlock(&sc->sc_lock); @@ -3505,17 +3505,17 @@ g_raid3_dumpconf(struct sbuf *sb, const char *indent, sbuf_printf(sb, "%s%u\n", indent, sc->sc_genid); sbuf_printf(sb, "%s", indent); if (sc->sc_flags == 0) - sbuf_printf(sb, "NONE"); + sbuf_cat(sb, "NONE"); else { int first = 1; #define ADD_FLAG(flag, name) do { \ if ((sc->sc_flags & (flag)) != 0) { \ if (!first) \ - sbuf_printf(sb, ", "); \ + sbuf_cat(sb, ", "); \ else \ first = 0; \ - sbuf_printf(sb, name); \ + sbuf_cat(sb, name); \ } \ } while (0) ADD_FLAG(G_RAID3_DEVICE_FLAG_NOFAILSYNC, "NOFAILSYNC"); @@ -3525,7 +3525,7 @@ g_raid3_dumpconf(struct sbuf *sb, const char *indent, ADD_FLAG(G_RAID3_DEVICE_FLAG_VERIFY, "VERIFY"); #undef ADD_FLAG } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%s%u\n", indent, sc->sc_ndisks); sbuf_printf(sb, "%s%s\n", indent, Modified: stable/12/sys/geom/stripe/g_stripe.c ============================================================================== --- stable/12/sys/geom/stripe/g_stripe.c Sun Jul 7 18:45:57 2019 (r349824) +++ stable/12/sys/geom/stripe/g_stripe.c Sun Jul 7 18:47:01 2019 (r349825) @@ -1248,24 +1248,24 @@ g_stripe_dumpconf(struct sbuf *sb, const char *indent, sbuf_printf(sb, "%s", indent); switch (sc->sc_type) { case G_STRIPE_TYPE_AUTOMATIC: - sbuf_printf(sb, "AUTOMATIC"); + sbuf_cat(sb, "AUTOMATIC"); break; case G_STRIPE_TYPE_MANUAL: - sbuf_printf(sb, "MANUAL"); + sbuf_cat(sb, "MANUAL"); break; default: - sbuf_printf(sb, "UNKNOWN"); + sbuf_cat(sb, "UNKNOWN"); break; } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%sTotal=%u, Online=%u\n", indent, sc->sc_ndisks, g_stripe_nvalid(sc)); sbuf_printf(sb, "%s", indent); if (sc->sc_provider != NULL && sc->sc_provider->error == 0) - sbuf_printf(sb, "UP"); + sbuf_cat(sb, "UP"); else - sbuf_printf(sb, "DOWN"); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "DOWN"); + sbuf_cat(sb, "\n"); } } Modified: stable/12/sys/kern/kern_uuid.c ============================================================================== --- stable/12/sys/kern/kern_uuid.c Sun Jul 7 18:45:57 2019 (r349824) +++ stable/12/sys/kern/kern_uuid.c Sun Jul 7 18:47:01 2019 (r349825) @@ -297,7 +297,7 @@ sbuf_printf_uuid(struct sbuf *sb, struct uuid *uuid) char buf[38]; snprintf_uuid(buf, sizeof(buf), uuid); - return (sbuf_printf(sb, "%s", buf)); + return (sbuf_cat(sb, buf)); } /* From owner-svn-src-all@freebsd.org Sun Jul 7 18:49:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DFC5615EB5E0; Sun, 7 Jul 2019 18:49:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8520B6D9B5; Sun, 7 Jul 2019 18:49:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 523BA5282; Sun, 7 Jul 2019 18:49:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67Infvt075499; Sun, 7 Jul 2019 18:49:41 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67IndUh075490; Sun, 7 Jul 2019 18:49:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201907071849.x67IndUh075490@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 7 Jul 2019 18:49:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349826 - in stable/12: share/man/man9 sys/kern sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12: share/man/man9 sys/kern sys/sys X-SVN-Commit-Revision: 349826 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8520B6D9B5 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.948,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 18:49:42 -0000 Author: mav Date: Sun Jul 7 18:49:39 2019 New Revision: 349826 URL: https://svnweb.freebsd.org/changeset/base/349826 Log: MFC r349220: Add wakeup_any(), cheaper wakeup_one() for taskqueue(9). wakeup_one() and underlying sleepq_signal() spend additional time trying to be fair, waking thread with highest priority, sleeping longest time. But in case of taskqueue there are many absolutely identical threads, and any fairness between them is quite pointless. It makes even worse, since round-robin wakeups not only make previous CPU affinity in scheduler quite useless, but also hide from user chance to see CPU bottlenecks, when sequential workload with one request at a time looks evenly distributed between multiple threads. This change adds new SLEEPQ_UNFAIR flag to sleepq_signal(), making it wakeup thread that went to sleep last, but no longer in context switch (to avoid immediate spinning on the thread lock). On top of that new wakeup_any() function is added, equivalent to wakeup_one(), but setting the flag. On top of that taskqueue(9) is switchied to wakeup_any() to wakeup its threads. As result, on 72-core Xeon v4 machine sequential ZFS write to 12 ZVOLs with 16KB block size spend 34% less time in wakeup_any() and descendants then it was spending in wakeup_one(), and total write throughput increased by ~10% with the same as before CPU usage. Modified: stable/12/share/man/man9/Makefile stable/12/share/man/man9/sleep.9 stable/12/share/man/man9/sleepqueue.9 stable/12/sys/kern/kern_synch.c stable/12/sys/kern/subr_sleepqueue.c stable/12/sys/kern/subr_taskqueue.c stable/12/sys/sys/queue.h stable/12/sys/sys/sleepqueue.h stable/12/sys/sys/systm.h Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man9/Makefile ============================================================================== --- stable/12/share/man/man9/Makefile Sun Jul 7 18:47:01 2019 (r349825) +++ stable/12/share/man/man9/Makefile Sun Jul 7 18:49:39 2019 (r349826) @@ -1888,7 +1888,8 @@ MLINKS+=sleep.9 msleep.9 \ sleep.9 tsleep.9 \ sleep.9 tsleep_sbt.9 \ sleep.9 wakeup.9 \ - sleep.9 wakeup_one.9 + sleep.9 wakeup_one.9 \ + sleep.9 wakeup_any.9 MLINKS+=sleepqueue.9 init_sleepqueues.9 \ sleepqueue.9 sleepq_abort.9 \ sleepqueue.9 sleepq_add.9 \ Modified: stable/12/share/man/man9/sleep.9 ============================================================================== --- stable/12/share/man/man9/sleep.9 Sun Jul 7 18:47:01 2019 (r349825) +++ stable/12/share/man/man9/sleep.9 Sun Jul 7 18:49:39 2019 (r349826) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 4, 2018 +.Dd June 19, 2019 .Dt SLEEP 9 .Os .Sh NAME @@ -38,7 +38,9 @@ .Nm pause_sbt , .Nm tsleep , .Nm tsleep_sbt , -.Nm wakeup +.Nm wakeup , +.Nm wakeup_one , +.Nm wakeup_any .Nd wait for events .Sh SYNOPSIS .In sys/param.h @@ -70,6 +72,8 @@ .Fn wakeup "void *chan" .Ft void .Fn wakeup_one "void *chan" +.Ft void +.Fn wakeup_any "void *chan" .Sh DESCRIPTION The functions .Fn tsleep , @@ -79,8 +83,9 @@ The functions .Fn pause_sig , .Fn pause_sbt , .Fn wakeup , +.Fn wakeup_one , and -.Fn wakeup_one +.Fn wakeup_any handle event-based thread blocking. If a thread must wait for an external event, it is put to sleep by @@ -252,9 +257,10 @@ function is a wrapper around .Fn tsleep that suspends execution of the current thread for the indicated timeout. The thread can not be awakened early by signals or calls to -.Fn wakeup +.Fn wakeup , +.Fn wakeup_one or -.Fn wakeup_one . +.Fn wakeup_any . The .Fn pause_sig function is a variant of @@ -263,8 +269,8 @@ which can be awakened early by signals. .Pp The .Fn wakeup_one -function makes the first thread in the queue that is sleeping on the -parameter +function makes the first highest priority thread in the queue that is +sleeping on the parameter .Fa chan runnable. This reduces the load when a large number of threads are sleeping on @@ -292,6 +298,16 @@ to pay particular attention to ensure that no other threads wait on the same .Fa chan . +.Pp +The +.Fn wakeup_any +function is similar to +.Fn wakeup_one , +except that it makes runnable last thread on the queue (sleeping less), +ignoring fairness. +It can be used when threads sleeping on the +.Fa chan +are known to be identical and there is no reason to be fair. .Pp If the timeout given by .Fa timo Modified: stable/12/share/man/man9/sleepqueue.9 ============================================================================== --- stable/12/share/man/man9/sleepqueue.9 Sun Jul 7 18:47:01 2019 (r349825) +++ stable/12/share/man/man9/sleepqueue.9 Sun Jul 7 18:49:39 2019 (r349826) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 22, 2014 +.Dd June 19, 2019 .Dt SLEEPQUEUE 9 .Os .Sh NAME @@ -291,7 +291,8 @@ and functions. The .Fn sleepq_signal -function awakens the highest priority thread sleeping on a wait channel while +function awakens the highest priority thread sleeping on a wait channel +(if SLEEPQ_UNFAIR flag is set, thread that went to sleep recently) while .Fn sleepq_broadcast awakens all of the threads sleeping on a wait channel. The Modified: stable/12/sys/kern/kern_synch.c ============================================================================== --- stable/12/sys/kern/kern_synch.c Sun Jul 7 18:47:01 2019 (r349825) +++ stable/12/sys/kern/kern_synch.c Sun Jul 7 18:49:39 2019 (r349826) @@ -368,6 +368,19 @@ wakeup_one(void *ident) kick_proc0(); } +void +wakeup_any(void *ident) +{ + int wakeup_swapper; + + sleepq_lock(ident); + wakeup_swapper = sleepq_signal(ident, SLEEPQ_SLEEP | SLEEPQ_UNFAIR, + 0, 0); + sleepq_release(ident); + if (wakeup_swapper) + kick_proc0(); +} + static void kdb_switch(void) { Modified: stable/12/sys/kern/subr_sleepqueue.c ============================================================================== --- stable/12/sys/kern/subr_sleepqueue.c Sun Jul 7 18:47:01 2019 (r349825) +++ stable/12/sys/kern/subr_sleepqueue.c Sun Jul 7 18:49:39 2019 (r349826) @@ -124,7 +124,7 @@ CTASSERT(powerof2(SC_TABLESIZE)); * c - sleep queue chain lock */ struct sleepqueue { - TAILQ_HEAD(, thread) sq_blocked[NR_SLEEPQS]; /* (c) Blocked threads. */ + struct threadqueue sq_blocked[NR_SLEEPQS]; /* (c) Blocked threads. */ u_int sq_blockedcnt[NR_SLEEPQS]; /* (c) N. of blocked threads. */ LIST_ENTRY(sleepqueue) sq_hash; /* (c) Chain and free list. */ LIST_HEAD(, sleepqueue) sq_free; /* (c) Free queues. */ @@ -890,12 +890,14 @@ sleepq_init(void *mem, int size, int flags) } /* - * Find the highest priority thread sleeping on a wait channel and resume it. + * Find thread sleeping on a wait channel and resume it. */ int sleepq_signal(void *wchan, int flags, int pri, int queue) { + struct sleepqueue_chain *sc; struct sleepqueue *sq; + struct threadqueue *head; struct thread *td, *besttd; int wakeup_swapper; @@ -908,16 +910,33 @@ sleepq_signal(void *wchan, int flags, int pri, int que KASSERT(sq->sq_type == (flags & SLEEPQ_TYPE), ("%s: mismatch between sleep/wakeup and cv_*", __func__)); - /* - * Find the highest priority thread on the queue. If there is a - * tie, use the thread that first appears in the queue as it has - * been sleeping the longest since threads are always added to - * the tail of sleep queues. - */ - besttd = TAILQ_FIRST(&sq->sq_blocked[queue]); - TAILQ_FOREACH(td, &sq->sq_blocked[queue], td_slpq) { - if (td->td_priority < besttd->td_priority) + head = &sq->sq_blocked[queue]; + if (flags & SLEEPQ_UNFAIR) { + /* + * Find the most recently sleeping thread, but try to + * skip threads still in process of context switch to + * avoid spinning on the thread lock. + */ + sc = SC_LOOKUP(wchan); + besttd = TAILQ_LAST_FAST(head, thread, td_slpq); + while (besttd->td_lock != &sc->sc_lock) { + td = TAILQ_PREV_FAST(besttd, head, thread, td_slpq); + if (td == NULL) + break; besttd = td; + } + } else { + /* + * Find the highest priority thread on the queue. If there + * is a tie, use the thread that first appears in the queue + * as it has been sleeping the longest since threads are + * always added to the tail of sleep queues. + */ + besttd = td = TAILQ_FIRST(head); + while ((td = TAILQ_NEXT(td, td_slpq)) != NULL) { + if (td->td_priority < besttd->td_priority) + besttd = td; + } } MPASS(besttd != NULL); thread_lock(besttd); Modified: stable/12/sys/kern/subr_taskqueue.c ============================================================================== --- stable/12/sys/kern/subr_taskqueue.c Sun Jul 7 18:47:01 2019 (r349825) +++ stable/12/sys/kern/subr_taskqueue.c Sun Jul 7 18:49:39 2019 (r349826) @@ -804,7 +804,7 @@ taskqueue_thread_enqueue(void *context) tqp = context; tq = *tqp; - wakeup_one(tq); + wakeup_any(tq); } TASKQUEUE_DEFINE(swi, taskqueue_swi_enqueue, NULL, Modified: stable/12/sys/sys/queue.h ============================================================================== --- stable/12/sys/sys/queue.h Sun Jul 7 18:47:01 2019 (r349825) +++ stable/12/sys/sys/queue.h Sun Jul 7 18:49:39 2019 (r349826) @@ -833,6 +833,10 @@ struct { \ #define TAILQ_PREV(elm, headname, field) \ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) +#define TAILQ_PREV_FAST(elm, head, type, field) \ + ((elm)->field.tqe_prev == &(head)->tqh_first ? NULL : \ + __containerof((elm)->field.tqe_prev, QUEUE_TYPEOF(type), field.tqe_next)) + #define TAILQ_REMOVE(head, elm, field) do { \ QMD_SAVELINK(oldnext, (elm)->field.tqe_next); \ QMD_SAVELINK(oldprev, (elm)->field.tqe_prev); \ Modified: stable/12/sys/sys/sleepqueue.h ============================================================================== --- stable/12/sys/sys/sleepqueue.h Sun Jul 7 18:47:01 2019 (r349825) +++ stable/12/sys/sys/sleepqueue.h Sun Jul 7 18:49:39 2019 (r349826) @@ -85,6 +85,7 @@ struct thread; #define SLEEPQ_SX 0x03 /* Used by an sx lock. */ #define SLEEPQ_LK 0x04 /* Used by a lockmgr. */ #define SLEEPQ_INTERRUPTIBLE 0x100 /* Sleep is interruptible. */ +#define SLEEPQ_UNFAIR 0x200 /* Unfair wakeup order. */ void init_sleepqueues(void); int sleepq_abort(struct thread *td, int intrval); Modified: stable/12/sys/sys/systm.h ============================================================================== --- stable/12/sys/sys/systm.h Sun Jul 7 18:47:01 2019 (r349825) +++ stable/12/sys/sys/systm.h Sun Jul 7 18:49:39 2019 (r349826) @@ -482,6 +482,7 @@ int pause_sbt(const char *wmesg, sbintime_t sbt, sbint _sleep((chan), NULL, (pri), (wmesg), (bt), (pr), (flags)) void wakeup(void * chan); void wakeup_one(void * chan); +void wakeup_any(void * chan); /* * Common `struct cdev *' stuff are declared here to avoid #include poisoning From owner-svn-src-all@freebsd.org Sun Jul 7 18:50:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6381415EB648; Sun, 7 Jul 2019 18:50:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0B3786DAFD; Sun, 7 Jul 2019 18:50:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC1C35286; Sun, 7 Jul 2019 18:50:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67IoNTs075614; Sun, 7 Jul 2019 18:50:23 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67IoNio075613; Sun, 7 Jul 2019 18:50:23 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201907071850.x67IoNio075613@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 7 Jul 2019 18:50:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349827 - stable/12/sys/cam X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam X-SVN-Commit-Revision: 349827 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0B3786DAFD X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 18:50:24 -0000 Author: mav Date: Sun Jul 7 18:50:23 2019 New Revision: 349827 URL: https://svnweb.freebsd.org/changeset/base/349827 Log: MFC r349243: Optimize xpt_getattr(). Do not allocate temporary buffer for attributes we are going to return as-is, just make sure to NUL-terminate them. Do not zero temporary 64KB buffer for CDAI_TYPE_SCSI_DEVID, XPT tells us how much data it filled and there are also length fields inside the returned data also. Modified: stable/12/sys/cam/cam_xpt.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/cam_xpt.c ============================================================================== --- stable/12/sys/cam/cam_xpt.c Sun Jul 7 18:49:39 2019 (r349826) +++ stable/12/sys/cam/cam_xpt.c Sun Jul 7 18:50:23 2019 (r349827) @@ -1262,6 +1262,7 @@ xpt_getattr(char *buf, size_t len, const char *attr, s cdai.ccb_h.func_code = XPT_DEV_ADVINFO; cdai.flags = CDAI_FLAG_NONE; cdai.bufsiz = len; + cdai.buf = buf; if (!strcmp(attr, "GEOM::ident")) cdai.buftype = CDAI_TYPE_SERIAL_NUM; @@ -1271,14 +1272,14 @@ xpt_getattr(char *buf, size_t len, const char *attr, s strcmp(attr, "GEOM::lunname") == 0) { cdai.buftype = CDAI_TYPE_SCSI_DEVID; cdai.bufsiz = CAM_SCSI_DEVID_MAXLEN; + cdai.buf = malloc(cdai.bufsiz, M_CAMXPT, M_NOWAIT); + if (cdai.buf == NULL) { + ret = ENOMEM; + goto out; + } } else goto out; - cdai.buf = malloc(cdai.bufsiz, M_CAMXPT, M_NOWAIT|M_ZERO); - if (cdai.buf == NULL) { - ret = ENOMEM; - goto out; - } xpt_action((union ccb *)&cdai); /* can only be synchronous */ if ((cdai.ccb_h.status & CAM_DEV_QFRZN) != 0) cam_release_devq(cdai.ccb_h.path, 0, 0, 0, FALSE); @@ -1343,13 +1344,15 @@ xpt_getattr(char *buf, size_t len, const char *attr, s ret = EFAULT; } } else { - ret = 0; - if (strlcpy(buf, cdai.buf, len) >= len) + if (cdai.provsiz < len) { + cdai.buf[cdai.provsiz] = 0; + ret = 0; + } else ret = EFAULT; } out: - if (cdai.buf != NULL) + if ((char *)cdai.buf != buf) free(cdai.buf, M_CAMXPT); return ret; } From owner-svn-src-all@freebsd.org Sun Jul 7 18:51:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85C4F15EB7D2; Sun, 7 Jul 2019 18:51:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 280616DC8F; Sun, 7 Jul 2019 18:51:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0300452A9; Sun, 7 Jul 2019 18:51:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x67Ip1WJ076641; Sun, 7 Jul 2019 18:51:01 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x67Ip1fN076640; Sun, 7 Jul 2019 18:51:01 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201907071851.x67Ip1fN076640@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 7 Jul 2019 18:51:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349828 - stable/12/sys/cam/ctl X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam/ctl X-SVN-Commit-Revision: 349828 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 280616DC8F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:12874, ipnet:2000::/3, country:IT] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jul 2019 18:51:02 -0000 Author: mav Date: Sun Jul 7 18:51:01 2019 New Revision: 349828 URL: https://svnweb.freebsd.org/changeset/base/349828 Log: MFC r349246: SPC-3 and up require some UAs to be returned as fixed. Modified: stable/12/sys/cam/ctl/ctl_error.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/ctl/ctl_error.c ============================================================================== --- stable/12/sys/cam/ctl/ctl_error.c Sun Jul 7 18:50:23 2019 (r349827) +++ stable/12/sys/cam/ctl/ctl_error.c Sun Jul 7 18:51:01 2019 (r349828) @@ -81,6 +81,12 @@ ctl_set_sense_data_va(struct scsi_sense_data *sense_da */ if (sense_format == SSD_TYPE_NONE) { /* + * SPC-3 and up require some UAs to be returned as fixed. + */ + if (asc == 0x29 || (asc == 0x2A && ascq == 0x01)) + sense_format = SSD_TYPE_FIXED; + else + /* * If the format isn't specified, we only return descriptor * sense if the LUN exists and descriptor sense is turned * on for that LUN. From owner-svn-src-all@freebsd.org Mon Jul 8 10:17:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9295F15DA3C3; Mon, 8 Jul 2019 10:17:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 349B795C83; Mon, 8 Jul 2019 10:17:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27941F07F; Mon, 8 Jul 2019 10:17:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68AH0uh059525; Mon, 8 Jul 2019 10:17:00 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68AH0Q3059524; Mon, 8 Jul 2019 10:17:00 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201907081017.x68AH0Q3059524@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 8 Jul 2019 10:17:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349829 - stable/12/sys/dev/ahci X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/ahci X-SVN-Commit-Revision: 349829 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 349B795C83 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 10:17:01 -0000 Author: mav Date: Mon Jul 8 10:17:00 2019 New Revision: 349829 URL: https://svnweb.freebsd.org/changeset/base/349829 Log: MFC r340041 (by miwi): - Add quirk for Samsung on Mac Mini 7,1 PR: 201676 Submitted by: Ruben Kerkhof Modified: stable/12/sys/dev/ahci/ahci_pci.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ahci/ahci_pci.c ============================================================================== --- stable/12/sys/dev/ahci/ahci_pci.c Sun Jul 7 18:51:01 2019 (r349828) +++ stable/12/sys/dev/ahci/ahci_pci.c Mon Jul 8 10:17:00 2019 (r349829) @@ -352,6 +352,7 @@ static const struct { {0x01861039, 0x00, "SiS 968", 0}, {0xa01c177d, 0x00, "ThunderX", AHCI_Q_ABAR0|AHCI_Q_1MSI}, {0x00311c36, 0x00, "Annapurna", AHCI_Q_FORCE_PI|AHCI_Q_RESTORE_CAP|AHCI_Q_NOMSIX}, + {0x1600144d, 0x00, "Samsung", AHCI_Q_NOMSI}, {0x00000000, 0x00, NULL, 0} }; From owner-svn-src-all@freebsd.org Mon Jul 8 10:18:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C644D15DA487; Mon, 8 Jul 2019 10:18:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6D8CD95E23; Mon, 8 Jul 2019 10:18:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4867CF082; Mon, 8 Jul 2019 10:18:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68AICjM059641; Mon, 8 Jul 2019 10:18:12 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68AIBpV059640; Mon, 8 Jul 2019 10:18:11 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201907081018.x68AIBpV059640@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 8 Jul 2019 10:18:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349830 - stable/12/sys/dev/ahci X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/ahci X-SVN-Commit-Revision: 349830 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6D8CD95E23 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 10:18:13 -0000 Author: mav Date: Mon Jul 8 10:18:11 2019 New Revision: 349830 URL: https://svnweb.freebsd.org/changeset/base/349830 Log: MFC r340092 (by imp): Implement ability to turn on/off PHYs for AHCI devices. As part of Chuck's work on fixing kernel crashes caused by disk I/O errors, it is useful to be able to trigger various kinds of errors. This patch allows causing an AHCI-attached disk to disappear, by having the driver keep the PHY disabled when the driver would otherwise enable the PHY. It also allows making the disk reappear by having the driver go back to setting the PHY enable/disable state as it normal would and simulating the hardware event that causes a bus rescan. Submitted by: Chuck Silvers Differential Revision: https://reviews.freebsd.org/D16043 Modified: stable/12/sys/dev/ahci/ahci.c stable/12/sys/dev/ahci/ahci.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ahci/ahci.c ============================================================================== --- stable/12/sys/dev/ahci/ahci.c Mon Jul 8 10:17:00 2019 (r349829) +++ stable/12/sys/dev/ahci/ahci.c Mon Jul 8 10:18:11 2019 (r349830) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -80,6 +81,8 @@ static void ahci_stop(struct ahci_channel *ch); static void ahci_clo(struct ahci_channel *ch); static void ahci_start_fr(struct ahci_channel *ch); static void ahci_stop_fr(struct ahci_channel *ch); +static int ahci_phy_check_events(struct ahci_channel *ch, u_int32_t serr); +static uint32_t ahci_ch_detval(struct ahci_channel *ch, uint32_t val); static int ahci_sata_connect(struct ahci_channel *ch); static int ahci_sata_phy_reset(struct ahci_channel *ch); @@ -100,6 +103,13 @@ static MALLOC_DEFINE(M_AHCI, "AHCI driver", "AHCI driv #define RECOVERY_REQUEST_SENSE 2 #define recovery_slot spriv_field1 +static uint32_t +ahci_ch_detval(struct ahci_channel *ch, uint32_t val) +{ + + return ch->disablephy ? ATA_SC_DET_DISABLE : val; +} + int ahci_ctlr_setup(device_t dev) { @@ -665,11 +675,38 @@ ahci_ch_probe(device_t dev) } static int +ahci_ch_disablephy_proc(SYSCTL_HANDLER_ARGS) +{ + struct ahci_channel *ch; + int error, value; + + ch = arg1; + value = ch->disablephy; + error = sysctl_handle_int(oidp, &value, 0, req); + if (error != 0 || req->newptr == NULL || (value != 0 && value != 1)) + return (error); + + mtx_lock(&ch->mtx); + ch->disablephy = value; + if (value) { + ahci_ch_deinit(ch->dev); + } else { + ahci_ch_init(ch->dev); + ahci_phy_check_events(ch, ATA_SE_PHY_CHANGED | ATA_SE_EXCHANGED); + } + mtx_unlock(&ch->mtx); + + return (0); +} + +static int ahci_ch_attach(device_t dev) { struct ahci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ahci_channel *ch = device_get_softc(dev); struct cam_devq *devq; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree; int rid, error, i, sata_rev = 0; u_int32_t version; @@ -787,6 +824,11 @@ ahci_ch_attach(device_t dev) ahci_ch_pm, ch); } mtx_unlock(&ch->mtx); + ctx = device_get_sysctl_ctx(dev); + tree = device_get_sysctl_tree(dev); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "disable_phy", + CTLFLAG_RW | CTLTYPE_UINT, ch, 0, ahci_ch_disablephy_proc, "IU", + "Disable PHY"); return (0); err3: @@ -2505,7 +2547,7 @@ static int ahci_sata_phy_reset(struct ahci_channel *ch) { int sata_rev; - uint32_t val; + uint32_t val, detval; if (ch->listening) { val = ATA_INL(ch->r_mem, AHCI_P_CMD); @@ -2522,12 +2564,14 @@ ahci_sata_phy_reset(struct ahci_channel *ch) val = ATA_SC_SPD_SPEED_GEN3; else val = 0; + detval = ahci_ch_detval(ch, ATA_SC_DET_RESET); ATA_OUTL(ch->r_mem, AHCI_P_SCTL, - ATA_SC_DET_RESET | val | + detval | val | ATA_SC_IPM_DIS_PARTIAL | ATA_SC_IPM_DIS_SLUMBER); DELAY(1000); + detval = ahci_ch_detval(ch, ATA_SC_DET_IDLE); ATA_OUTL(ch->r_mem, AHCI_P_SCTL, - ATA_SC_DET_IDLE | val | ((ch->pm_level > 0) ? 0 : + detval | val | ((ch->pm_level > 0) ? 0 : (ATA_SC_IPM_DIS_PARTIAL | ATA_SC_IPM_DIS_SLUMBER))); if (!ahci_sata_connect(ch)) { if (ch->caps & AHCI_CAP_SSS) { Modified: stable/12/sys/dev/ahci/ahci.h ============================================================================== --- stable/12/sys/dev/ahci/ahci.h Mon Jul 8 10:17:00 2019 (r349829) +++ stable/12/sys/dev/ahci/ahci.h Mon Jul 8 10:18:11 2019 (r349830) @@ -461,6 +461,8 @@ struct ahci_channel { struct mtx_padalign mtx; /* state lock */ STAILQ_HEAD(, ccb_hdr) doneq; /* queue of completed CCBs */ int batch; /* doneq is in use */ + + int disablephy; /* keep PHY disabled */ }; struct ahci_enclosure { From owner-svn-src-all@freebsd.org Mon Jul 8 10:19:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4043315DA5DF; Mon, 8 Jul 2019 10:19:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DBB0E9606D; Mon, 8 Jul 2019 10:19:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8B20F084; Mon, 8 Jul 2019 10:19:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68AJno4059752; Mon, 8 Jul 2019 10:19:49 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68AJnlk059751; Mon, 8 Jul 2019 10:19:49 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201907081019.x68AJnlk059751@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 8 Jul 2019 10:19:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349831 - stable/12/sys/dev/ahci X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/ahci X-SVN-Commit-Revision: 349831 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DBB0E9606D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 10:19:50 -0000 Author: mav Date: Mon Jul 8 10:19:49 2019 New Revision: 349831 URL: https://svnweb.freebsd.org/changeset/base/349831 Log: MFC r341811 (by delphij): Remove questionable initialization for ICH8M, rely on BIOS to properly initialize the controller. According to the datasheet, the old code checks if port 2 (P2E, 0x4) was the only enabled port (except port 0, which was ignored by mask 0xfe), and issue a write to the PCS register to disable all but port 0, right before ahci_ctlr_reset. Some other operating systems would issue a port enable to all ports, but since the current code only does the special initialization for ICH8M, it entirely and rely on BIOS to do the right thing (the alternative would be https://reviews.freebsd.org/D18300?id=50922 , should we see reports that we really need to do it). Differential Revision: https://reviews.freebsd.org/D18300 Modified: stable/12/sys/dev/ahci/ahci_pci.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ahci/ahci_pci.c ============================================================================== --- stable/12/sys/dev/ahci/ahci_pci.c Mon Jul 8 10:18:11 2019 (r349830) +++ stable/12/sys/dev/ahci/ahci_pci.c Mon Jul 8 10:19:49 2019 (r349831) @@ -360,10 +360,7 @@ static int ahci_pci_ctlr_reset(device_t dev) { - if (pci_read_config(dev, PCIR_DEVVENDOR, 4) == 0x28298086 && - (pci_read_config(dev, 0x92, 1) & 0xfe) == 0x04) - pci_write_config(dev, 0x92, 0x01, 1); - return ahci_ctlr_reset(dev); + return(ahci_ctlr_reset(dev)); } static int From owner-svn-src-all@freebsd.org Mon Jul 8 10:21:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3125C15DA84C; Mon, 8 Jul 2019 10:21:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D6B53963FA; Mon, 8 Jul 2019 10:21:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B007BF1F2; Mon, 8 Jul 2019 10:21:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68ALetu061536; Mon, 8 Jul 2019 10:21:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68ALciv061526; Mon, 8 Jul 2019 10:21:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201907081021.x68ALciv061526@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 8 Jul 2019 10:21:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349832 - in stable/12/sys: cam/scsi dev/ahci X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys: cam/scsi dev/ahci X-SVN-Commit-Revision: 349832 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D6B53963FA X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.965,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 10:21:41 -0000 Author: mav Date: Mon Jul 8 10:21:38 2019 New Revision: 349832 URL: https://svnweb.freebsd.org/changeset/base/349832 Log: MFC r349321: Improve AHCI Enclosure Management and SES interoperation. Since SES specs do not define mechanism to map enclosure slots to SATA disks, AHCI EM code I written many years ago appeared quite useless, that always bugged me. I was thinking whether it was a good idea, but if LSI HBAs do that, why I shouldn't? This change introduces simple non-standard mechanism for the mapping into both AHCI EM and SES code, that makes AHCI EM on capable controllers (most of Intel's) a first-class SES citizen, allowing it to report disk physical path to GEOM, show devices inserted into each enclosure slot in `sesutil map` and `getencstat`, control locate and fault LEDs for specific devices with `sesutil locate adaX on` and `sesutil fault adaX on`, etc. I've successfully tested this on Supermicro X10DRH-i motherboard connected with sideband cable of its S-SATA Mini-SAS connector to SAS815TQ backplane. It can indicate with LEDs Locate, Fault and Rebuild/Remap SES statuses for each disk identical to real SES of Supermicro SAS2 backplanes. Relnotes: yes Modified: stable/12/sys/cam/scsi/scsi_all.c stable/12/sys/cam/scsi/scsi_enc.c stable/12/sys/cam/scsi/scsi_enc.h stable/12/sys/cam/scsi/scsi_enc_internal.h stable/12/sys/cam/scsi/scsi_enc_safte.c stable/12/sys/cam/scsi/scsi_enc_ses.c stable/12/sys/cam/scsi/scsi_ses.h stable/12/sys/dev/ahci/ahci.c stable/12/sys/dev/ahci/ahci.h stable/12/sys/dev/ahci/ahciem.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_all.c Mon Jul 8 10:19:49 2019 (r349831) +++ stable/12/sys/cam/scsi/scsi_all.c Mon Jul 8 10:21:38 2019 (r349832) @@ -5574,6 +5574,7 @@ scsi_devid_is_naa_ieee_reg(uint8_t *bufp) { struct scsi_vpd_id_descriptor *descr; struct scsi_vpd_id_naa_basic *naa; + int n; descr = (struct scsi_vpd_id_descriptor *)bufp; naa = (struct scsi_vpd_id_naa_basic *)descr->identifier; @@ -5581,7 +5582,8 @@ scsi_devid_is_naa_ieee_reg(uint8_t *bufp) return 0; if (descr->length < sizeof(struct scsi_vpd_id_naa_ieee_reg)) return 0; - if ((naa->naa >> SVPD_ID_NAA_NAA_SHIFT) != SVPD_ID_NAA_IEEE_REG) + n = naa->naa >> SVPD_ID_NAA_NAA_SHIFT; + if (n != SVPD_ID_NAA_LOCAL_REG && n != SVPD_ID_NAA_IEEE_REG) return 0; return 1; } Modified: stable/12/sys/cam/scsi/scsi_enc.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_enc.c Mon Jul 8 10:19:49 2019 (r349831) +++ stable/12/sys/cam/scsi/scsi_enc.c Mon Jul 8 10:21:38 2019 (r349832) @@ -89,6 +89,9 @@ int enc_verbose = 0; SYSCTL_INT(_kern_cam_enc, OID_AUTO, verbose, CTLFLAG_RWTUN, &enc_verbose, 0, "Enable verbose logging"); +const char *elm_type_names[] = ELM_TYPE_NAMES; +CTASSERT(nitems(elm_type_names) - 1 == ELMTYP_LAST); + static struct periph_driver encdriver = { enc_init, "ses", TAILQ_HEAD_INITIALIZER(encdriver.units), /* generation */ 0 @@ -240,13 +243,19 @@ enc_async(void *callback_arg, uint32_t code, struct ca struct enc_softc *softc; softc = (struct enc_softc *)periph->softc; - if (xpt_path_path_id(periph->path) != path_id - || softc == NULL - || (softc->enc_flags & ENC_FLAG_INITIALIZED) - == 0 - || softc->enc_vec.device_found == NULL) + + /* Check this SEP is ready. */ + if (softc == NULL || (softc->enc_flags & + ENC_FLAG_INITIALIZED) == 0 || + softc->enc_vec.device_found == NULL) continue; + /* Check this SEP may manage this device. */ + if (xpt_path_path_id(periph->path) != path_id && + (softc->enc_type != ENC_SEMB_SES || + cgd->protocol != PROTO_ATA)) + continue; + softc->enc_vec.device_found(softc); } xpt_unlock_buses(); @@ -440,7 +449,7 @@ enc_ioctl(struct cdev *dev, u_long cmd, caddr_t arg_ad encioc_element_t kelm; kelm.elm_idx = i; kelm.elm_subenc_id = cache->elm_map[i].subenclosure; - kelm.elm_type = cache->elm_map[i].enctype; + kelm.elm_type = cache->elm_map[i].elm_type; error = copyout(&kelm, &uelm[i], sizeof(kelm)); if (error) break; Modified: stable/12/sys/cam/scsi/scsi_enc.h ============================================================================== --- stable/12/sys/cam/scsi/scsi_enc.h Mon Jul 8 10:19:49 2019 (r349831) +++ stable/12/sys/cam/scsi/scsi_enc.h Mon Jul 8 10:21:38 2019 (r349832) @@ -120,9 +120,41 @@ typedef enum { ELMTYP_SCSI_INI = 0x15, ELMTYP_SUBENC = 0x16, ELMTYP_ARRAY_DEV = 0x17, - ELMTYP_SAS_EXP = 0x18, /* SAS expander */ - ELMTYP_SAS_CONN = 0x19 /* SAS connector */ + ELMTYP_SAS_EXP = 0x18, /* SAS Expander */ + ELMTYP_SAS_CONN = 0x19, /* SAS Connector */ + ELMTYP_LAST = ELMTYP_SAS_CONN } elm_type_t; + +#define ELM_TYPE_NAMES { \ + "Unspecified", \ + "Device Slot", \ + "Power Supply", \ + "Cooling", \ + "Temperature Sensors", \ + "Door", \ + "Audible alarm", \ + "Enclosure Services Controller Electronics", \ + "SCC Controller Electronics", \ + "Nonvolatile Cache", \ + "Invalid Operation Reason", \ + "Uninterruptible Power Supply", \ + "Display", \ + "Key Pad Entry", \ + "Enclosure", \ + "SCSI Port/Transceiver", \ + "Language", \ + "Communication Port", \ + "Voltage Sensor", \ + "Current Sensor", \ + "SCSI Target Port", \ + "SCSI Initiator Port", \ + "Simple Subenclosure", \ + "Array Device Slot", \ + "SAS Expander", \ + "SAS Connector" \ +} + +extern const char *elm_type_names[]; typedef struct encioc_element { /* Element Index */ Modified: stable/12/sys/cam/scsi/scsi_enc_internal.h ============================================================================== --- stable/12/sys/cam/scsi/scsi_enc_internal.h Mon Jul 8 10:19:49 2019 (r349831) +++ stable/12/sys/cam/scsi/scsi_enc_internal.h Mon Jul 8 10:21:38 2019 (r349832) @@ -39,16 +39,12 @@ #include typedef struct enc_element { - uint32_t - enctype : 8, /* enclosure type */ - subenclosure : 8, /* subenclosure id */ - svalid : 1, /* enclosure information valid */ - overall_status_elem: 1,/* - * This object represents generic - * status about all objects of this - * type. - */ - priv : 14; /* private data, per object */ + uint8_t elm_idx; /* index of element */ + uint8_t elm_type; /* element type */ + uint8_t subenclosure; /* subenclosure id */ + uint8_t type_elm_idx; /* index of element within type */ + uint8_t svalid; /* enclosure information valid */ + uint16_t priv; /* private data, per object */ uint8_t encstat[4]; /* state && stats */ uint8_t *physical_path; /* Device physical path data. */ u_int physical_path_len; /* Length of device path data. */ Modified: stable/12/sys/cam/scsi/scsi_enc_safte.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_enc_safte.c Mon Jul 8 10:19:49 2019 (r349831) +++ stable/12/sys/cam/scsi/scsi_enc_safte.c Mon Jul 8 10:21:38 2019 (r349832) @@ -301,21 +301,21 @@ safte_process_config(enc_softc_t *enc, struct enc_fsm_ * in later fetches of status. */ for (i = 0; i < cfg->Nfans; i++) - enc->enc_cache.elm_map[r++].enctype = ELMTYP_FAN; + enc->enc_cache.elm_map[r++].elm_type = ELMTYP_FAN; cfg->pwroff = (uint8_t) r; for (i = 0; i < cfg->Npwr; i++) - enc->enc_cache.elm_map[r++].enctype = ELMTYP_POWER; + enc->enc_cache.elm_map[r++].elm_type = ELMTYP_POWER; for (i = 0; i < cfg->DoorLock; i++) - enc->enc_cache.elm_map[r++].enctype = ELMTYP_DOORLOCK; + enc->enc_cache.elm_map[r++].elm_type = ELMTYP_DOORLOCK; if (cfg->Nspkrs > 0) - enc->enc_cache.elm_map[r++].enctype = ELMTYP_ALARM; + enc->enc_cache.elm_map[r++].elm_type = ELMTYP_ALARM; for (i = 0; i < cfg->Ntherm; i++) - enc->enc_cache.elm_map[r++].enctype = ELMTYP_THERM; + enc->enc_cache.elm_map[r++].elm_type = ELMTYP_THERM; for (i = 0; i <= cfg->Ntstats; i++) - enc->enc_cache.elm_map[r++].enctype = ELMTYP_THERM; + enc->enc_cache.elm_map[r++].elm_type = ELMTYP_THERM; cfg->slotoff = (uint8_t) r; for (i = 0; i < cfg->Nslots; i++) - enc->enc_cache.elm_map[r++].enctype = + enc->enc_cache.elm_map[r++].elm_type = emulate_array_devices ? ELMTYP_ARRAY_DEV : ELMTYP_DEVICE; @@ -505,7 +505,7 @@ safte_process_status(enc_softc_t *enc, struct enc_fsm_ */ for (i = 0; i < cfg->Nslots; i++) { SAFT_BAIL(r, xfer_len); - if (cache->elm_map[cfg->slotoff + i].enctype == ELMTYP_DEVICE) + if (cache->elm_map[cfg->slotoff + i].elm_type == ELMTYP_DEVICE) cache->elm_map[cfg->slotoff + i].encstat[1] = buf[r]; r++; } @@ -678,7 +678,7 @@ safte_process_slotstatus(enc_softc_t *enc, struct enc_ oid = cfg->slotoff; for (r = i = 0; i < cfg->Nslots; i++, r += 4) { SAFT_BAIL(r+3, xfer_len); - if (cache->elm_map[oid].enctype == ELMTYP_ARRAY_DEV) + if (cache->elm_map[oid].elm_type == ELMTYP_ARRAY_DEV) cache->elm_map[oid].encstat[1] = 0; cache->elm_map[oid].encstat[2] &= SESCTL_RQSID; cache->elm_map[oid].encstat[3] = 0; @@ -705,7 +705,7 @@ safte_process_slotstatus(enc_softc_t *enc, struct enc_ cache->elm_map[oid].encstat[3] |= SESCTL_RQSFLT; if (buf[r+0] & 0x40) cache->elm_map[oid].encstat[0] |= SESCTL_PRDFAIL; - if (cache->elm_map[oid].enctype == ELMTYP_ARRAY_DEV) { + if (cache->elm_map[oid].elm_type == ELMTYP_ARRAY_DEV) { if (buf[r+0] & 0x01) cache->elm_map[oid].encstat[1] |= 0x80; if (buf[r+0] & 0x04) @@ -771,7 +771,7 @@ safte_fill_control_request(enc_softc_t *enc, struct en } else { ep = &enc->enc_cache.elm_map[idx]; - switch (ep->enctype) { + switch (ep->elm_type) { case ELMTYP_DEVICE: case ELMTYP_ARRAY_DEV: switch (cfg->current_request_stage) { @@ -781,7 +781,7 @@ safte_fill_control_request(enc_softc_t *enc, struct en ep->priv |= 0x40; if (req->elm_stat[3] & SESCTL_RQSFLT) ep->priv |= 0x02; - if (ep->enctype == ELMTYP_ARRAY_DEV) { + if (ep->elm_type == ELMTYP_ARRAY_DEV) { if (req->elm_stat[1] & 0x01) ep->priv |= 0x200; if (req->elm_stat[1] & 0x02) @@ -970,7 +970,7 @@ safte_process_control_request(enc_softc_t *enc, struct if (idx == SES_SETSTATUS_ENC_IDX) type = -1; else - type = enc->enc_cache.elm_map[idx].enctype; + type = enc->enc_cache.elm_map[idx].elm_type; if (type == ELMTYP_DEVICE || type == ELMTYP_ARRAY_DEV) enc_update_request(enc, SAFTE_UPDATE_READSLOTSTATUS); else Modified: stable/12/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_enc_ses.c Mon Jul 8 10:19:49 2019 (r349831) +++ stable/12/sys/cam/scsi/scsi_enc_ses.c Mon Jul 8 10:21:38 2019 (r349832) @@ -102,6 +102,7 @@ typedef struct ses_addl_status { union { union ses_fcobj_hdr *fc; union ses_elm_sas_hdr *sas; + struct ses_elm_ata_hdr *ata; } proto_hdr; union ses_addl_data proto_data; /* array sizes stored in header */ } ses_add_status_t; @@ -825,14 +826,6 @@ ses_devids_iter(enc_softc_t *enc, enc_element_t *elm, elmpriv = elm->elm_private; addl = &(elmpriv->addl); - /* - * Don't assume this object has additional status information, or - * that it is a SAS device, or that it is a device slot device. - */ - if (addl->hdr == NULL || addl->proto_hdr.sas == NULL - || addl->proto_data.sasdev_phys == NULL) - return; - devid_record_size = SVPD_DEVICE_ID_DESC_HDR_LEN + sizeof(struct scsi_vpd_id_naa_ieee_reg); for (i = 0; i < addl->proto_hdr.sas->base_hdr.num_phys; i++) { @@ -950,11 +943,40 @@ static void ses_paths_iter(enc_softc_t *enc, enc_element_t *elm, ses_path_callback_t *callback, void *callback_arg) { - ses_path_iter_args_t args; + ses_element_t *elmpriv; + struct ses_addl_status *addl; - args.callback = callback; - args.callback_arg = callback_arg; - ses_devids_iter(enc, elm, ses_path_iter_devid_callback, &args); + elmpriv = elm->elm_private; + addl = &(elmpriv->addl); + + if (addl->hdr == NULL) + return; + + if (addl->proto_hdr.sas != NULL && + addl->proto_data.sasdev_phys != NULL) { + ses_path_iter_args_t args; + + args.callback = callback; + args.callback_arg = callback_arg; + ses_devids_iter(enc, elm, ses_path_iter_devid_callback, &args); + } else if (addl->proto_hdr.ata != NULL) { + struct cam_path *path; + struct ccb_getdev cgd; + + if (xpt_create_path(&path, /*periph*/NULL, + scsi_4btoul(addl->proto_hdr.ata->bus), + scsi_4btoul(addl->proto_hdr.ata->target), 0) + != CAM_REQ_CMP) + return; + + xpt_setup_ccb(&cgd.ccb_h, path, CAM_PRIORITY_NORMAL); + cgd.ccb_h.func_code = XPT_GDEV_TYPE; + xpt_action((union ccb *)&cgd); + if (cgd.ccb_h.status == CAM_REQ_CMP) + callback(enc, elm, path, callback_arg); + + xpt_free_path(path); + } } /** @@ -1059,6 +1081,10 @@ ses_set_physpath(enc_softc_t *enc, enc_element_t *elm, ret = EIO; devid = NULL; + elmpriv = elm->elm_private; + if (elmpriv->addl.hdr == NULL) + goto out; + /* * Assemble the components of the physical path starting with * the device ID of the enclosure itself. @@ -1091,7 +1117,6 @@ ses_set_physpath(enc_softc_t *enc, enc_element_t *elm, scsi_8btou64(idd->identifier), iter->type_index, iter->type_element_index); /* Append the element descriptor if one exists */ - elmpriv = elm->elm_private; if (elmpriv->descr != NULL && elmpriv->descr_len > 0) { sbuf_cat(&sb, "/elmdesc@"); for (i = 0, c = elmpriv->descr; i < elmpriv->descr_len; @@ -1457,9 +1482,10 @@ ses_process_config(enc_softc_t *enc, struct enc_fsm_st iter.global_element_index, iter.type_index, nelm, iter.type_element_index); thdr = ses_cache->ses_types[iter.type_index].hdr; + element->elm_idx = iter.global_element_index; + element->elm_type = thdr->etype_elm_type; element->subenclosure = thdr->etype_subenc; - element->enctype = thdr->etype_elm_type; - element->overall_status_elem = iter.type_element_index == 0; + element->type_elm_idx = iter.type_element_index; element->elm_private = malloc(sizeof(ses_element_t), M_SCSIENC, M_WAITOK|M_ZERO); ENC_DLOG(enc, "%s: creating elmpriv %d(%d,%d) subenc %d " @@ -1663,6 +1689,8 @@ static int ses_get_elm_addlstatus_fc(enc_softc_t *, en uint8_t *, int); static int ses_get_elm_addlstatus_sas(enc_softc_t *, enc_cache_t *, uint8_t *, int, int, int, int); +static int ses_get_elm_addlstatus_ata(enc_softc_t *, enc_cache_t *, uint8_t *, + int, int, int, int); /** * \brief Parse the additional status element data for each object. @@ -1818,7 +1846,6 @@ badindex: } } elmpriv = element->elm_private; - elmpriv->addl.hdr = elm_hdr; ENC_DLOG(enc, "%s: global element index=%d, type index=%d " "type element index=%d, offset=0x%x, " "byte0=0x%x, length=0x%x\n", __func__, @@ -1842,6 +1869,7 @@ badindex: offset += elm_hdr->length; continue; } + elmpriv->addl.hdr = elm_hdr; /* Advance to the protocol data, skipping eip bytes if needed */ offset += (eip * SES_EIP_HDR_EXTRA_LEN); @@ -1865,6 +1893,13 @@ badindex: eip, iter.type_index, iter.global_element_index); break; + case SPSP_PROTO_ATA: + ses_get_elm_addlstatus_ata(enc, enc_cache, + &buf[offset], + proto_info_len, + eip, iter.type_index, + iter.global_element_index); + break; default: ENC_VLOG(enc, "Element %d: Unknown Additional Element " "Protocol 0x%x\n", iter.global_element_index, @@ -2193,18 +2228,16 @@ ses_get_elm_addlstatus_fc(enc_softc_t *enc, enc_cache_ } #define SES_PRINT_PORTS(p, type) do { \ - sbuf_printf(sbp, " %s(", type); \ - if (((p) & SES_SASOBJ_DEV_PHY_PROTOMASK) == 0) \ - sbuf_printf(sbp, " None"); \ - else { \ + if (((p) & SES_SASOBJ_DEV_PHY_PROTOMASK) != 0) { \ + sbuf_printf(sbp, " %s (", type); \ if ((p) & SES_SASOBJ_DEV_PHY_SMP) \ sbuf_printf(sbp, " SMP"); \ if ((p) & SES_SASOBJ_DEV_PHY_STP) \ sbuf_printf(sbp, " STP"); \ if ((p) & SES_SASOBJ_DEV_PHY_SSP) \ sbuf_printf(sbp, " SSP"); \ + sbuf_printf(sbp, " )"); \ } \ - sbuf_printf(sbp, " )"); \ } while(0) /** @@ -2214,11 +2247,10 @@ ses_get_elm_addlstatus_fc(enc_softc_t *enc, enc_cache_ * \param sesname SES device name associated with the object. * \param sbp Sbuf to print to. * \param obj The object to print the data for. - * \param periph_name Peripheral string associated with the object. */ static void ses_print_addl_data_sas_type0(char *sesname, struct sbuf *sbp, - enc_element_t *obj, char *periph_name) + enc_element_t *obj) { int i; ses_element_t *elmpriv; @@ -2227,16 +2259,12 @@ ses_print_addl_data_sas_type0(char *sesname, struct sb elmpriv = obj->elm_private; addl = &(elmpriv->addl); - if (addl->proto_hdr.sas == NULL) - return; - sbuf_printf(sbp, "%s: %s: SAS Device Slot Element:", - sesname, periph_name); - sbuf_printf(sbp, " %d Phys", addl->proto_hdr.sas->base_hdr.num_phys); + sbuf_printf(sbp, ", SAS Slot: %d%s phys", + addl->proto_hdr.sas->base_hdr.num_phys, + ses_elm_sas_type0_not_all_phys(addl->proto_hdr.sas) ? "+" : ""); if (ses_elm_addlstatus_eip(addl->hdr)) - sbuf_printf(sbp, " at Slot %d", + sbuf_printf(sbp, " at slot %d", addl->proto_hdr.sas->type0_eip.dev_slot_num); - if (ses_elm_sas_type0_not_all_phys(addl->proto_hdr.sas)) - sbuf_printf(sbp, ", Not All Phys"); sbuf_printf(sbp, "\n"); if (addl->proto_data.sasdev_phys == NULL) return; @@ -2247,9 +2275,8 @@ ses_print_addl_data_sas_type0(char *sesname, struct sb /* Spec says all other fields are specific values */ sbuf_printf(sbp, " SATA device\n"); else { - sbuf_printf(sbp, " SAS device type %d id %d\n", + sbuf_printf(sbp, " SAS device type %d phy %d", ses_elm_sas_dev_phy_dev_type(phy), phy->phy_id); - sbuf_printf(sbp, "%s: phy %d: protocols:", sesname, i); SES_PRINT_PORTS(phy->initiator_ports, "Initiator"); SES_PRINT_PORTS(phy->target_ports, "Target"); sbuf_printf(sbp, "\n"); @@ -2263,32 +2290,16 @@ ses_print_addl_data_sas_type0(char *sesname, struct sb #undef SES_PRINT_PORTS /** - * \brief Report whether a given enclosure object is an expander. - * - * \param enc SES softc associated with object. - * \param obj Enclosure object to report for. - * - * \return 1 if true, 0 otherwise. - */ -static int -ses_obj_is_expander(enc_softc_t *enc, enc_element_t *obj) -{ - return (obj->enctype == ELMTYP_SAS_EXP); -} - -/** * \brief Print the additional element status data for this object, for SAS * type 1 objects. See SES2 r20 Sections 6.1.13.3.3 and 6.1.13.3.4. * - * \param enc SES enclosure, needed for type identification. * \param sesname SES device name associated with the object. * \param sbp Sbuf to print to. * \param obj The object to print the data for. - * \param periph_name Peripheral string associated with the object. */ static void -ses_print_addl_data_sas_type1(enc_softc_t *enc, char *sesname, - struct sbuf *sbp, enc_element_t *obj, char *periph_name) +ses_print_addl_data_sas_type1(char *sesname, struct sbuf *sbp, + enc_element_t *obj) { int i, num_phys; ses_element_t *elmpriv; @@ -2298,12 +2309,10 @@ ses_print_addl_data_sas_type1(enc_softc_t *enc, char * elmpriv = obj->elm_private; addl = &(elmpriv->addl); - if (addl->proto_hdr.sas == NULL) - return; - sbuf_printf(sbp, "%s: %s: SAS ", sesname, periph_name); - if (ses_obj_is_expander(enc, obj)) { + sbuf_printf(sbp, ", SAS "); + if (obj->elm_type == ELMTYP_SAS_EXP) { num_phys = addl->proto_hdr.sas->base_hdr.num_phys; - sbuf_printf(sbp, "Expander: %d Phys", num_phys); + sbuf_printf(sbp, "Expander: %d phys", num_phys); if (addl->proto_data.sasexp_phys == NULL) return; for (i = 0;i < num_phys;i++) { @@ -2314,7 +2323,7 @@ ses_print_addl_data_sas_type1(enc_softc_t *enc, char * } } else { num_phys = addl->proto_hdr.sas->base_hdr.num_phys; - sbuf_printf(sbp, "Port: %d Phys", num_phys); + sbuf_printf(sbp, "Port: %d phys", num_phys); if (addl->proto_data.sasport_phys == NULL) return; for (i = 0;i < num_phys;i++) { @@ -2330,6 +2339,24 @@ ses_print_addl_data_sas_type1(enc_softc_t *enc, char * } /** + * \brief Print the additional element status data for this object, for + * ATA objects. + * + * \param sbp Sbuf to print to. + * \param obj The object to print the data for. + */ +static void +ses_print_addl_data_ata(struct sbuf *sbp, enc_element_t *obj) +{ + ses_element_t *elmpriv = obj->elm_private; + struct ses_addl_status *addl = &elmpriv->addl; + struct ses_elm_ata_hdr *ata = addl->proto_hdr.ata; + + sbuf_printf(sbp, ", SATA Slot: scbus%d target %d\n", + scsi_4btoul(ata->bus), scsi_4btoul(ata->target)); +} + +/** * \brief Print the additional element status data for this object. * * \param enc SES softc associated with the object. @@ -2360,27 +2387,45 @@ ses_print_addl_data(enc_softc_t *enc, enc_element_t *o sbuf_printf(&sesname, "%s%d", enc->periph->periph_name, enc->periph->unit_number); sbuf_finish(&sesname); + sbuf_printf(&out, "%s: %s in ", sbuf_data(&sesname), sbuf_data(&name)); if (elmpriv->descr != NULL) - sbuf_printf(&out, "%s: %s: Element descriptor: '%s'\n", - sbuf_data(&sesname), sbuf_data(&name), elmpriv->descr); + sbuf_printf(&out, "'%s'", elmpriv->descr); + else { + if (obj->elm_type <= ELMTYP_LAST) + sbuf_cat(&out, elm_type_names[obj->elm_type]); + else + sbuf_printf(&out, "", obj->elm_type); + sbuf_printf(&out, " %d", obj->type_elm_idx); + if (obj->subenclosure != 0) + sbuf_printf(&out, " of subenc %d", obj->subenclosure); + } switch(ses_elm_addlstatus_proto(addl->hdr)) { + case SPSP_PROTO_FC: + goto noaddl; /* stubbed for now */ case SPSP_PROTO_SAS: + if (addl->proto_hdr.sas == NULL) + goto noaddl; switch(ses_elm_sas_descr_type(addl->proto_hdr.sas)) { case SES_SASOBJ_TYPE_SLOT: ses_print_addl_data_sas_type0(sbuf_data(&sesname), - &out, obj, sbuf_data(&name)); + &out, obj); break; case SES_SASOBJ_TYPE_OTHER: - ses_print_addl_data_sas_type1(enc, sbuf_data(&sesname), - &out, obj, sbuf_data(&name)); + ses_print_addl_data_sas_type1(sbuf_data(&sesname), + &out, obj); break; default: - break; + goto noaddl; } break; - case SPSP_PROTO_FC: /* stubbed for now */ + case SPSP_PROTO_ATA: + if (addl->proto_hdr.ata == NULL) + goto noaddl; + ses_print_addl_data_ata(&out, obj); break; default: +noaddl: + sbuf_cat(&out, "\n"); break; } sbuf_finish(&out); @@ -2485,7 +2530,7 @@ ses_get_elm_addlstatus_sas_type1(enc_softc_t *enc, enc goto out; /* Process expanders differently from other type1 cases */ - if (ses_obj_is_expander(enc, obj)) { + if (obj->elm_type == ELMTYP_SAS_EXP) { offset += sizeof(struct ses_elm_sas_type1_expander_hdr); physz = addl->proto_hdr.sas->base_hdr.num_phys * sizeof(struct ses_elm_sas_expander_phy); @@ -2588,6 +2633,53 @@ ses_get_elm_addlstatus_sas(enc_softc_t *enc, enc_cache err = ENODEV; break; } + +out: + return (err); +} + +/** + * \brief Update the softc with the additional element status data for this + * object, for ATA objects. + * + * \param enc SES softc to be updated. + * \param buf The additional element status response buffer. + * \param bufsiz Size of the response buffer. + * \param eip The EIP bit value. + * \param tidx Type index for this object. + * \param nobj Number of objects attached to the SES softc. + * + * \return 0 on success, errno otherwise. + */ +static int +ses_get_elm_addlstatus_ata(enc_softc_t *enc, enc_cache_t *enc_cache, + uint8_t *buf, int bufsiz, int eip, int tidx, + int nobj) +{ + int err; + ses_cache_t *ses_cache; + + if (bufsiz < sizeof(struct ses_elm_ata_hdr)) { + err = EIO; + goto out; + } + + ses_cache = enc_cache->private; + switch(ses_cache->ses_types[tidx].hdr->etype_elm_type) { + case ELMTYP_DEVICE: + case ELMTYP_ARRAY_DEV: + break; + default: + ENC_VLOG(enc, "Element %d has Additional Status, " + "invalid for SES element type 0x%x\n", nobj, + ses_cache->ses_types[tidx].hdr->etype_elm_type); + err = ENODEV; + goto out; + } + + ((ses_element_t *)enc_cache->elm_map[nobj].elm_private) + ->addl.proto_hdr.ata = (struct ses_elm_ata_hdr *)buf; + err = 0; out: return (err); Modified: stable/12/sys/cam/scsi/scsi_ses.h ============================================================================== --- stable/12/sys/cam/scsi/scsi_ses.h Mon Jul 8 10:19:49 2019 (r349831) +++ stable/12/sys/cam/scsi/scsi_ses.h Mon Jul 8 10:21:38 2019 (r349832) @@ -2181,15 +2181,27 @@ struct ses_status_page_hdr { #define SESCTL_DISABLE 0x20 #define SESCTL_RSTSWAP 0x10 - -/* Control bits, Device Elements, byte 2 */ -#define SESCTL_DRVLCK 0x40 /* "DO NOT REMOVE" */ +/* Control bits, Array Device Slot Elements, byte 1 */ +#define SESCTL_RQSOK 0x80 /* RQST OK */ +#define SESCTL_RQSRSV 0x40 /* RQST RSVD DEVICE */ +#define SESCTL_RQSSPR 0x20 /* RQST HOT SPARE */ +#define SESCTL_RQSCCH 0x10 /* RQST CONS CHECK */ +#define SESCTL_RQSCRA 0x08 /* RQST IN CRIT ARRAY */ +#define SESCTL_RQSFAA 0x04 /* RQST IN FAILED ARRAY */ +#define SESCTL_RQSRR 0x02 /* RQST REBUI/REMAP */ +#define SESCTL_RQSRRA 0x01 /* RQST R/R ABORT */ +/* Control bits, [Array] Device Slot Elements, byte 2 */ +#define SESCTL_RQSACT 0x80 /* RQST ACTIVE */ +#define SESCTL_DRVLCK 0x40 /* DO NOT REMOVE */ +#define SESCTL_RQSMSN 0x10 /* RQST MISSING */ #define SESCTL_RQSINS 0x08 /* RQST INSERT */ #define SESCTL_RQSRMV 0x04 /* RQST REMOVE */ #define SESCTL_RQSID 0x02 /* RQST IDENT */ -/* Control bits, Device Elements, byte 3 */ +/* Control bits, [Array] Device Slot Elements, byte 3 */ #define SESCTL_RQSFLT 0x20 /* RQST FAULT */ #define SESCTL_DEVOFF 0x10 /* DEVICE OFF */ +#define SESCTL_ENBYPA 0x08 /* ENABLE BYP A */ +#define SESCTL_ENBYPB 0x04 /* ENABLE BYP B */ /* Control bits, Generic, byte 3 */ #define SESCTL_RQSTFAIL 0x40 @@ -2398,6 +2410,17 @@ union ses_elm_sas_hdr { }; int ses_elm_sas_type0_not_all_phys(union ses_elm_sas_hdr *); int ses_elm_sas_descr_type(union ses_elm_sas_hdr *); + +/* + * This structure for SPSP_PROTO_ATA is not defined by SES specs, + * but purely my own design to make AHCI EM interoperate with SES. + * Since no other software I know can talk to SEMB, and we do not + * expose this this outside, it should be safe to do what we want. + */ +struct ses_elm_ata_hdr { + uint8_t bus[4]; + uint8_t target[4]; +}; struct ses_elm_addlstatus_base_hdr { uint8_t byte0; Modified: stable/12/sys/dev/ahci/ahci.c ============================================================================== --- stable/12/sys/dev/ahci/ahci.c Mon Jul 8 10:19:49 2019 (r349831) +++ stable/12/sys/dev/ahci/ahci.c Mon Jul 8 10:21:38 2019 (r349832) @@ -186,6 +186,7 @@ ahci_attach(device_t dev) ctlr->ccc = 0; resource_int_value(device_get_name(dev), device_get_unit(dev), "ccc", &ctlr->ccc); + mtx_init(&ctlr->ch_mtx, "AHCI channels lock", NULL, MTX_DEF); /* Setup our own memory management for channels. */ ctlr->sc_iomem.rm_start = rman_get_start(ctlr->r_mem); @@ -379,6 +380,7 @@ ahci_detach(device_t dev) /* Free memory. */ rman_fini(&ctlr->sc_iomem); ahci_free_mem(dev); + mtx_destroy(&ctlr->ch_mtx); return (0); } @@ -666,6 +668,50 @@ ahci_get_dma_tag(device_t dev, device_t child) return (ctlr->dma_tag); } +void +ahci_attached(device_t dev, struct ahci_channel *ch) +{ + struct ahci_controller *ctlr = device_get_softc(dev); + + mtx_lock(&ctlr->ch_mtx); + ctlr->ch[ch->unit] = ch; + mtx_unlock(&ctlr->ch_mtx); +} + +void +ahci_detached(device_t dev, struct ahci_channel *ch) +{ + struct ahci_controller *ctlr = device_get_softc(dev); + + mtx_lock(&ctlr->ch_mtx); + mtx_lock(&ch->mtx); + ctlr->ch[ch->unit] = NULL; + mtx_unlock(&ch->mtx); + mtx_unlock(&ctlr->ch_mtx); +} + +struct ahci_channel * +ahci_getch(device_t dev, int n) +{ + struct ahci_controller *ctlr = device_get_softc(dev); + struct ahci_channel *ch; + + KASSERT(n >= 0 && n < AHCI_MAX_PORTS, ("Bad channel number %d", n)); + mtx_lock(&ctlr->ch_mtx); + ch = ctlr->ch[n]; + if (ch != NULL) + mtx_lock(&ch->mtx); + mtx_unlock(&ctlr->ch_mtx); + return (ch); +} + +void +ahci_putch(struct ahci_channel *ch) +{ + + mtx_unlock(&ch->mtx); +} + static int ahci_ch_probe(device_t dev) { @@ -824,6 +870,7 @@ ahci_ch_attach(device_t dev) ahci_ch_pm, ch); } mtx_unlock(&ch->mtx); + ahci_attached(device_get_parent(dev), ch); ctx = device_get_sysctl_ctx(dev); tree = device_get_sysctl_tree(dev); SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "disable_phy", @@ -849,6 +896,7 @@ ahci_ch_detach(device_t dev) { struct ahci_channel *ch = device_get_softc(dev); + ahci_detached(device_get_parent(dev), ch); mtx_lock(&ch->mtx); xpt_async(AC_LOST_DEVICE, ch->path, NULL); /* Forget about reset. */ Modified: stable/12/sys/dev/ahci/ahci.h ============================================================================== --- stable/12/sys/dev/ahci/ahci.h Mon Jul 8 10:19:49 2019 (r349831) +++ stable/12/sys/dev/ahci/ahci.h Mon Jul 8 10:21:38 2019 (r349832) @@ -524,6 +524,8 @@ struct ahci_controller { } interrupt[AHCI_MAX_PORTS]; void (*ch_start)(struct ahci_channel *); int dma_coherent; /* DMA is cache-coherent */ + struct mtx ch_mtx; /* Lock for attached channels */ + struct ahci_channel *ch[AHCI_MAX_PORTS]; /* Attached channels */ }; enum ahci_err_type { @@ -653,6 +655,12 @@ bus_dma_tag_t ahci_get_dma_tag(device_t dev, device_t int ahci_ctlr_reset(device_t dev); int ahci_ctlr_setup(device_t dev); void ahci_free_mem(device_t dev); + +/* Functions to allow AHCI EM to access other channels. */ +void ahci_attached(device_t dev, struct ahci_channel *ch); +void ahci_detached(device_t dev, struct ahci_channel *ch); +struct ahci_channel * ahci_getch(device_t dev, int n); +void ahci_putch(struct ahci_channel *ch); extern devclass_t ahci_devclass; Modified: stable/12/sys/dev/ahci/ahciem.c ============================================================================== --- stable/12/sys/dev/ahci/ahciem.c Mon Jul 8 10:19:49 2019 (r349831) +++ stable/12/sys/dev/ahci/ahciem.c Mon Jul 8 10:21:38 2019 (r349832) @@ -294,14 +294,14 @@ ahci_em_setleds(device_t dev, int c) enc = device_get_softc(dev); val = 0; - if (enc->status[c][2] & 0x80) /* Activity */ + if (enc->status[c][2] & SESCTL_RQSACT) /* Activity */ val |= (1 << 0); - if (enc->status[c][2] & SESCTL_RQSID) /* Identification */ + if (enc->status[c][1] & SESCTL_RQSRR) /* Rebuild */ + val |= (1 << 6) | (1 << 3); + else if (enc->status[c][2] & SESCTL_RQSID) /* Identification */ val |= (1 << 3); else if (enc->status[c][3] & SESCTL_RQSFLT) /* Fault */ val |= (1 << 6); - else if (enc->status[c][1] & 0x02) /* Rebuild */ - val |= (1 << 6) | (1 << 3); timeout = 10000; while (ATA_INL(enc->r_memc, 0) & (AHCI_EM_TM | AHCI_EM_RST) && @@ -366,9 +366,12 @@ static void ahci_em_emulate_ses_on_led(device_t dev, union ccb *ccb) { struct ahci_enclosure *enc; + struct ahci_channel *ch; struct ses_status_page *page; struct ses_status_array_dev_slot *ads, *ads0; struct ses_elm_desc_hdr *elmd; + struct ses_elm_addlstatus_eip_hdr *elma; + struct ses_elm_ata_hdr *elmb; uint8_t *buf; int i; @@ -391,7 +394,7 @@ ahci_em_emulate_ses_on_led(device_t dev, union ccb *cc strncpy(&buf[3], device_get_nameunit(dev), 7); strncpy(&buf[10], "AHCI ", SID_VENDOR_SIZE); strncpy(&buf[18], "SGPIO Enclosure ", SID_PRODUCT_SIZE); - strncpy(&buf[34], "1.00", SID_REVISION_SIZE); + strncpy(&buf[34], "2.00", SID_REVISION_SIZE); strncpy(&buf[39], "0001", 4); strncpy(&buf[43], "S-E-S ", 6); strncpy(&buf[49], "2.00", 4); @@ -403,14 +406,15 @@ ahci_em_emulate_ses_on_led(device_t dev, union ccb *cc page = (struct ses_status_page *)buf; if (ccb->ataio.cmd.lba_low == 0x02 && ccb->ataio.cmd.features == 0x00 && - ccb->ataio.cmd.sector_count >= 2) { + ccb->ataio.cmd.sector_count >= 3) { bzero(buf, ccb->ataio.dxfer_len); page->hdr.page_code = 0; - scsi_ulto2b(4, page->hdr.length); - buf[4] = 0; - buf[5] = 1; - buf[6] = 2; - buf[7] = 7; + scsi_ulto2b(5, page->hdr.length); + buf[4] = 0x00; + buf[5] = 0x01; + buf[6] = 0x02; + buf[7] = 0x07; + buf[8] = 0x0a; ccb->ccb_h.status = CAM_REQ_CMP; goto out; } @@ -418,26 +422,30 @@ ahci_em_emulate_ses_on_led(device_t dev, union ccb *cc /* SEMB RECEIVE DIAGNOSTIC RESULT (1) */ if (ccb->ataio.cmd.lba_low == 0x02 && ccb->ataio.cmd.features == 0x01 && - ccb->ataio.cmd.sector_count >= 13) { + ccb->ataio.cmd.sector_count >= 16) { struct ses_enc_desc *ed; struct ses_elm_type_desc *td; bzero(buf, ccb->ataio.dxfer_len); page->hdr.page_code = 0x01; - scsi_ulto2b(4 + 4 + 36 + 4, page->hdr.length); + scsi_ulto2b(4 + sizeof(*ed) + sizeof(*td) + 11, + page->hdr.length); ed = (struct ses_enc_desc *)&buf[8]; ed->byte0 = 0x11; ed->subenc_id = 0; ed->num_types = 1; ed->length = 36; + ed->logical_id[0] = 0x30; /* NAA Locally Assigned. */ + strncpy(&ed->logical_id[1], device_get_nameunit(dev), 7); strncpy(ed->vendor_id, "AHCI ", SID_VENDOR_SIZE); strncpy(ed->product_id, "SGPIO Enclosure ", SID_PRODUCT_SIZE); - strncpy(ed->product_rev, " ", SID_REVISION_SIZE); + strncpy(ed->product_rev, "2.00", SID_REVISION_SIZE); td = (struct ses_elm_type_desc *)ses_enc_desc_next(ed); td->etype_elm_type = 0x17; td->etype_maxelt = enc->channels; td->etype_subenc = 0; - td->etype_txt_len = 0; + td->etype_txt_len = 11; + snprintf((char *)(td + 1), 12, "Drive Slots"); ccb->ccb_h.status = CAM_REQ_CMP; goto out; } @@ -453,10 +461,22 @@ ahci_em_emulate_ses_on_led(device_t dev, union ccb *cc for (i = 0; i < enc->channels; i++) { ads = &page->elements[i + 1].array_dev_slot; memcpy(ads, enc->status[i], 4); - ads->common.bytes[0] |= - (enc->ichannels & (1 << i)) ? - SES_OBJSTAT_UNKNOWN : - SES_OBJSTAT_NOTINSTALLED; + ch = ahci_getch(device_get_parent(dev), i); + if (ch == NULL) { + ads->common.bytes[0] |= SES_OBJSTAT_UNKNOWN; + continue; + } + if (ch->pm_present) + ads->common.bytes[0] |= SES_OBJSTAT_UNKNOWN; + else if (ch->devices) + ads->common.bytes[0] |= SES_OBJSTAT_OK; + else if (ch->disablephy) + ads->common.bytes[0] |= SES_OBJSTAT_NOTAVAIL; + else + ads->common.bytes[0] |= SES_OBJSTAT_NOTINSTALLED; + if (ch->disablephy) + ads->common.bytes[3] |= SESCTL_DEVOFF; + ahci_putch(ch); } ccb->ccb_h.status = CAM_REQ_CMP; goto out; @@ -471,21 +491,21 @@ ahci_em_emulate_ses_on_led(device_t dev, union ccb *cc ads = &page->elements[i + 1].array_dev_slot; if (ads->common.bytes[0] & SESCTL_CSEL) { enc->status[i][0] = 0; - enc->status[i][1] = - ads->bytes[0] & 0x02; - enc->status[i][2] = - ads->bytes[1] & (0x80 | SESCTL_RQSID); - enc->status[i][3] = - ads->bytes[2] & SESCTL_RQSFLT; + enc->status[i][1] = ads->bytes[0] & + SESCTL_RQSRR; + enc->status[i][2] = ads->bytes[1] & + (SESCTL_RQSACT | SESCTL_RQSID); + enc->status[i][3] = ads->bytes[2] & + SESCTL_RQSFLT; ahci_em_setleds(dev, i); } else if (ads0->common.bytes[0] & SESCTL_CSEL) { enc->status[i][0] = 0; - enc->status[i][1] = - ads0->bytes[0] & 0x02; - enc->status[i][2] = - ads0->bytes[1] & (0x80 | SESCTL_RQSID); - enc->status[i][3] = - ads0->bytes[2] & SESCTL_RQSFLT; + enc->status[i][1] = ads0->bytes[0] & + SESCTL_RQSRR; + enc->status[i][2] = ads0->bytes[1] & + (SESCTL_RQSACT | SESCTL_RQSID); + enc->status[i][3] = ads0->bytes[2] & + SESCTL_RQSFLT; ahci_em_setleds(dev, i); } } @@ -496,15 +516,48 @@ ahci_em_emulate_ses_on_led(device_t dev, union ccb *cc /* SEMB RECEIVE DIAGNOSTIC RESULT (7) */ if (ccb->ataio.cmd.lba_low == 0x02 && ccb->ataio.cmd.features == 0x07 && - ccb->ataio.cmd.sector_count >= (3 + 3 * enc->channels)) { + ccb->ataio.cmd.sector_count >= (6 + 3 * enc->channels)) { bzero(buf, ccb->ataio.dxfer_len); page->hdr.page_code = 0x07; - scsi_ulto2b(4 + 4 + 12 * enc->channels, + scsi_ulto2b(4 + 15 + 11 * enc->channels, page->hdr.length); + elmd = (struct ses_elm_desc_hdr *)&buf[8]; + scsi_ulto2b(11, elmd->length); + snprintf((char *)(elmd + 1), 12, "Drive Slots"); + for (i = 0; i < enc->channels; i++) { + elmd = (struct ses_elm_desc_hdr *)&buf[8 + 15 + 11 * i]; + scsi_ulto2b(7, elmd->length); + snprintf((char *)(elmd + 1), 8, "Slot %02d", i); + } + ccb->ccb_h.status = CAM_REQ_CMP; + goto out; + } + + /* SEMB RECEIVE DIAGNOSTIC RESULT (a) */ + if (ccb->ataio.cmd.lba_low == 0x02 && + ccb->ataio.cmd.features == 0x0a && + ccb->ataio.cmd.sector_count >= (2 + 3 * enc->channels)) { + bzero(buf, ccb->ataio.dxfer_len); + page->hdr.page_code = 0x0a; + scsi_ulto2b(4 + (sizeof(*elma) + sizeof(*elmb)) * enc->channels, page->hdr.length); for (i = 0; i < enc->channels; i++) { - elmd = (struct ses_elm_desc_hdr *)&buf[8 + 4 + 12 * i]; - scsi_ulto2b(8, elmd->length); - snprintf((char *)(elmd + 1), 9, "SLOT %03d", i); + elma = (struct ses_elm_addlstatus_eip_hdr *)&buf[ + 8 + (sizeof(*elma) + sizeof(*elmb)) * i]; + elma->base.byte0 = 0x10 | SPSP_PROTO_ATA; + elma->base.length = 2 + sizeof(*elmb); + elma->byte2 = 0x01; + elma->element_index = 1 + i; + ch = ahci_getch(device_get_parent(dev), i); + if (ch == NULL) { + elma->base.byte0 |= 0x80; + continue; + } + if (ch->devices == 0 || ch->pm_present) + elma->base.byte0 |= 0x80; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Jul 8 13:01:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2C6E15DE456; Mon, 8 Jul 2019 13:01:55 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D3956D87A; Mon, 8 Jul 2019 13:01:55 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2857718BB8; Mon, 8 Jul 2019 13:01:55 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68D1s6u045006; Mon, 8 Jul 2019 13:01:54 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68D1sXT045005; Mon, 8 Jul 2019 13:01:54 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <201907081301.x68D1sXT045005@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Mon, 8 Jul 2019 13:01:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349833 - head/sys/powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: head/sys/powerpc/aim X-SVN-Commit-Revision: 349833 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4D3956D87A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 13:01:55 -0000 Author: luporl Date: Mon Jul 8 13:01:54 2019 New Revision: 349833 URL: https://svnweb.freebsd.org/changeset/base/349833 Log: [PPC] Add missing SLB allocation KASSERT Although PPC SLB code doesn't handle allocation failures, which are rare, in most places it asserts that the pointer returned by uma_zalloc() is not NULL, making it easier to identify the failure and avoiding an invalid pointer dereference. This change simply adds a missing KASSERT in SLB code. Modified: head/sys/powerpc/aim/slb.c Modified: head/sys/powerpc/aim/slb.c ============================================================================== --- head/sys/powerpc/aim/slb.c Mon Jul 8 10:21:38 2019 (r349832) +++ head/sys/powerpc/aim/slb.c Mon Jul 8 13:01:54 2019 (r349833) @@ -416,6 +416,7 @@ slb_alloc_tree(void) struct slbtnode *root; root = uma_zalloc(slbt_zone, M_NOWAIT | M_ZERO); + KASSERT(root != NULL, ("unhandled NULL case")); root->ua_level = UAD_ROOT_LEVEL; return (root); From owner-svn-src-all@freebsd.org Mon Jul 8 13:46:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68E7A15DF184; Mon, 8 Jul 2019 13:46:27 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 002546F3CB; Mon, 8 Jul 2019 13:46:26 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C3947193B8; Mon, 8 Jul 2019 13:46:26 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68DkQuS068564; Mon, 8 Jul 2019 13:46:26 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68DkQFF068563; Mon, 8 Jul 2019 13:46:26 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201907081346.x68DkQFF068563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Mon, 8 Jul 2019 13:46:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349834 - head/sys/dev/vt X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: head/sys/dev/vt X-SVN-Commit-Revision: 349834 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 002546F3CB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 13:46:27 -0000 Author: vangyzen Date: Mon Jul 8 13:46:26 2019 New Revision: 349834 URL: https://svnweb.freebsd.org/changeset/base/349834 Log: Ignore kern.vt.splash_cpu without graphics When the system has no graphical console, such as bhyve in common configurations, ignore kern.vt.splash_cpu, instead of panicking on INVARIANTS kernels. Reviewed by: cem dumbbell MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D20877 Modified: head/sys/dev/vt/vt_cpulogos.c Modified: head/sys/dev/vt/vt_cpulogos.c ============================================================================== --- head/sys/dev/vt/vt_cpulogos.c Mon Jul 8 13:01:54 2019 (r349833) +++ head/sys/dev/vt/vt_cpulogos.c Mon Jul 8 13:46:26 2019 (r349834) @@ -229,9 +229,8 @@ vt_init_logos(void *dummy) return; VT_LOCK(vd); - KASSERT((vd->vd_flags & VDF_INITIALIZED) != 0, - ("vd %p not initialized", vd)); - + if ((vd->vd_flags & VDF_INITIALIZED) == 0) + goto out; if ((vd->vd_flags & (VDF_DEAD | VDF_TEXTMODE)) != 0) goto out; if (vd->vd_height <= vt_logo_sprite_height) From owner-svn-src-all@freebsd.org Mon Jul 8 14:04:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00FC215DF703; Mon, 8 Jul 2019 14:04:46 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8FBDF6FEB0; Mon, 8 Jul 2019 14:04:45 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B1EC19704; Mon, 8 Jul 2019 14:04:45 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68E4j7t080757; Mon, 8 Jul 2019 14:04:45 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68E4jsS080756; Mon, 8 Jul 2019 14:04:45 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201907081404.x68E4jsS080756@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 8 Jul 2019 14:04:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-release@freebsd.org Subject: svn commit: r349835 - release/11.3.0 X-SVN-Group: release X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: release/11.3.0 X-SVN-Commit-Revision: 349835 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8FBDF6FEB0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 14:04:46 -0000 Author: gjb Date: Mon Jul 8 14:04:44 2019 New Revision: 349835 URL: https://svnweb.freebsd.org/changeset/base/349835 Log: Tag releng/11.3@r349754 as release/11.3.0 (11.3-RELEASE). Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC (Netgate) Added: release/11.3.0/ - copied from r349754, releng/11.3/ From owner-svn-src-all@freebsd.org Mon Jul 8 14:34:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA92615E00EB; Mon, 8 Jul 2019 14:34:01 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 50B89713E5; Mon, 8 Jul 2019 14:34:01 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2BF2219C0B; Mon, 8 Jul 2019 14:34:01 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68EY1RC099775; Mon, 8 Jul 2019 14:34:01 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68EY0sr099774; Mon, 8 Jul 2019 14:34:00 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201907081434.x68EY0sr099774@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 8 Jul 2019 14:34:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349836 - stable/11/usr.sbin/i2c X-SVN-Group: stable-11 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/11/usr.sbin/i2c X-SVN-Commit-Revision: 349836 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 50B89713E5 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.948,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 14:34:02 -0000 Author: ian Date: Mon Jul 8 14:34:00 2019 New Revision: 349836 URL: https://svnweb.freebsd.org/changeset/base/349836 Log: MFC r348120: Add a new 'tr' (transfer) mode to i2c(8) to support more i2c controllers. Some i2c controller hardware does not provide a way to do individual START, REPEAT-START and STOP actions on the i2c bus. Instead, they can only do a complete transfer as a single operation. Typically they can do either START-data-STOP or START-data-REPEATSTART-data-STOP. In the i2c driver framework, this corresponds to the iicbus_transfer method. In the userland interface they are initiated with the I2CRDWR ioctl command. These changes add a new 'tr' mode which can be specified with the '-m' command line option. This mode should work on all hardware; when an i2c controller driver doesn't directly support the iicbus_transfer method, code in the i2c driver framework uses the lower-level START/REPEAT/STOP methods to implement the transfer. After this new mode has gotten some testing on various hardware, the 'tr' mode should probably become the new default mode. PR: 189914 Modified: stable/11/usr.sbin/i2c/i2c.8 stable/11/usr.sbin/i2c/i2c.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/i2c/i2c.8 ============================================================================== --- stable/11/usr.sbin/i2c/i2c.8 Mon Jul 8 14:04:44 2019 (r349835) +++ stable/11/usr.sbin/i2c/i2c.8 Mon Jul 8 14:34:00 2019 (r349836) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 23, 2009 +.Dd May 22, 2019 .Dt I2C 8 .Os .Sh NAME @@ -39,7 +39,7 @@ .Op Fl w Ar 0|8|16 .Op Fl o Ar offset .Op Fl c Ar count -.Op Fl m Ar ss|rs|no +.Op Fl m Ar tr|ss|rs|no .Op Fl b .Op Fl v .Nm @@ -72,10 +72,29 @@ number of bytes to transfer (dec). transfer direction: r - read, w - write. .It Fl f Ar device I2C bus to use (default is /dev/iic0). -.It Fl m Ar ss|rs|no +.It Fl m Ar tr|ss|rs|no addressing mode, i.e., I2C bus operations performed after the offset for the transfer has been written to the device and before the actual read/write -operation. rs - repeated start; ss - stop start; no - none. +operation. +.Bl -tag -compact -offset indent +.It Va tr +complete-transfer +.It Va ss +stop then start +.It Va rs +repeated start +.It Va no +none +.El +Some I2C bus hardware does not provide control over the individual start, +repeat-start, and stop operations. +Such hardware can only perform a complete transfer of the offset and the +data as a single operation. +The +.Va tr +mode creates control structures describing the transfer and submits them +to the driver as a single complete transaction. +This mode works on all types of I2C hardware. .It Fl n Ar skip_addr skip address - address(es) to be skipped during bus scan. There are two ways to specify addresses to ignore: by range 'a..b' or Modified: stable/11/usr.sbin/i2c/i2c.c ============================================================================== --- stable/11/usr.sbin/i2c/i2c.c Mon Jul 8 14:04:44 2019 (r349835) +++ stable/11/usr.sbin/i2c/i2c.c Mon Jul 8 14:34:00 2019 (r349836) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #define I2C_MODE_NONE 1 #define I2C_MODE_STOP_START 2 #define I2C_MODE_REPEATED_START 3 +#define I2C_MODE_TRANSFER 4 struct options { int width; @@ -73,7 +74,7 @@ usage(void) { fprintf(stderr, "usage: %s -a addr [-f device] [-d [r|w]] [-o offset] " - "[-w [0|8|16]] [-c count] [-m [ss|rs|no]] [-b] [-v]\n", + "[-w [0|8|16]] [-c count] [-m [tr|ss|rs|no]] [-b] [-v]\n", getprogname()); fprintf(stderr, " %s -s [-f device] [-n skip_addr] -v\n", getprogname()); @@ -297,24 +298,9 @@ static int i2c_write(char *dev, struct options i2c_opt, char *i2c_buf) { struct iiccmd cmd; - int ch, i, error, fd, bufsize; + int error, fd, bufsize; char *err_msg, *buf; - /* - * Read data to be written to the chip from stdin - */ - if (i2c_opt.verbose && !i2c_opt.binary) - fprintf(stderr, "Enter %u bytes of data: ", i2c_opt.count); - - for (i = 0; i < i2c_opt.count; i++) { - ch = getchar(); - if (ch == EOF) { - free(i2c_buf); - err(1, "not enough data, exiting\n"); - } - i2c_buf[i] = ch; - } - fd = open(dev, O_RDWR); if (fd == -1) { free(i2c_buf); @@ -558,6 +544,72 @@ err2: return (1); } +/* + * i2c_rdwr_transfer() - use I2CRDWR to conduct a complete i2c transfer. + * + * Some i2c hardware is unable to provide direct control over START, REPEAT- + * START, and STOP operations. Such hardware can only perform a complete + * START--STOP or START--REPEAT-START--STOP sequence as a + * single operation. The driver framework refers to this sequence as a + * "transfer" so we call it "transfer mode". We assemble either one or two + * iic_msg structures to describe the IO operations, and hand them off to the + * driver to be handled as a single transfer. + */ +static int +i2c_rdwr_transfer(char *dev, struct options i2c_opt, char *i2c_buf) +{ + struct iic_msg msgs[2]; + struct iic_rdwr_data xfer; + int fd, i; + union { + uint8_t buf[2]; + uint8_t off8; + uint16_t off16; + } off; + + i = 0; + if (i2c_opt.width > 0) { + msgs[i].flags = IIC_M_WR | IIC_M_NOSTOP; + msgs[i].slave = i2c_opt.addr; + msgs[i].buf = off.buf; + if (i2c_opt.width == 8) { + off.off8 = (uint8_t)i2c_opt.off; + msgs[i].len = 1; + } else { + off.off16 = (uint16_t)i2c_opt.off; + msgs[i].len = 2; + } + ++i; + } + + /* + * If the transfer direction is write and we did a write of the offset + * above, then we need to elide the start; this transfer is just more + * writing that follows the one started above. For a read, we always do + * a start; if we did an offset write above it'll be a repeat-start + * because of the NOSTOP flag used above. + */ + if (i2c_opt.dir == 'w') + msgs[i].flags = IIC_M_WR | (i > 0) ? IIC_M_NOSTART : 0; + else + msgs[i].flags = IIC_M_RD; + msgs[i].slave = i2c_opt.addr; + msgs[i].len = i2c_opt.count; + msgs[i].buf = i2c_buf; + ++i; + + xfer.msgs = msgs; + xfer.nmsgs = i; + + if ((fd = open(dev, O_RDWR)) == -1) + err(1, "open(%s) failed", dev); + if (ioctl(fd, I2CRDWR, &xfer) == -1 ) + err(1, "ioctl(I2CRDWR) failed"); + close(fd); + + return (0); +} + int main(int argc, char** argv) { @@ -620,6 +672,8 @@ main(int argc, char** argv) i2c_opt.mode = I2C_MODE_STOP_START; else if (!strcmp(optarg, "rs")) i2c_opt.mode = I2C_MODE_REPEATED_START; + else if (!strcmp(optarg, "tr")) + i2c_opt.mode = I2C_MODE_TRANSFER; else usage(); break; @@ -687,19 +741,33 @@ main(int argc, char** argv) if (i2c_buf == NULL) err(1, "data malloc"); + /* + * For a write, read the data to be written to the chip from stdin. + */ if (i2c_opt.dir == 'w') { - error = i2c_write(dev, i2c_opt, i2c_buf); - if (error) { - free(i2c_buf); - return (1); + if (i2c_opt.verbose && !i2c_opt.binary) + fprintf(stderr, "Enter %u bytes of data: ", + i2c_opt.count); + for (i = 0; i < i2c_opt.count; i++) { + ch = getchar(); + if (ch == EOF) { + free(i2c_buf); + err(1, "not enough data, exiting\n"); + } + i2c_buf[i] = ch; } } - if (i2c_opt.dir == 'r') { + + if (i2c_opt.mode == I2C_MODE_TRANSFER) + error = i2c_rdwr_transfer(dev, i2c_opt, i2c_buf); + else if (i2c_opt.dir == 'w') + error = i2c_write(dev, i2c_opt, i2c_buf); + else error = i2c_read(dev, i2c_opt, i2c_buf); - if (error) { - free(i2c_buf); - return (1); - } + + if (error != 0) { + free(i2c_buf); + return (1); } if (i2c_opt.verbose) From owner-svn-src-all@freebsd.org Mon Jul 8 15:41:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8CC3515E1ABE; Mon, 8 Jul 2019 15:41:41 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2E22774798; Mon, 8 Jul 2019 15:41:41 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07CD51A797; Mon, 8 Jul 2019 15:41:41 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68FfeA7039359; Mon, 8 Jul 2019 15:41:40 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68FfeRE039358; Mon, 8 Jul 2019 15:41:40 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907081541.x68FfeRE039358@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 8 Jul 2019 15:41:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349837 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: imp X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 349837 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2E22774798 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.954,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 15:41:41 -0000 Author: imp Date: Mon Jul 8 15:41:40 2019 New Revision: 349837 URL: https://svnweb.freebsd.org/changeset/base/349837 Log: Add note about upgrading from RELENG_10. When upgrading from RELENG_10, you need to upgrade to r346291 first (or older on RELENG_11, but we know r346291 works so recommend that) before upgrading to the latest on RELENG_11. RELENG_10's static_assert implementation is used during bootstrapping with the new compiler, and turns out to be incompatible with the new compiler. It's unclear if this can be fixed easily but in the mean time add a note here. Modified: stable/11/UPDATING Modified: stable/11/UPDATING ============================================================================== --- stable/11/UPDATING Mon Jul 8 14:34:00 2019 (r349836) +++ stable/11/UPDATING Mon Jul 8 15:41:40 2019 (r349837) @@ -25,8 +25,12 @@ from older version of current across the gcc/clang cut 20190416: Clang, llvm, lld, lldb, compiler-rt and libc++ have been upgraded to 8.0.0. Please see the 20141231 entry below for information about - prerequisites and upgrading, if you are not already using clang 3.5.0 - or higher. + prerequisites and upgrading, if you are not already using clang 3.5.0 or + higher. In addtion, if updating from RELENG_10, update to r346291 first, + then update to the most recent version of RELENG_11. The older + implementation of static_assert on RELENG_10 is incompatible with newer + compilers, so compilation errors will occur. The trick it uses to when + the builtin is unavailable now generates a fatal error. 20190226: geom_uzip(4) depends on the new module xz. If geom_uzip is statically From owner-svn-src-all@freebsd.org Mon Jul 8 17:09:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B184D15E3A75; Mon, 8 Jul 2019 17:09:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 54F7180056; Mon, 8 Jul 2019 17:09:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 9492C283A3; Mon, 8 Jul 2019 17:09:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r349763 - in stable/12/sys: kern sys To: Hans Petter Selasky , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <201907051226.x65CQUev056366@repo.freebsd.org> <97b7657c-53b9-f3d2-f31a-5e56343da71d@FreeBSD.org> <1bd91e31-920c-8857-f900-f66fb99f95d3@selasky.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <3f85335c-635e-c37f-f887-39c1c3e7858d@FreeBSD.org> Date: Mon, 8 Jul 2019 10:09:09 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <1bd91e31-920c-8857-f900-f66fb99f95d3@selasky.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 54F7180056 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.940,0]; ASN(0.00)[asn:11403, ipnet:96.47.64.0/20, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 17:09:12 -0000 On 7/5/19 3:02 PM, Hans Petter Selasky wrote: > On 2019-07-05 17:49, John Baldwin wrote: >> How does this not break the module KBI? You've removed epoch_*_KBI symbols used >> by existing modules, and you appear to have changed the size of the >> 'struct epoch_tracker' object that existing modules allocate on the stack and >> pass to functions in the kernel. Bumping __FreeBSD_version is not sufficient >> cover to break the KBI of widely used interfaces in stable (while we don't >> enforce KBI for all parts of the kernel, locking primitives is one of the things >> we can't break). > > Hi John, > > I'm aware there is a KPI breakage, but there is no API or functionality > breakage. > > The epoch(9) API is a very new API and I don't expect it to be widely > used for binary only modules. Do you have any examples otherwise? > > man 9 epoch > > clearly states: > > NOTES > The epoch kernel programming interface is under development and is > subject to change. > > epoch(9) is currently mostly used inside the kernel which has to be > re-compiled. > > If you think it is really important that epoch(9) will stay KBI > compliant I'll do the work to fix that. Despite the NOTES claim, given its wide use it is effectively part of the KBI just as much as 'struct mtx'. We also do not limit KBI to just binary-only modules. It makes it much harder to test for one thing. You should be able to take a 12.0 if_tap.ko and load it and use it with a stable/12 GENERIC kernel for example. I think you've broken that. -- John Baldwin From owner-svn-src-all@freebsd.org Mon Jul 8 18:29:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA55015E5F24; Mon, 8 Jul 2019 18:29:38 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FF2084360; Mon, 8 Jul 2019 18:29:38 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3EB741C2F6; Mon, 8 Jul 2019 18:29:38 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68ITcOp041918; Mon, 8 Jul 2019 18:29:38 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68ITc5N041917; Mon, 8 Jul 2019 18:29:38 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201907081829.x68ITc5N041917@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 8 Jul 2019 18:29:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349839 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 349839 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4FF2084360 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 18:29:38 -0000 Author: ian Date: Mon Jul 8 18:29:37 2019 New Revision: 349839 URL: https://svnweb.freebsd.org/changeset/base/349839 Log: Call device_unbusy() on the error exit path, because if iicbus_request_bus() returns an error, iicbus_release_bus() is not going to be called. Modified: head/sys/dev/iicbus/iiconf.c Modified: head/sys/dev/iicbus/iiconf.c ============================================================================== --- head/sys/dev/iicbus/iiconf.c Mon Jul 8 17:11:51 2019 (r349838) +++ head/sys/dev/iicbus/iiconf.c Mon Jul 8 18:29:37 2019 (r349839) @@ -150,6 +150,7 @@ iicbus_request_bus(device_t bus, device_t dev, int how sc->owner = NULL; sc->owncount = 0; wakeup_one(sc); + device_unbusy(dev); } } } From owner-svn-src-all@freebsd.org Mon Jul 8 18:56:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D27115E6A53; Mon, 8 Jul 2019 18:56:32 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B459985D5E; Mon, 8 Jul 2019 18:56:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 89C3D1C807; Mon, 8 Jul 2019 18:56:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68IuVxd058728; Mon, 8 Jul 2019 18:56:31 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68IuUP2058723; Mon, 8 Jul 2019 18:56:30 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907081856.x68IuUP2058723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 8 Jul 2019 18:56:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349840 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 349840 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B459985D5E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 18:56:32 -0000 Author: markj Date: Mon Jul 8 18:56:30 2019 New Revision: 349840 URL: https://svnweb.freebsd.org/changeset/base/349840 Log: Add a per-CPU page cache per VM free pool. Some workloads benefit from having a per-CPU cache for VM_FREEPOOL_DIRECT pages. Reviewed by: dougm, kib Discussed with: alc, jeff MFC after: 2 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20858 Modified: head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vm_pagequeue.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Mon Jul 8 18:29:37 2019 (r349839) +++ head/sys/vm/vm_page.c Mon Jul 8 18:56:30 2019 (r349840) @@ -192,21 +192,28 @@ static void vm_page_init_cache_zones(void *dummy __unused) { struct vm_domain *vmd; - int i; + struct vm_pgcache *pgcache; + int domain, pool; - for (i = 0; i < vm_ndomains; i++) { - vmd = VM_DOMAIN(i); + for (domain = 0; domain < vm_ndomains; domain++) { + vmd = VM_DOMAIN(domain); + /* - * Don't allow the page cache to take up more than .25% of + * Don't allow the page caches to take up more than .25% of * memory. */ - if (vmd->vmd_page_count / 400 < 256 * mp_ncpus) + if (vmd->vmd_page_count / 400 < 256 * mp_ncpus * VM_NFREEPOOL) continue; - vmd->vmd_pgcache = uma_zcache_create("vm pgcache", - sizeof(struct vm_page), NULL, NULL, NULL, NULL, - vm_page_import, vm_page_release, vmd, - UMA_ZONE_MAXBUCKET | UMA_ZONE_VM); - (void )uma_zone_set_maxcache(vmd->vmd_pgcache, 0); + for (pool = 0; pool < VM_NFREEPOOL; pool++) { + pgcache = &vmd->vmd_pgcache[pool]; + pgcache->domain = domain; + pgcache->pool = pool; + pgcache->zone = uma_zcache_create("vm pgcache", + sizeof(struct vm_page), NULL, NULL, NULL, NULL, + vm_page_import, vm_page_release, pgcache, + UMA_ZONE_MAXBUCKET | UMA_ZONE_VM); + (void)uma_zone_set_maxcache(pgcache->zone, 0); + } } } SYSINIT(vm_page2, SI_SUB_VM_CONF, SI_ORDER_ANY, vm_page_init_cache_zones, NULL); @@ -1797,7 +1804,7 @@ vm_page_alloc_domain_after(vm_object_t object, vm_pind { struct vm_domain *vmd; vm_page_t m; - int flags; + int flags, pool; KASSERT((object != NULL) == ((req & VM_ALLOC_NOOBJ) == 0) && (object != NULL || (req & VM_ALLOC_SBUSY) == 0) && @@ -1814,6 +1821,7 @@ vm_page_alloc_domain_after(vm_object_t object, vm_pind flags = 0; m = NULL; + pool = object != NULL ? VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT; again: #if VM_NRESERVLEVEL > 0 /* @@ -1828,8 +1836,8 @@ again: } #endif vmd = VM_DOMAIN(domain); - if (object != NULL && vmd->vmd_pgcache != NULL) { - m = uma_zalloc(vmd->vmd_pgcache, M_NOWAIT); + if (vmd->vmd_pgcache[pool].zone != NULL) { + m = uma_zalloc(vmd->vmd_pgcache[pool].zone, M_NOWAIT); if (m != NULL) { flags |= PG_PCPU_CACHE; goto found; @@ -1840,8 +1848,7 @@ again: * If not, allocate it from the free page queues. */ vm_domain_free_lock(vmd); - m = vm_phys_alloc_pages(domain, object != NULL ? - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); + m = vm_phys_alloc_pages(domain, pool, 0); vm_domain_free_unlock(vmd); if (m == NULL) { vm_domain_freecnt_inc(vmd, 1); @@ -2231,15 +2238,17 @@ static int vm_page_import(void *arg, void **store, int cnt, int domain, int flags) { struct vm_domain *vmd; + struct vm_pgcache *pgcache; int i; - vmd = arg; + pgcache = arg; + vmd = VM_DOMAIN(pgcache->domain); /* Only import if we can bring in a full bucket. */ if (cnt == 1 || !vm_domain_allocate(vmd, VM_ALLOC_NORMAL, cnt)) return (0); domain = vmd->vmd_domain; vm_domain_free_lock(vmd); - i = vm_phys_alloc_npages(domain, VM_FREEPOOL_DEFAULT, cnt, + i = vm_phys_alloc_npages(domain, pgcache->pool, cnt, (vm_page_t *)store); vm_domain_free_unlock(vmd); if (cnt != i) @@ -2252,10 +2261,12 @@ static void vm_page_release(void *arg, void **store, int cnt) { struct vm_domain *vmd; + struct vm_pgcache *pgcache; vm_page_t m; int i; - vmd = arg; + pgcache = arg; + vmd = VM_DOMAIN(pgcache->domain); vm_domain_free_lock(vmd); for (i = 0; i < cnt; i++) { m = (vm_page_t)store[i]; @@ -3500,13 +3511,15 @@ void vm_page_free_toq(vm_page_t m) { struct vm_domain *vmd; + uma_zone_t zone; if (!vm_page_free_prep(m)) return; vmd = vm_pagequeue_domain(m); - if ((m->flags & PG_PCPU_CACHE) != 0 && vmd->vmd_pgcache != NULL) { - uma_zfree(vmd->vmd_pgcache, m); + zone = vmd->vmd_pgcache[m->pool].zone; + if ((m->flags & PG_PCPU_CACHE) != 0 && zone != NULL) { + uma_zfree(zone, m); return; } vm_domain_free_lock(vmd); Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Mon Jul 8 18:29:37 2019 (r349839) +++ head/sys/vm/vm_page.h Mon Jul 8 18:56:30 2019 (r349840) @@ -378,6 +378,10 @@ extern struct mtx_padalign pa_lock[]; /* * Page flags. If changed at any other time than page allocation or * freeing, the modification must be protected by the vm_page lock. + * + * The PG_PCPU_CACHE flag is set at allocation time if the page was + * allocated from a per-CPU cache. It is cleared the next time that the + * page is allocated from the physical memory allocator. */ #define PG_PCPU_CACHE 0x0001 /* was allocated from per-CPU caches */ #define PG_FICTITIOUS 0x0004 /* physical page doesn't exist */ Modified: head/sys/vm/vm_pagequeue.h ============================================================================== --- head/sys/vm/vm_pagequeue.h Mon Jul 8 18:29:37 2019 (r349839) +++ head/sys/vm/vm_pagequeue.h Mon Jul 8 18:56:30 2019 (r349840) @@ -103,7 +103,11 @@ struct vm_domain { struct vm_pagequeue vmd_pagequeues[PQ_COUNT]; struct mtx_padalign vmd_free_mtx; struct mtx_padalign vmd_pageout_mtx; - uma_zone_t vmd_pgcache; /* (c) page free cache. */ + struct vm_pgcache { + int domain; + int pool; + uma_zone_t zone; + } vmd_pgcache[VM_NFREEPOOL]; struct vmem *vmd_kernel_arena; /* (c) per-domain kva R/W arena. */ struct vmem *vmd_kernel_rwx_arena; /* (c) per-domain kva R/W/X arena. */ u_int vmd_domain; /* (c) Domain number. */ From owner-svn-src-all@freebsd.org Mon Jul 8 19:02:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9BC5F15E6C9F; Mon, 8 Jul 2019 19:02:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 417F98626F; Mon, 8 Jul 2019 19:02:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 194441C9AE; Mon, 8 Jul 2019 19:02:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68J2eeT063495; Mon, 8 Jul 2019 19:02:40 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68J2eOx063494; Mon, 8 Jul 2019 19:02:40 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907081902.x68J2eOx063494@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 8 Jul 2019 19:02:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349841 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 349841 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 417F98626F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 19:02:41 -0000 Author: markj Date: Mon Jul 8 19:02:40 2019 New Revision: 349841 URL: https://svnweb.freebsd.org/changeset/base/349841 Log: Elide the vm_reserv_free_page() call when PG_PCPU_CACHE is set. Pages with PG_PCPU_CACHE set cannot have been allocated from a reservation, so as an optimization, skip the call to vm_reserv_free_page() in this case. Otherwise, the access of the corresponding reservation structure often results in a cache miss. Reviewed by: alc, kib Discussed with: jeff MFC after: 2 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20859 Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Mon Jul 8 18:56:30 2019 (r349840) +++ head/sys/vm/vm_page.c Mon Jul 8 19:02:40 2019 (r349841) @@ -3491,7 +3491,12 @@ vm_page_free_prep(vm_page_t m) pmap_page_set_memattr(m, VM_MEMATTR_DEFAULT); #if VM_NRESERVLEVEL > 0 - if (vm_reserv_free_page(m)) + /* + * Determine whether the page belongs to a reservation. If the page was + * allocated from a per-CPU cache, it cannot belong to a reservation, so + * as an optimization, we avoid the check in that case. + */ + if ((m->flags & PG_PCPU_CACHE) == 0 && vm_reserv_free_page(m)) return (false); #endif From owner-svn-src-all@freebsd.org Mon Jul 8 19:11:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A67615E713A; Mon, 8 Jul 2019 19:11:37 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E2E9D86A47; Mon, 8 Jul 2019 19:11:36 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71DA21CB30; Mon, 8 Jul 2019 19:11:36 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68JBaqD066890; Mon, 8 Jul 2019 19:11:36 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68JBaS1066889; Mon, 8 Jul 2019 19:11:36 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907081911.x68JBaS1066889@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 8 Jul 2019 19:11:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349842 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349842 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E2E9D86A47 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 19:11:37 -0000 Author: cy Date: Mon Jul 8 19:11:35 2019 New Revision: 349842 URL: https://svnweb.freebsd.org/changeset/base/349842 Log: Correct the description for the low port in the port compare struct. Adjust the high port description to match that of the low port description. MFC after: 3 days Modified: head/sys/contrib/ipfilter/netinet/ip_fil.h Modified: head/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_fil.h Mon Jul 8 19:02:40 2019 (r349841) +++ head/sys/contrib/ipfilter/netinet/ip_fil.h Mon Jul 8 19:11:35 2019 (r349842) @@ -584,8 +584,8 @@ typedef enum fr_ctypes_e { */ typedef struct frpcmp { fr_ctypes_t frp_cmp; /* data for port comparisons */ - u_32_t frp_port; /* top port for <> and >< */ - u_32_t frp_top; /* top port for <> and >< */ + u_32_t frp_port; /* low port for <> and >< */ + u_32_t frp_top; /* high port for <> and >< */ } frpcmp_t; From owner-svn-src-all@freebsd.org Mon Jul 8 19:11:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 714E615E7164; Mon, 8 Jul 2019 19:11:50 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0E9DE86B57; Mon, 8 Jul 2019 19:11:50 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95AF11CB41; Mon, 8 Jul 2019 19:11:49 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68JBnj3067851; Mon, 8 Jul 2019 19:11:49 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68JBnn1067850; Mon, 8 Jul 2019 19:11:49 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907081911.x68JBnn1067850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 8 Jul 2019 19:11:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349843 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349843 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0E9DE86B57 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 19:11:50 -0000 Author: cy Date: Mon Jul 8 19:11:49 2019 New Revision: 349843 URL: https://svnweb.freebsd.org/changeset/base/349843 Log: Update frtuc struct comments. It not only defines TCP things we are interested in but also UDP. While at it document the source and destination port variables. MFC after: 3 days Modified: head/sys/contrib/ipfilter/netinet/ip_fil.h Modified: head/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_fil.h Mon Jul 8 19:11:35 2019 (r349842) +++ head/sys/contrib/ipfilter/netinet/ip_fil.h Mon Jul 8 19:11:49 2019 (r349843) @@ -590,14 +590,14 @@ typedef struct frpcmp { /* - * Structure containing all the relevant TCP things that can be checked in + * Structure containing all the relevant TCP/UDP things that can be checked in * a filter rule. */ typedef struct frtuc { u_char ftu_tcpfm; /* tcp flags mask */ u_char ftu_tcpf; /* tcp flags */ - frpcmp_t ftu_src; - frpcmp_t ftu_dst; + frpcmp_t ftu_src; /* source port */ + frpcmp_t ftu_dst; /* destination port */ } frtuc_t; #define ftu_scmp ftu_src.frp_cmp From owner-svn-src-all@freebsd.org Mon Jul 8 19:13:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 396A515E7270; Mon, 8 Jul 2019 19:13:12 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4007386DC1; Mon, 8 Jul 2019 19:13:09 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 668A26F2; Mon, 8 Jul 2019 15:13:02 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 08 Jul 2019 15:13:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm3; bh=I qgh2AADiGI3tpyXdwWquI7SL4Wbzppis/u/n4uMVrk=; b=eWqdHb4M2Fzeikoof qwOSvD5DOTm4U9LerLt8drJ482S8fggOgEB3FzLTiTgWE3z459YmA1KQ1R4YNrSd wlwjJrhMfh/YKiJHGWEteC3nuUTtMV8OWqYIPkdB8dLErl1s8ezPXsRsxUQR0uml ketsJbNeFoB+mH94THaVVFp5W4cVpoRMQqdbeRtTHHNjlzU7HELvVglPb4OpqslX pAxx7WDzt7O4C6dvjrrNDUbjmCbjA8n23gVGt7GZrHVwUc0KUZ/pjIBrVNVI9Pme KzvlIbvZXS5mvKzX0vcqYwFLnTRD9p9ajgv35Vyev5orwdP4v01+Qr/VV1DA4u9C oqUPw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=Iqgh2AADiGI3tpyXdwWquI7SL4Wbzppis/u/n4uMV rk=; b=JK0th8rWRVo6mE3u7kLe7YoXfB6n+sqBBjztbH/TIQXVqjdba1oefjvhM NOfdyqnQZ4MCUxA2j6kTFAZOrEwXzvcxfv+Kyi8QhN/XgKtZgTj0SCdZcgJajn5F uhLasvYIJp2EmxPq47+Ai1TZAqhHyD/T33M96sQ0SX45ILKUljusK1Jr21ydNl9B SQpVA1aTnW7c62WzFc9lBs4reYuiJRGXuNxGUjQr7PSctP5XizS1fhWtMjqEoyCa RKON6wDO4dSfH92VzcsgwypAZ5QpgiA+LIABEutXo91jDWH/MKykIP2xhohdpnrN 4XEwvh/ko5Q6QluAhBwgeHNncaQzw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrgedtgddufeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurheptggguffhjgffgffkfhfvofesthhqmhdthhdtjeenucfhrhhomhepufgtohht thcunfhonhhguceoshgtohhtthhlsehsrghmshgtohdrohhrgheqnecukfhppedujeegrd dvtdelrdeffedrudduvdenucfrrghrrghmpehmrghilhhfrhhomhepshgtohhtthhlsehs rghmshgtohdrohhrghenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [172.20.10.2] (112.sub-174-209-33.myvzw.com [174.209.33.112]) by mail.messagingengine.com (Postfix) with ESMTPA id 54E24380075; Mon, 8 Jul 2019 15:13:00 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r349791 - head/sys/vm From: Scott Long In-Reply-To: <20190707023441.B2047@besplex.bde.org> Date: Mon, 8 Jul 2019 13:12:58 -0600 Cc: Doug Moore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <4BC14FB0-F79B-48DA-98E1-40B20552EA11@samsco.org> References: <201907061555.x66FtGsg025314@repo.freebsd.org> <20190707023441.B2047@besplex.bde.org> To: Bruce Evans X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 4007386DC1 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=samsco.org header.s=fm3 header.b=eWqdHb4M; dkim=pass header.d=messagingengine.com header.s=fm3 header.b=JK0th8rW; spf=pass (mx1.freebsd.org: domain of scottl@samsco.org designates 64.147.123.20 as permitted sender) smtp.mailfrom=scottl@samsco.org X-Spamd-Result: default: False [-6.57 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[samsco.org:s=fm3,messagingengine.com:s=fm3]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:64.147.123.20]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[samsco.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[samsco.org:+,messagingengine.com:+]; MX_GOOD(-0.01)[in2-smtp.messagingengine.com,in1-smtp.messagingengine.com,in2-smtp.messagingengine.com,in1-smtp.messagingengine.com,in2-smtp.messagingengine.com,in1-smtp.messagingengine.com,in2-smtp.messagingengine.com,in1-smtp.messagingengine.com]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; IP_SCORE(-3.48)[ip: (-9.46), ipnet: 64.147.123.0/24(-4.87), asn: 11403(-3.01), country: US(-0.06)]; FREEMAIL_TO(0.00)[optusnet.com.au]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:11403, ipnet:64.147.123.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[20.123.147.64.list.dnswl.org : 127.0.5.1] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 19:13:12 -0000 Hi Bruce, This isn=E2=80=99t the first time I=E2=80=99ve witnessed your passion on = this topic. It would help immensely if there was some documentation, maybe in = /sys/sys/param.h, or maybe even in a manual page, on what a =E2=80=9Cclick=E2=80=9D is, = what a =E2=80=9Cdb=E2=80=9D is, why they=E2=80=99re important, and how they should be used. Do you have any documentation tucked away that could be edited and committed? Thanks, Scott > On Jul 6, 2019, at 11:48 AM, Bruce Evans wrote: >=20 > On Sat, 6 Jul 2019, Doug Moore wrote: >=20 >> Log: >> Fix style(9) violations involving division by PAGE_SIZE. >=20 > It is style violation to even use an explicit division by PAGE_SIZE > instead of the btoc() conversion macro (*). From owner-svn-src-all@freebsd.org Mon Jul 8 19:26:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA71315E7B14; Mon, 8 Jul 2019 19:26:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8F77387867; Mon, 8 Jul 2019 19:26:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 636491CD14; Mon, 8 Jul 2019 19:26:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68JQ6SB074094; Mon, 8 Jul 2019 19:26:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68JQ6f9074093; Mon, 8 Jul 2019 19:26:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201907081926.x68JQ6f9074093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 8 Jul 2019 19:26:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349844 - head/sys/dev/usb X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/usb X-SVN-Commit-Revision: 349844 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8F77387867 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 19:26:07 -0000 Author: hselasky Date: Mon Jul 8 19:26:05 2019 New Revision: 349844 URL: https://svnweb.freebsd.org/changeset/base/349844 Log: Minor code cleanup of USB ACPI code after r349161. While at it fix an invalid memory access issue when attaching external USB HUBs, which are not mapped by ACPI, due to missing status check when calling AcpiGetObjectInfo() from acpi_usb_hub_port_probe_cb(). Sponsored by: Mellanox Technologies Modified: head/sys/dev/usb/usb_hub_acpi.c Modified: head/sys/dev/usb/usb_hub_acpi.c ============================================================================== --- head/sys/dev/usb/usb_hub_acpi.c Mon Jul 8 19:11:49 2019 (r349843) +++ head/sys/dev/usb/usb_hub_acpi.c Mon Jul 8 19:26:05 2019 (r349844) @@ -80,51 +80,31 @@ #include #include -static UINT32 acpi_uhub_find_rh_cb(ACPI_HANDLE ah, UINT32 nl, void *ctx, void **status); -static ACPI_STATUS acpi_uhub_find_rh(device_t dev, ACPI_HANDLE * ah); -static ACPI_STATUS -acpi_usb_hub_port_probe_cb(ACPI_HANDLE ah, UINT32 lv, void *ctx, void **rv); -static ACPI_STATUS acpi_usb_hub_port_probe(device_t dev, ACPI_HANDLE ah); -static int acpi_uhub_root_probe(device_t dev); -static int acpi_uhub_probe(device_t dev); -static int acpi_uhub_root_attach(device_t dev); -static int acpi_uhub_attach(device_t dev); -static int acpi_uhub_detach(device_t dev); -static int -acpi_uhub_read_ivar(device_t dev, device_t child, int idx, - uintptr_t *res); -static int -acpi_uhub_child_location_string(device_t parent, device_t child, - char *buf, size_t buflen); -static int acpi_uhub_parse_upc(device_t dev, unsigned int port, ACPI_HANDLE ah); - struct acpi_uhub_softc { struct uhub_softc usc; uint8_t nports; ACPI_HANDLE *porthandle; }; -UINT32 -acpi_uhub_find_rh_cb(ACPI_HANDLE ah, UINT32 nl, void *ctx, void **status){ +static UINT32 +acpi_uhub_find_rh_cb(ACPI_HANDLE ah, UINT32 nl, void *ctx, void **status) +{ ACPI_DEVICE_INFO *devinfo; - UINT32 ret = AE_OK; + UINT32 ret; *status = NULL; devinfo = NULL; ret = AcpiGetObjectInfo(ah, &devinfo); - - if (ACPI_FAILURE(ret)) { - return ret; + if (ACPI_SUCCESS(ret)) { + if ((devinfo->Valid & ACPI_VALID_ADR) && + (devinfo->Address == 0)) { + ret = AE_CTRL_TERMINATE; + *status = ah; + } + AcpiOsFree(devinfo); } - if ((devinfo->Valid & ACPI_VALID_ADR) && - (devinfo->Address == 0)) { - ret = AE_CTRL_TERMINATE; - *status = ah; - } - AcpiOsFree(devinfo); - - return ret; + return (ret); } static int @@ -134,14 +114,17 @@ acpi_uhub_parse_upc(device_t dev, unsigned int port, A buf.Pointer = NULL; buf.Length = ACPI_ALLOCATE_BUFFER; + if (AcpiEvaluateObject(ah, "_UPC", NULL, &buf) == AE_OK) { UINT64 porttypenum, conn; const char *connectable; - const char *typelist[] = {"TypeA", "MiniAB", "Express", + const char *typelist[] = { + "TypeA", "MiniAB", "Express", "USB3-A", "USB3-B", "USB-MicroB", "USB3-MicroAB", "USB3-PowerB", "TypeC-USB2", "TypeC-Switch", - "TypeC-nonSwitch"}; + "TypeC-nonSwitch" + }; const char *porttype; const int last = sizeof(typelist) / sizeof(typelist[0]); ACPI_OBJECT *obj = buf.Pointer; @@ -162,7 +145,7 @@ acpi_uhub_parse_upc(device_t dev, unsigned int port, A } AcpiOsFree(buf.Pointer); - return 0; + return (0); } static int @@ -172,6 +155,7 @@ acpi_uhub_parse_pld(device_t dev, unsigned int port, A buf.Pointer = NULL; buf.Length = ACPI_ALLOCATE_BUFFER; + if (AcpiEvaluateObject(ah, "_PLD", NULL, &buf) == AE_OK) { ACPI_OBJECT *obj; unsigned char *resbuf; @@ -235,145 +219,145 @@ acpi_uhub_parse_pld(device_t dev, unsigned int port, A } skip: AcpiOsFree(buf.Pointer); - } - - - return 0; + return (0); } -ACPI_STATUS -acpi_uhub_find_rh(device_t dev, ACPI_HANDLE * ah) +static ACPI_STATUS +acpi_uhub_find_rh(device_t dev, ACPI_HANDLE *ah) { device_t grand; ACPI_HANDLE gah; *ah = NULL; grand = device_get_parent(device_get_parent(dev)); - if ((gah = acpi_get_handle(grand)) == NULL) { - return AE_ERROR; - } - return AcpiWalkNamespace(ACPI_TYPE_DEVICE, gah, 1, - acpi_uhub_find_rh_cb, NULL, dev, ah); + + if ((gah = acpi_get_handle(grand)) == NULL) + return (AE_ERROR); + + return (AcpiWalkNamespace(ACPI_TYPE_DEVICE, gah, 1, + acpi_uhub_find_rh_cb, NULL, dev, ah)); } -ACPI_STATUS +static ACPI_STATUS acpi_usb_hub_port_probe_cb(ACPI_HANDLE ah, UINT32 lv, void *ctx, void **rv) { ACPI_DEVICE_INFO *devinfo; device_t dev = ctx; struct acpi_uhub_softc *sc = device_get_softc(dev); + UINT32 ret; - if (usb_debug) - device_printf(dev, "%s\n", acpi_name(ah)); - - AcpiGetObjectInfo(ah, &devinfo); - if ((devinfo->Valid & ACPI_VALID_ADR) && - (devinfo->Address > 0) && - (devinfo->Address <= (uint64_t)sc->nports)) { - sc->porthandle[devinfo->Address - 1] = ah; - acpi_uhub_parse_upc(dev, devinfo->Address, ah); - acpi_uhub_parse_pld(dev, devinfo->Address, ah); - } else { - device_printf(dev, "Skiping invalid devobj %s\n", - acpi_name(ah)); + ret = AcpiGetObjectInfo(ah, &devinfo); + if (ACPI_SUCCESS(ret)) { + if ((devinfo->Valid & ACPI_VALID_ADR) && + (devinfo->Address > 0) && + (devinfo->Address <= (uint64_t)sc->nports)) { + sc->porthandle[devinfo->Address - 1] = ah; + acpi_uhub_parse_upc(dev, devinfo->Address, ah); + acpi_uhub_parse_pld(dev, devinfo->Address, ah); + } + AcpiOsFree(devinfo); } - AcpiOsFree(devinfo); - return AE_OK; + return (AE_OK); } -ACPI_STATUS +static ACPI_STATUS acpi_usb_hub_port_probe(device_t dev, ACPI_HANDLE ah) { - return AcpiWalkNamespace(ACPI_TYPE_DEVICE, + return (AcpiWalkNamespace(ACPI_TYPE_DEVICE, ah, 1, acpi_usb_hub_port_probe_cb, - NULL, dev, NULL); + NULL, dev, NULL)); } -int + +static int acpi_uhub_root_probe(device_t dev) { - ACPI_HANDLE ah; ACPI_STATUS status; + ACPI_HANDLE ah; - if(acpi_disabled("usb")) { - return ENXIO; - } + if (acpi_disabled("usb")) + return (ENXIO); + status = acpi_uhub_find_rh(dev, &ah); - if (ACPI_SUCCESS(status) - && ah != NULL - && (uhub_probe(dev) <= 0)) { - /* success prior than non - acpi hub */ + if (ACPI_SUCCESS(status) && ah != NULL && + uhub_probe(dev) <= 0) { + /* success prior than non-ACPI USB HUB */ return (BUS_PROBE_DEFAULT + 1); } - return ENXIO; + return (ENXIO); } -int +static int acpi_uhub_probe(device_t dev) { - ACPI_HANDLE ah = acpi_get_handle(dev); + ACPI_HANDLE ah; - if (!acpi_disabled("usb") && ah && (uhub_probe(dev) <= 0)) { - /*success prior than non - acpi hub*/ - return (BUS_PROBE_DEFAULT + 1); + if (acpi_disabled("usb")) + return (ENXIO); + + ah = acpi_get_handle(dev); + if (ah == NULL) + return (ENXIO); + + if (uhub_probe(dev) <= 0) { + /* success prior than non-ACPI USB HUB */ + return (BUS_PROBE_DEFAULT + 1); } return (ENXIO); } -int + +static int acpi_uhub_root_attach(device_t dev) { - ACPI_HANDLE devhandle; - struct usb_hub *uh; struct acpi_uhub_softc *sc = device_get_softc(dev); + ACPI_STATUS status; + ACPI_HANDLE ah; int ret; - if ((ret = uhub_attach(dev)) != 0) { - return (ret); - } - uh = sc->usc.sc_udev->hub; + ret = uhub_attach(dev); + if (ret != 0) + goto done; - if (ACPI_FAILURE(acpi_uhub_find_rh(dev, &devhandle)) || - (devhandle == NULL)) { - return ENXIO; - } + status = acpi_uhub_find_rh(dev, &ah); + if (ACPI_SUCCESS(status) && ah != NULL) { + struct usb_hub *uh = sc->usc.sc_udev->hub; - sc->nports = uh->nports; - sc->porthandle = malloc(sizeof(ACPI_HANDLE) * uh->nports, - M_USBDEV, M_WAITOK | M_ZERO); - acpi_usb_hub_port_probe(dev, devhandle); - - return 0; + sc->nports = uh->nports; + sc->porthandle = malloc(sizeof(ACPI_HANDLE) * uh->nports, + M_USBDEV, M_WAITOK | M_ZERO); + acpi_usb_hub_port_probe(dev, ah); + } +done: + return (ret); } -int +static int acpi_uhub_attach(device_t dev) { - struct usb_hub *uh; struct acpi_uhub_softc *sc = device_get_softc(dev); - ACPI_HANDLE devhandle; + ACPI_HANDLE ah; int ret; - if ((ret = uhub_attach(dev)) != 0) { - return (ret); - } - uh = sc->usc.sc_udev->hub; - devhandle = acpi_get_handle(dev); + ret = uhub_attach(dev); + if (ret != 0) + goto done; - if (devhandle == NULL) { - return ENXIO; - } + ah = acpi_get_handle(dev); + if (ah != NULL) { + struct usb_hub *uh = sc->usc.sc_udev->hub; - sc->nports = uh->nports; - sc->porthandle = malloc(sizeof(ACPI_HANDLE) * uh->nports, - M_USBDEV, M_WAITOK | M_ZERO); - acpi_usb_hub_port_probe(dev, acpi_get_handle(dev)); - return 0; + sc->nports = uh->nports; + sc->porthandle = malloc(sizeof(ACPI_HANDLE) * uh->nports, + M_USBDEV, M_WAITOK | M_ZERO); + acpi_usb_hub_port_probe(dev, ah); + } +done: + return (ret); } -int -acpi_uhub_read_ivar(device_t dev, device_t child, int idx, - uintptr_t *res) +static int +acpi_uhub_read_ivar(device_t dev, device_t child, int idx, uintptr_t *res) { struct hub_result hres; struct acpi_uhub_softc *sc = device_get_softc(dev); @@ -382,6 +366,7 @@ acpi_uhub_read_ivar(device_t dev, device_t child, int mtx_lock(&Giant); uhub_find_iface_index(sc->usc.sc_udev->hub, child, &hres); mtx_unlock(&Giant); + if ((idx == ACPI_IVAR_HANDLE) && (hres.portno > 0) && (hres.portno <= sc->nports) && @@ -391,29 +376,31 @@ acpi_uhub_read_ivar(device_t dev, device_t child, int } return (ENXIO); } + static int acpi_uhub_child_location_string(device_t parent, device_t child, char *buf, size_t buflen) { - ACPI_HANDLE ah; uhub_child_location_string(parent, child, buf, buflen); + ah = acpi_get_handle(child); - if (ah) { + if (ah != NULL) { strlcat(buf, " handle=", buflen); strlcat(buf, acpi_name(ah), buflen); } return (0); } -int +static int acpi_uhub_detach(device_t dev) { struct acpi_uhub_softc *sc = device_get_softc(dev); free(sc->porthandle, M_USBDEV); - return uhub_detach(dev); + + return (uhub_detach(dev)); } static device_method_t acpi_uhub_methods[] = { @@ -438,12 +425,14 @@ static device_method_t acpi_uhub_root_methods[] = { static devclass_t uhub_devclass; extern driver_t uhub_driver; static kobj_class_t uhub_baseclasses[] = {&uhub_driver, NULL}; + static driver_t acpi_uhub_driver = { .name = "uhub", .methods = acpi_uhub_methods, .size = sizeof(struct acpi_uhub_softc), .baseclasses = uhub_baseclasses, }; + static driver_t acpi_uhub_root_driver = { .name = "uhub", .methods = acpi_uhub_root_methods, From owner-svn-src-all@freebsd.org Mon Jul 8 19:27:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D995915E7BB8; Mon, 8 Jul 2019 19:27:39 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 78C8287A7C; Mon, 8 Jul 2019 19:27:39 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 849132603F7; Mon, 8 Jul 2019 21:27:36 +0200 (CEST) Subject: Re: svn commit: r349763 - in stable/12/sys: kern sys To: John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <201907051226.x65CQUev056366@repo.freebsd.org> <97b7657c-53b9-f3d2-f31a-5e56343da71d@FreeBSD.org> <1bd91e31-920c-8857-f900-f66fb99f95d3@selasky.org> <3f85335c-635e-c37f-f887-39c1c3e7858d@FreeBSD.org> From: Hans Petter Selasky Message-ID: Date: Mon, 8 Jul 2019 21:26:58 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <3f85335c-635e-c37f-f887-39c1c3e7858d@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 78C8287A7C X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.97 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.97)[-0.974,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 19:27:40 -0000 On 2019-07-08 19:09, John Baldwin wrote: > On 7/5/19 3:02 PM, Hans Petter Selasky wrote: >> On 2019-07-05 17:49, John Baldwin wrote: >>> How does this not break the module KBI? You've removed epoch_*_KBI symbols used >>> by existing modules, and you appear to have changed the size of the >>> 'struct epoch_tracker' object that existing modules allocate on the stack and >>> pass to functions in the kernel. Bumping __FreeBSD_version is not sufficient >>> cover to break the KBI of widely used interfaces in stable (while we don't >>> enforce KBI for all parts of the kernel, locking primitives is one of the things >>> we can't break). >> >> Hi John, >> >> I'm aware there is a KPI breakage, but there is no API or functionality >> breakage. >> >> The epoch(9) API is a very new API and I don't expect it to be widely >> used for binary only modules. Do you have any examples otherwise? >> >> man 9 epoch >> >> clearly states: >> >> NOTES >> The epoch kernel programming interface is under development and is >> subject to change. >> >> epoch(9) is currently mostly used inside the kernel which has to be >> re-compiled. >> >> If you think it is really important that epoch(9) will stay KBI >> compliant I'll do the work to fix that. > > Despite the NOTES claim, given its wide use it is effectively part of the KBI > just as much as 'struct mtx'. We also do not limit KBI to just binary-only > modules. It makes it much harder to test for one thing. You should be able > to take a 12.0 if_tap.ko and load it and use it with a stable/12 GENERIC > kernel for example. I think you've broken that. > Maybe I'm missing something, but won't this be blocked by the incremented __FreeBSD_version value in 12-stable vs 12.0 ??? --HPS From owner-svn-src-all@freebsd.org Mon Jul 8 19:38:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC84515E7F71; Mon, 8 Jul 2019 19:38:50 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 53D3B884F3; Mon, 8 Jul 2019 19:38:50 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2704D1CEB6; Mon, 8 Jul 2019 19:38:50 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68JcneQ079353; Mon, 8 Jul 2019 19:38:49 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68JcnMw079352; Mon, 8 Jul 2019 19:38:49 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907081938.x68JcnMw079352@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 8 Jul 2019 19:38:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349845 - head/sys/dev/pci X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/pci X-SVN-Commit-Revision: 349845 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 53D3B884F3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 19:38:51 -0000 Author: imp Date: Mon Jul 8 19:38:49 2019 New Revision: 349845 URL: https://svnweb.freebsd.org/changeset/base/349845 Log: Work around devices which return all zeros for reads of existing MSI-X table VCTRL registers. Unconditionally program the MSI-X vector control Mask field for MSI-X table entries without regarud for Mask's previous value. Some devices return all zeros on reads of the VCTRL registers, which would cause us to skip disabling interrupts. This fixes the Samsung SM961/PM961 SSDs which are return zero starting from offset 0x3084 within the memory region specified by BAR0, even when they are active MSI-X vectors. The Illumos kernel writes these unconditionally to 0 or 1. However, section 6.8.2.9 of the PCI Local Bus 3.0 spec (dated Feb 3, 2004) states for bits 31::01: After reset, the state of these bits must be 0. However, for potential future use, software must preserve the value of these reserved bits when modifying the value of other Vector Control bits. If software modifies the value of these reserved bits, the result is undefined." so we always set or clear the Mask bit, but otherwise preserves the old value. PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211713 Reviewed By: imp, jhb Submitted by: Ka Ho Ng MFC After: 1 week Differential Revision: https://reviews.freebsd.org/D20873 Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Mon Jul 8 19:26:05 2019 (r349844) +++ head/sys/dev/pci/pci.c Mon Jul 8 19:38:49 2019 (r349845) @@ -1671,10 +1671,13 @@ pci_mask_msix(device_t dev, u_int index) KASSERT(msix->msix_msgnum > index, ("bogus index")); offset = msix->msix_table_offset + index * 16 + 12; val = bus_read_4(msix->msix_table_res, offset); - if (!(val & PCIM_MSIX_VCTRL_MASK)) { - val |= PCIM_MSIX_VCTRL_MASK; - bus_write_4(msix->msix_table_res, offset, val); - } + val |= PCIM_MSIX_VCTRL_MASK; + + /* + * Some devices (e.g. Samsung PM961) do not support reads of this + * register, so always write the new value. + */ + bus_write_4(msix->msix_table_res, offset, val); } void @@ -1687,10 +1690,13 @@ pci_unmask_msix(device_t dev, u_int index) KASSERT(msix->msix_table_len > index, ("bogus index")); offset = msix->msix_table_offset + index * 16 + 12; val = bus_read_4(msix->msix_table_res, offset); - if (val & PCIM_MSIX_VCTRL_MASK) { - val &= ~PCIM_MSIX_VCTRL_MASK; - bus_write_4(msix->msix_table_res, offset, val); - } + val &= ~PCIM_MSIX_VCTRL_MASK; + + /* + * Some devices (e.g. Samsung PM961) do not support reads of this + * register, so always write the new value. + */ + bus_write_4(msix->msix_table_res, offset, val); } int From owner-svn-src-all@freebsd.org Mon Jul 8 19:46:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A787015E829D; Mon, 8 Jul 2019 19:46:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5677988B7B; Mon, 8 Jul 2019 19:46:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27FCF1D067; Mon, 8 Jul 2019 19:46:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68JkRBE084272; Mon, 8 Jul 2019 19:46:27 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68JkKYV084236; Mon, 8 Jul 2019 19:46:20 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907081946.x68JkKYV084236@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 8 Jul 2019 19:46:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349846 - in head: share/man/man9 sys/amd64/amd64 sys/amd64/vmm sys/arm/arm sys/arm64/arm64 sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linuxkpi/common/src sys/contrib/vch... X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head: share/man/man9 sys/amd64/amd64 sys/amd64/vmm sys/arm/arm sys/arm64/arm64 sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linuxkpi/common/src sys/contrib/vchiq/interface/vchiq_arm sy... X-SVN-Commit-Revision: 349846 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5677988B7B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 19:46:28 -0000 Author: markj Date: Mon Jul 8 19:46:20 2019 New Revision: 349846 URL: https://svnweb.freebsd.org/changeset/base/349846 Log: Merge the vm_page hold and wire mechanisms. The hold_count and wire_count fields of struct vm_page are separate reference counters with similar semantics. The remaining essential differences are that holds are not counted as a reference with respect to LRU, and holds have an implicit free-on-last unhold semantic whereas vm_page_unwire() callers must explicitly determine whether to free the page once the last reference to the page is released. This change removes the KPIs which directly manipulate hold_count. Functions such as vm_fault_quick_hold_pages() now return wired pages instead. Since r328977 the overhead of maintaining LRU for wired pages is lower, and in many cases vm_fault_quick_hold_pages() callers would swap holds for wirings on the returned pages anyway, so with this change we remove a number of page lock acquisitions. No functional change is intended. __FreeBSD_version is bumped. Reviewed by: alc, kib Discussed with: jeff Discussed with: jhb, np (cxgbe) Tested by: pho (previous version) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D19247 Deleted: head/share/man/man9/vm_page_hold.9 Modified: head/share/man/man9/Makefile head/sys/amd64/amd64/pmap.c head/sys/amd64/vmm/vmm.c head/sys/arm/arm/pmap-v4.c head/sys/arm/arm/pmap-v6.c head/sys/arm64/arm64/pmap.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/compat/linuxkpi/common/src/linux_page.c head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c head/sys/dev/cxgbe/tom/t4_cpl_io.c head/sys/dev/cxgbe/tom/t4_ddp.c head/sys/dev/cxgbe/tom/t4_tom.h head/sys/i386/i386/pmap.c head/sys/kern/kern_exec.c head/sys/kern/sys_process.c head/sys/kern/uipc_shm.c head/sys/mips/mips/pmap.c head/sys/net/bpf_zerocopy.c head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/booke/pmap.c head/sys/riscv/riscv/pmap.c head/sys/sparc64/sparc64/pmap.c head/sys/sys/param.h head/sys/vm/vm_fault.c head/sys/vm/vm_glue.c head/sys/vm/vm_object.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vm_pageout.c head/sys/vm/vm_swapout.c Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Mon Jul 8 19:38:49 2019 (r349845) +++ head/share/man/man9/Makefile Mon Jul 8 19:46:20 2019 (r349846) @@ -381,7 +381,6 @@ MAN= accept_filter.9 \ vm_page_aflag.9 \ vm_page_free.9 \ vm_page_grab.9 \ - vm_page_hold.9 \ vm_page_insert.9 \ vm_page_lookup.9 \ vm_page_rename.9 \ @@ -2248,7 +2247,6 @@ MLINKS+=vm_page_aflag.9 vm_page_aflag_clear.9 \ MLINKS+=vm_page_free.9 vm_page_free_toq.9 \ vm_page_free.9 vm_page_free_zero.9 \ vm_page_free.9 vm_page_try_to_free.9 -MLINKS+=vm_page_hold.9 vm_page_unhold.9 MLINKS+=vm_page_insert.9 vm_page_remove.9 MLINKS+=vm_page_wire.9 vm_page_unwire.9 MLINKS+=VOP_ACCESS.9 VOP_ACCESSX.9 Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/amd64/amd64/pmap.c Mon Jul 8 19:46:20 2019 (r349846) @@ -3035,7 +3035,7 @@ retry: } } if (m != NULL) - vm_page_hold(m); + vm_page_wire(m); } PA_UNLOCK_COND(pa); PMAP_UNLOCK(pmap); Modified: head/sys/amd64/vmm/vmm.c ============================================================================== --- head/sys/amd64/vmm/vmm.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/amd64/vmm/vmm.c Mon Jul 8 19:46:20 2019 (r349846) @@ -1003,7 +1003,7 @@ vm_gpa_release(void *cookie) vm_page_t m = cookie; vm_page_lock(m); - vm_page_unhold(m); + vm_page_unwire(m, PQ_ACTIVE); vm_page_unlock(m); } Modified: head/sys/arm/arm/pmap-v4.c ============================================================================== --- head/sys/arm/arm/pmap-v4.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/arm/arm/pmap-v4.c Mon Jul 8 19:46:20 2019 (r349846) @@ -3438,9 +3438,8 @@ retry: goto retry; if (l1pd & L1_S_PROT_W || (prot & VM_PROT_WRITE) == 0) { m = PHYS_TO_VM_PAGE(pa); - vm_page_hold(m); + vm_page_wire(m); } - } else { /* * Note that we can't rely on the validity of the L1 @@ -3470,7 +3469,7 @@ retry: if (vm_page_pa_tryrelock(pmap, pa & PG_FRAME, &paddr)) goto retry; m = PHYS_TO_VM_PAGE(pa); - vm_page_hold(m); + vm_page_wire(m); } } Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/arm/arm/pmap-v6.c Mon Jul 8 19:46:20 2019 (r349846) @@ -2002,7 +2002,7 @@ retry: if (vm_page_pa_tryrelock(pmap, pa, &lockpa)) goto retry; m = PHYS_TO_VM_PAGE(pa); - vm_page_hold(m); + vm_page_wire(m); } } else if (pte1_is_link(pte1)) { pte2p = pmap_pte2(pmap, va); @@ -2014,7 +2014,7 @@ retry: if (vm_page_pa_tryrelock(pmap, pa, &lockpa)) goto retry; m = PHYS_TO_VM_PAGE(pa); - vm_page_hold(m); + vm_page_wire(m); } } PA_UNLOCK_COND(lockpa); @@ -6710,10 +6710,9 @@ pmap_pid_dump(int pid) pa = pte2_pa(pte2); m = PHYS_TO_VM_PAGE(pa); - printf("va: 0x%x, pa: 0x%x, h: %d, w:" - " %d, f: 0x%x", va, pa, - m->hold_count, m->wire_count, - m->flags); + printf("va: 0x%x, pa: 0x%x, w: %d, " + "f: 0x%x", va, pa, + m->wire_count, m->flags); npte2++; index++; if (index >= 2) { @@ -6823,8 +6822,8 @@ dump_link(pmap_t pmap, uint32_t pte1_idx, boolean_t in printf(" 0x%08X: 0x%08X, TEX%d, s:%d, g:%d, m:%p", va , pte2, pte2_class(pte2), !!(pte2 & PTE2_S), !(pte2 & PTE2_NG), m); if (m != NULL) { - printf(" v:%d h:%d w:%d f:0x%04X\n", m->valid, - m->hold_count, m->wire_count, m->flags); + printf(" v:%d w:%d f:0x%04X\n", m->valid, + m->wire_count, m->flags); } else { printf("\n"); } @@ -6933,8 +6932,8 @@ dump_pt2tab(pmap_t pmap) printf(" 0x%08X: 0x%08X, TEX%d, s:%d, m:%p", va, pte2, pte2_class(pte2), !!(pte2 & PTE2_S), m); if (m != NULL) - printf(" , h: %d, w: %d, f: 0x%04X pidx: %lld", - m->hold_count, m->wire_count, m->flags, m->pindex); + printf(" , w: %d, f: 0x%04X pidx: %lld", + m->wire_count, m->flags, m->pindex); printf("\n"); } } Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/arm64/arm64/pmap.c Mon Jul 8 19:46:20 2019 (r349846) @@ -1100,7 +1100,7 @@ retry: (tpte & ~ATTR_MASK) | off, &pa)) goto retry; m = PHYS_TO_VM_PAGE((tpte & ~ATTR_MASK) | off); - vm_page_hold(m); + vm_page_wire(m); } } PA_UNLOCK_COND(pa); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Jul 8 19:46:20 2019 (r349846) @@ -455,7 +455,7 @@ page_unbusy(vm_page_t pp) } static vm_page_t -page_hold(vnode_t *vp, int64_t start) +page_wire(vnode_t *vp, int64_t start) { vm_object_t obj; vm_page_t pp; @@ -482,9 +482,8 @@ page_hold(vnode_t *vp, int64_t start) ASSERT3U(pp->valid, ==, VM_PAGE_BITS_ALL); vm_page_lock(pp); - vm_page_hold(pp); + vm_page_wire(pp); vm_page_unlock(pp); - } else pp = NULL; break; @@ -493,11 +492,11 @@ page_hold(vnode_t *vp, int64_t start) } static void -page_unhold(vm_page_t pp) +page_unwire(vm_page_t pp) { vm_page_lock(pp); - vm_page_unhold(pp); + vm_page_unwire(pp, PQ_ACTIVE); vm_page_unlock(pp); } @@ -647,7 +646,7 @@ mappedread(vnode_t *vp, int nbytes, uio_t *uio) vm_page_t pp; uint64_t bytes = MIN(PAGESIZE - off, len); - if (pp = page_hold(vp, start)) { + if (pp = page_wire(vp, start)) { struct sf_buf *sf; caddr_t va; @@ -660,7 +659,7 @@ mappedread(vnode_t *vp, int nbytes, uio_t *uio) #endif zfs_unmap_page(sf); zfs_vmobject_wlock(obj); - page_unhold(pp); + page_unwire(pp); } else { zfs_vmobject_wunlock(obj); error = dmu_read_uio_dbuf(sa_get_db(zp->z_sa_hdl), Modified: head/sys/compat/linuxkpi/common/src/linux_page.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_page.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/compat/linuxkpi/common/src/linux_page.c Mon Jul 8 19:46:20 2019 (r349846) @@ -198,23 +198,11 @@ linux_get_user_pages_internal(vm_map_t map, unsigned l vm_prot_t prot; size_t len; int count; - int i; prot = write ? (VM_PROT_READ | VM_PROT_WRITE) : VM_PROT_READ; len = ((size_t)nr_pages) << PAGE_SHIFT; count = vm_fault_quick_hold_pages(map, start, len, prot, pages, nr_pages); - if (count == -1) - return (-EFAULT); - - for (i = 0; i != nr_pages; i++) { - struct page *pg = pages[i]; - - vm_page_lock(pg); - vm_page_wire(pg); - vm_page_unhold(pg); - vm_page_unlock(pg); - } - return (nr_pages); + return (count == -1 ? -EFAULT : nr_pages); } int @@ -243,11 +231,6 @@ __get_user_pages_fast(unsigned long start, int nr_page *mp = pmap_extract_and_hold(map->pmap, va, prot); if (*mp == NULL) break; - - vm_page_lock(*mp); - vm_page_wire(*mp); - vm_page_unhold(*mp); - vm_page_unlock(*mp); if ((prot & VM_PROT_WRITE) != 0 && (*mp)->dirty != VM_PAGE_BITS_ALL) { Modified: head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c ============================================================================== --- head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c Mon Jul 8 19:46:20 2019 (r349846) @@ -474,13 +474,6 @@ create_pagelist(char __user *buf, size_t count, unsign return (-ENOMEM); } - for (i = 0; i < actual_pages; i++) { - vm_page_lock(pages[i]); - vm_page_wire(pages[i]); - vm_page_unhold(pages[i]); - vm_page_unlock(pages[i]); - } - pagelist->length = count; pagelist->type = type; pagelist->offset = offset; Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Mon Jul 8 19:46:20 2019 (r349846) @@ -1944,7 +1944,7 @@ aiotx_free_pgs(struct mbuf *m) for (int i = 0; i < ext_pgs->npgs; i++) { pg = PHYS_TO_VM_PAGE(ext_pgs->pa[i]); vm_page_change_lock(pg, &mtx); - vm_page_unhold(pg); + vm_page_unwire(pg, PQ_ACTIVE); } if (mtx != NULL) mtx_unlock(mtx); Modified: head/sys/dev/cxgbe/tom/t4_ddp.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_ddp.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/dev/cxgbe/tom/t4_ddp.c Mon Jul 8 19:46:20 2019 (r349846) @@ -112,15 +112,12 @@ free_pageset(struct tom_data *td, struct pageset *ps) if (ps->prsv.prsv_nppods > 0) t4_free_page_pods(&ps->prsv); - if (ps->flags & PS_WIRED) { - for (i = 0; i < ps->npages; i++) { - p = ps->pages[i]; - vm_page_lock(p); - vm_page_unwire(p, PQ_INACTIVE); - vm_page_unlock(p); - } - } else - vm_page_unhold_pages(ps->pages, ps->npages); + for (i = 0; i < ps->npages; i++) { + p = ps->pages[i]; + vm_page_lock(p); + vm_page_unwire(p, PQ_INACTIVE); + vm_page_unlock(p); + } mtx_lock(&ddp_orphan_pagesets_lock); TAILQ_INSERT_TAIL(&ddp_orphan_pagesets, ps, link); taskqueue_enqueue(taskqueue_thread, &ddp_orphan_task); @@ -150,7 +147,7 @@ recycle_pageset(struct toepcb *toep, struct pageset *p { DDP_ASSERT_LOCKED(toep); - if (!(toep->ddp.flags & DDP_DEAD) && ps->flags & PS_WIRED) { + if (!(toep->ddp.flags & DDP_DEAD)) { KASSERT(toep->ddp.cached_count + toep->ddp.active_count < nitems(toep->ddp.db), ("too many wired pagesets")); TAILQ_INSERT_HEAD(&toep->ddp.cached_pagesets, ps, link); @@ -1179,35 +1176,14 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct return (0); } -static void -wire_pageset(struct pageset *ps) -{ - vm_page_t p; - int i; - - KASSERT(!(ps->flags & PS_WIRED), ("pageset already wired")); - - for (i = 0; i < ps->npages; i++) { - p = ps->pages[i]; - vm_page_lock(p); - vm_page_wire(p); - vm_page_unhold(p); - vm_page_unlock(p); - } - ps->flags |= PS_WIRED; -} - /* - * Prepare a pageset for DDP. This wires the pageset and sets up page - * pods. + * Prepare a pageset for DDP. This sets up page pods. */ static int prep_pageset(struct adapter *sc, struct toepcb *toep, struct pageset *ps) { struct tom_data *td = sc->tom_softc; - if (!(ps->flags & PS_WIRED)) - wire_pageset(ps); if (ps->prsv.prsv_nppods == 0 && !t4_alloc_page_pods_for_ps(&td->pr, ps)) { return (0); Modified: head/sys/dev/cxgbe/tom/t4_tom.h ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.h Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/dev/cxgbe/tom/t4_tom.h Mon Jul 8 19:46:20 2019 (r349846) @@ -124,8 +124,7 @@ struct pageset { TAILQ_HEAD(pagesetq, pageset); -#define PS_WIRED 0x0001 /* Pages wired rather than held. */ -#define PS_PPODS_WRITTEN 0x0002 /* Page pods written to the card. */ +#define PS_PPODS_WRITTEN 0x0001 /* Page pods written to the card. */ struct ddp_buffer { struct pageset *ps; Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/i386/i386/pmap.c Mon Jul 8 19:46:20 2019 (r349846) @@ -1716,7 +1716,7 @@ retry: } } if (m != NULL) - vm_page_hold(m); + vm_page_wire(m); } PA_UNLOCK_COND(pa); PMAP_UNLOCK(pmap); Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/kern/kern_exec.c Mon Jul 8 19:46:20 2019 (r349846) @@ -1015,8 +1015,7 @@ exec_map_first_page(struct image_params *imgp) vm_page_readahead_finish(ma[i]); } vm_page_lock(ma[0]); - vm_page_hold(ma[0]); - vm_page_activate(ma[0]); + vm_page_wire(ma[0]); vm_page_unlock(ma[0]); VM_OBJECT_WUNLOCK(object); @@ -1036,7 +1035,7 @@ exec_unmap_first_page(struct image_params *imgp) sf_buf_free(imgp->firstpage); imgp->firstpage = NULL; vm_page_lock(m); - vm_page_unhold(m); + vm_page_unwire(m, PQ_ACTIVE); vm_page_unlock(m); } } Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/kern/sys_process.c Mon Jul 8 19:46:20 2019 (r349846) @@ -307,7 +307,8 @@ proc_rwmem(struct proc *p, struct uio *uio) * Release the page. */ vm_page_lock(m); - vm_page_unhold(m); + if (vm_page_unwire(m, PQ_ACTIVE) && m->object == NULL) + vm_page_free(m); vm_page_unlock(m); } while (error == 0 && uio->uio_resid > 0); Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/kern/uipc_shm.c Mon Jul 8 19:46:20 2019 (r349846) @@ -207,11 +207,7 @@ uiomove_object_page(vm_object_t obj, size_t len, struc vm_page_xunbusy(m); } vm_page_lock(m); - vm_page_hold(m); - if (vm_page_active(m)) - vm_page_reference(m); - else - vm_page_activate(m); + vm_page_wire(m); vm_page_unlock(m); VM_OBJECT_WUNLOCK(obj); error = uiomove_fromphys(&m, offset, tlen, uio); @@ -222,7 +218,7 @@ uiomove_object_page(vm_object_t obj, size_t len, struc VM_OBJECT_WUNLOCK(obj); } vm_page_lock(m); - vm_page_unhold(m); + vm_page_unwire(m, PQ_ACTIVE); vm_page_unlock(m); return (error); Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/mips/mips/pmap.c Mon Jul 8 19:46:20 2019 (r349846) @@ -811,7 +811,7 @@ retry: if (vm_page_pa_tryrelock(pmap, pte_pa, &pa)) goto retry; m = PHYS_TO_VM_PAGE(pte_pa); - vm_page_hold(m); + vm_page_wire(m); } } PA_UNLOCK_COND(pa); Modified: head/sys/net/bpf_zerocopy.c ============================================================================== --- head/sys/net/bpf_zerocopy.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/net/bpf_zerocopy.c Mon Jul 8 19:46:20 2019 (r349846) @@ -166,10 +166,6 @@ zbuf_sfbuf_get(struct vm_map *map, vm_offset_t uaddr) if (vm_fault_quick_hold_pages(map, uaddr, PAGE_SIZE, VM_PROT_READ | VM_PROT_WRITE, &pp, 1) < 0) return (NULL); - vm_page_lock(pp); - vm_page_wire(pp); - vm_page_unhold(pp); - vm_page_unlock(pp); sf = sf_buf_alloc(pp, SFB_NOWAIT); if (sf == NULL) { zbuf_page_free(pp); Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/powerpc/aim/mmu_oea.c Mon Jul 8 19:46:20 2019 (r349846) @@ -1275,7 +1275,7 @@ retry: if (vm_page_pa_tryrelock(pmap, pvo->pvo_pte.pte.pte_lo & PTE_RPGN, &pa)) goto retry; m = PHYS_TO_VM_PAGE(pvo->pvo_pte.pte.pte_lo & PTE_RPGN); - vm_page_hold(m); + vm_page_wire(m); } PA_UNLOCK_COND(pa); PMAP_UNLOCK(pmap); Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/powerpc/aim/mmu_oea64.c Mon Jul 8 19:46:20 2019 (r349846) @@ -1595,7 +1595,7 @@ retry: pvo->pvo_pte.pa & LPTE_RPGN, &pa)) goto retry; m = PHYS_TO_VM_PAGE(pvo->pvo_pte.pa & LPTE_RPGN); - vm_page_hold(m); + vm_page_wire(m); } PA_UNLOCK_COND(pa); PMAP_UNLOCK(pmap); Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/powerpc/booke/pmap.c Mon Jul 8 19:46:20 2019 (r349846) @@ -2951,7 +2951,7 @@ retry: if (vm_page_pa_tryrelock(pmap, PTE_PA(pte), &pa)) goto retry; m = PHYS_TO_VM_PAGE(PTE_PA(pte)); - vm_page_hold(m); + vm_page_wire(m); } } Modified: head/sys/riscv/riscv/pmap.c ============================================================================== --- head/sys/riscv/riscv/pmap.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/riscv/riscv/pmap.c Mon Jul 8 19:46:20 2019 (r349846) @@ -884,7 +884,7 @@ retry: if (vm_page_pa_tryrelock(pmap, phys, &pa)) goto retry; m = PHYS_TO_VM_PAGE(phys); - vm_page_hold(m); + vm_page_wire(m); } } PA_UNLOCK_COND(pa); Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/sparc64/sparc64/pmap.c Mon Jul 8 19:46:20 2019 (r349846) @@ -859,7 +859,7 @@ retry: m = PHYS_TO_VM_PAGE(TLB_DIRECT_TO_PHYS(va)); (void)vm_page_pa_tryrelock(pm, TLB_DIRECT_TO_PHYS(va), &pa); - vm_page_hold(m); + vm_page_wire(m); } else { tp = tsb_kvtotte(va); if ((tp->tte_data & TD_V) == 0) @@ -872,7 +872,7 @@ retry: if (vm_page_pa_tryrelock(pm, TTE_GET_PA(tp), &pa)) goto retry; m = PHYS_TO_VM_PAGE(TTE_GET_PA(tp)); - vm_page_hold(m); + vm_page_wire(m); } PA_UNLOCK_COND(pa); PMAP_UNLOCK(pm); Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/sys/param.h Mon Jul 8 19:46:20 2019 (r349846) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300034 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300035 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/vm/vm_fault.c Mon Jul 8 19:46:20 2019 (r349846) @@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -257,7 +258,7 @@ vm_fault_fill_hold(vm_page_t *m_hold, vm_page_t m) if (m_hold != NULL) { *m_hold = m; vm_page_lock(m); - vm_page_hold(m); + vm_page_wire(m); vm_page_unlock(m); } } @@ -505,7 +506,7 @@ vm_fault_populate(struct faultstate *fs, vm_prot_t pro vm_page_activate(&m[i]); if (m_hold != NULL && m[i].pindex == fs->first_pindex) { *m_hold = &m[i]; - vm_page_hold(&m[i]); + vm_page_wire(&m[i]); } vm_page_xunbusy_maybelocked(&m[i]); } @@ -563,6 +564,7 @@ vm_fault_hold(vm_map_t map, vm_offset_t vaddr, vm_prot struct faultstate fs; struct vnode *vp; struct domainset *dset; + struct mtx *mtx; vm_object_t next_object, retry_object; vm_offset_t e_end, e_start; vm_pindex_t retry_pindex; @@ -1142,15 +1144,23 @@ readrest: * We don't chase down the shadow chain */ fs.object == fs.first_object->backing_object) { - vm_page_lock(fs.m); - vm_page_dequeue(fs.m); + /* + * Keep the page wired to ensure that it is not + * freed by another thread, such as the page + * daemon, while it is disassociated from an + * object. + */ + mtx = NULL; + vm_page_change_lock(fs.m, &mtx); + vm_page_wire(fs.m); (void)vm_page_remove(fs.m); - vm_page_unlock(fs.m); - vm_page_lock(fs.first_m); + vm_page_change_lock(fs.first_m, &mtx); vm_page_replace_checked(fs.m, fs.first_object, fs.first_pindex, fs.first_m); vm_page_free(fs.first_m); - vm_page_unlock(fs.first_m); + vm_page_change_lock(fs.m, &mtx); + vm_page_unwire(fs.m, PQ_ACTIVE); + mtx_unlock(mtx); vm_page_dirty(fs.m); #if VM_NRESERVLEVEL > 0 /* @@ -1327,7 +1337,7 @@ readrest: vm_page_activate(fs.m); if (m_hold != NULL) { *m_hold = fs.m; - vm_page_hold(fs.m); + vm_page_wire(fs.m); } vm_page_unlock(fs.m); vm_page_xunbusy(fs.m); @@ -1600,7 +1610,9 @@ error: for (mp = ma; mp < ma + count; mp++) if (*mp != NULL) { vm_page_lock(*mp); - vm_page_unhold(*mp); + if (vm_page_unwire(*mp, PQ_INACTIVE) && + (*mp)->object == NULL) + vm_page_free(*mp); vm_page_unlock(*mp); } return (-1); Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/vm/vm_glue.c Mon Jul 8 19:46:20 2019 (r349846) @@ -223,12 +223,14 @@ vm_imgact_hold_page(vm_object_t object, vm_ooffset_t o VM_OBJECT_WLOCK(object); pindex = OFF_TO_IDX(offset); - m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY); + m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY | + VM_ALLOC_WIRED); if (m->valid != VM_PAGE_BITS_ALL) { vm_page_xbusy(m); rv = vm_pager_get_pages(object, &m, 1, NULL, NULL); if (rv != VM_PAGER_OK) { vm_page_lock(m); + vm_page_unwire(m, PQ_NONE); vm_page_free(m); vm_page_unlock(m); m = NULL; @@ -236,10 +238,6 @@ vm_imgact_hold_page(vm_object_t object, vm_ooffset_t o } vm_page_xunbusy(m); } - vm_page_lock(m); - vm_page_hold(m); - vm_page_activate(m); - vm_page_unlock(m); out: VM_OBJECT_WUNLOCK(object); return (m); @@ -273,7 +271,7 @@ vm_imgact_unmap_page(struct sf_buf *sf) sf_buf_free(sf); sched_unpin(); vm_page_lock(m); - vm_page_unhold(m); + vm_page_unwire(m, PQ_ACTIVE); vm_page_unlock(m); } Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/vm/vm_object.c Mon Jul 8 19:46:20 2019 (r349846) @@ -1212,7 +1212,7 @@ next_page: if (tm->valid != VM_PAGE_BITS_ALL) goto next_pindex; vm_page_lock(tm); - if (vm_page_held(tm)) { + if (vm_page_wired(tm)) { vm_page_unlock(tm); goto next_pindex; } Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/vm/vm_page.c Mon Jul 8 19:46:20 2019 (r349846) @@ -431,8 +431,7 @@ sysctl_vm_page_blacklist(SYSCTL_HANDLER_ARGS) /* * Initialize a dummy page for use in scans of the specified paging queue. * In principle, this function only needs to set the flag PG_MARKER. - * Nonetheless, it write busies and initializes the hold count to one as - * safety precautions. + * Nonetheless, it write busies the page as a safety precaution. */ static void vm_page_init_marker(vm_page_t marker, int queue, uint8_t aflags) @@ -443,7 +442,6 @@ vm_page_init_marker(vm_page_t marker, int queue, uint8 marker->aflags = aflags; marker->busy_lock = VPB_SINGLE_EXCLUSIVER; marker->queue = queue; - marker->hold_count = 1; } static void @@ -513,7 +511,6 @@ vm_page_init_page(vm_page_t m, vm_paddr_t pa, int segi m->object = NULL; m->wire_count = 0; m->busy_lock = VPB_UNBUSIED; - m->hold_count = 0; m->flags = m->aflags = 0; m->phys_addr = pa; m->queue = PQ_NONE; @@ -1096,31 +1093,6 @@ vm_page_change_lock(vm_page_t m, struct mtx **mtx) } /* - * Keep page from being freed by the page daemon - * much of the same effect as wiring, except much lower - * overhead and should be used only for *very* temporary - * holding ("wiring"). - */ -void -vm_page_hold(vm_page_t mem) -{ - - vm_page_lock_assert(mem, MA_OWNED); - mem->hold_count++; -} - -void -vm_page_unhold(vm_page_t mem) -{ - - vm_page_lock_assert(mem, MA_OWNED); - KASSERT(mem->hold_count >= 1, ("vm_page_unhold: hold count < 0!!!")); - --mem->hold_count; - if (mem->hold_count == 0 && (mem->flags & PG_UNHOLDFREE) != 0) - vm_page_free_toq(mem); -} - -/* * vm_page_unhold_pages: * * Unhold each of the pages that is referenced by the given array. @@ -1133,7 +1105,8 @@ vm_page_unhold_pages(vm_page_t *ma, int count) mtx = NULL; for (; count != 0; count--) { vm_page_change_lock(*ma, &mtx); - vm_page_unhold(*ma); + if (vm_page_unwire(*ma, PQ_ACTIVE) && (*ma)->object == NULL) + vm_page_free(*ma); ma++; } if (mtx != NULL) @@ -1595,7 +1568,7 @@ vm_page_replace(vm_page_t mnew, vm_object_t object, vm VM_OBJECT_ASSERT_WLOCKED(object); KASSERT(mnew->object == NULL, ("vm_page_replace: page %p already in object", mnew)); - KASSERT(mnew->queue == PQ_NONE, + KASSERT(mnew->queue == PQ_NONE || vm_page_wired(mnew), ("vm_page_replace: new page %p is on a paging queue", mnew)); /* @@ -2143,7 +2116,7 @@ vm_page_alloc_check(vm_page_t m) KASSERT(m->queue == PQ_NONE && (m->aflags & PGA_QUEUE_STATE_MASK) == 0, ("page %p has unexpected queue %d, flags %#x", m, m->queue, (m->aflags & PGA_QUEUE_STATE_MASK))); - KASSERT(!vm_page_held(m), ("page %p is held", m)); + KASSERT(!vm_page_wired(m), ("page %p is wired", m)); KASSERT(!vm_page_busied(m), ("page %p is busy", m)); KASSERT(m->dirty == 0, ("page %p is dirty", m)); KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, @@ -2350,7 +2323,7 @@ vm_page_scan_contig(u_long npages, vm_page_t m_start, vm_page_change_lock(m, &m_mtx); m_inc = 1; retry: - if (vm_page_held(m)) + if (vm_page_wired(m)) run_ext = 0; #if VM_NRESERVLEVEL > 0 else if ((level = vm_reserv_level(m)) >= 0 && @@ -2378,13 +2351,11 @@ retry: */ VM_OBJECT_RUNLOCK(object); goto retry; - } else if (vm_page_held(m)) { + } else if (vm_page_wired(m)) { run_ext = 0; goto unlock; } } - KASSERT((m->flags & PG_UNHOLDFREE) == 0, - ("page %p is PG_UNHOLDFREE", m)); /* Don't care: PG_NODUMP, PG_ZERO. */ if (object->type != OBJT_DEFAULT && object->type != OBJT_SWAP && @@ -2520,7 +2491,7 @@ vm_page_reclaim_run(int req_class, int domain, u_long */ vm_page_change_lock(m, &m_mtx); retry: - if (vm_page_held(m)) + if (vm_page_wired(m)) error = EBUSY; else if ((object = m->object) != NULL) { /* @@ -2537,13 +2508,11 @@ retry: */ VM_OBJECT_WUNLOCK(object); goto retry; - } else if (vm_page_held(m)) { + } else if (vm_page_wired(m)) { error = EBUSY; goto unlock; } } - KASSERT((m->flags & PG_UNHOLDFREE) == 0, - ("page %p is PG_UNHOLDFREE", m)); /* Don't care: PG_NODUMP, PG_ZERO. */ if (object->type != OBJT_DEFAULT && object->type != OBJT_SWAP && @@ -3476,13 +3445,6 @@ vm_page_free_prep(vm_page_t m) if (vm_page_wired(m) != 0) panic("vm_page_free_prep: freeing wired page %p", m); - if (m->hold_count != 0) { - m->flags &= ~PG_ZERO; - KASSERT((m->flags & PG_UNHOLDFREE) == 0, - ("vm_page_free_prep: freeing PG_UNHOLDFREE page %p", m)); - m->flags |= PG_UNHOLDFREE; - return (false); - } /* * Restore the default memory attribute to the page. @@ -3799,7 +3761,7 @@ vm_page_try_to_free(vm_page_t m) vm_page_assert_locked(m); VM_OBJECT_ASSERT_WLOCKED(m->object); KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("page %p is unmanaged", m)); - if (m->dirty != 0 || vm_page_held(m) || vm_page_busied(m)) + if (m->dirty != 0 || vm_page_wired(m) || vm_page_busied(m)) return (false); if (m->object->ref_count != 0) { pmap_remove_all(m); @@ -4539,10 +4501,10 @@ DB_SHOW_COMMAND(pginfo, vm_page_print_pginfo) else m = (vm_page_t)addr; db_printf( - "page %p obj %p pidx 0x%jx phys 0x%jx q %d hold %d wire %d\n" + "page %p obj %p pidx 0x%jx phys 0x%jx q %d wire %d\n" " af 0x%x of 0x%x f 0x%x act %d busy %x valid 0x%x dirty 0x%x\n", m, m->object, (uintmax_t)m->pindex, (uintmax_t)m->phys_addr, - m->queue, m->hold_count, m->wire_count, m->aflags, m->oflags, + m->queue, m->wire_count, m->aflags, m->oflags, m->flags, m->act_count, m->busy_lock, m->valid, m->dirty); } #endif /* DDB */ Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/vm/vm_page.h Mon Jul 8 19:46:20 2019 (r349846) @@ -204,15 +204,14 @@ struct vm_page { struct md_page md; /* machine dependent stuff */ u_int wire_count; /* wired down maps refs (P) */ volatile u_int busy_lock; /* busy owners lock */ - uint16_t hold_count; /* page hold count (P) */ uint16_t flags; /* page PG_* flags (P) */ + uint8_t order; /* index of the buddy queue (F) */ + uint8_t pool; /* vm_phys freepool index (F) */ uint8_t aflags; /* access is atomic */ uint8_t oflags; /* page VPO_* flags (O) */ uint8_t queue; /* page queue index (Q) */ int8_t psind; /* pagesizes[] index (O) */ int8_t segind; /* vm_phys segment index (C) */ - uint8_t order; /* index of the buddy queue (F) */ - uint8_t pool; /* vm_phys freepool index (F) */ u_char act_count; /* page usage count (P) */ /* NOTE that these must support one bit per DEV_BSIZE in a page */ /* so, on normal X86 kernels, they must be at least 8 bits wide */ @@ -388,7 +387,6 @@ extern struct mtx_padalign pa_lock[]; #define PG_ZERO 0x0008 /* page is zeroed */ #define PG_MARKER 0x0010 /* special queue marker page */ #define PG_NODUMP 0x0080 /* don't include this page in a dump */ -#define PG_UNHOLDFREE 0x0100 /* delayed free of a held page */ /* * Misc constants. @@ -516,8 +514,6 @@ malloc2vm_flags(int malloc_flags) void vm_page_busy_downgrade(vm_page_t m); void vm_page_busy_sleep(vm_page_t m, const char *msg, bool nonshared); void vm_page_flash(vm_page_t m); -void vm_page_hold(vm_page_t mem); -void vm_page_unhold(vm_page_t mem); void vm_page_free(vm_page_t m); void vm_page_free_zero(vm_page_t m); @@ -816,17 +812,10 @@ vm_page_in_laundry(vm_page_t m) } /* - * vm_page_held: + * vm_page_wired: * * Return true if a reference prevents the page from being reclaimable. */ -static inline bool -vm_page_held(vm_page_t m) -{ - - return (m->hold_count > 0 || m->wire_count > 0); -} - static inline bool vm_page_wired(vm_page_t m) { Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/vm/vm_pageout.c Mon Jul 8 19:46:20 2019 (r349846) @@ -334,7 +334,7 @@ vm_pageout_cluster(vm_page_t m) pindex = m->pindex; vm_page_assert_unbusied(m); - KASSERT(!vm_page_held(m), ("page %p is held", m)); + KASSERT(!vm_page_wired(m), ("page %p is wired", m)); pmap_remove_write(m); vm_page_unlock(m); @@ -373,7 +373,7 @@ more: break; } vm_page_lock(p); - if (vm_page_held(p) || !vm_page_in_laundry(p)) { + if (vm_page_wired(p) || !vm_page_in_laundry(p)) { vm_page_unlock(p); ib = 0; break; @@ -399,7 +399,7 @@ more: if (p->dirty == 0) break; vm_page_lock(p); - if (vm_page_held(p) || !vm_page_in_laundry(p)) { + if (vm_page_wired(p) || !vm_page_in_laundry(p)) { vm_page_unlock(p); break; } @@ -651,7 +651,7 @@ vm_pageout_clean(vm_page_t m, int *numpagedout) * The page may have been busied or referenced while the object * and page locks were released. */ - if (vm_page_busied(m) || vm_page_held(m)) { + if (vm_page_busied(m) || vm_page_wired(m)) { vm_page_unlock(m); error = EBUSY; goto unlock_all; @@ -747,14 +747,10 @@ recheck: } /* - * Held pages are essentially stuck in the queue. - * * Wired pages may not be freed. Complete their removal * from the queue now to avoid needless revisits during * future scans. */ - if (m->hold_count != 0) - continue; if (vm_page_wired(m)) { vm_page_dequeue_deferred(m); continue; @@ -1419,18 +1415,10 @@ recheck: goto reinsert; /* - * Held pages are essentially stuck in the queue. So, - * they ought to be discounted from the inactive count. - * See the description of addl_page_shortage above. - * * Wired pages may not be freed. Complete their removal * from the queue now to avoid needless revisits during * future scans. */ - if (m->hold_count != 0) { - addl_page_shortage++; - goto reinsert; - } if (vm_page_wired(m)) { vm_page_dequeue_deferred(m); continue; Modified: head/sys/vm/vm_swapout.c ============================================================================== --- head/sys/vm/vm_swapout.c Mon Jul 8 19:38:49 2019 (r349845) +++ head/sys/vm/vm_swapout.c Mon Jul 8 19:46:20 2019 (r349846) @@ -212,7 +212,7 @@ vm_swapout_object_deactivate_pages(pmap_t pmap, vm_obj continue; VM_CNT_INC(v_pdpages); vm_page_lock(p); - if (vm_page_held(p) || + if (vm_page_wired(p) || !pmap_page_exists_quick(pmap, p)) { vm_page_unlock(p); continue; From owner-svn-src-all@freebsd.org Mon Jul 8 19:59:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4E5015E8614; Mon, 8 Jul 2019 19:59:16 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6BB5089312; Mon, 8 Jul 2019 19:59:16 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EBB6C1D22A; Mon, 8 Jul 2019 19:59:15 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68JxFwb089686; Mon, 8 Jul 2019 19:59:15 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68JxF4u089685; Mon, 8 Jul 2019 19:59:15 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201907081959.x68JxF4u089685@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Mon, 8 Jul 2019 19:59:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349847 - head/sys/dev/cxgbe/tom X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 349847 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6BB5089312 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 19:59:16 -0000 Author: lwhsu Date: Mon Jul 8 19:59:15 2019 New Revision: 349847 URL: https://svnweb.freebsd.org/changeset/base/349847 Log: Fix gcc build for cxgbe(4) Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20879 Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Mon Jul 8 19:46:20 2019 (r349846) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Mon Jul 8 19:59:15 2019 (r349847) @@ -1985,7 +1985,7 @@ alloc_aiotx_mbuf(struct kaiocb *job, int len) last = NULL; while (len > 0) { mlen = imin(len, MBUF_PEXT_MAX_PGS * PAGE_SIZE - pgoff); - KASSERT(mlen == len || (start + mlen & PAGE_MASK) == 0, + KASSERT(mlen == len || ((start + mlen) & PAGE_MASK) == 0, ("%s: next start (%#jx + %#x) is not page aligned", __func__, (uintmax_t)start, mlen)); From owner-svn-src-all@freebsd.org Mon Jul 8 20:01:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7789415E87F3; Mon, 8 Jul 2019 20:01:29 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1DD0F896BC; Mon, 8 Jul 2019 20:01:29 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BFF691D379; Mon, 8 Jul 2019 20:01:28 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68K1Sa6090668; Mon, 8 Jul 2019 20:01:28 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68K1SM6090667; Mon, 8 Jul 2019 20:01:28 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201907082001.x68K1SM6090667@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Mon, 8 Jul 2019 20:01:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349848 - head/sys/dev/superio X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/sys/dev/superio X-SVN-Commit-Revision: 349848 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1DD0F896BC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 20:01:29 -0000 Author: lwhsu Date: Mon Jul 8 20:01:28 2019 New Revision: 349848 URL: https://svnweb.freebsd.org/changeset/base/349848 Log: - Fix gcc build for superio(4) - Change string mapping of SUPERIO_DEV_NONE to distinguish from SUPERIO_DEV_MAX Reviewed by: imp Discussed with: avg, imp, jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20880 Modified: head/sys/dev/superio/superio.c Modified: head/sys/dev/superio/superio.c ============================================================================== --- head/sys/dev/superio/superio.c Mon Jul 8 19:59:15 2019 (r349847) +++ head/sys/dev/superio/superio.c Mon Jul 8 20:01:28 2019 (r349848) @@ -405,7 +405,7 @@ devtype_to_str(superio_dev_type_t type) { switch (type) { case SUPERIO_DEV_NONE: - return ("invalid"); + return ("none"); case SUPERIO_DEV_HWM: return ("HWM"); case SUPERIO_DEV_WDT: @@ -415,6 +415,7 @@ devtype_to_str(superio_dev_type_t type) case SUPERIO_DEV_MAX: return ("invalid"); } + return ("invalid"); } static int From owner-svn-src-all@freebsd.org Mon Jul 8 20:19:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 133A615E8C00; Mon, 8 Jul 2019 20:19:13 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 65D908A235; Mon, 8 Jul 2019 20:19:12 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lj1-f175.google.com with SMTP id h10so17260757ljg.0; Mon, 08 Jul 2019 13:19:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=Co8BoiMCZTGoGPJsR5gAFFLxvbMUvzYz4sW2gIvzVlw=; b=afdjK0FfSFnkT0BuAG+EVKp1hCwvZcvX3mf4y2haTzRzUaqPFS/NL1Xb+QRJj2oLCg kiaY716jFO1HJtF4hMUuQjJkG6m1Lrn1U9QJWeY7fDQeak/f3tZT1t2V+aGviHSt+zyO 1DsuhKn0nG1Gx4YDHXVc+7iItpaQUVhz20Elo771tcitS5tm015L75nt36fP7m4mkvCH M/H9mMdzxeYwftY6Z3BrFi8wxPszXLZ48rn58uy8rZF9lrOoTSLBYxYCSTWjaApLRbaj 4nGJErUySMyHt9aqOe8QFbqGbomwaSUCBlgVfk/eH4D64ch7oIIcIM80BpsXHMzOSHaI ua3g== X-Gm-Message-State: APjAAAW1lr6mBBBkscs2tE3m4mJmfH2jvt+5p0ZzMDcXu898ZQ56L3hF Cd50QxUS0lFQtl9h3Kk78yQBWfcEaOY= X-Google-Smtp-Source: APXvYqzW3c+mALgu5MvJeU22Ugtd66sPk8ShaBqvwS2kit/vI82RajSiNft+nBfjeFXoP3AnTKHH6A== X-Received: by 2002:a2e:970d:: with SMTP id r13mr11416820lji.126.1562617144970; Mon, 08 Jul 2019 13:19:04 -0700 (PDT) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id x67sm3845391ljb.13.2019.07.08.13.19.03 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jul 2019 13:19:04 -0700 (PDT) Subject: Re: svn commit: r349763 - in stable/12/sys: kern sys To: Hans Petter Selasky , John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <201907051226.x65CQUev056366@repo.freebsd.org> <97b7657c-53b9-f3d2-f31a-5e56343da71d@FreeBSD.org> <1bd91e31-920c-8857-f900-f66fb99f95d3@selasky.org> <3f85335c-635e-c37f-f887-39c1c3e7858d@FreeBSD.org> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; prefer-encrypt=mutual; keydata= mQINBFm4LIgBEADNB/3lT7f15UKeQ52xCFQx/GqHkSxEdVyLFZTmY3KyNPQGBtyvVyBfprJ7 mAeXZWfhat6cKNRAGZcL5EmewdQuUfQfBdYmKjbw3a9GFDsDNuhDA2QwFt8BmkiVMRYyvI7l N0eVzszWCUgdc3qqM6qqcgBaqsVmJluwpvwp4ZBXmch5BgDDDb1MPO8AZ2QZfIQmplkj8Y6Z AiNMknkmgaekIINSJX8IzRzKD5WwMsin70psE8dpL/iBsA2cpJGzWMObVTtCxeDKlBCNqM1i gTXta1ukdUT7JgLEFZk9ceYQQMJJtUwzWu1UHfZn0Fs29HTqawfWPSZVbulbrnu5q55R4PlQ /xURkWQUTyDpqUvb4JK371zhepXiXDwrrpnyyZABm3SFLkk2bHlheeKU6Yql4pcmSVym1AS4 dV8y0oHAfdlSCF6tpOPf2+K9nW1CFA8b/tw4oJBTtfZ1kxXOMdyZU5fiG7xb1qDgpQKgHUX8 7Rd2T1UVLVeuhYlXNw2F+a2ucY+cMoqz3LtpksUiBppJhw099gEXehcN2JbUZ2TueJdt1FdS ztnZmsHUXLxrRBtGwqnFL7GSd6snpGIKuuL305iaOGODbb9c7ne1JqBbkw1wh8ci6vvwGlzx rexzimRaBzJxlkjNfMx8WpCvYebGMydNoeEtkWldtjTNVsUAtQARAQABtB5BbmRyaXkgR2Fw b24gPGF2Z0BGcmVlQlNELm9yZz6JAlQEEwEIAD4WIQS+LEO7ngQnXA4Bjr538m7TUc1yjwUC WbgsiAIbIwUJBaOagAULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRB38m7TUc1yj+JAEACV l9AK/nOWAt/9cufV2fRj0hdOqB1aCshtSrwHk/exXsDa4/FkmegxXQGY+3GWX3deIyesbVRL rYdtdK0dqJyT1SBqXK1h3/at9rxr9GQA6KWOxTjUFURsU7ok/6SIlm8uLRPNKO+yq0GDjgaO LzN+xykuBA0FlhQAXJnpZLcVfPJdWv7sSHGedL5ln8P8rxR+XnmsA5TUaaPcbhTB+mG+iKFj GghASDSfGqLWFPBlX/fpXikBDZ1gvOr8nyMY9nXhgfXpq3B6QCRYKPy58ChrZ5weeJZ29b7/ QdEO8NFNWHjSD9meiLdWQaqo9Y7uUxN3wySc/YUZxtS0bhAd8zJdNPsJYG8sXgKjeBQMVGuT eCAJFEYJqbwWvIXMfVWop4+O4xB+z2YE3jAbG/9tB/GSnQdVSj3G8MS80iLS58frnt+RSEw/ psahrfh0dh6SFHttE049xYiC+cM8J27Aaf0i9RflyITq57NuJm+AHJoU9SQUkIF0nc6lfA+o JRiyRlHZHKoRQkIg4aiKaZSWjQYRl5Txl0IZUP1dSWMX4s3XTMurC/pnja45dge/4ESOtJ9R 8XuIWg45Oq6MeIWdjKddGhRj3OohsltKgkEU3eLKYtB6qRTQypHHUawCXz88uYt5e3w4V16H lCpSTZV/EVHnNe45FVBlvK7k7HFfDDkryLkCDQRZuCyIARAAlq0slcsVboY/+IUJdcbEiJRW be9HKVz4SUchq0z9MZPX/0dcnvz/gkyYA+OuM78dNS7Mbby5dTvOqfpLJfCuhaNYOhlE0wY+ 1T6Tf1f4c/uA3U/YiadukQ3+6TJuYGAdRZD5EqYFIkreARTVWg87N9g0fT9BEqLw9lJtEGDY EWUE7L++B8o4uu3LQFEYxcrb4K/WKmgtmFcm77s0IKDrfcX4doV92QTIpLiRxcOmCC/OCYuO jB1oaaqXQzZrCutXRK0L5XN1Y1PYjIrEzHMIXmCDlLYnpFkK+itlXwlE2ZQxkfMruCWdQXye syl2fynAe8hvp7Mms9qU2r2K9EcJiR5N1t1C2/kTKNUhcRv7Yd/vwusK7BqJbhlng5ZgRx0m WxdntU/JLEntz3QBsBsWM9Y9wf2V4tLv6/DuDBta781RsCB/UrU2zNuOEkSixlUiHxw1dccI 6CVlaWkkJBxmHX22GdDFrcjvwMNIbbyfQLuBq6IOh8nvu9vuItup7qemDG3Ms6TVwA7BD3j+ 3fGprtyW8Fd/RR2bW2+LWkMrqHffAr6Y6V3h5kd2G9Q8ZWpEJk+LG6Mk3fhZhmCnHhDu6CwN MeUvxXDVO+fqc3JjFm5OxhmfVeJKrbCEUJyM8ESWLoNHLqjywdZga4Q7P12g8DUQ1mRxYg/L HgZY3zfKOqcAEQEAAYkCPAQYAQgAJhYhBL4sQ7ueBCdcDgGOvnfybtNRzXKPBQJZuCyIAhsM BQkFo5qAAAoJEHfybtNRzXKPBVwQAKfFy9P7N3OsLDMB56A4Kf+ZT+d5cIx0Yiaf4n6w7m3i ImHHHk9FIetI4Xe54a2IXh4Bq5UkAGY0667eIs+Z1Ea6I2i27Sdo7DxGwq09Qnm/Y65ADvXs 3aBvokCcm7FsM1wky395m8xUos1681oV5oxgqeRI8/76qy0hD9WR65UW+HQgZRIcIjSel9vR XDaD2HLGPTTGr7u4v00UeTMs6qvPsa2PJagogrKY8RXdFtXvweQFz78NbXhluwix2Tb9ETPk LIpDrtzV73CaE2aqBG/KrboXT2C67BgFtnk7T7Y7iKq4/XvEdDWscz2wws91BOXuMMd4c/c4 OmGW9m3RBLufFrOag1q5yUS9QbFfyqL6dftJP3Zq/xe+mr7sbWbhPVCQFrH3r26mpmy841ym dwQnNcsbIGiBASBSKksOvIDYKa2Wy8htPmWFTEOPRpFXdGQ27awcjjnB42nngyCK5ukZDHi6 w0qK5DNQQCkiweevCIC6wc3p67jl1EMFY5+z+zdTPb3h7LeVnGqW0qBQl99vVFgzLxchKcl0 R/paSFgwqXCZhAKMuUHncJuynDOP7z5LirUeFI8qsBAJi1rXpQoLJTVcW72swZ42IdPiboqx NbTMiNOiE36GqMcTPfKylCbF45JNX4nF9ElM0E+Y8gi4cizJYBRr2FBJgay0b9Cp Message-ID: <17b1bbeb-19a6-1818-6cf5-63d71a1c8620@FreeBSD.org> Date: Mon, 8 Jul 2019 23:19:02 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 65D908A235 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.96 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.961,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 20:19:13 -0000 On 08/07/2019 22:26, Hans Petter Selasky wrote: > Maybe I'm missing something, but won't this be blocked by the incremented > __FreeBSD_version value in 12-stable vs 12.0 ??? Please see MODULE_KERNEL_MAXVER. -- Andriy Gapon From owner-svn-src-all@freebsd.org Mon Jul 8 20:20:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3ADE215E8C72; Mon, 8 Jul 2019 20:20:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D4FEC8A444; Mon, 8 Jul 2019 20:20:03 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AEC6B1D577; Mon, 8 Jul 2019 20:20:03 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68KK3in000437; Mon, 8 Jul 2019 20:20:03 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68KK2WE000426; Mon, 8 Jul 2019 20:20:02 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907082020.x68KK2WE000426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 8 Jul 2019 20:20:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349849 - in head/sys/dev: mpr mps X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys/dev: mpr mps X-SVN-Commit-Revision: 349849 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D4FEC8A444 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 20:20:04 -0000 Author: imp Date: Mon Jul 8 20:20:01 2019 New Revision: 349849 URL: https://svnweb.freebsd.org/changeset/base/349849 Log: Fix bugs in recovery path and improve cm tracking Eliminate the TIMEDOUT state. This state really conveyed two different concepts: I timed out during recovery (and my command got put on the recovery queue), and I timed out diring discovery (which doesn't). Separate those two concepts into two flags. Use the TIMEDOUT flag to fail requests as timed out. Use the on queue flag to remove them from the queue. In mps_intr_locked for MPI2_RPY_DESCRIPT_FLAGS_ADDRESS_REPLY message type, when completing commands, ignore the ones that are not in state INQUEUE. They were already completed as part of the recovery process. When we complete them twice, we wind up with entries on the free queue that are marked as busy, trigging asserts. Reviewed by: scottl (earlier version, just for mpr) Differential Revision: https://reviews.freebsd.org/D20785 Modified: head/sys/dev/mpr/mpr.c head/sys/dev/mpr/mpr_sas.c head/sys/dev/mpr/mpr_sas_lsi.c head/sys/dev/mpr/mprvar.h head/sys/dev/mps/mps.c head/sys/dev/mps/mps_sas.c head/sys/dev/mps/mps_sas_lsi.c head/sys/dev/mps/mpsvar.h Modified: head/sys/dev/mpr/mpr.c ============================================================================== --- head/sys/dev/mpr/mpr.c Mon Jul 8 20:01:28 2019 (r349848) +++ head/sys/dev/mpr/mpr.c Mon Jul 8 20:20:01 2019 (r349849) @@ -2617,12 +2617,17 @@ mpr_intr_locked(void *data) } else { cm = &sc->commands[ le16toh(desc->AddressReply.SMID)]; - if (cm->cm_state != MPR_CM_STATE_TIMEDOUT) - cm->cm_state = MPR_CM_STATE_BUSY; - cm->cm_reply = reply; - cm->cm_reply_data = - le32toh(desc->AddressReply. - ReplyFrameAddress); + if (cm->cm_state == MPR_CM_STATE_INQUEUE) { + cm->cm_reply = reply; + cm->cm_reply_data = + le32toh(desc->AddressReply. + ReplyFrameAddress); + } else { + mpr_dprint(sc, MPR_RECOVERY, + "Bad state for ADDRESS_REPLY status," + " ignoring state %d cm %p\n", + cm->cm_state, cm); + } } break; } Modified: head/sys/dev/mpr/mpr_sas.c ============================================================================== --- head/sys/dev/mpr/mpr_sas.c Mon Jul 8 20:01:28 2019 (r349848) +++ head/sys/dev/mpr/mpr_sas.c Mon Jul 8 20:20:01 2019 (r349849) @@ -1692,7 +1692,7 @@ mprsas_scsiio_timeout(void *data) * and been re-used, though this is unlikely. */ mpr_intr_locked(sc); - if (cm->cm_state != MPR_CM_STATE_INQUEUE) { + if (cm->cm_flags & MPR_CM_FLAGS_ON_RECOVERY) { mprsas_log_command(cm, MPR_XINFO, "SCSI command %p almost timed out\n", cm); return; @@ -1721,7 +1721,7 @@ mprsas_scsiio_timeout(void *data) * operational. if not, do a diag reset. */ mprsas_set_ccbstatus(cm->cm_ccb, CAM_CMD_TIMEOUT); - cm->cm_state = MPR_CM_STATE_TIMEDOUT; + cm->cm_flags |= MPR_CM_FLAGS_ON_RECOVERY | MPR_CM_FLAGS_TIMEDOUT; TAILQ_INSERT_TAIL(&targ->timedout_commands, cm, cm_recovery); if (targ->tm != NULL) { @@ -2529,9 +2529,11 @@ mprsas_scsiio_complete(struct mpr_softc *sc, struct mp TAILQ_REMOVE(&cm->cm_targ->commands, cm, cm_link); ccb->ccb_h.status &= ~(CAM_STATUS_MASK | CAM_SIM_QUEUED); - if (cm->cm_state == MPR_CM_STATE_TIMEDOUT) { + if (cm->cm_flags & MPR_CM_FLAGS_ON_RECOVERY) { TAILQ_REMOVE(&cm->cm_targ->timedout_commands, cm, cm_recovery); - cm->cm_state = MPR_CM_STATE_BUSY; + KASSERT(cm->cm_state == MPR_CM_STATE_BUSY, + ("Not busy for CM_FLAGS_TIMEDOUT: %d\n", cm->cm_state)); + cm->cm_flags &= ~MPR_CM_FLAGS_ON_RECOVERY; if (cm->cm_reply != NULL) mprsas_log_command(cm, MPR_RECOVERY, "completed timedout cm %p ccb %p during recovery " @@ -2817,7 +2819,7 @@ mprsas_scsiio_complete(struct mpr_softc *sc, struct mp * retry counter), the only difference is what gets printed * on the console. */ - if (cm->cm_state == MPR_CM_STATE_TIMEDOUT) + if (cm->cm_flags & MPR_CM_FLAGS_TIMEDOUT) mprsas_set_ccbstatus(ccb, CAM_CMD_TIMEOUT); else mprsas_set_ccbstatus(ccb, CAM_REQ_ABORTED); Modified: head/sys/dev/mpr/mpr_sas_lsi.c ============================================================================== --- head/sys/dev/mpr/mpr_sas_lsi.c Mon Jul 8 20:01:28 2019 (r349848) +++ head/sys/dev/mpr/mpr_sas_lsi.c Mon Jul 8 20:20:01 2019 (r349849) @@ -1017,7 +1017,7 @@ mprsas_add_device(struct mpr_softc *sc, u16 handle, u8 cm = &sc->commands[i]; if (cm->cm_flags & MPR_CM_FLAGS_SATA_ID_TIMEOUT) { targ->timeouts++; - cm->cm_state = MPR_CM_STATE_TIMEDOUT; + cm->cm_flags |= MPR_CM_FLAGS_TIMEDOUT; if ((targ->tm = mprsas_alloc_tm(sc)) != NULL) { mpr_dprint(sc, MPR_INFO, "%s: sending Target " @@ -1244,9 +1244,11 @@ mprsas_ata_id_timeout(struct mpr_softc *sc, struct mpr /* * The Abort Task cannot be sent from here because the driver has not * completed setting up targets. Instead, the command is flagged so - * that special handling will be used to send the abort. + * that special handling will be used to send the abort. Now that + * this command has timed out, it's no longer in the queue. */ cm->cm_flags |= MPR_CM_FLAGS_SATA_ID_TIMEOUT; + cm->cm_state = MPR_CM_STATE_BUSY; } static int Modified: head/sys/dev/mpr/mprvar.h ============================================================================== --- head/sys/dev/mpr/mprvar.h Mon Jul 8 20:01:28 2019 (r349848) +++ head/sys/dev/mpr/mprvar.h Mon Jul 8 20:20:01 2019 (r349849) @@ -275,11 +275,12 @@ struct mpr_command { #define MPR_CM_FLAGS_ERROR_MASK MPR_CM_FLAGS_CHAIN_FAILED #define MPR_CM_FLAGS_USE_CCB (1 << 9) #define MPR_CM_FLAGS_SATA_ID_TIMEOUT (1 << 10) +#define MPR_CM_FLAGS_ON_RECOVERY (1 << 12) +#define MPR_CM_FLAGS_TIMEDOUT (1 << 13) u_int cm_state; #define MPR_CM_STATE_FREE 0 #define MPR_CM_STATE_BUSY 1 -#define MPR_CM_STATE_TIMEDOUT 2 -#define MPR_CM_STATE_INQUEUE 3 +#define MPR_CM_STATE_INQUEUE 2 bus_dmamap_t cm_dmamap; struct scsi_sense_data *cm_sense; uint64_t *nvme_error_response; Modified: head/sys/dev/mps/mps.c ============================================================================== --- head/sys/dev/mps/mps.c Mon Jul 8 20:01:28 2019 (r349848) +++ head/sys/dev/mps/mps.c Mon Jul 8 20:20:01 2019 (r349849) @@ -2479,13 +2479,24 @@ mps_intr_locked(void *data) (MPI2_EVENT_NOTIFICATION_REPLY *) reply); } else { + /* + * Ignore commands not in INQUEUE state + * since they've already been completed + * via another path. + */ cm = &sc->commands[ le16toh(desc->AddressReply.SMID)]; - if (cm->cm_state != MPS_CM_STATE_TIMEDOUT) + if (cm->cm_state == MPS_CM_STATE_INQUEUE) { cm->cm_state = MPS_CM_STATE_BUSY; - cm->cm_reply = reply; - cm->cm_reply_data = le32toh( - desc->AddressReply.ReplyFrameAddress); + cm->cm_reply = reply; + cm->cm_reply_data = le32toh( + desc->AddressReply.ReplyFrameAddress); + } else { + mps_dprint(sc, MPS_RECOVERY, + "Bad state for ADDRESS_REPLY status," + " ignoring state %d cm %p\n", + cm->cm_state, cm); + } } break; } Modified: head/sys/dev/mps/mps_sas.c ============================================================================== --- head/sys/dev/mps/mps_sas.c Mon Jul 8 20:01:28 2019 (r349848) +++ head/sys/dev/mps/mps_sas.c Mon Jul 8 20:20:01 2019 (r349849) @@ -1602,7 +1602,7 @@ mpssas_scsiio_timeout(void *data) * and been re-used, though this is unlikely. */ mps_intr_locked(sc); - if (cm->cm_state != MPS_CM_STATE_INQUEUE) { + if (cm->cm_flags & MPS_CM_FLAGS_ON_RECOVERY) { mpssas_log_command(cm, MPS_XINFO, "SCSI command %p almost timed out\n", cm); return; @@ -1626,7 +1626,7 @@ mpssas_scsiio_timeout(void *data) * operational. if not, do a diag reset. */ mpssas_set_ccbstatus(cm->cm_ccb, CAM_CMD_TIMEOUT); - cm->cm_state = MPS_CM_STATE_TIMEDOUT; + cm->cm_flags |= MPS_CM_FLAGS_ON_RECOVERY | MPS_CM_FLAGS_TIMEDOUT; TAILQ_INSERT_TAIL(&targ->timedout_commands, cm, cm_recovery); if (targ->tm != NULL) { @@ -2040,9 +2040,11 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mp biotrack(ccb->csio.bio, __func__); #endif - if (cm->cm_state == MPS_CM_STATE_TIMEDOUT) { + if (cm->cm_flags & MPS_CM_FLAGS_ON_RECOVERY) { TAILQ_REMOVE(&cm->cm_targ->timedout_commands, cm, cm_recovery); - cm->cm_state = MPS_CM_STATE_BUSY; + KASSERT(cm->cm_state == MPS_CM_STATE_BUSY, + ("Not busy for CM_FLAGS_TIMEDOUT: %d\n", cm->cm_state)); + cm->cm_flags &= ~MPS_CM_FLAGS_ON_RECOVERY; if (cm->cm_reply != NULL) mpssas_log_command(cm, MPS_RECOVERY, "completed timedout cm %p ccb %p during recovery " @@ -2325,7 +2327,7 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mp * retry counter), the only difference is what gets printed * on the console. */ - if (cm->cm_state == MPS_CM_STATE_TIMEDOUT) + if (cm->cm_flags & MPS_CM_FLAGS_TIMEDOUT) mpssas_set_ccbstatus(ccb, CAM_CMD_TIMEOUT); else mpssas_set_ccbstatus(ccb, CAM_REQ_ABORTED); Modified: head/sys/dev/mps/mps_sas_lsi.c ============================================================================== --- head/sys/dev/mps/mps_sas_lsi.c Mon Jul 8 20:01:28 2019 (r349848) +++ head/sys/dev/mps/mps_sas_lsi.c Mon Jul 8 20:20:01 2019 (r349849) @@ -790,7 +790,7 @@ mpssas_add_device(struct mps_softc *sc, u16 handle, u8 cm = &sc->commands[i]; if (cm->cm_flags & MPS_CM_FLAGS_SATA_ID_TIMEOUT) { targ->timeouts++; - cm->cm_state = MPS_CM_STATE_TIMEDOUT; + cm->cm_flags |= MPS_CM_FLAGS_TIMEDOUT; if ((targ->tm = mpssas_alloc_tm(sc)) != NULL) { mps_dprint(sc, MPS_INFO, "%s: sending Target " @@ -1017,9 +1017,11 @@ mpssas_ata_id_timeout(struct mps_softc *sc, struct mps /* * The Abort Task cannot be sent from here because the driver has not * completed setting up targets. Instead, the command is flagged so - * that special handling will be used to send the abort. + * that special handling will be used to send the abort. Now that + * this command has timed out, it's no longer in the queue. */ cm->cm_flags |= MPS_CM_FLAGS_SATA_ID_TIMEOUT; + cm->cm_state = MPS_CM_STATE_BUSY; } static int Modified: head/sys/dev/mps/mpsvar.h ============================================================================== --- head/sys/dev/mps/mpsvar.h Mon Jul 8 20:01:28 2019 (r349848) +++ head/sys/dev/mps/mpsvar.h Mon Jul 8 20:20:01 2019 (r349849) @@ -242,11 +242,12 @@ struct mps_command { #define MPS_CM_FLAGS_ERROR_MASK MPS_CM_FLAGS_CHAIN_FAILED #define MPS_CM_FLAGS_USE_CCB (1 << 10) #define MPS_CM_FLAGS_SATA_ID_TIMEOUT (1 << 11) +#define MPS_CM_FLAGS_ON_RECOVERY (1 << 12) +#define MPS_CM_FLAGS_TIMEDOUT (1 << 13) u_int cm_state; #define MPS_CM_STATE_FREE 0 #define MPS_CM_STATE_BUSY 1 -#define MPS_CM_STATE_TIMEDOUT 2 -#define MPS_CM_STATE_INQUEUE 3 +#define MPS_CM_STATE_INQUEUE 2 bus_dmamap_t cm_dmamap; struct scsi_sense_data *cm_sense; TAILQ_HEAD(, mps_chain) cm_chain_list; @@ -545,7 +546,8 @@ mps_free_command(struct mps_softc *sc, struct mps_comm { struct mps_chain *chain, *chain_temp; - KASSERT(cm->cm_state == MPS_CM_STATE_BUSY, ("state not busy\n")); + KASSERT(cm->cm_state == MPS_CM_STATE_BUSY, + ("state not busy: %d\n", cm->cm_state)); if (cm->cm_reply != NULL) mps_free_reply(sc, cm->cm_reply_data); @@ -581,7 +583,7 @@ mps_alloc_command(struct mps_softc *sc) return (NULL); KASSERT(cm->cm_state == MPS_CM_STATE_FREE, - ("mps: Allocating busy command\n")); + ("mps: Allocating busy command: %d\n", cm->cm_state)); TAILQ_REMOVE(&sc->req_list, cm, cm_link); cm->cm_state = MPS_CM_STATE_BUSY; @@ -594,7 +596,8 @@ mps_free_high_priority_command(struct mps_softc *sc, s { struct mps_chain *chain, *chain_temp; - KASSERT(cm->cm_state == MPS_CM_STATE_BUSY, ("state not busy\n")); + KASSERT(cm->cm_state == MPS_CM_STATE_BUSY, + ("state not busy: %d\n", cm->cm_state)); if (cm->cm_reply != NULL) mps_free_reply(sc, cm->cm_reply_data); @@ -623,7 +626,7 @@ mps_alloc_high_priority_command(struct mps_softc *sc) return (NULL); KASSERT(cm->cm_state == MPS_CM_STATE_FREE, - ("mps: Allocating busy command\n")); + ("mps: Allocating high priority busy command: %d\n", cm->cm_state)); TAILQ_REMOVE(&sc->high_priority_req_list, cm, cm_link); cm->cm_state = MPS_CM_STATE_BUSY; From owner-svn-src-all@freebsd.org Mon Jul 8 20:26:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8355315E8F24; Mon, 8 Jul 2019 20:26:58 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D17618AA65; Mon, 8 Jul 2019 20:26:57 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F01A1D73A; Mon, 8 Jul 2019 20:26:57 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68KQvaY005336; Mon, 8 Jul 2019 20:26:57 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68KQvAL005334; Mon, 8 Jul 2019 20:26:57 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201907082026.x68KQvAL005334@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 8 Jul 2019 20:26:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349850 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 349850 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D17618AA65 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 20:26:58 -0000 Author: ian Date: Mon Jul 8 20:26:56 2019 New Revision: 349850 URL: https://svnweb.freebsd.org/changeset/base/349850 Log: Restore the ability for i2c slave devices to do IO from their probe method. r348164 added code to iicbus_request_bus/iicbus_release_bus to automatically call device_busy()/device_unbusy() as part of aquiring exclusive use of the bus (so modules can't be unloaded while the bus is exclusively owned and/or IO is in progress). That broke the ability to do i2c IO from a slave device probe method, because the slave isn't attached yet, so calling device_busy() triggers a sanity-check panic for trying to busy a non-attached device. Now we check whether the device status is < DS_ATTACHING, and if so we busy the iicbus rather than the slave device. I think this leaves a small window where a module could be unloaded while probing is in progress. But I think that's true of all devices, and probably should be fixed by introducing a DS_PROBING state for devices, and handling that at various points in the newbus code. Modified: head/sys/dev/iicbus/iicbus.h head/sys/dev/iicbus/iiconf.c Modified: head/sys/dev/iicbus/iicbus.h ============================================================================== --- head/sys/dev/iicbus/iicbus.h Mon Jul 8 20:20:01 2019 (r349849) +++ head/sys/dev/iicbus/iicbus.h Mon Jul 8 20:26:56 2019 (r349850) @@ -41,6 +41,7 @@ struct iicbus_softc { device_t dev; /* Myself */ device_t owner; /* iicbus owner device structure */ + device_t busydev; /* iicbus_release_bus calls unbusy on this */ u_int owncount; /* iicbus ownership nesting count */ u_char started; /* address of the 'started' slave * 0 if no start condition succeeded */ Modified: head/sys/dev/iicbus/iiconf.c ============================================================================== --- head/sys/dev/iicbus/iiconf.c Mon Jul 8 20:20:01 2019 (r349849) +++ head/sys/dev/iicbus/iiconf.c Mon Jul 8 20:26:56 2019 (r349850) @@ -131,9 +131,15 @@ iicbus_request_bus(device_t bus, device_t dev, int how /* * Mark the device busy while it owns the bus, to * prevent detaching the device, bus, or hardware - * controller, until ownership is relinquished. + * controller, until ownership is relinquished. If the + * device is doing IO from its probe method before + * attaching, it cannot be busied; mark the bus busy. */ - device_busy(dev); + if (device_get_state(dev) < DS_ATTACHING) + sc->busydev = bus; + else + sc->busydev = dev; + device_busy(sc->busydev); /* * Drop the lock around the call to the bus driver, it * should be allowed to sleep in the IIC_WAIT case. @@ -150,7 +156,7 @@ iicbus_request_bus(device_t bus, device_t dev, int how sc->owner = NULL; sc->owncount = 0; wakeup_one(sc); - device_unbusy(dev); + device_unbusy(sc->busydev); } } } @@ -184,7 +190,7 @@ iicbus_release_bus(device_t bus, device_t dev) IICBUS_LOCK(sc); sc->owner = NULL; wakeup_one(sc); - device_unbusy(dev); + device_unbusy(sc->busydev); } IICBUS_UNLOCK(sc); return (0); From owner-svn-src-all@freebsd.org Mon Jul 8 20:53:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 626DA15E9999; Mon, 8 Jul 2019 20:53:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 03F518BC91; Mon, 8 Jul 2019 20:53:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DEE551DC1D; Mon, 8 Jul 2019 20:53:26 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68KrQx1020653; Mon, 8 Jul 2019 20:53:26 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68KrPtm020649; Mon, 8 Jul 2019 20:53:25 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201907082053.x68KrPtm020649@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 8 Jul 2019 20:53:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349851 - in head/sys: conf dev/usb modules/usb modules/usb/uacpi modules/usb/usb X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: conf dev/usb modules/usb modules/usb/uacpi modules/usb/usb X-SVN-Commit-Revision: 349851 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 03F518BC91 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 20:53:27 -0000 Author: hselasky Date: Mon Jul 8 20:53:25 2019 New Revision: 349851 URL: https://svnweb.freebsd.org/changeset/base/349851 Log: Put USB ACPI code into own module, uacpi.ko. The code needs more testing before being enabled by default. Sponsored by: Mellanox Technologies Added: head/sys/modules/usb/uacpi/ head/sys/modules/usb/uacpi/Makefile (contents, props changed) Modified: head/sys/conf/files head/sys/dev/usb/usb_hub_acpi.c head/sys/modules/usb/Makefile head/sys/modules/usb/usb/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Jul 8 20:26:56 2019 (r349850) +++ head/sys/conf/files Mon Jul 8 20:53:25 2019 (r349851) @@ -3221,7 +3221,7 @@ dev/usb/usb_generic.c optional usb dev/usb/usb_handle_request.c optional usb dev/usb/usb_hid.c optional usb dev/usb/usb_hub.c optional usb -dev/usb/usb_hub_acpi.c optional usb acpi +dev/usb/usb_hub_acpi.c optional uacpi acpi dev/usb/usb_if.m optional usb dev/usb/usb_lookup.c optional usb dev/usb/usb_mbuf.c optional usb Modified: head/sys/dev/usb/usb_hub_acpi.c ============================================================================== --- head/sys/dev/usb/usb_hub_acpi.c Mon Jul 8 20:26:56 2019 (r349850) +++ head/sys/dev/usb/usb_hub_acpi.c Mon Jul 8 20:53:25 2019 (r349851) @@ -440,6 +440,10 @@ static driver_t acpi_uhub_root_driver = { .baseclasses = uhub_baseclasses, }; -DRIVER_MODULE(acpi_uhub, uhub, acpi_uhub_driver, uhub_devclass, 0, 0); -MODULE_DEPEND(acpi_uhub, acpi, 1, 1, 1); -DRIVER_MODULE(acpi_uhub, usbus, acpi_uhub_root_driver, uhub_devclass, 0, 0); +DRIVER_MODULE(uacpi, uhub, acpi_uhub_driver, uhub_devclass, 0, 0); +DRIVER_MODULE(uacpi, usbus, acpi_uhub_root_driver, uhub_devclass, 0, 0); + +MODULE_DEPEND(uacpi, acpi, 1, 1, 1); +MODULE_DEPEND(uacpi, usb, 1, 1, 1); + +MODULE_VERSION(uacpi, 1); Modified: head/sys/modules/usb/Makefile ============================================================================== --- head/sys/modules/usb/Makefile Mon Jul 8 20:26:56 2019 (r349850) +++ head/sys/modules/usb/Makefile Mon Jul 8 20:53:25 2019 (r349851) @@ -55,6 +55,7 @@ SUBDIR += uether aue axe axge cdce cue ${_kue} mos rue SUBDIR += muge SUBDIR += ure urndis SUBDIR += usfs umass urio +SUBDIR += ${_uacpi} SUBDIR += quirk template SUBDIR += ${_g_audio} ${_g_keyboard} ${_g_modem} ${_g_mouse} @@ -100,6 +101,11 @@ _avr32dci= avr32dci .if ${MACHINE_CPUARCH} == "mips" _saf1761otg= saf1761otg +.endif + +.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ + ${MACHINE_CPUARCH} == "i386" +_uacpi= uacpi .endif .include Added: head/sys/modules/usb/uacpi/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/usb/uacpi/Makefile Mon Jul 8 20:53:25 2019 (r349851) @@ -0,0 +1,36 @@ +# +# $FreeBSD$ +# +# Copyright (c) 2019 Hans Petter Selasky. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +.PATH: ${SRCTOP}/sys/dev/usb + +KMOD= uacpi +SRCS= bus_if.h device_if.h usb_if.h usb_if.c vnode_if.h \ + opt_usb.h opt_bus.h opt_ddb.h \ + opt_acpi.h acpi_if.h \ + usb_hub_acpi.c + +.include Modified: head/sys/modules/usb/usb/Makefile ============================================================================== --- head/sys/modules/usb/usb/Makefile Mon Jul 8 20:26:56 2019 (r349850) +++ head/sys/modules/usb/usb/Makefile Mon Jul 8 20:53:25 2019 (r349851) @@ -25,10 +25,8 @@ # SUCH DAMAGE. # -S= ${SRCTOP}/sys +.PATH: ${SRCTOP}/sys/dev/usb ${SRCTOP}/sys/dev/usb/controller -.PATH: $S/dev/usb $S/dev/usb/controller - KMOD= usb SRCS= bus_if.h device_if.h usb_if.h usb_if.c vnode_if.h \ opt_usb.h opt_bus.h opt_ddb.h \ @@ -38,11 +36,6 @@ SRCS= bus_if.h device_if.h usb_if.h usb_if.c vnode_if. usb_handle_request.c usb_hid.c usb_hub.c usb_lookup.c usb_mbuf.c \ usb_msctest.c usb_parse.c usb_pf.c usb_process.c usb_request.c \ usb_transfer.c usb_util.c - -.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ - ${MACHINE_CPUARCH} == "i386" -SRCS += opt_acpi.h usb_hub_acpi.c acpi_if.h -.endif .if !empty(OPT_FDT) SRCS+= usb_fdt_support.c ofw_bus_if.h From owner-svn-src-all@freebsd.org Mon Jul 8 21:33:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5E5415EA498; Mon, 8 Jul 2019 21:33:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8921A8D543; Mon, 8 Jul 2019 21:33:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6507E1E346; Mon, 8 Jul 2019 21:33:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68LXFFO041172; Mon, 8 Jul 2019 21:33:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68LXEfB041170; Mon, 8 Jul 2019 21:33:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201907082133.x68LXEfB041170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 8 Jul 2019 21:33:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349852 - in stable/12/sys: kern sys X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys: kern sys X-SVN-Commit-Revision: 349852 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8921A8D543 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 21:33:16 -0000 Author: hselasky Date: Mon Jul 8 21:33:14 2019 New Revision: 349852 URL: https://svnweb.freebsd.org/changeset/base/349852 Log: Restore binary compatibility for epoch(9) API. This is a direct commit. Discussed with: jhb@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/kern/subr_epoch.c stable/12/sys/sys/epoch.h Modified: stable/12/sys/kern/subr_epoch.c ============================================================================== --- stable/12/sys/kern/subr_epoch.c Mon Jul 8 20:53:25 2019 (r349851) +++ stable/12/sys/kern/subr_epoch.c Mon Jul 8 21:33:14 2019 (r349852) @@ -65,11 +65,12 @@ static MALLOC_DEFINE(M_EPOCH, "epoch", "epoch based re TAILQ_HEAD (epoch_tdlist, epoch_tracker); typedef struct epoch_record { ck_epoch_record_t er_record; - struct epoch_context er_drain_ctx; - struct epoch *er_parent; volatile struct epoch_tdlist er_tdlist; volatile uint32_t er_gen; uint32_t er_cpuid; + /* fields above are part of KBI and cannot be modified */ + struct epoch_context er_drain_ctx; + struct epoch *er_parent; } __aligned(EPOCH_ALIGN) *epoch_record_t; struct epoch { @@ -77,6 +78,7 @@ struct epoch { epoch_record_t e_pcpu_record; int e_idx; int e_flags; + /* fields above are part of KBI and cannot be modified */ struct sx e_drain_sx; struct mtx e_drain_mtx; volatile int e_drain_count; @@ -736,4 +738,41 @@ epoch_drain_callbacks(epoch_t epoch) sx_xunlock(&epoch->e_drain_sx); PICKUP_GIANT(); +} + +/* for binary compatibility */ + +struct epoch_tracker_KBI { + void *datap[3]; +#ifdef EPOCH_TRACKER_DEBUG + int datai[5]; +#else + int datai[1]; +#endif +} __aligned(sizeof(void *)); + +CTASSERT(sizeof(struct epoch_tracker_KBI) >= sizeof(struct epoch_tracker)); + +void +epoch_enter_preempt_KBI(epoch_t epoch, epoch_tracker_t et) +{ + epoch_enter_preempt(epoch, et); +} + +void +epoch_exit_preempt_KBI(epoch_t epoch, epoch_tracker_t et) +{ + epoch_exit_preempt(epoch, et); +} + +void +epoch_enter_KBI(epoch_t epoch) +{ + epoch_enter(epoch); +} + +void +epoch_exit_KBI(epoch_t epoch) +{ + epoch_exit(epoch); } Modified: stable/12/sys/sys/epoch.h ============================================================================== --- stable/12/sys/sys/epoch.h Mon Jul 8 20:53:25 2019 (r349851) +++ stable/12/sys/sys/epoch.h Mon Jul 8 21:33:14 2019 (r349852) @@ -83,5 +83,11 @@ void epoch_exit_preempt(epoch_t epoch, epoch_tracker_t void epoch_enter(epoch_t epoch); void epoch_exit(epoch_t epoch); +/* for binary compatibility - do not use */ +void epoch_enter_preempt_KBI(epoch_t epoch, epoch_tracker_t et); +void epoch_exit_preempt_KBI(epoch_t epoch, epoch_tracker_t et); +void epoch_enter_KBI(epoch_t epoch); +void epoch_exit_KBI(epoch_t epoch); + #endif /* _KERNEL */ #endif /* _SYS_EPOCH_H_ */ From owner-svn-src-all@freebsd.org Mon Jul 8 21:35:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E228A15EA54E; Mon, 8 Jul 2019 21:35:07 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 812B38D714; Mon, 8 Jul 2019 21:35:07 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 52B05260156; Mon, 8 Jul 2019 23:35:05 +0200 (CEST) Subject: Re: svn commit: r349763 - in stable/12/sys: kern sys To: Andriy Gapon , John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <201907051226.x65CQUev056366@repo.freebsd.org> <97b7657c-53b9-f3d2-f31a-5e56343da71d@FreeBSD.org> <1bd91e31-920c-8857-f900-f66fb99f95d3@selasky.org> <3f85335c-635e-c37f-f887-39c1c3e7858d@FreeBSD.org> <17b1bbeb-19a6-1818-6cf5-63d71a1c8620@FreeBSD.org> From: Hans Petter Selasky Message-ID: <47c7d250-8024-fc21-0c79-d38030674def@selasky.org> Date: Mon, 8 Jul 2019 23:34:26 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <17b1bbeb-19a6-1818-6cf5-63d71a1c8620@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 812B38D714 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.993,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 21:35:08 -0000 On 2019-07-08 22:19, Andriy Gapon wrote: > On 08/07/2019 22:26, Hans Petter Selasky wrote: >> Maybe I'm missing something, but won't this be blocked by the incremented >> __FreeBSD_version value in 12-stable vs 12.0 ??? > > Please see MODULE_KERNEL_MAXVER. > OK got it. Should be fixed by: r349852 Let me know if not. --HPS From owner-svn-src-all@freebsd.org Mon Jul 8 22:20:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC04315EB088; Mon, 8 Jul 2019 22:20:26 +0000 (UTC) (envelope-from meta@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 70F068EE6B; Mon, 8 Jul 2019 22:20:26 +0000 (UTC) (envelope-from meta@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46DA31EA4A; Mon, 8 Jul 2019 22:20:26 +0000 (UTC) (envelope-from meta@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x68MKQRO061859; Mon, 8 Jul 2019 22:20:26 GMT (envelope-from meta@FreeBSD.org) Received: (from meta@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x68MKQri061858; Mon, 8 Jul 2019 22:20:26 GMT (envelope-from meta@FreeBSD.org) Message-Id: <201907082220.x68MKQri061858@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: meta set sender to meta@FreeBSD.org using -f From: Koichiro Iwao Date: Mon, 8 Jul 2019 22:20:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349853 - head/usr.sbin/mld6query X-SVN-Group: head X-SVN-Commit-Author: meta X-SVN-Commit-Paths: head/usr.sbin/mld6query X-SVN-Commit-Revision: 349853 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 70F068EE6B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.935,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jul 2019 22:20:27 -0000 Author: meta (ports committer) Date: Mon Jul 8 22:20:25 2019 New Revision: 349853 URL: https://svnweb.freebsd.org/changeset/base/349853 Log: mld6query: Fix typo s/linkocal/linklocal/ PR: 239039 Approved by: markj Modified: head/usr.sbin/mld6query/mld6.c Modified: head/usr.sbin/mld6query/mld6.c ============================================================================== --- head/usr.sbin/mld6query/mld6.c Mon Jul 8 21:33:14 2019 (r349852) +++ head/usr.sbin/mld6query/mld6.c Mon Jul 8 22:20:25 2019 (r349853) @@ -244,7 +244,7 @@ make_msg(int index, struct in6_addr *addr, u_int type, break; } if (ifap == NULL) - errx(1, "no linkocal address is available"); + errx(1, "no linklocal address is available"); memcpy(&src, &((struct sockaddr_in6 *)ifap->ifa_addr)->sin6_addr, sizeof(src)); freeifaddrs(ifa); From owner-svn-src-all@freebsd.org Tue Jul 9 07:19:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F7CC15D20AD; Tue, 9 Jul 2019 07:19:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2684583641; Tue, 9 Jul 2019 07:19:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 16146245D5; Tue, 9 Jul 2019 07:19:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x697Jab8040603; Tue, 9 Jul 2019 07:19:36 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x697JaVG040602; Tue, 9 Jul 2019 07:19:36 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201907090719.x697JaVG040602@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 9 Jul 2019 07:19:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349854 - stable/12/lib/libc/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/lib/libc/sys X-SVN-Commit-Revision: 349854 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2684583641 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 07:19:37 -0000 Author: kib Date: Tue Jul 9 07:19:36 2019 New Revision: 349854 URL: https://svnweb.freebsd.org/changeset/base/349854 Log: MFC r349794: Document atomicity for read(2) and write(2). Modified: stable/12/lib/libc/sys/read.2 Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/sys/read.2 ============================================================================== --- stable/12/lib/libc/sys/read.2 Mon Jul 8 22:20:25 2019 (r349853) +++ stable/12/lib/libc/sys/read.2 Tue Jul 9 07:19:36 2019 (r349854) @@ -28,7 +28,7 @@ .\" @(#)read.2 8.4 (Berkeley) 2/26/94 .\" $FreeBSD$ .\" -.Dd December 1, 2017 +.Dd July 6, 2019 .Dt READ 2 .Os .Sh NAME @@ -128,6 +128,25 @@ return the number of bytes actually read and placed in The system guarantees to read the number of bytes requested if the descriptor references a normal file that has that many bytes left before the end-of-file, but in no other case. +.Pp +In accordance with +.St -p1003.1-2004 , +both +.Xr read 2 +and +.Xr write 2 +syscalls are atomic with respect to each other in the effects on file +content, when they operate on regular files. +If two threads each call one of the +.Xr read 2 +or +.Xr write 2 , +syscalls, each call will see either all of the changes of the other call, +or none of them. +The +.Fx +kernel implements this guarantee by locking the file ranges affected by +the calls. .Sh RETURN VALUES If successful, the number of bytes actually read is returned. From owner-svn-src-all@freebsd.org Tue Jul 9 07:21:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3B3E15D220C; Tue, 9 Jul 2019 07:21:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 89BA9838E0; Tue, 9 Jul 2019 07:21:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 63F2024729; Tue, 9 Jul 2019 07:21:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x697LYmG044740; Tue, 9 Jul 2019 07:21:34 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x697LYE8044739; Tue, 9 Jul 2019 07:21:34 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201907090721.x697LYE8044739@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 9 Jul 2019 07:21:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349855 - stable/11/lib/libc/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/lib/libc/sys X-SVN-Commit-Revision: 349855 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 89BA9838E0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 07:21:35 -0000 Author: kib Date: Tue Jul 9 07:21:33 2019 New Revision: 349855 URL: https://svnweb.freebsd.org/changeset/base/349855 Log: MFC r349794: Document atomicity for read(2) and write(2). Modified: stable/11/lib/libc/sys/read.2 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/sys/read.2 ============================================================================== --- stable/11/lib/libc/sys/read.2 Tue Jul 9 07:19:36 2019 (r349854) +++ stable/11/lib/libc/sys/read.2 Tue Jul 9 07:21:33 2019 (r349855) @@ -28,7 +28,7 @@ .\" @(#)read.2 8.4 (Berkeley) 2/26/94 .\" $FreeBSD$ .\" -.Dd December 15, 2015 +.Dd July 6, 2019 .Dt READ 2 .Os .Sh NAME @@ -128,6 +128,25 @@ return the number of bytes actually read and placed in The system guarantees to read the number of bytes requested if the descriptor references a normal file that has that many bytes left before the end-of-file, but in no other case. +.Pp +In accordance with +.St -p1003.1-2004 , +both +.Xr read 2 +and +.Xr write 2 +syscalls are atomic with respect to each other in the effects on file +content, when they operate on regular files. +If two threads each call one of the +.Xr read 2 +or +.Xr write 2 , +syscalls, each call will see either all of the changes of the other call, +or none of them. +The +.Fx +kernel implements this guarantee by locking the file ranges affected by +the calls. .Sh RETURN VALUES If successful, the number of bytes actually read is returned. From owner-svn-src-all@freebsd.org Tue Jul 9 07:24:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B8FE15D2501; Tue, 9 Jul 2019 07:24:20 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E6E7283D39; Tue, 9 Jul 2019 07:24:19 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B4C4624777; Tue, 9 Jul 2019 07:24:19 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x697OJtn045858; Tue, 9 Jul 2019 07:24:19 GMT (envelope-from whu@FreeBSD.org) Received: (from whu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x697OIGR045853; Tue, 9 Jul 2019 07:24:18 GMT (envelope-from whu@FreeBSD.org) Message-Id: <201907090724.x697OIGR045853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: whu set sender to whu@FreeBSD.org using -f From: Wei Hu Date: Tue, 9 Jul 2019 07:24:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349856 - in head/sys/dev/hyperv: include netvsc vmbus X-SVN-Group: head X-SVN-Commit-Author: whu X-SVN-Commit-Paths: in head/sys/dev/hyperv: include netvsc vmbus X-SVN-Commit-Revision: 349856 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E6E7283D39 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.955,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 07:24:20 -0000 Author: whu Date: Tue Jul 9 07:24:18 2019 New Revision: 349856 URL: https://svnweb.freebsd.org/changeset/base/349856 Log: hyperv/vmbus: Update VMBus version 4.0 and 5.0 support. Add VMBus protocol version 4.0. and 5.0 to support Windows 10 and newer HyperV hosts. For VMBus 4.0 and newer HyperV, the netvsc gpadl teardown must be done after vmbus close. Submitted by: whu MFC after: 2 weeks Sponsored by: Microsoft Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/include/vmbus.h head/sys/dev/hyperv/netvsc/hn_nvs.c head/sys/dev/hyperv/netvsc/if_hn.c head/sys/dev/hyperv/vmbus/vmbus.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Tue Jul 9 07:21:33 2019 (r349855) +++ head/sys/dev/hyperv/include/hyperv.h Tue Jul 9 07:24:18 2019 (r349856) @@ -94,6 +94,11 @@ extern hyperv_tc64_t hyperv_tc64; extern u_int hyperv_features; /* CPUID_HV_MSR_ */ extern u_int hyperv_ver_major; +/* + * Vmbus version after negotiation with host. + */ +extern uint32_t vmbus_current_version; + #endif /* _KERNEL */ #endif /* _HYPERV_H_ */ Modified: head/sys/dev/hyperv/include/vmbus.h ============================================================================== --- head/sys/dev/hyperv/include/vmbus.h Tue Jul 9 07:21:33 2019 (r349855) +++ head/sys/dev/hyperv/include/vmbus.h Tue Jul 9 07:24:18 2019 (r349856) @@ -40,11 +40,15 @@ * 1.1 -- Windows 7 * 2.4 -- Windows 8 * 3.0 -- Windows 8.1 + * 4.0 -- Windows 10 + * 5.0 -- Newer Windows 10 */ #define VMBUS_VERSION_WS2008 ((0 << 16) | (13)) #define VMBUS_VERSION_WIN7 ((1 << 16) | (1)) #define VMBUS_VERSION_WIN8 ((2 << 16) | (4)) #define VMBUS_VERSION_WIN8_1 ((3 << 16) | (0)) +#define VMBUS_VERSION_WIN10 ((4 << 16) | (0)) +#define VMBUS_VERSION_WIN10_V5 ((5 << 16) | (0)) #define VMBUS_VERSION_MAJOR(ver) (((uint32_t)(ver)) >> 16) #define VMBUS_VERSION_MINOR(ver) (((uint32_t)(ver)) & 0xffff) Modified: head/sys/dev/hyperv/netvsc/hn_nvs.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hn_nvs.c Tue Jul 9 07:21:33 2019 (r349855) +++ head/sys/dev/hyperv/netvsc/hn_nvs.c Tue Jul 9 07:24:18 2019 (r349856) @@ -365,7 +365,7 @@ hn_nvs_disconn_rxbuf(struct hn_softc *sc) pause("lingtx", (200 * hz) / 1000); } - if (sc->hn_rxbuf_gpadl != 0) { + if (vmbus_current_version < VMBUS_VERSION_WIN10 && sc->hn_rxbuf_gpadl != 0) { /* * Disconnect RXBUF from primary channel. */ @@ -426,7 +426,7 @@ hn_nvs_disconn_chim(struct hn_softc *sc) pause("lingtx", (200 * hz) / 1000); } - if (sc->hn_chim_gpadl != 0) { + if (vmbus_current_version < VMBUS_VERSION_WIN10 && sc->hn_chim_gpadl != 0) { /* * Disconnect chimney sending buffer from primary channel. */ Modified: head/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hn.c Tue Jul 9 07:21:33 2019 (r349855) +++ head/sys/dev/hyperv/netvsc/if_hn.c Tue Jul 9 07:24:18 2019 (r349856) @@ -6630,6 +6630,38 @@ hn_synth_detach(struct hn_softc *sc) /* Detach all of the channels. */ hn_detach_allchans(sc); + if (vmbus_current_version >= VMBUS_VERSION_WIN10 && sc->hn_rxbuf_gpadl != 0) { + /* + * Host is post-Win2016, disconnect RXBUF from primary channel here. + */ + int error; + + error = vmbus_chan_gpadl_disconnect(sc->hn_prichan, + sc->hn_rxbuf_gpadl); + if (error) { + if_printf(sc->hn_ifp, + "rxbuf gpadl disconn failed: %d\n", error); + sc->hn_flags |= HN_FLAG_RXBUF_REF; + } + sc->hn_rxbuf_gpadl = 0; + } + + if (vmbus_current_version >= VMBUS_VERSION_WIN10 && sc->hn_chim_gpadl != 0) { + /* + * Host is post-Win2016, disconnect chimney sending buffer from + * primary channel here. + */ + int error; + + error = vmbus_chan_gpadl_disconnect(sc->hn_prichan, + sc->hn_chim_gpadl); + if (error) { + if_printf(sc->hn_ifp, + "chim gpadl disconn failed: %d\n", error); + sc->hn_flags |= HN_FLAG_CHIM_REF; + } + sc->hn_chim_gpadl = 0; + } sc->hn_flags &= ~HN_FLAG_SYNTH_ATTACHED; } Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 9 07:21:33 2019 (r349855) +++ head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 9 07:24:18 2019 (r349856) @@ -138,7 +138,10 @@ SYSCTL_INT(_hw_vmbus, OID_AUTO, pin_evttask, CTLFLAG_R extern inthand_t IDTVEC(vmbus_isr), IDTVEC(vmbus_isr_pti); +uint32_t vmbus_current_version; + static const uint32_t vmbus_version[] = { + VMBUS_VERSION_WIN10, VMBUS_VERSION_WIN8_1, VMBUS_VERSION_WIN8, VMBUS_VERSION_WIN7, @@ -412,6 +415,7 @@ vmbus_init(struct vmbus_softc *sc) error = vmbus_connect(sc, vmbus_version[i]); if (!error) { + vmbus_current_version = vmbus_version[i]; sc->vmbus_version = vmbus_version[i]; device_printf(sc->vmbus_dev, "version %u.%u\n", VMBUS_VERSION_MAJOR(sc->vmbus_version), From owner-svn-src-all@freebsd.org Tue Jul 9 08:21:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B855F15D381A; Tue, 9 Jul 2019 08:21:15 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5AF9385B74; Tue, 9 Jul 2019 08:21:15 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 368B725135; Tue, 9 Jul 2019 08:21:15 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x698LF7J074061; Tue, 9 Jul 2019 08:21:15 GMT (envelope-from whu@FreeBSD.org) Received: (from whu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x698LFJS074060; Tue, 9 Jul 2019 08:21:15 GMT (envelope-from whu@FreeBSD.org) Message-Id: <201907090821.x698LFJS074060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: whu set sender to whu@FreeBSD.org using -f From: Wei Hu Date: Tue, 9 Jul 2019 08:21:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349857 - head/sys/dev/hyperv/netvsc X-SVN-Group: head X-SVN-Commit-Author: whu X-SVN-Commit-Paths: head/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 349857 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5AF9385B74 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.934,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 08:21:15 -0000 Author: whu Date: Tue Jul 9 08:21:14 2019 New Revision: 349857 URL: https://svnweb.freebsd.org/changeset/base/349857 Log: hyperv/vmbus: Fix the wrong size in ndis_offload structure Submitted by: whu MFC after: 2 weeks Sponsored by: Microsoft Modified: head/sys/dev/hyperv/netvsc/ndis.h Modified: head/sys/dev/hyperv/netvsc/ndis.h ============================================================================== --- head/sys/dev/hyperv/netvsc/ndis.h Tue Jul 9 07:24:18 2019 (r349856) +++ head/sys/dev/hyperv/netvsc/ndis.h Tue Jul 9 08:21:14 2019 (r349857) @@ -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_ */ - uint8_t ndis_encap; /* NDIS_OFFLOAD_SET_ */ - uint8_t ndis_encap_types;/* NDIS_ENCAP_TYPE_ */ + uint32_t ndis_encap; /* NDIS_OFFLOAD_SET_ */ + uint32_t ndis_encap_types;/* NDIS_ENCAP_TYPE_ */ }; #define NDIS_OFFLOAD_PARAMS_SIZE sizeof(struct ndis_offload_params) From owner-svn-src-all@freebsd.org Tue Jul 9 09:09:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 449AA15D46A7; Tue, 9 Jul 2019 09:09:53 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D2E1187642; Tue, 9 Jul 2019 09:09:52 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A275025846; Tue, 9 Jul 2019 09:09:52 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6999qov097282; Tue, 9 Jul 2019 09:09:52 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6999qlA097280; Tue, 9 Jul 2019 09:09:52 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201907090909.x6999qlA097280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Tue, 9 Jul 2019 09:09:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349858 - stable/12/tests/sys/netpfil/pf X-SVN-Group: stable-12 X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: stable/12/tests/sys/netpfil/pf X-SVN-Commit-Revision: 349858 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D2E1187642 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.947,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 09:09:53 -0000 Author: lwhsu Date: Tue Jul 9 09:09:51 2019 New Revision: 349858 URL: https://svnweb.freebsd.org/changeset/base/349858 Log: MFC r349539 Skip sys.netpfil.pf.names.names and sys.netpfil.pf.synproxy.synproxy temporarily because kernel panics when flushing epair queue. PR: 238870 Sponsored by: The FreeBSD Foundation Modified: stable/12/tests/sys/netpfil/pf/names.sh stable/12/tests/sys/netpfil/pf/synproxy.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/tests/sys/netpfil/pf/names.sh ============================================================================== --- stable/12/tests/sys/netpfil/pf/names.sh Tue Jul 9 08:21:14 2019 (r349857) +++ stable/12/tests/sys/netpfil/pf/names.sh Tue Jul 9 09:09:51 2019 (r349858) @@ -11,6 +11,7 @@ names_head() names_body() { + atf_skip "Kernel panics when flushing epair queue (bug238870)" pft_init epair=$(vnet_mkepair) Modified: stable/12/tests/sys/netpfil/pf/synproxy.sh ============================================================================== --- stable/12/tests/sys/netpfil/pf/synproxy.sh Tue Jul 9 08:21:14 2019 (r349857) +++ stable/12/tests/sys/netpfil/pf/synproxy.sh Tue Jul 9 09:09:51 2019 (r349858) @@ -11,6 +11,7 @@ synproxy_head() synproxy_body() { + atf_skip "Kernel panics when flushing epair queue (bug238870)" pft_init epair=$(vnet_mkepair) From owner-svn-src-all@freebsd.org Tue Jul 9 13:44:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD61815DB1F1; Tue, 9 Jul 2019 13:44:33 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 811046ADE2; Tue, 9 Jul 2019 13:44:33 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E4C97E3; Tue, 9 Jul 2019 13:44:33 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x69DiXxt041660; Tue, 9 Jul 2019 13:44:33 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x69DiXhN041658; Tue, 9 Jul 2019 13:44:33 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201907091344.x69DiXhN041658@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 9 Jul 2019 13:44:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349860 - in stable/11/release/doc: en_US.ISO8859-1/errata share/xml X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in stable/11/release/doc: en_US.ISO8859-1/errata share/xml X-SVN-Commit-Revision: 349860 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 811046ADE2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.962,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 13:44:34 -0000 Author: gjb Date: Tue Jul 9 13:44:32 2019 New Revision: 349860 URL: https://svnweb.freebsd.org/changeset/base/349860 Log: Sync the 11-STABLE errata page with the releng/11.3 version. Bump version numbers accordingly. Fix wording regarding an entry about bhyve VMs compiled with clang 8.0.0. [1] Reported by: jhb [1] Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC (Netgate) Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml stable/11/release/doc/share/xml/release.ent Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Tue Jul 9 12:13:58 2019 (r349859) +++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Tue Jul 9 13:44:32 2019 (r349860) @@ -24,7 +24,7 @@ $FreeBSD$ - 2018 + 2019 The &os; Documentation Project @@ -49,7 +49,8 @@ &os;. This errata document for &os; &release; will be maintained - until the release of &os; &release.next;. + until the release of &os; &release.next; (if + applicable). @@ -96,157 +97,37 @@ - &os;/&arch.i386; installed on ZFS may crash during boot - when the ZFS pool mount is attempted while booting an - unmodified GENERIC kernel. - - A system tunable has been added as of revision - r286584 to make the - kern.kstack_pages tunable configurable - without recompiling the kernel. - - To mitigate system crashes with such configurations, - choose Escape to loader prompt in the - boot menu and enter the following lines from &man.loader.8; - prompt, after an OK: - - set kern.kstack_pages=4 -boot - - Add this line to - /boot/loader.conf for the change to - persist across reboots: - - kern.kstack_pages=4 + [2019-07-04] An issue which can cause a crash when + connecting to a &man.bhyve.4; instance with + a VNC client under certain circumstances + had been reported. An errata notice is planned + post-release. - [2017-07-25] &os;/&arch.arm64; currently lacks - EFI real-time clock - (RTC) support, which may cause the system - to boot with the wrong time set. + [2019-07-04] An issue booting &man.bhyve.4; virtual + machines compiled with &man.clang.1; version 8.0.0 or later + had been reported late in the release cycle. An errata + notice is planned post-release. - As a workaround, either enable &man.ntpdate.8; or - include ntpd_sync_on_start="YES" in - &man.rc.conf.5;. + This issue is believed to only affect OpenBSD virtual + machines compiled with &man.clang.1;. - [2017-07-25] A late issue was discovered with - &os;/&arch.arm64; and "root on - ZFS" installations where the root - ZFS pool would fail to be located. + [2019-07-04] An issue when upgrading from &os; 11.3 + to &os; 12.0 (which occurred earlier in time, + comparatively), had been reported where the + com.delphix:spacemap_v2 &man.zpool.8; + feature does not exist on &os; 12.0, will fail to + import the ZFS pool. - There currently is no workaround. - + At this time, it is advised to defer migrating from + &os; 11.3 to &os; 12.x until &os; 12.1 is + available. - - [2017-11-06] An issue with &os; virtual machines with - vagrant was discovered that - affects the VirtualBox where the - virtual machine will not start on the initial boot invoked - with vagrant up. - - The issue is due to the virtual machine - MAC being unset, as &os; does not provide - a default Vagrantfile. - - It has been observed, however, that a subsequent - invocation of vagrant up will allow the - virtual machine to successfully boot, allowing access via - vagrant ssh. - - - - [2018-06-21] An issue had been discovered late in the - release cycle where removing ZFS vdevs - from a pool under certain conditions would cause a system - crash when &man.zfsd.8; is enabled in - &man.rc.conf.5;. - - At present, it is believed to be limited to removal of - a mirror vdev from a pool consisting of - multiple mirror vdevs. - - See PR 228750 - for more information and updates as the issue is - investigated. - - - - [2018-06-26] An issue had been discovered late in the - release cycle where a system crash could occur after - installing emulators/virtualbox-ose-kmod - from upstream package mirrors via &man.pkg.8;. - - Building emulators/virtualbox-ose-kmod - from the &man.ports.7; collection has been observed to work - around the crash. - - See PR 228535 - for more information. - - - - [2018-06-26] It was discovered after the releng/11.2 branch was tagged - for &os; 11.2-RELEASE that a few device drivers were - missing from the hardware - page. The missing drivers, &man.alc.4;, &man.cxgbev.4;, - &man.liquidio.4;, and &man.mos.4; were added to the - 11-STABLE hardware - page. - - - - [2018-06-26] The URL to the - instructions for source-based upgrades in - UPDATING incorrectly points to a page - that no longer exists. The correct URL is . - - - - [2018-06-27] The announcement email for &os; 11.2 - incorrectly states the ocs_fw(4) driver - had been added; this should have stated - &man.ocs.fc.4;. - - - - [2018-06-28] An issue had been reported after the - release of &os; 11.2 with x11/nvidia-driver installed from - the upstream package mirrors via &man.pkg.8;. - - Building x11/nvidia-driver from - the &man.ports.7; collection has been reported to resolve - the issue. - - See PR 228536 - for more information. - - - - [2018-10-18] A &os; system with a custom kernel - configuration excluding NFS on 10.x did - not explicitly require the krpc option to - be included when booting via ZFS-on-root - and, for example, setting - MODULES_OVERRIDE="zfs opensolaris" in the - kernel configuration. - - In 11.x, however, krpc is explicitly - required if the kernel configuration excludes - NFS. + Upgrading from earlier &os; 11.x releases to + &os; 12.0 are believed to be unaffected. Modified: stable/11/release/doc/share/xml/release.ent ============================================================================== --- stable/11/release/doc/share/xml/release.ent Tue Jul 9 12:13:58 2019 (r349859) +++ stable/11/release/doc/share/xml/release.ent Tue Jul 9 13:44:32 2019 (r349860) @@ -6,23 +6,23 @@ - + - + - + - + - + From owner-svn-src-all@freebsd.org Tue Jul 9 15:48:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D9C215DD5EC; Tue, 9 Jul 2019 15:48:09 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id AA4DA6F1E4; Tue, 9 Jul 2019 15:48:08 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 8CF2714A4AB; Wed, 10 Jul 2019 01:47:55 +1000 (AEST) Date: Wed, 10 Jul 2019 01:47:53 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Scott Long cc: Bruce Evans , Doug Moore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349791 - head/sys/vm In-Reply-To: <4BC14FB0-F79B-48DA-98E1-40B20552EA11@samsco.org> Message-ID: <20190709235218.N1412@besplex.bde.org> References: <201907061555.x66FtGsg025314@repo.freebsd.org> <20190707023441.B2047@besplex.bde.org> <4BC14FB0-F79B-48DA-98E1-40B20552EA11@samsco.org> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=D+Q3ErZj c=1 sm=1 tr=0 cx=a_idp_d a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=nlC_4_pT8q9DhB4Ho9EA:9 a=q1NqS2nZEG050URDlaAA:9 a=PRXq6q6k_7zjf5kn:21 a=TWJIdX50S6YODk6M:21 a=45ClL6m2LaAA:10 X-Rspamd-Queue-Id: AA4DA6F1E4 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.93 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.933,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 15:48:09 -0000 On Mon, 8 Jul 2019, Scott Long wrote: > This isn=E2=80=99t the first time I=E2=80=99ve witnessed your passion on = this topic. It would > help immensely if there was some documentation, maybe in /sys/sys/param.h= , > or maybe even in a manual page, on what a =E2=80=9Cclick=E2=80=9D is, wha= t a =E2=80=9Cdb=E2=80=9D is, why > they=E2=80=99re important, and how they should be used. Do you have any > documentation tucked away that could be edited and committed? I don't have any extra documentation. I learned about clicks because Minix had them and actually used them in a nontrivial way (1 click =3D 16 bytes =3D real mode segment granularity, and 16-bit ints could could represent the final click address in the real-mode address space of 1MB but not the size of the whole address space). Mike Karels gave more details about this. PDP-11's had 64-bit clicks. I think this was also to extend the 16-bit address space in a less bad way that x86 real mode segments. Google says that NetBSD has dbtob(9). This is a link to ctod(9). This man page does little more than say "The ctod family of macros can be used to convert between bytes, pages (''clicks'') and disk blocks" and expand the abbreviations. 'c' is expanded to 'pages', and there are no documented macros where 'pages' is abbreviated to 'p'. The full list is: - ctod (spelled ctodb() in FreeBSD), - dtoc (similarly), - ctob, - btoc, - dbtob (same spelling as in FreeBSD). - btodb. One detail is interesting: that the macros make no assumption about the type of the input parameter (this is clearly wrong since signed types with negative values don't work when the implementation uses shifts, floating-point types are further from working, and non-arithmetic types can't work), and that the caller must ensure that integer overflow and integer underflow do not occur (here "integer underflow" is nonsense" -- it means integer overflow to a negative value). 4.4BSD-Lite2 has these macros with the NetBSD spellings, and also on i386, tahoe and vax: - ctos, stoc: core clicks to segments. All do the identity conversion. None are used on any arch. FreeBSD-1.0 has similar or the same macros as 4.4BSD-Lite2, including implementation and comments. FreeBSD-3 doesn't have ctos or stoc, and abbreviates 'disk block' to 'db' consistently, and improves some of the implementations and comments. FreeBSD-current is similar to FreeBSD-3, except most of the macros are now MI and it has lost better comments which were only in the alpha version. FreeBSD's actually documents most of these macros reasonably well in comments. It just uses different styles and random grouping. Only btodb and dbtob end up without a comment giving a hint about what b and db are. The comments for dbtoc and ctodb tell you that a db is a devblk and a c is a page. Other comments tell you that a c is a click. Bruce From owner-svn-src-all@freebsd.org Tue Jul 9 17:17:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4911E15DFA65; Tue, 9 Jul 2019 17:17:51 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EBCC973054; Tue, 9 Jul 2019 17:17:50 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C17C22B2C; Tue, 9 Jul 2019 17:17:50 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x69HHoHt051415; Tue, 9 Jul 2019 17:17:50 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x69HHkI6051390; Tue, 9 Jul 2019 17:17:46 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201907091717.x69HHkI6051390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Tue, 9 Jul 2019 17:17:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r349861 - in vendor-sys/acpica/dist: . source/compiler source/components/dispatcher source/components/events source/components/executer source/components/namespace source/components/tab... X-SVN-Group: vendor-sys X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in vendor-sys/acpica/dist: . source/compiler source/components/dispatcher source/components/events source/components/executer source/components/namespace source/components/tables source/components/uti... X-SVN-Commit-Revision: 349861 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EBCC973054 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.952,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 17:17:51 -0000 Author: jkim Date: Tue Jul 9 17:17:45 2019 New Revision: 349861 URL: https://svnweb.freebsd.org/changeset/base/349861 Log: Import ACPICA 20190703. Modified: vendor-sys/acpica/dist/changes.txt vendor-sys/acpica/dist/source/compiler/asldefine.h vendor-sys/acpica/dist/source/compiler/aslglobal.h vendor-sys/acpica/dist/source/compiler/aslload.c vendor-sys/acpica/dist/source/compiler/aslmessages.c vendor-sys/acpica/dist/source/compiler/aslmessages.h vendor-sys/acpica/dist/source/compiler/aslstubs.c vendor-sys/acpica/dist/source/compiler/aslsupport.l vendor-sys/acpica/dist/source/components/dispatcher/dsinit.c vendor-sys/acpica/dist/source/components/events/evgpe.c vendor-sys/acpica/dist/source/components/events/evgpeblk.c vendor-sys/acpica/dist/source/components/events/evxface.c vendor-sys/acpica/dist/source/components/events/evxfgpe.c vendor-sys/acpica/dist/source/components/executer/exconfig.c vendor-sys/acpica/dist/source/components/namespace/nsaccess.c vendor-sys/acpica/dist/source/components/namespace/nseval.c vendor-sys/acpica/dist/source/components/namespace/nsinit.c vendor-sys/acpica/dist/source/components/namespace/nsload.c vendor-sys/acpica/dist/source/components/namespace/nsutils.c vendor-sys/acpica/dist/source/components/tables/tbdata.c vendor-sys/acpica/dist/source/components/tables/tbxfload.c vendor-sys/acpica/dist/source/components/utilities/utinit.c vendor-sys/acpica/dist/source/components/utilities/utxfinit.c vendor-sys/acpica/dist/source/include/acevents.h vendor-sys/acpica/dist/source/include/acglobal.h vendor-sys/acpica/dist/source/include/acnamesp.h vendor-sys/acpica/dist/source/include/acpixf.h vendor-sys/acpica/dist/source/include/platform/acmsvc.h vendor-sys/acpica/dist/source/include/platform/acwin.h vendor-sys/acpica/dist/source/include/platform/acwin64.h vendor-sys/acpica/dist/source/tools/acpiexec/aetests.c vendor-sys/acpica/dist/source/tools/acpinames/anstubs.c vendor-sys/acpica/dist/source/tools/acpixtract/axmain.c Modified: vendor-sys/acpica/dist/changes.txt ============================================================================== --- vendor-sys/acpica/dist/changes.txt Tue Jul 9 13:44:32 2019 (r349860) +++ vendor-sys/acpica/dist/changes.txt Tue Jul 9 17:17:45 2019 (r349861) @@ -1,4 +1,53 @@ ---------------------------------------- +03 July 2019. Summary of changes for version 20190703: + + +1) ACPICA kernel-resident subsystem: + +Remove legacy module-level support code. There were still some remnants +of the legacy module-level code executions. Since we no longer support +this option, this is essentially dead code and has been removed from the +ACPICA source. + +iASL: ensure that _WAK, _PTS, _TTS, and _Sx are declared only at the root +scope. If these named objects are declared outside the root scope, they +will not be invoked by any host Operating System. + +Clear status of GPEs on first direct enable. ACPI GPEs (other than the EC +one) can be enabled in two situations. First, the GPEs with existing _Lxx +and _Exx methods are enabled implicitly by ACPICA during system +initialization. Second, the GPEs without these methods (like GPEs listed +by _PRW objects for wakeup devices) need to be enabled directly by the +code that is going to use them (e.g. ACPI power management or device +drivers). + +In the former case, if the status of a given GPE is set to start with, +its handler method (either _Lxx or _Exx) needs to be invoked to take care +of the events (possibly) signaled before the GPE was enabled. In the +latter case, however, the first caller of AcpiEnableGpe() for a given GPE +should not be expected to care about any events that might be signaled +through it earlier. In that case, it is better to clear the status of +the GPE before enabling it, to prevent stale events from triggering +unwanted actions (like spurious system resume, for example). + +For this reason, modify AcpiEvAddGpeReference() to take an additional +boolean argument indicating whether or not the GPE status needs to be +cleared when its reference counter changes from zero to one and make +AcpiEnableGpe() pass TRUE to it through that new argument. + + +2) iASL Compiler/Disassembler and ACPICA tools: + +The tool generation process has been migrated to MSVC 2017, and all +project files have been upgraded. The new project files appear in the +directory \acpica\generate\msvc2017. This change effectively deprecates +the older project files in \acpica\generate\msvc9. + +iASL: ensure that _WAK, _PTS, _TTS, and _Sx are declared only at the root +scope. If these named objects are declared outside the root scope, they +will not be invoked by any host Operating System + +---------------------------------------- 09 May 2019. Summary of changes for version 20190509: Modified: vendor-sys/acpica/dist/source/compiler/asldefine.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/asldefine.h Tue Jul 9 13:44:32 2019 (r349860) +++ vendor-sys/acpica/dist/source/compiler/asldefine.h Tue Jul 9 17:17:45 2019 (r349861) @@ -298,4 +298,20 @@ #define COMMENT_CAPTURE_ON AslGbl_CommentState.CaptureComments = TRUE; #define COMMENT_CAPTURE_OFF AslGbl_CommentState.CaptureComments = FALSE; +/* + * Special name segments - these must only be declared at the root scope + */ +#define NAMESEG__PTS "_PTS" +#define NAMESEG__WAK "_WAK" +#define NAMESEG__S0 "_S0_" +#define NAMESEG__S1 "_S1_" +#define NAMESEG__S2 "_S2_" +#define NAMESEG__S3 "_S3_" +#define NAMESEG__S4 "_S4_" +#define NAMESEG__S5 "_S5_" +#define NAMESEG__TTS "_TTS" + +#define MAX_SPECIAL_NAMES 9 + + #endif /* ASLDEFINE.H */ Modified: vendor-sys/acpica/dist/source/compiler/aslglobal.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslglobal.h Tue Jul 9 13:44:32 2019 (r349860) +++ vendor-sys/acpica/dist/source/compiler/aslglobal.h Tue Jul 9 17:17:45 2019 (r349861) @@ -223,11 +223,26 @@ const char *AslGbl_OpFlagName "OP_NOT_FOUND_DURING_LOAD" }; +const char *AslGbl_SpecialNamedObjects [MAX_SPECIAL_NAMES] = +{ + NAMESEG__PTS, + NAMESEG__WAK, + NAMESEG__S0, + NAMESEG__S1, + NAMESEG__S2, + NAMESEG__S3, + NAMESEG__S4, + NAMESEG__S5, + NAMESEG__TTS +}; + #else extern ASL_FILE_DESC AslGbl_FileDescs [ASL_NUM_FILES]; extern UINT32 AslGbl_ExceptionCount[ASL_NUM_REPORT_LEVELS]; extern const char *AslGbl_OpFlagNames[ACPI_NUM_OP_FLAGS]; +extern const char *AslGbl_SpecialNamedObjects[MAX_SPECIAL_NAMES]; #endif + /* Modified: vendor-sys/acpica/dist/source/compiler/aslload.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslload.c Tue Jul 9 13:44:32 2019 (r349860) +++ vendor-sys/acpica/dist/source/compiler/aslload.c Tue Jul 9 17:17:45 2019 (r349861) @@ -164,6 +164,7 @@ static ACPI_STATUS LdLoadFieldElements ( + UINT32 AmlType, ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState); @@ -190,6 +191,10 @@ LdCommonNamespaceEnd ( UINT32 Level, void *Context); +static void +LdCheckSpecialNames ( + ACPI_NAMESPACE_NODE *Node, + ACPI_PARSE_OBJECT *Op); /******************************************************************************* * @@ -247,7 +252,8 @@ LdLoadNamespace ( * * FUNCTION: LdLoadFieldElements * - * PARAMETERS: Op - Parent node (Field) + * PARAMETERS: AmlType - Type to search + * Op - Parent node (Field) * WalkState - Current walk state * * RETURN: Status @@ -259,6 +265,7 @@ LdLoadNamespace ( static ACPI_STATUS LdLoadFieldElements ( + UINT32 AmlType, ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState) { @@ -274,7 +281,7 @@ LdLoadFieldElements ( { Status = AcpiNsLookup (WalkState->ScopeInfo, SourceRegion->Asl.Value.String, - ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, + AmlType, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node); if (Status == AE_NOT_FOUND) { @@ -507,11 +514,15 @@ LdNamespace1Begin ( */ switch (Op->Asl.AmlOpcode) { - case AML_BANK_FIELD_OP: case AML_INDEX_FIELD_OP: + + Status = LdLoadFieldElements (ACPI_TYPE_LOCAL_REGION_FIELD, Op, WalkState); + return (Status); + + case AML_BANK_FIELD_OP: case AML_FIELD_OP: - Status = LdLoadFieldElements (Op, WalkState); + Status = LdLoadFieldElements (ACPI_TYPE_REGION, Op, WalkState); return (Status); case AML_INT_CONNECTION_OP: @@ -966,6 +977,10 @@ LdNamespace1Begin ( } } + /* Check special names like _WAK and _PTS */ + + LdCheckSpecialNames (Node, Op); + if (ForceNewScope) { Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); @@ -1001,6 +1016,42 @@ FinishNode: } return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: LdCheckSpecialNames + * + * PARAMETERS: Node - Node that represents the named object + * Op - Named object declaring this named object + * + * RETURN: None + * + * DESCRIPTION: Check if certain named objects are declared in the incorrect + * scope. Special named objects are listed in + * AslGbl_SpecialNamedObjects and can only be declared at the root + * scope. + * + ******************************************************************************/ + +static void +LdCheckSpecialNames ( + ACPI_NAMESPACE_NODE *Node, + ACPI_PARSE_OBJECT *Op) +{ + UINT32 i; + + + for (i = 0; i < MAX_SPECIAL_NAMES; i++) + { + if (ACPI_COMPARE_NAMESEG(Node->Name.Ascii, AslGbl_SpecialNamedObjects[i]) && + Node->Parent != AcpiGbl_RootNode) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_SPECIAL_NAME, Op, Op->Asl.ExternalName); + return; + } + } } Modified: vendor-sys/acpica/dist/source/compiler/aslmessages.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslmessages.c Tue Jul 9 13:44:32 2019 (r349860) +++ vendor-sys/acpica/dist/source/compiler/aslmessages.c Tue Jul 9 17:17:45 2019 (r349861) @@ -365,7 +365,8 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_REGION_LENGTH */ "Operation Region declared with zero length", /* ASL_MSG_TEMPORARY_OBJECT */ "Object is created temporarily in another method and cannot be accessed", /* ASL_MSG_UNDEFINED_EXTERNAL */ "Named object was declared external but the actual definition does not exist", -/* ASL_MSG_BUFFER_FIELD_OVERFLOW */ "Buffer field extends beyond end of target buffer" +/* ASL_MSG_BUFFER_FIELD_OVERFLOW */ "Buffer field extends beyond end of target buffer", +/* ASL_MSG_INVALID_SPECIAL_NAME */ "declaration of this named object outside root scope is illegal" }; /* Table compiler */ Modified: vendor-sys/acpica/dist/source/compiler/aslmessages.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslmessages.h Tue Jul 9 13:44:32 2019 (r349860) +++ vendor-sys/acpica/dist/source/compiler/aslmessages.h Tue Jul 9 17:17:45 2019 (r349861) @@ -368,6 +368,7 @@ typedef enum ASL_MSG_TEMPORARY_OBJECT, ASL_MSG_UNDEFINED_EXTERNAL, ASL_MSG_BUFFER_FIELD_OVERFLOW, + ASL_MSG_INVALID_SPECIAL_NAME, /* These messages are used by the Data Table compiler only */ Modified: vendor-sys/acpica/dist/source/compiler/aslstubs.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslstubs.c Tue Jul 9 13:44:32 2019 (r349860) +++ vendor-sys/acpica/dist/source/compiler/aslstubs.c Tue Jul 9 17:17:45 2019 (r349861) @@ -166,12 +166,6 @@ * Things like Events, Global Lock, etc. are not used * by the compiler, so they are stubbed out here. */ -void -AcpiNsExecModuleCodeList ( - void) -{ -} - ACPI_STATUS AcpiNsInitializeObjects ( void) Modified: vendor-sys/acpica/dist/source/compiler/aslsupport.l ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslsupport.l Tue Jul 9 13:44:32 2019 (r349860) +++ vendor-sys/acpica/dist/source/compiler/aslsupport.l Tue Jul 9 17:17:45 2019 (r349861) @@ -220,7 +220,7 @@ AslDoLineDirective ( while ((c = input()) != '\n' && c != EOF) { - *AslGbl_LineBufPtr = c; + *AslGbl_LineBufPtr = (char) c; AslGbl_LineBufPtr++; } *AslGbl_LineBufPtr = 0; @@ -498,7 +498,7 @@ AslInsertLineBuffer ( if (AcpiGbl_CaptureComments) { - CvProcessCommentState (SourceChar); + CvProcessCommentState ((char) SourceChar); } } } @@ -601,7 +601,7 @@ loop: AslInsertLineBuffer (c); if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { - *StringBuffer = c; + *StringBuffer = (char) c; ++StringBuffer; } c1 = c; @@ -629,7 +629,7 @@ loop: AslInsertLineBuffer (c); if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { - *StringBuffer = c; + *StringBuffer = (char) c; ++StringBuffer; } @@ -720,7 +720,7 @@ AslDoCommentType2 ( AslInsertLineBuffer (c); if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { - *StringBuffer = c; + *StringBuffer = (char) c; ++StringBuffer; } } @@ -878,7 +878,7 @@ DoCharacter: if (ACPI_IS_OCTAL_DIGIT (StringChar)) { State = ASL_OCTAL_CONSTANT; - ConvertBuffer[0] = StringChar; + ConvertBuffer[0] = (char) StringChar; i = 1; continue; } @@ -934,7 +934,7 @@ DoCharacter: /* Append another digit of the constant */ - ConvertBuffer[i] = StringChar; + ConvertBuffer[i] = (char) StringChar; i++; continue; @@ -978,7 +978,7 @@ DoCharacter: /* Append another digit of the constant */ - ConvertBuffer[i] = StringChar; + ConvertBuffer[i] = (char) StringChar; i++; continue; @@ -989,7 +989,7 @@ DoCharacter: /* Save the finished character */ - *StringBuffer = StringChar; + *StringBuffer = (char) StringChar; StringBuffer++; if (StringBuffer >= EndBuffer) { Modified: vendor-sys/acpica/dist/source/components/dispatcher/dsinit.c ============================================================================== --- vendor-sys/acpica/dist/source/components/dispatcher/dsinit.c Tue Jul 9 13:44:32 2019 (r349860) +++ vendor-sys/acpica/dist/source/components/dispatcher/dsinit.c Tue Jul 9 17:17:45 2019 (r349861) @@ -362,7 +362,7 @@ AcpiDsInitializeObjects ( if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_DSDT)) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "\nInitializing Namespace objects:\n")); + "\nACPI table initialization:\n")); } /* Summary of objects initialized */ Modified: vendor-sys/acpica/dist/source/components/events/evgpe.c ============================================================================== --- vendor-sys/acpica/dist/source/components/events/evgpe.c Tue Jul 9 13:44:32 2019 (r349860) +++ vendor-sys/acpica/dist/source/components/events/evgpe.c Tue Jul 9 17:17:45 2019 (r349861) @@ -316,6 +316,7 @@ AcpiEvMaskGpe ( * FUNCTION: AcpiEvAddGpeReference * * PARAMETERS: GpeEventInfo - Add a reference to this GPE + * ClearOnEnable - Clear GPE status before enabling it * * RETURN: Status * @@ -326,7 +327,8 @@ AcpiEvMaskGpe ( ACPI_STATUS AcpiEvAddGpeReference ( - ACPI_GPE_EVENT_INFO *GpeEventInfo) + ACPI_GPE_EVENT_INFO *GpeEventInfo, + BOOLEAN ClearOnEnable) { ACPI_STATUS Status = AE_OK; @@ -343,6 +345,11 @@ AcpiEvAddGpeReference ( if (GpeEventInfo->RuntimeCount == 1) { /* Enable on first reference */ + + if (ClearOnEnable) + { + (void) AcpiHwClearGpe (GpeEventInfo); + } Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo); if (ACPI_SUCCESS (Status)) Modified: vendor-sys/acpica/dist/source/components/events/evgpeblk.c ============================================================================== --- vendor-sys/acpica/dist/source/components/events/evgpeblk.c Tue Jul 9 13:44:32 2019 (r349860) +++ vendor-sys/acpica/dist/source/components/events/evgpeblk.c Tue Jul 9 17:17:45 2019 (r349861) @@ -637,7 +637,7 @@ AcpiEvInitializeGpeBlock ( continue; } - Status = AcpiEvAddGpeReference (GpeEventInfo); + Status = AcpiEvAddGpeReference (GpeEventInfo, FALSE); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, Modified: vendor-sys/acpica/dist/source/components/events/evxface.c ============================================================================== --- vendor-sys/acpica/dist/source/components/events/evxface.c Tue Jul 9 13:44:32 2019 (r349860) +++ vendor-sys/acpica/dist/source/components/events/evxface.c Tue Jul 9 17:17:45 2019 (r349861) @@ -1256,7 +1256,7 @@ AcpiRemoveGpeHandler ( ACPI_GPE_DISPATCH_NOTIFY)) && Handler->OriginallyEnabled) { - (void) AcpiEvAddGpeReference (GpeEventInfo); + (void) AcpiEvAddGpeReference (GpeEventInfo, FALSE); if (ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo)) { /* Poll edge triggered GPEs to handle existing events */ Modified: vendor-sys/acpica/dist/source/components/events/evxfgpe.c ============================================================================== --- vendor-sys/acpica/dist/source/components/events/evxfgpe.c Tue Jul 9 13:44:32 2019 (r349860) +++ vendor-sys/acpica/dist/source/components/events/evxfgpe.c Tue Jul 9 17:17:45 2019 (r349861) @@ -267,7 +267,7 @@ AcpiEnableGpe ( if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) != ACPI_GPE_DISPATCH_NONE) { - Status = AcpiEvAddGpeReference (GpeEventInfo); + Status = AcpiEvAddGpeReference (GpeEventInfo, TRUE); if (ACPI_SUCCESS (Status) && ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo)) { Modified: vendor-sys/acpica/dist/source/components/executer/exconfig.c ============================================================================== --- vendor-sys/acpica/dist/source/components/executer/exconfig.c Tue Jul 9 13:44:32 2019 (r349860) +++ vendor-sys/acpica/dist/source/components/executer/exconfig.c Tue Jul 9 17:17:45 2019 (r349861) @@ -342,10 +342,9 @@ AcpiExLoadTableOp ( return_ACPI_STATUS (Status); } - /* Complete the initialization/resolution of package objects */ + /* Complete the initialization/resolution of new objects */ - Status = AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL); + AcpiNsInitializeObjects (); /* Parameter Data (optional) */ @@ -620,10 +619,11 @@ AcpiExLoadOp ( return_ACPI_STATUS (Status); } - /* Complete the initialization/resolution of package objects */ + /* Complete the initialization/resolution of new objects */ - Status = AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL); + AcpiExExitInterpreter (); + AcpiNsInitializeObjects (); + AcpiExEnterInterpreter (); /* Store the DdbHandle into the Target operand */ Modified: vendor-sys/acpica/dist/source/components/namespace/nsaccess.c ============================================================================== --- vendor-sys/acpica/dist/source/components/namespace/nsaccess.c Tue Jul 9 13:44:32 2019 (r349860) +++ vendor-sys/acpica/dist/source/components/namespace/nsaccess.c Tue Jul 9 17:17:45 2019 (r349861) @@ -184,6 +184,7 @@ AcpiNsRootInitialize ( ACPI_STATUS Status; const ACPI_PREDEFINED_NAMES *InitVal = NULL; ACPI_NAMESPACE_NODE *NewNode; + ACPI_NAMESPACE_NODE *PrevNode = NULL; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STRING Val = NULL; @@ -213,13 +214,30 @@ AcpiNsRootInitialize ( */ AcpiGbl_RootNode = &AcpiGbl_RootNodeStruct; - /* Enter the pre-defined names in the name table */ + /* Enter the predefined names in the name table */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Entering predefined entries into namespace\n")); + /* + * Create the initial (default) namespace. + * This namespace looks like something similar to this: + * + * ACPI Namespace (from Namespace Root): + * 0 _GPE Scope 00203160 00 + * 0 _PR_ Scope 002031D0 00 + * 0 _SB_ Device 00203240 00 Notify Object: 0020ADD8 + * 0 _SI_ Scope 002032B0 00 + * 0 _TZ_ Device 00203320 00 + * 0 _REV Integer 00203390 00 = 0000000000000002 + * 0 _OS_ String 00203488 00 Len 14 "Microsoft Windows NT" + * 0 _GL_ Mutex 00203580 00 Object 002035F0 + * 0 _OSI Method 00203678 00 Args 1 Len 0000 Aml 00000000 + */ for (InitVal = AcpiGbl_PreDefinedNames; InitVal->Name; InitVal++) { + Status = AE_OK; + /* _OSI is optional for now, will be permanent later */ if (!strcmp (InitVal->Name, "_OSI") && !AcpiGbl_CreateOsiMethod) @@ -227,17 +245,35 @@ AcpiNsRootInitialize ( continue; } - Status = AcpiNsLookup (NULL, ACPI_CAST_PTR (char, InitVal->Name), - InitVal->Type, ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, - NULL, &NewNode); - if (ACPI_FAILURE (Status)) + /* + * Create, init, and link the new predefined name + * Note: No need to use AcpiNsLookup here because all the + * predefined names are at the root level. It is much easier to + * just create and link the new node(s) here. + */ + NewNode = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_NAMESPACE_NODE)); + if (!NewNode) { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not create predefined name %s", - InitVal->Name)); - continue; + Status = AE_NO_MEMORY; + goto UnlockAndExit; } + ACPI_COPY_NAMESEG (NewNode->Name.Ascii, InitVal->Name); + NewNode->DescriptorType = ACPI_DESC_TYPE_NAMED; + NewNode->Type = InitVal->Type; + + if (!PrevNode) + { + AcpiGbl_RootNodeStruct.Child = NewNode; + } + else + { + PrevNode->Peer = NewNode; + } + + NewNode->Parent = &AcpiGbl_RootNodeStruct; + PrevNode = NewNode; + /* * Name entered successfully. If entry in PreDefinedNames[] specifies * an initial value, create the initial value. @@ -286,7 +322,7 @@ AcpiNsRootInitialize ( NewNode->Value = ObjDesc->Method.ParamCount; #else - /* Mark this as a very SPECIAL method */ + /* Mark this as a very SPECIAL method (_OSI) */ ObjDesc->Method.InfoFlags = ACPI_METHOD_INTERNAL_ONLY; ObjDesc->Method.Dispatch.Implementation = AcpiUtOsiImplementation; @@ -358,7 +394,6 @@ AcpiNsRootInitialize ( AcpiUtRemoveReference (ObjDesc); } } - UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); Modified: vendor-sys/acpica/dist/source/components/namespace/nseval.c ============================================================================== --- vendor-sys/acpica/dist/source/components/namespace/nseval.c Tue Jul 9 13:44:32 2019 (r349860) +++ vendor-sys/acpica/dist/source/components/namespace/nseval.c Tue Jul 9 17:17:45 2019 (r349861) @@ -160,14 +160,7 @@ #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nseval") -/* Local prototypes */ -static void -AcpiNsExecModuleCode ( - ACPI_OPERAND_OBJECT *MethodObj, - ACPI_EVALUATE_INFO *Info); - - /******************************************************************************* * * FUNCTION: AcpiNsEvaluate @@ -464,207 +457,4 @@ Cleanup: ACPI_FREE (Info->FullPathname); Info->FullPathname = NULL; return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsExecModuleCodeList - * - * PARAMETERS: None - * - * RETURN: None. Exceptions during method execution are ignored, since - * we cannot abort a table load. - * - * DESCRIPTION: Execute all elements of the global module-level code list. - * Each element is executed as a single control method. - * - * NOTE: With this option enabled, each block of detected executable AML - * code that is outside of any control method is wrapped with a temporary - * control method object and placed on a global list. The methods on this - * list are executed below. - * - * This function executes the module-level code for all tables only after - * all of the tables have been loaded. It is a legacy option and is - * not compatible with other ACPI implementations. See AcpiNsLoadTable. - * - * This function will be removed when the legacy option is removed. - * - ******************************************************************************/ - -void -AcpiNsExecModuleCodeList ( - void) -{ - ACPI_OPERAND_OBJECT *Prev; - ACPI_OPERAND_OBJECT *Next; - ACPI_EVALUATE_INFO *Info; - UINT32 MethodCount = 0; - - - ACPI_FUNCTION_TRACE (NsExecModuleCodeList); - - - /* Exit now if the list is empty */ - - Next = AcpiGbl_ModuleCodeList; - if (!Next) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES, - "Legacy MLC block list is empty\n")); - - return_VOID; - } - - /* Allocate the evaluation information block */ - - Info = ACPI_ALLOCATE (sizeof (ACPI_EVALUATE_INFO)); - if (!Info) - { - return_VOID; - } - - /* Walk the list, executing each "method" */ - - while (Next) - { - Prev = Next; - Next = Next->Method.Mutex; - - /* Clear the link field and execute the method */ - - Prev->Method.Mutex = NULL; - AcpiNsExecModuleCode (Prev, Info); - MethodCount++; - - /* Delete the (temporary) method object */ - - AcpiUtRemoveReference (Prev); - } - - ACPI_INFO (( - "Executed %u blocks of module-level executable AML code", - MethodCount)); - - ACPI_FREE (Info); - AcpiGbl_ModuleCodeList = NULL; - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsExecModuleCode - * - * PARAMETERS: MethodObj - Object container for the module-level code - * Info - Info block for method evaluation - * - * RETURN: None. Exceptions during method execution are ignored, since - * we cannot abort a table load. - * - * DESCRIPTION: Execute a control method containing a block of module-level - * executable AML code. The control method is temporarily - * installed to the root node, then evaluated. - * - ******************************************************************************/ - -static void -AcpiNsExecModuleCode ( - ACPI_OPERAND_OBJECT *MethodObj, - ACPI_EVALUATE_INFO *Info) -{ - ACPI_OPERAND_OBJECT *ParentObj; - ACPI_NAMESPACE_NODE *ParentNode; - ACPI_OBJECT_TYPE Type; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (NsExecModuleCode); - - - /* - * Get the parent node. We cheat by using the NextObject field - * of the method object descriptor. - */ - ParentNode = ACPI_CAST_PTR ( - ACPI_NAMESPACE_NODE, MethodObj->Method.NextObject); - Type = AcpiNsGetType (ParentNode); - - /* - * Get the region handler and save it in the method object. We may need - * this if an operation region declaration causes a _REG method to be run. - * - * We can't do this in AcpiPsLinkModuleCode because - * AcpiGbl_RootNode->Object is NULL at PASS1. - */ - if ((Type == ACPI_TYPE_DEVICE) && ParentNode->Object) - { - MethodObj->Method.Dispatch.Handler = - ParentNode->Object->Device.Handler; - } - - /* Must clear NextObject (AcpiNsAttachObject needs the field) */ - - MethodObj->Method.NextObject = NULL; - - /* Initialize the evaluation information block */ - - memset (Info, 0, sizeof (ACPI_EVALUATE_INFO)); - Info->PrefixNode = ParentNode; - - /* - * Get the currently attached parent object. Add a reference, - * because the ref count will be decreased when the method object - * is installed to the parent node. - */ - ParentObj = AcpiNsGetAttachedObject (ParentNode); - if (ParentObj) - { - AcpiUtAddReference (ParentObj); - } - - /* Install the method (module-level code) in the parent node */ - - Status = AcpiNsAttachObject (ParentNode, MethodObj, ACPI_TYPE_METHOD); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - /* Execute the parent node as a control method */ - - Status = AcpiNsEvaluate (Info); - - ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES, - "Executed module-level code at %p\n", - MethodObj->Method.AmlStart)); - - /* Delete a possible implicit return value (in slack mode) */ - - if (Info->ReturnObject) - { - AcpiUtRemoveReference (Info->ReturnObject); - } - - /* Detach the temporary method object */ - - AcpiNsDetachObject (ParentNode); - - /* Restore the original parent object */ - - if (ParentObj) - { - Status = AcpiNsAttachObject (ParentNode, ParentObj, Type); - } - else - { - ParentNode->Type = (UINT8) Type; - } - -Exit: - if (ParentObj) - { - AcpiUtRemoveReference (ParentObj); - } - return_VOID; } Modified: vendor-sys/acpica/dist/source/components/namespace/nsinit.c ============================================================================== --- vendor-sys/acpica/dist/source/components/namespace/nsinit.c Tue Jul 9 13:44:32 2019 (r349860) +++ vendor-sys/acpica/dist/source/components/namespace/nsinit.c Tue Jul 9 17:17:45 2019 (r349861) @@ -212,29 +212,30 @@ AcpiNsInitializeObjects ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "**** Starting initialization of namespace objects ****\n")); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "Completing Region/Field/Buffer/Package initialization:\n")); + "Final data object initialization: ")); - /* Set all init info to zero */ + /* Clear the info block */ memset (&Info, 0, sizeof (ACPI_INIT_WALK_INFO)); /* Walk entire namespace from the supplied root */ + /* + * TBD: will become ACPI_TYPE_PACKAGE as this type object + * is now the only one that supports deferred initialization + * (forward references). + */ Status = AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, - &Info, NULL); + ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, &Info, NULL); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace")); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - " Initialized %u/%u Regions %u/%u Fields %u/%u " - "Buffers %u/%u Packages (%u nodes)\n", - Info.OpRegionInit, Info.OpRegionCount, - Info.FieldInit, Info.FieldCount, - Info.BufferInit, Info.BufferCount, - Info.PackageInit, Info.PackageCount, Info.ObjectCount)); + "Namespace contains %u (0x%X) objects\n", + Info.ObjectCount, + Info.ObjectCount)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "%u Control Methods found\n%u Op Regions found\n", @@ -561,35 +562,19 @@ AcpiNsInitOneObject ( AcpiExEnterInterpreter (); /* - * Each of these types can contain executable AML code within the - * declaration. + * Only initialization of Package objects can be deferred, in order + * to support forward references. */ switch (Type) { - case ACPI_TYPE_REGION: + case ACPI_TYPE_LOCAL_BANK_FIELD: - Info->OpRegionInit++; - Status = AcpiDsGetRegionArguments (ObjDesc); - break; + /* TBD: BankFields do not require deferred init, remove this code */ - case ACPI_TYPE_BUFFER_FIELD: - Info->FieldInit++; - Status = AcpiDsGetBufferFieldArguments (ObjDesc); - break; - - case ACPI_TYPE_LOCAL_BANK_FIELD: - - Info->FieldInit++; Status = AcpiDsGetBankFieldArguments (ObjDesc); break; - case ACPI_TYPE_BUFFER: - - Info->BufferInit++; - Status = AcpiDsGetBufferArguments (ObjDesc); - break; - case ACPI_TYPE_PACKAGE: /* Complete the initialization/resolution of the package object */ @@ -600,8 +585,12 @@ AcpiNsInitOneObject ( default: - /* No other types can get here */ + /* No other types should get here */ + Status = AE_TYPE; + ACPI_EXCEPTION ((AE_INFO, Status, + "Opcode is not deferred [%4.4s] (%s)", + AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Type))); break; } Modified: vendor-sys/acpica/dist/source/components/namespace/nsload.c ============================================================================== --- vendor-sys/acpica/dist/source/components/namespace/nsload.c Tue Jul 9 13:44:32 2019 (r349860) +++ vendor-sys/acpica/dist/source/components/namespace/nsload.c Tue Jul 9 17:17:45 2019 (r349861) @@ -268,18 +268,6 @@ Unlock: ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Completed Table Object Initialization\n")); - /* - * This case handles the legacy option that groups all module-level - * code blocks together and defers execution until all of the tables - * are loaded. Execute all of these blocks at this time. - * Execute any module-level code that was detected during the table - * load phase. - * - * Note: this option is deprecated and will be eliminated in the - * future. Use of this option can cause problems with AML code that - * depends upon in-order immediate execution of module-level code. - */ - AcpiNsExecModuleCodeList (); return_ACPI_STATUS (Status); } Modified: vendor-sys/acpica/dist/source/components/namespace/nsutils.c ============================================================================== --- vendor-sys/acpica/dist/source/components/namespace/nsutils.c Tue Jul 9 13:44:32 2019 (r349860) +++ vendor-sys/acpica/dist/source/components/namespace/nsutils.c Tue Jul 9 17:17:45 2019 (r349861) @@ -802,23 +802,10 @@ AcpiNsTerminate ( void) { ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *Prev; - ACPI_OPERAND_OBJECT *Next; ACPI_FUNCTION_TRACE (NsTerminate); - - /* Delete any module-level code blocks */ - - Next = AcpiGbl_ModuleCodeList; - while (Next) - { - Prev = Next; - Next = Next->Method.Mutex; - Prev->Method.Mutex = NULL; /* Clear the Mutex (cheated) field */ - AcpiUtRemoveReference (Prev); - } /* * Free the entire namespace -- all nodes and all objects Modified: vendor-sys/acpica/dist/source/components/tables/tbdata.c ============================================================================== --- vendor-sys/acpica/dist/source/components/tables/tbdata.c Tue Jul 9 13:44:32 2019 (r349860) +++ vendor-sys/acpica/dist/source/components/tables/tbdata.c Tue Jul 9 17:17:45 2019 (r349861) @@ -1191,19 +1191,6 @@ AcpiTbLoadTable ( Status = AcpiNsLoadTable (TableIndex, ParentNode); /* - * This case handles the legacy option that groups all module-level - * code blocks together and defers execution until all of the tables - * are loaded. Execute all of these blocks at this time. - * Execute any module-level code that was detected during the table - * load phase. - * - * Note: this option is deprecated and will be eliminated in the - * future. Use of this option can cause problems with AML code that - * depends upon in-order immediate execution of module-level code. - */ - AcpiNsExecModuleCodeList (); - - /* * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is * responsible for discovering any new wake GPEs by running _PRW methods * that may have been loaded by this table. Modified: vendor-sys/acpica/dist/source/components/tables/tbxfload.c ============================================================================== --- vendor-sys/acpica/dist/source/components/tables/tbxfload.c Tue Jul 9 13:44:32 2019 (r349860) +++ vendor-sys/acpica/dist/source/components/tables/tbxfload.c Tue Jul 9 17:17:45 2019 (r349861) @@ -479,6 +479,13 @@ AcpiLoadTable ( ACPI_INFO (("Host-directed Dynamic ACPI Table Load:")); Status = AcpiTbInstallAndLoadTable (ACPI_PTR_TO_PHYSADDR (Table), ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, FALSE, &TableIndex); + if (ACPI_SUCCESS (Status)) + { + /* Complete the initialization/resolution of new objects */ + + AcpiNsInitializeObjects (); + } + return_ACPI_STATUS (Status); } Modified: vendor-sys/acpica/dist/source/components/utilities/utinit.c ============================================================================== --- vendor-sys/acpica/dist/source/components/utilities/utinit.c Tue Jul 9 13:44:32 2019 (r349860) +++ vendor-sys/acpica/dist/source/components/utilities/utinit.c Tue Jul 9 17:17:45 2019 (r349861) @@ -342,7 +342,6 @@ AcpiUtInitGlobals ( /* Namespace */ - AcpiGbl_ModuleCodeList = NULL; AcpiGbl_RootNode = NULL; AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME; AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED; Modified: vendor-sys/acpica/dist/source/components/utilities/utxfinit.c ============================================================================== --- vendor-sys/acpica/dist/source/components/utilities/utxfinit.c Tue Jul 9 13:44:32 2019 (r349860) +++ vendor-sys/acpica/dist/source/components/utilities/utxfinit.c Tue Jul 9 17:17:45 2019 (r349861) @@ -381,24 +381,17 @@ AcpiInitializeObjects ( ACPI_FUNCTION_TRACE (AcpiInitializeObjects); +#ifdef ACPI_OBSOLETE_BEHAVIOR /* - * This case handles the legacy option that groups all module-level - * code blocks together and defers execution until all of the tables - * are loaded. Execute all of these blocks at this time. - * Execute any module-level code that was detected during the table - * load phase. - * - * Note: this option is deprecated and will be eliminated in the - * future. Use of this option can cause problems with AML code that - * depends upon in-order immediate execution of module-level code. + * 05/2019: Removed, initialization now happens at both object + * creation and table load time */ - AcpiNsExecModuleCodeList (); /* * Initialize the objects that remain uninitialized. This * runs the executable AML that may be part of the - * declaration of these objects: *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Jul 9 17:18:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67DC515DFAA9; Tue, 9 Jul 2019 17:18:25 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0E9BD73196; Tue, 9 Jul 2019 17:18:25 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BEE922B2D; Tue, 9 Jul 2019 17:18:24 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x69HIOID051482; Tue, 9 Jul 2019 17:18:24 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x69HIOB7051481; Tue, 9 Jul 2019 17:18:24 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201907091718.x69HIOB7051481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Tue, 9 Jul 2019 17:18:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r349862 - vendor-sys/acpica/20190703 X-SVN-Group: vendor-sys X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: vendor-sys/acpica/20190703 X-SVN-Commit-Revision: 349862 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0E9BD73196 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 17:18:25 -0000 Author: jkim Date: Tue Jul 9 17:18:24 2019 New Revision: 349862 URL: https://svnweb.freebsd.org/changeset/base/349862 Log: Tag ACPICA 20190703. Added: vendor-sys/acpica/20190703/ - copied from r349861, vendor-sys/acpica/dist/ From owner-svn-src-all@freebsd.org Tue Jul 9 18:02:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC07715E08B0; Tue, 9 Jul 2019 18:02:42 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 579E775326; Tue, 9 Jul 2019 18:02:42 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCFD4339D; Tue, 9 Jul 2019 18:02:41 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x69I2fxR076817; Tue, 9 Jul 2019 18:02:41 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x69I2bWv076792; Tue, 9 Jul 2019 18:02:37 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201907091802.x69I2bWv076792@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Tue, 9 Jul 2019 18:02:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349863 - in head/sys/contrib/dev/acpica: . compiler components/dispatcher components/events components/executer components/namespace components/tables components/utilities include X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in head/sys/contrib/dev/acpica: . compiler components/dispatcher components/events components/executer components/namespace components/tables components/utilities include X-SVN-Commit-Revision: 349863 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 579E775326 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 18:02:43 -0000 Author: jkim Date: Tue Jul 9 18:02:36 2019 New Revision: 349863 URL: https://svnweb.freebsd.org/changeset/base/349863 Log: MFV: r349861 Import ACPICA 20190703. Modified: head/sys/contrib/dev/acpica/changes.txt head/sys/contrib/dev/acpica/compiler/asldefine.h head/sys/contrib/dev/acpica/compiler/aslglobal.h head/sys/contrib/dev/acpica/compiler/aslload.c head/sys/contrib/dev/acpica/compiler/aslmessages.c head/sys/contrib/dev/acpica/compiler/aslmessages.h head/sys/contrib/dev/acpica/compiler/aslstubs.c head/sys/contrib/dev/acpica/compiler/aslsupport.l head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c head/sys/contrib/dev/acpica/components/events/evgpe.c head/sys/contrib/dev/acpica/components/events/evgpeblk.c head/sys/contrib/dev/acpica/components/events/evxface.c head/sys/contrib/dev/acpica/components/events/evxfgpe.c head/sys/contrib/dev/acpica/components/executer/exconfig.c head/sys/contrib/dev/acpica/components/namespace/nsaccess.c head/sys/contrib/dev/acpica/components/namespace/nseval.c head/sys/contrib/dev/acpica/components/namespace/nsinit.c head/sys/contrib/dev/acpica/components/namespace/nsload.c head/sys/contrib/dev/acpica/components/namespace/nsutils.c head/sys/contrib/dev/acpica/components/tables/tbdata.c head/sys/contrib/dev/acpica/components/tables/tbxfload.c head/sys/contrib/dev/acpica/components/utilities/utinit.c head/sys/contrib/dev/acpica/components/utilities/utxfinit.c head/sys/contrib/dev/acpica/include/acevents.h head/sys/contrib/dev/acpica/include/acglobal.h head/sys/contrib/dev/acpica/include/acnamesp.h head/sys/contrib/dev/acpica/include/acpixf.h Directory Properties: head/sys/contrib/dev/acpica/ (props changed) Modified: head/sys/contrib/dev/acpica/changes.txt ============================================================================== --- head/sys/contrib/dev/acpica/changes.txt Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/changes.txt Tue Jul 9 18:02:36 2019 (r349863) @@ -1,4 +1,53 @@ ---------------------------------------- +03 July 2019. Summary of changes for version 20190703: + + +1) ACPICA kernel-resident subsystem: + +Remove legacy module-level support code. There were still some remnants +of the legacy module-level code executions. Since we no longer support +this option, this is essentially dead code and has been removed from the +ACPICA source. + +iASL: ensure that _WAK, _PTS, _TTS, and _Sx are declared only at the root +scope. If these named objects are declared outside the root scope, they +will not be invoked by any host Operating System. + +Clear status of GPEs on first direct enable. ACPI GPEs (other than the EC +one) can be enabled in two situations. First, the GPEs with existing _Lxx +and _Exx methods are enabled implicitly by ACPICA during system +initialization. Second, the GPEs without these methods (like GPEs listed +by _PRW objects for wakeup devices) need to be enabled directly by the +code that is going to use them (e.g. ACPI power management or device +drivers). + +In the former case, if the status of a given GPE is set to start with, +its handler method (either _Lxx or _Exx) needs to be invoked to take care +of the events (possibly) signaled before the GPE was enabled. In the +latter case, however, the first caller of AcpiEnableGpe() for a given GPE +should not be expected to care about any events that might be signaled +through it earlier. In that case, it is better to clear the status of +the GPE before enabling it, to prevent stale events from triggering +unwanted actions (like spurious system resume, for example). + +For this reason, modify AcpiEvAddGpeReference() to take an additional +boolean argument indicating whether or not the GPE status needs to be +cleared when its reference counter changes from zero to one and make +AcpiEnableGpe() pass TRUE to it through that new argument. + + +2) iASL Compiler/Disassembler and ACPICA tools: + +The tool generation process has been migrated to MSVC 2017, and all +project files have been upgraded. The new project files appear in the +directory \acpica\generate\msvc2017. This change effectively deprecates +the older project files in \acpica\generate\msvc9. + +iASL: ensure that _WAK, _PTS, _TTS, and _Sx are declared only at the root +scope. If these named objects are declared outside the root scope, they +will not be invoked by any host Operating System + +---------------------------------------- 09 May 2019. Summary of changes for version 20190509: Modified: head/sys/contrib/dev/acpica/compiler/asldefine.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asldefine.h Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/compiler/asldefine.h Tue Jul 9 18:02:36 2019 (r349863) @@ -298,4 +298,20 @@ #define COMMENT_CAPTURE_ON AslGbl_CommentState.CaptureComments = TRUE; #define COMMENT_CAPTURE_OFF AslGbl_CommentState.CaptureComments = FALSE; +/* + * Special name segments - these must only be declared at the root scope + */ +#define NAMESEG__PTS "_PTS" +#define NAMESEG__WAK "_WAK" +#define NAMESEG__S0 "_S0_" +#define NAMESEG__S1 "_S1_" +#define NAMESEG__S2 "_S2_" +#define NAMESEG__S3 "_S3_" +#define NAMESEG__S4 "_S4_" +#define NAMESEG__S5 "_S5_" +#define NAMESEG__TTS "_TTS" + +#define MAX_SPECIAL_NAMES 9 + + #endif /* ASLDEFINE.H */ Modified: head/sys/contrib/dev/acpica/compiler/aslglobal.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslglobal.h Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/compiler/aslglobal.h Tue Jul 9 18:02:36 2019 (r349863) @@ -223,11 +223,26 @@ const char *AslGbl_OpFlagName "OP_NOT_FOUND_DURING_LOAD" }; +const char *AslGbl_SpecialNamedObjects [MAX_SPECIAL_NAMES] = +{ + NAMESEG__PTS, + NAMESEG__WAK, + NAMESEG__S0, + NAMESEG__S1, + NAMESEG__S2, + NAMESEG__S3, + NAMESEG__S4, + NAMESEG__S5, + NAMESEG__TTS +}; + #else extern ASL_FILE_DESC AslGbl_FileDescs [ASL_NUM_FILES]; extern UINT32 AslGbl_ExceptionCount[ASL_NUM_REPORT_LEVELS]; extern const char *AslGbl_OpFlagNames[ACPI_NUM_OP_FLAGS]; +extern const char *AslGbl_SpecialNamedObjects[MAX_SPECIAL_NAMES]; #endif + /* Modified: head/sys/contrib/dev/acpica/compiler/aslload.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslload.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/compiler/aslload.c Tue Jul 9 18:02:36 2019 (r349863) @@ -164,6 +164,7 @@ static ACPI_STATUS LdLoadFieldElements ( + UINT32 AmlType, ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState); @@ -190,6 +191,10 @@ LdCommonNamespaceEnd ( UINT32 Level, void *Context); +static void +LdCheckSpecialNames ( + ACPI_NAMESPACE_NODE *Node, + ACPI_PARSE_OBJECT *Op); /******************************************************************************* * @@ -247,7 +252,8 @@ LdLoadNamespace ( * * FUNCTION: LdLoadFieldElements * - * PARAMETERS: Op - Parent node (Field) + * PARAMETERS: AmlType - Type to search + * Op - Parent node (Field) * WalkState - Current walk state * * RETURN: Status @@ -259,6 +265,7 @@ LdLoadNamespace ( static ACPI_STATUS LdLoadFieldElements ( + UINT32 AmlType, ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState) { @@ -274,7 +281,7 @@ LdLoadFieldElements ( { Status = AcpiNsLookup (WalkState->ScopeInfo, SourceRegion->Asl.Value.String, - ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, + AmlType, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node); if (Status == AE_NOT_FOUND) { @@ -507,11 +514,15 @@ LdNamespace1Begin ( */ switch (Op->Asl.AmlOpcode) { - case AML_BANK_FIELD_OP: case AML_INDEX_FIELD_OP: + + Status = LdLoadFieldElements (ACPI_TYPE_LOCAL_REGION_FIELD, Op, WalkState); + return (Status); + + case AML_BANK_FIELD_OP: case AML_FIELD_OP: - Status = LdLoadFieldElements (Op, WalkState); + Status = LdLoadFieldElements (ACPI_TYPE_REGION, Op, WalkState); return (Status); case AML_INT_CONNECTION_OP: @@ -966,6 +977,10 @@ LdNamespace1Begin ( } } + /* Check special names like _WAK and _PTS */ + + LdCheckSpecialNames (Node, Op); + if (ForceNewScope) { Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); @@ -1001,6 +1016,42 @@ FinishNode: } return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: LdCheckSpecialNames + * + * PARAMETERS: Node - Node that represents the named object + * Op - Named object declaring this named object + * + * RETURN: None + * + * DESCRIPTION: Check if certain named objects are declared in the incorrect + * scope. Special named objects are listed in + * AslGbl_SpecialNamedObjects and can only be declared at the root + * scope. + * + ******************************************************************************/ + +static void +LdCheckSpecialNames ( + ACPI_NAMESPACE_NODE *Node, + ACPI_PARSE_OBJECT *Op) +{ + UINT32 i; + + + for (i = 0; i < MAX_SPECIAL_NAMES; i++) + { + if (ACPI_COMPARE_NAMESEG(Node->Name.Ascii, AslGbl_SpecialNamedObjects[i]) && + Node->Parent != AcpiGbl_RootNode) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_SPECIAL_NAME, Op, Op->Asl.ExternalName); + return; + } + } } Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmessages.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/compiler/aslmessages.c Tue Jul 9 18:02:36 2019 (r349863) @@ -365,7 +365,8 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_REGION_LENGTH */ "Operation Region declared with zero length", /* ASL_MSG_TEMPORARY_OBJECT */ "Object is created temporarily in another method and cannot be accessed", /* ASL_MSG_UNDEFINED_EXTERNAL */ "Named object was declared external but the actual definition does not exist", -/* ASL_MSG_BUFFER_FIELD_OVERFLOW */ "Buffer field extends beyond end of target buffer" +/* ASL_MSG_BUFFER_FIELD_OVERFLOW */ "Buffer field extends beyond end of target buffer", +/* ASL_MSG_INVALID_SPECIAL_NAME */ "declaration of this named object outside root scope is illegal" }; /* Table compiler */ Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmessages.h Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/compiler/aslmessages.h Tue Jul 9 18:02:36 2019 (r349863) @@ -368,6 +368,7 @@ typedef enum ASL_MSG_TEMPORARY_OBJECT, ASL_MSG_UNDEFINED_EXTERNAL, ASL_MSG_BUFFER_FIELD_OVERFLOW, + ASL_MSG_INVALID_SPECIAL_NAME, /* These messages are used by the Data Table compiler only */ Modified: head/sys/contrib/dev/acpica/compiler/aslstubs.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslstubs.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/compiler/aslstubs.c Tue Jul 9 18:02:36 2019 (r349863) @@ -166,12 +166,6 @@ * Things like Events, Global Lock, etc. are not used * by the compiler, so they are stubbed out here. */ -void -AcpiNsExecModuleCodeList ( - void) -{ -} - ACPI_STATUS AcpiNsInitializeObjects ( void) Modified: head/sys/contrib/dev/acpica/compiler/aslsupport.l ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslsupport.l Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/compiler/aslsupport.l Tue Jul 9 18:02:36 2019 (r349863) @@ -220,7 +220,7 @@ AslDoLineDirective ( while ((c = input()) != '\n' && c != EOF) { - *AslGbl_LineBufPtr = c; + *AslGbl_LineBufPtr = (char) c; AslGbl_LineBufPtr++; } *AslGbl_LineBufPtr = 0; @@ -498,7 +498,7 @@ AslInsertLineBuffer ( if (AcpiGbl_CaptureComments) { - CvProcessCommentState (SourceChar); + CvProcessCommentState ((char) SourceChar); } } } @@ -601,7 +601,7 @@ loop: AslInsertLineBuffer (c); if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { - *StringBuffer = c; + *StringBuffer = (char) c; ++StringBuffer; } c1 = c; @@ -629,7 +629,7 @@ loop: AslInsertLineBuffer (c); if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { - *StringBuffer = c; + *StringBuffer = (char) c; ++StringBuffer; } @@ -720,7 +720,7 @@ AslDoCommentType2 ( AslInsertLineBuffer (c); if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { - *StringBuffer = c; + *StringBuffer = (char) c; ++StringBuffer; } } @@ -878,7 +878,7 @@ DoCharacter: if (ACPI_IS_OCTAL_DIGIT (StringChar)) { State = ASL_OCTAL_CONSTANT; - ConvertBuffer[0] = StringChar; + ConvertBuffer[0] = (char) StringChar; i = 1; continue; } @@ -934,7 +934,7 @@ DoCharacter: /* Append another digit of the constant */ - ConvertBuffer[i] = StringChar; + ConvertBuffer[i] = (char) StringChar; i++; continue; @@ -978,7 +978,7 @@ DoCharacter: /* Append another digit of the constant */ - ConvertBuffer[i] = StringChar; + ConvertBuffer[i] = (char) StringChar; i++; continue; @@ -989,7 +989,7 @@ DoCharacter: /* Save the finished character */ - *StringBuffer = StringChar; + *StringBuffer = (char) StringChar; StringBuffer++; if (StringBuffer >= EndBuffer) { Modified: head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c ============================================================================== --- head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/dispatcher/dsinit.c Tue Jul 9 18:02:36 2019 (r349863) @@ -362,7 +362,7 @@ AcpiDsInitializeObjects ( if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_DSDT)) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "\nInitializing Namespace objects:\n")); + "\nACPI table initialization:\n")); } /* Summary of objects initialized */ Modified: head/sys/contrib/dev/acpica/components/events/evgpe.c ============================================================================== --- head/sys/contrib/dev/acpica/components/events/evgpe.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/events/evgpe.c Tue Jul 9 18:02:36 2019 (r349863) @@ -316,6 +316,7 @@ AcpiEvMaskGpe ( * FUNCTION: AcpiEvAddGpeReference * * PARAMETERS: GpeEventInfo - Add a reference to this GPE + * ClearOnEnable - Clear GPE status before enabling it * * RETURN: Status * @@ -326,7 +327,8 @@ AcpiEvMaskGpe ( ACPI_STATUS AcpiEvAddGpeReference ( - ACPI_GPE_EVENT_INFO *GpeEventInfo) + ACPI_GPE_EVENT_INFO *GpeEventInfo, + BOOLEAN ClearOnEnable) { ACPI_STATUS Status = AE_OK; @@ -343,6 +345,11 @@ AcpiEvAddGpeReference ( if (GpeEventInfo->RuntimeCount == 1) { /* Enable on first reference */ + + if (ClearOnEnable) + { + (void) AcpiHwClearGpe (GpeEventInfo); + } Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo); if (ACPI_SUCCESS (Status)) Modified: head/sys/contrib/dev/acpica/components/events/evgpeblk.c ============================================================================== --- head/sys/contrib/dev/acpica/components/events/evgpeblk.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/events/evgpeblk.c Tue Jul 9 18:02:36 2019 (r349863) @@ -637,7 +637,7 @@ AcpiEvInitializeGpeBlock ( continue; } - Status = AcpiEvAddGpeReference (GpeEventInfo); + Status = AcpiEvAddGpeReference (GpeEventInfo, FALSE); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, Modified: head/sys/contrib/dev/acpica/components/events/evxface.c ============================================================================== --- head/sys/contrib/dev/acpica/components/events/evxface.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/events/evxface.c Tue Jul 9 18:02:36 2019 (r349863) @@ -1256,7 +1256,7 @@ AcpiRemoveGpeHandler ( ACPI_GPE_DISPATCH_NOTIFY)) && Handler->OriginallyEnabled) { - (void) AcpiEvAddGpeReference (GpeEventInfo); + (void) AcpiEvAddGpeReference (GpeEventInfo, FALSE); if (ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo)) { /* Poll edge triggered GPEs to handle existing events */ Modified: head/sys/contrib/dev/acpica/components/events/evxfgpe.c ============================================================================== --- head/sys/contrib/dev/acpica/components/events/evxfgpe.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/events/evxfgpe.c Tue Jul 9 18:02:36 2019 (r349863) @@ -267,7 +267,7 @@ AcpiEnableGpe ( if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) != ACPI_GPE_DISPATCH_NONE) { - Status = AcpiEvAddGpeReference (GpeEventInfo); + Status = AcpiEvAddGpeReference (GpeEventInfo, TRUE); if (ACPI_SUCCESS (Status) && ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo)) { Modified: head/sys/contrib/dev/acpica/components/executer/exconfig.c ============================================================================== --- head/sys/contrib/dev/acpica/components/executer/exconfig.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/executer/exconfig.c Tue Jul 9 18:02:36 2019 (r349863) @@ -342,10 +342,9 @@ AcpiExLoadTableOp ( return_ACPI_STATUS (Status); } - /* Complete the initialization/resolution of package objects */ + /* Complete the initialization/resolution of new objects */ - Status = AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL); + AcpiNsInitializeObjects (); /* Parameter Data (optional) */ @@ -620,10 +619,11 @@ AcpiExLoadOp ( return_ACPI_STATUS (Status); } - /* Complete the initialization/resolution of package objects */ + /* Complete the initialization/resolution of new objects */ - Status = AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL); + AcpiExExitInterpreter (); + AcpiNsInitializeObjects (); + AcpiExEnterInterpreter (); /* Store the DdbHandle into the Target operand */ Modified: head/sys/contrib/dev/acpica/components/namespace/nsaccess.c ============================================================================== --- head/sys/contrib/dev/acpica/components/namespace/nsaccess.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/namespace/nsaccess.c Tue Jul 9 18:02:36 2019 (r349863) @@ -184,6 +184,7 @@ AcpiNsRootInitialize ( ACPI_STATUS Status; const ACPI_PREDEFINED_NAMES *InitVal = NULL; ACPI_NAMESPACE_NODE *NewNode; + ACPI_NAMESPACE_NODE *PrevNode = NULL; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STRING Val = NULL; @@ -213,13 +214,30 @@ AcpiNsRootInitialize ( */ AcpiGbl_RootNode = &AcpiGbl_RootNodeStruct; - /* Enter the pre-defined names in the name table */ + /* Enter the predefined names in the name table */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Entering predefined entries into namespace\n")); + /* + * Create the initial (default) namespace. + * This namespace looks like something similar to this: + * + * ACPI Namespace (from Namespace Root): + * 0 _GPE Scope 00203160 00 + * 0 _PR_ Scope 002031D0 00 + * 0 _SB_ Device 00203240 00 Notify Object: 0020ADD8 + * 0 _SI_ Scope 002032B0 00 + * 0 _TZ_ Device 00203320 00 + * 0 _REV Integer 00203390 00 = 0000000000000002 + * 0 _OS_ String 00203488 00 Len 14 "Microsoft Windows NT" + * 0 _GL_ Mutex 00203580 00 Object 002035F0 + * 0 _OSI Method 00203678 00 Args 1 Len 0000 Aml 00000000 + */ for (InitVal = AcpiGbl_PreDefinedNames; InitVal->Name; InitVal++) { + Status = AE_OK; + /* _OSI is optional for now, will be permanent later */ if (!strcmp (InitVal->Name, "_OSI") && !AcpiGbl_CreateOsiMethod) @@ -227,17 +245,35 @@ AcpiNsRootInitialize ( continue; } - Status = AcpiNsLookup (NULL, ACPI_CAST_PTR (char, InitVal->Name), - InitVal->Type, ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, - NULL, &NewNode); - if (ACPI_FAILURE (Status)) + /* + * Create, init, and link the new predefined name + * Note: No need to use AcpiNsLookup here because all the + * predefined names are at the root level. It is much easier to + * just create and link the new node(s) here. + */ + NewNode = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_NAMESPACE_NODE)); + if (!NewNode) { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not create predefined name %s", - InitVal->Name)); - continue; + Status = AE_NO_MEMORY; + goto UnlockAndExit; } + ACPI_COPY_NAMESEG (NewNode->Name.Ascii, InitVal->Name); + NewNode->DescriptorType = ACPI_DESC_TYPE_NAMED; + NewNode->Type = InitVal->Type; + + if (!PrevNode) + { + AcpiGbl_RootNodeStruct.Child = NewNode; + } + else + { + PrevNode->Peer = NewNode; + } + + NewNode->Parent = &AcpiGbl_RootNodeStruct; + PrevNode = NewNode; + /* * Name entered successfully. If entry in PreDefinedNames[] specifies * an initial value, create the initial value. @@ -286,7 +322,7 @@ AcpiNsRootInitialize ( NewNode->Value = ObjDesc->Method.ParamCount; #else - /* Mark this as a very SPECIAL method */ + /* Mark this as a very SPECIAL method (_OSI) */ ObjDesc->Method.InfoFlags = ACPI_METHOD_INTERNAL_ONLY; ObjDesc->Method.Dispatch.Implementation = AcpiUtOsiImplementation; @@ -358,7 +394,6 @@ AcpiNsRootInitialize ( AcpiUtRemoveReference (ObjDesc); } } - UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); Modified: head/sys/contrib/dev/acpica/components/namespace/nseval.c ============================================================================== --- head/sys/contrib/dev/acpica/components/namespace/nseval.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/namespace/nseval.c Tue Jul 9 18:02:36 2019 (r349863) @@ -160,14 +160,7 @@ #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nseval") -/* Local prototypes */ -static void -AcpiNsExecModuleCode ( - ACPI_OPERAND_OBJECT *MethodObj, - ACPI_EVALUATE_INFO *Info); - - /******************************************************************************* * * FUNCTION: AcpiNsEvaluate @@ -464,207 +457,4 @@ Cleanup: ACPI_FREE (Info->FullPathname); Info->FullPathname = NULL; return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsExecModuleCodeList - * - * PARAMETERS: None - * - * RETURN: None. Exceptions during method execution are ignored, since - * we cannot abort a table load. - * - * DESCRIPTION: Execute all elements of the global module-level code list. - * Each element is executed as a single control method. - * - * NOTE: With this option enabled, each block of detected executable AML - * code that is outside of any control method is wrapped with a temporary - * control method object and placed on a global list. The methods on this - * list are executed below. - * - * This function executes the module-level code for all tables only after - * all of the tables have been loaded. It is a legacy option and is - * not compatible with other ACPI implementations. See AcpiNsLoadTable. - * - * This function will be removed when the legacy option is removed. - * - ******************************************************************************/ - -void -AcpiNsExecModuleCodeList ( - void) -{ - ACPI_OPERAND_OBJECT *Prev; - ACPI_OPERAND_OBJECT *Next; - ACPI_EVALUATE_INFO *Info; - UINT32 MethodCount = 0; - - - ACPI_FUNCTION_TRACE (NsExecModuleCodeList); - - - /* Exit now if the list is empty */ - - Next = AcpiGbl_ModuleCodeList; - if (!Next) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES, - "Legacy MLC block list is empty\n")); - - return_VOID; - } - - /* Allocate the evaluation information block */ - - Info = ACPI_ALLOCATE (sizeof (ACPI_EVALUATE_INFO)); - if (!Info) - { - return_VOID; - } - - /* Walk the list, executing each "method" */ - - while (Next) - { - Prev = Next; - Next = Next->Method.Mutex; - - /* Clear the link field and execute the method */ - - Prev->Method.Mutex = NULL; - AcpiNsExecModuleCode (Prev, Info); - MethodCount++; - - /* Delete the (temporary) method object */ - - AcpiUtRemoveReference (Prev); - } - - ACPI_INFO (( - "Executed %u blocks of module-level executable AML code", - MethodCount)); - - ACPI_FREE (Info); - AcpiGbl_ModuleCodeList = NULL; - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsExecModuleCode - * - * PARAMETERS: MethodObj - Object container for the module-level code - * Info - Info block for method evaluation - * - * RETURN: None. Exceptions during method execution are ignored, since - * we cannot abort a table load. - * - * DESCRIPTION: Execute a control method containing a block of module-level - * executable AML code. The control method is temporarily - * installed to the root node, then evaluated. - * - ******************************************************************************/ - -static void -AcpiNsExecModuleCode ( - ACPI_OPERAND_OBJECT *MethodObj, - ACPI_EVALUATE_INFO *Info) -{ - ACPI_OPERAND_OBJECT *ParentObj; - ACPI_NAMESPACE_NODE *ParentNode; - ACPI_OBJECT_TYPE Type; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (NsExecModuleCode); - - - /* - * Get the parent node. We cheat by using the NextObject field - * of the method object descriptor. - */ - ParentNode = ACPI_CAST_PTR ( - ACPI_NAMESPACE_NODE, MethodObj->Method.NextObject); - Type = AcpiNsGetType (ParentNode); - - /* - * Get the region handler and save it in the method object. We may need - * this if an operation region declaration causes a _REG method to be run. - * - * We can't do this in AcpiPsLinkModuleCode because - * AcpiGbl_RootNode->Object is NULL at PASS1. - */ - if ((Type == ACPI_TYPE_DEVICE) && ParentNode->Object) - { - MethodObj->Method.Dispatch.Handler = - ParentNode->Object->Device.Handler; - } - - /* Must clear NextObject (AcpiNsAttachObject needs the field) */ - - MethodObj->Method.NextObject = NULL; - - /* Initialize the evaluation information block */ - - memset (Info, 0, sizeof (ACPI_EVALUATE_INFO)); - Info->PrefixNode = ParentNode; - - /* - * Get the currently attached parent object. Add a reference, - * because the ref count will be decreased when the method object - * is installed to the parent node. - */ - ParentObj = AcpiNsGetAttachedObject (ParentNode); - if (ParentObj) - { - AcpiUtAddReference (ParentObj); - } - - /* Install the method (module-level code) in the parent node */ - - Status = AcpiNsAttachObject (ParentNode, MethodObj, ACPI_TYPE_METHOD); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - /* Execute the parent node as a control method */ - - Status = AcpiNsEvaluate (Info); - - ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES, - "Executed module-level code at %p\n", - MethodObj->Method.AmlStart)); - - /* Delete a possible implicit return value (in slack mode) */ - - if (Info->ReturnObject) - { - AcpiUtRemoveReference (Info->ReturnObject); - } - - /* Detach the temporary method object */ - - AcpiNsDetachObject (ParentNode); - - /* Restore the original parent object */ - - if (ParentObj) - { - Status = AcpiNsAttachObject (ParentNode, ParentObj, Type); - } - else - { - ParentNode->Type = (UINT8) Type; - } - -Exit: - if (ParentObj) - { - AcpiUtRemoveReference (ParentObj); - } - return_VOID; } Modified: head/sys/contrib/dev/acpica/components/namespace/nsinit.c ============================================================================== --- head/sys/contrib/dev/acpica/components/namespace/nsinit.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/namespace/nsinit.c Tue Jul 9 18:02:36 2019 (r349863) @@ -212,29 +212,30 @@ AcpiNsInitializeObjects ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "**** Starting initialization of namespace objects ****\n")); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "Completing Region/Field/Buffer/Package initialization:\n")); + "Final data object initialization: ")); - /* Set all init info to zero */ + /* Clear the info block */ memset (&Info, 0, sizeof (ACPI_INIT_WALK_INFO)); /* Walk entire namespace from the supplied root */ + /* + * TBD: will become ACPI_TYPE_PACKAGE as this type object + * is now the only one that supports deferred initialization + * (forward references). + */ Status = AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, - &Info, NULL); + ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, &Info, NULL); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace")); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - " Initialized %u/%u Regions %u/%u Fields %u/%u " - "Buffers %u/%u Packages (%u nodes)\n", - Info.OpRegionInit, Info.OpRegionCount, - Info.FieldInit, Info.FieldCount, - Info.BufferInit, Info.BufferCount, - Info.PackageInit, Info.PackageCount, Info.ObjectCount)); + "Namespace contains %u (0x%X) objects\n", + Info.ObjectCount, + Info.ObjectCount)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "%u Control Methods found\n%u Op Regions found\n", @@ -561,35 +562,19 @@ AcpiNsInitOneObject ( AcpiExEnterInterpreter (); /* - * Each of these types can contain executable AML code within the - * declaration. + * Only initialization of Package objects can be deferred, in order + * to support forward references. */ switch (Type) { - case ACPI_TYPE_REGION: + case ACPI_TYPE_LOCAL_BANK_FIELD: - Info->OpRegionInit++; - Status = AcpiDsGetRegionArguments (ObjDesc); - break; + /* TBD: BankFields do not require deferred init, remove this code */ - case ACPI_TYPE_BUFFER_FIELD: - Info->FieldInit++; - Status = AcpiDsGetBufferFieldArguments (ObjDesc); - break; - - case ACPI_TYPE_LOCAL_BANK_FIELD: - - Info->FieldInit++; Status = AcpiDsGetBankFieldArguments (ObjDesc); break; - case ACPI_TYPE_BUFFER: - - Info->BufferInit++; - Status = AcpiDsGetBufferArguments (ObjDesc); - break; - case ACPI_TYPE_PACKAGE: /* Complete the initialization/resolution of the package object */ @@ -600,8 +585,12 @@ AcpiNsInitOneObject ( default: - /* No other types can get here */ + /* No other types should get here */ + Status = AE_TYPE; + ACPI_EXCEPTION ((AE_INFO, Status, + "Opcode is not deferred [%4.4s] (%s)", + AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Type))); break; } Modified: head/sys/contrib/dev/acpica/components/namespace/nsload.c ============================================================================== --- head/sys/contrib/dev/acpica/components/namespace/nsload.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/namespace/nsload.c Tue Jul 9 18:02:36 2019 (r349863) @@ -268,18 +268,6 @@ Unlock: ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Completed Table Object Initialization\n")); - /* - * This case handles the legacy option that groups all module-level - * code blocks together and defers execution until all of the tables - * are loaded. Execute all of these blocks at this time. - * Execute any module-level code that was detected during the table - * load phase. - * - * Note: this option is deprecated and will be eliminated in the - * future. Use of this option can cause problems with AML code that - * depends upon in-order immediate execution of module-level code. - */ - AcpiNsExecModuleCodeList (); return_ACPI_STATUS (Status); } Modified: head/sys/contrib/dev/acpica/components/namespace/nsutils.c ============================================================================== --- head/sys/contrib/dev/acpica/components/namespace/nsutils.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/namespace/nsutils.c Tue Jul 9 18:02:36 2019 (r349863) @@ -802,23 +802,10 @@ AcpiNsTerminate ( void) { ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *Prev; - ACPI_OPERAND_OBJECT *Next; ACPI_FUNCTION_TRACE (NsTerminate); - - /* Delete any module-level code blocks */ - - Next = AcpiGbl_ModuleCodeList; - while (Next) - { - Prev = Next; - Next = Next->Method.Mutex; - Prev->Method.Mutex = NULL; /* Clear the Mutex (cheated) field */ - AcpiUtRemoveReference (Prev); - } /* * Free the entire namespace -- all nodes and all objects Modified: head/sys/contrib/dev/acpica/components/tables/tbdata.c ============================================================================== --- head/sys/contrib/dev/acpica/components/tables/tbdata.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/tables/tbdata.c Tue Jul 9 18:02:36 2019 (r349863) @@ -1191,19 +1191,6 @@ AcpiTbLoadTable ( Status = AcpiNsLoadTable (TableIndex, ParentNode); /* - * This case handles the legacy option that groups all module-level - * code blocks together and defers execution until all of the tables - * are loaded. Execute all of these blocks at this time. - * Execute any module-level code that was detected during the table - * load phase. - * - * Note: this option is deprecated and will be eliminated in the - * future. Use of this option can cause problems with AML code that - * depends upon in-order immediate execution of module-level code. - */ - AcpiNsExecModuleCodeList (); - - /* * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is * responsible for discovering any new wake GPEs by running _PRW methods * that may have been loaded by this table. Modified: head/sys/contrib/dev/acpica/components/tables/tbxfload.c ============================================================================== --- head/sys/contrib/dev/acpica/components/tables/tbxfload.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/tables/tbxfload.c Tue Jul 9 18:02:36 2019 (r349863) @@ -479,6 +479,13 @@ AcpiLoadTable ( ACPI_INFO (("Host-directed Dynamic ACPI Table Load:")); Status = AcpiTbInstallAndLoadTable (ACPI_PTR_TO_PHYSADDR (Table), ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, FALSE, &TableIndex); + if (ACPI_SUCCESS (Status)) + { + /* Complete the initialization/resolution of new objects */ + + AcpiNsInitializeObjects (); + } + return_ACPI_STATUS (Status); } Modified: head/sys/contrib/dev/acpica/components/utilities/utinit.c ============================================================================== --- head/sys/contrib/dev/acpica/components/utilities/utinit.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/utilities/utinit.c Tue Jul 9 18:02:36 2019 (r349863) @@ -342,7 +342,6 @@ AcpiUtInitGlobals ( /* Namespace */ - AcpiGbl_ModuleCodeList = NULL; AcpiGbl_RootNode = NULL; AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME; AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED; Modified: head/sys/contrib/dev/acpica/components/utilities/utxfinit.c ============================================================================== --- head/sys/contrib/dev/acpica/components/utilities/utxfinit.c Tue Jul 9 17:18:24 2019 (r349862) +++ head/sys/contrib/dev/acpica/components/utilities/utxfinit.c Tue Jul 9 18:02:36 2019 (r349863) @@ -381,24 +381,17 @@ AcpiInitializeObjects ( ACPI_FUNCTION_TRACE (AcpiInitializeObjects); +#ifdef ACPI_OBSOLETE_BEHAVIOR /* - * This case handles the legacy option that groups all module-level - * code blocks together and defers execution until all of the tables - * are loaded. Execute all of these blocks at this time. - * Execute any module-level code that was detected during the table - * load phase. - * - * Note: this option is deprecated and will be eliminated in the - * future. Use of this option can cause problems with AML code that - * depends upon in-order immediate execution of module-level code. + * 05/2019: Removed, initialization now happens at both object + * creation and table load time */ - AcpiNsExecModuleCodeList (); /* * Initialize the objects that remain uninitialized. This * runs the executable AML that may be part of the - * declaration of these objects: *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Jul 9 18:33:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0552015E1A86; Tue, 9 Jul 2019 18:33:02 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9BB0C7735F; Tue, 9 Jul 2019 18:33:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 875643AFB; Tue, 9 Jul 2019 18:33:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x69IX1iH093683; Tue, 9 Jul 2019 18:33:01 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x69IX1ws093682; Tue, 9 Jul 2019 18:33:01 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907091833.x69IX1ws093682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 9 Jul 2019 18:33:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349864 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: imp X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 349864 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9BB0C7735F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 18:33:02 -0000 Author: imp Date: Tue Jul 9 18:33:01 2019 New Revision: 349864 URL: https://svnweb.freebsd.org/changeset/base/349864 Log: Refine the advice for upgrading from 10.x Simplify the advice to highlight the 3.5 minimum requirement (and note that RELENG_10 has 3.4.1). The other issues I highlighted were just the tip of the iceberg and not as helpful as I thought. Modified: stable/11/UPDATING Modified: stable/11/UPDATING ============================================================================== --- stable/11/UPDATING Tue Jul 9 18:02:36 2019 (r349863) +++ stable/11/UPDATING Tue Jul 9 18:33:01 2019 (r349864) @@ -26,11 +26,8 @@ from older version of current across the gcc/clang cut Clang, llvm, lld, lldb, compiler-rt and libc++ have been upgraded to 8.0.0. Please see the 20141231 entry below for information about prerequisites and upgrading, if you are not already using clang 3.5.0 or - higher. In addtion, if updating from RELENG_10, update to r346291 first, - then update to the most recent version of RELENG_11. The older - implementation of static_assert on RELENG_10 is incompatible with newer - compilers, so compilation errors will occur. The trick it uses to when - the builtin is unavailable now generates a fatal error. + higher. RELENG_10 still has 3.4.1, so you should upgrade to r346291 + first if you are upgrading from 10.x. 20190226: geom_uzip(4) depends on the new module xz. If geom_uzip is statically From owner-svn-src-all@freebsd.org Tue Jul 9 19:32:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B29AD15E36E8; Tue, 9 Jul 2019 19:32:32 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 583F1823FD; Tue, 9 Jul 2019 19:32:32 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 289584588; Tue, 9 Jul 2019 19:32:32 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x69JWWTs025541; Tue, 9 Jul 2019 19:32:32 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x69JWWGU025540; Tue, 9 Jul 2019 19:32:32 GMT (envelope-from np@FreeBSD.org) Message-Id: <201907091932.x69JWWGU025540@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 9 Jul 2019 19:32:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349865 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 349865 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 583F1823FD X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 19:32:32 -0000 Author: np Date: Tue Jul 9 19:32:31 2019 New Revision: 349865 URL: https://svnweb.freebsd.org/changeset/base/349865 Log: cxgbe(4): Use the simplest configuration possible when falling back from the default configuration. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Tue Jul 9 18:33:01 2019 (r349864) +++ head/sys/dev/cxgbe/t4_main.c Tue Jul 9 19:32:31 2019 (r349865) @@ -4009,10 +4009,8 @@ retry: rc, cfg_file); snprintf(cfg_file, sizeof(cfg_file), "%s", BUILTIN_CF); bzero(&caps_allowed, sizeof(caps_allowed)); - COPY_CAPS(nbm); - COPY_CAPS(link); COPY_CAPS(switch); - COPY_CAPS(nic); + caps_allowed.niccaps = FW_CAPS_CONFIG_NIC; fallback = false; goto retry; } From owner-svn-src-all@freebsd.org Tue Jul 9 20:28:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DFE9415E573F; Tue, 9 Jul 2019 20:28:54 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 81F45855EC; Tue, 9 Jul 2019 20:28:54 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C6914DE5; Tue, 9 Jul 2019 20:28:54 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x69KSsMZ051841; Tue, 9 Jul 2019 20:28:54 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x69KSsx1051840; Tue, 9 Jul 2019 20:28:54 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201907092028.x69KSsx1051840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Tue, 9 Jul 2019 20:28:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349866 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 349866 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 81F45855EC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 20:28:55 -0000 Author: alc Date: Tue Jul 9 20:28:53 2019 New Revision: 349866 URL: https://svnweb.freebsd.org/changeset/base/349866 Log: Introduce pmap_clear(), which zeroes a page table entry, and use it, instead of pmap_load_clear(), in places where we don't care about the page table entry's prior contents. Eliminate an unnecessary pmap_load() from pmap_remove_all(). Instead, use the value returned by the pmap_load_clear() on the very next line. (In the future, when we support "hardware dirty bit management", using the value from the pmap_load() rather than the pmap_load_clear() would have actually been an error because the dirty bit could potentially change between the pmap_load() and the pmap_load_clear().) A KASSERT() in pmap_enter(), which originated in the amd64 pmap, was meant to check the value returned by the pmap_load_clear() on the previous line. However, we were ignoring the value returned by the pmap_load_clear(), and so the KASSERT() was not serving its intended purpose. Use the value returned by the pmap_load_clear() in the KASSERT(). MFC after: 2 weeks Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Tue Jul 9 19:32:31 2019 (r349865) +++ head/sys/arm64/arm64/pmap.c Tue Jul 9 20:28:53 2019 (r349866) @@ -315,6 +315,7 @@ static __inline vm_page_t pmap_remove_pt_page(pmap_t p * They need to be atomic as the System MMU may write to the table at * the same time as the CPU. */ +#define pmap_clear(table) atomic_store_64(table, 0) #define pmap_load_store(table, entry) atomic_swap_64(table, entry) #define pmap_set(table, mask) atomic_set_64(table, mask) #define pmap_load_clear(table) atomic_swap_64(table, 0) @@ -1208,7 +1209,7 @@ pmap_kremove(vm_offset_t va) KASSERT(pte != NULL, ("pmap_kremove: Invalid address")); KASSERT(lvl == 3, ("pmap_kremove: Invalid pte level %d", lvl)); - pmap_load_clear(pte); + pmap_clear(pte); pmap_invalidate_page(kernel_pmap, va); } @@ -1230,7 +1231,7 @@ pmap_kremove_device(vm_offset_t sva, vm_size_t size) KASSERT(pte != NULL, ("Invalid page table, va: 0x%lx", va)); KASSERT(lvl == 3, ("Invalid device pagetable level: %d != 3", lvl)); - pmap_load_clear(pte); + pmap_clear(pte); va += PAGE_SIZE; size -= PAGE_SIZE; @@ -1315,7 +1316,7 @@ pmap_qremove(vm_offset_t sva, int count) KASSERT(lvl == 3, ("Invalid device pagetable level: %d != 3", lvl)); if (pte != NULL) { - pmap_load_clear(pte); + pmap_clear(pte); } va += PAGE_SIZE; @@ -1374,19 +1375,19 @@ _pmap_unwire_l3(pmap_t pmap, vm_offset_t va, vm_page_t pd_entry_t *l0; l0 = pmap_l0(pmap, va); - pmap_load_clear(l0); + pmap_clear(l0); } else if (m->pindex >= NUL2E) { /* l2 page */ pd_entry_t *l1; l1 = pmap_l1(pmap, va); - pmap_load_clear(l1); + pmap_clear(l1); } else { /* l3 page */ pd_entry_t *l2; l2 = pmap_l2(pmap, va); - pmap_load_clear(l2); + pmap_clear(l2); } pmap_resident_count_dec(pmap, 1); if (m->pindex < NUL2E) { @@ -2760,8 +2761,7 @@ retry: tpde = pmap_load(pde); pte = pmap_l2_to_l3(pde, pv->pv_va); - tpte = pmap_load(pte); - pmap_load_clear(pte); + tpte = pmap_load_clear(pte); pmap_invalidate_page(pmap, pv->pv_va); if (tpte & ATTR_SW_WIRED) pmap->pm_stats.wired_count--; @@ -2986,7 +2986,7 @@ pmap_update_entry(pmap_t pmap, pd_entry_t *pte, pd_ent critical_enter(); /* Clear the old mapping */ - pmap_load_clear(pte); + pmap_clear(pte); pmap_invalidate_range_nopin(pmap, va, va + size); /* Create the new mapping */ @@ -3265,9 +3265,10 @@ havel3: } /* - * The physical page has changed. + * The physical page has changed. Temporarily invalidate + * the mapping. */ - (void)pmap_load_clear(l3); + orig_l3 = pmap_load_clear(l3); KASSERT((orig_l3 & ~ATTR_MASK) == opa, ("pmap_enter: unexpected pa update for %#lx", va)); if ((orig_l3 & ATTR_SW_MANAGED) != 0) { @@ -4282,7 +4283,12 @@ pmap_remove_pages(pmap_t pmap) ("pmap_remove_pages: bad pte %#jx", (uintmax_t)tpte)); - pmap_load_clear(pte); + /* + * Because this pmap is not active on other + * processors, the dirty bit cannot have + * changed state since we last loaded pte. + */ + pmap_clear(pte); /* * Update the vm_page_t clean/reference bits. @@ -5002,7 +5008,7 @@ pmap_unmapbios(vm_offset_t va, vm_size_t size) ("pmap_unmapbios: Invalid page entry, va: 0x%lx", va_trunc)); l2 = pmap_l1_to_l2(pde, va_trunc); - pmap_load_clear(l2); + pmap_clear(l2); if (block == (l2_blocks - 1)) break; From owner-svn-src-all@freebsd.org Tue Jul 9 20:40:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB1A315E5B11; Tue, 9 Jul 2019 20:40:30 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from hz.grosbein.net (hz.grosbein.net [IPv6:2a01:4f8:c2c:26d8::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "hz.grosbein.net", Issuer "hz.grosbein.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 3E93E85BDA; Tue, 9 Jul 2019 20:40:29 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from eg.sd.rdtc.ru (eg.sd.rdtc.ru [IPv6:2a03:3100:c:13:0:0:0:5]) by hz.grosbein.net (8.15.2/8.15.2) with ESMTPS id x69KeND0047807 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 9 Jul 2019 20:40:24 GMT (envelope-from eugen@grosbein.net) X-Envelope-From: eugen@grosbein.net X-Envelope-To: imp@FreeBSD.org Received: from [10.58.0.4] (dadv@[10.58.0.4]) by eg.sd.rdtc.ru (8.15.2/8.15.2) with ESMTPS id x69KeJSj035571 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Wed, 10 Jul 2019 03:40:20 +0700 (+07) (envelope-from eugen@grosbein.net) Subject: Re: svn commit: r349864 - stable/11 To: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org References: <201907091833.x69IX1ws093682@repo.freebsd.org> From: Eugene Grosbein Message-ID: <81dfaefb-071e-3d7e-a54d-e70e2e448355@grosbein.net> Date: Wed, 10 Jul 2019 03:40:18 +0700 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <201907091833.x69IX1ws093682@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00,LOCAL_FROM, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Report: * -2.3 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record * -0.0 SPF_PASS SPF: sender matches SPF record * 2.6 LOCAL_FROM From my domains X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on hz.grosbein.net X-Rspamd-Queue-Id: 3E93E85BDA X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.975,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 20:40:30 -0000 10.07.2019 1:33, Warner Losh wrote: > Modified: stable/11/UPDATING > ============================================================================== > --- stable/11/UPDATING Tue Jul 9 18:02:36 2019 (r349863) > +++ stable/11/UPDATING Tue Jul 9 18:33:01 2019 (r349864) > @@ -26,11 +26,8 @@ from older version of current across the gcc/clang cut > Clang, llvm, lld, lldb, compiler-rt and libc++ have been upgraded to > 8.0.0. Please see the 20141231 entry below for information about > prerequisites and upgrading, if you are not already using clang 3.5.0 or > - higher. In addtion, if updating from RELENG_10, update to r346291 first, > - then update to the most recent version of RELENG_11. The older > - implementation of static_assert on RELENG_10 is incompatible with newer > - compilers, so compilation errors will occur. The trick it uses to when > - the builtin is unavailable now generates a fatal error. > + higher. RELENG_10 still has 3.4.1, so you should upgrade to r346291 > + first if you are upgrading from 10.x. Please clarify branch name of r346291 here. From owner-svn-src-all@freebsd.org Tue Jul 9 22:04:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C54D15E71A6; Tue, 9 Jul 2019 22:04:35 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9D85889021; Tue, 9 Jul 2019 22:04:34 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 581BD5EBD; Tue, 9 Jul 2019 22:04:34 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x69M4Ylj004302; Tue, 9 Jul 2019 22:04:34 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x69M4Xwu004298; Tue, 9 Jul 2019 22:04:33 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201907092204.x69M4Xwu004298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 9 Jul 2019 22:04:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349867 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349867 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9D85889021 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 22:04:35 -0000 Author: vmaffione Date: Tue Jul 9 22:04:33 2019 New Revision: 349867 URL: https://svnweb.freebsd.org/changeset/base/349867 Log: bhyve: add missing license identifiers in net_utils and net_backend Reviewed by: jhb, markj, imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20874 Modified: head/usr.sbin/bhyve/net_backends.c head/usr.sbin/bhyve/net_backends.h head/usr.sbin/bhyve/net_utils.c head/usr.sbin/bhyve/net_utils.h Modified: head/usr.sbin/bhyve/net_backends.c ============================================================================== --- head/usr.sbin/bhyve/net_backends.c Tue Jul 9 20:28:53 2019 (r349866) +++ head/usr.sbin/bhyve/net_backends.c Tue Jul 9 22:04:33 2019 (r349867) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2019 Vincenzo Maffione * * Redistribution and use in source and binary forms, with or without Modified: head/usr.sbin/bhyve/net_backends.h ============================================================================== --- head/usr.sbin/bhyve/net_backends.h Tue Jul 9 20:28:53 2019 (r349866) +++ head/usr.sbin/bhyve/net_backends.h Tue Jul 9 22:04:33 2019 (r349867) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2019 Vincenzo Maffione * * Redistribution and use in source and binary forms, with or without Modified: head/usr.sbin/bhyve/net_utils.c ============================================================================== --- head/usr.sbin/bhyve/net_utils.c Tue Jul 9 20:28:53 2019 (r349866) +++ head/usr.sbin/bhyve/net_utils.c Tue Jul 9 22:04:33 2019 (r349867) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2011 NetApp, Inc. * * Redistribution and use in source and binary forms, with or without Modified: head/usr.sbin/bhyve/net_utils.h ============================================================================== --- head/usr.sbin/bhyve/net_utils.h Tue Jul 9 20:28:53 2019 (r349866) +++ head/usr.sbin/bhyve/net_utils.h Tue Jul 9 22:04:33 2019 (r349867) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2019 Vincenzo Maffione * * Redistribution and use in source and binary forms, with or without From owner-svn-src-all@freebsd.org Tue Jul 9 22:05:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C2BB015E7271; Tue, 9 Jul 2019 22:05:59 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 643CD8924A; Tue, 9 Jul 2019 22:05:59 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3E3925ED2; Tue, 9 Jul 2019 22:05:59 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x69M5xRI004410; Tue, 9 Jul 2019 22:05:59 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x69M5xJN004409; Tue, 9 Jul 2019 22:05:59 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201907092205.x69M5xJN004409@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 9 Jul 2019 22:05:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349868 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349868 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 643CD8924A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 22:05:59 -0000 Author: vmaffione Date: Tue Jul 9 22:05:58 2019 New Revision: 349868 URL: https://svnweb.freebsd.org/changeset/base/349868 Log: bhyve: net_backends.c: add missing __FBSDID Reviewed by: jhb MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20883 Modified: head/usr.sbin/bhyve/net_backends.c Modified: head/usr.sbin/bhyve/net_backends.c ============================================================================== --- head/usr.sbin/bhyve/net_backends.c Tue Jul 9 22:04:33 2019 (r349867) +++ head/usr.sbin/bhyve/net_backends.c Tue Jul 9 22:05:58 2019 (r349868) @@ -34,11 +34,13 @@ * features) is exported by net_backends.h. */ +#include +__FBSDID("$FreeBSD$"); + #include /* u_short etc */ #ifndef WITHOUT_CAPSICUM #include #endif -#include #include #include #include From owner-svn-src-all@freebsd.org Tue Jul 9 22:11:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2F98C15E74B1; Tue, 9 Jul 2019 22:11:16 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CAF1D89658; Tue, 9 Jul 2019 22:11:15 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3D165F24; Tue, 9 Jul 2019 22:11:15 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x69MBFJ0006986; Tue, 9 Jul 2019 22:11:15 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x69MBFhV006985; Tue, 9 Jul 2019 22:11:15 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201907092211.x69MBFhV006985@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 9 Jul 2019 22:11:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349869 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 349869 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CAF1D89658 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 22:11:16 -0000 Author: vmaffione Date: Tue Jul 9 22:11:15 2019 New Revision: 349869 URL: https://svnweb.freebsd.org/changeset/base/349869 Log: update calendar.freebsd MFC after: 1 week Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Tue Jul 9 22:05:58 2019 (r349868) +++ head/usr.bin/calendar/calendars/calendar.freebsd Tue Jul 9 22:11:15 2019 (r349869) @@ -387,7 +387,6 @@ 10/05 Hiroki Sato born in Yamagata, Japan, 1977 10/05 Chris Costello born in Houston, Texas, United States, 1985 10/09 Stefan Walter born in Werne, Nordrhein-Westfalen, Germany, 1978 -10/09 Vincenzo Maffione born in Foggia, Italy, 1988 10/11 Rick Macklem born in Ontario, Canada, 1955 10/12 Pawel Jakub Dawidek born in Radzyn Podlaski, Poland, 1980 10/15 Maxim Konovalov born in Khabarovsk, USSR, 1973 From owner-svn-src-all@freebsd.org Tue Jul 9 22:24:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1333715E7870; Tue, 9 Jul 2019 22:24:24 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9C9BE89F80; Tue, 9 Jul 2019 22:24:23 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E3996229; Tue, 9 Jul 2019 22:24:23 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x69MONat014741; Tue, 9 Jul 2019 22:24:23 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x69MONmM014740; Tue, 9 Jul 2019 22:24:23 GMT (envelope-from np@FreeBSD.org) Message-Id: <201907092224.x69MONmM014740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 9 Jul 2019 22:24:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349870 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 349870 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9C9BE89F80 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 22:24:24 -0000 Author: np Date: Tue Jul 9 22:24:22 2019 New Revision: 349870 URL: https://svnweb.freebsd.org/changeset/base/349870 Log: cxgbe(4): Clear the freelist statistics in the clearstats ioctl. Move all clearstats code into its own function while here. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Tue Jul 9 22:11:15 2019 (r349869) +++ head/sys/dev/cxgbe/t4_main.c Tue Jul 9 22:24:22 2019 (r349870) @@ -694,6 +694,7 @@ static void free_offload_policy(struct t4_offload_poli static int set_offload_policy(struct adapter *, struct t4_offload_policy *); static int read_card_mem(struct adapter *, int, struct t4_mem_range *); static int read_i2c(struct adapter *, struct t4_i2c_data *); +static int clear_stats(struct adapter *, u_int); #ifdef TCP_OFFLOAD static int toe_capability(struct vi_info *, int); #endif @@ -9841,6 +9842,108 @@ read_i2c(struct adapter *sc, struct t4_i2c_data *i2cd) return (rc); } +static int +clear_stats(struct adapter *sc, u_int port_id) +{ + int i, v, bg_map; + struct port_info *pi; + struct vi_info *vi; + struct sge_rxq *rxq; + struct sge_txq *txq; + struct sge_wrq *wrq; +#ifdef TCP_OFFLOAD + struct sge_ofld_rxq *ofld_rxq; +#endif + + if (port_id >= sc->params.nports) + return (EINVAL); + pi = sc->port[port_id]; + if (pi == NULL) + return (EIO); + + /* MAC stats */ + t4_clr_port_stats(sc, pi->tx_chan); + pi->tx_parse_error = 0; + pi->tnl_cong_drops = 0; + mtx_lock(&sc->reg_lock); + for_each_vi(pi, v, vi) { + if (vi->flags & VI_INIT_DONE) + t4_clr_vi_stats(sc, vi->vin); + } + bg_map = pi->mps_bg_map; + v = 0; /* reuse */ + while (bg_map) { + i = ffs(bg_map) - 1; + t4_write_indirect(sc, A_TP_MIB_INDEX, A_TP_MIB_DATA, &v, + 1, A_TP_MIB_TNL_CNG_DROP_0 + i); + bg_map &= ~(1 << i); + } + mtx_unlock(&sc->reg_lock); + + /* + * Since this command accepts a port, clear stats for + * all VIs on this port. + */ + for_each_vi(pi, v, vi) { + if (vi->flags & VI_INIT_DONE) { + + for_each_rxq(vi, i, rxq) { +#if defined(INET) || defined(INET6) + rxq->lro.lro_queued = 0; + rxq->lro.lro_flushed = 0; +#endif + rxq->rxcsum = 0; + rxq->vlan_extraction = 0; + + rxq->fl.mbuf_allocated = 0; + rxq->fl.mbuf_inlined = 0; + rxq->fl.cl_allocated = 0; + rxq->fl.cl_recycled = 0; + rxq->fl.cl_fast_recycled = 0; + } + + for_each_txq(vi, i, txq) { + txq->txcsum = 0; + txq->tso_wrs = 0; + txq->vlan_insertion = 0; + txq->imm_wrs = 0; + txq->sgl_wrs = 0; + txq->txpkt_wrs = 0; + txq->txpkts0_wrs = 0; + txq->txpkts1_wrs = 0; + txq->txpkts0_pkts = 0; + txq->txpkts1_pkts = 0; + txq->raw_wrs = 0; + mp_ring_reset_stats(txq->r); + } + +#if defined(TCP_OFFLOAD) || defined(RATELIMIT) + for_each_ofld_txq(vi, i, wrq) { + wrq->tx_wrs_direct = 0; + wrq->tx_wrs_copied = 0; + } +#endif +#ifdef TCP_OFFLOAD + for_each_ofld_rxq(vi, i, ofld_rxq) { + ofld_rxq->fl.mbuf_allocated = 0; + ofld_rxq->fl.mbuf_inlined = 0; + ofld_rxq->fl.cl_allocated = 0; + ofld_rxq->fl.cl_recycled = 0; + ofld_rxq->fl.cl_fast_recycled = 0; + } +#endif + + if (IS_MAIN_VI(vi)) { + wrq = &sc->sge.ctrlq[pi->port_id]; + wrq->tx_wrs_direct = 0; + wrq->tx_wrs_copied = 0; + } + } + } + + return (0); +} + int t4_os_find_pci_capability(struct adapter *sc, int cap) { @@ -10044,89 +10147,9 @@ t4_ioctl(struct cdev *dev, unsigned long cmd, caddr_t case CHELSIO_T4_GET_I2C: rc = read_i2c(sc, (struct t4_i2c_data *)data); break; - case CHELSIO_T4_CLEAR_STATS: { - int i, v, bg_map; - u_int port_id = *(uint32_t *)data; - struct port_info *pi; - struct vi_info *vi; - - if (port_id >= sc->params.nports) - return (EINVAL); - pi = sc->port[port_id]; - if (pi == NULL) - return (EIO); - - /* MAC stats */ - t4_clr_port_stats(sc, pi->tx_chan); - pi->tx_parse_error = 0; - pi->tnl_cong_drops = 0; - mtx_lock(&sc->reg_lock); - for_each_vi(pi, v, vi) { - if (vi->flags & VI_INIT_DONE) - t4_clr_vi_stats(sc, vi->vin); - } - bg_map = pi->mps_bg_map; - v = 0; /* reuse */ - while (bg_map) { - i = ffs(bg_map) - 1; - t4_write_indirect(sc, A_TP_MIB_INDEX, A_TP_MIB_DATA, &v, - 1, A_TP_MIB_TNL_CNG_DROP_0 + i); - bg_map &= ~(1 << i); - } - mtx_unlock(&sc->reg_lock); - - /* - * Since this command accepts a port, clear stats for - * all VIs on this port. - */ - for_each_vi(pi, v, vi) { - if (vi->flags & VI_INIT_DONE) { - struct sge_rxq *rxq; - struct sge_txq *txq; - struct sge_wrq *wrq; - - for_each_rxq(vi, i, rxq) { -#if defined(INET) || defined(INET6) - rxq->lro.lro_queued = 0; - rxq->lro.lro_flushed = 0; -#endif - rxq->rxcsum = 0; - rxq->vlan_extraction = 0; - } - - for_each_txq(vi, i, txq) { - txq->txcsum = 0; - txq->tso_wrs = 0; - txq->vlan_insertion = 0; - txq->imm_wrs = 0; - txq->sgl_wrs = 0; - txq->txpkt_wrs = 0; - txq->txpkts0_wrs = 0; - txq->txpkts1_wrs = 0; - txq->txpkts0_pkts = 0; - txq->txpkts1_pkts = 0; - txq->raw_wrs = 0; - mp_ring_reset_stats(txq->r); - } - -#if defined(TCP_OFFLOAD) || defined(RATELIMIT) - /* nothing to clear for each ofld_rxq */ - - for_each_ofld_txq(vi, i, wrq) { - wrq->tx_wrs_direct = 0; - wrq->tx_wrs_copied = 0; - } -#endif - - if (IS_MAIN_VI(vi)) { - wrq = &sc->sge.ctrlq[pi->port_id]; - wrq->tx_wrs_direct = 0; - wrq->tx_wrs_copied = 0; - } - } - } + case CHELSIO_T4_CLEAR_STATS: + rc = clear_stats(sc, *(uint32_t *)data); break; - } case CHELSIO_T4_SCHED_CLASS: rc = t4_set_sched_class(sc, (struct t4_sched_params *)data); break; From owner-svn-src-all@freebsd.org Tue Jul 9 23:58:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D6BE15E938D; Tue, 9 Jul 2019 23:58:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E4D3E8CF3F; Tue, 9 Jul 2019 23:58:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA51A7156; Tue, 9 Jul 2019 23:58:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x69NwCQd061167; Tue, 9 Jul 2019 23:58:12 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x69NwC7C061166; Tue, 9 Jul 2019 23:58:12 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201907092358.x69NwC7C061166@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 9 Jul 2019 23:58:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349871 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 349871 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E4D3E8CF3F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.91 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.91)[-0.908,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2019 23:58:13 -0000 Author: jhb Date: Tue Jul 9 23:58:12 2019 New Revision: 349871 URL: https://svnweb.freebsd.org/changeset/base/349871 Log: Use 'retval' label for first error in syscallenter(). This is more consistent with the rest of the function and lets us unindent most of the function. Reviewed by: kib MFC after: 1 month Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D20897 Modified: head/sys/kern/subr_syscall.c Modified: head/sys/kern/subr_syscall.c ============================================================================== --- head/sys/kern/subr_syscall.c Tue Jul 9 22:24:22 2019 (r349870) +++ head/sys/kern/subr_syscall.c Tue Jul 9 23:58:12 2019 (r349871) @@ -85,69 +85,68 @@ syscallenter(struct thread *td) (uintptr_t)td, "pid:%d", td->td_proc->p_pid, "arg0:%p", sa->args[0], "arg1:%p", sa->args[1], "arg2:%p", sa->args[2]); - if (error == 0) { + if (error != 0) + goto retval; - STOPEVENT(p, S_SCE, sa->narg); - if (p->p_flag & P_TRACED) { - PROC_LOCK(p); - if (p->p_ptevents & PTRACE_SCE) - ptracestop((td), SIGTRAP, NULL); - PROC_UNLOCK(p); - } - if (td->td_dbgflags & TDB_USERWR) { - /* - * Reread syscall number and arguments if - * debugger modified registers or memory. - */ - error = (p->p_sysent->sv_fetch_syscall_args)(td); + STOPEVENT(p, S_SCE, sa->narg); + if ((p->p_flag & P_TRACED) != 0) { + PROC_LOCK(p); + if (p->p_ptevents & PTRACE_SCE) + ptracestop((td), SIGTRAP, NULL); + PROC_UNLOCK(p); + } + if ((td->td_dbgflags & TDB_USERWR) != 0) { + /* + * Reread syscall number and arguments if debugger + * modified registers or memory. + */ + error = (p->p_sysent->sv_fetch_syscall_args)(td); #ifdef KTRACE - if (KTRPOINT(td, KTR_SYSCALL)) - ktrsyscall(sa->code, sa->narg, sa->args); + if (KTRPOINT(td, KTR_SYSCALL)) + ktrsyscall(sa->code, sa->narg, sa->args); #endif - if (error != 0) - goto retval; - } + if (error != 0) + goto retval; + } #ifdef CAPABILITY_MODE - /* - * In capability mode, we only allow access to system calls - * flagged with SYF_CAPENABLED. - */ - if (IN_CAPABILITY_MODE(td) && - !(sa->callp->sy_flags & SYF_CAPENABLED)) { - error = ECAPMODE; - goto retval; - } + /* + * In capability mode, we only allow access to system calls + * flagged with SYF_CAPENABLED. + */ + if (IN_CAPABILITY_MODE(td) && + !(sa->callp->sy_flags & SYF_CAPENABLED)) { + error = ECAPMODE; + goto retval; + } #endif - error = syscall_thread_enter(td, sa->callp); - if (error != 0) - goto retval; + error = syscall_thread_enter(td, sa->callp); + if (error != 0) + goto retval; #ifdef KDTRACE_HOOKS - /* Give the syscall:::entry DTrace probe a chance to fire. */ - if (__predict_false(systrace_enabled && - sa->callp->sy_entry != 0)) - (*systrace_probe_func)(sa, SYSTRACE_ENTRY, 0); + /* Give the syscall:::entry DTrace probe a chance to fire. */ + if (__predict_false(systrace_enabled && sa->callp->sy_entry != 0)) + (*systrace_probe_func)(sa, SYSTRACE_ENTRY, 0); #endif - AUDIT_SYSCALL_ENTER(sa->code, td); - error = (sa->callp->sy_call)(td, sa->args); - AUDIT_SYSCALL_EXIT(error, td); + AUDIT_SYSCALL_ENTER(sa->code, td); + error = (sa->callp->sy_call)(td, sa->args); + AUDIT_SYSCALL_EXIT(error, td); - /* Save the latest error return value. */ - if ((td->td_pflags & TDP_NERRNO) == 0) - td->td_errno = error; + /* Save the latest error return value. */ + if ((td->td_pflags & TDP_NERRNO) == 0) + td->td_errno = error; #ifdef KDTRACE_HOOKS - /* Give the syscall:::return DTrace probe a chance to fire. */ - if (__predict_false(systrace_enabled && - sa->callp->sy_return != 0)) - (*systrace_probe_func)(sa, SYSTRACE_RETURN, - error ? -1 : td->td_retval[0]); + /* Give the syscall:::return DTrace probe a chance to fire. */ + if (__predict_false(systrace_enabled && sa->callp->sy_return != 0)) + (*systrace_probe_func)(sa, SYSTRACE_RETURN, + error ? -1 : td->td_retval[0]); #endif - syscall_thread_exit(td, sa->callp); - } + syscall_thread_exit(td, sa->callp); + retval: KTR_STOP4(KTR_SYSC, "syscall", syscallname(p, sa->code), (uintptr_t)td, "pid:%d", td->td_proc->p_pid, "error:%d", error, From owner-svn-src-all@freebsd.org Wed Jul 10 01:08:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D36DD15EA81C; Wed, 10 Jul 2019 01:08:09 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 71F9C8F57C; Wed, 10 Jul 2019 01:08:09 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 198827D26; Wed, 10 Jul 2019 01:08:09 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6A188oc097397; Wed, 10 Jul 2019 01:08:08 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6A188bl097396; Wed, 10 Jul 2019 01:08:08 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201907100108.x6A188bl097396@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Wed, 10 Jul 2019 01:08:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349872 - head/tests/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/tests/sys/opencrypto X-SVN-Commit-Revision: 349872 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 71F9C8F57C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 01:08:10 -0000 Author: lwhsu Date: Wed Jul 10 01:08:08 2019 New Revision: 349872 URL: https://svnweb.freebsd.org/changeset/base/349872 Log: Correct definitions in sys.opencrypto.runtests.main for 32bit platform Reviewed by: cem, jhb MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20894 Modified: head/tests/sys/opencrypto/cryptodev.py Modified: head/tests/sys/opencrypto/cryptodev.py ============================================================================== --- head/tests/sys/opencrypto/cryptodev.py Tue Jul 9 23:58:12 2019 (r349871) +++ head/tests/sys/opencrypto/cryptodev.py Wed Jul 10 01:08:08 2019 (r349872) @@ -36,6 +36,7 @@ import array import binascii from fcntl import ioctl import os +import platform import random import signal from struct import pack as _pack @@ -116,14 +117,19 @@ class CryptAEAD(dpkt.Packet): # h2py.py can't handle multiarg macros CRIOGET = 3221513060 CIOCGSESSION = 3224396645 -CIOCGSESSION2 = 3225445226 CIOCFSESSION = 2147771238 -CIOCCRYPT = 3224396647 CIOCKEY = 3230688104 CIOCASYMFEAT = 1074029417 CIOCKEY2 = 3230688107 CIOCFINDDEV = 3223610220 -CIOCCRYPTAEAD = 3225445229 +if platform.architecture()[0] == '64bit': + CIOCGSESSION2 = 3225445226 + CIOCCRYPT = 3224396647 + CIOCCRYPTAEAD = 3225445229 +else: + CIOCGSESSION2 = 3224396650 + CIOCCRYPT = 3223085927 + CIOCCRYPTAEAD = 3223872365 def _getdev(): buf = array.array('I', [0]) From owner-svn-src-all@freebsd.org Wed Jul 10 03:45:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B03F615ED456; Wed, 10 Jul 2019 03:45:24 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2917B6DFCA; Wed, 10 Jul 2019 03:45:24 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD96D9876; Wed, 10 Jul 2019 03:45:23 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6A3jNan080955; Wed, 10 Jul 2019 03:45:23 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6A3jNvj080954; Wed, 10 Jul 2019 03:45:23 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201907100345.x6A3jNvj080954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 10 Jul 2019 03:45:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349873 - head X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 349873 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2917B6DFCA X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.92)[-0.922,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 03:45:24 -0000 Author: ian Date: Wed Jul 10 03:45:23 2019 New Revision: 349873 URL: https://svnweb.freebsd.org/changeset/base/349873 Log: Add pwm.9, it was also deleted during the big round of pwm changes. Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Wed Jul 10 01:08:08 2019 (r349872) +++ head/ObsoleteFiles.inc Wed Jul 10 03:45:23 2019 (r349873) @@ -40,8 +40,8 @@ # 20190618: sys/capability.h removed (sys/capsicum.h is the one to use) OLD_FILES+=usr/include/sys/capability.h -# 20190615: sys/pwm.h renamed to dev/pwmc.h -OLD_FILES+=usr/include/sys/pwm.h +# 20190615: sys/pwm.h renamed to dev/pwmc.h and pwm(9) removed +OLD_FILES+=usr/include/sys/pwm.h usr/share/man/man9/pwm.9 # 20190612: new clang import which bumps version from 8.0.0 to 8.0.1. OLD_FILES+=usr/lib/clang/8.0.0/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/8.0.0/include/sanitizer/asan_interface.h From owner-svn-src-all@freebsd.org Wed Jul 10 04:09:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D49E15ED833; Wed, 10 Jul 2019 04:09:16 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 436636EA1F; Wed, 10 Jul 2019 04:09:16 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1CD6F9BE3; Wed, 10 Jul 2019 04:09:16 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6A49FBn090906; Wed, 10 Jul 2019 04:09:15 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6A49FFQ090905; Wed, 10 Jul 2019 04:09:15 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201907100409.x6A49FFQ090905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 10 Jul 2019 04:09:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349874 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 349874 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 436636EA1F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.92)[-0.922,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 04:09:16 -0000 Author: jhibbits Date: Wed Jul 10 04:09:15 2019 New Revision: 349874 URL: https://svnweb.freebsd.org/changeset/base/349874 Log: powerpc: Clamp 32-bit binaries to 32-bit MAXUSER sv_maxuser specifies the maximum addressable space for user space. Presently this is all 64-bits worth, which is impossible for a 32-bit process. This bug has existed since the initial import of powerpc64 in 2010. MFC after: 2 weeks Modified: head/sys/powerpc/powerpc/elf32_machdep.c Modified: head/sys/powerpc/powerpc/elf32_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/elf32_machdep.c Wed Jul 10 03:45:23 2019 (r349873) +++ head/sys/powerpc/powerpc/elf32_machdep.c Wed Jul 10 04:09:15 2019 (r349874) @@ -97,7 +97,7 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_minuser = VM_MIN_ADDRESS, .sv_stackprot = VM_PROT_ALL, #ifdef __powerpc64__ - .sv_maxuser = VM_MAXUSER_ADDRESS, + .sv_maxuser = VM_MAXUSER_ADDRESS32, .sv_usrstack = FREEBSD32_USRSTACK, .sv_psstrings = FREEBSD32_PS_STRINGS, .sv_copyout_strings = freebsd32_copyout_strings, From owner-svn-src-all@freebsd.org Wed Jul 10 05:45:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5FF8815CAFE9; Wed, 10 Jul 2019 05:45:52 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F120A716EF; Wed, 10 Jul 2019 05:45:51 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B88A1ACA3; Wed, 10 Jul 2019 05:45:51 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6A5jp3h042887; Wed, 10 Jul 2019 05:45:51 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6A5joIX042882; Wed, 10 Jul 2019 05:45:50 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201907100545.x6A5joIX042882@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Wed, 10 Jul 2019 05:45:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349875 - in head: share/man/man4 sys/dev/usb sys/dev/usb/net sys/dev/usb/quirk X-SVN-Group: head X-SVN-Commit-Author: hrs X-SVN-Commit-Paths: in head: share/man/man4 sys/dev/usb sys/dev/usb/net sys/dev/usb/quirk X-SVN-Commit-Revision: 349875 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F120A716EF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.92)[-0.924,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 05:45:52 -0000 Author: hrs Date: Wed Jul 10 05:45:50 2019 New Revision: 349875 URL: https://svnweb.freebsd.org/changeset/base/349875 Log: Add support for RTL8156, 2.5GbE USB network controller, to if_cdce(4). This chip can be found in Planex USB-LAN2500R. Modified: head/share/man/man4/cdce.4 head/sys/dev/usb/net/if_cdce.c head/sys/dev/usb/quirk/usb_quirk.c head/sys/dev/usb/usbdevs Modified: head/share/man/man4/cdce.4 ============================================================================== --- head/share/man/man4/cdce.4 Wed Jul 10 04:09:15 2019 (r349874) +++ head/share/man/man4/cdce.4 Wed Jul 10 05:45:50 2019 (r349875) @@ -28,7 +28,7 @@ .\" $NetBSD: cdce.4,v 1.4 2004/12/08 18:35:56 peter Exp $ .\" $FreeBSD$ .\" -.Dd May 21, 2018 +.Dd July 10, 2019 .Dt CDCE 4 .Os .Sh NAME @@ -89,6 +89,10 @@ Prolific PL-2501 Host-to-Host Bridge Controller Sharp Zaurus PDA .It Terayon TJ-715 DOCSIS Cable Modem +.It +Realtek RTL8156 USB GBE/2.5G Ethernet Family Controller +.It +Planex USB-LAN2500R .El .Sh DIAGNOSTICS .Bl -diag Modified: head/sys/dev/usb/net/if_cdce.c ============================================================================== --- head/sys/dev/usb/net/if_cdce.c Wed Jul 10 04:09:15 2019 (r349874) +++ head/sys/dev/usb/net/if_cdce.c Wed Jul 10 05:45:50 2019 (r349875) @@ -276,6 +276,7 @@ static const STRUCT_USB_HOST_ID cdce_host_devs[] = { {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SLA300, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SLC700, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SLC750, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, + {USB_VPI(USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8156, 0)}, {USB_VENDOR(USB_VENDOR_HUAWEI), USB_IFACE_CLASS(UICLASS_VENDOR), USB_IFACE_SUBCLASS(0x02), USB_IFACE_PROTOCOL(0x16), Modified: head/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- head/sys/dev/usb/quirk/usb_quirk.c Wed Jul 10 04:09:15 2019 (r349874) +++ head/sys/dev/usb/quirk/usb_quirk.c Wed Jul 10 05:45:50 2019 (r349875) @@ -101,6 +101,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK USB_QUIRK(ELSA, MODEM1, 0x0000, 0xffff, UQ_CFG_INDEX_1), USB_QUIRK(PLANEX2, MZKUE150N, 0x0000, 0xffff, UQ_CFG_INDEX_1), USB_QUIRK(CISCOLINKSYS, USB3GIGV1, 0x0000, 0xffff, UQ_CFG_INDEX_1), + USB_QUIRK(REALTEK, RTL8156, 0x0000, 0xffff, UQ_CFG_INDEX_2), /* Quirks for printer devices */ USB_QUIRK(HP, 895C, 0x0000, 0xffff, UQ_BROKEN_BIDIR), USB_QUIRK(HP, 880C, 0x0000, 0xffff, UQ_BROKEN_BIDIR), Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Wed Jul 10 04:09:15 2019 (r349874) +++ head/sys/dev/usb/usbdevs Wed Jul 10 05:45:50 2019 (r349875) @@ -3962,6 +3962,7 @@ product REALTEK RTL8188RU_2 0x317f RTL8188RU product REALTEK USBKR100 0x8150 USBKR100 USB Ethernet product REALTEK RTL8152 0x8152 RTL8152 USB Ethernet product REALTEK RTL8153 0x8153 RTL8153 USB Ethernet +product REALTEK RTL8156 0x8156 RTL8156 USB Ethernet product REALTEK RTL8188CE_0 0x8170 RTL8188CE product REALTEK RTL8171 0x8171 RTL8171 product REALTEK RTL8172 0x8172 RTL8172 From owner-svn-src-all@freebsd.org Wed Jul 10 05:57:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D023915CB2AD; Wed, 10 Jul 2019 05:57:38 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7242871CC2; Wed, 10 Jul 2019 05:57:38 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 519C1AE45; Wed, 10 Jul 2019 05:57:38 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6A5vcjW047855; Wed, 10 Jul 2019 05:57:38 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6A5vbeE047853; Wed, 10 Jul 2019 05:57:37 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201907100557.x6A5vbeE047853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 10 Jul 2019 05:57:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349876 - head/contrib/llvm/tools/clang/include/clang/AST X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm/tools/clang/include/clang/AST X-SVN-Commit-Revision: 349876 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7242871CC2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.93)[-0.926,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 05:57:39 -0000 Author: dim Date: Wed Jul 10 05:57:37 2019 New Revision: 349876 URL: https://svnweb.freebsd.org/changeset/base/349876 Log: Apply a workaround to be able to build clang 8.0.0 headers with clang 3.4.1, which is still in the stable/10 branch. It looks like clang 3.4.1 implements static_asserts by instantiating a temporary static object, and if those are in an anonymous union, it results in "error: anonymous union can only contain non-static data members". To work around this implementation limitation, move the static_asserts in question out of the anonymous unions. This should make building the latest stable/11 from stable/10 possible again. Reported by: Mike Tancsa MFC after: 3 days Modified: head/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h head/contrib/llvm/tools/clang/include/clang/AST/Type.h Modified: head/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h ============================================================================== --- head/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h Wed Jul 10 05:45:50 2019 (r349875) +++ head/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h Wed Jul 10 05:57:37 2019 (r349876) @@ -1696,30 +1696,30 @@ class DeclContext { (protected) ObjCContainerDeclBitfields ObjCContainerDeclBits; LinkageSpecDeclBitfields LinkageSpecDeclBits; BlockDeclBitfields BlockDeclBits; - - static_assert(sizeof(DeclContextBitfields) <= 8, - "DeclContextBitfields is larger than 8 bytes!"); - static_assert(sizeof(TagDeclBitfields) <= 8, - "TagDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(EnumDeclBitfields) <= 8, - "EnumDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(RecordDeclBitfields) <= 8, - "RecordDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(OMPDeclareReductionDeclBitfields) <= 8, - "OMPDeclareReductionDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(FunctionDeclBitfields) <= 8, - "FunctionDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(CXXConstructorDeclBitfields) <= 8, - "CXXConstructorDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(ObjCMethodDeclBitfields) <= 8, - "ObjCMethodDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(ObjCContainerDeclBitfields) <= 8, - "ObjCContainerDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(LinkageSpecDeclBitfields) <= 8, - "LinkageSpecDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(BlockDeclBitfields) <= 8, - "BlockDeclBitfields is larger than 8 bytes!"); }; + + static_assert(sizeof(DeclContextBitfields) <= 8, + "DeclContextBitfields is larger than 8 bytes!"); + static_assert(sizeof(TagDeclBitfields) <= 8, + "TagDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(EnumDeclBitfields) <= 8, + "EnumDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(RecordDeclBitfields) <= 8, + "RecordDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(OMPDeclareReductionDeclBitfields) <= 8, + "OMPDeclareReductionDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(FunctionDeclBitfields) <= 8, + "FunctionDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(CXXConstructorDeclBitfields) <= 8, + "CXXConstructorDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(ObjCMethodDeclBitfields) <= 8, + "ObjCMethodDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(ObjCContainerDeclBitfields) <= 8, + "ObjCContainerDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(LinkageSpecDeclBitfields) <= 8, + "LinkageSpecDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(BlockDeclBitfields) <= 8, + "BlockDeclBitfields is larger than 8 bytes!"); /// FirstDecl - The first declaration stored within this declaration /// context. Modified: head/contrib/llvm/tools/clang/include/clang/AST/Type.h ============================================================================== --- head/contrib/llvm/tools/clang/include/clang/AST/Type.h Wed Jul 10 05:45:50 2019 (r349875) +++ head/contrib/llvm/tools/clang/include/clang/AST/Type.h Wed Jul 10 05:57:37 2019 (r349876) @@ -1720,41 +1720,41 @@ class Type : public ExtQualsTypeCommonBase { (protecte DependentTemplateSpecializationTypeBitfields DependentTemplateSpecializationTypeBits; PackExpansionTypeBitfields PackExpansionTypeBits; - - static_assert(sizeof(TypeBitfields) <= 8, - "TypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(ArrayTypeBitfields) <= 8, - "ArrayTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(AttributedTypeBitfields) <= 8, - "AttributedTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(AutoTypeBitfields) <= 8, - "AutoTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(BuiltinTypeBitfields) <= 8, - "BuiltinTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(FunctionTypeBitfields) <= 8, - "FunctionTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(ObjCObjectTypeBitfields) <= 8, - "ObjCObjectTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(ReferenceTypeBitfields) <= 8, - "ReferenceTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(TypeWithKeywordBitfields) <= 8, - "TypeWithKeywordBitfields is larger than 8 bytes!"); - static_assert(sizeof(ElaboratedTypeBitfields) <= 8, - "ElaboratedTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(VectorTypeBitfields) <= 8, - "VectorTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(SubstTemplateTypeParmPackTypeBitfields) <= 8, - "SubstTemplateTypeParmPackTypeBitfields is larger" - " than 8 bytes!"); - static_assert(sizeof(TemplateSpecializationTypeBitfields) <= 8, - "TemplateSpecializationTypeBitfields is larger" - " than 8 bytes!"); - static_assert(sizeof(DependentTemplateSpecializationTypeBitfields) <= 8, - "DependentTemplateSpecializationTypeBitfields is larger" - " than 8 bytes!"); - static_assert(sizeof(PackExpansionTypeBitfields) <= 8, - "PackExpansionTypeBitfields is larger than 8 bytes"); }; + + static_assert(sizeof(TypeBitfields) <= 8, + "TypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(ArrayTypeBitfields) <= 8, + "ArrayTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(AttributedTypeBitfields) <= 8, + "AttributedTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(AutoTypeBitfields) <= 8, + "AutoTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(BuiltinTypeBitfields) <= 8, + "BuiltinTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(FunctionTypeBitfields) <= 8, + "FunctionTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(ObjCObjectTypeBitfields) <= 8, + "ObjCObjectTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(ReferenceTypeBitfields) <= 8, + "ReferenceTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(TypeWithKeywordBitfields) <= 8, + "TypeWithKeywordBitfields is larger than 8 bytes!"); + static_assert(sizeof(ElaboratedTypeBitfields) <= 8, + "ElaboratedTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(VectorTypeBitfields) <= 8, + "VectorTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(SubstTemplateTypeParmPackTypeBitfields) <= 8, + "SubstTemplateTypeParmPackTypeBitfields is larger" + " than 8 bytes!"); + static_assert(sizeof(TemplateSpecializationTypeBitfields) <= 8, + "TemplateSpecializationTypeBitfields is larger" + " than 8 bytes!"); + static_assert(sizeof(DependentTemplateSpecializationTypeBitfields) <= 8, + "DependentTemplateSpecializationTypeBitfields is larger" + " than 8 bytes!"); + static_assert(sizeof(PackExpansionTypeBitfields) <= 8, + "PackExpansionTypeBitfields is larger than 8 bytes"); private: template friend class TypePropertyCache; From owner-svn-src-all@freebsd.org Wed Jul 10 08:05:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 767E315CE694; Wed, 10 Jul 2019 08:05:14 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1CB0676A59; Wed, 10 Jul 2019 08:05:14 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E93A8C5A2; Wed, 10 Jul 2019 08:05:13 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6A85Dr3014830; Wed, 10 Jul 2019 08:05:13 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6A85DLi014829; Wed, 10 Jul 2019 08:05:13 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201907100805.x6A85DLi014829@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Wed, 10 Jul 2019 08:05:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349877 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: tijl X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 349877 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1CB0676A59 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.947,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 08:05:14 -0000 Author: tijl Date: Wed Jul 10 08:05:13 2019 New Revision: 349877 URL: https://svnweb.freebsd.org/changeset/base/349877 Log: MFC r349640, r349706: Also remove lib32 version of libcasper.so.0. Modified: stable/12/ObsoleteFiles.inc Directory Properties: stable/12/ (props changed) Modified: stable/12/ObsoleteFiles.inc ============================================================================== --- stable/12/ObsoleteFiles.inc Wed Jul 10 05:57:37 2019 (r349876) +++ stable/12/ObsoleteFiles.inc Wed Jul 10 08:05:13 2019 (r349877) @@ -585,6 +585,7 @@ OLD_FILES+=usr/share/man/man3/arc4random_stir.3.gz OLD_FILES+=usr/bin/send-pr # 20180725: Cleanup old libcasper.so.0 OLD_LIBS+=lib/libcasper.so.0 +OLD_LIBS+=usr/lib32/libcasper.so.0 # 20180722: indent(1) option renamed, test files follow OLD_FILES+=usr/bin/indent/tests/nsac.0 OLD_FILES+=usr/bin/indent/tests/nsac.0.pro From owner-svn-src-all@freebsd.org Wed Jul 10 08:07:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C63515CE736; Wed, 10 Jul 2019 08:07:34 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 13CAA76C01; Wed, 10 Jul 2019 08:07:34 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFAD3C5A3; Wed, 10 Jul 2019 08:07:33 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6A87XE1014977; Wed, 10 Jul 2019 08:07:33 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6A87XBW014976; Wed, 10 Jul 2019 08:07:33 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201907100807.x6A87XBW014976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Wed, 10 Jul 2019 08:07:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349878 - stable/12/tools/build/mk X-SVN-Group: stable-12 X-SVN-Commit-Author: tijl X-SVN-Commit-Paths: stable/12/tools/build/mk X-SVN-Commit-Revision: 349878 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 13CAA76C01 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.947,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 08:07:34 -0000 Author: tijl Date: Wed Jul 10 08:07:33 2019 New Revision: 349878 URL: https://svnweb.freebsd.org/changeset/base/349878 Log: MFC r349641: Also remove lib32 versions of libradius. Modified: stable/12/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/12/ (props changed) Modified: stable/12/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/12/tools/build/mk/OptionalObsoleteFiles.inc Wed Jul 10 08:05:13 2019 (r349877) +++ stable/12/tools/build/mk/OptionalObsoleteFiles.inc Wed Jul 10 08:07:33 2019 (r349878) @@ -7893,6 +7893,12 @@ OLD_LIBS+=usr/lib/libradius.so.4 OLD_FILES+=usr/lib/libradius_p.a OLD_FILES+=usr/lib/pam_radius.so OLD_LIBS+=usr/lib/pam_radius.so.6 +OLD_FILES+=usr/lib32/libradius.a +OLD_FILES+=usr/lib32/libradius.so +OLD_LIBS+=usr/lib32/libradius.so.4 +OLD_FILES+=usr/lib32/libradius_p.a +OLD_FILES+=usr/lib32/pam_radius.so +OLD_LIBS+=usr/lib32/pam_radius.so.6 OLD_FILES+=usr/include/radlib.h OLD_FILES+=usr/include/radlib_vs.h OLD_FILES+=usr/share/man/man3/libradius.3.gz From owner-svn-src-all@freebsd.org Wed Jul 10 08:08:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D0F415CE79B; Wed, 10 Jul 2019 08:08:15 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F017F76D3A; Wed, 10 Jul 2019 08:08:14 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C9E0CC5A4; Wed, 10 Jul 2019 08:08:14 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6A88Ef9015049; Wed, 10 Jul 2019 08:08:14 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6A88EXa015048; Wed, 10 Jul 2019 08:08:14 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201907100808.x6A88EXa015048@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Wed, 10 Jul 2019 08:08:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349879 - stable/11/tools/build/mk X-SVN-Group: stable-11 X-SVN-Commit-Author: tijl X-SVN-Commit-Paths: stable/11/tools/build/mk X-SVN-Commit-Revision: 349879 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F017F76D3A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.947,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 08:08:15 -0000 Author: tijl Date: Wed Jul 10 08:08:14 2019 New Revision: 349879 URL: https://svnweb.freebsd.org/changeset/base/349879 Log: MFC r349641: Also remove lib32 versions of libradius. Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/11/tools/build/mk/OptionalObsoleteFiles.inc Wed Jul 10 08:07:33 2019 (r349878) +++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc Wed Jul 10 08:08:14 2019 (r349879) @@ -7284,6 +7284,12 @@ OLD_LIBS+=usr/lib/libradius.so.4 OLD_FILES+=usr/lib/libradius_p.a OLD_FILES+=usr/lib/pam_radius.so OLD_LIBS+=usr/lib/pam_radius.so.6 +OLD_FILES+=usr/lib32/libradius.a +OLD_FILES+=usr/lib32/libradius.so +OLD_LIBS+=usr/lib32/libradius.so.4 +OLD_FILES+=usr/lib32/libradius_p.a +OLD_FILES+=usr/lib32/pam_radius.so +OLD_LIBS+=usr/lib32/pam_radius.so.6 OLD_FILES+=usr/include/radlib.h OLD_FILES+=usr/include/radlib_vs.h OLD_FILES+=usr/share/man/man3/libradius.3.gz From owner-svn-src-all@freebsd.org Wed Jul 10 08:19:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5853115CEA9D; Wed, 10 Jul 2019 08:19:34 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EED417733D; Wed, 10 Jul 2019 08:19:33 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9854C74A; Wed, 10 Jul 2019 08:19:33 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6A8JXNZ020464; Wed, 10 Jul 2019 08:19:33 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6A8JXHe020462; Wed, 10 Jul 2019 08:19:33 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201907100819.x6A8JXHe020462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Wed, 10 Jul 2019 08:19:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349880 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: tijl X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 349880 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EED417733D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.954,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 08:19:34 -0000 Author: tijl Date: Wed Jul 10 08:19:33 2019 New Revision: 349880 URL: https://svnweb.freebsd.org/changeset/base/349880 Log: Let linuxulator mprotect mask unsupported bits before calling kern_mprotect. After r349240 kern_mprotect returns EINVAL for unsupported bits in the prot argument. Linux rtld uses PROT_GROWSDOWN and PROT_GROWS_UP when marking the stack executable. Mask these bits like kern_mprotect used to do. For other unsupported bits EINVAL is returned like Linux does. Reviewed by: trasz, brooks MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20864 Modified: head/sys/compat/linux/linux_mmap.c head/sys/compat/linux/linux_mmap.h Modified: head/sys/compat/linux/linux_mmap.c ============================================================================== --- head/sys/compat/linux/linux_mmap.c Wed Jul 10 08:08:14 2019 (r349879) +++ head/sys/compat/linux/linux_mmap.c Wed Jul 10 08:19:33 2019 (r349880) @@ -228,6 +228,11 @@ int linux_mprotect_common(struct thread *td, uintptr_t addr, size_t len, int prot) { + /* XXX Ignore PROT_GROWSDOWN and PROT_GROWSUP for now. */ + prot &= ~(LINUX_PROT_GROWSDOWN | LINUX_PROT_GROWSUP); + if ((prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC)) != 0) + return (EINVAL); + #if defined(__amd64__) linux_fixup_prot(td, &prot); #endif Modified: head/sys/compat/linux/linux_mmap.h ============================================================================== --- head/sys/compat/linux/linux_mmap.h Wed Jul 10 08:08:14 2019 (r349879) +++ head/sys/compat/linux/linux_mmap.h Wed Jul 10 08:19:33 2019 (r349880) @@ -41,6 +41,8 @@ #define LINUX_MAP_ANON 0x0020 #define LINUX_MAP_GROWSDOWN 0x0100 +#define LINUX_PROT_GROWSDOWN 0x01000000 +#define LINUX_PROT_GROWSUP 0x02000000 int linux_mmap_common(struct thread *, uintptr_t, size_t, int, int, int, off_t); From owner-svn-src-all@freebsd.org Wed Jul 10 12:10:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0EB815D53DF; Wed, 10 Jul 2019 12:10:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 75BD588C27; Wed, 10 Jul 2019 12:10:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42586EE2C; Wed, 10 Jul 2019 12:10:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6ACABDc039392; Wed, 10 Jul 2019 12:10:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6ACABmh039391; Wed, 10 Jul 2019 12:10:11 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201907101210.x6ACABmh039391@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 10 Jul 2019 12:10:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349881 - stable/12/sys/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/conf X-SVN-Commit-Revision: 349881 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 75BD588C27 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.955,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 12:10:12 -0000 Author: mav Date: Wed Jul 10 12:10:10 2019 New Revision: 349881 URL: https://svnweb.freebsd.org/changeset/base/349881 Log: MFC r349418: Fix qlxgbe(4) static build. Modified: stable/12/sys/conf/files.amd64 Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/files.amd64 ============================================================================== --- stable/12/sys/conf/files.amd64 Wed Jul 10 08:19:33 2019 (r349880) +++ stable/12/sys/conf/files.amd64 Wed Jul 10 12:10:10 2019 (r349881) @@ -383,6 +383,9 @@ dev/qlxgbe/ql_isr.c optional qlxgbe pci dev/qlxgbe/ql_misc.c optional qlxgbe pci dev/qlxgbe/ql_os.c optional qlxgbe pci dev/qlxgbe/ql_reset.c optional qlxgbe pci +dev/qlxgbe/ql_fw.c optional qlxgbe pci +dev/qlxgbe/ql_boot.c optional qlxgbe pci +dev/qlxgbe/ql_minidump.c optional qlxgbe pci dev/qlnx/qlnxe/ecore_cxt.c optional qlnxe pci \ compile-with "${LINUXKPI_C}" dev/qlnx/qlnxe/ecore_dbg_fw_funcs.c optional qlnxe pci \ From owner-svn-src-all@freebsd.org Wed Jul 10 12:15:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C90715D5662; Wed, 10 Jul 2019 12:15:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E57E7890DE; Wed, 10 Jul 2019 12:15:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9C3CEFCC; Wed, 10 Jul 2019 12:15:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6ACF7eq044351; Wed, 10 Jul 2019 12:15:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6ACF7Rr044350; Wed, 10 Jul 2019 12:15:07 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201907101215.x6ACF7Rr044350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 10 Jul 2019 12:15:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349882 - stable/12/share/man/man4 X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/share/man/man4 X-SVN-Commit-Revision: 349882 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E57E7890DE X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.955,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 12:15:08 -0000 Author: mav Date: Wed Jul 10 12:15:07 2019 New Revision: 349882 URL: https://svnweb.freebsd.org/changeset/base/349882 Log: MFC r340093 (by imp): Document disbale_phy in ahcich sysctls. Modified: stable/12/share/man/man4/ahci.4 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/ahci.4 ============================================================================== --- stable/12/share/man/man4/ahci.4 Wed Jul 10 12:10:10 2019 (r349881) +++ stable/12/share/man/man4/ahci.4 Wed Jul 10 12:15:07 2019 (r349882) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 22, 2013 +.Dd November 2, 2018 .Dt AHCI 4 .Os .Sh NAME @@ -162,6 +162,13 @@ fault LED device nodes .It Pa /dev/led/ahci*.*.locate locate LED device nodes .El +.Sh SYSCTL +.Bl -tag +.It Pa dev.ahcich.X.disable_phy +Set to 1 to disable the phy for the drive on channel X. +Set to 0 to enable the phy. +Useful for turning off troublemakers. +Also useful for debugging when you need the ada drive to come and go. .Sh SEE ALSO .Xr ada 4 , .Xr ata 4 , From owner-svn-src-all@freebsd.org Wed Jul 10 12:40:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4EC0815D5F74; Wed, 10 Jul 2019 12:40:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E335389F46; Wed, 10 Jul 2019 12:40:10 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07577F35D; Wed, 10 Jul 2019 12:40:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6ACe7F2055369; Wed, 10 Jul 2019 12:40:07 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6ACe7pp055368; Wed, 10 Jul 2019 12:40:07 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201907101240.x6ACe7pp055368@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 10 Jul 2019 12:40:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349883 - head/sys/dev/ow X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/ow X-SVN-Commit-Revision: 349883 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E335389F46 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.958,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 12:40:11 -0000 Author: avg Date: Wed Jul 10 12:40:07 2019 New Revision: 349883 URL: https://svnweb.freebsd.org/changeset/base/349883 Log: owc_gpiobus: small formatting cleanup MFC after: 1 week Modified: head/sys/dev/ow/owc_gpiobus.c Modified: head/sys/dev/ow/owc_gpiobus.c ============================================================================== --- head/sys/dev/ow/owc_gpiobus.c Wed Jul 10 12:15:07 2019 (r349882) +++ head/sys/dev/ow/owc_gpiobus.c Wed Jul 10 12:40:07 2019 (r349883) @@ -191,7 +191,7 @@ owc_gpiobus_write_one(device_t dev, struct ow_timing * sc = device_get_softc(dev); error = GETBUS(sc); if (error != 0) - return error; + return (error); critical_enter(); @@ -205,10 +205,10 @@ owc_gpiobus_write_one(device_t dev, struct ow_timing * DELAY(t->t_slot - t->t_low1 + t->t_rec); critical_exit(); - + RELBUS(sc); - - return 0; + + return (0); } /* @@ -232,7 +232,7 @@ owc_gpiobus_write_zero(device_t dev, struct ow_timing sc = device_get_softc(dev); error = GETBUS(sc); if (error != 0) - return error; + return (error); critical_enter(); @@ -248,8 +248,8 @@ owc_gpiobus_write_zero(device_t dev, struct ow_timing critical_exit(); RELBUS(sc); - - return 0; + + return (0); } /* @@ -277,7 +277,7 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing * sc = device_get_softc(dev); error = GETBUS(sc); if (error != 0) - return error; + return (error); /* Force low for t_lowr microseconds */ then = sbinuptime(); @@ -309,8 +309,8 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing * } while ((now - then) / SBT_1US < t->t_slot); RELBUS(sc); - - return 0; + + return (error); } /* @@ -338,10 +338,9 @@ owc_gpiobus_reset_and_presence(device_t dev, struct ow sc = device_get_softc(dev); error = GETBUS(sc); if (error != 0) - return error; - + return (error); - /* + /* * Read the current state of the bus. The steady state of an idle bus is * high. Badly wired buses that are missing the required pull up, or * that have a short circuit to ground cause all kinds of mischief when @@ -353,7 +352,7 @@ owc_gpiobus_reset_and_presence(device_t dev, struct ow if (buf == 0) { *bit = -1; RELBUS(sc); - return EIO; + return (EIO); } critical_enter(); @@ -384,12 +383,12 @@ owc_gpiobus_reset_and_presence(device_t dev, struct ow if (buf == 0) { *bit = -1; RELBUS(sc); - return EIO; + return (EIO); } RELBUS(sc); - return 0; + return (0); } static devclass_t owc_gpiobus_devclass; From owner-svn-src-all@freebsd.org Wed Jul 10 13:35:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67DD415D75E3; Wed, 10 Jul 2019 13:35:02 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0ABB48C0EB; Wed, 10 Jul 2019 13:35:02 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF885FD57; Wed, 10 Jul 2019 13:35:01 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6ADZ1G3085543; Wed, 10 Jul 2019 13:35:01 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6ADZ1Ce085542; Wed, 10 Jul 2019 13:35:01 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201907101335.x6ADZ1Ce085542@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 10 Jul 2019 13:35:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349884 - stable/11/sys/conf X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/sys/conf X-SVN-Commit-Revision: 349884 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0ABB48C0EB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.936,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 13:35:02 -0000 Author: gjb Date: Wed Jul 10 13:35:01 2019 New Revision: 349884 URL: https://svnweb.freebsd.org/changeset/base/349884 Log: Call stable/11 -STABLE now that 11.3-RELEASE is out. Reminded by: marck Sponsored by: Rubicon Communications, LLC (Netgate) Modified: stable/11/sys/conf/newvers.sh Modified: stable/11/sys/conf/newvers.sh ============================================================================== --- stable/11/sys/conf/newvers.sh Wed Jul 10 12:40:07 2019 (r349883) +++ stable/11/sys/conf/newvers.sh Wed Jul 10 13:35:01 2019 (r349884) @@ -44,7 +44,7 @@ TYPE="FreeBSD" REVISION="11.3" -BRANCH="PRERELEASE" +BRANCH="STABLE" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@freebsd.org Wed Jul 10 13:36:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55DCC15D7667; Wed, 10 Jul 2019 13:36:18 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F0D8C8C256; Wed, 10 Jul 2019 13:36:17 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C3D5DFD58; Wed, 10 Jul 2019 13:36:17 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6ADaH61085636; Wed, 10 Jul 2019 13:36:17 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6ADaH84085635; Wed, 10 Jul 2019 13:36:17 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <201907101336.x6ADaH84085635@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Wed, 10 Jul 2019 13:36:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349885 - head/sys/powerpc/pseries X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: head/sys/powerpc/pseries X-SVN-Commit-Revision: 349885 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F0D8C8C256 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.941,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 13:36:18 -0000 Author: luporl Date: Wed Jul 10 13:36:17 2019 New Revision: 349885 URL: https://svnweb.freebsd.org/changeset/base/349885 Log: [PPC64] pseries: fix realmaxaddr calculation On POWER9/pseries, QEMU passes several regions of memory, instead of a single region containing all memory, as the code was expecting. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D20857 Modified: head/sys/powerpc/pseries/platform_chrp.c Modified: head/sys/powerpc/pseries/platform_chrp.c ============================================================================== --- head/sys/powerpc/pseries/platform_chrp.c Wed Jul 10 13:35:01 2019 (r349884) +++ head/sys/powerpc/pseries/platform_chrp.c Wed Jul 10 13:36:17 2019 (r349885) @@ -140,8 +140,15 @@ chrp_attach(platform_t plat) if (!(mfmsr() & PSL_HV)) { struct mem_region *phys, *avail; int nphys, navail; + vm_offset_t off; + mem_regions(&phys, &nphys, &avail, &navail); - realmaxaddr = phys[0].mr_size; + + realmaxaddr = 0; + for (i = 0; i < nphys; i++) { + off = phys[i].mr_start + phys[i].mr_size; + realmaxaddr = MAX(off, realmaxaddr); + } pmap_mmu_install("mmu_phyp", BUS_PROBE_SPECIFIC); cpu_idle_hook = phyp_cpu_idle; From owner-svn-src-all@freebsd.org Wed Jul 10 13:47:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E714615D79F6; Wed, 10 Jul 2019 13:47:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 85B5C8C8A6; Wed, 10 Jul 2019 13:47:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 581F5FF12; Wed, 10 Jul 2019 13:47:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6ADlB74090818; Wed, 10 Jul 2019 13:47:11 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6ADlBU8090817; Wed, 10 Jul 2019 13:47:11 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201907101347.x6ADlBU8090817@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 10 Jul 2019 13:47:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349886 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 349886 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 85B5C8C8A6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.939,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 13:47:12 -0000 Author: avg Date: Wed Jul 10 13:47:10 2019 New Revision: 349886 URL: https://svnweb.freebsd.org/changeset/base/349886 Log: linuxcommon: add module version MFC after: 2 weeks Modified: head/sys/compat/linux/linux_common.c Modified: head/sys/compat/linux/linux_common.c ============================================================================== --- head/sys/compat/linux/linux_common.c Wed Jul 10 13:36:17 2019 (r349885) +++ head/sys/compat/linux/linux_common.c Wed Jul 10 13:47:10 2019 (r349886) @@ -98,3 +98,4 @@ static moduledata_t linux_common_mod = { }; DECLARE_MODULE(linuxcommon, linux_common_mod, SI_SUB_EXEC, SI_ORDER_ANY); +MODULE_VERSION(linuxcommon, 1); From owner-svn-src-all@freebsd.org Wed Jul 10 14:34:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9EFE115D8771; Wed, 10 Jul 2019 14:34:53 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 422888E248; Wed, 10 Jul 2019 14:34:53 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1AC2B187B3; Wed, 10 Jul 2019 14:34:53 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6AEYqY9016440; Wed, 10 Jul 2019 14:34:52 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6AEYqIh016439; Wed, 10 Jul 2019 14:34:52 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201907101434.x6AEYqIh016439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 10 Jul 2019 14:34:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349887 - head/sys/arm/include X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/arm/include X-SVN-Commit-Revision: 349887 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 422888E248 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.962,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 14:34:53 -0000 Author: ian Date: Wed Jul 10 14:34:52 2019 New Revision: 349887 URL: https://svnweb.freebsd.org/changeset/base/349887 Log: De-pollute arm's sysarch.h. Instead of including stdint.h for uintptr_t, include sys/_types.h and use __types for everything that isn't a native C keyword type. Remove the #include of cdefs.h. It appears after the include of armreg.h which has a precondition of cdefs.h being included before it, so everyone including sysarch.h is already including cdefs.h. (When armv5 support goes away, there will be no need include armreg.h here either.) Unfortunately, the unprefixed struct member names "addr" and "len" cannot be changed, because 3rd-party software is relying on them (libcompiler_rt is one known consumer). Modified: head/sys/arm/include/sysarch.h Modified: head/sys/arm/include/sysarch.h ============================================================================== --- head/sys/arm/include/sysarch.h Wed Jul 10 13:47:10 2019 (r349886) +++ head/sys/arm/include/sysarch.h Wed Jul 10 14:34:52 2019 (r349887) @@ -65,12 +65,10 @@ #ifndef LOCORE #ifndef __ASSEMBLER__ -#include - /* - * Pickup definition of uintptr_t + * Pickup definition of various __types. */ -#include +#include /* * Architecture specific syscalls (arm) @@ -83,19 +81,19 @@ #define ARM_GET_VFPSTATE 4 struct arm_sync_icache_args { - uintptr_t addr; /* Virtual start address */ - size_t len; /* Region size */ + __uintptr_t addr; /* Virtual start address */ + __size_t len; /* Region size */ }; struct arm_get_vfpstate_args { - size_t mc_vfp_size; + __size_t mc_vfp_size; void *mc_vfp; }; #ifndef _KERNEL __BEGIN_DECLS -int arm_sync_icache (u_int addr, int len); -int arm_drain_writebuf (void); +int arm_sync_icache(unsigned int, int); +int arm_drain_writebuf(void); int sysarch(int, void *); __END_DECLS #endif From owner-svn-src-all@freebsd.org Wed Jul 10 14:46:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 013CA15D8C64; Wed, 10 Jul 2019 14:46:20 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9C4828EB88; Wed, 10 Jul 2019 14:46:19 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7262718984; Wed, 10 Jul 2019 14:46:19 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6AEkJOL021856; Wed, 10 Jul 2019 14:46:19 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6AEkJPQ021855; Wed, 10 Jul 2019 14:46:19 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201907101446.x6AEkJPQ021855@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 10 Jul 2019 14:46:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349888 - stable/11/release/doc/share/xml X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/release/doc/share/xml X-SVN-Commit-Revision: 349888 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9C4828EB88 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 14:46:20 -0000 Author: gjb Date: Wed Jul 10 14:46:18 2019 New Revision: 349888 URL: https://svnweb.freebsd.org/changeset/base/349888 Log: Prune leftover security/errata information from 11.2 that was supposed to be removed when regenerating the 11.3 errata page. Reported by: Terry Kennedy Sponsored by: Rubicon Communications, LLC (Netgate) Modified: stable/11/release/doc/share/xml/errata.xml stable/11/release/doc/share/xml/security.xml Modified: stable/11/release/doc/share/xml/errata.xml ============================================================================== --- stable/11/release/doc/share/xml/errata.xml Wed Jul 10 14:34:52 2019 (r349887) +++ stable/11/release/doc/share/xml/errata.xml Wed Jul 10 14:46:18 2019 (r349888) @@ -19,136 +19,9 @@ - FreeBSD-EN-18:08.lazyfpu - 12 September 2018 - Regression in Lazy FPU remediation - - - - FreeBSD-EN-18:09.ip - 27 September 2018 - IP fragment remediation causes - IPv6 reassembly failure - - - - FreeBSD-EN-18:10.syscall - 27 September 2018 - Null pointer dereference in - freebsd4_getfsstat system - call - - - - FreeBSD-EN-18:11.listen - 27 September 2018 - Denial of service in listen - system call - - - - FreeBSD-EN-18:12.mem - 27 September 2018 - Small kernel memory disclosures in two system - calls - - - - FreeBSD-EN-18:13.icmp - 27 November 2018 - ICMP buffer underwrite - - - - FreeBSD-EN-18:14.tzdata - 27 November 2018 - Timezone database information - update - - - - FreeBSD-EN-18:15.loader - 27 November 2018 - Deferred kernel loading breaks loader - password - - - - FreeBSD-EN-18:16.ptrace - 19 December 2018 - Kernel panic when attaching to stopped - process - - - - FreeBSD-EN-18:17.vm - 19 December 2018 - Kernel panic under load on &intel; Skylake™ - CPUs - - - - FreeBSD-EN-18:18.zfs - 19 December 2018 - ZFS vnode reclaim deadlock - - - - FreeBSD-EN-19:03.sqlite - 9 January 2019 - sqlite update - - - - FreeBSD-EN-19:04.tzdata - 9 January 2019 - Timezone database information - update - - - - FreeBSD-EN-19:05.kqueue - 9 January 2019 - kqueue race condition and kernel - panic - - - - FreeBSD-EN-19:08.tzdata - 14 May 2019 - Timezone database information - update - - - - FreeBSD-EN-19:09.xinstall - 14 May 2019 - &man.install.1; broken with partially matching - relative paths - - - - FreeBSD-EN-19:12.tzdata - 2 July 2019 - Timezone database information - update + No errata notices. +   +   Modified: stable/11/release/doc/share/xml/security.xml ============================================================================== --- stable/11/release/doc/share/xml/security.xml Wed Jul 10 14:34:52 2019 (r349887) +++ stable/11/release/doc/share/xml/security.xml Wed Jul 10 14:46:18 2019 (r349888) @@ -19,137 +19,9 @@ - FreeBSD-SA-18:08.tcp - 06 August 2018 - Resource exhaustion in TCP - reassembly - - - - FreeBSD-SA-18:09.l1tf - 14 August 2018 - L1 Terminal Fault (L1TF) Kernel Information - Disclosure - - - - FreeBSD-SA-18:10.ip - 14 August 2018 - Resource exhaustion in IP fragment - reassembly - - - - FreeBSD-SA-18:11.hostapd - 14 August 2018 - Unauthenticated EAPOL-Key Decryption - Vulnerability - - - - FreeBSD-SA-18:12.elf - 12 September 2018 - Improper ELF header parsing - - - - FreeBSD-SA-18:13.nfs - 27 November 2018 - Multiple vulnerabilities - - - - FreeBSD-SA-18:14.bhyve - 4 December 2018 - Insufficient bounds checking - - - - FreeBSD-SA-18:15.bootpd - 19 December 2018 - Buffer overflow - - - - FreeBSD-SA-19:01.syscall - 5 February 2019 - Kernel data register leak - - - - FreeBSD-SA-19:02.fd - 5 February 2019 - File description reference count - leak - - - - FreeBSD-SA-19:03.wpa - 14 May 2019 - Multiple vulnerabilities - - - - FreeBSD-SA-19:04.ntp - 14 May 2019 - Authenticated denial of service in - &man.ntpd.8; - - - - FreeBSD-SA-19:05.pf - 14 May 2019 - IPv6 fragment reassembly panic in - &man.pf.4; - - - - FreeBSD-SA-19:06.pf - 14 May 2019 - ICMP/ICMP6 packet filter bypass in - &man.pf.4; - - - - FreeBSD-SA-19:07.mds - 14 May 2019 - Microarchitectural Data Sampling - - - - FreeBSD-SA-19:09.iconv - 2 July 2019 - &man.iconv.3; buffer overflow - - - - FreeBSD-SA-19:10.ufs - 2 July 2019 - Kernel stack disclosure - - - - FreeBSD-SA-19:11.cd_ioctl - 2 July 2019 - Privilege escalation in &man.cd.4; + No advisories. +   +   From owner-svn-src-all@freebsd.org Wed Jul 10 17:22:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8DA8B15DD809; Wed, 10 Jul 2019 17:22:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2F64C968DE; Wed, 10 Jul 2019 17:22:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00CA61A379; Wed, 10 Jul 2019 17:22:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6AHLxLP005785; Wed, 10 Jul 2019 17:21:59 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6AHLxKH005783; Wed, 10 Jul 2019 17:21:59 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907101721.x6AHLxKH005783@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 10 Jul 2019 17:21:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349889 - head/sys/mips/ingenic X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/mips/ingenic X-SVN-Commit-Revision: 349889 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2F64C968DE X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 17:22:00 -0000 Author: imp Date: Wed Jul 10 17:21:59 2019 New Revision: 349889 URL: https://svnweb.freebsd.org/changeset/base/349889 Log: Fix compile errors with the CI20 Fix mutex includes and fix a typo. The CI20 kernel is not built as part of universe. PR: 239115 Submitted by: Kai Nacke Modified: head/sys/mips/ingenic/jz4780_machdep.c head/sys/mips/ingenic/jz4780_mmc.c head/sys/mips/ingenic/jz4780_smb.c Modified: head/sys/mips/ingenic/jz4780_machdep.c ============================================================================== --- head/sys/mips/ingenic/jz4780_machdep.c Wed Jul 10 14:46:18 2019 (r349888) +++ head/sys/mips/ingenic/jz4780_machdep.c Wed Jul 10 17:21:59 2019 (r349889) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #ifdef FDT Modified: head/sys/mips/ingenic/jz4780_mmc.c ============================================================================== --- head/sys/mips/ingenic/jz4780_mmc.c Wed Jul 10 14:46:18 2019 (r349888) +++ head/sys/mips/ingenic/jz4780_mmc.c Wed Jul 10 17:21:59 2019 (r349889) @@ -775,7 +775,7 @@ jz4780_mmc_read_ivar(device_t bus, device_t child, int *(int *)result = sc->sc_host.ios.power_mode; break; case MMCBR_IVAR_RETUNE_REQ: - *(int *)result = return_req_none; + *(int *)result = retune_req_none; break; case MMCBR_IVAR_VDD: *(int *)result = sc->sc_host.ios.vdd; Modified: head/sys/mips/ingenic/jz4780_smb.c ============================================================================== --- head/sys/mips/ingenic/jz4780_smb.c Wed Jul 10 14:46:18 2019 (r349888) +++ head/sys/mips/ingenic/jz4780_smb.c Wed Jul 10 17:21:59 2019 (r349889) @@ -39,6 +39,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include From owner-svn-src-all@freebsd.org Wed Jul 10 17:42:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2A0115DE328; Wed, 10 Jul 2019 17:42:05 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 718AB979BE; Wed, 10 Jul 2019 17:42:05 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3847D1A7D7; Wed, 10 Jul 2019 17:42:05 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6AHg5dq016755; Wed, 10 Jul 2019 17:42:05 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6AHg4os016752; Wed, 10 Jul 2019 17:42:04 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201907101742.x6AHg4os016752@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Wed, 10 Jul 2019 17:42:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349890 - head/contrib/telnet/telnet X-SVN-Group: head X-SVN-Commit-Author: philip X-SVN-Commit-Paths: head/contrib/telnet/telnet X-SVN-Commit-Revision: 349890 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 718AB979BE X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.973,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 17:42:06 -0000 Author: philip Date: Wed Jul 10 17:42:04 2019 New Revision: 349890 URL: https://svnweb.freebsd.org/changeset/base/349890 Log: telnet: fix a couple of snprintf() buffer overflows Obtained from: Juniper Networks MFC after: 1 week Modified: head/contrib/telnet/telnet/commands.c head/contrib/telnet/telnet/telnet.c head/contrib/telnet/telnet/utilities.c Modified: head/contrib/telnet/telnet/commands.c ============================================================================== --- head/contrib/telnet/telnet/commands.c Wed Jul 10 17:21:59 2019 (r349889) +++ head/contrib/telnet/telnet/commands.c Wed Jul 10 17:42:04 2019 (r349890) @@ -1655,10 +1655,11 @@ env_init(void) char hbuf[256+1]; char *cp2 = strchr((char *)ep->value, ':'); - gethostname(hbuf, 256); - hbuf[256] = '\0'; - cp = (char *)malloc(strlen(hbuf) + strlen(cp2) + 1); - sprintf((char *)cp, "%s%s", hbuf, cp2); + gethostname(hbuf, sizeof(hbuf)); + hbuf[sizeof(hbuf)-1] = '\0'; + unsigned int buflen = strlen(hbuf) + strlen(cp2) + 1; + cp = (char *)malloc(sizeof(char)*buflen); + snprintf((char *)cp, buflen, "%s%s", hbuf, cp2); free(ep->value); ep->value = (unsigned char *)cp; } Modified: head/contrib/telnet/telnet/telnet.c ============================================================================== --- head/contrib/telnet/telnet/telnet.c Wed Jul 10 17:21:59 2019 (r349889) +++ head/contrib/telnet/telnet/telnet.c Wed Jul 10 17:42:04 2019 (r349890) @@ -785,7 +785,7 @@ suboption(void) name = gettermname(); len = strlen(name) + 4 + 2; if (len < NETROOM()) { - sprintf(temp, "%c%c%c%c%s%c%c", IAC, SB, TELOPT_TTYPE, + snprintf(temp, sizeof(temp), "%c%c%c%c%s%c%c", IAC, SB, TELOPT_TTYPE, TELQUAL_IS, name, IAC, SE); ring_supply_data(&netoring, temp, len); printsub('>', &temp[2], len-2); @@ -807,7 +807,7 @@ suboption(void) TerminalSpeeds(&ispeed, &ospeed); - sprintf((char *)temp, "%c%c%c%c%ld,%ld%c%c", IAC, SB, TELOPT_TSPEED, + snprintf((char *)temp, sizeof(temp), "%c%c%c%c%ld,%ld%c%c", IAC, SB, TELOPT_TSPEED, TELQUAL_IS, ospeed, ispeed, IAC, SE); len = strlen((char *)temp+4) + 4; /* temp[3] is 0 ... */ Modified: head/contrib/telnet/telnet/utilities.c ============================================================================== --- head/contrib/telnet/telnet/utilities.c Wed Jul 10 17:21:59 2019 (r349889) +++ head/contrib/telnet/telnet/utilities.c Wed Jul 10 17:42:04 2019 (r349890) @@ -629,7 +629,7 @@ printsub(char direction, unsigned char *pointer, int l } { char tbuf[64]; - sprintf(tbuf, "%s%s%s%s%s", + snprintf(tbuf, sizeof(tbuf), "%s%s%s%s%s", pointer[2]&MODE_EDIT ? "|EDIT" : "", pointer[2]&MODE_TRAPSIG ? "|TRAPSIG" : "", pointer[2]&MODE_SOFT_TAB ? "|SOFT_TAB" : "", From owner-svn-src-all@freebsd.org Wed Jul 10 19:32:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A76A15E1B85; Wed, 10 Jul 2019 19:32:51 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2B07A6E554; Wed, 10 Jul 2019 19:32:51 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0488C1BB09; Wed, 10 Jul 2019 19:32:51 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6AJWon7074545; Wed, 10 Jul 2019 19:32:50 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6AJWo5r074544; Wed, 10 Jul 2019 19:32:50 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201907101932.x6AJWo5r074544@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Wed, 10 Jul 2019 19:32:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349891 - head/lib/libc/arm/gen X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/lib/libc/arm/gen X-SVN-Commit-Revision: 349891 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2B07A6E554 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.92)[-0.920,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 19:32:51 -0000 Author: ian Date: Wed Jul 10 19:32:50 2019 New Revision: 349891 URL: https://svnweb.freebsd.org/changeset/base/349891 Log: Reorganize the SRCS lists as one file per line, and then alphabetize them. No functional changes. Modified: head/lib/libc/arm/gen/Makefile.inc Modified: head/lib/libc/arm/gen/Makefile.inc ============================================================================== --- head/lib/libc/arm/gen/Makefile.inc Wed Jul 10 17:42:04 2019 (r349890) +++ head/lib/libc/arm/gen/Makefile.inc Wed Jul 10 19:32:50 2019 (r349891) @@ -1,13 +1,31 @@ # @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 # $FreeBSD$ -SRCS+= _ctx_start.S _setjmp.S _set_tp.c alloca.S fabs.c \ - infinity.c ldexp.c makecontext.c \ - __aeabi_read_tp.S setjmp.S signalcontext.c sigsetjmp.S flt_rounds.c \ +SRCS+= \ + __aeabi_read_tp.S \ + _ctx_start.S \ + _set_tp.c \ + _setjmp.S \ + alloca.S \ arm_initfini.c \ - getcontextx.c + fabs.c \ + flt_rounds.c \ + getcontextx.c \ + infinity.c \ + ldexp.c \ + makecontext.c \ + setjmp.S \ + signalcontext.c \ + sigsetjmp.S \ .if ${MACHINE_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") -SRCS+= fpgetmask_vfp.c fpgetround_vfp.c fpgetsticky_vfp.c fpsetmask_vfp.c \ - fpsetround_vfp.c fpsetsticky_vfp.c + +SRCS+= \ + fpgetmask_vfp.c \ + fpgetround_vfp.c \ + fpgetsticky_vfp.c \ + fpsetmask_vfp.c \ + fpsetround_vfp.c \ + fpsetsticky_vfp.c \ + .endif From owner-svn-src-all@freebsd.org Wed Jul 10 19:55:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3523615E2155 for ; Wed, 10 Jul 2019 19:55:54 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1980D6F2C4 for ; Wed, 10 Jul 2019 19:55:53 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt1-x831.google.com with SMTP id h24so3857267qto.0 for ; Wed, 10 Jul 2019 12:55:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=7NvUZXl9XAbn21ceC+wrjNVMtPTHxMqWu4vA3S6x0HI=; b=g+7C8JwNJjAMcb/TvEpGRTdgLY8NLMCywa9IY49+z65v1v575H3ellypZuBclEgyan GHnwYdo2RNxpzVgVFdutKlHjAvuhikQkmWRgqemF8bVHJdVSVX4WUUj7Af6DEkf6LO3t abIAFwjyJT0CVfRyOBGR7IQrcXKePSQh/YKLKIitAFv1JHGrxr9yvsHRwtftTMDefT7T /0iIVXdewiCI9H1PdySz9EzsW0hxNu2LUYEx6T4L6seCvSV3KHyaCH9HbZu/SexAUsXs ddLb+oPkpY/h2u9D/mv+yZRqYS2X79b6OiZNMjVXrX3lBCATEkDzGMZ0Hfi9cPmhZmA4 uEwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=7NvUZXl9XAbn21ceC+wrjNVMtPTHxMqWu4vA3S6x0HI=; b=csXhz1PHDM7XLMuKes4qu8pCvL0KpiKA5/9x1yruHj5CICzJOnP7g4eLLipOaVyjWd vc1WVWSq8i/I1GoRjZXRhlGKUkaroeIdwz8OGZvQXHDbNy0LHnPQrWxsx7oVWZ7n5RLG auJLORZ4MHUrLRZoE+8WR03mbKGms5fdTRYFEln8bjs3vPMdntn+BXf/dPziDSVCTXzP gZApaCdPbZjmVKFH2LP0fI0Xjn2EhmrFpa7V1KDTD7fYMHDUk4HJkG9dymT+2vaQNyB0 kUrQZTuaDrHfaTXBAwgIK3UzW5l7PHDQdjRyLB+LGn0knamcoliEYVQx27jGiPysU7KG L9Fw== X-Gm-Message-State: APjAAAW+sD3QpYOxxdWSSvctcCnv/ahoiuIGBct5ePi33bVIcUjzakK4 +JfWAbI/WWNPucrEkPTj15H46g== X-Google-Smtp-Source: APXvYqy4PjIXosf+TQ9hGnOD+5zGJnfN9zPhJnWmv3vdCM5U4JS+6z5lILa8XrIBNIpDN/4tmfSAAg== X-Received: by 2002:ac8:37b8:: with SMTP id d53mr25302514qtc.227.1562788551189; Wed, 10 Jul 2019 12:55:51 -0700 (PDT) Received: from mutt-hbsd ([151.196.118.239]) by smtp.gmail.com with ESMTPSA id p13sm1289774qkj.4.2019.07.10.12.55.49 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 10 Jul 2019 12:55:50 -0700 (PDT) Date: Wed, 10 Jul 2019 15:55:48 -0400 From: Shawn Webb To: Philip Paeps Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet Message-ID: <20190710195548.kdftfemj3icarcxo@mutt-hbsd> References: <201907101742.x6AHg4os016752@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2ecdm7fv5dibptma" Content-Disposition: inline In-Reply-To: <201907101742.x6AHg4os016752@repo.freebsd.org> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA User-Agent: NeoMutt/20180716 X-Rspamd-Queue-Id: 1980D6F2C4 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.982,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 19:55:54 -0000 --2ecdm7fv5dibptma Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 10, 2019 at 05:42:04PM +0000, Philip Paeps wrote: > Author: philip > Date: Wed Jul 10 17:42:04 2019 > New Revision: 349890 > URL: https://svnweb.freebsd.org/changeset/base/349890 >=20 > Log: > telnet: fix a couple of snprintf() buffer overflows > =20 > Obtained from: Juniper Networks > MFC after: 1 week >=20 > Modified: > head/contrib/telnet/telnet/commands.c > head/contrib/telnet/telnet/telnet.c > head/contrib/telnet/telnet/utilities.c >=20 > Modified: head/contrib/telnet/telnet/commands.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/contrib/telnet/telnet/commands.c Wed Jul 10 17:21:59 2019 (r3498= 89) > +++ head/contrib/telnet/telnet/commands.c Wed Jul 10 17:42:04 2019 (r3498= 90) > @@ -1655,10 +1655,11 @@ env_init(void) > char hbuf[256+1]; > char *cp2 =3D strchr((char *)ep->value, ':'); > =20 > - gethostname(hbuf, 256); > - hbuf[256] =3D '\0'; > - cp =3D (char *)malloc(strlen(hbuf) + strlen(cp2) + 1); > - sprintf((char *)cp, "%s%s", hbuf, cp2); > + gethostname(hbuf, sizeof(hbuf)); > + hbuf[sizeof(hbuf)-1] =3D '\0'; > + unsigned int buflen =3D strlen(hbuf) + strlen(cp2) + 1; buflen should be defined with the rest of the variables in the code block above this one. > + cp =3D (char *)malloc(sizeof(char)*buflen); Lack of NULL check here leads to > + snprintf((char *)cp, buflen, "%s%s", hbuf, cp2); potential NULL pointer deref here. Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 Tor+XMPP+OTR: lattera@is.a.hacker.sx GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 --2ecdm7fv5dibptma Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl0mQrsACgkQ/y5nonf4 4foXOQ/9ELBZEj5TmLFUfNXJdo50Sm6Q6Bf6B4UG4SwK+aAKZImvRclY0XS9GmdC HIj6XXzRTtX+6MKrWFteJhsXM1EyBIrry2SK5f/BbBHGK6pXhzTlFeIAexfFGiGR z1qO6Rz7WeKQNgR11zMIPZardNRtotlAm4maUw5q4Nvr7LMley+BtxpdhlJ3Guv3 0GZdbmxaQZDJnWW7AJ9F+JXWMXdnIPlsR2g8nZts7GnFQ4IGvox4j7O4BA8ZoIfG E4yzQapVkBYKtmg9nrLkhNALJeit/CY2DDYTBJhcecALiJbpXrn2ZFlTH6lDnZN5 4REXybTlzhXeUQpwIEESHd8cIkTG2HjX155GwozBDIomdy1nHtHSWmKmHeyEq6gh 7qVtk4lfClmyazcCkcgK7Gx8fADzFT607Z4wNWLY0arZ+WGTUNVT4K0y+s8DYHTy hW3D5/sfNLPmPRPCz/uvTd+XGloaSUPgoHCB6SHLY+cFvMwuI5UpLjH0055o9FSN UZ8/y+oR2ITcZFVv9PEp440AKExnhqONMQ03M1Xan+GN4HQ61Px8lPxP+VRo7U2E xzCz1QMHfwWURBHW07kc8mZiEzrgYBIBx0WMs0PZnLvRXpXqtsNTGGy+3n+yA9DO ncJmY+A2nD9lg2CHvimC2/e/a1hrE8Z5KBW10zA9AqpyMrZPfpI= =2JuV -----END PGP SIGNATURE----- --2ecdm7fv5dibptma-- From owner-svn-src-all@freebsd.org Wed Jul 10 19:57:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE8F115E21F4; Wed, 10 Jul 2019 19:57:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 747A56F460; Wed, 10 Jul 2019 19:57:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 61B011BE64; Wed, 10 Jul 2019 19:57:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6AJvnxc085023; Wed, 10 Jul 2019 19:57:49 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6AJvnXa085022; Wed, 10 Jul 2019 19:57:49 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907101957.x6AJvnXa085022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 10 Jul 2019 19:57:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349892 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 349892 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 747A56F460 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.947,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 19:57:50 -0000 Author: markj Date: Wed Jul 10 19:57:48 2019 New Revision: 349892 URL: https://svnweb.freebsd.org/changeset/base/349892 Log: Inherit P2_PROTMAX_{ENABLE,DISABLE} across fork(). Thus, when using proccontrol(1) to disable implicit application of PROT_MAX within a process, child processes will inherit this setting. Discussed with: kib MFC with: r349609 Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_fork.c Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Wed Jul 10 19:32:50 2019 (r349891) +++ head/sys/kern/kern_fork.c Wed Jul 10 19:57:48 2019 (r349892) @@ -465,7 +465,8 @@ do_fork(struct thread *td, struct fork_req *fr, struct */ p2->p_flag = P_INMEM; p2->p_flag2 = p1->p_flag2 & (P2_ASLR_DISABLE | P2_ASLR_ENABLE | - P2_ASLR_IGNSTART | P2_NOTRACE | P2_NOTRACE_EXEC | P2_TRAPCAP); + P2_ASLR_IGNSTART | P2_NOTRACE | P2_NOTRACE_EXEC | + P2_PROTMAX_ENABLE | P2_PROTMAX_DISABLE | P2_TRAPCAP); p2->p_swtick = ticks; if (p1->p_flag & P_PROFIL) startprofclock(p2); From owner-svn-src-all@freebsd.org Wed Jul 10 20:19:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB07815E2B1E; Wed, 10 Jul 2019 20:19:49 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2F98A704CE; Wed, 10 Jul 2019 20:19:49 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-io1-xd41.google.com with SMTP id k20so7518481ios.10; Wed, 10 Jul 2019 13:19:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MADvUaTXnTL2CQclZJxayupcXhlNjEDq9DzbE7a/uRI=; b=SET9N6lhHMkU0KIVXrmTrat8B73VTjknA9QBZLa86ZL6sYAlRYDM473BAZkvfO6kyC /YdEZ0pLm6Xxh/gnNGDJqIDnPrHvDyrfQyYGoRnBi4RvxM5v/yWIBbJv1br+bGSLazbj 9xRq1NeeELvyYGBf16xM7YWkhSHDhMZDo6RwWPE51juB80qAT/V8dbj7YsiJiE4B8evd vTjI/1izzfR02klnLXV0jOCDKYReVMY+6iwOraaZ+edz5vapQPBOnql/AMRHVNYVCogH qG3vasA4h3vIPYuvTAR2xvzxCiDwJZnCIczG9DXipQlbZl7Fbf8/NorlTnn66UBLNi/b +7ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MADvUaTXnTL2CQclZJxayupcXhlNjEDq9DzbE7a/uRI=; b=QmHTgUViwnviv41yHziFb3dkJpeo4r/enM17PpQn8oZ1n52I9fzW1qwsXzdX/OR9wF kzr8XqHTFAwJz/xcY08ANyhLOwAF0d0EnYdcESrdV6xHAe9eXjU6V84/xeC8xpIozlCZ 2zM3j0iKJBJWhvYbzoyJaagB2CPqkw7OrT0PViaWRpQ2zNV4Vcw6lGpgv+68BDEeP7ng oxdZW1cDg2oJquw4ASbrnqbwQTNk7bhaD581WaUWmPXvUtKXkEEyYiNOlEzCSrrtca48 e85l6sLidLvNHAJHXWxPLLd7rlkFKC/RPGOPIaI5qDLzfmECs8gH/fzwkiYb1TzgsKi4 p9Tg== X-Gm-Message-State: APjAAAXBkASlmjxSGUyg3+vyxB/U9qW45v72oXMVTWCwwAAOiOoZ2CFv s21nRJDgVczTmnsSLpe14t9NNs34EjI= X-Google-Smtp-Source: APXvYqy5duge4xWNnlX8nrApte+canjQEKUDrUwXwlY1OLaos5QnaLFWgd5PJsnNtLb6t6SVMpehiA== X-Received: by 2002:a5e:a708:: with SMTP id b8mr35081665iod.25.1562789988228; Wed, 10 Jul 2019 13:19:48 -0700 (PDT) Received: from titan.knownspace (173-25-245-129.client.mchsi.com. [173.25.245.129]) by smtp.gmail.com with ESMTPSA id b8sm2519885ioj.16.2019.07.10.13.19.47 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 10 Jul 2019 13:19:48 -0700 (PDT) Date: Wed, 10 Jul 2019 15:19:44 -0500 From: Justin Hibbits To: Shawn Webb Cc: Philip Paeps , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet Message-ID: <20190710151944.0fd94ec3@titan.knownspace> In-Reply-To: <20190710195548.kdftfemj3icarcxo@mutt-hbsd> References: <201907101742.x6AHg4os016752@repo.freebsd.org> <20190710195548.kdftfemj3icarcxo@mutt-hbsd> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; powerpc64-portbld-freebsd13.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 2F98A704CE X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.97 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 20:19:50 -0000 On Wed, 10 Jul 2019 15:55:48 -0400 Shawn Webb wrote: > On Wed, Jul 10, 2019 at 05:42:04PM +0000, Philip Paeps wrote: > > Author: philip > > Date: Wed Jul 10 17:42:04 2019 > > New Revision: 349890 > > URL: https://svnweb.freebsd.org/changeset/base/349890 > > > > Log: > > telnet: fix a couple of snprintf() buffer overflows > > > > Obtained from: Juniper Networks > > MFC after: 1 week > > > > Modified: > > head/contrib/telnet/telnet/commands.c > > head/contrib/telnet/telnet/telnet.c > > head/contrib/telnet/telnet/utilities.c > > > > Modified: head/contrib/telnet/telnet/commands.c > > ============================================================================== > > --- head/contrib/telnet/telnet/commands.c Wed Jul 10 > > 17:21:59 2019 (r349889) +++ > > head/contrib/telnet/telnet/commands.c Wed Jul 10 17:42:04 > > 2019 (r349890) @@ -1655,10 +1655,11 @@ env_init(void) char > > hbuf[256+1]; char *cp2 = strchr((char *)ep->value, ':'); > > > > - gethostname(hbuf, 256); > > - hbuf[256] = '\0'; > > - cp = (char *)malloc(strlen(hbuf) + strlen(cp2) + > > 1); > > - sprintf((char *)cp, "%s%s", hbuf, cp2); > > + gethostname(hbuf, sizeof(hbuf)); > > + hbuf[sizeof(hbuf)-1] = '\0'; > > + unsigned int buflen = strlen(hbuf) + strlen(cp2) + > > 1; > > buflen should be defined with the rest of the variables in the code > block above this one. Agreed. > > > + cp = (char *)malloc(sizeof(char)*buflen); > > Lack of NULL check here leads to > > > + snprintf((char *)cp, buflen, "%s%s", hbuf, cp2); > > potential NULL pointer deref here. I'm not sure if this is actually a problem. env_init() is called exactly once, at the beginning of main(), and the environment size is fully constrained by the OS. That said, this file it the only one in this component that does not check the return value of malloc(). All other uses, outside of this file, check and error. > > Thanks, > - Justin From owner-svn-src-all@freebsd.org Wed Jul 10 20:22:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DFC1E15E2D66 for ; Wed, 10 Jul 2019 20:22:22 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 68C1A70907 for ; Wed, 10 Jul 2019 20:22:22 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x742.google.com with SMTP id r21so3013068qke.2 for ; Wed, 10 Jul 2019 13:22:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=GE3Y0oRaMIibdHwfIAHAVvfwttW47sNPZaDKmkYvTbQ=; b=kKVFv7U3pVeN2HORVOKWb88nMt+sug+qgHxPtuL7d66JeRGt2wqz8HXyrlIhSz3Bpq b/znf+LcHd4DyvtWxd4sar3W9o3XeMrO9UH4bpI5ohp0GgfUctFtqt993+ntNDRSxu1l XvYBwkY/O2Nmy8dPHYvNOUR3NVqbUOc3Ki2BDshxD+r0RxH65D3UEZuNEORjpk1LBRin utIBkoDdcSmSuLElBIJnAdReaDGzQJdhYiVgBmWKdP+bR9SDCYWNc1g264nK+n6pN7do 280uDvmrb1odCYW5rSgT7zPRczY+Vm7Rzvq7ljPHFcLwdkKE639nWaMtgjNFn0BFh2cz RMyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=GE3Y0oRaMIibdHwfIAHAVvfwttW47sNPZaDKmkYvTbQ=; b=E54hHb5hu4GSPUz5eZoco+8T/KJ1uoe/LPrJGmIeWvKEivU8Mv3kcgmA3Fh2S8asRC H5tKbyQfzEyf94G0v476B1UqNunP1YeGk6Kwi07Jn60XJFPEURNwXhVKcdXwqfmVcROC KD5c/XxD927UnpiNinC81CrwCX4dUMZGkBNzHDDmL/DgXc0cLuAGXxyBP4L1In/UhxKy ssadFKmEHsjnEddPjg1MC+n8us+/nwml99Wd6KnUKG1Heq32aOLOLNQFWKdzLVNKur53 RMfwy0K/ksQ+BqtVMpeDSP3HL5Wh6aoB9rklJynsUHf0QzPbe2SZ000Nbuxv0jFZdN98 x80A== X-Gm-Message-State: APjAAAUludoJvaaDCZDCV1Nbrn+Rrth3smo4e6sKxmm7lYPZEMgofGQN AmJh8iQsoXLVke4Avcknw5i9wA== X-Google-Smtp-Source: APXvYqx8TuUO6yXvDkRWhJ8doD+5gS7UGZnDNZeQEhDd3EBjRPT9DKxGiVpSijeoKGj93q1GwkCbHQ== X-Received: by 2002:a37:7a84:: with SMTP id v126mr24105370qkc.439.1562790141051; Wed, 10 Jul 2019 13:22:21 -0700 (PDT) Received: from mutt-hbsd ([151.196.118.239]) by smtp.gmail.com with ESMTPSA id b7sm1404820qtt.38.2019.07.10.13.22.19 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 10 Jul 2019 13:22:20 -0700 (PDT) Date: Wed, 10 Jul 2019 16:22:18 -0400 From: Shawn Webb To: Justin Hibbits Cc: Philip Paeps , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet Message-ID: <20190710202218.yc3lcd6tsql3zkyr@mutt-hbsd> References: <201907101742.x6AHg4os016752@repo.freebsd.org> <20190710195548.kdftfemj3icarcxo@mutt-hbsd> <20190710151944.0fd94ec3@titan.knownspace> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="amaqwuyn6xpvcs6j" Content-Disposition: inline In-Reply-To: <20190710151944.0fd94ec3@titan.knownspace> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA User-Agent: NeoMutt/20180716 X-Rspamd-Queue-Id: 68C1A70907 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.984,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 20:22:23 -0000 --amaqwuyn6xpvcs6j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 10, 2019 at 03:19:44PM -0500, Justin Hibbits wrote: > On Wed, 10 Jul 2019 15:55:48 -0400 > Shawn Webb wrote: >=20 > > On Wed, Jul 10, 2019 at 05:42:04PM +0000, Philip Paeps wrote: > > > Author: philip > > > Date: Wed Jul 10 17:42:04 2019 > > > New Revision: 349890 > > > URL: https://svnweb.freebsd.org/changeset/base/349890 > > >=20 > > > Log: > > > telnet: fix a couple of snprintf() buffer overflows > > > =20 > > > Obtained from: Juniper Networks > > > MFC after: 1 week > > >=20 > > > Modified: > > > head/contrib/telnet/telnet/commands.c > > > head/contrib/telnet/telnet/telnet.c > > > head/contrib/telnet/telnet/utilities.c > > >=20 > > > Modified: head/contrib/telnet/telnet/commands.c > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > > --- head/contrib/telnet/telnet/commands.c Wed Jul 10 > > > 17:21:59 2019 (r349889) +++ > > > head/contrib/telnet/telnet/commands.c Wed Jul 10 17:42:04 > > > 2019 (r349890) @@ -1655,10 +1655,11 @@ env_init(void) char > > > hbuf[256+1]; char *cp2 =3D strchr((char *)ep->value, ':'); > > > =20 > > > - gethostname(hbuf, 256); > > > - hbuf[256] =3D '\0'; > > > - cp =3D (char *)malloc(strlen(hbuf) + strlen(cp2) + > > > 1); > > > - sprintf((char *)cp, "%s%s", hbuf, cp2); > > > + gethostname(hbuf, sizeof(hbuf)); > > > + hbuf[sizeof(hbuf)-1] =3D '\0'; > > > + unsigned int buflen =3D strlen(hbuf) + strlen(cp2) + > > > 1; =20 > >=20 > > buflen should be defined with the rest of the variables in the code > > block above this one. >=20 > Agreed. >=20 > >=20 > > > + cp =3D (char *)malloc(sizeof(char)*buflen); =20 > >=20 > > Lack of NULL check here leads to > >=20 > > > + snprintf((char *)cp, buflen, "%s%s", hbuf, cp2); =20 > >=20 > > potential NULL pointer deref here. >=20 > I'm not sure if this is actually a problem. env_init() is called > exactly once, at the beginning of main(), and the environment size is > fully constrained by the OS. >=20 > That said, this file it the only one in this component that does not > check the return value of malloc(). All other uses, outside of this > file, check and error. While fixing the style(9) violation above, we could still take care of the potential NULL deref at the same time. If anything, just for code correctness reasons? Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 Tor+XMPP+OTR: lattera@is.a.hacker.sx GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 --amaqwuyn6xpvcs6j Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl0mSPUACgkQ/y5nonf4 4frvKBAAivH1YeBwZUNG74MEdAj1APyfWpZnoJ//ReAdq/KhULPB3r9KSx2kjj3K GOkigEDKoRYNgIEVAhKBG6oyI3BBdnJJfHdF4Kl+OfmB/ORuGuUQOjWA7ddcFYRH +09PsOTnKckD2NpthTf1/CDzLtmYERIl7v1b9okUb9s2df5jYZGFwBMoKcccA8fP GwZaqmOuc1tc3fALVRqi3Xd0jV4750g+pkE36ggfMxgo1srlBCc1L9jiNqOwYjiK 7a3ccsfqcJoG/hGqjcGPUzR2xtTYCZ8crMTXebhtXYq+qH1Djx9lZX14LQXroQLO EQSL53KdfP7ZzH/M+Zyp5p2xHX8MnHiuGmdr0smYpT9m6db9WDN0/tDfSN8/xdys qmWWHR7CjWIxWitwTPz2VMFRrf08i3f5PYyxn64IhUUE5tAHdThMtn0OZTrXVKRk WFFw994IX7zOucJogiJrhfeyhX+fKe1JjkIyGDigzZJwFxIfslm47YJzcmZMn124 z/WG2iO17rbtYaaCvRRJnEeUMmCHhKJSqbKw0r3j4ehpPEvjZqjLS1EKL9Hw9BoV vM2unh2GM/g9ygREf9dwKSBk5BxSHLb88g9dDgR9eb7ZAaTODWpH1Z0L78tm9uNf pdm2ag7zNkfjOvN906TV83OHGL4cH8dtnqNQU5QUTcrFBljIQOY= =WE9C -----END PGP SIGNATURE----- --amaqwuyn6xpvcs6j-- From owner-svn-src-all@freebsd.org Wed Jul 10 20:40:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3631A15E3257; Wed, 10 Jul 2019 20:40:41 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D7B8C712B3; Wed, 10 Jul 2019 20:40:40 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A7E3D1C550; Wed, 10 Jul 2019 20:40:40 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6AKeeQA006735; Wed, 10 Jul 2019 20:40:40 GMT (envelope-from rrs@FreeBSD.org) Received: (from rrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6AKeern006731; Wed, 10 Jul 2019 20:40:40 GMT (envelope-from rrs@FreeBSD.org) Message-Id: <201907102040.x6AKeern006731@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rrs set sender to rrs@FreeBSD.org using -f From: Randall Stewart Date: Wed, 10 Jul 2019 20:40:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349893 - in head/sys: modules/tcp/rack netinet netinet/tcp_stacks sys X-SVN-Group: head X-SVN-Commit-Author: rrs X-SVN-Commit-Paths: in head/sys: modules/tcp/rack netinet netinet/tcp_stacks sys X-SVN-Commit-Revision: 349893 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D7B8C712B3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.930,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 20:40:41 -0000 Author: rrs Date: Wed Jul 10 20:40:39 2019 New Revision: 349893 URL: https://svnweb.freebsd.org/changeset/base/349893 Log: This commit updates rack to what is basically being used at NF as well as sets in some of the groundwork for committing BBR. The hpts system is updated as well as some other needed utilities for the entrance of BBR. This is actually part 1 of 3 more needed commits which will finally complete with BBRv1 being added as a new tcp stack. Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D20834 Added: head/sys/netinet/tcp_stacks/rack_bbr_common.c (contents, props changed) Modified: head/sys/modules/tcp/rack/Makefile head/sys/netinet/in_pcb.h head/sys/netinet/tcp.h head/sys/netinet/tcp_hpts.c head/sys/netinet/tcp_hpts.h head/sys/netinet/tcp_log_buf.h head/sys/netinet/tcp_stacks/rack.c head/sys/netinet/tcp_stacks/rack_bbr_common.h head/sys/netinet/tcp_var.h head/sys/sys/mbuf.h Modified: head/sys/modules/tcp/rack/Makefile ============================================================================== --- head/sys/modules/tcp/rack/Makefile Wed Jul 10 19:57:48 2019 (r349892) +++ head/sys/modules/tcp/rack/Makefile Wed Jul 10 20:40:39 2019 (r349893) @@ -6,7 +6,7 @@ STACKNAME= rack KMOD= tcp_${STACKNAME} -SRCS= rack.c sack_filter.c +SRCS= rack.c sack_filter.c rack_bbr_common.c SRCS+= opt_inet.h opt_inet6.h opt_ipsec.h SRCS+= opt_tcpdebug.h Modified: head/sys/netinet/in_pcb.h ============================================================================== --- head/sys/netinet/in_pcb.h Wed Jul 10 19:57:48 2019 (r349892) +++ head/sys/netinet/in_pcb.h Wed Jul 10 20:40:39 2019 (r349893) @@ -759,7 +759,9 @@ int inp_so_options(const struct inpcb *inp); #define INP_ORIGDSTADDR 0x00000800 /* receive IP dst address/port */ #define INP_CANNOT_DO_ECN 0x00001000 /* The stack does not do ECN */ #define INP_REUSEPORT_LB 0x00002000 /* SO_REUSEPORT_LB option is set */ - +#define INP_SUPPORTS_MBUFQ 0x00004000 /* Supports the mbuf queue method of LRO */ +#define INP_MBUF_QUEUE_READY 0x00008000 /* The transport is pacing, inputs can be queued */ +#define INP_DONT_SACK_QUEUE 0x00010000 /* If a sack arrives do not wake me */ /* * Flags passed to in_pcblookup*() functions. */ Modified: head/sys/netinet/tcp.h ============================================================================== --- head/sys/netinet/tcp.h Wed Jul 10 19:57:48 2019 (r349892) +++ head/sys/netinet/tcp.h Wed Jul 10 20:40:39 2019 (r349893) @@ -201,9 +201,8 @@ struct tcphdr { #define TCP_RACK_TLP_THRESH 1063 /* RACK TLP theshold i.e. srtt+(srtt/N) */ #define TCP_RACK_PKT_DELAY 1064 /* RACK added ms i.e. rack-rtt + reord + N */ #define TCP_RACK_TLP_INC_VAR 1065 /* Does TLP include rtt variance in t-o */ -#define TCP_RACK_SESS_CWV 1066 /* Enable RFC7611 cwnd validation on sess */ #define TCP_BBR_IWINTSO 1067 /* Initial TSO window for BBRs first sends */ -#define TCP_BBR_RECFORCE 1068 /* Enter recovery force out a segment disregard pacer */ +#define TCP_BBR_RECFORCE 1068 /* Enter recovery force out a segment disregard pacer no longer valid */ #define TCP_BBR_STARTUP_PG 1069 /* Startup pacing gain */ #define TCP_BBR_DRAIN_PG 1070 /* Drain pacing gain */ #define TCP_BBR_RWND_IS_APP 1071 /* Rwnd limited is considered app limited */ @@ -211,14 +210,18 @@ struct tcphdr { #define TCP_BBR_ONE_RETRAN 1073 /* Is only one segment allowed out during retran */ #define TCP_BBR_STARTUP_LOSS_EXIT 1074 /* Do we exit a loss during startup if not 20% incr */ #define TCP_BBR_USE_LOWGAIN 1075 /* lower the gain in PROBE_BW enable */ -#define TCP_BBR_LOWGAIN_THRESH 1076 /* How many cycles do we stay in lowgain */ -#define TCP_BBR_LOWGAIN_HALF 1077 /* Do we halfstep lowgain down */ -#define TCP_BBR_LOWGAIN_FD 1078 /* Do we force a drain when lowgain in place */ +#define TCP_BBR_LOWGAIN_THRESH 1076 /* Unused after 2.3 morphs to TSLIMITS >= 2.3 */ +#define TCP_BBR_TSLIMITS 1076 /* Do we use experimental Timestamp limiting for our algo */ +#define TCP_BBR_LOWGAIN_HALF 1077 /* Unused after 2.3 */ +#define TCP_BBR_PACE_OH 1077 /* Reused in 4.2 for pacing overhead setting */ +#define TCP_BBR_LOWGAIN_FD 1078 /* Unused after 2.3 */ +#define TCP_BBR_HOLD_TARGET 1078 /* For 4.3 on */ #define TCP_BBR_USEDEL_RATE 1079 /* Enable use of delivery rate for loss recovery */ #define TCP_BBR_MIN_RTO 1080 /* Min RTO in milliseconds */ #define TCP_BBR_MAX_RTO 1081 /* Max RTO in milliseconds */ #define TCP_BBR_REC_OVER_HPTS 1082 /* Recovery override htps settings 0/1/3 */ -#define TCP_BBR_UNLIMITED 1083 /* Does BBR, in non-recovery not use cwnd */ +#define TCP_BBR_UNLIMITED 1083 /* Not used before 2.3 and morphs to algorithm >= 2.3 */ +#define TCP_BBR_ALGORITHM 1083 /* What measurement algo does BBR use netflix=0, google=1 */ #define TCP_BBR_DRAIN_INC_EXTRA 1084 /* Does the 3/4 drain target include the extra gain */ #define TCP_BBR_STARTUP_EXIT_EPOCH 1085 /* what epoch gets us out of startup */ #define TCP_BBR_PACE_PER_SEC 1086 @@ -227,17 +230,27 @@ struct tcphdr { #define TCP_BBR_PACE_SEG_MIN 1089 #define TCP_BBR_PACE_CROSS 1090 #define TCP_RACK_IDLE_REDUCE_HIGH 1092 /* Reduce the highest cwnd seen to IW on idle */ -#define TCP_RACK_IDLE_REDUCE_HIGH 1092 /* Reduce the highest cwnd seen to IW on idle */ #define TCP_RACK_MIN_PACE 1093 /* Do we enforce rack min pace time */ #define TCP_RACK_MIN_PACE_SEG 1094 /* If so what is the seg threshould */ +#define TCP_RACK_GP_INCREASE 1094 /* After 4.1 its the GP increase */ #define TCP_RACK_TLP_USE 1095 #define TCP_BBR_ACK_COMP_ALG 1096 /* Not used */ +#define TCP_BBR_TMR_PACE_OH 1096 /* Recycled in 4.2 */ #define TCP_BBR_EXTRA_GAIN 1097 #define TCP_BBR_RACK_RTT_USE 1098 /* what RTT should we use 0, 1, or 2? */ #define TCP_BBR_RETRAN_WTSO 1099 #define TCP_DATA_AFTER_CLOSE 1100 #define TCP_BBR_PROBE_RTT_GAIN 1101 #define TCP_BBR_PROBE_RTT_LEN 1102 +#define TCP_BBR_SEND_IWND_IN_TSO 1103 /* Do we burst out whole iwin size chunks at start? */ +#define TCP_BBR_USE_RACK_CHEAT 1104 /* Do we use the rack cheat for pacing rxt's */ +#define TCP_BBR_HDWR_PACE 1105 /* Enable/disable hardware pacing */ +#define TCP_BBR_UTTER_MAX_TSO 1106 /* Do we enforce an utter max TSO size */ +#define TCP_BBR_EXTRA_STATE 1107 /* Special exit-persist catch up */ +#define TCP_BBR_FLOOR_MIN_TSO 1108 /* The min tso size */ +#define TCP_BBR_MIN_TOPACEOUT 1109 /* Do we suspend pacing until */ +#define TCP_BBR_TSTMP_RAISES 1110 /* Can a timestamp measurement raise the b/w */ +#define TCP_BBR_POLICER_DETECT 1111 /* Turn on/off google mode policer detection */ /* Start of reserved space for third-party user-settable options. */ Modified: head/sys/netinet/tcp_hpts.c ============================================================================== --- head/sys/netinet/tcp_hpts.c Wed Jul 10 19:57:48 2019 (r349892) +++ head/sys/netinet/tcp_hpts.c Wed Jul 10 20:40:39 2019 (r349893) @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); * pacing packets out onto the wire. It can be used in two ways * by a given TCP stack (and those two methods can be used simultaneously). * - * First, and probably the main thing its used by Rack and BBR for, it can + * First, and probably the main thing its used by Rack and BBR, it can * be used to call tcp_output() of a transport stack at some time in the future. * The normal way this is done is that tcp_output() of the stack schedules * itself to be called again by calling tcp_hpts_insert(tcpcb, slot). The @@ -59,42 +59,57 @@ __FBSDID("$FreeBSD$"); * to prevent output processing until the time alotted has gone by. * Of course this is a bare bones example and the stack will probably * have more consideration then just the above. - * - * Now the tcp_hpts system will call tcp_output in one of two forms, - * it will first check to see if the stack as defined a - * tfb_tcp_output_wtime() function, if so that is the routine it - * will call, if that function is not defined then it will call the - * tfb_tcp_output() function. The only difference between these - * two calls is that the former passes the time in to the function - * so the function does not have to access the time (which tcp_hpts - * already has). What these functions do is of course totally up - * to the individual tcp stack. - * + * * Now the second function (actually two functions I guess :D) * the tcp_hpts system provides is the ability to either abort - * a connection (later) or process input on a connection. - * Why would you want to do this? To keep processor locality. + * a connection (later) or process input on a connection. + * Why would you want to do this? To keep processor locality + * and or not have to worry about untangling any recursive + * locks. The input function now is hooked to the new LRO + * system as well. * - * So in order to use the input redirection function the - * stack changes its tcp_do_segment() routine to instead - * of process the data call the function: + * In order to use the input redirection function the + * tcp stack must define an input function for + * tfb_do_queued_segments(). This function understands + * how to dequeue a array of packets that were input and + * knows how to call the correct processing routine. * - * tcp_queue_pkt_to_input() - * - * You will note that the arguments to this function look - * a lot like tcp_do_segments's arguments. This function - * will assure that the tcp_hpts system will - * call the functions tfb_tcp_hpts_do_segment() from the - * correct CPU. Note that multiple calls can get pushed - * into the tcp_hpts system this will be indicated by - * the next to last argument to tfb_tcp_hpts_do_segment() - * (nxt_pkt). If nxt_pkt is a 1 then another packet is - * coming. If nxt_pkt is a 0 then this is the last call - * that the tcp_hpts system has available for the tcp stack. + * Locking in this is important as well so most likely the + * stack will need to define the tfb_do_segment_nounlock() + * splitting tfb_do_segment() into two parts. The main processing + * part that does not unlock the INP and returns a value of 1 or 0. + * It returns 0 if all is well and the lock was not released. It + * returns 1 if we had to destroy the TCB (a reset received etc). + * The remains of tfb_do_segment() then become just a simple call + * to the tfb_do_segment_nounlock() function and check the return + * code and possibly unlock. * - * The other point of the input system is to be able to safely - * drop a tcp connection without worrying about the recursive - * locking that may be occuring on the INP_WLOCK. So if + * The stack must also set the flag on the INP that it supports this + * feature i.e. INP_SUPPORTS_MBUFQ. The LRO code recoginizes + * this flag as well and will queue packets when it is set. + * There are other flags as well INP_MBUF_QUEUE_READY and + * INP_DONT_SACK_QUEUE. The first flag tells the LRO code + * that we are in the pacer for output so there is no + * need to wake up the hpts system to get immediate + * input. The second tells the LRO code that its okay + * if a SACK arrives you can still defer input and let + * the current hpts timer run (this is usually set when + * a rack timer is up so we know SACK's are happening + * on the connection already and don't want to wakeup yet). + * + * There is a common functions within the rack_bbr_common code + * version i.e. ctf_do_queued_segments(). This function + * knows how to take the input queue of packets from + * tp->t_in_pkts and process them digging out + * all the arguments, calling any bpf tap and + * calling into tfb_do_segment_nounlock(). The common + * function (ctf_do_queued_segments()) requires that + * you have defined the tfb_do_segment_nounlock() as + * described above. + * + * The second feature of the input side of hpts is the + * dropping of a connection. This is due to the way that + * locking may have occured on the INP_WLOCK. So if * a stack wants to drop a connection it calls: * * tcp_set_inp_to_drop(tp, ETIMEDOUT) @@ -156,6 +171,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef tcpdebug #include @@ -168,24 +184,19 @@ __FBSDID("$FreeBSD$"); MALLOC_DEFINE(M_TCPHPTS, "tcp_hpts", "TCP hpts"); #ifdef RSS -#include -#include static int tcp_bind_threads = 1; #else static int tcp_bind_threads = 2; #endif TUNABLE_INT("net.inet.tcp.bind_hptss", &tcp_bind_threads); -static uint32_t tcp_hpts_logging_size = DEFAULT_HPTS_LOG; - -TUNABLE_INT("net.inet.tcp.hpts_logging_sz", &tcp_hpts_logging_size); - static struct tcp_hptsi tcp_pace; +static int hpts_does_tp_logging = 0; static void tcp_wakehpts(struct tcp_hpts_entry *p); static void tcp_wakeinput(struct tcp_hpts_entry *p); static void tcp_input_data(struct tcp_hpts_entry *hpts, struct timeval *tv); -static void tcp_hptsi(struct tcp_hpts_entry *hpts, struct timeval *ctick); +static void tcp_hptsi(struct tcp_hpts_entry *hpts); static void tcp_hpts_thread(void *ctx); static void tcp_init_hptsi(void *st); @@ -204,8 +215,6 @@ SYSCTL_NODE(_net_inet_tcp, OID_AUTO, hpts, CTLFLAG_RW, } \ } while (0) -static int32_t logging_on = 0; -static int32_t hpts_sleep_max = (NUM_OF_HPTSI_SLOTS - 2); static int32_t tcp_hpts_precision = 120; struct hpts_domain_info { @@ -219,44 +228,75 @@ SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, precision, CT &tcp_hpts_precision, 120, "Value for PRE() precision of callout"); -SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, logging, CTLFLAG_RW, - &logging_on, 0, - "Turn on logging if compiled in"); +counter_u64_t hpts_hopelessly_behind; +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, hopeless, CTLFLAG_RD, + &hpts_hopelessly_behind, + "Number of times hpts could not catch up and was behind hopelessly"); + counter_u64_t hpts_loops; SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, loops, CTLFLAG_RD, &hpts_loops, "Number of times hpts had to loop to catch up"); + counter_u64_t back_tosleep; SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, no_tcbsfound, CTLFLAG_RD, &back_tosleep, "Number of times hpts found no tcbs"); -static int32_t in_newts_every_tcb = 0; +counter_u64_t combined_wheel_wrap; -SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, in_tsperpcb, CTLFLAG_RW, - &in_newts_every_tcb, 0, - "Do we have a new cts every tcb we process for input"); -static int32_t in_ts_percision = 0; +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, comb_wheel_wrap, CTLFLAG_RD, + &combined_wheel_wrap, "Number of times the wheel lagged enough to have an insert see wrap"); -SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, in_tspercision, CTLFLAG_RW, - &in_ts_percision, 0, - "Do we use percise timestamp for clients on input"); -static int32_t out_newts_every_tcb = 0; +counter_u64_t wheel_wrap; -SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, out_tsperpcb, CTLFLAG_RW, - &out_newts_every_tcb, 0, - "Do we have a new cts every tcb we process for output"); +SYSCTL_COUNTER_U64(_net_inet_tcp_hpts, OID_AUTO, wheel_wrap, CTLFLAG_RD, + &wheel_wrap, "Number of times the wheel lagged enough to have an insert see wrap"); + static int32_t out_ts_percision = 0; SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, out_tspercision, CTLFLAG_RW, &out_ts_percision, 0, "Do we use a percise timestamp for every output cts"); +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, logging, CTLFLAG_RW, + &hpts_does_tp_logging, 0, + "Do we add to any tp that has logging on pacer logs"); -SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, maxsleep, CTLFLAG_RW, +static int32_t max_pacer_loops = 10; +SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, loopmax, CTLFLAG_RW, + &max_pacer_loops, 10, + "What is the maximum number of times the pacer will loop trying to catch up"); + +#define HPTS_MAX_SLEEP_ALLOWED (NUM_OF_HPTSI_SLOTS/2) + +static uint32_t hpts_sleep_max = HPTS_MAX_SLEEP_ALLOWED; + + +static int +sysctl_net_inet_tcp_hpts_max_sleep(SYSCTL_HANDLER_ARGS) +{ + int error; + uint32_t new; + + new = hpts_sleep_max; + error = sysctl_handle_int(oidp, &new, 0, req); + if (error == 0 && req->newptr) { + if ((new < (NUM_OF_HPTSI_SLOTS / 4)) || + (new > HPTS_MAX_SLEEP_ALLOWED)) + error = EINVAL; + else + hpts_sleep_max = new; + } + return (error); +} + +SYSCTL_PROC(_net_inet_tcp_hpts, OID_AUTO, maxsleep, + CTLTYPE_UINT | CTLFLAG_RW, &hpts_sleep_max, 0, - "The maximum time the hpts will sleep <1 - 254>"); + &sysctl_net_inet_tcp_hpts_max_sleep, "IU", + "Maximum time hpts will sleep"); SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, minsleep, CTLFLAG_RW, &tcp_min_hptsi_time, 0, @@ -267,55 +307,35 @@ SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, skip_swi, CTL "Do we have the callout call directly to the hpts?"); static void -__tcp_hpts_log_it(struct tcp_hpts_entry *hpts, struct inpcb *inp, int event, uint32_t slot, - uint32_t ticknow, int32_t line) +tcp_hpts_log(struct tcp_hpts_entry *hpts, struct tcpcb *tp, struct timeval *tv, + int ticks_to_run, int idx) { - struct hpts_log *pl; - - HPTS_MTX_ASSERT(hpts); - if (hpts->p_log == NULL) - return; - pl = &hpts->p_log[hpts->p_log_at]; - hpts->p_log_at++; - if (hpts->p_log_at >= hpts->p_logsize) { - hpts->p_log_at = 0; - hpts->p_log_wrapped = 1; - } - pl->inp = inp; - if (inp) { - pl->t_paceslot = inp->inp_hptsslot; - pl->t_hptsreq = inp->inp_hpts_request; - pl->p_onhpts = inp->inp_in_hpts; - pl->p_oninput = inp->inp_in_input; - } else { - pl->t_paceslot = 0; - pl->t_hptsreq = 0; - pl->p_onhpts = 0; - pl->p_oninput = 0; - } - pl->is_notempty = 1; - pl->event = event; - pl->line = line; - pl->cts = tcp_get_usecs(NULL); - pl->p_curtick = hpts->p_curtick; - pl->p_prevtick = hpts->p_prevtick; - pl->p_on_queue_cnt = hpts->p_on_queue_cnt; - pl->ticknow = ticknow; - pl->slot_req = slot; - pl->p_nxt_slot = hpts->p_nxt_slot; - pl->p_cur_slot = hpts->p_cur_slot; - pl->p_hpts_sleep_time = hpts->p_hpts_sleep_time; - pl->p_flags = (hpts->p_cpu & 0x7f); - pl->p_flags <<= 7; - pl->p_flags |= (hpts->p_num & 0x7f); - pl->p_flags <<= 2; - if (hpts->p_hpts_active) { - pl->p_flags |= HPTS_HPTS_ACTIVE; - } + union tcp_log_stackspecific log; + + memset(&log.u_bbr, 0, sizeof(log.u_bbr)); + log.u_bbr.flex1 = hpts->p_nxt_slot; + log.u_bbr.flex2 = hpts->p_cur_slot; + log.u_bbr.flex3 = hpts->p_prev_slot; + log.u_bbr.flex4 = idx; + log.u_bbr.flex5 = hpts->p_curtick; + log.u_bbr.flex6 = hpts->p_on_queue_cnt; + log.u_bbr.use_lt_bw = 1; + log.u_bbr.inflight = ticks_to_run; + log.u_bbr.applimited = hpts->overidden_sleep; + log.u_bbr.delivered = hpts->saved_curtick; + log.u_bbr.timeStamp = tcp_tv_to_usectick(tv); + log.u_bbr.epoch = hpts->saved_curslot; + log.u_bbr.lt_epoch = hpts->saved_prev_slot; + log.u_bbr.pkts_out = hpts->p_delayed_by; + log.u_bbr.lost = hpts->p_hpts_sleep_time; + log.u_bbr.cur_del_rate = hpts->p_runningtick; + TCP_LOG_EVENTP(tp, NULL, + &tp->t_inpcb->inp_socket->so_rcv, + &tp->t_inpcb->inp_socket->so_snd, + BBR_LOG_HPTSDIAG, 0, + 0, &log, false, tv); } -#define tcp_hpts_log_it(a, b, c, d, e) __tcp_hpts_log_it(a, b, c, d, e, __LINE__) - static void hpts_timeout_swi(void *arg) { @@ -347,12 +367,6 @@ hpts_sane_pace_remove(struct tcp_hpts_entry *hpts, str /* We are not on the hpts? */ panic("%s: hpts:%p inp:%p not on the hpts?", __FUNCTION__, hpts, inp); } - if (TAILQ_EMPTY(head) && - (hpts->p_on_queue_cnt != 0)) { - /* We should not be empty with a queue count */ - panic("%s hpts:%p hpts bucket empty but cnt:%d", - __FUNCTION__, hpts, hpts->p_on_queue_cnt); - } #endif TAILQ_REMOVE(head, inp, inp_hpts); hpts->p_on_queue_cnt--; @@ -456,58 +470,13 @@ hpts_sane_input_insert(struct tcp_hpts_entry *hpts, st in_pcbref(inp); } -static int -sysctl_tcp_hpts_log(SYSCTL_HANDLER_ARGS) -{ - struct tcp_hpts_entry *hpts; - size_t sz; - int32_t logging_was, i; - int32_t error = 0; - - /* - * HACK: Turn off logging so no locks are required this really needs - * a memory barrier :) - */ - logging_was = logging_on; - logging_on = 0; - if (!req->oldptr) { - /* How much? */ - sz = 0; - for (i = 0; i < tcp_pace.rp_num_hptss; i++) { - hpts = tcp_pace.rp_ent[i]; - if (hpts->p_log == NULL) - continue; - sz += (sizeof(struct hpts_log) * hpts->p_logsize); - } - error = SYSCTL_OUT(req, 0, sz); - } else { - for (i = 0; i < tcp_pace.rp_num_hptss; i++) { - hpts = tcp_pace.rp_ent[i]; - if (hpts->p_log == NULL) - continue; - if (hpts->p_log_wrapped) - sz = (sizeof(struct hpts_log) * hpts->p_logsize); - else - sz = (sizeof(struct hpts_log) * hpts->p_log_at); - error = SYSCTL_OUT(req, hpts->p_log, sz); - } - } - logging_on = logging_was; - return error; -} - -SYSCTL_PROC(_net_inet_tcp_hpts, OID_AUTO, log, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, - 0, 0, sysctl_tcp_hpts_log, "A", "tcp hptsi log"); - - static void tcp_wakehpts(struct tcp_hpts_entry *hpts) { HPTS_MTX_ASSERT(hpts); - swi_sched(hpts->ie_cookie, 0); - if (hpts->p_hpts_active == 2) { - /* Rare sleeping on a ENOBUF */ - wakeup_one(hpts); + if (hpts->p_hpts_wake_scheduled == 0) { + hpts->p_hpts_wake_scheduled = 1; + swi_sched(hpts->ie_cookie, 0); } } @@ -515,10 +484,9 @@ static void tcp_wakeinput(struct tcp_hpts_entry *hpts) { HPTS_MTX_ASSERT(hpts); - swi_sched(hpts->ie_cookie, 0); - if (hpts->p_hpts_active == 2) { - /* Rare sleeping on a ENOBUF */ - wakeup_one(hpts); + if (hpts->p_hpts_wake_scheduled == 0) { + hpts->p_hpts_wake_scheduled = 1; + swi_sched(hpts->ie_cookie, 0); } } @@ -648,8 +616,8 @@ tcp_hpts_remove_locked_input(struct tcp_hpts_entry *hp * Valid values in the flags are * HPTS_REMOVE_OUTPUT - remove from the output of the hpts. * HPTS_REMOVE_INPUT - remove from the input of the hpts. - * Note that you can or both values together and get two - * actions. + * Note that you can use one or both values together + * and get two actions. */ void __tcp_hpts_remove(struct inpcb *inp, int32_t flags, int32_t line) @@ -670,53 +638,198 @@ __tcp_hpts_remove(struct inpcb *inp, int32_t flags, in } static inline int -hpts_tick(struct tcp_hpts_entry *hpts, int32_t plus) +hpts_tick(uint32_t wheel_tick, uint32_t plus) { - return ((hpts->p_prevtick + plus) % NUM_OF_HPTSI_SLOTS); + /* + * Given a slot on the wheel, what slot + * is that plus ticks out? + */ + KASSERT(wheel_tick < NUM_OF_HPTSI_SLOTS, ("Invalid tick %u not on wheel", wheel_tick)); + return ((wheel_tick + plus) % NUM_OF_HPTSI_SLOTS); } +static inline int +tick_to_wheel(uint32_t cts_in_wticks) +{ + /* + * Given a timestamp in wheel ticks (10usec inc's) + * map it to our limited space wheel. + */ + return (cts_in_wticks % NUM_OF_HPTSI_SLOTS); +} + +static inline int +hpts_ticks_diff(int prev_tick, int tick_now) +{ + /* + * Given two ticks that are someplace + * on our wheel. How far are they apart? + */ + if (tick_now > prev_tick) + return (tick_now - prev_tick); + else if (tick_now == prev_tick) + /* + * Special case, same means we can go all of our + * wheel less one slot. + */ + return (NUM_OF_HPTSI_SLOTS - 1); + else + return ((NUM_OF_HPTSI_SLOTS - prev_tick) + tick_now); +} + +/* + * Given a tick on the wheel that is the current time + * mapped to the wheel (wheel_tick), what is the maximum + * distance forward that can be obtained without + * wrapping past either prev_tick or running_tick + * depending on the htps state? Also if passed + * a uint32_t *, fill it with the tick location. + * + * Note if you do not give this function the current + * time (that you think it is) mapped to the wheel + * then the results will not be what you expect and + * could lead to invalid inserts. + */ +static inline int32_t +max_ticks_available(struct tcp_hpts_entry *hpts, uint32_t wheel_tick, uint32_t *target_tick) +{ + uint32_t dis_to_travel, end_tick, pacer_to_now, avail_on_wheel; + + if ((hpts->p_hpts_active == 1) && + (hpts->p_wheel_complete == 0)) { + end_tick = hpts->p_runningtick; + /* Back up one tick */ + if (end_tick == 0) + end_tick = NUM_OF_HPTSI_SLOTS - 1; + else + end_tick--; + if (target_tick) + *target_tick = end_tick; + } else { + /* + * For the case where we are + * not active, or we have + * completed the pass over + * the wheel, we can use the + * prev tick and subtract one from it. This puts us + * as far out as possible on the wheel. + */ + end_tick = hpts->p_prev_slot; + if (end_tick == 0) + end_tick = NUM_OF_HPTSI_SLOTS - 1; + else + end_tick--; + if (target_tick) + *target_tick = end_tick; + /* + * Now we have close to the full wheel left minus the + * time it has been since the pacer went to sleep. Note + * that wheel_tick, passed in, should be the current time + * from the perspective of the caller, mapped to the wheel. + */ + if (hpts->p_prev_slot != wheel_tick) + dis_to_travel = hpts_ticks_diff(hpts->p_prev_slot, wheel_tick); + else + dis_to_travel = 1; + /* + * dis_to_travel in this case is the space from when the + * pacer stopped (p_prev_slot) and where our wheel_tick + * is now. To know how many slots we can put it in we + * subtract from the wheel size. We would not want + * to place something after p_prev_slot or it will + * get ran too soon. + */ + return (NUM_OF_HPTSI_SLOTS - dis_to_travel); + } + /* + * So how many slots are open between p_runningtick -> p_cur_slot + * that is what is currently un-available for insertion. Special + * case when we are at the last slot, this gets 1, so that + * the answer to how many slots are available is all but 1. + */ + if (hpts->p_runningtick == hpts->p_cur_slot) + dis_to_travel = 1; + else + dis_to_travel = hpts_ticks_diff(hpts->p_runningtick, hpts->p_cur_slot); + /* + * How long has the pacer been running? + */ + if (hpts->p_cur_slot != wheel_tick) { + /* The pacer is a bit late */ + pacer_to_now = hpts_ticks_diff(hpts->p_cur_slot, wheel_tick); + } else { + /* The pacer is right on time, now == pacers start time */ + pacer_to_now = 0; + } + /* + * To get the number left we can insert into we simply + * subract the distance the pacer has to run from how + * many slots there are. + */ + avail_on_wheel = NUM_OF_HPTSI_SLOTS - dis_to_travel; + /* + * Now how many of those we will eat due to the pacer's + * time (p_cur_slot) of start being behind the + * real time (wheel_tick)? + */ + if (avail_on_wheel <= pacer_to_now) { + /* + * Wheel wrap, we can't fit on the wheel, that + * is unusual the system must be way overloaded! + * Insert into the assured tick, and return special + * "0". + */ + counter_u64_add(combined_wheel_wrap, 1); + *target_tick = hpts->p_nxt_slot; + return (0); + } else { + /* + * We know how many slots are open + * on the wheel (the reverse of what + * is left to run. Take away the time + * the pacer started to now (wheel_tick) + * and that tells you how many slots are + * open that can be inserted into that won't + * be touched by the pacer until later. + */ + return (avail_on_wheel - pacer_to_now); + } +} + static int tcp_queue_to_hpts_immediate_locked(struct inpcb *inp, struct tcp_hpts_entry *hpts, int32_t line, int32_t noref) { - int32_t need_wake = 0; - uint32_t ticknow = 0; - + uint32_t need_wake = 0; + HPTS_MTX_ASSERT(hpts); if (inp->inp_in_hpts == 0) { /* Ok we need to set it on the hpts in the current slot */ - if (hpts->p_hpts_active == 0) { - /* A sleeping hpts we want in next slot to run */ - if (logging_on) { - tcp_hpts_log_it(hpts, inp, HPTSLOG_INSERT_SLEEPER, 0, - hpts_tick(hpts, 1)); - } - inp->inp_hptsslot = hpts_tick(hpts, 1); - inp->inp_hpts_request = 0; - if (logging_on) { - tcp_hpts_log_it(hpts, inp, HPTSLOG_SLEEP_BEFORE, 1, ticknow); - } - need_wake = 1; + inp->inp_hpts_request = 0; + if ((hpts->p_hpts_active == 0) || + (hpts->p_wheel_complete)) { + /* + * A sleeping hpts we want in next slot to run + * note that in this state p_prev_slot == p_cur_slot + */ + inp->inp_hptsslot = hpts_tick(hpts->p_prev_slot, 1); + if ((hpts->p_on_min_sleep == 0) && (hpts->p_hpts_active == 0)) + need_wake = 1; } else if ((void *)inp == hpts->p_inp) { /* + * The hpts system is running and the caller + * was awoken by the hpts system. * We can't allow you to go into the same slot we - * are in. We must put you out. + * are in (we don't want a loop :-D). */ inp->inp_hptsslot = hpts->p_nxt_slot; } else - inp->inp_hptsslot = hpts->p_cur_slot; + inp->inp_hptsslot = hpts->p_runningtick; hpts_sane_pace_insert(hpts, inp, &hpts->p_hptss[inp->inp_hptsslot], line, noref); - inp->inp_hpts_request = 0; - if (logging_on) { - tcp_hpts_log_it(hpts, inp, HPTSLOG_IMMEDIATE, 0, 0); - } if (need_wake) { /* * Activate the hpts if it is sleeping and its * timeout is not 1. */ - if (logging_on) { - tcp_hpts_log_it(hpts, inp, HPTSLOG_WAKEUP_HPTS, 0, ticknow); - } hpts->p_direct_wake = 1; tcp_wakehpts(hpts); } @@ -737,141 +850,129 @@ __tcp_queue_to_hpts_immediate(struct inpcb *inp, int32 return (ret); } +#ifdef INVARIANTS static void -tcp_hpts_insert_locked(struct tcp_hpts_entry *hpts, struct inpcb *inp, uint32_t slot, uint32_t cts, int32_t line, - struct hpts_diag *diag, int32_t noref) +check_if_slot_would_be_wrong(struct tcp_hpts_entry *hpts, struct inpcb *inp, uint32_t inp_hptsslot, int line) { - int32_t need_new_to = 0; - int32_t need_wakeup = 0; - uint32_t largest_slot; - uint32_t ticknow = 0; - uint32_t slot_calc; + /* + * Sanity checks for the pacer with invariants + * on insert. + */ + if (inp_hptsslot >= NUM_OF_HPTSI_SLOTS) + panic("hpts:%p inp:%p slot:%d > max", + hpts, inp, inp_hptsslot); + if ((hpts->p_hpts_active) && + (hpts->p_wheel_complete == 0)) { + /* + * If the pacer is processing a arc + * of the wheel, we need to make + * sure we are not inserting within + * that arc. + */ + int distance, yet_to_run; + distance = hpts_ticks_diff(hpts->p_runningtick, inp_hptsslot); + if (hpts->p_runningtick != hpts->p_cur_slot) + yet_to_run = hpts_ticks_diff(hpts->p_runningtick, hpts->p_cur_slot); + else + yet_to_run = 0; /* processing last slot */ + if (yet_to_run > distance) { + panic("hpts:%p inp:%p slot:%d distance:%d yet_to_run:%d rs:%d cs:%d", + hpts, inp, inp_hptsslot, + distance, yet_to_run, + hpts->p_runningtick, hpts->p_cur_slot); + } + } +} +#endif + +static void +tcp_hpts_insert_locked(struct tcp_hpts_entry *hpts, struct inpcb *inp, uint32_t slot, int32_t line, + struct hpts_diag *diag, struct timeval *tv) +{ + uint32_t need_new_to = 0; + uint32_t wheel_cts, last_tick; + int32_t wheel_tick, maxticks; + int8_t need_wakeup = 0; + HPTS_MTX_ASSERT(hpts); if (diag) { memset(diag, 0, sizeof(struct hpts_diag)); diag->p_hpts_active = hpts->p_hpts_active; + diag->p_prev_slot = hpts->p_prev_slot; + diag->p_runningtick = hpts->p_runningtick; diag->p_nxt_slot = hpts->p_nxt_slot; diag->p_cur_slot = hpts->p_cur_slot; + diag->p_curtick = hpts->p_curtick; + diag->p_lasttick = hpts->p_lasttick; diag->slot_req = slot; + diag->p_on_min_sleep = hpts->p_on_min_sleep; + diag->hpts_sleep_time = hpts->p_hpts_sleep_time; } - if ((inp->inp_in_hpts == 0) || noref) { - inp->inp_hpts_request = slot; + if (inp->inp_in_hpts == 0) { if (slot == 0) { /* Immediate */ - tcp_queue_to_hpts_immediate_locked(inp, hpts, line, noref); + tcp_queue_to_hpts_immediate_locked(inp, hpts, line, 0); return; } - if (hpts->p_hpts_active) { - /* - * Its slot - 1 since nxt_slot is the next tick that - * will go off since the hpts is awake - */ - if (logging_on) { - tcp_hpts_log_it(hpts, inp, HPTSLOG_INSERT_NORMAL, slot, 0); - } - /* - * We want to make sure that we don't place a inp in - * the range of p_cur_slot <-> p_nxt_slot. If we - * take from p_nxt_slot to the end, plus p_cur_slot - * and then take away 2, we will know how many is - * the max slots we can use. - */ - if (hpts->p_nxt_slot > hpts->p_cur_slot) { - /* - * Non-wrap case nxt_slot <-> cur_slot we - * don't want to land in. So the diff gives - * us what is taken away from the number of - * slots. + /* Get the current time relative to the wheel */ + wheel_cts = tcp_tv_to_hptstick(tv); + /* Map it onto the wheel */ + wheel_tick = tick_to_wheel(wheel_cts); + /* Now what's the max we can place it at? */ + maxticks = max_ticks_available(hpts, wheel_tick, &last_tick); + if (diag) { + diag->wheel_tick = wheel_tick; + diag->maxticks = maxticks; + diag->wheel_cts = wheel_cts; + } + if (maxticks == 0) { + /* The pacer is in a wheel wrap behind, yikes! */ + if (slot > 1) { + /* + * Reduce by 1 to prevent a forever loop in + * case something else is wrong. Note this + * probably does not hurt because the pacer + * if its true is so far behind we will be + * > 1second late calling anyway. */ - largest_slot = NUM_OF_HPTSI_SLOTS - (hpts->p_nxt_slot - hpts->p_cur_slot); - } else if (hpts->p_nxt_slot == hpts->p_cur_slot) { - largest_slot = NUM_OF_HPTSI_SLOTS - 2; - } else { - /* - * Wrap case so the diff gives us the number - * of slots that we can land in. - */ - largest_slot = hpts->p_cur_slot - hpts->p_nxt_slot; + slot--; } - /* - * We take away two so we never have a problem (20 - * usec's) out of 1024000 usecs - */ - largest_slot -= 2; - if (inp->inp_hpts_request > largest_slot) { - /* - * Restrict max jump of slots and remember - * leftover - */ - slot = largest_slot; - inp->inp_hpts_request -= largest_slot; - } else { - /* This one will run when we hit it */ - inp->inp_hpts_request = 0; - } - if (hpts->p_nxt_slot == hpts->p_cur_slot) - slot_calc = (hpts->p_nxt_slot + slot) % NUM_OF_HPTSI_SLOTS; - else - slot_calc = (hpts->p_nxt_slot + slot - 1) % NUM_OF_HPTSI_SLOTS; - if (slot_calc == hpts->p_cur_slot) { + inp->inp_hptsslot = last_tick; + inp->inp_hpts_request = slot; + } else if (maxticks >= slot) { + /* It all fits on the wheel */ + inp->inp_hpts_request = 0; + inp->inp_hptsslot = hpts_tick(wheel_tick, slot); + } else { + /* It does not fit */ + inp->inp_hpts_request = slot - maxticks; + inp->inp_hptsslot = last_tick; + } + if (diag) { + diag->slot_remaining = inp->inp_hpts_request; + diag->inp_hptsslot = inp->inp_hptsslot; + } #ifdef INVARIANTS - /* TSNH */ - panic("Hpts:%p impossible slot calculation slot_calc:%u slot:%u largest:%u\n", - hpts, slot_calc, slot, largest_slot); + check_if_slot_would_be_wrong(hpts, inp, inp->inp_hptsslot, line); #endif - if (slot_calc) - slot_calc--; - else - slot_calc = NUM_OF_HPTSI_SLOTS - 1; - } - inp->inp_hptsslot = slot_calc; - if (diag) { - diag->inp_hptsslot = inp->inp_hptsslot; - } - } else { + hpts_sane_pace_insert(hpts, inp, &hpts->p_hptss[inp->inp_hptsslot], line, 0); + if ((hpts->p_hpts_active == 0) && + (inp->inp_hpts_request == 0) && + (hpts->p_on_min_sleep == 0)) { /* - * The hpts is sleeping, we need to figure out where + * The hpts is sleeping and not on a minimum + * sleep time, we need to figure out where * it will wake up at and if we need to reschedule * its time-out. */ uint32_t have_slept, yet_to_sleep; - uint32_t slot_now; - struct timeval tv; - ticknow = tcp_gethptstick(&tv); - slot_now = ticknow % NUM_OF_HPTSI_SLOTS; - /* - * The user wants to be inserted at (slot_now + - * slot) % NUM_OF_HPTSI_SLOTS, so lets set that up. - */ - largest_slot = NUM_OF_HPTSI_SLOTS - 2; - if (inp->inp_hpts_request > largest_slot) { - /* Adjust the residual in inp_hpts_request */ - slot = largest_slot; - inp->inp_hpts_request -= largest_slot; - } else { - /* No residual it all fits */ - inp->inp_hpts_request = 0; - } - inp->inp_hptsslot = (slot_now + slot) % NUM_OF_HPTSI_SLOTS; - if (diag) { - diag->slot_now = slot_now; - diag->inp_hptsslot = inp->inp_hptsslot; - diag->p_on_min_sleep = hpts->p_on_min_sleep; - } - if (logging_on) { - tcp_hpts_log_it(hpts, inp, HPTSLOG_INSERT_SLEEPER, slot, ticknow); - } /* Now do we need to restart the hpts's timer? */ - if (TSTMP_GT(ticknow, hpts->p_curtick)) - have_slept = ticknow - hpts->p_curtick; - else - have_slept = 0; - if (have_slept < hpts->p_hpts_sleep_time) { - /* This should be what happens */ + have_slept = hpts_ticks_diff(hpts->p_prev_slot, wheel_tick); + if (have_slept < hpts->p_hpts_sleep_time) yet_to_sleep = hpts->p_hpts_sleep_time - have_slept; - } else { + else { /* We are over-due */ yet_to_sleep = 0; need_wakeup = 1; @@ -879,29 +980,22 @@ tcp_hpts_insert_locked(struct tcp_hpts_entry *hpts, st if (diag) { diag->have_slept = have_slept; diag->yet_to_sleep = yet_to_sleep; - diag->hpts_sleep_time = hpts->p_hpts_sleep_time; } - if ((hpts->p_on_min_sleep == 0) && (yet_to_sleep > slot)) { + if (yet_to_sleep && + (yet_to_sleep > slot)) { /* - * We need to reschedule the hptss time-out. + * We need to reschedule the hpts's time-out. */ hpts->p_hpts_sleep_time = slot; need_new_to = slot * HPTS_TICKS_PER_USEC; } } - hpts_sane_pace_insert(hpts, inp, &hpts->p_hptss[inp->inp_hptsslot], line, noref); - if (logging_on) { - tcp_hpts_log_it(hpts, inp, HPTSLOG_INSERTED, slot, ticknow); - } /* * Now how far is the hpts sleeping to? if active is 1, its * up and ticking we do nothing, otherwise we may need to * reschedule its callout if need_new_to is set from above. */ if (need_wakeup) { - if (logging_on) { - tcp_hpts_log_it(hpts, inp, HPTSLOG_RESCHEDULE, 1, 0); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Jul 10 21:35:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC3BA15E40B0; Wed, 10 Jul 2019 21:35:57 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7DDF5731CD; Wed, 10 Jul 2019 21:35:57 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B1DC1CFAD; Wed, 10 Jul 2019 21:35:57 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6ALZvB1036776; Wed, 10 Jul 2019 21:35:57 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6ALZtri036769; Wed, 10 Jul 2019 21:35:55 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201907102135.x6ALZtri036769@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Wed, 10 Jul 2019 21:35:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349894 - in stable/12/lib/libsecureboot: . h openpgp X-SVN-Group: stable-12 X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: in stable/12/lib/libsecureboot: . h openpgp X-SVN-Commit-Revision: 349894 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7DDF5731CD X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.948,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 21:35:58 -0000 Author: sjg Date: Wed Jul 10 21:35:55 2019 New Revision: 349894 URL: https://svnweb.freebsd.org/changeset/base/349894 Log: libsecureboot: allow OpenPGP support to be dormant Since we can now add OpenPGP trust anchors at runtime, ensure the latent support is available. Ensure we do not add duplicate keys to trust store. Also allow reporting names of trust anchors added/revoked We only do this for loader and only after initializing trust store. Thus only changes to initial trust store will be logged. MFC of r349446 Reviewed by: stevek Differential Revision: https://reviews.freebsd.org/D20700 Modified: stable/12/lib/libsecureboot/h/libsecureboot.h stable/12/lib/libsecureboot/libsecureboot-priv.h stable/12/lib/libsecureboot/local.trust.mk stable/12/lib/libsecureboot/openpgp/opgp_key.c stable/12/lib/libsecureboot/readfile.c stable/12/lib/libsecureboot/verify_file.c stable/12/lib/libsecureboot/vets.c Modified: stable/12/lib/libsecureboot/h/libsecureboot.h ============================================================================== --- stable/12/lib/libsecureboot/h/libsecureboot.h Wed Jul 10 20:40:39 2019 (r349893) +++ stable/12/lib/libsecureboot/h/libsecureboot.h Wed Jul 10 21:35:55 2019 (r349894) @@ -42,6 +42,7 @@ #include +unsigned char * read_fd(int, size_t); #ifndef NEED_BRSSL_H unsigned char * read_file(const char *, size_t *); #endif @@ -51,8 +52,12 @@ extern int DebugVe; #define DEBUG_PRINTF(n, x) if (DebugVe >= n) printf x int ve_trust_init(void); +size_t ve_trust_anchors_add_buf(unsigned char *, size_t); +size_t ve_trust_anchors_revoke(unsigned char *, size_t); int ve_trust_add(const char *); void ve_debug_set(int); +void ve_anchor_verbose_set(int); +int ve_anchor_verbose_get(void); void ve_utc_set(time_t utc); char *ve_error_get(void); int ve_error_set(const char *, ...) __printflike(1,2); Modified: stable/12/lib/libsecureboot/libsecureboot-priv.h ============================================================================== --- stable/12/lib/libsecureboot/libsecureboot-priv.h Wed Jul 10 20:40:39 2019 (r349893) +++ stable/12/lib/libsecureboot/libsecureboot-priv.h Wed Jul 10 21:35:55 2019 (r349894) @@ -56,6 +56,8 @@ int is_verified(struct stat *stp); void add_verify_status(struct stat *stp, int status); int openpgp_trust_init(void); +int openpgp_trust_add_buf(unsigned char *, size_t); +int openpgp_trust_revoke(const char *); int openpgp_self_tests(void); int efi_secure_boot_enabled(void); Modified: stable/12/lib/libsecureboot/local.trust.mk ============================================================================== --- stable/12/lib/libsecureboot/local.trust.mk Wed Jul 10 20:40:39 2019 (r349893) +++ stable/12/lib/libsecureboot/local.trust.mk Wed Jul 10 21:35:55 2019 (r349894) @@ -33,6 +33,10 @@ VE_SIGNATURE_EXT_LIST+= \ sig .endif +# add OpenPGP support - possibly dormant +VE_SIGNATURE_LIST+= OPENPGP +VE_SIGNATURE_EXT_LIST+= asc + SIGNER ?= ${SB_TOOLS_PATH:U/volume/buildtools/bin}/sign.py .if exists(${SIGNER}) @@ -42,7 +46,12 @@ SIGN_ECDSA= ${PYTHON} ${SIGNER} -u ${SIGN_HOST}:${ECDS RSA2_PORT:= ${163%y:L:gmtime} SIGN_RSA2= ${PYTHON} ${SIGNER} -u ${SIGN_HOST}:${RSA2_PORT} -h sha256 +# deal with quirk of our .esig format +XCFLAGS.vets+= -DVE_ECDSA_HASH_AGAIN + .if !empty(OPENPGP_SIGN_URL) +XCFLAGS.opgp_key+= -DHAVE_TA_ASC_H + VE_SIGNATURE_LIST+= OPENPGP VE_SIGNATURE_EXT_LIST+= asc Modified: stable/12/lib/libsecureboot/openpgp/opgp_key.c ============================================================================== --- stable/12/lib/libsecureboot/openpgp/opgp_key.c Wed Jul 10 20:40:39 2019 (r349893) +++ stable/12/lib/libsecureboot/openpgp/opgp_key.c Wed Jul 10 21:35:55 2019 (r349894) @@ -209,13 +209,54 @@ openpgp_trust_add(OpenPGP_key *key) LIST_INIT(&trust_list); } - if (key) { - DEBUG_PRINTF(2, ("openpgp_trust_add(%s)\n", key->id)); + if (key && openpgp_trust_get(key->id) == NULL) { + if (ve_anchor_verbose_get()) + printf("openpgp_trust_add(%s)\n", key->id); LIST_INSERT_HEAD(&trust_list, key, entries); } } /** + * @brief add trust anchor from buf + */ +int +openpgp_trust_add_buf(unsigned char *buf, size_t nbytes) +{ + OpenPGP_key *key; + + if ((key = load_key_buf(buf, nbytes))) { + openpgp_trust_add(key); + } + return (key != NULL); +} + + +/** + * @brief if keyID is in our list clobber it + * + * @return true if keyID removed + */ +int +openpgp_trust_revoke(const char *keyID) +{ + OpenPGP_key *key, *tkey; + + openpgp_trust_add(NULL); /* initialize if needed */ + + LIST_FOREACH(key, &trust_list, entries) { + if (strcmp(key->id, keyID) == 0) { + tkey = key; + LIST_REMOVE(tkey, entries); + printf("openpgp_trust_revoke(%s)\n", key->id); + memset(key, 0, sizeof(OpenPGP_key)); + free(key); + return (1); + } + } + return (0); +} + +/** * @brief if keyID is in our list return the key * * @return key or NULL @@ -251,7 +292,9 @@ load_key_file(const char *kfile) return (key); } +#ifdef HAVE_TA_ASC_H #include +#endif #ifndef _STANDALONE /* we can lookup keyID in filesystem */ @@ -330,8 +373,8 @@ openpgp_trust_init(void) } } } - } #endif + } return (once); } Modified: stable/12/lib/libsecureboot/readfile.c ============================================================================== --- stable/12/lib/libsecureboot/readfile.c Wed Jul 10 20:40:39 2019 (r349893) +++ stable/12/lib/libsecureboot/readfile.c Wed Jul 10 21:35:55 2019 (r349894) @@ -28,21 +28,13 @@ __FBSDID("$FreeBSD$"); #include unsigned char * -read_file(const char *path, size_t *len) +read_fd(int fd, size_t len) { - int fd, m, n, x; - struct stat st; + int m, n, x; unsigned char *buf; - if (len) - *len = 0; - if ((fd = open(path, O_RDONLY)) < 0) - return (NULL); - fstat(fd, &st); - if (len) - *len = st.st_size; - buf = malloc(st.st_size + 1); - for (x = 0, m = st.st_size; m > 0; ) { + buf = malloc(len + 1); + for (x = 0, m = len; m > 0; ) { n = read(fd, &buf[x], m); if (n < 0) break; @@ -51,11 +43,30 @@ read_file(const char *path, size_t *len) x += n; } } - close(fd); if (m == 0) { - buf[st.st_size] = '\0'; + buf[len] = '\0'; return (buf); } free(buf); return (NULL); } + +unsigned char * +read_file(const char *path, size_t *len) +{ + struct stat st; + unsigned char *ucp; + int fd; + + if (len) + *len = 0; + if ((fd = open(path, O_RDONLY)) < 0) + return (NULL); + fstat(fd, &st); + ucp = read_fd(fd, st.st_size); + close(fd); + if (len != NULL && ucp != NULL) + *len = st.st_size; + return (ucp); +} + Modified: stable/12/lib/libsecureboot/verify_file.c ============================================================================== --- stable/12/lib/libsecureboot/verify_file.c Wed Jul 10 20:40:39 2019 (r349893) +++ stable/12/lib/libsecureboot/verify_file.c Wed Jul 10 21:35:55 2019 (r349894) @@ -246,7 +246,9 @@ severity_guess(const char *filename) } static void -verify_tweak(char *tweak, int *accept_no_fp, int *verbose, int *verifying) +verify_tweak(int fd, off_t off, struct stat *stp, + char *tweak, int *accept_no_fp, + int *verbose, int *verifying) { if (strcmp(tweak, "off") == 0) { *verifying = 0; @@ -268,6 +270,25 @@ verify_tweak(char *tweak, int *accept_no_fp, int *verb *verbose = 1; } else if (strcmp(tweak, "quiet") == 0) { *verbose = 0; + } else if (strncmp(tweak, "trust", 5) == 0) { + /* content is trust anchor to add or revoke */ + unsigned char *ucp; + size_t num; + + if (off > 0) + lseek(fd, 0, SEEK_SET); + ucp = read_fd(fd, stp->st_size); + if (ucp == NULL) + return; + if (strstr(tweak, "revoke")) { + num = ve_trust_anchors_revoke(ucp, stp->st_size); + DEBUG_PRINTF(3, ("revoked %d trust anchors\n", + (int) num)); + } else { + num = ve_trust_anchors_add_buf(ucp, stp->st_size); + DEBUG_PRINTF(3, ("added %d trust anchors\n", + (int) num)); + } } } @@ -317,8 +338,10 @@ verify_file(int fd, const char *filename, off_t off, i rc = verifying ? VE_NOT_CHECKED : VE_NOT_VERIFYING; ve_status_set(0, rc); ve_status_state = VE_STATUS_NONE; - if (verifying) + if (verifying) { ve_self_tests(); + ve_anchor_verbose_set(1); + } } if (!verifying) return (0); @@ -367,7 +390,7 @@ verify_file(int fd, const char *filename, off_t off, i cp++; if (strncmp(cp, "loader.ve.", 10) == 0) { cp += 10; - verify_tweak(cp, + verify_tweak(fd, off, &st, cp, &accept_no_fp, &verbose, &verifying); } Modified: stable/12/lib/libsecureboot/vets.c ============================================================================== --- stable/12/lib/libsecureboot/vets.c Wed Jul 10 20:40:39 2019 (r349893) +++ stable/12/lib/libsecureboot/vets.c Wed Jul 10 21:35:55 2019 (r349894) @@ -55,7 +55,21 @@ static anchor_list trust_anchors = VEC_INIT; static anchor_list forbidden_anchors = VEC_INIT; static digest_list forbidden_digests = VEC_INIT; +static int anchor_verbose = 0; + void +ve_anchor_verbose_set(int n) +{ + anchor_verbose = n; +} + +int +ve_anchor_verbose_get(void) +{ + return (anchor_verbose); +} + +void ve_debug_set(int n) { DebugVe = n; @@ -116,6 +130,47 @@ free_cert_contents(br_x509_certificate *xc) xfree(xc->data); } +/* + * a bit of a dance to get commonName from a certificate + */ +static char * +x509_cn_get(br_x509_certificate *xc, char *buf, size_t len) +{ + br_x509_minimal_context mc; + br_name_element cn; + unsigned char cn_oid[4]; + int err; + + if (buf == NULL) + return (buf); + /* + * We want the commonName field + * the OID we want is 2,5,4,3 - but DER encoded + */ + cn_oid[0] = 3; + cn_oid[1] = 0x55; + cn_oid[2] = 4; + cn_oid[3] = 3; + cn.oid = cn_oid; + cn.buf = buf; + cn.len = len; + cn.buf[0] = '\0'; + + br_x509_minimal_init(&mc, &br_sha256_vtable, NULL, 0); + br_x509_minimal_set_name_elements(&mc, &cn, 1); + /* the below actually does the work - updates cn.status */ + mc.vtable->start_chain(&mc.vtable, NULL); + mc.vtable->start_cert(&mc.vtable, xc->data_len); + mc.vtable->append(&mc.vtable, xc->data, xc->data_len); + mc.vtable->end_cert(&mc.vtable); + /* we don' actually care about cert status - just its name */ + err = mc.vtable->end_chain(&mc.vtable); + + if (!cn.status) + buf = NULL; + return (buf); +} + /* ASN parsing related defines */ #define ASN1_PRIMITIVE_TAG 0x1F #define ASN1_INF_LENGTH 0x80 @@ -184,7 +239,8 @@ ve_forbidden_digest_add(hash_data *digest, size_t num) } static size_t -ve_anchors_add(br_x509_certificate *xcs, size_t num, anchor_list *anchors) +ve_anchors_add(br_x509_certificate *xcs, size_t num, anchor_list *anchors, + char *anchors_name) { br_x509_trust_anchor ta; size_t u; @@ -194,6 +250,15 @@ ve_anchors_add(br_x509_certificate *xcs, size_t num, a break; } VEC_ADD(*anchors, ta); + if (anchor_verbose && anchors_name) { + char buf[64]; + char *cp; + + cp = x509_cn_get(&xcs[u], buf, sizeof(buf)); + if (cp) { + printf("x509_anchor(%s) %s\n", cp, anchors_name); + } + } } return (u); } @@ -205,27 +270,78 @@ ve_anchors_add(br_x509_certificate *xcs, size_t num, a size_t ve_trust_anchors_add(br_x509_certificate *xcs, size_t num) { - return (ve_anchors_add(xcs, num, &trust_anchors)); + return (ve_anchors_add(xcs, num, &trust_anchors, "trusted")); } size_t ve_forbidden_anchors_add(br_x509_certificate *xcs, size_t num) { - return (ve_anchors_add(xcs, num, &forbidden_anchors)); + return (ve_anchors_add(xcs, num, &forbidden_anchors, "forbidden")); } + /** + * @brief add trust anchors in buf + * + * Assume buf contains x509 certificates, but if not and + * we support OpenPGP try adding as that. + * + * @return number of anchors added + */ +size_t +ve_trust_anchors_add_buf(unsigned char *buf, size_t len) +{ + br_x509_certificate *xcs; + size_t num; + + num = 0; + xcs = parse_certificates(buf, len, &num); + if (xcs != NULL) { + num = ve_trust_anchors_add(xcs, num); +#ifdef VE_OPENPGP_SUPPORT + } else { + num = openpgp_trust_add_buf(buf, len); +#endif + } + return (num); +} + +/** + * @brief revoke trust anchors in buf + * + * Assume buf contains x509 certificates, but if not and + * we support OpenPGP try revoking keyId + * + * @return number of anchors revoked + */ +size_t +ve_trust_anchors_revoke(unsigned char *buf, size_t len) +{ + br_x509_certificate *xcs; + size_t num; + + num = 0; + xcs = parse_certificates(buf, len, &num); + if (xcs != NULL) { + num = ve_forbidden_anchors_add(xcs, num); +#ifdef VE_OPENPGP_SUPPORT + } else { + if (buf[len - 1] == '\n') + buf[len - 1] = '\0'; + num = openpgp_trust_revoke((char *)buf); +#endif + } + return (num); +} + +/** * @brief * initialize our trust_anchors from ta_PEM */ int ve_trust_init(void) { -#ifdef TRUST_ANCHOR_STR - br_x509_certificate *xcs; -#endif static int once = -1; - size_t num; if (once >= 0) return (once); @@ -240,10 +356,8 @@ ve_trust_init(void) #endif #ifdef TRUST_ANCHOR_STR - xcs = parse_certificates(__DECONST(unsigned char *, TRUST_ANCHOR_STR), - sizeof(TRUST_ANCHOR_STR), &num); - if (xcs != NULL) - num = ve_trust_anchors_add(xcs, num); + ve_trust_anchors_add_buf(__DECONST(unsigned char *, TRUST_ANCHOR_STR), + sizeof(TRUST_ANCHOR_STR)); #endif once = (int) VEC_LEN(trust_anchors); #ifdef VE_OPENPGP_SUPPORT @@ -552,6 +666,7 @@ verify_ec(br_x509_pkey *pk, const char *file, const ch br_sha256_init(&ctx); br_sha256_update(&ctx, fcp, flen); br_sha256_out(&ctx, rhbuf); +#ifdef VE_ECDSA_HASH_AGAIN hex = hexdigest(hexbuf, sizeof(hexbuf), rhbuf, br_sha256_SIZE); /* now hash that */ if (hex) { @@ -559,6 +674,7 @@ verify_ec(br_x509_pkey *pk, const char *file, const ch br_sha256_update(&ctx, hex, strlen(hex)); br_sha256_out(&ctx, rhbuf); } +#endif ec = br_ec_get_default(); vrfy = br_ecdsa_vrfy_asn1_get_default(); if (!vrfy(ec, rhbuf, br_sha256_SIZE, &pk->key.ec, po->data, From owner-svn-src-all@freebsd.org Wed Jul 10 22:24:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3CAD15E4DB7; Wed, 10 Jul 2019 22:24:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 72DCA7501B; Wed, 10 Jul 2019 22:24:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B9721D827; Wed, 10 Jul 2019 22:24:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6AMO0X7062091; Wed, 10 Jul 2019 22:24:00 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6AMNxHo062084; Wed, 10 Jul 2019 22:23:59 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907102223.x6AMNxHo062084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 10 Jul 2019 22:23:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349895 - head/sys/dev/isci X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/isci X-SVN-Commit-Revision: 349895 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 72DCA7501B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 22:24:01 -0000 Author: imp Date: Wed Jul 10 22:23:59 2019 New Revision: 349895 URL: https://svnweb.freebsd.org/changeset/base/349895 Log: Enforce a 4GB DMA boundary on isci(4) This device cannot cross a 4GB boundary with DMA. Removing the boundary in r346386 resulted in low frequency memory corruption on machines with isci(4) controllers. Submitted by: gallatin@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20910 Modified: head/sys/dev/isci/isci.c head/sys/dev/isci/isci.h head/sys/dev/isci/isci_controller.c Modified: head/sys/dev/isci/isci.c ============================================================================== --- head/sys/dev/isci/isci.c Wed Jul 10 21:35:55 2019 (r349894) +++ head/sys/dev/isci/isci.c Wed Jul 10 22:23:59 2019 (r349895) @@ -414,7 +414,8 @@ isci_allocate_dma_buffer(device_t device, struct ISCI_ uint32_t status; status = bus_dma_tag_create(bus_get_dma_tag(device), - 0x40 /* cacheline alignment */, 0x0, BUS_SPACE_MAXADDR, + 0x40 /* cacheline alignment */, + ISCI_DMA_BOUNDARY, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, memory->size, 0x1 /* we want physically contiguous */, memory->size, 0, busdma_lock_mutex, &controller->lock, Modified: head/sys/dev/isci/isci.h ============================================================================== --- head/sys/dev/isci/isci.h Wed Jul 10 21:35:55 2019 (r349894) +++ head/sys/dev/isci/isci.h Wed Jul 10 22:23:59 2019 (r349895) @@ -75,6 +75,9 @@ #define ISCI_NUM_PCI_BARS 2 #define ISCI_MAX_LUN 8 +/* This device cannot DMA across a 4GB boundary */ +#define ISCI_DMA_BOUNDARY ((bus_addr_t)((uint64_t)1 << 32)) + MALLOC_DECLARE(M_ISCI); struct ISCI_TIMER { Modified: head/sys/dev/isci/isci_controller.c ============================================================================== --- head/sys/dev/isci/isci_controller.c Wed Jul 10 21:35:55 2019 (r349894) +++ head/sys/dev/isci/isci_controller.c Wed Jul 10 22:23:59 2019 (r349895) @@ -477,9 +477,9 @@ int isci_controller_allocate_memory(struct ISCI_CONTRO * will enable better performance than creating the DMA maps every time we get * an I/O. */ - status = bus_dma_tag_create(bus_get_dma_tag(device), 0x1, 0x0, - BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, - isci_io_request_get_max_io_size(), + status = bus_dma_tag_create(bus_get_dma_tag(device), 0x1, + ISCI_DMA_BOUNDARY, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, + NULL, NULL, isci_io_request_get_max_io_size(), SCI_MAX_SCATTER_GATHER_ELEMENTS, max_segment_size, 0, busdma_lock_mutex, &controller->lock, &controller->buffer_dma_tag); From owner-svn-src-all@freebsd.org Wed Jul 10 22:29:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1557715E4F2B for ; Wed, 10 Jul 2019 22:29:22 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8ECB2752BD for ; Wed, 10 Jul 2019 22:29:21 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x742.google.com with SMTP id s145so3251446qke.7 for ; Wed, 10 Jul 2019 15:29:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=fnXYi2L8bu4DtFWgPbY0xIrmDLl+2QQA+YahJfT6/Kw=; b=XgzsvZtDRNMD0itkh7v0FDzohrXbsWHEyJkjj25pD4ighAytOYuEsbny0VUOjMZ2bo dnFHGe2m5LXfiPt26LWVu6PmSYdtpHeSAJeTIio/PmFa82wrG2FHMrjXgABdrwsf+/AV 6fCNkA/z0z+1YJl6Iucs/2DnrczaBj5gEXL/OYQ3BMzz0ZAn50GnNUgEXTdUl41yc549 RviYcXkQffKHEDyS4xnEdfRWGtpHbQbHamLgFIQ3B1E2nGaHPxRSht2o9Ys3VhcyPi1e BNa//u8DV37D3yWgYHgz6/vTbKYj8ISbWljJbehg0gZqfT/NeDsnP85Qvafz6wcDdJco ptbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=fnXYi2L8bu4DtFWgPbY0xIrmDLl+2QQA+YahJfT6/Kw=; b=hsZjcBSJseTuZ2uMjrNbdSv5Lj2ezcVHr9JjtCIdaWIazMu/bmcjod6HrjFRP5Y42H dkx5v/ipj95PAWDDWYwMnMEiJQGFbJtiYz4ILUnP7qoz4rnq2yJcVZZH96OOZb5hcCuR uXTZ2EyzG7XFl9eP7EBwoRdDxPGOC0M5Zmg5k6Kvty9MluKDWtaQJKAUXn0X807d8CQZ x3eDqmw7ilKtFqU582L+ANVo9f4qj1oaUeHQtA4GRET7FuY76gI/iGQJc9lJxHBGaHCI NnLOzb/Puvbxzd9GgM2Z0QPP5OQnc81KkYprLbqc/SislcYiCYhvSCWp4K0Q/WPW3HGo 9ALw== X-Gm-Message-State: APjAAAWhPzzF9YLIP0V3Vdenm5bBd5/3cuzjk9XPn0BqFBMAW5lIwpMH 44aD59ZOCw8O9IKUWrPB/lKqhQ== X-Google-Smtp-Source: APXvYqybTsfGTWXPmGM8w+29x6SZiIHtby0NhHegp4rWAZyYPbgyuExk6nqmJJ+KTaf1MD8rqIWxgg== X-Received: by 2002:a37:4714:: with SMTP id u20mr484167qka.162.1562797760432; Wed, 10 Jul 2019 15:29:20 -0700 (PDT) Received: from mutt-hbsd ([151.196.118.239]) by smtp.gmail.com with ESMTPSA id o26sm1420409qtp.11.2019.07.10.15.29.19 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 10 Jul 2019 15:29:19 -0700 (PDT) Date: Wed, 10 Jul 2019 18:29:18 -0400 From: Shawn Webb To: Justin Hibbits Cc: Philip Paeps , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet Message-ID: <20190710222918.vj4creizlubdzgw3@mutt-hbsd> References: <201907101742.x6AHg4os016752@repo.freebsd.org> <20190710195548.kdftfemj3icarcxo@mutt-hbsd> <20190710151944.0fd94ec3@titan.knownspace> <20190710202218.yc3lcd6tsql3zkyr@mutt-hbsd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="azbhwo34trcfg3f5" Content-Disposition: inline In-Reply-To: <20190710202218.yc3lcd6tsql3zkyr@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA User-Agent: NeoMutt/20180716 X-Rspamd-Queue-Id: 8ECB2752BD X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.991,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 22:29:22 -0000 --azbhwo34trcfg3f5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 10, 2019 at 04:22:18PM -0400, Shawn Webb wrote: > On Wed, Jul 10, 2019 at 03:19:44PM -0500, Justin Hibbits wrote: > > On Wed, 10 Jul 2019 15:55:48 -0400 > > Shawn Webb wrote: > >=20 > > > On Wed, Jul 10, 2019 at 05:42:04PM +0000, Philip Paeps wrote: > > > > Author: philip > > > > Date: Wed Jul 10 17:42:04 2019 > > > > New Revision: 349890 > > > > URL: https://svnweb.freebsd.org/changeset/base/349890 > > > >=20 > > > > Log: > > > > telnet: fix a couple of snprintf() buffer overflows > > > > =20 > > > > Obtained from: Juniper Networks > > > > MFC after: 1 week > > > >=20 > > > > Modified: > > > > head/contrib/telnet/telnet/commands.c > > > > head/contrib/telnet/telnet/telnet.c > > > > head/contrib/telnet/telnet/utilities.c > > > >=20 > > > > Modified: head/contrib/telnet/telnet/commands.c > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > > > > --- head/contrib/telnet/telnet/commands.c Wed Jul 10 > > > > 17:21:59 2019 (r349889) +++ > > > > head/contrib/telnet/telnet/commands.c Wed Jul 10 17:42:04 > > > > 2019 (r349890) @@ -1655,10 +1655,11 @@ env_init(void) char > > > > hbuf[256+1]; char *cp2 =3D strchr((char *)ep->value, ':'); > > > > =20 > > > > - gethostname(hbuf, 256); > > > > - hbuf[256] =3D '\0'; > > > > - cp =3D (char *)malloc(strlen(hbuf) + strlen(cp2) + > > > > 1); > > > > - sprintf((char *)cp, "%s%s", hbuf, cp2); > > > > + gethostname(hbuf, sizeof(hbuf)); > > > > + hbuf[sizeof(hbuf)-1] =3D '\0'; > > > > + unsigned int buflen =3D strlen(hbuf) + strlen(cp2)= + > > > > 1; =20 > > >=20 > > > buflen should be defined with the rest of the variables in the code > > > block above this one. > >=20 > > Agreed. > >=20 > > >=20 > > > > + cp =3D (char *)malloc(sizeof(char)*buflen); =20 > > >=20 > > > Lack of NULL check here leads to > > >=20 > > > > + snprintf((char *)cp, buflen, "%s%s", hbuf, cp2); =20 > > >=20 > > > potential NULL pointer deref here. > >=20 > > I'm not sure if this is actually a problem. env_init() is called > > exactly once, at the beginning of main(), and the environment size is > > fully constrained by the OS. > >=20 > > That said, this file it the only one in this component that does not > > check the return value of malloc(). All other uses, outside of this > > file, check and error. >=20 > While fixing the style(9) violation above, we could still take care of > the potential NULL deref at the same time. If anything, just for code > correctness reasons? Here's a patch: https://gist.github.com/579685c0252673c3ad92d2536c3486c7 Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 Tor+XMPP+OTR: lattera@is.a.hacker.sx GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 --azbhwo34trcfg3f5 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl0mZrkACgkQ/y5nonf4 4fonOxAAkkmmFdwEviglOgj8Odg8L+UEkbyDxTdH/auvBTfZTAQxMyr/tRaX8n5Q y0mIDhVnWIY1hyMOKtnaH2JvE1sDmLMuYiLY44nIBOzUS5bT2UylhyF3e7r7w9uJ LsMi5Ky0Ap313mhYZwyP0mGsWgU0U+uFwfCdfatV0BZMOX9G1jHXQyMIG/KGWO+Z cErCpJoNhOankh6IFZh5Z0WY8XtKhWwMXDT1AfRse8jHvjTbwmMCMph0bFBOaci2 OauFWvr0zax1dWoWO2EJeDPh2dOF8o0HKfFUkC0RINsKQMxG7sSsfceODl0ORb7k HTJEJXz9TItJC5xlHWkpCVo+UoaL5VFRDaPpEX8i/WYFXj8YKW1P4ah6J5osfVqG ky1BRnJOoRtc7S+EmdQuFZkSv0V1uSKzgp4hH2nDvxRd0xcu5cVJqhJmoCodQCXX nrdiM1cPhwUMgtJlDBZVp1EjRnd290+jRjR5bsoU+XdzkJCE+TiDf5HZw0gDD8Ui Zqcs5ZkiUpKBnsdkya4YI0AWqmtFdCqMqh57452aFwRE7oxxBWBkjJXYnMpwpVvS +ql/areAGV4HxsNz5bZEBv7TwNeYsvNKyEojdUmRfDjdmNOtROQNgYFKzVZO7Qn1 38Uqz/wR/7ymdeiRrSKNq5DlzWsJl8nFSskrSQ9lkMeYCAprYWw= =pPlH -----END PGP SIGNATURE----- --azbhwo34trcfg3f5-- From owner-svn-src-all@freebsd.org Wed Jul 10 22:36:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0D4015E51AB; Wed, 10 Jul 2019 22:36:15 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 74FC4757F1; Wed, 10 Jul 2019 22:36:15 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C21C1D9E9; Wed, 10 Jul 2019 22:36:15 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6AMaFJG067551; Wed, 10 Jul 2019 22:36:15 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6AMaFLI067550; Wed, 10 Jul 2019 22:36:15 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201907102236.x6AMaFLI067550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Wed, 10 Jul 2019 22:36:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349896 - head/contrib/telnet/telnet X-SVN-Group: head X-SVN-Commit-Author: philip X-SVN-Commit-Paths: head/contrib/telnet/telnet X-SVN-Commit-Revision: 349896 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 74FC4757F1 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 22:36:16 -0000 Author: philip Date: Wed Jul 10 22:36:14 2019 New Revision: 349896 URL: https://svnweb.freebsd.org/changeset/base/349896 Log: telnet: fix minor style violation While here also fix a very unlikely NULL pointer dereference. Submitted by: Shawn Webb Modified: head/contrib/telnet/telnet/commands.c Modified: head/contrib/telnet/telnet/commands.c ============================================================================== --- head/contrib/telnet/telnet/commands.c Wed Jul 10 22:23:59 2019 (r349895) +++ head/contrib/telnet/telnet/commands.c Wed Jul 10 22:36:14 2019 (r349896) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -1654,11 +1655,13 @@ env_init(void) || (strncmp((char *)ep->value, "unix:", 5) == 0))) { char hbuf[256+1]; char *cp2 = strchr((char *)ep->value, ':'); + size_t buflen; gethostname(hbuf, sizeof(hbuf)); hbuf[sizeof(hbuf)-1] = '\0'; - unsigned int buflen = strlen(hbuf) + strlen(cp2) + 1; + buflen = strlen(hbuf) + strlen(cp2) + 1; cp = (char *)malloc(sizeof(char)*buflen); + assert(cp != NULL); snprintf((char *)cp, buflen, "%s%s", hbuf, cp2); free(ep->value); ep->value = (unsigned char *)cp; From owner-svn-src-all@freebsd.org Wed Jul 10 22:40:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CEE1B15E5291 for ; Wed, 10 Jul 2019 22:40:38 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5913D75A01 for ; Wed, 10 Jul 2019 22:40:38 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x836.google.com with SMTP id h21so4257344qtn.13 for ; Wed, 10 Jul 2019 15:40:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RfqsVjdvsLWnDPnqUaU5U8Hp+bcrFaYO8yKMAQ8bzlI=; b=RDGDHR6XiHVLmyQ1WNR1bCCYoAcyzjrEPnC//1Fmg2oEkd9vuLq2P7pkYMufMYkJEm 92HQjQzCVQNjITz2woE97EtH1LQVTjeCgbua8Hg/U7xhgEiXPap7oI1eUCti/ykUPu12 WlHE65+duStmZ//6yuOTdaYSyM+LoRhrcaGEI7RhCogj8nIE/fCi96xRRR7NaXjf59I+ /C4vXlr718hO7yKl1vk6bJjZSTo5IZwQvpIOuHuPG78bTMPe3FVb2xi4DAb49apDAISP IqpuvtUGiflyA3qLCU2GZ0TK/hqAnlDtuwpqGzQbHtRRgYlqB4K9djBI/xCCRDjEbJqK lRzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RfqsVjdvsLWnDPnqUaU5U8Hp+bcrFaYO8yKMAQ8bzlI=; b=Zy4PwhubKXqleUPBjMg/rEwJ2QLCFehuqKgpUEc9wnZ9/S3RFZElx4am3ZhnBJvAp6 vrDRhZu5JR/fz6FjPgSsA9dT/i4i2138J44I1HYnyLi2gZZKPzPbJNecJ8Nkcii5oAi8 5YqGtFnUkfeGfvahXL/w9dJalgkDQ5WU5ZUzBWEF2hAptAmKXD2qt6WFhFqbFJvrhMEa 3AMy0gffkyTABzfkWd/d7cqocYKvYEa4G/Zbck1PPc+GxYPIY9W1ByrKkhZTLOrddp5v 7M0wKPESn5A30GlY1QD9U/N6zNIlwNqhOkIGagHS+RelSiwh75Sv4puXQOJm/LR0fXx1 vRbw== X-Gm-Message-State: APjAAAXhTyjELdilOPKNcCKSsgmpDOFo6c8E1GgtQhb1WCf7XYinnRCU smZC7RvQ09UKz0sdqU19D/BZcBeblgFhIlyEZ7o= X-Google-Smtp-Source: APXvYqyx6rFgWia53Pcg9R3t0/nosEAdHrUREYM/sAKaWRF5p8k/OXVztBkT8rPJeD+zaibAirUjgHb+6PrNC4Cq4yw= X-Received: by 2002:ac8:2baa:: with SMTP id m39mr355136qtm.242.1562798436769; Wed, 10 Jul 2019 15:40:36 -0700 (PDT) MIME-Version: 1.0 References: <201907101742.x6AHg4os016752@repo.freebsd.org> <20190710195548.kdftfemj3icarcxo@mutt-hbsd> <20190710151944.0fd94ec3@titan.knownspace> <20190710202218.yc3lcd6tsql3zkyr@mutt-hbsd> <20190710222918.vj4creizlubdzgw3@mutt-hbsd> In-Reply-To: <20190710222918.vj4creizlubdzgw3@mutt-hbsd> From: Warner Losh Date: Wed, 10 Jul 2019 16:40:25 -0600 Message-ID: Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet To: Shawn Webb Cc: Justin Hibbits , Philip Paeps , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 5913D75A01 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.955,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 22:40:39 -0000 On Wed, Jul 10, 2019 at 4:29 PM Shawn Webb wrote: > On Wed, Jul 10, 2019 at 04:22:18PM -0400, Shawn Webb wrote: > > On Wed, Jul 10, 2019 at 03:19:44PM -0500, Justin Hibbits wrote: > > > On Wed, 10 Jul 2019 15:55:48 -0400 > > > Shawn Webb wrote: > > > > > > > On Wed, Jul 10, 2019 at 05:42:04PM +0000, Philip Paeps wrote: > > > > > Author: philip > > > > > Date: Wed Jul 10 17:42:04 2019 > > > > > New Revision: 349890 > > > > > URL: https://svnweb.freebsd.org/changeset/base/349890 > > > > > > > > > > Log: > > > > > telnet: fix a couple of snprintf() buffer overflows > > > > > > > > > > Obtained from: Juniper Networks > > > > > MFC after: 1 week > > > > > > > > > > Modified: > > > > > head/contrib/telnet/telnet/commands.c > > > > > head/contrib/telnet/telnet/telnet.c > > > > > head/contrib/telnet/telnet/utilities.c > > > > > > > > > > Modified: head/contrib/telnet/telnet/commands.c > > > > > > ============================================================================== > > > > > --- head/contrib/telnet/telnet/commands.c Wed Jul 10 > > > > > 17:21:59 2019 (r349889) +++ > > > > > head/contrib/telnet/telnet/commands.c Wed Jul 10 17:42:04 > > > > > 2019 (r349890) @@ -1655,10 +1655,11 @@ env_init(void) char > > > > > hbuf[256+1]; char *cp2 = strchr((char *)ep->value, ':'); > > > > > > > > > > - gethostname(hbuf, 256); > > > > > - hbuf[256] = '\0'; > > > > > - cp = (char *)malloc(strlen(hbuf) + strlen(cp2) + > > > > > 1); > > > > > - sprintf((char *)cp, "%s%s", hbuf, cp2); > > > > > + gethostname(hbuf, sizeof(hbuf)); > > > > > + hbuf[sizeof(hbuf)-1] = '\0'; > > > > > + unsigned int buflen = strlen(hbuf) + strlen(cp2) + > > > > > 1; > > > > > > > > buflen should be defined with the rest of the variables in the code > > > > block above this one. > > > > > > Agreed. > > > > > > > > > > > > + cp = (char *)malloc(sizeof(char)*buflen); > > > > > > > > Lack of NULL check here leads to > > > > > > > > > + snprintf((char *)cp, buflen, "%s%s", hbuf, cp2); > > > > > > > > potential NULL pointer deref here. > > > > > > I'm not sure if this is actually a problem. env_init() is called > > > exactly once, at the beginning of main(), and the environment size is > > > fully constrained by the OS. > > > > > > That said, this file it the only one in this component that does not > > > check the return value of malloc(). All other uses, outside of this > > > file, check and error. > > > > While fixing the style(9) violation above, we could still take care of > > the potential NULL deref at the same time. If anything, just for code > > correctness reasons? > > Here's a patch: > > https://gist.github.com/579685c0252673c3ad92d2536c3486c7 Any reason to not use asprintf instead of malloc + snprintf? Warner From owner-svn-src-all@freebsd.org Wed Jul 10 22:43:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2B6415E5480 for ; Wed, 10 Jul 2019 22:43:44 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 38AD675E6D for ; Wed, 10 Jul 2019 22:43:44 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x742.google.com with SMTP id t8so3299222qkt.1 for ; Wed, 10 Jul 2019 15:43:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=KgZFzH1i+QylvYKNXWozjp50iP59a407g+mtKDPZH9Y=; b=DasIPif16NijjRZ/ceRzRCZ+h8ArS5YonGPafxeol6d5A/fWLqIZdgC9FTg+6c0KX7 9+4F+JFcyTOj+2nukmuR0dSUHGwk4vSCy0q1676GzmLVLqfDP2LttreUZQ8wQbfdtohf 5LL4vzXWzg9eplYEXWlxkZtur0iI6hnGriUJEG75AYf1fxayIy2GpCDuZSGuFwnYqQ4n +R7Dqe0Qc5MqFVxWoBP5ArMo4N/cEyE3Yyze8j8JrJQghIdc8XFNSD50p+4YL2TzbYVG rIK9zQyct+kuOksFWpfTmBkbF5toR8Z01i0+kCOqIJMG6hnkvL9gst7gc1lBMOXaypdV QNRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=KgZFzH1i+QylvYKNXWozjp50iP59a407g+mtKDPZH9Y=; b=B2cA3tzwSK7jb4bfG1wAOEm+N19u6uSMfHmBFAmTUFvRxrGOg9wSP/ETx8QQw1A6SW zwvVAe9kYPTP0ZxBTQvLJ/3BhZwtUQecklUUd6qXcR8AUlbkLBSnm4B+tYs6ohw0PLmV Xt4Gvscs/GC3DRq+Z+Dn7GU9MSgzEZQU9gnpSJheaT++QoUNr8AUYENKUHptWA2nomWB DbP7TT5TSTXcIsTy64YVRZGxbQuz/o7S0X7YtcRzqCs0zuX/8k9AOM4dU2yKFJyyEvhA GwvTBrMx08DSaYh59QFGR14qsj2Uzb52iZsmy1g8N8Z4rlT5aj4bt7dw3mpx0TB7glRI AYdA== X-Gm-Message-State: APjAAAXZxBVeSGmJvtfuzyU+SuvY1wc+GJ+dVHxxATH+cOdbjPVYuDMS 6wINANtjodbZpJEqOO3KRgwzCw== X-Google-Smtp-Source: APXvYqzJnWvkHDl0H3ZOec8Su/ADyHsyA88ltHX1xEn5JcoAfXd22fNe57+zAsHE+kdUClcSd4vkgw== X-Received: by 2002:a37:6944:: with SMTP id e65mr463062qkc.119.1562798623150; Wed, 10 Jul 2019 15:43:43 -0700 (PDT) Received: from mutt-hbsd ([151.196.118.239]) by smtp.gmail.com with ESMTPSA id n184sm1635739qkc.114.2019.07.10.15.43.41 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 10 Jul 2019 15:43:42 -0700 (PDT) Date: Wed, 10 Jul 2019 18:43:41 -0400 From: Shawn Webb To: Warner Losh Cc: Justin Hibbits , Philip Paeps , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet Message-ID: <20190710224341.i3rbhapmpdw6gkbd@mutt-hbsd> References: <201907101742.x6AHg4os016752@repo.freebsd.org> <20190710195548.kdftfemj3icarcxo@mutt-hbsd> <20190710151944.0fd94ec3@titan.knownspace> <20190710202218.yc3lcd6tsql3zkyr@mutt-hbsd> <20190710222918.vj4creizlubdzgw3@mutt-hbsd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ac2c4ewsv4bdieh7" Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA User-Agent: NeoMutt/20180716 X-Rspamd-Queue-Id: 38AD675E6D X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.991,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 22:43:45 -0000 --ac2c4ewsv4bdieh7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 10, 2019 at 04:40:25PM -0600, Warner Losh wrote: > On Wed, Jul 10, 2019 at 4:29 PM Shawn Webb > wrote: >=20 > > On Wed, Jul 10, 2019 at 04:22:18PM -0400, Shawn Webb wrote: > > > On Wed, Jul 10, 2019 at 03:19:44PM -0500, Justin Hibbits wrote: > > > > On Wed, 10 Jul 2019 15:55:48 -0400 > > > > Shawn Webb wrote: > > > > > > > > > On Wed, Jul 10, 2019 at 05:42:04PM +0000, Philip Paeps wrote: > > > > > > Author: philip > > > > > > Date: Wed Jul 10 17:42:04 2019 > > > > > > New Revision: 349890 > > > > > > URL: https://svnweb.freebsd.org/changeset/base/349890 > > > > > > > > > > > > Log: > > > > > > telnet: fix a couple of snprintf() buffer overflows > > > > > > > > > > > > Obtained from: Juniper Networks > > > > > > MFC after: 1 week > > > > > > > > > > > > Modified: > > > > > > head/contrib/telnet/telnet/commands.c > > > > > > head/contrib/telnet/telnet/telnet.c > > > > > > head/contrib/telnet/telnet/utilities.c > > > > > > > > > > > > Modified: head/contrib/telnet/telnet/commands.c > > > > > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > > > > > --- head/contrib/telnet/telnet/commands.c Wed Jul 10 > > > > > > 17:21:59 2019 (r349889) +++ > > > > > > head/contrib/telnet/telnet/commands.c Wed Jul 10 17:42:04 > > > > > > 2019 (r349890) @@ -1655,10 +1655,11 @@ env_init(void) char > > > > > > hbuf[256+1]; char *cp2 =3D strchr((char *)ep->value, ':'); > > > > > > > > > > > > - gethostname(hbuf, 256); > > > > > > - hbuf[256] =3D '\0'; > > > > > > - cp =3D (char *)malloc(strlen(hbuf) + strlen(cp2= ) + > > > > > > 1); > > > > > > - sprintf((char *)cp, "%s%s", hbuf, cp2); > > > > > > + gethostname(hbuf, sizeof(hbuf)); > > > > > > + hbuf[sizeof(hbuf)-1] =3D '\0'; > > > > > > + unsigned int buflen =3D strlen(hbuf) + strlen(= cp2) + > > > > > > 1; > > > > > > > > > > buflen should be defined with the rest of the variables in the co= de > > > > > block above this one. > > > > > > > > Agreed. > > > > > > > > > > > > > > > + cp =3D (char *)malloc(sizeof(char)*buflen); > > > > > > > > > > Lack of NULL check here leads to > > > > > > > > > > > + snprintf((char *)cp, buflen, "%s%s", hbuf, cp2); > > > > > > > > > > potential NULL pointer deref here. > > > > > > > > I'm not sure if this is actually a problem. env_init() is called > > > > exactly once, at the beginning of main(), and the environment size = is > > > > fully constrained by the OS. > > > > > > > > That said, this file it the only one in this component that does not > > > > check the return value of malloc(). All other uses, outside of this > > > > file, check and error. > > > > > > While fixing the style(9) violation above, we could still take care of > > > the potential NULL deref at the same time. If anything, just for code > > > correctness reasons? > > > > Here's a patch: > > > > https://gist.github.com/579685c0252673c3ad92d2536c3486c7 >=20 >=20 > Any reason to not use asprintf instead of malloc + snprintf? Because the existing code already used malloc + snprintf. And this is contrib/telnet/telnet, which arguably should be `rm -rf`ed. ;) The bike shed is now glow-in-the-dark neon green. Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 Tor+XMPP+OTR: lattera@is.a.hacker.sx GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 --ac2c4ewsv4bdieh7 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl0mahcACgkQ/y5nonf4 4fr/jA//RimSOU70RBT1Nd1RxIDlTLZGfwXvN8F8SL3OW+H2FhP+J0UvCzNghszj 8ox5RnWFsZa2WZckTd3zz3FSqUvt5WjNWD1JLSvCBJtTg4alfLkP6MUmCwVeHM/I JZVaOCzHcTr0W+hIq/QrkVcPMZJEm78INuDtn8rRtqp01foh5Wtea0hB5xaPC+DG CIvT2fhOue0eRkKSpc6xaeOSvaH3xHoOWLHRMniY4Moy3EoPpgRL/99ID+0ihaOA 4iD/ynMbJH9ClaKtkjgYi3Zy75vbmF+oNCMIIdHbG9+O0djtJ+xdJkXIzD1XIqoA YbUPE54svJ/Lk5jHKMtF+6b6bAdVbOGOrTedPTKW0y6CEIfB7KWz1dCYtNwltKQG /728n1AP6xQjySy8T5NwxSb7bQyC+FD0OeBOK4kgBSWQQIGonBKFCh4IswPP4RBk x8kShM5ILAClMhSZHYXMCoQEAY6Ia0zlRf2pAvYf08aGcNtsc0Qrg8X4ShHdBFEG 3SXNii9O7ikKNOl4oWOSISiXprzSTEm84OzJ3BiEdfl6QVqkipUrYmfm5lL3ZyI8 XSFjzlZ8hTwZ/KXtV/O46q+ZD/9BN35qIN1Jo+33P3tZ2h4ZEcf44ygDgstkGwel pdw3HTjvTDSWyUCY1NNhdiMqGvDm5nlQIPC0HeyUtjKMDK0GIAE= =j5EO -----END PGP SIGNATURE----- --ac2c4ewsv4bdieh7-- From owner-svn-src-all@freebsd.org Wed Jul 10 22:45:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB2AD15E5512 for ; Wed, 10 Jul 2019 22:45:19 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0442176007 for ; Wed, 10 Jul 2019 22:45:19 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x744.google.com with SMTP id r21so3307451qke.2 for ; Wed, 10 Jul 2019 15:45:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ykoT1uMDs4NCvfO3taegKBo8/Qv5V7f3JtqTSl4DiFU=; b=aS+QYpInjXTiu9fQz1DjdIrlsNjQuTrSrumfU649g7Twv0rUf4WN86ARZzogJKWhjE 6o/M64xrf5el7RU+B/K/LJlfpp0LYvwWHvMUwlF69lOxSmU6AhkfQ8WFfIiftt6rrxmR g2rDi4PNJRXt+QCn5+mzwMedmdgaSM8N9+rTMmvznb2m2v53vPtlt5FYzTY7lXzbf0BY CaEXXvlOggGWELSN03ShcSmOF66UR1bH55BWClVPr3hS03n1m2AHhIyB3KX5QRQZYQDh iGPl1BDGAQtjkVUtl6Hb5vZwWTKRliuE+TVuHrIYcvgvuKO/9W/Xdg8TYKlWDDPlQ7ML MdeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ykoT1uMDs4NCvfO3taegKBo8/Qv5V7f3JtqTSl4DiFU=; b=QVrMTAkwknABfEWX8v47anY++Tj4K6Q7cjwNKEigbjlAv9UB2VWVzbCHlNhBfulVYE ZuGXAtXK4sTIYCPkTHrQaT8JgX4z5pYCwlTY9XGB7Jav/tdE29pOfcDQQI3lot20DM2s 708Rfc3iEpEYp0lkgS0QHglAKZ9WBPoX9v2JZgKInLQ9vQ9CiTlzC1x3Daz6PfoJScoX DwVDiVx+vK2tHL9heCT45zeHmviw60pjtqcDfVjvZeEg9nT7IWoJ3y/KJoZrZb4VbKEE P7ER39IIzAQ5FOAtSz/mBgjwHmC6fXk1MscCKuXupL3d27pyFYJ7D1BD6/THYqaOB2Qh 9EiA== X-Gm-Message-State: APjAAAUq3PGhcGjwL+CqRfo1B21IlQysniKVngIMaczRKCnolqkJyZhD 8gJUF3fzpqABdkFevl0WUZkXL6W5Y2QRY1WiGyY= X-Google-Smtp-Source: APXvYqztVah2TMPb2Pr/wDD+QiWsTEH4SLMN9FZc7dZIJRnRxt9CM+ek+JlIcjiXhe6+BmcAXXMhzjLFb77MCcVLKTU= X-Received: by 2002:a05:620a:1017:: with SMTP id z23mr547301qkj.60.1562798718040; Wed, 10 Jul 2019 15:45:18 -0700 (PDT) MIME-Version: 1.0 References: <201907101742.x6AHg4os016752@repo.freebsd.org> <20190710195548.kdftfemj3icarcxo@mutt-hbsd> <20190710151944.0fd94ec3@titan.knownspace> <20190710202218.yc3lcd6tsql3zkyr@mutt-hbsd> <20190710222918.vj4creizlubdzgw3@mutt-hbsd> <20190710224341.i3rbhapmpdw6gkbd@mutt-hbsd> In-Reply-To: <20190710224341.i3rbhapmpdw6gkbd@mutt-hbsd> From: Warner Losh Date: Wed, 10 Jul 2019 16:45:06 -0600 Message-ID: Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet To: Shawn Webb Cc: Justin Hibbits , Philip Paeps , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 0442176007 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.955,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 22:45:20 -0000 On Wed, Jul 10, 2019 at 4:43 PM Shawn Webb wrote: > On Wed, Jul 10, 2019 at 04:40:25PM -0600, Warner Losh wrote: > > On Wed, Jul 10, 2019 at 4:29 PM Shawn Webb > > wrote: > > > > > On Wed, Jul 10, 2019 at 04:22:18PM -0400, Shawn Webb wrote: > > > > On Wed, Jul 10, 2019 at 03:19:44PM -0500, Justin Hibbits wrote: > > > > > On Wed, 10 Jul 2019 15:55:48 -0400 > > > > > Shawn Webb wrote: > > > > > > > > > > > On Wed, Jul 10, 2019 at 05:42:04PM +0000, Philip Paeps wrote: > > > > > > > Author: philip > > > > > > > Date: Wed Jul 10 17:42:04 2019 > > > > > > > New Revision: 349890 > > > > > > > URL: https://svnweb.freebsd.org/changeset/base/349890 > > > > > > > > > > > > > > Log: > > > > > > > telnet: fix a couple of snprintf() buffer overflows > > > > > > > > > > > > > > Obtained from: Juniper Networks > > > > > > > MFC after: 1 week > > > > > > > > > > > > > > Modified: > > > > > > > head/contrib/telnet/telnet/commands.c > > > > > > > head/contrib/telnet/telnet/telnet.c > > > > > > > head/contrib/telnet/telnet/utilities.c > > > > > > > > > > > > > > Modified: head/contrib/telnet/telnet/commands.c > > > > > > > > > > > ============================================================================== > > > > > > > --- head/contrib/telnet/telnet/commands.c Wed Jul 10 > > > > > > > 17:21:59 2019 (r349889) +++ > > > > > > > head/contrib/telnet/telnet/commands.c Wed Jul 10 17:42:04 > > > > > > > 2019 (r349890) @@ -1655,10 +1655,11 @@ env_init(void) char > > > > > > > hbuf[256+1]; char *cp2 = strchr((char *)ep->value, ':'); > > > > > > > > > > > > > > - gethostname(hbuf, 256); > > > > > > > - hbuf[256] = '\0'; > > > > > > > - cp = (char *)malloc(strlen(hbuf) + strlen(cp2) > + > > > > > > > 1); > > > > > > > - sprintf((char *)cp, "%s%s", hbuf, cp2); > > > > > > > + gethostname(hbuf, sizeof(hbuf)); > > > > > > > + hbuf[sizeof(hbuf)-1] = '\0'; > > > > > > > + unsigned int buflen = strlen(hbuf) + > strlen(cp2) + > > > > > > > 1; > > > > > > > > > > > > buflen should be defined with the rest of the variables in the > code > > > > > > block above this one. > > > > > > > > > > Agreed. > > > > > > > > > > > > > > > > > > + cp = (char *)malloc(sizeof(char)*buflen); > > > > > > > > > > > > Lack of NULL check here leads to > > > > > > > > > > > > > + snprintf((char *)cp, buflen, "%s%s", hbuf, > cp2); > > > > > > > > > > > > potential NULL pointer deref here. > > > > > > > > > > I'm not sure if this is actually a problem. env_init() is called > > > > > exactly once, at the beginning of main(), and the environment size > is > > > > > fully constrained by the OS. > > > > > > > > > > That said, this file it the only one in this component that does > not > > > > > check the return value of malloc(). All other uses, outside of > this > > > > > file, check and error. > > > > > > > > While fixing the style(9) violation above, we could still take care > of > > > > the potential NULL deref at the same time. If anything, just for code > > > > correctness reasons? > > > > > > Here's a patch: > > > > > > https://gist.github.com/579685c0252673c3ad92d2536c3486c7 > > > > > > Any reason to not use asprintf instead of malloc + snprintf? > > Because the existing code already used malloc + snprintf. And this is > contrib/telnet/telnet, which arguably should be `rm -rf`ed. ;) > > The bike shed is now glow-in-the-dark neon green. > I'm not in the rm-rf telnet camp... I use it far too often to connect to a port with good terminal support to want to do that... Warner From owner-svn-src-all@freebsd.org Wed Jul 10 22:52:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EFA6715E598A; Wed, 10 Jul 2019 22:52:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 930D776600; Wed, 10 Jul 2019 22:52:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C60C1DD2A; Wed, 10 Jul 2019 22:52:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6AMqR8N077488; Wed, 10 Jul 2019 22:52:27 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6AMqRfb077487; Wed, 10 Jul 2019 22:52:27 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907102252.x6AMqRfb077487@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 10 Jul 2019 22:52:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349897 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 349897 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 930D776600 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 22:52:28 -0000 Author: markj Date: Wed Jul 10 22:52:26 2019 New Revision: 349897 URL: https://svnweb.freebsd.org/changeset/base/349897 Log: Rename pmap_page_dirty() to pmap_pte_dirty(). This is a precursor to implementing dirty bit management. Discussed with: alc MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Wed Jul 10 22:36:14 2019 (r349896) +++ head/sys/arm64/arm64/pmap.c Wed Jul 10 22:52:26 2019 (r349897) @@ -536,7 +536,7 @@ CTASSERT(L1_BLOCK == L2_BLOCK); * arm64 so for now assume is a page mapped as rw was accessed it is. */ static inline int -pmap_page_dirty(pt_entry_t pte) +pmap_pte_dirty(pt_entry_t pte) { return ((pte & (ATTR_AF | ATTR_AP_RW_BIT)) == @@ -1952,7 +1952,7 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l tpte = pmap_load_clear(pte); pmap_invalidate_page(pmap, va); m = PHYS_TO_VM_PAGE(tpte & ~ATTR_MASK); - if (pmap_page_dirty(tpte)) + if (pmap_pte_dirty(tpte)) vm_page_dirty(m); if ((tpte & ATTR_AF) != 0) vm_page_aflag_set(m, PGA_REFERENCED); @@ -2449,7 +2449,7 @@ pmap_remove_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_ eva = sva + L2_SIZE; for (va = sva, m = PHYS_TO_VM_PAGE(old_l2 & ~ATTR_MASK); va < eva; va += PAGE_SIZE, m++) { - if (pmap_page_dirty(old_l2)) + if (pmap_pte_dirty(old_l2)) vm_page_dirty(m); if (old_l2 & ATTR_AF) vm_page_aflag_set(m, PGA_REFERENCED); @@ -2494,7 +2494,7 @@ pmap_remove_l3(pmap_t pmap, pt_entry_t *l3, vm_offset_ pmap_resident_count_dec(pmap, 1); if (old_l3 & ATTR_SW_MANAGED) { m = PHYS_TO_VM_PAGE(old_l3 & ~ATTR_MASK); - if (pmap_page_dirty(old_l3)) + if (pmap_pte_dirty(old_l3)) vm_page_dirty(m); if (old_l3 & ATTR_AF) vm_page_aflag_set(m, PGA_REFERENCED); @@ -2542,7 +2542,7 @@ pmap_remove_l3_range(pmap_t pmap, pd_entry_t l2e, vm_o pmap_resident_count_dec(pmap, 1); if ((old_l3 & ATTR_SW_MANAGED) != 0) { m = PHYS_TO_VM_PAGE(old_l3 & ~ATTR_MASK); - if (pmap_page_dirty(old_l3)) + if (pmap_pte_dirty(old_l3)) vm_page_dirty(m); if ((old_l3 & ATTR_AF) != 0) vm_page_aflag_set(m, PGA_REFERENCED); @@ -2771,7 +2771,7 @@ retry: /* * Update the vm_page_t clean and reference bits. */ - if (pmap_page_dirty(tpte)) + if (pmap_pte_dirty(tpte)) vm_page_dirty(m); pmap_unuse_pt(pmap, pv->pv_va, tpde, &free); TAILQ_REMOVE(&m->md.pv_list, pv, pv_next); @@ -2814,7 +2814,7 @@ pmap_protect_l2(pmap_t pmap, pt_entry_t *l2, vm_offset */ if ((nbits & ATTR_AP(ATTR_AP_RO)) != 0 && (old_l2 & ATTR_SW_MANAGED) != 0 && - pmap_page_dirty(old_l2)) { + pmap_pte_dirty(old_l2)) { m = PHYS_TO_VM_PAGE(old_l2 & ~ATTR_MASK); for (mt = m; mt < &m[L2_SIZE / PAGE_SIZE]; mt++) vm_page_dirty(mt); @@ -2922,7 +2922,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t */ if ((nbits & ATTR_AP(ATTR_AP_RO)) != 0 && (l3 & ATTR_SW_MANAGED) != 0 && - pmap_page_dirty(l3)) + pmap_pte_dirty(l3)) vm_page_dirty(PHYS_TO_VM_PAGE(l3 & ~ATTR_MASK)); pmap_set(l3p, nbits); @@ -3279,7 +3279,7 @@ havel3: * concurrent calls to pmap_page_test_mappings() and * pmap_ts_referenced(). */ - if (pmap_page_dirty(orig_l3)) + if (pmap_pte_dirty(orig_l3)) vm_page_dirty(om); if ((orig_l3 & ATTR_AF) != 0) vm_page_aflag_set(om, PGA_REFERENCED); @@ -3344,7 +3344,7 @@ validate: /* same PA, different attributes */ pmap_load_store(l3, new_l3); pmap_invalidate_page(pmap, va); - if (pmap_page_dirty(orig_l3) && + if (pmap_pte_dirty(orig_l3) && (orig_l3 & ATTR_SW_MANAGED) != 0) vm_page_dirty(m); } else { @@ -4684,7 +4684,7 @@ retry: ("pmap_ts_referenced: found an invalid l1 table")); pte = pmap_l1_to_l2(pde, pv->pv_va); tpte = pmap_load(pte); - if (pmap_page_dirty(tpte)) { + if (pmap_pte_dirty(tpte)) { /* * Although "tpte" is mapping a 2MB page, because * this function is called at a 4KB page granularity, @@ -4788,7 +4788,7 @@ small_mappings: ("pmap_ts_referenced: found an invalid l2 table")); pte = pmap_l2_to_l3(pde, pv->pv_va); tpte = pmap_load(pte); - if (pmap_page_dirty(tpte)) + if (pmap_pte_dirty(tpte)) vm_page_dirty(m); if ((tpte & ATTR_AF) != 0) { if (safe_to_clear_referenced(pmap, tpte)) { @@ -5454,7 +5454,7 @@ retry: val = MINCORE_INCORE; if (lvl != 3) val |= MINCORE_SUPER; - if (pmap_page_dirty(tpte)) + if (pmap_pte_dirty(tpte)) val |= MINCORE_MODIFIED | MINCORE_MODIFIED_OTHER; if ((tpte & ATTR_AF) == ATTR_AF) val |= MINCORE_REFERENCED | MINCORE_REFERENCED_OTHER; From owner-svn-src-all@freebsd.org Wed Jul 10 23:29:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B1D115E605A; Wed, 10 Jul 2019 23:29:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 11FF377710; Wed, 10 Jul 2019 23:29:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 2DFFF108BC; Wed, 10 Jul 2019 23:29:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r349893 - in head/sys: modules/tcp/rack netinet netinet/tcp_stacks sys To: Randall Stewart , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201907102040.x6AKeern006731@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <4cdc824e-7e71-731d-50d4-c3f6231f9858@FreeBSD.org> Date: Wed, 10 Jul 2019 16:28:58 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <201907102040.x6AKeern006731@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 11FF377710 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.983,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 23:29:02 -0000 On 7/10/19 1:40 PM, Randall Stewart wrote: > Author: rrs > Date: Wed Jul 10 20:40:39 2019 > New Revision: 349893 > URL: https://svnweb.freebsd.org/changeset/base/349893 > > Log: > This commit updates rack to what is basically being used at NF as > well as sets in some of the groundwork for committing BBR. The > hpts system is updated as well as some other needed utilities > for the entrance of BBR. This is actually part 1 of 3 more > needed commits which will finally complete with BBRv1 being > added as a new tcp stack. > > Sponsored by: Netflix Inc. > Differential Revision: https://reviews.freebsd.org/D20834 Is it safe for M_TSTMP_LRO to conflict with M_PROTO1? Also, it seems you changed the copyright range on rack.c from 2016-2019 to just 2016 which I suspect is an accident. I would suggest using #error here: #ifndef TCPHPTS fatal error missing option TCPHSTS in the build; #endif -- John Baldwin From owner-svn-src-all@freebsd.org Thu Jul 11 00:08:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5DC8815E6C95; Thu, 11 Jul 2019 00:08:47 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F26A680BC0; Thu, 11 Jul 2019 00:08:46 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB1A41E8FD; Thu, 11 Jul 2019 00:08:46 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B08kKP013547; Thu, 11 Jul 2019 00:08:46 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B08kuB013546; Thu, 11 Jul 2019 00:08:46 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907110008.x6B08kuB013546@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 11 Jul 2019 00:08:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349898 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349898 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F26A680BC0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 00:08:47 -0000 Author: cy Date: Thu Jul 11 00:08:46 2019 New Revision: 349898 URL: https://svnweb.freebsd.org/changeset/base/349898 Log: ipfilter commands, in this case ipf(8), passes its operations and rules via an ioctl interface. Rules can be added or removed and stats and counters can be zeroed out. As the ipfilter interprets these instructions or operations they are stored in an integer called addrem (add/remove). 1 is add, 2 is remove, and 3 is clear stats and counters. Much of this is not documented. This commit documents these operations by replacing simple integers with a self documenting enum along with a few basic comments. MFC after: 1 week Modified: head/sys/contrib/ipfilter/netinet/fil.c Modified: head/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/fil.c Wed Jul 10 22:52:26 2019 (r349897) +++ head/sys/contrib/ipfilter/netinet/fil.c Thu Jul 11 00:08:46 2019 (r349898) @@ -4472,7 +4472,12 @@ frrequest(softc, unit, req, data, set, makecopy) int set, makecopy; caddr_t data; { - int error = 0, in, family, addrem, need_free = 0; + int error = 0, in, family, need_free = 0; + enum { OP_UNDEF, /* undefined */ + OP_ADD, /* add rule */ + OP_REM, /* remove rule */ + OP_ZERO /* zero statistics and counters */ } + addrem = OP_UNDEF; frentry_t frd, *fp, *f, **fprev, **ftail; void *ptr, *uptr, *cptr; u_int *p, *pp; @@ -4540,11 +4545,11 @@ frrequest(softc, unit, req, data, set, makecopy) if (req == (ioctlcmd_t)SIOCINAFR || req == (ioctlcmd_t)SIOCINIFR || req == (ioctlcmd_t)SIOCADAFR || req == (ioctlcmd_t)SIOCADIFR) - addrem = 0; + addrem = OP_ADD; /* Add rule */ else if (req == (ioctlcmd_t)SIOCRMAFR || req == (ioctlcmd_t)SIOCRMIFR) - addrem = 1; + addrem = OP_REM; /* Remove rule */ else if (req == (ioctlcmd_t)SIOCZRLST) - addrem = 2; + addrem = OP_ZERO; /* Zero statistics and counters */ else { IPFERROR(9); error = EINVAL; @@ -4578,7 +4583,7 @@ frrequest(softc, unit, req, data, set, makecopy) goto donenolock; } - if (addrem == 0) { + if (addrem == OP_UNDEF) { error = ipf_funcinit(softc, fp); if (error != 0) goto donenolock; @@ -4642,7 +4647,7 @@ frrequest(softc, unit, req, data, set, makecopy) * them to be created if they don't already exit. */ group = FR_NAME(fp, fr_group); - if (addrem == 0) { + if (addrem == OP_UNDEF) { fg = ipf_group_add(softc, group, NULL, fp->fr_flags, unit, set); fp->fr_grp = fg; @@ -4947,7 +4952,7 @@ frrequest(softc, unit, req, data, set, makecopy) /* * If zero'ing statistics, copy current to caller and zero. */ - if (addrem == 2) { + if (addrem == OP_ZERO) { if (f == NULL) { IPFERROR(27); error = ESRCH; @@ -5040,7 +5045,7 @@ frrequest(softc, unit, req, data, set, makecopy) /* * Request to remove a rule. */ - if (addrem == 1) { + if (addrem == OP_REM) { if (f == NULL) { IPFERROR(29); error = ESRCH; @@ -5106,7 +5111,7 @@ frrequest(softc, unit, req, data, set, makecopy) if (fp->fr_next != NULL) fp->fr_next->fr_pnext = &fp->fr_next; *ftail = fp; - if (addrem == 0) + if (addrem == OP_UNDEF) ipf_fixskip(ftail, fp, 1); fp->fr_icmpgrp = NULL; From owner-svn-src-all@freebsd.org Thu Jul 11 00:21:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 220F415E7172; Thu, 11 Jul 2019 00:21:17 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BC76581662; Thu, 11 Jul 2019 00:21:16 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 950A41EAD5; Thu, 11 Jul 2019 00:21:16 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B0LGkZ022000; Thu, 11 Jul 2019 00:21:16 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B0LFsM021994; Thu, 11 Jul 2019 00:21:15 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201907110021.x6B0LFsM021994@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Thu, 11 Jul 2019 00:21:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349899 - in stable/12: contrib/libarchive/libarchive contrib/libarchive/libarchive/test lib/libarchive/tests X-SVN-Group: stable-12 X-SVN-Commit-Author: mm X-SVN-Commit-Paths: in stable/12: contrib/libarchive/libarchive contrib/libarchive/libarchive/test lib/libarchive/tests X-SVN-Commit-Revision: 349899 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BC76581662 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 00:21:17 -0000 Author: mm Date: Thu Jul 11 00:21:15 2019 New Revision: 349899 URL: https://svnweb.freebsd.org/changeset/base/349899 Log: MFC r349527,349538: Sync libarchive with vendor. Relevant vendor changes: PR #1217: RAR5 reader - fix ARM filter going beyond window buffer boundary (OSS-Fuzz 15431) PR #1218: Fixes to sparse file handling Added: stable/12/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu - copied unchanged from r349527, head/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu Modified: stable/12/contrib/libarchive/libarchive/archive_read.c stable/12/contrib/libarchive/libarchive/archive_read_disk_posix.c stable/12/contrib/libarchive/libarchive/archive_read_support_format_rar5.c stable/12/contrib/libarchive/libarchive/test/test_read_format_rar5.c stable/12/lib/libarchive/tests/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/libarchive/libarchive/archive_read.c ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read.c Thu Jul 11 00:08:46 2019 (r349898) +++ stable/12/contrib/libarchive/libarchive/archive_read.c Thu Jul 11 00:21:15 2019 (r349899) @@ -844,7 +844,8 @@ archive_read_data(struct archive *_a, void *buff, size dest = (char *)buff; while (s > 0) { - if (a->read_data_remaining == 0) { + if (a->read_data_offset == a->read_data_output_offset && + a->read_data_remaining == 0) { read_buf = a->read_data_block; a->read_data_is_posix_read = 1; a->read_data_requested = s; Modified: stable/12/contrib/libarchive/libarchive/archive_read_disk_posix.c ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_disk_posix.c Thu Jul 11 00:08:46 2019 (r349898) +++ stable/12/contrib/libarchive/libarchive/archive_read_disk_posix.c Thu Jul 11 00:21:15 2019 (r349899) @@ -1143,6 +1143,8 @@ _archive_read_next_header2(struct archive *_a, struct t->entry_fd = -1; } + archive_entry_clear(entry); + for (;;) { r = next_entry(a, t, entry); if (t->entry_fd >= 0) { Modified: stable/12/contrib/libarchive/libarchive/archive_read_support_format_rar5.c ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_support_format_rar5.c Thu Jul 11 00:08:46 2019 (r349898) +++ stable/12/contrib/libarchive/libarchive/archive_read_support_format_rar5.c Thu Jul 11 00:21:15 2019 (r349899) @@ -623,9 +623,9 @@ static int run_arm_filter(struct rar5* rar, struct fil for(i = 0; i < flt->block_length - 3; i += 4) { uint8_t* b = &rar->cstate.window_buf[ (rar->cstate.solid_offset + - flt->block_start + i) & rar->cstate.window_mask]; + flt->block_start + i + 3) & rar->cstate.window_mask]; - if(b[3] == 0xEB) { + if(*b == 0xEB) { /* 0xEB = ARM's BL (branch + link) instruction. */ offset = read_filter_data(rar, (rar->cstate.solid_offset + flt->block_start + i) & Modified: stable/12/contrib/libarchive/libarchive/test/test_read_format_rar5.c ============================================================================== --- stable/12/contrib/libarchive/libarchive/test/test_read_format_rar5.c Thu Jul 11 00:08:46 2019 (r349898) +++ stable/12/contrib/libarchive/libarchive/test/test_read_format_rar5.c Thu Jul 11 00:21:15 2019 (r349899) @@ -1215,3 +1215,18 @@ DEFINE_TEST(test_read_format_rar5_different_window_siz EPILOGUE(); } + +DEFINE_TEST(test_read_format_rar5_arm_filter_on_window_boundary) +{ + char buf[4096]; + PROLOGUE("test_read_format_rar5_arm_filter_on_window_boundary.rar"); + + /* Return codes of those calls are ignored, because this sample file + * is invalid. However, the unpacker shouldn't produce any SIGSEGV + * errors during processing. */ + + (void) archive_read_next_header(a, &ae); + while(0 != archive_read_data(a, buf, sizeof(buf))) {} + + EPILOGUE(); +} Copied: stable/12/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu (from r349527, head/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu Thu Jul 11 00:21:15 2019 (r349899, copy of r349527, head/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu) @@ -0,0 +1,9 @@ +begin 600 test_read_format_rar5_arm_filter_on_window_boundary.rar +M4F%R(1H'`0"-[P+2``(''(`'`/[_(`#_!``"(0$``/X(TB`!'O___P@``/W_ +M_Q``_]U84%"0_P1LAFVQ9,S,M[$`20"#__\`_P#_`/G___!DSR0V2+$`20`Z +M@R[_______\I:!<**-@P70D`KB1! Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9345C15E71DC; Thu, 11 Jul 2019 00:21:49 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3084E817F3; Thu, 11 Jul 2019 00:21:49 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC6021EB03; Thu, 11 Jul 2019 00:21:48 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B0LmH9022067; Thu, 11 Jul 2019 00:21:48 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B0LlWK022062; Thu, 11 Jul 2019 00:21:47 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201907110021.x6B0LlWK022062@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Thu, 11 Jul 2019 00:21:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349900 - in stable/11: contrib/libarchive/libarchive contrib/libarchive/libarchive/test lib/libarchive/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: mm X-SVN-Commit-Paths: in stable/11: contrib/libarchive/libarchive contrib/libarchive/libarchive/test lib/libarchive/tests X-SVN-Commit-Revision: 349900 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3084E817F3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 00:21:49 -0000 Author: mm Date: Thu Jul 11 00:21:47 2019 New Revision: 349900 URL: https://svnweb.freebsd.org/changeset/base/349900 Log: MFC r349527,349538: Sync libarchive with vendor. Relevant vendor changes: PR #1217: RAR5 reader - fix ARM filter going beyond window buffer boundary (OSS-Fuzz 15431) PR #1218: Fixes to sparse file handling Added: stable/11/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu - copied unchanged from r349527, head/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu Modified: stable/11/contrib/libarchive/libarchive/archive_read.c stable/11/contrib/libarchive/libarchive/archive_read_disk_posix.c stable/11/contrib/libarchive/libarchive/archive_read_support_format_rar5.c stable/11/contrib/libarchive/libarchive/test/test_read_format_rar5.c stable/11/lib/libarchive/tests/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/libarchive/libarchive/archive_read.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_read.c Thu Jul 11 00:21:15 2019 (r349899) +++ stable/11/contrib/libarchive/libarchive/archive_read.c Thu Jul 11 00:21:47 2019 (r349900) @@ -844,7 +844,8 @@ archive_read_data(struct archive *_a, void *buff, size dest = (char *)buff; while (s > 0) { - if (a->read_data_remaining == 0) { + if (a->read_data_offset == a->read_data_output_offset && + a->read_data_remaining == 0) { read_buf = a->read_data_block; a->read_data_is_posix_read = 1; a->read_data_requested = s; Modified: stable/11/contrib/libarchive/libarchive/archive_read_disk_posix.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_read_disk_posix.c Thu Jul 11 00:21:15 2019 (r349899) +++ stable/11/contrib/libarchive/libarchive/archive_read_disk_posix.c Thu Jul 11 00:21:47 2019 (r349900) @@ -1143,6 +1143,8 @@ _archive_read_next_header2(struct archive *_a, struct t->entry_fd = -1; } + archive_entry_clear(entry); + for (;;) { r = next_entry(a, t, entry); if (t->entry_fd >= 0) { Modified: stable/11/contrib/libarchive/libarchive/archive_read_support_format_rar5.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_read_support_format_rar5.c Thu Jul 11 00:21:15 2019 (r349899) +++ stable/11/contrib/libarchive/libarchive/archive_read_support_format_rar5.c Thu Jul 11 00:21:47 2019 (r349900) @@ -623,9 +623,9 @@ static int run_arm_filter(struct rar5* rar, struct fil for(i = 0; i < flt->block_length - 3; i += 4) { uint8_t* b = &rar->cstate.window_buf[ (rar->cstate.solid_offset + - flt->block_start + i) & rar->cstate.window_mask]; + flt->block_start + i + 3) & rar->cstate.window_mask]; - if(b[3] == 0xEB) { + if(*b == 0xEB) { /* 0xEB = ARM's BL (branch + link) instruction. */ offset = read_filter_data(rar, (rar->cstate.solid_offset + flt->block_start + i) & Modified: stable/11/contrib/libarchive/libarchive/test/test_read_format_rar5.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/test/test_read_format_rar5.c Thu Jul 11 00:21:15 2019 (r349899) +++ stable/11/contrib/libarchive/libarchive/test/test_read_format_rar5.c Thu Jul 11 00:21:47 2019 (r349900) @@ -1215,3 +1215,18 @@ DEFINE_TEST(test_read_format_rar5_different_window_siz EPILOGUE(); } + +DEFINE_TEST(test_read_format_rar5_arm_filter_on_window_boundary) +{ + char buf[4096]; + PROLOGUE("test_read_format_rar5_arm_filter_on_window_boundary.rar"); + + /* Return codes of those calls are ignored, because this sample file + * is invalid. However, the unpacker shouldn't produce any SIGSEGV + * errors during processing. */ + + (void) archive_read_next_header(a, &ae); + while(0 != archive_read_data(a, buf, sizeof(buf))) {} + + EPILOGUE(); +} Copied: stable/11/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu (from r349527, head/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu Thu Jul 11 00:21:47 2019 (r349900, copy of r349527, head/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu) @@ -0,0 +1,9 @@ +begin 600 test_read_format_rar5_arm_filter_on_window_boundary.rar +M4F%R(1H'`0"-[P+2``(''(`'`/[_(`#_!``"(0$``/X(TB`!'O___P@``/W_ +M_Q``_]U84%"0_P1LAFVQ9,S,M[$`20"#__\`_P#_`/G___!DSR0V2+$`20`Z +M@R[_______\I:!<**-@P70D`KB1! Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 572C615E7375; Thu, 11 Jul 2019 00:22:12 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CCB9281949; Thu, 11 Jul 2019 00:22:11 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 967391EC40; Thu, 11 Jul 2019 00:22:11 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B0MBcN022157; Thu, 11 Jul 2019 00:22:11 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B0MARV022151; Thu, 11 Jul 2019 00:22:10 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201907110022.x6B0MARV022151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Thu, 11 Jul 2019 00:22:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r349901 - in stable/10: contrib/libarchive/libarchive contrib/libarchive/libarchive/test lib/libarchive/tests X-SVN-Group: stable-10 X-SVN-Commit-Author: mm X-SVN-Commit-Paths: in stable/10: contrib/libarchive/libarchive contrib/libarchive/libarchive/test lib/libarchive/tests X-SVN-Commit-Revision: 349901 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CCB9281949 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 00:22:12 -0000 Author: mm Date: Thu Jul 11 00:22:10 2019 New Revision: 349901 URL: https://svnweb.freebsd.org/changeset/base/349901 Log: MFC r349527,349538: Sync libarchive with vendor. Relevant vendor changes: PR #1217: RAR5 reader - fix ARM filter going beyond window buffer boundary (OSS-Fuzz 15431) PR #1218: Fixes to sparse file handling Added: stable/10/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu - copied unchanged from r349527, head/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu Modified: stable/10/contrib/libarchive/libarchive/archive_read.c stable/10/contrib/libarchive/libarchive/archive_read_disk_posix.c stable/10/contrib/libarchive/libarchive/archive_read_support_format_rar5.c stable/10/contrib/libarchive/libarchive/test/test_read_format_rar5.c stable/10/lib/libarchive/tests/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/libarchive/libarchive/archive_read.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read.c Thu Jul 11 00:21:47 2019 (r349900) +++ stable/10/contrib/libarchive/libarchive/archive_read.c Thu Jul 11 00:22:10 2019 (r349901) @@ -844,7 +844,8 @@ archive_read_data(struct archive *_a, void *buff, size dest = (char *)buff; while (s > 0) { - if (a->read_data_remaining == 0) { + if (a->read_data_offset == a->read_data_output_offset && + a->read_data_remaining == 0) { read_buf = a->read_data_block; a->read_data_is_posix_read = 1; a->read_data_requested = s; Modified: stable/10/contrib/libarchive/libarchive/archive_read_disk_posix.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read_disk_posix.c Thu Jul 11 00:21:47 2019 (r349900) +++ stable/10/contrib/libarchive/libarchive/archive_read_disk_posix.c Thu Jul 11 00:22:10 2019 (r349901) @@ -1143,6 +1143,8 @@ _archive_read_next_header2(struct archive *_a, struct t->entry_fd = -1; } + archive_entry_clear(entry); + for (;;) { r = next_entry(a, t, entry); if (t->entry_fd >= 0) { Modified: stable/10/contrib/libarchive/libarchive/archive_read_support_format_rar5.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read_support_format_rar5.c Thu Jul 11 00:21:47 2019 (r349900) +++ stable/10/contrib/libarchive/libarchive/archive_read_support_format_rar5.c Thu Jul 11 00:22:10 2019 (r349901) @@ -623,9 +623,9 @@ static int run_arm_filter(struct rar5* rar, struct fil for(i = 0; i < flt->block_length - 3; i += 4) { uint8_t* b = &rar->cstate.window_buf[ (rar->cstate.solid_offset + - flt->block_start + i) & rar->cstate.window_mask]; + flt->block_start + i + 3) & rar->cstate.window_mask]; - if(b[3] == 0xEB) { + if(*b == 0xEB) { /* 0xEB = ARM's BL (branch + link) instruction. */ offset = read_filter_data(rar, (rar->cstate.solid_offset + flt->block_start + i) & Modified: stable/10/contrib/libarchive/libarchive/test/test_read_format_rar5.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/test/test_read_format_rar5.c Thu Jul 11 00:21:47 2019 (r349900) +++ stable/10/contrib/libarchive/libarchive/test/test_read_format_rar5.c Thu Jul 11 00:22:10 2019 (r349901) @@ -1215,3 +1215,18 @@ DEFINE_TEST(test_read_format_rar5_different_window_siz EPILOGUE(); } + +DEFINE_TEST(test_read_format_rar5_arm_filter_on_window_boundary) +{ + char buf[4096]; + PROLOGUE("test_read_format_rar5_arm_filter_on_window_boundary.rar"); + + /* Return codes of those calls are ignored, because this sample file + * is invalid. However, the unpacker shouldn't produce any SIGSEGV + * errors during processing. */ + + (void) archive_read_next_header(a, &ae); + while(0 != archive_read_data(a, buf, sizeof(buf))) {} + + EPILOGUE(); +} Copied: stable/10/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu (from r349527, head/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu Thu Jul 11 00:22:10 2019 (r349901, copy of r349527, head/contrib/libarchive/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu) @@ -0,0 +1,9 @@ +begin 600 test_read_format_rar5_arm_filter_on_window_boundary.rar +M4F%R(1H'`0"-[P+2``(''(`'`/[_(`#_!``"(0$``/X(TB`!'O___P@``/W_ +M_Q``_]U84%"0_P1LAFVQ9,S,M[$`20"#__\`_P#_`/G___!DSR0V2+$`20`Z +M@R[_______\I:!<**-@P70D`KB1! Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FC7815E7993; Thu, 11 Jul 2019 00:38:11 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A4F8A8297B; Thu, 11 Jul 2019 00:38:10 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 78E011EE0F; Thu, 11 Jul 2019 00:38:10 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B0cAEd029873; Thu, 11 Jul 2019 00:38:10 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B0cA4m029872; Thu, 11 Jul 2019 00:38:10 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907110038.x6B0cA4m029872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 11 Jul 2019 00:38:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349902 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349902 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A4F8A8297B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 00:38:11 -0000 Author: cy Date: Thu Jul 11 00:38:10 2019 New Revision: 349902 URL: https://svnweb.freebsd.org/changeset/base/349902 Log: MFC r349842: Correct the description for the low port in the port compare struct. Adjust the high port description to match that of the low port description. Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil.h stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Directory Properties: stable/10/ (props changed) stable/12/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Thu Jul 11 00:22:10 2019 (r349901) +++ stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Thu Jul 11 00:38:10 2019 (r349902) @@ -584,8 +584,8 @@ typedef enum fr_ctypes_e { */ typedef struct frpcmp { fr_ctypes_t frp_cmp; /* data for port comparisons */ - u_32_t frp_port; /* top port for <> and >< */ - u_32_t frp_top; /* top port for <> and >< */ + u_32_t frp_port; /* low port for <> and >< */ + u_32_t frp_top; /* high port for <> and >< */ } frpcmp_t; From owner-svn-src-all@freebsd.org Thu Jul 11 00:38:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF51F15E799F; Thu, 11 Jul 2019 00:38:11 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7635082982; Thu, 11 Jul 2019 00:38:11 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 215C01EE11; Thu, 11 Jul 2019 00:38:11 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B0cBuW029885; Thu, 11 Jul 2019 00:38:11 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B0cBVK029884; Thu, 11 Jul 2019 00:38:11 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907110038.x6B0cBVK029884@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 11 Jul 2019 00:38:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r349902 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-10 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349902 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7635082982 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 00:38:12 -0000 Author: cy Date: Thu Jul 11 00:38:10 2019 New Revision: 349902 URL: https://svnweb.freebsd.org/changeset/base/349902 Log: MFC r349842: Correct the description for the low port in the port compare struct. Adjust the high port description to match that of the low port description. Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil.h Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil.h stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Directory Properties: stable/11/ (props changed) stable/12/ (props changed) Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_fil.h Thu Jul 11 00:22:10 2019 (r349901) +++ stable/10/sys/contrib/ipfilter/netinet/ip_fil.h Thu Jul 11 00:38:10 2019 (r349902) @@ -594,8 +594,8 @@ typedef enum fr_ctypes_e { */ typedef struct frpcmp { fr_ctypes_t frp_cmp; /* data for port comparisons */ - u_32_t frp_port; /* top port for <> and >< */ - u_32_t frp_top; /* top port for <> and >< */ + u_32_t frp_port; /* low port for <> and >< */ + u_32_t frp_top; /* high port for <> and >< */ } frpcmp_t; From owner-svn-src-all@freebsd.org Thu Jul 11 00:38:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5589915E7997; Thu, 11 Jul 2019 00:38:11 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EEC848297C; Thu, 11 Jul 2019 00:38:10 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C74241EE10; Thu, 11 Jul 2019 00:38:10 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B0cAFi029879; Thu, 11 Jul 2019 00:38:10 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B0cAgQ029878; Thu, 11 Jul 2019 00:38:10 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907110038.x6B0cAgQ029878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 11 Jul 2019 00:38:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349902 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349902 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EEC848297C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 00:38:11 -0000 Author: cy Date: Thu Jul 11 00:38:10 2019 New Revision: 349902 URL: https://svnweb.freebsd.org/changeset/base/349902 Log: MFC r349842: Correct the description for the low port in the port compare struct. Adjust the high port description to match that of the low port description. Modified: stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil.h stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Thu Jul 11 00:22:10 2019 (r349901) +++ stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Thu Jul 11 00:38:10 2019 (r349902) @@ -584,8 +584,8 @@ typedef enum fr_ctypes_e { */ typedef struct frpcmp { fr_ctypes_t frp_cmp; /* data for port comparisons */ - u_32_t frp_port; /* top port for <> and >< */ - u_32_t frp_top; /* top port for <> and >< */ + u_32_t frp_port; /* low port for <> and >< */ + u_32_t frp_top; /* high port for <> and >< */ } frpcmp_t; From owner-svn-src-all@freebsd.org Thu Jul 11 00:44:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EED0D15E7D59; Thu, 11 Jul 2019 00:44:10 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8A5E983166; Thu, 11 Jul 2019 00:44:10 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 621BA1EFB5; Thu, 11 Jul 2019 00:44:10 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B0iATd034799; Thu, 11 Jul 2019 00:44:10 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B0iAQq034798; Thu, 11 Jul 2019 00:44:10 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907110044.x6B0iAQq034798@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 11 Jul 2019 00:44:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349903 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349903 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8A5E983166 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 00:44:11 -0000 Author: cy Date: Thu Jul 11 00:44:09 2019 New Revision: 349903 URL: https://svnweb.freebsd.org/changeset/base/349903 Log: MFC 349843: Update frtuc struct comments. It not only defines TCP things we are interested in but also UDP. While at it document the source and destination port variables. Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil.h stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Directory Properties: stable/10/ (props changed) stable/12/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Thu Jul 11 00:38:10 2019 (r349902) +++ stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Thu Jul 11 00:44:09 2019 (r349903) @@ -590,14 +590,14 @@ typedef struct frpcmp { /* - * Structure containing all the relevant TCP things that can be checked in + * Structure containing all the relevant TCP/UDP things that can be checked in * a filter rule. */ typedef struct frtuc { u_char ftu_tcpfm; /* tcp flags mask */ u_char ftu_tcpf; /* tcp flags */ - frpcmp_t ftu_src; - frpcmp_t ftu_dst; + frpcmp_t ftu_src; /* source port */ + frpcmp_t ftu_dst; /* destination port */ } frtuc_t; #define ftu_scmp ftu_src.frp_cmp From owner-svn-src-all@freebsd.org Thu Jul 11 00:44:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5291E15E7D60; Thu, 11 Jul 2019 00:44:11 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DDFA383167; Thu, 11 Jul 2019 00:44:10 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B0FE11EFB6; Thu, 11 Jul 2019 00:44:10 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B0iAfG034805; Thu, 11 Jul 2019 00:44:10 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B0iAhW034804; Thu, 11 Jul 2019 00:44:10 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907110044.x6B0iAhW034804@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 11 Jul 2019 00:44:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349903 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349903 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DDFA383167 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 00:44:11 -0000 Author: cy Date: Thu Jul 11 00:44:09 2019 New Revision: 349903 URL: https://svnweb.freebsd.org/changeset/base/349903 Log: MFC 349843: Update frtuc struct comments. It not only defines TCP things we are interested in but also UDP. While at it document the source and destination port variables. Modified: stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil.h stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Thu Jul 11 00:38:10 2019 (r349902) +++ stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Thu Jul 11 00:44:09 2019 (r349903) @@ -590,14 +590,14 @@ typedef struct frpcmp { /* - * Structure containing all the relevant TCP things that can be checked in + * Structure containing all the relevant TCP/UDP things that can be checked in * a filter rule. */ typedef struct frtuc { u_char ftu_tcpfm; /* tcp flags mask */ u_char ftu_tcpf; /* tcp flags */ - frpcmp_t ftu_src; - frpcmp_t ftu_dst; + frpcmp_t ftu_src; /* source port */ + frpcmp_t ftu_dst; /* destination port */ } frtuc_t; #define ftu_scmp ftu_src.frp_cmp From owner-svn-src-all@freebsd.org Thu Jul 11 00:44:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 894AB15E7D64; Thu, 11 Jul 2019 00:44:11 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2A8EB83168; Thu, 11 Jul 2019 00:44:11 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C8871EFB7; Thu, 11 Jul 2019 00:44:11 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B0iATp034811; Thu, 11 Jul 2019 00:44:10 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B0iADa034810; Thu, 11 Jul 2019 00:44:10 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907110044.x6B0iADa034810@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 11 Jul 2019 00:44:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r349903 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-10 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349903 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2A8EB83168 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 00:44:11 -0000 Author: cy Date: Thu Jul 11 00:44:09 2019 New Revision: 349903 URL: https://svnweb.freebsd.org/changeset/base/349903 Log: MFC 349843: Update frtuc struct comments. It not only defines TCP things we are interested in but also UDP. While at it document the source and destination port variables. Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil.h Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil.h stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Directory Properties: stable/11/ (props changed) stable/12/ (props changed) Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_fil.h Thu Jul 11 00:38:10 2019 (r349902) +++ stable/10/sys/contrib/ipfilter/netinet/ip_fil.h Thu Jul 11 00:44:09 2019 (r349903) @@ -600,14 +600,14 @@ typedef struct frpcmp { /* - * Structure containing all the relevant TCP things that can be checked in + * Structure containing all the relevant TCP/UDP things that can be checked in * a filter rule. */ typedef struct frtuc { u_char ftu_tcpfm; /* tcp flags mask */ u_char ftu_tcpf; /* tcp flags */ - frpcmp_t ftu_src; - frpcmp_t ftu_dst; + frpcmp_t ftu_src; /* source port */ + frpcmp_t ftu_dst; /* destination port */ } frtuc_t; #define ftu_scmp ftu_src.frp_cmp From owner-svn-src-all@freebsd.org Thu Jul 11 01:41:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 236EC15E8F19; Thu, 11 Jul 2019 01:41:31 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BB39085004; Thu, 11 Jul 2019 01:41:30 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id AD21314767; Thu, 11 Jul 2019 01:41:30 +0000 (UTC) Date: Thu, 11 Jul 2019 01:41:30 +0000 From: Alexey Dokuchaev To: Warner Losh Cc: Shawn Webb , svn-src-head , svn-src-all , src-committers , Justin Hibbits , Philip Paeps Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet Message-ID: <20190711014130.GA23621@FreeBSD.org> References: <201907101742.x6AHg4os016752@repo.freebsd.org> <20190710195548.kdftfemj3icarcxo@mutt-hbsd> <20190710151944.0fd94ec3@titan.knownspace> <20190710202218.yc3lcd6tsql3zkyr@mutt-hbsd> <20190710222918.vj4creizlubdzgw3@mutt-hbsd> <20190710224341.i3rbhapmpdw6gkbd@mutt-hbsd> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) X-Rspamd-Queue-Id: BB39085004 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.90 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.90)[-0.898,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 01:41:31 -0000 On Wed, Jul 10, 2019 at 04:45:06PM -0600, Warner Losh wrote: > On Wed, Jul 10, 2019 at 4:43 PM Shawn Webb > > ... > > Because the existing code already used malloc + snprintf. And this is > > contrib/telnet/telnet, which arguably should be `rm -rf`ed. ;) > > > > The bike shed is now glow-in-the-dark neon green. > > I'm not in the rm-rf telnet camp... I use it far too often to connect > to a port with good terminal support to want to do that... Seconded. Having telnet(1) in the base is so fucking convenient compared to GNU/Linux or Windoze where they've removed it from the default install. ./danfe From owner-svn-src-all@freebsd.org Thu Jul 11 01:47:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD8C215E91AD; Thu, 11 Jul 2019 01:47:29 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ECB3854F4; Thu, 11 Jul 2019 01:47:29 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 1A6C214A3F; Thu, 11 Jul 2019 01:47:29 +0000 (UTC) Date: Thu, 11 Jul 2019 01:47:29 +0000 From: Alexey Dokuchaev To: Philip Paeps Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet Message-ID: <20190711014729.GB23621@FreeBSD.org> References: <201907101742.x6AHg4os016752@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201907101742.x6AHg4os016752@repo.freebsd.org> User-Agent: Mutt/1.11.4 (2019-03-13) X-Rspamd-Queue-Id: 4ECB3854F4 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.90 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.90)[-0.900,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 01:47:29 -0000 On Wed, Jul 10, 2019 at 05:42:04PM +0000, Philip Paeps wrote: > New Revision: 349890 > URL: https://svnweb.freebsd.org/changeset/base/349890 > > Log: > telnet: fix a couple of snprintf() buffer overflows > > Modified: head/contrib/telnet/telnet/commands.c > @@ -1655,10 +1655,11 @@ env_init(void) > char hbuf[256+1]; > char *cp2 = strchr((char *)ep->value, ':'); > > - gethostname(hbuf, 256); > - hbuf[256] = '\0'; > - cp = (char *)malloc(strlen(hbuf) + strlen(cp2) + 1); > - sprintf((char *)cp, "%s%s", hbuf, cp2); Would it make sense to add something like __attribute__ ((deprecated)) to those unsafe functions like gets(), sprintf(), etc.? Or it would cause too much PITA? ./danfe From owner-svn-src-all@freebsd.org Thu Jul 11 02:06:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5845415E9639; Thu, 11 Jul 2019 02:06:51 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id C8DA885F85; Thu, 11 Jul 2019 02:06:49 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id lOTuhhY8nSrVclOTvhRbDQ; Wed, 10 Jul 2019 20:06:47 -0600 X-Authority-Analysis: v=2.3 cv=L5ZjvNb8 c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=0o9FgrsRnhwA:10 a=6I5d2MoRAAAA:8 a=2QSLavsyAAAA:8 a=YxBL1-UpAAAA:8 a=3YDKmzK5xmxd0qjhx50A:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=9H_80fVQ3bbXSWzY4Kdq:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy8 [10.2.2.6]) by spqr.komquats.com (Postfix) with ESMTPS id 0BD931188; Wed, 10 Jul 2019 19:06:44 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id x6B26PJj013176; Wed, 10 Jul 2019 19:06:25 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id x6B26PUu013164; Wed, 10 Jul 2019 19:06:25 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201907110206.x6B26PUu013164@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Alexey Dokuchaev cc: Philip Paeps , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet In-Reply-To: Message from Alexey Dokuchaev of "Thu, 11 Jul 2019 01:47:29 -0000." <20190711014729.GB23621@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 10 Jul 2019 19:06:25 -0700 X-CMAE-Envelope: MS4wfLYjaVx0R6CKiaY/yEwQrWMtfnAGKDFQTXUiWTJj3iIDlgCIq2FpGVrDM166ZfrioFEQERhdMy7WuidmEYp2c38hHbbASkadViEJW6QzcN3LJ4HqdThn wPs7yH/OyKp0r/NxPKD14JDeT6BxZmtFZ5Vyn8Db4jK7AGoC0xrAoBdHwQbyezPHcxfCAVq8cT47Kz2yXsV0wJaAA0s+v3ZCn4+MMQodux91gGnUo9wnJBS7 jhNtNu6H6yAwzdlzqC1Jif9E3AgcDCcV9e9f1jdisbz5J+Jm/amwT7PDBe65bvP9Aa4pOv/CTTlhcYiMokL43A== X-Rspamd-Queue-Id: C8DA885F85 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-4.80 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; REPLYTO_EQ_FROM(0.00)[]; IP_SCORE(-2.38)[ip: (-6.00), ipnet: 64.59.128.0/20(-3.26), asn: 6327(-2.53), country: CA(-0.09)]; MX_GOOD(-0.01)[cached: spqr.komquats.com]; NEURAL_HAM_SHORT(-0.82)[-0.818,0]; RCVD_IN_DNSWL_NONE(0.00)[139.136.59.64.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_SPF_NA(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.zen.spamhaus.org : 127.0.0.11]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_TLS_LAST(0.00)[]; FROM_EQ_ENVFROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 02:06:51 -0000 In message <20190711014729.GB23621@FreeBSD.org>, Alexey Dokuchaev writes: > On Wed, Jul 10, 2019 at 05:42:04PM +0000, Philip Paeps wrote: > > New Revision: 349890 > > URL: https://svnweb.freebsd.org/changeset/base/349890 > > > > Log: > > telnet: fix a couple of snprintf() buffer overflows > > > > Modified: head/contrib/telnet/telnet/commands.c > > @@ -1655,10 +1655,11 @@ env_init(void) > > char hbuf[256+1]; > > char *cp2 = strchr((char *)ep->value, ':'); > > > > - gethostname(hbuf, 256); > > - hbuf[256] = '\0'; > > - cp = (char *)malloc(strlen(hbuf) + strlen(cp2) + 1); > > - sprintf((char *)cp, "%s%s", hbuf, cp2); > > Would it make sense to add something like __attribute__ ((deprecated)) > to those unsafe functions like gets(), sprintf(), etc.? Or it would > cause too much PITA? sprintf() is not deprecated (https://en.cppreference.com/w/c/io/fprintf) . gets() is removed in C11 (https://en.cppreference.com/w/c/io/gets), replaced by gets_s(). We already have gets_s(). We need printf_s(), sprintf_s() and snprintf_s(). -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Thu Jul 11 02:15:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4557115E9839; Thu, 11 Jul 2019 02:15:51 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D9F4886472; Thu, 11 Jul 2019 02:15:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2EFB1FEEA; Thu, 11 Jul 2019 02:15:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B2FoKk082300; Thu, 11 Jul 2019 02:15:50 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B2FofK082299; Thu, 11 Jul 2019 02:15:50 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907110215.x6B2FofK082299@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 11 Jul 2019 02:15:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349904 - head X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 349904 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D9F4886472 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 02:15:51 -0000 Author: markj Date: Thu Jul 11 02:15:50 2019 New Revision: 349904 URL: https://svnweb.freebsd.org/changeset/base/349904 Log: Add vm_page_hold.9 to ObsoleteFiles.inc. Add a missing .gz suffix to pwm.9 while here. Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Thu Jul 11 00:44:09 2019 (r349903) +++ head/ObsoleteFiles.inc Thu Jul 11 02:15:50 2019 (r349904) @@ -38,10 +38,12 @@ # xargs -n1 | sort | uniq -d; # done +# 20190708: vm_page_hold() and _unhold() removed +OLD_FILES+=usr/share/man/man9/vm_page_hold.9.gz # 20190618: sys/capability.h removed (sys/capsicum.h is the one to use) OLD_FILES+=usr/include/sys/capability.h # 20190615: sys/pwm.h renamed to dev/pwmc.h and pwm(9) removed -OLD_FILES+=usr/include/sys/pwm.h usr/share/man/man9/pwm.9 +OLD_FILES+=usr/include/sys/pwm.h usr/share/man/man9/pwm.9.gz # 20190612: new clang import which bumps version from 8.0.0 to 8.0.1. OLD_FILES+=usr/lib/clang/8.0.0/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/8.0.0/include/sanitizer/asan_interface.h From owner-svn-src-all@freebsd.org Thu Jul 11 02:43:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E718915E9E8F; Thu, 11 Jul 2019 02:43:24 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7ECD087185; Thu, 11 Jul 2019 02:43:24 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6AEE2203CB; Thu, 11 Jul 2019 02:43:24 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B2hOHL097144; Thu, 11 Jul 2019 02:43:24 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B2hOKW097142; Thu, 11 Jul 2019 02:43:24 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201907110243.x6B2hOKW097142@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Thu, 11 Jul 2019 02:43:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349905 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 349905 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7ECD087185 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 02:43:25 -0000 Author: alc Date: Thu Jul 11 02:43:23 2019 New Revision: 349905 URL: https://svnweb.freebsd.org/changeset/base/349905 Log: According to Section D5.10.3 "Maintenance requirements on changing System register values" of the architecture manual, an isb instruction should be executed after updating ttbr0_el1 and before invalidating the TLB. The lack of this instruction in pmap_activate() appears to be the reason why andrew@ and I have observed an unexpected TLB entry for an invalid PTE on entry to pmap_enter_quick_locked(). Thus, we should now be able to revert the workaround committed in r349442. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D20904 Modified: head/sys/arm64/arm64/efirt_machdep.c head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/efirt_machdep.c ============================================================================== --- head/sys/arm64/arm64/efirt_machdep.c Thu Jul 11 02:15:50 2019 (r349904) +++ head/sys/arm64/arm64/efirt_machdep.c Thu Jul 11 02:43:23 2019 (r349905) @@ -239,6 +239,7 @@ efi_arch_enter(void) __asm __volatile( "msr ttbr0_el1, %0 \n" + "isb \n" "dsb ishst \n" "tlbi vmalle1is \n" "dsb ish \n" @@ -266,6 +267,7 @@ efi_arch_leave(void) td = curthread; __asm __volatile( "msr ttbr0_el1, %0 \n" + "isb \n" "dsb ishst \n" "tlbi vmalle1is \n" "dsb ish \n" Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Thu Jul 11 02:15:50 2019 (r349904) +++ head/sys/arm64/arm64/pmap.c Thu Jul 11 02:43:23 2019 (r349905) @@ -5484,8 +5484,10 @@ pmap_activate(struct thread *td) critical_enter(); pmap = vmspace_pmap(td->td_proc->p_vmspace); td->td_proc->p_md.md_l0addr = vtophys(pmap->pm_l0); - __asm __volatile("msr ttbr0_el1, %0" : : - "r"(td->td_proc->p_md.md_l0addr)); + __asm __volatile( + "msr ttbr0_el1, %0 \n" + "isb \n" + : : "r"(td->td_proc->p_md.md_l0addr)); pmap_invalidate_all(pmap); critical_exit(); } From owner-svn-src-all@freebsd.org Thu Jul 11 03:29:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 334B815EAD3E; Thu, 11 Jul 2019 03:29:26 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BC57688DDE; Thu, 11 Jul 2019 03:29:25 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 90A4D20B5B; Thu, 11 Jul 2019 03:29:25 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B3TPB2019036; Thu, 11 Jul 2019 03:29:25 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B3TPvv019035; Thu, 11 Jul 2019 03:29:25 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201907110329.x6B3TPvv019035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Thu, 11 Jul 2019 03:29:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349906 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 349906 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BC57688DDE X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 03:29:26 -0000 Author: jhibbits Date: Thu Jul 11 03:29:25 2019 New Revision: 349906 URL: https://svnweb.freebsd.org/changeset/base/349906 Log: powerpc: Only worry about the lower 32 bits of SP in a 32-bit process Summary: Running a 32-bit process on a 64-bit POWER CPU may still use all 64-bits in calculations, while ignoring the upper 32 bits for addressing storage. It so happens that some processes end up with r1 (SP) having bit 31 set in some cases (33-bit address). Writing out to this 33-bit address obviosly fails. Since the CPU ignores the upper bits, we should as well. sendsig() and cpu_fetch_syscall_args() appear to be the only functions that actually rely on userspace register values for copy in/out, and cpu_fetch_syscall_args() doesn't seem to be bitten in practice yet. Reviewed By: luporl Differential Revision: https://reviews.freebsd.org/D20896 Modified: head/sys/powerpc/powerpc/exec_machdep.c Modified: head/sys/powerpc/powerpc/exec_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/exec_machdep.c Thu Jul 11 02:43:23 2019 (r349905) +++ head/sys/powerpc/powerpc/exec_machdep.c Thu Jul 11 03:29:25 2019 (r349906) @@ -144,6 +144,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask #endif size_t sfpsize; caddr_t sfp, usfp; + register_t sp; int oonstack, rndfsize; int sig; int code; @@ -155,7 +156,6 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask psp = p->p_sigacts; mtx_assert(&psp->ps_mtx, MA_OWNED); tf = td->td_frame; - oonstack = sigonstack(tf->fixreg[1]); /* * Fill siginfo structure. @@ -173,6 +173,8 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask sfp = (caddr_t)&sf32; sfpsize = sizeof(sf32); rndfsize = roundup(sizeof(sf32), 16); + sp = (uint32_t)tf->fixreg[1]; + oonstack = sigonstack(sp); /* * Save user context @@ -203,6 +205,8 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask #else rndfsize = roundup(sizeof(sf), 16); #endif + sp = tf->fixreg[1]; + oonstack = sigonstack(sp); /* * Save user context @@ -232,7 +236,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask usfp = (void *)(((uintptr_t)td->td_sigstk.ss_sp + td->td_sigstk.ss_size - rndfsize) & ~0xFul); } else { - usfp = (void *)((tf->fixreg[1] - rndfsize) & ~0xFul); + usfp = (void *)((sp - rndfsize) & ~0xFul); } /* From owner-svn-src-all@freebsd.org Thu Jul 11 04:38:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2261F15EBCA1; Thu, 11 Jul 2019 04:38:34 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A9BE98B04A; Thu, 11 Jul 2019 04:38:33 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 82BA821768; Thu, 11 Jul 2019 04:38:33 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B4cXmt054796; Thu, 11 Jul 2019 04:38:33 GMT (envelope-from rrs@FreeBSD.org) Received: (from rrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B4cXX1054795; Thu, 11 Jul 2019 04:38:33 GMT (envelope-from rrs@FreeBSD.org) Message-Id: <201907110438.x6B4cXX1054795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rrs set sender to rrs@FreeBSD.org using -f From: Randall Stewart Date: Thu, 11 Jul 2019 04:38:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349907 - head/sys/netinet/tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: rrs X-SVN-Commit-Paths: head/sys/netinet/tcp_stacks X-SVN-Commit-Revision: 349907 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A9BE98B04A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.932,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 04:38:34 -0000 Author: rrs Date: Thu Jul 11 04:38:33 2019 New Revision: 349907 URL: https://svnweb.freebsd.org/changeset/base/349907 Log: Update copyright per JBH's suggestions.. thanks. Modified: head/sys/netinet/tcp_stacks/rack.c Modified: head/sys/netinet/tcp_stacks/rack.c ============================================================================== --- head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 03:29:25 2019 (r349906) +++ head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 04:38:33 2019 (r349907) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 + * Copyright (c) 2016-2019 * Netflix Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -8537,10 +8537,10 @@ out: * retransmit. In persist state, just set snd_max. */ if (error == 0) { -/* if (TCPS_HAVEESTABLISHED(tp->t_state) && + if (TCPS_HAVEESTABLISHED(tp->t_state) && (tp->t_flags & TF_SACK_PERMIT) && tp->rcv_numsacks > 0) - tcp_clean_dsack_blocks(tp);*/ + tcp_clean_dsack_blocks(tp); if (len == 0) counter_u64_add(rack_out_size[TCP_MSS_ACCT_SNDACK], 1); else if (len == 1) { From owner-svn-src-all@freebsd.org Thu Jul 11 04:40:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED6B015EBDB8; Thu, 11 Jul 2019 04:40:58 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9411F8B2C7; Thu, 11 Jul 2019 04:40:58 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6EBCF2178D; Thu, 11 Jul 2019 04:40:58 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B4ewEo056801; Thu, 11 Jul 2019 04:40:58 GMT (envelope-from rrs@FreeBSD.org) Received: (from rrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B4ewJH056800; Thu, 11 Jul 2019 04:40:58 GMT (envelope-from rrs@FreeBSD.org) Message-Id: <201907110440.x6B4ewJH056800@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rrs set sender to rrs@FreeBSD.org using -f From: Randall Stewart Date: Thu, 11 Jul 2019 04:40:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349908 - head/sys/netinet/tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: rrs X-SVN-Commit-Paths: head/sys/netinet/tcp_stacks X-SVN-Commit-Revision: 349908 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9411F8B2C7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.932,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 04:40:59 -0000 Author: rrs Date: Thu Jul 11 04:40:58 2019 New Revision: 349908 URL: https://svnweb.freebsd.org/changeset/base/349908 Log: Update to jhb's other suggestion, use #error when we are missing HPTS. Modified: head/sys/netinet/tcp_stacks/rack.c Modified: head/sys/netinet/tcp_stacks/rack.c ============================================================================== --- head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 04:38:33 2019 (r349907) +++ head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 04:40:58 2019 (r349908) @@ -129,7 +129,7 @@ struct sysctl_ctx_list rack_sysctl_ctx; struct sysctl_oid *rack_sysctl_root; #ifndef TCPHPTS -fatal error missing option TCPHSTS in the build; +#error "fatal error missing option TCPHSTS in the build" #endif #define CUM_ACKED 1 From owner-svn-src-all@freebsd.org Thu Jul 11 04:48:43 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B57F615EC182 for ; Thu, 11 Jul 2019 04:48:43 +0000 (UTC) (envelope-from rrs@netflix.com) Received: from mail-vs1-xe43.google.com (mail-vs1-xe43.google.com [IPv6:2607:f8b0:4864:20::e43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 42D458B8AD for ; Thu, 11 Jul 2019 04:48:43 +0000 (UTC) (envelope-from rrs@netflix.com) Received: by mail-vs1-xe43.google.com with SMTP id h28so3044770vsl.12 for ; Wed, 10 Jul 2019 21:48:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=DsJqhKklihTqGHjZRjvsZMbn6SVYL6vj8sP7JCbsRb8=; b=MyX7Dmczl08ivld2hdylDWYRbsKKGNyGWJkefq9p+RPmdwmC4Pb9QNG1MRszcZOzxS 5SAkfcaOLSjff0G82UyhpDfBdLmiEA/D8zj5fucDcwkAO6S9dAtI9eyTA5KN9rdA2SGo NyRveBri1LCXdKxrjb6qvlbo/1Uy1xNw6/XI0DOFbkYRFJYVFlCRsC2IaussO6NldgeD wlIXysVoEMFGYLF6dSVwnCtIBmoUFDx5kN8E2n4RNRnCeQfabYYTGVm0fd4X0payPiuJ Bhg05gPTMOs3HpECxviA0enYYl7/m7UhZeWfwD0aETr0BVXmEN4gNo6Ms9ERDQtzibPW Wd6A== X-Gm-Message-State: APjAAAXSBwTHo5LXk2MnQbz37MjHOS2TRPXLgz5cX/MW1TO/dodSWGvi MZ194MpnfaLnKNo0Itom8amJsQ== X-Google-Smtp-Source: APXvYqzSrgPMrmoWZpLGhZTl7L9fLdPBP29faGVRCk/+HjlGDVe58EKmrse4RdYrqF1HdbZJa2WCwg== X-Received: by 2002:a67:f116:: with SMTP id n22mr1149424vsk.73.1562820521300; Wed, 10 Jul 2019 21:48:41 -0700 (PDT) Received: from ?IPv6:2607:fb10:7061:7fd::15b5? ([2607:fb10:7061:7fd::15b5]) by smtp.gmail.com with ESMTPSA id i137sm1888993vkd.24.2019.07.10.21.48.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jul 2019 21:48:40 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: svn commit: r349893 - in head/sys: modules/tcp/rack netinet netinet/tcp_stacks sys From: Randall Stewart In-Reply-To: <4cdc824e-7e71-731d-50d4-c3f6231f9858@FreeBSD.org> Date: Thu, 11 Jul 2019 00:48:38 -0400 Cc: Randall Ray Stewart , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <7695E2FC-406D-46CE-88F2-0690B9AAA36D@netflix.com> References: <201907102040.x6AKeern006731@repo.freebsd.org> <4cdc824e-7e71-731d-50d4-c3f6231f9858@FreeBSD.org> To: John Baldwin X-Mailer: Apple Mail (2.3445.9.1) X-Rspamd-Queue-Id: 42D458B8AD X-Spamd-Bar: ------ X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.952,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 04:48:44 -0000 John: Thanks for the suggestions.. I have committed changes to the two nits. As to M_PROTO1, I see that in the NF world we have removed M_PROTO12 and moved the M_PROTO=E2=80=99s up 1 i.e. M_PROTO1 =3D=3D = 0x2000 So for now it is safe, since the M_TSTMP_LRO is not yet used.. but in my up and coming commits I will have to address this i.e. either do the same thing or just make it use M_PROTO12. There are a couple of places M_PROTO1 is used on the receive path so that would not work there :o After I get the DSACK fixes in my next change to get BBR in will be the LRO work=E2=80=A6 So maybe I should just settle on using M_PROTO12 for that=20 what do you think? R > On Jul 10, 2019, at 7:28 PM, John Baldwin wrote: >=20 > On 7/10/19 1:40 PM, Randall Stewart wrote: >> Author: rrs >> Date: Wed Jul 10 20:40:39 2019 >> New Revision: 349893 >> URL: https://svnweb.freebsd.org/changeset/base/349893 >>=20 >> Log: >> This commit updates rack to what is basically being used at NF as >> well as sets in some of the groundwork for committing BBR. The >> hpts system is updated as well as some other needed utilities >> for the entrance of BBR. This is actually part 1 of 3 more >> needed commits which will finally complete with BBRv1 being >> added as a new tcp stack. >>=20 >> Sponsored by: Netflix Inc. >> Differential Revision: https://reviews.freebsd.org/D20834 >=20 > Is it safe for M_TSTMP_LRO to conflict with M_PROTO1? >=20 > Also, it seems you changed the copyright range on rack.c from > 2016-2019 to just 2016 which I suspect is an accident. >=20 > I would suggest using #error here: >=20 > #ifndef TCPHPTS > fatal error missing option TCPHSTS in the build; > #endif >=20 > --=20 > John Baldwin ------ Randall Stewart rrs@netflix.com From owner-svn-src-all@freebsd.org Thu Jul 11 06:22:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 096B815ED485; Thu, 11 Jul 2019 06:22:16 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A0BD38E697; Thu, 11 Jul 2019 06:22:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 79B8E22ACA; Thu, 11 Jul 2019 06:22:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6B6MFgn008562; Thu, 11 Jul 2019 06:22:15 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6B6MF5S008561; Thu, 11 Jul 2019 06:22:15 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907110622.x6B6MF5S008561@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 11 Jul 2019 06:22:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349909 - head/sys/dev/mpr X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/mpr X-SVN-Commit-Revision: 349909 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A0BD38E697 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.952,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 06:22:16 -0000 Author: imp Date: Thu Jul 11 06:22:15 2019 New Revision: 349909 URL: https://svnweb.freebsd.org/changeset/base/349909 Log: More fully implement the state machine. When a command is finished running, we must transition it from INQUEUE to busy state. We were failing to do that, so we hit a panic when the commands were freed. This only affects mpr, mps already did simmilar things. Now both the polling and interrupt paths properly set BUSY as appropriate. Modified: head/sys/dev/mpr/mpr.c Modified: head/sys/dev/mpr/mpr.c ============================================================================== --- head/sys/dev/mpr/mpr.c Thu Jul 11 04:40:58 2019 (r349908) +++ head/sys/dev/mpr/mpr.c Thu Jul 11 06:22:15 2019 (r349909) @@ -2367,6 +2367,7 @@ mpr_complete_command(struct mpr_softc *sc, struct mpr_ return; } + cm->cm_state = MPR_CM_STATE_BUSY; if (cm->cm_flags & MPR_CM_FLAGS_POLLED) cm->cm_flags |= MPR_CM_FLAGS_COMPLETE; @@ -3879,7 +3880,7 @@ mpr_request_polled(struct mpr_softc *sc, struct mpr_co break; } } - + cm->cm_state = MPR_CM_STATE_BUSY; if (error) { mpr_dprint(sc, MPR_FAULT, "Calling Reinit from %s\n", __func__); rc = mpr_reinit(sc); From owner-svn-src-all@freebsd.org Thu Jul 11 07:57:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D14B215CA61A for ; Thu, 11 Jul 2019 07:57:55 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 749DA6B43B for ; Thu, 11 Jul 2019 07:57:55 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: by mail-yb1-xb36.google.com with SMTP id c202so548404ybf.0 for ; Thu, 11 Jul 2019 00:57:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UHis9ExlhtJ8Qh1gem2LPNGXL4WxSi65eb6HoqemXFk=; b=fvhf4rOiqMBbbTnJHP3uQ2QDzVIW+A59VRvwfOOxnaLpOKklR+18EKBAOxc0pDf2F4 V5KN7zmHdls8PMDk/f06hX+fPHfQITrgEWTEdnJMly6Gd4KQKbYMqVH4oDZu+AXscuWC fIADMDZVKYsYcYgKVh22KwWPcKzvP0BdYNOwI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UHis9ExlhtJ8Qh1gem2LPNGXL4WxSi65eb6HoqemXFk=; b=LyUDTPUrr1NwN11wh/976+7gSfgRYrHLtQRMjgUYBzCsivUPbd4BRrW1dXrX2FqB7O CenSzqLZBSFD2YLlLUkn3VZ5pQ7GtRuKTjIP9XRLpbjFCW58fxWEhoWwvhg9YxR0626w GwVI+PUXNsZikjtQSNs9TVW4xUxNUr+M39GPcc4uMHngH9kV8cH91vP1Tifa3zPQy90N XEYbmMEie9y+uw91ZqpprDKsxw+jxZwGqcLmR7NvsVS5X0c6kSaf6pKMnL+oFi/Z6Ubv dbkGa+iEvZF5nOvX8GxGZhXfkQ9eRrFtazvM/f886OI3KGEKMFAVJVy3jSTPanZSPAzl UH/Q== X-Gm-Message-State: APjAAAWEMZTcXRK+FO1iDScXJk+0Nkk6UW9o0iJxsUvmDVnYX7+CsYXs BtVwgnscA+NI9WiG6uxbn9HsH5xAkdELdiQuKzVa0d40 X-Google-Smtp-Source: APXvYqzfOr8fA3VGDhSHsLPrqc/voU0Ktag2aoy2qVEViny9LGIblkXQTUuuyexamYeBCIyAc7N1Ri59lOI7dk7AYxE= X-Received: by 2002:a25:99c2:: with SMTP id q2mr1309536ybo.133.1562831874119; Thu, 11 Jul 2019 00:57:54 -0700 (PDT) MIME-Version: 1.0 References: <201907101742.x6AHg4os016752@repo.freebsd.org> In-Reply-To: <201907101742.x6AHg4os016752@repo.freebsd.org> From: Eitan Adler Date: Thu, 11 Jul 2019 00:57:27 -0700 Message-ID: Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet To: Philip Paeps Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 749DA6B43B X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.93 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.929,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 07:57:56 -0000 On Wed, 10 Jul 2019 at 10:42, Philip Paeps wrote: > Author: philip > Date: Wed Jul 10 17:42:04 2019 > New Revision: 349890 > URL: https://svnweb.freebsd.org/changeset/base/349890 > > Log: > telnet: fix a couple of snprintf() buffer overflows > > Obtained from: Juniper Networks > MFC after: 1 week > > Modified: > head/contrib/telnet/telnet/commands.c > head/contrib/telnet/telnet/telnet.c > head/contrib/telnet/telnet/utilities.c > > Modified: head/contrib/telnet/telnet/commands.c > > ============================================================================== > --- head/contrib/telnet/telnet/commands.c Wed Jul 10 17:21:59 2019 > (r349889) > +++ head/contrib/telnet/telnet/commands.c Wed Jul 10 17:42:04 2019 > (r349890) > @@ -1655,10 +1655,11 @@ env_init(void) > char hbuf[256+1]; > char *cp2 = strchr((char *)ep->value, ':'); > > - gethostname(hbuf, 256); > - hbuf[256] = '\0'; > - cp = (char *)malloc(strlen(hbuf) + strlen(cp2) + 1); > - sprintf((char *)cp, "%s%s", hbuf, cp2); > + gethostname(hbuf, sizeof(hbuf)); > + hbuf[sizeof(hbuf)-1] = '\0'; > + unsigned int buflen = strlen(hbuf) + strlen(cp2) + 1; > Shouldn't this be `size_t` ? > + cp = (char *)malloc(sizeof(char)*buflen); > sizeof(char) is always 1 and is odd to see. Don't cast the return value of `malloc`. > + snprintf((char *)cp, buflen, "%s%s", hbuf, cp2); > Is the cast of `cp` here required? Also couldn't this be replaced with asprintf? free(ep->value); > ep->value = (unsigned char *)cp; > } > > Modified: head/contrib/telnet/telnet/telnet.c > > ============================================================================== > --- head/contrib/telnet/telnet/telnet.c Wed Jul 10 17:21:59 2019 > (r349889) > +++ head/contrib/telnet/telnet/telnet.c Wed Jul 10 17:42:04 2019 > (r349890) > @@ -785,7 +785,7 @@ suboption(void) > name = gettermname(); > len = strlen(name) + 4 + 2; > if (len < NETROOM()) { > - sprintf(temp, "%c%c%c%c%s%c%c", IAC, SB, TELOPT_TTYPE, > + snprintf(temp, sizeof(temp), "%c%c%c%c%s%c%c", IAC, SB, > TELOPT_TTYPE, > TELQUAL_IS, name, IAC, SE); > ring_supply_data(&netoring, temp, len); > printsub('>', &temp[2], len-2); > @@ -807,7 +807,7 @@ suboption(void) > > TerminalSpeeds(&ispeed, &ospeed); > > - sprintf((char *)temp, "%c%c%c%c%ld,%ld%c%c", IAC, SB, > TELOPT_TSPEED, > + snprintf((char *)temp, sizeof(temp), "%c%c%c%c%ld,%ld%c%c", > IAC, SB, TELOPT_TSPEED, > TELQUAL_IS, ospeed, ispeed, IAC, SE); > len = strlen((char *)temp+4) + 4; /* temp[3] is 0 ... */ > > > Modified: head/contrib/telnet/telnet/utilities.c > > ============================================================================== > --- head/contrib/telnet/telnet/utilities.c Wed Jul 10 17:21:59 2019 > (r349889) > +++ head/contrib/telnet/telnet/utilities.c Wed Jul 10 17:42:04 2019 > (r349890) > @@ -629,7 +629,7 @@ printsub(char direction, unsigned char *pointer, int l > } > { > char tbuf[64]; > - sprintf(tbuf, "%s%s%s%s%s", > + snprintf(tbuf, sizeof(tbuf), "%s%s%s%s%s", > pointer[2]&MODE_EDIT ? "|EDIT" : "", > pointer[2]&MODE_TRAPSIG ? "|TRAPSIG" : "", > pointer[2]&MODE_SOFT_TAB ? "|SOFT_TAB" : "", > > -- Eitan Adler From owner-svn-src-all@freebsd.org Thu Jul 11 08:02:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B2D415CAC96; Thu, 11 Jul 2019 08:02:20 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D4E286BA81; Thu, 11 Jul 2019 08:02:19 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg1-x52e.google.com with SMTP id w10so2537711pgj.7; Thu, 11 Jul 2019 01:02:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=2L+wyxSDhU1swICrUvbYRgi18tHZL7GALfpWn6mo/eo=; b=DAN4MPNQrW1/Eb3xcrV2i0petOVsM8kk6B2xhmvSBD45OxD4emWoYuYW744bHMQU47 ODp8mg01KvJTBds/su342jrB20L2c4KAZbdelKBkNpI5vg9xEG4iNIRrYNwtvePbwLi3 b8rwzLXbYBXXhkHa3tOcPLhijO7daN301NKGJCoZg4IxXzCZvaR6z3qVAkVJFiQKvvcR EblYjKfbv7mKbpbUMhydU1zBFTE2JGKcAqz0d+6XwiGIF3qtO/mXZeN7dsZQCSaLIncY Ym21QoYH3sqebnZU9Tv2hcAn8k5u+4m4byNxLJt4eEVjeeVfq+TEpwStP5F4KhheuxPV hi4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=2L+wyxSDhU1swICrUvbYRgi18tHZL7GALfpWn6mo/eo=; b=I9BIbeiWWO+2Cre8+I+9zLLuc1hLlGXNvSum7X4oE7F1KHAEzTPpsFAOKbT37v3/kX PefP8HDLJuitO+OwhRGLsPSylAsiCtJZJwDY7Z+JuVaPXjzxJ4bWgVewDJlOEA8e+s4A icaIBBXDs6eesBO1Ls1LUCVG/VlhEH3mVpqUmdONoZnvCoa1ly93O9fReLBt1h3zjWc7 twc5XF62W+Y4mrL7EJGy/KEa0SsUlQkGItfy0I21WgeQ3FGePAvEvm2l+PJszPMRmB+7 oXvRyfS+55picFfCJ1OPeU4IO3eG8Kj2JWBWUlYElrnEbtEVNrMT/YmgpKNLaJAcI02h Papg== X-Gm-Message-State: APjAAAUrqw5aGYHsr2zUzavYNHFVm8gboTEeXWA5C1Rtq6HZCbuxx4Zy gRqGkzAjSqKm+waiTUFJOaKiDQYqZq4= X-Google-Smtp-Source: APXvYqy2cj76h5c3hxFHlOnIss9JC47oxYdjQmzcPyBfBU973MaF+lK8OW+zX5m5ZaHQj2FpSlSqzw== X-Received: by 2002:a63:6981:: with SMTP id e123mr2970713pgc.136.1562832137234; Thu, 11 Jul 2019 01:02:17 -0700 (PDT) Received: from [192.168.20.7] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id j21sm4257444pfh.86.2019.07.11.01.02.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jul 2019 01:02:16 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r349896 - head/contrib/telnet/telnet From: Enji Cooper In-Reply-To: <201907102236.x6AMaFLI067550@repo.freebsd.org> Date: Thu, 11 Jul 2019 01:02:15 -0700 Cc: src-committers , svn-src-all , svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <6031EBD8-84D7-46D4-A3E5-D78427D084B1@gmail.com> References: <201907102236.x6AMaFLI067550@repo.freebsd.org> To: Philip Paeps X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: D4E286BA81 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.92 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.92)[-0.922,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 08:02:20 -0000 > On Jul 10, 2019, at 3:36 PM, Philip Paeps wrote: >=20 > Author: philip > Date: Wed Jul 10 22:36:14 2019 > New Revision: 349896 > URL: https://svnweb.freebsd.org/changeset/base/349896 >=20 > Log: > telnet: fix minor style violation >=20 > While here also fix a very unlikely NULL pointer dereference. >=20 > Submitted by: Shawn Webb >=20 > Modified: > head/contrib/telnet/telnet/commands.c >=20 > Modified: head/contrib/telnet/telnet/commands.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/contrib/telnet/telnet/commands.c Wed Jul 10 22:23:59 2019 = (r349895) > +++ head/contrib/telnet/telnet/commands.c Wed Jul 10 22:36:14 2019 = (r349896) > @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); > #include > #include >=20 > +#include > #include > #include > #include > @@ -1654,11 +1655,13 @@ env_init(void) > || (strncmp((char *)ep->value, "unix:", 5) =3D=3D 0))) { > char hbuf[256+1]; > char *cp2 =3D strchr((char *)ep->value, ':'); > + size_t buflen; >=20 > gethostname(hbuf, sizeof(hbuf)); > hbuf[sizeof(hbuf)-1] =3D '\0'; > - unsigned int buflen =3D strlen(hbuf) + strlen(cp2) + = 1; > + buflen =3D strlen(hbuf) + strlen(cp2) + 1; > cp =3D (char *)malloc(sizeof(char)*buflen); > + assert(cp !=3D NULL); This will unfortunately still segfault if assert is compiled out of the = system as a no-op (-DNDEBUG). I genuinely think using asprintf instead is the way to go, as Eitan and = Warner brought up, since it reduces complexity in the program. Thank you, -Enji= From owner-svn-src-all@freebsd.org Thu Jul 11 08:38:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2994215CB99B; Thu, 11 Jul 2019 08:38:01 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9EDE76CD39; Thu, 11 Jul 2019 08:38:00 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf1-x42d.google.com with SMTP id j2so2413676pfe.6; Thu, 11 Jul 2019 01:38:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=3UBZ/7kHrc8s5iB6X/AAff4ovemHn3/8xhPdX8yVFCc=; b=YlfYSiArDe50XgI/QwABeJlNLmIYfho/EB0nsvg1wLWJrKsURLdiYWq5gACT7CV24j M/gGLbMh2N1Tt89IDzQfULny8TRfXa+cjQM49DO/60Ms+PJFrLv98mla6pgoyai0Wpul WtqTRkioMPTCPwP5apY1bQBTBjw2fl8Q4mTAHjnn1JIsOXVRIs7DnqGf7oG7PpvYxKPo pJSstEoni6Vtq+cU4g31HRDHj9k19ThXlTjAeJo2CXbRmOCp4s6rxp7t8KGAh/ayDoW1 yHRfaPw+tW93guRVOnGYo3pYhgMGENvVU9CP6plnUnjN27p0Cj7w+zw1Nx6v8FUoFbUE Yibg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=3UBZ/7kHrc8s5iB6X/AAff4ovemHn3/8xhPdX8yVFCc=; b=St7BZspXw7QgChSNgNr56JCwx0N4ZX6dH8SeyHUyC9QGwC/psjkvJuyGdhguPgsLDD GOqFD1IKDwoYgnGKWUdeArYXufEGMHPVMS7V2zlhp17VXrru2KzHOJbjhLqg1Z6eA//C jSiy8RPKhXti8ly88lV3doZGcq3oinG0FpNYrZ8N531+aaWPto6nmpC9sLNXBZ+Q7hzF aEjjnpnLfq92GVEdLKg1BSLmwQcjMidBJvHj74DWFFkOvjXXncDGwQxmfLKo1GYOMuoY MDmvi1Axu4r+1zyPKTVvDFxywRpNt2YUn1zAvlKkKAl2yUX0rW9Cov3naUnTfEqAcL1I EDaA== X-Gm-Message-State: APjAAAUId/0B+DpibEdAn5WQzbhAIACvsS+SrzV2isWARa+0ILgVBnLb QMHJv3JjuWNV2jnjHBze/lGG5I61bXo= X-Google-Smtp-Source: APXvYqyAjnYIhABMpm/GB7VFZbAFG8XlyM/5M2/oM05UtYDz0lvtOc6AdP4GWsjOAcEj1+9vIsvQ3Q== X-Received: by 2002:a65:62ca:: with SMTP id m10mr3122365pgv.57.1562834278293; Thu, 11 Jul 2019 01:37:58 -0700 (PDT) Received: from [192.168.20.7] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id 131sm6756956pfx.57.2019.07.11.01.37.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jul 2019 01:37:57 -0700 (PDT) From: Enji Cooper Message-Id: <6AC34953-52FC-48FC-B83F-CFFB6A48EC84@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r349907 - head/sys/netinet/tcp_stacks Date: Thu, 11 Jul 2019 01:37:56 -0700 In-Reply-To: <201907110438.x6B4cXX1054795@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org To: Randall Stewart References: <201907110438.x6B4cXX1054795@repo.freebsd.org> X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 9EDE76CD39 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.93 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.933,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 08:38:01 -0000 > On Jul 10, 2019, at 9:38 PM, Randall Stewart wrote: >=20 > Author: rrs > Date: Thu Jul 11 04:38:33 2019 > New Revision: 349907 > URL: https://svnweb.freebsd.org/changeset/base/349907 >=20 > Log: > Update copyright per JBH's suggestions.. thanks. >=20 > Modified: > head/sys/netinet/tcp_stacks/rack.c >=20 > Modified: head/sys/netinet/tcp_stacks/rack.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 03:29:25 2019 = (r349906) > +++ head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 04:38:33 2019 = (r349907) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2016 > + * Copyright (c) 2016-2019 > * Netflix Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > @@ -8537,10 +8537,10 @@ out: > * retransmit. In persist state, just set snd_max. > */ > if (error =3D=3D 0) { > -/* if (TCPS_HAVEESTABLISHED(tp->t_state) && > + if (TCPS_HAVEESTABLISHED(tp->t_state) && > (tp->t_flags & TF_SACK_PERMIT) && > tp->rcv_numsacks > 0) > - tcp_clean_dsack_blocks(tp);*/ > + tcp_clean_dsack_blocks(tp); Removing this commented out code unfortunately broke the build: = https://ci.freebsd.org/job/FreeBSD-head-amd64-LINT/12934/console = . Thanks, -Enji From owner-svn-src-all@freebsd.org Thu Jul 11 11:50:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA0D715CFC5C; Thu, 11 Jul 2019 11:50:14 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 8E0EE735E8; Thu, 11 Jul 2019 11:50:13 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id lXaOhJyiyUIS2lXaPhaTn7; Thu, 11 Jul 2019 05:50:06 -0600 X-Authority-Analysis: v=2.3 cv=N41X6F1B c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=0o9FgrsRnhwA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=SQCxYW1kktpyUpVo5akA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 8176E64B; Thu, 11 Jul 2019 04:50:03 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id x6BBo3QI009399; Thu, 11 Jul 2019 04:50:03 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id x6BBo3YA009396; Thu, 11 Jul 2019 04:50:03 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201907111150.x6BBo3YA009396@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Randall Stewart cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349907 - head/sys/netinet/tcp_stacks In-Reply-To: Message from Randall Stewart of "Thu, 11 Jul 2019 04:38:33 -0000." <201907110438.x6B4cXX1054795@repo.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 11 Jul 2019 04:50:03 -0700 X-CMAE-Envelope: MS4wfNcC15S+wst+a8nn/j4/R45govZRPfnQFvJHfozHgExSW3XI0SzBH9oWda9PaGJDDmCI62c9+nf5Dv24KHEGpp9U/ZwAWOxMBILlnGm90EOTbcSa0+ln 4Ij/sJ20x8i0UJ18elyCGmRtyWYyZ9qb/wib99J/mpKiretBNY6PsK3S691kYLlYhKaCbsFL7QTbIdTRdDRr1sNl3kyMkQT6ynWAd1RJ0wHp2TDOESyRQdxP hPxxKQeD3xLLS/GNdok1yoJCjDxGjPfjh73Kz4v5ywfckes6TaENS0FN46pvjlMA X-Rspamd-Queue-Id: 8E0EE735E8 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-5.01 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; MV_CASE(0.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; REPLYTO_EQ_FROM(0.00)[]; IP_SCORE(-2.51)[ip: (-6.69), ipnet: 64.59.128.0/20(-3.25), asn: 6327(-2.53), country: CA(-0.09)]; MX_GOOD(-0.01)[cached: spqr.komquats.com]; NEURAL_HAM_SHORT(-0.89)[-0.888,0]; RCVD_IN_DNSWL_NONE(0.00)[9.134.59.64.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_SPF_NA(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.zen.spamhaus.org : 127.0.0.11]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_TLS_LAST(0.00)[]; FROM_EQ_ENVFROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 11:50:15 -0000 In message <201907110438.x6B4cXX1054795@repo.freebsd.org>, Randall Stewart writ es: > Author: rrs > Date: Thu Jul 11 04:38:33 2019 > New Revision: 349907 > URL: https://svnweb.freebsd.org/changeset/base/349907 > > Log: > Update copyright per JBH's suggestions.. thanks. > > Modified: > head/sys/netinet/tcp_stacks/rack.c > > Modified: head/sys/netinet/tcp_stacks/rack.c > ============================================================================= > = > --- head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 03:29:25 2019 > (r349906) > +++ head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 04:38:33 2019 > (r349907) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2016 > + * Copyright (c) 2016-2019 > * Netflix Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > @@ -8537,10 +8537,10 @@ out: > * retransmit. In persist state, just set snd_max. > */ > if (error == 0) { > -/* if (TCPS_HAVEESTABLISHED(tp->t_state) && > + if (TCPS_HAVEESTABLISHED(tp->t_state) && > (tp->t_flags & TF_SACK_PERMIT) && > tp->rcv_numsacks > 0) > - tcp_clean_dsack_blocks(tp);*/ > + tcp_clean_dsack_blocks(tp); > if (len == 0) > counter_u64_add(rack_out_size[TCP_MSS_ACCT_SNDACK], 1); > else if (len == 1) { > This commit updates more than just the copyright. Were the other changes intended? If yes, a) Removing the */ at the other end of the commented block is also needed. b) The commit log is incorrect. Let's revert this and try again. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Thu Jul 11 12:12:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0D2015D1222; Thu, 11 Jul 2019 12:12:48 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id A420D74C67; Thu, 11 Jul 2019 12:12:47 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id lXwKhK78lUIS2lXwLhaWA1; Thu, 11 Jul 2019 06:12:46 -0600 X-Authority-Analysis: v=2.3 cv=N41X6F1B c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=0o9FgrsRnhwA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=XDP4Czh_GyGxbl_F4qQA:9 a=CjuIK1q_8ugA:10 a=rtGtfcxtKB4A:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 0FAF2689; Thu, 11 Jul 2019 05:12:44 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id x6BCCh7c009611; Thu, 11 Jul 2019 05:12:43 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id x6BCChgp009608; Thu, 11 Jul 2019 05:12:43 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201907111212.x6BCChgp009608@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Randall Stewart cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Cy Schubert Subject: Re: svn commit: r349907 - head/sys/netinet/tcp_stacks In-Reply-To: Message from Cy Schubert of "Thu, 11 Jul 2019 04:50:03 -0700." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 11 Jul 2019 05:12:43 -0700 X-CMAE-Envelope: MS4wfKNQigXcT89M9MnpviT68M0OWxwsbgy9Slj3VJZUO7iutiflFsqlckO7aClh63XFrWF5s3IxuIGDN5Lce98SvtXf4FTIMtvwVa2k/sGiXq9m07o4jHcy gcw38qVFMptaU8HosBlwQfgibA9Nv+b9iSnOda5M6J13MACIY6SaKqYQ5qJmSW4h4VKnYpCqFShfRdjl71vDbPtM6GOpMtMWhJK2A9ndwmq5bQ0JyHeewpBk YqtAK+07Q9QP9xvK0OXTKWSk8kTX95LkCc1UxO0IGpPgLnRTGIvLpAHsLYmVQ0Ou X-Rspamd-Queue-Id: A420D74C67 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-5.06 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; REPLYTO_EQ_FROM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[cached: spqr.komquats.com]; NEURAL_HAM_SHORT(-0.94)[-0.940,0]; RCVD_IN_DNSWL_NONE(0.00)[9.134.59.64.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_TLS_LAST(0.00)[]; IP_SCORE(-2.51)[ip: (-6.67), ipnet: 64.59.128.0/20(-3.25), asn: 6327(-2.53), country: CA(-0.09)]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.zen.spamhaus.org : 127.0.0.11] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 12:12:48 -0000 Cy Schubert writes: > In message <201907110438.x6B4cXX1054795@repo.freebsd.org>, Randall > Stewart writ > es: > > Author: rrs > > Date: Thu Jul 11 04:38:33 2019 > > New Revision: 349907 > > URL: https://svnweb.freebsd.org/changeset/base/349907 > > > > Log: > > Update copyright per JBH's suggestions.. thanks. > > > > Modified: > > head/sys/netinet/tcp_stacks/rack.c > > > > Modified: head/sys/netinet/tcp_stacks/rack.c > > =========================================================================== > == > > = > > --- head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 03:29:25 2019 > > (r349906) > > +++ head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 04:38:33 2019 > > (r349907) > > @@ -1,5 +1,5 @@ > > /*- > > - * Copyright (c) 2016 > > + * Copyright (c) 2016-2019 > > * Netflix Inc. All rights reserved. > > * > > * Redistribution and use in source and binary forms, with or without > > @@ -8537,10 +8537,10 @@ out: > > * retransmit. In persist state, just set snd_max. > > */ > > if (error == 0) { > > -/* if (TCPS_HAVEESTABLISHED(tp->t_state) && > > + if (TCPS_HAVEESTABLISHED(tp->t_state) && > > (tp->t_flags & TF_SACK_PERMIT) && > > tp->rcv_numsacks > 0) > > - tcp_clean_dsack_blocks(tp);*/ > > + tcp_clean_dsack_blocks(tp); > > if (len == 0) > > counter_u64_add(rack_out_size[TCP_MSS_ACCT_SNDACK], 1); > > else if (len == 1) { > > > > This commit updates more than just the copyright. Were the other > changes intended? If yes, > > a) Removing the */ at the other end of the commented block is also > needed. My mistake. I missed the */. Sorry. > b) The commit log is incorrect. This is still a problem. > > Let's revert this and try again. For the sake of the log, probably. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Thu Jul 11 13:25:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40ABE15D28D1; Thu, 11 Jul 2019 13:25:38 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 89E6B76F09; Thu, 11 Jul 2019 13:25:37 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id F1BDF3607A7; Thu, 11 Jul 2019 23:25:26 +1000 (AEST) Date: Thu, 11 Jul 2019 23:25:24 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alexey Dokuchaev cc: Philip Paeps , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349890 - head/contrib/telnet/telnet In-Reply-To: <20190711014729.GB23621@FreeBSD.org> Message-ID: <20190711221158.N1533@besplex.bde.org> References: <201907101742.x6AHg4os016752@repo.freebsd.org> <20190711014729.GB23621@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 cx=a_idp_d a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=EprUL-5I6KnjuIzbal4A:9 a=YoCYy-C6q4L7z-oV:21 a=y7qSRRag8CzNf-xG:21 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-Rspamd-Queue-Id: 89E6B76F09 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.94 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.94)[-0.937,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 13:25:38 -0000 On Thu, 11 Jul 2019, Alexey Dokuchaev wrote: > On Wed, Jul 10, 2019 at 05:42:04PM +0000, Philip Paeps wrote: >> New Revision: 349890 >> URL: https://svnweb.freebsd.org/changeset/base/349890 >> >> Log: >> telnet: fix a couple of snprintf() buffer overflows I see few fixes in this fix. I see even more style bugs than before. >> Modified: head/contrib/telnet/telnet/commands.c >> @@ -1655,10 +1655,11 @@ env_init(void) >> char hbuf[256+1]; >> char *cp2 = strchr((char *)ep->value, ':'); >> >> - gethostname(hbuf, 256); >> - hbuf[256] = '\0'; >> - cp = (char *)malloc(strlen(hbuf) + strlen(cp2) + 1); >> - sprintf((char *)cp, "%s%s", hbuf, cp2); > > Would it make sense to add something like __attribute__ ((deprecated)) > to those unsafe functions like gets(), sprintf(), etc.? Or it would > cause too much PITA? sprintf() is safe to use and was used perfectly correctly (except for not not checking the validity of most of its args: no check of the result of gethostname() or malloc(), and no check for overflow in 'strlen(hbuf) + strlen(cp2) + 1'. malloc() is used to provide a buffer just large enough for sprintf() to not overflow the buffer, modulo the missing error checking. Blindly changing to snprintf() does little to improve this. It gives a garbage buffer instead of buffer overrun in some of the error cases. It is missing error checking. The bugs visible in the above are: - hard-coded size for hbuf. The correct size is {HOST_NAME_MAX} + 1. HOST_NAME_MAX is intentionally not defined in FreeBSD's , so even unportable POSIX applications have to deal with the full complexity of POSIX limits (they can't simply hard-code HOST_NAME_MAX). POSIX requires using sysconf(_SC_HOST_NAME_MAX) and dealing with errors and indeterminate values reported by it. Unfortunately, FreeBSD also has MAXHOSTNAMELEN. sysconf(_SC_HOST_NAME_MAX) just returns this minus 1. This is is 256. The hard-coded 256 in the above is essentially this, and adding 1 to this is nonsense. telnet uses MAXHOSTNAMELEN for global variables. It also #defines MAXHOSTNAMELEN as 256 if it is not defined in an included header. So if the extra 1 were actually used, then the global variables couldn't hold hostnames and there would be bugs elswhere. Honestly unportable code would use MAXHOSTNAME everywhere, and not add 1 to it, and depend on this being large enough. gethostname() guarantees to nul-terminated if it succeeds and the buffer is large enough. telnet uses gethostname() in 1 other place. In telnet.c, it initializes the global local_host which has size MAXHOSTNAME. Of course it doesn't check for errors. It does force nul-termination. - missing spaces around binary operator in '256+1' - initialization in declaration of cp2 - bogus cast to char * in declaration of cp2. This breaks the warning that ep->value has the bogus type unsigned char *. Not many character arrays actually need to have type unsigned char *, and if they do then it might be an error to pass them to str*() functions since str*() functions are only guaranteed to work right for plain char *. - no error check for gethostname(), bogus dishonestly unportable size for hbuf, and partial fixup for these bugs by forcing nul-termination (see above) - bogus cast of malloc() to char *. This was more needed 30-40 years ago for bad code that doesn't declare malloc() in a standard header or doesn't include that header. Telnet is that old, so this wasn't bogus originally. - no check for overflow in 'strlen(hbuf) + strlen(cp2) + 1'. Checking this would be silly, but not much sillier than forcing nul-termination after not trusting gethostname() and/or our buffer size. strlen(hbuf) is known to be small, and strlen(cp2) must be known to be non-preposterous, else overflow is possible. However, cp2 is a substring of an environment variable, so it can be almost as large as the address space if a malicious environment can be created. Perhaps it is limited to ARG_MAX. Practical code could limit its size to 256 or so and statically allocate the whole buffer on the stack. Or don't limit it, and use alloca() or a VLA to allocate the whole buffer on the stack. Paranoid code of course can't even have a stack, unless the C runtime checks for stack overflow and the program can handle exceptions from that. - bogus cast of cp arg to char * in sprintf() call. cp doesn't suffer from unsigned poisoning, so already has type char *. - no cast of cp2 arg in sprintf() call. Such a cast can only break the warning. It is unclear if %s format can handle args of type unsigned char *. Even if the behaviour is defined, then I think it ends up converting unsigned char to char via a type pun. The string concatenation can be done even more easily and correctly using strcat(), but style(9) says to use printf() instead of special methods and that is a good rule for sprintf() too. Bruce From owner-svn-src-all@freebsd.org Thu Jul 11 15:05:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA59915D5F1C for ; Thu, 11 Jul 2019 15:05:14 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-vs1-xe41.google.com (mail-vs1-xe41.google.com [IPv6:2607:f8b0:4864:20::e41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7E61383252 for ; Thu, 11 Jul 2019 15:05:14 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-vs1-xe41.google.com with SMTP id j26so4389969vsn.10 for ; Thu, 11 Jul 2019 08:05:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=QDsqdGOsdtsjbY16Uppg0T6oGBbyELyB94B16o7HVUk=; b=UpGtA/U4IzVa1NxBWbsIq+edC1eGFb2i2k2BgmU5ODVp9bPI8GN0Z1g63iiSBkQCGB l1MAcXbtyHStWJIvnw29TVgFdiBA+TsHoPyZJTgmO/pnxj8aQQ27MD+/WA/+SPcHBBzH m6aMIVLGTXGpccix/xOVcemCaUnSqMDB/FLUJCYYS8KO8IK+XXldp9APNW0/CvETnDxo xN51kKrGLtSP6J+WK1xa+9pz/cQ6Sdp1Z4PCWsHLbAZcGCsFDCkxlRoyKsYMScL3e+FV mjfZ5kd5rJPeg7sXGANTToeaOLY9FB3Y5y6zLjkn3SrBgTBehwfuIQB0+NkVUthwHfPE zt1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=QDsqdGOsdtsjbY16Uppg0T6oGBbyELyB94B16o7HVUk=; b=sc1C8JLZVUGK4ohsQXEafjDJ9srpTFSzA7wBYI3zTSwjBScrJEu0kHstkOvoumi67Y 2oHRBOptX0JJ9Zw3Br1EIQNaVCTiNUrEpMXLqOll+ZBiz0BFqcG78rGAZIvQOXJmo5y2 zzysoB2agZr//fC6ocfWxh3xhAWN1s7noFXx3xTKK1lJ34Pegd9ca+IhBjZ4/1ZUouWw DbPYzrTM1s1lQlvqc6pxZxUvKKFaQLb5W1xZlfcuGAVIzcU2nomk4zdUv1RXAt/i1F39 FMB7bABIU2ALsP9Ox3Mki/1U5lYJqr4Jvte4CBLdAwhoQR/nIbXd0KsKIt7OwzKRt2os y0PQ== X-Gm-Message-State: APjAAAXFvzxogLeG/VBErtOrn2u/4C8LOduxsCeKvUzF8IC+LWdyE6ag 4J8y4AXdVY8vTC3w2qgJOnmNMw== X-Google-Smtp-Source: APXvYqxcFgHfCfAskJoeb651WV2fqJ2nV0DXcTNLOpHCSLNnDskxQ3v3quUjoFcuyIl2cd8JRgFk5w== X-Received: by 2002:a67:d410:: with SMTP id c16mr5197251vsj.61.1562857513852; Thu, 11 Jul 2019 08:05:13 -0700 (PDT) Received: from mutt-hbsd ([63.88.83.108]) by smtp.gmail.com with ESMTPSA id d134sm1409319vsc.26.2019.07.11.08.05.12 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 11 Jul 2019 08:05:13 -0700 (PDT) Date: Thu, 11 Jul 2019 11:05:12 -0400 From: Shawn Webb To: Enji Cooper Cc: Philip Paeps , svn-src-head@freebsd.org, svn-src-all , src-committers Subject: Re: svn commit: r349896 - head/contrib/telnet/telnet Message-ID: <20190711150512.usrjdmg4fcoobshr@mutt-hbsd> References: <201907102236.x6AMaFLI067550@repo.freebsd.org> <6031EBD8-84D7-46D4-A3E5-D78427D084B1@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="qakgcoku6qo52req" Content-Disposition: inline In-Reply-To: <6031EBD8-84D7-46D4-A3E5-D78427D084B1@gmail.com> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA User-Agent: NeoMutt/20180716 X-Rspamd-Queue-Id: 7E61383252 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 15:05:15 -0000 --qakgcoku6qo52req Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 11, 2019 at 01:02:15AM -0700, Enji Cooper wrote: >=20 > > On Jul 10, 2019, at 3:36 PM, Philip Paeps wrote: > >=20 > > Author: philip > > Date: Wed Jul 10 22:36:14 2019 > > New Revision: 349896 > > URL: https://svnweb.freebsd.org/changeset/base/349896 > >=20 > > Log: > > telnet: fix minor style violation > >=20 > > While here also fix a very unlikely NULL pointer dereference. > >=20 > > Submitted by: Shawn Webb > >=20 > > Modified: > > head/contrib/telnet/telnet/commands.c > >=20 > > Modified: head/contrib/telnet/telnet/commands.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/contrib/telnet/telnet/commands.c Wed Jul 10 22:23:59 2019 (r34= 9895) > > +++ head/contrib/telnet/telnet/commands.c Wed Jul 10 22:36:14 2019 (r34= 9896) > > @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); > > #include > > #include > >=20 > > +#include > > #include > > #include > > #include > > @@ -1654,11 +1655,13 @@ env_init(void) > > || (strncmp((char *)ep->value, "unix:", 5) =3D=3D 0))) { > > char hbuf[256+1]; > > char *cp2 =3D strchr((char *)ep->value, ':'); > > + size_t buflen; > >=20 > > gethostname(hbuf, sizeof(hbuf)); > > hbuf[sizeof(hbuf)-1] =3D '\0'; > > - unsigned int buflen =3D strlen(hbuf) + strlen(cp2) + 1; > > + buflen =3D strlen(hbuf) + strlen(cp2) + 1; > > cp =3D (char *)malloc(sizeof(char)*buflen); > > + assert(cp !=3D NULL); >=20 > This will unfortunately still segfault if assert is compiled out of the s= ystem as a no-op (-DNDEBUG). >=20 > I genuinely think using asprintf instead is the way to go, as Eitan and W= arner brought up, since it reduces complexity in the program. https://gist.github.com/d49121a3e9a14b93868360edf32673f1 Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 Tor+XMPP+OTR: lattera@is.a.hacker.sx GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 --qakgcoku6qo52req Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl0nUCIACgkQ/y5nonf4 4fpJ7w/+NrzKkVZS9+LTrSIKC2EfdLI9eRmxMgejmz4zEkOH89CZszNeL8dGHrjV yd6STzisox8agg/EH/cYVVFSfHRmxS9mwZUzVOh3/kkcLj4cZ5KYnNWVJXrim7Zk vMAmrxway/X/XftwnVNFrFUAdSagfO9z7N6o+wy4npiAlam8llpNPF57REZs+Ymm xvp/LC0qJa5tOdQFUTe7MtUDlZcYGAaxb6w2tU2h8t86fI33jvLCe/NVrnKja2In d0Ej7x/bD07i9hBRB9iOLL8EHuH3RosLItSXwijaK0tChs2V9cxVc+G5mGBKf8OB 9XDqgugxh3dDek3UBjjua/7ZTk8GTz9W/Duc4G1Irp8oTbxYmHL0kJUZJS8P+DVZ pwB0vgebpiU13BLFVQv5G6LiychvpPV/acgnO1pkuQBlHSibyEP7vDS1icUKRAbN CldN8Svi/PnLQf+tPoOqOVSgwpeQRdtfBQi4i/cLbtQTSbMOjGBkUq8Tu4xy3707 falDgksqLZw/N5RqhdI3mH9u+7/TjCeqaClY1shFKmgnH1/wbdp6IDc29UZvyhHT IH2gma0Eiiz/ADr+oy+eoixHp/P4rOddYkd6DUyTJ6OE9l9R0qFNNWXwAExs4giE lws7yvW1y9XWf0y2jHLBToWKKryv3jHZ+Z6touYOqcbzyGEjkJk= =MU7h -----END PGP SIGNATURE----- --qakgcoku6qo52req-- From owner-svn-src-all@freebsd.org Thu Jul 11 15:30:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 800B415D668A; Thu, 11 Jul 2019 15:30:32 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id CA505841E5; Thu, 11 Jul 2019 15:30:31 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 2DEBE3606C7; Fri, 12 Jul 2019 01:30:27 +1000 (AEST) Date: Fri, 12 Jul 2019 01:30:25 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Enji Cooper cc: Philip Paeps , src-committers , svn-src-all , svn-src-head@freebsd.org Subject: Re: svn commit: r349896 - head/contrib/telnet/telnet In-Reply-To: <6031EBD8-84D7-46D4-A3E5-D78427D084B1@gmail.com> Message-ID: <20190712004934.Y1991@besplex.bde.org> References: <201907102236.x6AMaFLI067550@repo.freebsd.org> <6031EBD8-84D7-46D4-A3E5-D78427D084B1@gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=P6RKvmIu c=1 sm=1 tr=0 cx=a_idp_d a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=h6Ce3YiGc5IcDynMt-8A:9 a=wO83ShaMlpQIR83E:21 a=xOYv55zVvwvZlDf4:21 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-Rspamd-Queue-Id: CA505841E5 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.97 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 15:30:32 -0000 On Thu, 11 Jul 2019, Enji Cooper wrote: >> On Jul 10, 2019, at 3:36 PM, Philip Paeps wrote: >> >> Author: philip >> Date: Wed Jul 10 22:36:14 2019 >> New Revision: 349896 >> URL: https://svnweb.freebsd.org/changeset/base/349896 >> >> Log: >> telnet: fix minor style violation >> >> While here also fix a very unlikely NULL pointer dereference. I see no fix here. >> Modified: head/contrib/telnet/telnet/commands.c >> ============================================================================== >> --- head/contrib/telnet/telnet/commands.c Wed Jul 10 22:23:59 2019 (r349895) >> +++ head/contrib/telnet/telnet/commands.c Wed Jul 10 22:36:14 2019 (r349896) >> @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); >> #include >> #include >> >> +#include >> #include >> #include >> #include >> @@ -1654,11 +1655,13 @@ env_init(void) >> || (strncmp((char *)ep->value, "unix:", 5) == 0))) { >> char hbuf[256+1]; >> char *cp2 = strchr((char *)ep->value, ':'); >> + size_t buflen; This adds a different type of style bug (indentation via spaces instead of tabs). >> >> gethostname(hbuf, sizeof(hbuf)); >> hbuf[sizeof(hbuf)-1] = '\0'; >> - unsigned int buflen = strlen(hbuf) + strlen(cp2) + 1; >> + buflen = strlen(hbuf) + strlen(cp2) + 1; >> cp = (char *)malloc(sizeof(char)*buflen); >> + assert(cp != NULL); > > This will unfortunately still segfault if assert is compiled out of the system as a no-op (-DNDEBUG). telnet is unlikely to be compiled with -DNDEBUG, since it didn't use assert() before and this commit doesn't change its Makefile to control its new use of assert(). Any it doesn't fix the error either. On must arches, it turns a nice restartable null pointer trap into an unrestartable abort(). The program crashes in both cases. > I genuinely think using asprintf instead is the way to go, as Eitan and Warner brought up, since it reduces complexity in the program. asprintf() is only slightly easier to use. You still have to check if it succeeded, and free the storage that it allocates. It increases the complexity of the program compared with static allocation and strcat(). Example of a simple method: char buf[MAXHOSTNAMELEN + 256]; ... cp2 = ...; /* * Must bound cp2's length if we are paranoid, since cp2 * is in the environment. Use 256 for the bound, for * simple portable allocation above (don't use unportable * alloca() or newfangled VLAs to try to support much * larger sizes. Since we are paranoid, we are reluctant * to even allocate 1-byte buffers as local variables. */ if (strlen(cp2) > 256) abort(); /* sloppy, like assert() ... */ /* * Although MAXHOSTNAMELEN is undocumented, we assume that * it equals the documented {HOST_NAME_MAX} + 1 elsewhere * so may as well assume this here. We trust gethostname() * to work as documented and nul-terminate what it returns * provided it succeeds and the buffer is large enough. */ if (gethostname(buf, MAXHOSTNAMELEN) != 0) abort(); /* sloppy, but better than nothing */ #ifdef TRUE_PARANOID buf[MAXHOSTNAMELEN] = '\0'; assert(strlen(buf) < MAXHOSTNAMELEN); #endif /* The buffer is large enough, by construction. */ strcat(buf, cp2); The above is much more readable without any comments or error checking. I can't quite make it fail nicely with null pointer traps then: buf = alloca(MAXHOSTNAMELEN + strlen(cp2)); gethostname(buf, MAXHOSTNAMELEN); strcat(buf, cp2); Using alloca() is better than a VLA, since it its possible in principle for it to fail and return a null pointer giving a nice trap. Using asprintf(): /* Minor unportabilities, as above: */ char hbuf[MAXHOSTNAMELEN]; /* * Only needs error checking if TRUE_PARANOID, as above * (might be better to order the initialization so as to * use out global hostname variable): */ gethostname(hbuf, MAXHOSTNAMELEN); /* Remove cp2 above; expression for cp2 moved here: */ asprintf(&buf, "%s%s", buf, strchr((char *)ep->value, ':')); if (buf == NULL) abort(); /* sloppy, like assert() ... */ ... free(buf); /* more messes to free it */ xasprintfa() (asprintf() to an alloca()ed buffer with internal abort() of the allocation is impossible) would be most convenient here. Bruce From owner-svn-src-all@freebsd.org Thu Jul 11 15:37:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3FFAB15D6B24; Thu, 11 Jul 2019 15:37:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D9CF78475A; Thu, 11 Jul 2019 15:36:59 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B0DA78E3; Thu, 11 Jul 2019 15:36:59 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BFaxwW093299; Thu, 11 Jul 2019 15:36:59 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BFaxCX093298; Thu, 11 Jul 2019 15:36:59 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907111536.x6BFaxCX093298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 11 Jul 2019 15:36:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349910 - head/sys/arm64/include X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/arm64/include X-SVN-Commit-Revision: 349910 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D9CF78475A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 15:37:00 -0000 Author: markj Date: Thu Jul 11 15:36:59 2019 New Revision: 349910 URL: https://svnweb.freebsd.org/changeset/base/349910 Log: Fix some ISS bit definitions for data aborts. MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/include/armreg.h Modified: head/sys/arm64/include/armreg.h ============================================================================== --- head/sys/arm64/include/armreg.h Thu Jul 11 06:22:15 2019 (r349909) +++ head/sys/arm64/include/armreg.h Thu Jul 11 15:36:59 2019 (r349910) @@ -91,10 +91,10 @@ #define ISS_DATA_SF (0x01 << 15) #define ISS_DATA_AR (0x01 << 14) #define ISS_DATA_FnV (0x01 << 10) -#define ISS_DATa_EA (0x01 << 9) -#define ISS_DATa_CM (0x01 << 8) -#define ISS_INSN_S1PTW (0x01 << 7) -#define ISS_DATa_WnR (0x01 << 6) +#define ISS_DATA_EA (0x01 << 9) +#define ISS_DATA_CM (0x01 << 8) +#define ISS_DATA_S1PTW (0x01 << 7) +#define ISS_DATA_WnR (0x01 << 6) #define ISS_DATA_DFSC_MASK (0x3f << 0) #define ISS_DATA_DFSC_ASF_L0 (0x00 << 0) #define ISS_DATA_DFSC_ASF_L1 (0x01 << 0) From owner-svn-src-all@freebsd.org Thu Jul 11 15:38:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D925115D6C34; Thu, 11 Jul 2019 15:38:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7FECE8491B; Thu, 11 Jul 2019 15:38:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 590608E6; Thu, 11 Jul 2019 15:38:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BFcfap093413; Thu, 11 Jul 2019 15:38:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BFceag093412; Thu, 11 Jul 2019 15:38:40 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907111538.x6BFceag093412@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 11 Jul 2019 15:38:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349911 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 349911 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7FECE8491B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.945,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 15:38:42 -0000 Author: markj Date: Thu Jul 11 15:38:40 2019 New Revision: 349911 URL: https://svnweb.freebsd.org/changeset/base/349911 Log: MFC r349612: Mark pages allocated from the per-CPU cache. Modified: stable/12/sys/vm/vm_page.c stable/12/sys/vm/vm_page.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_page.c ============================================================================== --- stable/12/sys/vm/vm_page.c Thu Jul 11 15:36:59 2019 (r349910) +++ stable/12/sys/vm/vm_page.c Thu Jul 11 15:38:40 2019 (r349911) @@ -1808,8 +1808,9 @@ vm_page_alloc_domain_after(vm_object_t object, vm_pind if (object != NULL) VM_OBJECT_ASSERT_WLOCKED(object); -again: + flags = 0; m = NULL; +again: #if VM_NRESERVLEVEL > 0 /* * Can we allocate the page from a reservation? @@ -1825,8 +1826,10 @@ again: vmd = VM_DOMAIN(domain); if (object != NULL && vmd->vmd_pgcache != NULL) { m = uma_zalloc(vmd->vmd_pgcache, M_NOWAIT); - if (m != NULL) + if (m != NULL) { + flags |= PG_PCPU_CACHE; goto found; + } } if (vm_domain_allocate(vmd, req, 1)) { /* @@ -1854,10 +1857,8 @@ again: } /* - * At this point we had better have found a good page. + * At this point we had better have found a good page. */ - KASSERT(m != NULL, ("missing page")); - found: vm_page_dequeue(m); vm_page_alloc_check(m); @@ -1865,10 +1866,8 @@ found: /* * Initialize the page. Only the PG_ZERO flag is inherited. */ - flags = 0; if ((req & VM_ALLOC_ZERO) != 0) - flags = PG_ZERO; - flags &= m->flags; + flags |= (m->flags & PG_ZERO); if ((req & VM_ALLOC_NODUMP) != 0) flags |= PG_NODUMP; m->flags = flags; @@ -2014,6 +2013,7 @@ vm_page_alloc_contig_domain(vm_object_t object, vm_pin * Can we allocate the pages without the number of free pages falling * below the lower bound for the allocation class? */ + m_ret = NULL; again: #if VM_NRESERVLEVEL > 0 /* @@ -2029,7 +2029,6 @@ again: goto found; } #endif - m_ret = NULL; vmd = VM_DOMAIN(domain); if (vm_domain_allocate(vmd, req, npages)) { /* @@ -3475,7 +3474,7 @@ vm_page_free_toq(vm_page_t m) return; vmd = vm_pagequeue_domain(m); - if (m->pool == VM_FREEPOOL_DEFAULT && vmd->vmd_pgcache != NULL) { + if ((m->flags & PG_PCPU_CACHE) != 0 && vmd->vmd_pgcache != NULL) { uma_zfree(vmd->vmd_pgcache, m); return; } Modified: stable/12/sys/vm/vm_page.h ============================================================================== --- stable/12/sys/vm/vm_page.h Thu Jul 11 15:36:59 2019 (r349910) +++ stable/12/sys/vm/vm_page.h Thu Jul 11 15:38:40 2019 (r349911) @@ -377,6 +377,7 @@ extern struct mtx_padalign pa_lock[]; * Page flags. If changed at any other time than page allocation or * freeing, the modification must be protected by the vm_page lock. */ +#define PG_PCPU_CACHE 0x0001 /* was allocated from per-CPU caches */ #define PG_FICTITIOUS 0x0004 /* physical page doesn't exist */ #define PG_ZERO 0x0008 /* page is zeroed */ #define PG_MARKER 0x0010 /* special queue marker page */ From owner-svn-src-all@freebsd.org Thu Jul 11 15:43:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 690D915D6F75 for ; Thu, 11 Jul 2019 15:43:51 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-vs1-xe42.google.com (mail-vs1-xe42.google.com [IPv6:2607:f8b0:4864:20::e42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F14E284E65 for ; Thu, 11 Jul 2019 15:43:50 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-vs1-xe42.google.com with SMTP id v6so4547071vsq.4 for ; Thu, 11 Jul 2019 08:43:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=bsVkA+MXjLWNwM1jvGg2JecalO0cc3ZNjBjRRAMgihM=; b=MXJv/uXACmIsNo9zMGF4+DvnLjKe16uSB2OIN4AXLBMso0wSxURKy/Pg6a8JCJ95/r RflOCfeUOI9qyzoWAJvrZsxKZo04uFI/u+tOBoAYJz1NDYq0pf2nHjO+5//tjYfAr3ef uwt5VnkJt+GIu78+W1t2FMw6BOWKBVRpQZf50hfHlnrySnTQ36AdhR5jhUHNx7SSNRTo 796rE5aD9subf9BlD9xP/AQg16lnCCAhxW0KXaVJn6uuG2AAgx9pwOYvtfg4vf0wWUFD VMYqxmO5T0AWOurgsdKwJOJDP/fSmtkhDpaB/hPgD/aRDNahEmrhmuxUurG0qEuolJPL DC+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=bsVkA+MXjLWNwM1jvGg2JecalO0cc3ZNjBjRRAMgihM=; b=d45DKYKdzts/B/gd8IFqY8H287LZhEW/QRKZiulRWuI7rMmaDK4cVoPT8RZVs4Npn6 6kYWnGEHwl6tXW7iYs0AQVCmxAlBVdlDU4E/yGEOsGJFNF2VspCJvLAAha/0zVNevmVn L2h7SrsPgNIjCABUU2/MS+tPGaMEmZld8LYd1ExC9vSEKugN+mplPhVY9fw7KmRlSuMG Zf/n3BVXIRvXwClmfmnhqkI7fw4iaCfvmxI0o4IixxdKz/zD4q/p6DuT/KV2ozdNoGVK 1dsTHUCto/EaUT+S9aOYYw/VyJbhKnHBIlk6FbFfxxloUlAMQKMho3CxVVDCdW3dXTWC gDVg== X-Gm-Message-State: APjAAAXB7Wu0E9wtXw5s1uo+HfULcsLvmC2oeQZl7EKWyMdjOt3DQzdC MEIlnJqLlD4xzZsLalzoZiIp/Q== X-Google-Smtp-Source: APXvYqzDZf7vJ2I5q7eOgY04+qmhM5TlvXqOc4S0PeKHDC/4iANf/2ohkZIRx7cN1JDwqTcF5AGsIg== X-Received: by 2002:a67:1e44:: with SMTP id e65mr5379085vse.45.1562859830168; Thu, 11 Jul 2019 08:43:50 -0700 (PDT) Received: from mutt-hbsd ([63.88.83.108]) by smtp.gmail.com with ESMTPSA id s67sm2990340vkb.30.2019.07.11.08.43.49 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 11 Jul 2019 08:43:49 -0700 (PDT) Date: Thu, 11 Jul 2019 11:43:48 -0400 From: Shawn Webb To: Bruce Evans Cc: Enji Cooper , svn-src-head@freebsd.org, svn-src-all , src-committers , Philip Paeps Subject: Re: svn commit: r349896 - head/contrib/telnet/telnet Message-ID: <20190711154348.oss6ec5ysgfsiln4@mutt-hbsd> References: <201907102236.x6AMaFLI067550@repo.freebsd.org> <6031EBD8-84D7-46D4-A3E5-D78427D084B1@gmail.com> <20190712004934.Y1991@besplex.bde.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bjd2hj7ltmlg53jw" Content-Disposition: inline In-Reply-To: <20190712004934.Y1991@besplex.bde.org> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA User-Agent: NeoMutt/20180716 X-Rspamd-Queue-Id: F14E284E65 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.995,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 15:43:51 -0000 --bjd2hj7ltmlg53jw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 12, 2019 at 01:30:25AM +1000, Bruce Evans wrote: > On Thu, 11 Jul 2019, Enji Cooper wrote: >=20 > > > On Jul 10, 2019, at 3:36 PM, Philip Paeps wrote: > > >=20 > > > Author: philip > > > Date: Wed Jul 10 22:36:14 2019 > > > New Revision: 349896 > > > URL: https://svnweb.freebsd.org/changeset/base/349896 > > >=20 > > > Log: > > > telnet: fix minor style violation > > >=20 > > > While here also fix a very unlikely NULL pointer dereference. >=20 > I see no fix here. >=20 > > > Modified: head/contrib/telnet/telnet/commands.c > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > > --- head/contrib/telnet/telnet/commands.c Wed Jul 10 22:23:59 2019 (r= 349895) > > > +++ head/contrib/telnet/telnet/commands.c Wed Jul 10 22:36:14 2019 (r= 349896) > > > @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); > > > #include > > > #include > > >=20 > > > +#include > > > #include > > > #include > > > #include > > > @@ -1654,11 +1655,13 @@ env_init(void) > > > || (strncmp((char *)ep->value, "unix:", 5) =3D=3D 0))) { > > > char hbuf[256+1]; > > > char *cp2 =3D strchr((char *)ep->value, ':'); > > > + size_t buflen; >=20 > This adds a different type of style bug (indentation via spaces instead of > tabs). >=20 > > >=20 > > > gethostname(hbuf, sizeof(hbuf)); > > > hbuf[sizeof(hbuf)-1] =3D '\0'; > > > - unsigned int buflen =3D strlen(hbuf) + strlen(cp2) += 1; > > > + buflen =3D strlen(hbuf) + strlen(cp2) + 1; > > > cp =3D (char *)malloc(sizeof(char)*buflen); > > > + assert(cp !=3D NULL); > >=20 > > This will unfortunately still segfault if assert is compiled out of the= system as a no-op (-DNDEBUG). >=20 > telnet is unlikely to be compiled with -DNDEBUG, since it didn't use asse= rt() > before and this commit doesn't change its Makefile to control its new use > of assert(). >=20 > Any it doesn't fix the error either. On must arches, it turns a nice > restartable null pointer trap into an unrestartable abort(). The program > crashes in both cases. We're getting into theory, since this particular bug isn't vulnerable to this particular issue I'm about to bring up, but it is possible to map at NULL on FreeBSD, given a sysctl has been explicitly toggled by an administrative user. I've found it's best to adhere to good defensive programming techniques, even in cases where doing so may not make immediate sense. Future developers, even the code's original author(s), may be grateful later as they make changes. Thus, even if this particular potential NULL pointer dereference isn't exploitable in any meaningful way, adherence to defensive programming practices will help both now and later. One thing I love about FreeBSD is how it strives to deliver high quality, correct code. It seems strange that more characters have been written in emails about the lack of asprintf usage than it would've taken to actually write the patch to fix it. Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 Tor+XMPP+OTR: lattera@is.a.hacker.sx GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 --bjd2hj7ltmlg53jw Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl0nWS8ACgkQ/y5nonf4 4foCHxAAhWZrDCMz2kCTfUsZkJ9640CThBYZOcNu4kVo3wQdjei1P/YgEL1s+Ge+ rkNlRDrq+BoID1z4iEtXAAP3T9RPX0RDb/rJh1z0HsXQwVT2gQt1ClBVoJSnir5e 138uDOckI2L8as6HMEFkqfexFIfcXj2gmTKl6WEEHJcs/tpuwu5myZ3+G8LWbjed 0igr3CF4PoUrTMlguAvr0FU9V1QYO+HN49BZTjtY2/tmAc03/q05hUxU8tZSPp/P k3bY6r1agRlUOW/vax+iIE2QQYPeeqDeHSan+tX1hLvTEJBEesf2QBIZItskDDHV uMRPUQZLnqNXIeoenzXt5mrnDhr7OqgFubkAWIC0LTL5EGpBqttQ+9/sjjGUGbZP j0x98pQRf8yZkOEt1ffP/scYNL9vn8anf6UqBV5XFuDV2KZQrpYSilnW49JjNZ7S vDNUiCGjk7IcFgRXr07qhqzkkEH+lYJxcmJB9FfyYAug3gm62tjpAP+FyzO1qBT0 JZ9C0TcnacXBn5nxG3gjkwQo8qISWlq/3YGnCrVqMYfVJ0Qqrz/DvV4NhN+a2hzv S4awe1aEKYzY6DYsUuDMfXiWe5tPFswAFFwgnEsZqhy0GpohG/UQmLyA5pKs+f8e stYcZkfWXbNXEB0LR1y/B6kbjDfpMhDnNwo4tJ9IpSFsVuvmNak= =lax/ -----END PGP SIGNATURE----- --bjd2hj7ltmlg53jw-- From owner-svn-src-all@freebsd.org Thu Jul 11 16:19:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02D3715D80A3; Thu, 11 Jul 2019 16:19:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9F8F3865D6; Thu, 11 Jul 2019 16:19:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7BCC3FB7; Thu, 11 Jul 2019 16:19:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BGJX8X014178; Thu, 11 Jul 2019 16:19:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BGJXtc014177; Thu, 11 Jul 2019 16:19:33 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201907111619.x6BGJXtc014177@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 11 Jul 2019 16:19:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349912 - head/lib/libthr/thread X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/lib/libthr/thread X-SVN-Commit-Revision: 349912 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9F8F3865D6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 16:19:34 -0000 Author: kib Date: Thu Jul 11 16:19:33 2019 New Revision: 349912 URL: https://svnweb.freebsd.org/changeset/base/349912 Log: Restore ability to pass NULL name argument to pthread_set_name_np(3) to clear the thread name. PR: 239142 Submitted by: Lewis Donzis MFC after: 3 days Modified: head/lib/libthr/thread/thr_info.c Modified: head/lib/libthr/thread/thr_info.c ============================================================================== --- head/lib/libthr/thread/thr_info.c Thu Jul 11 15:38:40 2019 (r349911) +++ head/lib/libthr/thread/thr_info.c Thu Jul 11 16:19:33 2019 (r349912) @@ -52,7 +52,7 @@ thr_set_name_np(struct pthread *thread, const char *na { free(thread->name); - thread->name = strdup(name); + thread->name = name != NULL ? strdup(name) : NULL; } /* Set the thread name for debug. */ From owner-svn-src-all@freebsd.org Thu Jul 11 16:22:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D29A015D844A; Thu, 11 Jul 2019 16:22:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7555586C10; Thu, 11 Jul 2019 16:22:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 48A36115C; Thu, 11 Jul 2019 16:22:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BGMofW019247; Thu, 11 Jul 2019 16:22:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BGMoZ3019246; Thu, 11 Jul 2019 16:22:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201907111622.x6BGMoZ3019246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 11 Jul 2019 16:22:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349913 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 349913 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7555586C10 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 16:22:51 -0000 Author: kib Date: Thu Jul 11 16:22:49 2019 New Revision: 349913 URL: https://svnweb.freebsd.org/changeset/base/349913 Log: Ensure that mds_handler always points to a valid method. Depending on system configuration, version, and architecture, mds_handler might be dereferenced from doreti before hw_mds_recalculate_boot() initialized it. Statically assign void method to cover all cases. Reported by: "Schuendehuette, Matthias (LDA IT PLM)" Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/x86/x86/cpu_machdep.c Modified: head/sys/x86/x86/cpu_machdep.c ============================================================================== --- head/sys/x86/x86/cpu_machdep.c Thu Jul 11 16:19:33 2019 (r349912) +++ head/sys/x86/x86/cpu_machdep.c Thu Jul 11 16:22:49 2019 (r349913) @@ -939,7 +939,6 @@ int hw_mds_disable; * architectural state except possibly %rflags. Also, it is always * called with interrupts disabled. */ -void (*mds_handler)(void); void mds_handler_void(void); void mds_handler_verw(void); void mds_handler_ivb(void); @@ -948,6 +947,7 @@ void mds_handler_skl_sse(void); void mds_handler_skl_avx(void); void mds_handler_skl_avx512(void); void mds_handler_silvermont(void); +void (*mds_handler)(void) = mds_handler_void; static int sysctl_hw_mds_disable_state_handler(SYSCTL_HANDLER_ARGS) From owner-svn-src-all@freebsd.org Thu Jul 11 17:35:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D346315D9990; Thu, 11 Jul 2019 17:35:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7696E8977A; Thu, 11 Jul 2019 17:35:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id BF3311891F; Thu, 11 Jul 2019 17:35:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r349893 - in head/sys: modules/tcp/rack netinet netinet/tcp_stacks sys To: Randall Stewart Cc: Randall Ray Stewart , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201907102040.x6AKeern006731@repo.freebsd.org> <4cdc824e-7e71-731d-50d4-c3f6231f9858@FreeBSD.org> <7695E2FC-406D-46CE-88F2-0690B9AAA36D@netflix.com> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Thu, 11 Jul 2019 10:35:18 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <7695E2FC-406D-46CE-88F2-0690B9AAA36D@netflix.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7696E8977A X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.92 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.92)[-0.915,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 17:35:21 -0000 On 7/10/19 9:48 PM, Randall Stewart wrote: > John: > > Thanks for the suggestions.. I have committed changes to the two > nits. As to M_PROTO1, I see that in the NF world we have removed > M_PROTO12 and moved the M_PROTO’s up 1 i.e. M_PROTO1 == 0x2000 > > So for now it is safe, since the M_TSTMP_LRO is not yet used.. but in > my up and coming commits I will have to address this i.e. either do > the same thing or just make it use M_PROTO12. > > There are a couple of places M_PROTO1 is used on the receive path > so that would not work there :o > > After I get the DSACK fixes in my next change to get BBR in will > be the LRO work… > > So maybe I should just settle on using M_PROTO12 for that > what do you think? If M_PROTO12 isn't used in the tree, then the approach we've used in the past is to bump up the M_PROTO values by one as in the NF tree. -- John Baldwin From owner-svn-src-all@freebsd.org Thu Jul 11 19:07:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C095A15DB772; Thu, 11 Jul 2019 19:07:46 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 614078CFDC; Thu, 11 Jul 2019 19:07:46 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 351152F9B; Thu, 11 Jul 2019 19:07:46 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BJ7kff002651; Thu, 11 Jul 2019 19:07:46 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BJ7jG8002650; Thu, 11 Jul 2019 19:07:45 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907111907.x6BJ7jG8002650@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Thu, 11 Jul 2019 19:07:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349914 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349914 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 614078CFDC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 19:07:47 -0000 Author: seanc (ports committer) Date: Thu Jul 11 19:07:45 2019 New Revision: 349914 URL: https://svnweb.freebsd.org/changeset/base/349914 Log: usr.sbin/bhyve: free resources if there is an initialization error in rfb Coverity CID: 1357335 Approved by: markj, jhb Differential Revision: https://reviews.freebsd.org/D20919 Modified: head/usr.sbin/bhyve/pci_fbuf.c head/usr.sbin/bhyve/rfb.c Modified: head/usr.sbin/bhyve/pci_fbuf.c ============================================================================== --- head/usr.sbin/bhyve/pci_fbuf.c Thu Jul 11 16:22:49 2019 (r349913) +++ head/usr.sbin/bhyve/pci_fbuf.c Thu Jul 11 19:07:45 2019 (r349914) @@ -231,9 +231,7 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o ret = 0; uopts = strdup(opts); - for (xopts = strtok(uopts, ","); - xopts != NULL; - xopts = strtok(NULL, ",")) { + while ((xopts = strsep(&uopts, ",")) != NULL) { if (strcmp(xopts, "wait") == 0) { sc->rfb_wait = 1; continue; @@ -260,7 +258,7 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o if (config) { if (tmpstr[0] == '[') tmpstr++; - sc->rfb_host = tmpstr; + sc->rfb_host = strdup(tmpstr); if (config[0] == ':') config++; else { @@ -276,7 +274,7 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o sc->rfb_port = atoi(tmpstr); else { sc->rfb_port = atoi(config); - sc->rfb_host = tmpstr; + sc->rfb_host = strdup(tmpstr); } } } else if (!strcmp(xopts, "vga")) { @@ -310,7 +308,7 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o } else if (sc->memregs.height == 0) sc->memregs.height = 1080; } else if (!strcmp(xopts, "password")) { - sc->rfb_password = config; + sc->rfb_password = strdup(config); } else { pci_fbuf_usage(xopts); ret = -1; @@ -319,6 +317,7 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o } done: + free(uopts); return (ret); } Modified: head/usr.sbin/bhyve/rfb.c ============================================================================== --- head/usr.sbin/bhyve/rfb.c Thu Jul 11 16:22:49 2019 (r349913) +++ head/usr.sbin/bhyve/rfb.c Thu Jul 11 19:07:45 2019 (r349914) @@ -969,7 +969,7 @@ rfb_init(char *hostname, int port, int wait, char *pas int e; char servname[6]; struct rfb_softc *rc; - struct addrinfo *ai; + struct addrinfo *ai = NULL; struct addrinfo hints; int on = 1; #ifndef WITHOUT_CAPSICUM @@ -984,6 +984,7 @@ rfb_init(char *hostname, int port, int wait, char *pas sizeof(uint32_t)); rc->crc_width = RFB_MAX_WIDTH; rc->crc_height = RFB_MAX_HEIGHT; + rc->sfd = -1; rc->password = password; @@ -1003,28 +1004,25 @@ rfb_init(char *hostname, int port, int wait, char *pas if ((e = getaddrinfo(hostname, servname, &hints, &ai)) != 0) { fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(e)); - return(-1); + goto error; } rc->sfd = socket(ai->ai_family, ai->ai_socktype, 0); if (rc->sfd < 0) { perror("socket"); - freeaddrinfo(ai); - return (-1); + goto error; } setsockopt(rc->sfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); if (bind(rc->sfd, ai->ai_addr, ai->ai_addrlen) < 0) { perror("bind"); - freeaddrinfo(ai); - return (-1); + goto error; } if (listen(rc->sfd, 1) < 0) { perror("listen"); - freeaddrinfo(ai); - return (-1); + goto error; } #ifndef WITHOUT_CAPSICUM @@ -1053,4 +1051,14 @@ rfb_init(char *hostname, int port, int wait, char *pas freeaddrinfo(ai); return (0); + + error: + if (ai != NULL) + freeaddrinfo(ai); + if (rc->sfd != -1) + close(rc->sfd); + free(rc->crc); + free(rc->crc_tmp); + free(rc); + return (-1); } From owner-svn-src-all@freebsd.org Thu Jul 11 19:26:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C3F815DC002; Thu, 11 Jul 2019 19:26:36 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0DD648DC89; Thu, 11 Jul 2019 19:26:36 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D164D3366; Thu, 11 Jul 2019 19:26:35 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BJQZ2Z012737; Thu, 11 Jul 2019 19:26:35 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BJQZca012736; Thu, 11 Jul 2019 19:26:35 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907111926.x6BJQZca012736@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Thu, 11 Jul 2019 19:26:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349915 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349915 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0DD648DC89 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.937,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 19:26:36 -0000 Author: seanc (ports committer) Date: Thu Jul 11 19:26:35 2019 New Revision: 349915 URL: https://svnweb.freebsd.org/changeset/base/349915 Log: usr.sbin/bhyve: initialize return value in xhci device interrupt handler Coverity CID: 1357340 Approved by: scottl, markj Differential Revision: https://reviews.freebsd.org/D20917 Modified: head/usr.sbin/bhyve/pci_xhci.c Modified: head/usr.sbin/bhyve/pci_xhci.c ============================================================================== --- head/usr.sbin/bhyve/pci_xhci.c Thu Jul 11 19:07:45 2019 (r349914) +++ head/usr.sbin/bhyve/pci_xhci.c Thu Jul 11 19:26:35 2019 (r349915) @@ -2544,7 +2544,7 @@ pci_xhci_dev_intr(struct usb_hci *hci, int epctx) struct pci_xhci_softc *sc; struct pci_xhci_portregs *p; struct xhci_endp_ctx *ep_ctx; - int error; + int error = 0; int dir_in; int epid; From owner-svn-src-all@freebsd.org Thu Jul 11 19:36:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE81115DC306; Thu, 11 Jul 2019 19:36:15 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 84F8B8E262; Thu, 11 Jul 2019 19:36:15 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C3EE36E8; Thu, 11 Jul 2019 19:36:15 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BJaFLF018086; Thu, 11 Jul 2019 19:36:15 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BJaFCl018085; Thu, 11 Jul 2019 19:36:15 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907111936.x6BJaFCl018085@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 11 Jul 2019 19:36:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349916 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349916 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 84F8B8E262 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.937,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 19:36:16 -0000 Author: cy Date: Thu Jul 11 19:36:14 2019 New Revision: 349916 URL: https://svnweb.freebsd.org/changeset/base/349916 Log: Correct r349898. The default is add a rule. MFC after: 1 week X-MFC with: r349898 Modified: head/sys/contrib/ipfilter/netinet/fil.c Modified: head/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/fil.c Thu Jul 11 19:26:35 2019 (r349915) +++ head/sys/contrib/ipfilter/netinet/fil.c Thu Jul 11 19:36:14 2019 (r349916) @@ -4473,11 +4473,10 @@ frrequest(softc, unit, req, data, set, makecopy) caddr_t data; { int error = 0, in, family, need_free = 0; - enum { OP_UNDEF, /* undefined */ - OP_ADD, /* add rule */ - OP_REM, /* remove rule */ - OP_ZERO /* zero statistics and counters */ } - addrem = OP_UNDEF; + enum { OP_ADD, /* add rule */ + OP_REM, /* remove rule */ + OP_ZERO /* zero statistics and counters */ } + addrem = OP_ADD; frentry_t frd, *fp, *f, **fprev, **ftail; void *ptr, *uptr, *cptr; u_int *p, *pp; @@ -4583,7 +4582,7 @@ frrequest(softc, unit, req, data, set, makecopy) goto donenolock; } - if (addrem == OP_UNDEF) { + if (addrem == OP_ADD) { error = ipf_funcinit(softc, fp); if (error != 0) goto donenolock; @@ -4647,7 +4646,7 @@ frrequest(softc, unit, req, data, set, makecopy) * them to be created if they don't already exit. */ group = FR_NAME(fp, fr_group); - if (addrem == OP_UNDEF) { + if (addrem == OP_ADD) { fg = ipf_group_add(softc, group, NULL, fp->fr_flags, unit, set); fp->fr_grp = fg; @@ -5111,7 +5110,7 @@ frrequest(softc, unit, req, data, set, makecopy) if (fp->fr_next != NULL) fp->fr_next->fr_pnext = &fp->fr_next; *ftail = fp; - if (addrem == OP_UNDEF) + if (addrem == OP_ADD) ipf_fixskip(ftail, fp, 1); fp->fr_icmpgrp = NULL; From owner-svn-src-all@freebsd.org Thu Jul 11 19:36:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32DD015DC344; Thu, 11 Jul 2019 19:36:19 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C84C48E26D; Thu, 11 Jul 2019 19:36:18 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 977F736E9; Thu, 11 Jul 2019 19:36:18 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BJaIZI018134; Thu, 11 Jul 2019 19:36:18 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BJaIPU018133; Thu, 11 Jul 2019 19:36:18 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907111936.x6BJaIPU018133@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 11 Jul 2019 19:36:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349917 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349917 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C84C48E26D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.937,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 19:36:19 -0000 Author: cy Date: Thu Jul 11 19:36:18 2019 New Revision: 349917 URL: https://svnweb.freebsd.org/changeset/base/349917 Log: Remove a tautological test for adding a rule in the block that adds rules. MFC after: 1 week Modified: head/sys/contrib/ipfilter/netinet/fil.c Modified: head/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/fil.c Thu Jul 11 19:36:14 2019 (r349916) +++ head/sys/contrib/ipfilter/netinet/fil.c Thu Jul 11 19:36:18 2019 (r349917) @@ -5110,8 +5110,7 @@ frrequest(softc, unit, req, data, set, makecopy) if (fp->fr_next != NULL) fp->fr_next->fr_pnext = &fp->fr_next; *ftail = fp; - if (addrem == OP_ADD) - ipf_fixskip(ftail, fp, 1); + ipf_fixskip(ftail, fp, 1); fp->fr_icmpgrp = NULL; if (fp->fr_icmphead != -1) { From owner-svn-src-all@freebsd.org Thu Jul 11 19:41:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8A2615DC530; Thu, 11 Jul 2019 19:41:15 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8A43A8E6A7; Thu, 11 Jul 2019 19:41:15 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5ED0C3724; Thu, 11 Jul 2019 19:41:15 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BJfFK0019092; Thu, 11 Jul 2019 19:41:15 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BJfFpA019091; Thu, 11 Jul 2019 19:41:15 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907111941.x6BJfFpA019091@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Thu, 11 Jul 2019 19:41:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349918 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349918 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8A43A8E6A7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.937,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 19:41:16 -0000 Author: seanc (ports committer) Date: Thu Jul 11 19:41:14 2019 New Revision: 349918 URL: https://svnweb.freebsd.org/changeset/base/349918 Log: usr.sbin/bhyve: free leaked memory during option parsing Also update to use strsep(3) instead of strtok(3). Most of this commit inadvertently ended up in r349914. Coverity CID: 1357337 Approved by: markj PR: 233038 Differential Revision: https://reviews.freebsd.org/D20918 Modified: head/usr.sbin/bhyve/pci_fbuf.c Modified: head/usr.sbin/bhyve/pci_fbuf.c ============================================================================== --- head/usr.sbin/bhyve/pci_fbuf.c Thu Jul 11 19:36:18 2019 (r349917) +++ head/usr.sbin/bhyve/pci_fbuf.c Thu Jul 11 19:41:14 2019 (r349918) @@ -317,7 +317,7 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *o } done: - free(uopts); + free(uoptsbak); return (ret); } From owner-svn-src-all@freebsd.org Thu Jul 11 19:51:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C09415DC9A6; Thu, 11 Jul 2019 19:51:34 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2CF1E8ED95; Thu, 11 Jul 2019 19:51:34 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 070B23AB5; Thu, 11 Jul 2019 19:51:34 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BJpXU7025908; Thu, 11 Jul 2019 19:51:33 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BJpXFu025907; Thu, 11 Jul 2019 19:51:33 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907111951.x6BJpXFu025907@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Thu, 11 Jul 2019 19:51:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349919 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349919 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2CF1E8ED95 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.937,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 19:51:34 -0000 Author: seanc (ports committer) Date: Thu Jul 11 19:51:33 2019 New Revision: 349919 URL: https://svnweb.freebsd.org/changeset/base/349919 Log: usr.sbin/bhyve: commit miss from r349918 Submitted by: markj Approved by: markj Differential Revision: https://reviews.freebsd.org/D20918 Modified: head/usr.sbin/bhyve/pci_fbuf.c Modified: head/usr.sbin/bhyve/pci_fbuf.c ============================================================================== --- head/usr.sbin/bhyve/pci_fbuf.c Thu Jul 11 19:41:14 2019 (r349918) +++ head/usr.sbin/bhyve/pci_fbuf.c Thu Jul 11 19:51:33 2019 (r349919) @@ -225,12 +225,12 @@ pci_fbuf_read(struct vmctx *ctx, int vcpu, struct pci_ static int pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, char *opts) { - char *uopts, *xopts, *config; + char *uopts, *uoptsbak, *xopts, *config; char *tmpstr; int ret; ret = 0; - uopts = strdup(opts); + uoptsbak = uopts = strdup(opts); while ((xopts = strsep(&uopts, ",")) != NULL) { if (strcmp(xopts, "wait") == 0) { sc->rfb_wait = 1; From owner-svn-src-all@freebsd.org Thu Jul 11 20:13:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC4FA15DCDF7; Thu, 11 Jul 2019 20:13:52 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5E6538FA26; Thu, 11 Jul 2019 20:13:52 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 392A13EBC; Thu, 11 Jul 2019 20:13:52 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BKDqb5038464; Thu, 11 Jul 2019 20:13:52 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BKDqMx038463; Thu, 11 Jul 2019 20:13:52 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201907112013.x6BKDqMx038463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Thu, 11 Jul 2019 20:13:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349920 - stable/12/sys/dev/netmap X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/12/sys/dev/netmap X-SVN-Commit-Revision: 349920 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5E6538FA26 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.93)[-0.929,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 20:13:52 -0000 Author: vmaffione Date: Thu Jul 11 20:13:51 2019 New Revision: 349920 URL: https://svnweb.freebsd.org/changeset/base/349920 Log: MFC r349752 netmap: fix kernel pointer printing in netmap_generic.c Print the adapter name rather than the address of the adapter to avoid kernel address leakage. PR: Bug 238642 Submitted by: Fuqian Huang Reviewed by: vmaffione Modified: stable/12/sys/dev/netmap/netmap_generic.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/netmap/netmap_generic.c ============================================================================== --- stable/12/sys/dev/netmap/netmap_generic.c Thu Jul 11 19:51:33 2019 (r349919) +++ stable/12/sys/dev/netmap/netmap_generic.c Thu Jul 11 20:13:51 2019 (r349920) @@ -1024,7 +1024,7 @@ generic_netmap_dtor(struct netmap_adapter *na) */ netmap_adapter_put(prev_na); } - nm_prinf("Native netmap adapter %p restored", prev_na); + nm_prinf("Native netmap adapter for %s restored", prev_na->name); } NM_RESTORE_NA(ifp, prev_na); /* @@ -1126,7 +1126,7 @@ generic_netmap_attach(struct ifnet *ifp) nm_os_generic_set_features(gna); - nm_prinf("Emulated adapter for %s created (prev was %p)", na->name, gna->prev); + nm_prinf("Emulated adapter for %s created (prev was %s)", na->name, gna->prev->name); return retval; } From owner-svn-src-all@freebsd.org Thu Jul 11 20:15:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37B5415DCE88; Thu, 11 Jul 2019 20:15:01 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D32A18FB92; Thu, 11 Jul 2019 20:15:00 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8278A3EBE; Thu, 11 Jul 2019 20:15:00 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BKF056038589; Thu, 11 Jul 2019 20:15:00 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BKF0br038588; Thu, 11 Jul 2019 20:15:00 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201907112015.x6BKF0br038588@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Thu, 11 Jul 2019 20:15:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349921 - stable/12/sys/dev/netmap X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/12/sys/dev/netmap X-SVN-Commit-Revision: 349921 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D32A18FB92 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.93)[-0.929,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 20:15:01 -0000 Author: vmaffione Date: Thu Jul 11 20:14:59 2019 New Revision: 349921 URL: https://svnweb.freebsd.org/changeset/base/349921 Log: MFC r349753 netmap: Remove pointer leakage in netmap_mem2.c PR: 238641 Submitted by: Fuqian Huang Reviewed by: vmaffione Modified: stable/12/sys/dev/netmap/netmap_mem2.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/netmap/netmap_mem2.c ============================================================================== --- stable/12/sys/dev/netmap/netmap_mem2.c Thu Jul 11 20:13:51 2019 (r349920) +++ stable/12/sys/dev/netmap/netmap_mem2.c Thu Jul 11 20:14:59 2019 (r349921) @@ -2446,8 +2446,8 @@ netmap_mem_pt_guest_ifp_del(struct netmap_mem_d *nmd, } else { ptnmd->pt_ifs = curr->next; } - nm_prinf("removed (ifp=%p,nifp_offset=%u)", - curr->ifp, curr->nifp_offset); + nm_prinf("removed (ifp=%s,nifp_offset=%u)", + curr->ifp->if_xname, curr->nifp_offset); nm_os_free(curr); ret = 0; break; From owner-svn-src-all@freebsd.org Thu Jul 11 20:29:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9502415DD262; Thu, 11 Jul 2019 20:29:51 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 370E7684D6; Thu, 11 Jul 2019 20:29:51 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1295B409F; Thu, 11 Jul 2019 20:29:51 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BKTovE044033; Thu, 11 Jul 2019 20:29:50 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BKTo21044032; Thu, 11 Jul 2019 20:29:50 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201907112029.x6BKTo21044032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Thu, 11 Jul 2019 20:29:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349922 - stable/11/sys/dev/netmap X-SVN-Group: stable-11 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/11/sys/dev/netmap X-SVN-Commit-Revision: 349922 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 370E7684D6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.952,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 20:29:51 -0000 Author: vmaffione Date: Thu Jul 11 20:29:50 2019 New Revision: 349922 URL: https://svnweb.freebsd.org/changeset/base/349922 Log: MFC r349752 netmap: fix kernel pointer printing in netmap_generic.c Print the adapter name rather than the address of the adapter to avoid kernel address leakage. PR: Bug 238642 Submitted by: Fuqian Huang Reviewed by: vmaffione Modified: stable/11/sys/dev/netmap/netmap_generic.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/netmap/netmap_generic.c ============================================================================== --- stable/11/sys/dev/netmap/netmap_generic.c Thu Jul 11 20:14:59 2019 (r349921) +++ stable/11/sys/dev/netmap/netmap_generic.c Thu Jul 11 20:29:50 2019 (r349922) @@ -1022,7 +1022,7 @@ generic_netmap_dtor(struct netmap_adapter *na) */ netmap_adapter_put(prev_na); } - nm_prinf("Native netmap adapter %p restored", prev_na); + nm_prinf("Native netmap adapter for %s restored", prev_na->name); } NM_RESTORE_NA(ifp, prev_na); /* @@ -1124,7 +1124,7 @@ generic_netmap_attach(struct ifnet *ifp) nm_os_generic_set_features(gna); - nm_prinf("Emulated adapter for %s created (prev was %p)", na->name, gna->prev); + nm_prinf("Emulated adapter for %s created (prev was %s)", na->name, gna->prev->name); return retval; } From owner-svn-src-all@freebsd.org Thu Jul 11 20:52:40 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3422215DDBA5; Thu, 11 Jul 2019 20:52:40 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CCC596A917; Thu, 11 Jul 2019 20:52:39 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C11645B9; Thu, 11 Jul 2019 20:52:39 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BKqdUD059193; Thu, 11 Jul 2019 20:52:39 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BKqdFX059192; Thu, 11 Jul 2019 20:52:39 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201907112052.x6BKqdFX059192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Thu, 11 Jul 2019 20:52:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349923 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 349923 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CCC596A917 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 20:52:40 -0000 Author: dougm Date: Thu Jul 11 20:52:39 2019 New Revision: 349923 URL: https://svnweb.freebsd.org/changeset/base/349923 Log: Address problems in blist_alloc introduced in r349777. The swap block allocator could become corrupted if a retry to allocate swap space, after a larger allocation attempt failed, allocated a smaller set of free blocks that ended on a 32- or 64-block boundary. Add tests to detect this kind of failure-to-extend-at-boundary and prevent the associated accounting screwup. Reported by: pho Tested by: pho Reviewed by: alc Approved by: markj (mentor) Discussed with: kib Differential Revision: https://reviews.freebsd.org/D20893 Modified: head/sys/kern/subr_blist.c Modified: head/sys/kern/subr_blist.c ============================================================================== --- head/sys/kern/subr_blist.c Thu Jul 11 20:29:50 2019 (r349922) +++ head/sys/kern/subr_blist.c Thu Jul 11 20:52:39 2019 (r349923) @@ -639,15 +639,27 @@ blst_next_leaf_alloc(blmeta_t *scan, daddr_t start, in * bitpos() returns zero here. */ avail = blk - start + bitpos(~scan->bm_bitmap); - if (avail < count) { + if (avail < count || avail == 0) { /* * There isn't a next leaf with enough free - * blocks at its beginning to complete the - * spanning allocation. + * blocks at its beginning to bother + * allocating. */ return (avail); } maxcount = imin(avail, maxcount); + if (maxcount % BLIST_BMAP_RADIX == 0) { + /* + * There was no next leaf. Back scan up to + * last leaf. + */ + --scan; + while (radix != BLIST_BMAP_RADIX) { + radix /= BLIST_META_RADIX; + --scan; + } + blk -= BLIST_BMAP_RADIX; + } } } From owner-svn-src-all@freebsd.org Thu Jul 11 22:07:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA26815DF33B; Thu, 11 Jul 2019 22:07:00 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6D0256D4E4; Thu, 11 Jul 2019 22:07:00 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C4C95190; Thu, 11 Jul 2019 22:07:00 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BM70wa095494; Thu, 11 Jul 2019 22:07:00 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BM6xrI095488; Thu, 11 Jul 2019 22:06:59 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201907112206.x6BM6xrI095488@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Thu, 11 Jul 2019 22:06:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349924 - in head/lib/libsecureboot: . openpgp X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: in head/lib/libsecureboot: . openpgp X-SVN-Commit-Revision: 349924 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6D0256D4E4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.943,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 22:07:01 -0000 Author: sjg Date: Thu Jul 11 22:06:59 2019 New Revision: 349924 URL: https://svnweb.freebsd.org/changeset/base/349924 Log: libsecureboot: avoid recusion in ve_trust_init set our guard value immediately. also replace call to ve_trust_init in opgp_sig.c:initialize with call to openpgp_trust_init. Reported by: mindal@semihalf.com Reviewed by: jhibbits obrien MFC after: 1 week Modified: head/lib/libsecureboot/openpgp/opgp_sig.c head/lib/libsecureboot/vets.c Modified: head/lib/libsecureboot/openpgp/opgp_sig.c ============================================================================== --- head/lib/libsecureboot/openpgp/opgp_sig.c Thu Jul 11 20:52:39 2019 (r349923) +++ head/lib/libsecureboot/openpgp/opgp_sig.c Thu Jul 11 22:06:59 2019 (r349924) @@ -67,9 +67,7 @@ __FBSDID("$FreeBSD$"); void initialize (void) { -#ifdef _STANDALONE - ve_trust_init(); -#endif + openpgp_trust_init(); } #else Modified: head/lib/libsecureboot/vets.c ============================================================================== --- head/lib/libsecureboot/vets.c Thu Jul 11 20:52:39 2019 (r349923) +++ head/lib/libsecureboot/vets.c Thu Jul 11 22:06:59 2019 (r349924) @@ -345,7 +345,7 @@ ve_trust_init(void) if (once >= 0) return (once); - + once = 0; /* to be sure */ ve_utc_set(time(NULL)); #ifdef BUILD_UTC ve_utc_set(BUILD_UTC); /* just in case */ From owner-svn-src-all@freebsd.org Thu Jul 11 23:54:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4545815E14E6; Thu, 11 Jul 2019 23:54:51 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CD7B3715E0; Thu, 11 Jul 2019 23:54:50 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A83636468; Thu, 11 Jul 2019 23:54:50 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6BNsoLc051471; Thu, 11 Jul 2019 23:54:50 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6BNsoNP051470; Thu, 11 Jul 2019 23:54:50 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907112354.x6BNsoNP051470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Thu, 11 Jul 2019 23:54:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349925 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349925 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CD7B3715E0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2019 23:54:51 -0000 Author: seanc (ports committer) Date: Thu Jul 11 23:54:50 2019 New Revision: 349925 URL: https://svnweb.freebsd.org/changeset/base/349925 Log: usr.sbin/bhyve: send an initialized value to wake up blocking kqueue This is a no-op initialization because nothing reads this value. "This wasn't wrong previously, but this is more correct now." -imp Coverity CID: 1194307 Approved by: markj, imp, scottl Differential Revision: https://reviews.freebsd.org/D20921 Modified: head/usr.sbin/bhyve/mevent.c Modified: head/usr.sbin/bhyve/mevent.c ============================================================================== --- head/usr.sbin/bhyve/mevent.c Thu Jul 11 22:06:59 2019 (r349924) +++ head/usr.sbin/bhyve/mevent.c Thu Jul 11 23:54:50 2019 (r349925) @@ -119,7 +119,7 @@ mevent_pipe_read(int fd, enum ev_type type, void *para static void mevent_notify(void) { - char c; + char c = '\0'; /* * If calling from outside the i/o thread, write a byte on the From owner-svn-src-all@freebsd.org Fri Jul 12 00:35:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1AD715E20E2; Fri, 12 Jul 2019 00:35:44 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 78F037297F; Fri, 12 Jul 2019 00:35:44 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A0556B28; Fri, 12 Jul 2019 00:35:44 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C0Ziih071848; Fri, 12 Jul 2019 00:35:44 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C0ZijI071847; Fri, 12 Jul 2019 00:35:44 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907120035.x6C0ZijI071847@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 12 Jul 2019 00:35:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349926 - stable/12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: stable/12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349926 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 78F037297F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.92)[-0.917,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 00:35:45 -0000 Author: cy Date: Fri Jul 12 00:35:43 2019 New Revision: 349926 URL: https://svnweb.freebsd.org/changeset/base/349926 Log: MFC r348986: Register pfil hooks when VNET != vnet0. r302298, which virtualized ipf, assumed the pfil hook registration performed in ipf_modload() would take are of this. However ipf_modload() is only called when the ipl kld is loaded or when ipfilter is first called when it is statically linked into the kernel at build time. Prior to this, even though r302298 has been in the tree for a while, it has never been used. So, r302298 in reality begins now. PR: 212000 Reported by: ahsanb@ Modified: stable/12/sys/contrib/ipfilter/netinet/mlfk_ipl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/mlfk_ipl.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/mlfk_ipl.c Thu Jul 11 23:54:50 2019 (r349925) +++ stable/12/sys/contrib/ipfilter/netinet/mlfk_ipl.c Fri Jul 12 00:35:43 2019 (r349926) @@ -225,6 +225,9 @@ vnet_ipf_init(void) "" #endif ); + } else { + (void)ipf_pfil_hook(); + ipf_event_reg(); } } VNET_SYSINIT(vnet_ipf_init, SI_SUB_PROTO_FIREWALL, SI_ORDER_THIRD, From owner-svn-src-all@freebsd.org Fri Jul 12 00:50:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 306D615E247B; Fri, 12 Jul 2019 00:50:35 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CB1D97317A; Fri, 12 Jul 2019 00:50:34 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9ED776CF8; Fri, 12 Jul 2019 00:50:34 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C0oYpZ077306; Fri, 12 Jul 2019 00:50:34 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C0oYn8077303; Fri, 12 Jul 2019 00:50:34 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907120050.x6C0oYn8077303@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 12 Jul 2019 00:50:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349927 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349927 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CB1D97317A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.92)[-0.919,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 00:50:35 -0000 Author: cy Date: Fri Jul 12 00:50:33 2019 New Revision: 349927 URL: https://svnweb.freebsd.org/changeset/base/349927 Log: MFC r348987, r348989: Resolve IPv6 checksum errors with stateful inspection. According to PR/203585 this appears to have been broken by r235959, which predates the ipfilter 5.1.2 import into FreeBSD. The IPv6 checksum calculation is incorrect. To resolve this we call in6_cksum() to do the the heavy lifting for us, through a new function ipf_pcksum6(). Should we need to revisit this area again, a DTrace probe is added to aid with future debugging. Plus whitespace adjustments (r348989). PR: 203275, 203585 Differential Revision: https://reviews.freebsd.org/D20583 Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c stable/11/sys/contrib/ipfilter/netinet/ip_fil.h stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/contrib/ipfilter/netinet/fil.c stable/10/sys/contrib/ipfilter/netinet/ip_fil.h stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c stable/12/sys/contrib/ipfilter/netinet/fil.c stable/12/sys/contrib/ipfilter/netinet/ip_fil.h stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/10/ (props changed) stable/12/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/fil.c Fri Jul 12 00:35:43 2019 (r349926) +++ stable/11/sys/contrib/ipfilter/netinet/fil.c Fri Jul 12 00:50:33 2019 (r349927) @@ -3426,35 +3426,21 @@ fr_cksum(fin, ip, l4proto, l4hdr) sum += *sp++; sum += *sp++; /* ip_dst */ sum += *sp++; + slen = fin->fin_plen - off; + sum += htons(slen); #ifdef USE_INET6 } else if (IP_V(ip) == 6) { + mb_t *m; + + m = fin->fin_m; ip6 = (ip6_t *)ip; - hlen = sizeof(*ip6); - off = ((char *)fin->fin_dp - (char *)fin->fin_ip); - sp = (u_short *)&ip6->ip6_src; - sum += *sp++; /* ip6_src */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - /* This needs to be routing header aware. */ - sum += *sp++; /* ip6_dst */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; + off = ((caddr_t)ip6 - m->m_data) + sizeof(struct ip6_hdr); + int len = ntohs(ip6->ip6_plen) - (off - sizeof(*ip6)); + return(ipf_pcksum6(fin, ip6, off, len)); } else { return 0xffff; } #endif - slen = fin->fin_plen - off; - sum += htons(slen); switch (l4proto) { @@ -6649,6 +6635,12 @@ ipf_checkl4sum(fin) if ((fin->fin_flx & (FI_FRAG|FI_SHORT|FI_BAD)) != 0) return 1; + DT2(l4sumo, int, fin->fin_out, int, (int)fin->fin_p); + if (fin->fin_out == 1) { + fin->fin_cksum = FI_CK_SUMOK; + return 0; + } + csump = NULL; hdrsum = 0; dosum = 0; @@ -6700,7 +6692,11 @@ ipf_checkl4sum(fin) } #endif DT2(l4sums, u_short, hdrsum, u_short, sum); +#ifdef USE_INET6 + if (hdrsum == sum || (sum == 0 && fin->fin_p == IPPROTO_ICMPV6)) { +#else if (hdrsum == sum) { +#endif fin->fin_cksum = FI_CK_SUMOK; return 0; } Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Fri Jul 12 00:35:43 2019 (r349926) +++ stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Fri Jul 12 00:50:33 2019 (r349927) @@ -1835,6 +1835,10 @@ extern int ipf_matchicmpqueryreply __P((int, icmpinfo struct icmp *, int)); extern u_32_t ipf_newisn __P((fr_info_t *)); extern u_int ipf_pcksum __P((fr_info_t *, int, u_int)); +#ifdef USE_INET6 +extern u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, + u_int32_t, u_int32_t)); +#endif extern void ipf_rule_expire __P((ipf_main_softc_t *)); extern int ipf_scanlist __P((fr_info_t *, u_32_t)); extern frentry_t *ipf_srcgrpmap __P((fr_info_t *, u_32_t *)); Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Jul 12 00:35:43 2019 (r349926) +++ stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Jul 12 00:50:33 2019 (r349927) @@ -1447,3 +1447,56 @@ ipf_pcksum(fin, hlen, sum) sum2 = ~sum & 0xffff; return sum2; } + +#ifdef USE_INET6 +#ifdef _KERNEL +u_int +ipf_pcksum6(fin, ip6, off, len) + fr_info_t *fin; + ip6_t *ip6; + u_int32_t off; + u_int32_t len; +{ + struct mbuf *m; + int sum; + + m = fin->fin_m; + if (m->m_len < sizeof(struct ip6_hdr)) { + return 0xffff; + } + + sum = in6_cksum(m, ip6->ip6_nxt, off, len); + return(sum); +} +#else +u_int +ipf_pcksum6(fin, ip6, off, len) + fr_info_t *fin; + ip6_t *ip6; + u_int32_t off; + u_int32_t len; +{ + u_short *sp; + u_int sum; + + sp = (u_short *)&ip6->ip6_src; + sum = *sp++; /* ip6_src */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; /* ip6_dst */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + return(ipf_pcksum(fin, off, sum)); +} +#endif +#endif From owner-svn-src-all@freebsd.org Fri Jul 12 00:50:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1350415E2480; Fri, 12 Jul 2019 00:50:36 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AA78D7317E; Fri, 12 Jul 2019 00:50:35 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6DAAC6CFA; Fri, 12 Jul 2019 00:50:35 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C0oZvr077314; Fri, 12 Jul 2019 00:50:35 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C0oYvN077311; Fri, 12 Jul 2019 00:50:34 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907120050.x6C0oYvN077311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 12 Jul 2019 00:50:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349927 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349927 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AA78D7317E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.92)[-0.919,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 00:50:36 -0000 Author: cy Date: Fri Jul 12 00:50:33 2019 New Revision: 349927 URL: https://svnweb.freebsd.org/changeset/base/349927 Log: MFC r348987, r348989: Resolve IPv6 checksum errors with stateful inspection. According to PR/203585 this appears to have been broken by r235959, which predates the ipfilter 5.1.2 import into FreeBSD. The IPv6 checksum calculation is incorrect. To resolve this we call in6_cksum() to do the the heavy lifting for us, through a new function ipf_pcksum6(). Should we need to revisit this area again, a DTrace probe is added to aid with future debugging. Plus whitespace adjustments (r348989). PR: 203275, 203585 Differential Revision: https://reviews.freebsd.org/D20583 Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c stable/12/sys/contrib/ipfilter/netinet/ip_fil.h stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/contrib/ipfilter/netinet/fil.c stable/10/sys/contrib/ipfilter/netinet/ip_fil.h stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c stable/11/sys/contrib/ipfilter/netinet/fil.c stable/11/sys/contrib/ipfilter/netinet/ip_fil.h stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/fil.c Fri Jul 12 00:35:43 2019 (r349926) +++ stable/12/sys/contrib/ipfilter/netinet/fil.c Fri Jul 12 00:50:33 2019 (r349927) @@ -3426,35 +3426,21 @@ fr_cksum(fin, ip, l4proto, l4hdr) sum += *sp++; sum += *sp++; /* ip_dst */ sum += *sp++; + slen = fin->fin_plen - off; + sum += htons(slen); #ifdef USE_INET6 } else if (IP_V(ip) == 6) { + mb_t *m; + + m = fin->fin_m; ip6 = (ip6_t *)ip; - hlen = sizeof(*ip6); - off = ((char *)fin->fin_dp - (char *)fin->fin_ip); - sp = (u_short *)&ip6->ip6_src; - sum += *sp++; /* ip6_src */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - /* This needs to be routing header aware. */ - sum += *sp++; /* ip6_dst */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; + off = ((caddr_t)ip6 - m->m_data) + sizeof(struct ip6_hdr); + int len = ntohs(ip6->ip6_plen) - (off - sizeof(*ip6)); + return(ipf_pcksum6(fin, ip6, off, len)); } else { return 0xffff; } #endif - slen = fin->fin_plen - off; - sum += htons(slen); switch (l4proto) { @@ -6649,6 +6635,12 @@ ipf_checkl4sum(fin) if ((fin->fin_flx & (FI_FRAG|FI_SHORT|FI_BAD)) != 0) return 1; + DT2(l4sumo, int, fin->fin_out, int, (int)fin->fin_p); + if (fin->fin_out == 1) { + fin->fin_cksum = FI_CK_SUMOK; + return 0; + } + csump = NULL; hdrsum = 0; dosum = 0; @@ -6700,7 +6692,11 @@ ipf_checkl4sum(fin) } #endif DT2(l4sums, u_short, hdrsum, u_short, sum); +#ifdef USE_INET6 + if (hdrsum == sum || (sum == 0 && fin->fin_p == IPPROTO_ICMPV6)) { +#else if (hdrsum == sum) { +#endif fin->fin_cksum = FI_CK_SUMOK; return 0; } Modified: stable/12/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Fri Jul 12 00:35:43 2019 (r349926) +++ stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Fri Jul 12 00:50:33 2019 (r349927) @@ -1835,6 +1835,10 @@ extern int ipf_matchicmpqueryreply __P((int, icmpinfo struct icmp *, int)); extern u_32_t ipf_newisn __P((fr_info_t *)); extern u_int ipf_pcksum __P((fr_info_t *, int, u_int)); +#ifdef USE_INET6 +extern u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, + u_int32_t, u_int32_t)); +#endif extern void ipf_rule_expire __P((ipf_main_softc_t *)); extern int ipf_scanlist __P((fr_info_t *, u_32_t)); extern frentry_t *ipf_srcgrpmap __P((fr_info_t *, u_32_t *)); Modified: stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Jul 12 00:35:43 2019 (r349926) +++ stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Jul 12 00:50:33 2019 (r349927) @@ -1447,3 +1447,56 @@ ipf_pcksum(fin, hlen, sum) sum2 = ~sum & 0xffff; return sum2; } + +#ifdef USE_INET6 +#ifdef _KERNEL +u_int +ipf_pcksum6(fin, ip6, off, len) + fr_info_t *fin; + ip6_t *ip6; + u_int32_t off; + u_int32_t len; +{ + struct mbuf *m; + int sum; + + m = fin->fin_m; + if (m->m_len < sizeof(struct ip6_hdr)) { + return 0xffff; + } + + sum = in6_cksum(m, ip6->ip6_nxt, off, len); + return(sum); +} +#else +u_int +ipf_pcksum6(fin, ip6, off, len) + fr_info_t *fin; + ip6_t *ip6; + u_int32_t off; + u_int32_t len; +{ + u_short *sp; + u_int sum; + + sp = (u_short *)&ip6->ip6_src; + sum = *sp++; /* ip6_src */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; /* ip6_dst */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + return(ipf_pcksum(fin, off, sum)); +} +#endif +#endif From owner-svn-src-all@freebsd.org Fri Jul 12 00:50:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD75C15E2485; Fri, 12 Jul 2019 00:50:36 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 62D2D73187; Fri, 12 Jul 2019 00:50:36 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3E84F6CFC; Fri, 12 Jul 2019 00:50:36 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C0oa5s077322; Fri, 12 Jul 2019 00:50:36 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C0oZXx077319; Fri, 12 Jul 2019 00:50:35 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907120050.x6C0oZXx077319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 12 Jul 2019 00:50:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r349927 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-10 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349927 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 62D2D73187 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.92)[-0.919,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 00:50:37 -0000 Author: cy Date: Fri Jul 12 00:50:33 2019 New Revision: 349927 URL: https://svnweb.freebsd.org/changeset/base/349927 Log: MFC r348987, r348989: Resolve IPv6 checksum errors with stateful inspection. According to PR/203585 this appears to have been broken by r235959, which predates the ipfilter 5.1.2 import into FreeBSD. The IPv6 checksum calculation is incorrect. To resolve this we call in6_cksum() to do the the heavy lifting for us, through a new function ipf_pcksum6(). Should we need to revisit this area again, a DTrace probe is added to aid with future debugging. Plus whitespace adjustments (r348989). PR: 203275, 203585 Differential Revision: https://reviews.freebsd.org/D20583 Modified: stable/10/sys/contrib/ipfilter/netinet/fil.c stable/10/sys/contrib/ipfilter/netinet/ip_fil.h stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c stable/11/sys/contrib/ipfilter/netinet/ip_fil.h stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c stable/12/sys/contrib/ipfilter/netinet/fil.c stable/12/sys/contrib/ipfilter/netinet/ip_fil.h stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/11/ (props changed) stable/12/ (props changed) Modified: stable/10/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/fil.c Fri Jul 12 00:35:43 2019 (r349926) +++ stable/10/sys/contrib/ipfilter/netinet/fil.c Fri Jul 12 00:50:33 2019 (r349927) @@ -3433,35 +3433,21 @@ fr_cksum(fin, ip, l4proto, l4hdr) sum += *sp++; sum += *sp++; /* ip_dst */ sum += *sp++; + slen = fin->fin_plen - off; + sum += htons(slen); #ifdef USE_INET6 } else if (IP_V(ip) == 6) { + mb_t *m; + + m = fin->fin_m; ip6 = (ip6_t *)ip; - hlen = sizeof(*ip6); - off = ((char *)fin->fin_dp - (char *)fin->fin_ip); - sp = (u_short *)&ip6->ip6_src; - sum += *sp++; /* ip6_src */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - /* This needs to be routing header aware. */ - sum += *sp++; /* ip6_dst */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; + off = ((caddr_t)ip6 - m->m_data) + sizeof(struct ip6_hdr); + int len = ntohs(ip6->ip6_plen) - (off - sizeof(*ip6)); + return(ipf_pcksum6(fin, ip6, off, len)); } else { return 0xffff; } #endif - slen = fin->fin_plen - off; - sum += htons(slen); switch (l4proto) { @@ -6662,6 +6648,12 @@ ipf_checkl4sum(fin) if ((fin->fin_flx & (FI_FRAG|FI_SHORT|FI_BAD)) != 0) return 1; + DT2(l4sumo, int, fin->fin_out, int, (int)fin->fin_p); + if (fin->fin_out == 1) { + fin->fin_cksum = FI_CK_SUMOK; + return 0; + } + csump = NULL; hdrsum = 0; dosum = 0; @@ -6713,7 +6705,11 @@ ipf_checkl4sum(fin) } #endif DT2(l4sums, u_short, hdrsum, u_short, sum); +#ifdef USE_INET6 + if (hdrsum == sum || (sum == 0 && fin->fin_p == IPPROTO_ICMPV6)) { +#else if (hdrsum == sum) { +#endif fin->fin_cksum = FI_CK_SUMOK; return 0; } Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_fil.h Fri Jul 12 00:35:43 2019 (r349926) +++ stable/10/sys/contrib/ipfilter/netinet/ip_fil.h Fri Jul 12 00:50:33 2019 (r349927) @@ -1903,6 +1903,10 @@ extern int ipf_matchicmpqueryreply __P((int, icmpinfo extern u_32_t ipf_newisn __P((fr_info_t *)); extern u_short ipf_nextipid __P((fr_info_t *)); extern u_int ipf_pcksum __P((fr_info_t *, int, u_int)); +#ifdef USE_INET6 +extern u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, + u_int32_t, u_int32_t)); +#endif extern void ipf_rule_expire __P((ipf_main_softc_t *)); extern int ipf_scanlist __P((fr_info_t *, u_32_t)); extern frentry_t *ipf_srcgrpmap __P((fr_info_t *, u_32_t *)); Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Jul 12 00:35:43 2019 (r349926) +++ stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Jul 12 00:50:33 2019 (r349927) @@ -1465,3 +1465,56 @@ ipf_pcksum(fin, hlen, sum) sum2 = ~sum & 0xffff; return sum2; } + +#ifdef USE_INET6 +#ifdef _KERNEL +u_int +ipf_pcksum6(fin, ip6, off, len) + fr_info_t *fin; + ip6_t *ip6; + u_int32_t off; + u_int32_t len; +{ + struct mbuf *m; + int sum; + + m = fin->fin_m; + if (m->m_len < sizeof(struct ip6_hdr)) { + return 0xffff; + } + + sum = in6_cksum(m, ip6->ip6_nxt, off, len); + return(sum); +} +#else +u_int +ipf_pcksum6(fin, ip6, off, len) + fr_info_t *fin; + ip6_t *ip6; + u_int32_t off; + u_int32_t len; +{ + u_short *sp; + u_int sum; + + sp = (u_short *)&ip6->ip6_src; + sum = *sp++; /* ip6_src */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; /* ip6_dst */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + return(ipf_pcksum(fin, off, sum)); +} +#endif +#endif From owner-svn-src-all@freebsd.org Fri Jul 12 00:54:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78C4715E2869; Fri, 12 Jul 2019 00:54:21 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1AC4A738BF; Fri, 12 Jul 2019 00:54:21 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E4636E98; Fri, 12 Jul 2019 00:54:21 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C0sKmB082458; Fri, 12 Jul 2019 00:54:20 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C0sK8F082457; Fri, 12 Jul 2019 00:54:20 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201907120054.x6C0sK8F082457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 12 Jul 2019 00:54:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349928 - in head/stand: efi/libefi libsa X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/stand: efi/libefi libsa X-SVN-Commit-Revision: 349928 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1AC4A738BF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.929,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 00:54:21 -0000 Author: jhibbits Date: Fri Jul 12 00:54:20 2019 New Revision: 349928 URL: https://svnweb.freebsd.org/changeset/base/349928 Log: Allow efi loader to get network params from uboot Summary: efi loader does not work with static network parameters. It always uses BOOTP/DHCP and also uses RARP as a fallback. Problems with DHCP servers can cause the loader to fail to populate network parameters. Submitted by: Siddharth Tuli Reviewed by: imp Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D20811 Modified: head/stand/efi/libefi/efinet.c head/stand/libsa/net.h Modified: head/stand/efi/libefi/efinet.c ============================================================================== --- head/stand/efi/libefi/efinet.c Fri Jul 12 00:50:33 2019 (r349927) +++ head/stand/efi/libefi/efinet.c Fri Jul 12 00:54:20 2019 (r349928) @@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include "dev_net.h" + static EFI_GUID sn_guid = EFI_SIMPLE_NETWORK_PROTOCOL; static void efinet_end(struct netif *); @@ -198,7 +200,75 @@ efinet_get(struct iodesc *desc, void **pkt, time_t tim return (ret); } +/* + * Loader uses BOOTP/DHCP and also uses RARP as a fallback to populate + * network parameters and problems with DHCP servers can cause the loader + * to fail to populate them. Allow the device to ask about the basic + * network parameters and if present use them. + */ static void +efi_env_net_params(struct iodesc *desc) +{ + char *envstr; + in_addr_t ipaddr, mask, gwaddr, serveraddr; + n_long rootaddr; + + if ((envstr = getenv("rootpath")) != NULL) + strlcpy(rootpath, envstr, sizeof(rootpath)); + + /* + * Get network parameters. + */ + envstr = getenv("ipaddr"); + ipaddr = (envstr != NULL) ? inet_addr(envstr) : 0; + + envstr = getenv("netmask"); + mask = (envstr != NULL) ? inet_addr(envstr) : 0; + + envstr = getenv("gatewayip"); + gwaddr = (envstr != NULL) ? inet_addr(envstr) : 0; + + envstr = getenv("serverip"); + serveraddr = (envstr != NULL) ? inet_addr(envstr) : 0; + + /* No network params. */ + if (ipaddr == 0 && mask == 0 && gwaddr == 0 && serveraddr == 0) + return; + + /* Partial network params. */ + if (ipaddr == 0 || mask == 0 || gwaddr == 0 || serveraddr == 0) { + printf("Incomplete network settings from U-Boot\n"); + return; + } + + /* + * Set network parameters. + */ + myip.s_addr = ipaddr; + netmask = mask; + gateip.s_addr = gwaddr; + servip.s_addr = serveraddr; + + /* + * There must be a rootpath. It may be ip:/path or it may be just the + * path in which case the ip needs to be serverip. + */ + rootaddr = net_parse_rootpath(); + if (rootaddr == INADDR_NONE) + rootaddr = serveraddr; + rootip.s_addr = rootaddr; + +#ifdef EFINET_DEBUG + printf("%s: ip=%s\n", __func__, inet_ntoa(myip)); + printf("%s: mask=%s\n", __func__, intoa(netmask)); + printf("%s: gateway=%s\n", __func__, inet_ntoa(gateip)); + printf("%s: server=%s\n", __func__, inet_ntoa(servip)); +#endif + + desc->myip = myip; +} + +static void efinet_init(struct iodesc *desc, void *machdep_hint) { struct netif *nif = desc->io_netif; @@ -206,6 +276,9 @@ efinet_init(struct iodesc *desc, void *machdep_hint) EFI_HANDLE h; EFI_STATUS status; UINT32 mask; + + /* Attempt to get netboot params from env */ + efi_env_net_params(desc); if (nif->nif_driver->netif_ifs[nif->nif_unit].dif_unit < 0) { printf("Invalid network interface %d\n", nif->nif_unit); Modified: head/stand/libsa/net.h ============================================================================== --- head/stand/libsa/net.h Fri Jul 12 00:50:33 2019 (r349927) +++ head/stand/libsa/net.h Fri Jul 12 00:54:20 2019 (r349928) @@ -91,6 +91,7 @@ extern struct in_addr rootip; extern struct in_addr swapip; extern struct in_addr gateip; extern struct in_addr nameip; +extern struct in_addr servip; extern n_long netmask; extern u_int intf_mtu; From owner-svn-src-all@freebsd.org Fri Jul 12 01:59:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4108015E397D; Fri, 12 Jul 2019 01:59:10 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D729B75BA3; Fri, 12 Jul 2019 01:59:09 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B1DFB78CA; Fri, 12 Jul 2019 01:59:09 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C1x9ee013301; Fri, 12 Jul 2019 01:59:09 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C1x9go013298; Fri, 12 Jul 2019 01:59:09 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907120159.x6C1x9go013298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 12 Jul 2019 01:59:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349929 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349929 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D729B75BA3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.929,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 01:59:10 -0000 Author: cy Date: Fri Jul 12 01:59:08 2019 New Revision: 349929 URL: https://svnweb.freebsd.org/changeset/base/349929 Log: Move the new ipf_pcksum6() function from ip_fil_freebsd.c to fil.c. The reason for this is that ipftest(8), which still works on FreeBSD-11, fails to link to it, breaking stable/11 builds. ipftest(8) was broken (segfault) sometime during the FreeBSD-12 cycle. glebius@ suggested we disable building it until I can get around to fixing it. Hence this was not caught in -current. The intention is to fix ipftest(8) as it is used by the netbsd-tests (imported by ngie@ many moons ago) for regression testing. MFC after: immediately Modified: head/sys/contrib/ipfilter/netinet/fil.c head/sys/contrib/ipfilter/netinet/ip_fil.h head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Modified: head/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/fil.c Fri Jul 12 00:54:20 2019 (r349928) +++ head/sys/contrib/ipfilter/netinet/fil.c Fri Jul 12 01:59:08 2019 (r349929) @@ -179,6 +179,10 @@ static int ipf_updateipid __P((fr_info_t *)); static int ipf_settimeout __P((struct ipf_main_softc_s *, struct ipftuneable *, ipftuneval_t *)); +#ifdef USE_INET6 +static u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, + u_int32_t, u_int32_t)); +#endif #if !defined(_KERNEL) || SOLARIS static int ppsratecheck(struct timeval *, int *, int); #endif @@ -10226,4 +10230,55 @@ ipf_inet6_mask_del(bits, mask, mtab) mtab->imt6_max--; ASSERT(mtab->imt6_max >= 0); } + +#ifdef _KERNEL +static u_int +ipf_pcksum6(fin, ip6, off, len) + fr_info_t *fin; + ip6_t *ip6; + u_int32_t off; + u_int32_t len; +{ + struct mbuf *m; + int sum; + + m = fin->fin_m; + if (m->m_len < sizeof(struct ip6_hdr)) { + return 0xffff; + } + + sum = in6_cksum(m, ip6->ip6_nxt, off, len); + return(sum); +} +#else +static u_int +ipf_pcksum6(fin, ip6, off, len) + fr_info_t *fin; + ip6_t *ip6; + u_int32_t off; + u_int32_t len; +{ + u_short *sp; + u_int sum; + + sp = (u_short *)&ip6->ip6_src; + sum = *sp++; /* ip6_src */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; /* ip6_dst */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + return(ipf_pcksum(fin, off, sum)); +} +#endif #endif Modified: head/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_fil.h Fri Jul 12 00:54:20 2019 (r349928) +++ head/sys/contrib/ipfilter/netinet/ip_fil.h Fri Jul 12 01:59:08 2019 (r349929) @@ -1835,10 +1835,6 @@ extern int ipf_matchicmpqueryreply __P((int, icmpinfo struct icmp *, int)); extern u_32_t ipf_newisn __P((fr_info_t *)); extern u_int ipf_pcksum __P((fr_info_t *, int, u_int)); -#ifdef USE_INET6 -extern u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, - u_int32_t, u_int32_t)); -#endif extern void ipf_rule_expire __P((ipf_main_softc_t *)); extern int ipf_scanlist __P((fr_info_t *, u_32_t)); extern frentry_t *ipf_srcgrpmap __P((fr_info_t *, u_32_t *)); Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Jul 12 00:54:20 2019 (r349928) +++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Jul 12 01:59:08 2019 (r349929) @@ -1446,56 +1446,3 @@ ipf_pcksum(fin, hlen, sum) sum2 = ~sum & 0xffff; return sum2; } - -#ifdef USE_INET6 -#ifdef _KERNEL -u_int -ipf_pcksum6(fin, ip6, off, len) - fr_info_t *fin; - ip6_t *ip6; - u_int32_t off; - u_int32_t len; -{ - struct mbuf *m; - int sum; - - m = fin->fin_m; - if (m->m_len < sizeof(struct ip6_hdr)) { - return 0xffff; - } - - sum = in6_cksum(m, ip6->ip6_nxt, off, len); - return(sum); -} -#else -u_int -ipf_pcksum6(fin, ip6, off, len) - fr_info_t *fin; - ip6_t *ip6; - u_int32_t off; - u_int32_t len; -{ - u_short *sp; - u_int sum; - - sp = (u_short *)&ip6->ip6_src; - sum = *sp++; /* ip6_src */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; /* ip6_dst */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - return(ipf_pcksum(fin, off, sum)); -} -#endif -#endif From owner-svn-src-all@freebsd.org Fri Jul 12 02:03:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5E0115E3BAF; Fri, 12 Jul 2019 02:03:44 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8587176045; Fri, 12 Jul 2019 02:03:44 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D22A7A6B; Fri, 12 Jul 2019 02:03:44 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C23imJ018527; Fri, 12 Jul 2019 02:03:44 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C23h9p018525; Fri, 12 Jul 2019 02:03:43 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201907120203.x6C23h9p018525@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Fri, 12 Jul 2019 02:03:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349930 - in stable/12: sbin/swapon share/man/man5 X-SVN-Group: stable-12 X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: in stable/12: sbin/swapon share/man/man5 X-SVN-Commit-Revision: 349930 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8587176045 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.92)[-0.919,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 02:03:45 -0000 Author: dougm Date: Fri Jul 12 02:03:43 2019 New Revision: 349930 URL: https://svnweb.freebsd.org/changeset/base/349930 Log: MFC r349286, r349293 Modify swapon(8) to invoke BIO_DELETE to trim swap devices, either if '-E' appears on the swapon command line, or if "trimonce" appears as an fstab option. Remove #include to fix a style(9) violation. Assisted by: alc Release notes: yes Approved by: kib (mentor) Modified: stable/12/sbin/swapon/swapon.8 stable/12/sbin/swapon/swapon.c stable/12/share/man/man5/fstab.5 Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/swapon/swapon.8 ============================================================================== --- stable/12/sbin/swapon/swapon.8 Fri Jul 12 01:59:08 2019 (r349929) +++ stable/12/sbin/swapon/swapon.8 Fri Jul 12 02:03:43 2019 (r349930) @@ -28,7 +28,7 @@ .\" @(#)swapon.8 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd October 21, 2016 +.Dd June 21, 2019 .Dt SWAPON 8 .Os .Sh NAME @@ -38,7 +38,7 @@ .Nm swapon .Oo Fl F Ar fstab .Oc -.Fl aLq | Ar +.Fl aLq | E Ar .Nm swapoff .Oo Fl F Ar fstab .Oc @@ -86,6 +86,11 @@ If the option is used, informational messages will not be written to standard output when a swap device is added. +The +.Fl E +option causes each of following devices to receive a +.Dv BIO_DELETE +command to mark all blocks as unused. .Pp The .Nm swapoff Modified: stable/12/sbin/swapon/swapon.c ============================================================================== --- stable/12/sbin/swapon/swapon.c Fri Jul 12 01:59:08 2019 (r349929) +++ stable/12/sbin/swapon/swapon.c Fri Jul 12 02:03:43 2019 (r349930) @@ -44,7 +44,7 @@ static char sccsid[] = "@(#)swapon.c 8.1 (Berkeley) 6/ __FBSDID("$FreeBSD$"); #include -#include +#include #include #include #include @@ -77,7 +77,7 @@ static int run_cmd(int *, const char *, ...) __printfl static enum { SWAPON, SWAPOFF, SWAPCTL } orig_prog, which_prog = SWAPCTL; -static int qflag; +static int Eflag, qflag; int main(int argc, char **argv) @@ -100,7 +100,7 @@ main(int argc, char **argv) doall = 0; etc_fstab = NULL; - while ((ch = getopt(argc, argv, "AadghklLmqsUF:")) != -1) { + while ((ch = getopt(argc, argv, "AadEghklLmqsUF:")) != -1) { switch(ch) { case 'A': if (which_prog == SWAPCTL) { @@ -121,6 +121,12 @@ main(int argc, char **argv) else usage(); break; + case 'E': + if (which_prog == SWAPON) + Eflag = 2; + else + usage(); + break; case 'g': hflag = 'G'; break; @@ -182,8 +188,10 @@ main(int argc, char **argv) strstr(fsp->fs_mntops, "late") == NULL && late != 0) continue; + Eflag |= (strstr(fsp->fs_mntops, "trimonce") != NULL); swfile = swap_on_off(fsp->fs_spec, 1, fsp->fs_mntops); + Eflag &= ~1; if (swfile == NULL) { ret = 1; continue; @@ -378,12 +386,22 @@ swap_on_geli_args(const char *mntops) return (NULL); } } else if (strcmp(token, "notrim") == 0) { + if (Eflag) { + warn("Options \"notrim\" and " + "\"trimonce\" conflict"); + free(ops); + return (NULL); + } Tflag = " -T "; } else if (strcmp(token, "late") == 0) { /* ignore known option */ } else if (strcmp(token, "noauto") == 0) { /* ignore known option */ - } else if (strcmp(token, "sw") != 0) { + } else if (strcmp(token, "sw") == 0) { + /* ignore known option */ + } else if (strcmp(token, "trimonce") == 0) { + /* ignore known option */ + } else { warnx("Invalid option: %s", token); free(ops); return (NULL); @@ -721,14 +739,42 @@ run_cmd(int *ofd, const char *cmdline, ...) return (WEXITSTATUS(status)); } +static void +swap_trim(const char *name) +{ + struct stat sb; + off_t ioarg[2], sz; + int fd; + + fd = open(name, O_WRONLY); + if (fd < 0) + errx(1, "Cannot open %s", name); + if (fstat(fd, &sb) < 0) + errx(1, "Cannot stat %s", name); + if (S_ISREG(sb.st_mode)) + sz = sb.st_size; + else if (S_ISCHR(sb.st_mode)) { + if (ioctl(fd, DIOCGMEDIASIZE, &sz) != 0) + err(1, "ioctl(DIOCGMEDIASIZE)"); + } else + errx(1, "%s has an invalid file type", name); + ioarg[0] = 0; + ioarg[1] = sz; + if (ioctl(fd, DIOCGDELETE, ioarg) != 0) + warn("ioctl(DIOCGDELETE)"); + close(fd); +} + static const char * swap_on_off_sfile(const char *name, int doingall) { int error; - if (which_prog == SWAPON) + if (which_prog == SWAPON) { + if (Eflag) + swap_trim(name); error = swapon(name); - else /* SWAPOFF */ + } else /* SWAPOFF */ error = swapoff(name); if (error == -1) { @@ -759,6 +805,8 @@ usage(void) fprintf(stderr, "usage: %s ", getprogname()); switch(orig_prog) { case SWAPON: + fprintf(stderr, "[-F fstab] -aLq | [-E] file ...\n"); + break; case SWAPOFF: fprintf(stderr, "[-F fstab] -aLq | file ...\n"); break; Modified: stable/12/share/man/man5/fstab.5 ============================================================================== --- stable/12/share/man/man5/fstab.5 Fri Jul 12 01:59:08 2019 (r349929) +++ stable/12/share/man/man5/fstab.5 Fri Jul 12 02:03:43 2019 (r349930) @@ -216,6 +216,12 @@ then the special file is made available as a piece of space by the .Xr swapon 8 command at the end of the system reboot procedure. +For swap devices, the keyword +.Dq trimonce +triggers the delivery of a +.Dv BIO_DELETE +command to the device to mark +all blocks as unused. For vnode-backed swap spaces, .Dq file is supported in the From owner-svn-src-all@freebsd.org Fri Jul 12 02:14:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7BB8515E3E0D; Fri, 12 Jul 2019 02:14:07 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 129E17659B; Fri, 12 Jul 2019 02:14:07 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC63E7C11; Fri, 12 Jul 2019 02:14:06 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C2E6FG023664; Fri, 12 Jul 2019 02:14:06 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C2E6xw023659; Fri, 12 Jul 2019 02:14:06 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907120214.x6C2E6xw023659@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 12 Jul 2019 02:14:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349931 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349931 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 129E17659B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.92)[-0.919,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 02:14:07 -0000 Author: cy Date: Fri Jul 12 02:14:05 2019 New Revision: 349931 URL: https://svnweb.freebsd.org/changeset/base/349931 Log: MFC r349927, r349929: r349927: Resolve IPv6 checksum errors with stateful inspection. According to PR/203585 this appears to have been broken by r235959, which predates the ipfilter 5.1.2 import into FreeBSD. The IPv6 checksum calculation is incorrect. To resolve this we call in6_cksum() to do the the heavy lifting for us, through a new function ipf_pcksum6(). Should we need to revisit this area again, a DTrace probe is added to aid with future debugging. Plus whitespace adjustments (r348989). PR: 203275, 203585 Differential Revision: https://reviews.freebsd.org/D20583 r349929: Move the new ipf_pcksum6() function from ip_fil_freebsd.c to fil.c. The reason for this is that ipftest(8), which still works on FreeBSD-11, fails to link to it, breaking stable/11 builds. ipftest(8) was broken (segfault) sometime during the FreeBSD-12 cycle. glebius@ suggested we disable building it until I can get around to fixing it. Hence this was not caught in -current. The intention is to fix ipftest(8) as it is used by the netbsd-tests (imported by ngie@ many moons ago) for regression testing. Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c stable/11/sys/contrib/ipfilter/netinet/ip_fil.h stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/contrib/ipfilter/netinet/fil.c stable/10/sys/contrib/ipfilter/netinet/ip_fil.h stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/fil.c Fri Jul 12 02:03:43 2019 (r349930) +++ stable/11/sys/contrib/ipfilter/netinet/fil.c Fri Jul 12 02:14:05 2019 (r349931) @@ -179,6 +179,10 @@ static int ipf_updateipid __P((fr_info_t *)); static int ipf_settimeout __P((struct ipf_main_softc_s *, struct ipftuneable *, ipftuneval_t *)); +#ifdef USE_INET6 +static u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, + u_int32_t, u_int32_t)); +#endif #if !defined(_KERNEL) || SOLARIS static int ppsratecheck(struct timeval *, int *, int); #endif @@ -10223,4 +10227,55 @@ ipf_inet6_mask_del(bits, mask, mtab) mtab->imt6_max--; ASSERT(mtab->imt6_max >= 0); } + +#ifdef _KERNEL +static u_int +ipf_pcksum6(fin, ip6, off, len) + fr_info_t *fin; + ip6_t *ip6; + u_int32_t off; + u_int32_t len; +{ + struct mbuf *m; + int sum; + + m = fin->fin_m; + if (m->m_len < sizeof(struct ip6_hdr)) { + return 0xffff; + } + + sum = in6_cksum(m, ip6->ip6_nxt, off, len); + return(sum); +} +#else +static u_int +ipf_pcksum6(fin, ip6, off, len) + fr_info_t *fin; + ip6_t *ip6; + u_int32_t off; + u_int32_t len; +{ + u_short *sp; + u_int sum; + + sp = (u_short *)&ip6->ip6_src; + sum = *sp++; /* ip6_src */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; /* ip6_dst */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + return(ipf_pcksum(fin, off, sum)); +} +#endif #endif Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Fri Jul 12 02:03:43 2019 (r349930) +++ stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Fri Jul 12 02:14:05 2019 (r349931) @@ -1835,10 +1835,6 @@ extern int ipf_matchicmpqueryreply __P((int, icmpinfo struct icmp *, int)); extern u_32_t ipf_newisn __P((fr_info_t *)); extern u_int ipf_pcksum __P((fr_info_t *, int, u_int)); -#ifdef USE_INET6 -extern u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, - u_int32_t, u_int32_t)); -#endif extern void ipf_rule_expire __P((ipf_main_softc_t *)); extern int ipf_scanlist __P((fr_info_t *, u_32_t)); extern frentry_t *ipf_srcgrpmap __P((fr_info_t *, u_32_t *)); Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Jul 12 02:03:43 2019 (r349930) +++ stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Jul 12 02:14:05 2019 (r349931) @@ -1447,56 +1447,3 @@ ipf_pcksum(fin, hlen, sum) sum2 = ~sum & 0xffff; return sum2; } - -#ifdef USE_INET6 -#ifdef _KERNEL -u_int -ipf_pcksum6(fin, ip6, off, len) - fr_info_t *fin; - ip6_t *ip6; - u_int32_t off; - u_int32_t len; -{ - struct mbuf *m; - int sum; - - m = fin->fin_m; - if (m->m_len < sizeof(struct ip6_hdr)) { - return 0xffff; - } - - sum = in6_cksum(m, ip6->ip6_nxt, off, len); - return(sum); -} -#else -u_int -ipf_pcksum6(fin, ip6, off, len) - fr_info_t *fin; - ip6_t *ip6; - u_int32_t off; - u_int32_t len; -{ - u_short *sp; - u_int sum; - - sp = (u_short *)&ip6->ip6_src; - sum = *sp++; /* ip6_src */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; /* ip6_dst */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - return(ipf_pcksum(fin, off, sum)); -} -#endif -#endif From owner-svn-src-all@freebsd.org Fri Jul 12 02:14:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5864815E3E13; Fri, 12 Jul 2019 02:14:08 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EE5557659C; Fri, 12 Jul 2019 02:14:07 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB2697C12; Fri, 12 Jul 2019 02:14:07 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C2E7ZY023672; Fri, 12 Jul 2019 02:14:07 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C2E7r8023669; Fri, 12 Jul 2019 02:14:07 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907120214.x6C2E7r8023669@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 12 Jul 2019 02:14:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r349931 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet X-SVN-Group: stable-10 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349931 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EE5557659C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.92)[-0.919,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 02:14:08 -0000 Author: cy Date: Fri Jul 12 02:14:05 2019 New Revision: 349931 URL: https://svnweb.freebsd.org/changeset/base/349931 Log: MFC r349927, r349929: r349927: Resolve IPv6 checksum errors with stateful inspection. According to PR/203585 this appears to have been broken by r235959, which predates the ipfilter 5.1.2 import into FreeBSD. The IPv6 checksum calculation is incorrect. To resolve this we call in6_cksum() to do the the heavy lifting for us, through a new function ipf_pcksum6(). Should we need to revisit this area again, a DTrace probe is added to aid with future debugging. Plus whitespace adjustments (r348989). PR: 203275, 203585 Differential Revision: https://reviews.freebsd.org/D20583 r349929: Move the new ipf_pcksum6() function from ip_fil_freebsd.c to fil.c. The reason for this is that ipftest(8), which still works on FreeBSD-11, fails to link to it, breaking stable/11 builds. ipftest(8) was broken (segfault) sometime during the FreeBSD-12 cycle. glebius@ suggested we disable building it until I can get around to fixing it. Hence this was not caught in -current. The intention is to fix ipftest(8) as it is used by the netbsd-tests (imported by ngie@ many moons ago) for regression testing. Modified: stable/10/sys/contrib/ipfilter/netinet/fil.c stable/10/sys/contrib/ipfilter/netinet/ip_fil.h stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c stable/11/sys/contrib/ipfilter/netinet/ip_fil.h stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/11/ (props changed) Modified: stable/10/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/fil.c Fri Jul 12 02:03:43 2019 (r349930) +++ stable/10/sys/contrib/ipfilter/netinet/fil.c Fri Jul 12 02:14:05 2019 (r349931) @@ -214,6 +214,10 @@ static int ipf_updateipid __P((fr_info_t *)); static int ipf_settimeout __P((struct ipf_main_softc_s *, struct ipftuneable *, ipftuneval_t *)); +#ifdef USE_INET6 +static u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, + u_int32_t, u_int32_t)); +#endif #if !defined(_KERNEL) || (!defined(__NetBSD__) && !defined(__OpenBSD__) && \ !defined(__FreeBSD__)) || \ FREEBSD_LT_REV(501000) || NETBSD_LT_REV(105000000) || \ @@ -10243,4 +10247,55 @@ ipf_inet6_mask_del(bits, mask, mtab) mtab->imt6_max--; ASSERT(mtab->imt6_max >= 0); } + +#ifdef _KERNEL +static u_int +ipf_pcksum6(fin, ip6, off, len) + fr_info_t *fin; + ip6_t *ip6; + u_int32_t off; + u_int32_t len; +{ + struct mbuf *m; + int sum; + + m = fin->fin_m; + if (m->m_len < sizeof(struct ip6_hdr)) { + return 0xffff; + } + + sum = in6_cksum(m, ip6->ip6_nxt, off, len); + return(sum); +} +#else +static u_int +ipf_pcksum6(fin, ip6, off, len) + fr_info_t *fin; + ip6_t *ip6; + u_int32_t off; + u_int32_t len; +{ + u_short *sp; + u_int sum; + + sp = (u_short *)&ip6->ip6_src; + sum = *sp++; /* ip6_src */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; /* ip6_dst */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + return(ipf_pcksum(fin, off, sum)); +} +#endif #endif Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_fil.h Fri Jul 12 02:03:43 2019 (r349930) +++ stable/10/sys/contrib/ipfilter/netinet/ip_fil.h Fri Jul 12 02:14:05 2019 (r349931) @@ -1903,10 +1903,6 @@ extern int ipf_matchicmpqueryreply __P((int, icmpinfo extern u_32_t ipf_newisn __P((fr_info_t *)); extern u_short ipf_nextipid __P((fr_info_t *)); extern u_int ipf_pcksum __P((fr_info_t *, int, u_int)); -#ifdef USE_INET6 -extern u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, - u_int32_t, u_int32_t)); -#endif extern void ipf_rule_expire __P((ipf_main_softc_t *)); extern int ipf_scanlist __P((fr_info_t *, u_32_t)); extern frentry_t *ipf_srcgrpmap __P((fr_info_t *, u_32_t *)); Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Jul 12 02:03:43 2019 (r349930) +++ stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Jul 12 02:14:05 2019 (r349931) @@ -1465,56 +1465,3 @@ ipf_pcksum(fin, hlen, sum) sum2 = ~sum & 0xffff; return sum2; } - -#ifdef USE_INET6 -#ifdef _KERNEL -u_int -ipf_pcksum6(fin, ip6, off, len) - fr_info_t *fin; - ip6_t *ip6; - u_int32_t off; - u_int32_t len; -{ - struct mbuf *m; - int sum; - - m = fin->fin_m; - if (m->m_len < sizeof(struct ip6_hdr)) { - return 0xffff; - } - - sum = in6_cksum(m, ip6->ip6_nxt, off, len); - return(sum); -} -#else -u_int -ipf_pcksum6(fin, ip6, off, len) - fr_info_t *fin; - ip6_t *ip6; - u_int32_t off; - u_int32_t len; -{ - u_short *sp; - u_int sum; - - sp = (u_short *)&ip6->ip6_src; - sum = *sp++; /* ip6_src */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; /* ip6_dst */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - return(ipf_pcksum(fin, off, sum)); -} -#endif -#endif From owner-svn-src-all@freebsd.org Fri Jul 12 02:15:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF5DB15E3F20; Fri, 12 Jul 2019 02:15:07 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 72B627690B; Fri, 12 Jul 2019 02:15:07 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 503DF7C16; Fri, 12 Jul 2019 02:15:07 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C2F76O023875; Fri, 12 Jul 2019 02:15:07 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C2F689023872; Fri, 12 Jul 2019 02:15:06 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201907120215.x6C2F689023872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 12 Jul 2019 02:15:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349932 - stable/12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: stable/12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 349932 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 72B627690B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.92)[-0.919,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 02:15:08 -0000 Author: cy Date: Fri Jul 12 02:15:06 2019 New Revision: 349932 URL: https://svnweb.freebsd.org/changeset/base/349932 Log: MFC r349929: Move the new ipf_pcksum6() function from ip_fil_freebsd.c to fil.c. The reason for this is that ipftest(8), which still works on FreeBSD-11, fails to link to it, breaking stable/11 builds. ipftest(8) was broken (segfault) sometime during the FreeBSD-12 cycle. glebius@ suggested we disable building it until I can get around to fixing it. Hence this was not caught in -current. The intention is to fix ipftest(8) as it is used by the netbsd-tests (imported by ngie@ many moons ago) for regression testing. Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c stable/12/sys/contrib/ipfilter/netinet/ip_fil.h stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/fil.c Fri Jul 12 02:14:05 2019 (r349931) +++ stable/12/sys/contrib/ipfilter/netinet/fil.c Fri Jul 12 02:15:06 2019 (r349932) @@ -179,6 +179,10 @@ static int ipf_updateipid __P((fr_info_t *)); static int ipf_settimeout __P((struct ipf_main_softc_s *, struct ipftuneable *, ipftuneval_t *)); +#ifdef USE_INET6 +static u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, + u_int32_t, u_int32_t)); +#endif #if !defined(_KERNEL) || SOLARIS static int ppsratecheck(struct timeval *, int *, int); #endif @@ -10223,4 +10227,55 @@ ipf_inet6_mask_del(bits, mask, mtab) mtab->imt6_max--; ASSERT(mtab->imt6_max >= 0); } + +#ifdef _KERNEL +static u_int +ipf_pcksum6(fin, ip6, off, len) + fr_info_t *fin; + ip6_t *ip6; + u_int32_t off; + u_int32_t len; +{ + struct mbuf *m; + int sum; + + m = fin->fin_m; + if (m->m_len < sizeof(struct ip6_hdr)) { + return 0xffff; + } + + sum = in6_cksum(m, ip6->ip6_nxt, off, len); + return(sum); +} +#else +static u_int +ipf_pcksum6(fin, ip6, off, len) + fr_info_t *fin; + ip6_t *ip6; + u_int32_t off; + u_int32_t len; +{ + u_short *sp; + u_int sum; + + sp = (u_short *)&ip6->ip6_src; + sum = *sp++; /* ip6_src */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; /* ip6_dst */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + return(ipf_pcksum(fin, off, sum)); +} +#endif #endif Modified: stable/12/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Fri Jul 12 02:14:05 2019 (r349931) +++ stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Fri Jul 12 02:15:06 2019 (r349932) @@ -1835,10 +1835,6 @@ extern int ipf_matchicmpqueryreply __P((int, icmpinfo struct icmp *, int)); extern u_32_t ipf_newisn __P((fr_info_t *)); extern u_int ipf_pcksum __P((fr_info_t *, int, u_int)); -#ifdef USE_INET6 -extern u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, - u_int32_t, u_int32_t)); -#endif extern void ipf_rule_expire __P((ipf_main_softc_t *)); extern int ipf_scanlist __P((fr_info_t *, u_32_t)); extern frentry_t *ipf_srcgrpmap __P((fr_info_t *, u_32_t *)); Modified: stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Jul 12 02:14:05 2019 (r349931) +++ stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Jul 12 02:15:06 2019 (r349932) @@ -1447,56 +1447,3 @@ ipf_pcksum(fin, hlen, sum) sum2 = ~sum & 0xffff; return sum2; } - -#ifdef USE_INET6 -#ifdef _KERNEL -u_int -ipf_pcksum6(fin, ip6, off, len) - fr_info_t *fin; - ip6_t *ip6; - u_int32_t off; - u_int32_t len; -{ - struct mbuf *m; - int sum; - - m = fin->fin_m; - if (m->m_len < sizeof(struct ip6_hdr)) { - return 0xffff; - } - - sum = in6_cksum(m, ip6->ip6_nxt, off, len); - return(sum); -} -#else -u_int -ipf_pcksum6(fin, ip6, off, len) - fr_info_t *fin; - ip6_t *ip6; - u_int32_t off; - u_int32_t len; -{ - u_short *sp; - u_int sum; - - sp = (u_short *)&ip6->ip6_src; - sum = *sp++; /* ip6_src */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; /* ip6_dst */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - return(ipf_pcksum(fin, off, sum)); -} -#endif -#endif From owner-svn-src-all@freebsd.org Fri Jul 12 04:44:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45D8015E61DD; Fri, 12 Jul 2019 04:44:51 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D006C834E7; Fri, 12 Jul 2019 04:44:50 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 99A0895A7; Fri, 12 Jul 2019 04:44:50 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C4iojD002038; Fri, 12 Jul 2019 04:44:50 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C4ioil002037; Fri, 12 Jul 2019 04:44:50 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907120444.x6C4ioil002037@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 12 Jul 2019 04:44:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349933 - head/rescue/rescue X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/rescue/rescue X-SVN-Commit-Revision: 349933 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D006C834E7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.962,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 04:44:51 -0000 Author: imp Date: Fri Jul 12 04:44:50 2019 New Revision: 349933 URL: https://svnweb.freebsd.org/changeset/base/349933 Log: Remove unused defines since r147075 When the OpenBSD dhclient was brought in 14 years ago, we stopped supporting building a reduced sized dhclient, yet retained the options here. Also, the OpenBSD dhclient doesn't need lint defined, so it can go too. Modified: head/rescue/rescue/Makefile Modified: head/rescue/rescue/Makefile ============================================================================== --- head/rescue/rescue/Makefile Fri Jul 12 02:15:06 2019 (r349932) +++ head/rescue/rescue/Makefile Fri Jul 12 04:44:50 2019 (r349933) @@ -172,7 +172,6 @@ CRUNCH_ALIAS_shutdown= poweroff # dhclient has historically been troublesome... CRUNCH_PROGS_sbin+= dhclient -CRUNCH_BUILDOPTS_dhclient= -DRELEASE_CRUNCH -Dlint ################################################################## # Programs from stock /usr/bin From owner-svn-src-all@freebsd.org Fri Jul 12 05:19:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CFD2215E67E9; Fri, 12 Jul 2019 05:19:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6A4EA842A0; Fri, 12 Jul 2019 05:19:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 441DF9AC3; Fri, 12 Jul 2019 05:19:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C5J7U8017485; Fri, 12 Jul 2019 05:19:07 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C5J7va017484; Fri, 12 Jul 2019 05:19:07 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907120519.x6C5J7va017484@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 12 Jul 2019 05:19:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349934 - head/usr.bin/cpio X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/usr.bin/cpio X-SVN-Commit-Revision: 349934 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6A4EA842A0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.943,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 05:19:08 -0000 Author: imp Date: Fri Jul 12 05:19:06 2019 New Revision: 349934 URL: https://svnweb.freebsd.org/changeset/base/349934 Log: There is no SMALLER define anymore here Stop defining SMALLER. Since we replaced cpio with libarchive version, there's no options to make it smaller. Also, the comment about the FreeBSD installer is obsolete. Remove them both. Modified: head/usr.bin/cpio/Makefile Modified: head/usr.bin/cpio/Makefile ============================================================================== --- head/usr.bin/cpio/Makefile Fri Jul 12 04:44:50 2019 (r349933) +++ head/usr.bin/cpio/Makefile Fri Jul 12 05:19:06 2019 (r349934) @@ -18,11 +18,6 @@ CFLAGS+= -DBSDCPIO_VERSION_STRING=\"${BSDCPIO_VERSION_ CFLAGS+= -DPLATFORM_CONFIG_H=\"${_LIBARCHIVECONFDIR}/config_freebsd.h\" CFLAGS+= -I${_LIBARCHIVEDIR}/cpio -I${_LIBARCHIVEDIR}/libarchive_fe -.ifdef RELEASE_CRUNCH -# FreeBSD's installer uses cpio in crunched binaries that are -# statically linked, cannot use -lcrypto, and are size sensitive. -CFLAGS+= -DSMALLER -.endif LIBADD= archive .if ${MK_ICONV} != "no" From owner-svn-src-all@freebsd.org Fri Jul 12 05:19:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7CF6815E6818; Fri, 12 Jul 2019 05:19:38 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1E960843B3; Fri, 12 Jul 2019 05:19:38 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E74049AC4; Fri, 12 Jul 2019 05:19:37 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C5JbiI017555; Fri, 12 Jul 2019 05:19:37 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C5JbFS017554; Fri, 12 Jul 2019 05:19:37 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907120519.x6C5JbFS017554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Fri, 12 Jul 2019 05:19:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349935 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349935 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1E960843B3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.943,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 05:19:38 -0000 Author: seanc (ports committer) Date: Fri Jul 12 05:19:37 2019 New Revision: 349935 URL: https://svnweb.freebsd.org/changeset/base/349935 Log: usr.sbin/bhyve: free resources when erroring out of pci_vtnet_init() Coverity CID: 1402978 Approved by: vmaffione Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D20912 Modified: head/usr.sbin/bhyve/pci_virtio_net.c Modified: head/usr.sbin/bhyve/pci_virtio_net.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_net.c Fri Jul 12 05:19:06 2019 (r349934) +++ head/usr.sbin/bhyve/pci_virtio_net.c Fri Jul 12 05:19:37 2019 (r349935) @@ -411,6 +411,7 @@ pci_vtnet_init(struct vmctx *ctx, struct pci_devinst * err = net_parsemac(vtopts, sc->vsc_config.mac); if (err != 0) { free(devname); + free(sc); return (err); } mac_provided = 1; @@ -419,8 +420,10 @@ pci_vtnet_init(struct vmctx *ctx, struct pci_devinst * err = netbe_init(&sc->vsc_be, devname, pci_vtnet_rx_callback, sc); free(devname); - if (err) + if (err) { + free(sc); return (err); + } sc->vsc_consts.vc_hv_caps |= netbe_get_cap(sc->vsc_be); } @@ -442,8 +445,10 @@ pci_vtnet_init(struct vmctx *ctx, struct pci_devinst * sc->vsc_vs.vs_mtx = &sc->vsc_mtx; /* use BAR 1 to map MSI-X table and PBA, if we're using MSI-X */ - if (vi_intr_init(&sc->vsc_vs, 1, fbsdrun_virtio_msix())) + if (vi_intr_init(&sc->vsc_vs, 1, fbsdrun_virtio_msix())) { + free(sc); return (1); + } /* use BAR 0 to map config regs in IO space */ vi_set_io_bar(&sc->vsc_vs, 0); From owner-svn-src-all@freebsd.org Fri Jul 12 05:35:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB3D915E6D8B; Fri, 12 Jul 2019 05:35:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 747A284EF2; Fri, 12 Jul 2019 05:35:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 41B5D9E38; Fri, 12 Jul 2019 05:35:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C5Zks2032023; Fri, 12 Jul 2019 05:35:46 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C5ZjXT032022; Fri, 12 Jul 2019 05:35:45 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907120535.x6C5ZjXT032022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 12 Jul 2019 05:35:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349936 - head/sbin/camcontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/camcontrol X-SVN-Commit-Revision: 349936 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 747A284EF2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.946,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 05:35:47 -0000 Author: imp Date: Fri Jul 12 05:35:45 2019 New Revision: 349936 URL: https://svnweb.freebsd.org/changeset/base/349936 Log: Retire support for -DMINIMALISTIC We've not used this in years since we retired sysinstall, and it hasn't compiled in at least a year. A full camcontrol is only 180k, so making it smaller is not as important as it once was. OK'd by: ken@, scottl@ Modified: head/sbin/camcontrol/Makefile head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/Makefile ============================================================================== --- head/sbin/camcontrol/Makefile Fri Jul 12 05:19:37 2019 (r349935) +++ head/sbin/camcontrol/Makefile Fri Jul 12 05:35:45 2019 (r349936) @@ -5,11 +5,7 @@ PACKAGE=runtime PROG= camcontrol SRCS= camcontrol.c util.c -.if !defined(RELEASE_CRUNCH) SRCS+= attrib.c epc.c fwdownload.c modeedit.c persist.c progress.c timestamp.c zone.c -.else -CFLAGS+= -DMINIMALISTIC -.endif .if ${MK_NVME} != "no" .PATH: ${SRCTOP}/sbin/nvmecontrol CFLAGS+= -I${SRCTOP}/sbin/nvmecontrol -DWITH_NVME Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Fri Jul 12 05:19:37 2019 (r349935) +++ head/sbin/camcontrol/camcontrol.c Fri Jul 12 05:35:45 2019 (r349936) @@ -46,10 +46,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifndef MINIMALISTIC #include #include -#endif #include #include @@ -153,7 +151,6 @@ struct camcontrol_opts { const char *subopt; }; -#ifndef MINIMALISTIC struct ata_res_pass16 { u_int16_t reserved[5]; u_int8_t flags; @@ -192,10 +189,8 @@ static const char smprg_opts[] = "l"; static const char smppc_opts[] = "a:A:d:lm:M:o:p:s:S:T:"; static const char smpphylist_opts[] = "lq"; static char pwd_opt; -#endif static struct camcontrol_opts option_table[] = { -#ifndef MINIMALISTIC {"tur", CAM_CMD_TUR, CAM_ARG_NONE, NULL}, {"inquiry", CAM_CMD_INQUIRY, CAM_ARG_NONE, "DSR"}, {"identify", CAM_CMD_IDENTIFY, CAM_ARG_NONE, NULL}, @@ -206,10 +201,8 @@ static struct camcontrol_opts option_table[] = { {"reportluns", CAM_CMD_REPORTLUNS, CAM_ARG_NONE, "clr:"}, {"readcapacity", CAM_CMD_READCAP, CAM_ARG_NONE, "bhHlNqs"}, {"reprobe", CAM_CMD_REPROBE, CAM_ARG_NONE, NULL}, -#endif /* MINIMALISTIC */ {"rescan", CAM_CMD_RESCAN, CAM_ARG_NONE, NULL}, {"reset", CAM_CMD_RESET, CAM_ARG_NONE, NULL}, -#ifndef MINIMALISTIC {"cmd", CAM_CMD_SCSI_CMD, CAM_ARG_NONE, scsicmd_opts}, {"mmcsdcmd", CAM_CMD_MMCSD_CMD, CAM_ARG_NONE, "c:a:f:Wb:l:41S:I"}, {"command", CAM_CMD_SCSI_CMD, CAM_ARG_NONE, scsicmd_opts}, @@ -223,9 +216,7 @@ static struct camcontrol_opts option_table[] = { {"smpmaninfo", CAM_CMD_SMP_MANINFO, CAM_ARG_NONE, "l"}, {"defects", CAM_CMD_READ_DEFECTS, CAM_ARG_NONE, readdefect_opts}, {"defectlist", CAM_CMD_READ_DEFECTS, CAM_ARG_NONE, readdefect_opts}, -#endif /* MINIMALISTIC */ {"devlist", CAM_CMD_DEVTREE, CAM_ARG_NONE, "-b"}, -#ifndef MINIMALISTIC {"periphlist", CAM_CMD_DEVLIST, CAM_ARG_NONE, NULL}, {"modepage", CAM_CMD_MODE_PAGE, CAM_ARG_NONE, "bdelm:P:"}, {"tags", CAM_CMD_TAG, CAM_ARG_NONE, "N:q"}, @@ -249,7 +240,6 @@ static struct camcontrol_opts option_table[] = { {"zone", CAM_CMD_ZONE, CAM_ARG_NONE, "ac:l:No:P:"}, {"epc", CAM_CMD_EPC, CAM_ARG_NONE, "c:dDeHp:Pr:sS:T:"}, {"timestamp", CAM_CMD_TIMESTAMP, CAM_ARG_NONE, "f:mrsUT:"}, -#endif /* MINIMALISTIC */ {"help", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, {"-?", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, {"-h", CAM_CMD_USAGE, CAM_ARG_NONE, NULL}, @@ -276,9 +266,7 @@ static cam_argmask arglist; camcontrol_optret getoption(struct camcontrol_opts *table, char *arg, uint32_t *cmdnum, cam_argmask *argnum, const char **subopt); -#ifndef MINIMALISTIC static int getdevlist(struct cam_device *device); -#endif /* MINIMALISTIC */ static int getdevtree(int argc, char **argv, char *combinedopt); static int print_dev_scsi(struct device_match_result *dev_result, char *tmpstr); static int print_dev_ata(struct device_match_result *dev_result, char *tmpstr); @@ -288,7 +276,6 @@ static int print_dev_mmcsd(struct device_match_result #ifdef WITH_NVME static int print_dev_nvme(struct device_match_result *dev_result, char *tmpstr); #endif -#ifndef MINIMALISTIC static int testunitready(struct cam_device *device, int task_attr, int retry_count, int timeout, int quiet); static int scsistart(struct cam_device *device, int startstop, int loadeject, @@ -297,14 +284,12 @@ static int scsiinquiry(struct cam_device *device, int int retry_count, int timeout); static int scsiserial(struct cam_device *device, int task_attr, int retry_count, int timeout); -#endif /* MINIMALISTIC */ static int parse_btl(char *tstr, path_id_t *bus, target_id_t *target, lun_id_t *lun, cam_argmask *arglst); static int dorescan_or_reset(int argc, char **argv, int rescan); static int rescan_or_reset_bus(path_id_t bus, int rescan); static int scanlun_or_reset_dev(path_id_t bus, target_id_t target, lun_id_t lun, int scan); -#ifndef MINIMALISTIC static int readdefects(struct cam_device *device, int argc, char **argv, char *combinedopt, int task_attr, int retry_count, int timeout); @@ -371,7 +356,6 @@ static int scsiopcodes(struct cam_device *device, int int timeout, int verbose); static int scsireprobe(struct cam_device *device); -#endif /* MINIMALISTIC */ #ifndef min #define min(a,b) (((a)<(b))?(a):(b)) #endif @@ -403,7 +387,6 @@ getoption(struct camcontrol_opts *table, char *arg, ui return (CC_OR_NOT_FOUND); } -#ifndef MINIMALISTIC static int getdevlist(struct cam_device *device) { @@ -462,7 +445,6 @@ getdevlist(struct cam_device *device) return (error); } -#endif /* MINIMALISTIC */ static int getdevtree(int argc, char **argv, char *combinedopt) @@ -835,7 +817,6 @@ print_dev_nvme(struct device_match_result *dev_result, } #endif -#ifndef MINIMALISTIC static int testunitready(struct cam_device *device, int task_attr, int retry_count, int timeout, int quiet) @@ -2424,10 +2405,8 @@ identify(struct cam_device *device, int retry_count, i #endif return (ataidentify(device, retry_count, timeout)); } -#endif /* MINIMALISTIC */ -#ifndef MINIMALISTIC enum { ATA_SECURITY_ACTION_PRINT, ATA_SECURITY_ACTION_FREEZE, @@ -3260,7 +3239,6 @@ atasecurity(struct cam_device *device, int retry_count return (error); } -#endif /* MINIMALISTIC */ /* * Parse out a bus, or a bus, target and lun in the following @@ -3708,7 +3686,6 @@ scanlun_or_reset_dev(path_id_t bus, target_id_t target } } -#ifndef MINIMALISTIC static struct scsi_nv defect_list_type_map[] = { { "block", SRDD10_BLOCK_FORMAT }, @@ -4284,7 +4261,6 @@ defect_bailout: return (error); } -#endif /* MINIMALISTIC */ #if 0 void @@ -4298,7 +4274,6 @@ reassignblocks(struct cam_device *device, u_int32_t *b } #endif -#ifndef MINIMALISTIC void mode_sense(struct cam_device *device, int dbd, int pc, int page, int subpage, int task_attr, int retry_count, int timeout, u_int8_t *data, @@ -9522,7 +9497,6 @@ bailout: return (retval); } -#endif /* MINIMALISTIC */ static int scsireprobe(struct cam_device *device) @@ -9566,7 +9540,6 @@ usage(int printlong) fprintf(printlong ? stdout : stderr, "usage: camcontrol [device id][generic args][command args]\n" " camcontrol devlist [-b] [-v]\n" -#ifndef MINIMALISTIC " camcontrol periphlist [dev_id][-n dev_name] [-u unit]\n" " camcontrol tur [dev_id][generic args]\n" " camcontrol inquiry [dev_id][generic args] [-D] [-S] [-R]\n" @@ -9579,10 +9552,8 @@ usage(int printlong) " camcontrol load [dev_id][generic args]\n" " camcontrol eject [dev_id][generic args]\n" " camcontrol reprobe [dev_id][generic args]\n" -#endif /* MINIMALISTIC */ " camcontrol rescan \n" " camcontrol reset \n" -#ifndef MINIMALISTIC " camcontrol defects [dev_id][generic args] <-f format> [-P][-G]\n" " [-q][-s][-S offset][-X]\n" " camcontrol modepage [dev_id][generic args] <-m page | -l>\n" @@ -9642,11 +9613,9 @@ usage(int printlong) " camcontrol timestamp [dev_id][generic_args] <-r [-f format|-m|-U]>|\n" " <-s <-f format -T time | -U >>\n" " \n" -#endif /* MINIMALISTIC */ " camcontrol help\n"); if (!printlong) return; -#ifndef MINIMALISTIC fprintf(stdout, "Specify one of the following options:\n" "devlist list all CAM devices\n" @@ -9892,7 +9861,6 @@ usage(int printlong) "-T time the time value passed into strptime(3)\n" "-U set the timestamp of the device to UTC time\n" ); -#endif /* MINIMALISTIC */ } int @@ -9911,11 +9879,9 @@ main(int argc, char **argv) int error = 0, optstart = 2; int task_attr = MSG_SIMPLE_Q_TAG; int devopen = 1; -#ifndef MINIMALISTIC path_id_t bus; target_id_t target; lun_id_t lun; -#endif /* MINIMALISTIC */ cmdlist = CAM_CMD_NONE; arglist = CAM_ARG_NONE; @@ -10003,7 +9969,6 @@ main(int argc, char **argv) || (cmdlist == CAM_CMD_DEBUG)) devopen = 0; -#ifndef MINIMALISTIC if ((devopen == 1) && (argc > 2 && argv[2][0] != '-')) { char name[30]; @@ -10031,7 +9996,6 @@ main(int argc, char **argv) optstart++; } } -#endif /* MINIMALISTIC */ /* * Start getopt processing at argv[2/3], since we've already * accepted argv[1..2] as the command name, and as a possible @@ -10117,7 +10081,6 @@ main(int argc, char **argv) } } -#ifndef MINIMALISTIC /* * For most commands we'll want to open the passthrough device * associated with the specified device. In the case of the rescan @@ -10138,7 +10101,6 @@ main(int argc, char **argv) == NULL) errx(1,"%s", cam_errbuf); } -#endif /* MINIMALISTIC */ /* * Reset optind to 2, and reset getopt, so these routines can parse @@ -10148,7 +10110,6 @@ main(int argc, char **argv) optreset = 1; switch(cmdlist) { -#ifndef MINIMALISTIC case CAM_CMD_DEVLIST: error = getdevlist(cam_dev); break; @@ -10156,11 +10117,9 @@ main(int argc, char **argv) error = atahpa(cam_dev, retry_count, timeout, argc, argv, combinedopt); break; -#endif /* MINIMALISTIC */ case CAM_CMD_DEVTREE: error = getdevtree(argc, argv, combinedopt); break; -#ifndef MINIMALISTIC case CAM_CMD_TUR: error = testunitready(cam_dev, task_attr, retry_count, timeout, 0); @@ -10177,14 +10136,12 @@ main(int argc, char **argv) arglist & CAM_ARG_EJECT, task_attr, retry_count, timeout); break; -#endif /* MINIMALISTIC */ case CAM_CMD_RESCAN: error = dorescan_or_reset(argc, argv, 1); break; case CAM_CMD_RESET: error = dorescan_or_reset(argc, argv, 0); break; -#ifndef MINIMALISTIC case CAM_CMD_READ_DEFECTS: error = readdefects(cam_dev, argc, argv, combinedopt, task_attr, retry_count, timeout); @@ -10307,7 +10264,6 @@ main(int argc, char **argv) task_attr, retry_count, timeout, arglist & CAM_ARG_VERBOSE); break; -#endif /* MINIMALISTIC */ case CAM_CMD_USAGE: usage(1); break; From owner-svn-src-all@freebsd.org Fri Jul 12 05:53:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6BBA015E722A; Fri, 12 Jul 2019 05:53:14 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0A84D8587E; Fri, 12 Jul 2019 05:53:14 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB375A1CE; Fri, 12 Jul 2019 05:53:13 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C5rDnv042067; Fri, 12 Jul 2019 05:53:13 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C5rDxE042066; Fri, 12 Jul 2019 05:53:13 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907120553.x6C5rDxE042066@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Fri, 12 Jul 2019 05:53:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349937 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349937 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0A84D8587E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.943,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 05:53:14 -0000 Author: seanc (ports committer) Date: Fri Jul 12 05:53:13 2019 New Revision: 349937 URL: https://svnweb.freebsd.org/changeset/base/349937 Log: usr.sbin/bhyve: unconditionally initialize the NVMe completion status Follow-up work to improve the handling of unsupported/invalid opcodes is being developed by chuck@. Coverity CID: 1398928 Reviewed by: chuck Approved by: araujo, imp Differential Revision: https://reviews.freebsd.org/D20914 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Fri Jul 12 05:35:45 2019 (r349936) +++ head/usr.sbin/bhyve/pci_nvme.c Fri Jul 12 05:53:13 2019 (r349937) @@ -978,6 +978,7 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u while (sqhead != atomic_load_acq_short(&sq->tail)) { cmd = &(sq->qbase)[sqhead]; + compl.cdw0 = 0; compl.status = 0; switch (cmd->opc) { From owner-svn-src-all@freebsd.org Fri Jul 12 06:19:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9362815E773A; Fri, 12 Jul 2019 06:19:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3A84286597; Fri, 12 Jul 2019 06:19:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 14D1DA568; Fri, 12 Jul 2019 06:19:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C6JPIs052757; Fri, 12 Jul 2019 06:19:25 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C6JP2f052753; Fri, 12 Jul 2019 06:19:25 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907120619.x6C6JP2f052753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 12 Jul 2019 06:19:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349938 - head/usr.sbin/ppp X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/usr.sbin/ppp X-SVN-Commit-Revision: 349938 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3A84286597 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.967,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 06:19:26 -0000 Author: imp Date: Fri Jul 12 06:19:25 2019 New Revision: 349938 URL: https://svnweb.freebsd.org/changeset/base/349938 Log: Retire the -DRELEASE_CRUNCH define. The RELEASE_CRUNCH ifdefs save about 100 bytes of text space. The complexity is not worth it as they eliminate error messages. Left the RELEASE_CRUNCH ifdef to eliminate a lot of stuff in place. That saves an interesting amount of space and change some behaviors, so absent a more detailed analysis, maintain the status quo. Modified: head/usr.sbin/ppp/Makefile head/usr.sbin/ppp/bundle.c head/usr.sbin/ppp/physical.c Modified: head/usr.sbin/ppp/Makefile ============================================================================== --- head/usr.sbin/ppp/Makefile Fri Jul 12 05:53:13 2019 (r349937) +++ head/usr.sbin/ppp/Makefile Fri Jul 12 06:19:25 2019 (r349938) @@ -12,7 +12,6 @@ SRCS= acf.c arp.c async.c auth.c bundle.c cbcp.c ccp.c tcpmss.c throughput.c timer.c tty.c tun.c udp.c vjcomp.c WARNS?= 3 .if defined(RELEASE_CRUNCH) -CFLAGS+=-DRELEASE_CRUNCH PPP_NO_DES= PPP_NO_KLDLOAD= PPP_NO_NAT= Modified: head/usr.sbin/ppp/bundle.c ============================================================================== --- head/usr.sbin/ppp/bundle.c Fri Jul 12 05:53:13 2019 (r349937) +++ head/usr.sbin/ppp/bundle.c Fri Jul 12 06:19:25 2019 (r349938) @@ -678,12 +678,9 @@ bundle_LockTun(struct bundle *bundle) if (lockfile != NULL) { fprintf(lockfile, "%d\n", (int)getpid()); fclose(lockfile); - } -#ifndef RELEASE_CRUNCH - else + } else log_Printf(LogERROR, "Warning: Can't create %s: %s\n", pidfile, strerror(errno)); -#endif } static void Modified: head/usr.sbin/ppp/physical.c ============================================================================== --- head/usr.sbin/ppp/physical.c Fri Jul 12 05:53:13 2019 (r349937) +++ head/usr.sbin/ppp/physical.c Fri Jul 12 06:19:25 2019 (r349938) @@ -364,13 +364,9 @@ physical_Close(struct physical *p) if (*p->name.full == '/') { snprintf(fn, sizeof fn, "%s%s.if", _PATH_VARRUN, p->name.base); -#ifndef RELEASE_CRUNCH if (ID0unlink(fn) == -1) log_Printf(LogALERT, "%s: Can't remove %s: %s\n", p->link.name, fn, strerror(errno)); -#else - ID0unlink(fn); -#endif } physical_Unlock(p); if (p->handler && p->handler->destroy) @@ -978,12 +974,9 @@ physical_Found(struct physical *p) if (lockfile != NULL) { fprintf(lockfile, "%s%d\n", TUN_NAME, p->dl->bundle->unit); fclose(lockfile); - } -#ifndef RELEASE_CRUNCH - else + } else log_Printf(LogALERT, "%s: Can't create %s: %s\n", p->link.name, fn, strerror(errno)); -#endif } throughput_start(&p->link.stats.total, "physical throughput", From owner-svn-src-all@freebsd.org Fri Jul 12 09:02:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33CAC15EA67D; Fri, 12 Jul 2019 09:02:13 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C97968BB18; Fri, 12 Jul 2019 09:02:12 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3FD9C370; Fri, 12 Jul 2019 09:02:12 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C92Cw3038183; Fri, 12 Jul 2019 09:02:12 GMT (envelope-from phk@FreeBSD.org) Received: (from phk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C92CpB038182; Fri, 12 Jul 2019 09:02:12 GMT (envelope-from phk@FreeBSD.org) Message-Id: <201907120902.x6C92CpB038182@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phk set sender to phk@FreeBSD.org using -f From: Poul-Henning Kamp Date: Fri, 12 Jul 2019 09:02:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349939 - head/sys/dev/usb/serial X-SVN-Group: head X-SVN-Commit-Author: phk X-SVN-Commit-Paths: head/sys/dev/usb/serial X-SVN-Commit-Revision: 349939 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C97968BB18 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 09:02:13 -0000 Author: phk Date: Fri Jul 12 09:02:12 2019 New Revision: 349939 URL: https://svnweb.freebsd.org/changeset/base/349939 Log: Support multiple serial ports per device. Enable this for the NovAtel OEMv2 GPS receiver. Not fixed: The receiver shows up as "" in the device tree, because that is literally what the descriptor-string is. Reviewed by: hselasky@ Modified: head/sys/dev/usb/serial/ugensa.c Modified: head/sys/dev/usb/serial/ugensa.c ============================================================================== --- head/sys/dev/usb/serial/ugensa.c Fri Jul 12 06:19:25 2019 (r349938) +++ head/sys/dev/usb/serial/ugensa.c Fri Jul 12 09:02:12 2019 (r349939) @@ -70,6 +70,7 @@ #define UGENSA_CONFIG_INDEX 0 #define UGENSA_IFACE_INDEX 0 #define UGENSA_IFACE_MAX 8 /* exclusivly */ +#define UGENSA_PORT_MAX 8 /* exclusivly */ enum { UGENSA_BULK_DT_WR, @@ -84,11 +85,11 @@ struct ugensa_sub_softc { struct ugensa_softc { struct ucom_super_softc sc_super_ucom; - struct ucom_softc sc_ucom[UGENSA_IFACE_MAX]; - struct ugensa_sub_softc sc_sub[UGENSA_IFACE_MAX]; + struct ucom_softc sc_ucom[UGENSA_PORT_MAX]; + struct ugensa_sub_softc sc_sub[UGENSA_PORT_MAX]; struct mtx sc_mtx; - uint8_t sc_niface; + uint8_t sc_nports; }; /* prototypes */ @@ -154,12 +155,13 @@ static driver_t ugensa_driver = { .size = sizeof(struct ugensa_softc), }; +/* Driver-info is max number of serial ports per interface */ static const STRUCT_USB_HOST_ID ugensa_devs[] = { - {USB_VPI(USB_VENDOR_AIRPRIME, USB_PRODUCT_AIRPRIME_PC5220, 0)}, - {USB_VPI(USB_VENDOR_CMOTECH, USB_PRODUCT_CMOTECH_CDMA_MODEM1, 0)}, - {USB_VPI(USB_VENDOR_KYOCERA2, USB_PRODUCT_KYOCERA2_CDMA_MSM_K, 0)}, - {USB_VPI(USB_VENDOR_HP, USB_PRODUCT_HP_49GPLUS, 0)}, - {USB_VPI(USB_VENDOR_NOVATEL2, USB_PRODUCT_NOVATEL2_FLEXPACKGPS, 0)}, + {USB_VPI(USB_VENDOR_AIRPRIME, USB_PRODUCT_AIRPRIME_PC5220, 1)}, + {USB_VPI(USB_VENDOR_CMOTECH, USB_PRODUCT_CMOTECH_CDMA_MODEM1, 1)}, + {USB_VPI(USB_VENDOR_KYOCERA2, USB_PRODUCT_KYOCERA2_CDMA_MSM_K, 1)}, + {USB_VPI(USB_VENDOR_HP, USB_PRODUCT_HP_49GPLUS, 1)}, + {USB_VPI(USB_VENDOR_NOVATEL2, USB_PRODUCT_NOVATEL2_FLEXPACKGPS, 3)}, }; DRIVER_MODULE(ugensa, uhub, ugensa_driver, ugensa_devclass, NULL, 0); @@ -192,65 +194,68 @@ ugensa_attach(device_t dev) struct ugensa_softc *sc = device_get_softc(dev); struct ugensa_sub_softc *ssc; struct usb_interface *iface; + struct usb_config xfer_config[UGENSA_N_TRANSFER]; int32_t error; uint8_t iface_index; - int x, cnt; + int x, maxports; + maxports = USB_GET_DRIVER_INFO(uaa); device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, "ugensa", NULL, MTX_DEF); ucom_ref(&sc->sc_super_ucom); - /* Figure out how many interfaces this device has got */ - for (cnt = 0; cnt < UGENSA_IFACE_MAX; cnt++) { - if ((usbd_get_endpoint(uaa->device, cnt, ugensa_xfer_config + 0) == NULL) || - (usbd_get_endpoint(uaa->device, cnt, ugensa_xfer_config + 1) == NULL)) { - /* we have reached the end */ - break; - } - } + for (iface_index = UGENSA_IFACE_INDEX; iface_index < UGENSA_IFACE_MAX; iface_index++) { - if (cnt == 0) { - device_printf(dev, "No interfaces\n"); - goto detach; - } - for (x = 0; x < cnt; x++) { - iface = usbd_get_iface(uaa->device, x); - if (iface->idesc->bInterfaceClass != UICLASS_VENDOR) + iface = usbd_get_iface(uaa->device, iface_index); + if (iface == NULL || iface->idesc->bInterfaceClass != UICLASS_VENDOR) /* Not a serial port, most likely a SD reader */ continue; - ssc = sc->sc_sub + sc->sc_niface; - ssc->sc_ucom_ptr = sc->sc_ucom + sc->sc_niface; + /* Loop over all endpoints pairwise */ + for (x = 0; x < maxports && sc->sc_nports < UGENSA_PORT_MAX; x++) { - iface_index = (UGENSA_IFACE_INDEX + x); - error = usbd_transfer_setup(uaa->device, - &iface_index, ssc->sc_xfer, ugensa_xfer_config, - UGENSA_N_TRANSFER, ssc, &sc->sc_mtx); + ssc = sc->sc_sub + sc->sc_nports; + ssc->sc_ucom_ptr = sc->sc_ucom + sc->sc_nports; - if (error) { - device_printf(dev, "allocating USB " - "transfers failed\n"); - goto detach; - } - /* clear stall at first run */ - mtx_lock(&sc->sc_mtx); - usbd_xfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_WR]); - usbd_xfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_RD]); - mtx_unlock(&sc->sc_mtx); + memcpy(xfer_config, ugensa_xfer_config, sizeof ugensa_xfer_config); + xfer_config[UGENSA_BULK_DT_RD].ep_index = x; + xfer_config[UGENSA_BULK_DT_WR].ep_index = x; - /* initialize port number */ - ssc->sc_ucom_ptr->sc_portno = sc->sc_niface; - sc->sc_niface++; - if (x != uaa->info.bIfaceIndex) - usbd_set_parent_iface(uaa->device, x, - uaa->info.bIfaceIndex); + error = usbd_transfer_setup(uaa->device, + &iface_index, ssc->sc_xfer, xfer_config, + UGENSA_N_TRANSFER, ssc, &sc->sc_mtx); + + if (error) { + if (x == 0) { + device_printf(dev, "allocating USB " + "transfers failed (%d)\n", error); + goto detach; + } + break; + } + + /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); + usbd_xfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_WR]); + usbd_xfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); + + /* initialize port number */ + ssc->sc_ucom_ptr->sc_portno = sc->sc_nports; + if (iface_index != uaa->info.bIfaceIndex) { + usbd_set_parent_iface(uaa->device, iface_index, + uaa->info.bIfaceIndex); + } + sc->sc_nports++; + } } - device_printf(dev, "Found %d interfaces.\n", sc->sc_niface); + device_printf(dev, "Found %d serial ports.\n", sc->sc_nports); - error = ucom_attach(&sc->sc_super_ucom, sc->sc_ucom, sc->sc_niface, sc, + error = ucom_attach(&sc->sc_super_ucom, sc->sc_ucom, sc->sc_nports, sc, &ugensa_callback, &sc->sc_mtx); + if (error) { - DPRINTF("attach failed\n"); + DPRINTF("ucom attach failed\n"); goto detach; } ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); @@ -270,7 +275,7 @@ ugensa_detach(device_t dev) ucom_detach(&sc->sc_super_ucom, sc->sc_ucom); - for (x = 0; x < sc->sc_niface; x++) { + for (x = 0; x < sc->sc_nports; x++) { usbd_transfer_unsetup(sc->sc_sub[x].sc_xfer, UGENSA_N_TRANSFER); } From owner-svn-src-all@freebsd.org Fri Jul 12 09:48:43 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B17CA15EB168; Fri, 12 Jul 2019 09:48:43 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D48B8EDD9; Fri, 12 Jul 2019 09:48:43 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 17601CA64; Fri, 12 Jul 2019 09:48:43 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C9mgga061666; Fri, 12 Jul 2019 09:48:42 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C9mg0q061665; Fri, 12 Jul 2019 09:48:42 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201907120948.x6C9mg0q061665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 12 Jul 2019 09:48:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349940 - head/sys/netpfil/ipfw X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netpfil/ipfw X-SVN-Commit-Revision: 349940 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4D48B8EDD9 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 09:48:43 -0000 Author: ae Date: Fri Jul 12 09:48:42 2019 New Revision: 349940 URL: https://svnweb.freebsd.org/changeset/base/349940 Log: Correctly truncate the rule in case when it has several action opcodes. It is possible, that opcode at the ACTION_PTR() location is not real action, but action modificator like "log", "tag" etc. In this case we need to check for each opcode in the loop to find O_EXTERNAL_ACTION. Obtained from: Yandex LLC MFC after: 1 week Sponsored by: Yandex LLC Modified: head/sys/netpfil/ipfw/ip_fw_eaction.c Modified: head/sys/netpfil/ipfw/ip_fw_eaction.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_eaction.c Fri Jul 12 09:02:12 2019 (r349939) +++ head/sys/netpfil/ipfw/ip_fw_eaction.c Fri Jul 12 09:48:42 2019 (r349940) @@ -377,35 +377,51 @@ ipfw_reset_eaction(struct ip_fw_chain *ch, struct ip_f uint16_t eaction_id, uint16_t default_id, uint16_t instance_id) { ipfw_insn *cmd, *icmd; + int l, cmdlen; IPFW_UH_WLOCK_ASSERT(ch); IPFW_WLOCK_ASSERT(ch); cmd = ACTION_PTR(rule); + l = rule->cmd_len - rule->act_ofs; + while (l > 0) { + cmdlen = F_LEN(cmd); + l -= cmdlen; + if (cmd->opcode == O_EXTERNAL_ACTION) + break; + cmd += cmdlen; + } + /* + * Return if there is not O_EXTERNAL_ACTION or its id is + * different. + */ if (cmd->opcode != O_EXTERNAL_ACTION || cmd->arg1 != eaction_id) return (0); - - if (instance_id != 0 && rule->act_ofs < rule->cmd_len - 1) { + /* + * If instance_id is specified, we need to truncate the + * rule length. Check if there is O_EXTERNAL_INSTANCE opcode. + */ + if (instance_id != 0 && l > 0) { + MPASS(cmdlen == 1); icmd = cmd + 1; if (icmd->opcode != O_EXTERNAL_INSTANCE || icmd->arg1 != instance_id) return (0); - /* FALLTHROUGH */ + /* + * Since named_object related to this instance will be + * destroyed, truncate the chain of opcodes to remove + * the rest of cmd chain just after O_EXTERNAL_ACTION + * opcode. + */ + EACTION_DEBUG("truncate rule %d: len %u -> %u", + rule->rulenum, rule->cmd_len, rule->cmd_len - l); + rule->cmd_len -= l; + MPASS(((uint32_t *)icmd - + (uint32_t *)rule->cmd) == rule->cmd_len); } cmd->arg1 = default_id; /* Set to default id */ - /* - * Since named_object related to this instance will be - * also destroyed, truncate the chain of opcodes to - * remove the rest of cmd chain just after O_EXTERNAL_ACTION - * opcode. - */ - if (rule->act_ofs < rule->cmd_len - 1) { - EACTION_DEBUG("truncate rule %d: len %u -> %u", - rule->rulenum, rule->cmd_len, rule->act_ofs + 1); - rule->cmd_len = rule->act_ofs + 1; - } /* * Return 1 when reset successfully happened. */ From owner-svn-src-all@freebsd.org Fri Jul 12 09:59:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 281AB15EB435; Fri, 12 Jul 2019 09:59:23 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BEB138F515; Fri, 12 Jul 2019 09:59:22 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F6DCCC06; Fri, 12 Jul 2019 09:59:22 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6C9xMm4067043; Fri, 12 Jul 2019 09:59:22 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6C9xM1Z067042; Fri, 12 Jul 2019 09:59:22 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201907120959.x6C9xM1Z067042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 12 Jul 2019 09:59:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349941 - head/sys/netpfil/ipfw X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netpfil/ipfw X-SVN-Commit-Revision: 349941 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BEB138F515 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.935,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 09:59:23 -0000 Author: ae Date: Fri Jul 12 09:59:21 2019 New Revision: 349941 URL: https://svnweb.freebsd.org/changeset/base/349941 Log: Do not modify cmd pointer if it is already last opcode in the rule. MFC after: 1 week Modified: head/sys/netpfil/ipfw/ip_fw_eaction.c Modified: head/sys/netpfil/ipfw/ip_fw_eaction.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_eaction.c Fri Jul 12 09:48:42 2019 (r349940) +++ head/sys/netpfil/ipfw/ip_fw_eaction.c Fri Jul 12 09:59:21 2019 (r349941) @@ -387,7 +387,7 @@ ipfw_reset_eaction(struct ip_fw_chain *ch, struct ip_f while (l > 0) { cmdlen = F_LEN(cmd); l -= cmdlen; - if (cmd->opcode == O_EXTERNAL_ACTION) + if (cmd->opcode == O_EXTERNAL_ACTION || l <= 0) break; cmd += cmdlen; } From owner-svn-src-all@freebsd.org Fri Jul 12 11:44:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5FA8E15ED4D5 for ; Fri, 12 Jul 2019 11:44:21 +0000 (UTC) (envelope-from rrs@netflix.com) Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3A1206C63C for ; Fri, 12 Jul 2019 11:44:19 +0000 (UTC) (envelope-from rrs@netflix.com) Received: by mail-qt1-x82b.google.com with SMTP id a15so7682946qtn.7 for ; Fri, 12 Jul 2019 04:44:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=72dHoLVLuh4p5whkGaIaWBtSQVtJvl+XjXrUFVeI8Ms=; b=bJO2zx5+ePAp38L/PAIdeZlfQhGmmXWOexOcmhiGGZxHE/6aF53MKm1bVNRd+DOmAQ l7pl+vj3XZXpwlyI1zsa80y71bq637XT3AZh0p9vkBXxqy4u08lD4WU18DIDL3+k4UNb oFU7JRpfq1XMSHHLbag/kYvsXLVcKKle0donzf5IEzvD059I5iZj5y8lLC8LhTikFR1M y0ATitQDMcPkCCLBbbWkKQnF5sAWs6+EO/PsXVuqSrwPUPzS9yYiHIkPjkmsEjFJK88U TyyeNYSxVo4yuj2Ctj5QXJ1lzTkTtCYtPeZofppNLf4NwxfpV7XUr7pBmoeWvkcQIqAc /bVA== X-Gm-Message-State: APjAAAU+X57qoteD3pPEVjsU4KDcmig8FR5hnQvpCc1dVR3GTyBof/+M jZ8voZMBdbiN0qKBRy3QOqf8rw== X-Google-Smtp-Source: APXvYqyX+El7ZAJhfA+puyyOcNdMhKgSz9R/cMRcYEOSGoF5N9jK/7zWZGy0ckq4ApAysrtnoAunrg== X-Received: by 2002:a0c:adef:: with SMTP id x44mr6286426qvc.153.1562931858417; Fri, 12 Jul 2019 04:44:18 -0700 (PDT) Received: from ?IPv6:2607:fb10:7061:7fd::19c4? ([2607:fb10:7061:7fd::19c4]) by smtp.gmail.com with ESMTPSA id z8sm3502552qki.23.2019.07.12.04.44.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jul 2019 04:44:17 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: svn commit: r349907 - head/sys/netinet/tcp_stacks From: Randall Stewart In-Reply-To: <6AC34953-52FC-48FC-B83F-CFFB6A48EC84@gmail.com> Date: Fri, 12 Jul 2019 07:44:16 -0400 Cc: Randall Ray Stewart , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <9849A15D-6934-4076-9FE9-80AF28F8376C@netflix.com> References: <201907110438.x6B4cXX1054795@repo.freebsd.org> <6AC34953-52FC-48FC-B83F-CFFB6A48EC84@gmail.com> To: Enji Cooper X-Mailer: Apple Mail (2.3445.9.1) X-Rspamd-Queue-Id: 3A1206C63C X-Spamd-Bar: ---------------- X-Spamd-Result: default: False [-16.47 / 15.00]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; MV_CASE(0.50)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; MX_GOOD(-0.01)[alt1.aspmx.l.google.com,aspmx.l.google.com,aspmx2.googlemail.com,alt2.aspmx.l.google.com,aspmx3.googlemail.com]; DKIM_TRACE(0.00)[netflix.com:+]; DMARC_POLICY_ALLOW(-0.50)[netflix.com,reject]; NEURAL_HAM_SHORT(-0.94)[-0.943,0]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(-3.02)[ip: (-9.42), ipnet: 2607:f8b0::/32(-3.18), asn: 15169(-2.44), country: US(-0.06)]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_LAST(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[netflix.com:s=google]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; WHITELIST_DMARC(-7.00)[netflix.com:D:+]; RCVD_IN_DNSWL_NONE(0.00)[b.2.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; WHITELIST_SPF_DKIM(-3.00)[netflix.com:d:+,netflix.com:s:+] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 11:44:21 -0000 opps.. that was a error on my part I will fix it :) > On Jul 11, 2019, at 4:37 AM, Enji Cooper = wrote: >=20 >=20 >> On Jul 10, 2019, at 9:38 PM, Randall Stewart wrote: >>=20 >> Author: rrs >> Date: Thu Jul 11 04:38:33 2019 >> New Revision: 349907 >> URL: https://svnweb.freebsd.org/changeset/base/349907 >>=20 >> Log: >> Update copyright per JBH's suggestions.. thanks. >>=20 >> Modified: >> head/sys/netinet/tcp_stacks/rack.c >>=20 >> Modified: head/sys/netinet/tcp_stacks/rack.c >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 03:29:25 2019 = (r349906) >> +++ head/sys/netinet/tcp_stacks/rack.c Thu Jul 11 04:38:33 2019 = (r349907) >> @@ -1,5 +1,5 @@ >> /*- >> - * Copyright (c) 2016 >> + * Copyright (c) 2016-2019 >> * Netflix Inc. All rights reserved. >> * >> * Redistribution and use in source and binary forms, with or without >> @@ -8537,10 +8537,10 @@ out: >> * retransmit. In persist state, just set snd_max. >> */ >> if (error =3D=3D 0) { >> -/* if (TCPS_HAVEESTABLISHED(tp->t_state) && >> + if (TCPS_HAVEESTABLISHED(tp->t_state) && >> (tp->t_flags & TF_SACK_PERMIT) && >> tp->rcv_numsacks > 0) >> - tcp_clean_dsack_blocks(tp);*/ >> + tcp_clean_dsack_blocks(tp); >=20 > Removing this commented out code unfortunately broke the build: = https://ci.freebsd.org/job/FreeBSD-head-amd64-LINT/12934/console . > Thanks, > -Enji >=20 ------ Randall Stewart rrs@netflix.com From owner-svn-src-all@freebsd.org Fri Jul 12 11:45:43 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B67115ED581; Fri, 12 Jul 2019 11:45:43 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DEDB66C7CE; Fri, 12 Jul 2019 11:45:42 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC3D7DEA7; Fri, 12 Jul 2019 11:45:42 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CBjgRi024138; Fri, 12 Jul 2019 11:45:42 GMT (envelope-from rrs@FreeBSD.org) Received: (from rrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CBjgBn024137; Fri, 12 Jul 2019 11:45:42 GMT (envelope-from rrs@FreeBSD.org) Message-Id: <201907121145.x6CBjgBn024137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rrs set sender to rrs@FreeBSD.org using -f From: Randall Stewart Date: Fri, 12 Jul 2019 11:45:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349942 - head/sys/netinet/tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: rrs X-SVN-Commit-Paths: head/sys/netinet/tcp_stacks X-SVN-Commit-Revision: 349942 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DEDB66C7CE X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.947,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 11:45:43 -0000 Author: rrs Date: Fri Jul 12 11:45:42 2019 New Revision: 349942 URL: https://svnweb.freebsd.org/changeset/base/349942 Log: add back the comment around the pending DSACK fixes. Modified: head/sys/netinet/tcp_stacks/rack.c Modified: head/sys/netinet/tcp_stacks/rack.c ============================================================================== --- head/sys/netinet/tcp_stacks/rack.c Fri Jul 12 09:59:21 2019 (r349941) +++ head/sys/netinet/tcp_stacks/rack.c Fri Jul 12 11:45:42 2019 (r349942) @@ -8537,10 +8537,10 @@ out: * retransmit. In persist state, just set snd_max. */ if (error == 0) { - if (TCPS_HAVEESTABLISHED(tp->t_state) && +/* if (TCPS_HAVEESTABLISHED(tp->t_state) && (tp->t_flags & TF_SACK_PERMIT) && tp->rcv_numsacks > 0) - tcp_clean_dsack_blocks(tp); + tcp_clean_dsack_blocks(tp);*/ if (len == 0) counter_u64_add(rack_out_size[TCP_MSS_ACCT_SNDACK], 1); else if (len == 1) { From owner-svn-src-all@freebsd.org Fri Jul 12 15:24:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 649C315CD2BB; Fri, 12 Jul 2019 15:24:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0557174BC1; Fri, 12 Jul 2019 15:24:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D0A76184C6; Fri, 12 Jul 2019 15:24:25 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CFOPG8038584; Fri, 12 Jul 2019 15:24:25 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CFOPqq038583; Fri, 12 Jul 2019 15:24:25 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907121524.x6CFOPqq038583@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 12 Jul 2019 15:24:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349943 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 349943 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0557174BC1 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 15:24:26 -0000 Author: markj Date: Fri Jul 12 15:24:25 2019 New Revision: 349943 URL: https://svnweb.freebsd.org/changeset/base/349943 Log: Apply some light cleanup to uses of pmap_pte_dirty(). - Check for ATTR_SW_MANAGED before anything else. - Use pmap_pte_dirty() in pmap_remove_pages(). No functional change intended. Reviewed by: alc MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Fri Jul 12 11:45:42 2019 (r349942) +++ head/sys/arm64/arm64/pmap.c Fri Jul 12 15:24:25 2019 (r349943) @@ -2812,9 +2812,8 @@ pmap_protect_l2(pmap_t pmap, pt_entry_t *l2, vm_offset * update the dirty field of each of the superpage's constituent 4KB * pages. */ - if ((nbits & ATTR_AP(ATTR_AP_RO)) != 0 && - (old_l2 & ATTR_SW_MANAGED) != 0 && - pmap_pte_dirty(old_l2)) { + if ((old_l2 & ATTR_SW_MANAGED) != 0 && + (nbits & ATTR_AP(ATTR_AP_RO)) != 0 && pmap_pte_dirty(old_l2)) { m = PHYS_TO_VM_PAGE(old_l2 & ~ATTR_MASK); for (mt = m; mt < &m[L2_SIZE / PAGE_SIZE]; mt++) vm_page_dirty(mt); @@ -2920,8 +2919,8 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t * When a dirty read/write mapping is write protected, * update the page's dirty field. */ - if ((nbits & ATTR_AP(ATTR_AP_RO)) != 0 && - (l3 & ATTR_SW_MANAGED) != 0 && + if ((l3 & ATTR_SW_MANAGED) != 0 && + (nbits & ATTR_AP(ATTR_AP_RO)) != 0 && pmap_pte_dirty(l3)) vm_page_dirty(PHYS_TO_VM_PAGE(l3 & ~ATTR_MASK)); @@ -3344,8 +3343,8 @@ validate: /* same PA, different attributes */ pmap_load_store(l3, new_l3); pmap_invalidate_page(pmap, va); - if (pmap_pte_dirty(orig_l3) && - (orig_l3 & ATTR_SW_MANAGED) != 0) + if ((orig_l3 & ATTR_SW_MANAGED) != 0 && + pmap_pte_dirty(orig_l3)) vm_page_dirty(m); } else { /* @@ -4293,8 +4292,7 @@ pmap_remove_pages(pmap_t pmap) /* * Update the vm_page_t clean/reference bits. */ - if ((tpte & ATTR_AP_RW_BIT) == - ATTR_AP(ATTR_AP_RW)) { + if (pmap_pte_dirty(tpte)) { switch (lvl) { case 1: for (mt = m; mt < &m[L2_SIZE / PAGE_SIZE]; mt++) From owner-svn-src-all@freebsd.org Fri Jul 12 18:13:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02E3A15D1EF0; Fri, 12 Jul 2019 18:13:59 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9E65F84B8C; Fri, 12 Jul 2019 18:13:58 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 79A871A386; Fri, 12 Jul 2019 18:13:58 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CIDw1f028711; Fri, 12 Jul 2019 18:13:58 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CIDwFY028710; Fri, 12 Jul 2019 18:13:58 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907121813.x6CIDwFY028710@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Fri, 12 Jul 2019 18:13:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349944 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349944 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9E65F84B8C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 18:13:59 -0000 Author: seanc (ports committer) Date: Fri Jul 12 18:13:58 2019 New Revision: 349944 URL: https://svnweb.freebsd.org/changeset/base/349944 Log: usr.sbin/bhyve: don't leak a FD if the device is not a tty Coverity CID: 1194193 Approved by: markj, jhb Differential Revision: https://reviews.freebsd.org/D20934 Modified: head/usr.sbin/bhyve/uart_emul.c Modified: head/usr.sbin/bhyve/uart_emul.c ============================================================================== --- head/usr.sbin/bhyve/uart_emul.c Fri Jul 12 15:24:25 2019 (r349943) +++ head/usr.sbin/bhyve/uart_emul.c Fri Jul 12 18:13:58 2019 (r349944) @@ -678,8 +678,13 @@ uart_tty_backend(struct uart_softc *sc, const char *op int fd; fd = open(opts, O_RDWR | O_NONBLOCK); - if (fd < 0 || !isatty(fd)) + if (fd < 0) return (-1); + + if (!isatty(fd)) { + close(fd); + return (-1); + } sc->tty.rfd = sc->tty.wfd = fd; sc->tty.opened = true; From owner-svn-src-all@freebsd.org Fri Jul 12 18:17:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE16D15D20A9; Fri, 12 Jul 2019 18:17:36 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 937C484EC3; Fri, 12 Jul 2019 18:17:36 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6050C1A3B3; Fri, 12 Jul 2019 18:17:36 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CIHaY5028895; Fri, 12 Jul 2019 18:17:36 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CIHa03028894; Fri, 12 Jul 2019 18:17:36 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907121817.x6CIHa03028894@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Fri, 12 Jul 2019 18:17:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349945 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349945 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 937C484EC3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 18:17:37 -0000 Author: seanc (ports committer) Date: Fri Jul 12 18:17:35 2019 New Revision: 349945 URL: https://svnweb.freebsd.org/changeset/base/349945 Log: usr.sbin/bhyve: prevent use-after-free in virtio scsi request handling Coverity CID: 1393377 Approved by: araujo, jhb Differential Revision: https://reviews.freebsd.org/D20915 Modified: head/usr.sbin/bhyve/pci_virtio_scsi.c Modified: head/usr.sbin/bhyve/pci_virtio_scsi.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_scsi.c Fri Jul 12 18:13:58 2019 (r349944) +++ head/usr.sbin/bhyve/pci_virtio_scsi.c Fri Jul 12 18:17:35 2019 (r349945) @@ -465,7 +465,7 @@ pci_vtscsi_request_handle(struct pci_vtscsi_queue *q, int data_niov_in, data_niov_out; void *ext_data_ptr = NULL; uint32_t ext_data_len = 0, ext_sg_entries = 0; - int err; + int err, nxferred; seek_iov(iov_in, niov_in, data_iov_in, &data_niov_in, VTSCSI_IN_HEADER_LEN(sc)); @@ -544,10 +544,11 @@ pci_vtscsi_request_handle(struct pci_vtscsi_queue *q, } buf_to_iov(cmd_wr, VTSCSI_OUT_HEADER_LEN(sc), iov_out, niov_out, 0); + nxferred = VTSCSI_OUT_HEADER_LEN(sc) + io->scsiio.ext_data_filled; free(cmd_rd); free(cmd_wr); ctl_scsi_free_io(io); - return (VTSCSI_OUT_HEADER_LEN(sc) + io->scsiio.ext_data_filled); + return (nxferred); } static void From owner-svn-src-all@freebsd.org Fri Jul 12 18:20:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0CCFC15D21E8; Fri, 12 Jul 2019 18:20:57 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9F403851A4; Fri, 12 Jul 2019 18:20:56 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 78CB71A419; Fri, 12 Jul 2019 18:20:56 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CIKu6g030705; Fri, 12 Jul 2019 18:20:56 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CIKu1c030704; Fri, 12 Jul 2019 18:20:56 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907121820.x6CIKu1c030704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Fri, 12 Jul 2019 18:20:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349946 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349946 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9F403851A4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 18:20:57 -0000 Author: seanc (ports committer) Date: Fri Jul 12 18:20:56 2019 New Revision: 349946 URL: https://svnweb.freebsd.org/changeset/base/349946 Log: usr.sbin/bhyve: free resources when erroring out of pci_vtcon_sock_add() Coverity CID: 1362880 Approved by: markj, jhb Differential Revision: https://reviews.freebsd.org/D20916 Modified: head/usr.sbin/bhyve/pci_virtio_console.c Modified: head/usr.sbin/bhyve/pci_virtio_console.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_console.c Fri Jul 12 18:17:35 2019 (r349945) +++ head/usr.sbin/bhyve/pci_virtio_console.c Fri Jul 12 18:20:56 2019 (r349946) @@ -356,8 +356,11 @@ out: if (fd != -1) close(fd); - if (error != 0 && s != -1) - close(s); + if (error != 0) { + if (s != -1) + close(s); + free(sock); + } return (error); } From owner-svn-src-all@freebsd.org Fri Jul 12 18:33:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10E1F15D2834; Fri, 12 Jul 2019 18:33:59 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A560385CE4; Fri, 12 Jul 2019 18:33:58 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F0DA1A7A4; Fri, 12 Jul 2019 18:33:58 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CIXwpJ039193; Fri, 12 Jul 2019 18:33:58 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CIXwnA039192; Fri, 12 Jul 2019 18:33:58 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907121833.x6CIXwnA039192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Fri, 12 Jul 2019 18:33:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349947 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349947 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A560385CE4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 18:33:59 -0000 Author: seanc (ports committer) Date: Fri Jul 12 18:33:58 2019 New Revision: 349947 URL: https://svnweb.freebsd.org/changeset/base/349947 Log: usr.sbin/bhyve: only unassign a pt device after obtaining bus/slot/func Coverity CID: 1194302, 1194303, 1194304 Approved by: jhb, markj Differential Revision: https://reviews.freebsd.org/D20933 Modified: head/usr.sbin/bhyve/pci_passthru.c Modified: head/usr.sbin/bhyve/pci_passthru.c ============================================================================== --- head/usr.sbin/bhyve/pci_passthru.c Fri Jul 12 18:20:56 2019 (r349946) +++ head/usr.sbin/bhyve/pci_passthru.c Fri Jul 12 18:33:58 2019 (r349947) @@ -668,14 +668,14 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *p memflags = vm_get_memflags(ctx); if (!(memflags & VM_MEM_F_WIRED)) { warnx("passthru requires guest memory to be wired"); - goto done; + return (error); } if (pcifd < 0) { pcifd = open(_PATH_DEVPCI, O_RDWR, 0); if (pcifd < 0) { warn("failed to open %s", _PATH_DEVPCI); - goto done; + return (error); } } @@ -690,7 +690,7 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *p iofd = open(_PATH_DEVIO, O_RDWR, 0); if (iofd < 0) { warn("failed to open %s", _PATH_DEVIO); - goto done; + return (error); } } @@ -705,7 +705,7 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *p memfd = open(_PATH_MEM, O_RDWR, 0); if (memfd < 0) { warn("failed to open %s", _PATH_MEM); - goto done; + return (error); } } @@ -719,7 +719,7 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *p if (opts == NULL || sscanf(opts, "%d/%d/%d", &bus, &slot, &func) != 3) { warnx("invalid passthru options"); - goto done; + return (error); } if (vm_assign_pptdev(ctx, bus, slot, func) != 0) { @@ -734,10 +734,7 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *p sc->psc_pi = pi; /* initialize config space */ - if ((error = cfginit(ctx, pi, bus, slot, func)) != 0) - goto done; - - error = 0; /* success */ + error = cfginit(ctx, pi, bus, slot, func); done: if (error) { free(sc); From owner-svn-src-all@freebsd.org Fri Jul 12 18:37:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B08B15D28FB; Fri, 12 Jul 2019 18:37:58 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CFE1885EFB; Fri, 12 Jul 2019 18:37:57 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A57CC1A7BA; Fri, 12 Jul 2019 18:37:57 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CIbvph039409; Fri, 12 Jul 2019 18:37:57 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CIbugC039406; Fri, 12 Jul 2019 18:37:56 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201907121837.x6CIbugC039406@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Fri, 12 Jul 2019 18:37:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349948 - in head/sys/amd64: include vmm X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: in head/sys/amd64: include vmm X-SVN-Commit-Revision: 349948 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CFE1885EFB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 18:37:58 -0000 Author: scottl Date: Fri Jul 12 18:37:56 2019 New Revision: 349948 URL: https://svnweb.freebsd.org/changeset/base/349948 Log: Tie the name limit of a VM to SPECNAMELEN from devfs instead of a hard-coded value. Don't allocate space for it from the kernel stack. Account for prefix, suffix, and separator space in the name. This takes the effective length up to 229 bytes on 13-current, and 37 bytes on 12-stable. 37 bytes is enough to hold a full GUID string. PR: 234134 MFC after: 1 week Differential Revision: http://reviews.freebsd.org/D20924 Modified: head/sys/amd64/include/vmm.h head/sys/amd64/include/vmm_dev.h head/sys/amd64/vmm/vmm_dev.c Modified: head/sys/amd64/include/vmm.h ============================================================================== --- head/sys/amd64/include/vmm.h Fri Jul 12 18:33:58 2019 (r349947) +++ head/sys/amd64/include/vmm.h Fri Jul 12 18:37:56 2019 (r349948) @@ -114,9 +114,30 @@ enum x2apic_state { #define VM_INTINFO_HWEXCEPTION (3 << 8) #define VM_INTINFO_SWINTR (4 << 8) -#ifdef _KERNEL +/* + * The VM name has to fit into the pathname length constraints of devfs, + * governed primarily by SPECNAMELEN. The length is the total number of + * characters in the full path, relative to the mount point and not + * including any leading '/' characters. + * A prefix and a suffix are added to the name specified by the user. + * The prefix is usually "vmm/" or "vmm.io/", but can be a few characters + * longer for future use. + * The suffix is a string that identifies a bootrom image or some similar + * image that is attached to the VM. A separator character gets added to + * the suffix automatically when generating the full path, so it must be + * accounted for, reducing the effective length by 1. + * The effective length of a VM name is 229 bytes for FreeBSD 13 and 37 + * bytes for FreeBSD 12. A minimum length is set for safety and supports + * a SPECNAMELEN as small as 32 on old systems. + */ +#define VM_MAX_PREFIXLEN 10 +#define VM_MAX_SUFFIXLEN 15 +#define VM_MIN_NAMELEN 6 +#define VM_MAX_NAMELEN \ + (SPECNAMELEN - VM_MAX_PREFIXLEN - VM_MAX_SUFFIXLEN - 1) -#define VM_MAX_NAMELEN 32 +#ifdef _KERNEL +CTASSERT(VM_MAX_NAMELEN >= VM_MIN_NAMELEN); struct vm; struct vm_exception; Modified: head/sys/amd64/include/vmm_dev.h ============================================================================== --- head/sys/amd64/include/vmm_dev.h Fri Jul 12 18:33:58 2019 (r349947) +++ head/sys/amd64/include/vmm_dev.h Fri Jul 12 18:37:56 2019 (r349948) @@ -51,7 +51,7 @@ struct vm_memmap { struct vm_memseg { int segid; size_t len; - char name[SPECNAMELEN + 1]; + char name[VM_MAX_SUFFIXLEN + 1]; }; struct vm_register { Modified: head/sys/amd64/vmm/vmm_dev.c ============================================================================== --- head/sys/amd64/vmm/vmm_dev.c Fri Jul 12 18:33:58 2019 (r349947) +++ head/sys/amd64/vmm/vmm_dev.c Fri Jul 12 18:37:56 2019 (r349948) @@ -245,7 +245,7 @@ vmmdev_rw(struct cdev *cdev, struct uio *uio, int flag return (error); } -CTASSERT(sizeof(((struct vm_memseg *)0)->name) >= SPECNAMELEN + 1); +CTASSERT(sizeof(((struct vm_memseg *)0)->name) >= VM_MAX_SUFFIXLEN + 1); static int get_memseg(struct vmmdev_softc *sc, struct vm_memseg *mseg) @@ -265,7 +265,8 @@ get_memseg(struct vmmdev_softc *sc, struct vm_memseg * } KASSERT(dsc != NULL, ("%s: devmem segment %d not found", __func__, mseg->segid)); - error = copystr(dsc->name, mseg->name, SPECNAMELEN + 1, NULL); + error = copystr(dsc->name, mseg->name, sizeof(mseg->name), + NULL); } else { bzero(mseg->name, sizeof(mseg->name)); } @@ -284,10 +285,14 @@ alloc_memseg(struct vmmdev_softc *sc, struct vm_memseg name = NULL; sysmem = true; + /* + * The allocation is lengthened by 1 to hold a terminating NUL. It'll + * by stripped off when devfs processes the full string. + */ if (VM_MEMSEG_NAME(mseg)) { sysmem = false; - name = malloc(SPECNAMELEN + 1, M_VMMDEV, M_WAITOK); - error = copystr(mseg->name, name, SPECNAMELEN + 1, 0); + name = malloc(sizeof(mseg->name) M_VMMDEV, M_WAITOK); + error = copystr(mseg->name, name, sizeof(mseg->name), NULL); if (error) goto done; } @@ -894,26 +899,29 @@ vmmdev_destroy(void *arg) static int sysctl_vmm_destroy(SYSCTL_HANDLER_ARGS) { - int error; - char buf[VM_MAX_NAMELEN]; struct devmem_softc *dsc; struct vmmdev_softc *sc; struct cdev *cdev; + char *buf; + int error, buflen; error = vmm_priv_check(req->td->td_ucred); if (error) return (error); - strlcpy(buf, "beavis", sizeof(buf)); - error = sysctl_handle_string(oidp, buf, sizeof(buf), req); + buflen = VM_MAX_NAMELEN + 1; + buf = malloc(buflen, M_VMMDEV, M_WAITOK | M_ZERO); + strlcpy(buf, "beavis", buflen); + error = sysctl_handle_string(oidp, buf, buflen, req); if (error != 0 || req->newptr == NULL) - return (error); + goto out; mtx_lock(&vmmdev_mtx); sc = vmmdev_lookup(buf); if (sc == NULL || sc->cdev == NULL) { mtx_unlock(&vmmdev_mtx); - return (EINVAL); + error = EINVAL; + goto out; } /* @@ -943,7 +951,11 @@ sysctl_vmm_destroy(SYSCTL_HANDLER_ARGS) destroy_dev_sched_cb(dsc->cdev, devmem_destroy, dsc); } destroy_dev_sched_cb(cdev, vmmdev_destroy, sc); - return (0); + error = 0; + +out: + free(buf, M_VMMDEV); + return (error); } SYSCTL_PROC(_hw_vmm, OID_AUTO, destroy, CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_PRISON, @@ -961,30 +973,34 @@ static struct cdevsw vmmdevsw = { static int sysctl_vmm_create(SYSCTL_HANDLER_ARGS) { - int error; struct vm *vm; struct cdev *cdev; struct vmmdev_softc *sc, *sc2; - char buf[VM_MAX_NAMELEN]; + char *buf; + int error, buflen; error = vmm_priv_check(req->td->td_ucred); if (error) return (error); - strlcpy(buf, "beavis", sizeof(buf)); - error = sysctl_handle_string(oidp, buf, sizeof(buf), req); + buflen = VM_MAX_NAMELEN + 1; + buf = malloc(buflen, M_VMMDEV, M_WAITOK | M_ZERO); + strlcpy(buf, "beavis", buflen); + error = sysctl_handle_string(oidp, buf, buflen, req); if (error != 0 || req->newptr == NULL) - return (error); + goto out; mtx_lock(&vmmdev_mtx); sc = vmmdev_lookup(buf); mtx_unlock(&vmmdev_mtx); - if (sc != NULL) - return (EEXIST); + if (sc != NULL) { + error = EEXIST; + goto out; + } error = vm_create(buf, &vm); if (error != 0) - return (error); + goto out; sc = malloc(sizeof(struct vmmdev_softc), M_VMMDEV, M_WAITOK | M_ZERO); sc->vm = vm; @@ -1004,14 +1020,15 @@ sysctl_vmm_create(SYSCTL_HANDLER_ARGS) if (sc2 != NULL) { vmmdev_destroy(sc); - return (EEXIST); + error = EEXIST; + goto out; } error = make_dev_p(MAKEDEV_CHECKNAME, &cdev, &vmmdevsw, NULL, UID_ROOT, GID_WHEEL, 0600, "vmm/%s", buf); if (error != 0) { vmmdev_destroy(sc); - return (error); + goto out; } mtx_lock(&vmmdev_mtx); @@ -1019,7 +1036,9 @@ sysctl_vmm_create(SYSCTL_HANDLER_ARGS) sc->cdev->si_drv1 = sc; mtx_unlock(&vmmdev_mtx); - return (0); +out: + free(buf, M_VMMDEV); + return (error); } SYSCTL_PROC(_hw_vmm, OID_AUTO, create, CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_PRISON, From owner-svn-src-all@freebsd.org Fri Jul 12 18:38:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0A2415D2929; Fri, 12 Jul 2019 18:38:19 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 54C868601F; Fri, 12 Jul 2019 18:38:19 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 36ACC1A7BD; Fri, 12 Jul 2019 18:38:19 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CIcJEx039480; Fri, 12 Jul 2019 18:38:19 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CIcJ3K039479; Fri, 12 Jul 2019 18:38:19 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907121838.x6CIcJ3K039479@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Fri, 12 Jul 2019 18:38:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349949 - head/usr.sbin/bhyveload X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyveload X-SVN-Commit-Revision: 349949 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 54C868601F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 18:38:19 -0000 Author: seanc (ports committer) Date: Fri Jul 12 18:38:18 2019 New Revision: 349949 URL: https://svnweb.freebsd.org/changeset/base/349949 Log: usr.sbin/bhyveload: don't leak an fd if a device can't be opened Coverity CID: 1194167 Approved by: markj, jhb Differential Revision: https://reviews.freebsd.org/D20935 Modified: head/usr.sbin/bhyveload/bhyveload.c Modified: head/usr.sbin/bhyveload/bhyveload.c ============================================================================== --- head/usr.sbin/bhyveload/bhyveload.c Fri Jul 12 18:37:56 2019 (r349948) +++ head/usr.sbin/bhyveload/bhyveload.c Fri Jul 12 18:38:18 2019 (r349949) @@ -664,21 +664,19 @@ altcons_open(char *path) static int disk_open(char *path) { - int err, fd; + int fd; if (ndisks >= NDISKS) return (ERANGE); - err = 0; fd = open(path, O_RDONLY); + if (fd < 0) + return (errno); - if (fd > 0) { - disk_fd[ndisks] = fd; - ndisks++; - } else - err = errno; + disk_fd[ndisks] = fd; + ndisks++; - return (err); + return (0); } static void From owner-svn-src-all@freebsd.org Fri Jul 12 18:39:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1DE4C15D2A5C; Fri, 12 Jul 2019 18:39:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B6B6A86270; Fri, 12 Jul 2019 18:39:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 943921A7E8; Fri, 12 Jul 2019 18:39:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CIdfb9039573; Fri, 12 Jul 2019 18:39:41 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CIdfhb039572; Fri, 12 Jul 2019 18:39:41 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201907121839.x6CIdfhb039572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 12 Jul 2019 18:39:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349950 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 349950 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B6B6A86270 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 18:39:42 -0000 Author: kib Date: Fri Jul 12 18:39:41 2019 New Revision: 349950 URL: https://svnweb.freebsd.org/changeset/base/349950 Log: Style: avoid long lines by using .Fo instead of .Fn. Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/share/man/man9/casuword.9 Modified: head/share/man/man9/casuword.9 ============================================================================== --- head/share/man/man9/casuword.9 Fri Jul 12 18:38:18 2019 (r349949) +++ head/share/man/man9/casuword.9 Fri Jul 12 18:39:41 2019 (r349950) @@ -41,13 +41,31 @@ .In sys/types.h .In sys/systm.h .Ft int -.Fn casueword "volatile u_long *base" "u_long oldval" "u_long *oldvalp" "u_long newval" +.Fo casueword +.Fa "volatile u_long *base" +.Fa "u_long oldval" +.Fa "u_long *oldvalp" +.Fa "u_long newval" +.Fc .Ft int -.Fn casueword32 "volatile uint32_t *base" "uint32_t oldval" "uint32_t *oldvalp" "uint32_t newval" +.Fo casueword32 +.Fa "volatile uint32_t *base" +.Fa "uint32_t oldval" +.Fa "uint32_t *oldvalp" +.Fa "uint32_t newval" +.Fc .Ft u_long -.Fn casuword "volatile u_long *base" "u_long oldval" "u_long newval" +.Fo casuword +.Fa "volatile u_long *base" +.Fa "u_long oldval" +.Fa "u_long newval" +.Fc .Ft uint32_t -.Fn casuword32 "volatile uint32_t *base" "uint32_t oldval" "uint32_t newval" +.Fo casuword32 +.Fa "volatile uint32_t *base" +.Fa "uint32_t oldval" +.Fa "uint32_t newval" +.Fc .Sh DESCRIPTION The .Nm From owner-svn-src-all@freebsd.org Fri Jul 12 18:43:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC1C015D2D82; Fri, 12 Jul 2019 18:43:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8EB3D86741; Fri, 12 Jul 2019 18:43:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 795D81A99A; Fri, 12 Jul 2019 18:43:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CIhPhm044241; Fri, 12 Jul 2019 18:43:25 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CIhOPG044234; Fri, 12 Jul 2019 18:43:24 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201907121843.x6CIhOPG044234@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 12 Jul 2019 18:43:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349951 - in head: share/man/man9 sys/amd64/amd64 sys/arm/arm sys/arm64/arm64 sys/i386/i386 sys/kern sys/mips/mips sys/powerpc/powerpc sys/riscv/riscv sys/sparc64/sparc64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head: share/man/man9 sys/amd64/amd64 sys/arm/arm sys/arm64/arm64 sys/i386/i386 sys/kern sys/mips/mips sys/powerpc/powerpc sys/riscv/riscv sys/sparc64/sparc64 X-SVN-Commit-Revision: 349951 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8EB3D86741 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 18:43:26 -0000 Author: kib Date: Fri Jul 12 18:43:24 2019 New Revision: 349951 URL: https://svnweb.freebsd.org/changeset/base/349951 Log: Provide protection against starvation of the ll/sc loops when accessing userpace. Casueword(9) on ll/sc architectures must be prepared for userspace constantly modifying the same cache line as containing the CAS word, and not loop infinitely. Otherwise, rogue userspace livelocks the kernel. To fix the issue, change casueword(9) interface to return new value 1 indicating that either comparision or store failed, instead of relying on the oldval == *oldvalp comparison. The primitive no longer retries the operation if it failed spuriously. Modify callers of casueword(9), all in kern_umtx.c, to handle retries, and react to stops and requests to terminate between retries. On x86, despite cmpxchg should not return spurious failures, we can take advantage of the new interface and just return PSL.ZF. Reviewed by: andrew (arm64, previous version), markj Tested by: pho Reported by: https://xenbits.xen.org/xsa/advisory-295.txt Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D20772 Modified: head/share/man/man9/casuword.9 head/sys/amd64/amd64/support.S head/sys/arm/arm/fusu.S head/sys/arm64/arm64/support.S head/sys/i386/i386/copyout.c head/sys/kern/kern_umtx.c head/sys/mips/mips/support.S head/sys/powerpc/powerpc/copyinout.c head/sys/riscv/riscv/support.S head/sys/sparc64/sparc64/support.S head/sys/sparc64/sparc64/vm_machdep.c Modified: head/share/man/man9/casuword.9 ============================================================================== --- head/share/man/man9/casuword.9 Fri Jul 12 18:39:41 2019 (r349950) +++ head/share/man/man9/casuword.9 Fri Jul 12 18:43:24 2019 (r349951) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2014 The FreeBSD Foundation +.\" Copyright (c) 2014, 2019 The FreeBSD Foundation .\" All rights reserved. .\" .\" Part of this documentation was written by @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 21, 2014 +.Dd April 19, 2019 .Dt CASU 9 .Os .Sh NAME @@ -106,7 +106,9 @@ The .Fn casueword and .Fn casueword32 -functions return 0 on success and -1 on failure. +functions return 0 on success, -1 on failure to access memory, +and 1 when comparison or store failed. +The store can fail on load-linked/store-conditional architectures. .Sh SEE ALSO .Xr atomic 9 , .Xr fetch 9 , Modified: head/sys/amd64/amd64/support.S ============================================================================== --- head/sys/amd64/amd64/support.S Fri Jul 12 18:39:41 2019 (r349950) +++ head/sys/amd64/amd64/support.S Fri Jul 12 18:43:24 2019 (r349951) @@ -811,6 +811,7 @@ ENTRY(casueword32_nosmap) lock #endif cmpxchgl %ecx,(%rdi) /* new = %ecx */ + setne %cl /* * The old value is in %eax. If the store succeeded it will be the @@ -828,6 +829,7 @@ ENTRY(casueword32_nosmap) */ movl %esi,(%rdx) /* oldp = %rdx */ POP_FRAME_POINTER + movzbl %cl, %eax ret END(casueword32_nosmap) @@ -847,6 +849,7 @@ ENTRY(casueword32_smap) #endif cmpxchgl %ecx,(%rdi) /* new = %ecx */ clac + setne %cl /* * The old value is in %eax. If the store succeeded it will be the @@ -864,6 +867,7 @@ ENTRY(casueword32_smap) */ movl %esi,(%rdx) /* oldp = %rdx */ POP_FRAME_POINTER + movzbl %cl, %eax ret END(casueword32_smap) @@ -886,6 +890,7 @@ ENTRY(casueword_nosmap) lock #endif cmpxchgq %rcx,(%rdi) /* new = %rcx */ + setne %cl /* * The old value is in %rax. If the store succeeded it will be the @@ -897,6 +902,7 @@ ENTRY(casueword_nosmap) movq %rax,PCB_ONFAULT(%r8) movq %rsi,(%rdx) POP_FRAME_POINTER + movzbl %cl, %eax ret END(casueword_nosmap) @@ -916,6 +922,7 @@ ENTRY(casueword_smap) #endif cmpxchgq %rcx,(%rdi) /* new = %rcx */ clac + setne %cl /* * The old value is in %rax. If the store succeeded it will be the @@ -927,6 +934,7 @@ ENTRY(casueword_smap) movq %rax,PCB_ONFAULT(%r8) movq %rsi,(%rdx) POP_FRAME_POINTER + movzbl %cl, %eax ret END(casueword_smap) Modified: head/sys/arm/arm/fusu.S ============================================================================== --- head/sys/arm/arm/fusu.S Fri Jul 12 18:39:41 2019 (r349950) +++ head/sys/arm/arm/fusu.S Fri Jul 12 18:43:24 2019 (r349951) @@ -63,7 +63,7 @@ EENTRY_NP(casueword32) ldr r4, =(VM_MAXUSER_ADDRESS-3) cmp r0, r4 mvncs r0, #0 - bcs 2f + bcs 1f GET_PCB(r6) ldr r6, [r6] @@ -78,12 +78,10 @@ EENTRY_NP(casueword32) str r4, [r6, #PCB_ONFAULT] #if __ARM_ARCH >= 6 -1: + mov r5, #1 ldrex r4, [r0] cmp r4, r1 strexeq r5, r3, [r0] - cmpeq r5, #1 - beq 1b #else ldrt r4, [r0] cmp r4, r1 @@ -92,7 +90,10 @@ EENTRY_NP(casueword32) str r4, [r2] mov r0, #0 str r0, [r6, #PCB_ONFAULT] -2: +#if __ARM_ARCH >= 6 + mov r0, r5 +#endif +1: ldmfd sp!, {r4, r5, r6} RET EEND(casueword32) Modified: head/sys/arm64/arm64/support.S ============================================================================== --- head/sys/arm64/arm64/support.S Fri Jul 12 18:39:41 2019 (r349950) +++ head/sys/arm64/arm64/support.S Fri Jul 12 18:43:24 2019 (r349951) @@ -57,17 +57,17 @@ ENTRY(casueword32) cmp x0, x4 b.cs fsu_fault_nopcb adr x6, fsu_fault /* Load the fault handler */ + mov w5, #1 SET_FAULT_HANDLER(x6, x4) /* And set it */ ENTER_USER_ACCESS(w6, x4) 1: ldxr w4, [x0] /* Load-exclusive the data */ cmp w4, w1 /* Compare */ b.ne 2f /* Not equal, exit */ stxr w5, w3, [x0] /* Store the new data */ - cbnz w5, 1b /* Retry on failure */ 2: EXIT_USER_ACCESS(w6) - SET_FAULT_HANDLER(xzr, x5) /* Reset the fault handler */ + SET_FAULT_HANDLER(xzr, x6) /* Reset the fault handler */ str w4, [x2] /* Store the read data */ - mov x0, #0 /* Success */ + mov w0, w5 /* Result same as store status */ ret /* Return */ END(casueword32) @@ -79,17 +79,17 @@ ENTRY(casueword) cmp x0, x4 b.cs fsu_fault_nopcb adr x6, fsu_fault /* Load the fault handler */ + mov w5, #1 SET_FAULT_HANDLER(x6, x4) /* And set it */ ENTER_USER_ACCESS(w6, x4) 1: ldxr x4, [x0] /* Load-exclusive the data */ cmp x4, x1 /* Compare */ b.ne 2f /* Not equal, exit */ stxr w5, x3, [x0] /* Store the new data */ - cbnz w5, 1b /* Retry on failure */ 2: EXIT_USER_ACCESS(w6) - SET_FAULT_HANDLER(xzr, x5) /* Reset the fault handler */ + SET_FAULT_HANDLER(xzr, x6) /* Reset the fault handler */ str x4, [x2] /* Store the read data */ - mov x0, #0 /* Success */ + mov w0, w5 /* Result same as store status */ ret /* Return */ END(casueword) Modified: head/sys/i386/i386/copyout.c ============================================================================== --- head/sys/i386/i386/copyout.c Fri Jul 12 18:39:41 2019 (r349950) +++ head/sys/i386/i386/copyout.c Fri Jul 12 18:43:24 2019 (r349951) @@ -428,6 +428,7 @@ suword32(volatile void *base, int32_t word) struct casueword_arg0 { uint32_t oldval; uint32_t newval; + int res; }; static void @@ -436,7 +437,8 @@ casueword_slow0(vm_offset_t kva, void *arg) struct casueword_arg0 *ca; ca = arg; - atomic_fcmpset_int((u_int *)kva, &ca->oldval, ca->newval); + ca->res = 1 - atomic_fcmpset_int((u_int *)kva, &ca->oldval, + ca->newval); } int @@ -452,7 +454,7 @@ casueword32(volatile uint32_t *base, uint32_t oldval, casueword_slow0, &ca); if (res == 0) { *oldvalp = ca.oldval; - return (0); + return (ca.res); } return (-1); } @@ -469,7 +471,7 @@ casueword(volatile u_long *base, u_long oldval, u_long casueword_slow0, &ca); if (res == 0) { *oldvalp = ca.oldval; - return (0); + return (ca.res); } return (-1); } Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Fri Jul 12 18:39:41 2019 (r349950) +++ head/sys/kern/kern_umtx.c Fri Jul 12 18:43:24 2019 (r349951) @@ -690,8 +690,26 @@ umtxq_count_pi(struct umtx_key *key, struct umtx_q **f return (0); } +/* + * Check for possible stops and suspensions while executing a umtx + * locking operation. + * + * The sleep argument controls whether the function can handle a stop + * request itself or it should return ERESTART and the request is + * proceed at the kernel/user boundary in ast. + * + * Typically, when retrying due to casueword(9) failure (rv == 1), we + * should handle the stop requests there, with exception of cases when + * the thread busied the umtx key, or when functions return + * immediately if umtxq_check_susp() returned non-zero. On the other + * hand, retrying the whole lock operation, we better not stop there + * but delegate the handling to ast. + * + * If the request is for thread termination P_SINGLE_EXIT, we cannot + * handle it at all, and simply return EINTR. + */ static int -umtxq_check_susp(struct thread *td) +umtxq_check_susp(struct thread *td, bool sleep) { struct proc *p; int error; @@ -710,7 +728,7 @@ umtxq_check_susp(struct thread *td) if (p->p_flag & P_SINGLE_EXIT) error = EINTR; else - error = ERESTART; + error = sleep ? thread_suspend_check(0) : ERESTART; } PROC_UNLOCK(p); return (error); @@ -1049,9 +1067,12 @@ do_lock_normal(struct thread *td, struct umutex *m, ui id | UMUTEX_CONTESTED); if (rv == -1) return (EFAULT); - if (owner == UMUTEX_RB_OWNERDEAD) + if (rv == 0) { + MPASS(owner == UMUTEX_RB_OWNERDEAD); return (EOWNERDEAD); /* success */ - rv = umtxq_check_susp(td); + } + MPASS(rv == 1); + rv = umtxq_check_susp(td, false); if (rv != 0) return (rv); continue; @@ -1070,13 +1091,16 @@ do_lock_normal(struct thread *td, struct umutex *m, ui return (EFAULT); /* The acquire succeeded. */ - if (owner == UMUTEX_UNOWNED) + if (rv == 0) { + MPASS(owner == UMUTEX_UNOWNED); return (0); + } /* * If no one owns it but it is contested try * to acquire it. */ + MPASS(rv == 1); if (owner == UMUTEX_CONTESTED) { rv = casueword32(&m->m_owner, UMUTEX_CONTESTED, &owner, @@ -1084,20 +1108,27 @@ do_lock_normal(struct thread *td, struct umutex *m, ui /* The address was invalid. */ if (rv == -1) return (EFAULT); - - if (owner == UMUTEX_CONTESTED) + if (rv == 0) { + MPASS(owner == UMUTEX_CONTESTED); return (0); + } + if (rv == 1) { + rv = umtxq_check_susp(td, false); + if (rv != 0) + return (rv); + } - rv = umtxq_check_susp(td); - if (rv != 0) - return (rv); - /* * If this failed the lock has * changed, restart. */ continue; } + + /* rv == 1 but not contested, likely store failure */ + rv = umtxq_check_susp(td, false); + if (rv != 0) + return (rv); } if (mode == _UMUTEX_TRY) @@ -1128,14 +1159,21 @@ do_lock_normal(struct thread *td, struct umutex *m, ui rv = casueword32(&m->m_owner, owner, &old, owner | UMUTEX_CONTESTED); - /* The address was invalid. */ - if (rv == -1) { + /* The address was invalid or casueword failed to store. */ + if (rv == -1 || rv == 1) { umtxq_lock(&uq->uq_key); umtxq_remove(uq); umtxq_unbusy(&uq->uq_key); umtxq_unlock(&uq->uq_key); umtx_key_release(&uq->uq_key); - return (EFAULT); + if (rv == -1) + return (EFAULT); + if (rv == 1) { + rv = umtxq_check_susp(td, false); + if (rv != 0) + return (rv); + } + continue; } /* @@ -1145,15 +1183,15 @@ do_lock_normal(struct thread *td, struct umutex *m, ui */ umtxq_lock(&uq->uq_key); umtxq_unbusy(&uq->uq_key); - if (old == owner) - error = umtxq_sleep(uq, "umtxn", timeout == NULL ? - NULL : &timo); + MPASS(old == owner); + error = umtxq_sleep(uq, "umtxn", timeout == NULL ? + NULL : &timo); umtxq_remove(uq); umtxq_unlock(&uq->uq_key); umtx_key_release(&uq->uq_key); if (error == 0) - error = umtxq_check_susp(td); + error = umtxq_check_susp(td, false); } return (0); @@ -1170,6 +1208,8 @@ do_unlock_normal(struct thread *td, struct umutex *m, int error, count; id = td->td_tid; + +again: /* * Make sure we own this mtx. */ @@ -1185,9 +1225,14 @@ do_unlock_normal(struct thread *td, struct umutex *m, error = casueword32(&m->m_owner, owner, &old, newlock); if (error == -1) return (EFAULT); - if (old == owner) - return (0); - owner = old; + if (error == 1) { + error = umtxq_check_susp(td, false); + if (error != 0) + return (error); + goto again; + } + MPASS(old == owner); + return (0); } /* We should only ever be in here for contested locks */ @@ -1215,8 +1260,14 @@ do_unlock_normal(struct thread *td, struct umutex *m, umtx_key_release(&key); if (error == -1) return (EFAULT); - if (old != owner) - return (EINVAL); + if (error == 1) { + if (old != owner) + return (EINVAL); + error = umtxq_check_susp(td, false); + if (error != 0) + return (error); + goto again; + } return (0); } @@ -1233,6 +1284,7 @@ do_wake_umutex(struct thread *td, struct umutex *m) int error; int count; +again: error = fueword32(&m->m_owner, &owner); if (error == -1) return (EFAULT); @@ -1259,14 +1311,27 @@ do_wake_umutex(struct thread *td, struct umutex *m) owner != UMUTEX_RB_NOTRECOV) { error = casueword32(&m->m_owner, UMUTEX_CONTESTED, &owner, UMUTEX_UNOWNED); - if (error == -1) + if (error == -1) { error = EFAULT; + } else if (error == 1) { + umtxq_lock(&key); + umtxq_unbusy(&key); + umtxq_unlock(&key); + umtx_key_release(&key); + error = umtxq_check_susp(td, false); + if (error != 0) + return (error); + goto again; + } } umtxq_lock(&key); - if (error == 0 && count != 0 && ((owner & ~UMUTEX_CONTESTED) == 0 || - owner == UMUTEX_RB_OWNERDEAD || owner == UMUTEX_RB_NOTRECOV)) + if (error == 0 && count != 0) { + MPASS((owner & ~UMUTEX_CONTESTED) == 0 || + owner == UMUTEX_RB_OWNERDEAD || + owner == UMUTEX_RB_NOTRECOV); umtxq_signal(&key, 1); + } umtxq_unbusy(&key); umtxq_unlock(&key); umtx_key_release(&key); @@ -1314,49 +1379,32 @@ do_wake2_umutex(struct thread *td, struct umutex *m, u umtxq_busy(&key); count = umtxq_count(&key); umtxq_unlock(&key); + + error = fueword32(&m->m_owner, &owner); + if (error == -1) + error = EFAULT; + /* - * Only repair contention bit if there is a waiter, this means the mutex - * is still being referenced by userland code, otherwise don't update - * any memory. + * Only repair contention bit if there is a waiter, this means + * the mutex is still being referenced by userland code, + * otherwise don't update any memory. */ - if (count > 1) { - error = fueword32(&m->m_owner, &owner); - if (error == -1) + while (error == 0 && (owner & UMUTEX_CONTESTED) == 0 && + (count > 1 || (count == 1 && (owner & ~UMUTEX_CONTESTED) != 0))) { + error = casueword32(&m->m_owner, owner, &old, + owner | UMUTEX_CONTESTED); + if (error == -1) { error = EFAULT; - while (error == 0 && (owner & UMUTEX_CONTESTED) == 0) { - error = casueword32(&m->m_owner, owner, &old, - owner | UMUTEX_CONTESTED); - if (error == -1) { - error = EFAULT; - break; - } - if (old == owner) - break; - owner = old; - error = umtxq_check_susp(td); - if (error != 0) - break; + break; } - } else if (count == 1) { - error = fueword32(&m->m_owner, &owner); - if (error == -1) - error = EFAULT; - while (error == 0 && (owner & ~UMUTEX_CONTESTED) != 0 && - (owner & UMUTEX_CONTESTED) == 0) { - error = casueword32(&m->m_owner, owner, &old, - owner | UMUTEX_CONTESTED); - if (error == -1) { - error = EFAULT; - break; - } - if (old == owner) - break; - owner = old; - error = umtxq_check_susp(td); - if (error != 0) - break; + if (error == 0) { + MPASS(old == owner); + break; } + owner = old; + error = umtxq_check_susp(td, false); } + umtxq_lock(&key); if (error == EFAULT) { umtxq_signal(&key, INT_MAX); @@ -1842,9 +1890,9 @@ do_lock_pi(struct thread *td, struct umutex *m, uint32 error = EFAULT; break; } - /* The acquire succeeded. */ - if (owner == UMUTEX_UNOWNED) { + if (rv == 0) { + MPASS(owner == UMUTEX_UNOWNED); error = 0; break; } @@ -1854,6 +1902,16 @@ do_lock_pi(struct thread *td, struct umutex *m, uint32 break; } + /* + * Avoid overwriting a possible error from sleep due + * to the pending signal with suspension check result. + */ + if (error == 0) { + error = umtxq_check_susp(td, true); + if (error != 0) + break; + } + /* If no one owns it but it is contested try to acquire it. */ if (owner == UMUTEX_CONTESTED || owner == UMUTEX_RB_OWNERDEAD) { old_owner = owner; @@ -1864,36 +1922,40 @@ do_lock_pi(struct thread *td, struct umutex *m, uint32 error = EFAULT; break; } - - if (owner == old_owner) { - umtxq_lock(&uq->uq_key); - umtxq_busy(&uq->uq_key); - error = umtx_pi_claim(pi, td); - umtxq_unbusy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); - if (error != 0) { - /* - * Since we're going to return an - * error, restore the m_owner to its - * previous, unowned state to avoid - * compounding the problem. - */ - (void)casuword32(&m->m_owner, - id | UMUTEX_CONTESTED, - old_owner); + if (rv == 1) { + if (error == 0) { + error = umtxq_check_susp(td, true); + if (error != 0) + return (error); } - if (error == 0 && - old_owner == UMUTEX_RB_OWNERDEAD) - error = EOWNERDEAD; - break; + + /* + * If this failed the lock could + * changed, restart. + */ + continue; } - error = umtxq_check_susp(td); - if (error != 0) - break; - - /* If this failed the lock has changed, restart. */ - continue; + MPASS(rv == 0); + MPASS(owner == old_owner); + umtxq_lock(&uq->uq_key); + umtxq_busy(&uq->uq_key); + error = umtx_pi_claim(pi, td); + umtxq_unbusy(&uq->uq_key); + umtxq_unlock(&uq->uq_key); + if (error != 0) { + /* + * Since we're going to return an + * error, restore the m_owner to its + * previous, unowned state to avoid + * compounding the problem. + */ + (void)casuword32(&m->m_owner, + id | UMUTEX_CONTESTED, old_owner); + } + if (error == 0 && old_owner == UMUTEX_RB_OWNERDEAD) + error = EOWNERDEAD; + break; } if ((owner & ~UMUTEX_CONTESTED) == id) { @@ -1932,28 +1994,33 @@ do_lock_pi(struct thread *td, struct umutex *m, uint32 error = EFAULT; break; } - - umtxq_lock(&uq->uq_key); - /* - * We set the contested bit, sleep. Otherwise the lock changed - * and we need to retry or we lost a race to the thread - * unlocking the umtx. Note that the UMUTEX_RB_OWNERDEAD - * value for owner is impossible there. - */ - if (old == owner) { - error = umtxq_sleep_pi(uq, pi, - owner & ~UMUTEX_CONTESTED, - "umtxpi", timeout == NULL ? NULL : &timo, - (flags & USYNC_PROCESS_SHARED) != 0); + if (rv == 1) { + umtxq_unbusy_unlocked(&uq->uq_key); + error = umtxq_check_susp(td, true); if (error != 0) - continue; - } else { - umtxq_unbusy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); + break; + + /* + * The lock changed and we need to retry or we + * lost a race to the thread unlocking the + * umtx. Note that the UMUTEX_RB_OWNERDEAD + * value for owner is impossible there. + */ + continue; } - error = umtxq_check_susp(td); + umtxq_lock(&uq->uq_key); + + /* We set the contested bit, sleep. */ + MPASS(old == owner); + error = umtxq_sleep_pi(uq, pi, owner & ~UMUTEX_CONTESTED, + "umtxpi", timeout == NULL ? NULL : &timo, + (flags & USYNC_PROCESS_SHARED) != 0); if (error != 0) + continue; + + error = umtxq_check_susp(td, false); + if (error != 0) break; } @@ -1978,6 +2045,8 @@ do_unlock_pi(struct thread *td, struct umutex *m, uint int count, error, pri; id = td->td_tid; + +usrloop: /* * Make sure we own this mtx. */ @@ -1995,6 +2064,12 @@ do_unlock_pi(struct thread *td, struct umutex *m, uint error = casueword32(&m->m_owner, owner, &old, new_owner); if (error == -1) return (EFAULT); + if (error == 1) { + error = umtxq_check_susp(td, true); + if (error != 0) + return (error); + goto usrloop; + } if (old == owner) return (0); owner = old; @@ -2074,15 +2149,20 @@ do_unlock_pi(struct thread *td, struct umutex *m, uint if (count > 1) new_owner |= UMUTEX_CONTESTED; +again: error = casueword32(&m->m_owner, owner, &old, new_owner); - + if (error == 1) { + error = umtxq_check_susp(td, false); + if (error == 0) + goto again; + } umtxq_unbusy_unlocked(&key); umtx_key_release(&key); if (error == -1) return (EFAULT); - if (old != owner) + if (error == 0 && old != owner) return (EINVAL); - return (0); + return (error); } /* @@ -2149,31 +2229,49 @@ do_lock_pp(struct thread *td, struct umutex *m, uint32 error = EFAULT; break; } - - if (owner == UMUTEX_CONTESTED) { + if (rv == 0) { + MPASS(owner == UMUTEX_CONTESTED); error = 0; break; - } else if (owner == UMUTEX_RB_OWNERDEAD) { + } + /* rv == 1 */ + if (owner == UMUTEX_RB_OWNERDEAD) { rv = casueword32(&m->m_owner, UMUTEX_RB_OWNERDEAD, &owner, id | UMUTEX_CONTESTED); if (rv == -1) { error = EFAULT; break; } - if (owner == UMUTEX_RB_OWNERDEAD) { + if (rv == 0) { + MPASS(owner == UMUTEX_RB_OWNERDEAD); error = EOWNERDEAD; /* success */ break; } - error = 0; + + /* + * rv == 1, only check for suspension if we + * did not already catched a signal. If we + * get an error from the check, the same + * condition is checked by the umtxq_sleep() + * call below, so we should obliterate the + * error to not skip the last loop iteration. + */ + if (error == 0) { + error = umtxq_check_susp(td, false); + if (error == 0) { + if (try != 0) + error = EBUSY; + else + continue; + } + error = 0; + } } else if (owner == UMUTEX_RB_NOTRECOV) { error = ENOTRECOVERABLE; - break; } - if (try != 0) { + if (try != 0) error = EBUSY; - break; - } /* * If we caught a signal, we have retried and now @@ -2668,11 +2766,12 @@ do_rw_rdlock(struct thread *td, struct urwlock *rwlock umtx_key_release(&uq->uq_key); return (EFAULT); } - if (oldstate == state) { + if (rv == 0) { + MPASS(oldstate == state); umtx_key_release(&uq->uq_key); return (0); } - error = umtxq_check_susp(td); + error = umtxq_check_susp(td, true); if (error != 0) break; state = oldstate; @@ -2703,10 +2802,12 @@ do_rw_rdlock(struct thread *td, struct urwlock *rwlock error = EFAULT; break; } - if (oldstate == state) + if (rv == 0) { + MPASS(oldstate == state); goto sleep; + } state = oldstate; - error = umtxq_check_susp(td); + error = umtxq_check_susp(td, false); if (error != 0) break; } @@ -2718,7 +2819,7 @@ do_rw_rdlock(struct thread *td, struct urwlock *rwlock /* state is changed while setting flags, restart */ if (!(state & wrflags)) { umtxq_unbusy_unlocked(&uq->uq_key); - error = umtxq_check_susp(td); + error = umtxq_check_susp(td, true); if (error != 0) break; continue; @@ -2781,10 +2882,12 @@ sleep: error = EFAULT; break; } - if (oldstate == state) + if (rv == 0) { + MPASS(oldstate == state); break; + } state = oldstate; - error1 = umtxq_check_susp(td); + error1 = umtxq_check_susp(td, false); if (error1 != 0) { if (error == 0) error = error1; @@ -2840,22 +2943,25 @@ do_rw_wrlock(struct thread *td, struct urwlock *rwlock umtx_key_release(&uq->uq_key); return (EFAULT); } - if (oldstate == state) { + if (rv == 0) { + MPASS(oldstate == state); umtx_key_release(&uq->uq_key); return (0); } state = oldstate; - error = umtxq_check_susp(td); + error = umtxq_check_susp(td, true); if (error != 0) break; } if (error) { - if (!(state & (URWLOCK_WRITE_OWNER|URWLOCK_WRITE_WAITERS)) && + if ((state & (URWLOCK_WRITE_OWNER | + URWLOCK_WRITE_WAITERS)) == 0 && blocked_readers != 0) { umtxq_lock(&uq->uq_key); umtxq_busy(&uq->uq_key); - umtxq_signal_queue(&uq->uq_key, INT_MAX, UMTX_SHARED_QUEUE); + umtxq_signal_queue(&uq->uq_key, INT_MAX, + UMTX_SHARED_QUEUE); umtxq_unbusy(&uq->uq_key); umtxq_unlock(&uq->uq_key); } @@ -2885,10 +2991,12 @@ do_rw_wrlock(struct thread *td, struct urwlock *rwlock error = EFAULT; break; } - if (oldstate == state) + if (rv == 0) { + MPASS(oldstate == state); goto sleep; + } state = oldstate; - error = umtxq_check_susp(td); + error = umtxq_check_susp(td, false); if (error != 0) break; } @@ -2900,7 +3008,7 @@ do_rw_wrlock(struct thread *td, struct urwlock *rwlock if ((state & URWLOCK_WRITE_OWNER) == 0 && URWLOCK_READER_COUNT(state) == 0) { umtxq_unbusy_unlocked(&uq->uq_key); - error = umtxq_check_susp(td); + error = umtxq_check_susp(td, false); if (error != 0) break; continue; @@ -2958,10 +3066,12 @@ sleep: error = EFAULT; break; } - if (oldstate == state) + if (rv == 0) { + MPASS(oldstate == state); break; + } state = oldstate; - error1 = umtxq_check_susp(td); + error1 = umtxq_check_susp(td, false); /* * We are leaving the URWLOCK_WRITE_WAITERS * behind, but this should not harm the @@ -3021,13 +3131,13 @@ do_rw_unlock(struct thread *td, struct urwlock *rwlock error = EFAULT; goto out; } - if (oldstate != state) { + if (rv == 1) { state = oldstate; if (!(oldstate & URWLOCK_WRITE_OWNER)) { error = EPERM; goto out; } - error = umtxq_check_susp(td); + error = umtxq_check_susp(td, true); if (error != 0) goto out; } else @@ -3041,13 +3151,13 @@ do_rw_unlock(struct thread *td, struct urwlock *rwlock error = EFAULT; goto out; } - if (oldstate != state) { + if (rv == 1) { state = oldstate; if (URWLOCK_READER_COUNT(oldstate) == 0) { error = EPERM; goto out; } - error = umtxq_check_susp(td); + error = umtxq_check_susp(td, true); if (error != 0) goto out; } else @@ -3097,7 +3207,7 @@ do_sem_wait(struct thread *td, struct _usem *sem, stru struct abs_timeout timo; struct umtx_q *uq; uint32_t flags, count, count1; - int error, rv; + int error, rv, rv1; uq = td->td_umtxq; error = fueword32(&sem->_flags, &flags); @@ -3110,20 +3220,30 @@ do_sem_wait(struct thread *td, struct _usem *sem, stru if (timeout != NULL) abs_timeout_init2(&timo, timeout); +again: umtxq_lock(&uq->uq_key); umtxq_busy(&uq->uq_key); umtxq_insert(uq); umtxq_unlock(&uq->uq_key); rv = casueword32(&sem->_has_waiters, 0, &count1, 1); if (rv == 0) - rv = fueword32(&sem->_count, &count); - if (rv == -1 || count != 0) { + rv1 = fueword32(&sem->_count, &count); + if (rv == -1 || (rv == 0 && (rv1 == -1 || count != 0)) || rv == 1) { umtxq_lock(&uq->uq_key); umtxq_unbusy(&uq->uq_key); umtxq_remove(uq); umtxq_unlock(&uq->uq_key); - umtx_key_release(&uq->uq_key); - return (rv == -1 ? EFAULT : 0); + if (rv == 1) { + rv = umtxq_check_susp(td, true); + if (rv == 0) + goto again; + error = rv; + goto out; + } + if (rv == 0) + rv = rv1; + error = rv == -1 ? EFAULT : 0; + goto out; } umtxq_lock(&uq->uq_key); umtxq_unbusy(&uq->uq_key); @@ -3140,6 +3260,7 @@ do_sem_wait(struct thread *td, struct _usem *sem, stru error = EINTR; } umtxq_unlock(&uq->uq_key); +out: umtx_key_release(&uq->uq_key); return (error); } @@ -3201,6 +3322,7 @@ do_sem2_wait(struct thread *td, struct _usem2 *sem, st if (timeout != NULL) abs_timeout_init2(&timo, timeout); +again: umtxq_lock(&uq->uq_key); umtxq_busy(&uq->uq_key); umtxq_insert(uq); @@ -3226,16 +3348,19 @@ do_sem2_wait(struct thread *td, struct _usem2 *sem, st if (count == USEM_HAS_WAITERS) break; rv = casueword32(&sem->_count, 0, &count, USEM_HAS_WAITERS); - if (rv == -1) { - umtxq_lock(&uq->uq_key); - umtxq_unbusy(&uq->uq_key); - umtxq_remove(uq); - umtxq_unlock(&uq->uq_key); - umtx_key_release(&uq->uq_key); - return (EFAULT); - } - if (count == 0) + if (rv == 0) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Jul 12 18:50:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09E6B15D2FBC; Fri, 12 Jul 2019 18:50:47 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A191C86C64; Fri, 12 Jul 2019 18:50:46 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 717201AA1C; Fri, 12 Jul 2019 18:50:46 +0000 (UTC) (envelope-from seanc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CIokN7045347; Fri, 12 Jul 2019 18:50:46 GMT (envelope-from seanc@FreeBSD.org) Received: (from seanc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CIokN8045346; Fri, 12 Jul 2019 18:50:46 GMT (envelope-from seanc@FreeBSD.org) Message-Id: <201907121850.x6CIokN8045346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: seanc set sender to seanc@FreeBSD.org using -f From: Sean Chittenden Date: Fri, 12 Jul 2019 18:50:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349952 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: seanc X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 349952 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A191C86C64 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 18:50:47 -0000 Author: seanc (ports committer) Date: Fri Jul 12 18:50:46 2019 New Revision: 349952 URL: https://svnweb.freebsd.org/changeset/base/349952 Log: usr.sbin/bhyve: close backend file descriptor during tap init error Coverity CID: 1402953 Reviewed by: scottl, markj, aleksandr.fedorov -at- itglobal.com Approved by: vmaffione, jhb Differential Revision: https://reviews.freebsd.org/D20913 Modified: head/usr.sbin/bhyve/net_backends.c Modified: head/usr.sbin/bhyve/net_backends.c ============================================================================== --- head/usr.sbin/bhyve/net_backends.c Fri Jul 12 18:43:24 2019 (r349951) +++ head/usr.sbin/bhyve/net_backends.c Fri Jul 12 18:50:46 2019 (r349952) @@ -175,7 +175,6 @@ tap_init(struct net_backend *be, const char *devname, { struct tap_priv *priv = (struct tap_priv *)be->opaque; char tbuf[80]; - int fd; int opt = 1; #ifndef WITHOUT_CAPSICUM cap_rights_t rights; @@ -189,8 +188,8 @@ tap_init(struct net_backend *be, const char *devname, strcpy(tbuf, "/dev/"); strlcat(tbuf, devname, sizeof(tbuf)); - fd = open(tbuf, O_RDWR); - if (fd == -1) { + be->fd = open(tbuf, O_RDWR); + if (be->fd == -1) { WPRINTF(("open of tap device %s failed\n", tbuf)); goto error; } @@ -199,24 +198,22 @@ tap_init(struct net_backend *be, const char *devname, * Set non-blocking and register for read * notifications with the event loop */ - if (ioctl(fd, FIONBIO, &opt) < 0) { + if (ioctl(be->fd, FIONBIO, &opt) < 0) { WPRINTF(("tap device O_NONBLOCK failed\n")); goto error; } #ifndef WITHOUT_CAPSICUM cap_rights_init(&rights, CAP_EVENT, CAP_READ, CAP_WRITE); - if (caph_rights_limit(fd, &rights) == -1) + if (caph_rights_limit(be->fd, &rights) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif - priv->mevp = mevent_add(fd, EVF_READ, cb, param); + priv->mevp = mevent_add(be->fd, EVF_READ, cb, param); if (priv->mevp == NULL) { WPRINTF(("Could not register event\n")); goto error; } - - be->fd = fd; return (0); From owner-svn-src-all@freebsd.org Fri Jul 12 19:14:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 457FA15D3CEF; Fri, 12 Jul 2019 19:14:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DE71E87FA2; Fri, 12 Jul 2019 19:14:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2DF91AF38; Fri, 12 Jul 2019 19:14:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CJEq3N059858; Fri, 12 Jul 2019 19:14:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CJEqa6059857; Fri, 12 Jul 2019 19:14:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201907121914.x6CJEqa6059857@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 12 Jul 2019 19:14:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349953 - head/sys/amd64/vmm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/vmm X-SVN-Commit-Revision: 349953 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DE71E87FA2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.929,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 19:14:53 -0000 Author: kib Date: Fri Jul 12 19:14:52 2019 New Revision: 349953 URL: https://svnweb.freebsd.org/changeset/base/349953 Log: Fix syntax. Nod from: jhb Sponsored by: The FreeBSD Foundation Modified: head/sys/amd64/vmm/vmm_dev.c Modified: head/sys/amd64/vmm/vmm_dev.c ============================================================================== --- head/sys/amd64/vmm/vmm_dev.c Fri Jul 12 18:50:46 2019 (r349952) +++ head/sys/amd64/vmm/vmm_dev.c Fri Jul 12 19:14:52 2019 (r349953) @@ -291,7 +291,7 @@ alloc_memseg(struct vmmdev_softc *sc, struct vm_memseg */ if (VM_MEMSEG_NAME(mseg)) { sysmem = false; - name = malloc(sizeof(mseg->name) M_VMMDEV, M_WAITOK); + name = malloc(sizeof(mseg->name), M_VMMDEV, M_WAITOK); error = copystr(mseg->name, name, sizeof(mseg->name), NULL); if (error) goto done; From owner-svn-src-all@freebsd.org Fri Jul 12 19:28:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A242015D47D3; Fri, 12 Jul 2019 19:28:42 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A76388BF3; Fri, 12 Jul 2019 19:28:42 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 0F99F2BD; Fri, 12 Jul 2019 15:28:39 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 12 Jul 2019 15:28:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm3; bh=H Z2Q0OpgJqfOd6/pAPhVWpvDuwb7Ex2DiBOgSk/iJH4=; b=Fyu2tk5d0zHE+Cdhk zqxnakltfD6XojjF3REUQe70KB5shIziCD+avVSlUrMa4vDc+Zc5mflutvruWj3A nOg+xtxecytOdMuFUNwfiBui/rzHyr/+8Pbke8xC5ESkrpAPkmspY78MJhbB3Vf/ CM2wr1Vytc3v4fMxe8hiURuRNr2fzgn4MWXilZL6c+ZP5oktLQF78HI3JjLFuqdC VIVzVmgFnfVr1EHDM/+tIj2u3qvDJGAsOuDD1d5U2ShdBacJahE1C6CIi21aE0Xr L7V5dVk6CYvtPO1n/LY8FAWRu3AiA/yhiihtqvDkBh8KwmRNN7gw7SpMsRGBi1gS E8h/Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=HZ2Q0OpgJqfOd6/pAPhVWpvDuwb7Ex2DiBOgSk/iJ H4=; b=OmmYv+hMYAahwIkpKQJnGsFFIm56L8vqzTPby4J3ch6vgy/HxHoZ9AOjC ILkHCtZ8arijb34Ag0vealsZqQvUY5+aCIMDFWz6wnpfOBapdqgd5brl8Kf9/7S6 VJrvI1iRoeQ19feWuGTM0+2pyHMdJNuBGBWkxkkE/fLl28rs7UHJ2lZITGupYuvX N4uR3vqp2fuAJsPwRz7sqIt9ceo7Z/qG1vtF6eFSJmlZuWs2WrVJ1TELvWThHLge S9bJB8NUCk2wwxZdUL++l+XdgRc+WcwcnYBF1SN7eoU+Lm57ZZF+zD/5eBFio0DW Cv1mOlJRldvAzkLhlYNQyoI3URGlw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrhedtgddufeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpegtggfuhfgjfffgkfhfvffosehtqh hmtdhhtddvnecuhfhrohhmpefutghothhtucfnohhnghcuoehstghothhtlhesshgrmhhs tghordhorhhgqeenucffohhmrghinhepfhhrvggvsghsugdrohhrghenucfkphepkedrge eirdekledrvddufeenucfrrghrrghmpehmrghilhhfrhhomhepshgtohhtthhlsehsrghm shgtohdrohhrghenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [192.168.0.146] (unknown [8.46.89.213]) by mail.messagingengine.com (Postfix) with ESMTPA id C4D63380075; Fri, 12 Jul 2019 15:28:38 -0400 (EDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r349953 - head/sys/amd64/vmm From: Scott Long In-Reply-To: <201907121914.x6CJEqa6059857@repo.freebsd.org> Date: Fri, 12 Jul 2019 13:28:38 -0600 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201907121914.x6CJEqa6059857@repo.freebsd.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 3A76388BF3 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.95)[-0.948,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 19:28:42 -0000 Thanks, sorry about that, I had compiled and tested this a dozen times = before committing, not sure how this crept in. Scott > On Jul 12, 2019, at 1:14 PM, Konstantin Belousov = wrote: >=20 > Author: kib > Date: Fri Jul 12 19:14:52 2019 > New Revision: 349953 > URL: https://svnweb.freebsd.org/changeset/base/349953 >=20 > Log: > Fix syntax. >=20 > Nod from: jhb > Sponsored by: The FreeBSD Foundation >=20 > Modified: > head/sys/amd64/vmm/vmm_dev.c >=20 > Modified: head/sys/amd64/vmm/vmm_dev.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/amd64/vmm/vmm_dev.c Fri Jul 12 18:50:46 2019 = (r349952) > +++ head/sys/amd64/vmm/vmm_dev.c Fri Jul 12 19:14:52 2019 = (r349953) > @@ -291,7 +291,7 @@ alloc_memseg(struct vmmdev_softc *sc, struct = vm_memseg > */ > if (VM_MEMSEG_NAME(mseg)) { > sysmem =3D false; > - name =3D malloc(sizeof(mseg->name) M_VMMDEV, M_WAITOK); > + name =3D malloc(sizeof(mseg->name), M_VMMDEV, M_WAITOK); > error =3D copystr(mseg->name, name, sizeof(mseg->name), = NULL); > if (error) > goto done; >=20 From owner-svn-src-all@freebsd.org Fri Jul 12 19:44:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5DE6A15D4FEB; Fri, 12 Jul 2019 19:44:00 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 00F3489706; Fri, 12 Jul 2019 19:44:00 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C10271B47D; Fri, 12 Jul 2019 19:43:59 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CJhxnI075559; Fri, 12 Jul 2019 19:43:59 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CJhxuG075557; Fri, 12 Jul 2019 19:43:59 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201907121943.x6CJhxuG075557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 12 Jul 2019 19:43:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349954 - in stable: 11/contrib/llvm/include/llvm/Analysis 11/contrib/llvm/lib/Analysis 11/contrib/llvm/lib/Transforms/Scalar 12/contrib/llvm/include/llvm/Analysis 12/contrib/llvm/lib/A... X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/llvm/include/llvm/Analysis 11/contrib/llvm/lib/Analysis 11/contrib/llvm/lib/Transforms/Scalar 12/contrib/llvm/include/llvm/Analysis 12/contrib/llvm/lib/Analysis 12/contrib/llvm/l... X-SVN-Commit-Revision: 349954 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 00F3489706 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 19:44:00 -0000 Author: dim Date: Fri Jul 12 19:43:59 2019 New Revision: 349954 URL: https://svnweb.freebsd.org/changeset/base/349954 Log: MFC r349583: Pull in r360968 from upstream llvm trunk (by Philip Reames): Clarify comments on helpers used by LFTR [NFC] I'm slowly wrapping my head around this code, and am making comment improvements where I can. Pull in r360972 from upstream llvm trunk (by Philip Reames): [LFTR] Factor out a helper function for readability purpose [NFC] Pull in r360976 from upstream llvm trunk (by Philip Reames): [IndVars] Don't reimplement Loop::isLoopInvariant [NFC] Using dominance vs a set membership check is indistinguishable from a compile time perspective, and the two queries return equivelent results. Simplify code by using the existing function. Pull in r360978 from upstream llvm trunk (by Philip Reames): [LFTR] Strengthen assertions in genLoopLimit [NFCI] Pull in r362292 from upstream llvm trunk (by Nikita Popov): [IndVarSimplify] Fixup nowrap flags during LFTR (PR31181) Fix for https://bugs.llvm.org/show_bug.cgi?id=31181 and partial fix for LFTR poison handling issues in general. When LFTR moves a condition from pre-inc to post-inc, it may now depend on value that is poison due to nowrap flags. To avoid this, we clear any nowrap flag that SCEV cannot prove for the post-inc addrec. Additionally, LFTR may switch to a different IV that is dynamically dead and as such may be arbitrarily poison. This patch will correct nowrap flags in some but not all cases where this happens. This is related to the adoption of IR nowrap flags for the pre-inc addrec. (See some of the switch_to_different_iv tests, where flags are not dropped or insufficiently dropped.) Finally, there are likely similar issues with the handling of GEP inbounds, but we don't have a test case for this yet. Differential Revision: https://reviews.llvm.org/D60935 Pull in r362971 from upstream llvm trunk (by Philip Reames): Prepare for multi-exit LFTR [NFC] This change does the plumbing to wire an ExitingBB parameter through the LFTR implementation, and reorganizes the code to work in terms of a set of individual loop exits. Most of it is fairly obvious, but there's one key complexity which makes it worthy of consideration. The actual multi-exit LFTR patch is in D62625 for context. Specifically, it turns out the existing code uses the backedge taken count from before a IV is widened. Oddly, we can end up with a different (more expensive, but semantically equivelent) BE count for the loop when requerying after widening. For the nestedIV example from elim-extend, we end up with the following BE counts: BEFORE: (-2 + (-1 * %innercount) + %limit) AFTER: (-1 + (sext i32 (-1 + %limit) to i64) + (-1 * (sext i32 %innercount to i64))) This is the only test in tree which seems sensitive to this difference. The actual result of using the wider BETC on this example is that we actually produce slightly better code. :) In review, we decided to accept that test change. This patch is structured to preserve the old behavior, but a separate change will immediate follow with the behavior change. (I wanted it separate for problem attribution purposes.) Differential Revision: https://reviews.llvm.org/D62880 Pull in r362975 from upstream llvm trunk (by Philip Reames): [LFTR] Use recomputed BE count This was discussed as part of D62880. The basic thought is that computing BE taken count after widening should produce (on average) an equally good backedge taken count as the one before widening. Since there's only one test in the suite which is impacted by this change, and it's essentially equivelent codegen, that seems to be a reasonable assertion. This change was separated from r362971 so that if this turns out to be problematic, the triggering piece is obvious and easily revertable. For the nestedIV example from elim-extend.ll, we end up with the following BE counts: BEFORE: (-2 + (-1 * %innercount) + %limit) AFTER: (-1 + (sext i32 (-1 + %limit) to i64) + (-1 * (sext i32 %innercount to i64))) Note that before is an i32 type, and the after is an i64. Truncating the i64 produces the i32. Pull in r362980 from upstream llvm trunk (by Philip Reames): Factor out a helper function for readability and reuse in a future patch [NFC] Pull in r363613 from upstream llvm trunk (by Philip Reames): Fix a bug w/inbounds invalidation in LFTR (recommit) Recommit r363289 with a bug fix for crash identified in pr42279. Issue was that a loop exit test does not have to be an icmp, leading to a null dereference crash when new logic was exercised for that case. Test case previously committed in r363601. Original commit comment follows: This contains fixes for two cases where we might invalidate inbounds and leave it stale in the IR (a miscompile). Case 1 is when switching to an IV with no dynamically live uses, and case 2 is when doing pre-to-post conversion on the same pointer type IV. The basic scheme used is to prove that using the given IV (pre or post increment forms) would have to already trigger UB on the path to the test we're modifying. As such, our potential UB triggering use does not change the semantics of the original program. As was pointed out in the review thread by Nikita, this is defending against a separate issue from the hasConcreteDef case. This is about poison, that's about undef. Unfortunately, the two are different, see Nikita's comment for a fuller explanation, he explains it well. (Note: I'm going to address Nikita's last style comment in a separate commit just to minimize chance of subtle bugs being introduced due to typos.) Differential Revision: https://reviews.llvm.org/D62939 Pull in r363875 from upstream llvm trunk (by Philip Reames): [LFTR] Rename variable to minimize confusion [NFC] (Recommit of r363293 which was reverted when a dependent patch was.) As pointed out by Nikita in D62625, BackedgeTakenCount is generally used to refer to the backedge taken count of the loop. A conditional backedge taken count - one which only applies if a particular exit is taken - is called a ExitCount in SCEV code, so be consistent here. Pull in r363877 from upstream llvm trunk (by Philip Reames): [LFTR] Stylistic cleanup as suggested in last review comment of D62939 [NFC] (Resumbit of r363292 which was reverted along w/an earlier patch) Pull in r364346 from upstream llvm trunk (by Philip Reames): [LFTR] Adjust debug output to include extensions (if any) Pull in r364693 from upstream llvm trunk (by Philip Reames): [IndVars] Remove a bit of manual constant folding [NFC] SCEV is more than capable of folding (add x, trunc(0)) to x. Pull in r364709 from upstream llvm trunk (by Nikita Popov): [LFTR] Fix post-inc pointer IV with truncated exit count (PR41998) Fixes https://bugs.llvm.org/show_bug.cgi?id=41998. Usually when we have a truncated exit count we'll truncate the IV when comparing against the limit, in which case exit count overflow in post-inc form doesn't matter. However, for pointer IVs we don't do that, so we have to be careful about incrementing the IV in the wide type. I'm fixing this by removing the IVCount variable (which was ExitCount or ExitCount+1) and replacing it with a UsePostInc flag, and then moving the actual limit adjustment to the individual cases (which are: pointer IV where we add to the wide type, integer IV where we add to the narrow type, and constant integer IV where we add to the wide type). Differential Revision: https://reviews.llvm.org/D63686 Together, these should fix a hang when building the textproc/htmldoc port, due to an incorrect loop optimization. PR: 237515 Modified: stable/12/contrib/llvm/include/llvm/Analysis/ValueTracking.h stable/12/contrib/llvm/lib/Analysis/ValueTracking.cpp stable/12/contrib/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/llvm/include/llvm/Analysis/ValueTracking.h stable/11/contrib/llvm/lib/Analysis/ValueTracking.cpp stable/11/contrib/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp Directory Properties: stable/11/ (props changed) Modified: stable/12/contrib/llvm/include/llvm/Analysis/ValueTracking.h ============================================================================== --- stable/12/contrib/llvm/include/llvm/Analysis/ValueTracking.h Fri Jul 12 19:14:52 2019 (r349953) +++ stable/12/contrib/llvm/include/llvm/Analysis/ValueTracking.h Fri Jul 12 19:43:59 2019 (r349954) @@ -17,6 +17,7 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/Optional.h" +#include "llvm/ADT/SmallSet.h" #include "llvm/IR/CallSite.h" #include "llvm/IR/Constants.h" #include "llvm/IR/Instruction.h" @@ -505,6 +506,12 @@ class Value; /// undefined behavior if I is executed and that operand has a full-poison /// value (all bits poison). const Value *getGuaranteedNonFullPoisonOp(const Instruction *I); + + /// Return true if the given instruction must trigger undefined behavior. + /// when I is executed with any operands which appear in KnownPoison holding + /// a full-poison value at the point of execution. + bool mustTriggerUB(const Instruction *I, + const SmallSet& KnownPoison); /// Return true if this function can prove that if PoisonI is executed /// and yields a full-poison value (all bits poison), then that will Modified: stable/12/contrib/llvm/lib/Analysis/ValueTracking.cpp ============================================================================== --- stable/12/contrib/llvm/lib/Analysis/ValueTracking.cpp Fri Jul 12 19:14:52 2019 (r349953) +++ stable/12/contrib/llvm/lib/Analysis/ValueTracking.cpp Fri Jul 12 19:43:59 2019 (r349954) @@ -4413,6 +4413,13 @@ const Value *llvm::getGuaranteedNonFullPoisonOp(const } } +bool llvm::mustTriggerUB(const Instruction *I, + const SmallSet& KnownPoison) { + auto *NotPoison = getGuaranteedNonFullPoisonOp(I); + return (NotPoison && KnownPoison.count(NotPoison)); +} + + bool llvm::programUndefinedIfFullPoison(const Instruction *PoisonI) { // We currently only look for uses of poison values within the same basic // block, as that makes it easier to guarantee that the uses will be @@ -4436,8 +4443,7 @@ bool llvm::programUndefinedIfFullPoison(const Instruct while (Iter++ < MaxDepth) { for (auto &I : make_range(Begin, End)) { if (&I != PoisonI) { - const Value *NotPoison = getGuaranteedNonFullPoisonOp(&I); - if (NotPoison != nullptr && YieldsPoison.count(NotPoison)) + if (mustTriggerUB(&I, YieldsPoison)) return true; if (!isGuaranteedToTransferExecutionToSuccessor(&I)) return false; Modified: stable/12/contrib/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp ============================================================================== --- stable/12/contrib/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp Fri Jul 12 19:14:52 2019 (r349953) +++ stable/12/contrib/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp Fri Jul 12 19:43:59 2019 (r349954) @@ -32,6 +32,7 @@ #include "llvm/ADT/None.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/SmallSet.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" @@ -43,6 +44,7 @@ #include "llvm/Analysis/ScalarEvolutionExpressions.h" #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TargetTransformInfo.h" +#include "llvm/Analysis/ValueTracking.h" #include "llvm/Transforms/Utils/Local.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/Constant.h" @@ -147,7 +149,8 @@ class IndVarSimplify { bool rewriteFirstIterationLoopExitValues(Loop *L); bool hasHardUserWithinLoop(const Loop *L, const Instruction *I) const; - bool linearFunctionTestReplace(Loop *L, const SCEV *BackedgeTakenCount, + bool linearFunctionTestReplace(Loop *L, BasicBlock *ExitingBB, + const SCEV *ExitCount, PHINode *IndVar, SCEVExpander &Rewriter); bool sinkUnusedInvariants(Loop *L); @@ -1022,24 +1025,13 @@ class WidenIV { (protected) } // end anonymous namespace -/// Perform a quick domtree based check for loop invariance assuming that V is -/// used within the loop. LoopInfo::isLoopInvariant() seems gratuitous for this -/// purpose. -static bool isLoopInvariant(Value *V, const Loop *L, const DominatorTree *DT) { - Instruction *Inst = dyn_cast(V); - if (!Inst) - return true; - - return DT->properlyDominates(Inst->getParent(), L->getHeader()); -} - Value *WidenIV::createExtendInst(Value *NarrowOper, Type *WideType, bool IsSigned, Instruction *Use) { // Set the debug location and conservative insertion point. IRBuilder<> Builder(Use); // Hoist the insertion point into loop preheaders as far as possible. for (const Loop *L = LI->getLoopFor(Use->getParent()); - L && L->getLoopPreheader() && isLoopInvariant(NarrowOper, L, DT); + L && L->getLoopPreheader() && L->isLoopInvariant(NarrowOper); L = L->getParentLoop()) Builder.SetInsertPoint(L->getLoopPreheader()->getTerminator()); @@ -1977,41 +1969,10 @@ bool IndVarSimplify::simplifyAndExtend(Loop *L, // linearFunctionTestReplace and its kin. Rewrite the loop exit condition. //===----------------------------------------------------------------------===// -/// Return true if this loop's backedge taken count expression can be safely and -/// cheaply expanded into an instruction sequence that can be used by -/// linearFunctionTestReplace. -/// -/// TODO: This fails for pointer-type loop counters with greater than one byte -/// strides, consequently preventing LFTR from running. For the purpose of LFTR -/// we could skip this check in the case that the LFTR loop counter (chosen by -/// FindLoopCounter) is also pointer type. Instead, we could directly convert -/// the loop test to an inequality test by checking the target data's alignment -/// of element types (given that the initial pointer value originates from or is -/// used by ABI constrained operation, as opposed to inttoptr/ptrtoint). -/// However, we don't yet have a strong motivation for converting loop tests -/// into inequality tests. -static bool canExpandBackedgeTakenCount(Loop *L, ScalarEvolution *SE, - SCEVExpander &Rewriter) { - const SCEV *BackedgeTakenCount = SE->getBackedgeTakenCount(L); - if (isa(BackedgeTakenCount) || - BackedgeTakenCount->isZero()) - return false; - - if (!L->getExitingBlock()) - return false; - - // Can't rewrite non-branch yet. - if (!isa(L->getExitingBlock()->getTerminator())) - return false; - - if (Rewriter.isHighCostExpansion(BackedgeTakenCount, L)) - return false; - - return true; -} - -/// Return the loop header phi IFF IncV adds a loop invariant value to the phi. -static PHINode *getLoopPhiForCounter(Value *IncV, Loop *L, DominatorTree *DT) { +/// Given an Value which is hoped to be part of an add recurance in the given +/// loop, return the associated Phi node if so. Otherwise, return null. Note +/// that this is less general than SCEVs AddRec checking. +static PHINode *getLoopPhiForCounter(Value *IncV, Loop *L) { Instruction *IncI = dyn_cast(IncV); if (!IncI) return nullptr; @@ -2031,7 +1992,7 @@ static PHINode *getLoopPhiForCounter(Value *IncV, Loop PHINode *Phi = dyn_cast(IncI->getOperand(0)); if (Phi && Phi->getParent() == L->getHeader()) { - if (isLoopInvariant(IncI->getOperand(1), L, DT)) + if (L->isLoopInvariant(IncI->getOperand(1))) return Phi; return nullptr; } @@ -2041,22 +2002,23 @@ static PHINode *getLoopPhiForCounter(Value *IncV, Loop // Allow add/sub to be commuted. Phi = dyn_cast(IncI->getOperand(1)); if (Phi && Phi->getParent() == L->getHeader()) { - if (isLoopInvariant(IncI->getOperand(0), L, DT)) + if (L->isLoopInvariant(IncI->getOperand(0))) return Phi; } return nullptr; } -/// Return the compare guarding the loop latch, or NULL for unrecognized tests. -static ICmpInst *getLoopTest(Loop *L) { - assert(L->getExitingBlock() && "expected loop exit"); +/// Given a loop with one backedge and one exit, return the ICmpInst +/// controlling the sole loop exit. There is no guarantee that the exiting +/// block is also the latch. +static ICmpInst *getLoopTest(Loop *L, BasicBlock *ExitingBB) { BasicBlock *LatchBlock = L->getLoopLatch(); // Don't bother with LFTR if the loop is not properly simplified. if (!LatchBlock) return nullptr; - BranchInst *BI = dyn_cast(L->getExitingBlock()->getTerminator()); + BranchInst *BI = dyn_cast(ExitingBB->getTerminator()); assert(BI && "expected exit branch"); return dyn_cast(BI->getCondition()); @@ -2064,9 +2026,9 @@ static ICmpInst *getLoopTest(Loop *L) { /// linearFunctionTestReplace policy. Return true unless we can show that the /// current exit test is already sufficiently canonical. -static bool needsLFTR(Loop *L, DominatorTree *DT) { +static bool needsLFTR(Loop *L, BasicBlock *ExitingBB) { // Do LFTR to simplify the exit condition to an ICMP. - ICmpInst *Cond = getLoopTest(L); + ICmpInst *Cond = getLoopTest(L, ExitingBB); if (!Cond) return true; @@ -2078,15 +2040,15 @@ static bool needsLFTR(Loop *L, DominatorTree *DT) { // Look for a loop invariant RHS Value *LHS = Cond->getOperand(0); Value *RHS = Cond->getOperand(1); - if (!isLoopInvariant(RHS, L, DT)) { - if (!isLoopInvariant(LHS, L, DT)) + if (!L->isLoopInvariant(RHS)) { + if (!L->isLoopInvariant(LHS)) return true; std::swap(LHS, RHS); } // Look for a simple IV counter LHS PHINode *Phi = dyn_cast(LHS); if (!Phi) - Phi = getLoopPhiForCounter(LHS, L, DT); + Phi = getLoopPhiForCounter(LHS, L); if (!Phi) return true; @@ -2098,9 +2060,51 @@ static bool needsLFTR(Loop *L, DominatorTree *DT) { // Do LFTR if the exit condition's IV is *not* a simple counter. Value *IncV = Phi->getIncomingValue(Idx); - return Phi != getLoopPhiForCounter(IncV, L, DT); + return Phi != getLoopPhiForCounter(IncV, L); } +/// Return true if undefined behavior would provable be executed on the path to +/// OnPathTo if Root produced a posion result. Note that this doesn't say +/// anything about whether OnPathTo is actually executed or whether Root is +/// actually poison. This can be used to assess whether a new use of Root can +/// be added at a location which is control equivalent with OnPathTo (such as +/// immediately before it) without introducing UB which didn't previously +/// exist. Note that a false result conveys no information. +static bool mustExecuteUBIfPoisonOnPathTo(Instruction *Root, + Instruction *OnPathTo, + DominatorTree *DT) { + // Basic approach is to assume Root is poison, propagate poison forward + // through all users we can easily track, and then check whether any of those + // users are provable UB and must execute before out exiting block might + // exit. + + // The set of all recursive users we've visited (which are assumed to all be + // poison because of said visit) + SmallSet KnownPoison; + SmallVector Worklist; + Worklist.push_back(Root); + while (!Worklist.empty()) { + const Instruction *I = Worklist.pop_back_val(); + + // If we know this must trigger UB on a path leading our target. + if (mustTriggerUB(I, KnownPoison) && DT->dominates(I, OnPathTo)) + return true; + + // If we can't analyze propagation through this instruction, just skip it + // and transitive users. Safe as false is a conservative result. + if (!propagatesFullPoison(I) && I != Root) + continue; + + if (KnownPoison.insert(I).second) + for (const User *User : I->users()) + Worklist.push_back(cast(User)); + } + + // Might be non-UB, or might have a path we couldn't prove must execute on + // way to exiting bb. + return false; +} + /// Recursive helper for hasConcreteDef(). Unfortunately, this currently boils /// down to checking that all operands are constant and listing instructions /// that may hide undef. @@ -2157,25 +2161,43 @@ static bool AlmostDeadIV(PHINode *Phi, BasicBlock *Lat return true; } -/// Find an affine IV in canonical form. +/// Return true if the given phi is a "counter" in L. A counter is an +/// add recurance (of integer or pointer type) with an arbitrary start, and a +/// step of 1. Note that L must have exactly one latch. +static bool isLoopCounter(PHINode* Phi, Loop *L, + ScalarEvolution *SE) { + assert(Phi->getParent() == L->getHeader()); + assert(L->getLoopLatch()); + + if (!SE->isSCEVable(Phi->getType())) + return false; + + const SCEVAddRecExpr *AR = dyn_cast(SE->getSCEV(Phi)); + if (!AR || AR->getLoop() != L || !AR->isAffine()) + return false; + + const SCEV *Step = dyn_cast(AR->getStepRecurrence(*SE)); + if (!Step || !Step->isOne()) + return false; + + int LatchIdx = Phi->getBasicBlockIndex(L->getLoopLatch()); + Value *IncV = Phi->getIncomingValue(LatchIdx); + return (getLoopPhiForCounter(IncV, L) == Phi); +} + +/// Search the loop header for a loop counter (anadd rec w/step of one) +/// suitable for use by LFTR. If multiple counters are available, select the +/// "best" one based profitable heuristics. /// /// BECount may be an i8* pointer type. The pointer difference is already /// valid count without scaling the address stride, so it remains a pointer /// expression as far as SCEV is concerned. -/// -/// Currently only valid for LFTR. See the comments on hasConcreteDef below. -/// -/// FIXME: Accept -1 stride and set IVLimit = IVInit - BECount -/// -/// FIXME: Accept non-unit stride as long as SCEV can reduce BECount * Stride. -/// This is difficult in general for SCEV because of potential overflow. But we -/// could at least handle constant BECounts. -static PHINode *FindLoopCounter(Loop *L, const SCEV *BECount, +static PHINode *FindLoopCounter(Loop *L, BasicBlock *ExitingBB, + const SCEV *BECount, ScalarEvolution *SE, DominatorTree *DT) { uint64_t BCWidth = SE->getTypeSizeInBits(BECount->getType()); - Value *Cond = - cast(L->getExitingBlock()->getTerminator())->getCondition(); + Value *Cond = cast(ExitingBB->getTerminator())->getCondition(); // Loop over all of the PHI nodes, looking for a simple counter. PHINode *BestPhi = nullptr; @@ -2186,17 +2208,15 @@ static PHINode *FindLoopCounter(Loop *L, const SCEV *B for (BasicBlock::iterator I = L->getHeader()->begin(); isa(I); ++I) { PHINode *Phi = cast(I); - if (!SE->isSCEVable(Phi->getType())) + if (!isLoopCounter(Phi, L, SE)) continue; // Avoid comparing an integer IV against a pointer Limit. if (BECount->getType()->isPointerTy() && !Phi->getType()->isPointerTy()) continue; - const SCEVAddRecExpr *AR = dyn_cast(SE->getSCEV(Phi)); - if (!AR || AR->getLoop() != L || !AR->isAffine()) - continue; - + const auto *AR = dyn_cast(SE->getSCEV(Phi)); + // AR may be a pointer type, while BECount is an integer type. // AR may be wider than BECount. With eq/ne tests overflow is immaterial. // AR may not be a narrower type, or we may never exit. @@ -2204,28 +2224,33 @@ static PHINode *FindLoopCounter(Loop *L, const SCEV *B if (PhiWidth < BCWidth || !DL.isLegalInteger(PhiWidth)) continue; - const SCEV *Step = dyn_cast(AR->getStepRecurrence(*SE)); - if (!Step || !Step->isOne()) - continue; - - int LatchIdx = Phi->getBasicBlockIndex(LatchBlock); - Value *IncV = Phi->getIncomingValue(LatchIdx); - if (getLoopPhiForCounter(IncV, L, DT) != Phi) - continue; - // Avoid reusing a potentially undef value to compute other values that may // have originally had a concrete definition. if (!hasConcreteDef(Phi)) { // We explicitly allow unknown phis as long as they are already used by // the loop test. In this case we assume that performing LFTR could not // increase the number of undef users. - if (ICmpInst *Cond = getLoopTest(L)) { - if (Phi != getLoopPhiForCounter(Cond->getOperand(0), L, DT) && - Phi != getLoopPhiForCounter(Cond->getOperand(1), L, DT)) { - continue; - } - } + // TODO: Generalize this to allow *any* loop exit which is known to + // execute on each iteration + if (L->getExitingBlock()) + if (ICmpInst *Cond = getLoopTest(L, ExitingBB)) + if (Phi != getLoopPhiForCounter(Cond->getOperand(0), L) && + Phi != getLoopPhiForCounter(Cond->getOperand(1), L)) + continue; } + + // Avoid introducing undefined behavior due to poison which didn't exist in + // the original program. (Annoyingly, the rules for poison and undef + // propagation are distinct, so this does NOT cover the undef case above.) + // We have to ensure that we don't introduce UB by introducing a use on an + // iteration where said IV produces poison. Our strategy here differs for + // pointers and integer IVs. For integers, we strip and reinfer as needed, + // see code in linearFunctionTestReplace. For pointers, we restrict + // transforms as there is no good way to reinfer inbounds once lost. + if (!Phi->getType()->isIntegerTy() && + !mustExecuteUBIfPoisonOnPathTo(Phi, ExitingBB->getTerminator(), DT)) + continue; + const SCEV *Init = AR->getStart(); if (BestPhi && !AlmostDeadIV(BestPhi, LatchBlock, Cond)) { @@ -2251,38 +2276,43 @@ static PHINode *FindLoopCounter(Loop *L, const SCEV *B return BestPhi; } -/// Help linearFunctionTestReplace by generating a value that holds the RHS of -/// the new loop test. -static Value *genLoopLimit(PHINode *IndVar, const SCEV *IVCount, Loop *L, +/// Insert an IR expression which computes the value held by the IV IndVar +/// (which must be an loop counter w/unit stride) after the backedge of loop L +/// is taken ExitCount times. +static Value *genLoopLimit(PHINode *IndVar, BasicBlock *ExitingBB, + const SCEV *ExitCount, bool UsePostInc, Loop *L, SCEVExpander &Rewriter, ScalarEvolution *SE) { - const SCEVAddRecExpr *AR = dyn_cast(SE->getSCEV(IndVar)); - assert(AR && AR->getLoop() == L && AR->isAffine() && "bad loop counter"); + assert(isLoopCounter(IndVar, L, SE)); + const SCEVAddRecExpr *AR = cast(SE->getSCEV(IndVar)); const SCEV *IVInit = AR->getStart(); - // IVInit may be a pointer while IVCount is an integer when FindLoopCounter - // finds a valid pointer IV. Sign extend BECount in order to materialize a + // IVInit may be a pointer while ExitCount is an integer when FindLoopCounter + // finds a valid pointer IV. Sign extend ExitCount in order to materialize a // GEP. Avoid running SCEVExpander on a new pointer value, instead reusing // the existing GEPs whenever possible. - if (IndVar->getType()->isPointerTy() && !IVCount->getType()->isPointerTy()) { + if (IndVar->getType()->isPointerTy() && + !ExitCount->getType()->isPointerTy()) { // IVOffset will be the new GEP offset that is interpreted by GEP as a - // signed value. IVCount on the other hand represents the loop trip count, + // signed value. ExitCount on the other hand represents the loop trip count, // which is an unsigned value. FindLoopCounter only allows induction // variables that have a positive unit stride of one. This means we don't // have to handle the case of negative offsets (yet) and just need to zero - // extend IVCount. + // extend ExitCount. Type *OfsTy = SE->getEffectiveSCEVType(IVInit->getType()); - const SCEV *IVOffset = SE->getTruncateOrZeroExtend(IVCount, OfsTy); + const SCEV *IVOffset = SE->getTruncateOrZeroExtend(ExitCount, OfsTy); + if (UsePostInc) + IVOffset = SE->getAddExpr(IVOffset, SE->getOne(OfsTy)); // Expand the code for the iteration count. assert(SE->isLoopInvariant(IVOffset, L) && "Computed iteration count is not loop invariant!"); - BranchInst *BI = cast(L->getExitingBlock()->getTerminator()); + BranchInst *BI = cast(ExitingBB->getTerminator()); Value *GEPOffset = Rewriter.expandCodeFor(IVOffset, OfsTy, BI); Value *GEPBase = IndVar->getIncomingValueForBlock(L->getLoopPreheader()); assert(AR->getStart() == SE->getSCEV(GEPBase) && "bad loop counter"); // We could handle pointer IVs other than i8*, but we need to compensate for - // gep index scaling. See canExpandBackedgeTakenCount comments. + // gep index scaling. assert(SE->getSizeOfExpr(IntegerType::getInt64Ty(IndVar->getContext()), cast(GEPBase->getType()) ->getElementType())->isOne() && @@ -2291,7 +2321,7 @@ static Value *genLoopLimit(PHINode *IndVar, const SCEV IRBuilder<> Builder(L->getLoopPreheader()->getTerminator()); return Builder.CreateGEP(nullptr, GEPBase, GEPOffset, "lftr.limit"); } else { - // In any other case, convert both IVInit and IVCount to integers before + // In any other case, convert both IVInit and ExitCount to integers before // comparing. This may result in SCEV expansion of pointers, but in practice // SCEV will fold the pointer arithmetic away as such: // BECount = (IVEnd - IVInit - 1) => IVLimit = IVInit (postinc). @@ -2299,35 +2329,34 @@ static Value *genLoopLimit(PHINode *IndVar, const SCEV // Valid Cases: (1) both integers is most common; (2) both may be pointers // for simple memset-style loops. // - // IVInit integer and IVCount pointer would only occur if a canonical IV + // IVInit integer and ExitCount pointer would only occur if a canonical IV // were generated on top of case #2, which is not expected. - const SCEV *IVLimit = nullptr; - // For unit stride, IVCount = Start + BECount with 2's complement overflow. - // For non-zero Start, compute IVCount here. - if (AR->getStart()->isZero()) - IVLimit = IVCount; - else { - assert(AR->getStepRecurrence(*SE)->isOne() && "only handles unit stride"); - const SCEV *IVInit = AR->getStart(); + assert(AR->getStepRecurrence(*SE)->isOne() && "only handles unit stride"); + // For unit stride, IVCount = Start + ExitCount with 2's complement + // overflow. + const SCEV *IVInit = AR->getStart(); - // For integer IVs, truncate the IV before computing IVInit + BECount. - if (SE->getTypeSizeInBits(IVInit->getType()) - > SE->getTypeSizeInBits(IVCount->getType())) - IVInit = SE->getTruncateExpr(IVInit, IVCount->getType()); + // For integer IVs, truncate the IV before computing IVInit + BECount. + if (SE->getTypeSizeInBits(IVInit->getType()) + > SE->getTypeSizeInBits(ExitCount->getType())) + IVInit = SE->getTruncateExpr(IVInit, ExitCount->getType()); - IVLimit = SE->getAddExpr(IVInit, IVCount); - } + const SCEV *IVLimit = SE->getAddExpr(IVInit, ExitCount); + + if (UsePostInc) + IVLimit = SE->getAddExpr(IVLimit, SE->getOne(IVLimit->getType())); + // Expand the code for the iteration count. - BranchInst *BI = cast(L->getExitingBlock()->getTerminator()); + BranchInst *BI = cast(ExitingBB->getTerminator()); IRBuilder<> Builder(BI); assert(SE->isLoopInvariant(IVLimit, L) && "Computed iteration count is not loop invariant!"); // Ensure that we generate the same type as IndVar, or a smaller integer // type. In the presence of null pointer values, we have an integer type // SCEV expression (IVInit) for a pointer type IV value (IndVar). - Type *LimitTy = IVCount->getType()->isPointerTy() ? - IndVar->getType() : IVCount->getType(); + Type *LimitTy = ExitCount->getType()->isPointerTy() ? + IndVar->getType() : ExitCount->getType(); return Rewriter.expandCodeFor(IVLimit, LimitTy, BI); } } @@ -2338,51 +2367,76 @@ static Value *genLoopLimit(PHINode *IndVar, const SCEV /// determine a loop-invariant trip count of the loop, which is actually a much /// broader range than just linear tests. bool IndVarSimplify:: -linearFunctionTestReplace(Loop *L, const SCEV *BackedgeTakenCount, +linearFunctionTestReplace(Loop *L, BasicBlock *ExitingBB, + const SCEV *ExitCount, PHINode *IndVar, SCEVExpander &Rewriter) { - assert(canExpandBackedgeTakenCount(L, SE, Rewriter) && "precondition"); + assert(L->getLoopLatch() && "Loop no longer in simplified form?"); + assert(isLoopCounter(IndVar, L, SE)); + Instruction * const IncVar = + cast(IndVar->getIncomingValueForBlock(L->getLoopLatch())); - // Initialize CmpIndVar and IVCount to their preincremented values. + // Initialize CmpIndVar to the preincremented IV. Value *CmpIndVar = IndVar; - const SCEV *IVCount = BackedgeTakenCount; + bool UsePostInc = false; - assert(L->getLoopLatch() && "Loop no longer in simplified form?"); - // If the exiting block is the same as the backedge block, we prefer to // compare against the post-incremented value, otherwise we must compare // against the preincremented value. - if (L->getExitingBlock() == L->getLoopLatch()) { - // Add one to the "backedge-taken" count to get the trip count. - // This addition may overflow, which is valid as long as the comparison is - // truncated to BackedgeTakenCount->getType(). - IVCount = SE->getAddExpr(BackedgeTakenCount, - SE->getOne(BackedgeTakenCount->getType())); - // The BackedgeTaken expression contains the number of times that the - // backedge branches to the loop header. This is one less than the - // number of times the loop executes, so use the incremented indvar. - CmpIndVar = IndVar->getIncomingValueForBlock(L->getExitingBlock()); + if (ExitingBB == L->getLoopLatch()) { + bool SafeToPostInc = IndVar->getType()->isIntegerTy(); + if (!SafeToPostInc) { + // For pointer IVs, we chose to not strip inbounds which requires us not + // to add a potentially UB introducing use. We need to either a) show + // the loop test we're modifying is already in post-inc form, or b) show + // that adding a use must not introduce UB. + if (ICmpInst *LoopTest = getLoopTest(L, ExitingBB)) + SafeToPostInc = LoopTest->getOperand(0) == IncVar || + LoopTest->getOperand(1) == IncVar; + if (!SafeToPostInc) + SafeToPostInc = + mustExecuteUBIfPoisonOnPathTo(IncVar, ExitingBB->getTerminator(), DT); + } + + if (SafeToPostInc) { + UsePostInc = true; + CmpIndVar = IncVar; + } } - Value *ExitCnt = genLoopLimit(IndVar, IVCount, L, Rewriter, SE); + // It may be necessary to drop nowrap flags on the incrementing instruction + // if either LFTR moves from a pre-inc check to a post-inc check (in which + // case the increment might have previously been poison on the last iteration + // only) or if LFTR switches to a different IV that was previously dynamically + // dead (and as such may be arbitrarily poison). We remove any nowrap flags + // that SCEV didn't infer for the post-inc addrec (even if we use a pre-inc + // check), because the pre-inc addrec flags may be adopted from the original + // instruction, while SCEV has to explicitly prove the post-inc nowrap flags. + // TODO: This handling is inaccurate for one case: If we switch to a + // dynamically dead IV that wraps on the first loop iteration only, which is + // not covered by the post-inc addrec. (If the new IV was not dynamically + // dead, it could not be poison on the first iteration in the first place.) + if (auto *BO = dyn_cast(IncVar)) { + const SCEVAddRecExpr *AR = cast(SE->getSCEV(IncVar)); + if (BO->hasNoUnsignedWrap()) + BO->setHasNoUnsignedWrap(AR->hasNoUnsignedWrap()); + if (BO->hasNoSignedWrap()) + BO->setHasNoSignedWrap(AR->hasNoSignedWrap()); + } + + Value *ExitCnt = genLoopLimit( + IndVar, ExitingBB, ExitCount, UsePostInc, L, Rewriter, SE); assert(ExitCnt->getType()->isPointerTy() == IndVar->getType()->isPointerTy() && "genLoopLimit missed a cast"); // Insert a new icmp_ne or icmp_eq instruction before the branch. - BranchInst *BI = cast(L->getExitingBlock()->getTerminator()); + BranchInst *BI = cast(ExitingBB->getTerminator()); ICmpInst::Predicate P; if (L->contains(BI->getSuccessor(0))) P = ICmpInst::ICMP_NE; else P = ICmpInst::ICMP_EQ; - LLVM_DEBUG(dbgs() << "INDVARS: Rewriting loop exit condition to:\n" - << " LHS:" << *CmpIndVar << '\n' - << " op:\t" << (P == ICmpInst::ICMP_NE ? "!=" : "==") - << "\n" - << " RHS:\t" << *ExitCnt << "\n" - << " IVCount:\t" << *IVCount << "\n"); - IRBuilder<> Builder(BI); // The new loop exit condition should reuse the debug location of the @@ -2391,25 +2445,20 @@ linearFunctionTestReplace(Loop *L, const SCEV *Backedg Builder.SetCurrentDebugLocation(Cond->getDebugLoc()); // LFTR can ignore IV overflow and truncate to the width of - // BECount. This avoids materializing the add(zext(add)) expression. + // ExitCount. This avoids materializing the add(zext(add)) expression. unsigned CmpIndVarSize = SE->getTypeSizeInBits(CmpIndVar->getType()); unsigned ExitCntSize = SE->getTypeSizeInBits(ExitCnt->getType()); if (CmpIndVarSize > ExitCntSize) { const SCEVAddRecExpr *AR = cast(SE->getSCEV(IndVar)); const SCEV *ARStart = AR->getStart(); const SCEV *ARStep = AR->getStepRecurrence(*SE); - // For constant IVCount, avoid truncation. - if (isa(ARStart) && isa(IVCount)) { + // For constant ExitCount, avoid truncation. + if (isa(ARStart) && isa(ExitCount)) { const APInt &Start = cast(ARStart)->getAPInt(); - APInt Count = cast(IVCount)->getAPInt(); - // Note that the post-inc value of BackedgeTakenCount may have overflowed - // above such that IVCount is now zero. - if (IVCount != BackedgeTakenCount && Count == 0) { - Count = APInt::getMaxValue(Count.getBitWidth()).zext(CmpIndVarSize); + APInt Count = cast(ExitCount)->getAPInt(); + Count = Count.zext(CmpIndVarSize); + if (UsePostInc) ++Count; - } - else - Count = Count.zext(CmpIndVarSize); APInt NewLimit; if (cast(ARStep)->getValue()->isNegative()) NewLimit = Start - Count; @@ -2451,6 +2500,14 @@ linearFunctionTestReplace(Loop *L, const SCEV *Backedg "lftr.wideiv"); } } + LLVM_DEBUG(dbgs() << "INDVARS: Rewriting loop exit condition to:\n" + << " LHS:" << *CmpIndVar << '\n' + << " op:\t" << (P == ICmpInst::ICMP_NE ? "!=" : "==") + << "\n" + << " RHS:\t" << *ExitCnt << "\n" + << "ExitCount:\t" << *ExitCount << "\n" + << " was: " << *BI->getCondition() << "\n"); + Value *Cond = Builder.CreateICmp(P, CmpIndVar, ExitCnt, "exitcond"); Value *OrigCond = BI->getCondition(); // It's tempting to use replaceAllUsesWith here to fully replace the old @@ -2615,22 +2672,52 @@ bool IndVarSimplify::run(Loop *L) { NumElimIV += Rewriter.replaceCongruentIVs(L, DT, DeadInsts); // If we have a trip count expression, rewrite the loop's exit condition - // using it. We can currently only handle loops with a single exit. - if (!DisableLFTR && canExpandBackedgeTakenCount(L, SE, Rewriter) && - needsLFTR(L, DT)) { - PHINode *IndVar = FindLoopCounter(L, BackedgeTakenCount, SE, DT); - if (IndVar) { + // using it. + if (!DisableLFTR) { + // For the moment, we only do LFTR for single exit loops. The code is + // structured as it is in the expectation of generalization to multi-exit + // loops in the near future. See D62625 for context. + SmallVector ExitingBlocks; + if (auto *ExitingBB = L->getExitingBlock()) + ExitingBlocks.push_back(ExitingBB); + for (BasicBlock *ExitingBB : ExitingBlocks) { + // Can't rewrite non-branch yet. + if (!isa(ExitingBB->getTerminator())) + continue; + + if (!needsLFTR(L, ExitingBB)) + continue; + + const SCEV *ExitCount = SE->getExitCount(L, ExitingBB); + if (isa(ExitCount)) + continue; + + // Better to fold to true (TODO: do so!) + if (ExitCount->isZero()) + continue; + + PHINode *IndVar = FindLoopCounter(L, ExitingBB, ExitCount, SE, DT); + if (!IndVar) + continue; + + // Avoid high cost expansions. Note: This heuristic is questionable in + // that our definition of "high cost" is not exactly principled. + if (Rewriter.isHighCostExpansion(ExitCount, L)) + continue; + // Check preconditions for proper SCEVExpander operation. SCEV does not - // express SCEVExpander's dependencies, such as LoopSimplify. Instead any - // pass that uses the SCEVExpander must do it. This does not work well for - // loop passes because SCEVExpander makes assumptions about all loops, - // while LoopPassManager only forces the current loop to be simplified. + // express SCEVExpander's dependencies, such as LoopSimplify. Instead + // any pass that uses the SCEVExpander must do it. This does not work + // well for loop passes because SCEVExpander makes assumptions about + // all loops, while LoopPassManager only forces the current loop to be + // simplified. // // FIXME: SCEV expansion has no way to bail out, so the caller must // explicitly check any assumptions made by SCEV. Brittle. - const SCEVAddRecExpr *AR = dyn_cast(BackedgeTakenCount); + const SCEVAddRecExpr *AR = dyn_cast(ExitCount); if (!AR || AR->getLoop()->getLoopPreheader()) - Changed |= linearFunctionTestReplace(L, BackedgeTakenCount, IndVar, + Changed |= linearFunctionTestReplace(L, ExitingBB, + ExitCount, IndVar, Rewriter); } } From owner-svn-src-all@freebsd.org Fri Jul 12 19:44:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06F1715D4FEF; Fri, 12 Jul 2019 19:44:01 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A304F89708; Fri, 12 Jul 2019 19:44:00 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 74DC61B47E; Fri, 12 Jul 2019 19:44:00 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CJi0kb075592; Fri, 12 Jul 2019 19:44:00 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CJhx6J075564; Fri, 12 Jul 2019 19:43:59 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201907121943.x6CJhx6J075564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 12 Jul 2019 19:43:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349954 - in stable: 11/contrib/llvm/include/llvm/Analysis 11/contrib/llvm/lib/Analysis 11/contrib/llvm/lib/Transforms/Scalar 12/contrib/llvm/include/llvm/Analysis 12/contrib/llvm/lib/A... X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/llvm/include/llvm/Analysis 11/contrib/llvm/lib/Analysis 11/contrib/llvm/lib/Transforms/Scalar 12/contrib/llvm/include/llvm/Analysis 12/contrib/llvm/lib/Analysis 12/contrib/llvm/l... X-SVN-Commit-Revision: 349954 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A304F89708 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 19:44:01 -0000 Author: dim Date: Fri Jul 12 19:43:59 2019 New Revision: 349954 URL: https://svnweb.freebsd.org/changeset/base/349954 Log: MFC r349583: Pull in r360968 from upstream llvm trunk (by Philip Reames): Clarify comments on helpers used by LFTR [NFC] I'm slowly wrapping my head around this code, and am making comment improvements where I can. Pull in r360972 from upstream llvm trunk (by Philip Reames): [LFTR] Factor out a helper function for readability purpose [NFC] Pull in r360976 from upstream llvm trunk (by Philip Reames): [IndVars] Don't reimplement Loop::isLoopInvariant [NFC] Using dominance vs a set membership check is indistinguishable from a compile time perspective, and the two queries return equivelent results. Simplify code by using the existing function. Pull in r360978 from upstream llvm trunk (by Philip Reames): [LFTR] Strengthen assertions in genLoopLimit [NFCI] Pull in r362292 from upstream llvm trunk (by Nikita Popov): [IndVarSimplify] Fixup nowrap flags during LFTR (PR31181) Fix for https://bugs.llvm.org/show_bug.cgi?id=31181 and partial fix for LFTR poison handling issues in general. When LFTR moves a condition from pre-inc to post-inc, it may now depend on value that is poison due to nowrap flags. To avoid this, we clear any nowrap flag that SCEV cannot prove for the post-inc addrec. Additionally, LFTR may switch to a different IV that is dynamically dead and as such may be arbitrarily poison. This patch will correct nowrap flags in some but not all cases where this happens. This is related to the adoption of IR nowrap flags for the pre-inc addrec. (See some of the switch_to_different_iv tests, where flags are not dropped or insufficiently dropped.) Finally, there are likely similar issues with the handling of GEP inbounds, but we don't have a test case for this yet. Differential Revision: https://reviews.llvm.org/D60935 Pull in r362971 from upstream llvm trunk (by Philip Reames): Prepare for multi-exit LFTR [NFC] This change does the plumbing to wire an ExitingBB parameter through the LFTR implementation, and reorganizes the code to work in terms of a set of individual loop exits. Most of it is fairly obvious, but there's one key complexity which makes it worthy of consideration. The actual multi-exit LFTR patch is in D62625 for context. Specifically, it turns out the existing code uses the backedge taken count from before a IV is widened. Oddly, we can end up with a different (more expensive, but semantically equivelent) BE count for the loop when requerying after widening. For the nestedIV example from elim-extend, we end up with the following BE counts: BEFORE: (-2 + (-1 * %innercount) + %limit) AFTER: (-1 + (sext i32 (-1 + %limit) to i64) + (-1 * (sext i32 %innercount to i64))) This is the only test in tree which seems sensitive to this difference. The actual result of using the wider BETC on this example is that we actually produce slightly better code. :) In review, we decided to accept that test change. This patch is structured to preserve the old behavior, but a separate change will immediate follow with the behavior change. (I wanted it separate for problem attribution purposes.) Differential Revision: https://reviews.llvm.org/D62880 Pull in r362975 from upstream llvm trunk (by Philip Reames): [LFTR] Use recomputed BE count This was discussed as part of D62880. The basic thought is that computing BE taken count after widening should produce (on average) an equally good backedge taken count as the one before widening. Since there's only one test in the suite which is impacted by this change, and it's essentially equivelent codegen, that seems to be a reasonable assertion. This change was separated from r362971 so that if this turns out to be problematic, the triggering piece is obvious and easily revertable. For the nestedIV example from elim-extend.ll, we end up with the following BE counts: BEFORE: (-2 + (-1 * %innercount) + %limit) AFTER: (-1 + (sext i32 (-1 + %limit) to i64) + (-1 * (sext i32 %innercount to i64))) Note that before is an i32 type, and the after is an i64. Truncating the i64 produces the i32. Pull in r362980 from upstream llvm trunk (by Philip Reames): Factor out a helper function for readability and reuse in a future patch [NFC] Pull in r363613 from upstream llvm trunk (by Philip Reames): Fix a bug w/inbounds invalidation in LFTR (recommit) Recommit r363289 with a bug fix for crash identified in pr42279. Issue was that a loop exit test does not have to be an icmp, leading to a null dereference crash when new logic was exercised for that case. Test case previously committed in r363601. Original commit comment follows: This contains fixes for two cases where we might invalidate inbounds and leave it stale in the IR (a miscompile). Case 1 is when switching to an IV with no dynamically live uses, and case 2 is when doing pre-to-post conversion on the same pointer type IV. The basic scheme used is to prove that using the given IV (pre or post increment forms) would have to already trigger UB on the path to the test we're modifying. As such, our potential UB triggering use does not change the semantics of the original program. As was pointed out in the review thread by Nikita, this is defending against a separate issue from the hasConcreteDef case. This is about poison, that's about undef. Unfortunately, the two are different, see Nikita's comment for a fuller explanation, he explains it well. (Note: I'm going to address Nikita's last style comment in a separate commit just to minimize chance of subtle bugs being introduced due to typos.) Differential Revision: https://reviews.llvm.org/D62939 Pull in r363875 from upstream llvm trunk (by Philip Reames): [LFTR] Rename variable to minimize confusion [NFC] (Recommit of r363293 which was reverted when a dependent patch was.) As pointed out by Nikita in D62625, BackedgeTakenCount is generally used to refer to the backedge taken count of the loop. A conditional backedge taken count - one which only applies if a particular exit is taken - is called a ExitCount in SCEV code, so be consistent here. Pull in r363877 from upstream llvm trunk (by Philip Reames): [LFTR] Stylistic cleanup as suggested in last review comment of D62939 [NFC] (Resumbit of r363292 which was reverted along w/an earlier patch) Pull in r364346 from upstream llvm trunk (by Philip Reames): [LFTR] Adjust debug output to include extensions (if any) Pull in r364693 from upstream llvm trunk (by Philip Reames): [IndVars] Remove a bit of manual constant folding [NFC] SCEV is more than capable of folding (add x, trunc(0)) to x. Pull in r364709 from upstream llvm trunk (by Nikita Popov): [LFTR] Fix post-inc pointer IV with truncated exit count (PR41998) Fixes https://bugs.llvm.org/show_bug.cgi?id=41998. Usually when we have a truncated exit count we'll truncate the IV when comparing against the limit, in which case exit count overflow in post-inc form doesn't matter. However, for pointer IVs we don't do that, so we have to be careful about incrementing the IV in the wide type. I'm fixing this by removing the IVCount variable (which was ExitCount or ExitCount+1) and replacing it with a UsePostInc flag, and then moving the actual limit adjustment to the individual cases (which are: pointer IV where we add to the wide type, integer IV where we add to the narrow type, and constant integer IV where we add to the wide type). Differential Revision: https://reviews.llvm.org/D63686 Together, these should fix a hang when building the textproc/htmldoc port, due to an incorrect loop optimization. PR: 237515 Modified: stable/11/contrib/llvm/include/llvm/Analysis/ValueTracking.h stable/11/contrib/llvm/lib/Analysis/ValueTracking.cpp stable/11/contrib/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/llvm/include/llvm/Analysis/ValueTracking.h stable/12/contrib/llvm/lib/Analysis/ValueTracking.cpp stable/12/contrib/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/llvm/include/llvm/Analysis/ValueTracking.h ============================================================================== --- stable/11/contrib/llvm/include/llvm/Analysis/ValueTracking.h Fri Jul 12 19:14:52 2019 (r349953) +++ stable/11/contrib/llvm/include/llvm/Analysis/ValueTracking.h Fri Jul 12 19:43:59 2019 (r349954) @@ -17,6 +17,7 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/Optional.h" +#include "llvm/ADT/SmallSet.h" #include "llvm/IR/CallSite.h" #include "llvm/IR/Constants.h" #include "llvm/IR/Instruction.h" @@ -505,6 +506,12 @@ class Value; /// undefined behavior if I is executed and that operand has a full-poison /// value (all bits poison). const Value *getGuaranteedNonFullPoisonOp(const Instruction *I); + + /// Return true if the given instruction must trigger undefined behavior. + /// when I is executed with any operands which appear in KnownPoison holding + /// a full-poison value at the point of execution. + bool mustTriggerUB(const Instruction *I, + const SmallSet& KnownPoison); /// Return true if this function can prove that if PoisonI is executed /// and yields a full-poison value (all bits poison), then that will Modified: stable/11/contrib/llvm/lib/Analysis/ValueTracking.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Analysis/ValueTracking.cpp Fri Jul 12 19:14:52 2019 (r349953) +++ stable/11/contrib/llvm/lib/Analysis/ValueTracking.cpp Fri Jul 12 19:43:59 2019 (r349954) @@ -4413,6 +4413,13 @@ const Value *llvm::getGuaranteedNonFullPoisonOp(const } } +bool llvm::mustTriggerUB(const Instruction *I, + const SmallSet& KnownPoison) { + auto *NotPoison = getGuaranteedNonFullPoisonOp(I); + return (NotPoison && KnownPoison.count(NotPoison)); +} + + bool llvm::programUndefinedIfFullPoison(const Instruction *PoisonI) { // We currently only look for uses of poison values within the same basic // block, as that makes it easier to guarantee that the uses will be @@ -4436,8 +4443,7 @@ bool llvm::programUndefinedIfFullPoison(const Instruct while (Iter++ < MaxDepth) { for (auto &I : make_range(Begin, End)) { if (&I != PoisonI) { - const Value *NotPoison = getGuaranteedNonFullPoisonOp(&I); - if (NotPoison != nullptr && YieldsPoison.count(NotPoison)) + if (mustTriggerUB(&I, YieldsPoison)) return true; if (!isGuaranteedToTransferExecutionToSuccessor(&I)) return false; Modified: stable/11/contrib/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp Fri Jul 12 19:14:52 2019 (r349953) +++ stable/11/contrib/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp Fri Jul 12 19:43:59 2019 (r349954) @@ -32,6 +32,7 @@ #include "llvm/ADT/None.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/SmallSet.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" @@ -43,6 +44,7 @@ #include "llvm/Analysis/ScalarEvolutionExpressions.h" #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TargetTransformInfo.h" +#include "llvm/Analysis/ValueTracking.h" #include "llvm/Transforms/Utils/Local.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/Constant.h" @@ -147,7 +149,8 @@ class IndVarSimplify { bool rewriteFirstIterationLoopExitValues(Loop *L); bool hasHardUserWithinLoop(const Loop *L, const Instruction *I) const; - bool linearFunctionTestReplace(Loop *L, const SCEV *BackedgeTakenCount, + bool linearFunctionTestReplace(Loop *L, BasicBlock *ExitingBB, + const SCEV *ExitCount, PHINode *IndVar, SCEVExpander &Rewriter); bool sinkUnusedInvariants(Loop *L); @@ -1022,24 +1025,13 @@ class WidenIV { (protected) } // end anonymous namespace -/// Perform a quick domtree based check for loop invariance assuming that V is -/// used within the loop. LoopInfo::isLoopInvariant() seems gratuitous for this -/// purpose. -static bool isLoopInvariant(Value *V, const Loop *L, const DominatorTree *DT) { - Instruction *Inst = dyn_cast(V); - if (!Inst) - return true; - - return DT->properlyDominates(Inst->getParent(), L->getHeader()); -} - Value *WidenIV::createExtendInst(Value *NarrowOper, Type *WideType, bool IsSigned, Instruction *Use) { // Set the debug location and conservative insertion point. IRBuilder<> Builder(Use); // Hoist the insertion point into loop preheaders as far as possible. for (const Loop *L = LI->getLoopFor(Use->getParent()); - L && L->getLoopPreheader() && isLoopInvariant(NarrowOper, L, DT); + L && L->getLoopPreheader() && L->isLoopInvariant(NarrowOper); L = L->getParentLoop()) Builder.SetInsertPoint(L->getLoopPreheader()->getTerminator()); @@ -1977,41 +1969,10 @@ bool IndVarSimplify::simplifyAndExtend(Loop *L, // linearFunctionTestReplace and its kin. Rewrite the loop exit condition. //===----------------------------------------------------------------------===// -/// Return true if this loop's backedge taken count expression can be safely and -/// cheaply expanded into an instruction sequence that can be used by -/// linearFunctionTestReplace. -/// -/// TODO: This fails for pointer-type loop counters with greater than one byte -/// strides, consequently preventing LFTR from running. For the purpose of LFTR -/// we could skip this check in the case that the LFTR loop counter (chosen by -/// FindLoopCounter) is also pointer type. Instead, we could directly convert -/// the loop test to an inequality test by checking the target data's alignment -/// of element types (given that the initial pointer value originates from or is -/// used by ABI constrained operation, as opposed to inttoptr/ptrtoint). -/// However, we don't yet have a strong motivation for converting loop tests -/// into inequality tests. -static bool canExpandBackedgeTakenCount(Loop *L, ScalarEvolution *SE, - SCEVExpander &Rewriter) { - const SCEV *BackedgeTakenCount = SE->getBackedgeTakenCount(L); - if (isa(BackedgeTakenCount) || - BackedgeTakenCount->isZero()) - return false; - - if (!L->getExitingBlock()) - return false; - - // Can't rewrite non-branch yet. - if (!isa(L->getExitingBlock()->getTerminator())) - return false; - - if (Rewriter.isHighCostExpansion(BackedgeTakenCount, L)) - return false; - - return true; -} - -/// Return the loop header phi IFF IncV adds a loop invariant value to the phi. -static PHINode *getLoopPhiForCounter(Value *IncV, Loop *L, DominatorTree *DT) { +/// Given an Value which is hoped to be part of an add recurance in the given +/// loop, return the associated Phi node if so. Otherwise, return null. Note +/// that this is less general than SCEVs AddRec checking. +static PHINode *getLoopPhiForCounter(Value *IncV, Loop *L) { Instruction *IncI = dyn_cast(IncV); if (!IncI) return nullptr; @@ -2031,7 +1992,7 @@ static PHINode *getLoopPhiForCounter(Value *IncV, Loop PHINode *Phi = dyn_cast(IncI->getOperand(0)); if (Phi && Phi->getParent() == L->getHeader()) { - if (isLoopInvariant(IncI->getOperand(1), L, DT)) + if (L->isLoopInvariant(IncI->getOperand(1))) return Phi; return nullptr; } @@ -2041,22 +2002,23 @@ static PHINode *getLoopPhiForCounter(Value *IncV, Loop // Allow add/sub to be commuted. Phi = dyn_cast(IncI->getOperand(1)); if (Phi && Phi->getParent() == L->getHeader()) { - if (isLoopInvariant(IncI->getOperand(0), L, DT)) + if (L->isLoopInvariant(IncI->getOperand(0))) return Phi; } return nullptr; } -/// Return the compare guarding the loop latch, or NULL for unrecognized tests. -static ICmpInst *getLoopTest(Loop *L) { - assert(L->getExitingBlock() && "expected loop exit"); +/// Given a loop with one backedge and one exit, return the ICmpInst +/// controlling the sole loop exit. There is no guarantee that the exiting +/// block is also the latch. +static ICmpInst *getLoopTest(Loop *L, BasicBlock *ExitingBB) { BasicBlock *LatchBlock = L->getLoopLatch(); // Don't bother with LFTR if the loop is not properly simplified. if (!LatchBlock) return nullptr; - BranchInst *BI = dyn_cast(L->getExitingBlock()->getTerminator()); + BranchInst *BI = dyn_cast(ExitingBB->getTerminator()); assert(BI && "expected exit branch"); return dyn_cast(BI->getCondition()); @@ -2064,9 +2026,9 @@ static ICmpInst *getLoopTest(Loop *L) { /// linearFunctionTestReplace policy. Return true unless we can show that the /// current exit test is already sufficiently canonical. -static bool needsLFTR(Loop *L, DominatorTree *DT) { +static bool needsLFTR(Loop *L, BasicBlock *ExitingBB) { // Do LFTR to simplify the exit condition to an ICMP. - ICmpInst *Cond = getLoopTest(L); + ICmpInst *Cond = getLoopTest(L, ExitingBB); if (!Cond) return true; @@ -2078,15 +2040,15 @@ static bool needsLFTR(Loop *L, DominatorTree *DT) { // Look for a loop invariant RHS Value *LHS = Cond->getOperand(0); Value *RHS = Cond->getOperand(1); - if (!isLoopInvariant(RHS, L, DT)) { - if (!isLoopInvariant(LHS, L, DT)) + if (!L->isLoopInvariant(RHS)) { + if (!L->isLoopInvariant(LHS)) return true; std::swap(LHS, RHS); } // Look for a simple IV counter LHS PHINode *Phi = dyn_cast(LHS); if (!Phi) - Phi = getLoopPhiForCounter(LHS, L, DT); + Phi = getLoopPhiForCounter(LHS, L); if (!Phi) return true; @@ -2098,9 +2060,51 @@ static bool needsLFTR(Loop *L, DominatorTree *DT) { // Do LFTR if the exit condition's IV is *not* a simple counter. Value *IncV = Phi->getIncomingValue(Idx); - return Phi != getLoopPhiForCounter(IncV, L, DT); + return Phi != getLoopPhiForCounter(IncV, L); } +/// Return true if undefined behavior would provable be executed on the path to +/// OnPathTo if Root produced a posion result. Note that this doesn't say +/// anything about whether OnPathTo is actually executed or whether Root is +/// actually poison. This can be used to assess whether a new use of Root can +/// be added at a location which is control equivalent with OnPathTo (such as +/// immediately before it) without introducing UB which didn't previously +/// exist. Note that a false result conveys no information. +static bool mustExecuteUBIfPoisonOnPathTo(Instruction *Root, + Instruction *OnPathTo, + DominatorTree *DT) { + // Basic approach is to assume Root is poison, propagate poison forward + // through all users we can easily track, and then check whether any of those + // users are provable UB and must execute before out exiting block might + // exit. + + // The set of all recursive users we've visited (which are assumed to all be + // poison because of said visit) + SmallSet KnownPoison; + SmallVector Worklist; + Worklist.push_back(Root); + while (!Worklist.empty()) { + const Instruction *I = Worklist.pop_back_val(); + + // If we know this must trigger UB on a path leading our target. + if (mustTriggerUB(I, KnownPoison) && DT->dominates(I, OnPathTo)) + return true; + + // If we can't analyze propagation through this instruction, just skip it + // and transitive users. Safe as false is a conservative result. + if (!propagatesFullPoison(I) && I != Root) + continue; + + if (KnownPoison.insert(I).second) + for (const User *User : I->users()) + Worklist.push_back(cast(User)); + } + + // Might be non-UB, or might have a path we couldn't prove must execute on + // way to exiting bb. + return false; +} + /// Recursive helper for hasConcreteDef(). Unfortunately, this currently boils /// down to checking that all operands are constant and listing instructions /// that may hide undef. @@ -2157,25 +2161,43 @@ static bool AlmostDeadIV(PHINode *Phi, BasicBlock *Lat return true; } -/// Find an affine IV in canonical form. +/// Return true if the given phi is a "counter" in L. A counter is an +/// add recurance (of integer or pointer type) with an arbitrary start, and a +/// step of 1. Note that L must have exactly one latch. +static bool isLoopCounter(PHINode* Phi, Loop *L, + ScalarEvolution *SE) { + assert(Phi->getParent() == L->getHeader()); + assert(L->getLoopLatch()); + + if (!SE->isSCEVable(Phi->getType())) + return false; + + const SCEVAddRecExpr *AR = dyn_cast(SE->getSCEV(Phi)); + if (!AR || AR->getLoop() != L || !AR->isAffine()) + return false; + + const SCEV *Step = dyn_cast(AR->getStepRecurrence(*SE)); + if (!Step || !Step->isOne()) + return false; + + int LatchIdx = Phi->getBasicBlockIndex(L->getLoopLatch()); + Value *IncV = Phi->getIncomingValue(LatchIdx); + return (getLoopPhiForCounter(IncV, L) == Phi); +} + +/// Search the loop header for a loop counter (anadd rec w/step of one) +/// suitable for use by LFTR. If multiple counters are available, select the +/// "best" one based profitable heuristics. /// /// BECount may be an i8* pointer type. The pointer difference is already /// valid count without scaling the address stride, so it remains a pointer /// expression as far as SCEV is concerned. -/// -/// Currently only valid for LFTR. See the comments on hasConcreteDef below. -/// -/// FIXME: Accept -1 stride and set IVLimit = IVInit - BECount -/// -/// FIXME: Accept non-unit stride as long as SCEV can reduce BECount * Stride. -/// This is difficult in general for SCEV because of potential overflow. But we -/// could at least handle constant BECounts. -static PHINode *FindLoopCounter(Loop *L, const SCEV *BECount, +static PHINode *FindLoopCounter(Loop *L, BasicBlock *ExitingBB, + const SCEV *BECount, ScalarEvolution *SE, DominatorTree *DT) { uint64_t BCWidth = SE->getTypeSizeInBits(BECount->getType()); - Value *Cond = - cast(L->getExitingBlock()->getTerminator())->getCondition(); + Value *Cond = cast(ExitingBB->getTerminator())->getCondition(); // Loop over all of the PHI nodes, looking for a simple counter. PHINode *BestPhi = nullptr; @@ -2186,17 +2208,15 @@ static PHINode *FindLoopCounter(Loop *L, const SCEV *B for (BasicBlock::iterator I = L->getHeader()->begin(); isa(I); ++I) { PHINode *Phi = cast(I); - if (!SE->isSCEVable(Phi->getType())) + if (!isLoopCounter(Phi, L, SE)) continue; // Avoid comparing an integer IV against a pointer Limit. if (BECount->getType()->isPointerTy() && !Phi->getType()->isPointerTy()) continue; - const SCEVAddRecExpr *AR = dyn_cast(SE->getSCEV(Phi)); - if (!AR || AR->getLoop() != L || !AR->isAffine()) - continue; - + const auto *AR = dyn_cast(SE->getSCEV(Phi)); + // AR may be a pointer type, while BECount is an integer type. // AR may be wider than BECount. With eq/ne tests overflow is immaterial. // AR may not be a narrower type, or we may never exit. @@ -2204,28 +2224,33 @@ static PHINode *FindLoopCounter(Loop *L, const SCEV *B if (PhiWidth < BCWidth || !DL.isLegalInteger(PhiWidth)) continue; - const SCEV *Step = dyn_cast(AR->getStepRecurrence(*SE)); - if (!Step || !Step->isOne()) - continue; - - int LatchIdx = Phi->getBasicBlockIndex(LatchBlock); - Value *IncV = Phi->getIncomingValue(LatchIdx); - if (getLoopPhiForCounter(IncV, L, DT) != Phi) - continue; - // Avoid reusing a potentially undef value to compute other values that may // have originally had a concrete definition. if (!hasConcreteDef(Phi)) { // We explicitly allow unknown phis as long as they are already used by // the loop test. In this case we assume that performing LFTR could not // increase the number of undef users. - if (ICmpInst *Cond = getLoopTest(L)) { - if (Phi != getLoopPhiForCounter(Cond->getOperand(0), L, DT) && - Phi != getLoopPhiForCounter(Cond->getOperand(1), L, DT)) { - continue; - } - } + // TODO: Generalize this to allow *any* loop exit which is known to + // execute on each iteration + if (L->getExitingBlock()) + if (ICmpInst *Cond = getLoopTest(L, ExitingBB)) + if (Phi != getLoopPhiForCounter(Cond->getOperand(0), L) && + Phi != getLoopPhiForCounter(Cond->getOperand(1), L)) + continue; } + + // Avoid introducing undefined behavior due to poison which didn't exist in + // the original program. (Annoyingly, the rules for poison and undef + // propagation are distinct, so this does NOT cover the undef case above.) + // We have to ensure that we don't introduce UB by introducing a use on an + // iteration where said IV produces poison. Our strategy here differs for + // pointers and integer IVs. For integers, we strip and reinfer as needed, + // see code in linearFunctionTestReplace. For pointers, we restrict + // transforms as there is no good way to reinfer inbounds once lost. + if (!Phi->getType()->isIntegerTy() && + !mustExecuteUBIfPoisonOnPathTo(Phi, ExitingBB->getTerminator(), DT)) + continue; + const SCEV *Init = AR->getStart(); if (BestPhi && !AlmostDeadIV(BestPhi, LatchBlock, Cond)) { @@ -2251,38 +2276,43 @@ static PHINode *FindLoopCounter(Loop *L, const SCEV *B return BestPhi; } -/// Help linearFunctionTestReplace by generating a value that holds the RHS of -/// the new loop test. -static Value *genLoopLimit(PHINode *IndVar, const SCEV *IVCount, Loop *L, +/// Insert an IR expression which computes the value held by the IV IndVar +/// (which must be an loop counter w/unit stride) after the backedge of loop L +/// is taken ExitCount times. +static Value *genLoopLimit(PHINode *IndVar, BasicBlock *ExitingBB, + const SCEV *ExitCount, bool UsePostInc, Loop *L, SCEVExpander &Rewriter, ScalarEvolution *SE) { - const SCEVAddRecExpr *AR = dyn_cast(SE->getSCEV(IndVar)); - assert(AR && AR->getLoop() == L && AR->isAffine() && "bad loop counter"); + assert(isLoopCounter(IndVar, L, SE)); + const SCEVAddRecExpr *AR = cast(SE->getSCEV(IndVar)); const SCEV *IVInit = AR->getStart(); - // IVInit may be a pointer while IVCount is an integer when FindLoopCounter - // finds a valid pointer IV. Sign extend BECount in order to materialize a + // IVInit may be a pointer while ExitCount is an integer when FindLoopCounter + // finds a valid pointer IV. Sign extend ExitCount in order to materialize a // GEP. Avoid running SCEVExpander on a new pointer value, instead reusing // the existing GEPs whenever possible. - if (IndVar->getType()->isPointerTy() && !IVCount->getType()->isPointerTy()) { + if (IndVar->getType()->isPointerTy() && + !ExitCount->getType()->isPointerTy()) { // IVOffset will be the new GEP offset that is interpreted by GEP as a - // signed value. IVCount on the other hand represents the loop trip count, + // signed value. ExitCount on the other hand represents the loop trip count, // which is an unsigned value. FindLoopCounter only allows induction // variables that have a positive unit stride of one. This means we don't // have to handle the case of negative offsets (yet) and just need to zero - // extend IVCount. + // extend ExitCount. Type *OfsTy = SE->getEffectiveSCEVType(IVInit->getType()); - const SCEV *IVOffset = SE->getTruncateOrZeroExtend(IVCount, OfsTy); + const SCEV *IVOffset = SE->getTruncateOrZeroExtend(ExitCount, OfsTy); + if (UsePostInc) + IVOffset = SE->getAddExpr(IVOffset, SE->getOne(OfsTy)); // Expand the code for the iteration count. assert(SE->isLoopInvariant(IVOffset, L) && "Computed iteration count is not loop invariant!"); - BranchInst *BI = cast(L->getExitingBlock()->getTerminator()); + BranchInst *BI = cast(ExitingBB->getTerminator()); Value *GEPOffset = Rewriter.expandCodeFor(IVOffset, OfsTy, BI); Value *GEPBase = IndVar->getIncomingValueForBlock(L->getLoopPreheader()); assert(AR->getStart() == SE->getSCEV(GEPBase) && "bad loop counter"); // We could handle pointer IVs other than i8*, but we need to compensate for - // gep index scaling. See canExpandBackedgeTakenCount comments. + // gep index scaling. assert(SE->getSizeOfExpr(IntegerType::getInt64Ty(IndVar->getContext()), cast(GEPBase->getType()) ->getElementType())->isOne() && @@ -2291,7 +2321,7 @@ static Value *genLoopLimit(PHINode *IndVar, const SCEV IRBuilder<> Builder(L->getLoopPreheader()->getTerminator()); return Builder.CreateGEP(nullptr, GEPBase, GEPOffset, "lftr.limit"); } else { - // In any other case, convert both IVInit and IVCount to integers before + // In any other case, convert both IVInit and ExitCount to integers before // comparing. This may result in SCEV expansion of pointers, but in practice // SCEV will fold the pointer arithmetic away as such: // BECount = (IVEnd - IVInit - 1) => IVLimit = IVInit (postinc). @@ -2299,35 +2329,34 @@ static Value *genLoopLimit(PHINode *IndVar, const SCEV // Valid Cases: (1) both integers is most common; (2) both may be pointers // for simple memset-style loops. // - // IVInit integer and IVCount pointer would only occur if a canonical IV + // IVInit integer and ExitCount pointer would only occur if a canonical IV // were generated on top of case #2, which is not expected. - const SCEV *IVLimit = nullptr; - // For unit stride, IVCount = Start + BECount with 2's complement overflow. - // For non-zero Start, compute IVCount here. - if (AR->getStart()->isZero()) - IVLimit = IVCount; - else { - assert(AR->getStepRecurrence(*SE)->isOne() && "only handles unit stride"); - const SCEV *IVInit = AR->getStart(); + assert(AR->getStepRecurrence(*SE)->isOne() && "only handles unit stride"); + // For unit stride, IVCount = Start + ExitCount with 2's complement + // overflow. + const SCEV *IVInit = AR->getStart(); - // For integer IVs, truncate the IV before computing IVInit + BECount. - if (SE->getTypeSizeInBits(IVInit->getType()) - > SE->getTypeSizeInBits(IVCount->getType())) - IVInit = SE->getTruncateExpr(IVInit, IVCount->getType()); + // For integer IVs, truncate the IV before computing IVInit + BECount. + if (SE->getTypeSizeInBits(IVInit->getType()) + > SE->getTypeSizeInBits(ExitCount->getType())) + IVInit = SE->getTruncateExpr(IVInit, ExitCount->getType()); - IVLimit = SE->getAddExpr(IVInit, IVCount); - } + const SCEV *IVLimit = SE->getAddExpr(IVInit, ExitCount); + + if (UsePostInc) + IVLimit = SE->getAddExpr(IVLimit, SE->getOne(IVLimit->getType())); + // Expand the code for the iteration count. - BranchInst *BI = cast(L->getExitingBlock()->getTerminator()); + BranchInst *BI = cast(ExitingBB->getTerminator()); IRBuilder<> Builder(BI); assert(SE->isLoopInvariant(IVLimit, L) && "Computed iteration count is not loop invariant!"); // Ensure that we generate the same type as IndVar, or a smaller integer // type. In the presence of null pointer values, we have an integer type // SCEV expression (IVInit) for a pointer type IV value (IndVar). - Type *LimitTy = IVCount->getType()->isPointerTy() ? - IndVar->getType() : IVCount->getType(); + Type *LimitTy = ExitCount->getType()->isPointerTy() ? + IndVar->getType() : ExitCount->getType(); return Rewriter.expandCodeFor(IVLimit, LimitTy, BI); } } @@ -2338,51 +2367,76 @@ static Value *genLoopLimit(PHINode *IndVar, const SCEV /// determine a loop-invariant trip count of the loop, which is actually a much /// broader range than just linear tests. bool IndVarSimplify:: -linearFunctionTestReplace(Loop *L, const SCEV *BackedgeTakenCount, +linearFunctionTestReplace(Loop *L, BasicBlock *ExitingBB, + const SCEV *ExitCount, PHINode *IndVar, SCEVExpander &Rewriter) { - assert(canExpandBackedgeTakenCount(L, SE, Rewriter) && "precondition"); + assert(L->getLoopLatch() && "Loop no longer in simplified form?"); + assert(isLoopCounter(IndVar, L, SE)); + Instruction * const IncVar = + cast(IndVar->getIncomingValueForBlock(L->getLoopLatch())); - // Initialize CmpIndVar and IVCount to their preincremented values. + // Initialize CmpIndVar to the preincremented IV. Value *CmpIndVar = IndVar; - const SCEV *IVCount = BackedgeTakenCount; + bool UsePostInc = false; - assert(L->getLoopLatch() && "Loop no longer in simplified form?"); - // If the exiting block is the same as the backedge block, we prefer to // compare against the post-incremented value, otherwise we must compare // against the preincremented value. - if (L->getExitingBlock() == L->getLoopLatch()) { - // Add one to the "backedge-taken" count to get the trip count. - // This addition may overflow, which is valid as long as the comparison is - // truncated to BackedgeTakenCount->getType(). - IVCount = SE->getAddExpr(BackedgeTakenCount, - SE->getOne(BackedgeTakenCount->getType())); - // The BackedgeTaken expression contains the number of times that the - // backedge branches to the loop header. This is one less than the - // number of times the loop executes, so use the incremented indvar. - CmpIndVar = IndVar->getIncomingValueForBlock(L->getExitingBlock()); + if (ExitingBB == L->getLoopLatch()) { + bool SafeToPostInc = IndVar->getType()->isIntegerTy(); + if (!SafeToPostInc) { + // For pointer IVs, we chose to not strip inbounds which requires us not + // to add a potentially UB introducing use. We need to either a) show + // the loop test we're modifying is already in post-inc form, or b) show + // that adding a use must not introduce UB. + if (ICmpInst *LoopTest = getLoopTest(L, ExitingBB)) + SafeToPostInc = LoopTest->getOperand(0) == IncVar || + LoopTest->getOperand(1) == IncVar; + if (!SafeToPostInc) + SafeToPostInc = + mustExecuteUBIfPoisonOnPathTo(IncVar, ExitingBB->getTerminator(), DT); + } + + if (SafeToPostInc) { + UsePostInc = true; + CmpIndVar = IncVar; + } } - Value *ExitCnt = genLoopLimit(IndVar, IVCount, L, Rewriter, SE); + // It may be necessary to drop nowrap flags on the incrementing instruction + // if either LFTR moves from a pre-inc check to a post-inc check (in which + // case the increment might have previously been poison on the last iteration + // only) or if LFTR switches to a different IV that was previously dynamically + // dead (and as such may be arbitrarily poison). We remove any nowrap flags + // that SCEV didn't infer for the post-inc addrec (even if we use a pre-inc + // check), because the pre-inc addrec flags may be adopted from the original + // instruction, while SCEV has to explicitly prove the post-inc nowrap flags. + // TODO: This handling is inaccurate for one case: If we switch to a + // dynamically dead IV that wraps on the first loop iteration only, which is + // not covered by the post-inc addrec. (If the new IV was not dynamically + // dead, it could not be poison on the first iteration in the first place.) + if (auto *BO = dyn_cast(IncVar)) { + const SCEVAddRecExpr *AR = cast(SE->getSCEV(IncVar)); + if (BO->hasNoUnsignedWrap()) + BO->setHasNoUnsignedWrap(AR->hasNoUnsignedWrap()); + if (BO->hasNoSignedWrap()) + BO->setHasNoSignedWrap(AR->hasNoSignedWrap()); + } + + Value *ExitCnt = genLoopLimit( + IndVar, ExitingBB, ExitCount, UsePostInc, L, Rewriter, SE); assert(ExitCnt->getType()->isPointerTy() == IndVar->getType()->isPointerTy() && "genLoopLimit missed a cast"); // Insert a new icmp_ne or icmp_eq instruction before the branch. - BranchInst *BI = cast(L->getExitingBlock()->getTerminator()); + BranchInst *BI = cast(ExitingBB->getTerminator()); ICmpInst::Predicate P; if (L->contains(BI->getSuccessor(0))) P = ICmpInst::ICMP_NE; else P = ICmpInst::ICMP_EQ; - LLVM_DEBUG(dbgs() << "INDVARS: Rewriting loop exit condition to:\n" - << " LHS:" << *CmpIndVar << '\n' - << " op:\t" << (P == ICmpInst::ICMP_NE ? "!=" : "==") - << "\n" - << " RHS:\t" << *ExitCnt << "\n" - << " IVCount:\t" << *IVCount << "\n"); - IRBuilder<> Builder(BI); // The new loop exit condition should reuse the debug location of the @@ -2391,25 +2445,20 @@ linearFunctionTestReplace(Loop *L, const SCEV *Backedg Builder.SetCurrentDebugLocation(Cond->getDebugLoc()); // LFTR can ignore IV overflow and truncate to the width of - // BECount. This avoids materializing the add(zext(add)) expression. + // ExitCount. This avoids materializing the add(zext(add)) expression. unsigned CmpIndVarSize = SE->getTypeSizeInBits(CmpIndVar->getType()); unsigned ExitCntSize = SE->getTypeSizeInBits(ExitCnt->getType()); if (CmpIndVarSize > ExitCntSize) { const SCEVAddRecExpr *AR = cast(SE->getSCEV(IndVar)); const SCEV *ARStart = AR->getStart(); const SCEV *ARStep = AR->getStepRecurrence(*SE); - // For constant IVCount, avoid truncation. - if (isa(ARStart) && isa(IVCount)) { + // For constant ExitCount, avoid truncation. + if (isa(ARStart) && isa(ExitCount)) { const APInt &Start = cast(ARStart)->getAPInt(); - APInt Count = cast(IVCount)->getAPInt(); - // Note that the post-inc value of BackedgeTakenCount may have overflowed - // above such that IVCount is now zero. - if (IVCount != BackedgeTakenCount && Count == 0) { - Count = APInt::getMaxValue(Count.getBitWidth()).zext(CmpIndVarSize); + APInt Count = cast(ExitCount)->getAPInt(); + Count = Count.zext(CmpIndVarSize); + if (UsePostInc) ++Count; - } - else - Count = Count.zext(CmpIndVarSize); APInt NewLimit; if (cast(ARStep)->getValue()->isNegative()) NewLimit = Start - Count; @@ -2451,6 +2500,14 @@ linearFunctionTestReplace(Loop *L, const SCEV *Backedg "lftr.wideiv"); } } + LLVM_DEBUG(dbgs() << "INDVARS: Rewriting loop exit condition to:\n" + << " LHS:" << *CmpIndVar << '\n' + << " op:\t" << (P == ICmpInst::ICMP_NE ? "!=" : "==") + << "\n" + << " RHS:\t" << *ExitCnt << "\n" + << "ExitCount:\t" << *ExitCount << "\n" + << " was: " << *BI->getCondition() << "\n"); + Value *Cond = Builder.CreateICmp(P, CmpIndVar, ExitCnt, "exitcond"); Value *OrigCond = BI->getCondition(); // It's tempting to use replaceAllUsesWith here to fully replace the old @@ -2615,22 +2672,52 @@ bool IndVarSimplify::run(Loop *L) { NumElimIV += Rewriter.replaceCongruentIVs(L, DT, DeadInsts); // If we have a trip count expression, rewrite the loop's exit condition - // using it. We can currently only handle loops with a single exit. - if (!DisableLFTR && canExpandBackedgeTakenCount(L, SE, Rewriter) && - needsLFTR(L, DT)) { - PHINode *IndVar = FindLoopCounter(L, BackedgeTakenCount, SE, DT); - if (IndVar) { + // using it. + if (!DisableLFTR) { + // For the moment, we only do LFTR for single exit loops. The code is + // structured as it is in the expectation of generalization to multi-exit + // loops in the near future. See D62625 for context. + SmallVector ExitingBlocks; + if (auto *ExitingBB = L->getExitingBlock()) + ExitingBlocks.push_back(ExitingBB); + for (BasicBlock *ExitingBB : ExitingBlocks) { + // Can't rewrite non-branch yet. + if (!isa(ExitingBB->getTerminator())) + continue; + + if (!needsLFTR(L, ExitingBB)) + continue; + + const SCEV *ExitCount = SE->getExitCount(L, ExitingBB); + if (isa(ExitCount)) + continue; + + // Better to fold to true (TODO: do so!) + if (ExitCount->isZero()) + continue; + + PHINode *IndVar = FindLoopCounter(L, ExitingBB, ExitCount, SE, DT); + if (!IndVar) + continue; + + // Avoid high cost expansions. Note: This heuristic is questionable in + // that our definition of "high cost" is not exactly principled. + if (Rewriter.isHighCostExpansion(ExitCount, L)) + continue; + // Check preconditions for proper SCEVExpander operation. SCEV does not - // express SCEVExpander's dependencies, such as LoopSimplify. Instead any - // pass that uses the SCEVExpander must do it. This does not work well for - // loop passes because SCEVExpander makes assumptions about all loops, - // while LoopPassManager only forces the current loop to be simplified. + // express SCEVExpander's dependencies, such as LoopSimplify. Instead + // any pass that uses the SCEVExpander must do it. This does not work + // well for loop passes because SCEVExpander makes assumptions about + // all loops, while LoopPassManager only forces the current loop to be + // simplified. // // FIXME: SCEV expansion has no way to bail out, so the caller must // explicitly check any assumptions made by SCEV. Brittle. - const SCEVAddRecExpr *AR = dyn_cast(BackedgeTakenCount); + const SCEVAddRecExpr *AR = dyn_cast(ExitCount); if (!AR || AR->getLoop()->getLoopPreheader()) - Changed |= linearFunctionTestReplace(L, BackedgeTakenCount, IndVar, + Changed |= linearFunctionTestReplace(L, ExitingBB, + ExitCount, IndVar, Rewriter); } } From owner-svn-src-all@freebsd.org Fri Jul 12 20:05:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D572A15D562F; Fri, 12 Jul 2019 20:05:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 763678A43A; Fri, 12 Jul 2019 20:05:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5029A1B7FC; Fri, 12 Jul 2019 20:05:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CK5Vsu085844; Fri, 12 Jul 2019 20:05:31 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CK5VP2085842; Fri, 12 Jul 2019 20:05:31 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201907122005.x6CK5VP2085842@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 12 Jul 2019 20:05:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349955 - in stable: 11/sys/amd64/amd64 11/sys/x86/include 12/sys/amd64/amd64 12/sys/x86/include X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/amd64/amd64 11/sys/x86/include 12/sys/amd64/amd64 12/sys/x86/include X-SVN-Commit-Revision: 349955 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 763678A43A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 20:05:32 -0000 Author: jhb Date: Fri Jul 12 20:05:30 2019 New Revision: 349955 URL: https://svnweb.freebsd.org/changeset/base/349955 Log: MFC 348210: Add a constant for the LS config MSR on AMD CPUs. Modified: stable/12/sys/amd64/amd64/initcpu.c stable/12/sys/x86/include/specialreg.h Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/amd64/amd64/initcpu.c stable/11/sys/x86/include/specialreg.h Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/amd64/amd64/initcpu.c ============================================================================== --- stable/12/sys/amd64/amd64/initcpu.c Fri Jul 12 19:43:59 2019 (r349954) +++ stable/12/sys/amd64/amd64/initcpu.c Fri Jul 12 20:05:30 2019 (r349955) @@ -124,9 +124,9 @@ init_amd(void) */ if (CPUID_TO_FAMILY(cpu_id) == 0x16 && CPUID_TO_MODEL(cpu_id) <= 0xf) { if ((cpu_feature2 & CPUID2_HV) == 0) { - msr = rdmsr(0xc0011020); + msr = rdmsr(MSR_LS_CFG); msr |= (uint64_t)1 << 15; - wrmsr(0xc0011020, msr); + wrmsr(MSR_LS_CFG, msr); } } @@ -139,9 +139,9 @@ init_amd(void) wrmsr(0xc0011029, msr); /* 1033 */ - msr = rdmsr(0xc0011020); + msr = rdmsr(MSR_LS_CFG); msr |= 0x10; - wrmsr(0xc0011020, msr); + wrmsr(MSR_LS_CFG, msr); /* 1049 */ msr = rdmsr(0xc0011028); @@ -149,9 +149,9 @@ init_amd(void) wrmsr(0xc0011028, msr); /* 1095 */ - msr = rdmsr(0xc0011020); + msr = rdmsr(MSR_LS_CFG); msr |= 0x200000000000000; - wrmsr(0xc0011020, msr); + wrmsr(MSR_LS_CFG, msr); } /* Modified: stable/12/sys/x86/include/specialreg.h ============================================================================== --- stable/12/sys/x86/include/specialreg.h Fri Jul 12 19:43:59 2019 (r349954) +++ stable/12/sys/x86/include/specialreg.h Fri Jul 12 20:05:30 2019 (r349955) @@ -1029,6 +1029,7 @@ #define MSR_VM_HSAVE_PA 0xc0010117 /* SVM: host save area address */ #define MSR_AMD_CPUID07 0xc0011002 /* CPUID 07 %ebx override */ #define MSR_EXTFEATURES 0xc0011005 /* Extended CPUID Features override */ +#define MSR_LS_CFG 0xc0011020 #define MSR_IC_CFG 0xc0011021 /* Instruction Cache Configuration */ /* MSR_VM_CR related */ From owner-svn-src-all@freebsd.org Fri Jul 12 20:05:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6224B15D5634; Fri, 12 Jul 2019 20:05:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 025E08A43B; Fri, 12 Jul 2019 20:05:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD9C31B7FD; Fri, 12 Jul 2019 20:05:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CK5VKK085851; Fri, 12 Jul 2019 20:05:31 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CK5V7x085849; Fri, 12 Jul 2019 20:05:31 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201907122005.x6CK5V7x085849@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 12 Jul 2019 20:05:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349955 - in stable: 11/sys/amd64/amd64 11/sys/x86/include 12/sys/amd64/amd64 12/sys/x86/include X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/amd64/amd64 11/sys/x86/include 12/sys/amd64/amd64 12/sys/x86/include X-SVN-Commit-Revision: 349955 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 025E08A43B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 20:05:32 -0000 Author: jhb Date: Fri Jul 12 20:05:30 2019 New Revision: 349955 URL: https://svnweb.freebsd.org/changeset/base/349955 Log: MFC 348210: Add a constant for the LS config MSR on AMD CPUs. Modified: stable/11/sys/amd64/amd64/initcpu.c stable/11/sys/x86/include/specialreg.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/amd64/amd64/initcpu.c stable/12/sys/x86/include/specialreg.h Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/amd64/amd64/initcpu.c ============================================================================== --- stable/11/sys/amd64/amd64/initcpu.c Fri Jul 12 19:43:59 2019 (r349954) +++ stable/11/sys/amd64/amd64/initcpu.c Fri Jul 12 20:05:30 2019 (r349955) @@ -122,9 +122,9 @@ init_amd(void) */ if (CPUID_TO_FAMILY(cpu_id) == 0x16 && CPUID_TO_MODEL(cpu_id) <= 0xf) { if ((cpu_feature2 & CPUID2_HV) == 0) { - msr = rdmsr(0xc0011020); + msr = rdmsr(MSR_LS_CFG); msr |= (uint64_t)1 << 15; - wrmsr(0xc0011020, msr); + wrmsr(MSR_LS_CFG, msr); } } @@ -137,9 +137,9 @@ init_amd(void) wrmsr(0xc0011029, msr); /* 1033 */ - msr = rdmsr(0xc0011020); + msr = rdmsr(MSR_LS_CFG); msr |= 0x10; - wrmsr(0xc0011020, msr); + wrmsr(MSR_LS_CFG, msr); /* 1049 */ msr = rdmsr(0xc0011028); @@ -147,9 +147,9 @@ init_amd(void) wrmsr(0xc0011028, msr); /* 1095 */ - msr = rdmsr(0xc0011020); + msr = rdmsr(MSR_LS_CFG); msr |= 0x200000000000000; - wrmsr(0xc0011020, msr); + wrmsr(MSR_LS_CFG, msr); } /* Modified: stable/11/sys/x86/include/specialreg.h ============================================================================== --- stable/11/sys/x86/include/specialreg.h Fri Jul 12 19:43:59 2019 (r349954) +++ stable/11/sys/x86/include/specialreg.h Fri Jul 12 20:05:30 2019 (r349955) @@ -908,6 +908,7 @@ #define MSR_VM_HSAVE_PA 0xc0010117 /* SVM: host save area address */ #define MSR_AMD_CPUID07 0xc0011002 /* CPUID 07 %ebx override */ #define MSR_EXTFEATURES 0xc0011005 /* Extended CPUID Features override */ +#define MSR_LS_CFG 0xc0011020 #define MSR_IC_CFG 0xc0011021 /* Instruction Cache Configuration */ /* MSR_VM_CR related */ From owner-svn-src-all@freebsd.org Fri Jul 12 20:59:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C6B215D6380; Fri, 12 Jul 2019 20:59:11 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0EBB58BFD0; Fri, 12 Jul 2019 20:59:11 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA7481C0B5; Fri, 12 Jul 2019 20:59:10 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CKxAQi012111; Fri, 12 Jul 2019 20:59:10 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CKxAoY012110; Fri, 12 Jul 2019 20:59:10 GMT (envelope-from np@FreeBSD.org) Message-Id: <201907122059.x6CKxAoY012110@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 12 Jul 2019 20:59:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349956 - head/sys/dev/cxgbe/common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe/common X-SVN-Commit-Revision: 349956 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0EBB58BFD0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.954,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 20:59:11 -0000 Author: np Date: Fri Jul 12 20:59:10 2019 New Revision: 349956 URL: https://svnweb.freebsd.org/changeset/base/349956 Log: cxgbe(4): Completely ignore all top level interrupts that are not enabled. The driver used to log any non-zero cause and when running with a single line interrupt it would spam the console/logs with reports of interrupts that are of no interest to anyone. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/t4_hw.c Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Fri Jul 12 20:05:30 2019 (r349955) +++ head/sys/dev/cxgbe/common/t4_hw.c Fri Jul 12 20:59:10 2019 (r349956) @@ -4023,17 +4023,16 @@ t4_handle_intr(struct adapter *adap, const struct intr bool rc; const struct intr_action *action; - /* read and display cause. */ - cause = t4_read_reg(adap, ii->cause_reg); - if (verbose || cause != 0) - t4_show_intr_info(adap, ii, cause); /* - * The top level interrupt cause is a bit special and we need to ignore - * the bits that are not in the enable. Note that we did display them - * above in t4_show_intr_info but will not clear them. + * Read and display cause. Note that the top level PL_INT_CAUSE is a + * bit special and we need to completely ignore the bits that are not in + * PL_INT_ENABLE. */ + cause = t4_read_reg(adap, ii->cause_reg); if (ii->cause_reg == A_PL_INT_CAUSE) cause &= t4_read_reg(adap, ii->enable_reg); + if (verbose || cause != 0) + t4_show_intr_info(adap, ii, cause); fatal = cause & ii->fatal; if (fatal != 0 && ii->flags & NONFATAL_IF_DISABLED) fatal &= t4_read_reg(adap, ii->enable_reg); From owner-svn-src-all@freebsd.org Fri Jul 12 21:19:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 701C015D6BDE; Fri, 12 Jul 2019 21:19:48 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 134C48CBF9; Fri, 12 Jul 2019 21:19:48 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DBA7A1C417; Fri, 12 Jul 2019 21:19:47 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CLJl1Q022278; Fri, 12 Jul 2019 21:19:47 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CLJlrw022277; Fri, 12 Jul 2019 21:19:47 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201907122119.x6CLJlrw022277@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Fri, 12 Jul 2019 21:19:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349957 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: tijl X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 349957 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 134C48CBF9 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.954,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 21:19:48 -0000 Author: tijl Date: Fri Jul 12 21:19:47 2019 New Revision: 349957 URL: https://svnweb.freebsd.org/changeset/base/349957 Log: Fix layout. -C needs to be styled as a flag here, not as a new list item. MFC after: 2 weeks Modified: head/usr.bin/top/top.1 Modified: head/usr.bin/top/top.1 ============================================================================== --- head/usr.bin/top/top.1 Fri Jul 12 20:59:10 2019 (r349956) +++ head/usr.bin/top/top.1 Fri Jul 12 21:19:47 2019 (r349957) @@ -51,7 +51,7 @@ By default top displays the weighted CPU percentage in .Xr ps 1 displays as CPU). Each time -.It Fl C +.Fl C flag is passed it toggles between \*(lqraw cpu\*(rq mode and \*(lqweighted cpu\*(rq mode, showing the \*(lqCPU\*(rq or the \*(lqWCPU\*(rq column respectively. From owner-svn-src-all@freebsd.org Fri Jul 12 22:31:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5970815D8680; Fri, 12 Jul 2019 22:31:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ED0588F757; Fri, 12 Jul 2019 22:31:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C6B931D038; Fri, 12 Jul 2019 22:31:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CMVDbQ059301; Fri, 12 Jul 2019 22:31:13 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CMVCWU059296; Fri, 12 Jul 2019 22:31:12 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201907122231.x6CMVCWU059296@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 12 Jul 2019 22:31:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349958 - in stable: 11/sys/amd64/vmm 11/sys/amd64/vmm/amd 11/sys/x86/x86 11/usr.sbin/bhyve 12/sys/amd64/vmm 12/sys/amd64/vmm/amd 12/sys/x86/x86 12/usr.sbin/bhyve X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/amd64/vmm 11/sys/amd64/vmm/amd 11/sys/x86/x86 11/usr.sbin/bhyve 12/sys/amd64/vmm 12/sys/amd64/vmm/amd 12/sys/x86/x86 12/usr.sbin/bhyve X-SVN-Commit-Revision: 349958 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: ED0588F757 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 22:31:14 -0000 Author: jhb Date: Fri Jul 12 22:31:12 2019 New Revision: 349958 URL: https://svnweb.freebsd.org/changeset/base/349958 Log: MFC 339911,339936,343075,343166,348592: Various AMD CPU-specific fixes. 339911: Emulate machine check related MSR_EXTFEATURES to allow guest OSes to boot on AMD FX Series. 339936: Merge cases with upper block. This is a cosmetic change only to simplify code. 343075: vmm(4): Take steps towards multicore bhyve AMD support vmm's CPUID emulation presented Intel topology information to the guest, but disabled AMD topology information and in some cases passed through garbage. I.e., CPUID leaves 0x8000_001[de] were passed through to the guest, but guest CPUs can migrate between host threads, so the information presented was not consistent. This could easily be observed with 'cpucontrol -i 0xfoo /dev/cpuctl0'. Slightly improve this situation by enabling the AMD topology feature flag and presenting at least the CPUID fields used by FreeBSD itself to probe topology on more modern AMD64 hardware (Family 15h+). Older stuff is probably less interesting. I have not been able to empirically confirm it is sufficient, but it should not regress anything either. 343166: vmm(4): Mask Spectre feature bits on AMD hosts For parity with Intel hosts, which already mask out the CPUID feature bits that indicate the presence of the SPEC_CTRL MSR, do the same on AMD. Eventually we may want to have a better support story for guests, but for now, limit the damage of incorrectly indicating an MSR we do not yet support. Eventually, we may want a generic CPUID override system for administrators, or for minimum supported feature set in heterogenous environments with failover. That is a much larger scope effort than this bug fix. 348592: Emulate the AMD MSR_LS_CFG MSR used for various Ryzen errata. Writes are ignored and reads always return zero. PR: 224476, 235010 Modified: stable/12/sys/amd64/vmm/amd/svm_msr.c stable/12/sys/amd64/vmm/x86.c stable/12/sys/amd64/vmm/x86.h stable/12/sys/x86/x86/mp_x86.c stable/12/usr.sbin/bhyve/xmsr.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/amd64/vmm/amd/svm_msr.c stable/11/sys/amd64/vmm/x86.c stable/11/sys/amd64/vmm/x86.h stable/11/sys/x86/x86/mp_x86.c stable/11/usr.sbin/bhyve/xmsr.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/amd64/vmm/amd/svm_msr.c ============================================================================== --- stable/12/sys/amd64/vmm/amd/svm_msr.c Fri Jul 12 21:19:47 2019 (r349957) +++ stable/12/sys/amd64/vmm/amd/svm_msr.c Fri Jul 12 22:31:12 2019 (r349958) @@ -122,9 +122,8 @@ svm_rdmsr(struct svm_softc *sc, int vcpu, u_int num, u case MSR_MTRR16kBase ... MSR_MTRR16kBase + 1: case MSR_MTRR64kBase: case MSR_SYSCFG: - *result = 0; - break; case MSR_AMDK8_IPM: + case MSR_EXTFEATURES: *result = 0; break; default: @@ -162,6 +161,8 @@ svm_wrmsr(struct svm_softc *sc, int vcpu, u_int num, u /* * Ignore writes to microcode update register. */ + break; + case MSR_EXTFEATURES: break; default: error = EINVAL; Modified: stable/12/sys/amd64/vmm/x86.c ============================================================================== --- stable/12/sys/amd64/vmm/x86.c Fri Jul 12 21:19:47 2019 (r349957) +++ stable/12/sys/amd64/vmm/x86.c Fri Jul 12 22:31:12 2019 (r349958) @@ -137,17 +137,30 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, cpuid_count(*eax, *ecx, regs); if (vmm_is_amd()) { /* - * XXX this might appear silly because AMD - * cpus don't have threads. - * - * However this matches the logical cpus as - * advertised by leaf 0x1 and will work even - * if threads is set incorrectly on an AMD host. + * As on Intel (0000_0007:0, EDX), mask out + * unsupported or unsafe AMD extended features + * (8000_0008 EBX). */ + regs[1] &= (AMDFEID_CLZERO | AMDFEID_IRPERF | + AMDFEID_XSAVEERPTR); + vm_get_topology(vm, &sockets, &cores, &threads, &maxcpus); - logical_cpus = threads * cores; - regs[2] = logical_cpus - 1; + /* + * Here, width is ApicIdCoreIdSize, present on + * at least Family 15h and newer. It + * represents the "number of bits in the + * initial apicid that indicate thread id + * within a package." + * + * Our topo_probe_amd() uses it for + * pkg_id_shift and other OSes may rely on it. + */ + width = MIN(0xF, log2(threads * cores)); + if (width < 0x4) + width = 0; + logical_cpus = MIN(0xFF, threads * cores - 1); + regs[2] = (width << AMDID_COREID_SIZE_SHIFT) | logical_cpus; } break; @@ -155,9 +168,9 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, cpuid_count(*eax, *ecx, regs); /* - * Hide SVM and Topology Extension features from guest. + * Hide SVM from guest. */ - regs[2] &= ~(AMDID2_SVM | AMDID2_TOPOLOGY); + regs[2] &= ~AMDID2_SVM; /* * Don't advertise extended performance counter MSRs @@ -219,6 +232,68 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, regs[3] |= AMDPM_TSC_INVARIANT; break; + case CPUID_8000_001D: + /* AMD Cache topology, like 0000_0004 for Intel. */ + if (!vmm_is_amd()) + goto default_leaf; + + /* + * Similar to Intel, generate a ficticious cache + * topology for the guest with L3 shared by the + * package, and L1 and L2 local to a core. + */ + vm_get_topology(vm, &sockets, &cores, &threads, + &maxcpus); + switch (*ecx) { + case 0: + logical_cpus = threads; + level = 1; + func = 1; /* data cache */ + break; + case 1: + logical_cpus = threads; + level = 2; + func = 3; /* unified cache */ + break; + case 2: + logical_cpus = threads * cores; + level = 3; + func = 3; /* unified cache */ + break; + default: + logical_cpus = 0; + level = 0; + func = 0; + break; + } + + logical_cpus = MIN(0xfff, logical_cpus - 1); + regs[0] = (logical_cpus << 14) | (1 << 8) | + (level << 5) | func; + regs[1] = (func > 0) ? (CACHE_LINE_SIZE - 1) : 0; + regs[2] = 0; + regs[3] = 0; + break; + + case CPUID_8000_001E: + /* AMD Family 16h+ additional identifiers */ + if (!vmm_is_amd() || CPUID_TO_FAMILY(cpu_id) < 0x16) + goto default_leaf; + + vm_get_topology(vm, &sockets, &cores, &threads, + &maxcpus); + regs[0] = vcpu_id; + threads = MIN(0xFF, threads - 1); + regs[1] = (threads << 8) | + (vcpu_id >> log2(threads + 1)); + /* + * XXX Bhyve topology cannot yet represent >1 node per + * processor. + */ + regs[2] = 0; + regs[3] = 0; + break; + case CPUID_0000_0001: do_cpuid(1, regs); @@ -359,7 +434,7 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, CPUID_STDEXT_AVX512F | CPUID_STDEXT_AVX512PF | CPUID_STDEXT_AVX512ER | - CPUID_STDEXT_AVX512CD); + CPUID_STDEXT_AVX512CD | CPUID_STDEXT_SHA); regs[2] = 0; regs[3] &= CPUID_STDEXT3_MD_CLEAR; @@ -391,35 +466,42 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, case CPUID_0000_000B: /* - * Processor topology enumeration + * Intel processor topology enumeration */ - vm_get_topology(vm, &sockets, &cores, &threads, - &maxcpus); - if (*ecx == 0) { - logical_cpus = threads; - width = log2(logical_cpus); - level = CPUID_TYPE_SMT; - x2apic_id = vcpu_id; - } + if (vmm_is_intel()) { + vm_get_topology(vm, &sockets, &cores, &threads, + &maxcpus); + if (*ecx == 0) { + logical_cpus = threads; + width = log2(logical_cpus); + level = CPUID_TYPE_SMT; + x2apic_id = vcpu_id; + } - if (*ecx == 1) { - logical_cpus = threads * cores; - width = log2(logical_cpus); - level = CPUID_TYPE_CORE; - x2apic_id = vcpu_id; - } + if (*ecx == 1) { + logical_cpus = threads * cores; + width = log2(logical_cpus); + level = CPUID_TYPE_CORE; + x2apic_id = vcpu_id; + } - if (!cpuid_leaf_b || *ecx >= 2) { - width = 0; - logical_cpus = 0; - level = 0; - x2apic_id = 0; - } + if (!cpuid_leaf_b || *ecx >= 2) { + width = 0; + logical_cpus = 0; + level = 0; + x2apic_id = 0; + } - regs[0] = width & 0x1f; - regs[1] = logical_cpus & 0xffff; - regs[2] = (level << 8) | (*ecx & 0xff); - regs[3] = x2apic_id; + regs[0] = width & 0x1f; + regs[1] = logical_cpus & 0xffff; + regs[2] = (level << 8) | (*ecx & 0xff); + regs[3] = x2apic_id; + } else { + regs[0] = 0; + regs[1] = 0; + regs[2] = 0; + regs[3] = 0; + } break; case CPUID_0000_000D: @@ -481,6 +563,7 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, break; default: +default_leaf: /* * The leaf value has already been clamped so * simply pass this through, keeping count of Modified: stable/12/sys/amd64/vmm/x86.h ============================================================================== --- stable/12/sys/amd64/vmm/x86.h Fri Jul 12 21:19:47 2019 (r349957) +++ stable/12/sys/amd64/vmm/x86.h Fri Jul 12 22:31:12 2019 (r349958) @@ -49,6 +49,8 @@ #define CPUID_8000_0006 (0x80000006) #define CPUID_8000_0007 (0x80000007) #define CPUID_8000_0008 (0x80000008) +#define CPUID_8000_001D (0x8000001D) +#define CPUID_8000_001E (0x8000001E) /* * CPUID instruction Fn0000_0001: Modified: stable/12/sys/x86/x86/mp_x86.c ============================================================================== --- stable/12/sys/x86/x86/mp_x86.c Fri Jul 12 21:19:47 2019 (r349957) +++ stable/12/sys/x86/x86/mp_x86.c Fri Jul 12 22:31:12 2019 (r349958) @@ -235,6 +235,7 @@ add_deterministic_cache(int type, int level, int share * - BKDG For AMD Family 10h Processors (Publication # 31116) * - BKDG For AMD Family 15h Models 00h-0Fh Processors (Publication # 42301) * - BKDG For AMD Family 16h Models 00h-0Fh Processors (Publication # 48751) + * - PPR For AMD Family 17h Models 00h-0Fh Processors (Publication # 54945) */ static void topo_probe_amd(void) Modified: stable/12/usr.sbin/bhyve/xmsr.c ============================================================================== --- stable/12/usr.sbin/bhyve/xmsr.c Fri Jul 12 21:19:47 2019 (r349957) +++ stable/12/usr.sbin/bhyve/xmsr.c Fri Jul 12 22:31:12 2019 (r349958) @@ -72,6 +72,7 @@ emulate_wrmsr(struct vmctx *ctx, int vcpu, uint32_t nu return (0); case MSR_NB_CFG1: + case MSR_LS_CFG: case MSR_IC_CFG: return (0); /* Ignore writes */ @@ -141,6 +142,7 @@ emulate_rdmsr(struct vmctx *ctx, int vcpu, uint32_t nu break; case MSR_NB_CFG1: + case MSR_LS_CFG: case MSR_IC_CFG: /* * The reset value is processor family dependent so From owner-svn-src-all@freebsd.org Fri Jul 12 22:31:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90C3A15D8687; Fri, 12 Jul 2019 22:31:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2FDB48F759; Fri, 12 Jul 2019 22:31:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00DE01D03A; Fri, 12 Jul 2019 22:31:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6CMVEa5059312; Fri, 12 Jul 2019 22:31:14 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6CMVE8U059307; Fri, 12 Jul 2019 22:31:14 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201907122231.x6CMVE8U059307@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 12 Jul 2019 22:31:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349958 - in stable: 11/sys/amd64/vmm 11/sys/amd64/vmm/amd 11/sys/x86/x86 11/usr.sbin/bhyve 12/sys/amd64/vmm 12/sys/amd64/vmm/amd 12/sys/x86/x86 12/usr.sbin/bhyve X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/amd64/vmm 11/sys/amd64/vmm/amd 11/sys/x86/x86 11/usr.sbin/bhyve 12/sys/amd64/vmm 12/sys/amd64/vmm/amd 12/sys/x86/x86 12/usr.sbin/bhyve X-SVN-Commit-Revision: 349958 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2FDB48F759 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2019 22:31:15 -0000 Author: jhb Date: Fri Jul 12 22:31:12 2019 New Revision: 349958 URL: https://svnweb.freebsd.org/changeset/base/349958 Log: MFC 339911,339936,343075,343166,348592: Various AMD CPU-specific fixes. 339911: Emulate machine check related MSR_EXTFEATURES to allow guest OSes to boot on AMD FX Series. 339936: Merge cases with upper block. This is a cosmetic change only to simplify code. 343075: vmm(4): Take steps towards multicore bhyve AMD support vmm's CPUID emulation presented Intel topology information to the guest, but disabled AMD topology information and in some cases passed through garbage. I.e., CPUID leaves 0x8000_001[de] were passed through to the guest, but guest CPUs can migrate between host threads, so the information presented was not consistent. This could easily be observed with 'cpucontrol -i 0xfoo /dev/cpuctl0'. Slightly improve this situation by enabling the AMD topology feature flag and presenting at least the CPUID fields used by FreeBSD itself to probe topology on more modern AMD64 hardware (Family 15h+). Older stuff is probably less interesting. I have not been able to empirically confirm it is sufficient, but it should not regress anything either. 343166: vmm(4): Mask Spectre feature bits on AMD hosts For parity with Intel hosts, which already mask out the CPUID feature bits that indicate the presence of the SPEC_CTRL MSR, do the same on AMD. Eventually we may want to have a better support story for guests, but for now, limit the damage of incorrectly indicating an MSR we do not yet support. Eventually, we may want a generic CPUID override system for administrators, or for minimum supported feature set in heterogenous environments with failover. That is a much larger scope effort than this bug fix. 348592: Emulate the AMD MSR_LS_CFG MSR used for various Ryzen errata. Writes are ignored and reads always return zero. PR: 224476, 235010 Modified: stable/11/sys/amd64/vmm/amd/svm_msr.c stable/11/sys/amd64/vmm/x86.c stable/11/sys/amd64/vmm/x86.h stable/11/sys/x86/x86/mp_x86.c stable/11/usr.sbin/bhyve/xmsr.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/amd64/vmm/amd/svm_msr.c stable/12/sys/amd64/vmm/x86.c stable/12/sys/amd64/vmm/x86.h stable/12/sys/x86/x86/mp_x86.c stable/12/usr.sbin/bhyve/xmsr.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/amd64/vmm/amd/svm_msr.c ============================================================================== --- stable/11/sys/amd64/vmm/amd/svm_msr.c Fri Jul 12 21:19:47 2019 (r349957) +++ stable/11/sys/amd64/vmm/amd/svm_msr.c Fri Jul 12 22:31:12 2019 (r349958) @@ -122,9 +122,8 @@ svm_rdmsr(struct svm_softc *sc, int vcpu, u_int num, u case MSR_MTRR16kBase ... MSR_MTRR16kBase + 1: case MSR_MTRR64kBase: case MSR_SYSCFG: - *result = 0; - break; case MSR_AMDK8_IPM: + case MSR_EXTFEATURES: *result = 0; break; default: @@ -162,6 +161,8 @@ svm_wrmsr(struct svm_softc *sc, int vcpu, u_int num, u /* * Ignore writes to microcode update register. */ + break; + case MSR_EXTFEATURES: break; default: error = EINVAL; Modified: stable/11/sys/amd64/vmm/x86.c ============================================================================== --- stable/11/sys/amd64/vmm/x86.c Fri Jul 12 21:19:47 2019 (r349957) +++ stable/11/sys/amd64/vmm/x86.c Fri Jul 12 22:31:12 2019 (r349958) @@ -135,17 +135,30 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, cpuid_count(*eax, *ecx, regs); if (vmm_is_amd()) { /* - * XXX this might appear silly because AMD - * cpus don't have threads. - * - * However this matches the logical cpus as - * advertised by leaf 0x1 and will work even - * if threads is set incorrectly on an AMD host. + * As on Intel (0000_0007:0, EDX), mask out + * unsupported or unsafe AMD extended features + * (8000_0008 EBX). */ + regs[1] &= (AMDFEID_CLZERO | AMDFEID_IRPERF | + AMDFEID_XSAVEERPTR); + vm_get_topology(vm, &sockets, &cores, &threads, &maxcpus); - logical_cpus = threads * cores; - regs[2] = logical_cpus - 1; + /* + * Here, width is ApicIdCoreIdSize, present on + * at least Family 15h and newer. It + * represents the "number of bits in the + * initial apicid that indicate thread id + * within a package." + * + * Our topo_probe_amd() uses it for + * pkg_id_shift and other OSes may rely on it. + */ + width = MIN(0xF, log2(threads * cores)); + if (width < 0x4) + width = 0; + logical_cpus = MIN(0xFF, threads * cores - 1); + regs[2] = (width << AMDID_COREID_SIZE_SHIFT) | logical_cpus; } break; @@ -153,9 +166,9 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, cpuid_count(*eax, *ecx, regs); /* - * Hide SVM and Topology Extension features from guest. + * Hide SVM from guest. */ - regs[2] &= ~(AMDID2_SVM | AMDID2_TOPOLOGY); + regs[2] &= ~AMDID2_SVM; /* * Don't advertise extended performance counter MSRs @@ -217,6 +230,68 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, regs[3] |= AMDPM_TSC_INVARIANT; break; + case CPUID_8000_001D: + /* AMD Cache topology, like 0000_0004 for Intel. */ + if (!vmm_is_amd()) + goto default_leaf; + + /* + * Similar to Intel, generate a ficticious cache + * topology for the guest with L3 shared by the + * package, and L1 and L2 local to a core. + */ + vm_get_topology(vm, &sockets, &cores, &threads, + &maxcpus); + switch (*ecx) { + case 0: + logical_cpus = threads; + level = 1; + func = 1; /* data cache */ + break; + case 1: + logical_cpus = threads; + level = 2; + func = 3; /* unified cache */ + break; + case 2: + logical_cpus = threads * cores; + level = 3; + func = 3; /* unified cache */ + break; + default: + logical_cpus = 0; + level = 0; + func = 0; + break; + } + + logical_cpus = MIN(0xfff, logical_cpus - 1); + regs[0] = (logical_cpus << 14) | (1 << 8) | + (level << 5) | func; + regs[1] = (func > 0) ? (CACHE_LINE_SIZE - 1) : 0; + regs[2] = 0; + regs[3] = 0; + break; + + case CPUID_8000_001E: + /* AMD Family 16h+ additional identifiers */ + if (!vmm_is_amd() || CPUID_TO_FAMILY(cpu_id) < 0x16) + goto default_leaf; + + vm_get_topology(vm, &sockets, &cores, &threads, + &maxcpus); + regs[0] = vcpu_id; + threads = MIN(0xFF, threads - 1); + regs[1] = (threads << 8) | + (vcpu_id >> log2(threads + 1)); + /* + * XXX Bhyve topology cannot yet represent >1 node per + * processor. + */ + regs[2] = 0; + regs[3] = 0; + break; + case CPUID_0000_0001: do_cpuid(1, regs); @@ -357,7 +432,7 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, CPUID_STDEXT_AVX512F | CPUID_STDEXT_AVX512PF | CPUID_STDEXT_AVX512ER | - CPUID_STDEXT_AVX512CD); + CPUID_STDEXT_AVX512CD | CPUID_STDEXT_SHA); regs[2] = 0; regs[3] &= CPUID_STDEXT3_MD_CLEAR; @@ -389,35 +464,42 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, case CPUID_0000_000B: /* - * Processor topology enumeration + * Intel processor topology enumeration */ - vm_get_topology(vm, &sockets, &cores, &threads, - &maxcpus); - if (*ecx == 0) { - logical_cpus = threads; - width = log2(logical_cpus); - level = CPUID_TYPE_SMT; - x2apic_id = vcpu_id; - } + if (vmm_is_intel()) { + vm_get_topology(vm, &sockets, &cores, &threads, + &maxcpus); + if (*ecx == 0) { + logical_cpus = threads; + width = log2(logical_cpus); + level = CPUID_TYPE_SMT; + x2apic_id = vcpu_id; + } - if (*ecx == 1) { - logical_cpus = threads * cores; - width = log2(logical_cpus); - level = CPUID_TYPE_CORE; - x2apic_id = vcpu_id; - } + if (*ecx == 1) { + logical_cpus = threads * cores; + width = log2(logical_cpus); + level = CPUID_TYPE_CORE; + x2apic_id = vcpu_id; + } - if (!cpuid_leaf_b || *ecx >= 2) { - width = 0; - logical_cpus = 0; - level = 0; - x2apic_id = 0; - } + if (!cpuid_leaf_b || *ecx >= 2) { + width = 0; + logical_cpus = 0; + level = 0; + x2apic_id = 0; + } - regs[0] = width & 0x1f; - regs[1] = logical_cpus & 0xffff; - regs[2] = (level << 8) | (*ecx & 0xff); - regs[3] = x2apic_id; + regs[0] = width & 0x1f; + regs[1] = logical_cpus & 0xffff; + regs[2] = (level << 8) | (*ecx & 0xff); + regs[3] = x2apic_id; + } else { + regs[0] = 0; + regs[1] = 0; + regs[2] = 0; + regs[3] = 0; + } break; case CPUID_0000_000D: @@ -479,6 +561,7 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, break; default: +default_leaf: /* * The leaf value has already been clamped so * simply pass this through, keeping count of Modified: stable/11/sys/amd64/vmm/x86.h ============================================================================== --- stable/11/sys/amd64/vmm/x86.h Fri Jul 12 21:19:47 2019 (r349957) +++ stable/11/sys/amd64/vmm/x86.h Fri Jul 12 22:31:12 2019 (r349958) @@ -47,6 +47,8 @@ #define CPUID_8000_0006 (0x80000006) #define CPUID_8000_0007 (0x80000007) #define CPUID_8000_0008 (0x80000008) +#define CPUID_8000_001D (0x8000001D) +#define CPUID_8000_001E (0x8000001E) /* * CPUID instruction Fn0000_0001: Modified: stable/11/sys/x86/x86/mp_x86.c ============================================================================== --- stable/11/sys/x86/x86/mp_x86.c Fri Jul 12 21:19:47 2019 (r349957) +++ stable/11/sys/x86/x86/mp_x86.c Fri Jul 12 22:31:12 2019 (r349958) @@ -225,6 +225,7 @@ add_deterministic_cache(int type, int level, int share * - BKDG For AMD Family 10h Processors (Publication # 31116) * - BKDG For AMD Family 15h Models 00h-0Fh Processors (Publication # 42301) * - BKDG For AMD Family 16h Models 00h-0Fh Processors (Publication # 48751) + * - PPR For AMD Family 17h Models 00h-0Fh Processors (Publication # 54945) */ static void topo_probe_amd(void) Modified: stable/11/usr.sbin/bhyve/xmsr.c ============================================================================== --- stable/11/usr.sbin/bhyve/xmsr.c Fri Jul 12 21:19:47 2019 (r349957) +++ stable/11/usr.sbin/bhyve/xmsr.c Fri Jul 12 22:31:12 2019 (r349958) @@ -72,6 +72,7 @@ emulate_wrmsr(struct vmctx *ctx, int vcpu, uint32_t nu return (0); case MSR_NB_CFG1: + case MSR_LS_CFG: case MSR_IC_CFG: return (0); /* Ignore writes */ @@ -141,6 +142,7 @@ emulate_rdmsr(struct vmctx *ctx, int vcpu, uint32_t nu break; case MSR_NB_CFG1: + case MSR_LS_CFG: case MSR_IC_CFG: /* * The reset value is processor family dependent so From owner-svn-src-all@freebsd.org Sat Jul 13 00:12:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DBFC15DAC39; Sat, 13 Jul 2019 00:12:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CEC6A92DAF; Sat, 13 Jul 2019 00:12:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A8D2F1E250; Sat, 13 Jul 2019 00:12:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6D0CZAk015365; Sat, 13 Jul 2019 00:12:35 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6D0CZxF015364; Sat, 13 Jul 2019 00:12:35 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201907130012.x6D0CZxF015364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 13 Jul 2019 00:12:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349959 - stable/11/usr.sbin/bhyve X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/usr.sbin/bhyve X-SVN-Commit-Revision: 349959 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CEC6A92DAF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.965,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 00:12:36 -0000 Author: jhb Date: Sat Jul 13 00:12:35 2019 New Revision: 349959 URL: https://svnweb.freebsd.org/changeset/base/349959 Log: Add Capsicumification of the virtio_console device model. This is a direct commit to stable/11. This change was missed when merging virtio_console to 11 because the capsicum change and virtio_console changes were merged in the opposite order of the changes in head. Modified: stable/11/usr.sbin/bhyve/pci_virtio_console.c Modified: stable/11/usr.sbin/bhyve/pci_virtio_console.c ============================================================================== --- stable/11/usr.sbin/bhyve/pci_virtio_console.c Fri Jul 12 22:31:12 2019 (r349958) +++ stable/11/usr.sbin/bhyve/pci_virtio_console.c Sat Jul 13 00:12:35 2019 (r349959) @@ -34,12 +34,16 @@ __FBSDID("$FreeBSD$"); #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include #include #include +#include #include #include #include @@ -50,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "bhyverun.h" #include "pci_emul.h" @@ -270,6 +275,9 @@ pci_vtcon_sock_add(struct pci_vtcon_softc *sc, const c struct pci_vtcon_sock *sock; struct sockaddr_un sun; int s = -1, fd = -1, error = 0; +#ifndef WITHOUT_CAPSICUM + cap_rights_t rights; +#endif sock = calloc(1, sizeof(struct pci_vtcon_sock)); if (sock == NULL) { @@ -308,6 +316,11 @@ pci_vtcon_sock_add(struct pci_vtcon_softc *sc, const c goto out; } +#ifndef WITHOUT_CAPSICUM + cap_rights_init(&rights, CAP_ACCEPT, CAP_EVENT, CAP_READ, CAP_WRITE); + if (cap_rights_limit(s, &rights) == -1 && errno != ENOSYS) + errx(EX_OSERR, "Unable to apply rights for sandbox"); +#endif sock->vss_port = pci_vtcon_port_add(sc, name, pci_vtcon_sock_tx, sock); if (sock->vss_port == NULL) { From owner-svn-src-all@freebsd.org Sat Jul 13 00:19:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E67CD15DADA1; Sat, 13 Jul 2019 00:19:58 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8837B9304E; Sat, 13 Jul 2019 00:19:58 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58F921E255; Sat, 13 Jul 2019 00:19:58 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6D0Jw4K015754; Sat, 13 Jul 2019 00:19:58 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6D0JwlU015753; Sat, 13 Jul 2019 00:19:58 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201907130019.x6D0JwlU015753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 13 Jul 2019 00:19:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349960 - head/sys/powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/aim X-SVN-Commit-Revision: 349960 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8837B9304E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 00:19:59 -0000 Author: jhibbits Date: Sat Jul 13 00:19:57 2019 New Revision: 349960 URL: https://svnweb.freebsd.org/changeset/base/349960 Log: Set pcpu curpmap for powerpc64 Summary: If an illegal instruction is encountered on a process running on a powerpc64 kernel it would attempt to sync the cache before retrying the instruction "just in case". However, since curpmap is not set, when moea64_sync_icache() attempts to lock the pmap, it's locking on a NULL pointer, triggering a panic. Fix this by adding a (assumed unnecessary) fallback to curthread's pmap in moea64_sync_icache(). Reported by: alfredo.junior_eldorado.org.br Reviewed by: luporl, alfredo.junior_eldorado.org.br Differential Revision: https://reviews.freebsd.org/D20911 Modified: head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Sat Jul 13 00:12:35 2019 (r349959) +++ head/sys/powerpc/aim/mmu_oea64.c Sat Jul 13 00:19:57 2019 (r349960) @@ -2838,6 +2838,9 @@ moea64_sync_icache(mmu_t mmu, pmap_t pm, vm_offset_t v vm_paddr_t pa; vm_size_t len; + if (__predict_false(pm == NULL)) + pm = &curthread->td_proc->p_vmspace->vm_pmap; + PMAP_LOCK(pm); while (sz > 0) { lim = round_page(va+1); From owner-svn-src-all@freebsd.org Sat Jul 13 00:23:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 235B915DB002; Sat, 13 Jul 2019 00:23:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C28AE934F5; Sat, 13 Jul 2019 00:23:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D8471E3FE; Sat, 13 Jul 2019 00:23:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6D0NNBo020882; Sat, 13 Jul 2019 00:23:23 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6D0NLem020869; Sat, 13 Jul 2019 00:23:21 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201907130023.x6D0NLem020869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 13 Jul 2019 00:23:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349961 - stable/12/usr.sbin/bhyve X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/12/usr.sbin/bhyve X-SVN-Commit-Revision: 349961 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C28AE934F5 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 00:23:24 -0000 Author: jhb Date: Sat Jul 13 00:23:20 2019 New Revision: 349961 URL: https://svnweb.freebsd.org/changeset/base/349961 Log: MFC 343068: Use capsicum_helpers(3) that allow us to simplify the code and its functions will return success when the kernel is built without support of the capability mode. It is important to note, that I'm taking a more conservative approach with these changes and it will be done in small steps. Modified: stable/12/usr.sbin/bhyve/bhyverun.c stable/12/usr.sbin/bhyve/block_if.c stable/12/usr.sbin/bhyve/consport.c stable/12/usr.sbin/bhyve/dbgport.c stable/12/usr.sbin/bhyve/gdb.c stable/12/usr.sbin/bhyve/mevent.c stable/12/usr.sbin/bhyve/pci_e82545.c stable/12/usr.sbin/bhyve/pci_passthru.c stable/12/usr.sbin/bhyve/pci_virtio_console.c stable/12/usr.sbin/bhyve/pci_virtio_net.c stable/12/usr.sbin/bhyve/pci_virtio_rnd.c stable/12/usr.sbin/bhyve/rfb.c stable/12/usr.sbin/bhyve/uart_emul.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/bhyverun.c ============================================================================== --- stable/12/usr.sbin/bhyve/bhyverun.c Sat Jul 13 00:19:57 2019 (r349960) +++ stable/12/usr.sbin/bhyve/bhyverun.c Sat Jul 13 00:23:20 2019 (r349961) @@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -949,15 +948,13 @@ do_open(const char *vmname) #ifndef WITHOUT_CAPSICUM cap_rights_init(&rights, CAP_IOCTL, CAP_MMAP_RW); - if (cap_rights_limit(vm_get_device_fd(ctx), &rights) == -1 && - errno != ENOSYS) + if (caph_rights_limit(vm_get_device_fd(ctx), &rights) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); vm_get_ioctls(&ncmds); cmds = vm_get_ioctls(NULL); if (cmds == NULL) errx(EX_OSERR, "out of memory"); - if (cap_ioctls_limit(vm_get_device_fd(ctx), cmds, ncmds) == -1 && - errno != ENOSYS) + if (caph_ioctls_limit(vm_get_device_fd(ctx), cmds, ncmds) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); free((cap_ioctl_t *)cmds); #endif Modified: stable/12/usr.sbin/bhyve/block_if.c ============================================================================== --- stable/12/usr.sbin/bhyve/block_if.c Sat Jul 13 00:19:57 2019 (r349960) +++ stable/12/usr.sbin/bhyve/block_if.c Sat Jul 13 00:23:20 2019 (r349961) @@ -42,6 +42,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include @@ -473,7 +476,7 @@ blockif_open(const char *optstr, const char *ident) if (ro) cap_rights_clear(&rights, CAP_FSYNC, CAP_WRITE); - if (cap_rights_limit(fd, &rights) == -1 && errno != ENOSYS) + if (caph_rights_limit(fd, &rights) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif @@ -504,7 +507,7 @@ blockif_open(const char *optstr, const char *ident) psectsz = sbuf.st_blksize; #ifndef WITHOUT_CAPSICUM - if (cap_ioctls_limit(fd, cmds, nitems(cmds)) == -1 && errno != ENOSYS) + if (caph_ioctls_limit(fd, cmds, nitems(cmds)) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif Modified: stable/12/usr.sbin/bhyve/consport.c ============================================================================== --- stable/12/usr.sbin/bhyve/consport.c Sat Jul 13 00:19:57 2019 (r349960) +++ stable/12/usr.sbin/bhyve/consport.c Sat Jul 13 00:23:20 2019 (r349961) @@ -37,6 +37,9 @@ __FBSDID("$FreeBSD$"); #endif #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include @@ -138,11 +141,9 @@ console_handler(struct vmctx *ctx, int vcpu, int in, i #ifndef WITHOUT_CAPSICUM cap_rights_init(&rights, CAP_EVENT, CAP_IOCTL, CAP_READ, CAP_WRITE); - if (cap_rights_limit(STDIN_FILENO, &rights) == -1 && - errno != ENOSYS) + if (caph_rights_limit(STDIN_FILENO, &rights) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); - if (cap_ioctls_limit(STDIN_FILENO, cmds, nitems(cmds)) == -1 && - errno != ENOSYS) + if (caph_ioctls_limit(STDIN_FILENO, cmds, nitems(cmds)) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif ttyopen(); Modified: stable/12/usr.sbin/bhyve/dbgport.c ============================================================================== --- stable/12/usr.sbin/bhyve/dbgport.c Sat Jul 13 00:19:57 2019 (r349960) +++ stable/12/usr.sbin/bhyve/dbgport.c Sat Jul 13 00:23:20 2019 (r349961) @@ -40,6 +40,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include @@ -167,7 +170,7 @@ init_dbgport(int sport) #ifndef WITHOUT_CAPSICUM cap_rights_init(&rights, CAP_ACCEPT, CAP_READ, CAP_WRITE); - if (cap_rights_limit(listen_fd, &rights) == -1 && errno != ENOSYS) + if (caph_rights_limit(listen_fd, &rights) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif Modified: stable/12/usr.sbin/bhyve/gdb.c ============================================================================== --- stable/12/usr.sbin/bhyve/gdb.c Sat Jul 13 00:19:57 2019 (r349960) +++ stable/12/usr.sbin/bhyve/gdb.c Sat Jul 13 00:23:20 2019 (r349961) @@ -1252,9 +1252,9 @@ limit_gdb_socket(int s) cap_rights_init(&rights, CAP_ACCEPT, CAP_EVENT, CAP_READ, CAP_WRITE, CAP_SETSOCKOPT, CAP_IOCTL); - if (cap_rights_limit(s, &rights) == -1 && errno != ENOSYS) + if (caph_rights_limit(s, &rights) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); - if (cap_ioctls_limit(s, ioctls, nitems(ioctls)) == -1 && errno != ENOSYS) + if (caph_ioctls_limit(s, ioctls, nitems(ioctls)) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); } #endif Modified: stable/12/usr.sbin/bhyve/mevent.c ============================================================================== --- stable/12/usr.sbin/bhyve/mevent.c Sat Jul 13 00:19:57 2019 (r349960) +++ stable/12/usr.sbin/bhyve/mevent.c Sat Jul 13 00:23:20 2019 (r349961) @@ -37,6 +37,9 @@ __FBSDID("$FreeBSD$"); #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include @@ -420,7 +423,7 @@ mevent_dispatch(void) #ifndef WITHOUT_CAPSICUM cap_rights_init(&rights, CAP_KQUEUE); - if (cap_rights_limit(mfd, &rights) == -1 && errno != ENOSYS) + if (caph_rights_limit(mfd, &rights) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif @@ -437,9 +440,9 @@ mevent_dispatch(void) #ifndef WITHOUT_CAPSICUM cap_rights_init(&rights, CAP_EVENT, CAP_READ, CAP_WRITE); - if (cap_rights_limit(mevent_pipefd[0], &rights) == -1 && errno != ENOSYS) + if (caph_rights_limit(mevent_pipefd[0], &rights) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); - if (cap_rights_limit(mevent_pipefd[1], &rights) == -1 && errno != ENOSYS) + if (caph_rights_limit(mevent_pipefd[1], &rights) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif Modified: stable/12/usr.sbin/bhyve/pci_e82545.c ============================================================================== --- stable/12/usr.sbin/bhyve/pci_e82545.c Sat Jul 13 00:19:57 2019 (r349960) +++ stable/12/usr.sbin/bhyve/pci_e82545.c Sat Jul 13 00:23:20 2019 (r349961) @@ -43,6 +43,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include @@ -2241,7 +2244,7 @@ e82545_open_tap(struct e82545_softc *sc, char *opts) #ifndef WITHOUT_CAPSICUM cap_rights_init(&rights, CAP_EVENT, CAP_READ, CAP_WRITE); - if (cap_rights_limit(sc->esc_tapfd, &rights) == -1 && errno != ENOSYS) + if (caph_rights_limit(sc->esc_tapfd, &rights) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif Modified: stable/12/usr.sbin/bhyve/pci_passthru.c ============================================================================== --- stable/12/usr.sbin/bhyve/pci_passthru.c Sat Jul 13 00:19:57 2019 (r349960) +++ stable/12/usr.sbin/bhyve/pci_passthru.c Sat Jul 13 00:23:20 2019 (r349961) @@ -45,6 +45,9 @@ __FBSDID("$FreeBSD$"); #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include @@ -674,9 +677,9 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *p } #ifndef WITHOUT_CAPSICUM - if (cap_rights_limit(pcifd, &rights) == -1 && errno != ENOSYS) + if (caph_rights_limit(pcifd, &rights) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); - if (cap_ioctls_limit(pcifd, pci_ioctls, nitems(pci_ioctls)) == -1 && errno != ENOSYS) + if (caph_ioctls_limit(pcifd, pci_ioctls, nitems(pci_ioctls)) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif @@ -689,9 +692,9 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *p } #ifndef WITHOUT_CAPSICUM - if (cap_rights_limit(iofd, &rights) == -1 && errno != ENOSYS) + if (caph_rights_limit(iofd, &rights) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); - if (cap_ioctls_limit(iofd, io_ioctls, nitems(io_ioctls)) == -1 && errno != ENOSYS) + if (caph_ioctls_limit(iofd, io_ioctls, nitems(io_ioctls)) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif @@ -706,7 +709,7 @@ passthru_init(struct vmctx *ctx, struct pci_devinst *p #ifndef WITHOUT_CAPSICUM cap_rights_clear(&rights, CAP_IOCTL); cap_rights_set(&rights, CAP_MMAP_RW); - if (cap_rights_limit(memfd, &rights) == -1 && errno != ENOSYS) + if (caph_rights_limit(memfd, &rights) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif Modified: stable/12/usr.sbin/bhyve/pci_virtio_console.c ============================================================================== --- stable/12/usr.sbin/bhyve/pci_virtio_console.c Sat Jul 13 00:19:57 2019 (r349960) +++ stable/12/usr.sbin/bhyve/pci_virtio_console.c Sat Jul 13 00:23:20 2019 (r349961) @@ -43,6 +43,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include @@ -328,7 +331,7 @@ pci_vtcon_sock_add(struct pci_vtcon_softc *sc, const c #ifndef WITHOUT_CAPSICUM cap_rights_init(&rights, CAP_ACCEPT, CAP_EVENT, CAP_READ, CAP_WRITE); - if (cap_rights_limit(s, &rights) == -1 && errno != ENOSYS) + if (caph_rights_limit(s, &rights) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif Modified: stable/12/usr.sbin/bhyve/pci_virtio_net.c ============================================================================== --- stable/12/usr.sbin/bhyve/pci_virtio_net.c Sat Jul 13 00:19:57 2019 (r349960) +++ stable/12/usr.sbin/bhyve/pci_virtio_net.c Sat Jul 13 00:23:20 2019 (r349961) @@ -45,6 +45,9 @@ __FBSDID("$FreeBSD$"); #endif #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include @@ -731,7 +734,7 @@ pci_vtnet_tap_setup(struct pci_vtnet_softc *sc, char * #ifndef WITHOUT_CAPSICUM cap_rights_init(&rights, CAP_EVENT, CAP_READ, CAP_WRITE); - if (cap_rights_limit(sc->vsc_tapfd, &rights) == -1 && errno != ENOSYS) + if (caph_rights_limit(sc->vsc_tapfd, &rights) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif Modified: stable/12/usr.sbin/bhyve/pci_virtio_rnd.c ============================================================================== --- stable/12/usr.sbin/bhyve/pci_virtio_rnd.c Sat Jul 13 00:19:57 2019 (r349960) +++ stable/12/usr.sbin/bhyve/pci_virtio_rnd.c Sat Jul 13 00:23:20 2019 (r349961) @@ -43,6 +43,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include @@ -158,7 +161,7 @@ pci_vtrnd_init(struct vmctx *ctx, struct pci_devinst * #ifndef WITHOUT_CAPSICUM cap_rights_init(&rights, CAP_READ); - if (cap_rights_limit(fd, &rights) == -1 && errno != ENOSYS) + if (caph_rights_limit(fd, &rights) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif Modified: stable/12/usr.sbin/bhyve/rfb.c ============================================================================== --- stable/12/usr.sbin/bhyve/rfb.c Sat Jul 13 00:19:57 2019 (r349960) +++ stable/12/usr.sbin/bhyve/rfb.c Sat Jul 13 00:23:20 2019 (r349961) @@ -45,6 +45,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef WITHOUT_CAPSICUM +#include +#endif #include #include #include @@ -1026,7 +1029,7 @@ rfb_init(char *hostname, int port, int wait, char *pas #ifndef WITHOUT_CAPSICUM cap_rights_init(&rights, CAP_ACCEPT, CAP_EVENT, CAP_READ, CAP_WRITE); - if (cap_rights_limit(rc->sfd, &rights) == -1 && errno != ENOSYS) + if (caph_rights_limit(rc->sfd, &rights) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif Modified: stable/12/usr.sbin/bhyve/uart_emul.c ============================================================================== --- stable/12/usr.sbin/bhyve/uart_emul.c Sat Jul 13 00:19:57 2019 (r349960) +++ stable/12/usr.sbin/bhyve/uart_emul.c Sat Jul 13 00:23:20 2019 (r349961) @@ -684,14 +684,12 @@ uart_set_backend(struct uart_softc *sc, const char *op #ifndef WITHOUT_CAPSICUM cap_rights_init(&rights, CAP_EVENT, CAP_IOCTL, CAP_READ, CAP_WRITE); - if (cap_rights_limit(sc->tty.fd, &rights) == -1 && - errno != ENOSYS) + if (caph_rights_limit(sc->tty.fd, &rights) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); - if (cap_ioctls_limit(sc->tty.fd, cmds, nitems(cmds)) == -1 && - errno != ENOSYS) + if (caph_ioctls_limit(sc->tty.fd, cmds, nitems(cmds)) == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); if (!uart_stdio) { - if (caph_limit_stdin() == -1 && errno != ENOSYS) + if (caph_limit_stdin() == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); } From owner-svn-src-all@freebsd.org Sat Jul 13 00:51:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C71E15DB84B; Sat, 13 Jul 2019 00:51:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A136D94482; Sat, 13 Jul 2019 00:51:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C7761E8A6; Sat, 13 Jul 2019 00:51:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6D0pBbs032096; Sat, 13 Jul 2019 00:51:11 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6D0pBtm032095; Sat, 13 Jul 2019 00:51:11 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201907130051.x6D0pBtm032095@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 13 Jul 2019 00:51:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349962 - in stable: 11/sys/amd64/vmm 12/sys/amd64/vmm X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/amd64/vmm 12/sys/amd64/vmm X-SVN-Commit-Revision: 349962 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A136D94482 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.965,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 00:51:12 -0000 Author: jhb Date: Sat Jul 13 00:51:11 2019 New Revision: 349962 URL: https://svnweb.freebsd.org/changeset/base/349962 Log: MFC 347238: vmm(4): Pass through RDSEED feature bit to guests Modified: stable/12/sys/amd64/vmm/x86.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/amd64/vmm/x86.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/amd64/vmm/x86.c ============================================================================== --- stable/12/sys/amd64/vmm/x86.c Sat Jul 13 00:23:20 2019 (r349961) +++ stable/12/sys/amd64/vmm/x86.c Sat Jul 13 00:51:11 2019 (r349962) @@ -432,6 +432,7 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, CPUID_STDEXT_AVX2 | CPUID_STDEXT_BMI2 | CPUID_STDEXT_ERMS | CPUID_STDEXT_RTM | CPUID_STDEXT_AVX512F | + CPUID_STDEXT_RDSEED | CPUID_STDEXT_AVX512PF | CPUID_STDEXT_AVX512ER | CPUID_STDEXT_AVX512CD | CPUID_STDEXT_SHA); From owner-svn-src-all@freebsd.org Sat Jul 13 00:51:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6088B15DB850; Sat, 13 Jul 2019 00:51:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 045C994484; Sat, 13 Jul 2019 00:51:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE4BC1E8A7; Sat, 13 Jul 2019 00:51:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6D0pBXw032103; Sat, 13 Jul 2019 00:51:11 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6D0pBh2032102; Sat, 13 Jul 2019 00:51:11 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201907130051.x6D0pBh2032102@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 13 Jul 2019 00:51:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349962 - in stable: 11/sys/amd64/vmm 12/sys/amd64/vmm X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/amd64/vmm 12/sys/amd64/vmm X-SVN-Commit-Revision: 349962 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 045C994484 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.965,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 00:51:12 -0000 Author: jhb Date: Sat Jul 13 00:51:11 2019 New Revision: 349962 URL: https://svnweb.freebsd.org/changeset/base/349962 Log: MFC 347238: vmm(4): Pass through RDSEED feature bit to guests Modified: stable/11/sys/amd64/vmm/x86.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/amd64/vmm/x86.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/amd64/vmm/x86.c ============================================================================== --- stable/11/sys/amd64/vmm/x86.c Sat Jul 13 00:23:20 2019 (r349961) +++ stable/11/sys/amd64/vmm/x86.c Sat Jul 13 00:51:11 2019 (r349962) @@ -430,6 +430,7 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, CPUID_STDEXT_AVX2 | CPUID_STDEXT_BMI2 | CPUID_STDEXT_ERMS | CPUID_STDEXT_RTM | CPUID_STDEXT_AVX512F | + CPUID_STDEXT_RDSEED | CPUID_STDEXT_AVX512PF | CPUID_STDEXT_AVX512ER | CPUID_STDEXT_AVX512CD | CPUID_STDEXT_SHA); From owner-svn-src-all@freebsd.org Sat Jul 13 03:02:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D36E15DDF8D; Sat, 13 Jul 2019 03:02:13 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C770368561; Sat, 13 Jul 2019 03:02:12 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A2BFC1FF0F; Sat, 13 Jul 2019 03:02:12 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6D32CBw007468; Sat, 13 Jul 2019 03:02:12 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6D32CEE007467; Sat, 13 Jul 2019 03:02:12 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201907130302.x6D32CEE007467@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 13 Jul 2019 03:02:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349963 - head/sys/powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/aim X-SVN-Commit-Revision: 349963 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C770368561 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 03:02:13 -0000 Author: jhibbits Date: Sat Jul 13 03:02:11 2019 New Revision: 349963 URL: https://svnweb.freebsd.org/changeset/base/349963 Log: powerpc64/pmap: Reduce scope of PV_LOCK in remove path Summary: Since the 'page pv' lock is one of the most highly contended locks, we need to try to do as much work outside of the lock as we can. The moea64_pvo_remove_from_page() path is a low hanging fruit, where we can do some heavy work (PHYS_TO_VM_PAGE()) outside of the lock if needed. In one path, moea64_remove_all(), the PV lock is already held and can't be swizzled, so we provide two ways to perform the locked operation, one that can call PHYS_TO_VM_PAGE outside the lock, and one that calls with the lock already held. Reviewed By: luporl Differential Revision: https://reviews.freebsd.org/D20694 Modified: head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Sat Jul 13 00:51:11 2019 (r349962) +++ head/sys/powerpc/aim/mmu_oea64.c Sat Jul 13 03:02:11 2019 (r349963) @@ -234,6 +234,8 @@ static int moea64_pvo_enter(mmu_t mmu, struct pvo_entr struct pvo_head *pvo_head); static void moea64_pvo_remove_from_pmap(mmu_t mmu, struct pvo_entry *pvo); static void moea64_pvo_remove_from_page(mmu_t mmu, struct pvo_entry *pvo); +static void moea64_pvo_remove_from_page_locked(mmu_t mmu, + struct pvo_entry *pvo); static struct pvo_entry *moea64_pvo_find_va(pmap_t, vm_offset_t); /* @@ -1454,9 +1456,7 @@ moea64_enter(mmu_t mmu, pmap_t pmap, vm_offset_t va, v /* Free any dead pages */ if (oldpvo != NULL) { - PV_LOCK(oldpvo->pvo_pte.pa & LPTE_RPGN); moea64_pvo_remove_from_page(mmu, oldpvo); - PV_UNLOCK(oldpvo->pvo_pte.pa & LPTE_RPGN); free_pvo_entry(oldpvo); } @@ -1877,9 +1877,7 @@ moea64_kenter_attr(mmu_t mmu, vm_offset_t va, vm_paddr /* Free any dead pages */ if (oldpvo != NULL) { - PV_LOCK(oldpvo->pvo_pte.pa & LPTE_RPGN); moea64_pvo_remove_from_page(mmu, oldpvo); - PV_UNLOCK(oldpvo->pvo_pte.pa & LPTE_RPGN); free_pvo_entry(oldpvo); } @@ -2386,9 +2384,7 @@ moea64_remove_pages(mmu_t mmu, pmap_t pm) PMAP_UNLOCK(pm); RB_FOREACH_SAFE(pvo, pvo_tree, &tofree, tpvo) { - PV_LOCK(pvo->pvo_pte.pa & LPTE_RPGN); moea64_pvo_remove_from_page(mmu, pvo); - PV_UNLOCK(pvo->pvo_pte.pa & LPTE_RPGN); RB_REMOVE(pvo_tree, &tofree, pvo); free_pvo_entry(pvo); } @@ -2429,9 +2425,7 @@ moea64_remove(mmu_t mmu, pmap_t pm, vm_offset_t sva, v PMAP_UNLOCK(pm); RB_FOREACH_SAFE(pvo, pvo_tree, &tofree, tpvo) { - PV_LOCK(pvo->pvo_pte.pa & LPTE_RPGN); moea64_pvo_remove_from_page(mmu, pvo); - PV_UNLOCK(pvo->pvo_pte.pa & LPTE_RPGN); RB_REMOVE(pvo_tree, &tofree, pvo); free_pvo_entry(pvo); } @@ -2458,7 +2452,7 @@ moea64_remove_all(mmu_t mmu, vm_page_t m) wasdead = (pvo->pvo_vaddr & PVO_DEAD); if (!wasdead) moea64_pvo_remove_from_pmap(mmu, pvo); - moea64_pvo_remove_from_page(mmu, pvo); + moea64_pvo_remove_from_page_locked(mmu, pvo); if (!wasdead) LIST_INSERT_HEAD(&freequeue, pvo, pvo_vlink); PMAP_UNLOCK(pmap); @@ -2631,10 +2625,10 @@ moea64_pvo_remove_from_pmap(mmu_t mmu, struct pvo_entr } } -static void -moea64_pvo_remove_from_page(mmu_t mmu, struct pvo_entry *pvo) +static inline void +_moea64_pvo_remove_from_page_locked(mmu_t mmu, struct pvo_entry *pvo, + vm_page_t m) { - struct vm_page *pg; KASSERT(pvo->pvo_vaddr & PVO_DEAD, ("Trying to delink live page")); @@ -2648,18 +2642,40 @@ moea64_pvo_remove_from_page(mmu_t mmu, struct pvo_entr */ PV_LOCKASSERT(pvo->pvo_pte.pa & LPTE_RPGN); if (pvo->pvo_vaddr & PVO_MANAGED) { - pg = PHYS_TO_VM_PAGE(pvo->pvo_pte.pa & LPTE_RPGN); - - if (pg != NULL) { + if (m != NULL) { LIST_REMOVE(pvo, pvo_vlink); - if (LIST_EMPTY(vm_page_to_pvoh(pg))) - vm_page_aflag_clear(pg, + if (LIST_EMPTY(vm_page_to_pvoh(m))) + vm_page_aflag_clear(m, PGA_WRITEABLE | PGA_EXECUTABLE); } } moea64_pvo_entries--; moea64_pvo_remove_calls++; +} + +static void +moea64_pvo_remove_from_page_locked(mmu_t mmu, struct pvo_entry *pvo) +{ + vm_page_t pg = NULL; + + if (pvo->pvo_vaddr & PVO_MANAGED) + pg = PHYS_TO_VM_PAGE(pvo->pvo_pte.pa & LPTE_RPGN); + + _moea64_pvo_remove_from_page_locked(mmu, pvo, pg); +} + +static void +moea64_pvo_remove_from_page(mmu_t mmu, struct pvo_entry *pvo) +{ + vm_page_t pg = NULL; + + if (pvo->pvo_vaddr & PVO_MANAGED) + pg = PHYS_TO_VM_PAGE(pvo->pvo_pte.pa & LPTE_RPGN); + + PV_LOCK(pvo->pvo_pte.pa & LPTE_RPGN); + _moea64_pvo_remove_from_page_locked(mmu, pvo, pg); + PV_UNLOCK(pvo->pvo_pte.pa & LPTE_RPGN); } static struct pvo_entry * From owner-svn-src-all@freebsd.org Sat Jul 13 03:22:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 054AB15DE5A6; Sat, 13 Jul 2019 03:22:30 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9CAE76A509; Sat, 13 Jul 2019 03:22:29 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 782A5202BC; Sat, 13 Jul 2019 03:22:29 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6D3MTsj020110; Sat, 13 Jul 2019 03:22:29 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6D3MT0R020108; Sat, 13 Jul 2019 03:22:29 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907130322.x6D3MT0R020108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 13 Jul 2019 03:22:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349964 - head/sbin/camcontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/camcontrol X-SVN-Commit-Revision: 349964 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9CAE76A509 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 03:22:30 -0000 Author: imp Date: Sat Jul 13 03:22:28 2019 New Revision: 349964 URL: https://svnweb.freebsd.org/changeset/base/349964 Log: Add device type NVME and device type MMCSD to get_device_type For completeness, add nvme and mmc/sd devices to the list of device types we know. Modified: head/sbin/camcontrol/camcontrol.c head/sbin/camcontrol/camcontrol.h Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Sat Jul 13 03:02:11 2019 (r349963) +++ head/sbin/camcontrol/camcontrol.c Sat Jul 13 03:22:28 2019 (r349964) @@ -5366,6 +5366,14 @@ get_device_type(struct cam_device *dev, int retry_coun *devtype = CC_DT_ATA; goto bailout; break; /*NOTREACHED*/ + case PROTO_NVME: + *devtype = CC_DT_NVME; + goto bailout; + break; /*NOTREACHED*/ + case PROTO_MMCSD: + *devtype = CC_DT_MMCSD; + goto bailout; + break; /*NOTREACHED*/ default: *devtype = CC_DT_UNKNOWN; goto bailout; Modified: head/sbin/camcontrol/camcontrol.h ============================================================================== --- head/sbin/camcontrol/camcontrol.h Sat Jul 13 03:02:11 2019 (r349963) +++ head/sbin/camcontrol/camcontrol.h Sat Jul 13 03:22:28 2019 (r349964) @@ -44,6 +44,8 @@ typedef enum { CC_DT_SCSI, CC_DT_ATA_BEHIND_SCSI, CC_DT_ATA, + CC_DT_NVME, + CC_DT_MMCSD, CC_DT_UNKNOWN } camcontrol_devtype; From owner-svn-src-all@freebsd.org Sat Jul 13 03:39:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC34D15DE94E; Sat, 13 Jul 2019 03:39:47 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4065E6AC62; Sat, 13 Jul 2019 03:39:47 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F167720475; Sat, 13 Jul 2019 03:39:46 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6D3dkg0026075; Sat, 13 Jul 2019 03:39:46 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6D3dk6N026074; Sat, 13 Jul 2019 03:39:46 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201907130339.x6D3dk6N026074@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 13 Jul 2019 03:39:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349965 - head/sys/powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/aim X-SVN-Commit-Revision: 349965 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4065E6AC62 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 03:39:47 -0000 Author: jhibbits Date: Sat Jul 13 03:39:46 2019 New Revision: 349965 URL: https://svnweb.freebsd.org/changeset/base/349965 Log: powerpc64/pmap: No need for moea64_pvo_remove_from_page_locked() wrapper The only consumer of moea64_pvo_remove_from_page_locked() already has the page in hand, so there is no need to search for the page while holding the lock. Drop the wrapper, and rename _moea64_pvo_remove_from_page_locked(). Reported by: alc Modified: head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Sat Jul 13 03:22:28 2019 (r349964) +++ head/sys/powerpc/aim/mmu_oea64.c Sat Jul 13 03:39:46 2019 (r349965) @@ -235,7 +235,7 @@ static int moea64_pvo_enter(mmu_t mmu, struct pvo_entr static void moea64_pvo_remove_from_pmap(mmu_t mmu, struct pvo_entry *pvo); static void moea64_pvo_remove_from_page(mmu_t mmu, struct pvo_entry *pvo); static void moea64_pvo_remove_from_page_locked(mmu_t mmu, - struct pvo_entry *pvo); + struct pvo_entry *pvo, vm_page_t m); static struct pvo_entry *moea64_pvo_find_va(pmap_t, vm_offset_t); /* @@ -2452,7 +2452,7 @@ moea64_remove_all(mmu_t mmu, vm_page_t m) wasdead = (pvo->pvo_vaddr & PVO_DEAD); if (!wasdead) moea64_pvo_remove_from_pmap(mmu, pvo); - moea64_pvo_remove_from_page_locked(mmu, pvo); + moea64_pvo_remove_from_page_locked(mmu, pvo, m); if (!wasdead) LIST_INSERT_HEAD(&freequeue, pvo, pvo_vlink); PMAP_UNLOCK(pmap); @@ -2626,7 +2626,7 @@ moea64_pvo_remove_from_pmap(mmu_t mmu, struct pvo_entr } static inline void -_moea64_pvo_remove_from_page_locked(mmu_t mmu, struct pvo_entry *pvo, +moea64_pvo_remove_from_page_locked(mmu_t mmu, struct pvo_entry *pvo, vm_page_t m) { @@ -2655,17 +2655,6 @@ _moea64_pvo_remove_from_page_locked(mmu_t mmu, struct } static void -moea64_pvo_remove_from_page_locked(mmu_t mmu, struct pvo_entry *pvo) -{ - vm_page_t pg = NULL; - - if (pvo->pvo_vaddr & PVO_MANAGED) - pg = PHYS_TO_VM_PAGE(pvo->pvo_pte.pa & LPTE_RPGN); - - _moea64_pvo_remove_from_page_locked(mmu, pvo, pg); -} - -static void moea64_pvo_remove_from_page(mmu_t mmu, struct pvo_entry *pvo) { vm_page_t pg = NULL; @@ -2674,7 +2663,7 @@ moea64_pvo_remove_from_page(mmu_t mmu, struct pvo_entr pg = PHYS_TO_VM_PAGE(pvo->pvo_pte.pa & LPTE_RPGN); PV_LOCK(pvo->pvo_pte.pa & LPTE_RPGN); - _moea64_pvo_remove_from_page_locked(mmu, pvo, pg); + moea64_pvo_remove_from_page_locked(mmu, pvo, pg); PV_UNLOCK(pvo->pvo_pte.pa & LPTE_RPGN); } From owner-svn-src-all@freebsd.org Sat Jul 13 08:08:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9378615E3342; Sat, 13 Jul 2019 08:08:26 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 244B973668; Sat, 13 Jul 2019 08:08:26 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F2709231BB; Sat, 13 Jul 2019 08:08:25 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6D88Pte085343; Sat, 13 Jul 2019 08:08:25 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6D88PH2085342; Sat, 13 Jul 2019 08:08:25 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201907130808.x6D88PH2085342@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Sat, 13 Jul 2019 08:08:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349966 - head/sys/dev/netmap X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/sys/dev/netmap X-SVN-Commit-Revision: 349966 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 244B973668 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.90 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.90)[-0.899,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 08:08:26 -0000 Author: vmaffione Date: Sat Jul 13 08:08:25 2019 New Revision: 349966 URL: https://svnweb.freebsd.org/changeset/base/349966 Log: netmap: fix bug introduced by r349752 r349752 introduced a NULL pointer reference bug in the emulated netmap code. Reported by: lwhsu MFC after: 3 days Modified: head/sys/dev/netmap/netmap_generic.c Modified: head/sys/dev/netmap/netmap_generic.c ============================================================================== --- head/sys/dev/netmap/netmap_generic.c Sat Jul 13 03:39:46 2019 (r349965) +++ head/sys/dev/netmap/netmap_generic.c Sat Jul 13 08:08:25 2019 (r349966) @@ -1126,7 +1126,8 @@ generic_netmap_attach(struct ifnet *ifp) nm_os_generic_set_features(gna); - nm_prinf("Emulated adapter for %s created (prev was %s)", na->name, gna->prev->name); + nm_prinf("Emulated adapter for %s created (prev was %s)", na->name, + gna->prev ? gna->prev->name : "NULL"); return retval; } From owner-svn-src-all@freebsd.org Sat Jul 13 10:46:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6F4C15E5FDF; Sat, 13 Jul 2019 10:46:02 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8434381157; Sat, 13 Jul 2019 10:46:02 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 56DA624BD2; Sat, 13 Jul 2019 10:46:02 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6DAk2Ix079747; Sat, 13 Jul 2019 10:46:02 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6DAk1EY079745; Sat, 13 Jul 2019 10:46:01 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201907131046.x6DAk1EY079745@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 13 Jul 2019 10:46:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349967 - in stable: 11 11/contrib/llvm/tools/clang/include/clang/AST 12/contrib/llvm/tools/clang/include/clang/AST X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11 11/contrib/llvm/tools/clang/include/clang/AST 12/contrib/llvm/tools/clang/include/clang/AST X-SVN-Commit-Revision: 349967 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8434381157 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.943,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 10:46:03 -0000 Author: dim Date: Sat Jul 13 10:46:01 2019 New Revision: 349967 URL: https://svnweb.freebsd.org/changeset/base/349967 Log: MFC r349876: Apply a workaround to be able to build clang 8.0.0 headers with clang 3.4.1, which is still in the stable/10 branch. It looks like clang 3.4.1 implements static_asserts by instantiating a temporary static object, and if those are in an anonymous union, it results in "error: anonymous union can only contain non-static data members". To work around this implementation limitation, move the static_asserts in question out of the anonymous unions. This should make building the latest stable/11 from stable/10 possible again. Reported by: Mike Tancsa Modified: stable/12/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h stable/12/contrib/llvm/tools/clang/include/clang/AST/Type.h Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/UPDATING stable/11/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h stable/11/contrib/llvm/tools/clang/include/clang/AST/Type.h Directory Properties: stable/11/ (props changed) Modified: stable/12/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h ============================================================================== --- stable/12/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h Sat Jul 13 08:08:25 2019 (r349966) +++ stable/12/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h Sat Jul 13 10:46:01 2019 (r349967) @@ -1696,30 +1696,30 @@ class DeclContext { (protected) ObjCContainerDeclBitfields ObjCContainerDeclBits; LinkageSpecDeclBitfields LinkageSpecDeclBits; BlockDeclBitfields BlockDeclBits; - - static_assert(sizeof(DeclContextBitfields) <= 8, - "DeclContextBitfields is larger than 8 bytes!"); - static_assert(sizeof(TagDeclBitfields) <= 8, - "TagDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(EnumDeclBitfields) <= 8, - "EnumDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(RecordDeclBitfields) <= 8, - "RecordDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(OMPDeclareReductionDeclBitfields) <= 8, - "OMPDeclareReductionDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(FunctionDeclBitfields) <= 8, - "FunctionDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(CXXConstructorDeclBitfields) <= 8, - "CXXConstructorDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(ObjCMethodDeclBitfields) <= 8, - "ObjCMethodDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(ObjCContainerDeclBitfields) <= 8, - "ObjCContainerDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(LinkageSpecDeclBitfields) <= 8, - "LinkageSpecDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(BlockDeclBitfields) <= 8, - "BlockDeclBitfields is larger than 8 bytes!"); }; + + static_assert(sizeof(DeclContextBitfields) <= 8, + "DeclContextBitfields is larger than 8 bytes!"); + static_assert(sizeof(TagDeclBitfields) <= 8, + "TagDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(EnumDeclBitfields) <= 8, + "EnumDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(RecordDeclBitfields) <= 8, + "RecordDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(OMPDeclareReductionDeclBitfields) <= 8, + "OMPDeclareReductionDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(FunctionDeclBitfields) <= 8, + "FunctionDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(CXXConstructorDeclBitfields) <= 8, + "CXXConstructorDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(ObjCMethodDeclBitfields) <= 8, + "ObjCMethodDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(ObjCContainerDeclBitfields) <= 8, + "ObjCContainerDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(LinkageSpecDeclBitfields) <= 8, + "LinkageSpecDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(BlockDeclBitfields) <= 8, + "BlockDeclBitfields is larger than 8 bytes!"); /// FirstDecl - The first declaration stored within this declaration /// context. Modified: stable/12/contrib/llvm/tools/clang/include/clang/AST/Type.h ============================================================================== --- stable/12/contrib/llvm/tools/clang/include/clang/AST/Type.h Sat Jul 13 08:08:25 2019 (r349966) +++ stable/12/contrib/llvm/tools/clang/include/clang/AST/Type.h Sat Jul 13 10:46:01 2019 (r349967) @@ -1720,41 +1720,41 @@ class Type : public ExtQualsTypeCommonBase { (protecte DependentTemplateSpecializationTypeBitfields DependentTemplateSpecializationTypeBits; PackExpansionTypeBitfields PackExpansionTypeBits; - - static_assert(sizeof(TypeBitfields) <= 8, - "TypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(ArrayTypeBitfields) <= 8, - "ArrayTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(AttributedTypeBitfields) <= 8, - "AttributedTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(AutoTypeBitfields) <= 8, - "AutoTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(BuiltinTypeBitfields) <= 8, - "BuiltinTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(FunctionTypeBitfields) <= 8, - "FunctionTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(ObjCObjectTypeBitfields) <= 8, - "ObjCObjectTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(ReferenceTypeBitfields) <= 8, - "ReferenceTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(TypeWithKeywordBitfields) <= 8, - "TypeWithKeywordBitfields is larger than 8 bytes!"); - static_assert(sizeof(ElaboratedTypeBitfields) <= 8, - "ElaboratedTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(VectorTypeBitfields) <= 8, - "VectorTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(SubstTemplateTypeParmPackTypeBitfields) <= 8, - "SubstTemplateTypeParmPackTypeBitfields is larger" - " than 8 bytes!"); - static_assert(sizeof(TemplateSpecializationTypeBitfields) <= 8, - "TemplateSpecializationTypeBitfields is larger" - " than 8 bytes!"); - static_assert(sizeof(DependentTemplateSpecializationTypeBitfields) <= 8, - "DependentTemplateSpecializationTypeBitfields is larger" - " than 8 bytes!"); - static_assert(sizeof(PackExpansionTypeBitfields) <= 8, - "PackExpansionTypeBitfields is larger than 8 bytes"); }; + + static_assert(sizeof(TypeBitfields) <= 8, + "TypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(ArrayTypeBitfields) <= 8, + "ArrayTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(AttributedTypeBitfields) <= 8, + "AttributedTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(AutoTypeBitfields) <= 8, + "AutoTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(BuiltinTypeBitfields) <= 8, + "BuiltinTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(FunctionTypeBitfields) <= 8, + "FunctionTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(ObjCObjectTypeBitfields) <= 8, + "ObjCObjectTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(ReferenceTypeBitfields) <= 8, + "ReferenceTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(TypeWithKeywordBitfields) <= 8, + "TypeWithKeywordBitfields is larger than 8 bytes!"); + static_assert(sizeof(ElaboratedTypeBitfields) <= 8, + "ElaboratedTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(VectorTypeBitfields) <= 8, + "VectorTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(SubstTemplateTypeParmPackTypeBitfields) <= 8, + "SubstTemplateTypeParmPackTypeBitfields is larger" + " than 8 bytes!"); + static_assert(sizeof(TemplateSpecializationTypeBitfields) <= 8, + "TemplateSpecializationTypeBitfields is larger" + " than 8 bytes!"); + static_assert(sizeof(DependentTemplateSpecializationTypeBitfields) <= 8, + "DependentTemplateSpecializationTypeBitfields is larger" + " than 8 bytes!"); + static_assert(sizeof(PackExpansionTypeBitfields) <= 8, + "PackExpansionTypeBitfields is larger than 8 bytes"); private: template friend class TypePropertyCache; From owner-svn-src-all@freebsd.org Sat Jul 13 10:46:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E7E415E5FE3; Sat, 13 Jul 2019 10:46:03 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2C89181158; Sat, 13 Jul 2019 10:46:03 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 06B0524BD3; Sat, 13 Jul 2019 10:46:03 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6DAk2NJ079755; Sat, 13 Jul 2019 10:46:02 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6DAk2cN079753; Sat, 13 Jul 2019 10:46:02 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201907131046.x6DAk2cN079753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 13 Jul 2019 10:46:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r349967 - in stable: 11 11/contrib/llvm/tools/clang/include/clang/AST 12/contrib/llvm/tools/clang/include/clang/AST X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11 11/contrib/llvm/tools/clang/include/clang/AST 12/contrib/llvm/tools/clang/include/clang/AST X-SVN-Commit-Revision: 349967 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2C89181158 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.94)[-0.943,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 10:46:03 -0000 Author: dim Date: Sat Jul 13 10:46:01 2019 New Revision: 349967 URL: https://svnweb.freebsd.org/changeset/base/349967 Log: MFC r349876: Apply a workaround to be able to build clang 8.0.0 headers with clang 3.4.1, which is still in the stable/10 branch. It looks like clang 3.4.1 implements static_asserts by instantiating a temporary static object, and if those are in an anonymous union, it results in "error: anonymous union can only contain non-static data members". To work around this implementation limitation, move the static_asserts in question out of the anonymous unions. This should make building the latest stable/11 from stable/10 possible again. Reported by: Mike Tancsa Modified: stable/11/UPDATING stable/11/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h stable/11/contrib/llvm/tools/clang/include/clang/AST/Type.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h stable/12/contrib/llvm/tools/clang/include/clang/AST/Type.h Directory Properties: stable/12/ (props changed) Modified: stable/11/UPDATING ============================================================================== --- stable/11/UPDATING Sat Jul 13 08:08:25 2019 (r349966) +++ stable/11/UPDATING Sat Jul 13 10:46:01 2019 (r349967) @@ -25,9 +25,8 @@ from older version of current across the gcc/clang cut 20190416: Clang, llvm, lld, lldb, compiler-rt and libc++ have been upgraded to 8.0.0. Please see the 20141231 entry below for information about - prerequisites and upgrading, if you are not already using clang 3.5.0 or - higher. RELENG_10 still has 3.4.1, so you should upgrade to r346291 - first if you are upgrading from 10.x. + prerequisites and upgrading, if you are not already using clang 3.5.0 + or higher. 20190226: geom_uzip(4) depends on the new module xz. If geom_uzip is statically Modified: stable/11/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h ============================================================================== --- stable/11/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h Sat Jul 13 08:08:25 2019 (r349966) +++ stable/11/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h Sat Jul 13 10:46:01 2019 (r349967) @@ -1696,30 +1696,30 @@ class DeclContext { (protected) ObjCContainerDeclBitfields ObjCContainerDeclBits; LinkageSpecDeclBitfields LinkageSpecDeclBits; BlockDeclBitfields BlockDeclBits; - - static_assert(sizeof(DeclContextBitfields) <= 8, - "DeclContextBitfields is larger than 8 bytes!"); - static_assert(sizeof(TagDeclBitfields) <= 8, - "TagDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(EnumDeclBitfields) <= 8, - "EnumDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(RecordDeclBitfields) <= 8, - "RecordDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(OMPDeclareReductionDeclBitfields) <= 8, - "OMPDeclareReductionDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(FunctionDeclBitfields) <= 8, - "FunctionDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(CXXConstructorDeclBitfields) <= 8, - "CXXConstructorDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(ObjCMethodDeclBitfields) <= 8, - "ObjCMethodDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(ObjCContainerDeclBitfields) <= 8, - "ObjCContainerDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(LinkageSpecDeclBitfields) <= 8, - "LinkageSpecDeclBitfields is larger than 8 bytes!"); - static_assert(sizeof(BlockDeclBitfields) <= 8, - "BlockDeclBitfields is larger than 8 bytes!"); }; + + static_assert(sizeof(DeclContextBitfields) <= 8, + "DeclContextBitfields is larger than 8 bytes!"); + static_assert(sizeof(TagDeclBitfields) <= 8, + "TagDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(EnumDeclBitfields) <= 8, + "EnumDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(RecordDeclBitfields) <= 8, + "RecordDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(OMPDeclareReductionDeclBitfields) <= 8, + "OMPDeclareReductionDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(FunctionDeclBitfields) <= 8, + "FunctionDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(CXXConstructorDeclBitfields) <= 8, + "CXXConstructorDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(ObjCMethodDeclBitfields) <= 8, + "ObjCMethodDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(ObjCContainerDeclBitfields) <= 8, + "ObjCContainerDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(LinkageSpecDeclBitfields) <= 8, + "LinkageSpecDeclBitfields is larger than 8 bytes!"); + static_assert(sizeof(BlockDeclBitfields) <= 8, + "BlockDeclBitfields is larger than 8 bytes!"); /// FirstDecl - The first declaration stored within this declaration /// context. Modified: stable/11/contrib/llvm/tools/clang/include/clang/AST/Type.h ============================================================================== --- stable/11/contrib/llvm/tools/clang/include/clang/AST/Type.h Sat Jul 13 08:08:25 2019 (r349966) +++ stable/11/contrib/llvm/tools/clang/include/clang/AST/Type.h Sat Jul 13 10:46:01 2019 (r349967) @@ -1720,41 +1720,41 @@ class Type : public ExtQualsTypeCommonBase { (protecte DependentTemplateSpecializationTypeBitfields DependentTemplateSpecializationTypeBits; PackExpansionTypeBitfields PackExpansionTypeBits; - - static_assert(sizeof(TypeBitfields) <= 8, - "TypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(ArrayTypeBitfields) <= 8, - "ArrayTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(AttributedTypeBitfields) <= 8, - "AttributedTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(AutoTypeBitfields) <= 8, - "AutoTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(BuiltinTypeBitfields) <= 8, - "BuiltinTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(FunctionTypeBitfields) <= 8, - "FunctionTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(ObjCObjectTypeBitfields) <= 8, - "ObjCObjectTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(ReferenceTypeBitfields) <= 8, - "ReferenceTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(TypeWithKeywordBitfields) <= 8, - "TypeWithKeywordBitfields is larger than 8 bytes!"); - static_assert(sizeof(ElaboratedTypeBitfields) <= 8, - "ElaboratedTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(VectorTypeBitfields) <= 8, - "VectorTypeBitfields is larger than 8 bytes!"); - static_assert(sizeof(SubstTemplateTypeParmPackTypeBitfields) <= 8, - "SubstTemplateTypeParmPackTypeBitfields is larger" - " than 8 bytes!"); - static_assert(sizeof(TemplateSpecializationTypeBitfields) <= 8, - "TemplateSpecializationTypeBitfields is larger" - " than 8 bytes!"); - static_assert(sizeof(DependentTemplateSpecializationTypeBitfields) <= 8, - "DependentTemplateSpecializationTypeBitfields is larger" - " than 8 bytes!"); - static_assert(sizeof(PackExpansionTypeBitfields) <= 8, - "PackExpansionTypeBitfields is larger than 8 bytes"); }; + + static_assert(sizeof(TypeBitfields) <= 8, + "TypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(ArrayTypeBitfields) <= 8, + "ArrayTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(AttributedTypeBitfields) <= 8, + "AttributedTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(AutoTypeBitfields) <= 8, + "AutoTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(BuiltinTypeBitfields) <= 8, + "BuiltinTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(FunctionTypeBitfields) <= 8, + "FunctionTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(ObjCObjectTypeBitfields) <= 8, + "ObjCObjectTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(ReferenceTypeBitfields) <= 8, + "ReferenceTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(TypeWithKeywordBitfields) <= 8, + "TypeWithKeywordBitfields is larger than 8 bytes!"); + static_assert(sizeof(ElaboratedTypeBitfields) <= 8, + "ElaboratedTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(VectorTypeBitfields) <= 8, + "VectorTypeBitfields is larger than 8 bytes!"); + static_assert(sizeof(SubstTemplateTypeParmPackTypeBitfields) <= 8, + "SubstTemplateTypeParmPackTypeBitfields is larger" + " than 8 bytes!"); + static_assert(sizeof(TemplateSpecializationTypeBitfields) <= 8, + "TemplateSpecializationTypeBitfields is larger" + " than 8 bytes!"); + static_assert(sizeof(DependentTemplateSpecializationTypeBitfields) <= 8, + "DependentTemplateSpecializationTypeBitfields is larger" + " than 8 bytes!"); + static_assert(sizeof(PackExpansionTypeBitfields) <= 8, + "PackExpansionTypeBitfields is larger than 8 bytes"); private: template friend class TypePropertyCache; From owner-svn-src-all@freebsd.org Sat Jul 13 12:45:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26DAE15E8998; Sat, 13 Jul 2019 12:45:10 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BBFFB850A2; Sat, 13 Jul 2019 12:45:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 57A1625FF7; Sat, 13 Jul 2019 12:45:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6DCj90d050355; Sat, 13 Jul 2019 12:45:09 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6DCj9iK050354; Sat, 13 Jul 2019 12:45:09 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201907131245.x6DCj9iK050354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 13 Jul 2019 12:45:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349968 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 349968 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BBFFB850A2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 12:45:10 -0000 Author: tuexen Date: Sat Jul 13 12:45:08 2019 New Revision: 349968 URL: https://svnweb.freebsd.org/changeset/base/349968 Log: r348494 fixes a race in udp_output(). The same race exists in udp_output6(), therefore apply a similar patch to IPv6. Reported by: syzbot+c5ffbc8f14294c7b0e54@syzkaller.appspotmail.com Reviewed by: bz@, markj@ MFC after: 2 weeks Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D20936 Modified: head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Sat Jul 13 10:46:01 2019 (r349967) +++ head/sys/netinet6/udp6_usrreq.c Sat Jul 13 12:45:08 2019 (r349968) @@ -742,9 +742,24 @@ udp6_output(struct socket *so, int flags_arg, struct m * - when we are not bound to an address and source port (it is * in6_pcbsetport() which will require the write lock). */ +retry: if (sin6 == NULL || (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) && inp->inp_lport == 0)) { INP_WLOCK(inp); + /* + * In case we lost a race and another thread bound addr/port + * on the inp we cannot keep the wlock (which still would be + * fine) as further down, based on these values we make + * decisions for the pcbinfo lock. If the locks are not in + * synch the assertions on unlock will fire, hence we go for + * one retry loop. + */ + if (sin6 != NULL && + (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) || + inp->inp_lport != 0)) { + INP_WUNLOCK(inp); + goto retry; + } unlock_inp = UH_WLOCKED; } else { INP_RLOCK(inp); From owner-svn-src-all@freebsd.org Sat Jul 13 12:48:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C2C715E8A38; Sat, 13 Jul 2019 12:48:30 +0000 (UTC) (envelope-from chuck@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9F33385273; Sat, 13 Jul 2019 12:48:29 +0000 (UTC) (envelope-from chuck@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F6BE25FFF; Sat, 13 Jul 2019 12:48:29 +0000 (UTC) (envelope-from chuck@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6DCmTT8050523; Sat, 13 Jul 2019 12:48:29 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6DCmTgG050521; Sat, 13 Jul 2019 12:48:29 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <201907131248.x6DCmTgG050521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Sat, 13 Jul 2019 12:48:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349969 - in head: sys/net usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: in head: sys/net usr.sbin/bhyve X-SVN-Commit-Revision: 349969 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9F33385273 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.962,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 12:48:30 -0000 Author: chuck Date: Sat Jul 13 12:48:28 2019 New Revision: 349969 URL: https://svnweb.freebsd.org/changeset/base/349969 Log: bhyve: Create EUI64 for NVMe namespaces Accept an IEEE Extended Unique Identifier (EUI-64) from the command line for each NVMe namespace. If one isn't provided, it will create one based on the CRC16 of: - the FreeBSD IEEE OUI - PCI bus, device/slot, function values - Namespace ID Reviewed by: imp, araujo, jhb, rgrimes Approved by: imp (mentor), jhb (maintainer) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D19905 Modified: head/sys/net/ieee_oui.h head/usr.sbin/bhyve/pci_nvme.c Modified: head/sys/net/ieee_oui.h ============================================================================== --- head/sys/net/ieee_oui.h Sat Jul 13 12:45:08 2019 (r349968) +++ head/sys/net/ieee_oui.h Sat Jul 13 12:48:28 2019 (r349969) @@ -77,4 +77,9 @@ */ #define OUI_FREEBSD_GENERATED_MASK 0x10ffff #define OUI_FREEBSD_GENERATED_LOW OUI_FREEBSD(0x100000) -#define OUI_FREEBSD_GENERATED_HIGH OUI_FREEBSD(OU_FREEBSD_GENERATED_MASK) +#define OUI_FREEBSD_GENERATED_HIGH OUI_FREEBSD(OUI_FREEBSD_GENERATED_MASK) + +/* Allocate 16 bits for emulated NVMe devices */ +#define OUI_FREEBSD_NVME_MASK 0x20ffff +#define OUI_FREEBSD_NVME_LOW OUI_FREEBSD(0x200000) +#define OUI_FRREBSD_NVME_HIGH OUI_FREEBSD(OUI_FREEBSD_NVME_MASK) Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Sat Jul 13 12:45:08 2019 (r349968) +++ head/usr.sbin/bhyve/pci_nvme.c Sat Jul 13 12:48:28 2019 (r349969) @@ -4,6 +4,9 @@ * Copyright (c) 2017 Shunsuke Mie * Copyright (c) 2018 Leon Dang * + * Function crc16 Copyright (c) 2017, Fedor Uporov + * Obtained from function ext2_crc16() in sys/fs/ext2fs/ext2_csum.c + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -30,7 +33,7 @@ * bhyve PCIe-NVMe device emulation. * * options: - * -s ,nvme,devpath,maxq=#,qsz=#,ioslots=#,sectsz=#,ser=A-Z + * -s ,nvme,devpath,maxq=#,qsz=#,ioslots=#,sectsz=#,ser=A-Z,eui64=# * * accepted devpath: * /dev/blockdev @@ -42,6 +45,7 @@ * ioslots = max number of concurrent io requests * sectsz = sector size (defaults to blockif sector size) * ser = serial number (20-chars max) + * eui64 = IEEE Extended Unique Identifier (8 byte value) * */ @@ -54,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include @@ -164,6 +169,7 @@ struct pci_nvme_blockstore { uint64_t size; uint32_t sectsz; uint32_t sectsz_bits; + uint64_t eui64; }; struct pci_nvme_ioreq { @@ -352,23 +358,87 @@ pci_nvme_init_ctrldata(struct pci_nvme_softc *sc) cd->power_state[0].mp = 10; } -static void -pci_nvme_init_nsdata(struct pci_nvme_softc *sc) +/* + * Calculate the CRC-16 of the given buffer + * See copyright attribution at top of file + */ +static uint16_t +crc16(uint16_t crc, const void *buffer, unsigned int len) { - struct nvme_namespace_data *nd; + const unsigned char *cp = buffer; + /* CRC table for the CRC-16. The poly is 0x8005 (x16 + x15 + x2 + 1). */ + static uint16_t const crc16_table[256] = { + 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241, + 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440, + 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40, + 0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841, + 0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40, + 0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41, + 0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641, + 0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040, + 0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240, + 0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441, + 0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41, + 0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840, + 0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41, + 0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40, + 0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640, + 0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041, + 0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240, + 0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441, + 0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41, + 0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840, + 0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41, + 0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40, + 0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640, + 0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041, + 0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241, + 0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440, + 0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40, + 0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841, + 0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40, + 0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41, + 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641, + 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040 + }; - nd = &sc->nsdata; + while (len--) + crc = (((crc >> 8) & 0xffU) ^ + crc16_table[(crc ^ *cp++) & 0xffU]) & 0x0000ffffU; + return crc; +} +static void +pci_nvme_init_nsdata(struct pci_nvme_softc *sc, + struct nvme_namespace_data *nd, uint32_t nsid, + uint64_t eui64) +{ + nd->nsze = sc->nvstore.size / sc->nvstore.sectsz; nd->ncap = nd->nsze; nd->nuse = nd->nsze; /* Get LBA and backstore information from backing store */ nd->nlbaf = 0; /* NLBAF is a 0's based value (i.e. 1 LBA Format) */ + nd->flbas = 0; + + /* Create an EUI-64 if user did not provide one */ + if (eui64 == 0) { + char *data = NULL; + + asprintf(&data, "%s%u%u%u", vmname, sc->nsc_pi->pi_bus, + sc->nsc_pi->pi_slot, sc->nsc_pi->pi_func); + + if (data != NULL) { + eui64 = OUI_FREEBSD_NVME_LOW | crc16(0, data, strlen(data)); + free(data); + } + eui64 = (eui64 << 16) | (nsid & 0xffff); + } + be64enc(nd->eui64, eui64); + /* LBA data-sz = 2^lbads */ nd->lbaf[0] = sc->nvstore.sectsz_bits << NVME_NS_DATA_LBAF_LBADS_SHIFT; - - nd->flbas = 0; } static void @@ -1817,6 +1887,8 @@ pci_nvme_parse_opts(struct pci_nvme_softc *sc, char *o free(uopt); return (-1); } + } else if (!strcmp("eui64", xopts)) { + sc->nvstore.eui64 = htobe64(strtoull(config, NULL, 0)); } else if (optidx == 0) { snprintf(bident, sizeof(bident), "%d:%d", sc->nsc_pi->pi_slot, sc->nsc_pi->pi_func); @@ -1937,7 +2009,7 @@ pci_nvme_init(struct vmctx *ctx, struct pci_devinst *p pci_nvme_reset(sc); pci_nvme_init_ctrldata(sc); - pci_nvme_init_nsdata(sc); + pci_nvme_init_nsdata(sc, &sc->nsdata, 1, sc->nvstore.eui64); pci_nvme_init_logpages(sc); pci_lintr_request(pi); From owner-svn-src-all@freebsd.org Sat Jul 13 13:08:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8F0915E8EFA; Sat, 13 Jul 2019 13:08:22 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3013885DD5; Sat, 13 Jul 2019 13:08:22 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: by mail-ed1-x536.google.com with SMTP id v15so11503543eds.9; Sat, 13 Jul 2019 06:08:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=7GyKwOp/lmGL6X2F1ftFXVgc11O4S5xTHnsCGV4biDA=; b=WXVl2RosCb2Vfup91Jad4jMRZXgoS33XfoW4cG+gIfZYPT3CMt1s/XEP06VVmdKX43 IWHyopiN++Xh7HfEpWODugstvV8nXjepHRU5c0/1PWz9H+0I6qft1y7LQ6WdmiF1KjK4 6vEcrAOUE10o6R/iWpuhffx+t3BHyEMGWE6x0EkT0G2olrfmqXCyAncRjLXbrET4njq6 9rw/yDNEfDPVapdMmzglk71ZoSZhf022DKS5nFne8LDDXBdKHdEcaFsugIgFtI0hA6/K 0ZlPHB5pkhIJ9quEJnKgP/mAhzJi6mq4oPT3P7YnRRlNq9Da9Jh5J8dqAO6tmh5U7ogm wDHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=7GyKwOp/lmGL6X2F1ftFXVgc11O4S5xTHnsCGV4biDA=; b=UiX342pzXC51n3zT/c9Z7mCfjIhDjqR/z/67CY/P1pr+pRjLf5nVRJogrBWsZ1Wzr4 xGKOFc7VFnjeBKKPQILEZNfLrlOIlmtTRd09vleJGA3f1QdznFgqogu7HEIB1dCVQKs7 qgQt5mGdAP3pSEm8C6xsvgxspi+bGt6DEHk2X2INTQZFJLsprJdLQq28SooMHH75QQ5T QNWVKjZ4Ioiouvl6BuDXuGcmKsw64bgGvtRFehChZ+awGwIHV/g+mY8wvNlV9L6xJu4X mvBFyo4uphGmAvoX55y5LXGubOU6nB4eo4kgCd/+BDACOKma1cyY9B8xMmAqyAXZQvUc i61A== X-Gm-Message-State: APjAAAW13p75CRg2X+D41ADL09hn+fuNmo7zgXiRoADlxJ4FSXpPdOkU RxOTK//zmVzevAv9U0Mv0IITJD+W X-Google-Smtp-Source: APXvYqxDPS6AKO9tuCACPiPj08XbYAmW2ogfTwrid/lMmp4GIUtZYehzsg84nw6ntZFP/VGGo/JRHg== X-Received: by 2002:aa7:d30d:: with SMTP id p13mr14496044edq.292.1563023300968; Sat, 13 Jul 2019 06:08:20 -0700 (PDT) Received: from ernst.home (p5B3BE885.dip0.t-ipconnect.de. [91.59.232.133]) by smtp.gmail.com with ESMTPSA id w27sm3628672edw.63.2019.07.13.06.08.19 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 13 Jul 2019 06:08:20 -0700 (PDT) Date: Sat, 13 Jul 2019 15:08:18 +0200 From: Gary Jennejohn To: Chuck Tuffli Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349969 - in head: sys/net usr.sbin/bhyve Message-ID: <20190713150818.11ba99f8@ernst.home> In-Reply-To: <201907131248.x6DCmTgG050521@repo.freebsd.org> References: <201907131248.x6DCmTgG050521@repo.freebsd.org> Reply-To: gljennjohn@gmail.com X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; amd64-portbld-freebsd12.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 3013885DD5 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.96 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 13:08:23 -0000 On Sat, 13 Jul 2019 12:48:29 +0000 (UTC) Chuck Tuffli wrote: > Author: chuck > Date: Sat Jul 13 12:48:28 2019 > New Revision: 349969 > URL: https://svnweb.freebsd.org/changeset/base/349969 > > Log: > bhyve: Create EUI64 for NVMe namespaces > > Accept an IEEE Extended Unique Identifier (EUI-64) from the command > line for each NVMe namespace. If one isn't provided, it will create one > based on the CRC16 of: > - the FreeBSD IEEE OUI > - PCI bus, device/slot, function values > - Namespace ID > > Reviewed by: imp, araujo, jhb, rgrimes > Approved by: imp (mentor), jhb (maintainer) > MFC after: 2 weeks > Differential Revision: https://reviews.freebsd.org/D19905 > > Modified: > head/sys/net/ieee_oui.h > head/usr.sbin/bhyve/pci_nvme.c > > Modified: head/sys/net/ieee_oui.h > ============================================================================== > --- head/sys/net/ieee_oui.h Sat Jul 13 12:45:08 2019 (r349968) > +++ head/sys/net/ieee_oui.h Sat Jul 13 12:48:28 2019 (r349969) > @@ -77,4 +77,9 @@ > */ > #define OUI_FREEBSD_GENERATED_MASK 0x10ffff > #define OUI_FREEBSD_GENERATED_LOW OUI_FREEBSD(0x100000) > -#define OUI_FREEBSD_GENERATED_HIGH OUI_FREEBSD(OU_FREEBSD_GENERATED_MASK) > +#define OUI_FREEBSD_GENERATED_HIGH OUI_FREEBSD(OUI_FREEBSD_GENERATED_MASK) > + > +/* Allocate 16 bits for emulated NVMe devices */ > +#define OUI_FREEBSD_NVME_MASK 0x20ffff > +#define OUI_FREEBSD_NVME_LOW OUI_FREEBSD(0x200000) > +#define OUI_FRREBSD_NVME_HIGH OUI_FREEBSD(OUI_FREEBSD_NVME_MASK) TYPO (FRRE instead of FREE) - this works because the macro isn't used anywhere. > > Modified: head/usr.sbin/bhyve/pci_nvme.c > ============================================================================== > --- head/usr.sbin/bhyve/pci_nvme.c Sat Jul 13 12:45:08 2019 (r349968) > +++ head/usr.sbin/bhyve/pci_nvme.c Sat Jul 13 12:48:28 2019 (r349969) > @@ -4,6 +4,9 @@ > * Copyright (c) 2017 Shunsuke Mie > * Copyright (c) 2018 Leon Dang > * > + * Function crc16 Copyright (c) 2017, Fedor Uporov > + * Obtained from function ext2_crc16() in sys/fs/ext2fs/ext2_csum.c > + * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > * are met: > @@ -30,7 +33,7 @@ > * bhyve PCIe-NVMe device emulation. > * > * options: > - * -s ,nvme,devpath,maxq=#,qsz=#,ioslots=#,sectsz=#,ser=A-Z > + * -s ,nvme,devpath,maxq=#,qsz=#,ioslots=#,sectsz=#,ser=A-Z,eui64=# > * > * accepted devpath: > * /dev/blockdev > @@ -42,6 +45,7 @@ > * ioslots = max number of concurrent io requests > * sectsz = sector size (defaults to blockif sector size) > * ser = serial number (20-chars max) > + * eui64 = IEEE Extended Unique Identifier (8 byte value) > * > */ > > @@ -54,6 +58,7 @@ > __FBSDID("$FreeBSD$"); > > #include > +#include > > #include > #include > @@ -164,6 +169,7 @@ struct pci_nvme_blockstore { > uint64_t size; > uint32_t sectsz; > uint32_t sectsz_bits; > + uint64_t eui64; > }; > > struct pci_nvme_ioreq { > @@ -352,23 +358,87 @@ pci_nvme_init_ctrldata(struct pci_nvme_softc *sc) > cd->power_state[0].mp = 10; > } > > -static void > -pci_nvme_init_nsdata(struct pci_nvme_softc *sc) > +/* > + * Calculate the CRC-16 of the given buffer > + * See copyright attribution at top of file > + */ > +static uint16_t > +crc16(uint16_t crc, const void *buffer, unsigned int len) > { > - struct nvme_namespace_data *nd; > + const unsigned char *cp = buffer; > + /* CRC table for the CRC-16. The poly is 0x8005 (x16 + x15 + x2 + 1). */ > + static uint16_t const crc16_table[256] = { > + 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241, > + 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440, > + 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40, > + 0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841, > + 0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40, > + 0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41, > + 0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641, > + 0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040, > + 0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240, > + 0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441, > + 0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41, > + 0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840, > + 0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41, > + 0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40, > + 0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640, > + 0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041, > + 0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240, > + 0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441, > + 0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41, > + 0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840, > + 0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41, > + 0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40, > + 0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640, > + 0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041, > + 0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241, > + 0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440, > + 0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40, > + 0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841, > + 0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40, > + 0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41, > + 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641, > + 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040 > + }; > > - nd = &sc->nsdata; > + while (len--) > + crc = (((crc >> 8) & 0xffU) ^ > + crc16_table[(crc ^ *cp++) & 0xffU]) & 0x0000ffffU; > + return crc; > +} > > +static void > +pci_nvme_init_nsdata(struct pci_nvme_softc *sc, > + struct nvme_namespace_data *nd, uint32_t nsid, > + uint64_t eui64) > +{ > + > nd->nsze = sc->nvstore.size / sc->nvstore.sectsz; > nd->ncap = nd->nsze; > nd->nuse = nd->nsze; > > /* Get LBA and backstore information from backing store */ > nd->nlbaf = 0; /* NLBAF is a 0's based value (i.e. 1 LBA Format) */ > + nd->flbas = 0; > + > + /* Create an EUI-64 if user did not provide one */ > + if (eui64 == 0) { > + char *data = NULL; > + > + asprintf(&data, "%s%u%u%u", vmname, sc->nsc_pi->pi_bus, > + sc->nsc_pi->pi_slot, sc->nsc_pi->pi_func); > + > + if (data != NULL) { > + eui64 = OUI_FREEBSD_NVME_LOW | crc16(0, data, strlen(data)); > + free(data); > + } > + eui64 = (eui64 << 16) | (nsid & 0xffff); > + } > + be64enc(nd->eui64, eui64); > + > /* LBA data-sz = 2^lbads */ > nd->lbaf[0] = sc->nvstore.sectsz_bits << NVME_NS_DATA_LBAF_LBADS_SHIFT; > - > - nd->flbas = 0; > } > > static void > @@ -1817,6 +1887,8 @@ pci_nvme_parse_opts(struct pci_nvme_softc *sc, char *o > free(uopt); > return (-1); > } > + } else if (!strcmp("eui64", xopts)) { > + sc->nvstore.eui64 = htobe64(strtoull(config, NULL, 0)); > } else if (optidx == 0) { > snprintf(bident, sizeof(bident), "%d:%d", > sc->nsc_pi->pi_slot, sc->nsc_pi->pi_func); > @@ -1937,7 +2009,7 @@ pci_nvme_init(struct vmctx *ctx, struct pci_devinst *p > > pci_nvme_reset(sc); > pci_nvme_init_ctrldata(sc); > - pci_nvme_init_nsdata(sc); > + pci_nvme_init_nsdata(sc, &sc->nsdata, 1, sc->nvstore.eui64); > pci_nvme_init_logpages(sc); > > pci_lintr_request(pi); > _______________________________________________ > svn-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" -- Gary Jennejohn From owner-svn-src-all@freebsd.org Sat Jul 13 15:04:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E33A15EADD8; Sat, 13 Jul 2019 15:04:31 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ED45B895A8; Sat, 13 Jul 2019 15:04:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BEBDC27791; Sat, 13 Jul 2019 15:04:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6DF4UIg031722; Sat, 13 Jul 2019 15:04:30 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6DF4UKU031720; Sat, 13 Jul 2019 15:04:30 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201907131504.x6DF4UKU031720@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 13 Jul 2019 15:04:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349971 - head/contrib/llvm/tools/lld/ELF X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm/tools/lld/ELF X-SVN-Commit-Revision: 349971 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: ED45B895A8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 15:04:31 -0000 Author: dim Date: Sat Jul 13 15:04:30 2019 New Revision: 349971 URL: https://svnweb.freebsd.org/changeset/base/349971 Log: Pull in r365760 from upstream lld trunk (by Fangrui Song): [ELF] Handle non-glob patterns before glob patterns in version scripts & fix a corner case of --dynamic-list This fixes PR38549, which is silently accepted by ld.bfd. This seems correct because it makes sense to let non-glob patterns take precedence over glob patterns. lld issues an error because `assignWildcardVersion(ver, VER_NDX_LOCAL);` is processed before `assignExactVersion(ver, v.id, v.name);`. Move all assignWildcardVersion() calls after assignExactVersion() calls to fix this. Also, move handleDynamicList() to the bottom. computeBinding() called by includeInDynsym() has this cryptic rule: if (versionId == VER_NDX_LOCAL && isDefined() && !isPreemptible) return STB_LOCAL; Before the change: * foo's version is set to VER_NDX_LOCAL due to `local: *` * handleDynamicList() is called - foo.computeBinding() is STB_LOCAL - foo.includeInDynsym() is false - foo.isPreemptible is not set (wrong) * foo's version is set to V1 After the change: * foo's version is set to VER_NDX_LOCAL due to `local: *` * foo's version is set to V1 * handleDynamicList() is called - foo.computeBinding() is STB_GLOBAL - foo.includeInDynsym() is true - foo.isPreemptible is set (correct) Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D64550 This makes it longer necessary to patch the version scripts for the samba ports, to avoid "duplicate symbol 'pdb_search_init' in version script" errors. PR: 230602 MFC after: 3 days Modified: head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp head/contrib/llvm/tools/lld/ELF/SymbolTable.h Modified: head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp Sat Jul 13 14:42:09 2019 (r349970) +++ head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp Sat Jul 13 15:04:30 2019 (r349971) @@ -654,20 +654,6 @@ std::vector SymbolTable::findAllByVersion(Sy return Res; } -// If there's only one anonymous version definition in a version -// script file, the script does not actually define any symbol version, -// but just specifies symbols visibilities. -void SymbolTable::handleAnonymousVersion() { - for (SymbolVersion &Ver : Config->VersionScriptGlobals) - assignExactVersion(Ver, VER_NDX_GLOBAL, "global"); - for (SymbolVersion &Ver : Config->VersionScriptGlobals) - assignWildcardVersion(Ver, VER_NDX_GLOBAL); - for (SymbolVersion &Ver : Config->VersionScriptLocals) - assignExactVersion(Ver, VER_NDX_LOCAL, "local"); - for (SymbolVersion &Ver : Config->VersionScriptLocals) - assignWildcardVersion(Ver, VER_NDX_LOCAL); -} - // Handles -dynamic-list. void SymbolTable::handleDynamicList() { for (SymbolVersion &Ver : Config->DynamicList) { @@ -731,23 +717,27 @@ void SymbolTable::assignWildcardVersion(SymbolVersion // This function processes version scripts by updating VersionId // member of symbols. +// If there's only one anonymous version definition in a version +// script file, the script does not actually define any symbol version, +// but just specifies symbols visibilities. void SymbolTable::scanVersionScript() { - // Handle edge cases first. - handleAnonymousVersion(); - handleDynamicList(); - - // Now we have version definitions, so we need to set version ids to symbols. - // Each version definition has a glob pattern, and all symbols that match - // with the pattern get that version. - // First, we assign versions to exact matching symbols, // i.e. version definitions not containing any glob meta-characters. + for (SymbolVersion &Ver : Config->VersionScriptGlobals) + assignExactVersion(Ver, VER_NDX_GLOBAL, "global"); + for (SymbolVersion &Ver : Config->VersionScriptLocals) + assignExactVersion(Ver, VER_NDX_LOCAL, "local"); for (VersionDefinition &V : Config->VersionDefinitions) for (SymbolVersion &Ver : V.Globals) assignExactVersion(Ver, V.Id, V.Name); // Next, we assign versions to fuzzy matching symbols, // i.e. version definitions containing glob meta-characters. + for (SymbolVersion &Ver : Config->VersionScriptGlobals) + assignWildcardVersion(Ver, VER_NDX_GLOBAL); + for (SymbolVersion &Ver : Config->VersionScriptLocals) + assignWildcardVersion(Ver, VER_NDX_LOCAL); + // Note that because the last match takes precedence over previous matches, // we iterate over the definitions in the reverse order. for (VersionDefinition &V : llvm::reverse(Config->VersionDefinitions)) @@ -759,6 +749,12 @@ void SymbolTable::scanVersionScript() { // Let them parse and update their names to exclude version suffix. for (Symbol *Sym : SymVector) Sym->parseSymbolVersion(); + + // isPreemptible is false at this point. To correctly compute the binding of a + // Defined (which is used by includeInDynsym()), we need to know if it is + // VER_NDX_LOCAL or not. If defaultSymbolVersion is VER_NDX_LOCAL, we should + // compute symbol versions before handling --dynamic-list. + handleDynamicList(); } template void SymbolTable::addFile(InputFile *); Modified: head/contrib/llvm/tools/lld/ELF/SymbolTable.h ============================================================================== --- head/contrib/llvm/tools/lld/ELF/SymbolTable.h Sat Jul 13 14:42:09 2019 (r349970) +++ head/contrib/llvm/tools/lld/ELF/SymbolTable.h Sat Jul 13 15:04:30 2019 (r349971) @@ -90,7 +90,6 @@ class SymbolTable { (private) std::vector findAllByVersion(SymbolVersion Ver); llvm::StringMap> &getDemangledSyms(); - void handleAnonymousVersion(); void assignExactVersion(SymbolVersion Ver, uint16_t VersionId, StringRef VersionName); void assignWildcardVersion(SymbolVersion Ver, uint16_t VersionId); From owner-svn-src-all@freebsd.org Sat Jul 13 15:34:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 221B415EB527; Sat, 13 Jul 2019 15:34:32 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ACCD48A3A3; Sat, 13 Jul 2019 15:34:31 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E6C027C92; Sat, 13 Jul 2019 15:34:31 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6DFYVtb049269; Sat, 13 Jul 2019 15:34:31 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6DFYUa2049263; Sat, 13 Jul 2019 15:34:30 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201907131534.x6DFYUa2049263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 13 Jul 2019 15:34:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349972 - in head: lib/libc/arm lib/libc/arm/gen sys/sys X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head: lib/libc/arm lib/libc/arm/gen sys/sys X-SVN-Commit-Revision: 349972 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: ACCD48A3A3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.950,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 15:34:32 -0000 Author: ian Date: Sat Jul 13 15:34:29 2019 New Revision: 349972 URL: https://svnweb.freebsd.org/changeset/base/349972 Log: Add arm_sync_icache() and arm_drain_writebuf() sysarch syscall wrappers. NetBSD and OpenBSD have libc wrapper functions for the ARM_SYNC_ICACHE and ARM_DRAIN_WRITEBUF sysarch operations. This change adds compatible functions to our library. This should make it easier for various upstream sources to support *BSD operating systems with a single variation of cache maintence code in tools like interpreters and JIT compilers. I consider the argument types passed to arm_sync_icache() to be especially unfortunate, but this is intended to match the other BSDs. Differential Revision: https://reviews.freebsd.org/D20906 Added: head/lib/libc/arm/gen/arm_drain_writebuf.2 (contents, props changed) head/lib/libc/arm/gen/arm_drain_writebuf.c (contents, props changed) head/lib/libc/arm/gen/arm_sync_icache.2 (contents, props changed) head/lib/libc/arm/gen/arm_sync_icache.c (contents, props changed) Modified: head/lib/libc/arm/Symbol.map head/lib/libc/arm/gen/Makefile.inc head/sys/sys/param.h Modified: head/lib/libc/arm/Symbol.map ============================================================================== --- head/lib/libc/arm/Symbol.map Sat Jul 13 15:04:30 2019 (r349971) +++ head/lib/libc/arm/Symbol.map Sat Jul 13 15:34:29 2019 (r349972) @@ -41,6 +41,11 @@ FBSD_1.4 { dl_unwind_find_exidx; }; +FBSD_1.6 { + arm_drain_writebuf; + arm_sync_icache; +}; + FBSDprivate_1.0 { /* PSEUDO syscalls */ _getlogin; Modified: head/lib/libc/arm/gen/Makefile.inc ============================================================================== --- head/lib/libc/arm/gen/Makefile.inc Sat Jul 13 15:04:30 2019 (r349971) +++ head/lib/libc/arm/gen/Makefile.inc Sat Jul 13 15:34:29 2019 (r349972) @@ -8,6 +8,8 @@ SRCS+= \ _setjmp.S \ alloca.S \ arm_initfini.c \ + arm_drain_writebuf.c \ + arm_sync_icache.c \ fabs.c \ flt_rounds.c \ getcontextx.c \ @@ -17,6 +19,10 @@ SRCS+= \ setjmp.S \ signalcontext.c \ sigsetjmp.S \ + +MAN+= \ + arm_drain_writebuf.2 \ + arm_sync_icache.2 \ .if ${MACHINE_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") Added: head/lib/libc/arm/gen/arm_drain_writebuf.2 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/arm/gen/arm_drain_writebuf.2 Sat Jul 13 15:34:29 2019 (r349972) @@ -0,0 +1,77 @@ +.\" Copyright (c) 2019 Ian Lepore +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 10, 2019 +.Dt ARM_DRAIN_WRITEBUF 2 +.Os +.Sh NAME +.Nm arm_drain_writebuf +.Nd drain pending writes from cores and caches +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In machine/sysarch.h +.Ft int +.Fn arm_drain_writebuf void +.Sh DESCRIPTION +The +.Nm +system call causes all pending writes from ARM cores and caches to be +written out to main memory or memory-mapped I/O registers. +Not all hardware supports buffered writes; on such systems the +.Nm +function is a no-op. +.Pp +On ARMv5 systems, this executes a cp15 coprocessor +.Dq drain write buffer +operation. +On ARMv6 and ARMv7 systems, this executes a +.Dq DSB SY +synchronization barrier, followed by an L2 cache drain on +systems where the DSB does not include L2 automatically. +.Pp +.Nm +attempts to wait for the drain operation to complete, but cannot +guarantee the writes have reached their ultimate destination on all hardware. +For example, on an ARMv7 system, +.Nm +tells the L2 cache controller to drain its buffers, and it waits until +the controller indicates that operation is complete. +However, all the L2 controller knows is that the data was accepted for +delivery by the AXI bus. +If the ultimate destination of the write is a device on a subordinate +bus connected to the AXI bus, more buffering or other delays may occur +on that subordinate bus. +The only way to be certain a pending write has reached its +ultimate destination is to issue a read from that destination after +.Nm +returns. +.Sh RETURN VALUES +The +.Nm +system call cannot fail, and always returns 0. +.Sh AUTHORS +This man page was written by +.An Ian Lepore . Added: head/lib/libc/arm/gen/arm_drain_writebuf.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/arm/gen/arm_drain_writebuf.c Sat Jul 13 15:34:29 2019 (r349972) @@ -0,0 +1,39 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2019 Ian Lepore + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +int +arm_drain_writebuf(void) +{ + sysarch(ARM_DRAIN_WRITEBUF, NULL); + return (0); +} Added: head/lib/libc/arm/gen/arm_sync_icache.2 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/arm/gen/arm_sync_icache.2 Sat Jul 13 15:34:29 2019 (r349972) @@ -0,0 +1,79 @@ +.\" Copyright (c) 2019 Ian Lepore +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 10, 2019 +.Dt ARM_sync_icache 2 +.Os +.Sh NAME +.Nm arm_sync_icache +.Nd synchronize the data and instruction caches +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In machine/sysarch.h +.Ft int +.Fn arm_sync_icache "u_int addr" "int len" +.Sh DESCRIPTION +The +.Nm +system call synchronizes the contents of any data and instructions caches +with the contents of main memory for the given range. +Use this after loading executable code or modifying existing code in memory, +before attempting to execute that code. +.Pp +The +.Va addr +and +.Va len +arguments do not need to be aligned to any particular boundary, but +cache operations will affect entire cache lines, even those which are only +partially overlapped by the given range. +.Pp +This takes one or more of the following actions, depending on the requirements +of the hardware: +.Bl -bullet +.It +Write dirty data cache lines within the range back to main memory. +.It +Invalidate existing instruction cache contents for the range. +.It +Invalidate branch prediction caches for the range. +.El +.Pp +On hardware which supports multiple synchronization points for cache +operations, the caches are maintained to the point of unification, +making the data in the range coherent amongst all cores. +.Sh RETURN VALUES +The +.Nm +system call always returns 0. +.Sh ERRORS +If a call refers to memory which the calling process does not have rights +to access, or if the +.Va len +argument is negative, a SIGSEGV signal is delivered to the calling thread. +.Sh AUTHORS +This man page was written by +.An Ian Lepore . Added: head/lib/libc/arm/gen/arm_sync_icache.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/arm/gen/arm_sync_icache.c Sat Jul 13 15:34:29 2019 (r349972) @@ -0,0 +1,44 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2019 Ian Lepore + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +int +arm_sync_icache(u_int addr, int len) +{ + struct arm_sync_icache_args args; + + args.addr = addr; + args.len = len; + sysarch(ARM_SYNC_ICACHE, &args); + return (0); +} Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Sat Jul 13 15:04:30 2019 (r349971) +++ head/sys/sys/param.h Sat Jul 13 15:34:29 2019 (r349972) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300035 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300036 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Sat Jul 13 15:53:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BB5E15EBB9A; Sat, 13 Jul 2019 15:53:29 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BE7678AF19; Sat, 13 Jul 2019 15:53:28 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C87228019; Sat, 13 Jul 2019 15:53:28 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6DFrSI2060951; Sat, 13 Jul 2019 15:53:28 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6DFrS34060950; Sat, 13 Jul 2019 15:53:28 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201907131553.x6DFrS34060950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sat, 13 Jul 2019 15:53:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349973 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 349973 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BE7678AF19 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.946,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 15:53:29 -0000 Author: alc Date: Sat Jul 13 15:53:28 2019 New Revision: 349973 URL: https://svnweb.freebsd.org/changeset/base/349973 Log: Remove a stale comment. Reported by: markj MFC after: 1 week Modified: head/sys/i386/i386/pmap.c Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Sat Jul 13 15:34:29 2019 (r349972) +++ head/sys/i386/i386/pmap.c Sat Jul 13 15:53:28 2019 (r349973) @@ -5096,13 +5096,6 @@ __CONCAT(PMTYPE, ts_referenced)(vm_page_t m) * reference bit will result in clearing that bit. * This function is designed to avoid the selection of * the same 4KB page for every 2- or 4MB page mapping. - * - * On demotion, a mapping that hasn't been referenced - * is simply destroyed. To avoid the possibility of a - * subsequent page fault on a demoted wired mapping, - * always leave its reference bit set. Moreover, - * since the superpage is wired, the current state of - * its reference bit won't affect page replacement. */ if ((((pa >> PAGE_SHIFT) ^ (pv->pv_va >> PDRSHIFT) ^ (uintptr_t)pmap) & (NPTEPG - 1)) == 0 && From owner-svn-src-all@freebsd.org Sat Jul 13 16:07:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D04B15EBF02; Sat, 13 Jul 2019 16:07:39 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 119C48B63B; Sat, 13 Jul 2019 16:07:39 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0269281C1; Sat, 13 Jul 2019 16:07:38 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6DG7cg3067203; Sat, 13 Jul 2019 16:07:38 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6DG7cTR067202; Sat, 13 Jul 2019 16:07:38 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201907131607.x6DG7cTR067202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 13 Jul 2019 16:07:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349974 - head/libexec/rc/rc.d X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/libexec/rc/rc.d X-SVN-Commit-Revision: 349974 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 119C48B63B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.948,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 16:07:39 -0000 Author: ian Date: Sat Jul 13 16:07:38 2019 New Revision: 349974 URL: https://svnweb.freebsd.org/changeset/base/349974 Log: Limit access to system accounting files. In 2013 the security chapter of the Handbook was updated in r42501 to suggest limiting access to the system accounting file [*1] by creating the initial file with a mode of 0600. This was in part based on a discussion in the forums [*2]. Unfortunately, this advice is overridden by the fact that a new file is created as part of periodic daily processing, and the file mode is set by the rc.d/accounting script. These changes update the accounting script to create the directory with mode 0750 if it doesn't already exist, and to create the daily file with mode 0640. This limits write access to root only, read access to root and members of wheel, and eliminates world access completely. For admins who want to prevent even members of wheel from accessing the files, the mode of the /var/account directory can be manually changed to 0700, because the script never creates or changes that directory if it already exists. The accounting_rotate_log() function now also handles the error cases of no existing log file to rotate, and attempting to rotate the file multiple times (.0 file already exists). Another small change here eliminates the complexity of the mktemp/chmod/mv sequence for creating a new acct file by using install(1) with the flags needed to directly create the file with the desired ownership and modes. That allows coalescing two separate if checkyesno accounting_enable blocks into one. These changes were inspired by my investigation of PR 202203. [1] https://www.freebsd.org/doc/handbook/security-accounting.html [2] http://forums.freebsd.org/showthread.php?t=41059 PR: 202203 Differential Revision: https://reviews.freebsd.org/D20876 Modified: head/libexec/rc/rc.d/accounting Modified: head/libexec/rc/rc.d/accounting ============================================================================== --- head/libexec/rc/rc.d/accounting Sat Jul 13 15:53:28 2019 (r349973) +++ head/libexec/rc/rc.d/accounting Sat Jul 13 16:07:38 2019 (r349974) @@ -21,23 +21,27 @@ start_cmd="accounting_start" stop_cmd="accounting_stop" rotate_log_cmd="accounting_rotate_log" +create_accounting_file() +{ + install -o root -g wheel -m 0640 /dev/null "${accounting_file}" +} + accounting_start() { local _dir _dir="${accounting_file%/*}" if [ ! -d "$_dir" ]; then - if ! mkdir -p "$_dir"; then + if ! mkdir -p -m 0750 "$_dir"; then err 1 "Could not create $_dir." fi fi if [ ! -e "$accounting_file" ]; then echo -n "Creating accounting file ${accounting_file}" - touch "$accounting_file" + create_accounting_file echo '.' fi - chmod 644 "$accounting_file" echo "Turning on accounting." ${accounting_command} ${accounting_file} @@ -51,21 +55,24 @@ accounting_stop() accounting_rotate_log() { - local _dir _file + # Note that this function must handle being called as "onerotate_log" + # (by the periodic scripts) when accounting is disabled, and handle + # being called multiple times (by an admin making mistakes) without + # anything having actually rotated the old .0 file out of the way. - _dir="${accounting_file%/*}" - cd $_dir + if [ -e "${accounting_file}.0" ]; then + err 1 "Cannot rotate accounting log, ${accounting_file}.0 already exists." + fi - if checkyesno accounting_enable; then - _file=`mktemp newacct-XXXXX` - chmod 644 $_file - ${accounting_command} ${_dir}/${_file} + if [ ! -e "${accounting_file}" ]; then + err 1 "Cannot rotate accounting log, ${accounting_file} does not exist." fi mv ${accounting_file} ${accounting_file}.0 if checkyesno accounting_enable; then - mv $_file ${accounting_file} + create_accounting_file + ${accounting_command} "${accounting_file}" fi } From owner-svn-src-all@freebsd.org Sat Jul 13 16:32:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3802C15EC4CF; Sat, 13 Jul 2019 16:32:20 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C2B438C334; Sat, 13 Jul 2019 16:32:19 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E3D8286D8; Sat, 13 Jul 2019 16:32:19 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6DGWJHh084050; Sat, 13 Jul 2019 16:32:19 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6DGWJqZ084049; Sat, 13 Jul 2019 16:32:19 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201907131632.x6DGWJqZ084049@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sat, 13 Jul 2019 16:32:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349975 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 349975 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C2B438C334 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.92)[-0.920,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 16:32:20 -0000 Author: alc Date: Sat Jul 13 16:32:19 2019 New Revision: 349975 URL: https://svnweb.freebsd.org/changeset/base/349975 Log: Revert r349442, which was a workaround for bus errors caused by an errant TLB entry. Specifically, at the start of pmap_enter_quick_locked(), we would sometimes have a TLB entry for an invalid PTE, and we would need to issue a TLB invalidation before exiting pmap_enter_quick_locked(). However, we should never have a TLB entry for an invalid PTE. r349905 has addressed the root cause of the problem, and so we no longer need this workaround. X-MFC after: r349905 Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Sat Jul 13 16:07:38 2019 (r349974) +++ head/sys/arm64/arm64/pmap.c Sat Jul 13 16:32:19 2019 (r349975) @@ -3713,14 +3713,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v cpu_icache_sync_range(PHYS_TO_DMAP(pa), PAGE_SIZE); pmap_load_store(l3, l3_val); - - /* - * XXX In principle, because this L3 entry was invalid, we should not - * need to perform a TLB invalidation here. However, in practice, - * when simply performing a "dsb ishst" here, processes are being - * terminated due to bus errors and segmentation violations. - */ - pmap_invalidate_page(pmap, va); + dsb(ishst); return (mpte); } From owner-svn-src-all@freebsd.org Sat Jul 13 16:48:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7071C15EC743; Sat, 13 Jul 2019 16:48:28 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 05F848C8EA; Sat, 13 Jul 2019 16:48:28 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E8E352888B; Sat, 13 Jul 2019 16:48:27 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6DGmR08090396; Sat, 13 Jul 2019 16:48:27 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6DGmRc4090395; Sat, 13 Jul 2019 16:48:27 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201907131648.x6DGmRc4090395@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 13 Jul 2019 16:48:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349976 - head X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 349976 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 05F848C8EA X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.92)[-0.920,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 16:48:28 -0000 Author: ian Date: Sat Jul 13 16:48:27 2019 New Revision: 349976 URL: https://svnweb.freebsd.org/changeset/base/349976 Log: Add an entry mentioning the permission/mode change to daily accounting files. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Sat Jul 13 16:32:19 2019 (r349975) +++ head/UPDATING Sat Jul 13 16:48:27 2019 (r349976) @@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20190713: + Default permissions on the /var/account/acct file (and copies of it rotated + by periodic daily scripts) are changed from 0644 to 0640 because the file + contains sensitive information that should not be world-readable. If the + /var/account directory must be created by rc.d/accounting, the mode used is + now 0750. Admins who use the accounting feature are encouraged to change + the mode of an existing /var/account directory to 0750 or 0700. + 20190620: Entropy collection and the /dev/random device are no longer optional components. The "device random" option has been removed. From owner-svn-src-all@freebsd.org Sat Jul 13 22:42:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3785715CF13B; Sat, 13 Jul 2019 22:42:58 +0000 (UTC) (envelope-from ctuffli@gmail.com) Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BB79072B02; Sat, 13 Jul 2019 22:42:57 +0000 (UTC) (envelope-from ctuffli@gmail.com) Received: by mail-ot1-f52.google.com with SMTP id r6so13063581oti.3; Sat, 13 Jul 2019 15:42:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qcUiuYDU6gCKXRVpdLbRqXa6XzMSUNV/h4Q2WqxYT6I=; b=kRxW0RzcX/jU22jKbA7MvVPw8QwFy5ELOhjc7p2qCwWnN+eptwUSgV/gDt4QrekF2K oTQJX6D2JYfC+njFqnJiSdIvSOW0SXp/y3IME/VfJLr7Y5WUAnd08Q7AN6w69yjhCGbc Ai9LzRbaVQx/0oTdMb+fjSXT93LWiMNjR+mjLShgC7umNx7aJY1m+Ov6hJY6RkVg7xIQ vdmPNW/jP+3MwPorwoXN9II8VzGrN9Z8fgM1BWSKaw0nCFViWxfLPnER2NwDOpC+W9Tv dgC2riGM0AMtna11e9zFDcQoTyEh1j7L9e99+6u3s6SJYMUy1zxG3a/RGY7ehjadlwf0 ngQg== X-Gm-Message-State: APjAAAXvHuiyX2lncBX/O03qiS1Ik3yBavt1Rst4GwdZtA7g1rz+veZl 933gq7GhN0G+EOB+B1wJa2+/5xI/ X-Google-Smtp-Source: APXvYqweW9gRpJEMDiN+1DwSD9lcCy899vPXeMsnYgtlC+VN/7M0coUfq/hYIWW5gqurtAcMYrqZvg== X-Received: by 2002:a05:6830:157:: with SMTP id j23mr14228563otp.198.1563051008204; Sat, 13 Jul 2019 13:50:08 -0700 (PDT) Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com. [209.85.167.179]) by smtp.gmail.com with ESMTPSA id l5sm4444284otf.53.2019.07.13.13.50.07 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Sat, 13 Jul 2019 13:50:07 -0700 (PDT) Received: by mail-oi1-f179.google.com with SMTP id t76so9896802oih.4; Sat, 13 Jul 2019 13:50:07 -0700 (PDT) X-Received: by 2002:aca:3a04:: with SMTP id h4mr8560720oia.90.1563051007267; Sat, 13 Jul 2019 13:50:07 -0700 (PDT) MIME-Version: 1.0 References: <201907131248.x6DCmTgG050521@repo.freebsd.org> <20190713150818.11ba99f8@ernst.home> In-Reply-To: <20190713150818.11ba99f8@ernst.home> From: Chuck Tuffli Date: Sat, 13 Jul 2019 13:49:53 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r349969 - in head: sys/net usr.sbin/bhyve To: gljennjohn@gmail.com Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: BB79072B02 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.90 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.90)[-0.901,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 22:42:58 -0000 On Sat, Jul 13, 2019 at 6:08 AM Gary Jennejohn wrote: > > On Sat, 13 Jul 2019 12:48:29 +0000 (UTC) > Chuck Tuffli wrote: > > > Author: chuck > > Date: Sat Jul 13 12:48:28 2019 > > New Revision: 349969 > > URL: https://svnweb.freebsd.org/changeset/base/349969 ... > > +#define OUI_FREEBSD_NVME_MASK 0x20ffff > > +#define OUI_FREEBSD_NVME_LOW OUI_FREEBSD(0x200000) > > +#define OUI_FRREBSD_NVME_HIGH OUI_FREEBSD(OUI_FREEBSD_NVME_MASK) > > TYPO (FRRE instead of FREE) - this works because the macro isn't used > anywhere. Duh-oh! Good catch. Much appreciated. --chuck