svn commit: r302221 - in head: contrib/file contrib/file/doc contrib/file/magic contrib/file/magic/Magdir contrib/file/src lib/libmagic

2016-06-26 Thread Xin LI
Author: delphij
Date: Mon Jun 27 01:29:17 2016
New Revision: 302221
URL: https://svnweb.freebsd.org/changeset/base/302221

Log:
  MFV r302218: file 5.28.
  
  Relnotes: yes
  MFC after:2 weeks
  Approved by:  re (gjb)

Added:
  head/contrib/file/magic/Magdir/ber
 - copied unchanged from r302218, vendor/file/dist/magic/Magdir/ber
  head/contrib/file/magic/Magdir/coverage
 - copied unchanged from r302218, vendor/file/dist/magic/Magdir/coverage
  head/contrib/file/magic/Magdir/pc88
 - copied unchanged from r302218, vendor/file/dist/magic/Magdir/pc88
  head/contrib/file/magic/Magdir/pc98
 - copied unchanged from r302218, vendor/file/dist/magic/Magdir/pc98
  head/contrib/file/magic/Magdir/x68000
 - copied unchanged from r302218, vendor/file/dist/magic/Magdir/x68000
Deleted:
  head/contrib/file/src/magic.h
Modified:
  head/contrib/file/ChangeLog
  head/contrib/file/config.h.in
  head/contrib/file/configure
  head/contrib/file/configure.ac
  head/contrib/file/doc/file.man
  head/contrib/file/magic/Magdir/c-lang
  head/contrib/file/magic/Magdir/console
  head/contrib/file/magic/Magdir/database
  head/contrib/file/magic/Magdir/elf
  head/contrib/file/magic/Magdir/msdos
  head/contrib/file/magic/Magdir/msx
  head/contrib/file/magic/Magdir/perl
  head/contrib/file/magic/Makefile.am
  head/contrib/file/magic/Makefile.in
  head/contrib/file/src/Makefile.am
  head/contrib/file/src/Makefile.in
  head/contrib/file/src/apprentice.c
  head/contrib/file/src/cdf.c
  head/contrib/file/src/compress.c
  head/contrib/file/src/der.c
  head/contrib/file/src/file.c
  head/contrib/file/src/softmagic.c
  head/lib/libmagic/Makefile
  head/lib/libmagic/config.h
Directory Properties:
  head/contrib/file/   (props changed)

Modified: head/contrib/file/ChangeLog
==
--- head/contrib/file/ChangeLog Mon Jun 27 01:17:00 2016(r302220)
+++ head/contrib/file/ChangeLog Mon Jun 27 01:29:17 2016(r302221)
@@ -1,3 +1,15 @@
+2016-06-13  19:40  Christos Zoulas 
+
+   * release 5.28
+   * fix leak on allocation failure
+
+2016-06-01   1:20  Christos Zoulas 
+
+   * PR/555: Avoid overflow for offset > nbytes
+   * PR/550: Segv on DER parsing:
+   - use the correct variable for length
+   - set offset to 0 on failure.
+
 2016-05-13  12:00  Christos Zoulas 

* release 5.27

Modified: head/contrib/file/config.h.in
==
--- head/contrib/file/config.h.in   Mon Jun 27 01:17:00 2016
(r302220)
+++ head/contrib/file/config.h.in   Mon Jun 27 01:29:17 2016
(r302221)
@@ -328,6 +328,9 @@
 # endif
 #endif
 
+/* Enable zlib compression support */
+#undef ZLIBSUPPORT
+
 /* Enable large inode numbers on Mac OS X 10.5.  */
 #ifndef _DARWIN_USE_64_BIT_INODE
 # define _DARWIN_USE_64_BIT_INODE 1

Modified: head/contrib/file/configure
==
--- head/contrib/file/configure Mon Jun 27 01:17:00 2016(r302220)
+++ head/contrib/file/configure Mon Jun 27 01:29:17 2016(r302221)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for file 5.27.
+# Generated by GNU Autoconf 2.69 for file 5.28.
 #
 # Report bugs to .
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='file'
 PACKAGE_TARNAME='file'
-PACKAGE_VERSION='5.27'
-PACKAGE_STRING='file 5.27'
+PACKAGE_VERSION='5.28'
+PACKAGE_STRING='file 5.28'
 PACKAGE_BUGREPORT='chris...@astron.com'
 PACKAGE_URL=''
 
@@ -766,6 +766,7 @@ enable_option_checking
 enable_silent_rules
 enable_elf
 enable_elf_core
+enable_zlib
 enable_fsect_man5
 enable_dependency_tracking
 enable_static
