CVS commit: src/sys/dev/usb

2020-05-01 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat May  2 00:50:07 UTC 2020

Modified Files:
src/sys/dev/usb: if_urtwn.c

Log Message:
don't forget to destroy the new sc_media_mtx mutex.

now re-plugging and re-using the same softc doesn't give mutex
already initialised error.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/dev/usb/if_urtwn.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_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.86 src/sys/dev/usb/if_urtwn.c:1.87
--- src/sys/dev/usb/if_urtwn.c:1.86	Thu Apr 16 17:18:27 2020
+++ src/sys/dev/usb/if_urtwn.c	Sat May  2 00:50:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.86 2020/04/16 17:18:27 nat Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.87 2020/05/02 00:50:07 mrg Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.86 2020/04/16 17:18:27 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.87 2020/05/02 00:50:07 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -584,6 +584,8 @@ urtwn_detach(device_t self, int flags)
 		ieee80211_ifdetach(>sc_ic);
 		if_detach(ifp);
 
+		mutex_destroy(>sc_media_mtx);
+
 		/* Close Tx/Rx pipes.  Abort done by urtwn_stop. */
 		urtwn_close_pipes(sc);
 	}



CVS commit: src/sys/net

2020-05-01 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri May  1 22:27:42 UTC 2020

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

Log Message:
report no enabled capabilities when no interface is part of bridge


To generate a diff of this commit:
cvs rdiff -u -r1.172 -r1.173 src/sys/net/if_bridge.c

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

Modified files:

Index: src/sys/net/if_bridge.c
diff -u src/sys/net/if_bridge.c:1.172 src/sys/net/if_bridge.c:1.173
--- src/sys/net/if_bridge.c:1.172	Thu Apr 30 10:04:54 2020
+++ src/sys/net/if_bridge.c	Fri May  1 22:27:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.172 2020/04/30 10:04:54 jdolecek Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.173 2020/05/01 22:27:42 jdolecek Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.172 2020/04/30 10:04:54 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.173 2020/05/01 22:27:42 jdolecek Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -787,7 +787,7 @@ void
 bridge_calc_csum_flags(struct bridge_softc *sc)
 {
 	struct bridge_iflist *bif;
-	struct ifnet *ifs;
+	struct ifnet *ifs = NULL;
 	int flags = ~0;
 	int capenable = ~0;
 
@@ -798,7 +798,7 @@ bridge_calc_csum_flags(struct bridge_sof
 		capenable &= ifs->if_capenable;
 	}
 	sc->sc_csum_flags_tx = flags;
-	sc->sc_capenable = capenable;
+	sc->sc_capenable = (ifs != NULL) ? capenable : 0;
 	BRIDGE_UNLOCK(sc);
 }
 



CVS commit: src/etc/mtree

2020-05-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  1 22:26:11 UTC 2020

Modified Files:
src/etc/mtree: NetBSD.dist.base

Log Message:
Add a place for the debug modules.


To generate a diff of this commit:
cvs rdiff -u -r1.213 -r1.214 src/etc/mtree/NetBSD.dist.base

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

Modified files:

Index: src/etc/mtree/NetBSD.dist.base
diff -u src/etc/mtree/NetBSD.dist.base:1.213 src/etc/mtree/NetBSD.dist.base:1.214
--- src/etc/mtree/NetBSD.dist.base:1.213	Thu Apr  2 08:58:49 2020
+++ src/etc/mtree/NetBSD.dist.base	Fri May  1 18:26:11 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.base,v 1.213 2020/04/02 12:58:49 roy Exp $
+#	$NetBSD: NetBSD.dist.base,v 1.214 2020/05/01 22:26:11 christos Exp $
 #	@(#)4.4BSD.dist	8.1 (Berkeley) 6/13/93
 
 # Do not customize this file as it may be overwritten on upgrades.
@@ -280,6 +280,7 @@
 ./usr/libdata/debug/lib/npf
 ./usr/libdata/debug/libexec
 ./usr/libdata/debug/sbin
+./usr/libdata/debug/stand
 ./usr/libdata/debug/usr
 ./usr/libdata/debug/usr/bin
 ./usr/libdata/debug/usr/games



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

2020-05-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  1 22:25:19 UTC 2020

Modified Files:
src/distrib/sets/lists/base: mi

Log Message:
/usr/libdata/debug/stand is where the debug modules go


To generate a diff of this commit:
cvs rdiff -u -r1.1241 -r1.1242 src/distrib/sets/lists/base/mi

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

Modified files:

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1241 src/distrib/sets/lists/base/mi:1.1242
--- src/distrib/sets/lists/base/mi:1.1241	Sat Apr 25 08:18:47 2020
+++ src/distrib/sets/lists/base/mi	Fri May  1 18:25:18 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1241 2020/04/25 12:18:47 kre Exp $
+# $NetBSD: mi,v 1.1242 2020/05/01 22:25:18 christos Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -1370,6 +1370,7 @@
 ./usr/libdata/debug/lib/npf			base-sys-usr		compatfile
 ./usr/libdata/debug/libexec			base-sys-usr
 ./usr/libdata/debug/sbin			base-sys-usr
+./usr/libdata/debug/stand			base-sys-usr
 ./usr/libdata/debug/usrbase-sys-usr
 ./usr/libdata/debug/usr/bin			base-sys-usr
 ./usr/libdata/debug/usr/games			base-sys-usr



CVS commit: src/tests/modules

2020-05-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  1 22:24:19 UTC 2020

Modified Files:
src/tests/modules/k_helper: Makefile
src/tests/modules/k_helper2: Makefile
src/tests/modules/k_uvm: Makefile
src/tests/modules/threadpool_tester: Makefile
src/tests/modules/ufetchstore: Makefile
src/tests/modules/x86_pte_tester: Makefile

Log Message:
KMODULEDIR is no longer absolute (${DESTDIR} is added to it by the system
makefile because we need to install the module in two places the debug part
and the regular part)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/modules/k_helper/Makefile
cvs rdiff -u -r1.1 -r1.2 src/tests/modules/k_helper2/Makefile
cvs rdiff -u -r1.1 -r1.2 src/tests/modules/k_uvm/Makefile
cvs rdiff -u -r1.1 -r1.2 src/tests/modules/threadpool_tester/Makefile
cvs rdiff -u -r1.3 -r1.4 src/tests/modules/ufetchstore/Makefile
cvs rdiff -u -r1.1 -r1.2 src/tests/modules/x86_pte_tester/Makefile

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

Modified files:

Index: src/tests/modules/k_helper/Makefile
diff -u src/tests/modules/k_helper/Makefile:1.5 src/tests/modules/k_helper/Makefile:1.6
--- src/tests/modules/k_helper/Makefile:1.5	Tue Jul 13 17:13:28 2010
+++ src/tests/modules/k_helper/Makefile	Fri May  1 18:24:18 2020
@@ -1,9 +1,9 @@
-#	$NetBSD: Makefile,v 1.5 2010/07/13 21:13:28 jmmv Exp $
+#	$NetBSD: Makefile,v 1.6 2020/05/01 22:24:18 christos Exp $
 
 .include 
 
 KMOD=   	k_helper
-KMODULEDIR=	${DESTDIR}/${TESTSBASE}/modules/${KMOD}
+KMODULEDIR=	${TESTSBASE}/modules/${KMOD}
 
 SRCS=   	k_helper.c
 

Index: src/tests/modules/k_helper2/Makefile
diff -u src/tests/modules/k_helper2/Makefile:1.1 src/tests/modules/k_helper2/Makefile:1.2
--- src/tests/modules/k_helper2/Makefile:1.1	Sat Aug 21 09:21:48 2010
+++ src/tests/modules/k_helper2/Makefile	Fri May  1 18:24:18 2020
@@ -1,9 +1,9 @@
-#	$NetBSD: Makefile,v 1.1 2010/08/21 13:21:48 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.2 2020/05/01 22:24:18 christos Exp $
 
 .include 
 
 KMOD=   	k_helper2
-KMODULEDIR=	${DESTDIR}/${TESTSBASE}/modules/${KMOD}
+KMODULEDIR=	${TESTSBASE}/modules/${KMOD}
 
 SRCS=   	k_helper2.c
 

Index: src/tests/modules/k_uvm/Makefile
diff -u src/tests/modules/k_uvm/Makefile:1.1 src/tests/modules/k_uvm/Makefile:1.2
--- src/tests/modules/k_uvm/Makefile:1.1	Fri Feb 17 17:36:50 2012
+++ src/tests/modules/k_uvm/Makefile	Fri May  1 18:24:19 2020
@@ -1,9 +1,9 @@
-#	$NetBSD: Makefile,v 1.1 2012/02/17 22:36:50 jmmv Exp $
+#	$NetBSD: Makefile,v 1.2 2020/05/01 22:24:19 christos Exp $
 
 .include 
 
 KMOD=   	k_uvm
-KMODULEDIR=	${DESTDIR}/${TESTSBASE}/modules/${KMOD}
+KMODULEDIR=	${TESTSBASE}/modules/${KMOD}
 
 SRCS=   	k_uvm.c
 

Index: src/tests/modules/threadpool_tester/Makefile
diff -u src/tests/modules/threadpool_tester/Makefile:1.1 src/tests/modules/threadpool_tester/Makefile:1.2
--- src/tests/modules/threadpool_tester/Makefile:1.1	Fri Jan 25 13:33:59 2019
+++ src/tests/modules/threadpool_tester/Makefile	Fri May  1 18:24:19 2020
@@ -1,9 +1,9 @@
-#	$NetBSD: Makefile,v 1.1 2019/01/25 18:33:59 christos Exp $
+#	$NetBSD: Makefile,v 1.2 2020/05/01 22:24:19 christos Exp $
 
 .include 
 
 KMOD=		threadpool_tester
-KMODULEDIR=	${DESTDIR}/${TESTSBASE}/modules/${KMOD}
+KMODULEDIR=	${TESTSBASE}/modules/${KMOD}
 
 SRCS=		threadpool_tester.c
 

Index: src/tests/modules/ufetchstore/Makefile
diff -u src/tests/modules/ufetchstore/Makefile:1.3 src/tests/modules/ufetchstore/Makefile:1.4
--- src/tests/modules/ufetchstore/Makefile:1.3	Mon Apr 15 19:41:23 2019
+++ src/tests/modules/ufetchstore/Makefile	Fri May  1 18:24:19 2020
@@ -1,9 +1,9 @@
-#	$NetBSD: Makefile,v 1.3 2019/04/15 23:41:23 christos Exp $
+#	$NetBSD: Makefile,v 1.4 2020/05/01 22:24:19 christos Exp $
 
 .include 
 
 KMOD=		ufetchstore_tester
-KMODULEDIR=	${DESTDIR}/${TESTSBASE}/modules/${KMOD}
+KMODULEDIR=	${TESTSBASE}/modules/${KMOD}
 
 SRCS=		ufetchstore_tester.c
 

Index: src/tests/modules/x86_pte_tester/Makefile
diff -u src/tests/modules/x86_pte_tester/Makefile:1.1 src/tests/modules/x86_pte_tester/Makefile:1.2
--- src/tests/modules/x86_pte_tester/Makefile:1.1	Sun Apr 26 05:08:41 2020
+++ src/tests/modules/x86_pte_tester/Makefile	Fri May  1 18:24:19 2020
@@ -1,9 +1,9 @@
-#	$NetBSD: Makefile,v 1.1 2020/04/26 09:08:41 maxv Exp $
+#	$NetBSD: Makefile,v 1.2 2020/05/01 22:24:19 christos Exp $
 
 .include 
 
 KMOD=		x86_pte_tester
-KMODULEDIR=	${DESTDIR}/${TESTSBASE}/modules/${KMOD}
+KMODULEDIR=	${TESTSBASE}/modules/${KMOD}
 
 SRCS=		x86_pte_tester.c
 



CVS commit: src/share/mk

2020-05-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  1 22:23:00 UTC 2020

Modified Files:
src/share/mk: bsd.kmodule.mk

Log Message:
Install .kmod.debug files for kernel crash debugging.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/share/mk/bsd.kmodule.mk

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

Modified files:

Index: src/share/mk/bsd.kmodule.mk
diff -u src/share/mk/bsd.kmodule.mk:1.65 src/share/mk/bsd.kmodule.mk:1.66
--- src/share/mk/bsd.kmodule.mk:1.65	Sat Apr  4 19:19:08 2020
+++ src/share/mk/bsd.kmodule.mk	Fri May  1 18:23:00 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.kmodule.mk,v 1.65 2020/04/04 23:19:08 christos Exp $
+#	$NetBSD: bsd.kmodule.mk,v 1.66 2020/05/01 22:23:00 christos Exp $
 
 # We are not building this with PIE
 MKPIE=no
@@ -12,9 +12,9 @@ CFLAGS+=	-g
 CTFFLAGS=	-L VERSION
 CTFMFLAGS=	-t -L VERSION
 # Keep symbols if built with "-g"
-.if !empty(COPTS:M*-g*)
-CTFFLAGS+=	-g
-CTFMFLAGS+=	-g
+.if !empty(COPTS:M*-g*) || ${MKDEBUG:Uno} == "yes"
+CTFFLAGS+= -g
+CTFMFLAGS+=-g
 .endif
 .endif
 
@@ -108,6 +108,10 @@ KMODSCRIPT=	${KMODSCRIPTSRC}
 .endif
 
 PROG?=		${KMOD}.kmod
+.if ${MKDEBUG:Uno} != "no" && !defined(NODEBUG) && !commands(${PROG}) && \
+empty(SRCS:M*.sh)
+PROGDEBUG:=  ${PROG}.debug
+.endif  
 
 # Build rules
 realall:	${PROG}
@@ -169,55 +173,76 @@ ${PROG}: ${OBJS} ${DPADD} ${KMODSCRIPT}
 	${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS}
 .endif
 
+.if defined(PROGDEBUG)
+${PROGDEBUG}: ${PROG}
+	${_MKTARGET_CREATE}
+	(  ${OBJCOPY} --only-keep-debug ${PROG} ${PROGDEBUG} \
+	&& ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \
+		--add-gnu-debuglink=${PROGDEBUG} ${PROG} \
+	) || (rm -f ${PROGDEBUG}; false)
+.endif
+
 # Install rules
 .if !target(kmodinstall)
 .if !defined(KMODULEDIR)
 .if ${KERNEL_DIR:Uno} == "yes"
