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

2018-11-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 12 08:46:54 UTC 2018

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

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

bin/sh/parser.c: revision 1.152

PR bin/53712

Avoid crash from redirect on null compound command.


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

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

Modified files:

Index: src/bin/sh/parser.c
diff -u src/bin/sh/parser.c:1.132.2.6 src/bin/sh/parser.c:1.132.2.7
--- src/bin/sh/parser.c:1.132.2.6	Mon Sep 10 15:45:11 2018
+++ src/bin/sh/parser.c	Mon Nov 12 08:46:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: parser.c,v 1.132.2.6 2018/09/10 15:45:11 martin Exp $	*/
+/*	$NetBSD: parser.c,v 1.132.2.7 2018/11/12 08:46:54 martin Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)parser.c	8.7 (Berkeley) 5/16/95";
 #else
-__RCSID("$NetBSD: parser.c,v 1.132.2.6 2018/09/10 15:45:11 martin Exp $");
+__RCSID("$NetBSD: parser.c,v 1.132.2.7 2018/11/12 08:46:54 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -597,7 +597,7 @@ command(void)
 	tokpushback++;
 	*rpp = NULL;
 	if (redir) {
-		if (n1->type != NSUBSHELL) {
+		if (n1 == NULL || n1->type != NSUBSHELL) {
 			n2 = stalloc(sizeof(struct nredir));
 			n2->type = NREDIR;
 			n2->nredir.n = n1;



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

2018-11-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 12 08:50:18 UTC 2018

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

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

sys/net/if_gif.c: revision 1.145

Fix ALTQ on gif(4). Reported and tested by Anthony Mallet, advised by Greg 
Troxel, thanks.

l2tp(4) and ipsecif(4) don't support ALTQ yet. So, they don't require this fix.

XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.126.2.12 -r1.126.2.13 src/sys/net/if_gif.c

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

Modified files:

Index: src/sys/net/if_gif.c
diff -u src/sys/net/if_gif.c:1.126.2.12 src/sys/net/if_gif.c:1.126.2.13
--- src/sys/net/if_gif.c:1.126.2.12	Sun Oct 21 11:55:54 2018
+++ src/sys/net/if_gif.c	Mon Nov 12 08:50:18 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gif.c,v 1.126.2.12 2018/10/21 11:55:54 martin Exp $	*/
+/*	$NetBSD: if_gif.c,v 1.126.2.13 2018/11/12 08:50:18 martin Exp $	*/
 /*	$KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.126.2.12 2018/10/21 11:55:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.126.2.13 2018/11/12 08:50:18 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -489,7 +489,8 @@ gif_output(struct ifnet *ifp, struct mbu
 	m->m_pkthdr.csum_flags = 0;
 	m->m_pkthdr.csum_data = 0;
 
-	error = gif_transmit_direct(var, m);
+	error = if_transmit_lock(ifp, m);
+
 end:
 	if (var != NULL)
 		gif_putref_variant(var, &psref);



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

2018-11-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 12 08:56:15 UTC 2018

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

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

sys/kern/kern_proc.c: revision 1.219 (via patch)

Fix buffer overflow, which can lead to severe information leak. Detected
by kASan.


To generate a diff of this commit:
cvs rdiff -u -r1.206.6.4 -r1.206.6.5 src/sys/kern/kern_proc.c

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

Modified files:

Index: src/sys/kern/kern_proc.c
diff -u src/sys/kern/kern_proc.c:1.206.6.4 src/sys/kern/kern_proc.c:1.206.6.5
--- src/sys/kern/kern_proc.c:1.206.6.4	Mon Apr 16 13:31:33 2018
+++ src/sys/kern/kern_proc.c	Mon Nov 12 08:56:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_proc.c,v 1.206.6.4 2018/04/16 13:31:33 martin Exp $	*/
+/*	$NetBSD: kern_proc.c,v 1.206.6.5 2018/11/12 08:56:15 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.206.6.4 2018/04/16 13:31:33 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.206.6.5 2018/11/12 08:56:15 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_kstack.h"
@@ -2461,7 +2461,8 @@ fill_pathname(struct lwp *l, pid_t pid, 
 
 	len = strlen(path) + 1;
 	if (oldp != NULL) {
-		error = sysctl_copyout(l, path, oldp, *oldlenp);
+		size_t copylen = min(len, *oldlenp);
+		error = sysctl_copyout(l, path, oldp, copylen);
 		if (error == 0 && *oldlenp < len)
 			error = ENOSPC;
 	}



CVS commit: [netbsd-8] src/doc

2018-11-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 12 08:57:23 UTC 2018

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

Log Message:
Tickets #1086 - #1088


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.51 -r1.1.2.52 src/doc/CHANGES-8.1

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

Modified files:

Index: src/doc/CHANGES-8.1
diff -u src/doc/CHANGES-8.1:1.1.2.51 src/doc/CHANGES-8.1:1.1.2.52
--- src/doc/CHANGES-8.1:1.1.2.51	Thu Nov  8 12:11:27 2018
+++ src/doc/CHANGES-8.1	Mon Nov 12 08:57:23 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.1,v 1.1.2.51 2018/11/08 12:11:27 martin Exp $
+# $NetBSD: CHANGES-8.1,v 1.1.2.52 2018/11/12 08:57:23 martin Exp $
 
 A complete list of changes from the NetBSD 8.0 release to the NetBSD 8.1
 release:
@@ -1646,3 +1646,18 @@ sys/dev/pci/if_wm.c			1.590-1.596 via pa
 	- KNF & Use macro.
 	[msaitoh, ticket #1085]
 
+bin/sh/parser.c	1.152
+
+	Avoid crash from redirect on null compound command.
+	[kre, ticket #1086]
+
+sys/net/if_gif.c1.145
+
+	Fix ALTQ on gif(4).
+	[knakahara, ticket #1087]
+
+sys/kern/kern_proc.c1.219 (patch)
+
+	Fix buffer overflow, which can lead to severe information leak.
+	[maxv, ticket #1088]
+



CVS commit: src/sys/kern

2018-11-12 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Nov 12 09:21:13 UTC 2018

Modified Files:
src/sys/kern: uipc_syscalls.c

Log Message:
sys_recvmmsg: don't defer an error that already gets returned.


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/sys/kern/uipc_syscalls.c

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

Modified files:

Index: src/sys/kern/uipc_syscalls.c
diff -u src/sys/kern/uipc_syscalls.c:1.198 src/sys/kern/uipc_syscalls.c:1.199
--- src/sys/kern/uipc_syscalls.c:1.198	Wed Nov  7 09:59:12 2018
+++ src/sys/kern/uipc_syscalls.c	Mon Nov 12 09:21:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_syscalls.c,v 1.198 2018/11/07 09:59:12 hannken Exp $	*/
+/*	$NetBSD: uipc_syscalls.c,v 1.199 2018/11/12 09:21:13 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.198 2018/11/07 09:59:12 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.199 2018/11/12 09:21:13 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pipe.h"
@@ -1124,17 +1124,16 @@ sys_recvmmsg(struct lwp *l, const struct
 
 	*retval = dg;
 
-	if (error)
-		so->so_rerror = error;
-
-	fd_putfile(s);
-
 	/*
 	 * If we succeeded at least once, return 0, hopefully so->so_rerror
 	 * will catch it next time.
 	 */
-	if (dg)
-		return 0;
+	if (error && dg > 0) {
+		so->so_rerror = error;
+		error = 0;
+	}
+
+	fd_putfile(s);
 
 	return error;
 }



CVS commit: src/external/bsd/nsd/include

2018-11-12 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Nov 12 09:21:45 UTC 2018

Modified Files:
src/external/bsd/nsd/include: config.h

Log Message:
Re-enable {send,recv}mmsg now they are working.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/nsd/include/config.h

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

Modified files:

Index: src/external/bsd/nsd/include/config.h
diff -u src/external/bsd/nsd/include/config.h:1.4 src/external/bsd/nsd/include/config.h:1.5
--- src/external/bsd/nsd/include/config.h:1.4	Thu Nov  1 19:11:31 2018
+++ src/external/bsd/nsd/include/config.h	Mon Nov 12 09:21:45 2018
@@ -233,13 +233,11 @@
 /* Define to 1 if you have the `reallocarray' function. */
 #define HAVE_REALLOCARRAY 1
 
-#ifdef notyet
 /* Define if recvmmsg is implemented */
 #define HAVE_RECVMMSG 1
 
 /* Define if sendmmsg is implemented */
 #define HAVE_SENDMMSG 1
-#endif
 
 /* Define to 1 if you have the `setregid' function. */
 #define HAVE_SETREGID 1



CVS commit: src/lib

2018-11-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 12 09:25:42 UTC 2018

Modified Files:
src/lib: Makefile

Log Message:
Do not build a compat i386 version of libnvmm.


To generate a diff of this commit:
cvs rdiff -u -r1.262 -r1.263 src/lib/Makefile

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

Modified files:

Index: src/lib/Makefile
diff -u src/lib/Makefile:1.262 src/lib/Makefile:1.263
--- src/lib/Makefile:1.262	Sat Nov 10 09:28:56 2018
+++ src/lib/Makefile	Mon Nov 12 09:25:42 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.262 2018/11/10 09:28:56 maxv Exp $
+#	$NetBSD: Makefile,v 1.263 2018/11/12 09:25:42 martin Exp $
 #	from: @(#)Makefile	5.25.1.1 (Berkeley) 5/7/91
 
 .include 
@@ -50,7 +50,7 @@ SUBDIR+=	librumpclient
 SUBDIR+=	libskey
 .endif
 
-.if ${MACHINE_ARCH} == "x86_64"
+.if ${MACHINE_ARCH} == "x86_64" && ${MLIBDIR:Unone} != "i386"
 SUBDIR+=	libnvmm
 .endif
 



CVS commit: [netbsd-8] src

2018-11-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 12 09:43:19 UTC 2018

Modified Files:
src/external/bsd/nsd/include [netbsd-8]: config.h
src/sys/kern [netbsd-8]: uipc_socket.c uipc_syscalls.c

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

external/bsd/nsd/include/config.h: revision 1.5
sys/kern/uipc_syscalls.c: revision 1.198
sys/kern/uipc_syscalls.c: revision 1.199
sys/kern/uipc_socket.c: revision 1.267

Update getsockopt(SO_ERROR) to behave like soreceive() and
return and clear so->so_rerror if so->so_error is zero.

Ok: christos@

 -

Don't defer errors from sendmmsg().  This matches the linux manpage.

Defer errors from recvmmsg() through so_rerror and
tests and return a deferred error on entry.

Ok: christos@

 -

sys_recvmmsg: don't defer an error that already gets returned.

 -

Re-enable {send,recv}mmsg now they are working.


To generate a diff of this commit:
cvs rdiff -u -r1.1.8.2 -r1.1.8.3 src/external/bsd/nsd/include/config.h
cvs rdiff -u -r1.255.2.3 -r1.255.2.4 src/sys/kern/uipc_socket.c
cvs rdiff -u -r1.186.6.1 -r1.186.6.2 src/sys/kern/uipc_syscalls.c

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

Modified files:

Index: src/external/bsd/nsd/include/config.h
diff -u src/external/bsd/nsd/include/config.h:1.1.8.2 src/external/bsd/nsd/include/config.h:1.1.8.3
--- src/external/bsd/nsd/include/config.h:1.1.8.2	Sat Nov  3 17:15:58 2018
+++ src/external/bsd/nsd/include/config.h	Mon Nov 12 09:43:19 2018
@@ -233,13 +233,11 @@
 /* Define to 1 if you have the `reallocarray' function. */
 #define HAVE_REALLOCARRAY 1
 
-#ifdef notyet
 /* Define if recvmmsg is implemented */
 #define HAVE_RECVMMSG 1
 
 /* Define if sendmmsg is implemented */
 #define HAVE_SENDMMSG 1
-#endif
 
 /* Define to 1 if you have the `setregid' function. */
 #define HAVE_SETREGID 1

