svn commit: r317667 - head/sbin/ipfw

2017-05-01 Thread Andrey V. Elsukov
Author: ae
Date: Tue May  2 05:20:54 2017
New Revision: 317667
URL: https://svnweb.freebsd.org/changeset/base/317667

Log:
  In parse_range() validate both range values instead of checking
  the top  value twice.
  
  PR:   202295
  MFC after:1 week

Modified:
  head/sbin/ipfw/dummynet.c

Modified: head/sbin/ipfw/dummynet.c
==
--- head/sbin/ipfw/dummynet.c   Tue May  2 05:02:12 2017(r317666)
+++ head/sbin/ipfw/dummynet.c   Tue May  2 05:20:54 2017(r317667)
@@ -1881,7 +1881,7 @@ parse_range(int ac, char *av[], uint32_t
av--;
}
if (v[1] < v[0] ||
-   v[1] >= DN_MAX_ID-1 ||
+   v[0] >= DN_MAX_ID-1 ||
v[1] >= DN_MAX_ID-1) {
continue; /* invalid entry */
}
___
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: r317666 - head/sbin/ipfw

2017-05-01 Thread Andrey V. Elsukov
Author: ae
Date: Tue May  2 05:02:12 2017
New Revision: 317666
URL: https://svnweb.freebsd.org/changeset/base/317666

Log:
  Add sets support for ipfw table info/list/flush commands.
  
  PR:   212668
  MFC after:1 week

Modified:
  head/sbin/ipfw/tables.c

Modified: head/sbin/ipfw/tables.c
==
--- head/sbin/ipfw/tables.c Tue May  2 02:32:10 2017(r317665)
+++ head/sbin/ipfw/tables.c Tue May  2 05:02:12 2017(r317666)
@@ -1628,18 +1628,19 @@ tables_foreach(table_cb_t *f, void *arg,
}
 
if (sort != 0)
-   qsort(olh + 1, olh->count, olh->objsize, tablename_cmp);
+   qsort(olh + 1, olh->count, olh->objsize,
+   tablename_cmp);
 
info = (ipfw_xtable_info *)(olh + 1);
for (i = 0; i < olh->count; i++) {
-   error = f(info, arg); /* Ignore errors for now */
-   info = (ipfw_xtable_info *)((caddr_t)info + 
olh->objsize);
+   if (co.use_set == 0 || info->set == co.use_set - 1)
+   error = f(info, arg);
+   info = (ipfw_xtable_info *)((caddr_t)info +
+   olh->objsize);
}
-
free(olh);
break;
}
-
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: r317665 - in head: contrib/netbsd-tests/usr.bin/grep usr.bin/grep

2017-05-01 Thread Ed Maste
Author: emaste
Date: Tue May  2 02:32:10 2017
New Revision: 317665
URL: https://svnweb.freebsd.org/changeset/base/317665

Log:
  bsdgrep: fix -w -v matching improperly with certain patterns
  
  -w and -v flag matching was mostly functional but had some minor
  problems:
  
  1. -w flag processing only allowed one iteration through pattern
 matching on a line. This was problematic if one pattern could match
 more than once, or if there were multiple patterns and the earliest/
 longest match was not the most ideal, and
  
  2. Previous work "fixed" things to not further process a line if the
 first iteration through patterns produced no matches. This is clearly
 wrong if we're dealing with the more restrictive -w matching.
  
  #2 breakage could have also occurred before recent broad rewrites, but
  it would be more arbitrary based on input patterns as to whether or not
  it actually affected things.
  
  Fix both of these by forcing a retry of the patterns after advancing
  just past the start of the first match if we're doing more restrictive
  -w matching and we didn't get any hits to start with. Also move -v flag
  processing outside of the loop so that we have a greater change to match
  in the more restrictive cases. This wasn't strictly wrong, but it could
  be a little more error prone.
  
  While here, introduce some regressions tests for this behavior and fix
  some excessive wrapping nearby that hindered readability. GNU grep
  passes these new tests.
  
  PR:   218467, 218811
  Submitted by: Kyle Evans 
  Reviewed by:  cem, ngie
  Differential Revision:https://reviews.freebsd.org/D10329

Modified:
  head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
  head/usr.bin/grep/util.c

Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
==
--- head/contrib/netbsd-tests/usr.bin/grep/t_grep.shTue May  2 01:30:46 
2017(r317664)
+++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.shTue May  2 02:32:10 
2017(r317665)
@@ -93,6 +93,12 @@ word_regexps_body()
 {
atf_check -o file:"$(atf_get_srcdir)/d_word_regexps.out" \
grep -w separated $(atf_get_srcdir)/d_input
+
+   # Begin FreeBSD
+   printf "xmatch pmatch\n" > test1
+
+   atf_check -o inline:"pmatch\n" grep -Eow "(match )?pmatch" test1
+   # End FreeBSD
 }
 
 atf_test_case begin_end
@@ -439,6 +445,23 @@ grep_sanity_body()
 
atf_check -o inline:"M\n" grep -o -e "M\{1\}" test2
 }
+
+atf_test_case wv_combo_break
+wv_combo_break_head()
+{
+   atf_set "descr" "Check for incorrectly matching lines with both -w and 
-v flags (PR 218467)"
+}
+wv_combo_break_body()
+{
+   printf "x xx\n" > test1
+   printf "xx x\n" > test2
+
+   atf_check -o file:test1 grep -w "x" test1
+   atf_check -o file:test2 grep -w "x" test2
+
+   atf_check -s exit:1 grep -v -w "x" test1
+   atf_check -s exit:1 grep -v -w "x" test2
+}
 # End FreeBSD
 
 atf_init_test_cases()
@@ -467,6 +490,7 @@ atf_init_test_cases()
atf_add_test_case escmap
atf_add_test_case egrep_empty_invalid
atf_add_test_case zerolen
+   atf_add_test_case wv_combo_break
atf_add_test_case fgrep_sanity
atf_add_test_case egrep_sanity
atf_add_test_case grep_sanity

Modified: head/usr.bin/grep/util.c
==
--- head/usr.bin/grep/util.cTue May  2 01:30:46 2017(r317664)
+++ head/usr.bin/grep/util.cTue May  2 02:32:10 2017(r317665)
@@ -305,6 +305,7 @@ procline(struct str *l, int nottext)
unsigned int i;
int c = 0, m = 0, r = 0, lastmatches = 0, leflags = eflags;
int startm = 0;
+   int retry;
 