-KMODULEDIR=	${DESTDIR}/netbsd/modules/${KMOD}
-_INST_DIRS=	${DESTDIR}/netbsd
-_INST_DIRS+=	${DESTDIR}/netbsd/modules
-_INST_DIRS+=	${DESTDIR}/netbsd/modules/${KMOD}
+_INST_DIRS=	/netbsd
+_INST_DIRS+=	/netbsd/modules
+KMODULEDIR=	/netbsd/modules/${KMOD}
 .else
 # Ensure these are recorded properly in METALOG on unprived installes:
 _OSRELEASE!=	${HOST_SH} $S/conf/osrelease.sh -k
 KMODULEARCHDIR?= ${MACHINE}
-_INST_DIRS=	${DESTDIR}/stand/${KMODULEARCHDIR}
-_INST_DIRS+=	${DESTDIR}/stand/${KMODULEARCHDIR}/${_OSRELEASE}
-_INST_DIRS+=	${DESTDIR}/stand/${KMODULEARCHDIR}/${_OSRELEASE}/modules
-KMODULEDIR=	${DESTDIR}/stand/${KMODULEARCHDIR}/${_OSRELEASE}/modules/${KMOD}
+_INST_DIRS=	/stand/${KMODULEARCHDIR}
+_INST_DIRS+=	/stand/${KMODULEARCHDIR}/${_OSRELEASE}
+_INST_DIRS+=	/stand/${KMODULEARCHDIR}/${_OSRELEASE}/modules
+KMODULEDIR=	/stand/${KMODULEARCHDIR}/${_OSRELEASE}/modules/${KMOD}
 .endif
 .endif
-_PROG:=		${KMODULEDIR}/${PROG} # installed path
 
+_INST_DIRS+=	${KMODULEDIR}
+_PROG:=		${DESTDIR}${KMODULEDIR}/${PROG} # installed path
+
+.if defined(PROGDEBUG)
+.for i in ${_INST_DIRS}
+_DEBUG_INST_DIRS += ${DEBUGDIR}${i}
+.endfor
+_INST_DIRS += ${_DEBUG_INST_DIRS}
+_PROGDEBUG:=	${DESTDIR}${DEBUGDIR}${KMODULEDIR}/${PROG}.debug
+.endif
+
+.for _P P in ${_PROG} ${PROG} ${_PROGDEBUG} ${PROGDEBUG}
 .if ${MKUPDATE} == "no"
-${_PROG}! ${PROG}	# install rule
-.if !defined(BUILD) && !make(all) && !make(${PROG})
-${_PROG}!	.MADE	# no build at install
+${_P}! ${P}	# install rule
+.if !defined(BUILD) && !make(all) && !make(${P})
+${_P}!	.MADE	# no build at install
 .endif
 .else
-${_PROG}: ${PROG}	# install rule
-.if !defined(BUILD) && !make(all) && !make(${PROG})
-${_PROG}:	.MADE	# no build at install
+${_P}: ${P}	# install rule
+.if !defined(BUILD) && !make(all) && !make(${P})
+${_P}:	.MADE	# no build at install
 .endif
 .endif
 	${_MKTARGET_INSTALL}
 	dirs=${_INST_DIRS:Q}; \
 	for d in $$dirs; do \
-		${INSTALL_DIR} $$d; \
+		${INSTALL_DIR} ${DESTDIR}$$d; \
 	done
-	${INSTALL_DIR} ${KMODULEDIR}
 	${INSTALL_FILE} -o ${KMODULEOWN} -g ${KMODULEGRP} -m ${KMODULEMODE} \
 		${.ALLSRC} ${.TARGET}
 
-kmodinstall::	${_PROG}
+kmodinstall::	${_P}
 .PHONY:		kmodinstall
-.PRECIOUS:	${_PROG}# keep if install fails
+.PRECIOUS:	${_P}# keep if install fails
+.endfor
 
-.undef _PROG
+.undef _PPROG
+.undef _PPROGDEBUG
 .endif # !target(kmodinstall)
 
 # Clean rules
 CLEANFILES+= a.out [Ee]rrs mklog core *.core ${PROG} ${OBJS} ${LOBJS}
+CLEANFILES+= ${PROGDEBUG}
 CLEANFILES+= ${PROG}.map
 .if ${MKLDSCRIPT} == "yes"
 CLEANFILES+= kldscript



CVS commit: src/distrib/sets

2020-05-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  1 22:21:49 UTC 2020

Modified Files:
src/distrib/sets: sets.subr

Log Message:
add more module sets.


To generate a diff of this commit:
cvs rdiff -u -r1.188 -r1.189 src/distrib/sets/sets.subr

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/sets.subr
diff -u src/distrib/sets/sets.subr:1.188 src/distrib/sets/sets.subr:1.189
--- src/distrib/sets/sets.subr:1.188	Sat Apr  4 15:50:53 2020
+++ src/distrib/sets/sets.subr	Fri May  1 18:21:49 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: sets.subr,v 1.188 2020/04/04 19:50:53 christos Exp $
+#	$NetBSD: sets.subr,v 1.189 2020/05/01 22:21:49 christos Exp $
 #
 
 #
@@ -184,7 +184,7 @@ SUBST="${SUBST};s#@MACHINE@#${MACHINE}#g
 # In each file, a record consists of a path and a System Package name,
 # separated by whitespace. E.g.,
 #
-# 	# $NetBSD: sets.subr,v 1.188 2020/04/04 19:50:53 christos Exp $
+# 	# $NetBSD: sets.subr,v 1.189 2020/05/01 22:21:49 christos Exp $
 # 	.			base-sys-root	[keyword[,...]]
 # 	./altroot		base-sys-root
 # 	./bin			base-sys-root
@@ -557,6 +557,8 @@ list_set_lists_module()
 	[ "$module" != "no" ] || return
 	echo_if_exist $setdir/module.mi
 	echo_if_exist $setdir/module.${MACHINE}
+	echo_if_exist $setdir/module.ad.${MACHINE}
+	echo_if_exist $setdir/module.md.${MACHINE}
 	# XXX module never has .shl
 	[ "${MACHINE}" != "${MACHINE_ARCH}" ] && \
 	list_set_lists_common_ad $1 module



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

2020-05-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  1 22:21:11 UTC 2020

Modified Files:
src/distrib/sets/lists/debug: module.mi
Added Files:
src/distrib/sets/lists/debug: module.ad.aarch64 module.ad.arm
module.ad.m68k module.ad.mips module.ad.powerpc module.ad.sh3
module.md.alpha module.md.amd64 module.md.evbarm module.md.hppa
module.md.i386 module.md.ia64 module.md.prep module.md.sgimips
module.md.sparc module.md.sparc64 module.md.vax

Log Message:
Add module debug sets


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/distrib/sets/lists/debug/module.ad.aarch64 \
src/distrib/sets/lists/debug/module.ad.arm \
src/distrib/sets/lists/debug/module.ad.m68k \
src/distrib/sets/lists/debug/module.ad.mips \
src/distrib/sets/lists/debug/module.ad.powerpc \
src/distrib/sets/lists/debug/module.ad.sh3 \
src/distrib/sets/lists/debug/module.md.alpha \
src/distrib/sets/lists/debug/module.md.amd64 \
src/distrib/sets/lists/debug/module.md.evbarm \
src/distrib/sets/lists/debug/module.md.hppa \
src/distrib/sets/lists/debug/module.md.i386 \
src/distrib/sets/lists/debug/module.md.ia64 \
src/distrib/sets/lists/debug/module.md.prep \
src/distrib/sets/lists/debug/module.md.sgimips \
src/distrib/sets/lists/debug/module.md.sparc \
src/distrib/sets/lists/debug/module.md.sparc64 \
src/distrib/sets/lists/debug/module.md.vax
cvs rdiff -u -r1.4 -r1.5 src/distrib/sets/lists/debug/module.mi

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

Modified files:

Index: src/distrib/sets/lists/debug/module.mi
diff -u src/distrib/sets/lists/debug/module.mi:1.4 src/distrib/sets/lists/debug/module.mi:1.5
--- src/distrib/sets/lists/debug/module.mi:1.4	Fri May  1 13:14:28 2020
+++ src/distrib/sets/lists/debug/module.mi	Fri May  1 18:21:11 2020
@@ -1 +1,411 @@
-# $NetBSD: module.mi,v 1.4 2020/05/01 17:14:28 christos Exp $
+# $NetBSD: module.mi,v 1.5 2020/05/01 22:21:11 christos Exp $
+./usr/libdata/debug/@MODULEDIR@	modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/accf_dataready			modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/accf_dataready/accf_dataready.kmod.debug	modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/accf_httpready			modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/accf_httpready/accf_httpready.kmod.debug	modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/adosfsmodules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/adosfs/adosfs.kmod.debug		modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/aiomodules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/aio/aio.kmod.debug			modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/am2315temp			modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/am2315temp/am2315temp.kmod.debug	modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/audiomodules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/audio/audio.kmod.debug			modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/autofsmodules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/autofs/autofs.kmod.debug		modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/blowfishmodules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/blowfish/blowfish.kmod.debug		modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/bpfmodules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/bpf/bpf.kmod.debug			modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/bpf_filter			modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/bpf_filter/bpf_filter.kmod.debug	modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/bufq_disksort			modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/bufq_disksort/bufq_disksort.kmod.debug	modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/bufq_fcfsmodules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/bufq_fcfs/bufq_fcfs.kmod.debug		modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/bufq_priocscan			modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/bufq_priocscan/bufq_priocscan.kmod.debug modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/bufq_readprio			modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/bufq_readprio/bufq_readprio.kmod.debug	modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/camelliamodules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/camellia/camellia.kmod.debug		modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/cast128modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/cast128/cast128.kmod.debug		modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/ccdmodules-base-kernel	kmod,debug

CVS commit: src/lib/libpam/libpam

2020-05-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  1 21:58:16 UTC 2020

Modified Files:
src/lib/libpam/libpam: Makefile

Log Message:
Fix the vax build and explain why...


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/lib/libpam/libpam/Makefile

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

Modified files:

Index: src/lib/libpam/libpam/Makefile
diff -u src/lib/libpam/libpam/Makefile:1.24 src/lib/libpam/libpam/Makefile:1.25
--- src/lib/libpam/libpam/Makefile:1.24	Tue Apr 28 22:16:56 2020
+++ src/lib/libpam/libpam/Makefile	Fri May  1 17:58:16 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.24 2020/04/29 02:16:56 riastradh Exp $
+# $NetBSD: Makefile,v 1.25 2020/05/01 21:58:16 christos Exp $
 #-
 # Copyright (c) 1998 Juniper Networks, Inc.
 # All rights reserved.
@@ -40,6 +40,14 @@ NOPROFILE=	# Don't build a profiling lib
 
 .include 
 
+.if ${MACHINE} == "vax"
+# On VAX everything is PIC so we don't need to build a separate _pic.a
+# libraries so we set MKPICLIB.vax=no in bsd.own.mk to save time and space.
+# But in libpam.a we include the static modules which we don't want in the
+# shared library, so we force the build system to build a separate _pic.a.
+MKPICLIB=yes
+.endif
+
 DIST=   ${NETBSDSRCDIR}/external/bsd/openpam/dist
 LIB=	pam
 NOPROFILE=



CVS commit: src

2020-05-01 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri May  1 21:43:24 UTC 2020

Modified Files:
src/distrib/sets/lists/comp: mi
src/share/man/man9: Makefile

Log Message:
link also m_apply(9) to mbuf(9)


To generate a diff of this commit:
cvs rdiff -u -r1.2323 -r1.2324 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.449 -r1.450 src/share/man/man9/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/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2323 src/distrib/sets/lists/comp/mi:1.2324
--- src/distrib/sets/lists/comp/mi:1.2323	Thu Apr 30 03:28:18 2020
+++ src/distrib/sets/lists/comp/mi	Fri May  1 21:43:23 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2323 2020/04/30 03:28:18 riastradh Exp $
+#	$NetBSD: mi,v 1.2324 2020/05/01 21:43:23 jdolecek Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -11416,6 +11416,7 @@
 ./usr/share/man/cat9/ltsleep.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/lwp_trampoline.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/m_adj.0			comp-sys-catman		.cat
+./usr/share/man/cat9/m_apply.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/m_cat.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/m_copyback.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/m_copyback_cow.0		comp-sys-catman		.cat
@@ -19360,6 +19361,7 @@
 ./usr/share/man/html9/ltsleep.html		comp-sys-htmlman	html
 ./usr/share/man/html9/lwp_trampoline.html	comp-sys-htmlman	html
 ./usr/share/man/html9/m_adj.html		comp-sys-htmlman	html
+./usr/share/man/html9/m_apply.html		comp-sys-htmlman	html
 ./usr/share/man/html9/m_cat.html		comp-sys-htmlman	html
 ./usr/share/man/html9/m_copyback.html		comp-sys-htmlman	html
 ./usr/share/man/html9/m_copyback_cow.html	comp-sys-htmlman	html
@@ -27457,6 +27459,7 @@
 ./usr/share/man/man9/ltsleep.9			comp-sys-man		.man
 ./usr/share/man/man9/lwp_trampoline.9		comp-sys-man		.man
 ./usr/share/man/man9/m_adj.9			comp-sys-man		.man
+./usr/share/man/man9/m_apply.9			comp-sys-man		.man
 ./usr/share/man/man9/m_cat.9			comp-sys-man		.man
 ./usr/share/man/man9/m_copyback.9		comp-sys-man		.man
 ./usr/share/man/man9/m_copyback_cow.9		comp-sys-man		.man

Index: src/share/man/man9/Makefile
diff -u src/share/man/man9/Makefile:1.449 src/share/man/man9/Makefile:1.450
--- src/share/man/man9/Makefile:1.449	Thu Apr 30 03:28:18 2020
+++ src/share/man/man9/Makefile	Fri May  1 21:43:24 2020
@@ -1,4 +1,4 @@
-#   $NetBSD: Makefile,v 1.449 2020/04/30 03:28:18 riastradh Exp $
+#   $NetBSD: Makefile,v 1.450 2020/05/01 21:43:24 jdolecek Exp $
 
 #	Makefile for section 9 (kernel function and variable) manual pages.
 
