CVS commit: src/sys/netipsec

2017-07-12 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jul 12 07:00:40 UTC 2017

Modified Files:
src/sys/netipsec: ipsec.c ipsec_input.c ipsec_output.c key.c
xform_ipip.c

Log Message:
Omit unnecessary NULL checks for sav->sah


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/netipsec/ipsec.c
cvs rdiff -u -r1.47 -r1.48 src/sys/netipsec/ipsec_input.c
cvs rdiff -u -r1.50 -r1.51 src/sys/netipsec/ipsec_output.c \
src/sys/netipsec/xform_ipip.c
cvs rdiff -u -r1.178 -r1.179 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/ipsec.c
diff -u src/sys/netipsec/ipsec.c:1.101 src/sys/netipsec/ipsec.c:1.102
--- src/sys/netipsec/ipsec.c:1.101	Fri Jul  7 01:37:34 2017
+++ src/sys/netipsec/ipsec.c	Wed Jul 12 07:00:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.c,v 1.101 2017/07/07 01:37:34 ozaki-r Exp $	*/
+/*	$NetBSD: ipsec.c,v 1.102 2017/07/12 07:00:40 ozaki-r Exp $	*/
 /*	$FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netipsec/ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $	*/
 /*	$KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.101 2017/07/07 01:37:34 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.102 2017/07/12 07:00:40 ozaki-r Exp $");
 
 /*
  * IPsec controller part.
@@ -832,7 +832,7 @@ ipsec4_forward(struct mbuf *m, int *dest
 	/*
 	 * Find the correct route for outer IPv4 header, compute tunnel MTU.
 	 */
