CVS commit: src/tests/net

2017-06-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jun 16 04:41:03 UTC 2017

Modified Files:
src/tests/net/arp: t_arp.sh
src/tests/net/ndp: t_ndp.sh

Log Message:
Test routing messages emitted on operations of ARP/NDP entries


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/tests/net/arp/t_arp.sh
cvs rdiff -u -r1.19 -r1.20 src/tests/net/ndp/t_ndp.sh

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

Modified files:

Index: src/tests/net/arp/t_arp.sh
diff -u src/tests/net/arp/t_arp.sh:1.22 src/tests/net/arp/t_arp.sh:1.23
--- src/tests/net/arp/t_arp.sh:1.22	Fri Nov 25 08:51:16 2016
+++ src/tests/net/arp/t_arp.sh	Fri Jun 16 04:41:02 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_arp.sh,v 1.22 2016/11/25 08:51:16 ozaki-r Exp $
+#	$NetBSD: t_arp.sh,v 1.23 2017/06/16 04:41:02 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -598,6 +598,77 @@ arp_static_cleanup()
 	cleanup
 }
 
+arp_rtm_head()
+{
+
+	atf_set "descr" "Tests for routing messages on operations of ARP entries"
+	atf_set "require.progs" "rump_server"
+}
+
+arp_rtm_body()
+{
+	local arp_keep=5
+	local macaddr_src= macaddr_dst=
+	local file=./tmp
+	local pid= str=
+
+	rump_server_start $SOCKSRC
+	rump_server_start $SOCKDST
+
+	setup_dst_server
+	setup_src_server $arp_keep
+
+	macaddr_src=$(get_macaddr $SOCKSRC shmif0)
+	macaddr_dst=$(get_macaddr $SOCKDST shmif0)
+
+	export RUMP_SERVER=$SOCKSRC
+
+	# Test ping and a resulting routing message (RTM_ADD)
+	rump.route -n monitor -c 1 > $file &
+	pid=$?
+	sleep 1
+	atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 $IP4DST
+	wait $pid
+	$DEBUG && cat $file
+
+	str="RTM_ADD.+"
+	atf_check -s exit:0 -o match:"$str" cat $file
+	str=""
+	atf_check -s exit:0 -o match:"$str" cat $file
+	str="$IP4DST link#2 $macaddr_src $IP4SRC"
+	atf_check -s exit:0 -o match:"$str" cat $file
+
+	# Test arp -d and resulting routing messages (RTM_GET and RTM_DELETE)
+	rump.route -n monitor -c 2 > $file &
+	pid=$?
+	sleep 1
+	atf_check -s exit:0 -o ignore rump.arp -d $IP4DST
+	wait $pid
+	$DEBUG && cat $file
+
+	str="RTM_GET.+"
+	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_GET $file
+	str=""
+	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_GET $file
+	str="$IP4DST $macaddr_dst $macaddr_src $IP4SRC"
+	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_GET $file
+	str="RTM_DELETE.+"
+	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
+	str=""
+	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
+	str="$IP4DST $macaddr_dst $macaddr_src $IP4SRC"
+	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
+
+	rump_server_destroy_ifaces
+}
+
+arp_rtm_cleanup()
+{
+
+	$DEBUG && dump
+	cleanup
+}
+
 atf_init_test_cases()
 {
 	atf_add_test_case arp_cache_expiration_5s
@@ -609,4 +680,5 @@ atf_init_test_cases()
 	atf_add_test_case arp_proxy_arp_pubproxy
 	atf_add_test_case arp_link_activation
 	atf_add_test_case arp_static
+	atf_add_test_case arp_rtm
 }

Index: src/tests/net/ndp/t_ndp.sh
diff -u src/tests/net/ndp/t_ndp.sh:1.19 src/tests/net/ndp/t_ndp.sh:1.20
--- src/tests/net/ndp/t_ndp.sh:1.19	Fri May 26 01:14:38 2017
+++ src/tests/net/ndp/t_ndp.sh	Fri Jun 16 04:41:02 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ndp.sh,v 1.19 2017/05/26 01:14:38 ozaki-r Exp $
+#	$NetBSD: t_ndp.sh,v 1.20 2017/06/16 04:41:02 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -396,6 +396,76 @@ ndp_link_activation_cleanup()
 	cleanup
 }
 
