svn commit: r259412 - in head/sys: conf dev/netmap modules/netmap net

2013-12-15 Thread Luigi Rizzo
Author: luigi
Date: Sun Dec 15 08:37:24 2013
New Revision: 259412
URL: http://svnweb.freebsd.org/changeset/base/259412

Log:
  split netmap code according to functions:
  - netmap.cbase code
  - netmap_freebsd.cFreeBSD-specific code
  - netmap_generic.cemulate netmap over standard drivers
  - netmap_mbq.csimple mbuf tailq
  - netmap_mem2.c   memory management
  - netmap_vale.c   VALE switch
  
  simplify devce-specific code

Added:
  head/sys/dev/netmap/netmap_freebsd.c   (contents, props changed)
  head/sys/dev/netmap/netmap_generic.c   (contents, props changed)
  head/sys/dev/netmap/netmap_mbq.c   (contents, props changed)
  head/sys/dev/netmap/netmap_mbq.h   (contents, props changed)
  head/sys/dev/netmap/netmap_vale.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/netmap/if_em_netmap.h
  head/sys/dev/netmap/if_igb_netmap.h
  head/sys/dev/netmap/if_lem_netmap.h
  head/sys/dev/netmap/if_re_netmap.h
  head/sys/dev/netmap/ixgbe_netmap.h
  head/sys/dev/netmap/netmap.c
  head/sys/dev/netmap/netmap_kern.h
  head/sys/dev/netmap/netmap_mem2.c
  head/sys/dev/netmap/netmap_mem2.h
  head/sys/modules/netmap/Makefile
  head/sys/net/netmap.h
  head/sys/net/netmap_user.h

Modified: head/sys/conf/files
==
--- head/sys/conf/files Sun Dec 15 07:07:13 2013(r259411)
+++ head/sys/conf/files Sun Dec 15 08:37:24 2013(r259412)
@@ -1880,7 +1880,11 @@ dev/nand/nfc_if.moptional nand
 dev/ncv/ncr53c500.coptional ncv
 dev/ncv/ncr53c500_pccard.c optional ncv pccard
 dev/netmap/netmap.coptional netmap
+dev/netmap/netmap_freebsd.coptional netmap
+dev/netmap/netmap_generic.coptional netmap
+dev/netmap/netmap_mbq.coptional netmap
 dev/netmap/netmap_mem2.c   optional netmap
+dev/netmap/netmap_vale.c   optional netmap
 # compile-with ${NORMAL_C} -Wconversion -Wextra
 dev/nge/if_nge.c   optional nge
 dev/nxge/if_nxge.c optional nxge \

Modified: head/sys/dev/netmap/if_em_netmap.h
==
--- head/sys/dev/netmap/if_em_netmap.h  Sun Dec 15 07:07:13 2013
(r259411)
+++ head/sys/dev/netmap/if_em_netmap.h  Sun Dec 15 08:37:24 2013
(r259412)
@@ -26,7 +26,7 @@
 /*
  * $FreeBSD$
  *
- * netmap support for em.
+ * netmap support for: em.
  *
  * For more details on netmap support please see ixgbe_netmap.h
  */
@@ -39,10 +39,6 @@
 #include dev/netmap/netmap_kern.h
 
 
-static voidem_netmap_block_tasks(struct adapter *);
-static voidem_netmap_unblock_tasks(struct adapter *);
-
-
 // XXX do we need to block/unblock the tasks ?
 static void
 em_netmap_block_tasks(struct adapter *adapter)