/* Initialize to avoid a false positive warning from GCC. */
lastmatch.rm_so = lastmatch.rm_eo = 0;
@@ -313,6 +314,7 @@ procline(struct str *l, int nottext)
while (st <= l->len) {
lastmatches = 0;
startm = m;
+   retry = 0;
if (st > 0)
leflags |= REG_NOTBOL;
/* Loop to compare with all the patterns */
@@ -356,6 +358,17 @@ procline(struct str *l, int nottext)
else if (iswword(wbegin) ||
iswword(wend))
r = REG_NOMATCH;
+   /*
+* If we're doing whole word matching and we
+* matched once, then we should try the pattern
+* again after advancing just past the start  of
+* the earliest match. This allows the pattern
+* to  match later on in the line and possibly
+* still match a whole word.
+*/

svn commit: r317664 - stable/11/sys/dev/hyperv/netvsc

2017-05-01 Thread Sepherosa Ziehau
Author: sephe
Date: Tue May  2 01:30:46 2017
New Revision: 317664
URL: https://svnweb.freebsd.org/changeset/base/317664

Log:
  hyperv/hn: Enable sorted LRO (direct commit).
  
  This is a direct commit.  Sorted LRO is much better than plain
  (linked list LRO), which hash LRO is not available on this
  branch.
  
  Sponsored by: Microsoft

Modified:
  stable/11/sys/dev/hyperv/netvsc/if_hn.c

Modified: stable/11/sys/dev/hyperv/netvsc/if_hn.c
==
--- stable/11/sys/dev/hyperv/netvsc/if_hn.c Tue May  2 01:03:59 2017
(r317663)
+++ stable/11/sys/dev/hyperv/netvsc/if_hn.c Tue May  2 01:30:46 2017
(r317664)
@@ -487,7 +487,7 @@ SYSCTL_INT(_hw_hn, OID_AUTO, tx_swq_dept
 
 /* Enable sorted LRO, and the depth of the per-channel mbuf queue */
 #if __FreeBSD_version >= 1100095
-static u_int   hn_lro_mbufq_depth = 0;
+static u_int   hn_lro_mbufq_depth = 512;
 SYSCTL_UINT(_hw_hn, OID_AUTO, lro_mbufq_depth, CTLFLAG_RDTUN,
 _lro_mbufq_depth, 0, "Depth of LRO mbuf queue");
 #endif
___
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: r317663 - head/sbin/ipfw

2017-05-01 Thread Andrey V. Elsukov
Author: ae
Date: Tue May  2 01:03:59 2017
New Revision: 317663
URL: https://svnweb.freebsd.org/changeset/base/317663

Log:
  Properly initialize ipfw_range_tlv variable to fix possible EINVAL
  in case when ipfw delete/zero/resetlog command issued for several rules
  in the loop. Also reorder some variables by size.
  
  PR:   218993
  MFC after:1 week

Modified:
  head/sbin/ipfw/ipfw2.c

Modified: head/sbin/ipfw/ipfw2.c
==
--- head/sbin/ipfw/ipfw2.c  Mon May  1 21:21:04 2017(r317662)
+++ head/sbin/ipfw/ipfw2.c  Tue May  2 01:03:59 2017(r317663)
@@ -3187,15 +3187,14 @@ fill_flags_cmd(ipfw_insn *cmd, enum ipfw
 void
 ipfw_delete(char *av[])
 {
+   ipfw_range_tlv rt;
+   char *sep;
int i, j;
int exitval = EX_OK;
int do_set = 0;
-   char *sep;
-   ipfw_range_tlv rt;
 
av++;
NEED1("missing rule specification");
-   memset(, 0, sizeof(rt));
if ( *av && _substrcmp(*av, "set") == 0) {
/* Do not allow using the following syntax:
 *  ipfw set N delete set M
@@ -3222,6 +3221,7 @@ ipfw_delete(char *av[])
} else if (co.do_pipe) {
exitval = ipfw_delete_pipe(co.do_pipe, i);
} else {
+   memset(, 0, sizeof(rt));
if (do_set != 0) {
rt.set = i & 31;
rt.flags = IPFW_RCFLAG_SET;
@@ -5157,18 +5157,17 @@ void
 ipfw_zero(int ac, char *av[], int optname)
 {
ipfw_range_tlv rt;
-   uint32_t arg;
-   int failed = EX_OK;
char const *errstr;
char const *name = optname ? "RESETLOG" : "ZERO";
+   uint32_t arg;
+   int failed = EX_OK;
 
optname = optname ? IP_FW_XRESETLOG : IP_FW_XZERO;
-   memset(, 0, sizeof(rt));
-
av++; ac--;
 
if (ac == 0) {
/* clear all entries */
+   memset(, 0, sizeof(rt));
rt.flags = IPFW_RCFLAG_ALL;
if (do_range_cmd(optname, ) < 0)
err(EX_UNAVAILABLE, "setsockopt(IP_FW_X%s)", name);
@@ -5186,6 +5185,7 @@ ipfw_zero(int ac, char *av[], int optnam
if (errstr)
errx(EX_DATAERR,
"invalid rule number %s\n", *av);
+   memset(, 0, sizeof(rt));
rt.start_rule = arg;
rt.end_rule = arg;
rt.flags |= IPFW_RCFLAG_RANGE;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r317651 - in head/sys/compat/linuxkpi/common: include/asm include/linux src

2017-05-01 Thread John Baldwin
On Monday, May 01, 2017 04:32:28 PM Mark Johnston wrote:
> Author: markj
> Date: Mon May  1 16:32:28 2017
> New Revision: 317651
> URL: https://svnweb.freebsd.org/changeset/base/317651
> 
> Log:
>   Add on_each_cpu() and wbinvd_on_all_cpus().

For wbinvd_on_all_cpus() we do have a dedicated IPI.  You could just
use 'pmap_invalidate_cache()' in place of wbinvd_on_all_cpus() directly.

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


Re: svn commit: r317171 - head/sys/dev/vt

2017-05-01 Thread Jung-uk Kim
On 05/01/2017 16:55, Ed Maste wrote:
> On 20 April 2017 at 14:06, Jung-uk Kim  wrote:
>>
>> Maybe but I haven't seen much improvement in the area for many years.
>> Do you have any reason to believe someone is working on it?
>>
>> Even if we have such backend, I don't expect much difference in drawing
>> small area, i.e., redrawing narrow borders.  On top of that, I don't
>> like "if (vd->vd_driver->vd_drawrect == NULL) return (ENOTSUP)" stuff.
> 
> I don't believe anyone is working on it at the moment, but I expect
> that effort will go into improved VGA / VESA support at some point and
> that might implement an improved drawrect. I agree that there's
> unlikely to be a noticeable difference in the case of occasional
> operations filling a small region (e.g., border clearing after vt
> switch).
> 
> However, the vd_drawrect == NULL case is really no different than
> vd_setpixel == NULL. All vt drivers except ofwfb provide both, and
> ofwfb provides neither.

I can revert it but I don't like the previous implementation.  There
were overlapping regions and off-by-one issues.  Please see the attached
patch, which is against the previous version.

Jung-uk Kim
--- vt_core.c.orig
+++ vt_core.c
@@ -1546,21 +1546,23 @@
 	/* Left bar. */
 	if (vw->vw_draw_area.tr_begin.tp_col > 0)
 		vd->vd_driver->vd_drawrect(vd,
-		0, 0,
-		vw->vw_draw_area.tr_begin.tp_col - 1, vd->vd_height - 1,
+		0, vw->vw_draw_area.tr_begin.tp_row,
+		vw->vw_draw_area.tr_begin.tp_col - 1,
+		vw->vw_draw_area.tr_end.tp_row - 1,
 		1, c);
 
 	/* Right bar. */
 	if (vw->vw_draw_area.tr_end.tp_col < vd->vd_width)
 		vd->vd_driver->vd_drawrect(vd,
-		vw->vw_draw_area.tr_end.tp_col - 1, 0,
-		vd->vd_width - 1, vd->vd_height - 1,
+		vw->vw_draw_area.tr_end.tp_col,
+		vw->vw_draw_area.tr_begin.tp_row,
+		vd->vd_width - 1, vw->vw_draw_area.tr_end.tp_row - 1,
 		1, c);
 
 	/* Bottom bar. */
 	if (vw->vw_draw_area.tr_end.tp_row < vd->vd_height)
 		vd->vd_driver->vd_drawrect(vd,
-		0, vw->vw_draw_area.tr_end.tp_row - 1,
+		0, vw->vw_draw_area.tr_end.tp_row,
 		vd->vd_width - 1, vd->vd_height - 1,
 		1, c);
 


signature.asc
Description: OpenPGP digital signature


Re: svn commit: r317171 - head/sys/dev/vt

2017-05-01 Thread Ed Maste
On 20 April 2017 at 14:06, Jung-uk Kim  wrote:
>
> Maybe but I haven't seen much improvement in the area for many years.
> Do you have any reason to believe someone is working on it?
>
> Even if we have such backend, I don't expect much difference in drawing
> small area, i.e., redrawing narrow borders.  On top of that, I don't
> like "if (vd->vd_driver->vd_drawrect == NULL) return (ENOTSUP)" stuff.

I don't believe anyone is working on it at the moment, but I expect
that effort will go into improved VGA / VESA support at some point and
that might implement an improved drawrect. I agree that there's
unlikely to be a noticeable difference in the case of occasional
operations filling a small region (e.g., border clearing after vt
switch).

However, the vd_drawrect == NULL case is really no different than
vd_setpixel == NULL. All vt drivers except ofwfb provide both, and
ofwfb provides neither.
___
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: r317660 - head/lib/libc/rpc

2017-05-01 Thread Brooks Davis
Author: brooks
Date: Mon May  1 20:04:07 2017
New Revision: 317660
URL: https://svnweb.freebsd.org/changeset/base/317660

Log:
  Support clnt_raw's use of FD_SETSIZE as a fake file descriptor.
  
  Accomplish this by allocating space for it in __svc_xports and allowing
  it to be registered.  The failure to allocate space was causing an
  out-of-bounds read in svc_getreq_common().  The failure to register
  caused PR 211804.
  
  The bug was found with CHERI bounds checking.
  
  PR:   211804
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL
  Reviewed by:  ngie
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D10528

Modified:
  head/lib/libc/rpc/svc.c

Modified: head/lib/libc/rpc/svc.c
==
--- head/lib/libc/rpc/svc.c Mon May  1 19:47:10 2017(r317659)
+++ head/lib/libc/rpc/svc.c Mon May  1 20:04:07 2017(r317660)
@@ -108,18 +108,19 @@ xprt_register(SVCXPRT *xprt)
rwlock_wrlock(_fd_lock);
if (__svc_xports == NULL) {
__svc_xports = (SVCXPRT **)
-   mem_alloc(FD_SETSIZE * sizeof(SVCXPRT *));
+   mem_alloc((FD_SETSIZE + 1) * sizeof(SVCXPRT *));
if (__svc_xports == NULL) {
rwlock_unlock(_fd_lock);
return;
}
-   memset(__svc_xports, '\0', FD_SETSIZE * sizeof(SVCXPRT *));
+   memset(__svc_xports, '\0', (FD_SETSIZE + 1) * sizeof(SVCXPRT 
*));
}
if (sock < FD_SETSIZE) {
__svc_xports[sock] = xprt;
FD_SET(sock, _fdset);
svc_maxfd = max(svc_maxfd, sock);
-   }
+   } else if (sock == FD_SETSIZE)
+   __svc_xports[sock] = xprt;
rwlock_unlock(_fd_lock);
 }
 
@@ -157,7 +158,8 @@ __xprt_do_unregister(SVCXPRT *xprt, bool
if (__svc_xports[svc_maxfd])
break;
}
-   }
+   } else if ((sock == FD_SETSIZE) && (__svc_xports[sock] == xprt))
+   __svc_xports[sock] = NULL;
if (dolock)
rwlock_unlock(_fd_lock);
 }
___
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: r317659 - head/sys/dev/uart

2017-05-01 Thread Alexander Motin
Author: mav
Date: Mon May  1 19:47:10 2017
New Revision: 317659
URL: https://svnweb.freebsd.org/changeset/base/317659

Log:
  Make some UART consoles to not spin wait for data to be sent.
  
  At least with Tx FIFO enabled it shows me ~10% reduction of verbose boot
  time with serial console at 115200 baud.
  
  Reviewed by:  marcel
  MFC after:2 weeks

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

Modified: head/sys/dev/uart/uart_dev_lpc.c
==
--- head/sys/dev/uart/uart_dev_lpc.cMon May  1 19:34:15 2017
(r317658)
+++ head/sys/dev/uart/uart_dev_lpc.cMon May  1 19:47:10 2017
(r317659)
@@ -345,9 +345,6 @@ lpc_ns8250_putc(struct uart_bas *bas, in
DELAY(4);
uart_setreg(bas, REG_DATA, c);
uart_barrier(bas);
-   limit = 25;
-   while ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0 && --limit)
-   DELAY(4);
 }
 
 static int
