svn commit: r303830 - head/usr.bin/getconf

2016-08-08 Thread Garrett Cooper
Author: ngie
Date: Mon Aug  8 07:19:30 2016
New Revision: 303830
URL: https://svnweb.freebsd.org/changeset/base/303830

Log:
  Remove vestigal references to __alpha__
  
  Replace alpha reference in getconf(1) with amd64 [*]
  
  MFC after:1 week
  PR:   211300 [*]
  Submitted by: Sevan Janiyan  [*]
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/usr.bin/getconf/getconf.1
  head/usr.bin/getconf/progenv.gperf

Modified: head/usr.bin/getconf/getconf.1
==
--- head/usr.bin/getconf/getconf.1  Mon Aug  8 07:16:13 2016
(r303829)
+++ head/usr.bin/getconf/getconf.1  Mon Aug  8 07:19:30 2016
(r303830)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 18, 2002
+.Dd August 8, 2016
 .Dt GETCONF 1
 .Os
 .Sh NAME
@@ -122,7 +122,7 @@ Exactly 32-bit integer, long, and pointe
 .It Li POSIX_V6_LP64_OFF64
 Exactly 32-bit integer; exactly 64-bit long, pointer, and file offset.
 .Sy Supported platforms :
-.Tn Alpha ,
+.Tn AMD64 ,
 .Tn SPARC64 .
 .It Li POSIX_V6_LPBIG_OFFBIG
 At least 32-bit integer; at least 64-bit long, pointer, and file offset.

Modified: head/usr.bin/getconf/progenv.gperf
==
--- head/usr.bin/getconf/progenv.gperf  Mon Aug  8 07:16:13 2016
(r303829)
+++ head/usr.bin/getconf/progenv.gperf  Mon Aug  8 07:19:30 2016
(r303830)
@@ -30,7 +30,7 @@ static const struct map *in_word_set(con
  * be updated.  (We cheat here and define the supported environments
  * statically.)
  */
-#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__)
+#if defined(__sparc64__) || defined(__amd64__)
 #definehave_LP64_OFF64 NULL
 #endif
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r303831 - head/sys/netinet

2016-08-08 Thread Michael Tuexen
Author: tuexen
Date: Mon Aug  8 08:20:10 2016
New Revision: 303831
URL: https://svnweb.freebsd.org/changeset/base/303831

Log:
  Fix a locking issue found by stress testing with tsctp.
  The inp read lock neeeds to be held when considering control->do_not_ref_stcb.
  MFC after:3 days

Modified:
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctputil.c
==
--- head/sys/netinet/sctputil.c Mon Aug  8 07:19:30 2016(r303830)
+++ head/sys/netinet/sctputil.c Mon Aug  8 08:20:10 2016(r303831)
@@ -5497,20 +5497,16 @@ restart_nosblocks:
}
/* Clear the held length since there is something to read */
control->held_length = 0;
-   if (hold_rlock) {
-   SCTP_INP_READ_UNLOCK(inp);
-   hold_rlock = 0;
-   }
 found_one:
/*
 * If we reach here, control has a some data for us to read off.
 * Note that stcb COULD be NULL.
 */