@@ -85,45 +81,31 @@ em_netmap_unblock_tasks(struct adapter *
 
 
 /*
- * Register/unregister routine
+ * Register/unregister. We are already under netmap lock.
  */
 static int
-em_netmap_reg(struct ifnet *ifp, int onoff)
+em_netmap_reg(struct netmap_adapter *na, int onoff)
 {
+   struct ifnet *ifp = na-ifp;
struct adapter *adapter = ifp-if_softc;
-   struct netmap_adapter *na = NA(ifp);
-   int error = 0;
-
-   if (na == NULL)
-   return EINVAL;  /* no netmap support here */
 
+   EM_CORE_LOCK(adapter);
em_disable_intr(adapter);
 
/* Tell the stack that the interface is no longer active */
ifp-if_drv_flags = ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
 
em_netmap_block_tasks(adapter);
-
+   /* enable or disable flags and callbacks in na and ifp */
if (onoff) {
-   ifp-if_capenable |= IFCAP_NETMAP;
-
-   na-if_transmit = ifp-if_transmit;
-   ifp-if_transmit = netmap_transmit;
-
-   em_init_locked(adapter);
-   if ((ifp-if_drv_flags  (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) 
== 0) {
-   error = ENOMEM;
-   goto fail;
-   }
+   nm_set_native_flags(na);
} else {
-fail:
-   /* return to non-netmap mode */
-   ifp-if_transmit = na-if_transmit;
-   ifp-if_capenable = ~IFCAP_NETMAP;
-   em_init_locked(adapter);/* also enable intr */
+   nm_clear_native_flags(na);
}
+   em_init_locked(adapter);/* also enable intr */
em_netmap_unblock_tasks(adapter);
-   return (error);
+   EM_CORE_UNLOCK(adapter);
+   return (ifp-if_drv_flags  IFF_DRV_RUNNING ? 0 : 1);
 }
 
 
@@ -131,93 +113,103 @@ fail:
  * Reconcile kernel and user view of the transmit ring.
  */
 static int
-em_netmap_txsync(struct ifnet *ifp, u_int ring_nr, int flags)
+em_netmap_txsync(struct netmap_adapter *na, u_int ring_nr, int flags)
 {
-   struct adapter *adapter = ifp-if_softc;
-   struct tx_ring *txr = adapter-tx_rings[ring_nr];
-   

svn commit: r259413 - head/usr.sbin/bhyve

2013-12-15 Thread Joel Dahl
Author: joel (doc committer)
Date: Sun Dec 15 08:52:16 2013
New Revision: 259413
URL: http://svnweb.freebsd.org/changeset/base/259413

Log:
  mdoc: sort SEE ALSO.

Modified:
  head/usr.sbin/bhyve/bhyve.8

Modified: head/usr.sbin/bhyve/bhyve.8
==
--- head/usr.sbin/bhyve/bhyve.8 Sun Dec 15 08:37:24 2013(r259412)
+++ head/usr.sbin/bhyve/bhyve.8 Sun Dec 15 08:52:16 2013(r259413)
@@ -288,8 +288,8 @@ bhyve -c 4 \e\
 .Xr nmdm 4 ,
 .Xr vmm 4 ,
 .Xr ethers 5 ,
-.Xr bhyveload 8 ,
-.Xr bhyvectl 8
+.Xr bhyvectl 8 ,
+.Xr bhyveload 8
 .Sh HISTORY
 .Nm
 first appeared in
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r259397 - in head/sys/cam: . scsi

2013-12-15 Thread Konstantin Belousov
On Sat, Dec 14, 2013 at 10:07:41PM +, Nathan Whitehorn wrote:
 Author: nwhitehorn
 Date: Sat Dec 14 22:07:40 2013
 New Revision: 259397
 URL: http://svnweb.freebsd.org/changeset/base/259397
 
 Log:
   Widen lun_id_t to 64 bits. This is a follow-on to r257345 to let the kernel
   support all valid SAM-5 LUN IDs. CAM_VERSION is bumped, as the CAM ABI
   (though not API) is changed. No behavior is changed relative to r257345
   except that LUNs with non-zero high 32 bits will no longer be ignored
   during device enumeration for SIMs that have set PIM_EXTLUNS.

Does libcam.so version need to be bumped ?


pgpQfaIOzgRlN.pgp
Description: PGP signature


Re: svn commit: r259397 - in head/sys/cam: . scsi

2013-12-15 Thread Nathan Whitehorn

On 12/15/13 08:01, Konstantin Belousov wrote:

On Sat, Dec 14, 2013 at 10:07:41PM +, Nathan Whitehorn wrote:

Author: nwhitehorn
Date: Sat Dec 14 22:07:40 2013
New Revision: 259397
URL: http://svnweb.freebsd.org/changeset/base/259397

Log:
   Widen lun_id_t to 64 bits. This is a follow-on to r257345 to let the kernel
   support all valid SAM-5 LUN IDs. CAM_VERSION is bumped, as the CAM ABI
   (though not API) is changed. No behavior is changed relative to r257345
   except that LUNs with non-zero high 32 bits will no longer be ignored
   during device enumeration for SIMs that have set PIM_EXTLUNS.

Does libcam.so version need to be bumped ?


Yes, it should have been. I'll go do this now.
-Nathan
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r259416 - in head: . lib/libcam

2013-12-15 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Sun Dec 15 15:51:05 2013
New Revision: 259416
URL: http://svnweb.freebsd.org/changeset/base/259416

Log:
  Bump libcam shared library version forgotten in r259397.
  
  Submitted by: kib

Modified:
  head/ObsoleteFiles.inc
  head/lib/libcam/Makefile

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Sun Dec 15 15:37:07 2013(r259415)
+++ head/ObsoleteFiles.inc  Sun Dec 15 15:51:05 2013(r259416)
@@ -38,6 +38,8 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20131215: libcam version bumped
+OLD_LIBS+=lib/libcam.so.6 usr/lib32/libcam.so.6
 # 20131202: libcapsicum and libcasper moved to /lib/
 OLD_LIBS+=usr/lib/libcapsicum.so.0
 OLD_LIBS+=usr/lib/libcasper.so.0

Modified: head/lib/libcam/Makefile
==
--- head/lib/libcam/MakefileSun Dec 15 15:37:07 2013(r259415)
+++ head/lib/libcam/MakefileSun Dec 15 15:51:05 2013(r259416)
@@ -42,6 +42,6 @@ MLINKS+=  cam.3 cam_open_device.3 \
 SDIR=  ${.CURDIR}/../../sys
 CFLAGS+=   -I${.CURDIR} -I${SDIR}
 
-SHLIB_MAJOR=   6
+SHLIB_MAJOR=   7
 
 .include bsd.lib.mk
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r259417 - head/usr.sbin/ypbind

2013-12-15 Thread Hiroki Sato
Author: hrs
Date: Sun Dec 15 16:17:00 2013
New Revision: 259417
URL: http://svnweb.freebsd.org/changeset/base/259417

Log:
  Replace Sun RPC license for TI-RPC library with a 3-clause BSD license,
  with the explicit permission of Sun Microsystems in 2009.
  The code in question in this file was copied from lib/libc/rpc/pmap_getport.c.

Modified:
  head/usr.sbin/ypbind/yp_ping.c

Modified: head/usr.sbin/ypbind/yp_ping.c
==
--- head/usr.sbin/ypbind/yp_ping.c  Sun Dec 15 15:51:05 2013
(r259416)
+++ head/usr.sbin/ypbind/yp_ping.c  Sun Dec 15 16:17:00 2013
(r259417)
@@ -30,35 +30,33 @@
  * SUCH DAMAGE.
  */
 
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part.  Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
+/*-
+ * Copyright (c) 2009, Sun Microsystems, Inc.
+ * All rights reserved.
  *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California  94043
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions are met:
+ * - Redistributions of source code must retain the above copyright notice, 
+ *   this list of conditions and the following disclaimer.
+ * - 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.
+ * - Neither the name of Sun Microsystems, Inc. nor the names of its 
+ *   contributors may be used to endorse or promote products derived 
+ *   from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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.
  */
-
 #if 0
 #ifndef lint
 static char *sccsid = @(#)from: clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun 
Micro;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r259397 - in head/sys/cam: . scsi

2013-12-15 Thread Nathan Whitehorn

On 12/15/13 08:01, Konstantin Belousov wrote:

On Sat, Dec 14, 2013 at 10:07:41PM +, Nathan Whitehorn wrote:

Author: nwhitehorn
Date: Sat Dec 14 22:07:40 2013
New Revision: 259397
URL: http://svnweb.freebsd.org/changeset/base/259397

Log:
   Widen lun_id_t to 64 bits. This is a follow-on to r257345 to let the kernel
   support all valid SAM-5 LUN IDs. CAM_VERSION is bumped, as the CAM ABI
   (though not API) is changed. No behavior is changed relative to r257345
   except that LUNs with non-zero high 32 bits will no longer be ignored
   during device enumeration for SIMs that have set PIM_EXTLUNS.

Does libcam.so version need to be bumped ?


It wasn't the last time. Maybe it should have been?
-Nathan
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r259418 - head/sys/powerpc/pseries

2013-12-15 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Sun Dec 15 16:58:23 2013
New Revision: 259418
URL: http://svnweb.freebsd.org/changeset/base/259418

Log:
  Set max_lun to zero. This field is ignored unless we are manually probing
  LUNs anyway, and we certainly don't want to probe 2^32 values by hand in
  that case.
  
  MFC after:2 weeks

Modified:
  head/sys/powerpc/pseries/phyp_vscsi.c

Modified: head/sys/powerpc/pseries/phyp_vscsi.c
==
--- head/sys/powerpc/pseries/phyp_vscsi.c   Sun Dec 15 16:17:00 2013
(r259417)
+++ head/sys/powerpc/pseries/phyp_vscsi.c   Sun Dec 15 16:58:23 2013
(r259418)
@@ -426,7 +426,7 @@ vscsi_cam_action(struct cam_sim *sim, un
cpi-target_sprt = 0;
cpi-hba_eng_cnt = 0;
cpi-max_target = 0;
-   cpi-max_lun = ~(lun_id_t)(0);
+   cpi-max_lun = 0;
cpi-initiator_id = ~0;
strncpy(cpi-sim_vid, FreeBSD, SIM_IDLEN);
strncpy(cpi-hba_vid, IBM, HBA_IDLEN);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r259421 - head/sys/powerpc/aim

2013-12-15 Thread Justin Hibbits
Author: jhibbits
Date: Sun Dec 15 18:07:25 2013
New Revision: 259421
URL: http://svnweb.freebsd.org/changeset/base/259421

Log:
  Save r3 before using it for the trap check, else we end up saving the new r3,
  containing the trap instruction encoding (0x7c810808), and restoring it back
  with the frame on return.  This caused it to panic on my ppc32 machine, but
  somehow my ppc64 machine overlooked it, because I was using such a simple
  dtrace probe.
  
  X-MFC-with:   r259245
  MFC after:2 weeks

Modified:
  head/sys/powerpc/aim/trap_subr32.S
  head/sys/powerpc/aim/trap_subr64.S

Modified: head/sys/powerpc/aim/trap_subr32.S
==
--- head/sys/powerpc/aim/trap_subr32.S  Sun Dec 15 18:05:04 2013
(r259420)
+++ head/sys/powerpc/aim/trap_subr32.S  Sun Dec 15 18:07:25 2013
(r259421)
@@ -897,11 +897,13 @@ CNAME(dblow):
 #ifdef KDTRACE_HOOKS
/* Privileged, so drop to KDB */
mfsrr0  %r1
-   lwz %r4,0(%r1)
+   mtsprg3 %r3
+   lwz %r1,0(%r1)
/* Check if it's a DTrace trap. */
li  %r3,0x0808
addis   %r3,%r3,0x7c81
-   cmplw   %cr0,%r3,%r4
+   cmplw   %cr0,%r3,%r1
+   mfsprg3 %r3
beq %cr0,1b
 #endif
/* Privileged, so drop to KDB */

Modified: head/sys/powerpc/aim/trap_subr64.S
==
--- head/sys/powerpc/aim/trap_subr64.S  Sun Dec 15 18:05:04 2013
(r259420)
+++ head/sys/powerpc/aim/trap_subr64.S  Sun Dec 15 18:07:25 2013
(r259421)
@@ -804,11 +804,13 @@ CNAME(dblow):
 #ifdef KDTRACE_HOOKS
/* Privileged, so drop to KDB */
mfsrr0  %r1
-   lwz %r4,0(%r1)
+   mtsprg3 %r3
+   lwz %r1,0(%r1)
/* Check if it's a DTrace trap. */
li  %r3,0x0808
addis   %r3,%r3,0x7c81
-   cmplw   %cr0,%r3,%r4
+   cmplw   %cr0,%r3,%r1
+   mfsprg3 %r3
beq %cr0,1b
 #endif
GET_CPUINFO(%r1)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r259422 - head/sys/conf

2013-12-15 Thread Konstantin Belousov
Author: kib
Date: Sun Dec 15 18:13:42 2013
New Revision: 259422
URL: http://svnweb.freebsd.org/changeset/base/259422

Log:
  Revert r259045.
  
  It seems that clang miscompiles code related to UDP with -fno-strict-overflow.

Modified:
  head/sys/conf/kern.mk

Modified: head/sys/conf/kern.mk
==
--- head/sys/conf/kern.mk   Sun Dec 15 18:07:25 2013(r259421)
+++ head/sys/conf/kern.mk   Sun Dec 15 18:13:42 2013(r259422)
@@ -148,12 +148,6 @@ INLINE_LIMIT?= 8000
 CFLAGS+=   -ffreestanding
 
 #
-# Do not allow a compiler to optimize out overflow checks for signed
-# types.
-#
-CFLAGS+=   -fno-strict-overflow
-
-#
 # GCC SSP support
 #
 .if ${MK_SSP} != no  ${MACHINE_CPUARCH} != ia64  \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r259424 - head/sys/sys

2013-12-15 Thread Benjamin Kaduk
Author: bjk (doc committer)
Date: Sun Dec 15 18:26:31 2013
New Revision: 259424
URL: http://svnweb.freebsd.org/changeset/base/259424

Log:
  Increment __FreeBSD_version for the behavior change of gss_pseudo_random
  introduced in r259286.
  
  Approved by:  hrs (mentor, src committer)

Modified:
  head/sys/sys/param.h

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hSun Dec 15 18:22:51 2013(r259423)
+++ head/sys/sys/param.hSun Dec 15 18:26:31 2013(r259424)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 113  /* Master, propagated to newvers */
+#define __FreeBSD_version 114  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r259422 - head/sys/conf

2013-12-15 Thread Rui Paulo
On 15 Dec 2013, at 10:13, Konstantin Belousov k...@freebsd.org wrote:

 Author: kib
 Date: Sun Dec 15 18:13:42 2013
 New Revision: 259422
 URL: http://svnweb.freebsd.org/changeset/base/259422
 
 Log:
  Revert r259045.
 
  It seems that clang miscompiles code related to UDP with 
 -fno-strict-overflow.

Could you please file a bug report if you haven't already?

Thanks,
--
Rui Paulo



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


Re: svn commit: r259422 - head/sys/conf

2013-12-15 Thread Eitan Adler
On Sun, Dec 15, 2013 at 1:13 PM, Konstantin Belousov k...@freebsd.org wrote:
 Author: kib
 Date: Sun Dec 15 18:13:42 2013
 New Revision: 259422
 URL: http://svnweb.freebsd.org/changeset/base/259422

 Log:
   Revert r259045.

   It seems that clang miscompiles code related to UDP with 
 -fno-strict-overflow.
=
Is this actual miscompilation or just a missed optimization opportunity?


-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r259425 - head

2013-12-15 Thread Benjamin Kaduk
Author: bjk (doc committer)
Date: Sun Dec 15 19:18:18 2013
New Revision: 259425
URL: http://svnweb.freebsd.org/changeset/base/259425

Log:
  Add an UPDATING entry for the gss_pseudo_random behavior change
  
  Approved by:  hrs (mentor, src committer)

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Sun Dec 15 18:26:31 2013(r259424)
+++ head/UPDATING   Sun Dec 15 19:18:18 2013(r259425)
@@ -31,6 +31,17 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
disable the most expensive debugging functionality run
ln -s 'abort:false,junk:false' /etc/malloc.conf.)
 
+20131213:
+   The behavior of gss_pseudo_random() for the krb5 mechanism
+   has changed, for applications requesting a longer random string
+   than produced by the underlying enctype's pseudo-random() function.
+   In particular, the random string produced from a session key of
+   enctype aes256-cts-hmac-sha1-96 or aes256-cts-hmac-sha1-96 will
+   be different at the 17th octet and later, after this change.
+   The counter used in the PRF+ construction is now encoded as a
+   big-endian integer in accordance with RFC 4402.
+   __FreeBSD_version is bumped to 114.
+
 20131108:
The WITHOUT_ATF build knob has been removed and its functionality
has been subsumed into the more generic WITHOUT_TESTS.  If you were
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r259426 - in head/release: . scripts

2013-12-15 Thread Glen Barber
Author: gjb
Date: Sun Dec 15 20:38:07 2013
New Revision: 259426
URL: http://svnweb.freebsd.org/changeset/base/259426

Log:
  Add a pkg(8) repository configuration file for cdrom-based package
  installation.
  
  As part of the 'pkg-stage' target, copy the configuration file
  to the 'packages/repos/' directory on the DVD filesystem.
  
  MFC after:3 days
  X-MFC-Before: -RC3
  Sponsored by: The FreeBSD Foundation

Added:
  head/release/scripts/FreeBSD_install_cdrom.conf   (contents, props changed)
Modified:
  head/release/Makefile

Modified: head/release/Makefile
==
--- head/release/Makefile   Sun Dec 15 19:18:18 2013(r259425)
+++ head/release/Makefile   Sun Dec 15 20:38:07 2013(r259426)
@@ -225,7 +225,11 @@ pkg-stage:
 .if !defined(NOPKG)  exists(${.CURDIR}/${TARGET}/pkg-stage.conf)
sh ${.CURDIR}/scripts/pkg-stage.sh ${.CURDIR}/${TARGET}/pkg-stage.conf \
${REVISION}
+   mkdir -p ${.OBJDIR}/dvd/packages/repos/
+   cp ${.CURDIR}/scripts/FreeBSD_install_cdrom.conf \
+   ${.OBJDIR}/dvd/packages/repos/
 .endif
+   touch ${.TARGET}
 
 cdrom: disc1.iso bootonly.iso
 dvdrom: dvd1.iso

Added: head/release/scripts/FreeBSD_install_cdrom.conf
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/release/scripts/FreeBSD_install_cdrom.conf Sun Dec 15 20:38:07 
2013(r259426)
@@ -0,0 +1,12 @@
+#
+# $FreeBSD$
+#
+# The pkg(8) repository configuration file for the installation DVD.
+#
+
+FreeBSD_install_cdrom: {
+  url: file:///dist/packages/${ABI},
+  mirror_type: none,
+  enabled: yes
+}
+
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r259427 - head/usr.sbin/bsdconfig/share/packages

2013-12-15 Thread Glen Barber
Author: gjb
Date: Sun Dec 15 20:47:27 2013
New Revision: 259427
URL: http://svnweb.freebsd.org/changeset/base/259427

Log:
  Export 'REPOS_DIR' when the selected source medium for package
  installation is cdrom.  This enables bsdconfig(8) to make use
  of the on-disc pkg(8) repository configuration, which fixes
  package selection and installation from the dvd installer.
  
  MFC after:3 days
  M-MFC-With:   r259426
  X-MFC-Before: -RC3
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.sbin/bsdconfig/share/packages/index.subr

Modified: head/usr.sbin/bsdconfig/share/packages/index.subr
==
--- head/usr.sbin/bsdconfig/share/packages/index.subr   Sun Dec 15 20:38:07 
2013(r259426)
+++ head/usr.sbin/bsdconfig/share/packages/index.subr   Sun Dec 15 20:47:27 
2013(r259427)
@@ -119,6 +119,9 @@ f_index_initialize()
$DEVICE_TYPE_HTTP_PROXY)
f_getvar $VAR_HTTP_PROXY_PATH __site
__site=$__site/packages/$PKG_ABI ;;
+   $DEVICE_TYPE_CDROM)
+   __site=file://$MOUNTPOINT/packages/$PKG_ABI
+   export REPOS_DIR=$MOUNTPOINT/packages/repos ;;
*) # UFS, DISK, CDROM, USB, DOS, NFS, etc.
__site=file://$MOUNTPOINT/packages/$PKG_ABI
esac
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r259428 - head/sys/geom/eli

2013-12-15 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun Dec 15 22:51:26 2013
New Revision: 259428
URL: http://svnweb.freebsd.org/changeset/base/259428

Log:
  Clear content of keyfiles loaded by the loader after processing them.
  
  Pointed out by:   rwatson
  MFC after:1 week

Modified:
  head/sys/geom/eli/g_eli.c

Modified: head/sys/geom/eli/g_eli.c
==
--- head/sys/geom/eli/g_eli.c   Sun Dec 15 20:47:27 2013(r259427)
+++ head/sys/geom/eli/g_eli.c   Sun Dec 15 22:51:26 2013(r259428)
@@ -990,6 +990,7 @@ g_eli_keyfiles_load(struct hmac_ctx *ctx
G_ELI_DEBUG(1, Loaded keyfile %s for %s (type: %s)., file,
provider, name);
g_eli_crypto_hmac_update(ctx, data, size);
+   bzero(data, size);
}
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r259429 - head/sys/geom/eli

2013-12-15 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun Dec 15 22:52:18 2013
New Revision: 259429
URL: http://svnweb.freebsd.org/changeset/base/259429

Log:
  Clear some more places with potentially sensitive data.
  
  MFC after:1 week

Modified:
  head/sys/geom/eli/g_eli_crypto.c

Modified: head/sys/geom/eli/g_eli_crypto.c
==
--- head/sys/geom/eli/g_eli_crypto.cSun Dec 15 22:51:26 2013
(r259428)
+++ head/sys/geom/eli/g_eli_crypto.cSun Dec 15 22:52:18 2013
(r259429)
@@ -288,10 +288,12 @@ g_eli_crypto_hmac_final(struct hmac_ctx 
bzero(ctx, sizeof(*ctx));
SHA512_Update(lctx, digest, sizeof(digest));
SHA512_Final(digest, lctx);
+   bzero(lctx, sizeof(lctx));
/* mdsize == 0 means Give me the whole hash! */
if (mdsize == 0)
mdsize = SHA512_MDLEN;
bcopy(digest, md, mdsize);
+   bzero(digest, sizeof(digest));
 }
 
 void
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r259430 - head/lib/libnv

2013-12-15 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun Dec 15 22:58:09 2013
New Revision: 259430
URL: http://svnweb.freebsd.org/changeset/base/259430

Log:
  MFp4 @1189139:
  
  Get rid of the msg_peek() function, which has a problem.  If there was less
  data in the socket buffer than requested by the caller, the function would 
busy
  loop, as select(2) will always return immediately.
  
  We can just receive nvlhdr now, because some time ago we splitted receive of
  data from the receive of descriptors.
  
  MFC after:1 week

Modified:
  head/lib/libnv/msgio.c
  head/lib/libnv/msgio.h
  head/lib/libnv/nvlist.c

Modified: head/lib/libnv/msgio.c
==
--- head/lib/libnv/msgio.c  Sun Dec 15 22:52:18 2013(r259429)
+++ head/lib/libnv/msgio.c  Sun Dec 15 22:58:09 2013(r259430)
@@ -113,30 +113,6 @@ fd_wait(int fd, bool doread)
NULL, NULL);
 }
 