@@ -890,8 +887,13 @@ lpc_ns8250_bus_transmit(struct uart_soft
 
bas = >sc_bas;
uart_lock(sc->sc_hwmtx);
-   while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0)
-   ;
+   if (sc->sc_txdatasz > 1) {
+   if ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0)
+   ns8250_drain(bas, UART_DRAIN_TRANSMITTER);
+   } else {
+   while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0)
+   DELAY(4);
+   }
for (i = 0; i < sc->sc_txdatasz; i++) {
uart_setreg(bas, REG_DATA, sc->sc_txbuf[i]);
uart_barrier(bas);

Modified: head/sys/dev/uart/uart_dev_ns8250.c
==
--- head/sys/dev/uart/uart_dev_ns8250.c Mon May  1 19:34:15 2017
(r317658)
+++ head/sys/dev/uart/uart_dev_ns8250.c Mon May  1 19:47:10 2017
(r317659)
@@ -315,7 +315,7 @@ ns8250_init(struct uart_bas *bas, int ba
/* Disable the FIFO (if present). */
val = 0;
 #ifdef CPU_XBURST
-   val = FCR_UART_ON;
+   val |= FCR_UART_ON;
 #endif
uart_setreg(bas, REG_FCR, val);
uart_barrier(bas);
@@ -346,9 +346,6 @@ ns8250_putc(struct uart_bas *bas, int c)
DELAY(4);
uart_setreg(bas, REG_DATA, c);
uart_barrier(bas);
-   limit = 25;
-   while ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0 && --limit)
-   DELAY(4);
 }
 
 static int
