Re: svn commit: r349505 - head/contrib/bzip2

2019-06-27 Thread Kubilay Kocak

On 28/06/2019 3:11 pm, Xin LI wrote:

Author: delphij
Date: Fri Jun 28 05:11:02 2019
New Revision: 349505
URL: https://svnweb.freebsd.org/changeset/base/349505

Log:
   Upgrade to Bzip2 version 1.0.7.


PR: 238843


   MFC after:   3 days

Modified:
   head/contrib/bzip2/CHANGES
   head/contrib/bzip2/LICENSE
   head/contrib/bzip2/README
   head/contrib/bzip2/README.COMPILATION.PROBLEMS
   head/contrib/bzip2/blocksort.c
   head/contrib/bzip2/bzip2.1
   head/contrib/bzip2/bzip2.c
   head/contrib/bzip2/bzip2recover.c
   head/contrib/bzip2/bzlib.c
   head/contrib/bzip2/bzlib.h
   head/contrib/bzip2/bzlib_private.h
   head/contrib/bzip2/compress.c
   head/contrib/bzip2/crctable.c
   head/contrib/bzip2/decompress.c
   head/contrib/bzip2/huffman.c
   head/contrib/bzip2/randtable.c
   head/contrib/bzip2/spewG.c
   head/contrib/bzip2/unzcrash.c
   head/contrib/bzip2/words2
Directory Properties:
   head/contrib/bzip2/   (props changed)

Modified: head/contrib/bzip2/CHANGES
==
--- head/contrib/bzip2/CHANGES  Fri Jun 28 04:52:24 2019(r349504)
+++ head/contrib/bzip2/CHANGES  Fri Jun 28 05:11:02 2019(r349505)
@@ -2,8 +2,8 @@
   This file is part of bzip2/libbzip2, a program and library for
   lossless, block-sorting data compression.
  
- bzip2/libbzip2 version 1.0.6 of 6 September 2010

- Copyright (C) 1996-2010 Julian Seward 
+ bzip2/libbzip2 version 1.0.7 of 27 June 2019
+ Copyright (C) 1996-2010 Julian Seward 
  
   Please read the WARNING, DISCLAIMER and PATENTS sections in the

   README file.
@@ -325,3 +325,16 @@ Security fix only.  Fixes CERT-FI 20469 as it applies
Izdebski.
  
  * Make the documentation build on Ubuntu 10.04

+
+1.0.7 (27 Jun 19)
+~
+
+* Fix undefined behavior in the macros SET_BH, CLEAR_BH, & ISSET_BH
+
+* bzip2: Fix return value when combining --test,-t and -q.
+
+* bzip2recover: Fix buffer overflow for large argv[0]
+
+* bzip2recover: Fix use after free issue with outFile (CVE-2016-3189)
+
+* Make sure nSelectors is not out of range (CVE-2019-12900)

Modified: head/contrib/bzip2/LICENSE
==
--- head/contrib/bzip2/LICENSE  Fri Jun 28 04:52:24 2019(r349504)
+++ head/contrib/bzip2/LICENSE  Fri Jun 28 05:11:02 2019(r349505)
@@ -36,7 +36,7 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUD
  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
-Julian Seward, jsew...@bzip.org

-bzip2/libbzip2 version 1.0.6 of 6 September 2010
+Julian Seward, jsew...@acm.org
+bzip2/libbzip2 version 1.0.7 of 27 June 2019
  
  --


Modified: head/contrib/bzip2/README
==
--- head/contrib/bzip2/README   Fri Jun 28 04:52:24 2019(r349504)
+++ head/contrib/bzip2/README   Fri Jun 28 05:11:02 2019(r349505)
@@ -6,8 +6,8 @@ This version is fully compatible with the previous pub
  This file is part of bzip2/libbzip2, a program and library for
  lossless, block-sorting data compression.
  
-bzip2/libbzip2 version 1.0.6 of 6 September 2010

-Copyright (C) 1996-2010 Julian Seward 
+bzip2/libbzip2 version 1.0.7 of 27 June 2019
+Copyright (C) 1996-2010 Julian Seward 
  
  Please read the WARNING, DISCLAIMER and PATENTS sections in this file.
  
@@ -73,7 +73,7 @@ HOW TO BUILD -- Windows 95, NT, DOS, Mac, etc.
  
  It's difficult for me to support compilation on all these platforms.

  My approach is to collect binaries for these platforms, and put them