-   control->some_taken++;
-   if (hold_sblock) {
-   SOCKBUF_UNLOCK(&so->so_rcv);
-   hold_sblock = 0;
+   if (hold_rlock == 0) {
+   hold_rlock = 1;
+   SCTP_INP_READ_LOCK(inp);
}
+   control->some_taken++;
stcb = control->stcb;
if (stcb) {
if ((control->do_not_ref_stcb == 0) &&
@@ -5684,6 +5680,14 @@ found_one:
}
 #endif
}
+   if (hold_rlock) {
+   SCTP_INP_READ_UNLOCK(inp);
+   hold_rlock = 0;
+   }
+   if (hold_sblock) {
+   SOCKBUF_UNLOCK(&so->so_rcv);
+   hold_sblock = 0;
+   }
/* now copy out what data we can */
if (mp == NULL) {
/* copy out each mbuf in the chain up to length */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r303716 - head/crypto/openssh

2016-08-08 Thread Dag-Erling Smørgrav
Andrey Chernov  writes:
> You should address your complains to original openssh author instead, it
> was his decision to get rid of weak algos. In my personal opinion, if
> your hardware is outdated, just drop it out. We can't turn our security
> team into compatibility team, by constantly restoring removed code, such
> code quickly becomes outdated and may add new security holes even being
> inactive.

This.  It's bad enough that we will never be able to upgrade OpenSSH
past 7.3 in 10 because some of the deprecated code that we re-enabled is
scheduled to be removed entirely.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Re: svn commit: r303716 - head/crypto/openssh

2016-08-08 Thread Dag-Erling Smørgrav
Bruce Simpson  writes:
> Alcatel-Lucent OmniSwitch 6800 login broken (pfSense 2.3.2 which
> accepted the upstream change, workaround no-go)
>
> [2.3.2-RELEASE][r...@gw.lab]/root: ssh -l admin
> -oKexAlgorithms=+diffie-hellman-group1-sha1 192.168.1.XXX
> Fssh_ssh_dispatch_run_fatal: Connection to 192.168.1.XXX port 22: DH
> GEX group out of range

This patch did not remove weak DH groups.  That happened in 7.0p1 back
in January.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Re: svn commit: r303716 - head/crypto/openssh

2016-08-08 Thread Bruce Simpson

On 08/08/16 11:36, Dag-Erling Smørgrav wrote:

Bruce Simpson  writes:

Alcatel-Lucent OmniSwitch 6800 login broken

...

This patch did not remove weak DH groups.  That happened in 7.0p1 back
in January.


So my reading of this is that PuTTy may be the best workaround for 
end-users who have to speak to older SSH implementations.


That's what I ended up using to get around some of the SSH interop mess 
with the Proxim AP4000, although much of that was not directly related 
to the cipher suite!


(But ideally it should support X11-headless operation. To my knowledge, 
and as others have mentioned, it is currently believed to require it.)

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

svn commit: r303832 - head/crypto/openssh

2016-08-08 Thread Dag-Erling Smørgrav
Author: des
Date: Mon Aug  8 10:46:18 2016
New Revision: 303832
URL: https://svnweb.freebsd.org/changeset/base/303832

Log:
  Try to check whether each key file exists before adding it, and bail out
  if we didn't find any of them.  This reduces log spam about key files for
  deprecated algorithms, which we look for but don't generate.
  
  PR:   208254
  MFC after:3 days

Modified:
  head/crypto/openssh/servconf.c

Modified: head/crypto/openssh/servconf.c
==
--- head/crypto/openssh/servconf.c  Mon Aug  8 08:20:10 2016
(r303831)
+++ head/crypto/openssh/servconf.c  Mon Aug  8 10:46:18 2016
(r303832)
@@ -22,6 +22,7 @@ __RCSID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -206,24 +207,28 @@ fill_default_server_options(ServerOption
/* Standard Options */
if (options->protocol == SSH_PROTO_UNKNOWN)
options->protocol = SSH_PROTO_2;
+#define add_host_key_file(path)
\
+   do {\
+   if (access((path), O_RDONLY) == 0)  \
+   options->host_key_files \
+   [options->num_host_key_files++] = (path);   \
+   } while (0)
if (options->num_host_key_files == 0) {
/* fill default hostkeys for protocols */
if (options->protocol & SSH_PROTO_1)
-   options->host_key_files[options->num_host_key_files++] =
-   _PATH_HOST_KEY_FILE;
+   add_host_key_file(_PATH_HOST_KEY_FILE);
if (options->protocol & SSH_PROTO_2) {
-   options->host_key_files[options->num_host_key_files++] =
-   _PATH_HOST_RSA_KEY_FILE;
-   options->host_key_files[options->num_host_key_files++] =
-   _PATH_HOST_DSA_KEY_FILE;
+   add_host_key_file(_PATH_HOST_RSA_KEY_FILE);
+   add_host_key_file(_PATH_HOST_DSA_KEY_FILE);
 #ifdef OPENSSL_HAS_ECC
-   options->host_key_files[options->num_host_key_files++] =
-   _PATH_HOST_ECDSA_KEY_FILE;
+   add_host_key_file(_PATH_HOST_ECDSA_KEY_FILE);
 #endif
-   options->host_key_files[options->num_host_key_files++] =
-   _PATH_HOST_ED25519_KEY_FILE;
+   add_host_key_file(_PATH_HOST_ED25519_KEY_FILE);
}
}
+#undef add_host_key_file
+   if (options->num_host_key_files == 0)
+   fatal("No host key files found");
/* No certificates by default */
if (options->num_ports == 0)
options->ports[options->num_ports++] = SSH_DEFAULT_PORT;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r303716 - head/crypto/openssh

2016-08-08 Thread Baptiste Daroussin
On Mon, Aug 08, 2016 at 11:40:55AM +0100, Bruce Simpson wrote:
> On 08/08/16 11:36, Dag-Erling Smørgrav wrote:
> > Bruce Simpson  writes:
> > > Alcatel-Lucent OmniSwitch 6800 login broken
> ...
> > This patch did not remove weak DH groups.  That happened in 7.0p1 back
> > in January.
> 
> So my reading of this is that PuTTy may be the best workaround for end-users
> who have to speak to older SSH implementations.
> 
> That's what I ended up using to get around some of the SSH interop mess with
> the Proxim AP4000, although much of that was not directly related to the
> cipher suite!
> 
> (But ideally it should support X11-headless operation. To my knowledge, and
> as others have mentioned, it is currently believed to require it.)

putty comes with cli tools:
plink being the cli ssh client, just use that one.

You can also rebuild putty disabling the GTK2 option if you want the package not
to drag in all the X11 related stuff


signature.asc
Description: PGP signature


Re: svn commit: r303716 - head/crypto/openssh

2016-08-08 Thread Dag-Erling Smørgrav
Warner Losh  writes:
> Andrey Chernov  writes:
> > FreeBSD 11 is not released yet (betas are not counted), stable-10 too,
> > so it is right time to deprecate for them.
> Nice try, but feature freeze was months ago. Have you got buy in from the
> security officer and the release engineer?
>
> I didn’t think so...

You have absolutely *no* basis for this claim, and I would like you to
retract it.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Re: svn commit: r303716 - head/crypto/openssh

2016-08-08 Thread Brooks Davis
On Sun, Aug 07, 2016 at 03:48:44PM -0700, Xin Li wrote:
> 
> 
> On 8/7/16 14:20, Warner Losh wrote:
> > 
> >> On Aug 7, 2016, at 3:11 PM, Andrey Chernov  wrote:
> >>
> >>> OTOH, FreeBSD has a documented deprecation process that says things will
> >>> continue working for a major release after being formally deprecated.
> >>
> >> FreeBSD 11 is not released yet (betas are not counted), stable-10 too,
> >> so it is right time to deprecate for them.
> > 
> > Nice try, but feature freeze was months ago. Have you got buy in from the
> > security officer and the release engineer?
> 
> Well, despite the fact that I have to admit that I get locked out from
> my own storage box too, however (even without wearing any hat) I am for
> the change and would blame myself for being lazy in adopting the change
> when the upstream have announced it earlier about a year ago.

While the timing sucks, I don't see any way around this change given our
experience with the HPN patches and that upstream plans to kill this
feature, we must not ship 11 with support enabled.  There's just no
practical way to keep adding back a feature for 4-5 years.

-- Brooks


signature.asc
Description: PGP signature


svn commit: r303833 - head/sys/contrib/cloudabi

2016-08-08 Thread Ed Schouten
Author: ed
Date: Mon Aug  8 13:15:37 2016
New Revision: 303833
URL: https://svnweb.freebsd.org/changeset/base/303833

Log:
  Import vDSO-related source files from the CloudABI repository.
  
  CloudABI executables that are emulated on Mac OS X do not invoke system
  calls through "syscall". Instead, they make use of a vDSO that is
  provided by the emulator that provides symbols for all of the system
  call routines. The emulator can implement these any way it likes.
  
  At some point in time we want to do this for native execution as well,
  so that CloudABI executables are entirely oblivious of how system calls
  need to be performed. They will simply call into functions and let that
  deal with all of the details.
  
  These source files can be used to generate a simple vDSO that does
  nothing more than invoke "syscall". All we need to do now is map it into
  the processes.
  
  Obtained from:https://github.com/NuxiNL/cloudabi

Added:
  head/sys/contrib/cloudabi/cloudabi_types.h   (contents, props changed)
  head/sys/contrib/cloudabi/cloudabi_vdso_aarch64.c   (contents, props changed)
  head/sys/contrib/cloudabi/cloudabi_vdso_x86_64.c   (contents, props changed)

Added: head/sys/contrib/cloudabi/cloudabi_types.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/contrib/cloudabi/cloudabi_types.h  Mon Aug  8 13:15:37 2016
(r303833)
@@ -0,0 +1,273 @@
+// Copyright (c) 2016 Nuxi (https://nuxi.nl/) and contributors.
+//
+// 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.
+//
+// This file is automatically generated. Do not edit.
+//
+// Source: https://github.com/NuxiNL/cloudabi
+
+#ifndef CLOUDABI_TYPES_H
+#define CLOUDABI_TYPES_H
+
+#include "cloudabi_types_common.h"
+
+typedef struct {
+   _Alignas(4) cloudabi_auxtype_t a_type;
+   union {
+   size_t a_val;
+   void *a_ptr;
+   };
+} cloudabi_auxv_t;
+_Static_assert(offsetof(cloudabi_auxv_t, a_type) == 0, "Incorrect layout");
+_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_auxv_t, a_val) == 4, 
"Incorrect layout");
+_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_auxv_t, a_val) == 8, 
"Incorrect layout");
+_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_auxv_t, a_ptr) == 4, 
"Incorrect layout");
+_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_auxv_t, a_ptr) == 8, 
"Incorrect layout");
+_Static_assert(sizeof(void *) != 4 || sizeof(cloudabi_auxv_t) == 8, "Incorrect 
layout");
+_Static_assert(sizeof(void *) != 8 || sizeof(cloudabi_auxv_t) == 16, 
"Incorrect layout");
+_Static_assert(sizeof(void *) != 4 || _Alignof(cloudabi_auxv_t) == 4, 
"Incorrect layout");
+_Static_assert(sizeof(void *) != 8 || _Alignof(cloudabi_auxv_t) == 8, 
"Incorrect layout");
+
+typedef struct {
+   const void *iov_base;
+   size_t iov_len;
+} cloudabi_ciovec_t;
+_Static_assert(offsetof(cloudabi_ciovec_t, iov_base) == 0, "Incorrect layout");
+_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_ciovec_t, iov_len) == 
4, "Incorrect layout");
+_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_ciovec_t, iov_len) == 
8, "Incorrect layout");
+_Static_assert(sizeof(void *) != 4 || sizeof(cloudabi_ciovec_t) == 8, 
"Incorrect layout");
+_Static_assert(sizeof(void *) != 8 || sizeof(cloudabi_ciovec_t) == 16, 
"Incorrect layout");
+_Static_assert(sizeof(void *) != 4 || _Alignof(cloudabi_ciovec_t) == 4, 
"Incorrect layout");
+_Static_assert(sizeof(void *) != 8 || _Alignof(cloudabi_ciovec_t) == 8, 
"Incorrect layout");
+
+typedef struct {
+   _Alignas(8) cloudabi_userdata_t userdata;
+   _Alignas(2) cloudabi_errno_t error;
+   _Alignas(1) cloudab

svn commit: r303834 - head/sys/netinet

2016-08-08 Thread Michael Tuexen
Author: tuexen
Date: Mon Aug  8 13:52:18 2016
New Revision: 303834
URL: https://svnweb.freebsd.org/changeset/base/303834

Log:
  Fix the sending of FORWARD-TSN and I-FORWARD-TSN chunks. The
  last SID/SSN pair wasn't filled in.
  Thanks to Julian Cordes for providing a packetdrill script
  triggering the issue and making me aware of the bug.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Mon Aug  8 13:15:37 2016
(r303833)
+++ head/sys/netinet/sctp_output.c  Mon Aug  8 13:52:18 2016
(r303834)
@@ -10258,9 +10258,14 @@ void
 send_forward_tsn(struct sctp_tcb *stcb,
 struct sctp_association *asoc)
 {
-   struct sctp_tmit_chunk *chk;
+   struct sctp_tmit_chunk *chk, *at, *tp1, *last;
struct sctp_forward_tsn_chunk *fwdtsn;
+   struct sctp_strseq *strseq;
+   struct sctp_strseq_mid *strseq_m;
uint32_t advance_peer_ack_point;
+   unsigned int cnt_of_space, i, ovh;
+   unsigned int space_needed;
+   unsigned int cnt_of_skipped = 0;
int old;
 
if (asoc->idata_supported) {
@@ -10315,165 +10320,155 @@ sctp_fill_in_rest:
 * stream/seq of the ones we skip.
 */
SCTP_BUF_LEN(chk->data) = 0;
-   {
-   struct sctp_tmit_chunk *at, *tp1, *last;
-   struct sctp_strseq *strseq;
-   struct sctp_strseq_mid *strseq_m;
-   unsigned int cnt_of_space, i, ovh;
-   unsigned int space_needed;
-   unsigned int cnt_of_skipped = 0;
-
-   TAILQ_FOREACH(at, &asoc->sent_queue, sctp_next) {
-   if ((at->sent != SCTP_FORWARD_TSN_SKIP) &&
-   (at->sent != SCTP_DATAGRAM_NR_ACKED)) {
-   /* no more to look at */
-   break;
-   }
-   if ((at->rec.data.rcv_flags & SCTP_DATA_UNORDERED) && 
old) {
-   /* We don't report these */
-   continue;
-   }
-   cnt_of_skipped++;
+   TAILQ_FOREACH(at, &asoc->sent_queue, sctp_next) {
+   if ((at->sent != SCTP_FORWARD_TSN_SKIP) &&
+   (at->sent != SCTP_DATAGRAM_NR_ACKED)) {
+   /* no more to look at */
+   break;
}
-   if (old) {
-   space_needed = (sizeof(struct sctp_forward_tsn_chunk) +
-   (cnt_of_skipped * sizeof(struct sctp_strseq)));
-   } else {
-   space_needed = (sizeof(struct sctp_forward_tsn_chunk) +
-   (cnt_of_skipped * sizeof(struct sctp_strseq_mid)));
+   if (old && (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED)) {
+   /* We don't report these */
+   continue;
}
-   cnt_of_space = (unsigned int)M_TRAILINGSPACE(chk->data);
+   cnt_of_skipped++;
+   }
+   if (old) {
+   space_needed = (sizeof(struct sctp_forward_tsn_chunk) +
+   (cnt_of_skipped * sizeof(struct sctp_strseq)));
+   } else {
+   space_needed = (sizeof(struct sctp_forward_tsn_chunk) +
+   (cnt_of_skipped * sizeof(struct sctp_strseq_mid)));
+   }
+   cnt_of_space = (unsigned int)M_TRAILINGSPACE(chk->data);
 
-   if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
-   ovh = SCTP_MIN_OVERHEAD;
-   } else {
-   ovh = SCTP_MIN_V4_OVERHEAD;
-   }
-   if (cnt_of_space > (asoc->smallest_mtu - ovh)) {
-   /* trim to a mtu size */
-   cnt_of_space = asoc->smallest_mtu - ovh;
-   }
+   if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
+   ovh = SCTP_MIN_OVERHEAD;
+   } else {
+   ovh = SCTP_MIN_V4_OVERHEAD;
+   }
+   if (cnt_of_space > (asoc->smallest_mtu - ovh)) {
+   /* trim to a mtu size */
+   cnt_of_space = asoc->smallest_mtu - ovh;
+   }
+   if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_TRY_ADVANCE) {
+   sctp_misc_ints(SCTP_FWD_TSN_CHECK,
+   0xff, 0, cnt_of_skipped,
+   asoc->advanced_peer_ack_point);
+   }
+   advance_peer_ack_point = asoc->advanced_peer_ack_point;
+   if (cnt_of_space < space_needed) {
+   /*-
+* ok we must trim down the chunk by lowering the
+* advance peer ack point.
+*/
if (SCTP_BASE_SYSCTL(sctp_logging_level) & 
SCTP_LOG_TRY_ADVANCE) {
sctp_misc_ints(SCTP_FWD_TSN_CHECK,
-

svn commit: r303836 - head/sys/dev/bxe

2016-08-08 Thread Ryan Stone
Author: rstone
Date: Mon Aug  8 16:19:24 2016
New Revision: 303836
URL: https://svnweb.freebsd.org/changeset/base/303836

Log:
  Don't enqueue NULL on a drbr
  
  In one corner case in the bxe TX path, a NULL mbuf could be enqueued onto
  a drbr queue.  This could case a KASSERT to fire with INVARIANTS enabled,
  or the processing of packets from the queue to be prematurely ended later
  on.
  
  Submitted by: Matt Joras (matt.joras AT isilon.com)
  Reviewed by:  davidcs
  MFC after:3 days
  Sponsored by: EMC / Isilon Storage Division
  Differential Revision:https://reviews.freebsd.org/D7041

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

Modified: head/sys/dev/bxe/bxe.c
==
--- head/sys/dev/bxe/bxe.c  Mon Aug  8 15:07:38 2016(r303835)
+++ head/sys/dev/bxe/bxe.c  Mon Aug  8 16:19:24 2016(r303836)
@@ -5624,7 +5624,8 @@ bxe_tx_mq_start_locked(struct bxe_softc 
 if (!sc->link_vars.link_up ||
 (if_getdrvflags(ifp) &
 (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) {
-rc = drbr_enqueue(ifp, tx_br, m);
+if (m != NULL)
+rc = drbr_enqueue(ifp, tx_br, m);
 goto bxe_tx_mq_start_locked_exit;
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r303837 - in head/sys: dev/mlx5/mlx5_en modules/mlx5en

2016-08-08 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Aug  8 16:22:16 2016
New Revision: 303837
URL: https://svnweb.freebsd.org/changeset/base/303837

Log:
  Switch to the new block based LRO input function for the mlx5en
  driver. This change significantly increases the overall RX aggregation
  ratio for heavily loaded networks handling 10-80 thousand simultaneous
  connections.
  
  Remove the turbo LRO code and all references to it which has now been
  superceeded by the tcp_lro_queue_mbuf() function.
  
  Tested by:Netflix
  Sponsored by: Mellanox Technologies
  MFC after:1 week

Deleted:
  head/sys/dev/mlx5/mlx5_en/tcp_tlro.c
  head/sys/dev/mlx5/mlx5_en/tcp_tlro.h
Modified:
  head/sys/dev/mlx5/mlx5_en/en.h
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
  head/sys/modules/mlx5en/Makefile

Modified: head/sys/dev/mlx5/mlx5_en/en.h
==
--- head/sys/dev/mlx5/mlx5_en/en.h  Mon Aug  8 16:19:24 2016
(r303836)
+++ head/sys/dev/mlx5/mlx5_en/en.h  Mon Aug  8 16:22:16 2016
(r303837)
@@ -59,10 +59,6 @@
 
 #include 
 
-#ifdef HAVE_TURBO_LRO
-#include "tcp_tlro.h"
-#endif
-
 #include 
 #include 
 #include 
@@ -460,11 +456,7 @@ struct mlx5e_rq {
struct ifnet *ifp;
struct mlx5e_rq_stats stats;
struct mlx5e_cq cq;
-#ifdef HAVE_TURBO_LRO
-   struct tlro_ctrl lro;
-#else
struct lro_ctrl lro;
-#endif
volatile int enabled;
int ix;
 

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cMon Aug  8 16:19:24 2016
(r303836)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cMon Aug  8 16:22:16 2016
(r303837)
@@ -666,10 +666,15 @@ mlx5e_create_rq(struct mlx5e_channel *c,
}
 
wq_sz = mlx5_wq_ll_get_size(&rq->wq);
+
+   err = -tcp_lro_init_args(&rq->lro, c->ifp, TCP_LRO_ENTRIES, wq_sz);
+   if (err)
+   goto err_rq_wq_destroy;
+
rq->mbuf = malloc(wq_sz * sizeof(rq->mbuf[0]), M_MLX5EN, M_WAITOK | 
M_ZERO);
if (rq->mbuf == NULL) {
err = -ENOMEM;
-   goto err_rq_wq_destroy;
+   goto err_lro_init;
}
for (i = 0; i != wq_sz; i++) {
struct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(&rq->wq, i);
@@ -694,20 +699,12 @@ mlx5e_create_rq(struct mlx5e_channel *c,
mlx5e_create_stats(&rq->stats.ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet),
buffer, mlx5e_rq_stats_desc, MLX5E_RQ_STATS_NUM,
rq->stats.arg);
-
-#ifdef HAVE_TURBO_LRO
-   if (tcp_tlro_init(&rq->lro, c->ifp, MLX5E_BUDGET_MAX) != 0)
-   rq->lro.mbuf = NULL;
-#else
-   if (tcp_lro_init(&rq->lro))
-   rq->lro.lro_cnt = 0;
-   else
-   rq->lro.ifp = c->ifp;
-#endif
return (0);
 
 err_rq_mbuf_free:
free(rq->mbuf, M_MLX5EN);
+err_lro_init:
+   tcp_lro_free(&rq->lro);
 err_rq_wq_destroy:
mlx5_wq_destroy(&rq->wq_ctrl);
 err_free_dma_tag:
@@ -726,11 +723,8 @@ mlx5e_destroy_rq(struct mlx5e_rq *rq)
sysctl_ctx_free(&rq->stats.ctx);
 
/* free leftover LRO packets, if any */
-#ifdef HAVE_TURBO_LRO
-   tcp_tlro_free(&rq->lro);
-#else
tcp_lro_free(&rq->lro);
-#endif
+
wq_sz = mlx5_wq_ll_get_size(&rq->wq);
for (i = 0; i != wq_sz; i++) {
if (rq->mbuf[i].mbuf != NULL) {

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c  Mon Aug  8 16:19:24 2016
(r303836)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c  Mon Aug  8 16:22:16 2016
(r303837)
@@ -369,15 +369,9 @@ mlx5e_poll_rx_cq(struct mlx5e_rq *rq, in
 
mlx5e_build_rx_mbuf(cqe, rq, mb, byte_cnt);
rq->stats.packets++;
-#ifdef HAVE_TURBO_LRO
-   if (mb->m_pkthdr.csum_flags == 0 ||
-   (rq->ifp->if_capenable & IFCAP_LRO) == 0 ||
-   rq->lro.mbuf == NULL) {
-   /* normal input */
-   rq->ifp->if_input(rq->ifp, mb);
-   } else {
-   tcp_tlro_rx(&rq->lro, mb);
-   }
+
+#if !defined(HAVE_TCP_LRO_RX)
+   tcp_lro_queue_mbuf(&rq->lro, mb);
 #else
if (mb->m_pkthdr.csum_flags == 0 ||
(rq->ifp->if_capenable & IFCAP_LRO) == 0 ||
@@ -395,9 +389,6 @@ wq_ll_pop:
 
/* ensure cq space is freed before enabling more cqes */
wmb();
-#ifndef HAVE_TURBO_LRO
-   tcp_lro_flush_all(&rq->lro);
-#endif
return (i);
 }
 
@@ -437,8 +428,6 @@ mlx5e_rx_cq_comp(struct mlx5_core_cq *mc
}
mlx5e_post_rx_wqes(rq);
mlx5e_cq_arm(&rq->cq);
-#ifdef HAVE_TURBO_LRO
-   tcp_tlro_flush(&rq->lro, 1);
-#endif
+   tcp_lro_f

svn commit: r303840 - head/contrib/netbsd-tests/lib/libc/sys

2016-08-08 Thread John Baldwin
Author: jhb
Date: Mon Aug  8 17:57:25 2016
New Revision: 303840
URL: https://svnweb.freebsd.org/changeset/base/303840

Log:
  Add timer_settime tests using SIGEV_THREAD.
  
  Note that these tests should work fine on NetBSD and other systems as
  SIGEV_THREAD is POSIX.
  
  Differential Revision:https://reviews.freebsd.org/D7121

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c
==
--- head/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c Mon Aug  8 
17:53:51 2016(r303839)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c Mon Aug  8 
17:57:25 2016(r303840)
@@ -116,6 +116,61 @@ timer_signal_create(clockid_t cid, bool 
ATF_REQUIRE(timer_delete(t) == 0);
 }
 
+#ifdef __FreeBSD__
+static void
+timer_callback(union sigval value)
+{
+   timer_t *tp;
+
+   tp = value.sival_ptr;
+
+   if (*tp == t)
+   fail = false;
+}
+
+static void
+timer_thread_create(clockid_t cid, bool expire)
+{
+   struct itimerspec tim;
+   struct sigevent evt;
+
+   t = 0;
+   fail = true;
+
+   (void)memset(&evt, 0, sizeof(struct sigevent));
+   (void)memset(&tim, 0, sizeof(struct itimerspec));
+
+   /*
+* Create the timer (SIGEV_THREAD).
+*/
+   evt.sigev_notify_function = timer_callback;
+   evt.sigev_value.sival_ptr = &t;
+   evt.sigev_notify = SIGEV_THREAD;
+
+   ATF_REQUIRE(timer_create(cid, &evt, &t) == 0);
+
+   /*
+* Start the timer.
+*/
+   tim.it_value.tv_sec = expire ? 5 : 1;
+   tim.it_value.tv_nsec = 0;
+
+   ATF_REQUIRE(timer_settime(t, 0, &tim, NULL) == 0);
+
+   (void)sleep(2);
+
+   if (expire) {
+   if (!fail)
+   atf_tc_fail("timer fired too soon");
+   } else {
+   if (fail)
+   atf_tc_fail("timer failed to fire");
+   }
+
+   ATF_REQUIRE(timer_delete(t) == 0);
+}
+#endif
+
 ATF_TC(timer_create_err);
 ATF_TC_HEAD(timer_create_err, tc)
 {
@@ -198,6 +253,64 @@ ATF_TC_BODY(timer_create_mono_expire, tc
timer_signal_create(CLOCK_MONOTONIC, true);
 }
 
+ATF_TC(timer_thread_create_real);
+ATF_TC_HEAD(timer_thread_create_real, tc)
+{
+
+   atf_tc_set_md_var(tc, "descr",
+   "Checks timer_create(2) with CLOCK_REALTIME and sigevent(3), "
+   "SIGEV_THREAD");
+}
+
+#ifdef __FreeBSD__
+ATF_TC_BODY(timer_thread_create_real, tc)
+{
+   timer_thread_create(CLOCK_REALTIME, false);
+}
+
+ATF_TC(timer_thread_create_mono);
+ATF_TC_HEAD(timer_thread_create_mono, tc)
+{
+
+   atf_tc_set_md_var(tc, "descr",
+   "Checks timer_create(2) with CLOCK_MONOTONIC and sigevent(3), "
+   "SIGEV_THREAD");
+}
+
+ATF_TC_BODY(timer_thread_create_mono, tc)
+{
+   timer_thread_create(CLOCK_MONOTONIC, false);
+}
+
+ATF_TC(timer_thread_create_real_expire);
+ATF_TC_HEAD(timer_thread_create_real_expire, tc)
+{
+
+   atf_tc_set_md_var(tc, "descr",
+   "Checks timer_create(2) with CLOCK_REALTIME and sigevent(3), "
+   "SIGEV_THREAD, with expiration");
+}
+
+ATF_TC_BODY(timer_thread_create_real_expire, tc)
+{
+   timer_thread_create(CLOCK_REALTIME, true);
+}
+
+ATF_TC(timer_thread_create_mono_expire);
+ATF_TC_HEAD(timer_thread_create_mono_expire, tc)
+{
+
+   atf_tc_set_md_var(tc, "descr",
+   "Checks timer_create(2) with CLOCK_MONOTONIC and sigevent(3), "
+   "SIGEV_THREAD, with expiration");
+}
+
+ATF_TC_BODY(timer_thread_create_mono_expire, tc)
+{
+   timer_thread_create(CLOCK_MONOTONIC, true);
+}
+#endif
+
 ATF_TP_ADD_TCS(tp)
 {
 
@@ -206,6 +319,12 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, timer_create_mono);
ATF_TP_ADD_TC(tp, timer_create_real_expire);
ATF_TP_ADD_TC(tp, timer_create_mono_expire);
+#ifdef __FreeBSD__
+   ATF_TP_ADD_TC(tp, timer_thread_create_real);
+   ATF_TP_ADD_TC(tp, timer_thread_create_mono);
+   ATF_TP_ADD_TC(tp, timer_thread_create_real_expire);
+   ATF_TP_ADD_TC(tp, timer_thread_create_mono_expire);
+#endif
 
return atf_no_error();
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r303841 - head/lib/msun/tests

2016-08-08 Thread Bryan Drewery
Author: bdrewery
Date: Mon Aug  8 17:59:59 2016
New Revision: 303841
URL: https://svnweb.freebsd.org/changeset/base/303841

Log:
  Revert r298434 which should be fixed by r301287, r301394, and r301403.
  
  PR:   208703, 208963

Modified:
  head/lib/msun/tests/Makefile

Modified: head/lib/msun/tests/Makefile
==
--- head/lib/msun/tests/MakefileMon Aug  8 17:57:25 2016
(r303840)
+++ head/lib/msun/tests/MakefileMon Aug  8 17:59:59 2016
(r303841)
@@ -50,15 +50,9 @@ TAP_TESTS_C+=exponential_test
 TAP_TESTS_C+=  fenv_test
 TAP_TESTS_C+=  fma_test
 # clang 3.8.0 fails always fails this test. See: bug 208703
-#
-# XXX: depending on this compiler version check doesn't work at
-# buildworld/installworld time, which results in jenkins failures (bug 208963)
-# because the build is run on a 10.x instance, which has an older clang
-# compiler.
-#
-#.if ! (${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} == 30800)
-#TAP_TESTS_C+= fmaxmin_test
-#.endif
+.if ! (${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} == 30800)
+TAP_TESTS_C+=  fmaxmin_test
+.endif
 TAP_TESTS_C+=  ilogb_test
 TAP_TESTS_C+=  invtrig_test
 TAP_TESTS_C+=  invctrig_test
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r303840 - head/contrib/netbsd-tests/lib/libc/sys

2016-08-08 Thread John Baldwin
On Monday, August 08, 2016 05:57:25 PM John Baldwin wrote:
> Author: jhb
> Date: Mon Aug  8 17:57:25 2016
> New Revision: 303840
> URL: https://svnweb.freebsd.org/changeset/base/303840
> 
> Log:
>   Add timer_settime tests using SIGEV_THREAD.
>   
>   Note that these tests should work fine on NetBSD and other systems as
>   SIGEV_THREAD is POSIX.

I primarily cared about this as a I needed a program that used SIGEV_THREAD
to test SIGLIBRT changes to gdb (we had a patch in the port to pass SIGLIBRT
by default, now it is uptreamed).  It was simplest to extend this test to add
SIGEV_THREAD tests (and now we have some sort of basic testing for
SIGEV_THREAD as a bonus).

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


svn commit: r303842 - head/sbin/ipfw

2016-08-08 Thread Andrey V. Elsukov
Author: ae
Date: Mon Aug  8 18:10:30 2016
New Revision: 303842
URL: https://svnweb.freebsd.org/changeset/base/303842

Log:
  Fix constructing of setdscp opcode with tablearg keyword.
  
  setdscp's argument can have zero value that conflicts with IP_FW_TARG value.
  Always set high-order bit if parser doesn't find tablearg keyword.
  
  MFC after:3 days

Modified:
  head/sbin/ipfw/ipfw2.c

Modified: head/sbin/ipfw/ipfw2.c
==
--- head/sbin/ipfw/ipfw2.c  Mon Aug  8 17:59:59 2016(r303841)
+++ head/sbin/ipfw/ipfw2.c  Mon Aug  8 18:10:30 2016(r303842)
@@ -3957,15 +3957,19 @@ chkarg:
NEED1("missing DSCP code");
if (_substrcmp(*av, "tablearg") == 0) {
action->arg1 = IP_FW_TARG;
-   } else if (isalpha(*av[0])) {
-   if ((code = match_token(f_ipdscp, *av)) == -1)
-   errx(EX_DATAERR, "Unknown DSCP code");
-   action->arg1 = code;
-   } else
-   action->arg1 = strtoul(*av, NULL, 10);
-   /* Add high-order bit to DSCP to make room for tablearg */
-   if (action->arg1 != IP_FW_TARG)
+   } else {
+   if (isalpha(*av[0])) {
+   if ((code = match_token(f_ipdscp, *av)) == -1)
+   errx(EX_DATAERR, "Unknown DSCP code");
+   action->arg1 = code;
+   } else
+   action->arg1 = strtoul(*av, NULL, 10);
+   /*
+* Add high-order bit to DSCP to make room
+* for tablearg
+*/
action->arg1 |= 0x8000;
+   }
av++;
break;
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r303844 - head

2016-08-08 Thread Bryan Drewery
Author: bdrewery
Date: Mon Aug  8 18:13:03 2016
New Revision: 303844
URL: https://svnweb.freebsd.org/changeset/base/303844

Log:
  make world: Allow installworld to be ran in parallel.
  
  This has been safe for a while.
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/Makefile

Modified: head/Makefile
==
--- head/Makefile   Mon Aug  8 18:10:59 2016(r303843)
+++ head/Makefile   Mon Aug  8 18:13:03 2016(r303844)
@@ -315,7 +315,7 @@ world: upgrade_checks .PHONY
${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world
 .endif
${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld
-   ${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld
+   ${_+_}@cd ${.CURDIR}; ${_MAKE} installworld MK_META_MODE=no
 .if target(post-world)
@echo
@echo "--"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r303845 - head/sbin/ipfw

2016-08-08 Thread Andrey V. Elsukov
Author: ae
Date: Mon Aug  8 18:30:50 2016
New Revision: 303845
URL: https://svnweb.freebsd.org/changeset/base/303845

Log:
  Fix formatting of setfib opcode.
  
  Zero fib is correct value and it conflicts with IP_FW_TARG.
  Use bprint_uint_arg() only when opcode contains IP_FW_TARG,
  otherwise just print numeric value with cleared high-order bit.
  
  MFC after:3 days

Modified:
  head/sbin/ipfw/ipfw2.c

Modified: head/sbin/ipfw/ipfw2.c
==
--- head/sbin/ipfw/ipfw2.c  Mon Aug  8 18:13:03 2016(r303844)
+++ head/sbin/ipfw/ipfw2.c  Mon Aug  8 18:30:50 2016(r303845)
@@ -1590,8 +1590,11 @@ show_static_rule(struct cmdline_opts *co
break;
 
case O_SETFIB:
-   bprint_uint_arg(bp, "setfib ", cmd->arg1 & 0x7FFF);
-   break;
+   if (cmd->arg1 == IP_FW_TARG)
+   bprint_uint_arg(bp, "setfib ", cmd->arg1);
+   else
+   bprintf(bp, "setfib %u", cmd->arg1 & 0x7FFF);
+   break;
 
case O_EXTERNAL_ACTION: {
/*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r303716 - head/crypto/openssh

2016-08-08 Thread Garance A Drosehn
On 7 Aug 2016, at 7:40, Bruce Simpson wrote:

> On 07/08/16 11:58, Bruce Simpson wrote:
>> Is there a way to revert this change, at least on an ongoing
>> operational basis (e.g. configuration file) for those of us who
>> use FreeBSD to connect directly to such devices?
>
> I was able to override this (somewhat unilateral, to my mind)
> deprecation of the DH key exchange by using this option:
>-oKexAlgorithms=+diffie-hellman-group1-sha1

If I understand the issues, the biggest concern with this change is
for people who need ssh clients to connect to ancient hardware.

Perhaps we could reduce the pain of this change by creating a special
port for ssh.  One which installs a version of openssh that does not
include this change, and which also does not include sshd.  In addition,
it could install ssh/scp under some alternate names, such that people
would have to explicitly request 'ssh-2015' (instead of 'ssh') to
execute this older version of ssh.  (I suspect that we should not
call the binaries 'ssh-old' and 'scp-old', as those names will not
work well for a long-term option).

*That* port would remain frozen in time, and would (probably) not
import any updates from future versions of openssh.  The only goal of
this port is to give people a way to access hardware that they cannot
access with the newer version of openssh.  It is not some new fork
of ssh which will track future improvements to openssh.

This ssh-2015 version might need some updates of it's own, but only
wrt default configuration settings, and maybe so it will recognize
some special configuration options that the main ssh will ignore.

[aside: we have some machines here at RPI which are old enough that
I already have an alternate-version of ssh to connect to them, so
this tactic is nothing new to me!  Kinda sad, really...]

-- 
Garance Alistair Drosehn= dro...@rpi.edu
Senior Systems Programmer   or   g...@freebsd.org
Rensselaer Polytechnic Institute; Troy, NY;  USA
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r303847 - head/sys/dev/ixl

2016-08-08 Thread Sean Bruno
Author: sbruno
Date: Mon Aug  8 18:57:50 2016
New Revision: 303847
URL: https://svnweb.freebsd.org/changeset/base/303847

Log:
  Fixup ixl(4) options parsing to actually compile when using RSS/PCBGROUP
  in GENERIC.
  
  Fixup #ifdef RSS code blocks so that they build and add/delete variables
  that were missesd during the creation of this code.
  
  This code is untested and should have a big red warning on it.
  
  Reported by:  npn@
  MFC after:2 days

Modified:
  head/sys/dev/ixl/ixl.h
  head/sys/dev/ixl/ixl_pf_main.c
  head/sys/dev/ixl/ixlvc.c

Modified: head/sys/dev/ixl/ixl.h
==
--- head/sys/dev/ixl/ixl.h  Mon Aug  8 18:31:28 2016(r303846)
+++ head/sys/dev/ixl/ixl.h  Mon Aug  8 18:57:50 2016(r303847)
@@ -36,6 +36,10 @@
 #ifndef _IXL_H_
 #define _IXL_H_
 
+#include "opt_inet.h"
+#include "opt_inet6.h"
+#include "opt_rss.h"
+
 #include 
 #include 
 #include 
@@ -93,12 +97,9 @@
 
 #ifdef RSS
 #include 
+#include 
 #endif
 
-#include "opt_inet.h"
-#include "opt_inet6.h"
-#include "opt_rss.h"
-
 #include "i40e_type.h"
 #include "i40e_prototype.h"
 

Modified: head/sys/dev/ixl/ixl_pf_main.c
==
--- head/sys/dev/ixl/ixl_pf_main.c  Mon Aug  8 18:31:28 2016
(r303846)
+++ head/sys/dev/ixl/ixl_pf_main.c  Mon Aug  8 18:57:50 2016
(r303847)
@@ -1155,6 +1155,10 @@ ixl_setup_queue_tqs(struct ixl_vsi *vsi)
 {
struct ixl_queue *que = vsi->queues;
device_t dev = vsi->dev;
+#ifdef  RSS
+   int cpu_id = 0;
+cpuset_t   cpu_mask;
+#endif
 
/* Create queue tasks and start queue taskqueues */
for (int i = 0; i < vsi->num_queues; i++, que++) {
@@ -1246,9 +1250,6 @@ ixl_setup_queue_msix(struct ixl_vsi *vsi
struct  ixl_queue *que = vsi->queues;
struct  tx_ring  *txr;
int error, rid, vector = 1;
-#ifdef RSS
-   cpuset_t cpu_mask;
-#endif
 
/* Queue interrupt vector numbers start at 1 (adminq intr is 0) */
for (int i = 0; i < vsi->num_queues; i++, vector++, que++) {

Modified: head/sys/dev/ixl/ixlvc.c
==
--- head/sys/dev/ixl/ixlvc.cMon Aug  8 18:31:28 2016(r303846)
+++ head/sys/dev/ixl/ixlvc.cMon Aug  8 18:57:50 2016(r303847)
@@ -836,13 +836,10 @@ ixlv_config_rss_key(struct ixlv_sc *sc)
struct i40e_virtchnl_rss_key *rss_key_msg;
int msg_len, key_length;
u8  rss_seed[IXL_RSS_KEY_SIZE];
-#ifdef RSS
-   u32 rss_hash_config;
-#endif
 
 #ifdef RSS
/* Fetch the configured RSS key */
-   rss_getkey(&rss_seed);
+   rss_getkey((uint8_t *) &rss_seed);
 #else
ixl_get_default_rss_key((u32 *)rss_seed);
 #endif
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r303848 - head/sys/netgraph

2016-08-08 Thread Sean Bruno
Author: sbruno
Date: Mon Aug  8 19:31:01 2016
New Revision: 303848
URL: https://svnweb.freebsd.org/changeset/base/303848

Log:
  Avoid panic from ng_uncallout when unpluggin ethernet cable with active
  PPTP VPN connection.
  
  Submitted by: Michael Zhilin 
  Reviewed by:  ngie
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D7209

Modified:
  head/sys/netgraph/ng_base.c

Modified: head/sys/netgraph/ng_base.c
==
--- head/sys/netgraph/ng_base.c Mon Aug  8 18:57:50 2016(r303847)
+++ head/sys/netgraph/ng_base.c Mon Aug  8 19:31:01 2016(r303848)
@@ -3815,7 +3815,7 @@ ng_uncallout(struct callout *c, node_p n
item = c->c_arg;
/* Do an extra check */
if ((rval > 0) && (c->c_func == &ng_callout_trampoline) &&
-   (NGI_NODE(item) == node)) {
+   (item != NULL) && (NGI_NODE(item) == node)) {
/*
 * We successfully removed it from the queue before it ran
 * So now we need to unreference everything that was
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-08-08 Thread Mark Johnston
Author: markj
Date: Mon Aug  8 20:25:04 2016
New Revision: 303855
URL: https://svnweb.freebsd.org/changeset/base/303855

Log:
  Handle races with listening socket close when connecting a unix socket.
  
  If the listening socket is closed while sonewconn() is executing, the
  nascent child socket is aborted, which results in recursion on the
  unp_link lock when the child's pru_detach method is invoked. Fix this
  by using a flag to mark such sockets, and skip a part of the socket's
  teardown during detach.
  
  Reported by:  Raviprakash Darbha 
  Tested by:pho
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D7398

Modified:
  head/sys/kern/uipc_usrreq.c
  head/sys/sys/unpcb.h

Modified: head/sys/kern/uipc_usrreq.c
==
--- head/sys/kern/uipc_usrreq.c Mon Aug  8 20:23:11 2016(r303854)
+++ head/sys/kern/uipc_usrreq.c Mon Aug  8 20:25:04 2016(r303855)
@@ -430,6 +430,8 @@ uipc_attach(struct socket *so, int proto
unp->unp_socket = so;
so->so_pcb = unp;
unp->unp_refcount = 1;
+   if (so->so_head != NULL)
+   unp->unp_flags |= UNP_NASCENT;
 
UNP_LIST_LOCK();
unp->unp_gencnt = ++unp_gencnt;
@@ -652,14 +654,22 @@ uipc_detach(struct socket *so)
unp = sotounpcb(so);
KASSERT(unp != NULL, ("uipc_detach: unp == NULL"));
 
-   UNP_LINK_WLOCK();
+   vp = NULL;
+   local_unp_rights = 0;
+
UNP_LIST_LOCK();
-   UNP_PCB_LOCK(unp);
LIST_REMOVE(unp, unp_link);
unp->unp_gencnt = ++unp_gencnt;
--unp_count;
UNP_LIST_UNLOCK();
 
+   if ((unp->unp_flags & UNP_NASCENT) != 0) {
+   UNP_PCB_LOCK(unp);
+   goto teardown;
+   }
+   UNP_LINK_WLOCK();
+   UNP_PCB_LOCK(unp);
+
/*
 * XXXRW: Should assert vp->v_socket == so.
 */
@@ -687,6 +697,7 @@ uipc_detach(struct socket *so)
}
local_unp_rights = unp_rights;
UNP_LINK_WUNLOCK();
+teardown:
unp->unp_socket->so_pcb = NULL;
saved_unp_addr = unp->unp_addr;
unp->unp_addr = NULL;
@@ -1473,6 +1484,7 @@ unp_connect2(struct socket *so, struct s
 
if (so2->so_type != so->so_type)
return (EPROTOTYPE);
+   unp2->unp_flags &= ~UNP_NASCENT;
unp->unp_conn = unp2;
 
switch (so->so_type) {

Modified: head/sys/sys/unpcb.h
==
--- head/sys/sys/unpcb.hMon Aug  8 20:23:11 2016(r303854)
+++ head/sys/sys/unpcb.hMon Aug  8 20:25:04 2016(r303855)
@@ -103,11 +103,6 @@ struct unpcb {
 #defineUNP_WANTCRED0x004   /* credentials wanted */
 #defineUNP_CONNWAIT0x008   /* connect blocks until 
accepted */
 
-#defineUNPGC_REF   0x1 /* unpcb has external 
ref. */
-#defineUNPGC_DEAD  0x2 /* unpcb might be dead. 
*/
-#defineUNPGC_SCANNED   0x4 /* Has been scanned. */
-#defineUNPGC_IGNORE_RIGHTS 0x8 /* Attached rights are 
freed */
-
 /*
  * These flags are used to handle non-atomicity in connect() and bind()
  * operations on a socket: in particular, to avoid races between multiple
@@ -115,6 +110,15 @@ struct unpcb {
  */
 #defineUNP_CONNECTING  0x010   /* Currently 
connecting. */
 #defineUNP_BINDING 0x020   /* Currently binding. */
+#defineUNP_NASCENT 0x040   /* Newborn child 
socket. */
+
+/*
+ * Flags in unp_gcflag.
+ */
+#defineUNPGC_REF   0x1 /* unpcb has external 
ref. */
+#defineUNPGC_DEAD  0x2 /* unpcb might be dead. 
*/
+#defineUNPGC_SCANNED   0x4 /* Has been scanned. */
+#defineUNPGC_IGNORE_RIGHTS 0x8 /* Attached rights are 
freed */
 
 #definesotounpcb(so)   ((struct unpcb *)((so)->so_pcb))
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r303803 - in head/sys/dev: fdt ofw

2016-08-08 Thread Warner Losh
On Sun, Aug 7, 2016 at 2:51 AM, Brooks Davis  wrote:
> On Sat, Aug 06, 2016 at 06:48:47PM +, Stephen J. Kiernan wrote:
>> Author: stevek
>> Date: Sat Aug  6 18:48:47 2016
>> New Revision: 303803
>> URL: https://svnweb.freebsd.org/changeset/base/303803
>>
>> Log:
>>   Add hw.fdt sysctl node.
>>   Make FDT blob available via opaque hw.fdt.dtb sysctl, if a DTB has been
>>   installed by the time sysctls are registered.
>
> Thanks!  This has been on my todo list for ages.

Now all we need to do is make it writable with overlay support like we
have in the loader :)

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


svn commit: r303859 - head/sys/dev/cxgbe

2016-08-08 Thread John Baldwin
Author: jhb
Date: Mon Aug  8 21:28:02 2016
New Revision: 303859
URL: https://svnweb.freebsd.org/changeset/base/303859

Log:
  Fix a typo.

Modified:
  head/sys/dev/cxgbe/t4_sge.c

Modified: head/sys/dev/cxgbe/t4_sge.c
==
--- head/sys/dev/cxgbe/t4_sge.c Mon Aug  8 21:19:57 2016(r303858)
+++ head/sys/dev/cxgbe/t4_sge.c Mon Aug  8 21:28:02 2016(r303859)
@@ -590,7 +590,7 @@ t4_tweak_chip_settings(struct adapter *s
 
 /*
  * SGE wants the buffer to be at least 64B and then a multiple of 16.  If
- * padding is is use the buffer's start and end need to be aligned to the pad
+ * padding is in use, the buffer's start and end need to be aligned to the pad
  * boundary as well.  We'll just make sure that the size is a multiple of the
  * boundary here, it is up to the buffer allocation code to make sure the start
  * of the buffer is aligned as well.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r303860 - head/sys/dev/cxgbe

2016-08-08 Thread John Baldwin
Author: jhb
Date: Mon Aug  8 21:45:39 2016
New Revision: 303860
URL: https://svnweb.freebsd.org/changeset/base/303860

Log:
  Reserve an adapter flag IS_VF to mark VF devices vs PF devices.
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/adapter.h

Modified: head/sys/dev/cxgbe/adapter.h
==
--- head/sys/dev/cxgbe/adapter.hMon Aug  8 21:28:02 2016
(r303859)
+++ head/sys/dev/cxgbe/adapter.hMon Aug  8 21:45:39 2016
(r303860)
@@ -195,6 +195,7 @@ enum {
ADAP_SYSCTL_CTX = (1 << 4),
/* TOM_INIT_DONE= (1 << 5), No longer used */
BUF_PACKING_OK  = (1 << 6),
+   IS_VF   = (1 << 7),
 
CXGBE_BUSY  = (1 << 9),
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r303855 - in head/sys: kern sys

2016-08-08 Thread Oliver Pinter
Hi!

Can you please MFC back this change 10-STABLE together with the
following: 
https://github.com/HardenedBSD/hardenedBSD/commit/576619e564618bca3675db57580d8e1f76bd2ac7

This issue is still exists on 10-STABLE, as you can test with the
linked program from phabricator:
https://people.freebsd.org/~mjg/reproducers/unp-gc-panic.c

On Mon, Aug 8, 2016 at 10:25 PM, Mark Johnston  wrote:
> Author: markj
> Date: Mon Aug  8 20:25:04 2016
> New Revision: 303855
> URL: https://svnweb.freebsd.org/changeset/base/303855
>
> Log:
>   Handle races with listening socket close when connecting a unix socket.
>
>   If the listening socket is closed while sonewconn() is executing, the
>   nascent child socket is aborted, which results in recursion on the
>   unp_link lock when the child's pru_detach method is invoked. Fix this
>   by using a flag to mark such sockets, and skip a part of the socket's
>   teardown during detach.
>
>   Reported by:  Raviprakash Darbha 
>   Tested by:pho
>   MFC after:2 weeks
>   Differential Revision:https://reviews.freebsd.org/D7398
>
> Modified:
>   head/sys/kern/uipc_usrreq.c
>   head/sys/sys/unpcb.h
>
> Modified: head/sys/kern/uipc_usrreq.c
> ==
> --- head/sys/kern/uipc_usrreq.c Mon Aug  8 20:23:11 2016(r303854)
> +++ head/sys/kern/uipc_usrreq.c Mon Aug  8 20:25:04 2016(r303855)
> @@ -430,6 +430,8 @@ uipc_attach(struct socket *so, int proto
> unp->unp_socket = so;
> so->so_pcb = unp;
> unp->unp_refcount = 1;
> +   if (so->so_head != NULL)
> +   unp->unp_flags |= UNP_NASCENT;
>
> UNP_LIST_LOCK();
> unp->unp_gencnt = ++unp_gencnt;
> @@ -652,14 +654,22 @@ uipc_detach(struct socket *so)
> unp = sotounpcb(so);
> KASSERT(unp != NULL, ("uipc_detach: unp == NULL"));
>
> -   UNP_LINK_WLOCK();
> +   vp = NULL;
> +   local_unp_rights = 0;
> +
> UNP_LIST_LOCK();
> -   UNP_PCB_LOCK(unp);
> LIST_REMOVE(unp, unp_link);
> unp->unp_gencnt = ++unp_gencnt;
> --unp_count;
> UNP_LIST_UNLOCK();
>
> +   if ((unp->unp_flags & UNP_NASCENT) != 0) {
> +   UNP_PCB_LOCK(unp);
> +   goto teardown;
> +   }
> +   UNP_LINK_WLOCK();
> +   UNP_PCB_LOCK(unp);
> +
> /*
>  * XXXRW: Should assert vp->v_socket == so.
>  */
> @@ -687,6 +697,7 @@ uipc_detach(struct socket *so)
> }
> local_unp_rights = unp_rights;
> UNP_LINK_WUNLOCK();
> +teardown:
> unp->unp_socket->so_pcb = NULL;
> saved_unp_addr = unp->unp_addr;
> unp->unp_addr = NULL;
> @@ -1473,6 +1484,7 @@ unp_connect2(struct socket *so, struct s
>
> if (so2->so_type != so->so_type)
> return (EPROTOTYPE);
> +   unp2->unp_flags &= ~UNP_NASCENT;
> unp->unp_conn = unp2;
>
> switch (so->so_type) {
>
> Modified: head/sys/sys/unpcb.h
> ==
> --- head/sys/sys/unpcb.hMon Aug  8 20:23:11 2016(r303854)
> +++ head/sys/sys/unpcb.hMon Aug  8 20:25:04 2016(r303855)
> @@ -103,11 +103,6 @@ struct unpcb {
>  #defineUNP_WANTCRED0x004   /* credentials wanted 
> */
>  #defineUNP_CONNWAIT0x008   /* connect blocks 
> until accepted */
>
> -#defineUNPGC_REF   0x1 /* unpcb has external 
> ref. */
> -#defineUNPGC_DEAD  0x2 /* unpcb might be 
> dead. */
> -#defineUNPGC_SCANNED   0x4 /* Has been scanned. 
> */
> -#defineUNPGC_IGNORE_RIGHTS 0x8 /* Attached rights 
> are freed */
> -
>  /*
>   * These flags are used to handle non-atomicity in connect() and bind()
>   * operations on a socket: in particular, to avoid races between multiple
> @@ -115,6 +110,15 @@ struct unpcb {
>   */
>  #defineUNP_CONNECTING  0x010   /* Currently 
> connecting. */
>  #defineUNP_BINDING 0x020   /* Currently binding. 
> */
> +#defineUNP_NASCENT 0x040   /* Newborn child 
> socket. */
> +
> +/*
> + * Flags in unp_gcflag.
> + */
> +#defineUNPGC_REF   0x1 /* unpcb has external 
> ref. */
> +#defineUNPGC_DEAD  0x2 /* unpcb might be 
> dead. */
> +#defineUNPGC_SCANNED   0x4 /* Has been scanned. 
> */
> +#defineUNPGC_IGNORE_RIGHTS 0x8 /* Attached rights 
> are freed */
>
>  #definesotounpcb(so)   ((struct unpcb *)((so)->so_pcb))
>
> ___
> svn-src-head@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Re: svn commit: r303855 - in head/sys: kern sys

2016-08-08 Thread Mark Johnston
On Tue, Aug 09, 2016 at 12:53:47AM +0200, Oliver Pinter wrote:
> Hi!
> 
> Can you please MFC back this change 10-STABLE together with the
> following: 
> https://github.com/HardenedBSD/hardenedBSD/commit/576619e564618bca3675db57580d8e1f76bd2ac7
> 
> This issue is still exists on 10-STABLE, as you can test with the
> linked program from phabricator:
> https://people.freebsd.org/~mjg/reproducers/unp-gc-panic.c

Hm, I don't think this could be MFCed directly. It changes the kernel
ABI by modifying the argument of dom_dispose(). This could be fixed in
stable/10 with a hack to call the unix domain socket code directly when
appropriate, which I think is preferable to the current state of things.
I'll look into it further.

> 
> On Mon, Aug 8, 2016 at 10:25 PM, Mark Johnston  wrote:
> > Author: markj
> > Date: Mon Aug  8 20:25:04 2016
> > New Revision: 303855
> > URL: https://svnweb.freebsd.org/changeset/base/303855
> >
> > Log:
> >   Handle races with listening socket close when connecting a unix socket.
> >
> >   If the listening socket is closed while sonewconn() is executing, the
> >   nascent child socket is aborted, which results in recursion on the
> >   unp_link lock when the child's pru_detach method is invoked. Fix this
> >   by using a flag to mark such sockets, and skip a part of the socket's
> >   teardown during detach.
> >
> >   Reported by:  Raviprakash Darbha 
> >   Tested by:pho
> >   MFC after:2 weeks
> >   Differential Revision:https://reviews.freebsd.org/D7398
> >
> > Modified:
> >   head/sys/kern/uipc_usrreq.c
> >   head/sys/sys/unpcb.h
> >
> > Modified: head/sys/kern/uipc_usrreq.c
> > ==
> > --- head/sys/kern/uipc_usrreq.c Mon Aug  8 20:23:11 2016(r303854)
> > +++ head/sys/kern/uipc_usrreq.c Mon Aug  8 20:25:04 2016(r303855)
> > @@ -430,6 +430,8 @@ uipc_attach(struct socket *so, int proto
> > unp->unp_socket = so;
> > so->so_pcb = unp;
> > unp->unp_refcount = 1;
> > +   if (so->so_head != NULL)
> > +   unp->unp_flags |= UNP_NASCENT;
> >
> > UNP_LIST_LOCK();
> > unp->unp_gencnt = ++unp_gencnt;
> > @@ -652,14 +654,22 @@ uipc_detach(struct socket *so)
> > unp = sotounpcb(so);
> > KASSERT(unp != NULL, ("uipc_detach: unp == NULL"));
> >
> > -   UNP_LINK_WLOCK();
> > +   vp = NULL;
> > +   local_unp_rights = 0;
> > +
> > UNP_LIST_LOCK();
> > -   UNP_PCB_LOCK(unp);
> > LIST_REMOVE(unp, unp_link);
> > unp->unp_gencnt = ++unp_gencnt;
> > --unp_count;
> > UNP_LIST_UNLOCK();
> >
> > +   if ((unp->unp_flags & UNP_NASCENT) != 0) {
> > +   UNP_PCB_LOCK(unp);
> > +   goto teardown;
> > +   }
> > +   UNP_LINK_WLOCK();
> > +   UNP_PCB_LOCK(unp);
> > +
> > /*
> >  * XXXRW: Should assert vp->v_socket == so.
> >  */
> > @@ -687,6 +697,7 @@ uipc_detach(struct socket *so)
> > }
> > local_unp_rights = unp_rights;
> > UNP_LINK_WUNLOCK();
> > +teardown:
> > unp->unp_socket->so_pcb = NULL;
> > saved_unp_addr = unp->unp_addr;
> > unp->unp_addr = NULL;
> > @@ -1473,6 +1484,7 @@ unp_connect2(struct socket *so, struct s
> >
> > if (so2->so_type != so->so_type)
> > return (EPROTOTYPE);
> > +   unp2->unp_flags &= ~UNP_NASCENT;
> > unp->unp_conn = unp2;
> >
> > switch (so->so_type) {
> >
> > Modified: head/sys/sys/unpcb.h
> > ==
> > --- head/sys/sys/unpcb.hMon Aug  8 20:23:11 2016(r303854)
> > +++ head/sys/sys/unpcb.hMon Aug  8 20:25:04 2016(r303855)
> > @@ -103,11 +103,6 @@ struct unpcb {
> >  #defineUNP_WANTCRED0x004   /* credentials 
> > wanted */
> >  #defineUNP_CONNWAIT0x008   /* connect blocks 
> > until accepted */
> >
> > -#defineUNPGC_REF   0x1 /* unpcb has 
> > external ref. */
> > -#defineUNPGC_DEAD  0x2 /* unpcb might be 
> > dead. */
> > -#defineUNPGC_SCANNED   0x4 /* Has been 
> > scanned. */
> > -#defineUNPGC_IGNORE_RIGHTS 0x8 /* Attached rights 
> > are freed */
> > -
> >  /*
> >   * These flags are used to handle non-atomicity in connect() and bind()
> >   * operations on a socket: in particular, to avoid races between multiple
> > @@ -115,6 +110,15 @@ struct unpcb {
> >   */
> >  #defineUNP_CONNECTING  0x010   /* Currently 
> > connecting. */
> >  #defineUNP_BINDING 0x020   /* Currently 
> > binding. */
> > +#defineUNP_NASCENT 0x040   /* Newborn child 
> > socket. */
> > +
> > +/*
> > + * Flags in unp_gcflag.
> > + */
> > +#defineUNPGC_REF 

Re: svn commit: r303763 - in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys

2016-08-08 Thread Navdeep Parhar
Hello Andriy,

I'm at r303837 and have had two panics today in zfs_rename.  I have a
core for a kernel built with -O0.  Let me know if you think it's related
to this commit and need more information.  This is the stack:

(also available at https://people.freebsd.org/~np/rename_panic.txt in
case the wide lines are hard to read in email).

(kgdb) bt
#0  doadump (textdump=0) at /root/ws/head/sys/kern/kern_shutdown.c:298
#1  0x803f8692 in db_dump (dummy=-2100833195, dummy2=false,
dummy3=-1, dummy4=0xfe08604c6810 "") at
/root/ws/head/sys/ddb/db_command.c:533
#2  0x803f847e in db_command (last_cmdp=0x821d40d8
, cmd_table=0x0, dopager=1) at
/root/ws/head/sys/ddb/db_command.c:440
#3  0x803f801e in db_command_loop () at
/root/ws/head/sys/ddb/db_command.c:493
#4  0x803fcf13 in db_trap (type=12, code=0) at
/root/ws/head/sys/ddb/db_main.c:251
#5  0x8100116f in kdb_trap (type=12, code=0,
tf=0xfe08604c6fe0) at /root/ws/head/sys/kern/subr_kdb.c:654
#6  0x8163df24 in trap_fatal (frame=0xfe08604c6fe0,
eva=18446744069414584336) at /root/ws/head/sys/amd64/amd64/trap.c:836
#7  0x8163e53b in trap_pfault (frame=0xfe08604c6fe0,
usermode=0) at /root/ws/head/sys/amd64/amd64/trap.c:763
#8  0x8163d1e2 in trap (frame=0xfe08604c6fe0) at
/root/ws/head/sys/amd64/amd64/trap.c:442
#9  0x8163e63a in trap_check (frame=0xfe08604c6fe0) at
/root/ws/head/sys/amd64/amd64/trap.c:635
#10 
#11 0x82c7d455 in zfs_rename (sdvp=0xf80016e331d8,
svpp=0xfe08604c7318, scnp=0xfe08604c7750,
tdvp=0xf8015644, tvpp=0xfe08604c7308,
tcnp=0xfe08604c7688, cr=0xf8001612e600)
at
/root/ws/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c:3959
#12 0x82c6f6a9 in zfs_freebsd_rename (ap=0xfe08604c73c8) at
/root/ws/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c:5275
#13 0x8187d484 in VOP_RENAME_APV (vop=0x82d19bb0
, a=0xfe08604c73c8) at vnode_if.c:1547
#14 0x810e5d41 in VOP_RENAME (fdvp=0xf80016e331d8,
fvp=0xf80174c02588, fcnp=0xfe08604c7750,
tdvp=0xf8015644, tvp=0xf8017d7d1ce8,
tcnp=0xfe08604c7688) at ./vnode_if.h:636
#15 0x810e5b17 in kern_renameat (td=0xf8010b855a40,
oldfd=-100, old=0x800a121a0 , newfd=-100, new=0x7fffcfee ,
pathseg=UIO_USERSPACE) at /root/ws/head/sys/kern/vfs_syscalls.c:3553
#16 0x810e53d7 in sys_rename (td=0xf8010b855a40,
uap=0xfe08604c7a58) at /root/ws/head/sys/kern/vfs_syscalls.c:3427
#17 0x83ce244d in filemon_wrapper_rename (td=0xf8010b855a40,
uap=0xfe08604c7a58) at
/root/ws/head/sys/modules/filemon/../../dev/filemon/filemon_wrapper.c:240
#18 0x8163f1a9 in syscallenter (td=0xf8010b855a40,
sa=0xfe08604c7a48) at
/root/ws/head/sys/amd64/amd64/../../kern/subr_syscall.c:135
#19 0x8163e9ea in amd64_syscall (td=0xf8010b855a40,
traced=0) at /root/ws/head/sys/amd64/amd64/trap.c:942

Regards,
Navdeep


On 08/04/2016 23:23, Andriy Gapon wrote:
> Author: avg
> Date: Fri Aug  5 06:23:06 2016
> New Revision: 303763
> URL: https://svnweb.freebsd.org/changeset/base/303763
> 
> Log:
>   zfs: honour and make use of vfs vnode locking protocol
>   
>   ZFS POSIX Layer is originally written for Solaris VFS which is very
>   different from FreeBSD VFS.  Most importantly many things that FreeBSD VFS
>   manages on behalf of all filesystems are implemented in ZPL in a different
>   way.
>   Thus, ZPL contains code that is redundant on FreeBSD or duplicates VFS
>   functionality or, in the worst cases, badly interacts / interferes
>   with VFS.
>   
>   The most prominent problem is a deadlock caused by the lock order reversal
>   of vnode locks that may happen with concurrent zfs_rename() and lookup().
>   The deadlock is a result of zfs_rename() not observing the vnode locking
>   contract expected by VFS.
>   
>   This commit removes all ZPL internal locking that protects parent-child
>   relationships of filesystem nodes.  These relationships are protected
>   by vnode locks and the code is changed to take advantage of that fact
>   and to properly interact with VFS.
>   
>   Removal of the internal locking allowed all ZPL dmu_tx_assign calls to
>   use TXG_WAIT mode.
>   
>   Another victim, disputable perhaps, is ZFS support for filesystems with
>   mixed case sensitivity.  That support is not provided by the OS anyway,
>   so in ZFS it was a buch of dead code.
>   
>   To do:
>   - replace ZFS_ENTER mechanism with VFS managed / visible mechanism
>   - replace zfs_zget with zfs_vget[f] as much as possible
>   - get rid of not really useful now zfs_freebsd_* adapters
>   - more cleanups of unneeded / unused code
>   - fix / replace .zfs support
>   
>   PR: 209158
>   Reported by:many
>   Tested by:  many (thank you all!)
>   MFC after:  5 days
>   Sponsored by:   HybridCluster / ClusterHQ
>   Differential Revision: https://rev

Re: svn commit: r303855 - in head/sys: kern sys

2016-08-08 Thread Oliver Pinter
(Added bdrewery to CC, since I'm talking with him on IRC.)

On Tue, Aug 9, 2016 at 1:43 AM, Mark Johnston  wrote:
> On Tue, Aug 09, 2016 at 12:53:47AM +0200, Oliver Pinter wrote:
>> Hi!
>>
>> Can you please MFC back this change 10-STABLE together with the
>> following: 
>> https://github.com/HardenedBSD/hardenedBSD/commit/576619e564618bca3675db57580d8e1f76bd2ac7
>>
>> This issue is still exists on 10-STABLE, as you can test with the
>> linked program from phabricator:
>> https://people.freebsd.org/~mjg/reproducers/unp-gc-panic.c
>
> Hm, I don't think this could be MFCed directly. It changes the kernel
> ABI by modifying the argument of dom_dispose(). This could be fixed in
> stable/10 with a hack to call the unix domain socket code directly when
> appropriate, which I think is preferable to the current state of things.
> I'll look into it further.

The question is how much external / out of tree components would use
this ABI or how acceptable to break this ABI.
I just grepped through the src tree for internal uses, and I found only these:

op@opn hardenedBSD.git> git grep dom_dispose
share/doc/smm/18.net/6.t:   int (*dom_dispose)();   /*
dispose of internalized rights */
share/man/man9/domain.9:void(*dom_dispose)  /*
dispose of internalized rights */
sys/kern/uipc_debug.c:  db_printf("dom_dispose: %p\n", d->dom_dispose);
sys/kern/uipc_socket.c: if (pr->pr_flags & PR_RIGHTS &&
pr->pr_domain->dom_dispose != NULL)
sys/kern/uipc_socket.c: (*pr->pr_domain->dom_dispose)(so);
sys/kern/uipc_socket.c:  * dom_dispose() and sbrelease_internal() are
an inlining of what was
sys/kern/uipc_socket.c:  * In order to avoid calling dom_dispose with
the socket buffer mutex
sys/kern/uipc_socket.c: if (pr->pr_flags & PR_RIGHTS &&
pr->pr_domain->dom_dispose != NULL)
sys/kern/uipc_socket.c: (*pr->pr_domain->dom_dispose)(&aso);
sys/kern/uipc_usrreq.c: .dom_dispose =  unp_dispose_so,
sys/sys/domain.h:   void(*dom_dispose)  /* dispose of
internalized rights */

>
>>
>> On Mon, Aug 8, 2016 at 10:25 PM, Mark Johnston  wrote:
>> > Author: markj
>> > Date: Mon Aug  8 20:25:04 2016
>> > New Revision: 303855
>> > URL: https://svnweb.freebsd.org/changeset/base/303855
>> >
>> > Log:
>> >   Handle races with listening socket close when connecting a unix socket.
>> >
>> >   If the listening socket is closed while sonewconn() is executing, the
>> >   nascent child socket is aborted, which results in recursion on the
>> >   unp_link lock when the child's pru_detach method is invoked. Fix this
>> >   by using a flag to mark such sockets, and skip a part of the socket's
>> >   teardown during detach.
>> >
>> >   Reported by:  Raviprakash Darbha 
>> >   Tested by:pho
>> >   MFC after:2 weeks
>> >   Differential Revision:https://reviews.freebsd.org/D7398
>> >
>> > Modified:
>> >   head/sys/kern/uipc_usrreq.c
>> >   head/sys/sys/unpcb.h
>> >
>> > Modified: head/sys/kern/uipc_usrreq.c
>> > ==
>> > --- head/sys/kern/uipc_usrreq.c Mon Aug  8 20:23:11 2016(r303854)
>> > +++ head/sys/kern/uipc_usrreq.c Mon Aug  8 20:25:04 2016(r303855)
>> > @@ -430,6 +430,8 @@ uipc_attach(struct socket *so, int proto
>> > unp->unp_socket = so;
>> > so->so_pcb = unp;
>> > unp->unp_refcount = 1;
>> > +   if (so->so_head != NULL)
>> > +   unp->unp_flags |= UNP_NASCENT;
>> >
>> > UNP_LIST_LOCK();
>> > unp->unp_gencnt = ++unp_gencnt;
>> > @@ -652,14 +654,22 @@ uipc_detach(struct socket *so)
>> > unp = sotounpcb(so);
>> > KASSERT(unp != NULL, ("uipc_detach: unp == NULL"));
>> >
>> > -   UNP_LINK_WLOCK();
>> > +   vp = NULL;
>> > +   local_unp_rights = 0;
>> > +
>> > UNP_LIST_LOCK();
>> > -   UNP_PCB_LOCK(unp);
>> > LIST_REMOVE(unp, unp_link);
>> > unp->unp_gencnt = ++unp_gencnt;
>> > --unp_count;
>> > UNP_LIST_UNLOCK();
>> >
>> > +   if ((unp->unp_flags & UNP_NASCENT) != 0) {
>> > +   UNP_PCB_LOCK(unp);
>> > +   goto teardown;
>> > +   }
>> > +   UNP_LINK_WLOCK();
>> > +   UNP_PCB_LOCK(unp);
>> > +
>> > /*
>> >  * XXXRW: Should assert vp->v_socket == so.
>> >  */
>> > @@ -687,6 +697,7 @@ uipc_detach(struct socket *so)
>> > }
>> > local_unp_rights = unp_rights;
>> > UNP_LINK_WUNLOCK();
>> > +teardown:
>> > unp->unp_socket->so_pcb = NULL;
>> > saved_unp_addr = unp->unp_addr;
>> > unp->unp_addr = NULL;
>> > @@ -1473,6 +1484,7 @@ unp_connect2(struct socket *so, struct s
>> >
>> > if (so2->so_type != so->so_type)
>> > return (EPROTOTYPE);
>> > +   unp2->unp_flags &= ~UNP_NASCENT;
>> > unp->unp_conn = unp2;
>> >
>> > switch (so->so_type) {
>> >
>> > Modified: head/sys/sys/unpcb.h
>> > ===

svn commit: r303862 - head/sys/contrib/dev/ath/ath_hal/ar9300

2016-08-08 Thread Adrian Chadd
Author: adrian
Date: Tue Aug  9 01:05:29 2016
New Revision: 303862
URL: https://svnweb.freebsd.org/changeset/base/303862

Log:
  [ar9300] don't program a negative readytime.

Modified:
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_xmit.c

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_xmit.c
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_xmit.c   Mon Aug  8 
23:18:27 2016(r303861)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_xmit.c   Tue Aug  9 
01:05:29 2016(r303862)
@@ -447,6 +447,8 @@ ar9300_reset_tx_queue(struct ath_hal *ah
  */
 if (value < 10)
 value = 10;
+if (value < 0)
+value = 10;
 HALDEBUG(ah, HAL_DEBUG_TXQUEUE,
   "%s: defaulting to rdytime = %d uS\n",
   __func__, value);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r303863 - in head/sys: conf kern netinet netinet6 sys

2016-08-08 Thread Stephen J. Kiernan
Author: stevek
Date: Tue Aug  9 02:16:21 2016
New Revision: 303863
URL: https://svnweb.freebsd.org/changeset/base/303863

Log:
  Move IPv4-specific jail functions to new file netinet/in_jail.c
  _prison_check_ip4 renamed to prison_check_ip4_locked
  
  Move IPv6-specific jail functions to new file netinet6/in6_jail.c
  _prison_check_ip6 renamed to prison_check_ip6_locked
  
  Add appropriate prototypes to sys/sys/jail.h
  
  Adjust kern_jail.c to call prison_check_ip4_locked and
  prison_check_ip6_locked accordingly.
  
  Add netinet/in_jail.c and netinet6/in6_jail.c to the list of files that
  need to be built when INET and INET6, respectively, are configured in the
  kernel configuration file.
  
  Reviewed by:  jtl
  Approved by:  sjg (mentor)
  Sponsored by: Juniper Networks, Inc.
  Differential Revision:https://reviews.freebsd.org/D6799

Added:
  head/sys/netinet/in_jail.c   (contents, props changed)
  head/sys/netinet6/in6_jail.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/kern/kern_jail.c
  head/sys/sys/jail.h

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue Aug  9 01:05:29 2016(r303862)
+++ head/sys/conf/files Tue Aug  9 02:16:21 2016(r303863)
@@ -3748,6 +3748,7 @@ netinet/in_fib.c  optional inet
 netinet/in_gif.c   optional gif inet | netgraph_gif inet
 netinet/ip_gre.c   optional gre inet
 netinet/ip_id.coptional inet
+netinet/in_jail.c  optional inet
 netinet/in_mcast.c optional inet
 netinet/in_pcb.c   optional inet | inet6
 netinet/in_pcbgroup.c  optional inet pcbgroup | inet6 pcbgroup
@@ -3816,6 +3817,7 @@ netinet6/in6_cksum.c  optional inet6
 netinet6/in6_fib.c optional inet6
 netinet6/in6_gif.c optional gif inet6 | netgraph_gif inet6
 netinet6/in6_ifattach.coptional inet6
+netinet6/in6_jail.coptional inet6
 netinet6/in6_mcast.c   optional inet6
 netinet6/in6_pcb.c optional inet6
 netinet6/in6_pcbgroup.coptional inet6 pcbgroup

Modified: head/sys/kern/kern_jail.c
==
--- head/sys/kern/kern_jail.c   Tue Aug  9 01:05:29 2016(r303862)
+++ head/sys/kern/kern_jail.c   Tue Aug  9 02:16:21 2016(r303863)
@@ -130,14 +130,6 @@ static void prison_racct_attach(struct p
 static void prison_racct_modify(struct prison *pr);
 static void prison_racct_detach(struct prison *pr);
 #endif
-#ifdef INET
-static int _prison_check_ip4(const struct prison *, const struct in_addr *);
-static int prison_restrict_ip4(struct prison *pr, struct in_addr *newip4);
-#endif
-#ifdef INET6
-static int _prison_check_ip6(struct prison *pr, struct in6_addr *ia6);
-static int prison_restrict_ip6(struct prison *pr, struct in6_addr *newip6);
-#endif
 
 /* Flags for prison_deref */
 #definePD_DEREF0x01
@@ -252,54 +244,6 @@ prison0_init(void)
strlcpy(prison0.pr_osrelease, osrelease, sizeof(prison0.pr_osrelease));
 }
 
-#ifdef INET
-static int
-qcmp_v4(const void *ip1, const void *ip2)
-{
-   in_addr_t iaa, iab;
-
-   /*
-* We need to compare in HBO here to get the list sorted as expected
-* by the result of the code.  Sorting NBO addresses gives you
-* interesting results.  If you do not understand, do not try.
-*/
-   iaa = ntohl(((const struct in_addr *)ip1)->s_addr);
-   iab = ntohl(((const struct in_addr *)ip2)->s_addr);
-
-   /*
-* Do not simply return the difference of the two numbers, the int is
-* not wide enough.
-*/
-   if (iaa > iab)
-   return (1);
-   else if (iaa < iab)
-   return (-1);
-   else
-   return (0);
-}
-#endif
-
-#ifdef INET6
-static int
-qcmp_v6(const void *ip1, const void *ip2)
-{
-   const struct in6_addr *ia6a, *ia6b;
-   int i, rc;
-
-   ia6a = (const struct in6_addr *)ip1;
-   ia6b = (const struct in6_addr *)ip2;
-
-   rc = 0;
-   for (i = 0; rc == 0 && i < sizeof(struct in6_addr); i++) {
-   if (ia6a->s6_addr[i] > ia6b->s6_addr[i])
-   rc = 1;
-   else if (ia6a->s6_addr[i] < ia6b->s6_addr[i])
-   rc = -1;
-   }
-   return (rc);
-}
-#endif
-
 /*
  * struct jail_args {
  * struct jail *jail;
@@ -845,7 +789,8 @@ kern_jail_set(struct thread *td, struct 
 * address to connect from.
 */
if (ip4s > 1)
-   qsort(ip4 + 1, ip4s - 1, sizeof(*ip4), qcmp_v4);
+   qsort(ip4 + 1, ip4s - 1, sizeof(*ip4),
+   prison_qcmp_v4);
/*
 * Check for duplica

svn commit: r303867 - head/sys/dev/hyperv/netvsc

2016-08-08 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Aug  9 04:50:20 2016
New Revision: 303867
URL: https://svnweb.freebsd.org/changeset/base/303867

Log:
  hyperv/hn: Move gpa array out of netvsc_packet.
  
  Prepare to deprecate the netvsc_packet.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7436

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.c
  head/sys/dev/hyperv/netvsc/hv_net_vsc.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Tue Aug  9 04:41:33 2016
(r303866)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Tue Aug  9 04:50:20 2016
(r303867)
@@ -799,7 +799,8 @@ hv_nv_on_send_completion(netvsc_dev *net
  * Returns 0 on success, non-zero on failure.
  */
 int
-hv_nv_on_send(struct vmbus_channel *chan, netvsc_packet *pkt)
+hv_nv_on_send(struct vmbus_channel *chan,
+netvsc_packet *pkt, struct vmbus_gpa *gpa, int gpa_cnt)
 {
nvsp_msg send_msg;
int ret;
@@ -818,8 +819,8 @@ hv_nv_on_send(struct vmbus_channel *chan
send_msg.msgs.vers_1_msgs.send_rndis_pkt.send_buf_section_size =
pkt->send_buf_section_size;
 
-   if (pkt->gpa_cnt) {
-   ret = vmbus_chan_send_sglist(chan, pkt->gpa, pkt->gpa_cnt,
+   if (gpa_cnt) {
+   ret = vmbus_chan_send_sglist(chan, gpa, gpa_cnt,
&send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)pkt);
} else {
ret = vmbus_chan_send(chan,

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Tue Aug  9 04:41:33 2016
(r303866)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Tue Aug  9 04:50:20 2016
(r303867)
@@ -1137,8 +1137,6 @@ typedef struct netvsc_packet_ {
void*rndis_mesg;
uint32_ttot_data_buf_len;
void*data;
-   uint32_tgpa_cnt;
-   struct vmbus_gpa gpa[NETVSC_PACKET_MAXPAGE];
 } netvsc_packet;
 
 typedef struct {
@@ -1216,6 +1214,9 @@ struct hn_tx_ring {
bus_dma_tag_t   hn_tx_data_dtag;
uint64_thn_csum_assist;
 
+   int hn_gpa_cnt;
+   struct vmbus_gpa hn_gpa[NETVSC_PACKET_MAXPAGE];
+
u_long  hn_no_txdescs;
u_long  hn_send_failed;
u_long  hn_txdma_failed;
@@ -1275,7 +1276,8 @@ netvsc_dev *hv_nv_on_device_add(struct h
 void *additional_info, struct hn_rx_ring *rxr);
 int hv_nv_on_device_remove(struct hn_softc *sc,
 boolean_t destroy_channel);
-int hv_nv_on_send(struct vmbus_channel *chan, netvsc_packet *pkt);
+int hv_nv_on_send(struct vmbus_channel *chan, netvsc_packet *pkt,
+   struct vmbus_gpa *gpa, int gpa_cnt);
 int hv_nv_get_next_send_section(netvsc_dev *net_dev);
 void hv_nv_subchan_attach(struct vmbus_channel *chan,
 struct hn_rx_ring *rxr);

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Aug  9 04:41:33 
2016(r303866)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Aug  9 04:50:20 
2016(r303867)
@@ -993,7 +993,7 @@ hn_encap(struct hn_tx_ring *txr, struct 
packet->send_buf_section_idx = send_buf_section_idx;
packet->send_buf_section_size =
packet->tot_data_buf_len;
-   packet->gpa_cnt = 0;
+   txr->hn_gpa_cnt = 0;
txr->hn_tx_chimney++;
goto done;
}
@@ -1019,19 +1019,19 @@ hn_encap(struct hn_tx_ring *txr, struct 
}
*m_head0 = m_head;
 
-   packet->gpa_cnt = nsegs + HV_RF_NUM_TX_RESERVED_PAGE_BUFS;
+   txr->hn_gpa_cnt = nsegs + HV_RF_NUM_TX_RESERVED_PAGE_BUFS;
 
/* send packet with page buffer */
-   packet->gpa[0].gpa_page = atop(txd->rndis_msg_paddr);
-   packet->gpa[0].gpa_ofs = txd->rndis_msg_paddr & PAGE_MASK;
-   packet->gpa[0].gpa_len = rndis_msg_size;
+   txr->hn_gpa[0].gpa_page = atop(txd->rndis_msg_paddr);
+   txr->hn_gpa[0].gpa_ofs = txd->rndis_msg_paddr & PAGE_MASK;
+   txr->hn_gpa[0].gpa_len = rndis_msg_size;
 
/*
 * Fill the page buffers with mbuf info starting at index
 * HV_RF_NUM_TX_RESERVED_PAGE_BUFS.
 */
for (i = 0; i < nsegs; ++i) {
-   struct vmbus_gpa *gpa = &packet->gpa[
+   struct vmbus_gpa *gpa = &txr->hn_gpa[
i + HV_RF_NUM_TX_RESERVED_PAGE_BUFS];
 
gpa->gpa_page = atop(segs[i].ds_addr);
@@ -1068,7 +1068,8 @@ again:
 * Make sure

Re: svn commit: r303763 - in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys

2016-08-08 Thread Andriy Gapon
On 09/08/2016 02:48, Navdeep Parhar wrote:
> Hello Andriy,
> 
> I'm at r303837 and have had two panics today in zfs_rename.  I have a
> core for a kernel built with -O0.  Let me know if you think it's related
> to this commit and need more information.  This is the stack:
> 
> (also available at https://people.freebsd.org/~np/rename_panic.txt in
> case the wide lines are hard to read in email).

Thank you very much for the report.
More details are required for analysis. In frame 11 I would like to see objects
pointed to by all arguments and additionally local variables tdzp, sdzp, zfsvfs
and zilog.

> (kgdb) bt
> #0  doadump (textdump=0) at /root/ws/head/sys/kern/kern_shutdown.c:298
> #1  0x803f8692 in db_dump (dummy=-2100833195, dummy2=false,
> dummy3=-1, dummy4=0xfe08604c6810 "") at
> /root/ws/head/sys/ddb/db_command.c:533
> #2  0x803f847e in db_command (last_cmdp=0x821d40d8
> , cmd_table=0x0, dopager=1) at
> /root/ws/head/sys/ddb/db_command.c:440
> #3  0x803f801e in db_command_loop () at
> /root/ws/head/sys/ddb/db_command.c:493
> #4  0x803fcf13 in db_trap (type=12, code=0) at
> /root/ws/head/sys/ddb/db_main.c:251
> #5  0x8100116f in kdb_trap (type=12, code=0,
> tf=0xfe08604c6fe0) at /root/ws/head/sys/kern/subr_kdb.c:654
> #6  0x8163df24 in trap_fatal (frame=0xfe08604c6fe0,
> eva=18446744069414584336) at /root/ws/head/sys/amd64/amd64/trap.c:836
> #7  0x8163e53b in trap_pfault (frame=0xfe08604c6fe0,
> usermode=0) at /root/ws/head/sys/amd64/amd64/trap.c:763
> #8  0x8163d1e2 in trap (frame=0xfe08604c6fe0) at
> /root/ws/head/sys/amd64/amd64/trap.c:442
> #9  0x8163e63a in trap_check (frame=0xfe08604c6fe0) at
> /root/ws/head/sys/amd64/amd64/trap.c:635
> #10 
> #11 0x82c7d455 in zfs_rename (sdvp=0xf80016e331d8,
> svpp=0xfe08604c7318, scnp=0xfe08604c7750,
> tdvp=0xf8015644, tvpp=0xfe08604c7308,
> tcnp=0xfe08604c7688, cr=0xf8001612e600)
> at
> /root/ws/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c:3959
> #12 0x82c6f6a9 in zfs_freebsd_rename (ap=0xfe08604c73c8) at
> /root/ws/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c:5275
> #13 0x8187d484 in VOP_RENAME_APV (vop=0x82d19bb0
> , a=0xfe08604c73c8) at vnode_if.c:1547
> #14 0x810e5d41 in VOP_RENAME (fdvp=0xf80016e331d8,
> fvp=0xf80174c02588, fcnp=0xfe08604c7750,
> tdvp=0xf8015644, tvp=0xf8017d7d1ce8,
> tcnp=0xfe08604c7688) at ./vnode_if.h:636
> #15 0x810e5b17 in kern_renameat (td=0xf8010b855a40,
> oldfd=-100, old=0x800a121a0  0x800a121a0>, newfd=-100, new=0x7fffcfee  memory at address 0x7fffcfee>,
> pathseg=UIO_USERSPACE) at /root/ws/head/sys/kern/vfs_syscalls.c:3553
> #16 0x810e53d7 in sys_rename (td=0xf8010b855a40,
> uap=0xfe08604c7a58) at /root/ws/head/sys/kern/vfs_syscalls.c:3427
> #17 0x83ce244d in filemon_wrapper_rename (td=0xf8010b855a40,
> uap=0xfe08604c7a58) at
> /root/ws/head/sys/modules/filemon/../../dev/filemon/filemon_wrapper.c:240
> #18 0x8163f1a9 in syscallenter (td=0xf8010b855a40,
> sa=0xfe08604c7a48) at
> /root/ws/head/sys/amd64/amd64/../../kern/subr_syscall.c:135
> #19 0x8163e9ea in amd64_syscall (td=0xf8010b855a40,
> traced=0) at /root/ws/head/sys/amd64/amd64/trap.c:942
> 
> Regards,
> Navdeep
> 
> 
> On 08/04/2016 23:23, Andriy Gapon wrote:
>> Author: avg
>> Date: Fri Aug  5 06:23:06 2016
>> New Revision: 303763
>> URL: https://svnweb.freebsd.org/changeset/base/303763
>>
>> Log:
>>   zfs: honour and make use of vfs vnode locking protocol
>>   
>>   ZFS POSIX Layer is originally written for Solaris VFS which is very
>>   different from FreeBSD VFS.  Most importantly many things that FreeBSD VFS
>>   manages on behalf of all filesystems are implemented in ZPL in a different
>>   way.
>>   Thus, ZPL contains code that is redundant on FreeBSD or duplicates VFS
>>   functionality or, in the worst cases, badly interacts / interferes
>>   with VFS.
>>   
>>   The most prominent problem is a deadlock caused by the lock order reversal
>>   of vnode locks that may happen with concurrent zfs_rename() and lookup().
>>   The deadlock is a result of zfs_rename() not observing the vnode locking
>>   contract expected by VFS.
>>   
>>   This commit removes all ZPL internal locking that protects parent-child
>>   relationships of filesystem nodes.  These relationships are protected
>>   by vnode locks and the code is changed to take advantage of that fact
>>   and to properly interact with VFS.
>>   
>>   Removal of the internal locking allowed all ZPL dmu_tx_assign calls to
>>   use TXG_WAIT mode.
>>   
>>   Another victim, disputable perhaps, is ZFS support for filesystems with
>>   mixed case sensitivity.  That support is not provided by the OS anyway,
>>   so in ZFS it was a buch of dead code.
>>   
>>   To do:
>>   - replace ZFS_

Re: svn commit: r303763 - in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys

2016-08-08 Thread Andriy Gapon
On 09/08/2016 08:10, Andriy Gapon wrote:
> On 09/08/2016 02:48, Navdeep Parhar wrote:
>> Hello Andriy,
>>
>> I'm at r303837 and have had two panics today in zfs_rename.  I have a
>> core for a kernel built with -O0.  Let me know if you think it's related
>> to this commit and need more information.  This is the stack:
>>
>> (also available at https://people.freebsd.org/~np/rename_panic.txt in
>> case the wide lines are hard to read in email).
> 
> Thank you very much for the report.
> More details are required for analysis. In frame 11 I would like to see 
> objects
> pointed to by all arguments and additionally local variables tdzp, sdzp, 
> zfsvfs
> and zilog.

Navdeep,

thank you for the debugging information (provided out-of-band).
The problem seems to be with leaving a variable uninitialized when a
cross-device rename is detected and then accessing that variable before checking
the error code.  Also, thank you for testing a fix.  I'll commit it very soon.

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


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

2016-08-08 Thread Andriy Gapon
Author: avg
Date: Tue Aug  9 06:11:24 2016
New Revision: 303869
URL: https://svnweb.freebsd.org/changeset/base/303869

Log:
  fix a zfs cross-device rename crash introduced in r303763
  
  The problem was that 'zfsvfs' variable was not initialized if the error
  was detected, but in the exit path the variable was dereferenced before
  the error code was checked.
  
  Reported by:  np
  MFC after:3 days
  X-MFC with:   r303763

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Aug 
 9 04:59:55 2016(r303868)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Aug 
 9 06:11:24 2016(r303869)
@@ -3956,7 +3956,7 @@ unlockout:/* all 4 vnodes are 
locked,
VOP_UNLOCK(sdvp, 0);
 
 out:   /* original two vnodes are locked */
-   if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS && error == 0)
+   if (error == 0 && zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
zil_commit(zilog, 0);
 
if (*tvpp != NULL)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"