svn commit: r324379 - head/usr.sbin/cxgbetool

2017-10-06 Thread Navdeep Parhar
Author: np
Date: Sat Oct  7 01:20:30 2017
New Revision: 324379
URL: https://svnweb.freebsd.org/changeset/base/324379

Log:
  cxgbetool(8): Do not create a large file devoid of useful content when
  the dumpstate ioctl fails.  Make the file world-readable while here.
  
  MFC after:2 weeks
  Sponsored by: Chelsio Communications

Modified:
  head/usr.sbin/cxgbetool/cxgbetool.c

Modified: head/usr.sbin/cxgbetool/cxgbetool.c
==
--- head/usr.sbin/cxgbetool/cxgbetool.c Fri Oct  6 23:05:55 2017
(r324378)
+++ head/usr.sbin/cxgbetool/cxgbetool.c Sat Oct  7 01:20:30 2017
(r324379)
@@ -1896,13 +1896,6 @@ dumpstate(int argc, const char *argv[])
return (EINVAL);
}
 
-   fd = open(fname, O_CREAT | O_TRUNC | O_EXCL | O_WRONLY,
-   S_IRUSR | S_IRGRP);
-   if (fd < 0) {
-   warn("open(%s)", fname);
-   return (errno);
-   }
-
dump.wr_flash = 0;
memset(, 0xff, sizeof(dump.bitmap));
dump.len = 8 * 1024 * 1024;
@@ -1913,9 +1906,20 @@ dumpstate(int argc, const char *argv[])
}
 
rc = doit(CHELSIO_T4_CUDBG_DUMP, );
+   if (rc != 0)
+   goto done;
+
+   fd = open(fname, O_CREAT | O_TRUNC | O_EXCL | O_WRONLY,
+   S_IRUSR | S_IRGRP | S_IROTH);
+   if (fd < 0) {
+   warn("open(%s)", fname);
+   rc = errno;
+   goto done;
+   }
write(fd, dump.data, dump.len);
-   free(dump.data);
close(fd);
+done:
+   free(dump.data);
return (rc);
 }
 
___
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: r324378 - head/sys/kern

2017-10-06 Thread Mateusz Guzik
Author: mjg
Date: Fri Oct  6 23:05:55 2017
New Revision: 324378
URL: https://svnweb.freebsd.org/changeset/base/324378