Index: src/sys/kern/uipc_socket.c
diff -u src/sys/kern/uipc_socket.c:1.255.2.3 src/sys/kern/uipc_socket.c:1.255.2.4
--- src/sys/kern/uipc_socket.c:1.255.2.3	Sat Jun  9 15:16:30 2018
+++ src/sys/kern/uipc_socket.c	Mon Nov 12 09:43:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_socket.c,v 1.255.2.3 2018/06/09 15:16:30 martin Exp $	*/
+/*	$NetBSD: uipc_socket.c,v 1.255.2.4 2018/11/12 09:43:19 martin Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.255.2.3 2018/06/09 15:16:30 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.255.2.4 2018/11/12 09:43:19 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1970,6 +1970,10 @@ sogetopt1(struct socket *so, struct sock
 		break;
 
 	case SO_ERROR:
+		if (so->so_error == 0) {
+			so->so_error = so->so_rerror;
+			so->so_rerror = 0;
+		}
 		error = sockopt_setint(sopt, so->so_error);
 		so->so_error = 0;
 		break;

Index: src/sys/kern/uipc_syscalls.c
diff -u src/sys/kern/uipc_syscalls.c:1.186.6.1 src/sys/kern/uipc_syscalls.c:1.186.6.2
--- src/sys/kern/uipc_syscalls.c:1.186.6.1	Sun Mar 18 10:57:01 2018
+++ src/sys/kern/uipc_syscalls.c	Mon Nov 12 09:43:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_syscalls.c,v 1.186.6.1 2018/03/18 10:57:01 martin Exp $	*/
+/*	$NetBSD: uipc_syscalls.c,v 1.186.6.2 2018/11/12 09:43:19 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.186.6.1 2018/03/18 10:57:01 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.186.6.2 2018/11/12 09:43:19 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pipe.h"
@@ -809,14 +809,11 @@ sys_sendmmsg(struct lwp *l, const struct
 	}
 
 	*retval = dg;
-	if (error)
-		so->so_error = error;
 
 	fd_putfile(s);
 
 	/*
-	 * If we succeeded at least once, return 0, hopefully so->so_error
-	 * will catch it next time.
+	 * If we succeeded at least once, return 0.
 	 */
 	if (dg)
 		return 0;
@@ -1062,6 +1059,16 @@ sys_recvmmsg(struct lwp *l, const struct
 	if ((error = fd_getsock(s, &so)) != 0)
 		return error;
 
+	/*
+	 * If so->so_rerror holds a deferred error return it now.
+	 */
+	if (so->so_rerror) {
+		error = so->so_rerror;
+		so->so_rerror = 0;
+		fd_putfile(s);
+		return error;
+	}
+
 	vlen = SCARG(uap, vlen);
 	if (vlen > 1024)
 		vlen = 1024;
@@ -1126,17 +1133,17 @@ sys_recvmmsg(struct lwp *l, const struct
 		m_free(from);
 
 	*retval = dg;
-	if (error)
-		so->so_error = error;
-
-	fd_putfile(s);
 
 	/*
-	 * If we succeeded at least once, return 0, hopefully so->so_error
+	 * If we succeeded at least once, return 0, hopefully so->so_rerror
 	 * will catch it next time.
 	 */
-	if (dg)
-		return 0;
+	if (error && dg > 0) {
+		so->so_rerror = error;
+		error = 0;
+	}
+
+	fd_putfile(s);
 
 	return error;
 }



CVS commit: [netbsd-8] src/doc

2018-11-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 12 09:44:17 UTC 2018

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

Log Message:
Ticket #1089


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.52 -r1.1.2.53 src/doc/CHANGES-8.1

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

Modified files:

Index: src/doc/CHANGES-8.1
diff -u src/doc/CHANGES-8.1:1.1.2.52 src/doc/CHANGES-8.1:1.1.2.53
--- src/doc/CHANGES-8.1:1.1.2.52	Mon Nov 12 08:57:23 2018
+++ src/doc/CHANGES-8.1	Mon Nov 12 09:44:17 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.1,v 1.1.2.52 2018/11/12 08:57:23 martin Exp $
+# $NetBSD: CHANGES-8.1,v 1.1.2.53 2018/11/12 09:44:17 martin Exp $
 
 A complete list of changes from the NetBSD 8.0 release to the NetBSD 8.1
 release:
@@ -1661,3 +1661,10 @@ sys/kern/kern_proc.c1.219 (patch)
 	Fix buffer overflow, which can lead to severe information leak.
 	[maxv, ticket #1088]
 
+external/bsd/nsd/include/config.h		1.5
+sys/kern/uipc_socket.c1.267
+sys/kern/uipc_syscalls.c			1.198,1.199
+
+	Fix sendmmsg() and recvmmsg() and re-enable them for NSD.
+	[hannken, ticket #1089]
+



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

2018-11-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 12 12:17:07 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by manu in ticket #1090):

sys/dev/usb/ugen.c: revision 1.141

Enfore USB timeout on ugen(4) write operations


To generate a diff of this commit:
cvs rdiff -u -r1.134.10.1 -r1.134.10.2 src/sys/dev/usb/ugen.c

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

Modified files:

Index: src/sys/dev/usb/ugen.c
diff -u src/sys/dev/usb/ugen.c:1.134.10.1 src/sys/dev/usb/ugen.c:1.134.10.2
--- src/sys/dev/usb/ugen.c:1.134.10.1	Wed Jan 31 18:01:55 2018
+++ src/sys/dev/usb/ugen.c	Mon Nov 12 12:17:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ugen.c,v 1.134.10.1 2018/01/31 18:01:55 martin Exp $	*/
+/*	$NetBSD: ugen.c,v 1.134.10.2 2018/11/12 12:17:06 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.134.10.1 2018/01/31 18:01:55 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.134.10.2 2018/11/12 12:17:06 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1428,6 +1428,7 @@ ugen_do_ioctl(struct ugen_softc *sc, int
 	uint8_t conf, alt;
 	int cdesclen;
 	int error;
+	int dir;
 
 	DPRINTFN(5, ("ugenioctl: cmd=%08lx\n", cmd));
 	if (sc->sc_dying)
@@ -1450,14 +1451,13 @@ ugen_do_ioctl(struct ugen_softc *sc, int
 			sce->state &= ~UGEN_SHORT_OK;
 		return 0;
 	case USB_SET_TIMEOUT:
-		sce = &sc->sc_endpoints[endpt][IN];
-		if (sce == NULL
-		/* XXX this shouldn't happen, but the distinction between
-		   input and output pipes isn't clear enough.
-		   || sce->pipeh == NULL */
-			)
-			return EINVAL;
-		sce->timeout = *(int *)addr;
+		for (dir = OUT; dir <= IN; dir++) {
+			sce = &sc->sc_endpoints[endpt][dir];
+			if (sce == NULL)
+return EINVAL;
+
+			sce->timeout = *(int *)addr;
+		}
 		return 0;
 	case USB_SET_BULK_RA:
 		if (endpt == USB_CONTROL_ENDPOINT)



CVS commit: [netbsd-8] src/sys

2018-11-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 12 12:23:20 UTC 2018

Modified Files:
src/sys/kern [netbsd-8]: uipc_usrreq.c
src/sys/netipsec [netbsd-8]: keysock.c

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

sys/netipsec/keysock.c: revision 1.66
sys/kern/uipc_usrreq.c: revision 1.187

Don't call soroverflow when we return the error to the sender.

Thanks to thorpej@ for a sanity check.


To generate a diff of this commit:
cvs rdiff -u -r1.181.8.2 -r1.181.8.3 src/sys/kern/uipc_usrreq.c
cvs rdiff -u -r1.58.2.2 -r1.58.2.3 src/sys/netipsec/keysock.c

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

Modified files:

Index: src/sys/kern/uipc_usrreq.c
diff -u src/sys/kern/uipc_usrreq.c:1.181.8.2 src/sys/kern/uipc_usrreq.c:1.181.8.3
--- src/sys/kern/uipc_usrreq.c:1.181.8.2	Sat May 12 10:42:22 2018
+++ src/sys/kern/uipc_usrreq.c	Mon Nov 12 12:23:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_usrreq.c,v 1.181.8.2 2018/05/12 10:42:22 martin Exp $	*/
+/*	$NetBSD: uipc_usrreq.c,v 1.181.8.3 2018/11/12 12:23:20 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2004, 2008, 2009 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.181.8.2 2018/05/12 10:42:22 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.181.8.3 2018/11/12 12:23:20 martin Exp $");
 
 #include 
 #include 
@@ -332,11 +332,13 @@ unp_output(struct mbuf *m, struct mbuf *
 		unp_dispose(control);
 		m_freem(control);
 		m_freem(m);
-		soroverflow(so2);
-		return (ENOBUFS);
+		/* Don't call soroverflow because we're returning this
+		 * error directly to the sender. */
+		so2->so_rcv.sb_overflowed++;
+		return ENOBUFS;
 	} else {
 		sorwakeup(so2);
-		return (0);
+		return 0;
 	}
 }
 

Index: src/sys/netipsec/keysock.c
diff -u src/sys/netipsec/keysock.c:1.58.2.2 src/sys/netipsec/keysock.c:1.58.2.3
--- src/sys/netipsec/keysock.c:1.58.2.2	Mon Apr  9 13:34:10 2018
+++ src/sys/netipsec/keysock.c	Mon Nov 12 12:23:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: keysock.c,v 1.58.2.2 2018/04/09 13:34:10 bouyer Exp $	*/
+/*	$NetBSD: keysock.c,v 1.58.2.3 2018/11/12 12:23:20 martin Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/keysock.c,v 1.3.2.1 2003/01/24 05:11:36 sam Exp $	*/
 /*	$KAME: keysock.c,v 1.25 2001/08/13 20:07:41 itojun Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.58.2.2 2018/04/09 13:34:10 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.58.2.3 2018/11/12 12:23:20 martin Exp $");
 
 /* This code has derived from sys/net/rtsock.c on FreeBSD2.2.5 */
 
@@ -207,7 +207,9 @@ key_sendup0(
 		__func__);
 		PFKEY_STATINC(PFKEY_STAT_IN_NOMEM);
 		m_freem(m);
