CVS commit: [netbsd-8] src/doc

2018-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 22 17:51:55 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Tickets #830, #831 and #833


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.200 -r1.1.2.201 src/doc/CHANGES-8.0

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.200 src/doc/CHANGES-8.0:1.1.2.201
--- src/doc/CHANGES-8.0:1.1.2.200	Thu May 17 14:08:18 2018
+++ src/doc/CHANGES-8.0	Tue May 22 17:51:55 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.200 2018/05/17 14:08:18 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.201 2018/05/22 17:51:55 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -13479,3 +13479,20 @@ sys/netipsec/ipsecif.c1.8
 	are created.
 	[knakahara, ticket #829]
 
+sys/netinet6/nd6_rtr.c1.142
+
+	Add missing m_put_rcvif_psref.
+	[maxv, ticket #830]
+
+sys/arch/i386/stand/efiboot/eficons.c		1.6
+
+	Avoid an invisible timer countdown on some UEFI implementations.
+	[jakllsch, ticket #831]
+
+sys/kern/uipc_mbuf.c1.214
+
+	Revert ticket #770:
+	remove the M_READONLY check. The initial code was correct.
+	[maxv, ticket #833]
+
+



CVS commit: [netbsd-8] src/sys/kern

2018-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 22 17:50:27 UTC 2018

Modified Files:
src/sys/kern [netbsd-8]: uipc_mbuf.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #833):

sys/kern/uipc_mbuf.c: revision 1.214

Revert my rev1.190, remove the M_READONLY check. The initial code was
correct: what is read-only is the mbuf storage, not the mbuf itself. The
storage contains the packet payload, and never has anything related to
mbufs. So it is fine to remove M_PKTHDR on mbufs that have a read-only
storage.

In fact it was kind of obvious, since several places already manually
remove M_PKTHDR without taking care of the external storage.


To generate a diff of this commit:
cvs rdiff -u -r1.172.6.4 -r1.172.6.5 src/sys/kern/uipc_mbuf.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/kern/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.172.6.4 src/sys/kern/uipc_mbuf.c:1.172.6.5
--- src/sys/kern/uipc_mbuf.c:1.172.6.4	Sun May  6 09:20:43 2018
+++ src/sys/kern/uipc_mbuf.c	Tue May 22 17:50:27 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.172.6.4 2018/05/06 09:20:43 martin Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.172.6.5 2018/05/22 17:50:27 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.172.6.4 2018/05/06 09:20:43 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.172.6.5 2018/05/22 17:50:27 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -460,11 +460,6 @@ m_pkthdr_remove(struct mbuf *m)
 {
 	KASSERT(m->m_flags & M_PKTHDR);
 
-	if (M_READONLY(m)) {
-		/* Nothing we can do. */
-		return;
-	}
-
 	m_tag_delete_chain(m, NULL);
 	m->m_flags &= ~M_PKTHDR;
 	memset(>m_pkthdr, 0, sizeof(m->m_pkthdr));



CVS commit: [netbsd-8] src/sys/arch/i386/stand/efiboot

2018-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 22 17:43:21 UTC 2018

Modified Files:
src/sys/arch/i386/stand/efiboot [netbsd-8]: eficons.c

Log Message:
Pull up following revision(s) (requested by jakllsch in ticket #831):

sys/arch/i386/stand/efiboot/eficons.c: revision 1.6

During awaitkey(), move the cursor back to the beginning of the
countdown with '\b' only after waiting.

Some UEFI implementations have a destructive/erasing backspace,
and will not show the countdown if we move the cursor back before the
wait.

My ThinkPad T430 w/ Lenovo's UEFI exhibited this whiteout-backspace,
while my Gigabyte Brix GB-BXBT-2807 did not.

Should fix PR #53292.


To generate a diff of this commit:
cvs rdiff -u -r1.4.2.1 -r1.4.2.2 src/sys/arch/i386/stand/efiboot/eficons.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/i386/stand/efiboot/eficons.c
diff -u src/sys/arch/i386/stand/efiboot/eficons.c:1.4.2.1 src/sys/arch/i386/stand/efiboot/eficons.c:1.4.2.2
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.4.2.1	Mon Apr  2 08:50:33 2018
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Tue May 22 17:43:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.4.2.1 2018/04/02 08:50:33 martin Exp $	*/
+/*	$NetBSD: eficons.c,v 1.4.2.2 2018/05/22 17:43:21 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -328,10 +328,10 @@ awaitkey(int timeout, int tell)
 	char c = 0;
 
 	for (;;) {
-		if (tell && timeout) {
-			char numbuf[32];
-			int len;
+		char numbuf[32];
+		int len;
 
+		if (tell && timeout) {
 			len = snprintf(numbuf, sizeof(numbuf), "%d seconds. ",
 			timeout);
 			if (len > 0 && len < sizeof(numbuf)) {
@@ -340,7 +340,6 @@ awaitkey(int timeout, int tell)
 printf("%s", numbuf);
 while (*p)
 	*p++ = '\b';
-printf("%s", numbuf);
 			}
 		}
 		if (iskey(1)) {
@@ -355,6 +354,8 @@ awaitkey(int timeout, int tell)
 			internal_waitforinputevent(1000);
 		else
 			break;
+		if (tell)
+			printf("%s", numbuf);
 	}
 
 out:



CVS commit: [netbsd-8] src/sys/netinet6

2018-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 22 17:41:12 UTC 2018

Modified Files:
src/sys/netinet6 [netbsd-8]: nd6_rtr.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #830):

sys/netinet6/nd6_rtr.c: revision 1.142

Add missing m_put_rcvif_psref.


To generate a diff of this commit:
cvs rdiff -u -r1.135.6.2 -r1.135.6.3 src/sys/netinet6/nd6_rtr.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/netinet6/nd6_rtr.c
diff -u src/sys/netinet6/nd6_rtr.c:1.135.6.2 src/sys/netinet6/nd6_rtr.c:1.135.6.3
--- src/sys/netinet6/nd6_rtr.c:1.135.6.2	Mon Feb  5 14:55:15 2018
+++ src/sys/netinet6/nd6_rtr.c	Tue May 22 17:41:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6_rtr.c,v 1.135.6.2 2018/02/05 14:55:15 martin Exp $	*/
+/*	$NetBSD: nd6_rtr.c,v 1.135.6.3 2018/05/22 17:41:12 martin Exp $	*/
 /*	$KAME: nd6_rtr.c,v 1.95 2001/02/07 08:09:47 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.135.6.2 2018/02/05 14:55:15 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.135.6.3 2018/05/22 17:41:12 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -179,6 +179,7 @@ nd6_rs_input(struct mbuf *m, int off, in
 	IP6_EXTHDR_GET(nd_rs, struct nd_router_solicit *, m, off, icmp6len);
 	if (nd_rs == NULL) {
 		ICMP6_STATINC(ICMP6_STAT_TOOSHORT);
+		m_put_rcvif_psref(ifp, );
 		return;
 	}
 



CVS commit: [netbsd-8] src/doc

2018-05-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu May 17 14:08:19 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Tickets #827 - #829


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.199 -r1.1.2.200 src/doc/CHANGES-8.0

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.199 src/doc/CHANGES-8.0:1.1.2.200
--- src/doc/CHANGES-8.0:1.1.2.199	Tue May 15 13:50:20 2018
+++ src/doc/CHANGES-8.0	Thu May 17 14:08:18 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.199 2018/05/15 13:50:20 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.200 2018/05/17 14:08:18 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -13453,3 +13453,29 @@ sys/net/if_bridge.c1.155
 	is not MP-safe,
 	[ozaki-r, ticket #826]
 
+sys/dev/pci/if_wm.c1.577
+
+	Fix eventcounter type for rxipsum and rxtusum.
+	[msaitoh, ticket #827]
+
+sys/net/if_ipsec.c1.12
+
+	Fix zero padding of PF_KEY messages for ipsecif(4).
+	[knakahara, ticket #828]
+
+sys/net/if_gif.c1.140
+sys/net/if_gif.h1.31
+sys/net/if_ipsec.c1.13
+sys/net/if_ipsec.h1.3
+sys/net/if_l2tp.c1.24
+sys/net/if_l2tp.h1.5
+sys/netinet/in_gif.c1.93
+sys/netinet/in_l2tp.c1.13
+sys/netinet6/in6_gif.c1.92
+sys/netinet6/in6_l2tp.c1.15
+sys/netipsec/ipsecif.c1.8
+
+	Fix LOCKDEBUG kernel panic when many (about 200) tunnel interfaces
+	are created.
+	[knakahara, ticket #829]
+



CVS commit: [netbsd-8] src/sys

2018-05-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu May 17 14:07:04 UTC 2018

Modified Files:
src/sys/net [netbsd-8]: if_gif.c if_gif.h if_ipsec.c if_ipsec.h
if_l2tp.c if_l2tp.h
src/sys/netinet [netbsd-8]: in_gif.c in_l2tp.c
src/sys/netinet6 [netbsd-8]: in6_gif.c in6_l2tp.c
src/sys/netipsec [netbsd-8]: ipsecif.c

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #829):

sys/net/if_l2tp.c: revision 1.24
sys/net/if_ipsec.c: revision 1.13
sys/net/if_gif.h: revision 1.31
sys/netipsec/ipsecif.c: revision 1.8
sys/net/if_gif.c: revision 1.140
sys/netinet6/in6_l2tp.c: revision 1.15
sys/net/if_ipsec.h: revision 1.3
sys/netinet6/in6_gif.c: revision 1.92
sys/net/if_l2tp.h: revision 1.5
sys/netinet/in_l2tp.c: revision 1.13
sys/netinet/in_gif.c: revision 1.93

Fix LOCKDEBUG kernel panic when many(about 200) tunnel interfaces is created.

The tunnel interfaces are gif(4), l2tp(4), and ipsecif(4). They use mutex
itself in percpu area. When percpu_cpu_enlarge() run, the address of the
mutex in percpu area becomes different from the address which lockdebug
saved. That can cause "already initialized" false detection.


To generate a diff of this commit:
cvs rdiff -u -r1.126.2.9 -r1.126.2.10 src/sys/net/if_gif.c
cvs rdiff -u -r1.25.8.2 -r1.25.8.3 src/sys/net/if_gif.h
cvs rdiff -u -r1.3.2.6 -r1.3.2.7 src/sys/net/if_ipsec.c
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/net/if_ipsec.h
cvs rdiff -u -r1.11.2.7 -r1.11.2.8 src/sys/net/if_l2tp.c
cvs rdiff -u -r1.2.2.1 -r1.2.2.2 src/sys/net/if_l2tp.h
cvs rdiff -u -r1.87.8.4 -r1.87.8.5 src/sys/netinet/in_gif.c
cvs rdiff -u -r1.2.8.4 -r1.2.8.5 src/sys/netinet/in_l2tp.c
cvs rdiff -u -r1.85.6.5 -r1.85.6.6 src/sys/netinet6/in6_gif.c
cvs rdiff -u -r1.5.8.4 -r1.5.8.5 src/sys/netinet6/in6_l2tp.c
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/netipsec/ipsecif.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/if_gif.c
diff -u src/sys/net/if_gif.c:1.126.2.9 src/sys/net/if_gif.c:1.126.2.10
--- src/sys/net/if_gif.c:1.126.2.9	Thu Mar  8 13:22:26 2018
+++ src/sys/net/if_gif.c	Thu May 17 14:07:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gif.c,v 1.126.2.9 2018/03/08 13:22:26 martin Exp $	*/
+/*	$NetBSD: if_gif.c,v 1.126.2.10 2018/05/17 14:07:03 martin Exp $	*/
 /*	$KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.126.2.9 2018/03/08 13:22:26 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.126.2.10 2018/05/17 14:07:03 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -319,7 +319,7 @@ gif_ro_init_pc(void *p, void *arg __unus
 {
 	struct gif_ro *gro = p;
 
-	mutex_init(>gr_lock, MUTEX_DEFAULT, IPL_NONE);
+	gro->gr_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
 }
 
 static void
@@ -329,7 +329,7 @@ gif_ro_fini_pc(void *p, void *arg __unus
 
 	rtcache_free(>gr_ro);
 
-	mutex_destroy(>gr_lock);
+	mutex_obj_free(gro->gr_lock);
 }
 
 void

Index: src/sys/net/if_gif.h
diff -u src/sys/net/if_gif.h:1.25.8.2 src/sys/net/if_gif.h:1.25.8.3
--- src/sys/net/if_gif.h:1.25.8.2	Tue Jan  2 10:48:51 2018
+++ src/sys/net/if_gif.h	Thu May 17 14:07:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gif.h,v 1.25.8.2 2018/01/02 10:48:51 snj Exp $	*/
+/*	$NetBSD: if_gif.h,v 1.25.8.3 2018/05/17 14:07:03 martin Exp $	*/
 /*	$KAME: if_gif.h,v 1.23 2001/07/27 09:21:42 itojun Exp $	*/
 
 /*
@@ -56,7 +56,7 @@ struct encaptab;
 
 struct gif_ro {
 	struct route gr_ro;
-	kmutex_t gr_lock;
+	kmutex_t *gr_lock;
 };
 
 struct gif_variant {

Index: src/sys/net/if_ipsec.c
diff -u src/sys/net/if_ipsec.c:1.3.2.6 src/sys/net/if_ipsec.c:1.3.2.7
--- src/sys/net/if_ipsec.c:1.3.2.6	Thu May 17 14:02:31 2018
+++ src/sys/net/if_ipsec.c	Thu May 17 14:07:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipsec.c,v 1.3.2.6 2018/05/17 14:02:31 martin Exp $  */
+/*	$NetBSD: if_ipsec.c,v 1.3.2.7 2018/05/17 14:07:03 martin Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.3.2.6 2018/05/17 14:02:31 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.3.2.7 2018/05/17 14:07:03 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -220,7 +220,7 @@ if_ipsec_ro_init_pc(void *p, void *arg _
 {
 	struct ipsec_ro *iro = p;
 
-	mutex_init(>ir_lock, MUTEX_DEFAULT, IPL_NONE);
+	iro->ir_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
 }
 
 static void
@@ -230,7 +230,7 @@ if_ipsec_ro_fini_pc(void *p, void *arg _
 
 	rtcache_free(>ir_ro);
 
-	mutex_destroy(>ir_lock);
+	mutex_obj_free(iro->ir_lock);
 }
 
 static int

Index: src/sys/net/if_ipsec.h
diff -u src/sys/net/if_ipsec.h:1.1.2.2 src/sys/net/if_ipsec.h:1.1.2.3
--- src/sys/net/if_ipsec.h:1.1.2.2	Sun Feb 11 21:17:34 2018
+++ src/sys/net/if_ipsec.h	Thu May 17 

CVS commit: [netbsd-8] src/sys/net

2018-05-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu May 17 14:02:31 UTC 2018

Modified Files:
src/sys/net [netbsd-8]: if_ipsec.c

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #828):

sys/net/if_ipsec.c: revision 1.12

Fix "how" argument of MGET(). Pointed out by maxv@n.o, thanks.
MGET() does not have M_ZERO flag, so add memset when it is required.


To generate a diff of this commit:
cvs rdiff -u -r1.3.2.5 -r1.3.2.6 src/sys/net/if_ipsec.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/if_ipsec.c
diff -u src/sys/net/if_ipsec.c:1.3.2.5 src/sys/net/if_ipsec.c:1.3.2.6
--- src/sys/net/if_ipsec.c:1.3.2.5	Mon Apr  9 17:01:20 2018
+++ src/sys/net/if_ipsec.c	Thu May 17 14:02:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipsec.c,v 1.3.2.5 2018/04/09 17:01:20 martin Exp $  */
+/*	$NetBSD: if_ipsec.c,v 1.3.2.6 2018/05/17 14:02:31 martin Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.3.2.5 2018/04/09 17:01:20 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.3.2.6 2018/05/17 14:02:31 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1339,10 +1339,11 @@ if_ipsec_add_mbuf_optalign(struct mbuf *
 {
 	struct mbuf *m;
 
-	MGET(m, M_WAITOK | M_ZERO, MT_DATA);
-	if (align)
+	MGET(m, M_WAIT, MT_DATA);
+	if (align) {
 		m->m_len = PFKEY_ALIGN8(len);
-	else
+		memset(mtod(m, void *), 0, m->m_len);
+	} else
 		m->m_len = len;
 	m_copyback(m, 0, len, data);
 	m_cat(m0, m);
@@ -1378,8 +1379,9 @@ if_ipsec_add_pad(struct mbuf *m0, size_t
 	if (len == 0)
 		return;
 
-	MGET(m, M_WAITOK | M_ZERO, MT_DATA);
+	MGET(m, M_WAIT, MT_DATA);
 	m->m_len = len;
+	memset(mtod(m, void *), 0, m->m_len);
 	m_cat(m0, m);
 }
 
@@ -1556,7 +1558,7 @@ if_ipsec_add_sp0(struct sockaddr *src, i
 	memset(, 0, sizeof(xpl));
 	memset(, 0, sizeof(xisr));
 
-	MGETHDR(m, M_WAITOK, MT_DATA);
+	MGETHDR(m, M_WAIT, MT_DATA);
 
 	size = if_ipsec_set_sadb_src(, src, proto);
 	ext_msg_len += PFKEY_UNIT64(size);
@@ -1683,7 +1685,7 @@ if_ipsec_del_sp0(struct secpolicy *sp)
 	memset(, 0, sizeof(msg));
 	memset(, 0, sizeof(xpl));
 
-	MGETHDR(m, M_WAITOK, MT_DATA);
+	MGETHDR(m, M_WAIT, MT_DATA);
 
 	size = if_ipsec_set_sadb_x_policy(, NULL, 0, 0, sp->id, 0, NULL, NULL);
 	ext_msg_len += PFKEY_UNIT64(size);



CVS commit: [netbsd-8] src/sys/dev/pci

2018-05-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu May 17 13:58:08 UTC 2018

Modified Files:
src/sys/dev/pci [netbsd-8]: if_wm.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #827):

sys/dev/pci/if_wm.c: revision 1.577

rxipsum and rxtusum are not interrupt counter, so use EVCNT_TYPE_MISC
instead of EVCNT_TYPE_INTR.


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.18 -r1.508.4.19 src/sys/dev/pci/if_wm.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/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.508.4.18 src/sys/dev/pci/if_wm.c:1.508.4.19
--- src/sys/dev/pci/if_wm.c:1.508.4.18	Wed May  9 15:28:44 2018
+++ src/sys/dev/pci/if_wm.c	Thu May 17 13:58:07 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.18 2018/05/09 15:28:44 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.19 2018/05/17 13:58:07 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.18 2018/05/09 15:28:44 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.19 2018/05/17 13:58:07 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -6501,8 +6501,8 @@ wm_alloc_txrx_queues(struct wm_softc *sc
 		WM_Q_INTR_EVCNT_ATTACH(rxq, rxintr, rxq, i, xname);
 		WM_Q_INTR_EVCNT_ATTACH(rxq, rxdefer, rxq, i, xname);
 
-		WM_Q_INTR_EVCNT_ATTACH(rxq, rxipsum, rxq, i, xname);
-		WM_Q_INTR_EVCNT_ATTACH(rxq, rxtusum, rxq, i, xname);
+		WM_Q_MISC_EVCNT_ATTACH(rxq, rxipsum, rxq, i, xname);
+		WM_Q_MISC_EVCNT_ATTACH(rxq, rxtusum, rxq, i, xname);
 #endif /* WM_EVENT_COUNTERS */
 
 		rx_done++;



CVS commit: [netbsd-8] src/doc

2018-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 15 13:50:20 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Tickets #824 - #826


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.198 -r1.1.2.199 src/doc/CHANGES-8.0

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.198 src/doc/CHANGES-8.0:1.1.2.199
--- src/doc/CHANGES-8.0:1.1.2.198	Mon May 14 19:24:10 2018
+++ src/doc/CHANGES-8.0	Tue May 15 13:50:20 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.198 2018/05/14 19:24:10 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.199 2018/05/15 13:50:20 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -13421,3 +13421,35 @@ sys/net/npf/npf_sendpkt.c			1.19
 	Fix use-after-free and strengthen.
 	[maxv, ticket #823]
 
+sys/dev/pci/ixgbe/ixv.c1.97
+
+	Fix panic or hangup when enabling debugging.
+	[msaitoh, ticket #824]
+
+distrib/sets/lists/man/mi			1.1586
+share/man/man4/audio.41.85
+share/man/man7/Makefile1.32
+share/man/man7/audio.71.1,1.2
+share/man/man7/intro.71.24
+share/man/man9/audio.91.46
+sys/dev/audio.c	1.453-1.455
+
+	Bring audio in line with specification published in
+	audio.7, in particular consistient naming of vchans for
+	audioctl & mixerctl as well as exposure of the audio_info
+	structure for the mix ring.
+
+	Addition of an audio specification to describe the workings
+	of the audio mixer.
+	[nat, ticket #825]
+
+sys/net/bpf.c	1.224
+sys/net/if.c	1.421-1.423
+sys/net/if_bridge.c1.155
+
+	Use if_is_mpsafe.
+	Protect packet input routines with KERNEL_LOCK and splsoftnet.
+	Protect if_deferred_start_softint with KERNEL_LOCK if the interface
+	is not MP-safe,
+	[ozaki-r, ticket #826]
+



CVS commit: [netbsd-8] src/sys/net

2018-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 15 13:48:37 UTC 2018

Modified Files:
src/sys/net [netbsd-8]: bpf.c if.c if_bridge.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #826):

sys/net/if_bridge.c: revision 1.155
sys/net/if.c: revision 1.421
sys/net/bpf.c: revision 1.224
sys/net/if.c: revision 1.422
sys/net/if.c: revision 1.423

Use if_is_mpsafe (NFC)

Protect packet input routines with KERNEL_LOCK and splsoftnet
if_input, i.e, ether_input and friends, now runs in softint without any
protections.  It's ok for ether_input itself because it's already MP-safe,
however, subsequent routines called from it such as carp_input and agr_input
aren't safe because they're not MP-safe.  Protect if_input with KERNEL_LOCK.
if_input can be called from a normal LWP context.  In that case we need to
prevent interrupts (softint) from running by splsoftnet to protect
non-MP-safe
codes (e.g., carp_input and agr_input).

Pointed out by mlelstv@

Protect if_deferred_start_softint with KERNEL_LOCK if the interface isn't
MP-safe


To generate a diff of this commit:
cvs rdiff -u -r1.216.6.5 -r1.216.6.6 src/sys/net/bpf.c
cvs rdiff -u -r1.394.2.9 -r1.394.2.10 src/sys/net/if.c
cvs rdiff -u -r1.134.6.9 -r1.134.6.10 src/sys/net/if_bridge.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/bpf.c
diff -u src/sys/net/bpf.c:1.216.6.5 src/sys/net/bpf.c:1.216.6.6
--- src/sys/net/bpf.c:1.216.6.5	Mon Feb  5 14:18:00 2018
+++ src/sys/net/bpf.c	Tue May 15 13:48:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpf.c,v 1.216.6.5 2018/02/05 14:18:00 martin Exp $	*/
+/*	$NetBSD: bpf.c,v 1.216.6.6 2018/05/15 13:48:37 martin Exp $	*/
 
 /*
  * Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.216.6.5 2018/02/05 14:18:00 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.216.6.6 2018/05/15 13:48:37 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_bpf.h"
@@ -836,9 +836,13 @@ bpf_write(struct file *fp, off_t *offp, 
 	error = if_output_lock(ifp, ifp, m, (struct sockaddr *) , NULL);
 
 	if (mc != NULL) {
-		if (error == 0)
+		if (error == 0) {
+			int s = splsoftnet();
+			KERNEL_LOCK_UNLESS_IFP_MPSAFE(ifp);
 			ifp->_if_input(ifp, mc);
-		else
+			KERNEL_UNLOCK_UNLESS_IFP_MPSAFE(ifp);
+			splx(s);
+		} else
 			m_freem(mc);
 	}
 	/*

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.394.2.9 src/sys/net/if.c:1.394.2.10
--- src/sys/net/if.c:1.394.2.9	Wed Feb 28 18:54:43 2018
+++ src/sys/net/if.c	Tue May 15 13:48:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.394.2.9 2018/02/28 18:54:43 martin Exp $	*/
+/*	$NetBSD: if.c,v 1.394.2.10 2018/05/15 13:48:37 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.394.2.9 2018/02/28 18:54:43 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.394.2.10 2018/05/15 13:48:37 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -716,8 +716,7 @@ if_initialize(ifnet_t *ifp)
 
 	if (if_is_link_state_changeable(ifp)) {
 		u_int flags = SOFTINT_NET;
-		flags |= ISSET(ifp->if_extflags, IFEF_MPSAFE) ?
-		SOFTINT_MPSAFE : 0;
+		flags |= if_is_mpsafe(ifp) ? SOFTINT_MPSAFE : 0;
 		ifp->if_link_si = softint_establish(flags,
 		if_link_state_change_si, ifp);
 		if (ifp->if_link_si == NULL) {
@@ -834,11 +833,13 @@ struct if_percpuq *
 if_percpuq_create(struct ifnet *ifp)
 {
 	struct if_percpuq *ipq;
+	u_int flags = SOFTINT_NET;
+
+	flags |= if_is_mpsafe(ifp) ? SOFTINT_MPSAFE : 0;
 
 	ipq = kmem_zalloc(sizeof(*ipq), KM_SLEEP);
 	ipq->ipq_ifp = ifp;
-	ipq->ipq_si = softint_establish(SOFTINT_NET|SOFTINT_MPSAFE,
-	if_percpuq_softint, ipq);
+	ipq->ipq_si = softint_establish(flags, if_percpuq_softint, ipq);
 	ipq->ipq_ifqs = percpu_alloc(sizeof(struct ifqueue));
 	percpu_foreach(ipq->ipq_ifqs, _percpuq_init_ifq, NULL);
 
@@ -1066,11 +1067,13 @@ void
 if_deferred_start_init(struct ifnet *ifp, void (*func)(struct ifnet *))
 {
 	struct if_deferred_start *ids;
+	u_int flags = SOFTINT_NET;
+
+	flags |= if_is_mpsafe(ifp) ? SOFTINT_MPSAFE : 0;
 
 	ids = kmem_zalloc(sizeof(*ids), KM_SLEEP);
 	ids->ids_ifp = ifp;
-	ids->ids_si = softint_establish(SOFTINT_NET|SOFTINT_MPSAFE,
-	if_deferred_start_softint, ids);
+	ids->ids_si = softint_establish(flags, if_deferred_start_softint, ids);
 	if (func != NULL)
 		ids->ids_if_start = func;
 	else

Index: src/sys/net/if_bridge.c
diff -u src/sys/net/if_bridge.c:1.134.6.9 src/sys/net/if_bridge.c:1.134.6.10
--- src/sys/net/if_bridge.c:1.134.6.9	Wed Apr 18 14:11:42 2018
+++ src/sys/net/if_bridge.c	Tue May 15 13:48:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.134.6.9 2018/04/18 14:11:42 martin Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.134.6.10 2018/05/15 13:48:37 martin Exp $	*/
 
 /*
  * Copyright 2001 

CVS commit: [netbsd-8] src

2018-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 15 13:42:50 UTC 2018

Modified Files:
src/distrib/sets/lists/man [netbsd-8]: mi
src/share/man/man4 [netbsd-8]: audio.4
src/share/man/man7 [netbsd-8]: Makefile intro.7
src/share/man/man9 [netbsd-8]: audio.9
src/sys/dev [netbsd-8]: audio.c
Added Files:
src/share/man/man7 [netbsd-8]: audio.7

Log Message:
Pull up following revision(s) (requested by nat in ticket #825):

share/man/man7/Makefile: revision 1.32
share/man/man9/audio.9: revision 1.46
sys/dev/audio.c: revision 1.453
sys/dev/audio.c: revision 1.454
sys/dev/audio.c: revision 1.455
share/man/man7/audio.7: revision 1.1
share/man/man7/audio.7: revision 1.2
share/man/man7/intro.7: revision 1.24
share/man/man4/audio.4: revision 1.85
distrib/sets/lists/man/mi: revision 1.1586

Fix numbering of vchan mixer controls to correspond to the vchan number in
use.

This makes the numbering of vchans consistient for audioctl and mixerctl.
Expose the audio_info structure of vchan zero(0) the mix ring to allow
setting the hardware gain and balance via audioctl(1) using the -p 0
switch.

It is not possible to influence the hardware gain/blance from the
audio_info structure of vchans 1 onwards.  It is now possible to return
the audio mixers audio format from the audio_info structure of vchan 0 to
ease applications configuring for mmapped play back.

This is conformant to the audio specification posted on tech-kern see:

"NetBSD Audio Specification 2018"

or audio.7 manual page to be added in a follow up commit.
Add the audio mixer specification to section 7 of the manual.
See posting on tech-kern - "NetBSD Audio Specification 2018."
Update the introduction page to section 7 of the manual noting the audio
spec.

Various improvements, more markup, typo fixes.

Fix over cautious compiler error - setmode may not be initialized.


To generate a diff of this commit:
cvs rdiff -u -r1.1557.2.3 -r1.1557.2.4 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.79.2.1 -r1.79.2.2 src/share/man/man4/audio.4
cvs rdiff -u -r1.31 -r1.31.8.1 src/share/man/man7/Makefile
cvs rdiff -u -r0 -r1.2.2.2 src/share/man/man7/audio.7
cvs rdiff -u -r1.23 -r1.23.24.1 src/share/man/man7/intro.7
cvs rdiff -u -r1.44 -r1.44.16.1 src/share/man/man9/audio.9
cvs rdiff -u -r1.357.2.11 -r1.357.2.12 src/sys/dev/audio.c

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/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1557.2.3 src/distrib/sets/lists/man/mi:1.1557.2.4
--- src/distrib/sets/lists/man/mi:1.1557.2.3	Sat May 12 10:35:45 2018
+++ src/distrib/sets/lists/man/mi	Tue May 15 13:42:50 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1557.2.3 2018/05/12 10:35:45 martin Exp $
+# $NetBSD: mi,v 1.1557.2.4 2018/05/15 13:42:50 martin Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2251,6 +2251,7 @@
 ./usr/share/man/cat5/wtmpx.0			man-sys-catman		.cat
 ./usr/share/man/cat5/ypserv.acl.0		man-obsolete		obsolete
 ./usr/share/man/cat7/ascii.0			man-reference-catman	.cat
+./usr/share/man/cat7/audio.0			man-reference-catman	.cat
 ./usr/share/man/cat7/atf.0			man-atf-catman		.cat,atf
 ./usr/share/man/cat7/c.0			man-reference-catman	.cat
 ./usr/share/man/cat7/c78.0			man-reference-catman	.cat
@@ -5271,6 +5272,7 @@
 ./usr/share/man/html5/wtmp.html			man-sys-htmlman		html
 ./usr/share/man/html5/wtmpx.html		man-sys-htmlman		html
 ./usr/share/man/html7/ascii.html		man-reference-htmlman	html
+./usr/share/man/html7/audio.html		man-reference-htmlman	html
 ./usr/share/man/html7/atf.html			man-atf-htmlman		html,atf
 ./usr/share/man/html7/c.html			man-reference-htmlman	html
 ./usr/share/man/html7/c78.html			man-reference-htmlman	html
@@ -8261,6 +8263,7 @@
 ./usr/share/man/man5/wtmpx.5			man-sys-man		.man
 ./usr/share/man/man5/ypserv.acl.5		man-obsolete		obsolete
 ./usr/share/man/man7/ascii.7			man-reference-man	.man
+./usr/share/man/man7/audio.7			man-reference-man	.man
 ./usr/share/man/man7/atf.7			man-atf-man		.man,atf
 ./usr/share/man/man7/c.7			man-reference-man	.man
 ./usr/share/man/man7/c78.7			man-reference-man	.man

Index: src/share/man/man4/audio.4
diff -u src/share/man/man4/audio.4:1.79.2.1 src/share/man/man4/audio.4:1.79.2.2
--- src/share/man/man4/audio.4:1.79.2.1	Mon Jan 15 00:08:55 2018
+++ src/share/man/man4/audio.4	Tue May 15 13:42:50 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audio.4,v 1.79.2.1 2018/01/15 00:08:55 snj Exp $
+.\"	$NetBSD: audio.4,v 1.79.2.2 2018/05/15 13:42:50 martin Exp $
 .\"
 .\" Copyright (c) 1996 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd October 27, 2017
+.Dd May 15, 2018
 .Dt AUDIO 4
 .Os
 .Sh NAME
@@ -789,6 +789,8 @@ 

CVS commit: [netbsd-8] src/sys/dev/pci/ixgbe

2018-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 15 13:37:24 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ixv.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #824):

sys/dev/pci/ixgbe/ixv.c: revision 1.97

Fix panic or hangup when "sysctl -w hw.ixgN.debug=1".
XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.56.2.14 -r1.56.2.15 src/sys/dev/pci/ixgbe/ixv.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/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.56.2.14 src/sys/dev/pci/ixgbe/ixv.c:1.56.2.15
--- src/sys/dev/pci/ixgbe/ixv.c:1.56.2.14	Sat Apr 14 10:25:11 2018
+++ src/sys/dev/pci/ixgbe/ixv.c	Tue May 15 13:37:24 2018
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.56.2.14 2018/04/14 10:25:11 martin Exp $*/
+/*$NetBSD: ixv.c,v 1.56.2.15 2018/05/15 13:37:24 martin Exp $*/
 
 /**
 
@@ -2603,21 +2603,18 @@ ixv_print_debug_info(struct adapter *ada
 static int
 ixv_sysctl_debug(SYSCTLFN_ARGS)
 {
-	struct sysctlnode node;
-	struct adapter *adapter;
+	struct sysctlnode node = *rnode;
+	struct adapter *adapter = (struct adapter *)node.sysctl_data;
 	interror, result;
 
-	node = *rnode;
 	node.sysctl_data = 
 	error = sysctl_lookup(SYSCTLFN_CALL());
 
 	if (error || newp == NULL)
 		return error;
 
-	if (result == 1) {
-		adapter = (struct adapter *)node.sysctl_data;
+	if (result == 1)
 		ixv_print_debug_info(adapter);
-	}
 
 	return 0;
 } /* ixv_sysctl_debug */



CVS commit: [netbsd-8] src/doc

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 19:24:10 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Tickets #805, #822 and #823.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.197 -r1.1.2.198 src/doc/CHANGES-8.0

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.197 src/doc/CHANGES-8.0:1.1.2.198
--- src/doc/CHANGES-8.0:1.1.2.197	Sat May 12 10:44:25 2018
+++ src/doc/CHANGES-8.0	Mon May 14 19:24:10 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.197 2018/05/12 10:44:25 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.198 2018/05/14 19:24:10 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -13400,3 +13400,24 @@ sys/netinet6/in6_proto.c			1.125
 	Increase the default size of some receive buffers from 8k to 16k.
 	[roy, ticket #821]
 
+sys/kern/kern_lwp.c1.192
+
+	Revert previous, do not wait interruptibly when exiting.
+	The change caused other deadlocks and the golang issue
+	is not reproducable with later versions.
+	[gson, ticket #805]
+
+lib/libc/string/stresep.c			1.4
+tests/lib/libc/string/t_stresep.c		1.4
+
+	Fix memmove with of-by-one length in stresep(3) and add
+	a test.
+	[maya, ticket #822]
+
+sys/net/npf/npf_alg_icmp.c			1.27-1.30
+sys/net/npf/npf_inet.c1.45-1.47
+sys/net/npf/npf_sendpkt.c			1.19
+
+	Fix use-after-free and strengthen.
+	[maxv, ticket #823]
+



CVS commit: [netbsd-8] src/sys/net/npf

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 19:22:30 UTC 2018

Modified Files:
src/sys/net/npf [netbsd-8]: npf_alg_icmp.c npf_inet.c npf_sendpkt.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #823):

sys/net/npf/npf_inet.c: revision 1.45-1.47
sys/net/npf/npf_alg_icmp.c: revision 1.27-1.30
sys/net/npf/npf_sendpkt.c: revision 1.19

Fix use-after-free.

The nbuf can be reallocated as a result of caching 'enpc', so it is
necessary to recache 'npc', otherwise it contains pointers to the freed
mbuf - pointers which are then used in the ruleset machinery.

We recache 'npc' when we are sure we won't use 'enpc' anymore, because
'enpc' can be clobbered as a result of caching 'npc' (in other words,
only one of the two can be cached at the same time).
Also, we recache 'npc' unconditionally, because there is no way to know
whether the nbuf got clobbered relatively to it. We can't use the
NBUF_DATAREF_RESET flag, because it is stored in the nbuf and not in the
cache.

Discussed with rmind@.

Change npf_cache_all so that it ensures the potential ICMP Query Id is in
the nbuf. In such a way that we don't need to ensure that later.
Change npfa_icmp4_inspect and npfa_icmp6_inspect so that they touch neither
the nbuf nor npc. Adapt their callers accordingly.

In the end, if a packet has a Query Id, we set NPC_ICMP_ID in npc and leave
right away, without recaching npc (not needed since we didn't touch the
nbuf).

This fixes the handling of Query Id packets (that I broke in my previous
commit), and also fixes another possible use-after-free.

Retrieve the complete IPv4 header right away, and make sure we did retrieve
the IPv6 option header we were iterating on.

Ah, fix compilation. I tested my previous change by loading the kernel
module from the filesystem, but the Makefile didn't have DIAGNOSTIC
enabled, and the two KASSERTs I added did not compile properly.

If we fail to advance inside TCP/UDP/ICMPv4/ICMPv6, stop pretending L4
is unknown, and error out right away.

This prevents bugs in machinery, if a place looks for L4 in 'npc_proto'
without checking the cache too. I've seen a ~similar problem already.

In addition to checking L4 in the cache, here we also need to check the
protocol. The NPF entry point does not ensure that
ICMPv6 can be set only in IPv6
ICMPv4 can be set only in IPv4
So we could have ICMPv6 in IPv4.

apply some INET6 so this compiles in INET6-less kernels again.


To generate a diff of this commit:
cvs rdiff -u -r1.24.8.1 -r1.24.8.2 src/sys/net/npf/npf_alg_icmp.c
cvs rdiff -u -r1.37.6.1 -r1.37.6.2 src/sys/net/npf/npf_inet.c
cvs rdiff -u -r1.16.8.1 -r1.16.8.2 src/sys/net/npf/npf_sendpkt.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/npf/npf_alg_icmp.c
diff -u src/sys/net/npf/npf_alg_icmp.c:1.24.8.1 src/sys/net/npf/npf_alg_icmp.c:1.24.8.2
--- src/sys/net/npf/npf_alg_icmp.c:1.24.8.1	Wed May  9 15:35:37 2018
+++ src/sys/net/npf/npf_alg_icmp.c	Mon May 14 19:22:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_alg_icmp.c,v 1.24.8.1 2018/05/09 15:35:37 martin Exp $	*/
+/*	$NetBSD: npf_alg_icmp.c,v 1.24.8.2 2018/05/14 19:22:30 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_alg_icmp.c,v 1.24.8.1 2018/05/09 15:35:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_alg_icmp.c,v 1.24.8.2 2018/05/14 19:22:30 martin Exp $");
 
 #include 
 #include 
@@ -120,13 +120,15 @@ npfa_icmp_match(npf_cache_t *npc, npf_na
 /*
  * npfa_icmp{4,6}_inspect: retrieve unique identifiers - either ICMP query
  * ID or TCP/UDP ports of the original packet, which is embedded.
+ *
+ * => Sets hasqid=true if the packet has a Query Id. In this case neither
+ *the nbuf nor npc is touched.
  */
 
 static bool
-npfa_icmp4_inspect(const int type, npf_cache_t *npc)
+npfa_icmp4_inspect(const int type, npf_cache_t *npc, bool *hasqid)
 {
 	nbuf_t *nbuf = npc->npc_nbuf;
-	u_int offby;
 
 	/* Per RFC 792. */
 	switch (type) {
@@ -147,12 +149,8 @@ npfa_icmp4_inspect(const int type, npf_c
 	case ICMP_TSTAMPREPLY:
 	case ICMP_IREQ:
 	case ICMP_IREQREPLY:
-		/* Should contain ICMP query ID - ensure. */
-		offby = offsetof(struct icmp, icmp_id);
-		if (!nbuf_advance(nbuf, offby, sizeof(uint16_t))) {
-			return false;
-		}
-		npc->npc_info |= NPC_ICMP_ID;
+		/* Contains ICMP query ID. */
+		*hasqid = true;
 		return true;
 	default:
 		break;
@@ -161,10 +159,9 @@ npfa_icmp4_inspect(const int type, npf_c
 }
 
 static bool
-npfa_icmp6_inspect(const int type, npf_cache_t *npc)
+npfa_icmp6_inspect(const int type, npf_cache_t *npc, bool *hasqid)
 {
 	nbuf_t *nbuf = npc->npc_nbuf;
-	u_int offby;
 
 	/* Per RFC 4443. */
 	switch (type) {
@@ -180,12 +177,8 @@ npfa_icmp6_inspect(const int type, npf_c
 
 	case ICMP6_ECHO_REQUEST:
 	case ICMP6_ECHO_REPLY:
-		/* 

CVS commit: [netbsd-8] src

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 19:17:39 UTC 2018

Modified Files:
src/lib/libc/string [netbsd-8]: stresep.c
src/tests/lib/libc/string [netbsd-8]: t_stresep.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #822):

lib/libc/string/stresep.c: revision 1.4
tests/lib/libc/string/t_stresep.c: revision 1.4

PR/52499: Justin: stresep uses memmove with of-by-one length
Add test from PR/52499


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.4.1 src/lib/libc/string/stresep.c
cvs rdiff -u -r1.3 -r1.3.22.1 src/tests/lib/libc/string/t_stresep.c

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

Modified files:

Index: src/lib/libc/string/stresep.c
diff -u src/lib/libc/string/stresep.c:1.3 src/lib/libc/string/stresep.c:1.3.4.1
--- src/lib/libc/string/stresep.c:1.3	Sun Feb 12 17:19:00 2017
+++ src/lib/libc/string/stresep.c	Mon May 14 19:17:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: stresep.c,v 1.3 2017/02/12 17:19:00 maya Exp $	*/
+/*	$NetBSD: stresep.c,v 1.3.4.1 2018/05/14 19:17:39 martin Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)strsep.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: stresep.c,v 1.3 2017/02/12 17:19:00 maya Exp $");
+__RCSID("$NetBSD: stresep.c,v 1.3.4.1 2018/05/14 19:17:39 martin Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -66,6 +66,7 @@ stresep(char **stringp, const char *deli
 	char *s;
 	const char *spanp;
 	int c, sc;
+	size_t l;
 	char *tok;
 
 	_DIAGASSERT(stringp != NULL);
@@ -73,22 +74,25 @@ stresep(char **stringp, const char *deli
 
 	if ((s = *stringp) == NULL)
 		return NULL;
+	l = strlen(s) + 1;
 	for (tok = s;;) {
 		c = *s++;
+		l--;
 		while (esc != '\0' && c == esc) {
-			memmove(s - 1, s, strlen(s));
+			memmove(s - 1, s, l);
 			c = *s++;
+			l--;
 		}
 		spanp = delim;
 		do {
 			if ((sc = *spanp++) == c) {
-if (c == 0)
+if (c == '\0')
 	s = NULL;
 else
-	s[-1] = 0;
+	s[-1] = '\0';
 *stringp = s;
 return tok;
 			}
-		} while (sc != 0);
+		} while (sc != '\0');
 	}
 }

Index: src/tests/lib/libc/string/t_stresep.c
diff -u src/tests/lib/libc/string/t_stresep.c:1.3 src/tests/lib/libc/string/t_stresep.c:1.3.22.1
--- src/tests/lib/libc/string/t_stresep.c:1.3	Fri Feb 15 23:56:32 2013
+++ src/tests/lib/libc/string/t_stresep.c	Mon May 14 19:17:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_stresep.c,v 1.3 2013/02/15 23:56:32 christos Exp $ */
+/*	$NetBSD: t_stresep.c,v 1.3.22.1 2018/05/14 19:17:39 martin Exp $ */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -61,6 +61,12 @@ ATF_TC_BODY(stresep_basic, tc)
 	expect("bar  foo");
 	expect("   baz");
 	expect("bar  ");
+
+	char brkstr2[] = "aa bb cc\\ \\ \\ \\ dd-";
+	q = brkstr2;
+	expect("aa");
+	expect("bb");
+	expect("ccdd-");
 }
 
 ATF_TP_ADD_TCS(tp)



CVS commit: [netbsd-8] src/sys/kern

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 19:11:21 UTC 2018

Modified Files:
src/sys/kern [netbsd-8]: kern_lwp.c

Log Message:
Pull up following revision(s) (requested by gson in ticket #805):

sys/kern/kern_lwp.c: revision 1.192

PR/kern/53202: Kernel hangs running t_ptrace_wait:resume1 test, revert
previous.


To generate a diff of this commit:
cvs rdiff -u -r1.189.2.1 -r1.189.2.2 src/sys/kern/kern_lwp.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/kern/kern_lwp.c
diff -u src/sys/kern/kern_lwp.c:1.189.2.1 src/sys/kern/kern_lwp.c:1.189.2.2
--- src/sys/kern/kern_lwp.c:1.189.2.1	Sun Dec 10 09:35:03 2017
+++ src/sys/kern/kern_lwp.c	Mon May 14 19:11:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lwp.c,v 1.189.2.1 2017/12/10 09:35:03 snj Exp $	*/
+/*	$NetBSD: kern_lwp.c,v 1.189.2.2 2018/05/14 19:11:21 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -211,7 +211,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.189.2.1 2017/12/10 09:35:03 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.189.2.2 2018/05/14 19:11:21 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_lockdebug.h"
@@ -645,9 +645,8 @@ lwp_wait(struct lwp *l, lwpid_t lid, lwp
 		 */
 		if (exiting) {
 			KASSERT(p->p_nlwps > 1);
-			error = cv_wait_sig(>p_lwpcv, p->p_lock);
-			if (error == 0)
-error = EAGAIN;
+			cv_wait(>p_lwpcv, p->p_lock);
+			error = EAGAIN;
 			break;
 		}
 



CVS commit: [netbsd-8] src/doc

2018-05-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May 12 10:44:25 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Tickets #818 - #821


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.196 -r1.1.2.197 src/doc/CHANGES-8.0

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.196 src/doc/CHANGES-8.0:1.1.2.197
--- src/doc/CHANGES-8.0:1.1.2.196	Wed May  9 15:38:05 2018
+++ src/doc/CHANGES-8.0	Sat May 12 10:44:25 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.196 2018/05/09 15:38:05 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.197 2018/05/12 10:44:25 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -13367,3 +13367,36 @@ sys/net/npf/npf_sendpkt.c			1.17,1.18
 	Various fixes for NPF.
 	[maxv, ticket #817]
 
+sys/compat/linux/common/linux_socket.c		1.142
+sys/compat/linux32/common/linux32_socket.c	1.29
+
+	Fix pserialize enter/exit pairs in linux_getifconf and
+	linux32_getifconf.
+	[ozaki-r, ticket #818]
+
+distrib/sets/lists/man/mi			1.1585
+share/man/man4/Makefile1.652
+share/man/man4/ixg.41.11,1.12
+share/man/man4/ixv.41.1,1.2
+
+	Add a maunal page for ixv(4).
+	ixg.4: Macro fix and cosmetic change.
+	[msaitoh, ticket #819]
+
+usr.bin/midiplay/midiplay.1			1.20,1.21
+usr.bin/midiplay/midiplay.c			1.31,1.32
+
+	If just parsing don't try to read the uninitialised device name,
+	or display the unit number.
+	Add a "-s" option that sends an ALL_SOUNDS_OFF midi event.
+	Merge options without arguments in synopsis.
+	Sync usage with manpage.
+	[mrg, ticket #820]
+
+sys/kern/uipc_usrreq.c1.186
+sys/net/raw_cb.h1.29
+sys/netinet6/in6_proto.c			1.125
+
+	Increase the default size of some receive buffers from 8k to 16k.
+	[roy, ticket #821]
+



CVS commit: [netbsd-8] src/sys

2018-05-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May 12 10:42:22 UTC 2018

Modified Files:
src/sys/kern [netbsd-8]: uipc_usrreq.c
src/sys/net [netbsd-8]: raw_cb.h
src/sys/netinet6 [netbsd-8]: in6_proto.c

Log Message:
Pull up following revision(s) (requested by roy in ticket #821):

sys/netinet6/in6_proto.c: revision 1.125
sys/net/raw_cb.h: revision 1.29
sys/kern/uipc_usrreq.c: revision 1.186

Increase the default size of some receive buffers from 8k to 16k.

This mitigates recent reports of socket overflow errors
and fixes PR bin/53247.


To generate a diff of this commit:
cvs rdiff -u -r1.181.8.1 -r1.181.8.2 src/sys/kern/uipc_usrreq.c
cvs rdiff -u -r1.27.4.1 -r1.27.4.2 src/sys/net/raw_cb.h
cvs rdiff -u -r1.117.4.4 -r1.117.4.5 src/sys/netinet6/in6_proto.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/kern/uipc_usrreq.c
diff -u src/sys/kern/uipc_usrreq.c:1.181.8.1 src/sys/kern/uipc_usrreq.c:1.181.8.2
--- src/sys/kern/uipc_usrreq.c:1.181.8.1	Mon Apr  9 13:34:10 2018
+++ src/sys/kern/uipc_usrreq.c	Sat May 12 10:42:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_usrreq.c,v 1.181.8.1 2018/04/09 13:34:10 bouyer Exp $	*/
+/*	$NetBSD: uipc_usrreq.c,v 1.181.8.2 2018/05/12 10:42:22 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2004, 2008, 2009 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.181.8.1 2018/04/09 13:34:10 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.181.8.2 2018/05/12 10:42:22 martin Exp $");
 
 #include 
 #include 
@@ -665,7 +665,7 @@ uipc_ctloutput(int op, struct socket *so
 u_long	unpst_sendspace = PIPSIZ;
 u_long	unpst_recvspace = PIPSIZ;
 u_long	unpdg_sendspace = 2*1024;	/* really max datagram size */
-u_long	unpdg_recvspace = 4*1024;
+u_long	unpdg_recvspace = 16*1024;
 
 u_int	unp_rights;			/* files in flight */
 u_int	unp_rights_ratio = 2;		/* limit, fraction of maxfiles */

Index: src/sys/net/raw_cb.h
diff -u src/sys/net/raw_cb.h:1.27.4.1 src/sys/net/raw_cb.h:1.27.4.2
--- src/sys/net/raw_cb.h:1.27.4.1	Sat Oct 21 19:43:54 2017
+++ src/sys/net/raw_cb.h	Sat May 12 10:42:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: raw_cb.h,v 1.27.4.1 2017/10/21 19:43:54 snj Exp $	*/
+/*	$NetBSD: raw_cb.h,v 1.27.4.2 2018/05/12 10:42:22 martin Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -57,7 +57,7 @@ struct rawcb {
  * Nominal space allocated to a raw socket.
  */
 #define	RAWSNDQ		8192
-#define	RAWRCVQ		8192
+#define	RAWRCVQ		16384
 
 LIST_HEAD(rawcbhead, rawcb);
 

Index: src/sys/netinet6/in6_proto.c
diff -u src/sys/netinet6/in6_proto.c:1.117.4.4 src/sys/netinet6/in6_proto.c:1.117.4.5
--- src/sys/netinet6/in6_proto.c:1.117.4.4	Sat Mar 31 10:41:06 2018
+++ src/sys/netinet6/in6_proto.c	Sat May 12 10:42:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_proto.c,v 1.117.4.4 2018/03/31 10:41:06 martin Exp $	*/
+/*	$NetBSD: in6_proto.c,v 1.117.4.5 2018/05/12 10:42:22 martin Exp $	*/
 /*	$KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.117.4.4 2018/03/31 10:41:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_proto.c,v 1.117.4.5 2018/05/12 10:42:22 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_gateway.h"
@@ -605,7 +605,7 @@ int pmtu_expire = 60*10;
  * Nominal space allocated to a raw ip socket.
  */
 #define	RIPV6SNDQ	8192
-#define	RIPV6RCVQ	8192
+#define	RIPV6RCVQ	16384
 
 u_long	rip6_sendspace = RIPV6SNDQ;
 u_long	rip6_recvspace = RIPV6RCVQ;



CVS commit: [netbsd-8] src/usr.bin/midiplay

2018-05-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May 12 10:40:25 UTC 2018

Modified Files:
src/usr.bin/midiplay [netbsd-8]: midiplay.1 midiplay.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #820):

usr.bin/midiplay/midiplay.1: revision 1.20
usr.bin/midiplay/midiplay.1: revision 1.21
usr.bin/midiplay/midiplay.c: revision 1.31
usr.bin/midiplay/midiplay.c: revision 1.32

if just parsing don't try to read the uninitialised device name,
or display the unit number.

add a "-s" option that sends an ALL_SOUNDS_OFF midi event.  very
useful after an interrupted midiplay leaves notes on.

Merge options without arguments in synopsis.

Sync usage with manpage.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.19.38.1 src/usr.bin/midiplay/midiplay.1
cvs rdiff -u -r1.30 -r1.30.8.1 src/usr.bin/midiplay/midiplay.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/midiplay/midiplay.1
diff -u src/usr.bin/midiplay/midiplay.1:1.19 src/usr.bin/midiplay/midiplay.1:1.19.38.1
--- src/usr.bin/midiplay/midiplay.1:1.19	Sat Jan 16 08:50:29 2010
+++ src/usr.bin/midiplay/midiplay.1	Sat May 12 10:40:25 2018
@@ -1,4 +1,5 @@
-.\" $NetBSD: midiplay.1,v 1.19 2010/01/16 08:50:29 mbalmer Exp $
+.\" $NetBSD: midiplay.1,v 1.19.38.1 2018/05/12 10:40:25 martin Exp $
+.\"
 .\" Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
@@ -25,7 +26,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd January 16, 2010
+.Dd May 2, 2018
 .Dt MIDIPLAY 1
 .Os
 .Sh NAME
@@ -33,15 +34,11 @@
 .Nd play MIDI and RMID files
 .Sh SYNOPSIS
 .Nm
+.Op Fl lmqsvx
 .Op Fl d Ar devno
 .Op Fl f Ar file
-.Op Fl l
-.Op Fl m
 .Op Fl p Ar pgm
-.Op Fl q
 .Op Fl t Ar tempo
-.Op Fl v
-.Op Fl x
 .Op Ar file ...
 .Sh DESCRIPTION
 The
@@ -86,6 +83,11 @@ There is no way at present to have
 selectively map channels or instruments.
 .It Fl q
 specifies that the MIDI file should not be played, just parsed.
+.It Fl s
+send an
+.Dq ALL SOUNDS OFF
+MIDI event.
+Useful if an interrupted MIDI file left notes playing.
 .It Fl t Ar tempo-adjust
 specifies an adjustment (in percent) to the tempi recorded in the file.
 The default of 100 plays as specified in the file, 50 halves every tempo,
@@ -123,3 +125,8 @@ It may take a long while before playing 
 .Nm
 is interrupted, as the data already buffered in the sequencer will contain
 timing events.
+Use
+.Nm
+with the
+.Fl s
+option to silence any sounds left after an interrupted call.

Index: src/usr.bin/midiplay/midiplay.c
diff -u src/usr.bin/midiplay/midiplay.c:1.30 src/usr.bin/midiplay/midiplay.c:1.30.8.1
--- src/usr.bin/midiplay/midiplay.c:1.30	Sun Mar 22 22:47:43 2015
+++ src/usr.bin/midiplay/midiplay.c	Sat May 12 10:40:25 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: midiplay.c,v 1.30 2015/03/22 22:47:43 mrg Exp $	*/
+/*	$NetBSD: midiplay.c,v 1.30.8.1 2018/05/12 10:40:25 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: midiplay.c,v 1.30 2015/03/22 22:47:43 mrg Exp $");
+__RCSID("$NetBSD: midiplay.c,v 1.30.8.1 2018/05/12 10:40:25 martin Exp $");
 #endif
 
 
@@ -128,6 +128,13 @@ static u_char sample[] = {
 #undef E
 #undef F
 
+static u_char silence_sample[] = {
+	'M', 'T', 'h', 'd',  0, 0, 0, 6,  0, 1,  0, 1,  0, 8,
+	'M', 'T', 'r', 'k',  0, 0, 0, 8,
+	0, 0xb0, 0x78, 0x00, 
+	0, 0xff, 0x2f, 0
+};
+
 #define MARK_HEADER "MThd"
 #define MARK_TRACK "MTrk"
 #define MARK_LEN 4
@@ -148,8 +155,8 @@ static u_char sample[] = {
 static void __attribute__((__noreturn__))
 usage(void)
 {
-	fprintf(stderr, "usage: %s [-d unit] [-f file] [-l] [-m] [-p pgm] [-q] "
-	   "[-t %%tempo] [-v] [-x] [file ...]\n",
+	fprintf(stderr, "usage: %s [-lmqsvx] [-d devno] [-f file] "
+		"[-p pgm] [-t tempo] [file ...]\n",
 		getprogname());
 	exit(1);
 }
@@ -408,9 +415,12 @@ playdata(u_char *buf, u_int tot, const c
 		err(1, "ioctl(SEQUENCER_INFO) failed");
 
 	end = buf + tot;
-	if (verbose)
-		printf("Playing %s (%d bytes) on %s (unit %d)... \n",
-		name, tot, info.name, info.device);
+	if (verbose) {
+		printf("Playing %s (%d bytes)", name, tot);
+		if (play)
+			printf(" on %s (unit %d)...", info.name, info.device);
+		puts("\n");
+	}
 
 	if (tot < MARK_LEN + 4) {
 		warnx("Not a MIDI file, too short");
@@ -716,6 +726,7 @@ main(int argc, char **argv)
 	int ch;
 	int listdevs = 0;
 	int example = 0;
+	int silence = 0;
 	int nmidi;
 	const char *file = DEVMUSIC;
 	const char *sunit;
@@ -725,7 +736,7 @@ main(int argc, char **argv)
 	if ((sunit = getenv("MIDIUNIT")))
 		unit = parse_unit(sunit);
 
-	while ((ch = getopt(argc, argv, "?d:f:lmp:qt:vx")) != -1) {
+	while ((ch = getopt(argc, argv, "?d:f:lmp:qst:vx")) != -1) {
 		switch(ch) {
 		case 'd':
 			unit = parse_unit(optarg);
@@ -745,6 +756,9 @@ 

CVS commit: [netbsd-8] src

2018-05-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May 12 10:35:45 UTC 2018

Modified Files:
src/distrib/sets/lists/man [netbsd-8]: mi
src/share/man/man4 [netbsd-8]: Makefile ixg.4
Added Files:
src/share/man/man4 [netbsd-8]: ixv.4

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #819):

share/man/man4/ixg.4: revision 1.11
share/man/man4/ixg.4: revision 1.12
share/man/man4/Makefile: revision 1.652
share/man/man4/ixv.4: revision 1.1
share/man/man4/ixv.4: revision 1.2
distrib/sets/lists/man/mi: revision 1.1585

Add a maunal page for ixv(4).
Add missing .Nd.
Fix xref.
Use Nx. Fix typo. Capitalize Gigabit and Ethernet.
Add ixv.4.


To generate a diff of this commit:
cvs rdiff -u -r1.1557.2.2 -r1.1557.2.3 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.637.2.1 -r1.637.2.2 src/share/man/man4/Makefile
cvs rdiff -u -r1.10 -r1.10.4.1 src/share/man/man4/ixg.4
cvs rdiff -u -r0 -r1.3.2.2 src/share/man/man4/ixv.4

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/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1557.2.2 src/distrib/sets/lists/man/mi:1.1557.2.3
--- src/distrib/sets/lists/man/mi:1.1557.2.2	Sun Feb 11 21:17:33 2018
+++ src/distrib/sets/lists/man/mi	Sat May 12 10:35:45 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1557.2.2 2018/02/11 21:17:33 snj Exp $
+# $NetBSD: mi,v 1.1557.2.3 2018/05/12 10:35:45 martin Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1354,6 +1354,7 @@
 ./usr/share/man/cat4/ix.0			man-sys-catman		.cat
 ./usr/share/man/cat4/ixg.0			man-sys-catman		.cat
 ./usr/share/man/cat4/ixpide.0			man-sys-catman		.cat
+./usr/share/man/cat4/ixv.0			man-sys-catman		.cat
 ./usr/share/man/cat4/iy.0			man-sys-catman		.cat
 ./usr/share/man/cat4/jme.0			man-sys-catman		.cat
 ./usr/share/man/cat4/jmide.0			man-sys-catman		.cat
@@ -4438,6 +4439,7 @@
 ./usr/share/man/html4/ix.html			man-sys-htmlman		html
 ./usr/share/man/html4/ixg.html			man-sys-htmlman		html
 ./usr/share/man/html4/ixpide.html		man-sys-htmlman		html
+./usr/share/man/html4/ixv.html			man-sys-htmlman		html
 ./usr/share/man/html4/iy.html			man-sys-htmlman		html
 ./usr/share/man/html4/jme.html			man-sys-htmlman		html
 ./usr/share/man/html4/jmide.html		man-sys-htmlman		html
@@ -7362,6 +7364,7 @@
 ./usr/share/man/man4/ix.4			man-sys-man		.man
 ./usr/share/man/man4/ixg.4			man-sys-man		.man
 ./usr/share/man/man4/ixpide.4			man-sys-man		.man
+./usr/share/man/man4/ixv.4			man-sys-man		.man
 ./usr/share/man/man4/iy.4			man-sys-man		.man
 ./usr/share/man/man4/jme.4			man-sys-man		.man
 ./usr/share/man/man4/jmide.4			man-sys-man		.man

Index: src/share/man/man4/Makefile
diff -u src/share/man/man4/Makefile:1.637.2.1 src/share/man/man4/Makefile:1.637.2.2
--- src/share/man/man4/Makefile:1.637.2.1	Sun Feb 11 21:17:34 2018
+++ src/share/man/man4/Makefile	Sat May 12 10:35:45 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.637.2.1 2018/02/11 21:17:34 snj Exp $
+#	$NetBSD: Makefile,v 1.637.2.2 2018/05/12 10:35:45 martin Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 MAN=	aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -35,7 +35,7 @@ MAN=	aac.4 ac97.4 acardide.4 aceride.4 a
 	inphy.4 intersil7170.4 \
 	ioasic.4 ioat.4 iop.4 iophy.4 iopsp.4 ip.4 ipkdb.4 ipmi.4 ipw.4 \
 	irmce.4 isp.4 ismt.4 isv.4 itesio.4 iteide.4 iwi.4 iwm.4 iwn.4 ixg.4 \
-	ixpide.4 \
+	ixpide.4 ixv.4 \
 	jme.4 jmide.4 joy.4 \
 	kloader.4 kse.4 ksyms.4 kttcp.4 \
 	l2tp.4 lc.4 ld.4 lii.4 lo.4 lua.4 lxtphy.4 \

Index: src/share/man/man4/ixg.4
diff -u src/share/man/man4/ixg.4:1.10 src/share/man/man4/ixg.4:1.10.4.1
--- src/share/man/man4/ixg.4:1.10	Fri Feb 24 13:04:23 2017
+++ src/share/man/man4/ixg.4	Sat May 12 10:35:45 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: ixg.4,v 1.10 2017/02/24 13:04:23 msaitoh Exp $
+.\" $NetBSD: ixg.4,v 1.10.4.1 2018/05/12 10:35:45 martin Exp $
 .\"
 .\" Copyright (c) 2001-2008, Intel Corporation
 .\" All rights reserved.
@@ -33,7 +33,7 @@
 .\"
 .\" $FreeBSD: src/share/man/man4/ixgbe.4,v 1.3 2010/12/19 23:54:31 yongari Exp $
 .\"
-.Dd February 24, 2017
+.Dd May 9, 2018
 .Dt IXG 4
 .Os
 .Sh NAME
@@ -85,6 +85,7 @@ go to the Intel support website at:
 .\" .Aq freebsd...@mailbox.intel.com .
 .Sh SEE ALSO
 .Xr arp 4 ,
+.Xr ixv 4 ,
 .Xr netintro 4 ,
 .Xr vlan 4 ,
 .Xr ifconfig 8
@@ -94,7 +95,7 @@ The
 device driver comes from
 .Fx ,
 where it is called
-.Xr ixgbe 4 .
+.Nm ixgbe .
 It first appeared in
 .Nx 6.0 .
 .Sh AUTHORS

Added files:

Index: src/share/man/man4/ixv.4
diff -u /dev/null src/share/man/man4/ixv.4:1.3.2.2
--- /dev/null	Sat May 12 10:35:45 2018
+++ src/share/man/man4/ixv.4	Sat May 12 10:35:45 2018
@@ -0,0 +1,66 @@
+.\"	$NetBSD: ixv.4,v 1.3.2.2 2018/05/12 10:35:45 martin Exp $
+.\"
+.\" Copyright (c) 2018 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD 

CVS commit: [netbsd-8] src/sys/compat

2018-05-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May 12 10:29:08 UTC 2018

Modified Files:
src/sys/compat/linux/common [netbsd-8]: linux_socket.c
src/sys/compat/linux32/common [netbsd-8]: linux32_socket.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #818):

sys/compat/linux/common/linux_socket.c: revision 1.142
sys/compat/linux32/common/linux32_socket.c: revision 1.29

Fix pserialize enter/exit pairs in linux_getifconf and linux32_getifconf

Tested by using a small linux program that uses ioctl(SIOCGIFCONF).
Probably fix PR kern/53259 as well.


To generate a diff of this commit:
cvs rdiff -u -r1.138.6.1 -r1.138.6.2 \
src/sys/compat/linux/common/linux_socket.c
cvs rdiff -u -r1.27.6.1 -r1.27.6.2 \
src/sys/compat/linux32/common/linux32_socket.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/compat/linux/common/linux_socket.c
diff -u src/sys/compat/linux/common/linux_socket.c:1.138.6.1 src/sys/compat/linux/common/linux_socket.c:1.138.6.2
--- src/sys/compat/linux/common/linux_socket.c:1.138.6.1	Thu Nov 30 15:57:37 2017
+++ src/sys/compat/linux/common/linux_socket.c	Sat May 12 10:29:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_socket.c,v 1.138.6.1 2017/11/30 15:57:37 martin Exp $	*/
+/*	$NetBSD: linux_socket.c,v 1.138.6.2 2018/05/12 10:29:08 martin Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.138.6.1 2017/11/30 15:57:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.138.6.2 2018/05/12 10:29:08 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1180,7 +1180,7 @@ linux_getifconf(struct lwp *l, register_
 			ifa_release(ifa, _ifa);
 		}
 
-		s = pserialize_read_enter();
+		KASSERT(pserialize_in_read_section());
 		if_release(ifp, );
 	}
 	pserialize_read_exit(s);

Index: src/sys/compat/linux32/common/linux32_socket.c
diff -u src/sys/compat/linux32/common/linux32_socket.c:1.27.6.1 src/sys/compat/linux32/common/linux32_socket.c:1.27.6.2
--- src/sys/compat/linux32/common/linux32_socket.c:1.27.6.1	Thu Nov 30 15:57:36 2017
+++ src/sys/compat/linux32/common/linux32_socket.c	Sat May 12 10:29:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_socket.c,v 1.27.6.1 2017/11/30 15:57:36 martin Exp $ */
+/*	$NetBSD: linux32_socket.c,v 1.27.6.2 2018/05/12 10:29:08 martin Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: linux32_socket.c,v 1.27.6.1 2017/11/30 15:57:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_socket.c,v 1.27.6.2 2018/05/12 10:29:08 martin Exp $");
 
 #include 
 #include 
@@ -478,7 +478,7 @@ linux32_getifconf(struct lwp *l, registe
 			ifa_release(ifa, _ifa);
 		}
 
-		s = pserialize_read_enter();
+		KASSERT(pserialize_in_read_section());
 		if_release(ifp, );
 	}
 	pserialize_read_exit(s);



CVS commit: [netbsd-8] src/doc

2018-05-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed May  9 15:38:05 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Tickets #814 - #817


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.195 -r1.1.2.196 src/doc/CHANGES-8.0

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.195 src/doc/CHANGES-8.0:1.1.2.196
--- src/doc/CHANGES-8.0:1.1.2.195	Mon May  7 13:28:35 2018
+++ src/doc/CHANGES-8.0	Wed May  9 15:38:05 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.195 2018/05/07 13:28:35 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.196 2018/05/09 15:38:05 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -13339,4 +13339,31 @@ sys/dev/usb/if_axe.c1.85-1.89
 	Use the proper station nodeid read command.
 	[nonaka, ticket #782]
 
+sys/dev/pci/if_bnx.c1.64
+sys/dev/pci/if_bnxvar.h1.7
+
+	- Fix potential panic in bnx(4) on shutdown.
+	- Use pci_intr_establish_xname().
+	[msaitoh, ticket #814]
+
+sys/dev/ic/hme.c1.97
+
+	Fix mis-placed parenthesis.
+	[pgoyette, ticket #815]
+
+sys/dev/pci/if_wm.c1.578
+
+	- Fix a bug that TX might stall after initializing wm interface.
+	- Fix a bug that watchdog timer doesn't reinitialize the interface
+	  correctly.
+	[msaitoh, ticket #816]
+
+sys/net/npf/npf.h1.56
+sys/net/npf/npf_alg_icmp.c			1.26
+sys/net/npf/npf_handler.c			1.38,1.39
+sys/net/npf/npf_inet.c1.38-1.44
+sys/net/npf/npf_sendpkt.c			1.17,1.18
+
+	Various fixes for NPF.
+	[maxv, ticket #817]
 



CVS commit: [netbsd-8] src/sys/net/npf

2018-05-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed May  9 15:35:37 UTC 2018

Modified Files:
src/sys/net/npf [netbsd-8]: npf.h npf_alg_icmp.c npf_handler.c
npf_inet.c npf_sendpkt.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #817):

sys/net/npf/npf_inet.c: revision 1.38-1.44
sys/net/npf/npf_handler.c: revision 1.38-1.39
sys/net/npf/npf_alg_icmp.c: revision 1.26
sys/net/npf/npf.h: revision 1.56
sys/net/npf/npf_sendpkt.c: revision 1.17-1.18

Declare NPC_FMTERR, and use it to kick malformed packets. Several sanity
checks are added in IPv6; after we see the first IPPROTO_FRAGMENT header,
we are allowed to fail to advance, otherwise we kick the packet.
Sent on tech-net@ a few days ago, no response, but I'm committing it now
anyway.

Switch nptr to uint8_t, and use nbuf_ensure_contig. Makes us use fewer
magic values.

Remove dead branches, 'npc' can't be NULL (and it is dereferenced
earlier).

Fix two consecutive mistakes.

The first mistake was npf_inet.c rev1.37:
"Don't reassemble ipv6 fragments, instead treat the first fragment
as a regular packet (subject to filtering rules), and pass
subsequent fragments in the same group unconditionally."

Doing this was entirely wrong, because then a packet just had to push
the L4 payload in a secondary fragment, and NPF wouldn't apply rules on
it - meaning any IPv6 packet could bypass >=L4 filtering. This mistake
was supposed to be a fix for the second mistake.

The second mistake was that ip6_reass_packet (in npf_reassembly) was
getting called with npc->npc_hlen. But npc_hlen pointed to the last
encountered header in the IPv6 chain, which was not necessarily the
fragment header. So ip6_reass_packet was given garbage, and would fail,
resulting in the packet getting kicked. So basically IPv6 was broken by
NPF.

The first mistake is reverted, and the second one is fixed by doing:
-   hlen = sizeof(struct ip6_frag);
+   hlen = 0;

Now the iteration stops on the fragment header, and the call to
ip6_reass_packet is valid.

My npf_inet.c rev1.38 is partially reverted: we don't need to worry
about failing properly to advance; once the packet is reassembled
npf_cache_ip gets called again, and this time the whole chain should be
there.

Tested with a simple UDPv6 server - send a 3000-byte-sized buffer, the
packet gets correctly reassembled by NPF now.

Mmh, put back the RFC6946 check (about dummy fragments), otherwise NPF
is not happy in npf_reassembly, because NPC_IPFRAG is again returned after
the packet was reassembled.

I'm wondering whether it would not be better to just remove the fragment
header in frag6_input directly.

Fix the "return-rst" rule on IPv6 packets.
The scopes needed to be set on the addresses before invoking ip6_output,
because ip6_output needs them. The reason they are not here already is
because pfil_run_hooks (in ip6_input) is called _before_ the kernel
initializes the scopes.

Until now ip6_output was always failing, and the IPv6-TCP-RST packet was
never actually sent.

Perhaps it would be better to have the kernel initialize the scopes
before invoking pfil_run_hooks, but several things will need to be fixed
in several places.

Tested with a simple TCPv6 server. Until now the client would block
waiting for an answer that never came; now it receives an RST right away
and closes the connection, as expected.
I believe that the same problem exists in the "return-icmp" rules, but I
can't investigate this right now (some problems with wireshark).

Fix the IPv6 payload computation in npf_tcpsaw. It was incorrect, and this
caused the "return-rst" rules to send back an RST with the wrong ACK when
the received SYN had an IPv6 option.

Set the scopes before calling icmp6_error(). This fixes a bug similar to
the one I fixed in rev1.17: since the scopes were not set the packet was
never actually sent.

Tested with wireshark, now the ICMPv6 reply is correctly sent, as
expected.

Don't read the L4 payload after IPPROTO_AH when handling IPv6 packets.
AH must be considered as the payload, otherwise a

block all
pass in proto ah from any
pass out proto ah from any

configuration will actually block everything, because NPF checks the
protocol against the one found after AH, and not AH itself.

In addition it may have been a problem for stateful connections; an AH
packet sent by an attacker with an incorrect authentication and a correct
TCP/UDP/whatever payload from an active connection could manage to change
NPF's FSM state, which would perhaps have altered the legitimate
connection with the authenticated remote IPsec host.

Note that IPv4 already doesn't go beyond AH, which is the correct
behavior.

Add XXX (we don't handle IPv6 Jumbograms), and whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.54.6.1 -r1.54.6.2 src/sys/net/npf/npf.h
cvs rdiff -u -r1.24 -r1.24.8.1 

CVS commit: [netbsd-8] src/sys/dev/pci

2018-05-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed May  9 15:28:44 UTC 2018

Modified Files:
src/sys/dev/pci [netbsd-8]: if_wm.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #816):

sys/dev/pci/if_wm.c: revision 1.578

  Fix a bug that TX might stall because WM_TXQ_NO_SPACE is not cleared in
if_init() (though I've never seen this problem). Clear txq->txq_flags in
wm_init_tx_queue(). OK'd by knakahara.


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.17 -r1.508.4.18 src/sys/dev/pci/if_wm.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/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.508.4.17 src/sys/dev/pci/if_wm.c:1.508.4.18
--- src/sys/dev/pci/if_wm.c:1.508.4.17	Mon Apr 16 14:25:49 2018
+++ src/sys/dev/pci/if_wm.c	Wed May  9 15:28:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.17 2018/04/16 14:25:49 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.18 2018/05/09 15:28:44 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.17 2018/04/16 14:25:49 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.18 2018/05/09 15:28:44 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -6696,6 +6696,7 @@ wm_init_tx_queue(struct wm_softc *sc, st
 	wm_init_tx_regs(sc, wmq, txq);
 	wm_init_tx_buffer(sc, txq);
 
+	txq->txq_flags = 0; /* Clear WM_TXQ_NO_SPACE */
 	txq->txq_watchdog = false;
 }
 



CVS commit: [netbsd-8] src/sys/dev/ic

2018-05-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed May  9 15:21:02 UTC 2018

Modified Files:
src/sys/dev/ic [netbsd-8]: hme.c

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #815):

sys/dev/ic/hme.c: revision 1.97

Fix mis-placed right paren.  kern/53271


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.96.2.1 src/sys/dev/ic/hme.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/ic/hme.c
diff -u src/sys/dev/ic/hme.c:1.96 src/sys/dev/ic/hme.c:1.96.2.1
--- src/sys/dev/ic/hme.c:1.96	Tue May 23 02:19:14 2017
+++ src/sys/dev/ic/hme.c	Wed May  9 15:21:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: hme.c,v 1.96 2017/05/23 02:19:14 ozaki-r Exp $	*/
+/*	$NetBSD: hme.c,v 1.96.2.1 2018/05/09 15:21:02 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.96 2017/05/23 02:19:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.96.2.1 2018/05/09 15:21:02 martin Exp $");
 
 /* #define HMEDEBUG */
 
@@ -753,7 +753,7 @@ hme_get(struct hme_softc *sc, int ri, ui
 			pktlen = m0->m_pkthdr.len - ETHER_HDR_LEN;
 		} else if (ntohs(eh->ether_type) == ETHERTYPE_VLAN) {
 			evh = (struct ether_vlan_header *)eh;
-			if (ntohs(evh->evl_proto != ETHERTYPE_IP))
+			if (ntohs(evh->evl_proto) != ETHERTYPE_IP)
 goto swcsum;
 			ip = (struct ip *)((char *)eh + ETHER_HDR_LEN +
 			ETHER_VLAN_ENCAP_LEN);



CVS commit: [netbsd-8] src/sys/dev/pci

2018-05-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed May  9 14:52:40 UTC 2018

Modified Files:
src/sys/dev/pci [netbsd-8]: if_bnx.c if_bnxvar.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #814):

sys/dev/pci/if_bnxvar.h: revision 1.7
sys/dev/pci/if_bnx.c: revision 1.64

- Fix a bug that bnx(4) panics on shutdown. Stop callout before restroy.
   Reported by Andreas Gustafsson in PR#53265.
- Make sure not to re-arm the callout when we are about to detach. Same as
   if_bge.c rev. 1.292.
- Use pci_intr_establish_xname().


To generate a diff of this commit:
cvs rdiff -u -r1.61.8.1 -r1.61.8.2 src/sys/dev/pci/if_bnx.c
cvs rdiff -u -r1.6 -r1.6.22.1 src/sys/dev/pci/if_bnxvar.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/if_bnx.c
diff -u src/sys/dev/pci/if_bnx.c:1.61.8.1 src/sys/dev/pci/if_bnx.c:1.61.8.2
--- src/sys/dev/pci/if_bnx.c:1.61.8.1	Tue Oct 24 08:38:59 2017
+++ src/sys/dev/pci/if_bnx.c	Wed May  9 14:52:40 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bnx.c,v 1.61.8.1 2017/10/24 08:38:59 snj Exp $	*/
+/*	$NetBSD: if_bnx.c,v 1.61.8.2 2018/05/09 14:52:40 martin Exp $	*/
 /*	$OpenBSD: if_bnx.c,v 1.85 2009/11/09 14:32:41 dlg Exp $ */
 
 /*-
@@ -35,7 +35,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.61.8.1 2017/10/24 08:38:59 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.61.8.2 2018/05/09 14:52:40 martin Exp $");
 
 /*
  * The following controllers are supported by this driver:
@@ -792,7 +792,8 @@ bnx_attach(device_t parent, device_t sel
 	IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv4_Rx;
 
 	/* Hookup IRQ last. */
-	sc->bnx_intrhand = pci_intr_establish(pc, ih, IPL_NET, bnx_intr, sc);
+	sc->bnx_intrhand = pci_intr_establish_xname(pc, ih, IPL_NET, bnx_intr,
+	sc, device_xname(self));
 	if (sc->bnx_intrhand == NULL) {
 		aprint_error_dev(self, "couldn't establish interrupt");
 		if (intrstr != NULL)
@@ -890,17 +891,7 @@ bnx_detach(device_t dev, int flags)
 
 	/* Stop and reset the controller. */
 	s = splnet();
-	if (ifp->if_flags & IFF_RUNNING)
-		bnx_stop(ifp, 1);
-	else {
-		/* Disable the transmit/receive blocks. */
-		REG_WR(sc, BNX_MISC_ENABLE_CLR_BITS, 0x5ff);
-		REG_RD(sc, BNX_MISC_ENABLE_CLR_BITS);
-		DELAY(20);
-		bnx_disable_intr(sc);
-		bnx_reset(sc, BNX_DRV_MSG_CODE_RESET);
-	}
-
+	bnx_stop(ifp, 1);
 	splx(s);
 
 	pmf_device_deregister(dev);
@@ -3371,10 +3362,11 @@ bnx_stop(struct ifnet *ifp, int disable)
 
 	DBPRINT(sc, BNX_VERBOSE_RESET, "Entering %s()\n", __func__);
 
-	if ((ifp->if_flags & IFF_RUNNING) == 0)
-		return;
-
-	callout_stop(>bnx_timeout);
+	if (disable) {
+		sc->bnx_detaching = 1;
+		callout_halt(>bnx_timeout, NULL);
+	} else
+		callout_stop(>bnx_timeout);
 
 	mii_down(>bnx_mii);
 
@@ -5694,9 +5686,6 @@ bnx_tick(void *xsc)
 	/* Update the statistics from the hardware statistics block. */
 	bnx_stats_update(sc);
 
-	/* Schedule the next tick. */
-	callout_reset(>bnx_timeout, hz, bnx_tick, sc);
-
 	mii = >bnx_mii;
 	mii_tick(mii);
 
@@ -5707,6 +5696,11 @@ bnx_tick(void *xsc)
 	bnx_get_buf(sc, , _prod, _bseq);
 	sc->rx_prod = prod;
 	sc->rx_prod_bseq = prod_bseq;
+
+	/* Schedule the next tick. */
+	if (!sc->bnx_detaching)
+		callout_reset(>bnx_timeout, hz, bnx_tick, sc);
+
 	splx(s);
 	return;
 }

Index: src/sys/dev/pci/if_bnxvar.h
diff -u src/sys/dev/pci/if_bnxvar.h:1.6 src/sys/dev/pci/if_bnxvar.h:1.6.22.1
--- src/sys/dev/pci/if_bnxvar.h:1.6	Tue Jul  1 17:11:35 2014
+++ src/sys/dev/pci/if_bnxvar.h	Wed May  9 14:52:40 2018
@@ -210,6 +210,7 @@ struct bnx_softc
 	uint32_t		tx_prod_bseq;	/* Counts the bytes used.  */
 
 	struct callout		bnx_timeout;
+	int			bnx_detaching;
 
 	/* Frame size and mbuf allocation size for RX frames. */
 	uint32_t		max_frame_size;



CVS commit: [netbsd-8] src/doc

2018-05-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May  7 13:28:35 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Ticket #782


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.194 -r1.1.2.195 src/doc/CHANGES-8.0

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.194 src/doc/CHANGES-8.0:1.1.2.195
--- src/doc/CHANGES-8.0:1.1.2.194	Mon May  7 05:09:40 2018
+++ src/doc/CHANGES-8.0	Mon May  7 13:28:35 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.194 2018/05/07 05:09:40 snj Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.195 2018/05/07 13:28:35 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -1,3 +1,10 @@ usr.sbin/sysinst/partman.c			1.20-1.21
 	PR install/53220.
 	[kre, ticket #801]
 
+sys/dev/usb/if_axe.c1.85-1.89
+
+	Fix unintialized variable, merge duplicate code.
+	Use the proper station nodeid read command.
+	[nonaka, ticket #782]
+
+



CVS commit: [netbsd-8] src/sys/dev/usb

2018-05-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May  7 13:26:03 UTC 2018

Modified Files:
src/sys/dev/usb [netbsd-8]: if_axe.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #782):

sys/dev/usb/if_axe.c: revision 1.85-1.89

propagate pullup-782 for NetBSD-8 to HEAD (gcc uninitialized)

It was not gcc's fault for correctly detecting an uninitialized variable.

Fix the uninitialized variable issues by error checking things.
downgrade error to debug.

merge duplicated code, back to logging error.

use the proper station nodeid read command.


To generate a diff of this commit:
cvs rdiff -u -r1.82.6.2 -r1.82.6.3 src/sys/dev/usb/if_axe.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/usb/if_axe.c
diff -u src/sys/dev/usb/if_axe.c:1.82.6.2 src/sys/dev/usb/if_axe.c:1.82.6.3
--- src/sys/dev/usb/if_axe.c:1.82.6.2	Wed Jan 31 18:01:55 2018
+++ src/sys/dev/usb/if_axe.c	Mon May  7 13:26:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_axe.c,v 1.82.6.2 2018/01/31 18:01:55 martin Exp $	*/
+/*	$NetBSD: if_axe.c,v 1.82.6.3 2018/05/07 13:26:03 martin Exp $	*/
 /*	$OpenBSD: if_axe.c,v 1.137 2016/04/13 11:03:37 mpi Exp $ */
 
 /*
@@ -87,7 +87,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.82.6.2 2018/01/31 18:01:55 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.82.6.3 2018/05/07 13:26:03 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -303,7 +303,7 @@ axe_cmd(struct axe_softc *sc, int cmd, i
 	KASSERT(mutex_owned(>axe_mii_lock));
 
 	if (sc->axe_dying)
-		return 0;
+		return -1;
 
 	DPRINTFN(20, "cmd %#jx index %#jx val %#jx", cmd, index, val, 0);
 
@@ -337,7 +337,7 @@ axe_miibus_readreg_locked(device_t dev, 
 
 	axe_cmd(sc, AXE_CMD_MII_OPMODE_SW, 0, 0, NULL);
 
-	err = axe_cmd(sc, AXE_CMD_MII_READ_REG, reg, phy, (void *));
+	err = axe_cmd(sc, AXE_CMD_MII_READ_REG, reg, phy, );
 	axe_cmd(sc, AXE_CMD_MII_OPMODE_HW, 0, 0, NULL);
 	if (err) {
 		aprint_error_dev(sc->axe_dev, "read PHY failed\n");
@@ -389,7 +389,7 @@ axe_miibus_writereg_locked(device_t dev,
 	val = htole16(aval);
 
 	axe_cmd(sc, AXE_CMD_MII_OPMODE_SW, 0, 0, NULL);
-	err = axe_cmd(sc, AXE_CMD_MII_WRITE_REG, reg, phy, (void *));
+	err = axe_cmd(sc, AXE_CMD_MII_WRITE_REG, reg, phy, );
 	axe_cmd(sc, AXE_CMD_MII_OPMODE_HW, 0, 0, NULL);
 
 	if (err) {
@@ -477,7 +477,11 @@ axe_setmulti(struct axe_softc *sc)
 		return;
 
 	axe_lock_mii(sc);
-	axe_cmd(sc, AXE_CMD_RXCTL_READ, 0, 0, (void *));
+	if (axe_cmd(sc, AXE_CMD_RXCTL_READ, 0, 0, )) {
+		axe_unlock_mii(sc);
+		aprint_error_dev(sc->axe_dev, "can't read rxmode");
+		return;
+	}
 	rxmode = le16toh(rxmode);
 
 	rxmode &=
@@ -507,7 +511,7 @@ axe_setmulti(struct axe_softc *sc)
 	ifp->if_flags &= ~IFF_ALLMULTI;
 	rxmode |= AXE_RXCMD_MULTICAST;
 
-	axe_cmd(sc, AXE_CMD_WRITE_MCAST, 0, 0, (void *));
+	axe_cmd(sc, AXE_CMD_WRITE_MCAST, 0, 0, hashtbl);
 	axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, rxmode, NULL);
 	axe_unlock_mii(sc);
 	return;
@@ -519,6 +523,30 @@ axe_setmulti(struct axe_softc *sc)
 	axe_unlock_mii(sc);
 }
 
+static void
+axe_ax_init(struct axe_softc *sc)
+{
+	int cmd = AXE_178_CMD_READ_NODEID;
+
+	if (sc->axe_flags & AX178) {
+		axe_ax88178_init(sc);
+	} else if (sc->axe_flags & AX772) {
+		axe_ax88772_init(sc);
+	} else if (sc->axe_flags & AX772A) {
+		axe_ax88772a_init(sc);
+	} else if (sc->axe_flags & AX772B) {
+		axe_ax88772b_init(sc);
+		return;
+	} else {
+		cmd = AXE_172_CMD_READ_NODEID;
+	}
+
+	if (axe_cmd(sc, cmd, 0, 0, sc->axe_enaddr)) {
+		aprint_error_dev(sc->axe_dev,
+		"failed to read ethernet address\n");
+	}
+}
+
 
 static void
 axe_reset(struct axe_softc *sc)
@@ -542,15 +570,8 @@ axe_reset(struct axe_softc *sc)
 #else
 	axe_lock_mii(sc);
 
-	if (sc->axe_flags & AX178) {
-		axe_ax88178_init(sc);
-	} else if (sc->axe_flags & AX772) {
-		axe_ax88772_init(sc);
-	} else if (sc->axe_flags & AX772A) {
-		axe_ax88772a_init(sc);
-	} else if (sc->axe_flags & AX772B) {
-		axe_ax88772b_init(sc);
-	}
+	axe_ax_init(sc);
+
 	axe_unlock_mii(sc);
 #endif
 }
@@ -594,7 +615,8 @@ axe_ax88178_init(struct axe_softc *sc)
 
 	axe_cmd(sc, AXE_CMD_SROM_WR_ENABLE, 0, 0, NULL);
 	/* XXX magic */
-	axe_cmd(sc, AXE_CMD_SROM_READ, 0, 0x0017, );
+	if (axe_cmd(sc, AXE_CMD_SROM_READ, 0, 0x0017, ) != 0)
+		eeprom = 0x;
 	axe_cmd(sc, AXE_CMD_SROM_WR_DISABLE, 0, 0, NULL);
 
 	eeprom = le16toh(eeprom);
@@ -752,8 +774,7 @@ axe_ax88772_phywake(struct axe_softc *sc
 	if (sc->axe_phyno == AXE_772_PHY_NO_EPHY) {
 		/* Manually select internal(embedded) PHY - MAC mode. */
 		axe_cmd(sc, AXE_CMD_SW_PHY_SELECT, 0,
-		AXE_SW_PHY_SELECT_EMBEDDED,
-		NULL);
+		AXE_SW_PHY_SELECT_EMBEDDED, NULL);
 		usbd_delay_ms(sc->axe_udev, hztoms(hz / 32));
 	} else {
 		/*
@@ -815,7 +836,12 @@ axe_ax88772b_init(struct axe_softc *sc)
 	 * Save PHY power saving configuration(high byte) and
 	 * clear EEPROM checksum value(low byte).
 	 */
-	axe_cmd(sc, 

CVS commit: [netbsd-8] src/doc

2018-05-06 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon May  7 05:09:40 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
793, 794, 797, 798, 801


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.193 -r1.1.2.194 src/doc/CHANGES-8.0

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.193 src/doc/CHANGES-8.0:1.1.2.194
--- src/doc/CHANGES-8.0:1.1.2.193	Sun May  6 13:10:10 2018
+++ src/doc/CHANGES-8.0	Mon May  7 05:09:40 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.193 2018/05/06 13:10:10 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.194 2018/05/07 05:09:40 snj Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -13299,3 +13299,37 @@ sys/net/if_vlan.c1.122
 	Avoid a bogus kmem_alloc(9) call with zero size.
 	[spz, ticket #813]
 
+usr.sbin/sysinst/partman.c			1.16-1.17
+
+	Fix copy paste error. from coverity.
+	Cosmetics: fix the order of calloc() arguments.
+	[martin, ticket #793]
+
+usr.sbin/sysinst/partman.c			1.18
+
+	Fix missing {} in issue.pm_cgd_check().
+	[martin, ticket #794]
+
+sbin/gpt/gpt.8	1.60-1.63
+sbin/gpt/header.c1.9
+
+	Make the "gpt header" command return EXIT_FAILURE when no
+	GPT is present.  This helps sysinst to tell a GPT labeled disk
+	from others.
+
+	Man page imrovements.
+	[martin, ticket #797]
+
+usr.sbin/sysinst/disks.c			1.14
+
+	Simplify and get rid of external "grep" dependency which is not
+	available on all install meadia.  PR install/53220.
+	[martin, ticket #798]
+
+usr.sbin/sysinst/partman.c			1.20-1.21
+
+	Fix a core dump in sysinst when the externed partition manager
+	is used on a system where the lvm command is not present.
+	PR install/53220.
+	[kre, ticket #801]
+



CVS commit: [netbsd-8] src/usr.sbin/sysinst

2018-05-06 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon May  7 04:06:31 UTC 2018

Modified Files:
src/usr.sbin/sysinst [netbsd-8]: partman.c

Log Message:
Pull up following revision(s) (requested by kre in ticket #801):
usr.sbin/sysinst/partman.c: 1.20-1.21
PR install/53220
Don't call pm_lvm_find() unless have_lvm
pm_lvm_find() assumes that data structs (lvms) has been allocated
for it to use, which doesn't happen if !have_lvm
This avoids a sysinst core dump when the lvm command is not installed
(such as when installing from the embedded RAM root filesys in an
INSTALL kernel.)
--
Change return type of pm_lvm_find() from int to void.
It always returns (returned) 0 which was ignored by the one call.


To generate a diff of this commit:
cvs rdiff -u -r1.15.6.2 -r1.15.6.3 src/usr.sbin/sysinst/partman.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.sbin/sysinst/partman.c
diff -u src/usr.sbin/sysinst/partman.c:1.15.6.2 src/usr.sbin/sysinst/partman.c:1.15.6.3
--- src/usr.sbin/sysinst/partman.c:1.15.6.2	Mon May  7 03:51:01 2018
+++ src/usr.sbin/sysinst/partman.c	Mon May  7 04:06:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: partman.c,v 1.15.6.2 2018/05/07 03:51:01 snj Exp $ */
+/*	$NetBSD: partman.c,v 1.15.6.3 2018/05/07 04:06:31 snj Exp $ */
 
 /*
  * Copyright 2012 Eugene Lozovoy
@@ -1173,7 +1173,7 @@ pm_cgd_commit(void)
 
 /* Add lvm logical volumes to pm list */
 /* XXX: rewrite */
-static int
+static void
 pm_lvm_find(void)
 {
 	int i, ii, already_found;
@@ -1213,7 +1213,6 @@ pm_lvm_find(void)
 			memset(pm_new, 0, sizeof *pm_new);
 		}
 	}
-	return 0;
 }
 
 static int
@@ -2609,7 +2608,8 @@ pm_upddevlist(menudesc *m, void *arg)
 			pm_i->found = 0;
 	/* Detect all present devices */
 	(void)find_disks("partman");
-	pm_lvm_find();
+	if (have_lvm)
+		pm_lvm_find();
 	pm_clean();
 
 	if (m == NULL || arg == NULL)



CVS commit: [netbsd-8] src/usr.sbin/sysinst

2018-05-06 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon May  7 04:03:20 UTC 2018

Modified Files:
src/usr.sbin/sysinst [netbsd-8]: disks.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #798):
usr.sbin/sysinst/disks.c: 1.14
Simplify and get rid of external "grep" dependency which is not available
on all install meadia.
Sugested by kre.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.6.1 src/usr.sbin/sysinst/disks.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.sbin/sysinst/disks.c
diff -u src/usr.sbin/sysinst/disks.c:1.13 src/usr.sbin/sysinst/disks.c:1.13.6.1
--- src/usr.sbin/sysinst/disks.c:1.13	Fri Jan 13 05:49:27 2017
+++ src/usr.sbin/sysinst/disks.c	Mon May  7 04:03:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: disks.c,v 1.13 2017/01/13 05:49:27 christos Exp $ */
+/*	$NetBSD: disks.c,v 1.13.6.1 2018/05/07 04:03:20 snj Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1480,11 +1480,12 @@ incoregpt(pm_devs_t *pm_cur, partinfo *l
 static bool
 is_gpt(const char *dev)
 {
+
 	check_available_binaries();
 
 	if (!have_gpt)
 		return false;
 
-	return !run_program(RUN_SILENT | RUN_ERROR_OK,
-		"sh -c 'gpt show %s |grep -e Pri\\ GPT\\ table'", dev);
+	return run_program(RUN_SILENT | RUN_ERROR_OK,
+		"gpt -qr header %s", dev) == 0;
 }



CVS commit: [netbsd-8] src/sbin/gpt

2018-05-06 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon May  7 04:00:18 UTC 2018

Modified Files:
src/sbin/gpt [netbsd-8]: gpt.8 header.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #797):
sbin/gpt/gpt.8: 1.60-1.63
sbin/gpt/header.c: 1.9
Make the "gpt header" command return EXIT_FAILURE when no GPT is present.
This helps sysinst to tell a GPT labeled disk from others.
Very lazy version of a change proposed by kre.
--
Sort sections.
--
Bump date for new EXIT STATUS section.
--
Spello.   (it is "existence").
ispell also says that we should s/parseable/parsable/ but I'm
not sure about that one, so I left it.
I also left a correct spelling that no-one has bothered to mangle!


To generate a diff of this commit:
cvs rdiff -u -r1.52.4.2 -r1.52.4.3 src/sbin/gpt/gpt.8
cvs rdiff -u -r1.8 -r1.8.8.1 src/sbin/gpt/header.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/gpt/gpt.8
diff -u src/sbin/gpt/gpt.8:1.52.4.2 src/sbin/gpt/gpt.8:1.52.4.3
--- src/sbin/gpt/gpt.8:1.52.4.2	Fri May  4 16:24:46 2018
+++ src/sbin/gpt/gpt.8	Mon May  7 04:00:18 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpt.8,v 1.52.4.2 2018/05/04 16:24:46 martin Exp $
+.\" $NetBSD: gpt.8,v 1.52.4.3 2018/05/07 04:00:18 snj Exp $
 .\"
 .\" Copyright (c) 2002 Marcel Moolenaar
 .\" All rights reserved.
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD: src/sbin/gpt/gpt.8,v 1.17 2006/06/22 22:22:32 marcel Exp $
 .\"
-.Dd March 5, 2018
+.Dd May 1, 2018
 .Dt GPT 8
 .Os
 .Sh NAME
@@ -678,6 +678,12 @@ They may be used by
 .Nx
 code in the future.
 .El
+.Sh EXIT STATUS
+The
+.Nm
+command exits with a failure status (1) when the header command
+is used and no GPT header is found.
+This can be used to check for the existence of a GPT in shell scripts.
 .Sh EXAMPLES
 .Bd -literal
 nas# gpt show wd3

Index: src/sbin/gpt/header.c
diff -u src/sbin/gpt/header.c:1.8 src/sbin/gpt/header.c:1.8.8.1
--- src/sbin/gpt/header.c:1.8	Thu Dec 24 17:35:57 2015
+++ src/sbin/gpt/header.c	Mon May  7 04:00:18 2018
@@ -33,7 +33,7 @@
 
 #include 
 #ifdef __RCSID
-__RCSID("$NetBSD: header.c,v 1.8 2015/12/24 17:35:57 martin Exp $");
+__RCSID("$NetBSD: header.c,v 1.8.8.1 2018/05/07 04:00:18 snj Exp $");
 #endif
 
 #include 
@@ -83,7 +83,7 @@ header(gpt_t gpt)
 	map = map_find(gpt, MAP_TYPE_PRI_GPT_HDR);
 	if (map == NULL) {
 		printf("- GPT Header not found\n");
-		return 0;
+		return -1;
 	}
 
 	hdr = map->map_data;



CVS commit: [netbsd-8] src/usr.sbin/sysinst

2018-05-06 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon May  7 03:51:01 UTC 2018

Modified Files:
src/usr.sbin/sysinst [netbsd-8]: partman.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #794):
usr.sbin/sysinst/partman.c: 1.18
fixes for GCC 6.4:
sysinst's pm_cgd_check() has missing {} issue.


To generate a diff of this commit:
cvs rdiff -u -r1.15.6.1 -r1.15.6.2 src/usr.sbin/sysinst/partman.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.sbin/sysinst/partman.c
diff -u src/usr.sbin/sysinst/partman.c:1.15.6.1 src/usr.sbin/sysinst/partman.c:1.15.6.2
--- src/usr.sbin/sysinst/partman.c:1.15.6.1	Mon May  7 03:49:16 2018
+++ src/usr.sbin/sysinst/partman.c	Mon May  7 03:51:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: partman.c,v 1.15.6.1 2018/05/07 03:49:16 snj Exp $ */
+/*	$NetBSD: partman.c,v 1.15.6.2 2018/05/07 03:51:01 snj Exp $ */
 
 /*
  * Copyright 2012 Eugene Lozovoy
@@ -1099,10 +1099,11 @@ pm_cgd_check(void *arg)
 		return 0;
 	if (dev_ptr->pm == NULL)
 		dev_ptr->enabled = 0;
-	else
+	else {
 		pm_manage_getfreenode(&(dev_ptr->node), "cgd", _t_info);
 		if (dev_ptr->node < 0)
 			dev_ptr->enabled = 0;
+	}
 	return dev_ptr->enabled;
 }
 



CVS commit: [netbsd-8] src/usr.sbin/sysinst

2018-05-06 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon May  7 03:49:16 UTC 2018

Modified Files:
src/usr.sbin/sysinst [netbsd-8]: partman.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #793):
usr.sbin/sysinst/partman.c: 1.16-1.17
Fix copy paste error. from coverity.
Cosmetics: fix the order of calloc() arguments.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.6.1 src/usr.sbin/sysinst/partman.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.sbin/sysinst/partman.c
diff -u src/usr.sbin/sysinst/partman.c:1.15 src/usr.sbin/sysinst/partman.c:1.15.6.1
--- src/usr.sbin/sysinst/partman.c:1.15	Thu Jan 12 17:38:08 2017
+++ src/usr.sbin/sysinst/partman.c	Mon May  7 03:49:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: partman.c,v 1.15 2017/01/12 17:38:08 christos Exp $ */
+/*	$NetBSD: partman.c,v 1.15.6.1 2018/05/07 03:49:16 snj Exp $ */
 
 /*
  * Copyright 2012 Eugene Lozovoy
@@ -2116,7 +2116,7 @@ pm_mountall(void)
 	
 	localfs_dev[0] = '\0';
 	if (mnts == NULL)
-		mnts = calloc(sizeof(*mnts), MAX_MNTS);
+		mnts = calloc(MAX_MNTS, sizeof(*mnts));
 
 	SLIST_FOREACH(pm_i, _head, l) {
 		ok = 0;
@@ -2731,23 +2731,23 @@ partman(void)
 
 		if (!have_raid)
 			remove_raid_options();
-		else if (!(raids = calloc(sizeof(*raids), MAX_RAID)))
+		else if (!(raids = calloc(MAX_RAID, sizeof(*raids
 			have_raid = 0;
 			
 #define remove_vnd_options() (void)0
 		if (!have_vnd)
 			remove_vnd_options();
-		else if (!(vnds = calloc(sizeof(*vnds), MAX_VND)))
+		else if (!(vnds = calloc(MAX_VND, sizeof(*vnds
 			have_vnd = 0;
 
 		if (!have_cgd)
 			remove_cgd_options();
-		else if (!(cgds = calloc(sizeof(*vnds), MAX_CGD)))
+		else if (!(cgds = calloc(MAX_CGD, sizeof(*cgds
 			have_cgd = 0;
 
 		if (!have_lvm)
 			remove_lvm_options();
-		else if (!(lvms = calloc(sizeof(*lvms), MAX_LVM_VG)))
+		else if (!(lvms = calloc(MAX_LVM_VG, sizeof(*lvms
 			have_lvm = 0;
 
 		if (!have_gpt)



CVS commit: [netbsd-8] src/doc

2018-05-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  6 13:10:10 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Ticket #813


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.192 -r1.1.2.193 src/doc/CHANGES-8.0

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.192 src/doc/CHANGES-8.0:1.1.2.193
--- src/doc/CHANGES-8.0:1.1.2.192	Sun May  6 09:49:33 2018
+++ src/doc/CHANGES-8.0	Sun May  6 13:10:10 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.192 2018/05/06 09:49:33 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.193 2018/05/06 13:10:10 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -13294,3 +13294,8 @@ crypto/external/bsd/netpgp/dist/src/netp
 	Various documentation fixes for netpgp.
 	[sevan, ticket #810]
 
+sys/net/if_vlan.c1.122
+
+	Avoid a bogus kmem_alloc(9) call with zero size.
+	[spz, ticket #813]
+



CVS commit: [netbsd-8] src/sys/net

2018-05-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  6 13:09:06 UTC 2018

Modified Files:
src/sys/net [netbsd-8]: if_vlan.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #813):

sys/net/if_vlan.c: revision 1.122

If cnt == 0, don't kmem_alloc(0). Found by Mootja.

Looking at the code, I also find it suspicious that we read
ifv->ifv_mib->ifvm_p directly without making sure ifv_mib != NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.97.2.12 -r1.97.2.13 src/sys/net/if_vlan.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/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.97.2.12 src/sys/net/if_vlan.c:1.97.2.13
--- src/sys/net/if_vlan.c:1.97.2.12	Sat Apr 14 10:38:59 2018
+++ src/sys/net/if_vlan.c	Sun May  6 13:09:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.97.2.12 2018/04/14 10:38:59 martin Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.97.2.13 2018/05/06 13:09:05 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.97.2.12 2018/04/14 10:38:59 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.97.2.13 2018/05/06 13:09:05 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -800,6 +800,7 @@ vlan_ifdetach(struct ifnet *p)
 	int i, cnt = 0;
 
 	bound = curlwp_bind();
+
 	mutex_enter(_list.lock);
 	LIST_FOREACH(ifv, _list.list, ifv_list) {
 		mib = vlan_getref_linkmib(ifv, );
@@ -813,13 +814,18 @@ vlan_ifdetach(struct ifnet *p)
 	}
 	mutex_exit(_list.lock);
 
+	if (cnt == 0) {
+		curlwp_bindx(bound);
+		return;
+	}
+
 	/*
 	 * The value of "cnt" does not increase while ifv_list.lock
 	 * and ifv->ifv_lock are released here, because the parent
 	 * interface is detaching.
 	 */
 	nmibs = kmem_alloc(sizeof(*nmibs) * cnt, KM_SLEEP);
-	for (i=0; i < cnt; i++) {
+	for (i = 0; i < cnt; i++) {
 		nmibs[i] = kmem_alloc(sizeof(*nmibs[i]), KM_SLEEP);
 	}
 
@@ -847,9 +853,10 @@ vlan_ifdetach(struct ifnet *p)
 	}
 
 	mutex_exit(_list.lock);
+
 	curlwp_bindx(bound);
 
-	for (i=0; i < cnt; i++) {
+	for (i = 0; i < cnt; i++) {
 		if (nmibs[i])
 			kmem_free(nmibs[i], sizeof(*nmibs[i]));
 	}



CVS commit: [netbsd-8] src/crypto/external/bsd/heimdal/dist/kdc

2018-05-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  6 10:29:30 UTC 2018

Modified Files:
src/crypto/external/bsd/heimdal/dist/kdc [netbsd-8]: connect.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #800):

crypto/external/bsd/heimdal/dist/kdc/connect.c: revision 1.3

avoid busy-waiting on a dead child


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.4.1 \
src/crypto/external/bsd/heimdal/dist/kdc/connect.c

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

Modified files:

Index: src/crypto/external/bsd/heimdal/dist/kdc/connect.c
diff -u src/crypto/external/bsd/heimdal/dist/kdc/connect.c:1.2 src/crypto/external/bsd/heimdal/dist/kdc/connect.c:1.2.4.1
--- src/crypto/external/bsd/heimdal/dist/kdc/connect.c:1.2	Sat Jan 28 21:31:44 2017
+++ src/crypto/external/bsd/heimdal/dist/kdc/connect.c	Sun May  6 10:29:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: connect.c,v 1.2 2017/01/28 21:31:44 christos Exp $	*/
+/*	$NetBSD: connect.c,v 1.2.4.1 2018/05/06 10:29:30 martin Exp $	*/
 
 /*
  * Copyright (c) 1997-2005 Kungliga Tekniska Högskolan
@@ -1193,7 +1193,7 @@ start_kdc(krb5_context context,
 break;
 default:
 for (i=0; i < max_kdcs; i++) {
-if (pids[i] == 0) {
+if (pids[i] < 1) {
 pids[i] = pid;
 break;
 }



CVS commit: [netbsd-8] src/doc

2018-05-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  6 09:49:34 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Tickets #802 - #804, #807, #809, #810


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.191 -r1.1.2.192 src/doc/CHANGES-8.0

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.191 src/doc/CHANGES-8.0:1.1.2.192
--- src/doc/CHANGES-8.0:1.1.2.191	Sat May  5 19:34:43 2018
+++ src/doc/CHANGES-8.0	Sun May  6 09:49:33 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.191 2018/05/05 19:34:43 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.192 2018/05/06 09:49:33 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -13250,3 +13250,47 @@ crypto/external/bsd/heimdal/dist/kdc/con
 	Avoid busy-waiting on a dead child.
 	[spz, ticket #800]
 
+sys/kern/uipc_mbuf.c1.211 (patch)
+
+	Modify m_defrag, so that it never frees the first mbuf of
+	the chain.
+	[maxv, ticket #802]
+
+sys/conf/copyright1.16
+
+	Update for 2018 new year.
+	[nakayama, #803]
+
+bin/sh/parser.c	1.146
+
+	Do not error on newlines in the middle of variable expansions.
+	[kre, ticket #804]
+
+sys/compat/common/compat_mod.c			1.29
+
+	Clean up a stray #ifdef _MODULE.
+	[pgoyette, ticket #807]
+
+external/public-domain/tz/dist/Makefile up to 1.1.1.21
+external/public-domain/tz/dist/NEWS up to 1.1.1.22
+external/public-domain/tz/dist/TZDATA_VERSION   up to 1.12
+external/public-domain/tz/dist/africa   up to 1.1.1.15
+external/public-domain/tz/dist/asia up to 1.1.1.20
+external/public-domain/tz/dist/australasia  up to 1.1.1.15
+external/public-domain/tz/dist/europe   up to 1.1.1.21
+external/public-domain/tz/dist/theory.html  up to 1.1.1.4
+external/public-domain/tz/dist/version  up to 1.1.1.9
+external/public-domain/tz/dist/ziguard.awk  up to 1.1.1.2
+doc/3RDPARTY	1.1520 (patch)
+
+	tzdata updated to 2018e.
+	[kre, ticket #809]
+
+crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3 1.19-1.23
+crypto/external/bsd/netpgp/dist/src/libbn/libnetpgpbn.3 1.5,1.6
+crypto/external/bsd/netpgp/dist/src/libmj/libmj.3 1.8,1.9
+crypto/external/bsd/netpgp/dist/src/netpgpverify/netpgpverify.1 1.12,1.13
+
+	Various documentation fixes for netpgp.
+	[sevan, ticket #810]
+



CVS commit: [netbsd-8] src/crypto/external/bsd/netpgp/dist/src

2018-05-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  6 09:47:47 UTC 2018

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib [netbsd-8]: libnetpgp.3
src/crypto/external/bsd/netpgp/dist/src/libbn [netbsd-8]: libnetpgpbn.3
src/crypto/external/bsd/netpgp/dist/src/libmj [netbsd-8]: libmj.3
src/crypto/external/bsd/netpgp/dist/src/netpgpverify [netbsd-8]:
netpgpverify.1

Log Message:
Pull up following revision(s) (requested by sevan in ticket #810):

crypto/external/bsd/netpgp/dist/src/libbn/libnetpgpbn.3: revision 1.5
crypto/external/bsd/netpgp/dist/src/libbn/libnetpgpbn.3: revision 1.6
crypto/external/bsd/netpgp/dist/src/libmj/libmj.3: revision 1.8
crypto/external/bsd/netpgp/dist/src/libmj/libmj.3: revision 1.9
crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3: revision 1.20
crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3: revision 1.21
crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3: revision 1.22
crypto/external/bsd/netpgp/dist/src/netpgpverify/netpgpverify.1: 
revision 1.12
crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3: revision 1.23
crypto/external/bsd/netpgp/dist/src/netpgpverify/netpgpverify.1: 
revision 1.13
crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3: revision 1.19

Some further changes from PR bin/48395.

Drop superfluous zero prefix for single digit number days.
heads up by wiz

Break down explanation of netpgp_init to make it easier to extend.

Document how the userid is obtained.

Remove trailing whitespace.

Add the following functions to the list (TODO - add descriptions)
netpgp_unsetvar
netpgp_list_keys_json
netpgp_match_keys
netpgp_match_keys_json
netpgp_match_pubkeys
netpgp_validate_sigs
netpgp_format_json

Remove netpgp_match_list_keys() as function does not exist

Add missing output file to netpgp_verify_file() argument list

Sprinkle const to arguments


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.16.18.1 \
src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3
cvs rdiff -u -r1.4 -r1.4.18.1 \
src/crypto/external/bsd/netpgp/dist/src/libbn/libnetpgpbn.3
cvs rdiff -u -r1.7 -r1.7.18.1 \
src/crypto/external/bsd/netpgp/dist/src/libmj/libmj.3
cvs rdiff -u -r1.11 -r1.11.4.1 \
src/crypto/external/bsd/netpgp/dist/src/netpgpverify/netpgpverify.1

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.16 src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.16.18.1
--- src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.16	Mon Feb 17 07:23:18 2014
+++ src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3	Sun May  6 09:47:47 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: libnetpgp.3,v 1.16 2014/02/17 07:23:18 agc Exp $
+.\" $NetBSD: libnetpgp.3,v 1.16.18.1 2018/05/06 09:47:47 martin Exp $
 .\"
 .\" Copyright (c) 2009,2010 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 16, 2014
+.Dd April 29, 2018
 .Dt LIBNETPGP 3
 .Os
 .Sh NAME
@@ -79,6 +79,10 @@ The following functions are for variable
 .Fo netpgp_incvar
 .Fa "netpgp_t *netpgp" "const char *name" "const int delta"
 .Fc
+.Ft int
+.Fo netpgp_unsetvar
+.Fa "netpgp_t *netpgp" "const char *name"
+.Fc
 .Pp
 The following function sets the home directory:
 .Ft int
@@ -92,8 +96,20 @@ The following functions are used for key
 .Fa "netpgp_t *netpgp" "const int printsigs"
 .Fc
 .Ft int
-.Fo netpgp_match_list_keys
-.Fa "netpgp_t *netpgp" "char *pattern"
+.Fo netpgp_list_keys_json
+.Fa "netpgp_t *netpgp" "char **json" "const int psigs"
+.Fc
+.Ft int
+.Fo netpgp_match_keys
+.Fa "netpgp_t *netpgp" "char *name" "const char *fmt" "void *vp" "const int psigs"
+.Fc
+.Ft int
+.Fo netpgp_match_keys_json
+.Fa "netpgp_t *netpgp" "char **json" "char *name" "const char *fmt" "const int psigs"
+.Fc
+.Ft int
+.Fo netpgp_match_pubkeys
+.Fa "netpgp_t *netpgp" "char *name" "void *vp"
 .Fc
 .Ft int
 .Fo netpgp_find_key
@@ -101,7 +117,7 @@ The following functions are used for key
 .Fc
 .Ft char *
 .Fo netpgp_get_key
-.Fa "netpgp_t *netpgp" "const char *id"
+.Fa "netpgp_t *netpgp" "const char *name" "const char *fmt"
 .Fc
 .Ft int
 .Fo netpgp_export_key
@@ -115,31 +131,39 @@ The following functions are used for key
 .Fo netpgp_generate_key
 .Fa "netpgp_t *netpgp" "char *userid" "int numbits"
 .Fc
+.Ft int
+.Fo netpgp_validate_sigs
+.Fa "netpgp_t *netpgp"
+.Fc
+.Ft int
+.Fo netpgp_format_json
+.Fa "void *vp" "const char *json" "const int psigs"
+.Fc
 .Pp
 The following functions are used for file management:
 .Ft int
 .Fo netpgp_encrypt_file
-.Fa "netpgp_t *netpgp" "char *userid" "char *filename" "char *out"
+.Fa "netpgp_t 

CVS commit: [netbsd-8] src

2018-05-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  6 09:42:38 UTC 2018

Modified Files:
src/doc [netbsd-8]: 3RDPARTY
src/external/public-domain/tz/dist [netbsd-8]: Makefile NEWS
TZDATA_VERSION africa asia australasia europe theory.html version
ziguard.awk

Log Message:
Catch up to current for the following, requested by kre in ticket #809:

external/public-domain/tz/dist/Makefile up to 1.1.1.21
external/public-domain/tz/dist/NEWS up to 1.1.1.22
external/public-domain/tz/dist/TZDATA_VERSION   up to 1.12
external/public-domain/tz/dist/africa   up to 1.1.1.15
external/public-domain/tz/dist/asia up to 1.1.1.20
external/public-domain/tz/dist/australasia  up to 1.1.1.15
external/public-domain/tz/dist/europe   up to 1.1.1.21
external/public-domain/tz/dist/theory.html  up to 1.1.1.4
external/public-domain/tz/dist/version  up to 1.1.1.9
external/public-domain/tz/dist/ziguard.awk  up to 1.1.1.2
doc/3RDPARTY1.1520 (patch)

tzdata updated to 2018e.


To generate a diff of this commit:
cvs rdiff -u -r1.1444.2.10 -r1.1444.2.11 src/doc/3RDPARTY
cvs rdiff -u -r1.1.1.17.4.3 -r1.1.1.17.4.4 \
src/external/public-domain/tz/dist/Makefile \
src/external/public-domain/tz/dist/europe
cvs rdiff -u -r1.1.1.18.4.3 -r1.1.1.18.4.4 \
src/external/public-domain/tz/dist/NEWS
cvs rdiff -u -r1.8.4.3 -r1.8.4.4 \
src/external/public-domain/tz/dist/TZDATA_VERSION
cvs rdiff -u -r1.1.1.11.4.3 -r1.1.1.11.4.4 \
src/external/public-domain/tz/dist/africa \
src/external/public-domain/tz/dist/australasia
cvs rdiff -u -r1.1.1.16.4.3 -r1.1.1.16.4.4 \
src/external/public-domain/tz/dist/asia
cvs rdiff -u -r1.1.1.1.2.4 -r1.1.1.1.2.5 \
src/external/public-domain/tz/dist/theory.html
cvs rdiff -u -r1.1.1.5.4.3 -r1.1.1.5.4.4 \
src/external/public-domain/tz/dist/version
cvs rdiff -u -r1.1.1.1.2.2 -r1.1.1.1.2.3 \
src/external/public-domain/tz/dist/ziguard.awk

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.1444.2.10 src/doc/3RDPARTY:1.1444.2.11
--- src/doc/3RDPARTY:1.1444.2.10	Thu Apr 12 01:38:42 2018
+++ src/doc/3RDPARTY	Sun May  6 09:42:38 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1444.2.10 2018/04/12 01:38:42 msaitoh Exp $
+#	$NetBSD: 3RDPARTY,v 1.1444.2.11 2018/05/06 09:42:38 martin Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1411,8 +1411,8 @@ Notes:
 Added changes from a5 -> a12 manually.
 
 Package:	tz
-Version:	tzcode2017b / tzdata2018d
-Current Vers:	tzcode2018d / tzdata2018d
+Version:	tzcode2017b / tzdata2018e
+Current Vers:	tzcode2018d / tzdata2018e
 Maintainer:	Paul Eggert 
 Archive Site:	ftp://ftp.iana.org/tz/releases/
 Archive Site:	ftp://munnari.oz.au/pub/oldtz/

Index: src/external/public-domain/tz/dist/Makefile
diff -u src/external/public-domain/tz/dist/Makefile:1.1.1.17.4.3 src/external/public-domain/tz/dist/Makefile:1.1.1.17.4.4
--- src/external/public-domain/tz/dist/Makefile:1.1.1.17.4.3	Sat Mar 24 18:03:21 2018
+++ src/external/public-domain/tz/dist/Makefile	Sun May  6 09:42:38 2018
@@ -21,7 +21,7 @@ DATAFORM=		main
 
 # Change the line below for your time zone (after finding the zone you want in
 # the time zone files, or adding it to a time zone file).
-# Alternately, if you discover you've got the wrong time zone, you can just
+# Alternatively, if you discover you've got the wrong time zone, you can just
 #	zic -l rightzone
 # to correct things.
 # Use the command
@@ -38,7 +38,7 @@ LOCALTIME=	GMT
 # template file are used to determine "spring forward" and "fall back" days and
 # times; the environment variable itself specifies UT offsets of standard and
 # daylight saving time.
-# Alternately, if you discover you've got the wrong time zone, you can just
+# Alternatively, if you discover you've got the wrong time zone, you can just
 #	zic -p rightzone
 # to correct things.
 # Use the command
@@ -236,14 +236,16 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fn
   $(GCC_INSTRUMENT) \
   -Wall -Wextra \
   -Walloc-size-larger-than=10 -Warray-bounds=2 \
-  -Wbad-function-cast -Wcast-align -Wdate-time \
+  -Wbad-function-cast -Wcast-align=strict -Wdate-time \
   -Wdeclaration-after-statement -Wdouble-promotion \
   -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
   -Winit-self -Wjump-misses-init -Wlogical-op \
   -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
   -Wold-style-definition -Woverlength-strings -Wpointer-arith \
-  -Wshadow -Wshift-overflow=2 -Wstrict-prototypes -Wstringop-overflow=5 \
+  -Wshadow -Wshift-overflow=2 -Wstrict-prototypes -Wstringop-overflow=4 \
+  

CVS commit: [netbsd-8] src/sys/compat/common

2018-05-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  6 09:35:33 UTC 2018

Modified Files:
src/sys/compat/common [netbsd-8]: compat_mod.c

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #807):

sys/compat/common/compat_mod.c: revision 1.29

Clean up a stray #ifdef _MODULE - it prevented definition of
COMPAT_SIGCONTEXT which in turn prevented building of the
SYS_compat16_sigaction_14 code.

Should address PR kern/53260

XXX Pull-up to netbsd-8


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.24.8.1 src/sys/compat/common/compat_mod.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/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.24 src/sys/compat/common/compat_mod.c:1.24.8.1
--- src/sys/compat/common/compat_mod.c:1.24	Sat Nov  5 23:30:22 2016
+++ src/sys/compat/common/compat_mod.c	Sun May  6 09:35:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.24 2016/11/05 23:30:22 pgoyette Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.24.8.1 2018/05/06 09:35:33 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24 2016/11/05 23:30:22 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.8.1 2018/05/06 09:35:33 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -69,15 +69,13 @@ MODULE(MODULE_CLASS_EXEC, compat, NULL);
 
 int	ttcompat(struct tty *, u_long, void *, int, struct lwp *);
 
-#ifdef _MODULE
 #ifdef COMPAT_16
 #if !defined(__amd64__) || defined(COMPAT_NETBSD32)
 #define COMPAT_SIGCONTEXT
 extern char sigcode[], esigcode[];
 struct uvm_object *emul_netbsd_object;
-#endif
-#endif
-#endif /* _MODULE */
+#endif /* !defined(__amd64__) || defined(COMPAT_NETBSD32) */
+#endif /* COMPAT_16 */
 
 extern krwlock_t exec_lock;
 extern krwlock_t ttcompat_lock;



CVS commit: [netbsd-8] src/bin/sh

2018-05-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  6 09:32:57 UTC 2018

Modified Files:
src/bin/sh [netbsd-8]: parser.c

Log Message:
Pull up following revision(s) (requested by kre in ticket #804):

bin/sh/parser.c: revision 1.146

PR bin/53201

Don't synerr on
${var-anything
more}

The newline in the middle of the var expansion is permitted.

Bug reported by Martijn Dekker from his modernish tests.
XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.132.2.3 -r1.132.2.4 src/bin/sh/parser.c

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

Modified files:

Index: src/bin/sh/parser.c
diff -u src/bin/sh/parser.c:1.132.2.3 src/bin/sh/parser.c:1.132.2.4
--- src/bin/sh/parser.c:1.132.2.3	Fri Nov 17 20:33:53 2017
+++ src/bin/sh/parser.c	Sun May  6 09:32:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: parser.c,v 1.132.2.3 2017/11/17 20:33:53 snj Exp $	*/
+/*	$NetBSD: parser.c,v 1.132.2.4 2018/05/06 09:32:57 martin Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)parser.c	8.7 (Berkeley) 5/16/95";
 #else
-__RCSID("$NetBSD: parser.c,v 1.132.2.3 2017/11/17 20:33:53 snj Exp $");
+__RCSID("$NetBSD: parser.c,v 1.132.2.4 2018/05/06 09:32:57 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -1636,7 +1636,7 @@ readtoken1(int firstc, char const *syn, 
 		CHECKSTRSPACE(4, out);	/* permit 4 calls to USTPUTC */
 		switch (syntax[c]) {
 		case CNL:	/* '\n' */
-			if (syntax == BASESYNTAX)
+			if (syntax == BASESYNTAX && varnest == 0)
 break;	/* exit loop */
 			USTPUTC(c, out);
 			plinno++;



CVS commit: [netbsd-8] src/sys/conf

2018-05-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  6 09:27:05 UTC 2018

Modified Files:
src/sys/conf [netbsd-8]: copyright

Log Message:
Pull up the following, requested by nakayama in ticket #803:

sys/conf/copyright  1.16

Update for 2018 new year


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.8.1 src/sys/conf/copyright

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/copyright
diff -u src/sys/conf/copyright:1.15 src/sys/conf/copyright:1.15.8.1
--- src/sys/conf/copyright:1.15	Sun Jan  1 06:56:59 2017
+++ src/sys/conf/copyright	Sun May  6 09:27:04 2018
@@ -1,5 +1,5 @@
 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
-The NetBSD Foundation, Inc.  All rights reserved.
+2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
+2018 The NetBSD Foundation, Inc.  All rights reserved.
 Copyright (c) 1982, 1986, 1989, 1991, 1993
 The Regents of the University of California.  All rights reserved.



CVS commit: [netbsd-8] src/sys/kern

2018-05-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  6 09:20:43 UTC 2018

Modified Files:
src/sys/kern [netbsd-8]: uipc_mbuf.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #802):

sys/kern/uipc_mbuf.c: revision 1.211 (via patch)

Modify m_defrag, so that it never frees the first mbuf of the chain. While
here use the given 'flags' argument, and not M_DONTWAIT.

We have a problem with several drivers: they poll an mbuf chain from their
queues and call m_defrag on them, but m_defrag could update the mbuf
pointer, so the mbuf in the queue is no longer valid. It is not easy to
fix each driver, because doing pop+push will reorder the queue, and we
don't really want that to happen.

This problem was independently spotted by me, Kengo, Masanobu, and other
people too it seems (perhaps PR/53218).
Now m_defrag leaves the first mbuf in place, and compresses the chain
only starting from the second mbuf in the chain.

It is important not to compress the first mbuf with hacks, because the
storage of this first mbuf may be shared with other mbufs.


To generate a diff of this commit:
cvs rdiff -u -r1.172.6.3 -r1.172.6.4 src/sys/kern/uipc_mbuf.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/kern/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.172.6.3 src/sys/kern/uipc_mbuf.c:1.172.6.4
--- src/sys/kern/uipc_mbuf.c:1.172.6.3	Tue Apr 17 08:24:01 2018
+++ src/sys/kern/uipc_mbuf.c	Sun May  6 09:20:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.172.6.3 2018/04/17 08:24:01 martin Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.172.6.4 2018/05/06 09:20:43 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.172.6.3 2018/04/17 08:24:01 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.172.6.4 2018/05/06 09:20:43 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -1358,30 +1358,35 @@ m_makewritable(struct mbuf **mp, int off
 }
 
 /*
- * Copy the mbuf chain to a new mbuf chain that is as short as possible.
- * Return the new mbuf chain on success, NULL on failure.  On success,
- * free the old mbuf chain.
+ * Compress the mbuf chain. Return the new mbuf chain on success, NULL on
+ * failure. The first mbuf is preserved, and on success the pointer returned
+ * is the same as the one passed.
  */
 struct mbuf *
 m_defrag(struct mbuf *mold, int flags)
 {
 	struct mbuf *m0, *mn, *n;
-	size_t sz = mold->m_pkthdr.len;
+	int sz;
 
 #ifdef DIAGNOSTIC
 	if ((mold->m_flags & M_PKTHDR) == 0)
 		panic("m_defrag: not a mbuf chain header");
 #endif
 
-	m0 = m_gethdr(flags, MT_DATA);
+	if (mold->m_next == NULL)
+		return mold;
+
+	m0 = m_get(flags, MT_DATA);
 	if (m0 == NULL)
 		return NULL;
-	M_COPY_PKTHDR(m0, mold);
 	mn = m0;
 
+	sz = mold->m_pkthdr.len - mold->m_len;
+	KASSERT(sz >= 0);
+
 	do {
-		if (sz > MHLEN) {
-			MCLGET(mn, M_DONTWAIT);
+		if (sz > MLEN) {
+			MCLGET(mn, flags);
 			if ((mn->m_flags & M_EXT) == 0) {
 m_freem(m0);
 return NULL;
@@ -1397,7 +1402,7 @@ m_defrag(struct mbuf *mold, int flags)
 
 		if (sz > 0) {
 			/* need more mbufs */
-			n = m_get(M_NOWAIT, MT_DATA);
+			n = m_get(flags, MT_DATA);
 			if (n == NULL) {
 m_freem(m0);
 return NULL;
@@ -1408,9 +1413,10 @@ m_defrag(struct mbuf *mold, int flags)
 		}
 	} while (sz > 0);
 
-	m_freem(mold);
+	m_freem(mold->m_next);
+	mold->m_next = m0;
 
-	return m0;
+	return mold;
 }
 
 int



CVS commit: [netbsd-8] src/doc

2018-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May  5 19:34:43 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Tickets #786 - #792, #795, #796, #799, #800


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.190 -r1.1.2.191 src/doc/CHANGES-8.0

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.190 src/doc/CHANGES-8.0:1.1.2.191
--- src/doc/CHANGES-8.0:1.1.2.190	Fri May  4 16:26:29 2018
+++ src/doc/CHANGES-8.0	Sat May  5 19:34:43 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.190 2018/05/04 16:26:29 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.191 2018/05/05 19:34:43 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -13162,3 +13162,91 @@ sbin/gpt/map.c	1.14
 	If a new map entry doesn't fit, be more verbose about the sizes.
 	[mrg, ticket #785]
 
+sys/arch/amd64/amd64/locore.S			1.164,1.165
+
+	Do not use movq for loading arbitrary 64bit immediates.
+	[maxv, ticket #786]
+
+sys/dev/usb/xhci.c1.88-1.90
+sys/dev/usb/xhcireg.h1.10
+
+	Add KASSERT() that sc_child* is set to NULL after child detach.
+	Trigger the softint processing on that child bus which is not detached
+	yet.
+	Enable code to only trigger usb processing when EINT is set, to
+	avoid misinterpreting shared interrupt for another device.
+	Fix clearing of bits in the USBSTS register.
+	[jdolecek, ticket #787]
+
+sys/net/rtsock.c1.241
+
+	Fix a deadlock (rt_free vs. route_intr on rt_so_mtx).
+	[ozaki-r, ticket #788]
+
+sys/dev/isa/wbsio.c1.24
+
+	Use spin mutex to fix a panic.
+	[yamaguchi, ticket #789]
+
+share/man/man9/secmodel_securelevel.9		1.16
+sys/arch/x86/x86/svs.c1.18
+sys/secmodel/securelevel/secmodel_securelevel.c	1.31
+sys/secmodel/suser/secmodel_suser.c		1.44
+sys/sys/kauth.h	1.76
+
+	Disabling SVS is denied at securelevel 1 and above.
+	[alnsn, ticket #790]
+
+etc/namedb/bind.keys1.2
+
+	Update the keys file to the latest version.
+	[nakayama, ticket #791]
+
+sys/kern/sys_ptrace_common.c			1.38
+
+	Harden the NetBSD PT_TRACE_ME operation.
+	[kamil, ticket #792]
+
+sys/net/npf/npf_nat.c1.42
+
+	Fix bitwise vs. logical and typo.
+	[prlw1, ticket #795]
+
+tools/Makefile.host1.32
+tools/Makefile.inc1.14
+tools/binstall/Makefile1.12
+tools/binutils/Makefile1.27
+tools/compat/Makefile1.82
+tools/ctfconvert/Makefile			1.7
+tools/ctfmerge/Makefile1.8
+tools/cvslatest/Makefile			1.2
+tools/dbsym/Makefile1.13
+tools/dtc/Makefile1.3
+tools/gcc/Makefile1.85
+tools/gdb/Makefile1.35
+tools/genassym/Makefile1.7
+tools/gettext/Makefile1.7
+tools/libctf/Makefile1.7
+tools/libdwarf/Makefile1.8
+tools/libelf/Makefile1.9
+tools/libfdt/Makefile1.3
+tools/lorder/Makefile1.13
+tools/makekeys/Makefile1.2
+tools/mandoc/Makefile1.11
+tools/mdsetimage/Makefile			1.15
+
+	Disable MKREPRO in tools; the host compiler might
+	not support the necessary options.
+	[christos, ticket #796]
+
+sys/netipsec/ipsec_output.c			1.67,1.75 (patch)
+
+	compute_ipsec_pos: strengthen checks to avoid overruns,
+	allow the function to fail (and drop the misformed packet).
+	[maxv, ticket #799]
+
+crypto/external/bsd/heimdal/dist/kdc/connect.c	1.3
+
+	Avoid busy-waiting on a dead child.
+	[spz, ticket #800]
+



CVS commit: [netbsd-8] src/sys/netipsec

2018-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May  5 19:31:33 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-8]: ipsec_output.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #799):

sys/netipsec/ipsec_output.c: revision 1.75
sys/netipsec/ipsec_output.c: revision 1.67

Strengthen this check, to make sure there is room for an ip6_ext structure.
Seems possible to crash m_copydata here (but I didn't test more than that).

Fix the checks in compute_ipsec_pos, otherwise m_copydata could crash. I
already fixed half of the problem two months ago in rev1.67, back then I
thought it was not triggerable because each packet we emit is guaranteed
to have correctly formed IPv6 options; but it is actually triggerable via
IPv6 forwarding, we emit a packet we just received, and we don't sanitize
its options before invoking IPsec.

Since it would be wrong to just stop the iteration and continue the IPsec
processing, allow compute_ipsec_pos to fail, and when it does, drop the
packet entirely.


To generate a diff of this commit:
cvs rdiff -u -r1.48.2.2 -r1.48.2.3 src/sys/netipsec/ipsec_output.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/netipsec/ipsec_output.c
diff -u src/sys/netipsec/ipsec_output.c:1.48.2.2 src/sys/netipsec/ipsec_output.c:1.48.2.3
--- src/sys/netipsec/ipsec_output.c:1.48.2.2	Tue Jan  2 10:20:34 2018
+++ src/sys/netipsec/ipsec_output.c	Sat May  5 19:31:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec_output.c,v 1.48.2.2 2018/01/02 10:20:34 snj Exp $	*/
+/*	$NetBSD: ipsec_output.c,v 1.48.2.3 2018/05/05 19:31:33 martin Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.48.2.2 2018/01/02 10:20:34 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.48.2.3 2018/05/05 19:31:33 martin Exp $");
 
 /*
  * IPsec output processing.
@@ -633,7 +633,7 @@ bad:
 #endif
 
 #ifdef INET6
-static void
+static int
 compute_ipsec_pos(struct mbuf *m, int *i, int *off)
 {
 	int nxt;
@@ -650,7 +650,11 @@ compute_ipsec_pos(struct mbuf *m, int *i
 	 * put AH/ESP/IPcomp header.
 	 *  IPv6 hbh dest1 rthdr ah* [esp* dest2 payload]
 	 */
-	do {
+	while (1) {
+		if (*i + sizeof(ip6e) > m->m_pkthdr.len) {
+			return EINVAL;
+		}
+
 		switch (nxt) {
 		case IPPROTO_AH:
 		case IPPROTO_ESP:
@@ -659,7 +663,7 @@ compute_ipsec_pos(struct mbuf *m, int *i
 		 * we should not skip security header added
 		 * beforehand.
 		 */
-			return;
+			return 0;
 
 		case IPPROTO_HOPOPTS:
 		case IPPROTO_DSTOPTS:
@@ -669,7 +673,7 @@ compute_ipsec_pos(struct mbuf *m, int *i
 		 * we should stop there.
 		 */
 			if (nxt == IPPROTO_DSTOPTS && dstopt)
-return;
+return 0;
 
 			if (nxt == IPPROTO_DSTOPTS) {
 /*
@@ -689,16 +693,14 @@ compute_ipsec_pos(struct mbuf *m, int *i
 			m_copydata(m, *i, sizeof(ip6e), );
 			nxt = ip6e.ip6e_nxt;
 			*off = *i + offsetof(struct ip6_ext, ip6e_nxt);
-			/*
-			 * we will never see nxt == IPPROTO_AH
-			 * so it is safe to omit AH case.
-			 */
 			*i += (ip6e.ip6e_len + 1) << 3;
 			break;
 		default:
-			return;
+			return 0;
 		}
-	} while (*i < m->m_pkthdr.len);
+	}
+
+	return 0;
 }
 
 static int
@@ -802,7 +804,9 @@ ipsec6_process_packet(
 		i = ip->ip_hl << 2;
 		off = offsetof(struct ip, ip_p);
 	} else {	
-		compute_ipsec_pos(m, , );
+		error = compute_ipsec_pos(m, , );
+		if (error)
+			goto unrefsav;
 	}
 	error = (*sav->tdb_xform->xf_output)(m, isr, sav, NULL, i, off);
 	KEY_SA_UNREF();



CVS commit: [netbsd-8] src/tools

2018-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May  5 19:25:57 UTC 2018

Modified Files:
src/tools [netbsd-8]: Makefile.host
src/tools/binstall [netbsd-8]: Makefile
src/tools/binutils [netbsd-8]: Makefile
src/tools/compat [netbsd-8]: Makefile
src/tools/ctfconvert [netbsd-8]: Makefile
src/tools/ctfmerge [netbsd-8]: Makefile
src/tools/cvslatest [netbsd-8]: Makefile
src/tools/dbsym [netbsd-8]: Makefile
src/tools/dtc [netbsd-8]: Makefile
src/tools/gcc [netbsd-8]: Makefile
src/tools/gdb [netbsd-8]: Makefile
src/tools/genassym [netbsd-8]: Makefile
src/tools/gettext [netbsd-8]: Makefile
src/tools/libctf [netbsd-8]: Makefile
src/tools/libdwarf [netbsd-8]: Makefile
src/tools/libelf [netbsd-8]: Makefile
src/tools/libfdt [netbsd-8]: Makefile
src/tools/lorder [netbsd-8]: Makefile
src/tools/makekeys [netbsd-8]: Makefile
src/tools/mandoc [netbsd-8]: Makefile
src/tools/mdsetimage [netbsd-8]: Makefile
Added Files:
src/tools [netbsd-8]: Makefile.inc

Log Message:
Pull up following revision(s) (requested by christos in ticket #796):

tools/mdsetimage/Makefile: revision 1.15
tools/compat/Makefile: revision 1.82
tools/gdb/Makefile: revision 1.35
tools/lorder/Makefile: revision 1.13
tools/gcc/Makefile: revision 1.85
tools/dtc/Makefile: revision 1.3
tools/cvslatest/Makefile: revision 1.2
tools/ctfmerge/Makefile: revision 1.8
tools/libelf/Makefile: revision 1.9
tools/libdwarf/Makefile: revision 1.8
tools/ctfconvert/Makefile: revision 1.7
tools/makekeys/Makefile: revision 1.2
tools/gettext/Makefile: revision 1.7
tools/binstall/Makefile: revision 1.12
tools/libfdt/Makefile: revision 1.3
tools/libctf/Makefile: revision 1.7
tools/binutils/Makefile: revision 1.27
tools/mandoc/Makefile: revision 1.11
tools/Makefile.host: revision 1.32
tools/dbsym/Makefile: revision 1.13
tools/genassym/Makefile: revision 1.7
tools/Makefile.inc: revision 1.14

PR/53238: Robert Elz: Disable MKREPRO in tools; the host compiler might
not support the necessary options. This is done thusly:

1. Set MKREPRO=no in Makefile.host. This handles all the Makefiles that
   use it and don't include bsd.own.mk.
2. Create Makefile.inc and set MKREPRO=no in it. Change the Makefiles that
   include bsd.own.mk, to include bsd.init.mk which includes Makefile.inc
   first. This will also allow us to control other tools options from a
   single location if we need to.

XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.31.20.1 src/tools/Makefile.host
cvs rdiff -u -r0 -r1.16.2.2 src/tools/Makefile.inc
cvs rdiff -u -r1.11 -r1.11.22.1 src/tools/binstall/Makefile
cvs rdiff -u -r1.26 -r1.26.6.1 src/tools/binutils/Makefile
cvs rdiff -u -r1.81 -r1.81.8.1 src/tools/compat/Makefile
cvs rdiff -u -r1.6 -r1.6.8.1 src/tools/ctfconvert/Makefile
cvs rdiff -u -r1.7 -r1.7.8.1 src/tools/ctfmerge/Makefile
cvs rdiff -u -r1.1 -r1.1.8.1 src/tools/cvslatest/Makefile
cvs rdiff -u -r1.11 -r1.11.6.1 src/tools/dbsym/Makefile
cvs rdiff -u -r1.2.4.2 -r1.2.4.3 src/tools/dtc/Makefile
cvs rdiff -u -r1.81.4.1 -r1.81.4.2 src/tools/gcc/Makefile
cvs rdiff -u -r1.30 -r1.30.6.1 src/tools/gdb/Makefile
cvs rdiff -u -r1.6 -r1.6.22.1 src/tools/genassym/Makefile
cvs rdiff -u -r1.6 -r1.6.22.1 src/tools/gettext/Makefile
cvs rdiff -u -r1.6 -r1.6.8.1 src/tools/libctf/Makefile
cvs rdiff -u -r1.7 -r1.7.18.1 src/tools/libdwarf/Makefile
cvs rdiff -u -r1.8 -r1.8.18.1 src/tools/libelf/Makefile
cvs rdiff -u -r1.2.4.2 -r1.2.4.3 src/tools/libfdt/Makefile
cvs rdiff -u -r1.12 -r1.12.22.1 src/tools/lorder/Makefile
cvs rdiff -u -r1.1 -r1.1.8.1 src/tools/makekeys/Makefile
cvs rdiff -u -r1.9.8.1 -r1.9.8.2 src/tools/mandoc/Makefile
cvs rdiff -u -r1.13 -r1.13.6.1 src/tools/mdsetimage/Makefile

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

Modified files:

Index: src/tools/Makefile.host
diff -u src/tools/Makefile.host:1.31 src/tools/Makefile.host:1.31.20.1
--- src/tools/Makefile.host:1.31	Fri Jun 14 16:10:02 2013
+++ src/tools/Makefile.host	Sat May  5 19:25:56 2018
@@ -1,8 +1,9 @@
-#	$NetBSD: Makefile.host,v 1.31 2013/06/14 16:10:02 tsutsui Exp $
+#	$NetBSD: Makefile.host,v 1.31.20.1 2018/05/05 19:25:56 martin Exp $
 
 NOINFO=		# defined
 NOLINT=		# defined
 NOMAN=		# defined
+MKREPRO=no	# Native toolchain might be unable to do it
 
 .include 
 

Index: src/tools/binstall/Makefile
diff -u src/tools/binstall/Makefile:1.11 src/tools/binstall/Makefile:1.11.22.1
--- src/tools/binstall/Makefile:1.11	Sat Mar 16 22:32:50 2013
+++ src/tools/binstall/Makefile	Sat May  5 19:25:56 2018
@@ -1,7 +1,7 @@
-#	$NetBSD: Makefile,v 1.11 2013/03/16 22:32:50 christos Exp $
+#	$NetBSD: Makefile,v 1.11.22.1 

CVS commit: [netbsd-8] src/sys/net/npf

2018-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May  5 19:15:55 UTC 2018

Modified Files:
src/sys/net/npf [netbsd-8]: npf_nat.c

Log Message:
Pull up following revision(s) (requested by prlw1 in ticket #795):

sys/net/npf/npf_nat.c: revision 1.42

PR/53207: David Binderman: Use logical and


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.41.8.1 src/sys/net/npf/npf_nat.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/npf/npf_nat.c
diff -u src/sys/net/npf/npf_nat.c:1.41 src/sys/net/npf/npf_nat.c:1.41.8.1
--- src/sys/net/npf/npf_nat.c:1.41	Mon Dec 26 23:05:06 2016
+++ src/sys/net/npf/npf_nat.c	Sat May  5 19:15:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_nat.c,v 1.41 2016/12/26 23:05:06 christos Exp $	*/
+/*	$NetBSD: npf_nat.c,v 1.41.8.1 2018/05/05 19:15:55 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 Mindaugas Rasiukevicius 
@@ -72,7 +72,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_nat.c,v 1.41 2016/12/26 23:05:06 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_nat.c,v 1.41.8.1 2018/05/05 19:15:55 martin Exp $");
 
 #include 
 #include 
@@ -890,7 +890,7 @@ npf_nat_import(npf_t *npf, prop_dictiona
 	prop_dictionary_get_uint16(natdict, "tport", >nt_tport);
 
 	/* Take a specific port from port-map. */
-	if ((np->n_flags & NPF_NAT_PORTMAP) != 0 && nt->nt_tport &
+	if ((np->n_flags & NPF_NAT_PORTMAP) != 0 && nt->nt_tport &&
 	!npf_nat_takeport(np, nt->nt_tport)) {
 		pool_cache_put(nat_cache, nt);
 		return NULL;



CVS commit: [netbsd-8] src/sys/kern

2018-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May  5 19:13:21 UTC 2018

Modified Files:
src/sys/kern [netbsd-8]: sys_ptrace_common.c

Log Message:
Pull up following revision(s) (requested by kamil in ticket #792):

sys/kern/sys_ptrace_common.c: revision 1.38

Harden the NetBSD PT_TRACE_ME operation

You can't say to the parent of a process to start tracing if:
(1) the parent is initproc,
(2) the child is already traced.

Rationale:
 (1) - It has a side effect of being an anti-debugger functionality,
   as we cannot kill initproc (PID1) and reset the traced flag.
 - initproc is not a debugger, raising debugging events from a child
   to initproc can result in at least a stopped/hanging process
   in the system.
 (2) - It does not make sense to be simultanously traced by two debuggers
 - It does not make sense to be traced twice by the same debugger.

Permit enable tracing for a parent that has been chroot(8)ed, as this is
harmless and the parent is already monitoring for child signals.
The same semantics exist in FreeBSD.

If you are looking for an antidebugging trick for old NetBSD (pre 8.0)
or other popular kernels, here is an example:

$ cat antidebug.c
int
main(int argc, char **argv)
{
pid_t child;
int rv;
int n =3D 0;
child =3D fork();
if (child =3D=3D 0) {
while (getppid() !=3D 1)
continue;
rv =3D ptrace(PT_TRACE_ME, 0, 0, 0);
if (rv !=3D 0)
abort();
printf("Try to detach to me with a debugger!! ");
printf("haha My PID is %d\n", getpid());
while (1) {
printf("%d\n", n++);
sleep(1);
}
}
exit(0);
}

A developer is no longer able to attach GDB, strace or LLDB to this program
without killing the initproc (your favourite system daemon).. this action
would be fatal for the operation of the whole Operating System stability.

Examples from a current non-NetBSD popular kernel:
$ ps -o ppid=3D -p 17904
1
$ strace -p 17904
strace: attach: ptrace(PTRACE_SEIZE, 17904): Operation not permitted
$ gdb -p 17904
[...]
Attaching to process 17904
warning: process 17904 is already traced by process 1
ptrace: Operation not permitted.
(gdb)
$ lldb-3.9 -p 17904
(lldb) process attach --pid 17904
error: attach failed: unable to attach

On NetBSD 8.0 and newer it is now guaranteed to have an option to kill
a malevolent (fake?) debugger and attach with a new tracer to the process

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.2 -r1.22.2.3 src/sys/kern/sys_ptrace_common.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/kern/sys_ptrace_common.c
diff -u src/sys/kern/sys_ptrace_common.c:1.22.2.2 src/sys/kern/sys_ptrace_common.c:1.22.2.3
--- src/sys/kern/sys_ptrace_common.c:1.22.2.2	Thu Apr 12 13:42:48 2018
+++ src/sys/kern/sys_ptrace_common.c	Sat May  5 19:13:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_ptrace_common.c,v 1.22.2.2 2018/04/12 13:42:48 martin Exp $	*/
+/*	$NetBSD: sys_ptrace_common.c,v 1.22.2.3 2018/05/05 19:13:21 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.22.2.2 2018/04/12 13:42:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.22.2.3 2018/05/05 19:13:21 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -377,7 +377,19 @@ ptrace_allowed(struct lwp *l, int req, s
 	/* Make sure we can operate on it. */
 	switch (req) {
 	case PT_TRACE_ME:
-		/* Saying that you're being traced is always legal. */
+		/*
+		 * You can't say to the parent of a process to start tracing if:
+		 *	(1) the parent is initproc,
+		 */
+		if (p->p_pptr == initproc)
+			return EPERM;
+
+		/*
+		 *	(2) the child is already traced.
+		 */
+		if (ISSET(p->p_slflag, PSL_TRACED))
+			return EBUSY;
+
 		return 0;
 
 	case PT_ATTACH:
@@ -389,7 +401,7 @@ ptrace_allowed(struct lwp *l, int req, s
 			return EINVAL;
 
 		/*
-		 *  (2) it's a system process
+		 *	(2) it's a system process
 		 */
 		if (t->p_flag & PK_SYSTEM)
 			return EPERM;



CVS commit: [netbsd-8] src/sys/net

2018-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May  5 19:07:52 UTC 2018

Modified Files:
src/sys/net [netbsd-8]: rtsock.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #788):

sys/net/rtsock.c: revision 1.241

Fix a deadlock (rt_free vs. route_intr on rt_so_mtx)
It occurs only if NET_MPSAFE is enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.213.2.9 -r1.213.2.10 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.213.2.9 src/sys/net/rtsock.c:1.213.2.10
--- src/sys/net/rtsock.c:1.213.2.9	Sat Apr 14 10:16:19 2018
+++ src/sys/net/rtsock.c	Sat May  5 19:07:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock.c,v 1.213.2.9 2018/04/14 10:16:19 martin Exp $	*/
+/*	$NetBSD: rtsock.c,v 1.213.2.10 2018/05/05 19:07:51 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.213.2.9 2018/04/14 10:16:19 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.213.2.10 2018/05/05 19:07:51 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -928,9 +928,19 @@ flush:
 	if (old_rtm != NULL)
 		Free(old_rtm);
 	if (rt) {
-		if (do_rt_free)
+		if (do_rt_free) {
+#ifdef NET_MPSAFE
+			/*
+			 * Release rt_so_mtx to avoid a deadlock with
+			 * route_intr.
+			 */
+			mutex_exit(rt_so_mtx);
 			rt_free(rt);
-		else
+			mutex_enter(rt_so_mtx);
+#else
+			rt_free(rt);
+#endif
+		} else
 			rt_unref(rt);
 	}
 {



CVS commit: [netbsd-8] src/etc/namedb

2018-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May  5 15:14:30 UTC 2018

Modified Files:
src/etc/namedb [netbsd-8]: bind.keys

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #791):

etc/namedb/bind.keys: revision 1.2

Update the keys file to the latest version from:

https://ftp.isc.org/isc/bind9/keys/9.11/bind.keys.v9_11

This includes the new KSK2017 key which is planned to replace the KSK2010
in October 11th, 2018. It is important to have software that ships with
both before September 11th 2018. Anything that bootstraps after that could
have trouble switching.

XXX: pullup-8, pullup-7, pullup-6


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.1.26.1 src/etc/namedb/bind.keys

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

Modified files:

Index: src/etc/namedb/bind.keys
diff -u src/etc/namedb/bind.keys:1.1 src/etc/namedb/bind.keys:1.1.26.1
--- src/etc/namedb/bind.keys:1.1	Thu Apr 25 17:02:29 2013
+++ src/etc/namedb/bind.keys	Sat May  5 15:14:30 2018
@@ -1,5 +1,4 @@
-/*	$NetBSD: bind.keys,v 1.1 2013/04/25 17:02:29 christos Exp $	*/
-/* Id: bind.keys,v 1.7 2011-01-03 23:45:07 each Exp  */
+/*	$NetBSD: bind.keys,v 1.1.26.1 2018/05/05 15:14:30 martin Exp $	*/
 # The bind.keys file is used to override the built-in DNSSEC trust anchors
 # which are included as part of BIND 9.  As of the current release, the only
 # trust anchors it contains are those for the DNS root zone ("."), and for
@@ -16,15 +15,18 @@
 #
 # This file is NOT expected to be user-configured.
 #
-# These keys are current as of January 2011.  If any key fails to
+# These keys are current as of February 2017.  If any key fails to
 # initialize correctly, it may have expired.  In that event you should
 # replace this file with a current version.  The latest version of
 # bind.keys can always be obtained from ISC at https://www.isc.org/bind-keys.
 
 managed-keys {
 	# ISC DLV: See https://www.isc.org/solutions/dlv for details.
-# NOTE: This key is activated by setting "dnssec-lookaside auto;"
-# in named.conf.
+	#
+	# NOTE: The ISC DLV zone is being phased out as of February 2017;
+	# the key will remain in place but the zone will be otherwise empty.
+	# Configuring "dnssec-lookaside auto;" to activate this key is
+	# harmless, but is no longer useful and is not recommended.
 	dlv.isc.org. initial-key 257 3 5 "BEPHMu/5onzrEE7z1egmhg/WPO0+juoZrW3euWEn4MxDCE1+lLy2
 		brhQv5rN32RKtMzX6Mj70jdzeND4XknW58dnJNPCxn8+jAGl2FZLK8t+
 		1uq4W+nnA3qO2+DL+k6BD4mewMLbIYFwe0PG73Te9fZ2kJb56dhgMde5
@@ -33,10 +35,16 @@ managed-keys {
 		QKtUdvNXDrYJDSHZws3xiRXF1Rf+al9UmZfSav/4NWLKjHzpT59k/VSt
 		TDN0YUuWrBNh";
 
-	# ROOT KEY: See https://data.iana.org/root-anchors/root-anchors.xml
+	# ROOT KEYS: See https://data.iana.org/root-anchors/root-anchors.xml
 	# for current trust anchor information.
-# NOTE: This key is activated by setting "dnssec-validation auto;"
-# in named.conf.
+	#
+	# These keys are activated by setting "dnssec-validation auto;"
+	# in named.conf.
+	#
+	# This key (19036) is to be phased out starting in 2017. It will
+	# remain in the root zone for some time after its successor key
+	# has been added. It will remain this file until it is removed from
+	# the root zone.
 	. initial-key 257 3 8 "AwEAAagAIKlVZrpC6Ia7gEzahOR+9W29euxhJhVVLOyQbSEW0O8gcCjF
 		FVQUTf6v58fLjwBd0YI0EzrAcQqBGCzh/RStIoO8g0NfnfL2MTJRkxoX
 		bfDaUeVPQuYEhg37NZWAJQ9VnMVDxP/VHL496M/QZxkjf5/Efucp2gaD
@@ -44,4 +52,19 @@ managed-keys {
 		W5hOA2hzCTMjJPJ8LbqF6dsV6DoBQzgul0sGIcGOYl7OyQdXfZ57relS
 		Qageu+ipAdTTJ25AsRTAoub8ONGcLmqrAmRLKBP1dfwhYB4N7knNnulq
 		QxA+Uk1ihz0=";
+
+	# This key (20326) is to be published in the root zone in 2017.
+	# Servers which were already using the old key (19036) should
+	# roll seamlessly to this new one via RFC 5011 rollover. Servers
+	# being set up for the first time can use the contents of this
+	# file as initializing keys; thereafter, the keys in the
+	# managed key database will be trusted and maintained
+	# automatically.
+	. initial-key 257 3 8 "AwEAAaz/tAm8yTn4Mfeh5eyI96WSVexTBAvkMgJzkKTOiW1vkIbzxeF3
+		+/4RgWOq7HrxRixHlFlExOLAJr5emLvN7SWXgnLh4+B5xQlNVz8Og8kv
+		ArMtNROxVQuCaSnIDdD5LKyWbRd2n9WGe2R8PzgCmr3EgVLrjyBxWezF
+		0jLHwVN8efS3rCj/EWgvIWgb9tarpVUDK/b58Da+sqqls3eNbuv7pr+e
+		oZG+SrDK6nWeL3c6H5Apxz7LjVc1uTIdsIXxuOLYA4/ilBmSVIzuDWfd
+		RUfhHdY6+cn8HFRm+2hM8AnXGXws9555KrUB5qihylGa8subX2Nn6UwN
+		R1AkUTV74bU=";
 };



CVS commit: [netbsd-8] src

2018-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May  5 15:11:53 UTC 2018

Modified Files:
src/share/man/man9 [netbsd-8]: secmodel_securelevel.9
src/sys/arch/x86/x86 [netbsd-8]: svs.c
src/sys/secmodel/securelevel [netbsd-8]: secmodel_securelevel.c
src/sys/secmodel/suser [netbsd-8]: secmodel_suser.c
src/sys/sys [netbsd-8]: kauth.h

Log Message:
Pull up following revision(s) (requested by alnsn in ticket #790):

share/man/man9/secmodel_securelevel.9: revision 1.16
sys/secmodel/suser/secmodel_suser.c: revision 1.44
sys/secmodel/securelevel/secmodel_securelevel.c: revision 1.31
sys/sys/kauth.h: revision 1.76
sys/arch/x86/x86/svs.c: revision 1.18

Add KAUTH_MACHDEP_SVS_DISABLE and add support to secmodel_securelevel(9).
Disabling SVS is denied at securelevel 1 and above.

Add SVS. It may not be disabled at securelevel 1 and above.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.18.1 src/share/man/man9/secmodel_securelevel.9
cvs rdiff -u -r1.14.2.3 -r1.14.2.4 src/sys/arch/x86/x86/svs.c
cvs rdiff -u -r1.30 -r1.30.22.1 \
src/sys/secmodel/securelevel/secmodel_securelevel.c
cvs rdiff -u -r1.42.10.1 -r1.42.10.2 src/sys/secmodel/suser/secmodel_suser.c
cvs rdiff -u -r1.73.10.2 -r1.73.10.3 src/sys/sys/kauth.h

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

Modified files:

Index: src/share/man/man9/secmodel_securelevel.9
diff -u src/share/man/man9/secmodel_securelevel.9:1.15 src/share/man/man9/secmodel_securelevel.9:1.15.18.1
--- src/share/man/man9/secmodel_securelevel.9:1.15	Tue Mar 18 18:20:40 2014
+++ src/share/man/man9/secmodel_securelevel.9	Sat May  5 15:11:53 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: secmodel_securelevel.9,v 1.15 2014/03/18 18:20:40 riastradh Exp $
+.\" $NetBSD: secmodel_securelevel.9,v 1.15.18.1 2018/05/05 15:11:53 martin Exp $
 .\"
 .\" Copyright (c) 2006 Elad Efrat 
 .\" Copyright (c) 2000 Hugh Graham
@@ -26,7 +26,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd November 22, 2012
+.Dd April 26, 2018
 .Dt SECMODEL_SECURELEVEL 9
 .Os
 .Sh NAME
@@ -136,6 +136,8 @@ Access to unmanaged memory is denied.
 Only GPIO pins that have been set at
 .Em securelevel
 0 can be accessed.
+.It
+SVS (Separate Virtual Space) may not be disabled on platforms that support it.
 .El
 .It \ 2 Em Highly secure mode
 .Bl -bullet

Index: src/sys/arch/x86/x86/svs.c
diff -u src/sys/arch/x86/x86/svs.c:1.14.2.3 src/sys/arch/x86/x86/svs.c:1.14.2.4
--- src/sys/arch/x86/x86/svs.c:1.14.2.3	Mon Apr  2 08:43:58 2018
+++ src/sys/arch/x86/x86/svs.c	Sat May  5 15:11:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: svs.c,v 1.14.2.3 2018/04/02 08:43:58 martin Exp $	*/
+/*	$NetBSD: svs.c,v 1.14.2.4 2018/05/05 15:11:53 martin Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.14.2.3 2018/04/02 08:43:58 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.14.2.4 2018/05/05 15:11:53 martin Exp $");
 
 #include "opt_svs.h"
 
@@ -38,6 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.14
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -737,11 +738,13 @@ sysctl_machdep_svs_enabled(SYSCTLFN_ARGS
 			error = 0;
 		else
 			error = EOPNOTSUPP;
-	} else {
-		if (svs_enabled)
+	} else if (svs_enabled) {
+		error = kauth_authorize_machdep(kauth_cred_get(),
+		KAUTH_MACHDEP_SVS_DISABLE, NULL, NULL, NULL, NULL);
+		if (!error)
 			error = svs_disable();
-		else
-			error = 0;
+	} else {
+		error = 0;
 	}
 
 	return error;

Index: src/sys/secmodel/securelevel/secmodel_securelevel.c
diff -u src/sys/secmodel/securelevel/secmodel_securelevel.c:1.30 src/sys/secmodel/securelevel/secmodel_securelevel.c:1.30.22.1
--- src/sys/secmodel/securelevel/secmodel_securelevel.c:1.30	Tue Feb 25 18:30:13 2014
+++ src/sys/secmodel/securelevel/secmodel_securelevel.c	Sat May  5 15:11:53 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: secmodel_securelevel.c,v 1.30 2014/02/25 18:30:13 pooka Exp $ */
+/* $NetBSD: secmodel_securelevel.c,v 1.30.22.1 2018/05/05 15:11:53 martin Exp $ */
 /*-
  * Copyright (c) 2006 Elad Efrat 
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: secmodel_securelevel.c,v 1.30 2014/02/25 18:30:13 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: secmodel_securelevel.c,v 1.30.22.1 2018/05/05 15:11:53 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_insecure.h"
@@ -494,6 +494,11 @@ secmodel_securelevel_machdep_cb(kauth_cr
 			result = KAUTH_RESULT_DENY;
 		break;
 
+	case KAUTH_MACHDEP_SVS_DISABLE:
+		if (securelevel > 0)
+			result = KAUTH_RESULT_DENY;
+		break;
+
 	case KAUTH_MACHDEP_CPU_UCODE_APPLY:
 		if (securelevel > 1)
 			result = KAUTH_RESULT_DENY;

Index: src/sys/secmodel/suser/secmodel_suser.c
diff -u 

CVS commit: [netbsd-8] src/sys/dev/isa

2018-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May  5 15:08:15 UTC 2018

Modified Files:
src/sys/dev/isa [netbsd-8]: wbsio.c

Log Message:
Pull up following revision(s) (requested by yamaguchi in ticket #789):

sys/dev/isa/wbsio.c: revision 1.24

Use spin mutex to fix a panic

The GPIO part of wbsio(4) has a lock to keep the register access
order. In addition to the lock, gpio(4) has a look to prevent
multiple control through gpio_pin_ctl(). Those locks hold at
once when gpio_pin_ctl() is called, and the lock of gpio(4) hold
before that of wbsio(4).

Therefore, the wbsio(4) has to use spin lock if gpio(4) uses
spin lock.


To generate a diff of this commit:
cvs rdiff -u -r1.10.10.3 -r1.10.10.4 src/sys/dev/isa/wbsio.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/isa/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.10.10.3 src/sys/dev/isa/wbsio.c:1.10.10.4
--- src/sys/dev/isa/wbsio.c:1.10.10.3	Mon Apr 16 14:28:23 2018
+++ src/sys/dev/isa/wbsio.c	Sat May  5 15:08:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: wbsio.c,v 1.10.10.3 2018/04/16 14:28:23 martin Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.10.10.4 2018/05/05 15:08:14 martin Exp $	*/
 /*	$OpenBSD: wbsio.c,v 1.10 2015/03/14 03:38:47 jsg Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis 
@@ -546,7 +546,7 @@ wbsio_gpio_rt_init(struct wbsio_softc *s
 	aprint_normal_dev(sc->sc_dev, "GPIO: port 0x%x-0x%x\n",
 	iobase, iobase + WBSIO_GPIO_IOSIZE);
 
-	mutex_init(>sc_gpio_lock, MUTEX_DEFAULT, IPL_NONE);
+	mutex_init(>sc_gpio_lock, MUTEX_DEFAULT, IPL_VM);
 
 	return 0;
 }



CVS commit: [netbsd-8] src/sys/dev/usb

2018-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May  5 15:05:39 UTC 2018

Modified Files:
src/sys/dev/usb [netbsd-8]: xhci.c xhcireg.h

Log Message:
Pull up following revision(s) (requested by jdolecek in ticket #787):

sys/dev/usb/xhci.c: revision 1.88-1.90
sys/dev/usb/xhcireg.h: revision 1.10

add KASSERT() that sc_child* is set to NULL after child detach; just for
readability, it's not immediatelly obvious this is done in xhci_childdet()
no functional changes

trigger the softint processing on that child bus which is not detached yet
fixes PR kern/53066 by Martin Husemann

enable code to only trigger usb processing when EINT is set, to
avoid misinterpreting shared interrupt for another device

when clearing USBSTS, actually preserve the bits which spec requires to
preserve, and actually clear bit 1, which should be actually always
cleared to zero by spec

also #ifdef XHCI_DEBUG some unnecessary register reads
this should finally resolve PR kern/53066 also for Martin


To generate a diff of this commit:
cvs rdiff -u -r1.72.2.5 -r1.72.2.6 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.9 -r1.9.6.1 src/sys/dev/usb/xhcireg.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/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.72.2.5 src/sys/dev/usb/xhci.c:1.72.2.6
--- src/sys/dev/usb/xhci.c:1.72.2.5	Thu Dec 21 21:53:31 2017
+++ src/sys/dev/usb/xhci.c	Sat May  5 15:05:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.72.2.5 2017/12/21 21:53:31 snj Exp $	*/
+/*	$NetBSD: xhci.c,v 1.72.2.6 2018/05/05 15:05:39 martin Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.72.2.5 2017/12/21 21:53:31 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.72.2.6 2018/05/05 15:05:39 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -582,12 +582,14 @@ xhci_detach(struct xhci_softc *sc, int f
 		rv = config_detach(sc->sc_child2, flags);
 		if (rv != 0)
 			return rv;
+		KASSERT(sc->sc_child2 == NULL);
 	}
 
 	if (sc->sc_child != NULL) {
 		rv = config_detach(sc->sc_child, flags);
 		if (rv != 0)
 			return rv;
+		KASSERT(sc->sc_child == NULL);
 	}
 
 	/* XXX unconfigure/free slots */
@@ -1247,7 +1249,16 @@ xhci_intr(void *v)
 
 	ret = xhci_intr1(sc);
 	if (ret) {
-		usb_schedsoftintr(>sc_bus);
+		KASSERT(sc->sc_child || sc->sc_child2);
+
+		/*
+		 * One of child busses could be already detached. It doesn't
+		 * matter on which of the two the softintr is scheduled.
+		 */
+		if (sc->sc_child)
+			usb_schedsoftintr(>sc_bus);
+		else
+			usb_schedsoftintr(>sc_bus2);
 	}
 done:
 	mutex_spin_exit(>sc_intr_lock);
@@ -1264,24 +1275,36 @@ xhci_intr1(struct xhci_softc * const sc)
 
 	usbsts = xhci_op_read_4(sc, XHCI_USBSTS);
 	DPRINTFN(16, "USBSTS %08jx", usbsts, 0, 0, 0);
-#if 0
-	if ((usbsts & (XHCI_STS_EINT|XHCI_STS_PCD)) == 0) {
+	if ((usbsts & (XHCI_STS_HSE | XHCI_STS_EINT | XHCI_STS_PCD |
+	XHCI_STS_HCE)) == 0) {
+		DPRINTFN(16, "ignored intr not for %s",
+		device_xname(sc->sc_dev), 0, 0, 0);
 		return 0;
 	}
-#endif
-	xhci_op_write_4(sc, XHCI_USBSTS,
-	usbsts & (2|XHCI_STS_EINT|XHCI_STS_PCD)); /* XXX */
+
+	/*
+	 * Clear EINT and other transient flags, to not misenterpret
+	 * next shared interrupt. Also, to avoid race, EINT must be cleared
+	 * before XHCI_IMAN_INTR_PEND is cleared.
+	 */
+	xhci_op_write_4(sc, XHCI_USBSTS, usbsts & XHCI_STS_RSVDP0);
+
+#ifdef XHCI_DEBUG
 	usbsts = xhci_op_read_4(sc, XHCI_USBSTS);
 	DPRINTFN(16, "USBSTS %08jx", usbsts, 0, 0, 0);
+#endif
 
 	iman = xhci_rt_read_4(sc, XHCI_IMAN(0));
 	DPRINTFN(16, "IMAN0 %08jx", iman, 0, 0, 0);
 	iman |= XHCI_IMAN_INTR_PEND;
 	xhci_rt_write_4(sc, XHCI_IMAN(0), iman);
+
+#ifdef XHCI_DEBUG
 	iman = xhci_rt_read_4(sc, XHCI_IMAN(0));
 	DPRINTFN(16, "IMAN0 %08jx", iman, 0, 0, 0);
 	usbsts = xhci_op_read_4(sc, XHCI_USBSTS);
 	DPRINTFN(16, "USBSTS %08jx", usbsts, 0, 0, 0);
+#endif
 
 	return 1;
 }

Index: src/sys/dev/usb/xhcireg.h
diff -u src/sys/dev/usb/xhcireg.h:1.9 src/sys/dev/usb/xhcireg.h:1.9.6.1
--- src/sys/dev/usb/xhcireg.h:1.9	Thu Jan 19 16:05:00 2017
+++ src/sys/dev/usb/xhcireg.h	Sat May  5 15:05:39 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: xhcireg.h,v 1.9 2017/01/19 16:05:00 skrll Exp $ */
+/* $NetBSD: xhcireg.h,v 1.9.6.1 2018/05/05 15:05:39 martin Exp $ */
 
 /*-
  * Copyright (c) 2010 Hans Petter Selasky. All rights reserved.
@@ -106,14 +106,17 @@
 
 #define	XHCI_USBSTS		0x04	/* XHCI status */
 #define	 XHCI_STS_HCH		0x0001	/* RO - Host Controller Halted */
+#define	 XHCI_STS_RSVDZ0	0x0002	/* RsvdZ - 2:2 */
 #define	 XHCI_STS_HSE		0x0004	/* RW - Host System Error */
 #define	 XHCI_STS_EINT		0x0008	/* RW - Event Interrupt */
 #define	 XHCI_STS_PCD		0x0010	/* RW - Port Change Detect */
+#define	 XHCI_STS_RSVDZ1	__BITS(5, 7)	/* RsvdZ - 5:7 */
 #define	 XHCI_STS_SSS		0x0100	/* RO - Save State Status */
 #define	 

CVS commit: [netbsd-8] src/sys/arch/amd64/amd64

2018-05-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat May  5 15:00:29 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-8]: locore.S

Log Message:
Pull up following revision(s) (requested by maxv in ticket #786):

sys/arch/amd64/amd64/locore.S: revision 1.164,1.165

Adjust Xsyscall_svs to not use movq for 64bit immediates either.

Do not use movq for loading arbitrary 64bit immediates. The ISA
restricts it to 32bit immediates.


To generate a diff of this commit:
cvs rdiff -u -r1.123.6.5 -r1.123.6.6 src/sys/arch/amd64/amd64/locore.S

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

Modified files:

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.123.6.5 src/sys/arch/amd64/amd64/locore.S:1.123.6.6
--- src/sys/arch/amd64/amd64/locore.S:1.123.6.5	Thu Mar 22 16:59:03 2018
+++ src/sys/arch/amd64/amd64/locore.S	Sat May  5 15:00:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.123.6.5 2018/03/22 16:59:03 martin Exp $	*/
+/*	$NetBSD: locore.S,v 1.123.6.6 2018/05/05 15:00:29 martin Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1368,8 +1368,8 @@ IDTVEC(\name)
 
 	/* Get the LWP's kernel stack pointer in %rax */
 	.if	\is_svs
-		movq	%rax,SVS_UTLS+UTLS_SCRATCH
-		movq	SVS_UTLS+UTLS_RSP0,%rax
+		movabs	%rax,SVS_UTLS+UTLS_SCRATCH
+		movabs	SVS_UTLS+UTLS_RSP0,%rax
 	.else
 		movq	%rax,CPUVAR(SCRATCH)
 		movq	CPUVAR(CURLWP),%rax
@@ -1387,7 +1387,7 @@ IDTVEC(\name)
 
 	/* Restore %rax */
 	.if	\is_svs
-		movq	SVS_UTLS+UTLS_SCRATCH,%rax
+		movabs	SVS_UTLS+UTLS_SCRATCH,%rax
 	.else
 		movq	CPUVAR(SCRATCH),%rax
 	.endif
@@ -1579,7 +1579,7 @@ END(intrfastexit)
 	.globl	nosvs_leave_altstack, nosvs_leave_altstack_end
 
 LABEL(svs_enter)
-	movq	SVS_UTLS+UTLS_KPDIRPA,%rax
+	movabs	SVS_UTLS+UTLS_KPDIRPA,%rax
 	movq	%rax,%cr3
 	movq	CPUVAR(KRSP0),%rsp
 LABEL(svs_enter_end)
@@ -1587,7 +1587,7 @@ LABEL(svs_enter_end)
 LABEL(svs_enter_altstack)
 	testb	$SEL_UPL,TF_CS(%rsp)
 	jz	1234f
-	movq	SVS_UTLS+UTLS_KPDIRPA,%rax
+	movabs	SVS_UTLS+UTLS_KPDIRPA,%rax
 	movq	%rax,%cr3
 1234:
 LABEL(svs_enter_altstack_end)



CVS commit: [netbsd-8] src/doc

2018-05-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May  4 16:26:29 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Tickets #783, #784, #785


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.189 -r1.1.2.190 src/doc/CHANGES-8.0

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.189 src/doc/CHANGES-8.0:1.1.2.190
--- src/doc/CHANGES-8.0:1.1.2.189	Thu Apr 19 15:55:21 2018
+++ src/doc/CHANGES-8.0	Fri May  4 16:26:29 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.189 2018/04/19 15:55:21 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.190 2018/05/04 16:26:29 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -13139,3 +13139,26 @@ sys/dev/pci/nvme_pci.c1.20
 sys/sys/param.h	changed manually
 
 	Welcome to 8.0 RC1
+
+sys/arch/macppc/conf/GENERIC			(patch)
+
+	Disable radeonfb since it still fails on some hardware.
+	macallan, ticket #783]
+
+sys/arch/x86/acpi/acpi_wakeup.c			1.46
+
+	Save and restore xcr0 when doing ACPI sleeps.
+	[maya, ticket #784]
+
+sbin/gpt/gpt.8	1.53-1.57,1.59
+sbin/gpt/gpt.c	1.74
+sbin/gpt/map.c	1.14
+
+	Document the bootme flag.
+	Fix a typo, and make a couple of minor wording improvements.
+	Clarify that alignment is the number of bytes to align to.
+	Explain what suffixes are accepted when specifying a size.
+	Add information about how to boot from gpt.
+	If a new map entry doesn't fit, be more verbose about the sizes.
+	[mrg, ticket #785]
+



CVS commit: [netbsd-8] src/sbin/gpt

2018-05-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May  4 16:24:46 UTC 2018

Modified Files:
src/sbin/gpt [netbsd-8]: gpt.8 gpt.c map.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #785):
sbin/gpt/gpt.c: revision 1.74
sbin/gpt/map.c: revision 1.14
sbin/gpt/gpt.8: revision 1.53
sbin/gpt/gpt.8: revision 1.54
sbin/gpt/gpt.8: revision 1.55
sbin/gpt/gpt.8: revision 1.56
sbin/gpt/gpt.8: revision 1.57
sbin/gpt/gpt.8: revision 1.59

Add note about bootme flag:
The bootme flag is used to indicate which partiotion should be booted
by UEFI boot code.

Fix a typo, and make a couple of minor wording improvements.
I resisted the (very weak) impulse to Americanise some spellings ...

Use Fx/Nx.

clarify that alignment is the number of bytes to align to.

Explain what suffixes are accepted when specifying a size.
Spelling

add information about how to boot from gpt.  mostly taken from the wiki.

if a new map entry doesn't fit, be more verbose about the sizes.


To generate a diff of this commit:
cvs rdiff -u -r1.52.4.1 -r1.52.4.2 src/sbin/gpt/gpt.8
cvs rdiff -u -r1.70.4.1 -r1.70.4.2 src/sbin/gpt/gpt.c
cvs rdiff -u -r1.13 -r1.13.8.1 src/sbin/gpt/map.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/gpt/gpt.8
diff -u src/sbin/gpt/gpt.8:1.52.4.1 src/sbin/gpt/gpt.8:1.52.4.2
--- src/sbin/gpt/gpt.8:1.52.4.1	Mon Apr  9 12:54:00 2018
+++ src/sbin/gpt/gpt.8	Fri May  4 16:24:46 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpt.8,v 1.52.4.1 2018/04/09 12:54:00 bouyer Exp $
+.\" $NetBSD: gpt.8,v 1.52.4.2 2018/05/04 16:24:46 martin Exp $
 .\"
 .\" Copyright (c) 2002 Marcel Moolenaar
 .\" All rights reserved.
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD: src/sbin/gpt/gpt.8,v 1.17 2006/06/22 22:22:32 marcel Exp $
 .\"
-.Dd February 15, 2017
+.Dd March 5, 2018
 .Dt GPT 8
 .Os
 .Sh NAME
@@ -132,7 +132,8 @@ The command-specific options can be used
 The
 .Fl a Ar alignment
 option allows the user to specify an alignment for the start and size.
-The alignment may have a suffix to indicate its magnitude.
+The alignment is given in bytes and may have a suffix to indicate its
+magnitude.
 .Nm
 will attempt to align the partition.
 .Pp
@@ -162,6 +163,15 @@ or
 .Sq S
 then size is in sectors, otherwise size is in bytes which must be
 a multiple of the device's sector size.
+Accepted suffix units are
+.Sq b
+to denote bytes,
+.Sq k
+to denote kilobytes,
+.Sq m
+to denote megabytes and
+.Sq g
+to denote gigabytes.
 The minimum size is 1 sector.
 .Pp
 The
@@ -180,15 +190,20 @@ BIOS Boot
 .It Cm efi
 EFI System
 .It Cm fbsd-legacy
-FreeBSD legacy
+.Fx
+legacy
 .It Cm fbsd-swap
-FreeBSD swap
+.Fx
+swap
 .It Cm fbsd-ufs
-FreeBSD UFS/UFS2
+.Fx
+UFS/UFS2
 .It Cm fbsd-vinum
-FreeBSD vinum
+.Fx
+vinum
 .It Cm fbsd-zfs
-FreeBSD ZFS
+.Fx
+ZFS
 .It Cm linux-data
 Linux data
 .It Cm linux-raid
@@ -202,17 +217,23 @@ Windows basic data
 .It Cm windows-reserved
 Windows reserved
 .It Cm ccd
-NetBSD ccd component
+.Nx
+ccd component
 .It Cm cgd
-NetBSD Cryptographic Disk
+.Nx
+Cryptographic Disk
 .It Cm ffs
-NetBSD FFSv1/FFSv2
+.Nx
+FFSv1/FFSv2
 .It Cm lfs
-NetBSD LFS
+.Nx
+LFS
 .It Cm raid
-NetBSD RAIDFrame component
+.Nx
+RAIDFrame component
 .It Cm swap
-NetBSD swap
+.Nx
+swap
 .El
 as aliases for the most commonly used partition types.
 .\"  backup 
@@ -256,8 +277,8 @@ bootstrap code, as installed via
 The
 .Fl L
 option selects the partition by label.
-If there are multiple partitions with the same label, it will use the
-first one found.
+If there are multiple partitions with the same label, the
+first one found will be used.
 .\"  create 
 .It Nm Ic create Oo Fl AfP Oc Oo Fl p Ar partitions Oc
 The
@@ -462,6 +483,15 @@ or
 .Sq S
 then size is in sectors, otherwise size is in bytes which must be
 a multiple of the device's sector size.
+Accepted suffix units are
+.Sq b
+to denote bytes,
+.Sq k
+to denote kilobytes,
+.Sq m
+to denote megabytes and
+.Sq g
+to denote gigabytes.
 The minimum size is 1 sector.
 If the
 .Fl a
@@ -491,6 +521,15 @@ or
 .Sq S
 then size is in sectors, otherwise size is in bytes which must be
 a multiple of the device's sector size.
+Accepted suffix units are
+.Sq b
+to denote bytes,
+.Sq k
+to denote kilobytes,
+.Sq m
+to denote megabytes and
+.Sq g
+to denote gigabytes.
 Using the
 .Fl s
 option allows you to move the backup copy prior to resizing the medium.
@@ -543,14 +582,15 @@ by legacy BIOS boot code.
 See the
 .Ic biosboot
 command for more information.
+The bootme flag is used to indicate which partition should be booted
+by UEFI boot code.
 The other attributes are for compatibility with
 .Fx
-and are not currently used by any
-.Nx
-code.
+and are not currently used by
+.Nx .
 They may be used by
 .Nx
-code in the future.
+in the future.
 .\"  show 
 .It Nm Ic show Oo Fl aglu Oc Oo Fl i Ar index Oc

CVS commit: [netbsd-8] src/sys/arch/x86/acpi

2018-05-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May  4 16:07:59 UTC 2018

Modified Files:
src/sys/arch/x86/acpi [netbsd-8]: acpi_wakeup.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #784):
sys/arch/x86/acpi/acpi_wakeup.c: revision 1.46
Save and restore xcr0 when doing ACPI sleeps. Should fix PR/49174.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.45.8.1 src/sys/arch/x86/acpi/acpi_wakeup.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/acpi/acpi_wakeup.c
diff -u src/sys/arch/x86/acpi/acpi_wakeup.c:1.45 src/sys/arch/x86/acpi/acpi_wakeup.c:1.45.8.1
--- src/sys/arch/x86/acpi/acpi_wakeup.c:1.45	Thu Oct 20 16:05:04 2016
+++ src/sys/arch/x86/acpi/acpi_wakeup.c	Fri May  4 16:07:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_wakeup.c,v 1.45 2016/10/20 16:05:04 maxv Exp $	*/
+/*	$NetBSD: acpi_wakeup.c,v 1.45.8.1 2018/05/04 16:07:59 martin Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2011 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.45 2016/10/20 16:05:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.45.8.1 2018/05/04 16:07:59 martin Exp $");
 
 #include 
 #include 
@@ -250,6 +250,7 @@ acpi_md_sleep_enter(int state)
 void
 acpi_cpu_sleep(struct cpu_info *ci)
 {
+	uint64_t xcr0 = 0;
 	int s;
 
 	KASSERT(!CPU_IS_PRIMARY(ci));
@@ -259,12 +260,21 @@ acpi_cpu_sleep(struct cpu_info *ci)
 	fpusave_cpu(true);
 	x86_disable_intr();
 
+	/*
+	 * XXX also need to save the PMCs, the dbregs, and probably a few
+	 * MSRs too.
+	 */
+	if (rcr4() & CR4_OSXSAVE)
+		xcr0 = rdxcr(0);
+
 	if (acpi_md_sleep_prepare(-1))
 		goto out;
 
 	/* Execute Wakeup */
 	cpu_init_msrs(ci, false);
 	fpuinit(ci);
+	if (rcr4() & CR4_OSXSAVE)
+		wrxcr(0, xcr0);
 
 #if NLAPIC > 0
 	lapic_enable();
@@ -285,6 +295,7 @@ out:
 int
 acpi_md_sleep(int state)
 {
+	uint64_t xcr0 = 0;
 	int s, ret = 0;
 #ifdef MULTIPROCESSOR
 	struct cpu_info *ci;
@@ -315,12 +326,21 @@ acpi_md_sleep(int state)
 	}
 #endif
 
+	/*
+	 * XXX also need to save the PMCs, the dbregs, and probably a few
+	 * MSRs too.
+	 */
+	if (rcr4() & CR4_OSXSAVE)
+		xcr0 = rdxcr(0);
+
 	if (acpi_md_sleep_prepare(state))
 		goto out;
 
 	/* Execute Wakeup */
 	cpu_init_msrs(_info_primary, false);
 	fpuinit(_info_primary);
+	if (rcr4() & CR4_OSXSAVE)
+		wrxcr(0, xcr0);
 	i8259_reinit();
 #if NLAPIC > 0
 	lapic_enable();



CVS commit: [netbsd-8] src/sys/arch/macppc/conf

2018-05-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May  4 16:03:32 UTC 2018

Modified Files:
src/sys/arch/macppc/conf [netbsd-8]: GENERIC

Log Message:
Apply patch, reqeusted by macallan in ticket #783:

Disable radeonfb since it still fails on some hardware.


To generate a diff of this commit:
cvs rdiff -u -r1.329.2.4 -r1.329.2.5 src/sys/arch/macppc/conf/GENERIC

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

Modified files:

Index: src/sys/arch/macppc/conf/GENERIC
diff -u src/sys/arch/macppc/conf/GENERIC:1.329.2.4 src/sys/arch/macppc/conf/GENERIC:1.329.2.5
--- src/sys/arch/macppc/conf/GENERIC:1.329.2.4	Mon Feb 26 01:08:26 2018
+++ src/sys/arch/macppc/conf/GENERIC	Fri May  4 16:03:32 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.329.2.4 2018/02/26 01:08:26 snj Exp $
+# $NetBSD: GENERIC,v 1.329.2.5 2018/05/04 16:03:32 martin Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include		"arch/macppc/conf/std.macppc"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.329.2.4 $"
+#ident 		"GENERIC-$Revision: 1.329.2.5 $"
 
 maxusers	32
 
@@ -294,8 +294,8 @@ r128fb*		at pci? function ?	# ATI Rage 1
 voodoofb*	at pci? function ?	# 3Dfx Voodoo3 
 
 # ATI Radeon. Still has problems on some hardware
-radeonfb*	at pci? function ?
-options 	RADEONFB_ALWAYS_ACCEL_PUTCHAR
+#radeonfb*	at pci? function ?
+#options 	RADEONFB_ALWAYS_ACCEL_PUTCHAR
 
 # generic PCI framebuffer, should work with everything supported by OF
 genfb*		at pci? function ?



CVS commit: [netbsd-8] src/doc

2018-04-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr 23 09:22:14 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES

Log Message:
Fix revision confusion between CHANGES.prev and CHANGES in the
processing of ticket #602: the pullup asked for rev 1.138 of CHANGES.prev
to be applied to CHANGES, not rev 1.138 of CHANGES to be pulled up.


To generate a diff of this commit:
cvs rdiff -u -r1.2286.2.3 -r1.2286.2.4 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.2286.2.3 src/doc/CHANGES:1.2286.2.4
--- src/doc/CHANGES:1.2286.2.3	Tue Mar  6 09:52:09 2018
+++ src/doc/CHANGES	Mon Apr 23 09:22:14 2018
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2286.2.3 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2286.2.4 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -355,8 +355,6 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 	amd64: Use fine-grained permissions for architecture-specific memory
 		areas (W^X). [maxv 20160725]
 	sdtemp(4): Add support for Atmel AT30TS00, AT30TSE004, Giantec
-	kernel: SMBFS uses low-overhead NT Directory Change Notify SMB to watch
-		for vnode kqueue(2) events on directories [jdolecek 20030407]
 		GT30TS00, GT34TS02, Microchip MCP9804, MCP98244, IDT
 		TS3000GB[02], TS3001GB2, TSE200[24]GB2 and On Semiconductor
 		CAT34TS04. [msaitoh 20160726]
@@ -470,8 +468,6 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 	libc: Add accept4 function for compatibility [maya 20170208]
 	file(1): Upgraded to 5.30. [christos 20170210]
 	byacc: update to 20170201 [christos 20170211]
-	ptrace(2): Add signal mask information accessors API:
-		PT_GET_SIGMASK and PT_SET_SIGMASK [kamil 20170212]
 	postfix(1): Import version 3.1.4. [christos 20170213]
 	l2tp(4): Add L2TPv3 interface. [knakahara 20170216]
 	siginfo(2): Add new si_code for SIGTRAP: TRAP_DBREG [kamil 20170217]



CVS commit: [netbsd-8] src

2018-04-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 19 15:55:22 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0
src/sys/sys [netbsd-8]: param.h

Log Message:
Welcome to 8.0 RC1!


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.188 -r1.1.2.189 src/doc/CHANGES-8.0
cvs rdiff -u -r1.542.2.1 -r1.542.2.2 src/sys/sys/param.h

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.188 src/doc/CHANGES-8.0:1.1.2.189
--- src/doc/CHANGES-8.0:1.1.2.188	Thu Apr 19 15:38:22 2018
+++ src/doc/CHANGES-8.0	Thu Apr 19 15:55:21 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.188 2018/04/19 15:38:22 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.189 2018/04/19 15:55:21 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -13136,3 +13136,6 @@ sys/dev/pci/nvme_pci.c1.20
 	nvmectl(8): Remove some wdc subcommands from man page.
 	[nonaka, ticket #781]
 
+sys/sys/param.h	changed manually
+
+	Welcome to 8.0 RC1

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.542.2.1 src/sys/sys/param.h:1.542.2.2
--- src/sys/sys/param.h:1.542.2.1	Sun Jun  4 07:12:09 2017
+++ src/sys/sys/param.h	Thu Apr 19 15:55:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.542.2.1 2017/06/04 07:12:09 snj Exp $	*/
+/*	$NetBSD: param.h,v 1.542.2.2 2018/04/19 15:55:21 martin Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	8	/* NetBSD 8.0_BETA */
+#define	__NetBSD_Version__	8	/* NetBSD 8.0_RC1 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: [netbsd-8] src

2018-04-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 19 15:37:56 UTC 2018

Modified Files:
src/sbin/nvmectl [netbsd-8]: Makefile bignum.c devlist.c firmware.c
identify.c logpage.c nvme.h nvmectl.8 nvmectl.c nvmectl.h
perftest.c power.c reset.c wdc.c
src/sys/dev/ic [netbsd-8]: ld_nvme.c nvme.c nvmeio.h nvmereg.h
nvmevar.h
src/sys/dev/pci [netbsd-8]: nvme_pci.c
Added Files:
src/sbin/nvmectl [netbsd-8]: util.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #781):

sbin/nvmectl/Makefile   1.4
sbin/nvmectl/bignum.c   1.2
sbin/nvmectl/devlist.c  1.3-1.5
sbin/nvmectl/firmware.c 1.3,1.4
sbin/nvmectl/identify.c 1.3-1.5
sbin/nvmectl/logpage.c  1.5-1.7
sbin/nvmectl/nvme.h 1.3
sbin/nvmectl/nvmectl.8  1.5
sbin/nvmectl/nvmectl.c  1.5-1.7
sbin/nvmectl/nvmectl.h  1.5-1.8
sbin/nvmectl/perftest.c 1.3-1.5
sbin/nvmectl/power.c1.3,1.4
sbin/nvmectl/reset.c1.2,1.3
sbin/nvmectl/util.c 1.1,1.2
sbin/nvmectl/wdc.c  1.2-1.4
sys/dev/ic/ld_nvme.c1.20
sys/dev/ic/nvme.c   1.38,1.39
sys/dev/ic/nvmeio.h 1.2
sys/dev/ic/nvmereg.h1.10,1.11
sys/dev/ic/nvmevar.h1.16
sys/dev/pci/nvme_pci.c  1.20

nvmectl(8): Sync with FreeBSD nvmecontrol(8) r328763.

nvmectl(8): fix wdc command usage.

nvme(4): Added some delay before check RDY bit quirk when disabling device.
Pick from FreeBSD nvme(4) r326937.

Add some new structure fileds, opcodes and statuses from NVMe 1.3a.

nvmectl(8): Add big-endian support.
from FreeBSD nvmecontolr(8) r329824.

nvmectl(8): fix subcommand usage.

nvmectl(8): Remove some wdc subcommands from man page.
- wdc drive-log
- wdc get-crash-dump
- wdc purge
- wdc purge-monitor

Typos.

use setprogname()/getprogname(), do not hardcode the prognam name in fixed
strings


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.2.1 src/sbin/nvmectl/Makefile
cvs rdiff -u -r1.1 -r1.1.8.1 src/sbin/nvmectl/bignum.c \
src/sbin/nvmectl/reset.c
cvs rdiff -u -r1.2 -r1.2.8.1 src/sbin/nvmectl/devlist.c \
src/sbin/nvmectl/identify.c src/sbin/nvmectl/perftest.c \
src/sbin/nvmectl/power.c
cvs rdiff -u -r1.2 -r1.2.2.1 src/sbin/nvmectl/firmware.c \
src/sbin/nvmectl/nvme.h
cvs rdiff -u -r1.4 -r1.4.2.1 src/sbin/nvmectl/logpage.c \
src/sbin/nvmectl/nvmectl.8 src/sbin/nvmectl/nvmectl.c \
src/sbin/nvmectl/nvmectl.h
cvs rdiff -u -r0 -r1.2.2.2 src/sbin/nvmectl/util.c
cvs rdiff -u -r1.1 -r1.1.4.1 src/sbin/nvmectl/wdc.c
cvs rdiff -u -r1.16.2.2 -r1.16.2.3 src/sys/dev/ic/ld_nvme.c
cvs rdiff -u -r1.30.2.3 -r1.30.2.4 src/sys/dev/ic/nvme.c
cvs rdiff -u -r1.1 -r1.1.12.1 src/sys/dev/ic/nvmeio.h
cvs rdiff -u -r1.9 -r1.9.2.1 src/sys/dev/ic/nvmereg.h
cvs rdiff -u -r1.13.6.2 -r1.13.6.3 src/sys/dev/ic/nvmevar.h
cvs rdiff -u -r1.19 -r1.19.2.1 src/sys/dev/pci/nvme_pci.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/nvmectl/Makefile
diff -u src/sbin/nvmectl/Makefile:1.3 src/sbin/nvmectl/Makefile:1.3.2.1
--- src/sbin/nvmectl/Makefile:1.3	Sat Apr 29 00:06:40 2017
+++ src/sbin/nvmectl/Makefile	Thu Apr 19 15:37:56 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.3 2017/04/29 00:06:40 nonaka Exp $
+#	$NetBSD: Makefile,v 1.3.2.1 2018/04/19 15:37:56 martin Exp $
 
 .include 
 
@@ -11,6 +11,7 @@ SRCS+=	logpage.c
 SRCS+=	perftest.c
 SRCS+=	power.c
 SRCS+=	reset.c
+SRCS+=	util.c
 SRCS+=	wdc.c
 SRCS+=	bignum.c
 SRCS+=	humanize_bignum.c

Index: src/sbin/nvmectl/bignum.c
diff -u src/sbin/nvmectl/bignum.c:1.1 src/sbin/nvmectl/bignum.c:1.1.8.1
--- src/sbin/nvmectl/bignum.c:1.1	Mon Feb 13 11:16:46 2017
+++ src/sbin/nvmectl/bignum.c	Thu Apr 19 15:37:56 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bignum.c,v 1.1 2017/02/13 11:16:46 nonaka Exp $	*/
+/*	$NetBSD: bignum.c,v 1.1.8.1 2018/04/19 15:37:56 martin Exp $	*/
 
 /*-
  * Copyright (c) 2012 Alistair Crooks 
@@ -1649,7 +1649,7 @@ mp_2expt(mp_int * a, int b)
 	/* zero a as per default */
 	mp_zero(a);
 
-	/* grow a to accomodate the single bit */
+	/* grow a to accommodate the single bit */
 	if ((res = mp_grow(a, b / DIGIT_BIT + 1)) != MP_OKAY) {
 		return res;
 	}
@@ -1683,7 +1683,7 @@ doubled(mp_int * a, mp_int * b)
 {
 	int x, res, oldused;
 
-	/* grow to accomodate result */
+	/* grow to 

CVS commit: [netbsd-8] src/doc

2018-04-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 19 15:38:22 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Ticket #781


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.187 -r1.1.2.188 src/doc/CHANGES-8.0

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.187 src/doc/CHANGES-8.0:1.1.2.188
--- src/doc/CHANGES-8.0:1.1.2.187	Wed Apr 18 14:50:39 2018
+++ src/doc/CHANGES-8.0	Thu Apr 19 15:38:22 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.187 2018/04/18 14:50:39 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.188 2018/04/19 15:38:22 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -13104,3 +13104,35 @@ sys/arch/zaurus/conf/GENERIC
 	Remove options DIAGNOSTIC again.
 	[snj, ticket #60]
 
+sbin/nvmectl/Makefile1.4
+sbin/nvmectl/bignum.c1.2
+sbin/nvmectl/devlist.c1.3-1.5
+sbin/nvmectl/firmware.c1.3,1.4
+sbin/nvmectl/identify.c1.3-1.5
+sbin/nvmectl/logpage.c1.5-1.7
+sbin/nvmectl/nvme.h1.3
+sbin/nvmectl/nvmectl.81.5
+sbin/nvmectl/nvmectl.c1.5-1.7
+sbin/nvmectl/nvmectl.h1.5-1.8
+sbin/nvmectl/perftest.c1.3-1.5
+sbin/nvmectl/power.c1.3,1.4
+sbin/nvmectl/reset.c1.2,1.3
+sbin/nvmectl/util.c1.1,1.2
+sbin/nvmectl/wdc.c1.2-1.4
+sys/dev/ic/ld_nvme.c1.20
+sys/dev/ic/nvme.c1.38,1.39
+sys/dev/ic/nvmeio.h1.2
+sys/dev/ic/nvmereg.h1.10,1.11
+sys/dev/ic/nvmevar.h1.16
+sys/dev/pci/nvme_pci.c1.20
+
+	nvmectl(8): Sync with FreeBSD nvmecontrol(8) r328763.
+	nvmectl(8): fix wdc command usage.
+	nvme(4): Added some delay before check RDY bit quirk when
+	disabling device.
+	Add some new structure fileds, opcodes and statuses from NVMe 1.3a.
+	nvmectl(8): Add big-endian support.
+	nvmectl(8): fix subcommand usage.
+	nvmectl(8): Remove some wdc subcommands from man page.
+	[nonaka, ticket #781]
+



CVS commit: [netbsd-8] src/doc

2018-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 18 14:50:39 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Tickets #774 - #780, and #60.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.186 -r1.1.2.187 src/doc/CHANGES-8.0

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.186 src/doc/CHANGES-8.0:1.1.2.187
--- src/doc/CHANGES-8.0:1.1.2.186	Tue Apr 17 16:03:36 2018
+++ src/doc/CHANGES-8.0	Wed Apr 18 14:50:39 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.186 2018/04/17 16:03:36 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.187 2018/04/18 14:50:39 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -13019,4 +13019,88 @@ sys/netipsec/ipsec_mbuf.c			1.23,1.24
 	Fix a pretty bad mistake (IPsec DoS).
 	[maxv, ticket #773]
 
+crypto/external/bsd/openssl/dist/crypto/asn1/asn1.h		(patch)
+crypto/external/bsd/openssl/dist/crypto/asn1/asn1_err.c		(patch)
+crypto/external/bsd/openssl/dist/crypto/asn1/tasn_dec.c		(patch)
+crypto/external/bsd/openssl/dist/crypto/bn/asm/rsaz-avx2.pl	(patch)
+crypto/external/bsd/openssl/dist/crypto/bn/asm/x86_64-mont5.pl	(patch)
+crypto/external/bsd/openssl/dist/crypto/rsa/rsa_gen.c		1.2 (patch)
+crypto/external/bsd/openssl/dist/crypto/x509v3/v3_addr.c	(patch)
+crypto/external/bsd/openssl/dist/ssl/ssl.h			(patch)
+crypto/external/bsd/openssl/lib/libcrypto/arch/x86_64/rsaz-avx2.S (regen)
+crypto/external/bsd/openssl/lib/libcrypto/arch/x86_64/x86_64-mont5.S  (regen)
+
+	Apply upstream fixes for CVE-2017-3735, CVE-2017-3736, CVE-2017-3737,
+	CVE-2017-3738, CVE-2018-0737, CVE-2018-0739.
+	[christos, ticket #774]
+
+external/gpl3/gcc/dist/gcc/genattrtab.c		1.2
+tools/Makefile.gnuhost1.46-1.48
+
+	Remove hack previously needed to build gcc/arm with clang.
+	Apply upstream fix to not generate too many superflous
+	paranthesis, gcc/arm exceeds the clang limit.
+	[maya, ticket #775]
+
+sys/netipsec/key.c1.251-1.253
+sys/netipsec/keydb.h1.22
+
+	Improve the lookup of IPsec SAs.
+	[yamaguchi, ticket #776]
+
+sys/net/if_bridge.c1.150-1.154
+sys/net/if_bridgevar.h1.32
+tests/net/if_bridge/t_rtable.sh			1.3
+
+	Remove obsolete NULL checks.
+	Simplify bridge_rtnode_insert.
+	Use pslist(9) for rtlist and rthash.
+	Add a test that checks if brconfig flush surely removes all entries.
+	Add missing PSLIST_ENTRY_INIT and PSLIST_ENTRY_DESTROY.
+	[ozaki-r, ticket #777]
+
+sys/arch/x86/include/specialreg.h		1.118,1.119
+
+	From the latest Intel SDM:
+	 - Add Intel Fn_0006 %eax new bit 14-20 (HWP stuff).
+	 - Intel Fn_0007 %ecx bit 22 is for both RDPID and IA32_TSC_AUX.
+	Add Some bit definitions of AMD Fn8001 %edx:
+	 - MMX
+	 - FXSR
+	[msaitoh, ticket #778]
+
+sys/net/if_pppoe.c1.135,1.136
+
+	Sysctl net.pppoe.term_unknown can be written safely now.
+	Fix sending PADT to unexpected hosts when net.pppoe.term_unknown
+	is enabled.
+	[knakahara, ticket #779]
+
+sys/dev/pci/pcidevs1.1328-1.1330
+sys/dev/pci/pcidevs.h(regen)
+sys/dev/pci/pcidevs_data.h			(regen)
+
+	Add some 8th Generation Intel Core Processor devices.
+	Add Intel SSD 760p.
+	Add some NVMe devices.
+	[nonaka, ticket #780]
+
+sys/arch/amd64/conf/GENERIC
+sys/arch/amd64/conf/XEN3_DOM0
+sys/arch/amd64/conf/XEN3_DOMU
+sys/arch/cobalt/conf/GENERIC
+sys/arch/evbarm/conf/BEAGLEBONE
+sys/arch/evbarm/conf/BEAGLEBOARD
+sys/arch/evbarm/conf/BEAGLEBOARDXM
+sys/arch/evbarm/conf/GENERIC.common
+sys/arch/i386/conf/GENERIC
+sys/arch/i386/conf/XEN3_DOM0
+sys/arch/i386/conf/XEN3_DOMU
+sys/arch/mvmeppc/conf/GENERIC
+sys/arch/shark/conf/GENERIC
+sys/arch/sparc64/conf/GENERIC
+sys/arch/zaurus/conf/GENERIC
+
+	Remove options DIAGNOSTIC again.
+	[snj, ticket #60]
 



CVS commit: [netbsd-8] src/sys/arch

2018-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 18 14:45:09 UTC 2018

Modified Files:
src/sys/arch/amd64/conf [netbsd-8]: GENERIC XEN3_DOM0 XEN3_DOMU
src/sys/arch/cobalt/conf [netbsd-8]: GENERIC
src/sys/arch/evbarm/conf [netbsd-8]: BEAGLEBOARD BEAGLEBOARDXM
BEAGLEBONE GENERIC.common
src/sys/arch/i386/conf [netbsd-8]: GENERIC XEN3_DOM0 XEN3_DOMU
src/sys/arch/mvmeppc/conf [netbsd-8]: GENERIC
src/sys/arch/shark/conf [netbsd-8]: GENERIC
src/sys/arch/sparc64/conf [netbsd-8]: GENERIC
src/sys/arch/zaurus/conf [netbsd-8]: GENERIC

Log Message:
Requested by skrll in ticket #60:
sys/arch/amd64/conf/GENERIC
sys/arch/amd64/conf/XEN3_DOM0
sys/arch/amd64/conf/XEN3_DOMU
sys/arch/cobalt/conf/GENERIC
sys/arch/evbarm/conf/BEAGLEBONE
sys/arch/evbarm/conf/BEAGLEBOARD
sys/arch/evbarm/conf/BEAGLEBOARDXM
sys/arch/evbarm/conf/GENERIC.common
sys/arch/i386/conf/GENERIC
sys/arch/i386/conf/XEN3_DOM0
sys/arch/i386/conf/XEN3_DOMU
sys/arch/mvmeppc/conf/GENERIC
sys/arch/shark/conf/GENERIC
sys/arch/sparc64/conf/GENERIC
sys/arch/zaurus/conf/GENERIC

Remove option DIAGNOSTIC.


To generate a diff of this commit:
cvs rdiff -u -r1.459.2.8 -r1.459.2.9 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.135.4.6 -r1.135.4.7 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.75.2.3 -r1.75.2.4 src/sys/arch/amd64/conf/XEN3_DOMU
cvs rdiff -u -r1.151.8.3 -r1.151.8.4 src/sys/arch/cobalt/conf/GENERIC
cvs rdiff -u -r1.61.6.2 -r1.61.6.3 src/sys/arch/evbarm/conf/BEAGLEBOARD
cvs rdiff -u -r1.23.6.3 -r1.23.6.4 src/sys/arch/evbarm/conf/BEAGLEBOARDXM
cvs rdiff -u -r1.42.2.3 -r1.42.2.4 src/sys/arch/evbarm/conf/BEAGLEBONE
cvs rdiff -u -r1.18.6.3 -r1.18.6.4 src/sys/arch/evbarm/conf/GENERIC.common
cvs rdiff -u -r1.1156.2.8 -r1.1156.2.9 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.112.4.7 -r1.112.4.8 src/sys/arch/i386/conf/XEN3_DOM0
cvs rdiff -u -r1.77.2.5 -r1.77.2.6 src/sys/arch/i386/conf/XEN3_DOMU
cvs rdiff -u -r1.27.6.2 -r1.27.6.3 src/sys/arch/mvmeppc/conf/GENERIC
cvs rdiff -u -r1.127.6.2 -r1.127.6.3 src/sys/arch/shark/conf/GENERIC
cvs rdiff -u -r1.198.6.4 -r1.198.6.5 src/sys/arch/sparc64/conf/GENERIC
cvs rdiff -u -r1.73.6.2 -r1.73.6.3 src/sys/arch/zaurus/conf/GENERIC

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

Modified files:

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.459.2.8 src/sys/arch/amd64/conf/GENERIC:1.459.2.9
--- src/sys/arch/amd64/conf/GENERIC:1.459.2.8	Wed Apr 11 14:23:30 2018
+++ src/sys/arch/amd64/conf/GENERIC	Wed Apr 18 14:45:08 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.459.2.8 2018/04/11 14:23:30 martin Exp $
+# $NetBSD: GENERIC,v 1.459.2.9 2018/04/18 14:45:08 martin Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.459.2.8 $"
+#ident		"GENERIC-$Revision: 1.459.2.9 $"
 
 maxusers	64		# estimated number of users
 
@@ -94,7 +94,7 @@ options 	PMC		# performance-monitoring c
 options 	BUFQ_PRIOCSCAN
 
 # Diagnostic/debugging support options
-options 	DIAGNOSTIC	# inexpensive kernel consistency checks
+#options 	DIAGNOSTIC	# inexpensive kernel consistency checks
 # XXX to be commented out on release branch
 #options 	DEBUG		# expensive debugging checks/support
 #options 	LOCKDEBUG	# expensive locking checks/support

Index: src/sys/arch/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.135.4.6 src/sys/arch/amd64/conf/XEN3_DOM0:1.135.4.7
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.135.4.6	Mon Feb  5 15:14:00 2018
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Wed Apr 18 14:45:08 2018
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.135.4.6 2018/02/05 15:14:00 martin Exp $
+# $NetBSD: XEN3_DOM0,v 1.135.4.7 2018/04/18 14:45:08 martin Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -52,7 +52,7 @@ options 	SYSCTL_INCLUDE_DESCR	# Include 
 options 	BUFQ_PRIOCSCAN
 
 # Diagnostic/debugging support options
-options 	DIAGNOSTIC	# inexpensive kernel consistency checks
+#options 	DIAGNOSTIC	# inexpensive kernel consistency checks
 #options 	DEBUG		# expensive debugging checks/support
 options 	DDB		# in-kernel debugger
 options 	DDB_ONPANIC=1	# see also sysctl(7): `ddb.onpanic'

Index: src/sys/arch/amd64/conf/XEN3_DOMU
diff -u src/sys/arch/amd64/conf/XEN3_DOMU:1.75.2.3 src/sys/arch/amd64/conf/XEN3_DOMU:1.75.2.4
--- src/sys/arch/amd64/conf/XEN3_DOMU:1.75.2.3	Fri Jan 26 14:28:15 2018
+++ src/sys/arch/amd64/conf/XEN3_DOMU	Wed Apr 18 14:45:08 2018
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOMU,v 1.75.2.3 2018/01/26 14:28:15 martin Exp $
+# $NetBSD: XEN3_DOMU,v 1.75.2.4 2018/04/18 14:45:08 martin Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -44,7 +44,7 @@ options 	SYSCTL_INCLUDE_DESCR	# Include 
 

CVS commit: [netbsd-8] src/sys/dev/pci

2018-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 18 14:21:50 UTC 2018

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs.h pcidevs_data.h

Log Message:
regen for ticket #780


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.5 -r1.1281.2.6 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.5 -r1.1280.2.6 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


CVS commit: [netbsd-8] src/sys/dev/pci

2018-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 18 14:20:26 UTC 2018

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #780):

sys/dev/pci/pcidevs: revision 1.1328-1.1330

Add some 8th Generation Intel Core Processor devices.
Add Intel SSD 760p.
Added some NVMe devices.


To generate a diff of this commit:
cvs rdiff -u -r1.1289.2.5 -r1.1289.2.6 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1289.2.5 src/sys/dev/pci/pcidevs:1.1289.2.6
--- src/sys/dev/pci/pcidevs:1.1289.2.5	Sat Apr 14 10:32:05 2018
+++ src/sys/dev/pci/pcidevs	Wed Apr 18 14:20:25 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.5 2018/04/14 10:32:05 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.6 2018/04/18 14:20:25 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -645,6 +645,8 @@ vendor MARVELL2		0x1b4b	Marvell
 vendor FRESCO		0x1b73	Fresco Logic
 vendor QINHENG2		0x1c00	Nanjing QinHeng Electronics (PCIe)
 vendor SYMPHONY2	0x1c1c	Symphony Labs (2nd PCI Vendor ID)
+vendor HGST		0x1c58	HGST, Inc.
+vendor BEIJING_MEMBLAZE	0x1c5f	Beijing Memblaze Technology Co. Ltd.
 vendor TEKRAM2		0x1de1	Tekram Technology (2nd PCI Vendor ID)
 vendor SUNIX2		0x1fd4	SUNIX Co
 vendor HINT		0x3388	HiNT
@@ -1742,6 +1744,9 @@ product BBELEC ISOLATED_2_PORT		0x4212	d
 product BBELEC ISOLATED_4_PORT		0x4214	quad-channel Isolated RS-485 PCI UART
 product BBELEC ISOLATED_8_PORT		0x4218	octal-channel Isolated RS-485 PCI UART
 
+/* Beijing Memblaze Technology Co. Ltd. products */
+product BEIJING_MEMBLAZE PBLAZE4	0x0540	PBlaze4 NVMe SSD
+
 /* Belkin products */
 product BELKIN F5D6001		0x6001	F5D6001
 product BELKIN F5D6020V3	0x6020	F5D6020v3 802.11b
@@ -2631,6 +2636,10 @@ product HP ILO3_SLAVE		0x3306	iLO3 Slave
 product HP ILO3_MGMT		0x3307	iLO3 Management
 product HP RS780_PPB_GFX	0x9602  (AMD) RS780 PCI-PCI Bridge (int gfx)
 
+/* HGST Inc. products */
+product HGST SN100	0x0003	Ultrastar SN100 Series NVMe SSD
+product HGST SN200	0x0023	Ultrastar SN200 Series NVMe SSD
+
 /* Hifn products */
 product HIFN 7751	0x0005	7751
 product HIFN 6500	0x0006	6500
@@ -4469,6 +4478,11 @@ product INTEL E5_UNICAST	0x3ce8	E5 Unica
 product INTEL E5_SAD_1		0x3cf4	E5 SAD
 product INTEL E5_BROADCAST	0x3cf5	E5 Broadcast
 product INTEL E5_SAD_2		0x3cf6	E5 SAD
+product INTEL CORE8G_S_HOST_DRAM_4C 0x3e1f Core 8G (S) Host Bridge, DRAM
+product INTEL CORE8G_S_HOST_DRAM_6C 0x3ec2 Core 8G (S) Host Bridge, DRAM
+product INTEL CORE8G_PCIE_X16	0x3e81 Core 8G (S) PCIe x16
+product INTEL CORE8G_PCIE_X8	0x3e85 Core 8G (S) PCIe x16
+product INTEL CORE8G_PCIE_X4	0x3e89 Core 8G (S) PCIe x16
 product INTEL COFLK_IGD_1	0x3e90	UHD Graphics 610
 product INTEL COFLK_IGD_2	0x3e91	UHD Graphics 630
 product INTEL COFLK_IGD_3	0x3e92	UHD Graphics 630
@@ -5286,6 +5300,7 @@ product INTEL CP_SS_REGS	0xd156	Core Pro
 product INTEL CP_SCS_REGS	0xd157	Core Processor System Control and Status Registers
 product INTEL CP_MISC_REGS	0xd158	Core Processor Miscellaneous Registers
 product INTEL HANKSVILLE	0xf0fe	HANKSVILLE LAN Controller
+product INTEL SSD_760P		0xf1a6	SSD 760p
 
 /* Intergraph products */
 product INTERGRAPH 4D60T	0x00e3	Powerstorm 4D60T
@@ -6610,6 +6625,8 @@ product SAFENET SAFEXCEL	0x1141 SafeXcel
 product SAMSUNGELEC3	XP941		0xa800	XP941 M.2 SSD
 product SAMSUNGELEC3	SM951		0xa801	SM951 M.2 SSD
 product SAMSUNGELEC3	SM951_NVME	0xa802	SM951 M.2 NVMe SSD
+product SAMSUNGELEC3	172X		0xa821	NVMe SSD Controller 172X
+product SAMSUNGELEC3	172XAB		0xa822	NVMe SSD Controller 172Xa/172Xb
 
 /* Samsung Semiconductor products */
 product SAMSUNGSEMI	KS8920	0x8920	KS8920 10/100 Ethernet



CVS commit: [netbsd-8] src/sys/net

2018-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 18 14:16:57 UTC 2018

Modified Files:
src/sys/net [netbsd-8]: if_pppoe.c

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #779):

sys/net/if_pppoe.c: revision 1.135,1.136

net.pppoe.term_unknown can be written safely now.

Fix sending PADT to unexpected hosts when net.pppoe.term_unknown is enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.125.6.6 -r1.125.6.7 src/sys/net/if_pppoe.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/if_pppoe.c
diff -u src/sys/net/if_pppoe.c:1.125.6.6 src/sys/net/if_pppoe.c:1.125.6.7
--- src/sys/net/if_pppoe.c:1.125.6.6	Thu Mar  8 13:22:25 2018
+++ src/sys/net/if_pppoe.c	Wed Apr 18 14:16:57 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.125.6.6 2018/03/08 13:22:25 martin Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.125.6.7 2018/04/18 14:16:57 martin Exp $ */
 
 /*-
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.125.6.6 2018/03/08 13:22:25 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.125.6.7 2018/04/18 14:16:57 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -63,6 +63,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -236,6 +237,7 @@ static int	pppoe_clone_create(struct if_
 static int	pppoe_clone_destroy(struct ifnet *);
 
 static bool	pppoe_term_unknown = false;
+static int	pppoe_term_unknown_pps = 1;
 
 static struct sysctllog	*pppoe_sysctl_clog;
 static void sysctl_net_pppoe_setup(struct sysctllog **);
@@ -951,6 +953,16 @@ pppoe_disc_input(struct mbuf *m)
 		m_freem(m);
 }
 
+static bool
+pppoe_is_my_frame(uint8_t *dhost, struct ifnet *rcvif)
+{
+
+	if (memcmp(CLLADDR(rcvif->if_sadl), dhost, ETHER_ADDR_LEN) == 0)
+		return true;
+
+	return false;
+}
+
 static void
 pppoe_data_input(struct mbuf *m)
 {
@@ -960,12 +972,17 @@ pppoe_data_input(struct mbuf *m)
 	struct ifnet *rcvif;
 	struct psref psref;
 	uint8_t shost[ETHER_ADDR_LEN];
+	uint8_t dhost[ETHER_ADDR_LEN];
+	bool term_unknown = pppoe_term_unknown;
 
 	KASSERT(m->m_flags & M_PKTHDR);
 
-	if (pppoe_term_unknown)
+	if (term_unknown) {
 		memcpy(shost, mtod(m, struct ether_header*)->ether_shost,
 		ETHER_ADDR_LEN);
+		memcpy(dhost, mtod(m, struct ether_header*)->ether_dhost,
+		ETHER_ADDR_LEN);
+	}
 	m_adj(m, sizeof(struct ether_header));
 	if (m->m_pkthdr.len <= PPPOE_HEADERLEN) {
 		printf("pppoe (data): dropping too short packet: %d bytes\n",
@@ -996,10 +1013,21 @@ pppoe_data_input(struct mbuf *m)
 		goto drop;
 	sc = pppoe_find_softc_by_session(session, rcvif, RW_READER);
 	if (sc == NULL) {
-		if (pppoe_term_unknown) {
-			printf("pppoe: input for unknown session %#x, "
-			"sending PADT\n", session);
-			pppoe_send_padt(rcvif, session, shost);
+		if (term_unknown) {
+			static struct timeval lasttime = {0, 0};
+			static int curpps = 0;
+			/*
+			 * avoid to send wrong PADT which is response from
+			 * session stage pakcets for other hosts when parent
+			 * ethernet is promiscuous mode.
+			 */
+			if (pppoe_is_my_frame(dhost, rcvif)
+			&& ppsratecheck(, ,
+pppoe_term_unknown_pps)) {
+printf("pppoe: input for unknown session %#x, "
+"sending PADT\n", session);
+pppoe_send_padt(rcvif, session, shost);
+			}
 		}
 		m_put_rcvif_psref(rcvif, );
 		goto drop;
@@ -1941,7 +1969,7 @@ sysctl_net_pppoe_setup(struct sysctllog 
 		return;
 
 	sysctl_createv(clog, 0, , NULL,
-	CTLFLAG_PERMANENT | CTLFLAG_READONLY,
+	CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
 	CTLTYPE_BOOL, "term_unknown",
 	SYSCTL_DESCR("Terminate unknown sessions"),
 	NULL, 0, _term_unknown, sizeof(pppoe_term_unknown),



CVS commit: [netbsd-8] src/sys/arch/x86/include

2018-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 18 14:14:17 UTC 2018

Modified Files:
src/sys/arch/x86/include [netbsd-8]: specialreg.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #778):

sys/arch/x86/include/specialreg.h: revision 1.118,1.119

 From the latest Intel SDM:
- Add Intel Fn_0006 %eax new bit 14-20 (HWP stuff).
- Intel Fn_0007 %ecx bit 22 is for both RDPID and IA32_TSC_AUX.

Add Some bit definitions of AMD Fn8001 %edx:
  - MMX
  - FXSR


To generate a diff of this commit:
cvs rdiff -u -r1.98.2.3 -r1.98.2.4 src/sys/arch/x86/include/specialreg.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/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.98.2.3 src/sys/arch/x86/include/specialreg.h:1.98.2.4
--- src/sys/arch/x86/include/specialreg.h:1.98.2.3	Sat Mar 31 10:51:05 2018
+++ src/sys/arch/x86/include/specialreg.h	Wed Apr 18 14:14:17 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.98.2.3 2018/03/31 10:51:05 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.98.2.4 2018/04/18 14:14:17 martin Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -300,12 +300,19 @@
 #define CPUID_DSPM_HWP_PLR __BIT(11)	/* HWP Package Level Request */
 #define CPUID_DSPM_HDC	__BIT(13)	/* Hardware Duty Cycling */
 #define CPUID_DSPM_TBMT3 __BIT(14)	/* Turbo Boost Max Technology 3.0 */
+#define CPUID_DSPM_HWP_CAP__BIT(15)	/* HWP Capabilities */
+#define CPUID_DSPM_HWP_PECI   __BIT(16)	/* HWP PECI override */
+#define CPUID_DSPM_HWP_FLEX   __BIT(17)	/* Flexible HWP */
+#define CPUID_DSPM_HWP_FAST   __BIT(18)	/* Fast access for IA32_HWP_REQUEST */
+#define CPUID_DSPM_HWP_IGNIDL __BIT(20)	/* Ignore Idle Logical Processor HWP */
 
 #define CPUID_DSPM_FLAGS	"\20" \
 	"\1" "DTS"	"\2" "IDA"	"\3" "ARAT" 			\
 	"\5" "PLN"	"\6" "ECMD"	"\7" "PTM"	"\10" "HWP"	\
 	"\11" "HWP_NOTIFY" "\12" "HWP_ACTWIN" "\13" "HWP_EPP" "\14" "HWP_PLR" \
-			"\16" "HDC"	"\17" "TBM3"
+			"\16" "HDC"	"\17" "TBM3"	"\20" "HWP_CAP" \
+	"\21" "HWP_PECI" "\22" "HWP_FLEX" "\23" "HWP_FAST"		\
+	"25" "HWP_IGNIDL"
 
 /*
  * Intel Digital Thermal Sensor and
@@ -381,7 +388,7 @@
 #define CPUID_SEF_AVX512_VNNI	__BIT(11) /* Vector neural Network Instruction */
 #define CPUID_SEF_AVX512_BITALG	__BIT(12)
 #define CPUID_SEF_AVX512_VPOPCNTDQ __BIT(14)
-#define CPUID_SEF_RDPID		__BIT(22) /* ReaD Processor ID */
+#define CPUID_SEF_RDPID		__BIT(22) /* RDPID and IA32_TSC_AUX */
 #define CPUID_SEF_SGXLC		__BIT(30) /* SGX Launch Configuration */
 
 #define CPUID_SEF_FLAGS1	"\20" \
@@ -491,6 +498,8 @@
 #define CPUID_MPC	0x0008	/* Multiprocessing Capable */
 #define CPUID_NOX	0x0010	/* No Execute Page Protection */
 #define CPUID_MMXX	0x0040	/* AMD MMX Extensions */
+/*	CPUID_MMX			   MMX supported */
+/*	CPUID_FXSR			   fast FP/MMX save/restore */
 #define CPUID_FFXSR	0x0200	/* FXSAVE/FXSTOR Extensions */
 /*	CPUID_P1GB			   1GB Large Page Support */
 /*	CPUID_RDTSCP			   Read TSC Pair Instruction */
@@ -499,9 +508,11 @@
 #define CPUID_3DNOW	0x8000	/* 3DNow! Instructions */
 
 #define CPUID_EXT_FLAGS	"\20" \
-	"\14" "SYSCALL/SYSRET"		"\24" "MPC"	"\25" "NOX" \
-	"\27" "MMXX"	"\32" "FFXSR"	"\33" "P1GB"	"\34" "RDTSCP" \
-	"\36" "LONG"	"\37" "3DNOW2"	"\40" "3DNOW"
+		"\14" "SYSCALL/SYSRET"	\
+			"\24" "MPC"	\
+	"\25" "NOX"			"\27" "MMXX"	"\30" "MMX"	\
+	"\31" "FXSR"	"\32" "FFXSR"	"\33" "P1GB"	"\34" "RDTSCP"	\
+			"\36" "LONG"	"\37" "3DNOW2"	"\40" "3DNOW"
 
 /* AMD Fn8001 extended features - %ecx */
 /* 	CPUID_LAHF			   LAHF/SAHF instruction */



CVS commit: [netbsd-8] src

2018-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 18 14:11:43 UTC 2018

Modified Files:
src/sys/net [netbsd-8]: if_bridge.c if_bridgevar.h
src/tests/net/if_bridge [netbsd-8]: t_rtable.sh

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #777):

tests/net/if_bridge/t_rtable.sh: revision 1.3
sys/net/if_bridge.c: revision 1.150-1.154
sys/net/if_bridgevar.h: revision 1.32

Remove obsolete NULL checks

Simplify bridge_rtnode_insert (NFC)

bridge: use pslist(9) for rtlist and rthash

The change fixes race conditions on list operations.  One example is that a
reader may see invalid pointers on a looking item in a list due to lack of
membar_producer.

Add a test that checks if brconfig flush surely removes all entries

Get rid of a unnecessary semicolon
Pointed out by kamil@

Add missing PSLIST_ENTRY_INIT and PSLIST_ENTRY_DESTROY


To generate a diff of this commit:
cvs rdiff -u -r1.134.6.8 -r1.134.6.9 src/sys/net/if_bridge.c
cvs rdiff -u -r1.31 -r1.31.10.1 src/sys/net/if_bridgevar.h
cvs rdiff -u -r1.1.8.1 -r1.1.8.2 src/tests/net/if_bridge/t_rtable.sh

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/if_bridge.c
diff -u src/sys/net/if_bridge.c:1.134.6.8 src/sys/net/if_bridge.c:1.134.6.9
--- src/sys/net/if_bridge.c:1.134.6.8	Tue Apr 10 11:48:29 2018
+++ src/sys/net/if_bridge.c	Wed Apr 18 14:11:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.134.6.8 2018/04/10 11:48:29 martin Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.134.6.9 2018/04/18 14:11:42 martin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.134.6.8 2018/04/10 11:48:29 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.134.6.9 2018/04/18 14:11:42 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -181,20 +181,39 @@ __CTASSERT(offsetof(struct ifbifconf, if
 #define	BRIDGE_RTABLE_PRUNE_PERIOD	(5 * 60)
 #endif
 
-#define BRIDGE_RT_LOCK(_sc)	if ((_sc)->sc_rtlist_lock) \
-	mutex_enter((_sc)->sc_rtlist_lock)
-#define BRIDGE_RT_UNLOCK(_sc)	if ((_sc)->sc_rtlist_lock) \
-	mutex_exit((_sc)->sc_rtlist_lock)
-#define BRIDGE_RT_LOCKED(_sc)	(!(_sc)->sc_rtlist_lock || \
- mutex_owned((_sc)->sc_rtlist_lock))
+#define BRIDGE_RT_LOCK(_sc)	mutex_enter((_sc)->sc_rtlist_lock)
+#define BRIDGE_RT_UNLOCK(_sc)	mutex_exit((_sc)->sc_rtlist_lock)
+#define BRIDGE_RT_LOCKED(_sc)	mutex_owned((_sc)->sc_rtlist_lock)
 
 #define BRIDGE_RT_PSZ_PERFORM(_sc) \
-if ((_sc)->sc_rtlist_psz != NULL) \
-	pserialize_perform((_sc)->sc_rtlist_psz);
+pserialize_perform((_sc)->sc_rtlist_psz)
 
 #define BRIDGE_RT_RENTER(__s)	do { __s = pserialize_read_enter(); } while (0)
 #define BRIDGE_RT_REXIT(__s)	do { pserialize_read_exit(__s); } while (0)
 
+#define BRIDGE_RTLIST_READER_FOREACH(_brt, _sc)			\
+	PSLIST_READER_FOREACH((_brt), &((_sc)->sc_rtlist),		\
+	struct bridge_rtnode, brt_list)
+#define BRIDGE_RTLIST_WRITER_FOREACH(_brt, _sc)			\
+	PSLIST_WRITER_FOREACH((_brt), &((_sc)->sc_rtlist),		\
+	struct bridge_rtnode, brt_list)
+#define BRIDGE_RTLIST_WRITER_INSERT_HEAD(_sc, _brt)			\
+	PSLIST_WRITER_INSERT_HEAD(&(_sc)->sc_rtlist, brt, brt_list)
+#define BRIDGE_RTLIST_WRITER_REMOVE(_brt)\
+	PSLIST_WRITER_REMOVE((_brt), brt_list)
+
+#define BRIDGE_RTHASH_READER_FOREACH(_brt, _sc, _hash)			\
+	PSLIST_READER_FOREACH((_brt), &(_sc)->sc_rthash[(_hash)],	\
+	struct bridge_rtnode, brt_hash)
+#define BRIDGE_RTHASH_WRITER_FOREACH(_brt, _sc, _hash)			\
+	PSLIST_WRITER_FOREACH((_brt), &(_sc)->sc_rthash[(_hash)],	\
+	struct bridge_rtnode, brt_hash)
+#define BRIDGE_RTHASH_WRITER_INSERT_HEAD(_sc, _hash, _brt)		\
+	PSLIST_WRITER_INSERT_HEAD(&(_sc)->sc_rthash[(_hash)], brt, brt_hash)
+#define BRIDGE_RTHASH_WRITER_INSERT_AFTER(_brt, _new)			\
+	PSLIST_WRITER_INSERT_AFTER((_brt), (_new), brt_hash)
+#define BRIDGE_RTHASH_WRITER_REMOVE(_brt)\
+	PSLIST_WRITER_REMOVE((_brt), brt_hash)
 
 #ifdef NET_MPSAFE
 #define DECLARE_LOCK_VARIABLE
@@ -1043,7 +1062,7 @@ bridge_ioctl_rts(struct bridge_softc *sc
 	BRIDGE_RT_LOCK(sc);
 
 	len = bac->ifbac_len;
-	LIST_FOREACH(brt, >sc_rtlist, brt_list) {
+	BRIDGE_RTLIST_WRITER_FOREACH(brt, sc) {
 		if (len < sizeof(bareq))
 			goto out;
 		memset(, 0, sizeof(bareq));
@@ -2013,6 +2032,8 @@ bridge_rtalloc(struct bridge_softc *sc, 
 	brt->brt_expire = time_uptime + sc->sc_brttimeout;
 	brt->brt_flags = IFBAF_DYNAMIC;
 	memcpy(brt->brt_addr, dst, ETHER_ADDR_LEN);
+	PSLIST_ENTRY_INIT(brt, brt_list);
+	PSLIST_ENTRY_INIT(brt, brt_hash);
 
 	BRIDGE_RT_LOCK(sc);
 	error = bridge_rtnode_insert(sc, brt);
@@ -2109,7 +2130,7 @@ typedef bool (*bridge_iterate_cb_t)
 static void
 bridge_rtlist_iterate_remove(struct bridge_softc *sc, bridge_iterate_cb_t func, void *arg)
 {
-	struct bridge_rtnode *brt, *nbrt;
+	struct bridge_rtnode *brt;
 	struct bridge_rtnode **brt_list;
 	

CVS commit: [netbsd-8] src/sys/netipsec

2018-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 18 14:06:24 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-8]: key.c keydb.h

Log Message:
Pull up following revision(s) (requested by yamaguchi in ticket #776):

sys/netipsec/key.c: revision 1.251-1.253
sys/netipsec/keydb.h: revision 1.22

Introduced a hash table to sahlist

An saidx of sah included in the list is unique so that
the search can use a hash list whose hash is calculated by
the saidx to find an sah quickly.

The hash list of the sahlits is used in FreeBSD, too.
reviewed by ozaki-r@n.o, thanks.

Added a lookup table to find an sav quickly
key_sad.sahlists doesn't work well for inbound packets because
its key includes source address. For the reason, the
look-up-table for the inbound packets is newly added.
The table has all sav whose state is MATURE or DYING and uses a
key calculated by destination address, protocol, and spi instead
of saidx.

reviewd ozaki-r@n.o, thanks.

Fix panic of SADB when the state of sav is changed in timeout
pointed out by ozaki-r@n.o, thanks


To generate a diff of this commit:
cvs rdiff -u -r1.163.2.8 -r1.163.2.9 src/sys/netipsec/key.c
cvs rdiff -u -r1.15.2.2 -r1.15.2.3 src/sys/netipsec/keydb.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/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.163.2.8 src/sys/netipsec/key.c:1.163.2.9
--- src/sys/netipsec/key.c:1.163.2.8	Mon Apr 16 14:31:44 2018
+++ src/sys/netipsec/key.c	Wed Apr 18 14:06:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.163.2.8 2018/04/16 14:31:44 martin Exp $	*/
+/*	$NetBSD: key.c,v 1.163.2.9 2018/04/18 14:06:24 martin Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.163.2.8 2018/04/16 14:31:44 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.163.2.9 2018/04/18 14:06:24 martin Exp $");
 
 /*
  * This code is referred to RFC 2367
@@ -72,6 +72,7 @@ __KERNEL_RCSID(0, "$NetBSD: key.c,v 1.16
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -122,6 +123,14 @@ __KERNEL_RCSID(0, "$NetBSD: key.c,v 1.16
 #define PORT_LOOSE	1
 #define PORT_STRICT	2
 
+#ifndef SAHHASH_NHASH
+#define SAHHASH_NHASH		128
+#endif
+
+#ifndef SAVLUT_NHASH
+#define SAVLUT_NHASH		128
+#endif
+
 percpu_t *pfkeystat_percpu;
 
 /*
@@ -204,20 +213,23 @@ static u_int32_t acq_seq = 0;
 /*
  * Locking notes on SAD:
  * - Data structures
- *   - SAs are managed by the list called key_sad.sahlist and sav lists of sah
- * entries
+ *   - SAs are managed by the list called key_sad.sahlists and sav lists of
+ * sah entries
  * - An sav is supposed to be an SA from a viewpoint of users
  *   - A sah has sav lists for each SA state
- *   - Multiple sahs with the same saidx can exist
+ *   - Multiple saves with the same saidx can exist
  * - Only one entry has MATURE state and others should be DEAD
  * - DEAD entries are just ignored from searching
- * - Modifications to the key_sad.sahlist and sah.savlist must be done with
- *   holding key_sad.lock which is a adaptive mutex
- * - Read accesses to the key_sad.sahlist and sah.savlist must be in
- *   pserialize(9) read sections
+ *   - All sav whose state is MATURE or DYING are registered to the lookup
+ * table called key_sad.savlut in addition to the savlists.
+ * - The table is used to search an sav without use of saidx.
+ * - Modifications to the key_sad.sahlists, sah.savlist and key_sad.savlut
+ *   must be done with holding key_sad.lock which is a adaptive mutex
+ * - Read accesses to the key_sad.sahlists, sah.savlist and key_sad.savlut
+ *   must be in pserialize(9) read sections
  * - sah's lifetime is managed by localcount(9)
  * - Getting an sah entry
- *   - We get an sah from the key_sad.sahlist
+ *   - We get an sah from the key_sad.sahlists
  * - Must iterate the list and increment the reference count of a found sah
  *   (by key_sah_ref) in a pserialize read section
  *   - A gotten sah must be released after use by key_sah_unref
@@ -261,7 +273,10 @@ static struct {
 static struct {
 	kmutex_t lock;
 	kcondvar_t cv_lc;
-	struct pslist_head sahlist;
+	struct pslist_head *sahlists;
+	u_long sahlistmask;
+	struct pslist_head *savlut;
+	u_long savlutmask;
 
 	pserialize_t psz;
 	kcondvar_t cv_psz;
@@ -341,13 +356,23 @@ static struct {
 #define SAHLIST_WRITER_REMOVE(sah)	\
 	PSLIST_WRITER_REMOVE((sah), pslist_entry)
 #define SAHLIST_READER_FOREACH(sah)	\
-	PSLIST_READER_FOREACH((sah), _sad.sahlist, struct secashead,\
-	  pslist_entry)
+	for(int _i_sah = 0; _i_sah <= key_sad.sahlistmask; _i_sah++)	\
+		PSLIST_READER_FOREACH((sah), _sad.sahlists[_i_sah],	\
+		  struct secashead, pslist_entry)
+#define 

CVS commit: [netbsd-8] src

2018-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 18 14:01:16 UTC 2018

Modified Files:
src/external/gpl3/gcc/dist/gcc [netbsd-8]: genattrtab.c
src/tools [netbsd-8]: Makefile.gnuhost

Log Message:
Pull up following revision(s) (requested by maya in ticket #775):

tools/Makefile.gnuhost: revision 1.46-1.48
external/gpl3/gcc/dist/gcc/genattrtab.c: revision 1.2

do the bracket nesting only for clang for now.

Use the __clang__ preprocessor symbol to check for clang, since --version
might barf. From joerg@

Apply upstream commit:
From: ppalka 
Date: Wed, 27 Apr 2016 21:18:05 +
Subject: [PATCH] Reduce nesting of parentheses in conditionals generated by
 genattrtab

gcc/ChangeLog:
* genattrtab.c (write_test_expr): New parameter EMIT_PARENS
which defaults to true.  Emit an outer pair of parentheses only if
EMIT_PARENS.  When continuing a chain of && or || (or & or |),
don't emit parentheses for the right-hand operand.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235536

gcc/arm generates so many parens it hits a bracket depth limited which is
enforced by clang. This reduces the number of parens generated and avoids the
need to increase bracket depth.

Fixes PR toolchain/53178 properly.

Remove hack previously needed to build gcc/arm with clang.
genattrtab.c:1.2 makes this unnecessary.

Tested by thorpej.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.1.1.3.8.1 \
src/external/gpl3/gcc/dist/gcc/genattrtab.c
cvs rdiff -u -r1.44.8.1 -r1.44.8.2 src/tools/Makefile.gnuhost

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/gcc/dist/gcc/genattrtab.c
diff -u src/external/gpl3/gcc/dist/gcc/genattrtab.c:1.1.1.3 src/external/gpl3/gcc/dist/gcc/genattrtab.c:1.1.1.3.8.1
--- src/external/gpl3/gcc/dist/gcc/genattrtab.c:1.1.1.3	Sun Jan 24 06:06:07 2016
+++ src/external/gpl3/gcc/dist/gcc/genattrtab.c	Wed Apr 18 14:01:16 2018
@@ -3424,7 +3424,10 @@ find_attrs_to_cache (rtx exp, bool creat
 
 /* Given a piece of RTX, print a C expression to test its truth value to OUTF.
We use AND and IOR both for logical and bit-wise operations, so
-   interpret them as logical unless they are inside a comparison expression.  */
+   interpret them as logical unless they are inside a comparison expression.
+
+   An outermost pair of parentheses is emitted around this C expression unless
+   EMIT_PARENS is false.  */
 
 /* Interpret AND/IOR as bit-wise operations instead of logical.  */
 #define FLG_BITWISE		1
@@ -3440,16 +3443,16 @@ find_attrs_to_cache (rtx exp, bool creat
 #define FLG_OUTSIDE_AND		8
 
 static unsigned int
-write_test_expr (FILE *outf, rtx exp, unsigned int attrs_cached, int flags)
+write_test_expr (FILE *outf, rtx exp, unsigned int attrs_cached, int flags,
+		 bool emit_parens = true)
 {
   int comparison_operator = 0;
   RTX_CODE code;
   struct attr_desc *attr;
 
-  /* In order not to worry about operator precedence, surround our part of
- the expression with parentheses.  */
+  if (emit_parens)
+fprintf (outf, "(");
 
-  fprintf (outf, "(");
   code = GET_CODE (exp);
   switch (code)
 {
@@ -3583,8 +3586,18 @@ write_test_expr (FILE *outf, rtx exp, un
 	  || GET_CODE (XEXP (exp, 1)) == EQ_ATTR
 	  || (GET_CODE (XEXP (exp, 1)) == NOT
 		  && GET_CODE (XEXP (XEXP (exp, 1), 0)) == EQ_ATTR)))
-	attrs_cached
-	  = write_test_expr (outf, XEXP (exp, 1), attrs_cached, flags);
+	{
+	  bool need_parens = true;
+
+	  /* No need to emit parentheses around the right-hand operand if we are
+	 continuing a chain of && or || (or & or |).  */
+	  if (GET_CODE (XEXP (exp, 1)) == code)
+	need_parens = false;
+
+	  attrs_cached
+	= write_test_expr (outf, XEXP (exp, 1), attrs_cached, flags,
+			   need_parens);
+	}
   else
 	write_test_expr (outf, XEXP (exp, 1), attrs_cached,
 			 flags | comparison_operator);
@@ -3802,7 +3815,9 @@ write_test_expr (FILE *outf, rtx exp, un
 	 GET_RTX_NAME (code));
 }
 
-  fprintf (outf, ")");
+  if (emit_parens)
+fprintf (outf, ")");
+
   return attrs_cached;
 }
 

Index: src/tools/Makefile.gnuhost
diff -u src/tools/Makefile.gnuhost:1.44.8.1 src/tools/Makefile.gnuhost:1.44.8.2
--- src/tools/Makefile.gnuhost:1.44.8.1	Sat Apr 14 10:44:56 2018
+++ src/tools/Makefile.gnuhost	Wed Apr 18 14:01:16 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.gnuhost,v 1.44.8.1 2018/04/14 10:44:56 martin Exp $
+#	$NetBSD: Makefile.gnuhost,v 1.44.8.2 2018/04/18 14:01:16 martin Exp $
 #
 # Rules used when building a GNU host package.  Expects MODULE to be set.
 #
@@ -18,13 +18,11 @@
 .include 
 
 # Disable use of pre-compiled headers on Darwin.
-# GCC build exceeds the macOS clang default bracket nesting level of 256.
 BUILD_OSTYPE!= uname -s
 .if ${BUILD_OSTYPE} == "Darwin"
 HOST_CFLAGS+=-O2 -no-cpp-precomp
-HOST_CFLAGS+=-O2 

CVS commit: [netbsd-8] src/crypto/external/bsd/openssl

2018-04-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 18 13:51:36 UTC 2018

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/asn1 [netbsd-8]: asn1.h
asn1_err.c tasn_dec.c
src/crypto/external/bsd/openssl/dist/crypto/bn/asm [netbsd-8]:
rsaz-avx2.pl x86_64-mont5.pl
src/crypto/external/bsd/openssl/dist/crypto/rsa [netbsd-8]: rsa_gen.c
src/crypto/external/bsd/openssl/dist/crypto/x509v3 [netbsd-8]:
v3_addr.c
src/crypto/external/bsd/openssl/dist/ssl [netbsd-8]: ssl.h
src/crypto/external/bsd/openssl/lib/libcrypto/arch/x86_64 [netbsd-8]:
rsaz-avx2.S x86_64-mont5.S

Log Message:
Apply upstream fixes for CVE-2017-3735, CVE-2017-3736, CVE-2017-3737,
CVE-2017-3738, CVE-2018-0737, CVE-2018-0739. Regen.

Requested by christos in ticket #774.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.6.1 \
src/crypto/external/bsd/openssl/dist/crypto/asn1/asn1.h
cvs rdiff -u -r1.1.1.7 -r1.1.1.7.8.1 \
src/crypto/external/bsd/openssl/dist/crypto/asn1/asn1_err.c
cvs rdiff -u -r1.6 -r1.6.6.1 \
src/crypto/external/bsd/openssl/dist/crypto/asn1/tasn_dec.c
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.8.1 \
src/crypto/external/bsd/openssl/dist/crypto/bn/asm/rsaz-avx2.pl
cvs rdiff -u -r1.1.1.7 -r1.1.1.7.4.1 \
src/crypto/external/bsd/openssl/dist/crypto/bn/asm/x86_64-mont5.pl
cvs rdiff -u -r1.1.1.6 -r1.1.1.6.4.1 \
src/crypto/external/bsd/openssl/dist/crypto/rsa/rsa_gen.c
cvs rdiff -u -r1.5 -r1.5.6.1 \
src/crypto/external/bsd/openssl/dist/crypto/x509v3/v3_addr.c
cvs rdiff -u -r1.16 -r1.16.6.1 src/crypto/external/bsd/openssl/dist/ssl/ssl.h
cvs rdiff -u -r1.2 -r1.2.6.1 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/x86_64/rsaz-avx2.S
cvs rdiff -u -r1.5 -r1.5.4.1 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/x86_64/x86_64-mont5.S

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

Modified files:

Index: src/crypto/external/bsd/openssl/dist/crypto/asn1/asn1.h
diff -u src/crypto/external/bsd/openssl/dist/crypto/asn1/asn1.h:1.2 src/crypto/external/bsd/openssl/dist/crypto/asn1/asn1.h:1.2.6.1
--- src/crypto/external/bsd/openssl/dist/crypto/asn1/asn1.h:1.2	Fri Oct 14 16:23:18 2016
+++ src/crypto/external/bsd/openssl/dist/crypto/asn1/asn1.h	Wed Apr 18 13:51:35 2018
@@ -1365,6 +1365,7 @@ void ERR_load_ASN1_strings(void);
 # define ASN1_R_MSTRING_NOT_UNIVERSAL 139
 # define ASN1_R_MSTRING_WRONG_TAG 140
 # define ASN1_R_NESTED_ASN1_STRING197
+# define ASN1_R_NESTED_TOO_DEEP   219
 # define ASN1_R_NON_HEX_CHARACTERS141
 # define ASN1_R_NOT_ASCII_FORMAT  190
 # define ASN1_R_NOT_ENOUGH_DATA   142

Index: src/crypto/external/bsd/openssl/dist/crypto/asn1/asn1_err.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/asn1/asn1_err.c:1.1.1.7 src/crypto/external/bsd/openssl/dist/crypto/asn1/asn1_err.c:1.1.1.7.8.1
--- src/crypto/external/bsd/openssl/dist/crypto/asn1/asn1_err.c:1.1.1.7	Mon Mar 23 08:28:38 2015
+++ src/crypto/external/bsd/openssl/dist/crypto/asn1/asn1_err.c	Wed Apr 18 13:51:35 2018
@@ -1,6 +1,6 @@
 /* crypto/asn1/asn1_err.c */
 /* 
- * Copyright (c) 1999-2014 The OpenSSL Project.  All rights reserved.
+ * Copyright (c) 1999-2018 The OpenSSL Project.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -279,6 +279,7 @@ static ERR_STRING_DATA ASN1_str_reasons[
 {ERR_REASON(ASN1_R_MSTRING_NOT_UNIVERSAL), "mstring not universal"},
 {ERR_REASON(ASN1_R_MSTRING_WRONG_TAG), "mstring wrong tag"},
 {ERR_REASON(ASN1_R_NESTED_ASN1_STRING), "nested asn1 string"},
+{ERR_REASON(ASN1_R_NESTED_TOO_DEEP), "nested too deep"},
 {ERR_REASON(ASN1_R_NON_HEX_CHARACTERS), "non hex characters"},
 {ERR_REASON(ASN1_R_NOT_ASCII_FORMAT), "not ascii format"},
 {ERR_REASON(ASN1_R_NOT_ENOUGH_DATA), "not enough data"},

Index: src/crypto/external/bsd/openssl/dist/crypto/asn1/tasn_dec.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/asn1/tasn_dec.c:1.6 src/crypto/external/bsd/openssl/dist/crypto/asn1/tasn_dec.c:1.6.6.1
--- src/crypto/external/bsd/openssl/dist/crypto/asn1/tasn_dec.c:1.6	Fri Oct 14 16:23:18 2016
+++ src/crypto/external/bsd/openssl/dist/crypto/asn1/tasn_dec.c	Wed Apr 18 13:51:35 2018
@@ -65,6 +65,14 @@
 #include 
 #include 
 
+/*
+ * Constructed types with a recursive definition (such as can be found in PKCS7)
+ * could eventually exceed the stack given malicious input with excessive
+ * recursion. Therefore we limit the stack depth. This is the maximum number of
+ * recursive invocations of asn1_item_embed_d2i().
+ */
+#define ASN1_MAX_CONSTRUCTED_NEST 30
+
 static 

CVS commit: [netbsd-8] src/doc

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 16:03:37 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Ticket #773


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.185 -r1.1.2.186 src/doc/CHANGES-8.0

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.185 src/doc/CHANGES-8.0:1.1.2.186
--- src/doc/CHANGES-8.0:1.1.2.185	Tue Apr 17 08:37:22 2018
+++ src/doc/CHANGES-8.0	Tue Apr 17 16:03:36 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.185 2018/04/17 08:37:22 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.186 2018/04/17 16:03:36 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -13013,3 +13013,10 @@ sys/miscfs/procfs/procfs_subr.c			1.112
 	of VOP_REVOKE().
 	[hannken, ticket #772]
 
+sys/netipsec/ipsec_mbuf.c			1.23,1.24
+
+	Don't assume M_PKTHDR is set only on the first mbuf of the chain.
+	Fix a pretty bad mistake (IPsec DoS).
+	[maxv, ticket #773]
+
+



CVS commit: [netbsd-8] src/sys/netipsec

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 15:06:20 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-8]: ipsec_mbuf.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #773):

sys/netipsec/ipsec_mbuf.c: revision 1.23,1.24

Don't assume M_PKTHDR is set only on the first mbuf of the chain. It
should, but it looks like there are several places that can put M_PKTHDR
on secondary mbufs (PR/53189), so drop this assumption right now to
prevent further bugs.

The check is replaced by (m1 != m), which is equivalent to the previous
code: we want to modify m->m_pkthdr.len only when 'm' was not passed in
m_adj().

Fix a pretty bad mistake, that has always been there.

m_adj(m1, -(m1->m_len - roff));
if (m1 != m)
m->m_pkthdr.len -= (m1->m_len - roff);

This is wrong: m_adj will modify m1->m_len, so we're using a wrong value
when manually adjusting m->m_pkthdr.len.

Because of that, it is possible to exploit the attack I described in
uipc_mbuf.c::rev1.182. The exploit is more complicated, but works 100%
reliably.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.16.2.1 src/sys/netipsec/ipsec_mbuf.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/netipsec/ipsec_mbuf.c
diff -u src/sys/netipsec/ipsec_mbuf.c:1.16 src/sys/netipsec/ipsec_mbuf.c:1.16.2.1
--- src/sys/netipsec/ipsec_mbuf.c:1.16	Fri May 19 04:34:09 2017
+++ src/sys/netipsec/ipsec_mbuf.c	Tue Apr 17 15:06:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec_mbuf.c,v 1.16 2017/05/19 04:34:09 ozaki-r Exp $	*/
+/*	$NetBSD: ipsec_mbuf.c,v 1.16.2.1 2018/04/17 15:06:20 martin Exp $	*/
 /*-
  * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
  * All rights reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec_mbuf.c,v 1.16 2017/05/19 04:34:09 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_mbuf.c,v 1.16.2.1 2018/04/17 15:06:20 martin Exp $");
 
 /*
  * IPsec-specific mbuf routines.
@@ -403,10 +403,11 @@ m_striphdr(struct mbuf *m, int skip, int
 		/* The header was at the beginning of the mbuf */
 		IPSEC_STATINC(IPSEC_STAT_INPUT_FRONT);
 		m_adj(m1, hlen);
-		if ((m1->m_flags & M_PKTHDR) == 0)
+		if (m1 != m)
 			m->m_pkthdr.len -= hlen;
 	} else if (roff + hlen >= m1->m_len) {
 		struct mbuf *mo;
+		int adjlen;
 
 		/*
 		 * Part or all of the header is at the end of this mbuf,
@@ -415,11 +416,13 @@ m_striphdr(struct mbuf *m, int skip, int
 		 */
 		IPSEC_STATINC(IPSEC_STAT_INPUT_END);
 		if (roff + hlen > m1->m_len) {
+			adjlen = roff + hlen - m1->m_len;
+
 			/* Adjust the next mbuf by the remainder */
-			m_adj(m1->m_next, roff + hlen - m1->m_len);
+			m_adj(m1->m_next, adjlen);
 
 			/* The second mbuf is guaranteed not to have a pkthdr... */
-			m->m_pkthdr.len -= (roff + hlen - m1->m_len);
+			m->m_pkthdr.len -= adjlen;
 		}
 
 		/* Now, let's unlink the mbuf chain for a second...*/
@@ -427,9 +430,10 @@ m_striphdr(struct mbuf *m, int skip, int
 		m1->m_next = NULL;
 
 		/* ...and trim the end of the first part of the chain...sick */
-		m_adj(m1, -(m1->m_len - roff));
-		if ((m1->m_flags & M_PKTHDR) == 0)
-			m->m_pkthdr.len -= (m1->m_len - roff);
+		adjlen = m1->m_len - roff;
+		m_adj(m1, -adjlen);
+		if (m1 != m)
+			m->m_pkthdr.len -= adjlen;
 
 		/* Finally, let's relink */
 		m1->m_next = mo;



CVS commit: [netbsd-8] src/doc

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:37:23 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Tickets #768 - #772


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.184 -r1.1.2.185 src/doc/CHANGES-8.0

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.184 src/doc/CHANGES-8.0:1.1.2.185
--- src/doc/CHANGES-8.0:1.1.2.184	Mon Apr 16 14:36:29 2018
+++ src/doc/CHANGES-8.0	Tue Apr 17 08:37:22 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.184 2018/04/16 14:36:29 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.185 2018/04/17 08:37:22 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -12984,3 +12984,32 @@ sys/arch/x86/pci/if_vmx.c			1.23,1.24
 	bytes interface statistics.
 	[nonaka, ticket #767]
 
+external/gpl2/gmake/dist/glob/glob.c		1.4
+
+	Fix build of gmake (in tools) on new GLIBC systems.
+	[kamil, ticket #768]
+
+sys/dev/pci/ixgbe/ixgbe.c			1.147
+sys/dev/pci/ixgbe/ixgbe.h			1.42
+
+	Fix panic when changing the work queue size while there is traffic.
+	[knakahara, ticket #769]
+
+sys/kern/uipc_mbuf.c1.190
+
+	m_pkthdr_remove(): if the mbuf is shared leave M_PKTHDR
+	in place.
+	[maxv, ticket #770]
+
+sys/kern/subr_pserialize.c			1.11
+
+	Function pserialize_perform() usually succeeds after two cross calls
+	so defer kpause() to iterations three and above.
+	[hannken, ticket #771]
+
+sys/miscfs/procfs/procfs_subr.c			1.112
+
+	Change procfs_revoke_vnodes() to use vrecycle()/vgone() instead
+	of VOP_REVOKE().
+	[hannken, ticket #772]
+



CVS commit: [netbsd-8] src/sys/miscfs/procfs

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:36:11 UTC 2018

Modified Files:
src/sys/miscfs/procfs [netbsd-8]: procfs_subr.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #772):

sys/miscfs/procfs/procfs_subr.c: revision 1.112

Change procfs_revoke_vnodes() to use vrecycle()/vgone() instead
of VOP_REVOKE().

Gets rid of a bunch of suspensions on /proc as vrecycle() will
succeed most time and we suspend at most once per call.


To generate a diff of this commit:
cvs rdiff -u -r1.108.6.1 -r1.108.6.2 src/sys/miscfs/procfs/procfs_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/miscfs/procfs/procfs_subr.c
diff -u src/sys/miscfs/procfs/procfs_subr.c:1.108.6.1 src/sys/miscfs/procfs/procfs_subr.c:1.108.6.2
--- src/sys/miscfs/procfs/procfs_subr.c:1.108.6.1	Thu Apr 12 13:42:48 2018
+++ src/sys/miscfs/procfs/procfs_subr.c	Tue Apr 17 08:36:11 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_subr.c,v 1.108.6.1 2018/04/12 13:42:48 martin Exp $	*/
+/*	$NetBSD: procfs_subr.c,v 1.108.6.2 2018/04/17 08:36:11 martin Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -102,13 +102,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_subr.c,v 1.108.6.1 2018/04/12 13:42:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_subr.c,v 1.108.6.2 2018/04/17 08:36:11 martin Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -363,6 +364,8 @@ procfs_revoke_selector(void *arg, struct
 void
 procfs_revoke_vnodes(struct proc *p, void *arg)
 {
+	int error;
+	bool suspended;
 	struct vnode *vp;
 	struct vnode_iterator *marker;
 	struct mount *mp = (struct mount *)arg;
@@ -370,14 +373,29 @@ procfs_revoke_vnodes(struct proc *p, voi
 	if (!(p->p_flag & PK_SUGID))
 		return;
 
+	suspended = false;
 	vfs_vnode_iterator_init(mp, );
 
 	while ((vp = vfs_vnode_iterator_next(marker,
 	procfs_revoke_selector, p)) != NULL) {
-		VOP_REVOKE(vp, REVOKEALL);
-		vrele(vp);
+		if (vrecycle(vp))
+			continue;
+		/* Vnode is busy, we have to suspend the mount for vgone(). */
+		while (! suspended) {
+			error = vfs_suspend(mp, 0);
+			if (error == 0) {
+suspended = true;
+			} else if (error != EINTR && error != ERESTART) {
+KASSERT(error == EOPNOTSUPP);
+break;
+			}
+		}
+		vgone(vp);
 	}
 
+	if (suspended)
+		vfs_resume(mp);
+
 	vfs_vnode_iterator_destroy(marker);
 }
 



CVS commit: [netbsd-8] src/sys/kern

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:34:36 UTC 2018

Modified Files:
src/sys/kern [netbsd-8]: subr_pserialize.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #771):

sys/kern/subr_pserialize.c: revision 1.11

Function pserialize_perform() usually succeeds after two cross calls
so defer kpause() to iterations three and above.

Speeds up VOP_REVOKE() on /proc/XXX/status by a factor of ~12.

Ok: core@


To generate a diff of this commit:
cvs rdiff -u -r1.8.10.2 -r1.8.10.3 src/sys/kern/subr_pserialize.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/kern/subr_pserialize.c
diff -u src/sys/kern/subr_pserialize.c:1.8.10.2 src/sys/kern/subr_pserialize.c:1.8.10.3
--- src/sys/kern/subr_pserialize.c:1.8.10.2	Mon Jan 22 12:30:20 2018
+++ src/sys/kern/subr_pserialize.c	Tue Apr 17 08:34:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pserialize.c,v 1.8.10.2 2018/01/22 12:30:20 martin Exp $	*/
+/*	$NetBSD: subr_pserialize.c,v 1.8.10.3 2018/04/17 08:34:36 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_pserialize.c,v 1.8.10.2 2018/01/22 12:30:20 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pserialize.c,v 1.8.10.3 2018/04/17 08:34:36 martin Exp $");
 
 #include 
 
@@ -146,6 +146,7 @@ pserialize_destroy(pserialize_t psz)
 void
 pserialize_perform(pserialize_t psz)
 {
+	int n;
 	uint64_t xc;
 
 	KASSERT(!cpu_intr_p());
@@ -176,6 +177,7 @@ pserialize_perform(pserialize_t psz)
 	TAILQ_INSERT_TAIL(_queue0, psz, psz_chain);
 	psz_work_todo++;
 
+	n = 0;
 	do {
 		mutex_spin_exit(_lock);
 
@@ -183,9 +185,10 @@ pserialize_perform(pserialize_t psz)
 		 * Force some context switch activity on every CPU, as
 		 * the system may not be busy.  Pause to not flood.
 		 */
+		if (n++ > 1)
+			kpause("psrlz", false, 1, NULL);
 		xc = xc_broadcast(XC_HIGHPRI, (xcfunc_t)nullop, NULL, NULL);
 		xc_wait(xc);
-		kpause("psrlz", false, 1, NULL);
 
 		mutex_spin_enter(_lock);
 	} while (!kcpuset_iszero(psz->psz_target));



CVS commit: [netbsd-8] src/sys/kern

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:24:02 UTC 2018

Modified Files:
src/sys/kern [netbsd-8]: uipc_mbuf.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #770):

sys/kern/uipc_mbuf.c: revision 1.190

If the mbuf is shared leave M_PKTHDR in place. Given where this function
is called from that's not supposed to happen, but I'm growing unconfident
about our mbuf code.


To generate a diff of this commit:
cvs rdiff -u -r1.172.6.2 -r1.172.6.3 src/sys/kern/uipc_mbuf.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/kern/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.172.6.2 src/sys/kern/uipc_mbuf.c:1.172.6.3
--- src/sys/kern/uipc_mbuf.c:1.172.6.2	Thu Apr  5 14:33:41 2018
+++ src/sys/kern/uipc_mbuf.c	Tue Apr 17 08:24:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.172.6.2 2018/04/05 14:33:41 martin Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.172.6.3 2018/04/17 08:24:01 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.172.6.2 2018/04/05 14:33:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.172.6.3 2018/04/17 08:24:01 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -460,6 +460,11 @@ m_pkthdr_remove(struct mbuf *m)
 {
 	KASSERT(m->m_flags & M_PKTHDR);
 
+	if (M_READONLY(m)) {
+		/* Nothing we can do. */
+		return;
+	}
+
 	m_tag_delete_chain(m, NULL);
 	m->m_flags &= ~M_PKTHDR;
 	memset(>m_pkthdr, 0, sizeof(m->m_pkthdr));



CVS commit: [netbsd-8] src/sys/dev/pci/ixgbe

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:20:06 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ixgbe.c ixgbe.h

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #769):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.147
sys/dev/pci/ixgbe/ixgbe.h: revision 1.42

Fix panic when "sysctl -w hw.ixg0.txrx_workqueue=[01]" while there is traffic.
The operation is not supported, however causing panic is problem.


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.17 -r1.88.2.18 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.10 -r1.24.6.11 src/sys/dev/pci/ixgbe/ixgbe.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/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.17 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.18
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.17	Sat Apr 14 10:25:11 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Apr 17 08:20:06 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.17 2018/04/14 10:25:11 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.18 2018/04/17 08:20:06 martin Exp $ */
 
 /**
 
@@ -2487,7 +2487,7 @@ static inline void
 ixgbe_sched_handle_que(struct adapter *adapter, struct ix_queue *que)
 {
 
-	if (adapter->txrx_use_workqueue) {
+	if(que->txrx_use_workqueue) {
 		/*
 		 * adapter->que_wq is bound to each CPU instead of
 		 * each NIC queue to reduce workqueue kthread. As we
@@ -2531,6 +2531,12 @@ ixgbe_msix_que(void *arg)
 	ixgbe_disable_queue(adapter, que->msix);
 	++que->irqs.ev_count;
 
+	/*
+	 * Don't change "que->txrx_use_workqueue" from this point to avoid
+	 * flip-flopping softint/workqueue mode in one deferred processing.
+	 */
+	que->txrx_use_workqueue = adapter->txrx_use_workqueue;
+
 #ifdef __NetBSD__
 	/* Don't run ixgbe_rxeof in interrupt context */
 	more = true;
@@ -3174,6 +3180,16 @@ ixgbe_add_device_sysctls(struct adapter 
 	CTL_EOL) != 0)
 		aprint_error_dev(dev, "could not create sysctl\n");
 
+	/*
+	 * If each "que->txrx_use_workqueue" is changed in sysctl handler,
+	 * it causesflip-flopping softint/workqueue mode in one deferred
+	 * processing. Therefore, preempt_disable()/preempt_enable() are
+	 * required in ixgbe_sched_handle_que() to avoid
+	 * KASSERT(ixgbe_sched_handle_que()) in softint_schedule().
+	 * I think changing "que->txrx_use_workqueue" in interrupt handler
+	 * is lighter than doing preempt_disable()/preempt_enable() in every
+	 * ixgbe_sched_handle_que().
+	 */
 	adapter->txrx_use_workqueue = ixgbe_txrx_workqueue;
 	if (sysctl_createv(log, 0, , , CTLFLAG_READWRITE,
 	CTLTYPE_BOOL, "txrx_workqueue", SYSCTL_DESCR("Use workqueue for packet processing"),
@@ -4798,6 +4814,11 @@ ixgbe_legacy_irq(void *arg)
 	}
 
 	if ((ifp->if_flags & IFF_RUNNING) != 0) {
+		/*
+		 * The same as ixgbe_msix_que() about "que->txrx_use_workqueue".
+		 */
+		que->txrx_use_workqueue = adapter->txrx_use_workqueue;
+
 #ifdef __NetBSD__
 		/* Don't run ixgbe_rxeof in interrupt context */
 		more = true;

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.24.6.10 src/sys/dev/pci/ixgbe/ixgbe.h:1.24.6.11
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.24.6.10	Sat Apr 14 10:25:12 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Tue Apr 17 08:20:06 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.24.6.10 2018/04/14 10:25:12 martin Exp $ */
+/* $NetBSD: ixgbe.h,v 1.24.6.11 2018/04/17 08:20:06 martin Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -346,6 +346,7 @@ struct ix_queue {
 	 * > 0 : this queue is disabled
 	 *   the value is ixgbe_disable_queue() called count
 	 */
+	bool txrx_use_workqueue;
 };
 
 /*



CVS commit: [netbsd-8] src/external/gpl2/gmake/dist/glob

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:04:34 UTC 2018

Modified Files:
src/external/gpl2/gmake/dist/glob [netbsd-8]: glob.c

Log Message:
Pull up following revision(s) (requested by kamil in ticket #768):

external/gpl2/gmake/dist/glob/glob.c: revision 1.4

According to:
https://sourceforge.net/p/predef/wiki/Libraries/

The macro used for old glibc is __GNU_LIBRARY__ and the new one is
__GLIBC__.

Try to fix linux compilation by detecting both.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.8.1 src/external/gpl2/gmake/dist/glob/glob.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/gpl2/gmake/dist/glob/glob.c
diff -u src/external/gpl2/gmake/dist/glob/glob.c:1.1.1.1 src/external/gpl2/gmake/dist/glob/glob.c:1.1.1.1.8.1
--- src/external/gpl2/gmake/dist/glob/glob.c:1.1.1.1	Mon Aug 18 06:47:54 2014
+++ src/external/gpl2/gmake/dist/glob/glob.c	Tue Apr 17 08:04:34 2018
@@ -207,7 +207,7 @@ my_realloc (p, n)
 #endif /* __GNU_LIBRARY__ */
 
 
-#if !defined __alloca && !defined __GNU_LIBRARY__
+#if !defined __alloca && !(defined __GNU_LIBRARY__ || defined __GLIBC__)
 
 # ifdef	__GNUC__
 #  undef alloca



CVS commit: [netbsd-8] src/doc

2018-04-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr 16 14:36:29 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Tickets #758 - #767


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.183 -r1.1.2.184 src/doc/CHANGES-8.0

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.183 src/doc/CHANGES-8.0:1.1.2.184
--- src/doc/CHANGES-8.0:1.1.2.183	Sat Apr 14 11:28:12 2018
+++ src/doc/CHANGES-8.0	Mon Apr 16 14:36:29 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.183 2018/04/14 11:28:12 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.184 2018/04/16 14:36:29 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -12909,3 +12909,78 @@ external/gpl3/gcc.old/usr.bin/gcc/arch/p
 	to make  work.
 	[mrg, ticket #757]
 
+sys/kern/kern_proc.c1.212
+
+	Don't set errno ESRCH for empty result of KINFO_PROC[2].
+	[kamil, ticket #758]
+
+sys/dev/auconv.c1.31 (patch)
+sys/dev/audio.c	1.367,1.369,1.376 (patch),
+		1.377 (patch), 1.378,
+		1.382 (patch),1.383 (patch),
+		1.384,1.388,1.389,
+		1.395,1.396 (patch), 1.397,
+		1.403,1.451,1.452
+sys/dev/audiovar.h1.59 (patch),1.60 (patch)
+sys/dev/aurateconv.c1.21 (patch)
+
+	Various audio fixes.
+	[nat, ticket #759]
+
+sys/dev/isa/gus.c1.112
+
+	Add padding and fix locking.
+	[nat, ticket #760]
+
+sys/dev/isa/sbdsp.c1.137
+
+	Add AUDIO_ENCODING_SLINEAR to supported encodings.
+	This allows sb, sbpro & sb16 to configure with 8-bit precision.
+	[nat, ticket #761]
+
+sys/arch/x86/pci/if_vmx.c			1.22
+
+	Fix calculation of interface statistics counter.
+	[nonaka, ticket #762]
+
+sys/dev/pci/ichsmb.c1.57
+sys/dev/pci/pucdata.c1.101
+
+	ichsmb(4), puc(4): Add Intel 300 series support.
+	[msaitoh, ticket #763]
+
+share/man/man4/wm.41.40
+sys/dev/pci/if_wm.c1.567-1.572
+sys/dev/pci/if_wmreg.h1.106,1.107
+sys/dev/pci/if_wmvar.h1.38
+
+	- Fix a bug that ICH8 B0 stepping might misconfigure the chip from the
+	  NVM image.			  
+	- On PCH_SPT and newer, FLASH access should be done by 32bit. Fix it.
+	- Sync wm_nvm_valid_bank_detect_ich8lan() with FreeBSD r287467.
+	- If the extended configuration size in the EXTCNFSIZE register is 0,
+	  don't continue because it's not required.
+	- Add PCH_CNP support (I219 with Intel 300 series chipset).
+	- Enable all I219 devices by default.
+	- I354 uses an external PHY, so don't use wm_set_eee_i350().
+	  The function is only for internal PHY. 
+	- Sort registers and lowercase hexadecimal value. No functional change.
+	[msaitoh, ticket #764]
+
+sys/dev/isa/wbsio.c1.22
+
+	Handle watchdog attachment in the wbsio_rescan() function, where we
+	take care of other children.
+	[yamaguchi, ticket #765]
+
+sys/netipsec/key.c1.250
+
+	Removed the unnecessary order check of key_lookup_sa.
+	[yamaguchi, ticket #766]
+
+sys/arch/x86/pci/if_vmx.c			1.23,1.24
+
+	vmx(4): handled SIOCZIFDATA. Fix computation of received
+	bytes interface statistics.
+	[nonaka, ticket #767]
+



CVS commit: [netbsd-8] src/sys/arch/x86/pci

2018-04-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr 16 14:34:43 UTC 2018

Modified Files:
src/sys/arch/x86/pci [netbsd-8]: if_vmx.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #767):

sys/arch/x86/pci/if_vmx.c: revision 1.23,1.24

vmx(4): handled SIOCZIFDATA.

vmx(4): compute if_ibytes using rxq->vxrxq_stats.vmrxs_ibytes.


To generate a diff of this commit:
cvs rdiff -u -r1.19.6.3 -r1.19.6.4 src/sys/arch/x86/pci/if_vmx.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/pci/if_vmx.c
diff -u src/sys/arch/x86/pci/if_vmx.c:1.19.6.3 src/sys/arch/x86/pci/if_vmx.c:1.19.6.4
--- src/sys/arch/x86/pci/if_vmx.c:1.19.6.3	Mon Apr 16 14:18:53 2018
+++ src/sys/arch/x86/pci/if_vmx.c	Mon Apr 16 14:34:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vmx.c,v 1.19.6.3 2018/04/16 14:18:53 martin Exp $	*/
+/*	$NetBSD: if_vmx.c,v 1.19.6.4 2018/04/16 14:34:43 martin Exp $	*/
 /*	$OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.19.6.3 2018/04/16 14:18:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.19.6.4 2018/04/16 14:34:43 martin Exp $");
 
 #include 
 #include 
@@ -2892,27 +2892,40 @@ vmxnet3_ioctl(struct ifnet *ifp, u_long 
 		splx(s);
 		break;
 	case SIOCGIFDATA:
+	case SIOCZIFDATA:
 		ifp->if_ipackets = 0;
+		ifp->if_ibytes = 0;
 		ifp->if_iqdrops = 0;
 		ifp->if_ierrors = 0;
 		for (int i = 0; i < sc->vmx_nrxqueues; i++) {
-			ifp->if_ipackets +=
-			sc->vmx_rxq[i].vxrxq_stats.vmrxs_ipackets;
-			ifp->if_iqdrops +=
-			sc->vmx_rxq[i].vxrxq_stats.vmrxs_iqdrops;
-			ifp->if_ierrors +=
-			sc->vmx_rxq[i].vxrxq_stats.vmrxs_ierrors;
+			struct vmxnet3_rxqueue *rxq = >vmx_rxq[i];
+
+			VMXNET3_RXQ_LOCK(rxq);
+			ifp->if_ipackets += rxq->vxrxq_stats.vmrxs_ipackets;
+			ifp->if_ibytes += rxq->vxrxq_stats.vmrxs_ibytes;
+			ifp->if_iqdrops += rxq->vxrxq_stats.vmrxs_iqdrops;
+			ifp->if_ierrors += rxq->vxrxq_stats.vmrxs_ierrors;
+			if (cmd == SIOCZIFDATA) {
+memset(>vxrxq_stats, 0,
+sizeof(rxq->vxrxq_stats));
+			}
+			VMXNET3_RXQ_UNLOCK(rxq);
 		}
 		ifp->if_opackets = 0;
 		ifp->if_obytes = 0;
 		ifp->if_omcasts = 0;
 		for (int i = 0; i < sc->vmx_ntxqueues; i++) {
-			ifp->if_opackets +=
-			sc->vmx_txq[i].vxtxq_stats.vmtxs_opackets;
-			ifp->if_obytes +=
-			sc->vmx_txq[i].vxtxq_stats.vmtxs_obytes;
-			ifp->if_omcasts +=
-			sc->vmx_txq[i].vxtxq_stats.vmtxs_omcasts;
+			struct vmxnet3_txqueue *txq = >vmx_txq[i];
+
+			VMXNET3_TXQ_LOCK(txq);
+			ifp->if_opackets += txq->vxtxq_stats.vmtxs_opackets;
+			ifp->if_obytes += txq->vxtxq_stats.vmtxs_obytes;
+			ifp->if_omcasts += txq->vxtxq_stats.vmtxs_omcasts;
+			if (cmd == SIOCZIFDATA) {
+memset(>vxtxq_stats, 0,
+sizeof(txq->vxtxq_stats));
+			}
+			VMXNET3_TXQ_UNLOCK(txq);
 		}
 		/* FALLTHROUGH */
 	default:



CVS commit: [netbsd-8] src/sys/netipsec

2018-04-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr 16 14:31:44 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-8]: key.c

Log Message:
Pull up following revision(s) (requested by yamaguchi in ticket #766):

sys/netipsec/key.c: revision 1.250

Removed the unnecessary order check of key_lookup_sa

key_prefered_oldsa flag can change the sa to use if an sah
has multiple sav. However the multiple saves whose protocol
is ah, esp, or tcp cannot exist because their duplications
are checked by the spi value. Although the multiple saves
can exist in the case of ipcomp, the values using in the
post processing are same between the saves.

For those reasons, it is no need to select an sav by its
lifetime.

In addition, FreeBSD has already remove this.
reviewed by ozaki-r@n.o, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.163.2.7 -r1.163.2.8 src/sys/netipsec/key.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/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.163.2.7 src/sys/netipsec/key.c:1.163.2.8
--- src/sys/netipsec/key.c:1.163.2.7	Wed Mar  7 13:46:41 2018
+++ src/sys/netipsec/key.c	Mon Apr 16 14:31:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.163.2.7 2018/03/07 13:46:41 martin Exp $	*/
+/*	$NetBSD: key.c,v 1.163.2.8 2018/04/16 14:31:44 martin Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.163.2.7 2018/03/07 13:46:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.163.2.8 2018/04/16 14:31:44 martin Exp $");
 
 /*
  * This code is referred to RFC 2367
@@ -427,6 +427,12 @@ static const u_int saorder_state_any[] =
 	_i < __arraycount(saorder_state_any) ?		\
 	(s) = saorder_state_any[_i], true : false;		\
 	_i++)
+#define SASTATE_USABLE_FOREACH(s)\
+	for (int _i = 0;	\
+	_i < __arraycount(saorder_state_valid_prefer_new) ?	\
+	(s) = saorder_state_valid_prefer_new[_i],		\
+	true : false;	\
+	_i++)
 
 static const int minsize[] = {
 	sizeof(struct sadb_msg),	/* SADB_EXT_RESERVED */
@@ -1199,9 +1205,8 @@ key_lookup_sa(
 {
 	struct secashead *sah;
 	struct secasvar *sav;
-	u_int stateidx, state;
-	const u_int *saorder_state_valid;
-	int arraysize, chkport;
+	u_int state;
+	int chkport;
 	int s;
 
 	int must_check_spi = 1;
@@ -1245,18 +1250,10 @@ key_lookup_sa(
 	 * IPsec tunnel packet is received.  But ESP tunnel mode is
 	 * encrypted so we can't check internal IP header.
 	 */
-	if (key_prefered_oldsa) {
-		saorder_state_valid = saorder_state_valid_prefer_old;
-		arraysize = _ARRAYLEN(saorder_state_valid_prefer_old);
-	} else {
-		saorder_state_valid = saorder_state_valid_prefer_new;
-		arraysize = _ARRAYLEN(saorder_state_valid_prefer_new);
-	}
 	s = pserialize_read_enter();
 	SAHLIST_READER_FOREACH(sah) {
 		/* search valid state */
-		for (stateidx = 0; stateidx < arraysize; stateidx++) {
-			state = saorder_state_valid[stateidx];
+		SASTATE_USABLE_FOREACH(state) {
 			SAVLIST_READER_FOREACH(sav, sah, state) {
 KEYDEBUG_PRINTF(KEYDEBUG_MATCH,
 "try match spi %#x, %#x\n",



CVS commit: [netbsd-8] src/sys/dev/isa

2018-04-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr 16 14:28:24 UTC 2018

Modified Files:
src/sys/dev/isa [netbsd-8]: wbsio.c

Log Message:
Pull up following revision(s) (requested by yamaguchi in ticket #765):

sys/dev/isa/wbsio.c: revision 1.22

Handle watchdog attachment in the wbsio_rescan() function, where we
take care of other children.

ok knakahara@ and yamaguchi@


To generate a diff of this commit:
cvs rdiff -u -r1.10.10.2 -r1.10.10.3 src/sys/dev/isa/wbsio.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/isa/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.10.10.2 src/sys/dev/isa/wbsio.c:1.10.10.3
--- src/sys/dev/isa/wbsio.c:1.10.10.2	Mon Feb 19 18:50:35 2018
+++ src/sys/dev/isa/wbsio.c	Mon Apr 16 14:28:23 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: wbsio.c,v 1.10.10.2 2018/02/19 18:50:35 snj Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.10.10.3 2018/04/16 14:28:23 martin Exp $	*/
 /*	$OpenBSD: wbsio.c,v 1.10 2015/03/14 03:38:47 jsg Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis 
@@ -284,8 +284,7 @@ wbsio_attach(device_t parent, device_t s
 	if (!pmf_device_register(self, wbsio_suspend, NULL))
 		aprint_error_dev(self, "couldn't establish power handler\n");
 
-	wbsio_wdog_attach(self);
-
+	sc->sc_smw_valid = false;
 	wbsio_rescan(self, "wbsio", NULL);
 
 #if NGPIO > 0
@@ -336,6 +335,8 @@ wbsio_rescan(device_t self, const char *
 #endif
 	config_search_loc(wbsio_search, self, ifattr, locators, NULL);
 
+	wbsio_wdog_attach(self);
+
 	return 0;
 }
 
@@ -799,7 +800,8 @@ wbsio_wdog_attach(device_t self)
 	uint16_t devid;
 	uint8_t rev;
 
-	sc->sc_smw_valid = false;
+	if (sc->sc_smw_valid)
+		return;		/* watchdog already attached */
 
 	wbsio_conf_enable(>sc_conf_lock, sc->sc_iot, sc->sc_ioh);
 	devid = wbsio_conf_read(sc->sc_iot, sc->sc_ioh, WBSIO_ID);



CVS commit: [netbsd-8] src

2018-04-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr 16 14:25:49 UTC 2018

Modified Files:
src/share/man/man4 [netbsd-8]: wm.4
src/sys/dev/pci [netbsd-8]: if_wm.c if_wmreg.h if_wmvar.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #764):

sys/dev/pci/if_wm.c: revision 1.567
sys/dev/pci/if_wm.c: revision 1.568
sys/dev/pci/if_wm.c: revision 1.569
sys/dev/pci/if_wmvar.h: revision 1.38
sys/dev/pci/if_wm.c: revision 1.570
sys/dev/pci/if_wm.c: revision 1.571
sys/dev/pci/if_wm.c: revision 1.572
share/man/man4/wm.4: revision 1.40
sys/dev/pci/if_wmreg.h: revision 1.106
sys/dev/pci/if_wmreg.h: revision 1.107

SW PHY Config Enable bit for ICH8 B0 stepping is not bit 1 but bit 0.

 No binary change:
- Sort registers.
- Lowercase hexadecimal value.

 On PCH_SPT (and newer), FLASH access should be done by 32bit.
Especially for ICH_FLASH_HSFCTL register, it's located at 0x0006, so
it should be accessed via ICH_FLASH_HSFSTS(0x0004) and use shift or mask.

 Our PCH_SPT part of wm_nvm_valid_bank_detect_ich8lan() was based on
FreeBSD r287467. After that, they reverted it and committed the different
code in r287762. r287762's bank detect code didn't work for us because our wm
dirver had a problem in flash access. The problem was fixed in if_wm.c rev.
1.567, so we can use the new way now.

 If the extended configration size in the EXTCNFSIZE register is 0, don't
continue.
 Add PCH_CNP support (I219 with Intel 300 series chipset).
It's required more test, so it's disabled by default.

 Enable I219.

 I354 uses an external PHY, so don't use wm_set_eee_i350().


To generate a diff of this commit:
cvs rdiff -u -r1.36.4.1 -r1.36.4.2 src/share/man/man4/wm.4
cvs rdiff -u -r1.508.4.16 -r1.508.4.17 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.98.6.3 -r1.98.6.4 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.33.6.1 -r1.33.6.2 src/sys/dev/pci/if_wmvar.h

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

Modified files:

Index: src/share/man/man4/wm.4
diff -u src/share/man/man4/wm.4:1.36.4.1 src/share/man/man4/wm.4:1.36.4.2
--- src/share/man/man4/wm.4:1.36.4.1	Mon Feb  5 15:07:30 2018
+++ src/share/man/man4/wm.4	Mon Apr 16 14:25:49 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: wm.4,v 1.36.4.1 2018/02/05 15:07:30 martin Exp $
+.\"	$NetBSD: wm.4,v 1.36.4.2 2018/04/16 14:25:49 martin Exp $
 .\"
 .\" Copyright 2002, 2003 Wasabi Systems, Inc.
 .\" All rights reserved.
@@ -33,7 +33,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd January 18, 2018
+.Dd April 13, 2018
 .Dt WM 4
 .Os
 .Sh NAME
@@ -152,6 +152,8 @@ Intel I210 Ethernet (Copper, Fiber)
 Intel I211 Ethernet
 .It
 Intel I217 and I218 Ethernet
+.It
+Intel I219 Ethernet (with Intel [123]00 series chipset)
 .El
 .Pp
 In addition to Intel's own

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.508.4.16 src/sys/dev/pci/if_wm.c:1.508.4.17
--- src/sys/dev/pci/if_wm.c:1.508.4.16	Tue Mar  6 10:59:04 2018
+++ src/sys/dev/pci/if_wm.c	Mon Apr 16 14:25:49 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.16 2018/03/06 10:59:04 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.17 2018/04/16 14:25:49 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.16 2018/03/06 10:59:04 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.17 2018/04/16 14:25:49 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1485,7 +1485,6 @@ static const struct wm_product {
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I218_LM3,
 	  "I218 LM Ethernet Connection",
 	  WM_T_PCH_LPT,		WMP_F_COPPER },
-#if 0
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V,
 	  "I219 V Ethernet Connection",
 	  WM_T_PCH_SPT,		WMP_F_COPPER },
@@ -1513,7 +1512,18 @@ static const struct wm_product {
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM5,
 	  "I219 LM Ethernet Connection",
 	  WM_T_PCH_SPT,		WMP_F_COPPER },
-#endif
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V6,
+	  "I219 V Ethernet Connection",
+	  WM_T_PCH_CNP,		WMP_F_COPPER },
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V7,
+	  "I219 V Ethernet Connection",
+	  WM_T_PCH_CNP,		WMP_F_COPPER },
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM6,
+	  "I219 LM Ethernet Connection",
+	  WM_T_PCH_CNP,		WMP_F_COPPER },
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM7,
+	  "I219 LM Ethernet Connection",
+	  WM_T_PCH_CNP,		WMP_F_COPPER },
 	{ 0,			0,
 	  NULL,
 	  0,			0 },
@@ -1986,7 +1996,8 @@ alloc_retry:
 		&& (sc->sc_type != WM_T_PCH)
 		&& (sc->sc_type != WM_T_PCH2)
 		&& (sc->sc_type != WM_T_PCH_LPT)
-		&& (sc->sc_type != WM_T_PCH_SPT)) {
+		&& (sc->sc_type != WM_T_PCH_SPT)
+		&& (sc->sc_type != WM_T_PCH_CNP)) {
 			/* ICH* and PCH* have no PCIe capability 

CVS commit: [netbsd-8] src/sys/dev/pci

2018-04-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr 16 14:21:48 UTC 2018

Modified Files:
src/sys/dev/pci [netbsd-8]: ichsmb.c pucdata.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #763):

sys/dev/pci/ichsmb.c: revision 1.57
sys/dev/pci/pucdata.c: revision 1.101

Add 300 series chipset support.


To generate a diff of this commit:
cvs rdiff -u -r1.50.6.1 -r1.50.6.2 src/sys/dev/pci/ichsmb.c
cvs rdiff -u -r1.99.8.1 -r1.99.8.2 src/sys/dev/pci/pucdata.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/ichsmb.c
diff -u src/sys/dev/pci/ichsmb.c:1.50.6.1 src/sys/dev/pci/ichsmb.c:1.50.6.2
--- src/sys/dev/pci/ichsmb.c:1.50.6.1	Mon Feb 26 00:05:04 2018
+++ src/sys/dev/pci/ichsmb.c	Mon Apr 16 14:21:48 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichsmb.c,v 1.50.6.1 2018/02/26 00:05:04 snj Exp $	*/
+/*	$NetBSD: ichsmb.c,v 1.50.6.2 2018/04/16 14:21:48 martin Exp $	*/
 /*	$OpenBSD: ichiic.c,v 1.18 2007/05/03 09:36:26 dlg Exp $	*/
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.50.6.1 2018/02/26 00:05:04 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.50.6.2 2018/04/16 14:21:48 martin Exp $");
 
 #include 
 #include 
@@ -117,6 +117,7 @@ ichsmb_match(device_t parent, cfdata_t m
 		case PCI_PRODUCT_INTEL_100SERIES_SMB:
 		case PCI_PRODUCT_INTEL_100SERIES_LP_SMB:
 		case PCI_PRODUCT_INTEL_2HS_SMB:
+		case PCI_PRODUCT_INTEL_3HS_SMB:
 		case PCI_PRODUCT_INTEL_CORE4G_M_SMB:
 		case PCI_PRODUCT_INTEL_CORE5G_M_SMB:
 		case PCI_PRODUCT_INTEL_BAYTRAIL_PCU_SMB:

Index: src/sys/dev/pci/pucdata.c
diff -u src/sys/dev/pci/pucdata.c:1.99.8.1 src/sys/dev/pci/pucdata.c:1.99.8.2
--- src/sys/dev/pci/pucdata.c:1.99.8.1	Sat Jan 13 05:36:03 2018
+++ src/sys/dev/pci/pucdata.c	Mon Apr 16 14:21:48 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pucdata.c,v 1.99.8.1 2018/01/13 05:36:03 snj Exp $	*/
+/*	$NetBSD: pucdata.c,v 1.99.8.2 2018/04/16 14:21:48 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 1999 Christopher G. Demetriou.  All rights reserved.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.99.8.1 2018/01/13 05:36:03 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.99.8.2 2018/04/16 14:21:48 martin Exp $");
 
 #include 
 #include 
@@ -1936,7 +1936,16 @@ const struct puc_device_description puc_
 		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x00, COM_FREQ },
 	},
 	},
-	
+
+	/* Intel 300 Series KT */
+	{   "Intel 300 Series KT",
+	{	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_3HS_KT, 0, 0 },
+	{	0x,	0x,	0,	0	},
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x00, COM_FREQ },
+	},
+	},
+
 	/* Intel C600/X79 Series KT */
 	{   "Intel C600/X79 Series KT",
 	{	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_KT, 0, 0 },



CVS commit: [netbsd-8] src/sys/arch/x86/pci

2018-04-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr 16 14:18:53 UTC 2018

Modified Files:
src/sys/arch/x86/pci [netbsd-8]: if_vmx.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #762):

sys/arch/x86/pci/if_vmx.c: revision 1.22

vmx(4): Fix calculation of interface statistics counter.


To generate a diff of this commit:
cvs rdiff -u -r1.19.6.2 -r1.19.6.3 src/sys/arch/x86/pci/if_vmx.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/pci/if_vmx.c
diff -u src/sys/arch/x86/pci/if_vmx.c:1.19.6.2 src/sys/arch/x86/pci/if_vmx.c:1.19.6.3
--- src/sys/arch/x86/pci/if_vmx.c:1.19.6.2	Mon Feb 26 01:01:41 2018
+++ src/sys/arch/x86/pci/if_vmx.c	Mon Apr 16 14:18:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vmx.c,v 1.19.6.2 2018/02/26 01:01:41 snj Exp $	*/
+/*	$NetBSD: if_vmx.c,v 1.19.6.3 2018/04/16 14:18:53 martin Exp $	*/
 /*	$OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.19.6.2 2018/02/26 01:01:41 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.19.6.3 2018/04/16 14:18:53 martin Exp $");
 
 #include 
 #include 
@@ -2892,20 +2892,26 @@ vmxnet3_ioctl(struct ifnet *ifp, u_long 
 		splx(s);
 		break;
 	case SIOCGIFDATA:
+		ifp->if_ipackets = 0;
+		ifp->if_iqdrops = 0;
+		ifp->if_ierrors = 0;
 		for (int i = 0; i < sc->vmx_nrxqueues; i++) {
-			ifp->if_ipackets =
+			ifp->if_ipackets +=
 			sc->vmx_rxq[i].vxrxq_stats.vmrxs_ipackets;
-			ifp->if_iqdrops =
+			ifp->if_iqdrops +=
 			sc->vmx_rxq[i].vxrxq_stats.vmrxs_iqdrops;
-			ifp->if_ierrors =
+			ifp->if_ierrors +=
 			sc->vmx_rxq[i].vxrxq_stats.vmrxs_ierrors;
 		}
+		ifp->if_opackets = 0;
+		ifp->if_obytes = 0;
+		ifp->if_omcasts = 0;
 		for (int i = 0; i < sc->vmx_ntxqueues; i++) {
-			ifp->if_opackets =
+			ifp->if_opackets +=
 			sc->vmx_txq[i].vxtxq_stats.vmtxs_opackets;
-			ifp->if_obytes =
+			ifp->if_obytes +=
 			sc->vmx_txq[i].vxtxq_stats.vmtxs_obytes;
-			ifp->if_omcasts =
+			ifp->if_omcasts +=
 			sc->vmx_txq[i].vxtxq_stats.vmtxs_omcasts;
 		}
 		/* FALLTHROUGH */



CVS commit: [netbsd-8] src/sys/dev/isa

2018-04-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr 16 14:16:53 UTC 2018

Modified Files:
src/sys/dev/isa [netbsd-8]: sbdsp.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #761):

sys/dev/isa/sbdsp.c: revision 1.137

Add AUDIO_ENCODING_SLINEAR to supported encodings.  This allows sb, sbpro
& sb16 to configure with 8-bit precision.

Tested in games/mame with a 486DX emulation.


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.136.10.1 src/sys/dev/isa/sbdsp.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/isa/sbdsp.c
diff -u src/sys/dev/isa/sbdsp.c:1.136 src/sys/dev/isa/sbdsp.c:1.136.10.1
--- src/sys/dev/isa/sbdsp.c:1.136	Mon Jul 11 11:31:50 2016
+++ src/sys/dev/isa/sbdsp.c	Mon Apr 16 14:16:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sbdsp.c,v 1.136 2016/07/11 11:31:50 msaitoh Exp $	*/
+/*	$NetBSD: sbdsp.c,v 1.136.10.1 2018/04/16 14:16:53 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2008 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sbdsp.c,v 1.136 2016/07/11 11:31:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbdsp.c,v 1.136.10.1 2018/04/16 14:16:53 martin Exp $");
 
 #include "midi.h"
 #include "mpu.h"
@@ -640,6 +640,7 @@ sbdsp_set_params(
 	swcode = swap_bytes;
 }
 /* fall into */
+			case AUDIO_ENCODING_SLINEAR:
 			case AUDIO_ENCODING_SLINEAR_LE:
 bmode = SB_BMODE_SIGNED;
 break;
@@ -682,6 +683,7 @@ sbdsp_set_params(
 bmode |= SB_BMODE_STEREO;
 		} else if (m->model == SB_JAZZ && m->precision == 16) {
 			switch (p->encoding) {
+			case AUDIO_ENCODING_SLINEAR:
 			case AUDIO_ENCODING_SLINEAR_LE:
 break;
 			case AUDIO_ENCODING_ULINEAR_LE:
@@ -716,6 +718,7 @@ sbdsp_set_params(
 			switch (p->encoding) {
 			case AUDIO_ENCODING_SLINEAR_BE:
 			case AUDIO_ENCODING_SLINEAR_LE:
+			case AUDIO_ENCODING_SLINEAR:
 hw.encoding = AUDIO_ENCODING_ULINEAR_LE;
 swcode = change_sign8;
 break;



CVS commit: [netbsd-8] src/sys/dev/isa

2018-04-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr 16 14:15:03 UTC 2018

Modified Files:
src/sys/dev/isa [netbsd-8]: gus.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #760):

sys/dev/isa/gus.c: revision 1.112

Add padding to gus.c so fields match up when it ts cast to a ad1848_isa
softc for the allocation of hw ring buffers.

Locking fixes as gus KASSERTS / uses the codec locks.

Ok christos@.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.111.6.1 src/sys/dev/isa/gus.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/isa/gus.c
diff -u src/sys/dev/isa/gus.c:1.111 src/sys/dev/isa/gus.c:1.111.6.1
--- src/sys/dev/isa/gus.c:1.111	Wed Feb  1 19:10:33 2017
+++ src/sys/dev/isa/gus.c	Mon Apr 16 14:15:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: gus.c,v 1.111 2017/02/01 19:10:33 jakllsch Exp $	*/
+/*	$NetBSD: gus.c,v 1.111.6.1 2018/04/16 14:15:03 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1999, 2008 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gus.c,v 1.111 2017/02/01 19:10:33 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gus.c,v 1.111.6.1 2018/04/16 14:15:03 martin Exp $");
 
 #include 
 #include 
@@ -175,15 +175,16 @@ struct gus_softc {
 	kmutex_t sc_intr_lock;
 	void *sc_ih;			/* interrupt vector */
 	bus_space_tag_t sc_iot;		/* tag */
-	isa_chipset_tag_t sc_ic;	/* ISA chipset info */
 	bus_space_handle_t sc_ioh1;	/* handle */
 	bus_space_handle_t sc_ioh2;	/* handle */
 	bus_space_handle_t sc_ioh3;	/* ICS2101 handle */
 	bus_space_handle_t sc_ioh4;	/* MIDI handle */
+	char padding[20];
 
 	callout_t sc_dmaout_ch;
 
-	int sc_iobase;			/* I/O base address */
+	isa_chipset_tag_t sc_ic;	/* ISA chipset info */
+	char padding1[4];
 	int sc_irq;			/* IRQ used */
 	int sc_playdrq;			/* DMA channel for play */
 	bus_size_t sc_play_maxsize;	/* DMA size for play */
@@ -257,6 +258,7 @@ struct gus_softc {
 		struct ics2101_softc sc_mixer_u;
 		struct ad1848_isa_softc sc_codec_u;
 	} u;
+	int sc_iobase;			/* I/O base address */
 #define sc_mixer u.sc_mixer_u
 #define sc_codec u.sc_codec_u
 };
@@ -818,9 +820,12 @@ gusattach(device_t parent, device_t self
 	const struct audio_hw_if *hwif;
 
 	sc = device_private(self);
+	sc->sc_dev = self;
 	ia = aux;
 	callout_init(>sc_dmaout_ch, CALLOUT_MPSAFE);
 	ad1848_init_locks(>sc_codec.sc_ad1848, IPL_AUDIO);
+	sc->sc_lock = sc->sc_codec.sc_ad1848.sc_lock;
+	sc->sc_intr_lock = sc->sc_codec.sc_ad1848.sc_intr_lock;
 
 	sc->sc_iot = iot = ia->ia_iot;
 	sc->sc_ic = ia->ia_ic;
@@ -859,7 +864,7 @@ gusattach(device_t parent, device_t self
 
 	delay(500);
 
-	mutex_spin_enter(>sc_intr_lock);
+	mutex_spin_enter(>sc_codec.sc_ad1848.sc_intr_lock);
 
 	c = bus_space_read_1(iot, ioh3, GUS_BOARD_REV);
 	if (c != 0xff)
@@ -872,7 +877,7 @@ gusattach(device_t parent, device_t self
 
 	gusreset(sc, GUS_MAX_VOICES); /* initialize all voices */
 	gusreset(sc, GUS_MIN_VOICES); /* then set to just the ones we use */
-	mutex_spin_exit(>sc_intr_lock);
+	mutex_spin_exit(>sc_codec.sc_ad1848.sc_intr_lock);
 
 	/*
 	 * Setup the IRQ and DRQ lines in software, using values from
@@ -2311,7 +2316,7 @@ gus_set_params(void *addr,int setmode, i
 		return EINVAL;
 	}
 
-	mutex_spin_enter(>sc_intr_lock);
+	mutex_spin_enter(>sc_codec.sc_ad1848.sc_intr_lock);
 
 	if (p->precision == 8) {
 		sc->sc_voc[GUS_VOICE_LEFT].voccntl &= ~GUSMASK_DATA_SIZE16;
@@ -2332,7 +2337,7 @@ gus_set_params(void *addr,int setmode, i
 	if (setmode & AUMODE_PLAY)
 		sc->sc_orate = p->sample_rate;
 
-	mutex_spin_exit(>sc_intr_lock);
+	mutex_spin_exit(>sc_codec.sc_ad1848.sc_intr_lock);
 
 	hw = *p;
 	/* clear req_size before setting a filter to avoid confliction



CVS commit: [netbsd-8] src/sys/dev

2018-04-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr 16 14:11:44 UTC 2018

Modified Files:
src/sys/dev [netbsd-8]: auconv.c audio.c audiovar.h aurateconv.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #759):

sys/dev/audio.c: revision 1.367
sys/dev/audio.c: revision 1.369
sys/dev/audio.c: revision 1.376 (patch)
sys/dev/audio.c: revision 1.377 (patch)
sys/dev/audio.c: revision 1.378
sys/dev/audio.c: revision 1.382 (patch)
sys/dev/audio.c: revision 1.383 (patch)
sys/dev/audio.c: revision 1.384
sys/dev/audio.c: revision 1.388
sys/dev/audio.c: revision 1.389
sys/dev/audio.c: revision 1.395
sys/dev/audio.c: revision 1.396 (patch)
sys/dev/audio.c: revision 1.397
sys/dev/audio.c: revision 1.403
sys/dev/audio.c: revision 1.451
sys/dev/audio.c: revision 1.452
sys/dev/audiovar.h: revision 1.59 (patch)
sys/dev/aurateconv.c: revision 1.21 (patch)
sys/dev/auconv.c: revision 1.31 (patch)
sys/dev/audiovar.h: revision 1.60 (patch)

Broadcast all conditional variables if in being deactivated so no readers
or writers get stuck.

Fix a panic caused by opening pad(4)'s mixer before the corresponding
audio device has attached.

Addresses PR kern/52424.

Improve audio_set_vchan_defaults().
- Correct confused input/output parameters.
- Remove sc->{sc_channels, sc_precision, sc_frequency}.  They are
  the same as sc->sc_vchan_params.{channels, precision, sample_rate}.
The input parameter of audio_set_vchan_defaults() is now only
sc->sc_vchan_params.

Fix PR kern/52437

const-ify.

0 -> NULL in audioattach()

"bits" sounds better than "name" for argument name.
I feel expression (name / NBBY) a little strange.

The audio module will now compile with WARNS=5.

Typo in debug message.

Remove a duplicated line.

Add missing initialization of sc_rfilters in audioattach().

Remove dead codes.

sc->sc_opens never changes in this loop and as a result of
previous sc_audiochan cleanup "sc_opens == 0" is the same as
"sc_audiochan is empty".

Clean up audio_allocbufs().

As a result of sc_audiochan cleanup, it is easy to access sc_hwvc.

Clean up audio_open().

As a result of sc_audiochan cleanup, this loop is the same as last + 1.
hw_if->set_params is mandatory, so it will never be NULL.

CID-1427745: kill possible buffer overflows.

Revert my wrong r1.380 and add a comment instead.


To generate a diff of this commit:
cvs rdiff -u -r1.26.2.4 -r1.26.2.5 src/sys/dev/auconv.c
cvs rdiff -u -r1.357.2.10 -r1.357.2.11 src/sys/dev/audio.c
cvs rdiff -u -r1.55.2.5 -r1.55.2.6 src/sys/dev/audiovar.h
cvs rdiff -u -r1.19.42.1 -r1.19.42.2 src/sys/dev/aurateconv.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/auconv.c
diff -u src/sys/dev/auconv.c:1.26.2.4 src/sys/dev/auconv.c:1.26.2.5
--- src/sys/dev/auconv.c:1.26.2.4	Tue Jan  9 19:35:03 2018
+++ src/sys/dev/auconv.c	Mon Apr 16 14:11:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: auconv.c,v 1.26.2.4 2018/01/09 19:35:03 snj Exp $	*/
+/*	$NetBSD: auconv.c,v 1.26.2.5 2018/04/16 14:11:44 martin Exp $	*/
 
 /*
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.26.2.4 2018/01/09 19:35:03 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.26.2.5 2018/04/16 14:11:44 martin Exp $");
 
 #include 
 #include 
@@ -2115,7 +2115,7 @@ auconv_rateconv_check_rates(const struct
 			if (formats[i].frequency[1] > maxrate)
 maxrate = formats[i].frequency[1];
 		} else {
-			for (j = 0; j < formats[i].frequency_type; j++) {
+			for (j = 0; j < (int)formats[i].frequency_type; j++) {
 if (formats[i].frequency[j] < minrate)
 	minrate = formats[i].frequency[j];
 if (formats[i].frequency[j] > maxrate)

Index: src/sys/dev/audio.c
diff -u src/sys/dev/audio.c:1.357.2.10 src/sys/dev/audio.c:1.357.2.11
--- src/sys/dev/audio.c:1.357.2.10	Mon Jan 15 00:08:55 2018
+++ src/sys/dev/audio.c	Mon Apr 16 14:11:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.357.2.10 2018/01/15 00:08:55 snj Exp $	*/
+/*	$NetBSD: audio.c,v 1.357.2.11 2018/04/16 14:11:44 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.357.2.10 2018/01/15 00:08:55 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.357.2.11 2018/04/16 14:11:44 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -209,7 +209,7 @@ int	audiodebug = AUDIO_DEBUG;
 
 #define PREFILL_BLOCKS	3	/* no. audioblocks required to start stream */
 #define ROUNDSIZE(x)	(x) &= -16	/* round to nice boundary */
-#define SPECIFIED(x)	((x) != ~0)
+#define SPECIFIED(x)	((int)(x) != ~0)
 #define SPECIFIED_CH(x)	((x) != (u_char)~0)
 
 /* #define AUDIO_PM_IDLE */
@@ -282,10 +282,10 @@ static void	

CVS commit: [netbsd-8] src/sys/kern

2018-04-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr 16 13:31:33 UTC 2018

Modified Files:
src/sys/kern [netbsd-8]: kern_proc.c

Log Message:
Pull up following revision(s) (requested by kamil in ticket #758):

sys/kern/kern_proc.c: revision 1.212

Don't set errno ESRCH for empty result of KINFO_PROC[2]

Restore the previous behavior as it's prefered.
This new behavior was introduced in 1.210.
Code should check for length of the result.

Requested by 


To generate a diff of this commit:
cvs rdiff -u -r1.206.6.3 -r1.206.6.4 src/sys/kern/kern_proc.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/kern/kern_proc.c
diff -u src/sys/kern/kern_proc.c:1.206.6.3 src/sys/kern/kern_proc.c:1.206.6.4
--- src/sys/kern/kern_proc.c:1.206.6.3	Thu Apr 12 13:42:48 2018
+++ src/sys/kern/kern_proc.c	Mon Apr 16 13:31:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_proc.c,v 1.206.6.3 2018/04/12 13:42:48 martin Exp $	*/
+/*	$NetBSD: kern_proc.c,v 1.206.6.4 2018/04/16 13:31:33 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.206.6.3 2018/04/12 13:42:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.206.6.4 2018/04/16 13:31:33 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_kstack.h"
@@ -1834,10 +1834,6 @@ sysctl_doeproc(SYSCTLFN_ARGS)
 	mutex_exit(proc_lock);
 
 	if (where != NULL) {
-		if (needed == 0) {
-			error = ESRCH;
-			goto out;
-		}
 		*oldlenp = dp - where;
 		if (needed > *oldlenp) {
 			error = ENOMEM;



CVS commit: [netbsd-8] src/doc

2018-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr 14 11:28:13 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Ticket #757


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.182 -r1.1.2.183 src/doc/CHANGES-8.0

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.182 src/doc/CHANGES-8.0:1.1.2.183
--- src/doc/CHANGES-8.0:1.1.2.182	Sat Apr 14 11:07:16 2018
+++ src/doc/CHANGES-8.0	Sat Apr 14 11:28:12 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.182 2018/04/14 11:07:16 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.183 2018/04/14 11:28:12 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -12896,3 +12896,16 @@ sys/sys/ptrace.h1.61
 	Fix copy & pasto.
 	[kamil, ticket #756]
 
+external/gpl3/gcc.old/dist/gcc/config.gcc	1.9
+external/gpl3/gcc.old/lib/libstdc++-v3/arch/powerpc/c++config.h 1.8
+external/gpl3/gcc.old/lib/libstdc++-v3/arch/powerpc/gstdint.h 1.7
+external/gpl3/gcc.old/usr.bin/gcc/arch/powerpc/configargs.h 1.8
+external/gpl3/gcc.old/usr.bin/gcc/arch/powerpc/defs.mk 1.7
+external/gpl3/gcc.old/usr.bin/gcc/arch/powerpc/gtyp-input.list 1.6
+external/gpl3/gcc.old/usr.bin/gcc/arch/powerpc/tm.h 1.6
+	(with gcc.old -> gcc)
+
+	Apply the changes from GCC 6 / powerpc and netbsd-stdint.h
+	to make  work.
+	[mrg, ticket #757]
+



CVS commit: [netbsd-8] src/external/gpl3/gcc

2018-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr 14 11:26:46 UTC 2018

Modified Files:
src/external/gpl3/gcc/dist/gcc [netbsd-8]: config.gcc
src/external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc [netbsd-8]:
c++config.h gstdint.h
src/external/gpl3/gcc/usr.bin/gcc/arch/powerpc [netbsd-8]: configargs.h
defs.mk gtyp-input.list tm.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #757):

external/gpl3/gcc.old/lib/libstdc++-v3/arch/powerpc/gstdint.h: revision 
1.7
external/gpl3/gcc.old/usr.bin/gcc/arch/powerpc/configargs.h: revision 
1.8
external/gpl3/gcc.old/usr.bin/gcc/arch/powerpc/defs.mk: revision 1.7
external/gpl3/gcc.old/usr.bin/gcc/arch/powerpc/gtyp-input.list: 
revision 1.6
external/gpl3/gcc.old/lib/libstdc++-v3/arch/powerpc/c++config.h: 
revision 1.8
external/gpl3/gcc.old/usr.bin/gcc/arch/powerpc/tm.h: revision 1.6
external/gpl3/gcc.old/dist/gcc/config.gcc: revision 1.9
(with gcc.old -> gcc)

apply the changes from GCC 6 / powerpc and netbsd-stdint.h
to make  work.


To generate a diff of this commit:
cvs rdiff -u -r1.36.8.1 -r1.36.8.2 src/external/gpl3/gcc/dist/gcc/config.gcc
cvs rdiff -u -r1.19.6.3 -r1.19.6.4 \
src/external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc/c++config.h
cvs rdiff -u -r1.12.8.1 -r1.12.8.2 \
src/external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc/gstdint.h
cvs rdiff -u -r1.25.6.2 -r1.25.6.3 \
src/external/gpl3/gcc/usr.bin/gcc/arch/powerpc/configargs.h
cvs rdiff -u -r1.12.8.1 -r1.12.8.2 \
src/external/gpl3/gcc/usr.bin/gcc/arch/powerpc/defs.mk
cvs rdiff -u -r1.5 -r1.5.8.1 \
src/external/gpl3/gcc/usr.bin/gcc/arch/powerpc/gtyp-input.list \
src/external/gpl3/gcc/usr.bin/gcc/arch/powerpc/tm.h

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/gcc/dist/gcc/config.gcc
diff -u src/external/gpl3/gcc/dist/gcc/config.gcc:1.36.8.1 src/external/gpl3/gcc/dist/gcc/config.gcc:1.36.8.2
--- src/external/gpl3/gcc/dist/gcc/config.gcc:1.36.8.1	Thu Nov 23 11:01:44 2017
+++ src/external/gpl3/gcc/dist/gcc/config.gcc	Sat Apr 14 11:26:45 2018
@@ -2446,8 +2446,7 @@ powerpc*-*-freebsd*)
 	esac
 	;;
 powerpc*-*-netbsd*)
-	tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h"
-	tm_file="${tm_file} netbsd.h netbsd-elf.h"
+	tm_file="${tm_file} ${nbsd_tm_file} dbxelf.h elfos.h freebsd-spec.h"
 	case ${target} in
 	  powerpc64*)
 	tm_file="rs6000/biarch64.h ${tm_file} rs6000/sysv4.h rs6000/default64.h rs6000/netbsd64.h"

Index: src/external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc/c++config.h
diff -u src/external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc/c++config.h:1.19.6.3 src/external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc/c++config.h:1.19.6.4
--- src/external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc/c++config.h:1.19.6.3	Thu Nov 23 11:02:10 2017
+++ src/external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc/c++config.h	Sat Apr 14 11:26:45 2018
@@ -1,6 +1,6 @@
 /* This file is automatically generated.  DO NOT EDIT! */
 /* Generated from: NetBSD: mknative-gcc.old,v 1.5 2017/10/04 21:42:20 christos Exp  */
-/* Generated from: NetBSD: mknative.common,v 1.11 2014/02/17 21:39:43 christos Exp  */
+/* Generated from: NetBSD: mknative.common,v 1.15 2017/11/29 03:32:28 christos Exp  */
 
 // Predefined symbols and macros -*- C++ -*-
 
@@ -771,7 +771,7 @@ namespace std
 #define _GLIBCXX_HAVE_LDEXPF 1
 
 /* Define to 1 if you have the `ldexpl' function. */
-/* #undef _GLIBCXX_HAVE_LDEXPL */
+#define _GLIBCXX_HAVE_LDEXPL 1
 
 /* Define to 1 if you have the  header file. */
 /* #undef _GLIBCXX_HAVE_LIBINTL_H */

Index: src/external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc/gstdint.h
diff -u src/external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc/gstdint.h:1.12.8.1 src/external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc/gstdint.h:1.12.8.2
--- src/external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc/gstdint.h:1.12.8.1	Thu Nov 23 11:02:10 2017
+++ src/external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc/gstdint.h	Sat Apr 14 11:26:45 2018
@@ -1,8 +1,8 @@
 /* This file is automatically generated.  DO NOT EDIT! */
-/* Generated from: NetBSD: mknative-gcc,v 1.90 2017/10/04 21:42:20 christos Exp  */
-/* Generated from: NetBSD: mknative.common,v 1.11 2014/02/17 21:39:43 christos Exp  */
+/* Generated from: NetBSD: mknative-gcc,v 1.5 2017/10/04 21:42:20 christos Exp  */
+/* Generated from: NetBSD: mknative.common,v 1.15 2017/11/29 03:32:28 christos Exp  */
 
-/* generated for  powerpc--netbsd-gcc (NetBSD nb1 20171112) 5.5.0 */
+/* generated for  powerpc--netbsd-gcc (NetBSD nb2 20180327) 5.5.0 */
 
 #ifndef GCC_GENERATED_STDINT_H
 #define GCC_GENERATED_STDINT_H 1

Index: src/external/gpl3/gcc/usr.bin/gcc/arch/powerpc/configargs.h
diff -u src/external/gpl3/gcc/usr.bin/gcc/arch/powerpc/configargs.h:1.25.6.2 src/external/gpl3/gcc/usr.bin/gcc/arch/powerpc/configargs.h:1.25.6.3
--- 

CVS commit: [netbsd-8] src/doc

2018-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr 14 11:07:16 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Tickets #748 - #756


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.181 -r1.1.2.182 src/doc/CHANGES-8.0

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.181 src/doc/CHANGES-8.0:1.1.2.182
--- src/doc/CHANGES-8.0:1.1.2.181	Sat Apr 14 03:13:38 2018
+++ src/doc/CHANGES-8.0	Sat Apr 14 11:07:16 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.181 2018/04/14 03:13:38 snj Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.182 2018/04/14 11:07:16 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -12792,3 +12792,107 @@ distrib/sets/sets.subr1.184
 	work properly.
 	[nakayama, ticket #747]
 
+sys/arch/amd64/amd64/copy.S		1.29 (adapted, via patch)
+sys/arch/amd64/amd64/amd64_trap.S	1.16,1.19 (partial) (via patch)
+sys/arch/amd64/amd64/trap.c		1.102,1.106 (partial),1.110 (via patch)
+sys/arch/amd64/include/frameasm.h	1.22,1.24 (via patch)
+sys/arch/x86/x86/cpu.c			1.137 (via patch)
+sys/arch/x86/x86/patch.c		1.23,1.26 (partial) (via patch)
+
+	Backport of SMAP support.
+	[maxv, #748]
+
+sys/net/if.h	1.259
+sys/net/route.c	1.209
+sys/net/route.h	1.118
+sys/net/rtsock.c1.240
+
+	Resolve tangled lock dependencies in route.c
+	[ozaki-r, ticket #749]
+
+sys/dev/pci/ixgbe/if_bypass.c			1.4
+sys/dev/pci/ixgbe/if_fdir.c			1.2
+sys/dev/pci/ixgbe/if_sriov.c			1.3
+sys/dev/pci/ixgbe/ix_txrx.c			1.39
+sys/dev/pci/ixgbe/ixgbe.c			1.144-1.146
+sys/dev/pci/ixgbe/ixgbe.h			1.41
+sys/dev/pci/ixgbe/ixgbe_82598.c			1.11,1.12
+sys/dev/pci/ixgbe/ixgbe_82598.h			1.8
+sys/dev/pci/ixgbe/ixgbe_82599.c			1.18,1.19
+sys/dev/pci/ixgbe/ixgbe_82599.h			1.7
+sys/dev/pci/ixgbe/ixgbe_api.c			1.19,1.20
+sys/dev/pci/ixgbe/ixgbe_api.h			1.13
+sys/dev/pci/ixgbe/ixgbe_common.c		1.21,1.22
+sys/dev/pci/ixgbe/ixgbe_common.h		1.12,1.13
+sys/dev/pci/ixgbe/ixgbe_dcb.c			1.7,1.8
+sys/dev/pci/ixgbe/ixgbe_dcb.h			1.6
+sys/dev/pci/ixgbe/ixgbe_dcb_82598.c		1.6,1.7
+sys/dev/pci/ixgbe/ixgbe_dcb_82598.h		1.6
+sys/dev/pci/ixgbe/ixgbe_dcb_82599.c		1.6,1.7
+sys/dev/pci/ixgbe/ixgbe_dcb_82599.h		1.6
+sys/dev/pci/ixgbe/ixgbe_fdir.h			1.2
+sys/dev/pci/ixgbe/ixgbe_mbx.c			1.10
+sys/dev/pci/ixgbe/ixgbe_mbx.h			1.13
+sys/dev/pci/ixgbe/ixgbe_osdep.c			1.4
+sys/dev/pci/ixgbe/ixgbe_osdep.h			1.21
+sys/dev/pci/ixgbe/ixgbe_phy.c			1.16,1.17
+sys/dev/pci/ixgbe/ixgbe_phy.h			1.11
+sys/dev/pci/ixgbe/ixgbe_rss.h			1.4
+sys/dev/pci/ixgbe/ixgbe_sriov.h			1.3
+sys/dev/pci/ixgbe/ixgbe_type.h			1.33,1.34
+sys/dev/pci/ixgbe/ixgbe_vf.c			1.16,1.17
+sys/dev/pci/ixgbe/ixgbe_vf.h			1.13
+sys/dev/pci/ixgbe/ixgbe_x540.c			1.14,1.15
+sys/dev/pci/ixgbe/ixgbe_x540.h			1.8
+sys/dev/pci/ixgbe/ixgbe_x550.c			1.12
+sys/dev/pci/ixgbe/ixv.c1.91-1.93
+
+- Sync with FreeBSD r331224 except sfp_reinit and
+	   ixv_if_update_admin_status() stuff:
+  - Always schedule module interrupt in ixgbe_config_link() when
+a device is SFP+ based.
+  - Fix length of reading buffer when the command is Read Flash in
+ixgbe_host_interface_command().
+  - Some fixes unrelated to NetBSD.
+  - Style change.
+  - Update comment. 
+- Read sc_if_flags after taking core lock.
+	[msaitoh, ticket #750]
+
+sys/dev/pci/pcidevs1.1308,1.1327
+sys/dev/pci/pcidevs.h(regen)
+sys/dev/pci/pcidevs_data.h			(regen)
+
+	Add Nvidia GeForce 9400M as found in the late 2009 13"
+	MacBook (MacBook6,1).
+	Add new I219 devices (using with 300 series chipset).
+	[msaitoh, ticket #751]
+
+sys/net/if_vlan.c1.125
+
+	Fix the handling of the state returned from pfil_run_hooks().
+	[ryo, ticket #752]
+
+sys/arch/x86/include/bootinfo.h			1.29
+
+	x86: Increase BOOTINFO_MAXSIZE to 8Kib.
+	[nonaka, ticket #753]
+
+tools/Makefile.gnuhost1.45
+
+	GCC build exceeds the macOS clang default bracket nesting
+	level of 256. Work around with -fbracket-depth=512.
+	[maya, ticket #754]
+
+external/bsd/mdocml/dist/term_ascii.c		1.2
+external/bsd/mdocml/include/config.h		1.5
+
+	Re-enable wchar_t support.  mandoc(1) can now fall back to ascii
+	output if the locale is non-UTF-8.
+	[nakayama, ticket #755]
+
+sys/sys/ptrace.h1.61
+
+	Fix copy & pasto.
+	[kamil, ticket #756]
+



CVS commit: [netbsd-8] src/sys/sys

2018-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr 14 10:53:15 UTC 2018

Modified Files:
src/sys/sys [netbsd-8]: ptrace.h

Log Message:
Pull up following revision(s) (requested by kamil in ticket #756):

sys/sys/ptrace.h: revision 1.61

PR kern/52805: fix copy & pasto, from Onno van der Linden.


To generate a diff of this commit:
cvs rdiff -u -r1.60.6.2 -r1.60.6.3 src/sys/sys/ptrace.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/sys/ptrace.h
diff -u src/sys/sys/ptrace.h:1.60.6.2 src/sys/sys/ptrace.h:1.60.6.3
--- src/sys/sys/ptrace.h:1.60.6.2	Thu Apr 12 13:42:49 2018
+++ src/sys/sys/ptrace.h	Sat Apr 14 10:53:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.60.6.2 2018/04/12 13:42:49 martin Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.60.6.3 2018/04/14 10:53:14 martin Exp $	*/
 
 /*-
  * Copyright (c) 1984, 1993
@@ -172,7 +172,7 @@ struct fpreg;
 #endif
 
 #if defined(PT_GETDBREGS) || defined(PT_SETDBREGS)
-struct fpreg;
+struct dbreg;
 #ifndef process_dbreg32
 #define process_dbreg32 struct dbreg
 #endif



CVS commit: [netbsd-8] src/external/bsd/mdocml

2018-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr 14 10:50:49 UTC 2018

Modified Files:
src/external/bsd/mdocml/dist [netbsd-8]: term_ascii.c
src/external/bsd/mdocml/include [netbsd-8]: config.h

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #755):

external/bsd/mdocml/include/config.h: revision 1.5
external/bsd/mdocml/dist/term_ascii.c: revision 1.2

Re-enable wchar_t support.  mandoc(1) can now fall back to ascii
output if the locale is non-UTF-8 locale with the following change.

https://marc.info/?l=openbsd-cvs=152364416720474
Modified files:
usr.bin/mandoc : term_ascii.c
Log message:
Make sure that mandoc only goes into UTF-8 mode if the user really
selected UTF-8, not some other multibyte locale.  This obviously
makes no difference on OpenBSD but improves portability.
Issue reported by  via wiz@.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.11 -r1.1.1.11.4.1 \
src/external/bsd/mdocml/dist/term_ascii.c
cvs rdiff -u -r1.3.4.1 -r1.3.4.2 src/external/bsd/mdocml/include/config.h

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/mdocml/dist/term_ascii.c
diff -u src/external/bsd/mdocml/dist/term_ascii.c:1.1.1.11 src/external/bsd/mdocml/dist/term_ascii.c:1.1.1.11.4.1
--- src/external/bsd/mdocml/dist/term_ascii.c:1.1.1.11	Sat Mar 18 15:06:54 2017
+++ src/external/bsd/mdocml/dist/term_ascii.c	Sat Apr 14 10:50:49 2018
@@ -21,11 +21,13 @@
 
 #include 
 #if HAVE_WCHAR
+#include 
 #include 
 #endif
 #include 
 #include 
 #include 
+#include 
 #include 
 #if HAVE_WCHAR
 #include 
@@ -99,7 +101,17 @@ ascii_init(enum termenc enc, const struc
 		v = TERMENC_LOCALE == enc ?
 		setlocale(LC_CTYPE, "") :
 		setlocale(LC_CTYPE, UTF8_LOCALE);
-		if (NULL != v && MB_CUR_MAX > 1) {
+
+		/*
+		 * We only support UTF-8,
+		 * so revert to ASCII for anything else.
+		 */
+
+		if (v != NULL &&
+		strcmp(nl_langinfo(CODESET), "UTF-8") != 0)
+			v = setlocale(LC_CTYPE, "C");
+
+		if (v != NULL && MB_CUR_MAX > 1) {
 			p->enc = enc;
 			p->advance = locale_advance;
 			p->endline = locale_endline;

Index: src/external/bsd/mdocml/include/config.h
diff -u src/external/bsd/mdocml/include/config.h:1.3.4.1 src/external/bsd/mdocml/include/config.h:1.3.4.2
--- src/external/bsd/mdocml/include/config.h:1.3.4.1	Sun Mar 18 11:01:00 2018
+++ src/external/bsd/mdocml/include/config.h	Sat Apr 14 10:50:49 2018
@@ -41,7 +41,7 @@
 #define HAVE_STRTONUM 0
 #define HAVE_SYS_ENDIAN 1
 #define HAVE_VASPRINTF 1
-#define HAVE_WCHAR 0
+#define HAVE_WCHAR 1
 #define HAVE_OHASH 0
 
 #define BINM_APROPOS "apropos"



CVS commit: [netbsd-8] src/tools

2018-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr 14 10:44:56 UTC 2018

Modified Files:
src/tools [netbsd-8]: Makefile.gnuhost

Log Message:
Pull up following revision(s) (requested by maya in ticket #754):

tools/Makefile.gnuhost: revision 1.45

GCC build exceeds the macOS clang default bracket nesting level of 256.

Work around with -fbracket-depth=512.

>From potr in PR toolchain/53178.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.44.8.1 src/tools/Makefile.gnuhost

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

Modified files:

Index: src/tools/Makefile.gnuhost
diff -u src/tools/Makefile.gnuhost:1.44 src/tools/Makefile.gnuhost:1.44.8.1
--- src/tools/Makefile.gnuhost:1.44	Sat Jan 16 18:38:53 2016
+++ src/tools/Makefile.gnuhost	Sat Apr 14 10:44:56 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.gnuhost,v 1.44 2016/01/16 18:38:53 christos Exp $
+#	$NetBSD: Makefile.gnuhost,v 1.44.8.1 2018/04/14 10:44:56 martin Exp $
 #
 # Rules used when building a GNU host package.  Expects MODULE to be set.
 #
@@ -18,9 +18,12 @@
 .include 
 
 # Disable use of pre-compiled headers on Darwin.
+# GCC build exceeds the macOS clang default bracket nesting level of 256.
 BUILD_OSTYPE!= uname -s
 .if ${BUILD_OSTYPE} == "Darwin"
 HOST_CFLAGS+=-O2 -no-cpp-precomp
+HOST_CFLAGS+=-O2 -no-cpp-precomp -fbracket-depth=512
+HOST_CXXFLAGS+= -fbracket-depth=512
 .endif
 MAKE_PROGRAM?=	${MAKE}
 



CVS commit: [netbsd-8] src/sys/arch/x86/include

2018-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr 14 10:41:15 UTC 2018

Modified Files:
src/sys/arch/x86/include [netbsd-8]: bootinfo.h

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #753):

sys/arch/x86/include/bootinfo.h: revision 1.29

x86: Increase BOOTINFO_MAXSIZE to 8Kib.

Proposed on port-i386 and port-amd64 with no objections:
http://mail-index.netbsd.org/port-i386/2018/04/11/msg003692.html
http://mail-index.netbsd.org/port-amd64/2018/04/11/msg002697.html


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.26.6.1 src/sys/arch/x86/include/bootinfo.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/x86/include/bootinfo.h
diff -u src/sys/arch/x86/include/bootinfo.h:1.26 src/sys/arch/x86/include/bootinfo.h:1.26.6.1
--- src/sys/arch/x86/include/bootinfo.h:1.26	Tue Feb 14 13:25:22 2017
+++ src/sys/arch/x86/include/bootinfo.h	Sat Apr 14 10:41:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootinfo.h,v 1.26 2017/02/14 13:25:22 nonaka Exp $	*/
+/*	$NetBSD: bootinfo.h,v 1.26.6.1 2018/04/14 10:41:15 martin Exp $	*/
 
 /*
  * Copyright (c) 1997
@@ -244,7 +244,7 @@ struct btinfo_efimemmap {
 
 #ifdef _KERNEL
 
-#define BOOTINFO_MAXSIZE 4096
+#define BOOTINFO_MAXSIZE 8192
 
 #ifndef _LOCORE
 /*



CVS commit: [netbsd-8] src/sys/net

2018-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr 14 10:38:59 UTC 2018

Modified Files:
src/sys/net [netbsd-8]: if_vlan.c

Log Message:
Pull up following revision(s) (requested by ryo in ticket #752):

sys/net/if_vlan.c: revision 1.125

Fix the handling of the state returned from pfil_run_hooks().

pfil_run_hooks() invokes any registered packet filters on the packet
being handled.  It may return a (non-zero) errno, indicating that a
filter has decided that the packet should be discarded, and has freed
the mbuf.  While a non-error (0) return usually means that the packet
should be processed normally, a filter may still free the mbuf if the
packet is a fragment, and the filter is holding it for reassembly and
future evaluation.  Therefore, there must be separate tests for the
return value and for a possible discarded packet.  (See pfil(9).)

OK: christos, martin


To generate a diff of this commit:
cvs rdiff -u -r1.97.2.11 -r1.97.2.12 src/sys/net/if_vlan.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/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.97.2.11 src/sys/net/if_vlan.c:1.97.2.12
--- src/sys/net/if_vlan.c:1.97.2.11	Tue Jan  2 10:20:33 2018
+++ src/sys/net/if_vlan.c	Sat Apr 14 10:38:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.97.2.11 2018/01/02 10:20:33 snj Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.97.2.12 2018/04/14 10:38:59 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.97.2.11 2018/01/02 10:20:33 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.97.2.12 2018/04/14 10:38:59 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1419,12 +1419,10 @@ vlan_transmit(struct ifnet *ifp, struct 
 
 	bpf_mtap(ifp, m);
 
-	if (pfil_run_hooks(ifp->if_pfil, , ifp, PFIL_OUT) != 0) {
-		if (m != NULL)
-			m_freem(m);
-		error = 0;
+	if ((error = pfil_run_hooks(ifp->if_pfil, , ifp, PFIL_OUT)) != 0)
+		goto out;
+	if (m == NULL)
 		goto out;
-	}
 
 	/*
 	 * If the parent can insert the tag itself, just mark
@@ -1610,11 +1608,10 @@ vlan_input(struct ifnet *ifp, struct mbu
 	m_set_rcvif(m, >ifv_if);
 	ifv->ifv_if.if_ipackets++;
 
-	if (pfil_run_hooks(ifp->if_pfil, , ifp, PFIL_IN) != 0) {
-		if (m != NULL)
-			m_freem(m);
+	if (pfil_run_hooks(ifp->if_pfil, , ifp, PFIL_IN) != 0)
+		goto out;
+	if (m == NULL)
 		goto out;
-	}
 
 	m->m_flags &= ~M_PROMISC;
 	if_input(>ifv_if, m);



  1   2   3   4   5   6   7   8   9   10   >