CVS commit: src/sys/arch/amd64/conf

2016-06-13 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jun 14 03:34:01 UTC 2016

Modified Files:
src/sys/arch/amd64/conf: GENERIC

Log Message:
Re-arrange PAX_ASLR options to keep the _DEBUG next to the main option.


To generate a diff of this commit:
cvs rdiff -u -r1.433 -r1.434 src/sys/arch/amd64/conf/GENERIC

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.433 src/sys/arch/amd64/conf/GENERIC:1.434
--- src/sys/arch/amd64/conf/GENERIC:1.433	Sat May 14 17:11:30 2016
+++ src/sys/arch/amd64/conf/GENERIC	Tue Jun 14 03:34:01 2016
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.433 2016/05/14 17:11:30 christos Exp $
+# $NetBSD: GENERIC,v 1.434 2016/06/14 03:34:01 pgoyette Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.433 $"
+#ident 		"GENERIC-$Revision: 1.434 $"
 
 maxusers	64		# estimated number of users
 
@@ -1317,8 +1317,8 @@ options VERIFIED_EXEC_FP_SHA512
 options VERIFIED_EXEC_FP_SHA1
 options VERIFIED_EXEC_FP_MD5
 
-options 	PAX_ASLR_DEBUG=1	# PaX ASLR debug
 options 	PAX_SEGVGUARD=0		# PaX Segmentation fault guard
 options 	PAX_MPROTECT=1		# PaX mprotect(2) restrictions
 options 	PAX_MPROTECT_DEBUG=1	# PaX mprotect debug
 options 	PAX_ASLR=1		# PaX Address Space Layout Randomization
+options 	PAX_ASLR_DEBUG=1	# PaX ASLR debug



CVS commit: src/sys/arch/i386/i386

2016-06-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jun 14 03:05:25 UTC 2016

Modified Files:
src/sys/arch/i386/i386: cpu_in_cksum.S