+ndp_rtm_head()
+{
+
+	atf_set "descr" "Tests for routing messages on operations of ARP entries"
+	atf_set "require.progs" "rump_server"
+}
+
+ndp_rtm_body()
+{
+	local macaddr_src= macaddr_dst=
+	local file=./tmp
+	local pid= str=
+
+	rump_server_start $SOCKSRC netinet6
+	rump_server_start $SOCKDST netinet6
+
+	setup_dst_server
+	setup_src_server
+
+	macaddr_src=$(get_macaddr $SOCKSRC shmif0)
+	macaddr_dst=$(get_macaddr $SOCKDST shmif0)
+
+	export RUMP_SERVER=$SOCKSRC
+
+	# Test ping and a resulting routing message (RTM_ADD)
+	rump.route -n monitor -c 1 > $file &
+	pid=$?
+	sleep 1
+	atf_check -s exit:0 -o ignore rump.ping6 -n -X 1 -c 1 $IP6DST
+	wait $pid
+	$DEBUG && cat $file
+
+	str="RTM_ADD.+"
+	atf_check -s exit:0 -o match:"$str" cat $file
+	str=""
+	atf_check -s exit:0 -o match:"$str" cat $file
+	str="$IP6DST link#2 $macaddr_src $IP6SRC"
+	atf_check -s exit:0 -o match:"$str" cat $file
+
+	# Test ndp -d and resulting routing messages (RTM_GET and RTM_DELETE)
+	rump.route -n monitor -c 2 > $file &
+	pid=$?
+	sleep 1
+	atf_check -s exit:0 -o ignore rump.ndp -d $IP6DST
+	wait $pid
+	$DEBUG && cat $file
+
+	str="RTM_GET.+"
+	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_GET $file
+	str=""
+	atf_check -s 

CVS commit: src/sbin/route

2017-06-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jun 16 04:40:16 UTC 2017

Modified Files:
src/sbin/route: route.8 route.c

Log Message:
Support -c  option for route monitor

route command exits if it receives  routing messages where
 is a value specified by -c.

The option is useful to get only particular message(s) in a test script.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sbin/route/route.8
cvs rdiff -u -r1.155 -r1.156 src/sbin/route/route.c

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

Modified files:

Index: src/sbin/route/route.8
diff -u src/sbin/route/route.8:1.56 src/sbin/route/route.8:1.57
--- src/sbin/route/route.8:1.56	Mon Apr  4 07:37:07 2016
+++ src/sbin/route/route.8	Fri Jun 16 04:40:16 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: route.8,v 1.56 2016/04/04 07:37:07 ozaki-r Exp $
+.\"	$NetBSD: route.8,v 1.57 2017/06/16 04:40:16 ozaki-r Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)route.8	8.4 (Berkeley) 6/1/94
 .\"
-.Dd March 30, 2016
+.Dd June 16, 2017
 .Dt ROUTE 8
 .Os
 .Sh NAME
@@ -139,8 +139,17 @@ The monitor command has the syntax
 .Nm
 .Op Fl n
 .Cm monitor
+.Op Fl c Ar count
 .Ed
 .Pp
+If
+.Ar count
+is specified,
+.Nm
+exits after receiving
+.Ar count
+routing messages.
+.Pp
 The flush command has the syntax
 .Pp
 .Bd -filled -offset indent -compact

Index: src/sbin/route/route.c
diff -u src/sbin/route/route.c:1.155 src/sbin/route/route.c:1.156
--- src/sbin/route/route.c:1.155	Fri Mar 17 16:13:44 2017
+++ src/sbin/route/route.c	Fri Jun 16 04:40:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: route.c,v 1.155 2017/03/17 16:13:44 roy Exp $	*/
+/*	$NetBSD: route.c,v 1.156 2017/06/16 04:40:16 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 1983, 1989, 1991, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)route.c	8.6 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: route.c,v 1.155 2017/03/17 16:13:44 roy Exp $");
+__RCSID("$NetBSD: route.c,v 1.156 2017/06/16 04:40:16 ozaki-r Exp $");
 #endif
 #endif /* not lint */
 
@@ -108,7 +108,7 @@ static char *netmask_string(const struct
 static int prefixlen(const char *, struct sou *);
 #ifndef SMALL
 static void interfaces(void);
-__dead static void monitor(void);
+static void monitor(int, char * const *);
 static int print_getmsg(struct rt_msghdr *, int, struct sou *);
 static const char *linkstate(struct if_msghdr *);
 static sup readtag(sup, const char *);
@@ -236,7 +236,7 @@ main(int argc, char * const *argv)
 
 #ifndef SMALL
 	case K_MONITOR:
-		monitor();
+		monitor(argc, argv);
 		return 0;
 
 #endif /* SMALL */
@@ -1105,20 +1105,37 @@ interfaces(void)
 }
 
 static void
-monitor(void)
+monitor(int argc, char * const *argv)
 {
-	int n;
+	int i, n;
 	union {
 		char msg[2048];
 		struct rt_msghdr hdr;
 	} u;
+	int count = 0;
+
+	/* usage: route monitor [-c ] */
+
+	/* eat "monitor" */
+	argc -= 1;
+	argv += 1;
+
+	/* parse [-c ] */
+	if (argc > 0) {
+		if (argc != 2)
+			usage(argv[0]);
+		if (strcmp(argv[0], "-c") != 0)
+			usage(argv[0]);
+
+		count = atoi(argv[1]);
+	}
 
 	verbose = 1;
 	if (debugonly) {
 		interfaces();
 		exit(0);
 	}
-	for(;;) {
+	for(i = 0; count == 0 || i < count; i++) {
 		time_t now;
 		n = prog_read(sock, , sizeof(u));
 		now = time(NULL);



CVS commit: src/sys/modules/hdafg

2017-06-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Jun 16 04:16:18 UTC 2017

Modified Files:
src/sys/modules/hdafg: Makefile

Log Message:
For non-rump modules, enable HDMI audio device.

No impact to rump modules, and no impact to kernels which have the
hdafg driver built-in.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/modules/hdafg/Makefile

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

Modified files:

Index: src/sys/modules/hdafg/Makefile
diff -u src/sys/modules/hdafg/Makefile:1.5 src/sys/modules/hdafg/Makefile:1.6
--- src/sys/modules/hdafg/Makefile:1.5	Wed Nov 19 00:17:10 2014
+++ src/sys/modules/hdafg/Makefile	Fri Jun 16 04:16:18 2017
@@ -1,8 +1,12 @@
-#	$NetBSD: Makefile,v 1.5 2014/11/19 00:17:10 pooka Exp $
+#	$NetBSD: Makefile,v 1.6 2017/06/16 04:16:18 pgoyette Exp $
 
 .include "../Makefile.inc"
 .include "${.CURDIR}/Makefile.inc"
 
 KMOD=	hdafg
 
+# For non-rump modules, enable HDMI audio
+
+CPPFLAGS+=	-DHDAUDIO_ENABLE_HDMI
+
 .include 



CVS commit: src/sys/net

2017-06-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jun 16 02:26:17 UTC 2017

Modified Files:
src/sys/net: rtsock.c

Log Message:
Drop RTF_CONNECTED from a result of RTM_GET for ARP/NDP entries

ARP/NDP entries aren't connected routes.

Reported by ryo@


To generate a diff of this commit:
cvs rdiff -u -r1.215 -r1.216 src/sys/net/rtsock.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/net/rtsock.c
diff -u src/sys/net/rtsock.c:1.215 src/sys/net/rtsock.c:1.216
--- src/sys/net/rtsock.c:1.215	Fri Jun 16 02:24:54 2017
+++ src/sys/net/rtsock.c	Fri Jun 16 02:26:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock.c,v 1.215 2017/06/16 02:24:54 ozaki-r Exp $	*/
+/*	$NetBSD: rtsock.c,v 1.216 2017/06/16 02:26:17 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.215 2017/06/16 02:24:54 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.216 2017/06/16 02:26:17 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -916,6 +916,7 @@ COMPATNAME(route_output)(struct mbuf *m,
 rtm = new_rtm;
 			}
 			rtm->rtm_flags |= RTF_LLDATA;
+			rtm->rtm_flags &= ~RTF_CONNECTED;
 			rtm->rtm_flags |= (ll_flags & LLE_STATIC) ? RTF_STATIC : 0;
 			break;
 		}



CVS commit: src/sys

2017-06-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jun 16 02:24:54 UTC 2017

Modified Files:
src/sys/net: route.h rtsock.c
src/sys/netinet: if_arp.c
src/sys/netinet6: nd6.c

Log Message:
Sending a routing message (RTM_ADD) on adding an llentry

A message used to be sent on adding a cloned route. Restore the
behavior for backward compatibility.

Requested by ryo@


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/net/route.h
cvs rdiff -u -r1.214 -r1.215 src/sys/net/rtsock.c
cvs rdiff -u -r1.250 -r1.251 src/sys/netinet/if_arp.c
cvs rdiff -u -r1.232 -r1.233 src/sys/netinet6/nd6.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/net/route.h
diff -u src/sys/net/route.h:1.112 src/sys/net/route.h:1.113
--- src/sys/net/route.h:1.112	Tue Apr 11 13:55:54 2017
+++ src/sys/net/route.h	Fri Jun 16 02:24:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: route.h,v 1.112 2017/04/11 13:55:54 roy Exp $	*/
+/*	$NetBSD: route.h,v 1.113 2017/06/16 02:24:54 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -500,6 +500,10 @@ int	rt_msg3(int, struct rt_addrinfo *, v
 void	rt_newaddrmsg(int, struct ifaddr *, int, struct rtentry *);
 void	route_enqueue(struct mbuf *, int);
 
+struct llentry;
+void	rt_clonedmsg(const struct sockaddr *, const struct ifnet *,
+	const struct rtentry *);
+
 /* rtbl */
 int	rt_addaddr(rtbl_t *, struct rtentry *, const struct sockaddr *);
 void	rt_assert_inactive(const struct rtentry *);

Index: src/sys/net/rtsock.c
diff -u src/sys/net/rtsock.c:1.214 src/sys/net/rtsock.c:1.215
--- src/sys/net/rtsock.c:1.214	Thu Jun 15 02:51:45 2017
+++ src/sys/net/rtsock.c	Fri Jun 16 02:24:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock.c,v 1.214 2017/06/15 02:51:45 ozaki-r Exp $	*/
+/*	$NetBSD: rtsock.c,v 1.215 2017/06/16 02:24:54 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.214 2017/06/15 02:51:45 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.215 2017/06/16 02:24:54 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1628,6 +1628,44 @@ COMPATNAME(rt_ieee80211msg)(struct ifnet
 	COMPATNAME(route_enqueue)(m, 0);
 }
 
+#ifndef COMPAT_RTSOCK
+/*
+ * Send a routing message as mimicing that a cloned route is added.
+ */
+void
+rt_clonedmsg(const struct sockaddr *dst, const struct ifnet *ifp,
+const struct rtentry *rt)
+{
+	struct rt_addrinfo info;
+	/* Mimic flags exactly */
+#define RTF_LLINFO	0x400
+#define RTF_CLONED	0x2000
+	int flags = RTF_UP | RTF_HOST | RTF_DONE | RTF_LLINFO | RTF_CLONED;
+	union {
+		struct sockaddr sa;
+		struct sockaddr_storage ss;
+		struct sockaddr_dl sdl;
+	} u;
+	uint8_t namelen = strlen(ifp->if_xname);
+	uint8_t addrlen = ifp->if_addrlen;
+
+	if (rt == NULL)
+		return; /* XXX */
+
+	memset(, 0, sizeof(info));
+	info.rti_info[RTAX_DST] = dst;
+	sockaddr_dl_init(, sizeof(u.ss), ifp->if_index, ifp->if_type,
+	NULL, namelen, NULL, addrlen);
+	info.rti_info[RTAX_GATEWAY] = 
+	info.rti_info[RTAX_IFP] = rt->rt_ifp->if_dl->ifa_addr;
+	info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
+
+	rt_missmsg(RTM_ADD, , flags, 0);
+#undef RTF_LLINFO
+#undef RTF_CLONED
+}
+#endif /* COMPAT_RTSOCK */
+
 /*
  * This is used in dumping the kernel table via sysctl().
  */

Index: src/sys/netinet/if_arp.c
diff -u src/sys/netinet/if_arp.c:1.250 src/sys/netinet/if_arp.c:1.251
--- src/sys/netinet/if_arp.c:1.250	Thu May 18 06:33:11 2017
+++ src/sys/netinet/if_arp.c	Fri Jun 16 02:24:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.c,v 1.250 2017/05/18 06:33:11 ozaki-r Exp $	*/
+/*	$NetBSD: if_arp.c,v 1.251 2017/06/16 02:24:54 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.250 2017/05/18 06:33:11 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.251 2017/06/16 02:24:54 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -760,8 +760,13 @@ notfound:
 		IF_AFDATA_WUNLOCK(ifp);
 		if (la == NULL)
 			ARP_STATINC(ARP_STAT_ALLOCFAIL);
-		else
+		else {
+			struct sockaddr_in sin;
+
 			arp_init_llentry(ifp, la);
+			sockaddr_in_init(, >r_l3addr.addr4, 0);
+			rt_clonedmsg(sintosa(), ifp, rt);
+		}
 	} else if (LLE_TRY_UPGRADE(la) == 0) {
 		create_lookup = "lookup";
 		LLE_RUNLOCK(la);

Index: src/sys/netinet6/nd6.c
diff -u src/sys/netinet6/nd6.c:1.232 src/sys/netinet6/nd6.c:1.233
--- src/sys/netinet6/nd6.c:1.232	Thu Jun  1 02:45:14 2017
+++ src/sys/netinet6/nd6.c	Fri Jun 16 02:24:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6.c,v 1.232 2017/06/01 02:45:14 chs Exp $	*/
+/*	$NetBSD: nd6.c,v 1.233 2017/06/16 02:24:54 ozaki-r Exp $	*/
 /*	$KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.232 2017/06/01 02:45:14 chs Exp $");

CVS commit: src/usr.bin/config

2017-06-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 16 02:01:10 UTC 2017

Modified Files:
src/usr.bin/config: mkmakefile.c

Log Message:
un-c99


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/usr.bin/config/mkmakefile.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/config/mkmakefile.c
diff -u src/usr.bin/config/mkmakefile.c:1.69 src/usr.bin/config/mkmakefile.c:1.70
--- src/usr.bin/config/mkmakefile.c:1.69	Thu Jun 15 19:52:15 2017
+++ src/usr.bin/config/mkmakefile.c	Thu Jun 15 22:01:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkmakefile.c,v 1.69 2017/06/15 23:52:15 christos Exp $	*/
+/*	$NetBSD: mkmakefile.c,v 1.70 2017/06/16 02:01:10 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: mkmakefile.c,v 1.69 2017/06/15 23:52:15 christos Exp $");
+__RCSID("$NetBSD: mkmakefile.c,v 1.70 2017/06/16 02:01:10 christos Exp $");
 
 #include 
 #include 
@@ -214,15 +214,14 @@ mkmakefile(void)
 static void
 emitmkoption(FILE *fp, const char *ass, const struct nvlist *nv)
 {
+	const char *p;
 
 	fprintf(fp, "%s%s", nv->nv_name, ass);
-
-	for (const char *p = nv->nv_str; *p; p++) {
+	for (p = nv->nv_str; *p; p++) {
 		if (*p == '\n')
 			fputs(" \\", fp);
 		fputc(*p, fp);
 	}
-
 	fputc('\n', fp);
 }
 



CVS commit: src/usr.bin/config

2017-06-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 16 00:10:10 UTC 2017

Modified Files:
src/usr.bin/config: defs.h

Log Message:
Bump for quoting makeoptions with multiple lines.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/usr.bin/config/defs.h

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/config/defs.h
diff -u src/usr.bin/config/defs.h:1.98 src/usr.bin/config/defs.h:1.99
--- src/usr.bin/config/defs.h:1.98	Fri Sep  9 17:09:11 2016
+++ src/usr.bin/config/defs.h	Thu Jun 15 20:10:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.98 2016/09/09 21:09:11 christos Exp $	*/
+/*	$NetBSD: defs.h,v 1.99 2017/06/16 00:10:09 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -107,7 +107,7 @@ extern const char *progname;
  * The next two lines define the current version of the config(1) binary,
  * and the minimum version of the configuration files it supports.
  */
-#define CONFIG_VERSION		20160808
+#define CONFIG_VERSION		20170615
 #define CONFIG_MINVERSION	0
 
 /*



CVS commit: src/external/bsd/ipf/dist/ipsend

2017-06-15 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 15 23:55:42 UTC 2017

Modified Files:
src/external/bsd/ipf/dist/ipsend: lsock.c

Log Message:
Don't include  on NetBSD in IPF (lsock)

This header in this context is freebsdism.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/ipf/dist/ipsend/lsock.c

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

Modified files:

Index: src/external/bsd/ipf/dist/ipsend/lsock.c
diff -u src/external/bsd/ipf/dist/ipsend/lsock.c:1.2 src/external/bsd/ipf/dist/ipsend/lsock.c:1.3
--- src/external/bsd/ipf/dist/ipsend/lsock.c:1.2	Sun Jul 22 14:27:36 2012
+++ src/external/bsd/ipf/dist/ipsend/lsock.c	Thu Jun 15 23:55:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lsock.c,v 1.2 2012/07/22 14:27:36 darrenr Exp $	*/
+/*	$NetBSD: lsock.c,v 1.3 2017/06/15 23:55:42 kamil Exp $	*/
 
 /*
  * lsock.c (C) 1995-1998 Darren Reed
@@ -39,7 +39,9 @@ static const char rcsid[] = "@(#)Id: lso
 #include 
 #include 
 #include 
+#if defined(__FreeBSD__)
 #include 
+#endif
 #include 
 #include 
 #include 



CVS commit: src/external/bsd/ipf/dist/ipsend

2017-06-15 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 15 23:53:56 UTC 2017

Modified Files:
src/external/bsd/ipf/dist/ipsend: iptests.c

Log Message:
Don't include  on NetBSD in IPF (iptests)

This header in this context is freebsdism.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/ipf/dist/ipsend/iptests.c

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

Modified files:

Index: src/external/bsd/ipf/dist/ipsend/iptests.c
diff -u src/external/bsd/ipf/dist/ipsend/iptests.c:1.3 src/external/bsd/ipf/dist/ipsend/iptests.c:1.4
--- src/external/bsd/ipf/dist/ipsend/iptests.c:1.3	Sun Jul 22 14:27:36 2012
+++ src/external/bsd/ipf/dist/ipsend/iptests.c	Thu Jun 15 23:53:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: iptests.c,v 1.3 2012/07/22 14:27:36 darrenr Exp $	*/
+/*	$NetBSD: iptests.c,v 1.4 2017/06/15 23:53:56 kamil Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -41,7 +41,9 @@ typedef	int	boolean_t;
 #endif
 #if !defined(solaris) && !defined(linux) && !defined(__sgi)
 # include 
+#if defined(__FreeBSD__)
 # include 
+#endif
 # include 
 #endif
 #if !defined(ultrix) && !defined(hpux) && !defined(linux) && \



CVS commit: src/usr.bin/config

2017-06-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 15 23:52:15 UTC 2017

Modified Files:
src/usr.bin/config: mkmakefile.c

Log Message:
Allow multiline makeoptions to work by quoting the newline..


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/usr.bin/config/mkmakefile.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/config/mkmakefile.c
diff -u src/usr.bin/config/mkmakefile.c:1.68 src/usr.bin/config/mkmakefile.c:1.69
--- src/usr.bin/config/mkmakefile.c:1.68	Fri Sep  4 06:16:35 2015
+++ src/usr.bin/config/mkmakefile.c	Thu Jun 15 19:52:15 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkmakefile.c,v 1.68 2015/09/04 10:16:35 uebayasi Exp $	*/
+/*	$NetBSD: mkmakefile.c,v 1.69 2017/06/15 23:52:15 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: mkmakefile.c,v 1.68 2015/09/04 10:16:35 uebayasi Exp $");
+__RCSID("$NetBSD: mkmakefile.c,v 1.69 2017/06/15 23:52:15 christos Exp $");
 
 #include 
 #include 
@@ -77,6 +77,7 @@ static void emitrules(FILE *);
 static void emitload(FILE *);
 static void emitincludes(FILE *);
 static void emitappmkoptions(FILE *);
+static void emitmkoption(FILE *, const char *, const struct nvlist *);
 static void emitsubs(FILE *, const char *, const char *, int);
 static int  selectopt(const char *, void *);
 
@@ -211,6 +212,21 @@ mkmakefile(void)
 }
 
 static void
+emitmkoption(FILE *fp, const char *ass, const struct nvlist *nv)
+{
+
+	fprintf(fp, "%s%s", nv->nv_name, ass);
+
+	for (const char *p = nv->nv_str; *p; p++) {
+		if (*p == '\n')
+			fputs(" \\", fp);
+		fputc(*p, fp);
+	}
+
+	fputc('\n', fp);
+}
+
+static void
 emitsubs(FILE *fp, const char *line, const char *file, int lineno)
 {
 	char *nextpct;
@@ -292,7 +308,7 @@ emitdefs(FILE *fp)
 		fprintf(fp, "___USE_SUFFIX_RULES___=1\n");
 	}
 	for (nv = mkoptions; nv != NULL; nv = nv->nv_next)
-		fprintf(fp, "%s=%s\n", nv->nv_name, nv->nv_str);
+		emitmkoption(fp, "=", nv);
 }
 
 static void
@@ -583,7 +599,7 @@ emitappmkoptions(FILE *fp)
 	for (nv = condmkoptions; nv != NULL; nv = nv->nv_next) {
 		cond = nv->nv_ptr;
 		if (expr_eval(cond, selectopt, NULL))
-			fprintf(fp, "%s+=%s\n", nv->nv_name, nv->nv_str);
+			emitmkoption(fp, "+=", nv);
 		condexpr_destroy(cond);
 		nv->nv_ptr = NULL;
 	}



CVS commit: src/external/bsd/ipf/dist/ipsend

2017-06-15 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 15 23:50:20 UTC 2017

Modified Files:
src/external/bsd/ipf/dist/ipsend: sock.c

Log Message:
Don't include  on NetBSD in IPF

This header in this context is freebsdism.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/ipf/dist/ipsend/sock.c

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

Modified files:

Index: src/external/bsd/ipf/dist/ipsend/sock.c
diff -u src/external/bsd/ipf/dist/ipsend/sock.c:1.3 src/external/bsd/ipf/dist/ipsend/sock.c:1.4
--- src/external/bsd/ipf/dist/ipsend/sock.c:1.3	Sun Jul 22 14:27:36 2012
+++ src/external/bsd/ipf/dist/ipsend/sock.c	Thu Jun 15 23:50:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sock.c,v 1.3 2012/07/22 14:27:36 darrenr Exp $	*/
+/*	$NetBSD: sock.c,v 1.4 2017/06/15 23:50:20 kamil Exp $	*/
 
 /*
  * sock.c (C) 1995-1998 Darren Reed
@@ -47,7 +47,9 @@ typedef int boolean_t;
 # undef  KERNEL
 #endif
 #include 
+#if defined(__FreeBSD__)
 #include 
+#endif
 #include 
 #include 
 #include 



CVS commit: src/external/gpl3/gdb/dist/gdb

2017-06-15 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 15 23:46:30 UTC 2017

Modified Files:
src/external/gpl3/gdb/dist/gdb: bsd-kvm.c

Log Message:
Don't include  on NetBSD in GDB

This header in this context is freebsdism.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/gpl3/gdb/dist/gdb/bsd-kvm.c

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

Modified files:

Index: src/external/gpl3/gdb/dist/gdb/bsd-kvm.c
diff -u src/external/gpl3/gdb/dist/gdb/bsd-kvm.c:1.9 src/external/gpl3/gdb/dist/gdb/bsd-kvm.c:1.10
--- src/external/gpl3/gdb/dist/gdb/bsd-kvm.c:1.9	Wed Oct 12 20:20:33 2016
+++ src/external/gpl3/gdb/dist/gdb/bsd-kvm.c	Thu Jun 15 23:46:30 2017
@@ -37,7 +37,9 @@
 #include "readline/readline.h"
 #include 
 #include 
+#if defined(__FreeBSD__)
 #include 
+#endif
 
 #include "bsd-kvm.h"
 



CVS commit: src/external/bsd/libproc/dist

2017-06-15 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 15 23:44:58 UTC 2017

Modified Files:
src/external/bsd/libproc/dist: proc_sym.c

Log Message:
Don't include  on NetBSD in libproc

This header in this context is freebsdism.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/libproc/dist/proc_sym.c

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

Modified files:

Index: src/external/bsd/libproc/dist/proc_sym.c
diff -u src/external/bsd/libproc/dist/proc_sym.c:1.3 src/external/bsd/libproc/dist/proc_sym.c:1.4
--- src/external/bsd/libproc/dist/proc_sym.c:1.3	Tue Apr 26 14:28:39 2016
+++ src/external/bsd/libproc/dist/proc_sym.c	Thu Jun 15 23:44:58 2017
@@ -32,7 +32,7 @@
 #ifdef __FBSDID
 __FBSDID("$FreeBSD: head/lib/libproc/proc_sym.c 279946 2015-03-13 04:26:48Z stas $");
 #else
-__RCSID("$NetBSD: proc_sym.c,v 1.3 2016/04/26 14:28:39 chs Exp $");
+__RCSID("$NetBSD: proc_sym.c,v 1.4 2017/06/15 23:44:58 kamil Exp $");
 #endif
 
 #include 
@@ -40,7 +40,9 @@ __RCSID("$NetBSD: proc_sym.c,v 1.3 2016/
 #include 
 #include 
 #endif
+#if defined(__FreeBSD__)
 #include 
+#endif
 #include 
 
 #include 



CVS commit: src/libexec/ld.elf_so/arch/sparc64

2017-06-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jun 15 23:10:12 UTC 2017

Modified Files:
src/libexec/ld.elf_so/arch/sparc64: mdreloc.c

Log Message:
Fix indentation.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c

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

Modified files:

Index: src/libexec/ld.elf_so/arch/sparc64/mdreloc.c
diff -u src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.59 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.60
--- src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.59	Mon Aug 29 16:00:10 2016
+++ src/libexec/ld.elf_so/arch/sparc64/mdreloc.c	Thu Jun 15 23:10:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mdreloc.c,v 1.59 2016/08/29 16:00:10 martin Exp $	*/
+/*	$NetBSD: mdreloc.c,v 1.60 2017/06/15 23:10:12 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2000 Eduardo Horvath.
@@ -32,7 +32,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: mdreloc.c,v 1.59 2016/08/29 16:00:10 martin Exp $");
+__RCSID("$NetBSD: mdreloc.c,v 1.60 2017/06/15 23:10:12 joerg Exp $");
 #endif /* not lint */
 
 #include 
@@ -352,57 +352,55 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 		 */
 		if (RELOC_TLS(type)) {
 			switch (type) {
-case R_TYPE(TLS_DTPMOD64):
-	def = _rtld_find_symdef(symnum, obj,
-	, false);
-	if (def == NULL)
-		return -1;
-
-	*where = (Elf64_Addr)defobj->tlsindex;
-
-	rdbg(("TLS_DTPMOD64 %s in %s --> %p",
-	obj->strtab +
-	obj->symtab[symnum].st_name,
-	obj->path, (void *)*where));
-
-	break;
-
-case R_TYPE(TLS_DTPOFF64):
-	def = _rtld_find_symdef(symnum, obj,
-	, false);
-	if (def == NULL)
-		return -1;
-
-	*where = (Elf64_Addr)(def->st_value
-	+ rela->r_addend);
-
-	rdbg(("DTPOFF64 %s in %s --> %p",
-	obj->strtab +
-	obj->symtab[symnum].st_name,
-	obj->path, (void *)*where));
-
-	break;
-
-case R_TYPE(TLS_TPOFF64):
-	def = _rtld_find_symdef(symnum, obj,
-	, false);
-	if (def == NULL)
-		return -1;
-
-	if (!defobj->tls_done &&
-		_rtld_tls_offset_allocate(obj))
-		 return -1;
-
-	*where = (Elf64_Addr)(def->st_value -
-			defobj->tlsoffset +
-		rela->r_addend);
-
-		rdbg(("TLS_TPOFF64 %s in %s --> %p",
-		obj->strtab +
-	obj->symtab[symnum].st_name,
-		obj->path, (void *)*where));
+			case R_TYPE(TLS_DTPMOD64):
+def = _rtld_find_symdef(symnum, obj,
+, false);
+if (def == NULL)
+	return -1;
+
+*where = (Elf64_Addr)defobj->tlsindex;
+
+rdbg(("TLS_DTPMOD64 %s in %s --> %p",
+obj->strtab +
+obj->symtab[symnum].st_name,
+obj->path, (void *)*where));
+
+break;
+
+			case R_TYPE(TLS_DTPOFF64):
+def = _rtld_find_symdef(symnum, obj,
+, false);
+if (def == NULL)
+	return -1;
+
+*where = (Elf64_Addr)(def->st_value
++ rela->r_addend);
+
+rdbg(("DTPOFF64 %s in %s --> %p",
+obj->strtab +
+obj->symtab[symnum].st_name,
+obj->path, (void *)*where));
+
+break;
+
+			case R_TYPE(TLS_TPOFF64):
+def = _rtld_find_symdef(symnum, obj,
+, false);
+if (def == NULL)
+	return -1;
+
+if (!defobj->tls_done &&
+	_rtld_tls_offset_allocate(obj))
+	 return -1;
+
+*where = (Elf64_Addr)(def->st_value -
+defobj->tlsoffset + rela->r_addend);
+
+rdbg(("TLS_TPOFF64 %s in %s --> %p",
+obj->strtab + obj->symtab[symnum].st_name,
+obj->path, (void *)*where));
 
-			break;
+break;
 			}
 			continue;
 		}



CVS commit: src/libexec/ld.elf_so/arch/sparc

2017-06-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jun 15 23:08:46 UTC 2017

Modified Files:
src/libexec/ld.elf_so/arch/sparc: mdreloc.c

Log Message:
Fix indentation.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/libexec/ld.elf_so/arch/sparc/mdreloc.c

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

Modified files:

Index: src/libexec/ld.elf_so/arch/sparc/mdreloc.c
diff -u src/libexec/ld.elf_so/arch/sparc/mdreloc.c:1.48 src/libexec/ld.elf_so/arch/sparc/mdreloc.c:1.49
--- src/libexec/ld.elf_so/arch/sparc/mdreloc.c:1.48	Mon Aug 25 20:40:52 2014
+++ src/libexec/ld.elf_so/arch/sparc/mdreloc.c	Thu Jun 15 23:08:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mdreloc.c,v 1.48 2014/08/25 20:40:52 joerg Exp $	*/
+/*	$NetBSD: mdreloc.c,v 1.49 2017/06/15 23:08:46 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2002 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: mdreloc.c,v 1.48 2014/08/25 20:40:52 joerg Exp $");
+__RCSID("$NetBSD: mdreloc.c,v 1.49 2017/06/15 23:08:46 joerg Exp $");
 #endif /* not lint */
 
 #include 
@@ -238,57 +238,56 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 		 */
 		if (RELOC_TLS(type)) {
 			switch (type) {
-case R_TYPE(TLS_DTPMOD32):
-	def = _rtld_find_symdef(symnum, obj,
-	, false);
-	if (def == NULL)
-		return -1;
-
-	*where = (Elf_Addr)defobj->tlsindex;
-
-	rdbg(("TLS_DTPMOD32 %s in %s --> %p",
-	obj->strtab +
-	obj->symtab[symnum].st_name,
-	obj->path, (void *)*where));
-
-	break;
-
-case R_TYPE(TLS_DTPOFF32):
-	def = _rtld_find_symdef(symnum, obj,
-	, false);
-	if (def == NULL)
-		return -1;
-
-	*where = (Elf_Addr)(def->st_value
-	+ rela->r_addend);
-
-	rdbg(("TLS_DTPOFF32 %s in %s --> %p",
-	obj->strtab +
-	obj->symtab[symnum].st_name,
-	obj->path, (void *)*where));
-
-	break;
-
-case R_TYPE(TLS_TPOFF32):
-	def = _rtld_find_symdef(symnum, obj,
-	, false);
-	if (def == NULL)
-		return -1;
-
-	if (!defobj->tls_done &&
-		_rtld_tls_offset_allocate(obj))
-		 return -1;
-
-	*where = (Elf_Addr)(def->st_value -
-			defobj->tlsoffset +
-		rela->r_addend);
-
-		rdbg(("TLS_TPOFF32 %s in %s --> %p",
-		obj->strtab +
-	obj->symtab[symnum].st_name,
-		obj->path, (void *)*where));
+			case R_TYPE(TLS_DTPMOD32):
+def = _rtld_find_symdef(symnum, obj,
+, false);
+if (def == NULL)
+	return -1;
+
+*where = (Elf_Addr)defobj->tlsindex;
+
+rdbg(("TLS_DTPMOD32 %s in %s --> %p",
+obj->strtab +
+obj->symtab[symnum].st_name,
+obj->path, (void *)*where));
+
+break;
+
+			case R_TYPE(TLS_DTPOFF32):
+def = _rtld_find_symdef(symnum, obj,
+, false);
+if (def == NULL)
+	return -1;
+
+*where = (Elf_Addr)(def->st_value
++ rela->r_addend);
+
+rdbg(("TLS_DTPOFF32 %s in %s --> %p",
+obj->strtab +
+obj->symtab[symnum].st_name,
+obj->path, (void *)*where));
+
+break;
+
+			case R_TYPE(TLS_TPOFF32):
+def = _rtld_find_symdef(symnum, obj,
+, false);
+if (def == NULL)
+	return -1;
+
+if (!defobj->tls_done &&
+	_rtld_tls_offset_allocate(obj))
+	 return -1;
+
+*where = (Elf_Addr)(def->st_value -
+defobj->tlsoffset + rela->r_addend);
+
+rdbg(("TLS_TPOFF32 %s in %s --> %p",
+obj->strtab +
+obj->symtab[symnum].st_name,
+obj->path, (void *)*where));
 
-			break;
+break;
 			}
 			continue;
 		}



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

2017-06-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jun 15 22:08:07 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: mk.tegra

Log Message:
build tegra124-apalis-eval.dtb, tegra124-jetson-tk1.dtb, tegra124-nyan-big.dtb, 
tegra124-nyan-blaze.dtb, and tegra124-venice2.dtb with the kernel


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/mk.tegra

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/evbarm/conf/mk.tegra
diff -u src/sys/arch/evbarm/conf/mk.tegra:1.4 src/sys/arch/evbarm/conf/mk.tegra:1.5
--- src/sys/arch/evbarm/conf/mk.tegra:1.4	Mon Sep 26 20:05:03 2016
+++ src/sys/arch/evbarm/conf/mk.tegra	Thu Jun 15 22:08:07 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: mk.tegra,v 1.4 2016/09/26 20:05:03 jakllsch Exp $
+#	$NetBSD: mk.tegra,v 1.5 2017/06/15 22:08:07 jmcneill Exp $
 CPPFLAGS+=		-mcpu=cortex-a15 -mfpu=neon
 
 .include "$S/arch/arm/nvidia/tegra_xusb-fw.mk"
@@ -30,3 +30,9 @@ EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.K
 EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.ub@}
 EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.bin.gz@}
 EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gz.ub@}
+
+DTS=	tegra124-apalis-eval.dts \
+	tegra124-jetson-tk1.dts \
+	tegra124-nyan-big.dts \
+	tegra124-nyan-blaze.dts \
+	tegra124-venice2.dts



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

2017-06-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jun 15 22:07:10 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: mk.vexpress

Log Message:
build vexpress-v2p-ca15-tc1.dtb with the kernel


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/conf/mk.vexpress

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/evbarm/conf/mk.vexpress
diff -u src/sys/arch/evbarm/conf/mk.vexpress:1.2 src/sys/arch/evbarm/conf/mk.vexpress:1.3
--- src/sys/arch/evbarm/conf/mk.vexpress:1.2	Fri Jun  2 15:22:47 2017
+++ src/sys/arch/evbarm/conf/mk.vexpress	Thu Jun 15 22:07:10 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: mk.vexpress,v 1.2 2017/06/02 15:22:47 jmcneill Exp $
+#	$NetBSD: mk.vexpress,v 1.3 2017/06/15 22:07:10 jmcneill Exp $
 
 .if !empty(MACHINE_ARCH:M*eb)
 EXTRA_LINKFLAGS+=	--be8
@@ -33,3 +33,5 @@ EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.K
 EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.ub@}
 EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.bin.gz@}
 EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gz.ub@}