Log:
  namecache: factor out ~MAKEENTRY lookups from the common path
  
  Lookups of the sort are rare compared to regular ones and succesfull ones
  result in removing entries from the cache.
  
  In the current code buckets are rlocked and a trylock dance is performed,
  which can fail and cause a restart. Fixing it will require a little bit
  of surgery and in order to keep the code maintaineable the 2 cases have
  to split.
  
  MFC after:1 week

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Fri Oct  6 21:52:28 2017(r324377)
+++ head/sys/kern/vfs_cache.c   Fri Oct  6 23:05:55 2017(r324378)
@@ -1058,7 +1058,6 @@ cache_lookup_unlock(struct rwlock *blp, struct mtx *vl
 
if (blp != NULL) {
rw_runlock(blp);
-   mtx_assert(vlp, MA_NOTOWNED);
} else {
mtx_unlock(vlp);
}
@@ -1117,6 +1116,82 @@ cache_lookup_dot(struct vnode *dvp, struct vnode **vpp
  * not recursively acquired.
  */
 
+static __noinline int
+cache_lookup_nomakeentry(struct vnode *dvp, struct vnode **vpp,
+struct componentname *cnp, struct timespec *tsp, int *ticksp)
+{
+   struct namecache *ncp;
+   struct rwlock *blp;
+   struct mtx *dvlp, *dvlp2;
+   uint32_t hash;
+   int error;
+
+   if (cnp->cn_namelen == 2 && cnp->cn_nameptr[1] == '.') {
+   counter_u64_add(dotdothits, 1);
+   dvlp = VP2VNODELOCK(dvp);
+   dvlp2 = NULL;
+   mtx_lock(dvlp);
+retry_dotdot:
+   ncp = dvp->v_cache_dd;
+   if (ncp == NULL) {
+   SDT_PROBE3(vfs, namecache, lookup, miss, dvp,
+   "..", NULL);
+   mtx_unlock(dvlp);
+   return (0);
+   }
+   if ((ncp->nc_flag & NCF_ISDOTDOT) != 0) {
+   if (ncp->nc_dvp != dvp)
+   panic("dvp %p v_cache_dd %p\n", dvp, ncp);
+   if (!cache_zap_locked_vnode_kl2(ncp,
+   dvp, ))
+   goto retry_dotdot;
+   MPASS(dvp->v_cache_dd == NULL);
+   mtx_unlock(dvlp);
+   if (dvlp2 != NULL)
+   mtx_unlock(dvlp2);
+   cache_free(ncp);
+   } else {
+   dvp->v_cache_dd = NULL;
+   mtx_unlock(dvlp);
+   if (dvlp2 != NULL)
+   mtx_unlock(dvlp2);
+   }
+   return (0);
+   }
+
+   hash = cache_get_hash(cnp->cn_nameptr, cnp->cn_namelen, dvp);
+   blp = HASH2BUCKETLOCK(hash);
+retry:
+   rw_rlock(blp);
+
+   LIST_FOREACH(ncp, (NCHHASH(hash)), nc_hash) {
+   counter_u64_add(numchecks, 1);
+   if (ncp->nc_dvp == dvp && ncp->nc_nlen == cnp->cn_namelen &&
+   !bcmp(ncp->nc_name, cnp->cn_nameptr, ncp->nc_nlen))
+   break;
+   }
+
+   /* We failed to find an entry */
+   if (ncp == NULL) {
+   rw_runlock(blp);
+   SDT_PROBE3(vfs, namecache, lookup, miss, dvp, cnp->cn_nameptr,
+   NULL);
+   counter_u64_add(nummisszap, 1);
+   return (0);
+   }
+
+   counter_u64_add(numposzaps, 1);
+
+   error = cache_zap_rlocked_bucket(ncp, blp);
+   if (error != 0) {
+   zap_and_exit_bucket_fail++;
+   cache_maybe_yield();
+   goto retry;
+   }
+   cache_free(ncp);
+   return (0);
+}
+
 int
 cache_lookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp,
 struct timespec *tsp, int *ticksp)
@@ -1132,69 +1207,51 @@ cache_lookup(struct vnode *dvp, struct vnode **vpp, st
cnp->cn_flags &= ~MAKEENTRY;
return (0);
}
+
+   counter_u64_add(numcalls, 1);
+
+   if (__predict_false(cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.'))
+   return (cache_lookup_dot(dvp, vpp, cnp, tsp, ticksp));
+
+   if ((cnp->cn_flags & MAKEENTRY) == 0)
+   return (cache_lookup_nomakeentry(dvp, vpp, cnp, tsp, ticksp));
+
 retry:
blp = NULL;
-   dvlp = VP2VNODELOCK(dvp);
error = 0;
-   counter_u64_add(numcalls, 1);
-
-   if (cnp->cn_nameptr[0] == '.') {
-   if (cnp->cn_namelen == 1)
-   return (cache_lookup_dot(dvp, vpp, cnp, tsp, ticksp));
-   if (cnp->cn_namelen == 2 && cnp->cn_nameptr[1] == '.') {
-   counter_u64_add(dotdothits, 1);
-   dvlp2 = NULL;
-   mtx_lock(dvlp);

svn commit: r324377 - in head: share/man/man9 sys/kern sys/sys

2017-10-06 Thread Mark Johnston
Author: markj
Date: Fri Oct  6 21:52:28 2017
New Revision: 324377
URL: https://svnweb.freebsd.org/changeset/base/324377

Log:
  Let stack_create(9) take a malloc flags argument.
  
  Reviewed by:  cem
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D12614

Modified:
  head/share/man/man9/stack.9
  head/sys/kern/kern_proc.c
  head/sys/kern/subr_sleepqueue.c
  head/sys/kern/subr_stack.c
  head/sys/sys/stack.h

Modified: head/share/man/man9/stack.9
==
--- head/share/man/man9/stack.9 Fri Oct  6 20:51:32 2017(r324376)
+++ head/share/man/man9/stack.9 Fri Oct  6 21:52:28 2017(r324377)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 10, 2015
+.Dd October 6, 2017
 .Dt STACK 9
 .Os
 .Sh NAME
@@ -42,7 +42,7 @@ In the kernel configuration file:
 .Cd "options STACK"
 .Pp
 .Ft struct stack *
-.Fn stack_create "void"
+.Fn stack_create "int flags"
 .Ft void
 .Fn stack_destroy "struct stack *st"
 .Ft int
@@ -85,8 +85,11 @@ Each stack trace is described by a
 .Vt "struct stack" .
 Before a trace may be created or otherwise manipulated, storage for the trace
 must be allocated with
-.Fn stack_create ,
-which may sleep.
+.Fn stack_create .
+The
+.Ar flags
+argument is passed to
+.Xr malloc 9 .
 Memory associated with a trace is freed by calling
 .Fn stack_destroy .
 .Pp

Modified: head/sys/kern/kern_proc.c
==
--- head/sys/kern/kern_proc.c   Fri Oct  6 20:51:32 2017(r324376)
+++ head/sys/kern/kern_proc.c   Fri Oct  6 21:52:28 2017(r324377)
@@ -2547,7 +2547,7 @@ sysctl_kern_proc_kstack(SYSCTL_HANDLER_ARGS)
return (error);
 
kkstp = malloc(sizeof(*kkstp), M_TEMP, M_WAITOK);
-   st = stack_create();
+   st = stack_create(M_WAITOK);
 
lwpidarray = NULL;
PROC_LOCK(p);

Modified: head/sys/kern/subr_sleepqueue.c
==
--- head/sys/kern/subr_sleepqueue.c Fri Oct  6 20:51:32 2017
(r324376)
+++ head/sys/kern/subr_sleepqueue.c Fri Oct  6 21:52:28 2017
(r324377)
@@ -1163,7 +1163,7 @@ sleepq_sbuf_print_stacks(struct sbuf *sb, void *wchan,
M_TEMP, M_WAITOK);
for (stack_idx = 0; stack_idx < stacks_to_allocate;
stack_idx++)
-   st[stack_idx] = stack_create();
+   st[stack_idx] = stack_create(M_WAITOK);
 
/* Where we will store the td name, tid, etc. */
td_infos = malloc(sizeof(struct sbuf *) * stacks_to_allocate,

Modified: head/sys/kern/subr_stack.c
==
--- head/sys/kern/subr_stack.c  Fri Oct  6 20:51:32 2017(r324376)
+++ head/sys/kern/subr_stack.c  Fri Oct  6 21:52:28 2017(r324377)
@@ -50,11 +50,11 @@ static int stack_symbol(vm_offset_t pc, char *namebuf,
 static int stack_symbol_ddb(vm_offset_t pc, const char **name, long *offset);
 
 struct stack *
-stack_create(void)
+stack_create(int flags)
 {
struct stack *st;
 
-   st = malloc(sizeof *st, M_STACK, M_WAITOK | M_ZERO);
+   st = malloc(sizeof(*st), M_STACK, flags | M_ZERO);
return (st);
 }
 

Modified: head/sys/sys/stack.h
==
--- head/sys/sys/stack.hFri Oct  6 20:51:32 2017(r324376)
+++ head/sys/sys/stack.hFri Oct  6 21:52:28 2017(r324377)
@@ -34,7 +34,7 @@
 struct sbuf;
 
 /* MI Routines. */
-struct stack   *stack_create(void);
+struct stack   *stack_create(int);
 voidstack_destroy(struct stack *);
 int stack_put(struct stack *, vm_offset_t);
 voidstack_copy(const struct stack *, struct stack *);
___
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: r324376 - head/tests/sys/netpfil/pf

2017-10-06 Thread Kristof Provost
Author: kp
Date: Fri Oct  6 20:51:32 2017
New Revision: 324376
URL: https://svnweb.freebsd.org/changeset/base/324376

Log:
  pf: Very basic forwarding test
  
  This test illustrates the use of scapy to test pf.
  
  Differential Revision:https://reviews.freebsd.org/D12581

Added:
  head/tests/sys/netpfil/pf/forward.sh   (contents, props changed)
  head/tests/sys/netpfil/pf/pft_ping.py   (contents, props changed)
Modified:
  head/tests/sys/netpfil/pf/Makefile
  head/tests/sys/netpfil/pf/utils.subr

Modified: head/tests/sys/netpfil/pf/Makefile
==
--- head/tests/sys/netpfil/pf/Makefile  Fri Oct  6 20:43:14 2017
(r324375)
+++ head/tests/sys/netpfil/pf/Makefile  Fri Oct  6 20:51:32 2017
(r324376)
@@ -4,8 +4,12 @@ PACKAGE=   tests
 
 TESTSDIR=   ${TESTSBASE}/sys/netpfil/pf
 
-ATF_TESTS_SH+= pass_block
+ATF_TESTS_SH+= pass_block \
+   forward
 
-${PACKAGE}FILES+=  utils.subr
+${PACKAGE}FILES+=  utils.subr \
+   pft_ping.py
+
+${PACKAGE}FILESMODE_pft_ping.py=   0555
 
 .include 

Added: head/tests/sys/netpfil/pf/forward.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/netpfil/pf/forward.shFri Oct  6 20:51:32 2017
(r324376)
@@ -0,0 +1,67 @@
+# $FreeBSD$
+
+. $(atf_get_srcdir)/utils.subr
+
+atf_test_case "v4" "cleanup"
+v4_head()
+{
+   atf_set descr 'Basic forwarding test'
+   atf_set require.user root
+
+   # We need scapy to be installed for out test scripts to work
+   atf_set require.progs scapy
+}
+
+v4_body()
+{
+   pft_init
+
+   epair_send=$(pft_mkepair)
+   ifconfig ${epair_send}a 192.0.2.1/24 up
+
+   epair_recv=$(pft_mkepair)
+   ifconfig ${epair_recv}a up
+
+   pft_mkjail alcatraz ${epair_send}b ${epair_recv}b
+   jexec alcatraz ifconfig ${epair_send}b 192.0.2.2/24 up
+   jexec alcatraz ifconfig ${epair_recv}b 198.51.100.2/24 up
+   jexec alcatraz sysctl net.inet.ip.forwarding=1
+   jexec alcatraz arp -s 198.51.100.3 00:01:02:03:04:05
+   route add -net 198.51.100.0/24 192.0.2.2
+
+   # Sanity check, can we forward ICMP echo requests without pf?
+   atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \
+   --sendif ${epair_send}a \
+   --to 198.51.100.3 \
+   --recvif ${epair_recv}a
+
+   # Forward with pf enabled
+   printf "block in\n" | jexec alcatraz pfctl -ef -
+   atf_check -s exit:1 $(atf_get_srcdir)/pft_ping.py \
+   --sendif ${epair_send}a \
+   --to 198.51.100.3 \
+   --recvif ${epair_recv}a
+
+   printf "block out\n" | jexec alcatraz pfctl -f -
+   atf_check -s exit:1 $(atf_get_srcdir)/pft_ping.py \
+   --sendif ${epair_send}a \
+   --to 198.51.100.3 \
+   --recv ${epair_recv}a
+
+   # Allow ICMP
+   printf "block in\npass in proto icmp\n" | jexec alcatraz pfctl -f -
+   atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \
+   --sendif ${epair_send}a \
+   --to 198.51.100.3 \
+   --recvif ${epair_recv}a
+}
+
+v4_cleanup()
+{
+   pft_cleanup
+}
+
+atf_init_test_cases()
+{
+   atf_add_test_case "v4"
+}

Added: head/tests/sys/netpfil/pf/pft_ping.py
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/netpfil/pf/pft_ping.py   Fri Oct  6 20:51:32 2017
(r324376)
@@ -0,0 +1,83 @@
+#!/usr/local/bin/python2.7
+
+import argparse
+import scapy.all as sp
+import sys
+import threading
+
+PAYLOAD_MAGIC = 0x42c0ffee
+
+class Sniffer(threading.Thread):
+   def __init__(self, recvif):
+   threading.Thread.__init__(self)
+
+   self._recvif = recvif
+
+   self.start()
+
+   def run(self):
+   self.packets = sp.sniff(iface=self._recvif, timeout=3)
+
+def check_ping_request(packet, dst_ip):
+   """
+   Verify that the packet matches what we'd have sent
+   """
+   ip = packet.getlayer(sp.IP)
+   if not ip:
+   return False
+   if ip.dst != dst_ip:
+   return False
+
+   icmp = packet.getlayer(sp.ICMP)
+   if not icmp:
+   return False
+   if sp.icmptypes[icmp.type] != 'echo-request':
+   return False
+
+   raw = packet.getlayer(sp.Raw)
+   if not raw:
+   return False
+   if raw.load != str(PAYLOAD_MAGIC):
+   return False
+
+   return True
+
+def ping(send_if, dst_ip):
+   req = sp.Ether() \
+   / sp.IP(dst=dst_ip) \
+   / sp.ICMP(type='echo-request') \
+   / sp.Raw(PAYLOAD_MAGIC)
+   sp.sendp(req, iface=send_if, verbose=False)
+
+def 

svn commit: r324375 - in head: etc/mtree tests/sys tests/sys/netpfil tests/sys/netpfil/pf

2017-10-06 Thread Kristof Provost
Author: kp
Date: Fri Oct  6 20:43:14 2017
New Revision: 324375
URL: https://svnweb.freebsd.org/changeset/base/324375

Log:
  pf: Basic automated test using VIMAGE
  
  If VIMAGE is present we can start jails with their own pf instance. This
  makes it fairly easy to run tests.
  For example, this basic test verifies that drop/pass and icmp
  classification works. It's a basic sanity test for pf, and hopefully an
  example on how to write more pf tests.
  
  The tests are skipped if VIMAGE is not enabled.
  
  This work is inspired by the GSoC work of Panagiotes Mousikides.
  
  Differential Revision:https://reviews.freebsd.org/D12580

Added:
  head/tests/sys/netpfil/
  head/tests/sys/netpfil/Makefile   (contents, props changed)
  head/tests/sys/netpfil/pf/
  head/tests/sys/netpfil/pf/Makefile   (contents, props changed)
  head/tests/sys/netpfil/pf/pass_block.sh   (contents, props changed)
  head/tests/sys/netpfil/pf/utils.subr   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist
  head/tests/sys/Makefile

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Fri Oct  6 20:33:40 2017
(r324374)
+++ head/etc/mtree/BSD.tests.dist   Fri Oct  6 20:43:14 2017
(r324375)
@@ -476,6 +476,10 @@
 ..
 netinet
 ..
+netpfil
+pf
+..
+..
 opencrypto
 ..
 pjdfstest

Modified: head/tests/sys/Makefile
==
--- head/tests/sys/Makefile Fri Oct  6 20:33:40 2017(r324374)
+++ head/tests/sys/Makefile Fri Oct  6 20:43:14 2017(r324375)
@@ -13,6 +13,7 @@ TESTS_SUBDIRS+=   kqueue
 TESTS_SUBDIRS+=mac
 TESTS_SUBDIRS+=mqueue
 TESTS_SUBDIRS+=netinet
+TESTS_SUBDIRS+=netpfil
 TESTS_SUBDIRS+=opencrypto
 TESTS_SUBDIRS+=posixshm
 TESTS_SUBDIRS+=sys

Added: head/tests/sys/netpfil/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/netpfil/Makefile Fri Oct  6 20:43:14 2017
(r324375)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+TESTSDIR=  ${TESTSBASE}/sys/netpfil
+
+TESTS_SUBDIRS+=pf
+
+.include 

Added: head/tests/sys/netpfil/pf/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/netpfil/pf/Makefile  Fri Oct  6 20:43:14 2017
(r324375)
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+PACKAGE=   tests
+
+TESTSDIR=   ${TESTSBASE}/sys/netpfil/pf
+
+ATF_TESTS_SH+= pass_block
+
+${PACKAGE}FILES+=  utils.subr
+
+.include 

Added: head/tests/sys/netpfil/pf/pass_block.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/netpfil/pf/pass_block.sh Fri Oct  6 20:43:14 2017
(r324375)
@@ -0,0 +1,91 @@
+# $FreeBSD$
+
+. $(atf_get_srcdir)/utils.subr
+
+atf_test_case "v4" "cleanup"
+v4_head()
+{
+   atf_set descr 'Basic pass/block test for IPv4'
+   atf_set require.user root
+}
+
+v4_body()
+{
+   pft_init
+
+   epair=$(pft_mkepair)
+   ifconfig ${epair}a 192.0.2.1/24 up
+
+   # Set up a simple jail with one interface
+   pft_mkjail alcatraz ${epair}b
+   jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up
+
+   # Trivial ping to the jail, without pf
+   atf_check -s exit:0 -o ignore ping -c 1 -t 1 192.0.2.2
+
+   # pf without policy will let us ping
+   jexec alcatraz pfctl -e
+   atf_check -s exit:0 -o ignore ping -c 1 -t 1 192.0.2.2
+
+   # Block everything
+   printf "block in\n" | jexec alcatraz pfctl -f -
+   atf_check -s exit:2 -o ignore ping -c 1 -t 1 192.0.2.2
+
+   # Block everything but ICMP
+   printf "block in\npass in proto icmp\n" | jexec alcatraz pfctl -f -
+   atf_check -s exit:0 -o ignore ping -c 1 -t 1 192.0.2.2
+}
+
+v4_cleanup()
+{
+   pft_cleanup
+}
+
+atf_test_case "v6" "cleanup"
+v6_head()
+{
+   atf_set descr 'Basic pass/block test for IPv6'
+   atf_set require.user root
+}
+
+v6_body()
+{
+   pft_init
+
+   epair=$(pft_mkepair)
+   ifconfig ${epair}a inet6 2001:db8:42::1/64 up no_dad
+
+   # Set up a simple jail with one interface
+   pft_mkjail alcatraz ${epair}b
+   jexec alcatraz ifconfig ${epair}b inet6 2001:db8:42::2/64 up no_dad
+
+   # Trivial ping to the jail, without pf
+   atf_check -s exit:0 -o ignore ping6 -c 1 -x 1 2001:db8:42::2
+
+   # pf without policy will let us ping
+   jexec alcatraz pfctl -e
+   atf_check -s exit:0 -o ignore ping6 -c 1 -x 

svn commit: r324374 - head/sys/netinet

2017-10-06 Thread Gleb Smirnoff
Author: glebius
Date: Fri Oct  6 20:33:40 2017
New Revision: 324374
URL: https://svnweb.freebsd.org/changeset/base/324374

Log:
  Declare pmtud_blackhole global variables in tcp_timer.h, so that
  alternative TCP stacks can legally use them.

Modified:
  head/sys/netinet/tcp_timer.c
  head/sys/netinet/tcp_timer.h

Modified: head/sys/netinet/tcp_timer.c
==
--- head/sys/netinet/tcp_timer.cFri Oct  6 18:29:00 2017
(r324373)
+++ head/sys/netinet/tcp_timer.cFri Oct  6 20:33:40 2017
(r324374)
@@ -141,16 +141,14 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, rexmit_drop_option
 _rexmit_drop_options, 0,
 "Drop TCP options from 3rd and later retransmitted SYN");
 
-static VNET_DEFINE(int, tcp_pmtud_blackhole_detect);
-#defineV_tcp_pmtud_blackhole_detectVNET(tcp_pmtud_blackhole_detect)
+VNET_DEFINE(int, tcp_pmtud_blackhole_detect);
 SYSCTL_INT(_net_inet_tcp, OID_AUTO, pmtud_blackhole_detection,
 CTLFLAG_RW|CTLFLAG_VNET,
 _NAME(tcp_pmtud_blackhole_detect), 0,
 "Path MTU Discovery Black Hole Detection Enabled");
 
 #ifdef INET
-static VNET_DEFINE(int, tcp_pmtud_blackhole_mss) = 1200;
-#defineV_tcp_pmtud_blackhole_mss   VNET(tcp_pmtud_blackhole_mss)
+VNET_DEFINE(int, tcp_pmtud_blackhole_mss) = 1200;
 SYSCTL_INT(_net_inet_tcp, OID_AUTO, pmtud_blackhole_mss,
 CTLFLAG_RW|CTLFLAG_VNET,
 _NAME(tcp_pmtud_blackhole_mss), 0,
@@ -158,8 +156,7 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, pmtud_blackhole_ms
 #endif
 
 #ifdef INET6
-static VNET_DEFINE(int, tcp_v6pmtud_blackhole_mss) = 1220;
-#defineV_tcp_v6pmtud_blackhole_mss VNET(tcp_v6pmtud_blackhole_mss)
+VNET_DEFINE(int, tcp_v6pmtud_blackhole_mss) = 1220;
 SYSCTL_INT(_net_inet_tcp, OID_AUTO, v6pmtud_blackhole_mss,
 CTLFLAG_RW|CTLFLAG_VNET,
 _NAME(tcp_v6pmtud_blackhole_mss), 0,

Modified: head/sys/netinet/tcp_timer.h
==
--- head/sys/netinet/tcp_timer.hFri Oct  6 18:29:00 2017
(r324373)
+++ head/sys/netinet/tcp_timer.hFri Oct  6 20:33:40 2017
(r324374)
@@ -198,6 +198,13 @@ extern int tcp_syn_backoff[];
 extern int tcp_finwait2_timeout;
 extern int tcp_fast_finwait2_recycle;
 
+VNET_DECLARE(int, tcp_pmtud_blackhole_detect);
+#define V_tcp_pmtud_blackhole_detect   VNET(tcp_pmtud_blackhole_detect)
+VNET_DECLARE(int, tcp_pmtud_blackhole_mss);
+#defineV_tcp_pmtud_blackhole_mss   VNET(tcp_pmtud_blackhole_mss)
+VNET_DECLARE(int, tcp_v6pmtud_blackhole_mss);
+#define V_tcp_v6pmtud_blackhole_mssVNET(tcp_v6pmtud_blackhole_mss)
+
 int tcp_inpinfo_lock_add(struct inpcb *inp);
 void tcp_inpinfo_lock_del(struct inpcb *inp, struct tcpcb *tp);
 
___
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: r324373 - head/cddl/contrib/opensolaris/lib/libdtrace/common

2017-10-06 Thread Mark Johnston
Author: markj
Date: Fri Oct  6 18:29:00 2017
New Revision: 324373
URL: https://svnweb.freebsd.org/changeset/base/324373

Log:
  Avoid adding an extra "0x" prefix before pointer formats.
  
  MFC after:1 week

Modified:
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dis.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dis.c
==
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dis.c Fri Oct  6 
18:27:55 2017(r324372)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dis.c Fri Oct  6 
18:29:00 2017(r324373)
@@ -434,7 +434,7 @@ dt_dis(const dtrace_difo_t *dp, FILE *fp)
ulong_t i = 0;
char type[DT_TYPE_NAMELEN];
 
-   (void) fprintf(fp, "\nDIFO 0x%p returns %s\n", (void *)dp,
+   (void) fprintf(fp, "\nDIFO %p returns %s\n", (void *)dp,
dt_dis_typestr(>dtdo_rtype, type, sizeof (type)));
 
(void) fprintf(fp, "%-3s %-8s%s\n",

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c
==
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c   Fri Oct 
 6 18:27:55 2017(r324372)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c   Fri Oct 
 6 18:29:00 2017(r324373)
@@ -377,7 +377,7 @@ dt_print_array(ctf_id_t base, ulong_t off, dt_printarg
ctf_id_t rtype;
 
if (ctf_array_info(ctfp, base, ) == CTF_ERR) {
-   (void) fprintf(fp, "0x%p", (void *)addr);
+   (void) fprintf(fp, "%p", (void *)addr);
return;
}
 
___
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: r324372 - head/sys/dev/random

2017-10-06 Thread Conrad Meyer
Author: cem
Date: Fri Oct  6 18:27:55 2017
New Revision: 324372
URL: https://svnweb.freebsd.org/changeset/base/324372

Log:
  random(4): Discard low entropy inputs
  
  The later fields of the harvest_event structure are predictable and provide
  little value to the entropy pool.  Only feed in the relatively high entropy
  counter and explicit entropy buffer to increase measured input entropy.
  
  See also:
  https://people.freebsd.org/~jmg/vbsdcon_2017_ddfreebsdrng_slides.pdf
  
  PR:   222807
  Submitted by: W. Dean Freeman 
  Reviewed by:  jmg (earlier version), delphij
  Approved by:  secteam (delphij)
  Obtained from:HBSD 8d809124d563937edd84c9c9d5494406e359c55c
  Security: no -- low entropy marginal input has no known negative affect 
on pool quality
  Differential Revision:https://reviews.freebsd.org/D12610

Modified:
  head/sys/dev/random/fortuna.c

Modified: head/sys/dev/random/fortuna.c
==
--- head/sys/dev/random/fortuna.c   Fri Oct  6 18:22:36 2017
(r324371)
+++ head/sys/dev/random/fortuna.c   Fri Oct  6 18:27:55 2017
(r324372)
@@ -1,4 +1,5 @@
 /*-
+ * Copyright (c) 2017 W. Dean Freeman
  * Copyright (c) 2013-2015 Mark R V Murray
  * All rights reserved.
  *
@@ -87,7 +88,7 @@ __FBSDID("$FreeBSD$");
  * and too small may compromise initial security but get faster reseeds.
  */
 #defineRANDOM_FORTUNA_MINPOOLSIZE 16
-#defineRANDOM_FORTUNA_MAXPOOLSIZE UINT_MAX
+#defineRANDOM_FORTUNA_MAXPOOLSIZE INT_MAX 
 CTASSERT(RANDOM_FORTUNA_MINPOOLSIZE <= RANDOM_FORTUNA_DEFPOOLSIZE);
 CTASSERT(RANDOM_FORTUNA_DEFPOOLSIZE <= RANDOM_FORTUNA_MAXPOOLSIZE);
 
@@ -232,17 +233,29 @@ random_fortuna_process_event(struct harvest_event *eve
 * during accumulation/reseeding and reading/regating.
 */
pl = event->he_destination % RANDOM_FORTUNA_NPOOLS;
-   randomdev_hash_iterate(_state.fs_pool[pl].fsp_hash, event, 
sizeof(*event));
+   /*
+* We ignore low entropy static/counter fields towards the end of the
+* he_event structure in order to increase measurable entropy when
+* conducting SP800-90B entropy analysis measurements of seed material
+* fed into PRNG.
+* -- wdf
+*/
+   KASSERT(event->he_size <= sizeof(event->he_entropy),
+   ("%s: event->he_size: %hhu > sizeof(event->he_entropy): %zu\n",
+   __func__, event->he_size, sizeof(event->he_entropy)));
+   randomdev_hash_iterate(_state.fs_pool[pl].fsp_hash,
+   >he_somecounter, sizeof(event->he_somecounter));
+   randomdev_hash_iterate(_state.fs_pool[pl].fsp_hash,
+   event->he_entropy, event->he_size);
+
/*-
-* Don't wrap the length. Doing this the hard way so as not to wrap at 
MAXUINT.
-* This is a "saturating" add.
+* Don't wrap the length.  This is a "saturating" add.
 * XXX: FIX!!: We don't actually need lengths for anything but 
fs_pool[0],
 * but it's been useful debugging to see them all.
 */
-   if (RANDOM_FORTUNA_MAXPOOLSIZE - fortuna_state.fs_pool[pl].fsp_length > 
event->he_size)
-   fortuna_state.fs_pool[pl].fsp_length += event->he_size;
-   else
-   fortuna_state.fs_pool[pl].fsp_length = 
RANDOM_FORTUNA_MAXPOOLSIZE;
+   fortuna_state.fs_pool[pl].fsp_length = MIN(RANDOM_FORTUNA_MAXPOOLSIZE,
+   fortuna_state.fs_pool[pl].fsp_length +
+   sizeof(event->he_somecounter) + event->he_size);
explicit_bzero(event, sizeof(*event));
RANDOM_RESEED_UNLOCK();
 }
___
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: r324371 - stable/10/etc/defaults

2017-10-06 Thread Devin Teske
Author: dteske
Date: Fri Oct  6 18:22:36 2017
New Revision: 324371
URL: https://svnweb.freebsd.org/changeset/base/324371

Log:
  MFC SVN r295342-295344
  
  Differential Revision:https://reviews.freebsd.org/D12568
  Submitted by: Vinicius Zava (egypcio at googlemail.com)
  Reviewed by:  allanjude

Modified:
  stable/10/etc/defaults/rc.conf
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/defaults/rc.conf
==
--- stable/10/etc/defaults/rc.conf  Fri Oct  6 17:30:18 2017
(r324370)
+++ stable/10/etc/defaults/rc.conf  Fri Oct  6 18:22:36 2017
(r324371)
@@ -723,5 +723,18 @@ if [ -z "${source_rc_confs_defined}" ]; then
;;
esac
done
+   # Re-do process to pick up [possibly] redefined $rc_conf_files
+   for i in ${rc_conf_files}; do
+   case ${sourced_files} in
+   *:$i:*)
+   ;;
+   *)
+   sourced_files="${sourced_files}:$i:"
+   if [ -r $i ]; then
+   . $i
+   fi
+   ;;
+   esac
+   done
}
 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: r324370 - head/release/arm

2017-10-06 Thread Glen Barber
Author: gjb
Date: Fri Oct  6 17:30:18 2017
New Revision: 324370
URL: https://svnweb.freebsd.org/changeset/base/324370

Log:
  Catch up with r324340, switching relevant arm SoCs from armv6
  to armv7.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/arm/BANANAPI.conf
  head/release/arm/BEAGLEBONE.conf
  head/release/arm/CUBIEBOARD.conf
  head/release/arm/CUBIEBOARD2.conf
  head/release/arm/CUBOX-HUMMINGBOARD.conf
  head/release/arm/PANDABOARD.conf
  head/release/arm/RPI2.conf
  head/release/arm/WANDBOARD.conf

Modified: head/release/arm/BANANAPI.conf
==
--- head/release/arm/BANANAPI.conf  Fri Oct  6 16:38:00 2017
(r324369)
+++ head/release/arm/BANANAPI.conf  Fri Oct  6 17:30:18 2017
(r324370)
@@ -5,7 +5,7 @@
 
 EMBEDDEDBUILD=1
 EMBEDDED_TARGET="arm"
-EMBEDDED_TARGET_ARCH="armv6"
+EMBEDDED_TARGET_ARCH="armv7"
 EMBEDDEDPORTS="sysutils/u-boot-bananapi"
 KERNEL="GENERIC"
 WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x4200"

Modified: head/release/arm/BEAGLEBONE.conf
==
--- head/release/arm/BEAGLEBONE.confFri Oct  6 16:38:00 2017
(r324369)
+++ head/release/arm/BEAGLEBONE.confFri Oct  6 17:30:18 2017
(r324370)
@@ -5,7 +5,7 @@
 
 EMBEDDEDBUILD=1
 EMBEDDED_TARGET="arm"
-EMBEDDED_TARGET_ARCH="armv6"
+EMBEDDED_TARGET_ARCH="armv7"
 EMBEDDEDPORTS="sysutils/u-boot-beaglebone"
 KERNEL="BEAGLEBONE"
 WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x8800"

Modified: head/release/arm/CUBIEBOARD.conf
==
--- head/release/arm/CUBIEBOARD.confFri Oct  6 16:38:00 2017
(r324369)
+++ head/release/arm/CUBIEBOARD.confFri Oct  6 17:30:18 2017
(r324370)
@@ -5,7 +5,7 @@
 
 EMBEDDEDBUILD=1
 EMBEDDED_TARGET="arm"
-EMBEDDED_TARGET_ARCH="armv6"
+EMBEDDED_TARGET_ARCH="armv7"
 EMBEDDEDPORTS="sysutils/u-boot-cubieboard"
 KERNEL="ALLWINNER_UP"
 WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x4200"

Modified: head/release/arm/CUBIEBOARD2.conf
==
--- head/release/arm/CUBIEBOARD2.conf   Fri Oct  6 16:38:00 2017
(r324369)
+++ head/release/arm/CUBIEBOARD2.conf   Fri Oct  6 17:30:18 2017
(r324370)
@@ -5,7 +5,7 @@
 
 EMBEDDEDBUILD=1
 EMBEDDED_TARGET="arm"
-EMBEDDED_TARGET_ARCH="armv6"
+EMBEDDED_TARGET_ARCH="armv7"
 EMBEDDEDPORTS="sysutils/u-boot-cubieboard2"
 KERNEL="GENERIC"
 WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x4200"

Modified: head/release/arm/CUBOX-HUMMINGBOARD.conf
==
--- head/release/arm/CUBOX-HUMMINGBOARD.confFri Oct  6 16:38:00 2017
(r324369)
+++ head/release/arm/CUBOX-HUMMINGBOARD.confFri Oct  6 17:30:18 2017
(r324370)
@@ -5,7 +5,7 @@
 
 EMBEDDEDBUILD=1
 EMBEDDED_TARGET="arm"
-EMBEDDED_TARGET_ARCH="armv6"
+EMBEDDED_TARGET_ARCH="armv7"
 EMBEDDEDPORTS="sysutils/u-boot-cubox-hummingboard"
 KERNEL="IMX6"
 WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x1200"

Modified: head/release/arm/PANDABOARD.conf
==
--- head/release/arm/PANDABOARD.confFri Oct  6 16:38:00 2017
(r324369)
+++ head/release/arm/PANDABOARD.confFri Oct  6 17:30:18 2017
(r324370)
@@ -5,7 +5,7 @@
 
 EMBEDDEDBUILD=1
 EMBEDDED_TARGET="arm"
-EMBEDDED_TARGET_ARCH="armv6"
+EMBEDDED_TARGET_ARCH="armv7"
 EMBEDDEDPORTS="sysutils/u-boot-pandaboard"
 KERNEL="PANDABOARD"
 WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x8800"

Modified: head/release/arm/RPI2.conf
==
--- head/release/arm/RPI2.conf  Fri Oct  6 16:38:00 2017(r324369)
+++ head/release/arm/RPI2.conf  Fri Oct  6 17:30:18 2017(r324370)
@@ -5,7 +5,7 @@
 
 EMBEDDEDBUILD=1
 EMBEDDED_TARGET="arm"
-EMBEDDED_TARGET_ARCH="armv6"
+EMBEDDED_TARGET_ARCH="armv7"
 EMBEDDEDPORTS="sysutils/u-boot-rpi2"
 KERNEL="GENERIC"
 WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x200"

Modified: head/release/arm/WANDBOARD.conf
==
--- head/release/arm/WANDBOARD.conf Fri Oct  6 16:38:00 2017
(r324369)
+++ head/release/arm/WANDBOARD.conf Fri Oct  6 17:30:18 2017
(r324370)
@@ -5,7 +5,7 @@
 
 EMBEDDEDBUILD=1
 EMBEDDED_TARGET="arm"
-EMBEDDED_TARGET_ARCH="armv6"
+EMBEDDED_TARGET_ARCH="armv7"
 EMBEDDEDPORTS="sysutils/u-boot-wandboard"
 KERNEL="IMX6"
 WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x1200"
___
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: r324369 - head/sbin/geom/class/part

2017-10-06 Thread Marcel Moolenaar
Author: marcel
Date: Fri Oct  6 16:38:00 2017
New Revision: 324369
URL: https://svnweb.freebsd.org/changeset/base/324369

Log:
  Fix alignment of 'last' in autofill.
  
  'last' is the sector number of the last usable sector. Sector
  numbers start with 0. As such, 'last' is always 1 less than
  the count of sectors and aligning 'last' down as-is means that
  the number of free sectors is pessimized by 'alignment - 1' if
  the number of usable sectors was already a multiple of the
  alignment. Consequently, gpart(8) failed to create a partition
  when the alignment and size were such that it would extend to
  the end of the disk.

Modified:
  head/sbin/geom/class/part/geom_part.c

Modified: head/sbin/geom/class/part/geom_part.c
==
--- head/sbin/geom/class/part/geom_part.c   Fri Oct  6 15:46:11 2017
(r324368)
+++ head/sbin/geom/class/part/geom_part.c   Fri Oct  6 16:38:00 2017
(r324369)
@@ -547,7 +547,7 @@ gpart_autofill(struct gctl_req *req)
last = (off_t)strtoimax(s, NULL, 0);
grade = ~0ULL;
a_first = ALIGNUP(first + offset, alignment);
-   last = ALIGNDOWN(last + offset, alignment);
+   last = ALIGNDOWN(last + offset + 1, alignment) - 1;
if (a_first < start)
a_first = start;
while ((pp = find_provider(gp, first)) != NULL) {
___
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: r324368 - head/sys/dev/psci

2017-10-06 Thread Andrew Turner
Author: andrew
Date: Fri Oct  6 15:46:11 2017
New Revision: 324368
URL: https://svnweb.freebsd.org/changeset/base/324368

Log:
  Also handle psci 1.0. This can be seen as a bug fix update for the 0.2
  specification we already support, with the only changes in functions we
  don't currently use.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/dev/psci/psci.c

Modified: head/sys/dev/psci/psci.c
==
--- head/sys/dev/psci/psci.cFri Oct  6 15:09:28 2017(r324367)
+++ head/sys/dev/psci/psci.cFri Oct  6 15:46:11 2017(r324368)
@@ -97,6 +97,7 @@ struct psci_softc *psci_softc = NULL;
 
 #ifdef FDT
 static struct ofw_compat_data compat_data[] = {
+   {"arm,psci-1.0",(uintptr_t)psci_v0_2_init},
{"arm,psci-0.2",(uintptr_t)psci_v0_2_init},
{"arm,psci",(uintptr_t)psci_v0_1_init},
{NULL,  0}
@@ -332,9 +333,11 @@ psci_fdt_callfn(psci_callfn_t *callfn)
phandle_t node;
 
node = ofw_bus_find_compatible(OF_peer(0), "arm,psci-0.2");
-   if (node == 0)
-   /* TODO: Handle psci 0.1 */
-   return (PSCI_MISSING);
+   if (node == 0) {
+   node = ofw_bus_find_compatible(OF_peer(0), "arm,psci-1.0");
+   if (node == 0)
+   return (PSCI_MISSING);
+   }
 
*callfn = psci_fdt_get_callfn(node);
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: r324367 - head/bin/ps

2017-10-06 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri Oct  6 15:09:28 2017
New Revision: 324367
URL: https://svnweb.freebsd.org/changeset/base/324367

Log:
  Fix kvm_getprocs(3) error reporting in ps(1).
  
  Previously it just didn't work at all - kvm_getprocs(3) doesn't update
  the  when it returns NULL.  The end result was that ps(1) showed
  garbage data instead of reporting kinfo_proc size mismatch.
  
  Reviewed by:  cem
  Obtained from:CheriBSD
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D12414

Modified:
  head/bin/ps/ps.c

Modified: head/bin/ps/ps.c
==
--- head/bin/ps/ps.cFri Oct  6 14:29:53 2017(r324366)
+++ head/bin/ps/ps.cFri Oct  6 15:09:28 2017(r324367)
@@ -523,7 +523,11 @@ main(int argc, char *argv[])
 */
nentries = -1;
kp = kvm_getprocs(kd, what, flag, );
-   if ((kp == NULL && nentries > 0) || (kp != NULL && nentries < 0))
+   /*
+* Ignore ESRCH to preserve behaviour of "ps -p nonexistent-pid"
+* not reporting an error.
+*/
+   if ((kp == NULL && errno != ESRCH) || (kp != NULL && nentries < 0))
xo_errx(1, "%s", kvm_geterr(kd));
nkept = 0;
if (nentries > 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: r324366 - head/sys/i386/i386

2017-10-06 Thread Konstantin Belousov
Author: kib
Date: Fri Oct  6 14:29:53 2017
New Revision: 324366
URL: https://svnweb.freebsd.org/changeset/base/324366

Log:
  Improve i386_get_ldt().
  
  Provide consistent snapshot of the requested descriptors by preventing
  other threads from modifying LDT while we fetch the data, lock dt_lock
  around the read.  Copy the data into intermediate buffer, which is
  copied out after the lock is dropped.
  
  Comparing with the amd64 version, the read is done byte by byte, since
  there is no atomic 64bit read (cmpxchg8b method is too heavy comparing
  with the avoided issues).
  
  Improve overflow checking for the descriptors range calculations and
  remove unneeded casts.  Use unsigned types for sizes.
  
  Allow zero num argument to i386_get_ldt() and i386_set_ldt().  This
  case is handled naturally by the code flow.
  
  Reviewed by:  bde
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/i386/i386/sys_machdep.c

Modified: head/sys/i386/i386/sys_machdep.c
==
--- head/sys/i386/i386/sys_machdep.cFri Oct  6 13:48:38 2017
(r324365)
+++ head/sys/i386/i386/sys_machdep.cFri Oct  6 14:29:53 2017
(r324366)
@@ -154,8 +154,6 @@ sysarch(struct thread *td, struct sysarch_args *uap)
if ((error = copyin(uap->parms, ,
sizeof(struct i386_ldt_args))) != 0)
return (error);
-   if (kargs.largs.num > MAX_LD || kargs.largs.num <= 0)
-   return (EINVAL);
break;
case I386_GET_XFPUSTATE:
if ((error = copyin(uap->parms, ,
@@ -172,6 +170,8 @@ sysarch(struct thread *td, struct sysarch_args *uap)
break;
case I386_SET_LDT:
if (kargs.largs.descs != NULL) {
+   if (kargs.largs.num > MAX_LD)
+   return (EINVAL);
lp = malloc(kargs.largs.num * sizeof(union descriptor),
M_TEMP, M_WAITOK);
error = copyin(kargs.largs.descs, lp,
@@ -503,38 +503,37 @@ user_ldt_deref(struct proc_ldt *pldt)
 int
 i386_get_ldt(struct thread *td, struct i386_ldt_args *uap)
 {
-   int error = 0;
struct proc_ldt *pldt;
-   int nldt, num;
-   union descriptor *lp;
+   char *data;
+   u_int nldt, num;
+   int error;
 
 #ifdef DEBUG
printf("i386_get_ldt: start=%u num=%u descs=%p\n",
uap->start, uap->num, (void *)uap->descs);
 #endif
 
+   if (uap->start >= MAX_LD)
+   return (EINVAL);
+   num = min(uap->num, MAX_LD - uap->start);
+   data = malloc(uap->num * sizeof(union descriptor), M_TEMP, M_WAITOK);
mtx_lock_spin(_lock);
-   if ((pldt = td->td_proc->p_md.md_ldt) != NULL) {
-   nldt = pldt->ldt_len;
-   lp = &((union descriptor *)(pldt->ldt_base))[uap->start];
+   pldt = td->td_proc->p_md.md_ldt;
+   nldt = pldt != NULL ? pldt->ldt_len : nitems(ldt);
+   num = min(num, nldt);
+   if (uap->start > nldt || uap->start + num > nldt) {
mtx_unlock_spin(_lock);
-   num = min(uap->num, nldt);
-   } else {
-   mtx_unlock_spin(_lock);
-   nldt = sizeof(ldt)/sizeof(ldt[0]);
-   num = min(uap->num, nldt);
-   lp = [uap->start];
+   return (EINVAL);
}
+   bcopy(pldt != NULL ?
+   &((union descriptor *)(pldt->ldt_base))[uap->start] :
+   [uap->start], data, num * sizeof(union descriptor));
+   mtx_unlock_spin(_lock);
 
-   if ((uap->start > (unsigned int)nldt) ||
-   ((unsigned int)num > (unsigned int)nldt) ||
-   ((unsigned int)(uap->start + num) > (unsigned int)nldt))
-   return(EINVAL);
-
-   error = copyout(lp, uap->descs, num * sizeof(union descriptor));
+   error = copyout(data, uap->descs, num * sizeof(union descriptor));
if (error == 0)
td->td_retval[0] = num;
-
+   free(data, M_TEMP);
return (error);
 }
 
@@ -542,11 +541,11 @@ int
 i386_set_ldt(struct thread *td, struct i386_ldt_args *uap,
 union descriptor *descs)
 {
-   int error, i;
-   int largest_ld;
struct mdproc *mdp;
struct proc_ldt *pldt;
union descriptor *dp;
+   u_int largest_ld, i;
+   int error;
 
 #ifdef DEBUG
printf("i386_set_ldt: start=%u num=%u descs=%p\n",
@@ -565,8 +564,6 @@ i386_set_ldt(struct thread *td, struct i386_ldt_args *
uap->start = NLDT;
uap->num = MAX_LD - NLDT;
}
-   if (uap->num == 0)
-   return (EINVAL);
mtx_lock_spin(_lock);
if ((pldt = mdp->md_ldt) == NULL ||
uap->start >= pldt->ldt_len) {
___

svn commit: r324365 - head

2017-10-06 Thread Warner Losh
Author: imp
Date: Fri Oct  6 13:48:38 2017
New Revision: 324365
URL: https://svnweb.freebsd.org/changeset/base/324365

Log:
  Note about workaround for native armv7 builds using a kernel prior to
  r324363.

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Fri Oct  6 13:46:05 2017(r324364)
+++ head/UPDATING   Fri Oct  6 13:48:38 2017(r324365)
@@ -53,7 +53,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
 
 20171005:
The arm port has split armv6 into armv6 and armv7. armv7 is now
-   a valid TARGET_ARCH/MACHINE_ARCH setting.
+   a valid TARGET_ARCH/MACHINE_ARCH setting. If you have an armv7 system
+   and are running a kernel from before r324363, you will need to add
+   MACHINE_ARCH=armv7 to 'make buildworld' to do a native build.
 
 20171003:
When building multiple kernels using KERNCONF, non-existent KERNCONF
___
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: r324364 - head/libexec/ftpd

2017-10-06 Thread Eugene Grosbein
Author: eugen (ports committer)
Date: Fri Oct  6 13:46:05 2017
New Revision: 324364
URL: https://svnweb.freebsd.org/changeset/base/324364

Log:
  ftpd(8): fix user context handling.
  
  Apply authenticated user context after update of wtmp(5) at start of session,
  so that ftpd process is not killed by kernel with SIGXFSZ when user has
  "filesize" limit lower than size of system wtmp file. Same applies
  to session finalization: revert to super-user context before update of wtmp.
  
  If ftpd hits limit while writing a file at user request,
  do not get killed with SIGXFSZ instantly but apparently ignore the signal,
  process error and report it to the user, and continue with the session.
  
  PR:   143570
  Approved by:  avg (mentor), mav (mentor)
  MFC after:1 week

Modified:
  head/libexec/ftpd/ftpd.c

Modified: head/libexec/ftpd/ftpd.c
==
--- head/libexec/ftpd/ftpd.cFri Oct  6 13:43:16 2017(r324363)
+++ head/libexec/ftpd/ftpd.cFri Oct  6 13:46:05 2017(r324364)
@@ -430,6 +430,10 @@ main(int argc, char *argv[], char **envp)
}
}
 
+   /* handle filesize limit gracefully */
+   sa.sa_handler = SIG_IGN;
+   (void)sigaction(SIGXFSZ, , NULL);
+
if (daemon_mode) {
int *ctl_sock, fd, maxfd = -1, nfds, i;
fd_set defreadfds, readfds;
@@ -1196,14 +1200,14 @@ end_login(void)
 #endif
 
(void) seteuid(0);
-   if (logged_in && dowtmp)
-   ftpd_logwtmp(wtmpid, NULL, NULL);
-   pw = NULL;
 #ifdef LOGIN_CAP
setusercontext(NULL, getpwuid(0), 0, LOGIN_SETALL & ~(LOGIN_SETLOGIN |
   LOGIN_SETUSER | LOGIN_SETGROUP | LOGIN_SETPATH |
   LOGIN_SETENV));
 #endif
+   if (logged_in && dowtmp)
+   ftpd_logwtmp(wtmpid, NULL, NULL);
+   pw = NULL;
 #ifdef USE_PAM
if (pamh) {
if ((e = pam_setcred(pamh, PAM_DELETE_CRED)) != PAM_SUCCESS)
@@ -1478,7 +1482,7 @@ skip:
}
}
setusercontext(lc, pw, 0, LOGIN_SETALL &
-  ~(LOGIN_SETUSER | LOGIN_SETPATH | LOGIN_SETENV));
+  ~(LOGIN_SETRESOURCES | LOGIN_SETUSER | LOGIN_SETPATH | 
LOGIN_SETENV));
 #else
setlogin(pw->pw_name);
(void) initgroups(pw->pw_name, pw->pw_gid);
@@ -1520,6 +1524,10 @@ skip:
(struct sockaddr *)_addr);
logged_in = 1;
 
+#ifdef LOGIN_CAP
+   setusercontext(lc, pw, 0, LOGIN_SETRESOURCES);
+#endif
+
if (guest && stats && statfd < 0)
 #ifdef VIRTUAL_HOSTING
statfd = open(thishost->statfile, O_WRONLY|O_APPEND);
@@ -2770,6 +2778,11 @@ dologout(int status)
 
if (logged_in && dowtmp) {
(void) seteuid(0);
+#ifdef LOGIN_CAP
+   setusercontext(NULL, getpwuid(0), 0, LOGIN_SETALL & 
~(LOGIN_SETLOGIN |
+  LOGIN_SETUSER | LOGIN_SETGROUP | LOGIN_SETPATH |
+  LOGIN_SETENV));
+#endif
ftpd_logwtmp(wtmpid, NULL, NULL);
}
/* beware of flushing buffers after a SIGPIPE */
___
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: r324363 - head/sys/arm/include

2017-10-06 Thread Warner Losh
Author: imp
Date: Fri Oct  6 13:43:16 2017
New Revision: 324363
URL: https://svnweb.freebsd.org/changeset/base/324363

Log:
  Oversight on armv7 bulk commit: Make MACHINE_ARCH be armv7 for new
  enough processors. This isn't ideal, because one could still compile
  MACHINE_ARCH armv6, but with armv7 options enabled. We don't normally
  do that, and it's a bit of an edge case so accept the less than ideal
  solution here in the absence of something better.
  
  Reported by: strejda@
  Sponsored by: Netflix

Modified:
  head/sys/arm/include/param.h

Modified: head/sys/arm/include/param.h
==
--- head/sys/arm/include/param.hFri Oct  6 12:31:55 2017
(r324362)
+++ head/sys/arm/include/param.hFri Oct  6 13:43:16 2017
(r324363)
@@ -52,10 +52,12 @@
 
 #define __PCI_REROUTE_INTERRUPT
 
-#if __ARM_ARCH >= 6
-#define_V6_SUFFIX "v6"
+#if __ARM_ARCH >= 7
+#define_V_SUFFIX "v7"
+#elif __ARM_ARCH >= 6
+#define_V_SUFFIX "v6"
 #else
-#define_V6_SUFFIX ""
+#define_V_SUFFIX ""
 #endif
 
 #ifdef __ARM_BIG_ENDIAN
@@ -68,7 +70,7 @@
 #defineMACHINE "arm"
 #endif
 #ifndef MACHINE_ARCH
-#defineMACHINE_ARCH"arm" _V6_SUFFIX _EB_SUFFIX
+#defineMACHINE_ARCH"arm" _V_SUFFIX _EB_SUFFIX
 #endif
 
 #if defined(SMP) || defined(KLD_MODULE)
___
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: r324362 - head/contrib/mdocml

2017-10-06 Thread Baptiste Daroussin
Author: bapt
Date: Fri Oct  6 12:31:55 2017
New Revision: 324362
URL: https://svnweb.freebsd.org/changeset/base/324362

Log:
  Import mandoc 1.14.3
  
  MFC after:1 week

Modified:
  head/contrib/mdocml/Makefile
  head/contrib/mdocml/NEWS
  head/contrib/mdocml/man_term.c
  head/contrib/mdocml/mansearch.c
  head/contrib/mdocml/mdoc_validate.c
  head/contrib/mdocml/tbl_html.c
  head/contrib/mdocml/tbl_term.c
Directory Properties:
  head/contrib/mdocml/   (props changed)

Modified: head/contrib/mdocml/Makefile
==
--- head/contrib/mdocml/MakefileFri Oct  6 12:30:54 2017
(r324361)
+++ head/contrib/mdocml/MakefileFri Oct  6 12:31:55 2017
(r324362)
@@ -15,7 +15,7 @@
 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-VERSION = 1.14.2
+VERSION = 1.14.3
 
 # === LIST OF FILES 
 

Modified: head/contrib/mdocml/NEWS
==
--- head/contrib/mdocml/NEWSFri Oct  6 12:30:54 2017(r324361)
+++ head/contrib/mdocml/NEWSFri Oct  6 12:31:55 2017(r324362)
@@ -2,6 +2,21 @@ $Id: NEWS,v 1.26 2017/07/28 14:57:56 schwarze Exp $
 
 This file lists the most important changes in the mandoc.bsd.lv distribution.
 
+Changes in version 1.14.3, released on August 5, 2017
+
+--- BUG FIXES ---
+ * man(7): Do not crash with out-of-bounds read access to a constant
+   array if .sp or a blank line immediately precedes .SS or .SH.
+ * mdoc(7): Do not crash with out-of-bounds read access to a constant
+   array if .sp or a blank line precede the first .Sh macro.
+ * tbl(7): Ignore explicitly specified negative column widths rather than
+   wrapping around to huge numbers and risking memory exhaustion.
+ * man(1): No longer use names that only occur in the SYNOPSIS section.
+   Gets rid of some surprising behaviour and bogus warnings.
+--- THANKS TO ---
+   Leah Neukirchen (Void Linux), Markus Waldeck (Debian),
+   Peter Bui (nd.edu), and Yuri Pankov (illumos) for bug reports.
+
 Changes in version 1.14.2, released on July 28, 2017
 
 --- MAJOR NEW FEATURES ---

Modified: head/contrib/mdocml/man_term.c
==
--- head/contrib/mdocml/man_term.c  Fri Oct  6 12:30:54 2017
(r324361)
+++ head/contrib/mdocml/man_term.c  Fri Oct  6 12:31:55 2017
(r324362)
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.208 2017/06/25 11:42:02 schwarze Exp $ */
+/* $Id: man_term.c,v 1.209 2017/07/31 15:19:06 schwarze Exp $ */
 /*
  * Copyright (c) 2008-2012 Kristaps Dzonsons 
  * Copyright (c) 2010-2015, 2017 Ingo Schwarze 
@@ -673,7 +673,7 @@ pre_SS(DECL_ARGS)
 
do {
n = n->prev;
-   } while (n != NULL && n->tok != TOKEN_NONE &&
+   } while (n != NULL && n->tok >= MAN_TH &&
termacts[n->tok].flags & MAN_NOTEXT);
if (n == NULL || (n->tok == MAN_SS && n->body->child == NULL))
break;
@@ -735,7 +735,7 @@ pre_SH(DECL_ARGS)
 
do {
n = n->prev;
-   } while (n != NULL && n->tok != TOKEN_NONE &&
+   } while (n != NULL && n->tok >= MAN_TH &&
termacts[n->tok].flags & MAN_NOTEXT);
if (n == NULL || (n->tok == MAN_SH && n->body->child == NULL))
break;

Modified: head/contrib/mdocml/mansearch.c
==
--- head/contrib/mdocml/mansearch.c Fri Oct  6 12:30:54 2017
(r324361)
+++ head/contrib/mdocml/mansearch.c Fri Oct  6 12:31:55 2017
(r324362)
@@ -1,4 +1,4 @@
-/* $OpenBSD: mansearch.c,v 1.50 2016/07/09 15:23:36 schwarze Exp $ */
+/* $Id: mansearch.c,v 1.76 2017/08/02 13:29:04 schwarze Exp $ */
 /*
  * Copyright (c) 2012 Kristaps Dzonsons 
  * Copyright (c) 2013-2017 Ingo Schwarze 
@@ -171,7 +171,9 @@ mansearch(const struct mansearch *search,
page = dbm_page_get(rp->page);
 
if (lstmatch(search->sec, page->sect) == 0 ||
-   lstmatch(search->arch, page->arch) == 0)
+   lstmatch(search->arch, page->arch) == 0 ||
+   (search->argmode == ARG_NAME &&
+rp->bits <= (int32_t)(NAME_SYN & NAME_MASK)))
continue;
 
if (res == NULL) {
@@ -452,14 +454,28 @@ lstlen(const char *cp, size_t sep)
 {
size_t   sz;
 
-   for (sz = 0;; sz++) {
-   if (cp[0] == '\0') {
-   if (cp[1] == '\0')
-  

svn commit: r324361 - in head/contrib: ctfdump mdocml

2017-10-06 Thread Baptiste Daroussin
Author: bapt
Date: Fri Oct  6 12:30:54 2017
New Revision: 324361
URL: https://svnweb.freebsd.org/changeset/base/324361

Log:
  Revert r324358, some cruft when in with it, it will be
  properly reimported in another commit

Deleted:
  head/contrib/ctfdump/
Modified:
  head/contrib/mdocml/Makefile
  head/contrib/mdocml/NEWS
  head/contrib/mdocml/man_term.c
  head/contrib/mdocml/mansearch.c
  head/contrib/mdocml/mdoc_validate.c
  head/contrib/mdocml/tbl_html.c
  head/contrib/mdocml/tbl_term.c
Directory Properties:
  head/contrib/mdocml/   (props changed)

Modified: head/contrib/mdocml/Makefile
==
--- head/contrib/mdocml/MakefileFri Oct  6 12:21:46 2017
(r324360)
+++ head/contrib/mdocml/MakefileFri Oct  6 12:30:54 2017
(r324361)
@@ -15,7 +15,7 @@
 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-VERSION = 1.14.3
+VERSION = 1.14.2
 
 # === LIST OF FILES 
 

Modified: head/contrib/mdocml/NEWS
==
--- head/contrib/mdocml/NEWSFri Oct  6 12:21:46 2017(r324360)
+++ head/contrib/mdocml/NEWSFri Oct  6 12:30:54 2017(r324361)
@@ -2,21 +2,6 @@ $Id: NEWS,v 1.26 2017/07/28 14:57:56 schwarze Exp $
 
 This file lists the most important changes in the mandoc.bsd.lv distribution.
 
-Changes in version 1.14.3, released on August 5, 2017
-
---- BUG FIXES ---
- * man(7): Do not crash with out-of-bounds read access to a constant
-   array if .sp or a blank line immediately precedes .SS or .SH.
- * mdoc(7): Do not crash with out-of-bounds read access to a constant
-   array if .sp or a blank line precede the first .Sh macro.
- * tbl(7): Ignore explicitly specified negative column widths rather than
-   wrapping around to huge numbers and risking memory exhaustion.
- * man(1): No longer use names that only occur in the SYNOPSIS section.
-   Gets rid of some surprising behaviour and bogus warnings.
---- THANKS TO ---
-   Leah Neukirchen (Void Linux), Markus Waldeck (Debian),
-   Peter Bui (nd.edu), and Yuri Pankov (illumos) for bug reports.
-
 Changes in version 1.14.2, released on July 28, 2017
 
 --- MAJOR NEW FEATURES ---

Modified: head/contrib/mdocml/man_term.c
==
--- head/contrib/mdocml/man_term.c  Fri Oct  6 12:21:46 2017
(r324360)
+++ head/contrib/mdocml/man_term.c  Fri Oct  6 12:30:54 2017
(r324361)
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.209 2017/07/31 15:19:06 schwarze Exp $ */
+/* $Id: man_term.c,v 1.208 2017/06/25 11:42:02 schwarze Exp $ */
 /*
  * Copyright (c) 2008-2012 Kristaps Dzonsons 
  * Copyright (c) 2010-2015, 2017 Ingo Schwarze 
@@ -673,7 +673,7 @@ pre_SS(DECL_ARGS)
 
do {
n = n->prev;
-   } while (n != NULL && n->tok >= MAN_TH &&
+   } while (n != NULL && n->tok != TOKEN_NONE &&
termacts[n->tok].flags & MAN_NOTEXT);
if (n == NULL || (n->tok == MAN_SS && n->body->child == NULL))
break;
@@ -735,7 +735,7 @@ pre_SH(DECL_ARGS)
 
do {
n = n->prev;
-   } while (n != NULL && n->tok >= MAN_TH &&
+   } while (n != NULL && n->tok != TOKEN_NONE &&
termacts[n->tok].flags & MAN_NOTEXT);
if (n == NULL || (n->tok == MAN_SH && n->body->child == NULL))
break;

Modified: head/contrib/mdocml/mansearch.c
==
--- head/contrib/mdocml/mansearch.c Fri Oct  6 12:21:46 2017
(r324360)
+++ head/contrib/mdocml/mansearch.c Fri Oct  6 12:30:54 2017
(r324361)
@@ -1,4 +1,4 @@
-/* $Id: mansearch.c,v 1.76 2017/08/02 13:29:04 schwarze Exp $ */
+/* $OpenBSD: mansearch.c,v 1.50 2016/07/09 15:23:36 schwarze Exp $ */
 /*
  * Copyright (c) 2012 Kristaps Dzonsons 
  * Copyright (c) 2013-2017 Ingo Schwarze 
@@ -171,9 +171,7 @@ mansearch(const struct mansearch *search,
page = dbm_page_get(rp->page);
 
if (lstmatch(search->sec, page->sect) == 0 ||
-   lstmatch(search->arch, page->arch) == 0 ||
-   (search->argmode == ARG_NAME &&
-rp->bits <= (int32_t)(NAME_SYN & NAME_MASK)))
+   lstmatch(search->arch, page->arch) == 0)
continue;
 
if (res == NULL) {
@@ -454,28 +452,14 @@ lstlen(const char *cp, size_t sep)
 {
size_t   sz;
 
-   for (sz = 0; *cp != '\0'; 

svn commit: r324360 - in head/sys/boot/efi: include libefi loader

2017-10-06 Thread Warner Losh
Author: imp
Date: Fri Oct  6 12:21:46 2017
New Revision: 324360
URL: https://svnweb.freebsd.org/changeset/base/324360

Log:
  Encapsulate  ZFS preferences into efi_zfs_is_preferred
  
  Move the retrieval of the image information into loader's main instead
  of doing it in efizfs.c
  
  Differential Revision: https://reviews.freebsd.org/D12564
  Submitted by: Eric McCorkle

Modified:
  head/sys/boot/efi/include/efizfs.h
  head/sys/boot/efi/libefi/efizfs.c
  head/sys/boot/efi/loader/main.c

Modified: head/sys/boot/efi/include/efizfs.h
==
--- head/sys/boot/efi/include/efizfs.h  Fri Oct  6 12:20:24 2017
(r324359)
+++ head/sys/boot/efi/include/efizfs.h  Fri Oct  6 12:21:46 2017
(r324360)
@@ -27,6 +27,7 @@
  */
 
 #include 
+#include 
 
 #ifndef _EFIZFS_H_
 #define _EFIZFS_H_
@@ -45,6 +46,7 @@ extern uint64_t pool_guid;
 
 extern void efi_zfs_probe(void);
 extern zfsinfo_list_t *efizfs_get_zfsinfo_list(void);
+extern bool efi_zfs_is_preferred(EFI_HANDLE *h);
 extern EFI_HANDLE efizfs_get_handle_by_guid(uint64_t);
 
 #endif

Modified: head/sys/boot/efi/libefi/efizfs.c
==
--- head/sys/boot/efi/libefi/efizfs.c   Fri Oct  6 12:20:24 2017
(r324359)
+++ head/sys/boot/efi/libefi/efizfs.c   Fri Oct  6 12:21:46 2017
(r324360)
@@ -81,12 +81,9 @@ efi_zfs_probe(void)
 {
pdinfo_list_t *hdi;
pdinfo_t *hd, *pd = NULL;
-   EFI_GUID imgid = LOADED_IMAGE_PROTOCOL;
-   EFI_LOADED_IMAGE *img;
char devname[SPECNAMELEN + 1];
 uint64_t guid;
 
-   BS->HandleProtocol(IH, , (VOID**));
hdi = efiblk_get_pdinfo_list(_hddev);
STAILQ_INIT();
 
@@ -105,7 +102,7 @@ efi_zfs_probe(void)
 if (zfs_probe_dev(devname, ) == 0) {
 insert_zfs(pd->pd_handle, guid);
 
-if (pd->pd_handle == img->DeviceHandle)
+if (efi_zfs_is_preferred(pd->pd_handle))
 pool_guid = guid;
 }
 

Modified: head/sys/boot/efi/loader/main.c
==
--- head/sys/boot/efi/loader/main.c Fri Oct  6 12:20:24 2017
(r324359)
+++ head/sys/boot/efi/loader/main.c Fri Oct  6 12:21:46 2017
(r324360)
@@ -72,6 +72,15 @@ EFI_GUID debugimg = DEBUG_IMAGE_INFO_TABLE_GUID;
 EFI_GUID fdtdtb = FDT_TABLE_GUID;
 EFI_GUID inputid = SIMPLE_TEXT_INPUT_PROTOCOL;
 
+static EFI_LOADED_IMAGE *img;
+
+bool
+efi_zfs_is_preferred(EFI_HANDLE *h)
+{
+return (h == img->DeviceHandle);
+}
+
+
 static int
 has_keyboard(void)
 {
@@ -300,7 +309,6 @@ EFI_STATUS
 main(int argc, CHAR16 *argv[])
 {
char var[128];
-   EFI_LOADED_IMAGE *img;
EFI_GUID *guid;
int i, j, vargood, howto;
UINTN k;
@@ -319,6 +327,9 @@ main(int argc, CHAR16 *argv[])
archsw.arch_zfs_probe = efi_zfs_probe;
 #endif
 
+/* Get our loaded image protocol interface structure. */
+   BS->HandleProtocol(IH, , (VOID**));
+
/* Init the time source */
efi_time_init();
 
@@ -445,9 +456,6 @@ main(int argc, CHAR16 *argv[])
for (i = 0; devsw[i] != NULL; i++)
if (devsw[i]->dv_init != NULL)
(devsw[i]->dv_init)();
-
-   /* Get our loaded image protocol interface structure. */
-   BS->HandleProtocol(IH, , (VOID**));
 
printf("Command line arguments:");
for (i = 0; i < argc; i++)
___
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: r324359 - in head/sys/boot/efi: include libefi

2017-10-06 Thread Warner Losh
Author: imp
Date: Fri Oct  6 12:20:24 2017
New Revision: 324359
URL: https://svnweb.freebsd.org/changeset/base/324359

Log:
  Add efi_devpath_is_prefix
  
  efi_devpath_is_prefix determines if a path matches a passed-in prefix.
  
  Differential Revision: https://reviews.freebsd.org/D12564
  Submitted by: Eric McCorkle

Modified:
  head/sys/boot/efi/include/efilib.h
  head/sys/boot/efi/libefi/devpath.c

Modified: head/sys/boot/efi/include/efilib.h
==
--- head/sys/boot/efi/include/efilib.h  Fri Oct  6 11:48:09 2017
(r324358)
+++ head/sys/boot/efi/include/efilib.h  Fri Oct  6 12:20:24 2017
(r324359)
@@ -82,6 +82,7 @@ EFI_HANDLE efi_devpath_handle(EFI_DEVICE_PATH *);
 EFI_DEVICE_PATH *efi_devpath_last_node(EFI_DEVICE_PATH *);
 EFI_DEVICE_PATH *efi_devpath_trim(EFI_DEVICE_PATH *);
 bool efi_devpath_match(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *);
+int efi_devpath_is_prefix(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *);
 CHAR16 *efi_devpath_name(EFI_DEVICE_PATH *);
 void efi_free_devpath_name(CHAR16 *);
 

Modified: head/sys/boot/efi/libefi/devpath.c
==
--- head/sys/boot/efi/libefi/devpath.c  Fri Oct  6 11:48:09 2017
(r324358)
+++ head/sys/boot/efi/libefi/devpath.c  Fri Oct  6 12:20:24 2017
(r324359)
@@ -166,3 +166,32 @@ efi_devpath_match(EFI_DEVICE_PATH *devpath1, EFI_DEVIC
}
return (true);
 }
+
+int
+efi_devpath_is_prefix(EFI_DEVICE_PATH *prefix, EFI_DEVICE_PATH *path)
+{
+   int len;
+
+   if (prefix == NULL || path == NULL)
+   return (0);
+
+   while (1) {
+   if (IsDevicePathEnd(prefix))
+   break;
+
+   if (DevicePathType(prefix) != DevicePathType(path) ||
+   DevicePathSubType(prefix) != DevicePathSubType(path))
+   return (0);
+
+   len = DevicePathNodeLength(prefix);
+   if (len != DevicePathNodeLength(path))
+   return (0);
+
+   if (memcmp(prefix, path, (size_t)len) != 0)
+   return (0);
+
+   prefix = NextDevicePathNode(prefix);
+   path = NextDevicePathNode(path);
+   }
+   return (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: r324358 - in head/contrib: ctfdump mdocml

2017-10-06 Thread Baptiste Daroussin
Author: bapt
Date: Fri Oct  6 11:48:09 2017
New Revision: 324358
URL: https://svnweb.freebsd.org/changeset/base/324358

Log:
  Import 1.14.3
  
  MFC after:1 week

Added:
  head/contrib/ctfdump/
 - copied from r323072, vendor/ctfdump/dist/
Modified:
  head/contrib/mdocml/Makefile
  head/contrib/mdocml/NEWS
  head/contrib/mdocml/man_term.c
  head/contrib/mdocml/mansearch.c
  head/contrib/mdocml/mdoc_validate.c
  head/contrib/mdocml/tbl_html.c
  head/contrib/mdocml/tbl_term.c
Directory Properties:
  head/contrib/mdocml/   (props changed)

Modified: head/contrib/mdocml/Makefile
==
--- head/contrib/mdocml/MakefileFri Oct  6 11:46:37 2017
(r324357)
+++ head/contrib/mdocml/MakefileFri Oct  6 11:48:09 2017
(r324358)
@@ -15,7 +15,7 @@
 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-VERSION = 1.14.2
+VERSION = 1.14.3
 
 # === LIST OF FILES 
 

Modified: head/contrib/mdocml/NEWS
==
--- head/contrib/mdocml/NEWSFri Oct  6 11:46:37 2017(r324357)
+++ head/contrib/mdocml/NEWSFri Oct  6 11:48:09 2017(r324358)
@@ -2,6 +2,21 @@ $Id: NEWS,v 1.26 2017/07/28 14:57:56 schwarze Exp $
 
 This file lists the most important changes in the mandoc.bsd.lv distribution.
 
+Changes in version 1.14.3, released on August 5, 2017
+
+--- BUG FIXES ---
+ * man(7): Do not crash with out-of-bounds read access to a constant
+   array if .sp or a blank line immediately precedes .SS or .SH.
+ * mdoc(7): Do not crash with out-of-bounds read access to a constant
+   array if .sp or a blank line precede the first .Sh macro.
+ * tbl(7): Ignore explicitly specified negative column widths rather than
+   wrapping around to huge numbers and risking memory exhaustion.
+ * man(1): No longer use names that only occur in the SYNOPSIS section.
+   Gets rid of some surprising behaviour and bogus warnings.
+--- THANKS TO ---
+   Leah Neukirchen (Void Linux), Markus Waldeck (Debian),
+   Peter Bui (nd.edu), and Yuri Pankov (illumos) for bug reports.
+
 Changes in version 1.14.2, released on July 28, 2017
 
 --- MAJOR NEW FEATURES ---

Modified: head/contrib/mdocml/man_term.c
==
--- head/contrib/mdocml/man_term.c  Fri Oct  6 11:46:37 2017
(r324357)
+++ head/contrib/mdocml/man_term.c  Fri Oct  6 11:48:09 2017
(r324358)
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.208 2017/06/25 11:42:02 schwarze Exp $ */
+/* $Id: man_term.c,v 1.209 2017/07/31 15:19:06 schwarze Exp $ */
 /*
  * Copyright (c) 2008-2012 Kristaps Dzonsons 
  * Copyright (c) 2010-2015, 2017 Ingo Schwarze 
@@ -673,7 +673,7 @@ pre_SS(DECL_ARGS)
 
do {
n = n->prev;
-   } while (n != NULL && n->tok != TOKEN_NONE &&
+   } while (n != NULL && n->tok >= MAN_TH &&
termacts[n->tok].flags & MAN_NOTEXT);
if (n == NULL || (n->tok == MAN_SS && n->body->child == NULL))
break;
@@ -735,7 +735,7 @@ pre_SH(DECL_ARGS)
 
do {
n = n->prev;
-   } while (n != NULL && n->tok != TOKEN_NONE &&
+   } while (n != NULL && n->tok >= MAN_TH &&
termacts[n->tok].flags & MAN_NOTEXT);
if (n == NULL || (n->tok == MAN_SH && n->body->child == NULL))
break;

Modified: head/contrib/mdocml/mansearch.c
==
--- head/contrib/mdocml/mansearch.c Fri Oct  6 11:46:37 2017
(r324357)
+++ head/contrib/mdocml/mansearch.c Fri Oct  6 11:48:09 2017
(r324358)
@@ -1,4 +1,4 @@
-/* $OpenBSD: mansearch.c,v 1.50 2016/07/09 15:23:36 schwarze Exp $ */
+/* $Id: mansearch.c,v 1.76 2017/08/02 13:29:04 schwarze Exp $ */
 /*
  * Copyright (c) 2012 Kristaps Dzonsons 
  * Copyright (c) 2013-2017 Ingo Schwarze 
@@ -171,7 +171,9 @@ mansearch(const struct mansearch *search,
page = dbm_page_get(rp->page);
 
if (lstmatch(search->sec, page->sect) == 0 ||
-   lstmatch(search->arch, page->arch) == 0)
+   lstmatch(search->arch, page->arch) == 0 ||
+   (search->argmode == ARG_NAME &&
+rp->bits <= (int32_t)(NAME_SYN & NAME_MASK)))
continue;
 
if (res == NULL) {
@@ -452,14 +454,28 @@ lstlen(const char *cp, size_t sep)
 {
size_t   sz;
 
-   for (sz = 0;; sz++) {
- 

svn commit: r324357 - vendor/mdocml/1.14.3

2017-10-06 Thread Baptiste Daroussin
Author: bapt
Date: Fri Oct  6 11:46:37 2017
New Revision: 324357
URL: https://svnweb.freebsd.org/changeset/base/324357

Log:
  Tag import of mandoc 1.14.3

Added:
  vendor/mdocml/1.14.3/
 - copied from r324355, vendor/mdocml/dist/
Replaced:
  vendor/mdocml/1.14.3/Makefile
 - copied unchanged from r324356, vendor/mdocml/dist/Makefile
  vendor/mdocml/1.14.3/NEWS
 - copied unchanged from r324356, vendor/mdocml/dist/NEWS
  vendor/mdocml/1.14.3/man_term.c
 - copied unchanged from r324356, vendor/mdocml/dist/man_term.c
  vendor/mdocml/1.14.3/mansearch.c
 - copied unchanged from r324356, vendor/mdocml/dist/mansearch.c
  vendor/mdocml/1.14.3/mdoc_validate.c
 - copied unchanged from r324356, vendor/mdocml/dist/mdoc_validate.c
  vendor/mdocml/1.14.3/tbl_html.c
 - copied unchanged from r324356, vendor/mdocml/dist/tbl_html.c
  vendor/mdocml/1.14.3/tbl_term.c
 - copied unchanged from r324356, vendor/mdocml/dist/tbl_term.c

Copied: vendor/mdocml/1.14.3/Makefile (from r324356, 
vendor/mdocml/dist/Makefile)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/mdocml/1.14.3/Makefile   Fri Oct  6 11:46:37 2017
(r324357, copy of r324356, vendor/mdocml/dist/Makefile)
@@ -0,0 +1,573 @@
+# $Id: Makefile,v 1.516 2017/07/20 16:24:53 schwarze Exp $
+#
+# Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons 
+# Copyright (c) 2011, 2013-2017 Ingo Schwarze 
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+VERSION = 1.14.3
+
+# === LIST OF FILES 
+
+TESTSRCS= test-be32toh.c \
+  test-cmsg.c \
+  test-dirent-namlen.c \
+  test-EFTYPE.c \
+  test-err.c \
+  test-fts.c \
+  test-getline.c \
+  test-getsubopt.c \
+  test-isblank.c \
+  test-mkdtemp.c \
+  test-nanosleep.c \
+  test-ntohl.c \
+  test-O_DIRECTORY.c \
+  test-ohash.c \
+  test-PATH_MAX.c \
+  test-pledge.c \
+  test-progname.c \
+  test-recvmsg.c \
+  test-reallocarray.c \
+  test-recallocarray.c \
+  test-rewb-bsd.c \
+  test-rewb-sysv.c \
+  test-sandbox_init.c \
+  test-strcasestr.c \
+  test-stringlist.c \
+  test-strlcat.c \
+  test-strlcpy.c \
+  test-strptime.c \
+  test-strsep.c \
+  test-strtonum.c \
+  test-vasprintf.c \
+  test-wchar.c
+
+SRCS= att.c \
+  catman.c \
+  cgi.c \
+  chars.c \
+  compat_err.c \
+  compat_fts.c \
+  compat_getline.c \
+  compat_getsubopt.c \
+  compat_isblank.c \
+  compat_mkdtemp.c \
+  compat_ohash.c \
+  compat_progname.c \
+  compat_reallocarray.c \
+  compat_recallocarray.c \
+  compat_strcasestr.c \
+  compat_stringlist.c \
+  compat_strlcat.c \
+  compat_strlcpy.c \
+  compat_strsep.c \
+  compat_strtonum.c \
+  compat_vasprintf.c \
+  dba.c \
+  dba_array.c \
+  dba_read.c \
+  dba_write.c \
+  dbm.c \
+  dbm_map.c \
+  demandoc.c \
+  eqn.c \
+  eqn_html.c \
+  eqn_term.c \
+  html.c \
+  lib.c \
+  main.c \
+  man.c \
+  man_html.c \
+  man_macro.c \
+  man_term.c \
+  man_validate.c \
+  mandoc.c \
+  mandoc_aux.c \
+  mandoc_ohash.c \
+  mandoc_xr.c \
+

svn commit: r324356 - vendor/mdocml/dist

2017-10-06 Thread Baptiste Daroussin
Author: bapt
Date: Fri Oct  6 11:45:56 2017
New Revision: 324356
URL: https://svnweb.freebsd.org/changeset/base/324356

Log:
  Import mandoc 1.14.3

Modified:
  vendor/mdocml/dist/Makefile
  vendor/mdocml/dist/NEWS
  vendor/mdocml/dist/man_term.c
  vendor/mdocml/dist/mansearch.c
  vendor/mdocml/dist/mdoc_validate.c
  vendor/mdocml/dist/tbl_html.c
  vendor/mdocml/dist/tbl_term.c

Modified: vendor/mdocml/dist/Makefile
==
--- vendor/mdocml/dist/Makefile Fri Oct  6 10:17:50 2017(r324355)
+++ vendor/mdocml/dist/Makefile Fri Oct  6 11:45:56 2017(r324356)
@@ -15,7 +15,7 @@
 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-VERSION = 1.14.2
+VERSION = 1.14.3
 
 # === LIST OF FILES 
 

Modified: vendor/mdocml/dist/NEWS
==
--- vendor/mdocml/dist/NEWS Fri Oct  6 10:17:50 2017(r324355)
+++ vendor/mdocml/dist/NEWS Fri Oct  6 11:45:56 2017(r324356)
@@ -2,6 +2,21 @@ $Id: NEWS,v 1.26 2017/07/28 14:57:56 schwarze Exp $
 
 This file lists the most important changes in the mandoc.bsd.lv distribution.
 
+Changes in version 1.14.3, released on August 5, 2017
+
+--- BUG FIXES ---
+ * man(7): Do not crash with out-of-bounds read access to a constant
+   array if .sp or a blank line immediately precedes .SS or .SH.
+ * mdoc(7): Do not crash with out-of-bounds read access to a constant
+   array if .sp or a blank line precede the first .Sh macro.
+ * tbl(7): Ignore explicitly specified negative column widths rather than
+   wrapping around to huge numbers and risking memory exhaustion.
+ * man(1): No longer use names that only occur in the SYNOPSIS section.
+   Gets rid of some surprising behaviour and bogus warnings.
+--- THANKS TO ---
+   Leah Neukirchen (Void Linux), Markus Waldeck (Debian),
+   Peter Bui (nd.edu), and Yuri Pankov (illumos) for bug reports.
+
 Changes in version 1.14.2, released on July 28, 2017
 
 --- MAJOR NEW FEATURES ---

Modified: vendor/mdocml/dist/man_term.c
==
--- vendor/mdocml/dist/man_term.c   Fri Oct  6 10:17:50 2017
(r324355)
+++ vendor/mdocml/dist/man_term.c   Fri Oct  6 11:45:56 2017
(r324356)
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.208 2017/06/25 11:42:02 schwarze Exp $ */
+/* $Id: man_term.c,v 1.209 2017/07/31 15:19:06 schwarze Exp $ */
 /*
  * Copyright (c) 2008-2012 Kristaps Dzonsons 
  * Copyright (c) 2010-2015, 2017 Ingo Schwarze 
@@ -673,7 +673,7 @@ pre_SS(DECL_ARGS)
 
do {
n = n->prev;
-   } while (n != NULL && n->tok != TOKEN_NONE &&
+   } while (n != NULL && n->tok >= MAN_TH &&
termacts[n->tok].flags & MAN_NOTEXT);
if (n == NULL || (n->tok == MAN_SS && n->body->child == NULL))
break;
@@ -735,7 +735,7 @@ pre_SH(DECL_ARGS)
 
do {
n = n->prev;
-   } while (n != NULL && n->tok != TOKEN_NONE &&
+   } while (n != NULL && n->tok >= MAN_TH &&
termacts[n->tok].flags & MAN_NOTEXT);
if (n == NULL || (n->tok == MAN_SH && n->body->child == NULL))
break;

Modified: vendor/mdocml/dist/mansearch.c
==
--- vendor/mdocml/dist/mansearch.c  Fri Oct  6 10:17:50 2017
(r324355)
+++ vendor/mdocml/dist/mansearch.c  Fri Oct  6 11:45:56 2017
(r324356)
@@ -1,4 +1,4 @@
-/* $OpenBSD: mansearch.c,v 1.50 2016/07/09 15:23:36 schwarze Exp $ */
+/* $Id: mansearch.c,v 1.76 2017/08/02 13:29:04 schwarze Exp $ */
 /*
  * Copyright (c) 2012 Kristaps Dzonsons 
  * Copyright (c) 2013-2017 Ingo Schwarze 
@@ -171,7 +171,9 @@ mansearch(const struct mansearch *search,
page = dbm_page_get(rp->page);
 
if (lstmatch(search->sec, page->sect) == 0 ||
-   lstmatch(search->arch, page->arch) == 0)
+   lstmatch(search->arch, page->arch) == 0 ||
+   (search->argmode == ARG_NAME &&
+rp->bits <= (int32_t)(NAME_SYN & NAME_MASK)))
continue;
 
if (res == NULL) {
@@ -452,14 +454,28 @@ lstlen(const char *cp, size_t sep)
 {
size_t   sz;
 
-   for (sz = 0;; sz++) {
-   if (cp[0] == '\0') {
-   if (cp[1] == '\0')
-   break;
-   sz += sep - 1;
-   } else if (cp[0] < ' ')
-  

Re: svn commit: r324341 - in head/sys: arm/allwinner arm/altera/socfpga arm/amlogic/aml8726 arm/annapurna/alpine arm/broadcom/bcm2835 arm/conf arm/freescale/imx arm/freescale/vybrid arm/mv arm/mv/arma

2017-10-06 Thread Warner Losh
On Fri, Oct 6, 2017 at 1:16 AM, Andrew Turner  wrote:

>
> > On 6 Oct 2017, at 00:01, Warner Losh  wrote:
> >
> > Author: imp
> > Date: Thu Oct  5 23:01:50 2017
> > New Revision: 324341
> > URL: https://svnweb.freebsd.org/changeset/base/324341
> >
> > Log:
> >  Tag all armv7 kernels as such in their machine config line.
> >
> >  Transition all boards that support arm cortex CPUs to armv7. This
> >  leaves two armv6 kernels in the tree. RPI-B, which uses the BCM2835
> >  which has a ARM1176 core, and VERSATILEPB, which is a qemu board setup
> >  around the time RPI-B went in. Copy std.armv6 to std.armv7, even
> >  though that duplicates a lot of stuff. More work needs to be done to
> >  sort out the duplication.
> >
> >  Differential Revision: https://reviews.freebsd.org/D12027
> >
> > Added:
> >  head/sys/arm/conf/VIRT
> > - copied, changed from r324340, head/sys/arm/conf/ARMADAXP
>
> Did you mean to add VIRT?
>

No. I think that was a mismerge along the way.

Warner
___
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: r324355 - head/sys/i386/i386

2017-10-06 Thread Konstantin Belousov
Author: kib
Date: Fri Oct  6 10:17:50 2017
New Revision: 324355
URL: https://svnweb.freebsd.org/changeset/base/324355

Log:
  Remove unneeded cast.
  
  Reviewed by:  bde
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/i386/i386/sys_machdep.c

Modified: head/sys/i386/i386/sys_machdep.c
==
--- head/sys/i386/i386/sys_machdep.cFri Oct  6 10:16:57 2017
(r324354)
+++ head/sys/i386/i386/sys_machdep.cFri Oct  6 10:17:50 2017
(r324355)
@@ -172,8 +172,7 @@ sysarch(struct thread *td, struct sysarch_args *uap)
break;
case I386_SET_LDT:
if (kargs.largs.descs != NULL) {
-   lp = (union descriptor *)malloc(
-   kargs.largs.num * sizeof(union descriptor),
+   lp = malloc(kargs.largs.num * sizeof(union descriptor),
M_TEMP, M_WAITOK);
error = copyin(kargs.largs.descs, lp,
kargs.largs.num * sizeof(union descriptor));
___
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: r324354 - head/sys/i386/i386

2017-10-06 Thread Konstantin Belousov
Author: kib
Date: Fri Oct  6 10:16:57 2017
New Revision: 324354
URL: https://svnweb.freebsd.org/changeset/base/324354

Log:
  Style.
  
  Reviewed by:  bde
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/i386/i386/sys_machdep.c

Modified: head/sys/i386/i386/sys_machdep.c
==
--- head/sys/i386/i386/sys_machdep.cFri Oct  6 09:02:36 2017
(r324353)
+++ head/sys/i386/i386/sys_machdep.cFri Oct  6 10:16:57 2017
(r324354)
@@ -533,10 +533,10 @@ i386_get_ldt(struct thread *td, struct i386_ldt_args *
return(EINVAL);
 
error = copyout(lp, uap->descs, num * sizeof(union descriptor));
-   if (!error)
+   if (error == 0)
td->td_retval[0] = num;
 
-   return(error);
+   return (error);
 }
 
 int
@@ -545,7 +545,7 @@ i386_set_ldt(struct thread *td, struct i386_ldt_args *
 {
int error, i;
int largest_ld;
-   struct mdproc *mdp = >td_proc->p_md;
+   struct mdproc *mdp;
struct proc_ldt *pldt;
union descriptor *dp;
 
@@ -554,6 +554,7 @@ i386_set_ldt(struct thread *td, struct i386_ldt_args *
uap->start, uap->num, (void *)uap->descs);
 #endif
error = 0;
+   mdp = >td_proc->p_md;
 
if (descs == NULL) {
/* Free descriptors */
___
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: r324353 - head/sys/kern

2017-10-06 Thread Emmanuel Vadot
Author: manu
Date: Fri Oct  6 09:02:36 2017
New Revision: 324353
URL: https://svnweb.freebsd.org/changeset/base/324353

Log:
  vfs_export_lookup: Fix r324054
  
  When using the default address list nam is still valid, the code in
  r324054 assumed that is was NULL.
  
  Reported by:  Guy Yur 
  Tested by:Guy Yur 

Modified:
  head/sys/kern/vfs_export.c

Modified: head/sys/kern/vfs_export.c
==
--- head/sys/kern/vfs_export.c  Fri Oct  6 08:49:15 2017(r324352)
+++ head/sys/kern/vfs_export.c  Fri Oct  6 09:02:36 2017(r324353)
@@ -459,34 +459,33 @@ vfs_export_lookup(struct mount *mp, struct sockaddr *n
return (NULL);
 
/*
-* If no address is provided, use the default if it exists.
+* Lookup in the export list
 */
-   if (nam == NULL) {
-   if ((mp->mnt_flag & MNT_DEFEXPORTED) != 0)
-   return (>ne_defexported);
-   return (NULL);
+   if (nam != NULL) {
+   saddr = nam;
+   rnh = NULL;
+   switch (saddr->sa_family) {
+   case AF_INET:
+   rnh = nep->ne4;
+   break;
+   case AF_INET6:
+   rnh = nep->ne6;
+   break;
+   }
+   if (rnh != NULL) {
+   RADIX_NODE_HEAD_RLOCK(rnh);
+   np = (struct netcred *) (*rnh->rnh_matchaddr)(saddr, 
>rh);
+   RADIX_NODE_HEAD_RUNLOCK(rnh);
+   if (np != NULL && (np->netc_rnodes->rn_flags & 
RNF_ROOT) != 0)
+   return (NULL);
+   }
}
 
/*
-* Lookup in the export list
+* If no address match, use the default if it exists.
 */
-   saddr = nam;
-   rnh = NULL;
-   switch (saddr->sa_family) {
-   case AF_INET:
-   rnh = nep->ne4;
-   break;
-   case AF_INET6:
-   rnh = nep->ne6;
-   break;
-   }
-   if (rnh != NULL) {
-   RADIX_NODE_HEAD_RLOCK(rnh);
-   np = (struct netcred *) (*rnh->rnh_matchaddr)(saddr, >rh);
-   RADIX_NODE_HEAD_RUNLOCK(rnh);
-   if (np != NULL && (np->netc_rnodes->rn_flags & RNF_ROOT) != 0)
-   return (NULL);
-   }
+   if (np == NULL && (mp->mnt_flag & MNT_DEFEXPORTED) != 0)
+   return (>ne_defexported);
 
return (np);
 }
___
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: r324352 - head/share/man/man5

2017-10-06 Thread Jeremie Le Hen
Author: jlh
Date: Fri Oct  6 08:49:15 2017
New Revision: 324352
URL: https://svnweb.freebsd.org/changeset/base/324352

Log:
  Bump src.conf.5's Dd.
  
  This file shouldn't be modified manually but well, I did it in my previous
  commit.  So go down further the rabbit hole so as to at least keep some
  consistency.
  
  Reported by:  bapt

Modified:
  head/share/man/man5/src.conf.5

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Fri Oct  6 08:43:14 2017
(r324351)
+++ head/share/man/man5/src.conf.5  Fri Oct  6 08:49:15 2017
(r324352)
@@ -1,6 +1,6 @@
 .\" DO NOT EDIT-- this file is generated by tools/build/options/makeman.
 .\" $FreeBSD$
-.Dd August 14, 2017
+.Dd October 06, 2017
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
___
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: r324351 - in head: . bin bin/rcp etc etc/mtree etc/pam.d libexec libexec/rlogind libexec/rshd rescue/rescue share/man/man5 share/mk tools/build/mk tools/build/options tools/tools/nanobs...

2017-10-06 Thread Jeremie Le Hen
Author: jlh
Date: Fri Oct  6 08:43:14 2017
New Revision: 324351
URL: https://svnweb.freebsd.org/changeset/base/324351

Log:
  Remove rcmds.
  
  If they are still needed, you can find them in the net/bsdrcmds port.
  
  This was proposed June, 20th and approved by various committers [1].
  They have been marked as deprecated on CURRENT in r320644 [2] on July, 4th.
  Both stable/11 and release/11.1 contain the deprecation notice (thanks to
  allanjude@).
  
  Note that ruptime(1)/rwho(1)/rwhod(8) were initially thought to be part of
  rcmds but this was a mistake and those are therefore NOT removed.
  
  [1] https://lists.freebsd.org/pipermail/freebsd-arch/2017-June/018239.html
  [2] https://svnweb.freebsd.org/base?view=revision=320644
  
  Reviewed by:  bapt, brooks
  Differential Revision:https://reviews.freebsd.org/D12573

Deleted:
  head/bin/rcp/
  head/etc/pam.d/rsh
  head/libexec/rlogind/
  head/libexec/rshd/
  head/tools/build/options/WITHOUT_RCMDS
  head/tools/build/options/WITH_RCMDS
  head/usr.bin/rlogin/
  head/usr.bin/rsh/
Modified:
  head/ObsoleteFiles.inc
  head/bin/Makefile
  head/etc/inetd.conf
  head/etc/mtree/BSD.tests.dist
  head/etc/pam.d/Makefile
  head/libexec/Makefile
  head/rescue/rescue/Makefile
  head/share/man/man5/src.conf.5
  head/share/mk/src.opts.mk
  head/tools/build/mk/OptionalObsoleteFiles.inc
  head/tools/tools/nanobsd/dhcpd/common
  head/tools/tools/nanobsd/embedded/common
  head/tools/tools/nanobsd/gateworks/common
  head/usr.bin/Makefile

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Fri Oct  6 08:28:35 2017(r324350)
+++ head/ObsoleteFiles.inc  Fri Oct  6 08:43:14 2017(r324351)
@@ -38,6 +38,18 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20171003: remove RCMDS
+OLD_FILES+=bin/rcp
+OLD_FILES+=rescue/rcp
+OLD_FILES+=usr/bin/rlogin
+OLD_FILES+=usr/bin/rsh
+OLD_FILES+=usr/libexec/rlogind
+OLD_FILES+=usr/libexec/rshd
+OLD_FILES+=usr/share/man/man1/rcp.1.gz
+OLD_FILES+=usr/share/man/man1/rlogin.1.gz
+OLD_FILES+=usr/share/man/man1/rsh.1.gz
+OLD_FILES+=usr/share/man/man8/rlogind.8.gz
+OLD_FILES+=usr/share/man/man8/rshd.8.gz
 # 20170927: crshared
 OLD_FILES+=usr/share/man/man9/crshared.9.gz
 # 20170927: procctl

Modified: head/bin/Makefile
==
--- head/bin/Makefile   Fri Oct  6 08:28:35 2017(r324350)
+++ head/bin/Makefile   Fri Oct  6 08:43:14 2017(r324351)
@@ -40,7 +40,6 @@ SUBDIR= cat \
test \
uuidgen
 
-SUBDIR.${MK_RCMDS}+=   rcp
 SUBDIR.${MK_SENDMAIL}+=rmail
 SUBDIR.${MK_TCSH}+=csh
 SUBDIR.${MK_TESTS}+=   tests

Modified: head/etc/inetd.conf
==
--- head/etc/inetd.conf Fri Oct  6 08:28:35 2017(r324350)
+++ head/etc/inetd.conf Fri Oct  6 08:43:14 2017(r324351)
@@ -12,10 +12,10 @@
 #ssh   stream  tcp6nowait  root/usr/sbin/sshd  sshd -i -6
 #telnetstream  tcp nowait  root/usr/libexec/telnetdtelnetd
 #telnetstream  tcp6nowait  root/usr/libexec/telnetdtelnetd
-#shell stream  tcp nowait  root/usr/libexec/rshd   rshd
-#shell stream  tcp6nowait  root/usr/libexec/rshd   rshd
-#login stream  tcp nowait  root/usr/libexec/rlogindrlogind
-#login stream  tcp6nowait  root/usr/libexec/rlogindrlogind
+#shell stream  tcp nowait  root/usr/local/sbin/rshdrshd
+#shell stream  tcp6nowait  root/usr/local/sbin/rshdrshd
+#login stream  tcp nowait  root/usr/local/sbin/rlogind rlogind
+#login stream  tcp6nowait  root/usr/local/sbin/rlogind rlogind
 #fingerstream  tcp nowait/3/10 nobody /usr/libexec/fingerd fingerd 
-k -s
 #fingerstream  tcp6nowait/3/10 nobody /usr/libexec/fingerd fingerd 
-k -s
 #

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Fri Oct  6 08:28:35 2017
(r324350)
+++ head/etc/mtree/BSD.tests.dist   Fri Oct  6 08:43:14 2017
(r324351)
@@ -34,8 +34,6 @@
 ..
 pwait
 ..
-rcp
-..
 rmdir
 ..
 sh

Modified: head/etc/pam.d/Makefile
==
--- head/etc/pam.d/Makefile Fri Oct  6 08:28:35 2017(r324350)
+++ head/etc/pam.d/Makefile Fri Oct  6 08:43:14 2017(r324351)
@@ -35,14 +35,6 @@ FTPMODE= ${FILESMODE}
 LINKS= ${FILESDIR}/ftpd ${FILESDIR}/ftp
 .endif
 
-.if ${MK_RCMDS} != "no"
-FILESGROUPS+=  RCMDS
-RCMDS+=rsh
-RCMDSPACKAGE+= rcmds
-RCMDSDIR=  ${FILESDIR}
-RCMDSMODE= ${FILESMODE}
-.endif
-
 .if ${MK_TELNET} != "no"
 FILESGROUPS+=  TELNET
 TELNET+=   telnetd

Modified: 

svn commit: r324350 - head/cddl/contrib/opensolaris/cmd/zdb

2017-10-06 Thread Andriy Gapon
Author: avg
Date: Fri Oct  6 08:28:35 2017
New Revision: 324350
URL: https://svnweb.freebsd.org/changeset/base/324350

Log:
  zdb.8: replace with the slighly modified upstream version
  
  The upstream has converted their manual page to the same format as we
  have, so we can use the upstream version with minimal modifications.
  
  The current modifications are:
  - different zpool.cache path
  - different manual sections for zdb, zfs, zpool commands
  
  igor reports a few minor issues, it would be nice to fix them both in
  FreeBSD and in the upstream.
  
  MFC after:3 weeks

Modified:
  head/cddl/contrib/opensolaris/cmd/zdb/zdb.8

Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.8
==
--- head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Fri Oct  6 08:21:06 2017
(r324349)
+++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Fri Oct  6 08:28:35 2017
(r324350)
@@ -1,6 +1,3 @@
-'\" te
-.\" Copyright (c) 2012, Martin Matuska .
-.\" All Rights Reserved.
 .\"
 .\" This file and its contents are supplied under the terms of the
 .\" Common Development and Distribution License ("CDDL"), version 1.0.
@@ -13,73 +10,75 @@
 .\"
 .\"
 .\" Copyright 2012, Richard Lowe.
-.\" Copyright (c) 2012, Marcelo Araujo .
-.\" Copyright (c) 2012, 2014 by Delphix. All rights reserved.
-.\" Copyright 2016 Nexenta Systems, Inc.
-.\" All Rights Reserved.
+.\" Copyright (c) 2012, 2017 by Delphix. All rights reserved.
+.\" Copyright 2017 Nexenta Systems, Inc.
 .\"
-.\" $FreeBSD$
-.\"
-.Dd October 1, 2017
+.Dd October 06, 2017
 .Dt ZDB 8
 .Os
 .Sh NAME
 .Nm zdb
-.Nd Display zpool debugging and consistency information
+.Nd display zpool debugging and consistency information
 .Sh SYNOPSIS
 .Nm
-.Op Fl CmdibcsDvhLMXFPA
-.Op Fl e Op Fl p Ar path...
+.Op Fl AbcdDFGhiLMPsvX
+.Op Fl e Oo Fl V Oc Op Fl p Ar path ...
+.Op Fl I Ar inflight I/Os
+.Oo Fl o Ar var Ns = Ns Ar value Oc Ns ...
 .Op Fl t Ar txg
 .Op Fl U Ar cache
-.Op Fl I Ar inflight I/Os
 .Op Fl x Ar dumpdir
-.Op Fl o Ar var=value
-.Ar poolname
-.Op Ar object ...
+.Op Ar poolname Op Ar object ...
 .Nm
-.Op Fl divPA
-.Op Fl e Op Fl p Ar path...
+.Op Fl AdiPv
+.Op Fl e Oo Fl V Oc Op Fl p Ar path ...
 .Op Fl U Ar cache
-.Ar dataset
-.Op Ar object ...
+.Ar dataset Op Ar object ...
 .Nm
-.Fl m Op Fl MLXFPA
-.Op Fl t Ar txg
-.Op Fl e Op Fl p Ar path...
+.Fl C
+.Op Fl A
 .Op Fl U Ar cache
-.Ar poolname
 .Nm
-.Fl R Op Fl A
-.Op Fl e Op Fl p Ar path...
-.Op Fl U Ar cache
-.Ar poolname
-.Ar poolname
-.Ar vdev Ns : Ns Ar offset Ns : Ns Ar size Ns Op Ns : Ns Ar flags
+.Fl E
+.Op Fl A
+.Ar word0 Ns \&: Ns Ar word1 Ns :...: Ns Ar word15
 .Nm
-.Fl S
-.Op Fl AP
-.Op Fl e Op Fl p Ar path...
-.Op Fl U Ar cache
-.Ar poolname
-.Ar poolname
-.Nm
 .Fl l
 .Op Fl Aqu
 .Ar device
 .Nm
-.Fl C
+.Fl m
+.Op Fl AFLPX
+.Op Fl e Oo Fl V Oc Op Fl p Ar path ...
+.Op Fl t Ar txg
+.Op Fl U Ar cache
+.Ar poolname Op Ar vdev Op Ar metaslab ...
+.Nm
+.Fl O
+.Ar dataset path
+.Nm
+.Fl R
 .Op Fl A
+.Op Fl e Oo Fl V Oc Op Fl p Ar path ...
 .Op Fl U Ar cache
+.Ar poolname vdev Ns \&: Ns Ar offset Ns \&: Ns Ar size Ns Op : Ns Ar flags
+.Nm
+.Fl S
+.Op Fl AP
+.Op Fl e Oo Fl V Oc Op Fl p Ar path ...
+.Op Fl U Ar cache
+.Ar poolname
 .Sh DESCRIPTION
 The
 .Nm
-utility displays information about a ZFS pool useful for debugging and
-performs some amount of consistency checking.
-It is a not a general purpose tool and options (and facilities) may change.
+utility displays information about a ZFS pool useful for debugging and performs
+some amount of consistency checking.
+It is a not a general purpose tool and options
+.Pq and facilities
+may change.
 This is neither a
 .Xr fsck 8
-nor a
+nor an
 .Xr fsdb 8
 utility.
 .Pp
@@ -91,81 +90,99 @@ internals is assumed.
 If the
 .Ar dataset
 argument does not contain any
-.Sy /
+.Qq Sy /
 or
-.Sy @
+.Qq Sy @
 characters, it is interpreted as a pool name.
 The root dataset can be specified as
-.Pa pool Ns Sy /
-(pool name followed by a slash).
+.Ar pool Ns /
+.Pq pool name followed by a slash .
 .Pp
 When operating on an imported and active pool it is possible, though unlikely,
 that zdb may interpret inconsistent pool data and behave erratically.
 .Sh OPTIONS
 Display options:
-.Bl -tag -width indent
+.Bl -tag -width Ds
 .It Fl b
-Display statistics regarding the number, size (logical, physical and
-allocated) and deduplication of blocks.
+Display statistics regarding the number, size
+.Pq logical, physical and allocated
+and deduplication of blocks.
 .It Fl c
 Verify the checksum of all metadata blocks while printing block statistics
-(see
-.Fl b Ns ).
+.Po see
+.Fl b
+.Pc .
 .Pp
 If specified multiple times, verify the checksums of all blocks.
 .It Fl C
-Display information about the configuration. If specified with no other
-options, instead display information about the cache file
-.Po Pa /etc/zfs/zpool.cache Pc .
+Display information about the configuration.

Re: svn commit: r324341 - in head/sys: arm/allwinner arm/altera/socfpga arm/amlogic/aml8726 arm/annapurna/alpine arm/broadcom/bcm2835 arm/conf arm/freescale/imx arm/freescale/vybrid arm/mv arm/mv/arma

2017-10-06 Thread Andrew Turner

> On 6 Oct 2017, at 00:01, Warner Losh  wrote:
> 
> Author: imp
> Date: Thu Oct  5 23:01:50 2017
> New Revision: 324341
> URL: https://svnweb.freebsd.org/changeset/base/324341
> 
> Log:
>  Tag all armv7 kernels as such in their machine config line.
> 
>  Transition all boards that support arm cortex CPUs to armv7. This
>  leaves two armv6 kernels in the tree. RPI-B, which uses the BCM2835
>  which has a ARM1176 core, and VERSATILEPB, which is a qemu board setup
>  around the time RPI-B went in. Copy std.armv6 to std.armv7, even
>  though that duplicates a lot of stuff. More work needs to be done to
>  sort out the duplication.
> 
>  Differential Revision: https://reviews.freebsd.org/D12027
> 
> Added:
>  head/sys/arm/conf/VIRT
> - copied, changed from r324340, head/sys/arm/conf/ARMADAXP

Did you mean to add VIRT?

Andrew

___
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: r324349 - in head: cddl/contrib/opensolaris/cmd/zdb sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys

2017-10-06 Thread Andriy Gapon
Author: avg
Date: Fri Oct  6 08:21:06 2017
New Revision: 324349
URL: https://svnweb.freebsd.org/changeset/base/324349

Log:
  MFV r322235: 8067 zdb should be able to dump literal embedded block pointer
  
  illumos/illumos-gate@4923c69fddc0887da5604a262585af3efd82ee20
  
https://github.com/illumos/illumos-gate/commit/4923c69fddc0887da5604a262585af3efd82ee20
  
  FreeBSD note: the manual page is to be updated separately.
  
  https://www.illumos.org/issues/8067
Add an option to zdb to print a literal embedded block pointer supplied on 
the
command line:
zdb -E [-A] word0:word1:...:word15
  
  Reviewed by: George Wilson 
  Reviewed by: Alex Reece 
  Reviewed by: Yuri Pankov 
  Approved by: Robert Mustacchi 
  Author: Matthew Ahrens 
  
  MFC after:3 weeks

Modified:
  head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/blkptr.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/blkptr.h
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/cmd/zdb/   (props changed)
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==
--- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Oct  6 08:17:12 2017
(r324348)
+++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Oct  6 08:21:06 2017
(r324349)
@@ -61,6 +61,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #undef verify
 #include 
@@ -134,10 +135,11 @@ usage(void)
"\t%s -O  \n"
"\t%s -R [-A] [-e [-V] [-p  ...]] [-U ]\n"
"\t\t ::[:]\n"
+   "\t%s -E [-A] word0:word1:...:word15\n"
"\t%s -S [-AP] [-e [-V] [-p  ...]] [-U ] "
"\n\n",
cmdname, cmdname, cmdname, cmdname, cmdname, cmdname, cmdname,
-   cmdname);
+   cmdname, cmdname);
 
(void) fprintf(stderr, "Dataset name must include at least one "
"separator character '/' or '@'\n");
@@ -152,6 +154,8 @@ usage(void)
(void) fprintf(stderr, "-C config (or cachefile if alone)\n");
(void) fprintf(stderr, "-d dataset(s)\n");
(void) fprintf(stderr, "-D dedup statistics\n");
+   (void) fprintf(stderr, "-E decode and display block from an "
+   "embedded block pointer\n");
(void) fprintf(stderr, "-h pool history\n");
(void) fprintf(stderr, "-i intent logs\n");
(void) fprintf(stderr, "-l read label contents\n");
@@ -3653,6 +3657,33 @@ out:
free(dup);
 }
 
+static void
+zdb_embedded_block(char *thing)
+{
+   blkptr_t bp = { 0 };
+   unsigned long long *words = (void *)
+   char buf[SPA_MAXBLOCKSIZE];
+   int err;
+
+   err = sscanf(thing, "%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx:"
+   "%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx",
+   words + 0, words + 1, words + 2, words + 3,
+   words + 4, words + 5, words + 6, words + 7,
+   words + 8, words + 9, words + 10, words + 11,
+   words + 12, words + 13, words + 14, words + 15);
+   if (err != 16) {
+   (void) printf("invalid input format\n");
+   exit(1);
+   }
+   ASSERT3U(BPE_GET_LSIZE(), <=, SPA_MAXBLOCKSIZE);
+   err = decode_embedded_bp(, buf, BPE_GET_LSIZE());
+   if (err != 0) {
+   (void) printf("decode failed: %u\n", err);
+   exit(1);
+   }
+   zdb_dump_block_raw(buf, BPE_GET_LSIZE(), 0);
+}
+
 static boolean_t
 pool_match(nvlist_t *cfg, char *tgt)
 {
@@ -3771,13 +3802,14 @@ main(int argc, char **argv)
spa_config_path = spa_config_path_env;
 
while ((c = getopt(argc, argv,
-   "AbcCdDeFGhiI:lLmMo:Op:PqRsSt:uU:vVx:X")) != -1) {
+   "AbcCdDeEFGhiI:lLmMo:Op:PqRsSt:uU:vVx:X")) != -1) {
switch (c) {
case 'b':
case 'c':
case 'C':
case 'd':
case 'D':
+   case 'E':
case 'G':
case 'h':
case 'i':
@@ -3841,6 +3873,12 @@ main(int argc, char **argv)
break;
case 'U':
spa_config_path = optarg;
+   if (spa_config_path[0] != '/') {
+   (void) fprintf(stderr,
+   "cachefile must be an absolute path "
+   "(i.e. start with a slash)\n");
+   usage();
+   }
break;
case 'v':
verbose++;
@@ -3889,7 +3927,7 @@ main(int argc, char **argv)
verbose = MAX(verbose, 1);

Re: svn commit: r324341 - in head/sys: arm/allwinner arm/altera/socfpga arm/amlogic/aml8726 arm/annapurna/alpine arm/broadcom/bcm2835 arm/conf arm/freescale/imx arm/freescale/vybrid arm/mv arm/mv/arma

2017-10-06 Thread Emmanuel Vadot

 Hi Warner,

On Thu, 5 Oct 2017 23:01:50 + (UTC)
Warner Losh  wrote:

> Author: imp
> Date: Thu Oct  5 23:01:50 2017
> New Revision: 324341
> URL: https://svnweb.freebsd.org/changeset/base/324341
> 
> Log:
>   Tag all armv7 kernels as such in their machine config line.
>   
>   Transition all boards that support arm cortex CPUs to armv7. This
>   leaves two armv6 kernels in the tree. RPI-B, which uses the BCM2835
>   which has a ARM1176 core, and VERSATILEPB, which is a qemu board setup
>   around the time RPI-B went in. Copy std.armv6 to std.armv7, even
>   though that duplicates a lot of stuff. More work needs to be done to
>   sort out the duplication.
>   
>   Differential Revision: https://reviews.freebsd.org/D12027
> 
> Added:
>   head/sys/arm/conf/VIRT
>  - copied, changed from r324340, head/sys/arm/conf/ARMADAXP
>   head/sys/arm/conf/std.armv7
>  - copied, changed from r324340, head/sys/arm/conf/std.armv6
> Modified:
>   head/sys/arm/allwinner/std.allwinner
>   head/sys/arm/allwinner/std.allwinner_up
>   head/sys/arm/altera/socfpga/std.socfpga
>   head/sys/arm/amlogic/aml8726/std.aml8726
>   head/sys/arm/annapurna/alpine/std.alpine
>   head/sys/arm/broadcom/bcm2835/std.bcm2836
>   head/sys/arm/conf/ALLWINNER_UP
>   head/sys/arm/conf/ALPINE
>   head/sys/arm/conf/AML8726
>   head/sys/arm/conf/ARMADA38X
>   head/sys/arm/conf/ARMADAXP
>   head/sys/arm/conf/BEAGLEBONE
>   head/sys/arm/conf/EFIKA_MX
>   head/sys/arm/conf/EXYNOS5.common
>   head/sys/arm/conf/GENERIC
>   head/sys/arm/conf/IMX53
>   head/sys/arm/conf/IMX6
>   head/sys/arm/conf/PANDABOARD
>   head/sys/arm/conf/RK3188
>   head/sys/arm/conf/RPI2
>   head/sys/arm/conf/SOCFPGA
>   head/sys/arm/conf/TEGRA124
>   head/sys/arm/conf/VYBRID
>   head/sys/arm/conf/ZEDBOARD
>   head/sys/arm/conf/std.armv6
>   head/sys/arm/freescale/imx/std.imx51
>   head/sys/arm/freescale/imx/std.imx53
>   head/sys/arm/freescale/imx/std.imx6
>   head/sys/arm/freescale/vybrid/std.vybrid
>   head/sys/arm/mv/armada38x/std.armada38x
>   head/sys/arm/mv/std-pj4b.mv
>   head/sys/arm/nvidia/tegra124/std.tegra124
>   head/sys/arm/qemu/std.virt
>   head/sys/arm/rockchip/std.rk30xx
>   head/sys/arm/samsung/exynos/std.exynos5250
>   head/sys/arm/samsung/exynos/std.exynos5420
>   head/sys/arm/ti/std.ti
>   head/sys/arm/xilinx/std.zynq7
>   head/sys/conf/files.arm
>   head/sys/conf/options.arm
> 

 None of the release conf files have been updated so they will likely
fail.

 Thanks,

-- 
Emmanuel Vadot  
___
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: r324348 - head/cddl/contrib/opensolaris/lib/libzfs/common

2017-10-06 Thread Andriy Gapon
Author: avg
Date: Fri Oct  6 08:17:12 2017
New Revision: 324348
URL: https://svnweb.freebsd.org/changeset/base/324348

Log:
  MFV r316934: 7340 receive manual origin should override automatic origin
  
  illumos/illumos-gate@ed4e7a6a5cbc5e8986dc649ad54435210487b102
  
https://github.com/illumos/illumos-gate/commit/ed4e7a6a5cbc5e8986dc649ad54435210487b102
  
  https://www.illumos.org/issues/7340
When -o origin= is specified as part of a ZFS receive, that origin
should override the automatic detection in libzfs.
  
  Reviewed by: George Wilson 
  Reviewed by: Matthew Ahrens 
  Approved by: Robert Mustacchi 
  Author: Paul Dagnelie 
  
  MFC after:3 weeks

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/lib/libzfs/   (props changed)

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c   Fri Oct 
 6 08:15:37 2017(r324347)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c   Fri Oct 
 6 08:17:12 2017(r324348)
@@ -3212,7 +3212,12 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const 
/*
 * Determine the name of the origin snapshot, store in zc_string.
 */
-   if (drrb->drr_flags & DRR_FLAG_CLONE) {
+   if (originsnap) {
+   (void) strncpy(zc.zc_string, originsnap, sizeof (zc.zc_string));
+   if (flags->verbose)
+   (void) printf("using provided clone origin %s\n",
+   zc.zc_string);
+   } else if (drrb->drr_flags & DRR_FLAG_CLONE) {
if (guid_to_name(hdl, zc.zc_value,
drrb->drr_fromguid, B_FALSE, zc.zc_string) != 0) {
zcmd_free_nvlists();
@@ -3223,11 +3228,6 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const 
}
if (flags->verbose)
(void) printf("found clone origin %s\n", zc.zc_string);
-   } else if (originsnap) {
-   (void) strncpy(zc.zc_string, originsnap, sizeof (zc.zc_string));
-   if (flags->verbose)
-   (void) printf("using provided clone origin %s\n",
-   zc.zc_string);
}
 
boolean_t resuming = DMU_GET_FEATUREFLAGS(drrb->drr_versioninfo) &
___
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: r324347 - head/cddl/contrib/opensolaris/lib/libzfs/common

2017-10-06 Thread Andriy Gapon
Author: avg
Date: Fri Oct  6 08:15:37 2017
New Revision: 324347
URL: https://svnweb.freebsd.org/changeset/base/324347

Log:
  MFV r316933: 5142 libzfs support raidz root pool (loader project)
  
  illumos/illumos-gate@d5f26ad8122c3762fb16413a17bfb497db86a782
  
https://github.com/illumos/illumos-gate/commit/d5f26ad8122c3762fb16413a17bfb497db86a782
  
  https://www.illumos.org/issues/5142
the current libzfs only allows simple disk and mirror setup for boot pool, 
as
loader does support booting from raidz, this feature will remove raidz
restriction from boot pool setup.
  
  FreeBSD note: we have long supported this feature, this commit only
  removes a small difference in libzfs.
  
  Reviewed by: George Wilson 
  Reviewed by: Yuri Pankov 
  Reviewed by: Andrew Stormont 
  Reviewed by: Albert Lee 
  Approved by: Robert Mustacchi 
  Author: Toomas Soome 
  
  MFC after:3 weeks

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/lib/libzfs/   (props changed)

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c   Fri Oct 
 6 08:12:13 2017(r324346)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c   Fri Oct 
 6 08:15:37 2017(r324347)
@@ -2295,6 +2295,7 @@ vdev_get_physpaths(nvlist_t *nv, char *physpath, size_
return (ret);
}
} else if (strcmp(type, VDEV_TYPE_MIRROR) == 0 ||
+   strcmp(type, VDEV_TYPE_RAIDZ) == 0 ||
strcmp(type, VDEV_TYPE_REPLACING) == 0 ||
(is_spare = (strcmp(type, VDEV_TYPE_SPARE) == 0))) {
nvlist_t **child;
___
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: r324346 - head/cddl/contrib/opensolaris/lib/libzfs/common

2017-10-06 Thread Andriy Gapon
Author: avg
Date: Fri Oct  6 08:12:13 2017
New Revision: 324346
URL: https://svnweb.freebsd.org/changeset/base/324346

Log:
  MFV r316931: 6268 zfs diff confused by moving a file to another directory
  
  illumos/illumos-gate@aab04418a72c0a29040a5da7eec08efe19dbef04
  
https://github.com/illumos/illumos-gate/commit/aab04418a72c0a29040a5da7eec08efe19dbef04
  
  https://www.illumos.org/issues/6268
The zfs diff command presents a description of the changes that have 
occurred
to files within a filesystem between two snapshots. If a file is renamed, 
the
tool is capable of reporting this, e.g.:
cd /some/zfs/dataset/subdir
mv file0 file1
Will result in a diff record like:
R/some/zfs/dataset/subdir/file0  ->  /some/zfs/dataset/subdir/file1
Unfortunately, it seems that rename detection only uses the base filename to
determine if a file has been renamed or simply modified. This leads to
misreporting only the original filename, omitting the more relevant 
destination
filename entirely. For example:
cd /some/zfs/dataset/subdir
mv file0 ../otherdir/file0
Will result in a diff entry:
M/some/zfs/dataset/subdir/file0
But it should really emit:
R/some/zfs/dataset/subdir/file0  ->  
/some/zfs/dataset/otherdir/file0
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Justin Gibbs 
  Approved by: Dan McDonald 
  Author: Joshua M. Clulow 
  
  MFC after:3 weeks

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/lib/libzfs/   (props changed)

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c   Fri Oct 
 6 08:10:54 2017(r324345)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c   Fri Oct 
 6 08:12:13 2017(r324346)
@@ -55,15 +55,6 @@
 #defineZDIFF_REMOVED   '-'
 #defineZDIFF_RENAMED   'R'
 
-static boolean_t
-do_name_cmp(const char *fpath, const char *tpath)
-{
-   char *fname, *tname;
-   fname = strrchr(fpath, '/') + 1;
-   tname = strrchr(tpath, '/') + 1;
-   return (strcmp(fname, tname) == 0);
-}
-
 typedef struct differ_info {
zfs_handle_t *zhp;
char *fromsnap;
@@ -262,7 +253,6 @@ static int
 write_inuse_diffs_one(FILE *fp, differ_info_t *di, uint64_t dobj)
 {
struct zfs_stat fsb, tsb;
-   boolean_t same_name;
mode_t fmode, tmode;
char fobjname[MAXPATHLEN], tobjname[MAXPATHLEN];
int fobjerr, tobjerr;
@@ -323,7 +313,6 @@ write_inuse_diffs_one(FILE *fp, differ_info_t *di, uin
 
if (fmode != tmode && fsb.zs_gen == tsb.zs_gen)
tsb.zs_gen++;   /* Force a generational difference */
-   same_name = do_name_cmp(fobjname, tobjname);
 
/* Simple modification or no change */
if (fsb.zs_gen == tsb.zs_gen) {
@@ -334,7 +323,7 @@ write_inuse_diffs_one(FILE *fp, differ_info_t *di, uin
if (change) {
print_link_change(fp, di, change,
change > 0 ? fobjname : tobjname, );
-   } else if (same_name) {
+   } else if (strcmp(fobjname, tobjname) == 0) {
print_file(fp, di, ZDIFF_MODIFIED, fobjname, );
} else {
print_rename(fp, di, fobjname, tobjname, );
___
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: r324345 - head/cddl/contrib/opensolaris/lib/libzfs/common

2017-10-06 Thread Andriy Gapon
Author: avg
Date: Fri Oct  6 08:10:54 2017
New Revision: 324345
URL: https://svnweb.freebsd.org/changeset/base/324345

Log:
  MFV r316877: 7571 non-present readonly numeric ZFS props do not have default 
value
  
  illumos/illumos-gate@ad2760acbd9c3b479bf632f05c6f03d89830799d
  
https://github.com/illumos/illumos-gate/commit/ad2760acbd9c3b479bf632f05c6f03d89830799d
  
  https://www.illumos.org/issues/7571
ZFS displays the default value for non-present readonly numeric (and index)
properties. However, these properties default values are not meaningful.
Instead, we should display a "-", indicating that they are not present. For
example, on a version-12 pool, the usedby* properties are not available, but
they show up as the incorrect value "0":
   1. zfs get all test12
  ...
  test12 usedbysnapshots 0 -
  test12 usedbydataset 0 -
  test12 usedbychildren 0 -
  test12 usedbyrefreservation 0 -
We will be introducing more sometimes-present numeric readonly properties, 
so
it would be nice to fix this.
  
  Reviewed by: Dan Kimmel 
  Reviewed by: George Wilson 
  Approved by: Robert Mustacchi 
  Author: Matthew Ahrens 
  
  MFC after:3 weeks

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/lib/libzfs/   (props changed)

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.cFri Oct 
 6 08:09:20 2017(r324344)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.cFri Oct 
 6 08:10:54 2017(r324345)
@@ -22,7 +22,7 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
- * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2016 by Delphix. All rights reserved.
  * Copyright (c) 2012 DEY Storage Systems, Inc.  All rights reserved.
  * Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved.
  * Copyright (c) 2013 Martin Matuska. All rights reserved.
@@ -2166,6 +2166,7 @@ get_numeric_property(zfs_handle_t *zhp, zfs_prop_t pro
if (zfs_prop_readonly(prop) &&
*source != NULL && (*source)[0] == '\0') {
*source = NULL;
+   return (-1);
}
break;
 
___
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: r324344 - head/cddl/contrib/opensolaris/cmd/zdb

2017-10-06 Thread Andriy Gapon
Author: avg
Date: Fri Oct  6 08:09:20 2017
New Revision: 324344
URL: https://svnweb.freebsd.org/changeset/base/324344

Log:
  MFV r316864: 6392 zdb: introduce -V for verbatim import
  
  illumos/illumos-gate@dfd5965f7e43b6a630e5ac86708ae76b4f02cc40
  
https://github.com/illumos/illumos-gate/commit/dfd5965f7e43b6a630e5ac86708ae76b4f02cc40
  
  FreeBSD note: the manual page is to be updated separately.
  
  https://www.illumos.org/issues/6392
When given a pool name via -e, zdb would attempt an import. If it
failed, then it would attempt a verbatim import. This behavior is
not always desirable so a -V switch is added to zdb to control the
behavior. When specified, a verbatim import is done. Otherwise,
the behavior is as it was previously, except no verbatim import
is done on failure.

https://github.com/zfsonlinux/zfs/commit/a5778ea2427bd340e3b4f697d9b6e1452bd71909
Reviewed by: Brian Behlendorf 
Reviewed by: Matthew Ahrens 
  
  Reviewed by: Yuri Pankov 
  Reviewed by: Brian Behlendorf 
  Reviewed by: Matt Ahrens 
  Reviewed by: Pavel Zakharov 
  Approved by: Dan McDonald 
  Author: Richard Yao 
  
  MFC after:3 weeks

Modified:
  head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/cmd/zdb/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==
--- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Oct  6 07:52:25 2017
(r324343)
+++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Oct  6 08:09:20 2017
(r324344)
@@ -121,20 +121,21 @@ static void
 usage(void)
 {
(void) fprintf(stderr,
-   "Usage:\t%s [-AbcdDFGhiLMPsvX] [-e [-p  ...]] "
+   "Usage:\t%s [-AbcdDFGhiLMPsvX] [-e [-V] [-p  ...]] "
"[-I ]\n"
"\t\t[-o =]... [-t ] [-U ] [-x ]\n"
"\t\t[ [ ...]]\n"
-   "\t%s [-AdiPv] [-e [-p  ...]] [-U ]  "
+   "\t%s [-AdiPv] [-e [-V] [-p  ...]] [-U ]  "
"[ ...]\n"
"\t%s -C [-A] [-U ]\n"
"\t%s -l [-Aqu] \n"
-   "\t%s -m [-AFLPX] [-e [-p  ...]] [-t ] [-U ]\n"
-   "\t\t [ [ ...]]\n"
+   "\t%s -m [-AFLPX] [-e [-V] [-p  ...]] [-t ] "
+   "[-U ]\n\t\t [ [ ...]]\n"
"\t%s -O  \n"
-   "\t%s -R [-A] [-e [-p  ...]] [-U ]\n"
+   "\t%s -R [-A] [-e [-V] [-p  ...]] [-U ]\n"
"\t\t ::[:]\n"
-   "\t%s -S [-AP] [-e [-p  ...]] [-U ] \n\n",
+   "\t%s -S [-AP] [-e [-V] [-p  ...]] [-U ] "
+   "\n\n",
cmdname, cmdname, cmdname, cmdname, cmdname, cmdname, cmdname,
cmdname);
 
@@ -189,6 +190,7 @@ usage(void)
(void) fprintf(stderr, "-u uberblock\n");
(void) fprintf(stderr, "-U  -- use alternate "
"cachefile\n");
+   (void) fprintf(stderr, "-V do verbatim import\n");
(void) fprintf(stderr, "-x  -- "
"dump all read blocks into specified directory\n");
(void) fprintf(stderr, "-X attempt extreme rewind (does not "
@@ -3749,6 +3751,7 @@ main(int argc, char **argv)
char *target;
nvlist_t *policy = NULL;
uint64_t max_txg = UINT64_MAX;
+   int flags = ZFS_IMPORT_MISSING_LOG;
int rewind = ZPOOL_NEVER_REWIND;
char *spa_config_path_env;
boolean_t target_is_spa = B_TRUE;
@@ -3768,7 +3771,7 @@ main(int argc, char **argv)
spa_config_path = spa_config_path_env;
 
while ((c = getopt(argc, argv,
-   "AbcCdDeFGhiI:lLmMo:Op:PqRsSt:uU:vx:X")) != -1) {
+   "AbcCdDeFGhiI:lLmMo:Op:PqRsSt:uU:vVx:X")) != -1) {
switch (c) {
case 'b':
case 'c':
@@ -3842,6 +3845,9 @@ main(int argc, char **argv)
case 'v':
verbose++;
break;
+   case 'V':
+   flags = ZFS_IMPORT_VERBATIM;
+   break;
case 'x':
vn_dumpdir = optarg;
break;
@@ -3942,11 +3948,7 @@ main(int argc, char **argv)
fatal("can't open '%s': %s",
target, strerror(ENOMEM));
}
-   if ((error = spa_import(name, cfg, NULL,
-   ZFS_IMPORT_MISSING_LOG)) != 0) {
-   error = spa_import(name, cfg, NULL,
-   ZFS_IMPORT_VERBATIM);
-   }
+   error = spa_import(name, cfg, NULL, flags);
}
}
 

svn commit: r324343 - head/cddl/contrib/opensolaris/cmd/zdb

2017-10-06 Thread Andriy Gapon
Author: avg
Date: Fri Oct  6 07:52:25 2017
New Revision: 324343
URL: https://svnweb.freebsd.org/changeset/base/324343

Log:
  MFV r316862: 6410 teach zdb to perform object lookups by path
  
  illumos/illumos-gate@ed61ec1da9132e570b0853386d0f78a32f852cd2
  
https://github.com/illumos/illumos-gate/commit/ed61ec1da9132e570b0853386d0f78a32f852cd2
  
  FreeBSD note: this commit does not update the manual page.
  The original change includes conversion of the manual page from *roff format
  to mandoc format.  So, it is hard to extract the content change from
  that.  I am going to replace our zdb manual page, which is an earlier
  independent conversion, with a slighly modified version of the upstream page.
  
  https://www.illumos.org/issues/6410
This is primarily intended to ease debugging & testing ZFS when one is only
interested in things like the on-disk location of a specific object's 
blocks,
but doesn't know their object id. This allows doing things like the 
following
(FreeBSD-based example):
# zpool create -f foo da0
# dd if=/dev/zero of=/foo/1 bs=1M count=4 >/dev/null 2>&1
# zpool export foo
# zdb -v -o "ZFS plain file" foo /1
Object  lvl   iblk   dblk  dsize  lsize   %full  type
 8216K   128K  3.99M 4M  100.00  ZFS plain file 
(K=inherit) (Z=inherit)
168   bonus  System attributes
dnode flags: USED_BYTES USERUSED_ACCOUNTED
dnode maxblkid: 31
path/1
uid 0
gid 0
atime   Thu Apr 23 22:45:32 2015
mtime   Thu Apr 23 22:45:32 2015
ctime   Thu Apr 23 22:45:32 2015
crtime  Thu Apr 23 22:45:32 2015
gen 7
mode100644
size4194304
parent  4
links   1
pflags  4080004
Indirect blocks:
  0 L1  DVA[0]=<0:c19200:600> DVA[1]=<0:10800019200:600> [L1 ZFS
plain file] fletcher4 lz4 LE contiguous unique double size=4000L/200P 
birth=7L/
  
  Reviewed by: Pavel Zakharov 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Will Andrews 
  Approved by: Dan McDonald 
  Author: Yuri Pankov 
  
  MFC after:3 weeks

Modified:
  head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/cmd/zdb/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==
--- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Oct  5 23:05:56 2017
(r324342)
+++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Oct  6 07:52:25 2017
(r324343)
@@ -23,7 +23,7 @@
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2011, 2016 by Delphix. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
- * Copyright 2016 Nexenta Systems, Inc.
+ * Copyright 2017 Nexenta Systems, Inc.
  */
 
 #include 
@@ -121,19 +121,22 @@ static void
 usage(void)
 {
(void) fprintf(stderr,
-   "Usage: %s [-CmMdibcsDvhLXFPAG] [-t txg] [-e [-p path...]] "
-   "[-U config] [-I inflight I/Os] [-x dumpdir] [-o var=value] "
-   "poolname [object...]\n"
-   "   %s [-divPA] [-e -p path...] [-U config] dataset "
-   "[object...]\n"
-   "   %s -mM [-LXFPA] [-t txg] [-e [-p path...]] [-U config] "
-   "poolname [vdev [metaslab...]]\n"
-   "   %s -R [-A] [-e [-p path...]] poolname "
-   "vdev:offset:size[:flags]\n"
-   "   %s -S [-PA] [-e [-p path...]] [-U config] poolname\n"
-   "   %s -l [-Aqu] device\n"
-   "   %s -C [-A] [-U config]\n\n",
-   cmdname, cmdname, cmdname, cmdname, cmdname, cmdname, cmdname);
+   "Usage:\t%s [-AbcdDFGhiLMPsvX] [-e [-p  ...]] "
+   "[-I ]\n"
+   "\t\t[-o =]... [-t ] [-U ] [-x ]\n"
+   "\t\t[ [ ...]]\n"
+   "\t%s [-AdiPv] [-e [-p  ...]] [-U ]  "
+   "[ ...]\n"
+   "\t%s -C [-A] [-U ]\n"
+   "\t%s -l [-Aqu] \n"
+   "\t%s -m [-AFLPX] [-e [-p  ...]] [-t ] [-U ]\n"
+   "\t\t [ [ ...]]\n"
+   "\t%s -O  \n"
+   "\t%s -R [-A] [-e [-p  ...]] [-U ]\n"
+   "\t\t ::[:]\n"
+   "\t%s -S [-AP] [-e [-p  ...]] [-U ] \n\n",
+   cmdname, cmdname, cmdname, cmdname, cmdname, cmdname, cmdname,
+   cmdname);
 
(void) fprintf(stderr, "Dataset name must include at least one "
"separator character '/' or '@'\n");
@@ -142,52 +145,54 @@ usage(void)
(void) fprintf(stderr, "If object numbers are specified, only "
"those objects are