Re: svn commit: r322770 - head/usr.sbin/chown/tests

2017-08-21 Thread Ngie Cooper (yaneurabeya)

> On Aug 21, 2017, at 13:23, Glen Barber  wrote:
> 
> Author: gjb
> Date: Mon Aug 21 20:23:05 2017
> New Revision: 322770
> URL: https://svnweb.freebsd.org/changeset/base/322770
> 
> Log:
>  Apply changes from bin/chmod/tests/chmod_test.sh (r321949, r321950,
>  and r322101), adding atf_expect_fail() before chflags(8) is invoked
>  if the filesystem is ZFS, which does not support UF_IMMUTABLE.
> 
>  MFC after:   3 days
>  Sponsored by:The FreeBSD Foundation

Ah, thanks :)!
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r322759 - stable/10/bin/chmod/tests

2017-08-21 Thread Ngie Cooper (yaneurabeya)

> On Aug 21, 2017, at 10:20, Glen Barber  wrote:
> 
> Author: gjb
> Date: Mon Aug 21 17:20:31 2017
> New Revision: 322759
> URL: https://svnweb.freebsd.org/changeset/base/322759
> 
> Log:
>  MFC r321949, r321950, r322101:

Thanks Glen!
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r322777 - in stable/11: contrib/netbsd-tests/usr.bin/grep usr.bin/grep

2017-08-21 Thread Kyle Evans
Author: kevans
Date: Tue Aug 22 02:03:01 2017
New Revision: 322777
URL: https://svnweb.freebsd.org/changeset/base/322777

Log:
  MFC r321450: bsdgrep(1): Don't exit before processing every file
  
  Given an empty pattern (i.e. grep "" A B), bsdgrep(1) would previously
  exit() with the appropriate exit code upon encountering an empty file.
  Likely intended as an optimization, but this behavior is technically
  incorrect since an empty pattern should match every line.
  
  PR:   220924
  Approved by:  emaste (mentor, blanket MFC)

Modified:
  stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
  stable/11/usr.bin/grep/util.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
==
--- stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh   Tue Aug 22 
00:10:15 2017(r322776)
+++ stable/11/contrib/netbsd-tests/usr.bin/grep/t_grep.sh   Tue Aug 22 
02:03:01 2017(r322777)
@@ -667,6 +667,24 @@ mmap_eof_not_eol_body()
atf_check -s exit:0 -o not-empty \
env MALLOC_CONF="redzone:true" grep --mmap -e " " test2
 }
+
+atf_test_case matchall
+matchall_head()
+{
+   atf_set "descr" "Check proper behavior of matching all with an empty 
string"
+}
+matchall_body()
+{
+   printf "" > test1
+   printf "A" > test2
+   printf "A\nB" > test3
+
+   atf_check -o inline:"test2:A\ntest3:A\ntest3:B\n" grep "" test1 test2 
test3
+   atf_check -o inline:"test3:A\ntest3:B\ntest2:A\n" grep "" test3 test1 
test2
+   atf_check -o inline:"test2:A\ntest3:A\ntest3:B\n" grep "" test2 test3 
test1
+
+   atf_check -s exit:1 grep "" test1
+}
 # End FreeBSD
 
 atf_init_test_cases()
@@ -707,5 +725,6 @@ atf_init_test_cases()
atf_add_test_case badcontext
atf_add_test_case mmap
atf_add_test_case mmap_eof_not_eol
+   atf_add_test_case matchall
 # End FreeBSD
 }

Modified: stable/11/usr.bin/grep/util.c
==
--- stable/11/usr.bin/grep/util.c   Tue Aug 22 00:10:15 2017
(r322776)
+++ stable/11/usr.bin/grep/util.c   Tue Aug 22 02:03:01 2017
(r322777)
@@ -259,16 +259,8 @@ procfile(const char *fn)
pc.ln.boff = 0;
pc.ln.off += pc.ln.len + 1;
if ((pc.ln.dat = grep_fgetln(f, )) == NULL ||
-   pc.ln.len == 0) {
-   if (pc.ln.line_no == 0 && matchall)
-   /*
-* An empty file with an empty pattern and the
-* -w flag does not match
-*/
-   exit(matchall && wflag ? 1 : 0);
-   else
-   break;
-   }
+   pc.ln.len == 0)
+   break;
 
if (pc.ln.len > 0 && pc.ln.dat[pc.ln.len - 1] == fileeol)
--pc.ln.len;
___
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: r322776 - in head/sys: kern sys x86/x86

2017-08-21 Thread Conrad Meyer
Author: cem
Date: Tue Aug 22 00:10:15 2017
New Revision: 322776
URL: https://svnweb.freebsd.org/changeset/base/322776

Log:
  subr_smp: Clean up topology analysis, add additional layers
  
  Rather than repeatedly nesting loops, separate concerns with a single loop
  per call stack level.  Use a table to drive the recursive routine.  Handle
  missing topology layers more gracefully (infer a single unit).
  
  Analyze some additional optional layers which may be present on e.g. AMD Zen
  systems (groups, aka dies, per package; and cachegroups, aka CCXes, per
  group).
  
  Display that additional information in the boot-time topology information,
  when it is relevent (non-one).
  
  Reviewed by:  markj@, mjoras@ (earlier version)
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D12019

Modified:
  head/sys/kern/subr_smp.c
  head/sys/sys/smp.h
  head/sys/x86/x86/mp_x86.c

Modified: head/sys/kern/subr_smp.c
==
--- head/sys/kern/subr_smp.cMon Aug 21 22:26:49 2017(r322775)
+++ head/sys/kern/subr_smp.cTue Aug 22 00:10:15 2017(r322776)
@@ -993,7 +993,7 @@ topo_next_node(struct topo_node *top, struct topo_node
if ((next = TAILQ_NEXT(node, siblings)) != NULL)
return (next);
 
-   while ((node = node->parent) != top)
+   while (node != top && (node = node->parent) != top)
if ((next = TAILQ_NEXT(node, siblings)) != NULL)
return (next);
 
@@ -1012,7 +1012,7 @@ topo_next_nonchild_node(struct topo_node *top, struct 
if ((next = TAILQ_NEXT(node, siblings)) != NULL)
return (next);
 
-   while ((node = node->parent) != top)
+   while (node != top && (node = node->parent) != top)
if ((next = TAILQ_NEXT(node, siblings)) != NULL)
return (next);
 
@@ -1044,105 +1044,99 @@ topo_set_pu_id(struct topo_node *node, cpuid_t id)
}
 }
 