Log Message:
fix PIC code.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/i386/cpu_in_cksum.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/i386/cpu_in_cksum.S
diff -u src/sys/arch/i386/i386/cpu_in_cksum.S:1.5 src/sys/arch/i386/i386/cpu_in_cksum.S:1.6
--- src/sys/arch/i386/i386/cpu_in_cksum.S:1.5	Mon May 30 18:58:52 2016
+++ src/sys/arch/i386/i386/cpu_in_cksum.S	Mon Jun 13 23:05:24 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_in_cksum.S,v 1.5 2016/05/30 22:58:52 christos Exp $	*/
+/*	$NetBSD: cpu_in_cksum.S,v 1.6 2016/06/14 03:05:24 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum.S,v 1.5 2016/05/30 22:58:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum.S,v 1.6 2016/06/14 03:05:24 christos Exp $");
 
 #include "assym.h"
 
@@ -329,9 +329,21 @@ ENTRY(cpu_in_cksum)
 	ret
 
 .Lout_of_mbufs:
-	pushl	$1f
+#ifdef __PIC__
+	PIC_PROLOGUE
+	leal	PIC_GOTOFF(.Mout_of_mbufs_msg), %eax
+	pushl	%eax
 	call	PIC_PLT(_C_LABEL(printf))
 	leal	4(%esp), %esp
+	PIC_EPILOGUE
+#else
+	pushl	.Mout_of_mbufs_msg
+	call	_C_LABEL(printf)
+	leal	4(%esp), %esp
+#endif
 	jmp	.Lreturn
-1:
+
+	.section.rodata
+	.type   .Mout_of_mbufs_msg, @object
+.Mout_of_mbufs_msg:
 	.asciz	"cksum: out of data\n"



CVS commit: src

2016-06-13 Thread Ryo ONODERA
Module Name:src
Committed By:   ryoon
Date:   Mon Jun 13 20:03:07 UTC 2016

Modified Files:
src/external/mit/xorg/lib/libX11: Makefile.ximcp
src/sys/modules/ipl: Makefile

Log Message:
Fix buld with clang, add warning option exceptions


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/mit/xorg/lib/libX11/Makefile.ximcp
cvs rdiff -u -r1.1 -r1.2 src/sys/modules/ipl/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/xorg/lib/libX11/Makefile.ximcp
diff -u src/external/mit/xorg/lib/libX11/Makefile.ximcp:1.3 src/external/mit/xorg/lib/libX11/Makefile.ximcp:1.4
--- src/external/mit/xorg/lib/libX11/Makefile.ximcp:1.3	Thu Jun  2 22:41:26 2016
+++ src/external/mit/xorg/lib/libX11/Makefile.ximcp	Mon Jun 13 20:03:07 2016
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.ximcp,v 1.3 2016/06/02 22:41:26 mrg Exp $
+# $NetBSD: Makefile.ximcp,v 1.4 2016/06/13 20:03:07 ryoon Exp $
 
 .PATH:	${X11SRCDIR.X11}/modules/im/ximcp
 SRCS.ximcp= \
@@ -43,3 +43,4 @@ CPPFLAGS.imDefLkup.c=	-Wno-error
 CPPFLAGS.imRm.c=	-Wno-error
 CPPFLAGS.imTrans.c=	-Wno-error
 CPPFLAGS.imLcLkup.c=	-Wno-stack-protector
+CPPFLAGS.imInsClbk.c=	-Wno-unused-value

Index: src/sys/modules/ipl/Makefile
diff -u src/sys/modules/ipl/Makefile:1.1 src/sys/modules/ipl/Makefile:1.2
--- src/sys/modules/ipl/Makefile:1.1	Thu Jun  9 04:44:19 2016
+++ src/sys/modules/ipl/Makefile	Mon Jun 13 20:03:07 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1 2016/06/09 04:44:19 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.2 2016/06/13 20:03:07 ryoon Exp $
 #
 
 .include "../Makefile.inc"
@@ -54,4 +54,6 @@ SRCS+=	ip_sync.c
 SRCS+=	ip_fil_compat.c
 SRCS+=	radix_ipf.c
 
+CWARNFLAGS.clang+=	-Wno-self-assign
+
 .include 



CVS commit: src/usr.bin/ul

2016-06-13 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Mon Jun 13 14:58:57 UTC 2016

Modified Files:
src/usr.bin/ul: ul.c

Log Message:
Make the function static in the definition (prototype was already declared 
static).
Missed in my last commit.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/ul/ul.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/ul/ul.c
diff -u src/usr.bin/ul/ul.c:1.17 src/usr.bin/ul/ul.c:1.18
--- src/usr.bin/ul/ul.c:1.17	Sun Jun 12 13:29:29 2016
+++ src/usr.bin/ul/ul.c	Mon Jun 13 14:58:57 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ul.c,v 1.17 2016/06/12 13:29:29 abhinav Exp $	*/
+/*	$NetBSD: ul.c,v 1.18 2016/06/13 14:58:57 abhinav Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)ul.c	8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: ul.c,v 1.17 2016/06/12 13:29:29 abhinav Exp $");
+__RCSID("$NetBSD: ul.c,v 1.18 2016/06/13 14:58:57 abhinav Exp $");
 #endif /* not lint */
 
 #include 
@@ -507,7 +507,7 @@ setulmode(int newmode)
  * Reallocates the buffer pointed to by *buf and sets
  * the newly allocated set of bytes to 0.
  */