+
+DTS=	vexpress-v2p-ca15-tc1.dts



CVS commit: src/sys/conf

2017-06-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jun 15 21:41:01 UTC 2017

Modified Files:
src/sys/conf: Makefile.kern.inc

Log Message:
Add support for building DTB files during kernel build, from christos.


To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 src/sys/conf/Makefile.kern.inc

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

Modified files:

Index: src/sys/conf/Makefile.kern.inc
diff -u src/sys/conf/Makefile.kern.inc:1.256 src/sys/conf/Makefile.kern.inc:1.257
--- src/sys/conf/Makefile.kern.inc:1.256	Wed Jan 11 12:19:43 2017
+++ src/sys/conf/Makefile.kern.inc	Thu Jun 15 21:41:01 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.kern.inc,v 1.256 2017/01/11 12:19:43 joerg Exp $
+#	$NetBSD: Makefile.kern.inc,v 1.257 2017/06/15 21:41:01 jmcneill Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -534,6 +534,25 @@ build_kernel: .USE
 	@${KCOMPILE.s} -pg
 .endif # ___USE_SUFFIX_RULES___
 
+# Begin DTS handling
+
+DTSINC?=$S/external/gpl2/dts/dist/include
+DTSPATH?=$S/external/gpl2/dts/dist/arch/${MACHINE_CPU}/boot/dts
+DTSPADDING?=1024
+
+.SUFFIXES: .dtb .dts
+.dts.dtb:
+	${CPP} -P -xassembler-with-cpp -I ${DTSINC} -I ${DTSPATH} \
+	-include ${.IMPSRC} /dev/null | \
+	${TOOL_DTC} -i ${DTSINC} -i ${DTSPATH} -I dts -O dtb \
+	-p ${DTSPADDING} -b 0 -o ${.TARGET}
+
+.PATH.dts: ${DTSPATH}
+
+all: ${DTS:.dts=.dtb}
+
+# End DTS handling
+
 ##
 ## the end
 ##



CVS commit: src/sys/external/gpl2/dts

2017-06-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jun 15 20:22:44 UTC 2017

Modified Files:
src/sys/external/gpl2/dts: dts2netbsd

Log Message:
Cleanup copies of dt-bindings includes


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/external/gpl2/dts/dts2netbsd

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

Modified files:

Index: src/sys/external/gpl2/dts/dts2netbsd
diff -u src/sys/external/gpl2/dts/dts2netbsd:1.1 src/sys/external/gpl2/dts/dts2netbsd:1.2
--- src/sys/external/gpl2/dts/dts2netbsd:1.1	Thu Jun 15 20:15:11 2017
+++ src/sys/external/gpl2/dts/dts2netbsd	Thu Jun 15 20:22:44 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 #
-#	$NetBSD: dts2netbsd,v 1.1 2017/06/15 20:15:11 jmcneill Exp $ */
+#	$NetBSD: dts2netbsd,v 1.2 2017/06/15 20:22:44 jmcneill Exp $ */
 #
 # Copyright (c) 2013, 2017 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -77,6 +77,7 @@ cp -r $r/include/dt-bindings $d/include
 for arch in arm arm64 mips; do
 	mkdir -p $d/arch/${arch}/boot
 	cp -r $r/arch/${arch}/boot/dts $d/arch/${arch}/boot
+	rm -rf $d/arch/${arch}/boot/dts/include
 done
 
 # cd to import directory



CVS commit: src/sys/external/gpl2/dts

2017-06-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jun 15 20:15:11 UTC 2017

Added Files:
src/sys/external/gpl2/dts: dts2netbsd

Log Message:
Add dts2netbsd script


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/external/gpl2/dts/dts2netbsd

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

Added files:

Index: src/sys/external/gpl2/dts/dts2netbsd
diff -u /dev/null src/sys/external/gpl2/dts/dts2netbsd:1.1
--- /dev/null	Thu Jun 15 20:15:11 2017
+++ src/sys/external/gpl2/dts/dts2netbsd	Thu Jun 15 20:15:11 2017
@@ -0,0 +1,116 @@
+#! /bin/sh
+#
+#	$NetBSD: dts2netbsd,v 1.1 2017/06/15 20:15:11 jmcneill Exp $ */
+#
+# Copyright (c) 2013, 2017 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+#
+# dts2netbsd:  prepare the dts source files and headers for import into the
+# netbsd dts source tree, under src/sys/external/gpl2/dts/dist,
+# based on the other *2netbsd scripts in the NetBSD source tree
+#
+# Instructions for importing new dts release:
+#
+#	$ cd /some/where/temporary
+#	$ ftp https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.x.y.tar.xz
+#	$ tar -jxvf linux-4.x.y.tar.xz
+#	$ DTSSRCS=$(pwd)/linux-4.x.y
+#	$ WRKDIR=/an/other/temporary
+#	$ sh /usr/src/sys/external/gpl2/dts/dts2netbsd $DTSSRCS $WRKDIR
+#	$ cd $WRKDIR
+#	$ cvs -d cvs.netbsd.org:/cvsroot import -m "Import dts from Linux 4.x.y" src/sys/external/gpl2/dts/dist LINUX linux-4_x_y
+#
+
+if [ $# -ne 2 ]; then echo "dts2netbsd src dest"; exit 1; fi
+
+r=$1
+d=$2
+
+case "$d" in
+	/*)
+		;;
+	*)
+		d=`/bin/pwd`/$d
+		;;
+esac
+
+case "$r" in
+	/*)
+		;;
+	*)
+		r=`/bin/pwd`/$r
+		;;
+esac
+
+echo preparing directory $d
+rm -rf $d
+mkdir -p $d
+
+### Copy the files and directories
+echo copying $r to $d
+cd $r
+
+mkdir -p $d/include
+cp -r $r/include/dt-bindings $d/include
+
+for arch in arm arm64 mips; do
+	mkdir -p $d/arch/${arch}/boot
+	cp -r $r/arch/${arch}/boot/dts $d/arch/${arch}/boot
+done
+
+# cd to import directory
+cd $d
+
+### dts distribution doesn't have RCS/CVS tags, so add them.
+
+### Add our NetBSD RCS Id
+find $d -type f -name '*.[ch]' -print | while read c; do
+	sed 1q < $c | grep -q '\$NetBSD' || (
+echo "/*	\$NetBSD\$	*/" >/tmp/dts2n$$
+echo "" >>/tmp/dts2n$$
+cat $c  >> /tmp/dts2n$$
+mv /tmp/dts2n$$ $c && echo added NetBSD RCS tag to $c
+	)
+done
+
+echo done
+
+### Clean up any CVS directories that might be around.
+echo "cleaning up CVS residue."
+(
+	cd $d
+	find . -type d -name "CVS" -print | xargs rm -r
+)
+echo done
+
+### Fixing file and directory permissions.
+echo "Fixing file/directory permissions."
+(
+	cd $d
+	find . -type f -print | xargs chmod u+rw,go+r
+	find . -type d -print | xargs chmod u+rwx,go+rx
+)
+echo done
+
+exit 0



CVS commit: src/sys/arch/x86/x86

2017-06-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 15 18:15:53 UTC 2017

Modified Files:
src/sys/arch/x86/x86: pmap.c

Log Message:
tidy up printf/kasserts; no functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.250 -r1.251 src/sys/arch/x86/x86/pmap.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/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.250 src/sys/arch/x86/x86/pmap.c:1.251
--- src/sys/arch/x86/x86/pmap.c:1.250	Thu Jun 15 09:42:55 2017
+++ src/sys/arch/x86/x86/pmap.c	Thu Jun 15 14:15:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.250 2017/06/15 13:42:55 maxv Exp $	*/
+/*	$NetBSD: pmap.c,v 1.251 2017/06/15 18:15:53 christos Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.250 2017/06/15 13:42:55 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.251 2017/06/15 18:15:53 christos Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -974,8 +974,8 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v
 #ifdef DOM0OPS
 	if (pa < pmap_pa_start || pa >= pmap_pa_end) {
 #ifdef DEBUG
-		printf_nolog("%s: pa 0x%" PRIx64 " for va 0x%" PRIx64
-		" outside range\n", __func__, (int64_t)pa, (int64_t)va);
+		printf_nolog("%s: pa %#" PRIxPADDR " for va %#" PRIxVADDR
+		" outside range\n", __func__, pa, va);
 #endif /* DEBUG */
 		npte = pa;
 	} else