@@ -999,8 +996,13 @@ ns8250_bus_transmit(struct uart_softc *s
 
bas = >sc_bas;
uart_lock(sc->sc_hwmtx);
-   while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0)
-   ;
+   if (sc->sc_txdatasz > 1) {
+   if ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0)
+   ns8250_drain(bas, UART_DRAIN_TRANSMITTER);
+   } else {
+   while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0)
+   DELAY(4);
+   }
for (i = 0; i < sc->sc_txdatasz; i++) {
uart_setreg(bas, REG_DATA, sc->sc_txbuf[i]);
uart_barrier(bas);
___
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: r317658 - head/usr.bin

2017-05-01 Thread Bryan Drewery
Author: bdrewery
Date: Mon May  1 19:34:15 2017
New Revision: 317658
URL: https://svnweb.freebsd.org/changeset/base/317658

Log:
  Redo r288270: Hookup mkcsmapper_static and mkesdb_static for 'make clean'
  
  These are only built as part of the top-level 'build-tools' call for
  'make buildworld'.  They still need to be cleaned during the 'make clean'
  treewalks though.
  
  Reported by:  markj
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/usr.bin/Makefile

Modified: head/usr.bin/Makefile
==
--- head/usr.bin/Makefile   Mon May  1 18:53:47 2017(r317657)
+++ head/usr.bin/Makefile   Mon May  1 19:34:15 2017(r317658)
@@ -301,6 +301,12 @@ SUBDIR.${MK_UTMPX}+=   who
 SUBDIR.${MK_SVN}+= svn
 SUBDIR.${MK_SVNLITE}+= svn
 
+# These are normally only handled for build-tools.
+.if make(clean*)
+SUBDIR+=   mkcsmapper_static
+SUBDIR+=   mkesdb_static
+.endif
+
 .include 
 
 SUBDIR:=   ${SUBDIR:O:u}
___
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: r317657 - head/sbin/camcontrol

2017-05-01 Thread Kenneth D. Merry
Author: ken
Date: Mon May  1 18:53:47 2017
New Revision: 317657
URL: https://svnweb.freebsd.org/changeset/base/317657

Log:
  Fix camcontrol timestamp setting and update the man page.
  
  camcontrol timestamp -s would somtimes fail due to stack garbage.  Zero out
  the timestamp parameters to fix it.
  
  Fix another nearby bug, and update the man page.
  
  sbin/camcontrol/timestamp.c:
In set_timestamp(), bzero ts_p prior to creating the timestamp.
Previously stack garbage could cause some tape drives to reject the
timestamp.
  
In set_timestamp(), check for failures from strptime().
  
  sbin/camcontrol/camcontrol.8:
Add the time argument to the -T option to camcontrol timestamp -s
in the long description.
  
Change the time/date format used in the camcontrol timestamp
example to RFC 2822 format.  This fixes a time zone issue with the
original example by specifying the time zone as -0600.  Otherwise,
the time zone seems to default to standard time in the current
locale, which makes the time, when reported back from the drive,
1 hour off from the intended setting.  This also fixes a duplicate
day of the week ("Wednesday Wed") in the previous example.
  
  Submitted by: Sam Klopsch
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/sbin/camcontrol/camcontrol.8
  head/sbin/camcontrol/timestamp.c

Modified: head/sbin/camcontrol/camcontrol.8
==
--- head/sbin/camcontrol/camcontrol.8   Mon May  1 17:10:43 2017
(r317656)
+++ head/sbin/camcontrol/camcontrol.8   Mon May  1 18:53:47 2017
(r317657)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 17, 2017
+.Dd May 1, 2017
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
@@ -2488,7 +2488,7 @@ Specify the strptime format string, as d
 The time must also be specified with the
 .Fl T 
 option.
-.It Fl T
+.It Fl T Ar time
 Provide the time in the format specified with the
 .Fl f
 option.
@@ -2814,8 +2814,8 @@ drive
 .Pa ada0 .
 .Pp
 .Bd -literal -offset indent
-camcontrol timestamp sa0 -s -f "%A %c" \e
-   -T "Wednesday Wed Oct 26 21:43:57 2016"
+camcontrol timestamp sa0 -s -f "%a, %d %b %Y %T %z" \e
+   -T "Wed, 26 Oct 2016 21:43:57 -0600"
 .Ed
 .Pp
 Set the timestamp of drive

Modified: head/sbin/camcontrol/timestamp.c
==
--- head/sbin/camcontrol/timestamp.cMon May  1 17:10:43 2017
(r317656)
+++ head/sbin/camcontrol/timestamp.cMon May  1 18:53:47 2017
(r317657)
@@ -282,12 +282,18 @@ set_timestamp(struct cam_device *device,
ts = (uint64_t) time_value;
} else {
bzero(_struct, sizeof(struct tm));
-   strptime(timestamp_string, format_string, _struct);
+   if (strptime(timestamp_string, format_string,
+   _struct) == NULL) {
+   warnx("%s: strptime(3) failed", __func__);
+   error = 1;
+   goto bailout;
+   }
time_value = mktime(_struct);
ts = (uint64_t) time_value;
}
/* Convert time from seconds to milliseconds */
ts *= 1000;
+   bzero(_p, sizeof(ts_p));
scsi_create_timestamp(ts_p.timestamp, ts);
 
scsi_set_timestamp(>csio,
___
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: r317656 - stable/11/sys/dev/ieee488

2017-05-01 Thread Brooks Davis
Author: brooks
Date: Mon May  1 17:10:43 2017
New Revision: 317656
URL: https://svnweb.freebsd.org/changeset/base/317656

Log:
  Partial, manual MFC of r317411:
  
  Remove directory made empty by IEEE488 removal.

Deleted:
  stable/11/sys/dev/ieee488/
Modified:
Directory Properties:
  stable/11/   (props changed)
___
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: r317655 - stable/11/usr.sbin/ntp/sntp

2017-05-01 Thread Brooks Davis
Author: brooks
Date: Mon May  1 17:02:51 2017
New Revision: 317655
URL: https://svnweb.freebsd.org/changeset/base/317655

Log:
  MFC r317388:
  
  Use the approved syntax to build no man pages.
  
  Sponsored by: DARPA, AFRL

Modified:
  stable/11/usr.sbin/ntp/sntp/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/ntp/sntp/Makefile
==
--- stable/11/usr.sbin/ntp/sntp/MakefileMon May  1 17:01:00 2017
(r317654)
+++ stable/11/usr.sbin/ntp/sntp/MakefileMon May  1 17:02:51 2017
(r317655)
@@ -5,7 +5,7 @@
 .PATH: ${.CURDIR}/../../../contrib/ntp/sntp
 
 PROG=  sntp
-MK_MAN=no
+MAN=
 SRCS=  crypto.c kod_management.c log.c main.c networking.c \
sntp-opts.c sntp.c utilities.c
 
___
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: r317654 - head/sys/cddl/dev/dtrace

2017-05-01 Thread Mark Johnston
Author: markj
Date: Mon May  1 17:01:00 2017
New Revision: 317654
URL: https://svnweb.freebsd.org/changeset/base/317654

Log:
  Fix a harmless LOR in dtrace_load().
  
  MFC after:1 week

Modified:
  head/sys/cddl/dev/dtrace/dtrace_load.c

Modified: head/sys/cddl/dev/dtrace/dtrace_load.c
==
--- head/sys/cddl/dev/dtrace/dtrace_load.c  Mon May  1 16:59:54 2017
(r317653)
+++ head/sys/cddl/dev/dtrace/dtrace_load.c  Mon May  1 17:01:00 2017
(r317654)
@@ -97,11 +97,9 @@ dtrace_load(void *dummy)
mutex_init(_errlock,"dtrace error lock", MUTEX_DEFAULT, NULL);
 #endif
 
+   mutex_enter(_lock);
mutex_enter(_provider_lock);
mutex_enter(_lock);
-   mutex_enter(_lock);
-
-   ASSERT(MUTEX_HELD(_lock));
 
dtrace_state_cache = kmem_cache_create("dtrace_state_cache",
sizeof (dtrace_dstate_percpu_t) * NCPU, DTRACE_STATE_ALIGN,
@@ -151,13 +149,9 @@ dtrace_load(void *dummy)
dtrace_probeid_error = dtrace_probe_create((dtrace_provider_id_t)
dtrace_provider, NULL, NULL, "ERROR", 1, NULL);
 
-   mutex_exit(_lock);
-
mutex_exit(_lock);
mutex_exit(_provider_lock);
 
-   mutex_enter(_lock);
-
 #ifdef EARLY_AP_STARTUP
CPU_FOREACH(i) {
(void) dtrace_cpu_setup(CPU_CONFIG, i);
@@ -173,6 +167,4 @@ dtrace_load(void *dummy)
"dtrace/dtrace");
helper_dev = make_dev(_cdevsw, 0, UID_ROOT, GID_WHEEL, 0660,
"dtrace/helper");
-
-   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: r317653 - stable/11/usr.bin/getaddrinfo

2017-05-01 Thread Brooks Davis
Author: brooks
Date: Mon May  1 16:59:54 2017
New Revision: 317653
URL: https://svnweb.freebsd.org/changeset/base/317653

Log:
  MFC r317385:
  
  Clean up Makefile.
  
  Prefer SRCTOP vs .CURDIR relative paths.
  
  Find libnetbsd using LIBADD infrastructure rather than manual hackery.
  
  Reviewed by:  ngie, bapt
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL

Modified:
  stable/11/usr.bin/getaddrinfo/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/getaddrinfo/Makefile
==
--- stable/11/usr.bin/getaddrinfo/Makefile  Mon May  1 16:56:34 2017
(r317652)
+++ stable/11/usr.bin/getaddrinfo/Makefile  Mon May  1 16:59:54 2017
(r317653)
@@ -3,19 +3,15 @@
 .include 
 
 PROG=  getaddrinfo
+SRCS=  getaddrinfo.c tables.h
 
-CFLAGS+=   -I${.CURDIR}/../../lib/libnetbsd
-LIBNETBSDDIR=  ${.OBJDIR}/../../lib/libnetbsd
-LIBNETBSD= ${LIBNETBSDDIR}/libnetbsd.a
-DPADD+=${LIBNETBSD}
-LDADD+=${LIBNETBSD}
+CFLAGS+=   -I${SRCTOP}/lib/libnetbsd
 
-LIBADD+=   util
+LIBADD+=   netbsd util
 
-SYS_SOCKET_H?= ${.CURDIR}/../../sys/sys/socket.h
+SYS_SOCKET_H?= ${SRCTOP}/sys/sys/socket.h
 
-CFLAGS+=   -I.
-DPSRCS+=   tables.h
+CFLAGS+=   -I${.OBJDIR}
 CLEANFILES+=   tables.h
 tables.h: tables.awk ${SYS_SOCKET_H}
LC_ALL=C awk -f ${.ALLSRC} > ${.TARGET}
___
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: r317652 - head/sys/boot/efi/loader

2017-05-01 Thread Toomas Soome
Author: tsoome
Date: Mon May  1 16:56:34 2017
New Revision: 317652
URL: https://svnweb.freebsd.org/changeset/base/317652

Log:
  loader.efi: ResetSystem does not use data with EFI_SUCCESS
  
  The current reboot command in efi/loader/main.c is passing extra data with
  ResetSystem, however, UEFI spec 2.6, page 265 does state:
  
  "ResetData is only valid if ResetStatus is something other than EFI_SUCCESS
  unless the ResetType is EfiResetPlatformSpecific where a minimum amount of
  ResetData is always required."
  
  Therefore we should use DataSize 0 and ResetData NULL - those are two last
  arguments for the call.
  
  Reviewed by:  emaste
  Differential Revision:https://reviews.freebsd.org/D10562

Modified:
  head/sys/boot/efi/loader/main.c

Modified: head/sys/boot/efi/loader/main.c
==
--- head/sys/boot/efi/loader/main.c Mon May  1 16:32:28 2017
(r317651)
+++ head/sys/boot/efi/loader/main.c Mon May  1 16:56:34 2017
(r317652)
@@ -507,8 +507,7 @@ command_reboot(int argc, char *argv[])
if (devsw[i]->dv_cleanup != NULL)
(devsw[i]->dv_cleanup)();
 
-   RS->ResetSystem(EfiResetCold, EFI_SUCCESS, 23,
-   (CHAR16 *)"Reboot from the loader");
+   RS->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);
 
/* NOTREACHED */
return (CMD_ERROR);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r317632 - head/sys

2017-05-01 Thread Warner Losh
On Mon, May 1, 2017 at 10:30 AM, Rodney W. Grimes
 wrote:
>> Author: ngie
>> Date: Mon May  1 05:59:52 2017
>> New Revision: 317632
>> URL: https://svnweb.freebsd.org/changeset/base/317632
>>
>> Log:
>>   Fix "make cscope-clean" when .OBJDIR already exists
>>
>>   The cscope generated files are always put in .CURDIR .
>
> If this is writing to src dir then it should be fixed,
> or have we abandoned all hope of readonly src tree?

This is only for the cscope target, which isn't part of the normal build.

readonly src tree works great still

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: r317651 - in head/sys/compat/linuxkpi/common: include/asm include/linux src

2017-05-01 Thread Mark Johnston
Author: markj
Date: Mon May  1 16:32:28 2017
New Revision: 317651
URL: https://svnweb.freebsd.org/changeset/base/317651

Log:
  Add on_each_cpu() and wbinvd_on_all_cpus().
  
  Reviewed by:  hselasky
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D10550

Added:
  head/sys/compat/linuxkpi/common/include/asm/smp.h   (contents, props changed)
  head/sys/compat/linuxkpi/common/include/linux/smp.h   (contents, props 
changed)
Modified:
  head/sys/compat/linuxkpi/common/src/linux_compat.c

Added: head/sys/compat/linuxkpi/common/include/asm/smp.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/compat/linuxkpi/common/include/asm/smp.h   Mon May  1 16:32:28 
2017(r317651)
@@ -0,0 +1,40 @@
+/*-
+ * Copyright (c) 2017 Mark Johnston 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in
+ *the documentation and/or other materials provided with the
+ *distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _ASM_SMP_H_
+#define_ASM_SMP_H_
+
+#if defined(__i386__) || defined(__amd64__)
+
+#definewbinvd_on_all_cpus()linux_wbinvd_on_all_cpus()
+
+intlinux_wbinvd_on_all_cpus(void);
+
+#endif
+
+#endif /* _ASM_SMP_H_ */

Added: head/sys/compat/linuxkpi/common/include/linux/smp.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/compat/linuxkpi/common/include/linux/smp.h Mon May  1 16:32:28 
2017(r317651)
@@ -0,0 +1,39 @@
+/*-
+ * Copyright (c) 2017 Mark Johnston 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in
+ *the documentation and/or other materials provided with the
+ *distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _LINUX_SMP_H_
+#define_LINUX_SMP_H_
+
+#defineon_each_cpu(cb, data, wait) ({  \
+   CTASSERT(wait); \
+   linux_on_each_cpu(cb, data);\
+})
+
+extern int linux_on_each_cpu(void (*)(void *), void *);
+
+#endif /* _LINUX_SMP_H_ */

Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c
==
--- head/sys/compat/linuxkpi/common/src/linux_compat.c  Mon May  1 15:03:40 
2017(r317650)
+++ head/sys/compat/linuxkpi/common/src/linux_compat.c  Mon May  1 16:32:28 
2017(r317651)
@@ -48,6 +48,9 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 

Re: svn commit: r317631 - head/sys

2017-05-01 Thread Warner Losh
No, this disconnected netnatm from the cscope target. sys/Makefile is
normally unused otherwise in the build process.

Warner

On Mon, May 1, 2017 at 10:28 AM, Rodney W. Grimes
 wrote:
>> Author: ngie
>> Date: Mon May  1 05:54:33 2017
>> New Revision: 317631
>> URL: https://svnweb.freebsd.org/changeset/base/317631
>>
>> Log:
>>   Fix "make cscope" after r317411
>
> This commit is disconnect netnatm module from build
>
> ?  Mixed 2 commit messages perhaps?
>
>>   Sponsored by:   Dell EMC Isilon
>>
>> Modified:
>>   head/sys/Makefile
>>
>> Modified: head/sys/Makefile
>> ==
>> --- head/sys/Makefile Mon May  1 02:08:44 2017(r317630)
>> +++ head/sys/Makefile Mon May  1 05:54:33 2017(r317631)
>> @@ -3,7 +3,7 @@
>>  # Directories to include in cscope name file and TAGS.
>>  CSCOPEDIRS=  boot bsm cam cddl compat conf contrib crypto ddb dev fs gdb \
>>   geom gnu isa kern libkern modules net net80211 \
>> - netgraph netinet netinet6 netipsec netnatm netpfil \
>> + netgraph netinet netinet6 netipsec netpfil \
>>   netsmb nfs nfsclient nfsserver nlm ofed opencrypto \
>>   rpc security sys ufs vm xdr xen ${CSCOPE_ARCHDIR}
>>  .if !defined(CSCOPE_ARCHDIR)
>>
>>
>
> --
> Rod Grimes rgri...@freebsd.org
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r317632 - head/sys

2017-05-01 Thread Rodney W. Grimes
> Author: ngie
> Date: Mon May  1 05:59:52 2017
> New Revision: 317632
> URL: https://svnweb.freebsd.org/changeset/base/317632
> 
> Log:
>   Fix "make cscope-clean" when .OBJDIR already exists
>   
>   The cscope generated files are always put in .CURDIR .

If this is writing to src dir then it should be fixed,
or have we abandoned all hope of readonly src tree?

>   MFC after:  1 month
>   Sponsored by:   Dell EMC Isilon
> 
> Modified:
>   head/sys/Makefile
> 
> Modified: head/sys/Makefile
> ==
> --- head/sys/Makefile Mon May  1 05:54:33 2017(r317631)
> +++ head/sys/Makefile Mon May  1 05:59:52 2017(r317632)
> @@ -32,7 +32,8 @@ ${.CURDIR}/cscope.files: .PHONY
>   find ${CSCOPEDIRS} -name "*.[chSsly]" -a -type f > ${.TARGET}
>  
>  cscope-clean:
> - rm -f cscope.files cscope.out cscope.in.out cscope.po.out
> + cd ${.CURDIR}; \
> + rm -f cscope.files cscope.out cscope.in.out cscope.po.out
>  
>  #
>  # Installs SCM hooks to update the cscope database every time the source tree
> 
> 

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


Re: svn commit: r317631 - head/sys

2017-05-01 Thread Rodney W. Grimes
> Author: ngie
> Date: Mon May  1 05:54:33 2017
> New Revision: 317631
> URL: https://svnweb.freebsd.org/changeset/base/317631
> 
> Log:
>   Fix "make cscope" after r317411

This commit is disconnect netnatm module from build

?  Mixed 2 commit messages perhaps?

>   Sponsored by:   Dell EMC Isilon
> 
> Modified:
>   head/sys/Makefile
> 
> Modified: head/sys/Makefile
> ==
> --- head/sys/Makefile Mon May  1 02:08:44 2017(r317630)
> +++ head/sys/Makefile Mon May  1 05:54:33 2017(r317631)
> @@ -3,7 +3,7 @@
>  # Directories to include in cscope name file and TAGS.
>  CSCOPEDIRS=  boot bsm cam cddl compat conf contrib crypto ddb dev fs gdb \
>   geom gnu isa kern libkern modules net net80211 \
> - netgraph netinet netinet6 netipsec netnatm netpfil \
> + netgraph netinet netinet6 netipsec netpfil \
>   netsmb nfs nfsclient nfsserver nlm ofed opencrypto \
>   rpc security sys ufs vm xdr xen ${CSCOPE_ARCHDIR}
>  .if !defined(CSCOPE_ARCHDIR)
> 
> 

-- 
Rod Grimes rgri...@freebsd.org
___
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: r317650 - vendor/openpam/RESEDACEA

2017-05-01 Thread Dag-Erling Smørgrav
Author: des
Date: Mon May  1 15:03:40 2017
New Revision: 317650
URL: https://svnweb.freebsd.org/changeset/base/317650

Log:
  Tag OpenPAM Resedacea.

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


svn commit: r317649 - in vendor/openpam/dist: . bin bin/openpam_dump_policy bin/pamtest bin/su doc doc/man include include/security lib lib/libpam misc modules modules/pam_deny modules/pam_permit m...

2017-05-01 Thread Dag-Erling Smørgrav
Author: des
Date: Mon May  1 15:02:58 2017
New Revision: 317649
URL: https://svnweb.freebsd.org/changeset/base/317649

Log:
  Vendor import of OpenPAM Resedacea.

Modified:
  vendor/openpam/dist/HISTORY
  vendor/openpam/dist/Makefile.am
  vendor/openpam/dist/Makefile.in
  vendor/openpam/dist/RELNOTES
  vendor/openpam/dist/autogen.sh
  vendor/openpam/dist/bin/Makefile.am
  vendor/openpam/dist/bin/Makefile.in
  vendor/openpam/dist/bin/openpam_dump_policy/Makefile.am
  vendor/openpam/dist/bin/openpam_dump_policy/Makefile.in
  vendor/openpam/dist/bin/openpam_dump_policy/openpam_dump_policy.c
  vendor/openpam/dist/bin/pamtest/Makefile.am
  vendor/openpam/dist/bin/pamtest/Makefile.in
  vendor/openpam/dist/bin/pamtest/pamtest.1
  vendor/openpam/dist/bin/pamtest/pamtest.c
  vendor/openpam/dist/bin/su/Makefile.am
  vendor/openpam/dist/bin/su/Makefile.in
  vendor/openpam/dist/bin/su/su.1
  vendor/openpam/dist/bin/su/su.c
  vendor/openpam/dist/configure
  vendor/openpam/dist/configure.ac
  vendor/openpam/dist/doc/Makefile.am
  vendor/openpam/dist/doc/Makefile.in
  vendor/openpam/dist/doc/man/Makefile.am
  vendor/openpam/dist/doc/man/Makefile.in
  vendor/openpam/dist/doc/man/openpam.3
  vendor/openpam/dist/doc/man/openpam.man
  vendor/openpam/dist/doc/man/openpam_borrow_cred.3
  vendor/openpam/dist/doc/man/openpam_free_data.3
  vendor/openpam/dist/doc/man/openpam_free_envlist.3
  vendor/openpam/dist/doc/man/openpam_get_feature.3
  vendor/openpam/dist/doc/man/openpam_get_option.3
  vendor/openpam/dist/doc/man/openpam_log.3
  vendor/openpam/dist/doc/man/openpam_nullconv.3
  vendor/openpam/dist/doc/man/openpam_readline.3
  vendor/openpam/dist/doc/man/openpam_readlinev.3
  vendor/openpam/dist/doc/man/openpam_readword.3
  vendor/openpam/dist/doc/man/openpam_restore_cred.3
  vendor/openpam/dist/doc/man/openpam_set_feature.3
  vendor/openpam/dist/doc/man/openpam_set_option.3
  vendor/openpam/dist/doc/man/openpam_straddch.3
  vendor/openpam/dist/doc/man/openpam_subst.3
  vendor/openpam/dist/doc/man/openpam_ttyconv.3
  vendor/openpam/dist/doc/man/pam.3
  vendor/openpam/dist/doc/man/pam.conf.5
  vendor/openpam/dist/doc/man/pam.man
  vendor/openpam/dist/doc/man/pam_acct_mgmt.3
  vendor/openpam/dist/doc/man/pam_authenticate.3
  vendor/openpam/dist/doc/man/pam_chauthtok.3
  vendor/openpam/dist/doc/man/pam_close_session.3
  vendor/openpam/dist/doc/man/pam_conv.3
  vendor/openpam/dist/doc/man/pam_end.3
  vendor/openpam/dist/doc/man/pam_error.3
  vendor/openpam/dist/doc/man/pam_get_authtok.3
  vendor/openpam/dist/doc/man/pam_get_data.3
  vendor/openpam/dist/doc/man/pam_get_item.3
  vendor/openpam/dist/doc/man/pam_get_user.3
  vendor/openpam/dist/doc/man/pam_getenv.3
  vendor/openpam/dist/doc/man/pam_getenvlist.3
  vendor/openpam/dist/doc/man/pam_info.3
  vendor/openpam/dist/doc/man/pam_open_session.3
  vendor/openpam/dist/doc/man/pam_prompt.3
  vendor/openpam/dist/doc/man/pam_putenv.3
  vendor/openpam/dist/doc/man/pam_set_data.3
  vendor/openpam/dist/doc/man/pam_set_item.3
  vendor/openpam/dist/doc/man/pam_setcred.3
  vendor/openpam/dist/doc/man/pam_setenv.3
  vendor/openpam/dist/doc/man/pam_sm_acct_mgmt.3
  vendor/openpam/dist/doc/man/pam_sm_authenticate.3
  vendor/openpam/dist/doc/man/pam_sm_chauthtok.3
  vendor/openpam/dist/doc/man/pam_sm_close_session.3
  vendor/openpam/dist/doc/man/pam_sm_open_session.3
  vendor/openpam/dist/doc/man/pam_sm_setcred.3
  vendor/openpam/dist/doc/man/pam_start.3
  vendor/openpam/dist/doc/man/pam_strerror.3
  vendor/openpam/dist/doc/man/pam_verror.3
  vendor/openpam/dist/doc/man/pam_vinfo.3
  vendor/openpam/dist/doc/man/pam_vprompt.3
  vendor/openpam/dist/include/Makefile.am
  vendor/openpam/dist/include/Makefile.in
  vendor/openpam/dist/include/security/Makefile.am
  vendor/openpam/dist/include/security/Makefile.in
  vendor/openpam/dist/include/security/openpam.h
  vendor/openpam/dist/include/security/openpam_attr.h
  vendor/openpam/dist/include/security/openpam_version.h
  vendor/openpam/dist/include/security/pam_appl.h
  vendor/openpam/dist/include/security/pam_constants.h
  vendor/openpam/dist/include/security/pam_modules.h
  vendor/openpam/dist/include/security/pam_types.h
  vendor/openpam/dist/lib/Makefile.am
  vendor/openpam/dist/lib/Makefile.in
  vendor/openpam/dist/lib/libpam/Makefile.am
  vendor/openpam/dist/lib/libpam/Makefile.in
  vendor/openpam/dist/lib/libpam/openpam_asprintf.c
  vendor/openpam/dist/lib/libpam/openpam_asprintf.h
  vendor/openpam/dist/lib/libpam/openpam_borrow_cred.c
  vendor/openpam/dist/lib/libpam/openpam_check_owner_perms.c
  vendor/openpam/dist/lib/libpam/openpam_configure.c
  vendor/openpam/dist/lib/libpam/openpam_constants.c
  vendor/openpam/dist/lib/libpam/openpam_constants.h
  vendor/openpam/dist/lib/libpam/openpam_cred.h
  vendor/openpam/dist/lib/libpam/openpam_ctype.h
  vendor/openpam/dist/lib/libpam/openpam_debug.h
  vendor/openpam/dist/lib/libpam/openpam_dispatch.c
  vendor/openpam/dist/lib/libpam/openpam_dlfunc.h
  

svn commit: r317648 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2017-05-01 Thread Josh Paetzel
Author: jpaetzel
Date: Mon May  1 12:56:12 2017
New Revision: 317648
URL: https://svnweb.freebsd.org/changeset/base/317648

Log:
  Fix misport of compressed ZFS send/recv from 317414
  
  Reported by:  Michael Jung 
  Reviewed by:  avg

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Mon May  1 
12:42:06 2017(r317647)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Mon May  1 
12:56:12 2017(r317648)
@@ -962,7 +962,7 @@ zio_free_sync(zio_t *pio, spa_t *spa, ui
flags |= ZIO_FLAG_DONT_QUEUE;
 
zio = zio_create(pio, spa, txg, bp, NULL, size,
-   BP_GET_PSIZE(bp), NULL, NULL, ZIO_TYPE_FREE, ZIO_PRIORITY_NOW,
+   size, NULL, NULL, ZIO_TYPE_FREE, ZIO_PRIORITY_NOW,
flags, NULL, 0, NULL, ZIO_STAGE_OPEN, stage);
 
return (zio);
___
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: r317647 - in stable/11/lib/libc: string tests/string

2017-05-01 Thread Baptiste Daroussin
Author: bapt
Date: Mon May  1 12:42:06 2017
New Revision: 317647
URL: https://svnweb.freebsd.org/changeset/base/317647

Log:
  MFC r317034:
  
  Fix strcoll_l disagreeing with strxfrm by reworking the forward order case in
  wcscoll_l().
  
  Illumos fixed this while grabbing back our patches:
  https://www.illumos.org/rb/r/402/
  
  This does not 100% fix what postgresql folks reported as there is still a
  remaining issue: https://www.illumos.org/issues/7962, it improves the 
situation
  
  The initial issue was reported in postgresql mailing lists:
  
https://www.postgresql.org/message-id/flat/111d0e27-a8f3-4a84-a4e0-b0fb70386...@s24.com#111d0e27-a8f3-4a84-a4e0-b0fb70386...@s24.com
  
  Submitted by: Yuri Pankov 
  Obtained from:Illumos

Modified:
  stable/11/lib/libc/string/wcscoll.c
  stable/11/lib/libc/tests/string/wcscoll_test.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/string/wcscoll.c
==
--- stable/11/lib/libc/string/wcscoll.c Mon May  1 12:41:10 2017
(r317646)
+++ stable/11/lib/libc/string/wcscoll.c Mon May  1 12:42:06 2017
(r317647)
@@ -1,5 +1,5 @@
 /*-
- * Copyright 2010 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright 2017 Nexenta Systems, Inc.
  * Copyright (c) 2002 Tim J. Robbins
  * All rights reserved.
  *
@@ -42,22 +42,22 @@ __FBSDID("$FreeBSD$");
 int
 wcscoll_l(const wchar_t *ws1, const wchar_t *ws2, locale_t locale)
 {
-   int len1, len2, pri1, pri2, ret;
+   int len1, len2, pri1, pri2;
wchar_t *tr1 = NULL, *tr2 = NULL;
int direc, pass;
+   int ret = wcscmp(ws1, ws2);
 
FIX_LOCALE(locale);
struct xlocale_collate *table =
(struct xlocale_collate*)locale->components[XLC_COLLATE];
 
-   if (table->__collate_load_error)
-   /*
-* Locale has no special collating order or could not be
-* loaded, do a fast binary comparison.
-*/
-   return (wcscmp(ws1, ws2));
+   if (table->__collate_load_error || ret == 0)
+   return (ret);
 
-   ret = 0;
+   if (*ws1 == 0 && *ws2 != 0)
+   return (-1);
+   if (*ws1 != 0 && *ws2 == 0)
+   return (1);
 
/*
 * Once upon a time we had code to try to optimize this, but
@@ -77,19 +77,19 @@ wcscoll_l(const wchar_t *ws1, const wcha
const int32_t *st2 = NULL;
const wchar_t   *w1 = ws1;
const wchar_t   *w2 = ws2;
-   int check1, check2;
 
/* special pass for UNDEFINED */
if (pass == table->info->directive_count) {
-   direc = DIRECTIVE_FORWARD | DIRECTIVE_UNDEFINED;
+   direc = DIRECTIVE_FORWARD;
} else {
direc = table->info->directive[pass];
}
 
if (direc & DIRECTIVE_BACKWARD) {
wchar_t *bp, *fp, c;
+   free(tr1);
if ((tr1 = wcsdup(w1)) == NULL)
-   goto fail;
+   goto end;
bp = tr1;
fp = tr1 + wcslen(tr1) - 1;
while (bp < fp) {
@@ -97,8 +97,9 @@ wcscoll_l(const wchar_t *ws1, const wcha
*bp++ = *fp;
*fp-- = c;
}
+   free(tr2);
if ((tr2 = wcsdup(w2)) == NULL)
-   goto fail;
+   goto end;
bp = tr2;
fp = tr2 + wcslen(tr2) - 1;
while (bp < fp) {
@@ -111,6 +112,7 @@ wcscoll_l(const wchar_t *ws1, const wcha
}
 
if (direc & DIRECTIVE_POSITION) {
+   int check1, check2;
while (*w1 && *w2) {
pri1 = pri2 = 0;
check1 = check2 = 1;
@@ -120,7 +122,7 @@ wcscoll_l(const wchar_t *ws1, const wcha
, pass, );
if (pri1 < 0) {
errno = EINVAL;
-   goto fail;
+   goto end;
}
if (!pri1) {
pri1 = 
COLLATE_MAX_PRIORITY;
@@ -133,7 +135,7 @@ wcscoll_l(const wchar_t *ws1, const wcha
, pass, );
if (pri2 < 0) {
   

svn commit: r317646 - stable/11/lib/libc/tests/string

2017-05-01 Thread Baptiste Daroussin
Author: bapt
Date: Mon May  1 12:41:10 2017
New Revision: 317646
URL: https://svnweb.freebsd.org/changeset/base/317646

Log:
  MFC r302920
  
  Add a regression test to make sure the Russian collation is actually working
  
  when importing collation support from Dragonfly/Illumos amdmi3@ tested the
  collation branch and reported an issue with Russian collation. John Marino 
fixed
  the issue in Dragonfly and I merged it back to FreeBSD.
  
  Now that Illumos is working on merging our fixes they (Lauri Tirkkonen) found
  issues with the commit that fixes the russian collation in UTF-8 that resulted
  in a crash with strxfrm(3) and the ISO-8859-5 locale (fixed in FreeBSD 
r302916).
  This small test was written to ensure we do not bring back the old issue with
  russian collation while fixing the other issue.

Added:
  stable/11/lib/libc/tests/string/wcscoll_test.c
 - copied unchanged from r302920, head/lib/libc/tests/string/wcscoll_test.c
Modified:
  stable/11/lib/libc/tests/string/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/tests/string/Makefile
==
--- stable/11/lib/libc/tests/string/MakefileMon May  1 12:25:37 2017
(r317645)
+++ stable/11/lib/libc/tests/string/MakefileMon May  1 12:41:10 2017
(r317646)
@@ -6,6 +6,7 @@ ATF_TESTS_C+=   stpncpy_test
 ATF_TESTS_C+=  strerror2_test
 ATF_TESTS_C+=  wcscasecmp_test
 ATF_TESTS_C+=  wcsnlen_test
+ATF_TESTS_C+=  wcscoll_test
 
 # TODO: popcount, stresep
 

Copied: stable/11/lib/libc/tests/string/wcscoll_test.c (from r302920, 
head/lib/libc/tests/string/wcscoll_test.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/lib/libc/tests/string/wcscoll_test.c  Mon May  1 12:41:10 
2017(r317646, copy of r302920, 
head/lib/libc/tests/string/wcscoll_test.c)
@@ -0,0 +1,63 @@
+/*-
+ * Copyright (c) 2016 Baptiste Daroussin 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+
+#include 
+
+static int
+cmp(const void *a, const void *b)
+{
+   const wchar_t wa[2] = { *(const wchar_t *)a, 0 };
+   const wchar_t wb[2] = { *(const wchar_t *)b, 0 };
+
+   return (wcscoll(wa, wb));
+}
+
+ATF_TC_WITHOUT_HEAD(russian_collation);
+ATF_TC_BODY(russian_collation, tc)
+{
+   wchar_t c[] = 
L"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzЁАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяё";
+   wchar_t res[] = 
L"aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяЯ";
+
+   ATF_CHECK_MSG(setlocale(LC_ALL, "ru_RU.UTF-8") != NULL,
+   "Fail to set locale to \"ru_RU.UTF-8\"");
+   qsort(c, wcslen(c), sizeof(wchar_t), cmp);
+   ATF_CHECK_MSG(wcscmp(c, res) == 0,
+   "Bad collation, expected: '%ls' got '%ls'", res, c);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+   ATF_TP_ADD_TC(tp, russian_collation);
+
+   return (atf_no_error());
+}
___
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: r317645 - head/sys/compat/linux

2017-05-01 Thread Dmitry Chagin
Author: dchagin
Date: Mon May  1 12:25:37 2017
New Revision: 317645
URL: https://svnweb.freebsd.org/changeset/base/317645

Log:
  Fix NULL pointer dereference in futex_wake_op() in case when the same
  address specified for arguments uaddr and uaddr2.
  
  PR:   218987
  Reported by:  luke.tw gmail
  MFC after:1 week

Modified:
  head/sys/compat/linux/linux_futex.c

Modified: head/sys/compat/linux/linux_futex.c
==
--- head/sys/compat/linux/linux_futex.c Mon May  1 10:12:59 2017
(r317644)
+++ head/sys/compat/linux/linux_futex.c Mon May  1 12:25:37 2017
(r317645)
@@ -952,6 +952,11 @@ retry1:
args->uaddr, args->val, args->uaddr2, args->val3,
args->timeout);
 
+   if (args->uaddr == args->uaddr2) {
+   LIN_SDT_PROBE1(futex, linux_sys_futex, return, EINVAL);
+   return (EINVAL);
+   }
+
 retry2:
error = futex_get(args->uaddr, NULL, , flags | 
FUTEX_DONTLOCK);
if (error) {
@@ -959,9 +964,7 @@ retry2:
return (error);
}
 
-   if (args->uaddr != args->uaddr2)
-   error = futex_get(args->uaddr2, NULL, ,
-   flags | FUTEX_DONTLOCK);
+   error = futex_get(args->uaddr2, NULL, , flags | 
FUTEX_DONTLOCK);
if (error) {
futex_put(f, 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"


Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocf

2017-05-01 Thread Bruce Evans

On Sun, 30 Apr 2017, Konstantin Belousov wrote:


On Wed, Apr 19, 2017 at 02:09:58PM +1000, Bruce Evans wrote:

On Tue, 18 Apr 2017, Alan Somers wrote:


On Mon, Apr 17, 2017 at 11:34 AM, Gleb Smirnoff  wrote:



  head/usr.bin/top/machine.c
  head/usr.bin/vmstat/vmstat.c


The previous 2 lines turn out to be relevant.  I missed the update to
vmstat and checked a wrong version in my bug report described below
I checked an updated top, but the change seemed too small to help.
systat was not updated.


This change broke backwards compatibility with old top binaries.  When
I use a kernel at version 317094 but a top from 14-April, I get the
error "top: sysctl(vm.stats.vm.v_swappgsin...) failed: Cannot allocate
memory".  I get the same error when running top from an 11.0-RELEASE
jail.  Can you please add backward compatibility shims?


I sent a much longer (30 times longer) bug report to the author of the
bug.

Most or all statistics utilities that use vmmeter are broken.  vmstat
is too broken to even notice the bug -- it silently ignores the error,
an has type errors which prevent other errors which it doesn't ignore.
The result is silently truncating to 32 bits, like a quick fix would
do intentionally.  systat -v detects the errors but prints warning
messages to the status line where they overwrite each other so make
the problem look smaller than it is.  The result is unsilently
truncating to 32 bits.

I've never seen any backwards compatibility shims added for sysctls.
None should be needed, but there are few or no utilities other than
sysctl(8) which use sysctl(3) in a portable way.

See vfs.bufspace handled by vfs_bio.c:sysctl_bufspace().


Ugh.

My fix for this continues to work fine.  It handles about 162
combinations of integer sizes/signedness for all sysctls in not much
more space than sysctl_bufspace().  Unfortunately, the full version
breaks the API slightly (it even breaks sysctl(8)), and the dumbed
down version causes problems although it technically doesn't change
the API.

sysctl_bufspace() also changes the API slightly, much like my dumbed
down version.  This tends to break probes.


In fact, not only top and vmstat are broken. Quite unexpected and
worrying, reboot(8) is broken as well. This is due to get_pageins()
failing and system stopping userspace much earlier than it is desirable.

I now believe that compat shims to handle int-sized vmstat queries are
required.


Here are my current versions and a test program (mainly for old design
and implementation bugs with short reads and writes).

XX Index: kern_sysctl.c
XX ===
XX --- kern_sysctl.c(revision 317604)
XX +++ kern_sysctl.c(working copy)

This version changes the API too much, and I now use the simpler patch
to fix the immediate problem with counters.

The full version of it does:
- let userland do reads and writes of integers with any size large enough
  to hold the value
- new errno EOVERFLOW for userland sizes that are not large enough.  This
  replaces ENOMEM in most cases for integer sysctls.  Only oldlen = 0
  should mean to probe.
- new errno EOVERFLOW for kernel sizes that are not large enough.Be
  more careful not to write anything if the kernel size is not large
  enough.  The previous errno for this is EINVAL.
- it is no longer very fragile to read with a type larger than the kernel
  type.  The kernel expands to the requested size.  This used to be a
  non-error with garbage in the bits after the end of the unexpanded
  kernel size.
- it is now possible to write with a type smaller than the kernel type.
  The kernel expands to its size.  The case is documented to fail with
  EINVAL, and works as documented IIRC.
- it is now possible to write correctly with a type larger than the
  kernel type, provided the value fits.  The case is documented to fail
  with EINVAL, but IIRC it is the case that has been broken for almost
  20 years.  Usually, the bug is harmless since the value fits (due to
  are 0's or 1's in the unwritten top bits).

The dumbed down version keeps ENOMEM instead of EOVERFLOW, and doesn't
allow all combinations of sizes.  For the counter ABI change, the case
where the userland variable is smaller must be supported for reading,
and the opposite is not needed yet.  I forget what happens for writing.

XX @@ -1344,6 +1344,302 @@
XX  return (error);
XX  }
XX 
XX +int sysctl_uicvt(const void *src, size_t srclen, void *dst, size_t dstlen);

XX +int
XX +sysctl_uicvt(const void *src, size_t srclen, void *dst, size_t dstlen)
XX +{
XX +uintmax_t val, valtrunc;
XX +uint64_t val64;
XX +uint32_t val32;
XX +uint16_t val16;
XX +uint8_t val8;
XX +
XX +if (dstlen > sizeof(uintmax_t))
XX +dstlen = sizeof(uintmax_t);
XX +if (dstlen > srclen)
XX +dstlen = srclen;

The conversion functions are trivial, but not as small or as fast as
they could be.  In most case, no conversion is 

svn commit: r317637 - stable/11/sys/compat/linux

2017-05-01 Thread Dmitry Chagin
Author: dchagin
Date: Mon May  1 06:42:39 2017
New Revision: 317637
URL: https://svnweb.freebsd.org/changeset/base/317637

Log:
  MFC r316426:
  
  Use the kern_clock_nanosleep() to implement Linux clock_nanosleep() with
  the proper handling of the TIMER_ABSTIME flag.

Modified:
  stable/11/sys/compat/linux/linux_time.c
  stable/11/sys/compat/linux/linux_timer.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linux/linux_time.c
==
--- stable/11/sys/compat/linux/linux_time.c Mon May  1 06:05:04 2017
(r317636)
+++ stable/11/sys/compat/linux/linux_time.c Mon May  1 06:42:39 2017
(r317637)
@@ -231,6 +231,18 @@ linux_to_native_clockid(clockid_t *n, cl
 }
 
 int
+linux_to_native_timerflags(int *nflags, int flags)
+{
+
+   if (flags & ~LINUX_TIMER_ABSTIME)
+   return (EINVAL);
+   *nflags = 0;
+   if (flags & LINUX_TIMER_ABSTIME)
+   *nflags |= TIMER_ABSTIME;
+   return (0);
+}
+
+int
 linux_clock_gettime(struct thread *td, struct linux_clock_gettime_args *args)
 {
struct l_timespec lts;
@@ -543,24 +555,26 @@ linux_clock_nanosleep(struct thread *td,
struct timespec *rmtp;
struct l_timespec lrqts, lrmts;
struct timespec rqts, rmts;
-   int error, error2;
+   int error, error2, flags;
+   clockid_t clockid;
 
LIN_SDT_PROBE4(time, linux_clock_nanosleep, entry, args->which,
args->flags, args->rqtp, args->rmtp);
 
-   if (args->flags != 0) {
-   /* XXX deal with TIMER_ABSTIME */
+   error = linux_to_native_timerflags(, args->flags);
+   if (error != 0) {
LIN_SDT_PROBE1(time, linux_clock_nanosleep, unsupported_flags,
args->flags);
-   LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, EINVAL);
-   return (EINVAL);/* XXX deal with TIMER_ABSTIME */
+   LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, error);
+   return (error);
}
 
-   if (args->which != LINUX_CLOCK_REALTIME) {
+   error = linux_to_native_clockid(, args->which);
+   if (error != 0) {
LIN_SDT_PROBE1(time, linux_clock_nanosleep, unsupported_clockid,
args->which);
-   LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, EINVAL);
-   return (EINVAL);
+   LIN_SDT_PROBE1(time, linux_clock_settime, return, error);
+   return (error);
}
 
error = copyin(args->rqtp, , sizeof(lrqts));
@@ -583,9 +597,9 @@ linux_clock_nanosleep(struct thread *td,
LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, error);
return (error);
}
-   error = kern_nanosleep(td, , rmtp);
-   if (error == EINTR && args->rmtp != NULL) {
-   /* XXX. Not for TIMER_ABSTIME */
+   error = kern_clock_nanosleep(td, clockid, flags, , rmtp);
+   if (error == EINTR && (flags & TIMER_ABSTIME) == 0 &&
+   args->rmtp != NULL) {
error2 = native_to_linux_timespec(, rmtp);
if (error2 != 0)
return (error2);

Modified: stable/11/sys/compat/linux/linux_timer.h
==
--- stable/11/sys/compat/linux/linux_timer.hMon May  1 06:05:04 2017
(r317636)
+++ stable/11/sys/compat/linux/linux_timer.hMon May  1 06:42:39 2017
(r317637)
@@ -72,6 +72,7 @@
 #defineLINUX_CPUCLOCK_PERTHREAD(clock) \
(((clock) & (clockid_t) LINUX_CPUCLOCK_PERTHREAD_MASK) != 0)
 
+#defineLINUX_TIMER_ABSTIME 0x01
 
 #defineL_SIGEV_SIGNAL  0
 #defineL_SIGEV_NONE1
@@ -120,5 +121,6 @@ int native_to_linux_itimerspec(struct l_
 struct itimerspec *);
 int linux_to_native_itimerspec(struct itimerspec *,
 struct l_itimerspec *);
+int linux_to_native_timerflags(int *, int);
 
 #endif /* _LINUX_TIMER_H */
___
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: r317636 - stable/10/sys/dev/isp

2017-05-01 Thread Alexander Motin
Author: mav
Date: Mon May  1 06:05:04 2017
New Revision: 317636
URL: https://svnweb.freebsd.org/changeset/base/317636

Log:
  MFC r317356: Switch isp_reset to scratchpad not requiring ISP_MBOXDMASETUP.

Modified:
  stable/10/sys/dev/isp/isp.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/isp/isp.c
==
--- stable/10/sys/dev/isp/isp.c Mon May  1 06:04:34 2017(r317635)
+++ stable/10/sys/dev/isp/isp.c Mon May  1 06:05:04 2017(r317636)
@@ -1012,7 +1012,7 @@ isp_reset(ispsoftc_t *isp, int do_load_d
 
fwt = isp->isp_fwattr;
if (IS_24XX(isp)) {
-   buf = FCPARAM(isp, 0)->isp_scratch;
+   buf = FCPARAM(isp, 0)->isp_scanscratch;
ISP_SNPRINTF(buf, ISP_FC_SCRLEN, "Attributes:");
if (fwt & ISP2400_FW_ATTR_CLASS2) {
fwt ^=ISP2400_FW_ATTR_CLASS2;
@@ -1101,7 +1101,7 @@ isp_reset(ispsoftc_t *isp, int do_load_d
}
isp_prt(isp, ISP_LOGCONFIG, "%s", buf);
} else if (IS_FC(isp)) {
-   buf = FCPARAM(isp, 0)->isp_scratch;
+   buf = FCPARAM(isp, 0)->isp_scanscratch;
ISP_SNPRINTF(buf, ISP_FC_SCRLEN, "Attributes:");
if (fwt & ISP_FW_ATTR_TMODE) {
fwt ^=ISP_FW_ATTR_TMODE;
___
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: r317635 - stable/11/sys/dev/isp

2017-05-01 Thread Alexander Motin
Author: mav
Date: Mon May  1 06:04:34 2017
New Revision: 317635
URL: https://svnweb.freebsd.org/changeset/base/317635

Log:
  MFC r317356: Switch isp_reset to scratchpad not requiring ISP_MBOXDMASETUP.

Modified:
  stable/11/sys/dev/isp/isp.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/isp/isp.c
==
--- stable/11/sys/dev/isp/isp.c Mon May  1 06:03:44 2017(r317634)
+++ stable/11/sys/dev/isp/isp.c Mon May  1 06:04:34 2017(r317635)
@@ -1012,7 +1012,7 @@ isp_reset(ispsoftc_t *isp, int do_load_d
 
fwt = isp->isp_fwattr;
if (IS_24XX(isp)) {
-   buf = FCPARAM(isp, 0)->isp_scratch;
+   buf = FCPARAM(isp, 0)->isp_scanscratch;
ISP_SNPRINTF(buf, ISP_FC_SCRLEN, "Attributes:");
if (fwt & ISP2400_FW_ATTR_CLASS2) {
fwt ^=ISP2400_FW_ATTR_CLASS2;
@@ -1101,7 +1101,7 @@ isp_reset(ispsoftc_t *isp, int do_load_d
}
isp_prt(isp, ISP_LOGCONFIG, "%s", buf);
} else if (IS_FC(isp)) {
-   buf = FCPARAM(isp, 0)->isp_scratch;
+   buf = FCPARAM(isp, 0)->isp_scanscratch;
ISP_SNPRINTF(buf, ISP_FC_SCRLEN, "Attributes:");
if (fwt & ISP_FW_ATTR_TMODE) {
fwt ^=ISP_FW_ATTR_TMODE;
___
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: r317632 - head/sys

2017-05-01 Thread Ngie Cooper
Author: ngie
Date: Mon May  1 05:59:52 2017
New Revision: 317632
URL: https://svnweb.freebsd.org/changeset/base/317632

Log:
  Fix "make cscope-clean" when .OBJDIR already exists
  
  The cscope generated files are always put in .CURDIR .
  
  MFC after:1 month
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/Makefile

Modified: head/sys/Makefile
==
--- head/sys/Makefile   Mon May  1 05:54:33 2017(r317631)
+++ head/sys/Makefile   Mon May  1 05:59:52 2017(r317632)
@@ -32,7 +32,8 @@ ${.CURDIR}/cscope.files: .PHONY
find ${CSCOPEDIRS} -name "*.[chSsly]" -a -type f > ${.TARGET}
 
 cscope-clean:
-   rm -f cscope.files cscope.out cscope.in.out cscope.po.out
+   cd ${.CURDIR}; \
+   rm -f cscope.files cscope.out cscope.in.out cscope.po.out
 
 #
 # Installs SCM hooks to update the cscope database every time the source tree
___
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: r317631 - head/sys

2017-05-01 Thread Ngie Cooper
Author: ngie
Date: Mon May  1 05:54:33 2017
New Revision: 317631
URL: https://svnweb.freebsd.org/changeset/base/317631

Log:
  Fix "make cscope" after r317411
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/Makefile

Modified: head/sys/Makefile
==
--- head/sys/Makefile   Mon May  1 02:08:44 2017(r317630)
+++ head/sys/Makefile   Mon May  1 05:54:33 2017(r317631)
@@ -3,7 +3,7 @@
 # Directories to include in cscope name file and TAGS.
 CSCOPEDIRS=boot bsm cam cddl compat conf contrib crypto ddb dev fs gdb \
geom gnu isa kern libkern modules net net80211 \
-   netgraph netinet netinet6 netipsec netnatm netpfil \
+   netgraph netinet netinet6 netipsec netpfil \
netsmb nfs nfsclient nfsserver nlm ofed opencrypto \
rpc security sys ufs vm xdr xen ${CSCOPE_ARCHDIR}
 .if !defined(CSCOPE_ARCHDIR)
___
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: r317634 - stable/10/lib/libc/gen

2017-05-01 Thread Alexander Motin
Author: mav
Date: Mon May  1 06:03:44 2017
New Revision: 317634
URL: https://svnweb.freebsd.org/changeset/base/317634

Log:
  MFC r317064: Optimize pathologic case of telldir() for Samba.
  
  When application reads large directory, calling telldir() for each entry,
  like Samba does, it creates exponential performance drop as number of
  entries reach tenths to hundreds of thousands.  It is caused by full search
  through the internal list, that never finds matches in that scenario, but
  creates O(n^2) delays.  This patch optimizes that search, limiting it to
  entries of the same buffer, turning time closer to O(n) in case of linear
  directory scan.

Modified:
  stable/10/lib/libc/gen/telldir.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/gen/telldir.c
==
--- stable/10/lib/libc/gen/telldir.cMon May  1 06:03:07 2017
(r317633)
+++ stable/10/lib/libc/gen/telldir.cMon May  1 06:03:44 2017
(r317634)
@@ -53,15 +53,22 @@ long
 telldir(dirp)
DIR *dirp;
 {
-   struct ddloc *lp;
+   struct ddloc *lp, *flp;
long idx;
 
if (__isthreaded)
_pthread_mutex_lock(>dd_lock);
+   flp = NULL;
LIST_FOREACH(lp, >dd_td->td_locq, loc_lqe) {
-   if (lp->loc_seek == dirp->dd_seek &&
-   lp->loc_loc == dirp->dd_loc)
+   if (lp->loc_seek == dirp->dd_seek) {
+   if (flp == NULL)
+   flp = lp;
+   if (lp->loc_loc == dirp->dd_loc)
+   break;
+   } else if (flp != NULL) {
+   lp = NULL;
break;
+   }
}
if (lp == NULL) {
lp = malloc(sizeof(struct ddloc));
@@ -73,7 +80,10 @@ telldir(dirp)
lp->loc_index = dirp->dd_td->td_loccnt++;
lp->loc_seek = dirp->dd_seek;
lp->loc_loc = dirp->dd_loc;
-   LIST_INSERT_HEAD(>dd_td->td_locq, lp, loc_lqe);
+   if (flp != NULL)
+   LIST_INSERT_BEFORE(flp, lp, loc_lqe);
+   else
+   LIST_INSERT_HEAD(>dd_td->td_locq, lp, loc_lqe);
}
idx = lp->loc_index;
if (__isthreaded)
___
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: r317633 - stable/11/lib/libc/gen

2017-05-01 Thread Alexander Motin
Author: mav
Date: Mon May  1 06:03:07 2017
New Revision: 317633
URL: https://svnweb.freebsd.org/changeset/base/317633

Log:
  MFC r317064: Optimize pathologic case of telldir() for Samba.
  
  When application reads large directory, calling telldir() for each entry,
  like Samba does, it creates exponential performance drop as number of
  entries reach tenths to hundreds of thousands.  It is caused by full search
  through the internal list, that never finds matches in that scenario, but
  creates O(n^2) delays.  This patch optimizes that search, limiting it to
  entries of the same buffer, turning time closer to O(n) in case of linear
  directory scan.

Modified:
  stable/11/lib/libc/gen/telldir.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/gen/telldir.c
==
--- stable/11/lib/libc/gen/telldir.cMon May  1 05:59:52 2017
(r317632)
+++ stable/11/lib/libc/gen/telldir.cMon May  1 06:03:07 2017
(r317633)
@@ -52,15 +52,22 @@ __FBSDID("$FreeBSD$");
 long
 telldir(DIR *dirp)
 {
-   struct ddloc *lp;
+   struct ddloc *lp, *flp;
long idx;
 
if (__isthreaded)
_pthread_mutex_lock(>dd_lock);
+   flp = NULL;
LIST_FOREACH(lp, >dd_td->td_locq, loc_lqe) {
-   if (lp->loc_seek == dirp->dd_seek &&
-   lp->loc_loc == dirp->dd_loc)
+   if (lp->loc_seek == dirp->dd_seek) {
+   if (flp == NULL)
+   flp = lp;
+   if (lp->loc_loc == dirp->dd_loc)
+   break;
+   } else if (flp != NULL) {
+   lp = NULL;
break;
+   }
}
if (lp == NULL) {
lp = malloc(sizeof(struct ddloc));
@@ -72,7 +79,10 @@ telldir(DIR *dirp)
lp->loc_index = dirp->dd_td->td_loccnt++;
lp->loc_seek = dirp->dd_seek;
lp->loc_loc = dirp->dd_loc;
-   LIST_INSERT_HEAD(>dd_td->td_locq, lp, loc_lqe);
+   if (flp != NULL)
+   LIST_INSERT_BEFORE(flp, lp, loc_lqe);
+   else
+   LIST_INSERT_HEAD(>dd_td->td_locq, lp, loc_lqe);
}
idx = lp->loc_index;
if (__isthreaded)
___
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"