-		soroverflow(rp->rcb_socket);
+		/* Don't call soroverflow because we're returning this
+		 * error directly to the sender. */
+		rp->rcb_socket->so_rcv.sb_overflowed++;
 		error = ENOBUFS;
 	} else {
 		sorwakeup(rp->rcb_socket);



CVS commit: [netbsd-8] src/doc

2018-11-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 12 12:24:42 UTC 2018

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

Log Message:
Tickets #1090 and #1092


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.53 -r1.1.2.54 src/doc/CHANGES-8.1

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

Modified files:

Index: src/doc/CHANGES-8.1
diff -u src/doc/CHANGES-8.1:1.1.2.53 src/doc/CHANGES-8.1:1.1.2.54
--- src/doc/CHANGES-8.1:1.1.2.53	Mon Nov 12 09:44:17 2018
+++ src/doc/CHANGES-8.1	Mon Nov 12 12:24:42 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.1,v 1.1.2.53 2018/11/12 09:44:17 martin Exp $
+# $NetBSD: CHANGES-8.1,v 1.1.2.54 2018/11/12 12:24:42 martin Exp $
 
 A complete list of changes from the NetBSD 8.0 release to the NetBSD 8.1
 release:
@@ -1668,3 +1668,14 @@ sys/kern/uipc_syscalls.c			1.198,1.199
 	Fix sendmmsg() and recvmmsg() and re-enable them for NSD.
 	[hannken, ticket #1089]
 
+sys/dev/usb/ugen.c1.141
+
+	Enfore USB timeout on ugen(4) write operations.
+	[manu, ticket #1090]
+
+sys/kern/uipc_usrreq.c1.187
+sys/netipsec/keysock.c1.66
+
+	Don't call soroverflow when we return the error to the sender.
+	[roy, ticket #1092]
+



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

2018-11-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Nov 12 12:41:03 UTC 2018

Modified Files:
src/sys/arch/arm/fdt: gic_fdt.c

Log Message:
Only attach v2m if PCI support is present


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/fdt/gic_fdt.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/fdt/gic_fdt.c
diff -u src/sys/arch/arm/fdt/gic_fdt.c:1.14 src/sys/arch/arm/fdt/gic_fdt.c:1.15
--- src/sys/arch/arm/fdt/gic_fdt.c:1.14	Sun Nov 11 21:24:28 2018
+++ src/sys/arch/arm/fdt/gic_fdt.c	Mon Nov 12 12:41:03 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: gic_fdt.c,v 1.14 2018/11/11 21:24:28 jmcneill Exp $ */
+/* $NetBSD: gic_fdt.c,v 1.15 2018/11/12 12:41:03 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -26,8 +26,10 @@
  * SUCH DAMAGE.
  */
 
+#include "pci.h"
+
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.14 2018/11/11 21:24:28 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.15 2018/11/12 12:41:03 jmcneill Exp $");
 
 #include 
 #include 
@@ -57,7 +59,9 @@ struct gic_fdt_irq;
 
 static int	gic_fdt_match(device_t, cfdata_t, void *);
 static void	gic_fdt_attach(device_t, device_t, void *);
+#if NPCI > 0
 static void	gic_fdt_attach_v2m(struct gic_fdt_softc *, bus_space_tag_t, int);
+#endif
 
 static int	gic_fdt_intr(void *);
 
@@ -129,7 +133,7 @@ gic_fdt_attach(device_t parent, device_t
 	bus_addr_t addr_d, addr_c;
 	bus_size_t size_d, size_c;
 	bus_space_handle_t bsh;
-	int error, child;
+	int error;
 
 	sc->sc_dev = self;
 	sc->sc_phandle = phandle;
@@ -175,15 +179,18 @@ gic_fdt_attach(device_t parent, device_t
 
 	arm_fdt_irq_set_handler(armgic_irq_handler);
 
-	for (child = OF_child(phandle); child; child = OF_peer(child)) {
+#if NPCI > 0
+	for (int child = OF_child(phandle); child; child = OF_peer(child)) {
 		if (!fdtbus_status_okay(child))
 			continue;
 		const char * const v2m_compat[] = { "arm,gic-v2m-frame", NULL };
 		if (of_match_compatible(child, v2m_compat))
 			gic_fdt_attach_v2m(sc, faa->faa_bst, child);
 	}
+#endif
 }
 
+#if NPCI > 0
 static void
 gic_fdt_attach_v2m(struct gic_fdt_softc *sc, bus_space_tag_t bst, int phandle)
 {
@@ -224,6 +231,7 @@ gic_fdt_attach_v2m(struct gic_fdt_softc 
 		frame->frame_base + frame->frame_count);
 	}
 }
+#endif
 
 static void *
 gic_fdt_establish(device_t dev, u_int *specifier, int ipl, int flags,



CVS commit: src/sys/arch/arm

2018-11-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Nov 12 12:56:05 UTC 2018

Modified Files:
src/sys/arch/arm/acpi: acpi_machdep.c files.acpi gic_acpi.c
gicv3_acpi.c
src/sys/arch/arm/cortex: files.cortex
src/sys/arch/arm/fdt: acpi_fdt.c

Log Message:
Support building kernels with ACPI and no PCI.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/acpi/acpi_machdep.c \
src/sys/arch/arm/acpi/files.acpi
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/acpi/gic_acpi.c \
src/sys/arch/arm/acpi/gicv3_acpi.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/cortex/files.cortex
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/fdt/acpi_fdt.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/acpi/acpi_machdep.c
diff -u src/sys/arch/arm/acpi/acpi_machdep.c:1.4 src/sys/arch/arm/acpi/acpi_machdep.c:1.5
--- src/sys/arch/arm/acpi/acpi_machdep.c:1.4	Sun Oct 21 13:34:33 2018
+++ src/sys/arch/arm/acpi/acpi_machdep.c	Mon Nov 12 12:56:05 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.c,v 1.4 2018/10/21 13:34:33 jmcneill Exp $ */
+/* $NetBSD: acpi_machdep.c,v 1.5 2018/11/12 12:56:05 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "pci.h"
+
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.4 2018/10/21 13:34:33 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.5 2018/11/12 12:56:05 jmcneill Exp $");
 
 #include 
 #include 
@@ -44,7 +46,9 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_machdep
 
 #include 
 #include 
+#if NPCI > 0
 #include 
+#endif
 
 #include 
 
@@ -252,7 +256,9 @@ acpi_md_callback(struct acpi_softc *sc)
 {
 	ACPI_TABLE_HEADER *hdrp;
 
+#if NPCI > 0
 	acpimcfg_init(&arm_generic_bs_tag, NULL);
+#endif
 
 	if (acpi_madt_map() != AE_OK)
 		panic("Failed to map MADT");
Index: src/sys/arch/arm/acpi/files.acpi
diff -u src/sys/arch/arm/acpi/files.acpi:1.4 src/sys/arch/arm/acpi/files.acpi:1.5
--- src/sys/arch/arm/acpi/files.acpi:1.4	Wed Oct 24 11:01:47 2018
+++ src/sys/arch/arm/acpi/files.acpi	Mon Nov 12 12:56:05 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.acpi,v 1.4 2018/10/24 11:01:47 jmcneill Exp $
+#	$NetBSD: files.acpi,v 1.5 2018/11/12 12:56:05 jmcneill Exp $
 #
 # Configuration info for ACPI compliant ARM boards.
 #
@@ -11,7 +11,7 @@ defflag	opt_pcifixup.h		ACPI_PCI_FIXUP
 include "dev/acpi/files.acpi"
 
 file	arch/arm/acpi/acpi_machdep.c		acpi
-file	arch/arm/acpi/acpi_pci_machdep.c	acpi
+file	arch/arm/acpi/acpi_pci_machdep.c	acpi & pci
 file	arch/arm/acpi/acpi_platform.c		acpi
 file	arch/arm/acpi/acpi_table.c		acpi
 

Index: src/sys/arch/arm/acpi/gic_acpi.c
diff -u src/sys/arch/arm/acpi/gic_acpi.c:1.2 src/sys/arch/arm/acpi/gic_acpi.c:1.3
--- src/sys/arch/arm/acpi/gic_acpi.c:1.2	Sun Oct 21 00:42:05 2018
+++ src/sys/arch/arm/acpi/gic_acpi.c	Mon Nov 12 12:56:05 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: gic_acpi.c,v 1.2 2018/10/21 00:42:05 jmcneill Exp $ */
+/* $NetBSD: gic_acpi.c,v 1.3 2018/11/12 12:56:05 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "pci.h"
+
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gic_acpi.c,v 1.2 2018/10/21 00:42:05 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic_acpi.c,v 1.3 2018/11/12 12:56:05 jmcneill Exp $");
 
 #include 
 #include 
@@ -59,7 +61,9 @@ static int	gic_acpi_match(device_t, cfda
 static void	gic_acpi_attach(device_t, device_t, void *);
 
 static ACPI_STATUS gic_acpi_find_gicc(ACPI_SUBTABLE_HEADER *, void *);
+#if NPCI > 0
 static ACPI_STATUS gic_acpi_find_msi_frame(ACPI_SUBTABLE_HEADER *, void *);
+#endif
 
 CFATTACH_DECL_NEW(gic_acpi, 0, gic_acpi_match, gic_acpi_attach, NULL, NULL);
 
@@ -122,10 +126,12 @@ gic_acpi_attach(device_t parent, device_
 	};
 
 	armgic = config_found(self, &mpcaa, NULL);
+	if (armgic != NULL)
+		arm_fdt_irq_set_handler(armgic_irq_handler);
 
-	arm_fdt_irq_set_handler(armgic_irq_handler);
-
+#if NPCI > 0
 	acpi_madt_walk(gic_acpi_find_msi_frame, armgic);
+#endif
 }
 
 static ACPI_STATUS
@@ -141,6 +147,7 @@ gic_acpi_find_gicc(ACPI_SUBTABLE_HEADER 
 	return AE_LIMIT;
 }
 
+#if NPCI > 0
 static ACPI_STATUS
 gic_acpi_find_msi_frame(ACPI_SUBTABLE_HEADER *hdrp, void *aux)
 {
@@ -181,3 +188,4 @@ gic_acpi_find_msi_frame(ACPI_SUBTABLE_HE
 
 	return AE_OK;
 }
+#endif
Index: src/sys/arch/arm/acpi/gicv3_acpi.c
diff -u src/sys/arch/arm/acpi/gicv3_acpi.c:1.2 src/sys/arch/arm/acpi/gicv3_acpi.c:1.3
--- src/sys/arch/arm/acpi/gicv3_acpi.c:1.2	Fri Nov  9 23:36:58 2018
+++ src/sys/arch/arm/acpi/gicv3_acpi.c	Mon Nov 12 12:56:05 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3_acpi.c,v 1.2 2018/11/09 23:36:58 jmcneill Exp $ */
+/* $NetBSD: gicv3_acpi.c,v 1.3 2018/11/12 12:56:05 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -29,10 +29,12 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "pc

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

2018-11-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 12 16:01:35 UTC 2018

Modified Files:
src/sys/dev/usb [netbsd-8]: usb_quirks.c usb_quirks.h usbdevs
usbdi_util.c usbdi_util.h

Log Message:
Pull up following revision(s) (requested by manu in ticket #1091):

sys/dev/usb/usb_quirks.c: revision 1.88,1.89 (via patch)
sys/dev/usb/usbdi_util.c: revision 1.72 (via patch)
sys/dev/usb/usb_quirks.h: revision 1.28 (via patch)
sys/dev/usb/usbdi_util.h: revision 1.48
sys/dev/usb/usbdevs: revision 1.760,1.761 (via patch)

Add PN533 based NFC devices

 -

Workaround PN533 USB descriptor corruption

During normal operation, the PN533 chip may corrupt its USB configuration,
interface and endpoint descriptors. The device descriptor remains unaffected.

Since the descriptors are documented to be immutable, we can work around
the problem by providing hard-coded descriptors instead of pulling them
from the device.

Userland implementation such as NFC tools' libnfc use the same approach,
but this kernel quirk is still necessary so that the device can be
attached on reboot, after its USB descriptors got corrupted.

 -

Fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.86.8.1 src/sys/dev/usb/usb_quirks.c
cvs rdiff -u -r1.27 -r1.27.10.1 src/sys/dev/usb/usb_quirks.h
cvs rdiff -u -r1.736.2.1 -r1.736.2.2 src/sys/dev/usb/usbdevs
cvs rdiff -u -r1.66.2.1 -r1.66.2.2 src/sys/dev/usb/usbdi_util.c
cvs rdiff -u -r1.47 -r1.47.10.1 src/sys/dev/usb/usbdi_util.h

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

Modified files:

Index: src/sys/dev/usb/usb_quirks.c
diff -u src/sys/dev/usb/usb_quirks.c:1.86 src/sys/dev/usb/usb_quirks.c:1.86.8.1
--- src/sys/dev/usb/usb_quirks.c:1.86	Sun Dec  4 10:12:35 2016
+++ src/sys/dev/usb/usb_quirks.c	Mon Nov 12 16:01:35 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_quirks.c,v 1.86 2016/12/04 10:12:35 skrll Exp $	*/
+/*	$NetBSD: usb_quirks.c,v 1.86.8.1 2018/11/12 16:01:35 martin Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_quirks.c,v 1.30 2003/01/02 04:15:55 imp Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_quirks.c,v 1.86 2016/12/04 10:12:35 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_quirks.c,v 1.86.8.1 2018/11/12 16:01:35 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -43,13 +43,137 @@ __KERNEL_RCSID(0, "$NetBSD: usb_quirks.c
 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
 
 #ifdef USB_DEBUG
 extern int usbdebug;
 #endif
 
+#define DPRINTF(FMT,A,B,C,D)USBHIST_LOG(usbdebug,FMT,A,B,C,D)
+
 #define ANY 0x
+#define _USETW(w) { (w) & 0x00ff, ((w) & 0xff00) >> 8 }
+
+/*
+ * NXP PN533 NFC chip descriptors
+ */
+static const usb_endpoint_descriptor_t desc_ep_pn533_in = {
+	/* bLength */		sizeof(desc_ep_pn533_in),
+	/* bDescriptorType */	UDESC_ENDPOINT,
+	/* bEndpointAddress */	UE_DIR_IN | 0x04,
+	/* bmAttributes */	UE_BULK,
+	/* wMaxPacketSize */	_USETW(0x0040),
+	/* bInterval */		0x04, /* 255ms */
+};
+
+static const usb_endpoint_descriptor_t desc_ep_pn533_out = {
+	/* bLength */		sizeof(desc_ep_pn533_in),
+	/* bDescriptorType */	UDESC_ENDPOINT,
+	/* bEndpointAddress */	UE_DIR_OUT | 0x04,
+	/* bmAttributes */	UE_BULK,
+	/* wMaxPacketSize */	_USETW(0x0040),
+	/* bInterval */		0x04, /* 255ms */
+};
+
+static const usb_interface_descriptor_t desc_iface_pn533 = {
+	/* bLength */		sizeof(desc_iface_pn533),
+	/* bDescriptorType */	 UDESC_INTERFACE,
+	/* bInterfaceNumber */	 0,
+	/* bAlternateSetting */	 0,
+	/* bNumEndpoints */	 2,
+	/* bInterfaceClass */	 0xff,
+	/* bInterfaceSubClass */ 0xff,
+	/* bInterfaceProtocol */ 0xff,
+	/* iInterface */	 0,
+};
+
+static const usb_config_descriptor_t desc_conf_pn533 = {
+	/* bLength */		 sizeof(desc_conf_pn533),
+	/* bDescriptorType */	 UDESC_CONFIG,
+	/* wTotalLength	 */	 _USETW(sizeof(desc_conf_pn533) +
+	sizeof(desc_iface_pn533) +
+	sizeof(desc_ep_pn533_in) +
+	sizeof(desc_ep_pn533_out)
+ ),
+	/* bNumInterfac	*/	 1,
+	/* bConfigurationValue */1,
+	/* iConfiguration */	 0,
+	/* bmAttributes	*/	 UC_ATTR_MBO,
+	/* bMaxPower */		 0x32, /* 100mA */
+};
+
+static const usb_descriptor_t *desc_pn533[] = {
+	(const usb_descriptor_t *)&desc_conf_pn533,
+	(const usb_descriptor_t *)&desc_iface_pn533,
+	(const usb_descriptor_t *)&desc_ep_pn533_out,
+	(const usb_descriptor_t *)&desc_ep_pn533_in,
+	NULL
+};
+
+
+usbd_status
+usbd_get_desc_fake(struct usbd_device *dev, int type, int index,
+		   int len, void *desc)
+{
+	USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
+#ifdef USB_DEBUG
+	const usb_device_descriptor_t *dd = usbd_get_device_descriptor(dev);
+#endif
+	const usb_descriptor_t *ub;
+	int i = 0;
+	int j = 0;
+	usbd_status err = USBD_INVAL;
+
+	if (dev->ud_quirks == NULL || dev->ud_quirks->desc == NULL) {
+		DPRINTF("%04x/%04x: no fake descriptors",
+		UGETW(dd->idVendor), UGETW(dd->idProduct), 0, 0);
+		goto out;
+	}
+
+	for (j = 0

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

2018-11-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 12 16:02:18 UTC 2018

Modified Files:
src/sys/dev/usb [netbsd-8]: usbdevs.h usbdevs_data.h

Log Message:
regen for ticket #1091


To generate a diff of this commit:
cvs rdiff -u -r1.727.2.1 -r1.727.2.2 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.728.2.1 -r1.728.2.2 src/sys/dev/usb/usbdevs_data.h

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

Modified files:

Index: src/sys/dev/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.727.2.1 src/sys/dev/usb/usbdevs.h:1.727.2.2
--- src/sys/dev/usb/usbdevs.h:1.727.2.1	Wed Oct 31 09:32:21 2018
+++ src/sys/dev/usb/usbdevs.h	Mon Nov 12 16:02:17 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.727.2.1 2018/10/31 09:32:21 martin Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.727.2.2 2018/11/12 16:02:17 martin Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.736.2.1 2018/10/31 09:30:10 martin Exp
+ *	NetBSD: usbdevs,v 1.736.2.2 2018/11/12 16:01:35 martin Exp
  */
 
 /*
@@ -2595,6 +2595,7 @@
 
 /* Philips Semiconductor products */
 #define	USB_PRODUCT_PHILIPSSEMI_HUB1122	0x1122		/* hub */
+#define	USB_PRODUCT_PHILIPSSEMI_PN533	0x2533		/* NFC PN533 */
 
 /* P.I. Engineering products */
 #define	USB_PRODUCT_PIENGINEERING_PS2USB	0x020b		/* PS2 to Mac USB Adapter */
@@ -2938,6 +2939,8 @@
 #define	USB_PRODUCT_SHUTTLE_CDRW	0x0101		/* CD-RW Device */
 #define	USB_PRODUCT_SHUTTLE_ORCA	0x0325		/* eUSB ORCA Quad Reader */
 #define	USB_PRODUCT_SHUTTLE_SCM	0x1010		/* SCM Micro */
+#define	USB_PRODUCT_SHUTTLE_SCL3711	0x5591		/* SCM Micro SCL3711-NFC&RW */
+#define	USB_PRODUCT_SHUTTLE_SCL3712	0x5594		/* SCM Micro SCL3712-NFC&RW */
 
 /* Siemens products */
 #define	USB_PRODUCT_SIEMENS_SPEEDSTREAM	0x1001		/* SpeedStream USB */

Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.728.2.1 src/sys/dev/usb/usbdevs_data.h:1.728.2.2
--- src/sys/dev/usb/usbdevs_data.h:1.728.2.1	Wed Oct 31 09:32:21 2018
+++ src/sys/dev/usb/usbdevs_data.h	Mon Nov 12 16:02:17 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs_data.h,v 1.728.2.1 2018/10/31 09:32:21 martin Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.728.2.2 2018/11/12 16:02:17 martin Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.736.2.1 2018/10/31 09:30:10 martin Exp
+ *	NetBSD: usbdevs,v 1.736.2.2 2018/11/12 16:01:35 martin Exp
  */
 
 /*
@@ -3472,88 +3472,90 @@ static const uint16_t usb_products[] = {
 	4969, 0,
 	USB_VENDOR_PHILIPSSEMI, USB_PRODUCT_PHILIPSSEMI_HUB1122, 
 	6882, 0,
+	USB_VENDOR_PHILIPSSEMI, USB_PRODUCT_PHILIPSSEMI_PN533, 
+	15490, 15494, 0,
 	USB_VENDOR_PIENGINEERING, USB_PRODUCT_PIENGINEERING_PS2USB, 
 	8034, 5556, 9582, 4743, 4757, 0,
 	USB_VENDOR_PIENGINEERING, USB_PRODUCT_PIENGINEERING_XKEYS58, 
-	15490, 15496, 5759, 15509, 15513, 0,
+	15500, 15506, 5759, 15519, 15523, 0,
 	USB_VENDOR_PIENGINEERING, USB_PRODUCT_PIENGINEERING_XKEYS, 
-	15490, 15496, 5759, 0,
+	15500, 15506, 5759, 0,
 	USB_VENDOR_PILOTECH, USB_PRODUCT_PILOTECH_CRW600, 
-	15519, 14389, 10260, 0,
+	15529, 14389, 10260, 0,
 	USB_VENDOR_PINNACLE, USB_PRODUCT_PINNACLE_PCTV800E, 
-	15527, 15532, 0,
+	15537, 15542, 0,
 	USB_VENDOR_PINNACLE, USB_PRODUCT_PINNACLE_PCTVDVBTFLASH, 
-	4461, 15527, 6687, 11242, 0,
+	4461, 15537, 6687, 11242, 0,
 	USB_VENDOR_PINNACLE, USB_PRODUCT_PINNACLE_PCTV72E, 
-	4461, 15527, 15537, 0,
+	4461, 15537, 15547, 0,
 	USB_VENDOR_PINNACLE, USB_PRODUCT_PINNACLE_PCTV73E, 
-	4461, 15527, 15541, 0,
+	4461, 15537, 15551, 0,
 	USB_VENDOR_PLANEX, USB_PRODUCT_PLANEX_GW_US11H, 
-	15545, 5183, 0,
+	1, 5183, 0,
 	USB_VENDOR_PLANEX2, USB_PRODUCT_PLANEX2_RTL8188CUS, 
 	7246, 0,
 	USB_VENDOR_PLANEX2, USB_PRODUCT_PLANEX2_GW_US11S, 
-	15554, 5183, 0,
+	15564, 5183, 0,
 	USB_VENDOR_PLANEX2, USB_PRODUCT_PLANEX2_RTL8188CU_3, 
 	5110, 0,
 	USB_VENDOR_PLANEX2, USB_PRODUCT_PLANEX2_GWUSFANG300, 
-	15563, 0,
+	15573, 0,
 	USB_VENDOR_PLANEX2, USB_PRODUCT_PLANEX2_GWUS54GXS, 
-	15576, 0,
+	15586, 0,
 	USB_VENDOR_PLANEX2, USB_PRODUCT_PLANEX2_GW_US300, 
-	15587, 0,
+	15597, 0,
 	USB_VENDOR_PLANEX2, USB_PRODUCT_PLANEX2_GWUS54HP, 
-	15596, 0,
-	USB_VENDOR_PLANEX2, USB_PRODUCT_PLANEX2_GWUS300MINIS, 
 	15606, 0,
+	USB_VENDOR_PLANEX2, USB_PRODUCT_PLANEX2_GWUS300MINIS, 
+	15616, 0,
 	USB_VENDOR_PLANEX2, USB_PRODUCT_PLANEX2_RT3070, 
 	4976, 0,
 	USB_VENDOR_PLANEX2, USB_PRODUCT_PLANEX2_GWUSNANO, 
-	15620, 0,
-	USB_VENDOR_PLANEX2, USB_PRODUCT_PLANEX2_GWUSMICRO300, 
 	15630, 0,
+	USB_VENDOR_PLANEX2, USB_PRODUCT_PLANEX2_GWUSMICRO300, 
+	15640, 0,
 	USB_VENDOR_PLANEX2, USB_PRODUCT_PLANEX2_RTL8188CU_1, 
-	15644, 0,
+	15654, 0,
 	USB_VENDOR_PLANEX2, U

CVS commit: [netbsd-8] src/doc

2018-11-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 12 16:03:17 UTC 2018

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

Log Message:
Ticket #1091


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.54 -r1.1.2.55 src/doc/CHANGES-8.1

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

Modified files:

Index: src/doc/CHANGES-8.1
diff -u src/doc/CHANGES-8.1:1.1.2.54 src/doc/CHANGES-8.1:1.1.2.55
--- src/doc/CHANGES-8.1:1.1.2.54	Mon Nov 12 12:24:42 2018
+++ src/doc/CHANGES-8.1	Mon Nov 12 16:03:17 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.1,v 1.1.2.54 2018/11/12 12:24:42 martin Exp $
+# $NetBSD: CHANGES-8.1,v 1.1.2.55 2018/11/12 16:03:17 martin Exp $
 
 A complete list of changes from the NetBSD 8.0 release to the NetBSD 8.1
 release:
@@ -1679,3 +1679,15 @@ sys/netipsec/keysock.c1.66
 	Don't call soroverflow when we return the error to the sender.
 	[roy, ticket #1092]
 
+sys/dev/usb/usb_quirks.c			1.88,1.89 (patch)
+sys/dev/usb/usb_quirks.h			1.28 (patch)
+sys/dev/usb/usbdevs1.760,1.761 (patch)
+sys/dev/usb/usbdi_util.c			1.72 (patch)
+sys/dev/usb/usbdi_util.h			1.48 (patch)
+sys/dev/usb/usbdevs.h(regen)
+sys/dev/usb/usbdevs_data.h			(regen)
+
+	Add PN533 based NFC devices and a workaround for an errata
+	in those chips destroying USB descirptors.
+	[manu, ticket #1091]
+



CVS commit: src/lib/libnvmm

2018-11-12 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Mon Nov 12 17:46:53 UTC 2018

Modified Files:
src/lib/libnvmm: Makefile

Log Message:
No need to install shared libraries to /lib.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libnvmm/Makefile

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

Modified files:

Index: src/lib/libnvmm/Makefile
diff -u src/lib/libnvmm/Makefile:1.1 src/lib/libnvmm/Makefile:1.2
--- src/lib/libnvmm/Makefile:1.1	Sat Nov 10 09:28:56 2018
+++ src/lib/libnvmm/Makefile	Mon Nov 12 17:46:53 2018
@@ -1,6 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2018/11/10 09:28:56 maxv Exp $
-
-USE_SHLIBDIR=   yes
+# $NetBSD: Makefile,v 1.2 2018/11/12 17:46:53 nakayama Exp $
 
 .include 
 



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

2018-11-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Nov 12 18:10:37 UTC 2018

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

Log Message:
Add a comment explaining an important rule. Just to better highlight that
this rule is actually not respected.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/arch/x86/x86/cpu.c

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

Modified files:

Index: src/sys/arch/x86/x86/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.161 src/sys/arch/x86/x86/cpu.c:1.162
--- src/sys/arch/x86/x86/cpu.c:1.161	Mon Sep  3 16:29:29 2018
+++ src/sys/arch/x86/x86/cpu.c	Mon Nov 12 18:10:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.161 2018/09/03 16:29:29 riastradh Exp $	*/
+/*	$NetBSD: cpu.c,v 1.162 2018/11/12 18:10:36 maxv Exp $	*/
 
 /*
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.161 2018/09/03 16:29:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.162 2018/11/12 18:10:36 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -846,6 +846,13 @@ cpu_hatch(void *v)
 	struct pcb *pcb;
 	int s, i;
 
+	/* - */
+
+	/*
+	 * This section of code must be compiled with SSP disabled, to
+	 * prevent a race against cpu0. See sys/conf/ssp.mk.
+	 */
+
 	cpu_init_msrs(ci, true);
 	cpu_probe(ci);
 	cpu_speculation_init(ci);
@@ -863,6 +870,8 @@ cpu_hatch(void *v)
 	atomic_or_32(&ci->ci_flags, CPUF_PRESENT);
 	tsc_sync_ap(ci);
 
+	/* - */
+
 	/*
 	 * Wait to be brought online.
 	 *



CVS commit: src/sys/dev

2018-11-12 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Nov 12 18:51:01 UTC 2018

Modified Files:
src/sys/dev/ata: ata.c ata_wdc.c
src/sys/dev/ic: mvsata.c
src/sys/dev/scsipi: atapi_wdc.c

Log Message:
hold channel lock during whole ata_dmaerr()/ata_downgrade_mode() -
according to code inspection this is safe, none of the set_modes
hooks execute anything which would be taking the lock

adresses PR kern/53714 by Andreas Gustafsson


To generate a diff of this commit:
cvs rdiff -u -r1.145 -r1.146 src/sys/dev/ata/ata.c
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/ata/ata_wdc.c
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/ic/mvsata.c
cvs rdiff -u -r1.131 -r1.132 src/sys/dev/scsipi/atapi_wdc.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/ata/ata.c
diff -u src/sys/dev/ata/ata.c:1.145 src/sys/dev/ata/ata.c:1.146
--- src/sys/dev/ata/ata.c:1.145	Wed Oct 24 20:25:52 2018
+++ src/sys/dev/ata/ata.c	Mon Nov 12 18:51:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata.c,v 1.145 2018/10/24 20:25:52 jdolecek Exp $	*/
+/*	$NetBSD: ata.c,v 1.146 2018/11/12 18:51:01 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.145 2018/10/24 20:25:52 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.146 2018/11/12 18:51:01 jdolecek Exp $");
 
 #include "opt_ata.h"
 
@@ -952,6 +952,8 @@ out:
 void
 ata_dmaerr(struct ata_drive_datas *drvp, int flags)
 {
+	ata_channel_lock_owned(drvp->chnl_softc);
+
 	/*
 	 * Downgrade decision: if we get NERRS_MAX in NXFER.
 	 * We start with n_dmaerrs set to NERRS_MAX-1 so that the
@@ -1772,6 +1774,8 @@ ata_downgrade_mode(struct ata_drive_data
 	device_t drv_dev = drvp->drv_softc;
 	int cf_flags = device_cfdata(drv_dev)->cf_flags;
 
+	ata_channel_lock_owned(drvp->chnl_softc);
+
 	/* if drive or controller don't know its mode, we can't do much */
 	if ((drvp->drive_flags & ATA_DRIVE_MODE) == 0 ||
 	(atac->atac_set_modes == NULL))

Index: src/sys/dev/ata/ata_wdc.c
diff -u src/sys/dev/ata/ata_wdc.c:1.112 src/sys/dev/ata/ata_wdc.c:1.113
--- src/sys/dev/ata/ata_wdc.c:1.112	Mon Oct 22 20:13:47 2018
+++ src/sys/dev/ata/ata_wdc.c	Mon Nov 12 18:51:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata_wdc.c,v 1.112 2018/10/22 20:13:47 jdolecek Exp $	*/
+/*	$NetBSD: ata_wdc.c,v 1.113 2018/11/12 18:51:01 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001, 2003 Manuel Bouyer.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata_wdc.c,v 1.112 2018/10/22 20:13:47 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata_wdc.c,v 1.113 2018/11/12 18:51:01 jdolecek Exp $");
 
 #include "opt_ata.h"
 #include "opt_wdc.h"
@@ -729,10 +729,8 @@ wdc_ata_bio_intr(struct ata_channel *chp
 		if (drv_err != WDC_ATA_ERR)
 			goto end;
 		if (ata_bio->r_error & WDCE_CRC || ata_bio->error == ERR_DMA) {
-			ata_channel_unlock(chp);
 			ata_dmaerr(drvp,
 			(xfer->c_flags & C_POLL) ? AT_POLL : 0);
-			ata_channel_lock(chp);
 			goto err;
 		}
 	}

Index: src/sys/dev/ic/mvsata.c
diff -u src/sys/dev/ic/mvsata.c:1.44 src/sys/dev/ic/mvsata.c:1.45
--- src/sys/dev/ic/mvsata.c:1.44	Mon Oct 22 20:30:52 2018
+++ src/sys/dev/ic/mvsata.c	Mon Nov 12 18:51:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsata.c,v 1.44 2018/10/22 20:30:52 jdolecek Exp $	*/
+/*	$NetBSD: mvsata.c,v 1.45 2018/11/12 18:51:01 jdolecek Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.44 2018/10/22 20:30:52 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.45 2018/11/12 18:51:01 jdolecek Exp $");
 
 #include "opt_mvsata.h"
 
@@ -1360,9 +1360,9 @@ mvsata_bio_intr(struct ata_channel *chp,
 		if (ata_bio->error == NOERROR)
 			goto end;
 		if (ata_bio->error == ERR_DMA) {
-			ata_channel_unlock(chp);
 			ata_dmaerr(drvp,
 			(xfer->c_flags & C_POLL) ? AT_POLL : 0);
+			ata_channel_unlock(chp);
 			goto err;
 		}
 	}
@@ -2275,11 +2275,11 @@ mvsata_atapi_intr(struct ata_channel *ch
 		aprint_error_dev(atac->atac_dev,
 		"channel %d: device timeout, c_bcount=%d, c_skip=%d\n",
 		chp->ch_channel, xfer->c_bcount, xfer->c_skip);
-		ata_channel_unlock(chp);
 		if (xfer->c_flags & C_DMA)
 			ata_dmaerr(drvp,
 			(xfer->c_flags & C_POLL) ? AT_POLL : 0);
 		sc_xfer->error = XS_TIMEOUT;
+		ata_channel_unlock(chp);
 		mvsata_atapi_reset(chp, xfer);
 		return 1;
 	}
@@ -2289,9 +2289,9 @@ mvsata_atapi_intr(struct ata_channel *ch
 	 * and reset device.
 	 */
 	if ((xfer->c_flags & C_TIMEOU) && (xfer->c_flags & C_DMA)) {
-		ata_channel_unlock(chp);
 		ata_dmaerr(drvp, (xfer->c_flags & C_POLL) ? AT_POLL : 0);
 		sc_xfer->error = XS_RESET;
+		ata_channel_unlock(chp);
 		mvsata_atapi_reset(chp, xfer);
 		return (1);
 	}
@@ -2351,11 +2351,11 @@ again:
 			aprint_error_dev(atac->atac_dev,
 			"channel %d drive %d: bad data phase DATA

CVS commit: src/sys/arch/macppc/stand

2018-11-12 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Mon Nov 12 20:00:46 UTC 2018

Modified Files:
src/sys/arch/macppc/stand/bootxx: bootxx.c
src/sys/arch/macppc/stand/ofwboot: Locore.c

Log Message:
PR 51495/port-macppc

Allow ppc601 to boot off hard disk


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/macppc/stand/bootxx/bootxx.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/macppc/stand/ofwboot/Locore.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/macppc/stand/bootxx/bootxx.c
diff -u src/sys/arch/macppc/stand/bootxx/bootxx.c:1.18 src/sys/arch/macppc/stand/bootxx/bootxx.c:1.19
--- src/sys/arch/macppc/stand/bootxx/bootxx.c:1.18	Sat Mar 14 21:04:12 2009
+++ src/sys/arch/macppc/stand/bootxx/bootxx.c	Mon Nov 12 20:00:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootxx.c,v 1.18 2009/03/14 21:04:12 dsl Exp $	*/
+/*	$NetBSD: bootxx.c,v 1.19 2018/11/12 20:00:46 scole Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -33,6 +33,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -68,15 +69,21 @@ __asm(
 "	addi	%r8,8,(_start)@l\n"
 "	li	%r9,0x40	\n"	/* loop 64 times (for 2048 bytes of bootxx) */
 "	mtctr	%r9		\n"
-"1:\n"
-"	dcbf	%r0,%r8		\n"
+"\n"
+"1:	dcbf	%r0,%r8		\n"
 "	icbi	%r0,%r8		\n"
 "	addi	%r8,%r8,0x20	\n"
 "	bdnz	1b		\n"
 "	sync			\n"
 
 "	li	%r0,0		\n"
-"	mtdbatu	3,%r0		\n"
+"\n"	/* test for 601 cpu */
+"	mfspr	%r9,287		\n"	/* mfpvbr %r9 PVR = 287 */
+"	srwi	%r9,%r9,0x10	\n"
+"	cmplwi	%r9,0x02	\n"	/* 601 cpu == 0x0001 */
+"	blt	2f		\n"	/* skip over non-601 BAT setup */
+"\n"
+"	mtdbatu 3,%r0		\n"	/* non-601 BAT */
 "	mtibatu	3,%r0		\n"
 "	isync			\n"
 "	li	%r8,0x1ffe	\n"	/* map the lowest 256MB */
@@ -86,13 +93,61 @@ __asm(
 "	mtibatl	3,%r9		\n"
 "	mtibatu	3,%r8		\n"
 "	isync			\n"
-
+"	b	3f		\n"
+"\n"
+"2:	mfmsr	%r8		\n"	/* 601 BAT */
+"	mtmsr	%r0		\n"
+"	isync			\n"
+"\n"
+"	mtibatu 0,%r0		\n"
+"	mtibatu 1,%r0		\n"
+"	mtibatu 2,%r0		\n"
+"	mtibatu 3,%r0		\n"
+"\n"
+"	li	%r9,0x7f	\n"
+"	mtibatl 0,%r9		\n"
+"	li	%r9,0x1a	\n"
+"	mtibatu 0,%r9		\n"
+"\n"
+"	lis %r9,0x80		\n"
+"	addi %r9,%r9,0x7f	\n"
+"	mtibatl 1,%r9		\n"
+"	lis %r9,0x80		\n"
+"	addi %r9,%r9,0x1a	\n"
+"	mtibatu 1,%r9		\n"
+"\n"
+"	lis %r9,0x100		\n"
+"	addi %r9,%r9,0x7f	\n"
+"	mtibatl 2,%r9		\n"
+"	lis %r9,0x100		\n"
+"	addi %r9,%r9,0x1a	\n"
+"	mtibatu 2,%r9		\n"
+"\n"
+"	lis %r9,0x180		\n"
+"	addi %r9,%r9,0x7f	\n"
+"	mtibatl 3,%r9		\n"
+"	lis %r9,0x180		\n"
+"	addi %r9,%r9,0x1a	\n"
+"	mtibatu 3,%r9		\n"
+"\n"
+"	isync			\n"
+"\n"
+"	mtmsr	%r8		\n"
+"	isync			\n"
+"\n"
 	/*
 	 * setup 32 KB of stack with 32 bytes overpad (see above)
 	 */
-"	lis	%r1,(stack+32768)@ha\n"
+"3:	lis	%r1,(stack+32768)@ha\n"
 "	addi	%r1,%r1,(stack+32768)@l\n"
-"	stw	%r0,0(%r1)	\n"	/* terminate the frame link chain */
+	/*
+	 * terminate the frame link chain,
+	 * clear by bytes to avoid ppc601 alignment exceptions
+	 */
+"	stb	%r0,0(%r1)	\n"
+"	stb	%r0,1(%r1)	\n"
+"	stb	%r0,2(%r1)	\n"
+"	stb	%r0,3(%r1)	\n"
 
 "	b	startup		\n"
 );
@@ -258,10 +313,14 @@ void
 startup(int arg1, int arg2, void *openfirm)
 {
 	int fd, blk, chosen, options, j;
+	uint32_t cpuvers;
 	size_t i;
 	char *addr;
 	char bootpath[128];
 
+	__asm volatile ("mfpvr %0" : "=r"(cpuvers));
+	cpuvers >>= 16;
+
 	openfirmware = openfirm;
 
 	chosen = OF_finddevice("/chosen");
@@ -302,17 +361,19 @@ startup(int arg1, int arg2, void *openfi
 	}
 	putstr(". done!\r\nstarting stage 2...\r\n");
 
-	/*
-	 * enable D/I cache
-	 */
-	__asm(
-		"mtdbatu	3,%0\n\t"
-		"mtdbatl	3,%1\n\t"
-		"mtibatu	3,%0\n\t"
-		"mtibatl	3,%1\n\t"
-		"isync"
-	   ::	"r"(BATU(0, BAT_BL_256M, BAT_Vs)),
-		"r"(BATL(0, 0, BAT_PP_RW)));
+	if (cpuvers != MPC601) {
+		/*
+		 * enable D/I cache
+		 */
+		__asm(
+			"mtdbatu	3,%0\n\t"
+			"mtdbatl	3,%1\n\t"
+			"mtibatu	3,%0\n\t"
+			"mtibatl	3,%1\n\t"
+			"isync"
+		::	"r"(BATU(0, BAT_BL_256M, BAT_Vs)),
+			"r"(BATL(0, 0, BAT_PP_RW)));
+	}
 
 	entry_point(0, 0, openfirm);
 	for (;;);			/* just in case */

Index: src/sys/arch/macppc/stand/ofwboot/Locore.c
diff -u src/sys/arch/macppc/stand/ofwboot/Locore.c:1.32 src/sys/arch/macppc/stand/ofwboot/Locore.c:1.33
--- src/sys/arch/macppc/stand/ofwboot/Locore.c:1.32	Fri Aug 17 16:04:39 2018
+++ src/sys/arch/macppc/stand/ofwboot/Locore.c	Mon Nov 12 20:00:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: Locore.c,v 1.32 2018/08/17 16:04:39 macallan Exp $	*/
+/*	$NetBSD: Locore.c,v 1.33 2018/11/12 20:00:46 scole Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -81,11 +81,11 @@ __asm(
 "\n" /* test for 601 */
 "	mfspr	%r0,287		\n" /* mfpvbr %r0 PVR = 287 */
 "	srwi	%r0,%r0,0x10	\n"
-"	cmpi	0,1,%r0,0x02	\n" /* 601 CPU = 0x0001 */
+"	cmplwi	%r0,0x02	\n" /* 601 CPU = 0x0001 */
 "	blt	2f		\n" /* skip over non-601 BAT setup */
-"	cmpi	0,1,%r0,0x39	\n" /* PPC970 */
+"	cmplwi	%r0,0x39	\n" /* PPC970 */
 "	blt	0f		\n"
-"	cmpi	0,1,%r0,0x45	\n" 

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

2018-11-12 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Mon Nov 12 20:03:42 UTC 2018

Modified Files:
src/sys/arch/macppc/conf: GENERIC_601

Log Message:
Add scroll support, wsmouse


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/macppc/conf/GENERIC_601

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

Modified files:

Index: src/sys/arch/macppc/conf/GENERIC_601
diff -u src/sys/arch/macppc/conf/GENERIC_601:1.21 src/sys/arch/macppc/conf/GENERIC_601:1.22
--- src/sys/arch/macppc/conf/GENERIC_601:1.21	Wed Aug  1 20:04:12 2018
+++ src/sys/arch/macppc/conf/GENERIC_601	Mon Nov 12 20:03:42 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC_601,v 1.21 2018/08/01 20:04:12 maxv Exp $
+# $NetBSD: GENERIC_601,v 1.22 2018/11/12 20:03:42 scole Exp $
 #
 # GENERIC machine description file
 # 
@@ -28,7 +28,7 @@ include 	"arch/macppc/conf/std.macppc.60
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-ident 		"GENERIC-$Revision: 1.21 $"
+ident 		"GENERIC-$Revision: 1.22 $"
 
 maxusers	32
 
@@ -163,6 +163,7 @@ options 	WS_DEFAULT_FG=WSCOL_BLACK
 options 	WS_DEFAULT_BG=WSCOL_LIGHT_WHITE
 options 	WS_KERNEL_FG=WSCOL_GREEN
 options 	WS_KERNEL_BG=WSCOL_LIGHT_WHITE
+options WSDISPLAY_SCROLLSUPPORT
 
 #options 	WSDISPLAY_COMPAT_RAWKBD		# can get raw scancodes
 options 	FONT_GALLANT12x22
@@ -289,6 +290,7 @@ uhub*	at uhub? port ?
 uhidev*	at uhub? port ? configuration ? interface ?	# USB HID device
 
 ums*	at uhidev? reportid ?# USB Mice
+wsmouse* at ums? mux 0
 ukbd*	at uhidev? reportid ?# USB Keyboards
 uhid*	at uhidev? reportid ?# USB Generic HID
 
@@ -327,13 +329,13 @@ pseudo-device	vnd			# disk-like interfac
 pseudo-device	fss			# file system snapshot device
 #pseudo-device	md			# memory disk device
 pseudo-device	loop			# network loopback
-#pseudo-device	bpfilter		# packet filter
+pseudo-device	bpfilter		# packet filter
 #pseudo-device	npf			# NPF packet filter
 #pseudo-device	ppp			# Point-to-Point Protocol
 #pseudo-device	pppoe			# PPP over Ethernet (RFC 2516)
 #pseudo-device	sl			# Serial Line IP
 #pseudo-device	tun			# network tunneling over tty
-pseudo-device	tap			# virtual Ethernet
+#pseudo-device	tap			# virtual Ethernet
 #pseudo-device	gre			# generic L3 over IP tunnel
 #pseudo-device	gif			# IPv[46] over IPv[46] tunnel (RFC1933)
 #pseudo-device	faith			# IPv[46] tcp relay translation i/f
@@ -368,3 +370,9 @@ pseudo-device   drvctl
 #options VERIFIED_EXEC_FP_SHA512
 
 #options PAX_MPROTECT=0			# PaX mprotect(2) restrictions
+
+#rlphy*	at mii? phy ?			# Realtek 8139/8201L PHYs
+#rtk*	at pci? dev ? function ?	# Realtek 8129/8139
+
+#rgephy* at mii? phy ?			# Realtek 8169S/8110S internal PHYs
+#ral*	at pci? dev ? function ?	# Ralink Technology RT25x0 802.11a/b/g



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

2018-11-12 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Mon Nov 12 20:07:47 UTC 2018

Added Files:
src/sys/arch/macppc/conf: INSTALL_601

Log Message:
install kernel for ppc601 floppies and iso


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/macppc/conf/INSTALL_601

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

Added files:

Index: src/sys/arch/macppc/conf/INSTALL_601
diff -u /dev/null src/sys/arch/macppc/conf/INSTALL_601:1.1
--- /dev/null	Mon Nov 12 20:07:47 2018
+++ src/sys/arch/macppc/conf/INSTALL_601	Mon Nov 12 20:07:47 2018
@@ -0,0 +1,173 @@
+#	$NetBSD: INSTALL_601,v 1.1 2018/11/12 20:07:47 scole Exp $
+#
+# config file for INSTALL
+#
+# this config more or less matches a Power Macintosh 7200 with a USB card,
+# and platinumfb
+
+include 	"arch/macppc/conf/std.macppc.601"
+
+#options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
+
+makeoptions	COPTS="-Os" # Reduce size.
+
+maxusers	12
+
+options 	RTC_OFFSET=0	# hardware clock is this many mins. west of GMT
+
+# Enable the hooks used for initializing the ram-disk.
+options 	MEMORY_DISK_HOOKS
+options 	MEMORY_DISK_IS_ROOT	# Force root on ram-disk
+options 	MEMORY_DISK_SERVER=0	# no userspace memory disk support
+options 	MEMORY_DISK_ROOT_SIZE=5120	# 2560 KiB
+options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	# boot in single-user mode
+
+options 	USERCONF	# userconf(4) support
+options 	PIPE_SOCKETPAIR		# smaller, but slower pipe(2)
+#options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
+
+# Compatibility options
+include 	"conf/compat_netbsd13.config"
+
+# File systems
+file-system 	FFS		# UFS
+file-system 	MFS		# memory file system
+file-system 	NFS		# Network File System client
+file-system 	CD9660		# ISO 9660 + Rock Ridge file system
+file-system 	MSDOSFS		# MS-DOS file system
+#file-system	PTYFS		# /dev/pts/N support
+
+# Filesystem options
+options 	NFS_V2_ONLY	# Exclude NFS3 code to save space
+options 	APPLE_UFS	# Apple UFS support in FFS
+#options 	FFS_NO_SNAPSHOT	# No FFS snapshot support
+options 	WAPBL		# File system journaling support
+
+# Networking options
+options 	INET		# IP + ICMP + TCP + UDP
+options 	INET6		# IPV6
+options 	NFS_BOOT_DHCP	# Support DHCP NFS root
+
+options 	WSEMUL_VT100	# VT100 / VT220 emulation
+options 	WSDISPLAY_DEFAULTSCREENS=1
+#options 	WSDISPLAY_COMPAT_USL		# wsconscfg VT handling
+options 	FONT_GALLANT12x22	# big, Sun-like font
+options 	FONT_QVSS8x15		# a smaller font for lower resolutions
+
+# Kernel root file system and dump configuration.
+config		netbsd	root on ? type ?
+
+#
+# Device configuration
+#
+
+mainbus* at root
+
+cpu*	at mainbus?
+bandit*	at mainbus?
+
+pci*	at bandit? bus ?
+pci*	at ppb? bus ?
+
+pchb*	at pci? dev ? function ?	# PCI-Host bridges
+ppb*	at pci? dev ? function ?	# PCI-PCI bridges
+
+# Display devices
+#
+# The 7200's onboard video is unsupported by OF so we need either a
+# graphics card that works as OF console or a serial console.
+# The only cards known to work ( so far ) are PCI Voodoo3s flashed with the
+# official Macintosh firmware from 3Dfx. The others should work but are
+# untested with OF 1.0.5
+# this will take over the console if output-device is set to 'screen' or
+# 'platinum'. It will provide a NetBSD console, but still won't work with OF
+#platinumfb0 	at mainbus?
+
+#gffb*		at pci?	function ?	# NVIDIA GeForce2 MX
+#machfb*		at pci? function ?	# ATI Mach 64, Rage, Rage Pro
+#r128fb*		at pci? function ?	# ATI Rage 128
+voodoofb*	at pci? function ?	# 3Dfx Voodoo3 
+
+# ATI Radeon. Still has problems on some hardware
+#radeonfb*	at pci? function ?
+
+# generic PCI framebuffer, should work with everything supported by OF
+genfb*		at pci? function ?
+
+# make sure the console display is always wsdisplay0
+wsdisplay0	at wsemuldisplaydev? console 1
+wsdisplay*	at wsemuldisplaydev? console 0
+
+obio*	at pci? dev ? function ?
+
+mc*	at obio?			# MACE ethernet
+esp*	at obio? flags 0x00ff		# 53c9x SCSI
+# the 7200 has no mesh but other PMacs with 601 cards may
+mesh*	at obio? flags 0x		# MESH SCSI
+nvram*	at obio?			# nvram
+
+# the new, improved ADB subsystem
+
+cuda*	at obio?			# CUDA, for Old World PowerMacs
+nadb*	at adb_bus?			# ADB bus enumerator, at cuda or pmu
+adbkbd* at nadb?			# ADB keyboard
+adbms*	at nadb?			# ADB mice and touchpads
+
+wskbd*		at wskbddev? console ?
+wsmouse*	at wsmousedev?
+
+iic0	at cuda0		# CUDA's IIC bus
+
+zsc*	at obio?
+zstty*	at zsc? channel ?
+mediabay* at obio?
+wdc*	at mediabay? flags 0
+
+# Cryptographic Devices
+
+# PCI cryptographic devices
+# (disabled, requires opencrypto framework which requires generic softints
+#hifn*	at pci? dev ? function ?	# Hifn 7755/7811/795x
+#ubsec*	at pci? dev ? function ?	# Broadcom 5501/5601/580x/582x
+
+scsibus* at scsi?
+
+sd*	at scsibus? target ? lun ?	# SCSI disks
+cd*	at scsibus? target ? lun ?	# SCSI CD-ROM drives
+
+wdc*	at obio? flags 0x1
+atabus* at ata?
+wd*	at atabus? 

CVS commit: src/etc/etc.macppc

2018-11-12 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Mon Nov 12 20:09:07 UTC 2018

Modified Files:
src/etc/etc.macppc: Makefile.inc

Log Message:
install kernel for ppc601 floppies and iso


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/etc/etc.macppc/Makefile.inc

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

Modified files:

Index: src/etc/etc.macppc/Makefile.inc
diff -u src/etc/etc.macppc/Makefile.inc:1.9 src/etc/etc.macppc/Makefile.inc:1.10
--- src/etc/etc.macppc/Makefile.inc:1.9	Sun Jul 20 14:52:29 2014
+++ src/etc/etc.macppc/Makefile.inc	Mon Nov 12 20:09:07 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.9 2014/07/20 14:52:29 macallan Exp $
+#	$NetBSD: Makefile.inc,v 1.10 2018/11/12 20:09:07 scole Exp $
 #
 #	etc.macppc/Makefile.inc -- macppc-specific etc Makefile targets
 #
@@ -8,6 +8,6 @@
 
 KERNEL_SETS=		GENERIC GENERIC.MP GENERIC_601
 
-BUILD_KERNELS+=		INSTALL GENERIC_MD
+BUILD_KERNELS+=		INSTALL INSTALL_601 GENERIC_MD
 
 INSTALLATION_DIRS+=	installation/floppy



CVS commit: src/distrib/macppc/floppies

2018-11-12 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Mon Nov 12 20:11:39 UTC 2018

Modified Files:
src/distrib/macppc/floppies: Makefile
src/distrib/macppc/floppies/bootfloppy: Makefile
src/distrib/macppc/floppies/md-kernel: Makefile
src/distrib/macppc/floppies/ramdisk: Makefile

Log Message:
install kernel for ppc601 floppies and iso


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/distrib/macppc/floppies/Makefile
cvs rdiff -u -r1.28 -r1.29 src/distrib/macppc/floppies/bootfloppy/Makefile
cvs rdiff -u -r1.11 -r1.12 src/distrib/macppc/floppies/md-kernel/Makefile
cvs rdiff -u -r1.48 -r1.49 src/distrib/macppc/floppies/ramdisk/Makefile

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

Modified files:

Index: src/distrib/macppc/floppies/Makefile
diff -u src/distrib/macppc/floppies/Makefile:1.5 src/distrib/macppc/floppies/Makefile:1.6
--- src/distrib/macppc/floppies/Makefile:1.5	Fri Apr 12 02:19:30 2002
+++ src/distrib/macppc/floppies/Makefile	Mon Nov 12 20:11:39 2018
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile,v 1.5 2002/04/12 02:19:30 lukem Exp $
+#	$NetBSD: Makefile,v 1.6 2018/11/12 20:11:39 scole Exp $
 
-SUBDIR=	ramdisk .WAIT md-kernel .WAIT bootfloppy
+SUBDIR=	ramdisk .WAIT md-kernel .WAIT bootfloppy .WAIT bootfloppy-601
 TARGETS+=release
 
 .include 

Index: src/distrib/macppc/floppies/bootfloppy/Makefile
diff -u src/distrib/macppc/floppies/bootfloppy/Makefile:1.28 src/distrib/macppc/floppies/bootfloppy/Makefile:1.29
--- src/distrib/macppc/floppies/bootfloppy/Makefile:1.28	Thu Jan 29 20:47:12 2015
+++ src/distrib/macppc/floppies/bootfloppy/Makefile	Mon Nov 12 20:11:39 2018
@@ -1,22 +1,8 @@
-#	$NetBSD: Makefile,v 1.28 2015/01/29 20:47:12 joerg Exp $
+#	$NetBSD: Makefile,v 1.29 2018/11/12 20:11:39 scole Exp $
 
-.include 
-.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
-
-FLOPPYBASE=	boot
-FLOPPYSIZE=	2880
-FLOPPYFILES=	boot netbsd
-FLOPPYMAX=	3
-FLOPPYSUFFIX=	.fs
-
-FLOPPY_RELEASEDIR=	installation/floppy
-
-MDEC=		${DESTDIR}/usr/mdec
-KERNOBJ!=	cd ${.CURDIR}/../md-kernel && ${PRINTOBJDIR}
 FLOPPY_NETBSD=	${KERNOBJ}/netbsd-INSTALL.gz
-FLOPPY_BOOT=	${MDEC}/ofwboot
-FLOPPYINSTBOOT=	"${TOOL_INSTALLBOOT} -v -m ${MACHINE} -t raw -B 17 @IMAGE@ ${MDEC}/bootxx ${FLOPPY_BOOT}"
+FLOPPYBASE=	boot
 
-.include "${DISTRIBDIR}/common/Makefile.tarfloppy"
+.include 
 
-.include 
+.include "../bootfloppy-common/Makefile.inc"

Index: src/distrib/macppc/floppies/md-kernel/Makefile
diff -u src/distrib/macppc/floppies/md-kernel/Makefile:1.11 src/distrib/macppc/floppies/md-kernel/Makefile:1.12
--- src/distrib/macppc/floppies/md-kernel/Makefile:1.11	Wed May  8 21:44:56 2002
+++ src/distrib/macppc/floppies/md-kernel/Makefile	Mon Nov 12 20:11:39 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.11 2002/05/08 21:44:56 lukem Exp $
+#	$NetBSD: Makefile,v 1.12 2018/11/12 20:11:39 scole Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -7,6 +7,7 @@ RAMDISKDIR!=	cd ${.CURDIR}/../ramdisk &&
 RAMDISK=	${RAMDISKDIR}/ramdisk.fs
 
 MDSETTARGETS=		INSTALL		${RAMDISK}	-	\
+			INSTALL_601	${RAMDISK}	-	\
 			GENERIC_MD	${RAMDISK}	-
 MDSET_RELEASEDIR=	binary/kernel
 

Index: src/distrib/macppc/floppies/ramdisk/Makefile
diff -u src/distrib/macppc/floppies/ramdisk/Makefile:1.48 src/distrib/macppc/floppies/ramdisk/Makefile:1.49
--- src/distrib/macppc/floppies/ramdisk/Makefile:1.48	Tue Jan 24 18:04:03 2017
+++ src/distrib/macppc/floppies/ramdisk/Makefile	Mon Nov 12 20:11:39 2018
@@ -1,12 +1,12 @@
-#	$NetBSD: Makefile,v 1.48 2017/01/24 18:04:03 christos Exp $
+#	$NetBSD: Makefile,v 1.49 2018/11/12 20:11:39 scole Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
 
 IMAGE=		ramdisk.fs
-# This must be kept in sync with config option MEMORY_DISK_ROOT_SIZE
-# in both
+# This must be kept in sync with config option MEMORY_DISK_ROOT_SIZE in
 #   src/sys/arch/macppc/conf/INSTALL
+#   src/sys/arch/macppc/conf/INSTALL_601
 #   src/sys/arch/macppc/conf/GENERIC_MD
 IMAGESIZE=	2560k
 MAKEFS_FLAGS+=	-f 15



CVS commit: src/distrib/macppc/floppies

2018-11-12 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Mon Nov 12 20:16:46 UTC 2018

Added Files:
src/distrib/macppc/floppies/bootfloppy-601: Makefile
src/distrib/macppc/floppies/bootfloppy-common: Makefile.inc

Log Message:
install kernel for ppc601 floppies and iso


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/distrib/macppc/floppies/bootfloppy-601/Makefile
cvs rdiff -u -r0 -r1.1 \
src/distrib/macppc/floppies/bootfloppy-common/Makefile.inc

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

Added files:

Index: src/distrib/macppc/floppies/bootfloppy-601/Makefile
diff -u /dev/null src/distrib/macppc/floppies/bootfloppy-601/Makefile:1.1
--- /dev/null	Mon Nov 12 20:16:46 2018
+++ src/distrib/macppc/floppies/bootfloppy-601/Makefile	Mon Nov 12 20:16:46 2018
@@ -0,0 +1,8 @@
+#	$NetBSD: Makefile,v 1.1 2018/11/12 20:16:46 scole Exp $
+
+FLOPPY_NETBSD=	${KERNOBJ}/netbsd-INSTALL_601.gz
+FLOPPYBASE=	boot601_
+
+.include 
+
+.include "../bootfloppy-common/Makefile.inc"

Index: src/distrib/macppc/floppies/bootfloppy-common/Makefile.inc
diff -u /dev/null src/distrib/macppc/floppies/bootfloppy-common/Makefile.inc:1.1
--- /dev/null	Mon Nov 12 20:16:46 2018
+++ src/distrib/macppc/floppies/bootfloppy-common/Makefile.inc	Mon Nov 12 20:16:46 2018
@@ -0,0 +1,24 @@
+#	$NetBSD: Makefile.inc,v 1.1 2018/11/12 20:16:46 scole Exp $
+
+.include 
+.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
+
+# Required variables:
+#  FLOPPY_NETBSD
+#  FLOPPYBASE
+
+FLOPPYSIZE=	2880
+FLOPPYFILES=	boot netbsd
+FLOPPYMAX=	3
+FLOPPYSUFFIX=	.fs
+
+FLOPPY_RELEASEDIR=	installation/floppy
+
+MDEC=		${DESTDIR}/usr/mdec
+KERNOBJ!=	cd ${.CURDIR}/../md-kernel && ${PRINTOBJDIR}
+FLOPPY_BOOT=	${MDEC}/ofwboot
+FLOPPYINSTBOOT=	"${TOOL_INSTALLBOOT} -v -m ${MACHINE} -t raw -B 17 @IMAGE@ ${MDEC}/bootxx ${FLOPPY_BOOT}"
+
+.include "${DISTRIBDIR}/common/Makefile.tarfloppy"
+
+.include 



CVS commit: src/sys/dev

2018-11-12 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Nov 12 20:54:03 UTC 2018

Modified Files:
src/sys/dev/ic: mvsata.c
src/sys/dev/scsipi: atapi_wdc.c

Log Message:
pass correct status + error to *_atapi_phase_complete(), so that
the function is actually able to recognize when there was an error;
tested via reading a cd0 device in QEMU with ejected cdrom

bug was introduced with jdolecek-ncq branch

fixes PR kern/53724 by Andreas Gustafsson


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/ic/mvsata.c
cvs rdiff -u -r1.132 -r1.133 src/sys/dev/scsipi/atapi_wdc.c

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

Modified files:

Index: src/sys/dev/ic/mvsata.c
diff -u src/sys/dev/ic/mvsata.c:1.45 src/sys/dev/ic/mvsata.c:1.46
--- src/sys/dev/ic/mvsata.c:1.45	Mon Nov 12 18:51:01 2018
+++ src/sys/dev/ic/mvsata.c	Mon Nov 12 20:54:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsata.c,v 1.45 2018/11/12 18:51:01 jdolecek Exp $	*/
+/*	$NetBSD: mvsata.c,v 1.46 2018/11/12 20:54:03 jdolecek Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.45 2018/11/12 18:51:01 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.46 2018/11/12 20:54:03 jdolecek Exp $");
 
 #include "opt_mvsata.h"
 
@@ -161,7 +161,7 @@ static void mvsata_atapi_poll(struct ata
 static void mvsata_atapi_kill_xfer(struct ata_channel *, struct ata_xfer *,
    int);
 static void mvsata_atapi_reset(struct ata_channel *, struct ata_xfer *);
-static void mvsata_atapi_phase_complete(struct ata_xfer *);
+static void mvsata_atapi_phase_complete(struct ata_xfer *, int);
 static void mvsata_atapi_done(struct ata_channel *, struct ata_xfer *);
 static void mvsata_atapi_polldsc(void *);
 #endif
@@ -2422,7 +2422,7 @@ again:
 			xfer->c_bcount -= sc_xfer->datalen;
 		sc_xfer->resid = xfer->c_bcount;
 		/* this will unlock channel lock too */
-		mvsata_atapi_phase_complete(xfer);
+		mvsata_atapi_phase_complete(xfer, tfd);
 		return 1;
 
 	default:
@@ -2522,14 +2522,13 @@ mvsata_atapi_reset(struct ata_channel *c
 }
 
 static void
-mvsata_atapi_phase_complete(struct ata_xfer *xfer)
+mvsata_atapi_phase_complete(struct ata_xfer *xfer, int tfd)
 {
 	struct ata_channel *chp = xfer->c_chp;
 	struct atac_softc *atac = chp->ch_atac;
 	struct wdc_softc *wdc = CHAN_TO_WDC(chp);
 	struct scsipi_xfer *sc_xfer = xfer->c_scsipi;
 	struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive];
-	int tfd = 0;
 
 	ata_channel_lock_owned(chp);
 
@@ -2654,7 +2653,7 @@ mvsata_atapi_polldsc(void *arg)
 	ata_channel_lock(chp);
 
 	/* this will unlock channel lock too */
-	mvsata_atapi_phase_complete(xfer);
+	mvsata_atapi_phase_complete(xfer, 0);
 }
 #endif	/* NATAPIBUS > 0 */
 

Index: src/sys/dev/scsipi/atapi_wdc.c
diff -u src/sys/dev/scsipi/atapi_wdc.c:1.132 src/sys/dev/scsipi/atapi_wdc.c:1.133
--- src/sys/dev/scsipi/atapi_wdc.c:1.132	Mon Nov 12 18:51:01 2018
+++ src/sys/dev/scsipi/atapi_wdc.c	Mon Nov 12 20:54:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: atapi_wdc.c,v 1.132 2018/11/12 18:51:01 jdolecek Exp $	*/
+/*	$NetBSD: atapi_wdc.c,v 1.133 2018/11/12 20:54:03 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.132 2018/11/12 18:51:01 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.133 2018/11/12 20:54:03 jdolecek Exp $");
 
 #ifndef ATADEBUG
 #define ATADEBUG
@@ -89,7 +89,7 @@ static int	wdc_atapi_start(struct ata_ch
 static int	wdc_atapi_intr(struct ata_channel *, struct ata_xfer *, int);
 static void	wdc_atapi_kill_xfer(struct ata_channel *,
 struct ata_xfer *, int);
-static void	wdc_atapi_phase_complete(struct ata_xfer *);
+static void	wdc_atapi_phase_complete(struct ata_xfer *, int);
 static void	wdc_atapi_poll(struct ata_channel *, struct ata_xfer *);
 static void	wdc_atapi_done(struct ata_channel *, struct ata_xfer *);
 static void	wdc_atapi_reset(struct ata_channel *, struct ata_xfer *);
@@ -1018,7 +1018,7 @@ again:
 #endif
 		sc_xfer->resid = xfer->c_bcount;
 		/* this will unlock channel lock too */
-		wdc_atapi_phase_complete(xfer);
+		wdc_atapi_phase_complete(xfer, tfd);
 		return(1);
 
 	default:
@@ -1058,7 +1058,7 @@ again:
 }
 
 static void
-wdc_atapi_phase_complete(struct ata_xfer *xfer)
+wdc_atapi_phase_complete(struct ata_xfer *xfer, int tfd)
 {
 	struct ata_channel *chp = xfer->c_chp;
 	struct atac_softc *atac = chp->ch_atac;
@@ -1067,7 +1067,6 @@ wdc_atapi_phase_complete(struct ata_xfer
 #endif
 	struct scsipi_xfer *sc_xfer = xfer->c_scsipi;
 	struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive];
-	int tfd = 0;
 
 	ata_channel_lock_owned(chp);
 
@@ -1207,5 +1206,5 @@ wdc_atapi_polldsc(void *arg)
 	ata_channel_lock(chp);
 
 	/* this will unlock channel lock too */
-	wdc_atapi_phase_complete(xfer);
+	wdc_atapi_phase_complete(xfer, 0

CVS commit: src/sys/dev/fdt

2018-11-12 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Nov 13 01:06:37 UTC 2018

Modified Files:
src/sys/dev/fdt: fdt_intr.c

Log Message:
Avoid using the "interrupt-map" table on our own interrupts.

This is needed by the rk3399.dtsi's pcie0 node, which needs to map its
interrupts an entity other than itself.

Suggested by jmcneill@


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/fdt/fdt_intr.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/fdt/fdt_intr.c
diff -u src/sys/dev/fdt/fdt_intr.c:1.19 src/sys/dev/fdt/fdt_intr.c:1.20
--- src/sys/dev/fdt/fdt_intr.c:1.19	Sun Oct 21 05:32:39 2018
+++ src/sys/dev/fdt/fdt_intr.c	Tue Nov 13 01:06:37 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_intr.c,v 1.19 2018/10/21 05:32:39 skrll Exp $ */
+/* $NetBSD: fdt_intr.c,v 1.20 2018/11/13 01:06:37 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2015-2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.19 2018/10/21 05:32:39 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.20 2018/11/13 01:06:37 jakllsch Exp $");
 
 #include 
 #include 
@@ -91,7 +91,7 @@ fdtbus_get_interrupt_parent(int phandle)
 		 * If the node has an interrupt-map, use it. The caller is responsible
 		 * for parsing the interrupt-map and finding the real interrupt parent.
 		 */
-		if (of_hasprop(iparent, "interrupt-map"))
+		if (phandle != iparent && of_hasprop(iparent, "interrupt-map"))
 			return iparent;
 
 		/*



CVS commit: src/distrib/cdrom

2018-11-12 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Tue Nov 13 03:03:22 UTC 2018

Modified Files:
src/distrib/cdrom: NetBSD-current.mk

Log Message:
add ppc601 kernel to macppc iso


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/distrib/cdrom/NetBSD-current.mk

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

Modified files:

Index: src/distrib/cdrom/NetBSD-current.mk
diff -u src/distrib/cdrom/NetBSD-current.mk:1.8 src/distrib/cdrom/NetBSD-current.mk:1.9
--- src/distrib/cdrom/NetBSD-current.mk:1.8	Tue Oct  5 14:16:20 2010
+++ src/distrib/cdrom/NetBSD-current.mk	Tue Nov 13 03:03:22 2018
@@ -1,4 +1,4 @@
-# $NetBSD: NetBSD-current.mk,v 1.8 2010/10/05 14:16:20 tsutsui Exp $
+# $NetBSD: NetBSD-current.mk,v 1.9 2018/11/13 03:03:22 scole Exp $
 #
 # Configuration file for NetBSD-current.
 
@@ -31,7 +31,8 @@ EXTFILES.macppc=	macppc.bootxx:macppc/bi
 			macppc.ofwboot:macppc/binary/sets/base.tgz,./usr/mdec/ofwboot
 INTFILES.macppc=	ofwboot.xcf:macppc/installation/ofwboot.xcf,link \
 			ofwboot:macppc/binary/sets/base.tgz,./usr/mdec/ofwboot \
-			netbsd.macppc:macppc/binary/kernel/netbsd-INSTALL.gz,link
+			netbsd.macppc:macppc/binary/kernel/netbsd-INSTALL.gz,link \
+			netbsd.601:macppc/binary/kernel/netbsd-INSTALL_601.gz,link
 
 # BOOTFILE.pmax is absolute
 BOOTFILE.pmax=		${EXTFILEDIR}/pmax.bootxx



CVS commit: src/distrib/macppc/cdroms/installcd

2018-11-12 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Tue Nov 13 03:07:21 UTC 2018

Modified Files:
src/distrib/macppc/cdroms/installcd: Makefile

Log Message:
add ppc601 kernel to macppc iso


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/distrib/macppc/cdroms/installcd/Makefile

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

Modified files:

Index: src/distrib/macppc/cdroms/installcd/Makefile
diff -u src/distrib/macppc/cdroms/installcd/Makefile:1.3 src/distrib/macppc/cdroms/installcd/Makefile:1.4
--- src/distrib/macppc/cdroms/installcd/Makefile:1.3	Fri Sep 28 15:05:21 2018
+++ src/distrib/macppc/cdroms/installcd/Makefile	Tue Nov 13 03:07:21 2018
@@ -1,8 +1,9 @@
-#	$NetBSD: Makefile,v 1.3 2018/09/28 15:05:21 martin Exp $
+#	$NetBSD: Makefile,v 1.4 2018/11/13 03:07:21 scole Exp $
 CDBASE=		macppccd		# gives ${CDBASE}.iso
 CDRELEASE=	true			# include $RELEASEDIR/$MACHINE
 CDRELEASE_NODEBUG=	true
 CDKERNELS=	netbsd-INSTALL.gz netbsd
+CDKERNELS+=	netbsd-INSTALL_601.gz netbsd.601
 CDINSTKERNEL=	../../floppies/md-kernel
 CDBUILDEXTRA=	${DESTDIR}/usr/mdec/ofwboot.xcf
 



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

2018-11-12 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Tue Nov 13 06:06:30 UTC 2018

Modified Files:
src/sys/arch/evbarm/conf: std.generic64

Log Message:
turn on MODULAR by default on aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/conf/std.generic64

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/std.generic64
diff -u src/sys/arch/evbarm/conf/std.generic64:1.8 src/sys/arch/evbarm/conf/std.generic64:1.9
--- src/sys/arch/evbarm/conf/std.generic64:1.8	Sun Oct 21 00:42:06 2018
+++ src/sys/arch/evbarm/conf/std.generic64	Tue Nov 13 06:06:29 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: std.generic64,v 1.8 2018/10/21 00:42:06 jmcneill Exp $
+#	$NetBSD: std.generic64,v 1.9 2018/11/13 06:06:29 ryo Exp $
 #
 #	generic NetBSD/evbarm64 with FDT support
 
@@ -16,14 +16,14 @@ options 	DRAM_BLOCKS=256
 options 	EVBARM_BOARDTYPE="FDT"
 options 	FDT# Flattened Device Tree support
 options 	FPU_VFP
+options 	MODULAR
+options 	MODULAR_DEFAULT_AUTOLOAD
 options 	PCI_NETBSD_CONFIGURE
 options 	__HAVE_PCI_CONF_HOOK
 options 	__HAVE_PCI_MSI_MSIX
 
 # XXXNH not yet
 #options 	__HAVE_CPU_UAREA_ALLOC_IDLELWP
-#options 	MODULAR
-#options 	MODULAR_DEFAULT_AUTOLOAD
 
 makeoptions	BOARDMKFRAG="${THISARM}/conf/mk.generic64"
 



CVS commit: src/lib/libnvmm

2018-11-12 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Nov 13 06:57:14 UTC 2018

Modified Files:
src/lib/libnvmm: libnvmm_x86.c

Log Message:
Revert my own rev 1.2, the missing include was only when building the 32-bit
compat library, we no longer do this.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libnvmm/libnvmm_x86.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/libnvmm/libnvmm_x86.c
diff -u src/lib/libnvmm/libnvmm_x86.c:1.2 src/lib/libnvmm/libnvmm_x86.c:1.3
--- src/lib/libnvmm/libnvmm_x86.c:1.2	Sun Nov 11 00:06:48 2018
+++ src/lib/libnvmm/libnvmm_x86.c	Tue Nov 13 06:57:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: libnvmm_x86.c,v 1.2 2018/11/11 00:06:48 maya Exp $	*/
+/*	$NetBSD: libnvmm_x86.c,v 1.3 2018/11/13 06:57:14 maya Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -42,7 +42,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "nvmm.h"
 



CVS commit: src/sys/kern

2018-11-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Nov 13 06:58:14 UTC 2018

Modified Files:
src/sys/kern: kern_event.c

Log Message:
Fix kernel info leak. There are 4 bytes of padding in struct kevent.

[  287.537676] kleak: Possible leak in copyout: [len=40, leaked=4]
[  287.537676] #0 0x80b7c41a in kleak_note 
[  287.547673] #1 0x80b7c49a in kleak_copyout 
[  287.557677] #2 0x80b1d32d in kqueue_scan.isra.1.constprop.2 
[  287.557677] #3 0x80b1dc6a in kevent1 
[  287.567683] #4 0x80b1dcb0 in sys___kevent50 
[  287.567683] #5 0x8025ab3c in sy_call 
[  287.577688] #6 0x8025ad6e in sy_invoke 
[  287.587693] #7 0x8025adf4 in syscall 


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/kern/kern_event.c

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

Modified files:

Index: src/sys/kern/kern_event.c
diff -u src/sys/kern/kern_event.c:1.103 src/sys/kern/kern_event.c:1.104
--- src/sys/kern/kern_event.c:1.103	Fri Jan 12 17:58:51 2018
+++ src/sys/kern/kern_event.c	Tue Nov 13 06:58:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_event.c,v 1.103 2018/01/12 17:58:51 christos Exp $	*/
+/*	$NetBSD: kern_event.c,v 1.104 2018/11/13 06:58:14 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.103 2018/01/12 17:58:51 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.104 2018/11/13 06:58:14 maxv Exp $");
 
 #include 
 #include 
@@ -632,6 +632,7 @@ filt_proc(struct knote *kn, long hint)
 		 * event with the parent's pid.  Register knote with new
 		 * process.
 		 */
+		memset(&kev, 0, sizeof(kev));
 		kev.ident = hint & NOTE_PDATAMASK;	/* pid */
 		kev.filter = kn->kn_filter;
 		kev.flags = kn->kn_flags | EV_ADD | EV_ENABLE | EV_FLAG1;



CVS commit: src/sys/kern

2018-11-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Nov 13 07:16:33 UTC 2018

Modified Files:
src/sys/kern: kern_time.c

Log Message:
Fix kernel info leak. There are 2x4 bytes of padding in struct itimerval.

[  738.451860] kleak: Possible leak in copyout: [len=32, leaked=8]
[  738.481840] #0 0x80b7c42a in kleak_note 
[  738.491821] #1 0x80b7c4aa in kleak_copyout 
[  738.501806] #2 0x80b6154e in sys___getitimer50 
[  738.511778] #3 0x80b61e39 in sys___setitimer50 
[  738.521781] #4 0x8025ab3c in sy_call 
[  738.521781] #5 0x8025ad6e in sy_invoke 
[  738.531808] #6 0x8025adf4 in syscall 


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/sys/kern/kern_time.c

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

Modified files:

Index: src/sys/kern/kern_time.c
diff -u src/sys/kern/kern_time.c:1.190 src/sys/kern/kern_time.c:1.191
--- src/sys/kern/kern_time.c:1.190	Sun Nov 11 11:17:49 2018
+++ src/sys/kern/kern_time.c	Tue Nov 13 07:16:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time.c,v 1.190 2018/11/11 11:17:49 maxv Exp $	*/
+/*	$NetBSD: kern_time.c,v 1.191 2018/11/13 07:16:33 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.190 2018/11/11 11:17:49 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.191 2018/11/13 07:16:33 maxv Exp $");
 
 #include 
 #include 
@@ -1068,6 +1068,7 @@ sys___getitimer50(struct lwp *l, const s
 	struct itimerval aitv;
 	int error;
 
+	memset(&aitv, 0, sizeof(aitv));
 	error = dogetitimer(p, SCARG(uap, which), &aitv);
 	if (error)
 		return error;



CVS commit: src/sys/net

2018-11-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Nov 13 07:45:44 UTC 2018

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

Log Message:
Fix kernel info leak. There are 2 bytes of padding in struct if_msghdr.

[  944.607323] kleak: Possible leak in copyout: [len=176, leaked=2]
[  944.617335] #0 0x80b7c44a in kleak_note 
[  944.627332] #1 0x80b7c4ca in kleak_copyout 
[  944.627332] #2 0x80c91698 in sysctl_iflist_if 
[  944.637336] #3 0x80c91d3c in sysctl_iflist 
[  944.647343] #4 0x80c93855 in sysctl_rtable 
[  944.647343] #5 0x80b5b328 in sysctl_dispatch 
[  944.657346] #6 0x80b5b62e in sys___sysctl 
[  944.667354] #7 0x8025ab3c in sy_call 
[  944.667354] #8 0x8025ad6e in sy_invoke 
[  944.677365] #9 0x8025adf4 in syscall 


To generate a diff of this commit:
cvs rdiff -u -r1.243 -r1.244 src/sys/net/rtsock.c

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

Modified files:

Index: src/sys/net/rtsock.c
diff -u src/sys/net/rtsock.c:1.243 src/sys/net/rtsock.c:1.244
--- src/sys/net/rtsock.c:1.243	Fri Sep  7 06:08:16 2018
+++ src/sys/net/rtsock.c	Tue Nov 13 07:45:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock.c,v 1.243 2018/09/07 06:08:16 maxv Exp $	*/
+/*	$NetBSD: rtsock.c,v 1.244 2018/11/13 07:45:43 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.243 2018/09/07 06:08:16 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.244 2018/11/13 07:45:43 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1294,7 +1294,7 @@ again:
 			if (rw->w_tmemsize < len) {
 if (rw->w_tmem)
 	kmem_free(rw->w_tmem, rw->w_tmemsize);
-rw->w_tmem = kmem_alloc(len, KM_SLEEP);
+rw->w_tmem = kmem_zalloc(len, KM_SLEEP);
 rw->w_tmemsize = len;
 			}
 			if (rw->w_tmem) {
@@ -1863,7 +1863,7 @@ sysctl_rtable(SYSCTLFN_ARGS)
 again:
 	/* we may return here if a later [re]alloc of the t_mem buffer fails */
 	if (w.w_tmemneeded) {
-		w.w_tmem = kmem_alloc(w.w_tmemneeded, KM_SLEEP);
+		w.w_tmem = kmem_zalloc(w.w_tmemneeded, KM_SLEEP);
 		w.w_tmemsize = w.w_tmemneeded;
 		w.w_tmemneeded = 0;
 	}