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

2017-07-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jul 14 06:33:26 UTC 2017

Modified Files:
src/sys/arch/arm/cortex: gic.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/arm/cortex/gic.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/arm/cortex/gic.c
diff -u src/sys/arch/arm/cortex/gic.c:1.30 src/sys/arch/arm/cortex/gic.c:1.31
--- src/sys/arch/arm/cortex/gic.c:1.30	Thu Jun 29 00:11:28 2017
+++ src/sys/arch/arm/cortex/gic.c	Fri Jul 14 06:33:26 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: gic.c,v 1.30 2017/06/29 00:11:28 jmcneill Exp $	*/
+/*	$NetBSD: gic.c,v 1.31 2017/07/14 06:33:26 skrll Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,14 +34,14 @@
 #define _INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.30 2017/06/29 00:11:28 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.31 2017/07/14 06:33:26 skrll Exp $");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 



CVS commit: [netbsd-6-0] src/usr.sbin/rtadvd

2017-07-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jul 14 06:28:01 UTC 2017

Modified Files:
src/usr.sbin/rtadvd [netbsd-6-0]: config.c rtadvd.h

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1440):
usr.sbin/rtadvd/rtadvd.h: revision 1.15
usr.sbin/rtadvd/config.c: revision 1.36
Fix the default value of rltime
According to rtadvd.conf(5), the default value of rltime is 1800 seconds.
PR bin/51994


To generate a diff of this commit:
cvs rdiff -u -r1.27.2.1 -r1.27.2.1.4.1 src/usr.sbin/rtadvd/config.c
cvs rdiff -u -r1.11 -r1.11.8.1 src/usr.sbin/rtadvd/rtadvd.h

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

Modified files:

Index: src/usr.sbin/rtadvd/config.c
diff -u src/usr.sbin/rtadvd/config.c:1.27.2.1 src/usr.sbin/rtadvd/config.c:1.27.2.1.4.1
--- src/usr.sbin/rtadvd/config.c:1.27.2.1	Wed Aug  8 15:37:49 2012
+++ src/usr.sbin/rtadvd/config.c	Fri Jul 14 06:28:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.c,v 1.27.2.1 2012/08/08 15:37:49 martin Exp $	*/
+/*	$NetBSD: config.c,v 1.27.2.1.4.1 2017/07/14 06:28:01 snj Exp $	*/
 /*	$KAME: config.c,v 1.93 2005/10/17 14:40:02 suz Exp $	*/
 
 /*
@@ -229,7 +229,7 @@ getconfig(const char *intface)
 		exit(1);
 	}
 
-	MAYHAVE(val, "rltime", tmp->maxinterval * 3);
+	MAYHAVE(val, "rltime", DEF_ADVROUTERLIFETIME);
 	if (val && (val < tmp->maxinterval || val > MAXROUTERLIFETIME)) {
 		syslog(LOG_ERR,
 		   "<%s> router lifetime (%d) on %s is invalid "

Index: src/usr.sbin/rtadvd/rtadvd.h
diff -u src/usr.sbin/rtadvd/rtadvd.h:1.11 src/usr.sbin/rtadvd/rtadvd.h:1.11.8.1
--- src/usr.sbin/rtadvd/rtadvd.h:1.11	Sat Dec 10 19:14:29 2011
+++ src/usr.sbin/rtadvd/rtadvd.h	Fri Jul 14 06:28:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtadvd.h,v 1.11 2011/12/10 19:14:29 roy Exp $	*/
+/*	$NetBSD: rtadvd.h,v 1.11.8.1 2017/07/14 06:28:01 snj Exp $	*/
 /*	$KAME: rtadvd.h,v 1.30 2005/10/17 14:40:02 suz Exp $	*/
 
 /*
@@ -50,6 +50,7 @@ extern struct sockaddr_in6 sin6_siteloca
 #define DEF_ADVCURHOPLIMIT 64
 #define DEF_ADVVALIDLIFETIME 2592000
 #define DEF_ADVPREFERREDLIFETIME 604800
+#define DEF_ADVROUTERLIFETIME 1800
 
 #define MAXROUTERLIFETIME 9000
 #define MIN_MAXINTERVAL 4



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

2017-07-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jul 14 06:28:22 UTC 2017

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

Log Message:
1440


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

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

Modified files:

Index: src/doc/CHANGES-6.0.7
diff -u src/doc/CHANGES-6.0.7:1.1.2.99 src/doc/CHANGES-6.0.7:1.1.2.100
--- src/doc/CHANGES-6.0.7:1.1.2.99	Thu Jul 13 09:47:03 2017
+++ src/doc/CHANGES-6.0.7	Fri Jul 14 06:28:22 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0.7,v 1.1.2.99 2017/07/13 09:47:03 martin Exp $
+# $NetBSD: CHANGES-6.0.7,v 1.1.2.100 2017/07/14 06:28:22 snj Exp $
 
 A complete list of changes from the NetBSD 6.0.6 release to the NetBSD 6.0.7
 release:
@@ -12282,3 +12282,9 @@ crypto/external/bsd/heimdal/dist/lib/krb
 	Identified by Jeffrey Altman, Viktor Duchovni and Nico Williams.
 	[christos, ticket #1461]
 
+usr.sbin/rtadvd/config.c			1.36
+usr.sbin/rtadvd/rtadvd.h			1.15
+
+	Fix the default value of rltime.  PR bin/51994
+	[ozaki-r, ticket #1440]
+



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

2017-07-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jul 14 06:24:37 UTC 2017

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

Log Message:
1440


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

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

Modified files:

Index: src/doc/CHANGES-6.1.6
diff -u src/doc/CHANGES-6.1.6:1.1.2.97 src/doc/CHANGES-6.1.6:1.1.2.98
--- src/doc/CHANGES-6.1.6:1.1.2.97	Thu Jul 13 09:45:08 2017
+++ src/doc/CHANGES-6.1.6	Fri Jul 14 06:24:37 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.1.6,v 1.1.2.97 2017/07/13 09:45:08 martin Exp $
+# $NetBSD: CHANGES-6.1.6,v 1.1.2.98 2017/07/14 06:24:37 snj Exp $
 
 A complete list of changes from the NetBSD 6.1.5 release to the NetBSD 6.1.6
 release:
@@ -11981,3 +11981,9 @@ crypto/external/bsd/heimdal/dist/lib/krb
 	Identified by Jeffrey Altman, Viktor Duchovni and Nico Williams.
 	[christos, ticket #1461]
 
+usr.sbin/rtadvd/config.c			1.36
+usr.sbin/rtadvd/rtadvd.h			1.15
+
+	Fix the default value of rltime.  PR bin/51994
+	[ozaki-r, ticket #1440]
+



CVS commit: [netbsd-6-1] src/usr.sbin/rtadvd

2017-07-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jul 14 06:24:16 UTC 2017

Modified Files:
src/usr.sbin/rtadvd [netbsd-6-1]: config.c rtadvd.h

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1440):
usr.sbin/rtadvd/rtadvd.h: revision 1.15
usr.sbin/rtadvd/config.c: revision 1.36
Fix the default value of rltime
According to rtadvd.conf(5), the default value of rltime is 1800 seconds.
PR bin/51994


To generate a diff of this commit:
cvs rdiff -u -r1.27.2.1 -r1.27.2.1.6.1 src/usr.sbin/rtadvd/config.c
cvs rdiff -u -r1.11 -r1.11.10.1 src/usr.sbin/rtadvd/rtadvd.h

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

Modified files:

Index: src/usr.sbin/rtadvd/config.c
diff -u src/usr.sbin/rtadvd/config.c:1.27.2.1 src/usr.sbin/rtadvd/config.c:1.27.2.1.6.1
--- src/usr.sbin/rtadvd/config.c:1.27.2.1	Wed Aug  8 15:37:49 2012
+++ src/usr.sbin/rtadvd/config.c	Fri Jul 14 06:24:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.c,v 1.27.2.1 2012/08/08 15:37:49 martin Exp $	*/
+/*	$NetBSD: config.c,v 1.27.2.1.6.1 2017/07/14 06:24:16 snj Exp $	*/
 /*	$KAME: config.c,v 1.93 2005/10/17 14:40:02 suz Exp $	*/
 
 /*
@@ -229,7 +229,7 @@ getconfig(const char *intface)
 		exit(1);
 	}
 
-	MAYHAVE(val, "rltime", tmp->maxinterval * 3);
+	MAYHAVE(val, "rltime", DEF_ADVROUTERLIFETIME);
 	if (val && (val < tmp->maxinterval || val > MAXROUTERLIFETIME)) {
 		syslog(LOG_ERR,
 		   "<%s> router lifetime (%d) on %s is invalid "

Index: src/usr.sbin/rtadvd/rtadvd.h
diff -u src/usr.sbin/rtadvd/rtadvd.h:1.11 src/usr.sbin/rtadvd/rtadvd.h:1.11.10.1
--- src/usr.sbin/rtadvd/rtadvd.h:1.11	Sat Dec 10 19:14:29 2011
+++ src/usr.sbin/rtadvd/rtadvd.h	Fri Jul 14 06:24:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtadvd.h,v 1.11 2011/12/10 19:14:29 roy Exp $	*/
+/*	$NetBSD: rtadvd.h,v 1.11.10.1 2017/07/14 06:24:16 snj Exp $	*/
 /*	$KAME: rtadvd.h,v 1.30 2005/10/17 14:40:02 suz Exp $	*/
 
 /*
@@ -50,6 +50,7 @@ extern struct sockaddr_in6 sin6_siteloca
 #define DEF_ADVCURHOPLIMIT 64
 #define DEF_ADVVALIDLIFETIME 2592000
 #define DEF_ADVPREFERREDLIFETIME 604800
+#define DEF_ADVROUTERLIFETIME 1800
 
 #define MAXROUTERLIFETIME 9000
 #define MIN_MAXINTERVAL 4



CVS commit: [netbsd-6] src/doc

2017-07-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jul 14 06:20:55 UTC 2017

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

Log Message:
1426, 1438, 1440


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

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

Modified files:

Index: src/doc/CHANGES-6.2
diff -u src/doc/CHANGES-6.2:1.1.2.290 src/doc/CHANGES-6.2:1.1.2.291
--- src/doc/CHANGES-6.2:1.1.2.290	Thu Jul 13 09:02:11 2017
+++ src/doc/CHANGES-6.2	Fri Jul 14 06:20:55 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.290 2017/07/13 09:02:11 martin Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.291 2017/07/14 06:20:55 snj Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -17962,3 +17962,26 @@ crypto/external/bsd/heimdal/dist/lib/krb
 	Identified by Jeffrey Altman, Viktor Duchovni and Nico Williams.
 	[christos, ticket #1461]
 
+share/man/man9/bus_dma.9			1.58-1.62 via patch
+
+	Documentation improvements.
+	[sevan, ticket #1426]
+
+sys/kern/exec_elf.c1.88 via patch
+
+	netbsd_elf_signature - look at note segments (phdrs) not note
+	sections.  They point to the same data in the file, but sections
+	are for linkers and are not necessarily present in an executable
+
+	The original switch from phdrs to shdrs seems to be just a
+	cop-out to avoid parsing multiple notes per segment, which
+	doesn't really avoid the problem b/c sections also can
+	contain multiple notes.
+	[uwe, ticket #1438]
+
+usr.sbin/rtadvd/config.c			1.36
+usr.sbin/rtadvd/rtadvd.h			1.15
+
+	Fix the default value of rltime.  PR bin/51994
+	[ozaki-r, ticket #1440]
+



CVS commit: [netbsd-6] src/usr.sbin/rtadvd

2017-07-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jul 14 06:19:58 UTC 2017

Modified Files:
src/usr.sbin/rtadvd [netbsd-6]: config.c rtadvd.h

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1440):
usr.sbin/rtadvd/rtadvd.h: revision 1.15
usr.sbin/rtadvd/config.c: revision 1.36
Fix the default value of rltime
According to rtadvd.conf(5), the default value of rltime is 1800 seconds.
PR bin/51994


To generate a diff of this commit:
cvs rdiff -u -r1.27.2.1 -r1.27.2.2 src/usr.sbin/rtadvd/config.c
cvs rdiff -u -r1.11 -r1.11.2.1 src/usr.sbin/rtadvd/rtadvd.h

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

Modified files:

Index: src/usr.sbin/rtadvd/config.c
diff -u src/usr.sbin/rtadvd/config.c:1.27.2.1 src/usr.sbin/rtadvd/config.c:1.27.2.2
--- src/usr.sbin/rtadvd/config.c:1.27.2.1	Wed Aug  8 15:37:49 2012
+++ src/usr.sbin/rtadvd/config.c	Fri Jul 14 06:19:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.c,v 1.27.2.1 2012/08/08 15:37:49 martin Exp $	*/
+/*	$NetBSD: config.c,v 1.27.2.2 2017/07/14 06:19:58 snj Exp $	*/
 /*	$KAME: config.c,v 1.93 2005/10/17 14:40:02 suz Exp $	*/
 
 /*
@@ -229,7 +229,7 @@ getconfig(const char *intface)
 		exit(1);
 	}
 
-	MAYHAVE(val, "rltime", tmp->maxinterval * 3);
+	MAYHAVE(val, "rltime", DEF_ADVROUTERLIFETIME);
 	if (val && (val < tmp->maxinterval || val > MAXROUTERLIFETIME)) {
 		syslog(LOG_ERR,
 		   "<%s> router lifetime (%d) on %s is invalid "

Index: src/usr.sbin/rtadvd/rtadvd.h
diff -u src/usr.sbin/rtadvd/rtadvd.h:1.11 src/usr.sbin/rtadvd/rtadvd.h:1.11.2.1
--- src/usr.sbin/rtadvd/rtadvd.h:1.11	Sat Dec 10 19:14:29 2011
+++ src/usr.sbin/rtadvd/rtadvd.h	Fri Jul 14 06:19:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtadvd.h,v 1.11 2011/12/10 19:14:29 roy Exp $	*/
+/*	$NetBSD: rtadvd.h,v 1.11.2.1 2017/07/14 06:19:58 snj Exp $	*/
 /*	$KAME: rtadvd.h,v 1.30 2005/10/17 14:40:02 suz Exp $	*/
 
 /*
@@ -50,6 +50,7 @@ extern struct sockaddr_in6 sin6_siteloca
 #define DEF_ADVCURHOPLIMIT 64
 #define DEF_ADVVALIDLIFETIME 2592000
 #define DEF_ADVPREFERREDLIFETIME 604800
+#define DEF_ADVROUTERLIFETIME 1800
 
 #define MAXROUTERLIFETIME 9000
 #define MIN_MAXINTERVAL 4



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

2017-07-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jul 14 06:18:25 UTC 2017

Modified Files:
src/sys/kern [netbsd-6]: exec_elf.c

Log Message:
Pull up following revision(s) (requested by uwe in ticket #1438):
sys/kern/exec_elf.c: revision 1.88 via patch
netbsd_elf_signature - look at note segments (phdrs) not note
sections.  They point to the same data in the file, but sections are
for linkers and are not necessarily present in an executable.
The original switch from phdrs to shdrs seems to be just a cop-out to
avoid parsing multiple notes per segment, which doesn't really avoid
the problem b/c sections also can contain multiple notes.


To generate a diff of this commit:
cvs rdiff -u -r1.37.2.2 -r1.37.2.3 src/sys/kern/exec_elf.c

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

Modified files:

Index: src/sys/kern/exec_elf.c
diff -u src/sys/kern/exec_elf.c:1.37.2.2 src/sys/kern/exec_elf.c:1.37.2.3
--- src/sys/kern/exec_elf.c:1.37.2.2	Fri Feb 14 23:21:20 2014
+++ src/sys/kern/exec_elf.c	Fri Jul 14 06:18:25 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_elf.c,v 1.37.2.2 2014/02/14 23:21:20 bouyer Exp $	*/
+/*	$NetBSD: exec_elf.c,v 1.37.2.3 2017/07/14 06:18:25 snj Exp $	*/
 
 /*-
  * Copyright (c) 1994, 2000, 2005 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.37.2.2 2014/02/14 23:21:20 bouyer Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.37.2.3 2017/07/14 06:18:25 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pax.h"
@@ -94,6 +94,7 @@ extern struct emul emul_netbsd;
 #define elf_load_psection	ELFNAME(load_psection)
 #define exec_elf_makecmds	ELFNAME2(exec,makecmds)
 #define netbsd_elf_signature	ELFNAME2(netbsd,signature)
+#define netbsd_elf_note   	ELFNAME2(netbsd,note)
 #define netbsd_elf_probe	ELFNAME2(netbsd,probe)
 #define	coredump		ELFNAMEEND(coredump)
 #define	elf_free_emul_arg	ELFNAME(free_emul_arg)
@@ -104,6 +105,8 @@ void	elf_load_psection(struct exec_vmcmd
 	const Elf_Phdr *, Elf_Addr *, u_long *, int *, int);
 
 int	netbsd_elf_signature(struct lwp *, struct exec_package *, Elf_Ehdr *);
+int	netbsd_elf_note(struct exec_package *, const Elf_Nhdr *, const char *,
+	const char *);
 int	netbsd_elf_probe(struct lwp *, struct exec_package *, void *, char *,
 	vaddr_t *);
 
@@ -860,99 +863,140 @@ netbsd_elf_signature(struct lwp *l, stru
 Elf_Ehdr *eh)
 {
 	size_t i;
-	Elf_Shdr *sh;
-	Elf_Nhdr *np;
-	size_t shsize;
+	Elf_Phdr *ph;
+	size_t phsize;
+	char *nbuf;
 	int error;
 	int isnetbsd = 0;
-	char *ndata;
 
 	epp->ep_pax_flags = 0;
-	if (eh->e_shnum > MAXSHNUM || eh->e_shnum == 0)
+
+	if (eh->e_phnum > MAXPHNUM || eh->e_phnum == 0)
 		return ENOEXEC;
 
-	shsize = eh->e_shnum * sizeof(Elf_Shdr);
-	sh = kmem_alloc(shsize, KM_SLEEP);
-	error = exec_read_from(l, epp->ep_vp, eh->e_shoff, sh, shsize);
+	phsize = eh->e_phnum * sizeof(Elf_Phdr);
+	ph = kmem_alloc(phsize, KM_SLEEP);
+	error = exec_read_from(l, epp->ep_vp, eh->e_phoff, ph, phsize);
 	if (error)
 		goto out;
 
-	np = kmem_alloc(MAXNOTESIZE, KM_SLEEP);
-	for (i = 0; i < eh->e_shnum; i++) {
-		Elf_Shdr *shp = &sh[i];
-
-		if (shp->sh_type != SHT_NOTE ||
-		shp->sh_size > MAXNOTESIZE ||
-		shp->sh_size < sizeof(Elf_Nhdr) + ELF_NOTE_NETBSD_NAMESZ)
+	nbuf = kmem_alloc(MAXNOTESIZE, KM_SLEEP);
+	for (i = 0; i < eh->e_phnum; i++) {
+		const char *nptr;
+		size_t nlen;
+
+		if (ph[i].p_type != PT_NOTE ||
+		ph[i].p_filesz > MAXNOTESIZE)
 			continue;
 
-		error = exec_read_from(l, epp->ep_vp, shp->sh_offset, np,
-		shp->sh_size);
+		nlen = ph[i].p_filesz;
+		error = exec_read_from(l, epp->ep_vp, ph[i].p_offset,
+   nbuf, nlen);
 		if (error)
 			continue;
 
-		ndata = (char *)(np + 1);
-		switch (np->n_type) {
-		case ELF_NOTE_TYPE_NETBSD_TAG:
-			if (np->n_namesz != ELF_NOTE_NETBSD_NAMESZ ||
-			np->n_descsz != ELF_NOTE_NETBSD_DESCSZ ||
-			memcmp(ndata, ELF_NOTE_NETBSD_NAME,
-			ELF_NOTE_NETBSD_NAMESZ))
-goto bad;
-			isnetbsd = 1;
-			break;
+		nptr = nbuf;
+		while (nlen > 0) {
+			const Elf_Nhdr *np;
+			const char *ndata, *ndesc;
+
+			/* note header */
+			np = (const Elf_Nhdr *)nptr;
+			if (nlen < sizeof(*np)) {
+break;
+			}
+			nptr += sizeof(*np);
+			nlen -= sizeof(*np);
+
+			/* note name */
+			ndata = nptr;
+			if (nlen < roundup(np->n_namesz, 4)) {
+break;
+			}
+			nptr += roundup(np->n_namesz, 4);
+			nlen -= roundup(np->n_namesz, 4);
+
+			/* note description */
+			ndesc = nptr;
+			if (nlen < roundup(np->n_descsz, 4)) {
+break;
+			}
+			nptr += roundup(np->n_descsz, 4);
+			nlen -= roundup(np->n_descsz, 4);
+
+			isnetbsd |= netbsd_elf_note(epp, np, ndata, ndesc);
+		}
+	}
+	kmem_free(nbuf, MAXNOTESIZE);
+
+	error = isnetbsd ? 0 : ENOEXEC;
+out:
+	kmem_free(ph, phsize);
+	return error;
+}
+
+int
+netbsd_elf_note(struct exec_package *epp,
+		const Elf_Nhdr *np, const char *ndata, const char *ndesc)
+{
+	int isnetbs

CVS commit: [netbsd-6] src/share/man/man9

2017-07-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jul 14 06:13:07 UTC 2017

Modified Files:
src/share/man/man9 [netbsd-6]: bus_dma.9

Log Message:
Pull up following revision(s) (requested by sevan in ticket #1426):
share/man/man9/bus_dma.9: 1.58-1.62 via patch
fix proto
--
Remove extra period.
--
Use .An -nosplit.
--
Give a heads up about bus_dmatag_subregion()


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.57.4.1 src/share/man/man9/bus_dma.9

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

Modified files:

Index: src/share/man/man9/bus_dma.9
diff -u src/share/man/man9/bus_dma.9:1.57 src/share/man/man9/bus_dma.9:1.57.4.1
--- src/share/man/man9/bus_dma.9:1.57	Sat Jul  9 07:57:53 2011
+++ src/share/man/man9/bus_dma.9	Fri Jul 14 06:13:07 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: bus_dma.9,v 1.57 2011/07/09 07:57:53 wiz Exp $
+.\" $NetBSD: bus_dma.9,v 1.57.4.1 2017/07/14 06:13:07 snj Exp $
 .\"
 .\" Copyright (c) 1996, 1997, 1998, 2001, 2005, 2006 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -28,7 +28,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd July 8, 2011
+.Dd January 2, 2017
 .Dt BUS_DMA 9
 .Os
 .Sh NAME
@@ -58,7 +58,7 @@
 .Fn bus_dmamap_destroy "bus_dma_tag_t tag" "bus_dmamap_t dmam"
 .Ft int
 .Fn bus_dmamap_load "bus_dma_tag_t tag" "bus_dmamap_t dmam" "void *buf" \
-"bus_size_t buflen" "struct lwp *l" "int flags"
+"bus_size_t buflen" "struct proc *p" "int flags"
 .Ft int
 .Fn bus_dmamap_load_mbuf "bus_dma_tag_t tag" "bus_dmamap_t dmam" \
 "struct mbuf *chain" "int flags"
@@ -243,7 +243,7 @@ Behavior is not defined if invalid argum
 If given valid arguments,
 .Fn bus_dmamap_destroy
 always succeeds.
-.It Fn bus_dmamap_load "tag" "dmam" "buf" "buflen" "l" "flags"
+.It Fn bus_dmamap_load "tag" "dmam" "buf" "buflen" "p" "flags"
 Loads a DMA handle with mappings for a DMA transfer.
 It assumes that all pages involved in a DMA transfer are wired.
 Arguments are as follows:
@@ -257,13 +257,13 @@ The DMA handle with which to map the tra
 The buffer to be used for the DMA transfer.
 .It Fa buflen
 The size of the buffer.
-.It Fa l
+.It Fa p
 Used to indicate the address space in which the buffer is located.
 If
 .Dv NULL ,
 the buffer is assumed to be in kernel space.
-Otherwise, the buffer is assumed to be in lwp
-.Fa l Ap s
+Otherwise, the buffer is assumed to be in proc
+.Fa p Ap s
 address space.
 .It Fa flags
 are defined as follows:
@@ -798,13 +798,15 @@ Given a bus_dma_tag_t
 create a new bus_dma_tag_t with a limited bus address space.
 This function should not normally be used, but is useful for devices
 that do not support the full address space of the parent bus.
+Not all ports implement this method; on ports where it is unavailable,
+EOPNOTSUPP is returned.
 The arguments are as follows:
 .Bl -tag -width max_addr -compact
 .It Fa tag
 This is the bus_dma_tag_t to subregion.
 .It Fa min_addr
 The smallest address this new tag can address.
-.It Fa max_addr .
+.It Fa max_addr
 The largest address this new tag can address.
 .It Fa newtag
 Pointer filled in with the address of the new bus_dma_tag_t.
@@ -839,6 +841,7 @@ The
 interface appeared in
 .Nx 1.3 .
 .Sh AUTHORS
+.An -nosplit
 The
 .Nm
 interface was designed and implemented by Jason R. Thorpe of the



CVS commit: src/doc

2017-07-13 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Fri Jul 14 04:56:12 UTC 2017

Modified Files:
src/doc: RESPONSIBLE

Log Message:
add a few more '*'


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/doc/RESPONSIBLE

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

Modified files:

Index: src/doc/RESPONSIBLE
diff -u src/doc/RESPONSIBLE:1.117 src/doc/RESPONSIBLE:1.118
--- src/doc/RESPONSIBLE:1.117	Thu Jul 13 22:17:09 2017
+++ src/doc/RESPONSIBLE	Fri Jul 14 04:56:11 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: RESPONSIBLE,v 1.117 2017/07/13 22:17:09 pgoyette Exp $
+#	$NetBSD: RESPONSIBLE,v 1.118 2017/07/14 04:56:11 spz Exp $
 
 List of sections of the system, and who is responsible for them (or at
 least considered an expert on them).
@@ -17,10 +17,10 @@ audioplay	mrg
 audiorecord	mrg
 awk		jdolecek*
 bc		phil*, simonb
-config		cube
+config		cube*
 csh		christos
 cvs		christos, wiz
-dhcp		mellon
+dhcp		mellon*
 edquota		dholland
 error		christos
 etcupdate	[nobody]
@@ -66,7 +66,7 @@ top		simonb
 user		agc
 vi		aymeric
 wakeonlan	mbalmer
-wpa_supplicant	scw
+wpa_supplicant	scw*
 ypbind		dholland
 
 Userland Libraries:
@@ -113,7 +113,7 @@ device support:
 acpi		thorpej*, kochi*, jmcneill, joerg
 audio		augustss*, jmcneill, nat
 cgd		elric
-firewire	jmc
+firewire	jmc*
 flash		ahoka
 gpio		mbalmer
 ide/atapi	bouyer
@@ -183,7 +183,7 @@ file systems:
 
 adosfs		?
 cd9660		?
-chfs		ttoth
+chfs		ttoth*
 coda		gdt
 efs		rumble*
 ext2fs		[nobody in particular]
@@ -209,7 +209,7 @@ udf		reinoud
 ufs		fvdl*
 union		[nobody]
 umapfs		[nobody]
-v7fs		uch
+v7fs		uch*
 
 kern/vfs:
 
@@ -274,7 +274,7 @@ cobalt		core
 emips		pooka
 evbarm		core
 evbmips		simonb
-evbppc		scw
+evbppc		scw*
 evbsh3		core
 ews4800mips	tsutsui
 hp300		tsutsui
@@ -287,12 +287,12 @@ ibmnws		matt
 iyonix		gavan
 landisk		uwe
 luna68k		nisimura
-mac68k		scottr
+mac68k		scottr*
 macppc		macallan
 mipsco		wdk*
 mmeye		core
-mvme68k		scw
-mvmeppc		scw
+mvme68k		scw*
+mvmeppc		scw*
 netwinder	matt
 news68k		tsutsui
 newsmips	core
@@ -310,7 +310,7 @@ sh3		msaitoh,uwe
 sparc		core
 sparc64		martin
 sun2		core
-sun3		jeremy
+sun3		jeremy*
 usermode	reinoud
 vax		core
 x68k		core



CVS commit: src/sys/dev/pci

2017-07-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jul 14 04:34:29 UTC 2017

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

Log Message:
 Calling wm_init_lcd_from_nvm() makes hang on some machines reported by
Brad Harder. Until fix this problem correctly, Disable whole of
wm_init_lcd_from_nvm().


To generate a diff of this commit:
cvs rdiff -u -r1.524 -r1.525 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.524 src/sys/dev/pci/if_wm.c:1.525
--- src/sys/dev/pci/if_wm.c:1.524	Thu Jul 13 13:27:08 2017
+++ src/sys/dev/pci/if_wm.c	Fri Jul 14 04:34:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.524 2017/07/13 13:27:08 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.525 2017/07/14 04:34:29 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.524 2017/07/13 13:27:08 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.525 2017/07/14 04:34:29 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -3702,6 +3702,7 @@ wm_phy_post_reset(struct wm_softc *sc)
 void
 wm_init_lcd_from_nvm(struct wm_softc *sc)
 {
+#if 0
 	uint32_t extcnfctr, sw_cfg_mask, cnf_size, word_addr, i, reg;
 	uint16_t phy_page = 0;
 
@@ -3786,6 +3787,7 @@ wm_init_lcd_from_nvm(struct wm_softc *sc
 release:	
 	sc->phy.release(sc);
 	return;
+#endif
 }
 
 



CVS commit: src/sys/netipsec

2017-07-13 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jul 14 01:30:09 UTC 2017

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

Log Message:
Avoid examining freshness of sav on packet processing

If a sav list is sorted (by lft_c->sadb_lifetime_addtime) in advance,
we don't need to examine each sav and also don't need to delete one
on the fly and send up a message. Fortunately every sav lists are sorted
as we need.

Added key_validate_savlist validates that each sav list is surely sorted
(run only if DEBUG because it's not cheap).


To generate a diff of this commit:
cvs rdiff -u -r1.182 -r1.183 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.182 src/sys/netipsec/key.c:1.183
--- src/sys/netipsec/key.c:1.182	Fri Jul 14 01:24:23 2017
+++ src/sys/netipsec/key.c	Fri Jul 14 01:30:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.182 2017/07/14 01:24:23 ozaki-r Exp $	*/
+/*	$NetBSD: key.c,v 1.183 2017/07/14 01:30:08 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.182 2017/07/14 01:24:23 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.183 2017/07/14 01:30:08 ozaki-r Exp $");
 
 /*
  * This code is referd to RFC 2367
@@ -391,7 +391,6 @@ static struct secasvar *key_allocsa_poli
 static void key_freeso(struct socket *);
 static void key_freesp_so(struct secpolicy **);
 #endif
-static struct secasvar *key_do_allocsa_policy (struct secashead *, u_int);
 static void key_delsp (struct secpolicy *);
 static struct secpolicy *key_getsp (const struct secpolicyindex *);
 static struct secpolicy *key_getspbyid (u_int32_t);
@@ -958,14 +957,29 @@ key_allocsa_policy(const struct secasind
 
 		state = saorder_state_valid[stateidx];
 
-		sav = key_do_allocsa_policy(sah, state);
-		if (sav != NULL)
+		if (key_prefered_oldsa)
+			sav = LIST_FIRST(&sah->savtree[state]);
+		else {
+			/* XXX need O(1) lookup */
+			struct secasvar *last = NULL;
+
+			LIST_FOREACH(sav, &sah->savtree[state], chain)
+last = sav;
+			sav = last;
+		}
+		if (sav != NULL) {
+			SA_ADDREF(sav);
+			KEYDEBUG_PRINTF(KEYDEBUG_IPSEC_STAMP,
+			"DP cause refcnt++:%d SA:%p\n",
+			sav->refcnt, sav);
 			return sav;
+		}
 	}
 
 	return NULL;
 }
 
+#if 0
 static void
 key_sendup_message_delete(struct secasvar *sav)
 {
@@ -1019,77 +1033,7 @@ msgfail:
 	if (result)
 		m_freem(result);
 }
-
-/*
- * searching SAD with direction, protocol, mode and state.
- * called by key_allocsa_policy().
- * OUT:
- *	NULL	: not found
- *	others	: found, pointer to a SA.
- */
-static struct secasvar *
-key_do_allocsa_policy(struct secashead *sah, u_int state)
-{
-	struct secasvar *sav, *candidate, *d;
-
-	/* initilize */
-	candidate = NULL;
-
-	LIST_FOREACH(sav, &sah->savtree[state], chain) {
-		/* sanity check */
-		KEY_CHKSASTATE(sav->state, state);
-
-		/* initialize */
-		if (candidate == NULL) {
-			candidate = sav;
-			continue;
-		}
-
-		/* Which SA is the better ? */
-
-		/* sanity check 2 */
-		KASSERT(candidate->lft_c != NULL);
-		KASSERT(sav->lft_c != NULL);
-
-		/* What the best method is to compare ? */
-		if (key_prefered_oldsa) {
-			if (candidate->lft_c->sadb_lifetime_addtime >
-			sav->lft_c->sadb_lifetime_addtime) {
-candidate = sav;
-			}
-			continue;
-			/*NOTREACHED*/
-		}
-
-		/* prefered new sa rather than old sa */
-		if (candidate->lft_c->sadb_lifetime_addtime <
-		sav->lft_c->sadb_lifetime_addtime) {
-			d = candidate;
-			candidate = sav;
-		} else
-			d = sav;
-
-		/*
-		 * prepared to delete the SA when there is more
-		 * suitable candidate and the lifetime of the SA is not
-		 * permanent.
-		 */
-		if (d->lft_c->sadb_lifetime_addtime != 0) {
-			key_sa_chgstate(d, SADB_SASTATE_DEAD);
-			KASSERT(d->refcnt > 0);
-			key_sendup_message_delete(d);
-			KEY_FREESAV(&d);
-		}
-	}
-
-	if (candidate) {
-		SA_ADDREF(candidate);
-		KEYDEBUG_PRINTF(KEYDEBUG_IPSEC_STAMP,
-		"DP cause refcnt++:%d SA:%p\n",
-		candidate->refcnt, candidate);
-	}
-	return candidate;
-}
+#endif
 
 /*
  * allocating a usable SA entry for a *INBOUND* packet.
@@ -1235,6 +1179,30 @@ done:
 	return sav;
 }
 
+static void
+key_validate_savlist(const struct secashead *sah, const u_int state)
+{
+#ifdef DEBUG
+	struct secasvar *sav, *next;
+
+	/*
+	 * The list should be sorted by lft_c->sadb_lifetime_addtime
+	 * in ascending order.
+	 */
+	LIST_FOREACH_SAFE(sav, &sah->savtree[state], chain, next) {
+		if (next != NULL &&
+		sav->lft_c != NULL && next->lft_c != NULL) {
+			KDASSERTMSG(sav->lft_c->sadb_lifetime_addtime <=
+			next->lft_c->sadb_lifetime_addtime,
+			"savlist is not sorted: sah=%p, state=%d, "
+			"sav=%lu, next=%lu", sah, state,
+			sav->lft_c->sadb_lifetime_addti

CVS commit: src/sys/netipsec

2017-07-13 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jul 14 01:24:24 UTC 2017

Modified Files:
src/sys/netipsec: key.c key.h xform.h xform_ah.c xform_esp.c
xform_ipcomp.c xform_ipip.c xform_tcp.c

Log Message:
Pass sav directly to opencrypto callback

In a callback, use a passed sav as-is by default and look up a sav
only if the passed sav is dead.


To generate a diff of this commit:
cvs rdiff -u -r1.181 -r1.182 src/sys/netipsec/key.c
cvs rdiff -u -r1.21 -r1.22 src/sys/netipsec/key.h
cvs rdiff -u -r1.9 -r1.10 src/sys/netipsec/xform.h
cvs rdiff -u -r1.59 -r1.60 src/sys/netipsec/xform_ah.c
cvs rdiff -u -r1.60 -r1.61 src/sys/netipsec/xform_esp.c
cvs rdiff -u -r1.41 -r1.42 src/sys/netipsec/xform_ipcomp.c
cvs rdiff -u -r1.51 -r1.52 src/sys/netipsec/xform_ipip.c
cvs rdiff -u -r1.13 -r1.14 src/sys/netipsec/xform_tcp.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.181 src/sys/netipsec/key.c:1.182
--- src/sys/netipsec/key.c:1.181	Thu Jul 13 01:22:44 2017
+++ src/sys/netipsec/key.c	Fri Jul 14 01:24:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.181 2017/07/13 01:22:44 ozaki-r Exp $	*/
+/*	$NetBSD: key.c,v 1.182 2017/07/14 01:24:23 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.181 2017/07/13 01:22:44 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.182 2017/07/14 01:24:23 ozaki-r Exp $");
 
 /*
  * This code is referd to RFC 2367
@@ -1246,6 +1246,17 @@ key_sp_ref(struct secpolicy *sp, const c
 	sp, sp->id, where, tag, sp->refcnt);
 }
 
+void
+key_sa_ref(struct secasvar *sav, const char* where, int tag)
+{
+
+	SA_ADDREF2(sav, where, tag);
+
+	KEYDEBUG_PRINTF(KEYDEBUG_IPSEC_STAMP,
+	"DP cause refcnt++:%d SA:%p from %s:%u\n",
+	sav->refcnt, sav, where, tag);
+}
+
 /*
  * Must be called after calling key_lookup_sp*().
  * For both the packet without socket and key_freeso().

Index: src/sys/netipsec/key.h
diff -u src/sys/netipsec/key.h:1.21 src/sys/netipsec/key.h:1.22
--- src/sys/netipsec/key.h:1.21	Thu Jul 13 01:22:44 2017
+++ src/sys/netipsec/key.h	Fri Jul 14 01:24:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.h,v 1.21 2017/07/13 01:22:44 ozaki-r Exp $	*/
+/*	$NetBSD: key.h,v 1.22 2017/07/14 01:24:23 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 $	*/
 
@@ -59,6 +59,7 @@ struct secpolicy *key_gettunnel(const st
 /* NB: prepend with _ for KAME IPv6 compatbility */
 void _key_freesp(struct secpolicy **, const char*, int);
 void key_sp_ref(struct secpolicy *, const char*, int);
+void key_sa_ref(struct secasvar *, const char*, int);
 
 /*
  * Access to the SADB are interlocked with splsoftnet.  In particular,
@@ -79,6 +80,8 @@ void key_sp_ref(struct secpolicy *, cons
 	_key_freesp(spp, __func__, __LINE__)
 #define	KEY_SP_REF(sp)		\
 	key_sp_ref(sp, __func__, __LINE__)
+#define KEY_SA_REF(sav)		\
+	key_sa_ref(sav, __func__, __LINE__)
 
 struct secasvar *key_lookup_sa(const union sockaddr_union *,
 		u_int, u_int32_t, u_int16_t, u_int16_t, const char*, int);

Index: src/sys/netipsec/xform.h
diff -u src/sys/netipsec/xform.h:1.9 src/sys/netipsec/xform.h:1.10
--- src/sys/netipsec/xform.h:1.9	Wed Jul  5 03:44:59 2017
+++ src/sys/netipsec/xform.h	Fri Jul 14 01:24:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform.h,v 1.9 2017/07/05 03:44:59 ozaki-r Exp $	*/
+/*	$NetBSD: xform.h,v 1.10 2017/07/14 01:24:23 ozaki-r Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/xform.h,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $	*/
 /*	$OpenBSD: ip_ipsp.h,v 1.119 2002/03/14 01:27:11 millert Exp $	*/
 /*
@@ -62,6 +62,7 @@ struct tdb_ident {
 /*
  * Opaque data structure hung off a crypto operation descriptor.
  */
+struct secasvar;
 struct tdb_crypto {
 	struct ipsecrequest	*tc_isr;	/* ipsec request state */
 	u_int32_t		tc_spi;		/* associated SPI */
@@ -70,9 +71,9 @@ struct tdb_crypto {
 	u_int8_t		tc_nxt;		/* next protocol, e.g. IPV4 */
 	int			tc_protoff;	/* current protocol offset */
 	int			tc_skip;	/* data offset */
+	struct secasvar		*tc_sav;	/* ipsec SA */
 };
 
-struct secasvar;
 struct ipescrequest;
 
 struct xformsw {
@@ -89,7 +90,7 @@ struct xformsw {
 	const char	*xf_name;		/* human-readable name */
 	int	(*xf_init)(struct secasvar*, const struct xformsw*);/* setup */
 	int	(*xf_zeroize)(struct secasvar*);		/* cleanup */
-	int	(*xf_input)(struct mbuf*, const struct secasvar*, /* input */
+	int	(*xf_input)(struct mbuf*, struct secasvar*, /* input */
 			int, int);
 	int	(*xf_output)(struct mbuf*,	   		/* output */
 			struct ipsecrequest *, struct mbuf **, int, int);

Index: src/sys/netipsec/xform_ah.c
diff -u src/sys/netipsec/xform_ah.c:1.59 src/sys/netipsec/xform_ah.

CVS commit: src/doc

2017-07-13 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Jul 13 22:17:09 UTC 2017

Modified Files:
src/doc: RESPONSIBLE

Log Message:
Add myself in a couple of places


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/doc/RESPONSIBLE

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

Modified files:

Index: src/doc/RESPONSIBLE
diff -u src/doc/RESPONSIBLE:1.116 src/doc/RESPONSIBLE:1.117
--- src/doc/RESPONSIBLE:1.116	Thu Jul 13 19:10:59 2017
+++ src/doc/RESPONSIBLE	Thu Jul 13 22:17:09 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: RESPONSIBLE,v 1.116 2017/07/13 19:10:59 uwe Exp $
+#	$NetBSD: RESPONSIBLE,v 1.117 2017/07/13 22:17:09 pgoyette Exp $
 
 List of sections of the system, and who is responsible for them (or at
 least considered an expert on them).
@@ -126,6 +126,7 @@ net80211	dyoung
 onewire		riz
 podulebus	bjh21*
 scsi		bouyer, thorpej*, reinoud
+sysmon_envsys	pgoyette
 raid(hard)	ad*
 raidframe	oster
 usb		augustss*
@@ -227,7 +228,7 @@ ddb		jhawk
 emulation	christos, fvdl*, manu, jdolecek*, mrg
 kevents		jdolecek*
 ksyms		ragge*
-modules		jnemeth
+modules		jnemeth, pgoyette
 lwp/pthread	nathanw*
 ntp		simonb, jonathan*
 pipes		jdolecek*



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

2017-07-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jul 13 21:14:41 UTC 2017

Modified Files:
src/sys/arch/pmax/conf: RAMDISK

Log Message:
ramdisk ate too much ice cream, compensate.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/pmax/conf/RAMDISK

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/pmax/conf/RAMDISK
diff -u src/sys/arch/pmax/conf/RAMDISK:1.12 src/sys/arch/pmax/conf/RAMDISK:1.13
--- src/sys/arch/pmax/conf/RAMDISK:1.12	Tue Nov 23 06:14:04 2010
+++ src/sys/arch/pmax/conf/RAMDISK	Thu Jul 13 17:14:41 2017
@@ -1,4 +1,4 @@
-# 	$NetBSD: RAMDISK,v 1.12 2010/11/23 11:14:04 hannken Exp $
+# 	$NetBSD: RAMDISK,v 1.13 2017/07/13 21:14:41 christos Exp $
 #
 # Install kernel with ramdisk added.
 # The ramdisk is be too big to netboot directly via ECOFF on some machines,
@@ -13,7 +13,7 @@ include	"arch/pmax/conf/INSTALL"
 options 	MEMORY_DISK_HOOKS
 options 	MEMORY_DISK_IS_ROOT	# force root on memory disk
 options 	MEMORY_DISK_SERVER=0	# no userspace memory disk support
-options 	MEMORY_DISK_ROOT_SIZE=6800	# size of memory disk, in blocks (3400kB)
+options 	MEMORY_DISK_ROOT_SIZE=7000	# size of memory disk, in blocks (3400kB)
 #options 	MEMORY_DISK_ROOT_SIZE=2880	# 1.44M, same as a floppy
 options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	# boot in single-user mode
 



CVS commit: src/doc

2017-07-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Jul 13 19:10:59 UTC 2017

Modified Files:
src/doc: RESPONSIBLE

Log Message:
Claim responsibility for landisk too.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/doc/RESPONSIBLE

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

Modified files:

Index: src/doc/RESPONSIBLE
diff -u src/doc/RESPONSIBLE:1.115 src/doc/RESPONSIBLE:1.116
--- src/doc/RESPONSIBLE:1.115	Thu Jul 13 16:46:43 2017
+++ src/doc/RESPONSIBLE	Thu Jul 13 19:10:59 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: RESPONSIBLE,v 1.115 2017/07/13 16:46:43 uwe Exp $
+#	$NetBSD: RESPONSIBLE,v 1.116 2017/07/13 19:10:59 uwe Exp $
 
 List of sections of the system, and who is responsible for them (or at
 least considered an expert on them).
@@ -284,6 +284,7 @@ hppa		skrll
 i386		dsl
 ibmnws		matt
 iyonix		gavan
+landisk		uwe
 luna68k		nisimura
 mac68k		scottr
 macppc		macallan



CVS commit: src/doc

2017-07-13 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Jul 13 16:46:43 UTC 2017

Modified Files:
src/doc: RESPONSIBLE

Log Message:
Add myself to sh3.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/doc/RESPONSIBLE

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

Modified files:

Index: src/doc/RESPONSIBLE
diff -u src/doc/RESPONSIBLE:1.114 src/doc/RESPONSIBLE:1.115
--- src/doc/RESPONSIBLE:1.114	Thu Jul 13 15:38:23 2017
+++ src/doc/RESPONSIBLE	Thu Jul 13 16:46:43 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: RESPONSIBLE,v 1.114 2017/07/13 15:38:23 joerg Exp $
+#	$NetBSD: RESPONSIBLE,v 1.115 2017/07/13 16:46:43 uwe Exp $
 
 List of sections of the system, and who is responsible for them (or at
 least considered an expert on them).
@@ -304,7 +304,7 @@ sandpoint	nisimura
 sbmips		simonb
 sgimips		core
 shark		core
-sh3		msaitoh
+sh3		msaitoh,uwe
 sparc		core
 sparc64		martin
 sun2		core



CVS commit: src/etc/etc.hpcmips

2017-07-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jul 13 16:03:36 UTC 2017

Modified Files:
src/etc/etc.hpcmips: ttys

Log Message:
turn on "console" which can be either the serial console or the glass tty
instead of ttyE0, to facilitate anita tests. From uanand.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/etc/etc.hpcmips/ttys

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

Modified files:

Index: src/etc/etc.hpcmips/ttys
diff -u src/etc/etc.hpcmips/ttys:1.10 src/etc/etc.hpcmips/ttys:1.11
--- src/etc/etc.hpcmips/ttys:1.10	Wed Jun 13 16:49:13 2012
+++ src/etc/etc.hpcmips/ttys	Thu Jul 13 12:03:36 2017
@@ -1,11 +1,11 @@
 #
-#	$NetBSD: ttys,v 1.10 2012/06/13 20:49:13 martin Exp $
+#	$NetBSD: ttys,v 1.11 2017/07/13 16:03:36 christos Exp $
 #
 # name	gettytype	status		comments
 
 # serial port
-console	"/usr/libexec/getty std.9600"	vt100	off secure
+console	"/usr/libexec/getty std.9600"	vt100	on secure
 constty	"/usr/libexec/getty std.9600"	vt100	off secure
 
 # Workstation console (framebuffer) ttys
-ttyE0	"/usr/libexec/getty std.9600"	wsvt25	on secure
+ttyE0	"/usr/libexec/getty std.9600"	wsvt25	off secure



CVS commit: src/lib/libc/citrus

2017-07-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jul 13 16:00:30 UTC 2017

Modified Files:
src/lib/libc/citrus: citrus_none.c

Log Message:
s == NULL is illegal.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libc/citrus/citrus_none.c

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

Modified files:

Index: src/lib/libc/citrus/citrus_none.c
diff -u src/lib/libc/citrus/citrus_none.c:1.21 src/lib/libc/citrus/citrus_none.c:1.22
--- src/lib/libc/citrus/citrus_none.c:1.21	Thu Jul 13 11:46:26 2017
+++ src/lib/libc/citrus/citrus_none.c	Thu Jul 13 12:00:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: citrus_none.c,v 1.21 2017/07/13 15:46:26 joerg Exp $	*/
+/*	$NetBSD: citrus_none.c,v 1.22 2017/07/13 16:00:30 christos Exp $	*/
 
 /*-
  * Copyright (c)2002 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: citrus_none.c,v 1.21 2017/07/13 15:46:26 joerg Exp $");
+__RCSID("$NetBSD: citrus_none.c,v 1.22 2017/07/13 16:00:30 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
@@ -513,7 +513,10 @@ _citrus_NONE_stdenc_mbtowc(struct _citru
 			   void * __restrict pspriv,
 			   size_t * __restrict nresult)
 {
-	if (s == NULL || *s == NULL) {
+
+	_DIAGASSERT(s != NULL);
+
+	if (*s == NULL) {
 		*nresult = 0;
 		return (0);
 	}



CVS commit: src/lib/libc/citrus

2017-07-13 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jul 13 15:46:26 UTC 2017

Modified Files:
src/lib/libc/citrus: citrus_none.c

Log Message:
Redo previous: catch NULL pointer earlier, check for empty string
latter.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/citrus/citrus_none.c

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

Modified files:

Index: src/lib/libc/citrus/citrus_none.c
diff -u src/lib/libc/citrus/citrus_none.c:1.20 src/lib/libc/citrus/citrus_none.c:1.21
--- src/lib/libc/citrus/citrus_none.c:1.20	Thu Jul 13 15:44:45 2017
+++ src/lib/libc/citrus/citrus_none.c	Thu Jul 13 15:46:26 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: citrus_none.c,v 1.20 2017/07/13 15:44:45 joerg Exp $	*/
+/*	$NetBSD: citrus_none.c,v 1.21 2017/07/13 15:46:26 joerg Exp $	*/
 
 /*-
  * Copyright (c)2002 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: citrus_none.c,v 1.20 2017/07/13 15:44:45 joerg Exp $");
+__RCSID("$NetBSD: citrus_none.c,v 1.21 2017/07/13 15:46:26 joerg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
@@ -513,7 +513,7 @@ _citrus_NONE_stdenc_mbtowc(struct _citru
 			   void * __restrict pspriv,
 			   size_t * __restrict nresult)
 {
-	if (s == NULL) {
+	if (s == NULL || *s == NULL) {
 		*nresult = 0;
 		return (0);
 	}
@@ -525,7 +525,7 @@ _citrus_NONE_stdenc_mbtowc(struct _citru
 	if (pwc != NULL)
 		*pwc = (_wc_t)(unsigned char) **s;
 
-	*nresult = *s == NULL ? 0 : 1;
+	*nresult = **s == '\0' ? 0 : 1;
 	return (0);
 }
 



CVS commit: src/lib/libc/citrus

2017-07-13 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jul 13 15:44:46 UTC 2017

Modified Files:
src/lib/libc/citrus: citrus_none.c

Log Message:
Spell NULL correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/lib/libc/citrus/citrus_none.c

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

Modified files:

Index: src/lib/libc/citrus/citrus_none.c
diff -u src/lib/libc/citrus/citrus_none.c:1.19 src/lib/libc/citrus/citrus_none.c:1.20
--- src/lib/libc/citrus/citrus_none.c:1.19	Tue May 28 16:57:56 2013
+++ src/lib/libc/citrus/citrus_none.c	Thu Jul 13 15:44:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: citrus_none.c,v 1.19 2013/05/28 16:57:56 joerg Exp $	*/
+/*	$NetBSD: citrus_none.c,v 1.20 2017/07/13 15:44:45 joerg Exp $	*/
 
 /*-
  * Copyright (c)2002 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: citrus_none.c,v 1.19 2013/05/28 16:57:56 joerg Exp $");
+__RCSID("$NetBSD: citrus_none.c,v 1.20 2017/07/13 15:44:45 joerg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
@@ -525,7 +525,7 @@ _citrus_NONE_stdenc_mbtowc(struct _citru
 	if (pwc != NULL)
 		*pwc = (_wc_t)(unsigned char) **s;
 
-	*nresult = *s == '\0' ? 0 : 1;
+	*nresult = *s == NULL ? 0 : 1;
 	return (0);
 }
 



CVS commit: src/doc

2017-07-13 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jul 13 15:38:23 UTC 2017

Modified Files:
src/doc: RESPONSIBLE

Log Message:
Drop part-responsibility for audio on nat.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/doc/RESPONSIBLE

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

Modified files:

Index: src/doc/RESPONSIBLE
diff -u src/doc/RESPONSIBLE:1.113 src/doc/RESPONSIBLE:1.114
--- src/doc/RESPONSIBLE:1.113	Thu Jul 13 15:36:20 2017
+++ src/doc/RESPONSIBLE	Thu Jul 13 15:38:23 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: RESPONSIBLE,v 1.113 2017/07/13 15:36:20 joerg Exp $
+#	$NetBSD: RESPONSIBLE,v 1.114 2017/07/13 15:38:23 joerg Exp $
 
 List of sections of the system, and who is responsible for them (or at
 least considered an expert on them).
@@ -111,7 +111,7 @@ Kernel:
 device support:
 
 acpi		thorpej*, kochi*, jmcneill, joerg
-audio		augustss*, jmcneill
+audio		augustss*, jmcneill, nat
 cgd		elric
 firewire	jmc
 flash		ahoka



CVS commit: src/doc

2017-07-13 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jul 13 15:36:20 UTC 2017

Modified Files:
src/doc: RESPONSIBLE

Log Message:
jmcneill is committing again, so unstar him.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/doc/RESPONSIBLE

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

Modified files:

Index: src/doc/RESPONSIBLE
diff -u src/doc/RESPONSIBLE:1.112 src/doc/RESPONSIBLE:1.113
--- src/doc/RESPONSIBLE:1.112	Thu Jul 13 15:35:44 2017
+++ src/doc/RESPONSIBLE	Thu Jul 13 15:36:20 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: RESPONSIBLE,v 1.112 2017/07/13 15:35:44 joerg Exp $
+#	$NetBSD: RESPONSIBLE,v 1.113 2017/07/13 15:36:20 joerg Exp $
 
 List of sections of the system, and who is responsible for them (or at
 least considered an expert on them).
@@ -110,8 +110,8 @@ Kernel:
 
 device support:
 
-acpi		thorpej*, kochi*, jmcneill*, joerg
-audio		augustss*, jmcneill*
+acpi		thorpej*, kochi*, jmcneill, joerg
+audio		augustss*, jmcneill
 cgd		elric
 firewire	jmc
 flash		ahoka
@@ -138,7 +138,7 @@ audio device drivers:
 auich		kent*
 dbri		macallan
 eap		pooka
-esa		jmcneill*
+esa		jmcneill
 
 console device drivers:
 
@@ -231,7 +231,7 @@ modules		jnemeth
 lwp/pthread	nathanw*
 ntp		simonb, jonathan*
 pipes		jdolecek*
-splash		jmcneill*
+splash		jmcneill
 uvm		chuck, chs, mrg, atatat*
 
 kern/compat:



CVS commit: src/doc

2017-07-13 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jul 13 15:35:44 UTC 2017

Modified Files:
src/doc: RESPONSIBLE

Log Message:
Claim responsibility for ld.elf_so.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/doc/RESPONSIBLE

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

Modified files:

Index: src/doc/RESPONSIBLE
diff -u src/doc/RESPONSIBLE:1.111 src/doc/RESPONSIBLE:1.112
--- src/doc/RESPONSIBLE:1.111	Sun May 15 22:57:31 2016
+++ src/doc/RESPONSIBLE	Thu Jul 13 15:35:44 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: RESPONSIBLE,v 1.111 2016/05/15 22:57:31 dholland Exp $
+#	$NetBSD: RESPONSIBLE,v 1.112 2017/07/13 15:35:44 joerg Exp $
 
 List of sections of the system, and who is responsible for them (or at
 least considered an expert on them).
@@ -35,6 +35,7 @@ inetd		dholland
 hostapd		[nobody]
 installboot(mi)	core
 kerberos	lha*, joda*
+ld.elf_so	joerg
 less/more	mrg
 lint		christos
 lua/luac	mbalmer, lneto



CVS commit: src/sys/lib/libunwind

2017-07-13 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jul 13 15:13:19 UTC 2017

Modified Files:
src/sys/lib/libunwind: Registers.hpp

Log Message:
GCC 5.3 likes to emit unwind data with float registers, i.e. register
halfs. Compensate.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/lib/libunwind/Registers.hpp

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

Modified files:

Index: src/sys/lib/libunwind/Registers.hpp
diff -u src/sys/lib/libunwind/Registers.hpp:1.19 src/sys/lib/libunwind/Registers.hpp:1.20
--- src/sys/lib/libunwind/Registers.hpp:1.19	Sat Sep 27 12:08:46 2014
+++ src/sys/lib/libunwind/Registers.hpp	Thu Jul 13 15:13:19 2017
@@ -12,6 +12,7 @@
 #ifndef __REGISTERS_HPP__
 #define __REGISTERS_HPP__
 
+#include 
 #include 
 #include 
 
@@ -323,8 +324,8 @@ enum {
   DWARF_ARM32_R0 = 0,
   DWARF_ARM32_R15 = 15,
   DWARF_ARM32_SPSR = 128,
-  DWARF_ARM32_OLD_S0 = 64,
-  DWARF_ARM32_OLD_S31 = 91,
+  DWARF_ARM32_S0 = 64,
+  DWARF_ARM32_S31 = 91,
   DWARF_ARM32_D0 = 256,
   DWARF_ARM32_D31 = 287,
   REGNO_ARM32_R0 = 0,
@@ -334,6 +335,8 @@ enum {
   REGNO_ARM32_D0 = 17,
   REGNO_ARM32_D15 = 32,
   REGNO_ARM32_D31 = 48,
+  REGNO_ARM32_S0 = 49,
+  REGNO_ARM32_S31 = 70,
 };
 
 class Registers_arm32 {
@@ -354,9 +357,8 @@ public:
   return REGNO_ARM32_SPSR;
 if (num >= DWARF_ARM32_D0 && num <= DWARF_ARM32_D31)
   return REGNO_ARM32_D0 + (num - DWARF_ARM32_D0);
-if (num >= DWARF_ARM32_OLD_S0 && num <= DWARF_ARM32_OLD_S31) {
-  assert(num % 2 == 0);
-  return REGNO_ARM32_D0 + (num - DWARF_ARM32_OLD_S0) / 2;
+if (num >= DWARF_ARM32_S0 && num <= DWARF_ARM32_S31) {
+  return REGNO_ARM32_S0 + (num - DWARF_ARM32_S0);
 }
 return LAST_REGISTER + 1;
   }
@@ -384,10 +386,28 @@ public:
   void setSP(uint64_t value) { reg[REGNO_ARM32_SP] = value; }
 
   bool validFloatVectorRegister(int num) const {
-return (num >= REGNO_ARM32_D0 && num <= REGNO_ARM32_D31);
+return (num >= REGNO_ARM32_D0 && num <= REGNO_ARM32_S31);
   }
 
   void copyFloatVectorRegister(int num, uint64_t addr_) {
+const void *addr = reinterpret_cast(addr_);
+if (num >= REGNO_ARM32_S0 && num <= REGNO_ARM32_S31) {
+  if ((flags & 1) == 0) {
+lazyVFP1();
+flags |= 1;
+  }
+  /*
+   * Emulate single precision register as half of the
+   * corresponding double register.
+   */
+  int dnum = (num - REGNO_ARM32_S0) / 2;
+  int part = (num - REGNO_ARM32_S0) % 2;
+#if _BYTE_ORDER == _BIG_ENDIAN
+  part = 1 - part;
+#endif
+  memcpy(fpreg + dnum + part * sizeof(fpreg[0]) / 2,
+addr, sizeof(fpreg[0]) / 2);
+}
 if (num <= REGNO_ARM32_D15) {
   if ((flags & 1) == 0) {
 lazyVFP1();
@@ -399,7 +419,6 @@ public:
 flags |= 2;
   }
 }
-const void *addr = reinterpret_cast(addr_);
 memcpy(fpreg + (num - REGNO_ARM32_D0), addr, sizeof(fpreg[0]));
   }
 



CVS commit: src/libexec/ld.elf_so

2017-07-13 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jul 13 14:10:38 UTC 2017

Modified Files:
src/libexec/ld.elf_so: tls.c

Log Message:
Fix two bugs related to promotion of DSO TLS blocks into the static
thread allocation:
(1) Set the DTV vector up whenever an offset into the static allocation
is assigned, even if the block itself is not initialized. This has been
seen in libstdc++.
(2) Do not free a DTV block if it is part of the static thread
allocation.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/libexec/ld.elf_so/tls.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/tls.c
diff -u src/libexec/ld.elf_so/tls.c:1.10 src/libexec/ld.elf_so/tls.c:1.11
--- src/libexec/ld.elf_so/tls.c:1.10	Sun Dec 14 23:49:17 2014
+++ src/libexec/ld.elf_so/tls.c	Thu Jul 13 14:10:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: tls.c,v 1.10 2014/12/14 23:49:17 chs Exp $	*/
+/*	$NetBSD: tls.c,v 1.11 2017/07/13 14:10:38 joerg Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: tls.c,v 1.10 2014/12/14 23:49:17 chs Exp $");
+__RCSID("$NetBSD: tls.c,v 1.11 2017/07/13 14:10:38 joerg Exp $");
 
 #include 
 #include 
@@ -134,7 +134,7 @@ _rtld_tls_allocate_locked(void)
 	SET_DTV_GENERATION(tcb->tcb_dtv, _rtld_tls_dtv_generation);
 
 	for (obj = _rtld_objlist; obj != NULL; obj = obj->next) {
-		if (obj->tlsinitsize && obj->tls_done) {
+		if (obj->tls_done) {
 #ifdef __HAVE_TLS_VARIANT_I
 			q = p + obj->tlsoffset;
 #else
@@ -142,7 +142,8 @@ _rtld_tls_allocate_locked(void)
 #endif
 			dbg(("obj %p dtv %p tlsoffset %zu",
 			obj, q, obj->tlsoffset));
-			memcpy(q, obj->tlsinit, obj->tlsinitsize);
+			if (obj->tlsinitsize)
+memcpy(q, obj->tlsinit, obj->tlsinitsize);
 			tcb->tcb_dtv[obj->tlsindex] = q;
 		}
 	}
@@ -167,21 +168,25 @@ void
 _rtld_tls_free(struct tls_tcb *tcb)
 {
 	size_t i, max_index;
-	uint8_t *p;
+	uint8_t *p, *p_end;
 	sigset_t mask;
 
 	_rtld_exclusive_enter(&mask);
 
-	max_index = DTV_MAX_INDEX(tcb->tcb_dtv);
-	for (i = 1; i <= max_index; ++i)
-		xfree(tcb->tcb_dtv[i]);
-	xfree(tcb->tcb_dtv - 1);
-
 #ifdef __HAVE_TLS_VARIANT_I
 	p = (uint8_t *)tcb;
 #else
 	p = (uint8_t *)tcb - _rtld_tls_static_space;
 #endif
+	p_end = p + _rtld_tls_static_space;
+
+	max_index = DTV_MAX_INDEX(tcb->tcb_dtv);
+	for (i = 1; i <= max_index; ++i) {
+		if ((uint8_t *)tcb->tcb_dtv[i] < p ||
+		(uint8_t *)tcb->tcb_dtv[i] >= p_end)
+			xfree(tcb->tcb_dtv[i]);
+	}
+	xfree(tcb->tcb_dtv - 1);
 	xfree(p);
 
 	_rtld_exclusive_exit(&mask);



CVS commit: src/etc/powerd/scripts

2017-07-13 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Jul 13 13:50:48 UTC 2017

Modified Files:
src/etc/powerd/scripts: sleep_button

Log Message:
Remove the stopping and starting of various network scripts on
sleep / resume.
This should no longer be needed now the various applications
(dhcpcd, ntpd, wpa_supplicant et all) are more aware to the network state
as all interface carriers should be brought down and up again.

Fixes PR misc/52397.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/etc/powerd/scripts/sleep_button

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

Modified files:

Index: src/etc/powerd/scripts/sleep_button
diff -u src/etc/powerd/scripts/sleep_button:1.10 src/etc/powerd/scripts/sleep_button:1.11
--- src/etc/powerd/scripts/sleep_button:1.10	Mon Oct 17 23:27:41 2011
+++ src/etc/powerd/scripts/sleep_button	Thu Jul 13 13:50:48 2017
@@ -1,6 +1,6 @@
 #!/bin/sh -
 #
-#	$NetBSD: sleep_button,v 1.10 2011/10/17 23:27:41 jmcneill Exp $
+#	$NetBSD: sleep_button,v 1.11 2017/07/13 13:50:48 roy Exp $
 #
 # Generic script for sleep button events.
 #
@@ -10,13 +10,6 @@
 
 case "${2}" in
 pressed)
-
-	/etc/rc.d/bluetooth stop
-	/etc/rc.d/ntpd stop
-	/etc/rc.d/dhclient stop
-	/etc/rc.d/network stop
-	/etc/rc.d/wpa_supplicant stop
-
 	if /sbin/sysctl -q hw.acpi.sleep.state; then
 		/sbin/sysctl -w hw.acpi.sleep.state=3
 	elif /sbin/sysctl -q machdep.xen.suspend; then
@@ -31,13 +24,6 @@ pressed)
 		# ... waking up
 		sleep 1
 	fi
-
-	/etc/rc.d/wpa_supplicant start
-	/etc/rc.d/network start
-	/etc/rc.d/dhclient start
-	/etc/rc.d/ntpdate start
-	/etc/rc.d/ntpd start
-	/etc/rc.d/bluetooth start
 	;;
 
 released)



CVS commit: src/sys/dev/pci

2017-07-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jul 13 13:27:08 UTC 2017

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

Log Message:
 IF TX is not required to flush, RX is also not required to flush. Same as
other OSes.


To generate a diff of this commit:
cvs rdiff -u -r1.523 -r1.524 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.523 src/sys/dev/pci/if_wm.c:1.524
--- src/sys/dev/pci/if_wm.c:1.523	Thu Jul 13 08:22:21 2017
+++ src/sys/dev/pci/if_wm.c	Thu Jul 13 13:27:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.523 2017/07/13 08:22:21 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.524 2017/07/13 13:27:08 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.523 2017/07/13 08:22:21 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.524 2017/07/13 13:27:08 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -4076,7 +4076,10 @@ wm_flush_desc_rings(struct wm_softc *sc)
 {
 	pcireg_t preg;
 	uint32_t reg;
+	struct wm_txqueue *txq;
+	wiseman_txdesc_t *txd;
 	int nexttx;
+	uint32_t rctl;
 
 	/* First, disable MULR fix in FEXTNVM11 */
 	reg = CSR_READ(sc, WMREG_FEXTNVM11);
@@ -4085,66 +4088,64 @@ wm_flush_desc_rings(struct wm_softc *sc)
 
 	preg = pci_conf_read(sc->sc_pc, sc->sc_pcitag, WM_PCI_DESCRING_STATUS);
 	reg = CSR_READ(sc, WMREG_TDLEN(0));
-	if (((preg & DESCRING_STATUS_FLUSH_REQ) != 0) && (reg != 0)) {
-		struct wm_txqueue *txq;
-		wiseman_txdesc_t *txd;
-
-		/* TX */
-		printf("%s: Need TX flush (reg = %08x, len = %u)\n",
-		device_xname(sc->sc_dev), preg, reg);
-		reg = CSR_READ(sc, WMREG_TCTL);
-		CSR_WRITE(sc, WMREG_TCTL, reg | TCTL_EN);
+	if (((preg & DESCRING_STATUS_FLUSH_REQ) == 0) || (reg == 0))
+		return;
 
-		txq = &sc->sc_queue[0].wmq_txq;
-		nexttx = txq->txq_next;
-		txd = &txq->txq_descs[nexttx];
-		wm_set_dma_addr(&txd->wtx_addr, WM_CDTXADDR(txq, nexttx));
-		txd->wtx_cmdlen = htole32(WTX_CMD_IFCS| 512);
-		txd->wtx_fields.wtxu_status = 0;
-		txd->wtx_fields.wtxu_options = 0;
-		txd->wtx_fields.wtxu_vlan = 0;
+	/* TX */
+	printf("%s: Need TX flush (reg = %08x, len = %u)\n",
+	device_xname(sc->sc_dev), preg, reg);
+	reg = CSR_READ(sc, WMREG_TCTL);
+	CSR_WRITE(sc, WMREG_TCTL, reg | TCTL_EN);
+
+	txq = &sc->sc_queue[0].wmq_txq;
+	nexttx = txq->txq_next;
+	txd = &txq->txq_descs[nexttx];
+	wm_set_dma_addr(&txd->wtx_addr, WM_CDTXADDR(txq, nexttx));
+	txd->wtx_cmdlen = htole32(WTX_CMD_IFCS| 512);
+	txd->wtx_fields.wtxu_status = 0;
+	txd->wtx_fields.wtxu_options = 0;
+	txd->wtx_fields.wtxu_vlan = 0;
 
-		bus_space_barrier(sc->sc_st, sc->sc_sh, 0, 0,
-			BUS_SPACE_BARRIER_WRITE);
+	bus_space_barrier(sc->sc_st, sc->sc_sh, 0, 0,
+	BUS_SPACE_BARRIER_WRITE);
 		
-		txq->txq_next = WM_NEXTTX(txq, txq->txq_next);
-		CSR_WRITE(sc, WMREG_TDT(0), txq->txq_next);
-		bus_space_barrier(sc->sc_st, sc->sc_sh, 0, 0,
-			BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
-		delay(250);
-	}
+	txq->txq_next = WM_NEXTTX(txq, txq->txq_next);
+	CSR_WRITE(sc, WMREG_TDT(0), txq->txq_next);
+	bus_space_barrier(sc->sc_st, sc->sc_sh, 0, 0,
+	BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+	delay(250);
+
 	preg = pci_conf_read(sc->sc_pc, sc->sc_pcitag, WM_PCI_DESCRING_STATUS);
-	if (preg & DESCRING_STATUS_FLUSH_REQ) {
-		uint32_t rctl;
+	if ((preg & DESCRING_STATUS_FLUSH_REQ) == 0)
+		return;
 
-		/* RX */
-		printf("%s: Need RX flush (reg = %08x)\n",
-		device_xname(sc->sc_dev), preg);
-		rctl = CSR_READ(sc, WMREG_RCTL);
-		CSR_WRITE(sc, WMREG_RCTL, rctl & ~RCTL_EN);
-		CSR_WRITE_FLUSH(sc);
-		delay(150);
+	/* RX */
+	printf("%s: Need RX flush (reg = %08x)\n",
+	device_xname(sc->sc_dev), preg);
+	rctl = CSR_READ(sc, WMREG_RCTL);
+	CSR_WRITE(sc, WMREG_RCTL, rctl & ~RCTL_EN);
+	CSR_WRITE_FLUSH(sc);
+	delay(150);
 
-		reg = CSR_READ(sc, WMREG_RXDCTL(0));
-		/* zero the lower 14 bits (prefetch and host thresholds) */
-		reg &= 0xc000;
-		/*
-		 * update thresholds: prefetch threshold to 31, host threshold
-		 * to 1 and make sure the granularity is "descriptors" and not
-		 * "cache lines"
-		 */
-		reg |= (0x1f | (1 << 8) | RXDCTL_GRAN);
-		CSR_WRITE(sc, WMREG_RXDCTL(0), reg);
+	reg = CSR_READ(sc, WMREG_RXDCTL(0));
+	/* zero the lower 14 bits (prefetch and host thresholds) */
+	reg &= 0xc000;
+	/*
+	 * update thresholds: prefetch threshold to 31, host threshold
+	 * to 1 and make sure the granularity is "descriptors" and not
+	 * "cache lines"
+	 */
+	reg |= (0x1f | (1 << 8) | RXDCTL_GRAN);
+	CSR_WRITE(sc, WMREG_RXDCTL(0), reg);
 
-		/*
-		 * momentarily enable the RX ring for the changes to take
-		 * effect
-		 */
-		CSR_WRITE(sc, WMREG_RCTL, rctl | RCTL_EN);
-		CSR_WRITE_FLUSH(sc);
-		delay(150);
-		CSR_WRITE(sc, WMREG_RCTL, rctl & ~RCTL_EN);
-	}
+	/*
+	 * momentarily en

CVS commit: src/usr.bin/pmc

2017-07-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Jul 13 10:59:53 UTC 2017

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

Log Message:
Sort sections. Fix macro usage.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 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.12 src/usr.bin/pmc/pmc.1:1.13
--- src/usr.bin/pmc/pmc.1:1.12	Wed Jul 12 17:38:15 2017
+++ src/usr.bin/pmc/pmc.1	Thu Jul 13 10:59:53 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: pmc.1,v 1.12 2017/07/12 17:38:15 maxv Exp $
+.\"	$NetBSD: pmc.1,v 1.13 2017/07/13 10:59:53 wiz Exp $
 .\"
 .\" Copyright (c) 2017 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -96,6 +96,12 @@ specifies the source of the event; it mu
 Stop any performance counters that are currently running, and display the
 values of these counters.
 .El
+.Sh FILES
+.Pa src/sys/arch/x86/x86/pmc.c
+x86 implementation.
+.Pp
+.Pa src/usr.bin/pmc/pmc.c
+pmc tool.
 .Sh EXAMPLES
 The following command prints the available counters.
 .Dl # pmc list
@@ -114,12 +120,10 @@ 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
@@ -132,13 +136,6 @@ 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



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

2017-07-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jul 13 09:47:03 UTC 2017

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

Log Message:
Ticket #1461


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

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

Modified files:

Index: src/doc/CHANGES-6.0.7
diff -u src/doc/CHANGES-6.0.7:1.1.2.98 src/doc/CHANGES-6.0.7:1.1.2.99
--- src/doc/CHANGES-6.0.7:1.1.2.98	Tue Jul 11 21:28:11 2017
+++ src/doc/CHANGES-6.0.7	Thu Jul 13 09:47:03 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0.7,v 1.1.2.98 2017/07/11 21:28:11 snj Exp $
+# $NetBSD: CHANGES-6.0.7,v 1.1.2.99 2017/07/13 09:47:03 martin Exp $
 
 A complete list of changes from the NetBSD 6.0.6 release to the NetBSD 6.0.7
 release:
@@ -12271,3 +12271,14 @@ xsrc/xfree/xc/programs/Xserver/Xi/sendex
 	Fix CVE-2017-10971 and CVE-2017-10972.
 	[mrg, ticket #1459]
 
+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 #1461]
+



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

2017-07-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jul 13 09:45:58 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by christos in ticket #1461):
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.1 -r1.1.1.1.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.1 src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.1.1.1.12.1
--- src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.1.1.1	Wed Apr 13 18:15:39 2011
+++ src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c	Thu Jul 13 09:45:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ticket.c,v 1.1.1.1 2011/04/13 18:15:39 elric Exp $	*/
+/*	$NetBSD: ticket.c,v 1.1.1.1.12.1 2017/07/13 09:45:57 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-6-1] src/doc

2017-07-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jul 13 09:45:08 UTC 2017

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

Log Message:
Ticket #1461


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

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

Modified files:

Index: src/doc/CHANGES-6.1.6
diff -u src/doc/CHANGES-6.1.6:1.1.2.96 src/doc/CHANGES-6.1.6:1.1.2.97
--- src/doc/CHANGES-6.1.6:1.1.2.96	Tue Jul 11 21:29:14 2017
+++ src/doc/CHANGES-6.1.6	Thu Jul 13 09:45:08 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.1.6,v 1.1.2.96 2017/07/11 21:29:14 snj Exp $
+# $NetBSD: CHANGES-6.1.6,v 1.1.2.97 2017/07/13 09:45:08 martin Exp $
 
 A complete list of changes from the NetBSD 6.1.5 release to the NetBSD 6.1.6
 release:
@@ -11970,3 +11970,14 @@ xsrc/xfree/xc/programs/Xserver/Xi/sendex
 	Fix CVE-2017-10971 and CVE-2017-10972.
 	[mrg, ticket #1459]
 
+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 #1461]
+



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

2017-07-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jul 13 09:44:34 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by christos in ticket #1461):
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.1 -r1.1.1.1.20.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.1 src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.1.1.1.20.1
--- src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.1.1.1	Wed Apr 13 18:15:39 2011
+++ src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c	Thu Jul 13 09:44:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ticket.c,v 1.1.1.1 2011/04/13 18:15:39 elric Exp $	*/
+/*	$NetBSD: ticket.c,v 1.1.1.1.20.1 2017/07/13 09:44:34 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: src/sys/arch/evbarm/conf

2017-07-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jul 13 09:06:28 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: SUNXI

Log Message:
Build sun8i-h2-plus-orangepi-zero.dts


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/evbarm/conf/SUNXI

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

Modified files:

Index: src/sys/arch/evbarm/conf/SUNXI
diff -u src/sys/arch/evbarm/conf/SUNXI:1.16 src/sys/arch/evbarm/conf/SUNXI:1.17
--- src/sys/arch/evbarm/conf/SUNXI:1.16	Sat Jul  8 16:20:21 2017
+++ src/sys/arch/evbarm/conf/SUNXI	Thu Jul 13 09:06:28 2017
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: SUNXI,v 1.16 2017/07/08 16:20:21 jmcneill Exp $
+#	$NetBSD: SUNXI,v 1.17 2017/07/13 09:06:28 jmcneill Exp $
 #
 #	Allwinner sunxi family
 #
@@ -15,6 +15,8 @@ makeoptions	DTS="
 	sun6i-a31-m9.dts
 	sun6i-a31-mele-a1000g-quad.dts
 
+	sun8i-h2-plus-orangepi-zero.dts
+
 	sun8i-h3-bananapi-m2-plus.dts
 	sun8i-h3-beelink-x2.dts
 	sun8i-h3-nanopi-m1.dts



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

2017-07-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jul 13 09:04:28 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: sunxi_platform.c

Log Message:
Add support for Allwinner H2+ as found in the Orange Pi Zero.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/sunxi/sunxi_platform.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/arm/sunxi/sunxi_platform.c
diff -u src/sys/arch/arm/sunxi/sunxi_platform.c:1.4 src/sys/arch/arm/sunxi/sunxi_platform.c:1.5
--- src/sys/arch/arm/sunxi/sunxi_platform.c:1.4	Thu Jul  6 22:10:14 2017
+++ src/sys/arch/arm/sunxi/sunxi_platform.c	Thu Jul 13 09:04:28 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_platform.c,v 1.4 2017/07/06 22:10:14 jmcneill Exp $ */
+/* $NetBSD: sunxi_platform.c,v 1.5 2017/07/13 09:04:28 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -31,7 +31,7 @@
 #include "opt_fdt_arm.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_platform.c,v 1.4 2017/07/06 22:10:14 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_platform.c,v 1.5 2017/07/13 09:04:28 jmcneill Exp $");
 
 #include 
 #include 
@@ -153,6 +153,7 @@ static const struct arm_platform sun8i_p
 	.uart_freq = sunxi_platform_uart_freq,
 };
 
+ARM_PLATFORM(sun8i_h2plus, "allwinner,sun8i-h2-plus", &sun8i_platform);
 ARM_PLATFORM(sun8i_h3, "allwinner,sun8i-h3", &sun8i_platform);
 ARM_PLATFORM(sun8i_a83t, "allwinner,sun8i-a83t", &sun8i_platform);
 



CVS commit: [netbsd-6] src/doc

2017-07-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jul 13 09:02:11 UTC 2017

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

Log Message:
Ticket #1461


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

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

Modified files:

Index: src/doc/CHANGES-6.2
diff -u src/doc/CHANGES-6.2:1.1.2.289 src/doc/CHANGES-6.2:1.1.2.290
--- src/doc/CHANGES-6.2:1.1.2.289	Tue Jul 11 21:29:39 2017
+++ src/doc/CHANGES-6.2	Thu Jul 13 09:02:11 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.289 2017/07/11 21:29:39 snj Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.290 2017/07/13 09:02:11 martin Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -17951,3 +17951,14 @@ xsrc/xfree/xc/programs/Xserver/Xi/sendex
 	Fix CVE-2017-10971 and CVE-2017-10972.
 	[mrg, ticket #1459]
 
+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 #1461]
+



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

2017-07-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jul 13 09:01:29 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by christos in ticket #1461):
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.1 -r1.1.1.1.6.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.1 src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.1.1.1.6.1
--- src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c:1.1.1.1	Wed Apr 13 18:15:39 2011
+++ src/crypto/external/bsd/heimdal/dist/lib/krb5/ticket.c	Thu Jul 13 09:01:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ticket.c,v 1.1.1.1 2011/04/13 18:15:39 elric Exp $	*/
+/*	$NetBSD: ticket.c,v 1.1.1.1.6.1 2017/07/13 09:01:29 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: src/sys/dev/pci

2017-07-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jul 13 08:41:20 UTC 2017

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

Log Message:
- Official shortname of LN Requester is LNR, so change PCI_EXTCAP_LN_REQ
  to PCI_EXTCAP_LNR
- Use macro.


To generate a diff of this commit:
cvs rdiff -u -r1.189 -r1.190 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.131 -r1.132 src/sys/dev/pci/pcireg.h

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

Modified files:

Index: src/sys/dev/pci/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.189 src/sys/dev/pci/pci_subr.c:1.190
--- src/sys/dev/pci/pci_subr.c:1.189	Thu Jun 15 15:38:18 2017
+++ src/sys/dev/pci/pci_subr.c	Thu Jul 13 08:41:19 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.189 2017/06/15 15:38:18 flxd Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.190 2017/07/13 08:41:19 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.189 2017/06/15 15:38:18 flxd Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.190 2017/07/13 08:41:19 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -2087,7 +2087,7 @@ pci_conf_print_pcie_cap(const pcireg_t *
 		break;
 	}
 	printf("  OBFF Supported: ");
-	switch ((reg & PCIE_DCAP2_OBFF) >> 18) {
+	switch (__SHIFTOUT(reg, PCIE_DCAP2_OBFF)) {
 	case 0x0:
 		printf("Not supported\n");
 		break;
@@ -2139,7 +2139,7 @@ pci_conf_print_pcie_cap(const pcireg_t *
 	onoff("Emergency Power Reduction Request", reg,
 	PCIE_DCSR2_EMGPWRRED_REQ);
 	printf("  OBFF: ");
-	switch ((reg & PCIE_DCSR2_OBFF_EN) >> 13) {
+	switch (__SHIFTOUT(reg, PCIE_DCSR2_OBFF_EN)) {
 	case 0x0:
 		printf("Disabled\n");
 		break;
@@ -3939,7 +3939,7 @@ static struct {
 	  NULL },
 	{ PCI_EXTCAP_PASID,	"Process Address Space ID",
 	  pci_conf_print_pasid_cap },
-	{ PCI_EXTCAP_LN_REQ,	"LN Requester",
+	{ PCI_EXTCAP_LNR,	"LN Requester",
 	  pci_conf_print_lnr_cap },
 	{ PCI_EXTCAP_DPC,	"Downstream Port Containment",
 	  pci_conf_print_dpc_cap },

Index: src/sys/dev/pci/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.131 src/sys/dev/pci/pcireg.h:1.132
--- src/sys/dev/pci/pcireg.h:1.131	Thu Jun 15 06:51:18 2017
+++ src/sys/dev/pci/pcireg.h	Thu Jul 13 08:41:19 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.131 2017/06/15 06:51:18 msaitoh Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.132 2017/07/13 08:41:19 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -1433,7 +1433,7 @@ struct pci_rom {
 #define	PCI_EXTCAP_SEC_PCIE	0x0019	/* Secondary PCI Express */
 #define	PCI_EXTCAP_PMUX		0x001a	/* Protocol Multiplexing */
 #define	PCI_EXTCAP_PASID	0x001b	/* Process Address Space ID */
-#define	PCI_EXTCAP_LN_REQ	0x001c	/* LN Requester */
+#define	PCI_EXTCAP_LNR		0x001c	/* LN Requester */
 #define	PCI_EXTCAP_DPC		0x001d	/* Downstream Port Containment */
 #define	PCI_EXTCAP_L1PM		0x001e	/* L1 PM Substates */
 #define	PCI_EXTCAP_PTM		0x001f	/* Precision Time Management */



CVS commit: src/sbin/route

2017-07-13 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Thu Jul 13 08:26:29 UTC 2017

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

Log Message:
Fix route and netstat -r output when built with -DSMALL

A missing \n caused the routing table to be printed all in one line
if -DSMALL was used.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sbin/route/rtutil.c

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

Modified files:

Index: src/sbin/route/rtutil.c
diff -u src/sbin/route/rtutil.c:1.9 src/sbin/route/rtutil.c:1.10
--- src/sbin/route/rtutil.c:1.9	Wed Jun 28 04:14:53 2017
+++ src/sbin/route/rtutil.c	Thu Jul 13 08:26:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtutil.c,v 1.9 2017/06/28 04:14:53 ozaki-r Exp $	*/
+/*	$NetBSD: rtutil.c,v 1.10 2017/07/13 08:26:29 manu Exp $	*/
 /*	$OpenBSD: show.c,v 1.1 2006/05/27 19:16:37 claudio Exp $	*/
 
 /*
@@ -304,6 +304,8 @@ p_rtentry(struct rt_msghdr *rtm, int fla
 	putchar('\n');
 	if (flags & RT_VFLAG)
 		p_rtrmx(&rtm->rtm_rmx);
+#else
+	putchar('\n');
 #endif
 }
 



CVS commit: src/sys/dev

2017-07-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jul 13 08:22:21 UTC 2017

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

Log Message:
- Call wm_kmrn_lock_loss_workaround_ich8lan() before any PHY access in
  wm_linkintr_gmii().
- Register access in wm_kmrn_lock_loss_workaround_ich8lan() now works
  correctly. Enable this function.
- Configure the LCD with the extended configuration region in NVM if it's
  required.
- Add debug printf.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/mii/inbmphyreg.h
cvs rdiff -u -r1.522 -r1.523 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.101 -r1.102 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/mii/inbmphyreg.h
diff -u src/sys/dev/mii/inbmphyreg.h:1.9 src/sys/dev/mii/inbmphyreg.h:1.10
--- src/sys/dev/mii/inbmphyreg.h:1.9	Wed Nov 16 08:56:17 2016
+++ src/sys/dev/mii/inbmphyreg.h	Thu Jul 13 08:22:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: inbmphyreg.h,v 1.9 2016/11/16 08:56:17 msaitoh Exp $	*/
+/*	$NetBSD: inbmphyreg.h,v 1.10 2017/07/13 08:22:20 msaitoh Exp $	*/
 /***
 Copyright (c) 2001-2005, Intel Corporation 
 All rights reserved.
@@ -91,6 +91,8 @@ POSSIBILITY OF SUCH DAMAGE.
 #define HV_OEM_BITS_A1KDIS	(1 << 6)
 #define HV_OEM_BITS_ANEGNOW	(1 << 10)
 
+#define HV_LED_CONFIG		BME1000_REG(0, 30)
+
 #define	HV_KMRN_MODE_CTRL	BME1000_REG(BM_PORT_CTRL_PAGE, 16)
 #define	HV_KMRN_MDIO_SLOW	0x0400
 

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.522 src/sys/dev/pci/if_wm.c:1.523
--- src/sys/dev/pci/if_wm.c:1.522	Thu Jul 13 08:04:56 2017
+++ src/sys/dev/pci/if_wm.c	Thu Jul 13 08:22:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.522 2017/07/13 08:04:56 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.523 2017/07/13 08:22:21 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.522 2017/07/13 08:04:56 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.523 2017/07/13 08:22:21 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -679,6 +679,7 @@ static void	wm_get_auto_rd_done(struct w
 static void	wm_lan_init_done(struct wm_softc *);
 static void	wm_get_cfg_done(struct wm_softc *);
 static void	wm_phy_post_reset(struct wm_softc *);
+static void	wm_init_lcd_from_nvm(struct wm_softc *);
 static void	wm_initialize_hardware_bits(struct wm_softc *);
 static uint32_t	wm_rxpbs_adjust_82580(uint32_t);
 static void	wm_reset_phy(struct wm_softc *);
@@ -3692,13 +3693,101 @@ wm_phy_post_reset(struct wm_softc *sc)
 		BM_PORT_GEN_CFG, reg);
 	}
 
+	/* Configure the LCD with the extended configuration region in NVM */
+	wm_init_lcd_from_nvm(sc);
+
+	/* Configure the LCD with the OEM bits in NVM */
+}
+
+void
+wm_init_lcd_from_nvm(struct wm_softc *sc)
+{
+	uint32_t extcnfctr, sw_cfg_mask, cnf_size, word_addr, i, reg;
+	uint16_t phy_page = 0;
+
+	switch (sc->sc_type) {
+	case WM_T_ICH8:
+		if (sc->sc_phytype != WMPHY_IGP_3)
+			return;
+
+		if ((sc->sc_pcidevid == PCI_PRODUCT_INTEL_82801H_AMT)
+		|| (sc->sc_pcidevid == PCI_PRODUCT_INTEL_82801H_LAN)) {
+			sw_cfg_mask = FEXTNVM_SW_CONFIG;
+			break;
+		}
+		/* FALLTHROUGH */
+	case WM_T_PCH:
+	case WM_T_PCH2:
+	case WM_T_PCH_LPT:
+	case WM_T_PCH_SPT:
+		sw_cfg_mask = FEXTNVM_SW_CONFIG_ICH8M;
+		break;
+	default:
+		return;
+	}
+
+	sc->phy.acquire(sc);
+
+	reg = CSR_READ(sc, WMREG_FEXTNVM);
+	if ((reg & sw_cfg_mask) == 0)
+		goto release;
+
 	/*
-	 * XXX Configure the LCD with th extended configuration region
-	 * in NVM
+	 * Make sure HW does not configure LCD from PHY extended configuration
+	 * before SW configuration
 	 */
+	extcnfctr = CSR_READ(sc, WMREG_EXTCNFCTR);
+	if ((sc->sc_type < WM_T_PCH2)
+	&& ((extcnfctr & EXTCNFCTR_PCIE_WRITE_ENABLE) != 0))
+		goto release;
 
-	/* Configure the LCD with the OEM bits in NVM */
+	/* word_addr is in DWORD */
+	word_addr = __SHIFTOUT(extcnfctr, EXTCNFCTR_EXT_CNF_POINTER) << 1;
+	
+	reg = CSR_READ(sc, WMREG_EXTCNFSIZE);
+	cnf_size = __SHIFTOUT(reg, EXTCNFSIZE_LENGTH);
+
+	if (((sc->sc_type == WM_T_PCH)
+		&& ((extcnfctr & EXTCNFCTR_OEM_WRITE_ENABLE) == 0))
+	|| (sc->sc_type > WM_T_PCH)) {
+		/*
+		 * HW configures the SMBus address and LEDs when the OEM and
+		 * LCD Write Enable bits are set in the NVM. When both NVM bits
+		 * are cleared, SW will configure them instead.
+		 */
+		device_printf(sc->sc_dev, "%s: need write_smbus()\n",
+		__func__);
+
+		reg = CSR_READ(sc, WMREG_LEDCTL);
+		wm_gmii_hv_writereg_locked(sc->sc_dev, 1, HV_LED_CONFIG, reg);
+	}
+
+	/* Configure LCD from extended configuration region. */
+	for (i = 0; i < cnf_size; i++) {
+		uint16_t reg_data, reg_addr;
+
+		if (wm_nvm_read(sc, (word_addr + i * 2), 1, ®_data) != 0)
+			goto release

CVS commit: src/sys/dev/pci

2017-07-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jul 13 08:04:56 UTC 2017

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

Log Message:
- Fix a bug that wm_gmii_i82544_{read,write}reg() didn't take care of page
  select. PHY access from igphy() automatically did it, but accessing from
  wm(4) for wrokaround didn't work correctly. This change affects 8254[17],
  8257[12] ICH8, ICH9 and ICH10.
- Add diagnostic code.


To generate a diff of this commit:
cvs rdiff -u -r1.521 -r1.522 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.521 src/sys/dev/pci/if_wm.c:1.522
--- src/sys/dev/pci/if_wm.c:1.521	Thu Jul 13 07:50:49 2017
+++ src/sys/dev/pci/if_wm.c	Thu Jul 13 08:04:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.521 2017/07/13 07:50:49 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.522 2017/07/13 08:04:56 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.521 2017/07/13 07:50:49 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.522 2017/07/13 08:04:56 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -9617,6 +9617,12 @@ wm_gmii_mdic_readreg(device_t dev, int p
 	uint32_t mdic = 0;
 	int i, rv;
 
+	if (reg > MII_ADDRMASK) {
+		device_printf(dev, "%s: PHYTYPE = %d, addr 0x%x > 0x1f\n",
+		__func__, sc->sc_phytype, reg);
+		reg &= MII_ADDRMASK;
+	}
+
 	CSR_WRITE(sc, WMREG_MDIC, MDIC_OP_READ | MDIC_PHYADD(phy) |
 	MDIC_REGADD(reg));
 
@@ -9658,6 +9664,12 @@ wm_gmii_mdic_writereg(device_t dev, int 
 	uint32_t mdic = 0;
 	int i;
 
+	if (reg > MII_ADDRMASK) {
+		device_printf(dev, "%s: PHYTYPE = %d, addr 0x%x > 0x1f\n",
+		__func__, sc->sc_phytype, reg);
+		reg &= MII_ADDRMASK;
+	}
+
 	CSR_WRITE(sc, WMREG_MDIC, MDIC_OP_WRITE | MDIC_PHYADD(phy) |
 	MDIC_REGADD(reg) | MDIC_DATA(val));
 
@@ -9691,7 +9703,24 @@ wm_gmii_i82544_readreg(device_t dev, int
 		device_printf(dev, "%s: failed to get semaphore\n", __func__);
 		return 0;
 	}
-	rv = wm_gmii_mdic_readreg(dev, phy, reg);
+
+	if (reg > BME1000_MAX_MULTI_PAGE_REG) {
+		switch (sc->sc_phytype) {
+		case WMPHY_IGP:
+		case WMPHY_IGP_2:
+		case WMPHY_IGP_3:
+			wm_gmii_mdic_writereg(dev, phy, MII_IGPHY_PAGE_SELECT, reg);
+			break;
+		default:
+#ifdef WM_DEBUG
+			device_printf(dev, "%s: PHYTYPE = 0x%x, addr = %02x\n",
+			__func__, sc->sc_phytype, reg);
+#endif
+			break;
+		}
+	}
+	
+	rv = wm_gmii_mdic_readreg(dev, phy, reg & MII_ADDRMASK);
 	sc->phy.release(sc);
 
 	return rv;
@@ -9711,7 +9740,24 @@ wm_gmii_i82544_writereg(device_t dev, in
 		device_printf(dev, "%s: failed to get semaphore\n", __func__);
 		return;
 	}
-	wm_gmii_mdic_writereg(dev, phy, reg, val);
+
+	if (reg > BME1000_MAX_MULTI_PAGE_REG) {
+		switch (sc->sc_phytype) {
+		case WMPHY_IGP:
+		case WMPHY_IGP_2:
+		case WMPHY_IGP_3:
+			wm_gmii_mdic_writereg(dev, phy, MII_IGPHY_PAGE_SELECT, reg);
+			break;
+		default:
+#ifdef WM_DEBUG
+			device_printf(dev, "%s: PHYTYPE == 0x%x, addr = %02x",
+			__func__, sc->sc_phytype, reg);
+#endif
+			break;
+		}
+	}
+			
+	wm_gmii_mdic_writereg(dev, phy, reg & MII_ADDRMASK, val);
 	sc->phy.release(sc);
 }
 
@@ -10092,6 +10138,13 @@ wm_gmii_82580_readreg(device_t dev, int 
 		return 0;
 	}
 
+#ifdef DIAGNOSTIC
+	if (reg > MII_ADDRMASK) {
+		device_printf(dev, "%s: PHYTYPE = %d, addr 0x%x > 0x1f\n",
+		__func__, sc->sc_phytype, reg);
+		reg &= MII_ADDRMASK;
+	}
+#endif
 	rv = wm_gmii_mdic_readreg(dev, phy, reg);
 
 	sc->phy.release(sc);
@@ -10115,6 +10168,13 @@ wm_gmii_82580_writereg(device_t dev, int
 		return;
 	}
 
+#ifdef DIAGNOSTIC
+	if (reg > MII_ADDRMASK) {
+		device_printf(dev, "%s: PHYTYPE = %d, addr 0x%x > 0x1f\n",
+		__func__, sc->sc_phytype, reg);
+		reg &= MII_ADDRMASK;
+	}
+#endif
 	wm_gmii_mdic_writereg(dev, phy, reg, val);
 
 	sc->phy.release(sc);



CVS commit: src/sys/dev/pci

2017-07-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jul 13 07:50:49 UTC 2017

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

Log Message:
- Use device_printf() instead of aprint_error_dev() for PHY read/write
  functions because those are used not only in device attach.
- Add debug printf.
- Rename variables.


To generate a diff of this commit:
cvs rdiff -u -r1.520 -r1.521 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.520 src/sys/dev/pci/if_wm.c:1.521
--- src/sys/dev/pci/if_wm.c:1.520	Wed Jul 12 08:18:36 2017
+++ src/sys/dev/pci/if_wm.c	Thu Jul 13 07:50:49 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.520 2017/07/12 08:18:36 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.521 2017/07/13 07:50:49 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.520 2017/07/12 08:18:36 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.521 2017/07/13 07:50:49 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -9012,6 +9012,9 @@ wm_gmii_setup_phytype(struct wm_softc *s
 	mii_readreg_t new_readreg;
 	mii_writereg_t new_writereg;
 
+	DPRINTF(WM_DEBUG_INIT, ("%s: %s called\n",
+		device_xname(sc->sc_dev), __func__));
+
 	if (mii->mii_readreg == NULL) {
 		/*
 		 *  This is the first call of this function. For ICH and PCH
@@ -9570,9 +9573,9 @@ wm_i82543_mii_recvbits(struct wm_softc *
  *	Read a PHY register on the GMII (i82543 version).
  */
 static int
-wm_gmii_i82543_readreg(device_t self, int phy, int reg)
+wm_gmii_i82543_readreg(device_t dev, int phy, int reg)
 {
-	struct wm_softc *sc = device_private(self);
+	struct wm_softc *sc = device_private(dev);
 	int rv;
 
 	wm_i82543_mii_sendbits(sc, 0xU, 32);
@@ -9581,7 +9584,7 @@ wm_gmii_i82543_readreg(device_t self, in
 	rv = wm_i82543_mii_recvbits(sc) & 0x;
 
 	DPRINTF(WM_DEBUG_GMII, ("%s: GMII: read phy %d reg %d -> 0x%04x\n",
-	device_xname(sc->sc_dev), phy, reg, rv));
+	device_xname(dev), phy, reg, rv));
 
 	return rv;
 }
@@ -9592,9 +9595,9 @@ wm_gmii_i82543_readreg(device_t self, in
  *	Write a PHY register on the GMII (i82543 version).
  */
 static void
-wm_gmii_i82543_writereg(device_t self, int phy, int reg, int val)
+wm_gmii_i82543_writereg(device_t dev, int phy, int reg, int val)
 {
-	struct wm_softc *sc = device_private(self);
+	struct wm_softc *sc = device_private(dev);
 
 	wm_i82543_mii_sendbits(sc, 0xU, 32);
 	wm_i82543_mii_sendbits(sc, val | (MII_COMMAND_ACK << 16) |
@@ -9608,9 +9611,9 @@ wm_gmii_i82543_writereg(device_t self, i
  *	Read a PHY register on the GMII.
  */
 static int
-wm_gmii_mdic_readreg(device_t self, int phy, int reg)
+wm_gmii_mdic_readreg(device_t dev, int phy, int reg)
 {
-	struct wm_softc *sc = device_private(self);
+	struct wm_softc *sc = device_private(dev);
 	uint32_t mdic = 0;
 	int i, rv;
 
@@ -9626,12 +9629,12 @@ wm_gmii_mdic_readreg(device_t self, int 
 
 	if ((mdic & MDIC_READY) == 0) {
 		log(LOG_WARNING, "%s: MDIC read timed out: phy %d reg %d\n",
-		device_xname(sc->sc_dev), phy, reg);
+		device_xname(dev), phy, reg);
 		rv = 0;
 	} else if (mdic & MDIC_E) {
 #if 0 /* This is normal if no PHY is present. */
 		log(LOG_WARNING, "%s: MDIC read error: phy %d reg %d\n",
-		device_xname(sc->sc_dev), phy, reg);
+		device_xname(dev), phy, reg);
 #endif
 		rv = 0;
 	} else {
@@ -9649,9 +9652,9 @@ wm_gmii_mdic_readreg(device_t self, int 
  *	Write a PHY register on the GMII.
  */
 static void
-wm_gmii_mdic_writereg(device_t self, int phy, int reg, int val)
+wm_gmii_mdic_writereg(device_t dev, int phy, int reg, int val)
 {
-	struct wm_softc *sc = device_private(self);
+	struct wm_softc *sc = device_private(dev);
 	uint32_t mdic = 0;
 	int i;
 
@@ -9667,10 +9670,10 @@ wm_gmii_mdic_writereg(device_t self, int
 
 	if ((mdic & MDIC_READY) == 0)
 		log(LOG_WARNING, "%s: MDIC write timed out: phy %d reg %d\n",
-		device_xname(sc->sc_dev), phy, reg);
+		device_xname(dev), phy, reg);
 	else if (mdic & MDIC_E)
 		log(LOG_WARNING, "%s: MDIC write error: phy %d reg %d\n",
-		device_xname(sc->sc_dev), phy, reg);
+		device_xname(dev), phy, reg);
 }
 
 /*
@@ -9679,17 +9682,16 @@ wm_gmii_mdic_writereg(device_t self, int
  *	Read a PHY register on the GMII.
  */
 static int
-wm_gmii_i82544_readreg(device_t self, int phy, int reg)
+wm_gmii_i82544_readreg(device_t dev, int phy, int reg)
 {
-	struct wm_softc *sc = device_private(self);
+	struct wm_softc *sc = device_private(dev);
 	int rv;
 
 	if (sc->phy.acquire(sc)) {
-		aprint_error_dev(sc->sc_dev, "%s: failed to get semaphore\n",
-		__func__);
+		device_printf(dev, "%s: failed to get semaphore\n", __func__);
 		return 0;
 	}
-	rv = wm_gmii_mdic_readreg(self, phy, reg);
+	rv = wm_gmii_mdic_readreg(dev, phy, reg);
 	sc->phy.release