-int
-msg_peek(int sock, void *buf, size_t size)
-{
-   ssize_t done;
-
-   PJDLOG_ASSERT(sock = 0);
-   PJDLOG_ASSERT(size  0);
-
-   do {
-   fd_wait(sock, true);
-   done = recv(sock, buf, size, MSG_PEEK | MSG_WAITALL);
-   if (done == -1) {
-   if (errno == EAGAIN || errno == EINTR)
-   continue;
-   return (-1);
-   } else if (done == 0) {
-   errno = ENOTCONN;
-   return (-1);
-   }
-   } while (done != (ssize_t)size);
-
-   return (0);
-}
-
 static int
 msg_recv(int sock, struct msghdr *msg)
 {

Modified: head/lib/libnv/msgio.h
==
--- head/lib/libnv/msgio.h  Sun Dec 15 22:52:18 2013(r259429)
+++ head/lib/libnv/msgio.h  Sun Dec 15 22:58:09 2013(r259430)
@@ -38,8 +38,6 @@ struct cmsgcred;
 struct iovec;
 struct msghdr;
 
-int msg_peek(int sock, void *buf, size_t size);
-
 int cred_send(int sock);
 int cred_recv(int sock, struct cmsgcred *cred);
 

Modified: head/lib/libnv/nvlist.c
==
--- head/lib/libnv/nvlist.c Sun Dec 15 22:52:18 2013(r259429)
+++ head/lib/libnv/nvlist.c Sun Dec 15 22:58:09 2013(r259430)
@@ -724,11 +724,11 @@ nvlist_recv(int sock)
 {
struct nvlist_header nvlhdr;
nvlist_t *nvl, *ret;
+   unsigned char *buf;
size_t nfds, size;
-   void *buf;
int serrno, *fds;
 
-   if (msg_peek(sock, nvlhdr, sizeof(nvlhdr)) == -1)
+   if (buf_recv(sock, nvlhdr, sizeof(nvlhdr)) == -1)
return (NULL);
 
if (!nvlist_check_header(nvlhdr))
@@ -741,10 +741,12 @@ nvlist_recv(int sock)
if (buf == NULL)
return (NULL);
 
+   memcpy(buf, nvlhdr, sizeof(nvlhdr));
+
ret = NULL;
fds = NULL;
 
-   if (buf_recv(sock, buf, size) == -1)
+   if (buf_recv(sock, buf + sizeof(nvlhdr), size - sizeof(nvlhdr)) == -1)
goto out;
 
if (nfds  0) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r259431 - head/sbin/casperd

2013-12-15 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun Dec 15 22:59:34 2013
New Revision: 259431
URL: http://svnweb.freebsd.org/changeset/base/259431

Log:
  MFp4 @1189141:
  
  Change casperd's zygote process title.
  
  MFC after:1 week

Modified:
  head/sbin/casperd/zygote.c

Modified: head/sbin/casperd/zygote.c
==
--- head/sbin/casperd/zygote.c  Sun Dec 15 22:58:09 2013(r259430)
+++ head/sbin/casperd/zygote.c  Sun Dec 15 22:59:34 2013(r259431)
@@ -122,6 +122,8 @@ zygote_main(int sock)
 
assert(sock  STDERR_FILENO);
 
+   setproctitle(zygote);
+
if (pjdlog_mode_get() != PJDLOG_MODE_STD)
stdnull();
for (fd = STDERR_FILENO + 1; fd  sock; fd++)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r259432 - head/contrib/tcpdump

2013-12-15 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun Dec 15 23:02:36 2013
New Revision: 259432
URL: http://svnweb.freebsd.org/changeset/base/259432

Log:
  Make use of casperd's system.dns service when running without the -n option.
  Now tcpdump(8) is sandboxed even if DNS resolution is required.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/contrib/tcpdump/addrtoname.c
  head/contrib/tcpdump/tcpdump.c

Modified: head/contrib/tcpdump/addrtoname.c
==
--- head/contrib/tcpdump/addrtoname.c   Sun Dec 15 22:59:34 2013
(r259431)
+++ head/contrib/tcpdump/addrtoname.c   Sun Dec 15 23:02:36 2013
(r259432)
@@ -32,6 +32,10 @@ static const char rcsid[] _U_ =
 #include config.h
 #endif
 
+#ifdef __FreeBSD__
+#include libcapsicum.h
+#include libcapsicum_dns.h
+#endif
 #include tcpdump-stdinc.h
 
 #ifdef USE_ETHER_NTOHOST
@@ -203,6 +207,9 @@ intoa(u_int32_t addr)
 
 static u_int32_t f_netmask;
 static u_int32_t f_localnet;
+#ifdef HAVE_LIBCAPSICUM
+extern cap_channel_t *capdns;
+#endif
 
 /*
  * Return a name for the IP address pointed to by ap.  This address
@@ -248,7 +255,13 @@ getname(const u_char *ap)
 */
if (!nflag 
(addr  f_netmask) == f_localnet) {
-   hp = gethostbyaddr((char *)addr, 4, AF_INET);
+#ifdef HAVE_LIBCAPSICUM
+   if (capdns != NULL) {
+   hp = cap_gethostbyaddr(capdns, (char *)addr, 4,
+   AF_INET);
+   } else
+#endif
+   hp = gethostbyaddr((char *)addr, 4, AF_INET);
if (hp) {
char *dotp;
 
@@ -293,7 +306,13 @@ getname6(const u_char *ap)
 * Do not print names if -n was given.
 */
if (!nflag) {
-   hp = gethostbyaddr((char *)addr, sizeof(addr), AF_INET6);
+#ifdef HAVE_LIBCAPSICUM
+   if (capdns != NULL) {
+   hp = cap_gethostbyaddr(capdns, (char *)addr,
+   sizeof(addr), AF_INET6);
+   } else
+#endif
+   hp = gethostbyaddr((char *)addr, sizeof(addr), 
AF_INET6);
if (hp) {
char *dotp;
 

Modified: head/contrib/tcpdump/tcpdump.c
==
--- head/contrib/tcpdump/tcpdump.c  Sun Dec 15 22:59:34 2013
(r259431)
+++ head/contrib/tcpdump/tcpdump.c  Sun Dec 15 23:02:36 2013
(r259432)
@@ -76,6 +76,12 @@ extern int SIZE_BUF;
 #include net/bpf.h
 #include fcntl.h
 #include libgen.h
+#ifdef HAVE_LIBCAPSICUM
+#include libcapsicum.h
+#include libcapsicum_dns.h
+#include libcapsicum_service.h
+#include nv.h
+#endif /* HAVE_LIBCAPSICUM */
 #endif /* __FreeBSD__ */
 #ifndef WIN32
 #include sys/wait.h
@@ -123,6 +129,10 @@ static int infoprint;
 
 char *program_name;
 
+#ifdef HAVE_LIBCAPSICUM
+cap_channel_t *capdns;
+#endif
+
 int32_t thiszone;  /* seconds offset from gmt to local time */
 
 /* Forwards */
@@ -684,6 +694,45 @@ get_next_file(FILE *VFile, char *ptr)
return ret;
 }
 
+#ifdef HAVE_LIBCAPSICUM
+static cap_channel_t *
+capdns_setup(void)
+{
+   cap_channel_t *capcas, *capdnsloc;
+   const char *types[1];
+   int families[2];
+
+   capcas = cap_init();
+   if (capcas == NULL) {
+   warning(unable to contact casperd);
+   return (NULL);
+   }
+   capdnsloc = cap_service_open(capcas, system.dns);
+   /* Casper capability no longer needed. */
+   cap_close(capcas);
+   if (capdnsloc == NULL) {
+   warning(unable to open system.dns service);
+   return (NULL);
+   }
+   /* Limit system.dns to reverse DNS lookups. */
+   types[0] = ADDR;
+   if (cap_dns_type_limit(capdnsloc, types, 1)  0) {
+   warning(unable to limit access to system.dns service);
+   cap_close(capdnsloc);
+   return (NULL);
+   }
+   families[0] = AF_INET;
+   families[1] = AF_INET6;
+   if (cap_dns_family_limit(capdnsloc, families, 2)  0) {
+   warning(unable to limit access to system.dns service);
+   cap_close(capdnsloc);
+   return (NULL);
+   }
+
+   return (capdnsloc);
+}
+#endif /* HAVE_LIBCAPSICUM */
+
 int
 main(int argc, char **argv)
 {
@@ -1417,6 +1466,12 @@ main(int argc, char **argv)
free(cmdbuf);
exit(0);
}
+
+#ifdef HAVE_LIBCAPSICUM
+   if (!nflag)
+   capdns = capdns_setup();
+#endif /* HAVE_LIBCAPSICUM */
+
init_addrtoname(localnet, netmask);
 init_checksum();
 
@@ -1615,7 +1670,12 @@ main(int argc, char **argv)
 #endif /* WIN32 */
 
 #ifdef __FreeBSD__
-   cansandbox = (nflag  VFileName == NULL  zflag == NULL);
+   cansandbox = (VFileName == NULL  zflag == NULL);
+#ifdef HAVE_LIBCAPSICUM
+   cansandbox = (cansandbox  (nflag || capdns != 

svn commit: r259433 - head/usr.sbin/tcpdump/tcpdump

2013-12-15 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun Dec 15 23:05:19 2013
New Revision: 259433
URL: http://svnweb.freebsd.org/changeset/base/259433

Log:
  Add Casper support.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.sbin/tcpdump/tcpdump/Makefile

Modified: head/usr.sbin/tcpdump/tcpdump/Makefile
==
--- head/usr.sbin/tcpdump/tcpdump/Makefile  Sun Dec 15 23:02:36 2013
(r259432)
+++ head/usr.sbin/tcpdump/tcpdump/Makefile  Sun Dec 15 23:05:19 2013
(r259433)
@@ -162,6 +162,11 @@ CFLAGS+=   -DLBL_ALIGN
 
 DPADD= ${LIBL} ${LIBPCAP}
 LDADD= -ll -lpcap
+.if ${MK_CASPER} != no
+DPADD+=${LIBCAPSICUM} ${LIBNV}
+LDADD+=-lcapsicum -lnv
+CFLAGS+=-DHAVE_LIBCAPSICUM
+.endif
 .if ${MK_OPENSSL} != no  !defined(RELEASE_CRUNCH)
 DPADD+= ${LIBCRYPTO}
 LDADD+= -lcrypto
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r259434 - head/usr.bin/kdump

2013-12-15 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun Dec 15 23:09:05 2013
New Revision: 259434
URL: http://svnweb.freebsd.org/changeset/base/259434

Log:
  Make use of Casper's system.pwd and system.grp services when the -r option
  is given to convert uids and gids to user names and group names even when
  running in capability mode sandbox.
  
  While here log on stderr when we successfully enter the sandbox.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.bin/kdump/Makefile
  head/usr.bin/kdump/kdump.c

Modified: head/usr.bin/kdump/Makefile
==
--- head/usr.bin/kdump/Makefile Sun Dec 15 23:05:19 2013(r259433)
+++ head/usr.bin/kdump/Makefile Sun Dec 15 23:09:05 2013(r259434)
@@ -12,6 +12,12 @@ SRCS=kdump_subr.c kdump.c ioctl.c subr
 DPSRCS=kdump_subr.h 
 CFLAGS+=   -I${.CURDIR}/../ktrace -I${.CURDIR} -I${.CURDIR}/../.. -I.
 
+.if ${MK_CASPER} != no
+DPADD+=${LIBCAPSICUM} ${LIBNV}
+LDADD+=-lcapsicum -lnv
+CFLAGS+=-DHAVE_LIBCAPSICUM
+.endif
+
 .if ${MACHINE_ARCH} == amd64 || ${MACHINE_ARCH} == i386
 SRCS+= linux_syscalls.c
 .endif

Modified: head/usr.bin/kdump/kdump.c
==
--- head/usr.bin/kdump/kdump.c  Sun Dec 15 23:05:19 2013(r259433)
+++ head/usr.bin/kdump/kdump.c  Sun Dec 15 23:09:05 2013(r259434)
@@ -74,9 +74,18 @@ extern int errno;
 #include err.h
 #include grp.h
 #include inttypes.h
+#ifdef HAVE_LIBCAPSICUM
+#include libcapsicum.h
+#include libcapsicum_grp.h
+#include libcapsicum_pwd.h
+#include libcapsicum_service.h
+#endif
 #include locale.h
 #include netdb.h
 #include nl_types.h
+#ifdef HAVE_LIBCAPSICUM
+#include nv.h
+#endif
 #include pwd.h
 #include stdio.h
 #include stdlib.h
@@ -167,6 +176,10 @@ struct proc_info
 
 TAILQ_HEAD(trace_procs, proc_info) trace_procs;
 
+#ifdef HAVE_LIBCAPSICUM
+static cap_channel_t *cappwd, *capgrp;
+#endif
+
 static void
 strerror_init(void)
 {
@@ -192,6 +205,64 @@ localtime_init(void)
(void)localtime(ltime);
 }
 
+#ifdef HAVE_LIBCAPSICUM
+static int
+cappwdgrp_setup(cap_channel_t **cappwdp, cap_channel_t **capgrpp)
+{
+   cap_channel_t *capcas, *cappwdloc, *capgrploc;
+   const char *cmds[1], *fields[1];
+
+   capcas = cap_init();
+   if (capcas == NULL) {
+   warn(unable to contact casperd);
+   return (NULL);
+   }
+   cappwdloc = cap_service_open(capcas, system.pwd);
+   capgrploc = cap_service_open(capcas, system.grp);
+   /* Casper capability no longer needed. */
+   cap_close(capcas);
+   if (cappwdloc == NULL || capgrploc == NULL) {
+   if (cappwdloc == NULL)
+   warn(unable to open system.pwd service);
+   if (capgrploc == NULL)
+   warn(unable to open system.grp service);
+   goto fail;
+   }
+   /* Limit system.pwd to only getpwuid() function and pw_name field. */
+   cmds[0] = getpwuid;
+   if (cap_pwd_limit_cmds(cappwdloc, cmds, 1)  0) {
+   warn(unable to limit access to system.pwd service);
+   goto fail;
+   }
+   fields[0] = pw_name;
+   if (cap_pwd_limit_fields(cappwdloc, fields, 1)  0) {
+   warn(unable to limit access to system.pwd service);
+   goto fail;
+   }
+   /* Limit system.grp to only getgrgid() function and gr_name field. */
+   cmds[0] = getgrgid;
+   if (cap_grp_limit_cmds(capgrploc, cmds, 1)  0) {
+   warn(unable to limit access to system.grp service);
+   goto fail;
+   }
+   fields[0] = gr_name;
+   if (cap_grp_limit_fields(capgrploc, fields, 1)  0) {
+   warn(unable to limit access to system.grp service);
+   goto fail;
+   }
+
+   *cappwdp = cappwdloc;
+   *capgrpp = capgrploc;
+   return (0);
+fail:
+   if (capgrploc == NULL)
+   cap_close(cappwdloc);
+   if (capgrploc == NULL)
+   cap_close(capgrploc);
+   return (-1);
+}
+#endif /* HAVE_LIBCAPSICUM */
+
 int
 main(int argc, char *argv[])
 {
@@ -265,14 +336,28 @@ main(int argc, char *argv[])
 
strerror_init();
localtime_init();
-
+#ifdef HAVE_LIBCAPSICUM
+   if (resolv != 0) {
+   if (cappwdgrp_setup(cappwd, capgrp)  0) {
+   cappwd = NULL;
+   capgrp = NULL;
+   }
+   }
+   if (resolv == 0 || (cappwd != NULL  capgrp != NULL)) {
+   if (cap_enter()  0  errno != ENOSYS)
+   err(1, unable to enter capability mode);
+   }
+#else
if (resolv == 0) {
if (cap_enter()  0  errno != ENOSYS)
err(1, unable to enter capability mode);
}
+#endif
limitfd(STDIN_FILENO);
limitfd(STDOUT_FILENO);
limitfd(STDERR_FILENO);
+  

svn commit: r259435 - head/sys/kern

2013-12-15 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun Dec 15 23:12:42 2013
New Revision: 259435
URL: http://svnweb.freebsd.org/changeset/base/259435

Log:
  Forgot to regenerate after r257736.

Modified:
  head/sys/kern/init_sysent.c

Modified: head/sys/kern/init_sysent.c
==
--- head/sys/kern/init_sysent.c Sun Dec 15 23:09:05 2013(r259434)
+++ head/sys/kern/init_sysent.c Sun Dec 15 23:12:42 2013(r259435)
@@ -368,7 +368,7 @@ struct sysent sysent[] = {
{ 0, (sy_call_t *)sys_sched_yield, AUE_NULL, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC },   /* 331 = sched_yield */
{ AS(sched_get_priority_max_args), (sy_call_t 
*)sys_sched_get_priority_max, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, 
SY_THR_STATIC },  /* 332 = sched_get_priority_max */
{ AS(sched_get_priority_min_args), (sy_call_t 
*)sys_sched_get_priority_min, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, 
SY_THR_STATIC },  /* 333 = sched_get_priority_min */
-   { AS(sched_rr_get_interval_args), (sy_call_t 
*)sys_sched_rr_get_interval, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 
334 = sched_rr_get_interval */
+   { AS(sched_rr_get_interval_args), (sy_call_t 
*)sys_sched_rr_get_interval, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, 
SY_THR_STATIC },/* 334 = sched_rr_get_interval */
{ AS(utrace_args), (sy_call_t *)sys_utrace, AUE_NULL, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC },  /* 335 = utrace */
{ compat4(AS(freebsd4_sendfile_args),sendfile), AUE_SENDFILE, NULL, 0, 
0, SYF_CAPENABLED, SY_THR_STATIC },  /* 336 = freebsd4 sendfile */
{ AS(kldsym_args), (sy_call_t *)sys_kldsym, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_STATIC },   /* 337 = kldsym */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r259436 - head/sys/kern

2013-12-15 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun Dec 15 23:14:27 2013
New Revision: 259436
URL: http://svnweb.freebsd.org/changeset/base/259436

Log:
  Allow for pselect(2) in capability mode.
  
  Noticed by:   David Drysdale drysd...@google.com

Modified:
  head/sys/kern/capabilities.conf

Modified: head/sys/kern/capabilities.conf
==
--- head/sys/kern/capabilities.conf Sun Dec 15 23:12:42 2013
(r259435)
+++ head/sys/kern/capabilities.conf Sun Dec 15 23:14:27 2013
(r259436)
@@ -559,10 +559,11 @@ sctp_generic_sendmsg_iov
 sctp_peeloff
 
 ##
-## Allow select(2), which will be scoped by capability rights.
+## Allow pselect(2) and select(2), which will be scoped by capability rights.
 ##
 ## XXXRW: But is it?
 ##
+pselect
 select
 
 ##
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r259437 - head/sys/kern

2013-12-15 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun Dec 15 23:15:12 2013
New Revision: 259437
URL: http://svnweb.freebsd.org/changeset/base/259437

Log:
  Regenerate after r259436.

Modified:
  head/sys/kern/init_sysent.c

Modified: head/sys/kern/init_sysent.c
==
--- head/sys/kern/init_sysent.c Sun Dec 15 23:14:27 2013(r259436)
+++ head/sys/kern/init_sysent.c Sun Dec 15 23:15:12 2013(r259437)
@@ -556,7 +556,7 @@ struct sysent sysent[] = {
{ AS(pdkill_args), (sy_call_t *)sys_pdkill, AUE_PDKILL, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC },/* 519 = pdkill */
{ AS(pdgetpid_args), (sy_call_t *)sys_pdgetpid, AUE_PDGETPID, NULL, 0, 
0, SYF_CAPENABLED, SY_THR_STATIC },  /* 520 = pdgetpid */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },  
/* 521 = pdwait4 */
-   { AS(pselect_args), (sy_call_t *)sys_pselect, AUE_SELECT, NULL, 0, 0, 
0, SY_THR_STATIC },   /* 522 = pselect */
+   { AS(pselect_args), (sy_call_t *)sys_pselect, AUE_SELECT, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC },  /* 522 = pselect */
{ AS(getloginclass_args), (sy_call_t *)sys_getloginclass, AUE_NULL, 
NULL, 0, 0, 0, SY_THR_STATIC }, /* 523 = getloginclass */
{ AS(setloginclass_args), (sy_call_t *)sys_setloginclass, AUE_NULL, 
NULL, 0, 0, 0, SY_THR_STATIC }, /* 524 = setloginclass */
{ AS(rctl_get_racct_args), (sy_call_t *)sys_rctl_get_racct, AUE_NULL, 
NULL, 0, 0, 0, SY_THR_STATIC },   /* 525 = rctl_get_racct */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r259438 - head/sys/kern

2013-12-15 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun Dec 15 23:19:42 2013
New Revision: 259438
URL: http://svnweb.freebsd.org/changeset/base/259438

Log:
  Fix syscalls that can be loaded as kernel modules - they were not given
  the flag allowing to call them from capability mode sandbox.
  
  Noticed by:   David Drysdale drysd...@google.com

Modified:
  head/sys/kern/makesyscalls.sh

Modified: head/sys/kern/makesyscalls.sh
==
--- head/sys/kern/makesyscalls.sh   Sun Dec 15 23:15:12 2013
(r259437)
+++ head/sys/kern/makesyscalls.sh   Sun Dec 15 23:19:42 2013
(r259438)
@@ -460,7 +460,7 @@ s/\$//g
printf(\t{ %s, (sy_call_t *), argssize)  sysent
column = 8 + 2 + length(argssize) + 15
if (flag(NOSTD)) {
-   printf(%s },, lkmressys, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_ABSENT)  sysent
+   printf(lkmressys, AUE_NULL, NULL, 0, 0, %s, 
SY_THR_ABSENT },, flags)  sysent
column = column + length(lkmressys) + 
length(AUE_NULL) + 3
} else {
if (funcname == nosys || funcname == sysarch || 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r259439 - head/sys/kern

2013-12-15 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun Dec 15 23:20:26 2013
New Revision: 259439
URL: http://svnweb.freebsd.org/changeset/base/259439

Log:
  Regenerate after r259438.

Modified:
  head/sys/kern/init_sysent.c

Modified: head/sys/kern/init_sysent.c
==
--- head/sys/kern/init_sysent.c Sun Dec 15 23:19:42 2013(r259438)
+++ head/sys/kern/init_sysent.c Sun Dec 15 23:20:26 2013(r259439)
@@ -289,9 +289,9 @@ struct sysent sysent[] = {
{ AS(openbsd_poll_args), (sy_call_t *)sys_openbsd_poll, AUE_POLL, NULL, 
0, 0, SYF_CAPENABLED, SY_THR_STATIC },  /* 252 = openbsd_poll */
{ 0, (sy_call_t *)sys_issetugid, AUE_ISSETUGID, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC },/* 253 = issetugid */
{ AS(lchown_args), (sy_call_t *)sys_lchown, AUE_LCHOWN, NULL, 0, 0, 0, 
SY_THR_STATIC }, /* 254 = lchown */
-   { AS(aio_read_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_ABSENT },  /* 255 = aio_read */
-   { AS(aio_write_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_ABSENT }, /* 256 = aio_write */
-   { AS(lio_listio_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_ABSENT },/* 257 = lio_listio */
+   { AS(aio_read_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_ABSENT }, /* 255 = aio_read */
+   { AS(aio_write_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_ABSENT },/* 256 = aio_write */
+   { AS(lio_listio_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_ABSENT },   /* 257 = lio_listio */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },  
/* 258 = nosys */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },  
/* 259 = nosys */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },  
/* 260 = nosys */
@@ -348,13 +348,13 @@ struct sysent sysent[] = {
{ AS(setresuid_args), (sy_call_t *)sys_setresuid, AUE_SETRESUID, NULL, 
0, 0, SYF_CAPENABLED, SY_THR_STATIC },   /* 311 = setresuid */
{ AS(setresgid_args), (sy_call_t *)sys_setresgid, AUE_SETRESGID, NULL, 
0, 0, SYF_CAPENABLED, SY_THR_STATIC },   /* 312 = setresgid */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },  
/* 313 = obsolete signanosleep */
-   { AS(aio_return_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_ABSENT },/* 314 = aio_return */
-   { AS(aio_suspend_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 
0, SY_THR_ABSENT },   /* 315 = aio_suspend */
-   { AS(aio_cancel_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_ABSENT },/* 316 = aio_cancel */
-   { AS(aio_error_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_ABSENT }, /* 317 = aio_error */
-   { AS(oaio_read_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_ABSENT }, /* 318 = oaio_read */
-   { AS(oaio_write_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_ABSENT },/* 319 = oaio_write */
-   { AS(olio_listio_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 
0, SY_THR_ABSENT },   /* 320 = olio_listio */
+   { AS(aio_return_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_ABSENT },   /* 314 = aio_return */
+   { AS(aio_suspend_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_ABSENT },  /* 315 = aio_suspend */
+   { AS(aio_cancel_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_ABSENT },   /* 316 = aio_cancel */
+   { AS(aio_error_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_ABSENT },/* 317 = aio_error */
+   { AS(oaio_read_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_ABSENT },/* 318 = oaio_read */
+   { AS(oaio_write_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_ABSENT },   /* 319 = oaio_write */
+   { AS(olio_listio_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_ABSENT },  /* 320 = olio_listio */
{ 0, (sy_call_t *)sys_yield, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, 
SY_THR_STATIC }, /* 321 = yield */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },  
/* 322 = obsolete thr_sleep */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },  
/* 323 = obsolete thr_wakeup */
@@ -393,7 +393,7 @@ struct sysent sysent[] = {
{ AS(extattr_set_file_args), (sy_call_t *)sys_extattr_set_file, 
AUE_EXTATTR_SET_FILE, NULL, 0, 0, 0, SY_THR_STATIC },   /* 356 = 
extattr_set_file */
{ AS(extattr_get_file_args), (sy_call_t *)sys_extattr_get_file, 
AUE_EXTATTR_GET_FILE, NULL, 0, 0, 0, 

svn commit: r259440 - head/usr.bin/kdump

2013-12-15 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun Dec 15 23:49:42 2013
New Revision: 259440
URL: http://svnweb.freebsd.org/changeset/base/259440

Log:
  Include bsd.own.mk for MK_CASPER to work.
  
  Reported by:  nwhitehorn

Modified:
  head/usr.bin/kdump/Makefile

Modified: head/usr.bin/kdump/Makefile
==
--- head/usr.bin/kdump/Makefile Sun Dec 15 23:20:26 2013(r259439)
+++ head/usr.bin/kdump/Makefile Sun Dec 15 23:49:42 2013(r259440)
@@ -1,6 +1,8 @@
 #  @(#)Makefile8.1 (Berkeley) 6/6/93
 # $FreeBSD$
 
+.include bsd.own.mk
+
 .if (${MACHINE_ARCH} == amd64)
 SFX=   32
 .endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r259441 - head/sys/kern

2013-12-15 Thread Marcel Moolenaar
Author: marcel
Date: Mon Dec 16 00:50:14 2013
New Revision: 259441
URL: http://svnweb.freebsd.org/changeset/base/259441

Log:
  Properly drain the TTY when both revoke(2) and close(2) end up closing
  the TTY. In such a case, ttydev_close() is called multiple times and
  each time, t_revokecnt is incremented and cv_broadcast() is called for
  both the t_outwait and t_inwait condition variables.
  Let's say revoke(2) comes in first and gets to call tty_drain() from
  ttydev_leave(). Let's say that the revoke comes from init(8) as the
  result of running shutdown -r now. Since shutdown prints various
  messages to the console before announing that the machine will reboot
  immediately, let's also say that the output queue is not empty and
  that tty_drain() has something to do. Let's assume this all happens
  on a 9600 baud serial console, so it takes a time to drain.
  The shutdown command will exit(2) and as such will end up closing
  stdout. Let's say this close will come in second, bump t_revokecnt
  and call tty_wakeup(). This has tty_wait() return prematurely and
  the next thing that will happen is that the thread doing revoke(2)
  will flush the TTY. Since the drain wasn't complete, the flush will
  effectively drop whatever is left in t_outq.
  
  This change takes into account that tty_drain() will return ERESTART
  due to the fact that t_revokecnt was bumped and in that case simply
  call tty_drain() again. The thread in question is already performing
  the close so it can safely finish draining the TTY before destroying
  the TTY structure.
  
  Now all messages from shutdown will be printed on the serial console.
  
  Obtained from:Juniper Networks, Inc.

Modified:
  head/sys/kern/tty.c

Modified: head/sys/kern/tty.c
==
--- head/sys/kern/tty.c Sun Dec 15 23:49:42 2013(r259440)
+++ head/sys/kern/tty.c Mon Dec 16 00:50:14 2013(r259441)
@@ -191,8 +191,10 @@ ttydev_leave(struct tty *tp)
 
/* Drain any output. */
MPASS((tp-t_flags  TF_STOPPED) == 0);
-   if (!tty_gone(tp))
-   tty_drain(tp);
+   if (!tty_gone(tp)) {
+   while (tty_drain(tp) == ERESTART)
+   ;
+   }
 
ttydisc_close(tp);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r259446 - head/contrib/tzcode/stdtime

2013-12-15 Thread Benjamin Kaduk
Author: bjk (doc committer)
Date: Mon Dec 16 01:58:12 2013
New Revision: 259446
URL: http://svnweb.freebsd.org/changeset/base/259446

Log:
  tzfile.5: catch up to r204333
  
  The stdtime sources were moved from lib/libc to contrib/tzcode, and tzfile.h
  is not an installed header, so the man page refers to its location in the
  source tree.
  
  The documentation could be more clear about the internal nature of the
  header, but those changes should go through upstream tzcode.
  
  PR:   docs/176864
  Approved by:  hrs (mentor)

Modified:
  head/contrib/tzcode/stdtime/tzfile.5

Modified: head/contrib/tzcode/stdtime/tzfile.5
==
--- head/contrib/tzcode/stdtime/tzfile.5Mon Dec 16 01:47:52 2013
(r259445)
+++ head/contrib/tzcode/stdtime/tzfile.5Mon Dec 16 01:58:12 2013
(r259446)
@@ -6,7 +6,7 @@
 .Nm tzfile
 .Nd timezone information
 .Sh SYNOPSIS
-.Fd #include \/usr/src/lib/libc/stdtime/tzfile.h\
+.Fd #include \/usr/src/contrib/tzcode/stdtime/tzfile.h\
 .Sh DESCRIPTION
 The time zone information files used by
 .Xr tzset 3
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org