-	if (sp->req && sp->req->sav && sp->req->sav->sah) {
+	if (sp->req && sp->req->sav) {
 		struct route *ro;
 		struct rtentry *rt;
 

Index: src/sys/netipsec/ipsec_input.c
diff -u src/sys/netipsec/ipsec_input.c:1.47 src/sys/netipsec/ipsec_input.c:1.48
--- src/sys/netipsec/ipsec_input.c:1.47	Fri Jul  7 01:37:34 2017
+++ src/sys/netipsec/ipsec_input.c	Wed Jul 12 07:00:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec_input.c,v 1.47 2017/07/07 01:37:34 ozaki-r Exp $	*/
+/*	$NetBSD: ipsec_input.c,v 1.48 2017/07/12 07:00:40 ozaki-r Exp $	*/
 /*	$FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netipsec/ipsec_input.c,v 1.2.4.2 2003/03/28 20:32:53 sam Exp $	*/
 /*	$OpenBSD: ipsec_input.c,v 1.63 2003/02/20 18:35:43 deraadt Exp $	*/
 
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec_input.c,v 1.47 2017/07/07 01:37:34 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_input.c,v 1.48 2017/07/12 07:00:40 ozaki-r Exp $");
 
 /*
  * IPsec input processing.
@@ -332,7 +332,6 @@ ipsec4_common_input_cb(struct mbuf *m, s
 
 	KASSERT(m != NULL);
 	KASSERT(sav != NULL);
-	KASSERT(sav->sah != NULL);
 	saidx = &sav->sah->saidx;
 	af = saidx->dst.sa.sa_family;
 	KASSERTMSG(af == AF_INET, "unexpected af %u", af);
@@ -574,7 +573,6 @@ ipsec6_common_input_cb(struct mbuf *m, s
 
 	KASSERT(m != NULL);
 	KASSERT(sav != NULL);
-	KASSERT(sav->sah != NULL);
 	saidx = &sav->sah->saidx;
 	af = saidx->dst.sa.sa_family;
 	KASSERTMSG(af == AF_INET6, "unexpected af %u", af);

Index: src/sys/netipsec/ipsec_output.c
diff -u src/sys/netipsec/ipsec_output.c:1.50 src/sys/netipsec/ipsec_output.c:1.51
--- src/sys/netipsec/ipsec_output.c:1.50	Thu Jul  6 09:49:46 2017
+++ src/sys/netipsec/ipsec_output.c	Wed Jul 12 07:00:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec_output.c,v 1.50 2017/07/06 09:49:46 ozaki-r Exp $	*/
+/*	$NetBSD: ipsec_output.c,v 1.51 2017/07/12 07:00:40 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.50 2017/07/06 09:49:46 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.51 2017/07/12 07:00:40 ozaki-r Exp $");
 
 /*
  * IPsec output processing.
@@ -164,7 +164,6 @@ ipsec_process_done(struct mbuf *m, struc
 	KASSERT(isr != NULL);
 	sav = isr->sav;
 	KASSERT(sav != NULL);
-	KASSERT(sav->sah != NULL);
 
 	saidx = &sav->sah->saidx;
 
Index: src/sys/netipsec/xform_ipip.c
diff -u src/sys/netipsec/xform_ipip.c:1.50 src/sys/netipsec/xform_ipip.c:1.51
--- src/sys/netipsec/xform_ipip.c:1.50	Thu Jun 29 07:13:41 2017
+++ src/sys/netipsec/xform_ipip.c	Wed Jul 12 07:00:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_ipip.c,v 1.50 2017/06/29 07:13:41 ozaki-r Exp $	*/
+/*	$NetBSD: xform_ipip.c,v 1.51 2017/07/12 07:00:40 ozaki-r Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/xform_ipip.c,v 1.3.2.1 2003/01/24 05:11:36 sam Exp $	*/
 /*	$OpenBSD: ip_ipip.c,v 1.25 2002/06/10 18:04:55 itojun Exp $ */
 
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xform_ipip.c,v 1.50 2017/06/29 07:13:41 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ipip.c,v 1.51 2017/07/12 07:00:40 ozaki-r Exp $");
 
 /*
  * IP-inside-IP processing
@@ -419,7 +419,6 @@ ipip_output(
 
 	KASSERT(isr->sav != NULL);
 	sav = isr->sav;
-	KASSERT(sav->sah != NULL);
 
 	/* XXX Deal with empty TDB source/destination addresses. */
 

Index: src/sys/netipsec/key.c
diff -u src/sy

CVS commit: src/distrib/sets/lists/debug

2017-07-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 12 07:18:40 UTC 2017

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

Log Message:
Fix filename of new debug file


To generate a diff of this commit:
cvs rdiff -u -r1.178 -r1.179 src/distrib/sets/lists/debug/shl.mi

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

Modified files:

Index: src/distrib/sets/lists/debug/shl.mi
diff -u src/distrib/sets/lists/debug/shl.mi:1.178 src/distrib/sets/lists/debug/shl.mi:1.179
--- src/distrib/sets/lists/debug/shl.mi:1.178	Tue Jul 11 15:21:31 2017
+++ src/distrib/sets/lists/debug/shl.mi	Wed Jul 12 07:18:40 2017
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.178 2017/07/11 15:21:31 joerg Exp $
+# $NetBSD: shl.mi,v 1.179 2017/07/12 07:18:40 martin Exp $
 ./usr/lib/libbfd_g.a		comp-c-debuglib	debuglib,compatfile,binutils
 ./usr/libdata/debug/lib		base-sys-usr	debug,dynamicroot,compatdir
 ./usr/libdata/debug/lib/libblacklist.so.0.0.debug		comp-sys-debug	debug,dynamicroot
@@ -307,7 +307,7 @@
 ./usr/libdata/debug/usr/tests/libexec/ld.elf_so/h_helper_symver_dso0/libh_helper_symver_dso.so.1.debug	tests-libexec-debug	debug,compattestfile,atf
 ./usr/libdata/debug/usr/tests/libexec/ld.elf_so/h_helper_symver_dso1/libh_helper_symver_dso.so.1.debug	tests-libexec-debug	debug,compattestfile,atf
 ./usr/libdata/debug/usr/tests/libexec/ld.elf_so/h_helper_symver_dso2/libh_helper_symver_dso.so.1.debug	tests-libexec-debug	debug,compattestfile,atf
-./usr/libdata/debug/usr/tests/libexec/ld.elf_so/h_thread_local_dtor	tests-libexec-debug	debug,compattestfile,atf
+./usr/libdata/debug/usr/tests/libexec/ld.elf_so/h_thread_local_dtor.debug	tests-libexec-debug	debug,compattestfile,atf
 ./usr/libdata/debug/usr/tests/libexec/ld.elf_so/libh_helper_dso1.so.1.debug	tests-libexec-debug	debug,compattestfile,atf
 ./usr/libdata/debug/usr/tests/libexec/ld.elf_so/libh_helper_dso2.so.1.debug	tests-libexec-debug	debug,compattestfile,atf
 ./usr/libdata/debug/usr/tests/libexec/ld.elf_so/libh_helper_dso3.so.1.debug	tests-libexec-debug	debug,compattestfile,atf



CVS commit: src/sys/arch/arm

2017-07-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jul 12 07:22:31 UTC 2017

Modified Files:
src/sys/arch/arm/arm: cpufunc_asm_arm11x6.S
src/sys/arch/arm/arm32: genassym.cf

Log Message:
In idcache_wbinv_range if the range size is bigger than the dcache size
then call idcache_wbinv_all

Avoids a problem with large ranges as seen in
port-evbarm/52169: setting dtrace module to load cause Pi to hang on boot


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/arm/cpufunc_asm_arm11x6.S
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/arm/arm32/genassym.cf

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/arm/arm/cpufunc_asm_arm11x6.S
diff -u src/sys/arch/arm/arm/cpufunc_asm_arm11x6.S:1.7 src/sys/arch/arm/arm/cpufunc_asm_arm11x6.S:1.8
--- src/sys/arch/arm/arm/cpufunc_asm_arm11x6.S:1.7	Wed Jul 30 13:31:17 2014
+++ src/sys/arch/arm/arm/cpufunc_asm_arm11x6.S	Wed Jul 12 07:22:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc_asm_arm11x6.S,v 1.7 2014/07/30 13:31:17 skrll Exp $	*/
+/*	$NetBSD: cpufunc_asm_arm11x6.S,v 1.8 2017/07/12 07:22:31 skrll Exp $	*/
 
 /*
  * Copyright (c) 2007 Microsoft
@@ -63,7 +63,7 @@
 #include 
 #include 
 
-RCSID("$NetBSD: cpufunc_asm_arm11x6.S,v 1.7 2014/07/30 13:31:17 skrll Exp $")
+RCSID("$NetBSD: cpufunc_asm_arm11x6.S,v 1.8 2017/07/12 07:22:31 skrll Exp $")
 
 #if 0
 #define Invalidate_I_cache(Rtmp1, Rtmp2) \
@@ -164,6 +164,11 @@ ENTRY_NP(arm11x6_icache_sync_range)
 END(arm11x6_icache_sync_range)
 
 ENTRY_NP(arm11x6_idcache_wbinv_range)
+	ldr	r2, .Larm_pcache
+	ldr	r2, [r2, #DCACHE_SIZE]
+	cmp	r1, r2
+	bge	arm11x6_idcache_wbinv_all
+
 	add	r1, r1, r0
 	sub	r1, r1, #1
 	/* Erratum ARM1136 371025, workaround #2 */
@@ -212,3 +217,6 @@ ENTRY_NP(arm11x6_sleep)
 	bne	1b
 	RET
 END(arm11x6_sleep)
+
+.Larm_pcache:
+	.word arm_pcache

Index: src/sys/arch/arm/arm32/genassym.cf
diff -u src/sys/arch/arm/arm32/genassym.cf:1.74 src/sys/arch/arm/arm32/genassym.cf:1.75
--- src/sys/arch/arm/arm32/genassym.cf:1.74	Tue Jun  9 08:09:24 2015
+++ src/sys/arch/arm/arm32/genassym.cf	Wed Jul 12 07:22:31 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.74 2015/06/09 08:09:24 skrll Exp $
+#	$NetBSD: genassym.cf,v 1.75 2017/07/12 07:22:31 skrll Exp $
 
 # Copyright (c) 1982, 1990 The Regents of the University of California.
 # All rights reserved.
@@ -251,3 +251,6 @@ define	M_DATAoffsetof(struct mbuf, m
 define	M_NEXToffsetof(struct mbuf, m_next)
 define	IP_SRCoffsetof(struct ip, ip_src)
 define	IP_DSToffsetof(struct ip, ip_dst)
+
+# Cache information
+define	DCACHE_SIZE		offsetof(struct arm_cache_info, dcache_size)



CVS commit: src/sys/netipsec

2017-07-12 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jul 12 07:33:37 UTC 2017

Modified Files:
src/sys/netipsec: key.c

Log Message:
Omit unnecessary check of sav->state

key_allocsa_policy picks a sav of either MATURE or DYING so we
don't need to check its state again.


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 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.179 src/sys/netipsec/key.c:1.180
--- src/sys/netipsec/key.c:1.179	Wed Jul 12 07:00:40 2017
+++ src/sys/netipsec/key.c	Wed Jul 12 07:33:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.179 2017/07/12 07:00:40 ozaki-r Exp $	*/
+/*	$NetBSD: key.c,v 1.180 2017/07/12 07:33:37 ozaki-r 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.179 2017/07/12 07:00:40 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.180 2017/07/12 07:33:37 ozaki-r Exp $");
 
 /*
  * This code is referd to RFC 2367
@@ -899,12 +899,8 @@ key_checkrequest(struct ipsecrequest *is
 		KEY_FREESAV(&oldsav);
 
 	/* When there is SA. */
-	if (isr->sav != NULL) {
-		if (isr->sav->state != SADB_SASTATE_MATURE &&
-		isr->sav->state != SADB_SASTATE_DYING)
-			return EINVAL;
+	if (isr->sav != NULL)
 		return 0;
-	}
 
 	/* there is no SA */
 	error = key_acquire(saidx, isr->sp);



CVS commit: src/distrib/sets/lists/debug

2017-07-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 12 07:38:18 UTC 2017

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

Log Message:
Add misising DEBUGLIB file


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/distrib/sets/lists/debug/shl.mi

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

Modified files:

Index: src/distrib/sets/lists/debug/shl.mi
diff -u src/distrib/sets/lists/debug/shl.mi:1.179 src/distrib/sets/lists/debug/shl.mi:1.180
--- src/distrib/sets/lists/debug/shl.mi:1.179	Wed Jul 12 07:18:40 2017
+++ src/distrib/sets/lists/debug/shl.mi	Wed Jul 12 07:38:17 2017
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.179 2017/07/12 07:18:40 martin Exp $
+# $NetBSD: shl.mi,v 1.180 2017/07/12 07:38:17 martin Exp $
 ./usr/lib/libbfd_g.a		comp-c-debuglib	debuglib,compatfile,binutils
 ./usr/libdata/debug/lib		base-sys-usr	debug,dynamicroot,compatdir
 ./usr/libdata/debug/lib/libblacklist.so.0.0.debug		comp-sys-debug	debug,dynamicroot
@@ -317,4 +317,6 @@
 ./usr/tests/libexec/ld.elf_so/h_helper_symver_dso2/libh_helper_symver_dso_g.a	comp-c-debuglib	atf,debuglib,compattestfile
 ./usr/tests/libexec/ld.elf_so/libh_helper_dso1_g.a			comp-c-debuglib	atf,debuglib,compattestfile
 ./usr/tests/libexec/ld.elf_so/libh_helper_dso2_g.a			comp-c-debuglib	atf,debuglib,compattestfile
+./usr/tests/libexec/ld.elf_so/libh_helper_dso3_g.a			comp-c-debuglib	atf,debuglib,compattestfile
 ./usr/tests/libexec/ld.elf_so/libh_helper_ifunc_dso_g.a			comp-c-debuglib	atf,debuglib,compattestfile
+



CVS commit: src/sys/dev/pci

2017-07-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jul 12 08:15:31 UTC 2017

Modified Files:
src/sys/dev/pci: if_wm.c if_wmreg.h

Log Message:
 Disable D0 LPLU on 8257[12356], 82580, I350 and I21[01], too. Before this 
commit,
above devices and non-PCIe devices accessed wrong register.


To generate a diff of this commit:
cvs rdiff -u -r1.518 -r1.519 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.100 -r1.101 src/sys/dev/pci/if_wmreg.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_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.518 src/sys/dev/pci/if_wm.c:1.519
--- src/sys/dev/pci/if_wm.c:1.518	Thu Jul  6 08:50:52 2017
+++ src/sys/dev/pci/if_wm.c	Wed Jul 12 08:15:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.518 2017/07/06 08:50:52 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.519 2017/07/12 08:15:31 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -73,7 +73,6 @@
  * TODO (in order of importance):
  *
  *	- Check XXX'ed comments
- *	- Disable D0 LPLU on 8257[12356], 82580 and I350.
  *	- TX Multi queue improvement (refine queue selection logic)
  *	- Split header buffer for newer descriptors
  *	- EEE (Energy Efficiency Ethernet)
@@ -84,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.518 2017/07/06 08:50:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.519 2017/07/12 08:15:31 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -910,7 +909,6 @@ static void	wm_igp3_phy_powerdown_workar
 static void	wm_enable_wakeup(struct wm_softc *);
 /* LPLU (Low Power Link Up) */
 static void	wm_lplu_d0_disable(struct wm_softc *);
-static void	wm_lplu_d0_disable_pch(struct wm_softc *);
 /* EEE */
 static void	wm_set_eee_i350(struct wm_softc *);
 
@@ -8954,6 +8952,8 @@ wm_gmii_reset(struct wm_softc *sc)
 	case WM_T_82571:
 	case WM_T_82572:
 	case WM_T_82573:
+	case WM_T_82574:
+	case WM_T_82583:
 	case WM_T_82575:
 	case WM_T_82576:
 	case WM_T_82580:
@@ -8964,10 +8964,6 @@ wm_gmii_reset(struct wm_softc *sc)
 	case WM_T_80003:
 		/* null */
 		break;
-	case WM_T_82574:
-	case WM_T_82583:
-		wm_lplu_d0_disable(sc);
-		break;
 	case WM_T_82541:
 	case WM_T_82547:
 		/* XXX Configure actively LED after PHY reset */
@@ -9441,10 +9437,7 @@ wm_gmii_mediachange(struct ifnet *ifp)
 		return 0;
 
 	/* Disable D0 LPLU. */
-	if (sc->sc_type >= WM_T_PCH)	/* PCH* */
-		wm_lplu_d0_disable_pch(sc);
-	else
-		wm_lplu_d0_disable(sc);	/* ICH* */
+	wm_lplu_d0_disable(sc);
 
 	sc->sc_ctrl &= ~(CTRL_SPEED_MASK | CTRL_FD);
 	sc->sc_ctrl |= CTRL_SLU;
@@ -13381,28 +13374,58 @@ wm_enable_wakeup(struct wm_softc *sc)
 static void
 wm_lplu_d0_disable(struct wm_softc *sc)
 {
+	struct mii_data *mii = &sc->sc_mii;
 	uint32_t reg;
 
 	DPRINTF(WM_DEBUG_INIT, ("%s: %s called\n",
 		device_xname(sc->sc_dev), __func__));
 
-	reg = CSR_READ(sc, WMREG_PHY_CTRL);
-	reg &= ~(PHY_CTRL_GBE_DIS | PHY_CTRL_D0A_LPLU);
-	CSR_WRITE(sc, WMREG_PHY_CTRL, reg);
-}
-
-static void
-wm_lplu_d0_disable_pch(struct wm_softc *sc)
-{
-	uint32_t reg;
+	printf("%s called\n", __func__);
 
-	DPRINTF(WM_DEBUG_INIT, ("%s: %s called\n",
-		device_xname(sc->sc_dev), __func__));
+	if (sc->sc_phytype == WMPHY_IFE)
+		return;
 
-	reg = wm_gmii_hv_readreg(sc->sc_dev, 1, HV_OEM_BITS);
-	reg &= ~(HV_OEM_BITS_A1KDIS | HV_OEM_BITS_LPLU);
-	reg |= HV_OEM_BITS_ANEGNOW;
-	wm_gmii_hv_writereg(sc->sc_dev, 1, HV_OEM_BITS, reg);
+	switch (sc->sc_type) {
+	case WM_T_82571:
+	case WM_T_82572:
+	case WM_T_82573:
+	case WM_T_82575:
+	case WM_T_82576:
+		reg = mii->mii_readreg(sc->sc_dev, 1, MII_IGPHY_POWER_MGMT);
+		reg &= ~PMR_D0_LPLU;
+		mii->mii_writereg(sc->sc_dev, 1, MII_IGPHY_POWER_MGMT, reg);
+		break;
+	case WM_T_82580:
+	case WM_T_I350:
+	case WM_T_I210:
+	case WM_T_I211:
+		reg = CSR_READ(sc, WMREG_PHPM);
+		reg &= ~PHPM_D0A_LPLU;
+		CSR_WRITE(sc, WMREG_PHPM, reg);
+		break;
+	case WM_T_82574:
+	case WM_T_82583:
+	case WM_T_ICH8:
+	case WM_T_ICH9:
+	case WM_T_ICH10:
+		reg = CSR_READ(sc, WMREG_PHY_CTRL);
+		reg &= ~(PHY_CTRL_GBE_DIS | PHY_CTRL_D0A_LPLU);
+		CSR_WRITE(sc, WMREG_PHY_CTRL, reg);
+		CSR_WRITE_FLUSH(sc);
+		break;
+	case WM_T_PCH:
+	case WM_T_PCH2:
+	case WM_T_PCH_LPT:
+	case WM_T_PCH_SPT:
+		reg = wm_gmii_hv_readreg(sc->sc_dev, 1, HV_OEM_BITS);
+		reg &= ~(HV_OEM_BITS_A1KDIS | HV_OEM_BITS_LPLU);
+		if (wm_phy_resetisblocked(sc) == false)
+			reg |= HV_OEM_BITS_ANEGNOW;
+		wm_gmii_hv_writereg(sc->sc_dev, 1, HV_OEM_BITS, reg);
+		break;
+	default:
+		break;
+	}
 }
 
 /* EEE */

Index: src/sys/dev/pci/if_wmreg.h
diff -u src/sys/dev/pci/if_wmreg.h:1.100 src/sys/dev/pci/if_wmreg.h:1.101
--- src/sys/dev/pci/if_wmreg.h:1.100	Mon Jun 26 04:22:46 2017
+++ src/sys/dev/pci/if_wmreg.h	Wed Jul 12 08:15:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wmreg.h,v 1.100 2017/06/26 04:22:46 msaitoh Exp $	*/
+/*	$NetBSD: if_wmreg.h,v 1.101 2017/07/12 08:15:31 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasa

CVS commit: src/sys/dev/pci

2017-07-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jul 12 08:18:36 UTC 2017

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

Log Message:
Remove debug printf().


To generate a diff of this commit:
cvs rdiff -u -r1.519 -r1.520 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.519 src/sys/dev/pci/if_wm.c:1.520
--- src/sys/dev/pci/if_wm.c:1.519	Wed Jul 12 08:15:31 2017
+++ src/sys/dev/pci/if_wm.c	Wed Jul 12 08:18:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.519 2017/07/12 08:15:31 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.520 2017/07/12 08:18:36 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.519 2017/07/12 08:15:31 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.520 2017/07/12 08:18:36 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -13380,8 +13380,6 @@ wm_lplu_d0_disable(struct wm_softc *sc)
 	DPRINTF(WM_DEBUG_INIT, ("%s: %s called\n",
 		device_xname(sc->sc_dev), __func__));
 
-	printf("%s called\n", __func__);
-
 	if (sc->sc_phytype == WMPHY_IFE)
 		return;
 



CVS commit: src/sys/ufs/ffs

2017-07-12 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Jul 12 09:30:16 UTC 2017

Modified Files:
src/sys/ufs/ffs: ffs_alloc.c

Log Message:
When initializing more inodes make sure to write them to disk
before writing the cylinder group with updated cg_initediblk.


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/sys/ufs/ffs/ffs_alloc.c

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

Modified files:

Index: src/sys/ufs/ffs/ffs_alloc.c
diff -u src/sys/ufs/ffs/ffs_alloc.c:1.156 src/sys/ufs/ffs/ffs_alloc.c:1.157
--- src/sys/ufs/ffs/ffs_alloc.c:1.156	Sat Mar 18 05:20:04 2017
+++ src/sys/ufs/ffs/ffs_alloc.c	Wed Jul 12 09:30:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_alloc.c,v 1.156 2017/03/18 05:20:04 riastradh Exp $	*/
+/*	$NetBSD: ffs_alloc.c,v 1.157 2017/07/12 09:30:16 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.156 2017/03/18 05:20:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.157 2017/07/12 09:30:16 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -1379,8 +1379,8 @@ gotit:
 	}
 	mutex_exit(&ump->um_lock);
 	if (ibp != NULL) {
+		bwrite(ibp);
 		bwrite(bp);
-		bawrite(ibp);
 	} else
 		bdwrite(bp);
 	return (cg * fs->fs_ipg + ipref);



CVS commit: src/sys/kern

2017-07-12 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Jul 12 09:31:07 UTC 2017

Modified Files:
src/sys/kern: vnode_if.src

Log Message:
As VOP_ADVLOCK() may block indefinitely we cannot take fstrans here.

Fixes PR kern/52364: System hangs not much before showing the login prompt


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/kern/vnode_if.src

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/vnode_if.src
diff -u src/sys/kern/vnode_if.src:1.76 src/sys/kern/vnode_if.src:1.77
--- src/sys/kern/vnode_if.src:1.76	Sun Jun  4 07:59:17 2017
+++ src/sys/kern/vnode_if.src	Wed Jul 12 09:31:07 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: vnode_if.src,v 1.76 2017/06/04 07:59:17 hannken Exp $
+#	$NetBSD: vnode_if.src,v 1.77 2017/07/12 09:31:07 hannken Exp $
 #
 # Copyright (c) 1992, 1993
 #	The Regents of the University of California.  All rights reserved.
@@ -468,6 +468,7 @@ vop_pathconf {
 #% advlockvp  U U U
 #
 vop_advlock {
+	FSTRANS=NO
 	IN LOCKED=NO struct vnode *vp;
 	IN void *id;
 	IN int op;



CVS commit: src/sys

2017-07-12 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Jul 12 09:32:00 UTC 2017

Modified Files:
src/sys/kern: vnode_if.c
src/sys/rump/include/rump: rumpvnode_if.h
src/sys/rump/librump/rumpvfs: rumpvnode_if.c
src/sys/sys: vnode_if.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/kern/vnode_if.c
cvs rdiff -u -r1.30 -r1.31 src/sys/rump/include/rump/rumpvnode_if.h
cvs rdiff -u -r1.30 -r1.31 src/sys/rump/librump/rumpvfs/rumpvnode_if.c
cvs rdiff -u -r1.101 -r1.102 src/sys/sys/vnode_if.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/kern/vnode_if.c
diff -u src/sys/kern/vnode_if.c:1.106 src/sys/kern/vnode_if.c:1.107
--- src/sys/kern/vnode_if.c:1.106	Sun Jun  4 08:05:42 2017
+++ src/sys/kern/vnode_if.c	Wed Jul 12 09:31:59 2017
@@ -1,11 +1,11 @@
-/*	$NetBSD: vnode_if.c,v 1.106 2017/06/04 08:05:42 hannken Exp $	*/
+/*	$NetBSD: vnode_if.c,v 1.107 2017/07/12 09:31:59 hannken Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
  * (Modifications made here may easily be lost!)
  *
  * Created from the file:
- *	NetBSD: vnode_if.src,v 1.76 2017/06/04 07:59:17 hannken Exp
+ *	NetBSD: vnode_if.src,v 1.77 2017/07/12 09:31:07 hannken Exp
  * by the script:
  *	NetBSD: vnode_if.sh,v 1.66 2017/06/04 08:03:26 hannken Exp
  */
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.106 2017/06/04 08:05:42 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.107 2017/07/12 09:31:59 hannken Exp $");
 
 #include 
 #include 
@@ -1510,11 +1510,11 @@ VOP_ADVLOCK(struct vnode *vp,
 	a.a_op = op;
 	a.a_fl = fl;
 	a.a_flags = flags;
-	error = vop_pre(vp, &mp, &mpsafe, FST_YES);
+	error = vop_pre(vp, &mp, &mpsafe, FST_NO);
 	if (error)
 		return error;
 	error = (VCALL(vp, VOFFSET(vop_advlock), &a));
-	vop_post(vp, mp, mpsafe, FST_YES);
+	vop_post(vp, mp, mpsafe, FST_NO);
 	return error;
 }
 

Index: src/sys/rump/include/rump/rumpvnode_if.h
diff -u src/sys/rump/include/rump/rumpvnode_if.h:1.30 src/sys/rump/include/rump/rumpvnode_if.h:1.31
--- src/sys/rump/include/rump/rumpvnode_if.h:1.30	Sun Jun  4 08:05:42 2017
+++ src/sys/rump/include/rump/rumpvnode_if.h	Wed Jul 12 09:31:59 2017
@@ -1,11 +1,11 @@
-/*	$NetBSD: rumpvnode_if.h,v 1.30 2017/06/04 08:05:42 hannken Exp $	*/
+/*	$NetBSD: rumpvnode_if.h,v 1.31 2017/07/12 09:31:59 hannken Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
  * (Modifications made here may easily be lost!)
  *
  * Created from the file:
- *	NetBSD: vnode_if.src,v 1.76 2017/06/04 07:59:17 hannken Exp
+ *	NetBSD: vnode_if.src,v 1.77 2017/07/12 09:31:07 hannken Exp
  * by the script:
  *	NetBSD: vnode_if.sh,v 1.66 2017/06/04 08:03:26 hannken Exp
  */

Index: src/sys/rump/librump/rumpvfs/rumpvnode_if.c
diff -u src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.30 src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.31
--- src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.30	Sun Jun  4 08:05:42 2017
+++ src/sys/rump/librump/rumpvfs/rumpvnode_if.c	Wed Jul 12 09:31:59 2017
@@ -1,11 +1,11 @@
-/*	$NetBSD: rumpvnode_if.c,v 1.30 2017/06/04 08:05:42 hannken Exp $	*/
+/*	$NetBSD: rumpvnode_if.c,v 1.31 2017/07/12 09:31:59 hannken Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
  * (Modifications made here may easily be lost!)
  *
  * Created from the file:
- *	NetBSD: vnode_if.src,v 1.76 2017/06/04 07:59:17 hannken Exp
+ *	NetBSD: vnode_if.src,v 1.77 2017/07/12 09:31:07 hannken Exp
  * by the script:
  *	NetBSD: vnode_if.sh,v 1.66 2017/06/04 08:03:26 hannken Exp
  */
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpvnode_if.c,v 1.30 2017/06/04 08:05:42 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpvnode_if.c,v 1.31 2017/07/12 09:31:59 hannken Exp $");
 
 #include 
 #include 

Index: src/sys/sys/vnode_if.h
diff -u src/sys/sys/vnode_if.h:1.101 src/sys/sys/vnode_if.h:1.102
--- src/sys/sys/vnode_if.h:1.101	Sun Jun  4 08:05:42 2017
+++ src/sys/sys/vnode_if.h	Wed Jul 12 09:32:00 2017
@@ -1,11 +1,11 @@
-/*	$NetBSD: vnode_if.h,v 1.101 2017/06/04 08:05:42 hannken Exp $	*/
+/*	$NetBSD: vnode_if.h,v 1.102 2017/07/12 09:32:00 hannken Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
  * (Modifications made here may easily be lost!)
  *
  * Created from the file:
- *	NetBSD: vnode_if.src,v 1.76 2017/06/04 07:59:17 hannken Exp
+ *	NetBSD: vnode_if.src,v 1.77 2017/07/12 09:31:07 hannken Exp
  * by the script:
  *	NetBSD: vnode_if.sh,v 1.66 2017/06/04 08:03:26 hannken Exp
  */



CVS commit: src/sys/arch/arm/arm32

2017-07-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jul 12 09:49:08 UTC 2017

Modified Files:
src/sys/arch/arm/arm32: genassym.cf

Log Message:
Alignment whitespace.  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/arm/arm32/genassym.cf

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/arm/arm32/genassym.cf
diff -u src/sys/arch/arm/arm32/genassym.cf:1.75 src/sys/arch/arm/arm32/genassym.cf:1.76
--- src/sys/arch/arm/arm32/genassym.cf:1.75	Wed Jul 12 07:22:31 2017
+++ src/sys/arch/arm/arm32/genassym.cf	Wed Jul 12 09:49:08 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.75 2017/07/12 07:22:31 skrll Exp $
+#	$NetBSD: genassym.cf,v 1.76 2017/07/12 09:49:08 skrll Exp $
 
 # Copyright (c) 1982, 1990 The Regents of the University of California.
 # All rights reserved.
@@ -246,11 +246,11 @@ define	VFP_FPEXC_EN		VFP_FPEXC_EN
 define	NSACR_VFPCP		NSACR_CPn(VFP_COPROC)|NSACR_CPn(VFP_COPROC2)
 
 # Constants required for in_cksum() and friends.
-define	M_LENoffsetof(struct mbuf, m_len)
-define	M_DATAoffsetof(struct mbuf, m_data)
-define	M_NEXToffsetof(struct mbuf, m_next)
-define	IP_SRCoffsetof(struct ip, ip_src)
-define	IP_DSToffsetof(struct ip, ip_dst)
+define	M_LEN			offsetof(struct mbuf, m_len)
+define	M_DATA			offsetof(struct mbuf, m_data)
+define	M_NEXT			offsetof(struct mbuf, m_next)
+define	IP_SRC			offsetof(struct ip, ip_src)
+define	IP_DST			offsetof(struct ip, ip_dst)
 
 # Cache information
 define	DCACHE_SIZE		offsetof(struct arm_cache_info, dcache_size)



CVS commit: src/share/man/man4

2017-07-12 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Jul 12 11:23:53 UTC 2017

Modified Files:
src/share/man/man4: lm.4

Log Message:
Remove superfluous Pp.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/share/man/man4/lm.4

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/lm.4
diff -u src/share/man/man4/lm.4:1.33 src/share/man/man4/lm.4:1.34
--- src/share/man/man4/lm.4:1.33	Wed Jul 12 04:39:25 2017
+++ src/share/man/man4/lm.4	Wed Jul 12 11:23:52 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: lm.4,v 1.33 2017/07/12 04:39:25 msaitoh Exp $
+.\"	$NetBSD: lm.4,v 1.34 2017/07/12 11:23:52 wiz Exp $
 .\"
 .\" Copyright (c) 2000 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -74,7 +74,6 @@ Due to hardware limitations, fresh senso
 Chips supported by the
 .Nm
 driver include:
-.Pp
 .Bl -item -offset indent
 .It
 .Tn National Semiconductor



CVS commit: src/share/man/man4

2017-07-12 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Jul 12 11:23:59 UTC 2017

Modified Files:
src/share/man/man4: wbsio.4

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/share/man/man4/wbsio.4

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/wbsio.4
diff -u src/share/man/man4/wbsio.4:1.5 src/share/man/man4/wbsio.4:1.6
--- src/share/man/man4/wbsio.4:1.5	Wed Jul 12 05:26:42 2017
+++ src/share/man/man4/wbsio.4	Wed Jul 12 11:23:58 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: wbsio.4,v 1.5 2017/07/12 05:26:42 pgoyette Exp $
+.\"	$NetBSD: wbsio.4,v 1.6 2017/07/12 11:23:58 wiz Exp $
 .\"	$OpenBSD: wbsio.4,v 1.2 2008/02/17 16:48:47 jmc Exp $
 .\"
 .\" Copyright (c) 2008 Mark Kettenis 
@@ -20,7 +20,7 @@
 .Os
 .Sh NAME
 .Nm wbsio
-.Nd Winbond(Nuvoton) LPC Super I/O
+.Nd Winbond (Nuvoton) LPC Super I/O
 .Sh SYNOPSIS
 .Cd "wbsio* at isa? port 0x2e"
 .Cd "wbsio* at isa? port 0x4e"



CVS commit: src/external/bsd/nsd

2017-07-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jul 12 12:55:41 UTC 2017

Modified Files:
src/external/bsd/nsd: Makefile.inc

Log Message:
Oops, support IPv6 if not disabled.
XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/bsd/nsd/Makefile.inc

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/nsd/Makefile.inc
diff -u src/external/bsd/nsd/Makefile.inc:1.1 src/external/bsd/nsd/Makefile.inc:1.2
--- src/external/bsd/nsd/Makefile.inc:1.1	Sat Jan  7 14:51:21 2017
+++ src/external/bsd/nsd/Makefile.inc	Wed Jul 12 08:55:41 2017
@@ -1,4 +1,6 @@
-# $NetBSD: Makefile.inc,v 1.1 2017/01/07 19:51:21 christos Exp $
+# $NetBSD: Makefile.inc,v 1.2 2017/07/12 12:55:41 christos Exp $
+
+.include 
 
 USE_FORT?= yes  # network client/server
 
@@ -8,6 +10,10 @@ CPPFLAGS+=-D_OPENBSD_SOURCE
 CPPFLAGS+=-I${NSD} -I${NSD}/../include
 .PATH: ${NSD}
 
+.if (${USE_INET6} != "no")
+CPPFLAGS+=  -DINET6
+.endif
+
 DPLIBS+= event ${NETBSDSRCDIR}/external/bsd/libevent/lib/libevent
 DPLIBS+= ssl ${NETBSDSRCDIR}/crypto/external/bsd/openssl/lib/libssl
 DPLIBS+= crypto ${NETBSDSRCDIR}/crypto/external/bsd/openssl/lib/libcrypto



CVS commit: [netbsd-8] src/sys

2017-07-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 12 13:42:11 UTC 2017

Modified Files:
src/sys/netinet [netbsd-8]: in_l2tp.c
src/sys/netinet6 [netbsd-8]: in6_l2tp.c

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #121):
sys/netinet6/in6_l2tp.c: revision 1.6
sys/netinet/in_l2tp.c: revision 1.3
l2tp(4): fix mbuf leak when tunnel nested over the limit
XXX need pullup -8 branch


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.8.1 src/sys/netinet/in_l2tp.c
cvs rdiff -u -r1.5 -r1.5.8.1 src/sys/netinet6/in6_l2tp.c

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

Modified files:

Index: src/sys/netinet/in_l2tp.c
diff -u src/sys/netinet/in_l2tp.c:1.2 src/sys/netinet/in_l2tp.c:1.2.8.1
--- src/sys/netinet/in_l2tp.c:1.2	Thu Mar 30 23:13:54 2017
+++ src/sys/netinet/in_l2tp.c	Wed Jul 12 13:42:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_l2tp.c,v 1.2 2017/03/30 23:13:54 knakahara Exp $	*/
+/*	$NetBSD: in_l2tp.c,v 1.2.8.1 2017/07/12 13:42:11 martin Exp $	*/
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in_l2tp.c,v 1.2 2017/03/30 23:13:54 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_l2tp.c,v 1.2.8.1 2017/07/12 13:42:11 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_l2tp.h"
@@ -108,8 +108,10 @@ in_l2tp_output(struct l2tp_variant *var,
 
 	ifp = &sc->l2tp_ec.ec_if;
 	error = l2tp_check_nesting(ifp, m);
-	if (error)
+	if (error) {
+		m_freem(m);
 		goto looped;
+	}
 
 #ifdef NETYET
 /* TODO: support ALTQ for innner frame */

Index: src/sys/netinet6/in6_l2tp.c
diff -u src/sys/netinet6/in6_l2tp.c:1.5 src/sys/netinet6/in6_l2tp.c:1.5.8.1
--- src/sys/netinet6/in6_l2tp.c:1.5	Tue Apr  4 23:49:18 2017
+++ src/sys/netinet6/in6_l2tp.c	Wed Jul 12 13:42:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_l2tp.c,v 1.5 2017/04/04 23:49:18 knakahara Exp $	*/
+/*	$NetBSD: in6_l2tp.c,v 1.5.8.1 2017/07/12 13:42:11 martin Exp $	*/
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6_l2tp.c,v 1.5 2017/04/04 23:49:18 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_l2tp.c,v 1.5.8.1 2017/07/12 13:42:11 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_l2tp.h"
@@ -108,8 +108,10 @@ in6_l2tp_output(struct l2tp_variant *var
 	sc = var->lv_softc;
 	ifp = &sc->l2tp_ec.ec_if;
 	error = l2tp_check_nesting(ifp, m);
-	if (error)
+	if (error) {
+		m_freem(m);
 		goto looped;
+	}
 
 #ifdef NOTYET
 /* TODO: support ALTQ for innner frame */



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

2017-07-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 12 13:44:47 UTC 2017

Modified Files:
src/sys/arch/arm/arm [netbsd-8]: cpufunc_asm_arm11x6.S
src/sys/arch/arm/arm32 [netbsd-8]: genassym.cf

Log Message:
Pull up following revision(s) (requested by skrll in ticket #122):
sys/arch/arm/arm32/genassym.cf: revision 1.75
sys/arch/arm/arm/cpufunc_asm_arm11x6.S: revision 1.8
In idcache_wbinv_range if the range size is bigger than the dcache size
then call idcache_wbinv_all
Avoids a problem with large ranges as seen in
port-evbarm/52169: setting dtrace module to load cause Pi to hang on boot


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.20.1 src/sys/arch/arm/arm/cpufunc_asm_arm11x6.S
cvs rdiff -u -r1.74 -r1.74.10.1 src/sys/arch/arm/arm32/genassym.cf

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/arm/arm/cpufunc_asm_arm11x6.S
diff -u src/sys/arch/arm/arm/cpufunc_asm_arm11x6.S:1.7 src/sys/arch/arm/arm/cpufunc_asm_arm11x6.S:1.7.20.1
--- src/sys/arch/arm/arm/cpufunc_asm_arm11x6.S:1.7	Wed Jul 30 13:31:17 2014
+++ src/sys/arch/arm/arm/cpufunc_asm_arm11x6.S	Wed Jul 12 13:44:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc_asm_arm11x6.S,v 1.7 2014/07/30 13:31:17 skrll Exp $	*/
+/*	$NetBSD: cpufunc_asm_arm11x6.S,v 1.7.20.1 2017/07/12 13:44:47 martin Exp $	*/
 
 /*
  * Copyright (c) 2007 Microsoft
@@ -63,7 +63,7 @@
 #include 
 #include 
 
-RCSID("$NetBSD: cpufunc_asm_arm11x6.S,v 1.7 2014/07/30 13:31:17 skrll Exp $")
+RCSID("$NetBSD: cpufunc_asm_arm11x6.S,v 1.7.20.1 2017/07/12 13:44:47 martin Exp $")
 
 #if 0
 #define Invalidate_I_cache(Rtmp1, Rtmp2) \
@@ -164,6 +164,11 @@ ENTRY_NP(arm11x6_icache_sync_range)
 END(arm11x6_icache_sync_range)
 
 ENTRY_NP(arm11x6_idcache_wbinv_range)
+	ldr	r2, .Larm_pcache
+	ldr	r2, [r2, #DCACHE_SIZE]
+	cmp	r1, r2
+	bge	arm11x6_idcache_wbinv_all
+
 	add	r1, r1, r0
 	sub	r1, r1, #1
 	/* Erratum ARM1136 371025, workaround #2 */
@@ -212,3 +217,6 @@ ENTRY_NP(arm11x6_sleep)
 	bne	1b
 	RET
 END(arm11x6_sleep)
+
+.Larm_pcache:
+	.word arm_pcache

Index: src/sys/arch/arm/arm32/genassym.cf
diff -u src/sys/arch/arm/arm32/genassym.cf:1.74 src/sys/arch/arm/arm32/genassym.cf:1.74.10.1
--- src/sys/arch/arm/arm32/genassym.cf:1.74	Tue Jun  9 08:09:24 2015
+++ src/sys/arch/arm/arm32/genassym.cf	Wed Jul 12 13:44:47 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.74 2015/06/09 08:09:24 skrll Exp $
+#	$NetBSD: genassym.cf,v 1.74.10.1 2017/07/12 13:44:47 martin Exp $
 
 # Copyright (c) 1982, 1990 The Regents of the University of California.
 # All rights reserved.
@@ -251,3 +251,6 @@ define	M_DATAoffsetof(struct mbuf, m
 define	M_NEXToffsetof(struct mbuf, m_next)
 define	IP_SRCoffsetof(struct ip, ip_src)
 define	IP_DSToffsetof(struct ip, ip_dst)
+
+# Cache information
+define	DCACHE_SIZE		offsetof(struct arm_cache_info, dcache_size)



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

2017-07-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 12 13:51:05 UTC 2017

Modified Files:
src/crypto/external/bsd/heimdal/dist/lib/krb5 [netbsd-8]: ticket.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #123):
crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c: revision 1.3
crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c: revision 1.4
https://orpheus-lyre.info/design/index.html";>https://orpheus-lyre.info/design/index.html
https://github.com/heimdal/heimdal/commit/6dd3eb836bbb80a00ffced4ad57077a1cdf227ea";>https://github.com/heimdal/heimdal/commit/6dd3eb836bbb80a00ffced4ad57077a1cdf227ea
In _krb5_extract_ticket() the KDC-REP service name must be obtained from
encrypted version stored in 'enc_part' instead of the unencrypted version
stored in 'ticket'.  Use of the unecrypted version provides an
opportunity for successful server impersonation and other attacks.
Identified by Jeffrey Altman, Viktor Duchovni and Nico Williams.
XXX: pullup 6, 7, 8.
fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.4.1 \
src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.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/lib/krb5/ticket.c
diff -u src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.2 src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.2.4.1
--- src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.2	Sat Jan 28 21:31:49 2017
+++ src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c	Wed Jul 12 13:51:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ticket.c,v 1.2 2017/01/28 21:31:49 christos Exp $	*/
+/*	$NetBSD: ticket.c,v 1.2.4.1 2017/07/12 13:51:05 martin Exp $	*/
 
 /*
  * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan
@@ -707,8 +707,8 @@ _krb5_extract_ticket(krb5_context contex
 /* check server referral and save principal */
 ret = _krb5_principalname2krb5_principal (context,
 	  &tmp_principal,
-	  rep->kdc_rep.ticket.sname,
-	  rep->kdc_rep.ticket.realm);
+	  rep->enc_part.sname,
+	  rep->enc_part.srealm);
 if (ret)
 	goto out;
 if((flags & EXTRACT_TICKET_ALLOW_SERVER_MISMATCH) == 0){



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

2017-07-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 12 13:56:46 UTC 2017

Modified Files:
src/external/bsd/nsd [netbsd-8]: Makefile.inc

Log Message:
Pull up following revision(s) (requested by christos in ticket #124):
external/bsd/nsd/Makefile.inc: revision 1.2
Oops, support IPv6 if not disabled.
XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.1.8.1 src/external/bsd/nsd/Makefile.inc

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/nsd/Makefile.inc
diff -u src/external/bsd/nsd/Makefile.inc:1.1 src/external/bsd/nsd/Makefile.inc:1.1.8.1
--- src/external/bsd/nsd/Makefile.inc:1.1	Sat Jan  7 19:51:21 2017
+++ src/external/bsd/nsd/Makefile.inc	Wed Jul 12 13:56:46 2017
@@ -1,4 +1,6 @@
-# $NetBSD: Makefile.inc,v 1.1 2017/01/07 19:51:21 christos Exp $
+# $NetBSD: Makefile.inc,v 1.1.8.1 2017/07/12 13:56:46 martin Exp $
+
+.include 
 
 USE_FORT?= yes  # network client/server
 
@@ -8,6 +10,10 @@ CPPFLAGS+=-D_OPENBSD_SOURCE
 CPPFLAGS+=-I${NSD} -I${NSD}/../include
 .PATH: ${NSD}
 
+.if (${USE_INET6} != "no")
+CPPFLAGS+=  -DINET6
+.endif
+
 DPLIBS+= event ${NETBSDSRCDIR}/external/bsd/libevent/lib/libevent
 DPLIBS+= ssl ${NETBSDSRCDIR}/crypto/external/bsd/openssl/lib/libssl
 DPLIBS+= crypto ${NETBSDSRCDIR}/crypto/external/bsd/openssl/lib/libcrypto



CVS commit: [netbsd-8] src/doc

2017-07-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 12 13:58:38 UTC 2017

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

Log Message:
Tickets #117, #121-#124


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.22 -r1.1.2.23 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.22 src/doc/CHANGES-8.0:1.1.2.23
--- src/doc/CHANGES-8.0:1.1.2.22	Mon Jul 10 13:09:24 2017
+++ src/doc/CHANGES-8.0	Wed Jul 12 13:58:38 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.22 2017/07/10 13:09:24 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.23 2017/07/12 13:58:38 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -1927,3 +1927,35 @@ usr.sbin/postinstall/postinstall		1.216
 	Add npfd to the list of rc.d scripts to check.
 	[simonb, ticket #117]
 
+sys/netinet/in_l2tp.c1.3
+sys/netinet6/in6_l2tp.c1.6
+
+	l2tp(4): fix mbuf leak when tunnel nested over the limit
+	[knakahara, ticket #121]
+
+sys/arch/arm/arm/cpufunc_asm_arm11x6.S		1.8
+sys/arch/arm/arm32/genassym.cf			1.75
+
+	In idcache_wbinv_range if the range size is bigger than the dcache
+	size then call idcache_wbinv_all.
+	Avoids a problem with large ranges as seen in
+	port-evbarm/52169: setting dtrace module to load cause Pi to hang
+	on boot
+	[skrll, ticket #122]
+
+crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c 1.3-1.4
+
+	In _krb5_extract_ticket() the KDC-REP service name must be obtained
+	from encrypted version stored in 'enc_part' instead of the
+	unencrypted version stored in 'ticket'.
+	Use of the unecrypted version provides an opportunity for successful
+	server impersonation and other attacks.
+
+	Identified by Jeffrey Altman, Viktor Duchovni and Nico Williams.
+	[christos, ticket #123]
+
+external/bsd/nsd/Makefile.inc			1.2
+
+	Enable IPv6 support for nsd (accidently disabled).
+	[christos, ticket #124]
+



CVS commit: [netbsd-7] src/crypto/external/bsd/heimdal/dist/lib/krb5

2017-07-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 12 15:34:37 UTC 2017

Modified Files:
src/crypto/external/bsd/heimdal/dist/lib/krb5 [netbsd-7]: ticket.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #1453):
crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c: revision 1.3
crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c: revision 1.4
https://orpheus-lyre.info/design/index.html";>https://orpheus-lyre.info/design/index.html
https://github.com/heimdal/heimdal/commit/6dd3eb836bbb80a00ffced4ad57077a1cdf227ea";>https://github.com/heimdal/heimdal/commit/6dd3eb836bbb80a00ffced4ad57077a1cdf227ea
In _krb5_extract_ticket() the KDC-REP service name must be obtained from
encrypted version stored in 'enc_part' instead of the unencrypted version
stored in 'ticket'.  Use of the unecrypted version provides an
opportunity for successful server impersonation and other attacks.
Identified by Jeffrey Altman, Viktor Duchovni and Nico Williams.
XXX: pullup 6, 7, 8.
fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.1.1.2.2.1 \
src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.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/lib/krb5/ticket.c
diff -u src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.1.1.2 src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.1.1.2.2.1
--- src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.1.1.2	Thu Apr 24 12:45:51 2014
+++ src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c	Wed Jul 12 15:34:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ticket.c,v 1.1.1.2 2014/04/24 12:45:51 pettai Exp $	*/
+/*	$NetBSD: ticket.c,v 1.1.1.2.2.1 2017/07/12 15:34:37 martin Exp $	*/
 
 /*
  * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan
@@ -715,8 +715,8 @@ _krb5_extract_ticket(krb5_context contex
 /* check server referral and save principal */
 ret = _krb5_principalname2krb5_principal (context,
 	  &tmp_principal,
-	  rep->kdc_rep.ticket.sname,
-	  rep->kdc_rep.ticket.realm);
+	  rep->enc_part.sname,
+	  rep->enc_part.srealm);
 if (ret)
 	goto out;
 if((flags & EXTRACT_TICKET_ALLOW_SERVER_MISMATCH) == 0){



CVS commit: [netbsd-7] src/doc

2017-07-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 12 15:35:18 UTC 2017

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

Log Message:
Ticket #1453


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

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

Modified files:

Index: src/doc/CHANGES-7.2
diff -u src/doc/CHANGES-7.2:1.1.2.27 src/doc/CHANGES-7.2:1.1.2.28
--- src/doc/CHANGES-7.2:1.1.2.27	Mon Jul 10 13:12:40 2017
+++ src/doc/CHANGES-7.2	Wed Jul 12 15:35:18 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.2,v 1.1.2.27 2017/07/10 13:12:40 martin Exp $
+# $NetBSD: CHANGES-7.2,v 1.1.2.28 2017/07/12 15:35:18 martin Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.2
 release:
@@ -2483,3 +2483,14 @@ sys/kern/vfs_lookup.c1.208
 	in -r1.200.
 	[dh, ticket #1451]
 
+crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c 1.3-1.4
+
+	In _krb5_extract_ticket() the KDC-REP service name must be
+	obtained from encrypted version stored in 'enc_part' instead
+	of the unencrypted version stored in 'ticket'.
+	Use of the unecrypted version provides an opportunity for
+	successful server impersonation and other attacks.
+
+	Identified by Jeffrey Altman, Viktor Duchovni and Nico Williams.
+	[christos, ticket #1453]
+



CVS commit: [netbsd-7-1] src/crypto/external/bsd/heimdal/dist/lib/krb5

2017-07-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 12 15:35:53 UTC 2017

Modified Files:
src/crypto/external/bsd/heimdal/dist/lib/krb5 [netbsd-7-1]: ticket.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #1453):
crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c: revision 1.3
crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c: revision 1.4
https://orpheus-lyre.info/design/index.html";>https://orpheus-lyre.info/design/index.html
https://github.com/heimdal/heimdal/commit/6dd3eb836bbb80a00ffced4ad57077a1cdf227ea";>https://github.com/heimdal/heimdal/commit/6dd3eb836bbb80a00ffced4ad57077a1cdf227ea
In _krb5_extract_ticket() the KDC-REP service name must be obtained from
encrypted version stored in 'enc_part' instead of the unencrypted version
stored in 'ticket'.  Use of the unecrypted version provides an
opportunity for successful server impersonation and other attacks.
Identified by Jeffrey Altman, Viktor Duchovni and Nico Williams.
XXX: pullup 6, 7, 8.
fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.1.1.2.12.1 \
src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.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/lib/krb5/ticket.c
diff -u src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.1.1.2 src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.1.1.2.12.1
--- src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.1.1.2	Thu Apr 24 12:45:51 2014
+++ src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c	Wed Jul 12 15:35:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ticket.c,v 1.1.1.2 2014/04/24 12:45:51 pettai Exp $	*/
+/*	$NetBSD: ticket.c,v 1.1.1.2.12.1 2017/07/12 15:35:53 martin Exp $	*/
 
 /*
  * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan
@@ -715,8 +715,8 @@ _krb5_extract_ticket(krb5_context contex
 /* check server referral and save principal */
 ret = _krb5_principalname2krb5_principal (context,
 	  &tmp_principal,
-	  rep->kdc_rep.ticket.sname,
-	  rep->kdc_rep.ticket.realm);
+	  rep->enc_part.sname,
+	  rep->enc_part.srealm);
 if (ret)
 	goto out;
 if((flags & EXTRACT_TICKET_ALLOW_SERVER_MISMATCH) == 0){



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

2017-07-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 12 15:36:25 UTC 2017

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

Log Message:
Ticket #1453


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.14 -r1.1.2.15 src/doc/CHANGES-7.1.1

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

Modified files:

Index: src/doc/CHANGES-7.1.1
diff -u src/doc/CHANGES-7.1.1:1.1.2.14 src/doc/CHANGES-7.1.1:1.1.2.15
--- src/doc/CHANGES-7.1.1:1.1.2.14	Mon Jul 10 13:14:21 2017
+++ src/doc/CHANGES-7.1.1	Wed Jul 12 15:36:25 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1.1,v 1.1.2.14 2017/07/10 13:14:21 martin Exp $
+# $NetBSD: CHANGES-7.1.1,v 1.1.2.15 2017/07/12 15:36:25 martin Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.1.1
 release:
@@ -1686,3 +1686,14 @@ sys/kern/vfs_lookup.c1.208
 	in -r1.200.
 	[dh, ticket #1451]
 
+crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c 1.3-1.4
+
+	In _krb5_extract_ticket() the KDC-REP service name must be
+	obtained from encrypted version stored in 'enc_part' instead
+	of the unencrypted version stored in 'ticket'.
+	Use of the unecrypted version provides an opportunity for
+	successful server impersonation and other attacks.
+
+	Identified by Jeffrey Altman, Viktor Duchovni and Nico Williams.
+	[christos, ticket #1453]
+



CVS commit: [netbsd-7-0] src/crypto/external/bsd/heimdal/dist/lib/krb5

2017-07-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 12 15:36:59 UTC 2017

Modified Files:
src/crypto/external/bsd/heimdal/dist/lib/krb5 [netbsd-7-0]: ticket.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #1453):
crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c: revision 1.3
crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c: revision 1.4
https://orpheus-lyre.info/design/index.html";>https://orpheus-lyre.info/design/index.html
https://github.com/heimdal/heimdal/commit/6dd3eb836bbb80a00ffced4ad57077a1cdf227ea";>https://github.com/heimdal/heimdal/commit/6dd3eb836bbb80a00ffced4ad57077a1cdf227ea
In _krb5_extract_ticket() the KDC-REP service name must be obtained from
encrypted version stored in 'enc_part' instead of the unencrypted version
stored in 'ticket'.  Use of the unecrypted version provides an
opportunity for successful server impersonation and other attacks.
Identified by Jeffrey Altman, Viktor Duchovni and Nico Williams.
XXX: pullup 6, 7, 8.
fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.1.1.2.4.1 \
src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.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/lib/krb5/ticket.c
diff -u src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.1.1.2 src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.1.1.2.4.1
--- src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.1.1.2	Thu Apr 24 12:45:51 2014
+++ src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c	Wed Jul 12 15:36:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ticket.c,v 1.1.1.2 2014/04/24 12:45:51 pettai Exp $	*/
+/*	$NetBSD: ticket.c,v 1.1.1.2.4.1 2017/07/12 15:36:58 martin Exp $	*/
 
 /*
  * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan
@@ -715,8 +715,8 @@ _krb5_extract_ticket(krb5_context contex
 /* check server referral and save principal */
 ret = _krb5_principalname2krb5_principal (context,
 	  &tmp_principal,
-	  rep->kdc_rep.ticket.sname,
-	  rep->kdc_rep.ticket.realm);
+	  rep->enc_part.sname,
+	  rep->enc_part.srealm);
 if (ret)
 	goto out;
 if((flags & EXTRACT_TICKET_ALLOW_SERVER_MISMATCH) == 0){



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

2017-07-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 12 15:38:06 UTC 2017

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

Log Message:
Ticket #1453


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.47 -r1.1.2.48 src/doc/CHANGES-7.0.3

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

Modified files:

Index: src/doc/CHANGES-7.0.3
diff -u src/doc/CHANGES-7.0.3:1.1.2.47 src/doc/CHANGES-7.0.3:1.1.2.48
--- src/doc/CHANGES-7.0.3:1.1.2.47	Mon Jul 10 13:16:27 2017
+++ src/doc/CHANGES-7.0.3	Wed Jul 12 15:38:06 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0.3,v 1.1.2.47 2017/07/10 13:16:27 martin Exp $
+# $NetBSD: CHANGES-7.0.3,v 1.1.2.48 2017/07/12 15:38:06 martin Exp $
 
 A complete list of changes from the NetBSD 7.0.2 release to the NetBSD 7.0.3
 release:
@@ -2993,3 +2993,14 @@ sys/kern/vfs_lookup.c1.208
 	in -r1.200.
 	[dh, ticket #1451]
 
+crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c 1.3-1.4
+
+	In _krb5_extract_ticket() the KDC-REP service name must be
+	obtained from encrypted version stored in 'enc_part' instead
+	of the unencrypted version stored in 'ticket'.
+	Use of the unecrypted version provides an opportunity for
+	successful server impersonation and other attacks.
+
+	Identified by Jeffrey Altman, Viktor Duchovni and Nico Williams.
+	[christos, ticket #1453]
+



CVS commit: src/sys/arch

2017-07-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Jul 12 16:59:41 UTC 2017

Modified Files:
src/sys/arch/amd64/conf: files.amd64
src/sys/arch/i386/conf: files.i386
src/sys/arch/x86/x86: pmc.c sys_machdep.c
src/sys/arch/xen/conf: files.compat

Log Message:
include opt_pmc.h


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/arch/amd64/conf/files.amd64
cvs rdiff -u -r1.378 -r1.379 src/sys/arch/i386/conf/files.i386
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/x86/x86/pmc.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/x86/x86/sys_machdep.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/xen/conf/files.compat

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/files.amd64
diff -u src/sys/arch/amd64/conf/files.amd64:1.88 src/sys/arch/amd64/conf/files.amd64:1.89
--- src/sys/arch/amd64/conf/files.amd64:1.88	Thu Dec 15 12:04:17 2016
+++ src/sys/arch/amd64/conf/files.amd64	Wed Jul 12 16:59:41 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.amd64,v 1.88 2016/12/15 12:04:17 kamil Exp $
+#	$NetBSD: files.amd64,v 1.89 2017/07/12 16:59:41 maxv Exp $
 #
 # new style config file for amd64 architecture
 #
@@ -24,6 +24,7 @@ defparam opt_physmem.h	PHYSMEM_MAX_ADDR 
 # with the i386 (they include the opt_*.h for these)
 #
 
+defflag			PMC
 defflag			USER_LDT
 defflag eisa.h EISA
 

Index: src/sys/arch/i386/conf/files.i386
diff -u src/sys/arch/i386/conf/files.i386:1.378 src/sys/arch/i386/conf/files.i386:1.379
--- src/sys/arch/i386/conf/files.i386:1.378	Fri Mar 10 14:40:56 2017
+++ src/sys/arch/i386/conf/files.i386	Wed Jul 12 16:59:41 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i386,v 1.378 2017/03/10 14:40:56 maxv Exp $
+#	$NetBSD: files.i386,v 1.379 2017/07/12 16:59:41 maxv Exp $
 #
 # new style config file for i386 architecture
 #
@@ -21,6 +21,8 @@ obsolete defflag	XBOX
 # VM86 emulation
 defflag			VM86
 
+defflag			PMC
+
 # User-settable LDT (used by WINE)
 defflag			USER_LDT
 

Index: src/sys/arch/x86/x86/pmc.c
diff -u src/sys/arch/x86/x86/pmc.c:1.8 src/sys/arch/x86/x86/pmc.c:1.9
--- src/sys/arch/x86/x86/pmc.c:1.8	Wed Jun 14 17:48:40 2017
+++ src/sys/arch/x86/x86/pmc.c	Wed Jul 12 16:59:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmc.c,v 1.8 2017/06/14 17:48:40 maxv Exp $	*/
+/*	$NetBSD: pmc.c,v 1.9 2017/07/12 16:59:41 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -67,7 +67,9 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmc.c,v 1.8 2017/06/14 17:48:40 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmc.c,v 1.9 2017/07/12 16:59:41 maxv Exp $");
+
+#include "opt_pmc.h"
 
 #include 
 #include 

Index: src/sys/arch/x86/x86/sys_machdep.c
diff -u src/sys/arch/x86/x86/sys_machdep.c:1.35 src/sys/arch/x86/x86/sys_machdep.c:1.36
--- src/sys/arch/x86/x86/sys_machdep.c:1.35	Fri Mar 10 14:54:12 2017
+++ src/sys/arch/x86/x86/sys_machdep.c	Wed Jul 12 16:59:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_machdep.c,v 1.35 2017/03/10 14:54:12 maxv Exp $	*/
+/*	$NetBSD: sys_machdep.c,v 1.36 2017/07/12 16:59:41 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007, 2009 The NetBSD Foundation, Inc.
@@ -30,9 +30,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.35 2017/03/10 14:54:12 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.36 2017/07/12 16:59:41 maxv Exp $");
 
 #include "opt_mtrr.h"
+#include "opt_pmc.h"
 #include "opt_user_ldt.h"
 #include "opt_compat_netbsd.h"
 #ifdef i386

Index: src/sys/arch/xen/conf/files.compat
diff -u src/sys/arch/xen/conf/files.compat:1.25 src/sys/arch/xen/conf/files.compat:1.26
--- src/sys/arch/xen/conf/files.compat:1.25	Tue Dec 13 10:54:27 2016
+++ src/sys/arch/xen/conf/files.compat	Wed Jul 12 16:59:41 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.compat,v 1.25 2016/12/13 10:54:27 kamil Exp $
+#	$NetBSD: files.compat,v 1.26 2017/07/12 16:59:41 maxv Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 
 # options for MP configuration through the MP spec
@@ -28,6 +28,8 @@ defflag	opt_pcifixup.h		XXXOPT_PCIFIXUP
 # VM86 emulation
 defflag	opt_vm86.h			XXXVM86
 
+defflag opt_pmc.h			XXXPMC
+
 # User-settable LDT (used by WINE)
 defflag	opt_user_ldt.h			XXXUSER_LDT
 



CVS commit: src

2017-07-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Jul 12 17:10:09 UTC 2017

Modified Files:
src/distrib/sets/lists/base: md.amd64
src/distrib/sets/lists/debug: md.amd64
src/usr.bin/pmc: Makefile

Log Message:
Build the pmc tool on amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.268 -r1.269 src/distrib/sets/lists/base/md.amd64
cvs rdiff -u -r1.96 -r1.97 src/distrib/sets/lists/debug/md.amd64
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/pmc/Makefile

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

Modified files:

Index: src/distrib/sets/lists/base/md.amd64
diff -u src/distrib/sets/lists/base/md.amd64:1.268 src/distrib/sets/lists/base/md.amd64:1.269
--- src/distrib/sets/lists/base/md.amd64:1.268	Tue Jan 24 11:09:14 2017
+++ src/distrib/sets/lists/base/md.amd64	Wed Jul 12 17:10:09 2017
@@ -1,9 +1,10 @@
-# $NetBSD: md.amd64,v 1.268 2017/01/24 11:09:14 nonaka Exp $
+# $NetBSD: md.amd64,v 1.269 2017/07/12 17:10:09 maxv Exp $
 ./dev/lms0	base-obsolete		obsolete
 ./dev/mms0	base-obsolete		obsolete
 ./libexec/ld.elf_so-i386			base-sys-shlib		compat,pic
 ./usr/bin/fdformatbase-util-bin
 ./usr/bin/iasl	base-util-bin
+./usr/bin/pmc	base-util-bin
 ./usr/lib/i386/libi386.so.1			base-compat-shlib	compat,pic
 ./usr/lib/i386/libi386.so.1.0			base-compat-shlib	compat,pic
 ./usr/lib/i386/libproc.so.0			base-compat-shlib	compat,pic,dtrace

Index: src/distrib/sets/lists/debug/md.amd64
diff -u src/distrib/sets/lists/debug/md.amd64:1.96 src/distrib/sets/lists/debug/md.amd64:1.97
--- src/distrib/sets/lists/debug/md.amd64:1.96	Sun May  7 02:05:56 2017
+++ src/distrib/sets/lists/debug/md.amd64	Wed Jul 12 17:10:09 2017
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.96 2017/05/07 02:05:56 kamil Exp $
+# $NetBSD: md.amd64,v 1.97 2017/07/12 17:10:09 maxv Exp $
 ./usr/lib/i386/12.202++_g.a			comp-c-debuglib		debuglib,compat,12.202xx
 ./usr/lib/i386/libi386_g.a			comp-c-debuglib		debuglib,compat
 ./usr/lib/i386/libiberty_g.a			comp-obsolete		obsolete
@@ -6,6 +6,7 @@
 ./usr/libdata/debug/libexec/ld.elf_so-i386.debug	comp-sys-debug		debug,compat
 ./usr/libdata/debug/usr/bin/fdformat.debug	comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/iasl.debug		comp-util-debug		debug
+./usr/libdata/debug/usr/bin/pmc.debug		comp-util-debug		debug
 ./usr/libdata/debug/usr/lib/i386/libi386.so.1.0.debug	comp-compat-shlib	compat,pic,debug
 ./usr/libdata/debug/usr/lib/i386/libpam.so.4.1.debug	comp-compat-shlib	compat,pic,debug,pam
 ./usr/libdata/debug/usr/lib/i386/libproc.so.0.0.debug	comp-compat-shlib	compat,pic,debug,dtrace

Index: src/usr.bin/pmc/Makefile
diff -u src/usr.bin/pmc/Makefile:1.4 src/usr.bin/pmc/Makefile:1.5
--- src/usr.bin/pmc/Makefile:1.4	Wed Mar  8 16:05:29 2017
+++ src/usr.bin/pmc/Makefile	Wed Jul 12 17:10:09 2017
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile,v 1.4 2017/03/08 16:05:29 maxv Exp $
+#	$NetBSD: Makefile,v 1.5 2017/07/12 17:10:09 maxv Exp $
 
-.if (${MACHINE_ARCH} == "i386")
+.if (${MACHINE_ARCH} == "i386") || (${MACHINE_ARCH} == "x86_64")
 PROG=	pmc
 .else
 MAN=	pmc.1



CVS commit: src/tests/lib/libc/locale

2017-07-12 Thread Konrad Schroder
Module Name:src
Committed By:   perseant
Date:   Wed Jul 12 17:32:51 UTC 2017

Modified Files:
src/tests/lib/libc/locale: t_btowc.c t_io.c t_mbrtowc.c t_mbstowcs.c
t_sprintf.c t_wcstod.c t_wctomb.c t_wctype.c

Log Message:
Add ISO10646 versions of these tests, conditional on __STDC_ISO_10646__ .
Also make the tests a bit more verbose, to aid debugging when they fail.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/locale/t_btowc.c \
src/tests/lib/libc/locale/t_mbrtowc.c \
src/tests/lib/libc/locale/t_mbstowcs.c \
src/tests/lib/libc/locale/t_wctype.c
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/locale/t_io.c \
src/tests/lib/libc/locale/t_wctomb.c
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/locale/t_sprintf.c
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/locale/t_wcstod.c

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

Modified files:

Index: src/tests/lib/libc/locale/t_btowc.c
diff -u src/tests/lib/libc/locale/t_btowc.c:1.1 src/tests/lib/libc/locale/t_btowc.c:1.2
--- src/tests/lib/libc/locale/t_btowc.c:1.1	Thu Jun  1 15:45:02 2017
+++ src/tests/lib/libc/locale/t_btowc.c	Wed Jul 12 17:32:51 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_btowc.c,v 1.1 2017/06/01 15:45:02 perseant Exp $ */
+/* $NetBSD: t_btowc.c,v 1.2 2017/07/12 17:32:51 perseant Exp $ */
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -32,11 +32,12 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2017\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_btowc.c,v 1.1 2017/06/01 15:45:02 perseant Exp $");
+__RCSID("$NetBSD: t_btowc.c,v 1.2 2017/07/12 17:32:51 perseant Exp $");
 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -85,18 +86,28 @@ static void
 h_iso10646(struct test *t)
 {
 	const char *cp;
-	unsigned char c;
+	int c, wc;
 	char *str;
 	const wchar_t *wcp;
 
+	ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C");
+	printf("Trying locale: %s\n", t->locale);
+	ATF_REQUIRE(setlocale(LC_CTYPE, t->locale) != NULL);
+	ATF_REQUIRE((str = setlocale(LC_ALL, NULL)) != NULL);
+	(void)printf("Using locale: %s\n", str);
+
 	/* These should have valid wchar representations */
 	for (cp = t->legal, wcp = t->wlegal; *cp != '\0'; ++cp, ++wcp) {
-		c = (unsigned char)*cp;
+		c = (int)(unsigned char)*cp;
 		printf("Checking legal character 0x%x\n", c);
+		wc = btowc(c);
+
+		if (errno != 0)
+			printf(" btowc() failed with errno=%d\n", errno);
 
 		/* It should map to the known Unicode equivalent */
 		printf("btowc(0x%2.2x) = 0x%x, expecting 0x%x\n",
-			c, btowc(c), *wcp);
+		   c, wc, *wcp);
 		ATF_REQUIRE(btowc(c) == *wcp);
 	}
 
@@ -120,6 +131,8 @@ h_btowc(struct test *t)
 	ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C");
 	printf("Trying locale: %s\n", t->locale);
 	ATF_REQUIRE(setlocale(LC_CTYPE, t->locale) != NULL);
+	ATF_REQUIRE((str = setlocale(LC_ALL, NULL)) != NULL);
+	(void)printf("Using locale: %s\n", str);
 
 	/* btowc(EOF) -> WEOF */
 	ATF_REQUIRE_EQ(btowc(EOF), WEOF);
Index: src/tests/lib/libc/locale/t_mbrtowc.c
diff -u src/tests/lib/libc/locale/t_mbrtowc.c:1.1 src/tests/lib/libc/locale/t_mbrtowc.c:1.2
--- src/tests/lib/libc/locale/t_mbrtowc.c:1.1	Fri Jul 15 07:35:21 2011
+++ src/tests/lib/libc/locale/t_mbrtowc.c	Wed Jul 12 17:32:51 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mbrtowc.c,v 1.1 2011/07/15 07:35:21 jruoho Exp $ */
+/* $NetBSD: t_mbrtowc.c,v 1.2 2017/07/12 17:32:51 perseant Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2011\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_mbrtowc.c,v 1.1 2011/07/15 07:35:21 jruoho Exp $");
+__RCSID("$NetBSD: t_mbrtowc.c,v 1.2 2017/07/12 17:32:51 perseant Exp $");
 
 #include 
 #include 
@@ -98,19 +98,31 @@ static struct test {
 }, {
 	"ja_JP.ISO2022-JP2",
 	"\033$BF|K\1348l\033(BA\033$B$\"\033(BB\033$B$$\033(B",
+#ifdef __STDC_ISO_10646__
+	{ 0x65E5, 0x672C, 0x8A9E, 0x41, 0x3042, 0x42, 0x3044 },
+#else
 	{ 0x4200467c, 0x42004b5c, 0x4200386c, 0x41, 0x42002422, 0x42, 0x42002424 },
+#endif
 	{ 5, 2, 2, 4, 5, 4, 5 },
 	7
 }, {
 	"ja_JP.SJIS",
 	"\223\372\226{\214\352A\202\240B\202\242",
-	{ 0x93fa, 0x967b, 0x8cea, 0x41, 0x82a0, 0x42, 0x82a2 },
+#ifdef __STDC_ISO_10646__
+	{ 0x65E5, 0x672C, 0x8A9E, 0x41, 0x3042, 0x42, 0x3044 },
+#else
+	{ 0x93FA, 0x967B, 0x8CEA, 0x41, 0x82A0, 0x42, 0x82A2 },
+#endif
 	{ 2, 2, 2, 1, 2, 1, 2 },
 	7
 }, {
 	"ja_JP.eucJP",
 	"\306\374\313\334\270\354A\244\242B\244\244",
-	{ 0xc6fc, 0xcbdc, 0xb8ec, 0x41, 0xa4a2, 0x42, 0xa4a4 },
+#ifdef __STDC_ISO_10646__
+	{ 0x65E5, 0x672C, 0x8A9E, 0x41, 0x3042, 0x42, 0x3044 },
+#else
+	{ 0xC6FC, 0xCBDC, 0xB8EC, 0x41, 0xA4A2, 0x42, 0xA4A4 },
+#endif
 	{ 2, 2, 2, 1, 2, 1, 2 },
 	7
 }, {
@@ -146,6 +158,8 @@ h_ctype2(const struct test *t, bool use_
 //	mbrtowc(0, 0, 0, &st); /* XXX for ISO2022-JP */
 	stp = use_mbstate ? &st : 0;
 
+	printf("First using

CVS commit: src

2017-07-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Jul 12 17:33:29 UTC 2017

Modified Files:
src/sys/arch/x86/include: sysarch.h
src/sys/arch/x86/x86: pmc.c
src/usr.bin/pmc: pmc.c

Log Message:
Properly handle overflows, and take them into account in userland.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/x86/include/sysarch.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/x86/x86/pmc.c
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/pmc/pmc.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/include/sysarch.h
diff -u src/sys/arch/x86/include/sysarch.h:1.11 src/sys/arch/x86/include/sysarch.h:1.12
--- src/sys/arch/x86/include/sysarch.h:1.11	Fri Mar 10 13:09:11 2017
+++ src/sys/arch/x86/include/sysarch.h	Wed Jul 12 17:33:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysarch.h,v 1.11 2017/03/10 13:09:11 maxv Exp $	*/
+/*	$NetBSD: sysarch.h,v 1.12 2017/07/12 17:33:29 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -134,6 +134,7 @@ struct _X86_SYSARCH_L(pmc_info_args) {
 	int vers;
 	int type;
 	uint32_t nctrs;
+	uint64_t nsamp;
 };
 
 #define	PMC_VERSION		1

Index: src/sys/arch/x86/x86/pmc.c
diff -u src/sys/arch/x86/x86/pmc.c:1.9 src/sys/arch/x86/x86/pmc.c:1.10
--- src/sys/arch/x86/x86/pmc.c:1.9	Wed Jul 12 16:59:41 2017
+++ src/sys/arch/x86/x86/pmc.c	Wed Jul 12 17:33:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmc.c,v 1.9 2017/07/12 16:59:41 maxv Exp $	*/
+/*	$NetBSD: pmc.c,v 1.10 2017/07/12 17:33:29 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -63,11 +63,17 @@
  */
 
 /*
- * Interface to x86 CPU Performance Counters.
+ * Interface to x86 CPU Performance Counters. System-wide only, for now.
+ *
+ * For each PMC on each CPU, two pieces of information are returned to userland:
+ * the number of overflows, and the current value of the PMC. It means that the
+ * total number of events for the given PMC on the given CPU is computable the
+ * following way:
+ * tot_n_events = NEVENTS_SAMPLE * overfl + ctrval
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmc.c,v 1.9 2017/07/12 16:59:41 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmc.c,v 1.10 2017/07/12 17:33:29 maxv Exp $");
 
 #include "opt_pmc.h"
 
@@ -83,7 +89,6 @@ __KERNEL_RCSID(0, "$NetBSD: pmc.c,v 1.9 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -92,8 +97,12 @@ __KERNEL_RCSID(0, "$NetBSD: pmc.c,v 1.9 
 
 #define NEVENTS_SAMPLE	50
 
+/*
+ * Structure describing a PMC.
+ */
 typedef struct {
 	bool running;
+	size_t n;		/* pmc number */
 	uint32_t evtmsr;	/* event selector MSR */
 	uint64_t evtval;	/* event selector value */
 	uint32_t ctrmsr;	/* counter MSR */
@@ -102,21 +111,36 @@ typedef struct {
 	uint64_t ctrmask;
 } pmc_state_t;
 
-static nmi_handler_t *pmc_nmi_handle;
-static uint32_t pmc_lapic_image[MAXCPUS];
+/*
+ * Per-CPU structure that describes the values of each PMC, plus the state
+ * of the LAPIC before enabling PMCs.
+ */
+typedef struct {
+	x86_pmc_cpuval_t val[PMC_NCOUNTERS];	/* values returned to user */ 
+	uint64_t nmioverfl[PMC_NCOUNTERS];	/* incremented by NMI intr */
+	uint32_t lapic_image;			/* saved content of LAPIC */
+} pmc_cpu_t;
 
-static x86_pmc_cpuval_t pmc_val_cpus[MAXCPUS] __aligned(CACHE_LINE_SIZE);
+static pmc_state_t pmc_state[PMC_NCOUNTERS];
+static pmc_cpu_t pmc_cpu[MAXCPUS];
+
+static nmi_handler_t *pmc_nmi_handle;
 static kmutex_t pmc_lock;
 
-static pmc_state_t pmc_state[PMC_NCOUNTERS];
 static uint32_t pmc_ncounters __read_mostly;
 static int pmc_type __read_mostly;
 
+/*
+ * Handle PMC overflows. Called from NMI interrupt context, with interrupts
+ * disabled.
+ */
 static int
 pmc_nmi(const struct trapframe *tf, void *dummy)
 {
 	struct cpu_info *ci = curcpu();
 	pmc_state_t *pmc;
+	pmc_cpu_t *cpu;
+	uint64_t ctr;
 	size_t i;
 
 	if (pmc_type == PMC_TYPE_NONE) {
@@ -127,7 +151,11 @@ pmc_nmi(const struct trapframe *tf, void
 		if (!pmc->running) {
 			continue;
 		}
-		/* XXX make sure it really comes from this PMC */
+		ctr = rdmsr(pmc->ctrmsr);
+		/* If the highest bit is zero, then it's this PMC */
+		if ((ctr & ((pmc->ctrmask + 1) >> 1)) != 0) {
+			continue;
+		}
 		break;
 	}
 	if (i == pmc_ncounters) {
@@ -135,7 +163,8 @@ pmc_nmi(const struct trapframe *tf, void
 	}
 
 	/* Count the overflow, and restart the counter */
-	pmc_val_cpus[cpu_index(ci)].overfl++;
+	cpu = &pmc_cpu[cpu_index(ci)];
+	cpu->nmioverfl[i]++;
 	wrmsr(pmc->ctrmsr, pmc->ctrinitval);
 
 	return 1;
@@ -146,9 +175,37 @@ pmc_read_cpu(void *arg1, void *arg2)
 {
 	pmc_state_t *pmc = (pmc_state_t *)arg1;
 	struct cpu_info *ci = curcpu();
+	pmc_cpu_t *cpu = &pmc_cpu[cpu_index(ci)];
+	uint64_t evtmsr, en;
+
+	switch (pmc_type) {
+	case PMC_TYPE_I686:
+		en = PMC6_EVTSEL_EN;
+		break;
 
-	pmc_val_cpus[cpu_index(ci)].ctrval =
+	case PMC_TYPE_K7:
+		en = K7_EVTSEL_EN;
+		break;
+
+	case PMC_TYPE_F10H:
+		en = F10H_EVTSEL_EN;

CVS commit: src/usr.bin/pmc

2017-07-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Jul 12 17:38:15 UTC 2017

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

Log Message:
Update.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/pmc/pmc.1

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

Modified files:

Index: src/usr.bin/pmc/pmc.1
diff -u src/usr.bin/pmc/pmc.1:1.11 src/usr.bin/pmc/pmc.1:1.12
--- src/usr.bin/pmc/pmc.1:1.11	Fri Mar 10 15:34:17 2017
+++ src/usr.bin/pmc/pmc.1	Wed Jul 12 17:38:15 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: pmc.1,v 1.11 2017/03/10 15:34:17 wiz Exp $
+.\"	$NetBSD: pmc.1,v 1.12 2017/07/12 17:38:15 maxv Exp $
 .\"
 .\" Copyright (c) 2017 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -58,7 +58,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 March 10, 2017
+.Dd July 12, 2017
 .Dt PMC 1
 .Os
 .Sh NAME
@@ -71,7 +71,8 @@
 .Sh DESCRIPTION
 The
 .Nm
-command can be used to control and inspect the state of CPUs in the system.
+tool can be used to control and inspect the state of the
+Performance-Monitoring Counters (PMCs) in the system.
 .Pp
 The first argument,
 .Ar command ,
@@ -97,22 +98,28 @@ values of these counters.
 .El
 .Sh EXAMPLES
 The following command prints the available counters.
-.Dl $ pmc list
+.Dl # pmc list
 .Pp
 The following command starts two counters.
 The former will count the 'l2cache-access' events that are triggered from
 userland, the latter will count the 'l1cache-access' events triggered from
 both userland and the kernel.
-.Dl $ pmc start l2cache-access:u l1cache-access:uk
+.Dl # pmc start l2cache-access:u l1cache-access:uk
 .Pp
 Note that the two following commands are not exactly identical.
-.Dl $ pmc start l1cache-access:u l1cache-access:k
-.Dl $ pmc start l1cache-access:uk
+.Dl # pmc start l1cache-access:u l1cache-access:k
+.Dl # pmc start l1cache-access:uk
 The former will start two different counters that have a different source but
 track the same event.
 The latter will start one counter that tracks the event from all sources;
 it therefore does the sum of the two counters from the first command, but
 takes only one counter to do so.
+.El
+.Sh INTERPRETING RESULTS
+For each PMC on each CPU, the value reported by the
+.Nm
+tool is the number of events counted, encoded in a 64bit integer.
+.El
 .Sh DIAGNOSTICS
 .Bl -diag
 .It PMC support not compiled into the kernel
@@ -125,6 +132,13 @@ See
 .Xr options 4
 for details.
 .El
+.Sh FILES
+.Pa src/sys/arch/x86/x86/pmc.c
+x86 implementation.
+.Pp
+.Pa src/usr.bin/pmc/pmc.c
+pmc tool.
+.El
 .Sh SEE ALSO
 .Xr options 4
 .Sh HISTORY
@@ -132,9 +146,10 @@ The
 .Nm
 command first appeared in
 .Nx 1.6 .
-It was revamped in 2017.
+It was revamped in
+.Nx 8.0 .
 .Sh BUGS
 The
 .Nm
 command currently only supports performance-monitoring counters
-on the i386 architecture.
+on the i386 and amd64 architectures.



CVS commit: src/sys/arch

2017-07-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Jul 12 17:40:34 UTC 2017

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

Log Message:
Enable PMCs by default.


To generate a diff of this commit:
cvs rdiff -u -r1.459 -r1.460 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.1156 -r1.1157 src/sys/arch/i386/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 src/sys/arch/amd64/conf/GENERIC:1.460
--- src/sys/arch/amd64/conf/GENERIC:1.459	Sat May 27 22:53:29 2017
+++ src/sys/arch/amd64/conf/GENERIC	Wed Jul 12 17:40:33 2017
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.459 2017/05/27 22:53:29 bouyer Exp $
+# $NetBSD: GENERIC,v 1.460 2017/07/12 17:40:33 maxv 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 $"
+#ident		"GENERIC-$Revision: 1.460 $"
 
 maxusers	64		# estimated number of users
 
@@ -81,7 +81,7 @@ est0		at cpu0		# Intel Enhanced SpeedSte
 powernow0	at cpu0		# AMD PowerNow! and Cool'n'Quiet (non-ACPI)
 vmt0		at cpu0		# VMware Tools
 
-#options 	PMC		# performance-monitoring counters support
+options 	PMC		# performance-monitoring counters support
 
 # Alternate buffer queue strategies for better responsiveness under high
 # disk I/O load.

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1156 src/sys/arch/i386/conf/GENERIC:1.1157
--- src/sys/arch/i386/conf/GENERIC:1.1156	Sat May 27 22:53:29 2017
+++ src/sys/arch/i386/conf/GENERIC	Wed Jul 12 17:40:34 2017
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1156 2017/05/27 22:53:29 bouyer Exp $
+# $NetBSD: GENERIC,v 1.1157 2017/07/12 17:40:34 maxv Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1156 $"
+#ident		"GENERIC-$Revision: 1.1157 $"
 
 maxusers	64		# estimated number of users
 
@@ -42,7 +42,7 @@ viac7temp*	at cpu?		# VIA C7 temperature
 vmt0		at cpu0		# VMware Tools
 
 options 	MTRR		# memory-type range register syscall support
-#options 	PMC		# performance-monitoring counters support
+options 	PMC		# performance-monitoring counters support
 
 options 	MULTIBOOT	# Multiboot support (see multiboot(8))
 



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

2017-07-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Jul 12 17:52:18 UTC 2017

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

Log Message:
rsp2, not 3


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amd64/include/tss.h

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

Modified files:

Index: src/sys/arch/amd64/include/tss.h
diff -u src/sys/arch/amd64/include/tss.h:1.5 src/sys/arch/amd64/include/tss.h:1.6
--- src/sys/arch/amd64/include/tss.h:1.5	Sun Oct 26 00:08:15 2008
+++ src/sys/arch/amd64/include/tss.h	Wed Jul 12 17:52:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: tss.h,v 1.5 2008/10/26 00:08:15 mrg Exp $	*/
+/*	$NetBSD: tss.h,v 1.6 2017/07/12 17:52:18 maxv Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -50,7 +50,7 @@ struct x86_64_tss {
 	uint32_t	tss_reserved1;
 	uint64_t	tss_rsp0;
 	uint64_t	tss_rsp1;
-	uint64_t	tss_rsp3;
+	uint64_t	tss_rsp2;
 	uint32_t	tss_reserved2;
 	uint32_t	tss_reserved3;
 	uint64_t	tss_ist[7];



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

2017-07-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jul 12 17:54:23 UTC 2017

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

Log Message:
make this compile with debug again (symnum uninitialized)


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/libexec/ld.elf_so/arch/x86_64/mdreloc.c

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

Modified files:

Index: src/libexec/ld.elf_so/arch/x86_64/mdreloc.c
diff -u src/libexec/ld.elf_so/arch/x86_64/mdreloc.c:1.42 src/libexec/ld.elf_so/arch/x86_64/mdreloc.c:1.43
--- src/libexec/ld.elf_so/arch/x86_64/mdreloc.c:1.42	Mon Jun 19 07:57:02 2017
+++ src/libexec/ld.elf_so/arch/x86_64/mdreloc.c	Wed Jul 12 13:54:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mdreloc.c,v 1.42 2017/06/19 11:57:02 joerg Exp $	*/
+/*	$NetBSD: mdreloc.c,v 1.43 2017/07/12 17:54:23 christos Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -68,7 +68,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: mdreloc.c,v 1.42 2017/06/19 11:57:02 joerg Exp $");
+__RCSID("$NetBSD: mdreloc.c,v 1.43 2017/07/12 17:54:23 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -91,6 +91,9 @@ caddr_t _rtld_bind(const Obj_Entry *, El
 static inline int _rtld_relocate_plt_object(const Obj_Entry *,
 const Elf_Rela *, Elf_Addr *);
 
+#define rdbg_symnum(obj, rela) \
+((obj)->strtab + (obj)->symtab[ELF_R_SYM((rela)->r_info)].st_name)
+
 void
 _rtld_setup_pltgot(const Obj_Entry *obj)
 {
@@ -180,7 +183,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			if (*where32 != tmp32)
 *where32 = tmp32;
 			rdbg(("32/32S %s in %s --> %p in %s",
-			obj->strtab + obj->symtab[symnum].st_name,
+			rdbg_symnum(obj, rela),
 			obj->path, (void *)(uintptr_t)*where32,
 			defobj->path));
 			break;
@@ -191,7 +194,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			if (*where64 != tmp64)
 *where64 = tmp64;
 			rdbg(("64 %s in %s --> %p in %s",
-			obj->strtab + obj->symtab[symnum].st_name,
+			rdbg_symnum(obj, rela),
 			obj->path, (void *)*where64, defobj->path));
 			break;
 		case R_TYPE(PC32):	/* word32 S + A - P */
@@ -201,7 +204,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			if (*where32 != tmp32)
 *where32 = tmp32;
 			rdbg(("PC32 %s in %s --> %p in %s",
-			obj->strtab + obj->symtab[symnum].st_name,
+			rdbg_symnum(obj, rela),
 			obj->path, (void *)(unsigned long)*where32,
 			defobj->path));
 			break;
@@ -211,7 +214,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			if (*where64 != tmp64)
 *where64 = tmp64;
 			rdbg(("64 %s in %s --> %p in %s",
-			obj->strtab + obj->symtab[symnum].st_name,
+			rdbg_symnum(obj, rela),
 			obj->path, (void *)*where64, defobj->path));
 			break;
 		case R_TYPE(RELATIVE):  /* word64 B + A */
@@ -231,7 +234,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			defobj->tlsoffset + rela->r_addend);
 
 			rdbg(("TPOFF64 %s in %s --> %p",
-			obj->strtab + obj->symtab[symnum].st_name,
+			rdbg_symnum(obj, rela),
 			obj->path, (void *)*where64));
 
 			break;
@@ -240,7 +243,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			*where64 = (Elf64_Addr)defobj->tlsindex;
 
 			rdbg(("DTPMOD64 %s in %s --> %p",
-			obj->strtab + obj->symtab[symnum].st_name,
+			rdbg_symnum(obj, rela),
 			obj->path, (void *)*where64));
 
 			break;
@@ -249,7 +252,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			*where64 = (Elf64_Addr)(def->st_value + rela->r_addend);
 
 			rdbg(("DTPOFF64 %s in %s --> %p",
-			obj->strtab + obj->symtab[symnum].st_name,
+			rdbg_symnum(obj, rela),
 			obj->path, (void *)*where64));
 
 			break;
@@ -264,8 +267,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			(u_long)ELF_R_SYM(rela->r_info),
 			(u_long)ELF_R_TYPE(rela->r_info),
 			(void *)rela->r_offset, (void *)rela->r_addend,
-			(void *)*where64,
-			obj->strtab + obj->symtab[symnum].st_name));
+			(void *)*where64, rdbg_symnum(obj, rela)));
 			_rtld_error("%s: Unsupported relocation type %ld "
 			"in non-PLT relocations",
 			obj->path, (u_long) ELF_R_TYPE(rela->r_info));



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

2017-07-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jul 12 17:55:24 UTC 2017

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

Log Message:
rename the macro


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/libexec/ld.elf_so/arch/x86_64/mdreloc.c

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

Modified files:

Index: src/libexec/ld.elf_so/arch/x86_64/mdreloc.c
diff -u src/libexec/ld.elf_so/arch/x86_64/mdreloc.c:1.43 src/libexec/ld.elf_so/arch/x86_64/mdreloc.c:1.44
--- src/libexec/ld.elf_so/arch/x86_64/mdreloc.c:1.43	Wed Jul 12 13:54:23 2017
+++ src/libexec/ld.elf_so/arch/x86_64/mdreloc.c	Wed Jul 12 13:55:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mdreloc.c,v 1.43 2017/07/12 17:54:23 christos Exp $	*/
+/*	$NetBSD: mdreloc.c,v 1.44 2017/07/12 17:55:24 christos Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -68,7 +68,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: mdreloc.c,v 1.43 2017/07/12 17:54:23 christos Exp $");
+__RCSID("$NetBSD: mdreloc.c,v 1.44 2017/07/12 17:55:24 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -91,7 +91,7 @@ caddr_t _rtld_bind(const Obj_Entry *, El
 static inline int _rtld_relocate_plt_object(const Obj_Entry *,
 const Elf_Rela *, Elf_Addr *);
 
-#define rdbg_symnum(obj, rela) \
+#define rdbg_symname(obj, rela) \
 ((obj)->strtab + (obj)->symtab[ELF_R_SYM((rela)->r_info)].st_name)
 
 void
@@ -183,7 +183,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			if (*where32 != tmp32)
 *where32 = tmp32;
 			rdbg(("32/32S %s in %s --> %p in %s",
-			rdbg_symnum(obj, rela),
+			rdbg_symname(obj, rela),
 			obj->path, (void *)(uintptr_t)*where32,
 			defobj->path));
 			break;
@@ -194,7 +194,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			if (*where64 != tmp64)
 *where64 = tmp64;
 			rdbg(("64 %s in %s --> %p in %s",
-			rdbg_symnum(obj, rela),
+			rdbg_symname(obj, rela),
 			obj->path, (void *)*where64, defobj->path));
 			break;
 		case R_TYPE(PC32):	/* word32 S + A - P */
@@ -204,7 +204,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			if (*where32 != tmp32)
 *where32 = tmp32;
 			rdbg(("PC32 %s in %s --> %p in %s",
-			rdbg_symnum(obj, rela),
+			rdbg_symname(obj, rela),
 			obj->path, (void *)(unsigned long)*where32,
 			defobj->path));
 			break;
@@ -214,7 +214,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			if (*where64 != tmp64)
 *where64 = tmp64;
 			rdbg(("64 %s in %s --> %p in %s",
-			rdbg_symnum(obj, rela),
+			rdbg_symname(obj, rela),
 			obj->path, (void *)*where64, defobj->path));
 			break;
 		case R_TYPE(RELATIVE):  /* word64 B + A */
@@ -234,7 +234,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			defobj->tlsoffset + rela->r_addend);
 
 			rdbg(("TPOFF64 %s in %s --> %p",
-			rdbg_symnum(obj, rela),
+			rdbg_symname(obj, rela),
 			obj->path, (void *)*where64));
 
 			break;
@@ -243,7 +243,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			*where64 = (Elf64_Addr)defobj->tlsindex;
 
 			rdbg(("DTPMOD64 %s in %s --> %p",
-			rdbg_symnum(obj, rela),
+			rdbg_symname(obj, rela),
 			obj->path, (void *)*where64));
 
 			break;
@@ -252,7 +252,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			*where64 = (Elf64_Addr)(def->st_value + rela->r_addend);
 
 			rdbg(("DTPOFF64 %s in %s --> %p",
-			rdbg_symnum(obj, rela),
+			rdbg_symname(obj, rela),
 			obj->path, (void *)*where64));
 
 			break;
@@ -267,7 +267,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			(u_long)ELF_R_SYM(rela->r_info),
 			(u_long)ELF_R_TYPE(rela->r_info),
 			(void *)rela->r_offset, (void *)rela->r_addend,
-			(void *)*where64, rdbg_symnum(obj, rela)));
+			(void *)*where64, rdbg_symname(obj, rela)));
 			_rtld_error("%s: Unsupported relocation type %ld "
 			"in non-PLT relocations",
 			obj->path, (u_long) ELF_R_TYPE(rela->r_info));



CVS commit: [netbsd-7-1] src/sys/external/bsd/ipf/netinet

2017-07-12 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Wed Jul 12 18:50:44 UTC 2017

Modified Files:
src/sys/external/bsd/ipf/netinet [netbsd-7-1]: fil.c ip_frag.c
ip_state.c

Log Message:
Pull up the following revisions(s) (requested by christos in ticket #1412):
sys/external/bsd/ipf/netinet/fil.c: revision 1.20
sys/external/bsd/ipf/netinet/ip_state.c:revision 1.7
sys/external/bsd/ipf/netinet/ip_frag.c: revision 1.5

Disconnect maintaining fragment state from keeping session state. The user
now must specify keep frags along with keep state to have ipfilter do what
it did before, as documented in ipf.conf.5.
Free the right fragment. This will cause use after free issues and eventually
panic.


To generate a diff of this commit:
cvs rdiff -u -r1.15.2.2 -r1.15.2.2.4.1 src/sys/external/bsd/ipf/netinet/fil.c
cvs rdiff -u -r1.3 -r1.3.24.1 src/sys/external/bsd/ipf/netinet/ip_frag.c
cvs rdiff -u -r1.6 -r1.6.16.1 src/sys/external/bsd/ipf/netinet/ip_state.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/external/bsd/ipf/netinet/fil.c
diff -u src/sys/external/bsd/ipf/netinet/fil.c:1.15.2.2 src/sys/external/bsd/ipf/netinet/fil.c:1.15.2.2.4.1
--- src/sys/external/bsd/ipf/netinet/fil.c:1.15.2.2	Fri Apr 29 19:00:40 2016
+++ src/sys/external/bsd/ipf/netinet/fil.c	Wed Jul 12 18:50:44 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fil.c,v 1.15.2.2 2016/04/29 19:00:40 snj Exp $	*/
+/*	$NetBSD: fil.c,v 1.15.2.2.4.1 2017/07/12 18:50:44 sborrill Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -138,7 +138,7 @@ extern struct timeout ipf_slowtimer_ch;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.15.2.2 2016/04/29 19:00:40 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.15.2.2.4.1 2017/07/12 18:50:44 sborrill Exp $");
 #else
 static const char sccsid[] = "@(#)fil.c	1.36 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: fil.c,v 1.1.1.2 2012/07/22 13:45:07 darrenr Exp $";
@@ -2689,7 +2689,7 @@ ipf_firewall(fr_info_t *fin, u_32_t *pas
 	 * If the rule has "keep frag" and the packet is actually a fragment,
 	 * then create a fragment state entry.
 	 */
-	if ((pass & (FR_KEEPFRAG|FR_KEEPSTATE)) == FR_KEEPFRAG) {
+	if (pass & FR_KEEPFRAG) {
 		if (fin->fin_flx & FI_FRAG) {
 			if (ipf_frag_new(softc, fin, pass) == -1) {
 LBUMP(ipf_stats[out].fr_bnfr);

Index: src/sys/external/bsd/ipf/netinet/ip_frag.c
diff -u src/sys/external/bsd/ipf/netinet/ip_frag.c:1.3 src/sys/external/bsd/ipf/netinet/ip_frag.c:1.3.24.1
--- src/sys/external/bsd/ipf/netinet/ip_frag.c:1.3	Sun Jul 22 14:27:51 2012
+++ src/sys/external/bsd/ipf/netinet/ip_frag.c	Wed Jul 12 18:50:44 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_frag.c,v 1.3 2012/07/22 14:27:51 darrenr Exp $	*/
+/*	$NetBSD: ip_frag.c,v 1.3.24.1 2017/07/12 18:50:44 sborrill Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -87,7 +87,7 @@ struct file;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_frag.c,v 1.3 2012/07/22 14:27:51 darrenr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_frag.c,v 1.3.24.1 2017/07/12 18:50:44 sborrill Exp $");
 #else
 static const char sccsid[] = "@(#)ip_frag.c	1.11 3/24/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_frag.c,v 1.1.1.2 2012/07/22 13:45:17 darrenr Exp";
@@ -468,7 +468,7 @@ ipfr_frag_new(
 			  IPFR_CMPSZ)) {
 			RWLOCK_EXIT(lock);
 			FBUMPD(ifs_exists);
-			KFREE(fra);
+			KFREE(fran);
 			return NULL;
 		}
 

Index: src/sys/external/bsd/ipf/netinet/ip_state.c
diff -u src/sys/external/bsd/ipf/netinet/ip_state.c:1.6 src/sys/external/bsd/ipf/netinet/ip_state.c:1.6.16.1
--- src/sys/external/bsd/ipf/netinet/ip_state.c:1.6	Sat Sep 14 12:16:11 2013
+++ src/sys/external/bsd/ipf/netinet/ip_state.c	Wed Jul 12 18:50:44 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_state.c,v 1.6 2013/09/14 12:16:11 martin Exp $	*/
+/*	$NetBSD: ip_state.c,v 1.6.16.1 2017/07/12 18:50:44 sborrill Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -100,7 +100,7 @@ struct file;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_state.c,v 1.6 2013/09/14 12:16:11 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_state.c,v 1.6.16.1 2017/07/12 18:50:44 sborrill Exp $");
 #else
 static const char sccsid[] = "@(#)ip_state.c	1.8 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_state.c,v 1.1.1.2 2012/07/22 13:45:37 darrenr Exp";
@@ -3341,7 +3341,8 @@ ipf_state_check(fr_info_t *fin, u_32_t *
 	 * If this packet is a fragment and the rule says to track fragments,
 	 * then create a new fragment cache entry.
 	 */
-	if ((fin->fin_flx & FI_FRAG) && FR_ISPASS(is->is_pass))
+	if (fin->fin_flx & FI_FRAG && FR_ISPASS(is->is_pass) &&
+	   is->is_pass & FR_KEEPFRAG)
 		(void) ipf_frag_new(softc, fin, is->is_pass);
 
 	/*



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

2017-07-12 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Wed Jul 12 18:52:40 UTC 2017

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

Log Message:
Ticket #1412


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.15 -r1.1.2.16 src/doc/CHANGES-7.1.1

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

Modified files:

Index: src/doc/CHANGES-7.1.1
diff -u src/doc/CHANGES-7.1.1:1.1.2.15 src/doc/CHANGES-7.1.1:1.1.2.16
--- src/doc/CHANGES-7.1.1:1.1.2.15	Wed Jul 12 15:36:25 2017
+++ src/doc/CHANGES-7.1.1	Wed Jul 12 18:52:40 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1.1,v 1.1.2.15 2017/07/12 15:36:25 martin Exp $
+# $NetBSD: CHANGES-7.1.1,v 1.1.2.16 2017/07/12 18:52:40 sborrill Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.1.1
 release:
@@ -1697,3 +1697,14 @@ crypto/external/bsd/heimdal/dist/lib/krb
 	Identified by Jeffrey Altman, Viktor Duchovni and Nico Williams.
 	[christos, ticket #1453]
 
+sys/external/bsd/ipf/netinet/fil.c		1.20
+sys/external/bsd/ipf/netinet/ip_state.c		1.7
+sys/external/bsd/ipf/netinet/ip_frag.c		1.5
+
+	Disconnect maintaining fragment state from keeping session state.
+	The user now must specify keep frags along with keep state to have 
+	ipfilter do what it did before, as documented in ipf.conf.5.
+	Free the right fragment. This will cause use after free issues and
+	eventually panic.
+	[christos, ticket #1412]
+



CVS commit: src/bin/sh

2017-07-12 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Jul 12 19:06:16 UTC 2017

Modified Files:
src/bin/sh: var.c

Log Message:
Fix a reference after free (and consequent nonsense diagnostic for
attempts to set readonly variables) I added in 1.60 by incompletely
copying the FreeBSD fix for the lost memory issue.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/bin/sh/var.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/var.c
diff -u src/bin/sh/var.c:1.64 src/bin/sh/var.c:1.65
--- src/bin/sh/var.c:1.64	Wed Jul  5 20:00:27 2017
+++ src/bin/sh/var.c	Wed Jul 12 19:06:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.64 2017/07/05 20:00:27 kre Exp $	*/
+/*	$NetBSD: var.c,v 1.65 2017/07/12 19:06:16 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: var.c,v 1.64 2017/07/05 20:00:27 kre Exp $");
+__RCSID("$NetBSD: var.c,v 1.65 2017/07/12 19:06:16 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -431,7 +431,7 @@ setvareq(char *s, int flags)
 ckfree(s);
 			if (flags & VNOERROR)
 return;
-			error("%.*s: is read only", vp->name_len, s);
+			error("%.*s: is read only", vp->name_len, vp->text);
 		}
 		if (flags & VNOSET) {
 			if ((flags & (VTEXTFIXED|VSTACK)) == 0)



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

2017-07-12 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Thu Jul 13 00:44:14 UTC 2017

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

Log Message:
PR/52266: Before access MSR[APICBASE], need to check if APIC is present.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/x86/x86/lapic.c

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

Modified files:

Index: src/sys/arch/x86/x86/lapic.c
diff -u src/sys/arch/x86/x86/lapic.c:1.59 src/sys/arch/x86/x86/lapic.c:1.60
--- src/sys/arch/x86/x86/lapic.c:1.59	Sat Jul  8 14:35:33 2017
+++ src/sys/arch/x86/x86/lapic.c	Thu Jul 13 00:44:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lapic.c,v 1.59 2017/07/08 14:35:33 nonaka Exp $	*/
+/*	$NetBSD: lapic.c,v 1.60 2017/07/13 00:44:14 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.59 2017/07/08 14:35:33 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.60 2017/07/13 00:44:14 nonaka Exp $");
 
 #include "acpica.h"
 #include "ioapic.h"
@@ -237,7 +237,8 @@ lapic_is_x2apic(void)
 {
 	uint64_t msr;
 
-	if (rdmsr_safe(MSR_APICBASE, &msr) == EFAULT)
+	if (!ISSET(cpu_feature[0], CPUID_APIC) ||
+	rdmsr_safe(MSR_APICBASE, &msr) == EFAULT)
 		return false;
 	return (msr & (APICBASE_EN | APICBASE_EXTD)) ==
 	(APICBASE_EN | APICBASE_EXTD);



CVS commit: src/sys/conf

2017-07-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jul 13 01:17:03 UTC 2017

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

Log Message:
Add support for dts files outside of external/gpl2.


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

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

Modified files:

Index: src/sys/conf/Makefile.kern.inc
diff -u src/sys/conf/Makefile.kern.inc:1.258 src/sys/conf/Makefile.kern.inc:1.259
--- src/sys/conf/Makefile.kern.inc:1.258	Sat Jun 17 17:08:49 2017
+++ src/sys/conf/Makefile.kern.inc	Thu Jul 13 01:17:03 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.kern.inc,v 1.258 2017/06/17 17:08:49 christos Exp $
+#	$NetBSD: Makefile.kern.inc,v 1.259 2017/07/13 01:17:03 jmcneill Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -537,17 +537,18 @@ build_kernel: .USE
 # Begin DTS handling
 
 DTSINC?=$S/external/gpl2/dts/dist/include
-DTSPATH?=$S/external/gpl2/dts/dist/arch/${MACHINE_CPU}/boot/dts
+DTSGNUPATH?=$S/external/gpl2/dts/dist/arch/${MACHINE_CPU}/boot/dts
+DTSPATH?=$S/arch/${MACHINE_CPU}/dts
 DTSPADDING?=1024
 
 .SUFFIXES: .dtb .dts
 .dts.dtb:
-	${CPP} -P -xassembler-with-cpp -I ${DTSINC} -I ${DTSPATH} \
+	${CPP} -P -xassembler-with-cpp -I ${DTSINC} -I ${DTSPATH} -I ${DTSGNUPATH} \
 	-include ${.IMPSRC} /dev/null | \
-	${TOOL_DTC} -i ${DTSINC} -i ${DTSPATH} -I dts -O dtb \
+	${TOOL_DTC} -i ${DTSINC} -i ${DTSPATH} -i ${DTSGNUPATH} -I dts -O dtb \
 	-p ${DTSPADDING} -b 0 -o ${.TARGET}
 
-.PATH.dts: ${DTSPATH}
+.PATH.dts: ${DTSPATH} ${DTSGNUPATH}
 
 DTB= ${DTS:.dts=.dtb}
 all: ${DTB}



CVS commit: src/sys/arch/arm/dts

2017-07-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jul 13 01:17:58 UTC 2017

Added Files:
src/sys/arch/arm/dts: sun8i-h3-nanopi-neo.dts
sun8i-h3-orangepi-plus2e.dts sun8i-h3.dtsi

Log Message:
Add local patches to sun8i-h3-orangepi-plus2e and sun8i-h3-nanopi-neo to
enable ethernet support.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/dts/sun8i-h3-nanopi-neo.dts \
src/sys/arch/arm/dts/sun8i-h3-orangepi-plus2e.dts \
src/sys/arch/arm/dts/sun8i-h3.dtsi

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

Added files:

Index: src/sys/arch/arm/dts/sun8i-h3-nanopi-neo.dts
diff -u /dev/null src/sys/arch/arm/dts/sun8i-h3-nanopi-neo.dts:1.1
--- /dev/null	Thu Jul 13 01:17:58 2017
+++ src/sys/arch/arm/dts/sun8i-h3-nanopi-neo.dts	Thu Jul 13 01:17:58 2017
@@ -0,0 +1,43 @@
+/* $NetBSD: sun8i-h3-nanopi-neo.dts,v 1.1 2017/07/13 01:17:58 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2017 Jared McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "../../../external/gpl2/dts/dist/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts"
+#include "sun8i-h3.dtsi"
+
+&emac {
+	phy-mode = "mii";
+	phy = <&phy1>;
+
+	allwinner,use-internal-phy;
+	allwinner,leds-active-low;
+	status = "okay";
+
+	phy1: ethernet-phy@1 {
+		reg = <1>;
+	};
+};
Index: src/sys/arch/arm/dts/sun8i-h3-orangepi-plus2e.dts
diff -u /dev/null src/sys/arch/arm/dts/sun8i-h3-orangepi-plus2e.dts:1.1
--- /dev/null	Thu Jul 13 01:17:58 2017
+++ src/sys/arch/arm/dts/sun8i-h3-orangepi-plus2e.dts	Thu Jul 13 01:17:58 2017
@@ -0,0 +1,59 @@
+/* $NetBSD: sun8i-h3-orangepi-plus2e.dts,v 1.1 2017/07/13 01:17:58 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2017 Jared McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "../../../external/gpl2/dts/dist/arch/arm/boot/dts/sun8i-h3-orangepi-plus2e.dts"
+#include "sun8i-h3.dtsi"
+
+/ {
+	reg_gmac_3v3: gmac-3v3 {
+		compatible = "regulator-fixed";
+		pinctrl-names = "default";
+		pinctrl-0 = <&emac_phy_reset_pin>;
+		regulator-name = "gmac-3v3";
+		regulator-min-microvolt = <330>;
+		regulator-max-microvolt = <330>;
+		startup-delay-us = <10>;
+		enable-active-high;
+		gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
+	};
+};
+
+&emac {
+	pinctrl-names = "default";
+	pinctrl-0 = <&emac_pins_rgmii_a>;
+	phy-supply = <®_gmac_3v3>;
+	phy-mode = "rgmii";
+	phy = <&phy1>;
+
+	allwinner,leds-active-low;
+	status = "okay";
+
+	phy1: 

CVS commit: src/sys/netipsec

2017-07-12 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Jul 13 01:22:44 UTC 2017

Modified Files:
src/sys/netipsec: ipsec_output.c key.c key.h

Log Message:
Simplify; omit unnecessary saidx passing

- ipsec_nextisr returns a saidx but no caller uses it
- key_checkrequest is passed a saidx but it can be gotton by
  another argument (isr)


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/netipsec/ipsec_output.c
cvs rdiff -u -r1.180 -r1.181 src/sys/netipsec/key.c
cvs rdiff -u -r1.20 -r1.21 src/sys/netipsec/key.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/ipsec_output.c
diff -u src/sys/netipsec/ipsec_output.c:1.51 src/sys/netipsec/ipsec_output.c:1.52
--- src/sys/netipsec/ipsec_output.c:1.51	Wed Jul 12 07:00:40 2017
+++ src/sys/netipsec/ipsec_output.c	Thu Jul 13 01:22:44 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec_output.c,v 1.51 2017/07/12 07:00:40 ozaki-r Exp $	*/
+/*	$NetBSD: ipsec_output.c,v 1.52 2017/07/13 01:22:44 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.51 2017/07/12 07:00:40 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.52 2017/07/13 01:22:44 ozaki-r Exp $");
 
 /*
  * IPsec output processing.
@@ -293,7 +293,6 @@ ipsec_nextisr(
 	struct mbuf *m,
 	struct ipsecrequest *isr,
 	int af,
-	struct secasindex *saidx,
 	int *error
 )
 {
@@ -313,6 +312,7 @@ do {	\
 } while (/*CONSTCOND*/0)
 
 	struct secasvar *sav;
+	struct secasindex *saidx;
 
 	IPSEC_SPLASSERT_SOFTNET("ipsec_nextisr");
 	KASSERTMSG(af == AF_INET || af == AF_INET6,
@@ -323,7 +323,7 @@ again:
 	 * we only fillin unspecified SA peers for transport
 	 * mode; for tunnel mode they must already be filled in.
 	 */
-	*saidx = isr->saidx;
+	saidx = &isr->saidx;
 	if (isr->saidx.mode == IPSEC_MODE_TRANSPORT) {
 		/* Fillin unspecified SA peers only for transport mode */
 		if (af == AF_INET) {
@@ -380,7 +380,7 @@ again:
 	/*
 	 * Lookup SA and validate it.
 	 */
-	*error = key_checkrequest(isr, saidx);
+	*error = key_checkrequest(isr);
 	if (*error != 0) {
 		/*
 		 * IPsec processing is required, but no SA found.
@@ -442,7 +442,6 @@ bad:
 int
 ipsec4_process_packet(struct mbuf *m, struct ipsecrequest *isr)
 {
-	struct secasindex saidx;
 	struct secasvar *sav;
 	struct ip *ip;
 	int s, error, i, off;
@@ -454,7 +453,7 @@ ipsec4_process_packet(struct mbuf *m, st
 
 	s = splsoftnet();			/* insure SA contents don't change */
 
-	isr = ipsec_nextisr(m, isr, AF_INET, &saidx, &error);
+	isr = ipsec_nextisr(m, isr, AF_INET, &error);
 	if (isr == NULL) {
 		if (error != 0) {
 			goto bad;
@@ -674,7 +673,6 @@ ipsec6_process_packet(
  	struct ipsecrequest *isr
 )
 {
-	struct secasindex saidx;
 	struct secasvar *sav;
 	struct ip6_hdr *ip6;
 	int s, error, i, off;
@@ -685,7 +683,7 @@ ipsec6_process_packet(
 
 	s = splsoftnet();   /* insure SA contents don't change */
 
-	isr = ipsec_nextisr(m, isr, AF_INET6, &saidx, &error);
+	isr = ipsec_nextisr(m, isr, AF_INET6, &error);
 	if (isr == NULL) {
 		if (error != 0) {
 			/* XXX Should we send a notification ? */

Index: src/sys/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.180 src/sys/netipsec/key.c:1.181
--- src/sys/netipsec/key.c:1.180	Wed Jul 12 07:33:37 2017
+++ src/sys/netipsec/key.c	Thu Jul 13 01:22:44 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.180 2017/07/12 07:33:37 ozaki-r Exp $	*/
+/*	$NetBSD: key.c,v 1.181 2017/07/13 01:22:44 ozaki-r 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.180 2017/07/12 07:33:37 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.181 2017/07/13 01:22:44 ozaki-r Exp $");
 
 /*
  * This code is referd to RFC 2367
@@ -838,14 +838,14 @@ done:
  *	ENOENT: policy may be valid, but SA with REQUIRE is on acquiring.
  */
 int
-key_checkrequest(struct ipsecrequest *isr, const struct secasindex *saidx)
+key_checkrequest(struct ipsecrequest *isr)
 {
 	u_int level;
 	int error;
 	struct secasvar *oldsav = NULL;
+	const struct secasindex *saidx = &isr->saidx;
 
 	KASSERT(isr != NULL);
-	KASSERT(saidx != NULL);
 	KASSERTMSG(saidx->mode == IPSEC_MODE_TRANSPORT ||
 	saidx->mode == IPSEC_MODE_TUNNEL,
 	"unexpected policy %u", saidx->mode);

Index: src/sys/netipsec/key.h
diff -u src/sys/netipsec/key.h:1.20 src/sys/netipsec/key.h:1.21
--- src/sys/netipsec/key.h:1.20	Fri Jul  7 01:37:34 2017
+++ src/sys/netipsec/key.h	Thu Jul 13 01:22:44 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.h,v 1.20 2017/07/07 01:37:34 ozaki-r Exp $	*/
+/*	$NetBSD: key.h,v 1.21 2017/07/13 01:22:44 ozaki-r Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/key.h,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $	*/
 /*	$KAME: key.h,v 1.21 2001/07/27 03:51:30 itojun Exp $

CVS commit: src/sys/netipsec

2017-07-12 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Jul 13 01:48:52 UTC 2017

Modified Files:
src/sys/netipsec: ipsec_output.c

Log Message:
Fix splx isn't called on some error paths


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 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.52 src/sys/netipsec/ipsec_output.c:1.53
--- src/sys/netipsec/ipsec_output.c:1.52	Thu Jul 13 01:22:44 2017
+++ src/sys/netipsec/ipsec_output.c	Thu Jul 13 01:48:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec_output.c,v 1.52 2017/07/13 01:22:44 ozaki-r Exp $	*/
+/*	$NetBSD: ipsec_output.c,v 1.53 2017/07/13 01:48:52 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.52 2017/07/13 01:22:44 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.53 2017/07/13 01:48:52 ozaki-r Exp $");
 
 /*
  * IPsec output processing.
@@ -712,14 +712,17 @@ ipsec6_process_packet(
 		struct mbuf *mp;
 
 		/* Fix IPv6 header payload length. */
-		if (m->m_len < sizeof(struct ip6_hdr))
-			if ((m = m_pullup(m,sizeof(struct ip6_hdr))) == NULL)
-return ENOBUFS;
+		if (m->m_len < sizeof(struct ip6_hdr)) {
+			if ((m = m_pullup(m,sizeof(struct ip6_hdr))) == NULL) {
+error = ENOBUFS;
+goto bad;
+			}
+		}
 
 		if (m->m_pkthdr.len - sizeof(*ip6) > IPV6_MAXPACKET) {
 			/* No jumbogram support. */
-			m_freem(m);
-			return ENXIO;   /*XXX*/
+			error = ENXIO;   /*XXX*/
+			goto bad;
 		}
 
 		ip6 = mtod(m, struct ip6_hdr *);



CVS commit: src/sys/netipsec

2017-07-12 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Jul 13 03:00:46 UTC 2017

Modified Files:
src/sys/netipsec: xform_esp.c

Log Message:
Fix header size calculation of esp where sav is NULL


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/netipsec/xform_esp.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/xform_esp.c
diff -u src/sys/netipsec/xform_esp.c:1.59 src/sys/netipsec/xform_esp.c:1.60
--- src/sys/netipsec/xform_esp.c:1.59	Mon Jul 10 07:17:12 2017
+++ src/sys/netipsec/xform_esp.c	Thu Jul 13 03:00:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_esp.c,v 1.59 2017/07/10 07:17:12 ozaki-r Exp $	*/
+/*	$NetBSD: xform_esp.c,v 1.60 2017/07/13 03:00:46 ozaki-r Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/xform_esp.c,v 1.2.2.1 2003/01/24 05:11:36 sam Exp $	*/
 /*	$OpenBSD: ip_esp.c,v 1.69 2001/06/26 06:18:59 angelos Exp $ */
 
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.59 2017/07/10 07:17:12 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.60 2017/07/13 03:00:46 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -163,7 +163,8 @@ esp_hdrsiz(const struct secasvar *sav)
 		 * + sizeof(next header field)
 		 * + max icv supported.
 		 */
-		size = sizeof(struct newesp) + esp_max_ivlen + 9 + 16;
+		size = sizeof(struct newesp) + esp_max_ivlen + 9 +
+		ah_hdrsiz(NULL);
 	}
 	return size;
 }



CVS commit: src/sys/netipsec

2017-07-12 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Jul 13 03:25:38 UTC 2017

Modified Files:
src/sys/netipsec: xform_ah.c

Log Message:
Fix header size calculation of ah in the case sav is NULL

This fix was also needed for esp.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/netipsec/xform_ah.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/xform_ah.c
diff -u src/sys/netipsec/xform_ah.c:1.58 src/sys/netipsec/xform_ah.c:1.59
--- src/sys/netipsec/xform_ah.c:1.58	Mon Jul 10 07:17:12 2017
+++ src/sys/netipsec/xform_ah.c	Thu Jul 13 03:25:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_ah.c,v 1.58 2017/07/10 07:17:12 ozaki-r Exp $	*/
+/*	$NetBSD: xform_ah.c,v 1.59 2017/07/13 03:25:38 ozaki-r Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/xform_ah.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $	*/
 /*	$OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */
 /*
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.58 2017/07/10 07:17:12 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.59 2017/07/13 03:25:38 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -164,7 +164,8 @@ ah_hdrsiz(const struct secasvar *sav)
 		size = roundup(authsize, sizeof(uint32_t)) + HDRSIZE(sav);
 	} else {
 		/* default guess */
-		size = sizeof(struct ah) + sizeof(uint32_t) + 16;
+		size = sizeof(struct ah) + sizeof(uint32_t) +
+		32 /* XXX need to update when max authsize is changed */;
 	}
 	return size;
 }