-void
+static void
 alloc_buf(struct CHAR **buf, size_t *size)
 {
 size_t osize = *size;



CVS commit: src/sys/nfs

2016-06-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 13 14:23:26 UTC 2016

Modified Files:
src/sys/nfs: nfs_clntsocket.c

Log Message:
Simplify, no functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/nfs/nfs_clntsocket.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/nfs/nfs_clntsocket.c
diff -u src/sys/nfs/nfs_clntsocket.c:1.3 src/sys/nfs/nfs_clntsocket.c:1.4
--- src/sys/nfs/nfs_clntsocket.c:1.3	Tue Jul 14 23:28:55 2015
+++ src/sys/nfs/nfs_clntsocket.c	Mon Jun 13 10:23:26 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_clntsocket.c,v 1.3 2015/07/15 03:28:55 manu Exp $	*/
+/*	$NetBSD: nfs_clntsocket.c,v 1.4 2016/06/13 14:23:26 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1991, 1993, 1995
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nfs_clntsocket.c,v 1.3 2015/07/15 03:28:55 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_clntsocket.c,v 1.4 2016/06/13 14:23:26 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_nfs.h"
@@ -403,67 +403,69 @@ nfsmout:
 		 * Iff no match, just drop the datagram
 		 */
 		TAILQ_FOREACH(rep, _reqq, r_chain) {
-			if (rep->r_mrep == NULL && rxid == rep->r_xid) {
-/* Found it.. */
-rep->r_mrep = mrep;
-rep->r_md = md;
-rep->r_dpos = dpos;
-if (nfsrtton) {
-	struct rttl *rt;
-
-	rt = [nfsrtt.pos];
-	rt->proc = rep->r_procnum;
-	rt->rto = NFS_RTO(nmp, nfs_proct[rep->r_procnum]);
-	rt->sent = nmp->nm_sent;
-	rt->cwnd = nmp->nm_cwnd;
-	rt->srtt = nmp->nm_srtt[nfs_proct[rep->r_procnum] - 1];
-	rt->sdrtt = nmp->nm_sdrtt[nfs_proct[rep->r_procnum] - 1];
-	rt->fsid = nmp->nm_mountp->mnt_stat.f_fsidx;
-	getmicrotime(>tstamp);
-	if (rep->r_flags & R_TIMING)
-		rt->rtt = rep->r_rtt;
-	else
-		rt->rtt = 100;
-	nfsrtt.pos = (nfsrtt.pos + 1) % NFSRTTLOGSIZ;
-}
-/*
- * Update congestion window.
- * Do the additive increase of
- * one rpc/rtt.
- */
-if (nmp->nm_cwnd <= nmp->nm_sent) {
-	nmp->nm_cwnd +=
-	   (NFS_CWNDSCALE * NFS_CWNDSCALE +
-	   (nmp->nm_cwnd >> 1)) / nmp->nm_cwnd;
-	if (nmp->nm_cwnd > NFS_MAXCWND)
-		nmp->nm_cwnd = NFS_MAXCWND;
-}
-rep->r_flags &= ~R_SENT;
-nmp->nm_sent -= NFS_CWNDSCALE;
+			if (rep->r_mrep != NULL || rxid != rep->r_xid)
+continue;
+
+			/* Found it.. */
+			rep->r_mrep = mrep;
+			rep->r_md = md;
+			rep->r_dpos = dpos;
+			if (nfsrtton) {
+struct rttl *rt;
+int proct = nfs_proct[rep->r_procnum];
+
+rt = [nfsrtt.pos];
+rt->proc = rep->r_procnum;
+rt->rto = NFS_RTO(nmp, proct);
+rt->sent = nmp->nm_sent;
+rt->cwnd = nmp->nm_cwnd;
+rt->srtt = nmp->nm_srtt[proct - 1];
+rt->sdrtt = nmp->nm_sdrtt[proct - 1];
+rt->fsid = nmp->nm_mountp->mnt_stat.f_fsidx;
+getmicrotime(>tstamp);
+if (rep->r_flags & R_TIMING)
+	rt->rtt = rep->r_rtt;
+else
+	rt->rtt = 100;
+nfsrtt.pos = (nfsrtt.pos + 1) % NFSRTTLOGSIZ;
+			}
+			/*
+			 * Update congestion window.
+			 * Do the additive increase of
+			 * one rpc/rtt.
+			 */
+			if (nmp->nm_cwnd <= nmp->nm_sent) {
+nmp->nm_cwnd +=
+   (NFS_CWNDSCALE * NFS_CWNDSCALE +
+   (nmp->nm_cwnd >> 1)) / nmp->nm_cwnd;
+if (nmp->nm_cwnd > NFS_MAXCWND)
+	nmp->nm_cwnd = NFS_MAXCWND;
+			}
+			rep->r_flags &= ~R_SENT;
+			nmp->nm_sent -= NFS_CWNDSCALE;
+			/*
+			 * Update rtt using a gain of 0.125 on the mean
+			 * and a gain of 0.25 on the deviation.
+			 */
+			if (rep->r_flags & R_TIMING) {
 /*
- * Update rtt using a gain of 0.125 on the mean
- * and a gain of 0.25 on the deviation.
+ * Since the timer resolution of
+ * NFS_HZ is so course, it can often
+ * result in r_rtt == 0. Since
+ * r_rtt == N means that the actual
+ * rtt is between N+dt and N+2-dt ticks,
+ * add 1.
  */
-if (rep->r_flags & R_TIMING) {
-	/*
-	 * Since the timer resolution of
-	 * NFS_HZ is so course, it can often
-	 * result in r_rtt == 0. Since
-	 * r_rtt == N means that the actual
-	 * rtt is between N+dt and N+2-dt ticks,
-	 * add 1.
-	 */
-	t1 = rep->r_rtt + 1;
-	t1 -= (NFS_SRTT(rep) >> 3);
-	NFS_SRTT(rep) += t1;
-	if (t1 < 0)
-		t1 = -t1;
-	t1 -= (NFS_SDRTT(rep) >> 2);
-	NFS_SDRTT(rep) += t1;
-}
-nmp->nm_timeouts = 0;
-break;
+t1 = rep->r_rtt + 1;
+t1 -= (NFS_SRTT(rep) >> 3);
+NFS_SRTT(rep) += t1;
+if (t1 < 0)
+	t1 = -t1;
+t1 -= (NFS_SDRTT(rep) >> 2);
+NFS_SDRTT(rep) += t1;
 			}
+			nmp->nm_timeouts = 0;
+			break;
 		}
 		nfs_rcvunlock(nmp);
 		/*



CVS commit: src/sys

2016-06-13 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Jun 13 08:37:15 UTC 2016

Modified Files:
src/sys/netinet: ip_flow.c
src/sys/netinet6: ip6_flow.c

Log Message:
eliminate unnecessary splnet


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/netinet/ip_flow.c
cvs rdiff -u -r1.25 -r1.26 src/sys/netinet6/ip6_flow.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet/ip_flow.c
diff -u src/sys/netinet/ip_flow.c:1.70 src/sys/netinet/ip_flow.c:1.71
--- src/sys/netinet/ip_flow.c:1.70	Mon Jun 13 08:34:23 2016
+++ src/sys/netinet/ip_flow.c	Mon Jun 13 08:37:15 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_flow.c,v 1.70 2016/06/13 08:34:23 knakahara Exp $	*/
+/*	$NetBSD: ip_flow.c,v 1.71 2016/06/13 08:37:15 knakahara Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_flow.c,v 1.70 2016/06/13 08:34:23 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_flow.c,v 1.71 2016/06/13 08:37:15 knakahara Exp $");
 
 #include 
 #include 
@@ -357,7 +357,6 @@ ipflow_addstats(struct ipflow *ipf)
 static void
 ipflow_free(struct ipflow *ipf)
 {
-	int s;
 
 	KASSERT(mutex_owned(_lock));
 
@@ -366,9 +365,8 @@ ipflow_free(struct ipflow *ipf)
 	 * Once it's off the list, we can deal with it at normal
 	 * network IPL.
 	 */
-	s = splnet();
 	IPFLOW_REMOVE(ipf);
-	splx(s);
+
 	ipflow_addstats(ipf);
 	rtcache_free(>ipf_ro);
 	ipflow_inuse--;
@@ -383,7 +381,6 @@ ipflow_reap(bool just_one)
 
 	while (just_one || ipflow_inuse > ip_maxflows) {
 		struct ipflow *ipf, *maybe_ipf = NULL;
-		int s;
 
 		ipf = LIST_FIRST();
 		while (ipf != NULL) {
@@ -412,9 +409,8 @@ ipflow_reap(bool just_one)
 		/*
 		 * Remove the entry from the flow table.
 		 */
-		s = splnet();
 		IPFLOW_REMOVE(ipf);
-		splx(s);
+
 		ipflow_addstats(ipf);
 		rtcache_free(>ipf_ro);
 		if (just_one)
@@ -462,7 +458,6 @@ ipflow_create(const struct route *ro, st
 	const struct ip *const ip = mtod(m, const struct ip *);
 	struct ipflow *ipf;
 	size_t hash;
-	int s;
 
 	mutex_enter(_lock);
 
@@ -493,9 +488,8 @@ ipflow_create(const struct route *ro, st
 		}
 		memset(ipf, 0, sizeof(*ipf));
 	} else {
-		s = splnet();
 		IPFLOW_REMOVE(ipf);
-		splx(s);
+
 		ipflow_addstats(ipf);
 		rtcache_free(>ipf_ro);
 		ipf->ipf_uses = ipf->ipf_last_uses = 0;
@@ -515,9 +509,7 @@ ipflow_create(const struct route *ro, st
 	 * Insert into the approriate bucket of the flow table.
 	 */
 	hash = ipflow_hash(ip);
-	s = splnet();
 	IPFLOW_INSERT([hash], ipf);
-	splx(s);
 
  out:
 	KERNEL_UNLOCK_ONE(NULL);
@@ -528,13 +520,12 @@ int
 ipflow_invalidate_all(int new_size)
 {
 	struct ipflow *ipf, *next_ipf;
-	int s, error;
+	int error;
 
 	error = 0;
 
 	mutex_enter(_lock);
 
-	s = splnet();
 	for (ipf = LIST_FIRST(); ipf != NULL; ipf = next_ipf) {
 		next_ipf = LIST_NEXT(ipf, ipf_list);
 		ipflow_free(ipf);
@@ -542,7 +533,6 @@ ipflow_invalidate_all(int new_size)
 
 	if (new_size)
 		error = ipflow_reinit(new_size);
-	splx(s);
 
 	mutex_exit(_lock);
 

Index: src/sys/netinet6/ip6_flow.c
diff -u src/sys/netinet6/ip6_flow.c:1.25 src/sys/netinet6/ip6_flow.c:1.26
--- src/sys/netinet6/ip6_flow.c:1.25	Mon Jun 13 08:34:23 2016
+++ src/sys/netinet6/ip6_flow.c	Mon Jun 13 08:37:15 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_flow.c,v 1.25 2016/06/13 08:34:23 knakahara Exp $	*/
+/*	$NetBSD: ip6_flow.c,v 1.26 2016/06/13 08:37:15 knakahara Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip6_flow.c,v 1.25 2016/06/13 08:34:23 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_flow.c,v 1.26 2016/06/13 08:37:15 knakahara Exp $");
 
 #include 
 #include 
@@ -377,7 +377,6 @@ ip6flow_addstats(const struct ip6flow *i
 static void
 ip6flow_free(struct ip6flow *ip6f)
 {
-	int s;
 
 	KASSERT(mutex_owned(_lock));
 
@@ -386,9 +385,8 @@ ip6flow_free(struct ip6flow *ip6f)
 	 * Once it's off the list, we can deal with it at normal
 	 * network IPL.
 	 */
-	s = splnet();
 	IP6FLOW_REMOVE(ip6f);
-	splx(s);
+
 	ip6flow_inuse--;
 	ip6flow_addstats(ip6f);
 	rtcache_free(>ip6f_ro);
@@ -403,7 +401,6 @@ ip6flow_reap_locked(int just_one)
 
 	while (just_one || ip6flow_inuse > ip6_maxflows) {
 		struct ip6flow *ip6f, *maybe_ip6f = NULL;
-		int s;
 
 		ip6f = LIST_FIRST();
 		while (ip6f != NULL) {
@@ -432,9 +429,8 @@ ip6flow_reap_locked(int just_one)
 		/*
 		 * Remove the entry from the flow table
 		 */
-		s = splnet();
 		IP6FLOW_REMOVE(ip6f);
-		splx(s);
+
 		rtcache_free(>ip6f_ro);
 		if (just_one) {
 			ip6flow_addstats(ip6f);
@@ -500,7 +496,6 @@ ip6flow_create(const struct route *ro, s
 	const struct ip6_hdr *ip6;
 	struct ip6flow *ip6f;
 	size_t hash;
-	int s;
 
 	mutex_enter(_lock);
 
@@ -542,9 +537,8 @@ ip6flow_create(const struct route *ro, s
 		}
 		memset(ip6f, 0, sizeof(*ip6f));
 	} else {
-		s = splnet();
 		IP6FLOW_REMOVE(ip6f);

CVS commit: src/sys

2016-06-13 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Jun 13 08:34:23 UTC 2016

Modified Files:
src/sys/netinet: ip_flow.c
src/sys/netinet6: ip6_flow.c

Log Message:
MP-ify fastforward to support GATEWAY kernel option.

I add "ipflow_lock" mutex in ip_flow.c and "ip6flow_lock" mutex in ip6_flow.c
to protect all data in each file. Of course, this is not MP-scalable. However,
it is sufficient as tentative workaround. We should make it scalable somehow
in the future.

ok by ozaki-r@n.o.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/netinet/ip_flow.c
cvs rdiff -u -r1.24 -r1.25 src/sys/netinet6/ip6_flow.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet/ip_flow.c
diff -u src/sys/netinet/ip_flow.c:1.69 src/sys/netinet/ip_flow.c:1.70
--- src/sys/netinet/ip_flow.c:1.69	Mon Jun 13 08:29:55 2016
+++ src/sys/netinet/ip_flow.c	Mon Jun 13 08:34:23 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_flow.c,v 1.69 2016/06/13 08:29:55 knakahara Exp $	*/
+/*	$NetBSD: ip_flow.c,v 1.70 2016/06/13 08:34:23 knakahara Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_flow.c,v 1.69 2016/06/13 08:29:55 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_flow.c,v 1.70 2016/06/13 08:34:23 knakahara Exp $");
 
 #include 
 #include 
@@ -72,6 +72,14 @@ LIST_HEAD(ipflowhead, ipflow);
 #define	IPFLOW_TIMER		(5 * PR_SLOWHZ)
 #define	IPFLOW_DEFAULT_HASHSIZE	(1 << IPFLOW_HASHBITS)
 
+/*
+ * ip_flow.c internal lock.
+ * If we use softnet_lock, it would cause recursive lock.
+ *
+ * This is a tentative workaround.
+ * We should make it scalable somehow in the future.
+ */
+static kmutex_t ipflow_lock;
 static struct ipflowhead *ipflowtable = NULL;
 static struct ipflowhead ipflowlist;
 static int ipflow_inuse;
@@ -117,6 +125,8 @@ ipflow_lookup(const struct ip *ip)
 	size_t hash;
 	struct ipflow *ipf;
 
+	KASSERT(mutex_owned(_lock));
+
 	hash = ipflow_hash(ip);
 
 	LIST_FOREACH(ipf, [hash], ipf_hash) {
@@ -142,6 +152,8 @@ ipflow_reinit(int table_size)
 	struct ipflowhead *new_table;
 	size_t i;
 
+	KASSERT(mutex_owned(_lock));
+
 	new_table = (struct ipflowhead *)malloc(sizeof(struct ipflowhead) *
 	table_size, M_RTABLE, M_NOWAIT);
 
@@ -164,7 +176,12 @@ ipflow_reinit(int table_size)
 void
 ipflow_init(void)
 {
+
+	mutex_init(_lock, MUTEX_DEFAULT, IPL_NONE);
+
+	mutex_enter(_lock);
 	(void)ipflow_reinit(ip_hashsize);
+	mutex_exit(_lock);
 	ipflow_sysctl_init(NULL);
 }
 
@@ -180,19 +197,21 @@ ipflow_fastforward(struct mbuf *m)
 	int iplen;
 	struct ifnet *ifp;
 	int s;
+	int ret = 0;
 
+	mutex_enter(_lock);
 	/*
 	 * Are we forwarding packets?  Big enough for an IP packet?
 	 */
 	if (!ipforwarding || ipflow_inuse == 0 || m->m_len < sizeof(struct ip))
-		return 0;
+		goto out;
 
 	/*
 	 * Was packet received as a link-level multicast or broadcast?
 	 * If so, don't try to fast forward..
 	 */
 	if ((m->m_flags & (M_BCAST|M_MCAST)) != 0)
-		return 0;
+		goto out;
 
 	/*
 	 * IP header with no option and valid version and length
@@ -206,12 +225,12 @@ ipflow_fastforward(struct mbuf *m)
 	iplen = ntohs(ip->ip_len);
 	if (ip->ip_v != IPVERSION || ip->ip_hl != (sizeof(struct ip) >> 2) ||
 	iplen < sizeof(struct ip) || iplen > m->m_pkthdr.len)
-		return 0;
+		goto out;
 	/*
 	 * Find a flow.
 	 */
 	if ((ipf = ipflow_lookup(ip)) == NULL)
-		return 0;
+		goto out;
 
 	ifp = m_get_rcvif(m, );
 	/*
@@ -222,7 +241,7 @@ ipflow_fastforward(struct mbuf *m)
 		 M_CSUM_IPv4_BAD)) {
 	case M_CSUM_IPv4|M_CSUM_IPv4_BAD:
 		m_put_rcvif(ifp, );
-		return 0;
+		goto out;
 
 	case M_CSUM_IPv4:
 		/* Checksum was okay. */
@@ -232,7 +251,7 @@ ipflow_fastforward(struct mbuf *m)
 		/* Must compute it ourselves. */
 		if (in_cksum(m, sizeof(struct ip)) != 0) {
 			m_put_rcvif(ifp, );
-			return 0;
+			goto out;
 		}
 		break;
 	}
@@ -244,13 +263,13 @@ ipflow_fastforward(struct mbuf *m)
 	if ((rt = rtcache_validate(>ipf_ro)) == NULL ||
 	(rt->rt_ifp->if_flags & IFF_UP) == 0 ||
 	(rt->rt_flags & (RTF_BLACKHOLE | RTF_BROADCAST)) != 0)
-		return 0;
+		goto out;
 
 	/*
 	 * Packet size OK?  TTL?
 	 */
 	if (m->m_pkthdr.len > rt->rt_ifp->if_mtu || ip->ip_ttl <= IPTTLDEC)
-		return 0;
+		goto out;
 
 	/*
 	 * Clear any in-bound checksum flags for this packet.
@@ -312,7 +331,10 @@ ipflow_fastforward(struct mbuf *m)
 			ipf->ipf_errors++;
 	}
 	KERNEL_UNLOCK_ONE(NULL);
-	return 1;
+	ret = 1;
+ out:
+	mutex_exit(_lock);
+	return ret;
 }
 
 static void
@@ -336,6 +358,9 @@ static void
 ipflow_free(struct ipflow *ipf)
 {
 	int s;
+
+	KASSERT(mutex_owned(_lock));
+
 	/*
 	 * Remove the flow from the hash table (at elevated IPL).
 	 * Once it's off the list, we can deal with it at normal
@@ -353,6 +378,9 @@ ipflow_free(struct ipflow *ipf)
 static struct ipflow *
 ipflow_reap(bool just_one)
 {
+
+	KASSERT(mutex_owned(_lock));
+
 	while (just_one 

CVS commit: src/sys/netinet

2016-06-13 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Jun 13 08:29:55 UTC 2016

Modified Files:
src/sys/netinet: ip_flow.c ip_var.h

Log Message:
make ipflow_reap() static function.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/netinet/ip_flow.c
cvs rdiff -u -r1.112 -r1.113 src/sys/netinet/ip_var.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet/ip_flow.c
diff -u src/sys/netinet/ip_flow.c:1.68 src/sys/netinet/ip_flow.c:1.69
--- src/sys/netinet/ip_flow.c:1.68	Mon Jun 13 08:04:44 2016
+++ src/sys/netinet/ip_flow.c	Mon Jun 13 08:29:55 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_flow.c,v 1.68 2016/06/13 08:04:44 knakahara Exp $	*/
+/*	$NetBSD: ip_flow.c,v 1.69 2016/06/13 08:29:55 knakahara Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_flow.c,v 1.68 2016/06/13 08:04:44 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_flow.c,v 1.69 2016/06/13 08:29:55 knakahara Exp $");
 
 #include 
 #include 
@@ -94,6 +94,7 @@ do { \
 static int ip_maxflows = IPFLOW_MAX;
 static int ip_hashsize = IPFLOW_DEFAULT_HASHSIZE;
 
+static struct ipflow *ipflow_reap(bool);
 static void ipflow_sysctl_init(struct sysctllog **);
 
 static size_t 
@@ -349,7 +350,7 @@ ipflow_free(struct ipflow *ipf)
 	pool_put(_pool, ipf);
 }
 
-struct ipflow *
+static struct ipflow *
 ipflow_reap(bool just_one)
 {
 	while (just_one || ipflow_inuse > ip_maxflows) {

Index: src/sys/netinet/ip_var.h
diff -u src/sys/netinet/ip_var.h:1.112 src/sys/netinet/ip_var.h:1.113
--- src/sys/netinet/ip_var.h:1.112	Thu Apr 28 00:16:56 2016
+++ src/sys/netinet/ip_var.h	Mon Jun 13 08:29:55 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_var.h,v 1.112 2016/04/28 00:16:56 ozaki-r Exp $	*/
+/*	$NetBSD: ip_var.h,v 1.113 2016/06/13 08:29:55 knakahara Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -244,7 +244,6 @@ int	ip_if_output(struct ifnet * const, s
 /* IP Flow interface. */
 void	ipflow_init(void);
 void	ipflow_poolinit(void);
-struct ipflow *ipflow_reap(bool);
 void	ipflow_create(const struct route *, struct mbuf *);
 void	ipflow_slowtimo(void);
 int	ipflow_invalidate_all(int);



CVS commit: src/sys/netinet

2016-06-13 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Jun 13 08:04:44 UTC 2016

Modified Files:
src/sys/netinet: ip_flow.c

Log Message:
remove unnecessary splnet before pool_{get,put}


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/netinet/ip_flow.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet/ip_flow.c
diff -u src/sys/netinet/ip_flow.c:1.67 src/sys/netinet/ip_flow.c:1.68
--- src/sys/netinet/ip_flow.c:1.67	Fri Jun 10 13:31:44 2016
+++ src/sys/netinet/ip_flow.c	Mon Jun 13 08:04:44 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_flow.c,v 1.67 2016/06/10 13:31:44 ozaki-r Exp $	*/
+/*	$NetBSD: ip_flow.c,v 1.68 2016/06/13 08:04:44 knakahara Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_flow.c,v 1.67 2016/06/10 13:31:44 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_flow.c,v 1.68 2016/06/13 08:04:44 knakahara Exp $");
 
 #include 
 #include 
@@ -346,9 +346,7 @@ ipflow_free(struct ipflow *ipf)
 	ipflow_addstats(ipf);
 	rtcache_free(>ipf_ro);
 	ipflow_inuse--;
-	s = splnet();
 	pool_put(_pool, ipf);
-	splx(s);
 }
 
 struct ipflow *
@@ -453,9 +451,7 @@ ipflow_create(const struct route *ro, st
 		if (ipflow_inuse >= ip_maxflows) {
 			ipf = ipflow_reap(true);
 		} else {
-			s = splnet();
 			ipf = pool_get(_pool, PR_NOWAIT);
-			splx(s);
 			if (ipf == NULL)
 goto out;
 			ipflow_inuse++;



CVS commit: src/usr.bin/find

2016-06-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Jun 13 06:17:19 UTC 2016

Modified Files:
src/usr.bin/find: find.1

Log Message:
Remove trailing whitespace. Remove unnecessary quotes.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/usr.bin/find/find.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.1
diff -u src/usr.bin/find/find.1:1.86 src/usr.bin/find/find.1:1.87
--- src/usr.bin/find/find.1:1.86	Mon Jun 13 00:04:40 2016
+++ src/usr.bin/find/find.1	Mon Jun 13 06:17:19 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: find.1,v 1.86 2016/06/13 00:04:40 pgoyette Exp $
+.\"	$NetBSD: find.1,v 1.87 2016/06/13 06:17:19 wiz Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -172,7 +172,7 @@ and neither means
 .Dq exactly Ar n .
 (The argument specified for the
 .Ic -user
-and 
+and
 .Ic -group
 primaries
 are similarly treated if the value is numeric and does not correspond to a
@@ -196,7 +196,7 @@ minutes.
 True if the current file has a more recent last access time than
 .Ar file .
 .Pp
-.It Ic -asince Ar "timestamp"
+.It Ic -asince Ar timestamp
 True if the file last access time is greater than the specified
 .Ar timestamp .
 .Pp
@@ -219,7 +219,7 @@ minutes.
 True if the current file has a more recent last change time than
 .Ar file .
 .Pp
-.It Ic -csince Ar "timestamp"
+.It Ic -csince Ar timestamp
 True if the file last status change time is greater than the specified
 .Ar timestamp .
 .Pp
@@ -673,7 +673,7 @@ basic regular expression
 This is a match on the whole path, not a search for the regular expression
 within the path.
 .Pp
-.It Ic -since Ar "timestamp"
+.It Ic -since Ar timestamp
 True if the file last modification time is more recent than
 .Ar timestamp .
 .Pp