@@ -499,6 +499,7 @@ MLINKS+=mbuf.9 m_get.9 mbuf.9 m_gethdr.9
 	mbuf.9 m_makewritable.9 \
 	mbuf.9 m_pulldown.9 mbuf.9 m_pullup.9 mbuf.9 m_copyup.9 \
 	mbuf.9 m_split.9 mbuf.9 m_adj.9 mbuf.9 m_free.9 \
+	mbuf.9 m_apply.9 \
 	mbuf.9 m_freem.9 mbuf.9 mtod.9 mbuf.9 mtocl.9 mbuf.9 cltom.9 \
 	mbuf.9 MGET.9 mbuf.9 MGETHDR.9 mbuf.9 MEXTMALLOC.9 \
 	mbuf.9 MEXTADD.9 mbuf.9 MCLGET.9 \



CVS commit: src/sys/modules/examples/pollpal

2020-05-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  1 21:42:34 UTC 2020

Modified Files:
src/sys/modules/examples/pollpal: pollpal.c

Log Message:
s/&&/&/ and also return POLLRDNORM (pointed out by joerg@)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/modules/examples/pollpal/pollpal.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/modules/examples/pollpal/pollpal.c
diff -u src/sys/modules/examples/pollpal/pollpal.c:1.2 src/sys/modules/examples/pollpal/pollpal.c:1.3
--- src/sys/modules/examples/pollpal/pollpal.c:1.2	Thu Apr 30 03:07:22 2020
+++ src/sys/modules/examples/pollpal/pollpal.c	Fri May  1 17:42:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pollpal.c,v 1.2 2020/04/30 07:07:22 mrg Exp $	*/ 
+/*	$NetBSD: pollpal.c,v 1.3 2020/05/01 21:42:34 christos Exp $	*/ 
 
 /*-
 * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
 */ 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pollpal.c,v 1.2 2020/04/30 07:07:22 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pollpal.c,v 1.3 2020/05/01 21:42:34 christos Exp $");
 
 #include 
 #include 
@@ -281,9 +281,9 @@ pollpal_poll(struct file *fp, int events
 		}
 		break;
 	case WRITE_WAITING:
