CVS commit: src

2017-08-09 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Aug 10 04:31:58 UTC 2017

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/share/man/man4: ip.4
src/sys/netinet: in.c in.h in_pcb.c in_pcb.h ip_output.c ip_var.h
raw_ip.c udp_usrreq.c udp_var.h
src/tests/net/net: Makefile
Added Files:
src/tests/net/net: t_pktinfo_send.c

Log Message:
Add support IP_PKTINFO for sendmsg(2).

The source address or output interface can be specified by adding IP_PKTINFO
to the control part of the message on a SOCK_DGRAM or SOCK_RAW socket.

Reviewed by ozaki-r@ and christos@. thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.221 -r1.222 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.759 -r1.760 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.37 -r1.38 src/share/man/man4/ip.4
cvs rdiff -u -r1.206 -r1.207 src/sys/netinet/in.c
cvs rdiff -u -r1.100 -r1.101 src/sys/netinet/in.h
cvs rdiff -u -r1.178 -r1.179 src/sys/netinet/in_pcb.c
cvs rdiff -u -r1.63 -r1.64 src/sys/netinet/in_pcb.h
cvs rdiff -u -r1.283 -r1.284 src/sys/netinet/ip_output.c
cvs rdiff -u -r1.119 -r1.120 src/sys/netinet/ip_var.h
cvs rdiff -u -r1.165 -r1.166 src/sys/netinet/raw_ip.c
cvs rdiff -u -r1.234 -r1.235 src/sys/netinet/udp_usrreq.c
cvs rdiff -u -r1.41 -r1.42 src/sys/netinet/udp_var.h
cvs rdiff -u -r1.20 -r1.21 src/tests/net/net/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/net/net/t_pktinfo_send.c

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

Modified files:

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.221 src/distrib/sets/lists/debug/mi:1.222
--- src/distrib/sets/lists/debug/mi:1.221	Sun Jul 23 19:26:05 2017
+++ src/distrib/sets/lists/debug/mi	Thu Aug 10 04:31:58 2017
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.221 2017/07/23 19:26:05 perseant Exp $
+# $NetBSD: mi,v 1.222 2017/08/10 04:31:58 ryo Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -2280,6 +2280,7 @@
 ./usr/libdata/debug/usr/tests/net/mcast/mcast.debug		tests-net-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/net/mcast/t_mcast.debug		tests-obsolete		debug,atf,rump,obsolete
 ./usr/libdata/debug/usr/tests/net/net/t_pktinfo.debug		tests-net-debug		debug,atf,compattestfile
+./usr/libdata/debug/usr/tests/net/net/t_pktinfo_test.debug	tests-net-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/net/net/t_raw.debug		tests-net-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/net/net/t_tcp.debug		tests-net-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/net/net/t_udp.debug		tests-net-debug		debug,atf,compattestfile

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.759 src/distrib/sets/lists/tests/mi:1.760
--- src/distrib/sets/lists/tests/mi:1.759	Wed Aug  2 02:19:56 2017
+++ src/distrib/sets/lists/tests/mi	Thu Aug 10 04:31:58 2017
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.759 2017/08/02 02:19:56 ozaki-r Exp $
+# $NetBSD: mi,v 1.760 2017/08/10 04:31:58 ryo Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3361,6 +3361,7 @@
 ./usr/tests/net/net/t_ping6_opts		tests-net-tests		atf,rump
 ./usr/tests/net/net/t_ping_opts			tests-net-tests		atf,rump
 ./usr/tests/net/net/t_pktinfo			tests-net-tests		compattestfile,atf
+./usr/tests/net/net/t_pktinfo_send		tests-net-tests		atf,rump
 ./usr/tests/net/net/t_raw			tests-net-tests		atf,rump
 ./usr/tests/net/net/t_tcp			tests-net-tests		compattestfile,atf
 ./usr/tests/net/net/t_udp			tests-net-tests		compattestfile,atf

Index: src/share/man/man4/ip.4
diff -u src/share/man/man4/ip.4:1.37 src/share/man/man4/ip.4:1.38
--- src/share/man/man4/ip.4:1.37	Mon Jul  3 21:30:58 2017
+++ src/share/man/man4/ip.4	Thu Aug 10 04:31:58 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ip.4,v 1.37 2017/07/03 21:30:58 wiz Exp $
+.\"	$NetBSD: ip.4,v 1.38 2017/08/10 04:31:58 ryo Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)ip.4	8.2 (Berkeley) 11/30/93
 .\"
-.Dd June 27, 2013
+.Dd August 10, 2017
 .Dt IP 4
 .Os
 .Sh NAME
@@ -121,6 +121,7 @@ structure, which contains
 	struct in_addr ipi_addr;	/* the source or destination address */
 	unsigned int ipi_ifindex;	/* the interface index */
 .Ed
+.Pp
 and added to the control portion of the message:
 The cmsghdr fields have the following values:
 .Bd -literal
@@ -129,6 +130,16 @@ cmsg_level = IPPROTO_IP
 cmsg_type = IP_PKTINFO
 .Ed
 .Pp
+For
+.Xr sendmsg 2 ,
+the source address or output interface can be specified by adding
+.Dv IP_PKTINFO
+to the control part of the message on a
+.Dv SOCK_DGRAM
+or
+.Dv SOCK_RAW
+socket.
+.Pp
 The
 .Dv IP_PORTALGO
 can be used to randomize the port selection.

Index: src/sys/netinet/in.c
diff -u 

CVS commit: src/usr.sbin/sysinst/arch/evbmips

2017-08-09 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Wed Aug  9 23:01:06 UTC 2017

Modified Files:
src/usr.sbin/sysinst/arch/evbmips: md.h

Log Message:
evbmips can "boot root FFSv2"

It typically uses a non-NetBSD bootloader (PMON, u-boot...) and those
don't differentiate from v1 from v2 - both are unsupported and it requires
a separate boot partition.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/sysinst/arch/evbmips/md.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/sysinst/arch/evbmips/md.h
diff -u src/usr.sbin/sysinst/arch/evbmips/md.h:1.1 src/usr.sbin/sysinst/arch/evbmips/md.h:1.2
--- src/usr.sbin/sysinst/arch/evbmips/md.h:1.1	Sat Jul 26 19:30:45 2014
+++ src/usr.sbin/sysinst/arch/evbmips/md.h	Wed Aug  9 23:01:06 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: md.h,v 1.1 2014/07/26 19:30:45 dholland Exp $ */
+/* $NetBSD: md.h,v 1.2 2017/08/09 23:01:06 maya Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -42,6 +42,9 @@
 /* Megs required for a full X installation. */
 #define XNEEDMB			50
 
+/* have support for booting from UFS2 */
+#define HAVE_UFS2_BOOT
+
 /*
  *  Default filesets to fetch and install during installation or upgrade.
  *  The standard sets are: base etc comp games man misc tests text



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

2017-08-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Aug  9 19:18:59 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: MMNET_GENERIC MPCSA_GENERIC

Log Message:
Remove references to svr4 and ibcs2, they are not supported here.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/evbarm/conf/MMNET_GENERIC
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/evbarm/conf/MPCSA_GENERIC

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

Modified files:

Index: src/sys/arch/evbarm/conf/MMNET_GENERIC
diff -u src/sys/arch/evbarm/conf/MMNET_GENERIC:1.30 src/sys/arch/evbarm/conf/MMNET_GENERIC:1.31
--- src/sys/arch/evbarm/conf/MMNET_GENERIC:1.30	Tue Aug  1 14:23:42 2017
+++ src/sys/arch/evbarm/conf/MMNET_GENERIC	Wed Aug  9 19:18:59 2017
@@ -1,4 +1,4 @@
-# $NetBSD: MMNET_GENERIC,v 1.30 2017/08/01 14:23:42 maxv Exp $
+# $NetBSD: MMNET_GENERIC,v 1.31 2017/08/09 19:18:59 maxv Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include		"arch/evbarm/conf/std.mmnet"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.30 $"
+#ident 		"GENERIC-$Revision: 1.31 $"
 
 maxusers	32		# estimated number of users
 
@@ -109,8 +109,6 @@ options 	COMPAT_43	# 4.3BSD, 386BSD, and
 #options 	COMPAT_386BSD_MBRPART # recognize old partition ID
 
 #options 	COMPAT_OSSAUDIO	# OSS (Voxware) audio driver compatibility
-#options 	COMPAT_SVR4	# binary compatibility with SVR4
-#options 	COMPAT_IBCS2	# binary compatibility with SCO and ISC
 #options 	COMPAT_LINUX	# binary compatibility with Linux
 #options 	COMPAT_NDIS	# NDIS network driver
 options 	COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.

Index: src/sys/arch/evbarm/conf/MPCSA_GENERIC
diff -u src/sys/arch/evbarm/conf/MPCSA_GENERIC:1.51 src/sys/arch/evbarm/conf/MPCSA_GENERIC:1.52
--- src/sys/arch/evbarm/conf/MPCSA_GENERIC:1.51	Tue Aug  1 14:23:42 2017
+++ src/sys/arch/evbarm/conf/MPCSA_GENERIC	Wed Aug  9 19:18:59 2017
@@ -1,4 +1,4 @@
-# $NetBSD: MPCSA_GENERIC,v 1.51 2017/08/01 14:23:42 maxv Exp $
+# $NetBSD: MPCSA_GENERIC,v 1.52 2017/08/09 19:18:59 maxv Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include		"arch/evbarm/conf/std.mpcsa"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.51 $"
+#ident 		"GENERIC-$Revision: 1.52 $"
 
 maxusers	32		# estimated number of users
 
@@ -109,8 +109,6 @@ options 	COMPAT_43	# 4.3BSD, 386BSD, and
 #options 	COMPAT_386BSD_MBRPART # recognize old partition ID
 
 #options 	COMPAT_OSSAUDIO	# OSS (Voxware) audio driver compatibility
-#options 	COMPAT_SVR4	# binary compatibility with SVR4
-#options 	COMPAT_IBCS2	# binary compatibility with SCO and ISC
 #options 	COMPAT_LINUX	# binary compatibility with Linux
 #options 	COMPAT_NDIS	# NDIS network driver
 options 	COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.



CVS commit: src/sys/arch

2017-08-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Aug  9 19:11:13 UTC 2017

Modified Files:
src/sys/arch/amd64/conf: Makefile.amd64
src/sys/arch/i386/conf: Makefile.i386
src/sys/arch/xen/conf: Makefile.xen

Log Message:
Remove several dead entries from the x86 makefiles. Looks like people (me
included) regularly forget to take care of this.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/amd64/conf/Makefile.amd64
cvs rdiff -u -r1.185 -r1.186 src/sys/arch/i386/conf/Makefile.i386
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/xen/conf/Makefile.xen

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

Modified files:

Index: src/sys/arch/amd64/conf/Makefile.amd64
diff -u src/sys/arch/amd64/conf/Makefile.amd64:1.57 src/sys/arch/amd64/conf/Makefile.amd64:1.58
--- src/sys/arch/amd64/conf/Makefile.amd64:1.57	Sat Feb 11 16:02:11 2017
+++ src/sys/arch/amd64/conf/Makefile.amd64	Wed Aug  9 19:11:13 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.amd64,v 1.57 2017/02/11 16:02:11 maxv Exp $
+#	$NetBSD: Makefile.amd64,v 1.58 2017/08/09 19:11:13 maxv Exp $
 
 # Makefile for NetBSD
 #
@@ -73,7 +73,7 @@ KERNLDSCRIPT?= ${AMD64}/conf/kern.ldscri
 locore.o machdep.o: Makefile
 
 acpi_wakeup_low.o amd64func.o busfunc.o cpufunc.o cpu_in_cksum.o: assym.h
-linux_support.o linux32_sigcode.o lock_stubs.o mptramp.o: assym.h
+linux32_sigcode.o lock_stubs.o mptramp.o: assym.h
 netbsd32_sigcode.o: assym.h
 
 ##

Index: src/sys/arch/i386/conf/Makefile.i386
diff -u src/sys/arch/i386/conf/Makefile.i386:1.185 src/sys/arch/i386/conf/Makefile.i386:1.186
--- src/sys/arch/i386/conf/Makefile.i386:1.185	Mon Aug 24 14:04:24 2015
+++ src/sys/arch/i386/conf/Makefile.i386	Wed Aug  9 19:11:13 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.i386,v 1.185 2015/08/24 14:04:24 uebayasi Exp $
+#	$NetBSD: Makefile.i386,v 1.186 2017/08/09 19:11:13 maxv Exp $
 
 # Makefile for NetBSD
 #
@@ -83,8 +83,8 @@ KERNLDSCRIPT?=	${I386}/conf/kern.ldscrip
 ## (6) port specific target dependencies
 ##
 
-freebsd_sigcode.o i386func.o ibcs2_sigcode.o linux_support.o: assym.h
-linux_sigcode.o lock_stubs.o svr4_sigcode.o mach_sigcode.o: assym.h
+i386func.o: assym.h
+linux_sigcode.o lock_stubs.o: assym.h
 cpufunc.o cpu_in_cksum.o pnpbioscall.o bioscall.o: assym.h
 mptramp.o: assym.h
 acpi_wakeup_low.o busfunc.o: assym.h

Index: src/sys/arch/xen/conf/Makefile.xen
diff -u src/sys/arch/xen/conf/Makefile.xen:1.41 src/sys/arch/xen/conf/Makefile.xen:1.42
--- src/sys/arch/xen/conf/Makefile.xen:1.41	Thu Feb  2 19:09:08 2017
+++ src/sys/arch/xen/conf/Makefile.xen	Wed Aug  9 19:11:13 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.xen,v 1.41 2017/02/02 19:09:08 maxv Exp $
+#	$NetBSD: Makefile.xen,v 1.42 2017/08/09 19:11:13 maxv Exp $
 #	NetBSD: Makefile.i386,v 1.132 2003/07/05 16:56:10 simonb Exp 
 
 # Makefile for NetBSD
@@ -115,13 +115,12 @@ KERNLDSCRIPT?=	$S/arch/${XEN_BUILD}/conf
 ##
 
 .if ${XEN_BUILD} == i386
-freebsd_sigcode.o ibcs2_sigcode.o linux_sigcode.o: assym.h
-svr4_sigcode.o mach_sigcode.o: assym.h
-apmcall.o pnpbioscall.o bioscall.o: assym.h
+linux_sigcode.o: assym.h
+pnpbioscall.o bioscall.o: assym.h
 mptramp.o: assym.h
 .elif  ${XEN_BUILD} == amd64
 locore.o machdep.o: Makefile
-linux_support.o linux32_sigcode.o netbsd32_sigcode.o: assym.h
+linux32_sigcode.o netbsd32_sigcode.o: assym.h
 .endif
 busfunc.o cpu_in_cksum.o cpufunc.o lock_stubs.o: assym.h
 



CVS commit: src

2017-08-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Aug  9 18:58:51 UTC 2017

Modified Files:
src/distrib/sets/lists/comp: md.amd64 md.i386
src/sys/arch/i386/include: Makefile
Removed Files:
src/sys/arch/i386/include: ibcs2_machdep.h

Log Message:
Remove ibcs2_machdep.h on i386, and don't install it.


To generate a diff of this commit:
cvs rdiff -u -r1.248 -r1.249 src/distrib/sets/lists/comp/md.amd64
cvs rdiff -u -r1.172 -r1.173 src/distrib/sets/lists/comp/md.i386
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/i386/include/Makefile
cvs rdiff -u -r1.17 -r0 src/sys/arch/i386/include/ibcs2_machdep.h

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

Modified files:

Index: src/distrib/sets/lists/comp/md.amd64
diff -u src/distrib/sets/lists/comp/md.amd64:1.248 src/distrib/sets/lists/comp/md.amd64:1.249
--- src/distrib/sets/lists/comp/md.amd64:1.248	Tue Aug  8 08:04:05 2017
+++ src/distrib/sets/lists/comp/md.amd64	Wed Aug  9 18:58:51 2017
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.248 2017/08/08 08:04:05 maxv Exp $
+# $NetBSD: md.amd64,v 1.249 2017/08/09 18:58:51 maxv Exp $
 
 ./usr/include/amd64comp-c-include
 ./usr/include/amd64/ansi.h			comp-c-include
@@ -487,7 +487,7 @@
 ./usr/include/i386/frame.h			comp-c-include
 ./usr/include/i386/freebsd_machdep.h		comp-obsolete		obsolete
 ./usr/include/i386/gdt.h			comp-c-include
-./usr/include/i386/ibcs2_machdep.h		comp-c-include
+./usr/include/i386/ibcs2_machdep.h		comp-obsolete		obsolete
 ./usr/include/i386/ieee.h			comp-c-include
 ./usr/include/i386/ieeefp.h			comp-c-include
 ./usr/include/i386/int_const.h			comp-c-include

Index: src/distrib/sets/lists/comp/md.i386
diff -u src/distrib/sets/lists/comp/md.i386:1.172 src/distrib/sets/lists/comp/md.i386:1.173
--- src/distrib/sets/lists/comp/md.i386:1.172	Tue Aug  8 08:04:05 2017
+++ src/distrib/sets/lists/comp/md.i386	Wed Aug  9 18:58:51 2017
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.172 2017/08/08 08:04:05 maxv Exp $
+# $NetBSD: md.i386,v 1.173 2017/08/09 18:58:51 maxv Exp $
 ./usr/include/clang-3.4/__wmmintrin_aes.h	comp-obsolete		obsolete
 ./usr/include/clang-3.4/__wmmintrin_pclmul.h	comp-obsolete		obsolete
 ./usr/include/clang-3.4/ammintrin.h		comp-obsolete		obsolete
@@ -416,7 +416,7 @@
 ./usr/include/i386/frame.h			comp-c-include
 ./usr/include/i386/freebsd_machdep.h		comp-obsolete		obsolete
 ./usr/include/i386/gdt.h			comp-c-include
-./usr/include/i386/ibcs2_machdep.h		comp-c-include
+./usr/include/i386/ibcs2_machdep.h		comp-obsolete		obsolete
 ./usr/include/i386/ieee.h			comp-c-include
 ./usr/include/i386/ieeefp.h			comp-c-include
 ./usr/include/i386/int_const.h			comp-c-include

Index: src/sys/arch/i386/include/Makefile
diff -u src/sys/arch/i386/include/Makefile:1.46 src/sys/arch/i386/include/Makefile:1.47
--- src/sys/arch/i386/include/Makefile:1.46	Tue Aug  8 08:04:06 2017
+++ src/sys/arch/i386/include/Makefile	Wed Aug  9 18:58:51 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.46 2017/08/08 08:04:06 maxv Exp $
+#	$NetBSD: Makefile,v 1.47 2017/08/09 18:58:51 maxv Exp $
 
 INCSDIR= /usr/include/i386
 
@@ -9,7 +9,7 @@ INCS=	ansi.h aout_machdep.h apmvar.h asm
 	elf_machdep.h endian.h endian_machdep.h \
 	fenv.h float.h frame.h \
 	gdt.h \
-	ibcs2_machdep.h ieee.h ieeefp.h \
+	ieee.h ieeefp.h \
 	int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h \
 	intr.h intrdefs.h \
 	joystick.h \



CVS commit: src/sys/compat/ibcs2

2017-08-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Aug  9 18:55:21 UTC 2017

Modified Files:
src/sys/compat/ibcs2: ibcs2_misc.c

Log Message:
Remove __i386__.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/compat/ibcs2/ibcs2_misc.c

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

Modified files:

Index: src/sys/compat/ibcs2/ibcs2_misc.c
diff -u src/sys/compat/ibcs2/ibcs2_misc.c:1.114 src/sys/compat/ibcs2/ibcs2_misc.c:1.115
--- src/sys/compat/ibcs2/ibcs2_misc.c:1.114	Fri Jul 28 15:34:06 2017
+++ src/sys/compat/ibcs2/ibcs2_misc.c	Wed Aug  9 18:55:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ibcs2_misc.c,v 1.114 2017/07/28 15:34:06 riastradh Exp $	*/
+/*	$NetBSD: ibcs2_misc.c,v 1.115 2017/08/09 18:55:21 maxv Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -95,7 +95,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ibcs2_misc.c,v 1.114 2017/07/28 15:34:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibcs2_misc.c,v 1.115 2017/08/09 18:55:21 maxv Exp $");
 
 #include 
 #include 
@@ -135,10 +135,6 @@ __KERNEL_RCSID(0, "$NetBSD: ibcs2_misc.c
 #include 
 #include 
 
-#if defined(__i386__)
-#include 
-#endif
-
 #include 
 #include 
 #include 
@@ -208,29 +204,16 @@ ibcs2_sys_ulimit(struct lwp *l, const st
 int
 ibcs2_sys_waitsys(struct lwp *l, const struct ibcs2_sys_waitsys_args *uap, register_t *retval)
 {
-#if defined(__i386__)
 	/* {
 		syscallarg(int) a1;
 		syscallarg(int) a2;
 		syscallarg(int) a3;
 	} */