-/*
- * Check if the topology is uniform, that is, each package has the same number
- * of cores in it and each core has the same number of threads (logical
- * processors) in it.  If so, calculate the number of package, the number of
- * cores per package and the number of logical processors per core.
- * 'all' parameter tells whether to include administratively disabled logical
- * processors into the analysis.
- */
-int
-topo_analyze(struct topo_node *topo_root, int all,
-int *pkg_count, int *cores_per_pkg, int *thrs_per_core)
+static struct topology_spec {
+   topo_node_type  type;
+   boolmatch_subtype;
+   uintptr_t   subtype;
+} topology_level_table[TOPO_LEVEL_COUNT] = {
+   [TOPO_LEVEL_PKG] = { .type = TOPO_TYPE_PKG, },
+   [TOPO_LEVEL_GROUP] = { .type = TOPO_TYPE_GROUP, },
+   [TOPO_LEVEL_CACHEGROUP] = {
+   .type = TOPO_TYPE_CACHE,
+   .match_subtype = true,
+   .subtype = CG_SHARE_L3,
+   },
+   [TOPO_LEVEL_CORE] = { .type = TOPO_TYPE_CORE, },
+   [TOPO_LEVEL_THREAD] = { .type = TOPO_TYPE_PU, },
+};
+
+static bool
+topo_analyze_table(struct topo_node *root, int all, enum topo_level level,
+struct topo_analysis *results)
 {
-   struct topo_node *pkg_node;
-   struct topo_node *core_node;
-   struct topo_node *pu_node;
-   int thrs_per_pkg;
-   int cpp_counter;
-   int tpc_counter;
-   int tpp_counter;
+   struct topology_spec *spec;
+   struct topo_node *node;
+   int count;
 
-   *pkg_count = 0;
-   *cores_per_pkg = -1;
-   *thrs_per_core = -1;
-   thrs_per_pkg = -1;
-   pkg_node = topo_root;
-   while (pkg_node != NULL) {
-   if (pkg_node->type != TOPO_TYPE_PKG) {
-   pkg_node = topo_next_node(topo_root, pkg_node);
+   if (level >= TOPO_LEVEL_COUNT)
+   return (true);
+
+   spec = _level_table[level];
+   count = 0;
+   node = topo_next_node(root, root);
+
+   while (node != NULL) {
+   if (node->type != spec->type ||
+   (spec->match_subtype && node->subtype != spec->subtype)) {
+   node = topo_next_node(root, node);
continue;
}
-   if (!all && CPU_EMPTY(_node->cpuset)) {
-   pkg_node = topo_next_nonchild_node(topo_root, pkg_node);
+   if (!all && CPU_EMPTY(>cpuset)) {
+   node = topo_next_nonchild_node(root, node);
continue;
}
 
-   (*pkg_count)++;
+   count++;
 
-   cpp_counter = 0;
-   tpp_counter = 0;
-   core_node = pkg_node;
-   while (core_node != NULL) {
-   if (core_node->type == TOPO_TYPE_CORE) {
-   if (!all && CPU_EMPTY(_node->cpuset)) {
-   

svn commit: r322775 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize

2017-08-21 Thread Mark Johnston
Author: markj
Date: Mon Aug 21 22:26:49 2017
New Revision: 322775
URL: https://svnweb.freebsd.org/changeset/base/322775

Log:
  Use an updated copy of the CDDL header boilerplate from illumos.
  
  Reported by:  Yuri Pankov 
  X-MFC with:   r322774

Modified:
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_MAGTOOBIG.offbyone.d

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_MAGTOOBIG.offbyone.d
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_MAGTOOBIG.offbyone.d
  Mon Aug 21 21:58:42 2017(r322774)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_MAGTOOBIG.offbyone.d
  Mon Aug 21 22:26:49 2017(r322775)
@@ -1,26 +1,16 @@
 /*
- * CDDL HEADER START
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms version
+ * 1.0 of the CDDL.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [] [name of copyright owner]
- *
- * CDDL HEADER END
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
  */
 
 /*
- * Copyright (c) 2017 Mark Johnston 
+ * Copyright 2017 Mark Johnston 
  */
 
 /*
___
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: r322774 - in head/cddl: contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize usr.sbin/dtrace/tests/common/llquantize

2017-08-21 Thread Mark Johnston
Author: markj
Date: Mon Aug 21 21:58:42 2017
New Revision: 322774
URL: https://svnweb.freebsd.org/changeset/base/322774

Log:
  Add a regression test for r322773.
  
  MFC after:1 week

Added:
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_MAGTOOBIG.offbyone.d
   (contents, props changed)
Modified:
  head/cddl/usr.sbin/dtrace/tests/common/llquantize/Makefile

Added: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_MAGTOOBIG.offbyone.d
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/llquantize/err.D_LLQUANT_MAGTOOBIG.offbyone.d
  Mon Aug 21 21:58:42 2017(r322774)
@@ -0,0 +1,35 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2017 Mark Johnston 
+ */
+
+/*
+ * A regression test for FreeBSD r322773. 100^9 fits in 64 bits, but
+ * llquantize() will create buckets up to 100^{10}, which does not fit.
+ */
+
+BEGIN
+{
+   @ = llquantize(0, 100, 0, 9, 100);
+   exit(0);
+}

Modified: head/cddl/usr.sbin/dtrace/tests/common/llquantize/Makefile
==
--- head/cddl/usr.sbin/dtrace/tests/common/llquantize/Makefile  Mon Aug 21 
21:56:02 2017(r322773)
+++ head/cddl/usr.sbin/dtrace/tests/common/llquantize/Makefile  Mon Aug 21 
21:58:42 2017(r322774)
@@ -22,6 +22,7 @@ ${PACKAGE}FILES= \
  err.D_LLQUANT_LOWVAL.d  \
  err.D_LLQUANT_MAGRANGE.d  \
  err.D_LLQUANT_MAGTOOBIG.d  \
+ err.D_LLQUANT_MAGTOOBIG.offbyone.d  \
  err.D_LLQUANT_NSTEPMATCH.d  \
  err.D_LLQUANT_NSTEPTYPE.d  \
  err.D_LLQUANT_NSTEPVAL.d  \
___
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: r322773 - head/cddl/contrib/opensolaris/lib/libdtrace/common

2017-08-21 Thread Mark Johnston
Author: markj
Date: Mon Aug 21 21:56:02 2017
New Revision: 322773
URL: https://svnweb.freebsd.org/changeset/base/322773

Log:
  Fix an off-by-two in the llquantize() action parameter validation.
  
  The aggregation created by llquantize() partitions values into buckets; the
  lower bound of the bucket containing the largest values is b^{m+1}, where
  b and m are the second and fourth parameters to the action, respectively.
  Bucket bounds are stored in a 64-bit integer, and so the llquantize()
  validation checks need to verify that b^{m+1} fits in 64 bits. However, it
  was only verifying that b^{m-1} fits in 64 bits, so certain parameter
  combinations could trigger assertion failures in libdtrace.
  
  PR:   219451
  MFC after:1 week

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

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c
==
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c  Mon Aug 21 
21:48:24 2017(r322772)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c  Mon Aug 21 
21:56:02 2017(r322773)
@@ -1503,7 +1503,7 @@ dt_compile_agg(dtrace_hdl_t *dtp, dt_node_t *dnp, dtra
"divide a power of the factor\n");
}
 
-   for (i = 0, order = 1; i < args[2].value; i++) {
+   for (i = 0, order = 1; i <= args[2].value + 1; i++) {
if (order * args[0].value > order) {
order *= args[0].value;
continue;
@@ -1511,7 +1511,7 @@ dt_compile_agg(dtrace_hdl_t *dtp, dt_node_t *dnp, dtra
 
dnerror(dnp, D_LLQUANT_MAGTOOBIG, "llquantize( ) "
"factor (%d) raised to power of high magnitude "
-   "(%d) overflows 64-bits\n", args[0].value,
+   "(%d) plus 1 overflows 64-bits\n", args[0].value,
args[2].value);
}
 
___
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: r322772 - head/sys/mips/mips

2017-08-21 Thread John Baldwin
Author: jhb
Date: Mon Aug 21 21:48:24 2017
New Revision: 322772
URL: https://svnweb.freebsd.org/changeset/base/322772

Log:
  Enable hardfloat CPU instructions in the FP exception handler.
  
  This permits compiling with clang's integrated assembler.
  
  Sponsored by: DARPA / AFRL

Modified:
  head/sys/mips/mips/exception.S

Modified: head/sys/mips/mips/exception.S
==
--- head/sys/mips/mips/exception.S  Mon Aug 21 20:27:45 2017
(r322771)
+++ head/sys/mips/mips/exception.S  Mon Aug 21 21:48:24 2017
(r322772)
@@ -1102,6 +1102,8 @@ END(MipsTLBMissException)
  *
  */
 NESTED(MipsFPTrap, CALLFRAME_SIZ, ra)
+   .set push
+   .set hardfloat
PTR_SUBUsp, sp, CALLFRAME_SIZ
mfc0t0, MIPS_COP_0_STATUS
HAZARD_DELAY
@@ -1201,6 +1203,7 @@ FPReturn:
ITLBNOPFIX
j   ra
PTR_ADDU sp, sp, CALLFRAME_SIZ
+   .set pop
 END(MipsFPTrap)
 
 #ifndef INTRNG
___
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: r322771 - in head/sys: dev/qlxgbe modules/qlxgbe

2017-08-21 Thread David C Somayajulu
Author: davidcs
Date: Mon Aug 21 20:27:45 2017
New Revision: 322771
URL: https://svnweb.freebsd.org/changeset/base/322771

Log:
  Upgrade FW to 5.4.66
  sysctls to display stats, stats polled every 2 seconds
  Modify QLA_LOCK()/QLA_UNLOCK() to not sleep after acquiring mtx_lock
  Add support to turn OFF/ON error recovery following heartbeat failure for
  debug purposes.
  Set default max values to 32 Tx/Rx/SDS rings
  
  MFC after:5 days

Modified:
  head/sys/dev/qlxgbe/README.txt
  head/sys/dev/qlxgbe/ql_boot.c
  head/sys/dev/qlxgbe/ql_def.h
  head/sys/dev/qlxgbe/ql_fw.c
  head/sys/dev/qlxgbe/ql_glbl.h
  head/sys/dev/qlxgbe/ql_hw.c
  head/sys/dev/qlxgbe/ql_hw.h
  head/sys/dev/qlxgbe/ql_inline.h
  head/sys/dev/qlxgbe/ql_ioctl.c
  head/sys/dev/qlxgbe/ql_isr.c
  head/sys/dev/qlxgbe/ql_minidump.c
  head/sys/dev/qlxgbe/ql_os.c
  head/sys/dev/qlxgbe/ql_os.h
  head/sys/dev/qlxgbe/ql_reset.c
  head/sys/dev/qlxgbe/ql_ver.h
  head/sys/modules/qlxgbe/Makefile

Modified: head/sys/dev/qlxgbe/README.txt
==
--- head/sys/dev/qlxgbe/README.txt  Mon Aug 21 20:23:05 2017
(r322770)
+++ head/sys/dev/qlxgbe/README.txt  Mon Aug 21 20:27:45 2017
(r322771)
@@ -61,14 +61,17 @@ following OS platforms:
   - kldunload if_qlxgbe
 
 5. Parameters to set prior to installing the driver
+ Please run  "sysctl kern.ipc" and "sysctl net.inet.tcp" and see if these
+ values are already greater than shown below. Change only those which
+ are less than shown below.
 
- Add the following lines to /etc/sysctl.conf and reboot the machine prior
  to installing the driver

-   kern.ipc.nmbjumbo9=262144
+   kern.ipc.nmbjumbo9=200
+   kern.ipc.nmbclusters=100
net.inet.tcp.recvbuf_max=262144
net.inet.tcp.recvbuf_inc=16384
-   kern.ipc.nmbclusters=100
kern.ipc.maxsockbuf=2097152
net.inet.tcp.recvspace=131072
net.inet.tcp.sendbuf_max=262144
@@ -78,10 +81,10 @@ following OS platforms:
 
login or su to root
 
-   sysctl kern.ipc.nmbjumbo9=262144
+   sysctl kern.ipc.nmbjumbo9=200
+   sysctl kern.ipc.nmbclusters=100
sysctl net.inet.tcp.recvbuf_max=262144
sysctl net.inet.tcp.recvbuf_inc=16384
-   sysctl kern.ipc.nmbclusters=100
sysctl kern.ipc.maxsockbuf=2097152
sysctl net.inet.tcp.recvspace=131072
sysctl net.inet.tcp.sendbuf_max=262144

Modified: head/sys/dev/qlxgbe/ql_boot.c
==
--- head/sys/dev/qlxgbe/ql_boot.c   Mon Aug 21 20:23:05 2017
(r322770)
+++ head/sys/dev/qlxgbe/ql_boot.c   Mon Aug 21 20:27:45 2017
(r322771)
@@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$");
 
 unsigned int ql83xx_bootloader_version_major = 5;
 unsigned int ql83xx_bootloader_version_minor = 4;
-unsigned int ql83xx_bootloader_version_sub = 64;
+unsigned int ql83xx_bootloader_version_sub = 66;
 unsigned char ql83xx_bootloader[] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -10957,9 +10957,8 @@ unsigned char ql83xx_bootloader[] = {
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0x02, 0x00, 0x40, 0x40, 0x05, 0x04, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x02, 0x00, 0x40, 0x40, 0x05, 0x04, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00,
   0xe0, 0xff, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x9b, 0x64, 0x95, 0x0e
+  0x00, 0x00, 0x00, 0x00, 0x9b, 0x64, 0x93, 0x0e
 };
 unsigned int ql83xx_bootloader_len = 131072;
-

Modified: head/sys/dev/qlxgbe/ql_def.h
==
--- head/sys/dev/qlxgbe/ql_def.hMon Aug 21 20:23:05 2017
(r322770)
+++ head/sys/dev/qlxgbe/ql_def.hMon Aug 21 20:27:45 2017
(r322771)
@@ -110,6 +110,7 @@ typedef struct qla_ivec qla_ivec_t;
 typedef struct _qla_tx_ring {
qla_tx_buf_ttx_buf[NUM_TX_DESCRIPTORS];
uint64_tcount;
+   uint64_tiscsi_pkt_count;
 } qla_tx_ring_t;
 
 typedef struct _qla_tx_fp {
@@ -123,25 +124,26 @@ typedef struct _qla_tx_fp {
 } qla_tx_fp_t;
 
 /*
- * Adapter structure contains the hardware independent information of the
+ * Adapter structure contains the hardware independant information of the
  * pci function.
  */
 struct qla_host {
 volatile struct {
 volatile uint32_t
-   qla_interface_up:1,
qla_callout_init:1,
qla_watchdog_active :1,
-   qla_watchdog_exit   :1,
-   qla_watchdog_pause

svn commit: r322770 - head/usr.sbin/chown/tests

2017-08-21 Thread Glen Barber
Author: gjb
Date: Mon Aug 21 20:23:05 2017
New Revision: 322770
URL: https://svnweb.freebsd.org/changeset/base/322770

Log:
  Apply changes from bin/chmod/tests/chmod_test.sh (r321949, r321950,
  and r322101), adding atf_expect_fail() before chflags(8) is invoked
  if the filesystem is ZFS, which does not support UF_IMMUTABLE.
  
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.sbin/chown/tests/chown_test.sh

Modified: head/usr.sbin/chown/tests/chown_test.sh
==
--- head/usr.sbin/chown/tests/chown_test.sh Mon Aug 21 18:12:32 2017
(r322769)
+++ head/usr.sbin/chown/tests/chown_test.sh Mon Aug 21 20:23:05 2017
(r322770)
@@ -25,6 +25,13 @@
 #
 # $FreeBSD$
 
+get_filesystem()
+{
+   local mountpoint=$1
+
+   df -T $mountpoint | tail -n 1 | cut -wf 2
+}
+
 atf_test_case RH_flag
 RH_flag_head()
 {
@@ -98,6 +105,11 @@ f_flag_body()
 {
atf_check truncate -s 0 foo bar
atf_check chown 0:0 foo bar
+   case "$(get_filesystem .)" in
+   zfs)
+   atf_expect_fail "ZFS does not support UF_IMMUTABLE; returns 
EPERM"
+   ;;
+   esac
atf_check chflags uchg foo
atf_check -e not-empty -s not-exit:0 chown 42:42 foo bar
atf_check -o inline:'0:0\n42:42\n' stat -f '%u:%g' foo bar
@@ -107,7 +119,7 @@ f_flag_body()
 
 f_flag_cleanup()
 {
-   atf_check chflags 0 foo
+   chflags 0 foo || :
 }
 
 atf_test_case h_flag
@@ -144,6 +156,11 @@ v_flag_body()
atf_check truncate -s 0 foo bar
atf_check chown 0:0 foo
atf_check chown 42:42 bar
+   case "$(get_filesystem .)" in
+   zfs)
+   atf_expect_fail "ZFS updates mode for foo unnecessarily"
+   ;;
+   esac
atf_check -o 'inline:bar\n' chown -v 0:0 foo bar
atf_check chown -v 0:0 foo bar
for f in foo bar; do
___
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: r322769 - head/sys/arm64/arm64

2017-08-21 Thread Andrew Turner
Author: andrew
Date: Mon Aug 21 18:12:32 2017
New Revision: 322769
URL: https://svnweb.freebsd.org/changeset/base/322769

Log:
  Improve the performance of the arm64 thread switching code.
  
  The full system memory barrier around a TLB invalidation is stricter than
  required. It needs to wait on accesses to main memory, with just the weaker
  store variant before the invalidate. As such use the dsb istst, tlbi, dlb
  ish sequence already used in pmap.
  
  The tlbi instruction in this sequence is also unnecessarily using a
  broadcast invalidate when it just needs to invalidate the local CPUs TLB.
  Switch to a non-broadcast variant of this instruction.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm64/arm64/swtch.S

Modified: head/sys/arm64/arm64/swtch.S
==
--- head/sys/arm64/arm64/swtch.SMon Aug 21 18:00:26 2017
(r322768)
+++ head/sys/arm64/arm64/swtch.SMon Aug 21 18:12:32 2017
(r322769)
@@ -91,9 +91,9 @@ ENTRY(cpu_throw)
isb
 
/* Invalidate the TLB */
-   dsb sy
-   tlbivmalle1is
-   dsb sy
+   dsb ishst
+   tlbivmalle1
+   dsb ish
isb
 
/* If we are single stepping, enable it */
@@ -192,9 +192,9 @@ ENTRY(cpu_switch)
isb
 
/* Invalidate the TLB */
-   dsb sy
-   tlbivmalle1is
-   dsb sy
+   dsb ishst
+   tlbivmalle1
+   dsb ish
isb
 
/*
___
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: r322768 - svnadmin/conf

2017-08-21 Thread John Baldwin
Author: jhb
Date: Mon Aug 21 18:00:26 2017
New Revision: 322768
URL: https://svnweb.freebsd.org/changeset/base/322768

Log:
  Add Alexander Richardson (arichardson@) as a source committer.
  
  Alex has been working on MIPS LLD support as well as cross-building
  FreeBSD from Linux and OS X hosts.  Brooks and I will co-mentor.
  
  Approved by:  core

Modified:
  svnadmin/conf/access
  svnadmin/conf/mentors

Modified: svnadmin/conf/access
==
--- svnadmin/conf/accessMon Aug 21 17:52:09 2017(r322767)
+++ svnadmin/conf/accessMon Aug 21 18:00:26 2017(r322768)
@@ -29,6 +29,7 @@ andrew
 anish
 antoine
 araujo
+arichardson
 arybchik
 asomers
 avatar

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Mon Aug 21 17:52:09 2017(r322767)
+++ svnadmin/conf/mentors   Mon Aug 21 18:00:26 2017(r322768)
@@ -12,6 +12,7 @@
 # Mentee   Mentor  Optional comment
 achim  scottl  Co-mentor: emaste
 anish  neelCo-mentor: grehan
+arichardsonjhb Co-mentor: brooks
 dabvangyzen
 defpjd
 eriae  Co-mentor: thompsa
___
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: r322767 - head/contrib/top

2017-08-21 Thread John Baldwin
Author: jhb
Date: Mon Aug 21 17:52:09 2017
New Revision: 322767
URL: https://svnweb.freebsd.org/changeset/base/322767

Log:
  Fix FreeBSD-presence macro to fix the build on mips with clang.
  
  GCC doesn't define 'mips' which is why it doesn't trip over this.
  
  Sponsored by: DARPA / AFRL

Modified:
  head/contrib/top/loadavg.h

Modified: head/contrib/top/loadavg.h
==
--- head/contrib/top/loadavg.h  Mon Aug 21 17:49:01 2017(r322766)
+++ head/contrib/top/loadavg.h  Mon Aug 21 17:52:09 2017(r322767)
@@ -19,7 +19,7 @@
  *
  * Defined types:  load_avg for load averages, pctcpu for cpu percentages.
  */
-#if defined(mips) && !(defined(NetBSD) || defined(FreeBSD))
+#if defined(mips) && !(defined(NetBSD) || defined(__FreeBSD__))
 # include 
 # if defined(FBITS) && !defined(FSCALE)
 #  define FSCALE (1 << FBITS)  /* RISC/os on mips */
___
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: r322766 - in head/lib: libc/mips libcompiler_rt

2017-08-21 Thread John Baldwin
Author: jhb
Date: Mon Aug 21 17:49:01 2017
New Revision: 322766
URL: https://svnweb.freebsd.org/changeset/base/322766

Log:
  Include {u,}{div,mod}si3() on mips in libcompiler_rt.
  
  These builtins were listed in the mips-specific Symbol.map for libc but
  were not implemented.  Compiling mips with recent clang requires these
  symbols.
  
  Sponsored by: DARPA / AFRL

Modified:
  head/lib/libc/mips/Symbol.map
  head/lib/libcompiler_rt/Makefile.inc

Modified: head/lib/libc/mips/Symbol.map
==
--- head/lib/libc/mips/Symbol.map   Mon Aug 21 17:45:06 2017
(r322765)
+++ head/lib/libc/mips/Symbol.map   Mon Aug 21 17:49:01 2017
(r322766)
@@ -43,10 +43,6 @@ FBSDprivate_1.0 {
 
_set_tp;
___longjmp;
-   __umodsi3;
-   __modsi3;
-   __udivsi3;
-   __divsi3;
__makecontext;
__longjmp;
signalcontext;

Modified: head/lib/libcompiler_rt/Makefile.inc
==
--- head/lib/libcompiler_rt/Makefile.incMon Aug 21 17:45:06 2017
(r322765)
+++ head/lib/libcompiler_rt/Makefile.incMon Aug 21 17:49:01 2017
(r322766)
@@ -32,6 +32,7 @@ SRCF+=divdi3
 SRCF+= divmoddi4
 SRCF+= divmodsi4
 SRCF+= divsc3
+SRCF+= divsi3
 SRCF+= divtc3
 SRCF+= divti3
 SRCF+= divxc3
@@ -78,6 +79,7 @@ SRCF+=int_util
 SRCF+= lshrdi3
 SRCF+= lshrti3
 SRCF+= moddi3
+SRCF+= modsi3
 SRCF+= modti3
 SRCF+= muldc3
 SRCF+= muldi3
@@ -120,8 +122,10 @@ SRCF+= udivdi3
 SRCF+= udivmoddi4
 SRCF+= udivmodsi4
 SRCF+= udivmodti4
+SRCF+= udivsi3
 SRCF+= udivti3
 SRCF+= umoddi3
+SRCF+= umodsi3
 SRCF+= umodti3
 
 # __cpu_model support, only used on x86
@@ -174,13 +178,6 @@ SRCF+= truncdfsf2
 .if ${MACHINE_CPUARCH} != "arm"
 SRCF+= comparedf2
 SRCF+= comparesf2
-.endif
-
-.if ${MACHINE_CPUARCH} != "mips"
-SRCF+= divsi3
-SRCF+= modsi3
-SRCF+= udivsi3
-SRCF+= umodsi3
 .endif
 
 # FreeBSD-specific atomic intrinsics.
___
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: r322765 - head/sys/cddl/contrib/opensolaris/uts/common/sys

2017-08-21 Thread John Baldwin
Author: jhb
Date: Mon Aug 21 17:45:06 2017
New Revision: 322765
URL: https://svnweb.freebsd.org/changeset/base/322765

Log:
  Add a guard around _ILP32 for mips.
  
  This is already done for other architectures in this file and fixes the
  build with clang.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h

Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h Mon Aug 21 
17:40:51 2017(r322764)
+++ head/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h Mon Aug 21 
17:45:06 2017(r322765)
@@ -525,7 +525,9 @@ extern "C" {
 /*
  * Define the appropriate "implementation choices".
  */
+#if !defined(_ILP32)
 #define_ILP32
+#endif
 #if !defined(_I32LPx) && defined(_KERNEL)
 #define_I32LPx
 #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: r322764 - stable/11/sys/kern

2017-08-21 Thread Gleb Smirnoff
Author: glebius
Date: Mon Aug 21 17:40:51 2017
New Revision: 322764
URL: https://svnweb.freebsd.org/changeset/base/322764

Log:
  Merge r322321:
  
Plug uninitialized stack variable leak in sendfile(2).
  
  Reported by:  Ilja Van Sprundel 
  Submitted by: Domagoj Stolfa 
  Security: uninitialized stack variable leak

Modified:
  stable/11/sys/kern/kern_sendfile.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_sendfile.c
==
--- stable/11/sys/kern/kern_sendfile.c  Mon Aug 21 17:39:12 2017
(r322763)
+++ stable/11/sys/kern/kern_sendfile.c  Mon Aug 21 17:40:51 2017
(r322764)
@@ -930,6 +930,7 @@ sendfile(struct thread *td, struct sendfile_args *uap,
if (uap->offset < 0)
return (EINVAL);
 
+   sbytes = 0;
hdr_uio = trl_uio = NULL;
 
if (uap->hdtr != 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: r322763 - head/lib/libc/amd64/sys

2017-08-21 Thread Konstantin Belousov
Author: kib
Date: Mon Aug 21 17:39:12 2017
New Revision: 322763
URL: https://svnweb.freebsd.org/changeset/base/322763

Log:
  Optimize libc to get and set TLS using the RDFSBASE and RDGSBASE
  instructions, if supported both by CPU and kernel.
  
  Reviewed by:  jhb (previous version)
  Tested by:pho (previous version)
  Sponsored by: The FreeBSD Foundation
  MFC after:3 weeks
  Differential revision:https://reviews.freebsd.org/D12023

Added:
  head/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.c   (contents, props changed)
  head/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.h   (contents, props changed)
Modified:
  head/lib/libc/amd64/sys/Makefile.inc
  head/lib/libc/amd64/sys/amd64_get_fsbase.c
  head/lib/libc/amd64/sys/amd64_get_gsbase.c
  head/lib/libc/amd64/sys/amd64_set_fsbase.c
  head/lib/libc/amd64/sys/amd64_set_gsbase.c

Modified: head/lib/libc/amd64/sys/Makefile.inc
==
--- head/lib/libc/amd64/sys/Makefile.incMon Aug 21 17:38:02 2017
(r322762)
+++ head/lib/libc/amd64/sys/Makefile.incMon Aug 21 17:39:12 2017
(r322763)
@@ -1,7 +1,11 @@
 #  from: Makefile.inc,v 1.1 1993/09/03 19:04:23 jtc Exp
 # $FreeBSD$
 
-SRCS+= amd64_get_fsbase.c amd64_get_gsbase.c amd64_set_fsbase.c \
+SRCS+= \
+   amd64_detect_rdfsgsbase.c \
+   amd64_get_fsbase.c \
+   amd64_get_gsbase.c \
+   amd64_set_fsbase.c \
amd64_set_gsbase.c
 
 MDASM= vfork.S brk.S cerror.S exect.S getcontext.S \

Added: head/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.c   Mon Aug 21 17:39:12 
2017(r322763)
@@ -0,0 +1,63 @@
+/*-
+ * Copyright (c) 2017 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Konstantin Belousov 
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * 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$");
+
+#defineIN_RTLD 1
+#include 
+#undef IN_RTLD
+#include 
+#include 
+#include "amd64_detect_rdfsgsbase.h"
+#include "libc_private.h"
+
+static int state = RDFSGS_UNKNOWN;
+
+int
+amd64_detect_rdfsgsbase(void)
+{
+   u_int p[4];
+
+   if (__predict_true(state != RDFSGS_UNKNOWN))
+   return (state);
+
+   if (__getosreldate() >= P_OSREL_WRFSBASE) {
+   do_cpuid(0x0, p);
+   if (p[0] >= 0x7) {
+   cpuid_count(0x7, 0x0, p);
+   if ((p[1] & CPUID_STDEXT_FSGSBASE) != 0) {
+   state = RDFSGS_SUPPORTED;
+   return (state);
+   }
+   }
+   }
+   state = RDFSGS_UNSUPPORTED;
+   return (state);
+}

Added: head/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/amd64/sys/amd64_detect_rdfsgsbase.h   Mon Aug 21 17:39:12 
2017(r322763)
@@ -0,0 +1,43 @@
+/*-
+ * Copyright (c) 2017 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Konstantin Belousov 
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions 

svn commit: r322762 - in head/sys: amd64/amd64 amd64/include sys

2017-08-21 Thread Konstantin Belousov
Author: kib
Date: Mon Aug 21 17:38:02 2017
New Revision: 322762
URL: https://svnweb.freebsd.org/changeset/base/322762

Log:
  Make WRFSBASE and WRGSBASE instructions functional.
  
  Right now, we enable the CR4.FSGSBASE bit on CPUs which support the
  facility (Ivy and later), to allow usermode to read fs and gs bases
  without syscalls. This bit also controls the write access to bases
  from userspace, but WRFSBASE and WRGSBASE instructions currently
  cannot be used, because return path from both exceptions or interrupts
  overrides bases with the values from pcb.
  
  Supporting the instructions is useful because this means that usermode
  can implement green-threads completely in userspace without issuing
  syscalls to change all of the machine context.
  
  Support is implemented by saving the fs base and user gs base when
  PCB_FULL_IRET flag is set. The flag is set on the context switch,
  which potentially causes clobber of the bases due to activation of
  another context, and when explicit modification of the user context by
  a syscall or exception handler is performed. In particular, the patch
  moves setting of the flag before syscalls change context.
  
  The changes to doreti_exit and PUSH_FRAME to clear PCB_FULL_IRET on
  entry from userspace can be considered a bug fixes on its own.
  
  Reviewed by:  jhb (previous version)
  Tested by:pho (previous version)
  Sponsored by: The FreeBSD Foundation
  MFC after:3 weeks
  Differential revision:https://reviews.freebsd.org/D12023

Modified:
  head/sys/amd64/amd64/cpu_switch.S
  head/sys/amd64/amd64/exception.S
  head/sys/amd64/amd64/machdep.c
  head/sys/amd64/amd64/ptrace_machdep.c
  head/sys/amd64/amd64/sys_machdep.c
  head/sys/amd64/amd64/vm_machdep.c
  head/sys/amd64/include/asmacros.h
  head/sys/amd64/include/pcb.h
  head/sys/sys/param.h

Modified: head/sys/amd64/amd64/cpu_switch.S
==
--- head/sys/amd64/amd64/cpu_switch.S   Mon Aug 21 17:35:04 2017
(r322761)
+++ head/sys/amd64/amd64/cpu_switch.S   Mon Aug 21 17:38:02 2017
(r322762)
@@ -87,7 +87,6 @@ END(cpu_throw)
 ENTRY(cpu_switch)
/* Switch to new thread.  First, save context. */
movqTD_PCB(%rdi),%r8
-   orl $PCB_FULL_IRET,PCB_FLAGS(%r8)
 
movq(%rsp),%rax /* Hardware registers */
movq%r15,PCB_R15(%r8)
@@ -99,6 +98,30 @@ ENTRY(cpu_switch)
movq%rbx,PCB_RBX(%r8)
movq%rax,PCB_RIP(%r8)
 
+   testl   $PCB_FULL_IRET,PCB_FLAGS(%r8)
+   jnz 2f
+   orl $PCB_FULL_IRET,PCB_FLAGS(%r8)
+   testl   $TDP_KTHREAD,TD_PFLAGS(%rdi)
+   jnz 2f
+   testb   $CPUID_STDEXT_FSGSBASE,cpu_stdext_feature(%rip)
+   jz  2f
+   movl%fs,%eax
+   cmpl$KUF32SEL,%eax
+   jne 1f
+   rdfsbaseq %rax
+   movq%rax,PCB_FSBASE(%r8)
+1: movl%gs,%eax
+   cmpl$KUG32SEL,%eax
+   jne 2f
+   movq%rdx,%r12
+   movl$MSR_KGSBASE,%ecx   /* Read user gs base */
+   rdmsr
+   shlq$32,%rdx
+   orq %rdx,%rax
+   movq%rax,PCB_GSBASE(%r8)
+   movq%r12,%rdx
+
+2:
testl   $PCB_DBREGS,PCB_FLAGS(%r8)
jnz store_dr/* static predict not taken */
 done_store_dr:

Modified: head/sys/amd64/amd64/exception.S
==
--- head/sys/amd64/amd64/exception.SMon Aug 21 17:35:04 2017
(r322761)
+++ head/sys/amd64/amd64/exception.SMon Aug 21 17:38:02 2017
(r322762)
@@ -187,12 +187,13 @@ alltraps_testi:
jz  alltraps_pushregs_no_rdi
sti
 alltraps_pushregs_no_rdi:
-   movq%rsi,TF_RSI(%rsp)
movq%rdx,TF_RDX(%rsp)
+   movq%rax,TF_RAX(%rsp)
+alltraps_pushregs_no_rax:
+   movq%rsi,TF_RSI(%rsp)
movq%rcx,TF_RCX(%rsp)
movq%r8,TF_R8(%rsp)
movq%r9,TF_R9(%rsp)
-   movq%rax,TF_RAX(%rsp)
movq%rbx,TF_RBX(%rsp)
movq%rbp,TF_RBP(%rsp)
movq%r10,TF_R10(%rsp)
@@ -326,31 +327,53 @@ IDTVEC(prot)
 prot_addrf:
movq$0,TF_ADDR(%rsp)
movq%rdi,TF_RDI(%rsp)   /* free up a GP register */
+   movq%rax,TF_RAX(%rsp)
+   movq%rdx,TF_RDX(%rsp)
+   movw%fs,TF_FS(%rsp)
+   movw%gs,TF_GS(%rsp)
leaqdoreti_iret(%rip),%rdi
cmpq%rdi,TF_RIP(%rsp)
-   je  1f  /* kernel but with user gsbase!! */
+   je  5f  /* kernel but with user gsbase!! */
testb   $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */
-   jz  2f  /* already running with kernel GS.base 
*/
-1: swapgs
-2: movqPCPU(CURPCB),%rdi
-   orl $PCB_FULL_IRET,PCB_FLAGS(%rdi)  /* always full iret from GPF */
-   movw

svn commit: r322761 - in stable/11/sys/arm64: arm64 include

2017-08-21 Thread John Baldwin
Author: jhb
Date: Mon Aug 21 17:35:04 2017
New Revision: 322761
URL: https://svnweb.freebsd.org/changeset/base/322761

Log:
  MFC 322437: Reliably enable debug exceptions on all CPUs.
  
  Previously, debug exceptions were only enabled on the boot CPU if
  DDB was enabled in the dbg_monitor_init() function.  APs also called
  this function, but since mp_machdep.c doesn't include opt_ddb.h, the
  APs ended up calling an empty stub defined in 
  instead of the real function.  Also, if DDB was not enabled in the kernel,
  the boot CPU would not enable debug exceptions.
  
  Fix this by adding a new dbg_init() function that always clears the OS
  lock to enable debug exceptions which the boot CPU and the APs call.
  This function also calls dbg_monitor_init() to enable hardware breakpoints
  from DDB on all CPUs if DDB is enabled.  Eventually base support for
  hardware breakpoints/watchpoints will need to move out of the DDB-only
  debug_monitor.c for use by userland debuggers.

Modified:
  stable/11/sys/arm64/arm64/debug_monitor.c
  stable/11/sys/arm64/arm64/machdep.c
  stable/11/sys/arm64/arm64/mp_machdep.c
  stable/11/sys/arm64/include/machdep.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm64/arm64/debug_monitor.c
==
--- stable/11/sys/arm64/arm64/debug_monitor.c   Mon Aug 21 17:29:37 2017
(r322760)
+++ stable/11/sys/arm64/arm64/debug_monitor.c   Mon Aug 21 17:35:04 2017
(r322761)
@@ -453,15 +453,12 @@ dbg_monitor_init(void)
 {
u_int i;
 
-   /* Clear OS lock */
-   WRITE_SPECIALREG(OSLAR_EL1, 0);
-
/* Find out many breakpoints and watchpoints we can use */
dbg_watchpoint_num = ((READ_SPECIALREG(ID_AA64DFR0_EL1) >> 20) & 0xf) + 
1;
dbg_breakpoint_num = ((READ_SPECIALREG(ID_AA64DFR0_EL1) >> 12) & 0xf) + 
1;
 
if (bootverbose && PCPU_GET(cpuid) == 0) {
-   db_printf("%d watchpoints and %d breakpoints supported\n",
+   printf("%d watchpoints and %d breakpoints supported\n",
dbg_watchpoint_num, dbg_breakpoint_num);
}
 

Modified: stable/11/sys/arm64/arm64/machdep.c
==
--- stable/11/sys/arm64/arm64/machdep.c Mon Aug 21 17:29:37 2017
(r322760)
+++ stable/11/sys/arm64/arm64/machdep.c Mon Aug 21 17:35:04 2017
(r322761)
@@ -970,11 +970,24 @@ initarm(struct arm64_bootparams *abp)
mutex_init();
init_param2(physmem);
 
-   dbg_monitor_init();
+   dbg_init();
kdb_init();
pan_enable();
 
early_boot = 0;
+}
+
+void
+dbg_init(void)
+{
+
+   /* Clear OS lock */
+   WRITE_SPECIALREG(OSLAR_EL1, 0);
+
+   /* This permits DDB to use debug registers for watchpoints. */
+   dbg_monitor_init();
+
+   /* TODO: Eventually will need to initialize debug registers here. */
 }
 
 #ifdef DDB

Modified: stable/11/sys/arm64/arm64/mp_machdep.c
==
--- stable/11/sys/arm64/arm64/mp_machdep.c  Mon Aug 21 17:29:37 2017
(r322760)
+++ stable/11/sys/arm64/arm64/mp_machdep.c  Mon Aug 21 17:35:04 2017
(r322761)
@@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
 #include 
 #include 
 #ifdef VFP
@@ -277,7 +276,7 @@ init_secondary(uint64_t cpu)
vfp_init();
 #endif
 
-   dbg_monitor_init();
+   dbg_init();
pan_enable();
 
/* Enable interrupts */

Modified: stable/11/sys/arm64/include/machdep.h
==
--- stable/11/sys/arm64/include/machdep.h   Mon Aug 21 17:29:37 2017
(r322760)
+++ stable/11/sys/arm64/include/machdep.h   Mon Aug 21 17:35:04 2017
(r322761)
@@ -40,6 +40,7 @@ struct arm64_bootparams {
 extern vm_paddr_t physmap[];
 extern u_int physmap_idx;
 
+void dbg_init(void);
 void initarm(struct arm64_bootparams *);
 extern void (*pagezero)(void *);
 
___
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: r322760 - stable/11/sys/arm64/arm64

2017-08-21 Thread John Baldwin
Author: jhb
Date: Mon Aug 21 17:29:37 2017
New Revision: 322760
URL: https://svnweb.freebsd.org/changeset/base/322760

Log:
  MFC 322436: Don't panic for PT_GETFPREGS.
  
  Only fetch the VFP state from the CPU if the thread whose registers are
  being requested is the current thread.  If a stopped thread's registers
  are being fetched by a debugger, the saved state in the PCB is already
  valid.

Modified:
  stable/11/sys/arm64/arm64/machdep.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm64/arm64/machdep.c
==
--- stable/11/sys/arm64/arm64/machdep.c Mon Aug 21 17:20:31 2017
(r322759)
+++ stable/11/sys/arm64/arm64/machdep.c Mon Aug 21 17:29:37 2017
(r322760)
@@ -213,7 +213,8 @@ fill_fpregs(struct thread *td, struct fpreg *regs)
 * If we have just been running VFP instructions we will
 * need to save the state to memcpy it below.
 */
-   vfp_save_state(td, pcb);
+   if (td == curthread)
+   vfp_save_state(td, pcb);
 
memcpy(regs->fp_q, pcb->pcb_vfp, sizeof(regs->fp_q));
regs->fp_cr = pcb->pcb_fpcr;
___
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: r322759 - stable/10/bin/chmod/tests

2017-08-21 Thread Glen Barber
Author: gjb
Date: Mon Aug 21 17:20:31 2017
New Revision: 322759
URL: https://svnweb.freebsd.org/changeset/base/322759

Log:
  MFC r321949, r321950, r322101:
  
   r321949 (ngie):
Add expected failures for ZFS
  
- :f_flag fails on ZFS because UF_IMMUTABLE isn't supported.
- :v_flag fails on ZFS because the mode for foo is [always] updated
  unnecessarily.
  
get_filesystem(..) (supporting function that was added to the test
script) is based on equivalent logic in
usr.bin/extattr/tests/extattr_test.sh .
  
   r321950 (ngie):
Always use first parameter passed to get_filesystem(..) instead of
discarding it and using `.` instead.
  
   r322101 (ngie):
Don't check result of chflags in f_flag_cleanup()
  
This will prevent false positives from occurring if the test is run
on ZFS since ZFS doesn't support fflags throbbing like UFS.
  
  PR:   221188, 221189
  Approved by:  re (marius)
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/bin/chmod/tests/chmod_test.sh
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/bin/chmod/tests/chmod_test.sh
==
--- stable/10/bin/chmod/tests/chmod_test.sh Mon Aug 21 17:05:43 2017
(r322758)
+++ stable/10/bin/chmod/tests/chmod_test.sh Mon Aug 21 17:20:31 2017
(r322759)
@@ -25,6 +25,13 @@
 #
 # $FreeBSD$
 
+get_filesystem()
+{
+   local mountpoint=$1
+
+   df -T $mountpoint | tail -n 1 | cut -wf 2
+}
+
 atf_test_case RH_flag
 RH_flag_head()
 {
@@ -94,6 +101,11 @@ f_flag_body()
 {
atf_check truncate -s 0 foo bar
atf_check chmod 0750 foo bar
+   case "$(get_filesystem .)" in
+   zfs)
+   atf_expect_fail "ZFS doesn't support UF_IMMUTABLE; returns 
EPERM - bug 221189"
+   ;;
+   esac
atf_check chflags uchg foo
atf_check -e not-empty -s not-exit:0 chmod 0700 foo bar
atf_check -o inline:'100750\n100700\n' stat -f '%p' foo bar
@@ -103,7 +115,7 @@ f_flag_body()
 
 f_flag_cleanup()
 {
-   atf_check chflags 0 foo
+   chflags 0 foo || :
 }
 
 atf_test_case h_flag
@@ -140,6 +152,11 @@ v_flag_body()
atf_check truncate -s 0 foo bar
atf_check chmod 0600 foo
atf_check chmod 0750 bar
+   case "$(get_filesystem .)" in
+   zfs)
+   atf_expect_fail "ZFS updates mode for foo unnecessarily - bug 
221188"
+   ;;
+   esac
atf_check -o 'inline:bar\n' chmod -v 0600 foo bar
atf_check chmod -v 0600 foo bar
for f in foo bar; do
___
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: r322757 - head/sys/ufs/ffs

2017-08-21 Thread Konstantin Belousov
Author: kib
Date: Mon Aug 21 16:23:44 2017
New Revision: 322757
URL: https://svnweb.freebsd.org/changeset/base/322757

Log:
  Avoid dereferencing potentially freed workitem in
  softdep_count_dependencies().
  
  Buffer's b_dep list is protected by the SU mount lock.  Owning the
  buffer lock is not enough to guarantee the stability of the list.
  
  Calculation of the UFS mount owning the workitems from the buffer must
  be much more careful to not dereference the work item which might be
  freed meantime.  To get to ump, use the pointers chain which does not
  involve workitems at all.
  
  Reported and tested by:   pho
  Reviewed by:  mckusick
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/ufs/ffs/ffs_softdep.c

Modified: head/sys/ufs/ffs/ffs_softdep.c
==
--- head/sys/ufs/ffs/ffs_softdep.c  Mon Aug 21 16:16:02 2017
(r322756)
+++ head/sys/ufs/ffs/ffs_softdep.c  Mon Aug 21 16:23:44 2017
(r322757)
@@ -13919,12 +13919,36 @@ softdep_count_dependencies(bp, wantcount)
struct newblk *newblk;
struct mkdir *mkdir;
struct diradd *dap;
+   struct vnode *vp;
+   struct mount *mp;
int i, retval;
 
retval = 0;
-   if ((wk = LIST_FIRST(>b_dep)) == NULL)
+   if (LIST_EMPTY(>b_dep))
return (0);
-   ump = VFSTOUFS(wk->wk_mp);
+   vp = bp->b_vp;
+
+   /*
+* The ump mount point is stable after we get a correct
+* pointer, since bp is locked and this prevents unmount from
+* proceed.  But to get to it, we cannot dereference bp->b_dep
+* head wk_mp, because we do not yet own SU ump lock and
+* workitem might be freed while dereferenced.
+*/
+retry:
+   if (vp->v_type == VCHR) {
+   VOP_LOCK(vp, LK_RETRY | LK_EXCLUSIVE);
+   mp = vp->v_type == VCHR ? vp->v_rdev->si_mountpt : NULL;
+   VOP_UNLOCK(vp, 0);
+   if (mp == NULL)
+   goto retry;
+   } else if (vp->v_type == VREG) {
+   mp = vp->v_mount;
+   } else {
+   return (0);
+   }
+   ump = VFSTOUFS(mp);
+
ACQUIRE_LOCK(ump);
LIST_FOREACH(wk, >b_dep, wk_list) {
switch (wk->wk_type) {
___
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: r322756 - head/sys/ufs/ffs

2017-08-21 Thread Konstantin Belousov
Author: kib
Date: Mon Aug 21 16:16:02 2017
New Revision: 322756
URL: https://svnweb.freebsd.org/changeset/base/322756

Log:
  Style.
  
  Reviewed by:  mckusick
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

Modified:
  head/sys/ufs/ffs/ffs_softdep.c

Modified: head/sys/ufs/ffs/ffs_softdep.c
==
--- head/sys/ufs/ffs/ffs_softdep.c  Mon Aug 21 15:44:57 2017
(r322755)
+++ head/sys/ufs/ffs/ffs_softdep.c  Mon Aug 21 16:16:02 2017
(r322756)
@@ -14059,7 +14059,7 @@ softdep_count_dependencies(bp, wantcount)
}
 out:
FREE_LOCK(ump);
-   return retval;
+   return (retval);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r322755 - stable/10/sys/i386/i386

2017-08-21 Thread Konstantin Belousov
Author: kib
Date: Mon Aug 21 15:44:57 2017
New Revision: 322755
URL: https://svnweb.freebsd.org/changeset/base/322755

Log:
  MFC r322667,r322706:
  Improve i386 #UD low-level kdtrace hook.
  
  Approved by:  re (marius)

Modified:
  stable/10/sys/i386/i386/exception.s
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/i386/i386/exception.s
==
--- stable/10/sys/i386/i386/exception.s Mon Aug 21 15:39:48 2017
(r322754)
+++ stable/10/sys/i386/i386/exception.s Mon Aug 21 15:44:57 2017
(r322755)
@@ -185,21 +185,29 @@ calltrap:
 #ifdef KDTRACE_HOOKS
SUPERALIGN_TEXT
 IDTVEC(ill)
-   /* Check if there is no DTrace hook registered. */
-   cmpl$0,dtrace_invop_jump_addr
+   /*
+* Check if a DTrace hook is registered.  The default (data) segment
+* cannot be used for this since %ds is not known good until we
+* verify that the entry was from kernel mode.
+*/
+   cmpl$0,%ss:dtrace_invop_jump_addr
je  norm_ill
 
-   /* Check if this is a user fault. */
-   cmpl$GSEL_KPL, 4(%esp)  /* Check the code segment. */
-
-   /* If so, just handle it as a normal trap. */
+   /*
+* Check if this is a user fault.  If so, just handle it as a normal
+* trap.
+*/
+   cmpl$GSEL_KPL, 4(%esp)  /* Check the code segment */
jne norm_ill
+   testl   $PSL_VM, 8(%esp)/* and vm86 mode. */
+   jnz norm_ill
 
/*
 * This is a kernel instruction fault that might have been caused
 * by a DTrace provider.
 */
-   pushal  /* Push all registers onto the stack. */
+   pushal
+   cld
 
/*
 * Set our jump address for the jump back in the event that
___
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: r322753 - stable/11/sys/i386/i386

2017-08-21 Thread Konstantin Belousov
Author: kib
Date: Mon Aug 21 15:11:58 2017
New Revision: 322753
URL: https://svnweb.freebsd.org/changeset/base/322753

Log:
  MFC r322667,r322706:
  Improve i386 #UD low-level kdtrace hook.

Modified:
  stable/11/sys/i386/i386/exception.s
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/i386/i386/exception.s
==
--- stable/11/sys/i386/i386/exception.s Mon Aug 21 14:14:13 2017
(r322752)
+++ stable/11/sys/i386/i386/exception.s Mon Aug 21 15:11:58 2017
(r322753)
@@ -183,21 +183,29 @@ calltrap:
 #ifdef KDTRACE_HOOKS
SUPERALIGN_TEXT
 IDTVEC(ill)
-   /* Check if there is no DTrace hook registered. */
-   cmpl$0,dtrace_invop_jump_addr
+   /*
+* Check if a DTrace hook is registered.  The default (data) segment
+* cannot be used for this since %ds is not known good until we
+* verify that the entry was from kernel mode.
+*/
+   cmpl$0,%ss:dtrace_invop_jump_addr
je  norm_ill
 
-   /* Check if this is a user fault. */
-   cmpl$GSEL_KPL, 4(%esp)  /* Check the code segment. */
-
-   /* If so, just handle it as a normal trap. */
+   /*
+* Check if this is a user fault.  If so, just handle it as a normal
+* trap.
+*/
+   cmpl$GSEL_KPL, 4(%esp)  /* Check the code segment */
jne norm_ill
+   testl   $PSL_VM, 8(%esp)/* and vm86 mode. */
+   jnz norm_ill
 
/*
 * This is a kernel instruction fault that might have been caused
 * by a DTrace provider.
 */
-   pushal  /* Push all registers onto the stack. */
+   pushal
+   cld
 
/*
 * Set our jump address for the jump back in the event that
___
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: r322752 - head/share/man/man7

2017-08-21 Thread Glen Barber
Author: gjb
Date: Mon Aug 21 14:14:13 2017
New Revision: 322752
URL: https://svnweb.freebsd.org/changeset/base/322752

Log:
  Update the tests(7) manual page to note the test suite is installed
  by default as of 11.0-RELEASE.
  
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/share/man/man7/tests.7

Modified: head/share/man/man7/tests.7
==
--- head/share/man/man7/tests.7 Mon Aug 21 13:54:29 2017(r322751)
+++ head/share/man/man7/tests.7 Mon Aug 21 14:14:13 2017(r322752)
@@ -26,7 +26,7 @@
 .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd March 22, 2017
+.Dd August 21, 2017
 .Dt TESTS 7
 .Os
 .Sh NAME
@@ -59,10 +59,9 @@ hierarchy.
 This manual page describes how to run the test suite and how to configure
 some of its optional features.
 .Ss Installing the test suite
-The test suite is not yet installed by default as part of
-.Fx ,
-but this is bound to change during the development of
-.Fx 11.0 .
+The test suite is installed by default as of
+.Fx
+11.0-RELEASE.
 .Pp
 If the
 .Pa /usr/tests
___
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: r322751 - head/sys/netipsec

2017-08-21 Thread Andrey V. Elsukov
Author: ae
Date: Mon Aug 21 13:54:29 2017
New Revision: 322751
URL: https://svnweb.freebsd.org/changeset/base/322751

Log:
  Remove stale comments.
  
  MFC after:1 week

Modified:
  head/sys/netipsec/ipsec.c

Modified: head/sys/netipsec/ipsec.c
==
--- head/sys/netipsec/ipsec.c   Mon Aug 21 13:52:21 2017(r322750)
+++ head/sys/netipsec/ipsec.c   Mon Aug 21 13:54:29 2017(r322751)
@@ -573,7 +573,6 @@ ipsec4_getpolicy(const struct mbuf *m, struct inpcb *i
if (sp == NULL && key_havesp(dir)) {
/* Make an index to look for a policy. */
ipsec4_setspidx_ipaddr(m, );
-   /* Fill ports in spidx if we have inpcb. */
ipsec4_get_ulp(m, , needport);
spidx.dir = dir;
sp = key_allocsp(, dir);
@@ -743,7 +742,6 @@ ipsec6_getpolicy(const struct mbuf *m, struct inpcb *i
if (sp == NULL && key_havesp(dir)) {
/* Make an index to look for a policy. */
ipsec6_setspidx_ipaddr(m, );
-   /* Fill ports in spidx if we have inpcb. */
ipsec6_get_ulp(m, , needport);
spidx.dir = dir;
sp = key_allocsp(, dir);
___
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: r322750 - head/sys/netipsec

2017-08-21 Thread Andrey V. Elsukov
Author: ae
Date: Mon Aug 21 13:52:21 2017
New Revision: 322750
URL: https://svnweb.freebsd.org/changeset/base/322750

Log:
  Fix the regression introduced in r275710.
  
  When a security policy should match TCP connection with specific ports,
  the SYN+ACK segment send by syncache_respond() is considered as forwarded
  packet, because at this moment TCP connection does not have PCB structure,
  and ip_output() is called without inpcb pointer. In this case SPIDX filled
  for SP lookup will not contain TCP ports and security policy will not
  be found. This can lead to unencrypted SYN+ACK on the wire.
  
  This patch restores the old behavior, when ports will not be filled only
  for forwarded packets.
  
  Reported by:  Dewayne Geraghty 
  MFC after:1 week

Modified:
  head/sys/netipsec/ipsec.c
  head/sys/netipsec/ipsec.h
  head/sys/netipsec/ipsec6.h
  head/sys/netipsec/ipsec_output.c

Modified: head/sys/netipsec/ipsec.c
==
--- head/sys/netipsec/ipsec.c   Mon Aug 21 12:42:05 2017(r322749)
+++ head/sys/netipsec/ipsec.c   Mon Aug 21 13:52:21 2017(r322750)
@@ -563,7 +563,8 @@ ipsec4_setspidx_ipaddr(const struct mbuf *m, struct se
 }
 
 static struct secpolicy *
-ipsec4_getpolicy(const struct mbuf *m, struct inpcb *inp, u_int dir)
+ipsec4_getpolicy(const struct mbuf *m, struct inpcb *inp, u_int dir,
+int needport)
 {
struct secpolicyindex spidx;
struct secpolicy *sp;
@@ -573,7 +574,7 @@ ipsec4_getpolicy(const struct mbuf *m, struct inpcb *i
/* Make an index to look for a policy. */
ipsec4_setspidx_ipaddr(m, );
/* Fill ports in spidx if we have inpcb. */
-   ipsec4_get_ulp(m, , inp != NULL);
+   ipsec4_get_ulp(m, , needport);
spidx.dir = dir;
sp = key_allocsp(, dir);
}
@@ -586,12 +587,13 @@ ipsec4_getpolicy(const struct mbuf *m, struct inpcb *i
  * Check security policy for *OUTBOUND* IPv4 packet.
  */
 struct secpolicy *
-ipsec4_checkpolicy(const struct mbuf *m, struct inpcb *inp, int *error)
+ipsec4_checkpolicy(const struct mbuf *m, struct inpcb *inp, int *error,
+int needport)
 {
struct secpolicy *sp;
 
*error = 0;
-   sp = ipsec4_getpolicy(m, inp, IPSEC_DIR_OUTBOUND);
+   sp = ipsec4_getpolicy(m, inp, IPSEC_DIR_OUTBOUND, needport);
if (sp != NULL)
sp = ipsec_checkpolicy(sp, inp, error);
if (sp == NULL) {
@@ -623,7 +625,7 @@ ipsec4_in_reject(const struct mbuf *m, struct inpcb *i
struct secpolicy *sp;
int result;
 
-   sp = ipsec4_getpolicy(m, inp, IPSEC_DIR_INBOUND);
+   sp = ipsec4_getpolicy(m, inp, IPSEC_DIR_INBOUND, 0);
result = ipsec_in_reject(sp, inp, m);
key_freesp();
if (result != 0)
@@ -731,7 +733,8 @@ ipsec6_setspidx_ipaddr(const struct mbuf *m, struct se
 }
 
 static struct secpolicy *
-ipsec6_getpolicy(const struct mbuf *m, struct inpcb *inp, u_int dir)
+ipsec6_getpolicy(const struct mbuf *m, struct inpcb *inp, u_int dir,
+int needport)
 {
struct secpolicyindex spidx;
struct secpolicy *sp;
@@ -741,7 +744,7 @@ ipsec6_getpolicy(const struct mbuf *m, struct inpcb *i
/* Make an index to look for a policy. */
ipsec6_setspidx_ipaddr(m, );
/* Fill ports in spidx if we have inpcb. */
-   ipsec6_get_ulp(m, , inp != NULL);
+   ipsec6_get_ulp(m, , needport);
spidx.dir = dir;
sp = key_allocsp(, dir);
}
@@ -754,12 +757,13 @@ ipsec6_getpolicy(const struct mbuf *m, struct inpcb *i
  * Check security policy for *OUTBOUND* IPv6 packet.
  */
 struct secpolicy *
-ipsec6_checkpolicy(const struct mbuf *m, struct inpcb *inp, int *error)
+ipsec6_checkpolicy(const struct mbuf *m, struct inpcb *inp, int *error,
+int needport)
 {
struct secpolicy *sp;
 
*error = 0;
-   sp = ipsec6_getpolicy(m, inp, IPSEC_DIR_OUTBOUND);
+   sp = ipsec6_getpolicy(m, inp, IPSEC_DIR_OUTBOUND, needport);
if (sp != NULL)
sp = ipsec_checkpolicy(sp, inp, error);
if (sp == NULL) {
@@ -791,7 +795,7 @@ ipsec6_in_reject(const struct mbuf *m, struct inpcb *i
struct secpolicy *sp;
int result;
 
-   sp = ipsec6_getpolicy(m, inp, IPSEC_DIR_INBOUND);
+   sp = ipsec6_getpolicy(m, inp, IPSEC_DIR_INBOUND, 0);
result = ipsec_in_reject(sp, inp, m);
key_freesp();
if (result)

Modified: head/sys/netipsec/ipsec.h
==
--- head/sys/netipsec/ipsec.h   Mon Aug 21 12:42:05 2017(r322749)
+++ head/sys/netipsec/ipsec.h   Mon Aug 21 13:52:21 2017(r322750)
@@ -320,7 +320,7 @@ int ipsec_if_input(struct mbuf *, struct secasvar *, u
 struct ipsecrequest *ipsec_newisr(void);
 void ipsec_delisr(struct ipsecrequest *);
 

Re: svn commit: r322678 - in head/usr.sbin/pw: . tests

2017-08-21 Thread Ed Maste
On 18 August 2017 at 21:08, Ngie Cooper (yaneurabeya)
 wrote:
>
>> On Aug 18, 2017, at 17:32, Ed Maste  wrote:
>>
>> Author: emaste
>> Date: Sat Aug 19 00:32:26 2017
>> New Revision: 322678
>> URL: https://svnweb.freebsd.org/changeset/base/322678
>>
>> Log:
>>  pw useradd: Validate the user name before creating the entry
>>
>>  Previouly it was possible to create users with spaces in the name with:
>>  pw useradd -u 1234 -g 1234 -n 'test user'
>>
>>  The "-g 1234" is relevant, without it the name was already rejected
>>  as expected:
...
>
> Usernames with passwords are permitted in some cases, e.g., AD.

I assume you meant "usernames with spaces"?

Note that this change only addresses the discrepancy between "pw
useradd 'test user'" (which was previously rejected) and "pw useradd
'test user' -g " (which was accepted prior to this change).
___
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: r322749 - head/kerberos5/libexec/kpasswdd

2017-08-21 Thread Cy Schubert
Author: cy
Date: Mon Aug 21 12:42:05 2017
New Revision: 322749
URL: https://svnweb.freebsd.org/changeset/base/322749

Log:
  Replace the include path using CURDIR with KRB5DIR. This is consistent
  with the rest of the Makefiles in kerberos5/.
  
  MFC after:1 week

Modified:
  head/kerberos5/libexec/kpasswdd/Makefile

Modified: head/kerberos5/libexec/kpasswdd/Makefile
==
--- head/kerberos5/libexec/kpasswdd/MakefileMon Aug 21 12:23:11 2017
(r322748)
+++ head/kerberos5/libexec/kpasswdd/MakefileMon Aug 21 12:42:05 2017
(r322749)
@@ -2,7 +2,7 @@
 
 PROG=  kpasswdd
 MAN=   kpasswdd.8
-CFLAGS+=-I${KRB5DIR}/lib/roken -I${.CURDIR:H:H}/lib/libhdb ${LDAPCFLAGS}
+CFLAGS+=-I${KRB5DIR}/lib/roken -I${KRB5DIR}/lib/libhdb ${LDAPCFLAGS}
 LIBADD=kadm5srv hdb krb5 roken vers asn1
 DPADD= ${LDAPDPADD}
 LDADD= ${LDAPLDADD}
___
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: r322748 - stable/11/sys/arm64/arm64

2017-08-21 Thread Ed Maste
Author: emaste
Date: Mon Aug 21 12:23:11 2017
New Revision: 322748
URL: https://svnweb.freebsd.org/changeset/base/322748

Log:
  MFC r322627: arm64: return error instead of panic in unimplemented ptrace ops
  
  We don't need a panic as a reminder that these need to be implemented.
  
  Reported by:  Shawn Webb
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/sys/arm64/arm64/machdep.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm64/arm64/machdep.c
==
--- stable/11/sys/arm64/arm64/machdep.c Mon Aug 21 11:56:47 2017
(r322747)
+++ stable/11/sys/arm64/arm64/machdep.c Mon Aug 21 12:23:11 2017
(r322748)
@@ -242,22 +242,24 @@ int
 fill_dbregs(struct thread *td, struct dbreg *regs)
 {
 
-   panic("ARM64TODO: fill_dbregs");
+   printf("ARM64TODO: fill_dbregs");
+   return (EDOOFUS);
 }
 
 int
 set_dbregs(struct thread *td, struct dbreg *regs)
 {
 
-   panic("ARM64TODO: set_dbregs");
+   printf("ARM64TODO: set_dbregs");
+   return (EDOOFUS);
 }
 
 int
 ptrace_set_pc(struct thread *td, u_long addr)
 {
 
-   panic("ARM64TODO: ptrace_set_pc");
-   return (0);
+   printf("ARM64TODO: ptrace_set_pc");
+   return (EDOOFUS);
 }
 
 int
___
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: r322746 - head/sys/compat/linuxkpi/common/src

2017-08-21 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Aug 21 11:51:40 2017
New Revision: 322746
URL: https://svnweb.freebsd.org/changeset/base/322746

Log:
  Fix for deadlock situation in the LinuxKPI's RCU synchronize API.
  
  Deadlock condition:
  The return value of TDQ_LOCKPTR(td) is the same for two threads.
  
  1) The first thread signals a wakeup while keeping the rcu_read_lock().
  This invokes sched_add() which in turn will try to lock TDQ_LOCK().
  
  2) The second thread is calling synchronize_rcu() calling mi_switch() over
  and over again trying to yield(). This prevents the first thread from running
  and releasing the RCU reader lock.
  
  Solution:
  Release the thread lock while yielding to allow other threads to acquire the
  lock pointed to by TDQ_LOCKPTR(td).
  
  Found by: KrishnamRaju ErapaRaju 
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/src/linux_rcu.c

Modified: head/sys/compat/linuxkpi/common/src/linux_rcu.c
==
--- head/sys/compat/linuxkpi/common/src/linux_rcu.c Mon Aug 21 10:26:11 
2017(r322745)
+++ head/sys/compat/linuxkpi/common/src/linux_rcu.c Mon Aug 21 11:51:40 
2017(r322746)
@@ -258,6 +258,15 @@ linux_synchronize_rcu_cb(ck_epoch_t *epoch __unused, c
sched_prio(td, prio);
/* task switch */
mi_switch(SW_VOL | SWT_RELINQUISH, NULL);
+
+   /*
+* Release the thread lock while yielding to
+* allow other threads to acquire the lock
+* pointed to by TDQ_LOCKPTR(td). Else a
+* deadlock like situation might happen.
+*/
+   thread_unlock(td);
+   thread_lock(td);
}
} else {
/*
___
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: r322745 - stable/11/share/mk

2017-08-21 Thread Li-Wen Hsu
Author: lwhsu (ports committer)
Date: Mon Aug 21 10:26:11 2017
New Revision: 322745
URL: https://svnweb.freebsd.org/changeset/base/322745

Log:
  MFC r322434:
  
  Re-remove excess / for installing SYMLINKS
  
  This excess / was introduced in r280129, and fixed in r295230, but got
  re-introduced while merging another branch in r298107.
  
  Approved by:  gjb
  Differential Revision:https://reviews.freebsd.org/D11995

Modified:
  stable/11/share/mk/bsd.links.mk
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/mk/bsd.links.mk
==
--- stable/11/share/mk/bsd.links.mk Mon Aug 21 10:07:12 2017
(r322744)
+++ stable/11/share/mk/bsd.links.mk Mon Aug 21 10:26:11 2017
(r322745)
@@ -20,5 +20,5 @@ _installlinks:
 .endfor
 .for s t in ${SYMLINKS}
@${ECHO} "${t} -> ${s}" ;\
-   ${INSTALL_SYMLINK} ${TAG_ARGS} ${s} ${DESTDIR}/${t}
+   ${INSTALL_SYMLINK} ${TAG_ARGS} ${s} ${DESTDIR}${t}
 .endfor
___
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: r322744 - in stable/10: share/man/man4 sys/conf sys/modules/geom/geom_map

2017-08-21 Thread Andrey V. Elsukov
Author: ae
Date: Mon Aug 21 10:07:12 2017
New Revision: 322744
URL: https://svnweb.freebsd.org/changeset/base/322744

Log:
  MFC r284152:
Add makefile to build geom_map kld. Document some GEOM_* options
in NOTES and geom(4).
  
  PR:   197766
  Approved by:  re (kib)

Added:
  stable/10/sys/modules/geom/geom_map/
 - copied from r284152, head/sys/modules/geom/geom_map/
Modified:
  stable/10/share/man/man4/geom.4
  stable/10/share/man/man4/geom_map.4
  stable/10/sys/conf/NOTES
  stable/10/sys/conf/options
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/geom.4
==
--- stable/10/share/man/man4/geom.4 Mon Aug 21 09:52:15 2017
(r322743)
+++ stable/10/share/man/man4/geom.4 Mon Aug 21 10:07:12 2017
(r322744)
@@ -34,7 +34,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 10, 2013
+.Dd June 8, 2015
 .Dt GEOM 4
 .Os
 .Sh NAME
@@ -52,12 +52,14 @@
 .Cd options GEOM_JOURNAL
 .Cd options GEOM_LABEL
 .Cd options GEOM_LINUX_LVM
+.Cd options GEOM_MAP
 .Cd options GEOM_MBR
 .Cd options GEOM_MIRROR
 .Cd options GEOM_MULTIPATH
 .Cd options GEOM_NOP
 .Cd options GEOM_PART_APM
 .Cd options GEOM_PART_BSD
+.Cd options GEOM_PART_BSD64
 .Cd options GEOM_PART_EBR
 .Cd options GEOM_PART_EBR_COMPAT
 .Cd options GEOM_PART_GPT
@@ -71,6 +73,7 @@
 .Cd options GEOM_SHSEC
 .Cd options GEOM_STRIPE
 .Cd options GEOM_SUNLABEL
+.Cd options GEOM_UNCOMPRESS
 .Cd options GEOM_UZIP
 .Cd options GEOM_VIRSTOR
 .Cd options GEOM_VOL

Modified: stable/10/share/man/man4/geom_map.4
==
--- stable/10/share/man/man4/geom_map.4 Mon Aug 21 09:52:15 2017
(r322743)
+++ stable/10/share/man/man4/geom_map.4 Mon Aug 21 10:07:12 2017
(r322744)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 17, 2011
+.Dd June 8, 2015
 .Dt GEOM_MAP 4
 .Os
 .Sh NAME
@@ -36,7 +36,7 @@ To compile this driver into the kernel,
 place the following line in your
 kernel configuration file:
 .Bd -ragged -offset indent
-.Cd "device geom_map"
+.Cd "options geom_map"
 .Ed
 .Sh DESCRIPTION
 The

Modified: stable/10/sys/conf/NOTES
==
--- stable/10/sys/conf/NOTESMon Aug 21 09:52:15 2017(r322743)
+++ stable/10/sys/conf/NOTESMon Aug 21 10:07:12 2017(r322744)
@@ -156,6 +156,7 @@ options GEOM_GATE   # Userland services.
 optionsGEOM_JOURNAL# Journaling.
 optionsGEOM_LABEL  # Providers labelization.
 optionsGEOM_LINUX_LVM  # Linux LVM2 volumes
+optionsGEOM_MAP# Map based partitioning
 optionsGEOM_MBR# DOS/MBR partitioning
 optionsGEOM_MIRROR # Disk mirroring.
 optionsGEOM_MULTIPATH  # Disk multipath
@@ -176,6 +177,7 @@ options GEOM_RAID3  # RAID3 functionality.
 optionsGEOM_SHSEC  # Shared secret.
 optionsGEOM_STRIPE # Disk striping.
 optionsGEOM_SUNLABEL   # Sun/Solaris partitioning
+optionsGEOM_UNCOMPRESS # Read-only compressed disks (lzma, zip)
 optionsGEOM_UZIP   # Read-only compressed disks
 optionsGEOM_VINUM  # Vinum logical volume manager
 optionsGEOM_VIRSTOR# Virtual storage.

Modified: stable/10/sys/conf/options
==
--- stable/10/sys/conf/options  Mon Aug 21 09:52:15 2017(r322743)
+++ stable/10/sys/conf/options  Mon Aug 21 10:07:12 2017(r322744)
@@ -104,6 +104,7 @@ GEOM_GATE   opt_geom.h
 GEOM_JOURNAL   opt_geom.h
 GEOM_LABEL opt_geom.h
 GEOM_LINUX_LVM opt_geom.h
+GEOM_MAP   opt_geom.h
 GEOM_MBR   opt_geom.h
 GEOM_MIRRORopt_geom.h
 GEOM_MOUNTVER  opt_geom.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: r322743 - stable/11/sys/amd64/amd64

2017-08-21 Thread Konstantin Belousov
Author: kib
Date: Mon Aug 21 09:52:15 2017
New Revision: 322743
URL: https://svnweb.freebsd.org/changeset/base/322743

Log:
  MFC r322496:
  Print whole machine state on double fault.

Modified:
  stable/11/sys/amd64/amd64/trap.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/amd64/trap.c
==
--- stable/11/sys/amd64/amd64/trap.cMon Aug 21 09:04:43 2017
(r322742)
+++ stable/11/sys/amd64/amd64/trap.cMon Aug 21 09:52:15 2017
(r322743)
@@ -822,10 +822,24 @@ dblfault_handler(struct trapframe *frame)
if (dtrace_doubletrap_func != NULL)
(*dtrace_doubletrap_func)();
 #endif
-   printf("\nFatal double fault\n");
-   printf("rip = 0x%lx\n", frame->tf_rip);
-   printf("rsp = 0x%lx\n", frame->tf_rsp);
-   printf("rbp = 0x%lx\n", frame->tf_rbp);
+   printf("\nFatal double fault\n"
+   "rip %#lx rsp %#lx rbp %#lx\n"
+   "rax %#lx rdx %#lx rbx %#lx\n"
+   "rcx %#lx rsi %#lx rdi %#lx\n"
+   "r8 %#lx r9 %#lx r10 %#lx\n"
+   "r11 %#lx r12 %#lx r13 %#lx\n"
+   "r14 %#lx r15 %#lx rflags %#lx\n"
+   "cs %#lx ss %#lx ds %#hx es %#hx fs %#hx gs %#hx\n"
+   "fsbase %#lx gsbase %#lx kgsbase %#lx\n",
+   frame->tf_rip, frame->tf_rsp, frame->tf_rbp,
+   frame->tf_rax, frame->tf_rdx, frame->tf_rbx,
+   frame->tf_rcx, frame->tf_rdi, frame->tf_rsi,
+   frame->tf_r8, frame->tf_r9, frame->tf_r10,
+   frame->tf_r11, frame->tf_r12, frame->tf_r13,
+   frame->tf_r14, frame->tf_r15, frame->tf_rflags,
+   frame->tf_cs, frame->tf_ss, frame->tf_ds, frame->tf_es,
+   frame->tf_fs, frame->tf_gs,
+   rdmsr(MSR_FSBASE), rdmsr(MSR_GSBASE), rdmsr(MSR_KGSBASE));
 #ifdef SMP
/* two separate prints in case of a trap on an unmapped page */
printf("cpuid = %d; ", PCPU_GET(cpuid));
___
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: r322742 - stable/11/sys/amd64/include

2017-08-21 Thread Konstantin Belousov
Author: kib
Date: Mon Aug 21 09:04:43 2017
New Revision: 322742
URL: https://svnweb.freebsd.org/changeset/base/322742

Log:
  MFC r322495:
  Add {rd,wr}{fs,gs}base C wrappers for instructions.

Modified:
  stable/11/sys/amd64/include/cpufunc.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/include/cpufunc.h
==
--- stable/11/sys/amd64/include/cpufunc.h   Mon Aug 21 09:03:20 2017
(r322741)
+++ stable/11/sys/amd64/include/cpufunc.h   Mon Aug 21 09:04:43 2017
(r322742)
@@ -651,6 +651,38 @@ load_gs(u_short sel)
 }
 #endif
 
+static __inline uint64_t
+rdfsbase(void)
+{
+   uint64_t x;
+
+   __asm __volatile("rdfsbase %0" : "=r" (x));
+   return (x);
+}
+
+static __inline void
+wrfsbase(uint64_t x)
+{
+
+   __asm __volatile("wrfsbase %0" : : "r" (x));
+}
+
+static __inline uint64_t
+rdgsbase(void)
+{
+   uint64_t x;
+
+   __asm __volatile("rdgsbase %0" : "=r" (x));
+   return (x);
+}
+
+static __inline void
+wrgsbase(uint64_t x)
+{
+
+   __asm __volatile("wrgsbase %0" : : "r" (x));
+}
+
 static __inline void
 bare_lgdt(struct region_descriptor *addr)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r322741 - in stable/11/sys: net netipsec

2017-08-21 Thread Andrey V. Elsukov
Author: ae
Date: Mon Aug 21 09:03:20 2017
New Revision: 322741
URL: https://svnweb.freebsd.org/changeset/base/322741

Log:
  MFC r321779:
Add inpcb pointer to struct ipsec_ctx_data and pass it to the pfil hook
from enc_hhook().
  
This should solve the problem when pf is used with if_enc(4) interface,
and outbound packet with existing PCB checked by pf, and this leads to
deadlock due to pf does its own PCB lookup and tries to take rlock when
wlock is already held.
  
Now we pass PCB pointer if it is known to the pfil hook, this helps to
avoid extra PCB lookup and thus rlock acquiring is not needed.
For inbound packets it is safe to pass NULL, because we do not held any
PCB locks yet.
  
PR: 220217
Sponsored by:   Yandex LLC

Modified:
  stable/11/sys/net/if_enc.c
  stable/11/sys/net/if_enc.h
  stable/11/sys/netipsec/ipsec.h
  stable/11/sys/netipsec/ipsec_input.c
  stable/11/sys/netipsec/ipsec_output.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/net/if_enc.c
==
--- stable/11/sys/net/if_enc.c  Mon Aug 21 07:03:02 2017(r322740)
+++ stable/11/sys/net/if_enc.c  Mon Aug 21 09:03:20 2017(r322741)
@@ -284,7 +284,7 @@ enc_hhook(int32_t hhook_type, int32_t hhook_id, void *
/* Make a packet looks like it was received on enc(4) */
rcvif = (*ctx->mp)->m_pkthdr.rcvif;
(*ctx->mp)->m_pkthdr.rcvif = ifp;
-   if (pfil_run_hooks(ph, ctx->mp, ifp, pdir, NULL) != 0 ||
+   if (pfil_run_hooks(ph, ctx->mp, ifp, pdir, ctx->inp) != 0 ||
*ctx->mp == NULL) {
*ctx->mp = NULL; /* consumed by filter */
return (EACCES);

Modified: stable/11/sys/net/if_enc.h
==
--- stable/11/sys/net/if_enc.h  Mon Aug 21 07:03:02 2017(r322740)
+++ stable/11/sys/net/if_enc.h  Mon Aug 21 09:03:20 2017(r322741)
@@ -33,6 +33,7 @@
 struct ipsec_ctx_data {
struct mbuf **mp;
struct secasvar *sav;
+   struct inpcb*inp;
uint8_t af;
 #defineIPSEC_ENC_BEFORE0x01
 #defineIPSEC_ENC_AFTER 0x02

Modified: stable/11/sys/netipsec/ipsec.h
==
--- stable/11/sys/netipsec/ipsec.h  Mon Aug 21 07:03:02 2017
(r322740)
+++ stable/11/sys/netipsec/ipsec.h  Mon Aug 21 09:03:20 2017
(r322741)
@@ -253,8 +253,9 @@ struct ipsecstat {
 #include 
 
 struct ipsec_ctx_data;
-#defineIPSEC_INIT_CTX(_ctx, _mp, _sav, _af, _enc) do { \
+#defineIPSEC_INIT_CTX(_ctx, _mp, _inp, _sav, _af, _enc) do {   \
(_ctx)->mp = (_mp); \
+   (_ctx)->inp = (_inp);   \
(_ctx)->sav = (_sav);   \
(_ctx)->af = (_af); \
(_ctx)->enc = (_enc);   \

Modified: stable/11/sys/netipsec/ipsec_input.c
==
--- stable/11/sys/netipsec/ipsec_input.cMon Aug 21 07:03:02 2017
(r322740)
+++ stable/11/sys/netipsec/ipsec_input.cMon Aug 21 09:03:20 2017
(r322741)
@@ -325,7 +325,7 @@ ipsec4_common_input_cb(struct mbuf *m, struct secasvar
(prot == IPPROTO_UDP || prot == IPPROTO_TCP))
udp_ipsec_adjust_cksum(m, sav, prot, skip);
 
-   IPSEC_INIT_CTX(, , sav, AF_INET, IPSEC_ENC_BEFORE);
+   IPSEC_INIT_CTX(, , NULL, sav, AF_INET, IPSEC_ENC_BEFORE);
if ((error = ipsec_run_hhooks(, HHOOK_TYPE_IPSEC_IN)) != 0)
goto bad;
ip = mtod(m, struct ip *);  /* update pointer */
@@ -416,7 +416,7 @@ ipsec4_common_input_cb(struct mbuf *m, struct secasvar
goto bad;
}
 
-   IPSEC_INIT_CTX(, , sav, af, IPSEC_ENC_AFTER);
+   IPSEC_INIT_CTX(, , NULL, sav, af, IPSEC_ENC_AFTER);
if ((error = ipsec_run_hhooks(, HHOOK_TYPE_IPSEC_IN)) != 0)
goto bad;
 
@@ -522,7 +522,7 @@ ipsec6_common_input_cb(struct mbuf *m, struct secasvar
goto bad;
}
 
-   IPSEC_INIT_CTX(, , sav, af, IPSEC_ENC_BEFORE);
+   IPSEC_INIT_CTX(, , NULL, sav, af, IPSEC_ENC_BEFORE);
if ((error = ipsec_run_hhooks(, HHOOK_TYPE_IPSEC_IN)) != 0)
goto bad;
 
@@ -593,7 +593,7 @@ ipsec6_common_input_cb(struct mbuf *m, struct secasvar
else
 #endif
af = AF_INET6;
-   IPSEC_INIT_CTX(, , sav, af, IPSEC_ENC_AFTER);
+   IPSEC_INIT_CTX(, , NULL, sav, af, IPSEC_ENC_AFTER);
if ((error = ipsec_run_hhooks(, HHOOK_TYPE_IPSEC_IN)) != 0)
goto bad;
if (skip == 0) {

Modified: stable/11/sys/netipsec/ipsec_output.c

svn commit: r322740 - in head: contrib/libc++/include contrib/llvm/include/llvm/CodeGen contrib/llvm/include/llvm/ExecutionEngine/Orc contrib/llvm/include/llvm/Object contrib/llvm/lib/Analysis cont...

2017-08-21 Thread Dimitry Andric
Author: dim
Date: Mon Aug 21 07:03:02 2017
New Revision: 322740
URL: https://svnweb.freebsd.org/changeset/base/322740

Log:
  Upgrade our copies of clang, llvm, lld and libc++ to r311219 from the
  upstream release_50 branch.
  
  MFC after:2 months
  X-MFC-with:   r321369

Modified:
  head/contrib/libc++/include/string
  head/contrib/llvm/include/llvm/CodeGen/SelectionDAG.h
  head/contrib/llvm/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h
  head/contrib/llvm/include/llvm/Object/COFFImportFile.h
  head/contrib/llvm/lib/Analysis/ScalarEvolution.cpp
  head/contrib/llvm/lib/Analysis/ValueTracking.cpp
  head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
  head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  head/contrib/llvm/lib/CodeGen/VirtRegMap.cpp
  head/contrib/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
  head/contrib/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
  head/contrib/llvm/lib/Object/COFFImportFile.cpp
  head/contrib/llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
  head/contrib/llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp
  head/contrib/llvm/lib/Target/ARM/ARMInstrInfo.td
  head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp
  head/contrib/llvm/lib/Target/X86/X86InstrAVX512.td
  head/contrib/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
  head/contrib/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
  head/contrib/llvm/lib/Transforms/Scalar/BDCE.cpp
  head/contrib/llvm/tools/clang/include/clang-c/Index.h
  head/contrib/llvm/tools/clang/include/clang/AST/Decl.h
  head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticDriverKinds.td
  head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticGroups.td
  head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticLexKinds.td
  head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticParseKinds.td
  head/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td
  head/contrib/llvm/tools/clang/include/clang/Driver/Options.td
  head/contrib/llvm/tools/clang/include/clang/Driver/ToolChain.h
  head/contrib/llvm/tools/clang/include/clang/Frontend/LangStandards.def
  head/contrib/llvm/tools/clang/lib/AST/DeclCXX.cpp
  head/contrib/llvm/tools/clang/lib/AST/ExprCXX.cpp
  head/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp
  head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp
  head/contrib/llvm/tools/clang/lib/CodeGen/TargetInfo.cpp
  head/contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp
  head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/Mips.cpp
  head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp
  head/contrib/llvm/tools/clang/lib/Driver/ToolChains/CrossWindows.cpp
  head/contrib/llvm/tools/clang/lib/Driver/ToolChains/CrossWindows.h
  head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Darwin.cpp
  head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Darwin.h
  head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Gnu.cpp
  head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Gnu.h
  head/contrib/llvm/tools/clang/lib/Driver/ToolChains/MSVC.cpp
  head/contrib/llvm/tools/clang/lib/Driver/ToolChains/MSVC.h
  head/contrib/llvm/tools/clang/lib/Driver/ToolChains/MinGW.cpp
  head/contrib/llvm/tools/clang/lib/Driver/ToolChains/MinGW.h
  head/contrib/llvm/tools/clang/lib/Driver/ToolChains/NetBSD.h
  head/contrib/llvm/tools/clang/lib/Frontend/InitPreprocessor.cpp
  head/contrib/llvm/tools/clang/lib/Parse/ParseCXXInlineMethods.cpp
  head/contrib/llvm/tools/clang/lib/Sema/SemaCast.cpp
  head/contrib/llvm/tools/clang/lib/Sema/SemaCodeComplete.cpp
  head/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp
  head/contrib/llvm/tools/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  head/contrib/llvm/tools/lld/COFF/Driver.cpp
  head/contrib/llvm/tools/lld/ELF/Driver.cpp
  head/contrib/llvm/tools/lld/ELF/Options.td
  head/contrib/llvm/tools/llvm-objdump/llvm-objdump.cpp
  head/lib/clang/include/clang/Basic/Version.inc
  head/lib/clang/include/lld/Config/Version.inc
  head/lib/clang/include/llvm/Support/VCSRevision.h
Directory Properties:
  head/contrib/compiler-rt/   (props changed)
  head/contrib/libc++/   (props changed)
  head/contrib/llvm/   (props changed)
  head/contrib/llvm/tools/clang/   (props changed)
  head/contrib/llvm/tools/lld/   (props changed)
  head/contrib/llvm/tools/lldb/   (props changed)

Modified: head/contrib/libc++/include/string
==
--- head/contrib/libc++/include/string  Mon Aug 21 05:25:30 2017
(r322739)
+++ head/contrib/libc++/include/string  Mon Aug 21 07:03:02 2017
(r322740)
@@ -556,6 +556,8 @@ template
 operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, _CharT __y);
 
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS string operator+(char const*, string const&))
+
 template 
 class _LIBCPP_TEMPLATE_VIS __basic_string_common
 {
@@ -3999,7 +4001,6 @@ basic_string<_CharT, _Traits, _Allocator>::__subscript