@@ -991,7 +991,7 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v
 	 * be kentered.
 	 */
 	if (opte & PG_PS)
-		panic("%s: PG_PS", __func__);
+		panic("%s: PG_PS va=%#" PRIxVADDR, __func__, va);
 #endif
 	if ((opte & (PG_V | PG_U)) == (PG_V | PG_U)) {
 		/* This should not happen. */
@@ -1127,8 +1127,10 @@ pmap_kremove1(vaddr_t sva, vsize_t len, 
 			pmap_tlb_shootdown(pmap_kernel(), va, opte,
 			TLBSHOOT_KREMOVE);
 		}
-		KASSERT((opte & PG_PS) == 0);
-		KASSERT((opte & PG_PVLIST) == 0);
+		KASSERTMSG((opte & PG_PS) == 0,
+		"va %#" PRIxVADDR " is a large page", va);
+		KASSERTMSG((opte & PG_PVLIST) == 0,
+		"va %#" PRIxVADDR " is a pv tracked page", va);
 	}
 	if (localonly) {
 		tlbflushg();
@@ -2422,7 +2424,7 @@ pmap_destroy(struct pmap *pmap)
 ci->ci_index, ci->ci_pmap,
 i, ci->ci_kpm_pdir[i],
 i, pmap->pm_pdir[i]);
-panic("pmap_destroy: used pmap");
+panic("%s: used pmap", __func__);
 			}
 		}
 #endif