-		if (events && (POLLIN | POLLRDNORM)) {
+		if (events & (POLLIN | POLLRDNORM)) {
 			/* When device is in WRITE_WAITING state it can read. */
-			revents |= POLLIN;
+			revents |= POLLIN | POLLRDNORM;
 		} else {
 			/* Record the request if it wasn't satisfied. */
 			selrecord(curlwp, >psel);



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

2020-05-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  1 21:35:30 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_sigaltstack.c

Log Message:
no need for alloca() (breaks SSP)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/sys/t_sigaltstack.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_sigaltstack.c
diff -u src/tests/lib/libc/sys/t_sigaltstack.c:1.1 src/tests/lib/libc/sys/t_sigaltstack.c:1.2
--- src/tests/lib/libc/sys/t_sigaltstack.c:1.1	Thu Apr 30 07:03:29 2020
+++ src/tests/lib/libc/sys/t_sigaltstack.c	Fri May  1 17:35:30 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sigaltstack.c,v 1.1 2020/04/30 11:03:29 ryo Exp $ */
+/* $NetBSD: t_sigaltstack.c,v 1.2 2020/05/01 21:35:30 christos Exp $ */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_sigaltstack.c,v 1.1 2020/04/30 11:03:29 ryo Exp $");
+__RCSID("$NetBSD: t_sigaltstack.c,v 1.2 2020/05/01 21:35:30 christos Exp $");
 
 #include 
 #include 
@@ -43,7 +43,7 @@ static bool handler_use_altstack;
 static void
 handler(int signo __unused)
 {
-	char *sp = alloca(128);
+	char sp[128];
 
 	handler_called = true;
 



CVS commit: src/sys/arch/xen/xen

2020-05-01 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri May  1 19:59:47 UTC 2020

Modified Files:
src/sys/arch/xen/xen: xennetback_xenbus.c

Log Message:
destroy dma maps in xennetback_xenbus_destroy() to avoid memory leak
when xvif(4) is destroyed


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/xen/xen/xennetback_xenbus.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/xen/xen/xennetback_xenbus.c
diff -u src/sys/arch/xen/xen/xennetback_xenbus.c:1.100 src/sys/arch/xen/xen/xennetback_xenbus.c:1.101
--- src/sys/arch/xen/xen/xennetback_xenbus.c:1.100	Fri May  1 19:53:17 2020
+++ src/sys/arch/xen/xen/xennetback_xenbus.c	Fri May  1 19:59:47 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xennetback_xenbus.c,v 1.100 2020/05/01 19:53:17 jdolecek Exp $  */
+/*  $NetBSD: xennetback_xenbus.c,v 1.101 2020/05/01 19:59:47 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.100 2020/05/01 19:53:17 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.101 2020/05/01 19:59:47 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -386,6 +386,15 @@ xennetback_xenbus_destroy(void *arg)
 	evcnt_detach(>xni_cnt_rx_cksum_blank);
 	evcnt_detach(>xni_cnt_rx_cksum_undefer);
 
+	/* Destroy DMA maps */
+	for (int i = 0; i < __arraycount(xneti->xni_xstate); i++) {
+		if (xneti->xni_xstate[i].xs_dmamap != NULL) {
+			bus_dmamap_destroy(xneti->xni_xbusd->xbusd_dmat,
+			xneti->xni_xstate[i].xs_dmamap);
+			xneti->xni_xstate[i].xs_dmamap = NULL;
+		}
+	}
+
 	if (xneti->xni_txring.sring) {
 		op.host_addr = xneti->xni_tx_ring_va;
 		op.handle = xneti->xni_tx_ring_handle;



CVS commit: src/share/man/man4

2020-05-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri May  1 19:56:08 UTC 2020

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

Log Message:
Combine some related paragraphs.


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

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

Modified files:

Index: src/share/man/man4/rnd.4
diff -u src/share/man/man4/rnd.4:1.32 src/share/man/man4/rnd.4:1.33
--- src/share/man/man4/rnd.4:1.32	Fri May  1 19:54:37 2020
+++ src/share/man/man4/rnd.4	Fri May  1 19:56:08 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: rnd.4,v 1.32 2020/05/01 19:54:37 riastradh Exp $
+.\"	$NetBSD: rnd.4,v 1.33 2020/05/01 19:56:08 riastradh Exp $
 .\"
 .\" Copyright (c) 2014-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -79,7 +79,6 @@ Systems should be engineered to judiciou
 at boot before running any services that talk to the internet or
 otherwise require cryptography, in order to avoid generating keys
 predictably.
-.Pp
 .Pa /dev/random
 may block at any time, so programs that read from it must be prepared
 to handle blocking.
@@ -100,7 +99,6 @@ or
 .Pa /dev/urandom
 influences subsequent output of both devices, guaranteed to take
 effect at next open.
-.Pp
 If you have a coin in your pocket, you can flip it 256 times and feed
 the outputs to
 .Pa /dev/random



CVS commit: src/share/man/man4

2020-05-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri May  1 19:54:37 UTC 2020

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

Log Message:
Tighten language so it fits in one paragraph again.

This way the first two paragraphs have parallel structure:

- _Applications_ should read from /dev/urandom or sysctl kern.arandom...
- _Systems_ should be engineered to read once from /dev/random...


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/share/man/man4/rnd.4

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

Modified files:

Index: src/share/man/man4/rnd.4
diff -u src/share/man/man4/rnd.4:1.31 src/share/man/man4/rnd.4:1.32
--- src/share/man/man4/rnd.4:1.31	Fri May  1 12:43:33 2020
+++ src/share/man/man4/rnd.4	Fri May  1 19:54:37 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: rnd.4,v 1.31 2020/05/01 12:43:33 nia Exp $
+.\"	$NetBSD: rnd.4,v 1.32 2020/05/01 19:54:37 riastradh Exp $
 .\"
 .\" Copyright (c) 2014-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -51,32 +51,28 @@ Will block early at boot if the system's
 predictable.
 .El
 .Pp
-Applications can read from
-.Pa /dev/urandom
-when they need randomly generated data, e.g. key material for
-cryptography or seeds for simulations, and the device is known
-to be available.
-.Pp
-A
+Applications should read from
+.Pa /dev/urandom ,
+or the
 .Xr sysctl 7
-variable,
+variable
 .Li kern.arandom ,
-provides equivalent functionality to
-.Pa /dev/urandom
-and will never block.  However, it only returns up to 256 bytes per call.
-This is expected to be enough for seeding most cryptographically secure
-random number generators and ciphers, and if more data is required the
-variable can be queried again.
-.Pp
-Applications should read from the sysctl variable when a high level of
-reliability is required, or the runtime environment cannot be predicted,
-e.g. in a library.  It is possible that
+when they need randomly generated data, e.g. key material for
+cryptography or seeds for simulations.
+(The
+.Xr sysctl 7
+variable
+.Li kern.arandom
+is limited to 256 bytes per read, but is otherwise equivalent to
+reading from
 .Pa /dev/urandom
-is unavailable due to the application being in a
+and always works even in a
 .Xr chroot 8
-environment, or when other restrictions such as those enforced by
-.Xr setrlimit 2
-apply.
+environment without requiring a populated
+.Pa /dev
+tree and without opening a file descriptor, so
+.Li kern.arandom
+may be preferable to use in libraries.)
 .Pp
 Systems should be engineered to judiciously read at least once from
 .Pa /dev/random



CVS commit: src/sys/arch/xen

2020-05-01 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri May  1 19:53:17 UTC 2020

Modified Files:
src/sys/arch/xen/include: xennet_checksum.h
src/sys/arch/xen/xen: if_xennet_xenbus.c xennet_checksum.c
xennetback_xenbus.c

Log Message:
make the csum blank/undefer counters per interface


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/xen/include/xennet_checksum.h
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/xen/xen/if_xennet_xenbus.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/xen/xen/xennet_checksum.c
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/xen/xen/xennetback_xenbus.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/xen/include/xennet_checksum.h
diff -u src/sys/arch/xen/include/xennet_checksum.h:1.4 src/sys/arch/xen/include/xennet_checksum.h:1.5
--- src/sys/arch/xen/include/xennet_checksum.h:1.4	Sun Mar 22 11:20:59 2020
+++ src/sys/arch/xen/include/xennet_checksum.h	Fri May  1 19:53:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xennet_checksum.h,v 1.4 2020/03/22 11:20:59 jdolecek Exp $	*/
+/*	$NetBSD: xennet_checksum.h,v 1.5 2020/05/01 19:53:17 jdolecek Exp $	*/
 
 /*-
  * Copyright (c)2006 YAMAMOTO Takashi,
@@ -32,6 +32,7 @@
 struct ifnet;
 struct mbuf;
 
-int xennet_checksum_fill(struct ifnet *, struct mbuf *);
+int xennet_checksum_fill(struct ifnet *, struct mbuf *,
+	struct evcnt *, struct evcnt *);
 
 #endif /* !_XEN_XENNET_CHECKSUM_H_ */

Index: src/sys/arch/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.120 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.121
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.120	Thu Apr 30 11:19:39 2020
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Fri May  1 19:53:17 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.120 2020/04/30 11:19:39 jdolecek Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.121 2020/05/01 19:53:17 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.120 2020/04/30 11:19:39 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.121 2020/05/01 19:53:17 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -204,6 +204,8 @@ struct xennet_xenbus_softc {
 	struct evcnt sc_cnt_tx_drop;
 	struct evcnt sc_cnt_tx_frag;
 	struct evcnt sc_cnt_rx_frag;
+	struct evcnt sc_cnt_rx_cksum_blank;
+	struct evcnt sc_cnt_rx_cksum_undefer;
 };
 
 static pool_cache_t if_xennetrxbuf_cache;
@@ -433,6 +435,10 @@ xennet_xenbus_attach(device_t parent, de
 	NULL, device_xname(sc->sc_dev), "Tx queue full");
 	evcnt_attach_dynamic(>sc_cnt_rx_frag, EVCNT_TYPE_MISC,
 	NULL, device_xname(sc->sc_dev), "Rx multi-segment packet");
+	evcnt_attach_dynamic(>sc_cnt_rx_cksum_blank, EVCNT_TYPE_MISC,
+	NULL, device_xname(sc->sc_dev), "Rx csum blank");
+	evcnt_attach_dynamic(>sc_cnt_rx_cksum_undefer, EVCNT_TYPE_MISC,
+	NULL, device_xname(sc->sc_dev), "Rx csum undeferred");
 
 	if (!pmf_device_register(self, xennet_xenbus_suspend,
 	xennet_xenbus_resume))
@@ -493,6 +499,8 @@ xennet_xenbus_detach(device_t self, int 
 	evcnt_detach(>sc_cnt_tx_drop);
 	evcnt_detach(>sc_cnt_tx_queue_full);
 	evcnt_detach(>sc_cnt_rx_frag);
+	evcnt_detach(>sc_cnt_rx_cksum_blank);
+	evcnt_detach(>sc_cnt_rx_cksum_undefer);
 
 	/* Unhook the entropy source. */
 	rnd_detach_source(>sc_rnd_source);
@@ -1034,9 +1042,10 @@ again:
 			rxflags = m0_rxflags;
 		}
 
-		if (rxflags & NETRXF_csum_blank)
-			xennet_checksum_fill(ifp, m);
-		else if (rxflags & NETRXF_data_validated)
+		if (rxflags & NETRXF_csum_blank) {
+			xennet_checksum_fill(ifp, m, >sc_cnt_rx_cksum_blank,
+			>sc_cnt_rx_cksum_undefer);
+		} else if (rxflags & NETRXF_data_validated)
 			m->m_pkthdr.csum_flags = XN_M_CSUM_SUPPORTED;
 
 		/* We'are done with req */

Index: src/sys/arch/xen/xen/xennet_checksum.c
diff -u src/sys/arch/xen/xen/xennet_checksum.c:1.11 src/sys/arch/xen/xen/xennet_checksum.c:1.12
--- src/sys/arch/xen/xen/xennet_checksum.c:1.11	Sun Apr 26 12:38:21 2020
+++ src/sys/arch/xen/xen/xennet_checksum.c	Fri May  1 19:53:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xennet_checksum.c,v 1.11 2020/04/26 12:38:21 jdolecek Exp $	*/
+/*	$NetBSD: xennet_checksum.c,v 1.12 2020/05/01 19:53:17 jdolecek Exp $	*/
 
 /*-
  * Copyright (c)2006 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xennet_checksum.c,v 1.11 2020/04/26 12:38:21 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xennet_checksum.c,v 1.12 2020/05/01 19:53:17 jdolecek Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -52,14 +52,6 @@ __KERNEL_RCSID(0, "$NetBSD: xennet_check
 
 #include 
 
-static struct evcnt xn_cksum_defer = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
-NULL, "xennet", "csum blank");
-static struct evcnt xn_cksum_undefer = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
-NULL, "xennet", "csum undeferred");
-

CVS commit: src/sys/arch/aarch64/aarch64

2020-05-01 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri May  1 17:58:48 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: cpu_machdep.c sig_machdep.c

Log Message:
aarch64: handle _UC_SETSTACK and _UC_CLRSTACK like on arm32

ok ryo@


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/aarch64/aarch64/cpu_machdep.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/aarch64/aarch64/sig_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/aarch64/aarch64/cpu_machdep.c
diff -u src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.8 src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.9
--- src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.8	Sat Nov 23 19:40:34 2019
+++ src/sys/arch/aarch64/aarch64/cpu_machdep.c	Fri May  1 17:58:48 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_machdep.c,v 1.8 2019/11/23 19:40:34 ad Exp $ */
+/* $NetBSD: cpu_machdep.c,v 1.9 2020/05/01 17:58:48 tnn Exp $ */
 
 /*-
  * Copyright (c) 2014, 2019 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: cpu_machdep.c,v 1.8 2019/11/23 19:40:34 ad Exp $");
+__KERNEL_RCSID(1, "$NetBSD: cpu_machdep.c,v 1.9 2020/05/01 17:58:48 tnn Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -198,6 +198,8 @@ cpu_getmcontext(struct lwp *l, mcontext_
 int
 cpu_setmcontext(struct lwp *l, const mcontext_t *mcp, unsigned int flags)
 {
+	struct proc * const p = l->l_proc;
+
 	if (flags & _UC_CPU) {
 		struct trapframe * const tf = l->l_md.md_utf;
 		int error = cpu_mcontext_validate(l, mcp);
@@ -216,6 +218,13 @@ cpu_setmcontext(struct lwp *l, const mco
 		pcb->pcb_fpregs = *(const struct fpreg *)>__fregs;
 	}
 
+	mutex_enter(p->p_lock);
+	if (flags & _UC_SETSTACK)
+		l->l_sigstk.ss_flags |= SS_ONSTACK;
+	if (flags & _UC_CLRSTACK)
+		l->l_sigstk.ss_flags &= ~SS_ONSTACK;
+	mutex_exit(p->p_lock);
+
 	return 0;
 }
 

Index: src/sys/arch/aarch64/aarch64/sig_machdep.c
diff -u src/sys/arch/aarch64/aarch64/sig_machdep.c:1.4 src/sys/arch/aarch64/aarch64/sig_machdep.c:1.5
--- src/sys/arch/aarch64/aarch64/sig_machdep.c:1.4	Thu Apr 23 17:21:53 2020
+++ src/sys/arch/aarch64/aarch64/sig_machdep.c	Fri May  1 17:58:48 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: sig_machdep.c,v 1.4 2020/04/23 17:21:53 skrll Exp $ */
+/* $NetBSD: sig_machdep.c,v 1.5 2020/05/01 17:58:48 tnn Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sig_machdep.c,v 1.4 2020/04/23 17:21:53 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sig_machdep.c,v 1.5 2020/05/01 17:58:48 tnn Exp $");
 
 #include 
 #include 
@@ -71,6 +71,8 @@ sendsig_siginfo(const ksiginfo_t *ksi, c
 	uc.uc_flags = _UC_SIGMASK;
 	uc.uc_sigmask = *mask;
 	uc.uc_link = l->l_ctxlink;
+	uc.uc_flags |= (l->l_sigstk.ss_flags & SS_ONSTACK)
+	? _UC_SETSTACK : _UC_CLRSTACK;
 	sendsig_reset(l, ksi->ksi_signo);
 	mutex_exit(p->p_lock);
 	cpu_getmcontext(l, _mcontext, _flags);



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

2020-05-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  1 17:14:28 UTC 2020

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

Log Message:
Move the rump module test programs in the regular mi file. These are not
really kernel modules and the other md module test is in the md.amd64 file
already.


To generate a diff of this commit:
cvs rdiff -u -r1.308 -r1.309 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.3 -r1.4 src/distrib/sets/lists/debug/module.mi

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

Modified files:

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.308 src/distrib/sets/lists/debug/mi:1.309
--- src/distrib/sets/lists/debug/mi:1.308	Thu Apr 30 07:03:29 2020
+++ src/distrib/sets/lists/debug/mi	Fri May  1 13:14:28 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.308 2020/04/30 11:03:29 ryo Exp $
+# $NetBSD: mi,v 1.309 2020/05/01 17:14:28 christos 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
@@ -534,10 +534,10 @@
 ./usr/libdata/debug/usr/bin/expand.debug	comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/f77.debug		comp-obsolete	obsolete
 ./usr/libdata/debug/usr/bin/fgen.debug		comp-util-debug		debug
-./usr/libdata/debug/usr/bin/file.debug		comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/fido2-assert.debug	comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/fido2-cred.debug	comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/fido2-token.debug	comp-util-debug		debug
+./usr/libdata/debug/usr/bin/file.debug		comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/fincore.debug	comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/find.debug		comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/finger.debug	comp-util-debug		debug
@@ -1717,8 +1717,8 @@
 ./usr/libdata/debug/usr/tests/kernel/arch/i386/t_ptrace_wait6.debug	tests-obsolete		obsolete,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/arch/i386/t_ptrace_waitid.debug	tests-obsolete		obsolete,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/arch/i386/t_ptrace_waitpid.debug	tests-obsolete		obsolete,compattestfile
-./usr/libdata/debug/usr/tests/kernel/h_fpufork.debug			tests-kernel-tests	debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/h_fexecve.debug			tests-kernel-tests	debug,atf,compattestfile
+./usr/libdata/debug/usr/tests/kernel/h_fpufork.debug			tests-kernel-tests	debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/h_getprocpath.debug		tests-kernel-tests	debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/h_ps_strings1.debug		tests-kernel-tests	debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/h_ps_strings2.debug		tests-kernel-tests	debug,atf,compattestfile
@@ -2335,6 +2335,11 @@
 ./usr/libdata/debug/usr/tests/libexec/ld.elf_so/t_dlinfo.debug		tests-libexec-debug	debug,atf,pic,compattestfile
 ./usr/libdata/debug/usr/tests/libexec/ld.elf_so/t_dlvsym.debug		tests-libexec-debug	debug,atf,pic,compattestfile
 ./usr/libdata/debug/usr/tests/libexec/ld.elf_so/t_ifunc.debug	tests-libexec-debug	debug,atf,pic,compattestfile
+./usr/libdata/debug/usr/tests/modules/k_helper3.debug	tests-sys-debug		debug,atf,rump
+./usr/libdata/debug/usr/tests/modules/t_builtin.debug	tests-sys-debug		debug,atf,rump
+./usr/libdata/debug/usr/tests/modules/t_kcov.debug	tests-sys-debug		debug,atf,rump
+./usr/libdata/debug/usr/tests/modules/t_modctl.debug	tests-sys-debug		debug,atf,rump
+./usr/libdata/debug/usr/tests/modules/t_ufetchstore.debug	tests-sys-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/net/bpf/t_bpf.debug		tests-net-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/net/bpf/t_div-by-zero.debug		tests-net-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/net/bpf/t_mbuf.debug		tests-net-debug		debug,atf,rump

Index: src/distrib/sets/lists/debug/module.mi
diff -u src/distrib/sets/lists/debug/module.mi:1.3 src/distrib/sets/lists/debug/module.mi:1.4
--- src/distrib/sets/lists/debug/module.mi:1.3	Sat Apr  6 08:34:30 2019
+++ src/distrib/sets/lists/debug/module.mi	Fri May  1 13:14:28 2020
@@ -1,6 +1 @@
-# $NetBSD: module.mi,v 1.3 2019/04/06 12:34:30 kamil Exp $
-./usr/libdata/debug/usr/tests/modules/k_helper3.debug	tests-sys-debug		debug,atf,rump
-./usr/libdata/debug/usr/tests/modules/t_builtin.debug	tests-sys-debug		debug,atf,rump
-./usr/libdata/debug/usr/tests/modules/t_kcov.debug	tests-sys-debug		debug,atf,rump
-./usr/libdata/debug/usr/tests/modules/t_modctl.debug	tests-sys-debug		debug,atf,rump
-./usr/libdata/debug/usr/tests/modules/t_ufetchstore.debug	tests-sys-debug		debug,atf,rump
+# $NetBSD: module.mi,v 1.4 2020/05/01 17:14:28 christos Exp $



CVS commit: src/sys/gdbscripts

2020-05-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May  1 17:00:43 UTC 2020

Modified Files:
src/sys/gdbscripts: modload

Log Message:
mention the need to reload the kernel symbols


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/gdbscripts/modload

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

Modified files:

Index: src/sys/gdbscripts/modload
diff -u src/sys/gdbscripts/modload:1.1 src/sys/gdbscripts/modload:1.2
--- src/sys/gdbscripts/modload:1.1	Tue Apr 28 15:45:58 2020
+++ src/sys/gdbscripts/modload	Fri May  1 13:00:42 2020
@@ -1,5 +1,7 @@
-# $NetBSD: modload,v 1.1 2020/04/28 19:45:58 christos Exp $
+# $NetBSD: modload,v 1.2 2020/05/01 17:00:42 christos Exp $
 # Load the symbol files for all active modules
+# Note that you need to re-run add-symbol-file netbsd.gdb after you
+# load the modules.
 define modload
 	set $h = module_list
 	set $e = $h.tqh_first



CVS commit: src/usr.bin/make/unit-tests

2020-05-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri May  1 16:29:34 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: forloop.exp forloop.mk

Log Message:
usr.bin/make: add test demonstrating that .for stops at newline


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/forloop.exp \
src/usr.bin/make/unit-tests/forloop.mk

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

Modified files:

Index: src/usr.bin/make/unit-tests/forloop.exp
diff -u src/usr.bin/make/unit-tests/forloop.exp:1.1 src/usr.bin/make/unit-tests/forloop.exp:1.2
--- src/usr.bin/make/unit-tests/forloop.exp:1.1	Thu Aug 21 13:44:51 2014
+++ src/usr.bin/make/unit-tests/forloop.exp	Fri May  1 16:29:34 2020
@@ -7,12 +7,13 @@ x=-I"This or that"
 x=-Ithat
 x="-DTHIS=\"this and that\""
 cfl=-I/this -I"This or that" -Ithat "-DTHIS=\"this and that\""
+newline-item=(a)
 a=one b="two and three"
 a=four b="five"
 a=ONE b="TWO AND THREE"
 a=FOUR b="FIVE"
 We expect an error next:
-make: "forloop.mk" line 38: Wrong number of words (9) in .for substitution list with 2 vars
+make: "forloop.mk" line 46: Wrong number of words (9) in .for substitution list with 2 vars
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 OK
Index: src/usr.bin/make/unit-tests/forloop.mk
diff -u src/usr.bin/make/unit-tests/forloop.mk:1.1 src/usr.bin/make/unit-tests/forloop.mk:1.2
--- src/usr.bin/make/unit-tests/forloop.mk:1.1	Thu Aug 21 13:44:51 2014
+++ src/usr.bin/make/unit-tests/forloop.mk	Fri May  1 16:29:34 2020
@@ -1,4 +1,4 @@
-# $Id: forloop.mk,v 1.1 2014/08/21 13:44:51 apb Exp $
+# $Id: forloop.mk,v 1.2 2020/05/01 16:29:34 rillig Exp $
 
 all: for-loop
 
@@ -33,7 +33,15 @@ X!= echo 'cfl=${cfl}' >&2; echo
 .for a b in ${EMPTY}
 X!= echo 'a=$a b=$b' >&2; echo
 .endfor
-.endif
+
+# Since at least 1993, iteration stops at the first newline.
+# Back then, the .newline variable didn't exist, therefore it was unlikely
+# that a newline ever occured.
+.for var in a${.newline}b${.newline}c
+X!= echo 'newline-item=('${var:Q}')' 1>&2; echo
+.endfor
+
+.endif	# for-fail
 
 .for a b in ${LIST} ${LIST:tu} ${XTRA_LIST}
 X!= echo 'a=$a b=$b' >&2; echo



CVS commit: src/usr.bin/make/unit-tests

2020-05-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri May  1 16:26:41 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: cond-late.exp

Log Message:
usr.bin/make: fix test for late evaluated condition


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/cond-late.exp

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

Modified files:

Index: src/usr.bin/make/unit-tests/cond-late.exp
diff -u src/usr.bin/make/unit-tests/cond-late.exp:1.1 src/usr.bin/make/unit-tests/cond-late.exp:1.2
--- src/usr.bin/make/unit-tests/cond-late.exp:1.1	Wed Apr 29 23:15:21 2020
+++ src/usr.bin/make/unit-tests/cond-late.exp	Fri May  1 16:26:41 2020
@@ -1,2 +1,3 @@
 yes
 no
+exit status 0



CVS commit: src/etc/rc.d

2020-05-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri May  1 15:52:38 UTC 2020

Modified Files:
src/etc/rc.d: random_seed

Log Message:
Don't delete the random seed before issuing `rndctl -S'.

`rndctl -S' can replace the file just fine, and deleting it ahead of
time adds a window during which we can lose the seed altogether if
the system is interrupted by a crash or power outage.

XXX pullup


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/etc/rc.d/random_seed

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

Modified files:

Index: src/etc/rc.d/random_seed
diff -u src/etc/rc.d/random_seed:1.8 src/etc/rc.d/random_seed:1.9
--- src/etc/rc.d/random_seed:1.8	Sun Feb 23 08:53:14 2020
+++ src/etc/rc.d/random_seed	Fri May  1 15:52:38 2020
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: random_seed,v 1.8 2020/02/23 08:53:14 riastradh Exp $
+# $NetBSD: random_seed,v 1.9 2020/05/01 15:52:38 riastradh Exp $
 #
 
 # PROVIDE: random_seed
@@ -93,8 +93,6 @@ random_save()
 	oum="$(umask)"
 	umask 077
 
-	rm -Pf "${random_file}"
-
 	if ! fs_safe "$(dirname "${random_file}")"; then
 		umask "${oum}"
 		return 1



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

2020-05-01 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri May  1 14:16:15 UTC 2020

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

Log Message:
Use PRIxPADDR for paddr_t to make i386/ALL compile.


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/sys/arch/x86/x86/x86_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/x86/x86/x86_machdep.c
diff -u src/sys/arch/x86/x86/x86_machdep.c:1.139 src/sys/arch/x86/x86/x86_machdep.c:1.140
--- src/sys/arch/x86/x86/x86_machdep.c:1.139	Thu Apr 30 22:09:32 2020
+++ src/sys/arch/x86/x86/x86_machdep.c	Fri May  1 14:16:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_machdep.c,v 1.139 2020/04/30 22:09:32 bouyer Exp $	*/
+/*	$NetBSD: x86_machdep.c,v 1.140 2020/05/01 14:16:15 hannken Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.139 2020/04/30 22:09:32 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.140 2020/05/01 14:16:15 hannken Exp $");
 
 #include "opt_modular.h"
 #include "opt_physmem.h"
@@ -959,7 +959,8 @@ init_x86_vm(paddr_t pa_kend)
 		if (seg_start <= pa_kstart && pa_kend <= seg_end) {
 #ifdef DEBUG_MEMLOAD
 			printf("split kernel overlapping to "
-			"%" PRIx64 " - %lx and %lx - %" PRIx64 "\n",
+			"%" PRIx64 " - %" PRIxPADDR " and "
+			"%" PRIxPADDR " - %" PRIx64 "\n",
 			seg_start, pa_kstart, pa_kend, seg_end);
 #endif
 			seg_start1 = pa_kend;
@@ -991,7 +992,8 @@ init_x86_vm(paddr_t pa_kend)
 		pa_kend < seg_end) {
 #ifdef DEBUG_MEMLOAD
 			printf("discard leading kernel overlap "
-			"%" PRIx64 " - %lx\n", seg_start, pa_kend);
+			"%" PRIx64 " - %" PRIxPADDR "\n",
+			seg_start, pa_kend);
 #endif
 			seg_start = pa_kend;
 		}
@@ -1006,7 +1008,8 @@ init_x86_vm(paddr_t pa_kend)
 		seg_end < pa_kend) {
 #ifdef DEBUG_MEMLOAD
 			printf("discard trailing kernel overlap "
-			"%lx - %" PRIx64 "\n", pa_kstart, seg_end);
+			"%" PRIxPADDR " - %" PRIx64 "\n",
+			pa_kstart, seg_end);
 #endif
 			seg_end = pa_kstart;
 		}



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

2020-05-01 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri May  1 14:15:41 UTC 2020

Modified Files:
src/sys/arch/i386/conf: ALL

Log Message:
Remove wd* at umass?, it was dropped.


To generate a diff of this commit:
cvs rdiff -u -r1.490 -r1.491 src/sys/arch/i386/conf/ALL

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

Modified files:

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.490 src/sys/arch/i386/conf/ALL:1.491
--- src/sys/arch/i386/conf/ALL:1.490	Wed Mar 25 17:06:19 2020
+++ src/sys/arch/i386/conf/ALL	Fri May  1 14:15:41 2020
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.490 2020/03/25 17:06:19 jdolecek Exp $
+# $NetBSD: ALL,v 1.491 2020/05/01 14:15:41 hannken 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.490 $"
+#ident		"ALL-$Revision: 1.491 $"
 
 maxusers	64		# estimated number of users
 
@@ -1302,7 +1302,6 @@ uhso*	at uhub? port ? configuration ?
 
 # USB Mass Storage
 umass*	at uhub? port ? configuration ? interface ?
-wd*	at umass?
 
 # USB audio
 uaudio* at uhub? port ? configuration ?



CVS commit: src/share/man/man4

2020-05-01 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Fri May  1 12:43:33 UTC 2020

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

Log Message:
rnd.4: Bump dates.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/share/man/man4/rnd.4

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

Modified files:

Index: src/share/man/man4/rnd.4
diff -u src/share/man/man4/rnd.4:1.30 src/share/man/man4/rnd.4:1.31
--- src/share/man/man4/rnd.4:1.30	Fri May  1 12:30:16 2020
+++ src/share/man/man4/rnd.4	Fri May  1 12:43:33 2020
@@ -1,6 +1,6 @@
-.\"	$NetBSD: rnd.4,v 1.30 2020/05/01 12:30:16 nia Exp $
+.\"	$NetBSD: rnd.4,v 1.31 2020/05/01 12:43:33 nia Exp $
 .\"
-.\" Copyright (c) 2014-2019 The NetBSD Foundation, Inc.
+.\" Copyright (c) 2014-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
 .\" This code is derived from software contributed to The NetBSD Foundation
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 3, 2019
+.Dd May 1, 2020
 .Dt RND 4
 .Os
 .\"



CVS commit: src/share/man/man4

2020-05-01 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Fri May  1 12:30:16 UTC 2020

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

Log Message:
rnd.4: Explain why libraries should use kern.arandom over /dev/urandom


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/share/man/man4/rnd.4

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

Modified files:

Index: src/share/man/man4/rnd.4
diff -u src/share/man/man4/rnd.4:1.29 src/share/man/man4/rnd.4:1.30
--- src/share/man/man4/rnd.4:1.29	Thu Apr 30 03:28:18 2020
+++ src/share/man/man4/rnd.4	Fri May  1 12:30:16 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: rnd.4,v 1.29 2020/04/30 03:28:18 riastradh Exp $
+.\"	$NetBSD: rnd.4,v 1.30 2020/05/01 12:30:16 nia Exp $
 .\"
 .\" Copyright (c) 2014-2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -51,10 +51,32 @@ Will block early at boot if the system's
 predictable.
 .El
 .Pp
-Applications should read from
+Applications can read from
 .Pa /dev/urandom
 when they need randomly generated data, e.g. key material for
-cryptography or seeds for simulations.
+cryptography or seeds for simulations, and the device is known
+to be available.
+.Pp
+A
+.Xr sysctl 7
+variable,
+.Li kern.arandom ,
+provides equivalent functionality to
+.Pa /dev/urandom
+and will never block.  However, it only returns up to 256 bytes per call.
+This is expected to be enough for seeding most cryptographically secure
+random number generators and ciphers, and if more data is required the
+variable can be queried again.
+.Pp
+Applications should read from the sysctl variable when a high level of
+reliability is required, or the runtime environment cannot be predicted,
+e.g. in a library.  It is possible that
+.Pa /dev/urandom
+is unavailable due to the application being in a
+.Xr chroot 8
+environment, or when other restrictions such as those enforced by
+.Xr setrlimit 2
+apply.
 .Pp
 Systems should be engineered to judiciously read at least once from
 .Pa /dev/random
@@ -485,6 +507,7 @@ pools and consolidated into a global poo
 Keys for
 .Pa /dev/random ,
 .Pa /dev/urandom ,
+.Li kern.arandom ,
 and the in-kernel
 .Xr cprng 9
 subsystem are extracted from the global pool.



CVS commit: [netbsd-9] src/doc

2020-05-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May  1 11:55:45 UTC 2020

Modified Files:
src/doc [netbsd-9]: CHANGES-9.1

Log Message:
Tickets #880 and #881


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.49 -r1.1.2.50 src/doc/CHANGES-9.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-9.1
diff -u src/doc/CHANGES-9.1:1.1.2.49 src/doc/CHANGES-9.1:1.1.2.50
--- src/doc/CHANGES-9.1:1.1.2.49	Fri May  1 07:29:03 2020
+++ src/doc/CHANGES-9.1	Fri May  1 11:55:45 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.1,v 1.1.2.49 2020/05/01 07:29:03 martin Exp $
+# $NetBSD: CHANGES-9.1,v 1.1.2.50 2020/05/01 11:55:45 martin Exp $
 
 A complete list of changes from the NetBSD 9.0 release to the NetBSD 9.1
 release:
@@ -2394,3 +2394,17 @@ games/fortune/unstr/unstr.c			1.15
 	Fix potential buffer overflows in fortune tools.
 	[nia, ticket #879]
 
+sys/arch/hp300/stand/common/netio.c		1.17
+sys/arch/hp300/stand/inst/version		1.14
+sys/arch/hp300/stand/uboot/version		1.21
+
+	hp300: fix bootloader error message.
+	[tsutsui, ticket #880]
+
+sys/kern/vfs_mount.c1.82
+
+	Undo Rev. 1.79, it breaks root-on-raid where it destroys the component
+	disks before the raid.
+	Reopens PR kern/54969: Disk cache is no longer flushed on shutdown.
+	[hannken, ticket #881]
+



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

2020-05-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May  1 11:54:53 UTC 2020

Modified Files:
src/sys/kern [netbsd-9]: vfs_mount.c

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

sys/kern/vfs_mount.c: revision 1.82

Undo Rev. 1.79, it breaks root-on-raid where it destroys the component
disks before the raid:

 forcefully unmounting / (/dev/raid0a)...
 sd1: detached
 sd0: detached
 raid0: cache flush to component /dev/sd0a failed.
 raid0: cache flush to component /dev/sd1a failed.
 fatal page fault in supervisor mode
 Stopped in pid 2356.2356 (reboot) at netbsd:sdstrategy+0x36

Reopens PR kern/54969: Disk cache is no longer flushed on shutdown


To generate a diff of this commit:
cvs rdiff -u -r1.70.4.1 -r1.70.4.2 src/sys/kern/vfs_mount.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/vfs_mount.c
diff -u src/sys/kern/vfs_mount.c:1.70.4.1 src/sys/kern/vfs_mount.c:1.70.4.2
--- src/sys/kern/vfs_mount.c:1.70.4.1	Wed Apr 22 18:05:11 2020
+++ src/sys/kern/vfs_mount.c	Fri May  1 11:54:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_mount.c,v 1.70.4.1 2020/04/22 18:05:11 martin Exp $	*/
+/*	$NetBSD: vfs_mount.c,v 1.70.4.2 2020/05/01 11:54:53 martin Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.70.4.1 2020/04/22 18:05:11 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.70.4.2 2020/05/01 11:54:53 martin Exp $");
 
 #include 
 #include 
@@ -114,8 +114,6 @@ static struct vnode *vfs_vnode_iterator_
 /* Root filesystem. */
 vnode_t *			rootvnode;
 
-extern struct mount		*dead_rootmount;
-
 /* Mounted filesystem list. */
 static TAILQ_HEAD(mountlist, mountlist_entry) mountlist;
 static kmutex_t			mountlist_lock;
@@ -1002,7 +1000,6 @@ bool
 vfs_unmountall1(struct lwp *l, bool force, bool verbose)
 {
 	struct mount *mp;
-	mount_iterator_t *iter;
 	bool any_error = false, progress = false;
 	uint64_t gen;
 	int error;
@@ -1037,24 +1034,6 @@ vfs_unmountall1(struct lwp *l, bool forc
 	if (any_error && verbose) {
 		printf("WARNING: some file systems would not unmount\n");
 	}
-
-	/* If the mountlist is empty destroy anonymous device vnodes. */
-	mountlist_iterator_init();
-	if (mountlist_iterator_next(iter) == NULL) {
-		struct vnode_iterator *marker;
-		vnode_t *vp;
-
-		vfs_vnode_iterator_init(dead_rootmount, );
-		while ((vp = vfs_vnode_iterator_next(marker, NULL, NULL))) {
-			if (vp->v_type == VCHR || vp->v_type == VBLK)
-vgone(vp);
-			else
-vrele(vp);
-		}
-		vfs_vnode_iterator_destroy(marker);
-	}
-	mountlist_iterator_destroy(iter);
-
 	return progress;
 }
 



CVS commit: [netbsd-9] src/sys/arch/hp300/stand

2020-05-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May  1 11:53:08 UTC 2020

Modified Files:
src/sys/arch/hp300/stand/common [netbsd-9]: netio.c
src/sys/arch/hp300/stand/inst [netbsd-9]: version
src/sys/arch/hp300/stand/uboot [netbsd-9]: version

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #880):

sys/arch/hp300/stand/uboot/version: revision 1.21
sys/arch/hp300/stand/inst/version: revision 1.14
sys/arch/hp300/stand/common/netio.c: revision 1.17

Fix inappropriate error messages when nfs_mount() fails.

Noticed by Chris Hanson and his HP332 and confirmed on my HP425e.

Also bump revisions to denote visible changes.
Worth to pull up to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.16.22.1 src/sys/arch/hp300/stand/common/netio.c
cvs rdiff -u -r1.13 -r1.13.22.1 src/sys/arch/hp300/stand/inst/version
cvs rdiff -u -r1.20 -r1.20.22.1 src/sys/arch/hp300/stand/uboot/version

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/hp300/stand/common/netio.c
diff -u src/sys/arch/hp300/stand/common/netio.c:1.16 src/sys/arch/hp300/stand/common/netio.c:1.16.22.1
--- src/sys/arch/hp300/stand/common/netio.c:1.16	Sat Jun 11 06:20:11 2016
+++ src/sys/arch/hp300/stand/common/netio.c	Fri May  1 11:53:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netio.c,v 1.16 2016/06/11 06:20:11 dholland Exp $	*/
+/*	$NetBSD: netio.c,v 1.16.22.1 2020/05/01 11:53:08 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -158,7 +158,6 @@ netstrategy(void *devdata, int func, dad
 int
 netmountroot(struct open_file *f, char *devname)
 {
-	int error;
 	struct iodesc *d;
 
 #ifdef DEBUG
@@ -260,7 +259,8 @@ netmountroot(struct open_file *f, char *
 
  do_nfs_mount:
 	/* Get the NFS file handle (mount). */
-	error = nfs_mount(netdev_sock, rootip, rootpath);
+	if (nfs_mount(netdev_sock, rootip, rootpath))
+		return errno;
 
-	return error;
+	return 0;
 }

Index: src/sys/arch/hp300/stand/inst/version
diff -u src/sys/arch/hp300/stand/inst/version:1.13 src/sys/arch/hp300/stand/inst/version:1.13.22.1
--- src/sys/arch/hp300/stand/inst/version:1.13	Sun Jan 17 08:05:20 2016
+++ src/sys/arch/hp300/stand/inst/version	Fri May  1 11:53:08 2020
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.13 2016/01/17 08:05:20 tsutsui Exp $
+$NetBSD: version,v 1.13.22.1 2020/05/01 11:53:08 martin Exp $
 
 1.1:	Initial version
 1.2:	Added support for HP-IB cartridge tapes
@@ -13,3 +13,4 @@ $NetBSD: version,v 1.13 2016/01/17 08:05
 1.11:	Add support for framebuffers on HP362 and HP382.
 1.12:	Add and fix support for HP425e mcclock, sti framebuffer, apci and dnkbd.
 1.13:	Disable slow gunzip CRC32 calculation.
+1.14:	Fix wrong errno when nfs_mount() fails.

Index: src/sys/arch/hp300/stand/uboot/version
diff -u src/sys/arch/hp300/stand/uboot/version:1.20 src/sys/arch/hp300/stand/uboot/version:1.20.22.1
--- src/sys/arch/hp300/stand/uboot/version:1.20	Sun Jan 17 08:05:20 2016
+++ src/sys/arch/hp300/stand/uboot/version	Fri May  1 11:53:07 2020
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.20 2016/01/17 08:05:20 tsutsui Exp $
+$NetBSD: version,v 1.20.22.1 2020/05/01 11:53:07 martin Exp $
 
 1.1:	Initial version
 1.2:	Added support for network booting
@@ -20,3 +20,4 @@ $NetBSD: version,v 1.20 2016/01/17 08:05
 1.18:	Add support for framebuffers on HP362 and HP382.
 1.19:	Add and fix support for HP425e mcclock, sti framebuffer, apci and dnkbd.
 1.20:	Disable slow gunzip CRC32 calculation.
+1.21:	Fix wrong errno when nfs_mount() fails.



CVS commit: src/sys/dev/pci

2020-05-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri May  1 10:38:35 UTC 2020

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add IDs for Ampere eMAG PCIe Root Ports


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

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1412 src/sys/dev/pci/pcidevs:1.1413
--- src/sys/dev/pci/pcidevs:1.1412	Thu Apr 23 04:17:37 2020
+++ src/sys/dev/pci/pcidevs	Fri May  1 10:38:35 2020
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1412 2020/04/23 04:17:37 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1413 2020/05/01 10:38:35 jmcneill Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -654,6 +654,7 @@ vendor AMAZON		0x1d0f	Amazon.com, Inc.
 vendor AQUANTIA		0x1d6a	Aquantia
 vendor ROCKCHIP		0x1d87	Rockchip
 vendor TEKRAM2		0x1de1	Tekram Technology (2nd PCI Vendor ID)
+vendor AMPERE		0x1def	Ampere Computing
 vendor SUNIX2		0x1fd4	SUNIX Co
 vendor HINT		0x3388	HiNT
 vendor 3DLABS		0x3d3d	3D Labs
@@ -1219,6 +1220,16 @@ product AMI MEGARAID3		0x1960	MegaRAID 3
 product AMI MEGARAID		0x9010	MegaRAID
 product AMI MEGARAID2		0x9060	MegaRAID 2
 
+/* Ampere Computing products */
+product AMPERE EMAG_PCIE_0	0xe005	eMAG PCIe Root Port 0
+product AMPERE EMAG_PCIE_1	0xe006	eMAG PCIe Root Port 1
+product AMPERE EMAG_PCIE_2	0xe007	eMAG PCIe Root Port 2
+product AMPERE EMAG_PCIE_3	0xe008	eMAG PCIe Root Port 3
+product AMPERE EMAG_PCIE_4	0xe009	eMAG PCIe Root Port 4
+product AMPERE EMAG_PCIE_5	0xe00a	eMAG PCIe Root Port 5
+product AMPERE EMAG_PCIE_6	0xe00b	eMAG PCIe Root Port 6
+product AMPERE EMAG_PCIE_7	0xe00c	eMAG PCIe Root Port 7
+
 /* Analog Devices products */
 product ANALOG AD1889	0x1889	AD1889 PCI SoundMAX Controller
 product ANALOG SAFENET	0x2f44	SafeNet Crypto Accelerator ADSP-2141



CVS commit: src/sys/dev/pci

2020-05-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri May  1 10:39:00 UTC 2020

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1399 -r1.1400 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1398 -r1.1399 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


CVS commit: src/share/man/man7

2020-05-01 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Fri May  1 10:06:09 UTC 2020

Modified Files:
src/share/man/man7: sysctl.7

Log Message:
Update documentation of kern.arandom. It uses cprng_strong(9).


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/share/man/man7/sysctl.7

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

Modified files:

Index: src/share/man/man7/sysctl.7
diff -u src/share/man/man7/sysctl.7:1.142 src/share/man/man7/sysctl.7:1.143
--- src/share/man/man7/sysctl.7:1.142	Sat Nov 16 17:33:09 2019
+++ src/share/man/man7/sysctl.7	Fri May  1 10:06:09 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sysctl.7,v 1.142 2019/11/16 17:33:09 nia Exp $
+.\"	$NetBSD: sysctl.7,v 1.143 2020/05/01 10:06:09 nia Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -390,7 +390,7 @@ non-blocking cryptographically secure ra
 The used random number generator
 .Pf ( RNG )
 is based on
-.Xr arc4random 3 .
+.Xr cprng_strong 9 .
 .It Li kern.argmax ( Dv KERN_ARGMAX )
 The maximum bytes of argument to
 .Xr execve 2 .



CVS commit: src/sys/arch

2020-05-01 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri May  1 09:40:48 UTC 2020

Modified Files:
src/sys/arch/i386/i386: lock_stubs.S spl.S
src/sys/arch/i386/include: frameasm.h
src/sys/arch/x86/x86: patch.c

Log Message:
Switch the rest of i386 to the x86_hotpatch mechanism.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/i386/i386/lock_stubs.S
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/i386/i386/spl.S
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/i386/include/frameasm.h
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/x86/x86/patch.c

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

Modified files:

Index: src/sys/arch/i386/i386/lock_stubs.S
diff -u src/sys/arch/i386/i386/lock_stubs.S:1.34 src/sys/arch/i386/i386/lock_stubs.S:1.35
--- src/sys/arch/i386/i386/lock_stubs.S:1.34	Fri May  1 09:17:58 2020
+++ src/sys/arch/i386/i386/lock_stubs.S	Fri May  1 09:40:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs.S,v 1.34 2020/05/01 09:17:58 maxv Exp $	*/
+/*	$NetBSD: lock_stubs.S,v 1.35 2020/05/01 09:40:47 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lock_stubs.S,v 1.34 2020/05/01 09:17:58 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lock_stubs.S,v 1.35 2020/05/01 09:40:47 maxv Exp $");
 
 #include "opt_lockdebug.h"
 
@@ -255,9 +255,10 @@ END(mutex_spin_enter)
 
 #ifndef XENPV
 /*
- * Release a spin mutex and post a store fence.
+ * Release a spin mutex and post a store fence. Must occupy 96 bytes.
  */
 ENTRY(mutex_spin_exit)
+	HOTPATCH(HP_NAME_MUTEX_EXIT, 96)
 	movl	4(%esp), %edx
 	movl	CPUVAR(MTX_OLDSPL), %ecx
 	incl	CPUVAR(MTX_COUNT)
@@ -273,7 +274,6 @@ ENTRY(mutex_spin_exit)
 1:	ret
 	.space	32, 0xCC
 	.align	32
-LABEL(mutex_spin_exit_end)
 END(mutex_spin_exit)
 #else  /* XENPV */
 STRONG_ALIAS(mutex_spin_exit, i686_mutex_spin_exit)
@@ -281,7 +281,7 @@ STRONG_ALIAS(mutex_spin_exit, i686_mutex
 
 /*
  * Patch for i686 CPUs where cli/sti is prohibitively expensive.
- * Must be the same size as mutex_spin_exit().
+ * Must be the same size as mutex_spin_exit(), that is, 96 bytes.
  */
 ENTRY(i686_mutex_spin_exit)
 	mov	4(%esp),%edx

Index: src/sys/arch/i386/i386/spl.S
diff -u src/sys/arch/i386/i386/spl.S:1.53 src/sys/arch/i386/i386/spl.S:1.54
--- src/sys/arch/i386/i386/spl.S:1.53	Fri May  1 09:23:43 2020
+++ src/sys/arch/i386/i386/spl.S	Fri May  1 09:40:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: spl.S,v 1.53 2020/05/01 09:23:43 maxv Exp $	*/
+/*	$NetBSD: spl.S,v 1.54 2020/05/01 09:40:47 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.53 2020/05/01 09:23:43 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.54 2020/05/01 09:40:47 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_spldebug.h"
@@ -71,11 +71,12 @@ END(splraise)
 /*
  * void spllower(int s);
  *
- * spllower() for i486 and Pentium.  Must be the same size as
- * cx8_spllower().  This must use pushf/cli/popf as it is used
- * early in boot where interrupts are disabled via eflags/IE.
+ * spllower() for i486 and Pentium. Must be the same size as cx8_spllower(),
+ * that is, 64 bytes. This must use pushf/cli/popf as it is used early in boot
+ * where interrupts are disabled via eflags/IE.
  */
 ENTRY(spllower)
+	HOTPATCH(HP_NAME_SPLLOWER, 64)
 #ifdef SPLDEBUG
 	movl	4(%esp),%ecx
 	pushl	%ebp
@@ -101,7 +102,6 @@ ENTRY(spllower)
 	popf
 	jmp	_C_LABEL(Xspllower)
 	.align	32
-LABEL(spllower_end)
 END(spllower)
 #else  /* XENPV */
 STRONG_ALIAS(spllower, cx8_spllower)
@@ -110,10 +110,10 @@ STRONG_ALIAS(spllower, cx8_spllower)
 /*
  * void	cx8_spllower(int s);
  *
- * spllower() optimized for Pentium Pro and later, which have long
- * pipelines that will be stalled by pushf/cli/popf.  Must be the
- * same size as spllower().  Does not need to restore eflags/IE as
- * is patched in once autoconf is underway.
+ * spllower() optimized for Pentium Pro and later, which have long pipelines
+ * that will be stalled by pushf/cli/popf.  Must be the same size as
+ * spllower(), ie 64 bytes.  Does not need to restore eflags/IE as is patched
+ * in once autoconf is underway.
  *
  * For cmpxchg8b, edx/ecx are the high words and eax/ebx the low.
  *

Index: src/sys/arch/i386/include/frameasm.h
diff -u src/sys/arch/i386/include/frameasm.h:1.32 src/sys/arch/i386/include/frameasm.h:1.33
--- src/sys/arch/i386/include/frameasm.h:1.32	Fri May  1 08:32:50 2020
+++ src/sys/arch/i386/include/frameasm.h	Fri May  1 09:40:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: frameasm.h,v 1.32 2020/05/01 08:32:50 maxv Exp $	*/
+/*	$NetBSD: frameasm.h,v 1.33 2020/05/01 09:40:47 maxv Exp $	*/
 
 #ifndef _I386_FRAMEASM_H_
 #define _I386_FRAMEASM_H_
@@ -51,6 +51,8 @@
 #define HP_NAME_SSE2_LFENCE	5
 #define HP_NAME_SSE2_MFENCE	6
 #define HP_NAME_CAS_64		7
+#define HP_NAME_SPLLOWER	8
+#define 

CVS commit: src/sys/arch/i386/i386

2020-05-01 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri May  1 09:23:43 UTC 2020

Modified Files:
src/sys/arch/i386/i386: spl.S

Log Message:
Remove dead code, we are in an #ifndef XENPV block here.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/i386/i386/spl.S

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

Modified files:

Index: src/sys/arch/i386/i386/spl.S
diff -u src/sys/arch/i386/i386/spl.S:1.52 src/sys/arch/i386/i386/spl.S:1.53
--- src/sys/arch/i386/i386/spl.S:1.52	Fri May  1 09:17:58 2020
+++ src/sys/arch/i386/i386/spl.S	Fri May  1 09:23:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: spl.S,v 1.52 2020/05/01 09:17:58 maxv Exp $	*/
+/*	$NetBSD: spl.S,v 1.53 2020/05/01 09:23:43 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.52 2020/05/01 09:17:58 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.53 2020/05/01 09:23:43 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_spldebug.h"
@@ -98,15 +98,7 @@ ENTRY(spllower)
 1:
 	ret
 2:
-#ifdef XENPV
-	/*
-	 * no need to call stipending, we're going to CLI again
-	 * just drop the saved value on stack
-	 */
-	addl	$4,%esp
-#else
 	popf
-#endif
 	jmp	_C_LABEL(Xspllower)
 	.align	32
 LABEL(spllower_end)



CVS commit: src/sys/arch

2020-05-01 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri May  1 09:17:58 UTC 2020

Modified Files:
src/sys/arch/i386/i386: lock_stubs.S spl.S
src/sys/arch/x86/x86: patch.c

Log Message:
Use absolute jumps, and drop the PC-relative patching. We want exact
templates.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/i386/i386/lock_stubs.S
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/i386/i386/spl.S
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/x86/x86/patch.c

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

Modified files:

Index: src/sys/arch/i386/i386/lock_stubs.S
diff -u src/sys/arch/i386/i386/lock_stubs.S:1.33 src/sys/arch/i386/i386/lock_stubs.S:1.34
--- src/sys/arch/i386/i386/lock_stubs.S:1.33	Sat Apr 25 15:26:17 2020
+++ src/sys/arch/i386/i386/lock_stubs.S	Fri May  1 09:17:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs.S,v 1.33 2020/04/25 15:26:17 bouyer Exp $	*/
+/*	$NetBSD: lock_stubs.S,v 1.34 2020/05/01 09:17:58 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lock_stubs.S,v 1.33 2020/04/25 15:26:17 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lock_stubs.S,v 1.34 2020/05/01 09:17:58 maxv Exp $");
 
 #include "opt_lockdebug.h"
 
@@ -271,13 +271,14 @@ ENTRY(mutex_spin_exit)
 	movl	%ecx, CPUVAR(ILEVEL)
 	sti
 1:	ret
-	.space 32
+	.space	32, 0xCC
 	.align	32
 LABEL(mutex_spin_exit_end)
 END(mutex_spin_exit)
 #else  /* XENPV */
 STRONG_ALIAS(mutex_spin_exit, i686_mutex_spin_exit)
 #endif	/* !XENPV */
+
 /*
  * Patch for i686 CPUs where cli/sti is prohibitively expensive.
  * Must be the same size as mutex_spin_exit().
@@ -302,9 +303,12 @@ ENTRY(i686_mutex_spin_exit)
 2:
 	popl	%ebx
 	movl	%ecx,4(%esp)
-LABEL(i686_mutex_spin_exit_patch)
-	jmp	_C_LABEL(Xspllower)
-	.space 16
+
+	/* The reference must be absolute, hence the indirect jump. */
+	movl	$Xspllower,%eax
+	jmp	*%eax
+
+	.space	16, 0xCC
 	.align	32
 LABEL(i686_mutex_spin_exit_end)
 END(i686_mutex_spin_exit)

Index: src/sys/arch/i386/i386/spl.S
diff -u src/sys/arch/i386/i386/spl.S:1.51 src/sys/arch/i386/i386/spl.S:1.52
--- src/sys/arch/i386/i386/spl.S:1.51	Sat Apr 25 15:26:17 2020
+++ src/sys/arch/i386/i386/spl.S	Fri May  1 09:17:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: spl.S,v 1.51 2020/04/25 15:26:17 bouyer Exp $	*/
+/*	$NetBSD: spl.S,v 1.52 2020/05/01 09:17:58 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.51 2020/04/25 15:26:17 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.52 2020/05/01 09:17:58 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_spldebug.h"
@@ -147,10 +147,11 @@ ENTRY(cx8_spllower)
 2:
 	popl	%ebx
 
-	.type	_C_LABEL(cx8_spllower_patch), @function
-LABEL(cx8_spllower_patch)
-	jmp	_C_LABEL(Xspllower)
-	.align	32
+	/* The reference must be absolute, hence the indirect jump. */
+	movl	$Xspllower,%eax
+	jmp	*%eax
+
+	.align	32, 0xCC
 LABEL(cx8_spllower_end)
 END(cx8_spllower)
 

Index: src/sys/arch/x86/x86/patch.c
diff -u src/sys/arch/x86/x86/patch.c:1.44 src/sys/arch/x86/x86/patch.c:1.45
--- src/sys/arch/x86/x86/patch.c:1.44	Fri May  1 08:32:50 2020
+++ src/sys/arch/x86/x86/patch.c	Fri May  1 09:17:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: patch.c,v 1.44 2020/05/01 08:32:50 maxv Exp $	*/
+/*	$NetBSD: patch.c,v 1.45 2020/05/01 09:17:58 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.44 2020/05/01 08:32:50 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.45 2020/05/01 09:17:58 maxv Exp $");
 
 #include "opt_lockdebug.h"
 #ifdef i386
@@ -62,35 +62,13 @@ void	spllower(int);
 void	spllower_end(void);
 void	cx8_spllower(int);
 void	cx8_spllower_end(void);
-void	cx8_spllower_patch(void);
 
 void	mutex_spin_exit_end(void);
 void	i686_mutex_spin_exit(int);
 void	i686_mutex_spin_exit_end(void);
-void	i686_mutex_spin_exit_patch(void);
-
-#define	X86_CS		0x2e
-#define	X86_DS		0x3e
-#define	X86_GROUP_0F	0x0f
-
-static void
-adjust_jumpoff(uint8_t *ptr, void *from_s, void *to_s)
-{
-
-	/* Branch hints */
-	if (ptr[0] == X86_CS || ptr[0] == X86_DS)
-		ptr++;
-	/* Conditional jumps */
-	if (ptr[0] == X86_GROUP_0F)
-		ptr++;		
-	/* 4-byte relative jump or call */
-	*(uint32_t *)(ptr + 1 - (uintptr_t)from_s + (uintptr_t)to_s) +=
-	((uint32_t)(uintptr_t)from_s - (uint32_t)(uintptr_t)to_s);
-}
 
 static void __unused
-patchfunc(void *from_s, void *from_e, void *to_s, void *to_e,
-	  void *pcrel)
+patchfunc(void *from_s, void *from_e, void *to_s, void *to_e)
 {
 
 	if ((uintptr_t)from_e - (uintptr_t)from_s !=
@@ -98,8 +76,6 @@ patchfunc(void *from_s, void *from_e, vo
 		panic("patchfunc: sizes do not match (from=%p)", from_s);
 
 	memcpy(to_s, from_s, (uintptr_t)to_e - (uintptr_t)to_s);
-	if (pcrel != NULL)
-		

CVS commit: src/sys/kern

2020-05-01 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri May  1 08:45:01 UTC 2020

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

Log Message:
Undo Rev. 1.79, it breaks root-on-raid where it destroys the component
disks before the raid:

  forcefully unmounting / (/dev/raid0a)...
  sd1: detached
  sd0: detached
  raid0: cache flush to component /dev/sd0a failed.
  raid0: cache flush to component /dev/sd1a failed.
  fatal page fault in supervisor mode
  Stopped in pid 2356.2356 (reboot) at netbsd:sdstrategy+0x36

Reopens PR kern/54969: Disk cache is no longer flushed on shutdown


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/kern/vfs_mount.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/vfs_mount.c
diff -u src/sys/kern/vfs_mount.c:1.81 src/sys/kern/vfs_mount.c:1.82
--- src/sys/kern/vfs_mount.c:1.81	Tue Apr 21 21:42:47 2020
+++ src/sys/kern/vfs_mount.c	Fri May  1 08:45:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_mount.c,v 1.81 2020/04/21 21:42:47 ad Exp $	*/
+/*	$NetBSD: vfs_mount.c,v 1.82 2020/05/01 08:45:01 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1997-2020 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.81 2020/04/21 21:42:47 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.82 2020/05/01 08:45:01 hannken Exp $");
 
 #include 
 #include 
@@ -114,8 +114,6 @@ static struct vnode *vfs_vnode_iterator_
 /* Root filesystem. */
 vnode_t *			rootvnode;
 
-extern struct mount		*dead_rootmount;
-
 /* Mounted filesystem list. */
 static TAILQ_HEAD(mountlist, mountlist_entry) mountlist;
 static kmutex_t			mountlist_lock __cacheline_aligned;
@@ -1016,7 +1014,6 @@ bool
 vfs_unmountall1(struct lwp *l, bool force, bool verbose)
 {
 	struct mount *mp;
-	mount_iterator_t *iter;
 	bool any_error = false, progress = false;
 	uint64_t gen;
 	int error;
@@ -1051,24 +1048,6 @@ vfs_unmountall1(struct lwp *l, bool forc
 	if (any_error && verbose) {
 		printf("WARNING: some file systems would not unmount\n");
 	}
-
-	/* If the mountlist is empty destroy anonymous device vnodes. */
-	mountlist_iterator_init();
-	if (mountlist_iterator_next(iter) == NULL) {
-		struct vnode_iterator *marker;
-		vnode_t *vp;
-
-		vfs_vnode_iterator_init(dead_rootmount, );
-		while ((vp = vfs_vnode_iterator_next(marker, NULL, NULL))) {
-			if (vp->v_type == VCHR || vp->v_type == VBLK)
-vgone(vp);
-			else
-vrele(vp);
-		}
-		vfs_vnode_iterator_destroy(marker);
-	}
-	mountlist_iterator_destroy(iter);
-
 	return progress;
 }
 



CVS commit: src/sys/ufs/ufs

2020-05-01 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri May  1 08:43:37 UTC 2020

Modified Files:
src/sys/ufs/ufs: ufs_vfsops.c

Log Message:
There is no difference between a zero-sized and not yet
reclaimed directory vnode and a non-existent vnode.

Teach ufs_fhtovp() to treat zero-sized directories as stale.

PR kern/55211 (fs/vfs/t_vnops:nfs_dir_rmdirdotdot test fails)


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

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

Modified files:

Index: src/sys/ufs/ufs/ufs_vfsops.c
diff -u src/sys/ufs/ufs/ufs_vfsops.c:1.59 src/sys/ufs/ufs/ufs_vfsops.c:1.60
--- src/sys/ufs/ufs/ufs_vfsops.c:1.59	Fri Jan 17 20:08:10 2020
+++ src/sys/ufs/ufs/ufs_vfsops.c	Fri May  1 08:43:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_vfsops.c,v 1.59 2020/01/17 20:08:10 ad Exp $	*/
+/*	$NetBSD: ufs_vfsops.c,v 1.60 2020/05/01 08:43:37 hannken Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993, 1994
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_vfsops.c,v 1.59 2020/01/17 20:08:10 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_vfsops.c,v 1.60 2020/05/01 08:43:37 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -247,7 +247,8 @@ ufs_fhtovp(struct mount *mp, struct ufid
 	}
 	ip = VTOI(nvp);
 	KASSERT(ip != NULL);
-	if (ip->i_mode == 0 || ip->i_gen != ufhp->ufid_gen) {
+	if (ip->i_mode == 0 || ip->i_gen != ufhp->ufid_gen ||
+	((ip->i_mode & IFMT) == IFDIR && ip->i_size == 0)) {
 		vput(nvp);
 		*vpp = NULLVP;
 		return (ESTALE);



CVS commit: src/sys/nfs

2020-05-01 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri May  1 08:43:00 UTC 2020

Modified Files:
src/sys/nfs: nfs_node.c

Log Message:
Resolve delayed truncation from nfs_inactive() too.

Should prevent "locking against self" from nfs_unlock().


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/nfs/nfs_node.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/nfs/nfs_node.c
diff -u src/sys/nfs/nfs_node.c:1.125 src/sys/nfs/nfs_node.c:1.126
--- src/sys/nfs/nfs_node.c:1.125	Mon Feb 24 20:11:45 2020
+++ src/sys/nfs/nfs_node.c	Fri May  1 08:43:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_node.c,v 1.125 2020/02/24 20:11:45 ad Exp $	*/
+/*	$NetBSD: nfs_node.c,v 1.126 2020/05/01 08:43:00 hannken Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nfs_node.c,v 1.125 2020/02/24 20:11:45 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_node.c,v 1.126 2020/05/01 08:43:00 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_nfs.h"
@@ -186,6 +186,9 @@ nfs_inactive(void *v)
 	struct sillyrename *sp;
 	struct vnode *vp = ap->a_vp;
 
+	/* If we have a delayed truncation, do it now. */
+	nfs_delayedtruncate(vp);
+
 	np = VTONFS(vp);
 	if (vp->v_type != VDIR) {
 		sp = np->n_sillyrename;



CVS commit: src

2020-05-01 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri May  1 08:32:50 UTC 2020

Modified Files:
src/common/lib/libc/arch/i386/atomic: atomic.S
src/sys/arch/i386/include: frameasm.h
src/sys/arch/x86/x86: patch.c

Log Message:
Use the hotpatch framework when patching _atomic_cas_64.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/common/lib/libc/arch/i386/atomic/atomic.S
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/i386/include/frameasm.h
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/x86/x86/patch.c

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

Modified files:

Index: src/common/lib/libc/arch/i386/atomic/atomic.S
diff -u src/common/lib/libc/arch/i386/atomic/atomic.S:1.28 src/common/lib/libc/arch/i386/atomic/atomic.S:1.29
--- src/common/lib/libc/arch/i386/atomic/atomic.S:1.28	Sun Apr 26 14:49:17 2020
+++ src/common/lib/libc/arch/i386/atomic/atomic.S	Fri May  1 08:32:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic.S,v 1.28 2020/04/26 14:49:17 maxv Exp $	*/
+/*	$NetBSD: atomic.S,v 1.29 2020/05/01 08:32:50 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -48,12 +48,12 @@
 #define LOCK			HOTPATCH(HP_NAME_NOLOCK, 1); lock
 #define HOTPATCH_SSE2_LFENCE	HOTPATCH(HP_NAME_SSE2_LFENCE, 7);
 #define HOTPATCH_SSE2_MFENCE	HOTPATCH(HP_NAME_SSE2_MFENCE, 7);
-#define ENDLABEL(a)		_ALIGN_TEXT; LABEL(a)
+#define HOTPATCH_CAS_64		HOTPATCH(HP_NAME_CAS_64, 49);
 #else
 #define LOCK			lock
 #define HOTPATCH_SSE2_LFENCE	/* nothing */
 #define HOTPATCH_SSE2_MFENCE	/* nothing */
-#define ENDLABEL(a)		/* nothing */
+#define HOTPATCH_CAS_64		/* nothing */
 #endif
 
 	.text
@@ -207,10 +207,12 @@ END(_membar_sync)
 STRONG_ALIAS(_atomic_cas_64,_atomic_cas_cx8)
 #else
 ENTRY(_atomic_cas_64)
+	HOTPATCH_CAS_64
+	/* 49 bytes of instructions */
 #ifdef _HARDKERNEL
 	pushf
 	cli
-#endif /* _HARDKERNEL */
+#endif
 	pushl	%edi
 	pushl	%ebx
 	movl	12(%esp), %edi
@@ -229,17 +231,17 @@ ENTRY(_atomic_cas_64)
 	popl	%edi
 #ifdef _HARDKERNEL
 	popf
-#endif /* _HARDKERNEL */
+#endif
 	ret
 2:
 	movl	0(%edi), %eax
 	movl	4(%edi), %edx
 	jmp	1b
 END(_atomic_cas_64)
-ENDLABEL(_atomic_cas_64_end)
-#endif /* !XEN */
+#endif /* !XENPV */
 
 ENTRY(_atomic_cas_cx8)
+	/* 49 bytes of instructions */
 	pushl	%edi
 	pushl	%ebx
 	movl	12(%esp), %edi
@@ -253,14 +255,10 @@ ENTRY(_atomic_cas_cx8)
 	popl	%edi
 	ret
 #ifdef _HARDKERNEL
-#ifdef GPROF
-	.space	16, 0x90
-#else
-	.space	32, 0x90
+	.space	20, 0xCC
 #endif
-#endif /* _HARDKERNEL */
 END(_atomic_cas_cx8)
-ENDLABEL(_atomic_cas_cx8_end)
+LABEL(_atomic_cas_cx8_end)
 #endif /* __HAVE_ATOMIC64_OPS || _KERNEL */
 
 ALIAS(atomic_add_32,_atomic_add_32)

Index: src/sys/arch/i386/include/frameasm.h
diff -u src/sys/arch/i386/include/frameasm.h:1.31 src/sys/arch/i386/include/frameasm.h:1.32
--- src/sys/arch/i386/include/frameasm.h:1.31	Sun Apr 26 14:49:17 2020
+++ src/sys/arch/i386/include/frameasm.h	Fri May  1 08:32:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: frameasm.h,v 1.31 2020/04/26 14:49:17 maxv Exp $	*/
+/*	$NetBSD: frameasm.h,v 1.32 2020/05/01 08:32:50 maxv Exp $	*/
 
 #ifndef _I386_FRAMEASM_H_
 #define _I386_FRAMEASM_H_
@@ -50,6 +50,7 @@
 #define HP_NAME_RETFENCE	4
 #define HP_NAME_SSE2_LFENCE	5
 #define HP_NAME_SSE2_MFENCE	6
+#define HP_NAME_CAS_64		7
 
 #define HOTPATCH(name, size) \
 123:		; \

Index: src/sys/arch/x86/x86/patch.c
diff -u src/sys/arch/x86/x86/patch.c:1.43 src/sys/arch/x86/x86/patch.c:1.44
--- src/sys/arch/x86/x86/patch.c:1.43	Thu Apr 30 17:17:33 2020
+++ src/sys/arch/x86/x86/patch.c	Fri May  1 08:32:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: patch.c,v 1.43 2020/04/30 17:17:33 maxv Exp $	*/
+/*	$NetBSD: patch.c,v 1.44 2020/05/01 08:32:50 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.43 2020/04/30 17:17:33 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.44 2020/05/01 08:32:50 maxv Exp $");
 
 #include "opt_lockdebug.h"
 #ifdef i386
@@ -69,14 +69,6 @@ void	i686_mutex_spin_exit(int);
 void	i686_mutex_spin_exit_end(void);
 void	i686_mutex_spin_exit_patch(void);
 
-void	_atomic_cas_64(void);
-void	_atomic_cas_64_end(void);
-void	_atomic_cas_cx8(void);
-void	_atomic_cas_cx8_end(void);
-
-#define	X86_NOP		0x90
-#define	X86_REP		0xf3
-#define	X86_RET		0xc3
 #define	X86_CS		0x2e
 #define	X86_DS		0x3e
 #define	X86_GROUP_0F	0x0f
@@ -229,11 +221,11 @@ x86_patch(bool early)
 	 * may be gone.
 	 */
 	if ((cpu_feature[0] & CPUID_CX8) != 0) {
-		patchfunc(
-		_atomic_cas_cx8, _atomic_cas_cx8_end,
-		_atomic_cas_64, _atomic_cas_64_end,
-		NULL
-		);
+		extern uint8_t _atomic_cas_cx8, _atomic_cas_cx8_end;
+
+		bytes = &_atomic_cas_cx8;
+		size = (size_t)&_atomic_cas_cx8_end - (size_t)&_atomic_cas_cx8;
+		x86_hotpatch(HP_NAME_CAS_64, bytes, size);
 	}
 
 #if !defined(SPLDEBUG)



CVS commit: src/sys

2020-05-01 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Fri May  1 08:21:27 UTC 2020

Modified Files:
src/sys/arch/hppa/include: param.h
src/sys/arch/m68k/include: param.h
src/sys/arch/sh3/include: param.h
src/sys/arch/sparc/include: param.h
src/sys/arch/vax/include: param.h
src/sys/dev/audio: audio.c

Log Message:
Move machine dependent AUDIO_BLK_MS default value to .
If the port has __AUDIO_BLK_MS in , it will be used.
Otherwise the default value (currently 10 msec) defined in audio.c will
be used.  This mechanism is for very old ports which cannot satisfactorily
handle 10 msec block.  Currently hppa, m68k, sh3, sparc(!64) and vax are.

For port maintainers, if general models in your port cannot satisfactorily
handle 10 msec block, please consider to define your suitable longer period
(40 msec would be a good first choice).
But please don't be eager to make the default value shorter.

 was discussed in source-changes-d.  It's better than
ifdef storm, or adding 60+ new header files in every arch/*/include/
directories for this.  Thanks mrg@, ad@, and everyone.
http://mail-index.netbsd.org/source-changes-d/2020/05/01/msg012572.html


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/hppa/include/param.h
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/m68k/include/param.h
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/sh3/include/param.h
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/sparc/include/param.h
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/vax/include/param.h
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/audio/audio.c

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

Modified files:

Index: src/sys/arch/hppa/include/param.h
diff -u src/sys/arch/hppa/include/param.h:1.26 src/sys/arch/hppa/include/param.h:1.27
--- src/sys/arch/hppa/include/param.h:1.26	Sat Mar 21 17:00:47 2020
+++ src/sys/arch/hppa/include/param.h	Fri May  1 08:21:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.26 2020/03/21 17:00:47 riastradh Exp $	*/
+/*	$NetBSD: param.h,v 1.27 2020/05/01 08:21:27 isaki Exp $	*/
 
 /*	$OpenBSD: param.h,v 1.12 2001/07/06 02:07:41 provos Exp $	*/
 
@@ -88,3 +88,8 @@
 
 #define btop(x)		((unsigned long)(x) >> PGSHIFT)
 #define ptob(x)		((unsigned long)(x) << PGSHIFT)
+
+/* Default audio blocksize in msec.  See sys/dev/audio/audio.c */
+#if defined(_KERNEL)
+#define	__AUDIO_BLK_MS (40)
+#endif

Index: src/sys/arch/m68k/include/param.h
diff -u src/sys/arch/m68k/include/param.h:1.22 src/sys/arch/m68k/include/param.h:1.23
--- src/sys/arch/m68k/include/param.h:1.22	Mon Jan  7 22:00:31 2019
+++ src/sys/arch/m68k/include/param.h	Fri May  1 08:21:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.22 2019/01/07 22:00:31 jdolecek Exp $	*/
+/*	$NetBSD: param.h,v 1.23 2020/05/01 08:21:27 isaki Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -95,4 +95,9 @@
 #define	m68k_btop(x)		((vaddr_t)(x) >> PGSHIFT)
 #define	m68k_ptob(x)		((vaddr_t)(x) << PGSHIFT)
 
+/* Default audio blocksize in msec.  See sys/dev/audio/audio.c */
+#if defined(_KERNEL)
+#define	__AUDIO_BLK_MS (40)
+#endif
+
 #endif	/* !_M68K_PARAM_H_ */

Index: src/sys/arch/sh3/include/param.h
diff -u src/sys/arch/sh3/include/param.h:1.24 src/sys/arch/sh3/include/param.h:1.25
--- src/sys/arch/sh3/include/param.h:1.24	Mon Jan  7 22:00:32 2019
+++ src/sys/arch/sh3/include/param.h	Fri May  1 08:21:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.24 2019/01/07 22:00:32 jdolecek Exp $	*/
+/*	$NetBSD: param.h,v 1.25 2020/05/01 08:21:27 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved.
@@ -91,4 +91,9 @@
 #define	NKMEMPAGES_MIN_DEFAULT	((16 * 1024 * 1024) >> PAGE_SHIFT)
 #define	NKMEMPAGES_MAX_DEFAULT	((128 * 1024 * 1024) >> PAGE_SHIFT)
 
+/* Default audio blocksize in msec.  See sys/dev/audio/audio.c */
+#if defined(_KERNEL)
+#define	__AUDIO_BLK_MS (40)
+#endif
+
 #endif /* !_SH3_PARAM_H_ */

Index: src/sys/arch/sparc/include/param.h
diff -u src/sys/arch/sparc/include/param.h:1.73 src/sys/arch/sparc/include/param.h:1.74
--- src/sys/arch/sparc/include/param.h:1.73	Wed May 15 16:59:10 2019
+++ src/sys/arch/sparc/include/param.h	Fri May  1 08:21:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.73 2019/05/15 16:59:10 christos Exp $ */
+/*	$NetBSD: param.h,v 1.74 2020/05/01 08:21:27 isaki Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -155,4 +155,7 @@ extern void	delay(unsigned int);
 #	define PGSHIFT		pgshift
 #endif
 
+/* Default audio blocksize in msec.  See sys/dev/audio/audio.c */
+#define	__AUDIO_BLK_MS (40)
+
 #endif /* _KERNEL || _STANDALONE */

Index: src/sys/arch/vax/include/param.h
diff -u src/sys/arch/vax/include/param.h:1.62 src/sys/arch/vax/include/param.h:1.63
--- src/sys/arch/vax/include/param.h:1.62	Mon Jan  7 22:00:33 2019
+++ src/sys/arch/vax/include/param.h	Fri May  1 08:21:27 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: param.h,v 1.62 2019/01/07 22:00:33 jdolecek Exp $*/
+/*  $NetBSD: 

CVS commit: [netbsd-9] src/doc

2020-05-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May  1 07:29:03 UTC 2020

Modified Files:
src/doc [netbsd-9]: CHANGES-9.1

Log Message:
Add Ticket #879 (this time for real)


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.48 -r1.1.2.49 src/doc/CHANGES-9.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-9.1
diff -u src/doc/CHANGES-9.1:1.1.2.48 src/doc/CHANGES-9.1:1.1.2.49
--- src/doc/CHANGES-9.1:1.1.2.48	Thu Apr 30 16:20:21 2020
+++ src/doc/CHANGES-9.1	Fri May  1 07:29:03 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.1,v 1.1.2.48 2020/04/30 16:20:21 martin Exp $
+# $NetBSD: CHANGES-9.1,v 1.1.2.49 2020/05/01 07:29:03 martin Exp $
 
 A complete list of changes from the NetBSD 9.0 release to the NetBSD 9.1
 release:
@@ -2388,3 +2388,9 @@ crypto/external/bsd/openssl/dist/crypto/
 	Fix the detection of KERN_ARND by OpenSSL.
 	[nia, ticket #878]
 
+games/fortune/strfile/strfile.c			1.39
+games/fortune/unstr/unstr.c			1.15
+
+	Fix potential buffer overflows in fortune tools.
+	[nia, ticket #879]
+



CVS commit: src/sys/dev/ic

2020-05-01 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri May  1 07:27:52 UTC 2020

Modified Files:
src/sys/dev/ic: com.c

Log Message:
Get rid of needless __predict_true() and move a comment slightly.


To generate a diff of this commit:
cvs rdiff -u -r1.357 -r1.358 src/sys/dev/ic/com.c

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

Modified files:

Index: src/sys/dev/ic/com.c
diff -u src/sys/dev/ic/com.c:1.357 src/sys/dev/ic/com.c:1.358
--- src/sys/dev/ic/com.c:1.357	Sat Feb  1 15:24:04 2020
+++ src/sys/dev/ic/com.c	Fri May  1 07:27:51 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.357 2020/02/01 15:24:04 skrll Exp $ */
+/* $NetBSD: com.c,v 1.358 2020/05/01 07:27:51 simonb Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.357 2020/02/01 15:24:04 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.358 2020/05/01 07:27:51 simonb Exp $");
 
 #include "opt_com.h"
 #include "opt_ddb.h"
@@ -2442,11 +2442,11 @@ cominit(struct com_regs *regsp, int rate
 	}
 
 	rate = comspeed(rate, frequency, type);
-	if (__predict_true(rate != -1)) {
+	if (rate != -1) {
 		if (type == COM_TYPE_AU1x00) {
+			/* no EFR on alchemy */
 			CSR_WRITE_2(regsp, COM_REG_DLBL, rate);
 		} else {
-			/* no EFR on alchemy */
 			if ((type != COM_TYPE_16550_NOERS) && 
 			(type != COM_TYPE_INGENIC)) {
 CSR_WRITE_1(regsp, COM_REG_LCR, LCR_EERS);



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

2020-05-01 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri May  1 07:03:02 UTC 2020

Modified Files:
src/sys/arch/amd64/amd64: vector.S

Log Message:
Explicitly align to 8 bytes, found by kUBSan.

Reported-by: syzbot+f1e1561ed739db869...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/amd64/amd64/vector.S

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

Modified files:

Index: src/sys/arch/amd64/amd64/vector.S
diff -u src/sys/arch/amd64/amd64/vector.S:1.75 src/sys/arch/amd64/amd64/vector.S:1.76
--- src/sys/arch/amd64/amd64/vector.S:1.75	Mon Apr 27 16:55:50 2020
+++ src/sys/arch/amd64/amd64/vector.S	Fri May  1 07:03:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.75 2020/04/27 16:55:50 bouyer Exp $	*/
+/*	$NetBSD: vector.S,v 1.76 2020/05/01 07:03:02 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -630,6 +630,7 @@ INTRSTUB(x2apic_level,31,voidop,x2apic_a
  */
 #define INTRSTUB_ARRAY_16(name) 		; \
 	.type _C_LABEL(name ## _stubs), @object	; \
+	.align 8; \
 LABEL(name ## _stubs); \
 	INTRSTUB_ENTRY(name ## 0)		; \
 	INTRSTUB_ENTRY(name ## 1)		; \
@@ -654,6 +655,7 @@ END(name ## _stubs)
  */
 #define INTRSTUB_ARRAY_32(name) 		; \
 	.type _C_LABEL(name ## _stubs), @object	; \
+	.align 8; \
 LABEL(name ## _stubs); \
 	INTRSTUB_ENTRY(name ## 0)		; \
 	INTRSTUB_ENTRY(name ## 1)		; \
@@ -745,6 +747,7 @@ END(entry_xenev)
 	.quad entry_xenev , _C_LABEL(Xrecurse_ ## name ## sir); \
 	.quad _C_LABEL(Xresume_ ## name ## sir);
 
+	.align 8
 LABEL(xenev_stubs)
 	XENINTRSTUB_ENTRY(xenev, SIR_XENIPL_VM) ;
 	XENINTRSTUB_ENTRY(xenev, SIR_XENIPL_SCHED) ;