-#endif
 	int error, options, status, pid;
 
-#if defined(__i386__)
-#define WAITPID_EFLAGS	0x8c4	/* OF, SF, ZF, PF */
-	if ((l->l_md.md_regs->tf_eflags & WAITPID_EFLAGS) == WAITPID_EFLAGS) {
-		/* waitpid */
-		pid = SCARG(uap, a1);
-		options = SCARG(uap, a3);
-	} else {
-#endif
-		/* wait */
-		pid = WAIT_ANY;
-		options = 0;
-#if defined(__i386__)
-	}
-#endif
+	/* wait */
+	pid = WAIT_ANY;
+	options = 0;
 
 	error = do_sys_wait(, , options, NULL);
 	retval[0] = pid;



CVS commit: src/sys/compat/svr4

2017-08-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Aug  9 18:52:00 UTC 2017

Modified Files:
src/sys/compat/svr4: svr4_exec.h svr4_stat.c

Log Message:
Remove __i386__.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/compat/svr4/svr4_exec.h
cvs rdiff -u -r1.70 -r1.71 src/sys/compat/svr4/svr4_stat.c

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

Modified files:

Index: src/sys/compat/svr4/svr4_exec.h
diff -u src/sys/compat/svr4/svr4_exec.h:1.28 src/sys/compat/svr4/svr4_exec.h:1.29
--- src/sys/compat/svr4/svr4_exec.h:1.28	Thu Dec 10 14:13:53 2009
+++ src/sys/compat/svr4/svr4_exec.h	Wed Aug  9 18:52:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_exec.h,v 1.28 2009/12/10 14:13:53 matt Exp $	 */
+/*	$NetBSD: svr4_exec.h,v 1.29 2017/08/09 18:52:00 maxv Exp $	 */
 
 /*-
  * Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -37,15 +37,6 @@
  * play with brk(2) a bit more.
  */
 
-#ifdef __i386__
-/*
- * I cannot load the interpreter after the data segment because brk(2)
- * breaks. I have to load it somewhere before. Programs start at
- * 0x0800 so I load the interpreter far before.
- */
-#define SVR4_INTERP_ADDR	0x0100
-#endif
-
 #ifdef __m68k__
 /*
  * Here programs load at 0x8000, so I load the interpreter far before.

Index: src/sys/compat/svr4/svr4_stat.c
diff -u src/sys/compat/svr4/svr4_stat.c:1.70 src/sys/compat/svr4/svr4_stat.c:1.71
--- src/sys/compat/svr4/svr4_stat.c:1.70	Thu Aug 14 17:29:30 2014
+++ src/sys/compat/svr4/svr4_stat.c	Wed Aug  9 18:52:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_stat.c,v 1.70 2014/08/14 17:29:30 maxv Exp $	 */
+/*	$NetBSD: svr4_stat.c,v 1.71 2017/08/09 18:52:00 maxv Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svr4_stat.c,v 1.70 2014/08/14 17:29:30 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_stat.c,v 1.71 2017/08/09 18:52:00 maxv Exp $");
 
 #include 
 #include 
@@ -454,8 +454,6 @@ svr4_sys_systeminfo(struct lwp *l, const
 	case SVR4_SI_ISALIST:
 #if defined(__sparc__)
 		str = "sparcv9 sparcv9-fsmuld sparcv8 sparcv8-fsmuld sparcv7 sparc";
-#elif defined(__i386__)
-		str = "i386";
 #else
 		str = "unknown";
 #endif
@@ -475,9 +473,7 @@ svr4_sys_systeminfo(struct lwp *l, const
 		break;
 
 	case SVR4_SI_PLATFORM:
-#if defined(__i386__)
-		str = "i86pc";
-#elif defined(__sparc__)
+#if defined(__sparc__)
 		{
 			extern char machine_model[];
 



CVS commit: src/sys/arch

2017-08-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Aug  9 18:48:53 UTC 2017

Modified Files:
src/sys/arch/amd64/conf: ALL
src/sys/arch/xen/conf: files.xen

Log Message:
Remove references to compat_ibcs2.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.152 -r1.153 src/sys/arch/xen/conf/files.xen

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

Modified files:

Index: src/sys/arch/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.64 src/sys/arch/amd64/conf/ALL:1.65
--- src/sys/arch/amd64/conf/ALL:1.64	Sat Jul 29 07:19:47 2017
+++ src/sys/arch/amd64/conf/ALL	Wed Aug  9 18:48:53 2017
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.64 2017/07/29 07:19:47 maxv Exp $
+# $NetBSD: ALL,v 1.65 2017/08/09 18:48:53 maxv Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.64 $"
+#ident		"ALL-$Revision: 1.65 $"
 
 maxusers	64		# estimated number of users
 
@@ -155,7 +155,6 @@ options 	COMPAT_OSSAUDIO	# OSS (Voxware)
 options 	COMPAT_NETBSD32 # NetBSD 32-bit
 options 	COMPAT_LINUX	# binary compatibility with Linux
 options 	COMPAT_LINUX32	# binary compatibility with Linux 32-bit
-options 	COMPAT_IBCS2	# binary compatibility with SCO and ISC
 options 	COMPAT_FREEBSD	# binary compatibility with FreeBSD
 options 	COMPAT_NDIS	# NDIS network driver
 options 	COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.

Index: src/sys/arch/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.152 src/sys/arch/xen/conf/files.xen:1.153
--- src/sys/arch/xen/conf/files.xen:1.152	Tue Aug  1 14:43:54 2017
+++ src/sys/arch/xen/conf/files.xen	Wed Aug  9 18:48:53 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.152 2017/08/01 14:43:54 maxv Exp $
+#	$NetBSD: files.xen,v 1.153 2017/08/09 18:48:53 maxv Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -317,13 +317,7 @@ file	arch/i386/i386/vm86.c			vm86
 
 # Binary compatibility with previous NetBSD releases (COMPAT_XX)
 file	arch/i386/i386/compat_13_machdep.c	compat_13
-file	arch/i386/i386/compat_16_machdep.c	compat_16 | compat_ibcs2
-
-# iBCS-2 binary compatibility (COMPAT_IBCS2)
-include	"compat/ibcs2/files.ibcs2"
-file	arch/i386/i386/ibcs2_machdep.c		compat_ibcs2
-file	arch/i386/i386/ibcs2_sigcode.S		compat_ibcs2
-file	arch/i386/i386/ibcs2_syscall.c		compat_ibcs2
+file	arch/i386/i386/compat_16_machdep.c	compat_16
 
 # Linux binary compatibility (COMPAT_LINUX)
 include	"compat/linux/files.linux"



CVS commit: src

2017-08-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Aug  9 18:45:30 UTC 2017

Modified Files:
src/distrib/sets/lists/modules: md.i386
src/sys/arch/i386/conf: ALL GENERIC GENERIC_TINY INSTALL_FLOPPY
INSTALL_TINY MODULAR NET4501 XEN3_DOM0 XEN3_DOMU files.i386
src/sys/arch/i386/i386: compat_16_machdep.c
src/sys/modules/compat_ibcs2: Makefile
Removed Files:
src/sys/arch/i386/i386: ibcs2_machdep.c ibcs2_sigcode.S ibcs2_syscall.c

Log Message:
Remove compat_ibcs2 from i386. After a discussion on port-vax, it turns
out that compat_ibcs2 does not implement the iBCS2 standard - which is
x86-specific - but rather SVR3. Our real iBCS2 implementation was a
mixture of compat_ibcs2 and compat_svr4, and was only partial. Keeping
support for this in i386 is totally irrelevant today. I also asked on
port-i386 but didn't wait long.

The main issue is that compat_ibcs2 should have been called compat_svr3.
But CVS does not support renaming files, and moving things around is both
painful and tiring, even more so when no one seems to be interested in
doing this work or in the feature at all. For now compat_ibcs2 is available
on Vax and will stay, until someone (not me) cleans it up.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/distrib/sets/lists/modules/md.i386
cvs rdiff -u -r1.424 -r1.425 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1163 -r1.1164 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.152 -r1.153 src/sys/arch/i386/conf/GENERIC_TINY \
src/sys/arch/i386/conf/INSTALL_TINY
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/i386/conf/INSTALL_FLOPPY
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/conf/MODULAR
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/i386/conf/NET4501
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/i386/conf/XEN3_DOM0
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/i386/conf/XEN3_DOMU
cvs rdiff -u -r1.383 -r1.384 src/sys/arch/i386/conf/files.i386
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/i386/i386/compat_16_machdep.c
cvs rdiff -u -r1.44 -r0 src/sys/arch/i386/i386/ibcs2_machdep.c
cvs rdiff -u -r1.5 -r0 src/sys/arch/i386/i386/ibcs2_sigcode.S
cvs rdiff -u -r1.49 -r0 src/sys/arch/i386/i386/ibcs2_syscall.c
cvs rdiff -u -r1.3 -r1.4 src/sys/modules/compat_ibcs2/Makefile

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

Modified files:

Index: src/distrib/sets/lists/modules/md.i386
diff -u src/distrib/sets/lists/modules/md.i386:1.74 src/distrib/sets/lists/modules/md.i386:1.75
--- src/distrib/sets/lists/modules/md.i386:1.74	Tue Aug  1 17:04:06 2017
+++ src/distrib/sets/lists/modules/md.i386	Wed Aug  9 18:45:30 2017
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.74 2017/08/01 17:04:06 maya Exp $
+# $NetBSD: md.i386,v 1.75 2017/08/09 18:45:30 maxv Exp $
 #
 # NOTE that there are three sets of files here:
 # @MODULEDIR@, i386-xen, and i386pae-xen
@@ -52,8 +52,8 @@
 ./@MODULEDIR@/cac_eisa/cac_eisa.kmod		base-obsolete		obsolete
 ./@MODULEDIR@/compat_freebsd			base-kernel-modules	kmod
 ./@MODULEDIR@/compat_freebsd/compat_freebsd.kmod	base-kernel-modules	kmod
-./@MODULEDIR@/compat_ibcs2			base-kernel-modules	kmod
-./@MODULEDIR@/compat_ibcs2/compat_ibcs2.kmod	base-kernel-modules	kmod
+./@MODULEDIR@/compat_ibcs2			base-obsolete		obsolete
+./@MODULEDIR@/compat_ibcs2/compat_ibcs2.kmod	base-obsolete		obsolete
 ./@MODULEDIR@/compat_linux			base-kernel-modules	kmod
 ./@MODULEDIR@/compat_linux/compat_linux.kmod	base-kernel-modules	kmod
 ./@MODULEDIR@/compat_svr4			base-obsolete		obsolete

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.424 src/sys/arch/i386/conf/ALL:1.425
--- src/sys/arch/i386/conf/ALL:1.424	Sat Jul 29 18:08:58 2017
+++ src/sys/arch/i386/conf/ALL	Wed Aug  9 18:45:30 2017
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.424 2017/07/29 18:08:58 maxv Exp $
+# $NetBSD: ALL,v 1.425 2017/08/09 18:45:30 maxv Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.424 $"
+#ident		"ALL-$Revision: 1.425 $"
 
 maxusers	64		# estimated number of users
 
@@ -148,7 +148,6 @@ options 	COMPAT_44	# 4.4BSD
 options 	COMPAT_386BSD_MBRPART # recognize old partition ID
 
 options 	COMPAT_OSSAUDIO	# OSS (Voxware) audio driver compatibility
-options 	COMPAT_IBCS2	# binary compatibility with SCO and ISC
 options 	COMPAT_LINUX	# binary compatibility with Linux
 options 	COMPAT_FREEBSD	# binary compatibility with FreeBSD
 options 	COMPAT_NDIS	# NDIS network driver

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1163 src/sys/arch/i386/conf/GENERIC:1.1164
--- src/sys/arch/i386/conf/GENERIC:1.1163	Fri Aug  4 09:30:19 2017
+++ src/sys/arch/i386/conf/GENERIC	Wed Aug  9 18:45:30 2017
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1163 2017/08/04 09:30:19 maxv Exp $
+# $NetBSD: GENERIC,v 1.1164 2017/08/09 

CVS commit: src/libexec/ld.elf_so

2017-08-09 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Aug  9 18:44:32 UTC 2017

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

Log Message:
If a DF_1_NODELETE DSO has been removed from the DAG list, it still
needs to be able to resolve relocations against itself. As such, search
the referencing object explicitly last, if it hasn't been searched
before.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/libexec/ld.elf_so/symbol.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/symbol.c
diff -u src/libexec/ld.elf_so/symbol.c:1.68 src/libexec/ld.elf_so/symbol.c:1.69
--- src/libexec/ld.elf_so/symbol.c:1.68	Mon Jun 19 11:57:01 2017
+++ src/libexec/ld.elf_so/symbol.c	Wed Aug  9 18:44:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: symbol.c,v 1.68 2017/06/19 11:57:01 joerg Exp $	 */
+/*	$NetBSD: symbol.c,v 1.69 2017/08/09 18:44:32 joerg Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: symbol.c,v 1.68 2017/06/19 11:57:01 joerg Exp $");
+__RCSID("$NetBSD: symbol.c,v 1.69 2017/08/09 18:44:32 joerg Exp $");
 #endif /* not lint */
 
 #include 