@@ -1327,7 +1328,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures file 5.27 to adapt to many kinds of systems.
+\`configure' configures file 5.28 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1397,7 +1398,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
- short | recursive ) echo "Configuration of file 5.27:";;
+ short | recursive ) echo "Configuration of file 5.28:";;
esac
   cat <<\_ACEOF
 
@@ -1409,6 +1410,7 @@ Optional Features:
   --disable-silent-rules  verbose build output (undo: "make V=0")
   --disable-elfdisable builtin ELF support
   --disable-elf-core   disable ELF core file support
+  --disable-zlib  disable zlib compression support [default=auto]
   --enable-fsect-man5  enable file formats in man section 5
   --enable-dependency-tracking
  

svn commit: r302216 - in head/sys: kern nlm

2016-06-26 Thread Konstantin Belousov
Author: kib
Date: Sun Jun 26 20:08:42 2016
New Revision: 302216
URL: https://svnweb.freebsd.org/changeset/base/302216

Log:
  When sleeping waiting for either local or remote advisory lock,
  interrupt sleeps with the ERESTART on the suspension attempts.
  Otherwise, single-threading requests are deferred until the locks are
  granted for NFS files, which causes hangs.
  
  When retrying local registration of the remotely-granted adv lock,
  allow full suspension and check for suspension, for usual reasons.
  
  Reported by:  markj, pho
  Reviewed by:  jilles
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  Approved by:  re (gjb)

Modified:
  head/sys/kern/kern_lockf.c
  head/sys/nlm/nlm_advlock.c
  head/sys/nlm/nlm_prot_impl.c

Modified: head/sys/kern/kern_lockf.c
==
--- head/sys/kern/kern_lockf.c  Sun Jun 26 20:07:24 2016(r302215)
+++ head/sys/kern/kern_lockf.c  Sun Jun 26 20:08:42 2016(r302216)
@@ -1378,7 +1378,7 @@ lf_setlock(struct lockf *state, struct l
 void **cookiep)
 {
static char lockstr[] = "lockf";
-   int priority, error;
+   int error, priority, stops_deferred;
 
 #ifdef LOCKF_DEBUG
if (lockf_debug & 1)
@@ -1466,7 +1466,9 @@ lf_setlock(struct lockf *state, struct l
}
 
lock->lf_refs++;
+   stops_deferred = sigdeferstop(SIGDEFERSTOP_ERESTART);
error = sx_sleep(lock, >ls_lock, priority, lockstr, 0);
+   sigallowstop(stops_deferred);
if (lf_free_lock(lock)) {
error = EDOOFUS;
goto out;

Modified: head/sys/nlm/nlm_advlock.c
==
--- head/sys/nlm/nlm_advlock.c  Sun Jun 26 20:07:24 2016(r302215)
+++ head/sys/nlm/nlm_advlock.c  Sun Jun 26 20:08:42 2016(r302216)
@@ -697,7 +697,8 @@ nlm_record_lock(struct vnode *vp, int op
 {
struct vop_advlockasync_args a;
struct flock newfl;
-   int error;
+   struct proc *p;
+   int error, stops_deferred;
 
a.a_vp = vp;
a.a_id = NULL;
@@ -730,7 +731,12 @@ nlm_record_lock(struct vnode *vp, int op
 * return EDEADLK.
*/
pause("nlmdlk", 1);
-   /* XXXKIB allow suspend */
+   p = curproc;
+   stops_deferred = sigdeferstop(SIGDEFERSTOP_OFF);
+   PROC_LOCK(p);
+   thread_suspend_check(0);
+   PROC_UNLOCK(p);
+   sigallowstop(stops_deferred);
} else if (error == EINTR) {
/*
 * lf_purgelocks() might wake up the lock

Modified: head/sys/nlm/nlm_prot_impl.c
==
--- head/sys/nlm/nlm_prot_impl.cSun Jun 26 20:07:24 2016
(r302215)
+++ head/sys/nlm/nlm_prot_impl.cSun Jun 26 20:08:42 2016
(r302216)
@@ -1356,7 +1356,7 @@ int
 nlm_wait_lock(void *handle, int timo)
 {
struct nlm_waiting_lock *nw = handle;
-   int error;
+   int error, stops_deferred;
 
/*
 * If the granted message arrived before we got here,
@@ -1364,8 +1364,11 @@ nlm_wait_lock(void *handle, int timo)
 */
mtx_lock(_global_lock);
error = 0;
-   if (nw->nw_waiting)
+   if (nw->nw_waiting) {
+   stops_deferred = sigdeferstop(SIGDEFERSTOP_ERESTART);
error = msleep(nw, _global_lock, PCATCH, "nlmlock", timo);
+   sigallowstop(stops_deferred);
+   }
TAILQ_REMOVE(_waiting_locks, nw, nw_link);
if (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: r302215 - in head/sys: fs/fifofs kern sys

2016-06-26 Thread Konstantin Belousov
Author: kib
Date: Sun Jun 26 20:07:24 2016
New Revision: 302215
URL: https://svnweb.freebsd.org/changeset/base/302215

Log:
  Rewrite sigdeferstop(9) and sigallowstop(9) into more flexible
  framework allowing to set the suspension policy for the dynamic block.
  Extend the currently possible policies of stopping on interruptible
  sleeps and ignoring such sleeps by two more: do not suspend at
  interruptible sleeps, but interrupt them with either EINTR or ERESTART.
  
  Reviewed by:  jilles
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  Approved by:  re (gjb)

Modified:
  head/sys/fs/fifofs/fifo_vnops.c
  head/sys/kern/kern_sig.c
  head/sys/kern/kern_thread.c
  head/sys/kern/subr_trap.c
  head/sys/sys/mount.h
  head/sys/sys/proc.h
  head/sys/sys/signalvar.h

Modified: head/sys/fs/fifofs/fifo_vnops.c
==
--- head/sys/fs/fifofs/fifo_vnops.c Sun Jun 26 18:43:42 2016
(r302214)
+++ head/sys/fs/fifofs/fifo_vnops.c Sun Jun 26 20:07:24 2016
(r302215)
@@ -194,11 +194,10 @@ fifo_open(ap)
if ((ap->a_mode & FREAD) && fip->fi_writers == 0) {
gen = fip->fi_wgen;
VOP_UNLOCK(vp, 0);
-   stops_deferred = sigallowstop();
+   stops_deferred = sigdeferstop(SIGDEFERSTOP_OFF);
error = msleep(>fi_readers, PIPE_MTX(fpipe),
PDROP | PCATCH | PSOCK, "fifoor", 0);
-   if (stops_deferred)
-   sigdeferstop();
+   sigallowstop(stops_deferred);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
if (error != 0 && gen == fip->fi_wgen) {
fip->fi_readers--;
@@ -222,11 +221,10 @@ fifo_open(ap)
if ((ap->a_mode & FWRITE) && fip->fi_readers == 0) {
gen = fip->fi_rgen;
VOP_UNLOCK(vp, 0);
-   stops_deferred = sigallowstop();
+   stops_deferred = sigdeferstop(SIGDEFERSTOP_OFF);
error = msleep(>fi_writers, PIPE_MTX(fpipe),
PDROP | PCATCH | PSOCK, "fifoow", 0);
-   if (stops_deferred)
-   sigdeferstop();
+   sigallowstop(stops_deferred);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
if (error != 0 && gen == fip->fi_rgen) {
fip->fi_writers--;

Modified: head/sys/kern/kern_sig.c
==
--- head/sys/kern/kern_sig.cSun Jun 26 18:43:42 2016(r302214)
+++ head/sys/kern/kern_sig.cSun Jun 26 20:07:24 2016(r302215)
@@ -2596,41 +2596,81 @@ tdsigcleanup(struct thread *td)
 
 }
 
+static int
+sigdeferstop_curr_flags(int cflags)
+{
+
+   MPASS((cflags & (TDF_SEINTR | TDF_SERESTART)) == 0 ||
+   (cflags & TDF_SBDRY) != 0);
+   return (cflags & (TDF_SBDRY | TDF_SEINTR | TDF_SERESTART));
+}
+
 /*
- * Defer the delivery of SIGSTOP for the current thread.  Returns true
- * if stops were deferred and false if they were already deferred.
+ * Defer the delivery of SIGSTOP for the current thread, according to
+ * the requested mode.  Returns previous flags, which must be restored
+ * by sigallowstop().
+ *
+ * TDF_SBDRY, TDF_SEINTR, and TDF_SERESTART flags are only set and
+ * cleared by the current thread, which allow the lock-less read-only
+ * accesses below.
  */
 int
-sigdeferstop(void)
+sigdeferstop(int mode)
 {
struct thread *td;
+   int cflags, nflags;
 
td = curthread;
-   if (td->td_flags & TDF_SBDRY)
-   return (0);
-   thread_lock(td);
-   td->td_flags |= TDF_SBDRY;
-   thread_unlock(td);
-   return (1);
+   cflags = sigdeferstop_curr_flags(td->td_flags);
+   switch (mode) {
+   case SIGDEFERSTOP_NOP:
+   nflags = cflags;
+   break;
+   case SIGDEFERSTOP_OFF:
+   nflags = 0;
+   break;
+   case SIGDEFERSTOP_SILENT:
+   nflags = (cflags | TDF_SBDRY) & ~(TDF_SEINTR | TDF_SERESTART);
+   break;
+   case SIGDEFERSTOP_EINTR:
+   nflags = (cflags | TDF_SBDRY | TDF_SEINTR) & ~TDF_SERESTART;
+   break;
+   case SIGDEFERSTOP_ERESTART:
+   nflags = (cflags | TDF_SBDRY | TDF_SERESTART) & ~TDF_SEINTR;
+   break;
+   default:
+   panic("sigdeferstop: invalid mode %x", mode);
+   break;
+   }
+   if (cflags != nflags) {
+   thread_lock(td);
+   td->td_flags = (td->td_flags & ~cflags) | nflags;
+   thread_unlock(td);
+   }
+   return (cflags);
 }
 
 /*
- * Permit the delivery of 

Re: svn commit: r298537 - head/etc/rc.d

2016-06-26 Thread Benjamin Kaduk
On Sun, Apr 24, 2016 at 12:01 PM, Jan Beich  wrote:

> Jens Schweikhardt  writes:
>
> >  - parenthesize the "case" string for symmetry and improved
> >search for matching paren (e.g. with vi's %)
> [...]
> >   case "${state}" in
> > - [oO][nN])
> > + ([oO][nN])
> >   swapon /dev/zvol/${name}
> >   ;;
>
> For style consistency is more important. Why this case is special unlike
> the rest of rc.d/* or rc.subr ?
>


Coming in quite late, I agree.  I think this part should be reverted.

-Ben
___
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: r302214 - head/sys/powerpc/aim

2016-06-26 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Sun Jun 26 18:43:42 2016
New Revision: 302214
URL: https://svnweb.freebsd.org/changeset/base/302214

Log:
  Enter 64-bit mode as early as possible in the 64-bit PowerPC boot sequence.
  Most of the effect of setting MSR[SF] is that the CPU will stop ignoring
  the high 32 bits of registers containing addresses in load/store
  instructions. As such, the kernel was setting it only when it began to
  need access to high memory. MSR[SF] also affects the operation of some
  conditional instructions, however, and so setting it at late times could
  subtly break code at very early times. This fixes use of the FDT mode in
  loader, and FDT boot more generally, on 64-bit PowerPC systems.
  
  Hardware provided by: IBM LTC
  Approved by: re (kib)

Modified:
  head/sys/powerpc/aim/aim_machdep.c
  head/sys/powerpc/aim/locore64.S

Modified: head/sys/powerpc/aim/aim_machdep.c
==
--- head/sys/powerpc/aim/aim_machdep.c  Sun Jun 26 16:59:59 2016
(r302213)
+++ head/sys/powerpc/aim/aim_machdep.c  Sun Jun 26 18:43:42 2016
(r302214)
@@ -179,17 +179,6 @@ aim_cpu_init(vm_offset_t toc)
trap_offset = 0;
cacheline_warn = 0;
 
-   #ifdef __powerpc64__
-   /*
-* Switch to 64-bit mode, if the bootloader didn't, before we start 
-* using memory beyond what the bootloader might have set up.
-* Guaranteed not to cause an implicit branch since we either (a)
-* started with a 32-bit bootloader below 4 GB or (b) were already in
-* 64-bit mode, making this a no-op.
-*/
-   mtmsrd(mfmsr() | PSL_SF);
-   #endif
-
/* Various very early CPU fix ups */
switch (mfpvr() >> 16) {
/*

Modified: head/sys/powerpc/aim/locore64.S
==
--- head/sys/powerpc/aim/locore64.S Sun Jun 26 16:59:59 2016
(r302213)
+++ head/sys/powerpc/aim/locore64.S Sun Jun 26 18:43:42 2016
(r302214)
@@ -76,6 +76,14 @@ btext:
  */
.text
 ASENTRY_NOPROF(__start)
+   /* Set 64-bit mode if not yet set before branching to C */
+   mfmsr   %r20
+   li  %r21,1
+   insrdi  %r20,%r21,1,0
+   mtmsrd  %r20
+   isync
+   nop /* Make this block a multiple of 8 bytes */
+
/* Set up the TOC pointer */
b   0f
.align 3
___
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: r302213 - head/sys/compat/linux

2016-06-26 Thread Dmitry Chagin
Author: dchagin
Date: Sun Jun 26 16:59:59 2016
New Revision: 302213
URL: https://svnweb.freebsd.org/changeset/base/302213

Log:
  Fix a bug introduced in r283433.
  
  [1] Remove unneeded sockaddr conversion before kern_recvit() call as the from
  argument is used to record result (the source address of the received 
message) only.
  
  [2] In Linux the type of msg_namelen member of struct msghdr is signed but 
native
  msg_namelen has a unsigned type (socklen_t). So use the proper storage to 
fetch fromlen
  from userspace and than check the user supplied value and return EINVAL if it 
is less
  than 0 as a Linux do.
  
  Reported by:  Thomas Mueller  [1]
  Reviewed by:  kib@
  Approved by:  re (gjb, kib)
  MFC after:3 days

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

Modified: head/sys/compat/linux/linux_socket.c
==
--- head/sys/compat/linux/linux_socket.cSun Jun 26 16:38:42 2016
(r302212)
+++ head/sys/compat/linux/linux_socket.cSun Jun 26 16:59:59 2016
(r302213)
@@ -1054,18 +1054,16 @@ linux_recvfrom(struct thread *td, struct
 {
struct msghdr msg;
struct iovec aiov;
-   int error;
+   int error, fromlen;
 
if (PTRIN(args->fromlen) != NULL) {
-   error = copyin(PTRIN(args->fromlen), _namelen,
-   sizeof(msg.msg_namelen));
-   if (error != 0)
-   return (error);
-
-   error = linux_to_bsd_sockaddr((struct sockaddr 
*)PTRIN(args->from),
-   msg.msg_namelen);
+   error = copyin(PTRIN(args->fromlen), ,
+   sizeof(fromlen));
if (error != 0)
return (error);
+   if (fromlen < 0)
+   return (EINVAL);
+   msg.msg_namelen = fromlen;
} else
msg.msg_namelen = 0;
 
___
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: r302212 - head/sys/netinet

2016-06-26 Thread Michael Tuexen
Author: tuexen
Date: Sun Jun 26 16:38:42 2016
New Revision: 302212
URL: https://svnweb.freebsd.org/changeset/base/302212

Log:
  This patch fixes two bugs related to the SCTP message recovery
  for messages which have been put on the send queue:
  * Do not report any DATA or I-DATA chunk padding.
  * Correctly deal with the I-DATA chunk header instead of the DATA
chunk header when the I-DATA extension is used.
  
  Approved by:  re (kib)
  MFC after:1 week

Modified:
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctputil.c
==
--- head/sys/netinet/sctputil.c Sun Jun 26 14:44:01 2016(r302211)
+++ head/sys/netinet/sctputil.c Sun Jun 26 16:38:42 2016(r302212)
@@ -2933,7 +2933,8 @@ sctp_notify_send_failed(struct sctp_tcb 
struct sctp_send_failed *ssf;
struct sctp_send_failed_event *ssfe;
struct sctp_queued_to_read *control;
-   int length;
+   struct sctp_chunkhdr *chkhdr;
+   int notifhdr_len, chk_len, chkhdr_len, padding_len, payload_len;
 
if ((stcb == NULL) ||
(sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, 
SCTP_PCB_FLAGS_RECVSENDFAILEVNT) &&
@@ -2942,27 +2943,49 @@ sctp_notify_send_failed(struct sctp_tcb 
return;
}
if (sctp_stcb_is_feature_on(stcb->sctp_ep, stcb, 
SCTP_PCB_FLAGS_RECVNSENDFAILEVNT)) {
-   length = sizeof(struct sctp_send_failed_event);
+   notifhdr_len = sizeof(struct sctp_send_failed_event);
} else {
-   length = sizeof(struct sctp_send_failed);
+   notifhdr_len = sizeof(struct sctp_send_failed);
}
-   m_notify = sctp_get_mbuf_for_msg(length, 0, M_NOWAIT, 1, MT_DATA);
+   m_notify = sctp_get_mbuf_for_msg(notifhdr_len, 0, M_NOWAIT, 1, MT_DATA);
if (m_notify == NULL)
/* no space left */
return;
-   SCTP_BUF_LEN(m_notify) = 0;
+   SCTP_BUF_LEN(m_notify) = notifhdr_len;
+   if (stcb->asoc.idata_supported) {
+   chkhdr_len = sizeof(struct sctp_idata_chunk);
+   } else {
+   chkhdr_len = sizeof(struct sctp_data_chunk);
+   }
+   /* Use some defaults in case we can't access the chunk header */
+   if (chk->send_size >= chkhdr_len) {
+   payload_len = chk->send_size - chkhdr_len;
+   } else {
+   payload_len = 0;
+   }
+   padding_len = 0;
+   if (chk->data != NULL) {
+   chkhdr = mtod(chk->data, struct sctp_chunkhdr *);
+   if (chkhdr != NULL) {
+   chk_len = ntohs(chkhdr->chunk_length);
+   if ((chk_len >= chkhdr_len) &&
+   (chk->send_size >= chk_len) &&
+   (chk->send_size - chk_len < 4)) {
+   padding_len = chk->send_size - chk_len;
+   payload_len = chk->send_size - chkhdr_len - 
padding_len;
+   }
+   }
+   }
if (sctp_stcb_is_feature_on(stcb->sctp_ep, stcb, 
SCTP_PCB_FLAGS_RECVNSENDFAILEVNT)) {
ssfe = mtod(m_notify, struct sctp_send_failed_event *);
-   memset(ssfe, 0, length);
+   memset(ssfe, 0, notifhdr_len);
ssfe->ssfe_type = SCTP_SEND_FAILED_EVENT;
if (sent) {
ssfe->ssfe_flags = SCTP_DATA_SENT;
} else {
ssfe->ssfe_flags = SCTP_DATA_UNSENT;
}
-   length += chk->send_size;
-   length -= sizeof(struct sctp_data_chunk);
-   ssfe->ssfe_length = length;
+   ssfe->ssfe_length = (uint32_t) (notifhdr_len + payload_len);
ssfe->ssfe_error = error;
/* not exactly what the user sent in, but should be close :) */
ssfe->ssfe_info.snd_sid = chk->rec.data.stream_number;
@@ -2971,39 +2994,33 @@ sctp_notify_send_failed(struct sctp_tcb 
ssfe->ssfe_info.snd_context = chk->rec.data.context;
ssfe->ssfe_info.snd_assoc_id = sctp_get_associd(stcb);
ssfe->ssfe_assoc_id = sctp_get_associd(stcb);
-   SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_send_failed_event);
} else {
ssf = mtod(m_notify, struct sctp_send_failed *);
-   memset(ssf, 0, length);
+   memset(ssf, 0, notifhdr_len);
ssf->ssf_type = SCTP_SEND_FAILED;
if (sent) {
ssf->ssf_flags = SCTP_DATA_SENT;
} else {
ssf->ssf_flags = SCTP_DATA_UNSENT;
}
-   length += chk->send_size;
-   length -= sizeof(struct sctp_data_chunk);
-   ssf->ssf_length = length;
+   ssf->ssf_length = (uint32_t) (notifhdr_len + payload_len);
ssf->ssf_error = 

Re: svn commit: r302194 - head/lib/libthr/thread

2016-06-26 Thread Konstantin Belousov
On Sun, Jun 26, 2016 at 12:33:38AM +0200, Jilles Tjoelker wrote:
> To be bug-compatible with glibc, you'd need to return the wrong
> [EDEADLK] error for robust errorcheck mutexes only. Robust
> non-errorcheck and non-robust errorcheck mutexes return the correct
> [EBUSY]. I have not checked PI and PP mutexes which probably use a
> different code path.
Yes, you are right, I read the glibc code wrong way.

> I'm not sure whether we should copy glibc's bug, but if we do it must be
> documented in the man page. I'm not happy with it because the bug may
> break applications written to the standard; at least, Samba developers
> should be contacted first.

I tried to send the mail to samba tech list yesterday, but it did not pass.
Seems that today I managed it.

Still, it is pity that the only real-world consumer of the robust
interface cannot exercise our implementation due to this minor issue.
___
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: r302210 - head/sys/fs/nfsclient

2016-06-26 Thread Konstantin Belousov
On Sun, Jun 26, 2016 at 10:54:44AM -0500, Benjamin Kaduk wrote:
> On Sun, Jun 26, 2016 at 9:18 AM, Konstantin Belousov 
> wrote:
> 
> > Author: kib
> > Date: Sun Jun 26 14:18:28 2016
> > New Revision: 302210
> > URL: https://svnweb.freebsd.org/changeset/base/302210
> >
> > Log:
> >   Clean other flags in ncl_inactive, only.  Add comment explaining why
> > other
> >   flags should be unset.
> >
> [...]
> 
> > +
> > +   /*
> > +* NMODIFIED means that there might be dirty/stale buffers
> > +* associated with the NFS vnode.  None of the other flags are
> > +* meaningful after the vnode is unused.
> > +*/
> > +   np->n_flag &= NMODIFIED;
> >
> 
> Maybe I am confused, but the commit message reads like this should be '=',
> not '&='.

The line clears all flags except NMODIFIED, and lefts the NMODIFIED flag
intact (it could have been not set there, after all).
___
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: r302210 - head/sys/fs/nfsclient

2016-06-26 Thread Benjamin Kaduk
On Sun, Jun 26, 2016 at 9:18 AM, Konstantin Belousov 
wrote:

> Author: kib
> Date: Sun Jun 26 14:18:28 2016
> New Revision: 302210
> URL: https://svnweb.freebsd.org/changeset/base/302210
>
> Log:
>   Clean other flags in ncl_inactive, only.  Add comment explaining why
> other
>   flags should be unset.
>
[...]

> +
> +   /*
> +* NMODIFIED means that there might be dirty/stale buffers
> +* associated with the NFS vnode.  None of the other flags are
> +* meaningful after the vnode is unused.
> +*/
> +   np->n_flag &= NMODIFIED;
>

Maybe I am confused, but the commit message reads like this should be '=',
not '&='.

-Ben


> +   mtx_unlock(>n_mtx);
> return (0);
>  }
>
>
___
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: r302211 - in head/usr.sbin: bhyve bhyveload

2016-06-26 Thread Roman Bogorodskiy
Author: novel (ports committer)
Date: Sun Jun 26 14:44:01 2016
New Revision: 302211
URL: https://svnweb.freebsd.org/changeset/base/302211

Log:
  bhyve: improve memory size documentation
  
  A couple of minor memory size option related nits:
  
   - use common name 'memsize' (instead of 'max-size' or just 'size')
   - bhyve: update usage with memsize unit suffix, drop legacy "MB"
 unit
   - bhyveload: update usage with memsize unit suffix
   - bhyve(8): document default size
   - bhyveload(8): use memsize formatting like it's done
 in bhyve(8)
  
  Reviewed by:wblock, grehan
  Approved by:re (kib), wblock, grehan
  Differential Revision:  https://reviews.freebsd.org/D6952

Modified:
  head/usr.sbin/bhyve/bhyve.8
  head/usr.sbin/bhyve/bhyverun.c
  head/usr.sbin/bhyveload/bhyveload.8
  head/usr.sbin/bhyveload/bhyveload.c

Modified: head/usr.sbin/bhyve/bhyve.8
==
--- head/usr.sbin/bhyve/bhyve.8 Sun Jun 26 14:18:28 2016(r302210)
+++ head/usr.sbin/bhyve/bhyve.8 Sun Jun 26 14:44:01 2016(r302211)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 18, 2016
+.Dd June 24, 2016
 .Dt BHYVE 8
 .Os
 .Sh NAME
@@ -36,7 +36,7 @@
 .Op Fl c Ar numcpus
 .Op Fl g Ar gdbport
 .Op Fl l Ar lpcdev Ns Op , Ns Ar conf
-.Op Fl m Ar size Ns Op Ar K|k|M|m|G|g|T|t
+.Op Fl m Ar memsize Ns Op Ar K|k|M|m|G|g|T|t
 .Op Fl p Ar vcpu:hostcpu
 .Op Fl s Ar slot,emulation Ns Op , Ns Ar conf
 .Op Fl U Ar uuid
@@ -105,7 +105,7 @@ and
 .Ar com2
 and the boot ROM device
 .Ar bootrom .
-.It Fl m Ar size Ns Op Ar K|k|M|m|G|g|T|t
+.It Fl m Ar memsize Ns Op Ar K|k|M|m|G|g|T|t
 Guest physical memory size in bytes.
 This must be the same size that was given to
 .Xr bhyveload 8 .
@@ -114,6 +114,9 @@ The size argument may be suffixed with o
 or lower case) to indicate a multiple of kilobytes, megabytes, gigabytes,
 or terabytes.
 If no suffix is given, the value is assumed to be in megabytes.
+.Pp
+.Ar memsize
+defaults to 256M.
 .It Fl p Ar vcpu:hostcpu
 Pin guest's virtual CPU
 .Em vcpu

Modified: head/usr.sbin/bhyve/bhyverun.c
==
--- head/usr.sbin/bhyve/bhyverun.c  Sun Jun 26 14:18:28 2016
(r302210)
+++ head/usr.sbin/bhyve/bhyverun.c  Sun Jun 26 14:44:01 2016
(r302211)
@@ -125,7 +125,7 @@ usage(int code)
 
 fprintf(stderr,
 "Usage: %s [-abehuwxACHPSWY] [-c vcpus] [-g ] [-l 
]\n"
-   "   %*s [-m mem] [-p vcpu:hostcpu] [-s ] [-U uuid] 
\n"
+   "   %*s [-m memsize[K|k|M|m|G|g|T|t]] [-p vcpu:hostcpu] [-s 
] [-U uuid] \n"
"   -a: local apic is in xAPIC mode (deprecated)\n"
"   -A: create ACPI tables\n"
"   -c: # cpus (default 1)\n"
@@ -135,7 +135,7 @@ usage(int code)
"   -h: help\n"
"   -H: vmexit from the guest on hlt\n"
"   -l: LPC device configuration\n"
-   "   -m: memory size in MB\n"
+   "   -m: memory size\n"
"   -p: pin 'vcpu' to 'hostcpu'\n"
"   -P: vmexit from the guest on pause\n"
"   -s:  PCI slot config\n"

Modified: head/usr.sbin/bhyveload/bhyveload.8
==
--- head/usr.sbin/bhyveload/bhyveload.8 Sun Jun 26 14:18:28 2016
(r302210)
+++ head/usr.sbin/bhyveload/bhyveload.8 Sun Jun 26 14:44:01 2016
(r302211)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 26, 2016
+.Dd June 24, 2016
 .Dt BHYVELOAD 8
 .Os
 .Sh NAME
@@ -42,7 +42,7 @@ guest inside a bhyve virtual machine
 .Op Fl e Ar name=value
 .Op Fl h Ar host-path
 .Op Fl l Ar os-loader
-.Op Fl m Ar mem-size
+.Op Fl m Ar memsize Ns Op Ar K|k|M|m|G|g|T|t
 .Ar vmname
 .Sh DESCRIPTION
 .Nm
@@ -103,16 +103,12 @@ will use
 which presents a standard
 .Fx
 loader.
-.It Fl m Ar mem-size Xo
-.Sm off
-.Op Cm K | k | M | m | G | g | T | t
-.Xc
-.Sm on
-.Ar mem-size
+.It Fl m Ar memsize Ns Op Ar K|k|M|m|G|g|T|t
+.Ar memsize
 is the amount of memory allocated to the guest.
 .Pp
 The
-.Ar mem-size
+.Ar memsize
 argument may be suffixed with one of
 .Cm K ,
 .Cm M ,
@@ -123,9 +119,8 @@ or
 Kilobytes, Megabytes, Gigabytes or Terabytes
 respectively.
 .Pp
-The default value of
-.Ar mem-size
-is 256M.
+.Ar memsize
+defaults to 256M.
 .It Fl C
 Include guest memory in the core file when
 .Nm

Modified: head/usr.sbin/bhyveload/bhyveload.c
==
--- head/usr.sbin/bhyveload/bhyveload.c Sun Jun 26 14:18:28 2016
(r302210)
+++ head/usr.sbin/bhyveload/bhyveload.c Sun Jun 26 14:44:01 2016
(r302211)
@@ -648,7 +648,7 @@ usage(void)
 
fprintf(stderr,
"usage: %s [-S][-c ] [-d ] [-e 

svn commit: r302210 - head/sys/fs/nfsclient

2016-06-26 Thread Konstantin Belousov
Author: kib
Date: Sun Jun 26 14:18:28 2016
New Revision: 302210
URL: https://svnweb.freebsd.org/changeset/base/302210

Log:
  Clean other flags in ncl_inactive, only.  Add comment explaining why other
  flags should be unset.
  
  Suggested and reviewed by:rmacklem
  Sponsored by: The FreeBSD Foundation
  MFC after:12 days
  Approved by:  re (gjb)

Modified:
  head/sys/fs/nfsclient/nfs_clnode.c

Modified: head/sys/fs/nfsclient/nfs_clnode.c
==
--- head/sys/fs/nfsclient/nfs_clnode.c  Sun Jun 26 13:18:03 2016
(r302209)
+++ head/sys/fs/nfsclient/nfs_clnode.c  Sun Jun 26 14:18:28 2016
(r302210)
@@ -206,7 +206,7 @@ ncl_releasesillyrename(struct vnode *vp,
 
ASSERT_VOP_ELOCKED(vp, "releasesillyrename");
np = VTONFS(vp);
-   mtx_lock(>n_mtx);
+   mtx_assert(>n_mtx, MA_OWNED);
if (vp->v_type != VDIR) {
sp = np->n_sillyrename;
np->n_sillyrename = NULL;
@@ -224,14 +224,13 @@ ncl_releasesillyrename(struct vnode *vp,
taskqueue_enqueue(taskqueue_thread, >s_task);
mtx_lock(>n_mtx);
}
-   np->n_flag &= NMODIFIED;
-   mtx_unlock(>n_mtx);
 }
 
 int
 ncl_inactive(struct vop_inactive_args *ap)
 {
struct vnode *vp = ap->a_vp;
+   struct nfsnode *np;
boolean_t retv;
 
if (NFS_ISV4(vp) && vp->v_type == VREG) {
@@ -254,7 +253,17 @@ ncl_inactive(struct vop_inactive_args *a
}
}
 
+   np = VTONFS(vp);
+   mtx_lock(>n_mtx);
ncl_releasesillyrename(vp, ap->a_td);
+
+   /*
+* NMODIFIED means that there might be dirty/stale buffers
+* associated with the NFS vnode.  None of the other flags are
+* meaningful after the vnode is unused.
+*/
+   np->n_flag &= NMODIFIED;
+   mtx_unlock(>n_mtx);
return (0);
 }
 
@@ -275,7 +284,9 @@ ncl_reclaim(struct vop_reclaim_args *ap)
if (nfs_reclaim_p != NULL)
nfs_reclaim_p(ap);
 
+   mtx_lock(>n_mtx);
ncl_releasesillyrename(vp, ap->a_td);
+   mtx_unlock(>n_mtx);
 
/*
 * Destroy the vm object and flush associated pages.
___
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: r302207 - head/sys/netinet

2016-06-26 Thread Michael Tuexen
Author: tuexen
Date: Sun Jun 26 12:41:02 2016
New Revision: 302207
URL: https://svnweb.freebsd.org/changeset/base/302207

Log:
  This patch fixes a locking bug when a send() call blocks
  on an SCTP socket and the association is aborted by the
  peer.
  
  Approved by:  re (kib)
  MFC after:1 week

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Sun Jun 26 00:53:31 2016
(r302206)
+++ head/sys/netinet/sctp_output.c  Sun Jun 26 12:41:02 2016
(r302207)
@@ -13136,6 +13136,7 @@ sctp_lower_sosend(struct socket *so,
asoc, stcb->asoc.total_output_queue_size);
}
if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
+   SOCKBUF_UNLOCK(>so_snd);
goto out_unlocked;
}
inqueue_bytes = stcb->asoc.total_output_queue_size - 
(stcb->asoc.chunks_on_out_queue * sizeof(struct sctp_data_chunk));
___
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"