From owner-dev-commits-src-main@freebsd.org Mon May 10 14:11:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE26F6393F1; Mon, 10 May 2021 14:11:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ff2zL5xHnz3Qqq; Mon, 10 May 2021 14:11:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE9C225D9B; Mon, 10 May 2021 14:11:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14AEBQV9063972; Mon, 10 May 2021 14:11:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14AEBQJx063971; Mon, 10 May 2021 14:11:26 GMT (envelope-from git) Date: Mon, 10 May 2021 14:11:26 GMT Message-Id: <202105101411.14AEBQJx063971@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 2ef5d803e384 - main - in6_mcast: Return EADDRINUSE when we've already joined the group MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2ef5d803e3847f56771c107d9517ec560cf318c9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2021 14:11:26 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2ef5d803e3847f56771c107d9517ec560cf318c9 commit 2ef5d803e3847f56771c107d9517ec560cf318c9 Author: Kristof Provost AuthorDate: 2021-05-04 17:23:15 +0000 Commit: Kristof Provost CommitDate: 2021-05-10 07:48:51 +0000 in6_mcast: Return EADDRINUSE when we've already joined the group Distinguish between truly invalid requests and those that fail because we've already joined the group. Both cases fail, but differentiating them allows userspace to make more informed decisions about what the error means. For example. radvd tries to join the all-routers group on every SIGHUP. This fails, because it's already joined it, but this failure should be ignored (rather than treated as a sign that the interface's multicast is broken). This puts us in line with OpenBSD, NetBSD and Linux. Reviewed by: donner MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30111 --- sys/netinet6/in6_mcast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c index 9b04c87d22a0..0744a1178fc7 100644 --- a/sys/netinet6/in6_mcast.c +++ b/sys/netinet6/in6_mcast.c @@ -2030,7 +2030,7 @@ in6p_join_group(struct inpcb *inp, struct sockopt *sopt) * state at t1, because allocation of a filter * is atomic with allocation of a membership. */ - error = EINVAL; + error = EADDRINUSE; goto out_in6p_locked; } } From owner-dev-commits-src-main@freebsd.org Mon May 10 15:31:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7753D63B070; Mon, 10 May 2021 15:31:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ff4lY30Pmz3l7f; Mon, 10 May 2021 15:31:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 59B8F26B59; Mon, 10 May 2021 15:31:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14AFVLRi069109; Mon, 10 May 2021 15:31:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14AFVLcE069108; Mon, 10 May 2021 15:31:21 GMT (envelope-from git) Date: Mon, 10 May 2021 15:31:21 GMT Message-Id: <202105101531.14AFVLcE069108@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: 9867224bab3f - main - tcp:Host cache and rack ending up with incorrect values. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9867224bab3f247ac875d89c2472aa4bc855fe3b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2021 15:31:21 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=9867224bab3f247ac875d89c2472aa4bc855fe3b commit 9867224bab3f247ac875d89c2472aa4bc855fe3b Author: Randall Stewart AuthorDate: 2021-05-10 15:25:51 +0000 Commit: Randall Stewart CommitDate: 2021-05-10 15:25:51 +0000 tcp:Host cache and rack ending up with incorrect values. The hostcache up to now as been updated in the discard callback but without checking if we are all done (the race where there are more than one calls and the counter has not yet reached zero). This means that when the race occurs, we end up calling the hc_upate more than once. Also alternate stacks can keep there srtt/rttvar in different formats (example rack keeps its values in microseconds). Since we call the hc_update *before* the stack fini() then the values will be in the wrong format. Rack on the other hand, needs to convert items pulled from the hostcache into its internal format else it may end up with very much incorrect values from the hostcache. In the process lets commonize the update mechanism for srtt/rttvar since we now have more than one place that needs to call it. Reviewed by: Michael Tuexen Sponsored by: Netflix Inc Differential Revision: https://reviews.freebsd.org/D30172 --- sys/netinet/tcp_stacks/rack.c | 102 ++++++++++++++++++++---------------- sys/netinet/tcp_subr.c | 118 ++++++++++++++++++++++-------------------- 2 files changed, 119 insertions(+), 101 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 7c59d8097e22..865e54c90e6a 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -6563,13 +6563,65 @@ rack_remxt_tmr(struct tcpcb *tp) rack->r_ctl.rc_snd_max_at_rto = tp->snd_max; } +static void +rack_convert_rtts(struct tcpcb *tp) +{ + if (tp->t_srtt > 1) { + uint32_t val, frac; + + val = tp->t_srtt >> TCP_RTT_SHIFT; + frac = tp->t_srtt & 0x1f; + tp->t_srtt = TICKS_2_USEC(val); + /* + * frac is the fractional part of the srtt (if any) + * but its in ticks and every bit represents + * 1/32nd of a hz. + */ + if (frac) { + if (hz == 1000) { + frac = (((uint64_t)frac * (uint64_t)HPTS_USEC_IN_MSEC) / (uint64_t)TCP_RTT_SCALE); + } else { + frac = (((uint64_t)frac * (uint64_t)HPTS_USEC_IN_SEC) / ((uint64_t)(hz) * (uint64_t)TCP_RTT_SCALE)); + } + tp->t_srtt += frac; + } + } + if (tp->t_rttvar) { + uint32_t val, frac; + + val = tp->t_rttvar >> TCP_RTTVAR_SHIFT; + frac = tp->t_rttvar & 0x1f; + tp->t_rttvar = TICKS_2_USEC(val); + /* + * frac is the fractional part of the srtt (if any) + * but its in ticks and every bit represents + * 1/32nd of a hz. + */ + if (frac) { + if (hz == 1000) { + frac = (((uint64_t)frac * (uint64_t)HPTS_USEC_IN_MSEC) / (uint64_t)TCP_RTT_SCALE); + } else { + frac = (((uint64_t)frac * (uint64_t)HPTS_USEC_IN_SEC) / ((uint64_t)(hz) * (uint64_t)TCP_RTT_SCALE)); + } + tp->t_rttvar += frac; + } + } + RACK_TCPT_RANGESET(tp->t_rxtcur, RACK_REXMTVAL(tp), + rack_rto_min, rack_rto_max); +} + static void rack_cc_conn_init(struct tcpcb *tp) { struct tcp_rack *rack; rack = (struct tcp_rack *)tp->t_fb_ptr; + cc_conn_init(tp); + /* + * Now convert to rack's internal format. + */ + rack_convert_rtts(tp); /* * We want a chance to stay in slowstart as * we create a connection. TCP spec says that @@ -11916,9 +11968,9 @@ rack_init_fsb_block(struct tcpcb *tp, struct tcp_rack *rack) static int rack_init_fsb(struct tcpcb *tp, struct tcp_rack *rack) { - /* - * Allocate the larger of spaces V6 if available else just - * V4 and include udphdr (overbook) + /* + * Allocate the larger of spaces V6 if available else just + * V4 and include udphdr (overbook) */ #ifdef INET6 rack->r_ctl.fsb.tcp_ip_hdr_len = sizeof(struct ip6_hdr) + sizeof(struct tcphdr) + sizeof(struct udphdr); @@ -12147,47 +12199,7 @@ rack_init(struct tcpcb *tp) * bit decimal so we have to carefully convert * these to get the full precision. */ - if (tp->t_srtt > 1) { - uint32_t val, frac; - - val = tp->t_srtt >> TCP_RTT_SHIFT; - frac = tp->t_srtt & 0x1f; - tp->t_srtt = TICKS_2_USEC(val); - /* - * frac is the fractional part of the srtt (if any) - * but its in ticks and every bit represents - * 1/32nd of a hz. - */ - if (frac) { - if (hz == 1000) { - frac = (((uint64_t)frac * (uint64_t)HPTS_USEC_IN_MSEC) / (uint64_t)TCP_RTT_SCALE); - } else { - frac = (((uint64_t)frac * (uint64_t)HPTS_USEC_IN_SEC) / ((uint64_t)(hz) * (uint64_t)TCP_RTT_SCALE)); - } - tp->t_srtt += frac; - } - } - if (tp->t_rttvar) { - uint32_t val, frac; - - val = tp->t_rttvar >> TCP_RTTVAR_SHIFT; - frac = tp->t_rttvar & 0x1f; - tp->t_rttvar = TICKS_2_USEC(val); - /* - * frac is the fractional part of the srtt (if any) - * but its in ticks and every bit represents - * 1/32nd of a hz. - */ - if (frac) { - if (hz == 1000) { - frac = (((uint64_t)frac * (uint64_t)HPTS_USEC_IN_MSEC) / (uint64_t)TCP_RTT_SCALE); - } else { - frac = (((uint64_t)frac * (uint64_t)HPTS_USEC_IN_SEC) / ((uint64_t)(hz) * (uint64_t)TCP_RTT_SCALE)); - } - tp->t_rttvar += frac; - } - } - tp->t_rxtcur = TICKS_2_USEC(tp->t_rxtcur); + rack_convert_rtts(tp); tp->t_rttlow = TICKS_2_USEC(tp->t_rttlow); if (rack_def_profile) rack_set_profile(rack, rack_def_profile); @@ -12230,7 +12242,7 @@ rack_init(struct tcpcb *tp) rack_stop_all_timers(tp); /* Lets setup the fsb block */ rack_start_hpts_timer(rack, tp, tcp_get_usecs(NULL), 0, 0, 0); - rack_log_rtt_shrinks(rack, us_cts, 0, + rack_log_rtt_shrinks(rack, us_cts, tp->t_rxtcur, __LINE__, RACK_RTTS_INIT); return (0); } diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 51bb749c99d8..5f2997163471 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -2309,62 +2309,6 @@ tcp_discardcb(struct tcpcb *tp) tp->t_fb->tfb_tcp_timer_stop_all(tp); } - /* - * If we got enough samples through the srtt filter, - * save the rtt and rttvar in the routing entry. - * 'Enough' is arbitrarily defined as 4 rtt samples. - * 4 samples is enough for the srtt filter to converge - * to within enough % of the correct value; fewer samples - * and we could save a bogus rtt. The danger is not high - * as tcp quickly recovers from everything. - * XXX: Works very well but needs some more statistics! - */ - if (tp->t_rttupdated >= 4) { - struct hc_metrics_lite metrics; - uint32_t ssthresh; - - bzero(&metrics, sizeof(metrics)); - /* - * Update the ssthresh always when the conditions below - * are satisfied. This gives us better new start value - * for the congestion avoidance for new connections. - * ssthresh is only set if packet loss occurred on a session. - * - * XXXRW: 'so' may be NULL here, and/or socket buffer may be - * being torn down. Ideally this code would not use 'so'. - */ - ssthresh = tp->snd_ssthresh; - if (ssthresh != 0 && ssthresh < so->so_snd.sb_hiwat / 2) { - /* - * convert the limit from user data bytes to - * packets then to packet data bytes. - */ - ssthresh = (ssthresh + tp->t_maxseg / 2) / tp->t_maxseg; - if (ssthresh < 2) - ssthresh = 2; - ssthresh *= (tp->t_maxseg + -#ifdef INET6 - (isipv6 ? sizeof (struct ip6_hdr) + - sizeof (struct tcphdr) : -#endif - sizeof (struct tcpiphdr) -#ifdef INET6 - ) -#endif - ); - } else - ssthresh = 0; - metrics.rmx_ssthresh = ssthresh; - - metrics.rmx_rtt = tp->t_srtt; - metrics.rmx_rttvar = tp->t_rttvar; - metrics.rmx_cwnd = tp->snd_cwnd; - metrics.rmx_sendpipe = 0; - metrics.rmx_recvpipe = 0; - - tcp_hc_update(&inp->inp_inc, &metrics); - } - /* free the reassembly queue, if any */ tcp_reass_flush(tp); @@ -2404,6 +2348,68 @@ tcp_discardcb(struct tcpcb *tp) TCPSTATES_DEC(tp->t_state); if (tp->t_fb->tfb_tcp_fb_fini) (*tp->t_fb->tfb_tcp_fb_fini)(tp, 1); + + /* + * If we got enough samples through the srtt filter, + * save the rtt and rttvar in the routing entry. + * 'Enough' is arbitrarily defined as 4 rtt samples. + * 4 samples is enough for the srtt filter to converge + * to within enough % of the correct value; fewer samples + * and we could save a bogus rtt. The danger is not high + * as tcp quickly recovers from everything. + * XXX: Works very well but needs some more statistics! + * + * XXXRRS: Updating must be after the stack fini() since + * that may be converting some internal representation of + * say srtt etc into the general one used by other stacks. + * Lets also at least protect against the so being NULL + * as RW stated below. + */ + if ((tp->t_rttupdated >= 4) && (so != NULL)) { + struct hc_metrics_lite metrics; + uint32_t ssthresh; + + bzero(&metrics, sizeof(metrics)); + /* + * Update the ssthresh always when the conditions below + * are satisfied. This gives us better new start value + * for the congestion avoidance for new connections. + * ssthresh is only set if packet loss occurred on a session. + * + * XXXRW: 'so' may be NULL here, and/or socket buffer may be + * being torn down. Ideally this code would not use 'so'. + */ + ssthresh = tp->snd_ssthresh; + if (ssthresh != 0 && ssthresh < so->so_snd.sb_hiwat / 2) { + /* + * convert the limit from user data bytes to + * packets then to packet data bytes. + */ + ssthresh = (ssthresh + tp->t_maxseg / 2) / tp->t_maxseg; + if (ssthresh < 2) + ssthresh = 2; + ssthresh *= (tp->t_maxseg + +#ifdef INET6 + (isipv6 ? sizeof (struct ip6_hdr) + + sizeof (struct tcphdr) : +#endif + sizeof (struct tcpiphdr) +#ifdef INET6 + ) +#endif + ); + } else + ssthresh = 0; + metrics.rmx_ssthresh = ssthresh; + + metrics.rmx_rtt = tp->t_srtt; + metrics.rmx_rttvar = tp->t_rttvar; + metrics.rmx_cwnd = tp->snd_cwnd; + metrics.rmx_sendpipe = 0; + metrics.rmx_recvpipe = 0; + + tcp_hc_update(&inp->inp_inc, &metrics); + } refcount_release(&tp->t_fb->tfb_refcnt); tp->t_inpcb = NULL; uma_zfree(V_tcpcb_zone, tp); From owner-dev-commits-src-main@freebsd.org Mon May 10 16:57:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D10A363DB82; Mon, 10 May 2021 16:57:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ff6fw5dXRz3qHW; Mon, 10 May 2021 16:57:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B433027F70; Mon, 10 May 2021 16:57:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14AGvSlB080051; Mon, 10 May 2021 16:57:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14AGvSWf080050; Mon, 10 May 2021 16:57:28 GMT (envelope-from git) Date: Mon, 10 May 2021 16:57:28 GMT Message-Id: <202105101657.14AGvSWf080050@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 988b1bb0c54e - main - sh: implement persistent history storage MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 988b1bb0c54e50654112f0bd649aee68307a5a80 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2021 16:57:28 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=988b1bb0c54e50654112f0bd649aee68307a5a80 commit 988b1bb0c54e50654112f0bd649aee68307a5a80 Author: Baptiste Daroussin AuthorDate: 2021-03-30 08:28:08 +0000 Commit: Baptiste Daroussin CommitDate: 2021-05-10 16:57:13 +0000 sh: implement persistent history storage Implement persistent history storage: the strategy is simple at start: loads the existing .sh_history file at exit dump it. The implementation respects the HISTFILE variable and its POSIX definition: ~/.sh_history is used if HISTFILE is not set. to avoid sh to create the history file, set HISTSIZE to 0 or HISTFILE to en empty value Co-authored-by: pstef Reviewed by: jilles Differential Revision: https://reviews.freebsd.org/D29493 --- bin/sh/histedit.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++ bin/sh/main.c | 7 +++++++ bin/sh/myhistedit.h | 3 ++- bin/sh/sh.1 | 11 +++++++++- bin/sh/trap.c | 3 +++ 5 files changed, 81 insertions(+), 2 deletions(-) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index ba2bec357181..596145790f31 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -78,6 +79,64 @@ static int comparator(const void *, const void *, void *); static char **sh_matches(const char *, int, int); static unsigned char sh_complete(EditLine *, int); +static const char * +get_histfile(void) +{ + const char *histfile; + + /* don't try to save if the history size is 0 */ + if (hist == NULL || histsizeval() == 0) + return (NULL); + histfile = expandstr("${HISTFILE-${HOME-}/.sh_history}"); + + if (histfile[0] == '\0') + return (NULL); + return (histfile); +} + +void +histsave(void) +{ + HistEvent he; + char *histtmpname = NULL; + const char *histfile; + int fd; + FILE *f; + + if ((histfile = get_histfile()) == NULL) + return; + INTOFF; + asprintf(&histtmpname, "%s.XXXXXXXXXX", histfile); + if (histtmpname == NULL) { + INTON; + return; + } + fd = mkstemp(histtmpname); + if (fd == -1 || (f = fdopen(fd, "w")) == NULL) { + free(histtmpname); + INTON; + return; + } + if (history(hist, &he, H_SAVE_FP, f) < 1 || + rename(histtmpname, histfile) == -1) + unlink(histtmpname); + fclose(f); + free(histtmpname); + INTON; + +} + +void +histload(void) +{ + const char *histfile; + HistEvent he; + + if ((histfile = get_histfile()) == NULL) + return; + history(hist, &he, H_LOAD, histfile); +} + /* * Set history and editing status. Called whenever the status may * have changed (figures out what to do). diff --git a/bin/sh/main.c b/bin/sh/main.c index cbe026e13640..b0a5fac6fd4e 100644 --- a/bin/sh/main.c +++ b/bin/sh/main.c @@ -75,6 +75,9 @@ __FBSDID("$FreeBSD$"); #include "cd.h" #include "redir.h" #include "builtins.h" +#ifndef NO_HISTORY +#include "myhistedit.h" +#endif int rootpid; int rootshell; @@ -157,6 +160,10 @@ state2: read_profile(shinit); } } +#ifndef NO_HISTORY + if (iflag) + histload(); +#endif state3: state = 4; popstackmark(&smark2); diff --git a/bin/sh/myhistedit.h b/bin/sh/myhistedit.h index 968d23c9c1f8..1f513f0ae206 100644 --- a/bin/sh/myhistedit.h +++ b/bin/sh/myhistedit.h @@ -43,4 +43,5 @@ extern int displayhist; void histedit(void); void sethistsize(const char *); void setterm(const char *); - +void histload(void); +void histsave(void); diff --git a/bin/sh/sh.1 b/bin/sh/sh.1 index 76335cfaa2cd..ca3faeff13af 100644 --- a/bin/sh/sh.1 +++ b/bin/sh/sh.1 @@ -32,7 +32,7 @@ .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd July 6, 2020 +.Dd May 10, 2021 .Dt SH 1 .Os .Sh NAME @@ -1351,6 +1351,15 @@ If not set, the default editor is The default editor used with the .Ic fc built-in. +.It Va HISTFILE +File used for persistent history storage. +If unset +.Pa ~/.sh_history +will be used. +If set but empty or +.Va HISTSIZE +is set to 0 +the shell will not load and save the history. .It Va HISTSIZE The number of previous commands that are accessible. .It Va HOME diff --git a/bin/sh/trap.c b/bin/sh/trap.c index d7ef40274270..2dd394035ca4 100644 --- a/bin/sh/trap.c +++ b/bin/sh/trap.c @@ -535,6 +535,9 @@ exitshell_savedstatus(void) flushall(); #if JOBS setjobctl(0); +#endif +#ifndef NO_HISTORY + histsave(); #endif } if (sig != 0 && sig != SIGSTOP && sig != SIGTSTP && sig != SIGTTIN && From owner-dev-commits-src-main@freebsd.org Mon May 10 17:11:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE62763E322; Mon, 10 May 2021 17:11:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ff6z74csGz3rKX; Mon, 10 May 2021 17:11:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 91D781F8; Mon, 10 May 2021 17:11:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14AHBVPF006203; Mon, 10 May 2021 17:11:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14AHBVbr006202; Mon, 10 May 2021 17:11:31 GMT (envelope-from git) Date: Mon, 10 May 2021 17:11:31 GMT Message-Id: <202105101711.14AHBVbr006202@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: 0471a8c73402 - main - tcp: SACK Lost Retransmission Detection (LRD) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0471a8c7340274a5cd4b8c963965493f459c9662 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2021 17:11:31 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=0471a8c7340274a5cd4b8c963965493f459c9662 commit 0471a8c7340274a5cd4b8c963965493f459c9662 Author: Richard Scheffenegger AuthorDate: 2021-05-10 16:47:47 +0000 Commit: Richard Scheffenegger CommitDate: 2021-05-10 17:06:20 +0000 tcp: SACK Lost Retransmission Detection (LRD) Recover from excessive losses without reverting to a retransmission timeout (RTO). Disabled by default, enable with sysctl net.inet.tcp.do_lrd=1 Reviewed By: #transport, rrs, tuexen, #manpages Sponsored by: Netapp, Inc. Differential Revision: https://reviews.freebsd.org/D28931 --- share/man/man4/tcp.4 | 7 +++++ sys/netinet/tcp.h | 1 + sys/netinet/tcp_input.c | 14 ++++++++-- sys/netinet/tcp_output.c | 8 ++++++ sys/netinet/tcp_sack.c | 73 ++++++++++++++++++++++++++++++++++++++++++++---- sys/netinet/tcp_subr.c | 2 ++ sys/netinet/tcp_usrreq.c | 9 ++++++ sys/netinet/tcp_var.h | 9 ++++-- usr.bin/netstat/inet.c | 2 ++ 9 files changed, 114 insertions(+), 11 deletions(-) diff --git a/share/man/man4/tcp.4 b/share/man/man4/tcp.4 index d06630aa8d44..93d1e075e92d 100644 --- a/share/man/man4/tcp.4 +++ b/share/man/man4/tcp.4 @@ -547,6 +547,13 @@ This gently reduces the congestion window during periods, where TCP is application limited and the network bandwidth is not utilized completely. That prevents self-inflicted packet losses once the application starts to transmit data at a higher speed. +.It Va do_lrd +Enable Lost Retransmission Detection for SACK-enabled sessions, disabled by +default. +Under severe congestion, a retransmission can be lost which then leads to a +mandatory Retransmission Timeout (RTO), followed by slow-start. +LRD will try to resend the repeatedly lost packet, preventing the time-consuming +RTO and performance reducing slow-start. .It Va do_prr Perform SACK loss recovery using the Proportional Rate Reduction (PRR) algorithm described in RFC6937. diff --git a/sys/netinet/tcp.h b/sys/netinet/tcp.h index 50f0811a6517..7ba99df51ed3 100644 --- a/sys/netinet/tcp.h +++ b/sys/netinet/tcp.h @@ -199,6 +199,7 @@ struct tcphdr { #define TCP_PROC_ACCOUNTING 76 /* Do accounting on tcp cpu usage and counts */ #define TCP_USE_CMP_ACKS 77 /* The transport can handle the Compressed mbuf acks */ #define TCP_PERF_INFO 78 /* retrieve accounting counters */ +#define TCP_LRD 79 /* toggle Lost Retransmission Detection for A/B testing */ #define TCP_KEEPINIT 128 /* N, time to establish connection */ #define TCP_KEEPIDLE 256 /* L,N,X start keeplives after this period */ #define TCP_KEEPINTVL 512 /* L,N interval between keepalives */ diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index bfa95feb7eee..49db8cc63cb3 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -164,6 +164,11 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, do_prr, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_do_prr), 1, "Enable Proportional Rate Reduction per RFC 6937"); +VNET_DEFINE(int, tcp_do_lrd) = 0; +SYSCTL_INT(_net_inet_tcp, OID_AUTO, do_lrd, CTLFLAG_VNET | CTLFLAG_RW, + &VNET_NAME(tcp_do_lrd), 1, + "Perform Lost Retransmission Detection"); + VNET_DEFINE(int, tcp_do_newcwv) = 0; SYSCTL_INT(_net_inet_tcp, OID_AUTO, newcwv, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_do_newcwv), 0, @@ -2523,9 +2528,12 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, } if ((tp->t_flags & TF_SACK_PERMIT) && ((to.to_flags & TOF_SACK) || - !TAILQ_EMPTY(&tp->snd_holes))) - sack_changed = tcp_sack_doack(tp, &to, th->th_ack); - else + !TAILQ_EMPTY(&tp->snd_holes))) { + if (((sack_changed = tcp_sack_doack(tp, &to, th->th_ack)) != 0) && + (tp->t_flags & TF_LRD)) { + tcp_sack_lost_retransmission(tp, th); + } + } else /* * Reset the value so that previous (valid) value * from the last ack with SACK doesn't get used. diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 5bda2be14df0..20b9c0371122 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1264,6 +1264,14 @@ send: } else { th->th_seq = htonl(p->rxmit); p->rxmit += len; + /* + * Lost Retransmission Detection + * trigger resending of a (then + * still existing) hole, when + * fack acks recoverypoint. + */ + if ((tp->t_flags & TF_LRD) && SEQ_GEQ(p->rxmit, p->end)) + p->rxmit = tp->snd_recover; tp->sackhint.sack_bytes_rexmit += len; } if (IN_RECOVERY(tp->t_flags)) { diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c index 96056b5efd4d..9753536926d5 100644 --- a/sys/netinet/tcp_sack.c +++ b/sys/netinet/tcp_sack.c @@ -119,6 +119,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef TCPDEBUG #include #endif /* TCPDEBUG */ @@ -730,7 +731,8 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tcp_seq th_ack) cur = TAILQ_PREV(cur, sackhole_head, scblink); continue; } - tp->sackhint.sack_bytes_rexmit -= (cur->rxmit - cur->start); + tp->sackhint.sack_bytes_rexmit -= + (SEQ_MIN(cur->rxmit, cur->end) - cur->start); KASSERT(tp->sackhint.sack_bytes_rexmit >= 0, ("sackhint bytes rtx >= 0")); sack_changed = 1; @@ -761,6 +763,8 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tcp_seq th_ack) delivered_data += (cur->end - sblkp->start); cur->end = sblkp->start; cur->rxmit = SEQ_MIN(cur->rxmit, cur->end); + if ((tp->t_flags & TF_LRD) && SEQ_GEQ(cur->rxmit, cur->end)) + cur->rxmit = tp->snd_recover; } else { /* * ACKs some data in middle of a hole; need @@ -771,18 +775,21 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tcp_seq th_ack) if (temp != NULL) { if (SEQ_GT(cur->rxmit, temp->rxmit)) { temp->rxmit = cur->rxmit; - tp->sackhint.sack_bytes_rexmit - += (temp->rxmit - - temp->start); + tp->sackhint.sack_bytes_rexmit += + (SEQ_MIN(temp->rxmit, + temp->end) - temp->start); } cur->end = sblkp->start; cur->rxmit = SEQ_MIN(cur->rxmit, cur->end); + if ((tp->t_flags & TF_LRD) && SEQ_GEQ(cur->rxmit, cur->end)) + cur->rxmit = tp->snd_recover; delivered_data += (sblkp->end - sblkp->start); } } } - tp->sackhint.sack_bytes_rexmit += (cur->rxmit - cur->start); + tp->sackhint.sack_bytes_rexmit += + (SEQ_MIN(cur->rxmit, cur->end) - cur->start); /* * Testing sblkp->start against cur->start tells us whether * we're done with the sack block or the sack hole. @@ -912,7 +919,7 @@ tcp_sack_output_debug(struct tcpcb *tp, int *sack_bytes_rexmt) *sack_bytes_rexmt += (p->rxmit - p->start); break; } - *sack_bytes_rexmt += (p->rxmit - p->start); + *sack_bytes_rexmt += (SEQ_MIN(p->rxmit, p->end) - p->start); } return (p); } @@ -989,3 +996,57 @@ tcp_sack_adjust(struct tcpcb *tp) return; tp->snd_nxt = tp->snd_fack; } + +/* + * Lost Retransmission Detection + * Check is FACK is beyond the rexmit of the leftmost hole. + * If yes, we restart sending from still existing holes, + * and adjust cwnd via the congestion control module. + */ +void +tcp_sack_lost_retransmission(struct tcpcb *tp, struct tcphdr *th) +{ + struct sackhole *temp; + uint32_t prev_cwnd; + if (IN_RECOVERY(tp->t_flags) && + SEQ_GT(tp->snd_fack, tp->snd_recover) && + ((temp = TAILQ_FIRST(&tp->snd_holes)) != NULL) && + SEQ_GEQ(temp->rxmit, temp->end) && + SEQ_GEQ(tp->snd_fack, temp->rxmit)) { + TCPSTAT_INC(tcps_sack_lostrexmt); + /* + * Start retransmissions from the first hole, and + * subsequently all other remaining holes, including + * those, which had been sent completely before. + */ + tp->sackhint.nexthole = temp; + TAILQ_FOREACH(temp, &tp->snd_holes, scblink) { + if (SEQ_GEQ(tp->snd_fack, temp->rxmit) && + SEQ_GEQ(temp->rxmit, temp->end)) + temp->rxmit = temp->start; + } + /* + * Remember the old ssthresh, to deduct the beta factor used + * by the CC module. Finally, set cwnd to ssthresh just + * prior to invoking another cwnd reduction by the CC + * module, to not shrink it excessively. + */ + prev_cwnd = tp->snd_cwnd; + tp->snd_cwnd = tp->snd_ssthresh; + /* + * Formally exit recovery, and let the CC module adjust + * ssthresh as intended. + */ + EXIT_RECOVERY(tp->t_flags); + cc_cong_signal(tp, th, CC_NDUPACK); + /* + * For PRR, adjust recover_fs as if this new reduction + * initialized this variable. + * cwnd will be adjusted by SACK or PRR processing + * subsequently, only set it to a safe value here. + */ + tp->snd_cwnd = tcp_maxseg(tp); + tp->sackhint.recover_fs = (tp->snd_max - tp->snd_una) - + tp->sackhint.recover_fs; + } +} diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 5f2997163471..c44f26f78a2f 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -2171,6 +2171,8 @@ tcp_newtcpcb(struct inpcb *inp) if (V_tcp_perconn_stats_enable == 1) tp->t_stats = stats_blob_alloc(V_tcp_perconn_stats_dflt_tpl, 0); #endif + if (V_tcp_do_lrd) + tp->t_flags |= TF_LRD; return (tp); /* XXX */ } diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index cbc36860bf32..061681ddc2bc 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -2001,6 +2001,7 @@ tcp_default_ctloutput(struct socket *so, struct sockopt *sopt, struct inpcb *inp case TCP_NODELAY: case TCP_NOOPT: + case TCP_LRD: INP_WUNLOCK(inp); error = sooptcopyin(sopt, &optval, sizeof optval, sizeof optval); @@ -2015,6 +2016,9 @@ tcp_default_ctloutput(struct socket *so, struct sockopt *sopt, struct inpcb *inp case TCP_NOOPT: opt = TF_NOOPT; break; + case TCP_LRD: + opt = TF_LRD; + break; default: opt = 0; /* dead code to fool gcc */ break; @@ -2562,6 +2566,11 @@ unhold: error = sooptcopyout(sopt, &optval, sizeof(optval)); break; #endif + case TCP_LRD: + optval = tp->t_flags & TF_LRD; + INP_WUNLOCK(inp); + error = sooptcopyout(sopt, &optval, sizeof optval); + break; default: INP_WUNLOCK(inp); error = ENOPROTOOPT; diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 515362c6bf9e..b80746b1ede4 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -410,7 +410,7 @@ TAILQ_HEAD(tcp_funchead, tcp_function); #define TF_TOE 0x02000000 /* this connection is offloaded */ #define TF_WAKESOW 0x04000000 /* wake up send socket */ #define TF_UNUSED1 0x08000000 /* unused */ -#define TF_UNUSED2 0x10000000 /* unused */ +#define TF_LRD 0x10000000 /* Lost Retransmission Detection */ #define TF_CONGRECOVERY 0x20000000 /* congestion recovery mode */ #define TF_WASCRECOVERY 0x40000000 /* was in congestion recovery */ #define TF_FASTOPEN 0x80000000 /* TCP Fast Open indication */ @@ -673,6 +673,7 @@ struct tcpstat { uint64_t tcps_sack_rexmit_bytes; /* SACK rexmit bytes */ uint64_t tcps_sack_rcv_blocks; /* SACK blocks (options) received */ uint64_t tcps_sack_send_blocks; /* SACK blocks (options) sent */ + uint64_t tcps_sack_lostrexmt; /* SACK lost retransmission recovered */ uint64_t tcps_sack_sboverflow; /* times scoreboard overflowed */ /* ECN related stats */ @@ -697,7 +698,7 @@ struct tcpstat { uint64_t tcps_tunneled_pkts; /* Packets encap's in UDP received */ uint64_t tcps_tunneled_errs; /* Packets that had errors that were UDP encaped */ - uint64_t _pad[10]; /* 6 UTO, 6 TBD */ + uint64_t _pad[9]; /* 6 UTO, 3 TBD */ }; #define tcps_rcvmemdrop tcps_rcvreassfull /* compat */ @@ -859,6 +860,7 @@ VNET_DECLARE(int, tcp_delack_enabled); VNET_DECLARE(int, tcp_do_autorcvbuf); VNET_DECLARE(int, tcp_do_autosndbuf); VNET_DECLARE(int, tcp_do_ecn); +VNET_DECLARE(int, tcp_do_lrd); VNET_DECLARE(int, tcp_do_prr); VNET_DECLARE(int, tcp_do_prr_conservative); VNET_DECLARE(int, tcp_do_newcwv); @@ -893,6 +895,7 @@ VNET_DECLARE(int, tcp_udp_tunneling_port); VNET_DECLARE(struct inpcbhead, tcb); VNET_DECLARE(struct inpcbinfo, tcbinfo); +#define V_tcp_do_lrd VNET(tcp_do_lrd) #define V_tcp_do_prr VNET(tcp_do_prr) #define V_tcp_do_prr_conservative VNET(tcp_do_prr_conservative) #define V_tcp_do_newcwv VNET(tcp_do_newcwv) @@ -1091,8 +1094,10 @@ void tcp_clean_sackreport(struct tcpcb *tp); void tcp_sack_adjust(struct tcpcb *tp); struct sackhole *tcp_sack_output(struct tcpcb *tp, int *sack_bytes_rexmt); void tcp_do_prr_ack(struct tcpcb *, struct tcphdr *, struct tcpopt *); +void tcp_lost_retransmission(struct tcpcb *, struct tcphdr *); void tcp_sack_partialack(struct tcpcb *, struct tcphdr *); void tcp_free_sackholes(struct tcpcb *tp); +void tcp_sack_lost_retransmission(struct tcpcb *, struct tcphdr *); int tcp_newreno(struct tcpcb *, struct tcphdr *); int tcp_compute_pipe(struct tcpcb *); uint32_t tcp_compute_initwnd(uint32_t); diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 49478c4a9247..45b107b42d39 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -809,6 +809,8 @@ tcp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) "{N:/SACK option%s (SACK blocks) received}\n"); p(tcps_sack_send_blocks, "\t{:sent-option-blocks/%ju} " "{N:/SACK option%s (SACK blocks) sent}\n"); + p(tcps_sack_lostrexmit, "\t{:lost-retransmissions/%ju} " + "{N:/SACK retransmission%s lost}\n"); p1a(tcps_sack_sboverflow, "\t{:scoreboard-overflows/%ju} " "{N:/SACK scoreboard overflow}\n"); From owner-dev-commits-src-main@freebsd.org Mon May 10 18:50:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C53546403FA; Mon, 10 May 2021 18:50:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ff98n53kxz3wHg; Mon, 10 May 2021 18:50:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C74F18F6; Mon, 10 May 2021 18:50:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14AIo17Y028779; Mon, 10 May 2021 18:50:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14AIo1WJ028764; Mon, 10 May 2021 18:50:01 GMT (envelope-from git) Date: Mon, 10 May 2021 18:50:01 GMT Message-Id: <202105101850.14AIo1WJ028764@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: c55b340f824d - main - netstat: fix typo from 0471a8c73402 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c55b340f824d353b7581e8ccf94ecd4929a41ea5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2021 18:50:01 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=c55b340f824d353b7581e8ccf94ecd4929a41ea5 commit c55b340f824d353b7581e8ccf94ecd4929a41ea5 Author: Richard Scheffenegger AuthorDate: 2021-05-10 18:49:19 +0000 Commit: Richard Scheffenegger CommitDate: 2021-05-10 18:49:19 +0000 netstat: fix typo from 0471a8c73402 --- usr.bin/netstat/inet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 45b107b42d39..1143c09734e4 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -809,7 +809,7 @@ tcp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) "{N:/SACK option%s (SACK blocks) received}\n"); p(tcps_sack_send_blocks, "\t{:sent-option-blocks/%ju} " "{N:/SACK option%s (SACK blocks) sent}\n"); - p(tcps_sack_lostrexmit, "\t{:lost-retransmissions/%ju} " + p(tcps_sack_lostrexmt, "\t{:lost-retransmissions/%ju} " "{N:/SACK retransmission%s lost}\n"); p1a(tcps_sack_sboverflow, "\t{:scoreboard-overflows/%ju} " "{N:/SACK scoreboard overflow}\n"); From owner-dev-commits-src-main@freebsd.org Mon May 10 23:40:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0CDC46460A1; Mon, 10 May 2021 23:40:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FfHbQ70KLz4dw2; Mon, 10 May 2021 23:40:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D865D5A91; Mon, 10 May 2021 23:40:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14ANe28D012139; Mon, 10 May 2021 23:40:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14ANe2ro012136; Mon, 10 May 2021 23:40:02 GMT (envelope-from git) Date: Mon, 10 May 2021 23:40:02 GMT Message-Id: <202105102340.14ANe2ro012136@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 5e7cdf181792 - main - openat(2): add O_EMPTY_PATH MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5e7cdf1817924f8ae0333c0b53c2da32f35b65ea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2021 23:40:03 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5e7cdf1817924f8ae0333c0b53c2da32f35b65ea commit 5e7cdf1817924f8ae0333c0b53c2da32f35b65ea Author: Konstantin Belousov AuthorDate: 2021-05-06 17:16:53 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-10 23:39:24 +0000 openat(2): add O_EMPTY_PATH It reopens the passed file descriptor, checking the file backing vnode' current access rights against open mode. In particular, this flag allows to convert file descriptor opened with O_PATH, into operable file descriptor, assuming permissions allow that. Reviewed by: markj Tested by: Andrew Walker Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30148 --- lib/libc/sys/open.2 | 18 +++++++++++++++++- sys/kern/vfs_vnops.c | 2 ++ sys/sys/fcntl.h | 3 +++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2 index a7806df69daf..5a6f161291f6 100644 --- a/lib/libc/sys/open.2 +++ b/lib/libc/sys/open.2 @@ -28,7 +28,7 @@ .\" @(#)open.2 8.2 (Berkeley) 11/16/93 .\" $FreeBSD$ .\" -.Dd March 18, 2021 +.Dd May 6, 2021 .Dt OPEN 2 .Os .Sh NAME @@ -169,6 +169,7 @@ O_CLOEXEC set FD_CLOEXEC upon open O_VERIFY verify the contents of the file O_RESOLVE_BENEATH path resolution must not cross the fd directory O_PATH record only the target path in the opened descriptor +O_EMPTY_PATH openat, open file referenced by fd if path is empty .Ed .Pp Opening a file with @@ -355,6 +356,21 @@ are not allowed. File opened with the .Dv O_PATH flag does not prevent non-forced unmount of the volume it belongs to. +.Pp +A file descriptor created with the +.Dv O_PATH +flag can be opened into normal (operable) file descriptor by +specifying it as the +.Fa fd +argument to +.Fn openat +with empty +.Fa path +and flag +.Dv O_EMPTY_PATH . +Such an open behaves as if the current path of the file referenced by +.Fa fd +is passed, except that the path walk permissions are not checked. See also the description of .Dv AT_EMPTY_PATH flag for diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index d4396f67a67b..670bc4bf8fcc 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -200,6 +200,8 @@ open2nameif(int fmode, u_int vn_open_flags) res = ISOPEN | LOCKLEAF; if ((fmode & O_RESOLVE_BENEATH) != 0) res |= RBENEATH; + if ((fmode & O_EMPTY_PATH) != 0) + res |= EMPTYPATH; if ((vn_open_flags & VN_OPEN_NOAUDIT) == 0) res |= AUDITVNODE1; if ((vn_open_flags & VN_OPEN_NOCAPCHECK) != 0) diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h index 58d46ae26338..8fa52aeacafd 100644 --- a/sys/sys/fcntl.h +++ b/sys/sys/fcntl.h @@ -141,6 +141,9 @@ typedef __pid_t pid_t; #endif #define O_DSYNC 0x01000000 /* POSIX data sync */ +#if __BSD_VISIBLE +#define O_EMPTY_PATH 0x02000000 +#endif /* * XXX missing O_RSYNC. From owner-dev-commits-src-main@freebsd.org Mon May 10 23:48:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5AA30645FE4; Mon, 10 May 2021 23:48:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FfHn924tHz4djg; Mon, 10 May 2021 23:48:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3AE8255EF; Mon, 10 May 2021 23:48:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14ANmTMi023125; Mon, 10 May 2021 23:48:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14ANmTFC023124; Mon, 10 May 2021 23:48:29 GMT (envelope-from git) Date: Mon, 10 May 2021 23:48:29 GMT Message-Id: <202105102348.14ANmTFC023124@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 630caa95d461 - main - rtld: preserve the 'seen' state of the dlerror message in errmsg_save() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 630caa95d46191220dd457c2ae2d06460cb4f71b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2021 23:48:29 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=630caa95d46191220dd457c2ae2d06460cb4f71b commit 630caa95d46191220dd457c2ae2d06460cb4f71b Author: Konstantin Belousov AuthorDate: 2021-05-10 19:02:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-10 23:47:00 +0000 rtld: preserve the 'seen' state of the dlerror message in errmsg_save() rtld preserves its current error message around calls to user init/fini lists, to not override original error with potential secondary errors caused by user code recursing into rtld. After 4d9128da54f8f8e2a29190, the preservation of the string itself is not enough, the 'seen' indicator must be preserved as well. Otherwise, since new code does not clear string (it cannot), call to _rtld_error() from errmsg_restore() revived whatever message was consumed last. Change errmsg_save() to return structure recording both 'seen' indicator and the message, if any. PR: 255698 Reported by: Eugene M. Kim Sponsored by: The FreeBSD Foundation MFC after: 3 days --- libexec/rtld-elf/rtld.c | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index fce455a0ee79..75c502e8cc85 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -81,6 +81,10 @@ extern struct r_debug r_debug; /* For GDB */ extern int _thread_autoinit_dummy_decl; extern void (*__cleanup)(void); +struct dlerror_save { + int seen; + char *msg; +}; /* * Function declarations. @@ -100,8 +104,8 @@ static Obj_Entry *dlopen_object(const char *name, int fd, Obj_Entry *refobj, static Obj_Entry *do_load_object(int, const char *, char *, struct stat *, int); static int do_search_info(const Obj_Entry *obj, int, struct dl_serinfo *); static bool donelist_check(DoneList *, const Obj_Entry *); -static void errmsg_restore(char *); -static char *errmsg_save(void); +static void errmsg_restore(struct dlerror_save *); +static struct dlerror_save *errmsg_save(void); static void *fill_search_info(const char *, size_t, void *); static char *find_library(const char *, const Obj_Entry *, int *); static const char *gethints(bool); @@ -941,10 +945,16 @@ _rtld_error(const char *fmt, ...) /* * Return a dynamically-allocated copy of the current error message, if any. */ -static char * +static struct dlerror_save * errmsg_save(void) { - return (xstrdup(lockinfo.dlerror_loc())); + struct dlerror_save *res; + + res = xmalloc(sizeof(*res)); + res->seen = *lockinfo.dlerror_seen(); + if (res->seen == 0) + res->msg = xstrdup(lockinfo.dlerror_loc()); + return (res); } /* @@ -952,14 +962,17 @@ errmsg_save(void) * by errmsg_save(). The copy is freed. */ static void -errmsg_restore(char *saved_msg) +errmsg_restore(struct dlerror_save *saved_msg) { - if (saved_msg == NULL) - _rtld_error(""); - else { - _rtld_error("%s", saved_msg); - free(saved_msg); + if (saved_msg == NULL || saved_msg->seen == 1) { + *lockinfo.dlerror_seen() = 1; + } else { + *lockinfo.dlerror_seen() = 0; + strlcpy(lockinfo.dlerror_loc(), saved_msg->msg, + lockinfo.dlerror_loc_sz); + free(saved_msg->msg); } + free(saved_msg); } static const char * @@ -2736,7 +2749,7 @@ static void objlist_call_fini(Objlist *list, Obj_Entry *root, RtldLockState *lockstate) { Objlist_Entry *elm; - char *saved_msg; + struct dlerror_save *saved_msg; Elf_Addr *fini_addr; int index; @@ -2812,7 +2825,7 @@ objlist_call_init(Objlist *list, RtldLockState *lockstate) { Objlist_Entry *elm; Obj_Entry *obj; - char *saved_msg; + struct dlerror_save *saved_msg; Elf_Addr *init_addr; void (*reg)(void (*)(void)); int index; From owner-dev-commits-src-main@freebsd.org Tue May 11 00:25:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C8FD64757F; Tue, 11 May 2021 00:25:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FfJbk0H8Jz4gd0; Tue, 11 May 2021 00:25:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC5F56168; Tue, 11 May 2021 00:25:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14B0PLNY076266; Tue, 11 May 2021 00:25:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14B0PLN0076265; Tue, 11 May 2021 00:25:21 GMT (envelope-from git) Date: Tue, 11 May 2021 00:25:21 GMT Message-Id: <202105110025.14B0PLN0076265@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: c8bbb1272c8b - main - vfs: Fix error handling in vn_fullpath_hardlink() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c8bbb1272c8bc103cfaa42c7a1639f42b62483dd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 00:25:22 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c8bbb1272c8bc103cfaa42c7a1639f42b62483dd commit c8bbb1272c8bc103cfaa42c7a1639f42b62483dd Author: Mark Johnston AuthorDate: 2021-05-11 00:18:00 +0000 Commit: Mark Johnston CommitDate: 2021-05-11 00:22:27 +0000 vfs: Fix error handling in vn_fullpath_hardlink() vn_fullpath_any_smr() will return a positive error number if the caller-supplied buffer isn't big enough. In this case the error must be propagated up, otherwise we may copy out uninitialized bytes. Reported by: syzkaller+KMSAN Reviewed by: mjg, kib MFC aftr: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30198 --- sys/kern/vfs_cache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 2aaaecb5cd4d..607b1e67a40a 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3646,9 +3646,9 @@ vn_fullpath_hardlink(struct nameidata *ndp, char **retbuf, char **freebuf, error = vn_fullpath_dir(vp, pwd->pwd_rdir, buf, retbuf, buflen, addend); pwd_drop(pwd); - if (error != 0) - goto out_bad; } + if (error != 0) + goto out_bad; *freebuf = buf; From owner-dev-commits-src-main@freebsd.org Tue May 11 00:38:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 47FB6647FAB; Tue, 11 May 2021 00:38:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FfJtS1bFlz4hDP; Tue, 11 May 2021 00:38:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 298926721; Tue, 11 May 2021 00:38:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14B0c8vI091406; Tue, 11 May 2021 00:38:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14B0c8m6091405; Tue, 11 May 2021 00:38:08 GMT (envelope-from git) Date: Tue, 11 May 2021 00:38:08 GMT Message-Id: <202105110038.14B0c8m6091405@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: cb07628d9e7c - main - nfscl: Delete unneeded redundant MODULE_DEPEND() calls MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cb07628d9e7c84019f99e2dfeadbe0957e5c22e8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 00:38:08 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=cb07628d9e7c84019f99e2dfeadbe0957e5c22e8 commit cb07628d9e7c84019f99e2dfeadbe0957e5c22e8 Author: Rick Macklem AuthorDate: 2021-05-11 00:34:29 +0000 Commit: Rick Macklem CommitDate: 2021-05-11 00:34:29 +0000 nfscl: Delete unneeded redundant MODULE_DEPEND() calls There are two module declarations in the nfscl.ko module for "nfscl" and "nfs". Both of these declarations had MODULE_DEPEND() calls. This patch deletes the MODULE_DEPEND() calls for "nfs" to avoid confusion with respect to what modules this module is dependent upon. The patch also adds comments explaining why there are two module declarations within the module. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D30102 --- sys/fs/nfsclient/nfs_clport.c | 9 +++++++++ sys/fs/nfsclient/nfs_clvfsops.c | 14 ++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clport.c b/sys/fs/nfsclient/nfs_clport.c index 492b93340e4e..4676f09f8e86 100644 --- a/sys/fs/nfsclient/nfs_clport.c +++ b/sys/fs/nfsclient/nfs_clport.c @@ -1438,6 +1438,14 @@ static moduledata_t nfscl_mod = { nfscl_modevent, NULL, }; +/* + * This is the main module declaration for the NFS client. The + * nfscl_modevent() function is needed to ensure that the module + * cannot be unloaded, among other things. + * There is also a module declaration in sys/fs/nfsclient/nfs_clvfsops.c + * for the name "nfs" within the VFS_SET() macro that defines the "nfs" + * file system type. + */ DECLARE_MODULE(nfscl, nfscl_mod, SI_SUB_VFS, SI_ORDER_FIRST); /* So that loader and kldload(2) can find us, wherever we are.. */ @@ -1445,3 +1453,4 @@ MODULE_VERSION(nfscl, 1); MODULE_DEPEND(nfscl, nfscommon, 1, 1, 1); MODULE_DEPEND(nfscl, krpc, 1, 1, 1); MODULE_DEPEND(nfscl, nfssvc, 1, 1, 1); +MODULE_DEPEND(nfscl, xdr, 1, 1, 1); diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c index 08a25c6fe632..847bf72acf0c 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -148,14 +147,17 @@ static struct vfsops nfs_vfsops = { .vfs_sysctl = nfs_sysctl, .vfs_purge = nfs_purge, }; +/* + * This macro declares that the file system type is named "nfs". + * It also declares a module name of "nfs" and uses vfs_modevent() + * as the event handling function. + * The main module declaration is found in sys/fs/nfsclient/nfs_clport.c + * for "nfscl" and is needed so that a custom event handling + * function gets called. MODULE_DEPEND() macros are found there. + */ VFS_SET(nfs_vfsops, nfs, VFCF_NETWORK | VFCF_SBDRY); -/* So that loader and kldload(2) can find us, wherever we are.. */ MODULE_VERSION(nfs, 1); -MODULE_DEPEND(nfs, nfscommon, 1, 1, 1); -MODULE_DEPEND(nfs, krpc, 1, 1, 1); -MODULE_DEPEND(nfs, nfssvc, 1, 1, 1); -MODULE_DEPEND(nfs, xdr, 1, 1, 1); /* * This structure is now defined in sys/nfs/nfs_diskless.c so that it From owner-dev-commits-src-main@freebsd.org Tue May 11 02:26:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6C8E64C1B8; Tue, 11 May 2021 02:26:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FfMHJ6Cmlz4nxC; Tue, 11 May 2021 02:26:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C821F7C40; Tue, 11 May 2021 02:26:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14B2QKOP037484; Tue, 11 May 2021 02:26:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14B2QKrm037483; Tue, 11 May 2021 02:26:20 GMT (envelope-from git) Date: Tue, 11 May 2021 02:26:20 GMT Message-Id: <202105110226.14B2QKrm037483@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 31c3770ee5b7 - main - powerpc/mmu: Actually use the Radix pmap_align_superpage function MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 31c3770ee5b7017ecee79ff9b98db915f2b97653 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 02:26:21 -0000 The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=31c3770ee5b7017ecee79ff9b98db915f2b97653 commit 31c3770ee5b7017ecee79ff9b98db915f2b97653 Author: Justin Hibbits AuthorDate: 2021-05-11 02:23:04 +0000 Commit: Justin Hibbits CommitDate: 2021-05-11 02:26:14 +0000 powerpc/mmu: Actually use the Radix pmap_align_superpage function This was missed in the conversion to ifuncs. It might help improve promotion rates. --- sys/powerpc/aim/mmu_radix.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index bb43b64febff..5c1bd6e7ea02 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -512,6 +512,7 @@ static struct pmap_funcs mmu_radix_methods = { .dumpsys_map_chunk = mmu_radix_dumpsys_map, .page_is_mapped = mmu_radix_page_is_mapped, .ps_enabled = mmu_radix_ps_enabled, + .align_superpage = mmu_radix_align_superpage, .object_init_pt = mmu_radix_object_init_pt, .protect = mmu_radix_protect, /* pmap dispatcher interface */ From owner-dev-commits-src-main@freebsd.org Tue May 11 02:26:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5155964C41B; Tue, 11 May 2021 02:26:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FfMHL0MGmz4nhv; Tue, 11 May 2021 02:26:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA6477C41; Tue, 11 May 2021 02:26:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14B2QLMU037505; Tue, 11 May 2021 02:26:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14B2QLDx037504; Tue, 11 May 2021 02:26:21 GMT (envelope-from git) Date: Tue, 11 May 2021 02:26:21 GMT Message-Id: <202105110226.14B2QLDx037504@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: a436e6653142 - main - powerpc/radix pmap: Convert stat counters from ulongs to counters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a436e665314276c8ab4cb3264f5f7cb0f29d7506 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 02:26:22 -0000 The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=a436e665314276c8ab4cb3264f5f7cb0f29d7506 commit a436e665314276c8ab4cb3264f5f7cb0f29d7506 Author: Justin Hibbits AuthorDate: 2021-05-11 02:23:14 +0000 Commit: Justin Hibbits CommitDate: 2021-05-11 02:26:14 +0000 powerpc/radix pmap: Convert stat counters from ulongs to counters This should help performance a hair, for concurrent stat updates, by reducing contention on cache lines. --- sys/powerpc/aim/mmu_radix.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index 5c1bd6e7ea02..01fcc94bafb5 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -2366,28 +2366,28 @@ mmu_radix_cpu_bootstrap(int ap) static SYSCTL_NODE(_vm_pmap, OID_AUTO, l3e, CTLFLAG_RD, 0, "2MB page mapping counters"); -static u_long pmap_l3e_demotions; -SYSCTL_ULONG(_vm_pmap_l3e, OID_AUTO, demotions, CTLFLAG_RD, - &pmap_l3e_demotions, 0, "2MB page demotions"); +static COUNTER_U64_DEFINE_EARLY(pmap_l3e_demotions); +SYSCTL_COUNTER_U64(_vm_pmap_l3e, OID_AUTO, demotions, CTLFLAG_RD, + &pmap_l3e_demotions, "2MB page demotions"); -static u_long pmap_l3e_mappings; -SYSCTL_ULONG(_vm_pmap_l3e, OID_AUTO, mappings, CTLFLAG_RD, - &pmap_l3e_mappings, 0, "2MB page mappings"); +static COUNTER_U64_DEFINE_EARLY(pmap_l3e_mappings); +SYSCTL_COUNTER_U64(_vm_pmap_l3e, OID_AUTO, mappings, CTLFLAG_RD, + &pmap_l3e_mappings, "2MB page mappings"); -static u_long pmap_l3e_p_failures; -SYSCTL_ULONG(_vm_pmap_l3e, OID_AUTO, p_failures, CTLFLAG_RD, - &pmap_l3e_p_failures, 0, "2MB page promotion failures"); +static COUNTER_U64_DEFINE_EARLY(pmap_l3e_p_failures); +SYSCTL_COUNTER_U64(_vm_pmap_l3e, OID_AUTO, p_failures, CTLFLAG_RD, + &pmap_l3e_p_failures, "2MB page promotion failures"); -static u_long pmap_l3e_promotions; -SYSCTL_ULONG(_vm_pmap_l3e, OID_AUTO, promotions, CTLFLAG_RD, - &pmap_l3e_promotions, 0, "2MB page promotions"); +static COUNTER_U64_DEFINE_EARLY(pmap_l3e_promotions); +SYSCTL_COUNTER_U64(_vm_pmap_l3e, OID_AUTO, promotions, CTLFLAG_RD, + &pmap_l3e_promotions, "2MB page promotions"); static SYSCTL_NODE(_vm_pmap, OID_AUTO, l2e, CTLFLAG_RD, 0, "1GB page mapping counters"); -static u_long pmap_l2e_demotions; -SYSCTL_ULONG(_vm_pmap_l2e, OID_AUTO, demotions, CTLFLAG_RD, - &pmap_l2e_demotions, 0, "1GB page demotions"); +static COUNTER_U64_DEFINE_EARLY(pmap_l2e_demotions); +SYSCTL_COUNTER_U64(_vm_pmap_l2e, OID_AUTO, demotions, CTLFLAG_RD, + &pmap_l2e_demotions, "1GB page demotions"); void mmu_radix_clear_modify(vm_page_t m) @@ -2559,7 +2559,7 @@ mmu_radix_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, *l3e = htobe64(srcptepaddr & ~PG_W); pmap_resident_count_inc(dst_pmap, L3_PAGE_SIZE / PAGE_SIZE); - atomic_add_long(&pmap_l3e_mappings, 1); + counter_u64_add(pmap_l3e_mappings, 1); } else dst_pdpg->ref_count--; continue; @@ -2784,12 +2784,12 @@ setpte: pte_store(pde, PG_PROMOTED | newpde); ptesync(); - atomic_add_long(&pmap_l3e_promotions, 1); + counter_u64_add(pmap_l3e_promotions, 1); CTR2(KTR_PMAP, "pmap_promote_l3e: success for va %#lx" " in pmap %p", va, pmap); return (0); fail: - atomic_add_long(&pmap_l3e_p_failures, 1); + counter_u64_add(pmap_l3e_p_failures, 1); return (KERN_FAILURE); } #endif /* VM_NRESERVLEVEL > 0 */ @@ -3246,7 +3246,7 @@ pmap_enter_l3e(pmap_t pmap, vm_offset_t va, pml3_entry_t newpde, u_int flags, pte_store(l3e, newpde); ptesync(); - atomic_add_long(&pmap_l3e_mappings, 1); + counter_u64_add(pmap_l3e_mappings, 1); CTR2(KTR_PMAP, "pmap_enter_pde: success for va %#lx" " in pmap %p", va, pmap); return (KERN_SUCCESS); @@ -4037,7 +4037,7 @@ mmu_radix_object_init_pt(pmap_t pmap, vm_offset_t addr, pa |= PG_M | PG_A | PG_RW; pte_store(l3e, pa); pmap_resident_count_inc(pmap, L3_PAGE_SIZE / PAGE_SIZE); - atomic_add_long(&pmap_l3e_mappings, 1); + counter_u64_add(pmap_l3e_mappings, 1); } else { /* Continue on if the PDE is already valid. */ pdpg->ref_count--; @@ -4953,7 +4953,7 @@ pmap_demote_l3e_locked(pmap_t pmap, pml3_entry_t *l3e, vm_offset_t va, if ((oldpde & PG_MANAGED) != 0) pmap_pv_demote_l3e(pmap, va, oldpde & PG_PS_FRAME, lockp); - atomic_add_long(&pmap_l3e_demotions, 1); + counter_u64_add(pmap_l3e_demotions, 1); CTR2(KTR_PMAP, "pmap_demote_l3e: success for va %#lx" " in pmap %p", va, pmap); return (TRUE); @@ -5950,7 +5950,7 @@ pmap_demote_l2e(pmap_t pmap, pml2_entry_t *l2e, vm_offset_t va) */ pmap_invalidate_all(pmap); - pmap_l2e_demotions++; + counter_u64_add(pmap_l2e_demotions, 1); CTR2(KTR_PMAP, "pmap_demote_pdpe: success for va %#lx" " in pmap %p", va, pmap); return (TRUE); From owner-dev-commits-src-main@freebsd.org Tue May 11 04:30:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C6EFA64EC63; Tue, 11 May 2021 04:30:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FfQ2M5KBTz4th6; Tue, 11 May 2021 04:30:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A9F631174A; Tue, 11 May 2021 04:30:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14B4UJ08003822; Tue, 11 May 2021 04:30:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14B4UJxA003819; Tue, 11 May 2021 04:30:19 GMT (envelope-from git) Date: Tue, 11 May 2021 04:30:19 GMT Message-Id: <202105110430.14B4UJxA003819@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 12288bd999ca - main - cache: fix lockless absolute symlink traversal to non-fp mounts MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 12288bd999ca3a493b8dc4cba109e5a8fa838c45 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 04:30:19 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=12288bd999ca3a493b8dc4cba109e5a8fa838c45 commit 12288bd999ca3a493b8dc4cba109e5a8fa838c45 Author: Mateusz Guzik AuthorDate: 2021-05-11 03:48:08 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-11 04:30:12 +0000 cache: fix lockless absolute symlink traversal to non-fp mounts Said lookups would incorrectly fail with EOPNOTSUP. Reported by: kib --- sys/kern/vfs_cache.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 607b1e67a40a..5b978511db17 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3904,6 +3904,7 @@ struct cache_fpl { #endif }; +static bool cache_fplookup_mp_supported(struct mount *mp); static bool cache_fplookup_is_mp(struct cache_fpl *fpl); static int cache_fplookup_cross_mount(struct cache_fpl *fpl); static int cache_fplookup_partial_setup(struct cache_fpl *fpl); @@ -5142,6 +5143,19 @@ cache_fplookup_symlink(struct cache_fpl *fpl) if (seqc_in_modify(fpl->dvp_seqc)) { return (cache_fpl_aborted(fpl)); } + /* + * The main loop assumes that ->dvp points to a vnode belonging + * to a filesystem which can do lockless lookup, but the absolute + * symlink can be wandering off to one which does not. + */ + mp = atomic_load_ptr(&fpl->dvp->v_mount); + if (__predict_false(mp == NULL)) { + return (cache_fpl_aborted(fpl)); + } + if (!cache_fplookup_mp_supported(mp)) { + cache_fpl_checkpoint(fpl); + return (cache_fpl_partial(fpl)); + } } return (0); } From owner-dev-commits-src-main@freebsd.org Tue May 11 06:12:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8F4D0629493; Tue, 11 May 2021 06:12:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FfSHt3kBZz3Fl5; Tue, 11 May 2021 06:12:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72D8913491; Tue, 11 May 2021 06:12:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14B6CAlV043051; Tue, 11 May 2021 06:12:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14B6CAF0043050; Tue, 11 May 2021 06:12:10 GMT (envelope-from git) Date: Tue, 11 May 2021 06:12:10 GMT Message-Id: <202105110612.14B6CAF0043050@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: 9e16b9530aab - main - Clean up copyright messages. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9e16b9530aab5e1c4efee2a8fe2feaf33340c764 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 06:12:10 -0000 The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=9e16b9530aab5e1c4efee2a8fe2feaf33340c764 commit 9e16b9530aab5e1c4efee2a8fe2feaf33340c764 Author: Kirk McKusick AuthorDate: 2021-05-11 06:01:58 +0000 Commit: Kirk McKusick CommitDate: 2021-05-11 06:14:35 +0000 Clean up copyright messages. Reported by: Yoshihiro Ota MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29354 --- usr.bin/systat/sysput.c | 9 ++++----- usr.bin/systat/zarc.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/usr.bin/systat/sysput.c b/usr.bin/systat/sysput.c index 10401cee772a..e089c5c2ff55 100644 --- a/usr.bin/systat/sysput.c +++ b/usr.bin/systat/sysput.c @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2019, 2020 Yoshihiro Ota * * Redistribution and use in source and binary forms, with or without @@ -9,14 +11,11 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * 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 REGENTS OR CONTRIBUTORS BE LIABLE + * 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) diff --git a/usr.bin/systat/zarc.c b/usr.bin/systat/zarc.c index bb6aada8581c..41efe136779d 100644 --- a/usr.bin/systat/zarc.c +++ b/usr.bin/systat/zarc.c @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2014 - 2017, 2019 Yoshihiro Ota * * Redistribution and use in source and binary forms, with or without @@ -9,14 +11,11 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * 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 REGENTS OR CONTRIBUTORS BE LIABLE + * 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) From owner-dev-commits-src-main@freebsd.org Tue May 11 08:45:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D846762DB39; Tue, 11 May 2021 08:45:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FfWjL3SlTz3N3D; Tue, 11 May 2021 08:45:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A091151B7; Tue, 11 May 2021 08:45:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14B8jwQ1041863; Tue, 11 May 2021 08:45:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14B8jwdY041862; Tue, 11 May 2021 08:45:58 GMT (envelope-from git) Date: Tue, 11 May 2021 08:45:58 GMT Message-Id: <202105110845.14B8jwdY041862@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: f6f297871d46 - main - sbin/ipfw: Allow tablearg as hostname MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f6f297871d469daf808f78faead8f950a2c81e36 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 08:45:58 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=f6f297871d469daf808f78faead8f950a2c81e36 commit f6f297871d469daf808f78faead8f950a2c81e36 Author: Lutz Donnerhacke AuthorDate: 2021-05-11 08:22:16 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-11 08:44:33 +0000 sbin/ipfw: Allow tablearg as hostname Hostnames starting with "tablearg" are considered as a functional argument instead of a literal. Reported by: ae Reviewers: ae MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30208 --- sbin/ipfw/ipfw2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 498da22e6599..fb1d9a4a180b 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -4021,7 +4021,8 @@ chkarg: NEED1("missing forward address[:port]"); - if (strncmp(*av, "tablearg", 8) == 0) + if (strncmp(*av, "tablearg", 8) == 0 && + ((*av)[8] == '\0' || (*av)[8] == ',' || (*av)[8] == ':')) memcpy(++(*av), "0.0.0.0", 7); /* From owner-dev-commits-src-main@freebsd.org Tue May 11 09:53:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E97E4630213; Tue, 11 May 2021 09:53:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FfYCR6HTVz3hFy; Tue, 11 May 2021 09:53:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CAA0F16129; Tue, 11 May 2021 09:53:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14B9rdpM035167; Tue, 11 May 2021 09:53:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14B9rdFw035166; Tue, 11 May 2021 09:53:39 GMT (envelope-from git) Date: Tue, 11 May 2021 09:53:39 GMT Message-Id: <202105110953.14B9rdFw035166@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 3cbad8287aa0 - main - truss: Add missing underscore to compat_prefix for FreeBSD32 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3cbad8287aa0ed72e07df1130ce2ae490642e63a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 09:53:40 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=3cbad8287aa0ed72e07df1130ce2ae490642e63a commit 3cbad8287aa0ed72e07df1130ce2ae490642e63a Author: Alex Richardson AuthorDate: 2021-05-11 09:52:56 +0000 Commit: Alex Richardson CommitDate: 2021-05-11 09:53:02 +0000 truss: Add missing underscore to compat_prefix for FreeBSD32 I accidentally dropped this in the final version of D27625, so it didn't actually work as intended. I found this while testing the MFC to stable/13. MFC after: immediately Fixes: 7daca4e2043f ("truss: improved support for decoding compat32 arguments") --- usr.bin/truss/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/truss/setup.c b/usr.bin/truss/setup.c index 31c20d656b6a..78be0c7f570f 100644 --- a/usr.bin/truss/setup.c +++ b/usr.bin/truss/setup.c @@ -106,7 +106,7 @@ static struct procabi freebsd32 = { .type = "FreeBSD32", .abi = SYSDECODE_ABI_FREEBSD32, .pointer_size = sizeof(uint32_t), - .compat_prefix = "freebsd32", + .compat_prefix = "freebsd32_", .extra_syscalls = STAILQ_HEAD_INITIALIZER(freebsd32.extra_syscalls), .syscalls = { NULL } }; From owner-dev-commits-src-main@freebsd.org Tue May 11 10:37:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 229896323C9; Tue, 11 May 2021 10:37:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FfZB40VGsz3kVZ; Tue, 11 May 2021 10:37:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 040E5167D3; Tue, 11 May 2021 10:37:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14BAbVeq090519; Tue, 11 May 2021 10:37:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14BAbVuU090518; Tue, 11 May 2021 10:37:31 GMT (envelope-from git) Date: Tue, 11 May 2021 10:37:31 GMT Message-Id: <202105111037.14BAbVuU090518@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 65634ae748e7 - main - mroute: fix race condition during mrouter shutting down MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 65634ae748e7f6b7b9f11e8838c65060c3f31347 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 10:37:32 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=65634ae748e7f6b7b9f11e8838c65060c3f31347 commit 65634ae748e7f6b7b9f11e8838c65060c3f31347 Author: Wojciech Macek AuthorDate: 2021-04-23 03:57:03 +0000 Commit: Wojciech Macek CommitDate: 2021-05-11 10:34:20 +0000 mroute: fix race condition during mrouter shutting down There is a race condition between V_ip_mrouter de-init and ip_mforward handling. It might happen that mrouted is cleaned up after V_ip_mrouter check and before processing packet in ip_mforward. Use epoch call aproach, similar to IPSec which also handles such case. Reported by: Damien Deville Obtained from: Stormshield Reviewed by: mw Differential Revision: https://reviews.freebsd.org/D29946 --- sys/netinet/ip_input.c | 9 ++++++++- sys/netinet/ip_mroute.c | 2 ++ sys/netinet/ip_mroute.h | 5 +++++ sys/netinet/ip_output.c | 5 +++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index a85f8ac7b567..43d375c2385f 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -451,6 +452,7 @@ ip_direct_input(struct mbuf *m) void ip_input(struct mbuf *m) { + MROUTER_RLOCK_TRACKER; struct rm_priotracker in_ifa_tracker; struct ip *ip = NULL; struct in_ifaddr *ia = NULL; @@ -743,6 +745,7 @@ passin: return; } if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) { + MROUTER_RLOCK(); if (V_ip_mrouter) { /* * If we are acting as a multicast router, all @@ -753,6 +756,7 @@ passin: * must be discarded, else it may be accepted below. */ if (ip_mforward && ip_mforward(ip, ifp, m, 0) != 0) { + MROUTER_RUNLOCK(); IPSTAT_INC(ips_cantforward); m_freem(m); return; @@ -763,10 +767,13 @@ passin: * all multicast IGMP packets, whether or not this * host belongs to their destination groups. */ - if (ip->ip_p == IPPROTO_IGMP) + if (ip->ip_p == IPPROTO_IGMP) { + MROUTER_RUNLOCK(); goto ours; + } IPSTAT_INC(ips_forward); } + MROUTER_RUNLOCK(); /* * Assume the packet is for us, to avoid prematurely taking * a lock on the in_multi hash. Protocols must perform diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index b66fe8df0793..8ecc983ea58f 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -720,6 +720,8 @@ X_ip_mrouter_done(void) ip_mrouter_cnt--; V_mrt_api_config = 0; + MROUTER_WAIT(); + VIF_LOCK(); /* diff --git a/sys/netinet/ip_mroute.h b/sys/netinet/ip_mroute.h index 054eb921d3df..6ef99c0172f3 100644 --- a/sys/netinet/ip_mroute.h +++ b/sys/netinet/ip_mroute.h @@ -355,6 +355,11 @@ extern int (*ip_mrouter_get)(struct socket *, struct sockopt *); extern int (*ip_mrouter_done)(void); extern int (*mrt_ioctl)(u_long, caddr_t, int); +#define MROUTER_RLOCK_TRACKER struct epoch_tracker mrouter_et +#define MROUTER_RLOCK() epoch_enter_preempt(net_epoch_preempt, &mrouter_et) +#define MROUTER_RUNLOCK() epoch_exit_preempt(net_epoch_preempt, &mrouter_et) +#define MROUTER_WAIT() epoch_wait_preempt(net_epoch_preempt) + #endif /* _KERNEL */ #endif /* _NETINET_IP_MROUTE_H_ */ diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 405490e890c0..f913a2591fcc 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -319,6 +320,7 @@ int ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags, struct ip_moptions *imo, struct inpcb *inp) { + MROUTER_RLOCK_TRACKER; struct rm_priotracker in_ifa_tracker; struct ip *ip; struct ifnet *ifp = NULL; /* keep compiler happy */ @@ -613,6 +615,7 @@ again: * above, will be forwarded by the ip_input() routine, * if necessary. */ + MROUTER_RLOCK(); if (V_ip_mrouter && (flags & IP_FORWARDING) == 0) { /* * If rsvp daemon is not running, do not @@ -624,10 +627,12 @@ again: imo = NULL; if (ip_mforward && ip_mforward(ip, ifp, m, imo) != 0) { + MROUTER_RUNLOCK(); m_freem(m); goto done; } } + MROUTER_RUNLOCK(); } /* From owner-dev-commits-src-main@freebsd.org Tue May 11 10:37:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4B69E6324A2; Tue, 11 May 2021 10:37:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FfZB51RMnz3kXw; Tue, 11 May 2021 10:37:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2182016A10; Tue, 11 May 2021 10:37:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14BAbXrA090542; Tue, 11 May 2021 10:37:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14BAbXtl090541; Tue, 11 May 2021 10:37:33 GMT (envelope-from git) Date: Tue, 11 May 2021 10:37:33 GMT Message-Id: <202105111037.14BAbXtl090541@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 0b103f72376b - main - mrouter: do not loopback packets unconditionally MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0b103f72376b5ec7c9a9d574c976e42805ae88a4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 10:37:33 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=0b103f72376b5ec7c9a9d574c976e42805ae88a4 commit 0b103f72376b5ec7c9a9d574c976e42805ae88a4 Author: Wojciech Macek AuthorDate: 2021-04-23 06:49:27 +0000 Commit: Wojciech Macek CommitDate: 2021-05-11 10:36:07 +0000 mrouter: do not loopback packets unconditionally Looping back router multicast traffic signifficantly stresses network stack. Add possibility to disable or enable loopbacked based on sysctl value. Reported by: Daniel Deville Reviewed by: mw Differential Revision: https://reviews.freebsd.org/D29947 --- sys/netinet/ip_mroute.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index 8ecc983ea58f..b8e677ba9af1 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -244,6 +244,8 @@ static const struct encaptab *pim_encap_cookie; static int pim_encapcheck(const struct mbuf *, int, int, void *); static int pim_input(struct mbuf *, int, int, void *); +extern int in_mcast_loop; + static const struct encap_config ipv4_encap_cfg = { .proto = IPPROTO_PIM, .min_length = sizeof(struct ip) + PIM_MINLEN, @@ -1685,7 +1687,7 @@ send_packet(struct vif *vifp, struct mbuf *m) imo.imo_multicast_ifp = vifp->v_ifp; imo.imo_multicast_ttl = mtod(m, struct ip *)->ip_ttl - 1; - imo.imo_multicast_loop = 1; + imo.imo_multicast_loop = !!in_mcast_loop; imo.imo_multicast_vif = -1; STAILQ_INIT(&imo.imo_head); From owner-dev-commits-src-main@freebsd.org Tue May 11 12:18:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A499B635C62; Tue, 11 May 2021 12:18:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FfcQT4Hjrz3q2b; Tue, 11 May 2021 12:18:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8621417E27; Tue, 11 May 2021 12:18:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14BCIPJg022990; Tue, 11 May 2021 12:18:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14BCIP72022989; Tue, 11 May 2021 12:18:25 GMT (envelope-from git) Date: Tue, 11 May 2021 12:18:25 GMT Message-Id: <202105111218.14BCIP72022989@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: 4b86a24a76a4 - main - tcp: In rack, we must only convert restored rtt when the hostcache does restore them. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4b86a24a76a4d58c1d870fcb2252b321f61cb3cc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 12:18:25 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=4b86a24a76a4d58c1d870fcb2252b321f61cb3cc commit 4b86a24a76a4d58c1d870fcb2252b321f61cb3cc Author: Randall Stewart AuthorDate: 2021-05-11 12:15:05 +0000 Commit: Randall Stewart CommitDate: 2021-05-11 12:15:05 +0000 tcp: In rack, we must only convert restored rtt when the hostcache does restore them. Rack now after the previous commit is very careful to translate any value in the hostcache for srtt/rttvar into its proper format. However there is a snafu here in that if tp->srtt is 0 is the only time that the HC will actually restore the srtt. We need to then only convert the srtt restored when it is actually restored. We do this by making sure it was zero before the call to cc_conn_init and it is non-zero afterwards. Reviewed by: Michael Tuexen Sponsored by: Netflix Inc Differential Revision: https://reviews.freebsd.org/D30213 --- sys/netinet/tcp_stacks/rack.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 865e54c90e6a..e6b2ef60cef7 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -6614,14 +6614,17 @@ static void rack_cc_conn_init(struct tcpcb *tp) { struct tcp_rack *rack; + uint32_t srtt; rack = (struct tcp_rack *)tp->t_fb_ptr; - + srtt = tp->t_srtt; cc_conn_init(tp); /* - * Now convert to rack's internal format. + * Now convert to rack's internal format, + * if required. */ - rack_convert_rtts(tp); + if ((srtt == 0) && (tp->t_srtt != 0)) + rack_convert_rtts(tp); /* * We want a chance to stay in slowstart as * we create a connection. TCP spec says that From owner-dev-commits-src-main@freebsd.org Tue May 11 14:15:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 289F563957F; Tue, 11 May 2021 14:15:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ffg1p0f3Xz3wTs; Tue, 11 May 2021 14:15:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 04A94196CF; Tue, 11 May 2021 14:15:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14BEFf5J083214; Tue, 11 May 2021 14:15:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14BEFfNJ083213; Tue, 11 May 2021 14:15:41 GMT (envelope-from git) Date: Tue, 11 May 2021 14:15:41 GMT Message-Id: <202105111415.14BEFfNJ083213@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?B?Um9nZXIgUGF1IE1vbm7DqQ==?= Subject: git: 4772e86beb08 - main - xen/blkback: fix reconnection of backend MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4772e86beb089ee08a3bff8ad359e83a4c623238 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 14:15:42 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=4772e86beb089ee08a3bff8ad359e83a4c623238 commit 4772e86beb089ee08a3bff8ad359e83a4c623238 Author: Roger Pau Monné AuthorDate: 2021-05-11 10:19:29 +0000 Commit: Roger Pau Monné CommitDate: 2021-05-11 13:43:42 +0000 xen/blkback: fix reconnection of backend The hotplug script will be executed only once for each backend, regardless of the frontend triggering reconnections. Fix blkback to deal with the hotplug script being executed only once, so that reconnections don't stall waiting for a hotplug script execution that will never happen. As a result of the fix move the initialization of dev_mode, dev_type and dev_name to the watch callback, as they should be set only once the first time the backend connects. This fix is specially relevant for guests wanting to use UEFI OVMF firmware, because OVMF will use Xen PV block devices and disconnect afterwards, thus allowing them to be used by the guest OS. Without this change the guest OS will stall waiting for the block backed to attach. Fixes: de0bad00010c ('blkback: add support for hotplug scripts') MFC after: 1 week Sponsored by: Citrix Systems R&D --- sys/dev/xen/blkback/blkback.c | 83 +++++++++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 35 deletions(-) diff --git a/sys/dev/xen/blkback/blkback.c b/sys/dev/xen/blkback/blkback.c index 678472cc2ab8..010e737740b8 100644 --- a/sys/dev/xen/blkback/blkback.c +++ b/sys/dev/xen/blkback/blkback.c @@ -3412,7 +3412,6 @@ xbb_shutdown(struct xbb_softc *xbb) free(xbb->hotplug_watch.node, M_XENBLOCKBACK); xbb->hotplug_watch.node = NULL; } - xbb->hotplug_done = false; if (xenbus_get_state(xbb->dev) < XenbusStateClosing) xenbus_set_state(xbb->dev, XenbusStateClosing); @@ -3597,39 +3596,14 @@ xbb_setup_sysctl(struct xbb_softc *xbb) } static void -xbb_attach_disk(struct xs_watch *watch, const char **vec, unsigned int len) +xbb_attach_disk(device_t dev) { - device_t dev; struct xbb_softc *xbb; int error; - dev = (device_t) watch->callback_data; xbb = device_get_softc(dev); - error = xs_gather(XST_NIL, xenbus_get_node(dev), "physical-device-path", - NULL, &xbb->dev_name, NULL); - if (error != 0) - return; - - xs_unregister_watch(watch); - free(watch->node, M_XENBLOCKBACK); - watch->node = NULL; - - /* Collect physical device information. */ - error = xs_gather(XST_NIL, xenbus_get_otherend_path(xbb->dev), - "device-type", NULL, &xbb->dev_type, - NULL); - if (error != 0) - xbb->dev_type = NULL; - - error = xs_gather(XST_NIL, xenbus_get_node(dev), - "mode", NULL, &xbb->dev_mode, - NULL); - if (error != 0) { - xbb_attach_failed(xbb, error, "reading backend fields at %s", - xenbus_get_node(dev)); - return; - } + KASSERT(xbb->hotplug_done, ("Missing hotplug execution")); /* Parse fopen style mode flags. */ if (strchr(xbb->dev_mode, 'w') == NULL) @@ -3693,13 +3667,48 @@ xbb_attach_disk(struct xs_watch *watch, const char **vec, unsigned int len) return; } - xbb->hotplug_done = true; - /* The front end might be waiting for the backend, attach if so. */ if (xenbus_get_otherend_state(xbb->dev) == XenbusStateInitialised) xbb_connect(xbb); } +static void +xbb_attach_cb(struct xs_watch *watch, const char **vec, unsigned int len) +{ + device_t dev; + struct xbb_softc *xbb; + int error; + + dev = (device_t)watch->callback_data; + xbb = device_get_softc(dev); + + error = xs_gather(XST_NIL, xenbus_get_node(dev), "physical-device-path", + NULL, &xbb->dev_name, NULL); + if (error != 0) + return; + + xs_unregister_watch(watch); + free(watch->node, M_XENBLOCKBACK); + watch->node = NULL; + xbb->hotplug_done = true; + + /* Collect physical device information. */ + error = xs_gather(XST_NIL, xenbus_get_otherend_path(dev), "device-type", + NULL, &xbb->dev_type, NULL); + if (error != 0) + xbb->dev_type = NULL; + + error = xs_gather(XST_NIL, xenbus_get_node(dev), "mode", NULL, + &xbb->dev_mode, NULL); + if (error != 0) { + xbb_attach_failed(xbb, error, "reading backend fields at %s", + xenbus_get_node(dev)); + return; + } + + xbb_attach_disk(dev); +} + /** * Attach to a XenBus device that has been claimed by our probe routine. * @@ -3757,14 +3766,21 @@ xbb_attach(device_t dev) return (error); } + /* Tell the toolstack blkback has attached. */ + xenbus_set_state(dev, XenbusStateInitWait); + + if (xbb->hotplug_done) { + xbb_attach_disk(dev); + return (0); + } + /* * We need to wait for hotplug script execution before * moving forward. */ - KASSERT(!xbb->hotplug_done, ("Hotplug scripts already executed")); watch_path = xs_join(xenbus_get_node(xbb->dev), "physical-device-path"); xbb->hotplug_watch.callback_data = (uintptr_t)dev; - xbb->hotplug_watch.callback = xbb_attach_disk; + xbb->hotplug_watch.callback = xbb_attach_cb; KASSERT(xbb->hotplug_watch.node == NULL, ("watch node already setup")); xbb->hotplug_watch.node = strdup(sbuf_data(watch_path), M_XENBLOCKBACK); /* @@ -3782,9 +3798,6 @@ xbb_attach(device_t dev) return (error); } - /* Tell the toolstack blkback has attached. */ - xenbus_set_state(dev, XenbusStateInitWait); - return (0); } From owner-dev-commits-src-main@freebsd.org Tue May 11 15:23:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB37363BD52; Tue, 11 May 2021 15:23:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FfhXL4V5Hz4VHD; Tue, 11 May 2021 15:23:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8CD331A88C; Tue, 11 May 2021 15:23:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14BFNkDk075692; Tue, 11 May 2021 15:23:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14BFNkpD075691; Tue, 11 May 2021 15:23:46 GMT (envelope-from git) Date: Tue, 11 May 2021 15:23:46 GMT Message-Id: <202105111523.14BFNkpD075691@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 80430c15caac - main - netinet6 tests: Fix Python warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 80430c15caac0c10832455f868fa01c912996982 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 15:23:46 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=80430c15caac0c10832455f868fa01c912996982 commit 80430c15caac0c10832455f868fa01c912996982 Author: Kristof Provost AuthorDate: 2021-05-11 13:47:45 +0000 Commit: Kristof Provost CommitDate: 2021-05-11 15:10:42 +0000 netinet6 tests: Fix Python warning Python 3.8 warns about line 112: 'SyntaxWarning: "is" with a literal. Did you mean "=="?' Use '==' as Python suggests. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netinet6/frag6/frag6_16.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sys/netinet6/frag6/frag6_16.py b/tests/sys/netinet6/frag6/frag6_16.py index c38f5da4dea9..42ac8e2b4675 100644 --- a/tests/sys/netinet6/frag6/frag6_16.py +++ b/tests/sys/netinet6/frag6/frag6_16.py @@ -109,7 +109,7 @@ def main(): foffset=(int)(1288/8) mbit=1 for i in range(1,30): - if i is 29: + if i == 29: mbit=0 ip6f0n = sp.Ether() / \ sp.IPv6(src=args.src[0], dst=args.to[0]) / \ From owner-dev-commits-src-main@freebsd.org Tue May 11 15:40:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F2EA163C3D6; Tue, 11 May 2021 15:40:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ffhvh6YjXz4W8f; Tue, 11 May 2021 15:40:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D41DF1A46B; Tue, 11 May 2021 15:40:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14BFeW5X098033; Tue, 11 May 2021 15:40:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14BFeWG9098032; Tue, 11 May 2021 15:40:32 GMT (envelope-from git) Date: Tue, 11 May 2021 15:40:32 GMT Message-Id: <202105111540.14BFeWG9098032@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: 802637be0645 - main - ipfw.8: Fix table example MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 802637be06457c7593692bdf79f8466fa5f54d4a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 15:40:33 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=802637be06457c7593692bdf79f8466fa5f54d4a commit 802637be06457c7593692bdf79f8466fa5f54d4a Author: Lutz Donnerhacke AuthorDate: 2021-05-10 18:31:52 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-11 15:38:26 +0000 ipfw.8: Fix table example Fix some erronous lines in the example section. PR: 248943 Submitted by: Jose Luis Duran MFC after: 2 weeks Reviewers: ae, manpages (gbe) Differential Revision: https://reviews.freebsd.org/D30191 --- sbin/ipfw/ipfw.8 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sbin/ipfw/ipfw.8 b/sbin/ipfw/ipfw.8 index 439738a54e34..2380c6c344ec 100644 --- a/sbin/ipfw/ipfw.8 +++ b/sbin/ipfw/ipfw.8 @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 7, 2021 +.Dd May 11, 2021 .Dt IPFW 8 .Os .Sh NAME @@ -4451,11 +4451,11 @@ Using the .Cm fwd action, the table entries may include hostnames and IP addresses. .Pp -.Dl "ipfw table T2 create type addr ftype ip" +.Dl "ipfw table T2 create type addr valtype ipv4" .Dl "ipfw table T2 add 192.168.2.0/24 10.23.2.1" -.Dl "ipfw table T21 add 192.168.0.0/27 router1.dmz" +.Dl "ipfw table T2 add 192.168.0.0/27 router1.dmz" .Dl "..." -.Dl "ipfw add 100 fwd tablearg ip from any to table(1)" +.Dl "ipfw add 100 fwd tablearg ip from any to 'table(T2)'" .Pp In the following example per-interface firewall is created: .Pp From owner-dev-commits-src-main@freebsd.org Tue May 11 19:02:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E6CE642483; Tue, 11 May 2021 19:02:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FfnNt39Txz4hPx; Tue, 11 May 2021 19:02:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FE801D35F; Tue, 11 May 2021 19:02:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14BJ2ceX069956; Tue, 11 May 2021 19:02:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14BJ2c6Z069955; Tue, 11 May 2021 19:02:38 GMT (envelope-from git) Date: Tue, 11 May 2021 19:02:38 GMT Message-Id: <202105111902.14BJ2c6Z069955@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 904390b4787d - main - Implement read-only VM_SHARED flag in the LinuxKPI. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 904390b4787d2e4a0d9d8ca9cb0d6da5a4fb320c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 19:02:38 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=904390b4787d2e4a0d9d8ca9cb0d6da5a4fb320c commit 904390b4787d2e4a0d9d8ca9cb0d6da5a4fb320c Author: Hans Petter Selasky AuthorDate: 2021-05-11 18:49:13 +0000 Commit: Hans Petter Selasky CommitDate: 2021-05-11 19:00:14 +0000 Implement read-only VM_SHARED flag in the LinuxKPI. For use by mmap(2) callbacks. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/compat/linuxkpi/common/include/linux/mm.h | 1 + sys/compat/linuxkpi/common/src/linux_compat.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/mm.h b/sys/compat/linuxkpi/common/include/linux/mm.h index f6f53afbc8a9..68a0f34acaf3 100644 --- a/sys/compat/linuxkpi/common/include/linux/mm.h +++ b/sys/compat/linuxkpi/common/include/linux/mm.h @@ -63,6 +63,7 @@ CTASSERT((VM_PROT_ALL & -(1 << 8)) == 0); #define VM_DONTCOPY (1 << 14) #define VM_DONTEXPAND (1 << 15) #define VM_DONTDUMP (1 << 16) +#define VM_SHARED (1 << 17) #define VMA_MAX_PREFAULT_RECORD 1 diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index 630ee30e73e2..ee41e5e2b30d 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -1232,7 +1232,7 @@ linux_file_kqfilter(struct file *file, struct knote *kn) static int linux_file_mmap_single(struct file *fp, const struct file_operations *fop, vm_ooffset_t *offset, vm_size_t size, struct vm_object **object, - int nprot, struct thread *td) + int nprot, bool is_shared, struct thread *td) { struct task_struct *task; struct vm_area_struct *vmap; @@ -1267,6 +1267,8 @@ linux_file_mmap_single(struct file *fp, const struct file_operations *fop, vmap->vm_pgoff = *offset / PAGE_SIZE; vmap->vm_pfn = 0; vmap->vm_flags = vmap->vm_page_prot = (nprot & VM_PROT_ALL); + if (is_shared) + vmap->vm_flags |= VM_SHARED; vmap->vm_ops = NULL; vmap->vm_file = get_file(filp); vmap->vm_mm = mm; @@ -1601,21 +1603,21 @@ linux_file_ioctl(struct file *fp, u_long cmd, void *data, struct ucred *cred, static int linux_file_mmap_sub(struct thread *td, vm_size_t objsize, vm_prot_t prot, - vm_prot_t *maxprotp, int *flagsp, struct file *fp, + vm_prot_t maxprot, int flags, struct file *fp, vm_ooffset_t *foff, const struct file_operations *fop, vm_object_t *objp) { /* * Character devices do not provide private mappings * of any kind: */ - if ((*maxprotp & VM_PROT_WRITE) == 0 && + if ((maxprot & VM_PROT_WRITE) == 0 && (prot & VM_PROT_WRITE) != 0) return (EACCES); - if ((*flagsp & (MAP_PRIVATE | MAP_COPY)) != 0) + if ((flags & (MAP_PRIVATE | MAP_COPY)) != 0) return (EINVAL); return (linux_file_mmap_single(fp, fop, foff, objsize, objp, - (int)prot, td)); + (int)prot, (flags & MAP_SHARED) ? true : false, td)); } static int @@ -1673,7 +1675,7 @@ linux_file_mmap(struct file *fp, vm_map_t map, vm_offset_t *addr, vm_size_t size maxprot &= cap_maxprot; linux_get_fop(filp, &fop, &ldev); - error = linux_file_mmap_sub(td, size, prot, &maxprot, &flags, fp, + error = linux_file_mmap_sub(td, size, prot, maxprot, flags, fp, &foff, fop, &object); if (error != 0) goto out; From owner-dev-commits-src-main@freebsd.org Tue May 11 19:02:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D8D8A642484; Tue, 11 May 2021 19:02:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FfnNv57Crz4h4t; Tue, 11 May 2021 19:02:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A6021D360; Tue, 11 May 2021 19:02:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14BJ2dum069977; Tue, 11 May 2021 19:02:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14BJ2dqR069976; Tue, 11 May 2021 19:02:39 GMT (envelope-from git) Date: Tue, 11 May 2021 19:02:39 GMT Message-Id: <202105111902.14BJ2dqR069976@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 67807f5066a0 - main - cdev_del() should only put it's kernel object in the LinuxKPI. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 67807f5066a012254da9a4535c0f225377afb66d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 19:02:40 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=67807f5066a012254da9a4535c0f225377afb66d commit 67807f5066a012254da9a4535c0f225377afb66d Author: Hans Petter Selasky AuthorDate: 2021-05-11 18:51:35 +0000 Commit: Hans Petter Selasky CommitDate: 2021-05-11 19:00:23 +0000 cdev_del() should only put it's kernel object in the LinuxKPI. The destructor takes care of the rest. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/compat/linuxkpi/common/include/linux/cdev.h | 4 ---- sys/compat/linuxkpi/common/src/linux_compat.c | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/cdev.h b/sys/compat/linuxkpi/common/include/linux/cdev.h index 2a472da91866..bdfb7e76c9a7 100644 --- a/sys/compat/linuxkpi/common/include/linux/cdev.h +++ b/sys/compat/linuxkpi/common/include/linux/cdev.h @@ -135,13 +135,9 @@ cdev_add_ext(struct linux_cdev *cdev, dev_t dev, uid_t uid, gid_t gid, int mode) return (0); } -void linux_destroy_dev(struct linux_cdev *); - static inline void cdev_del(struct linux_cdev *cdev) { - - linux_destroy_dev(cdev); kobject_put(&cdev->kobj); } diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index ee41e5e2b30d..dcbbc3a80b8a 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -115,6 +115,7 @@ MALLOC_DEFINE(M_KMALLOC, "linux", "Linux kmalloc compat"); #undef cdev #define RB_ROOT(head) (head)->rbh_root +static void linux_destroy_dev(struct linux_cdev *); static void linux_cdev_deref(struct linux_cdev *ldev); static struct vm_area_struct *linux_cdev_handle_find(void *handle); @@ -2243,7 +2244,7 @@ linux_cdev_static_release(struct kobject *kobj) kobject_put(kobj->parent); } -void +static void linux_destroy_dev(struct linux_cdev *ldev) { From owner-dev-commits-src-main@freebsd.org Tue May 11 19:02:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 46702642458; Tue, 11 May 2021 19:02:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FfnNx05PPz4h50; Tue, 11 May 2021 19:02:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B03361D878; Tue, 11 May 2021 19:02:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14BJ2eSW069998; Tue, 11 May 2021 19:02:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14BJ2e8K069997; Tue, 11 May 2021 19:02:40 GMT (envelope-from git) Date: Tue, 11 May 2021 19:02:40 GMT Message-Id: <202105111902.14BJ2e8K069997@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: b8f113cab91f - main - Implement cdev_device_add() and cdev_device_del() in the LinuxKPI. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b8f113cab91f288e5d5e29d21184d1601b87cfdd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 19:02:41 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=b8f113cab91f288e5d5e29d21184d1601b87cfdd commit b8f113cab91f288e5d5e29d21184d1601b87cfdd Author: Hans Petter Selasky AuthorDate: 2021-05-11 18:51:59 +0000 Commit: Hans Petter Selasky CommitDate: 2021-05-11 19:00:23 +0000 Implement cdev_device_add() and cdev_device_del() in the LinuxKPI. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/compat/linuxkpi/common/include/linux/cdev.h | 11 ++++++- sys/compat/linuxkpi/common/src/linux_compat.c | 38 ++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/cdev.h b/sys/compat/linuxkpi/common/include/linux/cdev.h index bdfb7e76c9a7..39a65472e921 100644 --- a/sys/compat/linuxkpi/common/include/linux/cdev.h +++ b/sys/compat/linuxkpi/common/include/linux/cdev.h @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2021 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,6 +38,7 @@ #include +struct device; struct file_operations; struct inode; struct module; @@ -143,6 +144,14 @@ cdev_del(struct linux_cdev *cdev) struct linux_cdev *linux_find_cdev(const char *name, unsigned major, unsigned minor); +int linux_cdev_device_add(struct linux_cdev *, struct device *); +void linux_cdev_device_del(struct linux_cdev *, struct device *); + +#define cdev_device_add(...) \ + linux_cdev_device_add(__VA_ARGS__) +#define cdev_device_del(...) \ + linux_cdev_device_del(__VA_ARGS__) + #define cdev linux_cdev #endif /* _LINUX_CDEV_H_ */ diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index dcbbc3a80b8a..a8f090ed0bd5 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013-2018 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2021 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -2244,6 +2244,42 @@ linux_cdev_static_release(struct kobject *kobj) kobject_put(kobj->parent); } +int +linux_cdev_device_add(struct linux_cdev *ldev, struct device *dev) +{ + int ret; + + if (dev->devt != 0) { + /* Set parent kernel object. */ + ldev->kobj.parent = &dev->kobj; + + /* + * Unlike Linux we require the kobject of the + * character device structure to have a valid name + * before calling this function: + */ + if (ldev->kobj.name == NULL) + return (-EINVAL); + + ret = cdev_add(ldev, dev->devt, 1); + if (ret) + return (ret); + } + ret = device_add(dev); + if (ret != 0 && dev->devt != 0) + cdev_del(ldev); + return (ret); +} + +void +linux_cdev_device_del(struct linux_cdev *ldev, struct device *dev) +{ + device_del(dev); + + if (dev->devt != 0) + cdev_del(ldev); +} + static void linux_destroy_dev(struct linux_cdev *ldev) { From owner-dev-commits-src-main@freebsd.org Tue May 11 21:36:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 30BAE645E89; Tue, 11 May 2021 21:36:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FfrpX0qr3z4pWb; Tue, 11 May 2021 21:36:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F6B51F72D; Tue, 11 May 2021 21:36:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14BLaZ4F070273; Tue, 11 May 2021 21:36:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14BLaZwn070272; Tue, 11 May 2021 21:36:35 GMT (envelope-from git) Date: Tue, 11 May 2021 21:36:35 GMT Message-Id: <202105112136.14BLaZwn070272@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 1a04f0156c4e - main - cryptodev: Fix some input validation bugs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1a04f0156c4e6abfc01d5841341a94179f317f31 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 21:36:36 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1a04f0156c4e6abfc01d5841341a94179f317f31 commit 1a04f0156c4e6abfc01d5841341a94179f317f31 Author: Mark Johnston AuthorDate: 2021-05-11 21:36:12 +0000 Commit: Mark Johnston CommitDate: 2021-05-11 21:36:12 +0000 cryptodev: Fix some input validation bugs - When we do not have a separate IV, make sure that the IV length specified by the session is not larger than the payload size. - Disallow AEAD requests without a separate IV. crp_sanity() asserts that CRYPTO_F_IV_SEPARATE is set for AEAD requests, and some (but not all) drivers require it. - Return EINVAL for AEAD requests if an IV is specified but the transform does not expect one. Reported by: syzbot+c9e8f6ff5cb7fa6a1250@syzkaller.appspotmail.com Reported by: syzbot+007341439ae295cee74f@syzkaller.appspotmail.com Reported by: syzbot+46e0cc42a428b3b0a40d@syzkaller.appspotmail.com Reported by: syzbot+2c4d670173b8bdb947df@syzkaller.appspotmail.com Reported by: syzbot+220faa5eeb4d47b23877@syzkaller.appspotmail.com Reported by: syzbot+e83434b40f05843722f7@syzkaller.appspotmail.com Reviewed by: jhb MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30154 --- sys/opencrypto/cryptodev.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index f102b59b82ac..d179dd6348e5 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -878,6 +878,11 @@ cryptodev_op(struct csession *cse, const struct crypt_op *cop) } crp->crp_flags |= CRYPTO_F_IV_SEPARATE; } else if (cse->ivsize != 0) { + if (crp->crp_payload_length < cse->ivsize) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + error = EINVAL; + goto bail; + } crp->crp_iv_start = 0; crp->crp_payload_start += cse->ivsize; crp->crp_payload_length -= cse->ivsize; @@ -1058,6 +1063,11 @@ cryptodev_aead(struct csession *cse, struct crypt_aead *caead) cse->ivsize == AES_XTS_IV_LEN) caead->ivlen = AES_XTS_IV_LEN; + if (cse->ivsize == 0) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + error = EINVAL; + goto bail; + } if (caead->ivlen != cse->ivsize) { error = EINVAL; SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); @@ -1071,10 +1081,9 @@ cryptodev_aead(struct csession *cse, struct crypt_aead *caead) } crp->crp_flags |= CRYPTO_F_IV_SEPARATE; } else { - crp->crp_iv_start = crp->crp_payload_start; - crp->crp_payload_start += cse->ivsize; - crp->crp_payload_length -= cse->ivsize; - dst += cse->ivsize; + error = EINVAL; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + goto bail; } if (crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) { From owner-dev-commits-src-main@freebsd.org Tue May 11 21:48:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BABB46461D1; Tue, 11 May 2021 21:48:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ffs4L4ydKz4qGy; Tue, 11 May 2021 21:48:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D3531FB13; Tue, 11 May 2021 21:48:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14BLmYrQ083579; Tue, 11 May 2021 21:48:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14BLmYwu083578; Tue, 11 May 2021 21:48:34 GMT (envelope-from git) Date: Tue, 11 May 2021 21:48:34 GMT Message-Id: <202105112148.14BLmYwu083578@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: a3628327e7b6 - main - Ensure that files with no allocated blocks are trimmed to zero length. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a3628327e7b62c955e7bad9e43044cdb01984d80 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 21:48:34 -0000 The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=a3628327e7b62c955e7bad9e43044cdb01984d80 commit a3628327e7b62c955e7bad9e43044cdb01984d80 Author: Kirk McKusick AuthorDate: 2021-05-11 21:51:06 +0000 Commit: Kirk McKusick CommitDate: 2021-05-11 21:52:26 +0000 Ensure that files with no allocated blocks are trimmed to zero length. UFS does not allow files to end with a hole; it requires that the last block of a file be allocated. As fsck_ffs(8) initially scans each allocated inode, it tracks the last allocated block in the inode. It then checks that the inode's size falls in the last allocated block. If the last allocated block falls before the size, a `file size beyond end of allocated file' warning is issued and the file is shortened to reference the last allocated block (to avoid having it reference a hole at its end). If the last allocated block falls after the size, a `partially truncated file' warning is issued and all blocks following the block referenced by the size are freed. Because of an incorrect unsigned comparison, this test was failing to handle files with no allocated blocks but non-zero size (which should have had their size reset to zero). Once that was fixed the test started incorrectly complaining about short symbolic links that place the link path in the inode rather than in a disk block. Because these symbolic links have a non-zero size, but no allocated blocks, fsck_ffs wanted to zero out their size. This patch has to detect and avoid changing the size of such symbolic links. Reported by: Chuck Silvers Tested by: Chuck Silvers MFC after: 1 week Sponsored by: Netflix --- sbin/fsck_ffs/pass1.c | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/sbin/fsck_ffs/pass1.c b/sbin/fsck_ffs/pass1.c index c1f1b1ec04f5..319a324cc070 100644 --- a/sbin/fsck_ffs/pass1.c +++ b/sbin/fsck_ffs/pass1.c @@ -248,7 +248,7 @@ checkinode(ino_t inumber, struct inodesc *idesc, int rebuildcg) off_t kernmaxfilesize; ufs2_daddr_t ndb; mode_t mode; - uintmax_t fixsize; + intmax_t size, fixsize; int j, ret, offset; if ((dp = getnextinode(inumber, rebuildcg)) == NULL) @@ -429,25 +429,37 @@ checkinode(ino_t inumber, struct inodesc *idesc, int rebuildcg) } } /* + * UFS does not allow files to end with a hole; it requires that + * the last block of a file be allocated. The last allocated block + * in a file is tracked in id_lballoc. Here, we check for a size + * past the last allocated block of the file and if that is found, + * shorten the file to reference the last allocated block to avoid + * having it reference a hole at its end. + * * Soft updates will always ensure that the file size is correct * for files that contain only direct block pointers. However * soft updates does not roll back sizes for files with indirect * blocks that it has set to unallocated because their contents * have not yet been written to disk. Hence, the file can appear * to have a hole at its end because the block pointer has been - * rolled back to zero. Thus, id_lballoc tracks the last allocated - * block in the file. Here, for files that extend into indirect - * blocks, we check for a size past the last allocated block of - * the file and if that is found, shorten the file to reference - * the last allocated block to avoid having it reference a hole - * at its end. + * rolled back to zero. Thus finding a hole at the end of a file + * that is located in an indirect block receives only a warning + * while finding a hole at the end of a file in a direct block + * receives a fatal error message. */ - if (DIP(dp, di_size) > UFS_NDADDR * sblock.fs_bsize && - idesc->id_lballoc < lblkno(&sblock, DIP(dp, di_size) - 1)) { - fixsize = lblktosize(&sblock, idesc->id_lballoc + 1); - pwarn("INODE %lu: FILE SIZE %ju BEYOND END OF ALLOCATED FILE, " - "SIZE SHOULD BE %ju", (u_long)inumber, - (uintmax_t)DIP(dp, di_size), fixsize); + size = DIP(dp, di_size); + if (idesc->id_lballoc < lblkno(&sblock, size - 1) && + /* exclude embedded symbolic links */ + ((mode != IFLNK) || size >= sblock.fs_maxsymlinklen)) { + fixsize = lblktosize(&sblock, idesc->id_lballoc + 1); + if (size > UFS_NDADDR * sblock.fs_bsize) + pwarn("INODE %lu: FILE SIZE %ju BEYOND END OF " + "ALLOCATED FILE, SIZE SHOULD BE %ju", + (u_long)inumber, size, fixsize); + else + pfatal("INODE %lu: FILE SIZE %ju BEYOND END OF " + "ALLOCATED FILE, SIZE SHOULD BE %ju", + (u_long)inumber, size, fixsize); if (preen) printf(" (ADJUSTED)\n"); else if (reply("ADJUST") == 0) From owner-dev-commits-src-main@freebsd.org Tue May 11 21:56:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 50A4E628507; Tue, 11 May 2021 21:56:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FfsFt1RwLz4t1g; Tue, 11 May 2021 21:56:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2184E1F96A; Tue, 11 May 2021 21:56:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14BLunsd002341; Tue, 11 May 2021 21:56:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14BLunli002340; Tue, 11 May 2021 21:56:49 GMT (envelope-from git) Date: Tue, 11 May 2021 21:56:49 GMT Message-Id: <202105112156.14BLunli002340@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: ed93deba1106 - main - Remove a write-only variable. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ed93deba1106da2cd4755a61612c37bb67edc914 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 21:56:51 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=ed93deba1106da2cd4755a61612c37bb67edc914 commit ed93deba1106da2cd4755a61612c37bb67edc914 Author: John Baldwin AuthorDate: 2021-05-11 21:56:23 +0000 Commit: John Baldwin CommitDate: 2021-05-11 21:56:23 +0000 Remove a write-only variable. While refactoring an earlier series of changes during review, the 'saved_data' variable stopped being used at the bottom of if_ioctl(). Suggested by: brooks Reviewed by: brooks, imp, kib Fixes: d17e0940f79f Rework compat shims in ifioctl(). Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D30197 --- sys/net/if.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index e444faa54cb0..e18ed3e275ac 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -2901,7 +2901,6 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct thread *td) struct ifgroupreq ifgr; struct ifmediareq ifmr; } thunk; - caddr_t saved_data; u_long saved_cmd; struct ifconf32 *ifc32; struct ifdrv32 *ifd32; @@ -2928,7 +2927,6 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct thread *td) #ifdef COMPAT_FREEBSD32 saved_cmd = cmd; - saved_data = data; switch (cmd) { case SIOCGIFCONF32: ifc32 = (struct ifconf32 *)data; From owner-dev-commits-src-main@freebsd.org Tue May 11 22:59:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8830C629541; Tue, 11 May 2021 22:59:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FftfT3Sftz4vx1; Tue, 11 May 2021 22:59:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69B4B20971; Tue, 11 May 2021 22:59:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14BMxjK9081317; Tue, 11 May 2021 22:59:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14BMxjX2081316; Tue, 11 May 2021 22:59:45 GMT (envelope-from git) Date: Tue, 11 May 2021 22:59:45 GMT Message-Id: <202105112259.14BMxjX2081316@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Poul-Henning Kamp Subject: git: 9db7da1f55b3 - main - Polish source to WARNS=6 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: phk X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9db7da1f55b3f793c9b0e7d8fca5fbbc26c90691 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 22:59:45 -0000 The branch main has been updated by phk: URL: https://cgit.FreeBSD.org/src/commit/?id=9db7da1f55b3f793c9b0e7d8fca5fbbc26c90691 commit 9db7da1f55b3f793c9b0e7d8fca5fbbc26c90691 Author: Poul-Henning Kamp AuthorDate: 2021-05-11 22:59:23 +0000 Commit: Poul-Henning Kamp CommitDate: 2021-05-11 22:59:23 +0000 Polish source to WARNS=6 --- usr.sbin/i2c/Makefile | 2 +- usr.sbin/i2c/i2c.c | 55 +++++++++++++++++++++++++++++++-------------------- 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/usr.sbin/i2c/Makefile b/usr.sbin/i2c/Makefile index 9f377e6ac577..681f4b7b89d2 100644 --- a/usr.sbin/i2c/Makefile +++ b/usr.sbin/i2c/Makefile @@ -3,6 +3,6 @@ PROG= i2c MAN= i2c.8 -WARNS?= 2 +WARNS?= 6 .include diff --git a/usr.sbin/i2c/i2c.c b/usr.sbin/i2c/i2c.c index 0fcdd56e7373..1df12cf44460 100644 --- a/usr.sbin/i2c/i2c.c +++ b/usr.sbin/i2c/i2c.c @@ -29,6 +29,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include #include @@ -36,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -122,12 +122,13 @@ skip_get_tokens(char *skip_addr, int *sk_addr, int max_index) } static int -scan_bus(struct iiccmd cmd, char *dev, int skip, char *skip_addr) +scan_bus(const char *dev, int skip, char *skip_addr) { + struct iiccmd cmd; struct iic_msg rdmsg; struct iic_rdwr_data rdwrdata; struct skip_range addr_range = { 0, 0 }; - int *tokens, fd, error, i, index, j; + int *tokens = NULL, fd, error, i, idx = 0, j; int len = 0, do_skip = 0, no_range = 1, num_found = 0, use_read_xfer = 0; uint8_t rdbyte; @@ -139,6 +140,7 @@ scan_bus(struct iiccmd cmd, char *dev, int skip, char *skip_addr) } if (skip) { + assert(skip_addr != NULL); len = strlen(skip_addr); if (strstr(skip_addr, "..") != NULL) { addr_range = skip_get_range(skip_addr); @@ -151,7 +153,7 @@ scan_bus(struct iiccmd cmd, char *dev, int skip, char *skip_addr) error = -1; goto out; } - index = skip_get_tokens(skip_addr, tokens, + idx = skip_get_tokens(skip_addr, tokens, len / 2 + 1); } @@ -166,7 +168,7 @@ scan_bus(struct iiccmd cmd, char *dev, int skip, char *skip_addr) start_over: if (use_read_xfer) { - fprintf(stderr, + fprintf(stderr, "Hardware may not support START/STOP scanning; " "trying less-reliable read method.\n"); } @@ -177,13 +179,15 @@ start_over: if (i >= addr_range.start && i <= addr_range.end) continue; - } else if (skip && no_range) - for (j = 0; j < index; j++) { + } else if (skip && no_range) { + assert (tokens != NULL); + for (j = 0; j < idx; j++) { if (tokens[j] == i) { do_skip = 1; break; } } + } if (do_skip) { do_skip = 0; @@ -241,6 +245,8 @@ out: close(fd); if (skip && no_range) free(tokens); + else + assert(tokens == NULL); if (error) { fprintf(stderr, "Error scanning I2C controller (%s): %s\n", @@ -251,8 +257,9 @@ out: } static int -reset_bus(struct iiccmd cmd, char *dev) +reset_bus(const char *dev) { + struct iiccmd cmd; int fd, error; fd = open(dev, O_RDWR); @@ -295,11 +302,12 @@ prepare_buf(int size, uint32_t off) } static int -i2c_write(char *dev, struct options i2c_opt, char *i2c_buf) +i2c_write(const char *dev, struct options i2c_opt, char *i2c_buf) { struct iiccmd cmd; int error, fd, bufsize; - char *err_msg, *buf; + char *buf; + const char *err_msg; fd = open(dev, O_RDWR); if (fd == -1) { @@ -404,7 +412,7 @@ i2c_write(char *dev, struct options i2c_opt, char *i2c_buf) break; case I2C_MODE_NONE: /* fall through */ - default: + default: buf = realloc(buf, bufsize + i2c_opt.count); if (buf == NULL) { err_msg = "error: data malloc"; @@ -448,11 +456,12 @@ err2: } static int -i2c_read(char *dev, struct options i2c_opt, char *i2c_buf) +i2c_read(const char *dev, struct options i2c_opt, char *i2c_buf) { struct iiccmd cmd; int fd, error, bufsize; - char *err_msg, data = 0, *buf; + char data = 0, *buf; + const char *err_msg; fd = open(dev, O_RDWR); if (fd == -1) @@ -556,7 +565,7 @@ err2: * driver to be handled as a single transfer. */ static int -i2c_rdwr_transfer(char *dev, struct options i2c_opt, char *i2c_buf) +i2c_rdwr_transfer(const char *dev, struct options i2c_opt, char *i2c_buf) { struct iic_msg msgs[2]; struct iic_rdwr_data xfer; @@ -613,9 +622,9 @@ i2c_rdwr_transfer(char *dev, struct options i2c_opt, char *i2c_buf) int main(int argc, char** argv) { - struct iiccmd cmd; struct options i2c_opt; - char *dev, *skip_addr, *i2c_buf; + char *skip_addr = NULL, *i2c_buf; + const char *dev; int error, chunk_size, i, j, ch; errno = 0; @@ -700,6 +709,10 @@ main(int argc, char** argv) } argc -= optind; argv += optind; + if (argc > 0) { + fprintf(stderr, "Too many arguments\n"); + usage(); + } /* Set default mode if option -m is not specified */ if (i2c_opt.mode == I2C_MODE_NOTSET) { @@ -722,20 +735,20 @@ main(int argc, char** argv) if ((i2c_opt.addr_set == 0) || !(i2c_opt.width == 0 || i2c_opt.width == 8 || i2c_opt.width == 16)) - usage(); + usage(); } if (i2c_opt.verbose) fprintf(stderr, "dev: %s, addr: 0x%x, r/w: %c, " - "offset: 0x%02x, width: %u, count: %u\n", dev, + "offset: 0x%02x, width: %d, count: %d\n", dev, i2c_opt.addr >> 1, i2c_opt.dir, i2c_opt.off, i2c_opt.width, i2c_opt.count); if (i2c_opt.scan) - exit(scan_bus(cmd, dev, i2c_opt.skip, skip_addr)); + exit(scan_bus(dev, i2c_opt.skip, skip_addr)); if (i2c_opt.reset) - exit(reset_bus(cmd, dev)); + exit(reset_bus(dev)); i2c_buf = malloc(i2c_opt.count); if (i2c_buf == NULL) @@ -746,7 +759,7 @@ main(int argc, char** argv) */ if (i2c_opt.dir == 'w') { if (i2c_opt.verbose && !i2c_opt.binary) - fprintf(stderr, "Enter %u bytes of data: ", + fprintf(stderr, "Enter %d bytes of data: ", i2c_opt.count); for (i = 0; i < i2c_opt.count; i++) { ch = getchar(); From owner-dev-commits-src-main@freebsd.org Tue May 11 23:07:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61FD4629B46; Tue, 11 May 2021 23:07:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fftqz2LNQz3CWW; Tue, 11 May 2021 23:07:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3ECE520B0F; Tue, 11 May 2021 23:07:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14BN7x77094910; Tue, 11 May 2021 23:07:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14BN7xUk094908; Tue, 11 May 2021 23:07:59 GMT (envelope-from git) Date: Tue, 11 May 2021 23:07:59 GMT Message-Id: <202105112307.14BN7xUk094908@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Poul-Henning Kamp Subject: git: b2ae176d914a - main - Sixteen bit I2c addresses are always little endian. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: phk X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b2ae176d914acd63247e24d7e23dbe8f239fbfb0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 23:07:59 -0000 The branch main has been updated by phk: URL: https://cgit.FreeBSD.org/src/commit/?id=b2ae176d914acd63247e24d7e23dbe8f239fbfb0 commit b2ae176d914acd63247e24d7e23dbe8f239fbfb0 Author: Poul-Henning Kamp AuthorDate: 2021-05-11 23:07:06 +0000 Commit: Poul-Henning Kamp CommitDate: 2021-05-11 23:07:06 +0000 Sixteen bit I2c addresses are always little endian. --- usr.sbin/i2c/i2c.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/usr.sbin/i2c/i2c.c b/usr.sbin/i2c/i2c.c index 1df12cf44460..23613ee744f9 100644 --- a/usr.sbin/i2c/i2c.c +++ b/usr.sbin/i2c/i2c.c @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -570,22 +571,18 @@ i2c_rdwr_transfer(const 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; + uint8_t off_buf[2]; 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; + msgs[i].buf = off_buf; if (i2c_opt.width == 8) { - off.off8 = (uint8_t)i2c_opt.off; + off_buf[0] = i2c_opt.off; msgs[i].len = 1; } else { - off.off16 = (uint16_t)i2c_opt.off; + le16enc(off_buf, i2c_opt.off); msgs[i].len = 2; } ++i; From owner-dev-commits-src-main@freebsd.org Tue May 11 23:15:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4594262A28E; Tue, 11 May 2021 23:15:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ffv0P1Z8sz3D3H; Tue, 11 May 2021 23:15:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 28B7620F08; Tue, 11 May 2021 23:15:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14BNFHYO008390; Tue, 11 May 2021 23:15:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14BNFHMt008389; Tue, 11 May 2021 23:15:17 GMT (envelope-from git) Date: Tue, 11 May 2021 23:15:17 GMT Message-Id: <202105112315.14BNFHMt008389@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: a7f81b488df2 - main - libvmm: explicitly save and restore errno in vm_open() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a7f81b488df2d4a5dcd785b4112e04ffb6ca0442 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 May 2021 23:15:17 -0000 The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=a7f81b488df2d4a5dcd785b4112e04ffb6ca0442 commit a7f81b488df2d4a5dcd785b4112e04ffb6ca0442 Author: Robert Wing AuthorDate: 2021-03-11 19:27:43 +0000 Commit: Robert Wing CommitDate: 2021-05-11 23:11:52 +0000 libvmm: explicitly save and restore errno in vm_open() In commit 6bb140e3ca895a14, vm_destroy() was replaced with free() to preserve errno. However, it's possible that free() may change the errno as well. Keep the free() call, but explicitly save and restore errno. Noted by: jhb Fixes: 6bb140e3ca895a14 --- lib/libvmmapi/vmmapi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c index 7faa2fc545ea..5810274c9a73 100644 --- a/lib/libvmmapi/vmmapi.c +++ b/lib/libvmmapi/vmmapi.c @@ -118,6 +118,7 @@ struct vmctx * vm_open(const char *name) { struct vmctx *vm; + int saved_errno; vm = malloc(sizeof(struct vmctx) + strlen(name) + 1); assert(vm != NULL); @@ -133,7 +134,9 @@ vm_open(const char *name) return (vm); err: + saved_errno = errno; free(vm); + errno = saved_errno; return (NULL); } From owner-dev-commits-src-main@freebsd.org Wed May 12 02:03:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EF84162DBDB; Wed, 12 May 2021 02:03:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FfykP6TR0z3LBm; Wed, 12 May 2021 02:03:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D14ED23020; Wed, 12 May 2021 02:03:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14C23PEw033395; Wed, 12 May 2021 02:03:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14C23PQx033394; Wed, 12 May 2021 02:03:25 GMT (envelope-from git) Date: Wed, 12 May 2021 02:03:25 GMT Message-Id: <202105120203.14C23PQx033394@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Allan Jude Subject: git: 30659d1dcbcc - main - Add support for adding default routes for other FIBs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: allanjude X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 30659d1dcbcc92016833f0956461314ed501ac83 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 02:03:26 -0000 The branch main has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=30659d1dcbcc92016833f0956461314ed501ac83 commit 30659d1dcbcc92016833f0956461314ed501ac83 Author: Andrew Fengler AuthorDate: 2021-05-12 01:59:10 +0000 Commit: Allan Jude CommitDate: 2021-05-12 01:59:10 +0000 Add support for adding default routes for other FIBs Make rc.d/routing read defaultrouter_fibN and ipv6_defaultrouter_fibN, and set it as the default gateway for FIB N, where N is from 1 to (net.fibs - 1) This allows adding gateways for multiple FIBs in the same format as the main gateway. (FIB 0) Reviewed by: olivier, rgrimes, bcr (man page) Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D22706 --- libexec/rc/rc.conf | 2 ++ libexec/rc/rc.d/routing | 38 ++++++++++++++++++++++++++++++++++++-- share/man/man5/rc.conf.5 | 11 ++++++++++- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf index 998cd3fd14d6..d941a20b6e07 100644 --- a/libexec/rc/rc.conf +++ b/libexec/rc/rc.conf @@ -437,6 +437,7 @@ bsnmpd_flags="" # Flags for bsnmpd. ### Network routing options: ### defaultrouter="NO" # Set to default gateway (or NO). +#defaultrouter_fibN="192.0.2.1" # Use this form to set a gateway for FIB N static_arp_pairs="" # Set to static ARP list (or leave empty). static_ndp_pairs="" # Set to static NDP list (or leave empty). static_routes="" # Set to static route list (or leave empty). @@ -499,6 +500,7 @@ ipv6_activate_all_interfaces="NO" # If NO, interfaces which have no # reason. ipv6_defaultrouter="NO" # Set to IPv6 default gateway (or NO). #ipv6_defaultrouter="2002:c058:6301::" # Use this for 6to4 (RFC 3068) +#ipv6_defaultrouter_fibN="2001:db8::" # Use this form to set a gateway for FIB N ipv6_static_routes="" # Set to static route list (or leave empty). #ipv6_static_routes="xxx" # An example to set fec0:0000:0000:0006::/64 # route toward loopback interface. diff --git a/libexec/rc/rc.d/routing b/libexec/rc/rc.d/routing index 043c5b15fbaa..37b3da0f0cef 100755 --- a/libexec/rc/rc.d/routing +++ b/libexec/rc/rc.d/routing @@ -140,11 +140,12 @@ get_fibmod() static_inet() { - local _action _if _skip _fibmod + local _action _if _skip _fibmod _fibs _action=$1 _if=$2 _fibmod=`get_fibmod` + _fibs=$((`${SYSCTL_N} net.fibs` - 1)) # Provide loopback route in all routing tables. This has to come # first so that any following routes can be added. @@ -161,6 +162,22 @@ static_inet() ;; esac + # Add default routes for fibs + if [ ${_fibs} -gt 0 ]; then + for _fibnum in `jot ${_fibs}` ; do + eval _fib_gw=\${defaultrouter_fib${_fibnum}} + case ${_fib_gw} in + [Nn][Oo] | '') + ;; + *) + static_routes="${static_routes} _default_fib${_fibnum}" + eval route__default_fib${fibnum}="'default ${_fib_gw} -fib ${_fibnum}'" + ;; + esac + done + fi + + # Install configured routes. if [ -n "${static_routes}" ]; then for i in ${static_routes}; do @@ -185,11 +202,12 @@ static_inet() static_inet6() { - local _action _if _skip fibmod allfibs + local _action _if _skip fibmod _fibs _action=$1 _if=$2 fibmod=`get_fibmod` + _fibs=$((`${SYSCTL_N} net.fibs` - 1)) # Add pre-defined static routes first. ipv6_static_routes="_v4mapped _v4compat ${ipv6_static_routes}" @@ -221,6 +239,22 @@ static_inet6() ;; esac + # Add default routes for fibs + if [ ${_fibs} -gt 0 ]; then + for _fibnum in `jot ${_fibs}` ; do + eval _fib_gw=\${ipv6_defaultrouter_fib${_fibnum}} + case ${_fib_gw} in + [Nn][Oo] | '') + ;; + *) + ipv6_static_routes="${static_routes} _default_fib${_fibnum}" + eval ipv6_route__default_fib${fibnum}="'default ${_fib_gw} -fib ${_fibnum}'" + ;; + esac + done + fi + + # Install configured routes. if [ -n "${ipv6_static_routes}" ]; then for i in ${ipv6_static_routes}; do diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index 01c4a8436496..6baf3b22b024 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 21, 2021 +.Dd May 11, 2021 .Dt RC.CONF 5 .Os .Sh NAME @@ -2818,10 +2818,19 @@ If not set to create a default route to this host name or IP address (use an IP address if this router is also required to get to the name server!). +.It Va defaultrouter_fibN +.Pq Vt str +If not set to +.Dq Li NO , +create a default route in FIB N to this host name or IP address. .It Va ipv6_defaultrouter .Pq Vt str The IPv6 equivalent of .Va defaultrouter . +.It Va ipv6_defaultrouter_fibN +.Pq Vt str +The IPv6 equivalent of +.Va defaultrouter_fibN . .It Va static_arp_pairs .Pq Vt str Set to the list of static ARP pairs that are to be added at system From owner-dev-commits-src-main@freebsd.org Wed May 12 05:18:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A8F01631499; Wed, 12 May 2021 05:18:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fg32z4Nkyz3j4n; Wed, 12 May 2021 05:18:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 89940253D8; Wed, 12 May 2021 05:18:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14C5I3an086275; Wed, 12 May 2021 05:18:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14C5I3u1086274; Wed, 12 May 2021 05:18:03 GMT (envelope-from git) Date: Wed, 12 May 2021 05:18:03 GMT Message-Id: <202105120518.14C5I3u1086274@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?B?U3RlZmFuIEXDn2Vy?= Subject: git: e5092308d94e - main - Vendor import of Gavin D. Howard's bc version 4.0.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e5092308d94ef05d9af0ea4d5edfe8b0ce323ec3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 05:18:03 -0000 The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=e5092308d94ef05d9af0ea4d5edfe8b0ce323ec3 commit e5092308d94ef05d9af0ea4d5edfe8b0ce323ec3 Author: Stefan Eßer AuthorDate: 2021-05-12 05:15:24 +0000 Commit: Stefan Eßer CommitDate: 2021-05-12 05:17:15 +0000 Vendor import of Gavin D. Howard's bc version 4.0.2 --- contrib/bc/NEWS.md | 9 +++++++++ contrib/bc/include/history.h | 1 + contrib/bc/include/version.h | 2 +- contrib/bc/src/history.c | 5 ++++- contrib/bc/src/vm.c | 2 ++ contrib/bc/tests/other.sh | 5 ++--- 6 files changed, 19 insertions(+), 5 deletions(-) diff --git a/contrib/bc/NEWS.md b/contrib/bc/NEWS.md index c66e7b164c8a..c78bddd27e76 100644 --- a/contrib/bc/NEWS.md +++ b/contrib/bc/NEWS.md @@ -1,5 +1,14 @@ # News +## 4.0.2 + +This is a production release that fixes two bugs: + +1. If no files are used and the first statement on `stdin` is invalid, `scale` + would not be set to `20` even if `-l` was used. +2. When using history, `bc` failed to respond properly to `SIGSTOP` and + `SIGTSTP`. + ## 4.0.1 This is a production release that only adds one thing: flushing output when it diff --git a/contrib/bc/include/history.h b/contrib/bc/include/history.h index 469785a118a9..444a2a107ac5 100644 --- a/contrib/bc/include/history.h +++ b/contrib/bc/include/history.h @@ -165,6 +165,7 @@ typedef enum BcHistoryAction { BC_ACTION_ENTER = 13, BC_ACTION_CTRL_N = 14, BC_ACTION_CTRL_P = 16, + BC_ACTION_CTRL_S = 19, BC_ACTION_CTRL_T = 20, BC_ACTION_CTRL_U = 21, BC_ACTION_CTRL_W = 23, diff --git a/contrib/bc/include/version.h b/contrib/bc/include/version.h index ab4823bd7c2a..42eb3a11d2c0 100644 --- a/contrib/bc/include/version.h +++ b/contrib/bc/include/version.h @@ -36,6 +36,6 @@ #ifndef BC_VERSION_H #define BC_VERSION_H -#define VERSION 4.0.1 +#define VERSION 4.0.2 #endif // BC_VERSION_H diff --git a/contrib/bc/src/history.c b/contrib/bc/src/history.c index c0d54fe35234..317d9193036c 100644 --- a/contrib/bc/src/history.c +++ b/contrib/bc/src/history.c @@ -1281,8 +1281,11 @@ static BcStatus bc_history_edit(BcHistory *h, const char *prompt) { default: { - if (c >= BC_ACTION_CTRL_A && c <= BC_ACTION_CTRL_Z) + if (c >= BC_ACTION_CTRL_A && c <= BC_ACTION_CTRL_Z) { bc_history_printCtrl(h, c); + if (c == BC_ACTION_CTRL_Z) raise(SIGTSTP); + if (c == BC_ACTION_CTRL_S) raise(SIGSTOP); + } else bc_history_edit_insert(h, cbuf, nread); break; } diff --git a/contrib/bc/src/vm.c b/contrib/bc/src/vm.c index e7ee8d35ba54..d01c8fd6860f 100644 --- a/contrib/bc/src/vm.c +++ b/contrib/bc/src/vm.c @@ -835,6 +835,8 @@ static void bc_vm_exec(void) { #if BC_ENABLE_EXTRA_MATH if (!BC_IS_POSIX) bc_vm_load(bc_lib2_name, bc_lib2); #endif // BC_ENABLE_EXTRA_MATH + + bc_program_exec(&vm.prog); } #endif // BC_ENABLED diff --git a/contrib/bc/tests/other.sh b/contrib/bc/tests/other.sh index d2ef4f6d0694..e13891fcad89 100755 --- a/contrib/bc/tests/other.sh +++ b/contrib/bc/tests/other.sh @@ -138,7 +138,7 @@ else set +e - printf 'three\n' | head -c3 > /dev/null + printf 'three\n' | cut -c1-3 > /dev/null err=$? if [ "$err" -eq 0 ]; then @@ -156,8 +156,7 @@ else printf '4 April 2021\n' > "$easter_res" - "$testdir/dc/scripts/easter.sh" "$exe" 2021 | head -c12 > "$easter_out" - printf '\n' >> "$easter_out" + "$testdir/dc/scripts/easter.sh" "$exe" 2021 | cut -c1-12 > "$easter_out" err="$?" checktest "$d" "$err" "Easter script" "$easter_res" "$easter_out" From owner-dev-commits-src-main@freebsd.org Wed May 12 05:25:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CEC5663137F; Wed, 12 May 2021 05:25:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fg3C35Tn6z3k0G; Wed, 12 May 2021 05:25:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AEDA925C98; Wed, 12 May 2021 05:25:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14C5P3pn099042; Wed, 12 May 2021 05:25:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14C5P3nh099041; Wed, 12 May 2021 05:25:03 GMT (envelope-from git) Date: Wed, 12 May 2021 05:25:03 GMT Message-Id: <202105120525.14C5P3nh099041@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?B?U3RlZmFuIEXDn2Vy?= Subject: git: e681dd3e2c12 - main - Revert "Vendor import of Gavin D. Howard's bc version 4.0.2" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e681dd3e2c1221fcf81cc8bc36a70decc50d9ebb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 05:25:03 -0000 The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=e681dd3e2c1221fcf81cc8bc36a70decc50d9ebb commit e681dd3e2c1221fcf81cc8bc36a70decc50d9ebb Author: Stefan Eßer AuthorDate: 2021-05-12 05:22:37 +0000 Commit: Stefan Eßer CommitDate: 2021-05-12 05:22:37 +0000 Revert "Vendor import of Gavin D. Howard's bc version 4.0.2" The update had been performed on a check-out of the vendor branch, but the final push lacked the target designation vendor/bc. --- contrib/bc/NEWS.md | 9 --------- contrib/bc/include/history.h | 1 - contrib/bc/include/version.h | 2 +- contrib/bc/src/history.c | 5 +---- contrib/bc/src/vm.c | 2 -- contrib/bc/tests/other.sh | 5 +++-- 6 files changed, 5 insertions(+), 19 deletions(-) diff --git a/contrib/bc/NEWS.md b/contrib/bc/NEWS.md index c78bddd27e76..c66e7b164c8a 100644 --- a/contrib/bc/NEWS.md +++ b/contrib/bc/NEWS.md @@ -1,14 +1,5 @@ # News -## 4.0.2 - -This is a production release that fixes two bugs: - -1. If no files are used and the first statement on `stdin` is invalid, `scale` - would not be set to `20` even if `-l` was used. -2. When using history, `bc` failed to respond properly to `SIGSTOP` and - `SIGTSTP`. - ## 4.0.1 This is a production release that only adds one thing: flushing output when it diff --git a/contrib/bc/include/history.h b/contrib/bc/include/history.h index 444a2a107ac5..469785a118a9 100644 --- a/contrib/bc/include/history.h +++ b/contrib/bc/include/history.h @@ -165,7 +165,6 @@ typedef enum BcHistoryAction { BC_ACTION_ENTER = 13, BC_ACTION_CTRL_N = 14, BC_ACTION_CTRL_P = 16, - BC_ACTION_CTRL_S = 19, BC_ACTION_CTRL_T = 20, BC_ACTION_CTRL_U = 21, BC_ACTION_CTRL_W = 23, diff --git a/contrib/bc/include/version.h b/contrib/bc/include/version.h index 42eb3a11d2c0..ab4823bd7c2a 100644 --- a/contrib/bc/include/version.h +++ b/contrib/bc/include/version.h @@ -36,6 +36,6 @@ #ifndef BC_VERSION_H #define BC_VERSION_H -#define VERSION 4.0.2 +#define VERSION 4.0.1 #endif // BC_VERSION_H diff --git a/contrib/bc/src/history.c b/contrib/bc/src/history.c index 317d9193036c..c0d54fe35234 100644 --- a/contrib/bc/src/history.c +++ b/contrib/bc/src/history.c @@ -1281,11 +1281,8 @@ static BcStatus bc_history_edit(BcHistory *h, const char *prompt) { default: { - if (c >= BC_ACTION_CTRL_A && c <= BC_ACTION_CTRL_Z) { + if (c >= BC_ACTION_CTRL_A && c <= BC_ACTION_CTRL_Z) bc_history_printCtrl(h, c); - if (c == BC_ACTION_CTRL_Z) raise(SIGTSTP); - if (c == BC_ACTION_CTRL_S) raise(SIGSTOP); - } else bc_history_edit_insert(h, cbuf, nread); break; } diff --git a/contrib/bc/src/vm.c b/contrib/bc/src/vm.c index d01c8fd6860f..e7ee8d35ba54 100644 --- a/contrib/bc/src/vm.c +++ b/contrib/bc/src/vm.c @@ -835,8 +835,6 @@ static void bc_vm_exec(void) { #if BC_ENABLE_EXTRA_MATH if (!BC_IS_POSIX) bc_vm_load(bc_lib2_name, bc_lib2); #endif // BC_ENABLE_EXTRA_MATH - - bc_program_exec(&vm.prog); } #endif // BC_ENABLED diff --git a/contrib/bc/tests/other.sh b/contrib/bc/tests/other.sh index e13891fcad89..d2ef4f6d0694 100755 --- a/contrib/bc/tests/other.sh +++ b/contrib/bc/tests/other.sh @@ -138,7 +138,7 @@ else set +e - printf 'three\n' | cut -c1-3 > /dev/null + printf 'three\n' | head -c3 > /dev/null err=$? if [ "$err" -eq 0 ]; then @@ -156,7 +156,8 @@ else printf '4 April 2021\n' > "$easter_res" - "$testdir/dc/scripts/easter.sh" "$exe" 2021 | cut -c1-12 > "$easter_out" + "$testdir/dc/scripts/easter.sh" "$exe" 2021 | head -c12 > "$easter_out" + printf '\n' >> "$easter_out" err="$?" checktest "$d" "$err" "Easter script" "$easter_res" "$easter_out" From owner-dev-commits-src-main@freebsd.org Wed May 12 05:52:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CC274631DD1; Wed, 12 May 2021 05:52:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fg3q55QD1z3lCN; Wed, 12 May 2021 05:52:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ACFB526108; Wed, 12 May 2021 05:52:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14C5qnYA038697; Wed, 12 May 2021 05:52:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14C5qnbf038696; Wed, 12 May 2021 05:52:49 GMT (envelope-from git) Date: Wed, 12 May 2021 05:52:49 GMT Message-Id: <202105120552.14C5qnbf038696@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?B?U3RlZmFuIEXDn2Vy?= Subject: git: 8c39e25220bb - main - contrib/bc: update to version 4.0.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8c39e25220bb88cd027d0c3b0fe86e52f6abd150 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 05:52:49 -0000 The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=8c39e25220bb88cd027d0c3b0fe86e52f6abd150 commit 8c39e25220bb88cd027d0c3b0fe86e52f6abd150 Merge: e681dd3e2c12 2858419a0ee2 Author: Stefan Eßer AuthorDate: 2021-05-12 05:49:19 +0000 Commit: Stefan Eßer CommitDate: 2021-05-12 05:50:59 +0000 contrib/bc: update to version 4.0.2 Merge commit '2858419a0ee2b8f5827de72c00618bcd69ebc5fc' This update fixes the initialization of "scale" to 20 if started with -l and the initial statement leads to an error (e.g. contains a syntax error). Scale was initialized to 0 in that case. Another change is the support of job control in interactive mode with line editing enabled. The control characters have been interpreted as editing commands only, prior to this version. MFC after: 3 days contrib/bc/NEWS.md | 9 +++++++++ contrib/bc/include/history.h | 1 + contrib/bc/include/version.h | 2 +- contrib/bc/src/history.c | 5 ++++- contrib/bc/src/vm.c | 2 ++ contrib/bc/tests/other.sh | 5 ++--- 6 files changed, 19 insertions(+), 5 deletions(-) From owner-dev-commits-src-main@freebsd.org Wed May 12 09:03:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C1938636B33 for ; Wed, 12 May 2021 09:03:04 +0000 (UTC) (envelope-from andrew@bansion.cn) Received: from smtpbgbr2.qq.com (smtpbgbr2.qq.com [54.207.22.56]) (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 4Fg82b0Pjpz3t4w for ; Wed, 12 May 2021 09:03:02 +0000 (UTC) (envelope-from andrew@bansion.cn) X-QQ-mid: bizesmtp54t1620810172t93422zf Received: from Andrew-Wang (unknown [113.88.112.5]) by esmtp6.qq.com (ESMTP) with SMTP id 0 for ; Wed, 12 May 2021 17:02:52 +0800 (CST) X-QQ-SSF: 0020000J002000U0Z000B00A0000000 X-QQ-FEAT: Hldt3KHDFFqmB6ISVSbEGTgjQS1EbxBIXlPNmnBV106YnnvjN48RSGkinWCkj YB6kFcA53JJG0e0Wq9+LXmuFQdQXpvhxJo8aPvD5R7xufwcQUMDDzlx61s35w1StC0fSFj0 MF3EtnW0fHC6eVEzBJ6iHl4fImy0p1DJ191w0VogYARcSF+LNpgw2lhnUFfBlesPnAtDLBr voEkxBGcozmU8VSXcii+6h8HEPDI3aSw42e8oyZFCjtKLsrci7BKo9VSFVHNkZOXer+R4Bb M65MToJXbiIeqvdGafgGaM08eiHkggRFGL5DUAGsvBeftRNc70ZbRnDqL0hBvngQOmPY8k1 y3y3nkCUuNb3jK9dfjE9QrtDfkm7j2CMKwOy7kKMJScP0db2O+SCZ6yl3DL0qQgXnXEODzH X-QQ-GoodBg: 0 Message-Id: <18E7C3AE1AED9620D79771320471FF86@bansion.cn> Date: Wed, 12 May 2021 17:02:53 +0800 Priority: urgent X-Priority: 1 Importance: high X-DM-Templet-ReadReply: 1 X-Mailer: DM Pro6 [GB - 6.3.2.325] From: "Andrew Wang" Subject: RE: interactive display, interactive whiteboard, interactive flat panel To: "dev-commits-src-main" Reply-To: andrew@bansion.com X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:bansion.cn:qybgforeign:qybgforeign1 X-QQ-Bgrelay: 1 X-Rspamd-Queue-Id: 4Fg82b0Pjpz3t4w X-Spamd-Bar: ++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of andrew@bansion.cn designates 54.207.22.56 as permitted sender) smtp.mailfrom=andrew@bansion.cn X-Spamd-Result: default: False [2.82 / 15.00]; HAS_REPLYTO(0.00)[andrew@bansion.com]; RWL_MAILSPIKE_GOOD(0.00)[54.207.22.56:from]; R_SPF_ALLOW(-0.20)[+ip4:54.207.22.56:c]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MIME_BASE64_TEXT(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:~]; HAS_X_PRIO_ONE(0.00)[1]; PHISHING(0.72)[bansion->s8ke]; R_DKIM_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; ASN(0.00)[asn:16509, ipnet:54.207.0.0/17, country:US]; ARC_NA(0.00)[]; FAKE_REPLY(1.00)[]; FREEFALL_USER(0.00)[andrew]; FROM_HAS_DN(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[54.207.22.56:from]; TO_MATCH_ENVRCPT_ALL(0.00)[]; HEADER_FORGED_MDN(2.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[113.88.112.5:received]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-main@freebsd.org]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[54.207.22.56:from:127.0.2.255]; RCVD_TLS_LAST(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[54.207.22.56:from]; MIME_HTML_ONLY(0.20)[]; DMARC_NA(0.00)[bansion.cn]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-main] MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 09:03:04 -0000 From owner-dev-commits-src-main@freebsd.org Wed May 12 13:31:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D124863E6B6; Wed, 12 May 2021 13:31:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgG024rWDz4bfr; Wed, 12 May 2021 13:31:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 996CA40AC; Wed, 12 May 2021 13:31:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14CDVEUd045991; Wed, 12 May 2021 13:31:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14CDVEoJ045990; Wed, 12 May 2021 13:31:14 GMT (envelope-from git) Date: Wed, 12 May 2021 13:31:14 GMT Message-Id: <202105121331.14CDVEoJ045990@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 12dda000ed32 - main - sctp: fix locking in case of error handling during a restart MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 12dda000ed32efa16f59909a6294e4d4b5a771ba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 13:31:14 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=12dda000ed32efa16f59909a6294e4d4b5a771ba commit 12dda000ed32efa16f59909a6294e4d4b5a771ba Author: Michael Tuexen AuthorDate: 2021-05-12 13:29:06 +0000 Commit: Michael Tuexen CommitDate: 2021-05-12 13:29:06 +0000 sctp: fix locking in case of error handling during a restart Thanks to Taylor Brandstetter for finding the issue and providing a patch for the userland stack. MFC after: 3 days --- sys/netinet/sctp_input.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 050f30d145b7..f066cc100ac2 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -1395,6 +1395,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, vrf_id, net->port); if (how_indx < sizeof(asoc->cookie_how)) asoc->cookie_how[how_indx] = 2; + SCTP_TCB_UNLOCK(stcb); return (NULL); } /* @@ -1409,9 +1410,11 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, (uint8_t *)&init_buf); if (init_cp == NULL) { /* could not pull a INIT chunk in cookie */ + SCTP_TCB_UNLOCK(stcb); return (NULL); } if (init_cp->ch.chunk_type != SCTP_INITIATION) { + SCTP_TCB_UNLOCK(stcb); return (NULL); } /* @@ -1424,9 +1427,11 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, (uint8_t *)&initack_buf); if (initack_cp == NULL) { /* could not pull INIT-ACK chunk in cookie */ + SCTP_TCB_UNLOCK(stcb); return (NULL); } if (initack_cp->ch.chunk_type != SCTP_INITIATION_ACK) { + SCTP_TCB_UNLOCK(stcb); return (NULL); } if ((ntohl(initack_cp->init.initiate_tag) == asoc->my_vtag) && @@ -1452,6 +1457,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, */ if (how_indx < sizeof(asoc->cookie_how)) asoc->cookie_how[how_indx] = 17; + SCTP_TCB_UNLOCK(stcb); return (NULL); } switch (SCTP_GET_STATE(stcb)) { @@ -1567,6 +1573,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, */ if (how_indx < sizeof(asoc->cookie_how)) asoc->cookie_how[how_indx] = 6; + SCTP_TCB_UNLOCK(stcb); return (NULL); } /* @@ -1592,6 +1599,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, sctp_send_abort(m, iphlen, src, dst, sh, 0, op_err, mflowtype, mflowid, inp->fibnum, vrf_id, port); + SCTP_TCB_UNLOCK(stcb); return (NULL); } if ((ntohl(initack_cp->init.initiate_tag) == asoc->my_vtag) && @@ -1622,6 +1630,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, if (how_indx < sizeof(asoc->cookie_how)) asoc->cookie_how[how_indx] = 7; + SCTP_TCB_UNLOCK(stcb); return (NULL); } if (how_indx < sizeof(asoc->cookie_how)) @@ -1952,6 +1961,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, if (how_indx < sizeof(asoc->cookie_how)) asoc->cookie_how[how_indx] = 16; /* all other cases... */ + SCTP_TCB_UNLOCK(stcb); return (NULL); } From owner-dev-commits-src-main@freebsd.org Wed May 12 14:48:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CBED7640D92; Wed, 12 May 2021 14:48:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgHjN5RkZz4g8Y; Wed, 12 May 2021 14:48:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE2BC5227; Wed, 12 May 2021 14:48:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14CEmeah042734; Wed, 12 May 2021 14:48:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14CEmeUm042733; Wed, 12 May 2021 14:48:40 GMT (envelope-from git) Date: Wed, 12 May 2021 14:48:40 GMT Message-Id: <202105121448.14CEmeUm042733@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Glen Barber Subject: git: 3f25cfea5592 - main - release: update release.sh to use Git for ports tree checkouts MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3f25cfea55922780fe47eb6ebcef49ca15297261 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 14:48:40 -0000 The branch main has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=3f25cfea55922780fe47eb6ebcef49ca15297261 commit 3f25cfea55922780fe47eb6ebcef49ca15297261 Author: Glen Barber AuthorDate: 2021-05-12 14:27:21 +0000 Commit: Glen Barber CommitDate: 2021-05-12 14:27:21 +0000 release: update release.sh to use Git for ports tree checkouts MFC after: immediately (pending re approval) Sponsored by: Rubicon Communications, LLC ("Netgate") --- release/release.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/release/release.sh b/release/release.sh index aa2ef4e6b3da..84a7813205f9 100755 --- a/release/release.sh +++ b/release/release.sh @@ -86,7 +86,7 @@ env_setup() { # and ports/. GITROOT="https://git.FreeBSD.org/" SRCBRANCH="main" - PORTBRANCH="head" + PORTBRANCH="main" GITSRC="src.git" GITPORTS="ports.git" @@ -141,8 +141,7 @@ env_check() { # Prefix the branches with the GITROOT for the full checkout URL. SRC="${GITROOT}${GITSRC}" - #PORT="${GITROOT}${GITPORTS}" - PORT="svn://svn.freebsd.org/ports/" + PORT="${GITROOT}${GITPORTS}" if [ -n "${EMBEDDEDBUILD}" ]; then WITH_DVD= From owner-dev-commits-src-main@freebsd.org Wed May 12 14:48:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2BF44640D34; Wed, 12 May 2021 14:48:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgHjP6sLhz4gYC; Wed, 12 May 2021 14:48:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9FB35514; Wed, 12 May 2021 14:48:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14CEmfBX042755; Wed, 12 May 2021 14:48:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14CEmfJH042754; Wed, 12 May 2021 14:48:41 GMT (envelope-from git) Date: Wed, 12 May 2021 14:48:41 GMT Message-Id: <202105121448.14CEmfJH042754@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Glen Barber Subject: git: fb6e261c20eb - main - release: follow-up to previous commit to use Git for the ports tree MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fb6e261c20ebcd94875d623e167369802721f2dd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 14:48:42 -0000 The branch main has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=fb6e261c20ebcd94875d623e167369802721f2dd commit fb6e261c20ebcd94875d623e167369802721f2dd Author: Glen Barber AuthorDate: 2021-05-12 14:29:53 +0000 Commit: Glen Barber CommitDate: 2021-05-12 14:29:53 +0000 release: follow-up to previous commit to use Git for the ports tree MFC after: immediately (pending re approval) Sponsored by: Rubicon Communications, LLC ("Netgate") --- release/release.sh | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/release/release.sh b/release/release.sh index 84a7813205f9..87e22e669fd1 100755 --- a/release/release.sh +++ b/release/release.sh @@ -222,16 +222,8 @@ chroot_setup() { fi fi if [ -z "${NOPORTS}" ] && [ -z "${PORTS_UPDATE_SKIP}" ]; then - # if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then - # git -C ${CHROOTDIR}/usr/ports pull -q - # XXX: Workaround for the overlap in the Git conversion timeframe. - if [ -d "${CHROOTDIR}/usr/ports/.svn" ]; then - ${SVNCMD} update ${CHROOTDIR}/usr/ports - else - #${VCSCMD} ${PORT} -b ${PORTBRANCH} ${CHROOTDIR}/usr/ports - # XXX: Workaround for the overlap in the Git - # conversion timeframe. - ${SVNCMD} co ${PORT}/${PORTBRANCH} ${CHROOTDIR}/usr/ports + if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then + git -C ${CHROOTDIR}/usr/ports pull -q fi fi From owner-dev-commits-src-main@freebsd.org Wed May 12 14:48:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A9C1640E16; Wed, 12 May 2021 14:48:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgHjR0fftz4gfP; Wed, 12 May 2021 14:48:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 09871505E; Wed, 12 May 2021 14:48:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14CEmgR6042778; Wed, 12 May 2021 14:48:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14CEmgAB042777; Wed, 12 May 2021 14:48:42 GMT (envelope-from git) Date: Wed, 12 May 2021 14:48:42 GMT Message-Id: <202105121448.14CEmgAB042777@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Glen Barber Subject: git: 69b6abb7b2bb - main - release: remove logic to locate the svn{, lite} binary MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 69b6abb7b2bb2b07600b27660d864ddcd0b28cec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 14:48:43 -0000 The branch main has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=69b6abb7b2bb2b07600b27660d864ddcd0b28cec commit 69b6abb7b2bb2b07600b27660d864ddcd0b28cec Author: Glen Barber AuthorDate: 2021-05-12 14:32:03 +0000 Commit: Glen Barber CommitDate: 2021-05-12 14:32:03 +0000 release: remove logic to locate the svn{,lite} binary Sponsored by: Rubicon Communications, LLC ("Netgate") --- release/release.sh | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/release/release.sh b/release/release.sh index 87e22e669fd1..a448361b86a6 100755 --- a/release/release.sh +++ b/release/release.sh @@ -65,17 +65,6 @@ env_setup() { [ ! -z "${VCSCMD}" ] && break 2 done - # Find the Subversion binary to use. This is a workaround to use - # the source of truth for the ports tree, as the conversion to Git - # is targeted to occur slightly after the currently-scheduled 13.0 - # release. - for _dir in /usr/bin /usr/local/bin; do - for _svn in svn svnlite; do - [ -x "${_dir}/${_svn}" ] && SVNCMD="${_dir}/${_svn}" - [ ! -z "${SVNCMD}" ] && break 2 - done - done - if [ -z "${VCSCMD}" -a -z "${NOGIT}" ]; then echo "*** The devel/git port/package is required." exit 1 From owner-dev-commits-src-main@freebsd.org Wed May 12 16:04:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 981C2643F55; Wed, 12 May 2021 16:04:31 +0000 (UTC) (envelope-from yasu@utahime.org) Received: from maybe.home.utahime.org (gate.home.utahime.org [183.180.29.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgKNv26q7z4nFd; Wed, 12 May 2021 16:04:30 +0000 (UTC) (envelope-from yasu@utahime.org) Received: from eastasia.home.utahime.org (eastasia.home.utahime.org [192.168.174.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by maybe.home.utahime.org (Postfix) with ESMTPS id 068D72EAED; Thu, 13 May 2021 01:04:26 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=utahime.org; s=maybe2019112701; t=1620835466; bh=jI0h5E0Jpa44AqE+3T43HONXHiHdnyKK4DGFlkdII4Y=; h=Date:To:Cc:Subject:From:In-Reply-To:References; b=u1Eke5sJ6KXxHXCNuodx8BDzVaP6Zn7GtVX+vbsSYAz4qpLDIX/BoCv3zFEw3Nu5n 0a4LxWWZvXsB2BBB6oxzMrNVGTpSxhVASHwEtfcFJ8hgF9PgInCMQvnIDNxpqRDiqF wl8El7T8tytH/x9Djzx0uWlbJ66awqJjy+/dr+NnJQgtm6KK/rkmxBoJNWOXr4uQii 4NFfOy3X0dC7B8wflpah0ATP3taV3WPG920rL0zITuDymPhJq32eOgmRz2Ik51fX7v WksKbbZdVPIl4QaGDXs0hWUMTh80nMh+htIp15iF7FAyPjQHsoDGVVUIjBu18/AnWG onaV9KJc9V6UA== Received: from localhost (rolling.home.utahime.org [192.168.174.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by eastasia.home.utahime.org (Postfix) with ESMTPSA id F13C43B410; Thu, 13 May 2021 01:04:24 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.2 at eastasia.home.utahime.org Date: Thu, 13 May 2021 01:03:37 +0900 (JST) Message-Id: <20210513.010337.560902240722301845.yasu@utahime.org> To: gjb@FreeBSD.org Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: fb6e261c20eb - main - release: follow-up to previous commit to use Git for the ports tree From: Yasuhiro Kimura In-Reply-To: <202105121448.14CEmfJH042754@gitrepo.freebsd.org> References: <202105121448.14CEmfJH042754@gitrepo.freebsd.org> X-Mailer: Mew version 6.8 on Emacs 27.2 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4FgKNv26q7z4nFd X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 16:04:31 -0000 Hello Glen, From: Glen Barber Subject: git: fb6e261c20eb - main - release: follow-up to previous commit to use Git for the ports tree Date: Wed, 12 May 2021 14:48:41 GMT > diff --git a/release/release.sh b/release/release.sh > index 84a7813205f9..87e22e669fd1 100755 > --- a/release/release.sh > +++ b/release/release.sh > @@ -222,16 +222,8 @@ chroot_setup() { > fi > fi > if [ -z "${NOPORTS}" ] && [ -z "${PORTS_UPDATE_SKIP}" ]; then > - # if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then > - # git -C ${CHROOTDIR}/usr/ports pull -q > - # XXX: Workaround for the overlap in the Git conversion timeframe. > - if [ -d "${CHROOTDIR}/usr/ports/.svn" ]; then > - ${SVNCMD} update ${CHROOTDIR}/usr/ports > - else > - #${VCSCMD} ${PORT} -b ${PORTBRANCH} ${CHROOTDIR}/usr/ports > - # XXX: Workaround for the overlap in the Git > - # conversion timeframe. > - ${SVNCMD} co ${PORT}/${PORTBRANCH} ${CHROOTDIR}/usr/ports > + if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then > + git -C ${CHROOTDIR}/usr/ports pull -q > fi > fi This should be such as following. ---------------------------------------------------------------------- if [ -z "${NOPORTS}" ] && [ -z "${PORTS_UPDATE_SKIP}" ]; then - # if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then - # git -C ${CHROOTDIR}/usr/ports pull -q - # XXX: Workaround for the overlap in the Git conversion timeframe. - if [ -d "${CHROOTDIR}/usr/ports/.svn" ]; then - ${SVNCMD} update ${CHROOTDIR}/usr/ports - else - #${VCSCMD} ${PORT} -b ${PORTBRANCH} ${CHROOTDIR}/usr/ports - # XXX: Workaround for the overlap in the Git - # conversion timeframe. - ${SVNCMD} co ${PORT}/${PORTBRANCH} ${CHROOTDIR}/usr/ports + if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then + git -C ${CHROOTDIR}/usr/ports pull -q + else + ${VCSCMD} ${PORT} -b ${PORTBRANCH} ${CHROOTDIR}/usr/ports fi fi ---------------------------------------------------------------------- Or ports tree isn't checked out when build is from scratch. --- Yasuhiro Kimura From owner-dev-commits-src-main@freebsd.org Wed May 12 16:06:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B61B0644056; Wed, 12 May 2021 16:06:47 +0000 (UTC) (envelope-from gjb@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgKRW4nGpz4nP5; Wed, 12 May 2021 16:06:47 +0000 (UTC) (envelope-from gjb@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1620835607; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iM/6S/XBpIHR3FKh83auetAQd0nHp17ge8Ep90ukPs4=; b=Kjnc9ydulKwJ4FEEW6htLj7eJmft7N1yCx9i+vS3LN48oR7zi2cEJ+U+Y1osHSfXlV5Vbt Q5qVsPvplgyll6of5wb/zZhimnEKEQZBK3MH7NVBq8PmdcK4HdcSmEH25drqNXMpcmeCqW e4y+CfdRNM/+z4cj00VCFzs7yr0QlyjkMWN4Hp2pSPDzgaBek5rh/I7vNQLzdZ+zmcVUOG vrWg9b3IlS3ENPUHQINBGZR4XC031N1bw59adl/b1iGALN9DvqleEE6TgK/dD95CMoKXVh nIr2niOTnh2sDXzsj9gkkc037IeIBBAJfO3xoHv6DBfa+ebu/MjpBJinYAet9w== Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 31BF818C07; Wed, 12 May 2021 16:06:47 +0000 (UTC) (envelope-from gjb@freebsd.org) Date: Wed, 12 May 2021 16:06:45 +0000 From: Glen Barber To: Yasuhiro Kimura Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: fb6e261c20eb - main - release: follow-up to previous commit to use Git for the ports tree Message-ID: <20210512160645.GJ92026@FreeBSD.org> References: <202105121448.14CEmfJH042754@gitrepo.freebsd.org> <20210513.010337.560902240722301845.yasu@utahime.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="QFQuXaHm0gDucWbk" Content-Disposition: inline In-Reply-To: <20210513.010337.560902240722301845.yasu@utahime.org> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1620835607; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iM/6S/XBpIHR3FKh83auetAQd0nHp17ge8Ep90ukPs4=; b=wJmfwqtzZJaRHh90jewE8Fjzm+gZ9VpHeV9AQvdr/Ov/MRXxnCqYwPIvph1a0M9rxpQAJM ZrG+hQuVPEWSv6brJtC1Ql7jeA5FES4LDrAsImkbaLrggYV3+Sr4EGxfMIawzUif/oe0ua i0yPOK3NsBfmz026KqHMVHkE7MRNy8ELh4mCn6ANP5znPm+P/LXmZvTrZjxnpRo9EJMgKa 8u1cZWxmUbOCI1QYBXmeGVgHPiKrcdlzz4HsfJUxYl9Y63kBRLWU6tC1mpu0lbgRE01qRe Md+1G/biBV4VvzwSJGz9WsdID717oyjuFrHd/MgBkj14Mddj4qbTM/cHla99yw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1620835607; a=rsa-sha256; cv=none; b=iE+2vhOtTM7+rRbhfXN9olLQtdHhDG/s0Ffhq9ogABDK6dOeAuUZUNHD6h8EjPE19F+3U9 9AQkJ635VADipvOnwUlqblb/Kb+LotHkvPWAa1fYG0qbJkkr8x4tKvwZ+GHEPTauEGKVEW osAq3kcani7w1rJGEAt7Mtt4+OIS0KpFGNr4mBNUj63hMvEhdc1KaMJhjhxgJd3Kn27yS0 3TmK2PcmWZp50fvKRL2z8+C45ZmwHzxdHBFtWpRqYAtO3eW7AxKI/8l4db0f2oHasoXXOC o9jvMzwHzD8QJ+yZWb/RBPE0HO0LPjgSU8v9+1OEopllZo+IJKt8Kr06kQvL6w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 16:06:47 -0000 --QFQuXaHm0gDucWbk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 13, 2021 at 01:03:37AM +0900, Yasuhiro Kimura wrote: > Hello Glen, >=20 > From: Glen Barber > Subject: git: fb6e261c20eb - main - release: follow-up to previous commit= to use Git for the ports tree > Date: Wed, 12 May 2021 14:48:41 GMT >=20 > > diff --git a/release/release.sh b/release/release.sh > > index 84a7813205f9..87e22e669fd1 100755 > > --- a/release/release.sh > > +++ b/release/release.sh > > @@ -222,16 +222,8 @@ chroot_setup() { > > fi > > fi > > if [ -z "${NOPORTS}" ] && [ -z "${PORTS_UPDATE_SKIP}" ]; then > > - # if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then > > - # git -C ${CHROOTDIR}/usr/ports pull -q > > - # XXX: Workaround for the overlap in the Git conversion timeframe. > > - if [ -d "${CHROOTDIR}/usr/ports/.svn" ]; then > > - ${SVNCMD} update ${CHROOTDIR}/usr/ports > > - else > > - #${VCSCMD} ${PORT} -b ${PORTBRANCH} ${CHROOTDIR}/usr/ports > > - # XXX: Workaround for the overlap in the Git > > - # conversion timeframe. > > - ${SVNCMD} co ${PORT}/${PORTBRANCH} ${CHROOTDIR}/usr/ports > > + if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then > > + git -C ${CHROOTDIR}/usr/ports pull -q > > fi > > fi >=20 > This should be such as following. >=20 > ---------------------------------------------------------------------- > if [ -z "${NOPORTS}" ] && [ -z "${PORTS_UPDATE_SKIP}" ]; then > - # if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then > - # git -C ${CHROOTDIR}/usr/ports pull -q > - # XXX: Workaround for the overlap in the Git conversion timeframe. > - if [ -d "${CHROOTDIR}/usr/ports/.svn" ]; then > - ${SVNCMD} update ${CHROOTDIR}/usr/ports > - else > - #${VCSCMD} ${PORT} -b ${PORTBRANCH} ${CHROOTDIR}/usr/ports > - # XXX: Workaround for the overlap in the Git > - # conversion timeframe. > - ${SVNCMD} co ${PORT}/${PORTBRANCH} ${CHROOTDIR}/usr/ports > + if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then > + git -C ${CHROOTDIR}/usr/ports pull -q > + else > + ${VCSCMD} ${PORT} -b ${PORTBRANCH} ${CHROOTDIR}/usr/ports > fi > fi > ---------------------------------------------------------------------- >=20 > Or ports tree isn't checked out when build is from scratch. >=20 Bah, you're right. I fixed it in stable/13 without noticing it was needed here, too. Thanks for spotting this. Glen --QFQuXaHm0gDucWbk Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEjRJAPC5sqwhs9k2jAxRYpUeP4pMFAmCb/RQACgkQAxRYpUeP 4pN75Q/+Jebv7Kefjt7Q9E+aFj0SHLl8Dt+p2xetVJAyPejm+UEZvrZ4D7kP1A57 fJXgPehfZ6TEYhW0sZIUyMInX+RCmhgcgN6Lhhf/LU9GuHIsLpDjdluv5tOiY4Wr iitAYvmmycvxZBReyQmEHw1tw5IuHvuys6/RxO2rfUXYLz90CgERykqJ6fUCHM54 5D+RHw/Mio3Daa8F+srCxUkXhKmeFWOsBiKxWdNffVGeYxQispuVQjLmtOoveZRN pS6e8hdg7ZSFzaDLfW8/Vx2D7Ek3k5i/xPi/aHB0yBLGH+y5JVRGS3fi52dr1zOl qBRCOdHvwv7Qa9aRM29bBtG/aEzhRF+sskUf2NbT6w7KBGfxopYETNRt90T6Z4qn 73wz8yimmFwkBwfN8IQYOLKNwSuTZEjJN55LnmxLotX5ClyCv2dTWGTqYtqlD+MH 6xgCOXLLHMOHxHW3400vF5zZW1xGGEqL1R5GQeM8w11uj7zQae0I8D3z837erlCT 2VciT6QxDAmgIpbGf8iNSFGalecimYo+3S+io38NtkF+2HCPjs2Wp382vYYvKL9O P4AAAHkSTDfsDPg+J65nARQCvdKYENTMup5PVoEypVXm78Rv+37COZr8GfWNizef ygTgo5Ktl4iYN68XhDQDINSdh0g/tUuBBLdjkDqKOaUfm+gxU3A= =lSKz -----END PGP SIGNATURE----- --QFQuXaHm0gDucWbk-- From owner-dev-commits-src-main@freebsd.org Wed May 12 16:09:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 44EB16445BD; Wed, 12 May 2021 16:09:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgKVS1WPgz4njp; Wed, 12 May 2021 16:09:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 231136427; Wed, 12 May 2021 16:09:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14CG9K0m051533; Wed, 12 May 2021 16:09:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14CG9J2F051532; Wed, 12 May 2021 16:09:19 GMT (envelope-from git) Date: Wed, 12 May 2021 16:09:19 GMT Message-Id: <202105121609.14CG9J2F051532@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Glen Barber Subject: git: c0dbc49ab3f7 - main - release: fix ports checkout if /usr/ports does not exist MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c0dbc49ab3f7e43a2972c932fcd2b2ed4d06448b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 16:09:20 -0000 The branch main has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=c0dbc49ab3f7e43a2972c932fcd2b2ed4d06448b commit c0dbc49ab3f7e43a2972c932fcd2b2ed4d06448b Author: Glen Barber AuthorDate: 2021-05-12 16:08:59 +0000 Commit: Glen Barber CommitDate: 2021-05-12 16:08:59 +0000 release: fix ports checkout if /usr/ports does not exist Reported by: Yasuhiro Kimura Sponsored by: Rubicon Communications, LLC ("Netgate") --- release/release.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/release/release.sh b/release/release.sh index a448361b86a6..75278a12daa6 100755 --- a/release/release.sh +++ b/release/release.sh @@ -213,6 +213,8 @@ chroot_setup() { if [ -z "${NOPORTS}" ] && [ -z "${PORTS_UPDATE_SKIP}" ]; then if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then git -C ${CHROOTDIR}/usr/ports pull -q + else + ${VCSCMD} ${PORT} -b ${PORTBRANCH} ${CHROOTDIR}/usr/ports fi fi From owner-dev-commits-src-main@freebsd.org Wed May 12 16:10:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 226556446BE; Wed, 12 May 2021 16:10:51 +0000 (UTC) (envelope-from gjb@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgKXC0SKSz4ngT; Wed, 12 May 2021 16:10:51 +0000 (UTC) (envelope-from gjb@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1620835851; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YuRK6vs4aeCb/p8Z+t1qHEjnFu/7tia3v7UUFSp14+g=; b=oFEbPFjSNIsC2iG3+xC5r6HRq2I3y3eaY8+e6svPuxIspdA9BTFZfS7CZj4nFY872WqGpW 1gtnOU0PfKHn3gf/ra2u3CG66hlDB7/ew4el7+kG+i46yYtLNwHEsH1XfWvHD9CbWInNSU diUiAu7gZHw1KnBPfupQZbC95XJQVpi3qow+iOlfB2ZE0vjUDie+GnlyaMYDIJ3TZ5pE4F /3oVuh/adlbCiX6gPtmSGGM7LMiFd/mHn19JsChbQkrO7mAl9Ug4d4f+LLEIrYmWYvCppO Aq6LZ/0GDYSnukGpDDYfRsthm7sjnXTYr3dzQZXzZ4xSYgNz86mviHxDpvb7Cw== Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 95AFC18C19; Wed, 12 May 2021 16:10:50 +0000 (UTC) (envelope-from gjb@freebsd.org) Date: Wed, 12 May 2021 16:10:48 +0000 From: Glen Barber To: Yasuhiro Kimura Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: fb6e261c20eb - main - release: follow-up to previous commit to use Git for the ports tree Message-ID: <20210512161048.GK92026@FreeBSD.org> References: <202105121448.14CEmfJH042754@gitrepo.freebsd.org> <20210513.010337.560902240722301845.yasu@utahime.org> <20210512160645.GJ92026@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="+yydNiOxrtWvz4sx" Content-Disposition: inline In-Reply-To: <20210512160645.GJ92026@FreeBSD.org> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1620835851; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YuRK6vs4aeCb/p8Z+t1qHEjnFu/7tia3v7UUFSp14+g=; b=mMFWGhhCCWpgqPTPkxUGMYtBCNcEpQjj/SVNVhi36YuGJ7JaRktMlcWROxB1ttFtOcIgcJ i4udx/XLtaVNu+k/lMP7Rs1tZFNmYXeGSDHuJLocrltPTcCIqI9neqrC6G8+y7mZO74Z2/ khBEU0rkb3ZdHbBCnhN/vFiu/da/cwstf6DO3F+cAlgKWVqY7Wl/Wl2MY0+xRm9z4tc/Zp uR1NUEqXmbBJ0Vc0lHpczzBb/iq0spmrFaAddlu3mnmx8+k6whMA91Bmd1zzIU0hr63D2m wq1EOl2OxB0xICYuxBcdpWxxePCEcRrS1cxIuB0b8b68p2zKhBAo9d4UcdX1ag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1620835851; a=rsa-sha256; cv=none; b=ykVRhs3u07rNzkOdpN3Y5Flcgb8KLEISlRsq0qDNsrRQxZiHUFcLt4MvPB40Jy9PL270KU 5SNg3ZR3KVgjZQ3MVcaVVwgjK+7iSpUfrZ4J75xW5NLUuYyKGntX2jaqg/hgQEabdeedki VX70ewjggezlwen9ABP0nGu73678WWwmcFpAtNVWXiyj79TE986SkBJWoHBrsUyKSdxTqW aKTXeAswAbekRb3gWwNPjLtnyDQ0i6koCnY0BlLwieu7HMEbFYbn2r63vqP1kkyA2MiTk9 s9IDXrthlMnSKlGVQmdGCXsWF6BV+eW5SI+ZgHZVgVRMTt/i6IRJL846pZC+lg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 16:10:51 -0000 --+yydNiOxrtWvz4sx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 12, 2021 at 04:06:45PM +0000, Glen Barber wrote: > On Thu, May 13, 2021 at 01:03:37AM +0900, Yasuhiro Kimura wrote: > > Hello Glen, > >=20 > > From: Glen Barber > > Subject: git: fb6e261c20eb - main - release: follow-up to previous comm= it to use Git for the ports tree > > Date: Wed, 12 May 2021 14:48:41 GMT > >=20 > > > diff --git a/release/release.sh b/release/release.sh > > > index 84a7813205f9..87e22e669fd1 100755 > > > --- a/release/release.sh > > > +++ b/release/release.sh > > > @@ -222,16 +222,8 @@ chroot_setup() { > > > fi > > > fi > > > if [ -z "${NOPORTS}" ] && [ -z "${PORTS_UPDATE_SKIP}" ]; then > > > - # if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then > > > - # git -C ${CHROOTDIR}/usr/ports pull -q > > > - # XXX: Workaround for the overlap in the Git conversion timeframe. > > > - if [ -d "${CHROOTDIR}/usr/ports/.svn" ]; then > > > - ${SVNCMD} update ${CHROOTDIR}/usr/ports > > > - else > > > - #${VCSCMD} ${PORT} -b ${PORTBRANCH} ${CHROOTDIR}/usr/ports > > > - # XXX: Workaround for the overlap in the Git > > > - # conversion timeframe. > > > - ${SVNCMD} co ${PORT}/${PORTBRANCH} ${CHROOTDIR}/usr/ports > > > + if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then > > > + git -C ${CHROOTDIR}/usr/ports pull -q > > > fi > > > fi > >=20 > > This should be such as following. > >=20 > > ---------------------------------------------------------------------- > > if [ -z "${NOPORTS}" ] && [ -z "${PORTS_UPDATE_SKIP}" ]; then > > - # if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then > > - # git -C ${CHROOTDIR}/usr/ports pull -q > > - # XXX: Workaround for the overlap in the Git conversion timeframe. > > - if [ -d "${CHROOTDIR}/usr/ports/.svn" ]; then > > - ${SVNCMD} update ${CHROOTDIR}/usr/ports > > - else > > - #${VCSCMD} ${PORT} -b ${PORTBRANCH} ${CHROOTDIR}/usr/ports > > - # XXX: Workaround for the overlap in the Git > > - # conversion timeframe. > > - ${SVNCMD} co ${PORT}/${PORTBRANCH} ${CHROOTDIR}/usr/ports > > + if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then > > + git -C ${CHROOTDIR}/usr/ports pull -q > > + else > > + ${VCSCMD} ${PORT} -b ${PORTBRANCH} ${CHROOTDIR}/usr/ports > > fi > > fi > > ---------------------------------------------------------------------- > >=20 > > Or ports tree isn't checked out when build is from scratch. > >=20 >=20 > Bah, you're right. I fixed it in stable/13 without noticing it was > needed here, too. >=20 > Thanks for spotting this. >=20 Oops. It turns out I did not fix this in stable/13. I pushed an update there, too. Glen --+yydNiOxrtWvz4sx Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEjRJAPC5sqwhs9k2jAxRYpUeP4pMFAmCb/ggACgkQAxRYpUeP 4pOopg//exr/7nEUuIMBv3rUEn97TCTRwi6Bl3bRFo2249u/AfZDSiQnCNcCN7pL CpVJo05vOGZVO96jNudq1pxrJqoolevep0wnrz898M73IgiVfoktuhU8i+dqfKHZ imXaDDlt5sDfi0BNbraXZ7OEUFtI2LklwIiilHQYiC5oA4+nbfFKJDnmnZLbEv4T u7CXZ8Fi1E7TR/tZx7lSzXxsclUcAfUi1y90kJL0S7+yYTAKcd16PD95N6NE2SQG 8oh1p642DNuXuqxqLXnfD4gcs8x6BNraPT4GhJIoG/SX9iyWesnGJBish6iopbXV 8Pjujg58EEwH0dOjDrgA3nroXBcLoydYf7JbkI7xcIFNxH5UFBTiECmv295RKNQW g90zeGswCDz/2P/7Vc8mVPER1Ndjdcn1skBEMu6dYD2bFpOJPC69SfndKEarTCdP PcDd+PJmICG2Nleg1fpBfZG/vawIXIZjA5ljpktS1WjgVUN13R7/vMauH0n0MgLU EIrum5FR2z0kA9w2eNls+g5cLqgN5L419D9xnkjJ2rpLVgKQNhs0Ih/0hLLRwVut uL7MQ4pxC1ObeLVjYSYWNfgCbLivEGt9jTisiMZGA+d0vlCuoosetjc7nbwncapP +nM7GdJtj7kZ9ji4RV8+pzYRlGI5yLp8MIORr2i1iuFfZWeXwpQ= =iLd8 -----END PGP SIGNATURE----- --+yydNiOxrtWvz4sx-- From owner-dev-commits-src-main@freebsd.org Wed May 12 16:11:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 12FEA6449A6; Wed, 12 May 2021 16:11:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgKYT01wJz4nhK; Wed, 12 May 2021 16:11:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7C766835; Wed, 12 May 2021 16:11:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14CGBunh061093; Wed, 12 May 2021 16:11:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14CGBud7061092; Wed, 12 May 2021 16:11:56 GMT (envelope-from git) Date: Wed, 12 May 2021 16:11:56 GMT Message-Id: <202105121611.14CGBud7061092@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 251842c63927 - main - tcp rack: improve initialisation of retransmit timeout MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 251842c63927fc4af63bdc61989bbfbf3823c679 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 16:11:57 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=251842c63927fc4af63bdc61989bbfbf3823c679 commit 251842c63927fc4af63bdc61989bbfbf3823c679 Author: Michael Tuexen AuthorDate: 2021-05-12 15:58:56 +0000 Commit: Michael Tuexen CommitDate: 2021-05-12 16:02:21 +0000 tcp rack: improve initialisation of retransmit timeout When the TCP is in the front states, don't take the slop variable into account. This improves consistency with the base stack. Reviewed by: rrs@ Differential Revision: https://reviews.freebsd.org/D30230 MFC after: 1 week Sponsored by: Netflix, Inc. --- sys/netinet/tcp_stacks/rack.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index e6b2ef60cef7..115f5f2ee44b 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -6606,8 +6606,13 @@ rack_convert_rtts(struct tcpcb *tp) tp->t_rttvar += frac; } } - RACK_TCPT_RANGESET(tp->t_rxtcur, RACK_REXMTVAL(tp), - rack_rto_min, rack_rto_max); + tp->t_rxtcur = RACK_REXMTVAL(tp); + if (TCPS_HAVEESTABLISHED(tp->t_state)) { + tp->t_rxtcur += TICKS_2_USEC(tcp_rexmit_slop); + } + if (tp->t_rxtcur > rack_rto_max) { + tp->t_rxtcur = rack_rto_max; + } } static void From owner-dev-commits-src-main@freebsd.org Wed May 12 16:36:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8CF9B645227; Wed, 12 May 2021 16:36:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgL5r3ZNlz4ptX; Wed, 12 May 2021 16:36:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6DC386943; Wed, 12 May 2021 16:36:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14CGaWpL091709; Wed, 12 May 2021 16:36:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14CGaW94091708; Wed, 12 May 2021 16:36:32 GMT (envelope-from git) Date: Wed, 12 May 2021 16:36:32 GMT Message-Id: <202105121636.14CGaW94091708@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 93f7be080f3a - main - Update the EFI timer to be called once a second MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 93f7be080f3ad0bd71190d87aa2043d714270206 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 16:36:32 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=93f7be080f3ad0bd71190d87aa2043d714270206 commit 93f7be080f3ad0bd71190d87aa2043d714270206 Author: Andrew Turner AuthorDate: 2021-05-12 08:59:04 +0000 Commit: Andrew Turner CommitDate: 2021-05-12 14:12:34 +0000 Update the EFI timer to be called once a second There is no need to call it evert 10ms when we need 1s granularity. Update to update the time every second. Reviewed by: imp, manu, tsoome Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D30227 --- stand/efi/libefi/time_event.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stand/efi/libefi/time_event.c b/stand/efi/libefi/time_event.c index f96f1d845f6a..f171bf997078 100644 --- a/stand/efi/libefi/time_event.c +++ b/stand/efi/libefi/time_event.c @@ -40,7 +40,7 @@ static void time_update(EFI_EVENT event, void *context) { - curtime += 10; + curtime++; } void @@ -50,8 +50,8 @@ efi_time_init(void) /* Create a timer event */ BS->CreateEvent(EVT_TIMER | EVT_NOTIFY_SIGNAL, TPL_CALLBACK, time_update, 0, &time_event); - /* Use a 10ms timer */ - BS->SetTimer(time_event, TimerPeriodic, 100000); + /* Use a 1s timer */ + BS->SetTimer(time_event, TimerPeriodic, 10000000); } void @@ -68,7 +68,7 @@ time(time_t *tloc) { time_t t; - t = curtime / 1000; + t = curtime; if (tloc != NULL) *tloc = t; From owner-dev-commits-src-main@freebsd.org Wed May 12 17:09:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34EF1646112; Wed, 12 May 2021 17:09:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgLqw11V6z4rH9; Wed, 12 May 2021 17:09:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 15B4D738D; Wed, 12 May 2021 17:09:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14CH9VUc031710; Wed, 12 May 2021 17:09:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14CH9Vrp031709; Wed, 12 May 2021 17:09:31 GMT (envelope-from git) Date: Wed, 12 May 2021 17:09:31 GMT Message-Id: <202105121709.14CH9Vrp031709@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: cd497bd40bb6 - main - truss: Decode FreeBSD 11 mknod(2) and mknodat(2) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cd497bd40bb65b5e4603d57614eb15ca7d947a10 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 17:09:32 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=cd497bd40bb65b5e4603d57614eb15ca7d947a10 commit cd497bd40bb65b5e4603d57614eb15ca7d947a10 Author: Mark Johnston AuthorDate: 2021-05-12 13:42:11 +0000 Commit: Mark Johnston CommitDate: 2021-05-12 16:52:05 +0000 truss: Decode FreeBSD 11 mknod(2) and mknodat(2) MFC after: 1 week Sponsored by: The FreeBSD Foundation --- usr.bin/truss/syscalls.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index 798cd299582c..b9c6ff4ad361 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -193,6 +193,10 @@ static const struct syscall_decode decoded_syscalls[] = { { Kevent11 | OUT, 3 }, { Int, 4 }, { Timespec, 5 } } }, { .name = "compat11.lstat", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Stat11 | OUT, 1 } } }, + { .name = "compat11.mknod", .ret_type = 1, .nargs = 3, + .args = { { Name, 0 }, { Octal, 1 }, { Int, 2 } } }, + { .name = "compat11.mknodat", .ret_type = 1, .nargs = 4, + .args = { { Atfd, 0 }, { Name, 1 }, { Octal, 2 }, { Int, 3 } } }, { .name = "compat11.stat", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Stat11 | OUT, 1 } } }, { .name = "connect", .ret_type = 1, .nargs = 3, @@ -372,9 +376,9 @@ static const struct syscall_decode decoded_syscalls[] = { { .name = "mkfifoat", .ret_type = 1, .nargs = 3, .args = { { Atfd, 0 }, { Name, 1 }, { Octal, 2 } } }, { .name = "mknod", .ret_type = 1, .nargs = 3, - .args = { { Name, 0 }, { Octal, 1 }, { Int, 2 } } }, + .args = { { Name, 0 }, { Octal, 1 }, { Quad, 2 } } }, { .name = "mknodat", .ret_type = 1, .nargs = 4, - .args = { { Atfd, 0 }, { Name, 1 }, { Octal, 2 }, { Int, 3 } } }, + .args = { { Atfd, 0 }, { Name, 1 }, { Octal, 2 }, { Quad, 3 } } }, { .name = "mlock", .ret_type = 1, .nargs = 2, .args = { { Ptr, 0 }, { Sizet, 1 } } }, { .name = "mlockall", .ret_type = 1, .nargs = 1, From owner-dev-commits-src-main@freebsd.org Wed May 12 17:09:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61007645FD8; Wed, 12 May 2021 17:09:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgLqx23PKz4rKT; Wed, 12 May 2021 17:09:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37F0E70DD; Wed, 12 May 2021 17:09:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14CH9XWe031731; Wed, 12 May 2021 17:09:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14CH9Xug031730; Wed, 12 May 2021 17:09:33 GMT (envelope-from git) Date: Wed, 12 May 2021 17:09:33 GMT Message-Id: <202105121709.14CH9Xug031730@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 06d1fd9f42fa - main - swap_pager: Zero swap info before exporting to userspace MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 06d1fd9f42fa9c060fad8f3a71fcaada3baaf200 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 17:09:33 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=06d1fd9f42fa9c060fad8f3a71fcaada3baaf200 commit 06d1fd9f42fa9c060fad8f3a71fcaada3baaf200 Author: Mark Johnston AuthorDate: 2021-05-12 13:42:44 +0000 Commit: Mark Johnston CommitDate: 2021-05-12 16:52:05 +0000 swap_pager: Zero swap info before exporting to userspace Otherwise padding bytes are leaked. Reported by: KMSAN MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/vm/swap_pager.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index b0b0b41d2148..57c953542a88 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -2706,11 +2706,14 @@ sysctl_vm_swap_info(SYSCTL_HANDLER_ARGS) if (arg2 != 1) /* name length */ return (EINVAL); + + memset(&xs, 0, sizeof(xs)); error = swap_dev_info(*(int *)arg1, &xs, NULL, 0); if (error != 0) return (error); #if defined(__amd64__) && defined(COMPAT_FREEBSD32) if (req->oldlen == sizeof(xs32)) { + memset(&xs32, 0, sizeof(xs32)); xs32.xsw_version = XSWDEV_VERSION; xs32.xsw_dev1 = xs.xsw_dev; xs32.xsw_dev2 = xs.xsw_dev >> 32; @@ -2723,6 +2726,7 @@ sysctl_vm_swap_info(SYSCTL_HANDLER_ARGS) #endif #if defined(COMPAT_FREEBSD11) if (req->oldlen == sizeof(xs11)) { + memset(&xs11, 0, sizeof(xs11)); xs11.xsw_version = XSWDEV_VERSION_11; xs11.xsw_dev = xs.xsw_dev; /* truncation */ xs11.xsw_flags = xs.xsw_flags; From owner-dev-commits-src-main@freebsd.org Wed May 12 17:09:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 85C45645C76; Wed, 12 May 2021 17:09:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgLqy2mjYz4rQP; Wed, 12 May 2021 17:09:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 49FBC72B8; Wed, 12 May 2021 17:09:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14CH9YQZ031752; Wed, 12 May 2021 17:09:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14CH9Yf5031751; Wed, 12 May 2021 17:09:34 GMT (envelope-from git) Date: Wed, 12 May 2021 17:09:34 GMT Message-Id: <202105121709.14CH9Yf5031751@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: ad22ba2b9f3b - main - if: Remove unnecessary validation in the SIOCSIFNAME handler MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ad22ba2b9f3b6ff5d85be14627d3a59ca389f5e4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 17:09:34 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ad22ba2b9f3b6ff5d85be14627d3a59ca389f5e4 commit ad22ba2b9f3b6ff5d85be14627d3a59ca389f5e4 Author: Mark Johnston AuthorDate: 2021-05-12 14:05:37 +0000 Commit: Mark Johnston CommitDate: 2021-05-12 16:52:06 +0000 if: Remove unnecessary validation in the SIOCSIFNAME handler A successful copyinstr() call guarantees that the returned string is nul-terminated. Furthermore, the removed check would harmlessly compare an uninitialized byte with '\0' if the new name is shorter than IFNAMESIZ - 1. Reported by: KMSAN MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/net/if.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index e18ed3e275ac..f615d82636be 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -2653,11 +2653,6 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td) return (error); if (new_name[0] == '\0') return (EINVAL); - if (new_name[IFNAMSIZ-1] != '\0') { - new_name[IFNAMSIZ-1] = '\0'; - if (strlen(new_name) == IFNAMSIZ-1) - return (EINVAL); - } if (strcmp(new_name, ifp->if_xname) == 0) break; if (ifunit(new_name) != NULL) From owner-dev-commits-src-main@freebsd.org Wed May 12 17:09:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED54664619D; Wed, 12 May 2021 17:09:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgLr05Trpz4rKk; Wed, 12 May 2021 17:09:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 94763713B; Wed, 12 May 2021 17:09:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14CH9a6A031795; Wed, 12 May 2021 17:09:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14CH9ak4031794; Wed, 12 May 2021 17:09:36 GMT (envelope-from git) Date: Wed, 12 May 2021 17:09:36 GMT Message-Id: <202105121709.14CH9ak4031794@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: d8acd2681bcf - main - Fix mbuf leaks in various pru_send implementations MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d8acd2681bcfb2ff7eb154df82f268b1cb191b4c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 17:09:37 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d8acd2681bcfb2ff7eb154df82f268b1cb191b4c commit d8acd2681bcfb2ff7eb154df82f268b1cb191b4c Author: Mark Johnston AuthorDate: 2021-05-12 13:39:36 +0000 Commit: Mark Johnston CommitDate: 2021-05-12 17:00:09 +0000 Fix mbuf leaks in various pru_send implementations The various protocol implementations are not very consistent about freeing mbufs in error paths. In general, all protocols must free both "m" and "control" upon an error, except if PRUS_NOTREADY is specified (this is only implemented by TCP and unix(4) and requires further work not handled in this diff), in which case "control" still must be freed. This diff plugs various leaks in the pru_send implementations. Reviewed by: tuexen MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30151 --- sys/kern/uipc_socket.c | 6 +++- sys/netinet/ip_divert.c | 2 ++ sys/netinet/raw_ip.c | 19 +++++++---- sys/netinet/tcp_usrreq.c | 77 ++++++++++++++++++--------------------------- sys/netinet/udp_usrreq.c | 1 + sys/netinet6/raw_ip6.c | 40 ++++++++++++----------- sys/netinet6/sctp6_usrreq.c | 25 +++++++++++++++ sys/netinet6/send.c | 3 ++ 8 files changed, 100 insertions(+), 73 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index ae678136bade..ea86f66556ea 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -3741,7 +3741,11 @@ pru_send_notsupp(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, struct mbuf *control, struct thread *td) { - return EOPNOTSUPP; + if (control != NULL) + m_freem(control); + if ((flags & PRUS_NOTREADY) == 0) + m_freem(m); + return (EOPNOTSUPP); } int diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index f83a42cb36c9..77a4bfcd08ac 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -677,6 +677,8 @@ div_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, if (m->m_len < sizeof (struct ip) && (m = m_pullup(m, sizeof (struct ip))) == NULL) { KMOD_IPSTAT_INC(ips_toosmall); + if (control != NULL) + m_freem(control); m_freem(m); return EINVAL; } diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 89ab6a6bbdad..1db73a6da68c 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -1077,13 +1077,18 @@ rip_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, inp = sotoinpcb(so); KASSERT(inp != NULL, ("rip_send: inp == NULL")); + if (control != NULL) { + m_freem(control); + control = NULL; + } + /* * Note: 'dst' reads below are unlocked. */ if (so->so_state & SS_ISCONNECTED) { if (nam) { - m_freem(m); - return (EISCONN); + error = EISCONN; + goto release; } dst = inp->inp_faddr.s_addr; /* Unlocked read. */ } else { @@ -1094,13 +1099,15 @@ rip_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, error = EAFNOSUPPORT; else if (nam->sa_len != sizeof(struct sockaddr_in)) error = EINVAL; - if (error != 0) { - m_freem(m); - return (error); - } + if (error != 0) + goto release; dst = ((struct sockaddr_in *)nam)->sin_addr.s_addr; } return (rip_output(m, so, dst)); + +release: + m_freem(m); + return (error); } #endif /* INET */ diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 061681ddc2bc..693cf553de44 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -993,21 +993,31 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { if (control) m_freem(control); + /* * In case of PRUS_NOTREADY, tcp_usr_ready() is responsible * for freeing memory. */ - if (m && (flags & PRUS_NOTREADY) == 0) + if ((flags & PRUS_NOTREADY) == 0) m_freem(m); error = ECONNRESET; goto out; } + if (control != NULL) { + /* TCP doesn't do control messages (rights, creds, etc) */ + if (control->m_len) { + m_freem(control); + m_freem(m); + error = EINVAL; + goto out; + } + m_freem(control); /* empty control, just free it */ + control = NULL; + } tp = intotcpcb(inp); if (flags & PRUS_OOB) { if ((error = tcp_pru_options_support(tp, PRUS_OOB)) != 0) { - if (control) - m_freem(control); - if (m && (flags & PRUS_NOTREADY) == 0) + if ((flags & PRUS_NOTREADY) == 0) m_freem(m); goto out; } @@ -1019,33 +1029,28 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, case AF_INET: sinp = (struct sockaddr_in *)nam; if (sinp->sin_len != sizeof(struct sockaddr_in)) { - if (m) - m_freem(m); + m_freem(m); error = EINVAL; goto out; } if ((inp->inp_vflag & INP_IPV6) != 0) { - if (m) - m_freem(m); + m_freem(m); error = EAFNOSUPPORT; goto out; } if (IN_MULTICAST(ntohl(sinp->sin_addr.s_addr))) { - if (m) - m_freem(m); + m_freem(m); error = EAFNOSUPPORT; goto out; } if (ntohl(sinp->sin_addr.s_addr) == INADDR_BROADCAST) { - if (m) - m_freem(m); + m_freem(m); error = EACCES; goto out; } if ((error = prison_remote_ip4(td->td_ucred, &sinp->sin_addr))) { - if (m) - m_freem(m); + m_freem(m); goto out; } #ifdef INET6 @@ -1060,20 +1065,17 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, sin6 = (struct sockaddr_in6 *)nam; if (sin6->sin6_len != sizeof(*sin6)) { - if (m) - m_freem(m); + m_freem(m); error = EINVAL; goto out; } if ((inp->inp_vflag & INP_IPV6PROTO) == 0) { - if (m != NULL) - m_freem(m); + m_freem(m); error = EAFNOSUPPORT; goto out; } if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) { - if (m) - m_freem(m); + m_freem(m); error = EAFNOSUPPORT; goto out; } @@ -1081,14 +1083,12 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, #ifdef INET if ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0) { error = EINVAL; - if (m) - m_freem(m); + m_freem(m); goto out; } if ((inp->inp_vflag & INP_IPV4) == 0) { error = EAFNOSUPPORT; - if (m) - m_freem(m); + m_freem(m); goto out; } restoreflags = true; @@ -1098,27 +1098,23 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, if (IN_MULTICAST( ntohl(sinp->sin_addr.s_addr))) { error = EAFNOSUPPORT; - if (m) - m_freem(m); + m_freem(m); goto out; } if ((error = prison_remote_ip4(td->td_ucred, &sinp->sin_addr))) { - if (m) - m_freem(m); + m_freem(m); goto out; } isipv6 = 0; #else /* !INET */ error = EAFNOSUPPORT; - if (m) - m_freem(m); + m_freem(m); goto out; #endif /* INET */ } else { if ((inp->inp_vflag & INP_IPV6) == 0) { - if (m) - m_freem(m); + m_freem(m); error = EAFNOSUPPORT; goto out; } @@ -1127,8 +1123,7 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, inp->inp_inc.inc_flags |= INC_ISIPV6; if ((error = prison_remote_ip6(td->td_ucred, &sin6->sin6_addr))) { - if (m) - m_freem(m); + m_freem(m); goto out; } isipv6 = 1; @@ -1137,23 +1132,11 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, } #endif /* INET6 */ default: - if (m) - m_freem(m); + m_freem(m); error = EAFNOSUPPORT; goto out; } } - if (control) { - /* TCP doesn't do control messages (rights, creds, etc) */ - if (control->m_len) { - m_freem(control); - if (m) - m_freem(m); - error = EINVAL; - goto out; - } - m_freem(control); /* empty control, just free it */ - } if (!(flags & PRUS_OOB)) { sbappendstream(&so->so_snd, m, flags); if (nam && tp->t_state < TCPS_SYN_SENT) { diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 16ae0a89bb15..62a07701df6c 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1273,6 +1273,7 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr, break; } m_freem(control); + control = NULL; } if (error) goto release; diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index 3d2af6e5c9e6..a369abb04bfc 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -867,7 +867,7 @@ rip6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, struct inpcb *inp; struct sockaddr_in6 tmp; struct sockaddr_in6 *dst; - int ret; + int error; inp = sotoinpcb(so); KASSERT(inp != NULL, ("rip6_send: inp == NULL")); @@ -876,8 +876,8 @@ rip6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, /* Unlocked read. */ if (so->so_state & SS_ISCONNECTED) { if (nam) { - m_freem(m); - return (EISCONN); + error = EISCONN; + goto release; } /* XXX */ bzero(&tmp, sizeof(tmp)); @@ -889,18 +889,15 @@ rip6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, INP_RUNLOCK(inp); dst = &tmp; } else { - if (nam == NULL) { - m_freem(m); - return (ENOTCONN); - } - if (nam->sa_family != AF_INET6) { - m_freem(m); - return (EAFNOSUPPORT); - } - if (nam->sa_len != sizeof(struct sockaddr_in6)) { - m_freem(m); - return (EINVAL); - } + error = 0; + if (nam == NULL) + error = ENOTCONN; + else if (nam->sa_family != AF_INET6) + error = EAFNOSUPPORT; + else if (nam->sa_len != sizeof(struct sockaddr_in6)) + error = EINVAL; + if (error != 0) + goto release; tmp = *(struct sockaddr_in6 *)nam; dst = &tmp; @@ -914,12 +911,17 @@ rip6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, "unspec. Assume AF_INET6\n"); dst->sin6_family = AF_INET6; } else if (dst->sin6_family != AF_INET6) { - m_freem(m); - return(EAFNOSUPPORT); + error = EAFNOSUPPORT; + goto release; } } - ret = rip6_output(m, so, dst, control); - return (ret); + return (rip6_output(m, so, dst, control)); + +release: + if (control != NULL) + m_freem(control); + m_freem(m); + return (error); } struct pr_usrreqs rip6_usrreqs = { diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c index 1030fe1bbb68..3be7a3e25de8 100644 --- a/sys/netinet6/sctp6_usrreq.c +++ b/sys/netinet6/sctp6_usrreq.c @@ -713,6 +713,11 @@ sctp6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, #ifdef INET case AF_INET: if (addr->sa_len != sizeof(struct sockaddr_in)) { + if (control) { + SCTP_RELEASE_PKT(control); + control = NULL; + } + SCTP_RELEASE_PKT(m); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); return (EINVAL); } @@ -721,12 +726,22 @@ sctp6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, #ifdef INET6 case AF_INET6: if (addr->sa_len != sizeof(struct sockaddr_in6)) { + if (control) { + SCTP_RELEASE_PKT(control); + control = NULL; + } + SCTP_RELEASE_PKT(m); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); return (EINVAL); } break; #endif default: + if (control) { + SCTP_RELEASE_PKT(control); + control = NULL; + } + SCTP_RELEASE_PKT(m); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); return (EINVAL); } @@ -738,10 +753,20 @@ sctp6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, * v4 addr or v4-mapped addr */ if (addr->sa_family == AF_INET) { + if (control) { + SCTP_RELEASE_PKT(control); + control = NULL; + } + SCTP_RELEASE_PKT(m); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); return (EINVAL); } if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { + if (control) { + SCTP_RELEASE_PKT(control); + control = NULL; + } + SCTP_RELEASE_PKT(m); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); return (EINVAL); } diff --git a/sys/netinet6/send.c b/sys/netinet6/send.c index aef2ee400c0e..677a83ab94cc 100644 --- a/sys/netinet6/send.c +++ b/sys/netinet6/send.c @@ -250,8 +250,11 @@ send_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, m = NULL; err: + if (control != NULL) + m_freem(control); if (m != NULL) m_freem(m); + return (error); } From owner-dev-commits-src-main@freebsd.org Wed May 12 17:09:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C7059645C7A; Wed, 12 May 2021 17:09:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgLqz52MDz4rHD; Wed, 12 May 2021 17:09:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 70F567320; Wed, 12 May 2021 17:09:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14CH9ZrI031773; Wed, 12 May 2021 17:09:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14CH9ZN5031772; Wed, 12 May 2021 17:09:35 GMT (envelope-from git) Date: Wed, 12 May 2021 17:09:35 GMT Message-Id: <202105121709.14CH9ZN5031772@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: c1dd4d642fa0 - main - nd6: Avoid using an uninitialized sockaddr in nd6_prefix_offlink() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c1dd4d642fa0e2c8ea4f9a879f2cc4e5d6c39211 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 17:09:35 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c1dd4d642fa0e2c8ea4f9a879f2cc4e5d6c39211 commit c1dd4d642fa0e2c8ea4f9a879f2cc4e5d6c39211 Author: Mark Johnston AuthorDate: 2021-05-12 15:49:24 +0000 Commit: Mark Johnston CommitDate: 2021-05-12 16:52:06 +0000 nd6: Avoid using an uninitialized sockaddr in nd6_prefix_offlink() Commit 81728a538 ("Split rtinit() into multiple functions.") removed the initialization of sa6, but not one of its uses. This meant that we were passing an uninitialized sockaddr as the address to lltable_prefix_free(). Remove the variable outright to fix the problem. The caller is expected to hold a reference on pr. Fixes: 81728a538 ("Split rtinit() into multiple functions.") Reported by: KMSAN Reviewed by: donner MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30166 --- sys/netinet6/nd6_rtr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 2f721b4edcc3..2960b6cad951 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -2165,7 +2165,6 @@ nd6_prefix_offlink(struct nd_prefix *pr) int error = 0; struct ifnet *ifp = pr->ndpr_ifp; struct nd_prefix *opr; - struct sockaddr_in6 sa6; char ip6buf[INET6_ADDRSTRLEN]; uint64_t genid; int a_failure; @@ -2240,7 +2239,8 @@ restart: } if (a_failure) - lltable_prefix_free(AF_INET6, (struct sockaddr *)&sa6, + lltable_prefix_free(AF_INET6, + (struct sockaddr *)&pr->ndpr_prefix, (struct sockaddr *)&mask6, LLE_STATIC); return (error); From owner-dev-commits-src-main@freebsd.org Wed May 12 18:35:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34479648824; Wed, 12 May 2021 18:35:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgNkY0rB9z3Byy; Wed, 12 May 2021 18:35:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F82B10469; Wed, 12 May 2021 18:35:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14CIZ0Ai050471; Wed, 12 May 2021 18:35:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14CIZ0Sa050470; Wed, 12 May 2021 18:35:00 GMT (envelope-from git) Date: Wed, 12 May 2021 18:35:00 GMT Message-Id: <202105121835.14CIZ0Sa050470@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: 98454e3f825e - main - Correct location of libcap_random.so in ObsoleteFiles.inc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 98454e3f825e086e47d107e7ff4ddf4239285dbe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 18:35:01 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=98454e3f825e086e47d107e7ff4ddf4239285dbe commit 98454e3f825e086e47d107e7ff4ddf4239285dbe Author: Dimitry Andric AuthorDate: 2021-05-12 18:33:46 +0000 Commit: Dimitry Andric CommitDate: 2021-05-12 18:34:23 +0000 Correct location of libcap_random.so in ObsoleteFiles.inc --- ObsoleteFiles.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 62a4dcc5df31..7bc4f435f869 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -5678,7 +5678,7 @@ OLD_FILES+=usr/include/sys/inflate.h # 20190722: cap_random(3) removed OLD_LIBS+=lib/casper/libcap_random.so.1 OLD_FILES+=usr/include/casper/cap_random.h -OLD_LIBS+=usr/lib/casper/libcap_random.so +OLD_LIBS+=usr/lib/libcap_random.so OLD_FILES+=usr/share/man/man3/libcap_random.3.gz OLD_FILES+=usr/share/man/man3/cap_random.3.gz OLD_FILES+=usr/share/man/man3/cap_random_buf.3.gz From owner-dev-commits-src-main@freebsd.org Wed May 12 18:54:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 41BDE648E49; Wed, 12 May 2021 18:54:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgP9N10dMz3CkN; Wed, 12 May 2021 18:54:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AF38107EF; Wed, 12 May 2021 18:54:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14CIslfL078009; Wed, 12 May 2021 18:54:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14CIslqW078008; Wed, 12 May 2021 18:54:47 GMT (envelope-from git) Date: Wed, 12 May 2021 18:54:47 GMT Message-Id: <202105121854.14CIslqW078008@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: a26e895f3d80 - main - tests: Only log critical errors from scapy MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a26e895f3d803cc1f4ee1c2b33c61330998808b9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 18:54:48 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a26e895f3d803cc1f4ee1c2b33c61330998808b9 commit a26e895f3d803cc1f4ee1c2b33c61330998808b9 Author: Kristof Provost AuthorDate: 2021-05-12 17:13:40 +0000 Commit: Kristof Provost CommitDate: 2021-05-12 18:54:30 +0000 tests: Only log critical errors from scapy Since 2.4.5 scapy started issuing warnings about a few different configurations during our tests. These are harmless, but they generate stderr output, which upsets atf_check. Configure scapy to only log critical errors (and thus not warnings) to fix these tests. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/common/divert.py | 2 ++ tests/sys/common/sender.py | 2 ++ tests/sys/net/stp.py | 2 ++ tests/sys/netinet6/exthdr.py | 2 ++ tests/sys/netinet6/frag6/frag6_01.py | 2 ++ tests/sys/netinet6/frag6/frag6_02.py | 2 ++ tests/sys/netinet6/frag6/frag6_03.py | 2 ++ tests/sys/netinet6/frag6/frag6_04.py | 2 ++ tests/sys/netinet6/frag6/frag6_05.py | 2 ++ tests/sys/netinet6/frag6/frag6_06.py | 2 ++ tests/sys/netinet6/frag6/frag6_07.py | 2 ++ tests/sys/netinet6/frag6/frag6_08.py | 2 ++ tests/sys/netinet6/frag6/frag6_09.py | 2 ++ tests/sys/netinet6/frag6/frag6_10.py | 2 ++ tests/sys/netinet6/frag6/frag6_11.py | 2 ++ tests/sys/netinet6/frag6/frag6_12.py | 2 ++ tests/sys/netinet6/frag6/frag6_13.py | 2 ++ tests/sys/netinet6/frag6/frag6_14.py | 2 ++ tests/sys/netinet6/frag6/frag6_15.py | 2 ++ tests/sys/netinet6/frag6/frag6_16.py | 2 ++ tests/sys/netinet6/frag6/frag6_17.py | 2 ++ tests/sys/netinet6/frag6/frag6_18.py | 2 ++ tests/sys/netinet6/frag6/frag6_19.py | 2 ++ tests/sys/netinet6/frag6/frag6_20.py | 2 ++ tests/sys/netinet6/frag6/sniffer.py | 2 ++ tests/sys/netinet6/mld.py | 2 ++ tests/sys/netinet6/redirect.py | 2 ++ tests/sys/netinet6/scapyi386.py | 2 ++ tests/sys/netpfil/common/pft_ping.py | 2 ++ tests/sys/netpfil/pf/CVE-2019-5597.py | 2 ++ tests/sys/netpfil/pf/CVE-2019-5598.py | 2 ++ 31 files changed, 62 insertions(+) diff --git a/tests/sys/common/divert.py b/tests/sys/common/divert.py index 1861f87402ad..f23fbe857cbb 100755 --- a/tests/sys/common/divert.py +++ b/tests/sys/common/divert.py @@ -30,6 +30,8 @@ import socket +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sc import argparse diff --git a/tests/sys/common/sender.py b/tests/sys/common/sender.py index 483210e54fcb..2ff699a8ef6d 100755 --- a/tests/sys/common/sender.py +++ b/tests/sys/common/sender.py @@ -31,6 +31,8 @@ from functools import partial import socket +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sc import argparse import time diff --git a/tests/sys/net/stp.py b/tests/sys/net/stp.py index 4c4c0af4c728..3e7d011efdd1 100644 --- a/tests/sys/net/stp.py +++ b/tests/sys/net/stp.py @@ -27,6 +27,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import sys import os diff --git a/tests/sys/netinet6/exthdr.py b/tests/sys/netinet6/exthdr.py index 7c09f44c5b58..52739a9cfa11 100644 --- a/tests/sys/netinet6/exthdr.py +++ b/tests/sys/netinet6/exthdr.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_01.py b/tests/sys/netinet6/frag6/frag6_01.py index 5a6b327337c6..efa99ce65759 100644 --- a/tests/sys/netinet6/frag6/frag6_01.py +++ b/tests/sys/netinet6/frag6/frag6_01.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_02.py b/tests/sys/netinet6/frag6/frag6_02.py index 945b428c3dac..794801b4a819 100644 --- a/tests/sys/netinet6/frag6/frag6_02.py +++ b/tests/sys/netinet6/frag6/frag6_02.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_03.py b/tests/sys/netinet6/frag6/frag6_03.py index 341de7915bd8..434dfe554a5a 100644 --- a/tests/sys/netinet6/frag6/frag6_03.py +++ b/tests/sys/netinet6/frag6/frag6_03.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_04.py b/tests/sys/netinet6/frag6/frag6_04.py index 6c35d4858ccb..8f0a20e003da 100644 --- a/tests/sys/netinet6/frag6/frag6_04.py +++ b/tests/sys/netinet6/frag6/frag6_04.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_05.py b/tests/sys/netinet6/frag6/frag6_05.py index d67c35581bbf..f9bc947d5465 100644 --- a/tests/sys/netinet6/frag6/frag6_05.py +++ b/tests/sys/netinet6/frag6/frag6_05.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_06.py b/tests/sys/netinet6/frag6/frag6_06.py index 42c8b02042cd..ca4e9b1a5ca0 100644 --- a/tests/sys/netinet6/frag6/frag6_06.py +++ b/tests/sys/netinet6/frag6/frag6_06.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_07.py b/tests/sys/netinet6/frag6/frag6_07.py index c84a783137d3..231f49eac2e0 100644 --- a/tests/sys/netinet6/frag6/frag6_07.py +++ b/tests/sys/netinet6/frag6/frag6_07.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_08.py b/tests/sys/netinet6/frag6/frag6_08.py index fa17e1e5c774..25f57f702e71 100644 --- a/tests/sys/netinet6/frag6/frag6_08.py +++ b/tests/sys/netinet6/frag6/frag6_08.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_09.py b/tests/sys/netinet6/frag6/frag6_09.py index 6e9771bc7d58..63ec646e1175 100644 --- a/tests/sys/netinet6/frag6/frag6_09.py +++ b/tests/sys/netinet6/frag6/frag6_09.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_10.py b/tests/sys/netinet6/frag6/frag6_10.py index 02d25bd96450..fcd331190c02 100644 --- a/tests/sys/netinet6/frag6/frag6_10.py +++ b/tests/sys/netinet6/frag6/frag6_10.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_11.py b/tests/sys/netinet6/frag6/frag6_11.py index a5c8e1918430..6b9643337597 100644 --- a/tests/sys/netinet6/frag6/frag6_11.py +++ b/tests/sys/netinet6/frag6/frag6_11.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_12.py b/tests/sys/netinet6/frag6/frag6_12.py index 68ea180599e1..a683782f2b69 100644 --- a/tests/sys/netinet6/frag6/frag6_12.py +++ b/tests/sys/netinet6/frag6/frag6_12.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_13.py b/tests/sys/netinet6/frag6/frag6_13.py index da3b2afe239f..e377a4272fa1 100644 --- a/tests/sys/netinet6/frag6/frag6_13.py +++ b/tests/sys/netinet6/frag6/frag6_13.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_14.py b/tests/sys/netinet6/frag6/frag6_14.py index 915571cfc36f..b53a65e67529 100644 --- a/tests/sys/netinet6/frag6/frag6_14.py +++ b/tests/sys/netinet6/frag6/frag6_14.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_15.py b/tests/sys/netinet6/frag6/frag6_15.py index f9922aaa9717..fff5c1efbe17 100644 --- a/tests/sys/netinet6/frag6/frag6_15.py +++ b/tests/sys/netinet6/frag6/frag6_15.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_16.py b/tests/sys/netinet6/frag6/frag6_16.py index 42ac8e2b4675..bf5b78cb6d6b 100644 --- a/tests/sys/netinet6/frag6/frag6_16.py +++ b/tests/sys/netinet6/frag6/frag6_16.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_17.py b/tests/sys/netinet6/frag6/frag6_17.py index a4d6deea0a24..b4a1a1898c2e 100644 --- a/tests/sys/netinet6/frag6/frag6_17.py +++ b/tests/sys/netinet6/frag6/frag6_17.py @@ -30,6 +30,8 @@ import argparse import random as random +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_18.py b/tests/sys/netinet6/frag6/frag6_18.py index a4d6deea0a24..b4a1a1898c2e 100644 --- a/tests/sys/netinet6/frag6/frag6_18.py +++ b/tests/sys/netinet6/frag6/frag6_18.py @@ -30,6 +30,8 @@ import argparse import random as random +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_19.py b/tests/sys/netinet6/frag6/frag6_19.py index 9248f5f40c43..f8613f757573 100644 --- a/tests/sys/netinet6/frag6/frag6_19.py +++ b/tests/sys/netinet6/frag6/frag6_19.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/frag6_20.py b/tests/sys/netinet6/frag6/frag6_20.py index 4e935a1f640a..6dd4c2379357 100755 --- a/tests/sys/netinet6/frag6/frag6_20.py +++ b/tests/sys/netinet6/frag6/frag6_20.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/frag6/sniffer.py b/tests/sys/netinet6/frag6/sniffer.py index 2c5f460488db..7e1d283dbf91 100644 --- a/tests/sys/netinet6/frag6/sniffer.py +++ b/tests/sys/netinet6/frag6/sniffer.py @@ -1,6 +1,8 @@ # $FreeBSD$ import threading +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp class Sniffer(threading.Thread): diff --git a/tests/sys/netinet6/mld.py b/tests/sys/netinet6/mld.py index b1fcf2f8e50a..1f43cee5d6ad 100644 --- a/tests/sys/netinet6/mld.py +++ b/tests/sys/netinet6/mld.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netinet6/redirect.py b/tests/sys/netinet6/redirect.py index 7066f8066518..4f785c615f62 100644 --- a/tests/sys/netinet6/redirect.py +++ b/tests/sys/netinet6/redirect.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sc import socket import sys diff --git a/tests/sys/netinet6/scapyi386.py b/tests/sys/netinet6/scapyi386.py index 745c01b45881..ac0c877380c4 100644 --- a/tests/sys/netinet6/scapyi386.py +++ b/tests/sys/netinet6/scapyi386.py @@ -29,6 +29,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netpfil/common/pft_ping.py b/tests/sys/netpfil/common/pft_ping.py index de673f026c77..9cc7c5d5c5c0 100644 --- a/tests/sys/netpfil/common/pft_ping.py +++ b/tests/sys/netpfil/common/pft_ping.py @@ -27,6 +27,8 @@ # import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import socket import sys diff --git a/tests/sys/netpfil/pf/CVE-2019-5597.py b/tests/sys/netpfil/pf/CVE-2019-5597.py index 1050af506f8d..1b25809cbedf 100644 --- a/tests/sys/netpfil/pf/CVE-2019-5597.py +++ b/tests/sys/netpfil/pf/CVE-2019-5597.py @@ -26,6 +26,8 @@ # SUCH DAMAGE. import random +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import sys diff --git a/tests/sys/netpfil/pf/CVE-2019-5598.py b/tests/sys/netpfil/pf/CVE-2019-5598.py index ac1e4f3438f5..603a1aef376f 100644 --- a/tests/sys/netpfil/pf/CVE-2019-5598.py +++ b/tests/sys/netpfil/pf/CVE-2019-5598.py @@ -26,6 +26,8 @@ # SUCH DAMAGE. import argparse +import logging +logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sp import sys from sniffer import Sniffer From owner-dev-commits-src-main@freebsd.org Wed May 12 19:44:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9717E64A5B3; Wed, 12 May 2021 19:44:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgQGb3t5yz3Gbd; Wed, 12 May 2021 19:44:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 77DB211810; Wed, 12 May 2021 19:44:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14CJiNiZ046675; Wed, 12 May 2021 19:44:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14CJiNHQ046674; Wed, 12 May 2021 19:44:23 GMT (envelope-from git) Date: Wed, 12 May 2021 19:44:23 GMT Message-Id: <202105121944.14CJiNHQ046674@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Poul-Henning Kamp Subject: git: 38a4732f395b - main - Centralize open/close of /dev/iic%d devices MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: phk X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 38a4732f395b1a529bf2358326a458c2c8c90cf0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 19:44:23 -0000 The branch main has been updated by phk: URL: https://cgit.FreeBSD.org/src/commit/?id=38a4732f395b1a529bf2358326a458c2c8c90cf0 commit 38a4732f395b1a529bf2358326a458c2c8c90cf0 Author: Poul-Henning Kamp AuthorDate: 2021-05-12 19:43:44 +0000 Commit: Poul-Henning Kamp CommitDate: 2021-05-12 19:43:44 +0000 Centralize open/close of /dev/iic%d devices --- usr.sbin/i2c/i2c.c | 77 +++++++++++++++++++----------------------------------- 1 file changed, 27 insertions(+), 50 deletions(-) diff --git a/usr.sbin/i2c/i2c.c b/usr.sbin/i2c/i2c.c index 23613ee744f9..604460625ecf 100644 --- a/usr.sbin/i2c/i2c.c +++ b/usr.sbin/i2c/i2c.c @@ -123,23 +123,16 @@ skip_get_tokens(char *skip_addr, int *sk_addr, int max_index) } static int -scan_bus(const char *dev, int skip, char *skip_addr) +scan_bus(const char *dev, int fd, int skip, char *skip_addr) { struct iiccmd cmd; struct iic_msg rdmsg; struct iic_rdwr_data rdwrdata; struct skip_range addr_range = { 0, 0 }; - int *tokens = NULL, fd, error, i, idx = 0, j; + int *tokens = NULL, error, i, idx = 0, j; int len = 0, do_skip = 0, no_range = 1, num_found = 0, use_read_xfer = 0; uint8_t rdbyte; - fd = open(dev, O_RDWR); - if (fd == -1) { - fprintf(stderr, "Error opening I2C controller (%s) for " - "scanning: %s\n", dev, strerror(errno)); - return (EX_NOINPUT); - } - if (skip) { assert(skip_addr != NULL); len = strlen(skip_addr); @@ -220,7 +213,7 @@ start_over: use_read_xfer = 1; goto start_over; } - ioctl(fd, I2CSTOP); + (void)ioctl(fd, I2CSTOP); } if (error == 0) { ++num_found; @@ -243,7 +236,6 @@ start_over: error = ioctl(fd, I2CRSTCARD, &cmd); out: - close(fd); if (skip && no_range) free(tokens); else @@ -258,21 +250,13 @@ out: } static int -reset_bus(const char *dev) +reset_bus(const char *dev, int fd) { struct iiccmd cmd; - int fd, error; - - fd = open(dev, O_RDWR); - if (fd == -1) { - fprintf(stderr, "Error opening I2C controller (%s) for " - "resetting: %s\n", dev, strerror(errno)); - return (EX_NOINPUT); - } + int error; printf("Resetting I2C controller on %s: ", dev); error = ioctl(fd, I2CRSTCARD, &cmd); - close (fd); if (error) { printf("error: %s\n", strerror(errno)); @@ -303,19 +287,13 @@ prepare_buf(int size, uint32_t off) } static int -i2c_write(const char *dev, struct options i2c_opt, char *i2c_buf) +i2c_write(int fd, struct options i2c_opt, char *i2c_buf) { struct iiccmd cmd; - int error, fd, bufsize; + int error, bufsize; char *buf; const char *err_msg; - fd = open(dev, O_RDWR); - if (fd == -1) { - free(i2c_buf); - err(1, "open failed"); - } - cmd.slave = i2c_opt.addr; error = ioctl(fd, I2CSTART, &cmd); if (error == -1) { @@ -441,7 +419,6 @@ i2c_write(const char *dev, struct options i2c_opt, char *i2c_buf) goto err2; } - close(fd); return (0); err1: @@ -452,22 +429,17 @@ err2: if (err_msg) fprintf(stderr, "%s\n", err_msg); - close(fd); return (1); } static int -i2c_read(const char *dev, struct options i2c_opt, char *i2c_buf) +i2c_read(int fd, struct options i2c_opt, char *i2c_buf) { struct iiccmd cmd; - int fd, error, bufsize; + int error, bufsize; char data = 0, *buf; const char *err_msg; - fd = open(dev, O_RDWR); - if (fd == -1) - err(1, "open failed"); - bzero(&cmd, sizeof(cmd)); if (i2c_opt.width) { @@ -539,7 +511,6 @@ i2c_read(const char *dev, struct options i2c_opt, char *i2c_buf) goto err2; } - close(fd); return (0); err1: @@ -550,7 +521,6 @@ err2: if (err_msg) fprintf(stderr, "%s\n", err_msg); - close(fd); return (1); } @@ -566,11 +536,11 @@ err2: * driver to be handled as a single transfer. */ static int -i2c_rdwr_transfer(const char *dev, struct options i2c_opt, char *i2c_buf) +i2c_rdwr_transfer(int fd, struct options i2c_opt, char *i2c_buf) { struct iic_msg msgs[2]; struct iic_rdwr_data xfer; - int fd, i; + int i; uint8_t off_buf[2]; i = 0; @@ -607,11 +577,8 @@ i2c_rdwr_transfer(const char *dev, struct options i2c_opt, char *i2c_buf) 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); } @@ -622,7 +589,7 @@ main(int argc, char** argv) struct options i2c_opt; char *skip_addr = NULL, *i2c_buf; const char *dev; - int error, chunk_size, i, j, ch; + int fd, error, chunk_size, i, j, ch; errno = 0; error = 0; @@ -741,11 +708,18 @@ main(int argc, char** argv) i2c_opt.addr >> 1, i2c_opt.dir, i2c_opt.off, i2c_opt.width, i2c_opt.count); + fd = open(dev, O_RDWR); + if (fd == -1) { + fprintf(stderr, "Error opening I2C controller (%s): %s\n", + dev, strerror(errno)); + return (EX_NOINPUT); + } + if (i2c_opt.scan) - exit(scan_bus(dev, i2c_opt.skip, skip_addr)); + exit(scan_bus(dev, fd, i2c_opt.skip, skip_addr)); if (i2c_opt.reset) - exit(reset_bus(dev)); + exit(reset_bus(dev, fd)); i2c_buf = malloc(i2c_opt.count); if (i2c_buf == NULL) @@ -769,17 +743,20 @@ main(int argc, char** argv) } if (i2c_opt.mode == I2C_MODE_TRANSFER) - error = i2c_rdwr_transfer(dev, i2c_opt, i2c_buf); + error = i2c_rdwr_transfer(fd, i2c_opt, i2c_buf); else if (i2c_opt.dir == 'w') - error = i2c_write(dev, i2c_opt, i2c_buf); + error = i2c_write(fd, i2c_opt, i2c_buf); else - error = i2c_read(dev, i2c_opt, i2c_buf); + error = i2c_read(fd, i2c_opt, i2c_buf); if (error != 0) { free(i2c_buf); return (1); } + error = close(fd); + assert(error == 0); + if (i2c_opt.verbose) fprintf(stderr, "\nData %s (hex):\n", i2c_opt.dir == 'r' ? "read" : "written"); From owner-dev-commits-src-main@freebsd.org Wed May 12 20:02:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BF86964A76D; Wed, 12 May 2021 20:02:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgQg34wPgz3GqJ; Wed, 12 May 2021 20:02:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C03511467; Wed, 12 May 2021 20:02:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14CK27ii074257; Wed, 12 May 2021 20:02:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14CK27Db074256; Wed, 12 May 2021 20:02:07 GMT (envelope-from git) Date: Wed, 12 May 2021 20:02:07 GMT Message-Id: <202105122002.14CK27Db074256@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Poul-Henning Kamp Subject: git: e06874f3f6d1 - main - Centralize offset width handling, and make it possible to specify explicit endianess. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: phk X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e06874f3f6d1f9a737f4d6489a3de676a5cdc9ec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 20:02:07 -0000 The branch main has been updated by phk: URL: https://cgit.FreeBSD.org/src/commit/?id=e06874f3f6d1f9a737f4d6489a3de676a5cdc9ec commit e06874f3f6d1f9a737f4d6489a3de676a5cdc9ec Author: Poul-Henning Kamp AuthorDate: 2021-05-12 20:01:14 +0000 Commit: Poul-Henning Kamp CommitDate: 2021-05-12 20:01:14 +0000 Centralize offset width handling, and make it possible to specify explicit endianess. --- usr.sbin/i2c/i2c.8 | 5 +- usr.sbin/i2c/i2c.c | 214 ++++++++++++++++++++++++----------------------------- 2 files changed, 101 insertions(+), 118 deletions(-) diff --git a/usr.sbin/i2c/i2c.8 b/usr.sbin/i2c/i2c.8 index 7e6fe0e7bd49..1c5174e63f32 100644 --- a/usr.sbin/i2c/i2c.8 +++ b/usr.sbin/i2c/i2c.8 @@ -36,7 +36,7 @@ .Cm -a Ar address .Op Fl f Ar device .Op Fl d Ar r|w -.Op Fl w Ar 0|8|16 +.Op Fl w Ar 0|8|16|16LE|16BE .Op Fl o Ar offset .Op Fl c Ar count .Op Fl m Ar tr|ss|rs|no @@ -112,7 +112,7 @@ reset the controller. scan the bus for devices. .It Fl v be verbose. -.It Fl w Ar 0|8|16 +.It Fl w Ar 0|8|16|16LE|16BE device addressing width (in bits). This is used to determine how to pass .Ar offset @@ -120,6 +120,7 @@ specified with .Fl o to the slave. Zero means that the offset is ignored and not passed to the slave at all. +The endianess defaults to little-endian. .El .Sh WARNINGS Great care must be taken when manipulating slave I2C devices with the diff --git a/usr.sbin/i2c/i2c.c b/usr.sbin/i2c/i2c.c index 604460625ecf..64233366a0a8 100644 --- a/usr.sbin/i2c/i2c.c +++ b/usr.sbin/i2c/i2c.c @@ -51,18 +51,20 @@ __FBSDID("$FreeBSD$"); #define I2C_MODE_TRANSFER 4 struct options { - int width; - int count; - int verbose; - int addr_set; - int binary; - int scan; - int skip; - int reset; - int mode; - char dir; + const char *width; + int count; + int verbose; + int addr_set; + int binary; + int scan; + int skip; + int reset; + int mode; + char dir; uint32_t addr; uint32_t off; + uint8_t off_buf[2]; + size_t off_len; }; struct skip_range { @@ -267,30 +269,56 @@ reset_bus(const char *dev, int fd) } } -static char * -prepare_buf(int size, uint32_t off) +static const char * +encode_offset(const char *width, unsigned address, uint8_t *dst, size_t *len) { - char *buf; - - buf = malloc(size); - if (buf == NULL) - return (buf); - if (size == 1) - buf[0] = off & 0xff; - else if (size == 2) { - buf[0] = (off >> 8) & 0xff; - buf[1] = off & 0xff; + if (!strcmp(width, "0")) { + *len = 0; + return (NULL); + } + if (!strcmp(width, "8")) { + if (address > 0xff) + return ("Invalid 8-bit address\n"); + *dst = address; + *len = 1; + return (NULL); } + if (address > 0xffff) + return ("Invalid 16-bit address\n"); + if (!strcmp(width, "16LE") || !strcmp(width, "16")) { + le16enc(dst, address); + *len = 2; + return (NULL); + } + if (!strcmp(width, "16BE")) { + be16enc(dst, address); + *len = 2; + return (NULL); + } + return ("Invalid offset width, must be: 0|8|16|16LE|16BE\n"); +} - return (buf); +static const char * +write_offset(int fd, struct options i2c_opt, struct iiccmd *cmd) +{ + int error; + + if (i2c_opt.off_len > 0) { + cmd->count = i2c_opt.off_len; + cmd->buf = i2c_opt.off_buf; + error = ioctl(fd, I2CWRITE, cmd); + if (error == -1) + return ("ioctl: error writing offset\n"); + } + return (NULL); } static int i2c_write(int fd, struct options i2c_opt, char *i2c_buf) { struct iiccmd cmd; - int error, bufsize; + int error; char *buf; const char *err_msg; @@ -301,33 +329,11 @@ i2c_write(int fd, struct options i2c_opt, char *i2c_buf) goto err1; } - if (i2c_opt.width) { - bufsize = i2c_opt.width / 8; - buf = prepare_buf(bufsize, i2c_opt.off); - if (buf == NULL) { - err_msg = "error: offset malloc"; - goto err1; - } - } else { - bufsize = 0; - buf = NULL; - } - switch(i2c_opt.mode) { case I2C_MODE_STOP_START: - /* - * Write offset where the data will go - */ - if (i2c_opt.width) { - cmd.count = bufsize; - cmd.buf = buf; - error = ioctl(fd, I2CWRITE, &cmd); - free(buf); - if (error == -1) { - err_msg = "ioctl: error writing offset"; - goto err1; - } - } + err_msg = write_offset(fd, i2c_opt, &cmd); + if (err_msg != NULL) + goto err1; error = ioctl(fd, I2CSTOP); if (error == -1) { @@ -355,19 +361,9 @@ i2c_write(int fd, struct options i2c_opt, char *i2c_buf) break; case I2C_MODE_REPEATED_START: - /* - * Write offset where the data will go - */ - if (i2c_opt.width) { - cmd.count = bufsize; - cmd.buf = buf; - error = ioctl(fd, I2CWRITE, &cmd); - free(buf); - if (error == -1) { - err_msg = "ioctl: error writing offset"; - goto err1; - } - } + err_msg = write_offset(fd, i2c_opt, &cmd); + if (err_msg != NULL) + goto err1; cmd.slave = i2c_opt.addr; error = ioctl(fd, I2CRPTSTART, &cmd); @@ -392,17 +388,18 @@ i2c_write(int fd, struct options i2c_opt, char *i2c_buf) case I2C_MODE_NONE: /* fall through */ default: - buf = realloc(buf, bufsize + i2c_opt.count); + buf = malloc(i2c_opt.off_len + i2c_opt.count); if (buf == NULL) { err_msg = "error: data malloc"; goto err1; } + memcpy(buf, i2c_opt.off_buf, i2c_opt.off_len); - memcpy(buf + bufsize, i2c_buf, i2c_opt.count); + memcpy(buf + i2c_opt.off_len, i2c_buf, i2c_opt.count); /* * Write offset and data */ - cmd.count = bufsize + i2c_opt.count; + cmd.count = i2c_opt.off_len + i2c_opt.count; cmd.buf = buf; cmd.last = 0; error = ioctl(fd, I2CWRITE, &cmd); @@ -436,13 +433,13 @@ static int i2c_read(int fd, struct options i2c_opt, char *i2c_buf) { struct iiccmd cmd; - int error, bufsize; - char data = 0, *buf; + int error; + char data = 0; const char *err_msg; bzero(&cmd, sizeof(cmd)); - if (i2c_opt.width) { + if (i2c_opt.off_len) { cmd.slave = i2c_opt.addr; cmd.count = 1; cmd.last = 0; @@ -452,22 +449,10 @@ i2c_read(int fd, struct options i2c_opt, char *i2c_buf) err_msg = "ioctl: error sending start condition"; goto err1; } - bufsize = i2c_opt.width / 8; - buf = prepare_buf(bufsize, i2c_opt.off); - if (buf == NULL) { - err_msg = "error: offset malloc"; - goto err1; - } - cmd.count = bufsize; - cmd.buf = buf; - cmd.last = 0; - error = ioctl(fd, I2CWRITE, &cmd); - free(buf); - if (error == -1) { - err_msg = "ioctl: error writing offset"; + err_msg = write_offset(fd, i2c_opt, &cmd); + if (err_msg != NULL) goto err1; - } if (i2c_opt.mode == I2C_MODE_STOP_START) { error = ioctl(fd, I2CSTOP); @@ -481,7 +466,7 @@ i2c_read(int fd, struct options i2c_opt, char *i2c_buf) cmd.count = 1; cmd.last = 0; cmd.buf = &data; - if (i2c_opt.mode == I2C_MODE_STOP_START || i2c_opt.width == 0) { + if (i2c_opt.mode == I2C_MODE_STOP_START || i2c_opt.off_len == 0) { error = ioctl(fd, I2CSTART, &cmd); if (error == -1) { err_msg = "ioctl: error sending start condition"; @@ -538,24 +523,17 @@ err2: static int i2c_rdwr_transfer(int fd, struct options i2c_opt, char *i2c_buf) { - struct iic_msg msgs[2]; + struct iic_msg msgs[2], *msgp = msgs; struct iic_rdwr_data xfer; - int i; - uint8_t off_buf[2]; - - 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_buf[0] = i2c_opt.off; - msgs[i].len = 1; - } else { - le16enc(off_buf, i2c_opt.off); - msgs[i].len = 2; - } - ++i; + int flag = 0; + + if (i2c_opt.off_len) { + msgp->flags = IIC_M_WR | IIC_M_NOSTOP; + msgp->slave = i2c_opt.addr; + msgp->buf = i2c_opt.off_buf; + msgp->len = i2c_opt.off_len; + msgp++; + flag = IIC_M_NOSTART; } /* @@ -566,16 +544,16 @@ i2c_rdwr_transfer(int fd, struct options i2c_opt, char *i2c_buf) * because of the NOSTOP flag used above. */ if (i2c_opt.dir == 'w') - msgs[i].flags = IIC_M_WR | ((i > 0) ? IIC_M_NOSTART : 0); + msgp->flags = IIC_M_WR | flag; 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; + msgp->flags = IIC_M_RD; + msgp->slave = i2c_opt.addr; + msgp->len = i2c_opt.count; + msgp->buf = i2c_buf; + msgp++; xfer.msgs = msgs; - xfer.nmsgs = i; + xfer.nmsgs = msgp - msgs; if (ioctl(fd, I2CRDWR, &xfer) == -1 ) err(1, "ioctl(I2CRDWR) failed"); @@ -588,7 +566,7 @@ main(int argc, char** argv) { struct options i2c_opt; char *skip_addr = NULL, *i2c_buf; - const char *dev; + const char *dev, *err_msg; int fd, error, chunk_size, i, j, ch; errno = 0; @@ -604,7 +582,7 @@ main(int argc, char** argv) i2c_opt.off = 0; i2c_opt.verbose = 0; i2c_opt.dir = 'r'; /* direction = read */ - i2c_opt.width = 8; + i2c_opt.width = "8"; i2c_opt.count = 1; i2c_opt.binary = 0; /* ASCII text output */ i2c_opt.scan = 0; /* no bus scan */ @@ -633,7 +611,7 @@ main(int argc, char** argv) error = 1; break; case 'w': - i2c_opt.width = atoi(optarg); + i2c_opt.width = optarg; break; case 'c': i2c_opt.count = atoi(optarg); @@ -686,6 +664,15 @@ main(int argc, char** argv) i2c_opt.mode = I2C_MODE_NONE; } + if (i2c_opt.addr_set) { + err_msg = encode_offset(i2c_opt.width, i2c_opt.off, + i2c_opt.off_buf, &i2c_opt.off_len); + if (err_msg != NULL) { + fprintf(stderr, "%s", err_msg); + exit(EX_USAGE); + } + } + /* Basic sanity check of command line arguments */ if (i2c_opt.scan) { if (i2c_opt.addr_set) @@ -695,16 +682,11 @@ main(int argc, char** argv) usage(); } else if (error) { usage(); - } else if ((i2c_opt.dir == 'r' || i2c_opt.dir == 'w')) { - if ((i2c_opt.addr_set == 0) || - !(i2c_opt.width == 0 || i2c_opt.width == 8 || - i2c_opt.width == 16)) - usage(); } if (i2c_opt.verbose) fprintf(stderr, "dev: %s, addr: 0x%x, r/w: %c, " - "offset: 0x%02x, width: %d, count: %d\n", dev, + "offset: 0x%02x, width: %s, count: %d\n", dev, i2c_opt.addr >> 1, i2c_opt.dir, i2c_opt.off, i2c_opt.width, i2c_opt.count); From owner-dev-commits-src-main@freebsd.org Wed May 12 21:16:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 902F964C66C; Wed, 12 May 2021 21:16:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgSJJ3hVTz3Lmw; Wed, 12 May 2021 21:16:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71BAF12938; Wed, 12 May 2021 21:16:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14CLG0iW067379; Wed, 12 May 2021 21:16:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14CLG0F3067378; Wed, 12 May 2021 21:16:00 GMT (envelope-from git) Date: Wed, 12 May 2021 21:16:00 GMT Message-Id: <202105122116.14CLG0F3067378@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: eec6aed5b8c8 - main - sctp: fix another locking bug in COOKIE handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eec6aed5b8c848841ae8d25940e0a333e5039ce9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 21:16:00 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=eec6aed5b8c848841ae8d25940e0a333e5039ce9 commit eec6aed5b8c848841ae8d25940e0a333e5039ce9 Author: Michael Tuexen AuthorDate: 2021-05-12 21:02:31 +0000 Commit: Michael Tuexen CommitDate: 2021-05-12 21:05:28 +0000 sctp: fix another locking bug in COOKIE handling Thanks to Tolya Korniltsev for reporting the issue for the userland stack and testing the fix. MFC after: 3 days --- sys/netinet/sctp_input.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index f066cc100ac2..442e58afd0ff 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -1752,17 +1752,23 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, struct sctpasochead *head; if (asoc->peer_supports_nat) { + struct sctp_tcb *local_stcb; + /* * This is a gross gross hack. Just call the * cookie_new code since we are allowing a duplicate * association. I hope this works... */ - return (sctp_process_cookie_new(m, iphlen, offset, src, dst, + local_stcb = sctp_process_cookie_new(m, iphlen, offset, src, dst, sh, cookie, cookie_len, inp, netp, init_src, notification, auth_skipped, auth_offset, auth_len, mflowtype, mflowid, - vrf_id, port)); + vrf_id, port); + if (local_stcb == NULL) { + SCTP_TCB_UNLOCK(stcb); + } + return (local_stcb); } /* * case A in Section 5.2.4 Table 2: XXMM (peer restarted) From owner-dev-commits-src-main@freebsd.org Wed May 12 21:39:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7891464D233; Wed, 12 May 2021 21:39:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgSqR2gWzz3MYv; Wed, 12 May 2021 21:39:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4CC7812F82; Wed, 12 May 2021 21:39:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14CLdVMa093861; Wed, 12 May 2021 21:39:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14CLdVRh093860; Wed, 12 May 2021 21:39:31 GMT (envelope-from git) Date: Wed, 12 May 2021 21:39:31 GMT Message-Id: <202105122139.14CLdVRh093860@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Poul-Henning Kamp Subject: git: 29c6e6e279b3 - main - More refactoring & polishing. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: phk X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 29c6e6e279b3bbab78510ff03922e7fb85f93ee2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 21:39:31 -0000 The branch main has been updated by phk: URL: https://cgit.FreeBSD.org/src/commit/?id=29c6e6e279b3bbab78510ff03922e7fb85f93ee2 commit 29c6e6e279b3bbab78510ff03922e7fb85f93ee2 Author: Poul-Henning Kamp AuthorDate: 2021-05-12 21:37:00 +0000 Commit: Poul-Henning Kamp CommitDate: 2021-05-12 21:39:19 +0000 More refactoring & polishing. Do not call usage() without telling why. Extract '-a' mode into a function, and sanitize hexdumping. Revise manpage to match reality of code. --- usr.sbin/i2c/i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/i2c/i2c.c b/usr.sbin/i2c/i2c.c index c862666fc9a7..588aad8592ee 100644 --- a/usr.sbin/i2c/i2c.c +++ b/usr.sbin/i2c/i2c.c @@ -79,7 +79,7 @@ usage(const char *msg) if (msg != NULL) fprintf(stderr, "%s\n", msg); fprintf(stderr, "usage: %s -a addr [-f device] [-d [r|w]] [-o offset] " - "[-w [0|8|16]] [-c count] [-m [tr|ss|rs|no]] [-b] [-v]\n", + "[-w [0|8|16|16LE|16BE]] [-c count] [-m [tr|ss|rs|no]] [-b] [-v]\n", getprogname()); fprintf(stderr, " %s -s [-f device] [-n skip_addr] -v\n", getprogname()); From owner-dev-commits-src-main@freebsd.org Wed May 12 21:39:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4972464D0F6; Wed, 12 May 2021 21:39:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgSqQ1cmfz3MLl; Wed, 12 May 2021 21:39:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2022512CD5; Wed, 12 May 2021 21:39:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14CLdUMU093840; Wed, 12 May 2021 21:39:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14CLdU54093839; Wed, 12 May 2021 21:39:30 GMT (envelope-from git) Date: Wed, 12 May 2021 21:39:30 GMT Message-Id: <202105122139.14CLdU54093839@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Poul-Henning Kamp Subject: git: 5ab41ff8e92d - main - More refactoring: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: phk X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5ab41ff8e92da548acf06b50384df538737aa8ee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 21:39:30 -0000 The branch main has been updated by phk: URL: https://cgit.FreeBSD.org/src/commit/?id=5ab41ff8e92da548acf06b50384df538737aa8ee commit 5ab41ff8e92da548acf06b50384df538737aa8ee Author: Poul-Henning Kamp AuthorDate: 2021-05-12 21:34:58 +0000 Commit: Poul-Henning Kamp CommitDate: 2021-05-12 21:39:19 +0000 More refactoring: Extract the '-a' mode into a separate function, and simplify the hexdumping logic. Dont call usage() without telling why. --- usr.sbin/i2c/i2c.8 | 36 +++-------- usr.sbin/i2c/i2c.c | 181 +++++++++++++++++++++++++---------------------------- 2 files changed, 97 insertions(+), 120 deletions(-) diff --git a/usr.sbin/i2c/i2c.8 b/usr.sbin/i2c/i2c.8 index 1c5174e63f32..352b13157968 100644 --- a/usr.sbin/i2c/i2c.8 +++ b/usr.sbin/i2c/i2c.8 @@ -64,12 +64,12 @@ The options are as follows: 7-bit address on the I2C device to operate on (hex). .It Fl b binary mode - when performing a read operation, the data read from the device -is output in binary format on stdout; when doing a write, the binary data to -be written to the device is read from stdin. +is output in binary format on stdout. .It Fl c Ar count -number of bytes to transfer (dec). +number of bytes to transfer (decimal). .It Fl d Ar r|w transfer direction: r - read, w - write. +Data to be written is read from stdin as binary bytes. .It Fl f Ar device I2C bus to use (default is /dev/iic0). .It Fl m Ar tr|ss|rs|no @@ -113,7 +113,7 @@ scan the bus for devices. .It Fl v be verbose. .It Fl w Ar 0|8|16|16LE|16BE -device addressing width (in bits). +device offset width (in bits). This is used to determine how to pass .Ar offset specified with @@ -122,28 +122,6 @@ to the slave. Zero means that the offset is ignored and not passed to the slave at all. The endianess defaults to little-endian. .El -.Sh WARNINGS -Great care must be taken when manipulating slave I2C devices with the -.Nm -utility. -Often times important configuration data for the system is kept in non-volatile -but write enabled memories located on the I2C bus, for example Ethernet hardware -addresses, RAM module parameters (SPD), processor reset configuration word etc. -.Pp -It is very easy to render the whole system unusable when such configuration -data is deleted or altered, so use the -.Dq -d w -(write) command only if you know exactly what you are doing. -.Pp -Also avoid ungraceful interrupting of an ongoing transaction on the I2C bus, -as it can lead to potentially dangerous effects. -Consider the following scenario: when the host CPU is reset (for whatever reason) -in the middle of a started I2C transaction, the I2C slave device could be left -in write mode waiting for data or offset to arrive. -When the CPU reinitializes itself and talks to this I2C slave device again, -the commands and other control info it sends are treated by the slave device -as data or offset it was waiting for, and there's great potential for -corruption if such a write is performed. .Sh EXAMPLES .Bl -bullet .It @@ -177,9 +155,15 @@ Reset the controller: .Pp i2c -f /dev/iic1 -r .El +.Sh WARNING +Many systems store critical low-level information in I2C memories, and +may contain other I2C devices, such as temperature or voltage sensors. +Reading these can disturb the firmware's operation and writing to them +can "brick" the hardware. .Sh SEE ALSO .Xr iic 4 , .Xr iicbus 4 +.Xr smbus 4 .Sh HISTORY The .Nm diff --git a/usr.sbin/i2c/i2c.c b/usr.sbin/i2c/i2c.c index 64233366a0a8..c862666fc9a7 100644 --- a/usr.sbin/i2c/i2c.c +++ b/usr.sbin/i2c/i2c.c @@ -73,9 +73,11 @@ struct skip_range { }; __dead2 static void -usage(void) +usage(const char *msg) { + if (msg != NULL) + fprintf(stderr, "%s\n", msg); fprintf(stderr, "usage: %s -a addr [-f device] [-d [r|w]] [-o offset] " "[-w [0|8|16]] [-c count] [-m [tr|ss|rs|no]] [-b] [-v]\n", getprogname()); @@ -561,19 +563,71 @@ i2c_rdwr_transfer(int fd, struct options i2c_opt, char *i2c_buf) return (0); } +static int +access_bus(int fd, struct options i2c_opt) +{ + char *i2c_buf; + int error, chunk_size = 16, i, ch; + + i2c_buf = malloc(i2c_opt.count); + 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') { + if (i2c_opt.verbose && !i2c_opt.binary) + fprintf(stderr, "Enter %d 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.mode == I2C_MODE_TRANSFER) + error = i2c_rdwr_transfer(fd, i2c_opt, i2c_buf); + else if (i2c_opt.dir == 'w') + error = i2c_write(fd, i2c_opt, i2c_buf); + else + error = i2c_read(fd, i2c_opt, i2c_buf); + + if (error == 0) { + if (i2c_opt.dir == 'r' && i2c_opt.binary) { + (void)fwrite(i2c_buf, 1, i2c_opt.count, stdout); + } else if (i2c_opt.verbose || i2c_opt.dir == 'r') { + if (i2c_opt.verbose) + fprintf(stderr, "\nData %s (hex):\n", + i2c_opt.dir == 'r' ? "read" : "written"); + + for (i = 0; i < i2c_opt.count; i++) { + fprintf (stderr, "%02hhx ", i2c_buf[i]); + if ((i % chunk_size) == chunk_size - 1) + fprintf(stderr, "\n"); + } + if ((i % chunk_size) != 0) + fprintf(stderr, "\n"); + } + } + + free(i2c_buf); + return (error); +} + int main(int argc, char** argv) { struct options i2c_opt; - char *skip_addr = NULL, *i2c_buf; + char *skip_addr = NULL; const char *dev, *err_msg; - int fd, error, chunk_size, i, j, ch; + int fd, error, ch; errno = 0; - error = 0; - - /* Line-break the output every chunk_size bytes */ - chunk_size = 16; dev = I2C_DEV; @@ -595,9 +649,8 @@ main(int argc, char** argv) case 'a': i2c_opt.addr = (strtoul(optarg, 0, 16) << 1); if (i2c_opt.addr == 0 && errno == EINVAL) - i2c_opt.addr_set = 0; - else - i2c_opt.addr_set = 1; + usage("Bad -a argument (hex)"); + i2c_opt.addr_set = 1; break; case 'f': dev = optarg; @@ -608,13 +661,15 @@ main(int argc, char** argv) case 'o': i2c_opt.off = strtoul(optarg, 0, 16); if (i2c_opt.off == 0 && errno == EINVAL) - error = 1; + usage("Bad -o argument (hex)"); break; case 'w': i2c_opt.width = optarg; break; case 'c': - i2c_opt.count = atoi(optarg); + i2c_opt.count = (strtoul(optarg, 0, 10)); + if (i2c_opt.count == 0 && errno == EINVAL) + usage("Bad -c argument (decimal)"); break; case 'm': if (!strcmp(optarg, "no")) @@ -626,7 +681,7 @@ main(int argc, char** argv) else if (!strcmp(optarg, "tr")) i2c_opt.mode = I2C_MODE_TRANSFER; else - usage(); + usage("Bad -m argument ([no|ss|rs|tr])"); break; case 'n': i2c_opt.skip = 1; @@ -645,16 +700,16 @@ main(int argc, char** argv) i2c_opt.reset = 1; break; case 'h': + usage("Help:"); + break; default: - usage(); + usage("Bad argument"); } } argc -= optind; argv += optind; - if (argc > 0) { - fprintf(stderr, "Too many arguments\n"); - usage(); - } + if (argc > 0) + usage("Too many arguments"); /* Set default mode if option -m is not specified */ if (i2c_opt.mode == I2C_MODE_NOTSET) { @@ -664,24 +719,20 @@ main(int argc, char** argv) i2c_opt.mode = I2C_MODE_NONE; } - if (i2c_opt.addr_set) { - err_msg = encode_offset(i2c_opt.width, i2c_opt.off, - i2c_opt.off_buf, &i2c_opt.off_len); - if (err_msg != NULL) { - fprintf(stderr, "%s", err_msg); - exit(EX_USAGE); - } + err_msg = encode_offset(i2c_opt.width, i2c_opt.off, + i2c_opt.off_buf, &i2c_opt.off_len); + if (err_msg != NULL) { + fprintf(stderr, "%s", err_msg); + exit(EX_USAGE); } /* Basic sanity check of command line arguments */ if (i2c_opt.scan) { if (i2c_opt.addr_set) - usage(); + usage("-s and -a are incompatible"); } else if (i2c_opt.reset) { if (i2c_opt.addr_set) - usage(); - } else if (error) { - usage(); + usage("-r and -a are incompatible"); } if (i2c_opt.verbose) @@ -698,71 +749,13 @@ main(int argc, char** argv) } if (i2c_opt.scan) - exit(scan_bus(dev, fd, i2c_opt.skip, skip_addr)); - - if (i2c_opt.reset) - exit(reset_bus(dev, fd)); - - i2c_buf = malloc(i2c_opt.count); - 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') { - if (i2c_opt.verbose && !i2c_opt.binary) - fprintf(stderr, "Enter %d 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.mode == I2C_MODE_TRANSFER) - error = i2c_rdwr_transfer(fd, i2c_opt, i2c_buf); - else if (i2c_opt.dir == 'w') - error = i2c_write(fd, i2c_opt, i2c_buf); + error = scan_bus(dev, fd, i2c_opt.skip, skip_addr); + else if (i2c_opt.reset) + error = reset_bus(dev, fd); else - error = i2c_read(fd, i2c_opt, i2c_buf); - - if (error != 0) { - free(i2c_buf); - return (1); - } - - error = close(fd); - assert(error == 0); + error = access_bus(fd, i2c_opt); - if (i2c_opt.verbose) - fprintf(stderr, "\nData %s (hex):\n", i2c_opt.dir == 'r' ? - "read" : "written"); - - i = 0; - j = 0; - while (i < i2c_opt.count) { - if (i2c_opt.verbose || (i2c_opt.dir == 'r' && - !i2c_opt.binary)) - fprintf (stderr, "%02hhx ", i2c_buf[i++]); - - if (i2c_opt.dir == 'r' && i2c_opt.binary) { - fprintf(stdout, "%c", i2c_buf[j++]); - if(!i2c_opt.verbose) - i++; - } - if (!i2c_opt.verbose && (i2c_opt.dir == 'w')) - break; - if ((i % chunk_size) == 0) - fprintf(stderr, "\n"); - } - if ((i % chunk_size) != 0) - fprintf(stderr, "\n"); - - free(i2c_buf); - return (0); + ch = close(fd); + assert(ch == 0); + return (error); } From owner-dev-commits-src-main@freebsd.org Wed May 12 23:31:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2EEB364F9C9; Wed, 12 May 2021 23:31:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgWJs0vn6z3hfj; Wed, 12 May 2021 23:31:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 122C114612; Wed, 12 May 2021 23:31:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14CNVeTM050958; Wed, 12 May 2021 23:31:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14CNVeKf050957; Wed, 12 May 2021 23:31:40 GMT (envelope-from git) Date: Wed, 12 May 2021 23:31:40 GMT Message-Id: <202105122331.14CNVeKf050957@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 529ab5a75925 - main - rtld: initialize default dlerror_seen_val as true MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 529ab5a75925c9c1eeea0b2712911048119d06ae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 23:31:41 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=529ab5a75925c9c1eeea0b2712911048119d06ae commit 529ab5a75925c9c1eeea0b2712911048119d06ae Author: Konstantin Belousov AuthorDate: 2021-05-11 23:36:09 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-12 23:31:29 +0000 rtld: initialize default dlerror_seen_val as true There should be no error after startup. PR: 255698 Reported by: Eugene M. Kim Sponsored by: The FreeBSD Foundation MFC after: 1 week --- libexec/rtld-elf/rtld_lock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rtld-elf/rtld_lock.c b/libexec/rtld-elf/rtld_lock.c index 94e931c2f760..e501c03f0722 100644 --- a/libexec/rtld-elf/rtld_lock.c +++ b/libexec/rtld-elf/rtld_lock.c @@ -60,7 +60,7 @@ void _rtld_atfork_pre(int *) __exported; void _rtld_atfork_post(int *) __exported; static char def_dlerror_msg[512]; -static int def_dlerror_seen_val; +static int def_dlerror_seen_val = 1; static char * def_dlerror_loc(void) From owner-dev-commits-src-main@freebsd.org Wed May 12 23:32:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F2D8764FC18; Wed, 12 May 2021 23:32:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgWKh6dV3z3hvL; Wed, 12 May 2021 23:32:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D69E0146D5; Wed, 12 May 2021 23:32:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14CNWOeB052023; Wed, 12 May 2021 23:32:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14CNWOEk052022; Wed, 12 May 2021 23:32:24 GMT (envelope-from git) Date: Wed, 12 May 2021 23:32:24 GMT Message-Id: <202105122332.14CNWOEk052022@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 6de3cf14c47d - main - vn_open_cred(): disallow O_CREAT | O_EMPTY_PATH MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6de3cf14c47d97b423ae25d5bd1d80b896ecd9e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 23:32:25 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=6de3cf14c47d97b423ae25d5bd1d80b896ecd9e6 commit 6de3cf14c47d97b423ae25d5bd1d80b896ecd9e6 Author: Konstantin Belousov AuthorDate: 2021-05-12 19:04:44 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-12 23:32:04 +0000 vn_open_cred(): disallow O_CREAT | O_EMPTY_PATH This combination does not make sense, and cannot be satisfied by lookup. In particular, lookup cannot supply dvp, it only can directly return vp. Reported and reviewed by: markj using syzkaller Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/kern/vfs_vnops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 670bc4bf8fcc..8f583329f067 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -233,7 +233,8 @@ restart: first_open = false; fmode = *flagp; if ((fmode & (O_CREAT | O_EXCL | O_DIRECTORY)) == (O_CREAT | - O_EXCL | O_DIRECTORY)) + O_EXCL | O_DIRECTORY) || + (fmode & (O_CREAT | O_EMPTY_PATH)) == (O_CREAT | O_EMPTY_PATH)) return (EINVAL); else if ((fmode & (O_CREAT | O_DIRECTORY)) == O_CREAT) { ndp->ni_cnd.cn_nameiop = CREATE; From owner-dev-commits-src-main@freebsd.org Thu May 13 01:33:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD60C62C7EE; Thu, 13 May 2021 01:33:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgZ1T5TMtz3pN6; Thu, 13 May 2021 01:33:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AEDF81602B; Thu, 13 May 2021 01:33:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14D1XX67013557; Thu, 13 May 2021 01:33:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14D1XXD6013556; Thu, 13 May 2021 01:33:33 GMT (envelope-from git) Date: Thu, 13 May 2021 01:33:33 GMT Message-Id: <202105130133.14D1XXD6013556@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: d4870e3a7256 - main - bhyve/snapshot: provide a way to send other messages/data to bhyve MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d4870e3a7256704905655e997b37a866024c2894 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 01:33:33 -0000 The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=d4870e3a7256704905655e997b37a866024c2894 commit d4870e3a7256704905655e997b37a866024c2894 Author: Robert Wing AuthorDate: 2021-03-03 06:05:47 +0000 Commit: Robert Wing CommitDate: 2021-05-13 01:20:15 +0000 bhyve/snapshot: provide a way to send other messages/data to bhyve This is a step towards sending messages (other than suspend/checkpoint) from bhyvectl to bhyve. Introduce a new struct, ipc_message - this struct stores the type of message and a union containing message specific structures for the type of message being sent. Reviewed by: grehan Differential Revision: https://reviews.freebsd.org/D30221 --- usr.sbin/bhyve/snapshot.c | 16 ++++++++-------- usr.sbin/bhyve/snapshot.h | 21 ++++++++++++++++++--- usr.sbin/bhyvectl/bhyvectl.c | 15 +++++++++------ 3 files changed, 35 insertions(+), 17 deletions(-) diff --git a/usr.sbin/bhyve/snapshot.c b/usr.sbin/bhyve/snapshot.c index 221558b6f205..019f4fdd6cb0 100644 --- a/usr.sbin/bhyve/snapshot.c +++ b/usr.sbin/bhyve/snapshot.c @@ -1441,16 +1441,16 @@ done: } int -handle_message(struct checkpoint_op *checkpoint_op, struct vmctx *ctx) +handle_message(struct ipc_message *imsg, struct vmctx *ctx) { int err; - switch (checkpoint_op->op) { + switch (imsg->code) { case START_CHECKPOINT: - err = vm_checkpoint(ctx, checkpoint_op->snapshot_filename, false); + err = vm_checkpoint(ctx, imsg->data.op.snapshot_filename, false); break; case START_SUSPEND: - err = vm_checkpoint(ctx, checkpoint_op->snapshot_filename, true); + err = vm_checkpoint(ctx, imsg->data.op.snapshot_filename, true); break; default: EPRINTLN("Unrecognized checkpoint operation\n"); @@ -1469,7 +1469,7 @@ handle_message(struct checkpoint_op *checkpoint_op, struct vmctx *ctx) void * checkpoint_thread(void *param) { - struct checkpoint_op op; + struct ipc_message imsg; struct checkpoint_thread_info *thread_info; ssize_t n; @@ -1477,14 +1477,14 @@ checkpoint_thread(void *param) thread_info = (struct checkpoint_thread_info *)param; for (;;) { - n = recvfrom(thread_info->socket_fd, &op, sizeof(op), 0, NULL, 0); + n = recvfrom(thread_info->socket_fd, &imsg, sizeof(imsg), 0, NULL, 0); /* * slight sanity check: see if there's enough data to at * least determine the type of message. */ - if (n >= sizeof(op.op)) - handle_message(&op, thread_info->ctx); + if (n >= sizeof(imsg.code)) + handle_message(&imsg, thread_info->ctx); else EPRINTLN("Failed to receive message: %s\n", n == -1 ? strerror(errno) : "unknown error"); diff --git a/usr.sbin/bhyve/snapshot.h b/usr.sbin/bhyve/snapshot.h index 8a6ee67ef19d..f28b56cf0a7f 100644 --- a/usr.sbin/bhyve/snapshot.h +++ b/usr.sbin/bhyve/snapshot.h @@ -60,14 +60,29 @@ struct restore_state { ucl_object_t *meta_root_obj; }; +/* Filename that will be used for save/restore */ +struct checkpoint_op { + char snapshot_filename[MAX_SNAPSHOT_FILENAME]; +}; + +/* Messages that a bhyve process understands. */ enum ipc_opcode { START_CHECKPOINT, START_SUSPEND, }; -struct checkpoint_op { - unsigned int op; - char snapshot_filename[MAX_SNAPSHOT_FILENAME]; +/* + * The type of message and associated data to + * send to a bhyve process. + */ +struct ipc_message { + enum ipc_opcode code; + union { + /* + * message specific structures + */ + struct checkpoint_op op; + } data; }; struct checkpoint_thread_info { diff --git a/usr.sbin/bhyvectl/bhyvectl.c b/usr.sbin/bhyvectl/bhyvectl.c index df02f7caf345..017427db4d4f 100644 --- a/usr.sbin/bhyvectl/bhyvectl.c +++ b/usr.sbin/bhyvectl/bhyvectl.c @@ -1684,7 +1684,7 @@ show_memseg(struct vmctx *ctx) #ifdef BHYVE_SNAPSHOT static int -send_checkpoint_op_req(struct vmctx *ctx, struct checkpoint_op *op) +send_message(struct vmctx *ctx, void *data, size_t len) { struct sockaddr_un addr; ssize_t len_sent; @@ -1709,7 +1709,7 @@ send_checkpoint_op_req(struct vmctx *ctx, struct checkpoint_op *op) snprintf(addr.sun_path, sizeof(addr.sun_path), "%s%s", BHYVE_RUN_DIR, vmname_buf); - len_sent = sendto(socket_fd, op, sizeof(*op), 0, + len_sent = sendto(socket_fd, data, len, 0, (struct sockaddr *)&addr, sizeof(struct sockaddr_un)); if (len_sent < 0) { @@ -1726,12 +1726,15 @@ done: static int snapshot_request(struct vmctx *ctx, const char *file, enum ipc_opcode code) { - struct checkpoint_op op; + struct ipc_message imsg; + size_t length; - op.op = code; - strlcpy(op.snapshot_filename, file, MAX_SNAPSHOT_FILENAME); + imsg.code = code; + strlcpy(imsg.data.op.snapshot_filename, file, MAX_SNAPSHOT_FILENAME); - return (send_checkpoint_op_req(ctx, &op)); + length = offsetof(struct ipc_message, data) + sizeof(imsg.data.op); + + return (send_message(ctx, (void *)&imsg, length)); } #endif From owner-dev-commits-src-main@freebsd.org Thu May 13 01:42:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B68862D1C1; Thu, 13 May 2021 01:42:51 +0000 (UTC) (envelope-from rew@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgZDC27CBz3pdx; Thu, 13 May 2021 01:42:51 +0000 (UTC) (envelope-from rew@freebsd.org) Received: from mail-ot1-f44.google.com (mail-ot1-f44.google.com [209.85.210.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: rew) by smtp.freebsd.org (Postfix) with ESMTPSA id 3954B395D; Thu, 13 May 2021 01:42:51 +0000 (UTC) (envelope-from rew@freebsd.org) Received: by mail-ot1-f44.google.com with SMTP id t4-20020a05683014c4b02902ed26dd7a60so12279005otq.7; Wed, 12 May 2021 18:42:51 -0700 (PDT) X-Gm-Message-State: AOAM533bIQqwR9ltEDJS2HIE/dje7+JhOZ8nRIf9g6Ip4jJRKaJjeeLj ddQG/a/dfXSB/kRmpSlr4UyzTqpN0BbsP6eNw6I= X-Google-Smtp-Source: ABdhPJxw3pxmTbK45iSz7Ob8/axO5IIBh57kvZ3oGYhyqnDUxwUuDLi4dVARVxFFU3VI5U3CsSoNYTIhyKynuKVvw6Q= X-Received: by 2002:a05:6830:1556:: with SMTP id l22mr33105404otp.34.1620870170349; Wed, 12 May 2021 18:42:50 -0700 (PDT) MIME-Version: 1.0 References: <202105130133.14D1XXD6013556@gitrepo.freebsd.org> In-Reply-To: <202105130133.14D1XXD6013556@gitrepo.freebsd.org> From: Rob Wing Date: Wed, 12 May 2021 17:43:08 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: d4870e3a7256 - main - bhyve/snapshot: provide a way to send other messages/data to bhyve To: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 01:42:51 -0000 shoot, I messed up - the differential revision is https://reviews.freebsd.org/D29213 On Wed, May 12, 2021 at 5:33 PM Robert Wing wrote: > The branch main has been updated by rew: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=d4870e3a7256704905655e997b37a866024c2894 > > commit d4870e3a7256704905655e997b37a866024c2894 > Author: Robert Wing > AuthorDate: 2021-03-03 06:05:47 +0000 > Commit: Robert Wing > CommitDate: 2021-05-13 01:20:15 +0000 > > bhyve/snapshot: provide a way to send other messages/data to bhyve > > This is a step towards sending messages (other than suspend/checkpoint) > from bhyvectl to bhyve. > > Introduce a new struct, ipc_message - this struct stores the type of > message and a union containing message specific structures for the type > of message being sent. > > Reviewed by: grehan > Differential Revision: https://reviews.freebsd.org/D30221 > --- > usr.sbin/bhyve/snapshot.c | 16 ++++++++-------- > usr.sbin/bhyve/snapshot.h | 21 ++++++++++++++++++--- > usr.sbin/bhyvectl/bhyvectl.c | 15 +++++++++------ > 3 files changed, 35 insertions(+), 17 deletions(-) > > diff --git a/usr.sbin/bhyve/snapshot.c b/usr.sbin/bhyve/snapshot.c > index 221558b6f205..019f4fdd6cb0 100644 > --- a/usr.sbin/bhyve/snapshot.c > +++ b/usr.sbin/bhyve/snapshot.c > @@ -1441,16 +1441,16 @@ done: > } > > int > -handle_message(struct checkpoint_op *checkpoint_op, struct vmctx *ctx) > +handle_message(struct ipc_message *imsg, struct vmctx *ctx) > { > int err; > > - switch (checkpoint_op->op) { > + switch (imsg->code) { > case START_CHECKPOINT: > - err = vm_checkpoint(ctx, > checkpoint_op->snapshot_filename, false); > + err = vm_checkpoint(ctx, > imsg->data.op.snapshot_filename, false); > break; > case START_SUSPEND: > - err = vm_checkpoint(ctx, > checkpoint_op->snapshot_filename, true); > + err = vm_checkpoint(ctx, > imsg->data.op.snapshot_filename, true); > break; > default: > EPRINTLN("Unrecognized checkpoint operation\n"); > @@ -1469,7 +1469,7 @@ handle_message(struct checkpoint_op *checkpoint_op, > struct vmctx *ctx) > void * > checkpoint_thread(void *param) > { > - struct checkpoint_op op; > + struct ipc_message imsg; > struct checkpoint_thread_info *thread_info; > ssize_t n; > > @@ -1477,14 +1477,14 @@ checkpoint_thread(void *param) > thread_info = (struct checkpoint_thread_info *)param; > > for (;;) { > - n = recvfrom(thread_info->socket_fd, &op, sizeof(op), 0, > NULL, 0); > + n = recvfrom(thread_info->socket_fd, &imsg, sizeof(imsg), > 0, NULL, 0); > > /* > * slight sanity check: see if there's enough data to at > * least determine the type of message. > */ > - if (n >= sizeof(op.op)) > - handle_message(&op, thread_info->ctx); > + if (n >= sizeof(imsg.code)) > + handle_message(&imsg, thread_info->ctx); > else > EPRINTLN("Failed to receive message: %s\n", > n == -1 ? strerror(errno) : "unknown error"); > diff --git a/usr.sbin/bhyve/snapshot.h b/usr.sbin/bhyve/snapshot.h > index 8a6ee67ef19d..f28b56cf0a7f 100644 > --- a/usr.sbin/bhyve/snapshot.h > +++ b/usr.sbin/bhyve/snapshot.h > @@ -60,14 +60,29 @@ struct restore_state { > ucl_object_t *meta_root_obj; > }; > > +/* Filename that will be used for save/restore */ > +struct checkpoint_op { > + char snapshot_filename[MAX_SNAPSHOT_FILENAME]; > +}; > + > +/* Messages that a bhyve process understands. */ > enum ipc_opcode { > START_CHECKPOINT, > START_SUSPEND, > }; > > -struct checkpoint_op { > - unsigned int op; > - char snapshot_filename[MAX_SNAPSHOT_FILENAME]; > +/* > + * The type of message and associated data to > + * send to a bhyve process. > + */ > +struct ipc_message { > + enum ipc_opcode code; > + union { > + /* > + * message specific structures > + */ > + struct checkpoint_op op; > + } data; > }; > > struct checkpoint_thread_info { > diff --git a/usr.sbin/bhyvectl/bhyvectl.c b/usr.sbin/bhyvectl/bhyvectl.c > index df02f7caf345..017427db4d4f 100644 > --- a/usr.sbin/bhyvectl/bhyvectl.c > +++ b/usr.sbin/bhyvectl/bhyvectl.c > @@ -1684,7 +1684,7 @@ show_memseg(struct vmctx *ctx) > > #ifdef BHYVE_SNAPSHOT > static int > -send_checkpoint_op_req(struct vmctx *ctx, struct checkpoint_op *op) > +send_message(struct vmctx *ctx, void *data, size_t len) > { > struct sockaddr_un addr; > ssize_t len_sent; > @@ -1709,7 +1709,7 @@ send_checkpoint_op_req(struct vmctx *ctx, struct > checkpoint_op *op) > > snprintf(addr.sun_path, sizeof(addr.sun_path), "%s%s", > BHYVE_RUN_DIR, vmname_buf); > > - len_sent = sendto(socket_fd, op, sizeof(*op), 0, > + len_sent = sendto(socket_fd, data, len, 0, > (struct sockaddr *)&addr, sizeof(struct sockaddr_un)); > > if (len_sent < 0) { > @@ -1726,12 +1726,15 @@ done: > static int > snapshot_request(struct vmctx *ctx, const char *file, enum ipc_opcode > code) > { > - struct checkpoint_op op; > + struct ipc_message imsg; > + size_t length; > > - op.op = code; > - strlcpy(op.snapshot_filename, file, MAX_SNAPSHOT_FILENAME); > + imsg.code = code; > + strlcpy(imsg.data.op.snapshot_filename, file, > MAX_SNAPSHOT_FILENAME); > > - return (send_checkpoint_op_req(ctx, &op)); > + length = offsetof(struct ipc_message, data) + sizeof(imsg.data.op); > + > + return (send_message(ctx, (void *)&imsg, length)); > } > #endif > > From owner-dev-commits-src-main@freebsd.org Thu May 13 04:39:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 74900630E9B; Thu, 13 May 2021 04:39:49 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fgf8P18Cbz4RNR; Thu, 13 May 2021 04:39:48 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 14D4dfTQ074721; Wed, 12 May 2021 21:39:41 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 14D4dfZ2074720; Wed, 12 May 2021 21:39:41 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202105130439.14D4dfZ2074720@gndrsh.dnsmgr.net> Subject: Re: git: d4870e3a7256 - main - bhyve/snapshot: provide a way to send other messages/data to bhyve In-Reply-To: To: Rob Wing Date: Wed, 12 May 2021 21:39:41 -0700 (PDT) CC: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4Fgf8P18Cbz4RNR X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 04:39:49 -0000 > shoot, I messed up - the differential revision is > https://reviews.freebsd.org/D29213 And it is going to take more than a comment here and remove a couple of subscribers to "undo" this mistake. If you go open https://reviews.freebsd.org/D30211 now you well see that this committed diff is what shows up in the review, and what you get if you try to download the rawdiff. I do not know how to clean this up, but the simple action of making a comment on the mailling list to "fix" these types of mistakes is leaving a lot of cruft around that can be very hard to sort out at a later date, especially since the "fix" is pretty much invisible to all the tools. > > On Wed, May 12, 2021 at 5:33 PM Robert Wing wrote: > > > The branch main has been updated by rew: > > > > URL: > > https://cgit.FreeBSD.org/src/commit/?id=d4870e3a7256704905655e997b37a866024c2894 > > > > commit d4870e3a7256704905655e997b37a866024c2894 > > Author: Robert Wing > > AuthorDate: 2021-03-03 06:05:47 +0000 > > Commit: Robert Wing > > CommitDate: 2021-05-13 01:20:15 +0000 > > > > bhyve/snapshot: provide a way to send other messages/data to bhyve > > > > This is a step towards sending messages (other than suspend/checkpoint) > > from bhyvectl to bhyve. > > > > Introduce a new struct, ipc_message - this struct stores the type of > > message and a union containing message specific structures for the type > > of message being sent. > > > > Reviewed by: grehan > > Differential Revision: https://reviews.freebsd.org/D30221 > > --- > > usr.sbin/bhyve/snapshot.c | 16 ++++++++-------- > > usr.sbin/bhyve/snapshot.h | 21 ++++++++++++++++++--- > > usr.sbin/bhyvectl/bhyvectl.c | 15 +++++++++------ > > 3 files changed, 35 insertions(+), 17 deletions(-) > > > > diff --git a/usr.sbin/bhyve/snapshot.c b/usr.sbin/bhyve/snapshot.c > > index 221558b6f205..019f4fdd6cb0 100644 > > --- a/usr.sbin/bhyve/snapshot.c > > +++ b/usr.sbin/bhyve/snapshot.c > > @@ -1441,16 +1441,16 @@ done: > > } > > > > int > > -handle_message(struct checkpoint_op *checkpoint_op, struct vmctx *ctx) > > +handle_message(struct ipc_message *imsg, struct vmctx *ctx) > > { > > int err; > > > > - switch (checkpoint_op->op) { > > + switch (imsg->code) { > > case START_CHECKPOINT: > > - err = vm_checkpoint(ctx, > > checkpoint_op->snapshot_filename, false); > > + err = vm_checkpoint(ctx, > > imsg->data.op.snapshot_filename, false); > > break; > > case START_SUSPEND: > > - err = vm_checkpoint(ctx, > > checkpoint_op->snapshot_filename, true); > > + err = vm_checkpoint(ctx, > > imsg->data.op.snapshot_filename, true); > > break; > > default: > > EPRINTLN("Unrecognized checkpoint operation\n"); > > @@ -1469,7 +1469,7 @@ handle_message(struct checkpoint_op *checkpoint_op, > > struct vmctx *ctx) > > void * > > checkpoint_thread(void *param) > > { > > - struct checkpoint_op op; > > + struct ipc_message imsg; > > struct checkpoint_thread_info *thread_info; > > ssize_t n; > > > > @@ -1477,14 +1477,14 @@ checkpoint_thread(void *param) > > thread_info = (struct checkpoint_thread_info *)param; > > > > for (;;) { > > - n = recvfrom(thread_info->socket_fd, &op, sizeof(op), 0, > > NULL, 0); > > + n = recvfrom(thread_info->socket_fd, &imsg, sizeof(imsg), > > 0, NULL, 0); > > > > /* > > * slight sanity check: see if there's enough data to at > > * least determine the type of message. > > */ > > - if (n >= sizeof(op.op)) > > - handle_message(&op, thread_info->ctx); > > + if (n >= sizeof(imsg.code)) > > + handle_message(&imsg, thread_info->ctx); > > else > > EPRINTLN("Failed to receive message: %s\n", > > n == -1 ? strerror(errno) : "unknown error"); > > diff --git a/usr.sbin/bhyve/snapshot.h b/usr.sbin/bhyve/snapshot.h > > index 8a6ee67ef19d..f28b56cf0a7f 100644 > > --- a/usr.sbin/bhyve/snapshot.h > > +++ b/usr.sbin/bhyve/snapshot.h > > @@ -60,14 +60,29 @@ struct restore_state { > > ucl_object_t *meta_root_obj; > > }; > > > > +/* Filename that will be used for save/restore */ > > +struct checkpoint_op { > > + char snapshot_filename[MAX_SNAPSHOT_FILENAME]; > > +}; > > + > > +/* Messages that a bhyve process understands. */ > > enum ipc_opcode { > > START_CHECKPOINT, > > START_SUSPEND, > > }; > > > > -struct checkpoint_op { > > - unsigned int op; > > - char snapshot_filename[MAX_SNAPSHOT_FILENAME]; > > +/* > > + * The type of message and associated data to > > + * send to a bhyve process. > > + */ > > +struct ipc_message { > > + enum ipc_opcode code; > > + union { > > + /* > > + * message specific structures > > + */ > > + struct checkpoint_op op; > > + } data; > > }; > > > > struct checkpoint_thread_info { > > diff --git a/usr.sbin/bhyvectl/bhyvectl.c b/usr.sbin/bhyvectl/bhyvectl.c > > index df02f7caf345..017427db4d4f 100644 > > --- a/usr.sbin/bhyvectl/bhyvectl.c > > +++ b/usr.sbin/bhyvectl/bhyvectl.c > > @@ -1684,7 +1684,7 @@ show_memseg(struct vmctx *ctx) > > > > #ifdef BHYVE_SNAPSHOT > > static int > > -send_checkpoint_op_req(struct vmctx *ctx, struct checkpoint_op *op) > > +send_message(struct vmctx *ctx, void *data, size_t len) > > { > > struct sockaddr_un addr; > > ssize_t len_sent; > > @@ -1709,7 +1709,7 @@ send_checkpoint_op_req(struct vmctx *ctx, struct > > checkpoint_op *op) > > > > snprintf(addr.sun_path, sizeof(addr.sun_path), "%s%s", > > BHYVE_RUN_DIR, vmname_buf); > > > > - len_sent = sendto(socket_fd, op, sizeof(*op), 0, > > + len_sent = sendto(socket_fd, data, len, 0, > > (struct sockaddr *)&addr, sizeof(struct sockaddr_un)); > > > > if (len_sent < 0) { > > @@ -1726,12 +1726,15 @@ done: > > static int > > snapshot_request(struct vmctx *ctx, const char *file, enum ipc_opcode > > code) > > { > > - struct checkpoint_op op; > > + struct ipc_message imsg; > > + size_t length; > > > > - op.op = code; > > - strlcpy(op.snapshot_filename, file, MAX_SNAPSHOT_FILENAME); > > + imsg.code = code; > > + strlcpy(imsg.data.op.snapshot_filename, file, > > MAX_SNAPSHOT_FILENAME); > > > > - return (send_checkpoint_op_req(ctx, &op)); > > + length = offsetof(struct ipc_message, data) + sizeof(imsg.data.op); > > + > > + return (send_message(ctx, (void *)&imsg, length)); > > } > > #endif > > > > -- Rod Grimes rgrimes@freebsd.org From owner-dev-commits-src-main@freebsd.org Thu May 13 05:58:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EFD7C6323CC; Thu, 13 May 2021 05:58:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FggvJ66y1z4VG8; Thu, 13 May 2021 05:58:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C02B719548; Thu, 13 May 2021 05:58:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14D5wa57057476; Thu, 13 May 2021 05:58:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14D5wa8P057475; Thu, 13 May 2021 05:58:36 GMT (envelope-from git) Date: Thu, 13 May 2021 05:58:36 GMT Message-Id: <202105130558.14D5wa8P057475@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 1025baec7b78 - main - stress2: Added two new syzkaller reproducers. Update the exclude list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1025baec7b786df46ee63bf55369cf081002b8af Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 05:58:37 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=1025baec7b786df46ee63bf55369cf081002b8af commit 1025baec7b786df46ee63bf55369cf081002b8af Author: Peter Holm AuthorDate: 2021-05-13 05:57:32 +0000 Commit: Peter Holm CommitDate: 2021-05-13 05:57:32 +0000 stress2: Added two new syzkaller reproducers. Update the exclude list --- tools/test/stress2/misc/all.exclude | 2 - tools/test/stress2/misc/syzkaller37.sh | 99 ++++++++++++++++++++++++++++++++++ tools/test/stress2/misc/syzkaller38.sh | 63 ++++++++++++++++++++++ 3 files changed, 162 insertions(+), 2 deletions(-) diff --git a/tools/test/stress2/misc/all.exclude b/tools/test/stress2/misc/all.exclude index e388fa8957d9..9f856c1b9d2f 100644 --- a/tools/test/stress2/misc/all.exclude +++ b/tools/test/stress2/misc/all.exclude @@ -70,8 +70,6 @@ syzkaller30.sh May change policy for random threads to to domainset_fixed 20210 syzkaller31.sh panic: Bad tailq NEXT(0xfffffe0079608f00->tqh_last) != NULL 20210322 syzkaller32.sh Fatal trap 18: integer divide fault while in kernel mode 20210322 syzkaller33.sh Fatal trap 18: integer divide fault while in kernel mode 20210418 -syzkaller35.sh panic: AEAD without a separate IV 20210508 -syzkaller36.sh panic: IV outside buffer length 20210508 truss3.sh WiP 20200915 unionfs.sh insmntque: non-locked vp: xx is not exclusive locked... 20130909 unionfs2.sh insmntque: mp-safe fs and non-locked vp is not ... 20111219 diff --git a/tools/test/stress2/misc/syzkaller37.sh b/tools/test/stress2/misc/syzkaller37.sh new file mode 100755 index 000000000000..cda44530af85 --- /dev/null +++ b/tools/test/stress2/misc/syzkaller37.sh @@ -0,0 +1,99 @@ +#!/bin/sh + +# panic: crp_iv_start set when IV isn't used +# cpuid = 15 +# time = 1620460567 +# KDB: stack backtrace: +# db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe023ceef5d0 +# vpanic() at vpanic+0x181/frame 0xfffffe023ceef620 +# panic() at panic+0x43/frame 0xfffffe023ceef680 +# crp_sanity() at crp_sanity+0x236/frame 0xfffffe023ceef6b0 +# crypto_dispatch() at crypto_dispatch+0xf/frame 0xfffffe023ceef6d0 +# crypto_ioctl() at crypto_ioctl+0x1e33/frame 0xfffffe023ceef7e0 +# devfs_ioctl() at devfs_ioctl+0xcd/frame 0xfffffe023ceef830 +# VOP_IOCTL_APV() at VOP_IOCTL_APV+0x59/frame 0xfffffe023ceef850 +# vn_ioctl() at vn_ioctl+0x133/frame 0xfffffe023ceef960 +# devfs_ioctl_f() at devfs_ioctl_f+0x1e/frame 0xfffffe023ceef980 +# kern_ioctl() at kern_ioctl+0x289/frame 0xfffffe023ceef9f0 +# sys_ioctl() at sys_ioctl+0x12a/frame 0xfffffe023ceefac0 +# amd64_syscall() at amd64_syscall+0x147/frame 0xfffffe023ceefbf0 +# fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe023ceefbf0 +# --- syscall (0, FreeBSD ELF64, nosys), rip = 0x8003827da, rsp = 0x7fffffffe4e8, rbp = 0x7fffffffe540 --- +# KDB: enter: panic +# [ thread pid 18612 tid 109119 ] +# Stopped at kdb_enter+0x37: movq $0,0x1281a2e(%rip) +# db> x/s version +# version: FreeBSD 14.0-CURRENT #0 main-n246560-2018d488628: Sat May 8 08:32:52 CEST 2021 +# pho@t2.osted.lan:/usr/src/sys/amd64/compile/PHO +# db> + +[ `uname -p` != "amd64" ] && exit 0 +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg +cat > /tmp/syzkaller37.c < +#include +#include +#include +#include +#include +#include +#include +#include +#include + +uint64_t r[1] = {0xffffffffffffffff}; + +int main(void) +{ + syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x1012ul, -1, 0ul); + intptr_t res = 0; + memcpy((void*)0x20000340, "/dev/crypto\000", 12); + res = syscall(SYS_openat, 0xffffffffffffff9cul, 0x20000340ul, 0ul, 0ul); + if (res != -1) + r[0] = res; + *(uint32_t*)0x20000040 = 0x10; + *(uint32_t*)0x20000044 = 0x1d; + *(uint32_t*)0x20000048 = 1; + *(uint64_t*)0x20000050 = 0x20000080; + memset((void*)0x20000080, 66, 1); + *(uint32_t*)0x20000058 = 0; + *(uint64_t*)0x20000060 = 0; + *(uint32_t*)0x20000068 = 0; + *(uint32_t*)0x2000006c = 0xfdffffff; + *(uint32_t*)0x20000070 = 0; + *(uint32_t*)0x20000074 = 0; + *(uint32_t*)0x20000078 = 0; + *(uint32_t*)0x2000007c = 0; + syscall(SYS_ioctl, r[0], 0xc040636aul, 0x20000040ul); + *(uint32_t*)0x20000000 = 0; + *(uint16_t*)0x20000004 = 2; + *(uint16_t*)0x20000006 = 0; + *(uint32_t*)0x20000008 = 0; + *(uint32_t*)0x2000000c = 0x10001; + *(uint32_t*)0x20000010 = 0; + *(uint64_t*)0x20000018 = 0; + *(uint64_t*)0x20000020 = 0; + *(uint64_t*)0x20000028 = 0x200001c0; + *(uint64_t*)0x20000030 = 0x20000380; + *(uint64_t*)0x20000038 = 0; + syscall(SYS_ioctl, r[0], 0xc040636dul, 0x20000000ul); + return 0; +} +EOF +mycc -o /tmp/syzkaller37 -Wall -Wextra -O0 /tmp/syzkaller37.c || + exit 1 + +kldload cryptodev.ko && loaded=1 +(cd /tmp; timeout 3m ./syzkaller37) +[ $loaded ] && kldunload cryptodev.ko + +rm -rf /tmp/syzkaller37 syzkaller37.c /tmp/syzkaller.* +exit 0 diff --git a/tools/test/stress2/misc/syzkaller38.sh b/tools/test/stress2/misc/syzkaller38.sh new file mode 100755 index 000000000000..2bd42e98a644 --- /dev/null +++ b/tools/test/stress2/misc/syzkaller38.sh @@ -0,0 +1,63 @@ +#!/bin/sh + +# panic: Assertion (cnp->cn_flags & (LOCKPARENT | WANTPARENT)) == 0 failed at ../../../kern/vfs_lookup.c:490 +# cpuid = 22 +# time = 1620845561 +# KDB: stack backtrace: +# db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe01499e7690 +# vpanic() at vpanic+0x181/frame 0xfffffe01499e76e0 +# panic() at panic+0x43/frame 0xfffffe01499e7740 +# namei() at namei+0xb4e/frame 0xfffffe01499e77f0 +# vn_open_cred() at vn_open_cred+0x11d/frame 0xfffffe01499e7960 +# kern_openat() at kern_openat+0x28f/frame 0xfffffe01499e7ac0 +# amd64_syscall() at amd64_syscall+0x147/frame 0xfffffe01499e7bf0 +# fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe01499e7bf0 +# --- syscall (0, FreeBSD ELF64, nosys), rip = 0x80038254a, rsp = 0x7fffffffe4f8, rbp = 0x7fffffffe540 --- +# KDB: enter: panic +# [ thread pid 2990 tid 100320 ] +# Stopped at kdb_enter+0x37: movq $0,0x12819de(%rip) +# db> x/s version +# version: FreeBSD 14.0-CURRENT #0 main-n246600-e681dd3e2c1-dirty: Wed May 12 07:56:58 CEST 2021 +# pho@t2.osted.lan:/usr/src/sys/amd64/compile/PHO\012 +# db> + +# Fixed by: 6de3cf14c47d - main - vn_open_cred(): disallow O_CREAT | O_EMPTY_PATH + +[ `uname -p` != "amd64" ] && exit 0 +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg +cat > /tmp/syzkaller38.c < +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int main(void) +{ + syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x1012ul, -1, 0ul); + + memset((void*)0x20000180, 0, 1); + syscall(SYS_open, 0x20000180ul, 0x20c0200ul, 0ul); + return 0; +} +EOF +mycc -o /tmp/syzkaller38 -Wall -Wextra -O0 /tmp/syzkaller38.c || + exit 1 + +(cd /tmp; timeout 3m ./syzkaller38) + +rm -rf /tmp/syzkaller38 syzkaller38.c /tmp/syzkaller.* +exit 0 From owner-dev-commits-src-main@freebsd.org Thu May 13 07:56:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7FB8E635118; Thu, 13 May 2021 07:56:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgkWv3DF0z4Zwd; Thu, 13 May 2021 07:56:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 61A781AE60; Thu, 13 May 2021 07:56:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14D7uxVc016011; Thu, 13 May 2021 07:56:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14D7uxP7016010; Thu, 13 May 2021 07:56:59 GMT (envelope-from git) Date: Thu, 13 May 2021 07:56:59 GMT Message-Id: <202105130756.14D7uxP7016010@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 1760799b4c61 - main - Remove references to timed(8) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1760799b4c612b98c0e5c1abeb03814e24c33cf6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 07:56:59 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=1760799b4c612b98c0e5c1abeb03814e24c33cf6 commit 1760799b4c612b98c0e5c1abeb03814e24c33cf6 Author: Ceri Davies AuthorDate: 2021-05-13 07:53:08 +0000 Commit: Gordon Bergling CommitDate: 2021-05-13 07:53:08 +0000 Remove references to timed(8) There are still references to timed(8) and timedc(8) in the base system, which were removed in 2018. PR: 255425 Reported by: Ceri Davies Reviewed by: ygy, gbe MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30232 --- lib/libc/rpc/rtime.3 | 4 +--- lib/libc/sys/adjtime.2 | 6 ++---- lib/libc/sys/clock_gettime.2 | 5 ++--- lib/libc/sys/gettimeofday.2 | 5 ++--- libexec/rc/rc.conf | 2 -- share/man/man5/rc.conf.5 | 26 +------------------------- 6 files changed, 8 insertions(+), 40 deletions(-) diff --git a/lib/libc/rpc/rtime.3 b/lib/libc/rpc/rtime.3 index 028d2beade14..e657ca50aa18 100644 --- a/lib/libc/rpc/rtime.3 +++ b/lib/libc/rpc/rtime.3 @@ -1,7 +1,7 @@ .\" @(#)rtime.3n 2.1 88/08/08 4.0 RPCSRC; from 1.5 88/02/08 SMI .\" $FreeBSD$ .\" -.Dd November 22, 1987 +.Dd May 13, 2021 .Dt RTIME 3 .Os .Sh NAME @@ -46,5 +46,3 @@ however, the routine will instead use and block until a reply is received from the time server. .Sh RETURN VALUES .Rv -std rtime -.Sh SEE ALSO -.Xr timed 8 diff --git a/lib/libc/sys/adjtime.2 b/lib/libc/sys/adjtime.2 index 03a93a8ae842..18f6f368d140 100644 --- a/lib/libc/sys/adjtime.2 +++ b/lib/libc/sys/adjtime.2 @@ -28,7 +28,7 @@ .\" @(#)adjtime.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd May 13, 2021 .Dt ADJTIME 2 .Os .Sh NAME @@ -96,9 +96,7 @@ The process's effective user ID is not that of the super-user. .El .Sh SEE ALSO .Xr date 1 , -.Xr gettimeofday 2 , -.Xr timed 8 , -.Xr timedc 8 +.Xr gettimeofday 2 .Rs .%T "TSP: The Time Synchronization Protocol for UNIX 4.3BSD" .%A R. Gusella diff --git a/lib/libc/sys/clock_gettime.2 b/lib/libc/sys/clock_gettime.2 index 6dca19449be9..4552819ea902 100644 --- a/lib/libc/sys/clock_gettime.2 +++ b/lib/libc/sys/clock_gettime.2 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 7, 2019 +.Dd May 13, 2021 .Dt CLOCK_GETTIME 2 .Os .Sh NAME @@ -154,8 +154,7 @@ A user other than the super-user attempted to set the time. .Xr adjtime 2 , .Xr clock_getcpuclockid 3 , .Xr ctime 3 , -.Xr pthread_getcpuclockid 3 , -.Xr timed 8 +.Xr pthread_getcpuclockid 3 .Sh STANDARDS The .Fn clock_gettime , diff --git a/lib/libc/sys/gettimeofday.2 b/lib/libc/sys/gettimeofday.2 index 29f713653063..08e3979149e7 100644 --- a/lib/libc/sys/gettimeofday.2 +++ b/lib/libc/sys/gettimeofday.2 @@ -28,7 +28,7 @@ .\" @(#)gettimeofday.2 8.2 (Berkeley) 5/26/95 .\" $FreeBSD$ .\" -.Dd October 27, 2018 +.Dd May 13, 2021 .Dt GETTIMEOFDAY 2 .Os .Sh NAME @@ -123,8 +123,7 @@ A user other than the super-user attempted to set the time. .Xr clock_gettime 2 , .Xr ctime 3 , .Xr timeradd 3 , -.Xr clocks 7 , -.Xr timed 8 +.Xr clocks 7 .Sh HISTORY The .Fn gettimeofday diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf index d941a20b6e07..041d4b6b5321 100644 --- a/libexec/rc/rc.conf +++ b/libexec/rc/rc.conf @@ -391,8 +391,6 @@ tlsservd_enable="NO" # Run rpc.tlsservd needed for NFS-over-TLS nfsd tlsservd_flags="" # Flags for rpc.tlsservd ### Network Time Services options: ### -timed_enable="NO" # Run the time daemon (or NO). -timed_flags="" # Flags to timed (if enabled). ntpdate_enable="NO" # Run ntpdate to sync time on boot (or NO). ntpdate_program="/usr/sbin/ntpdate" # path to ntpdate, if you want a different one. ntpdate_flags="-b" # Flags to ntpdate (if enabled). diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index 6baf3b22b024..95fa8bce4dc0 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 11, 2021 +.Dd May 13, 2021 .Dt RC.CONF 5 .Os .Sh NAME @@ -2574,29 +2574,6 @@ This is mandatory when .Va pppoed_enable is set to .Dq Li YES . -.It Va timed_enable -.Pq Vt bool -If set to -.Dq Li YES , -run the -.Xr timed 8 -service at boot time. -This command is intended for networks of -machines where a consistent -.Dq "network time" -for all hosts must be established. -This is often useful in large NFS -environments where time stamps on files are expected to be consistent -network-wide. -.It Va timed_flags -.Pq Vt str -If -.Va timed_enable -is set to -.Dq Li YES , -these are the flags to pass to the -.Xr timed 8 -service. .It Va ntpdate_enable .Pq Vt bool If set to @@ -4691,7 +4668,6 @@ it will be made permanently active. .Xr sysctl 8 , .Xr syslogd 8 , .Xr sysrc 8 , -.Xr timed 8 , .Xr unbound 8 , .Xr usbconfig 8 , .Xr wlandebug 8 , From owner-dev-commits-src-main@freebsd.org Thu May 13 08:13:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 47D836357F7; Thu, 13 May 2021 08:13:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fgkv41WNgz4bll; Thu, 13 May 2021 08:13:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 26FB31B78B; Thu, 13 May 2021 08:13:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14D8Da0t042388; Thu, 13 May 2021 08:13:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14D8Da83042387; Thu, 13 May 2021 08:13:36 GMT (envelope-from git) Date: Thu, 13 May 2021 08:13:36 GMT Message-Id: <202105130813.14D8Da83042387@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 82483ea7adfe - main - find(1): Document the -f option MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 82483ea7adfe4213059f6dacf31f3bd1327b2cc0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 08:13:36 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=82483ea7adfe4213059f6dacf31f3bd1327b2cc0 commit 82483ea7adfe4213059f6dacf31f3bd1327b2cc0 Author: Ceri Davies AuthorDate: 2021-05-13 08:10:22 +0000 Commit: Gordon Bergling CommitDate: 2021-05-13 08:10:22 +0000 find(1): Document the -f option PR: 223127 Reported by: Mathieu Arnold Reviewed by: bcr, gbe MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D30215 --- usr.bin/find/find.1 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/usr.bin/find/find.1 b/usr.bin/find/find.1 index 0c5c113479a3..8bc9f9d69604 100644 --- a/usr.bin/find/find.1 +++ b/usr.bin/find/find.1 @@ -31,7 +31,7 @@ .\" @(#)find.1 8.7 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd March 13, 2021 +.Dd May 13, 2021 .Dt FIND 1 .Os .Sh NAME @@ -135,6 +135,19 @@ primary specified by Refer to its description under .Sx PRIMARIES for more information. +.It Fl f Ar path +Add +.Ar path +to the list of paths that will be recursed into. +This is useful when +.Ar path +begins with a character that would otherwise be interpreted as an +.Ar expression , +namely +.Dq Li "!" , +.Dq Li "(" +and +.Dq Li - . .It Fl s Cause .Nm From owner-dev-commits-src-main@freebsd.org Thu May 13 09:39:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8F4436384D4; Thu, 13 May 2021 09:39:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgmpP3dg0z4g02; Thu, 13 May 2021 09:39:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6FAE91C066; Thu, 13 May 2021 09:39:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14D9dfFD050148; Thu, 13 May 2021 09:39:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14D9dfBC050147; Thu, 13 May 2021 09:39:41 GMT (envelope-from git) Date: Thu, 13 May 2021 09:39:41 GMT Message-Id: <202105130939.14D9dfBC050147@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: cef8a95acbae - main - vfs: fix vnode use count leak in O_EMPTY_PATH support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cef8a95acbae0c3043d95028d8ebb24d959a82a0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 09:39:41 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=cef8a95acbae0c3043d95028d8ebb24d959a82a0 commit cef8a95acbae0c3043d95028d8ebb24d959a82a0 Author: Mateusz Guzik AuthorDate: 2021-05-13 09:23:03 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-13 09:39:27 +0000 vfs: fix vnode use count leak in O_EMPTY_PATH support The vnode returned by namei_setup is already referenced. Reported by: pho --- sys/kern/vfs_lookup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 3050275c1b6f..5336bf87ec68 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -495,8 +495,10 @@ namei_emptypath(struct nameidata *ndp) goto errout; } + /* + * Usecount on dp already provided by namei_setup. + */ ndp->ni_vp = dp; - vref(dp); namei_cleanup_cnp(cnp); pwd_drop(pwd); ndp->ni_resflags |= NIRES_EMPTYPATH; From owner-dev-commits-src-main@freebsd.org Thu May 13 10:15:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 05799639ABB; Thu, 13 May 2021 10:15:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgnbN6kMzz4hyj; Thu, 13 May 2021 10:15:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9BA01CC55; Thu, 13 May 2021 10:15:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DAFCQu002973; Thu, 13 May 2021 10:15:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DAFClb002972; Thu, 13 May 2021 10:15:12 GMT (envelope-from git) Date: Thu, 13 May 2021 10:15:12 GMT Message-Id: <202105131015.14DAFClb002972@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 8ea5eeb913b9 - main - mod_cc: cross reference CC modules consistently MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8ea5eeb913b94aa45aa7773d14b31222d509ec34 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 10:15:13 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=8ea5eeb913b94aa45aa7773d14b31222d509ec34 commit 8ea5eeb913b94aa45aa7773d14b31222d509ec34 Author: Michael Tuexen AuthorDate: 2021-05-13 08:47:45 +0000 Commit: Michael Tuexen CommitDate: 2021-05-13 09:29:35 +0000 mod_cc: cross reference CC modules consistently Reviewed by: bcr, gbe MFC after: 3 days Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D30240 --- share/man/man4/cc_cdg.4 | 3 ++- share/man/man4/cc_chd.4 | 4 +++- share/man/man4/cc_cubic.4 | 4 +++- share/man/man4/cc_dctcp.4 | 3 ++- share/man/man4/cc_hd.4 | 4 +++- share/man/man4/cc_htcp.4 | 4 +++- share/man/man4/cc_newreno.4 | 4 +++- share/man/man4/cc_vegas.4 | 4 +++- share/man/man9/mod_cc.9 | 3 ++- 9 files changed, 24 insertions(+), 9 deletions(-) diff --git a/share/man/man4/cc_cdg.4 b/share/man/man4/cc_cdg.4 index 38f8ed397def..1b14e094ff84 100644 --- a/share/man/man4/cc_cdg.4 +++ b/share/man/man4/cc_cdg.4 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 2, 2013 +.Dd May 13, 2021 .Dt CC_CDG 4 .Os .Sh NAME @@ -99,6 +99,7 @@ Default is 0. .Sh SEE ALSO .Xr cc_chd 4 , .Xr cc_cubic 4 , +.Xr cc_dctcp 4 , .Xr cc_hd 4 , .Xr cc_htcp 4 , .Xr cc_newreno 4 , diff --git a/share/man/man4/cc_chd.4 b/share/man/man4/cc_chd.4 index 963d89247fde..32b0444f89d7 100644 --- a/share/man/man4/cc_chd.4 +++ b/share/man/man4/cc_chd.4 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 15, 2011 +.Dd May 13, 2021 .Dt CC_CHD 4 .Os .Sh NAME @@ -86,7 +86,9 @@ is used. Default is 1. .El .Sh SEE ALSO +.Xr cc_cdg 4 , .Xr cc_cubic 4 , +.Xr cc_dctcp 4 , .Xr cc_hd 4 , .Xr cc_htcp 4 , .Xr cc_newreno 4 , diff --git a/share/man/man4/cc_cubic.4 b/share/man/man4/cc_cubic.4 index 75df183fa16f..92ac8971e867 100644 --- a/share/man/man4/cc_cubic.4 +++ b/share/man/man4/cc_cubic.4 @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 15, 2011 +.Dd May 13, 2021 .Dt CC_CUBIC 4 .Os .Sh NAME @@ -62,7 +62,9 @@ section below. .Sh MIB Variables There are currently no tunable MIB variables. .Sh SEE ALSO +.Xr cc_cdg 4 , .Xr cc_chd 4 , +.Xr cc_dctcp 4 , .Xr cc_hd 4 , .Xr cc_htcp 4 , .Xr cc_newreno 4 , diff --git a/share/man/man4/cc_dctcp.4 b/share/man/man4/cc_dctcp.4 index 5c5be4fed96e..8c23f2eaa134 100644 --- a/share/man/man4/cc_dctcp.4 +++ b/share/man/man4/cc_dctcp.4 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 29, 2019 +.Dd May 13, 2021 .Dt CC_DCTCP 4 .Os .Sh NAME @@ -93,6 +93,7 @@ A flag if the congestion window should be reduced by one half after slow start. Valid settings 0 and 1, default 0. .El .Sh SEE ALSO +.Xr cc_cdg 4 , .Xr cc_chd 4 , .Xr cc_cubic 4 , .Xr cc_hd 4 , diff --git a/share/man/man4/cc_hd.4 b/share/man/man4/cc_hd.4 index 497e61616a0a..d56d9b77b4d9 100644 --- a/share/man/man4/cc_hd.4 +++ b/share/man/man4/cc_hd.4 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 15, 2011 +.Dd May 13, 2021 .Dt CC_HD 4 .Os .Sh NAME @@ -69,8 +69,10 @@ Minimum queuing delay threshold (qmin) in ticks. Default is 5. .El .Sh SEE ALSO +.Xr cc_cdg 4 , .Xr cc_chd 4 , .Xr cc_cubic 4 , +.Xr cc_dctcp 4 , .Xr cc_htcp 4 , .Xr cc_newreno 4 , .Xr cc_vegas 4 , diff --git a/share/man/man4/cc_htcp.4 b/share/man/man4/cc_htcp.4 index 0e141bb79a7d..46d94a12114a 100644 --- a/share/man/man4/cc_htcp.4 +++ b/share/man/man4/cc_htcp.4 @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 15, 2011 +.Dd May 13, 2021 .Dt CC_HTCP 4 .Os .Sh NAME @@ -69,8 +69,10 @@ window increase during congestion avoidance mode invariant with respect to RTT. Default is 0 (disabled). .El .Sh SEE ALSO +.Xr cc_cdg 4 , .Xr cc_chd 4 , .Xr cc_cubic 4 , +.Xr cc_dctcp 4 , .Xr cc_hd 4 , .Xr cc_newreno 4 , .Xr cc_vegas 4 , diff --git a/share/man/man4/cc_newreno.4 b/share/man/man4/cc_newreno.4 index 8169c04c3eaa..0ac59beeec48 100644 --- a/share/man/man4/cc_newreno.4 +++ b/share/man/man4/cc_newreno.4 @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 6, 2019 +.Dd May 13, 2021 .Dt CC_NEWRENO 4 .Os .Sh NAME @@ -96,8 +96,10 @@ per: cwnd = (cwnd * beta_ecn) / 100. Default is 80. .El .Sh SEE ALSO +.Xr cc_cdg 4 , .Xr cc_chd 4 , .Xr cc_cubic 4 , +.Xr cc_dctcp 4 , .Xr cc_hd 4 , .Xr cc_htcp 4 , .Xr cc_vegas 4 , diff --git a/share/man/man4/cc_vegas.4 b/share/man/man4/cc_vegas.4 index 45b4b6244017..ad043b218a4d 100644 --- a/share/man/man4/cc_vegas.4 +++ b/share/man/man4/cc_vegas.4 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 15, 2011 +.Dd May 13, 2021 .Dt CC_VEGAS 4 .Os .Sh NAME @@ -92,8 +92,10 @@ When setting beta, the value must satisfy: 0 < alpha < beta. Default is 3. .El .Sh SEE ALSO +.Xr cc_cdg 4 , .Xr cc_chd 4 , .Xr cc_cubic 4 , +.Xr cc_dctcp 4 , .Xr cc_hd 4 , .Xr cc_htcp 4 , .Xr cc_newreno 4 , diff --git a/share/man/man9/mod_cc.9 b/share/man/man9/mod_cc.9 index 7e9ab2488437..8be6fb2381bd 100644 --- a/share/man/man9/mod_cc.9 +++ b/share/man/man9/mod_cc.9 @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 21, 2016 +.Dd May 13, 2021 .Dt MOD_CC 9 .Os .Sh NAME @@ -309,6 +309,7 @@ a large difference between the congestion window and send window. .Xr cc_cdg 4 , .Xr cc_chd 4 , .Xr cc_cubic 4 , +.Xr cc_dctcp 4 , .Xr cc_hd 4 , .Xr cc_htcp 4 , .Xr cc_newreno 4 , From owner-dev-commits-src-main@freebsd.org Thu May 13 11:39:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AFA0463B964; Thu, 13 May 2021 11:39:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgqSW4cRzz4ly2; Thu, 13 May 2021 11:39:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 90E771DF24; Thu, 13 May 2021 11:39:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DBdNdg008351; Thu, 13 May 2021 11:39:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DBdNVj008350; Thu, 13 May 2021 11:39:23 GMT (envelope-from git) Date: Thu, 13 May 2021 11:39:23 GMT Message-Id: <202105131139.14DBdNVj008350@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: 02cffbc2507e - main - tcp: Incorrect KASSERT causes a panic in rack MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 02cffbc2507e83944b0c29d69d6ddf26c9386d54 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 11:39:23 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=02cffbc2507e83944b0c29d69d6ddf26c9386d54 commit 02cffbc2507e83944b0c29d69d6ddf26c9386d54 Author: Randall Stewart AuthorDate: 2021-05-13 11:36:04 +0000 Commit: Randall Stewart CommitDate: 2021-05-13 11:36:04 +0000 tcp: Incorrect KASSERT causes a panic in rack Skyzall found an interesting panic in rack. When a SYN and FIN are both sent together a KASSERT gets tripped where it is validating that a mbuf pointer is in the sendmap. But a SYN and FIN often will not have a mbuf pointer. So the fix is two fold a) make sure that the SYN and FIN split the right way when cloning an RSM SYN on left edge and FIN on right. And also make sure the KASSERT properly accounts for the case that we have a SYN or FIN so we don't panic. Reviewed by: mtuexen Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D30241 --- sys/netinet/tcp_stacks/rack.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 115f5f2ee44b..c4f3be02dd29 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -6054,6 +6054,12 @@ rack_clone_rsm(struct tcp_rack *rack, struct rack_sendmap *nrsm, for (idx = 0; idx < nrsm->r_rtr_cnt; idx++) { nrsm->r_tim_lastsent[idx] = rsm->r_tim_lastsent[idx]; } + /* Now if we have SYN flag we keep it on the left edge */ + if (nrsm->r_flags & RACK_HAS_SYN) + nrsm->r_flags &= ~RACK_HAS_SYN; + /* Now if we have a FIN flag we keep it on the right edge */ + if (nrsm->r_flags & RACK_HAS_FIN) + nrsm->r_flags &= ~RACK_HAS_FIN; /* * Now we need to find nrsm's new location in the mbuf chain * we basically calculate a new offset, which is soff + @@ -6061,9 +6067,11 @@ rack_clone_rsm(struct tcp_rack *rack, struct rack_sendmap *nrsm, * chain to find the righ postion, it may be the same mbuf * or maybe not. */ - KASSERT((rsm->m != NULL), + KASSERT(((rsm->m != NULL) || + (rsm->r_flags & (RACK_HAS_SYN|RACK_HAS_FIN))), ("rsm:%p nrsm:%p rack:%p -- rsm->m is NULL?", rsm, nrsm, rack)); - rack_setup_offset_for_rsm(rsm, nrsm); + if (rsm->m) + rack_setup_offset_for_rsm(rsm, nrsm); } static struct rack_sendmap * From owner-dev-commits-src-main@freebsd.org Thu May 13 12:00:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8211C63C9EC; Thu, 13 May 2021 12:00:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fgqwq3KD7z4nNk; Thu, 13 May 2021 12:00:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 651051E3E2; Thu, 13 May 2021 12:00:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DC0R04043823; Thu, 13 May 2021 12:00:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DC0R11043822; Thu, 13 May 2021 12:00:27 GMT (envelope-from git) Date: Thu, 13 May 2021 12:00:27 GMT Message-Id: <202105131200.14DC0R11043822@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Poul-Henning Kamp Subject: git: 7183d96e1ddb - main - Refactor argument processing. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: phk X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7183d96e1ddb71dae59b6272185cfef9a6e1112b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 12:00:27 -0000 The branch main has been updated by phk: URL: https://cgit.FreeBSD.org/src/commit/?id=7183d96e1ddb71dae59b6272185cfef9a6e1112b commit 7183d96e1ddb71dae59b6272185cfef9a6e1112b Author: Poul-Henning Kamp AuthorDate: 2021-05-13 09:52:36 +0000 Commit: Poul-Henning Kamp CommitDate: 2021-05-13 11:58:35 +0000 Refactor argument processing. --- usr.sbin/i2c/i2c.c | 116 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 66 insertions(+), 50 deletions(-) diff --git a/usr.sbin/i2c/i2c.c b/usr.sbin/i2c/i2c.c index 588aad8592ee..9bfa8c801a3e 100644 --- a/usr.sbin/i2c/i2c.c +++ b/usr.sbin/i2c/i2c.c @@ -54,11 +54,8 @@ struct options { const char *width; int count; int verbose; - int addr_set; int binary; - int scan; - int skip; - int reset; + char *skip; int mode; char dir; uint32_t addr; @@ -127,7 +124,7 @@ skip_get_tokens(char *skip_addr, int *sk_addr, int max_index) } static int -scan_bus(const char *dev, int fd, int skip, char *skip_addr) +scan_bus(const char *dev, int fd, char *skip) { struct iiccmd cmd; struct iic_msg rdmsg; @@ -137,11 +134,10 @@ scan_bus(const char *dev, int fd, int skip, char *skip_addr) int len = 0, do_skip = 0, no_range = 1, num_found = 0, use_read_xfer = 0; uint8_t rdbyte; - if (skip) { - assert(skip_addr != NULL); - len = strlen(skip_addr); - if (strstr(skip_addr, "..") != NULL) { - addr_range = skip_get_range(skip_addr); + if (skip != NULL) { + len = strlen(skip); + if (strstr(skip, "..") != NULL) { + addr_range = skip_get_range(skip); no_range = 0; } else { tokens = (int *)malloc((len / 2 + 1) * sizeof(int)); @@ -151,7 +147,7 @@ scan_bus(const char *dev, int fd, int skip, char *skip_addr) error = -1; goto out; } - idx = skip_get_tokens(skip_addr, tokens, + idx = skip_get_tokens(skip, tokens, len / 2 + 1); } @@ -173,11 +169,11 @@ start_over: for (i = 1; i < 127; i++) { - if (skip && ( addr_range.start < addr_range.end)) { + if (skip != NULL && ( addr_range.start < addr_range.end)) { if (i >= addr_range.start && i <= addr_range.end) continue; - } else if (skip && no_range) { + } else if (skip != NULL && no_range) { assert (tokens != NULL); for (j = 0; j < idx; j++) { if (tokens[j] == i) { @@ -240,7 +236,7 @@ start_over: error = ioctl(fd, I2CRSTCARD, &cmd); out: - if (skip && no_range) + if (skip != NULL && no_range) free(tokens); else assert(tokens == NULL); @@ -308,7 +304,7 @@ write_offset(int fd, struct options i2c_opt, struct iiccmd *cmd) if (i2c_opt.off_len > 0) { cmd->count = i2c_opt.off_len; - cmd->buf = i2c_opt.off_buf; + cmd->buf = (void*)i2c_opt.off_buf; error = ioctl(fd, I2CWRITE, cmd); if (error == -1) return ("ioctl: error writing offset\n"); @@ -623,39 +619,68 @@ int main(int argc, char** argv) { struct options i2c_opt; - char *skip_addr = NULL; const char *dev, *err_msg; - int fd, error, ch; - - errno = 0; + int fd, error = 0, ch; + const char *optflags = "a:f:d:o:w:c:m:n:sbvrh"; + char do_what = 0; dev = I2C_DEV; /* Default values */ - i2c_opt.addr_set = 0; i2c_opt.off = 0; i2c_opt.verbose = 0; i2c_opt.dir = 'r'; /* direction = read */ i2c_opt.width = "8"; i2c_opt.count = 1; i2c_opt.binary = 0; /* ASCII text output */ - i2c_opt.scan = 0; /* no bus scan */ - i2c_opt.skip = 0; /* scan all addresses */ - i2c_opt.reset = 0; /* no bus reset */ + i2c_opt.skip = NULL; /* scan all addresses */ i2c_opt.mode = I2C_MODE_NOTSET; + /* Find out what we are going to do */ + while ((ch = getopt(argc, argv, "a:f:d:o:w:c:m:n:sbvrh")) != -1) { + switch(ch) { + case 'a': + case 'r': + case 's': + if (do_what) + usage("Only one of [-a|-h|-r|-s]"); + do_what = ch; + break; + case 'h': + usage("Help:"); + break; + default: + break; + } + } + + /* Then handle the legal subset of arguments */ + + switch (do_what) { + case 0: usage("Pick one of [-a|-h|-r|-s]"); break; + case 'a': optflags = "a:f:d:w:o:c:m:bv"; break; + case 'r': optflags = "rf:v"; break; + case 's': optflags = "sf:n:v"; break; + default: assert("Bad do_what"); + } + + optreset = 1; + optind = 1; + + while ((ch = getopt(argc, argv, optflags)) != -1) { switch(ch) { case 'a': i2c_opt.addr = (strtoul(optarg, 0, 16) << 1); if (i2c_opt.addr == 0 && errno == EINVAL) usage("Bad -a argument (hex)"); - i2c_opt.addr_set = 1; break; case 'f': dev = optarg; break; case 'd': + if (strcmp(optarg, "r") && strcmp(optarg, "w")) + usage("Bad -d argument ([r|w])"); i2c_opt.dir = optarg[0]; break; case 'o': @@ -664,7 +689,7 @@ main(int argc, char** argv) usage("Bad -o argument (hex)"); break; case 'w': - i2c_opt.width = optarg; + i2c_opt.width = optarg; // checked later. break; case 'c': i2c_opt.count = (strtoul(optarg, 0, 10)); @@ -684,26 +709,19 @@ main(int argc, char** argv) usage("Bad -m argument ([no|ss|rs|tr])"); break; case 'n': - i2c_opt.skip = 1; - skip_addr = optarg; - break; - case 's': - i2c_opt.scan = 1; + i2c_opt.skip = optarg; break; + case 's': break; case 'b': i2c_opt.binary = 1; break; case 'v': i2c_opt.verbose = 1; break; - case 'r': - i2c_opt.reset = 1; - break; - case 'h': - usage("Help:"); - break; + case 'r': break; default: - usage("Bad argument"); + fprintf(stderr, "Illegal -%c option", ch); + usage(NULL); } } argc -= optind; @@ -726,15 +744,6 @@ main(int argc, char** argv) exit(EX_USAGE); } - /* Basic sanity check of command line arguments */ - if (i2c_opt.scan) { - if (i2c_opt.addr_set) - usage("-s and -a are incompatible"); - } else if (i2c_opt.reset) { - if (i2c_opt.addr_set) - usage("-r and -a are incompatible"); - } - if (i2c_opt.verbose) fprintf(stderr, "dev: %s, addr: 0x%x, r/w: %c, " "offset: 0x%02x, width: %s, count: %d\n", dev, @@ -748,12 +757,19 @@ main(int argc, char** argv) return (EX_NOINPUT); } - if (i2c_opt.scan) - error = scan_bus(dev, fd, i2c_opt.skip, skip_addr); - else if (i2c_opt.reset) + switch (do_what) { + case 's': + error = scan_bus(dev, fd, i2c_opt.skip); + break; + case 'r': error = reset_bus(dev, fd); - else + break; + case 'a': error = access_bus(fd, i2c_opt); + break; + default: + assert("Bad do_what"); + } ch = close(fd); assert(ch == 0); From owner-dev-commits-src-main@freebsd.org Thu May 13 12:00:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A5C4763CB50; Thu, 13 May 2021 12:00:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fgqwr4Jnmz4nQx; Thu, 13 May 2021 12:00:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8539D1E4D6; Thu, 13 May 2021 12:00:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DC0Spf043847; Thu, 13 May 2021 12:00:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DC0Sbq043845; Thu, 13 May 2021 12:00:28 GMT (envelope-from git) Date: Thu, 13 May 2021 12:00:28 GMT Message-Id: <202105131200.14DC0Sbq043845@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Poul-Henning Kamp Subject: git: 63c8d31e4f9b - main - Rewrite and simplify the -n argument processing. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: phk X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 63c8d31e4f9bb4800be3247c9962d48257dedc94 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 12:00:28 -0000 The branch main has been updated by phk: URL: https://cgit.FreeBSD.org/src/commit/?id=63c8d31e4f9bb4800be3247c9962d48257dedc94 commit 63c8d31e4f9bb4800be3247c9962d48257dedc94 Author: Poul-Henning Kamp AuthorDate: 2021-05-13 10:55:37 +0000 Commit: Poul-Henning Kamp CommitDate: 2021-05-13 11:58:35 +0000 Rewrite and simplify the -n argument processing. --- usr.sbin/i2c/i2c.8 | 18 ++-- usr.sbin/i2c/i2c.c | 246 ++++++++++++++++++++++------------------------------- 2 files changed, 107 insertions(+), 157 deletions(-) diff --git a/usr.sbin/i2c/i2c.8 b/usr.sbin/i2c/i2c.8 index 352b13157968..92cc62e983aa 100644 --- a/usr.sbin/i2c/i2c.8 +++ b/usr.sbin/i2c/i2c.8 @@ -96,10 +96,9 @@ 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 -using selected addresses 'a:b:c'. This option is available only when "-s" is -used. +address(es) to be skipped during bus scan. +One or more addresses ([0x]xx) or ranges of addresses +([0x]xx-[0x]xx or [0x]xx..[0x]xx) separated by commas or colons. .It Fl o Ar offset offset within the device for data transfer (hex). The default is zero. @@ -129,15 +128,10 @@ Scan the default bus (/dev/iic0) for devices: .Pp i2c -s .It -Scan the default bus (/dev/iic0) for devices and skip addresses 0x56 and -0x45. +Scan the default bus (/dev/iic0) for devices and skip addresses +0x45 to 0x47 (inclusive) and 0x56. .Pp -i2c -s -n 0x56:0x45 -.It -Scan the default bus (/dev/iic0) for devices and skip address range -0x34 to 0x56. -.Pp -i2c -s -n 0x34..0x56 +i2c -s -n 0x56,45-47 .It Read 8 bytes of data from device at address 0x56 (e.g., an EEPROM): .Pp diff --git a/usr.sbin/i2c/i2c.c b/usr.sbin/i2c/i2c.c index 9bfa8c801a3e..753ddbf712d3 100644 --- a/usr.sbin/i2c/i2c.c +++ b/usr.sbin/i2c/i2c.c @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -55,7 +56,7 @@ struct options { int count; int verbose; int binary; - char *skip; + const char *skip; int mode; char dir; uint32_t addr; @@ -64,11 +65,6 @@ struct options { size_t off_len; }; -struct skip_range { - int start; - int end; -}; - __dead2 static void usage(const char *msg) { @@ -84,169 +80,126 @@ usage(const char *msg) exit(EX_USAGE); } -static struct skip_range -skip_get_range(char *skip_addr) +static void +parse_skip(const char *skip, char blacklist[128]) { - struct skip_range addr_range; - char *token; - - addr_range.start = 0; - addr_range.end = 0; - - token = strsep(&skip_addr, ".."); - if (token) { - addr_range.start = strtoul(token, 0, 16); - token = strsep(&skip_addr, ".."); - if ((token != NULL) && !atoi(token)) { - token = strsep(&skip_addr, ".."); - if (token) - addr_range.end = strtoul(token, 0, 16); + const char *p; + unsigned x, y; + + for (p = skip; *p != '\0';) { + if (*p == '0' && p[1] == 'x') + p += 2; + if (!isxdigit(*p)) + usage("Bad -n argument, expected (first) hex-digit"); + x = digittoint(*p++) << 4; + if (!isxdigit(*p)) + usage("Bad -n argument, expected (second) hex-digit"); + x |= digittoint(*p++); + if (x == 0 || x > 0x7f) + usage("Bad -n argument, (01..7f)"); + if (*p == ':' || *p == ',' || *p == '\0') { + blacklist[x] = 1; + if (*p != '\0') + p++; + continue; } + if (*p == '-') { + p++; + } else if (*p == '.' && p[1] == '.') { + p += 2; + } else { + usage("Bad -n argument, ([:|,|..|-])"); + } + if (*p == '0' && p[1] == 'x') + p += 2; + if (!isxdigit(*p)) + usage("Bad -n argument, expected (first) hex-digit"); + y = digittoint(*p++) << 4; + if (!isxdigit(*p)) + usage("Bad -n argument, expected (second) hex-digit"); + y |= digittoint(*p++); + if (y == 0 || y > 0x7f) + usage("Bad -n argument, (01..7f)"); + if (y < x) + usage("Bad -n argument, (end < start)"); + for (;x <= y; x++) + blacklist[x] = 1; + if (*p == ':' || *p == ',') + p++; } - - return (addr_range); -} - -/* Parse the string to get hex 7 bits addresses */ -static int -skip_get_tokens(char *skip_addr, int *sk_addr, int max_index) -{ - char *token; - int i; - - for (i = 0; i < max_index; i++) { - token = strsep(&skip_addr, ":"); - if (token == NULL) - break; - sk_addr[i] = strtoul(token, 0, 16); - } - return (i); } static int -scan_bus(const char *dev, int fd, char *skip) +scan_bus(const char *dev, int fd, const char *skip) { struct iiccmd cmd; struct iic_msg rdmsg; struct iic_rdwr_data rdwrdata; - struct skip_range addr_range = { 0, 0 }; - int *tokens = NULL, error, i, idx = 0, j; - int len = 0, do_skip = 0, no_range = 1, num_found = 0, use_read_xfer = 0; + int error; + unsigned u; + int num_found = 0, use_read_xfer; uint8_t rdbyte; + char blacklist[128]; - if (skip != NULL) { - len = strlen(skip); - if (strstr(skip, "..") != NULL) { - addr_range = skip_get_range(skip); - no_range = 0; - } else { - tokens = (int *)malloc((len / 2 + 1) * sizeof(int)); - if (tokens == NULL) { - fprintf(stderr, "Error allocating tokens " - "buffer\n"); - error = -1; - goto out; - } - idx = skip_get_tokens(skip, tokens, - len / 2 + 1); - } + memset(blacklist, 0, sizeof blacklist); - if (!no_range && (addr_range.start > addr_range.end)) { - fprintf(stderr, "Skip address out of range\n"); - error = -1; - goto out; - } - } + if (skip != NULL) + parse_skip(skip, blacklist); - printf("Scanning I2C devices on %s: ", dev); + printf("Scanning I2C devices on %s:", dev); -start_over: - if (use_read_xfer) { - fprintf(stderr, - "Hardware may not support START/STOP scanning; " - "trying less-reliable read method.\n"); - } - - for (i = 1; i < 127; i++) { - - if (skip != NULL && ( addr_range.start < addr_range.end)) { - if (i >= addr_range.start && i <= addr_range.end) + for (use_read_xfer = 0; use_read_xfer < 2; use_read_xfer++) { + for (u = 1; u < 127; u++) { + if (blacklist[u]) continue; - } else if (skip != NULL && no_range) { - assert (tokens != NULL); - for (j = 0; j < idx; j++) { - if (tokens[j] == i) { - do_skip = 1; - break; - } - } - } - - if (do_skip) { - do_skip = 0; - continue; - } - - cmd.slave = i << 1; - cmd.last = 1; - cmd.count = 0; - error = ioctl(fd, I2CRSTCARD, &cmd); - if (error) { - fprintf(stderr, "Controller reset failed\n"); - goto out; - } - if (use_read_xfer) { - rdmsg.buf = &rdbyte; - rdmsg.len = 1; - rdmsg.flags = IIC_M_RD; - rdmsg.slave = i << 1; - rdwrdata.msgs = &rdmsg; - rdwrdata.nmsgs = 1; - error = ioctl(fd, I2CRDWR, &rdwrdata); - } else { - cmd.slave = i << 1; + cmd.slave = u << 1; cmd.last = 1; - error = ioctl(fd, I2CSTART, &cmd); - if (errno == ENODEV || errno == EOPNOTSUPP) { - /* If START not supported try reading. */ - use_read_xfer = 1; - goto start_over; + cmd.count = 0; + error = ioctl(fd, I2CRSTCARD, &cmd); + if (error) { + fprintf(stderr, "Controller reset failed\n"); + fprintf(stderr, + "Error scanning I2C controller (%s): %s\n", + dev, strerror(errno)); + return (EX_NOINPUT); + } + if (use_read_xfer) { + rdmsg.buf = &rdbyte; + rdmsg.len = 1; + rdmsg.flags = IIC_M_RD; + rdmsg.slave = u << 1; + rdwrdata.msgs = &rdmsg; + rdwrdata.nmsgs = 1; + error = ioctl(fd, I2CRDWR, &rdwrdata); + } else { + cmd.slave = u << 1; + cmd.last = 1; + error = ioctl(fd, I2CSTART, &cmd); + if (errno == ENODEV || errno == EOPNOTSUPP) + break; /* Try reads instead */ + (void)ioctl(fd, I2CSTOP); + } + if (error == 0) { + ++num_found; + printf(" %02x", u); } - (void)ioctl(fd, I2CSTOP); - } - if (error == 0) { - ++num_found; - printf("%02x ", i); } + if (num_found > 0) + break; + fprintf(stderr, + "Hardware may not support START/STOP scanning; " + "trying less-reliable read method.\n"); } - - /* - * If we found nothing, maybe START is not supported and returns a - * generic error code such as EIO or ENXIO, so try again using reads. - */ - if (num_found == 0) { - if (!use_read_xfer) { - use_read_xfer = 1; - goto start_over; - } + if (num_found == 0) printf(""); - } + printf("\n"); error = ioctl(fd, I2CRSTCARD, &cmd); -out: - if (skip != NULL && no_range) - free(tokens); - else - assert(tokens == NULL); - - if (error) { - fprintf(stderr, "Error scanning I2C controller (%s): %s\n", - dev, strerror(errno)); - return (EX_NOINPUT); - } else - return (EX_OK); + if (error) + fprintf(stderr, "Controller reset failed\n"); + return (EX_OK); } static int @@ -671,9 +624,12 @@ main(int argc, char** argv) while ((ch = getopt(argc, argv, optflags)) != -1) { switch(ch) { case 'a': - i2c_opt.addr = (strtoul(optarg, 0, 16) << 1); + i2c_opt.addr = strtoul(optarg, 0, 16); if (i2c_opt.addr == 0 && errno == EINVAL) usage("Bad -a argument (hex)"); + if (i2c_opt.addr == 0 || i2c_opt.addr > 0x7f) + usage("Bad -a argument (01..7f)"); + i2c_opt.addr <<= 1; break; case 'f': dev = optarg; From owner-dev-commits-src-main@freebsd.org Thu May 13 12:00:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E4F9563CC16; Thu, 13 May 2021 12:00:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fgqws5bL2z4nNs; Thu, 13 May 2021 12:00:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A54591E4D7; Thu, 13 May 2021 12:00:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DC0Tid043872; Thu, 13 May 2021 12:00:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DC0TYa043871; Thu, 13 May 2021 12:00:29 GMT (envelope-from git) Date: Thu, 13 May 2021 12:00:29 GMT Message-Id: <202105131200.14DC0TYa043871@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Poul-Henning Kamp Subject: git: b23362afa995 - main - Final pass of cleanup: Get rid of gotos and general polish. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: phk X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b23362afa9956a22225dc4edd5dd4d5883e39de8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 12:00:30 -0000 The branch main has been updated by phk: URL: https://cgit.FreeBSD.org/src/commit/?id=b23362afa9956a22225dc4edd5dd4d5883e39de8 commit b23362afa9956a22225dc4edd5dd4d5883e39de8 Author: Poul-Henning Kamp AuthorDate: 2021-05-13 11:58:50 +0000 Commit: Poul-Henning Kamp CommitDate: 2021-05-13 11:58:50 +0000 Final pass of cleanup: Get rid of gotos and general polish. NB: This changes the outputs, in particular in error conditions, in various subtle ways to be more systematic and usable. --- usr.sbin/i2c/i2c.c | 361 ++++++++++++++++++++++++----------------------------- 1 file changed, 162 insertions(+), 199 deletions(-) diff --git a/usr.sbin/i2c/i2c.c b/usr.sbin/i2c/i2c.c index 753ddbf712d3..ef0ca0e8fda5 100644 --- a/usr.sbin/i2c/i2c.c +++ b/usr.sbin/i2c/i2c.c @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); struct options { const char *width; - int count; + unsigned count; int verbose; int binary; const char *skip; @@ -80,6 +80,80 @@ usage(const char *msg) exit(EX_USAGE); } +static int +i2c_do_stop(int fd) +{ + int i; + + i = ioctl(fd, I2CSTOP); + if (i < 0) + fprintf(stderr, "ioctl: error sending stop condition: %s\n", + strerror(errno)); + return (i); +} + +static int +i2c_do_start(int fd, struct iiccmd *cmd) +{ + int i; + + i = ioctl(fd, I2CSTART, cmd); + if (i < 0) + fprintf(stderr, "ioctl: error sending start condition: %s\n", + strerror(errno)); + return (i); +} + +static int +i2c_do_repeatstart(int fd, struct iiccmd *cmd) +{ + int i; + + i = ioctl(fd, I2CRPTSTART, cmd); + if (i < 0) + fprintf(stderr, "ioctl: error sending repeated start: %s\n", + strerror(errno)); + return (i); +} + +static int +i2c_do_write(int fd, struct iiccmd *cmd) +{ + int i; + + i = ioctl(fd, I2CWRITE, cmd); + if (i < 0) + fprintf(stderr, "ioctl: error writing: %s\n", + strerror(errno)); + return (i); +} + +static int +i2c_do_read(int fd, struct iiccmd *cmd) +{ + int i; + + i = ioctl(fd, I2CREAD, cmd); + if (i < 0) + fprintf(stderr, "ioctl: error reading: %s\n", + strerror(errno)); + return (i); +} + +static int +i2c_do_reset(int fd) +{ + struct iiccmd cmd; + int i; + + memset(&cmd, 0, sizeof cmd); + i = ioctl(fd, I2CRSTCARD, &cmd); + if (i < 0) + fprintf(stderr, "ioctl: error resetting controller: %s\n", + strerror(errno)); + return (i); +} + static void parse_skip(const char *skip, char blacklist[128]) { @@ -130,7 +204,7 @@ parse_skip(const char *skip, char blacklist[128]) } static int -scan_bus(const char *dev, int fd, const char *skip) +scan_bus(const char *dev, int fd, const char *skip, int verbose) { struct iiccmd cmd; struct iic_msg rdmsg; @@ -140,14 +214,13 @@ scan_bus(const char *dev, int fd, const char *skip) int num_found = 0, use_read_xfer; uint8_t rdbyte; char blacklist[128]; + const char *sep = ""; memset(blacklist, 0, sizeof blacklist); if (skip != NULL) parse_skip(skip, blacklist); - printf("Scanning I2C devices on %s:", dev); - for (use_read_xfer = 0; use_read_xfer < 2; use_read_xfer++) { for (u = 1; u < 127; u++) { if (blacklist[u]) @@ -156,14 +229,9 @@ scan_bus(const char *dev, int fd, const char *skip) cmd.slave = u << 1; cmd.last = 1; cmd.count = 0; - error = ioctl(fd, I2CRSTCARD, &cmd); - if (error) { - fprintf(stderr, "Controller reset failed\n"); - fprintf(stderr, - "Error scanning I2C controller (%s): %s\n", - dev, strerror(errno)); + if (i2c_do_reset(fd)) return (EX_NOINPUT); - } + if (use_read_xfer) { rdmsg.buf = &rdbyte; rdmsg.len = 1; @@ -173,51 +241,43 @@ scan_bus(const char *dev, int fd, const char *skip) rdwrdata.nmsgs = 1; error = ioctl(fd, I2CRDWR, &rdwrdata); } else { - cmd.slave = u << 1; - cmd.last = 1; error = ioctl(fd, I2CSTART, &cmd); if (errno == ENODEV || errno == EOPNOTSUPP) break; /* Try reads instead */ (void)ioctl(fd, I2CSTOP); } if (error == 0) { - ++num_found; - printf(" %02x", u); + if (!num_found++ && verbose) { + fprintf(stderr, + "Scanning I2C devices on %s:\n", + dev); + } + printf("%s%02x", sep, u); + sep = " "; } } if (num_found > 0) break; - fprintf(stderr, - "Hardware may not support START/STOP scanning; " - "trying less-reliable read method.\n"); + if (verbose && !use_read_xfer) + fprintf(stderr, + "Hardware may not support START/STOP scanning; " + "trying less-reliable read method.\n"); } - if (num_found == 0) - printf(""); + if (num_found == 0 && verbose) + printf(""); printf("\n"); - error = ioctl(fd, I2CRSTCARD, &cmd); - if (error) - fprintf(stderr, "Controller reset failed\n"); - return (EX_OK); + return (i2c_do_reset(fd)); } static int -reset_bus(const char *dev, int fd) +reset_bus(const char *dev, int fd, int verbose) { - struct iiccmd cmd; - int error; - - printf("Resetting I2C controller on %s: ", dev); - error = ioctl(fd, I2CRSTCARD, &cmd); - if (error) { - printf("error: %s\n", strerror(errno)); - return (EX_IOERR); - } else { - printf("OK\n"); - return (EX_OK); - } + if (verbose) + fprintf(stderr, "Resetting I2C controller on %s\n", dev); + return (i2c_do_reset(fd)); } static const char * @@ -250,214 +310,127 @@ encode_offset(const char *width, unsigned address, uint8_t *dst, size_t *len) return ("Invalid offset width, must be: 0|8|16|16LE|16BE\n"); } -static const char * +static int write_offset(int fd, struct options i2c_opt, struct iiccmd *cmd) { - int error; if (i2c_opt.off_len > 0) { cmd->count = i2c_opt.off_len; cmd->buf = (void*)i2c_opt.off_buf; - error = ioctl(fd, I2CWRITE, cmd); - if (error == -1) - return ("ioctl: error writing offset\n"); + return (i2c_do_write(fd, cmd)); } - return (NULL); + return (0); } static int -i2c_write(int fd, struct options i2c_opt, char *i2c_buf) +i2c_write(int fd, struct options i2c_opt, uint8_t *i2c_buf) { struct iiccmd cmd; - int error; - char *buf; - const char *err_msg; + char buf[i2c_opt.off_len + i2c_opt.count]; + memset(&cmd, 0, sizeof(cmd)); cmd.slave = i2c_opt.addr; - error = ioctl(fd, I2CSTART, &cmd); - if (error == -1) { - err_msg = "ioctl: error sending start condition"; - goto err1; - } + + if (i2c_do_start(fd, &cmd)) + return (i2c_do_stop(fd) | 1); switch(i2c_opt.mode) { case I2C_MODE_STOP_START: - err_msg = write_offset(fd, i2c_opt, &cmd); - if (err_msg != NULL) - goto err1; - - error = ioctl(fd, I2CSTOP); - if (error == -1) { - err_msg = "ioctl: error sending stop condition"; - goto err2; - } - cmd.slave = i2c_opt.addr; - error = ioctl(fd, I2CSTART, &cmd); - if (error == -1) { - err_msg = "ioctl: error sending start condition"; - goto err1; - } + if (write_offset(fd, i2c_opt, &cmd)) + return (i2c_do_stop(fd) | 1); + + if (i2c_do_stop(fd)) + return (1); + + if (i2c_do_start(fd, &cmd)) + return (i2c_do_stop(fd) | 1); /* * Write the data */ cmd.count = i2c_opt.count; - cmd.buf = i2c_buf; + cmd.buf = (void*)i2c_buf; cmd.last = 0; - error = ioctl(fd, I2CWRITE, &cmd); - if (error == -1) { - err_msg = "ioctl: error writing"; - goto err1; - } + if (i2c_do_write(fd, &cmd)) + return (i2c_do_stop(fd) | 1); break; case I2C_MODE_REPEATED_START: - err_msg = write_offset(fd, i2c_opt, &cmd); - if (err_msg != NULL) - goto err1; - - cmd.slave = i2c_opt.addr; - error = ioctl(fd, I2CRPTSTART, &cmd); - if (error == -1) { - err_msg = "ioctl: error sending repeated start " - "condition"; - goto err1; - } + if (write_offset(fd, i2c_opt, &cmd)) + return (i2c_do_stop(fd) | 1); + + if (i2c_do_repeatstart(fd, &cmd)) + return (i2c_do_stop(fd) | 1); /* * Write the data */ cmd.count = i2c_opt.count; - cmd.buf = i2c_buf; + cmd.buf = (void*)i2c_buf; cmd.last = 0; - error = ioctl(fd, I2CWRITE, &cmd); - if (error == -1) { - err_msg = "ioctl: error writing"; - goto err1; - } + if (i2c_do_write(fd, &cmd)) + return (i2c_do_stop(fd) | 1); break; case I2C_MODE_NONE: /* fall through */ default: - buf = malloc(i2c_opt.off_len + i2c_opt.count); - if (buf == NULL) { - err_msg = "error: data malloc"; - goto err1; - } memcpy(buf, i2c_opt.off_buf, i2c_opt.off_len); - memcpy(buf + i2c_opt.off_len, i2c_buf, i2c_opt.count); /* * Write offset and data */ cmd.count = i2c_opt.off_len + i2c_opt.count; - cmd.buf = buf; + cmd.buf = (void*)buf; cmd.last = 0; - error = ioctl(fd, I2CWRITE, &cmd); - free(buf); - if (error == -1) { - err_msg = "ioctl: error writing"; - goto err1; - } + if (i2c_do_write(fd, &cmd)) + return (i2c_do_stop(fd) | 1); break; } - error = ioctl(fd, I2CSTOP); - if (error == -1) { - err_msg = "ioctl: error sending stop condition"; - goto err2; - } - - return (0); - -err1: - error = ioctl(fd, I2CSTOP); - if (error == -1) - fprintf(stderr, "error sending stop condition\n"); -err2: - if (err_msg) - fprintf(stderr, "%s\n", err_msg); - return (1); + return (i2c_do_stop(fd)); } static int -i2c_read(int fd, struct options i2c_opt, char *i2c_buf) +i2c_read(int fd, struct options i2c_opt, uint8_t *i2c_buf) { struct iiccmd cmd; - int error; char data = 0; - const char *err_msg; - bzero(&cmd, sizeof(cmd)); + memset(&cmd, 0, sizeof(cmd)); + cmd.slave = i2c_opt.addr; if (i2c_opt.off_len) { - cmd.slave = i2c_opt.addr; cmd.count = 1; cmd.last = 0; cmd.buf = &data; - error = ioctl(fd, I2CSTART, &cmd); - if (error == -1) { - err_msg = "ioctl: error sending start condition"; - goto err1; - } + if (i2c_do_start(fd, &cmd)) + return (i2c_do_stop(fd) | 1); - err_msg = write_offset(fd, i2c_opt, &cmd); - if (err_msg != NULL) - goto err1; + if (write_offset(fd, i2c_opt, &cmd)) + return (i2c_do_stop(fd) | 1); - if (i2c_opt.mode == I2C_MODE_STOP_START) { - error = ioctl(fd, I2CSTOP); - if (error == -1) { - err_msg = "error sending stop condition"; - goto err2; - } - } + if (i2c_opt.mode == I2C_MODE_STOP_START && i2c_do_stop(fd)) + return (1); } cmd.slave = i2c_opt.addr | 1; cmd.count = 1; cmd.last = 0; cmd.buf = &data; if (i2c_opt.mode == I2C_MODE_STOP_START || i2c_opt.off_len == 0) { - error = ioctl(fd, I2CSTART, &cmd); - if (error == -1) { - err_msg = "ioctl: error sending start condition"; - goto err2; - } + if (i2c_do_start(fd, &cmd)) + return (i2c_do_stop(fd) | 1); } else if (i2c_opt.mode == I2C_MODE_REPEATED_START) { - error = ioctl(fd, I2CRPTSTART, &cmd); - if (error == -1) { - err_msg = "ioctl: error sending repeated start " - "condition"; - goto err1; - } + if (i2c_do_repeatstart(fd, &cmd)) + return (i2c_do_stop(fd) | 1); } cmd.count = i2c_opt.count; - cmd.buf = i2c_buf; + cmd.buf = (void*)i2c_buf; cmd.last = 1; - error = ioctl(fd, I2CREAD, &cmd); - if (error == -1) { - err_msg = "ioctl: error while reading"; - goto err1; - } + if (i2c_do_read(fd, &cmd)) + return (i2c_do_stop(fd) | 1); - error = ioctl(fd, I2CSTOP); - if (error == -1) { - err_msg = "error sending stop condtion\n"; - goto err2; - } - - return (0); - -err1: - error = ioctl(fd, I2CSTOP); - if (error == -1) - fprintf(stderr, "error sending stop condition\n"); -err2: - if (err_msg) - fprintf(stderr, "%s\n", err_msg); - - return (1); + return (i2c_do_stop(fd)); } /* @@ -472,7 +445,7 @@ err2: * driver to be handled as a single transfer. */ static int -i2c_rdwr_transfer(int fd, struct options i2c_opt, char *i2c_buf) +i2c_rdwr_transfer(int fd, struct options i2c_opt, uint8_t *i2c_buf) { struct iic_msg msgs[2], *msgp = msgs; struct iic_rdwr_data xfer; @@ -515,28 +488,19 @@ i2c_rdwr_transfer(int fd, struct options i2c_opt, char *i2c_buf) static int access_bus(int fd, struct options i2c_opt) { - char *i2c_buf; - int error, chunk_size = 16, i, ch; - - i2c_buf = malloc(i2c_opt.count); - if (i2c_buf == NULL) - err(1, "data malloc"); + uint8_t i2c_buf[i2c_opt.count]; + int error; + unsigned u, chunk_size = 16; /* * For a write, read the data to be written to the chip from stdin. */ if (i2c_opt.dir == 'w') { if (i2c_opt.verbose && !i2c_opt.binary) - fprintf(stderr, "Enter %d bytes of data: ", + 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 (fread(i2c_buf, 1, i2c_opt.count, stdin) != i2c_opt.count) + err(1, "not enough data, exiting\n"); } if (i2c_opt.mode == I2C_MODE_TRANSFER) @@ -554,17 +518,16 @@ access_bus(int fd, struct options i2c_opt) fprintf(stderr, "\nData %s (hex):\n", i2c_opt.dir == 'r' ? "read" : "written"); - for (i = 0; i < i2c_opt.count; i++) { - fprintf (stderr, "%02hhx ", i2c_buf[i]); - if ((i % chunk_size) == chunk_size - 1) - fprintf(stderr, "\n"); + for (u = 0; u < i2c_opt.count; u++) { + printf("%02hhx ", i2c_buf[u]); + if ((u % chunk_size) == chunk_size - 1) + printf("\n"); } - if ((i % chunk_size) != 0) - fprintf(stderr, "\n"); + if ((u % chunk_size) != 0) + printf("\n"); } } - free(i2c_buf); return (error); } @@ -702,7 +665,7 @@ main(int argc, char** argv) if (i2c_opt.verbose) fprintf(stderr, "dev: %s, addr: 0x%x, r/w: %c, " - "offset: 0x%02x, width: %s, count: %d\n", dev, + "offset: 0x%02x, width: %s, count: %u\n", dev, i2c_opt.addr >> 1, i2c_opt.dir, i2c_opt.off, i2c_opt.width, i2c_opt.count); @@ -715,10 +678,10 @@ main(int argc, char** argv) switch (do_what) { case 's': - error = scan_bus(dev, fd, i2c_opt.skip); + error = scan_bus(dev, fd, i2c_opt.skip, i2c_opt.verbose); break; case 'r': - error = reset_bus(dev, fd); + error = reset_bus(dev, fd, i2c_opt.verbose); break; case 'a': error = access_bus(fd, i2c_opt); From owner-dev-commits-src-main@freebsd.org Thu May 13 12:34:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE6F063EB6C; Thu, 13 May 2021 12:34:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fgrh746Sfz4qwM; Thu, 13 May 2021 12:34:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 800E91ED22; Thu, 13 May 2021 12:34:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DCYVVG087936; Thu, 13 May 2021 12:34:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DCYVVG087935; Thu, 13 May 2021 12:34:31 GMT (envelope-from git) Date: Thu, 13 May 2021 12:34:31 GMT Message-Id: <202105131234.14DCYVVG087935@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 9246b3090cbc - main - fork: Suspend other threads if both RFPROC and RFMEM are not set MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9246b3090cbc82c54350391601b9acef2aa9a625 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 12:34:31 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9246b3090cbc82c54350391601b9acef2aa9a625 commit 9246b3090cbc82c54350391601b9acef2aa9a625 Author: Mark Johnston AuthorDate: 2021-05-13 12:33:23 +0000 Commit: Mark Johnston CommitDate: 2021-05-13 12:33:23 +0000 fork: Suspend other threads if both RFPROC and RFMEM are not set Otherwise, a multithreaded parent process may trigger races in vm_forkproc() if one thread calls rfork() with RFMEM set and another calls rfork() without RFMEM. Also simplify vm_forkproc() a bit, vmspace_unshare() already checks to see if the address space is shared. Reported by: syzbot+0aa7c2bec74c4066c36f@syzkaller.appspotmail.com Reported by: syzbot+ea84cb06937afeae609d@syzkaller.appspotmail.com Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30220 --- sys/kern/kern_fork.c | 13 +++++++++---- sys/vm/vm_glue.c | 8 +++----- sys/vm/vm_map.c | 4 ++++ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 2a092b192878..0d0659b432fe 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -313,8 +313,13 @@ fork_norfproc(struct thread *td, int flags) ("fork_norfproc called with RFPROC set")); p1 = td->td_proc; - if (((p1->p_flag & (P_HADTHREADS|P_SYSTEM)) == P_HADTHREADS) && - (flags & (RFCFDG | RFFDG))) { + /* + * Quiesce other threads if necessary. If RFMEM is not specified we + * must ensure that other threads do not concurrently create a second + * process sharing the vmspace, see vmspace_unshare(). + */ + if ((p1->p_flag & (P_HADTHREADS | P_SYSTEM)) == P_HADTHREADS && + ((flags & (RFCFDG | RFFDG)) != 0 || (flags & RFMEM) == 0)) { PROC_LOCK(p1); if (thread_single(p1, SINGLE_BOUNDARY)) { PROC_UNLOCK(p1); @@ -350,8 +355,8 @@ fork_norfproc(struct thread *td, int flags) } fail: - if (((p1->p_flag & (P_HADTHREADS|P_SYSTEM)) == P_HADTHREADS) && - (flags & (RFCFDG | RFFDG))) { + if ((p1->p_flag & (P_HADTHREADS | P_SYSTEM)) == P_HADTHREADS && + ((flags & (RFCFDG | RFFDG)) != 0 || (flags & RFMEM) == 0)) { PROC_LOCK(p1); thread_single_end(p1, SINGLE_BOUNDARY); PROC_UNLOCK(p1); diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index 6facf744456c..7cfb08246f9e 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -553,11 +553,9 @@ vm_forkproc(struct thread *td, struct proc *p2, struct thread *td2, * COW locally. */ if ((flags & RFMEM) == 0) { - if (refcount_load(&p1->p_vmspace->vm_refcnt) > 1) { - error = vmspace_unshare(p1); - if (error) - return (error); - } + error = vmspace_unshare(p1); + if (error) + return (error); } cpu_fork(td, p2, td2, flags); return (0); diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index d870fe3507fd..1ac4ccf72f11 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -4867,6 +4867,10 @@ vmspace_unshare(struct proc *p) struct vmspace *newvmspace; vm_ooffset_t fork_charge; + /* + * The caller is responsible for ensuring that the reference count + * cannot concurrently transition 1 -> 2. + */ if (refcount_load(&oldvmspace->vm_refcnt) == 1) return (0); fork_charge = 0; From owner-dev-commits-src-main@freebsd.org Thu May 13 12:34:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E5D4963EE30; Thu, 13 May 2021 12:34:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fgrh86095z4rCZ; Thu, 13 May 2021 12:34:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ABF0B1ECB5; Thu, 13 May 2021 12:34:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DCYWgM087958; Thu, 13 May 2021 12:34:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DCYWxu087957; Thu, 13 May 2021 12:34:32 GMT (envelope-from git) Date: Thu, 13 May 2021 12:34:32 GMT Message-Id: <202105131234.14DCYWxu087957@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 8b3c4231abf0 - main - posix timers: Check for overflow when converting to ns MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8b3c4231abf0ef6ac79655e463d0ef98ad84cd51 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 12:34:33 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8b3c4231abf0ef6ac79655e463d0ef98ad84cd51 commit 8b3c4231abf0ef6ac79655e463d0ef98ad84cd51 Author: Mark Johnston AuthorDate: 2021-05-13 12:33:37 +0000 Commit: Mark Johnston CommitDate: 2021-05-13 12:34:03 +0000 posix timers: Check for overflow when converting to ns Disallow a time or timer period value when the conversion to nanoseconds would overflow. Otherwise it is possible to trigger a divison by zero in realtime_expire_l(), where we compute the number of overruns by dividing by the timer interval. Fixes: 7995dae9 ("posix timers: Improve the overrun calculation") Reported by: syzbot+5ab360bd3d3e3c5a6e0e@syzkaller.appspotmail.com Reported by: syzbot+157b74ff493140d86eac@syzkaller.appspotmail.com Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30233 --- sys/kern/kern_time.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index ab22ac4a1697..323ef9a1f7a0 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -72,6 +72,8 @@ __FBSDID("$FreeBSD$"); #define MAKE_PROCESS_CPUCLOCK(pid) \ (CPUCLOCK_BIT|CPUCLOCK_PROCESS_BIT|(pid)) +#define NS_PER_SEC 1000000000 + static struct kclock posix_clocks[MAX_CLOCKS]; static uma_zone_t itimer_zone = NULL; @@ -408,8 +410,7 @@ kern_clock_settime(struct thread *td, clockid_t clock_id, struct timespec *ats) return (error); if (clock_id != CLOCK_REALTIME) return (EINVAL); - if (ats->tv_nsec < 0 || ats->tv_nsec >= 1000000000 || - ats->tv_sec < 0) + if (ats->tv_nsec < 0 || ats->tv_nsec >= NS_PER_SEC || ats->tv_sec < 0) return (EINVAL); if (!allow_insane_settime && (ats->tv_sec > 8000ULL * 365 * 24 * 60 * 60 || @@ -462,12 +463,12 @@ kern_clock_getres(struct thread *td, clockid_t clock_id, struct timespec *ts) * Rounding up is especially important if rounding down * would give 0. Perfect rounding is unimportant. */ - ts->tv_nsec = 1000000000 / tc_getfrequency() + 1; + ts->tv_nsec = NS_PER_SEC / tc_getfrequency() + 1; break; case CLOCK_VIRTUAL: case CLOCK_PROF: /* Accurately round up here because we can do so cheaply. */ - ts->tv_nsec = howmany(1000000000, hz); + ts->tv_nsec = howmany(NS_PER_SEC, hz); break; case CLOCK_SECOND: ts->tv_sec = 1; @@ -509,7 +510,7 @@ kern_clock_nanosleep(struct thread *td, clockid_t clock_id, int flags, int error; bool is_abs_real; - if (rqt->tv_nsec < 0 || rqt->tv_nsec >= 1000000000) + if (rqt->tv_nsec < 0 || rqt->tv_nsec >= NS_PER_SEC) return (EINVAL); if ((flags & ~TIMER_ABSTIME) != 0) return (EINVAL); @@ -1650,7 +1651,9 @@ static int itimespecfix(struct timespec *ts) { - if (ts->tv_sec < 0 || ts->tv_nsec < 0 || ts->tv_nsec >= 1000000000) + if (ts->tv_sec < 0 || ts->tv_nsec < 0 || ts->tv_nsec >= NS_PER_SEC) + return (EINVAL); + if ((UINT64_MAX - ts->tv_nsec) / NS_PER_SEC < ts->tv_sec) return (EINVAL); if (ts->tv_sec == 0 && ts->tv_nsec != 0 && ts->tv_nsec < tick * 1000) ts->tv_nsec = tick * 1000; @@ -1658,10 +1661,10 @@ itimespecfix(struct timespec *ts) } #define timespectons(tsp) \ - ((uint64_t)(tsp)->tv_sec * 1000000000 + (tsp)->tv_nsec) + ((uint64_t)(tsp)->tv_sec * NS_PER_SEC + (tsp)->tv_nsec) #define timespecfromns(ns) (struct timespec){ \ - .tv_sec = (ns) / 1000000000, \ - .tv_nsec = (ns) % 1000000000 \ + .tv_sec = (ns) / NS_PER_SEC, \ + .tv_nsec = (ns) % NS_PER_SEC \ } static void From owner-dev-commits-src-main@freebsd.org Thu May 13 13:35:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C0721641126; Thu, 13 May 2021 13:35:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fgt2F55hxz4v2C; Thu, 13 May 2021 13:35:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A19FA1FBAF; Thu, 13 May 2021 13:35:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DDZHuS067348; Thu, 13 May 2021 13:35:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DDZHu2067347; Thu, 13 May 2021 13:35:17 GMT (envelope-from git) Date: Thu, 13 May 2021 13:35:17 GMT Message-Id: <202105131335.14DDZHu2067347@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: fa43162c6379 - main - sort: Stop "fixing" obsolete key syntax after -- flag MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fa43162c63790806d0effba5ac98a1a3c6b835e1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 13:35:17 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fa43162c63790806d0effba5ac98a1a3c6b835e1 commit fa43162c63790806d0effba5ac98a1a3c6b835e1 Author: Cyril Zhang AuthorDate: 2021-05-13 12:52:51 +0000 Commit: Mark Johnston CommitDate: 2021-05-13 13:33:19 +0000 sort: Stop "fixing" obsolete key syntax after -- flag PR: 255798 Reviewed by: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30234 --- usr.bin/sort/sort.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c index fee6f72449e2..d5c18552d914 100644 --- a/usr.bin/sort/sort.c +++ b/usr.bin/sort/sort.c @@ -858,6 +858,11 @@ fix_obsolete_keys(int *argc, char **argv) arg1 = argv[i]; + if (strcmp(arg1, "--") == 0) { + /* Following arguments are treated as filenames. */ + break; + } + if (strlen(arg1) > 1 && arg1[0] == '+') { int c1, f1; char sopts1[128]; From owner-dev-commits-src-main@freebsd.org Thu May 13 13:35:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F1A6464118C; Thu, 13 May 2021 13:35:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fgt2G6MWXz4v88; Thu, 13 May 2021 13:35:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C7A921FBB0; Thu, 13 May 2021 13:35:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DDZINZ067369; Thu, 13 May 2021 13:35:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DDZIu1067368; Thu, 13 May 2021 13:35:18 GMT (envelope-from git) Date: Thu, 13 May 2021 13:35:18 GMT Message-Id: <202105131335.14DDZIu1067368@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 71ec05a21257 - main - sort: Cache value of MB_CUR_MAX MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 71ec05a21257e159f40d54e26ad0011bb19b5134 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 13:35:19 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=71ec05a21257e159f40d54e26ad0011bb19b5134 commit 71ec05a21257e159f40d54e26ad0011bb19b5134 Author: Cyril Zhang AuthorDate: 2021-05-13 12:55:06 +0000 Commit: Mark Johnston CommitDate: 2021-05-13 13:33:19 +0000 sort: Cache value of MB_CUR_MAX Every usage of MB_CUR_MAX results in a call to __mb_cur_max. This is inefficient and redundant. Caching the value of MB_CUR_MAX in a global variable removes these calls and speeds up the runtime of sort. For numeric sorting, runtime is almost halved in some tests. PR: 255551 PR: 255840 Reviewed by: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30170 --- usr.bin/sort/bwstring.c | 54 ++++++++++++++++++++++++------------------------ usr.bin/sort/bwstring.h | 9 ++++---- usr.bin/sort/radixsort.c | 4 ++-- usr.bin/sort/sort.c | 6 +++++- usr.bin/sort/sort.h | 6 ++++++ 5 files changed, 45 insertions(+), 34 deletions(-) diff --git a/usr.bin/sort/bwstring.c b/usr.bin/sort/bwstring.c index cab21324c4b3..f6200c53c83e 100644 --- a/usr.bin/sort/bwstring.c +++ b/usr.bin/sort/bwstring.c @@ -59,7 +59,7 @@ initialise_months(void) char *tmp; size_t len; - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { if (cmonths == NULL) { char *m; @@ -143,7 +143,7 @@ void bwsprintf(FILE *f, struct bwstring *bws, const char *prefix, const char *suffix) { - if (MB_CUR_MAX == 1) + if (mb_cur_max == 1) fprintf(f, "%s%s%s", prefix, bws->data.cstr, suffix); else fprintf(f, "%s%S%s", prefix, bws->data.wstr, suffix); @@ -158,14 +158,14 @@ const void* bwsrawdata(const struct bwstring *bws) size_t bwsrawlen(const struct bwstring *bws) { - return ((MB_CUR_MAX == 1) ? bws->len : SIZEOF_WCHAR_STRING(bws->len)); + return ((mb_cur_max == 1) ? bws->len : SIZEOF_WCHAR_STRING(bws->len)); } size_t bws_memsize(const struct bwstring *bws) { - return ((MB_CUR_MAX == 1) ? (bws->len + 2 + sizeof(struct bwstring)) : + return ((mb_cur_max == 1) ? (bws->len + 2 + sizeof(struct bwstring)) : (SIZEOF_WCHAR_STRING(bws->len + 1) + sizeof(struct bwstring))); } @@ -175,7 +175,7 @@ bws_setlen(struct bwstring *bws, size_t newlen) if (bws && newlen != bws->len && newlen <= bws->len) { bws->len = newlen; - if (MB_CUR_MAX == 1) + if (mb_cur_max == 1) bws->data.cstr[newlen] = '\0'; else bws->data.wstr[newlen] = L'\0'; @@ -190,14 +190,14 @@ bwsalloc(size_t sz) { struct bwstring *ret; - if (MB_CUR_MAX == 1) + if (mb_cur_max == 1) ret = sort_malloc(sizeof(struct bwstring) + 1 + sz); else ret = sort_malloc(sizeof(struct bwstring) + SIZEOF_WCHAR_STRING(sz + 1)); ret->len = sz; - if (MB_CUR_MAX == 1) + if (mb_cur_max == 1) ret->data.cstr[ret->len] = '\0'; else ret->data.wstr[ret->len] = L'\0'; @@ -218,7 +218,7 @@ bwsdup(const struct bwstring *s) else { struct bwstring *ret = bwsalloc(s->len); - if (MB_CUR_MAX == 1) + if (mb_cur_max == 1) memcpy(ret->data.cstr, s->data.cstr, (s->len)); else memcpy(ret->data.wstr, s->data.wstr, @@ -242,7 +242,7 @@ bwssbdup(const wchar_t *str, size_t len) ret = bwsalloc(len); - if (MB_CUR_MAX == 1) + if (mb_cur_max == 1) for (size_t i = 0; i < len; ++i) ret->data.cstr[i] = (unsigned char) str[i]; else @@ -263,7 +263,7 @@ bwscsbdup(const unsigned char *str, size_t len) ret = bwsalloc(len); if (str) { - if (MB_CUR_MAX == 1) + if (mb_cur_max == 1) memcpy(ret->data.cstr, str, len); else { mbstate_t mbs; @@ -277,7 +277,7 @@ bwscsbdup(const unsigned char *str, size_t len) memset(&mbs, 0, sizeof(mbs)); while (cptr < len) { - size_t n = MB_CUR_MAX; + size_t n = mb_cur_max; if (n > len - cptr) n = len - cptr; @@ -334,7 +334,7 @@ bwscpy(struct bwstring *dst, const struct bwstring *src) nums = dst->len; dst->len = nums; - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { memcpy(dst->data.cstr, src->data.cstr, nums); dst->data.cstr[dst->len] = '\0'; } else { @@ -363,7 +363,7 @@ bwsncpy(struct bwstring *dst, const struct bwstring *src, size_t size) nums = size; dst->len = nums; - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { memcpy(dst->data.cstr, src->data.cstr, nums); dst->data.cstr[dst->len] = '\0'; } else { @@ -398,7 +398,7 @@ bwsnocpy(struct bwstring *dst, const struct bwstring *src, size_t offset, if (nums > size) nums = size; dst->len = nums; - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { memcpy(dst->data.cstr, src->data.cstr + offset, (nums)); dst->data.cstr[dst->len] = '\0'; @@ -420,7 +420,7 @@ size_t bwsfwrite(struct bwstring *bws, FILE *f, bool zero_ended) { - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { size_t len = bws->len; if (!zero_ended) { @@ -478,7 +478,7 @@ bwsfgetln(FILE *f, size_t *len, bool zero_ended, struct reader_buffer *rb) eols = zero_ended ? btowc('\0') : btowc('\n'); - if (!zero_ended && (MB_CUR_MAX > 1)) { + if (!zero_ended && (mb_cur_max > 1)) { wchar_t *ret; ret = fgetwln(f, len); @@ -494,7 +494,7 @@ bwsfgetln(FILE *f, size_t *len, bool zero_ended, struct reader_buffer *rb) } return (bwssbdup(ret, *len)); - } else if (!zero_ended && (MB_CUR_MAX == 1)) { + } else if (!zero_ended && (mb_cur_max == 1)) { char *ret; ret = fgetln(f, len); @@ -523,7 +523,7 @@ bwsfgetln(FILE *f, size_t *len, bool zero_ended, struct reader_buffer *rb) } rb->fgetwln_z_buffer[*len] = 0; - if (MB_CUR_MAX == 1) + if (mb_cur_max == 1) while (!feof(f)) { int c; @@ -603,7 +603,7 @@ bwsncmp(const struct bwstring *bws1, const struct bwstring *bws2, if (len < cmp_len) cmp_len = len; - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { const unsigned char *s1, *s2; s1 = bws1->data.cstr + offset; @@ -696,7 +696,7 @@ bwscoll(const struct bwstring *bws1, const struct bwstring *bws2, size_t offset) len1 -= offset; len2 -= offset; - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { const unsigned char *s1, *s2; s1 = bws1->data.cstr + offset; @@ -852,7 +852,7 @@ bwstod(struct bwstring *s0, bool *empty) { double ret = 0; - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { unsigned char *end, *s; char *ep; @@ -909,7 +909,7 @@ int bws_month_score(const struct bwstring *s0) { - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { const unsigned char *end, *s; s = s0->data.cstr; @@ -949,7 +949,7 @@ struct bwstring * ignore_leading_blanks(struct bwstring *str) { - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { unsigned char *dst, *end, *src; src = str->data.cstr; @@ -1005,7 +1005,7 @@ ignore_nonprinting(struct bwstring *str) { size_t newlen = str->len; - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { unsigned char *dst, *end, *src; unsigned char c; @@ -1058,7 +1058,7 @@ dictionary_order(struct bwstring *str) { size_t newlen = str->len; - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { unsigned char *dst, *end, *src; unsigned char c; @@ -1109,7 +1109,7 @@ struct bwstring * ignore_case(struct bwstring *str) { - if (MB_CUR_MAX == 1) { + if (mb_cur_max == 1) { unsigned char *end, *s; s = str->data.cstr; @@ -1137,7 +1137,7 @@ void bws_disorder_warnx(struct bwstring *s, const char *fn, size_t pos) { - if (MB_CUR_MAX == 1) + if (mb_cur_max == 1) warnx("%s:%zu: disorder: %s", fn, pos + 1, s->data.cstr); else warnx("%s:%zu: disorder: %ls", fn, pos + 1, s->data.wstr); diff --git a/usr.bin/sort/bwstring.h b/usr.bin/sort/bwstring.h index 9d62eaf37f62..b63bb97ab93f 100644 --- a/usr.bin/sort/bwstring.h +++ b/usr.bin/sort/bwstring.h @@ -38,6 +38,7 @@ #include #include +#include "sort.h" #include "mem.h" extern bool byte_sort; @@ -109,7 +110,7 @@ static inline bwstring_iterator bws_end(struct bwstring *bws) { - return ((MB_CUR_MAX == 1) ? + return ((mb_cur_max == 1) ? (bwstring_iterator) (bws->data.cstr + bws->len) : (bwstring_iterator) (bws->data.wstr + bws->len)); } @@ -118,7 +119,7 @@ static inline bwstring_iterator bws_iterator_inc(bwstring_iterator iter, size_t pos) { - if (MB_CUR_MAX == 1) + if (mb_cur_max == 1) return ((unsigned char *) iter) + pos; else return ((wchar_t*) iter) + pos; @@ -128,7 +129,7 @@ static inline wchar_t bws_get_iter_value(bwstring_iterator iter) { - if (MB_CUR_MAX == 1) + if (mb_cur_max == 1) return *((unsigned char *) iter); else return *((wchar_t*) iter); @@ -137,7 +138,7 @@ bws_get_iter_value(bwstring_iterator iter) int bws_iterator_cmp(bwstring_iterator iter1, bwstring_iterator iter2, size_t len); -#define BWS_GET(bws, pos) ((MB_CUR_MAX == 1) ? ((bws)->data.cstr[(pos)]) : (bws)->data.wstr[(pos)]) +#define BWS_GET(bws, pos) ((mb_cur_max == 1) ? ((bws)->data.cstr[(pos)]) : (bws)->data.wstr[(pos)]) void initialise_months(void); diff --git a/usr.bin/sort/radixsort.c b/usr.bin/sort/radixsort.c index 4993566aeb77..4c448fad69e9 100644 --- a/usr.bin/sort/radixsort.c +++ b/usr.bin/sort/radixsort.c @@ -258,7 +258,7 @@ add_leaf(struct sort_level *sl, struct sort_list_item *item) static inline int get_wc_index(struct sort_list_item *sli, size_t level) { - const size_t wcfact = (MB_CUR_MAX == 1) ? 1 : sizeof(wchar_t); + const size_t wcfact = (mb_cur_max == 1) ? 1 : sizeof(wchar_t); const struct key_value *kv; const struct bwstring *bws; @@ -331,7 +331,7 @@ free_sort_level(struct sort_level *sl) static void run_sort_level_next(struct sort_level *sl) { - const size_t wcfact = (MB_CUR_MAX == 1) ? 1 : sizeof(wchar_t); + const size_t wcfact = (mb_cur_max == 1) ? 1 : sizeof(wchar_t); struct sort_level *slc; size_t i, sln, tosort_num; diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c index d5c18552d914..0fbbd9284aad 100644 --- a/usr.bin/sort/sort.c +++ b/usr.bin/sort/sort.c @@ -99,6 +99,8 @@ struct sort_opts sort_opts_vals; bool debug_sort; bool need_hint; +size_t mb_cur_max; + #if defined(SORT_THREADS) unsigned int ncpu = 1; size_t nthreads = 1; @@ -305,7 +307,7 @@ conv_mbtowc(wchar_t *wc, const char *c, const wchar_t def) if (wc && c) { int res; - res = mbtowc(wc, c, MB_CUR_MAX); + res = mbtowc(wc, c, mb_cur_max); if (res < 1) *wc = def; } @@ -322,6 +324,8 @@ set_locale(void) setlocale(LC_ALL, ""); + mb_cur_max = MB_CUR_MAX; + lc = localeconv(); if (lc) { diff --git a/usr.bin/sort/sort.h b/usr.bin/sort/sort.h index b472fd16c098..96b36a65f4e4 100644 --- a/usr.bin/sort/sort.h +++ b/usr.bin/sort/sort.h @@ -127,4 +127,10 @@ extern struct sort_opts sort_opts_vals; extern struct sort_mods * const default_sort_mods; +/* + * Cached value of MB_CUR_MAX. Because MB_CUR_MAX is used often throughout the program, + * this avoids frequent calls to __mb_cur_max. + */ +extern size_t mb_cur_max; + #endif /* __BSD_SORT_H__ */ From owner-dev-commits-src-main@freebsd.org Thu May 13 13:35:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 494A7640CE1; Thu, 13 May 2021 13:35:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fgt2J0ZfCz4v9g; Thu, 13 May 2021 13:35:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7D7F1FC07; Thu, 13 May 2021 13:35:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DDZJ7S067390; Thu, 13 May 2021 13:35:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DDZJcY067389; Thu, 13 May 2021 13:35:19 GMT (envelope-from git) Date: Thu, 13 May 2021 13:35:19 GMT Message-Id: <202105131335.14DDZJcY067389@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: f9e565abca9b - main - sort: Make NetBSD sort tests compatible with our sort MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f9e565abca9b5880fe3203ba67c90eaf3e906e95 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 13:35:20 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f9e565abca9b5880fe3203ba67c90eaf3e906e95 commit f9e565abca9b5880fe3203ba67c90eaf3e906e95 Author: Cyril Zhang AuthorDate: 2021-05-13 12:50:23 +0000 Commit: Mark Johnston CommitDate: 2021-05-13 13:33:47 +0000 sort: Make NetBSD sort tests compatible with our sort This diff primarily adds/removes flags to make the tests compatible with sort. Two tests are removed. One test is changed to expect fail due to a bug. Reviewed by: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30217 --- contrib/netbsd-tests/usr.bin/sort/t_sort.sh | 57 ++++++++++++++++++----------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/contrib/netbsd-tests/usr.bin/sort/t_sort.sh b/contrib/netbsd-tests/usr.bin/sort/t_sort.sh index a36457cb41ec..431d23b69f96 100755 --- a/contrib/netbsd-tests/usr.bin/sort/t_sort.sh +++ b/contrib/netbsd-tests/usr.bin/sort/t_sort.sh @@ -25,6 +25,13 @@ # POSSIBILITY OF SUCH DAMAGE. # +# The -S flag in NetBSD sort enables non-stable sorting order. This flag +# doesn't exist in FreeBSD sort, and instead indicates buffer size, so all +# instances of this flag should be removed. +# +# For tests that expect exact output, but where some lines may compare +# the same, the flag -s should be added to enforce an expected sorting order. + atf_test_case basic basic_head() { @@ -57,9 +64,9 @@ empty_file_head() empty_file_body() { touch empty - atf_check -o empty sort -S empty - atf_check sort -S -c empty - atf_check sort -S -c -u empty + atf_check -o empty sort empty + atf_check sort -c empty + atf_check sort -c -u empty } atf_test_case end_of_options @@ -70,8 +77,8 @@ end_of_options_head() end_of_options_body() { echo x >-k - atf_check -o file:-k -x "sort -S -- -k in - atf_check -o inline:'\0a\n\0b\n' sort -S in + atf_check -o inline:'\0a\n\0b\n' sort in } atf_test_case long_records @@ -126,7 +133,7 @@ long_file_head() long_file_body() { awk 'BEGIN { for(i=0; i<20000; i++) print rand() }' >in - sort -S -r in | awk '$0 "x" != x { print ; x = $0 "x" }' >out + sort -r in | awk '$0 "x" != x { print ; x = $0 "x" }' >out atf_check -o file:out sort -u -r in } @@ -155,6 +162,7 @@ bflag_head() } bflag_body() { + atf_expect_fail "Behavior differs from NetBSD" cat >in <xx" + atf_check -x "sort -k2b -k2 in >xx" atf_check -e ignore sort -c -t: -k2n xx - atf_check -x "sort -S -k2,2.1b -k2 in >xx" + atf_check -x "sort -k2,2.1b -k2 in >xx" atf_check -e ignore sort -c -t: -k3n xx - atf_check -x "sort -S -k2.3 -k2 in >xx" + atf_check -x "sort -k2.3 -k2 in >xx" atf_check -e ignore sort -c -t: -k4n xx - atf_check -x "sort -S -k2b,2.3 -k2 in >xx" + atf_check -x "sort -k2b,2.3 -k2 in >xx" atf_check -e ignore sort -c -t: -k5n xx - atf_check -x "sort -S -k2.3,2.1b -k2 in >xx" + atf_check -x "sort -k2.3,2.1b -k2 in >xx" atf_check -e ignore sort -c -t: -k6n xx - atf_check -x "sort -S -k2,2.1b -k2r in >xx" + atf_check -x "sort -k2,2.1b -k2r in >xx" atf_check -e ignore sort -c -t: -k7n xx - atf_check -x "sort -S -b -k2,2 -k2 in >xx" + atf_check -x "sort -b -k2,2 -k2 in >xx" atf_check -e ignore sort -c -t: -k8n xx # XXX This test is broken. The standard is not clear on the behavior. @@ -442,7 +452,7 @@ c ca EOF - atf_check -o file:out sort -S -m in1 in2 + atf_check -o file:out sort -m in1 in2 } atf_test_case mflag_uflag @@ -585,7 +595,7 @@ oflag_displaced_head() } oflag_displaced_body() { - atf_check sort -S /dev/null -o out + atf_check sort /dev/null -o out test -f out || atf_fail "File not created" } @@ -757,7 +767,7 @@ EOF b c EOF - atf_check -o file:out sort -S -k2 in + atf_check -o file:out sort -k2 in cat >out <./+0 echo 'more contents' >in cat ./+0 in >expout @@ -926,6 +937,8 @@ plus_rflag_invalid_head() } plus_rflag_invalid_body() { + atf_expect_fail "-R flag not available on FreeBSD" + ( echo 'z b m f' echo 'y c o e' From owner-dev-commits-src-main@freebsd.org Thu May 13 13:35:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F77B640CE3; Thu, 13 May 2021 13:35:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fgt2K28F8z4v0f; Thu, 13 May 2021 13:35:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 186E01F8CE; Thu, 13 May 2021 13:35:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DDZKeN067411; Thu, 13 May 2021 13:35:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DDZKkn067410; Thu, 13 May 2021 13:35:20 GMT (envelope-from git) Date: Thu, 13 May 2021 13:35:20 GMT Message-Id: <202105131335.14DDZKkn067410@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 186ba88a7c1f - main - sort: Hook NetBSD tests up to the build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 186ba88a7c1f2bea14eb3fb092671e8367f7187f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 13:35:21 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=186ba88a7c1f2bea14eb3fb092671e8367f7187f commit 186ba88a7c1f2bea14eb3fb092671e8367f7187f Author: Mark Johnston AuthorDate: 2021-05-13 12:57:26 +0000 Commit: Mark Johnston CommitDate: 2021-05-13 13:34:01 +0000 sort: Hook NetBSD tests up to the build MFC after: 1 week Sponsored by: The FreeBSD Foundation --- etc/mtree/BSD.tests.dist | 2 ++ usr.bin/sort/Makefile | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist index 51cc6f8a2871..1dc756aecbc5 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -1056,6 +1056,8 @@ .. soelim .. + sort + .. stat .. tail diff --git a/usr.bin/sort/Makefile b/usr.bin/sort/Makefile index 41feec2bdee0..d38e036b90c0 100644 --- a/usr.bin/sort/Makefile +++ b/usr.bin/sort/Makefile @@ -32,7 +32,7 @@ CFLAGS+= -DWITHOUT_NLS MAN_SUB+= -e 's|%%NLS%%|\.\\"|g' .endif -#HAS_TESTS= -#SUBDIR.${MK_TESTS}+= tests +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include From owner-dev-commits-src-main@freebsd.org Thu May 13 14:31:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CCD71643BCD; Thu, 13 May 2021 14:31:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgvGz5VrCz3FXf; Thu, 13 May 2021 14:31:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AFE212034F; Thu, 13 May 2021 14:31:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DEVNtn043469; Thu, 13 May 2021 14:31:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DEVNvZ043468; Thu, 13 May 2021 14:31:23 GMT (envelope-from git) Date: Thu, 13 May 2021 14:31:23 GMT Message-Id: <202105131431.14DEVNvZ043468@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?B?RmVybmFuZG8gQXBlc3RlZ3XDrWE=?= Subject: git: 94eb6c42ab4a - main - syslog.3 - Add detail about LOG_PID MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fernape X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 94eb6c42ab4a2e2581e7cde6d8bd7e81c87a4442 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 14:31:23 -0000 The branch main has been updated by fernape (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=94eb6c42ab4a2e2581e7cde6d8bd7e81c87a4442 commit 94eb6c42ab4a2e2581e7cde6d8bd7e81c87a4442 Author: Fernando Apesteguía AuthorDate: 2021-05-10 15:20:06 +0000 Commit: Fernando Apesteguía CommitDate: 2021-05-13 14:23:44 +0000 syslog.3 - Add detail about LOG_PID Document that LOG_PID is ignored and can not be disabled. This change was made along with the move from RFC 3164 to RFC 5424 log messages. PR: 255664 Reported by: des.gaufres@gmail.com Reviewed by: gbe, jilles Approved by: gbe (mentor, manpages), jilles --- lib/libc/gen/syslog.3 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/gen/syslog.3 b/lib/libc/gen/syslog.3 index 2cb2c0d198b3..ce7dfdccf55e 100644 --- a/lib/libc/gen/syslog.3 +++ b/lib/libc/gen/syslog.3 @@ -28,7 +28,7 @@ .\" @(#)syslog.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd November 25, 2018 +.Dd May 13, 2021 .Dt SYSLOG 3 .Os .Sh NAME @@ -159,7 +159,7 @@ Log the process id with each message: useful for identifying instantiations of daemons. On .Fx , -this option is enabled by default. +this option is enabled by default and cannot be disabled. .El .Pp The From owner-dev-commits-src-main@freebsd.org Thu May 13 15:27:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2CF72645783; Thu, 13 May 2021 15:27:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgwXC0nldz3KLj; Thu, 13 May 2021 15:27:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 09D3D21423; Thu, 13 May 2021 15:27:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DFRsWC013666; Thu, 13 May 2021 15:27:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DFRs7U013665; Thu, 13 May 2021 15:27:54 GMT (envelope-from git) Date: Thu, 13 May 2021 15:27:54 GMT Message-Id: <202105131527.14DFRs7U013665@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: f6e0c471691e - main - netgraph/ng_bridge: move MACs via control message MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f6e0c471691e0005e450ec968a9fa3b5346a3c45 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 15:27:55 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=f6e0c471691e0005e450ec968a9fa3b5346a3c45 commit f6e0c471691e0005e450ec968a9fa3b5346a3c45 Author: Lutz Donnerhacke AuthorDate: 2021-02-09 13:28:48 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-13 15:27:01 +0000 netgraph/ng_bridge: move MACs via control message Use the new control message to move ethernet addresses from a link to a new link in ng_bridge(4). Send this message instead of doing the work directly requires to move the loop detection into the control message processing. This will delay the loop detection by a few frames. This decouples the read-only activity from the modification under a more strict writer lock. Reviewed by: manpages (gbe) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28559 --- share/man/man4/ng_bridge.4 | 13 ++++-- sys/netgraph/ng_bridge.c | 112 ++++++++++++++++++++------------------------- 2 files changed, 59 insertions(+), 66 deletions(-) diff --git a/share/man/man4/ng_bridge.4 b/share/man/man4/ng_bridge.4 index 216dea3c392a..f83bacecce40 100644 --- a/share/man/man4/ng_bridge.4 +++ b/share/man/man4/ng_bridge.4 @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 17, 2021 +.Dd May 13, 2021 .Dt NG_BRIDGE 4 .Os .Sh NAME @@ -221,12 +221,19 @@ as an argument. It assigns the MAC .Va addr to the -.Va hook , -which must not be assigned yet. +.Va hook . If the .Va hook is the empty string, the incoming hook of the control message is used as fallback. +.Pp +If necessary, the MAC is removed from the currently assigned hook and +moved to the new one. +If the MAC is moved faster than +.Va minStableAge , +the hook is considered as a loop and will block traffic for +.Va loopTimeout +seconds. .Bd -literal -offset 0n struct ng_bridge_move_host { u_char addr[ETHER_ADDR_LEN]; /* ethernet address */ diff --git a/sys/netgraph/ng_bridge.c b/sys/netgraph/ng_bridge.c index 915a18550cba..ecb00f9ba29f 100644 --- a/sys/netgraph/ng_bridge.c +++ b/sys/netgraph/ng_bridge.c @@ -103,7 +103,7 @@ struct ng_bridge_link_kernel_stats { counter_u64_t xmitMulticasts; /* multicast pkts xmit'd on link */ counter_u64_t xmitBroadcasts; /* broadcast pkts xmit'd on link */ counter_u64_t loopDrops; /* pkts dropped due to loopback */ - counter_u64_t loopDetects; /* number of loop detections */ + u_int64_t loopDetects; /* number of loop detections */ counter_u64_t memoryFailures; /* times couldn't get mem or mbuf */ }; @@ -420,7 +420,6 @@ ng_bridge_newhook(node_p node, hook_p hook, const char *name) link->stats.xmitMulticasts = counter_u64_alloc(M_WAITOK); link->stats.xmitBroadcasts = counter_u64_alloc(M_WAITOK); link->stats.loopDrops = counter_u64_alloc(M_WAITOK); - link->stats.loopDetects = counter_u64_alloc(M_WAITOK); link->stats.memoryFailures = counter_u64_alloc(M_WAITOK); link->hook = hook; @@ -456,7 +455,7 @@ static void ng_bridge_clear_link_stats(struct ng_bridge_link_kernel_stats * p) counter_u64_zero(p->xmitMulticasts); counter_u64_zero(p->xmitBroadcasts); counter_u64_zero(p->loopDrops); - counter_u64_zero(p->loopDetects); + p->loopDetects = 0; counter_u64_zero(p->memoryFailures); }; @@ -573,7 +572,7 @@ ng_bridge_rcvmsg(node_p node, item_p item, hook_p lasthook) FETCH(xmitMulticasts); FETCH(xmitBroadcasts); FETCH(loopDrops); - FETCH(loopDetects); + rs->loopDetects = link->stats.loopDetects; FETCH(memoryFailures); #undef FETCH } @@ -619,7 +618,6 @@ ng_bridge_rcvmsg(node_p node, item_p item, hook_p lasthook) { struct ng_bridge_move_host *mh; hook_p hook; - struct ng_bridge_host *host; if (msg->header.arglen < sizeof(*mh)) { error = EINVAL; @@ -633,11 +631,6 @@ ng_bridge_rcvmsg(node_p node, item_p item, hook_p lasthook) error = ENOENT; break; } - host = ng_bridge_get(priv, mh->addr); - if (host != NULL) { - error = EADDRINUSE; - break; - } error = ng_bridge_put(priv, mh->addr, NG_HOOK_PRIVATE(hook)); break; } @@ -784,7 +777,7 @@ ng_bridge_rcvdata(hook_p hook, item_p item) counter_u64_add(ctx.incoming->stats.loopDrops, 1); NG_FREE_ITEM(item); NG_FREE_M(ctx.m); - return (ELOOP); /* XXX is this an appropriate error? */ + return (ELOOP); } /* Update stats */ @@ -799,56 +792,15 @@ ng_bridge_rcvdata(hook_p hook, item_p item) } /* Look up packet's source Ethernet address in hashtable */ - if ((host = ng_bridge_get(priv, eh->ether_shost)) != NULL) { + if ((host = ng_bridge_get(priv, eh->ether_shost)) != NULL) /* Update time since last heard from this host. * This is safe without locking, because it's * the only operation during shared access. */ host->staleness = 0; - /* Did host jump to a different link? */ - if (host->link != ctx.incoming) { - /* - * If the host's old link was recently established - * on the old link and it's already jumped to a new - * link, declare a loopback condition. - */ - if (host->age < priv->conf.minStableAge) { - /* Log the problem */ - if (priv->conf.debugLevel >= 2) { - struct ifnet *ifp = ctx.m->m_pkthdr.rcvif; - char suffix[32]; - - if (ifp != NULL) - snprintf(suffix, sizeof(suffix), - " (%s)", ifp->if_xname); - else - *suffix = '\0'; - log(LOG_WARNING, "ng_bridge: %s:" - " loopback detected on %s%s\n", - ng_bridge_nodename(node), - NG_HOOK_NAME(hook), suffix); - } - - /* Mark link as linka non grata */ - ctx.incoming->loopCount = priv->conf.loopTimeout; - counter_u64_add(ctx.incoming->stats.loopDetects, 1); - - /* Forget all hosts on this link */ - ng_bridge_remove_hosts(priv, ctx.incoming); - - /* Drop packet */ - counter_u64_add(ctx.incoming->stats.loopDrops, 1); - NG_FREE_ITEM(item); - NG_FREE_M(ctx.m); - return (ELOOP); /* XXX appropriate? */ - } - - /* Move host over to new link */ - host->link = ctx.incoming; - host->age = 0; - } - } else if (ctx.incoming->learnMac) { + if ((host == NULL && ctx.incoming->learnMac) || + (host != NULL && host->link != ctx.incoming)) { struct ng_mesg *msg; struct ng_bridge_move_host *mh; int error = 0; @@ -871,6 +823,16 @@ ng_bridge_rcvdata(hook_p hook, item_p item) counter_u64_add(ctx.incoming->stats.memoryFailures, 1); } + if (host != NULL && host->link != ctx.incoming) { + if (host->age < priv->conf.minStableAge) { + /* Drop packet on instable links */ + counter_u64_add(ctx.incoming->stats.loopDrops, 1); + NG_FREE_ITEM(item); + NG_FREE_M(ctx.m); + return (ELOOP); + } + } + /* Run packet through ipfw processing, if enabled */ #if 0 if (priv->conf.ipfw[linkNum] && V_fw_enable && V_ip_fw_chk_ptr != NULL) { @@ -970,7 +932,6 @@ ng_bridge_disconnect(hook_p hook) counter_u64_free(link->stats.xmitMulticasts); counter_u64_free(link->stats.xmitBroadcasts); counter_u64_free(link->stats.loopDrops); - counter_u64_free(link->stats.loopDetects); counter_u64_free(link->stats.memoryFailures); free(link, M_NETGRAPH_BRIDGE); priv->numLinks--; @@ -1012,8 +973,8 @@ ng_bridge_get(priv_cp priv, const u_char *addr) } /* - * Add a new host entry to the table. This assumes the host doesn't - * already exist in the table. Returns 0 on success. + * Add a host entry to the table. If it already exists, move it + * to the new link. Returns 0 on success. */ static int ng_bridge_put(priv_p priv, const u_char *addr, link_p link) @@ -1021,11 +982,36 @@ ng_bridge_put(priv_p priv, const u_char *addr, link_p link) const int bucket = HASH(addr, priv->hashMask); struct ng_bridge_host *host; -#ifdef INVARIANTS - /* Assert that entry does not already exist in hashtable */ - KASSERT(ng_bridge_get(priv, addr) == NULL, - ("%s: entry %6D exists in table", __func__, addr, ":")); -#endif + if ((host = ng_bridge_get(priv, addr)) != NULL) { + /* Host already on the correct link? */ + if (host->link == link) + return 0; + + /* Move old host over to new link */ + if (host->age >= priv->conf.minStableAge) { + host->link = link; + host->age = 0; + return (0); + } + /* + * If the host was recently moved to the old link and + * it's now jumping to a new link, declare a loopback + * condition. + */ + if (priv->conf.debugLevel >= 2) + log(LOG_WARNING, "ng_bridge: %s:" + " loopback detected on %s\n", + ng_bridge_nodename(priv->node), + NG_HOOK_NAME(link->hook)); + + /* Mark link as linka non grata */ + link->loopCount = priv->conf.loopTimeout; + link->stats.loopDetects++; + + /* Forget all hosts on this link */ + ng_bridge_remove_hosts(priv, link); + return (ELOOP); + } /* Allocate and initialize new hashtable entry */ host = malloc(sizeof(*host), M_NETGRAPH_BRIDGE, M_NOWAIT); From owner-dev-commits-src-main@freebsd.org Thu May 13 15:46:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2493F646116; Thu, 13 May 2021 15:46:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fgwxv0cqgz3LnS; Thu, 13 May 2021 15:46:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 08A4F212ED; Thu, 13 May 2021 15:46:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DFkgCZ040551; Thu, 13 May 2021 15:46:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DFkgDV040549; Thu, 13 May 2021 15:46:42 GMT (envelope-from git) Date: Thu, 13 May 2021 15:46:42 GMT Message-Id: <202105131546.14DFkgDV040549@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 6dbde50a7e48 - main - pkgbase: Move librt to clibs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6dbde50a7e48d4779dc7a7b0bc63f922aa5bcbf5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 15:46:43 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=6dbde50a7e48d4779dc7a7b0bc63f922aa5bcbf5 commit 6dbde50a7e48d4779dc7a7b0bc63f922aa5bcbf5 Author: Emmanuel Vadot AuthorDate: 2021-05-03 08:12:26 +0000 Commit: Emmanuel Vadot CommitDate: 2021-05-13 15:41:24 +0000 pkgbase: Move librt to clibs librt implement the POSIX realtime extension library. Move it to clibs instead of utilities as a number of ports uses it so avoid a dependancy on FreeBSD-utilities. MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D30088 --- lib/librt/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librt/Makefile b/lib/librt/Makefile index 6a751b7a3aa3..00ae29bab26b 100644 --- a/lib/librt/Makefile +++ b/lib/librt/Makefile @@ -2,6 +2,7 @@ .include +PACKAGE=clibs LIB=rt SHLIB_MAJOR= 1 CFLAGS+=-I${SRCTOP}/lib/libc/include -I${.CURDIR} From owner-dev-commits-src-main@freebsd.org Thu May 13 15:46:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8406F645DBE; Thu, 13 May 2021 15:46:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fgwxw1bLqz3LnT; Thu, 13 May 2021 15:46:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27FFB216D5; Thu, 13 May 2021 15:46:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DFkiQ4040578; Thu, 13 May 2021 15:46:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DFkixT040577; Thu, 13 May 2021 15:46:44 GMT (envelope-from git) Date: Thu, 13 May 2021 15:46:44 GMT Message-Id: <202105131546.14DFkixT040577@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: ca179c4d74f2 - main - pkgbase: Put openssl in its own package MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ca179c4d74f2ce1e458bae1826bd77d17f28aab2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 15:46:44 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=ca179c4d74f2ce1e458bae1826bd77d17f28aab2 commit ca179c4d74f2ce1e458bae1826bd77d17f28aab2 Author: Emmanuel Vadot AuthorDate: 2021-05-02 15:46:17 +0000 Commit: Emmanuel Vadot CommitDate: 2021-05-13 15:42:29 +0000 pkgbase: Put openssl in its own package This is useful for upgrade and also to make tiny jail so they won't depend on FreeBSD-utilities (where openssl was packaged before). MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D30081 --- release/packages/Makefile.package | 2 ++ secure/lib/libcrypto/Makefile | 2 +- secure/lib/libssl/Makefile | 1 + secure/usr.bin/openssl/Makefile | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/release/packages/Makefile.package b/release/packages/Makefile.package index 125732267008..dd7ce63d78a1 100644 --- a/release/packages/Makefile.package +++ b/release/packages/Makefile.package @@ -57,6 +57,8 @@ kernel_COMMENT= FreeBSD Kernel kernel_DESC= FreeBSD Kernel manuals_COMMENT= Manual Pages manuals_DESC= Manual Pages +openssl_COMMENT= OpenSSL Library and Utility +openssl_DESC= OpenSSL Library and Utility rc_COMMENT= RC Scripts rc_DESC= RC Scripts rcmds_COMMENT= Remote Command Utilities diff --git a/secure/lib/libcrypto/Makefile b/secure/lib/libcrypto/Makefile index b82b5c8d84b1..ff9303c9edae 100644 --- a/secure/lib/libcrypto/Makefile +++ b/secure/lib/libcrypto/Makefile @@ -6,7 +6,7 @@ SUBDIR= engines .include .include -PACKAGE= runtime +PACKAGE= openssl LIB= crypto SHLIB_MAJOR= 111 VERSION_MAP= ${.CURDIR}/Version.map diff --git a/secure/lib/libssl/Makefile b/secure/lib/libssl/Makefile index 74856aaa3b1f..893ea6ebed79 100644 --- a/secure/lib/libssl/Makefile +++ b/secure/lib/libssl/Makefile @@ -5,6 +5,7 @@ LIB= ssl SHLIB_MAJOR= 111 VERSION_MAP= ${.CURDIR}/Version.map +PACKAGE= openssl NO_LINT= diff --git a/secure/usr.bin/openssl/Makefile b/secure/usr.bin/openssl/Makefile index e71be39bae56..5f3bf395a149 100644 --- a/secure/usr.bin/openssl/Makefile +++ b/secure/usr.bin/openssl/Makefile @@ -3,6 +3,7 @@ CONFS= openssl.cnf CONFSDIR= /etc/ssl PROG= openssl +PACKAGE= openssl LIBADD= ssl crypto From owner-dev-commits-src-main@freebsd.org Thu May 13 15:46:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3C27645D60; Thu, 13 May 2021 15:46:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fgwxx3cGvz3LWP; Thu, 13 May 2021 15:46:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A6872193B; Thu, 13 May 2021 15:46:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DFkj5a040599; Thu, 13 May 2021 15:46:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DFkjWT040598; Thu, 13 May 2021 15:46:45 GMT (envelope-from git) Date: Thu, 13 May 2021 15:46:45 GMT Message-Id: <202105131546.14DFkjWT040598@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 1c2ab28f598a - main - UPDATING: Add a note for pkgbase user for commit ca179c4d74f2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1c2ab28f598a9598b3c50d9001c70ff51f88e445 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 15:46:45 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=1c2ab28f598a9598b3c50d9001c70ff51f88e445 commit 1c2ab28f598a9598b3c50d9001c70ff51f88e445 Author: Emmanuel Vadot AuthorDate: 2021-05-13 15:46:08 +0000 Commit: Emmanuel Vadot CommitDate: 2021-05-13 15:46:08 +0000 UPDATING: Add a note for pkgbase user for commit ca179c4d74f2 --- UPDATING | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/UPDATING b/UPDATING index 2059bbddbdc0..36f9f1aea126 100644 --- a/UPDATING +++ b/UPDATING @@ -27,6 +27,15 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20210513: + Commit ca179c4d74f2 changed the package in which the OpenSSL + libraries and utilities are packaged. + It is recommanded for pkgbase user to do : + pkg install -f FreeBSD-openssl + before pkg upgrade otherwise some dependencies might not be met + and pkg will stop working as libssl will not be present anymore + on the system. + 20210426: Commit 875977314881 changed the internal KAPI between the nfsd and nfscommon modules. As such these modules From owner-dev-commits-src-main@freebsd.org Thu May 13 15:54:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E43C64637F; Thu, 13 May 2021 15:54:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fgx6R2jfVz3MTL; Thu, 13 May 2021 15:54:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FF3F217B4; Thu, 13 May 2021 15:54:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DFs76P053531; Thu, 13 May 2021 15:54:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DFs79n053530; Thu, 13 May 2021 15:54:07 GMT (envelope-from git) Date: Thu, 13 May 2021 15:54:07 GMT Message-Id: <202105131554.14DFs79n053530@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: 9674c2e68c61 - main - netgraph/ng_bridge: become SMP aware MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9674c2e68c613757ddf5a8780743842b5ac4d74f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 15:54:07 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=9674c2e68c613757ddf5a8780743842b5ac4d74f commit 9674c2e68c613757ddf5a8780743842b5ac4d74f Author: Lutz Donnerhacke AuthorDate: 2021-01-12 21:28:29 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-13 15:53:07 +0000 netgraph/ng_bridge: become SMP aware The node ng_bridge underwent a lot of changes in the last few months. All those steps were necessary to distinguish between structure modifying and read-only data transport paths. Now it's done, the node can perform frame forwarding on multiple cores in parallel. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28123 --- sys/netgraph/ng_bridge.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/sys/netgraph/ng_bridge.c b/sys/netgraph/ng_bridge.c index ecb00f9ba29f..470c0f05f18d 100644 --- a/sys/netgraph/ng_bridge.c +++ b/sys/netgraph/ng_bridge.c @@ -351,15 +351,6 @@ ng_bridge_constructor(node_p node) priv->conf.minStableAge = DEFAULT_MIN_STABLE_AGE; priv->sendUnknown = 1; /* classic bridge */ - /* - * This node has all kinds of stuff that could be screwed by SMP. - * Until it gets it's own internal protection, we go through in - * single file. This could hurt a machine bridging between two - * GB ethernets so it should be fixed. - * When it's fixed the process SHOULD NOT SLEEP, spinlocks please! - * (and atomic ops ) - */ - NG_NODE_FORCE_WRITER(node); NG_NODE_SET_PRIVATE(node, priv); priv->node = node; From owner-dev-commits-src-main@freebsd.org Thu May 13 16:15:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 51C8D646DAE; Thu, 13 May 2021 16:15:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgxbP1vQ7z3N6N; Thu, 13 May 2021 16:15:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 341F221DC8; Thu, 13 May 2021 16:15:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DGFjDS081475; Thu, 13 May 2021 16:15:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DGFjFr081474; Thu, 13 May 2021 16:15:45 GMT (envelope-from git) Date: Thu, 13 May 2021 16:15:45 GMT Message-Id: <202105131615.14DGFjFr081474@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 9e08f82058cb - main - modules: Add sdhci_fdt module MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9e08f82058cb5e3c04cdfe90fc7a0d109c7f2659 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 16:15:45 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=9e08f82058cb5e3c04cdfe90fc7a0d109c7f2659 commit 9e08f82058cb5e3c04cdfe90fc7a0d109c7f2659 Author: Emmanuel Vadot AuthorDate: 2021-04-28 13:57:39 +0000 Commit: Emmanuel Vadot CommitDate: 2021-05-13 16:15:31 +0000 modules: Add sdhci_fdt module This is a module for sdhci on fdt system --- sys/modules/Makefile | 2 ++ sys/modules/sdhci_fdt/Makefile | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 9d5b84ccf58f..6a5097e9ded0 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -331,6 +331,7 @@ SUBDIR= \ ${_sctp} \ sdhci \ ${_sdhci_acpi} \ + ${_sdhci_fdt} \ sdhci_pci \ sdio \ sem \ @@ -490,6 +491,7 @@ SUBDIR+= iscsi_initiator .if !empty(OPT_FDT) SUBDIR+= fdt +_sdhci_fdt= sdhci_fdt .endif # Linuxulator diff --git a/sys/modules/sdhci_fdt/Makefile b/sys/modules/sdhci_fdt/Makefile new file mode 100644 index 000000000000..cc8c8b44f2e6 --- /dev/null +++ b/sys/modules/sdhci_fdt/Makefile @@ -0,0 +1,8 @@ +# + +.PATH: ${SRCTOP}/sys/dev/sdhci + +KMOD= sdhci_fdt +SRCS= sdhci_fdt.c sdhci_fdt_gpio.c sdhci_if.h device_if.h bus_if.h mmcbr_if.h opt_mmccam.h opt_cam.h + +.include From owner-dev-commits-src-main@freebsd.org Thu May 13 16:15:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 85968647055; Thu, 13 May 2021 16:15:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FgxbQ38Khz3NBN; Thu, 13 May 2021 16:15:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5744721FC4; Thu, 13 May 2021 16:15:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DGFkah081497; Thu, 13 May 2021 16:15:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DGFkNv081496; Thu, 13 May 2021 16:15:46 GMT (envelope-from git) Date: Thu, 13 May 2021 16:15:46 GMT Message-Id: <202105131615.14DGFkNv081496@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: eb094080855e - main - arm64: rockchip: Add some DTSO to disable sd/mmc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eb094080855e1e8c28a70dbebab3e6ecbf8c1255 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 16:15:46 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=eb094080855e1e8c28a70dbebab3e6ecbf8c1255 commit eb094080855e1e8c28a70dbebab3e6ecbf8c1255 Author: Emmanuel Vadot AuthorDate: 2021-04-21 13:25:29 +0000 Commit: Emmanuel Vadot CommitDate: 2021-05-13 16:15:31 +0000 arm64: rockchip: Add some DTSO to disable sd/mmc This helps during developement to reduce the number of mmc controller. --- sys/dts/arm64/overlays/rk3399-mmc0-disable.dtso | 10 ++++++++++ sys/dts/arm64/overlays/rk3399-mmc1-disable.dtso | 10 ++++++++++ sys/dts/arm64/overlays/rk3399-sdhci-disable.dtso | 10 ++++++++++ sys/modules/dtb/rockchip/Makefile | 5 ++++- 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/sys/dts/arm64/overlays/rk3399-mmc0-disable.dtso b/sys/dts/arm64/overlays/rk3399-mmc0-disable.dtso new file mode 100644 index 000000000000..a638ed65c717 --- /dev/null +++ b/sys/dts/arm64/overlays/rk3399-mmc0-disable.dtso @@ -0,0 +1,10 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "rockchip,rk3399"; +}; + +&{/mmc@fe310000} { + status = "disabled"; +}; diff --git a/sys/dts/arm64/overlays/rk3399-mmc1-disable.dtso b/sys/dts/arm64/overlays/rk3399-mmc1-disable.dtso new file mode 100644 index 000000000000..333be61da216 --- /dev/null +++ b/sys/dts/arm64/overlays/rk3399-mmc1-disable.dtso @@ -0,0 +1,10 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "rockchip,rk3399"; +}; + +&{/mmc@fe320000} { + status = "disabled"; +}; diff --git a/sys/dts/arm64/overlays/rk3399-sdhci-disable.dtso b/sys/dts/arm64/overlays/rk3399-sdhci-disable.dtso new file mode 100644 index 000000000000..b386cc12e62a --- /dev/null +++ b/sys/dts/arm64/overlays/rk3399-sdhci-disable.dtso @@ -0,0 +1,10 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "rockchip,rk3399"; +}; + +&{/sdhci@fe330000} { + status = "disabled"; +}; diff --git a/sys/modules/dtb/rockchip/Makefile b/sys/modules/dtb/rockchip/Makefile index 12f59e4ee973..20df656bd148 100644 --- a/sys/modules/dtb/rockchip/Makefile +++ b/sys/modules/dtb/rockchip/Makefile @@ -15,7 +15,10 @@ DTS= \ rockchip/rk3399-firefly.dts \ rockchip/rk3399-rockpro64.dts -DTSO= rk3328-dwc3.dtso +DTSO= rk3328-dwc3.dtso \ + rk3399-mmc0-disable.dtso \ + rk3399-mmc1-disable.dtso \ + rk3399-sdhci-disable.dtso .endif .include From owner-dev-commits-src-main@freebsd.org Thu May 13 17:14:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1D24F6286A4; Thu, 13 May 2021 17:14:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fgyts0MQfz3Qsv; Thu, 13 May 2021 17:14:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F356322C9B; Thu, 13 May 2021 17:14:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DHECTC063307; Thu, 13 May 2021 17:14:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DHECkS063306; Thu, 13 May 2021 17:14:12 GMT (envelope-from git) Date: Thu, 13 May 2021 17:14:12 GMT Message-Id: <202105131714.14DHECkS063306@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 00a3fe968b84 - main - vm_object_kvme_type(): reimplement by embedding kvme_type into pagerops MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 00a3fe968b840ee197c32dfe4107dab730bd9915 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 17:14:13 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=00a3fe968b840ee197c32dfe4107dab730bd9915 commit 00a3fe968b840ee197c32dfe4107dab730bd9915 Author: Konstantin Belousov AuthorDate: 2021-05-07 17:46:51 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-13 17:10:35 +0000 vm_object_kvme_type(): reimplement by embedding kvme_type into pagerops Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30168 --- sys/vm/default_pager.c | 2 ++ sys/vm/device_pager.c | 3 +++ sys/vm/phys_pager.c | 2 ++ sys/vm/sg_pager.c | 2 ++ sys/vm/swap_pager.c | 3 +++ sys/vm/vm_object.c | 35 ----------------------------------- sys/vm/vm_pager.c | 16 ++++++++++++++++ sys/vm/vm_pager.h | 1 + sys/vm/vnode_pager.c | 2 ++ 9 files changed, 31 insertions(+), 35 deletions(-) diff --git a/sys/vm/default_pager.c b/sys/vm/default_pager.c index 758012692a48..d07a84f8c98e 100644 --- a/sys/vm/default_pager.c +++ b/sys/vm/default_pager.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -71,6 +72,7 @@ static boolean_t default_pager_haspage(vm_object_t, vm_pindex_t, int *, * object is converted to swap pager type. */ const struct pagerops defaultpagerops = { + .pgo_kvme_type = KVME_TYPE_DEFAULT, .pgo_alloc = default_pager_alloc, .pgo_dealloc = default_pager_dealloc, .pgo_getpages = default_pager_getpages, diff --git a/sys/vm/device_pager.c b/sys/vm/device_pager.c index 25affb114a47..567f8fe55817 100644 --- a/sys/vm/device_pager.c +++ b/sys/vm/device_pager.c @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -75,6 +76,7 @@ static struct pagerlst dev_pager_object_list; static struct mtx dev_pager_mtx; const struct pagerops devicepagerops = { + .pgo_kvme_type = KVME_TYPE_DEVICE, .pgo_init = dev_pager_init, .pgo_alloc = dev_pager_alloc, .pgo_dealloc = dev_pager_dealloc, @@ -84,6 +86,7 @@ const struct pagerops devicepagerops = { }; const struct pagerops mgtdevicepagerops = { + .pgo_kvme_type = KVME_TYPE_MGTDEVICE, .pgo_alloc = dev_pager_alloc, .pgo_dealloc = dev_pager_dealloc, .pgo_getpages = dev_pager_getpages, diff --git a/sys/vm/phys_pager.c b/sys/vm/phys_pager.c index af7b10701b16..6d7c5a4a7291 100644 --- a/sys/vm/phys_pager.c +++ b/sys/vm/phys_pager.c @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -299,6 +300,7 @@ phys_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *before, } const struct pagerops physpagerops = { + .pgo_kvme_type = KVME_TYPE_PHYS, .pgo_init = phys_pager_init, .pgo_alloc = phys_pager_alloc, .pgo_dealloc = phys_pager_dealloc, diff --git a/sys/vm/sg_pager.c b/sys/vm/sg_pager.c index 9b3e60bc170a..d7af2aed935a 100644 --- a/sys/vm/sg_pager.c +++ b/sys/vm/sg_pager.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -60,6 +61,7 @@ static boolean_t sg_pager_haspage(vm_object_t, vm_pindex_t, int *, int *); const struct pagerops sgpagerops = { + .pgo_kvme_type = KVME_TYPE_SG, .pgo_alloc = sg_pager_alloc, .pgo_dealloc = sg_pager_dealloc, .pgo_getpages = sg_pager_getpages, diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 57c953542a88..37db4cbac857 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -99,6 +99,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -442,6 +443,7 @@ static void swap_pager_freespace(vm_object_t object, vm_pindex_t start, vm_size_t size); const struct pagerops swappagerops = { + .pgo_kvme_type = KVME_TYPE_SWAP, .pgo_init = swap_pager_init, /* early system initialization of pager */ .pgo_alloc = swap_pager_alloc, /* allocate an OBJT_SWAP object */ .pgo_dealloc = swap_pager_dealloc, /* deallocate an OBJT_SWAP object */ @@ -456,6 +458,7 @@ const struct pagerops swappagerops = { }; const struct pagerops swaptmpfspagerops = { + .pgo_kvme_type = KVME_TYPE_VNODE, .pgo_alloc = swap_tmpfs_pager_alloc, .pgo_dealloc = swap_pager_dealloc, .pgo_getpages = swap_pager_getpages, diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 1c4e879d82ea..735ab603a09b 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -2469,41 +2469,6 @@ vm_object_busy_wait(vm_object_t obj, const char *wmesg) (void)blockcount_sleep(&obj->busy, NULL, wmesg, PVM); } -/* - * Return the kvme type of the given object. - * If vpp is not NULL, set it to the object's vm_object_vnode() or NULL. - */ -int -vm_object_kvme_type(vm_object_t object, struct vnode **vpp) -{ - - VM_OBJECT_ASSERT_LOCKED(object); - if (vpp != NULL) - *vpp = vm_object_vnode(object); - switch (object->type) { - case OBJT_DEFAULT: - return (KVME_TYPE_DEFAULT); - case OBJT_VNODE: - return (KVME_TYPE_VNODE); - case OBJT_SWAP: - return (KVME_TYPE_SWAP); - case OBJT_SWAP_TMPFS: - return (KVME_TYPE_VNODE); - case OBJT_DEVICE: - return (KVME_TYPE_DEVICE); - case OBJT_PHYS: - return (KVME_TYPE_PHYS); - case OBJT_DEAD: - return (KVME_TYPE_DEAD); - case OBJT_SG: - return (KVME_TYPE_SG); - case OBJT_MGTDEVICE: - return (KVME_TYPE_MGTDEVICE); - default: - return (KVME_TYPE_UNKNOWN); - } -} - static int sysctl_vm_object_list(SYSCTL_HANDLER_ARGS) { diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 240847903f62..9476058a75bf 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -155,6 +156,7 @@ dead_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) } static const struct pagerops deadpagerops = { + .pgo_kvme_type = KVME_TYPE_DEAD, .pgo_alloc = dead_pager_alloc, .pgo_dealloc = dead_pager_dealloc, .pgo_getpages = dead_pager_getpages, @@ -530,3 +532,17 @@ vm_object_mightbedirty(vm_object_t object) return (false); return (method(object)); } + +/* + * Return the kvme type of the given object. + * If vpp is not NULL, set it to the object's vm_object_vnode() or NULL. + */ +int +vm_object_kvme_type(vm_object_t object, struct vnode **vpp) +{ + VM_OBJECT_ASSERT_LOCKED(object); + + if (vpp != NULL) + *vpp = vm_object_vnode(object); + return (pagertab[object->type]->pgo_kvme_type); +} diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index 68c5fe42351e..5e0261f818cf 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -71,6 +71,7 @@ typedef void pgo_freespace_t(vm_object_t object, vm_pindex_t start, vm_size_t size); struct pagerops { + int pgo_kvme_type; pgo_init_t *pgo_init; /* Initialize pager. */ pgo_alloc_t *pgo_alloc; /* Allocate pager. */ pgo_dealloc_t *pgo_dealloc; /* Disassociate. */ diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index fb0b4068183b..d167fcc555fb 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -108,6 +109,7 @@ static void vnode_pager_release_writecount(vm_object_t, vm_offset_t, static void vnode_pager_getvp(vm_object_t, struct vnode **, bool *); const struct pagerops vnodepagerops = { + .pgo_kvme_type = KVME_TYPE_VNODE, .pgo_alloc = vnode_pager_alloc, .pgo_dealloc = vnode_pager_dealloc, .pgo_getpages = vnode_pager_getpages, From owner-dev-commits-src-main@freebsd.org Thu May 13 17:14:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A7756281E5; Thu, 13 May 2021 17:14:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fgytt2D1Hz3Qqq; Thu, 13 May 2021 17:14:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 195BE22C32; Thu, 13 May 2021 17:14:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DHEE4S063332; Thu, 13 May 2021 17:14:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DHED5R063331; Thu, 13 May 2021 17:14:13 GMT (envelope-from git) Date: Thu, 13 May 2021 17:14:13 GMT Message-Id: <202105131714.14DHED5R063331@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 8b99833ac253 - main - procfs_map: switch to use vm_object_kvme_type MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8b99833ac2538a74d013d101e2b5ec2d9e29d198 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 17:14:14 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8b99833ac2538a74d013d101e2b5ec2d9e29d198 commit 8b99833ac2538a74d013d101e2b5ec2d9e29d198 Author: Konstantin Belousov AuthorDate: 2021-05-10 15:20:42 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-13 17:10:35 +0000 procfs_map: switch to use vm_object_kvme_type to get object type, and stop enumerating OBJT_XXX constants. This also provides properly a pointer for the vnode, if object backs any. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30168 --- sys/fs/procfs/procfs_map.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/sys/fs/procfs/procfs_map.c b/sys/fs/procfs/procfs_map.c index 9ee49b0149a2..bd4cd2c09c00 100644 --- a/sys/fs/procfs/procfs_map.c +++ b/sys/fs/procfs/procfs_map.c @@ -51,6 +51,7 @@ #include #endif #include +#include #include #include @@ -85,7 +86,8 @@ procfs_doprocmap(PFS_FILL_ARGS) char *fullpath, *freepath, *type; struct ucred *cred; vm_object_t lobj, nobj, obj, tobj; - int error, privateresident, ref_count, resident, shadow_count, flags; + int error, flags, kvme, privateresident, ref_count, resident; + int shadow_count; vm_offset_t e_start, e_end; vm_eflags_t e_eflags; vm_prot_t e_prot; @@ -155,29 +157,29 @@ procfs_doprocmap(PFS_FILL_ARGS) freepath = NULL; fullpath = "-"; if (lobj) { - vp = NULL; - switch (lobj->type) { - default: - case OBJT_DEFAULT: - type = "default"; - break; - case OBJT_VNODE: - type = "vnode"; - vp = lobj->handle; + kvme = vm_object_kvme_type(lobj, &vp); + if (vp != NULL) vref(vp); + switch (kvme) { + default: + type = "unknown"; break; - case OBJT_SWAP_TMPFS: - type = "vnode"; - if ((lobj->flags & OBJ_TMPFS) != 0) { - vp = lobj->un_pager.swp.swp_tmpfs; - vref(vp); - } + case KVME_TYPE_PHYS: + type = "phys"; break; - case OBJT_SWAP: + case KVME_TYPE_DEFAULT: + case KVME_TYPE_SWAP: type = "swap"; break; - case OBJT_SG: - case OBJT_DEVICE: + case KVME_TYPE_DEAD: + type = "dead"; + break; + case KVME_TYPE_VNODE: + type = "vnode"; + break; + case KVME_TYPE_SG: + case KVME_TYPE_DEVICE: + case KVME_TYPE_MGTDEVICE: type = "device"; break; } From owner-dev-commits-src-main@freebsd.org Thu May 13 17:14:15 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B710628179; Thu, 13 May 2021 17:14:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fgytv1jY3z3Qqy; Thu, 13 May 2021 17:14:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2B6BF22A60; Thu, 13 May 2021 17:14:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DHEF2C063353; Thu, 13 May 2021 17:14:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DHEF6k063352; Thu, 13 May 2021 17:14:15 GMT (envelope-from git) Date: Thu, 13 May 2021 17:14:15 GMT Message-Id: <202105131714.14DHEF6k063352@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 3e7a11ca21f3 - main - vm_object_set_memattr(): handle all object types without listing them explicitly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3e7a11ca21f3a7948c50f27de5b2159f0bb56672 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 17:14:15 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3e7a11ca21f3a7948c50f27de5b2159f0bb56672 commit 3e7a11ca21f3a7948c50f27de5b2159f0bb56672 Author: Konstantin Belousov AuthorDate: 2021-05-07 18:19:30 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-13 17:10:35 +0000 vm_object_set_memattr(): handle all object types without listing them explicitly This avoids the need to know all existing object types in advance, by the cost of loosing the assert that unknown object type is handled in a sane manner. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30168 --- sys/vm/vm_object.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 735ab603a09b..1aa05093f93a 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -330,24 +330,12 @@ vm_object_set_memattr(vm_object_t object, vm_memattr_t memattr) { VM_OBJECT_ASSERT_WLOCKED(object); - switch (object->type) { - case OBJT_DEFAULT: - case OBJT_DEVICE: - case OBJT_MGTDEVICE: - case OBJT_PHYS: - case OBJT_SG: - case OBJT_SWAP: - case OBJT_SWAP_TMPFS: - case OBJT_VNODE: - if (!TAILQ_EMPTY(&object->memq)) - return (KERN_FAILURE); - break; - case OBJT_DEAD: + + if (object->type == OBJT_DEAD) return (KERN_INVALID_ARGUMENT); - default: - panic("vm_object_set_memattr: object %p is of undefined type", - object); - } + if (!TAILQ_EMPTY(&object->memq)) + return (KERN_FAILURE); + object->memattr = memattr; return (KERN_SUCCESS); } From owner-dev-commits-src-main@freebsd.org Thu May 13 17:14:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDD676286AB; Thu, 13 May 2021 17:14:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fgytw3l38z3Qlf; Thu, 13 May 2021 17:14:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5430D22A61; Thu, 13 May 2021 17:14:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DHEGnl063381; Thu, 13 May 2021 17:14:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DHEGPY063380; Thu, 13 May 2021 17:14:16 GMT (envelope-from git) Date: Thu, 13 May 2021 17:14:16 GMT Message-Id: <202105131714.14DHEGPY063380@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 7079449b0b56 - main - sys/vm: remove several other uses of OBJT_SWAP_TMPFS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7079449b0b56d13b4ae7b4039ac8eb7c45c03fb5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 17:14:17 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7079449b0b56d13b4ae7b4039ac8eb7c45c03fb5 commit 7079449b0b56d13b4ae7b4039ac8eb7c45c03fb5 Author: Konstantin Belousov AuthorDate: 2021-05-07 18:21:22 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-13 17:10:35 +0000 sys/vm: remove several other uses of OBJT_SWAP_TMPFS Mostly in cases where OBJ_SWAP flag works as well, or by reversing the condition so that object types can be listed. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30168 --- sys/vm/vm_object.c | 5 +++-- sys/vm/vm_pageout.c | 10 ++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 1aa05093f93a..8cb4c0006c59 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -669,7 +669,8 @@ vm_object_deallocate(vm_object_t object) umtx_shm_object_terminated(object); temp = object->backing_object; if (temp != NULL) { - KASSERT(object->type != OBJT_SWAP_TMPFS, + KASSERT(object->type == OBJT_DEFAULT || + object->type == OBJT_SWAP, ("shadowed tmpfs v_object 2 %p", object)); vm_object_backing_remove(object); } @@ -950,7 +951,7 @@ vm_object_terminate(vm_object_t object) #endif KASSERT(object->cred == NULL || object->type == OBJT_DEFAULT || - object->type == OBJT_SWAP || object->type == OBJT_SWAP_TMPFS, + (object->flags & OBJ_SWAP) != 0, ("%s: non-swap obj %p has cred", __func__, object)); /* diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index 521fc4ce95f2..216e76359631 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -1887,15 +1887,9 @@ vm_pageout_oom_pagecount(struct vmspace *vmspace) if ((entry->eflags & MAP_ENTRY_NEEDS_COPY) != 0 && obj->ref_count != 1) continue; - switch (obj->type) { - case OBJT_DEFAULT: - case OBJT_SWAP: - case OBJT_SWAP_TMPFS: - case OBJT_PHYS: - case OBJT_VNODE: + if (obj->type == OBJT_DEFAULT || obj->type == OBJT_PHYS || + obj->type == OBJT_VNODE || (obj->flags & OBJ_SWAP) != 0) res += obj->resident_page_count; - break; - } } return (res); } From owner-dev-commits-src-main@freebsd.org Thu May 13 17:14:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B55B362817A; Thu, 13 May 2021 17:14:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fgytx44vJz3R2K; Thu, 13 May 2021 17:14:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 793C7226D5; Thu, 13 May 2021 17:14:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DHEH2u063402; Thu, 13 May 2021 17:14:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DHEHd5063401; Thu, 13 May 2021 17:14:17 GMT (envelope-from git) Date: Thu, 13 May 2021 17:14:17 GMT Message-Id: <202105131714.14DHEHd5063401@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: b730fd30b78f - main - vm: Add KPI to dynamically register pagers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b730fd30b78f502ed5dd08e5285cb2c951495d65 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 17:14:17 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b730fd30b78f502ed5dd08e5285cb2c951495d65 commit b730fd30b78f502ed5dd08e5285cb2c951495d65 Author: Konstantin Belousov AuthorDate: 2021-05-07 19:06:16 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-13 17:12:29 +0000 vm: Add KPI to dynamically register pagers Pager is allowed to inherit part of its implementation from the existing pager, which is done by copying non-NULL virtual method slots. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30168 --- sys/vm/vm.h | 1 + sys/vm/vm_object.c | 15 +++++++++- sys/vm/vm_object.h | 1 + sys/vm/vm_pager.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++------- sys/vm/vm_pager.h | 3 ++ 5 files changed, 91 insertions(+), 11 deletions(-) diff --git a/sys/vm/vm.h b/sys/vm/vm.h index 2aae787d7f58..ca310b15b43c 100644 --- a/sys/vm/vm.h +++ b/sys/vm/vm.h @@ -98,6 +98,7 @@ enum obj_type { OBJT_SG, OBJT_MGTDEVICE, OBJT_SWAP_TMPFS, + OBJT_FIRST_DYN, }; typedef u_char objtype_t; diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 8cb4c0006c59..73cbdfb1ece4 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -430,7 +430,8 @@ vm_object_allocate(objtype_t type, vm_pindex_t size) flags = 0; break; default: - panic("vm_object_allocate: type %d is undefined", type); + panic("vm_object_allocate: type %d is undefined or dynamic", + type); } object = (vm_object_t)uma_zalloc(obj_zone, M_WAITOK); _vm_object_allocate(type, size, flags, object, NULL); @@ -438,6 +439,18 @@ vm_object_allocate(objtype_t type, vm_pindex_t size) return (object); } +vm_object_t +vm_object_allocate_dyn(objtype_t dyntype, vm_pindex_t size, u_short flags) +{ + vm_object_t object; + + MPASS(dyntype >= OBJT_FIRST_DYN /* && dyntype < nitems(pagertab) */); + object = (vm_object_t)uma_zalloc(obj_zone, M_WAITOK); + _vm_object_allocate(dyntype, size, flags, object, NULL); + + return (object); +} + /* * vm_object_allocate_anon: * diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index 0e1ed321255f..7e99288e0ff2 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -356,6 +356,7 @@ extern int umtx_shm_vnobj_persistent; vm_object_t vm_object_allocate (objtype_t, vm_pindex_t); vm_object_t vm_object_allocate_anon(vm_pindex_t, vm_object_t, struct ucred *, vm_size_t); +vm_object_t vm_object_allocate_dyn(objtype_t, vm_pindex_t, u_short); boolean_t vm_object_coalesce(vm_object_t, vm_ooffset_t, vm_size_t, vm_size_t, boolean_t); void vm_object_collapse (vm_object_t); diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 9476058a75bf..432a948cfe81 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -165,7 +165,7 @@ static const struct pagerops deadpagerops = { .pgo_getvp = dead_pager_getvp, }; -const struct pagerops *pagertab[] __read_mostly = { +const struct pagerops *pagertab[16] __read_mostly = { [OBJT_DEFAULT] = &defaultpagerops, [OBJT_SWAP] = &swappagerops, [OBJT_VNODE] = &vnodepagerops, @@ -176,18 +176,24 @@ const struct pagerops *pagertab[] __read_mostly = { [OBJT_MGTDEVICE] = &mgtdevicepagerops, [OBJT_SWAP_TMPFS] = &swaptmpfspagerops, }; +static struct mtx pagertab_lock; void vm_pager_init(void) { const struct pagerops **pgops; + int i; + + mtx_init(&pagertab_lock, "dynpag", NULL, MTX_DEF); /* * Initialize known pagers */ - for (pgops = pagertab; pgops < &pagertab[nitems(pagertab)]; pgops++) + for (i = 0; i < OBJT_FIRST_DYN; i++) { + pgops = &pagertab[i]; if ((*pgops)->pgo_init != NULL) (*(*pgops)->pgo_init)(); + } } static int nswbuf_max; @@ -245,15 +251,9 @@ vm_object_t vm_pager_allocate(objtype_t type, void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t off, struct ucred *cred) { - vm_object_t ret; - const struct pagerops *ops; + MPASS(type < nitems(pagertab)); - ops = pagertab[type]; - if (ops) - ret = (*ops->pgo_alloc)(handle, size, prot, off, cred); - else - ret = NULL; - return (ret); + return ((*pagertab[type]->pgo_alloc)(handle, size, prot, off, cred)); } /* @@ -264,6 +264,7 @@ vm_pager_deallocate(vm_object_t object) { VM_OBJECT_ASSERT_WLOCKED(object); + MPASS(object->type < nitems(pagertab)); (*pagertab[object->type]->pgo_dealloc) (object); } @@ -315,6 +316,7 @@ vm_pager_get_pages(vm_object_t object, vm_page_t *m, int count, int *rbehind, #endif int r; + MPASS(object->type < nitems(pagertab)); vm_pager_assert_in(object, m, count); r = (*pagertab[object->type]->pgo_getpages)(object, m, count, rbehind, @@ -348,6 +350,7 @@ vm_pager_get_pages_async(vm_object_t object, vm_page_t *m, int count, int *rbehind, int *rahead, pgo_getpages_iodone_t iodone, void *arg) { + MPASS(object->type < nitems(pagertab)); vm_pager_assert_in(object, m, count); return ((*pagertab[object->type]->pgo_getpages_async)(object, m, @@ -385,6 +388,60 @@ vm_pager_object_lookup(struct pagerlst *pg_list, void *handle) return (object); } +int +vm_pager_alloc_dyn_type(struct pagerops *ops, int base_type) +{ + int res; + + mtx_lock(&pagertab_lock); + MPASS(base_type == -1 || + (base_type >= OBJT_DEFAULT && base_type < nitems(pagertab))); + for (res = OBJT_FIRST_DYN; res < nitems(pagertab); res++) { + if (pagertab[res] == NULL) + break; + } + if (res == nitems(pagertab)) { + mtx_unlock(&pagertab_lock); + return (-1); + } + if (base_type != -1) { + MPASS(pagertab[base_type] != NULL); +#define FIX(n) \ + if (ops->pgo_##n == NULL) \ + ops->pgo_##n = pagertab[base_type]->pgo_##n + FIX(init); + FIX(alloc); + FIX(dealloc); + FIX(getpages); + FIX(getpages_async); + FIX(putpages); + FIX(haspage); + FIX(populate); + FIX(pageunswapped); + FIX(update_writecount); + FIX(release_writecount); + FIX(set_writeable_dirty); + FIX(mightbedirty); + FIX(getvp); + FIX(freespace); +#undef FIX + } + pagertab[res] = ops; /* XXXKIB should be rel, but acq is too much */ + mtx_unlock(&pagertab_lock); + return (res); +} + +void +vm_pager_free_dyn_type(objtype_t type) +{ + MPASS(type >= OBJT_FIRST_DYN && type < nitems(pagertab)); + + mtx_lock(&pagertab_lock); + MPASS(pagertab[type] != NULL); + pagertab[type] = NULL; + mtx_unlock(&pagertab_lock); +} + static int pbuf_ctor(void *mem, int size, void *arg, int flags) { @@ -517,6 +574,8 @@ vm_object_set_writeable_dirty(vm_object_t object) { pgo_set_writeable_dirty_t *method; + MPASS(object->type < nitems(pagertab)); + method = pagertab[object->type]->pgo_set_writeable_dirty; if (method != NULL) method(object); @@ -527,6 +586,8 @@ vm_object_mightbedirty(vm_object_t object) { pgo_mightbedirty_t *method; + MPASS(object->type < nitems(pagertab)); + method = pagertab[object->type]->pgo_mightbedirty; if (method == NULL) return (false); @@ -541,6 +602,7 @@ int vm_object_kvme_type(vm_object_t object, struct vnode **vpp) { VM_OBJECT_ASSERT_LOCKED(object); + MPASS(object->type < nitems(pagertab)); if (vpp != NULL) *vpp = vm_object_vnode(object); diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h index 5e0261f818cf..098d48ea3d9d 100644 --- a/sys/vm/vm_pager.h +++ b/sys/vm/vm_pager.h @@ -249,6 +249,9 @@ vm_pager_freespace(vm_object_t object, vm_pindex_t start, method(object, start, size); } +int vm_pager_alloc_dyn_type(struct pagerops *ops, int base_type); +void vm_pager_free_dyn_type(objtype_t type); + struct cdev_pager_ops { int (*cdev_pg_fault)(vm_object_t vm_obj, vm_ooffset_t offset, int prot, vm_page_t *mres); From owner-dev-commits-src-main@freebsd.org Thu May 13 17:14:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2AFD662807F; Thu, 13 May 2021 17:14:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fgyty5Vqsz3QrH; Thu, 13 May 2021 17:14:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A04DC2295E; Thu, 13 May 2021 17:14:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DHEISH063423; Thu, 13 May 2021 17:14:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DHEI6P063422; Thu, 13 May 2021 17:14:18 GMT (envelope-from git) Date: Thu, 13 May 2021 17:14:18 GMT Message-Id: <202105131714.14DHEI6P063422@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 28bc23ab92ce - main - tmpfs: dynamically register tmpfs pager MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 28bc23ab92ce7393aab48da7d71ccde63592ff2d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 17:14:19 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=28bc23ab92ce7393aab48da7d71ccde63592ff2d commit 28bc23ab92ce7393aab48da7d71ccde63592ff2d Author: Konstantin Belousov AuthorDate: 2021-05-07 19:42:06 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-13 17:13:34 +0000 tmpfs: dynamically register tmpfs pager Remove OBJT_SWAP_TMPFS. Move tmpfs-specific swap pager bits into tmpfs_subr.c. There is no longer any code to directly support tmpfs in sys/vm, most tmpfs knowledge is shared by non-anon swap object type implementation. The tmpfs-specific methods are provided by registered tmpfs pager, which inherits from the swap pager. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30168 --- sys/fs/tmpfs/tmpfs.h | 6 ++- sys/fs/tmpfs/tmpfs_subr.c | 70 ++++++++++++++++++++++++++++++++-- sys/fs/tmpfs/tmpfs_vfsops.c | 14 ++++--- sys/fs/tmpfs/tmpfs_vnops.c | 2 +- sys/vm/swap_pager.c | 93 ++++++++++----------------------------------- sys/vm/swap_pager.h | 3 +- sys/vm/vm.h | 1 - sys/vm/vm_object.c | 1 - sys/vm/vm_object.h | 2 +- sys/vm/vm_pager.c | 1 - 10 files changed, 106 insertions(+), 87 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h index 28493a550252..549339d9b6d1 100644 --- a/sys/fs/tmpfs/tmpfs.h +++ b/sys/fs/tmpfs/tmpfs.h @@ -45,6 +45,8 @@ MALLOC_DECLARE(M_TMPFSNAME); #endif +#define OBJ_TMPFS OBJ_PAGERPRIV /* has tmpfs vnode allocated */ + /* * Internal representation of a tmpfs directory entry. */ @@ -514,9 +516,11 @@ tmpfs_update(struct vnode *vp) size_t tmpfs_mem_avail(void); size_t tmpfs_pages_used(struct tmpfs_mount *tmp); -void tmpfs_subr_init(void); +int tmpfs_subr_init(void); void tmpfs_subr_uninit(void); +extern int tmpfs_pager_type; + /* * Macros/functions to convert from generic data structures to tmpfs * specific ones. diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 1ea4cf23b314..67eb12598e24 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -79,6 +80,61 @@ MALLOC_DEFINE(M_TMPFSDIR, "tmpfs dir", "tmpfs dirent structure"); static uma_zone_t tmpfs_node_pool; VFS_SMR_DECLARE; +int tmpfs_pager_type = -1; + +static vm_object_t +tmpfs_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, + vm_ooffset_t offset, struct ucred *cred) +{ + vm_object_t object; + + MPASS(handle == NULL); + MPASS(offset == 0); + object = vm_object_allocate_dyn(tmpfs_pager_type, size, + OBJ_COLORED | OBJ_SWAP); + if (!swap_pager_init_object(object, NULL, NULL, size, 0)) { + vm_object_deallocate(object); + object = NULL; + } + return (object); +} + +static void +tmpfs_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) +{ + struct vnode *vp; + + /* + * Tmpfs VREG node, which was reclaimed, has tmpfs_pager_type + * type, but not OBJ_TMPFS flag. In this case there is no + * v_writecount to adjust. + */ + if (vp_heldp != NULL) + VM_OBJECT_RLOCK(object); + else + VM_OBJECT_ASSERT_LOCKED(object); + if ((object->flags & OBJ_TMPFS) != 0) { + vp = object->un_pager.swp.swp_tmpfs; + if (vp != NULL) { + *vpp = vp; + if (vp_heldp != NULL) { + vhold(vp); + *vp_heldp = true; + } + } + } + if (vp_heldp != NULL) + VM_OBJECT_RUNLOCK(object); +} + +struct pagerops tmpfs_pager_ops = { + .pgo_kvme_type = KVME_TYPE_VNODE, + .pgo_alloc = tmpfs_pager_alloc, + .pgo_set_writeable_dirty = vm_object_set_writeable_dirty_, + .pgo_mightbedirty = vm_object_mightbedirty_, + .pgo_getvp = tmpfs_pager_getvp, +}; + static int tmpfs_node_ctor(void *mem, int size, void *arg, int flags) { @@ -126,18 +182,26 @@ tmpfs_node_fini(void *mem, int size) mtx_destroy(&node->tn_interlock); } -void +int tmpfs_subr_init(void) { + tmpfs_pager_type = vm_pager_alloc_dyn_type(&tmpfs_pager_ops, + OBJT_SWAP); + if (tmpfs_pager_type == -1) + return (EINVAL); tmpfs_node_pool = uma_zcreate("TMPFS node", sizeof(struct tmpfs_node), tmpfs_node_ctor, tmpfs_node_dtor, tmpfs_node_init, tmpfs_node_fini, UMA_ALIGN_PTR, 0); VFS_SMR_ZONE_SET(tmpfs_node_pool); + return (0); } void tmpfs_subr_uninit(void) { + if (tmpfs_pager_type != -1) + vm_pager_free_dyn_type(tmpfs_pager_type); + tmpfs_pager_type = -1; uma_zdestroy(tmpfs_node_pool); } @@ -364,7 +428,7 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type, case VREG: obj = nnode->tn_reg.tn_aobj = - vm_pager_allocate(OBJT_SWAP_TMPFS, NULL, 0, + vm_pager_allocate(tmpfs_pager_type, NULL, 0, VM_PROT_DEFAULT, 0, NULL /* XXXKIB - tmpfs needs swap reservation */); /* OBJ_TMPFS is set together with the setting of vp->v_object */ @@ -1588,7 +1652,7 @@ tmpfs_check_mtime(struct vnode *vp) if (vp->v_type != VREG) return; obj = vp->v_object; - KASSERT(obj->type == OBJT_SWAP_TMPFS && + KASSERT(obj->type == tmpfs_pager_type && (obj->flags & (OBJ_SWAP | OBJ_TMPFS)) == (OBJ_SWAP | OBJ_TMPFS), ("non-tmpfs obj")); /* unlocked read */ diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index 51d097203135..4f29b5dfc6f0 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -103,8 +103,8 @@ static const char *tmpfs_updateopts[] = { * Handle updates of time from writes to mmaped regions, if allowed. * Use MNT_VNODE_FOREACH_ALL instead of MNT_VNODE_FOREACH_LAZY, since * unmap of the tmpfs-backed vnode does not call vinactive(), due to - * vm object type is OBJT_SWAP. If lazy, only handle delayed update - * of mtime due to the writes to mapped files. + * vm object type is basically OBJT_SWAP. If lazy, only handle + * delayed update of mtime due to the writes to mapped files. */ static void tmpfs_update_mtime(struct mount *mp, bool lazy) @@ -120,7 +120,7 @@ tmpfs_update_mtime(struct mount *mp, bool lazy) continue; } obj = vp->v_object; - MPASS(obj->type == OBJT_SWAP_TMPFS); + MPASS(obj->type == tmpfs_pager_type); MPASS((obj->flags & OBJ_TMPFS) != 0); /* @@ -225,7 +225,7 @@ again: (entry->max_protection & VM_PROT_WRITE) == 0) continue; object = entry->object.vm_object; - if (object == NULL || object->type != OBJT_SWAP_TMPFS) + if (object == NULL || object->type != tmpfs_pager_type) continue; /* * No need to dig into shadow chain, mapping @@ -661,7 +661,11 @@ tmpfs_sync(struct mount *mp, int waitfor) static int tmpfs_init(struct vfsconf *conf) { - tmpfs_subr_init(); + int res; + + res = tmpfs_subr_init(); + if (res != 0) + return (res); memcpy(&tmpfs_fnops, &vnops, sizeof(struct fileops)); tmpfs_fnops.fo_close = tmpfs_fo_close; return (0); diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 401ee672b96a..43a2aa77dbbb 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -623,7 +623,7 @@ tmpfs_read_pgcache(struct vop_read_pgcache_args *v) if (object == NULL) goto out_smr; - MPASS(object->type == OBJT_SWAP_TMPFS); + MPASS(object->type == tmpfs_pager_type); MPASS((object->flags & (OBJ_ANON | OBJ_DEAD | OBJ_SWAP)) == OBJ_SWAP); if (!VN_IS_DOOMED(vp)) { diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 37db4cbac857..63f0d22ed705 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -419,9 +419,6 @@ static uma_zone_t swpctrie_zone; static vm_object_t swap_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t offset, struct ucred *); -static vm_object_t - swap_tmpfs_pager_alloc(void *handle, vm_ooffset_t size, - vm_prot_t prot, vm_ooffset_t offset, struct ucred *); static void swap_pager_dealloc(vm_object_t object); static int swap_pager_getpages(vm_object_t, vm_page_t *, int, int *, int *); @@ -437,8 +434,6 @@ static void swap_pager_update_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); static void swap_pager_release_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end); -static void swap_tmpfs_pager_getvp(vm_object_t object, struct vnode **vpp, - bool *vp_heldp); static void swap_pager_freespace(vm_object_t object, vm_pindex_t start, vm_size_t size); @@ -457,23 +452,6 @@ const struct pagerops swappagerops = { .pgo_freespace = swap_pager_freespace, }; -const struct pagerops swaptmpfspagerops = { - .pgo_kvme_type = KVME_TYPE_VNODE, - .pgo_alloc = swap_tmpfs_pager_alloc, - .pgo_dealloc = swap_pager_dealloc, - .pgo_getpages = swap_pager_getpages, - .pgo_getpages_async = swap_pager_getpages_async, - .pgo_putpages = swap_pager_putpages, - .pgo_haspage = swap_pager_haspage, - .pgo_pageunswapped = swap_pager_unswapped, - .pgo_update_writecount = swap_pager_update_writecount, - .pgo_release_writecount = swap_pager_release_writecount, - .pgo_set_writeable_dirty = vm_object_set_writeable_dirty_, - .pgo_mightbedirty = vm_object_mightbedirty_, - .pgo_getvp = swap_tmpfs_pager_getvp, - .pgo_freespace = swap_pager_freespace, -}; - /* * swap_*() routines are externally accessible. swp_*() routines are * internal. @@ -681,18 +659,31 @@ swap_pager_swap_init(void) "reduce kern.maxswzone.\n"); } -static vm_object_t -swap_pager_alloc_init(objtype_t otype, void *handle, struct ucred *cred, +bool +swap_pager_init_object(vm_object_t object, void *handle, struct ucred *cred, vm_ooffset_t size, vm_ooffset_t offset) { - vm_object_t object; - if (cred != NULL) { if (!swap_reserve_by_cred(size, cred)) - return (NULL); + return (false); crhold(cred); } + object->un_pager.swp.writemappings = 0; + object->handle = handle; + if (cred != NULL) { + object->cred = cred; + object->charge = size; + } + return (true); +} + +static vm_object_t +swap_pager_alloc_init(objtype_t otype, void *handle, struct ucred *cred, + vm_ooffset_t size, vm_ooffset_t offset) +{ + vm_object_t object; + /* * The un_pager.swp.swp_blks trie is initialized by * vm_object_allocate() to ensure the correct order of @@ -701,11 +692,9 @@ swap_pager_alloc_init(objtype_t otype, void *handle, struct ucred *cred, object = vm_object_allocate(otype, OFF_TO_IDX(offset + PAGE_MASK + size)); - object->un_pager.swp.writemappings = 0; - object->handle = handle; - if (cred != NULL) { - object->cred = cred; - object->charge = size; + if (!swap_pager_init_object(object, handle, cred, size, offset)) { + vm_object_deallocate(object); + return (NULL); } return (object); } @@ -752,18 +741,6 @@ swap_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, return (object); } -static vm_object_t -swap_tmpfs_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, - vm_ooffset_t offset, struct ucred *cred) -{ - vm_object_t object; - - MPASS(handle == NULL); - object = swap_pager_alloc_init(OBJT_SWAP_TMPFS, handle, cred, - size, offset); - return (object); -} - /* * SWAP_PAGER_DEALLOC() - remove swap metadata from object * @@ -3168,31 +3145,3 @@ swap_pager_release_writecount(vm_object_t object, vm_offset_t start, object->un_pager.swp.writemappings -= (vm_ooffset_t)end - start; VM_OBJECT_WUNLOCK(object); } - -static void -swap_tmpfs_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) -{ - struct vnode *vp; - - /* - * Tmpfs VREG node, which was reclaimed, has OBJT_SWAP_TMPFS - * type, but not OBJ_TMPFS flag. In this case there is no - * v_writecount to adjust. - */ - if (vp_heldp != NULL) - VM_OBJECT_RLOCK(object); - else - VM_OBJECT_ASSERT_LOCKED(object); - if ((object->flags & OBJ_TMPFS) != 0) { - vp = object->un_pager.swp.swp_tmpfs; - if (vp != NULL) { - *vpp = vp; - if (vp_heldp != NULL) { - vhold(vp); - *vp_heldp = true; - } - } - } - if (vp_heldp != NULL) - VM_OBJECT_RUNLOCK(object); -} diff --git a/sys/vm/swap_pager.h b/sys/vm/swap_pager.h index 7a2ea12e887d..20ff70acc3d8 100644 --- a/sys/vm/swap_pager.h +++ b/sys/vm/swap_pager.h @@ -82,6 +82,7 @@ int swap_pager_reserve(vm_object_t, vm_pindex_t, vm_size_t); void swap_pager_status(int *total, int *used); u_long swap_pager_swapped_pages(vm_object_t object); void swapoff_all(void); - +bool swap_pager_init_object(vm_object_t object, void *handle, + struct ucred *cred, vm_ooffset_t size, vm_ooffset_t offset); #endif /* _KERNEL */ #endif /* _VM_SWAP_PAGER_H_ */ diff --git a/sys/vm/vm.h b/sys/vm/vm.h index ca310b15b43c..8dce853e684d 100644 --- a/sys/vm/vm.h +++ b/sys/vm/vm.h @@ -97,7 +97,6 @@ enum obj_type { OBJT_DEAD, OBJT_SG, OBJT_MGTDEVICE, - OBJT_SWAP_TMPFS, OBJT_FIRST_DYN, }; typedef u_char objtype_t; diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 73cbdfb1ece4..9bd3f416ff94 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -413,7 +413,6 @@ vm_object_allocate(objtype_t type, vm_pindex_t size) flags = OBJ_COLORED; break; case OBJT_SWAP: - case OBJT_SWAP_TMPFS: flags = OBJ_COLORED | OBJ_SWAP; break; case OBJT_DEVICE: diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index 7e99288e0ff2..d159c621d2e6 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -207,7 +207,7 @@ struct vm_object { #define OBJ_COLORED 0x1000 /* pg_color is defined */ #define OBJ_ONEMAPPING 0x2000 /* One USE (a single, non-forked) mapping flag */ #define OBJ_SHADOWLIST 0x4000 /* Object is on the shadow list. */ -#define OBJ_TMPFS 0x8000 /* has tmpfs vnode allocated */ +#define OBJ_PAGERPRIV 0x8000 /* Pager private */ /* * Helpers to perform conversion between vm_object page indexes and offsets. diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 432a948cfe81..640e3d977e99 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -174,7 +174,6 @@ const struct pagerops *pagertab[16] __read_mostly = { [OBJT_DEAD] = &deadpagerops, [OBJT_SG] = &sgpagerops, [OBJT_MGTDEVICE] = &mgtdevicepagerops, - [OBJT_SWAP_TMPFS] = &swaptmpfspagerops, }; static struct mtx pagertab_lock; From owner-dev-commits-src-main@freebsd.org Thu May 13 18:11:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52D0D629C6A; Thu, 13 May 2021 18:11:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fh08Y1twdz3kQL; Thu, 13 May 2021 18:11:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 294632378C; Thu, 13 May 2021 18:11:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DIB9Zb045613; Thu, 13 May 2021 18:11:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DIB9Lj045612; Thu, 13 May 2021 18:11:09 GMT (envelope-from git) Date: Thu, 13 May 2021 18:11:09 GMT Message-Id: <202105131811.14DIB9Lj045612@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: ad385f7b46e7 - main - makesyscalls.lua: improve generated file style(9) compliance MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ad385f7b46e7636b11fb0fd56bc42b60b06b16ad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 18:11:09 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=ad385f7b46e7636b11fb0fd56bc42b60b06b16ad commit ad385f7b46e7636b11fb0fd56bc42b60b06b16ad Author: Ed Maste AuthorDate: 2021-05-12 20:11:44 +0000 Commit: Ed Maste CommitDate: 2021-05-13 17:59:25 +0000 makesyscalls.lua: improve generated file style(9) compliance We generally like to avoid style changes when other changes are not planned. In this case there are some makesyscalls.lua changes in the pipeline, and this cleans up style nits in generated files that were highlighted by experiments with clang-format. Reviewed by: brooks, kevans MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30235 --- sys/tools/makesyscalls.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/tools/makesyscalls.lua b/sys/tools/makesyscalls.lua index 3b88c65c4440..dab8e0e01f82 100644 --- a/sys/tools/makesyscalls.lua +++ b/sys/tools/makesyscalls.lua @@ -648,7 +648,7 @@ local function handle_noncompat(sysnum, thr_flag, flags, sysflags, rettype, ]], funcname, sysnum)) if #funcargs > 0 then - write_line("systracetmp", "\t\tswitch(ndx) {\n") + write_line("systracetmp", "\t\tswitch (ndx) {\n") write_line("systrace", string.format( "\t\tstruct %s *p = params;\n", argalias)) @@ -671,7 +671,7 @@ local function handle_noncompat(sysnum, thr_flag, flags, sysflags, rettype, if isptrtype(argtype) then write_line("systrace", string.format( - "\t\tuarg[%d] = (%s) p->%s; /* %s */\n", + "\t\tuarg[%d] = (%s)p->%s; /* %s */\n", idx - 1, config["ptr_intptr_t_cast"], argname, argtype)) elseif argtype == "union l_semun" then @@ -1285,7 +1285,7 @@ write_line("systrace", string.format([[/* static void systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) { - int64_t *iarg = (int64_t *) uarg; + int64_t *iarg = (int64_t *)uarg; switch (sysnum) { ]], generated_tag, config['os_id_keyword'])) @@ -1316,7 +1316,7 @@ for _, v in pairs(compat_options) do write_line("sysinc", string.format([[ #ifdef %s -#define %s(n, name) .sy_narg = n, .sy_call = (sy_call_t *)__CONCAT(%s,name) +#define %s(n, name) .sy_narg = n, .sy_call = (sy_call_t *)__CONCAT(%s, name) #else #define %s(n, name) .sy_narg = 0, .sy_call = (sy_call_t *)nosys #endif From owner-dev-commits-src-main@freebsd.org Thu May 13 18:11:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ECAE7629C7D; Thu, 13 May 2021 18:11:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fh08Z4Pkyz3k46; Thu, 13 May 2021 18:11:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8439123345; Thu, 13 May 2021 18:11:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DIBARB045634; Thu, 13 May 2021 18:11:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DIBA1p045633; Thu, 13 May 2021 18:11:10 GMT (envelope-from git) Date: Thu, 13 May 2021 18:11:10 GMT Message-Id: <202105131811.14DIBA1p045633@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 2c9764f36b6f - main - regen syscall files after d51198d63b63 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2c9764f36b6f20e9a6c71ce64a21988a394050b6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 18:11:11 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=2c9764f36b6f20e9a6c71ce64a21988a394050b6 commit 2c9764f36b6f20e9a6c71ce64a21988a394050b6 Author: Ed Maste AuthorDate: 2021-05-13 17:58:04 +0000 Commit: Ed Maste CommitDate: 2021-05-13 18:09:58 +0000 regen syscall files after d51198d63b63 --- sys/amd64/linux/linux_systrace_args.c | 1052 +++++++------- sys/amd64/linux32/linux32_systrace_args.c | 1212 ++++++++-------- sys/arm/linux/linux_systrace_args.c | 946 ++++++------- sys/arm64/linux/linux_systrace_args.c | 888 ++++++------ sys/compat/cloudabi32/cloudabi32_systrace_args.c | 182 +-- sys/compat/cloudabi64/cloudabi64_systrace_args.c | 182 +-- sys/compat/freebsd32/freebsd32_sysent.c | 14 +- sys/compat/freebsd32/freebsd32_systrace_args.c | 1568 ++++++++++----------- sys/i386/linux/linux_systrace_args.c | 1232 ++++++++-------- sys/kern/init_sysent.c | 14 +- sys/kern/systrace_args.c | 1632 +++++++++++----------- 11 files changed, 4461 insertions(+), 4461 deletions(-) diff --git a/sys/amd64/linux/linux_systrace_args.c b/sys/amd64/linux/linux_systrace_args.c index 5aa83b94e7a3..daacb1af287c 100644 --- a/sys/amd64/linux/linux_systrace_args.c +++ b/sys/amd64/linux/linux_systrace_args.c @@ -9,14 +9,14 @@ static void systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) { - int64_t *iarg = (int64_t *) uarg; + int64_t *iarg = (int64_t *)uarg; switch (sysnum) { #define nosys linux_nosys /* read */ case 0: { struct read_args *p = params; iarg[0] = p->fd; /* int */ - uarg[1] = (intptr_t) p->buf; /* char * */ + uarg[1] = (intptr_t)p->buf; /* char * */ iarg[2] = p->nbyte; /* l_size_t */ *n_args = 3; break; @@ -25,7 +25,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 1: { struct write_args *p = params; iarg[0] = p->fd; /* int */ - uarg[1] = (intptr_t) p->buf; /* char * */ + uarg[1] = (intptr_t)p->buf; /* char * */ iarg[2] = p->nbyte; /* l_size_t */ *n_args = 3; break; @@ -33,7 +33,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_open */ case 2: { struct linux_open_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ iarg[1] = p->flags; /* l_int */ iarg[2] = p->mode; /* l_mode_t */ *n_args = 3; @@ -49,8 +49,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_newstat */ case 4: { struct linux_newstat_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ - uarg[1] = (intptr_t) p->buf; /* struct l_newstat * */ + uarg[0] = (intptr_t)p->path; /* char * */ + uarg[1] = (intptr_t)p->buf; /* struct l_newstat * */ *n_args = 2; break; } @@ -58,22 +58,22 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 5: { struct linux_newfstat_args *p = params; iarg[0] = p->fd; /* l_uint */ - uarg[1] = (intptr_t) p->buf; /* struct l_newstat * */ + uarg[1] = (intptr_t)p->buf; /* struct l_newstat * */ *n_args = 2; break; } /* linux_newlstat */ case 6: { struct linux_newlstat_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ - uarg[1] = (intptr_t) p->buf; /* struct l_newstat * */ + uarg[0] = (intptr_t)p->path; /* char * */ + uarg[1] = (intptr_t)p->buf; /* struct l_newstat * */ *n_args = 2; break; } /* poll */ case 7: { struct poll_args *p = params; - uarg[0] = (intptr_t) p->fds; /* struct pollfd * */ + uarg[0] = (intptr_t)p->fds; /* struct pollfd * */ uarg[1] = p->nfds; /* u_int */ iarg[2] = p->timeout; /* int */ *n_args = 3; @@ -112,7 +112,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* munmap */ case 11: { struct munmap_args *p = params; - uarg[0] = (intptr_t) p->addr; /* void * */ + uarg[0] = (intptr_t)p->addr; /* void * */ iarg[1] = p->len; /* l_size_t */ *n_args = 2; break; @@ -128,8 +128,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 13: { struct linux_rt_sigaction_args *p = params; iarg[0] = p->sig; /* l_int */ - uarg[1] = (intptr_t) p->act; /* l_sigaction_t * */ - uarg[2] = (intptr_t) p->oact; /* l_sigaction_t * */ + uarg[1] = (intptr_t)p->act; /* l_sigaction_t * */ + uarg[2] = (intptr_t)p->oact; /* l_sigaction_t * */ iarg[3] = p->sigsetsize; /* l_size_t */ *n_args = 4; break; @@ -138,8 +138,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 14: { struct linux_rt_sigprocmask_args *p = params; iarg[0] = p->how; /* l_int */ - uarg[1] = (intptr_t) p->mask; /* l_sigset_t * */ - uarg[2] = (intptr_t) p->omask; /* l_sigset_t * */ + uarg[1] = (intptr_t)p->mask; /* l_sigset_t * */ + uarg[2] = (intptr_t)p->omask; /* l_sigset_t * */ iarg[3] = p->sigsetsize; /* l_size_t */ *n_args = 4; break; @@ -147,7 +147,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_rt_sigreturn */ case 15: { struct linux_rt_sigreturn_args *p = params; - uarg[0] = (intptr_t) p->ucp; /* struct l_ucontext * */ + uarg[0] = (intptr_t)p->ucp; /* struct l_ucontext * */ *n_args = 1; break; } @@ -164,7 +164,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 17: { struct linux_pread_args *p = params; iarg[0] = p->fd; /* l_uint */ - uarg[1] = (intptr_t) p->buf; /* char * */ + uarg[1] = (intptr_t)p->buf; /* char * */ iarg[2] = p->nbyte; /* l_size_t */ iarg[3] = p->offset; /* l_loff_t */ *n_args = 4; @@ -174,7 +174,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 18: { struct linux_pwrite_args *p = params; iarg[0] = p->fd; /* l_uint */ - uarg[1] = (intptr_t) p->buf; /* char * */ + uarg[1] = (intptr_t)p->buf; /* char * */ iarg[2] = p->nbyte; /* l_size_t */ iarg[3] = p->offset; /* l_loff_t */ *n_args = 4; @@ -184,7 +184,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 19: { struct readv_args *p = params; iarg[0] = p->fd; /* int */ - uarg[1] = (intptr_t) p->iovp; /* struct iovec * */ + uarg[1] = (intptr_t)p->iovp; /* struct iovec * */ uarg[2] = p->iovcnt; /* u_int */ *n_args = 3; break; @@ -193,7 +193,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 20: { struct writev_args *p = params; iarg[0] = p->fd; /* int */ - uarg[1] = (intptr_t) p->iovp; /* struct iovec * */ + uarg[1] = (intptr_t)p->iovp; /* struct iovec * */ uarg[2] = p->iovcnt; /* u_int */ *n_args = 3; break; @@ -201,7 +201,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_access */ case 21: { struct linux_access_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ iarg[1] = p->amode; /* l_int */ *n_args = 2; break; @@ -209,7 +209,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_pipe */ case 22: { struct linux_pipe_args *p = params; - uarg[0] = (intptr_t) p->pipefds; /* l_int * */ + uarg[0] = (intptr_t)p->pipefds; /* l_int * */ *n_args = 1; break; } @@ -217,10 +217,10 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 23: { struct linux_select_args *p = params; iarg[0] = p->nfds; /* l_int */ - uarg[1] = (intptr_t) p->readfds; /* l_fd_set * */ - uarg[2] = (intptr_t) p->writefds; /* l_fd_set * */ - uarg[3] = (intptr_t) p->exceptfds; /* l_fd_set * */ - uarg[4] = (intptr_t) p->timeout; /* struct l_timeval * */ + uarg[1] = (intptr_t)p->readfds; /* l_fd_set * */ + uarg[2] = (intptr_t)p->writefds; /* l_fd_set * */ + uarg[3] = (intptr_t)p->exceptfds; /* l_fd_set * */ + uarg[4] = (intptr_t)p->timeout; /* struct l_timeval * */ *n_args = 5; break; } @@ -254,7 +254,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_mincore_args *p = params; iarg[0] = p->start; /* l_ulong */ iarg[1] = p->len; /* l_size_t */ - uarg[2] = (intptr_t) p->vec; /* u_char * */ + uarg[2] = (intptr_t)p->vec; /* u_char * */ *n_args = 3; break; } @@ -280,7 +280,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 30: { struct linux_shmat_args *p = params; iarg[0] = p->shmid; /* l_int */ - uarg[1] = (intptr_t) p->shmaddr; /* char * */ + uarg[1] = (intptr_t)p->shmaddr; /* char * */ iarg[2] = p->shmflg; /* l_int */ *n_args = 3; break; @@ -290,7 +290,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_shmctl_args *p = params; iarg[0] = p->shmid; /* l_int */ iarg[1] = p->cmd; /* l_int */ - uarg[2] = (intptr_t) p->buf; /* struct l_shmid_ds * */ + uarg[2] = (intptr_t)p->buf; /* struct l_shmid_ds * */ *n_args = 3; break; } @@ -317,8 +317,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_nanosleep */ case 35: { struct linux_nanosleep_args *p = params; - uarg[0] = (intptr_t) p->rqtp; /* const struct l_timespec * */ - uarg[1] = (intptr_t) p->rmtp; /* struct l_timespec * */ + uarg[0] = (intptr_t)p->rqtp; /* const struct l_timespec * */ + uarg[1] = (intptr_t)p->rmtp; /* struct l_timespec * */ *n_args = 2; break; } @@ -326,7 +326,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 36: { struct linux_getitimer_args *p = params; iarg[0] = p->which; /* l_int */ - uarg[1] = (intptr_t) p->itv; /* struct l_itimerval * */ + uarg[1] = (intptr_t)p->itv; /* struct l_itimerval * */ *n_args = 2; break; } @@ -341,8 +341,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 38: { struct linux_setitimer_args *p = params; iarg[0] = p->which; /* l_int */ - uarg[1] = (intptr_t) p->itv; /* struct l_itimerval * */ - uarg[2] = (intptr_t) p->oitv; /* struct l_itimerval * */ + uarg[1] = (intptr_t)p->itv; /* struct l_itimerval * */ + uarg[2] = (intptr_t)p->oitv; /* struct l_itimerval * */ *n_args = 3; break; } @@ -356,7 +356,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_sendfile_args *p = params; iarg[0] = p->out; /* l_int */ iarg[1] = p->in; /* l_int */ - uarg[2] = (intptr_t) p->offset; /* l_off_t * */ + uarg[2] = (intptr_t)p->offset; /* l_off_t * */ iarg[3] = p->count; /* l_size_t */ *n_args = 4; break; @@ -509,10 +509,10 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 56: { struct linux_clone_args *p = params; iarg[0] = p->flags; /* l_ulong */ - uarg[1] = (intptr_t) p->stack; /* void * */ - uarg[2] = (intptr_t) p->parent_tidptr; /* void * */ - uarg[3] = (intptr_t) p->child_tidptr; /* void * */ - uarg[4] = (intptr_t) p->tls; /* void * */ + uarg[1] = (intptr_t)p->stack; /* void * */ + uarg[2] = (intptr_t)p->parent_tidptr; /* void * */ + uarg[3] = (intptr_t)p->child_tidptr; /* void * */ + uarg[4] = (intptr_t)p->tls; /* void * */ *n_args = 5; break; } @@ -529,9 +529,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_execve */ case 59: { struct linux_execve_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ - uarg[1] = (intptr_t) p->argp; /* char ** */ - uarg[2] = (intptr_t) p->envp; /* char ** */ + uarg[0] = (intptr_t)p->path; /* char * */ + uarg[1] = (intptr_t)p->argp; /* char ** */ + uarg[2] = (intptr_t)p->envp; /* char ** */ *n_args = 3; break; } @@ -546,9 +546,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 61: { struct linux_wait4_args *p = params; iarg[0] = p->pid; /* l_pid_t */ - uarg[1] = (intptr_t) p->status; /* l_int * */ + uarg[1] = (intptr_t)p->status; /* l_int * */ iarg[2] = p->options; /* l_int */ - uarg[3] = (intptr_t) p->rusage; /* struct rusage * */ + uarg[3] = (intptr_t)p->rusage; /* struct rusage * */ *n_args = 4; break; } @@ -563,7 +563,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_newuname */ case 63: { struct linux_newuname_args *p = params; - uarg[0] = (intptr_t) p->buf; /* struct l_new_utsname * */ + uarg[0] = (intptr_t)p->buf; /* struct l_new_utsname * */ *n_args = 1; break; } @@ -580,7 +580,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 65: { struct linux_semop_args *p = params; iarg[0] = p->semid; /* l_int */ - uarg[1] = (intptr_t) p->tsops; /* struct l_sembuf * */ + uarg[1] = (intptr_t)p->tsops; /* struct l_sembuf * */ iarg[2] = p->nsops; /* l_uint */ *n_args = 3; break; @@ -598,7 +598,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_shmdt */ case 67: { struct linux_shmdt_args *p = params; - uarg[0] = (intptr_t) p->shmaddr; /* char * */ + uarg[0] = (intptr_t)p->shmaddr; /* char * */ *n_args = 1; break; } @@ -614,7 +614,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 69: { struct linux_msgsnd_args *p = params; iarg[0] = p->msqid; /* l_int */ - uarg[1] = (intptr_t) p->msgp; /* struct l_msgbuf * */ + uarg[1] = (intptr_t)p->msgp; /* struct l_msgbuf * */ iarg[2] = p->msgsz; /* l_size_t */ iarg[3] = p->msgflg; /* l_int */ *n_args = 4; @@ -624,7 +624,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 70: { struct linux_msgrcv_args *p = params; iarg[0] = p->msqid; /* l_int */ - uarg[1] = (intptr_t) p->msgp; /* struct l_msgbuf * */ + uarg[1] = (intptr_t)p->msgp; /* struct l_msgbuf * */ iarg[2] = p->msgsz; /* l_size_t */ iarg[3] = p->msgtyp; /* l_long */ iarg[4] = p->msgflg; /* l_int */ @@ -636,7 +636,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_msgctl_args *p = params; iarg[0] = p->msqid; /* l_int */ iarg[1] = p->cmd; /* l_int */ - uarg[2] = (intptr_t) p->buf; /* struct l_msqid_ds * */ + uarg[2] = (intptr_t)p->buf; /* struct l_msqid_ds * */ *n_args = 3; break; } @@ -674,7 +674,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_truncate */ case 76: { struct linux_truncate_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ iarg[1] = p->length; /* l_long */ *n_args = 2; break; @@ -691,7 +691,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 78: { struct linux_getdents_args *p = params; iarg[0] = p->fd; /* l_uint */ - uarg[1] = (intptr_t) p->dent; /* void * */ + uarg[1] = (intptr_t)p->dent; /* void * */ iarg[2] = p->count; /* l_uint */ *n_args = 3; break; @@ -699,7 +699,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_getcwd */ case 79: { struct linux_getcwd_args *p = params; - uarg[0] = (intptr_t) p->buf; /* char * */ + uarg[0] = (intptr_t)p->buf; /* char * */ iarg[1] = p->bufsize; /* l_ulong */ *n_args = 2; break; @@ -707,7 +707,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_chdir */ case 80: { struct linux_chdir_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ *n_args = 1; break; } @@ -721,15 +721,15 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_rename */ case 82: { struct linux_rename_args *p = params; - uarg[0] = (intptr_t) p->from; /* char * */ - uarg[1] = (intptr_t) p->to; /* char * */ + uarg[0] = (intptr_t)p->from; /* char * */ + uarg[1] = (intptr_t)p->to; /* char * */ *n_args = 2; break; } /* linux_mkdir */ case 83: { struct linux_mkdir_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ iarg[1] = p->mode; /* l_mode_t */ *n_args = 2; break; @@ -737,14 +737,14 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_rmdir */ case 84: { struct linux_rmdir_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ *n_args = 1; break; } /* linux_creat */ case 85: { struct linux_creat_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ iarg[1] = p->mode; /* l_mode_t */ *n_args = 2; break; @@ -752,31 +752,31 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_link */ case 86: { struct linux_link_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ - uarg[1] = (intptr_t) p->to; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ + uarg[1] = (intptr_t)p->to; /* char * */ *n_args = 2; break; } /* linux_unlink */ case 87: { struct linux_unlink_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ *n_args = 1; break; } /* linux_symlink */ case 88: { struct linux_symlink_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ - uarg[1] = (intptr_t) p->to; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ + uarg[1] = (intptr_t)p->to; /* char * */ *n_args = 2; break; } /* linux_readlink */ case 89: { struct linux_readlink_args *p = params; - uarg[0] = (intptr_t) p->name; /* char * */ - uarg[1] = (intptr_t) p->buf; /* char * */ + uarg[0] = (intptr_t)p->name; /* char * */ + uarg[1] = (intptr_t)p->buf; /* char * */ iarg[2] = p->count; /* l_int */ *n_args = 3; break; @@ -784,7 +784,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_chmod */ case 90: { struct linux_chmod_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ iarg[1] = p->mode; /* l_mode_t */ *n_args = 2; break; @@ -800,7 +800,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_chown */ case 92: { struct linux_chown_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ iarg[1] = p->uid; /* l_uid_t */ iarg[2] = p->gid; /* l_gid_t */ *n_args = 3; @@ -818,7 +818,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_lchown */ case 94: { struct linux_lchown_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ iarg[1] = p->uid; /* l_uid_t */ iarg[2] = p->gid; /* l_gid_t */ *n_args = 3; @@ -834,8 +834,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* gettimeofday */ case 96: { struct gettimeofday_args *p = params; - uarg[0] = (intptr_t) p->tp; /* struct l_timeval * */ - uarg[1] = (intptr_t) p->tzp; /* struct timezone * */ + uarg[0] = (intptr_t)p->tp; /* struct l_timeval * */ + uarg[1] = (intptr_t)p->tzp; /* struct timezone * */ *n_args = 2; break; } @@ -843,7 +843,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 97: { struct linux_getrlimit_args *p = params; iarg[0] = p->resource; /* l_uint */ - uarg[1] = (intptr_t) p->rlim; /* struct l_rlimit * */ + uarg[1] = (intptr_t)p->rlim; /* struct l_rlimit * */ *n_args = 2; break; } @@ -851,21 +851,21 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 98: { struct getrusage_args *p = params; iarg[0] = p->who; /* int */ - uarg[1] = (intptr_t) p->rusage; /* struct rusage * */ + uarg[1] = (intptr_t)p->rusage; /* struct rusage * */ *n_args = 2; break; } /* linux_sysinfo */ case 99: { struct linux_sysinfo_args *p = params; - uarg[0] = (intptr_t) p->info; /* struct l_sysinfo * */ + uarg[0] = (intptr_t)p->info; /* struct l_sysinfo * */ *n_args = 1; break; } /* linux_times */ case 100: { struct linux_times_args *p = params; - uarg[0] = (intptr_t) p->buf; /* struct l_times_argv * */ + uarg[0] = (intptr_t)p->buf; /* struct l_times_argv * */ *n_args = 1; break; } @@ -888,7 +888,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 103: { struct linux_syslog_args *p = params; iarg[0] = p->type; /* l_int */ - uarg[1] = (intptr_t) p->buf; /* char * */ + uarg[1] = (intptr_t)p->buf; /* char * */ iarg[2] = p->len; /* l_int */ *n_args = 3; break; @@ -965,7 +965,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 115: { struct linux_getgroups_args *p = params; iarg[0] = p->gidsetsize; /* l_int */ - uarg[1] = (intptr_t) p->grouplist; /* l_gid_t * */ + uarg[1] = (intptr_t)p->grouplist; /* l_gid_t * */ *n_args = 2; break; } @@ -973,7 +973,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 116: { struct linux_setgroups_args *p = params; iarg[0] = p->gidsetsize; /* l_int */ - uarg[1] = (intptr_t) p->grouplist; /* l_gid_t * */ + uarg[1] = (intptr_t)p->grouplist; /* l_gid_t * */ *n_args = 2; break; } @@ -989,9 +989,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* getresuid */ case 118: { struct getresuid_args *p = params; - uarg[0] = (intptr_t) p->ruid; /* uid_t * */ - uarg[1] = (intptr_t) p->euid; /* uid_t * */ - uarg[2] = (intptr_t) p->suid; /* uid_t * */ + uarg[0] = (intptr_t)p->ruid; /* uid_t * */ + uarg[1] = (intptr_t)p->euid; /* uid_t * */ + uarg[2] = (intptr_t)p->suid; /* uid_t * */ *n_args = 3; break; } @@ -1007,9 +1007,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* getresgid */ case 120: { struct getresgid_args *p = params; - uarg[0] = (intptr_t) p->rgid; /* gid_t * */ - uarg[1] = (intptr_t) p->egid; /* gid_t * */ - uarg[2] = (intptr_t) p->sgid; /* gid_t * */ + uarg[0] = (intptr_t)p->rgid; /* gid_t * */ + uarg[1] = (intptr_t)p->egid; /* gid_t * */ + uarg[2] = (intptr_t)p->sgid; /* gid_t * */ *n_args = 3; break; } @@ -1044,23 +1044,23 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_capget */ case 125: { struct linux_capget_args *p = params; - uarg[0] = (intptr_t) p->hdrp; /* struct l_user_cap_header * */ - uarg[1] = (intptr_t) p->datap; /* struct l_user_cap_data * */ + uarg[0] = (intptr_t)p->hdrp; /* struct l_user_cap_header * */ + uarg[1] = (intptr_t)p->datap; /* struct l_user_cap_data * */ *n_args = 2; break; } /* linux_capset */ case 126: { struct linux_capset_args *p = params; - uarg[0] = (intptr_t) p->hdrp; /* struct l_user_cap_header * */ - uarg[1] = (intptr_t) p->datap; /* struct l_user_cap_data * */ + uarg[0] = (intptr_t)p->hdrp; /* struct l_user_cap_header * */ + uarg[1] = (intptr_t)p->datap; /* struct l_user_cap_data * */ *n_args = 2; break; } /* linux_rt_sigpending */ case 127: { struct linux_rt_sigpending_args *p = params; - uarg[0] = (intptr_t) p->set; /* l_sigset_t * */ + uarg[0] = (intptr_t)p->set; /* l_sigset_t * */ iarg[1] = p->sigsetsize; /* l_size_t */ *n_args = 2; break; @@ -1068,9 +1068,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_rt_sigtimedwait */ case 128: { struct linux_rt_sigtimedwait_args *p = params; - uarg[0] = (intptr_t) p->mask; /* l_sigset_t * */ - uarg[1] = (intptr_t) p->ptr; /* l_siginfo_t * */ - uarg[2] = (intptr_t) p->timeout; /* struct l_timeval * */ + uarg[0] = (intptr_t)p->mask; /* l_sigset_t * */ + uarg[1] = (intptr_t)p->ptr; /* l_siginfo_t * */ + uarg[2] = (intptr_t)p->timeout; /* struct l_timeval * */ iarg[3] = p->sigsetsize; /* l_size_t */ *n_args = 4; break; @@ -1080,14 +1080,14 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_rt_sigqueueinfo_args *p = params; iarg[0] = p->pid; /* l_pid_t */ iarg[1] = p->sig; /* l_int */ - uarg[2] = (intptr_t) p->info; /* l_siginfo_t * */ + uarg[2] = (intptr_t)p->info; /* l_siginfo_t * */ *n_args = 3; break; } /* linux_rt_sigsuspend */ case 130: { struct linux_rt_sigsuspend_args *p = params; - uarg[0] = (intptr_t) p->newset; /* l_sigset_t * */ + uarg[0] = (intptr_t)p->newset; /* l_sigset_t * */ iarg[1] = p->sigsetsize; /* l_size_t */ *n_args = 2; break; @@ -1095,23 +1095,23 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_sigaltstack */ case 131: { struct linux_sigaltstack_args *p = params; - uarg[0] = (intptr_t) p->uss; /* l_stack_t * */ - uarg[1] = (intptr_t) p->uoss; /* l_stack_t * */ + uarg[0] = (intptr_t)p->uss; /* l_stack_t * */ + uarg[1] = (intptr_t)p->uoss; /* l_stack_t * */ *n_args = 2; break; } /* linux_utime */ case 132: { struct linux_utime_args *p = params; - uarg[0] = (intptr_t) p->fname; /* char * */ - uarg[1] = (intptr_t) p->times; /* struct l_utimbuf * */ + uarg[0] = (intptr_t)p->fname; /* char * */ + uarg[1] = (intptr_t)p->times; /* struct l_utimbuf * */ *n_args = 2; break; } /* linux_mknod */ case 133: { struct linux_mknod_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ iarg[1] = p->mode; /* l_mode_t */ iarg[2] = p->dev; /* l_uint */ *n_args = 3; @@ -1128,15 +1128,15 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 136: { struct linux_ustat_args *p = params; iarg[0] = p->dev; /* l_uint */ - uarg[1] = (intptr_t) p->ubuf; /* struct l_ustat * */ + uarg[1] = (intptr_t)p->ubuf; /* struct l_ustat * */ *n_args = 2; break; } /* linux_statfs */ case 137: { struct linux_statfs_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ - uarg[1] = (intptr_t) p->buf; /* struct l_statfs_buf * */ + uarg[0] = (intptr_t)p->path; /* char * */ + uarg[1] = (intptr_t)p->buf; /* struct l_statfs_buf * */ *n_args = 2; break; } @@ -1144,7 +1144,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 138: { struct linux_fstatfs_args *p = params; iarg[0] = p->fd; /* l_uint */ - uarg[1] = (intptr_t) p->buf; /* struct l_statfs_buf * */ + uarg[1] = (intptr_t)p->buf; /* struct l_statfs_buf * */ *n_args = 2; break; } @@ -1178,7 +1178,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 142: { struct linux_sched_setparam_args *p = params; iarg[0] = p->pid; /* l_pid_t */ - uarg[1] = (intptr_t) p->param; /* struct sched_param * */ + uarg[1] = (intptr_t)p->param; /* struct sched_param * */ *n_args = 2; break; } @@ -1186,7 +1186,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 143: { struct linux_sched_getparam_args *p = params; iarg[0] = p->pid; /* l_pid_t */ - uarg[1] = (intptr_t) p->param; /* struct sched_param * */ + uarg[1] = (intptr_t)p->param; /* struct sched_param * */ *n_args = 2; break; } @@ -1195,7 +1195,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_sched_setscheduler_args *p = params; iarg[0] = p->pid; /* l_pid_t */ iarg[1] = p->policy; /* l_int */ - uarg[2] = (intptr_t) p->param; /* struct sched_param * */ + uarg[2] = (intptr_t)p->param; /* struct sched_param * */ *n_args = 3; break; } @@ -1224,14 +1224,14 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 148: { struct linux_sched_rr_get_interval_args *p = params; iarg[0] = p->pid; /* l_pid_t */ - uarg[1] = (intptr_t) p->interval; /* struct l_timespec * */ + uarg[1] = (intptr_t)p->interval; /* struct l_timespec * */ *n_args = 2; break; } /* mlock */ case 149: { struct mlock_args *p = params; - uarg[0] = (intptr_t) p->addr; /* const void * */ + uarg[0] = (intptr_t)p->addr; /* const void * */ uarg[1] = p->len; /* size_t */ *n_args = 2; break; @@ -1239,7 +1239,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* munlock */ case 150: { struct munlock_args *p = params; - uarg[0] = (intptr_t) p->addr; /* const void * */ + uarg[0] = (intptr_t)p->addr; /* const void * */ uarg[1] = p->len; /* size_t */ *n_args = 2; break; @@ -1274,7 +1274,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_sysctl */ case 156: { struct linux_sysctl_args *p = params; - uarg[0] = (intptr_t) p->args; /* struct l___sysctl_args * */ + uarg[0] = (intptr_t)p->args; /* struct l___sysctl_args * */ *n_args = 1; break; } @@ -1306,14 +1306,14 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 160: { struct linux_setrlimit_args *p = params; iarg[0] = p->resource; /* l_uint */ - uarg[1] = (intptr_t) p->rlim; /* struct l_rlimit * */ + uarg[1] = (intptr_t)p->rlim; /* struct l_rlimit * */ *n_args = 2; break; } /* chroot */ case 161: { struct chroot_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ *n_args = 1; break; } @@ -1325,33 +1325,33 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* acct */ case 163: { struct acct_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ *n_args = 1; break; } /* settimeofday */ case 164: { struct settimeofday_args *p = params; - uarg[0] = (intptr_t) p->tv; /* struct l_timeval * */ - uarg[1] = (intptr_t) p->tzp; /* struct timezone * */ + uarg[0] = (intptr_t)p->tv; /* struct l_timeval * */ + uarg[1] = (intptr_t)p->tzp; /* struct timezone * */ *n_args = 2; break; } /* linux_mount */ case 165: { struct linux_mount_args *p = params; - uarg[0] = (intptr_t) p->specialfile; /* char * */ - uarg[1] = (intptr_t) p->dir; /* char * */ - uarg[2] = (intptr_t) p->filesystemtype; /* char * */ + uarg[0] = (intptr_t)p->specialfile; /* char * */ + uarg[1] = (intptr_t)p->dir; /* char * */ + uarg[2] = (intptr_t)p->filesystemtype; /* char * */ iarg[3] = p->rwflag; /* l_ulong */ - uarg[4] = (intptr_t) p->data; /* void * */ + uarg[4] = (intptr_t)p->data; /* void * */ *n_args = 5; break; } /* linux_umount */ case 166: { struct linux_umount_args *p = params; - uarg[0] = (intptr_t) p->path; /* char * */ + uarg[0] = (intptr_t)p->path; /* char * */ iarg[1] = p->flags; /* l_int */ *n_args = 2; break; @@ -1359,7 +1359,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* swapon */ case 167: { struct swapon_args *p = params; - uarg[0] = (intptr_t) p->name; /* char * */ + uarg[0] = (intptr_t)p->name; /* char * */ *n_args = 1; break; } @@ -1374,14 +1374,14 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) iarg[0] = p->magic1; /* l_int */ iarg[1] = p->magic2; /* l_int */ iarg[2] = p->cmd; /* l_uint */ - uarg[3] = (intptr_t) p->arg; /* void * */ + uarg[3] = (intptr_t)p->arg; /* void * */ *n_args = 4; break; } /* linux_sethostname */ case 170: { struct linux_sethostname_args *p = params; - uarg[0] = (intptr_t) p->hostname; /* char * */ + uarg[0] = (intptr_t)p->hostname; /* char * */ iarg[1] = p->len; /* l_int */ *n_args = 2; break; @@ -1389,7 +1389,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_setdomainname */ case 171: { struct linux_setdomainname_args *p = params; - uarg[0] = (intptr_t) p->name; /* char * */ + uarg[0] = (intptr_t)p->name; /* char * */ iarg[1] = p->len; /* l_int */ *n_args = 2; break; @@ -1434,9 +1434,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_setxattr */ case 188: { struct linux_setxattr_args *p = params; - uarg[0] = (intptr_t) p->path; /* const char * */ - uarg[1] = (intptr_t) p->name; /* const char * */ - uarg[2] = (intptr_t) p->value; /* const char * */ + uarg[0] = (intptr_t)p->path; /* const char * */ + uarg[1] = (intptr_t)p->name; /* const char * */ + uarg[2] = (intptr_t)p->value; /* const char * */ iarg[3] = p->size; /* l_size_t */ iarg[4] = p->flags; /* l_int */ *n_args = 5; @@ -1445,9 +1445,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_lsetxattr */ case 189: { struct linux_lsetxattr_args *p = params; - uarg[0] = (intptr_t) p->path; /* const char * */ - uarg[1] = (intptr_t) p->name; /* const char * */ - uarg[2] = (intptr_t) p->value; /* const char * */ + uarg[0] = (intptr_t)p->path; /* const char * */ + uarg[1] = (intptr_t)p->name; /* const char * */ + uarg[2] = (intptr_t)p->value; /* const char * */ iarg[3] = p->size; /* l_size_t */ iarg[4] = p->flags; /* l_int */ *n_args = 5; @@ -1457,8 +1457,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 190: { struct linux_fsetxattr_args *p = params; iarg[0] = p->fd; /* l_int */ - uarg[1] = (intptr_t) p->name; /* const char * */ - uarg[2] = (intptr_t) p->value; /* const char * */ + uarg[1] = (intptr_t)p->name; /* const char * */ + uarg[2] = (intptr_t)p->value; /* const char * */ iarg[3] = p->size; /* l_size_t */ iarg[4] = p->flags; /* l_int */ *n_args = 5; @@ -1467,9 +1467,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_getxattr */ case 191: { struct linux_getxattr_args *p = params; - uarg[0] = (intptr_t) p->path; /* const char * */ - uarg[1] = (intptr_t) p->name; /* const char * */ - uarg[2] = (intptr_t) p->value; /* char * */ + uarg[0] = (intptr_t)p->path; /* const char * */ + uarg[1] = (intptr_t)p->name; /* const char * */ + uarg[2] = (intptr_t)p->value; /* char * */ iarg[3] = p->size; /* l_size_t */ *n_args = 4; break; @@ -1477,9 +1477,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_lgetxattr */ case 192: { struct linux_lgetxattr_args *p = params; - uarg[0] = (intptr_t) p->path; /* const char * */ - uarg[1] = (intptr_t) p->name; /* const char * */ - uarg[2] = (intptr_t) p->value; /* char * */ + uarg[0] = (intptr_t)p->path; /* const char * */ + uarg[1] = (intptr_t)p->name; /* const char * */ + uarg[2] = (intptr_t)p->value; /* char * */ iarg[3] = p->size; /* l_size_t */ *n_args = 4; break; @@ -1488,8 +1488,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 193: { struct linux_fgetxattr_args *p = params; iarg[0] = p->fd; /* l_int */ - uarg[1] = (intptr_t) p->name; /* const char * */ - uarg[2] = (intptr_t) p->value; /* char * */ + uarg[1] = (intptr_t)p->name; /* const char * */ + uarg[2] = (intptr_t)p->value; /* char * */ iarg[3] = p->size; /* l_size_t */ *n_args = 4; break; @@ -1497,8 +1497,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_listxattr */ case 194: { struct linux_listxattr_args *p = params; - uarg[0] = (intptr_t) p->path; /* const char * */ - uarg[1] = (intptr_t) p->list; /* const char * */ + uarg[0] = (intptr_t)p->path; /* const char * */ + uarg[1] = (intptr_t)p->list; /* const char * */ iarg[2] = p->size; /* l_size_t */ *n_args = 3; break; @@ -1506,8 +1506,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_llistxattr */ case 195: { struct linux_llistxattr_args *p = params; - uarg[0] = (intptr_t) p->path; /* const char * */ - uarg[1] = (intptr_t) p->list; /* const char * */ + uarg[0] = (intptr_t)p->path; /* const char * */ + uarg[1] = (intptr_t)p->list; /* const char * */ iarg[2] = p->size; /* l_size_t */ *n_args = 3; break; @@ -1516,7 +1516,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) case 196: { struct linux_flistxattr_args *p = params; iarg[0] = p->fd; /* l_int */ - uarg[1] = (intptr_t) p->list; /* const char * */ + uarg[1] = (intptr_t)p->list; /* const char * */ iarg[2] = p->size; /* l_size_t */ *n_args = 3; break; @@ -1524,16 +1524,16 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* linux_removexattr */ *** 33954 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Thu May 13 18:25:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ABC4262A5E8; Thu, 13 May 2021 18:25:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fh0TB4VvYz3l67; Thu, 13 May 2021 18:25:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D6B423954; Thu, 13 May 2021 18:25:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DIPYvB061158; Thu, 13 May 2021 18:25:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DIPYUw061157; Thu, 13 May 2021 18:25:34 GMT (envelope-from git) Date: Thu, 13 May 2021 18:25:34 GMT Message-Id: <202105131825.14DIPYUw061157@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 0b426a1c2cef - main - modules: Only build sdhci_fdt for arm and arm64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0b426a1c2cef14ded10ded6ec737d5c116182996 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 18:25:34 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=0b426a1c2cef14ded10ded6ec737d5c116182996 commit 0b426a1c2cef14ded10ded6ec737d5c116182996 Author: Emmanuel Vadot AuthorDate: 2021-05-13 18:23:59 +0000 Commit: Emmanuel Vadot CommitDate: 2021-05-13 18:23:59 +0000 modules: Only build sdhci_fdt for arm and arm64 Other FDT platform (like powerpc64* or riscv64) don't have gpio built by default so just compile the module for those two arches. Fixes: 9e08f82058cb ("modules: Add sdhci_fdt module") --- sys/modules/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 6a5097e9ded0..fb2481140345 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -491,7 +491,6 @@ SUBDIR+= iscsi_initiator .if !empty(OPT_FDT) SUBDIR+= fdt -_sdhci_fdt= sdhci_fdt .endif # Linuxulator @@ -618,6 +617,10 @@ _em= em _rockchip= rockchip .endif +.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" +_sdhci_fdt= sdhci_fdt +.endif + .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" _agp= agp _an= an From owner-dev-commits-src-main@freebsd.org Thu May 13 18:26:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 56E2B62AA06; Thu, 13 May 2021 18:26:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fh0VL21gnz3lCR; Thu, 13 May 2021 18:26:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 38B6323BD8; Thu, 13 May 2021 18:26:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DIQYQZ061393; Thu, 13 May 2021 18:26:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DIQYra061392; Thu, 13 May 2021 18:26:34 GMT (envelope-from git) Date: Thu, 13 May 2021 18:26:34 GMT Message-Id: <202105131826.14DIQYra061392@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 28ce201269cd - main - UPDATING: fix spelling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 28ce201269cdaf8c95b76b7cd1b08d10edce817e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 18:26:34 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=28ce201269cdaf8c95b76b7cd1b08d10edce817e commit 28ce201269cdaf8c95b76b7cd1b08d10edce817e Author: Emmanuel Vadot AuthorDate: 2021-05-13 18:26:10 +0000 Commit: Emmanuel Vadot CommitDate: 2021-05-13 18:26:10 +0000 UPDATING: fix spelling Reported by: pstef --- UPDATING | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index 36f9f1aea126..efccbf3b2fff 100644 --- a/UPDATING +++ b/UPDATING @@ -30,7 +30,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: 20210513: Commit ca179c4d74f2 changed the package in which the OpenSSL libraries and utilities are packaged. - It is recommanded for pkgbase user to do : + It is recommended for pkgbase user to do: pkg install -f FreeBSD-openssl before pkg upgrade otherwise some dependencies might not be met and pkg will stop working as libssl will not be present anymore From owner-dev-commits-src-main@freebsd.org Thu May 13 18:29:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B43B062AB9E; Thu, 13 May 2021 18:29:23 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fh0Yb05LKz3krB; Thu, 13 May 2021 18:29:22 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f45.google.com with SMTP id n40so10075270ioz.4; Thu, 13 May 2021 11:29:22 -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; bh=3lPG2G3JNnd2GYwR9ELP3g0q0AuvBWWVhlbj/hYn0lM=; b=QdmvV7677mb4X1+JPaqUcCuAVcRa0zf5luhQbuGlgfy4KTxgZuHw+JVs1KLntHcoBf a9XHQswXnj2pvu9L+b9B9ByUoxdUuD21ZToCLkTdofisyNJ5EaoIcWr3Bof4ktR06HTu TsXfw4sTCANe9mPupd2MlXCqatozkxlvvEFgbVT0LGCx338jfQuONPKdY2fQ54C9ios5 1Al8Hv7RAnp4y9h9dBv/lszoZH+AvqNUu+340+C5V3DIOsl8GW+/jEGFiJ6PUr6O6lb9 /arhTP27qo8k6p5tXNpefIq8apk/hio8HPPEe9t17pC+7tocp50DMF+o4glMvnv66WZf ZXtQ== X-Gm-Message-State: AOAM532tT7/irTJEikJ+aoawl0yd5i8ef1PI8GET30xg32JFiWrhy5Lz CwpZlG9prVmwq9L85JLQPWM1xxXwVklcI9S9QMbKY/14bSU= X-Google-Smtp-Source: ABdhPJzfTUlNIGNPeiJXGVX9myDwMN4s6TZkRznqw11oIXwgJGDjVOENjOcRAn89X4SQwkZM0TtPE0AcoDnYMPAlJk8= X-Received: by 2002:a6b:14d2:: with SMTP id 201mr31487031iou.15.1620930561326; Thu, 13 May 2021 11:29:21 -0700 (PDT) MIME-Version: 1.0 References: <202105131811.14DIBA1p045633@gitrepo.freebsd.org> In-Reply-To: <202105131811.14DIBA1p045633@gitrepo.freebsd.org> From: Ed Maste Date: Thu, 13 May 2021 14:28:51 -0400 Message-ID: Subject: Re: git: 2c9764f36b6f - main - regen syscall files after d51198d63b63 To: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4Fh0Yb05LKz3krB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of carpeddiem@gmail.com designates 209.85.166.45 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; FREEFALL_USER(0.00)[carpeddiem]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.166.45:from]; TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; SPAMHAUS_ZRD(0.00)[209.85.166.45:from:127.0.2.255]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[209.85.166.45:from]; FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.166.45:from]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 18:29:23 -0000 On Thu, 13 May 2021 at 14:11, Ed Maste wrote: > > The branch main has been updated by emaste: > > URL: https://cgit.FreeBSD.org/src/commit/?id=2c9764f36b6f20e9a6c71ce64a21988a394050b6 > > commit 2c9764f36b6f20e9a6c71ce64a21988a394050b6 > Author: Ed Maste > AuthorDate: 2021-05-13 17:58:04 +0000 > Commit: Ed Maste > CommitDate: 2021-05-13 18:09:58 +0000 > > regen syscall files after d51198d63b63 Oops I guess I rebased and didn't notice :( That should be "after ad385f7b46e7" From owner-dev-commits-src-main@freebsd.org Thu May 13 19:05:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52A0E62B871; Thu, 13 May 2021 19:05:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fh1Ln1vthz3myx; Thu, 13 May 2021 19:05:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 344572403F; Thu, 13 May 2021 19:05:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DJ55Jf016314; Thu, 13 May 2021 19:05:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DJ55w8016313; Thu, 13 May 2021 19:05:05 GMT (envelope-from git) Date: Thu, 13 May 2021 19:05:05 GMT Message-Id: <202105131905.14DJ55w8016313@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 4d8d74a4f52e - main - libpmc: remove unused PMC_MDEP_INIT_INTEL_V2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4d8d74a4f52efd078bd6298e0adbdd476ed70de9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 19:05:05 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=4d8d74a4f52efd078bd6298e0adbdd476ed70de9 commit 4d8d74a4f52efd078bd6298e0adbdd476ed70de9 Author: Mitchell Horne AuthorDate: 2021-05-13 18:56:39 +0000 Commit: Mitchell Horne CommitDate: 2021-05-13 18:56:39 +0000 libpmc: remove unused PMC_MDEP_INIT_INTEL_V2 All uses of this macro were removed in e92a1350b50e. Remove cpu_has_iaf_counters as well. Reviewed by: ray, emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30195 --- lib/libpmc/libpmc.c | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c index 512f3957962a..e66ec5822226 100644 --- a/lib/libpmc/libpmc.c +++ b/lib/libpmc/libpmc.c @@ -1367,10 +1367,6 @@ pmc_init(void) uint32_t abi_version; struct module_stat pmc_modstat; struct pmc_op_getcpuinfo op_cpu_info; -#if defined(__amd64__) || defined(__i386__) - int cpu_has_iaf_counters; - unsigned int t; -#endif if (pmc_syscall != -1) /* already inited */ return (0); @@ -1446,15 +1442,6 @@ pmc_init(void) #if defined(__amd64__) || defined(__i386__) if (cpu_info.pm_cputype != PMC_CPU_GENERIC) pmc_class_table[n++] = &tsc_class_table_descr; - - /* - * Check if this CPU has fixed function counters. - */ - cpu_has_iaf_counters = 0; - for (t = 0; t < cpu_info.pm_nclass; t++) - if (cpu_info.pm_classes[t].pm_class == PMC_CLASS_IAF && - cpu_info.pm_classes[t].pm_num > 0) - cpu_has_iaf_counters = 1; #endif #define PMC_MDEP_INIT(C) do { \ @@ -1464,15 +1451,6 @@ pmc_init(void) PMC_TABLE_SIZE(C##_pmc_classes); \ } while (0) -#define PMC_MDEP_INIT_INTEL_V2(C) do { \ - PMC_MDEP_INIT(C); \ - pmc_class_table[n++] = &iaf_class_table_descr; \ - if (!cpu_has_iaf_counters) \ - pmc_mdep_event_aliases = \ - C##_aliases_without_iaf; \ - pmc_class_table[n] = &C##_class_table_descr; \ - } while (0) - /* Configure the event name parser. */ switch (cpu_info.pm_cputype) { #if defined(__amd64__) || defined(__i386__) From owner-dev-commits-src-main@freebsd.org Thu May 13 19:05:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 85B1F62BAA8; Thu, 13 May 2021 19:05:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fh1Lp31RHz3mm7; Thu, 13 May 2021 19:05:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 57A3C24320; Thu, 13 May 2021 19:05:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DJ56aP016335; Thu, 13 May 2021 19:05:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DJ56kv016334; Thu, 13 May 2021 19:05:06 GMT (envelope-from git) Date: Thu, 13 May 2021 19:05:06 GMT Message-Id: <202105131905.14DJ56kv016334@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: da13ef6aa056 - main - libpmc: remove PMC_MDEP_TABLE logic MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: da13ef6aa0565c8d79326bba5606671062033bbf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 19:05:06 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=da13ef6aa0565c8d79326bba5606671062033bbf commit da13ef6aa0565c8d79326bba5606671062033bbf Author: Mitchell Horne AuthorDate: 2021-05-13 19:00:07 +0000 Commit: Mitchell Horne CommitDate: 2021-05-13 19:01:19 +0000 libpmc: remove PMC_MDEP_TABLE logic This logic was added for handling some of the complicated relationships between events and x86 CPU models. Since that logic has been mostly removed from libpmc(3) in favor of pmu-events, this no longer serves much of a purpose. Mapping CPU types to event tables is already handled by the switch statement in pmc_init(). Reviewed by: ray, emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30196 --- lib/libpmc/libpmc.c | 54 ++++------------------------------------------------- 1 file changed, 4 insertions(+), 50 deletions(-) diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c index e66ec5822226..6636c974cb73 100644 --- a/lib/libpmc/libpmc.c +++ b/lib/libpmc/libpmc.c @@ -177,32 +177,6 @@ static const struct pmc_event_descr cortex_a76_event_table[] = __PMC_EV_ALIAS_ARMV8_CORTEX_A76() }; -/* - * PMC_MDEP_TABLE(NAME, PRIMARYCLASS, ADDITIONAL_CLASSES...) - * - * Map a CPU to the PMC classes it supports. - */ -#define PMC_MDEP_TABLE(N,C,...) \ - static const enum pmc_class N##_pmc_classes[] = { \ - PMC_CLASS_##C, __VA_ARGS__ \ - } - -PMC_MDEP_TABLE(k8, K8, PMC_CLASS_SOFT, PMC_CLASS_TSC); -PMC_MDEP_TABLE(beri, BERI, PMC_CLASS_SOFT, PMC_CLASS_BERI); -PMC_MDEP_TABLE(cortex_a8, ARMV7, PMC_CLASS_SOFT, PMC_CLASS_ARMV7); -PMC_MDEP_TABLE(cortex_a9, ARMV7, PMC_CLASS_SOFT, PMC_CLASS_ARMV7); -PMC_MDEP_TABLE(cortex_a53, ARMV8, PMC_CLASS_SOFT, PMC_CLASS_ARMV8); -PMC_MDEP_TABLE(cortex_a57, ARMV8, PMC_CLASS_SOFT, PMC_CLASS_ARMV8); -PMC_MDEP_TABLE(cortex_a76, ARMV8, PMC_CLASS_SOFT, PMC_CLASS_ARMV8); -PMC_MDEP_TABLE(mips24k, MIPS24K, PMC_CLASS_SOFT, PMC_CLASS_MIPS24K); -PMC_MDEP_TABLE(mips74k, MIPS74K, PMC_CLASS_SOFT, PMC_CLASS_MIPS74K); -PMC_MDEP_TABLE(octeon, OCTEON, PMC_CLASS_SOFT, PMC_CLASS_OCTEON); -PMC_MDEP_TABLE(ppc7450, PPC7450, PMC_CLASS_SOFT, PMC_CLASS_PPC7450, PMC_CLASS_TSC); -PMC_MDEP_TABLE(ppc970, PPC970, PMC_CLASS_SOFT, PMC_CLASS_PPC970, PMC_CLASS_TSC); -PMC_MDEP_TABLE(power8, POWER8, PMC_CLASS_SOFT, PMC_CLASS_POWER8, PMC_CLASS_TSC); -PMC_MDEP_TABLE(e500, E500, PMC_CLASS_SOFT, PMC_CLASS_E500, PMC_CLASS_TSC); -PMC_MDEP_TABLE(generic, SOFT, PMC_CLASS_SOFT); - static const struct pmc_event_descr tsc_event_table[] = { __PMC_EV_TSC() @@ -264,9 +238,6 @@ static struct pmc_class_descr soft_class_table_descr = static const struct pmc_class_descr **pmc_class_table; #define PMC_CLASS_TABLE_SIZE cpu_info.pm_nclass -static const enum pmc_class *pmc_mdep_class_list; -static size_t pmc_mdep_class_list_size; - /* * Mapping tables, mapping enumeration values to human readable * strings. @@ -985,17 +956,6 @@ pmc_match_event_class(const char *name, return (NULL); } -static int -pmc_mdep_is_compatible_class(enum pmc_class pc) -{ - size_t n; - - for (n = 0; n < pmc_mdep_class_list_size; n++) - if (pmc_mdep_class_list[n] == pc) - return (1); - return (0); -} - /* * API entry points */ @@ -1070,9 +1030,8 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode, ev = NULL; for (n = 0; n < PMC_CLASS_TABLE_SIZE; n++) { pcd = pmc_class_table[n]; - if (pcd && pmc_mdep_is_compatible_class(pcd->pm_evc_class) && - strncasecmp(ctrname, pcd->pm_evc_name, - pcd->pm_evc_name_size) == 0) { + if (pcd != NULL && strncasecmp(ctrname, pcd->pm_evc_name, + pcd->pm_evc_name_size) == 0) { if ((ev = pmc_match_event_class(ctrname + pcd->pm_evc_name_size, pcd)) == NULL) { errno = EINVAL; @@ -1088,7 +1047,7 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode, */ for (n = 0; ev == NULL && n < PMC_CLASS_TABLE_SIZE; n++) { pcd = pmc_class_table[n]; - if (pcd && pmc_mdep_is_compatible_class(pcd->pm_evc_class)) + if (pcd != NULL) ev = pmc_match_event_class(ctrname, pcd); } @@ -1444,12 +1403,7 @@ pmc_init(void) pmc_class_table[n++] = &tsc_class_table_descr; #endif -#define PMC_MDEP_INIT(C) do { \ - pmc_mdep_event_aliases = C##_aliases; \ - pmc_mdep_class_list = C##_pmc_classes; \ - pmc_mdep_class_list_size = \ - PMC_TABLE_SIZE(C##_pmc_classes); \ - } while (0) +#define PMC_MDEP_INIT(C) pmc_mdep_event_aliases = C##_aliases /* Configure the event name parser. */ switch (cpu_info.pm_cputype) { From owner-dev-commits-src-main@freebsd.org Thu May 13 19:05:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E047562BB39; Thu, 13 May 2021 19:05:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fh1Lq5Xspz3mmF; Thu, 13 May 2021 19:05:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 89987242FC; Thu, 13 May 2021 19:05:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DJ57aa016358; Thu, 13 May 2021 19:05:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DJ57pA016357; Thu, 13 May 2021 19:05:07 GMT (envelope-from git) Date: Thu, 13 May 2021 19:05:07 GMT Message-Id: <202105131905.14DJ57pA016357@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: dfdc57e8aa8b - main - libpmc: fall-back to kernel tables if pmu-events fails MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dfdc57e8aa8ba4b4e4484f736e8c7645ab69b54a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 19:05:08 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=dfdc57e8aa8ba4b4e4484f736e8c7645ab69b54a commit dfdc57e8aa8ba4b4e4484f736e8c7645ab69b54a Author: Mitchell Horne AuthorDate: 2021-05-13 18:57:37 +0000 Commit: Mitchell Horne CommitDate: 2021-05-13 19:01:24 +0000 libpmc: fall-back to kernel tables if pmu-events fails On x86, the pmu_events table is the source of truth for finding supported events. However, events not found there may still be present in the kernel's static event tables. For example, the pmc.soft(3) events will never be available from pmu-events. Update pmc_allocate() to search the legacy event tables if pmc_pmu_pmcallocate() fails to return a result. This allows both event sources to be consulted before giving up, thus restoring pmc.soft(3) and pmc.tsc(3) on x86. Reviewed by: emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30216 --- lib/libpmc/libpmc.c | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c index 6636c974cb73..e2422f167267 100644 --- a/lib/libpmc/libpmc.c +++ b/lib/libpmc/libpmc.c @@ -989,25 +989,25 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode, pmc_config.pm_count = count; if (PMC_IS_SAMPLING_MODE(mode)) pmc_config.pm_caps |= PMC_CAP_INTERRUPT; + /* - * Can we pull this straight from the pmu table? + * Try to pull the raw event ID directly from the pmu-events table. If + * this is unsupported on the platform, or the event is not found, + * continue with searching the regular event tables. */ r = spec_copy = strdup(ctrspec); ctrname = strsep(&r, ","); if (pmc_pmu_enabled()) { - if (pmc_pmu_pmcallocate(ctrname, &pmc_config) == 0) { - if (PMC_CALL(PMCALLOCATE, &pmc_config) < 0) { - goto out; - } - retval = 0; - *pmcid = pmc_config.pm_pmcid; - goto out; - } - errx(EX_USAGE, "ERROR: pmc_pmu_allocate failed, check for ctrname %s\n", ctrname); - } else { - free(spec_copy); - spec_copy = NULL; + if (pmc_pmu_pmcallocate(ctrname, &pmc_config) == 0) + goto found; + + /* Otherwise, reset any changes */ + pmc_config.pm_ev = 0; + pmc_config.pm_caps = 0; + pmc_config.pm_class = 0; } + free(spec_copy); + spec_copy = NULL; /* replace an event alias with the canonical event specifier */ if (pmc_mdep_event_aliases) @@ -1064,14 +1064,12 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode, goto out; } - if (PMC_CALL(PMCALLOCATE, &pmc_config) < 0) - goto out; - - *pmcid = pmc_config.pm_pmcid; - - retval = 0; - - out: +found: + if (PMC_CALL(PMCALLOCATE, &pmc_config) == 0) { + *pmcid = pmc_config.pm_pmcid; + retval = 0; + } +out: if (spec_copy) free(spec_copy); From owner-dev-commits-src-main@freebsd.org Thu May 13 19:05:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C27A662BAAA; Thu, 13 May 2021 19:05:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fh1Lr4yzqz3mxM; Thu, 13 May 2021 19:05:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B48423C73; Thu, 13 May 2021 19:05:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DJ58mr016388; Thu, 13 May 2021 19:05:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DJ58cG016387; Thu, 13 May 2021 19:05:08 GMT (envelope-from git) Date: Thu, 13 May 2021 19:05:08 GMT Message-Id: <202105131905.14DJ58cG016387@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: f59127dac5ca - main - hwpmc: fix PMC_CPU_LAST MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f59127dac5ca0be3648ecc0a031a21e472afb133 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 19:05:08 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=f59127dac5ca0be3648ecc0a031a21e472afb133 commit f59127dac5ca0be3648ecc0a031a21e472afb133 Author: Mitchell Horne AuthorDate: 2021-05-05 18:40:39 +0000 Commit: Mitchell Horne CommitDate: 2021-05-13 19:02:59 +0000 hwpmc: fix PMC_CPU_LAST It is unused, but incorrect. MFC after: 3 days Sponsored by: The FreeBSD Foundation --- sys/sys/pmc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/pmc.h b/sys/sys/pmc.h index 1486c7aa91c7..9328a7bdfa05 100644 --- a/sys/sys/pmc.h +++ b/sys/sys/pmc.h @@ -138,7 +138,7 @@ enum pmc_cputype { }; #define PMC_CPU_FIRST PMC_CPU_AMD_K7 -#define PMC_CPU_LAST PMC_CPU_GENERIC +#define PMC_CPU_LAST PMC_CPU_ARMV8_CORTEX_A76 /* * Classes of PMCs From owner-dev-commits-src-main@freebsd.org Thu May 13 19:18:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E7AE62C501; Thu, 13 May 2021 19:18:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fh1fG382Jz3nlx; Thu, 13 May 2021 19:18:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5ED3224273; Thu, 13 May 2021 19:18:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DJIUcn030196; Thu, 13 May 2021 19:18:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DJIU4i030195; Thu, 13 May 2021 19:18:30 GMT (envelope-from git) Date: Thu, 13 May 2021 19:18:30 GMT Message-Id: <202105131918.14DJIU4i030195@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: 4dfe70fdbda0 - main - netgraph/ng_bridge: Avoid cache thrashing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4dfe70fdbda05453e824bc9edfc0d09eab7b2929 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 19:18:30 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=4dfe70fdbda05453e824bc9edfc0d09eab7b2929 commit 4dfe70fdbda05453e824bc9edfc0d09eab7b2929 Author: Lutz Donnerhacke AuthorDate: 2021-02-11 22:59:11 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-13 19:14:36 +0000 netgraph/ng_bridge: Avoid cache thrashing Hint the compiler, that this update is needed at most once per second. Only in this case the memory line needs to be written. This will reduce the amount of cache trashing during forward of most frames. Suggested by: zec Approved by: zec MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28601 --- sys/netgraph/ng_bridge.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/netgraph/ng_bridge.c b/sys/netgraph/ng_bridge.c index 470c0f05f18d..820c93515490 100644 --- a/sys/netgraph/ng_bridge.c +++ b/sys/netgraph/ng_bridge.c @@ -788,7 +788,8 @@ ng_bridge_rcvdata(hook_p hook, item_p item) * This is safe without locking, because it's * the only operation during shared access. */ - host->staleness = 0; + if (__predict_false(host->staleness > 0)) + host->staleness = 0; if ((host == NULL && ctx.incoming->learnMac) || (host != NULL && host->link != ctx.incoming)) { From owner-dev-commits-src-main@freebsd.org Thu May 13 19:51:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2654B62D087; Thu, 13 May 2021 19:51:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fh2Mn0g1Zz3q34; Thu, 13 May 2021 19:51:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A20924C43; Thu, 13 May 2021 19:51:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DJp0c8079067; Thu, 13 May 2021 19:51:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DJp00l079066; Thu, 13 May 2021 19:51:00 GMT (envelope-from git) Date: Thu, 13 May 2021 19:51:00 GMT Message-Id: <202105131951.14DJp00l079066@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: a56e5ad69030 - main - netgraph/ng_bridge: Handle send errors during loop handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a56e5ad6903037861457da754574b4903dcb0e7e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 19:51:01 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=a56e5ad6903037861457da754574b4903dcb0e7e commit a56e5ad6903037861457da754574b4903dcb0e7e Author: Lutz Donnerhacke AuthorDate: 2021-04-27 07:49:50 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-13 19:49:20 +0000 netgraph/ng_bridge: Handle send errors during loop handling If sending out a packet fails during the loop over all links, the allocated memory is leaked and not all links receive a copy. This patch fixes those problems, clarifies a premature abort of the loop, and fixes a minory style(9) bug. PR: 255430 Submitted by: Dancho Penev Tested by: Dancho Penev MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30008 --- sys/netgraph/ng_bridge.c | 55 ++++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/sys/netgraph/ng_bridge.c b/sys/netgraph/ng_bridge.c index 820c93515490..f77012d42d1c 100644 --- a/sys/netgraph/ng_bridge.c +++ b/sys/netgraph/ng_bridge.c @@ -663,22 +663,28 @@ ng_bridge_send_data(link_cp dst, int manycast, struct mbuf *m, item_p item) { else NG_SEND_DATA_ONLY(error, dst->hook, m); - if (error == 0) { - counter_u64_add(dst->stats.xmitPackets, 1); - counter_u64_add(dst->stats.xmitOctets, len); - switch (manycast) { - default: /* unknown unicast */ - break; - case 1: /* multicast */ - counter_u64_add(dst->stats.xmitMulticasts, 1); - break; - case 2: /* broadcast */ - counter_u64_add(dst->stats.xmitBroadcasts, 1); - break; - } + if (error) { + /* The packet is still ours */ + if (item != NULL) + NG_FREE_ITEM(item); + if (m != NULL) + NG_FREE_M(m); + return (error); } - return (error); + counter_u64_add(dst->stats.xmitPackets, 1); + counter_u64_add(dst->stats.xmitOctets, len); + switch (manycast) { + default: /* unknown unicast */ + break; + case 1: /* multicast */ + counter_u64_add(dst->stats.xmitMulticasts, 1); + break; + case 2: /* broadcast */ + counter_u64_add(dst->stats.xmitBroadcasts, 1); + break; + } + return (0); } /* @@ -716,16 +722,16 @@ ng_bridge_send_ctx(hook_p dst, void *arg) * It's usable link but not the reserved (first) one. * Copy mbuf info for sending. */ - m2 = m_dup(ctx->m, M_NOWAIT); /* XXX m_copypacket() */ + m2 = m_dup(ctx->m, M_NOWAIT); if (m2 == NULL) { counter_u64_add(ctx->incoming->stats.memoryFailures, 1); ctx->error = ENOBUFS; - return (0); /* abort loop */ + return (0); /* abort loop, do not try again and again */ } /* Send packet */ error = ng_bridge_send_data(destLink, ctx->manycast, m2, NULL); - if(error) + if (error) ctx->error = error; return (1); } @@ -859,18 +865,17 @@ ng_bridge_rcvdata(hook_p hook, item_p item) /* Distribute unknown, multicast, broadcast pkts to all other links */ NG_NODE_FOREACH_HOOK(node, ng_bridge_send_ctx, &ctx, ret); - /* If we never saw a good link, leave. */ - if (ctx.foundFirst == NULL || ctx.error != 0) { + /* Finally send out on the first link found */ + if (ctx.foundFirst != NULL) { + int error = ng_bridge_send_data(ctx.foundFirst, ctx.manycast, ctx.m, item); + if (error) + ctx.error = error; + } else { /* nothing to send at all */ NG_FREE_ITEM(item); NG_FREE_M(ctx.m); - return (ctx.error); } - /* - * If we've sent all the others, send the original - * on the first link we found. - */ - return (ng_bridge_send_data(ctx.foundFirst, ctx.manycast, ctx.m, item)); + return (ctx.error); } /* From owner-dev-commits-src-main@freebsd.org Fri May 14 07:19:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 13F0363B97E; Fri, 14 May 2021 07:19:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FhKf002DDz4nwh; Fri, 14 May 2021 07:19:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E39715B56; Fri, 14 May 2021 07:19:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14E7JJrO085818; Fri, 14 May 2021 07:19:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14E7JJdp085817; Fri, 14 May 2021 07:19:19 GMT (envelope-from git) Date: Fri, 14 May 2021 07:19:19 GMT Message-Id: <202105140719.14E7JJdp085817@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 2a60dec0919c - main - stress2: Added a regression test. Fixed a type on an old test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2a60dec0919c20a03c2830a9466a86f9f44fbaf0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 07:19:20 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=2a60dec0919c20a03c2830a9466a86f9f44fbaf0 commit 2a60dec0919c20a03c2830a9466a86f9f44fbaf0 Author: Peter Holm AuthorDate: 2021-05-14 07:18:39 +0000 Commit: Peter Holm CommitDate: 2021-05-14 07:18:39 +0000 stress2: Added a regression test. Fixed a type on an old test --- tools/test/stress2/misc/open2.sh | 45 ++++++++++++++++++++++++++++++++++++++ tools/test/stress2/misc/rename2.sh | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/tools/test/stress2/misc/open2.sh b/tools/test/stress2/misc/open2.sh new file mode 100755 index 000000000000..7c0994bfd4e4 --- /dev/null +++ b/tools/test/stress2/misc/open2.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Peter Holm +# +# 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. +# + +# open(2) and openat(2) syscall fuzz test + +# umount(8) returns busy +# https://people.freebsd.org/~pho/stress/log/log0111.txt +# Fixed by: cef8a95acbae + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +snums=`grep -Ew 'SYS_open|SYS_openat' /usr/include/sys/syscall.h 2>/dev/null | + awk '{print $NF}'` + [ -z "$snums" ] && exit 0 +for i in $snums; do + ./syscall4.sh $i; s=$? + [ $s -ne 0 ] && break +done +exit $s diff --git a/tools/test/stress2/misc/rename2.sh b/tools/test/stress2/misc/rename2.sh index 2c9781602d2c..085a424a98f2 100755 --- a/tools/test/stress2/misc/rename2.sh +++ b/tools/test/stress2/misc/rename2.sh @@ -40,7 +40,7 @@ cd $here rm -rf /tmp/rename.dir.* start=`date +%s` -while [ $((`date +%s` - start -lt 300 ]; do +while [ $((`date +%s` - start)) -lt 300 ]; do for j in `jot 10`; do /tmp/rename2 & done From owner-dev-commits-src-main@freebsd.org Fri May 14 08:53:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3F4263E618; Fri, 14 May 2021 08:53:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FhMkT5g7mz4tCl; Fri, 14 May 2021 08:53:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B55CB6EF9; Fri, 14 May 2021 08:53:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14E8rLfm017292; Fri, 14 May 2021 08:53:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14E8rLvK017291; Fri, 14 May 2021 08:53:21 GMT (envelope-from git) Date: Fri, 14 May 2021 08:53:21 GMT Message-Id: <202105140853.14E8rLvK017291@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: ffd61af32cf7 - main - sdhci_fsl_fdt.c: Add support for LS1028a. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ffd61af32cf76f2e59cf11a0242d327f6c24c1f0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 08:53:21 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=ffd61af32cf76f2e59cf11a0242d327f6c24c1f0 commit ffd61af32cf76f2e59cf11a0242d327f6c24c1f0 Author: Marcin Wojtas AuthorDate: 2021-04-15 13:19:13 +0000 Commit: Marcin Wojtas CommitDate: 2021-05-14 08:28:09 +0000 sdhci_fsl_fdt.c: Add support for LS1028a. Add data specific for SoC, including all necessary quirks. Submitted by: Lukasz Hajec Reviewed by: manu Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D30121 --- sys/dev/sdhci/sdhci_fsl_fdt.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/dev/sdhci/sdhci_fsl_fdt.c b/sys/dev/sdhci/sdhci_fsl_fdt.c index 167c28b60ca0..695176a17218 100644 --- a/sys/dev/sdhci/sdhci_fsl_fdt.c +++ b/sys/dev/sdhci/sdhci_fsl_fdt.c @@ -111,6 +111,12 @@ struct sdhci_fsl_fdt_soc_data { int baseclk_div; }; +static const struct sdhci_fsl_fdt_soc_data sdhci_fsl_fdt_ls1028a_soc_data = { + .quirks = SDHCI_QUIRK_DONT_SET_HISPD_BIT | + SDHCI_QUIRK_BROKEN_AUTO_STOP | SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK, + .baseclk_div = 2, +}; + static const struct sdhci_fsl_fdt_soc_data sdhci_fsl_fdt_ls1046a_soc_data = { .quirks = SDHCI_QUIRK_DONT_SET_HISPD_BIT | SDHCI_QUIRK_BROKEN_AUTO_STOP, .baseclk_div = 2, @@ -122,6 +128,7 @@ static const struct sdhci_fsl_fdt_soc_data sdhci_fsl_fdt_gen_data = { }; static const struct ofw_compat_data sdhci_fsl_fdt_compat_data[] = { + {"fsl,ls1028a-esdhc", (uintptr_t)&sdhci_fsl_fdt_ls1028a_soc_data}, {"fsl,ls1046a-esdhc", (uintptr_t)&sdhci_fsl_fdt_ls1046a_soc_data}, {"fsl,esdhc", (uintptr_t)&sdhci_fsl_fdt_gen_data}, {NULL, 0} From owner-dev-commits-src-main@freebsd.org Fri May 14 08:53:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2774C63E817; Fri, 14 May 2021 08:53:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FhMkW09V7z4tJM; Fri, 14 May 2021 08:53:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0EAB725D; Fri, 14 May 2021 08:53:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14E8rMXr017313; Fri, 14 May 2021 08:53:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14E8rMEC017312; Fri, 14 May 2021 08:53:22 GMT (envelope-from git) Date: Fri, 14 May 2021 08:53:22 GMT Message-Id: <202105140853.14E8rMEC017312@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: f0a9d7d79956 - main - sdhci_fsl_fdt.c: Add a missing call to mmc_fdt_parse. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f0a9d7d7995641901e3132242d1d9bf22dc333f6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 08:53:23 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=f0a9d7d7995641901e3132242d1d9bf22dc333f6 commit f0a9d7d7995641901e3132242d1d9bf22dc333f6 Author: Marcin Wojtas AuthorDate: 2021-04-22 10:54:41 +0000 Commit: Marcin Wojtas CommitDate: 2021-05-14 08:29:31 +0000 sdhci_fsl_fdt.c: Add a missing call to mmc_fdt_parse. Add a missing call to mmc_fdt_parse, without it some dts properties are not parsed. Submitted by: Lukasz Hajec Reviewed by: manu Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D30122 --- sys/dev/sdhci/sdhci_fsl_fdt.c | 110 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 106 insertions(+), 4 deletions(-) diff --git a/sys/dev/sdhci/sdhci_fsl_fdt.c b/sys/dev/sdhci/sdhci_fsl_fdt.c index 695176a17218..c2330a679963 100644 --- a/sys/dev/sdhci/sdhci_fsl_fdt.c +++ b/sys/dev/sdhci/sdhci_fsl_fdt.c @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -96,11 +97,13 @@ struct sdhci_fsl_fdt_softc { struct resource *irq_res; void *irq_cookie; uint32_t baseclk_hz; + uint32_t maxclk_hz; struct sdhci_fdt_gpio *gpio; struct sdhci_slot slot; bool slot_init_done; uint32_t cmd_and_mode; uint16_t sdclk_bits; + struct mmc_fdt_helper fdt_helper; uint32_t (* read)(struct sdhci_fsl_fdt_softc *, bus_size_t); void (* write)(struct sdhci_fsl_fdt_softc *, bus_size_t, uint32_t); @@ -194,9 +197,9 @@ fsl_sdhc_fdt_set_clock(struct sdhci_fsl_fdt_softc *sc, uint16_t val) ((val >> SDHCI_DIVIDER_HI_SHIFT) & SDHCI_DIVIDER_HI_MASK) << SDHCI_DIVIDER_MASK_LEN; if (div == 0) - freq = sc->baseclk_hz; + freq = sc->maxclk_hz; else - freq = sc->baseclk_hz / (2 * div); + freq = sc->maxclk_hz / (2 * div); for (prescale = 2; freq < sc->baseclk_hz / (prescale * 16); ) prescale <<= 1; @@ -445,6 +448,86 @@ sdhci_fsl_fdt_irq(void *arg) return; } +static int +sdhci_fsl_fdt_update_ios(device_t brdev, device_t reqdev) +{ + int err; + struct sdhci_fsl_fdt_softc *sc; + struct mmc_ios *ios; + struct sdhci_slot *slot; + + err = sdhci_generic_update_ios(brdev, reqdev); + if (err != 0) + return (err); + + sc = device_get_softc(brdev); + slot = device_get_ivars(reqdev); + ios = &slot->host.ios; + + switch (ios->power_mode) { + case power_on: + break; + case power_off: + if (bootverbose) + device_printf(sc->dev, "Powering down sd/mmc\n"); + + if (sc->fdt_helper.vmmc_supply) + regulator_disable(sc->fdt_helper.vmmc_supply); + if (sc->fdt_helper.vqmmc_supply) + regulator_disable(sc->fdt_helper.vqmmc_supply); + break; + case power_up: + if (bootverbose) + device_printf(sc->dev, "Powering up sd/mmc\n"); + + if (sc->fdt_helper.vmmc_supply) + regulator_enable(sc->fdt_helper.vmmc_supply); + if (sc->fdt_helper.vqmmc_supply) + regulator_enable(sc->fdt_helper.vqmmc_supply); + break; + }; + + return (0); +} + +static int +sdhci_fsl_fdt_switch_vccq(device_t brdev, device_t reqdev) +{ + struct sdhci_fsl_fdt_softc *sc; + struct sdhci_slot *slot; + int uvolt, err; + + err = sdhci_generic_switch_vccq(brdev, reqdev); + if (err != 0) + return (err); + + sc = device_get_softc(brdev); + + if (sc->fdt_helper.vqmmc_supply == NULL) + return EOPNOTSUPP; + + slot = device_get_ivars(reqdev); + switch (slot->host.ios.vccq) { + case vccq_180: + uvolt = 1800000; + break; + case vccq_330: + uvolt = 3300000; + break; + default: + return EINVAL; + } + + err = regulator_set_voltage(sc->fdt_helper.vqmmc_supply, uvolt, uvolt); + if (err != 0) { + device_printf(sc->dev, + "Cannot set vqmmc to %d<->%d\n", uvolt, uvolt); + return (err); + } + + return (0); +} + static int sdhci_fsl_fdt_get_ro(device_t bus, device_t child) { @@ -463,10 +546,24 @@ sdhci_fsl_fdt_get_card_present(device_t dev, struct sdhci_slot *slot) return (sdhci_fdt_gpio_get_present(sc->gpio)); } +static void +sdhci_fsl_fdt_of_parse(device_t dev) +{ + struct sdhci_fsl_fdt_softc *sc; + phandle_t node; + + sc = device_get_softc(dev); + node = ofw_bus_get_node(dev); + + /* Call mmc_fdt_parse in order to get mmc related properties. */ + mmc_fdt_parse(dev, node, &sc->fdt_helper, &sc->slot.host); +} + static int sdhci_fsl_fdt_attach(device_t dev) { struct sdhci_fsl_fdt_softc *sc; + struct mmc_host *host; uint32_t val, buf_order; uintptr_t ocd_data; uint64_t clk_hz; @@ -481,6 +578,7 @@ sdhci_fsl_fdt_attach(device_t dev) sc->soc_data = (struct sdhci_fsl_fdt_soc_data *)ocd_data; sc->dev = dev; sc->slot.quirks = sc->soc_data->quirks; + host = &sc->slot.host; rid = 0; sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, @@ -534,6 +632,9 @@ sdhci_fsl_fdt_attach(device_t dev) buf_order = SDHCI_FSL_PROT_CTRL_BYTE_SWAP; } + sdhci_fsl_fdt_of_parse(dev); + sc->maxclk_hz = host->f_max ? host->f_max : sc->baseclk_hz; + /* * Setting this register affects byte order in SDHCI_BUFFER only. * If the eSDHC block is connected over a big-endian bus, the data @@ -555,7 +656,7 @@ sdhci_fsl_fdt_attach(device_t dev) WR4(sc, SDHCI_CLOCK_CONTROL, val & ~SDHCI_FSL_CLK_SDCLKEN); val = RD4(sc, SDHCI_FSL_ESDHC_CTRL); WR4(sc, SDHCI_FSL_ESDHC_CTRL, val | SDHCI_FSL_ESDHC_CTRL_CLK_DIV2); - sc->slot.max_clk = sc->baseclk_hz; + sc->slot.max_clk = sc->maxclk_hz; sc->gpio = sdhci_fdt_gpio_setup(dev, &sc->slot); /* @@ -656,11 +757,12 @@ static const device_method_t sdhci_fsl_fdt_methods[] = { DEVMETHOD(bus_write_ivar, sdhci_generic_write_ivar), /* MMC bridge interface. */ - DEVMETHOD(mmcbr_update_ios, sdhci_generic_update_ios), DEVMETHOD(mmcbr_request, sdhci_generic_request), DEVMETHOD(mmcbr_get_ro, sdhci_fsl_fdt_get_ro), DEVMETHOD(mmcbr_acquire_host, sdhci_generic_acquire_host), DEVMETHOD(mmcbr_release_host, sdhci_generic_release_host), + DEVMETHOD(mmcbr_switch_vccq, sdhci_fsl_fdt_switch_vccq), + DEVMETHOD(mmcbr_update_ios, sdhci_fsl_fdt_update_ios), /* SDHCI accessors. */ DEVMETHOD(sdhci_read_1, sdhci_fsl_fdt_read_1), From owner-dev-commits-src-main@freebsd.org Fri May 14 08:53:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62F0F63E49C; Fri, 14 May 2021 08:53:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FhMkX2546z4tJR; Fri, 14 May 2021 08:53:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A2867522; Fri, 14 May 2021 08:53:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14E8rN7A017340; Fri, 14 May 2021 08:53:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14E8rNbI017339; Fri, 14 May 2021 08:53:23 GMT (envelope-from git) Date: Fri, 14 May 2021 08:53:23 GMT Message-Id: <202105140853.14E8rNbI017339@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 1f84b3a247bf - main - sdhci_fsl_fdt.c: Read supported voltages from dts. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1f84b3a247bf4c0e584e36576a20dc120def1214 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 08:53:24 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=1f84b3a247bf4c0e584e36576a20dc120def1214 commit 1f84b3a247bf4c0e584e36576a20dc120def1214 Author: Marcin Wojtas AuthorDate: 2021-04-22 11:01:06 +0000 Commit: Marcin Wojtas CommitDate: 2021-05-14 08:34:37 +0000 sdhci_fsl_fdt.c: Read supported voltages from dts. We shouldn't overwrite capability register. Instead, voltages supported by the controller have to be read from dts, as the hardware doesn't report correct values. Submitted by: Lukasz Hajec Reviewed by: manu Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D30123 --- sys/dev/sdhci/sdhci_fsl_fdt.c | 73 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 65 insertions(+), 8 deletions(-) diff --git a/sys/dev/sdhci/sdhci_fsl_fdt.c b/sys/dev/sdhci/sdhci_fsl_fdt.c index c2330a679963..26092f662406 100644 --- a/sys/dev/sdhci/sdhci_fsl_fdt.c +++ b/sys/dev/sdhci/sdhci_fsl_fdt.c @@ -90,6 +90,9 @@ __FBSDID("$FreeBSD$"); #define SDHCI_FSL_ESDHC_CTRL_SNOOP (1 << 6) #define SDHCI_FSL_ESDHC_CTRL_CLK_DIV2 (1 << 19) +#define SDHCI_FSL_CAN_VDD_MASK \ + (SDHCI_CAN_VDD_180 | SDHCI_CAN_VDD_300 | SDHCI_CAN_VDD_330) + struct sdhci_fsl_fdt_softc { device_t dev; const struct sdhci_fsl_fdt_soc_data *soc_data; @@ -295,18 +298,11 @@ sdhci_fsl_fdt_read_4(device_t dev, struct sdhci_slot *slot, bus_size_t off) val32 = RD4(sc, off); - switch (off) { - case SDHCI_CAPABILITIES: - val32 &= ~(SDHCI_CAN_DO_SUSPEND | SDHCI_CAN_VDD_180); - break; - case SDHCI_PRESENT_STATE: + if (off == SDHCI_PRESENT_STATE) { wrk32 = val32; val32 &= SDHCI_FSL_PRES_COMPAT_MASK; val32 |= (wrk32 >> 4) & SDHCI_STATE_DAT_MASK; val32 |= (wrk32 << 1) & SDHCI_STATE_CMD; - break; - default: - break; } return (val32); @@ -546,17 +542,78 @@ sdhci_fsl_fdt_get_card_present(device_t dev, struct sdhci_slot *slot) return (sdhci_fdt_gpio_get_present(sc->gpio)); } +static uint32_t +sdhci_fsl_fdt_vddrange_to_mask(device_t dev, uint32_t *vdd_ranges, int len) +{ + uint32_t vdd_min, vdd_max; + uint32_t vdd_mask = 0; + int i; + + /* Ranges are organized as pairs of values. */ + if ((len % 2) != 0) { + device_printf(dev, "Invalid voltage range\n"); + return (0); + } + len = len / 2; + + for (i = 0; i < len; i++) { + vdd_min = vdd_ranges[2 * i]; + vdd_max = vdd_ranges[2 * i + 1]; + + if (vdd_min > vdd_max || vdd_min < 1650 || vdd_min > 3600 || + vdd_max < 1650 || vdd_max > 3600) { + device_printf(dev, "Voltage range %d - %d is out of bounds\n", + vdd_min, vdd_max); + return (0); + } + + if (vdd_min <= 1800 && vdd_max >= 1800) + vdd_mask |= SDHCI_CAN_VDD_180; + if (vdd_min <= 3000 && vdd_max >= 3000) + vdd_mask |= SDHCI_CAN_VDD_300; + if (vdd_min <= 3300 && vdd_max >= 3300) + vdd_mask |= SDHCI_CAN_VDD_330; + } + + return (vdd_mask); +} + static void sdhci_fsl_fdt_of_parse(device_t dev) { struct sdhci_fsl_fdt_softc *sc; phandle_t node; + pcell_t *voltage_ranges; + uint32_t vdd_mask = 0; + ssize_t num_ranges; sc = device_get_softc(dev); node = ofw_bus_get_node(dev); /* Call mmc_fdt_parse in order to get mmc related properties. */ mmc_fdt_parse(dev, node, &sc->fdt_helper, &sc->slot.host); + + sc->slot.caps = sdhci_fsl_fdt_read_4(dev, &sc->slot, + SDHCI_CAPABILITIES) & ~(SDHCI_CAN_DO_SUSPEND); + sc->slot.caps2 = sdhci_fsl_fdt_read_4(dev, &sc->slot, + SDHCI_CAPABILITIES2); + + /* Parse the "voltage-ranges" dts property. */ + num_ranges = OF_getencprop_alloc(node, "voltage-ranges", + (void **) &voltage_ranges); + if (num_ranges <= 0) + return; + vdd_mask = sdhci_fsl_fdt_vddrange_to_mask(dev, voltage_ranges, + num_ranges / sizeof(uint32_t)); + OF_prop_free(voltage_ranges); + + /* Overwrite voltage caps only if we got something from dts. */ + if (vdd_mask != 0 && + (vdd_mask != (sc->slot.caps & SDHCI_FSL_CAN_VDD_MASK))) { + sc->slot.caps &= ~(SDHCI_FSL_CAN_VDD_MASK); + sc->slot.caps |= vdd_mask; + sc->slot.quirks |= SDHCI_QUIRK_MISSING_CAPS; + } } static int From owner-dev-commits-src-main@freebsd.org Fri May 14 08:53:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AAFB263E539; Fri, 14 May 2021 08:53:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FhMkY1yn8z4tXn; Fri, 14 May 2021 08:53:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2B1697523; Fri, 14 May 2021 08:53:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14E8rPUD017362; Fri, 14 May 2021 08:53:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14E8rPvq017361; Fri, 14 May 2021 08:53:25 GMT (envelope-from git) Date: Fri, 14 May 2021 08:53:25 GMT Message-Id: <202105140853.14E8rPvq017361@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: f55bd0e5798d - main - qoriq_dw_pci: disable LS1028A support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f55bd0e5798dd17251302f73904da76bdfd257b9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 08:53:25 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=f55bd0e5798dd17251302f73904da76bdfd257b9 commit f55bd0e5798dd17251302f73904da76bdfd257b9 Author: Marcin Wojtas AuthorDate: 2021-05-14 08:39:46 +0000 Commit: Marcin Wojtas CommitDate: 2021-05-14 08:50:17 +0000 qoriq_dw_pci: disable LS1028A support Enabled driver initialization causes an abort on the NXP LS1028ARDB platform (without any external endpoints connected). Temporarily disable qoriq_dw_pci probe, so that to allow successful booting of the OS. Submitted by: Lukasz Hajec Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D30229 --- sys/arm64/qoriq/qoriq_dw_pci.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/arm64/qoriq/qoriq_dw_pci.c b/sys/arm64/qoriq/qoriq_dw_pci.c index 424a030e094c..4d0c7928fc4c 100644 --- a/sys/arm64/qoriq/qoriq_dw_pci.c +++ b/sys/arm64/qoriq/qoriq_dw_pci.c @@ -101,7 +101,13 @@ static struct qoriq_dw_pci_cfg ls2028_cfg = { /* Compatible devices. */ static struct ofw_compat_data compat_data[] = { {"fsl,ls1012a-pcie", (uintptr_t)&ls1012_cfg}, + /* + * XXX: On LS1028ARDB attaching this driver causes external abort. + * Disable it for now. + */ +#ifdef notyet {"fsl,ls1028a-pcie", (uintptr_t)&ls2028_cfg}, +#endif {"fsl,ls1043a-pcie", (uintptr_t)&ls1043_cfg}, {"fsl,ls1046a-pcie", (uintptr_t)&ls1012_cfg}, {"fsl,ls2080a-pcie", (uintptr_t)&ls2080_cfg}, From owner-dev-commits-src-main@freebsd.org Fri May 14 12:32:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C7D08645D0D; Fri, 14 May 2021 12:32:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FhSbX5Kfjz3RKj; Fri, 14 May 2021 12:32:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A9DD012720; Fri, 14 May 2021 12:32:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14ECWe58010683; Fri, 14 May 2021 12:32:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14ECWeGH010682; Fri, 14 May 2021 12:32:40 GMT (envelope-from git) Date: Fri, 14 May 2021 12:32:40 GMT Message-Id: <202105141232.14ECWeGH010682@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Nathan Whitehorn Subject: git: 34766aa8cb51 - main - Fix scripted installs on EFI systems using ZFS root with zfsboot. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nwhitehorn X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 34766aa8cb514472c571f8b0e90e833833acef51 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 12:32:40 -0000 The branch main has been updated by nwhitehorn: URL: https://cgit.FreeBSD.org/src/commit/?id=34766aa8cb514472c571f8b0e90e833833acef51 commit 34766aa8cb514472c571f8b0e90e833833acef51 Author: Nathan Whitehorn AuthorDate: 2021-05-14 12:30:41 +0000 Commit: Nathan Whitehorn CommitDate: 2021-05-14 12:30:41 +0000 Fix scripted installs on EFI systems using ZFS root with zfsboot. Unlike attended installations, scripted installs did not mount non-ZFS partitions when ZFS root (via zfsboot) was selected. Since this included the ESP, the EFI loader was not installed. Copy logic from the attended-install path to make this work. PR: 255824, 255081 MFC after: 1 week Obtained from: Mark Huizer --- usr.sbin/bsdinstall/scripts/script | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/script b/usr.sbin/bsdinstall/scripts/script index 1d8e52a9d6d3..6a03e88bba39 100755 --- a/usr.sbin/bsdinstall/scripts/script +++ b/usr.sbin/bsdinstall/scripts/script @@ -111,8 +111,8 @@ if [ "$ZFSBOOT_DISKS" ]; then bsdinstall zfsboot else bsdinstall scriptedpart "$PARTITIONS" - bsdinstall mount fi +bsdinstall mount # Unpack distributions bsdinstall checksum @@ -163,9 +163,8 @@ fi bsdinstall entropy if [ "$ZFSBOOT_DISKS" ]; then zpool export $ZFSBOOT_POOL_NAME -else - bsdinstall umount fi +bsdinstall umount f_dprintf "Installation Completed at %s" "$( date )" From owner-dev-commits-src-main@freebsd.org Fri May 14 14:08:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F062C649A81; Fri, 14 May 2021 14:08:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FhVkC6WDlz3psn; Fri, 14 May 2021 14:08:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC50E13619; Fri, 14 May 2021 14:08:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14EE8ZjY032613; Fri, 14 May 2021 14:08:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14EE8ZnX032612; Fri, 14 May 2021 14:08:35 GMT (envelope-from git) Date: Fri, 14 May 2021 14:08:35 GMT Message-Id: <202105141408.14EE8ZnX032612@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 2cca77ee0134 - main - kqueue timer: Remove detached knotes from the process stop queue MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2cca77ee01343bf080f1b70f0217a84c200fe7c1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 14:08:36 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2cca77ee01343bf080f1b70f0217a84c200fe7c1 commit 2cca77ee01343bf080f1b70f0217a84c200fe7c1 Author: Mark Johnston AuthorDate: 2021-05-14 14:07:56 +0000 Commit: Mark Johnston CommitDate: 2021-05-14 14:08:14 +0000 kqueue timer: Remove detached knotes from the process stop queue There are some scenarios where a timer event may be detached when it is on the process' kqueue timer stop queue. If kqtimer_proc_continue() is called after that point, it will iterate over the queue and access freed timer structures. It is also possible, at least in a multithreaded program, for a stopped timer event to be scheduled without removing it from the process' stop queue. Ensure that we do not doubly enqueue the event structure in this case. Reported by: syzbot+cea0931bb4e34cd728bd@syzkaller.appspotmail.com Reported by: syzbot+9e1a2f3734652015998c@syzkaller.appspotmail.com Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30251 --- sys/kern/kern_event.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 1067e7f128b7..e7047e9a7ad9 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -680,11 +680,14 @@ struct kq_timer_cb_data { struct proc *p; struct knote *kn; int cpuid; + int flags; TAILQ_ENTRY(kq_timer_cb_data) link; sbintime_t next; /* next timer event fires at */ sbintime_t to; /* precalculated timer period, 0 for abs */ }; +#define KQ_TIMER_CB_ENQUEUED 0x01 + static void kqtimer_sched_callout(struct kq_timer_cb_data *kc) { @@ -706,6 +709,7 @@ kqtimer_proc_continue(struct proc *p) TAILQ_FOREACH_SAFE(kc, &p->p_kqtim_stop, link, kc1) { TAILQ_REMOVE(&p->p_kqtim_stop, kc, link); + kc->flags &= ~KQ_TIMER_CB_ENQUEUED; if (kc->next <= now) filt_timerexpire_l(kc->kn, true); else @@ -753,7 +757,10 @@ filt_timerexpire_l(struct knote *kn, bool proc_locked) if (!proc_locked) PROC_LOCK(p); if (P_SHOULDSTOP(p) || P_KILLED(p)) { - TAILQ_INSERT_TAIL(&p->p_kqtim_stop, kc, link); + if ((kc->flags & KQ_TIMER_CB_ENQUEUED) == 0) { + kc->flags |= KQ_TIMER_CB_ENQUEUED; + TAILQ_INSERT_TAIL(&p->p_kqtim_stop, kc, link); + } if (!proc_locked) PROC_UNLOCK(p); return; @@ -826,6 +833,7 @@ filt_timerattach(struct knote *kn) kc->kn = kn; kc->p = curproc; kc->cpuid = PCPU_GET(cpuid); + kc->flags = 0; callout_init(&kc->c, 1); filt_timerstart(kn, to); @@ -856,6 +864,11 @@ filt_timerdetach(struct knote *kn) kc = kn->kn_ptr.p_v; callout_drain(&kc->c); + if ((kc->flags & KQ_TIMER_CB_ENQUEUED) != 0) { + PROC_LOCK(kc->p); + TAILQ_REMOVE(&kc->p->p_kqtim_stop, kc, link); + PROC_UNLOCK(kc->p); + } free(kc, M_KQUEUE); old = atomic_fetchadd_int(&kq_ncallouts, -1); KASSERT(old > 0, ("Number of callouts cannot become negative")); From owner-dev-commits-src-main@freebsd.org Fri May 14 14:23:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 815AB649FE5; Fri, 14 May 2021 14:23:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FhW3v2H16z3rjj; Fri, 14 May 2021 14:23:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 409AC13DA6; Fri, 14 May 2021 14:23:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14EENtvt058649; Fri, 14 May 2021 14:23:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14EENtDX058648; Fri, 14 May 2021 14:23:55 GMT (envelope-from git) Date: Fri, 14 May 2021 14:23:55 GMT Message-Id: <202105141423.14EENtDX058648@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: b5fb9ae6872c - main - vfs: lockless writecount adjustment in set/unset text MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b5fb9ae6872c499f1a02bec41f48b163a73a2aaa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 14:23:55 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=b5fb9ae6872c499f1a02bec41f48b163a73a2aaa commit b5fb9ae6872c499f1a02bec41f48b163a73a2aaa Author: Mateusz Guzik AuthorDate: 2021-05-07 14:04:27 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-14 14:22:21 +0000 vfs: lockless writecount adjustment in set/unset text ... for cases where this is not the first/last exec. --- sys/kern/vfs_default.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index cf224981cbe7..3518bbeaa279 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -1177,9 +1177,23 @@ vop_stdset_text(struct vop_set_text_args *ap) { struct vnode *vp; struct mount *mp; - int error; + int error, n; vp = ap->a_vp; + + /* + * Avoid the interlock if execs are already present. + */ + n = atomic_load_int(&vp->v_writecount); + for (;;) { + if (n > -1) { + break; + } + if (atomic_fcmpset_int(&vp->v_writecount, &n, n - 1)) { + return (0); + } + } + VI_LOCK(vp); if (vp->v_writecount > 0) { error = ETXTBSY; @@ -1207,10 +1221,24 @@ static int vop_stdunset_text(struct vop_unset_text_args *ap) { struct vnode *vp; - int error; + int error, n; bool last; vp = ap->a_vp; + + /* + * Avoid the interlock if this is not the last exec. + */ + n = atomic_load_int(&vp->v_writecount); + for (;;) { + if (n >= -1) { + break; + } + if (atomic_fcmpset_int(&vp->v_writecount, &n, n + 1)) { + return (0); + } + } + last = false; VI_LOCK(vp); if (vp->v_writecount < 0) { From owner-dev-commits-src-main@freebsd.org Fri May 14 14:23:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9905764A297; Fri, 14 May 2021 14:23:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FhW3w3cTBz3rW7; Fri, 14 May 2021 14:23:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 617AE13F21; Fri, 14 May 2021 14:23:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14EENuPa058670; Fri, 14 May 2021 14:23:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14EENuqh058669; Fri, 14 May 2021 14:23:56 GMT (envelope-from git) Date: Fri, 14 May 2021 14:23:56 GMT Message-Id: <202105141423.14EENuqh058669@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: ca1ce50b2b5e - main - vfs: add more safety against concurrent forced unmount to vn_write MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ca1ce50b2b5ef11d85841f3aead98b2a9ad18819 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 14:23:56 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=ca1ce50b2b5ef11d85841f3aead98b2a9ad18819 commit ca1ce50b2b5ef11d85841f3aead98b2a9ad18819 Author: Mateusz Guzik AuthorDate: 2021-05-14 11:26:56 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-14 14:22:22 +0000 vfs: add more safety against concurrent forced unmount to vn_write 1. stop re-reading ->v_mount (can become NULL) 2. stop re-reading ->v_type (can change to VBAD) --- sys/kern/vfs_vnops.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 8f583329f067..6bf798cd73c5 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1107,6 +1107,7 @@ vn_write(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, off_t orig_offset; int error, ioflag, lock_flags; int advice; + bool need_finished_write; KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); @@ -1121,9 +1122,11 @@ vn_write(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, ioflag |= IO_NDELAY; if (fp->f_flag & O_DIRECT) ioflag |= IO_DIRECT; - if ((fp->f_flag & O_FSYNC) || - (vp->v_mount && (vp->v_mount->mnt_flag & MNT_SYNCHRONOUS))) - ioflag |= IO_SYNC; + if (fp->f_flag & O_FSYNC) { + mp = atomic_load_ptr(&vp->v_mount); + if (mp != NULL && mp->mnt_flag & MNT_SYNCHRONOUS) + ioflag |= IO_SYNC; + } /* * For O_DSYNC we set both IO_SYNC and IO_DATASYNC, so that VOP_WRITE() * implementations that don't understand IO_DATASYNC fall back to full @@ -1132,9 +1135,13 @@ vn_write(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, if (fp->f_flag & O_DSYNC) ioflag |= IO_SYNC | IO_DATASYNC; mp = NULL; - if (vp->v_type != VCHR && - (error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) - goto unlock; + need_finished_write = false; + if (vp->v_type != VCHR) { + error = vn_start_write(vp, &mp, V_WAIT | PCATCH); + if (error != 0) + goto unlock; + need_finished_write = true; + } advice = get_advice(fp, uio); @@ -1165,7 +1172,7 @@ vn_write(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, error = VOP_WRITE(vp, uio, ioflag, fp->f_cred); fp->f_nextoff[UIO_WRITE] = uio->uio_offset; VOP_UNLOCK(vp); - if (vp->v_type != VCHR) + if (need_finished_write) vn_finished_write(mp); if (error == 0 && advice == POSIX_FADV_NOREUSE && orig_offset != uio->uio_offset) From owner-dev-commits-src-main@freebsd.org Fri May 14 15:18:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 91F8264B9EC; Fri, 14 May 2021 15:18:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FhXGl3k2vz3wWS; Fri, 14 May 2021 15:18:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C88D142F4; Fri, 14 May 2021 15:18:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14EFINFn025512; Fri, 14 May 2021 15:18:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14EFINQL025511; Fri, 14 May 2021 15:18:23 GMT (envelope-from git) Date: Fri, 14 May 2021 15:18:23 GMT Message-Id: <202105141518.14EFINQL025511@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: c65e2d7092d6 - main - Update ugen(4) manual page. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c65e2d7092d6cbaf03721ebe46e51cec4bd6ac0f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 15:18:23 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=c65e2d7092d6cbaf03721ebe46e51cec4bd6ac0f commit c65e2d7092d6cbaf03721ebe46e51cec4bd6ac0f Author: Hans Petter Selasky AuthorDate: 2021-05-14 14:34:15 +0000 Commit: Hans Petter Selasky CommitDate: 2021-05-14 15:14:18 +0000 Update ugen(4) manual page. Fix description of generic USB character devices. PR: 244842 MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- share/man/man4/ugen.4 | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/share/man/man4/ugen.4 b/share/man/man4/ugen.4 index ad3ba80e0af7..35580e8aa88b 100644 --- a/share/man/man4/ugen.4 +++ b/share/man/man4/ugen.4 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 24, 2018 +.Dd May 14, 2021 .Dt UGEN 4 .Os .Sh NAME @@ -304,12 +304,19 @@ debug message verbosity. Default is 0. .El .Sh FILES -.Bl -tag -width ".Pa /dev/ugen Ns Ar N Ns Pa \&. Ns Ar E" -compact -.It Pa /dev/ugen Ns Ar N Ns Pa \&. Ns Ar E +.Bl -tag -width "/dev/usb/B.D.E" -compact +.It Pa /dev/usb/B.D.E Endpoint .Ar E of device -.Ar N . +.Ar D +at bus +.Ar B . +.It Pa /dev/ugenB.D +Control endpoint, 0, of device +.Ar D +at bus +.Ar B . .El .Sh SEE ALSO .Xr usb 4 @@ -319,5 +326,3 @@ The driver appeared in .Nx 1.4 . -.\" .Sh BUGS -.\" The driver is not yet finished; there is no access to isochronous endpoints. From owner-dev-commits-src-main@freebsd.org Fri May 14 15:18:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA02364B94B; Fri, 14 May 2021 15:18:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FhXGm4qZsz3wLl; Fri, 14 May 2021 15:18:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 83D9C14833; Fri, 14 May 2021 15:18:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14EFIOWT025533; Fri, 14 May 2021 15:18:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14EFIONt025532; Fri, 14 May 2021 15:18:24 GMT (envelope-from git) Date: Fri, 14 May 2021 15:18:24 GMT Message-Id: <202105141518.14EFIONt025532@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: c904e20cc903 - main - Implement own command line option for the frequently used -i usbusX -f Y syntax, -d ugenX.Y, similar to what usbconfig(8) does. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c904e20cc903d28c1090c531c907cdd6865455ff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 15:18:25 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=c904e20cc903d28c1090c531c907cdd6865455ff commit c904e20cc903d28c1090c531c907cdd6865455ff Author: Hans Petter Selasky AuthorDate: 2021-05-14 15:12:57 +0000 Commit: Hans Petter Selasky CommitDate: 2021-05-14 15:15:07 +0000 Implement own command line option for the frequently used -i usbusX -f Y syntax, -d ugenX.Y, similar to what usbconfig(8) does. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- usr.sbin/usbdump/usbdump.8 | 30 ++++++++++++++++++++++++- usr.sbin/usbdump/usbdump.c | 56 ++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 76 insertions(+), 10 deletions(-) diff --git a/usr.sbin/usbdump/usbdump.8 b/usr.sbin/usbdump/usbdump.8 index 475e832cd03b..6b5ad1920e94 100644 --- a/usr.sbin/usbdump/usbdump.8 +++ b/usr.sbin/usbdump/usbdump.8 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 24, 2012 +.Dd May 14, 2021 .Dt USBDUMP 8 .Os .Sh NAME @@ -33,6 +33,9 @@ .Nd "dump traffic on USB host controller" .Sh SYNOPSIS .Nm +.Op Fl d Ar [ugen]B +.Op Fl d Ar [ugen]B.D +.Op Fl d Ar [ugen]B.D.E .Op Fl i Ar ifname .Op Fl r Ar file .Op Fl s Ar snaplen @@ -48,6 +51,31 @@ utility provides a way to dump USB packets on host controllers. .Pp The following options are accepted: .Bl -tag -width ".Fl f Ar file" +.It Fl d Ar [ugen]bus +Shortcut for +.Fl i +option. +The argument may be prefixed by "ugen". +The option may be specified multiple times, but the bus specified must +be the same. +.It Fl d Ar [ugen]bus.device +Shortcut for +.Fl i +and +.Fl f +options. +The argument may be prefixed by "ugen". +The option may be specified multiple times, but the bus specified must +be the same. +.It Fl d Ar [ugen]bus.device.endpoint +Shortcut for +.Fl i +and +.Fl f +options. +The argument may be prefixed by "ugen". +The option may be specified multiple times, but the bus specified must +be the same. .It Fl b Ar file Store data part of the USB trace in binary format to the given .Ar file . diff --git a/usr.sbin/usbdump/usbdump.c b/usr.sbin/usbdump/usbdump.c index a38d08a252af..00d3b8e8913b 100644 --- a/usr.sbin/usbdump/usbdump.c +++ b/usr.sbin/usbdump/usbdump.c @@ -108,14 +108,14 @@ struct header_32 { uint8_t align; } __packed; -static int doexit = 0; -static int pkt_captured = 0; -static int verbose = 0; +static int doexit; +static int pkt_captured; +static int verbose; static int uf_minor; -static const char *i_arg = "usbus0"; -static const char *r_arg = NULL; -static const char *w_arg = NULL; -static const char *b_arg = NULL; +static char *i_arg; +static char *r_arg; +static char *w_arg; +static char *b_arg; static struct usbcap uc; static const char *errstr_table[USB_ERR_MAX] = { [USB_ERR_NORMAL_COMPLETION] = "0", @@ -779,7 +779,10 @@ usage(void) #define FMT " %-14s %s\n" fprintf(stderr, "usage: usbdump [options]\n"); - fprintf(stderr, FMT, "-i ", "Listen on USB bus interface"); + fprintf(stderr, FMT, "-d [ugen]B", "Listen on bus, B"); + fprintf(stderr, FMT, "-d [ugen]B.D", "Listen on bus, B and device, D"); + fprintf(stderr, FMT, "-d [ugen]B.D.E", "Listen on bus, B, device, D, and endpoint E"); + fprintf(stderr, FMT, "-i ", "Listen on this bus interface"); fprintf(stderr, FMT, "-f ", "Specify a device and endpoint filter"); fprintf(stderr, FMT, "-r ", "Read the raw packets from file"); fprintf(stderr, FMT, "-s ", "Snapshot bytes from each packet"); @@ -828,9 +831,41 @@ main(int argc, char *argv[]) const char *optstring; char *pp; - optstring = "b:hi:r:s:vw:f:"; + optstring = "b:d:hi:r:s:vw:f:"; while ((o = getopt(argc, argv, optstring)) != -1) { switch (o) { + case 'd': + pp = optarg; + if (pp[0] == 'u' && pp[1] == 'g' && pp[2] == 'e' && pp[3] == 'n') + pp += 4; + ifindex = strtol(pp, &pp, 10); + /* Must be same bus when using -d option. */ + if (i_arg != NULL) { + if (atoi(i_arg + 5) != ifindex) + usage(); + } else { + asprintf(&i_arg, "usbus%d", ifindex); + } + /* Parse unit and endpoint, if any. */ + if (pp != NULL) { + if (*pp == '.') { + filt_unit = strtol(pp + 1, &pp, 10); + filt_ep = -1; + if (pp != NULL) { + if (*pp == '.') { + filt_ep = strtol(pp + 1, &pp, 10); + if (pp != NULL && *pp != 0) + usage(); + } else if (*pp != 0) { + usage(); + } + } + add_filter(filt_unit, filt_ep); + } else if (*pp != 0) { + usage(); + } + } + break; case 'i': i_arg = optarg; break; @@ -879,6 +914,9 @@ main(int argc, char *argv[]) } } + if (i_arg == NULL) + i_arg = "usbus0"; + if (b_arg != NULL) { p->bfd = open(b_arg, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR); From owner-dev-commits-src-main@freebsd.org Fri May 14 15:43:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8BFB64C352; Fri, 14 May 2021 15:43:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FhXqv4w4Cz4T69; Fri, 14 May 2021 15:43:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9B83314B4E; Fri, 14 May 2021 15:43:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14EFhdNu064625; Fri, 14 May 2021 15:43:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14EFhdNh064624; Fri, 14 May 2021 15:43:39 GMT (envelope-from git) Date: Fri, 14 May 2021 15:43:39 GMT Message-Id: <202105141543.14EFhdNh064624@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 852088f6af6c - main - vfs: add missing atomic conversion to writecount adjustment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 852088f6af6c5cd44542dde72aa5c3f4c4f9353c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 15:43:39 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=852088f6af6c5cd44542dde72aa5c3f4c4f9353c commit 852088f6af6c5cd44542dde72aa5c3f4c4f9353c Author: Mateusz Guzik AuthorDate: 2021-05-14 15:41:39 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-14 15:42:05 +0000 vfs: add missing atomic conversion to writecount adjustment Fixes: ("vfs: lockless writecount adjustment in set/unset text") --- sys/kern/vfs_default.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 3518bbeaa279..ace9ad1d37c3 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -1210,7 +1210,7 @@ vop_stdset_text(struct vop_set_text_args *ap) vrefl(vp); } - vp->v_writecount--; + atomic_subtract_int(&vp->v_writecount, 1); error = 0; } VI_UNLOCK(vp); @@ -1247,7 +1247,7 @@ vop_stdunset_text(struct vop_unset_text_args *ap) last = true; vp->v_iflag &= ~VI_TEXT_REF; } - vp->v_writecount++; + atomic_add_int(&vp->v_writecount, 1); error = 0; } else { error = EINVAL; From owner-dev-commits-src-main@freebsd.org Fri May 14 16:10:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E0B9164CC74; Fri, 14 May 2021 16:10:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FhYQd53lzz4X4f; Fri, 14 May 2021 16:10:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A0B0115418; Fri, 14 May 2021 16:10:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14EGAHeV099257; Fri, 14 May 2021 16:10:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14EGAHDV099254; Fri, 14 May 2021 16:10:17 GMT (envelope-from git) Date: Fri, 14 May 2021 16:10:17 GMT Message-Id: <202105141610.14EGAHDV099254@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 76cfc6fa0d81 - main - Fix a use after free in update_rtm_from_rc(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 76cfc6fa0d819e7caca86c8299947cea1af9d6bc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 16:10:17 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=76cfc6fa0d819e7caca86c8299947cea1af9d6bc commit 76cfc6fa0d819e7caca86c8299947cea1af9d6bc Author: Alexander V. Chernikov AuthorDate: 2021-05-14 16:03:08 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-05-14 16:06:41 +0000 Fix a use after free in update_rtm_from_rc(). update_rtm_from_rc() calls update_rtm_from_info() internally. The latter one may update provided prtm pointer with a new rtm. Reassign rtm from prtm afeter calling update_rtm_from_info() to avoid touching the freed rtm. PR: 255871 Submitted by: lylgood@foxmail.com MFC after: 3 days --- sys/net/rtsock.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 6930bd167ac1..3cb645f42e4c 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -976,6 +976,7 @@ update_rtm_from_rc(struct rt_addrinfo *info, struct rt_msghdr **prtm, if ((error = update_rtm_from_info(info, prtm, alloc_len)) != 0) return (error); + rtm = *prtm; rtm->rtm_flags = rc->rc_rt->rte_flags | nhop_get_rtflags(nh); if (rtm->rtm_flags & RTF_GWFLAG_COMPAT) rtm->rtm_flags = RTF_GATEWAY | From owner-dev-commits-src-main@freebsd.org Fri May 14 18:04:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E84D64F1C9; Fri, 14 May 2021 18:04:10 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fhby21x9fz4mqQ; Fri, 14 May 2021 18:04:09 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 14EI41V2074110 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 14 May 2021 21:04:04 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 14EI41V2074110 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 14EI41oN074109; Fri, 14 May 2021 21:04:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 14 May 2021 21:04:01 +0300 From: Konstantin Belousov To: Mateusz Guzik Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: b5fb9ae6872c - main - vfs: lockless writecount adjustment in set/unset text Message-ID: References: <202105141423.14EENtDX058648@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202105141423.14EENtDX058648@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4Fhby21x9fz4mqQ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 18:04:10 -0000 On Fri, May 14, 2021 at 02:23:55PM +0000, Mateusz Guzik wrote: > The branch main has been updated by mjg: > > URL: https://cgit.FreeBSD.org/src/commit/?id=b5fb9ae6872c499f1a02bec41f48b163a73a2aaa > > commit b5fb9ae6872c499f1a02bec41f48b163a73a2aaa > Author: Mateusz Guzik > AuthorDate: 2021-05-07 14:04:27 +0000 > Commit: Mateusz Guzik > CommitDate: 2021-05-14 14:22:21 +0000 > > vfs: lockless writecount adjustment in set/unset text > > ... for cases where this is not the first/last exec. > --- > sys/kern/vfs_default.c | 32 ++++++++++++++++++++++++++++++-- > 1 file changed, 30 insertions(+), 2 deletions(-) > > diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c > index cf224981cbe7..3518bbeaa279 100644 > --- a/sys/kern/vfs_default.c > +++ b/sys/kern/vfs_default.c > @@ -1177,9 +1177,23 @@ vop_stdset_text(struct vop_set_text_args *ap) > { > struct vnode *vp; > struct mount *mp; > - int error; > + int error, n; > > vp = ap->a_vp; > + > + /* > + * Avoid the interlock if execs are already present. > + */ > + n = atomic_load_int(&vp->v_writecount); > + for (;;) { > + if (n > -1) { > + break; If you split the VOP for tmpfs/non-tmpfs implementations, then non-tmpfs can go with the atomics only. From owner-dev-commits-src-main@freebsd.org Fri May 14 18:25:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B9E8964FC2F; Fri, 14 May 2021 18:25:37 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FhcQn4ktHz4s0M; Fri, 14 May 2021 18:25:37 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lj1-x233.google.com with SMTP id 131so13505876ljj.3; Fri, 14 May 2021 11:25:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=0rnukEjPFahhmoOV2kNSHvE/AU3FMBOCrLgsgVIVe3c=; b=MNoNNQU+CH127VgBH3mOJq/cSVOQRR5vXWtF+t6aB2xZzgaMbv0EmfH3/U+qHm+f4o jxJ0B/NIwZfGyGYOOT0lY1qNhkOU4aOjRbiy7tZKP1yStU5CQekV1IdrWS6dUkvWmB08 +2pF49vAtZS2YrrLlMrybVC2OLgSum8bB1DYp6W4qqq5bqdBBE/qNkvuJSUodUVCCs8+ b3cSiCL3meqw8eCrXndvBBHklpuZmRXmHbS39SY5vggxe7YrSEu0m/Bvi8Q34CC2/YDz UeZ53kVTlGVhRP4PRbzEdgSmwuecIqzxuO4cdqAz7vvN2N2o5M094A75MCpW8dSol93l RlzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=0rnukEjPFahhmoOV2kNSHvE/AU3FMBOCrLgsgVIVe3c=; b=YHA8HdtlRRWvISLnWu3j0CyaS6q2Q57DBkMmv4qWqtF+wzqBu44hNerSsv2fiZOxfw d4/RWnCZ/CMxl52jfBGd3oJ0do9Nh5TxFY0v5nTDip3UxZGDg7DamO1xmPB2Pw7iM3XF ihZM8JfMLKNKCmahxw2lcn7Nl3FFhxgTBrkbySR1OBwnyhNkXirIVGOzI+BmGtL2l0Qz 92ciM+bbGT3g/BojdJXdZmGDgYjNdQzTo9/6vCMgmZQrmFOhj+FQZZmLGLXPxAeQ7qvL wNH+IzgR9t7XPUmDrQPVnQnYdIy0DGHWE9fEKD0jvH+RFi7c4Ay4ZUM2dDmpFh7TlJlI uXbg== X-Gm-Message-State: AOAM531iyYQNldUv9xlzplNUlQprUWfX1qPWzHM+iCoNy8Fug4aGuYhh jCxO1ntKsYb9TANgy6mKJ+kFD65FU0F9UPD9RFs= X-Google-Smtp-Source: ABdhPJz0JG4Ry5w2zjXjR052zsl8SWva7DkfwpbBPahqbWbiw2Kw20vmBUyzOpP4YO7+pRepYI+WKRRjvOcwlv7ax/4= X-Received: by 2002:a2e:b605:: with SMTP id r5mr37633937ljn.483.1621016735854; Fri, 14 May 2021 11:25:35 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:651c:485:0:0:0:0 with HTTP; Fri, 14 May 2021 11:25:35 -0700 (PDT) In-Reply-To: References: <202105141423.14EENtDX058648@gitrepo.freebsd.org> From: Mateusz Guzik Date: Fri, 14 May 2021 20:25:35 +0200 Message-ID: Subject: Re: git: b5fb9ae6872c - main - vfs: lockless writecount adjustment in set/unset text To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4FhcQn4ktHz4s0M X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 18:25:37 -0000 Even tmpfs can go without the interlock. The code can check if it transitioned across 0 and act accordingly and conditionally vref based on that. I did not check if said transition is safe without the interlock vs other users, so I did not go for it. Arguably both exec and write counts could be treated the same way, would have a side effect of avoiding VI_LOCK_FLAGS(vp, MTX_DUPOK);. Maybe i'll look into it today or tomorrow. On 5/14/21, Konstantin Belousov wrote: > On Fri, May 14, 2021 at 02:23:55PM +0000, Mateusz Guzik wrote: >> The branch main has been updated by mjg: >> >> URL: >> https://cgit.FreeBSD.org/src/commit/?id=b5fb9ae6872c499f1a02bec41f48b163a73a2aaa >> >> commit b5fb9ae6872c499f1a02bec41f48b163a73a2aaa >> Author: Mateusz Guzik >> AuthorDate: 2021-05-07 14:04:27 +0000 >> Commit: Mateusz Guzik >> CommitDate: 2021-05-14 14:22:21 +0000 >> >> vfs: lockless writecount adjustment in set/unset text >> >> ... for cases where this is not the first/last exec. >> --- >> sys/kern/vfs_default.c | 32 ++++++++++++++++++++++++++++++-- >> 1 file changed, 30 insertions(+), 2 deletions(-) >> >> diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c >> index cf224981cbe7..3518bbeaa279 100644 >> --- a/sys/kern/vfs_default.c >> +++ b/sys/kern/vfs_default.c >> @@ -1177,9 +1177,23 @@ vop_stdset_text(struct vop_set_text_args *ap) >> { >> struct vnode *vp; >> struct mount *mp; >> - int error; >> + int error, n; >> >> vp = ap->a_vp; >> + >> + /* >> + * Avoid the interlock if execs are already present. >> + */ >> + n = atomic_load_int(&vp->v_writecount); >> + for (;;) { >> + if (n > -1) { >> + break; > If you split the VOP for tmpfs/non-tmpfs implementations, then > non-tmpfs can go with the atomics only. > -- Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Fri May 14 19:21:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7D99E628CE5; Fri, 14 May 2021 19:21:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fhdgd39mGz3Ghv; Fri, 14 May 2021 19:21:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F39317BA1; Fri, 14 May 2021 19:21:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14EJLngs058112; Fri, 14 May 2021 19:21:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14EJLnrr058111; Fri, 14 May 2021 19:21:49 GMT (envelope-from git) Date: Fri, 14 May 2021 19:21:49 GMT Message-Id: <202105141921.14EJLnrr058111@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 4b6ed0758dc6 - main - cxgbe: Make the TOE ISCSI RX stats per-queue instead of per adapter. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4b6ed0758dc6fad17081d7bd791cb0edbddbddb8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 19:21:49 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4b6ed0758dc6fad17081d7bd791cb0edbddbddb8 commit 4b6ed0758dc6fad17081d7bd791cb0edbddbddb8 Author: John Baldwin AuthorDate: 2021-05-14 19:16:33 +0000 Commit: John Baldwin CommitDate: 2021-05-14 19:16:33 +0000 cxgbe: Make the TOE ISCSI RX stats per-queue instead of per adapter. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29903 --- sys/dev/cxgbe/adapter.h | 7 +++- sys/dev/cxgbe/cxgbei/cxgbei.c | 83 +++------------------------------------ sys/dev/cxgbe/cxgbei/cxgbei.h | 6 --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 10 +++-- sys/dev/cxgbe/t4_main.c | 8 ++++ sys/dev/cxgbe/t4_sge.c | 29 +++++++++++++- 6 files changed, 52 insertions(+), 91 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 086918b7dff9..cce58f9729c1 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -656,11 +656,16 @@ iq_to_rxq(struct sge_iq *iq) return (__containerof(iq, struct sge_rxq, iq)); } - /* ofld_rxq: SGE ingress queue + SGE free list + miscellaneous items */ struct sge_ofld_rxq { struct sge_iq iq; /* MUST be first */ struct sge_fl fl; /* MUST follow iq */ + counter_u64_t rx_iscsi_ddp_setup_ok; + counter_u64_t rx_iscsi_ddp_setup_error; + uint64_t rx_iscsi_ddp_pdus; + uint64_t rx_iscsi_ddp_octets; + uint64_t rx_iscsi_fl_pdus; + uint64_t rx_iscsi_fl_octets; u_long rx_toe_tls_records; u_long rx_toe_tls_octets; } __aligned(CACHE_LINE_SIZE); diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index 4acdc726e75c..07f704752305 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -96,50 +96,6 @@ static int worker_thread_count; static struct cxgbei_worker_thread_softc *cwt_softc; static struct proc *cxgbei_proc; -static void -free_ci_counters(struct cxgbei_data *ci) -{ - -#define FREE_CI_COUNTER(x) do { \ - if (ci->x != NULL) { \ - counter_u64_free(ci->x); \ - ci->x = NULL; \ - } \ -} while (0) - - FREE_CI_COUNTER(ddp_setup_ok); - FREE_CI_COUNTER(ddp_setup_error); - FREE_CI_COUNTER(ddp_bytes); - FREE_CI_COUNTER(ddp_pdus); - FREE_CI_COUNTER(fl_bytes); - FREE_CI_COUNTER(fl_pdus); -#undef FREE_CI_COUNTER -} - -static int -alloc_ci_counters(struct cxgbei_data *ci) -{ - -#define ALLOC_CI_COUNTER(x) do { \ - ci->x = counter_u64_alloc(M_WAITOK); \ - if (ci->x == NULL) \ - goto fail; \ -} while (0) - - ALLOC_CI_COUNTER(ddp_setup_ok); - ALLOC_CI_COUNTER(ddp_setup_error); - ALLOC_CI_COUNTER(ddp_bytes); - ALLOC_CI_COUNTER(ddp_pdus); - ALLOC_CI_COUNTER(fl_bytes); - ALLOC_CI_COUNTER(fl_pdus); -#undef ALLOC_CI_COUNTER - - return (0); -fail: - free_ci_counters(ci); - return (ENOMEM); -} - static void read_pdu_limits(struct adapter *sc, uint32_t *max_tx_pdu_len, uint32_t *max_rx_pdu_len) @@ -182,10 +138,6 @@ cxgbei_init(struct adapter *sc, struct cxgbei_data *ci) MPASS(sc->vres.iscsi.size > 0); MPASS(ci != NULL); - rc = alloc_ci_counters(ci); - if (rc != 0) - return (rc); - read_pdu_limits(sc, &ci->max_tx_pdu_len, &ci->max_rx_pdu_len); pr = &ci->pr; @@ -195,7 +147,6 @@ cxgbei_init(struct adapter *sc, struct cxgbei_data *ci) device_printf(sc->dev, "%s: failed to initialize the iSCSI page pod region: %u.\n", __func__, rc); - free_ci_counters(ci); return (rc); } @@ -219,30 +170,9 @@ cxgbei_init(struct adapter *sc, struct cxgbei_data *ci) children = SYSCTL_CHILDREN(oid); oid = SYSCTL_ADD_NODE(&ci->ctx, children, OID_AUTO, "iscsi", - CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "iSCSI ULP statistics"); + CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "iSCSI ULP settings"); children = SYSCTL_CHILDREN(oid); - SYSCTL_ADD_COUNTER_U64(&ci->ctx, children, OID_AUTO, "ddp_setup_ok", - CTLFLAG_RD, &ci->ddp_setup_ok, - "# of times DDP buffer was setup successfully."); - - SYSCTL_ADD_COUNTER_U64(&ci->ctx, children, OID_AUTO, "ddp_setup_error", - CTLFLAG_RD, &ci->ddp_setup_error, - "# of times DDP buffer setup failed."); - - SYSCTL_ADD_COUNTER_U64(&ci->ctx, children, OID_AUTO, "ddp_bytes", - CTLFLAG_RD, &ci->ddp_bytes, "# of bytes placed directly"); - - SYSCTL_ADD_COUNTER_U64(&ci->ctx, children, OID_AUTO, "ddp_pdus", - CTLFLAG_RD, &ci->ddp_pdus, "# of PDUs with data placed directly."); - - SYSCTL_ADD_COUNTER_U64(&ci->ctx, children, OID_AUTO, "fl_bytes", - CTLFLAG_RD, &ci->fl_bytes, "# of data bytes delivered in freelist"); - - SYSCTL_ADD_COUNTER_U64(&ci->ctx, children, OID_AUTO, "fl_pdus", - CTLFLAG_RD, &ci->fl_pdus, - "# of PDUs with data delivered in freelist"); - ci->ddp_threshold = 2048; SYSCTL_ADD_UINT(&ci->ctx, children, OID_AUTO, "ddp_threshold", CTLFLAG_RW, &ci->ddp_threshold, 0, "Rx zero copy threshold"); @@ -291,7 +221,6 @@ static int do_rx_iscsi_data(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) { struct adapter *sc = iq->adapter; - struct cxgbei_data *ci = sc->iscsi_ulp_softc; struct cpl_iscsi_data *cpl = mtod(m, struct cpl_iscsi_data *); u_int tid = GET_TID(cpl); struct toepcb *toep = lookup_tid(sc, tid); @@ -311,8 +240,8 @@ do_rx_iscsi_data(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m icp->icp_flags |= ICPF_RX_FLBUF; icp->ip.ip_data_mbuf = m; - counter_u64_add(ci->fl_pdus, 1); - counter_u64_add(ci->fl_bytes, m->m_pkthdr.len); + toep->ofld_rxq->rx_iscsi_fl_pdus++; + toep->ofld_rxq->rx_iscsi_fl_octets += m->m_pkthdr.len; #if 0 CTR3(KTR_CXGBE, "%s: tid %u, cpl->len %u", __func__, tid, @@ -326,7 +255,6 @@ static int do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) { struct adapter *sc = iq->adapter; - struct cxgbei_data *ci = sc->iscsi_ulp_softc; const struct cpl_rx_data_ddp *cpl = (const void *)(rss + 1); u_int tid = GET_TID(cpl); struct toepcb *toep = lookup_tid(sc, tid); @@ -369,8 +297,8 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) MPASS((icp->icp_flags & ICPF_RX_FLBUF) == 0); MPASS(ip->ip_data_len > 0); icp->icp_flags |= ICPF_RX_DDP; - counter_u64_add(ci->ddp_pdus, 1); - counter_u64_add(ci->ddp_bytes, ip->ip_data_len); + toep->ofld_rxq->rx_iscsi_ddp_pdus++; + toep->ofld_rxq->rx_iscsi_ddp_octets += ip->ip_data_len; } INP_WLOCK(inp); @@ -527,7 +455,6 @@ cxgbei_deactivate(struct adapter *sc) if (ci != NULL) { sysctl_ctx_free(&ci->ctx); t4_free_ppod_region(&ci->pr); - free_ci_counters(ci); free(ci, M_CXGBE); sc->iscsi_ulp_softc = NULL; } diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.h b/sys/dev/cxgbe/cxgbei/cxgbei.h index b0369b974136..3b17a4f2b36a 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.h +++ b/sys/dev/cxgbe/cxgbei/cxgbei.h @@ -113,12 +113,6 @@ struct cxgbei_data { struct ppod_region pr; struct sysctl_ctx_list ctx; /* from uld_activate to deactivate */ - counter_u64_t ddp_setup_ok; - counter_u64_t ddp_setup_error; - counter_u64_t ddp_bytes; - counter_u64_t ddp_pdus; - counter_u64_t fl_bytes; - counter_u64_t fl_pdus; }; /* cxgbei.c */ diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 94963f13b601..961acfb31987 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -819,7 +819,8 @@ no_ddp: *ittp = htobe32(itt); MPASS(*arg == NULL); /* State is maintained for DDP only. */ if (rc != 0) - counter_u64_add(ci->ddp_setup_error, 1); + counter_u64_add( + toep->ofld_rxq->rx_iscsi_ddp_setup_error, 1); return (0); } @@ -853,7 +854,7 @@ no_ddp: *ittp = htobe32(prsv->prsv_tag); *arg = prsv; - counter_u64_add(ci->ddp_setup_ok, 1); + counter_u64_add(toep->ofld_rxq->rx_iscsi_ddp_setup_ok, 1); return (0); } @@ -922,7 +923,8 @@ no_ddp: *tttp = htobe32(ttt); MPASS(io_to_ppod_reservation(io) == NULL); if (rc != 0) - counter_u64_add(ci->ddp_setup_error, 1); + counter_u64_add( + toep->ofld_rxq->rx_iscsi_ddp_setup_error, 1); return (0); } @@ -968,7 +970,7 @@ no_ddp: *tttp = htobe32(prsv->prsv_tag); io_to_ppod_reservation(io) = prsv; *arg = ctsio; - counter_u64_add(ci->ddp_setup_ok, 1); + counter_u64_add(toep->ofld_rxq->rx_iscsi_ddp_setup_ok, 1); return (0); } diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index da9d7565f3a3..3cfab1ef04e2 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -11886,6 +11886,14 @@ clear_stats(struct adapter *sc, u_int port_id) ofld_rxq->fl.cl_allocated = 0; ofld_rxq->fl.cl_recycled = 0; ofld_rxq->fl.cl_fast_recycled = 0; + counter_u64_zero( + ofld_rxq->rx_iscsi_ddp_setup_ok); + counter_u64_zero( + ofld_rxq->rx_iscsi_ddp_setup_error); + ofld_rxq->rx_iscsi_ddp_pdus = 0; + ofld_rxq->rx_iscsi_ddp_octets = 0; + ofld_rxq->rx_iscsi_fl_pdus = 0; + ofld_rxq->rx_iscsi_fl_octets = 0; ofld_rxq->rx_toe_tls_records = 0; ofld_rxq->rx_toe_tls_octets = 0; } diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 2f6c7e2e7914..ac79d8002784 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -4116,12 +4116,37 @@ add_ofld_rxq_sysctls(struct sysctl_ctx_list *ctx, struct sysctl_oid *oid, return; children = SYSCTL_CHILDREN(oid); - SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, + SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "rx_toe_tls_records", CTLFLAG_RD, &ofld_rxq->rx_toe_tls_records, "# of TOE TLS records received"); - SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, + SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "rx_toe_tls_octets", CTLFLAG_RD, &ofld_rxq->rx_toe_tls_octets, "# of payload octets in received TOE TLS records"); + + oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "iscsi", + CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "TOE iSCSI statistics"); + children = SYSCTL_CHILDREN(oid); + + ofld_rxq->rx_iscsi_ddp_setup_ok = counter_u64_alloc(M_WAITOK); + ofld_rxq->rx_iscsi_ddp_setup_error = counter_u64_alloc(M_WAITOK); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "ddp_setup_ok", + CTLFLAG_RD, &ofld_rxq->rx_iscsi_ddp_setup_ok, + "# of times DDP buffer was setup successfully."); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "ddp_setup_error", + CTLFLAG_RD, &ofld_rxq->rx_iscsi_ddp_setup_error, + "# of times DDP buffer setup failed."); + SYSCTL_ADD_U64(ctx, children, OID_AUTO, "ddp_octets", + CTLFLAG_RD, &ofld_rxq->rx_iscsi_ddp_octets, 0, + "# of octets placed directly"); + SYSCTL_ADD_U64(ctx, children, OID_AUTO, "ddp_pdus", + CTLFLAG_RD, &ofld_rxq->rx_iscsi_ddp_pdus, 0, + "# of PDUs with data placed directly."); + SYSCTL_ADD_U64(ctx, children, OID_AUTO, "fl_octets", + CTLFLAG_RD, &ofld_rxq->rx_iscsi_fl_octets, 0, + "# of data octets delivered in freelist"); + SYSCTL_ADD_U64(ctx, children, OID_AUTO, "fl_pdus", + CTLFLAG_RD, &ofld_rxq->rx_iscsi_fl_pdus, 0, + "# of PDUs with data delivered in freelist"); } #endif From owner-dev-commits-src-main@freebsd.org Fri May 14 19:21:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6A92628E34; Fri, 14 May 2021 19:21:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fhdgf4Cghz3Gct; Fri, 14 May 2021 19:21:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8270717CF2; Fri, 14 May 2021 19:21:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14EJLoZi058133; Fri, 14 May 2021 19:21:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14EJLoXK058132; Fri, 14 May 2021 19:21:50 GMT (envelope-from git) Date: Fri, 14 May 2021 19:21:50 GMT Message-Id: <202105141921.14EJLoXK058132@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 4427ac3675f9 - main - cxgbe tom: Set the tid in the work requests to program page pods for iSCSI. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4427ac3675f91df039d54a23518132e0e0fede86 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 19:21:50 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4427ac3675f91df039d54a23518132e0e0fede86 commit 4427ac3675f91df039d54a23518132e0e0fede86 Author: John Baldwin AuthorDate: 2021-05-14 19:16:40 +0000 Commit: John Baldwin CommitDate: 2021-05-14 19:16:40 +0000 cxgbe tom: Set the tid in the work requests to program page pods for iSCSI. As a result, CPL_FW4_ACK now returns credits for these work requests. To support this, page pod work requests are now constructed in special mbufs similar to "raw" mbufs used for NIC TLS in plain TX queues. These special mbufs are stored in the ulp_pduq and dispatched in order with PDU work requests. Sponsored by: Chelsio Communications Discussed with: np Differential Revision: https://reviews.freebsd.org/D29904 --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 7 +- sys/dev/cxgbe/tom/t4_cpl_io.c | 241 ++++++++++++++++++++++---------------- sys/dev/cxgbe/tom/t4_ddp.c | 48 ++++++-- sys/dev/cxgbe/tom/t4_tom.h | 18 ++- 4 files changed, 196 insertions(+), 118 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 961acfb31987..4e168a33e2ca 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -844,8 +844,8 @@ no_ddp: goto no_ddp; } - rc = t4_write_page_pods_for_buf(sc, &toep->ofld_txq->wrq, toep->tid, - prsv, (vm_offset_t)csio->data_ptr, csio->dxfer_len); + rc = t4_write_page_pods_for_buf(sc, toep, prsv, + (vm_offset_t)csio->data_ptr, csio->dxfer_len); if (rc != 0) { t4_free_page_pods(prsv); uma_zfree(prsv_zone, prsv); @@ -959,8 +959,7 @@ no_ddp: goto no_ddp; } - rc = t4_write_page_pods_for_buf(sc, &toep->ofld_txq->wrq, - toep->tid, prsv, buf, xferlen); + rc = t4_write_page_pods_for_buf(sc, toep, prsv, buf, xferlen); if (rc != 0) { t4_free_page_pods(prsv); uma_zfree(prsv_zone, prsv); diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index d8eb0e091218..b4d84d3e5c55 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -927,10 +927,10 @@ rqdrop_locked(struct mbufq *q, int plen) } } -void -t4_push_pdus(struct adapter *sc, struct toepcb *toep, int drop) +static struct wrqe * +write_iscsi_mbuf_wr(struct toepcb *toep, struct mbuf *sndptr) { - struct mbuf *sndptr, *m; + struct mbuf *m; struct fw_ofld_tx_data_wr *txwr; struct wrqe *wr; u_int plen, nsegs, credits, max_imm, max_nsegs, max_nsegs_1mbuf; @@ -938,9 +938,129 @@ t4_push_pdus(struct adapter *sc, struct toepcb *toep, int drop) struct inpcb *inp = toep->inp; struct tcpcb *tp = intotcpcb(inp); int tx_credits, shove; + static const u_int ulp_extra_len[] = {0, 4, 4, 8}; + + M_ASSERTPKTHDR(sndptr); + + tx_credits = min(toep->tx_credits, MAX_OFLD_TX_CREDITS); + if (mbuf_raw_wr(sndptr)) { + plen = sndptr->m_pkthdr.len; + KASSERT(plen <= SGE_MAX_WR_LEN, + ("raw WR len %u is greater than max WR len", plen)); + if (plen > tx_credits * 16) + return (NULL); + + wr = alloc_wrqe(roundup2(plen, 16), &toep->ofld_txq->wrq); + if (__predict_false(wr == NULL)) + return (NULL); + + m_copydata(sndptr, 0, plen, wrtod(wr)); + return (wr); + } + + max_imm = max_imm_payload(tx_credits); + max_nsegs = max_dsgl_nsegs(tx_credits); + + plen = 0; + nsegs = 0; + max_nsegs_1mbuf = 0; /* max # of SGL segments in any one mbuf */ + for (m = sndptr; m != NULL; m = m->m_next) { + int n = sglist_count(mtod(m, void *), m->m_len); + + nsegs += n; + plen += m->m_len; + + /* + * This mbuf would send us _over_ the nsegs limit. + * Suspend tx because the PDU can't be sent out. + */ + if (plen > max_imm && nsegs > max_nsegs) + return (NULL); + + if (max_nsegs_1mbuf < n) + max_nsegs_1mbuf = n; + } + + if (__predict_false(toep->flags & TPF_FIN_SENT)) + panic("%s: excess tx.", __func__); + + /* + * We have a PDU to send. All of it goes out in one WR so 'm' + * is NULL. A PDU's length is always a multiple of 4. + */ + MPASS(m == NULL); + MPASS((plen & 3) == 0); + MPASS(sndptr->m_pkthdr.len == plen); + + shove = !(tp->t_flags & TF_MORETOCOME); + ulp_submode = mbuf_ulp_submode(sndptr); + MPASS(ulp_submode < nitems(ulp_extra_len)); + + /* + * plen doesn't include header and data digests, which are + * generated and inserted in the right places by the TOE, but + * they do occupy TCP sequence space and need to be accounted + * for. + */ + adjusted_plen = plen + ulp_extra_len[ulp_submode]; + if (plen <= max_imm) { + + /* Immediate data tx */ + + wr = alloc_wrqe(roundup2(sizeof(*txwr) + plen, 16), + &toep->ofld_txq->wrq); + if (wr == NULL) { + /* XXX: how will we recover from this? */ + return (NULL); + } + txwr = wrtod(wr); + credits = howmany(wr->wr_len, 16); + write_tx_wr(txwr, toep, plen, adjusted_plen, credits, + shove, ulp_submode); + m_copydata(sndptr, 0, plen, (void *)(txwr + 1)); + nsegs = 0; + } else { + int wr_len; + + /* DSGL tx */ + wr_len = sizeof(*txwr) + sizeof(struct ulptx_sgl) + + ((3 * (nsegs - 1)) / 2 + ((nsegs - 1) & 1)) * 8; + wr = alloc_wrqe(roundup2(wr_len, 16), + &toep->ofld_txq->wrq); + if (wr == NULL) { + /* XXX: how will we recover from this? */ + return (NULL); + } + txwr = wrtod(wr); + credits = howmany(wr_len, 16); + write_tx_wr(txwr, toep, 0, adjusted_plen, credits, + shove, ulp_submode); + write_tx_sgl(txwr + 1, sndptr, m, nsegs, max_nsegs_1mbuf); + if (wr_len & 0xf) { + uint64_t *pad = (uint64_t *)((uintptr_t)txwr + wr_len); + *pad = 0; + } + } + + tp->snd_nxt += adjusted_plen; + tp->snd_max += adjusted_plen; + + counter_u64_add(toep->ofld_txq->tx_iscsi_pdus, 1); + counter_u64_add(toep->ofld_txq->tx_iscsi_octets, plen); + + return (wr); +} + +void +t4_push_pdus(struct adapter *sc, struct toepcb *toep, int drop) +{ + struct mbuf *sndptr, *m; + struct fw_wr_hdr *wrhdr; + struct wrqe *wr; + u_int plen, credits; + struct inpcb *inp = toep->inp; struct ofld_tx_sdesc *txsd = &toep->txsd[toep->txsd_pidx]; struct mbufq *pduq = &toep->ulp_pduq; - static const u_int ulp_extra_len[] = {0, 4, 4, 8}; INP_WLOCK_ASSERT(inp); KASSERT(toep->flags & TPF_FLOWC_WR_SENT, @@ -965,99 +1085,14 @@ t4_push_pdus(struct adapter *sc, struct toepcb *toep, int drop) rqdrop_locked(&toep->ulp_pdu_reclaimq, drop); while ((sndptr = mbufq_first(pduq)) != NULL) { - M_ASSERTPKTHDR(sndptr); - - tx_credits = min(toep->tx_credits, MAX_OFLD_TX_CREDITS); - max_imm = max_imm_payload(tx_credits); - max_nsegs = max_dsgl_nsegs(tx_credits); - - plen = 0; - nsegs = 0; - max_nsegs_1mbuf = 0; /* max # of SGL segments in any one mbuf */ - for (m = sndptr; m != NULL; m = m->m_next) { - int n = sglist_count(mtod(m, void *), m->m_len); - - nsegs += n; - plen += m->m_len; - - /* - * This mbuf would send us _over_ the nsegs limit. - * Suspend tx because the PDU can't be sent out. - */ - if (plen > max_imm && nsegs > max_nsegs) { - toep->flags |= TPF_TX_SUSPENDED; - return; - } - - if (max_nsegs_1mbuf < n) - max_nsegs_1mbuf = n; - } - - if (__predict_false(toep->flags & TPF_FIN_SENT)) - panic("%s: excess tx.", __func__); - - /* - * We have a PDU to send. All of it goes out in one WR so 'm' - * is NULL. A PDU's length is always a multiple of 4. - */ - MPASS(m == NULL); - MPASS((plen & 3) == 0); - MPASS(sndptr->m_pkthdr.len == plen); - - shove = !(tp->t_flags & TF_MORETOCOME); - ulp_submode = mbuf_ulp_submode(sndptr); - MPASS(ulp_submode < nitems(ulp_extra_len)); - - /* - * plen doesn't include header and data digests, which are - * generated and inserted in the right places by the TOE, but - * they do occupy TCP sequence space and need to be accounted - * for. - */ - adjusted_plen = plen + ulp_extra_len[ulp_submode]; - if (plen <= max_imm) { - - /* Immediate data tx */ - - wr = alloc_wrqe(roundup2(sizeof(*txwr) + plen, 16), - &toep->ofld_txq->wrq); - if (wr == NULL) { - /* XXX: how will we recover from this? */ - toep->flags |= TPF_TX_SUSPENDED; - return; - } - txwr = wrtod(wr); - credits = howmany(wr->wr_len, 16); - write_tx_wr(txwr, toep, plen, adjusted_plen, credits, - shove, ulp_submode); - m_copydata(sndptr, 0, plen, (void *)(txwr + 1)); - nsegs = 0; - } else { - int wr_len; - - /* DSGL tx */ - wr_len = sizeof(*txwr) + sizeof(struct ulptx_sgl) + - ((3 * (nsegs - 1)) / 2 + ((nsegs - 1) & 1)) * 8; - wr = alloc_wrqe(roundup2(wr_len, 16), - &toep->ofld_txq->wrq); - if (wr == NULL) { - /* XXX: how will we recover from this? */ - toep->flags |= TPF_TX_SUSPENDED; - return; - } - txwr = wrtod(wr); - credits = howmany(wr_len, 16); - write_tx_wr(txwr, toep, 0, adjusted_plen, credits, - shove, ulp_submode); - write_tx_sgl(txwr + 1, sndptr, m, nsegs, - max_nsegs_1mbuf); - if (wr_len & 0xf) { - uint64_t *pad = (uint64_t *) - ((uintptr_t)txwr + wr_len); - *pad = 0; - } + wr = write_iscsi_mbuf_wr(toep, sndptr); + if (wr == NULL) { + toep->flags |= TPF_TX_SUSPENDED; + return; } + plen = sndptr->m_pkthdr.len; + credits = howmany(wr->wr_len, 16); KASSERT(toep->tx_credits >= credits, ("%s: not enough credits", __func__)); @@ -1068,16 +1103,19 @@ t4_push_pdus(struct adapter *sc, struct toepcb *toep, int drop) toep->tx_credits -= credits; toep->tx_nocompl += credits; toep->plen_nocompl += plen; - if (toep->tx_credits <= toep->tx_total * 3 / 8 && + + /* + * Ensure there are enough credits for a full-sized WR + * as page pod WRs can be full-sized. + */ + if (toep->tx_credits <= SGE_MAX_WR_LEN * 5 / 4 && toep->tx_nocompl >= toep->tx_total / 4) { - txwr->op_to_immdlen |= htobe32(F_FW_WR_COMPL); + wrhdr = wrtod(wr); + wrhdr->hi |= htobe32(F_FW_WR_COMPL); toep->tx_nocompl = 0; toep->plen_nocompl = 0; } - tp->snd_nxt += adjusted_plen; - tp->snd_max += adjusted_plen; - toep->flags |= TPF_TX_DATA_SENT; if (toep->tx_credits < MIN_OFLD_TX_CREDITS) toep->flags |= TPF_TX_SUSPENDED; @@ -1092,9 +1130,6 @@ t4_push_pdus(struct adapter *sc, struct toepcb *toep, int drop) } toep->txsd_avail--; - counter_u64_add(toep->ofld_txq->tx_iscsi_pdus, 1); - counter_u64_add(toep->ofld_txq->tx_iscsi_octets, plen); - t4_l2t_send(sc, wr, toep->l2te); } diff --git a/sys/dev/cxgbe/tom/t4_ddp.c b/sys/dev/cxgbe/tom/t4_ddp.c index b0d53dd63997..e87d013a0453 100644 --- a/sys/dev/cxgbe/tom/t4_ddp.c +++ b/sys/dev/cxgbe/tom/t4_ddp.c @@ -1081,11 +1081,30 @@ t4_write_page_pods_for_ps(struct adapter *sc, struct sge_wrq *wrq, int tid, return (0); } +static struct mbuf * +alloc_raw_wr_mbuf(int len) +{ + struct mbuf *m; + + if (len <= MHLEN) + m = m_gethdr(M_NOWAIT, MT_DATA); + else if (len <= MCLBYTES) + m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); + else + m = NULL; + if (m == NULL) + return (NULL); + m->m_pkthdr.len = len; + m->m_len = len; + set_mbuf_raw_wr(m, true); + return (m); +} + int -t4_write_page_pods_for_buf(struct adapter *sc, struct sge_wrq *wrq, int tid, +t4_write_page_pods_for_buf(struct adapter *sc, struct toepcb *toep, struct ppod_reservation *prsv, vm_offset_t buf, int buflen) { - struct wrqe *wr; + struct inpcb *inp = toep->inp; struct ulp_mem_io *ulpmc; struct ulptx_idata *ulpsc; struct pagepod *ppod; @@ -1094,6 +1113,8 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct sge_wrq *wrq, int tid, uint32_t cmd; struct ppod_region *pr = prsv->prsv_pr; uintptr_t end_pva, pva, pa; + struct mbuf *m; + struct mbufq wrq; cmd = htobe32(V_ULPTX_CMD(ULP_TX_MEM_WRITE)); if (is_t4(sc)) @@ -1105,6 +1126,7 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct sge_wrq *wrq, int tid, ppod_addr = pr->pr_start + (prsv->prsv_tag & pr->pr_tag_mask); pva = trunc_page(buf); end_pva = trunc_page(buf + buflen - 1); + mbufq_init(&wrq, INT_MAX); for (i = 0; i < prsv->prsv_nppods; ppod_addr += chunk) { /* How many page pods are we writing in this cycle */ @@ -1113,12 +1135,14 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct sge_wrq *wrq, int tid, chunk = PPOD_SZ(n); len = roundup2(sizeof(*ulpmc) + sizeof(*ulpsc) + chunk, 16); - wr = alloc_wrqe(len, wrq); - if (wr == NULL) - return (ENOMEM); /* ok to just bail out */ - ulpmc = wrtod(wr); + m = alloc_raw_wr_mbuf(len); + if (m == NULL) { + mbufq_drain(&wrq); + return (ENOMEM); + } + ulpmc = mtod(m, struct ulp_mem_io *); - INIT_ULPTX_WR(ulpmc, len, 0, 0); + INIT_ULPTX_WR(ulpmc, len, 0, toep->tid); ulpmc->cmd = cmd; ulpmc->dlen = htobe32(V_ULP_MEMIO_DATA_LEN(chunk / 32)); ulpmc->len16 = htobe32(howmany(len - sizeof(ulpmc->wr), 16)); @@ -1131,7 +1155,7 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct sge_wrq *wrq, int tid, ppod = (struct pagepod *)(ulpsc + 1); for (j = 0; j < n; i++, j++, ppod++) { ppod->vld_tid_pgsz_tag_color = htobe64(F_PPOD_VALID | - V_PPOD_TID(tid) | + V_PPOD_TID(toep->tid) | (prsv->prsv_tag & ~V_PPOD_PGSZ(M_PPOD_PGSZ))); ppod->len_offset = htobe64(V_PPOD_LEN(buflen) | V_PPOD_OFST(offset)); @@ -1148,7 +1172,7 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct sge_wrq *wrq, int tid, #if 0 CTR5(KTR_CXGBE, "%s: tid %d ppod[%d]->addr[%d] = %p", - __func__, tid, i, k, + __func__, toep->tid, i, k, htobe64(ppod->addr[k])); #endif } @@ -1161,9 +1185,13 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct sge_wrq *wrq, int tid, pva -= ddp_pgsz; } - t4_wrq_tx(sc, wr); + mbufq_enqueue(&wrq, m); } + INP_WLOCK(inp); + mbufq_concat(&toep->ulp_pduq, &wrq); + INP_WUNLOCK(inp); + MPASS(pva <= end_pva); return (0); diff --git a/sys/dev/cxgbe/tom/t4_tom.h b/sys/dev/cxgbe/tom/t4_tom.h index 68b3d29295f8..f1129b47cbcf 100644 --- a/sys/dev/cxgbe/tom/t4_tom.h +++ b/sys/dev/cxgbe/tom/t4_tom.h @@ -330,6 +330,22 @@ td_adapter(struct tom_data *td) return (td->tod.tod_softc); } +static inline void +set_mbuf_raw_wr(struct mbuf *m, bool raw) +{ + + M_ASSERTPKTHDR(m); + m->m_pkthdr.PH_per.eight[6] = raw; +} + +static inline bool +mbuf_raw_wr(struct mbuf *m) +{ + + M_ASSERTPKTHDR(m); + return (m->m_pkthdr.PH_per.eight[6]); +} + static inline void set_mbuf_ulp_submode(struct mbuf *m, uint8_t ulp_submode) { @@ -423,7 +439,7 @@ int t4_alloc_page_pods_for_buf(struct ppod_region *, vm_offset_t, int, struct ppod_reservation *); int t4_write_page_pods_for_ps(struct adapter *, struct sge_wrq *, int, struct pageset *); -int t4_write_page_pods_for_buf(struct adapter *, struct sge_wrq *, int, +int t4_write_page_pods_for_buf(struct adapter *, struct toepcb *, struct ppod_reservation *, vm_offset_t, int); void t4_free_page_pods(struct ppod_reservation *); int t4_soreceive_ddp(struct socket *, struct sockaddr **, struct uio *, From owner-dev-commits-src-main@freebsd.org Fri May 14 19:21:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 45BCD628C66; Fri, 14 May 2021 19:21:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fhdgg6cWzz3GTp; Fri, 14 May 2021 19:21:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A7D3B17ABC; Fri, 14 May 2021 19:21:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14EJLpsc058154; Fri, 14 May 2021 19:21:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14EJLpdC058153; Fri, 14 May 2021 19:21:51 GMT (envelope-from git) Date: Fri, 14 May 2021 19:21:51 GMT Message-Id: <202105141921.14EJLpdC058153@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 87bb5ed606fc - main - cxgbei: Use hardware RX flow control for offloaded iSCSI connections. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 87bb5ed606fc02f6520bbb8f9dfe2bc834a50d4d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 19:21:52 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=87bb5ed606fc02f6520bbb8f9dfe2bc834a50d4d commit 87bb5ed606fc02f6520bbb8f9dfe2bc834a50d4d Author: John Baldwin AuthorDate: 2021-05-14 19:16:51 +0000 Commit: John Baldwin CommitDate: 2021-05-14 19:16:51 +0000 cxgbei: Use hardware RX flow control for offloaded iSCSI connections. Forthcoming T6 iSCSI DDP support requires hardware RX flow control. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29905 --- sys/dev/cxgbe/cxgbei/cxgbei.c | 8 ++++---- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index 07f704752305..7027e6428515 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -315,13 +315,13 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) tp = intotcpcb(inp); MPASS(icp->icp_seq == tp->rcv_nxt); - MPASS(tp->rcv_wnd >= pdu_len); tp->rcv_nxt += pdu_len; - tp->rcv_wnd -= pdu_len; tp->t_rcvtime = ticks; - /* update rx credits */ - t4_rcvd(&toep->td->tod, tp); /* XXX: sc->tom_softc.tod */ + /* + * Don't update the window size or return credits since RX + * flow control is disabled. + */ so = inp->inp_socket; sb = &so->so_rcv; diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 4e168a33e2ca..9ee31616b873 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -591,6 +591,9 @@ set_ulp_mode_iscsi(struct adapter *sc, struct toepcb *toep, u_int ulp_submode) t4_set_tcb_field(sc, toep->ctrlq, toep, W_TCB_ULP_TYPE, V_TCB_ULP_TYPE(M_TCB_ULP_TYPE) | V_TCB_ULP_RAW(M_TCB_ULP_RAW), val, 0, 0); + + val = V_TF_RX_FLOW_CONTROL_DISABLE(1ULL); + t4_set_tcb_field(sc, toep->ctrlq, toep, W_TCB_T_FLAGS, val, val, 0, 0); } /* From owner-dev-commits-src-main@freebsd.org Fri May 14 19:21:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 084BB628CF2; Fri, 14 May 2021 19:21:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fhdgh6VD1z3Gd3; Fri, 14 May 2021 19:21:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CCED317A75; Fri, 14 May 2021 19:21:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14EJLq6E058175; Fri, 14 May 2021 19:21:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14EJLqIH058174; Fri, 14 May 2021 19:21:52 GMT (envelope-from git) Date: Fri, 14 May 2021 19:21:52 GMT Message-Id: <202105141921.14EJLqIH058174@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 91ca7b095408 - main - cxgbei: Whitespace fixes, comment typo, and rewrap a comment. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 91ca7b0954088f882e55e0ece6f456ca172ebcf5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 19:21:53 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=91ca7b0954088f882e55e0ece6f456ca172ebcf5 commit 91ca7b0954088f882e55e0ece6f456ca172ebcf5 Author: John Baldwin AuthorDate: 2021-05-14 19:16:57 +0000 Commit: John Baldwin CommitDate: 2021-05-14 19:16:57 +0000 cxgbei: Whitespace fixes, comment typo, and rewrap a comment. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29906 --- sys/dev/cxgbe/cxgbei/cxgbei.c | 2 +- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 12 ++++++------ sys/dev/cxgbe/tom/t4_cpl_io.c | 9 ++++----- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index 7027e6428515..419293ec9cdf 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -88,7 +88,7 @@ __FBSDID("$FreeBSD$"); #include "common/common.h" #include "common/t4_msg.h" -#include "common/t4_regs.h" /* for PCIE_MEM_ACCESS */ +#include "common/t4_regs.h" /* for PCIE_MEM_ACCESS */ #include "tom/t4_tom.h" #include "cxgbei.h" diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 9ee31616b873..655cc1de1478 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -280,7 +280,7 @@ finalize_pdu(struct icl_cxgbei_conn *icc, struct icl_cxgbei_pdu *icp) last = m_last(m); /* - * Round up the data segment to a 4B boundary. Pad with 0 if + * Round up the data segment to a 4B boundary. Pad with 0 if * necessary. There will definitely be room in the mbuf. */ padding = roundup2(ip->ip_data_len, 4) - ip->ip_data_len; @@ -306,7 +306,7 @@ finalize_pdu(struct icl_cxgbei_conn *icc, struct icl_cxgbei_pdu *icp) bhs->bhs_data_segment_len[1] = ip->ip_data_len >> 8; bhs->bhs_data_segment_len[0] = ip->ip_data_len >> 16; - /* "Convert" PDU to mbuf chain. Do not use icp/ip after this. */ + /* "Convert" PDU to mbuf chain. Do not use icp/ip after this. */ m->m_pkthdr.len = sizeof(struct iscsi_bhs) + ip->ip_data_len + padding; m->m_next = ip->ip_data_mbuf; set_mbuf_ulp_submode(m, ulp_submode); @@ -347,7 +347,7 @@ icl_cxgbei_conn_pdu_append_data(struct icl_conn *ic, struct icl_pdu *ip, MPASS(ip->ip_data_len <= ic->ic_max_data_segment_length); return (0); } else { - if (flags & M_WAITOK) { + if (flags & M_WAITOK) { CXGBE_UNIMPLEMENTED("fail safe append"); } ip->ip_data_len = m_length(m, NULL); @@ -576,7 +576,7 @@ send_iscsi_flowc_wr(struct adapter *sc, struct toepcb *toep, int maxlen) toep->txsd_pidx = 0; toep->txsd_avail--; - t4_wrq_tx(sc, wr); + t4_wrq_tx(sc, wr); } static void @@ -813,7 +813,7 @@ icl_cxgbei_conn_task_setup(struct icl_conn *ic, struct icl_pdu *ip, csio->dxfer_len < ci->ddp_threshold) { no_ddp: /* - * No DDP for this I/O. Allocate an ITT (based on the one + * No DDP for this I/O. Allocate an ITT (based on the one * passed in) that cannot be a valid hardware DDP tag in the * iSCSI region. */ @@ -1049,7 +1049,7 @@ static int icl_cxgbei_limits(struct icl_drv_limits *idl) { - /* Maximum allowed by the RFC. cxgbei_limits will clip them. */ + /* Maximum allowed by the RFC. cxgbei_limits will clip them. */ idl->idl_max_recv_data_segment_length = (1 << 24) - 1; idl->idl_max_send_data_segment_length = (1 << 24) - 1; diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index b4d84d3e5c55..d1b20cfa0e1e 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -1819,13 +1819,12 @@ do_fw4_ack(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) SOCKBUF_LOCK(sb); sbu = sbused(sb); if (ulp_mode(toep) == ULP_MODE_ISCSI) { - if (__predict_false(sbu > 0)) { /* - * The data trasmitted before the tid's ULP mode - * changed to ISCSI is still in so_snd. - * Incoming credits should account for so_snd - * first. + * The data transmitted before the + * tid's ULP mode changed to ISCSI is + * still in so_snd. Incoming credits + * should account for so_snd first. */ sbdrop_locked(sb, min(sbu, plen)); plen -= min(sbu, plen); From owner-dev-commits-src-main@freebsd.org Fri May 14 19:21:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 85327628F0F; Fri, 14 May 2021 19:21:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fhdgk0qM9z3GjG; Fri, 14 May 2021 19:21:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EADF6178F0; Fri, 14 May 2021 19:21:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14EJLrTq058198; Fri, 14 May 2021 19:21:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14EJLrGH058197; Fri, 14 May 2021 19:21:53 GMT (envelope-from git) Date: Fri, 14 May 2021 19:21:53 GMT Message-Id: <202105141921.14EJLrGH058197@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 23b209ee885b - main - cxgbe tom: Account for pre-iSCSI mode data on suspended connections. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 23b209ee885b7891f806ecfe1bb944e40b3b4728 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 19:21:54 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=23b209ee885b7891f806ecfe1bb944e40b3b4728 commit 23b209ee885b7891f806ecfe1bb944e40b3b4728 Author: John Baldwin AuthorDate: 2021-05-14 19:17:02 +0000 Commit: John Baldwin CommitDate: 2021-05-14 19:17:02 +0000 cxgbe tom: Account for pre-iSCSI mode data on suspended connections. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29907 --- sys/dev/cxgbe/tom/t4_cpl_io.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index d1b20cfa0e1e..732754d07f8f 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -1081,8 +1081,34 @@ t4_push_pdus(struct adapter *sc, struct toepcb *toep, int drop) return; } - if (drop) + if (drop) { + struct socket *so = inp->inp_socket; + struct sockbuf *sb = &so->so_snd; + int sbu; + + /* + * An unlocked read is ok here as the data should only + * transition from a non-zero value to either another + * non-zero value or zero. Once it is zero it should + * stay zero. + */ + if (__predict_false(sbused(sb)) > 0) { + SOCKBUF_LOCK(sb); + sbu = sbused(sb); + if (sbu > 0) { + /* + * The data transmitted before the + * tid's ULP mode changed to ISCSI is + * still in so_snd. Incoming credits + * should account for so_snd first. + */ + sbdrop_locked(sb, min(sbu, drop)); + drop -= min(sbu, drop); + } + sowwakeup_locked(so); /* unlocks so_snd */ + } rqdrop_locked(&toep->ulp_pdu_reclaimq, drop); + } while ((sndptr = mbufq_first(pduq)) != NULL) { wr = write_iscsi_mbuf_wr(toep, sndptr); From owner-dev-commits-src-main@freebsd.org Fri May 14 19:21:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 42EA6628F11; Fri, 14 May 2021 19:21:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fhdgl10ljz3Gd8; Fri, 14 May 2021 19:21:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0EC2717AC6; Fri, 14 May 2021 19:21:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14EJLsbF058224; Fri, 14 May 2021 19:21:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14EJLsvI058223; Fri, 14 May 2021 19:21:54 GMT (envelope-from git) Date: Fri, 14 May 2021 19:21:54 GMT Message-Id: <202105141921.14EJLsvI058223@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 46bee8043ee2 - main - cxgbei: Support DDP for target I/O S/G lists with more than one entry. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 46bee8043ee2bd352d420cd573e0364ca45f813e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 19:21:55 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=46bee8043ee2bd352d420cd573e0364ca45f813e commit 46bee8043ee2bd352d420cd573e0364ca45f813e Author: John Baldwin AuthorDate: 2021-05-14 19:17:06 +0000 Commit: John Baldwin CommitDate: 2021-05-14 19:17:06 +0000 cxgbei: Support DDP for target I/O S/G lists with more than one entry. A CAM target layer I/O CCB can use a S/G list of virtual address ranges to describe its data buffer. This change adds zero-copy receive support for such requests. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29908 --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 50 +++++++--- sys/dev/cxgbe/tom/t4_ddp.c | 191 ++++++++++++++++++++++++++++++++++++++ sys/dev/cxgbe/tom/t4_tom.h | 5 + 3 files changed, 232 insertions(+), 14 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 655cc1de1478..5770599eeeef 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -873,6 +873,28 @@ icl_cxgbei_conn_task_done(struct icl_conn *ic, void *arg) } } +static inline bool +ddp_sgl_check(struct ctl_sg_entry *sg, int entries, int xferlen) +{ + int total_len = 0; + + MPASS(entries > 0); + if (((vm_offset_t)sg[--entries].addr & 3U) != 0) + return (false); + + total_len += sg[entries].len; + + while (--entries >= 0) { + if (((vm_offset_t)sg[entries].addr & PAGE_MASK) != 0 || + (sg[entries].len % PAGE_SIZE) != 0) + return (false); + total_len += sg[entries].len; + } + + MPASS(total_len == xferlen); + return (true); +} + /* XXXNP: PDU should be passed in as parameter, like on the initiator. */ #define io_to_request_pdu(io) ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr) #define io_to_ppod_reservation(io) ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr) @@ -888,6 +910,8 @@ icl_cxgbei_conn_transfer_setup(struct icl_conn *ic, union ctl_io *io, struct cxgbei_data *ci = sc->iscsi_ulp_softc; struct ppod_region *pr = &ci->pr; struct ppod_reservation *prsv; + struct ctl_sg_entry *sgl, sg_entry; + int sg_entries = ctsio->kern_sg_entries; uint32_t ttt; int xferlen, rc = 0, alias; @@ -898,7 +922,6 @@ icl_cxgbei_conn_transfer_setup(struct icl_conn *ic, union ctl_io *io, if (ctsio->ext_data_filled == 0) { int first_burst; struct icl_pdu *ip = io_to_request_pdu(io); - vm_offset_t buf; #ifdef INVARIANTS struct icl_cxgbei_pdu *icp = ip_to_icp(ip); @@ -931,18 +954,16 @@ no_ddp: return (0); } - if (ctsio->kern_sg_entries == 0) - buf = (vm_offset_t)ctsio->kern_data_ptr; - else if (ctsio->kern_sg_entries == 1) { - struct ctl_sg_entry *sgl = (void *)ctsio->kern_data_ptr; + if (sg_entries == 0) { + sgl = &sg_entry; + sgl->len = xferlen; + sgl->addr = (void *)ctsio->kern_data_ptr; + sg_entries = 1; + } else + sgl = (void *)ctsio->kern_data_ptr; - MPASS(sgl->len == xferlen); - buf = (vm_offset_t)sgl->addr; - } else { - rc = EAGAIN; /* XXX implement */ + if (!ddp_sgl_check(sgl, sg_entries, xferlen)) goto no_ddp; - } - /* * Reserve resources for DDP, update the ttt that should be used @@ -956,14 +977,15 @@ no_ddp: goto no_ddp; } - rc = t4_alloc_page_pods_for_buf(pr, buf, xferlen, prsv); + rc = t4_alloc_page_pods_for_sgl(pr, sgl, sg_entries, prsv); if (rc != 0) { uma_zfree(prsv_zone, prsv); goto no_ddp; } - rc = t4_write_page_pods_for_buf(sc, toep, prsv, buf, xferlen); - if (rc != 0) { + rc = t4_write_page_pods_for_sgl(sc, toep, prsv, sgl, sg_entries, + xferlen); + if (__predict_false(rc != 0)) { t4_free_page_pods(prsv); uma_zfree(prsv_zone, prsv); goto no_ddp; diff --git a/sys/dev/cxgbe/tom/t4_ddp.c b/sys/dev/cxgbe/tom/t4_ddp.c index e87d013a0453..c266a2e39fa9 100644 --- a/sys/dev/cxgbe/tom/t4_ddp.c +++ b/sys/dev/cxgbe/tom/t4_ddp.c @@ -62,6 +62,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #ifdef TCP_OFFLOAD #include "common/common.h" #include "common/t4_msg.h" @@ -981,6 +984,76 @@ have_pgsz: return (0); } +int +t4_alloc_page_pods_for_sgl(struct ppod_region *pr, struct ctl_sg_entry *sgl, + int entries, struct ppod_reservation *prsv) +{ + int hcf, seglen, idx = 0, npages, nppods, i, len; + uintptr_t start_pva, end_pva, pva, p1 ; + vm_offset_t buf; + struct ctl_sg_entry *sge; + + MPASS(entries > 0); + MPASS(sgl); + + /* + * The DDP page size is unrelated to the VM page size. We combine + * contiguous physical pages into larger segments to get the best DDP + * page size possible. This is the largest of the four sizes in + * A_ULP_RX_ISCSI_PSZ that evenly divides the HCF of the segment sizes + * in the page list. + */ + hcf = 0; + for (i = entries - 1; i >= 0; i--) { + sge = sgl + i; + buf = (vm_offset_t)sge->addr; + len = sge->len; + start_pva = trunc_page(buf); + end_pva = trunc_page(buf + len - 1); + pva = start_pva; + while (pva <= end_pva) { + seglen = PAGE_SIZE; + p1 = pmap_kextract(pva); + pva += PAGE_SIZE; + while (pva <= end_pva && p1 + seglen == + pmap_kextract(pva)) { + seglen += PAGE_SIZE; + pva += PAGE_SIZE; + } + + hcf = calculate_hcf(hcf, seglen); + if (hcf < (1 << pr->pr_page_shift[1])) { + idx = 0; + goto have_pgsz; /* give up, short circuit */ + } + } + } +#define PR_PAGE_MASK(x) ((1 << pr->pr_page_shift[(x)]) - 1) + MPASS((hcf & PR_PAGE_MASK(0)) == 0); /* PAGE_SIZE is >= 4K everywhere */ + for (idx = nitems(pr->pr_page_shift) - 1; idx > 0; idx--) { + if ((hcf & PR_PAGE_MASK(idx)) == 0) + break; + } +#undef PR_PAGE_MASK + +have_pgsz: + MPASS(idx <= M_PPOD_PGSZ); + + npages = 0; + while (entries--) { + npages++; + start_pva = trunc_page(sgl->addr); + end_pva = trunc_page((vm_offset_t)sgl->addr + sgl->len - 1); + npages += (end_pva - start_pva) >> pr->pr_page_shift[idx]; + sgl = sgl + 1; + } + nppods = howmany(npages, PPOD_PAGES); + if (alloc_page_pods(pr, nppods, idx, prsv) != 0) + return (ENOMEM); + MPASS(prsv->prsv_nppods > 0); + return (0); +} + void t4_free_page_pods(struct ppod_reservation *prsv) { @@ -1197,6 +1270,124 @@ t4_write_page_pods_for_buf(struct adapter *sc, struct toepcb *toep, return (0); } +int +t4_write_page_pods_for_sgl(struct adapter *sc, struct toepcb *toep, + struct ppod_reservation *prsv, struct ctl_sg_entry *sgl, int entries, + int xferlen) +{ + struct inpcb *inp = toep->inp; + struct ulp_mem_io *ulpmc; + struct ulptx_idata *ulpsc; + struct pagepod *ppod; + int i, j, k, n, chunk, len, ddp_pgsz; + u_int ppod_addr, offset, sg_offset = 0; + uint32_t cmd; + struct ppod_region *pr = prsv->prsv_pr; + uintptr_t pva, pa; + struct mbuf *m; + struct mbufq wrq; + + MPASS(sgl != NULL); + MPASS(entries > 0); + cmd = htobe32(V_ULPTX_CMD(ULP_TX_MEM_WRITE)); + if (is_t4(sc)) + cmd |= htobe32(F_ULP_MEMIO_ORDER); + else + cmd |= htobe32(F_T5_ULP_MEMIO_IMM); + ddp_pgsz = 1 << pr->pr_page_shift[G_PPOD_PGSZ(prsv->prsv_tag)]; + offset = (vm_offset_t)sgl->addr & PAGE_MASK; + ppod_addr = pr->pr_start + (prsv->prsv_tag & pr->pr_tag_mask); + pva = trunc_page(sgl->addr); + mbufq_init(&wrq, INT_MAX); + for (i = 0; i < prsv->prsv_nppods; ppod_addr += chunk) { + + /* How many page pods are we writing in this cycle */ + n = min(prsv->prsv_nppods - i, NUM_ULP_TX_SC_IMM_PPODS); + MPASS(n > 0); + chunk = PPOD_SZ(n); + len = roundup2(sizeof(*ulpmc) + sizeof(*ulpsc) + chunk, 16); + + m = alloc_raw_wr_mbuf(len); + if (m == NULL) { + mbufq_drain(&wrq); + return (ENOMEM); + } + ulpmc = mtod(m, struct ulp_mem_io *); + + INIT_ULPTX_WR(ulpmc, len, 0, toep->tid); + ulpmc->cmd = cmd; + ulpmc->dlen = htobe32(V_ULP_MEMIO_DATA_LEN(chunk / 32)); + ulpmc->len16 = htobe32(howmany(len - sizeof(ulpmc->wr), 16)); + ulpmc->lock_addr = htobe32(V_ULP_MEMIO_ADDR(ppod_addr >> 5)); + + ulpsc = (struct ulptx_idata *)(ulpmc + 1); + ulpsc->cmd_more = htobe32(V_ULPTX_CMD(ULP_TX_SC_IMM)); + ulpsc->len = htobe32(chunk); + + ppod = (struct pagepod *)(ulpsc + 1); + for (j = 0; j < n; i++, j++, ppod++) { + ppod->vld_tid_pgsz_tag_color = htobe64(F_PPOD_VALID | + V_PPOD_TID(toep->tid) | + (prsv->prsv_tag & ~V_PPOD_PGSZ(M_PPOD_PGSZ))); + ppod->len_offset = htobe64(V_PPOD_LEN(xferlen) | + V_PPOD_OFST(offset)); + ppod->rsvd = 0; + + for (k = 0; k < nitems(ppod->addr); k++) { + if (entries != 0) { + pa = pmap_kextract(pva + sg_offset); + ppod->addr[k] = htobe64(pa); + } else + ppod->addr[k] = 0; + +#if 0 + CTR5(KTR_CXGBE, + "%s: tid %d ppod[%d]->addr[%d] = %p", + __func__, toep->tid, i, k, + htobe64(ppod->addr[k])); +#endif + + /* + * If this is the last entry in a pod, + * reuse the same entry for first address + * in the next pod. + */ + if (k + 1 == nitems(ppod->addr)) + break; + + /* + * Don't move to the next DDP page if the + * sgl is already finished. + */ + if (entries == 0) + continue; + + sg_offset += ddp_pgsz; + if (sg_offset == sgl->len) { + /* + * This sgl entry is done. Go + * to the next. + */ + entries--; + sgl++; + sg_offset = 0; + if (entries != 0) + pva = trunc_page( + (vm_offset_t)sgl->addr); + } + } + } + + mbufq_enqueue(&wrq, m); + } + + INP_WLOCK(inp); + mbufq_concat(&toep->ulp_pduq, &wrq); + INP_WUNLOCK(inp); + + return (0); +} + /* * Prepare a pageset for DDP. This sets up page pods. */ diff --git a/sys/dev/cxgbe/tom/t4_tom.h b/sys/dev/cxgbe/tom/t4_tom.h index f1129b47cbcf..c7984f838735 100644 --- a/sys/dev/cxgbe/tom/t4_tom.h +++ b/sys/dev/cxgbe/tom/t4_tom.h @@ -88,6 +88,7 @@ enum { DDP_DEAD = (1 << 6), /* toepcb is shutting down */ }; +struct ctl_sg_entry; struct sockopt; struct offload_settings; @@ -437,10 +438,14 @@ void t4_free_ppod_region(struct ppod_region *); int t4_alloc_page_pods_for_ps(struct ppod_region *, struct pageset *); int t4_alloc_page_pods_for_buf(struct ppod_region *, vm_offset_t, int, struct ppod_reservation *); +int t4_alloc_page_pods_for_sgl(struct ppod_region *, struct ctl_sg_entry *, int, + struct ppod_reservation *); int t4_write_page_pods_for_ps(struct adapter *, struct sge_wrq *, int, struct pageset *); int t4_write_page_pods_for_buf(struct adapter *, struct toepcb *, struct ppod_reservation *, vm_offset_t, int); +int t4_write_page_pods_for_sgl(struct adapter *, struct toepcb *, + struct ppod_reservation *, struct ctl_sg_entry *, int, int); void t4_free_page_pods(struct ppod_reservation *); int t4_soreceive_ddp(struct socket *, struct sockaddr **, struct uio *, struct mbuf **, struct mbuf **, int *); From owner-dev-commits-src-main@freebsd.org Fri May 14 19:21:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0EF33628C7A; Fri, 14 May 2021 19:21:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fhdgm4Pzqz3GdB; Fri, 14 May 2021 19:21:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31115178FF; Fri, 14 May 2021 19:21:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14EJLujN058245; Fri, 14 May 2021 19:21:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14EJLukW058244; Fri, 14 May 2021 19:21:56 GMT (envelope-from git) Date: Fri, 14 May 2021 19:21:56 GMT Message-Id: <202105141921.14EJLukW058244@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 31df8ff73e3a - main - cxgbei: Rework the pdu_append_data hook to support M_WAITOK. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 31df8ff73e3aa809146fae9baa6a96e1adf8526b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 19:21:57 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=31df8ff73e3aa809146fae9baa6a96e1adf8526b commit 31df8ff73e3aa809146fae9baa6a96e1adf8526b Author: John Baldwin AuthorDate: 2021-05-14 19:17:14 +0000 Commit: John Baldwin CommitDate: 2021-05-14 19:17:14 +0000 cxgbei: Rework the pdu_append_data hook to support M_WAITOK. - Only allocate 16K jumbo mbufs if the region of data to be appended is sufficiently large, and use a loop. - Use m_getm2() to allocate a chain for data less than 16K, or if m_getjcl() fails. - Use ENOMEM as the return value instead of '1' if the hook fails due to a memory allocation error. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29909 --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 65 ++++++++++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 15 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 5770599eeeef..f91b9ee38616 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -324,35 +324,70 @@ int icl_cxgbei_conn_pdu_append_data(struct icl_conn *ic, struct icl_pdu *ip, const void *addr, size_t len, int flags) { - struct mbuf *m; #ifdef INVARIANTS struct icl_cxgbei_pdu *icp = ip_to_icp(ip); #endif + struct mbuf *m, *m_tail; + const char *src; MPASS(icp->icp_signature == CXGBEI_PDU_SIGNATURE); MPASS(ic == ip->ip_conn); KASSERT(len > 0, ("%s: len is %jd", __func__, (intmax_t)len)); - m = ip->ip_data_mbuf; - if (m == NULL) { + m_tail = ip->ip_data_mbuf; + if (m_tail != NULL) + for (; m_tail->m_next != NULL; m_tail = m_tail->m_next) + ; + + src = (const char *)addr; + + /* Allocate as jumbo mbufs of size MJUM16BYTES. */ + while (len >= MJUM16BYTES) { m = m_getjcl(M_NOWAIT, MT_DATA, 0, MJUM16BYTES); - if (__predict_false(m == NULL)) + if (__predict_false(m == NULL)) { + if ((flags & M_WAITOK) != 0) { + /* Fall back to non-jumbo mbufs. */ + break; + } return (ENOMEM); - - ip->ip_data_mbuf = m; + } + memcpy(mtod(m, void *), src, MJUM16BYTES); + m->m_len = MJUM16BYTES; + if (ip->ip_data_mbuf == NULL) { + ip->ip_data_mbuf = m_tail = m; + ip->ip_data_len = MJUM16BYTES; + } else { + m_tail->m_next = m; + m_tail = m_tail->m_next; + ip->ip_data_len += MJUM16BYTES; + } + src += MJUM16BYTES; + len -= MJUM16BYTES; } - if (__predict_true(m_append(m, len, addr) != 0)) { - ip->ip_data_len += len; - MPASS(ip->ip_data_len <= ic->ic_max_data_segment_length); - return (0); - } else { - if (flags & M_WAITOK) { - CXGBE_UNIMPLEMENTED("fail safe append"); + /* Allocate mbuf chain for the remaining data. */ + if (len != 0) { + m = m_getm2(NULL, len, flags, MT_DATA, 0); + if (__predict_false(m == NULL)) + return (ENOMEM); + if (ip->ip_data_mbuf == NULL) { + ip->ip_data_mbuf = m; + ip->ip_data_len = len; + } else { + m_tail->m_next = m; + ip->ip_data_len += len; } - ip->ip_data_len = m_length(m, NULL); - return (1); + for (; m != NULL; m = m->m_next) { + m->m_len = min(len, M_SIZE(m)); + memcpy(mtod(m, void *), src, m->m_len); + src += m->m_len; + len -= m->m_len; + } + MPASS(len == 0); } + MPASS(ip->ip_data_len <= ic->ic_max_data_segment_length); + + return (0); } void From owner-dev-commits-src-main@freebsd.org Fri May 14 19:21:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F05A1629082; Fri, 14 May 2021 19:21:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fhdgn4QqHz3GVG; Fri, 14 May 2021 19:21:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 485E017E2E; Fri, 14 May 2021 19:21:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14EJLvuT058266; Fri, 14 May 2021 19:21:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14EJLvUc058265; Fri, 14 May 2021 19:21:57 GMT (envelope-from git) Date: Fri, 14 May 2021 19:21:57 GMT Message-Id: <202105141921.14EJLvUc058265@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: a1c687347a7f - main - cxgbei: Add support for zero-copy iSCSI target transmission/read. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a1c687347a7f983dadec10949938ee4d1b321120 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 19:21:58 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a1c687347a7f983dadec10949938ee4d1b321120 commit a1c687347a7f983dadec10949938ee4d1b321120 Author: John Baldwin AuthorDate: 2021-05-14 19:17:20 +0000 Commit: John Baldwin CommitDate: 2021-05-14 19:17:20 +0000 cxgbei: Add support for zero-copy iSCSI target transmission/read. - Switch to allocating the cxgbei version of icl_pdu explicitly as a separate refcounted object allocated via malloc/free instead of storing it in the bhs mbuf prior to the bhs. - Support the icl_conn_pdu_queue_cb() method to set a callback on a PDU to be invoked when the PDU is freed. - For ICL_NOCOPY buffers, use an external mbuf to manage the storage for the buffer via m_extaddref(). Each external mbuf holds a reference on the associated PDU, so the callback is invoked once all of the external mbufs have been freed. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29910 --- sys/dev/cxgbe/cxgbei/cxgbei.h | 4 + sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 161 ++++++++++++++++++++++++++++++-------- 2 files changed, 132 insertions(+), 33 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.h b/sys/dev/cxgbe/cxgbei/cxgbei.h index 3b17a4f2b36a..9941e817b9cb 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.h +++ b/sys/dev/cxgbe/cxgbei/cxgbei.h @@ -96,6 +96,10 @@ struct icl_cxgbei_pdu { uint32_t icp_signature; uint32_t icp_seq; /* For debug only */ u_int icp_flags; + + u_int ref_cnt; + icl_pdu_cb cb; + int error; }; static inline struct icl_cxgbei_pdu * diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index f91b9ee38616..f661d0a9d7d7 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -100,6 +100,8 @@ __FBSDID("$FreeBSD$"); #include "tom/t4_tom.h" #include "cxgbei.h" +static MALLOC_DEFINE(M_CXGBEI, "cxgbei", "cxgbei(4)"); + SYSCTL_NODE(_kern_icl, OID_AUTO, cxgbei, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "Chelsio iSCSI offload"); static int coalesce = 1; @@ -130,6 +132,7 @@ static icl_conn_pdu_data_segment_length_t static icl_conn_pdu_append_data_t icl_cxgbei_conn_pdu_append_data; static icl_conn_pdu_get_data_t icl_cxgbei_conn_pdu_get_data; static icl_conn_pdu_queue_t icl_cxgbei_conn_pdu_queue; +static icl_conn_pdu_queue_cb_t icl_cxgbei_conn_pdu_queue_cb; static icl_conn_handoff_t icl_cxgbei_conn_handoff; static icl_conn_free_t icl_cxgbei_conn_free; static icl_conn_close_t icl_cxgbei_conn_close; @@ -146,6 +149,7 @@ static kobj_method_t icl_cxgbei_methods[] = { KOBJMETHOD(icl_conn_pdu_append_data, icl_cxgbei_conn_pdu_append_data), KOBJMETHOD(icl_conn_pdu_get_data, icl_cxgbei_conn_pdu_get_data), KOBJMETHOD(icl_conn_pdu_queue, icl_cxgbei_conn_pdu_queue), + KOBJMETHOD(icl_conn_pdu_queue_cb, icl_cxgbei_conn_pdu_queue_cb), KOBJMETHOD(icl_conn_handoff, icl_cxgbei_conn_handoff), KOBJMETHOD(icl_conn_free, icl_cxgbei_conn_free), KOBJMETHOD(icl_conn_close, icl_cxgbei_conn_close), @@ -161,54 +165,108 @@ DEFINE_CLASS(icl_cxgbei, icl_cxgbei_methods, sizeof(struct icl_cxgbei_conn)); void icl_cxgbei_conn_pdu_free(struct icl_conn *ic, struct icl_pdu *ip) { -#ifdef INVARIANTS struct icl_cxgbei_pdu *icp = ip_to_icp(ip); -#endif + KASSERT(icp->ref_cnt != 0, ("freeing deleted PDU")); MPASS(icp->icp_signature == CXGBEI_PDU_SIGNATURE); MPASS(ic == ip->ip_conn); - MPASS(ip->ip_bhs_mbuf != NULL); m_freem(ip->ip_ahs_mbuf); m_freem(ip->ip_data_mbuf); - m_freem(ip->ip_bhs_mbuf); /* storage for icl_cxgbei_pdu itself */ + m_freem(ip->ip_bhs_mbuf); + + KASSERT(ic != NULL || icp->ref_cnt == 1, + ("orphaned PDU has oustanding references")); + if (atomic_fetchadd_int(&icp->ref_cnt, -1) != 1) + return; + + free(icp, M_CXGBEI); #ifdef DIAGNOSTIC if (__predict_true(ic != NULL)) refcount_release(&ic->ic_outstanding_pdus); #endif } +static void +icl_cxgbei_pdu_call_cb(struct icl_pdu *ip) +{ + struct icl_cxgbei_pdu *icp = ip_to_icp(ip); + + MPASS(icp->icp_signature == CXGBEI_PDU_SIGNATURE); + + if (icp->cb != NULL) + icp->cb(ip, icp->error); +#ifdef DIAGNOSTIC + if (__predict_true(ip->ip_conn != NULL)) + refcount_release(&ip->ip_conn->ic_outstanding_pdus); +#endif + free(icp, M_CXGBEI); +} + +static void +icl_cxgbei_pdu_done(struct icl_pdu *ip, int error) +{ + struct icl_cxgbei_pdu *icp = ip_to_icp(ip); + + if (error != 0) + icp->error = error; + + m_freem(ip->ip_ahs_mbuf); + ip->ip_ahs_mbuf = NULL; + m_freem(ip->ip_data_mbuf); + ip->ip_data_mbuf = NULL; + m_freem(ip->ip_bhs_mbuf); + ip->ip_bhs_mbuf = NULL; + + /* + * All other references to this PDU should have been dropped + * by the m_freem() of ip_data_mbuf. + */ + if (atomic_fetchadd_int(&icp->ref_cnt, -1) == 1) + icl_cxgbei_pdu_call_cb(ip); + else + __assert_unreachable(); +} + +static void +icl_cxgbei_mbuf_done(struct mbuf *mb) +{ + + struct icl_cxgbei_pdu *icp = (struct icl_cxgbei_pdu *)mb->m_ext.ext_arg1; + + /* + * NB: mb_free_mext() might leave ref_cnt as 1 without + * decrementing it if it hits the fast path in the ref_cnt + * check. + */ + icl_cxgbei_pdu_call_cb(&icp->ip); +} + struct icl_pdu * icl_cxgbei_new_pdu(int flags) { struct icl_cxgbei_pdu *icp; struct icl_pdu *ip; struct mbuf *m; - uintptr_t a; - m = m_gethdr(flags, MT_DATA); - if (__predict_false(m == NULL)) + icp = malloc(sizeof(*icp), M_CXGBEI, flags | M_ZERO); + if (__predict_false(icp == NULL)) return (NULL); - a = roundup2(mtod(m, uintptr_t), _Alignof(struct icl_cxgbei_pdu)); - icp = (struct icl_cxgbei_pdu *)a; - bzero(icp, sizeof(*icp)); - icp->icp_signature = CXGBEI_PDU_SIGNATURE; + icp->ref_cnt = 1; ip = &icp->ip; - ip->ip_bhs_mbuf = m; - a = roundup2((uintptr_t)(icp + 1), _Alignof(struct iscsi_bhs *)); - ip->ip_bhs = (struct iscsi_bhs *)a; -#ifdef INVARIANTS - /* Everything must fit entirely in the mbuf. */ - a = (uintptr_t)(ip->ip_bhs + 1); - MPASS(a <= (uintptr_t)m + MSIZE); -#endif - bzero(ip->ip_bhs, sizeof(*ip->ip_bhs)); + m = m_gethdr(flags, MT_DATA); + if (__predict_false(m == NULL)) { + free(icp, M_CXGBEI); + return (NULL); + } - m->m_data = (void *)ip->ip_bhs; + ip->ip_bhs_mbuf = m; + ip->ip_bhs = mtod(m, struct iscsi_bhs *); + memset(ip->ip_bhs, 0, sizeof(*ip->ip_bhs)); m->m_len = sizeof(struct iscsi_bhs); m->m_pkthdr.len = m->m_len; @@ -306,16 +364,22 @@ finalize_pdu(struct icl_cxgbei_conn *icc, struct icl_cxgbei_pdu *icp) bhs->bhs_data_segment_len[1] = ip->ip_data_len >> 8; bhs->bhs_data_segment_len[0] = ip->ip_data_len >> 16; - /* "Convert" PDU to mbuf chain. Do not use icp/ip after this. */ - m->m_pkthdr.len = sizeof(struct iscsi_bhs) + ip->ip_data_len + padding; + /* + * Extract mbuf chain from PDU. + */ + m->m_pkthdr.len += ip->ip_data_len + padding; m->m_next = ip->ip_data_mbuf; set_mbuf_ulp_submode(m, ulp_submode); -#ifdef INVARIANTS - bzero(icp, sizeof(*icp)); -#endif -#ifdef DIAGNOSTIC - refcount_release(&icc->ic.ic_outstanding_pdus); -#endif + ip->ip_bhs_mbuf = NULL; + ip->ip_data_mbuf = NULL; + ip->ip_bhs = NULL; + + /* + * Drop PDU reference on icp. Additional references might + * still be held by zero-copy PDU buffers (ICL_NOCOPY). + */ + if (atomic_fetchadd_int(&icp->ref_cnt, -1) == 1) + icl_cxgbei_pdu_call_cb(ip); return (m); } @@ -324,9 +388,7 @@ int icl_cxgbei_conn_pdu_append_data(struct icl_conn *ic, struct icl_pdu *ip, const void *addr, size_t len, int flags) { -#ifdef INVARIANTS struct icl_cxgbei_pdu *icp = ip_to_icp(ip); -#endif struct mbuf *m, *m_tail; const char *src; @@ -339,6 +401,29 @@ icl_cxgbei_conn_pdu_append_data(struct icl_conn *ic, struct icl_pdu *ip, for (; m_tail->m_next != NULL; m_tail = m_tail->m_next) ; + if (flags & ICL_NOCOPY) { + m = m_get(flags & ~ICL_NOCOPY, MT_DATA); + if (m == NULL) { + ICL_WARN("failed to allocate mbuf"); + return (ENOMEM); + } + + m->m_flags |= M_RDONLY; + m_extaddref(m, __DECONST(char *, addr), len, &icp->ref_cnt, + icl_cxgbei_mbuf_done, icp, NULL); + m->m_len = len; + if (ip->ip_data_mbuf == NULL) { + ip->ip_data_mbuf = m; + ip->ip_data_len = len; + } else { + m_tail->m_next = m; + m_tail = m_tail->m_next; + ip->ip_data_len += len; + } + + return (0); + } + src = (const char *)addr; /* Allocate as jumbo mbufs of size MJUM16BYTES. */ @@ -403,6 +488,13 @@ icl_cxgbei_conn_pdu_get_data(struct icl_conn *ic, struct icl_pdu *ip, void icl_cxgbei_conn_pdu_queue(struct icl_conn *ic, struct icl_pdu *ip) +{ + icl_cxgbei_conn_pdu_queue_cb(ic, ip, NULL); +} + +void +icl_cxgbei_conn_pdu_queue_cb(struct icl_conn *ic, struct icl_pdu *ip, + icl_pdu_cb cb) { struct epoch_tracker et; struct icl_cxgbei_conn *icc = ic_to_icc(ic); @@ -418,9 +510,12 @@ icl_cxgbei_conn_pdu_queue(struct icl_conn *ic, struct icl_pdu *ip) MPASS(ip->ip_ahs_mbuf == NULL && ip->ip_ahs_len == 0); ICL_CONN_LOCK_ASSERT(ic); + + icp->cb = cb; + /* NOTE: sowriteable without so_snd lock is a mostly harmless race. */ if (ic->ic_disconnecting || so == NULL || !sowriteable(so)) { - icl_cxgbei_conn_pdu_free(ic, ip); + icl_cxgbei_pdu_done(ip, ENOTCONN); return; } @@ -809,7 +904,7 @@ icl_cxgbei_conn_close(struct icl_conn *ic) while (!STAILQ_EMPTY(&icc->rcvd_pdus)) { ip = STAILQ_FIRST(&icc->rcvd_pdus); STAILQ_REMOVE_HEAD(&icc->rcvd_pdus, ip_next); - icl_cxgbei_conn_pdu_free(ic, ip); + icl_cxgbei_pdu_done(ip, ENOTCONN); } SOCKBUF_UNLOCK(sb); } From owner-dev-commits-src-main@freebsd.org Fri May 14 19:21:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E4AF5628B0D; Fri, 14 May 2021 19:21:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fhdgp3bzsz3Ggy; Fri, 14 May 2021 19:21:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 587EC17E2F; Fri, 14 May 2021 19:21:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14EJLwfO058287; Fri, 14 May 2021 19:21:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14EJLwgq058286; Fri, 14 May 2021 19:21:58 GMT (envelope-from git) Date: Fri, 14 May 2021 19:21:58 GMT Message-Id: <202105141921.14EJLwgq058286@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 4add8e4c8991 - main - cxgbei: Don't leak resources for an aborted target transfer. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4add8e4c89915dc0018a8480c63b6d6031d31295 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 19:21:59 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4add8e4c89915dc0018a8480c63b6d6031d31295 commit 4add8e4c89915dc0018a8480c63b6d6031d31295 Author: John Baldwin AuthorDate: 2021-05-14 19:17:26 +0000 Commit: John Baldwin CommitDate: 2021-05-14 19:17:26 +0000 cxgbei: Don't leak resources for an aborted target transfer. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29911 --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index f661d0a9d7d7..e3dc05645732 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -1153,7 +1153,8 @@ icl_cxgbei_conn_transfer_done(struct icl_conn *ic, void *arg) { struct ctl_scsiio *ctsio = arg; - if (ctsio != NULL && ctsio->kern_data_len == ctsio->ext_data_filled) { + if (ctsio != NULL && (ctsio->kern_data_len == ctsio->ext_data_filled || + ic->ic_disconnecting)) { struct ppod_reservation *prsv; prsv = io_to_ppod_reservation(ctsio); From owner-dev-commits-src-main@freebsd.org Fri May 14 19:21:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E71B7628B27; Fri, 14 May 2021 19:21:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fhdgq4ddVz3GWt; Fri, 14 May 2021 19:21:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F08917E30; Fri, 14 May 2021 19:21:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14EJLxGn058308; Fri, 14 May 2021 19:21:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14EJLxbj058307; Fri, 14 May 2021 19:21:59 GMT (envelope-from git) Date: Fri, 14 May 2021 19:21:59 GMT Message-Id: <202105141921.14EJLxbj058307@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 1ad32ad0bed4 - main - cxgbei: Don't clamp iSCSI PDUs to 8K. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1ad32ad0bed40be5deb87a36a0564adc994ad47a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 19:22:00 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1ad32ad0bed40be5deb87a36a0564adc994ad47a commit 1ad32ad0bed40be5deb87a36a0564adc994ad47a Author: John Baldwin AuthorDate: 2021-05-14 19:17:31 +0000 Commit: John Baldwin CommitDate: 2021-05-14 19:21:24 +0000 cxgbei: Don't clamp iSCSI PDUs to 8K. The firmware no longer requires this workaround. Discussed with: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29912 --- sys/dev/cxgbe/cxgbei/cxgbei.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index 419293ec9cdf..f95c9f60163f 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -114,9 +114,6 @@ read_pdu_limits(struct adapter *sc, uint32_t *max_tx_pdu_len, rx_len = min(rx_len, v); tx_len = min(tx_len, v); - /* Remove after FW_FLOWC_MNEM_TXDATAPLEN_MAX fix in firmware. */ - tx_len = min(tx_len, 3 * 4096); - *max_tx_pdu_len = rounddown2(tx_len, 512); *max_rx_pdu_len = rounddown2(rx_len, 512); } From owner-dev-commits-src-main@freebsd.org Fri May 14 19:22:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B0A14628B2B; Fri, 14 May 2021 19:22:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fhdgs4DQVz3Gts; Fri, 14 May 2021 19:22:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A785417AC9; Fri, 14 May 2021 19:22:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14EJM0ma058348; Fri, 14 May 2021 19:22:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14EJM0YC058347; Fri, 14 May 2021 19:22:00 GMT (envelope-from git) Date: Fri, 14 May 2021 19:22:00 GMT Message-Id: <202105141922.14EJM0YC058347@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: e894e3adb206 - main - cxgbei: Explicitly clear the page pode reservation pointer after freeing it. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e894e3adb206815c2acff17a4011becb166c2f66 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 19:22:02 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=e894e3adb206815c2acff17a4011becb166c2f66 commit e894e3adb206815c2acff17a4011becb166c2f66 Author: John Baldwin AuthorDate: 2021-05-14 19:20:51 +0000 Commit: John Baldwin CommitDate: 2021-05-14 19:21:34 +0000 cxgbei: Explicitly clear the page pode reservation pointer after freeing it. A single union ctl_io can be reused across multiple transfers (in particular by the ramdisk backend). On a reuse, the reservation pointer would retain its value from the previous transfer tripping an assertion. Reported by: Jithesh Arakkan @ Chelsio Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29939 --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index e3dc05645732..7f638c96483a 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -1162,6 +1162,7 @@ icl_cxgbei_conn_transfer_done(struct icl_conn *ic, void *arg) t4_free_page_pods(prsv); uma_zfree(prsv_zone, prsv); + io_to_ppod_reservation(ctsio) = NULL; } } From owner-dev-commits-src-main@freebsd.org Fri May 14 19:22:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D4883629076; Fri, 14 May 2021 19:22:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fhdgt0wM4z3GhG; Fri, 14 May 2021 19:22:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CACEB17ACA; Fri, 14 May 2021 19:22:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14EJM1SX058369; Fri, 14 May 2021 19:22:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14EJM1pM058368; Fri, 14 May 2021 19:22:01 GMT (envelope-from git) Date: Fri, 14 May 2021 19:22:01 GMT Message-Id: <202105141922.14EJM1pM058368@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: e73e2ee0acf5 - main - cxgbei: Handle target transfers with excess unsolicited data. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e73e2ee0acf5a0e0f47b9c2bcd73c835c4922fab Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 19:22:03 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=e73e2ee0acf5a0e0f47b9c2bcd73c835c4922fab commit e73e2ee0acf5a0e0f47b9c2bcd73c835c4922fab Author: John Baldwin AuthorDate: 2021-05-14 19:20:57 +0000 Commit: John Baldwin CommitDate: 2021-05-14 19:21:34 +0000 cxgbei: Handle target transfers with excess unsolicited data. The CTL frontend might have provided a buffer that is smaller than the FirstBurstLength and thus smaller than the amount of unsolicited data included in the request PDU. Treat these transfers as an empty transfer. Reported by: Jithesh Arakkan @ Chelsio Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29940 --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 7f638c96483a..c4eb4a35ad31 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -1064,10 +1064,15 @@ icl_cxgbei_conn_transfer_setup(struct icl_conn *ic, union ctl_io *io, /* * Note that ICL calls conn_transfer_setup even if the first * burst had everything and there's nothing left to transfer. + * + * NB: The CTL frontend might have provided a buffer + * whose length (kern_data_len) is smaller than the + * FirstBurstLength of unsolicited data. Treat those + * as an empty transfer. */ - MPASS(ctsio->kern_data_len >= first_burst); xferlen = ctsio->kern_data_len; - if (xferlen - first_burst < ci->ddp_threshold) { + if (xferlen < first_burst || + xferlen - first_burst < ci->ddp_threshold) { no_ddp: /* * No DDP for this transfer. Allocate a TTT (based on From owner-dev-commits-src-main@freebsd.org Fri May 14 20:34:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E2F9B62A97F; Fri, 14 May 2021 20:34:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FhgHh6782z3RF1; Fri, 14 May 2021 20:34:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C536A18C20; Fri, 14 May 2021 20:34:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14EKYeCw052140; Fri, 14 May 2021 20:34:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14EKYevJ052139; Fri, 14 May 2021 20:34:40 GMT (envelope-from git) Date: Fri, 14 May 2021 20:34:40 GMT Message-Id: <202105142034.14EKYevJ052139@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: cf653b7abea3 - main - git-arc(1): fix usage formatting for stage command MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cf653b7abea3852cac8dfb65415f7349baa6ceb1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 20:34:40 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=cf653b7abea3852cac8dfb65415f7349baa6ceb1 commit cf653b7abea3852cac8dfb65415f7349baa6ceb1 Author: Mitchell Horne AuthorDate: 2021-05-14 20:32:47 +0000 Commit: Mitchell Horne CommitDate: 2021-05-14 20:34:04 +0000 git-arc(1): fix usage formatting for stage command The branch argument is conditional on the -b flag. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D30262 --- tools/tools/git/git-arc.1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/tools/git/git-arc.1 b/tools/tools/git/git-arc.1 index 00019a19180d..21399aef8e0e 100644 --- a/tools/tools/git/git-arc.1 +++ b/tools/tools/git/git-arc.1 @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd February 7, 2021 +.Dd May 14, 2021 .Dt GIT-ARC 1 .Os .Sh NAME @@ -43,8 +43,8 @@ .Cm patch Ar diff1 Ns Op Cm \&, Ns Ar diff2 .Nm .Cm stage -.Op Fl b -.Ar branch Op Ar commit Ns | Ns Ar commit-range +.Op Fl b Ar branch +.Op Ar commit Ns | Ns Ar commit-range .Nm .Cm update .Op Ar commit Ns | Ns Ar commit-range Oc From owner-dev-commits-src-main@freebsd.org Fri May 14 21:25:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED29B62C818; Fri, 14 May 2021 21:25:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FhhQS6RCnz3rXY; Fri, 14 May 2021 21:25:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CFB6A19822; Fri, 14 May 2021 21:25:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14ELPaOd019353; Fri, 14 May 2021 21:25:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14ELPabh019352; Fri, 14 May 2021 21:25:36 GMT (envelope-from git) Date: Fri, 14 May 2021 21:25:36 GMT Message-Id: <202105142125.14ELPabh019352@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: 91f251b2ab3a - main - fstyp(8): define HAVE_ZFS macro when built with zfs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 91f251b2ab3ade5de703756873142bfae2573753 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 21:25:37 -0000 The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=91f251b2ab3ade5de703756873142bfae2573753 commit 91f251b2ab3ade5de703756873142bfae2573753 Author: Robert Wing AuthorDate: 2021-05-12 02:57:24 +0000 Commit: Robert Wing CommitDate: 2021-05-14 21:00:24 +0000 fstyp(8): define HAVE_ZFS macro when built with zfs The HAVE_ZFS macro was dropped from the Makefile during the OpenZFS merge, bring it back. While here, drop unused WARNS setting. PR: 255616 Reported by: Michael Büker Submitted by: Michael Büker Fixes: 9e5787d2284e187abb5b654d924394a65772e004 Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30221 --- usr.sbin/fstyp/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/fstyp/Makefile b/usr.sbin/fstyp/Makefile index bfdc845bba4a..14b5d9dfd9c3 100644 --- a/usr.sbin/fstyp/Makefile +++ b/usr.sbin/fstyp/Makefile @@ -28,7 +28,7 @@ SUBDIR.${MK_TESTS}+= tests .if ${MK_ZFS} != "no" IGNORE_PRAGMA= YES -WARNS?= 0 +CFLAGS+= -DHAVE_ZFS CFLAGS.zfs.c+= -DIN_BASE CFLAGS.zfs.c+= -I${SRCTOP}/sys/contrib/openzfs/include CFLAGS.zfs.c+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include From owner-dev-commits-src-main@freebsd.org Sat May 15 07:01:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9108363BE3E; Sat, 15 May 2021 07:01:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FhxBW3Qk8z4qL7; Sat, 15 May 2021 07:01:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E1E9211E3; Sat, 15 May 2021 07:01:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14F7171Y084360; Sat, 15 May 2021 07:01:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14F717lf084359; Sat, 15 May 2021 07:01:07 GMT (envelope-from git) Date: Sat, 15 May 2021 07:01:07 GMT Message-Id: <202105150701.14F717lf084359@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: effc8e57fbf0 - main - libalias: Style cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: effc8e57fbf03d7f1423c662caf2b63f0d1d21a9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2021 07:01:07 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=effc8e57fbf03d7f1423c662caf2b63f0d1d21a9 commit effc8e57fbf03d7f1423c662caf2b63f0d1d21a9 Author: Lutz Donnerhacke AuthorDate: 2021-05-14 13:08:08 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-15 06:57:55 +0000 libalias: Style cleanup libalias is a convolut of various coding styles modified by a series of different editors enforcing interesting convetions on spacing and comments. This patch is a baseline to start with a perfomance rework of libalias. Upcoming patches should be focus on the code, not on the style. That's why most annoying style errors should be fixed beforehand. Reviewed by: hselasky Discussed by: emaste MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30259 --- sys/netinet/libalias/alias.c | 379 ++++++++++++++++----------------- sys/netinet/libalias/alias.h | 44 ++-- sys/netinet/libalias/alias_db.c | 414 +++++++++++++++++------------------- sys/netinet/libalias/alias_dummy.c | 15 +- sys/netinet/libalias/alias_ftp.c | 68 +++--- sys/netinet/libalias/alias_irc.c | 52 +++-- sys/netinet/libalias/alias_local.h | 178 +++++++--------- sys/netinet/libalias/alias_mod.c | 2 - sys/netinet/libalias/alias_nbt.c | 253 ++++++++++------------ sys/netinet/libalias/alias_pptp.c | 84 ++++---- sys/netinet/libalias/alias_proxy.c | 271 ++++++++++++----------- sys/netinet/libalias/alias_sctp.c | 138 ++++++------ sys/netinet/libalias/alias_sctp.h | 26 +-- sys/netinet/libalias/alias_skinny.c | 30 ++- sys/netinet/libalias/alias_smedia.c | 91 ++++---- sys/netinet/libalias/alias_util.c | 30 +-- 16 files changed, 975 insertions(+), 1100 deletions(-) diff --git a/sys/netinet/libalias/alias.c b/sys/netinet/libalias/alias.c index 900731fcbec6..cac19ab55d56 100644 --- a/sys/netinet/libalias/alias.c +++ b/sys/netinet/libalias/alias.c @@ -146,7 +146,7 @@ __FBSDID("$FreeBSD$"); #include "alias_mod.h" #endif -/* +/* * Define libalias SYSCTL Node */ #ifdef SYSCTL_NODE @@ -192,7 +192,6 @@ static void TcpMonitorOut(u_char, struct alias_link *); static void TcpMonitorIn(u_char th_flags, struct alias_link *lnk) { - switch (GetStateIn(lnk)) { case ALIAS_TCP_STATE_NOT_CONNECTED: if (th_flags & TH_RST) @@ -210,7 +209,6 @@ TcpMonitorIn(u_char th_flags, struct alias_link *lnk) static void TcpMonitorOut(u_char th_flags, struct alias_link *lnk) { - switch (GetStateOut(lnk)) { case ALIAS_TCP_STATE_NOT_CONNECTED: if (th_flags & TH_RST) @@ -285,21 +283,20 @@ static int UdpAliasOut(struct libalias *, struct ip *, int, int create); static int TcpAliasIn(struct libalias *, struct ip *); static int TcpAliasOut(struct libalias *, struct ip *, int, int create); -static int -IcmpAliasIn1(struct libalias *la, struct ip *pip) -{ - - LIBALIAS_LOCK_ASSERT(la); /* De-alias incoming echo and timestamp replies. Alias incoming echo and timestamp requests. */ +static int +IcmpAliasIn1(struct libalias *la, struct ip *pip) +{ + LIBALIAS_LOCK_ASSERT(la); struct alias_link *lnk; struct icmp *ic; ic = (struct icmp *)ip_next(pip); -/* Get source address from ICMP data field and restore original data */ + /* Get source address from ICMP data field and restore original data */ lnk = FindIcmpIn(la, pip->ip_src, pip->ip_dst, ic->icmp_id, 1); if (lnk != NULL) { u_short original_id; @@ -307,15 +304,15 @@ IcmpAliasIn1(struct libalias *la, struct ip *pip) original_id = GetOriginalPort(lnk); -/* Adjust ICMP checksum */ + /* Adjust ICMP checksum */ accumulate = ic->icmp_id; accumulate -= original_id; ADJUST_CHECKSUM(accumulate, ic->icmp_cksum); -/* Put original sequence number back in */ + /* Put original sequence number back in */ ic->icmp_id = original_id; -/* Put original address back into IP header */ + /* Put original address back into IP header */ { struct in_addr original_address; @@ -330,15 +327,14 @@ IcmpAliasIn1(struct libalias *la, struct ip *pip) return (PKT_ALIAS_IGNORED); } -static int -IcmpAliasIn2(struct libalias *la, struct ip *pip) -{ - - LIBALIAS_LOCK_ASSERT(la); /* Alias incoming ICMP error messages containing IP header and first 64 bits of datagram. */ +static int +IcmpAliasIn2(struct libalias *la, struct ip *pip) +{ + LIBALIAS_LOCK_ASSERT(la); struct ip *ip; struct icmp *ic, *ic2; struct udphdr *ud; @@ -377,7 +373,7 @@ IcmpAliasIn2(struct libalias *la, struct ip *pip) original_address = GetOriginalAddress(lnk); original_port = GetOriginalPort(lnk); -/* Adjust ICMP checksum */ + /* Adjust ICMP checksum */ accumulate = twowords(&ip->ip_src); accumulate -= twowords(&original_address); accumulate += ud->uh_sport; @@ -388,13 +384,14 @@ IcmpAliasIn2(struct libalias *la, struct ip *pip) accumulate2 -= ip->ip_sum; ADJUST_CHECKSUM(accumulate2, ic->icmp_cksum); -/* Un-alias address in IP header */ + /* Un-alias address in IP header */ DifferentialChecksum(&pip->ip_sum, &original_address, &pip->ip_dst, 2); pip->ip_dst = original_address; -/* Un-alias address and port number of original IP packet -fragment contained in ICMP data section */ + /* Un-alias address and port number of + * original IP packet fragment contained + * in ICMP data section */ ip->ip_src = original_address; ud->uh_sport = original_port; } else if (ip->ip_p == IPPROTO_ICMP) { @@ -405,7 +402,7 @@ fragment contained in ICMP data section */ original_address = GetOriginalAddress(lnk); original_id = GetOriginalPort(lnk); -/* Adjust ICMP checksum */ + /* Adjust ICMP checksum */ accumulate = twowords(&ip->ip_src); accumulate -= twowords(&original_address); accumulate += ic2->icmp_id; @@ -416,13 +413,13 @@ fragment contained in ICMP data section */ accumulate2 -= ip->ip_sum; ADJUST_CHECKSUM(accumulate2, ic->icmp_cksum); -/* Un-alias address in IP header */ + /* Un-alias address in IP header */ DifferentialChecksum(&pip->ip_sum, &original_address, &pip->ip_dst, 2); pip->ip_dst = original_address; -/* Un-alias address of original IP packet and sequence number of - embedded ICMP datagram */ + /* Un-alias address of original IP packet and + * sequence number of embedded ICMP datagram */ ip->ip_src = original_address; ic2->icmp_id = original_id; } @@ -444,7 +441,7 @@ IcmpAliasIn(struct libalias *la, struct ip *pip) if (dlen < ICMP_MINLEN) return (PKT_ALIAS_IGNORED); -/* Return if proxy-only mode is enabled */ + /* Return if proxy-only mode is enabled */ if (la->packetAliasMode & PKT_ALIAS_PROXY_ONLY) return (PKT_ALIAS_OK); @@ -475,20 +472,20 @@ IcmpAliasIn(struct libalias *la, struct ip *pip) return (iresult); } -static int -IcmpAliasOut1(struct libalias *la, struct ip *pip, int create) -{ /* Alias outgoing echo and timestamp requests. De-alias outgoing echo and timestamp replies. */ +static int +IcmpAliasOut1(struct libalias *la, struct ip *pip, int create) +{ struct alias_link *lnk; struct icmp *ic; LIBALIAS_LOCK_ASSERT(la); ic = (struct icmp *)ip_next(pip); -/* Save overwritten data for when echo packet returns */ + /* Save overwritten data for when echo packet returns */ lnk = FindIcmpOut(la, pip->ip_src, pip->ip_dst, ic->icmp_id, create); if (lnk != NULL) { u_short alias_id; @@ -496,15 +493,15 @@ IcmpAliasOut1(struct libalias *la, struct ip *pip, int create) alias_id = GetAliasPort(lnk); -/* Since data field is being modified, adjust ICMP checksum */ + /* Since data field is being modified, adjust ICMP checksum */ accumulate = ic->icmp_id; accumulate -= alias_id; ADJUST_CHECKSUM(accumulate, ic->icmp_cksum); -/* Alias sequence number */ + /* Alias sequence number */ ic->icmp_id = alias_id; -/* Change source address */ + /* Change source address */ { struct in_addr alias_address; @@ -519,13 +516,13 @@ IcmpAliasOut1(struct libalias *la, struct ip *pip, int create) return (PKT_ALIAS_IGNORED); } -static int -IcmpAliasOut2(struct libalias *la, struct ip *pip) -{ /* Alias outgoing ICMP error messages containing IP header and first 64 bits of datagram. */ +static int +IcmpAliasOut2(struct libalias *la, struct ip *pip) +{ struct ip *ip; struct icmp *ic, *ic2; struct udphdr *ud; @@ -565,24 +562,24 @@ IcmpAliasOut2(struct libalias *la, struct ip *pip) alias_address = GetAliasAddress(lnk); alias_port = GetAliasPort(lnk); -/* Adjust ICMP checksum */ + /* Adjust ICMP checksum */ accumulate = twowords(&ip->ip_dst); accumulate -= twowords(&alias_address); accumulate += ud->uh_dport; accumulate -= alias_port; ADJUST_CHECKSUM(accumulate, ic->icmp_cksum); -/* - * Alias address in IP header if it comes from the host - * the original TCP/UDP packet was destined for. - */ + /* + * Alias address in IP header if it comes from the host + * the original TCP/UDP packet was destined for. + */ if (pip->ip_src.s_addr == ip->ip_dst.s_addr) { DifferentialChecksum(&pip->ip_sum, &alias_address, &pip->ip_src, 2); pip->ip_src = alias_address; } -/* Alias address and port number of original IP packet -fragment contained in ICMP data section */ + /* Alias address and port number of original IP packet + * fragment contained in ICMP data section */ ip->ip_dst = alias_address; ud->uh_dport = alias_port; } else if (ip->ip_p == IPPROTO_ICMP) { @@ -593,24 +590,24 @@ fragment contained in ICMP data section */ alias_address = GetAliasAddress(lnk); alias_id = GetAliasPort(lnk); -/* Adjust ICMP checksum */ + /* Adjust ICMP checksum */ accumulate = twowords(&ip->ip_dst); accumulate -= twowords(&alias_address); accumulate += ic2->icmp_id; accumulate -= alias_id; ADJUST_CHECKSUM(accumulate, ic->icmp_cksum); -/* - * Alias address in IP header if it comes from the host - * the original ICMP message was destined for. - */ + /* + * Alias address in IP header if it comes from the host + * the original ICMP message was destined for. + */ if (pip->ip_src.s_addr == ip->ip_dst.s_addr) { DifferentialChecksum(&pip->ip_sum, &alias_address, &pip->ip_src, 2); pip->ip_src = alias_address; } -/* Alias address of original IP packet and sequence number of - embedded ICMP datagram */ + /* Alias address of original IP packet and + * sequence number of embedded ICMP datagram */ ip->ip_dst = alias_address; ic2->icmp_id = alias_id; } @@ -628,7 +625,7 @@ IcmpAliasOut(struct libalias *la, struct ip *pip, int create) LIBALIAS_LOCK_ASSERT(la); (void)create; -/* Return if proxy-only mode is enabled */ + /* Return if proxy-only mode is enabled */ if (la->packetAliasMode & PKT_ALIAS_PROXY_ONLY) return (PKT_ALIAS_OK); @@ -655,20 +652,20 @@ IcmpAliasOut(struct libalias *la, struct ip *pip, int create) return (iresult); } -static int -ProtoAliasIn(struct libalias *la, struct in_addr ip_src, - struct ip *pip, u_char ip_p, u_short *ip_sum) -{ /* Handle incoming IP packets. The only thing which is done in this case is to alias the dest IP address of the packet to our inside machine. */ +static int +ProtoAliasIn(struct libalias *la, struct in_addr ip_src, + struct ip *pip, u_char ip_p, u_short *ip_sum) +{ struct alias_link *lnk; LIBALIAS_LOCK_ASSERT(la); -/* Return if proxy-only mode is enabled */ + /* Return if proxy-only mode is enabled */ if (la->packetAliasMode & PKT_ALIAS_PROXY_ONLY) return (PKT_ALIAS_OK); @@ -678,7 +675,7 @@ ProtoAliasIn(struct libalias *la, struct in_addr ip_src, original_address = GetOriginalAddress(lnk); -/* Restore original IP address */ + /* Restore original IP address */ DifferentialChecksum(ip_sum, &original_address, &pip->ip_dst, 2); pip->ip_dst = original_address; @@ -688,20 +685,20 @@ ProtoAliasIn(struct libalias *la, struct in_addr ip_src, return (PKT_ALIAS_IGNORED); } -static int -ProtoAliasOut(struct libalias *la, struct ip *pip, - struct in_addr ip_dst, u_char ip_p, u_short *ip_sum, int create) -{ /* Handle outgoing IP packets. The only thing which is done in this case is to alias the source IP address of the packet. */ +static int +ProtoAliasOut(struct libalias *la, struct ip *pip, + struct in_addr ip_dst, u_char ip_p, u_short *ip_sum, int create) +{ struct alias_link *lnk; LIBALIAS_LOCK_ASSERT(la); -/* Return if proxy-only mode is enabled */ + /* Return if proxy-only mode is enabled */ if (la->packetAliasMode & PKT_ALIAS_PROXY_ONLY) return (PKT_ALIAS_OK); @@ -714,7 +711,7 @@ ProtoAliasOut(struct libalias *la, struct ip *pip, alias_address = GetAliasAddress(lnk); -/* Change source address */ + /* Change source address */ DifferentialChecksum(ip_sum, &alias_address, &pip->ip_src, 2); pip->ip_src = alias_address; @@ -753,8 +750,8 @@ UdpAliasIn(struct libalias *la, struct ip *pip) int accumulate; int error; struct alias_data ad = { - .lnk = lnk, - .oaddr = &original_address, + .lnk = lnk, + .oaddr = &original_address, .aaddr = &alias_address, .aport = &alias_port, .sport = &ud->uh_sport, @@ -769,46 +766,48 @@ UdpAliasIn(struct libalias *la, struct ip *pip) ud->uh_dport = GetOriginalPort(lnk); proxy_port = GetProxyPort(lnk); - /* Walk out chain. */ + /* Walk out chain. */ error = find_handler(IN, UDP, la, pip, &ad); /* If we cannot figure out the packet, ignore it. */ if (error < 0) return (PKT_ALIAS_IGNORED); -/* If UDP checksum is not zero, then adjust since destination port */ -/* is being unaliased and destination address is being altered. */ + /* If UDP checksum is not zero, then adjust since + * destination port is being unaliased and + * destination address is being altered. */ if (ud->uh_sum != 0) { accumulate = alias_port; accumulate -= ud->uh_dport; accumulate += twowords(&alias_address); accumulate -= twowords(&original_address); -/* If this is a proxy packet, modify checksum because of source change.*/ - if (proxy_port != 0) { - accumulate += ud->uh_sport; - accumulate -= proxy_port; - } + /* If this is a proxy packet, modify checksum + * because of source change.*/ + if (proxy_port != 0) { + accumulate += ud->uh_sport; + accumulate -= proxy_port; + } - if (proxy_address.s_addr != 0) { + if (proxy_address.s_addr != 0) { accumulate += twowords(&pip->ip_src); accumulate -= twowords(&proxy_address); - } + } ADJUST_CHECKSUM(accumulate, ud->uh_sum); } -/* XXX: Could the two if's below be concatenated to one ? */ -/* Restore source port and/or address in case of proxying*/ - if (proxy_port != 0) - ud->uh_sport = proxy_port; + /* XXX: Could the two if's below be concatenated to one ? */ + /* Restore source port and/or address in case of proxying*/ + if (proxy_port != 0) + ud->uh_sport = proxy_port; - if (proxy_address.s_addr != 0) { - DifferentialChecksum(&pip->ip_sum, - &proxy_address, &pip->ip_src, 2); - pip->ip_src = proxy_address; - } + if (proxy_address.s_addr != 0) { + DifferentialChecksum(&pip->ip_sum, + &proxy_address, &pip->ip_src, 2); + pip->ip_src = proxy_address; + } -/* Restore original IP address */ + /* Restore original IP address */ DifferentialChecksum(&pip->ip_sum, &original_address, &pip->ip_dst, 2); pip->ip_dst = original_address; @@ -833,7 +832,7 @@ UdpAliasOut(struct libalias *la, struct ip *pip, int maxpacketsize, int create) LIBALIAS_LOCK_ASSERT(la); -/* Return if proxy-only mode is enabled and not proxyrule found.*/ + /* Return if proxy-only mode is enabled and not proxyrule found.*/ dlen = ntohs(pip->ip_len) - (pip->ip_hl << 2); if (dlen < sizeof(struct udphdr)) return (PKT_ALIAS_IGNORED); @@ -842,34 +841,33 @@ UdpAliasOut(struct libalias *la, struct ip *pip, int maxpacketsize, int create) if (dlen < ntohs(ud->uh_ulen)) return (PKT_ALIAS_IGNORED); - proxy_type = ProxyCheck(la, &proxy_server_address, - &proxy_server_port, pip->ip_src, pip->ip_dst, - ud->uh_dport, pip->ip_p); + proxy_type = ProxyCheck(la, &proxy_server_address, &proxy_server_port, + pip->ip_src, pip->ip_dst, ud->uh_dport, pip->ip_p); if (proxy_type == 0 && (la->packetAliasMode & PKT_ALIAS_PROXY_ONLY)) return (PKT_ALIAS_OK); -/* If this is a transparent proxy, save original destination, - * then alter the destination and adjust checksums */ + /* If this is a transparent proxy, save original destination, + * then alter the destination and adjust checksums */ dest_port = ud->uh_dport; dest_address = pip->ip_dst; if (proxy_type != 0) { - int accumulate; + int accumulate; accumulate = twowords(&pip->ip_dst); accumulate -= twowords(&proxy_server_address); - ADJUST_CHECKSUM(accumulate, pip->ip_sum); + ADJUST_CHECKSUM(accumulate, pip->ip_sum); if (ud->uh_sum != 0) { accumulate = twowords(&pip->ip_dst); accumulate -= twowords(&proxy_server_address); - accumulate += ud->uh_dport; - accumulate -= proxy_server_port; - ADJUST_CHECKSUM(accumulate, ud->uh_sum); + accumulate += ud->uh_dport; + accumulate -= proxy_server_port; + ADJUST_CHECKSUM(accumulate, ud->uh_sum); } - pip->ip_dst = proxy_server_address; - ud->uh_dport = proxy_server_port; + pip->ip_dst = proxy_server_address; + ud->uh_dport = proxy_server_port; } lnk = FindUdpTcpOut(la, pip->ip_src, pip->ip_dst, ud->uh_sport, ud->uh_dport, @@ -878,7 +876,7 @@ UdpAliasOut(struct libalias *la, struct ip *pip, int maxpacketsize, int create) u_short alias_port; struct in_addr alias_address; struct alias_data ad = { - .lnk = lnk, + .lnk = lnk, .oaddr = NULL, .aaddr = &alias_address, .aport = &alias_port, @@ -887,24 +885,24 @@ UdpAliasOut(struct libalias *la, struct ip *pip, int maxpacketsize, int create) .maxpktsize = 0 }; -/* Save original destination address, if this is a proxy packet. - * Also modify packet to include destination encoding. This may - * change the size of IP header. */ + /* Save original destination address, if this is a proxy packet. + * Also modify packet to include destination encoding. This may + * change the size of IP header. */ if (proxy_type != 0) { - SetProxyPort(lnk, dest_port); - SetProxyAddress(lnk, dest_address); - ProxyModify(la, lnk, pip, maxpacketsize, proxy_type); - ud = (struct udphdr *)ip_next(pip); - } + SetProxyPort(lnk, dest_port); + SetProxyAddress(lnk, dest_address); + ProxyModify(la, lnk, pip, maxpacketsize, proxy_type); + ud = (struct udphdr *)ip_next(pip); + } alias_address = GetAliasAddress(lnk); alias_port = GetAliasPort(lnk); - /* Walk out chain. */ + /* Walk out chain. */ error = find_handler(OUT, UDP, la, pip, &ad); -/* If UDP checksum is not zero, adjust since source port is */ -/* being aliased and source address is being altered */ + /* If UDP checksum is not zero, adjust since source port is */ + /* being aliased and source address is being altered */ if (ud->uh_sum != 0) { int accumulate; @@ -914,10 +912,10 @@ UdpAliasOut(struct libalias *la, struct ip *pip, int maxpacketsize, int create) accumulate -= twowords(&alias_address); ADJUST_CHECKSUM(accumulate, ud->uh_sum); } -/* Put alias port in UDP header */ + /* Put alias port in UDP header */ ud->uh_sport = alias_port; -/* Change source address */ + /* Change source address */ DifferentialChecksum(&pip->ip_sum, &alias_address, &pip->ip_src, 2); pip->ip_src = alias_address; @@ -953,14 +951,14 @@ TcpAliasIn(struct libalias *la, struct ip *pip) u_short proxy_port; int accumulate, error; - /* - * The init of MANY vars is a bit below, but aliashandlepptpin + /* + * The init of MANY vars is a bit below, but aliashandlepptpin * seems to need the destination port that came within the * packet and not the original one looks below [*]. */ struct alias_data ad = { - .lnk = lnk, + .lnk = lnk, .oaddr = NULL, .aaddr = NULL, .aport = NULL, @@ -969,7 +967,7 @@ TcpAliasIn(struct libalias *la, struct ip *pip) .maxpktsize = 0 }; - /* Walk out chain. */ + /* Walk out chain. */ error = find_handler(IN, TCP, la, pip, &ad); alias_address = GetAliasAddress(lnk); @@ -979,8 +977,8 @@ TcpAliasIn(struct libalias *la, struct ip *pip) tc->th_dport = GetOriginalPort(lnk); proxy_port = GetProxyPort(lnk); - /* - * Look above, if anyone is going to add find_handler AFTER + /* + * Look above, if anyone is going to add find_handler AFTER * this aliashandlepptpin/point, please redo alias_data too. * Uncommenting the piece here below should be enough. */ @@ -994,22 +992,22 @@ TcpAliasIn(struct libalias *la, struct ip *pip) .dport = &ud->uh_dport, .maxpktsize = 0 }; - + /* Walk out chain. */ error = find_handler(la, pip, &ad); if (error == EHDNOF) printf("Protocol handler not found\n"); #endif -/* Adjust TCP checksum since destination port is being unaliased */ -/* and destination port is being altered. */ + /* Adjust TCP checksum since destination port is being + * unaliased and destination port is being altered. */ accumulate = alias_port; accumulate -= tc->th_dport; accumulate += twowords(&alias_address); accumulate -= twowords(&original_address); -/* If this is a proxy, then modify the TCP source port and - checksum accumulation */ + /* If this is a proxy, then modify the TCP source port + * and checksum accumulation */ if (proxy_port != 0) { accumulate += tc->th_sport; tc->th_sport = proxy_port; @@ -1017,7 +1015,7 @@ TcpAliasIn(struct libalias *la, struct ip *pip) accumulate += twowords(&pip->ip_src); accumulate -= twowords(&proxy_address); } -/* See if ACK number needs to be modified */ + /* See if ACK number needs to be modified */ if (GetAckModified(lnk) == 1) { int delta; @@ -1031,13 +1029,13 @@ TcpAliasIn(struct libalias *la, struct ip *pip) } ADJUST_CHECKSUM(accumulate, tc->th_sum); -/* Restore original IP address */ + /* Restore original IP address */ accumulate = twowords(&pip->ip_dst); pip->ip_dst = original_address; accumulate -= twowords(&pip->ip_dst); -/* If this is a transparent proxy packet, then modify the source - address */ + /* If this is a transparent proxy packet, + * then modify the source address */ if (proxy_address.s_addr != 0) { accumulate += twowords(&pip->ip_src); pip->ip_src = proxy_address; @@ -1045,7 +1043,7 @@ TcpAliasIn(struct libalias *la, struct ip *pip) } ADJUST_CHECKSUM(accumulate, pip->ip_sum); -/* Monitor TCP connection state */ + /* Monitor TCP connection state */ tc = (struct tcphdr *)ip_next(pip); TcpMonitorIn(tc->th_flags, lnk); @@ -1074,8 +1072,8 @@ TcpAliasOut(struct libalias *la, struct ip *pip, int maxpacketsize, int create) tc = (struct tcphdr *)ip_next(pip); if (create) - proxy_type = ProxyCheck(la, &proxy_server_address, - &proxy_server_port, pip->ip_src, pip->ip_dst, + proxy_type = ProxyCheck(la, &proxy_server_address, + &proxy_server_port, pip->ip_src, pip->ip_dst, tc->th_dport, pip->ip_p); else proxy_type = 0; @@ -1083,8 +1081,8 @@ TcpAliasOut(struct libalias *la, struct ip *pip, int maxpacketsize, int create) if (proxy_type == 0 && (la->packetAliasMode & PKT_ALIAS_PROXY_ONLY)) return (PKT_ALIAS_OK); -/* If this is a transparent proxy, save original destination, - then alter the destination and adjust checksums */ + /* If this is a transparent proxy, save original destination, + * then alter the destination and adjust checksums */ dest_port = tc->th_dport; dest_address = pip->ip_dst; if (proxy_type != 0) { @@ -1112,7 +1110,7 @@ TcpAliasOut(struct libalias *la, struct ip *pip, int maxpacketsize, int create) struct in_addr alias_address; int accumulate; struct alias_data ad = { - .lnk = lnk, + .lnk = lnk, .oaddr = NULL, .aaddr = &alias_address, .aport = &alias_port, @@ -1121,38 +1119,38 @@ TcpAliasOut(struct libalias *la, struct ip *pip, int maxpacketsize, int create) .maxpktsize = maxpacketsize }; -/* Save original destination address, if this is a proxy packet. - Also modify packet to include destination encoding. This may - change the size of IP header. */ + /* Save original destination address, if this is a proxy packet. + * Also modify packet to include destination + * encoding. This may change the size of IP header. */ if (proxy_type != 0) { SetProxyPort(lnk, dest_port); SetProxyAddress(lnk, dest_address); ProxyModify(la, lnk, pip, maxpacketsize, proxy_type); tc = (struct tcphdr *)ip_next(pip); } -/* Get alias address and port */ + /* Get alias address and port */ alias_port = GetAliasPort(lnk); alias_address = GetAliasAddress(lnk); -/* Monitor TCP connection state */ + /* Monitor TCP connection state */ tc = (struct tcphdr *)ip_next(pip); TcpMonitorOut(tc->th_flags, lnk); - - /* Walk out chain. */ + + /* Walk out chain. */ error = find_handler(OUT, TCP, la, pip, &ad); -/* Adjust TCP checksum since source port is being aliased */ -/* and source address is being altered */ + /* Adjust TCP checksum since source port is being aliased + * and source address is being altered */ accumulate = tc->th_sport; tc->th_sport = alias_port; accumulate -= tc->th_sport; accumulate += twowords(&pip->ip_src); accumulate -= twowords(&alias_address); -/* Modify sequence number if necessary */ + /* Modify sequence number if necessary */ if (GetAckModified(lnk) == 1) { int delta; - + tc = (struct tcphdr *)ip_next(pip); delta = GetDeltaSeqOut(tc->th_seq, lnk); if (delta != 0) { @@ -1163,7 +1161,7 @@ TcpAliasOut(struct libalias *la, struct ip *pip, int maxpacketsize, int create) } ADJUST_CHECKSUM(accumulate, tc->th_sum); -/* Change source address */ + /* Change source address */ accumulate = twowords(&pip->ip_src); pip->ip_src = alias_address; accumulate -= twowords(&pip->ip_src); @@ -1259,7 +1257,7 @@ LibAliasSaveFragment(struct libalias *la, void *ptr) return (iresult); } -void * +void * LibAliasGetFragment(struct libalias *la, void *ptr) { struct alias_link *lnk; @@ -1273,7 +1271,7 @@ LibAliasGetFragment(struct libalias *la, void *ptr) GetFragmentPtr(lnk, &fptr); SetFragmentPtr(lnk, NULL); SetExpire(lnk, 0); /* Deletes link */ - } else + } else fptr = NULL; LIBALIAS_UNLOCK(la); @@ -1281,11 +1279,9 @@ LibAliasGetFragment(struct libalias *la, void *ptr) } void -LibAliasFragmentIn(struct libalias *la, void *ptr, /* Points to correctly - * de-aliased header - * fragment */ - void *ptr_fragment /* Points to fragment which must be - * de-aliased */ +LibAliasFragmentIn(struct libalias *la, + void *ptr, /* Points to correctly de-aliased header fragment */ + void *ptr_fragment /* fragment which must be de-aliased */ ) { struct ip *pip; @@ -1305,10 +1301,10 @@ LibAliasFragmentIn(struct libalias *la, void *ptr, /* Points to correctly /* Local prototypes */ static int LibAliasOutLocked(struct libalias *la, struct ip *pip, - int maxpacketsize, int create); + int maxpacketsize, int create); static int LibAliasInLocked(struct libalias *la, struct ip *pip, - int maxpacketsize); + int maxpacketsize); int LibAliasIn(struct libalias *la, void *ptr, int maxpacketsize) @@ -1340,7 +1336,7 @@ LibAliasInLocked(struct libalias *la, struct ip *pip, int maxpacketsize) /* Defense against mangled packets */ if (ntohs(pip->ip_len) > maxpacketsize || (pip->ip_hl << 2) > maxpacketsize) { - iresult = PKT_ALIAS_IGNORED; + iresult = PKT_ALIAS_IGNORED; goto getout; } @@ -1358,30 +1354,30 @@ LibAliasInLocked(struct libalias *la, struct ip *pip, int maxpacketsize) break; #ifdef _KERNEL case IPPROTO_SCTP: - iresult = SctpAlias(la, pip, SN_TO_LOCAL); + iresult = SctpAlias(la, pip, SN_TO_LOCAL); break; #endif - case IPPROTO_GRE: { + case IPPROTO_GRE: { int error; struct alias_data ad = { - .lnk = NULL, - .oaddr = NULL, + .lnk = NULL, + .oaddr = NULL, .aaddr = NULL, .aport = NULL, .sport = NULL, .dport = NULL, - .maxpktsize = 0 + .maxpktsize = 0 }; - - /* Walk out chain. */ + + /* Walk out chain. */ error = find_handler(IN, IP, la, pip, &ad); - if (error == 0) + if (error == 0) iresult = PKT_ALIAS_OK; else iresult = ProtoAliasIn(la, pip->ip_src, pip, pip->ip_p, &pip->ip_sum); + break; } - break; default: iresult = ProtoAliasIn(la, pip->ip_src, pip, pip->ip_p, &pip->ip_sum); @@ -1449,10 +1445,10 @@ LibAliasOutTry(struct libalias *la, void *ptr, int maxpacketsize, int create) } static int -LibAliasOutLocked(struct libalias *la, struct ip *pip, /* valid IP packet */ - int maxpacketsize, /* How much the packet data may grow (FTP - * and IRC inline changes) */ - int create /* Create new entries ? */ +LibAliasOutLocked(struct libalias *la, + struct ip *pip, /* valid IP packet */ + int maxpacketsize, /* How much the packet data may grow (FTP and IRC inline changes) */ + int create /* Create new entries ? */ ) { int iresult; @@ -1512,29 +1508,29 @@ LibAliasOutLocked(struct libalias *la, struct ip *pip, /* valid IP packet */ break; #ifdef _KERNEL case IPPROTO_SCTP: - iresult = SctpAlias(la, pip, SN_TO_GLOBAL); + iresult = SctpAlias(la, pip, SN_TO_GLOBAL); break; #endif case IPPROTO_GRE: { int error; struct alias_data ad = { - .lnk = NULL, - .oaddr = NULL, + .lnk = NULL, + .oaddr = NULL, .aaddr = NULL, .aport = NULL, .sport = NULL, .dport = NULL, - .maxpktsize = 0 + .maxpktsize = 0 }; - /* Walk out chain. */ + /* Walk out chain. */ error = find_handler(OUT, IP, la, pip, &ad); if (error == 0) - iresult = PKT_ALIAS_OK; - else + iresult = PKT_ALIAS_OK; + else iresult = ProtoAliasOut(la, pip, pip->ip_dst, pip->ip_p, &pip->ip_sum, create); + break; } - break; default: iresult = ProtoAliasOut(la, pip, pip->ip_dst, pip->ip_p, &pip->ip_sum, create); @@ -1550,8 +1546,9 @@ getout: } int -LibAliasUnaliasOut(struct libalias *la, void *ptr, /* valid IP packet */ - int maxpacketsize /* for error checking */ +LibAliasUnaliasOut(struct libalias *la, + void *ptr, /* valid IP packet */ + int maxpacketsize /* for error checking */ ) { struct ip *pip; @@ -1623,7 +1620,6 @@ LibAliasUnaliasOut(struct libalias *la, void *ptr, /* valid IP packet */ tc->th_sport = original_port; iresult = PKT_ALIAS_OK; - } else if (pip->ip_p == IPPROTO_ICMP) { int accumulate; struct in_addr original_address; @@ -1653,7 +1649,6 @@ LibAliasUnaliasOut(struct libalias *la, void *ptr, /* valid IP packet */ getout: LIBALIAS_UNLOCK(la); return (iresult); - } #ifndef _KERNEL @@ -1673,8 +1668,8 @@ LibAliasRefreshModules(void) for (;;) { fgets(buf, 256, fd); - if (feof(fd)) - break; + if (feof(fd)) + break; len = strlen(buf); if (len > 1) { for (i = 0; i < len; i++) @@ -1696,20 +1691,20 @@ LibAliasLoadModule(char *path) struct dll *t; void *handle; struct proto_handler *m; - const char *error; + const char *error; moduledata_t *p; - handle = dlopen (path, RTLD_LAZY); - if (!handle) { + handle = dlopen (path, RTLD_LAZY); *** 4297 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Sat May 15 07:08:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A471C63C0B7; Sat, 15 May 2021 07:08:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FhxMV4C3Nz4qwN; Sat, 15 May 2021 07:08:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 789372131E; Sat, 15 May 2021 07:08:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14F78sIO086292; Sat, 15 May 2021 07:08:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14F78s3J086291; Sat, 15 May 2021 07:08:54 GMT (envelope-from git) Date: Sat, 15 May 2021 07:08:54 GMT Message-Id: <202105150708.14F78s3J086291@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: 189f8eea138a - main - libalias: replace placeholder with static constant MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 189f8eea138a78b09c9f19114b1362b0df1cf87d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2021 07:08:54 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=189f8eea138a78b09c9f19114b1362b0df1cf87d commit 189f8eea138a78b09c9f19114b1362b0df1cf87d Author: Lutz Donnerhacke AuthorDate: 2021-05-13 21:47:57 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-15 07:05:30 +0000 libalias: replace placeholder with static constant The field nullAddress in struct libalias is never set and never used. It exists as a placeholder for an unused argument only. Reviewed by: hselasky MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30253 --- sys/netinet/libalias/alias_db.c | 24 ++++++++++++++---------- sys/netinet/libalias/alias_local.h | 2 -- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index cd29c16ac945..518f221c63f9 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -224,6 +224,10 @@ static LIST_HEAD(, libalias) instancehead = LIST_HEAD_INITIALIZER(instancehead); #define NO_DEST_PORT 1 #define NO_SRC_PORT 1 +/* Dummy address used for FindLinkIn/Out() and AddLink(). + The value of this variable is never used. */ +static struct in_addr const NO_ADDR; + /* Data Structures The fundamental data structure used in this program is @@ -1111,12 +1115,12 @@ _FindLinkOut(struct libalias *la, struct in_addr src_addr, lnk = _FindLinkOut(la, src_addr, dst_addr, src_port, 0, link_type, 0); if (lnk == NULL) - lnk = _FindLinkOut(la, src_addr, la->nullAddress, src_port, + lnk = _FindLinkOut(la, src_addr, NO_ADDR, src_port, dst_port, link_type, 0); } if (lnk == NULL && (dst_port != 0 || dst_addr.s_addr != INADDR_ANY)) { - lnk = _FindLinkOut(la, src_addr, la->nullAddress, src_port, 0, + lnk = _FindLinkOut(la, src_addr, NO_ADDR, src_port, 0, link_type, 0); } if (lnk != NULL) { @@ -1152,7 +1156,7 @@ FindLinkOut(struct libalias *la, struct in_addr src_addr, */ if (la->aliasAddress.s_addr != INADDR_ANY && src_addr.s_addr == la->aliasAddress.s_addr) { - lnk = _FindLinkOut(la, la->nullAddress, dst_addr, src_port, dst_port, + lnk = _FindLinkOut(la, NO_ADDR, dst_addr, src_port, dst_port, link_type, replace_partial_links); } } @@ -1294,7 +1298,7 @@ FindLinkIn(struct libalias *la, struct in_addr dst_addr, */ if (la->aliasAddress.s_addr != INADDR_ANY && alias_addr.s_addr == la->aliasAddress.s_addr) { - lnk = _FindLinkIn(la, dst_addr, la->nullAddress, dst_port, alias_port, + lnk = _FindLinkIn(la, dst_addr, NO_ADDR, dst_port, alias_port, link_type, replace_partial_links); } } @@ -1376,7 +1380,7 @@ FindFragmentIn1(struct libalias *la, struct in_addr dst_addr, LINK_FRAGMENT_ID, 0); if (lnk == NULL) { - lnk = AddLink(la, la->nullAddress, dst_addr, alias_addr, + lnk = AddLink(la, NO_ADDR, dst_addr, alias_addr, NO_SRC_PORT, NO_DEST_PORT, ip_id, LINK_FRAGMENT_ID); } @@ -1399,7 +1403,7 @@ AddFragmentPtrLink(struct libalias *la, struct in_addr dst_addr, u_short ip_id) { LIBALIAS_LOCK_ASSERT(la); - return AddLink(la, la->nullAddress, dst_addr, la->nullAddress, + return AddLink(la, NO_ADDR, dst_addr, NO_ADDR, NO_SRC_PORT, NO_DEST_PORT, ip_id, LINK_FRAGMENT_PTR); } @@ -1409,7 +1413,7 @@ FindFragmentPtr(struct libalias *la, struct in_addr dst_addr, u_short ip_id) { LIBALIAS_LOCK_ASSERT(la); - return FindLinkIn(la, dst_addr, la->nullAddress, + return FindLinkIn(la, dst_addr, NO_ADDR, NO_DEST_PORT, ip_id, LINK_FRAGMENT_PTR, 0); } @@ -1669,7 +1673,7 @@ FindOriginalAddress(struct libalias *la, struct in_addr alias_addr) struct alias_link *lnk; LIBALIAS_LOCK_ASSERT(la); - lnk = FindLinkIn(la, la->nullAddress, alias_addr, + lnk = FindLinkIn(la, NO_ADDR, alias_addr, 0, 0, LINK_ADDR, 0); if (lnk == NULL) { la->newDefaultLink = 1; @@ -1701,7 +1705,7 @@ FindAliasAddress(struct libalias *la, struct in_addr original_addr) struct alias_link *lnk; LIBALIAS_LOCK_ASSERT(la); - lnk = FindLinkOut(la, original_addr, la->nullAddress, + lnk = FindLinkOut(la, original_addr, NO_ADDR, 0, 0, LINK_ADDR, 0); if (lnk == NULL) { return (la->aliasAddress.s_addr != INADDR_ANY) ? @@ -2317,7 +2321,7 @@ LibAliasRedirectAddr(struct libalias *la, struct in_addr src_addr, struct alias_link *lnk; LIBALIAS_LOCK(la); - lnk = AddLink(la, src_addr, la->nullAddress, alias_addr, + lnk = AddLink(la, src_addr, NO_ADDR, alias_addr, 0, 0, 0, LINK_ADDR); diff --git a/sys/netinet/libalias/alias_local.h b/sys/netinet/libalias/alias_local.h index e6374a72ef75..63bfd857f14f 100644 --- a/sys/netinet/libalias/alias_local.h +++ b/sys/netinet/libalias/alias_local.h @@ -89,8 +89,6 @@ struct libalias { /* IP address incoming packets are sent to * if no aliasing link already exists */ struct in_addr targetAddress; - /* Used as a dummy parameter for some function calls */ - struct in_addr nullAddress; /* Lookup table of pointers to chains of link records. * Each link record is doubly indexed into input and * output lookup tables. */ From owner-dev-commits-src-main@freebsd.org Sat May 15 11:05:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E94C5642410; Sat, 15 May 2021 11:05:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fj2cs6Fw0z3rsW; Sat, 15 May 2021 11:05:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF53524652; Sat, 15 May 2021 11:05:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14FB5nec005916; Sat, 15 May 2021 11:05:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14FB5nv7005915; Sat, 15 May 2021 11:05:49 GMT (envelope-from git) Date: Sat, 15 May 2021 11:05:49 GMT Message-Id: <202105151105.14FB5nv7005915@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 3394d4239b85 - main - cam: allocate CCBs from UMA for SCSI and ATA IO MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3394d4239b85b5577845d9e6de4e97b18d3dba58 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2021 11:05:50 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=3394d4239b85b5577845d9e6de4e97b18d3dba58 commit 3394d4239b85b5577845d9e6de4e97b18d3dba58 Author: Edward Tomasz Napierala AuthorDate: 2021-05-15 10:17:22 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-15 11:03:49 +0000 cam: allocate CCBs from UMA for SCSI and ATA IO This patch makes it possible for CAM to use small CCBs allocated from an periph-specific UMA zone instead of the usual, huge ones. The end result is that CCBs issued via da(4) take 544B (size of ccb_scsiio) instead of the usual 2kB (size of 'union ccb', ~1.5kB, rounded up by malloc(9)). For ATA it's 272B. We waste less memory, we avoid zeroing the unused 1kB, and it should be easier to allocate those CCBs in low memory conditions. It should also be possible to use uma_zone_reserve(9) to improve behaviour in low memory conditions even further. Note that this does not change the size, or the layout, of CCBs as such. CCBs get allocated in various different ways, in particular on the stack, and I don't want to redo all that. Instead, this provides an opt-in mechanism for the periph to declare "my start() callback is fine with receiving a CCB allocated from this UMA zone". In other words, most of the code works exactly as it used to; the change only happens to IOs issued by xpt_run_allockq(), which is - conveniently - pretty much all that matters for performance. The reason for doing it this way is that it's pretty small, localized change, and can be implemented gradually and iteratively: take a periph, make sure its start() callback only casts the CCBs it takes to a particular type of CCB, for example ccb_scsiio, and that it only casts CCBs returned by cam_periph_getccb() to that type, then add UMA zone for that size, and declare it safe to XPT. This is disabled by default. Set 'kern.cam.ada.enable_uma_ccbs=1' and 'kern.cam.da.enable_uma_ccbs=1' tunables to enable it. Testing is welcome; I will flip the default to enable in two weeks from now. Reviewed By: imp Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D28674 --- sys/cam/ata/ata_da.c | 18 ++++++++++++++++++ sys/cam/ata/ata_xpt.c | 7 +++++++ sys/cam/cam_ccb.h | 14 +++++++++++++- sys/cam/cam_periph.h | 3 +++ sys/cam/cam_xpt.c | 32 +++++++++++++++++++++++++++++--- sys/cam/scsi/scsi_da.c | 18 ++++++++++++++++++ sys/cam/scsi/scsi_xpt.c | 7 +++++++ 7 files changed, 95 insertions(+), 4 deletions(-) diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c index c29235e64e81..a8b67b2254a6 100644 --- a/sys/cam/ata/ata_da.c +++ b/sys/cam/ata/ata_da.c @@ -297,6 +297,8 @@ struct ada_softc { char announce_buffer[ADA_ANNOUNCE_SZ]; }; +static uma_zone_t ada_ccb_zone; + struct ada_quirk_entry { struct scsi_inquiry_pattern inq_pat; ada_quirks quirks; @@ -902,6 +904,7 @@ static int ada_spindown_suspend = ADA_DEFAULT_SPINDOWN_SUSPEND; static int ada_read_ahead = ADA_DEFAULT_READ_AHEAD; static int ada_write_cache = ADA_DEFAULT_WRITE_CACHE; static int ada_enable_biospeedup = 1; +static int ada_enable_uma_ccbs = 0; static SYSCTL_NODE(_kern_cam, OID_AUTO, ada, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "CAM Direct Access Disk driver"); @@ -921,6 +924,8 @@ SYSCTL_INT(_kern_cam_ada, OID_AUTO, write_cache, CTLFLAG_RWTUN, &ada_write_cache, 0, "Enable disk write cache"); SYSCTL_INT(_kern_cam_ada, OID_AUTO, enable_biospeedup, CTLFLAG_RDTUN, &ada_enable_biospeedup, 0, "Enable BIO_SPEEDUP processing"); +SYSCTL_INT(_kern_cam_ada, OID_AUTO, enable_uma_ccbs, CTLFLAG_RWTUN, + &ada_enable_uma_ccbs, 0, "Use UMA for CCBs"); /* * ADA_ORDEREDTAG_INTERVAL determines how often, relative @@ -1178,6 +1183,10 @@ adainit(void) { cam_status status; + ada_ccb_zone = uma_zcreate("ada_ccb", + sizeof(struct ccb_ataio), NULL, NULL, NULL, NULL, + UMA_ALIGN_PTR, 0); + /* * Install a global async callback. This callback will * receive async callbacks like "new device found". @@ -1855,6 +1864,15 @@ adaregister(struct cam_periph *periph, void *arg) "kern.cam.ada.%d.write_cache", periph->unit_number); TUNABLE_INT_FETCH(announce_buf, &softc->write_cache); + /* + * Let XPT know we can use UMA-allocated CCBs. + */ + if (ada_enable_uma_ccbs) { + KASSERT(ada_ccb_zone != NULL, + ("%s: NULL ada_ccb_zone", __func__)); + periph->ccb_zone = ada_ccb_zone; + } + /* * Set support flags based on the Identify data and quirks. */ diff --git a/sys/cam/ata/ata_xpt.c b/sys/cam/ata/ata_xpt.c index 0f94e556745a..c13c7b493c78 100644 --- a/sys/cam/ata/ata_xpt.c +++ b/sys/cam/ata/ata_xpt.c @@ -1795,6 +1795,13 @@ static void ata_action(union ccb *start_ccb) { + if (start_ccb->ccb_h.func_code != XPT_ATA_IO) { + KASSERT((start_ccb->ccb_h.alloc_flags & CAM_CCB_FROM_UMA) == 0, + ("%s: ccb %p, func_code %#x should not be allocated " + "from UMA zone\n", + __func__, start_ccb, start_ccb->ccb_h.func_code)); + } + switch (start_ccb->ccb_h.func_code) { case XPT_SET_TRAN_SETTINGS: { diff --git a/sys/cam/cam_ccb.h b/sys/cam/cam_ccb.h index 221b24a7c187..2545e40e192d 100644 --- a/sys/cam/cam_ccb.h +++ b/sys/cam/cam_ccb.h @@ -58,6 +58,12 @@ /* Struct definitions for CAM control blocks */ /* Common CCB header */ + +/* CCB memory allocation flags */ +typedef enum { + CAM_CCB_FROM_UMA = 0x00000001,/* CCB from a periph UMA zone */ +} ccb_alloc_flags; + /* CAM CCB flags */ typedef enum { CAM_CDB_POINTER = 0x00000001,/* The CDB field is a pointer */ @@ -341,7 +347,13 @@ struct ccb_hdr { camq_entry xpt_links; /* For chaining in the XPT layer */ camq_entry sim_links; /* For chaining in the SIM layer */ camq_entry periph_links; /* For chaining in the type driver */ - u_int32_t retry_count; +#if BYTE_ORDER == LITTLE_ENDIAN + u_int16_t retry_count; + u_int16_t alloc_flags; /* ccb_alloc_flags */ +#else + u_int16_t alloc_flags; /* ccb_alloc_flags */ + u_int16_t retry_count; +#endif void (*cbfcnp)(struct cam_periph *, union ccb *); /* Callback on completion function */ xpt_opcode func_code; /* XPT function code */ diff --git a/sys/cam/cam_periph.h b/sys/cam/cam_periph.h index 15a239decf0a..9c323394797c 100644 --- a/sys/cam/cam_periph.h +++ b/sys/cam/cam_periph.h @@ -42,6 +42,8 @@ #include #include +#include + #include struct devstat; @@ -147,6 +149,7 @@ struct cam_periph { ac_callback_t *deferred_callback; ac_code deferred_ac; struct task periph_run_task; + uma_zone_t ccb_zone; }; #define CAM_PERIPH_MAXMAPS 2 diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index b7bc2b74da6c..33361cfb68a5 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -4693,7 +4693,17 @@ xpt_alloc_ccb_nowait(void) void xpt_free_ccb(union ccb *free_ccb) { - free(free_ccb, M_CAMCCB); + struct cam_periph *periph; + + if (free_ccb->ccb_h.alloc_flags & CAM_CCB_FROM_UMA) { + /* + * Looks like a CCB allocated from a periph UMA zone. + */ + periph = free_ccb->ccb_h.path->periph; + uma_zfree(periph->ccb_zone, free_ccb); + } else { + free(free_ccb, M_CAMCCB); + } } /* Private XPT functions */ @@ -4707,10 +4717,18 @@ static union ccb * xpt_get_ccb_nowait(struct cam_periph *periph) { union ccb *new_ccb; + int alloc_flags; - new_ccb = malloc(sizeof(*new_ccb), M_CAMCCB, M_ZERO|M_NOWAIT); + if (periph->ccb_zone != NULL) { + alloc_flags = CAM_CCB_FROM_UMA; + new_ccb = uma_zalloc(periph->ccb_zone, M_ZERO|M_NOWAIT); + } else { + alloc_flags = 0; + new_ccb = malloc(sizeof(*new_ccb), M_CAMCCB, M_ZERO|M_NOWAIT); + } if (new_ccb == NULL) return (NULL); + new_ccb->ccb_h.alloc_flags = alloc_flags; periph->periph_allocated++; cam_ccbq_take_opening(&periph->path->device->ccbq); return (new_ccb); @@ -4720,9 +4738,17 @@ static union ccb * xpt_get_ccb(struct cam_periph *periph) { union ccb *new_ccb; + int alloc_flags; cam_periph_unlock(periph); - new_ccb = malloc(sizeof(*new_ccb), M_CAMCCB, M_ZERO|M_WAITOK); + if (periph->ccb_zone != NULL) { + alloc_flags = CAM_CCB_FROM_UMA; + new_ccb = uma_zalloc(periph->ccb_zone, M_ZERO|M_WAITOK); + } else { + alloc_flags = 0; + new_ccb = malloc(sizeof(*new_ccb), M_CAMCCB, M_ZERO|M_WAITOK); + } + new_ccb->ccb_h.alloc_flags = alloc_flags; cam_periph_lock(periph); periph->periph_allocated++; cam_ccbq_take_opening(&periph->path->device->ccbq); diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index baba5d9ed839..05dd9b6e7566 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -403,6 +403,8 @@ struct da_softc { softc->delete_available &= ~(1 << delete_method); \ } +static uma_zone_t da_ccb_zone; + struct da_quirk_entry { struct scsi_inquiry_pattern inq_pat; da_quirks quirks; @@ -1557,6 +1559,7 @@ static sbintime_t da_default_softtimeout = DA_DEFAULT_SOFTTIMEOUT; static int da_send_ordered = DA_DEFAULT_SEND_ORDERED; static int da_disable_wp_detection = 0; static int da_enable_biospeedup = 1; +static int da_enable_uma_ccbs = 0; static SYSCTL_NODE(_kern_cam, OID_AUTO, da, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "CAM Direct Access Disk driver"); @@ -1573,6 +1576,8 @@ SYSCTL_INT(_kern_cam_da, OID_AUTO, disable_wp_detection, CTLFLAG_RWTUN, "Disable detection of write-protected disks"); SYSCTL_INT(_kern_cam_da, OID_AUTO, enable_biospeedup, CTLFLAG_RDTUN, &da_enable_biospeedup, 0, "Enable BIO_SPEEDUP processing"); +SYSCTL_INT(_kern_cam_da, OID_AUTO, enable_uma_ccbs, CTLFLAG_RWTUN, + &da_enable_uma_ccbs, 0, "Use UMA for CCBs"); SYSCTL_PROC(_kern_cam_da, OID_AUTO, default_softtimeout, CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, NULL, 0, @@ -2011,6 +2016,10 @@ dainit(void) NULL, SHUTDOWN_PRI_DEFAULT)) == NULL) printf("dainit: shutdown event registration failed!\n"); } + + da_ccb_zone = uma_zcreate("da_ccb", + sizeof(struct ccb_scsiio), NULL, NULL, NULL, NULL, + UMA_ALIGN_PTR, 0); } /* @@ -2848,6 +2857,15 @@ daregister(struct cam_periph *periph, void *arg) TASK_INIT(&softc->sysctl_task, 0, dasysctlinit, periph); + /* + * Let XPT know we can use UMA-allocated CCBs. + */ + if (da_enable_uma_ccbs) { + KASSERT(da_ccb_zone != NULL, + ("%s: NULL da_ccb_zone", __func__)); + periph->ccb_zone = da_ccb_zone; + } + /* * Take an exclusive section lock on the periph while dastart is called * to finish the probe. The lock will be dropped in dadone at the end diff --git a/sys/cam/scsi/scsi_xpt.c b/sys/cam/scsi/scsi_xpt.c index 67b94488dff0..bdc23e4b51b7 100644 --- a/sys/cam/scsi/scsi_xpt.c +++ b/sys/cam/scsi/scsi_xpt.c @@ -2625,6 +2625,13 @@ static void scsi_action(union ccb *start_ccb) { + if (start_ccb->ccb_h.func_code != XPT_SCSI_IO) { + KASSERT((start_ccb->ccb_h.alloc_flags & CAM_CCB_FROM_UMA) == 0, + ("%s: ccb %p, func_code %#x should not be allocated " + "from UMA zone\n", + __func__, start_ccb, start_ccb->ccb_h.func_code)); + } + switch (start_ccb->ccb_h.func_code) { case XPT_SET_TRAN_SETTINGS: { From owner-dev-commits-src-main@freebsd.org Sat May 15 14:15:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E85CD646DDD; Sat, 15 May 2021 14:15:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fj6r86Fgqz4m5c; Sat, 15 May 2021 14:15:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BED6726870; Sat, 15 May 2021 14:15:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14FEFqxA057749; Sat, 15 May 2021 14:15:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14FEFqb8057748; Sat, 15 May 2021 14:15:52 GMT (envelope-from git) Date: Sat, 15 May 2021 14:15:52 GMT Message-Id: <202105151415.14FEFqb8057748@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 7fbc0c98a8ef - main - build(7): use a more relevant example for PORTS_MODULES MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7fbc0c98a8efaef86d72759372ec7746d929302e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2021 14:15:53 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=7fbc0c98a8efaef86d72759372ec7746d929302e commit 7fbc0c98a8efaef86d72759372ec7746d929302e Author: Mitchell Horne AuthorDate: 2021-05-15 14:14:52 +0000 Commit: Mitchell Horne CommitDate: 2021-05-15 14:15:25 +0000 build(7): use a more relevant example for PORTS_MODULES emulators/kqemu-kmod no longer exists in the ports tree. Reviewed by: imp, bcr Differential Revision: https://reviews.freebsd.org/D30261 --- share/man/man7/build.7 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/man/man7/build.7 b/share/man/man7/build.7 index 9591b0365307..62c24eaed0dc 100644 --- a/share/man/man7/build.7 +++ b/share/man/man7/build.7 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 28, 2021 +.Dd May 15, 2021 .Dt BUILD 7 .Os .Sh NAME @@ -602,7 +602,7 @@ and .Cm installkernel process. .Bd -literal -offset indent -make PORTS_MODULES=emulators/kqemu-kmod kernel +make PORTS_MODULES=emulators/virtualbox-ose-kmod kernel .Ed .It Va SRCCONF Specify a file to override the default From owner-dev-commits-src-main@freebsd.org Sat May 15 16:03:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0251B649BF1; Sat, 15 May 2021 16:03:04 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fj9Cq6Pj2z50lC; Sat, 15 May 2021 16:03:03 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: by mail-ed1-x52b.google.com with SMTP id di13so1935170edb.2; Sat, 15 May 2021 09:03:03 -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=0pYabJsDvhMWX7/rOW/ty1e+SB90zG7wjhk/p30gv58=; b=JncGC+LTZf8Q6vtIXuMyAADRPjyFs6KNuNpxQMqNXdMRYHvNrQ8kDAJlNUQaYS1CfV GhTRsLx/BYpjUMLTOEHKSsVPROShGSOol2ixQF26D08N3OBu/Tt2ZyHbaYdA3ZvATjmi I1xj17KcsTg0AoE7v5IdMQ2pXm+nlbQL4O82nd8kIFxYBM/lw9l38jpxsWjeqX7JynAR TTZjIFdeaROZdn8pTl7U4n6F4WJzT2irP32xpmZ93dCW+ime13uUulHVjleoJBneCcrL HfMo2I1AoNCyPNOa74k0gVKEJlELtzWjmk8mqNrby33nSVte90Y/K3I6gYqe+CB+IdGV A3pw== 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=0pYabJsDvhMWX7/rOW/ty1e+SB90zG7wjhk/p30gv58=; b=gvPhWAZPqgW8B8eLOsF9sPOshgorgIjtMYGSVhqBbVdeVduGCa71f/kI6gja6FlhQO RoQkdsNYnhAXKRtPY2bm3qGupLEK/NE2juYUZ26uYw4nBp/DgP9rPYcSuqhLv5XPw8jH cN7+AxE2OXQ1eg1NneNO5aIj2MU1wIBWCoDN1z1g3bh1MLKilHe54l06f/UMRkP3L/vo NNNMR5DhcJ8WvwbI8ikvDYhM2cnIQFPsGIPvUc6dXP5sMf7I7kf8BYjsFPFTCJLb1TNV Jvjn8ZfsQ/4bO1HR49c1gMd+1/ZT/CimTSAvaWQVC4B81FIeYw+X/uw3wrfPL642PnkV eA1Q== X-Gm-Message-State: AOAM533OAVFQeLmaTprog2k3xkECpZWp72dxeKHtj5aCv6s7RqIfPIzi M5F7EOgrDXDBWxx7QrMoYndyt+H+djo= X-Google-Smtp-Source: ABdhPJyPO/S76U+6lOZEhLkQhCbf5Lni3h+hXbbVxwmh8D6vQgb7zMHw1PLPnn13osYGDDgtNwTGeQ== X-Received: by 2002:aa7:d455:: with SMTP id q21mr12628496edr.2.1621094581860; Sat, 15 May 2021 09:03:01 -0700 (PDT) Received: from ernst.home (pd9e23d76.dip0.t-ipconnect.de. [217.226.61.118]) by smtp.gmail.com with ESMTPSA id bw26sm5526253ejb.119.2021.05.15.09.03.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 May 2021 09:03:00 -0700 (PDT) Date: Sat, 15 May 2021 18:03:00 +0200 From: Gary Jennejohn To: Edward Tomasz Napierala Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 3394d4239b85 - main - cam: allocate CCBs from UMA for SCSI and ATA IO Message-ID: <20210515160300.6d6d3916@ernst.home> In-Reply-To: <202105151105.14FB5nv7005915@gitrepo.freebsd.org> References: <202105151105.14FB5nv7005915@gitrepo.freebsd.org> Reply-To: gljennjohn@gmail.com X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4Fj9Cq6Pj2z50lC X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2021 16:03:04 -0000 On Sat, 15 May 2021 11:05:49 GMT Edward Tomasz Napierala wrote: > The branch main has been updated by trasz: > > URL: https://cgit.FreeBSD.org/src/commit/?id=3394d4239b85b5577845d9e6de4e97b18d3dba58 > > commit 3394d4239b85b5577845d9e6de4e97b18d3dba58 > Author: Edward Tomasz Napierala > AuthorDate: 2021-05-15 10:17:22 +0000 > Commit: Edward Tomasz Napierala > CommitDate: 2021-05-15 11:03:49 +0000 > > cam: allocate CCBs from UMA for SCSI and ATA IO > > This patch makes it possible for CAM to use small CCBs allocated > from an periph-specific UMA zone instead of the usual, huge ones. > The end result is that CCBs issued via da(4) take 544B (size of > ccb_scsiio) instead of the usual 2kB (size of 'union ccb', ~1.5kB, > rounded up by malloc(9)). For ATA it's 272B. We waste less > memory, we avoid zeroing the unused 1kB, and it should be easier > to allocate those CCBs in low memory conditions. It should also > be possible to use uma_zone_reserve(9) to improve behaviour > in low memory conditions even further. > > Note that this does not change the size, or the layout, of CCBs > as such. CCBs get allocated in various different ways, in particular > on the stack, and I don't want to redo all that. Instead, this > provides an opt-in mechanism for the periph to declare "my start() > callback is fine with receiving a CCB allocated from this UMA zone". > In other words, most of the code works exactly as it used to; the > change only happens to IOs issued by xpt_run_allockq(), which > is - conveniently - pretty much all that matters for performance. > > The reason for doing it this way is that it's pretty small, localized > change, and can be implemented gradually and iteratively: take a > periph, make sure its start() callback only casts the CCBs it takes > to a particular type of CCB, for example ccb_scsiio, and that it only > casts CCBs returned by cam_periph_getccb() to that type, then add UMA > zone for that size, and declare it safe to XPT. > > This is disabled by default. Set 'kern.cam.ada.enable_uma_ccbs=1' > and 'kern.cam.da.enable_uma_ccbs=1' tunables to enable it. Testing > is welcome; I will flip the default to enable in two weeks from now. > [snip diff] I built and installed world and kernel and enabled both tunables. System's been up for about two hours using both ada and da disks pretty intensely and hasn't trashed any yet. -- Gary Jennejohn From owner-dev-commits-src-main@freebsd.org Sat May 15 19:42:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C8F4564DE2F; Sat, 15 May 2021 19:42:08 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FjG4c3pgpz3hF8; Sat, 15 May 2021 19:42:08 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 14FJfrDd040099 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 15 May 2021 22:41:56 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 14FJfrDd040099 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 14FJfrd9040098; Sat, 15 May 2021 22:41:53 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 15 May 2021 22:41:53 +0300 From: Konstantin Belousov To: Lutz Donnerhacke Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: effc8e57fbf0 - main - libalias: Style cleanup Message-ID: References: <202105150701.14F717lf084359@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202105150701.14F717lf084359@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4FjG4c3pgpz3hF8 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2021 19:42:08 -0000 On Sat, May 15, 2021 at 07:01:07AM +0000, Lutz Donnerhacke wrote: > The branch main has been updated by donner: > > URL: https://cgit.FreeBSD.org/src/commit/?id=effc8e57fbf03d7f1423c662caf2b63f0d1d21a9 > > commit effc8e57fbf03d7f1423c662caf2b63f0d1d21a9 > Author: Lutz Donnerhacke > AuthorDate: 2021-05-14 13:08:08 +0000 > Commit: Lutz Donnerhacke > CommitDate: 2021-05-15 06:57:55 +0000 > > libalias: Style cleanup > > libalias is a convolut of various coding styles modified by a series > of different editors enforcing interesting convetions on spacing and > comments. > > This patch is a baseline to start with a perfomance rework of > libalias. Upcoming patches should be focus on the code, not on the > style. That's why most annoying style errors should be fixed > beforehand. > > Reviewed by: hselasky > Discussed by: emaste > MFC after: 2 weeks > Differential Revision: https://reviews.freebsd.org/D30259 > --- > sys/netinet/libalias/alias.c | 379 ++++++++++++++++----------------- > sys/netinet/libalias/alias.h | 44 ++-- > sys/netinet/libalias/alias_db.c | 414 +++++++++++++++++------------------- > sys/netinet/libalias/alias_dummy.c | 15 +- > sys/netinet/libalias/alias_ftp.c | 68 +++--- > sys/netinet/libalias/alias_irc.c | 52 +++-- > sys/netinet/libalias/alias_local.h | 178 +++++++--------- > sys/netinet/libalias/alias_mod.c | 2 - > sys/netinet/libalias/alias_nbt.c | 253 ++++++++++------------ > sys/netinet/libalias/alias_pptp.c | 84 ++++---- > sys/netinet/libalias/alias_proxy.c | 271 ++++++++++++----------- > sys/netinet/libalias/alias_sctp.c | 138 ++++++------ > sys/netinet/libalias/alias_sctp.h | 26 +-- > sys/netinet/libalias/alias_skinny.c | 30 ++- > sys/netinet/libalias/alias_smedia.c | 91 ++++---- > sys/netinet/libalias/alias_util.c | 30 +-- > 16 files changed, 975 insertions(+), 1100 deletions(-) > > diff --git a/sys/netinet/libalias/alias.c b/sys/netinet/libalias/alias.c > index 900731fcbec6..cac19ab55d56 100644 > --- a/sys/netinet/libalias/alias.c > +++ b/sys/netinet/libalias/alias.c > @@ -146,7 +146,7 @@ __FBSDID("$FreeBSD$"); > #include "alias_mod.h" > #endif > > -/* > +/* > * Define libalias SYSCTL Node > */ > #ifdef SYSCTL_NODE > @@ -192,7 +192,6 @@ static void TcpMonitorOut(u_char, struct alias_link *); > static void > TcpMonitorIn(u_char th_flags, struct alias_link *lnk) > { > - > switch (GetStateIn(lnk)) { This was style-compatible. > case ALIAS_TCP_STATE_NOT_CONNECTED: > if (th_flags & TH_RST) > @@ -210,7 +209,6 @@ TcpMonitorIn(u_char th_flags, struct alias_link *lnk) > static void > TcpMonitorOut(u_char th_flags, struct alias_link *lnk) > { > - > switch (GetStateOut(lnk)) { > case ALIAS_TCP_STATE_NOT_CONNECTED: > if (th_flags & TH_RST) > @@ -285,21 +283,20 @@ static int UdpAliasOut(struct libalias *, struct ip *, int, int create); > static int TcpAliasIn(struct libalias *, struct ip *); > static int TcpAliasOut(struct libalias *, struct ip *, int, int create); > > -static int > -IcmpAliasIn1(struct libalias *la, struct ip *pip) > -{ > - > - LIBALIAS_LOCK_ASSERT(la); > /* > De-alias incoming echo and timestamp replies. > Alias incoming echo and timestamp requests. > */ > +static int > +IcmpAliasIn1(struct libalias *la, struct ip *pip) > +{ > + LIBALIAS_LOCK_ASSERT(la); > struct alias_link *lnk; > struct icmp *ic; And this is not in style. Declarations must precede executable statements, even asserts. From owner-dev-commits-src-main@freebsd.org Sat May 15 19:58:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3128F64E53A; Sat, 15 May 2021 19:58:30 +0000 (UTC) (envelope-from lutz@iks-jena.de) Received: from annwfn.iks-jena.de (annwfn.iks-jena.de [IPv6:2001:4bd8::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 4FjGRT6V41z3kh6; Sat, 15 May 2021 19:58:29 +0000 (UTC) (envelope-from lutz@iks-jena.de) X-SMTP-Sender: IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f Received: from belenus.iks-jena.de (belenus.iks-jena.de [IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f]) by annwfn.iks-jena.de (8.15.2/8.15.2) with ESMTPS id 14FJwC15008462 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sat, 15 May 2021 21:58:12 +0200 X-MSA-Host: belenus.iks-jena.de Received: (from lutz@localhost) by belenus.iks-jena.de (8.14.3/8.14.1/Submit) id 14FJwChK018571; Sat, 15 May 2021 21:58:12 +0200 Date: Sat, 15 May 2021 21:58:12 +0200 From: Lutz Donnerhacke To: Konstantin Belousov Cc: Lutz Donnerhacke , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: effc8e57fbf0 - main - libalias: Style cleanup Message-ID: <20210515195812.GB17734@belenus.iks-jena.de> References: <202105150701.14F717lf084359@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-message-flag: Please send plain text messages only. Thank you. User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspamd-Queue-Id: 4FjGRT6V41z3kh6 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2021 19:58:30 -0000 On Sat, May 15, 2021 at 10:41:53PM +0300, Konstantin Belousov wrote: > On Sat, May 15, 2021 at 07:01:07AM +0000, Lutz Donnerhacke wrote: > > @@ -285,21 +283,20 @@ static int UdpAliasOut(struct libalias *, struct ip *, int, int create); > > static int TcpAliasIn(struct libalias *, struct ip *); > > static int TcpAliasOut(struct libalias *, struct ip *, int, int create); > > > > -static int > > -IcmpAliasIn1(struct libalias *la, struct ip *pip) > > -{ > > - > > - LIBALIAS_LOCK_ASSERT(la); > > /* > > De-alias incoming echo and timestamp replies. > > Alias incoming echo and timestamp requests. > > */ > > +static int > > +IcmpAliasIn1(struct libalias *la, struct ip *pip) > > +{ > > + LIBALIAS_LOCK_ASSERT(la); > > struct alias_link *lnk; > > struct icmp *ic; > And this is not in style. Declarations must precede executable statements, > even asserts. Of course it was a style commit. + /* + De-alias incoming echo and timestamp replies. + Alias incoming echo and timestamp requests. + */ static int IcmpAliasIn1(struct libalias *la, struct ip *pip) { - LIBALIAS_LOCK_ASSERT(la); - /* - De-alias incoming echo and timestamp replies. - Alias incoming echo and timestamp requests. - */ struct alias_link *lnk; From owner-dev-commits-src-main@freebsd.org Sat May 15 20:19:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8182264EF15; Sat, 15 May 2021 20:19:50 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FjGw55x1Tz3n3Y; Sat, 15 May 2021 20:19:49 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 14FKEVwT047967 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 15 May 2021 23:14:34 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 14FKEVwT047967 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 14FKEV4O047966; Sat, 15 May 2021 23:14:31 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 15 May 2021 23:14:31 +0300 From: Konstantin Belousov To: Lutz Donnerhacke Cc: Lutz Donnerhacke , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: effc8e57fbf0 - main - libalias: Style cleanup Message-ID: References: <202105150701.14F717lf084359@gitrepo.freebsd.org> <20210515195812.GB17734@belenus.iks-jena.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210515195812.GB17734@belenus.iks-jena.de> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4FjGw55x1Tz3n3Y X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2021 20:19:50 -0000 On Sat, May 15, 2021 at 09:58:12PM +0200, Lutz Donnerhacke wrote: > On Sat, May 15, 2021 at 10:41:53PM +0300, Konstantin Belousov wrote: > > On Sat, May 15, 2021 at 07:01:07AM +0000, Lutz Donnerhacke wrote: > > > @@ -285,21 +283,20 @@ static int UdpAliasOut(struct libalias *, struct ip *, int, int create); > > > static int TcpAliasIn(struct libalias *, struct ip *); > > > static int TcpAliasOut(struct libalias *, struct ip *, int, int create); > > > > > > -static int > > > -IcmpAliasIn1(struct libalias *la, struct ip *pip) > > > -{ > > > - > > > - LIBALIAS_LOCK_ASSERT(la); > > > /* > > > De-alias incoming echo and timestamp replies. > > > Alias incoming echo and timestamp requests. > > > */ > > > +static int > > > +IcmpAliasIn1(struct libalias *la, struct ip *pip) > > > +{ > > > + LIBALIAS_LOCK_ASSERT(la); > > > struct alias_link *lnk; > > > struct icmp *ic; > > And this is not in style. Declarations must precede executable statements, > > even asserts. > > Of course it was a style commit. > > + /* > + De-alias incoming echo and timestamp replies. > + Alias incoming echo and timestamp requests. > + */ > static int > IcmpAliasIn1(struct libalias *la, struct ip *pip) > { > - > LIBALIAS_LOCK_ASSERT(la); > - /* > - De-alias incoming echo and timestamp replies. > - Alias incoming echo and timestamp requests. > - */ > struct alias_link *lnk; I do not understand what are you trying to say. From owner-dev-commits-src-main@freebsd.org Sat May 15 20:51:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9FDD664FA57; Sat, 15 May 2021 20:51:42 +0000 (UTC) (envelope-from lutz@iks-jena.de) Received: from annwfn.iks-jena.de (annwfn.iks-jena.de [IPv6:2001:4bd8::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 4FjHct2pXGz3rV3; Sat, 15 May 2021 20:51:42 +0000 (UTC) (envelope-from lutz@iks-jena.de) X-SMTP-Sender: IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f Received: from belenus.iks-jena.de (belenus.iks-jena.de [IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f]) by annwfn.iks-jena.de (8.15.2/8.15.2) with ESMTPS id 14FKpXKe014408 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sat, 15 May 2021 22:51:34 +0200 X-MSA-Host: belenus.iks-jena.de Received: (from lutz@localhost) by belenus.iks-jena.de (8.14.3/8.14.1/Submit) id 14FKpXkB019890; Sat, 15 May 2021 22:51:33 +0200 Date: Sat, 15 May 2021 22:51:33 +0200 From: Lutz Donnerhacke To: Konstantin Belousov Cc: Lutz Donnerhacke , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: effc8e57fbf0 - main - libalias: Style cleanup Message-ID: <20210515205133.GA19770@belenus.iks-jena.de> References: <202105150701.14F717lf084359@gitrepo.freebsd.org> <20210515195812.GB17734@belenus.iks-jena.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-message-flag: Please send plain text messages only. Thank you. User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspamd-Queue-Id: 4FjHct2pXGz3rV3 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2021 20:51:42 -0000 On Sat, May 15, 2021 at 11:14:31PM +0300, Konstantin Belousov wrote: > On Sat, May 15, 2021 at 09:58:12PM +0200, Lutz Donnerhacke wrote: > > Of course it was a style commit. > > > > + /* > > + De-alias incoming echo and timestamp replies. > > + Alias incoming echo and timestamp requests. > > + */ > > static int > > IcmpAliasIn1(struct libalias *la, struct ip *pip) > > { > > - > > LIBALIAS_LOCK_ASSERT(la); > > - /* > > - De-alias incoming echo and timestamp replies. > > - Alias incoming echo and timestamp requests. > > - */ > > struct alias_link *lnk; > > I do not understand what are you trying to say. The diff above is a reformatting of the original diff in the commit. It does show, what really happend during the edit: - The empty line at the beginnen of the function body was removed - The comment at the beginning of the function body was moved before the function definition. The LIBALIAS_LOCK_ASSERT and the variable declarations were not moved. From owner-dev-commits-src-main@freebsd.org Sat May 15 20:55:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 58D0364FC3B; Sat, 15 May 2021 20:55:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FjHjC22vKz3rSY; Sat, 15 May 2021 20:55:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2EBCD4690; Sat, 15 May 2021 20:55:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14FKtRSs088260; Sat, 15 May 2021 20:55:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14FKtRRQ088259; Sat, 15 May 2021 20:55:27 GMT (envelope-from git) Date: Sat, 15 May 2021 20:55:27 GMT Message-Id: <202105152055.14FKtRRQ088259@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 128e25842ef5 - main - vm: add another pager private flag MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 128e25842ef510b39815d784e1d2af0d4afd584f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2021 20:55:27 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=128e25842ef510b39815d784e1d2af0d4afd584f commit 128e25842ef510b39815d784e1d2af0d4afd584f Author: Mateusz Guzik AuthorDate: 2021-05-14 07:50:10 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-15 20:47:29 +0000 vm: add another pager private flag Move OBJ_SHADOWLIST around to let pager flags be next to each other. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D30258 --- sys/fs/tmpfs/tmpfs.h | 2 +- sys/vm/vm_object.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h index 549339d9b6d1..bb777e29e3d0 100644 --- a/sys/fs/tmpfs/tmpfs.h +++ b/sys/fs/tmpfs/tmpfs.h @@ -45,7 +45,7 @@ MALLOC_DECLARE(M_TMPFSNAME); #endif -#define OBJ_TMPFS OBJ_PAGERPRIV /* has tmpfs vnode allocated */ +#define OBJ_TMPFS OBJ_PAGERPRIV1 /* has tmpfs vnode allocated */ /* * Internal representation of a tmpfs directory entry. diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index d159c621d2e6..1bf4cee856c7 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -201,13 +201,14 @@ struct vm_object { #define OBJ_UMTXDEAD 0x0020 /* umtx pshared was terminated */ #define OBJ_SIZEVNLOCK 0x0040 /* lock vnode to check obj size */ #define OBJ_PG_DTOR 0x0080 /* dont reset object, leave that for dtor */ +#define OBJ_SHADOWLIST 0x0100 /* Object is on the shadow list. */ #define OBJ_SWAP 0x0200 /* object swaps */ #define OBJ_SPLIT 0x0400 /* object is being split */ #define OBJ_COLLAPSING 0x0800 /* Parent of collapse. */ #define OBJ_COLORED 0x1000 /* pg_color is defined */ #define OBJ_ONEMAPPING 0x2000 /* One USE (a single, non-forked) mapping flag */ -#define OBJ_SHADOWLIST 0x4000 /* Object is on the shadow list. */ -#define OBJ_PAGERPRIV 0x8000 /* Pager private */ +#define OBJ_PAGERPRIV1 0x4000 /* Pager private */ +#define OBJ_PAGERPRIV2 0x8000 /* Pager private */ /* * Helpers to perform conversion between vm_object page indexes and offsets. From owner-dev-commits-src-main@freebsd.org Sat May 15 20:55:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6FCD464FF85; Sat, 15 May 2021 20:55:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FjHjD2gnLz3rq7; Sat, 15 May 2021 20:55:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 453CD42F5; Sat, 15 May 2021 20:55:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14FKtSPX088288; Sat, 15 May 2021 20:55:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14FKtSRD088287; Sat, 15 May 2021 20:55:28 GMT (envelope-from git) Date: Sat, 15 May 2021 20:55:28 GMT Message-Id: <202105152055.14FKtSRD088287@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: eec2e4ef7f96 - main - tmpfs: reimplement the mtime scan to use the lazy list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eec2e4ef7f964d18fcec3dc2cdcd7530be490835 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2021 20:55:28 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=eec2e4ef7f964d18fcec3dc2cdcd7530be490835 commit eec2e4ef7f964d18fcec3dc2cdcd7530be490835 Author: Mateusz Guzik AuthorDate: 2021-05-07 14:43:43 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-15 20:48:45 +0000 tmpfs: reimplement the mtime scan to use the lazy list Tested by: pho Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D30065 --- sys/fs/tmpfs/tmpfs.h | 1 + sys/fs/tmpfs/tmpfs_subr.c | 107 ++++++++++++++++++++++++++++++++++++++++++++ sys/fs/tmpfs/tmpfs_vfsops.c | 67 ++++++++++++++------------- 3 files changed, 143 insertions(+), 32 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h index bb777e29e3d0..99368d67aaaa 100644 --- a/sys/fs/tmpfs/tmpfs.h +++ b/sys/fs/tmpfs/tmpfs.h @@ -46,6 +46,7 @@ MALLOC_DECLARE(M_TMPFSNAME); #endif #define OBJ_TMPFS OBJ_PAGERPRIV1 /* has tmpfs vnode allocated */ +#define OBJ_TMPFS_VREF OBJ_PAGERPRIV2 /* vnode is referenced */ /* * Internal representation of a tmpfs directory entry. diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 67eb12598e24..8b75c58d69a2 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -99,6 +99,92 @@ tmpfs_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, return (object); } +/* + * Make sure tmpfs vnodes with writable mappings can be found on the lazy list. + * + * This allows for periodic mtime updates while only scanning vnodes which are + * plausibly dirty, see tmpfs_update_mtime_lazy. + */ +static void +tmpfs_pager_writecount_recalc(vm_object_t object, vm_offset_t old, + vm_offset_t new) +{ + struct vnode *vp; + + VM_OBJECT_ASSERT_WLOCKED(object); + + vp = object->un_pager.swp.swp_tmpfs; + + /* + * Forced unmount? + */ + if (vp == NULL) { + KASSERT((object->flags & OBJ_TMPFS_VREF) == 0, + ("object %p with OBJ_TMPFS_VREF but without vnode", object)); + VM_OBJECT_WUNLOCK(object); + return; + } + + if (old == 0) { + VNASSERT((object->flags & OBJ_TMPFS_VREF) == 0, vp, + ("object without writable mappings has a reference")); + VNPASS(vp->v_usecount > 0, vp); + } else { + VNASSERT((object->flags & OBJ_TMPFS_VREF) != 0, vp, + ("object with writable mappings does not have a reference")); + } + + if (old == new) { + VM_OBJECT_WUNLOCK(object); + return; + } + + if (new == 0) { + vm_object_clear_flag(object, OBJ_TMPFS_VREF); + VM_OBJECT_WUNLOCK(object); + vrele(vp); + } else { + if ((object->flags & OBJ_TMPFS_VREF) == 0) { + vref(vp); + vlazy(vp); + vm_object_set_flag(object, OBJ_TMPFS_VREF); + } + VM_OBJECT_WUNLOCK(object); + } +} + +static void +tmpfs_pager_update_writecount(vm_object_t object, vm_offset_t start, + vm_offset_t end) +{ + vm_offset_t new, old; + + VM_OBJECT_WLOCK(object); + KASSERT((object->flags & OBJ_ANON) == 0, + ("%s: object %p with OBJ_ANON", __func__, object)); + old = object->un_pager.swp.writemappings; + object->un_pager.swp.writemappings += (vm_ooffset_t)end - start; + new = object->un_pager.swp.writemappings; + tmpfs_pager_writecount_recalc(object, old, new); + VM_OBJECT_ASSERT_UNLOCKED(object); +} + +static void +tmpfs_pager_release_writecount(vm_object_t object, vm_offset_t start, + vm_offset_t end) +{ + vm_offset_t new, old; + + VM_OBJECT_WLOCK(object); + KASSERT((object->flags & OBJ_ANON) == 0, + ("%s: object %p with OBJ_ANON", __func__, object)); + old = object->un_pager.swp.writemappings; + object->un_pager.swp.writemappings -= (vm_ooffset_t)end - start; + new = object->un_pager.swp.writemappings; + tmpfs_pager_writecount_recalc(object, old, new); + VM_OBJECT_ASSERT_UNLOCKED(object); +} + static void tmpfs_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp) { @@ -131,6 +217,8 @@ struct pagerops tmpfs_pager_ops = { .pgo_kvme_type = KVME_TYPE_VNODE, .pgo_alloc = tmpfs_pager_alloc, .pgo_set_writeable_dirty = vm_object_set_writeable_dirty_, + .pgo_update_writecount = tmpfs_pager_update_writecount, + .pgo_release_writecount = tmpfs_pager_release_writecount, .pgo_mightbedirty = vm_object_mightbedirty_, .pgo_getvp = tmpfs_pager_getvp, }; @@ -643,6 +731,7 @@ tmpfs_free_dirent(struct tmpfs_mount *tmp, struct tmpfs_dirent *de) void tmpfs_destroy_vobject(struct vnode *vp, vm_object_t obj) { + bool want_vrele; ASSERT_VOP_ELOCKED(vp, "tmpfs_destroy_vobject"); if (vp->v_type != VREG || obj == NULL) @@ -650,12 +739,24 @@ tmpfs_destroy_vobject(struct vnode *vp, vm_object_t obj) VM_OBJECT_WLOCK(obj); VI_LOCK(vp); + /* + * May be going through forced unmount. + */ + want_vrele = false; + if ((obj->flags & OBJ_TMPFS_VREF) != 0) { + vm_object_clear_flag(obj, OBJ_TMPFS_VREF); + want_vrele = true; + } + vm_object_clear_flag(obj, OBJ_TMPFS); obj->un_pager.swp.swp_tmpfs = NULL; if (vp->v_writecount < 0) vp->v_writecount = 0; VI_UNLOCK(vp); VM_OBJECT_WUNLOCK(obj); + if (want_vrele) { + vrele(vp); + } } /* @@ -792,6 +893,12 @@ loop: case VREG: object = node->tn_reg.tn_aobj; VM_OBJECT_WLOCK(object); + KASSERT((object->flags & OBJ_TMPFS_VREF) == 0, + ("%s: object %p with OBJ_TMPFS_VREF but without vnode", + __func__, object)); + KASSERT(object->un_pager.swp.writemappings == 0, + ("%s: object %p has writemappings", + __func__, object)); VI_LOCK(vp); KASSERT(vp->v_object == NULL, ("Not NULL v_object in tmpfs")); vp->v_object = object; diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index 4f29b5dfc6f0..7dffb9027946 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -99,18 +99,38 @@ static const char *tmpfs_updateopts[] = { "from", "export", "nomtime", "size", NULL }; -/* - * Handle updates of time from writes to mmaped regions, if allowed. - * Use MNT_VNODE_FOREACH_ALL instead of MNT_VNODE_FOREACH_LAZY, since - * unmap of the tmpfs-backed vnode does not call vinactive(), due to - * vm object type is basically OBJT_SWAP. If lazy, only handle - * delayed update of mtime due to the writes to mapped files. - */ +static int +tmpfs_update_mtime_lazy_filter(struct vnode *vp, void *arg) +{ + struct vm_object *obj; + + if (vp->v_type != VREG) + return (0); + + obj = atomic_load_ptr(&vp->v_object); + if (obj == NULL) + return (0); + + return (vm_object_mightbedirty_(obj)); +} + static void -tmpfs_update_mtime(struct mount *mp, bool lazy) +tmpfs_update_mtime_lazy(struct mount *mp) +{ + struct vnode *vp, *mvp; + + MNT_VNODE_FOREACH_LAZY(vp, mp, mvp, tmpfs_update_mtime_lazy_filter, NULL) { + if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK) != 0) + continue; + tmpfs_check_mtime(vp); + vput(vp); + } +} + +static void +tmpfs_update_mtime_all(struct mount *mp) { struct vnode *vp, *mvp; - struct vm_object *obj; if (VFS_TO_TMPFS(mp)->tm_nomtime) return; @@ -119,28 +139,11 @@ tmpfs_update_mtime(struct mount *mp, bool lazy) VI_UNLOCK(vp); continue; } - obj = vp->v_object; - MPASS(obj->type == tmpfs_pager_type); - MPASS((obj->flags & OBJ_TMPFS) != 0); - - /* - * In lazy case, do unlocked read, avoid taking vnode - * lock if not needed. Lost update will be handled on - * the next call. - * For non-lazy case, we must flush all pending - * metadata changes now. - */ - if (!lazy || obj->generation != obj->cleangeneration) { - if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK) != 0) - continue; - tmpfs_check_mtime(vp); - if (!lazy) - tmpfs_update(vp); - vput(vp); - } else { - VI_UNLOCK(vp); + if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK) != 0) continue; - } + tmpfs_check_mtime(vp); + tmpfs_update(vp); + vput(vp); } } @@ -300,7 +303,7 @@ tmpfs_rw_to_ro(struct mount *mp) MNT_IUNLOCK(mp); for (;;) { tmpfs_all_rw_maps(mp, tmpfs_revoke_rw_maps_cb, NULL); - tmpfs_update_mtime(mp, false); + tmpfs_update_mtime_all(mp); error = vflush(mp, 0, flags, curthread); if (error != 0) { VFS_TO_TMPFS(mp)->tm_ronly = 0; @@ -653,7 +656,7 @@ tmpfs_sync(struct mount *mp, int waitfor) mp->mnt_kern_flag |= MNTK_SUSPEND2 | MNTK_SUSPENDED; MNT_IUNLOCK(mp); } else if (waitfor == MNT_LAZY) { - tmpfs_update_mtime(mp, true); + tmpfs_update_mtime_lazy(mp); } return (0); } From owner-dev-commits-src-main@freebsd.org Sat May 15 20:56:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C42FF64FFA3; Sat, 15 May 2021 20:56:13 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FjHk46yv5z3rnR; Sat, 15 May 2021 20:56:12 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lj1-x234.google.com with SMTP id p12so2606960ljg.1; Sat, 15 May 2021 13:56:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=u3P4RRuFANpBOQgVDLfIeMvs7Z29Xd/tfiRTqRDcXO4=; b=aSiu+ajARc4YQ99EbbfbpIQBl/dG2u9uPpN+ub4epe9I9tdYX8t7XvHsL29L9lX3MU 3K8vCR8CikQKyf+w8NxJaxaX6x36pWIqf4x6OMbZanrZYxAcSZMLTY6/TexNdA4s3dE0 WuJWf1vidn1jxr0/Du2kRqQ3WcpogWbddDEOZ5Ackzb6yeNsVsF5EKTtTjIEjbpfUgV5 R8JM8BxuZsiqQ8W+TEKWgfv+vXX7yMVKRBZIhznHmV6shVpKX1kRvFrG/gpZqfl7L4a/ drR1g5GYM/cTF+/1ldRXuiSzWxl/hzXTrB/ZmIDcc9Omd+TT4/aJQrJNavuyVvh1Sfpq 916Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=u3P4RRuFANpBOQgVDLfIeMvs7Z29Xd/tfiRTqRDcXO4=; b=BO5h5KbV85Wt6OYOmTtdVnSX7OnhKaTdkLspEiqozw5VMzhcMCnXgFtdEkzY5mKbMh MKcsX66KuG/xxLukNvlEuCHAszMtsrqfyFjkGVAYdvj7BiXR3vWxcGVTyTVv/4lBbz4i YwNz5jeLwohL/n1jFTDM3NSGngsBGntg5/NoWY9FZHd7XY8pp5/IdRP/uFKIkFBtWqRO MNgcnTwwFHxHzhARVnUWBL5f2ygXdyzxe5cSm0qgDkeUnpfsP73O8f2+IOtblciVWDWi PZ7UL3w/hKQmBzmCueSCgc48Skd7C3bE/YqMqL+Xe2s1+mVaMFZrN7unL0wOxIoFn9Vb GmeQ== X-Gm-Message-State: AOAM531E7t1/Gaip2mS9+EMk8vprrO/FwiP0jYOIPLd3WzZj8dz80qVk WVxLfLsi5ciCtZYPyffzPU1c+mgs4xuvgMmLS5CpI5BM X-Google-Smtp-Source: ABdhPJylAPDWx2g+2sskNL8cko1FqffbbnFUfeBd6zeCnbluqrXGY46c/59ETFoY+SJAtFqSkhCYh3Gx+ABFhsoPB/8= X-Received: by 2002:a2e:9acb:: with SMTP id p11mr42549540ljj.463.1621112170523; Sat, 15 May 2021 13:56:10 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:651c:485:0:0:0:0 with HTTP; Sat, 15 May 2021 13:56:09 -0700 (PDT) In-Reply-To: <202105141922.14EJM1pM058368@gitrepo.freebsd.org> References: <202105141922.14EJM1pM058368@gitrepo.freebsd.org> From: Mateusz Guzik Date: Sat, 15 May 2021 22:56:09 +0200 Message-ID: Subject: Re: git: e73e2ee0acf5 - main - cxgbei: Handle target transfers with excess unsolicited data. To: John Baldwin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4FjHk46yv5z3rnR X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=aSiu+ajA; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::234 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-3.73 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; NEURAL_HAM_MEDIUM(-1.00)[-0.997]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::234:from]; TO_DN_SOME(0.00)[]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::234:from:127.0.2.255]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::234:from]; NEURAL_HAM_SHORT(-1.00)[-1.000]; NEURAL_HAM_LONG(-0.73)[-0.732]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2021 20:56:13 -0000 One of these commits breaks tinderbox: i386 MINIMAL kernel failed, check _.i386.MINIMAL for details i386 GENERIC kernel failed, check _.i386.GENERIC for details i386 GENERIC-NODEBUG kernel failed, check _.i386.GENERIC-NODEBUG for details i386 PAE kernel failed, check _.i386.PAE for details i386 LINT kernel failed, check _.i386.LINT for details i386 LINT-NOINET kernel failed, check _.i386.LINT-NOINET for details i386 LINT-NOINET6 kernel failed, check _.i386.LINT-NOINET6 for details i386 LINT-NOIP kernel failed, check _.i386.LINT-NOIP for details /usr/src/sys/dev/cxgbe/tom/t4_ddp.c:1045:15: error: invalid operands to binary expression ('void *' and 'int') start_pva = trunc_page(sgl->addr); ^~~~~~~~~~~~~~~~~~~~~ ./machine/param.h:150:29: note: expanded from macro 'trunc_page' #define trunc_page(x) ((x) & ~PAGE_MASK) ~~~ ^ ~~~~~~~~~~ /usr/src/sys/dev/cxgbe/tom/t4_ddp.c:1300:8: error: invalid operands to binary expression ('void *' and 'int') pva = trunc_page(sgl->addr); ^~~~~~~~~~~~~~~~~~~~~ ./machine/param.h:150:29: note: expanded from macro 'trunc_page' #define trunc_page(x) ((x) & ~PAGE_MASK) ~~~ ^ ~~~~~~~~~~ On 5/14/21, John Baldwin wrote: > The branch main has been updated by jhb: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=e73e2ee0acf5a0e0f47b9c2bcd73c835c4922fab > > commit e73e2ee0acf5a0e0f47b9c2bcd73c835c4922fab > Author: John Baldwin > AuthorDate: 2021-05-14 19:20:57 +0000 > Commit: John Baldwin > CommitDate: 2021-05-14 19:21:34 +0000 > > cxgbei: Handle target transfers with excess unsolicited data. > > The CTL frontend might have provided a buffer that is smaller than the > FirstBurstLength and thus smaller than the amount of unsolicited data > included in the request PDU. Treat these transfers as an empty > transfer. > > Reported by: Jithesh Arakkan @ Chelsio > Sponsored by: Chelsio Communications > > Differential Revision: https://reviews.freebsd.org/D29940 > --- > sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c > b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c > index 7f638c96483a..c4eb4a35ad31 100644 > --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c > +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c > @@ -1064,10 +1064,15 @@ icl_cxgbei_conn_transfer_setup(struct icl_conn *ic, > union ctl_io *io, > /* > * Note that ICL calls conn_transfer_setup even if the first > * burst had everything and there's nothing left to transfer. > + * > + * NB: The CTL frontend might have provided a buffer > + * whose length (kern_data_len) is smaller than the > + * FirstBurstLength of unsolicited data. Treat those > + * as an empty transfer. > */ > - MPASS(ctsio->kern_data_len >= first_burst); > xferlen = ctsio->kern_data_len; > - if (xferlen - first_burst < ci->ddp_threshold) { > + if (xferlen < first_burst || > + xferlen - first_burst < ci->ddp_threshold) { > no_ddp: > /* > * No DDP for this transfer. Allocate a TTT (based on > -- Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Sat May 15 21:25:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F04A262835A for ; Sat, 15 May 2021 21:25:10 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FjJMV6JK1z3vlV for ; Sat, 15 May 2021 21:25:10 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f45.google.com with SMTP id u133so1463847wmg.1 for ; Sat, 15 May 2021 14:25:10 -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=+NQ0JGpMrnEYkuoL4ruQ5d4fx+ZcAWcjyboX8xjX+QU=; b=TxSs/xV42JF91F8rg4ytKRZXEQPAH78xMs5Z1DiO3yQ7IOYY+oCtghpWw3leRKM7rr yfsOyRcF9yYxnGvbEWsloNoUDq+BSgMhlP40/y17NzuB4+Khae1mRJp5KfyDxCbqy1zt i2+wpGX7vKtRlmIJXB1yNG8FgnAPKLWY48HL8lZqR6IJrrovWYIHBxCJ7wLvicHIKmcz 4TAKF6EQ4dbyhgdzyw3FDSmVVbWx9emHlZWTl1FDdo2fWxv0/jISmavuLQfYULKqTt7r tvtq7GQ+rw97odWIZKABQzf8BjNVK1mondgWd9JG10X7nbbyAvr9iLa9UZygR99u9Iaq BJLA== X-Gm-Message-State: AOAM530eAggGnmQNl+ppEE+v5phMU8WoIjfIJOONLOeGYKBa42m57WNd coUErSoNedCqPKyMm+l9mAecSQ== X-Google-Smtp-Source: ABdhPJydoeNd5dUz4L5Pt+hW79x2P3FGPYZ0Fv+6c9CDH5Ycud3olFTC6Un/nRCJ/SgzWa9nD+vfBA== X-Received: by 2002:a1c:c911:: with SMTP id f17mr57365662wmb.45.1621113909413; Sat, 15 May 2021 14:25:09 -0700 (PDT) Received: from [192.168.150.48] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id z66sm16182477wmc.4.2021.05.15.14.25.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 May 2021 14:25:09 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: git: e73e2ee0acf5 - main - cxgbei: Handle target transfers with excess unsolicited data. From: Jessica Clarke In-Reply-To: Date: Sat, 15 May 2021 22:25:08 +0100 Cc: John Baldwin , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <2B05ED91-15B0-468B-A23A-266BD559419D@freebsd.org> References: <202105141922.14EJM1pM058368@gitrepo.freebsd.org> To: Mateusz Guzik X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Rspamd-Queue-Id: 4FjJMV6JK1z3vlV X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2021 21:25:11 -0000 On 15 May 2021, at 21:56, Mateusz Guzik wrote: >=20 > One of these commits breaks tinderbox: > i386 MINIMAL kernel failed, check _.i386.MINIMAL for details > i386 GENERIC kernel failed, check _.i386.GENERIC for details > i386 GENERIC-NODEBUG kernel failed, check _.i386.GENERIC-NODEBUG for = details > i386 PAE kernel failed, check _.i386.PAE for details > i386 LINT kernel failed, check _.i386.LINT for details > i386 LINT-NOINET kernel failed, check _.i386.LINT-NOINET for details > i386 LINT-NOINET6 kernel failed, check _.i386.LINT-NOINET6 for details > i386 LINT-NOIP kernel failed, check _.i386.LINT-NOIP for details >=20 > /usr/src/sys/dev/cxgbe/tom/t4_ddp.c:1045:15: error: invalid operands > to binary expression ('void *' and 'int') > start_pva =3D trunc_page(sgl->addr); > ^~~~~~~~~~~~~~~~~~~~~ > ./machine/param.h:150:29: note: expanded from macro 'trunc_page' > #define trunc_page(x) ((x) & ~PAGE_MASK) > ~~~ ^ ~~~~~~~~~~ > /usr/src/sys/dev/cxgbe/tom/t4_ddp.c:1300:8: error: invalid operands to > binary expression ('void *' and 'int') > pva =3D trunc_page(sgl->addr); > ^~~~~~~~~~~~~~~~~~~~~ > ./machine/param.h:150:29: note: expanded from macro 'trunc_page' > #define trunc_page(x) ((x) & ~PAGE_MASK) > ~~~ ^ ~~~~~~~~~~ It seems amd64, arm64 and riscv cast to unsigned long first, but arm, = i386, mips and powerpc do not. These macros should probably just become MI in sys/sys/param.h rather than fixing the MD copies to include casts. Jess > On 5/14/21, John Baldwin wrote: >> The branch main has been updated by jhb: >>=20 >> URL: >> = https://cgit.FreeBSD.org/src/commit/?id=3De73e2ee0acf5a0e0f47b9c2bcd73c835= c4922fab >>=20 >> commit e73e2ee0acf5a0e0f47b9c2bcd73c835c4922fab >> Author: John Baldwin >> AuthorDate: 2021-05-14 19:20:57 +0000 >> Commit: John Baldwin >> CommitDate: 2021-05-14 19:21:34 +0000 >>=20 >> cxgbei: Handle target transfers with excess unsolicited data. >>=20 >> The CTL frontend might have provided a buffer that is smaller than = the >> FirstBurstLength and thus smaller than the amount of unsolicited = data >> included in the request PDU. Treat these transfers as an empty >> transfer. >>=20 >> Reported by: Jithesh Arakkan @ Chelsio >> Sponsored by: Chelsio Communications >>=20 >> Differential Revision: https://reviews.freebsd.org/D29940 >> --- >> sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 9 +++++++-- >> 1 file changed, 7 insertions(+), 2 deletions(-) >>=20 >> diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c >> b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c >> index 7f638c96483a..c4eb4a35ad31 100644 >> --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c >> +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c >> @@ -1064,10 +1064,15 @@ icl_cxgbei_conn_transfer_setup(struct = icl_conn *ic, >> union ctl_io *io, >> /* >> * Note that ICL calls conn_transfer_setup even if the = first >> * burst had everything and there's nothing left to = transfer. >> + * >> + * NB: The CTL frontend might have provided a buffer >> + * whose length (kern_data_len) is smaller than the >> + * FirstBurstLength of unsolicited data. Treat those >> + * as an empty transfer. >> */ >> - MPASS(ctsio->kern_data_len >=3D first_burst); >> xferlen =3D ctsio->kern_data_len; >> - if (xferlen - first_burst < ci->ddp_threshold) { >> + if (xferlen < first_burst || >> + xferlen - first_burst < ci->ddp_threshold) { >> no_ddp: >> /* >> * No DDP for this transfer. Allocate a TTT = (based on >>=20 >=20 >=20 > --=20 > Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Sat May 15 21:28:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 050F962879A for ; Sat, 15 May 2021 21:28:12 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic304-25.consmr.mail.gq1.yahoo.com (sonic304-25.consmr.mail.gq1.yahoo.com [98.137.68.206]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FjJQy6cGMz3vly for ; Sat, 15 May 2021 21:28:10 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1621114089; bh=sCmR1QjB7mtYXUqm7t1kuZl7yDH22Tb9jszA5UeTa9P=; h=X-Sonic-MF:From:Subject:Date:To:From:Subject; b=FQwM84yMNXwS97JsS1zzOADjfyfodNdQAfhWYVjv9qfPLvrRdENmDp18CJNGCIwHxfmGez7mzhjinRafwVhlF9UnkoqH2mkFznb5IZ1sSqDHPOIhBos2SjmR58AK5Fd81f+aigqD6petAb0zwbAPF5vUEiarU8Ve6VJq/9ga4oVoxjocJXptN7E0RWcRRhgerI1+vT+KJnqglfaFfFVc2iUZEDGjoRS0FeqdYitYkC2y9kuRbHIejNiYKiFpuz8GaN167pYw16NNLdXT6D9xIxGXTkZ3UqTIDr/fWwIOuOvft+0QIjJKHjcRMeQ6hP3h+0X5tCChvynj1wuaJGd6ZA== X-YMail-OSG: 5O.imfoVM1npih_DZUw.nyMqdBUTJryiJdlhk_ffMQMSUby41.zKN6ba5a.0pf0 w5mQYhA2lCqrLnkvsPd0xIbLvjp1WVfK2VUegL1NQ2Tqn6mba5u9aZGRQbgT9QnAhiRZIi.hYhO8 _OX2iFPCKppWbH2Jut0boSHxP49dn8wioRRHLmGc5V_u04M5l7hiuvyBEOnW89yloWHxAM77PrUM RK9Xc8Yd51aEiKjZtM7.BUsfShtMGvcji8ZV2kovyg.Lbo9kooy.fx0lA5VSo7DX0C8.jZy36aSB M1MfrfLAJA0RZBoprkNeYWI0crvIUJmL9aKdxU1btDHO_gJe_GvnSa7Q.a5YfThcAHs0x4AVAKds bfr_0pe49RV_BMG0iIJRIj3PF5AhU_.mmtlS25DvxKWyNgOdcRGibP6GSZhpEpIQuFZGBTOndk2J pL8LFaezM0WyE5SVnTN5kur0alzNXf40OlMSdgL1cH7.co4QoFl5RqvnfeS9euo9foRYUHfAd1UQ wJXha5wu9fm8vWuHiLqWFgQB9gnEFnelNuQ19FAiUSZfkbe8nzsQXV1NxH.vjCKCijS1wuK97pMi rt7Z5VROJ.4WhKPaYUVdPq9eUnoar5KG27J1yaA0N6FIUXCl4r0qqCeZyjbNerogXCQrPy4If0lB wqZf29FQsTTEA_8WZaecWtprFEMpeC5uDOlQZLiFFCOwT3EC3wCfRmdsPFNcIQRgYn_tM1enDgGz kojA7j_TNkJKklHMXhQa13J_c0FUqGY6dqy56neuSDT2UJp7kqtyl1TDPJ5XjMTb6gqGYk6sbdi6 959Wz5VvSFx_eDrQ5F0R45yS1tuAzNSYetOpJ83rJK_XDQkNhDhhXYKQOWbITYAZ45vOWCdScbMP PMqNxfhuaNUukiNRHDaVoTDsJGImNvTjP7qZjCR32JVzE6J5woShuznBubhMXLL0CdBgdSYbqPwS 0FJTflfEEHGXmD5cJxQbpErHtVAIwJ4_ck8VcVK55y.SgBopcTZTPzH60GO6Qi2wH1PC13M18jNf fbMAfb_JbKgH2bhnxhpBvfKp90065f9rLlFR6.4HGCdUVDy4mGErZCrnVVZAmqLkFvXuWWZIH1H. IjO2s7EYICiyiZASW0eoKiEJG4NXB2tI6hqMefJud8Mw7sdFRRpXuG0nzZ0b.q6lSWvbD3i7LfMa q88wVSVawezTKG4lR6dF.H8ZiSLZqqdCJlgEXJEY5GGlAZNmXw8IbYXIRfx0qrQEdgFpD63SPghy KvUNuFWCFQc7jryXPfcNqoHoxspPR5ePW0bgzMrOr0aEGbfPWD2kGkVtpq8PCtidilMzvf7nSFs9 R7PPCug8rWfEMPTP4qKYq6FsKG_Trbv.1ChcxO9W0Ysr3TKvkiTiNSuSqdb.MqMWXqEP0jO_tuwk R8bjElroDvXH98AtTWyyBRqA3_pMX8b.59ljURBc3mvHqbCLdLB41cL_37TnqZlKVINJ78cRUhKh 3CUiC2T6EppRuoxDaaEscwUgwZ3K1fPKwxXfLV.VAKb6YDVoWS8JAZp_q927M.e9Ka1wXKSDdV7F K44Ape256BhUFDbAqaNKmRieCGf0PebQ5S.kh8lYrk0c.fYv2Ha1MJKOeEs8VNz2OILPp6m7w0M4 WkhwtUthZ1kMY.GlENbuILA5nLAD9ISW6ZHiJtqW.RXEbOGsiOUwb.qIt8X.8KsiV6XaIm0kXO0w 63GNgd1dbL92ZSzglOQ9aGZDeKA3uIK9F8VwgQIkt0EmzweergOnXXVI2em5NFRwW2w2WRX79xxl vkJPhA81CS.qZcqQcWuQzieznv8ZMpl1N4freID7vaTAVMIIF.a.l3GYqykWd4cSMpMER_JJmbv. cLuwqzvjbSaFYTgZsHlfoSOwAF.T7TzCRydwtDi4wo7snvK.cFkoF1ZO0IVELfvGD2qKyJqRUXwK p4PHnsrpxqUDyVJ1IazvCFKr09WEslLEKivxZrk_3tLJOhmXjLPDnZU1uOqL59jPr_Hqpw10AI68 25vpQaXCuDRpsELVfNjbs3N1xz5z8jlr43Owu6h_Shib2yiMdMxvuppMFZZiwpCtY93doonOuQUN U8iBSCwz_251x7C8DqTlIa1Isb10VyZAvh9gRjNw6ZZoPfaSDeLIoVQ6YA6EDqHcQjCVUN4jjjSk 0wtuStC4fRMBXEfwC0aTxQua4k8QenqKSiSsqAdvzKnLq2bi8gy0.XVUrcJxR42nkgSkFCCrWhR7 jeNLYg2sFyJBGtoDWEjet6QHWqxcXae8Pqdk_Ll3YzyYolkDvyOS6UsA3usQKZDkXbYbSJj_LuTv cY.xlu7rXpAjvN_KVTNwt7P0MsrF7IySFquVqbEws24UMZ04TT5F2.W1n8GhpNxgDuR2ThhLam7Y f9sJrGaJsMpOQVkCjc4v3idlYD.QPmV1wm9ZmPWkr9aYTlvSufCS3mz7cokRw1MJtn7N56hSpdBU KP9GGr97Yl.VYOHH5939T2CLBHg8- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.gq1.yahoo.com with HTTP; Sat, 15 May 2021 21:28:09 +0000 Received: by kubenode547.mail-prod1.omega.bf1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 33cceacc3dd67f1f7f69288ec56db454; Sat, 15 May 2021 21:28:08 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.80.0.2.43\)) Subject: Re: git: effc8e57fbf0 - main - libalias: Style cleanup Message-Id: Date: Sat, 15 May 2021 14:28:05 -0700 To: Konstantin Belousov , dev-commits-src-main@freebsd.org X-Mailer: Apple Mail (2.3654.80.0.2.43) References: X-Rspamd-Queue-Id: 4FjJQy6cGMz3vly X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.50 / 15.00]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; DKIM_TRACE(0.00)[yahoo.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/20, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[98.137.68.206:from]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; SPAMHAUS_ZRD(0.00)[98.137.68.206:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[98.137.68.206:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.68.206:from]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2021 21:28:12 -0000 Konstantin Belousov kostikbel at gmail.com wrote on Sat May 15 19:42:08 UTC 2021 : > On Sat, May 15, 2021 at 07:01:07AM +0000, Lutz Donnerhacke wrote: > > . . . > > +static int > > +IcmpAliasIn1(struct libalias *la, struct ip *pip) > > +{ > > + LIBALIAS_LOCK_ASSERT(la); > > struct alias_link *lnk; > > struct icmp *ic; > And this is not in style. Declarations must precede executable = statements, > even asserts. Looks like the "may be placed" wording in "man 9 style" below might need adjustment in the first paragraph quoted. The beginning of a function is an example of a block and I got a rather different interpretation of the wording out of reading the material as it is: I read it as indicating an optional status for such a placement of declarations in blocks generally. QUOTE When declaring variables in functions declare them sorted by size, = then in alphabetical order; multiple ones per line are okay. If a line overflows reuse the type keyword. Variables may be initialized = where declared especially when they are constant for the rest of the = scope. Declarations may be placed before executable lines at the start of = any block. Calls to complicated functions should be avoided when initializing variables. . . . Do not insert a blank line at the beginning of functions with local variables. Instead, these should have local variable declarations = first, followed by one blank line, followed by the first statement. END QUOTE In the second paragraph quoted, the "should have" possibly should be "must have". Having read the other wording first, and misinterpreted, I apparently read too much optionality into "should have" as well. =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-dev-commits-src-main@freebsd.org Sat May 15 21:31:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EE443628931; Sat, 15 May 2021 21:31:05 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FjJVK4rdjz3wGw; Sat, 15 May 2021 21:31:05 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 14FLUsfc066663 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 16 May 2021 00:30:57 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 14FLUsfc066663 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 14FLUsFM066662; Sun, 16 May 2021 00:30:54 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 16 May 2021 00:30:54 +0300 From: Konstantin Belousov To: Lutz Donnerhacke Cc: Lutz Donnerhacke , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: effc8e57fbf0 - main - libalias: Style cleanup Message-ID: References: <202105150701.14F717lf084359@gitrepo.freebsd.org> <20210515195812.GB17734@belenus.iks-jena.de> <20210515205133.GA19770@belenus.iks-jena.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210515205133.GA19770@belenus.iks-jena.de> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4FjJVK4rdjz3wGw X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2021 21:31:06 -0000 On Sat, May 15, 2021 at 10:51:33PM +0200, Lutz Donnerhacke wrote: > On Sat, May 15, 2021 at 11:14:31PM +0300, Konstantin Belousov wrote: > > On Sat, May 15, 2021 at 09:58:12PM +0200, Lutz Donnerhacke wrote: > > > Of course it was a style commit. > > > > > > + /* > > > + De-alias incoming echo and timestamp replies. > > > + Alias incoming echo and timestamp requests. > > > + */ > > > static int > > > IcmpAliasIn1(struct libalias *la, struct ip *pip) > > > { > > > - > > > LIBALIAS_LOCK_ASSERT(la); > > > - /* > > > - De-alias incoming echo and timestamp replies. > > > - Alias incoming echo and timestamp requests. > > > - */ > > > struct alias_link *lnk; > > > > I do not understand what are you trying to say. > > The diff above is a reformatting of the original diff in the commit. > It does show, what really happend during the edit: > - The empty line at the beginnen of the function body was removed This is optional, empty line at the beginning for the functions without local declarations was required before, and is allowed right now. > - The comment at the beginning of the function body was moved > before the function definition. > > The LIBALIAS_LOCK_ASSERT and the variable declarations were not moved. So you changed some style, but left the large violation in place. From owner-dev-commits-src-main@freebsd.org Sat May 15 22:37:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 28E9E629822; Sat, 15 May 2021 22:37:33 +0000 (UTC) (envelope-from lutz@iks-jena.de) Received: from annwfn.iks-jena.de (annwfn.iks-jena.de [IPv6:2001:4bd8::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 4FjKz0693Mz4YXj; Sat, 15 May 2021 22:37:32 +0000 (UTC) (envelope-from lutz@iks-jena.de) X-SMTP-Sender: IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f Received: from belenus.iks-jena.de (belenus.iks-jena.de [IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f]) by annwfn.iks-jena.de (8.15.2/8.15.2) with ESMTPS id 14FMbOJK023145 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sun, 16 May 2021 00:37:25 +0200 X-MSA-Host: belenus.iks-jena.de Received: (from lutz@localhost) by belenus.iks-jena.de (8.14.3/8.14.1/Submit) id 14FMaYgC023690; Sun, 16 May 2021 00:36:34 +0200 Date: Sun, 16 May 2021 00:36:34 +0200 From: Lutz Donnerhacke To: Konstantin Belousov Cc: Lutz Donnerhacke , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: effc8e57fbf0 - main - libalias: Style cleanup Message-ID: <20210515223634.GA21814@belenus.iks-jena.de> References: <202105150701.14F717lf084359@gitrepo.freebsd.org> <20210515195812.GB17734@belenus.iks-jena.de> <20210515205133.GA19770@belenus.iks-jena.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-message-flag: Please send plain text messages only. Thank you. User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspamd-Queue-Id: 4FjKz0693Mz4YXj X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2021 22:37:33 -0000 On Sun, May 16, 2021 at 12:30:54AM +0300, Konstantin Belousov wrote: > > The LIBALIAS_LOCK_ASSERT and the variable declarations were not moved. > So you changed some style, but left the large violation in place. This cleanup is a preparation to fix various issues in this code. So yes, the change was intentionally limited to style issues. Mixing style and functional changes makes it very hard to track down a broken behavior to a single commit. This change is huge, it must not break anything. From owner-dev-commits-src-main@freebsd.org Sat May 15 22:42:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29D4F629A7F for ; Sat, 15 May 2021 22:42:09 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FjL4K0N2jz4Ywx for ; Sat, 15 May 2021 22:42:09 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f52.google.com with SMTP id h4so2572438wrt.12 for ; Sat, 15 May 2021 15:42:08 -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=F7NT+d9CyIVNEdF3LuF2NMB/isI8Z051uKvErSixD3o=; b=ggam76TK8F238BpO4IDyyJ+HjxqJBMm2LDtgAYNva4RGOzFUz+s5sBzbBlDFQg+hWM KSdoVZbshLL3y6IXPuY+g5rZQsqWaTLohCUv0gOOTMPTpMry+9cnFQlnYgIyMV3XVK/C C36i88A410JZV/Fzr2pI6oE2KX42cYT4V2Cj6vdOJptsqNVOVYrR+J6dsOX1c80m9pu0 mRdRHBckvA/2oXLeQQ/ktWg2hnLigN2/eQHS7Tp5mDbwPR2fGj4lcSEHRTOLQ8FCZYQJ wvbGQ0aIIUrpJtboBnH5OwUyr76UKjcypZQEEoSC0kPUXouPsdGxCdr5CDOxWBgRzL+P pf9g== X-Gm-Message-State: AOAM532QNJc0GdclhNe9UNmdTL+d5tPnbgAFZ0E5rNekF5QFp7iGeP2o C13qsoPOfu6NH/vZ1d9WcLGxUg== X-Google-Smtp-Source: ABdhPJxMCn1m6Q6Vt+IF7pmyxy1F8CxguUj8k19zOHo7zqJAZTbbaXipbKRq3nzJLGH2APlA+3vxzQ== X-Received: by 2002:a5d:4408:: with SMTP id z8mr3869094wrq.2.1621118527506; Sat, 15 May 2021 15:42:07 -0700 (PDT) Received: from [192.168.150.48] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id v10sm12664092wrq.0.2021.05.15.15.42.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 May 2021 15:42:07 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: git: effc8e57fbf0 - main - libalias: Style cleanup From: Jessica Clarke In-Reply-To: <20210515223634.GA21814@belenus.iks-jena.de> Date: Sat, 15 May 2021 23:42:06 +0100 Cc: Konstantin Belousov , Lutz Donnerhacke , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <67F972DE-A735-4537-8AFB-87E4E9832424@freebsd.org> References: <202105150701.14F717lf084359@gitrepo.freebsd.org> <20210515195812.GB17734@belenus.iks-jena.de> <20210515205133.GA19770@belenus.iks-jena.de> <20210515223634.GA21814@belenus.iks-jena.de> To: Lutz Donnerhacke X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Rspamd-Queue-Id: 4FjL4K0N2jz4Ywx X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2021 22:42:09 -0000 On 15 May 2021, at 23:36, Lutz Donnerhacke wrote: >=20 > On Sun, May 16, 2021 at 12:30:54AM +0300, Konstantin Belousov wrote: >>> The LIBALIAS_LOCK_ASSERT and the variable declarations were not = moved. >> So you changed some style, but left the large violation in place. >=20 > This cleanup is a preparation to fix various issues in this code. > So yes, the change was intentionally limited to style issues. >=20 > Mixing style and functional changes makes it very hard to track down a > broken behavior to a single commit. This change is huge, it must not = break > anything. I think you two are talking past each other. kib@=E2=80=99s point is = that some of the changes made in this commit were style *changes* not style *fixes* (i.e. = the code was compliant before, you=E2=80=99ve just changed it from one = acceptable formatting to another), and that there were instances of significant = style violations *not* fixed (e.g. the assertion macro before variable = declarations pointed out). He is not talking about functional violations, only style = ones. However, in your defence, your original commit did not claim to fix = *all* style violations, only "most annoying style errors", though that doesn=E2=80=99t= account for unnecessary churn as seen with the blank lines at the starts of = functions. Jess From owner-dev-commits-src-main@freebsd.org Sat May 15 22:44:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 70C81629F23; Sat, 15 May 2021 22:44:57 +0000 (UTC) (envelope-from lutz@iks-jena.de) Received: from annwfn.iks-jena.de (annwfn.iks-jena.de [IPv6:2001:4bd8::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 4FjL7Y1N9Qz4ZPH; Sat, 15 May 2021 22:44:56 +0000 (UTC) (envelope-from lutz@iks-jena.de) X-SMTP-Sender: IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f Received: from belenus.iks-jena.de (belenus.iks-jena.de [IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f]) by annwfn.iks-jena.de (8.15.2/8.15.2) with ESMTPS id 14FMiseA023622 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sun, 16 May 2021 00:44:54 +0200 X-MSA-Host: belenus.iks-jena.de Received: (from lutz@localhost) by belenus.iks-jena.de (8.14.3/8.14.1/Submit) id 14FMisfL024199; Sun, 16 May 2021 00:44:54 +0200 Date: Sun, 16 May 2021 00:44:54 +0200 From: Lutz Donnerhacke To: Jessica Clarke Cc: Konstantin Belousov , Lutz Donnerhacke , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: effc8e57fbf0 - main - libalias: Style cleanup Message-ID: <20210515224454.GB21814@belenus.iks-jena.de> References: <202105150701.14F717lf084359@gitrepo.freebsd.org> <20210515195812.GB17734@belenus.iks-jena.de> <20210515205133.GA19770@belenus.iks-jena.de> <20210515223634.GA21814@belenus.iks-jena.de> <67F972DE-A735-4537-8AFB-87E4E9832424@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <67F972DE-A735-4537-8AFB-87E4E9832424@freebsd.org> X-message-flag: Please send plain text messages only. Thank you. User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspamd-Queue-Id: 4FjL7Y1N9Qz4ZPH X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2021 22:44:57 -0000 On Sat, May 15, 2021 at 11:42:06PM +0100, Jessica Clarke wrote: > I think you two are talking past each other. kib@’s point is that some of the > changes made in this commit were style *changes* not style *fixes* (i.e. the > code was compliant before, you’ve just changed it from one acceptable > formatting to another), and that there were instances of significant style > violations *not* fixed (e.g. the assertion macro before variable declarations > pointed out). He is not talking about functional violations, only style ones. > However, in your defence, your original commit did not claim to fix *all* style > violations, only "most annoying style errors", though that doesn’t account for > unnecessary churn as seen with the blank lines at the starts of functions. You are right. Let's close this discussion. From owner-dev-commits-src-main@freebsd.org Sat May 15 23:24:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8FDFC62A7CC for ; Sat, 15 May 2021 23:24:41 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FjM1P3NdZz4dtp for ; Sat, 15 May 2021 23:24:41 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x733.google.com with SMTP id o27so2494514qkj.9 for ; Sat, 15 May 2021 16:24:41 -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; bh=kR5UUuS67BzBCIwANsMwLI5sCoL9aMgF930m9lLpzG4=; b=Ca8bC712qFl2S0t9HZMjBx5GogIlTeNecu9ZmGmtcJxUfbDHgBMnK4Y6kOkdttLRUq HM7BnXTSCNU5CIP6ZNZh7f3E6rX+C/2J8GHxklhWl92Zej+QWhvOJps/4x1h6F0dylbE HUJNTdOjKhExs91KHiX4rYm3wsL6TIjh8es/wC6RxKeMPUzVFtmHYAAINZb3vONNnNmR JQPl/5FILILO5xEIAiEeeOrjeEqdgc7fUU1mtYR9FJuS2Ckr0UgGXHZ6BYPPDMOuOCmk YnJOb0jmqbIRlySzhcDKV6ercTS2MhvYcpdEoBJ8A8a4H7H/k6JlgKXXcMRBeLDtoZmE m/Jg== 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; bh=kR5UUuS67BzBCIwANsMwLI5sCoL9aMgF930m9lLpzG4=; b=WcRvAB5itkpwdmjBnzOvwW5TX2TgMEXqdnibWKMDO7ObNpvV644R5v1Dvx0QU00NS7 NzM86Ndfa6iEj+nbrCv+Bop/MCB/rv8kV+xK6lxSboBK/J1UIWJ5F9SlH1r79ug9fTlm HfUzRTHoPI+VCebcHwnGy+ullBctpxajD50SjWrjkh5Nn/TLkFffeMtwNZMXZwzHxXhe vYXsObgsaRtaZb1xQGvO/hkl2tfF3ylzKkjfci30f1aE38bpzxaOI6CnIVxvfGOGPp14 bSa382kb70pUbjaaXNAvYtynECZ6VeSPT56Y4kgus0ewxfsAdLe98O2inhCS5n4HXTeJ ajyg== X-Gm-Message-State: AOAM530pBhhjTf9LttXIwSlW/W10lwEZ8iY3ivOAxVlUP/QvCDcWwhLz EDlCcXUWR30Ob4eZ+Yawpv4qkQ== X-Google-Smtp-Source: ABdhPJz6KIup3BvglK/USF/2tVBV6PNnuNOx+5Hor9gHUD0EsjMTHiW3iM2KI0oV0FxkzAYoi10HrQ== X-Received: by 2002:a37:815:: with SMTP id 21mr48899075qki.498.1621121080238; Sat, 15 May 2021 16:24:40 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-224-136.bltmmd.fios.verizon.net. [100.16.224.136]) by smtp.gmail.com with ESMTPSA id i9sm7940282qtg.18.2021.05.15.16.24.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 May 2021 16:24:39 -0700 (PDT) Date: Sat, 15 May 2021 19:24:38 -0400 From: Shawn Webb To: Edward Tomasz Napierala Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 3394d4239b85 - main - cam: allocate CCBs from UMA for SCSI and ATA IO Message-ID: <20210515232438.7siob6di7bdvaefs@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <202105151105.14FB5nv7005915@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6k5h3synwn52j6at" Content-Disposition: inline In-Reply-To: <202105151105.14FB5nv7005915@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4FjM1P3NdZz4dtp X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2021 23:24:41 -0000 --6k5h3synwn52j6at Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, May 15, 2021 at 11:05:49AM +0000, Edward Tomasz Napierala wrote: > The branch main has been updated by trasz: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D3394d4239b85b5577845d9e6de= 4e97b18d3dba58 >=20 > commit 3394d4239b85b5577845d9e6de4e97b18d3dba58 > Author: Edward Tomasz Napierala > AuthorDate: 2021-05-15 10:17:22 +0000 > Commit: Edward Tomasz Napierala > CommitDate: 2021-05-15 11:03:49 +0000 >=20 > cam: allocate CCBs from UMA for SCSI and ATA IO > =20 > This patch makes it possible for CAM to use small CCBs allocated > from an periph-specific UMA zone instead of the usual, huge ones. > The end result is that CCBs issued via da(4) take 544B (size of > ccb_scsiio) instead of the usual 2kB (size of 'union ccb', ~1.5kB, > rounded up by malloc(9)). For ATA it's 272B. We waste less > memory, we avoid zeroing the unused 1kB, and it should be easier > to allocate those CCBs in low memory conditions. It should also > be possible to use uma_zone_reserve(9) to improve behaviour > in low memory conditions even further. > =20 > Note that this does not change the size, or the layout, of CCBs > as such. CCBs get allocated in various different ways, in particular > on the stack, and I don't want to redo all that. Instead, this > provides an opt-in mechanism for the periph to declare "my start() > callback is fine with receiving a CCB allocated from this UMA zone". > In other words, most of the code works exactly as it used to; the > change only happens to IOs issued by xpt_run_allockq(), which > is - conveniently - pretty much all that matters for performance. > =20 > The reason for doing it this way is that it's pretty small, localized > change, and can be implemented gradually and iteratively: take a > periph, make sure its start() callback only casts the CCBs it takes > to a particular type of CCB, for example ccb_scsiio, and that it only > casts CCBs returned by cam_periph_getccb() to that type, then add UMA > zone for that size, and declare it safe to XPT. > =20 > This is disabled by default. Set 'kern.cam.ada.enable_uma_ccbs=3D1' > and 'kern.cam.da.enable_uma_ccbs=3D1' tunables to enable it. Testing > is welcome; I will flip the default to enable in two weeks from now. > =20 > Reviewed By: imp > Sponsored by: NetApp, Inc. > Sponsored by: Klara, Inc. > Differential Revision: https://reviews.freebsd.org/D28674 > --- > sys/cam/ata/ata_da.c | 18 ++++++++++++++++++ > sys/cam/ata/ata_xpt.c | 7 +++++++ > sys/cam/cam_ccb.h | 14 +++++++++++++- > sys/cam/cam_periph.h | 3 +++ > sys/cam/cam_xpt.c | 32 +++++++++++++++++++++++++++++--- > sys/cam/scsi/scsi_da.c | 18 ++++++++++++++++++ > sys/cam/scsi/scsi_xpt.c | 7 +++++++ > 7 files changed, 95 insertions(+), 4 deletions(-) Hey Edward, I suspect this may be the cause of a kernel panic I just had when booting my Softiron Overdrive 1000 arm64 system: panic: ata_action: ccb 0xffff000040388828, func_code 0x15 should not be all= ocated from UMA zone cpuid =3D 1 time =3D 1 __HardenedBSD_version =3D 1400000 __FreeBSD_version =3D 1400013 version =3D FreeBSD 14.0-CURRENT-HBSD #1 hardened/current/master-n190374-a= 541810e5fa: Sat May 15 17:05:42 EDT 2021 shawn@arm64-02:/usr/obj/usr/src/arm64.aarch64/sys/HARDENEDBSD KDB: stack backtrace: db_trace_self() at db_trace_self db_trace_self_wrapper() at db_trace_self_wrapper+0x30 vpanic() at vpanic+0x188 panic() at panic+0x44 ata_action() at ata_action+0x340 _ata_announce_periph() at _ata_announce_periph+0x74 ata_announce_periph_sbuf() at ata_announce_periph_sbuf+0x24 xpt_announce_periph_sbuf() at xpt_announce_periph_sbuf+0x1a8 adaregister() at adaregister+0x420 cam_periph_alloc() at cam_periph_alloc+0x528 adaasync() at adaasync+0xa8 xptsetasyncfunc() at xptsetasyncfunc+0x100 xptdevicetraverse() at xptdevicetraverse+0x9c xpttargettraverse() at xpttargettraverse+0x78 xptbustraverse() at xptbustraverse+0x80 xpt_register_async() at xpt_register_async+0x1fc adainit() at adainit+0x4c periphdriver_init() at periphdriver_init+0x54 xpt_finishconfig_task() at xpt_finishconfig_task+0x18 taskqueue_run_locked() at taskqueue_run_locked+0x188 taskqueue_thread_loop() at taskqueue_thread_loop+0x9c fork_exit() at fork_exit+0x74 fork_trampoline() at fork_trampoline+0x14 KDB: enter: panic [ thread pid 0 tid 100023 ] Stopped at kdb_enter+0x44: undefined f904411f Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --6k5h3synwn52j6at Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmCgWDMACgkQ/y5nonf4 4fruaQ/+PIkDG/eUlPCAdIrcETOpYDRNCaCK08kg1k6F4OE4H6PUeltr00DQhjH8 NdmIGPlne3Bs2y0qsZLGIMcD5s+NdFyj6bm2d6IX0UP3Si8zSiI8L7bum7jQlv2K Bbk7pAFKBHwYlNm5CotlwoIlDAWztr0N/YNIi4SWX+m2MStoVXZTOcO+3fRB/yFE buWVb1hZlPECmpVnhP/XQtMParxbUd1i9I00oxdYHSVux8CQq73D/Rkm4PT5pj4S iOWouMUGed6fDLS7o1M/wB9t9KOGpvnRqVaolvRfZglTI8ek5d6w9Po0fI4aSUNy LcWZKS0LsQH7zTlevpNvQNDBq1a7xm5UbhMOs3wNiBCgjsJ0anwV9j3/951x/jTS EjqDVfMsa1Vb7s+hXb4Gf9f1RF4HoUeB7P1nOjn+LjZv3kCT/b6mKEMYjrCjeOJz JChaBU2BBY8Q8hsIk4Ndx2Vn3XMLxDjsCsBPQ7f88LX+PZfUiIWtP5aHUuPbQw7l 9zDAkRV7Bb1SeIJeDPvfNbQSHq2waRvd+cZM278X7fM5GmvZG4SfUnEpGpiSA+aD /Eq74lJN35/SdVWH/oRvgpj1zKCwP62Pc112S2Tv6qog2BApWRlPdfMEk+FzMImm B92knlTQDqe1zf2/P5koVWLzLBXteQ9gqpmV30mP8Ki2FLNeoF8= =02Rf -----END PGP SIGNATURE----- --6k5h3synwn52j6at-- From owner-dev-commits-src-main@freebsd.org Sun May 16 00:29:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D425D62C716; Sun, 16 May 2021 00:29:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FjNSZ5WLCz4mBG; Sun, 16 May 2021 00:29:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1D3E71AE; Sun, 16 May 2021 00:29:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14G0To61066287; Sun, 16 May 2021 00:29:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14G0ToTT066286; Sun, 16 May 2021 00:29:50 GMT (envelope-from git) Date: Sun, 16 May 2021 00:29:50 GMT Message-Id: <202105160029.14G0ToTT066286@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: 2e6b07866f9e - main - libalias: Ensure ASSERT behind varable declarations MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2e6b07866f9e1520626a1523f6609cc411bdda1c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 May 2021 00:29:50 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=2e6b07866f9e1520626a1523f6609cc411bdda1c commit 2e6b07866f9e1520626a1523f6609cc411bdda1c Author: Lutz Donnerhacke AuthorDate: 2021-05-15 22:49:11 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-16 00:28:36 +0000 libalias: Ensure ASSERT behind varable declarations At some places the ASSERT was inserted before variable declarations are finished. This is fixed now. Reported by: kib Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30282 --- sys/netinet/libalias/alias.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/libalias/alias.c b/sys/netinet/libalias/alias.c index cac19ab55d56..0e2756affcb4 100644 --- a/sys/netinet/libalias/alias.c +++ b/sys/netinet/libalias/alias.c @@ -290,10 +290,10 @@ static int TcpAliasOut(struct libalias *, struct ip *, int, int create); static int IcmpAliasIn1(struct libalias *la, struct ip *pip) { - LIBALIAS_LOCK_ASSERT(la); struct alias_link *lnk; struct icmp *ic; + LIBALIAS_LOCK_ASSERT(la); ic = (struct icmp *)ip_next(pip); /* Get source address from ICMP data field and restore original data */ @@ -334,13 +334,13 @@ IcmpAliasIn1(struct libalias *la, struct ip *pip) static int IcmpAliasIn2(struct libalias *la, struct ip *pip) { - LIBALIAS_LOCK_ASSERT(la); struct ip *ip; struct icmp *ic, *ic2; struct udphdr *ud; struct tcphdr *tc; struct alias_link *lnk; + LIBALIAS_LOCK_ASSERT(la); ic = (struct icmp *)ip_next(pip); ip = &ic->icmp_ip; From owner-dev-commits-src-main@freebsd.org Sun May 16 05:38:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A3BF636231; Sun, 16 May 2021 05:38:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FjWJv2yldz3w58; Sun, 16 May 2021 05:38:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FBC613856; Sun, 16 May 2021 05:38:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14G5cdIt079933; Sun, 16 May 2021 05:38:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14G5cdtY079932; Sun, 16 May 2021 05:38:39 GMT (envelope-from git) Date: Sun, 16 May 2021 05:38:39 GMT Message-Id: <202105160538.14G5cdtY079932@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Guangyuan Yang Subject: git: 80ba60f64394 - main - kerberos.8: Replace dead link MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 80ba60f64394fab3cda10d5921af896ed1c57c5f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 May 2021 05:38:39 -0000 The branch main has been updated by ygy (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=80ba60f64394fab3cda10d5921af896ed1c57c5f commit 80ba60f64394fab3cda10d5921af896ed1c57c5f Author: Guangyuan Yang AuthorDate: 2021-05-16 05:37:09 +0000 Commit: Guangyuan Yang CommitDate: 2021-05-16 05:37:09 +0000 kerberos.8: Replace dead link Replace it with a tutorial hosted on kerberos.org and the classic "dialogue" from Bill Bryant. The change has been reported and merged upstream (https://github.com/heimdal/heimdal/commit/7f3445f1b7). MFC after: 3 days PR: 251854 Reported by: ktullavik@gmail.com Submitted by: bjk (upstream github) Reviewed by: bcr --- crypto/heimdal/lib/krb5/kerberos.8 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/crypto/heimdal/lib/krb5/kerberos.8 b/crypto/heimdal/lib/krb5/kerberos.8 index 94d49955180b..a4161eea5953 100644 --- a/crypto/heimdal/lib/krb5/kerberos.8 +++ b/crypto/heimdal/lib/krb5/kerberos.8 @@ -31,7 +31,7 @@ .\" .\" $Id$ .\" -.Dd September 1, 2000 +.Dd May 15, 2021 .Dt KERBEROS 8 .Os HEIMDAL .Sh NAME @@ -71,9 +71,12 @@ or .Ic ftp , without giving your password. .Pp -For more information on how Kerberos works, and other general Kerberos -questions see the Kerberos FAQ at -.Pa http://www.nrl.navy.mil/CCS/people/kenh/kerberos-faq.html . +For more information on how Kerberos works, see the tutorial at +.Lk https://kerberos.org/software/tutorial.html +or the informal +.Dq dialogue +at +.Lk https://web.mit.edu/kerberos/dialogue.html . .Pp For setup instructions see the Heimdal Texinfo manual. .Sh SEE ALSO From owner-dev-commits-src-main@freebsd.org Sun May 16 09:13:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 833C863B84E; Sun, 16 May 2021 09:13:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fjc4b3L99z4qJK; Sun, 16 May 2021 09:13:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B159163CC; Sun, 16 May 2021 09:13:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14G9DJ7N074278; Sun, 16 May 2021 09:13:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14G9DJT1074277; Sun, 16 May 2021 09:13:19 GMT (envelope-from git) Date: Sun, 16 May 2021 09:13:19 GMT Message-Id: <202105160913.14G9DJT1074277@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: 5365af662c78 - main - loader: gfx_fb_drawrect should use GfxFbBltVideoFill MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5365af662c78d7bded3bf83c7271d6bff17229a9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 May 2021 09:13:19 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=5365af662c78d7bded3bf83c7271d6bff17229a9 commit 5365af662c78d7bded3bf83c7271d6bff17229a9 Author: Toomas Soome AuthorDate: 2021-05-11 18:05:12 +0000 Commit: Toomas Soome CommitDate: 2021-05-16 08:22:37 +0000 loader: gfx_fb_drawrect should use GfxFbBltVideoFill The gfx_fb_drawrect() is drawing rectangle by pixels, this can be very slow on some systems. Use Blt() video fill primitive instead. Testing done: Tested on mac mini 2012 where the issue was revealed Reviewed by: yuripv MFC after: 1 week --- stand/common/gfx_fb.c | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c index 3eae0a3a859e..92af49913748 100644 --- a/stand/common/gfx_fb.c +++ b/stand/common/gfx_fb.c @@ -1357,16 +1357,12 @@ isqrt(int num) return (res); } -/* set pixel in framebuffer using gfx coordinates */ -void -gfx_fb_setpixel(uint32_t x, uint32_t y) +static uint32_t +gfx_fb_getcolor(void) { uint32_t c; const teken_attr_t *ap; - if (gfx_state.tg_fb_type == FB_TEXT) - return; - ap = teken_get_curattr(&gfx_state.tg_teken); if (ap->ta_format & TF_REVERSE) { c = ap->ta_bgcolor; @@ -1378,7 +1374,19 @@ gfx_fb_setpixel(uint32_t x, uint32_t y) c |= TC_LIGHT; } - c = gfx_fb_color_map(c); + return (gfx_fb_color_map(c)); +} + +/* set pixel in framebuffer using gfx coordinates */ +void +gfx_fb_setpixel(uint32_t x, uint32_t y) +{ + uint32_t c; + + if (gfx_state.tg_fb_type == FB_TEXT) + return; + + c = gfx_fb_getcolor(); if (x >= gfx_state.tg_fb.fb_width || y >= gfx_state.tg_fb.fb_height) @@ -1389,25 +1397,26 @@ gfx_fb_setpixel(uint32_t x, uint32_t y) /* * draw rectangle in framebuffer using gfx coordinates. - * The function is borrowed from vt_fb.c */ void gfx_fb_drawrect(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t fill) { - uint32_t x, y; + uint32_t c; if (gfx_state.tg_fb_type == FB_TEXT) return; - for (y = y1; y <= y2; y++) { - if (fill || (y == y1) || (y == y2)) { - for (x = x1; x <= x2; x++) - gfx_fb_setpixel(x, y); - } else { - gfx_fb_setpixel(x1, y); - gfx_fb_setpixel(x2, y); - } + c = gfx_fb_getcolor(); + + if (fill != 0) { + gfxfb_blt(&c, GfxFbBltVideoFill, 0, 0, x1, y1, x2 - x1, + y2 - y1, 0); + } else { + gfxfb_blt(&c, GfxFbBltVideoFill, 0, 0, x1, y1, x2 - x1, 1, 0); + gfxfb_blt(&c, GfxFbBltVideoFill, 0, 0, x1, y2, x2 - x1, 1, 0); + gfxfb_blt(&c, GfxFbBltVideoFill, 0, 0, x1, y1, 1, y2 - y1, 0); + gfxfb_blt(&c, GfxFbBltVideoFill, 0, 0, x2, y1, 1, y2 - y1, 0); } } From owner-dev-commits-src-main@freebsd.org Sun May 16 10:45:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1700A63D917; Sun, 16 May 2021 10:45:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fjf7404Wrz3Gv9; Sun, 16 May 2021 10:45:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E051F1760E; Sun, 16 May 2021 10:45:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14GAjZ1S093218; Sun, 16 May 2021 10:45:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14GAjZIL093217; Sun, 16 May 2021 10:45:35 GMT (envelope-from git) Date: Sun, 16 May 2021 10:45:35 GMT Message-Id: <202105161045.14GAjZIL093217@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 0f206cc91279 - main - cam: add missing zeroing of a stack-allocated CCB. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0f206cc91279e630ad9e733eb6e330b7dbe6c70e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 May 2021 10:45:36 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=0f206cc91279e630ad9e733eb6e330b7dbe6c70e commit 0f206cc91279e630ad9e733eb6e330b7dbe6c70e Author: Edward Tomasz Napierala AuthorDate: 2021-05-16 09:28:04 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-16 10:38:26 +0000 cam: add missing zeroing of a stack-allocated CCB. This could cause a panic at boot. Reported By: Shawn Webb Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. --- sys/cam/ata/ata_xpt.c | 1 + sys/cam/scsi/scsi_xpt.c | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/cam/ata/ata_xpt.c b/sys/cam/ata/ata_xpt.c index c13c7b493c78..2e3f862cbf41 100644 --- a/sys/cam/ata/ata_xpt.c +++ b/sys/cam/ata/ata_xpt.c @@ -2187,6 +2187,7 @@ ata_announce_periph_sbuf(struct cam_periph *periph, struct sbuf *sb) struct ccb_trans_settings cts; u_int speed, mb; + bzero(&cts, sizeof(cts)); _ata_announce_periph(periph, &cts, &speed); if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) return; diff --git a/sys/cam/scsi/scsi_xpt.c b/sys/cam/scsi/scsi_xpt.c index bdc23e4b51b7..5097802c4063 100644 --- a/sys/cam/scsi/scsi_xpt.c +++ b/sys/cam/scsi/scsi_xpt.c @@ -3154,6 +3154,7 @@ scsi_announce_periph(struct cam_periph *periph) struct ccb_trans_settings cts; u_int speed, freq, mb; + memset(&cts, 0, sizeof(cts)); _scsi_announce_periph(periph, &speed, &freq, &cts); if (cam_ccb_status((union ccb *)&cts) != CAM_REQ_CMP) return; From owner-dev-commits-src-main@freebsd.org Sun May 16 12:40:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8816D640E8B; Sun, 16 May 2021 12:40:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fjhh23RQ9z3lWy; Sun, 16 May 2021 12:40:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F345187EB; Sun, 16 May 2021 12:40:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14GCeo57047750; Sun, 16 May 2021 12:40:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14GCeoNl047749; Sun, 16 May 2021 12:40:50 GMT (envelope-from git) Date: Sun, 16 May 2021 12:40:50 GMT Message-Id: <202105161240.14GCeoNl047749@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 8252fe56a0ed - main - cam: Fix race condition in dainit() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8252fe56a0edc95f55b203424a8f2f957959e7a4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 May 2021 12:40:50 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=8252fe56a0edc95f55b203424a8f2f957959e7a4 commit 8252fe56a0edc95f55b203424a8f2f957959e7a4 Author: Edward Tomasz Napierala AuthorDate: 2021-05-16 09:35:31 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-16 12:36:54 +0000 cam: Fix race condition in dainit() Previously, daregister() could have been called before dainit() initialized the UMA zone. This would trip a KASSERT. Reported By: pho Tested By: pho Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. --- sys/cam/scsi/scsi_da.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index 05dd9b6e7566..cf6e2e17e410 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -2001,6 +2001,10 @@ dainit(void) { cam_status status; + da_ccb_zone = uma_zcreate("da_ccb", + sizeof(struct ccb_scsiio), NULL, NULL, NULL, NULL, + UMA_ALIGN_PTR, 0); + /* * Install a global async callback. This callback will * receive async callbacks like "new device found". @@ -2016,10 +2020,6 @@ dainit(void) NULL, SHUTDOWN_PRI_DEFAULT)) == NULL) printf("dainit: shutdown event registration failed!\n"); } - - da_ccb_zone = uma_zcreate("da_ccb", - sizeof(struct ccb_scsiio), NULL, NULL, NULL, NULL, - UMA_ALIGN_PTR, 0); } /* From owner-dev-commits-src-main@freebsd.org Sun May 16 16:55:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A84D9628C29; Sun, 16 May 2021 16:55:21 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FjpKj49SVz4n53; Sun, 16 May 2021 16:55:21 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk1-x734.google.com with SMTP id o27so3640219qkj.9; Sun, 16 May 2021 09:55:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=myAaqOW72vhosiqprMnDFN1trSIm4iOk05JdaY8VWFI=; b=bTnwqbEdRCH2CuLyhfBtDZ5C8Z/ApTAIOEax0932HUdRBrXRcHPe01xYT1TB0D6MFe UOY4g+/oCPd64eRpVBrXh+rpjSsoXVmeL5AESqd6q0lRcsVcaBJqyBf1ui2q/kVrhxUD QJXQ9vp4Zt2RhYZNBl8nHW8OGO/+NIFudGa5mbo096axxJcfGsfLjBjs/5F+HHePX0f2 VmWAFbv+eerHPg0+TQiWLFCu8wMnLF+BFwBIXUUSR6TAZIM6MSOg+Lydpqj13BwTXaBa bxynSpWIkE1Zgua/epdASCL35xtzb9dAGZwf8BSFGkKggdF+L1nXsNSLWPPzDSlW0V8V LgiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=myAaqOW72vhosiqprMnDFN1trSIm4iOk05JdaY8VWFI=; b=H71Q+/dINwShPfSXmoyqMTnrSj/lCq63wd9vMb9m1QdSKYNcHaD6Vthev8ZCbiewbx 0l1SPmzOVzoMlzsjwVja7PEX5iqllZtdmPp2/lz2JuvpgynT/0RWVWViFr5Hn4MzD8pW /VRFYHiFxSnlzzyh59eEihiGyLHp3c6YJdwKRH9MhhmfarWD+qfcJG7EubA7Go/vwDWe wdrmM5ofYQDpxkyrUEgq61ky83RdFgqJpnXVaab15Zc3Q3qdiYMGvFMQTHmLvxvBEu0g bGqNqvcBFZAUZ8yZxuQ/KDefpvWCBs+dgLTY+l0ECjibK4cbK3leUkEvvLXIRiHgRiWj JiHQ== X-Gm-Message-State: AOAM5316mLv3Ru1l7IcO+dd/T04HZRo9sDOTbBdryJyRuRRU4P1QfFFZ DW/wifxLqPzp5vq7YWgBGmvrqdg499naaA== X-Google-Smtp-Source: ABdhPJyt86hQotUc3VmNuJu9uClqlCoeE8mtQTPJOhOcWOMOZ3nhGAcnFe3mRzdXapjuKHq9l+RG2w== X-Received: by 2002:a05:620a:9d6:: with SMTP id y22mr42975860qky.432.1621184120577; Sun, 16 May 2021 09:55:20 -0700 (PDT) Received: from nuc ([142.126.163.177]) by smtp.gmail.com with ESMTPSA id y6sm8841357qkd.106.2021.05.16.09.55.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 May 2021 09:55:20 -0700 (PDT) Sender: Mark Johnston Date: Sun, 16 May 2021 12:55:20 -0400 From: Mark Johnston To: Edward Tomasz Napierala Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 0f206cc91279 - main - cam: add missing zeroing of a stack-allocated CCB. Message-ID: References: <202105161045.14GAjZIL093217@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202105161045.14GAjZIL093217@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4FjpKj49SVz4n53 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 May 2021 16:55:21 -0000 On Sun, May 16, 2021 at 10:45:35AM +0000, Edward Tomasz Napierala wrote: > The branch main has been updated by trasz: > > URL: https://cgit.FreeBSD.org/src/commit/?id=0f206cc91279e630ad9e733eb6e330b7dbe6c70e > > commit 0f206cc91279e630ad9e733eb6e330b7dbe6c70e > Author: Edward Tomasz Napierala > AuthorDate: 2021-05-16 09:28:04 +0000 > Commit: Edward Tomasz Napierala > CommitDate: 2021-05-16 10:38:26 +0000 > > cam: add missing zeroing of a stack-allocated CCB. > > This could cause a panic at boot. There are other instances of this, for example syzbot is currently hitting an assertion, seemingly because the alloc_flags field of a stack-allocated CCB was not zeroed: https://syzkaller.appspot.com/bug?extid=2e9ce63919709feb3d1c I think the patch below will fix it, but I did not audit other callers. It feels a bit strange to require all callers of xpt_setup_ccb() to manually zero the structure first, can we provide a single routine to initialize stack-allocated CCBs? diff --git a/sys/dev/virtio/scsi/virtio_scsi.c b/sys/dev/virtio/scsi/virtio_scsi.c index 51d9e5f532f7..adf4fd17fc5b 100644 --- a/sys/dev/virtio/scsi/virtio_scsi.c +++ b/sys/dev/virtio/scsi/virtio_scsi.c @@ -700,6 +700,7 @@ vtscsi_register_async(struct vtscsi_softc *sc) { struct ccb_setasync csa; + memset(&csa, 0, sizeof(csa)); xpt_setup_ccb(&csa.ccb_h, sc->vtscsi_path, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = AC_LOST_DEVICE | AC_FOUND_DEVICE; @@ -716,6 +717,7 @@ vtscsi_deregister_async(struct vtscsi_softc *sc) { struct ccb_setasync csa; + memset(&csa, 0, sizeof(csa)); xpt_setup_ccb(&csa.ccb_h, sc->vtscsi_path, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = 0; From owner-dev-commits-src-main@freebsd.org Sun May 16 17:27:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 43AAB629B55 for ; Sun, 16 May 2021 17:27:57 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fjq3K0wJyz4s27 for ; Sun, 16 May 2021 17:27:56 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82d.google.com with SMTP id j11so3297867qtn.12 for ; Sun, 16 May 2021 10:27:56 -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=Vq3Su//bgkIJZX5L6/plp06s8ZYj72lwnbBMdimOgmk=; b=BkFQh9dFjSXNoe64TOHag0i+9LcvAbjV7+LB7575mowd90hjsQmmNiRXNAcTrgfsEL XP0A71kihfn3Zyt5/99sANQgDd3KZqbSeV7hFr2DXv/z4eW4WRuQi94xYVYD90gqilXL XXiZxiHV1kok4TMdAUJAAcYvvqcxTylpxo0gr34nqfLf9Wk7T0OT9Lfjr0eoh6KaJytp qQmbCS7Oy7N1s7Z6Qw/svHO75e3x0IIBGXdCU4u/l5/TXOXVgpIKTabmfY8RJWhGmsLG VXT1n5snkbm1o9xgnKKbs5qInGsd/h5k6kPfn1IREa5HNjUNnAxpL8jK2lgbpGfXVEwa 5w2g== 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=Vq3Su//bgkIJZX5L6/plp06s8ZYj72lwnbBMdimOgmk=; b=GLtge5glE7JkzodIXHWj6wZhaStPv7K5TriBzf+dRA7C7v0lEkc6r7oimUtGWY7Leh y1OLqp/i4qArRH6OrBHj4Tl9fujf0VvfjDN+/2AulXjdQL03i2QmHahhVA/AZw2z/26y DVwzoNRHTJVJspRWoLAwuWNYCwqmtaOE8T0B4AQVX40YbcevuPYQAfYC5U6uZ3tAJJFg e9tmPGI5rOUog+Rszsf53Wh3dbBU0Hcbd7zuGmXnPO4W0pHUf9zvqph2zkW+7/2xIQpm oPj8m62YrkDQX1s7Xt4U3kHQRQayvYkSXLgI7MgmAwroC2pdbss3DvdPh5tO04LjX0Z6 A/ow== X-Gm-Message-State: AOAM533Bf4Kr5wThxD+vBnJhDFHYTeaX5difpNwPa8npjkLKYUwf2Y56 lf49bTln7cuxLb3LOkngXQsdfTIY7U8jSIoQcrQYuw== X-Google-Smtp-Source: ABdhPJydZS6wTHdOJZWQYbmMK32O9TYOIk54C4VDXfuLltbd3NI+GQRTzh+zzruiWUDXpFwhglWbRclf0Px5XSaaaYU= X-Received: by 2002:a05:622a:588:: with SMTP id c8mr42429415qtb.49.1621186075894; Sun, 16 May 2021 10:27:55 -0700 (PDT) MIME-Version: 1.0 References: <202105161045.14GAjZIL093217@gitrepo.freebsd.org> In-Reply-To: From: Warner Losh Date: Sun, 16 May 2021 12:27:44 -0500 Message-ID: Subject: Re: git: 0f206cc91279 - main - cam: add missing zeroing of a stack-allocated CCB. To: Mark Johnston Cc: Edward Tomasz Napierala , src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4Fjq3K0wJyz4s27 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 May 2021 17:27:57 -0000 On Sun, May 16, 2021, 11:55 AM Mark Johnston wrote: > On Sun, May 16, 2021 at 10:45:35AM +0000, Edward Tomasz Napierala wrote: > > The branch main has been updated by trasz: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=0f206cc91279e630ad9e733eb6e330b7dbe6c70e > > > > commit 0f206cc91279e630ad9e733eb6e330b7dbe6c70e > > Author: Edward Tomasz Napierala > > AuthorDate: 2021-05-16 09:28:04 +0000 > > Commit: Edward Tomasz Napierala > > CommitDate: 2021-05-16 10:38:26 +0000 > > > > cam: add missing zeroing of a stack-allocated CCB. > > > > This could cause a panic at boot. > > There are other instances of this, for example syzbot is currently > hitting an assertion, seemingly because the alloc_flags field of a > stack-allocated CCB was not zeroed: > https://syzkaller.appspot.com/bug?extid=2e9ce63919709feb3d1c > > I think the patch below will fix it, but I did not audit other callers. > It feels a bit strange to require all callers of xpt_setup_ccb() to > manually zero the structure first, can we provide a single routine to > initialize stack-allocated CCBs? > If we did, we could set a flag we could assert on, and/or do static analysis to find any others... Warner diff --git a/sys/dev/virtio/scsi/virtio_scsi.c > b/sys/dev/virtio/scsi/virtio_scsi.c > index 51d9e5f532f7..adf4fd17fc5b 100644 > --- a/sys/dev/virtio/scsi/virtio_scsi.c > +++ b/sys/dev/virtio/scsi/virtio_scsi.c > @@ -700,6 +700,7 @@ vtscsi_register_async(struct vtscsi_softc *sc) > { > struct ccb_setasync csa; > > + memset(&csa, 0, sizeof(csa)); > xpt_setup_ccb(&csa.ccb_h, sc->vtscsi_path, 5); > csa.ccb_h.func_code = XPT_SASYNC_CB; > csa.event_enable = AC_LOST_DEVICE | AC_FOUND_DEVICE; > @@ -716,6 +717,7 @@ vtscsi_deregister_async(struct vtscsi_softc *sc) > { > struct ccb_setasync csa; > > + memset(&csa, 0, sizeof(csa)); > xpt_setup_ccb(&csa.ccb_h, sc->vtscsi_path, 5); > csa.ccb_h.func_code = XPT_SASYNC_CB; > csa.event_enable = 0; > From owner-dev-commits-src-main@freebsd.org Sun May 16 17:41:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 220DA62A33D; Sun, 16 May 2021 17:41:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FjqM20Wd2z4tCD; Sun, 16 May 2021 17:41:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE1DD1D00A; Sun, 16 May 2021 17:41:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14GHfXwv049651; Sun, 16 May 2021 17:41:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14GHfXXF049650; Sun, 16 May 2021 17:41:33 GMT (envelope-from git) Date: Sun, 16 May 2021 17:41:33 GMT Message-Id: <202105161741.14GHfXXF049650@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: 687e510e5ce3 - main - netgraph/ng_checksum: Fix double free error MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 687e510e5ce32fddf46a9dc1d517ccc8a8e25581 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 May 2021 17:41:34 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=687e510e5ce32fddf46a9dc1d517ccc8a8e25581 commit 687e510e5ce32fddf46a9dc1d517ccc8a8e25581 Author: Lutz Donnerhacke AuthorDate: 2021-05-15 09:32:57 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-16 17:39:51 +0000 netgraph/ng_checksum: Fix double free error m_pullup(9) frees the mbuf(9) chain in the case of an allocation error. The mbuf chain must not be freed again in this case. PR: 255874 Submitted by: Approved by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30273 --- sys/netgraph/ng_checksum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netgraph/ng_checksum.c b/sys/netgraph/ng_checksum.c index 682375c805da..3b542bd86acc 100644 --- a/sys/netgraph/ng_checksum.c +++ b/sys/netgraph/ng_checksum.c @@ -682,9 +682,9 @@ bypass: return (error); done: + NG_FREE_M(m); drop: NG_FREE_ITEM(item); - NG_FREE_M(m); priv->stats.dropped++; From owner-dev-commits-src-main@freebsd.org Sun May 16 17:44:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 08AE262A83E; Sun, 16 May 2021 17:44:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FjqQC6lTjz4tj4; Sun, 16 May 2021 17:44:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CEB071D190; Sun, 16 May 2021 17:44:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14GHiJOM054601; Sun, 16 May 2021 17:44:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14GHiJrd054600; Sun, 16 May 2021 17:44:19 GMT (envelope-from git) Date: Sun, 16 May 2021 17:44:19 GMT Message-Id: <202105161744.14GHiJrd054600@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: fb580451456a - main - linux: Fix SMAP-enabled futex routines MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fb580451456aa769daa2f4b2f077e39692f80c62 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 May 2021 17:44:20 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fb580451456aa769daa2f4b2f077e39692f80c62 commit fb580451456aa769daa2f4b2f077e39692f80c62 Author: Mark Johnston AuthorDate: 2021-05-16 17:41:41 +0000 Commit: Mark Johnston CommitDate: 2021-05-16 17:42:08 +0000 linux: Fix SMAP-enabled futex routines Some of them were dereferencing the user pointer before disabling SMAP. PR: 255591 Reviewed by: kib Tested by: pitwuu@gmail.com Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30276 --- sys/amd64/linux/linux_support.s | 12 ++++++------ sys/amd64/linux32/linux32_support.s | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/amd64/linux/linux_support.s b/sys/amd64/linux/linux_support.s index 391f76414f22..45eb565f667d 100644 --- a/sys/amd64/linux/linux_support.s +++ b/sys/amd64/linux/linux_support.s @@ -126,16 +126,16 @@ ENTRY(futex_orl_smap) movq $VM_MAXUSER_ADDRESS-4,%rax cmpq %rax,%rsi ja futex_fault + stac movl (%rsi),%eax 1: movl %eax,%ecx orl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8) @@ -168,16 +168,16 @@ ENTRY(futex_andl_smap) movq $VM_MAXUSER_ADDRESS-4,%rax cmpq %rax,%rsi ja futex_fault + stac movl (%rsi),%eax 1: movl %eax,%ecx andl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8) @@ -210,16 +210,16 @@ ENTRY(futex_xorl_smap) movq $VM_MAXUSER_ADDRESS-4,%rax cmpq %rax,%rsi ja futex_fault + stac movl (%rsi),%eax 1: movl %eax,%ecx xorl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8) diff --git a/sys/amd64/linux32/linux32_support.s b/sys/amd64/linux32/linux32_support.s index 981bba9f5821..f3ec3bd8c776 100644 --- a/sys/amd64/linux32/linux32_support.s +++ b/sys/amd64/linux32/linux32_support.s @@ -126,16 +126,16 @@ ENTRY(futex_orl_smap) movq $VM_MAXUSER_ADDRESS-4,%rax cmpq %rax,%rsi ja futex_fault + stac movl (%rsi),%eax 1: movl %eax,%ecx orl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8) @@ -169,15 +169,15 @@ ENTRY(futex_andl_smap) cmpq %rax,%rsi ja futex_fault movl (%rsi),%eax + stac 1: movl %eax,%ecx andl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8) @@ -210,16 +210,16 @@ ENTRY(futex_xorl_smap) movq $VM_MAXUSER_ADDRESS-4,%rax cmpq %rax,%rsi ja futex_fault + stac movl (%rsi),%eax 1: movl %eax,%ecx xorl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8) From owner-dev-commits-src-main@freebsd.org Sun May 16 18:03:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3BA162B1A7; Sun, 16 May 2021 18:03:28 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FjqrJ5HWfz3CW8; Sun, 16 May 2021 18:03:28 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-wr1-x431.google.com with SMTP id i17so4075659wrq.11; Sun, 16 May 2021 11:03:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to; bh=RJd8EkduXX1rOocBDVC1ceaIUceaXDSc4J8sp+3rY0E=; b=OnkmTGeijHITWrzexNz32ko0Yg2nlraovElXAOFNnrxCPqiQtLYEFFkAmYyuxT6Z0W fpgQQz0G0x4YpGAbEHVbLtjUNOKBmPol7Q6FyFJrQSjpnBFKiSTn2M1bGVhXjaLG9g44 HFc5tpWj6pylpec+pgHzDvxwdXcE2dqAIB2FxtyQ65XXQHrQaCL7g06NIY8GcfVeTSvA X2PfshR+7WMycR1LlX3cqe8kWh9AL/PUq+BSo/oW46rlwn/mKWHcfYAx3R47miQDz5mo 9u2gwKEiuFo8aFbTwe9RMDK1pLvSl+CO471rpq4p6n+OeSE33mYVdsJu56V284fcNUzk A0fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=RJd8EkduXX1rOocBDVC1ceaIUceaXDSc4J8sp+3rY0E=; b=ryyPzp2e2JCYebJ4OFdZLvDS4QmjH5HOAKUq4RHL751g4z7NwPU8q2W4ra7YCWr5DF QeeMCR4tSO5OrJ76VnOB27H3zub0cImJ7mU95+VZfsAhc7ojK2BnruTlTLUF/CnLtaSt Pn5yxgvmWAOPInqz037CxWPM6I3RGXtc45U/uyHCeVIXtuhzH6uW2KfgvPio5m8Y4W5C Gk+DXbMU6nkgUMUVuXPrsFLYvrZSjIVueb/BvvHOLIep1rJJBILpH930heCMEsQyx1BJ Yzp6wPLpSbC3ltEx8GvmKAXUak2fAYPWHJHVwt2GCUh/SwxI0C+T43ZlrtgUKGbNAqNd S/Nw== X-Gm-Message-State: AOAM5303VnZC1OYJLdgw2lk6xIMYqjkL/J7u62OMgt6kYbC3xo8rtW1A hNHOZ4d9Adw5WFwPHdaONCAAoQPasq0= X-Google-Smtp-Source: ABdhPJxwF1GbGE36PPtBMJ95CEir7aZlYkN79Tv1m01fmVv8BhvQbQ4quJkzgJo18Foibh70BWl4TQ== X-Received: by 2002:a05:6000:1ac7:: with SMTP id i7mr71075228wry.380.1621188206578; Sun, 16 May 2021 11:03:26 -0700 (PDT) Received: from brick (cpc159423-cmbg20-2-0-cust338.5-4.cable.virginm.net. [86.7.147.83]) by smtp.gmail.com with ESMTPSA id y14sm14129240wrr.82.2021.05.16.11.03.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 May 2021 11:03:25 -0700 (PDT) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Sun, 16 May 2021 19:03:24 +0100 From: Edward Tomasz Napierala To: Warner Losh Cc: Mark Johnston , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 0f206cc91279 - main - cam: add missing zeroing of a stack-allocated CCB. Message-ID: Mail-Followup-To: Warner Losh , Mark Johnston , src-committers , "" , dev-commits-src-main@freebsd.org References: <202105161045.14GAjZIL093217@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4FjqrJ5HWfz3CW8 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 May 2021 18:03:28 -0000 On 0516T1227, Warner Losh wrote: > On Sun, May 16, 2021, 11:55 AM Mark Johnston wrote: > > > On Sun, May 16, 2021 at 10:45:35AM +0000, Edward Tomasz Napierala wrote: > > > The branch main has been updated by trasz: > > > > > > URL: > > https://cgit.FreeBSD.org/src/commit/?id=0f206cc91279e630ad9e733eb6e330b7dbe6c70e > > > > > > commit 0f206cc91279e630ad9e733eb6e330b7dbe6c70e > > > Author: Edward Tomasz Napierala > > > AuthorDate: 2021-05-16 09:28:04 +0000 > > > Commit: Edward Tomasz Napierala > > > CommitDate: 2021-05-16 10:38:26 +0000 > > > > > > cam: add missing zeroing of a stack-allocated CCB. > > > > > > This could cause a panic at boot. > > > > There are other instances of this, for example syzbot is currently > > hitting an assertion, seemingly because the alloc_flags field of a > > stack-allocated CCB was not zeroed: > > https://syzkaller.appspot.com/bug?extid=2e9ce63919709feb3d1c > > > > I think the patch below will fix it, but I did not audit other callers. > > It feels a bit strange to require all callers of xpt_setup_ccb() to > > manually zero the structure first, can we provide a single routine to > > initialize stack-allocated CCBs? We definitely could, although in some cases it's a bit more complicated than that - a function that gets passed a CCB and then calls xpt_setup_ccb() to fill it shouldn't zero it, as that would be making assumption on how the CCB passed to it was allocated. Now that I look at the code, I can definitely see that I've missed a couple of places. Perhaps I should replace those two KASSERTs with diagnostic printfs for now, until I get that sorted out? > If we did, we could set a flag we could assert on, and/or do static > analysis to find any others... That sounds promising, except I've never done anything like that; I don't even know where to start. From owner-dev-commits-src-main@freebsd.org Sun May 16 19:19:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 09EE762DF65; Sun, 16 May 2021 19:19:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FjsX76rXXz3MqF; Sun, 16 May 2021 19:19:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D173E1E2AE; Sun, 16 May 2021 19:19:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14GJJZOi074699; Sun, 16 May 2021 19:19:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14GJJZu0074697; Sun, 16 May 2021 19:19:35 GMT (envelope-from git) Date: Sun, 16 May 2021 19:19:35 GMT Message-Id: <202105161919.14GJJZu0074697@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 75b5caa08ef2 - main - cam: turn KASSERTs into printfs for now MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 75b5caa08ef286b484aee6ddae61582b8b7ac407 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 May 2021 19:19:36 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=75b5caa08ef286b484aee6ddae61582b8b7ac407 commit 75b5caa08ef286b484aee6ddae61582b8b7ac407 Author: Edward Tomasz Napierala AuthorDate: 2021-05-16 19:11:46 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-05-16 19:19:19 +0000 cam: turn KASSERTs into printfs for now It looks like I've missed a couple of places where we don't clear stack-allocated CCBs. Don't panic when that happens, just print a warning. This is a temporary measure until I get those cases fixed. Reviewed By: markj Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D30296 --- sys/cam/ata/ata_xpt.c | 8 ++++++++ sys/cam/scsi/scsi_xpt.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/sys/cam/ata/ata_xpt.c b/sys/cam/ata/ata_xpt.c index 2e3f862cbf41..08ce945a0938 100644 --- a/sys/cam/ata/ata_xpt.c +++ b/sys/cam/ata/ata_xpt.c @@ -1796,10 +1796,18 @@ ata_action(union ccb *start_ccb) { if (start_ccb->ccb_h.func_code != XPT_ATA_IO) { +#ifdef notyet KASSERT((start_ccb->ccb_h.alloc_flags & CAM_CCB_FROM_UMA) == 0, ("%s: ccb %p, func_code %#x should not be allocated " "from UMA zone\n", __func__, start_ccb, start_ccb->ccb_h.func_code)); +#else + if ((start_ccb->ccb_h.alloc_flags & CAM_CCB_FROM_UMA) != 0) { + printf("%s: ccb %p, func_code %#x should not be allocated " + "from UMA zone\n", + __func__, start_ccb, start_ccb->ccb_h.func_code); + } +#endif } switch (start_ccb->ccb_h.func_code) { diff --git a/sys/cam/scsi/scsi_xpt.c b/sys/cam/scsi/scsi_xpt.c index 5097802c4063..b88e1869b880 100644 --- a/sys/cam/scsi/scsi_xpt.c +++ b/sys/cam/scsi/scsi_xpt.c @@ -2626,10 +2626,18 @@ scsi_action(union ccb *start_ccb) { if (start_ccb->ccb_h.func_code != XPT_SCSI_IO) { +#ifdef notyet KASSERT((start_ccb->ccb_h.alloc_flags & CAM_CCB_FROM_UMA) == 0, ("%s: ccb %p, func_code %#x should not be allocated " "from UMA zone\n", __func__, start_ccb, start_ccb->ccb_h.func_code)); +#else + if ((start_ccb->ccb_h.alloc_flags & CAM_CCB_FROM_UMA) != 0) { + printf("%s: ccb %p, func_code %#x should not be allocated " + "from UMA zone\n", + __func__, start_ccb, start_ccb->ccb_h.func_code); + } +#endif } switch (start_ccb->ccb_h.func_code) { From owner-dev-commits-src-main@freebsd.org Sun May 16 23:43:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 379C2635EA8; Sun, 16 May 2021 23:43:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FjzN615drz4pLl; Sun, 16 May 2021 23:43:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0D5FC21C73; Sun, 16 May 2021 23:43:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14GNh1mT031584; Sun, 16 May 2021 23:43:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14GNh1fS031583; Sun, 16 May 2021 23:43:01 GMT (envelope-from git) Date: Sun, 16 May 2021 23:43:01 GMT Message-Id: <202105162343.14GNh1fS031583@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 46269d66ed02 - main - NFSv4 server: Re-establish the delegation recall timeout MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 46269d66ed02598c86756d81a7d7b27ec0f0c5cd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 May 2021 23:43:02 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=46269d66ed02598c86756d81a7d7b27ec0f0c5cd commit 46269d66ed02598c86756d81a7d7b27ec0f0c5cd Author: Rick Macklem AuthorDate: 2021-05-16 23:40:01 +0000 Commit: Rick Macklem CommitDate: 2021-05-16 23:40:01 +0000 NFSv4 server: Re-establish the delegation recall timeout Commit 7a606f280a3e allowed the server to do retries of CB_RECALL callbacks every couple of seconds. This was needed to allow the Linux client to re-establish the back channel. However this patch broke the delegation timeout check, such that it would just keep retrying CB_RECALLS. If the client has crashed or been network patitioned from the server, this continues until the client TCP reconnects to the server and re-establishes the back channel. This patch modifies the code such that it still times out the delegation recall after some minutes, so that the server will allow the conflicting client request once the delegation times out. This patch only affects the NFSv4 server when delegations are enabled and a NFSv4 client that holds a delegation has crashed or been network partitioned from the server for at least several minutes when a delegation needs to be recalled. MFC after: 2 weeks --- sys/fs/nfsserver/nfs_nfsdstate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index 3aebddad0962..c16d5b8afdc8 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -5292,8 +5292,9 @@ nfsrv_delegconflict(struct nfsstate *stp, int *haslockp, NFSPROC_T *p, * - check to see if the delegation has expired * - if so, get the v4root lock and then expire it */ - if ((stp->ls_flags & NFSLCK_DELEGRECALL) == 0 || stp->ls_lastrecall < - time_uptime) { + if ((stp->ls_flags & NFSLCK_DELEGRECALL) == 0 || (stp->ls_lastrecall < + NFSD_MONOSEC && clp->lc_expiry >= NFSD_MONOSEC && + stp->ls_delegtime >= NFSD_MONOSEC)) { /* * - do a recall callback, since not yet done * For now, never allow truncate to be set. To use