-on the master web site (http://www.bzip.org).  Look there.  However
+on the master web site (https://sourceware.org/bzip2/).  Look there.  However
  (FWIW), bzip2-1.0.X is very standard ANSI C and should compile
  unmodified with MS Visual C.  If you have difficulties building, you
  might want to read README.COMPILATION.PROBLEMS.
@@ -161,43 +161,22 @@ WHAT'S NEW IN 0.9.5 ?
 * Many small improvements in file and flag handling.
 * A Y2K statement.
  
-WHAT'S NEW IN 1.0.0 ?

+WHAT'S NEW IN 1.0.x ?
  
 See the CHANGES file.
  
-WHAT'S NEW IN 1.0.2 ?

-
-   See the CHANGES file.
-
-WHAT'S NEW IN 1.0.3 ?
-
-   See the CHANGES file.
-
-WHAT'S NEW IN 1.0.4 ?
-
-   See the CHANGES file.
-
-WHAT'S NEW IN 1.0.5 ?
-
-   See the CHANGES file.
-
-WHAT'S NEW IN 1.0.6 ?
-
-   See the CHANGES file.
-
-
  I hope you find bzip2 useful.  Feel free to contact me at
-   jsew...@bzip.org
+   jsew...@acm.org
  if you have any suggestions or queries.  Many people mailed me with
  comments, suggestions and patches after the releases of bzip-0.15,
  bzip-0.21, and bzip2 versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1,
  1.0.2 and 1.0.3, and the changes in bzip2 are largely a result of this
  feedback.  I thank you for your comments.
  
-bzip2's "home" 

svn commit: r349505 - head/contrib/bzip2

2019-06-27 Thread Xin LI
Author: delphij
Date: Fri Jun 28 05:11:02 2019
New Revision: 349505
URL: https://svnweb.freebsd.org/changeset/base/349505

Log:
  Upgrade to Bzip2 version 1.0.7.
  
  MFC after:3 days

Modified:
  head/contrib/bzip2/CHANGES
  head/contrib/bzip2/LICENSE
  head/contrib/bzip2/README
  head/contrib/bzip2/README.COMPILATION.PROBLEMS
  head/contrib/bzip2/blocksort.c
  head/contrib/bzip2/bzip2.1
  head/contrib/bzip2/bzip2.c
  head/contrib/bzip2/bzip2recover.c
  head/contrib/bzip2/bzlib.c
  head/contrib/bzip2/bzlib.h
  head/contrib/bzip2/bzlib_private.h
  head/contrib/bzip2/compress.c
  head/contrib/bzip2/crctable.c
  head/contrib/bzip2/decompress.c
  head/contrib/bzip2/huffman.c
  head/contrib/bzip2/randtable.c
  head/contrib/bzip2/spewG.c
  head/contrib/bzip2/unzcrash.c
  head/contrib/bzip2/words2
Directory Properties:
  head/contrib/bzip2/   (props changed)

Modified: head/contrib/bzip2/CHANGES
==
--- head/contrib/bzip2/CHANGES  Fri Jun 28 04:52:24 2019(r349504)
+++ head/contrib/bzip2/CHANGES  Fri Jun 28 05:11:02 2019(r349505)
@@ -2,8 +2,8 @@
  This file is part of bzip2/libbzip2, a program and library for
  lossless, block-sorting data compression.
 
- bzip2/libbzip2 version 1.0.6 of 6 September 2010
- Copyright (C) 1996-2010 Julian Seward 
+ bzip2/libbzip2 version 1.0.7 of 27 June 2019
+ Copyright (C) 1996-2010 Julian Seward 
 
  Please read the WARNING, DISCLAIMER and PATENTS sections in the 
  README file.
@@ -325,3 +325,16 @@ Security fix only.  Fixes CERT-FI 20469 as it applies 
   Izdebski.
 
 * Make the documentation build on Ubuntu 10.04
+
+1.0.7 (27 Jun 19)
+~
+
+* Fix undefined behavior in the macros SET_BH, CLEAR_BH, & ISSET_BH
+
+* bzip2: Fix return value when combining --test,-t and -q.
+
+* bzip2recover: Fix buffer overflow for large argv[0]
+
+* bzip2recover: Fix use after free issue with outFile (CVE-2016-3189)
+
+* Make sure nSelectors is not out of range (CVE-2019-12900)

Modified: head/contrib/bzip2/LICENSE
==
--- head/contrib/bzip2/LICENSE  Fri Jun 28 04:52:24 2019(r349504)
+++ head/contrib/bzip2/LICENSE  Fri Jun 28 05:11:02 2019(r349505)
@@ -36,7 +36,7 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUD
 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-Julian Seward, jsew...@bzip.org
-bzip2/libbzip2 version 1.0.6 of 6 September 2010
+Julian Seward, jsew...@acm.org
+bzip2/libbzip2 version 1.0.7 of 27 June 2019
 
 --

Modified: head/contrib/bzip2/README
==
--- head/contrib/bzip2/README   Fri Jun 28 04:52:24 2019(r349504)
+++ head/contrib/bzip2/README   Fri Jun 28 05:11:02 2019(r349505)
@@ -6,8 +6,8 @@ This version is fully compatible with the previous pub
 This file is part of bzip2/libbzip2, a program and library for
 lossless, block-sorting data compression.
 
-bzip2/libbzip2 version 1.0.6 of 6 September 2010
-Copyright (C) 1996-2010 Julian Seward 
+bzip2/libbzip2 version 1.0.7 of 27 June 2019
+Copyright (C) 1996-2010 Julian Seward 
 
 Please read the WARNING, DISCLAIMER and PATENTS sections in this file.
 
@@ -73,7 +73,7 @@ HOW TO BUILD -- Windows 95, NT, DOS, Mac, etc.
 
 It's difficult for me to support compilation on all these platforms.
 My approach is to collect binaries for these platforms, and put them
-on the master web site (http://www.bzip.org).  Look there.  However
+on the master web site (https://sourceware.org/bzip2/).  Look there.  However
 (FWIW), bzip2-1.0.X is very standard ANSI C and should compile
 unmodified with MS Visual C.  If you have difficulties building, you
 might want to read README.COMPILATION.PROBLEMS.
@@ -161,43 +161,22 @@ WHAT'S NEW IN 0.9.5 ?
* Many small improvements in file and flag handling.
* A Y2K statement.
 
-WHAT'S NEW IN 1.0.0 ?
+WHAT'S NEW IN 1.0.x ?
 
See the CHANGES file.
 
-WHAT'S NEW IN 1.0.2 ?
-
-   See the CHANGES file.
-
-WHAT'S NEW IN 1.0.3 ?
-
-   See the CHANGES file.
-
-WHAT'S NEW IN 1.0.4 ?
-
-   See the CHANGES file.
-
-WHAT'S NEW IN 1.0.5 ?
-
-   See the CHANGES file.
-
-WHAT'S NEW IN 1.0.6 ?
-
-   See the CHANGES file.
-
-
 I hope you find bzip2 useful.  Feel free to contact me at
-   jsew...@bzip.org
+   jsew...@acm.org
 if you have any suggestions or queries.  Many people mailed me with
 comments, suggestions and patches after the releases of bzip-0.15,
 bzip-0.21, and bzip2 versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1,
 1.0.2 and 1.0.3, and the changes in bzip2 are largely a result of this
 feedback.  I thank you for your comments.
 
-bzip2's "home" is http://www.bzip.org/
+bzip2's "home" is https://sourceware.org/bzip2/
 
 Julian Seward
-jsew...@bzip.org

svn commit: r349504 - head/contrib/ipfilter/man

2019-06-27 Thread Cy Schubert
Author: cy
Date: Fri Jun 28 04:52:24 2019
New Revision: 349504
URL: https://svnweb.freebsd.org/changeset/base/349504

Log:
  Fix a typo.
  
  PR:   238816
  MFC after:1 week
  X-MFC with:   r349503

Modified:
  head/contrib/ipfilter/man/ipmon.8

Modified: head/contrib/ipfilter/man/ipmon.8
==
--- head/contrib/ipfilter/man/ipmon.8   Fri Jun 28 04:28:32 2019
(r349503)
+++ head/contrib/ipfilter/man/ipmon.8   Fri Jun 28 04:52:24 2019
(r349504)
@@ -9,7 +9,7 @@ ipmon \- monitors /dev/ipl for logged packets
 ] [
 .B "\-B "
 ] [
-.B "\-B "
+.B "\-C "
 ] [
 .B "\-N "
 ] [
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349503 - head/contrib/ipfilter/man

2019-06-27 Thread Cy Schubert
Author: cy
Date: Fri Jun 28 04:28:32 2019
New Revision: 349503
URL: https://svnweb.freebsd.org/changeset/base/349503

Log:
  Document the -B, binary logfile, and the -C config file options.
  Reference the ipmon.5 man page and ipmon.conf.
  
  PR:   238816
  MFC after:1 week

Modified:
  head/contrib/ipfilter/man/ipmon.8

Modified: head/contrib/ipfilter/man/ipmon.8
==
--- head/contrib/ipfilter/man/ipmon.8   Fri Jun 28 04:18:10 2019
(r349502)
+++ head/contrib/ipfilter/man/ipmon.8   Fri Jun 28 04:28:32 2019
(r349503)
@@ -7,6 +7,10 @@ ipmon \- monitors /dev/ipl for logged packets
 [
 .B \-abBDFhnpstvxX
 ] [
+.B "\-B "
+] [
+.B "\-B "
+] [
 .B "\-N "
 ] [
 .B "\-L "
@@ -92,6 +96,10 @@ Enable logging of the raw, unformatted binary data to 
 \fI\fP file.  This can be read, later, using \fBipmon\fP
 with the \fB-f\fP option.
 .TP
+.B \-C 
+This option specifies a file to be used to specify optional extra actions
+when it sees specific log entries from the kernel.
+.TP
 .B \-D
 Cause ipmon to turn itself into a daemon.  Using subshells or backgrounding
 of ipmon is not required to turn it into an orphan so it can run indefinitely.
@@ -178,9 +186,11 @@ recorded data.
 .br
 /dev/ipstate
 .br
+/etc/ipmon.conf
+.br
 /etc/services
 .SH SEE ALSO
-ipl(4), ipf(8), ipfstat(8), ipnat(8)
+ipl(4), ipmon(5), ipf(8), ipfstat(8), ipnat(8)
 .SH BUGS
 .PP
 If you find any, please send email to me at darr...@pobox.com
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349501 - head/sys/dev/cxgbe/tom

2019-06-27 Thread Navdeep Parhar
Author: np
Date: Fri Jun 28 04:02:56 2019
New Revision: 349501
URL: https://svnweb.freebsd.org/changeset/base/349501

Log:
  cxgbe/t4_tom: Mark the socket's receive as done before calling
  handle_ddp_close.
  
  This eliminates a bad race where an aio_ddp_requeue that happened to run
  after handle_ddp_close could bump up the active count.
  
  Discussed with:   jhb@
  MFC after:3 days
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/tom/t4_cpl_io.c

Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c
==
--- head/sys/dev/cxgbe/tom/t4_cpl_io.c  Fri Jun 28 02:41:17 2019
(r349500)
+++ head/sys/dev/cxgbe/tom/t4_cpl_io.c  Fri Jun 28 04:02:56 2019
(r349501)
@@ -1253,6 +1253,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_head
tp->rcv_nxt++;  /* FIN */
 
so = inp->inp_socket;
+   socantrcvmore(so);
if (toep->ulp_mode == ULP_MODE_TCPDDP) {
DDP_LOCK(toep);
if (__predict_false(toep->ddp.flags &
@@ -1260,7 +1261,6 @@ do_peer_close(struct sge_iq *iq, const struct rss_head
handle_ddp_close(toep, tp, cpl->rcv_nxt);
DDP_UNLOCK(toep);
}
-   socantrcvmore(so);
 
if (toep->ulp_mode != ULP_MODE_RDMA) {
KASSERT(tp->rcv_nxt == be32toh(cpl->rcv_nxt),
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349500 - head/sys/dev/cxgbe/tom

2019-06-27 Thread Navdeep Parhar
Author: np
Date: Fri Jun 28 02:41:17 2019
New Revision: 349500
URL: https://svnweb.freebsd.org/changeset/base/349500

Log:
  cxgbe/t4_tom: Fix regression in t_maxseg usage within t4_tom.
  
  t_maxseg was changed in r293284 to not have any adjustment for TCP
  timestamps.  t4_tom inadvertently went back to pre-r293284 semantics
  in r332506.
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/tom/t4_cpl_io.c
  head/sys/dev/cxgbe/tom/t4_tom.c
  head/sys/dev/cxgbe/tom/t4_tom.h

Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c
==
--- head/sys/dev/cxgbe/tom/t4_cpl_io.c  Fri Jun 28 02:21:42 2019
(r349499)
+++ head/sys/dev/cxgbe/tom/t4_cpl_io.c  Fri Jun 28 02:41:17 2019
(r349500)
@@ -327,31 +327,33 @@ send_reset(struct adapter *sc, struct toepcb *toep, ui
  * reported by HW to FreeBSD's native format.
  */
 static void
-assign_rxopt(struct tcpcb *tp, unsigned int opt)
+assign_rxopt(struct tcpcb *tp, uint16_t opt)
 {
struct toepcb *toep = tp->t_toe;
struct inpcb *inp = tp->t_inpcb;
struct adapter *sc = td_adapter(toep->td);
-   int n;
 
INP_LOCK_ASSERT(inp);
 
+   toep->tcp_opt = opt;
+   toep->mtu_idx = G_TCPOPT_MSS(opt);
+   tp->t_maxseg = sc->params.mtus[toep->mtu_idx];
if (inp->inp_inc.inc_flags & INC_ISIPV6)
-   n = sizeof(struct ip6_hdr) + sizeof(struct tcphdr);
+   tp->t_maxseg -= sizeof(struct ip6_hdr) + sizeof(struct tcphdr);
else
-   n = sizeof(struct ip) + sizeof(struct tcphdr);
-   tp->t_maxseg = sc->params.mtus[G_TCPOPT_MSS(opt)] - n;
+   tp->t_maxseg -= sizeof(struct ip) + sizeof(struct tcphdr);
 
+   toep->emss = tp->t_maxseg;
if (G_TCPOPT_TSTAMP(opt)) {
tp->t_flags |= TF_RCVD_TSTMP;   /* timestamps ok */
tp->ts_recent = 0;  /* hmmm */
tp->ts_recent_age = tcp_ts_getticks();
-   tp->t_maxseg -= TCPOLEN_TSTAMP_APPA;
+   toep->emss -= TCPOLEN_TSTAMP_APPA;
}
 
-   CTR5(KTR_CXGBE, "%s: tid %d, mtu_idx %u (%u), mss %u", __func__,
-   toep->tid, G_TCPOPT_MSS(opt), sc->params.mtus[G_TCPOPT_MSS(opt)],
-   tp->t_maxseg);
+   CTR6(KTR_CXGBE, "%s: tid %d, mtu_idx %u (%u), t_maxseg %u, emss %u",
+   __func__, toep->tid, toep->mtu_idx,
+   sc->params.mtus[G_TCPOPT_MSS(opt)], tp->t_maxseg, toep->emss);
 
if (G_TCPOPT_SACK(opt))
tp->t_flags |= TF_SACK_PERMIT;  /* should already be set */
@@ -399,7 +401,7 @@ make_established(struct toepcb *toep, uint32_t iss, ui
 
tp->irs = irs;
tcp_rcvseqinit(tp);
-   tp->rcv_wnd = toep->opt0_rcv_bufsize << 10;
+   tp->rcv_wnd = (u_int)toep->opt0_rcv_bufsize << 10;
tp->rcv_adv += tp->rcv_wnd;
tp->last_ack_sent = tp->rcv_nxt;
 
@@ -421,7 +423,7 @@ make_established(struct toepcb *toep, uint32_t iss, ui
ftxp.snd_nxt = tp->snd_nxt;
ftxp.rcv_nxt = tp->rcv_nxt;
ftxp.snd_space = bufsize;
-   ftxp.mss = tp->t_maxseg;
+   ftxp.mss = toep->emss;
send_flowc_wr(toep, );
 
soisconnected(so);
@@ -613,7 +615,7 @@ write_tx_wr(void *dst, struct toepcb *toep, unsigned i
if (txalign > 0) {
struct tcpcb *tp = intotcpcb(toep->inp);
 
-   if (plen < 2 * tp->t_maxseg)
+   if (plen < 2 * toep->emss)
txwr->lsodisable_to_flags |=
htobe32(F_FW_OFLD_TX_DATA_WR_LSODISABLE);
else

Modified: head/sys/dev/cxgbe/tom/t4_tom.c
==
--- head/sys/dev/cxgbe/tom/t4_tom.c Fri Jun 28 02:21:42 2019
(r349499)
+++ head/sys/dev/cxgbe/tom/t4_tom.c Fri Jun 28 02:41:17 2019
(r349500)
@@ -851,8 +851,7 @@ remove_tid(struct adapter *sc, int tid, int ntids)
  * What mtu_idx to use, given a 4-tuple.  Note that both s->mss and tcp_mssopt
  * have the MSS that we should advertise in our SYN.  Advertised MSS doesn't
  * account for any TCP options so the effective MSS (only payload, no headers 
or
- * options) could be different.  We fill up tp->t_maxseg with the effective MSS
- * at the end of the 3-way handshake.
+ * options) could be different.
  */
 int
 find_best_mtu_idx(struct adapter *sc, struct in_conninfo *inc,

Modified: head/sys/dev/cxgbe/tom/t4_tom.h
==
--- head/sys/dev/cxgbe/tom/t4_tom.h Fri Jun 28 02:21:42 2019
(r349499)
+++ head/sys/dev/cxgbe/tom/t4_tom.h Fri Jun 28 02:41:17 2019
(r349500)
@@ -181,7 +181,10 @@ struct toepcb {
u_int tx_nocompl;   /* tx WR credits since last compl request */
u_int plen_nocompl; /* payload since last compl request */
 
-   int opt0_rcv_bufsize;   /* XXX: save full opt0/opt2 for 

svn commit: r349499 - head/sys/dev/cxgbe/iw_cxgbe

2019-06-27 Thread Navdeep Parhar
Author: np
Date: Fri Jun 28 02:21:42 2019
New Revision: 349499
URL: https://svnweb.freebsd.org/changeset/base/349499

Log:
  cxgbe/iw_cxgbe: Remove unused field from the endpoint structure.
  
  MFC after:3 days

Modified:
  head/sys/dev/cxgbe/iw_cxgbe/cm.c
  head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h

Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c
==
--- head/sys/dev/cxgbe/iw_cxgbe/cm.cFri Jun 28 02:14:54 2019
(r349498)
+++ head/sys/dev/cxgbe/iw_cxgbe/cm.cFri Jun 28 02:21:42 2019
(r349499)
@@ -528,7 +528,6 @@ set_tcpinfo(struct c4iw_ep *ep)
ep->hwtid = toep->tid;
ep->snd_seq = tp->snd_nxt;
ep->rcv_seq = tp->rcv_nxt;
-   ep->emss = max(tp->t_maxseg, 128);
 done:
INP_WUNLOCK(inp);
return (rc);

Modified: head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h
==
--- head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h  Fri Jun 28 02:14:54 2019
(r349498)
+++ head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h  Fri Jun 28 02:21:42 2019
(r349499)
@@ -862,7 +862,6 @@ struct c4iw_ep {
u32 tx_chan;
u32 mtu;
u16 mss;
-   u16 emss;
u16 plen;
u16 rss_qid;
u16 txq_idx;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349498 - head/sys/vm

2019-06-27 Thread Doug Moore
Author: dougm
Date: Fri Jun 28 02:14:54 2019
New Revision: 349498
URL: https://svnweb.freebsd.org/changeset/base/349498

Log:
  If vm_map_protect fails with KERN_RESOURCE_SHORTAGE, be sure to
  simplify modified entries before returning.
  
  Reviewed by: alc, markj (earlier version), kib (earlier version)
  Approved by: kib, markj (mentors, implicit)
  Differential Revision: https://reviews.freebsd.org/D20753

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==
--- head/sys/vm/vm_map.cFri Jun 28 01:57:59 2019(r349497)
+++ head/sys/vm/vm_map.cFri Jun 28 02:14:54 2019(r349498)
@@ -2454,6 +2454,7 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_off
vm_object_t obj;
struct ucred *cred;
vm_prot_t old_prot;
+   int rv;
 
if (start == end)
return (KERN_SUCCESS);
@@ -2508,10 +2509,13 @@ again:
}
 
/*
-* Do an accounting pass for private read-only mappings that
-* now will do cow due to allowed write (e.g. debugger sets
-* breakpoint on text segment)
+* Before changing the protections, try to reserve swap space for any
+* private (i.e., copy-on-write) mappings that are transitioning from
+* read-only to read/write access.  If a reservation fails, break out
+* of this loop early and let the next loop simplify the entries, since
+* some may now be mergeable.
 */
+   rv = KERN_SUCCESS;
vm_map_clip_start(map, entry, start);
for (current = entry; current->start < end; current = current->next) {
 
@@ -2529,8 +2533,9 @@ again:
 
if (obj == NULL || (current->eflags & MAP_ENTRY_NEEDS_COPY)) {
if (!swap_reserve(current->end - current->start)) {
-   vm_map_unlock(map);
-   return (KERN_RESOURCE_SHORTAGE);
+   rv = KERN_RESOURCE_SHORTAGE;
+   end = current->end;
+   break;
}
crhold(cred);
current->cred = cred;
@@ -2553,8 +2558,9 @@ again:
obj, current));
if (!swap_reserve(ptoa(obj->size))) {
VM_OBJECT_WUNLOCK(obj);
-   vm_map_unlock(map);
-   return (KERN_RESOURCE_SHORTAGE);
+   rv = KERN_RESOURCE_SHORTAGE;
+   end = current->end;
+   break;
}
 
crhold(cred);
@@ -2564,11 +2570,14 @@ again:
}
 
/*
-* Go back and fix up protections. [Note that clipping is not
-* necessary the second time.]
+* If enough swap space was available, go back and fix up protections.
+* Otherwise, just simplify entries, since some may have been modified.
+* [Note that clipping is not necessary the second time.]
 */
-   for (current = entry; current->start < end; current = current->next) {
-   if ((current->eflags & MAP_ENTRY_GUARD) != 0)
+   for (current = entry; current->start < end;
+   vm_map_simplify_entry(map, current), current = current->next) {
+   if (rv != KERN_SUCCESS ||
+   (current->eflags & MAP_ENTRY_GUARD) != 0)
continue;
 
old_prot = current->protection;
@@ -2603,10 +2612,9 @@ again:
current->protection & MASK(current));
 #undef MASK
}
-   vm_map_simplify_entry(map, current);
}
vm_map_unlock(map);
-   return (KERN_SUCCESS);
+   return (rv);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349497 - vendor/bzip2/1.0.7

2019-06-27 Thread Xin LI
Author: delphij
Date: Fri Jun 28 01:57:59 2019
New Revision: 349497
URL: https://svnweb.freebsd.org/changeset/base/349497

Log:
  "Tag" the Bzip2 1.0.7 vendor import.

Added:
  vendor/bzip2/1.0.7/
 - copied from r349496, vendor/bzip2/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349496 - vendor/bzip2/dist

2019-06-27 Thread Xin LI
Author: delphij
Date: Fri Jun 28 01:54:07 2019
New Revision: 349496
URL: https://svnweb.freebsd.org/changeset/base/349496

Log:
  Vendor import bzip2 -- upgrade to version 1.0.7.

Modified:
  vendor/bzip2/dist/CHANGES
  vendor/bzip2/dist/LICENSE
  vendor/bzip2/dist/Makefile
  vendor/bzip2/dist/Makefile-libbz2_so
  vendor/bzip2/dist/README
  vendor/bzip2/dist/README.COMPILATION.PROBLEMS
  vendor/bzip2/dist/blocksort.c
  vendor/bzip2/dist/bzip2.1
  vendor/bzip2/dist/bzip2.c
  vendor/bzip2/dist/bzip2recover.c
  vendor/bzip2/dist/bzlib.c
  vendor/bzip2/dist/bzlib.h
  vendor/bzip2/dist/bzlib_private.h
  vendor/bzip2/dist/compress.c
  vendor/bzip2/dist/crctable.c
  vendor/bzip2/dist/decompress.c
  vendor/bzip2/dist/huffman.c
  vendor/bzip2/dist/randtable.c
  vendor/bzip2/dist/spewG.c
  vendor/bzip2/dist/unzcrash.c
  vendor/bzip2/dist/words2

Modified: vendor/bzip2/dist/CHANGES
==
--- vendor/bzip2/dist/CHANGES   Fri Jun 28 01:53:34 2019(r349495)
+++ vendor/bzip2/dist/CHANGES   Fri Jun 28 01:54:07 2019(r349496)
@@ -2,8 +2,8 @@
  This file is part of bzip2/libbzip2, a program and library for
  lossless, block-sorting data compression.
 
- bzip2/libbzip2 version 1.0.6 of 6 September 2010
- Copyright (C) 1996-2010 Julian Seward 
+ bzip2/libbzip2 version 1.0.7 of 27 June 2019
+ Copyright (C) 1996-2010 Julian Seward 
 
  Please read the WARNING, DISCLAIMER and PATENTS sections in the 
  README file.
@@ -325,3 +325,16 @@ Security fix only.  Fixes CERT-FI 20469 as it applies 
   Izdebski.
 
 * Make the documentation build on Ubuntu 10.04
+
+1.0.7 (27 Jun 19)
+~
+
+* Fix undefined behavior in the macros SET_BH, CLEAR_BH, & ISSET_BH
+
+* bzip2: Fix return value when combining --test,-t and -q.
+
+* bzip2recover: Fix buffer overflow for large argv[0]
+
+* bzip2recover: Fix use after free issue with outFile (CVE-2016-3189)
+
+* Make sure nSelectors is not out of range (CVE-2019-12900)

Modified: vendor/bzip2/dist/LICENSE
==
--- vendor/bzip2/dist/LICENSE   Fri Jun 28 01:53:34 2019(r349495)
+++ vendor/bzip2/dist/LICENSE   Fri Jun 28 01:54:07 2019(r349496)
@@ -36,7 +36,7 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUD
 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-Julian Seward, jsew...@bzip.org
-bzip2/libbzip2 version 1.0.6 of 6 September 2010
+Julian Seward, jsew...@acm.org
+bzip2/libbzip2 version 1.0.7 of 27 June 2019
 
 --

Modified: vendor/bzip2/dist/Makefile
==
--- vendor/bzip2/dist/Makefile  Fri Jun 28 01:53:34 2019(r349495)
+++ vendor/bzip2/dist/Makefile  Fri Jun 28 01:54:07 2019(r349496)
@@ -3,7 +3,7 @@
 # lossless, block-sorting data compression.
 #
 # bzip2/libbzip2 version 1.0.6 of 6 September 2010
-# Copyright (C) 1996-2010 Julian Seward 
+# Copyright (C) 1996-2010 Julian Seward 
 #
 # Please read the WARNING, DISCLAIMER and PATENTS sections in the 
 # README file.
@@ -137,7 +137,7 @@ bzip2recover.o: bzip2recover.c
 distclean: clean
rm -f manual.ps manual.html manual.pdf
 
-DISTNAME=bzip2-1.0.6
+DISTNAME=bzip2-1.0.7
 dist: check manual
rm -f $(DISTNAME)
ln -s -f . $(DISTNAME)

Modified: vendor/bzip2/dist/Makefile-libbz2_so
==
--- vendor/bzip2/dist/Makefile-libbz2_soFri Jun 28 01:53:34 2019
(r349495)
+++ vendor/bzip2/dist/Makefile-libbz2_soFri Jun 28 01:54:07 2019
(r349496)
@@ -1,6 +1,6 @@
 
 # This Makefile builds a shared version of the library, 
-# libbz2.so.1.0.6, with soname libbz2.so.1.0,
+# libbz2.so.1.0.7, with soname libbz2.so.1.0,
 # at least on x86-Linux (RedHat 7.2), 
 # with gcc-2.96 2731 (Red Hat Linux 7.1 2.96-98).  
 # Please see the README file for some important info 
@@ -11,7 +11,7 @@
 # lossless, block-sorting data compression.
 #
 # bzip2/libbzip2 version 1.0.6 of 6 September 2010
-# Copyright (C) 1996-2010 Julian Seward 
+# Copyright (C) 1996-2010 Julian Seward 
 #
 # Please read the WARNING, DISCLAIMER and PATENTS sections in the 
 # README file.
@@ -35,13 +35,13 @@ OBJS= blocksort.o  \
   bzlib.o
 
 all: $(OBJS)
-   $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.6 $(OBJS)
-   $(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.6
+   $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.7 $(OBJS)
+   $(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.7
rm -f libbz2.so.1.0
-   ln -s libbz2.so.1.0.6 libbz2.so.1.0
+   ln -s libbz2.so.1.0.7 libbz2.so.1.0
 
 clean: 
-   rm -f $(OBJS) bzip2.o libbz2.so.1.0.6 libbz2.so.1.0 bzip2-shared
+   rm -f 

svn commit: r349495 - vendor/bzip2

2019-06-27 Thread Xin LI
Author: delphij
Date: Fri Jun 28 01:53:34 2019
New Revision: 349495
URL: https://svnweb.freebsd.org/changeset/base/349495

Log:
  Update upgrade instructions.
  
  PR:   238843

Modified:
  vendor/bzip2/FREEBSD-Xlist
  vendor/bzip2/FREEBSD-upgrade

Modified: vendor/bzip2/FREEBSD-Xlist
==
--- vendor/bzip2/FREEBSD-Xlist  Fri Jun 28 01:19:08 2019(r349494)
+++ vendor/bzip2/FREEBSD-Xlist  Fri Jun 28 01:53:34 2019(r349495)
@@ -22,3 +22,5 @@
 *manual.xml
 *mk251.c
 *xmlproc.sh
+prepare-release.sh
+release-update.sh 

Modified: vendor/bzip2/FREEBSD-upgrade
==
--- vendor/bzip2/FREEBSD-upgradeFri Jun 28 01:19:08 2019
(r349494)
+++ vendor/bzip2/FREEBSD-upgradeFri Jun 28 01:53:34 2019
(r349495)
@@ -1,16 +1,13 @@
 $FreeBSD$
 
 Julian Seward's bzip2
-   originals can be found at:  http://www.bzip.org/downloads.html
+   originals can be found at:  
https://www.sourceware.org/bzip2/downloads.html
 
-Imported by:
-   svn import -m "Virgin import (trimmed) of Bzip2 version 1.0.6."
-
 Notes:
The following log shows details of trimming:
~~~
-   tar xvfz bzip2-1.0.6.tar.gz -X FREEBSD-Xlist
-   cd bzip2-1.0.6
+   tar xvfz bzip2-1.0.7.tar.gz -X FREEBSD-Xlist
+   cd bzip2-1.0.7
uuencode sample1.bz2 sample1.bz2 > sample1.bz2.uu
uuencode sample2.bz2 sample2.bz2 > sample2.bz2.uu
uuencode sample3.bz2 sample3.bz2 > sample3.bz2.uu
@@ -23,4 +20,4 @@ Notes:
sed -i '' -e 's/begin [0-7][0-7][0-7] /begin 644 /g' *.uu
 
 obr...@freebsd.org
-1 Oct 2010
+27 Jun 2019
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349494 - head/sys/dev/uart

2019-06-27 Thread Rebecca Cran
Author: bcran
Date: Fri Jun 28 01:19:08 2019
New Revision: 349494
URL: https://svnweb.freebsd.org/changeset/base/349494

Log:
  Add ACPI entries for Synopsys Designware UARTs used on ARM platforms
  
  This fixes (userspace) console on the Marvell MACCHIATObin in ACPI mode with
  latest TianoCore EDK2 firmware.
  
  Submitted by: Greg V 
  Reviewed by:  mw, bcran
  Differential Revision:https://reviews.freebsd.org/D20765

Modified:
  head/sys/dev/uart/uart_dev_ns8250.c

Modified: head/sys/dev/uart/uart_dev_ns8250.c
==
--- head/sys/dev/uart/uart_dev_ns8250.c Fri Jun 28 01:17:33 2019
(r349493)
+++ head/sys/dev/uart/uart_dev_ns8250.c Fri Jun 28 01:19:08 2019
(r349494)
@@ -415,6 +415,9 @@ struct uart_class uart_ns8250_class = {
 static struct acpi_uart_compat_data acpi_compat_data[] = {
{"AMD0020", _ns8250_class, 0, 2, 0, 4800, 
UART_F_BUSY_DETECT, "AMD / Synopsys Designware UART"},
{"AMDI0020", _ns8250_class, 0, 2, 0, 4800, UART_F_BUSY_DETECT, 
"AMD / Synopsys Designware UART"},
+   {"MRVL0001", _ns8250_class, 0, 2, 0, 2, 
UART_F_BUSY_DETECT, "Marvell / Synopsys Designware UART"},
+   {"SCX0006",  _ns8250_class, 0, 2, 0, 6250, UART_F_BUSY_DETECT, 
"SynQuacer / Synopsys Designware UART"},
+   {"HISI0031", _ns8250_class, 0, 2, 0, 2, 
UART_F_BUSY_DETECT, "HiSilicon / Synopsys Designware UART"},
{"PNP0500", _ns8250_class, 0, 0, 0, 0, 0, "Standard PC COM port"},
{"PNP0501", _ns8250_class, 0, 0, 0, 0, 0, "16550A-compatible COM 
port"},
{"PNP0502", _ns8250_class, 0, 0, 0, 0, 0, "Multiport serial device 
(non-intelligent 16550)"},
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349493 - head/sys/arm/arm

2019-06-27 Thread Rebecca Cran
Author: bcran
Date: Fri Jun 28 01:17:33 2019
New Revision: 349493
URL: https://svnweb.freebsd.org/changeset/base/349493

Log:
  Add missing ACPI GICv2 MSI/MSI-X attachment
  
  This lets PCIe MSI-X device interrupts work on the MACCHIATObin
  (Marvell Armada 8k), which allows e.g. the Intel igb NIC to fully work.
  
  Submitted by: Greg V 
  Reviewed by:  mw, bcran
  Differential Revision:https://reviews.freebsd.org/D20775

Modified:
  head/sys/arm/arm/gic_acpi.c

Modified: head/sys/arm/arm/gic_acpi.c
==
--- head/sys/arm/arm/gic_acpi.c Fri Jun 28 01:07:19 2019(r349492)
+++ head/sys/arm/arm/gic_acpi.c Fri Jun 28 01:17:33 2019(r349493)
@@ -331,9 +331,21 @@ arm_gicv2m_acpi_probe(device_t dev)
return (BUS_PROBE_DEFAULT);
 }
 
+static int
+arm_gicv2m_acpi_attach(device_t dev)
+{
+   struct arm_gicv2m_softc *sc;
+
+   sc = device_get_softc(dev);
+   sc->sc_xref = ACPI_MSI_XREF;
+
+   return (arm_gicv2m_attach(dev));
+}
+
 static device_method_t arm_gicv2m_acpi_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, arm_gicv2m_acpi_probe),
+   DEVMETHOD(device_attach,arm_gicv2m_acpi_attach),
 
/* End */
DEVMETHOD_END
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349492 - stable/11/usr.bin/procstat

2019-06-27 Thread Mitchell Horne
Author: mhorne
Date: Fri Jun 28 01:07:19 2019
New Revision: 349492
URL: https://svnweb.freebsd.org/changeset/base/349492

Log:
  MFC r348887:
  procstat: Recognize HWCAP and HWCAP2 with auxv command
  
  Approved by:  markj (mentor, implicit)

Modified:
  stable/11/usr.bin/procstat/procstat_auxv.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/procstat/procstat_auxv.c
==
--- stable/11/usr.bin/procstat/procstat_auxv.c  Fri Jun 28 01:03:55 2019
(r349491)
+++ stable/11/usr.bin/procstat/procstat_auxv.c  Fri Jun 28 01:07:19 2019
(r349492)
@@ -185,6 +185,18 @@ procstat_auxv(struct procstat *procstat, struct kinfo_
prefix, "AT_EHDRFLAGS", (u_long)auxv[i].a_un.a_val);
break;
 #endif
+#ifdef AT_HWCAP
+   case AT_HWCAP:
+   xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_HWCAP/%#lx}\n",
+   prefix, "AT_HWCAP", (u_long)auxv[i].a_un.a_val);
+   break;
+#endif
+#ifdef AT_HWCAP2
+   case AT_HWCAP2:
+   xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_HWCAP2/%#lx}\n",
+   prefix, "AT_HWCAP2", (u_long)auxv[i].a_un.a_val);
+   break;
+#endif
default:
xo_emit("{dw:/%s}{Lw:/%16ld/%ld}{:UNKNOWN/%#lx}\n",
prefix, auxv[i].a_type, auxv[i].a_un.a_val);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349491 - stable/12/usr.bin/procstat

2019-06-27 Thread Mitchell Horne
Author: mhorne
Date: Fri Jun 28 01:03:55 2019
New Revision: 349491
URL: https://svnweb.freebsd.org/changeset/base/349491

Log:
  MFC r348887:
  procstat: Recognize HWCAP and HWCAP2 with auxv command
  
  Approved by:  markj (mentor, implicit)

Modified:
  stable/12/usr.bin/procstat/procstat_auxv.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.bin/procstat/procstat_auxv.c
==
--- stable/12/usr.bin/procstat/procstat_auxv.c  Fri Jun 28 01:01:54 2019
(r349490)
+++ stable/12/usr.bin/procstat/procstat_auxv.c  Fri Jun 28 01:03:55 2019
(r349491)
@@ -185,6 +185,18 @@ procstat_auxv(struct procstat *procstat, struct kinfo_
prefix, "AT_EHDRFLAGS", (u_long)auxv[i].a_un.a_val);
break;
 #endif
+#ifdef AT_HWCAP
+   case AT_HWCAP:
+   xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_HWCAP/%#lx}\n",
+   prefix, "AT_HWCAP", (u_long)auxv[i].a_un.a_val);
+   break;
+#endif
+#ifdef AT_HWCAP2
+   case AT_HWCAP2:
+   xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_HWCAP2/%#lx}\n",
+   prefix, "AT_HWCAP2", (u_long)auxv[i].a_un.a_val);
+   break;
+#endif
default:
xo_emit("{dw:/%s}{Lw:/%16ld/%ld}{:UNKNOWN/%#lx}\n",
prefix, auxv[i].a_type, auxv[i].a_un.a_val);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349490 - in stable/12/sys/riscv: include riscv

2019-06-27 Thread Mitchell Horne
Author: mhorne
Date: Fri Jun 28 01:01:54 2019
New Revision: 349490
URL: https://svnweb.freebsd.org/changeset/base/349490

Log:
  MFC r348886:
  RISC-V: expose extension bits in AT_HWCAP
  
  Approved by:  markj (mentor, implicit)

Modified:
  stable/12/sys/riscv/include/elf.h
  stable/12/sys/riscv/include/md_var.h
  stable/12/sys/riscv/riscv/elf_machdep.c
  stable/12/sys/riscv/riscv/identcpu.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/riscv/include/elf.h
==
--- stable/12/sys/riscv/include/elf.h   Fri Jun 28 00:58:54 2019
(r349489)
+++ stable/12/sys/riscv/include/elf.h   Fri Jun 28 01:01:54 2019
(r349490)
@@ -105,4 +105,15 @@ __ElfType(Auxinfo);
 /* TODO: set correct value */
 #defineET_DYN_LOAD_ADDR 0x10
 
+/* Flags passed in AT_HWCAP */
+#defineHWCAP_ISA_BIT(c)(1 << ((c) - 'A'))
+#defineHWCAP_ISA_I HWCAP_ISA_BIT('I')
+#defineHWCAP_ISA_M HWCAP_ISA_BIT('M')
+#defineHWCAP_ISA_A HWCAP_ISA_BIT('A')
+#defineHWCAP_ISA_F HWCAP_ISA_BIT('F')
+#defineHWCAP_ISA_D HWCAP_ISA_BIT('D')
+#defineHWCAP_ISA_C HWCAP_ISA_BIT('C')
+#defineHWCAP_ISA_G \
+(HWCAP_ISA_I | HWCAP_ISA_M | HWCAP_ISA_A | HWCAP_ISA_F | HWCAP_ISA_D)
+
 #endif /* !_MACHINE_ELF_H_ */

Modified: stable/12/sys/riscv/include/md_var.h
==
--- stable/12/sys/riscv/include/md_var.hFri Jun 28 00:58:54 2019
(r349489)
+++ stable/12/sys/riscv/include/md_var.hFri Jun 28 01:01:54 2019
(r349490)
@@ -38,6 +38,7 @@ extern char sigcode[];
 extern int szsigcode;
 extern uint64_t *vm_page_dump;
 extern int vm_page_dump_size;
+extern u_long elf_hwcap;
 
 struct dumperinfo;
 

Modified: stable/12/sys/riscv/riscv/elf_machdep.c
==
--- stable/12/sys/riscv/riscv/elf_machdep.c Fri Jun 28 00:58:54 2019
(r349489)
+++ stable/12/sys/riscv/riscv/elf_machdep.c Fri Jun 28 01:01:54 2019
(r349490)
@@ -58,6 +58,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+u_long elf_hwcap;
+
 struct sysentvec elf64_freebsd_sysvec = {
.sv_size= SYS_MAXSYSCALL,
.sv_table   = sysent,
@@ -89,6 +91,7 @@ struct sysentvec elf64_freebsd_sysvec = {
.sv_schedtail   = NULL,
.sv_thread_detach = NULL,
.sv_trap= NULL,
+   .sv_hwcap   = _hwcap,
 };
 INIT_SYSENTVEC(elf64_sysvec, _freebsd_sysvec);
 

Modified: stable/12/sys/riscv/riscv/identcpu.c
==
--- stable/12/sys/riscv/riscv/identcpu.cFri Jun 28 00:58:54 2019
(r349489)
+++ stable/12/sys/riscv/riscv/identcpu.cFri Jun 28 01:01:54 2019
(r349490)
@@ -32,18 +32,28 @@
  * SUCH DAMAGE.
  */
 
+#include "opt_platform.h"
+
 #include 
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
+#include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
+#include 
+#include 
 #include 
 
+#ifdef FDT
+#include 
+#include 
+#endif
+
 char machine[] = "riscv";
 
 SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD, machine, 0,
@@ -87,6 +97,84 @@ const struct cpu_implementers cpu_implementers[] = {
{ CPU_IMPL_UCB_ROCKET,  "UC Berkeley Rocket" },
CPU_IMPLEMENTER_NONE,
 };
+
+#ifdef FDT
+/*
+ * The ISA string is made up of a small prefix (e.g. rv64) and up to 26 letters
+ * indicating the presence of the 26 possible standard extensions. Therefore 32
+ * characters will be sufficient.
+ */
+#defineISA_NAME_MAXLEN 32
+#defineISA_PREFIX  ("rv" __XSTRING(__riscv_xlen))
+#defineISA_PREFIX_LEN  (sizeof(ISA_PREFIX) - 1)
+
+static void
+fill_elf_hwcap(void *dummy __unused)
+{
+   u_long caps[256] = {0};
+   char isa[ISA_NAME_MAXLEN];
+   u_long hwcap;
+   phandle_t node;
+   ssize_t len;
+   int i;
+
+   caps['i'] = caps['I'] = HWCAP_ISA_I;
+   caps['m'] = caps['M'] = HWCAP_ISA_M;
+   caps['a'] = caps['A'] = HWCAP_ISA_A;
+#ifdef FPE
+   caps['f'] = caps['F'] = HWCAP_ISA_F;
+   caps['d'] = caps['D'] = HWCAP_ISA_D;
+#endif
+   caps['c'] = caps['C'] = HWCAP_ISA_C;
+
+   node = OF_finddevice("/cpus");
+   if (node == -1) {
+   if (bootverbose)
+   printf("fill_elf_hwcap: Can't find cpus node\n");
+   return;
+   }
+
+   /*
+* Iterate through the CPUs and examine their ISA string. While we
+* could assign elf_hwcap to be whatever the boot CPU supports, to
+* handle the (unusual) case of running a system with hetergeneous
+* ISAs, keep only the extension bits that are common to all harts.
+*/
+   for (node = 

svn commit: r349489 - stable/12/sys/riscv/riscv

2019-06-27 Thread Mitchell Horne
Author: mhorne
Date: Fri Jun 28 00:58:54 2019
New Revision: 349489
URL: https://svnweb.freebsd.org/changeset/base/349489

Log:
  MFC r348840:
  Remove unused mcall_trap() function
  
  Approved by:  markj (mentor, implicit)

Modified:
  stable/12/sys/riscv/riscv/machdep.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/riscv/riscv/machdep.c
==
--- stable/12/sys/riscv/riscv/machdep.c Fri Jun 28 00:56:26 2019
(r349488)
+++ stable/12/sys/riscv/riscv/machdep.c Fri Jun 28 00:58:54 2019
(r349489)
@@ -125,15 +125,6 @@ cpuset_t all_harts;
 extern int *end;
 extern int *initstack_end;
 
-uintptr_t mcall_trap(uintptr_t mcause, uintptr_t* regs);
-
-uintptr_t
-mcall_trap(uintptr_t mcause, uintptr_t* regs)
-{
-
-   return (0);
-}
-
 static void
 cpu_startup(void *dummy)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349488 - stable/12/sys/riscv/conf

2019-06-27 Thread Mitchell Horne
Author: mhorne
Date: Fri Jun 28 00:56:26 2019
New Revision: 349488
URL: https://svnweb.freebsd.org/changeset/base/349488

Log:
  MFC r348839:
  Clean up some GENERIC options
  
  Approved by:  markj (mentor)

Modified:
  stable/12/sys/riscv/conf/GENERIC
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/riscv/conf/GENERIC
==
--- stable/12/sys/riscv/conf/GENERICFri Jun 28 00:53:27 2019
(r349487)
+++ stable/12/sys/riscv/conf/GENERICFri Jun 28 00:56:26 2019
(r349488)
@@ -22,12 +22,8 @@ cpu  RISCV
 ident  GENERIC
 
 makeoptionsDEBUG=-g# Build kernel with gdb(1) debug symbols
-# makeoptions  WITH_CTF=1  # Run ctfconvert(1) for DTrace support
+makeoptionsWITH_CTF=1  # Run ctfconvert(1) for DTrace support
 
-# FIXME: linker error. "--relax and -r may not be used together"
-makeoptionsWITHOUT_MODULES="usb otusfw mwlfw ispfw mwlfw ralfw rtwnfw"
-# makeoptions  NO_MODULES
-
 optionsSCHED_ULE   # ULE scheduler
 optionsPREEMPTION  # Enable kernel thread preemption
 optionsVIMAGE  # Subsystem virtualization, e.g. VNET
@@ -53,11 +49,11 @@ options CD9660  # ISO 9660 Filesystem
 optionsPROCFS  # Process filesystem (requires PSEUDOFS)
 optionsPSEUDOFS# Pseudo-filesystem framework
 optionsGEOM_PART_GPT   # GUID Partition Tables.
-# options  GEOM_RAID   # Soft RAID functionality.
+optionsGEOM_RAID   # Soft RAID functionality.
 optionsGEOM_LABEL  # Provides labelization
 optionsSCSI_DELAY=5000 # Delay (in ms) before probing SCSI
 optionsKTRACE  # ktrace(1) support
-# options  STACK   # stack(9) support
+optionsSTACK   # stack(9) support
 optionsSYSVSHM # SYSV-style shared memory
 optionsSYSVMSG # SYSV-style message queues
 optionsSYSVSEM # SYSV-style semaphores
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349487 - stable/12/sys/riscv/riscv

2019-06-27 Thread Mitchell Horne
Author: mhorne
Date: Fri Jun 28 00:53:27 2019
New Revision: 349487
URL: https://svnweb.freebsd.org/changeset/base/349487

Log:
  MFC r348838:
  Announce real and available memory at boot
  
  Approved by:  markj (mentor, implicit)

Modified:
  stable/12/sys/riscv/riscv/machdep.c
  stable/12/sys/riscv/riscv/pmap.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/riscv/riscv/machdep.c
==
--- stable/12/sys/riscv/riscv/machdep.c Fri Jun 28 00:50:00 2019
(r349486)
+++ stable/12/sys/riscv/riscv/machdep.c Fri Jun 28 00:53:27 2019
(r349487)
@@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -139,7 +140,34 @@ cpu_startup(void *dummy)
 
identify_cpu();
 
+   printf("real memory  = %ju (%ju MB)\n", ptoa((uintmax_t)realmem),
+   ptoa((uintmax_t)realmem) / (1024 * 1024));
+
+   /*
+* Display any holes after the first chunk of extended memory.
+*/
+   if (bootverbose) {
+   int indx;
+
+   printf("Physical memory chunk(s):\n");
+   for (indx = 0; phys_avail[indx + 1] != 0; indx += 2) {
+   vm_paddr_t size;
+
+   size = phys_avail[indx + 1] - phys_avail[indx];
+   printf(
+   "0x%016jx - 0x%016jx, %ju bytes (%ju pages)\n",
+   (uintmax_t)phys_avail[indx],
+   (uintmax_t)phys_avail[indx + 1] - 1,
+   (uintmax_t)size, (uintmax_t)size / PAGE_SIZE);
+   }
+   }
+
vm_ksubmap_init();
+
+   printf("avail memory = %ju (%ju MB)\n",
+   ptoa((uintmax_t)vm_free_count()),
+   ptoa((uintmax_t)vm_free_count()) / (1024 * 1024));
+
bufinit();
vm_pager_bufferinit();
 }

Modified: stable/12/sys/riscv/riscv/pmap.c
==
--- stable/12/sys/riscv/riscv/pmap.cFri Jun 28 00:50:00 2019
(r349486)
+++ stable/12/sys/riscv/riscv/pmap.cFri Jun 28 00:53:27 2019
(r349487)
@@ -640,6 +640,7 @@ pmap_bootstrap(vm_offset_t l1pt, vm_paddr_t kernstart,
continue;
dump_avail[map_slot] = start;
dump_avail[map_slot + 1] = end;
+   realmem += atop((vm_offset_t)(end - start));
 
if (start >= kernstart && end <= pa)
continue;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349486 - stable/12/sys/riscv/riscv

2019-06-27 Thread Mitchell Horne
Author: mhorne
Date: Fri Jun 28 00:50:00 2019
New Revision: 349486
URL: https://svnweb.freebsd.org/changeset/base/349486

Log:
  MFC r348837:
  Add TSLOG events to initriscv()
  
  Approved by:  markj (mentor, implicit)

Modified:
  stable/12/sys/riscv/riscv/machdep.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/riscv/riscv/machdep.c
==
--- stable/12/sys/riscv/riscv/machdep.c Fri Jun 28 00:43:38 2019
(r349485)
+++ stable/12/sys/riscv/riscv/machdep.c Fri Jun 28 00:50:00 2019
(r349486)
@@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -815,6 +816,8 @@ initriscv(struct riscv_bootparams *rvbp)
caddr_t kmdp;
int i;
 
+   TSRAW(, TS_ENTER, __func__, NULL);
+
/* Set the pcpu data, this is needed by pmap_bootstrap */
pcpup = &__pcpu[0];
pcpu_init(pcpup, 0, sizeof(struct pcpu));
@@ -887,6 +890,8 @@ initriscv(struct riscv_bootparams *rvbp)
kdb_init();
 
early_boot = 0;
+
+   TSEXIT();
 }
 
 #undef bzero
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349485 - in stable/12/sys: conf riscv/include riscv/riscv

2019-06-27 Thread Mitchell Horne
Author: mhorne
Date: Fri Jun 28 00:43:38 2019
New Revision: 349485
URL: https://svnweb.freebsd.org/changeset/base/349485

Log:
  MFC 348835-348836:
  Fix global pointer relaxations in the RISC-V kernel
  
  The gp register is intended to used by the linker as another means of
  performing relaxations, and should point to the small data section (.sdata).
  
  Currently gp is being used as the pcpu pointer within the kernel, but the more
  appropriate choice for this is the tp register, which is unused.
  
  Swap existing usage of gp with tp within the kernel, and set up gp properly
  at boot with the value of __global_pointer$ for all harts.
  
  Approved by:  markj (mentor, implicit)

Modified:
  stable/12/sys/conf/ldscript.riscv
  stable/12/sys/riscv/include/asm.h
  stable/12/sys/riscv/include/pcpu.h
  stable/12/sys/riscv/riscv/exception.S
  stable/12/sys/riscv/riscv/locore.S
  stable/12/sys/riscv/riscv/machdep.c
  stable/12/sys/riscv/riscv/mp_machdep.c
  stable/12/sys/riscv/riscv/swtch.S
  stable/12/sys/riscv/riscv/vm_machdep.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/conf/ldscript.riscv
==
--- stable/12/sys/conf/ldscript.riscv   Fri Jun 28 00:36:26 2019
(r349484)
+++ stable/12/sys/conf/ldscript.riscv   Fri Jun 28 00:43:38 2019
(r349485)
@@ -84,7 +84,11 @@ SECTIONS
  can access them all, and initialized data all before uninitialized, so
  we can shorten the on-disk segment size.  */
   . = ALIGN(8);
-  .sdata : { *(.sdata) }
+  .sdata :
+  {
+__global_pointer$ = . + 0x800;
+*(.sdata)
+  }
   _edata  =  .;
   PROVIDE (edata = .);
   /* Ensure __bss_start is associated with the next section in case orphan

Modified: stable/12/sys/riscv/include/asm.h
==
--- stable/12/sys/riscv/include/asm.h   Fri Jun 28 00:36:26 2019
(r349484)
+++ stable/12/sys/riscv/include/asm.h   Fri Jun 28 00:43:38 2019
(r349485)
@@ -59,7 +59,7 @@
.set alias,sym
 
 #defineSET_FAULT_HANDLER(handler, tmp) 
\
-   ld  tmp, PC_CURTHREAD(gp);  \
+   ld  tmp, PC_CURTHREAD(tp);  \
ld  tmp, TD_PCB(tmp);   /* Load the pcb */  \
sd  handler, PCB_ONFAULT(tmp)   /* Set the handler */
 

Modified: stable/12/sys/riscv/include/pcpu.h
==
--- stable/12/sys/riscv/include/pcpu.h  Fri Jun 28 00:36:26 2019
(r349484)
+++ stable/12/sys/riscv/include/pcpu.h  Fri Jun 28 00:43:38 2019
(r349485)
@@ -60,7 +60,7 @@ get_pcpu(void)
 {
struct pcpu *pcpu;
 
-   __asm __volatile("mv %0, gp" : "="(pcpu));
+   __asm __volatile("mv %0, tp" : "="(pcpu));
 
return (pcpu);
 }
@@ -70,7 +70,7 @@ get_curthread(void)
 {
struct thread *td;
 
-   __asm __volatile("ld %0, 0(gp)" : "="(td));
+   __asm __volatile("ld %0, 0(tp)" : "="(td));
 
return (td);
 }

Modified: stable/12/sys/riscv/riscv/exception.S
==
--- stable/12/sys/riscv/riscv/exception.S   Fri Jun 28 00:36:26 2019
(r349484)
+++ stable/12/sys/riscv/riscv/exception.S   Fri Jun 28 00:43:38 2019
(r349485)
@@ -44,11 +44,18 @@ __FBSDID("$FreeBSD$");
addisp, sp, -(TF_SIZE)
 
sd  ra, (TF_RA)(sp)
-   sd  tp, (TF_TP)(sp)
 
-.if \el == 0   /* We came from userspace. Load our pcpu */
+.if \el == 0   /* We came from userspace. */
sd  gp, (TF_GP)(sp)
-   ld  gp, (TF_SIZE)(sp)
+.option push
+.option norelax
+   /* Load the kernel's global pointer */
+   la  gp, __global_pointer$
+.option pop
+
+   /* Load our pcpu */
+   sd  tp, (TF_TP)(sp)
+   ld  tp, (TF_SIZE)(sp)
 .endif
 
sd  t0, (TF_T + 0 * 8)(sp)
@@ -81,16 +88,6 @@ __FBSDID("$FreeBSD$");
sd  a6, (TF_A + 6 * 8)(sp)
sd  a7, (TF_A + 7 * 8)(sp)
 
-#if 0
-   /* XXX: temporary test: spin if stack is not kernel one */
-.if \el == 1   /* kernel */
-   mv  t0, sp
-   srlit0, t0, 63
-1:
-   beqzt0, 1b
-.endif
-#endif
-
 .if \el == 1
/* Store kernel sp */
li  t1, TF_SIZE
@@ -138,13 +135,15 @@ __FBSDID("$FreeBSD$");
ld  t0, (TF_SP)(sp)
csrwsscratch, t0
 
-   /* And store our pcpu */
-   sd  gp, (TF_SIZE)(sp)
+   /* Store our pcpu */
+   sd  tp, (TF_SIZE)(sp)
+   ld  tp, (TF_TP)(sp)
+
+   /* And restore the user's global pointer */
ld  gp, (TF_GP)(sp)
 .endif
 
ld  ra, (TF_RA)(sp)
-   ld  tp, (TF_TP)(sp)
 
ld  t0, (TF_T + 0 * 8)(sp)
ld  t1, (TF_T + 1 * 8)(sp)
@@ -185,7 

svn commit: r349484 - in stable/12/sys/riscv: include riscv

2019-06-27 Thread Mitchell Horne
Author: mhorne
Date: Fri Jun 28 00:36:26 2019
New Revision: 349484
URL: https://svnweb.freebsd.org/changeset/base/349484

Log:
  MFC r346021:
  RISC-V: initialize pcpu slightly earlier
  
  In certain scenarios, it is possible for PCPU data to be
  accessed before it has been initialized (e.g. during printf
  if the kernel was built with the TSLOG option).
  
  Initialize the PCPU pointer for hart 0 at the beginning of
  initriscv() rather than near the end.
  
  Approved by: markj (mentor)

Modified:
  stable/12/sys/riscv/include/pcpu.h
  stable/12/sys/riscv/riscv/machdep.c

Modified: stable/12/sys/riscv/include/pcpu.h
==
--- stable/12/sys/riscv/include/pcpu.h  Fri Jun 28 00:14:12 2019
(r349483)
+++ stable/12/sys/riscv/include/pcpu.h  Fri Jun 28 00:36:26 2019
(r349484)
@@ -54,7 +54,6 @@
 
 struct pcb;
 struct pcpu;
-extern struct pcpu *pcpup;
 
 static inline struct pcpu *
 get_pcpu(void)

Modified: stable/12/sys/riscv/riscv/machdep.c
==
--- stable/12/sys/riscv/riscv/machdep.c Fri Jun 28 00:14:12 2019
(r349483)
+++ stable/12/sys/riscv/riscv/machdep.c Fri Jun 28 00:36:26 2019
(r349484)
@@ -123,8 +123,6 @@ cpuset_t all_harts;
 extern int *end;
 extern int *initstack_end;
 
-struct pcpu *pcpup;
-
 uintptr_t mcall_trap(uintptr_t mcause, uintptr_t* regs);
 
 uintptr_t
@@ -632,6 +630,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
 static void
 init_proc0(vm_offset_t kstack)
 {
+   struct pcpu *pcpup;
 
pcpup = &__pcpu[0];
 
@@ -807,6 +806,7 @@ void
 initriscv(struct riscv_bootparams *rvbp)
 {
struct mem_region mem_regions[FDT_MEM_REGIONS];
+   struct pcpu *pcpup;
vm_offset_t rstart, rend;
vm_offset_t s, e;
int mem_regions_sz;
@@ -815,6 +815,16 @@ initriscv(struct riscv_bootparams *rvbp)
caddr_t kmdp;
int i;
 
+   /* Set the pcpu data, this is needed by pmap_bootstrap */
+   pcpup = &__pcpu[0];
+   pcpu_init(pcpup, 0, sizeof(struct pcpu));
+   pcpup->pc_hart = boot_hart;
+
+   /* Set the pcpu pointer */
+   __asm __volatile("mv gp, %0" :: "r"(pcpup));
+
+   PCPU_SET(curthread, );
+
/* Set the module data location */
lastaddr = fake_preload_metadata(rvbp);
 
@@ -857,16 +867,6 @@ initriscv(struct riscv_bootparams *rvbp)
}
}
 #endif
-
-   /* Set the pcpu data, this is needed by pmap_bootstrap */
-   pcpup = &__pcpu[0];
-   pcpu_init(pcpup, 0, sizeof(struct pcpu));
-   pcpup->pc_hart = boot_hart;
-
-   /* Set the pcpu pointer */
-   __asm __volatile("mv gp, %0" :: "r"(pcpup));
-
-   PCPU_SET(curthread, );
 
/* Do basic tuning, hz etc */
init_param1();
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349483 - head/contrib/elftoolchain/libelftc

2019-06-27 Thread Mitchell Horne
Author: mhorne
Date: Fri Jun 28 00:14:12 2019
New Revision: 349483
URL: https://svnweb.freebsd.org/changeset/base/349483

Log:
  libelftc: add RISC-V bfd targets
  
  This adds the following targets: elf32-riscv, elf64-riscv, elf64-riscv-freebsd
  
  Reviewed by:  emaste, markj, jko...@users.sourceforge.net
  Approved by:  markj (mentor)
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D20768

Modified:
  head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3
  head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c

Modified: head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3
==
--- head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3  Fri Jun 28 
00:10:26 2019(r349482)
+++ head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3  Fri Jun 28 
00:14:12 2019(r349483)
@@ -76,6 +76,9 @@ Known descriptor names and their properties include:
 .It Li elf32-powerpc Ta ELF Ta MSB Ta 32
 .It Li elf32-powerpc-freebsd Ta ELF Ta MSB Ta 32
 .It Li elf32-powerpcle Ta ELF Ta LSB Ta 32
+.It Li elf32-riscv Ta ELF Ta LSB Ta 32
+.It Li elf64-riscv Ta ELF Ta LSB Ta 64
+.It Li elf64-riscv-freebsd Ta ELF Ta LSB Ta 64
 .It Li elf32-sh Ta ELF Ta MSB Ta 32
 .It Li elf32-shl Ta ELF Ta LSB Ta 32
 .It Li elf32-sh-nbsd Ta ELF Ta MSB Ta 32

Modified: head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c
==
--- head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Fri Jun 28 
00:10:26 2019(r349482)
+++ head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Fri Jun 28 
00:14:12 2019(r349483)
@@ -316,6 +316,31 @@ struct _Elftc_Bfd_Target _libelftc_targets[] = {
},
 
{
+   .bt_name  = "elf32-riscv",
+   .bt_type  = ETF_ELF,
+   .bt_byteorder = ELFDATA2LSB,
+   .bt_elfclass  = ELFCLASS32,
+   .bt_machine   = EM_RISCV,
+   },
+
+   {
+   .bt_name  = "elf64-riscv",
+   .bt_type  = ETF_ELF,
+   .bt_byteorder = ELFDATA2LSB,
+   .bt_elfclass  = ELFCLASS64,
+   .bt_machine   = EM_RISCV,
+   },
+
+   {
+   .bt_name  = "elf64-riscv-freebsd",
+   .bt_type  = ETF_ELF,
+   .bt_byteorder = ELFDATA2MSB,
+   .bt_elfclass  = ELFCLASS64,
+   .bt_machine   = EM_RISCV,
+   .bt_osabi = ELFOSABI_FREEBSD,
+   },
+
+   {
.bt_name  = "elf64-sh64",
.bt_type  = ETF_ELF,
.bt_byteorder = ELFDATA2MSB,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349482 - in head/contrib/elftoolchain: common readelf

2019-06-27 Thread Mitchell Horne
Author: mhorne
Date: Fri Jun 28 00:10:26 2019
New Revision: 349482
URL: https://svnweb.freebsd.org/changeset/base/349482

Log:
  readelf: Add support for RISC-V specific e_flags
  
  Reviewed by:  markj
  Approved by:  markj (mentor)
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D20767

Modified:
  head/contrib/elftoolchain/common/elfdefinitions.h
  head/contrib/elftoolchain/readelf/readelf.c

Modified: head/contrib/elftoolchain/common/elfdefinitions.h
==
--- head/contrib/elftoolchain/common/elfdefinitions.h   Fri Jun 28 00:03:29 
2019(r349481)
+++ head/contrib/elftoolchain/common/elfdefinitions.h   Fri Jun 28 00:10:26 
2019(r349482)
@@ -33,7 +33,7 @@
  *   See: http://www.sco.com/developers/gabi/latest/ch4.intro.html
  * - The May 1998 (version 1.5) draft of "The ELF-64 object format".
  * - Processor-specific ELF ABI definitions for sparc, i386, amd64, mips,
- *   ia64, and powerpc processors.
+ *   ia64, powerpc, and RISC-V processors.
  * - The "Linkers and Libraries Guide", from Sun Microsystems.
  */
 
@@ -426,6 +426,22 @@ _ELF_DEFINE_EF(EF_PPC_RELOCATABLE,  0x0001UL,  
\
"-mrelocatable flag")   \
 _ELF_DEFINE_EF(EF_PPC_RELOCATABLE_LIB, 0x8000UL,   \
"-mrelocatable-lib flag")   \
+_ELF_DEFINE_EF(EF_RISCV_RVC,   0x0001UL,   \
+   "Compressed instruction extension") \
+_ELF_DEFINE_EF(EF_RISCV_FLOAT_ABI_MASK, 0x0006UL,  \
+   "Floating point ABI")   \
+_ELF_DEFINE_EF(EF_RISCV_FLOAT_ABI_SOFT, 0xUL,  \
+   "Software emulated floating point") \
+_ELF_DEFINE_EF(EF_RISCV_FLOAT_ABI_SINGLE, 0x0002UL,
\
+   "Single precision floating point")  \
+_ELF_DEFINE_EF(EF_RISCV_FLOAT_ABI_DOUBLE, 0x0004UL,
\
+   "Double precision floating point")  \
+_ELF_DEFINE_EF(EF_RISCV_FLOAT_ABI_QUAD, 0x0006UL,  \
+   "Quad precision floating point")\
+_ELF_DEFINE_EF(EF_RISCV_RVE,   0x0008UL,   \
+   "Compressed instruction ABI")   \
+_ELF_DEFINE_EF(EF_RISCV_TSO,   0x0010UL,   \
+   "RVTSO memory consistency model")   \
 _ELF_DEFINE_EF(EF_SPARC_EXT_MASK,   0x0000UL,  \
"Vendor Extension mask")\
 _ELF_DEFINE_EF(EF_SPARC_32PLUS, 0x0100UL,  \

Modified: head/contrib/elftoolchain/readelf/readelf.c
==
--- head/contrib/elftoolchain/readelf/readelf.c Fri Jun 28 00:03:29 2019
(r349481)
+++ head/contrib/elftoolchain/readelf/readelf.c Fri Jun 28 00:10:26 2019
(r349482)
@@ -431,6 +431,13 @@ static struct eflags_desc powerpc_eflags_desc[] = {
{0, NULL}
 };
 
+static struct eflags_desc riscv_eflags_desc[] = {
+   {EF_RISCV_RVC, "RVC"},
+   {EF_RISCV_RVE, "RVE"},
+   {EF_RISCV_TSO, "TSO"},
+   {0, NULL}
+};
+
 static struct eflags_desc sparc_eflags_desc[] = {
{EF_SPARC_32PLUS, "v8+"},
{EF_SPARC_SUN_US1, "ultrasparcI"},
@@ -2293,6 +2300,23 @@ dump_eflags(struct readelf *re, uint64_t e_flags)
case EM_PPC:
case EM_PPC64:
edesc = powerpc_eflags_desc;
+   break;
+   case EM_RISCV:
+   switch (e_flags & EF_RISCV_FLOAT_ABI_MASK) {
+   case EF_RISCV_FLOAT_ABI_SOFT:
+   printf(", soft-float ABI");
+   break;
+   case EF_RISCV_FLOAT_ABI_SINGLE:
+   printf(", single-float ABI");
+   break;
+   case EF_RISCV_FLOAT_ABI_DOUBLE:
+   printf(", double-float ABI");
+   break;
+   case EF_RISCV_FLOAT_ABI_QUAD:
+   printf(", quad-float ABI");
+   break;
+   }
+   edesc = riscv_eflags_desc;
break;
case EM_SPARC:
case EM_SPARC32PLUS:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349481 - head/sys/sys

2019-06-27 Thread Mitchell Horne
Author: mhorne
Date: Fri Jun 28 00:03:29 2019
New Revision: 349481
URL: https://svnweb.freebsd.org/changeset/base/349481

Log:
  Add some missing RISC-V ELF defines
  
  This adds defines for the RISC-V specific e_flags values, and some of
  the missing static relocations.
  
  Reviewed by:  markj
  Approved by:  markj (mentor)
  Differential Revision:https://reviews.freebsd.org/D20766

Modified:
  head/sys/sys/elf_common.h

Modified: head/sys/sys/elf_common.h
==
--- head/sys/sys/elf_common.h   Fri Jun 28 00:00:02 2019(r349480)
+++ head/sys/sys/elf_common.h   Fri Jun 28 00:03:29 2019(r349481)
@@ -369,6 +369,15 @@ typedef struct {
 #defineEF_PPC_RELOCATABLE  0x0001
 #defineEF_PPC_RELOCATABLE_LIB  0x8000
 
+#defineEF_RISCV_RVC0x0001
+#defineEF_RISCV_FLOAT_ABI_MASK 0x0006
+#defineEF_RISCV_FLOAT_ABI_SOFT 0x
+#defineEF_RISCV_FLOAT_ABI_SINGLE 0x02
+#defineEF_RISCV_FLOAT_ABI_DOUBLE 0x04
+#defineEF_RISCV_FLOAT_ABI_QUAD 0x0006
+#defineEF_RISCV_RVE0x0008
+#defineEF_RISCV_TSO0x0010
+
 #defineEF_SPARC_EXT_MASK   0x0000
 #defineEF_SPARC_32PLUS 0x0100
 #defineEF_SPARC_SUN_US10x0200
@@ -1310,6 +1319,17 @@ typedef struct {
 #defineR_RISCV_ALIGN   43
 #defineR_RISCV_RVC_BRANCH  44
 #defineR_RISCV_RVC_JUMP45
+#defineR_RISCV_RVC_LUI 46
+#defineR_RISCV_GPREL_I 47
+#defineR_RISCV_GPREL_S 48
+#defineR_RISCV_TPREL_I 49
+#defineR_RISCV_TPREL_S 50
+#defineR_RISCV_RELAX   51
+#defineR_RISCV_SUB652
+#defineR_RISCV_SET653
+#defineR_RISCV_SET854
+#defineR_RISCV_SET16   55
+#defineR_RISCV_SET32   56
 
 #defineR_SPARC_NONE0
 #defineR_SPARC_8   1
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349480 - releng/11.3/sys/conf

2019-06-27 Thread Glen Barber
Author: gjb
Date: Fri Jun 28 00:00:02 2019
New Revision: 349480
URL: https://svnweb.freebsd.org/changeset/base/349480

Log:
  Update releng/11.3 to RC3 as part of the 11.3-RELEASE cycle.
  
  Approved by:  re (implicit)
  Sponsored by: Rubicon Communications, LLC (Netgate)

Modified:
  releng/11.3/sys/conf/newvers.sh

Modified: releng/11.3/sys/conf/newvers.sh
==
--- releng/11.3/sys/conf/newvers.sh Thu Jun 27 23:50:54 2019
(r349479)
+++ releng/11.3/sys/conf/newvers.sh Fri Jun 28 00:00:02 2019
(r349480)
@@ -44,7 +44,7 @@
 
 TYPE="FreeBSD"
 REVISION="11.3"
-BRANCH="RC2"
+BRANCH="RC3"
 if [ -n "${BRANCH_OVERRIDE}" ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349478 - head/sys/kern

2019-06-27 Thread Alan Somers
Author: asomers
Date: Thu Jun 27 23:39:06 2019
New Revision: 349478
URL: https://svnweb.freebsd.org/changeset/base/349478

Log:
  FIOBMAP2: inline vn_ioc_bmap2
  
  Reported by:  kib
  Reviewed by:  kib
  MFC after:2 weeks
  MFC-With: 349238
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D20783

Modified:
  head/sys/kern/vfs_vnops.c

Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Thu Jun 27 23:37:09 2019(r349477)
+++ head/sys/kern/vfs_vnops.c   Thu Jun 27 23:39:06 2019(r349478)
@@ -1457,25 +1457,6 @@ vn_stat(struct vnode *vp, struct stat *sb, struct ucre
return (0);
 }
 
-/* generic FIOBMAP2 implementation */
-static int
-vn_ioc_bmap2(struct file *fp, struct fiobmap2_arg *arg, struct ucred *cred)
-{
-   struct vnode *vp = fp->f_vnode;
-   daddr_t lbn = arg->bn;
-   int error;
-
-   vn_lock(vp, LK_SHARED | LK_RETRY);
-#ifdef MAC
-   error = mac_vnode_check_read(cred, fp->f_cred, vp);
-   if (error == 0)
-#endif
-   error = VOP_BMAP(vp, lbn, NULL, >bn, >runp,
-   >runb);
-   VOP_UNLOCK(vp, 0);
-   return (error);
-}
-
 /*
  * File table vnode ioctl routine.
  */
@@ -1485,6 +1466,7 @@ vn_ioctl(struct file *fp, u_long com, void *data, stru
 {
struct vattr vattr;
struct vnode *vp;
+   struct fiobmap2_arg *bmarg;
int error;
 
vp = fp->f_vnode;
@@ -1500,8 +1482,17 @@ vn_ioctl(struct file *fp, u_long com, void *data, stru
*(int *)data = vattr.va_size - fp->f_offset;
return (error);
case FIOBMAP2:
-   return (vn_ioc_bmap2(fp, (struct fiobmap2_arg*)data,
-   active_cred));
+   bmarg = (struct fiobmap2_arg *)data;
+   vn_lock(vp, LK_SHARED | LK_RETRY);
+#ifdef MAC
+   error = mac_vnode_check_read(active_cred, fp->f_cred,
+   vp);
+   if (error == 0)
+#endif
+   error = VOP_BMAP(vp, bmarg->bn, NULL,
+   >bn, >runp, >runb);
+   VOP_UNLOCK(vp, 0);
+   return (error);
case FIONBIO:
case FIOASYNC:
return (0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349477 - head/share/man/man9

2019-06-27 Thread Alan Somers
Author: asomers
Date: Thu Jun 27 23:37:09 2019
New Revision: 349477
URL: https://svnweb.freebsd.org/changeset/base/349477

Log:
  [skip ci] VOP_BMAP.9: fix diction in copyright header
  
  MFC after:2 weeks
  MFC-With: r349230
  Sponsored by: The FreeBSD Foundation

Modified:
  head/share/man/man9/VOP_BMAP.9

Modified: head/share/man/man9/VOP_BMAP.9
==
--- head/share/man/man9/VOP_BMAP.9  Thu Jun 27 23:10:40 2019
(r349476)
+++ head/share/man/man9/VOP_BMAP.9  Thu Jun 27 23:37:09 2019
(r349477)
@@ -3,8 +3,8 @@
 .\"
 .\" Copyright (c) 2019 The FreeBSD Foundation
 .\"
-.\" This software was developed by BFF Storage Systems, LLC under sponsorship
-.\" from the FreeBSD Foundation.
+.\" This documentation was written by BFF Storage Systems, LLC under
+.\" sponsorship from the FreeBSD Foundation.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Quotation received from Chemworld Precious Stones - # 3/37691 - 30710

2019-06-27 Thread Chemworld Precious Stones
Quotation 

Company: CHEMWORLD Precious Stones WorldWide 
Address: 1st Floor, Fakhri Trade Centre, Shahrah-e-Liaqat 


Quote #: 15314
 Jun 27, 2019 

Hello Customer 158, 

You have received a quotation from Burhaan Arshid at CHEMWORLD Precious Stones 
WorldWide  in response to your query for qouation of 100MT of raw Diamonds. 

# ITEM UNIT PRICE 
1 Diamond Model: Vt4115-02, 1/4'', 220vac 
 22,750.00 / Pieces  
2 Diamond Model: Vt307-02, 1/4'', 220vac 
 10,150.00 / Pieces  
3 Diamond Model: Vxz260k, 1'', 220vac 
 28,000.00 / Pieces  

View Full Quotation 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349476 - in head/sys: kern sys

2019-06-27 Thread Rick Macklem
Author: rmacklem
Date: Thu Jun 27 23:10:40 2019
New Revision: 349476
URL: https://svnweb.freebsd.org/changeset/base/349476

Log:
  Add non-blocking trylock variants for the rangelock functions.
  
  A future patch that will add a Linux compatible copy_file_range(2) syscall
  needs to be able to lock the byte ranges of two files concurrently.
  To do this without a risk of deadlock, a non-blocking variant of
  vn_rangelock_rlock() called vn_rangelock_tryrlock() was needed.
  This patch adds this, along with vn_rangelock_trywlock(), in order to
  do this.
  The patch also adds a couple of comments, that I hope clarify how the
  algorithm used in kern_rangelock.c works.
  
  Reviewed by:  kib, asomers (previous version)
  Differential Revision:https://reviews.freebsd.org/D20645

Modified:
  head/sys/kern/kern_rangelock.c
  head/sys/sys/rangelock.h
  head/sys/sys/vnode.h

Modified: head/sys/kern/kern_rangelock.c
==
--- head/sys/kern/kern_rangelock.c  Thu Jun 27 22:50:11 2019
(r349475)
+++ head/sys/kern/kern_rangelock.c  Thu Jun 27 23:10:40 2019
(r349476)
@@ -141,15 +141,33 @@ out:
 
 static void
 rangelock_unlock_locked(struct rangelock *lock, struct rl_q_entry *entry,
-struct mtx *ilk)
+struct mtx *ilk, bool do_calc_block)
 {
 
MPASS(lock != NULL && entry != NULL && ilk != NULL);
mtx_assert(ilk, MA_OWNED);
-   KASSERT(entry != lock->rl_currdep, ("stuck currdep"));
 
+   if (!do_calc_block) {
+   /*
+* This is the case where rangelock_enqueue() has been called
+* with trylock == true and just inserted this entry in the
+* queue.
+* If rl_currdep is this entry, rl_currdep needs to
+* be set to the next entry in the rl_waiters list.
+* However, since this entry is the last entry in the
+* list, the next entry is NULL.
+*/
+   if (lock->rl_currdep == entry) {
+   KASSERT(TAILQ_NEXT(lock->rl_currdep, rl_q_link) == NULL,
+   ("rangelock_enqueue: next entry not NULL"));
+   lock->rl_currdep = NULL;
+   }
+   } else
+   KASSERT(entry != lock->rl_currdep, ("stuck currdep"));
+
TAILQ_REMOVE(>rl_waiters, entry, rl_q_link);
-   rangelock_calc_block(lock);
+   if (do_calc_block)
+   rangelock_calc_block(lock);
mtx_unlock(ilk);
if (curthread->td_rlqe == NULL)
curthread->td_rlqe = entry;
@@ -164,7 +182,7 @@ rangelock_unlock(struct rangelock *lock, void *cookie,
MPASS(lock != NULL && cookie != NULL && ilk != NULL);
 
mtx_lock(ilk);
-   rangelock_unlock_locked(lock, cookie, ilk);
+   rangelock_unlock_locked(lock, cookie, ilk, true);
 }
 
 /*
@@ -185,7 +203,7 @@ rangelock_unlock_range(struct rangelock *lock, void *c
 
mtx_lock(ilk);
if (entry->rl_q_end == end) {
-   rangelock_unlock_locked(lock, cookie, ilk);
+   rangelock_unlock_locked(lock, cookie, ilk, true);
return (NULL);
}
entry->rl_q_end = end;
@@ -196,11 +214,11 @@ rangelock_unlock_range(struct rangelock *lock, void *c
 
 /*
  * Add the lock request to the queue of the pending requests for
- * rangelock.  Sleep until the request can be granted.
+ * rangelock.  Sleep until the request can be granted unless trylock == true.
  */
 static void *
 rangelock_enqueue(struct rangelock *lock, off_t start, off_t end, int mode,
-struct mtx *ilk)
+struct mtx *ilk, bool trylock)
 {
struct rl_q_entry *entry;
struct thread *td;
@@ -226,11 +244,28 @@ rangelock_enqueue(struct rangelock *lock, off_t start,
 */
 
TAILQ_INSERT_TAIL(>rl_waiters, entry, rl_q_link);
+   /*
+* If rl_currdep == NULL, there is no entry waiting for a conflicting
+* range to be resolved, so set rl_currdep to this entry.  If there is
+* no conflicting entry for this entry, rl_currdep will be set back to
+* NULL by rangelock_calc_block().
+*/
if (lock->rl_currdep == NULL)
lock->rl_currdep = entry;
rangelock_calc_block(lock);
-   while (!(entry->rl_q_flags & RL_LOCK_GRANTED))
+   while (!(entry->rl_q_flags & RL_LOCK_GRANTED)) {
+   if (trylock) {
+   /*
+* For this case, the range is not actually locked
+* yet, but removal from the list requires the same
+* steps, except for not doing a rangelock_calc_block()
+* call, since rangelock_calc_block() was called above.
+*/
+   rangelock_unlock_locked(lock, entry, ilk, false);
+   return (NULL);
+   }

svn commit: r349475 - head/sys/kern

2019-06-27 Thread John Baldwin
Author: jhb
Date: Thu Jun 27 22:50:11 2019
New Revision: 349475
URL: https://svnweb.freebsd.org/changeset/base/349475

Log:
  Fix comment in sofree() to reference sbdestroy().
  
  r160875 added sbdestroy() as a wrapper around sbrelease_internal to be
  called from sofree(), yet the comment added in the same revision to
  sofree() still mentions sbrelease_internal().
  
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D20488

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Thu Jun 27 22:34:05 2019(r349474)
+++ head/sys/kern/uipc_socket.c Thu Jun 27 22:50:11 2019(r349475)
@@ -1044,7 +1044,7 @@ sofree(struct socket *so)
 *
 * We used to do a lot of socket buffer and socket locking here, as
 * well as invoke sorflush() and perform wakeups.  The direct call to
-* dom_dispose() and sbrelease_internal() are an inlining of what was
+* dom_dispose() and sbdestroy() are an inlining of what was
 * necessary from sorflush().
 *
 * Notice that the socket buffer and kqueue state are torn down
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349474 - head/sys/netinet

2019-06-27 Thread John Baldwin
Author: jhb
Date: Thu Jun 27 22:34:05 2019
New Revision: 349474
URL: https://svnweb.freebsd.org/changeset/base/349474

Log:
  Reject attempts to register a TCP stack being unloaded.
  
  Reviewed by:  gallatin
  MFC after:2 weeks
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D20617

Modified:
  head/sys/netinet/tcp_subr.c

Modified: head/sys/netinet/tcp_subr.c
==
--- head/sys/netinet/tcp_subr.c Thu Jun 27 22:24:56 2019(r349473)
+++ head/sys/netinet/tcp_subr.c Thu Jun 27 22:34:05 2019(r349474)
@@ -798,8 +798,12 @@ register_tcp_functions_as_names(struct tcp_function_bl
}
}
 
+   if (blk->tfb_flags & TCP_FUNC_BEING_REMOVED) {
+   *num_names = 0;
+   return (EINVAL);
+   }
+
refcount_init(>tfb_refcnt, 0);
-   blk->tfb_flags = 0;
blk->tfb_id = atomic_fetchadd_int(_tcp_stack_id, 1);
for (i = 0; i < *num_names; i++) {
n = malloc(sizeof(struct tcp_function), M_TCPFUNCTIONS, wait);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349472 - head/sys/dev/gpio

2019-06-27 Thread Li-Wen Hsu
Author: lwhsu
Date: Thu Jun 27 22:18:21 2019
New Revision: 349472
URL: https://svnweb.freebsd.org/changeset/base/349472

Log:
  Follow r349460 to complete removing "flags" in struct gpiobus_ivar
  
  MFC with: r349460
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/gpio/ofw_gpiobus.c

Modified: head/sys/dev/gpio/ofw_gpiobus.c
==
--- head/sys/dev/gpio/ofw_gpiobus.c Thu Jun 27 22:06:41 2019
(r349471)
+++ head/sys/dev/gpio/ofw_gpiobus.c Thu Jun 27 22:18:21 2019
(r349472)
@@ -321,10 +321,8 @@ ofw_gpiobus_setup_devinfo(device_t bus, device_t child
ofw_gpiobus_destroy_devinfo(bus, dinfo);
return (NULL);
}
-   for (i = 0; i < devi->npins; i++) {
-   devi->flags[i] = pins[i].flags;
+   for (i = 0; i < devi->npins; i++)
devi->pins[i] = pins[i].pin;
-   }
free(pins, M_DEVBUF);
/* Parse the interrupt resources. */
if (ofw_bus_intr_to_rl(bus, node, >opd_dinfo.rl, NULL) != 0) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349471 - head/stand/efi/loader

2019-06-27 Thread Rebecca Cran
Author: bcran
Date: Thu Jun 27 22:06:41 2019
New Revision: 349471
URL: https://svnweb.freebsd.org/changeset/base/349471

Log:
  Increase EFI_STAGING_SIZE to 100MB on x64
  
  To avoid failures when the large 18MB nvidia.ko module is being loaded,
  increase EFI_STAGING_SIZE from 64MB to 100MB on x64 systems.
  Leave the other platforms at 64MB.

Modified:
  head/stand/efi/loader/copy.c

Modified: head/stand/efi/loader/copy.c
==
--- head/stand/efi/loader/copy.cThu Jun 27 21:45:40 2019
(r349470)
+++ head/stand/efi/loader/copy.cThu Jun 27 22:06:41 2019
(r349471)
@@ -176,7 +176,11 @@ out:
 #endif /* __i386__ || __amd64__ */
 
 #ifndef EFI_STAGING_SIZE
+#if defined(__amd64__)
+#defineEFI_STAGING_SIZE100
+#else
 #defineEFI_STAGING_SIZE64
+#endif
 #endif
 
 EFI_PHYSICAL_ADDRESS   staging, staging_end;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r349231 - in head/sys: kern sys ufs/ufs

2019-06-27 Thread Scott Long


> On Jun 27, 2019, at 3:09 PM, Konstantin Belousov  wrote:
> 
> On Thu, Jun 27, 2019 at 02:01:11PM -0600, Alan Somers wrote:
>> On Thu, Jun 27, 2019 at 1:18 PM Konstantin Belousov  
>> wrote:
>>> 
>>> On Thu, Jun 20, 2019 at 02:13:11PM +, Alan Somers wrote:
 Author: asomers
 Date: Thu Jun 20 14:13:10 2019
 New Revision: 349231
 URL: https://svnweb.freebsd.org/changeset/base/349231
 
 Log:
  Add FIOBMAP2 ioctl
>>> 
 
  This ioctl exposes VOP_BMAP information to userland. It can be used by
  programs like fragmentation analyzers and optimized cp implementations. 
 But
  I'm using it to test fusefs's VOP_BMAP implementation. The "2" in the name
  distinguishes it from the similar but incompatible FIBMAP ioctls in NetBSD
  and Linux.  FIOBMAP2 differs from FIBMAP in that it uses a 64-bit block
  number instead of 32-bit, and it also returns runp and runb.
 
  Reviewed by:mckusick
  MFC after:  2 weeks
  Sponsored by:   The FreeBSD Foundation
  Differential Revision:  https://reviews.freebsd.org/D20705
 
 Modified:
  head/sys/kern/vfs_vnops.c
  head/sys/sys/filio.h
  head/sys/ufs/ufs/ufs_bmap.c
 
 Modified: head/sys/kern/vfs_vnops.c
 ==
 --- head/sys/kern/vfs_vnops.c Thu Jun 20 13:59:46 2019(r349230)
 +++ head/sys/kern/vfs_vnops.c Thu Jun 20 14:13:10 2019(r349231)
 @@ -1458,6 +1458,25 @@ vn_stat(struct vnode *vp, struct stat *sb, struct 
 ucre
  return (0);
 }
 
 +/* generic FIOBMAP2 implementation */
 +static int
 +vn_ioc_bmap2(struct file *fp, struct fiobmap2_arg *arg, struct ucred 
 *cred)
>>> I do not like the fact that internal kernel function takes the
>>> user-visible structure which results in the mix of ABI and KBI.
>>> Traditionally we pass explicit arguments to kern_XXX, vn_XXX and similar
>>> internal implementations.
>> 
>> Ok.  It will increase the number of function arguments, which is ugly,
>> but I can do it if you prefer.
>> 
>>> 
 +{
 + struct vnode *vp = fp->f_vnode;
>>> Why do you pass fp to the function that
>>> 1. Has vn_ namespace, i.e. operating on vnode.
>>> 2. Only needs vnode to operate on.
>>> Please change the argument from fp to vp.  You would need to pass f_cred
>>> as additional argument, or move mac check to vn_ioctl (I think this is
>>> a better approach).
>> 
>> Ok.
>> 
>>> 
 + daddr_t lbn = arg->bn;
>>> Style: initialization in declaration.
>>> 
 + int error;
 +
 + vn_lock(vp, LK_SHARED | LK_RETRY);
 +#ifdef MAC
 + error = mac_vnode_check_read(cred, fp->f_cred, vp);
 + if (error == 0)
 +#endif
 + error = VOP_BMAP(vp, lbn, NULL, >bn, >runp,
 + >runb);
>>> Wrong indent for continuation line.
>>> 
 + VOP_UNLOCK(vp, 0);
 + return (error);
 +}
 +
 /*
  * File table vnode ioctl routine.
  */
 @@ -1481,6 +1500,9 @@ vn_ioctl(struct file *fp, u_long com, void *data, 
 stru
  if (error == 0)
  *(int *)data = vattr.va_size - fp->f_offset;
  return (error);
 + case FIOBMAP2:
 + return (vn_ioc_bmap2(fp, (struct fiobmap2_arg*)data,
>>> Need space between fiobmap2_arg and '*'.
 + active_cred));
>>> Wrong indent.
>>> 
  case FIONBIO:
  case FIOASYNC:
  return (0);
 
 Modified: head/sys/sys/filio.h
 ==
 --- head/sys/sys/filio.h  Thu Jun 20 13:59:46 2019(r349230)
 +++ head/sys/sys/filio.h  Thu Jun 20 14:13:10 2019(r349231)
 @@ -62,6 +62,13 @@ struct fiodgname_arg {
 /* Handle lseek SEEK_DATA and SEEK_HOLE for holey file knowledge. */
 #define  FIOSEEKDATA _IOWR('f', 97, off_t)   /* SEEK_DATA */
 #define  FIOSEEKHOLE _IOWR('f', 98, off_t)   /* SEEK_HOLE */
 +struct fiobmap2_arg {
 + int64_t bn;
 + int runp;
 + int runb;
 +};
>>> This structure has different layout for LP64 and ILP32, and you did not
>>> provided the compat shims.
>> 
>> Really?  How so?  All of the fields have the same width on 64 and 32
>> bit archs, and there shouldn't be any need for padding, either.
> Sorry, you are right.
> 
>> 
>>> 
 +/* Get the file's bmap info for the logical block bn */
 +#define FIOBMAP2 _IOWR('f', 99, struct fiobmap2_arg)
 
 #ifdef _KERNEL
 #ifdef COMPAT_FREEBSD32
 
 Modified: head/sys/ufs/ufs/ufs_bmap.c
 ==
 --- head/sys/ufs/ufs/ufs_bmap.c   Thu Jun 20 13:59:46 2019

svn commit: r349470 - head/usr.sbin/bhyve

2019-06-27 Thread John Baldwin
Author: jhb
Date: Thu Jun 27 21:45:40 2019
New Revision: 349470
URL: https://svnweb.freebsd.org/changeset/base/349470

Log:
  Use __FBSDID() and sort #includes.
  
  No functional change.

Modified:
  head/usr.sbin/bhyve/net_utils.c

Modified: head/usr.sbin/bhyve/net_utils.c
==
--- head/usr.sbin/bhyve/net_utils.c Thu Jun 27 20:34:50 2019
(r349469)
+++ head/usr.sbin/bhyve/net_utils.c Thu Jun 27 21:45:40 2019
(r349470)
@@ -21,17 +21,21 @@
  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
  */
 
-#include "net_utils.h"
-#include "bhyverun.h"
-#include 
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
 #include 
-#include 
-#include 
+
 #include 
+#include 
+#include 
+#include 
+
+#include "bhyverun.h"
+#include "net_utils.h"
 
 int
 net_parsemac(char *mac_str, uint8_t *mac_addr)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r349231 - in head/sys: kern sys ufs/ufs

2019-06-27 Thread Konstantin Belousov
On Thu, Jun 27, 2019 at 02:01:11PM -0600, Alan Somers wrote:
> On Thu, Jun 27, 2019 at 1:18 PM Konstantin Belousov  
> wrote:
> >
> > On Thu, Jun 20, 2019 at 02:13:11PM +, Alan Somers wrote:
> > > Author: asomers
> > > Date: Thu Jun 20 14:13:10 2019
> > > New Revision: 349231
> > > URL: https://svnweb.freebsd.org/changeset/base/349231
> > >
> > > Log:
> > >   Add FIOBMAP2 ioctl
> >
> > >
> > >   This ioctl exposes VOP_BMAP information to userland. It can be used by
> > >   programs like fragmentation analyzers and optimized cp implementations. 
> > > But
> > >   I'm using it to test fusefs's VOP_BMAP implementation. The "2" in the 
> > > name
> > >   distinguishes it from the similar but incompatible FIBMAP ioctls in 
> > > NetBSD
> > >   and Linux.  FIOBMAP2 differs from FIBMAP in that it uses a 64-bit block
> > >   number instead of 32-bit, and it also returns runp and runb.
> > >
> > >   Reviewed by:mckusick
> > >   MFC after:  2 weeks
> > >   Sponsored by:   The FreeBSD Foundation
> > >   Differential Revision:  https://reviews.freebsd.org/D20705
> > >
> > > Modified:
> > >   head/sys/kern/vfs_vnops.c
> > >   head/sys/sys/filio.h
> > >   head/sys/ufs/ufs/ufs_bmap.c
> > >
> > > Modified: head/sys/kern/vfs_vnops.c
> > > ==
> > > --- head/sys/kern/vfs_vnops.c Thu Jun 20 13:59:46 2019(r349230)
> > > +++ head/sys/kern/vfs_vnops.c Thu Jun 20 14:13:10 2019(r349231)
> > > @@ -1458,6 +1458,25 @@ vn_stat(struct vnode *vp, struct stat *sb, struct 
> > > ucre
> > >   return (0);
> > >  }
> > >
> > > +/* generic FIOBMAP2 implementation */
> > > +static int
> > > +vn_ioc_bmap2(struct file *fp, struct fiobmap2_arg *arg, struct ucred 
> > > *cred)
> > I do not like the fact that internal kernel function takes the
> > user-visible structure which results in the mix of ABI and KBI.
> > Traditionally we pass explicit arguments to kern_XXX, vn_XXX and similar
> > internal implementations.
> 
> Ok.  It will increase the number of function arguments, which is ugly,
> but I can do it if you prefer.
> 
> >
> > > +{
> > > + struct vnode *vp = fp->f_vnode;
> > Why do you pass fp to the function that
> > 1. Has vn_ namespace, i.e. operating on vnode.
> > 2. Only needs vnode to operate on.
> > Please change the argument from fp to vp.  You would need to pass f_cred
> > as additional argument, or move mac check to vn_ioctl (I think this is
> > a better approach).
> 
> Ok.
> 
> >
> > > + daddr_t lbn = arg->bn;
> > Style: initialization in declaration.
> >
> > > + int error;
> > > +
> > > + vn_lock(vp, LK_SHARED | LK_RETRY);
> > > +#ifdef MAC
> > > + error = mac_vnode_check_read(cred, fp->f_cred, vp);
> > > + if (error == 0)
> > > +#endif
> > > + error = VOP_BMAP(vp, lbn, NULL, >bn, >runp,
> > > + >runb);
> > Wrong indent for continuation line.
> >
> > > + VOP_UNLOCK(vp, 0);
> > > + return (error);
> > > +}
> > > +
> > >  /*
> > >   * File table vnode ioctl routine.
> > >   */
> > > @@ -1481,6 +1500,9 @@ vn_ioctl(struct file *fp, u_long com, void *data, 
> > > stru
> > >   if (error == 0)
> > >   *(int *)data = vattr.va_size - fp->f_offset;
> > >   return (error);
> > > + case FIOBMAP2:
> > > + return (vn_ioc_bmap2(fp, (struct fiobmap2_arg*)data,
> > Need space between fiobmap2_arg and '*'.
> > > + active_cred));
> > Wrong indent.
> >
> > >   case FIONBIO:
> > >   case FIOASYNC:
> > >   return (0);
> > >
> > > Modified: head/sys/sys/filio.h
> > > ==
> > > --- head/sys/sys/filio.h  Thu Jun 20 13:59:46 2019(r349230)
> > > +++ head/sys/sys/filio.h  Thu Jun 20 14:13:10 2019(r349231)
> > > @@ -62,6 +62,13 @@ struct fiodgname_arg {
> > >  /* Handle lseek SEEK_DATA and SEEK_HOLE for holey file knowledge. */
> > >  #define  FIOSEEKDATA _IOWR('f', 97, off_t)   /* SEEK_DATA */
> > >  #define  FIOSEEKHOLE _IOWR('f', 98, off_t)   /* SEEK_HOLE */
> > > +struct fiobmap2_arg {
> > > + int64_t bn;
> > > + int runp;
> > > + int runb;
> > > +};
> > This structure has different layout for LP64 and ILP32, and you did not
> > provided the compat shims.
> 
> Really?  How so?  All of the fields have the same width on 64 and 32
> bit archs, and there shouldn't be any need for padding, either.
Sorry, you are right.

> 
> >
> > > +/* Get the file's bmap info for the logical block bn */
> > > +#define FIOBMAP2 _IOWR('f', 99, struct fiobmap2_arg)
> > >
> > >  #ifdef _KERNEL
> > >  #ifdef COMPAT_FREEBSD32
> > >
> > > Modified: head/sys/ufs/ufs/ufs_bmap.c
> > > ==
> > > --- head/sys/ufs/ufs/ufs_bmap.c

svn commit: r349469 - head/usr.bin/uname

2019-06-27 Thread Ed Maste
Author: emaste
Date: Thu Jun 27 20:34:50 2019
New Revision: 349469
URL: https://svnweb.freebsd.org/changeset/base/349469

Log:
  Expose the kernel's build-ID through `uname -b`
  
  After r348611 the kernel's build-ID is available via sysctl.  Add a -b flag
  to uname to report it.
  
  Submitted by: Ali Mashtizadeh 
  Reviewed by:  markj, imp
  Relnotes: Yes
  Event:Waterloo Hackathon 2019
  Differential Revision:https://reviews.freebsd.org/D20511

Modified:
  head/usr.bin/uname/uname.1
  head/usr.bin/uname/uname.c

Modified: head/usr.bin/uname/uname.1
==
--- head/usr.bin/uname/uname.1  Thu Jun 27 20:18:12 2019(r349468)
+++ head/usr.bin/uname/uname.1  Thu Jun 27 20:34:50 2019(r349469)
@@ -28,7 +28,7 @@
 .\"@(#)uname.1 8.3 (Berkeley) 4/8/94
 .\" $FreeBSD$
 .\"
-.Dd May 31, 2017
+.Dd June 27, 2019
 .Dt UNAME 1
 .Os
 .Sh NAME
@@ -36,7 +36,7 @@
 .Nd display information about the system
 .Sh SYNOPSIS
 .Nm
-.Op Fl aiKmnoprsUv
+.Op Fl abiKmnoprsUv
 .Sh DESCRIPTION
 The
 .Nm
@@ -53,6 +53,8 @@ Behave as though the options
 and
 .Fl v
 were specified.
+.It Fl b
+Write the kernel's linker-generated build-id to standard output.
 .It Fl i
 Write the kernel ident to standard output.
 .It Fl K
@@ -152,3 +154,7 @@ and
 .Fl U
 extension flags appeared in
 .Fx 10.0 .
+The
+.Fl b
+extension flag appeared in
+.Fx 13.0 .

Modified: head/usr.bin/uname/uname.c
==
--- head/usr.bin/uname/uname.c  Thu Jun 27 20:18:12 2019(r349468)
+++ head/usr.bin/uname/uname.c  Thu Jun 27 20:34:50 2019(r349469)
@@ -67,9 +67,10 @@ static const char sccsid[] = "@(#)uname.c8.2 (Berkele
 #defineIFLAG   0x40
 #defineUFLAG   0x80
 #defineKFLAG   0x100
+#defineBFLAG   0x200
 
 typedef void (*get_t)(void);
-static get_t get_ident, get_platform, get_hostname, get_arch,
+static get_t get_buildid, get_ident, get_platform, get_hostname, get_arch,
 get_release, get_sysname, get_kernvers, get_uservers, get_version;
 
 static void native_ident(void);
@@ -81,11 +82,13 @@ static void native_sysname(void);
 static void native_version(void);
 static void native_kernvers(void);
 static void native_uservers(void);
+static void native_buildid(void);
 static void print_uname(u_int);
 static void setup_get(void);
 static void usage(void);
 
-static char *ident, *platform, *hostname, *arch, *release, *sysname, *version, 
*kernvers, *uservers;
+static char *buildid, *ident, *platform, *hostname, *arch, *release, *sysname,
+*version, *kernvers, *uservers;
 static int space;
 
 int
@@ -97,11 +100,14 @@ main(int argc, char *argv[])
setup_get();
flags = 0;
 
-   while ((ch = getopt(argc, argv, "aiKmnoprsUv")) != -1)
+   while ((ch = getopt(argc, argv, "abiKmnoprsUv")) != -1)
switch(ch) {
case 'a':
flags |= (MFLAG | NFLAG | RFLAG | SFLAG | VFLAG);
break;
+   case 'b':
+   flags |= BFLAG;
+   break;
case 'i':
flags |= IFLAG;
break;
@@ -169,6 +175,7 @@ setup_get(void)
CHECK_ENV("i", ident);
CHECK_ENV("K", kernvers);
CHECK_ENV("U", uservers);
+   CHECK_ENV("b", buildid);
 }
 
 #definePRINT_FLAG(flags,flag,var)  \
@@ -194,6 +201,7 @@ print_uname(u_int flags)
PRINT_FLAG(flags, IFLAG, ident);
PRINT_FLAG(flags, KFLAG, kernvers);
PRINT_FLAG(flags, UFLAG, uservers);
+   PRINT_FLAG(flags, BFLAG, buildid);
printf("\n");
 }
 
@@ -261,6 +269,9 @@ NATIVE_SYSCTL2_GET(arch, CTL_HW, HW_MACHINE_ARCH) {
 NATIVE_SYSCTLNAME_GET(ident, "kern.ident") {
 } NATIVE_SET;
 
+NATIVE_SYSCTLNAME_GET(buildid, "kern.build_id") {
+} NATIVE_SET;
+
 static void
 native_uservers(void)
 {
@@ -282,6 +293,6 @@ native_kernvers(void)
 static void
 usage(void)
 {
-   fprintf(stderr, "usage: uname [-aiKmnoprsUv]\n");
+   fprintf(stderr, "usage: uname [-abiKmnoprsUv]\n");
exit(1);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r349459 - head/sys/sys

2019-06-27 Thread Andriy Gapon
On 27/06/2019 20:37, Bruce Evans wrote:
> On Thu, 27 Jun 2019, Andriy Gapon wrote:
> 
>> On 27/06/2019 18:47, Bruce Evans wrote:
>>> On Thu, 27 Jun 2019, Andriy Gapon wrote:
>>>
 Log:
  upgrade the warning printf-s in bus accessors to KASSERT-s

  After this change sys/bus.h includes sys/systm.h.
>>>
>>> This is further namespace pollution.  sys/systm.h is a prerequiste for
>>> all kernel headers except sys/param.h and the headers that that includes,
>>> since any kernel header (except sys/param.hm etc.) may have inlines which
>>> use features in systm.h, e.g., KASSERT() or an inline function.
>>
>> what do you think about amending style(9) to require that if sys/systm.h is 
>> to
>> be included, then it must be included before any other header except for
>> sys/param.h (and possibly sys/cdefs.h) ?
> 
> It is not a style matter.

I know... but style(9) documents sys/param.h for similar reasons.

> sys/systm.h is just a prerequisite for almost
> all kernel code.  Perhaps this can be enforced using #ifdef magic even
> for headers that don't currently use it.  If it is to be included nested,
> then sys/param.h is the place to include it, but I don't like that since
> it is even less related to parameters than sys/param.h, and this would be
> a regression from minor depollution of sys/param.h.
> 
> sys/systm.h is also kernel-only, and as you found, including it nested
> tends to break applications, so other headers that have the bug of
> including it tend to have _KERNEL ifdefs to avoid including it in
> applications.  This is so fundamental that it doesn't have a "No
> user-serviceable parts inside" ifdef.

I think that there is a trivial fix to my commit: moving the sys/systm.h include
to the _KERNEL section of sys/bus.h.  That's where its definitions are actually
used.
But I agree that there should be a better approach.


-- 
Andriy Gapon
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r349231 - in head/sys: kern sys ufs/ufs

2019-06-27 Thread Alan Somers
On Thu, Jun 27, 2019 at 1:18 PM Konstantin Belousov  wrote:
>
> On Thu, Jun 20, 2019 at 02:13:11PM +, Alan Somers wrote:
> > Author: asomers
> > Date: Thu Jun 20 14:13:10 2019
> > New Revision: 349231
> > URL: https://svnweb.freebsd.org/changeset/base/349231
> >
> > Log:
> >   Add FIOBMAP2 ioctl
>
> >
> >   This ioctl exposes VOP_BMAP information to userland. It can be used by
> >   programs like fragmentation analyzers and optimized cp implementations. 
> > But
> >   I'm using it to test fusefs's VOP_BMAP implementation. The "2" in the name
> >   distinguishes it from the similar but incompatible FIBMAP ioctls in NetBSD
> >   and Linux.  FIOBMAP2 differs from FIBMAP in that it uses a 64-bit block
> >   number instead of 32-bit, and it also returns runp and runb.
> >
> >   Reviewed by:mckusick
> >   MFC after:  2 weeks
> >   Sponsored by:   The FreeBSD Foundation
> >   Differential Revision:  https://reviews.freebsd.org/D20705
> >
> > Modified:
> >   head/sys/kern/vfs_vnops.c
> >   head/sys/sys/filio.h
> >   head/sys/ufs/ufs/ufs_bmap.c
> >
> > Modified: head/sys/kern/vfs_vnops.c
> > ==
> > --- head/sys/kern/vfs_vnops.c Thu Jun 20 13:59:46 2019(r349230)
> > +++ head/sys/kern/vfs_vnops.c Thu Jun 20 14:13:10 2019(r349231)
> > @@ -1458,6 +1458,25 @@ vn_stat(struct vnode *vp, struct stat *sb, struct 
> > ucre
> >   return (0);
> >  }
> >
> > +/* generic FIOBMAP2 implementation */
> > +static int
> > +vn_ioc_bmap2(struct file *fp, struct fiobmap2_arg *arg, struct ucred *cred)
> I do not like the fact that internal kernel function takes the
> user-visible structure which results in the mix of ABI and KBI.
> Traditionally we pass explicit arguments to kern_XXX, vn_XXX and similar
> internal implementations.

Ok.  It will increase the number of function arguments, which is ugly,
but I can do it if you prefer.

>
> > +{
> > + struct vnode *vp = fp->f_vnode;
> Why do you pass fp to the function that
> 1. Has vn_ namespace, i.e. operating on vnode.
> 2. Only needs vnode to operate on.
> Please change the argument from fp to vp.  You would need to pass f_cred
> as additional argument, or move mac check to vn_ioctl (I think this is
> a better approach).

Ok.

>
> > + daddr_t lbn = arg->bn;
> Style: initialization in declaration.
>
> > + int error;
> > +
> > + vn_lock(vp, LK_SHARED | LK_RETRY);
> > +#ifdef MAC
> > + error = mac_vnode_check_read(cred, fp->f_cred, vp);
> > + if (error == 0)
> > +#endif
> > + error = VOP_BMAP(vp, lbn, NULL, >bn, >runp,
> > + >runb);
> Wrong indent for continuation line.
>
> > + VOP_UNLOCK(vp, 0);
> > + return (error);
> > +}
> > +
> >  /*
> >   * File table vnode ioctl routine.
> >   */
> > @@ -1481,6 +1500,9 @@ vn_ioctl(struct file *fp, u_long com, void *data, stru
> >   if (error == 0)
> >   *(int *)data = vattr.va_size - fp->f_offset;
> >   return (error);
> > + case FIOBMAP2:
> > + return (vn_ioc_bmap2(fp, (struct fiobmap2_arg*)data,
> Need space between fiobmap2_arg and '*'.
> > + active_cred));
> Wrong indent.
>
> >   case FIONBIO:
> >   case FIOASYNC:
> >   return (0);
> >
> > Modified: head/sys/sys/filio.h
> > ==
> > --- head/sys/sys/filio.h  Thu Jun 20 13:59:46 2019(r349230)
> > +++ head/sys/sys/filio.h  Thu Jun 20 14:13:10 2019(r349231)
> > @@ -62,6 +62,13 @@ struct fiodgname_arg {
> >  /* Handle lseek SEEK_DATA and SEEK_HOLE for holey file knowledge. */
> >  #define  FIOSEEKDATA _IOWR('f', 97, off_t)   /* SEEK_DATA */
> >  #define  FIOSEEKHOLE _IOWR('f', 98, off_t)   /* SEEK_HOLE */
> > +struct fiobmap2_arg {
> > + int64_t bn;
> > + int runp;
> > + int runb;
> > +};
> This structure has different layout for LP64 and ILP32, and you did not
> provided the compat shims.

Really?  How so?  All of the fields have the same width on 64 and 32
bit archs, and there shouldn't be any need for padding, either.

>
> > +/* Get the file's bmap info for the logical block bn */
> > +#define FIOBMAP2 _IOWR('f', 99, struct fiobmap2_arg)
> >
> >  #ifdef _KERNEL
> >  #ifdef COMPAT_FREEBSD32
> >
> > Modified: head/sys/ufs/ufs/ufs_bmap.c
> > ==
> > --- head/sys/ufs/ufs/ufs_bmap.c   Thu Jun 20 13:59:46 2019
> > (r349230)
> > +++ head/sys/ufs/ufs/ufs_bmap.c   Thu Jun 20 14:13:10 2019
> > (r349231)
> > @@ -200,12 +200,15 @@ ufs_bmaparray(vp, bn, bnp, nbp, runp, runb)
> >   *bnp = blkptrtodb(ump, ip->i_din2->di_extb[-1 - bn]);
> >   if (*bnp == 0)
> >   *bnp 

svn commit: r349467 - head/sys/dev/cxgbe/tom

2019-06-27 Thread John Baldwin
Author: jhb
Date: Thu Jun 27 19:36:30 2019
New Revision: 349467
URL: https://svnweb.freebsd.org/changeset/base/349467

Log:
  Hold an explicit reference on the socket for the aiotx task.
  
  Previously, the aiotx task relied on the aio jobs in the queue to hold
  a reference on the socket.  However, when the last job is completed,
  there is nothing left to hold a reference to the socket buffer lock
  used to check if the queue is empty.  In addition, if the last job on
  the queue is cancelled, the task can run with no queued jobs holding a
  reference to the socket buffer lock the task uses to notice the queue
  is empty.
  
  Fix these races by holding an explicit reference on the socket when
  the task is queued and dropping that reference when the task
  completes.
  
  Reviewed by:  np
  MFC after:1 week
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D20539

Modified:
  head/sys/dev/cxgbe/tom/t4_cpl_io.c
  head/sys/dev/cxgbe/tom/t4_tom.h

Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c
==
--- head/sys/dev/cxgbe/tom/t4_cpl_io.c  Thu Jun 27 18:08:18 2019
(r349466)
+++ head/sys/dev/cxgbe/tom/t4_cpl_io.c  Thu Jun 27 19:36:30 2019
(r349467)
@@ -74,7 +74,7 @@ __FBSDID("$FreeBSD$");
 #include "tom/t4_tom.h"
 
 static voidt4_aiotx_cancel(struct kaiocb *job);
-static voidt4_aiotx_queue_toep(struct toepcb *toep);
+static voidt4_aiotx_queue_toep(struct socket *so, struct toepcb *toep);
 
 static size_t
 aiotx_mbuf_pgoff(struct mbuf *m)
@@ -785,7 +785,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep
if (sowwakeup) {
if (!TAILQ_EMPTY(
>aiotx_jobq))
-   t4_aiotx_queue_toep(
+   t4_aiotx_queue_toep(so,
toep);
sowwakeup_locked(so);
} else
@@ -829,7 +829,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep
}
if (sowwakeup) {
if (!TAILQ_EMPTY(>aiotx_jobq))
-   t4_aiotx_queue_toep(toep);
+   t4_aiotx_queue_toep(so, toep);
sowwakeup_locked(so);
} else
SOCKBUF_UNLOCK(sb);
@@ -1821,7 +1821,7 @@ do_fw4_ack(struct sge_iq *iq, const struct rss_header 
tls_ofld->sb_off -= plen;
}
if (!TAILQ_EMPTY(>aiotx_jobq))
-   t4_aiotx_queue_toep(toep);
+   t4_aiotx_queue_toep(so, toep);
sowwakeup_locked(so);   /* unlocks so_snd */
}
SOCKBUF_UNLOCK_ASSERT(sb);
@@ -2195,10 +2195,10 @@ static void
 t4_aiotx_task(void *context, int pending)
 {
struct toepcb *toep = context;
-   struct inpcb *inp = toep->inp;
-   struct socket *so = inp->inp_socket;
+   struct socket *so;
struct kaiocb *job;
 
+   so = toep->aiotx_so;
CURVNET_SET(toep->vnet);
SOCKBUF_LOCK(>so_snd);
while (!TAILQ_EMPTY(>aiotx_jobq) && sowriteable(so)) {
@@ -2209,15 +2209,17 @@ t4_aiotx_task(void *context, int pending)
 
t4_aiotx_process_job(toep, so, job);
}
-   toep->aiotx_task_active = false;
+   toep->aiotx_so = NULL;
SOCKBUF_UNLOCK(>so_snd);
CURVNET_RESTORE();
 
free_toepcb(toep);
+   SOCK_LOCK(so);
+   sorele(so);
 }
 
 static void
-t4_aiotx_queue_toep(struct toepcb *toep)
+t4_aiotx_queue_toep(struct socket *so, struct toepcb *toep)
 {
 
SOCKBUF_LOCK_ASSERT(>inp->inp_socket->so_snd);
@@ -2225,9 +2227,10 @@ t4_aiotx_queue_toep(struct toepcb *toep)
CTR3(KTR_CXGBE, "%s: queueing aiotx task for tid %d, active = %s",
__func__, toep->tid, toep->aiotx_task_active ? "true" : "false");
 #endif
-   if (toep->aiotx_task_active)
+   if (toep->aiotx_so != NULL)
return;
-   toep->aiotx_task_active = true;
+   soref(so);
+   toep->aiotx_so = so;
hold_toepcb(toep);
soaio_enqueue(>aiotx_task);
 }
@@ -2284,7 +2287,7 @@ t4_aio_queue_aiotx(struct socket *so, struct kaiocb *j
panic("new job was cancelled");
TAILQ_INSERT_TAIL(>aiotx_jobq, job, list);
if (sowriteable(so))
-   t4_aiotx_queue_toep(toep);
+   t4_aiotx_queue_toep(so, toep);
SOCKBUF_UNLOCK(>so_snd);
return (0);
 }

Modified: head/sys/dev/cxgbe/tom/t4_tom.h
==
--- 

Re: svn commit: r349231 - in head/sys: kern sys ufs/ufs

2019-06-27 Thread Konstantin Belousov
On Thu, Jun 20, 2019 at 02:13:11PM +, Alan Somers wrote:
> Author: asomers
> Date: Thu Jun 20 14:13:10 2019
> New Revision: 349231
> URL: https://svnweb.freebsd.org/changeset/base/349231
> 
> Log:
>   Add FIOBMAP2 ioctl

>   
>   This ioctl exposes VOP_BMAP information to userland. It can be used by
>   programs like fragmentation analyzers and optimized cp implementations. But
>   I'm using it to test fusefs's VOP_BMAP implementation. The "2" in the name
>   distinguishes it from the similar but incompatible FIBMAP ioctls in NetBSD
>   and Linux.  FIOBMAP2 differs from FIBMAP in that it uses a 64-bit block
>   number instead of 32-bit, and it also returns runp and runb.
>   
>   Reviewed by:mckusick
>   MFC after:  2 weeks
>   Sponsored by:   The FreeBSD Foundation
>   Differential Revision:  https://reviews.freebsd.org/D20705
> 
> Modified:
>   head/sys/kern/vfs_vnops.c
>   head/sys/sys/filio.h
>   head/sys/ufs/ufs/ufs_bmap.c
> 
> Modified: head/sys/kern/vfs_vnops.c
> ==
> --- head/sys/kern/vfs_vnops.c Thu Jun 20 13:59:46 2019(r349230)
> +++ head/sys/kern/vfs_vnops.c Thu Jun 20 14:13:10 2019(r349231)
> @@ -1458,6 +1458,25 @@ vn_stat(struct vnode *vp, struct stat *sb, struct ucre
>   return (0);
>  }
>  
> +/* generic FIOBMAP2 implementation */
> +static int
> +vn_ioc_bmap2(struct file *fp, struct fiobmap2_arg *arg, struct ucred *cred)
I do not like the fact that internal kernel function takes the
user-visible structure which results in the mix of ABI and KBI.
Traditionally we pass explicit arguments to kern_XXX, vn_XXX and similar
internal implementations.

> +{
> + struct vnode *vp = fp->f_vnode;
Why do you pass fp to the function that
1. Has vn_ namespace, i.e. operating on vnode.
2. Only needs vnode to operate on.
Please change the argument from fp to vp.  You would need to pass f_cred
as additional argument, or move mac check to vn_ioctl (I think this is
a better approach).

> + daddr_t lbn = arg->bn;
Style: initialization in declaration.

> + int error;
> +
> + vn_lock(vp, LK_SHARED | LK_RETRY);
> +#ifdef MAC
> + error = mac_vnode_check_read(cred, fp->f_cred, vp);
> + if (error == 0)
> +#endif
> + error = VOP_BMAP(vp, lbn, NULL, >bn, >runp,
> + >runb);
Wrong indent for continuation line.

> + VOP_UNLOCK(vp, 0);
> + return (error);
> +}
> +
>  /*
>   * File table vnode ioctl routine.
>   */
> @@ -1481,6 +1500,9 @@ vn_ioctl(struct file *fp, u_long com, void *data, stru
>   if (error == 0)
>   *(int *)data = vattr.va_size - fp->f_offset;
>   return (error);
> + case FIOBMAP2:
> + return (vn_ioc_bmap2(fp, (struct fiobmap2_arg*)data,
Need space between fiobmap2_arg and '*'.
> + active_cred));
Wrong indent.

>   case FIONBIO:
>   case FIOASYNC:
>   return (0);
> 
> Modified: head/sys/sys/filio.h
> ==
> --- head/sys/sys/filio.h  Thu Jun 20 13:59:46 2019(r349230)
> +++ head/sys/sys/filio.h  Thu Jun 20 14:13:10 2019(r349231)
> @@ -62,6 +62,13 @@ struct fiodgname_arg {
>  /* Handle lseek SEEK_DATA and SEEK_HOLE for holey file knowledge. */
>  #define  FIOSEEKDATA _IOWR('f', 97, off_t)   /* SEEK_DATA */
>  #define  FIOSEEKHOLE _IOWR('f', 98, off_t)   /* SEEK_HOLE */
> +struct fiobmap2_arg {
> + int64_t bn;
> + int runp;
> + int runb;
> +};
This structure has different layout for LP64 and ILP32, and you did not
provided the compat shims.

> +/* Get the file's bmap info for the logical block bn */
> +#define FIOBMAP2 _IOWR('f', 99, struct fiobmap2_arg)
>  
>  #ifdef _KERNEL
>  #ifdef COMPAT_FREEBSD32
> 
> Modified: head/sys/ufs/ufs/ufs_bmap.c
> ==
> --- head/sys/ufs/ufs/ufs_bmap.c   Thu Jun 20 13:59:46 2019
> (r349230)
> +++ head/sys/ufs/ufs/ufs_bmap.c   Thu Jun 20 14:13:10 2019
> (r349231)
> @@ -200,12 +200,15 @@ ufs_bmaparray(vp, bn, bnp, nbp, runp, runb)
>   *bnp = blkptrtodb(ump, ip->i_din2->di_extb[-1 - bn]);
>   if (*bnp == 0)
>   *bnp = -1;
> - if (nbp == NULL)
> - panic("ufs_bmaparray: mapping ext data");
> + if (nbp == NULL) {
> + /* indirect block not found */
> + return (EINVAL);
> + }
This (and next chunk) loose useful checks for in-kernel interfaces.

>   nbp->b_xflags |= BX_ALTDATA;
>   return (0);
>   } else {
> - panic("ufs_bmaparray: 

svn commit: r349466 - in head/sys: conf dev/altera/msgdma mips/conf

2019-06-27 Thread Ruslan Bukin
Author: br
Date: Thu Jun 27 18:08:18 2019
New Revision: 349466
URL: https://svnweb.freebsd.org/changeset/base/349466

Log:
  Add support for extended descriptor format to Altera mSGDMA driver.
  
  The format to use depends on hardware configuration (synthesis-time),
  so make it compile-time kernel option.
  
  Extended format allows DMA engine to operate with 64-bit memory addresses.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/conf/options
  head/sys/dev/altera/msgdma/msgdma.c
  head/sys/dev/altera/msgdma/msgdma.h
  head/sys/mips/conf/BERI_DE4_BASE

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Thu Jun 27 17:59:15 2019(r349465)
+++ head/sys/conf/options   Thu Jun 27 18:08:18 2019(r349466)
@@ -861,6 +861,12 @@ AH_INTERRUPT_DEBUGGING opt_ah.h
 # XXX do not use this for AR9130
 AH_AR5416_INTERRUPT_MITIGATION opt_ah.h
 
+# options for the Altera mSGDMA driver (altera_msgdma)
+ALTERA_MSGDMA_DESC_STD opt_altera_msgdma.h
+ALTERA_MSGDMA_DESC_EXT opt_altera_msgdma.h
+ALTERA_MSGDMA_DESC_PF_STD  opt_altera_msgdma.h
+ALTERA_MSGDMA_DESC_PF_EXT  opt_altera_msgdma.h
+
 # options for the Broadcom BCM43xx driver (bwi)
 BWI_DEBUG  opt_bwi.h
 BWI_DEBUG_VERBOSE  opt_bwi.h

Modified: head/sys/dev/altera/msgdma/msgdma.c
==
--- head/sys/dev/altera/msgdma/msgdma.c Thu Jun 27 17:59:15 2019
(r349465)
+++ head/sys/dev/altera/msgdma/msgdma.c Thu Jun 27 18:08:18 2019
(r349466)
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include "xdma_if.h"
+#include "opt_altera_msgdma.h"
 
 #include 
 
@@ -470,8 +471,8 @@ msgdma_channel_submit_sg(device_t dev, struct xdma_cha
struct msgdma_channel *chan;
struct msgdma_desc *desc;
struct msgdma_softc *sc;
-   uint32_t src_addr_lo;
-   uint32_t dst_addr_lo;
+   bus_addr_t src_addr_lo;
+   bus_addr_t dst_addr_lo;
uint32_t len;
uint32_t tmp;
int i;
@@ -481,14 +482,18 @@ msgdma_channel_submit_sg(device_t dev, struct xdma_cha
chan = (struct msgdma_channel *)xchan->chan;
 
for (i = 0; i < sg_n; i++) {
-   src_addr_lo = (uint32_t)sg[i].src_addr;
-   dst_addr_lo = (uint32_t)sg[i].dst_addr;
+   src_addr_lo = sg[i].src_addr;
+   dst_addr_lo = sg[i].dst_addr;
len = (uint32_t)sg[i].len;
 
dprintf("%s: src %x dst %x len %d\n", __func__,
src_addr_lo, dst_addr_lo, len);
 
desc = chan->descs[chan->idx_head];
+#if defined(ALTERA_MSGDMA_DESC_EXT) || defined(ALTERA_MSGDMA_DESC_PF_EXT)
+   desc->read_hi = htole32(src_addr_lo >> 32);
+   desc->write_hi = htole32(dst_addr_lo >> 32);
+#endif
desc->read_lo = htole32(src_addr_lo);
desc->write_lo = htole32(dst_addr_lo);
desc->length = htole32(len);

Modified: head/sys/dev/altera/msgdma/msgdma.h
==
--- head/sys/dev/altera/msgdma/msgdma.h Thu Jun 27 17:59:15 2019
(r349465)
+++ head/sys/dev/altera/msgdma/msgdma.h Thu Jun 27 18:08:18 2019
(r349466)
@@ -30,6 +30,8 @@
  * $FreeBSD$
  */
 
+#include "opt_altera_msgdma.h"
+
 /* Altera mSGDMA registers. */
 #defineDMA_STATUS  0x00
 #define STATUS_RESETTING   (1 << 6)
@@ -75,22 +77,74 @@
 #defineWRITE4_DESC(_sc, _reg, _val)\
bus_space_write_4(_sc->bst_d, _sc->bsh_d, _reg, htole32(_val))
 
-/* Prefetcher-disabled descriptor format. */
-struct msgdma_desc_nonpf {
-   uint32_t src_addr;
-   uint32_t dst_addr;
+#if defined(ALTERA_MSGDMA_DESC_STD)
+
+/* Standard descriptor format with prefetcher disabled. */
+struct msgdma_desc {
+   uint32_t read_lo;
+   uint32_t write_lo;
uint32_t length;
uint32_t control;
 };
 
-/* Prefetcher-enabled descriptor format. */
+#elif defined(ALTERA_MSGDMA_DESC_EXT)
+
+/* Extended descriptor format with prefetcher disabled. */
 struct msgdma_desc {
uint32_t read_lo;
uint32_t write_lo;
uint32_t length;
+   uint8_t write_burst;
+   uint8_t read_burst;
+   uint16_t seq_num;
+   uint16_t write_stride;
+   uint16_t read_stride;
+   uint32_t read_hi;
+   uint32_t write_hi;
+   uint32_t control;
+};
+
+#elif defined(ALTERA_MSGDMA_DESC_PF_STD)
+
+/* Standard descriptor format with prefetcher enabled. */
+struct msgdma_desc {
+   uint32_t read_lo;
+   uint32_t write_lo;
+   uint32_t length;
uint32_t next;
uint32_t transferred;
uint32_t status;
uint32_t reserved;
uint32_t control;
 };
+
+#elif defined(ALTERA_MSGDMA_DESC_PF_EXT)
+
+/* Extended descriptor format with prefetcher enabled. */
+struct msgdma_desc {

Re: svn commit: r349459 - head/sys/sys

2019-06-27 Thread Bruce Evans

On Thu, 27 Jun 2019, Andriy Gapon wrote:


On 27/06/2019 18:47, Bruce Evans wrote:

On Thu, 27 Jun 2019, Andriy Gapon wrote:


Log:
??upgrade the warning printf-s in bus accessors to KASSERT-s

??After this change sys/bus.h includes sys/systm.h.


This is further namespace pollution.?? sys/systm.h is a prerequiste for
all kernel headers except sys/param.h and the headers that that includes,
since any kernel header (except sys/param.hm etc.) may have inlines which
use features in systm.h, e.g., KASSERT() or an inline function.


what do you think about amending style(9) to require that if sys/systm.h is to
be included, then it must be included before any other header except for
sys/param.h (and possibly sys/cdefs.h) ?


It is not a style matter.  sys/systm.h is just a prerequisite for almost
all kernel code.  Perhaps this can be enforced using #ifdef magic even
for headers that don't currently use it.  If it is to be included nested,
then sys/param.h is the place to include it, but I don't like that since
it is even less related to parameters than sys/param.h, and this would be
a regression from minor depollution of sys/param.h.

sys/systm.h is also kernel-only, and as you found, including it nested
tends to break applications, so other headers that have the bug of
including it tend to have _KERNEL ifdefs to avoid including it in
applications.  This is so fundamental that it doesn't have a "No
user-serviceable parts inside" ifdef.

Bruce___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349463 - in stable/12: lib/libkvm sys/riscv/riscv sys/vm

2019-06-27 Thread Mark Johnston
Author: markj
Date: Thu Jun 27 16:48:24 2019
New Revision: 349463
URL: https://svnweb.freebsd.org/changeset/base/349463

Log:
  MFC r344827-344830, r344845:
  Implement minidump support for RISC-V.

Added:
  stable/12/lib/libkvm/kvm_minidump_riscv.c
 - copied unchanged from r344829, head/lib/libkvm/kvm_minidump_riscv.c
  stable/12/lib/libkvm/kvm_riscv.h
 - copied, changed from r344829, head/lib/libkvm/kvm_riscv.h
Modified:
  stable/12/lib/libkvm/Makefile
  stable/12/sys/riscv/riscv/minidump_machdep.c
  stable/12/sys/riscv/riscv/pmap.c
  stable/12/sys/riscv/riscv/uma_machdep.c
  stable/12/sys/vm/vm_page.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libkvm/Makefile
==
--- stable/12/lib/libkvm/Makefile   Thu Jun 27 16:30:25 2019
(r349462)
+++ stable/12/lib/libkvm/Makefile   Thu Jun 27 16:48:24 2019
(r349463)
@@ -18,6 +18,7 @@ SRCS= kvm.c kvm_cptime.c kvm_getloadavg.c \
kvm_i386.c kvm_minidump_i386.c \
kvm_minidump_mips.c \
kvm_powerpc.c kvm_powerpc64.c \
+   kvm_minidump_riscv.c \
kvm_sparc64.c
 INCS=  kvm.h
 

Copied: stable/12/lib/libkvm/kvm_minidump_riscv.c (from r344829, 
head/lib/libkvm/kvm_minidump_riscv.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/lib/libkvm/kvm_minidump_riscv.c   Thu Jun 27 16:48:24 2019
(r349463, copy of r344829, head/lib/libkvm/kvm_minidump_riscv.c)
@@ -0,0 +1,288 @@
+/*-
+ * Copyright (c) 2006 Peter Wemm
+ * Copyright (c) 2019 Mitchell Horne
+ *
+ * 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.
+ *
+ * From: FreeBSD: src/lib/libkvm/kvm_minidump_amd64.c r261799
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+/*
+ * RISC-V machine dependent routines for kvm and minidumps.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "../../sys/riscv/include/minidump.h"
+
+#include 
+
+#include "kvm_private.h"
+#include "kvm_riscv.h"
+
+#defineriscv_round_page(x) roundup2((kvaddr_t)(x), RISCV_PAGE_SIZE)
+
+struct vmstate {
+   struct minidumphdr hdr;
+};
+
+static riscv_pt_entry_t
+_riscv_pte_get(kvm_t *kd, u_long pteindex)
+{
+   riscv_pt_entry_t *pte = _kvm_pmap_get(kd, pteindex, sizeof(*pte));
+
+   return le64toh(*pte);
+}
+
+static int
+_riscv_minidump_probe(kvm_t *kd)
+{
+
+   return (_kvm_probe_elf_kernel(kd, ELFCLASS64, EM_RISCV) &&
+   _kvm_is_minidump(kd));
+}
+
+static void
+_riscv_minidump_freevtop(kvm_t *kd)
+{
+   struct vmstate *vm = kd->vmst;
+
+   free(vm);
+   kd->vmst = NULL;
+}
+
+static int
+_riscv_minidump_initvtop(kvm_t *kd)
+{
+   struct vmstate *vmst;
+   off_t off, sparse_off;
+
+   vmst = _kvm_malloc(kd, sizeof(*vmst));
+   if (vmst == NULL) {
+   _kvm_err(kd, kd->program, "cannot allocate vm");
+   return (-1);
+   }
+   kd->vmst = vmst;
+   if (pread(kd->pmfd, >hdr, sizeof(vmst->hdr), 0) !=
+   sizeof(vmst->hdr)) {
+   _kvm_err(kd, kd->program, "cannot read dump header");
+   return (-1);
+   }
+   if (strncmp(MINIDUMP_MAGIC, vmst->hdr.magic,
+   sizeof(vmst->hdr.magic)) != 0) {
+   _kvm_err(kd, kd->program, "not a minidump for this platform");
+   return (-1);
+   }
+
+   vmst->hdr.version = le32toh(vmst->hdr.version);
+   if (vmst->hdr.version != MINIDUMP_VERSION) {
+   _kvm_err(kd, kd->program, "wrong minidump version. "
+   "Expected %d got %d", MINIDUMP_VERSION, vmst->hdr.version);

Re: svn commit: r349459 - head/sys/sys

2019-06-27 Thread Andriy Gapon
On 27/06/2019 18:47, Bruce Evans wrote:
> On Thu, 27 Jun 2019, Andriy Gapon wrote:
> 
>> Log:
>>  upgrade the warning printf-s in bus accessors to KASSERT-s
>>
>>  After this change sys/bus.h includes sys/systm.h.
> 
> This is further namespace pollution.  sys/systm.h is a prerequiste for
> all kernel headers except sys/param.h and the headers that that includes,
> since any kernel header (except sys/param.hm etc.) may have inlines which
> use features in systm.h, e.g., KASSERT() or an inline function.

Bruce,

what do you think about amending style(9) to require that if sys/systm.h is to
be included, then it must be included before any other header except for
sys/param.h (and possibly sys/cdefs.h) ?

-- 
Andriy Gapon
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349461 - head/sys/sys

2019-06-27 Thread Andriy Gapon
Author: avg
Date: Thu Jun 27 15:51:50 2019
New Revision: 349461
URL: https://svnweb.freebsd.org/changeset/base/349461

Log:
  revert r349460, printf -> KASSERT in bus.h, until I can fix it
  
  I tested only kernel builds naively assuming that sys/bus.h cannot
  affect userland builds.
  
  Pointyhat to: me

Modified:
  head/sys/sys/bus.h

Modified: head/sys/sys/bus.h
==
--- head/sys/sys/bus.h  Thu Jun 27 15:46:06 2019(r349460)
+++ head/sys/sys/bus.h  Thu Jun 27 15:51:50 2019(r349461)
@@ -35,7 +35,6 @@
 #include 
 #include 
 #include 
-#include 
 
 /**
  * @defgroup NEWBUS newbus - a generic framework for managing devices
@@ -814,9 +813,12 @@ static __inline type varp ## _get_ ## var(device_t dev
int e;  \
e = BUS_READ_IVAR(device_get_parent(dev), dev,  \
ivarp ## _IVAR_ ## ivar, );   \
-   KASSERT(e == 0, ("%s failed for %s on bus %s, error = %d",  \
-   __func__, device_get_nameunit(dev), \
-   device_get_nameunit(device_get_parent(dev)), e));   \
+   if (e != 0) {   \
+   device_printf(dev, "failed to read ivar "   \
+   __XSTRING(ivarp ## _IVAR_ ## ivar) " on bus %s, "   \
+   "error = %d\n", \
+   device_get_nameunit(device_get_parent(dev)), e);\
+   }   \
return ((type) v);  \
 }  \
\
@@ -826,9 +828,12 @@ static __inline void varp ## _set_ ## var(device_t dev
int e;  \
e = BUS_WRITE_IVAR(device_get_parent(dev), dev, \
ivarp ## _IVAR_ ## ivar, v);\
-   KASSERT(e == 0, ("%s failed for %s on bus %s, error = %d",  \
-   __func__, device_get_nameunit(dev), \
-   device_get_nameunit(device_get_parent(dev)), e));   \
+   if (e != 0) {   \
+   device_printf(dev, "failed to write ivar "  \
+   __XSTRING(ivarp ## _IVAR_ ## ivar) " on bus %s, "   \
+   "error = %d\n", \
+   device_get_nameunit(device_get_parent(dev)), e);\
+   }   \
 }
 
 /**
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r349459 - head/sys/sys

2019-06-27 Thread Bruce Evans

On Thu, 27 Jun 2019, Andriy Gapon wrote:


Log:
 upgrade the warning printf-s in bus accessors to KASSERT-s

 After this change sys/bus.h includes sys/systm.h.


This is further namespace pollution.  sys/systm.h is a prerequiste for
all kernel headers except sys/param.h and the headers that that includes,
since any kernel header (except sys/param.hm etc.) may have inlines which
use features in systm.h, e.g., KASSERT() or an inline function.


Modified: head/sys/sys/bus.h
==
--- head/sys/sys/bus.h  Thu Jun 27 14:26:57 2019(r349458)
+++ head/sys/sys/bus.h  Thu Jun 27 15:07:06 2019(r349459)
@@ -35,6 +35,7 @@
#include 
#include 
#include 
+#include 


This header used to be relatively clean, with no polluting includes.

The following low-quality headers in sys already include sys/systm.h:

- capsicum.h:#include 
- fail.h:#include 
- fbio.h:#include 
- intr.h:#include 
- libkern.h:#include 
- malloc.h:#include 
- mbuf.h:#include 
- pmckern.h:#include 
- proc.h:#include 
- refcount.h:#include 
- seqc.h:#include 
- sf_buf.h:#include 
- zutil.h:#include 

This is especially bad in:
- libkern.h.  systm.h includes libkern.h, so this recurses.  The recursion
  is bounded by the reinclude guard.  libkern.h was broken by adding
  KASSERT()s to it.  It is a leaf header, so must be written carefully.
- malloc.h and mbuf.h.  I fixed all the include pollution in them.  They
  are now much more polluted than before I cleaned them
- proc.h.  Almost everything includes this.  Including sys/systm.h in it
  hdes the bug of not including sys/systm.h in the correct place in .c files.


/**
 * @defgroup NEWBUS newbus - a generic framework for managing devices
@@ -813,12 +814,9 @@ static __inline type varp ## _get_ ## var(device_t dev
int e;  \
e = BUS_READ_IVAR(device_get_parent(dev), dev,  \
ivarp ## _IVAR_ ## ivar, );   \
-   if (e != 0) {   \
-   device_printf(dev, "failed to read ivar " \
-   __XSTRING(ivarp ## _IVAR_ ## ivar) " on bus %s, " \
-   "error = %d\n",   \
-   device_get_nameunit(device_get_parent(dev)), e);\
-   }   \
+   KASSERT(e == 0, ("%s failed for %s on bus %s, error = %d",\
+   __func__, device_get_nameunit(dev), \
+   device_get_nameunit(device_get_parent(dev)), e));   \
return ((type) v);  \
}   \
\


Inline functions in headers generally cause namespace pollution, like here.
Some headers use macros which don't have that problem.  mbuf.h used to be
like that.  The cleaned version of it in FreeBSD-4 includes only
sys/queue.h.  It has rotted to include sys/systm.h, sys/refcount.h,
vm/uma.h. sys/lock.h and sys/sdt.h.

Bruce
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349460 - in head: share/man/man4 sys/dev/gpio

2019-06-27 Thread Andriy Gapon
Author: avg
Date: Thu Jun 27 15:46:06 2019
New Revision: 349460
URL: https://svnweb.freebsd.org/changeset/base/349460

Log:
  gpiobus: provide a new hint, pin_list
  
  "pin_list" allows to specify child pins as a list of pin numbers.
  Existing hint "pins" serves the same purpose but with a 32-bit wide bit
  mask.  One problem with that is that a controller can have more than 32
  pins.  One example is amdgpio.  Also, a list of numbers is a little bit
  more human friendly than a matching bit mask.  As a side note, it seems
  that in FDT pins are typically specified by their numbers as well.
  
  This commit also adds accessors for instance variables (IVARs) that
  define the child pins.  My primary goal is to allow a child to be
  configured programmatically rather than via hints (assuming that FDT is
  not supported on a platform).  Also, while a child should not care about
  specific pin numbers that are allocated to it, it could be interested in
  how many were actually assigned to it.
  
  While there, I removed "flags" instance variable.  It was unused.
  
  Reviewed by:  mizhka
  MFC after:2 weeks
  Differential Revision: https://reviews.freebsd.org/D20459

Modified:
  head/share/man/man4/gpio.4
  head/sys/dev/gpio/gpiobus.c
  head/sys/dev/gpio/gpiobusvar.h

Modified: head/share/man/man4/gpio.4
==
--- head/share/man/man4/gpio.4  Thu Jun 27 15:07:06 2019(r349459)
+++ head/share/man/man4/gpio.4  Thu Jun 27 15:46:06 2019(r349460)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 26, 2019
+.Dd June 27, 2019
 .Dt GPIO 4
 .Os
 .Sh NAME
@@ -109,7 +109,7 @@ based system these hints can be used to configure driv
 attached to
 .Nm
 pins:
-.Bl -tag -width ".Va hint.driver.unit.pins"
+.Bl -tag -width ".Va hint.driver.unit.pin_list"
 .It Va hint.driver.unit.at
 The
 .Nm gpiobus
@@ -125,6 +125,20 @@ This is a bitmask of the pins on the
 .Nm gpiobus
 that are connected to the device.
 The pins will be allocated to the specified driver instance.
+Only pins with numbers from 0 to 31 can be specified using this hint.
+.It Va hint.driver.unit.pin_list
+This is a list of pin numbers of pins on the
+.Nm gpiobus
+that are connected to the device.
+The pins will be allocated to the specified driver instance.
+This is a more user friendly alternative to the
+.Ar pins
+hint.
+Additionally, this hint allows specifying pin numbers greater than 31.
+The numbers can be decimal or hexadecimal with 0x prefix.
+Any non-digit character can be used as a separator.
+For example, it can be a comma, a slash or a space.
+The separator can be followed by any number of space characters.
 .El
 .Pp
 The following

Modified: head/sys/dev/gpio/gpiobus.c
==
--- head/sys/dev/gpio/gpiobus.c Thu Jun 27 15:07:06 2019(r349459)
+++ head/sys/dev/gpio/gpiobus.c Thu Jun 27 15:46:06 2019(r349460)
@@ -255,13 +255,6 @@ gpiobus_alloc_ivars(struct gpiobus_ivar *devi)
M_NOWAIT | M_ZERO);
if (devi->pins == NULL)
return (ENOMEM);
-   devi->flags = malloc(sizeof(uint32_t) * devi->npins, M_DEVBUF,
-   M_NOWAIT | M_ZERO);
-   if (devi->flags == NULL) {
-   free(devi->pins, M_DEVBUF);
-   return (ENOMEM);
-   }
-
return (0);
 }
 
@@ -269,14 +262,11 @@ void
 gpiobus_free_ivars(struct gpiobus_ivar *devi)
 {
 
-   if (devi->flags) {
-   free(devi->flags, M_DEVBUF);
-   devi->flags = NULL;
-   }
if (devi->pins) {
free(devi->pins, M_DEVBUF);
devi->pins = NULL;
}
+   devi->npins = 0;
 }
 
 int
@@ -326,6 +316,34 @@ gpiobus_release_pin(device_t bus, uint32_t pin)
 }
 
 static int
+gpiobus_acquire_child_pins(device_t dev, device_t child)
+{
+   struct gpiobus_ivar *devi = GPIOBUS_IVAR(child);
+   int i;
+
+   for (i = 0; i < devi->npins; i++) {
+   /* Reserve the GPIO pin. */
+   if (gpiobus_acquire_pin(dev, devi->pins[i]) != 0) {
+   device_printf(child, "cannot acquire pin %d\n",
+   devi->pins[i]);
+   while (--i >= 0) {
+   (void)gpiobus_release_pin(dev,
+   devi->pins[i]);
+   }
+   gpiobus_free_ivars(devi);
+   return (EBUSY);
+   }
+   }
+   for (i = 0; i < devi->npins; i++) {
+   /* Use the child name as pin name. */
+   GPIOBUS_PIN_SETNAME(dev, devi->pins[i],
+   device_get_nameunit(child));
+
+   }
+   return (0);
+}
+
+static int
 gpiobus_parse_pins(struct gpiobus_softc *sc, device_t child, int mask)
 {
struct gpiobus_ivar *devi = GPIOBUS_IVAR(child);
@@ -349,21 +367,70 @@ gpiobus_parse_pins(struct gpiobus_softc 

svn commit: r349459 - head/sys/sys

2019-06-27 Thread Andriy Gapon
Author: avg
Date: Thu Jun 27 15:07:06 2019
New Revision: 349459
URL: https://svnweb.freebsd.org/changeset/base/349459

Log:
  upgrade the warning printf-s in bus accessors to KASSERT-s
  
  After this change sys/bus.h includes sys/systm.h.
  
  Discussed with:   cem, imp
  MFC after:2 weeks

Modified:
  head/sys/sys/bus.h

Modified: head/sys/sys/bus.h
==
--- head/sys/sys/bus.h  Thu Jun 27 14:26:57 2019(r349458)
+++ head/sys/sys/bus.h  Thu Jun 27 15:07:06 2019(r349459)
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /**
  * @defgroup NEWBUS newbus - a generic framework for managing devices
@@ -813,12 +814,9 @@ static __inline type varp ## _get_ ## var(device_t dev
int e;  \
e = BUS_READ_IVAR(device_get_parent(dev), dev,  \
ivarp ## _IVAR_ ## ivar, );   \
-   if (e != 0) {   \
-   device_printf(dev, "failed to read ivar "   \
-   __XSTRING(ivarp ## _IVAR_ ## ivar) " on bus %s, "   \
-   "error = %d\n", \
-   device_get_nameunit(device_get_parent(dev)), e);\
-   }   \
+   KASSERT(e == 0, ("%s failed for %s on bus %s, error = %d",  \
+   __func__, device_get_nameunit(dev), \
+   device_get_nameunit(device_get_parent(dev)), e));   \
return ((type) v);  \
 }  \
\
@@ -828,12 +826,9 @@ static __inline void varp ## _set_ ## var(device_t dev
int e;  \
e = BUS_WRITE_IVAR(device_get_parent(dev), dev, \
ivarp ## _IVAR_ ## ivar, v);\
-   if (e != 0) {   \
-   device_printf(dev, "failed to write ivar "  \
-   __XSTRING(ivarp ## _IVAR_ ## ivar) " on bus %s, "   \
-   "error = %d\n", \
-   device_get_nameunit(device_get_parent(dev)), e);\
-   }   \
+   KASSERT(e == 0, ("%s failed for %s on bus %s, error = %d",  \
+   __func__, device_get_nameunit(dev), \
+   device_get_nameunit(device_get_parent(dev)), e));   \
 }
 
 /**
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349458 - releng/11.3/usr.sbin/mountd

2019-06-27 Thread Alexander Motin
Author: mav
Date: Thu Jun 27 14:26:57 2019
New Revision: 349458
URL: https://svnweb.freebsd.org/changeset/base/349458

Log:
  MFC r349376: Fix strsep_quote() on strings without quotes.
  
  For strings without quotes and escapes dstptr and srcptr are equal, so
  zeroing *dstptr before checking *srcptr is not a good idea.  In practice
  it means that in -maproot=65534:65533 everything after the colon is lost.
  
  The problem was there since r293305, but before r346976 it was covered by
  improper strsep_quote() usage.
  
  PR:   238725
  
  Approved by:  re (gjb)

Modified:
  releng/11.3/usr.sbin/mountd/mountd.c
Directory Properties:
  releng/11.3/   (props changed)

Modified: releng/11.3/usr.sbin/mountd/mountd.c
==
--- releng/11.3/usr.sbin/mountd/mountd.cThu Jun 27 14:12:20 2019
(r349457)
+++ releng/11.3/usr.sbin/mountd/mountd.cThu Jun 27 14:26:57 2019
(r349458)
@@ -343,8 +343,8 @@ strsep_quote(char **stringp, const char *delim)
*dstptr++ = *srcptr++;
}
 
-   *dstptr = 0; /* Terminate the string */
*stringp = (*srcptr == '\0') ? NULL : srcptr + 1;
+   *dstptr = 0; /* Terminate the string */
return (retval);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349457 - stable/11/usr.sbin/mountd

2019-06-27 Thread Alexander Motin
Author: mav
Date: Thu Jun 27 14:12:20 2019
New Revision: 349457
URL: https://svnweb.freebsd.org/changeset/base/349457

Log:
  MFC r349376: Fix strsep_quote() on strings without quotes.
  
  For strings without quotes and escapes dstptr and srcptr are equal, so
  zeroing *dstptr before checking *srcptr is not a good idea.  In practice
  it means that in -maproot=65534:65533 everything after the colon is lost.
  
  The problem was there since r293305, but before r346976 it was covered by
  improper strsep_quote() usage.
  
  PR:   238725

Modified:
  stable/11/usr.sbin/mountd/mountd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/mountd/mountd.c
==
--- stable/11/usr.sbin/mountd/mountd.c  Thu Jun 27 14:10:58 2019
(r349456)
+++ stable/11/usr.sbin/mountd/mountd.c  Thu Jun 27 14:12:20 2019
(r349457)
@@ -349,8 +349,8 @@ strsep_quote(char **stringp, const char *delim)
*dstptr++ = *srcptr++;
}
 
-   *dstptr = 0; /* Terminate the string */
*stringp = (*srcptr == '\0') ? NULL : srcptr + 1;
+   *dstptr = 0; /* Terminate the string */
return (retval);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349456 - stable/12/usr.sbin/mountd

2019-06-27 Thread Alexander Motin
Author: mav
Date: Thu Jun 27 14:10:58 2019
New Revision: 349456
URL: https://svnweb.freebsd.org/changeset/base/349456

Log:
  MFC r349376: Fix strsep_quote() on strings without quotes.
  
  For strings without quotes and escapes dstptr and srcptr are equal, so
  zeroing *dstptr before checking *srcptr is not a good idea.  In practice
  it means that in -maproot=65534:65533 everything after the colon is lost.
  
  The problem was there since r293305, but before r346976 it was covered by
  improper strsep_quote() usage.
  
  PR:   238725

Modified:
  stable/12/usr.sbin/mountd/mountd.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/mountd/mountd.c
==
--- stable/12/usr.sbin/mountd/mountd.c  Thu Jun 27 14:03:32 2019
(r349455)
+++ stable/12/usr.sbin/mountd/mountd.c  Thu Jun 27 14:10:58 2019
(r349456)
@@ -351,8 +351,8 @@ strsep_quote(char **stringp, const char *delim)
*dstptr++ = *srcptr++;
}
 
-   *dstptr = 0; /* Terminate the string */
*stringp = (*srcptr == '\0') ? NULL : srcptr + 1;
+   *dstptr = 0; /* Terminate the string */
return (retval);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349455 - in head/sbin/bectl: . tests

2019-06-27 Thread Kyle Evans
Author: kevans
Date: Thu Jun 27 14:03:32 2019
New Revision: 349455
URL: https://svnweb.freebsd.org/changeset/base/349455

Log:
  bectl(8): create non-recursive boot environments
  
  bectl advertises that it has the ability to create recursive and
  non-recursive boot environments. This patch implements that functionality
  using the be_create_depth API provided by libbe. With this patch, bectl now
  works as bectl(8) describes in regards to creating recursive/non-recursive
  boot environments.
  
  Submitted by: Rob Fairbanks  (with minor changes)
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D20240

Modified:
  head/sbin/bectl/bectl.c
  head/sbin/bectl/tests/bectl_test.sh

Modified: head/sbin/bectl/bectl.c
==
--- head/sbin/bectl/bectl.c Thu Jun 27 13:37:34 2019(r349454)
+++ head/sbin/bectl/bectl.c Thu Jun 27 14:03:32 2019(r349455)
@@ -184,7 +184,8 @@ bectl_cmd_activate(int argc, char *argv[])
 static int
 bectl_cmd_create(int argc, char *argv[])
 {
-   char *atpos, *bootenv, *snapname, *source;
+   char snapshot[BE_MAXPATHLEN];
+   char *atpos, *bootenv, *snapname;
int err, opt;
bool recursive;
 
@@ -214,6 +215,8 @@ bectl_cmd_create(int argc, char *argv[])
}
 
bootenv = *argv;
+
+   err = BE_ERR_SUCCESS;
if ((atpos = strchr(bootenv, '@')) != NULL) {
/*
 * This is the "create a snapshot variant". No new boot
@@ -221,24 +224,22 @@ bectl_cmd_create(int argc, char *argv[])
 */
*atpos++ = '\0';
err = be_snapshot(be, bootenv, atpos, recursive, NULL);
-   } else if (snapname != NULL) {
-   if (strchr(snapname, '@') != NULL)
-   err = be_create_from_existing_snap(be, bootenv,
-   snapname);
-   else
-   err = be_create_from_existing(be, bootenv, snapname);
} else {
-   if ((snapname = strchr(bootenv, '@')) != NULL) {
-   *(snapname++) = '\0';
-   if ((err = be_snapshot(be, be_active_path(be),
-   snapname, true, NULL)) != BE_ERR_SUCCESS)
-   fprintf(stderr, "failed to create snapshot\n");
-   asprintf(, "%s@%s", be_active_path(be), 
snapname);
-   err = be_create_from_existing_snap(be, bootenv,
-   source);
-   return (err);
-   } else
-   err = be_create(be, bootenv);
+   if (snapname == NULL)
+   /* Create from currently booted BE */
+   err = be_snapshot(be, be_active_path(be), NULL,
+   recursive, snapshot);
+   else if (strchr(snapname, '@') != NULL)
+   /* Create from given snapshot */
+   strlcpy(snapshot, snapname, sizeof(snapshot));
+   else
+   /* Create from given BE */
+   err = be_snapshot(be, snapname, NULL, recursive,
+   snapshot);
+
+   if (err == BE_ERR_SUCCESS)
+   err = be_create_depth(be, bootenv, snapshot,
+ recursive == true ? -1 : 0);
}
 
switch (err) {

Modified: head/sbin/bectl/tests/bectl_test.sh
==
--- head/sbin/bectl/tests/bectl_test.sh Thu Jun 27 13:37:34 2019
(r349454)
+++ head/sbin/bectl/tests/bectl_test.sh Thu Jun 27 14:03:32 2019
(r349455)
@@ -99,11 +99,35 @@ bectl_create_body()
mount=${cwd}/mnt
 
bectl_create_setup ${zpool} ${disk} ${mount}
+
+   # Create a child dataset that will be used to test creation
+   # of recursive and non-recursive boot environments.
+   atf_check zfs create -o mountpoint=/usr -o canmount=noauto \
+   ${zpool}/ROOT/default/usr
+
# Test standard creation, creation of a snapshot, and creation from a
# snapshot.
atf_check bectl -r ${zpool}/ROOT create -e default default2
atf_check bectl -r ${zpool}/ROOT create default2@test_snap
atf_check bectl -r ${zpool}/ROOT create -e default2@test_snap default3
+
+   # Test standard creation, creation of a snapshot, and creation from a
+   # snapshot for recursive boot environments.
+   atf_check bectl -r ${zpool}/ROOT create -r -e default recursive
+   atf_check bectl -r ${zpool}/ROOT create -r recursive@test_snap
+   atf_check bectl -r ${zpool}/ROOT create -r -e recursive@test_snap 
recursive-snap
+
+   # Test that non-recursive boot environments have no child datasets.
+   atf_check -e not-empty -s not-exit:0 \
+   zfs list 

svn commit: r349454 - in vendor/libarchive/dist: . build/ci/cirrus_ci libarchive libarchive/test

2019-06-27 Thread Martin Matuska
Author: mm
Date: Thu Jun 27 13:37:34 2019
New Revision: 349454
URL: https://svnweb.freebsd.org/changeset/base/349454

Log:
  Update vendor/libarchive/dist to git d6d3799d6b309593f271c4c319dfba92efc95772
  
  Relevant vendor changes:
PR #1217: RAR5 reader - fix ARM filter going beyond window buffer boundary
  (OSS-Fuzz 15431)
PR #1218: Fixes to sparse file handling

Added:
  vendor/libarchive/dist/build/ci/cirrus_ci/Dockerfile.fc30
  vendor/libarchive/dist/build/ci/cirrus_ci/Dockerfile.fc30.distcheck
  
vendor/libarchive/dist/libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu
Deleted:
  vendor/libarchive/dist/build/ci/cirrus_ci/Dockerfile.fc29
  vendor/libarchive/dist/build/ci/cirrus_ci/Dockerfile.fc29.distcheck
Modified:
  vendor/libarchive/dist/.cirrus.yml
  vendor/libarchive/dist/Makefile.am
  vendor/libarchive/dist/libarchive/archive_read.c
  vendor/libarchive/dist/libarchive/archive_read_disk_posix.c
  vendor/libarchive/dist/libarchive/archive_read_disk_windows.c
  vendor/libarchive/dist/libarchive/archive_read_support_format_rar5.c
  vendor/libarchive/dist/libarchive/test/test_read_format_rar5.c

Modified: vendor/libarchive/dist/.cirrus.yml
==
--- vendor/libarchive/dist/.cirrus.yml  Thu Jun 27 13:31:55 2019
(r349453)
+++ vendor/libarchive/dist/.cirrus.yml  Thu Jun 27 13:37:34 2019
(r349454)
@@ -35,8 +35,6 @@ MacOS_task:
   matrix:
 osx_instance:
   image: mojave-xcode-10.2
-osx_instance:
-  image: high-sierra-xcode-10.0
   prepare_script:
   - ./build/ci/cirrus_ci/ci.sh prepare
   configure_script:
@@ -50,9 +48,9 @@ MacOS_task:
   install_script:
   - ./build/ci/build.sh -a install
 
-Fedora_29_task:
+Fedora_30_task:
   container:
-dockerfile: build/ci/cirrus_ci/Dockerfile.fc29
+dockerfile: build/ci/cirrus_ci/Dockerfile.fc30
   matrix:
 env:
   BS: autotools
@@ -68,9 +66,9 @@ Fedora_29_task:
   install_script:
   - ./build/ci/build.sh -a install
 
-Fedora_29_distcheck_task:
+Fedora_30_distcheck_task:
   container:
-dockerfile: build/ci/cirrus_ci/Dockerfile.fc29.distcheck
+dockerfile: build/ci/cirrus_ci/Dockerfile.fc30.distcheck
   env:
 BS: autotools
   configure_script:

Modified: vendor/libarchive/dist/Makefile.am
==
--- vendor/libarchive/dist/Makefile.am  Thu Jun 27 13:31:55 2019
(r349453)
+++ vendor/libarchive/dist/Makefile.am  Thu Jun 27 13:37:34 2019
(r349454)
@@ -865,6 +865,7 @@ libarchive_test_EXTRA_DIST=\
libarchive/test/test_read_format_rar5_symlink.rar.uu \
libarchive/test/test_read_format_rar5_truncated_huff.rar.uu \
libarchive/test/test_read_format_rar5_win32.rar.uu \
+   
libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu \
libarchive/test/test_read_format_raw.bufr.uu \
libarchive/test/test_read_format_raw.data.gz.uu \
libarchive/test/test_read_format_raw.data.Z.uu \

Added: vendor/libarchive/dist/build/ci/cirrus_ci/Dockerfile.fc30
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/libarchive/dist/build/ci/cirrus_ci/Dockerfile.fc30   Thu Jun 27 
13:37:34 2019(r349454)
@@ -0,0 +1,3 @@
+FROM fedora:30
+
+RUN dnf -y install make cmake gcc gcc-c++ kernel-devel automake libtool bison 
sharutils pkgconf libacl-devel libasan librichacl-devel bzip2-devel 
libzip-devel zlib-devel xz-devel lz4-devel libzstd-devel openssl-devel

Added: vendor/libarchive/dist/build/ci/cirrus_ci/Dockerfile.fc30.distcheck
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/libarchive/dist/build/ci/cirrus_ci/Dockerfile.fc30.distcheck Thu Jun 
27 13:37:34 2019(r349454)
@@ -0,0 +1,3 @@
+FROM fedora:30
+
+RUN dnf -y install make cmake gcc gcc-c++ kernel-devel automake libtool bison 
sharutils pkgconf libacl-devel libasan librichacl-devel bzip2-devel 
libzip-devel zlib-devel xz-devel lz4-devel libzstd-devel openssl-devel groff 
ghostscript

Modified: vendor/libarchive/dist/libarchive/archive_read.c
==
--- vendor/libarchive/dist/libarchive/archive_read.cThu Jun 27 13:31:55 
2019(r349453)
+++ vendor/libarchive/dist/libarchive/archive_read.cThu Jun 27 13:37:34 
2019(r349454)
@@ -844,7 +844,8 @@ archive_read_data(struct archive *_a, void *buff, size
dest = (char *)buff;
 
while (s > 0) {
-   if (a->read_data_remaining == 0) {
+   if (a->read_data_offset == a->read_data_output_offset &&
+   a->read_data_remaining == 0) {
read_buf = a->read_data_block;

svn commit: r349453 - head/release/picobsd/build

2019-06-27 Thread Ed Maste
Author: emaste
Date: Thu Jun 27 13:31:55 2019
New Revision: 349453
URL: https://svnweb.freebsd.org/changeset/base/349453

Log:
  picobsd: also exclude .git where we exclude .svn today
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/picobsd/build/picobsd

Modified: head/release/picobsd/build/picobsd
==
--- head/release/picobsd/build/picobsd  Thu Jun 27 12:37:44 2019
(r349452)
+++ head/release/picobsd/build/picobsd  Thu Jun 27 13:31:55 2019
(r349453)
@@ -437,7 +437,7 @@ populate_floppy_fs() {  # OK
${MY_TREE}/floppy.tree.${SITE} ; do
if [ -d ${FLOPPY_TREE} ] ; then
(cd ${FLOPPY_TREE} ; tar -cf - \
-   --exclude .svn ${excl} . ) | \
+   --exclude .git --exclude .svn ${excl} . ) | \
(cd ${dst} ; tar x${o_tarv}f - )
log "Copied from ${FLOPPY_TREE}"
fi
@@ -698,7 +698,7 @@ populate_mfs_tree() {
 for MFS_TREE in ${PICO_TREE}/mfs_tree ${MY_TREE}/mfs_tree ; do
if [ -d ${MFS_TREE} ] ; then
log "Copy ${MFS_TREE} ..."
-   (cd ${MFS_TREE} ; tar -cf - --exclude .svn . ) | \
+   (cd ${MFS_TREE} ; tar -cf - --exclude .git --exclude .svn . ) | \
(cd ${dst} ; tar x${o_tarv}f - )
fi
 done
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349452 - in head: sbin/ipf/ipmon tools/build/mk

2019-06-27 Thread Cy Schubert
Author: cy
Date: Thu Jun 27 12:37:44 2019
New Revision: 349452
URL: https://svnweb.freebsd.org/changeset/base/349452

Log:
  Create a link to the ipmon.conf.5 man page as documented in ipmon.5.
  Add its corresponding optional removal entry.
  
  PR:   238816
  MFC after:1 week

Modified:
  head/sbin/ipf/ipmon/Makefile
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/sbin/ipf/ipmon/Makefile
==
--- head/sbin/ipf/ipmon/MakefileThu Jun 27 03:50:13 2019
(r349451)
+++ head/sbin/ipf/ipmon/MakefileThu Jun 27 12:37:44 2019
(r349452)
@@ -4,6 +4,7 @@ PACKAGE=ipf
 PROG=  ipmon
 SRCS=  ${GENHDRS} ipmon.c ipmon_y.c ipmon_l.c
 MAN=   ipmon.5 ipmon.8
+MLINKS=ipmon.5 ipmon.conf.5
 
 CFLAGS+=   -DLOGFAC=LOG_LOCAL0 -I.
 

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Thu Jun 27 03:50:13 
2019(r349451)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Thu Jun 27 12:37:44 
2019(r349452)
@@ -3351,6 +3351,7 @@ OLD_FILES+=usr/share/man/man5/ipf.conf.5.gz
 OLD_FILES+=usr/share/man/man5/ipf6.conf.5.gz
 OLD_FILES+=usr/share/man/man5/ipfilter.5.gz
 OLD_FILES+=usr/share/man/man8/ipmon.5.gz
+OLD_FILES+=usr/share/man/man5/ipmon.conf.5.gz
 OLD_FILES+=usr/share/man/man5/ipnat.5.gz
 OLD_FILES+=usr/share/man/man5/ipnat.conf.5.gz
 OLD_FILES+=usr/share/man/man5/ippool.5.gz
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"