@@ -2527,8 +2529,8 @@ pmap_fork(struct pmap *pmap1, struct pma
 		new_ldt = (union descriptor *)uvm_km_alloc(kernel_map, len, 0,
 		UVM_KMF_WIRED);
 		if (new_ldt == NULL) {
-			printf("WARNING: pmap_fork: "
-			   "unable to allocate LDT space\n");
+			printf("WARNING: %s: unable to allocate LDT space\n",
+			__func__);
 			return;
 		}
 		mutex_enter(_lock);
@@ -2538,8 +2540,8 @@ pmap_fork(struct pmap *pmap1, struct pma
 			mutex_exit(_lock);
 			uvm_km_free(kernel_map, (vaddr_t)new_ldt, len,
 			UVM_KMF_WIRED);
-			printf("WARNING: pmap_fork: "
-			   "unable to allocate LDT selector\n");
+			printf("WARNING: %s: unable to allocate LDT selector\n",
+			__func__);
 			return;
 		}
 	} else {
@@ -3392,8 +3394,8 @@ pmap_remove_pte(struct pmap *pmap, struc
 #if defined(DIAGNOSTIC) && !defined(DOM0OPS)
 		if (PHYS_TO_VM_PAGE(pmap_pte2pa(opte)) != NULL ||
 		pmap_pv_tracked(pmap_pte2pa(opte)) != NULL)
-			panic("pmap_remove_pte: managed or pv-tracked page"
-			" without PG_PVLIST for %#"PRIxVADDR, va);
+			panic("%s: managed or pv-tracked page"
+			" without PG_PVLIST for %#"PRIxVADDR, __func__, va);
 #endif
 		return true;
 	}
@@ -3403,10 +3405,9 @@ pmap_remove_pte(struct pmap *pmap, struc
 		pp = VM_PAGE_TO_PP(pg);
 	} else if ((pp = pmap_pv_tracked(pmap_pte2pa(opte))) == NULL) {
 		paddr_t pa = pmap_pte2pa(opte);
-		panic("pmap_remove_pte: PG_PVLIST with pv-untracked page"
-		" va = 0x%"PRIxVADDR
-		" pa = 0x%"PRIxPADDR" (0x%"PRIxPADDR")",
-		va, pa, atop(pa));
+		panic("%s: PG_PVLIST with pv-untracked page"
+		" va = %#"PRIxVADDR"pa = %#"PRIxPADDR" (%#"PRIxPADDR")",
+		__func__, va, pa, atop(pa));
 	}
 
 	/* Sync R/M bits. */
@@ -3457,7 +3458,7 @@ pmap_remove(struct pmap *pmap, vaddr_t s
 			if (pmap != pmap_kernel()) {
 ptp = pmap_find_ptp(pmap, va, ptppa, 1);
 KASSERTMSG(ptp != NULL,
-"pmap_remove: unmanaged PTP detected");
+"%s: unmanaged PTP detected", __func__);
 			} else {
 /* Never free kernel PTPs. */
 ptp = NULL;
@@ -3511,8 +3512,8 @@ pmap_remove(struct pmap *pmap, vaddr_t s
 		/* Get PTP if non-kernel mapping. */
 		if (pmap != pmap_kernel()) {
 			ptp = pmap_find_ptp(pmap, va, ptppa, 1);
-			KASSERTMSG(ptp != NULL,
-			"pmap_remove: unmanaged PTP detected");
+			KASSERTMSG(ptp != NULL, "%s: unmanaged PTP detected",
+			__func__);
 		} else {
 			/* Never free kernel PTPs. */
 			ptp = NULL;
@@ -3744,8 +3745,7 @@ pmap_pv_remove(paddr_t pa)
 

CVS commit: src/doc

2017-06-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 15 16:02:29 UTC 2017

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
new bind


To generate a diff of this commit:
cvs rdiff -u -r1.1451 -r1.1452 src/doc/3RDPARTY
cvs rdiff -u -r1.2291 -r1.2292 src/doc/CHANGES

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1451 src/doc/3RDPARTY:1.1452
--- src/doc/3RDPARTY:1.1451	Wed Jun 14 17:05:02 2017
+++ src/doc/3RDPARTY	Thu Jun 15 12:02:28 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1451 2017/06/14 21:05:02 wiz Exp $
+#	$NetBSD: 3RDPARTY,v 1.1452 2017/06/15 16:02:28 christos Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -114,8 +114,8 @@ Notes:
 bc includes dc, both of which are in the NetBSD tree.
 
 Package:	bind [named and utils]
-Version:	9.10.4-P8/BSD	9.11.0-P3/MPL
-Current Vers:	9.10.4-P8/BSD
+Version:	9.10.5-P1/BSD	9.11.1-P1/MPL
+Current Vers:	9.10.5-P1/BSD
 Maintainer:	Paul Vixie <vi...@vix.com>
 Archive Site:	ftp://ftp.isc.org/isc/bind9/
 Home Page:	http://www.isc.org/software/bind/

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2291 src/doc/CHANGES:1.2292
--- src/doc/CHANGES:1.2291	Thu Jun 15 10:23:42 2017
+++ src/doc/CHANGES	Thu Jun 15 12:02:28 2017
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2291 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2292 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -28,3 +28,4 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	vax: Add support for VAXstation 4000 TURBOchannel. [flxd 20170609]
 	wsbell(4): added console bell support for all speaker devices, not
 		only those attached at pcppi [nat 20170612]
+	bind: Import version 9.10.5-P1. [christos 20170615]



CVS commit: src/distrib/sets/lists

2017-06-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 15 16:00:57 UTC 2017

Modified Files:
src/distrib/sets/lists/base: shl.mi
src/distrib/sets/lists/debug: shl.mi

Log Message:
bump for bind


To generate a diff of this commit:
cvs rdiff -u -r1.817 -r1.818 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.176 -r1.177 src/distrib/sets/lists/debug/shl.mi

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

Modified files:

Index: src/distrib/sets/lists/base/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.817 src/distrib/sets/lists/base/shl.mi:1.818
--- src/distrib/sets/lists/base/shl.mi:1.817	Sat May 27 17:02:54 2017
+++ src/distrib/sets/lists/base/shl.mi	Thu Jun 15 12:00:57 2017
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.817 2017/05/27 21:02:54 bouyer Exp $
+# $NetBSD: shl.mi,v 1.818 2017/06/15 16:00:57 christos Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -196,7 +196,7 @@
 ./usr/lib/libbfd.so.15.0			base-sys-shlib		compatfile,binutils=227
 ./usr/lib/libbind9.sobase-bind-shlib		compatfile
 ./usr/lib/libbind9.so.8base-bind-shlib		compatfile
-./usr/lib/libbind9.so.8.4			base-bind-shlib		compatfile
+./usr/lib/libbind9.so.8.5			base-bind-shlib		compatfile
 ./usr/lib/libblacklist.so			base-sys-shlib		compatfile
 ./usr/lib/libblacklist.so.0			base-sys-shlib		compatfile
 ./usr/lib/libblacklist.so.0.0			base-sys-shlib		compatfile
@@ -249,7 +249,7 @@
 ./usr/lib/libdm.so.0.0base-sys-shlib		compatfile
 ./usr/lib/libdns.sobase-bind-shlib		compatfile
 ./usr/lib/libdns.so.8base-bind-shlib		compatfile
-./usr/lib/libdns.so.8.4base-bind-shlib		compatfile
+./usr/lib/libdns.so.8.5base-bind-shlib		compatfile
 ./usr/lib/libdns_sd.sobase-mdns-shlib		compatfile,mdns
 ./usr/lib/libdns_sd.so.0			base-mdns-shlib		compatfile,mdns
 ./usr/lib/libdns_sd.so.0.0			base-mdns-shlib		compatfile,mdns
@@ -321,16 +321,16 @@
 ./usr/lib/libipsec.so.3.0			base-net-shlib		compatfile
 ./usr/lib/libirs.sobase-bind-shlib		compatfile
 ./usr/lib/libirs.so.8base-bind-shlib		compatfile
-./usr/lib/libirs.so.8.4base-bind-shlib		compatfile
+./usr/lib/libirs.so.8.5base-bind-shlib		compatfile
 ./usr/lib/libisc.sobase-bind-shlib		compatfile
 ./usr/lib/libisc.so.8base-bind-shlib		compatfile
-./usr/lib/libisc.so.8.4base-bind-shlib		compatfile
+./usr/lib/libisc.so.8.5base-bind-shlib		compatfile
 ./usr/lib/libisccc.sobase-bind-shlib		compatfile
 ./usr/lib/libisccc.so.8base-bind-shlib		compatfile
-./usr/lib/libisccc.so.8.4			base-bind-shlib		compatfile
+./usr/lib/libisccc.so.8.5			base-bind-shlib		compatfile
 ./usr/lib/libisccfg.sobase-bind-shlib		compatfile
 ./usr/lib/libisccfg.so.8			base-bind-shlib		compatfile
-./usr/lib/libisccfg.so.8.4			base-bind-shlib		compatfile
+./usr/lib/libisccfg.so.8.5			base-bind-shlib		compatfile
 ./usr/lib/libiscsi.sobase-iscsi-shlib	iscsi,compatfile
 ./usr/lib/libiscsi.so.2base-iscsi-shlib	iscsi,compatfile
 ./usr/lib/libiscsi.so.2.0			base-iscsi-shlib	iscsi,compatfile
@@ -378,7 +378,7 @@
 ./usr/lib/liblutok.so.2.0			base-sys-shlib		kyua,compatfile
 ./usr/lib/liblwres.sobase-bind-shlib		compatfile
 ./usr/lib/liblwres.so.8base-bind-shlib		compatfile
-./usr/lib/liblwres.so.8.4			base-bind-shlib		compatfile
+./usr/lib/liblwres.so.8.5			base-bind-shlib		compatfile
 ./usr/lib/liblzf.sobase-sys-shlib		compatfile
 ./usr/lib/liblzf.so.1base-sys-shlib		compatfile
 ./usr/lib/liblzf.so.1.0base-sys-shlib		compatfile

Index: src/distrib/sets/lists/debug/shl.mi
diff -u src/distrib/sets/lists/debug/shl.mi:1.176 src/distrib/sets/lists/debug/shl.mi:1.177
--- src/distrib/sets/lists/debug/shl.mi:1.176	Sat May 27 17:02:55 2017
+++ src/distrib/sets/lists/debug/shl.mi	Thu Jun 15 12:00:57 2017
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.176 2017/05/27 21:02:55 bouyer Exp $
+# $NetBSD: shl.mi,v 1.177 2017/06/15 16:00:57 christos Exp $
 ./usr/lib/libbfd_g.a		comp-c-debuglib	debuglib,compatfile,binutils
 ./usr/libdata/debug/lib		base-sys-usr	debug,dynamicroot,compatdir
 ./usr/libdata/debug/lib/libblacklist.so.0.0.debug		comp-sys-debug	debug,dynamicroot
@@ -64,7 +64,7 @@
 ./usr/libdata/debug/usr/lib/libavl.so.0.0.debug			comp-zfs-debug	debug,compatfile,zfs
 ./usr/libdata/debug/usr/lib/libbfd.so.14.0.debug		comp-sys-debug	debug,compatfile,binutils=226
 ./usr/libdata/debug/usr/lib/libbfd.so.15.0.debug		comp-sys-debug	debug,compatfile,binutils=227
-./usr/libdata/debug/usr/lib/libbind9.so.8.4.debug		comp-bind-debug	debug,compatfile
+./usr/libdata/debug/usr/lib/libbind9.so.8.5.debug		comp-bind-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libblacklist.so.0.0.debug		comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libbluetooth.so.4.2.debug		comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libbsdmalloc.so.0.0.debug		comp-sys-debug	debug,compatfile
@@ -83,7 +83,7 @@

CVS commit: src/external/bsd/bind

2017-06-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 15 15:59:43 UTC 2017

Modified Files:
src/external/bsd/bind/dist: CHANGES Makefile.in README acconfig.h
config.h.in configure configure.in isc-config.sh.1 srcid version
src/external/bsd/bind/dist/bin/check: named-checkconf.8
named-checkconf.c named-checkzone.8
src/external/bsd/bind/dist/bin/confgen: ddns-confgen.8 keygen.c
rndc-confgen.8 rndc-confgen.c
src/external/bsd/bind/dist/bin/delv: delv.c
src/external/bsd/bind/dist/bin/dig: dig.1 dig.c dighost.c host.1 host.c
nslookup.c
src/external/bsd/bind/dist/bin/dig/include/dig: dig.h
src/external/bsd/bind/dist/bin/dnssec: dnssec-dsfromkey.8
dnssec-importkey.8 dnssec-keyfromlabel.8 dnssec-keyfromlabel.c
dnssec-keygen.8 dnssec-keygen.c dnssec-revoke.8 dnssec-settime.8
dnssec-settime.c dnssec-signzone.8 dnssec-signzone.c
dnssec-verify.8 dnssectool.c dnssectool.h
src/external/bsd/bind/dist/bin/named: client.c config.c control.c
logconf.c lwresd.8 lwsearch.c main.c named.8 named.conf.5
named.conf.docbook named.conf.html query.c server.c update.c
xfrout.c zoneconf.c
src/external/bsd/bind/dist/bin/named/include/named: config.h globals.h
server.h
src/external/bsd/bind/dist/bin/named/unix: os.c
src/external/bsd/bind/dist/bin/nsupdate: nsupdate.1 nsupdate.c
src/external/bsd/bind/dist/bin/pkcs11: pkcs11-destroy.8 pkcs11-keygen.8
pkcs11-list.8
src/external/bsd/bind/dist/bin/python: dnssec-checkds.8
dnssec-checkds.docbook
src/external/bsd/bind/dist/bin/rndc: rndc.8 rndc.c rndc.conf.5
src/external/bsd/bind/dist/bin/tests: byname_test.c hash_test.c
rdata_test.c
src/external/bsd/bind/dist/bin/tests/atomic: t_atomic.c
src/external/bsd/bind/dist/bin/tests/dst: t_dst.c
src/external/bsd/bind/dist/bin/tests/hashes: t_hashes.c
src/external/bsd/bind/dist/bin/tests/system/lwresd: lwtest.c
src/external/bsd/bind/dist/bin/tests/system/stub: tests.sh
src/external/bsd/bind/dist/bin/tests/system/tkey: keycreate.c
keydelete.c
src/external/bsd/bind/dist/bin/tools: arpaname.1 genrandom.8
isc-hmac-fixup.8 isc-hmac-fixup.c named-journalprint.8 nsec3hash.8
src/external/bsd/bind/dist/contrib/sdb/ldap: zone2ldap.c
src/external/bsd/bind/dist/doc/arm: Bv9ARM.ch04.html Bv9ARM.ch06.html
Bv9ARM.ch07.html Bv9ARM.ch08.html Bv9ARM.ch09.html Bv9ARM.html
Bv9ARM.pdf man.arpaname.html man.ddns-confgen.html man.delv.html
man.dig.html man.dnssec-checkds.html man.dnssec-coverage.html
man.dnssec-dsfromkey.html man.dnssec-importkey.html
man.dnssec-keyfromlabel.html man.dnssec-keygen.html
man.dnssec-revoke.html man.dnssec-settime.html
man.dnssec-signzone.html man.dnssec-verify.html man.genrandom.html
man.host.html man.isc-hmac-fixup.html man.named-checkconf.html
man.named-checkzone.html man.named-journalprint.html
man.named-rrchecker.html man.named.html man.nsec3hash.html
man.nsupdate.html man.rndc-confgen.html man.rndc.conf.html
man.rndc.html
src/external/bsd/bind/dist/doc/misc: options
src/external/bsd/bind/dist/lib/bind9: check.c
src/external/bsd/bind/dist/lib/dns: acl.c adb.c api client.c db.c
dbtable.c dispatch.c dnssec.c dst_api.c dst_internal.h
dst_openssl.h dst_parse.c ecdb.c gssapictx.c hmac_link.c iptable.c
keytable.c masterdump.c message.c name.c ncache.c openssl_link.c
openssldh_link.c openssldsa_link.c opensslecdsa_link.c
opensslgost_link.c opensslrsa_link.c peer.c rbt.c rbtdb.c rcode.c
rdata.c rdataset.c rdataslab.c request.c resolver.c result.c
rootns.c rpz.c sdb.c sdlz.c spnego.c tkey.c tsec.c tsig.c view.c
xfrin.c zone.c zt.c
src/external/bsd/bind/dist/lib/dns/include/dns: db.h events.h
keytable.h masterdump.h message.h peer.h rbt.h rdata.h rdataslab.h
result.h rrl.h tsig.h types.h view.h zone.h zt.h
src/external/bsd/bind/dist/lib/dns/include/dst: gssapi.h
src/external/bsd/bind/dist/lib/dns/rdata/generic: opt_41.c
src/external/bsd/bind/dist/lib/dns/rdata/in_1: wks_11.c
src/external/bsd/bind/dist/lib/dns/tests: Makefile.in
src/external/bsd/bind/dist/lib/irs: getaddrinfo.c resconf.c
src/external/bsd/bind/dist/lib/isc: backtrace-emptytbl.c hash.c
hmacmd5.c hmacsha.c lex.c log.c md5.c netaddr.c print.c radix.c
random.c ratelimiter.c sha1.c sha2.c task.c
src/external/bsd/bind/dist/lib/isc/include/isc: backtrace.h event.h
hmacmd5.h hmacsha.h lex.h md5.h netaddr.h 

CVS commit: src/sys/dev/pci

2017-06-15 Thread Felix Deichmann
Module Name:src
Committed By:   flxd
Date:   Thu Jun 15 15:38:18 UTC 2017

Modified Files:
src/sys/dev/pci: pci_subr.c

Log Message:
Fix printf format/argument.


To generate a diff of this commit:
cvs rdiff -u -r1.188 -r1.189 src/sys/dev/pci/pci_subr.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/dev/pci/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.188 src/sys/dev/pci/pci_subr.c:1.189
--- src/sys/dev/pci/pci_subr.c:1.188	Thu Jun 15 06:51:18 2017
+++ src/sys/dev/pci/pci_subr.c	Thu Jun 15 15:38:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.188 2017/06/15 06:51:18 msaitoh Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.189 2017/06/15 15:38:18 flxd Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.188 2017/06/15 06:51:18 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.189 2017/06/15 15:38:18 flxd Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -3505,13 +3505,13 @@ pci_conf_print_ltr_cap(const pcireg_t *r
 	printf("\n  Latency Tolerance Reporting\n");
 	reg = regs[o2i(extcapoff + PCI_LTR_MAXSNOOPLAT)];
 	printf("Max Snoop Latency Register: 0x%04x\n", reg & 0x);
-	printf("  Max Snoop Latency: %luns\n",
-	__SHIFTOUT(reg, PCI_LTR_MAXSNOOPLAT_VAL)
-	* PCI_LTR_SCALETONS(__SHIFTOUT(reg, PCI_LTR_MAXSNOOPLAT_SCALE)));
+	printf("  Max Snoop Latency: %juns\n",
+	(uintmax_t)(__SHIFTOUT(reg, PCI_LTR_MAXSNOOPLAT_VAL)
+	* PCI_LTR_SCALETONS(__SHIFTOUT(reg, PCI_LTR_MAXSNOOPLAT_SCALE;
 	printf("Max No-Snoop Latency Register: 0x%04x\n", reg >> 16);
-	printf("  Max No-Snoop Latency: %luns\n",
-	__SHIFTOUT(reg, PCI_LTR_MAXNOSNOOPLAT_VAL)
-	* PCI_LTR_SCALETONS(__SHIFTOUT(reg, PCI_LTR_MAXNOSNOOPLAT_SCALE)));
+	printf("  Max No-Snoop Latency: %juns\n",
+	(uintmax_t)(__SHIFTOUT(reg, PCI_LTR_MAXNOSNOOPLAT_VAL)
+	* PCI_LTR_SCALETONS(__SHIFTOUT(reg, PCI_LTR_MAXNOSNOOPLAT_SCALE;
 }
 
 static void



CVS commit: src/etc/mtree

2017-06-15 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 15 15:20:14 UTC 2017

Modified Files:
src/etc/mtree: NetBSD.dist.tests

Log Message:
G/C libpthread_dbg from mtree

Remove entries:
 - ./usr/libdata/debug/usr/tests/lib/libpthread_dbg
 - ./usr/tests/lib/libpthread_dbg

Noted by  via private mail.


To generate a diff of this commit:
cvs rdiff -u -r1.147 -r1.148 src/etc/mtree/NetBSD.dist.tests

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

Modified files:

Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.147 src/etc/mtree/NetBSD.dist.tests:1.148
--- src/etc/mtree/NetBSD.dist.tests:1.147	Sat May 27 21:02:55 2017
+++ src/etc/mtree/NetBSD.dist.tests	Thu Jun 15 15:20:13 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.tests,v 1.147 2017/05/27 21:02:55 bouyer Exp $
+#	$NetBSD: NetBSD.dist.tests,v 1.148 2017/06/15 15:20:13 kamil Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -116,7 +116,6 @@
 ./usr/libdata/debug/usr/tests/lib/libprop
 ./usr/libdata/debug/usr/tests/lib/libpthread
 ./usr/libdata/debug/usr/tests/lib/libpthread/dlopen
-./usr/libdata/debug/usr/tests/lib/libpthread_dbg
 ./usr/libdata/debug/usr/tests/lib/librefuse
 ./usr/libdata/debug/usr/tests/lib/librt
 ./usr/libdata/debug/usr/tests/lib/librumpclient
@@ -303,7 +302,6 @@
 ./usr/tests/lib/libprop
 ./usr/tests/lib/libpthread
 ./usr/tests/lib/libpthread/dlopen
-./usr/tests/lib/libpthread_dbg
 ./usr/tests/lib/librefuse
 ./usr/tests/lib/librt
 ./usr/tests/lib/librumpclient



CVS commit: src/sys/ufs/lfs

2017-06-15 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Thu Jun 15 14:37:31 UTC 2017

Modified Files:
src/sys/ufs/lfs: lfs_segment.c

Log Message:
It isn't safe to drain dirops with seglock held, it'll deadlock if there
are any dirops. drain before grabbing seglock.

lfs_dirops == 0 is always true (as we already drained dirops), so omit
that part of the comparison.

Fixes a lot of LFS deadlocks. PR kern/52301

Many thanks to dholland for help analyzing coredumps


To generate a diff of this commit:
cvs rdiff -u -r1.271 -r1.272 src/sys/ufs/lfs/lfs_segment.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/ufs/lfs/lfs_segment.c
diff -u src/sys/ufs/lfs/lfs_segment.c:1.271 src/sys/ufs/lfs/lfs_segment.c:1.272
--- src/sys/ufs/lfs/lfs_segment.c:1.271	Mon Jun 12 15:02:32 2017
+++ src/sys/ufs/lfs/lfs_segment.c	Thu Jun 15 14:37:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_segment.c,v 1.271 2017/06/12 15:02:32 maya Exp $	*/
+/*	$NetBSD: lfs_segment.c,v 1.272 2017/06/15 14:37:30 maya Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.271 2017/06/12 15:02:32 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.272 2017/06/15 14:37:30 maya Exp $");
 
 #ifdef DEBUG
 # define vndebug(vp, str) do {		\
@@ -603,7 +603,6 @@ lfs_segwrite(struct mount *mp, int flags
 	SEGUSE *segusep;
 	int do_ckp, did_ckp, error;
 	unsigned n, segleft, maxseg, sn, i, curseg;
-	int writer_set = 0;
 	int dirty;
 	int redo;
 	SEGSUM *ssp;
@@ -628,6 +627,8 @@ lfs_segwrite(struct mount *mp, int flags
 	if (do_ckp)
 		flags &= ~SEGM_SINGLE;
 
+	lfs_writer_enter(fs, "lfs segwrite");
+
 	lfs_seglock(fs, flags | (do_ckp ? SEGM_CKP : 0));
 	sp = fs->lfs_sp;
 	if (sp->seg_flags & (SEGM_CLEAN | SEGM_CKP))
@@ -653,11 +654,7 @@ lfs_segwrite(struct mount *mp, int flags
 break;
 			}
 
-			if (do_ckp || fs->lfs_dirops == 0) {
-if (!writer_set) {
-	lfs_writer_enter(fs, "lfs writer");
-	writer_set = 1;
-}
+			if (do_ckp) {
 error = lfs_writevnodes(fs, mp, sp, VN_DIROP);
 if (um_error == 0)
 	um_error = error;
@@ -806,8 +803,7 @@ lfs_segwrite(struct mount *mp, int flags
 
 	/* Note Ifile no longer needs to be written */
 	fs->lfs_doifile = 0;
-	if (writer_set)
-		lfs_writer_leave(fs);
+	lfs_writer_leave(fs);
 
 	/*
 	 * If we didn't write the Ifile, we didn't really do anything.



CVS commit: src/doc

2017-06-15 Thread Felix Deichmann
Module Name:src
Committed By:   flxd
Date:   Thu Jun 15 14:23:42 UTC 2017

Modified Files:
src/doc: CHANGES

Log Message:
Note support for VAXstation 4000 TURBOchannel.


To generate a diff of this commit:
cvs rdiff -u -r1.2290 -r1.2291 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2290 src/doc/CHANGES:1.2291
--- src/doc/CHANGES:1.2290	Mon Jun 12 11:05:21 2017
+++ src/doc/CHANGES	Thu Jun 15 14:23:42 2017
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2290 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2291 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -25,5 +25,6 @@
 
 Changes from NetBSD 8.0 to NetBSD 9.0:
 	byacc: update to 20170430 [christos 20170605]
+	vax: Add support for VAXstation 4000 TURBOchannel. [flxd 20170609]
 	wsbell(4): added console bell support for all speaker devices, not
 		only those attached at pcppi [nat 20170612]



CVS commit: src/sys/arch/x86/x86

2017-06-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Jun 15 13:42:56 UTC 2017

Modified Files:
src/sys/arch/x86/x86: pmap.c

Log Message:
Fix a subtle but important bug in pmap_growkernel. When adding new toplevel
slots to pmap_kernel, we are implicitly using the recursive slot; but this
slot is in the active pmap, which may not be pmap_kernel. Therefore, adding
L4 slots is fine in itself, but when adding L3 slots the kernel faults
since the L4 slots that were just added are not active on the cpu.

So far this has never been triggered, because the current va limit makes it
impossible to add a new L4 slot, and i386 only has one level so the kernel
cannot fault in a lower level.

Now the tree is grown in the current pmap (cpm), copied into pmap_kernel,
and propagated in the other pmaps as expected.

Note that we're using CPUF_PRESENT, because this function may be called
early, before cpu0 is attached. It does add to the current mess in the
cpu attach code, so it will probably have to be revisited later.


To generate a diff of this commit:
cvs rdiff -u -r1.249 -r1.250 src/sys/arch/x86/x86/pmap.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/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.249 src/sys/arch/x86/x86/pmap.c:1.250
--- src/sys/arch/x86/x86/pmap.c:1.249	Thu Jun 15 09:31:48 2017
+++ src/sys/arch/x86/x86/pmap.c	Thu Jun 15 13:42:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.249 2017/06/15 09:31:48 maxv Exp $	*/
+/*	$NetBSD: pmap.c,v 1.250 2017/06/15 13:42:55 maxv Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.249 2017/06/15 09:31:48 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.250 2017/06/15 13:42:55 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -562,7 +562,7 @@ static void pmap_remove_ptes(struct pmap
 vaddr_t, struct pv_entry **);
 
 static paddr_t pmap_get_physpage(void);
-static void pmap_alloc_level(vaddr_t, long *);
+static void pmap_alloc_level(struct pmap *, vaddr_t, long *);
 
 static bool pmap_reactivate(struct pmap *);
 
@@ -4325,7 +4325,7 @@ pmap_get_physpage(void)
  * Used only by pmap_growkernel.
  */
 static void
-pmap_alloc_level(vaddr_t kva, long *needed_ptps)
+pmap_alloc_level(struct pmap *cpm, vaddr_t kva, long *needed_ptps)
 {
 	unsigned long i;
 	paddr_t pa;
@@ -4338,7 +4338,7 @@ pmap_alloc_level(vaddr_t kva, long *need
 
 	for (level = PTP_LEVELS; level > 1; level--) {
 		if (level == PTP_LEVELS)
-			pdep = pmap_kernel()->pm_pdir;
+			pdep = cpm->pm_pdir;
 		else
 			pdep = normal_pdes[level - 2];
 		index = pl_i_roundup(kva, level);
@@ -4398,10 +4398,11 @@ vaddr_t
 pmap_growkernel(vaddr_t maxkvaddr)
 {
 	struct pmap *kpm = pmap_kernel();
+	struct pmap *cpm;
 #if !defined(XEN) || !defined(__x86_64__)
 	struct pmap *pm;
-	long old;
 #endif
+	long old;
 	int s, i;
 	long needed_kptp[PTP_LEVELS], target_nptp;
 	bool invalidate = false;
@@ -4416,9 +4417,7 @@ pmap_growkernel(vaddr_t maxkvaddr)
 	}
 
 	maxkvaddr = x86_round_pdr(maxkvaddr);
-#if !defined(XEN) || !defined(__x86_64__)
 	old = nkptp[PTP_LEVELS - 1];
-#endif
 
 	/* Initialize needed_kptp. */
 	for (i = PTP_LEVELS - 1; i >= 1; i--) {
@@ -4431,12 +4430,28 @@ pmap_growkernel(vaddr_t maxkvaddr)
 		needed_kptp[i] = target_nptp - nkptp[i];
 	}
 
-	pmap_alloc_level(pmap_maxkvaddr, needed_kptp);
+	/* Get the current pmap */
+	if (__predict_true(cpu_info_primary.ci_flags & CPUF_PRESENT)) {
+		cpm = curcpu()->ci_pmap;
+	} else {
+		cpm = kpm;
+	}
+
+	pmap_alloc_level(cpm, pmap_maxkvaddr, needed_kptp);
 
 	/*
 	 * If the number of top level entries changed, update all pmaps.
 	 */
 	if (needed_kptp[PTP_LEVELS - 1] != 0) {
+		size_t newpdes;
+		newpdes = nkptp[PTP_LEVELS - 1] - old;
+
+		if (cpm != kpm) {
+			memcpy(>pm_pdir[PDIR_SLOT_KERN + old],
+			>pm_pdir[PDIR_SLOT_KERN + old],
+			newpdes * sizeof(pd_entry_t));
+		}
+
 #ifdef XEN
 #ifdef __x86_64__
 		/* nothing, kernel entries are never entered in user pmap */
@@ -4455,8 +4470,6 @@ pmap_growkernel(vaddr_t maxkvaddr)
 		mutex_exit(_lock);
 #endif /* __x86_64__ */
 #else /* XEN */
-		unsigned newpdes;
-		newpdes = nkptp[PTP_LEVELS - 1] - old;
 		mutex_enter(_lock);
 		LIST_FOREACH(pm, , pm_list) {
 			memcpy(>pm_pdir[PDIR_SLOT_KERN + old],



CVS commit: src/sys/opencrypto

2017-06-15 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Jun 15 12:45:10 UTC 2017

Modified Files:
src/sys/opencrypto: crypto.c

Log Message:
Reduce crypto_ret_q_mtx lock regions.

crypto.c does not access the members of crp when the crp is in crp_q or
crp_ret_q. Furthermore, crp_q and crp_ret_q are protected by each mutex,
so the members of crp is not shared. That means crp_flags is not required
mutex in crypto.c.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/opencrypto/crypto.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/opencrypto/crypto.c
diff -u src/sys/opencrypto/crypto.c:1.89 src/sys/opencrypto/crypto.c:1.90
--- src/sys/opencrypto/crypto.c:1.89	Wed Jun 14 07:38:24 2017
+++ src/sys/opencrypto/crypto.c	Thu Jun 15 12:45:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: crypto.c,v 1.89 2017/06/14 07:38:24 knakahara Exp $ */
+/*	$NetBSD: crypto.c,v 1.90 2017/06/15 12:45:10 knakahara Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.5 2003/02/26 00:14:05 sam Exp $	*/
 /*	$OpenBSD: crypto.c,v 1.41 2002/07/17 23:52:38 art Exp $	*/
 
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.89 2017/06/14 07:38:24 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.90 2017/06/15 12:45:10 knakahara Exp $");
 
 #include 
 #include 
@@ -1494,7 +1494,6 @@ crypto_kgetreq(int num __unused, int prf
 void
 crypto_done(struct cryptop *crp)
 {
-	int wasempty;
 
 	KASSERT(crp != NULL);
 
@@ -1520,9 +1519,7 @@ crypto_done(struct cryptop *crp)
   	 	* callback routine does very little (e.g. the
 	 	* /dev/crypto callback method just does a wakeup).
 	 	*/
-		mutex_spin_enter(_ret_q_mtx);
 		crp->crp_flags |= CRYPTO_F_DONE;
-		mutex_spin_exit(_ret_q_mtx);
 
 #ifdef CRYPTO_TIMING
 		if (crypto_timing) {
@@ -1539,7 +1536,6 @@ crypto_done(struct cryptop *crp)
 #endif
 		crp->crp_callback(crp);
 	} else {
-		mutex_spin_enter(_ret_q_mtx);
 		crp->crp_flags |= CRYPTO_F_DONE;
 #if 0
 		if (crp->crp_flags & CRYPTO_F_USER) {
@@ -1555,6 +1551,9 @@ crypto_done(struct cryptop *crp)
 		} else
 #endif
 		{
+			int wasempty;
+
+			mutex_spin_enter(_ret_q_mtx);
 			wasempty = TAILQ_EMPTY(_ret_q);
 			DPRINTF("lid[%u]: queueing %p\n",
 CRYPTO_SESID2LID(crp->crp_sid), crp);
@@ -1567,8 +1566,8 @@ crypto_done(struct cryptop *crp)
 	CRYPTO_SESID2LID(crp->crp_sid), crp);
 cv_signal(_cv);
 			}
+			mutex_spin_exit(_ret_q_mtx);
 		}
-		mutex_spin_exit(_ret_q_mtx);
 	}
 }
 
@@ -1578,7 +1577,6 @@ crypto_done(struct cryptop *crp)
 void
 crypto_kdone(struct cryptkop *krp)
 {
-	int wasempty;
 
 	KASSERT(krp != NULL);
 
@@ -1596,6 +1594,8 @@ crypto_kdone(struct cryptkop *krp)
 	if (krp->krp_flags & CRYPTO_F_CBIMM) {
 		krp->krp_callback(krp);
 	} else {
+		int wasempty;
+
 		mutex_spin_enter(_ret_q_mtx);
 		wasempty = TAILQ_EMPTY(_ret_kq);
 		krp->krp_flags |= CRYPTO_F_ONRETQ;



CVS commit: src/sys/opencrypto

2017-06-15 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Jun 15 12:41:18 UTC 2017

Modified Files:
src/sys/opencrypto: cryptodev.c cryptodev.h

Log Message:
Divide crp_devflags from crp_flags to write exclusively.

CRYPTO_F_DQRETQ(new name is CRYPTODEV_F_RET) is used by cryptodev.c only.
It should be divided to other member.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/opencrypto/cryptodev.c
cvs rdiff -u -r1.36 -r1.37 src/sys/opencrypto/cryptodev.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/opencrypto/cryptodev.c
diff -u src/sys/opencrypto/cryptodev.c:1.94 src/sys/opencrypto/cryptodev.c:1.95
--- src/sys/opencrypto/cryptodev.c:1.94	Thu Jun  8 09:49:46 2017
+++ src/sys/opencrypto/cryptodev.c	Thu Jun 15 12:41:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cryptodev.c,v 1.94 2017/06/08 09:49:46 knakahara Exp $ */
+/*	$NetBSD: cryptodev.c,v 1.95 2017/06/15 12:41:18 knakahara Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $	*/
 /*	$OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $	*/
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.94 2017/06/08 09:49:46 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.95 2017/06/15 12:41:18 knakahara Exp $");
 
 #include 
 #include 
@@ -689,7 +689,7 @@ eagain:
 		goto bail;
 	}
 
-	while (!(crp->crp_flags & CRYPTO_F_DQRETQ)) {
+	while (!(crp->crp_devflags & CRYPTODEV_F_RET)) {
 		DPRINTF("cse->sid[%d]: sleeping on cv %p for crp %p\n",
 			(uint32_t)cse->sid, >crp_cv, crp);
 		cv_wait(>crp_cv, _mtx);	/* XXX cv_wait_sig? */
@@ -763,7 +763,7 @@ cryptodev_cb(void *op)
 		mutex_enter(_mtx);
 	}
 	if (error != 0 || (crp->crp_flags & CRYPTO_F_DONE)) {
-		crp->crp_flags |= CRYPTO_F_DQRETQ;
+		crp->crp_devflags |= CRYPTODEV_F_RET;
 		cv_signal(>crp_cv);
 	}
 	mutex_exit(_mtx);
@@ -800,7 +800,7 @@ cryptodevkey_cb(void *op)
 	struct cryptkop *krp = op;
 	
 	mutex_enter(_mtx);
-	krp->krp_flags |= CRYPTO_F_DQRETQ;
+	krp->krp_devflags |= CRYPTODEV_F_RET;
 	cv_signal(>krp_cv);
 	mutex_exit(_mtx);
 	return 0;
@@ -915,7 +915,7 @@ cryptodev_key(struct crypt_kop *kop)
 	}
 
 	mutex_enter(_mtx);
-	while (!(krp->krp_flags & CRYPTO_F_DQRETQ)) {
+	while (!(krp->krp_devflags & CRYPTODEV_F_RET)) {
 		cv_wait(>krp_cv, _mtx);	/* XXX cv_wait_sig? */
 	}
 	mutex_exit(_mtx);

Index: src/sys/opencrypto/cryptodev.h
diff -u src/sys/opencrypto/cryptodev.h:1.36 src/sys/opencrypto/cryptodev.h:1.37
--- src/sys/opencrypto/cryptodev.h:1.36	Tue Jun  6 01:48:33 2017
+++ src/sys/opencrypto/cryptodev.h	Thu Jun 15 12:41:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cryptodev.h,v 1.36 2017/06/06 01:48:33 knakahara Exp $ */
+/*	$NetBSD: cryptodev.h,v 1.37 2017/06/15 12:41:18 knakahara Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/cryptodev.h,v 1.2.2.6 2003/07/02 17:04:50 sam Exp $	*/
 /*	$OpenBSD: cryptodev.h,v 1.33 2002/07/17 23:52:39 art Exp $	*/
 
@@ -461,8 +461,10 @@ struct cryptop {
 	 * should always check and use the new
 	 * value on future requests.
 	 */
-	int		crp_flags;	/* Note: must hold mutext to modify */
-
+	int		crp_flags;	/*
+	 * other than crypto.c must not write
+	 * after crypto_dispatch().
+	 */
 #define CRYPTO_F_IMBUF		0x0001	/* Input/output are mbuf chains */
 #define CRYPTO_F_IOV		0x0002	/* Input/output are uio */
 #define CRYPTO_F_REL		0x0004	/* Must return data in same place */
@@ -473,7 +475,9 @@ struct cryptop {
 #define	CRYPTO_F_ONRETQ		0x0080	/* Request is on return queue */
 #define	CRYPTO_F_USER		0x0100	/* Request is in user context */
 #define	CRYPTO_F_MORE		0x0200	/* more data to follow */
-#define	CRYPTO_F_DQRETQ		0x0400	/* Dequeued from crp_ret_{,k}q */
+
+	int		crp_devflags;	/* other than cryptodev.c must not use. */
+#define	CRYPTODEV_F_RET		0x0001	/* return from crypto.c to cryptodev.c */
 
 	void *		crp_buf;	/* Data to be processed */
 	void *		crp_opaque;	/* Opaque pointer, passed along */
@@ -528,6 +532,7 @@ struct cryptkop {
 	struct crparam	krp_param[CRK_MAXPARAM];	/* kvm */
 	int		(*krp_callback)(struct cryptkop *);
 	int		krp_flags;	/* same values as crp_flags */
+	int		krp_devflags;	/* same values as crp_devflags */
 	kcondvar_t	krp_cv;
 	struct fcrypt 	*fcrp;
 	struct crparam	crk_param[CRK_MAXPARAM];



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

2017-06-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Jun 15 11:25:52 UTC 2017

Modified Files:
src/sys/arch/amd64/include: vmparam.h

Log Message:
Correct these values. They must be consistent with NKL4_MAX_ENTRIES,
otherwise the kernel thinks it has ~126TB of va while pmap knows it
has only 512GB.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amd64/include/vmparam.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/arch/amd64/include/vmparam.h
diff -u src/sys/arch/amd64/include/vmparam.h:1.39 src/sys/arch/amd64/include/vmparam.h:1.40
--- src/sys/arch/amd64/include/vmparam.h:1.39	Sat Feb 11 15:05:15 2017
+++ src/sys/arch/amd64/include/vmparam.h	Thu Jun 15 11:25:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.39 2017/02/11 15:05:15 maxv Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.40 2017/06/15 11:25:52 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -108,22 +108,24 @@
  */
 #define	USRIOSIZE 	300
 
-/*
- * Mach derived constants
- */
-
-/* user/kernel map constants */
+/* User map constants */
 #define VM_MIN_ADDRESS		0
 #define VM_MAXUSER_ADDRESS	(0x7f80 - PAGE_SIZE)
+#define VM_MAXUSER_ADDRESS32	0xf000
 #define VM_MAX_ADDRESS		0x7fbfdfeff000
+
+/*
+ * Kernel map constants.
+ * MIN = VA_SIGN_NEG(L4_SLOT_KERN * NBPD_L4)
+ * MAX = MIN + NKL4_MAX_ENTRIES * NBPD_L4
+ */
 #ifndef XEN
 #define VM_MIN_KERNEL_ADDRESS	0x8000
-#else /* XEN */
+#define VM_MAX_KERNEL_ADDRESS	0x8080
+#else
 #define VM_MIN_KERNEL_ADDRESS	0xa000
+#define VM_MAX_KERNEL_ADDRESS	0xa080
 #endif
-#define VM_MAX_KERNEL_ADDRESS	0xfe80
-
-#define VM_MAXUSER_ADDRESS32	0xf000
 
 /*
  * The address to which unspecified mapping requests default



CVS commit: src/sys/arch/x86/x86

2017-06-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Jun 15 09:31:48 UTC 2017

Modified Files:
src/sys/arch/x86/x86: pmap.c

Log Message:
Mmh, correctly handle the physmem % lvl == 0 case. Don't know how I didn't
see this in the first place.


To generate a diff of this commit:
cvs rdiff -u -r1.248 -r1.249 src/sys/arch/x86/x86/pmap.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/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.248 src/sys/arch/x86/x86/pmap.c:1.249
--- src/sys/arch/x86/x86/pmap.c:1.248	Thu Jun 15 07:05:32 2017
+++ src/sys/arch/x86/x86/pmap.c	Thu Jun 15 09:31:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.248 2017/06/15 07:05:32 maxv Exp $	*/
+/*	$NetBSD: pmap.c,v 1.249 2017/06/15 09:31:48 maxv Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.248 2017/06/15 07:05:32 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.249 2017/06/15 09:31:48 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -1518,7 +1518,8 @@ pmap_init_directmap(struct pmap *kpm)
 			memset((void *)tmpva, 0, PAGE_SIZE);
 
 			pde = (pd_entry_t *)tmpva;
-			npd = (i == nL3e - 1) ? (nL2e % NPDPG) : NPDPG;
+			npd = ((i == nL3e - 1) && (nL2e % NPDPG != 0)) ?
+			(nL2e % NPDPG) : NPDPG;
 			for (n = 0; n < npd; n++) {
 pn = (i * NPDPG) + n;
 pde[n] = ((paddr_t)pn << L2_SHIFT) | pteflags |
@@ -1533,7 +1534,8 @@ pmap_init_directmap(struct pmap *kpm)
 			pmap_update_pg(tmpva);
 
 			pde = (pd_entry_t *)tmpva;
-			npd = (i == nL4e - 1) ? (nL3e % NPDPG) : NPDPG;
+			npd = ((i == nL4e - 1) && (nL3e % NPDPG != 0)) ?
+			(nL3e % NPDPG) : NPDPG;
 			for (n = 0; n < npd; n++) {
 pn = (i * NPDPG) + n;
 pde[n] = (L2page_pa + (pn << PAGE_SHIFT)) |



CVS commit: src/sys/arch/x86/x86

2017-06-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Jun 15 07:05:32 UTC 2017

Modified Files:
src/sys/arch/x86/x86: pmap.c

Log Message:
Limit the size of the direct map with a 2MB granularity (instead of 1GB).
This way if there's a computation error somewhere we will fault earlier
instead of letting the cpu access non-present physmem - which may cause
some bizarre behavior.


To generate a diff of this commit:
cvs rdiff -u -r1.247 -r1.248 src/sys/arch/x86/x86/pmap.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/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.247 src/sys/arch/x86/x86/pmap.c:1.248
--- src/sys/arch/x86/x86/pmap.c:1.247	Thu Jun 15 06:32:52 2017
+++ src/sys/arch/x86/x86/pmap.c	Thu Jun 15 07:05:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.247 2017/06/15 06:32:52 maxv Exp $	*/
+/*	$NetBSD: pmap.c,v 1.248 2017/06/15 07:05:32 maxv Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.247 2017/06/15 06:32:52 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.248 2017/06/15 07:05:32 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -1443,7 +1443,8 @@ pmap_init_directmap(struct pmap *kpm)
 	pt_entry_t *pte;
 	pd_entry_t *pde;
 	phys_ram_seg_t *mc;
-	size_t nL4e, nL3e, pn, npd;
+	size_t nL4e, nL3e, nL2e;
+	size_t pn, npd;
 	int i, n;
 
 	const pd_entry_t pteflags = PG_V | PG_KW | pmap_pg_nx;
@@ -1503,6 +1504,9 @@ pmap_init_directmap(struct pmap *kpm)
 		/* Allocate L2. */
 		L2page_pa = pmap_bootstrap_palloc(nL3e);
 
+		/* Number of L2 entries. */
+		nL2e = (lastpa + NBPD_L2 - 1) >> L2_SHIFT;
+
 		KASSERT(pmap_largepages != 0);
 
 		/* Large pages are supported. Just create L2. */
@@ -1514,7 +1518,8 @@ pmap_init_directmap(struct pmap *kpm)
 			memset((void *)tmpva, 0, PAGE_SIZE);
 
 			pde = (pd_entry_t *)tmpva;
-			for (n = 0; n < NPDPG; n++) {
+			npd = (i == nL3e - 1) ? (nL2e % NPDPG) : NPDPG;
+			for (n = 0; n < npd; n++) {
 pn = (i * NPDPG) + n;
 pde[n] = ((paddr_t)pn << L2_SHIFT) | pteflags |
 	PG_U | PG_PS | PG_G;



CVS commit: src/sys/dev/pci

2017-06-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jun 15 06:51:18 UTC 2017

Modified Files:
src/sys/dev/pci: pci_subr.c pcireg.h

Log Message:
 Fix a bug that LTR's latency in L1 PM Substates capability and Latency
Tolerance Reporting capability isn't printed correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.188 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.130 -r1.131 src/sys/dev/pci/pcireg.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/dev/pci/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.187 src/sys/dev/pci/pci_subr.c:1.188
--- src/sys/dev/pci/pci_subr.c:1.187	Thu Jun 15 05:42:27 2017
+++ src/sys/dev/pci/pci_subr.c	Thu Jun 15 06:51:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.187 2017/06/15 05:42:27 msaitoh Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.188 2017/06/15 06:51:18 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.187 2017/06/15 05:42:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.188 2017/06/15 06:51:18 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -3503,18 +3503,15 @@ pci_conf_print_ltr_cap(const pcireg_t *r
 	pcireg_t reg;
 
 	printf("\n  Latency Tolerance Reporting\n");
-	reg = regs[o2i(extcapoff + PCI_LTR_MAXSNOOPLAT)] & 0x;
-	printf("Max Snoop Latency Register: 0x%04x\n", reg);
-	printf("  Max Snoop LatencyValue: %u\n",
-	(pcireg_t)__SHIFTOUT(reg, PCI_LTR_MAXSNOOPLAT_VAL));
-	printf("  Max Snoop LatencyScale: %uns\n",
-	PCI_LTR_SCALETONS(__SHIFTOUT(reg, PCI_LTR_MAXSNOOPLAT_SCALE)));
-	reg = regs[o2i(extcapoff + PCI_LTR_MAXNOSNOOPLAT)] >> 16;
-	printf("Max No-Snoop Latency Register: 0x%04x\n", reg);
-	printf("  Max No-Snoop LatencyValue: %u\n",
-	(pcireg_t)__SHIFTOUT(reg, PCI_LTR_MAXNOSNOOPLAT_VAL));
-	printf("  Max No-Snoop LatencyScale: %uns\n",
-	PCI_LTR_SCALETONS(__SHIFTOUT(reg, PCI_LTR_MAXNOSNOOPLAT_SCALE)));
+	reg = regs[o2i(extcapoff + PCI_LTR_MAXSNOOPLAT)];
+	printf("Max Snoop Latency Register: 0x%04x\n", reg & 0x);
+	printf("  Max Snoop Latency: %luns\n",
+	__SHIFTOUT(reg, PCI_LTR_MAXSNOOPLAT_VAL)
+	* PCI_LTR_SCALETONS(__SHIFTOUT(reg, PCI_LTR_MAXSNOOPLAT_SCALE)));
+	printf("Max No-Snoop Latency Register: 0x%04x\n", reg >> 16);
+	printf("  Max No-Snoop Latency: %luns\n",
+	__SHIFTOUT(reg, PCI_LTR_MAXNOSNOOPLAT_VAL)
+	* PCI_LTR_SCALETONS(__SHIFTOUT(reg, PCI_LTR_MAXNOSNOOPLAT_SCALE)));
 }
 
 static void

Index: src/sys/dev/pci/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.130 src/sys/dev/pci/pcireg.h:1.131
--- src/sys/dev/pci/pcireg.h:1.130	Mon May 29 07:09:20 2017
+++ src/sys/dev/pci/pcireg.h	Thu Jun 15 06:51:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.130 2017/05/29 07:09:20 msaitoh Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.131 2017/06/15 06:51:18 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -1877,7 +1877,7 @@ struct pci_rom {
 #define	PCI_LTR_MAXNOSNOOPLAT	0x04	/* Max No-Snoop Latency */
 #define	PCI_LTR_MAXNOSNOOPLAT_VAL __BITS(25, 16) /* Max No-Snoop LatencyValue*/
 #define	PCI_LTR_MAXNOSNOOPLAT_SCALE __BITS(28, 26) /*Max NoSnoop LatencyScale*/
-#define	PCI_LTR_SCALETONS(x) ((32 << (x)) / 32)
+#define	PCI_LTR_SCALETONS(x) (1 << ((x) * 5))
 
 /*
  * Extended capability ID: 0x0019



CVS commit: src/sys/arch/x86/x86

2017-06-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Jun 15 06:32:52 UTC 2017

Modified Files:
src/sys/arch/x86/x86: pmap.c

Log Message:
Reorder these loops to reduce the number of enter->flush. I figured out
yesterday that this has a clear impact: a system with 16TB of hard-coded
ram has a 4-second black screen when booting. Now we're down to < 0.5s.

It could be optimized more, but verily I don't have a machine with P1GB
right now.


To generate a diff of this commit:
cvs rdiff -u -r1.246 -r1.247 src/sys/arch/x86/x86/pmap.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/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.246 src/sys/arch/x86/x86/pmap.c:1.247
--- src/sys/arch/x86/x86/pmap.c:1.246	Wed Jun 14 14:17:15 2017
+++ src/sys/arch/x86/x86/pmap.c	Thu Jun 15 06:32:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.246 2017/06/14 14:17:15 maxv Exp $	*/
+/*	$NetBSD: pmap.c,v 1.247 2017/06/15 06:32:52 maxv Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.246 2017/06/14 14:17:15 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.247 2017/06/15 06:32:52 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -1443,8 +1443,8 @@ pmap_init_directmap(struct pmap *kpm)
 	pt_entry_t *pte;
 	pd_entry_t *pde;
 	phys_ram_seg_t *mc;
-	size_t nL4e, nL3e;
-	int i;
+	size_t nL4e, nL3e, pn, npd;
+	int i, n;
 
 	const pd_entry_t pteflags = PG_V | PG_KW | pmap_pg_nx;
 
@@ -1503,36 +1503,37 @@ pmap_init_directmap(struct pmap *kpm)
 		/* Allocate L2. */
 		L2page_pa = pmap_bootstrap_palloc(nL3e);
 
-		/* Zero out the L2 pages. */
+		KASSERT(pmap_largepages != 0);
+
+		/* Large pages are supported. Just create L2. */
 		for (i = 0; i < nL3e; i++) {
 			pdp = L2page_pa + i * PAGE_SIZE;
 			*pte = (pdp & PG_FRAME) | pteflags;
 			pmap_update_pg(tmpva);
 
 			memset((void *)tmpva, 0, PAGE_SIZE);
-		}
 
-		KASSERT(pmap_largepages != 0);
-
-		/* Large pages are supported. Just create L2. */
-		for (i = 0; i < NPDPG * nL3e; i++) {
-			pdp = (paddr_t)&(((pd_entry_t *)L2page_pa)[i]);
-			*pte = (pdp & PG_FRAME) | pteflags;
-			pmap_update_pg(tmpva);
-
-			pde = (pd_entry_t *)(tmpva + (pdp & ~PG_FRAME));
-			*pde = ((paddr_t)i << L2_SHIFT) | pteflags |
-			PG_U | PG_PS | PG_G;
+			pde = (pd_entry_t *)tmpva;
+			for (n = 0; n < NPDPG; n++) {
+pn = (i * NPDPG) + n;
+pde[n] = ((paddr_t)pn << L2_SHIFT) | pteflags |
+	PG_U | PG_PS | PG_G;
+			}
 		}
 
 		/* Fill in the L3 entries, linked to L2. */
-		for (i = 0; i < nL3e; i++) {
-			pdp = (paddr_t)&(((pd_entry_t *)L3page_pa)[i]);
+		for (i = 0; i < nL4e; i++) {
+			pdp = L3page_pa + i * PAGE_SIZE;
 			*pte = (pdp & PG_FRAME) | pteflags;
 			pmap_update_pg(tmpva);
 
-			pde = (pd_entry_t *)(tmpva + (pdp & ~PG_FRAME));
-			*pde = (L2page_pa + (i << PAGE_SHIFT)) | pteflags | PG_U;
+			pde = (pd_entry_t *)tmpva;
+			npd = (i == nL4e - 1) ? (nL3e % NPDPG) : NPDPG;
+			for (n = 0; n < npd; n++) {
+pn = (i * NPDPG) + n;
+pde[n] = (L2page_pa + (pn << PAGE_SHIFT)) |
+pteflags | PG_U;
+			}
 		}
 	}
 



CVS commit: [netbsd-6] src/doc

2017-06-15 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jun 15 06:04:25 UTC 2017

Modified Files:
src/doc [netbsd-6]: CHANGES-6.2

Log Message:
1456


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.285 -r1.1.2.286 src/doc/CHANGES-6.2

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

Modified files:

Index: src/doc/CHANGES-6.2
diff -u src/doc/CHANGES-6.2:1.1.2.285 src/doc/CHANGES-6.2:1.1.2.286
--- src/doc/CHANGES-6.2:1.1.2.285	Sat Jun  3 17:26:55 2017
+++ src/doc/CHANGES-6.2	Thu Jun 15 06:04:24 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.285 2017/06/03 17:26:55 snj Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.286 2017/06/15 06:04:24 snj Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -17783,3 +17783,11 @@ crypto/external/bsd/openssh/dist/moduli	
 	Update moduli file.
 	[aymeric/christos, ticket #1422]
 
+sys/arch/ews4800mips/sbd/fb_sbdio.c		1.16
+sys/arch/pmax/ibus/pm.c1.13
+sys/dev/hpc/bivideo.c1.34
+sys/dev/ic/sti.c1.19
+
+	Fix size checks so they can't be circumvented by integer overflows.
+	[spz, ticket #1456]
+



CVS commit: [netbsd-6-1] src/sys

2017-06-15 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jun 15 06:02:58 UTC 2017

Modified Files:
src/sys/arch/ews4800mips/sbd [netbsd-6-1]: fb_sbdio.c
src/sys/arch/pmax/ibus [netbsd-6-1]: pm.c
src/sys/dev/hpc [netbsd-6-1]: bivideo.c
src/sys/dev/ic [netbsd-6-1]: sti.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #1456):
sys/arch/ews4800mips/sbd/fb_sbdio.c: revision 1.16
sys/arch/pmax/ibus/pm.c: revision 1.13
sys/dev/hpc/bivideo.c: revision 1.34
sys/dev/ic/sti.c: revision 1.19
correct size checks so they cannot be circumvented by integer overflows
reported by CTurt, thanks for the notification


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.16.1 src/sys/arch/ews4800mips/sbd/fb_sbdio.c
cvs rdiff -u -r1.11 -r1.11.16.1 src/sys/arch/pmax/ibus/pm.c
cvs rdiff -u -r1.32 -r1.32.22.1 src/sys/dev/hpc/bivideo.c
cvs rdiff -u -r1.16 -r1.16.22.1 src/sys/dev/ic/sti.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/arch/ews4800mips/sbd/fb_sbdio.c
diff -u src/sys/arch/ews4800mips/sbd/fb_sbdio.c:1.12 src/sys/arch/ews4800mips/sbd/fb_sbdio.c:1.12.16.1
--- src/sys/arch/ews4800mips/sbd/fb_sbdio.c:1.12	Wed Jan 11 21:17:33 2012
+++ src/sys/arch/ews4800mips/sbd/fb_sbdio.c	Thu Jun 15 06:02:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fb_sbdio.c,v 1.12 2012/01/11 21:17:33 macallan Exp $	*/
+/*	$NetBSD: fb_sbdio.c,v 1.12.16.1 2017/06/15 06:02:57 snj Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2005 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #define WIRED_FB_TLB
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fb_sbdio.c,v 1.12 2012/01/11 21:17:33 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fb_sbdio.c,v 1.12.16.1 2017/06/15 06:02:57 snj Exp $");
 
 #include 
 #include 
@@ -304,6 +304,8 @@ _fb_ioctl(void *v, void *vs, u_long cmd,
 		if (ri->ri_flg == RI_FORCEMONO)
 			break;
 		ga_clut_get(ga);
+		if (cmap->index >= 256 || cmap->count > 256 - cmap->index)
+			return (EINVAL);
 		for (i = 0; i < cmap->count; i++) {
 			cmap->red[i] = ga->clut[cmap->index + i][0];
 			cmap->green[i] = ga->clut[cmap->index + i][1];
@@ -314,6 +316,8 @@ _fb_ioctl(void *v, void *vs, u_long cmd,
 	case WSDISPLAYIO_PUTCMAP:
 		if (ri->ri_flg == RI_FORCEMONO)
 			break;
+		if (cmap->index >= 256 || cmap->count > 256 - cmap->index)
+			return (EINVAL);
 		for (i = 0; i < cmap->count; i++) {
 			ga->clut[cmap->index + i][0] = cmap->red[i];
 			ga->clut[cmap->index + i][1] = cmap->green[i];

Index: src/sys/arch/pmax/ibus/pm.c
diff -u src/sys/arch/pmax/ibus/pm.c:1.11 src/sys/arch/pmax/ibus/pm.c:1.11.16.1
--- src/sys/arch/pmax/ibus/pm.c:1.11	Wed Jan 11 21:17:33 2012
+++ src/sys/arch/pmax/ibus/pm.c	Thu Jun 15 06:02:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pm.c,v 1.11 2012/01/11 21:17:33 macallan Exp $	*/
+/*	$NetBSD: pm.c,v 1.11.16.1 2017/06/15 06:02:57 snj Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pm.c,v 1.11 2012/01/11 21:17:33 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pm.c,v 1.11.16.1 2017/06/15 06:02:57 snj Exp $");
 
 #include 
 #include 
@@ -668,7 +668,7 @@ pm_get_cmap(struct pm_softc *sc, struct 
 	index = p->index;
 	count = p->count;
 
-	if (index >= sc->sc_cmap_size || (index + count) > sc->sc_cmap_size)
+	if (index >= sc->sc_cmap_size || count > sc->sc_cmap_size - index)
 		return (EINVAL);
 
 	if ((rv = copyout(>sc_cmap.r[index], p->red, count)) != 0)
@@ -687,7 +687,7 @@ pm_set_cmap(struct pm_softc *sc, struct 
 	index = p->index;
 	count = p->count;
 
-	if (index >= sc->sc_cmap_size || (index + count) > sc->sc_cmap_size)
+	if (index >= sc->sc_cmap_size || count > sc->sc_cmap_size - index)
 		return (EINVAL);
 
 	if ((rv = copyin(p->red, >sc_cmap.r[index], count)) != 0)

Index: src/sys/dev/hpc/bivideo.c
diff -u src/sys/dev/hpc/bivideo.c:1.32 src/sys/dev/hpc/bivideo.c:1.32.22.1
--- src/sys/dev/hpc/bivideo.c:1.32	Sat Nov 13 13:51:58 2010
+++ src/sys/dev/hpc/bivideo.c	Thu Jun 15 06:02:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bivideo.c,v 1.32 2010/11/13 13:51:58 uebayasi Exp $	*/
+/*	$NetBSD: bivideo.c,v 1.32.22.1 2017/06/15 06:02:57 snj Exp $	*/
 
 /*-
  * Copyright (c) 1999-2001
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bivideo.c,v 1.32 2010/11/13 13:51:58 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bivideo.c,v 1.32.22.1 2017/06/15 06:02:57 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_hpcfb.h"
@@ -403,8 +403,8 @@ bivideo_ioctl(void *v, u_long cmd, void 
 
 		if (sc->sc_fbconf.hf_class != HPCFB_CLASS_INDEXCOLOR ||
 		sc->sc_fbconf.hf_pack_width != 8 ||
-		256 <= cmap->index ||
-		256 < (cmap->index + cmap->count))
+		cmap->index >= 256 ||
+		cmap->count > 256 - cmap->index)
 			return (EINVAL);
 
 		error = copyout(_cmap_r[cmap->index], cmap->red,

Index: src/sys/dev/ic/sti.c
diff -u src/sys/dev/ic/sti.c:1.16 

CVS commit: [netbsd-6] src/sys

2017-06-15 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jun 15 06:04:01 UTC 2017

Modified Files:
src/sys/arch/ews4800mips/sbd [netbsd-6]: fb_sbdio.c
src/sys/arch/pmax/ibus [netbsd-6]: pm.c
src/sys/dev/hpc [netbsd-6]: bivideo.c
src/sys/dev/ic [netbsd-6]: sti.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #1456):
sys/arch/ews4800mips/sbd/fb_sbdio.c: revision 1.16
sys/arch/pmax/ibus/pm.c: revision 1.13
sys/dev/hpc/bivideo.c: revision 1.34
sys/dev/ic/sti.c: revision 1.19
correct size checks so they cannot be circumvented by integer overflows
reported by CTurt, thanks for the notification


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.2.1 src/sys/arch/ews4800mips/sbd/fb_sbdio.c
cvs rdiff -u -r1.11 -r1.11.2.1 src/sys/arch/pmax/ibus/pm.c
cvs rdiff -u -r1.32 -r1.32.14.1 src/sys/dev/hpc/bivideo.c
cvs rdiff -u -r1.16.8.1 -r1.16.8.2 src/sys/dev/ic/sti.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/arch/ews4800mips/sbd/fb_sbdio.c
diff -u src/sys/arch/ews4800mips/sbd/fb_sbdio.c:1.12 src/sys/arch/ews4800mips/sbd/fb_sbdio.c:1.12.2.1
--- src/sys/arch/ews4800mips/sbd/fb_sbdio.c:1.12	Wed Jan 11 21:17:33 2012
+++ src/sys/arch/ews4800mips/sbd/fb_sbdio.c	Thu Jun 15 06:04:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fb_sbdio.c,v 1.12 2012/01/11 21:17:33 macallan Exp $	*/
+/*	$NetBSD: fb_sbdio.c,v 1.12.2.1 2017/06/15 06:04:01 snj Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2005 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #define WIRED_FB_TLB
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fb_sbdio.c,v 1.12 2012/01/11 21:17:33 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fb_sbdio.c,v 1.12.2.1 2017/06/15 06:04:01 snj Exp $");
 
 #include 
 #include 
@@ -304,6 +304,8 @@ _fb_ioctl(void *v, void *vs, u_long cmd,
 		if (ri->ri_flg == RI_FORCEMONO)
 			break;
 		ga_clut_get(ga);
+		if (cmap->index >= 256 || cmap->count > 256 - cmap->index)
+			return (EINVAL);
 		for (i = 0; i < cmap->count; i++) {
 			cmap->red[i] = ga->clut[cmap->index + i][0];
 			cmap->green[i] = ga->clut[cmap->index + i][1];
@@ -314,6 +316,8 @@ _fb_ioctl(void *v, void *vs, u_long cmd,
 	case WSDISPLAYIO_PUTCMAP:
 		if (ri->ri_flg == RI_FORCEMONO)
 			break;
+		if (cmap->index >= 256 || cmap->count > 256 - cmap->index)
+			return (EINVAL);
 		for (i = 0; i < cmap->count; i++) {
 			ga->clut[cmap->index + i][0] = cmap->red[i];
 			ga->clut[cmap->index + i][1] = cmap->green[i];

Index: src/sys/arch/pmax/ibus/pm.c
diff -u src/sys/arch/pmax/ibus/pm.c:1.11 src/sys/arch/pmax/ibus/pm.c:1.11.2.1
--- src/sys/arch/pmax/ibus/pm.c:1.11	Wed Jan 11 21:17:33 2012
+++ src/sys/arch/pmax/ibus/pm.c	Thu Jun 15 06:04:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pm.c,v 1.11 2012/01/11 21:17:33 macallan Exp $	*/
+/*	$NetBSD: pm.c,v 1.11.2.1 2017/06/15 06:04:01 snj Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pm.c,v 1.11 2012/01/11 21:17:33 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pm.c,v 1.11.2.1 2017/06/15 06:04:01 snj Exp $");
 
 #include 
 #include 
@@ -668,7 +668,7 @@ pm_get_cmap(struct pm_softc *sc, struct 
 	index = p->index;
 	count = p->count;
 
-	if (index >= sc->sc_cmap_size || (index + count) > sc->sc_cmap_size)
+	if (index >= sc->sc_cmap_size || count > sc->sc_cmap_size - index)
 		return (EINVAL);
 
 	if ((rv = copyout(>sc_cmap.r[index], p->red, count)) != 0)
@@ -687,7 +687,7 @@ pm_set_cmap(struct pm_softc *sc, struct 
 	index = p->index;
 	count = p->count;
 
-	if (index >= sc->sc_cmap_size || (index + count) > sc->sc_cmap_size)
+	if (index >= sc->sc_cmap_size || count > sc->sc_cmap_size - index)
 		return (EINVAL);
 
 	if ((rv = copyin(p->red, >sc_cmap.r[index], count)) != 0)

Index: src/sys/dev/hpc/bivideo.c
diff -u src/sys/dev/hpc/bivideo.c:1.32 src/sys/dev/hpc/bivideo.c:1.32.14.1
--- src/sys/dev/hpc/bivideo.c:1.32	Sat Nov 13 13:51:58 2010
+++ src/sys/dev/hpc/bivideo.c	Thu Jun 15 06:04:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bivideo.c,v 1.32 2010/11/13 13:51:58 uebayasi Exp $	*/
+/*	$NetBSD: bivideo.c,v 1.32.14.1 2017/06/15 06:04:01 snj Exp $	*/
 
 /*-
  * Copyright (c) 1999-2001
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bivideo.c,v 1.32 2010/11/13 13:51:58 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bivideo.c,v 1.32.14.1 2017/06/15 06:04:01 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_hpcfb.h"
@@ -403,8 +403,8 @@ bivideo_ioctl(void *v, u_long cmd, void 
 
 		if (sc->sc_fbconf.hf_class != HPCFB_CLASS_INDEXCOLOR ||
 		sc->sc_fbconf.hf_pack_width != 8 ||
-		256 <= cmap->index ||
-		256 < (cmap->index + cmap->count))
+		cmap->index >= 256 ||
+		cmap->count > 256 - cmap->index)
 			return (EINVAL);
 
 		error = copyout(_cmap_r[cmap->index], cmap->red,

Index: src/sys/dev/ic/sti.c
diff -u src/sys/dev/ic/sti.c:1.16.8.1 

CVS commit: [netbsd-6-1] src/doc

2017-06-15 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jun 15 06:03:15 UTC 2017

Modified Files:
src/doc [netbsd-6-1]: CHANGES-6.1.6

Log Message:
1456


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.92 -r1.1.2.93 src/doc/CHANGES-6.1.6

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

Modified files:

Index: src/doc/CHANGES-6.1.6
diff -u src/doc/CHANGES-6.1.6:1.1.2.92 src/doc/CHANGES-6.1.6:1.1.2.93
--- src/doc/CHANGES-6.1.6:1.1.2.92	Sat Jun  3 17:26:42 2017
+++ src/doc/CHANGES-6.1.6	Thu Jun 15 06:03:15 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.1.6,v 1.1.2.92 2017/06/03 17:26:42 snj Exp $
+# $NetBSD: CHANGES-6.1.6,v 1.1.2.93 2017/06/15 06:03:15 snj Exp $
 
 A complete list of changes from the NetBSD 6.1.5 release to the NetBSD 6.1.6
 release:
@@ -11830,3 +11830,11 @@ crypto/external/bsd/openssh/dist/moduli	
 	Update moduli file.
 	[aymeric/christos, ticket #1422]
 
+sys/arch/ews4800mips/sbd/fb_sbdio.c		1.16
+sys/arch/pmax/ibus/pm.c1.13
+sys/dev/hpc/bivideo.c1.34
+sys/dev/ic/sti.c1.19
+
+	Fix size checks so they can't be circumvented by integer overflows.
+	[spz, ticket #1456]
+



CVS commit: [netbsd-6-0] src/doc

2017-06-15 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jun 15 06:02:28 UTC 2017

Modified Files:
src/doc [netbsd-6-0]: CHANGES-6.0.7

Log Message:
1456


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.94 -r1.1.2.95 src/doc/CHANGES-6.0.7

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

Modified files:

Index: src/doc/CHANGES-6.0.7
diff -u src/doc/CHANGES-6.0.7:1.1.2.94 src/doc/CHANGES-6.0.7:1.1.2.95
--- src/doc/CHANGES-6.0.7:1.1.2.94	Sat Jun  3 17:26:27 2017
+++ src/doc/CHANGES-6.0.7	Thu Jun 15 06:02:27 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0.7,v 1.1.2.94 2017/06/03 17:26:27 snj Exp $
+# $NetBSD: CHANGES-6.0.7,v 1.1.2.95 2017/06/15 06:02:27 snj Exp $
 
 A complete list of changes from the NetBSD 6.0.6 release to the NetBSD 6.0.7
 release:
@@ -12131,3 +12131,11 @@ crypto/external/bsd/openssh/dist/moduli	
 	Update moduli file.
 	[aymeric/christos, ticket #1422]
 
+sys/arch/ews4800mips/sbd/fb_sbdio.c		1.16
+sys/arch/pmax/ibus/pm.c1.13
+sys/dev/hpc/bivideo.c1.34
+sys/dev/ic/sti.c1.19
+
+	Fix size checks so they can't be circumvented by integer overflows.
+	[spz, ticket #1456]
+



CVS commit: [netbsd-6-0] src/sys

2017-06-15 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jun 15 06:02:09 UTC 2017

Modified Files:
src/sys/arch/ews4800mips/sbd [netbsd-6-0]: fb_sbdio.c
src/sys/arch/pmax/ibus [netbsd-6-0]: pm.c
src/sys/dev/hpc [netbsd-6-0]: bivideo.c
src/sys/dev/ic [netbsd-6-0]: sti.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #1456):
sys/arch/ews4800mips/sbd/fb_sbdio.c: revision 1.16
sys/arch/pmax/ibus/pm.c: revision 1.13
sys/dev/hpc/bivideo.c: revision 1.34
sys/dev/ic/sti.c: revision 1.19
correct size checks so they cannot be circumvented by integer overflows
reported by CTurt, thanks for the notification


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.8.1 src/sys/arch/ews4800mips/sbd/fb_sbdio.c
cvs rdiff -u -r1.11 -r1.11.8.1 src/sys/arch/pmax/ibus/pm.c
cvs rdiff -u -r1.32 -r1.32.20.1 src/sys/dev/hpc/bivideo.c
cvs rdiff -u -r1.16 -r1.16.14.1 src/sys/dev/ic/sti.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/arch/ews4800mips/sbd/fb_sbdio.c
diff -u src/sys/arch/ews4800mips/sbd/fb_sbdio.c:1.12 src/sys/arch/ews4800mips/sbd/fb_sbdio.c:1.12.8.1
--- src/sys/arch/ews4800mips/sbd/fb_sbdio.c:1.12	Wed Jan 11 21:17:33 2012
+++ src/sys/arch/ews4800mips/sbd/fb_sbdio.c	Thu Jun 15 06:02:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fb_sbdio.c,v 1.12 2012/01/11 21:17:33 macallan Exp $	*/
+/*	$NetBSD: fb_sbdio.c,v 1.12.8.1 2017/06/15 06:02:08 snj Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2005 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #define WIRED_FB_TLB
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fb_sbdio.c,v 1.12 2012/01/11 21:17:33 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fb_sbdio.c,v 1.12.8.1 2017/06/15 06:02:08 snj Exp $");
 
 #include 
 #include 
@@ -304,6 +304,8 @@ _fb_ioctl(void *v, void *vs, u_long cmd,
 		if (ri->ri_flg == RI_FORCEMONO)
 			break;
 		ga_clut_get(ga);
+		if (cmap->index >= 256 || cmap->count > 256 - cmap->index)
+			return (EINVAL);
 		for (i = 0; i < cmap->count; i++) {
 			cmap->red[i] = ga->clut[cmap->index + i][0];
 			cmap->green[i] = ga->clut[cmap->index + i][1];
@@ -314,6 +316,8 @@ _fb_ioctl(void *v, void *vs, u_long cmd,
 	case WSDISPLAYIO_PUTCMAP:
 		if (ri->ri_flg == RI_FORCEMONO)
 			break;
+		if (cmap->index >= 256 || cmap->count > 256 - cmap->index)
+			return (EINVAL);
 		for (i = 0; i < cmap->count; i++) {
 			ga->clut[cmap->index + i][0] = cmap->red[i];
 			ga->clut[cmap->index + i][1] = cmap->green[i];

Index: src/sys/arch/pmax/ibus/pm.c
diff -u src/sys/arch/pmax/ibus/pm.c:1.11 src/sys/arch/pmax/ibus/pm.c:1.11.8.1
--- src/sys/arch/pmax/ibus/pm.c:1.11	Wed Jan 11 21:17:33 2012
+++ src/sys/arch/pmax/ibus/pm.c	Thu Jun 15 06:02:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pm.c,v 1.11 2012/01/11 21:17:33 macallan Exp $	*/
+/*	$NetBSD: pm.c,v 1.11.8.1 2017/06/15 06:02:08 snj Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pm.c,v 1.11 2012/01/11 21:17:33 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pm.c,v 1.11.8.1 2017/06/15 06:02:08 snj Exp $");
 
 #include 
 #include 
@@ -668,7 +668,7 @@ pm_get_cmap(struct pm_softc *sc, struct 
 	index = p->index;
 	count = p->count;
 
-	if (index >= sc->sc_cmap_size || (index + count) > sc->sc_cmap_size)
+	if (index >= sc->sc_cmap_size || count > sc->sc_cmap_size - index)
 		return (EINVAL);
 
 	if ((rv = copyout(>sc_cmap.r[index], p->red, count)) != 0)
@@ -687,7 +687,7 @@ pm_set_cmap(struct pm_softc *sc, struct 
 	index = p->index;
 	count = p->count;
 
-	if (index >= sc->sc_cmap_size || (index + count) > sc->sc_cmap_size)
+	if (index >= sc->sc_cmap_size || count > sc->sc_cmap_size - index)
 		return (EINVAL);
 
 	if ((rv = copyin(p->red, >sc_cmap.r[index], count)) != 0)

Index: src/sys/dev/hpc/bivideo.c
diff -u src/sys/dev/hpc/bivideo.c:1.32 src/sys/dev/hpc/bivideo.c:1.32.20.1
--- src/sys/dev/hpc/bivideo.c:1.32	Sat Nov 13 13:51:58 2010
+++ src/sys/dev/hpc/bivideo.c	Thu Jun 15 06:02:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bivideo.c,v 1.32 2010/11/13 13:51:58 uebayasi Exp $	*/
+/*	$NetBSD: bivideo.c,v 1.32.20.1 2017/06/15 06:02:08 snj Exp $	*/
 
 /*-
  * Copyright (c) 1999-2001
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bivideo.c,v 1.32 2010/11/13 13:51:58 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bivideo.c,v 1.32.20.1 2017/06/15 06:02:08 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_hpcfb.h"
@@ -403,8 +403,8 @@ bivideo_ioctl(void *v, u_long cmd, void 
 
 		if (sc->sc_fbconf.hf_class != HPCFB_CLASS_INDEXCOLOR ||
 		sc->sc_fbconf.hf_pack_width != 8 ||
-		256 <= cmap->index ||
-		256 < (cmap->index + cmap->count))
+		cmap->index >= 256 ||
+		cmap->count > 256 - cmap->index)
 			return (EINVAL);
 
 		error = copyout(_cmap_r[cmap->index], cmap->red,

Index: src/sys/dev/ic/sti.c
diff -u src/sys/dev/ic/sti.c:1.16 

CVS commit: [netbsd-7] src/doc

2017-06-15 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jun 15 05:59:39 UTC 2017

Modified Files:
src/doc [netbsd-7]: CHANGES-7.2

Log Message:
1432


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.20 -r1.1.2.21 src/doc/CHANGES-7.2

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

Modified files:

Index: src/doc/CHANGES-7.2
diff -u src/doc/CHANGES-7.2:1.1.2.20 src/doc/CHANGES-7.2:1.1.2.21
--- src/doc/CHANGES-7.2:1.1.2.20	Sat Jun  3 17:53:38 2017
+++ src/doc/CHANGES-7.2	Thu Jun 15 05:59:39 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.2,v 1.1.2.20 2017/06/03 17:53:38 snj Exp $
+# $NetBSD: CHANGES-7.2,v 1.1.2.21 2017/06/15 05:59:39 snj Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.2
 release:
@@ -1331,3 +1331,11 @@ lib/lua/sqlite/sqlite.c1.9
 	This fixes PR bin/52218.
 	[mbalmer, ticket #1416]
 
+sys/arch/ews4800mips/sbd/fb_sbdio.c		1.16
+sys/arch/pmax/ibus/pm.c1.13
+sys/dev/hpc/bivideo.c1.34
+sys/dev/ic/sti.c1.19
+
+	Fix size checks so they can't be circumvented by integer overflows.
+	[spz, ticket #1432]
+