@@ -480,6 +480,21 @@ _rtld_symlook_default(const char *name, 
 	}
 
 	/*
+	 * Finally, look in the referencing object if not linked symbolically.
+	 * This is necessary for DF_1_NODELETE objects where the containing DAG
+	 * has been unlinked, so local references are resolved properly.
+	 */
+	if ((def == NULL || ELF_ST_BIND(def->st_info) == STB_WEAK) &&
+	!refobj->symbolic && !_rtld_donelist_check(, refobj)) {
+		rdbg(("search referencing object for %s", name));
+		symp = _rtld_symlook_obj(name, hash, refobj, flags, ventry);
+		if (symp != NULL) {
+			def = symp;
+			defobj = refobj;
+		}
+	}
+
+	/*
 	 * Search the dynamic linker itself, and possibly resolve the
 	 * symbol from there.  This is how the application links to
 	 * dynamic linker services such as dlopen.



CVS commit: src/sys/netinet6

2017-08-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug  9 17:20:44 UTC 2017

Modified Files:
src/sys/netinet6: scope6_var.h

Log Message:
PR/52472: Edgar Fuss: Document handling of scoped IPv6 addresses by embedding
ASCII art from:
IPv6 Core Protocols Implementation
By Qing Li, Tatuya Jinmei, Keiichi Shima
Page 56, Figure 2.12


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/netinet6/scope6_var.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/netinet6/scope6_var.h
diff -u src/sys/netinet6/scope6_var.h:1.3 src/sys/netinet6/scope6_var.h:1.4
--- src/sys/netinet6/scope6_var.h:1.3	Tue Dec  9 20:10:37 2014
+++ src/sys/netinet6/scope6_var.h	Wed Aug  9 13:20:44 2017
@@ -34,6 +34,65 @@
 #define _NETINET6_SCOPE6_VAR_H_
 
 #ifdef _KERNEL
+
+/*
+ * IPv6 Core Protocols Implementation
+ * By Qing Li, Tatuya Jinmei, Keiichi Shima
+ *
+ * Some information from Chapter 2.9 (Handling Scope Zones) Figure 2.12, p.56
+ *
+ * User Space
+ *
+ * Normal App Statistics/Mgmt AppRouting App
+ *  /---\/---\   /--\
+ *  | sin6_scope_id ||   embedded form   |   |  embedded form   |
+ *  |  only || (+ sin6_scope_id) |   | or sin6_scope_id |
+ *  \---/\---/   \--/
+ *  ^  ^^  |
+ *  |  ||  |
+ *no conversion  parseparse  embed
+ *  |   embeddedembbeded  ID
+ *  |  ID  ID(if necessary)
+ *  |  ||  |
+ *  v  ||  v
+ *  /---\/---\   /--\
+ * --   |AF_INET6   ||kvm|   | Routing  |
+ * Kernel   | socket|| interface |   | socket   |
+ *  \---/\---/   \--/
+ * ^   |  ^^
+ * |   |  ||
+ *   clear   embed   no conversion |
+ *  embedded  ID  |   no conversion
+ *ID   |  --   |
+ * |   V  ||   v
+ *  /---\/\
+ *  |   | clear sin_scope_id --->| embedded form only |
+ *  |   |<---  set sin_scope_id  ||
+ *  |   |\/
+ *  | embedded form |  ^
+ *  |   +   |  |
+ *  | sin_scope_id  |no conversion
+ *  |   |  |
+ *  |   |  V
+ *  |   |/\
+ *  |   | clear sin_scope_id --->| embedded form only |
+ *  |   |<---  set sin_scope_id  ||
+ *  \---/\/
+ *    ^   |
+ * Physical   | clear 
+ * Network  embed ID,  embedded
+ *   set ID
+ *sin_scope_id|
+ *|   v
+ *  /---\
+ *  | 128-bit IPv6  |
+ *  | address   |
+ *  | (ID not   |
+ *  |  included)|
+ *  \---/
+ */
+
+
 struct scope6_id {
 	/*
 	 * 16 is correspondent to 4bit multicast scope field.



CVS commit: src/sys/dev

2017-08-09 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Aug  9 16:44:40 UTC 2017

Modified Files:
src/sys/dev: ld.c ldvar.h
src/sys/dev/i2o: ld_iop.c
src/sys/dev/ic: ld_cac.c ld_nvme.c
src/sys/dev/pci: ld_virtio.c
src/sys/dev/sdmmc: ld_sdmmc.c

Log Message:
While ld(4) is MP safe, many backends are not.

Add a flag for backends that are MP safe. Take KERNEL_LOCK when calling
into a backend that doesn't have the flag set. Do the same for the
discard routine.

Fixes PR 52462.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/dev/ld.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/ldvar.h
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/i2o/ld_iop.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/ic/ld_cac.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/ld_nvme.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/ld_virtio.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/sdmmc/ld_sdmmc.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/ld.c
diff -u src/sys/dev/ld.c:1.101 src/sys/dev/ld.c:1.102
--- src/sys/dev/ld.c:1.101	Thu Apr 27 17:07:22 2017
+++ src/sys/dev/ld.c	Wed Aug  9 16:44:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld.c,v 1.101 2017/04/27 17:07:22 jdolecek Exp $	*/
+/*	$NetBSD: ld.c,v 1.102 2017/08/09 16:44:39 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.101 2017/04/27 17:07:22 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.102 2017/08/09 16:44:39 mlelstv Exp $");
 
 #include 
 #include 
@@ -419,6 +419,9 @@ ld_diskstart(device_t dev, struct buf *b
 	if (sc->sc_queuecnt >= sc->sc_maxqueuecnt)
 		return EAGAIN;
 
+	if ((sc->sc_flags & LDF_MPSAFE) == 0)
+		KERNEL_LOCK(1, curlwp);
+
 	mutex_enter(>sc_mutex);
 
 	if (sc->sc_queuecnt >= sc->sc_maxqueuecnt)
@@ -431,6 +434,9 @@ ld_diskstart(device_t dev, struct buf *b
 
 	mutex_exit(>sc_mutex);
 
+	if ((sc->sc_flags & LDF_MPSAFE) == 0)
+		KERNEL_UNLOCK_ONE(curlwp);
+
 	return error;
 }
 
@@ -589,11 +595,22 @@ static int
 ld_discard(device_t dev, off_t pos, off_t len)
 {
 	struct ld_softc *sc = device_private(dev);
+	int rc;
 
 	if (sc->sc_discard == NULL)
 		return (ENODEV);
 
-	return (*sc->sc_discard)(sc, pos, len);
+	if ((sc->sc_flags & LDF_MPSAFE) == 0)
+		KERNEL_LOCK(1, curlwp);
+	mutex_enter(>sc_mutex);
+
+	rc = (*sc->sc_discard)(sc, pos, len);
+
+	mutex_exit(>sc_mutex);
+	if ((sc->sc_flags & LDF_MPSAFE) == 0)
+		KERNEL_UNLOCK_ONE(curlwp);
+
+	return rc;
 }
 
 static int

Index: src/sys/dev/ldvar.h
diff -u src/sys/dev/ldvar.h:1.30 src/sys/dev/ldvar.h:1.31
--- src/sys/dev/ldvar.h:1.30	Thu Apr 27 17:07:22 2017
+++ src/sys/dev/ldvar.h	Wed Aug  9 16:44:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ldvar.h,v 1.30 2017/04/27 17:07:22 jdolecek Exp $	*/
+/*	$NetBSD: ldvar.h,v 1.31 2017/08/09 16:44:39 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -68,6 +68,7 @@ struct ld_softc {
 #define	LDF_ENABLED	0x001		/* device enabled */
 #define	LDF_DRAIN	0x020		/* maxqueuecnt has changed; drain */
 #define	LDF_NO_RND	0x040		/* do not attach rnd source */
+#define	LDF_MPSAFE	0x080		/* backend is MPSAFE */
 
 int	ldadjqparam(struct ld_softc *, int);
 void	ldattach(struct ld_softc *, const char *);

Index: src/sys/dev/i2o/ld_iop.c
diff -u src/sys/dev/i2o/ld_iop.c:1.38 src/sys/dev/i2o/ld_iop.c:1.39
--- src/sys/dev/i2o/ld_iop.c:1.38	Wed Aug  9 16:09:16 2017
+++ src/sys/dev/i2o/ld_iop.c	Wed Aug  9 16:44:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_iop.c,v 1.38 2017/08/09 16:09:16 mlelstv Exp $	*/
+/*	$NetBSD: ld_iop.c,v 1.39 2017/08/09 16:44:39 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld_iop.c,v 1.38 2017/08/09 16:09:16 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_iop.c,v 1.39 2017/08/09 16:44:39 mlelstv Exp $");
 
 #include 
 #include 
@@ -171,6 +171,7 @@ ld_iop_attach(device_t parent, device_t 
 	ld->sc_dump = ld_iop_dump;
 	ld->sc_ioctl = ld_iop_ioctl;
 	ld->sc_start = ld_iop_start;
+	ld->sc_flags = LDF_MPSAFE;
 
 	/* Say what the device is. */
 	printf(":");
@@ -221,7 +222,7 @@ ld_iop_attach(device_t parent, device_t 
 
 	if ((le32toh(param.p.bdi.capabilities) & I2O_RBS_CAP_REMOVABLE_MEDIA)
 	!= 0) {
-		/* ld->sc_flags = LDF_REMOVABLE; */
+		/* ld->sc_flags |= LDF_REMOVABLE; */
 		fixedstr = "removable";
 		enable = 0;
 	} else

Index: src/sys/dev/ic/ld_cac.c
diff -u src/sys/dev/ic/ld_cac.c:1.30 src/sys/dev/ic/ld_cac.c:1.31
--- src/sys/dev/ic/ld_cac.c:1.30	Tue Sep 27 03:33:32 2016
+++ src/sys/dev/ic/ld_cac.c	Wed Aug  9 16:44:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_cac.c,v 1.30 2016/09/27 03:33:32 pgoyette Exp $	*/
+/*	$NetBSD: ld_cac.c,v 1.31 2017/08/09 16:44:40 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2006 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: 

CVS commit: src/sys/dev/i2o

2017-08-09 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Aug  9 16:09:16 UTC 2017

Modified Files:
src/sys/dev/i2o: ld_iop.c

Log Message:
Don't wait for allocation in polling mode.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/i2o/ld_iop.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/i2o/ld_iop.c
diff -u src/sys/dev/i2o/ld_iop.c:1.37 src/sys/dev/i2o/ld_iop.c:1.38
--- src/sys/dev/i2o/ld_iop.c:1.37	Mon Feb 27 21:32:33 2017
+++ src/sys/dev/i2o/ld_iop.c	Wed Aug  9 16:09:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_iop.c,v 1.37 2017/02/27 21:32:33 jdolecek Exp $	*/
+/*	$NetBSD: ld_iop.c,v 1.38 2017/08/09 16:09:16 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld_iop.c,v 1.37 2017/02/27 21:32:33 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_iop.c,v 1.38 2017/08/09 16:09:16 mlelstv Exp $");
 
 #include 
 #include 
@@ -448,7 +448,7 @@ ld_iop_flush(struct ld_softc *ld, bool p
 
 	sc = device_private(ld->sc_dv);
 	iop = device_private(device_parent(ld->sc_dv));
-	im = iop_msg_alloc(iop, IM_WAIT);
+	im = iop_msg_alloc(iop, poll ? IM_POLL : IM_WAIT);
 
 	mf.msgflags = I2O_MSGFLAGS(i2o_rbs_cache_flush);
 	mf.msgfunc = I2O_MSGFUNC(sc->sc_ii.ii_tid, I2O_RBS_CACHE_FLUSH);



CVS commit: [netbsd-8] src/doc

2017-08-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  9 13:03:38 UTC 2017

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

Log Message:
Ammend ticket #189


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

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

Modified files:

Index: src/doc/CHANGES-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.37 src/doc/CHANGES-8.0:1.1.2.38
--- src/doc/CHANGES-8.0:1.1.2.37	Wed Aug  9 06:10:08 2017
+++ src/doc/CHANGES-8.0	Wed Aug  9 13:03:38 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.37 2017/08/09 06:10:08 snj Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.38 2017/08/09 13:03:38 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -5098,7 +5098,7 @@ sys/compat/linux/common/linux_time.c		1.
 sys/compat/svr4/svr4_lwp.c			1.20
 sys/compat/svr4/svr4_signal.c			1.67
 sys/compat/svr4/svr4_stream.c			1.89-1.91
-sys/compat/svr4_32/svr4_32_signal.c		1.29
+sys/compat/svr4_32/svr4_32_signal.c		1.29-1.30
 
 	Fix some of the multitudinous holes in svr4 streams.
 	Zero stack data before copyout.



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

2017-08-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  9 13:03:18 UTC 2017

Modified Files:
src/sys/compat/svr4_32 [netbsd-8]: svr4_32_signal.c

Log Message:
Additionally pull up r1.30 for ticket #189 to unbreak the build.


To generate a diff of this commit:
cvs rdiff -u -r1.28.10.1 -r1.28.10.2 src/sys/compat/svr4_32/svr4_32_signal.c

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

Modified files:

Index: src/sys/compat/svr4_32/svr4_32_signal.c
diff -u src/sys/compat/svr4_32/svr4_32_signal.c:1.28.10.1 src/sys/compat/svr4_32/svr4_32_signal.c:1.28.10.2
--- src/sys/compat/svr4_32/svr4_32_signal.c:1.28.10.1	Tue Aug  8 16:05:37 2017
+++ src/sys/compat/svr4_32/svr4_32_signal.c	Wed Aug  9 13:03:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_32_signal.c,v 1.28.10.1 2017/08/08 16:05:37 martin Exp $	 */
+/*	$NetBSD: svr4_32_signal.c,v 1.28.10.2 2017/08/09 13:03:18 martin Exp $	 */
 
 /*-
  * Copyright (c) 1994, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svr4_32_signal.c,v 1.28.10.1 2017/08/08 16:05:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_32_signal.c,v 1.28.10.2 2017/08/09 13:03:18 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_svr4.h"
@@ -397,16 +397,16 @@ svr4_32_sys_signal(struct lwp *l, const 
 		nbsa.sa_handler = (sig_t)SCARG(uap, handler);
 		sigemptyset(_mask);
 		nbsa.sa_flags = 0;
-		error = sigaction1(l, signum, , , NULL, 0);
+		error = sigaction1(l, native_signo, , , NULL, 0);
 		if (error)
-			return (error);
+			return error;
 		*retval = (u_int)(u_long)obsa.sa_handler;
-		return (0);
+		return 0;
 
 	case SVR4_SIGHOLD_MASK:
 	sighold:
 		sigemptyset();
-		sigaddset(, signum);
+		sigaddset(, native_signo);
 		mutex_enter(p->p_lock);
 		error = sigprocmask1(l, SIG_BLOCK, , 0);
 		mutex_exit(p->p_lock);
@@ -414,7 +414,7 @@ svr4_32_sys_signal(struct lwp *l, const 
 
 	case SVR4_SIGRELSE_MASK:
 		sigemptyset();
-		sigaddset(, signum);
+		sigaddset(, native_signo);
 		mutex_enter(p->p_lock);
 		error = sigprocmask1(l, SIG_UNBLOCK, , 0);
 		mutex_exit(p->p_lock);
@@ -424,17 +424,17 @@ svr4_32_sys_signal(struct lwp *l, const 
 		nbsa.sa_handler = SIG_IGN;
 		sigemptyset(_mask);
 		nbsa.sa_flags = 0;
-		return (sigaction1(l, signum, , 0, NULL, 0));
+		return sigaction1(l, native_signo, , 0, NULL, 0);
 
 	case SVR4_SIGPAUSE_MASK:
 		mutex_enter(p->p_lock);
 		ss = l->l_sigmask;
 		mutex_exit(p->p_lock);
-		sigdelset(, signum);
-		return (sigsuspend1(l, ));
+		sigdelset(, native_signo);
+		return sigsuspend1(l, );
 
 	default:
-		return (ENOSYS);
+		return ENOSYS;
 	}
 }
 



CVS commit: src/sys/netipsec

2017-08-09 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Aug  9 09:48:11 UTC 2017

Modified Files:
src/sys/netipsec: key.c key.h keydb.h xform_ah.c xform_esp.c
xform_ipcomp.c

Log Message:
MP-ify SAD (savlist)

localcount(9) is used to protect savlist of sah. The basic design is
similar to MP-ifications of SPD and SAD sahlist. Please read the
locking notes of SAD for more details.


To generate a diff of this commit:
cvs rdiff -u -r1.222 -r1.223 src/sys/netipsec/key.c
cvs rdiff -u -r1.28 -r1.29 src/sys/netipsec/key.h
cvs rdiff -u -r1.19 -r1.20 src/sys/netipsec/keydb.h
cvs rdiff -u -r1.71 -r1.72 src/sys/netipsec/xform_ah.c
cvs rdiff -u -r1.69 -r1.70 src/sys/netipsec/xform_esp.c
cvs rdiff -u -r1.50 -r1.51 src/sys/netipsec/xform_ipcomp.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.222 src/sys/netipsec/key.c:1.223
--- src/sys/netipsec/key.c:1.222	Wed Aug  9 08:30:54 2017
+++ src/sys/netipsec/key.c	Wed Aug  9 09:48:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.222 2017/08/09 08:30:54 ozaki-r Exp $	*/
+/*	$NetBSD: key.c,v 1.223 2017/08/09 09:48:11 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.222 2017/08/09 08:30:54 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.223 2017/08/09 09:48:11 ozaki-r Exp $");
 
 /*
  * This code is referd to RFC 2367
@@ -202,13 +202,15 @@ static u_int32_t acq_seq = 0;
  * - Data structures
  *   - SAs are managed by the list called key_sad.sahlist and sav lists of sah
  * entries
+ * - An sav is supposed to be an SA from a viewpoint of users
  *   - A sah has sav lists for each SA state
  *   - Multiple sahs with the same saidx can exist
  * - Only one entry has MATURE state and others should be DEAD
  * - DEAD entries are just ignored from searching
- * - Modifications to the key_sad.sahlist must be done with holding key_sad.lock
- *   which is a adaptive mutex
- * - Read accesses to the key_sad.sahlist must be in pserialize(9) read sections
+ * - Modifications to the key_sad.sahlist and sah.savlist must be done with
+ *   holding key_sad.lock which is a adaptive mutex
+ * - Read accesses to the key_sad.sahlist and sah.savlist must be in
+ *   pserialize(9) read sections
  * - sah's lifetime is managed by localcount(9)
  * - Getting an sah entry
  *   - We get an sah from the key_sad.sahlist
@@ -218,6 +220,16 @@ static u_int32_t acq_seq = 0;
  * - An sah is destroyed when its state become DEAD and no sav is
  *   listed to the sah
  *   - The destruction is done only in the timer (see key_timehandler_sad)
+ * - sav's lifetime is managed by localcount(9)
+ * - Getting an sav entry
+ *   - First get an sah by saidx and get an sav from either of sah's savlists
+ * - Must iterate the list and increment the reference count of a found sav
+ *   (by key_sa_ref) in a pserialize read section
+ *   - We can gain another reference from a held SA only if we check its state
+ * and take its reference in a pserialize read section
+ * (see esp_output for example)
+ *   - A gotten sav must be released after use by key_sa_unref
+ * - An sav is destroyed when its state become DEAD
  */
 /*
  * Locking notes on misc data:
@@ -643,6 +655,9 @@ static void key_destroy_sah(struct secas
 static bool key_sah_has_sav(struct secashead *);
 static void key_sah_ref(struct secashead *);
 static void key_sah_unref(struct secashead *);
+static void key_init_sav(struct secasvar *);
+static void key_destroy_sav(struct secasvar *);
+static void key_destroy_sav_with_ref(struct secasvar *);
 static struct secasvar *key_newsav(struct mbuf *,
 	const struct sadb_msghdr *, int *, const char*, int);
 #define	KEY_NEWSAV(m, sadb, e)\
@@ -776,35 +791,6 @@ static struct callout	key_timehandler_ch
 static struct workqueue	*key_timehandler_wq;
 static struct work	key_timehandler_wk;
 
-#ifdef IPSEC_REF_DEBUG
-#define REFLOG(label, p, where, tag)	\
-	log(LOG_DEBUG, "%s:%d: " label " : refcnt=%d (%p)\n.",		\
-	(where), (tag), (p)->refcnt, (p))
-#else
-#define REFLOG(label, p, where, tag)	do {} while (0)
-#endif
-
-#define	SA_ADDREF(p) do {		\
-	atomic_inc_uint(&(p)->refcnt);	\
-	REFLOG("SA_ADDREF", (p), __func__, __LINE__);			\
-	KASSERTMSG((p)->refcnt != 0, "SA refcnt overflow");		\
-} while (0)
-#define	SA_ADDREF2(p, where, tag) do {	\
-	atomic_inc_uint(&(p)->refcnt);	\
-	REFLOG("SA_ADDREF", (p), (where), (tag));			\
-	KASSERTMSG((p)->refcnt != 0, "SA refcnt overflow");		\
-} while (0)
-#define	SA_DELREF(p) do {		\
-	KASSERTMSG((p)->refcnt > 0, "SA refcnt underflow");		\
-	atomic_dec_uint(&(p)->refcnt);	\
-	REFLOG("SA_DELREF", (p), __func__, __LINE__);			\
-} while (0)
-#define	SA_DELREF2(p, nv, 

CVS commit: src/sys/netipsec

2017-08-09 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Aug  9 08:30:54 UTC 2017

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

Log Message:
Limit the number of mbufs queued for deferred key_sendup_mbuf

It's easy to be queued hundreds of mbufs on the list under heavy
network load.


To generate a diff of this commit:
cvs rdiff -u -r1.221 -r1.222 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.221 src/sys/netipsec/key.c:1.222
--- src/sys/netipsec/key.c:1.221	Wed Aug  9 06:04:41 2017
+++ src/sys/netipsec/key.c	Wed Aug  9 08:30:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.221 2017/08/09 06:04:41 ozaki-r Exp $	*/
+/*	$NetBSD: key.c,v 1.222 2017/08/09 08:30:54 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.221 2017/08/09 06:04:41 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.222 2017/08/09 08:30:54 ozaki-r Exp $");
 
 /*
  * This code is referd to RFC 2367
@@ -735,7 +735,7 @@ static struct mbuf *key_getcomb_ipcomp (
 static struct mbuf *key_getprop (const struct secasindex *);
 
 static int key_acquire (const struct secasindex *, struct secpolicy *);
-static void key_acquire_sendup_mbuf_later(struct mbuf *);
+static int key_acquire_sendup_mbuf_later(struct mbuf *);
 static void key_acquire_sendup_pending_mbuf(void);
 #ifndef IPSEC_NONBLOCK_ACQUIRE
 static struct secacq *key_newacq (const struct secasindex *);
@@ -6656,8 +6656,7 @@ key_acquire(const struct secasindex *sai
 	 *
 	 * So defer key_sendup_mbuf to the timer.
 	 */
-	key_acquire_sendup_mbuf_later(result);
-	return 0;
+	return key_acquire_sendup_mbuf_later(result);
 
  fail:
 	if (result)
@@ -,6 +6665,8 @@ key_acquire(const struct secasindex *sai
 }
 
 static struct mbuf *key_acquire_mbuf_head = NULL;
+static unsigned key_acquire_mbuf_count = 0;
+#define KEY_ACQUIRE_MBUF_MAX	10
 
 static void
 key_acquire_sendup_pending_mbuf(void)
@@ -6684,6 +6685,7 @@ again:
 prev->m_nextpkt = NULL;
 			if (m == key_acquire_mbuf_head)
 key_acquire_mbuf_head = NULL;
+			key_acquire_mbuf_count--;
 			break;
 		}
 		prev = m;
@@ -6694,6 +6696,7 @@ again:
 	if (m == NULL)
 		return;
 
+	m->m_nextpkt = NULL;
 	error = key_sendup_mbuf(NULL, m, KEY_SENDUP_REGISTERED);
 	if (error != 0)
 		IPSECLOG(LOG_WARNING, "key_sendup_mbuf failed (error=%d)\n",
@@ -6703,18 +6706,27 @@ again:
 		goto again;
 }
 
-static void
+static int
 key_acquire_sendup_mbuf_later(struct mbuf *m)
 {
 
 	mutex_enter(_misc.lock);
+	/* Avoid queuing too much mbufs */
+	if (key_acquire_mbuf_count >= KEY_ACQUIRE_MBUF_MAX) {
+		mutex_exit(_misc.lock);
+		m_freem(m);
+		return ENOBUFS; /* XXX */
+	}
 	/* Enqueue mbuf at the head of the list */
 	m->m_nextpkt = key_acquire_mbuf_head;
 	key_acquire_mbuf_head = m;
+	key_acquire_mbuf_count++;
 	mutex_exit(_misc.lock);
 
 	/* Kick the timer */
 	key_timehandler(NULL);
+
+	return 0;
 }
 
 #ifndef IPSEC_NONBLOCK_ACQUIRE



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

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 07:32:43 UTC 2017

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

Log Message:
1460-1462


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

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

Modified files:

Index: src/doc/CHANGES-7.0.3
diff -u src/doc/CHANGES-7.0.3:1.1.2.50 src/doc/CHANGES-7.0.3:1.1.2.51
--- src/doc/CHANGES-7.0.3:1.1.2.50	Wed Jul 26 16:04:26 2017
+++ src/doc/CHANGES-7.0.3	Wed Aug  9 07:32:43 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0.3,v 1.1.2.50 2017/07/26 16:04:26 snj Exp $
+# $NetBSD: CHANGES-7.0.3,v 1.1.2.51 2017/08/09 07:32:43 snj Exp $
 
 A complete list of changes from the NetBSD 7.0.2 release to the NetBSD 7.0.3
 release:
@@ -3031,3 +3031,20 @@ external/public-domain/tz/dist/version  
 	Haiti, and a change to historic data for Liberia.
 	[kre, ticket #1450]
 
+sys/dev/auconv.c1.30 via patch
+sys/dev/ic/ac97.c1.97 via patch
+sys/dev/pci/azalia_codec.c			1.81 via patch
+
+	Mixer device bounds checking.
+	[nat, ticket #1460]
+
+sys/kern/kern_malloc.c1.146
+
+	Avoid integer overflow in kern_malloc().
+	[martin, ticket #1461]
+
+sys/dev/usb/if_ural.c1.52
+
+	Free the RX list if ural_alloc_rx_list fails part way through.
+	[skrll, ticket #1462]
+



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

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 07:27:02 UTC 2017

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

Log Message:
1460-1462


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

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

Modified files:

Index: src/doc/CHANGES-7.1.1
diff -u src/doc/CHANGES-7.1.1:1.1.2.19 src/doc/CHANGES-7.1.1:1.1.2.20
--- src/doc/CHANGES-7.1.1:1.1.2.19	Wed Jul 26 16:07:41 2017
+++ src/doc/CHANGES-7.1.1	Wed Aug  9 07:27:01 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1.1,v 1.1.2.19 2017/07/26 16:07:41 snj Exp $
+# $NetBSD: CHANGES-7.1.1,v 1.1.2.20 2017/08/09 07:27:01 snj Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.1.1
 release:
@@ -1741,3 +1741,20 @@ external/public-domain/tz/dist/version  
 	Haiti, and a change to historic data for Liberia.
 	[kre, ticket #1450]
 
+sys/dev/auconv.c1.30 via patch
+sys/dev/ic/ac97.c1.97 via patch
+sys/dev/pci/azalia_codec.c			1.81 via patch
+
+	Mixer device bounds checking.
+	[nat, ticket #1460]
+
+sys/kern/kern_malloc.c1.146
+
+	Avoid integer overflow in kern_malloc().
+	[martin, ticket #1461]
+
+sys/dev/usb/if_ural.c1.52
+
+	Free the RX list if ural_alloc_rx_list fails part way through.
+	[skrll, ticket #1462]
+



CVS commit: [netbsd-7] src/doc

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 07:19:05 UTC 2017

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

Log Message:
1460-1462, 1464-1466


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

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

Modified files:

Index: src/doc/CHANGES-7.2
diff -u src/doc/CHANGES-7.2:1.1.2.33 src/doc/CHANGES-7.2:1.1.2.34
--- src/doc/CHANGES-7.2:1.1.2.33	Wed Jul 26 16:11:31 2017
+++ src/doc/CHANGES-7.2	Wed Aug  9 07:19:05 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.2,v 1.1.2.33 2017/07/26 16:11:31 snj Exp $
+# $NetBSD: CHANGES-7.2,v 1.1.2.34 2017/08/09 07:19:05 snj Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.2
 release:
@@ -2681,3 +2681,35 @@ sys/dev/pci/if_iwm.c1.72
 	iwm(4): match Wireless 8265 device.
 	[nonaka, ticket #1459]
 
+sys/dev/auconv.c1.30 via patch
+sys/dev/ic/ac97.c1.97 via patch
+sys/dev/pci/azalia_codec.c			1.81 via patch
+
+	Mixer device bounds checking.
+	[nat, ticket #1460]
+
+sys/kern/kern_malloc.c1.146
+
+	Avoid integer overflow in kern_malloc().
+	[martin, ticket #1461]
+
+sys/dev/usb/if_ural.c1.52
+
+	Free the RX list if ural_alloc_rx_list fails part way through.
+	[skrll, ticket #1462]
+
+sys/arch/evbarm/rpi/rpi_machdep.c		1.71 via patch
+
+	Disable BSC0 on Raspberry Pi 3 and Zero W boards.
+	[jmcneill, ticket #1464]
+
+sys/dev/hpc/hpckbd.c1.32
+
+hpcsh: unbreak wscons console after ticket #1438.
+[uwe, ticket #1465]
+
+sys/arch/hpcsh/dev/pfckbd.c			1.30
+
+	Make early ddb work with wscons console again.
+	[uwe, ticket #1466]
+



CVS commit: [netbsd-7] src/sys/arch/hpcsh/dev

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 06:56:02 UTC 2017

Modified Files:
src/sys/arch/hpcsh/dev [netbsd-7]: pfckbd.c

Log Message:
Pull up following revision(s) (requested by uwe in ticket #1466):
sys/arch/hpcsh/dev/pfckbd.c: revision 1.30
Don't reschedule the callout in the scanning function itself, as that
conflicts with using the same function for polled console.
Makes early ddb work with wscons console again on my Jornada 690.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.22.1 src/sys/arch/hpcsh/dev/pfckbd.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/hpcsh/dev/pfckbd.c
diff -u src/sys/arch/hpcsh/dev/pfckbd.c:1.29 src/sys/arch/hpcsh/dev/pfckbd.c:1.29.22.1
--- src/sys/arch/hpcsh/dev/pfckbd.c:1.29	Sun Feb 12 16:34:08 2012
+++ src/sys/arch/hpcsh/dev/pfckbd.c	Wed Aug  9 06:56:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pfckbd.c,v 1.29 2012/02/12 16:34:08 matt Exp $	*/
+/*	$NetBSD: pfckbd.c,v 1.29.22.1 2017/08/09 06:56:02 snj Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  * currently, HP Jornada 680/690, HITACHI PERSONA HPW-50PAD only.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pfckbd.c,v 1.29 2012/02/12 16:34:08 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pfckbd.c,v 1.29.22.1 2017/08/09 06:56:02 snj Exp $");
 
 #include "debug_hpcsh.h"
 
@@ -66,7 +66,7 @@ static struct pfckbd_core {
 	struct hpckbd_ic_if pc_if;
 	struct hpckbd_if *pc_hpckbd;
 	uint16_t pc_column[8];
-	void (*pc_callout)(void *);
+	void (*pc_callout)(struct pfckbd_core *);
 } pfckbd_core;
 
 static int pfckbd_match(device_t, cfdata_t, void *);
@@ -83,17 +83,17 @@ static int pfckbd_poll(void *);
 
 static void pfckbd_input(struct pfckbd_core *, int, uint16_t);
 
-static void (*pfckbd_callout_lookup(void))(void *);
-static void pfckbd_callout_unknown(void *);
-static void pfckbd_callout_hp(void *);
-static void pfckbd_callout_hitachi(void *);
+static void (*pfckbd_callout_lookup(void))(struct pfckbd_core *);
+static void pfckbd_callout(void *);
+static void pfckbd_callout_hp(struct pfckbd_core *);
+static void pfckbd_callout_hitachi(struct pfckbd_core *);
 void pfckbd_poll_hitachi_power(void);
 
 
 /* callout function table. this function is platfrom specific. */
 static const struct {
 	platid_mask_t *platform;
-	void (*func)(void *);
+	void (*func)(struct pfckbd_core *);
 } pfckbd_calloutfunc_table[] = {
 	{ _mask_MACH_HP		, pfckbd_callout_hp },
 	{ _mask_MACH_HITACHI	, pfckbd_callout_hitachi }
@@ -144,9 +144,13 @@ pfckbd_attach(device_t parent, device_t 
 	config_found(self, , hpckbd_print);
 
 	/* install callout handler */
-	callout_init(_core.pc_soft_ch, 0);
-	callout_reset(_core.pc_soft_ch, 1,
-		  pfckbd_core.pc_callout, _core);
+	if (pfckbd_core.pc_callout != NULL) {
+		callout_init(_core.pc_soft_ch, 0);
+		callout_reset(_core.pc_soft_ch, 1,
+			  pfckbd_callout, _core);
+	}
+	else
+		aprint_error_dev(self, "unsupported platform\n");
 
 	if (!pmf_device_register(self, NULL, NULL))
 		aprint_error_dev(self, "unable to establish power handler\n");
@@ -191,12 +195,22 @@ pfckbd_poll(void *ic)
 {
 	struct pfckbd_core *pc = ic;
 
-	if (pc->pc_enabled)
+	if (pc->pc_enabled && pc->pc_callout != NULL)
 		(*pc->pc_callout)(pc);
 
 	return 0;
 }
 
+static void
+pfckbd_callout(void *arg)
+{
+	struct pfckbd_core *pc = arg;
+
+	(*pc->pc_callout)(pc);
+	callout_schedule(>pc_soft_ch, 1);
+}
+
+
 /*
  * Called by platform specific scan routines to report key events to hpckbd
  */
@@ -230,7 +244,7 @@ pfckbd_input(struct pfckbd_core *pc, int
 
 /* Look up appropriate callback handler */
 static void
-(*pfckbd_callout_lookup(void))(void *)
+(*pfckbd_callout_lookup(void))(struct pfckbd_core *)
 {
 	int i, n;
 
@@ -242,22 +256,14 @@ static void
  pfckbd_calloutfunc_table[i].platform))
 			return pfckbd_calloutfunc_table[i].func;
 
-	return pfckbd_callout_unknown;
-}
-
-/* Placeholder for unknown platform */
-static void
-pfckbd_callout_unknown(void *arg)
-{
-
-	printf("%s: unknown keyboard switch\n", __func__);
+	return NULL;
 }
 
 /*
  * HP Jornada680/690, HP620LX
  */
 static void
-pfckbd_callout_hp(void *arg)
+pfckbd_callout_hp(struct pfckbd_core *pc)
 {
 #define PFCKBD_HP_PDCR_MASK 0xcc0c
 #define PFCKBD_HP_PECR_MASK 0xf0cf
@@ -288,13 +294,12 @@ pfckbd_callout_hp(void *arg)
 #undef PD
 #undef PE
 
-	struct pfckbd_core *pc = arg;
 	uint16_t dc, ec;
 	int column;
 	uint16_t data;
 
 	if (!pc->pc_enabled)
-		goto reinstall;
+		return;
 
 	/* bits in D/E control regs we do not touch (XXX: can they change?) */
 	dc = _reg_read_2(SH7709_PDCR) & ~PFCKBD_HP_PDCR_MASK;
@@ -330,16 +335,13 @@ pfckbd_callout_hp(void *arg)
 	/* (ignore) extra keys/events (recorder buttons, lid, cable ) */
 	data = _reg_read_1(SH7709_PGDR) | (_reg_read_1(SH7709_PHDR) << 8);
 #endif
-
- reinstall:
-	callout_schedule(>pc_soft_ch, 1);
 }
 
 /*
  * HITACH PERSONA 

CVS commit: [netbsd-7] src/sys/dev/hpc

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 06:48:57 UTC 2017

Modified Files:
src/sys/dev/hpc [netbsd-7]: hpckbd.c

Log Message:
Pull up following revision(s) (requested by uwe in ticket #1465):
sys/dev/hpc/hpckbd.c: revision 1.32
XXX: On hpcsh only - bring back old incorrect hpckbd_keymap_setup()
fixed in 1.31.  The old one with UNCONST does work on hpcsh b/c the
kernel is directly mapped.  The new one does not work on hpcsh b/c it
calls consinit() very early when malloc() is not yet available.
The real fix for this is to fix the constness of wscons keymap
structures that is self-contradictory.


To generate a diff of this commit:
cvs rdiff -u -r1.30.12.1 -r1.30.12.2 src/sys/dev/hpc/hpckbd.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/hpc/hpckbd.c
diff -u src/sys/dev/hpc/hpckbd.c:1.30.12.1 src/sys/dev/hpc/hpckbd.c:1.30.12.2
--- src/sys/dev/hpc/hpckbd.c:1.30.12.1	Sun Jul 23 06:05:36 2017
+++ src/sys/dev/hpc/hpckbd.c	Wed Aug  9 06:48:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpckbd.c,v 1.30.12.1 2017/07/23 06:05:36 snj Exp $ */
+/*	$NetBSD: hpckbd.c,v 1.30.12.2 2017/08/09 06:48:57 snj Exp $ */
 
 /*-
  * Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.30.12.1 2017/07/23 06:05:36 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.30.12.2 2017/08/09 06:48:57 snj Exp $");
 
 #include 
 #include 
@@ -260,6 +260,40 @@ hpckbd_getevent(struct hpckbd_core* hc, 
 	return (1);
 }
 
+
+#ifdef hpcsh
+/*
+ * XXX: Use the old wrong code for now as hpcsh attaches console very
+ * early and it's convenient to be able to do early DDB on wscons.
+ */
+void
+hpckbd_keymap_setup(struct hpckbd_core *hc,
+		const keysym_t *map, int mapsize)
+{
+	int i;
+	struct wscons_keydesc *desc;
+
+	/* fix keydesc table */
+	/* 
+	 * XXX The way this is done is really wrong.  The __UNCONST()
+	 * is a hint as to what is wrong.  This actually ends up modifying
+	 * initialized data which is marked "const".
+	 * The reason we get away with it here is that on sh3 kernel
+	 * is directly mapped.
+	 */
+	desc = (struct wscons_keydesc *)__UNCONST(hpckbd_keymapdata.keydesc);
+	for (i = 0; desc[i].name != 0; i++) {
+		if ((desc[i].name & KB_MACHDEP) && desc[i].map == NULL) {
+			desc[i].map = map;
+			desc[i].map_size = mapsize;
+		}
+	}
+
+	return;
+}
+
+#else
+
 void
 hpckbd_keymap_setup(struct hpckbd_core *hc,
 		const keysym_t *map, int mapsize)
@@ -294,6 +328,7 @@ hpckbd_keymap_setup(struct hpckbd_core *
 
 	return;
 }
+#endif
 
 void
 hpckbd_keymap_lookup(struct hpckbd_core *hc)



CVS commit: [netbsd-7] src/sys/arch/evbarm/rpi

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 06:40:25 UTC 2017

Modified Files:
src/sys/arch/evbarm/rpi [netbsd-7]: rpi_machdep.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #1464):
sys/arch/evbarm/rpi/rpi_machdep.c: 1.71 via patch
Disable BSC0 on Raspberry Pi 3 and Zero W boards.


To generate a diff of this commit:
cvs rdiff -u -r1.43.2.7 -r1.43.2.8 src/sys/arch/evbarm/rpi/rpi_machdep.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/evbarm/rpi/rpi_machdep.c
diff -u src/sys/arch/evbarm/rpi/rpi_machdep.c:1.43.2.7 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.43.2.8
--- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.43.2.7	Wed Jul 26 15:22:37 2017
+++ src/sys/arch/evbarm/rpi/rpi_machdep.c	Wed Aug  9 06:40:25 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpi_machdep.c,v 1.43.2.7 2017/07/26 15:22:37 snj Exp $	*/
+/*	$NetBSD: rpi_machdep.c,v 1.43.2.8 2017/08/09 06:40:25 snj Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.43.2.7 2017/07/26 15:22:37 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.43.2.8 2017/08/09 06:40:25 snj Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_bcm283x.h"
@@ -74,6 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_machdep.
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1033,6 +1034,21 @@ rpi_device_register(device_t dev, void *
 		}
 	}
 #endif
+
+	/* BSC0 is used internally on some boards */
+	if (device_is_a(dev, "bsciic") &&
+	((struct amba_attach_args *)aux)->aaa_addr == BCM2835_BSC0_BASE) {
+		const uint32_t rev = vb.vbt_boardrev.rev;
+
+		if ((rev & VCPROP_REV_ENCFLAG) != 0) {
+			switch (__SHIFTOUT(rev, VCPROP_REV_MODEL)) {
+			case RPI_MODEL_B_PI3:
+			case RPI_MODEL_ZERO_W:
+prop_dictionary_set_bool(dict, "disable", true);
+break;
+			}
+		}
+	}
 }
 
 SYSCTL_SETUP(sysctl_machdep_rpi, "sysctl machdep subtree setup (rpi)")



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

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 06:35:37 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-0]: if_ural.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1462):
sys/dev/usb/if_ural.c: revision 1.52
Free the RX list if ural_alloc_rx_list fails part way through.
Reported by Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.44.16.1 src/sys/dev/usb/if_ural.c

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

Modified files:

Index: src/sys/dev/usb/if_ural.c
diff -u src/sys/dev/usb/if_ural.c:1.44 src/sys/dev/usb/if_ural.c:1.44.16.1
--- src/sys/dev/usb/if_ural.c:1.44	Tue Jan 22 12:40:43 2013
+++ src/sys/dev/usb/if_ural.c	Wed Aug  9 06:35:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ural.c,v 1.44 2013/01/22 12:40:43 jmcneill Exp $ */
+/*	$NetBSD: if_ural.c,v 1.44.16.1 2017/08/09 06:35:37 snj Exp $ */
 /*	$FreeBSD: /repoman/r/ncvs/src/sys/dev/usb/if_ural.c,v 1.40 2006/06/02 23:14:40 sam Exp $	*/
 
 /*-
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.44 2013/01/22 12:40:43 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.44.16.1 2017/08/09 06:35:37 snj Exp $");
 
 #include 
 #include 
@@ -674,7 +674,7 @@ ural_alloc_rx_list(struct ural_softc *sc
 
 	return 0;
 
-fail:	ural_free_tx_list(sc);
+fail:	ural_free_rx_list(sc);
 	return error;
 }
 



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

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 06:35:16 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-1]: if_ural.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1462):
sys/dev/usb/if_ural.c: revision 1.52
Free the RX list if ural_alloc_rx_list fails part way through.
Reported by Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.44.20.1 src/sys/dev/usb/if_ural.c

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

Modified files:

Index: src/sys/dev/usb/if_ural.c
diff -u src/sys/dev/usb/if_ural.c:1.44 src/sys/dev/usb/if_ural.c:1.44.20.1
--- src/sys/dev/usb/if_ural.c:1.44	Tue Jan 22 12:40:43 2013
+++ src/sys/dev/usb/if_ural.c	Wed Aug  9 06:35:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ural.c,v 1.44 2013/01/22 12:40:43 jmcneill Exp $ */
+/*	$NetBSD: if_ural.c,v 1.44.20.1 2017/08/09 06:35:16 snj Exp $ */
 /*	$FreeBSD: /repoman/r/ncvs/src/sys/dev/usb/if_ural.c,v 1.40 2006/06/02 23:14:40 sam Exp $	*/
 
 /*-
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.44 2013/01/22 12:40:43 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.44.20.1 2017/08/09 06:35:16 snj Exp $");
 
 #include 
 #include 
@@ -674,7 +674,7 @@ ural_alloc_rx_list(struct ural_softc *sc
 
 	return 0;
 
-fail:	ural_free_tx_list(sc);
+fail:	ural_free_rx_list(sc);
 	return error;
 }
 



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

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 06:34:53 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7]: if_ural.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1462):
sys/dev/usb/if_ural.c: revision 1.52
Free the RX list if ural_alloc_rx_list fails part way through.
Reported by Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.44.12.1 -r1.44.12.2 src/sys/dev/usb/if_ural.c

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

Modified files:

Index: src/sys/dev/usb/if_ural.c
diff -u src/sys/dev/usb/if_ural.c:1.44.12.1 src/sys/dev/usb/if_ural.c:1.44.12.2
--- src/sys/dev/usb/if_ural.c:1.44.12.1	Wed Apr  5 19:54:19 2017
+++ src/sys/dev/usb/if_ural.c	Wed Aug  9 06:34:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ural.c,v 1.44.12.1 2017/04/05 19:54:19 snj Exp $ */
+/*	$NetBSD: if_ural.c,v 1.44.12.2 2017/08/09 06:34:53 snj Exp $ */
 /*	$FreeBSD: /repoman/r/ncvs/src/sys/dev/usb/if_ural.c,v 1.40 2006/06/02 23:14:40 sam Exp $	*/
 
 /*-
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.44.12.1 2017/04/05 19:54:19 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.44.12.2 2017/08/09 06:34:53 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -652,7 +652,7 @@ ural_alloc_rx_list(struct ural_softc *sc
 
 	return 0;
 
-fail:	ural_free_tx_list(sc);
+fail:	ural_free_rx_list(sc);
 	return error;
 }
 



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

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 06:32:49 UTC 2017

Modified Files:
src/sys/kern [netbsd-7]: kern_malloc.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #1461):
sys/kern/kern_malloc.c: revision 1.146
Avoid integer overflow in kern_malloc(). Reported by Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.143.2.1 -r1.143.2.2 src/sys/kern/kern_malloc.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_malloc.c
diff -u src/sys/kern/kern_malloc.c:1.143.2.1 src/sys/kern/kern_malloc.c:1.143.2.2
--- src/sys/kern/kern_malloc.c:1.143.2.1	Wed Mar 25 16:54:37 2015
+++ src/sys/kern/kern_malloc.c	Wed Aug  9 06:32:49 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_malloc.c,v 1.143.2.1 2015/03/25 16:54:37 snj Exp $	*/
+/*	$NetBSD: kern_malloc.c,v 1.143.2.2 2017/08/09 06:32:49 snj Exp $	*/
 
 /*
  * Copyright (c) 1987, 1991, 1993
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.143.2.1 2015/03/25 16:54:37 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.143.2.2 2017/08/09 06:32:49 snj Exp $");
 
 #include 
 #include 
@@ -105,7 +105,10 @@ kern_malloc(unsigned long size, int flag
 	void *p;
 
 	if (size >= PAGE_SIZE) {
-		allocsize = PAGE_SIZE + size; /* for page alignment */
+		if (size > (ULONG_MAX-PAGE_SIZE))
+			allocsize = ULONG_MAX;	/* this will fail later */
+		else
+			allocsize = PAGE_SIZE + size; /* for page alignment */
 		hdroffset = PAGE_SIZE - sizeof(struct malloc_header);
 	} else {
 		allocsize = sizeof(struct malloc_header) + size;



CVS commit: [netbsd-7-1] src/sys/kern

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 06:32:22 UTC 2017

Modified Files:
src/sys/kern [netbsd-7-1]: kern_malloc.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #1461):
sys/kern/kern_malloc.c: revision 1.146
Avoid integer overflow in kern_malloc(). Reported by Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.143.2.1 -r1.143.2.1.6.1 src/sys/kern/kern_malloc.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_malloc.c
diff -u src/sys/kern/kern_malloc.c:1.143.2.1 src/sys/kern/kern_malloc.c:1.143.2.1.6.1
--- src/sys/kern/kern_malloc.c:1.143.2.1	Wed Mar 25 16:54:37 2015
+++ src/sys/kern/kern_malloc.c	Wed Aug  9 06:32:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_malloc.c,v 1.143.2.1 2015/03/25 16:54:37 snj Exp $	*/
+/*	$NetBSD: kern_malloc.c,v 1.143.2.1.6.1 2017/08/09 06:32:22 snj Exp $	*/
 
 /*
  * Copyright (c) 1987, 1991, 1993
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.143.2.1 2015/03/25 16:54:37 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.143.2.1.6.1 2017/08/09 06:32:22 snj Exp $");
 
 #include 
 #include 
@@ -105,7 +105,10 @@ kern_malloc(unsigned long size, int flag
 	void *p;
 
 	if (size >= PAGE_SIZE) {
-		allocsize = PAGE_SIZE + size; /* for page alignment */
+		if (size > (ULONG_MAX-PAGE_SIZE))
+			allocsize = ULONG_MAX;	/* this will fail later */
+		else
+			allocsize = PAGE_SIZE + size; /* for page alignment */
 		hdroffset = PAGE_SIZE - sizeof(struct malloc_header);
 	} else {
 		allocsize = sizeof(struct malloc_header) + size;



CVS commit: [netbsd-7-0] src/sys/kern

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 06:31:33 UTC 2017

Modified Files:
src/sys/kern [netbsd-7-0]: kern_malloc.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #1461):
sys/kern/kern_malloc.c: revision 1.146
Avoid integer overflow in kern_malloc(). Reported by Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.143.2.1 -r1.143.2.1.2.1 src/sys/kern/kern_malloc.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_malloc.c
diff -u src/sys/kern/kern_malloc.c:1.143.2.1 src/sys/kern/kern_malloc.c:1.143.2.1.2.1
--- src/sys/kern/kern_malloc.c:1.143.2.1	Wed Mar 25 16:54:37 2015
+++ src/sys/kern/kern_malloc.c	Wed Aug  9 06:31:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_malloc.c,v 1.143.2.1 2015/03/25 16:54:37 snj Exp $	*/
+/*	$NetBSD: kern_malloc.c,v 1.143.2.1.2.1 2017/08/09 06:31:33 snj Exp $	*/
 
 /*
  * Copyright (c) 1987, 1991, 1993
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.143.2.1 2015/03/25 16:54:37 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.143.2.1.2.1 2017/08/09 06:31:33 snj Exp $");
 
 #include 
 #include 
@@ -105,7 +105,10 @@ kern_malloc(unsigned long size, int flag
 	void *p;
 
 	if (size >= PAGE_SIZE) {
-		allocsize = PAGE_SIZE + size; /* for page alignment */
+		if (size > (ULONG_MAX-PAGE_SIZE))
+			allocsize = ULONG_MAX;	/* this will fail later */
+		else
+			allocsize = PAGE_SIZE + size; /* for page alignment */
 		hdroffset = PAGE_SIZE - sizeof(struct malloc_header);
 	} else {
 		allocsize = sizeof(struct malloc_header) + size;



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

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 06:22:07 UTC 2017

Modified Files:
src/sys/dev [netbsd-7]: auconv.c
src/sys/dev/ic [netbsd-7]: ac97.c
src/sys/dev/pci [netbsd-7]: azalia_codec.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #1460):
sys/dev/auconv.c: revision 1.30 via patch
sys/dev/ic/ac97.c: revision 1.97 via patch
sys/dev/pci/azalia_codec.c: revision 1.81 via patch
Mixer device bounds checking.
Analysis by Ilja van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.24.1 src/sys/dev/auconv.c
cvs rdiff -u -r1.95.12.1 -r1.95.12.2 src/sys/dev/ic/ac97.c
cvs rdiff -u -r1.79 -r1.79.24.1 src/sys/dev/pci/azalia_codec.c

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

Modified files:

Index: src/sys/dev/auconv.c
diff -u src/sys/dev/auconv.c:1.25 src/sys/dev/auconv.c:1.25.24.1
--- src/sys/dev/auconv.c:1.25	Wed Nov 23 23:07:31 2011
+++ src/sys/dev/auconv.c	Wed Aug  9 06:22:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: auconv.c,v 1.25 2011/11/23 23:07:31 jmcneill Exp $	*/
+/*	$NetBSD: auconv.c,v 1.25.24.1 2017/08/09 06:22:06 snj Exp $	*/
 
 /*
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.25 2011/11/23 23:07:31 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.25.24.1 2017/08/09 06:22:06 snj Exp $");
 
 #include 
 #include 
@@ -1162,7 +1162,7 @@ int
 auconv_query_encoding(const struct audio_encoding_set *encodings,
 		  audio_encoding_t *aep)
 {
-	if (aep->index >= encodings->size)
+	if (aep->index < 0 || aep->index >= encodings->size)
 		return EINVAL;
 	strlcpy(aep->name, encodings->items[aep->index].name,
 		MAX_AUDIO_DEV_LEN);

Index: src/sys/dev/ic/ac97.c
diff -u src/sys/dev/ic/ac97.c:1.95.12.1 src/sys/dev/ic/ac97.c:1.95.12.2
--- src/sys/dev/ic/ac97.c:1.95.12.1	Sun Jul  5 20:37:01 2015
+++ src/sys/dev/ic/ac97.c	Wed Aug  9 06:22:06 2017
@@ -1,4 +1,4 @@
-/*  $NetBSD: ac97.c,v 1.95.12.1 2015/07/05 20:37:01 snj Exp $ */
+/*  $NetBSD: ac97.c,v 1.95.12.2 2017/08/09 06:22:06 snj Exp $ */
 /*	$OpenBSD: ac97.c,v 1.8 2000/07/19 09:01:35 csapuntz Exp $	*/
 
 /*
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ac97.c,v 1.95.12.1 2015/07/05 20:37:01 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ac97.c,v 1.95.12.2 2017/08/09 06:22:06 snj Exp $");
 
 #include 
 #include 
@@ -1677,7 +1677,7 @@ ac97_query_devinfo(struct ac97_codec_if 
 	const char *name;
 
 	as = (struct ac97_softc *)codec_if;
-	if (dip->index < as->num_source_info) {
+	if (dip->index >= 0 && dip->index < as->num_source_info) {
 		si = >source_info[dip->index];
 		dip->type = si->type;
 		dip->mixer_class = si->mixer_class;

Index: src/sys/dev/pci/azalia_codec.c
diff -u src/sys/dev/pci/azalia_codec.c:1.79 src/sys/dev/pci/azalia_codec.c:1.79.24.1
--- src/sys/dev/pci/azalia_codec.c:1.79	Wed Nov 23 23:07:35 2011
+++ src/sys/dev/pci/azalia_codec.c	Wed Aug  9 06:22:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: azalia_codec.c,v 1.79 2011/11/23 23:07:35 jmcneill Exp $	*/
+/*	$NetBSD: azalia_codec.c,v 1.79.24.1 2017/08/09 06:22:07 snj Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: azalia_codec.c,v 1.79 2011/11/23 23:07:35 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: azalia_codec.c,v 1.79.24.1 2017/08/09 06:22:07 snj Exp $");
 
 #include 
 #include 
@@ -2074,7 +2074,7 @@ generic_set_port(codec_t *this, mixer_ct
 {
 	const mixer_item_t *m;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m = >mixers[mc->dev];
 	if (mc->type != m->devinfo.type)
@@ -2089,7 +2089,7 @@ generic_get_port(codec_t *this, mixer_ct
 {
 	const mixer_item_t *m;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m = >mixers[mc->dev];
 	mc->type = m->devinfo.type;
@@ -2328,7 +2328,7 @@ alc260_set_port(codec_t *this, mixer_ctr
 	uint32_t value;
 	int err;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m = >mixers[mc->dev];
 	if (mc->type != m->devinfo.type)
@@ -2386,7 +2386,7 @@ alc260_get_port(codec_t *this, mixer_ctr
 {
 	const mixer_item_t *m;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m = >mixers[mc->dev];
 	mc->type = m->devinfo.type;
@@ -2895,7 +2895,7 @@ alc882_set_port(codec_t *this, mixer_ctr
 	uint32_t mask, bit;
 	int i, err;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m = >mixers[mc->dev];
 	if (mc->type != m->devinfo.type)
@@ -2929,7 +2929,7 @@ alc882_get_port(codec_t *this, mixer_ctr
 	uint32_t mask, bit, result;
 	int i, err;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m = >mixers[mc->dev];
 	

CVS commit: [netbsd-7-1] src/sys/dev

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 06:21:18 UTC 2017

Modified Files:
src/sys/dev [netbsd-7-1]: auconv.c
src/sys/dev/ic [netbsd-7-1]: ac97.c
src/sys/dev/pci [netbsd-7-1]: azalia_codec.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #1460):
sys/dev/auconv.c: revision 1.30 via patch
sys/dev/ic/ac97.c: revision 1.97 via patch
sys/dev/pci/azalia_codec.c: revision 1.81 via patch
Mixer device bounds checking.
Analysis by Ilja van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.36.1 src/sys/dev/auconv.c
cvs rdiff -u -r1.95.12.1 -r1.95.12.1.6.1 src/sys/dev/ic/ac97.c
cvs rdiff -u -r1.79 -r1.79.36.1 src/sys/dev/pci/azalia_codec.c

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

Modified files:

Index: src/sys/dev/auconv.c
diff -u src/sys/dev/auconv.c:1.25 src/sys/dev/auconv.c:1.25.36.1
--- src/sys/dev/auconv.c:1.25	Wed Nov 23 23:07:31 2011
+++ src/sys/dev/auconv.c	Wed Aug  9 06:21:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: auconv.c,v 1.25 2011/11/23 23:07:31 jmcneill Exp $	*/
+/*	$NetBSD: auconv.c,v 1.25.36.1 2017/08/09 06:21:18 snj Exp $	*/
 
 /*
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.25 2011/11/23 23:07:31 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.25.36.1 2017/08/09 06:21:18 snj Exp $");
 
 #include 
 #include 
@@ -1162,7 +1162,7 @@ int
 auconv_query_encoding(const struct audio_encoding_set *encodings,
 		  audio_encoding_t *aep)
 {
-	if (aep->index >= encodings->size)
+	if (aep->index < 0 || aep->index >= encodings->size)
 		return EINVAL;
 	strlcpy(aep->name, encodings->items[aep->index].name,
 		MAX_AUDIO_DEV_LEN);

Index: src/sys/dev/ic/ac97.c
diff -u src/sys/dev/ic/ac97.c:1.95.12.1 src/sys/dev/ic/ac97.c:1.95.12.1.6.1
--- src/sys/dev/ic/ac97.c:1.95.12.1	Sun Jul  5 20:37:01 2015
+++ src/sys/dev/ic/ac97.c	Wed Aug  9 06:21:18 2017
@@ -1,4 +1,4 @@
-/*  $NetBSD: ac97.c,v 1.95.12.1 2015/07/05 20:37:01 snj Exp $ */
+/*  $NetBSD: ac97.c,v 1.95.12.1.6.1 2017/08/09 06:21:18 snj Exp $ */
 /*	$OpenBSD: ac97.c,v 1.8 2000/07/19 09:01:35 csapuntz Exp $	*/
 
 /*
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ac97.c,v 1.95.12.1 2015/07/05 20:37:01 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ac97.c,v 1.95.12.1.6.1 2017/08/09 06:21:18 snj Exp $");
 
 #include 
 #include 
@@ -1677,7 +1677,7 @@ ac97_query_devinfo(struct ac97_codec_if 
 	const char *name;
 
 	as = (struct ac97_softc *)codec_if;
-	if (dip->index < as->num_source_info) {
+	if (dip->index >= 0 && dip->index < as->num_source_info) {
 		si = >source_info[dip->index];
 		dip->type = si->type;
 		dip->mixer_class = si->mixer_class;

Index: src/sys/dev/pci/azalia_codec.c
diff -u src/sys/dev/pci/azalia_codec.c:1.79 src/sys/dev/pci/azalia_codec.c:1.79.36.1
--- src/sys/dev/pci/azalia_codec.c:1.79	Wed Nov 23 23:07:35 2011
+++ src/sys/dev/pci/azalia_codec.c	Wed Aug  9 06:21:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: azalia_codec.c,v 1.79 2011/11/23 23:07:35 jmcneill Exp $	*/
+/*	$NetBSD: azalia_codec.c,v 1.79.36.1 2017/08/09 06:21:18 snj Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: azalia_codec.c,v 1.79 2011/11/23 23:07:35 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: azalia_codec.c,v 1.79.36.1 2017/08/09 06:21:18 snj Exp $");
 
 #include 
 #include 
@@ -2074,7 +2074,7 @@ generic_set_port(codec_t *this, mixer_ct
 {
 	const mixer_item_t *m;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m = >mixers[mc->dev];
 	if (mc->type != m->devinfo.type)
@@ -2089,7 +2089,7 @@ generic_get_port(codec_t *this, mixer_ct
 {
 	const mixer_item_t *m;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m = >mixers[mc->dev];
 	mc->type = m->devinfo.type;
@@ -2328,7 +2328,7 @@ alc260_set_port(codec_t *this, mixer_ctr
 	uint32_t value;
 	int err;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m = >mixers[mc->dev];
 	if (mc->type != m->devinfo.type)
@@ -2386,7 +2386,7 @@ alc260_get_port(codec_t *this, mixer_ctr
 {
 	const mixer_item_t *m;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m = >mixers[mc->dev];
 	mc->type = m->devinfo.type;
@@ -2895,7 +2895,7 @@ alc882_set_port(codec_t *this, mixer_ctr
 	uint32_t mask, bit;
 	int i, err;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m = >mixers[mc->dev];
 	if (mc->type != m->devinfo.type)
@@ -2929,7 +2929,7 @@ alc882_get_port(codec_t *this, mixer_ctr
 	uint32_t mask, bit, result;
 	int i, err;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m 

CVS commit: [netbsd-7-0] src/sys/dev

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 06:20:10 UTC 2017

Modified Files:
src/sys/dev [netbsd-7-0]: auconv.c
src/sys/dev/ic [netbsd-7-0]: ac97.c
src/sys/dev/pci [netbsd-7-0]: azalia_codec.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #1460):
sys/dev/auconv.c: revision 1.30 via patch
sys/dev/ic/ac97.c: revision 1.97 via patch
sys/dev/pci/azalia_codec.c: revision 1.81 via patch
Mixer device bounds checking.
Analysis by Ilja van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.28.1 src/sys/dev/auconv.c
cvs rdiff -u -r1.95.12.1 -r1.95.12.1.2.1 src/sys/dev/ic/ac97.c
cvs rdiff -u -r1.79 -r1.79.28.1 src/sys/dev/pci/azalia_codec.c

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

Modified files:

Index: src/sys/dev/auconv.c
diff -u src/sys/dev/auconv.c:1.25 src/sys/dev/auconv.c:1.25.28.1
--- src/sys/dev/auconv.c:1.25	Wed Nov 23 23:07:31 2011
+++ src/sys/dev/auconv.c	Wed Aug  9 06:20:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: auconv.c,v 1.25 2011/11/23 23:07:31 jmcneill Exp $	*/
+/*	$NetBSD: auconv.c,v 1.25.28.1 2017/08/09 06:20:10 snj Exp $	*/
 
 /*
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.25 2011/11/23 23:07:31 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.25.28.1 2017/08/09 06:20:10 snj Exp $");
 
 #include 
 #include 
@@ -1162,7 +1162,7 @@ int
 auconv_query_encoding(const struct audio_encoding_set *encodings,
 		  audio_encoding_t *aep)
 {
-	if (aep->index >= encodings->size)
+	if (aep->index < 0 || aep->index >= encodings->size)
 		return EINVAL;
 	strlcpy(aep->name, encodings->items[aep->index].name,
 		MAX_AUDIO_DEV_LEN);

Index: src/sys/dev/ic/ac97.c
diff -u src/sys/dev/ic/ac97.c:1.95.12.1 src/sys/dev/ic/ac97.c:1.95.12.1.2.1
--- src/sys/dev/ic/ac97.c:1.95.12.1	Sun Jul  5 20:37:01 2015
+++ src/sys/dev/ic/ac97.c	Wed Aug  9 06:20:10 2017
@@ -1,4 +1,4 @@
-/*  $NetBSD: ac97.c,v 1.95.12.1 2015/07/05 20:37:01 snj Exp $ */
+/*  $NetBSD: ac97.c,v 1.95.12.1.2.1 2017/08/09 06:20:10 snj Exp $ */
 /*	$OpenBSD: ac97.c,v 1.8 2000/07/19 09:01:35 csapuntz Exp $	*/
 
 /*
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ac97.c,v 1.95.12.1 2015/07/05 20:37:01 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ac97.c,v 1.95.12.1.2.1 2017/08/09 06:20:10 snj Exp $");
 
 #include 
 #include 
@@ -1677,7 +1677,7 @@ ac97_query_devinfo(struct ac97_codec_if 
 	const char *name;
 
 	as = (struct ac97_softc *)codec_if;
-	if (dip->index < as->num_source_info) {
+	if (dip->index >= 0 && dip->index < as->num_source_info) {
 		si = >source_info[dip->index];
 		dip->type = si->type;
 		dip->mixer_class = si->mixer_class;

Index: src/sys/dev/pci/azalia_codec.c
diff -u src/sys/dev/pci/azalia_codec.c:1.79 src/sys/dev/pci/azalia_codec.c:1.79.28.1
--- src/sys/dev/pci/azalia_codec.c:1.79	Wed Nov 23 23:07:35 2011
+++ src/sys/dev/pci/azalia_codec.c	Wed Aug  9 06:20:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: azalia_codec.c,v 1.79 2011/11/23 23:07:35 jmcneill Exp $	*/
+/*	$NetBSD: azalia_codec.c,v 1.79.28.1 2017/08/09 06:20:10 snj Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: azalia_codec.c,v 1.79 2011/11/23 23:07:35 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: azalia_codec.c,v 1.79.28.1 2017/08/09 06:20:10 snj Exp $");
 
 #include 
 #include 
@@ -2074,7 +2074,7 @@ generic_set_port(codec_t *this, mixer_ct
 {
 	const mixer_item_t *m;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m = >mixers[mc->dev];
 	if (mc->type != m->devinfo.type)
@@ -2089,7 +2089,7 @@ generic_get_port(codec_t *this, mixer_ct
 {
 	const mixer_item_t *m;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m = >mixers[mc->dev];
 	mc->type = m->devinfo.type;
@@ -2328,7 +2328,7 @@ alc260_set_port(codec_t *this, mixer_ctr
 	uint32_t value;
 	int err;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m = >mixers[mc->dev];
 	if (mc->type != m->devinfo.type)
@@ -2386,7 +2386,7 @@ alc260_get_port(codec_t *this, mixer_ctr
 {
 	const mixer_item_t *m;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m = >mixers[mc->dev];
 	mc->type = m->devinfo.type;
@@ -2895,7 +2895,7 @@ alc882_set_port(codec_t *this, mixer_ctr
 	uint32_t mask, bit;
 	int i, err;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m = >mixers[mc->dev];
 	if (mc->type != m->devinfo.type)
@@ -2929,7 +2929,7 @@ alc882_get_port(codec_t *this, mixer_ctr
 	uint32_t mask, bit, result;
 	int i, err;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m 

CVS commit: src/tests/net/if_vlan

2017-08-09 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Aug  9 06:19:56 UTC 2017

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
Add counter check to vlan(4) ATF. Implemented by s-yamaguchi@IIJ, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/if_vlan/t_vlan.sh

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

Modified files:

Index: src/tests/net/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.2 src/tests/net/if_vlan/t_vlan.sh:1.3
--- src/tests/net/if_vlan/t_vlan.sh:1.2	Wed Jun 14 02:32:29 2017
+++ src/tests/net/if_vlan/t_vlan.sh	Wed Aug  9 06:19:56 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.2 2017/06/14 02:32:29 ozaki-r Exp $
+#	$NetBSD: t_vlan.sh,v 1.3 2017/08/09 06:19:56 knakahara Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -182,6 +182,20 @@ vlan_basic_body_common()
 
 	extract_new_packets $BUS > $outfile
 	atf_check -s exit:0 -o match:'vlan 20' cat $outfile
+
+	export RUMP_SERVER=$SOCK_LOCAL
+	atf_check -s exit:0 rump.ifconfig vlan0 -vlanif
+	atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0
+	atf_check -s exit:0 rump.ifconfig vlan0 $af $local0/$prefix
+	atf_check -s exit:0 rump.ifconfig vlan0 up
+	atf_check -s exit:0 rump.ifconfig -w 10
+
+	atf_check -s exit:0 -o ignore rump.ifconfig -z vlan0
+	atf_check -s exit:0 -o ignore $ping_cmd $remote0
+	rump.ifconfig -v vlan0 > $outfile
+
+	atf_check -s exit:0 -o not-match:' 0 packets' cat $outfile
+	atf_check -s exit:0 -o not-match:' 0 bytes' cat $outfile
 }
 
 atf_test_case vlan_basic cleanup



CVS commit: src/sys/net

2017-08-09 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Aug  9 06:17:23 UTC 2017

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

Log Message:
Fix vlan(4) obytes counter. Implemented by s-yamaguchi@IIJ, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/net/if_vlan.c

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

Modified files:

Index: src/sys/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.98 src/sys/net/if_vlan.c:1.99
--- src/sys/net/if_vlan.c:1.98	Wed Jun  7 03:53:11 2017
+++ src/sys/net/if_vlan.c	Wed Aug  9 06:17:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.98 2017/06/07 03:53:11 knakahara Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.99 2017/08/09 06:17:23 knakahara Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.98 2017/06/07 03:53:11 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.99 2017/08/09 06:17:23 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1342,6 +1342,8 @@ vlan_transmit(struct ifnet *ifp, struct 
 	struct ifvlan_linkmib *mib;
 	struct psref psref;
 	int error;
+	size_t pktlen = m->m_pkthdr.len;
+	bool mcast = (m->m_flags & M_MCAST) != 0;
 
 	mib = vlan_getref_linkmib(ifv, );
 	if (mib == NULL) {
@@ -1451,10 +1453,11 @@ vlan_transmit(struct ifnet *ifp, struct 
 		/* mbuf is already freed */
 		ifp->if_oerrors++;
 	} else {
+
 		ifp->if_opackets++;
-		/*
-		 * obytes is incremented at ether_output() or bridge_enqueue().
-		 */
+		ifp->if_obytes += pktlen;
+		if (mcast)
+			ifp->if_omcasts++;
 	}
 
 out:



CVS commit: [netbsd-8] src/doc

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 06:10:08 UTC 2017

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

Log Message:
tickets 192-204


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

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

Modified files:

Index: src/doc/CHANGES-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.36 src/doc/CHANGES-8.0:1.1.2.37
--- src/doc/CHANGES-8.0:1.1.2.36	Tue Aug  8 16:24:03 2017
+++ src/doc/CHANGES-8.0	Wed Aug  9 06:10:08 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.36 2017/08/08 16:24:03 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.37 2017/08/09 06:10:08 snj Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -5123,3 +5123,105 @@ sys/compat/ibcs2/ibcs2_stat.c			1.49-1.5
 	ibcs2_sys_statvfs()
 	[spz, ticket #191]
 
+sys/kern/vfs_getcwd.c1.52
+
+	Out of bound read in getcwd_scandir()
+	[spz, ticket #192]
+
+sys/compat/common/vfs_syscalls_12.c		1.34
+sys/compat/common/vfs_syscalls_43.c		1.60
+sys/compat/ibcs2/ibcs2_misc.c			1.114
+sys/compat/linux/common/linux_file64.c		1.59
+sys/compat/linux/common/linux_misc.c		1.239
+sys/compat/linux32/common/linux32_dirent.c	1.18
+sys/compat/osf1/osf1_file.c			1.44
+sys/compat/sunos/sunos_misc.c			1.171
+sys/compat/sunos32/sunos32_misc.c		1.78
+sys/compat/svr4/svr4_misc.c			1.158
+sys/compat/svr4_32/svr4_32_misc.c		1.78
+sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c 1.2
+
+	puffs userland can trigger panic in compat getdents
+	[spz, ticket #193]
+
+sys/kern/kern_ktrace.c1.171
+
+	info leak in ktruser() if copyin fails.
+	[spz, ticket #194]
+
+sys/dev/ic/isp_netbsd.c1.89
+
+	Unvalidated channel index in ISP_FC_GETDLIST case of ispioctl()
+	can cause out of bound read.
+	[spz, ticket #195]
+
+sys/dev/ic/ciss.c1.37
+
+	Out of bound read in ciss_ioctl_vol(). Signedness bug in
+	ciss_ioctl().
+	[spz, ticket #196]
+
+sys/netsmb/smb_dev.c1.50
+sys/netsmb/smb_subr.c1.38
+sys/netsmb/smb_subr.h1.22
+sys/netsmb/smb_usr.c1.17-1.19
+
+	netsmb:
+	- no length validation in smb_usr_vc2spec() can cause out
+	  of bound read.
+	- signedness bug in smb_usr_t2request() can cause out of
+	  bound read
+	[spz, ticket #197]
+
+sys/altq/altq_cbq.c1.31
+sys/altq/altq_hfsc.c1.27
+sys/altq/altq_jobs.c1.11
+sys/altq/altq_priq.c1.24
+sys/altq/altq_wfq.c1.22
+
+	ALTQ:
+	- info leak in get_class_stats()
+	- signedness bug in wfq_getstats()
+	[spz, ticket #198]
+
+bin/sh/input.c	1.61
+bin/sh/parser.c	1.143
+
+	PR bin/52458:
+	Fix sh history when PS1 contains \n
+	Correctly save empty lines in a multi-line command.
+	[kre, ticket #199]
+
+sys/arch/arm/sunxi/files.sunxi			1.15-1.16
+sys/arch/arm/sunxi/sun6i_dma.c			1.1-1.2
+sys/arch/arm/sunxi/sun8i_h3_ccu.c		1.9-1.10
+sys/arch/arm/sunxi/sun8i_h3_codec.c		1.1-1.2
+sys/arch/arm/sunxi/sunxi_ccu.h			1.8
+sys/arch/arm/sunxi/sunxi_ccu_nkmp.c		1.5
+sys/arch/arm/sunxi/sunxi_codec.c		1.1
+sys/arch/arm/sunxi/sunxi_codec.h		1.1
+sys/arch/evbarm/conf/SUNXI			1.20-1.21
+
+	Add Allwinner H3 analog audio support.
+	[jmcneill, ticket #200]
+
+sys/net/if_gif.c1.128
+
+	gif(4): fix leak when encap_attach() fails twice.
+	[knakahara, ticket #201]
+
+sys/dev/hpc/hpckbd.c1.32
+
+	hpcsh: unbreak wscons console after ticket #61.
+	[uwe, ticket #202]
+
+sys/arch/hpcsh/dev/pfckbd.c			1.30
+
+	Make early ddb work with wscons console again.
+	[uwe, ticket #203]
+
+lib/libc/Makefile.inpatch
+
+	Don't define _DIAGNOSTIC in libc.
+	[mrg, ticket #204]
+



CVS commit: src/sys/netipsec

2017-08-09 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Aug  9 06:04:41 UTC 2017

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

Log Message:
Fix that prev isn't cleared on retry


To generate a diff of this commit:
cvs rdiff -u -r1.220 -r1.221 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.220 src/sys/netipsec/key.c:1.221
--- src/sys/netipsec/key.c:1.220	Wed Aug  9 04:29:36 2017
+++ src/sys/netipsec/key.c	Wed Aug  9 06:04:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.220 2017/08/09 04:29:36 ozaki-r Exp $	*/
+/*	$NetBSD: key.c,v 1.221 2017/08/09 06:04:41 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.220 2017/08/09 04:29:36 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.221 2017/08/09 06:04:41 ozaki-r Exp $");
 
 /*
  * This code is referd to RFC 2367
@@ -6670,10 +6670,11 @@ static struct mbuf *key_acquire_mbuf_hea
 static void
 key_acquire_sendup_pending_mbuf(void)
 {
-	struct mbuf *m, *prev = NULL;
+	struct mbuf *m, *prev;
 	int error;
 
 again:
+	prev = NULL;
 	mutex_enter(_misc.lock);
 	m = key_acquire_mbuf_head;
 	/* Get an earliest mbuf (one at the tail of the list) */



CVS commit: [netbsd-8] src/lib/libc

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 06:03:47 UTC 2017

Modified Files:
src/lib/libc [netbsd-8]: Makefile.inc

Log Message:
Apply patch (requested by mrg in ticket #204):
Don't define _DIAGNOSTIC in libc.  When this was introduced in revision
1.9, it was intended to be turned off for release branches.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.18.8.1 src/lib/libc/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/lib/libc/Makefile.inc
diff -u src/lib/libc/Makefile.inc:1.18 src/lib/libc/Makefile.inc:1.18.8.1
--- src/lib/libc/Makefile.inc:1.18	Fri Aug 28 11:45:02 2015
+++ src/lib/libc/Makefile.inc	Wed Aug  9 06:03:47 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.18 2015/08/28 11:45:02 joerg Exp $
+#	$NetBSD: Makefile.inc,v 1.18.8.1 2017/08/09 06:03:47 snj Exp $
 #	@(#)Makefile	8.2 (Berkeley) 2/3/94
 #
 # All library objects contain sccsid strings by default; they may be
@@ -29,7 +29,7 @@ RUMPRUN?=	no
 
 WARNS=5
 CPPFLAGS+=	-D_LIBC -DLIBC_SCCS -DSYSLIBC_SCCS -D_REENTRANT
-CPPFLAGS+=	-D_DIAGNOSTIC
+#CPPFLAGS+=	-D_DIAGNOSTIC
 .if defined(MLIBDIR)
 CPPFLAGS+=	-DMLIBDIR=\"${MLIBDIR}\"
 .endif



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

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 06:00:11 UTC 2017

Modified Files:
src/sys/arch/hpcsh/dev [netbsd-8]: pfckbd.c

Log Message:
Pull up following revision(s) (requested by uwe in ticket #203):
sys/arch/hpcsh/dev/pfckbd.c: revision 1.30
Don't reschedule the callout in the scanning function itself, as that
conflicts with using the same function for polled console.
Makes early ddb work with wscons console again on my Jornada 690.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.40.1 src/sys/arch/hpcsh/dev/pfckbd.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/hpcsh/dev/pfckbd.c
diff -u src/sys/arch/hpcsh/dev/pfckbd.c:1.29 src/sys/arch/hpcsh/dev/pfckbd.c:1.29.40.1
--- src/sys/arch/hpcsh/dev/pfckbd.c:1.29	Sun Feb 12 16:34:08 2012
+++ src/sys/arch/hpcsh/dev/pfckbd.c	Wed Aug  9 06:00:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pfckbd.c,v 1.29 2012/02/12 16:34:08 matt Exp $	*/
+/*	$NetBSD: pfckbd.c,v 1.29.40.1 2017/08/09 06:00:11 snj Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  * currently, HP Jornada 680/690, HITACHI PERSONA HPW-50PAD only.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pfckbd.c,v 1.29 2012/02/12 16:34:08 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pfckbd.c,v 1.29.40.1 2017/08/09 06:00:11 snj Exp $");
 
 #include "debug_hpcsh.h"
 
@@ -66,7 +66,7 @@ static struct pfckbd_core {
 	struct hpckbd_ic_if pc_if;
 	struct hpckbd_if *pc_hpckbd;
 	uint16_t pc_column[8];
-	void (*pc_callout)(void *);
+	void (*pc_callout)(struct pfckbd_core *);
 } pfckbd_core;
 
 static int pfckbd_match(device_t, cfdata_t, void *);
@@ -83,17 +83,17 @@ static int pfckbd_poll(void *);
 
 static void pfckbd_input(struct pfckbd_core *, int, uint16_t);
 
-static void (*pfckbd_callout_lookup(void))(void *);
-static void pfckbd_callout_unknown(void *);
-static void pfckbd_callout_hp(void *);
-static void pfckbd_callout_hitachi(void *);
+static void (*pfckbd_callout_lookup(void))(struct pfckbd_core *);
+static void pfckbd_callout(void *);
+static void pfckbd_callout_hp(struct pfckbd_core *);
+static void pfckbd_callout_hitachi(struct pfckbd_core *);
 void pfckbd_poll_hitachi_power(void);
 
 
 /* callout function table. this function is platfrom specific. */
 static const struct {
 	platid_mask_t *platform;
-	void (*func)(void *);
+	void (*func)(struct pfckbd_core *);
 } pfckbd_calloutfunc_table[] = {
 	{ _mask_MACH_HP		, pfckbd_callout_hp },
 	{ _mask_MACH_HITACHI	, pfckbd_callout_hitachi }
@@ -144,9 +144,13 @@ pfckbd_attach(device_t parent, device_t 
 	config_found(self, , hpckbd_print);
 
 	/* install callout handler */
-	callout_init(_core.pc_soft_ch, 0);
-	callout_reset(_core.pc_soft_ch, 1,
-		  pfckbd_core.pc_callout, _core);
+	if (pfckbd_core.pc_callout != NULL) {
+		callout_init(_core.pc_soft_ch, 0);
+		callout_reset(_core.pc_soft_ch, 1,
+			  pfckbd_callout, _core);
+	}
+	else
+		aprint_error_dev(self, "unsupported platform\n");
 
 	if (!pmf_device_register(self, NULL, NULL))
 		aprint_error_dev(self, "unable to establish power handler\n");
@@ -191,12 +195,22 @@ pfckbd_poll(void *ic)
 {
 	struct pfckbd_core *pc = ic;
 
-	if (pc->pc_enabled)
+	if (pc->pc_enabled && pc->pc_callout != NULL)
 		(*pc->pc_callout)(pc);
 
 	return 0;
 }
 
+static void
+pfckbd_callout(void *arg)
+{
+	struct pfckbd_core *pc = arg;
+
+	(*pc->pc_callout)(pc);
+	callout_schedule(>pc_soft_ch, 1);
+}
+
+
 /*
  * Called by platform specific scan routines to report key events to hpckbd
  */
@@ -230,7 +244,7 @@ pfckbd_input(struct pfckbd_core *pc, int
 
 /* Look up appropriate callback handler */
 static void
-(*pfckbd_callout_lookup(void))(void *)
+(*pfckbd_callout_lookup(void))(struct pfckbd_core *)
 {
 	int i, n;
 
@@ -242,22 +256,14 @@ static void
  pfckbd_calloutfunc_table[i].platform))
 			return pfckbd_calloutfunc_table[i].func;
 
-	return pfckbd_callout_unknown;
-}
-
-/* Placeholder for unknown platform */
-static void
-pfckbd_callout_unknown(void *arg)
-{
-
-	printf("%s: unknown keyboard switch\n", __func__);
+	return NULL;
 }
 
 /*
  * HP Jornada680/690, HP620LX
  */
 static void
-pfckbd_callout_hp(void *arg)
+pfckbd_callout_hp(struct pfckbd_core *pc)
 {
 #define PFCKBD_HP_PDCR_MASK 0xcc0c
 #define PFCKBD_HP_PECR_MASK 0xf0cf
@@ -288,13 +294,12 @@ pfckbd_callout_hp(void *arg)
 #undef PD
 #undef PE
 
-	struct pfckbd_core *pc = arg;
 	uint16_t dc, ec;
 	int column;
 	uint16_t data;
 
 	if (!pc->pc_enabled)
-		goto reinstall;
+		return;
 
 	/* bits in D/E control regs we do not touch (XXX: can they change?) */
 	dc = _reg_read_2(SH7709_PDCR) & ~PFCKBD_HP_PDCR_MASK;
@@ -330,16 +335,13 @@ pfckbd_callout_hp(void *arg)
 	/* (ignore) extra keys/events (recorder buttons, lid, cable ) */
 	data = _reg_read_1(SH7709_PGDR) | (_reg_read_1(SH7709_PHDR) << 8);
 #endif
-
- reinstall:
-	callout_schedule(>pc_soft_ch, 1);
 }
 
 /*
  * HITACH PERSONA